preview: improve sidebar layout and screenshot export
Validate / Validate (push) Successful in 3m29s
Validate / Validate (push) Successful in 3m29s
This commit is contained in:
1 parent
e51e2e9996
commit
6733e81356
8 files changed
+259
-118
No files matched your search
@@ -21,6 +21,9 @@ REQUIRED_FILES = (
|
||||
"docs/README.zh-CN.md",
|
||||
"docs/CONTRIBUTING.zh-CN.md",
|
||||
"preview/index.html",
|
||||
"preview/lib/html2canvas/html2canvas.min.js",
|
||||
"preview/lib/html2canvas/LICENSE",
|
||||
"preview/lib/html2canvas/README.md",
|
||||
)
|
||||
OPTIONAL_ROOT_DOCUMENTS = ("AGENTS.md", "THIRD_PARTY_NOTICES.md")
|
||||
DOCUMENTATION_DIRECTORIES = ("docs", ".github/release-notes")
|
||||
|
||||
@@ -30,6 +30,9 @@ class PackagingTests(unittest.TestCase):
|
||||
"docs/README.zh-CN.md",
|
||||
"docs/CONTRIBUTING.zh-CN.md",
|
||||
"preview/index.html",
|
||||
"preview/lib/html2canvas/html2canvas.min.js",
|
||||
"preview/lib/html2canvas/LICENSE",
|
||||
"preview/lib/html2canvas/README.md",
|
||||
"docs/images/README.md",
|
||||
)
|
||||
|
||||
@@ -130,8 +133,15 @@ class PackagingTests(unittest.TestCase):
|
||||
self.assertEqual(expected_members, zipped)
|
||||
self.assertEqual(expected_members, tarred)
|
||||
self.assertIn(prefix + "themes/demo/mail/base/head.tmpl", zipped)
|
||||
for name in ("html2canvas.min.js", "LICENSE", "README.md"):
|
||||
self.assertIn(prefix + "preview/lib/html2canvas/" + name, zipped)
|
||||
self.assertFalse(any("stale" in name or "/build/" in name for name in zipped))
|
||||
|
||||
def test_missing_screenshot_library_is_rejected(self):
|
||||
(self.root / "preview/lib/html2canvas/html2canvas.min.js").unlink()
|
||||
with self.assertRaisesRegex(ValueError, "Expected regular file"):
|
||||
PACKER.collect(self.root, self.VERSION)
|
||||
|
||||
def test_existing_archives_are_not_overwritten(self):
|
||||
PACKER.package(self.root, self.VERSION, self.output)
|
||||
original_archives = {
|
||||
|
||||
+10
-27
@@ -1,6 +1,6 @@
|
||||
# Contributing to Gitea Mail Templates
|
||||
|
||||
[简体中文](docs/CONTRIBUTING.zh-CN.md) · [Project overview](README.md) · [Compatibility](COMPATIBILITY.md)
|
||||
[简体中文](docs/CONTRIBUTING.zh-CN.md)
|
||||
|
||||
Contributions to themes, tooling, tests, documentation and translations are welcome. This guide covers the current source architecture; installation and release selection are described in the [README](README.md#installation).
|
||||
|
||||
@@ -18,7 +18,7 @@ go run . preview all
|
||||
|
||||
Open `preview/index.html` in a browser, or run `go run . dev` from `tools/` and visit [http://127.0.0.1:3456](http://127.0.0.1:3456) for live reload. The development server watches themes, the framework, the lock/cache and preview fixtures.
|
||||
|
||||
The CLI uses urfave/cli and the x/net HTML parser. Python 3.11 or later is used by the documentation and packaging checks. Node.js and the dependencies in `tools/qa` are needed only for browser QA.
|
||||
The CLI uses urfave/cli and the x/net HTML parser. Python 3.11 or later is used by the documentation and packaging checks.
|
||||
|
||||
### Common Commands
|
||||
|
||||
@@ -114,7 +114,7 @@ go test ./...
|
||||
go run . preview all
|
||||
```
|
||||
|
||||
To review a different version, specify its tag explicitly. Review the lock diff, update the framework adapter and fixtures as needed, and complete the checks and matching-instance smoke test before updating compatibility records. `sync` changes the cache and lock only; documentation and release publication are separate steps. Use `prepare` for a missing cache.
|
||||
To review a different version, specify its tag explicitly. Review the lock diff, update the framework adapter and fixtures as needed, and complete the checks before updating compatibility records. `sync` changes the cache and lock only; documentation and release publication are separate steps. Use `prepare` for a missing cache.
|
||||
|
||||
Changes to the reviewed translation or mail-renderer sources require an adapter review before their reference hashes can be updated. Official English must contain all referenced keys; other languages use English fallback. New mail types require framework alignment and fixtures in `tools/data/templates_config.json`, which supplies preview metadata and example contexts. Keep integer values as integers in JSON fixtures for Go formatting.
|
||||
|
||||
@@ -145,7 +145,7 @@ Gitea v28.0.0 contains a Polish `mail.team_invite.text_1` placeholder defect. Pr
|
||||
|
||||
From `tools/`, run `go test ./...` and `go run . preview all`. Tests cover deterministic generation, changes to action anchors, translation keys, and notification subjects, text and links across all themes and languages. Fixtures include push, review, reply, workflow and attachment branches. Shared controls and branding are accounted for separately from official notification content.
|
||||
|
||||
For documentation, tracker or packaging changes, run from the repository root:
|
||||
For documentation or packaging changes, run from the repository root:
|
||||
|
||||
```bash
|
||||
python -B -m unittest discover -s .github/scripts -p 'test_*.py'
|
||||
@@ -153,29 +153,12 @@ python -B -m unittest discover -s .github/scripts -p 'test_*.py'
|
||||
|
||||
Keep English and Simplified Chinese guides aligned when changing shared instructions. Include a description of the change, relevant checks and screenshots for visual changes in the pull request.
|
||||
|
||||
### Browser and Gitea Checks
|
||||
|
||||
After generating preview data, run the optional browser suite:
|
||||
|
||||
```bash
|
||||
cd tools/qa
|
||||
npm install
|
||||
npx playwright install chromium
|
||||
npm test
|
||||
```
|
||||
|
||||
To use installed Chrome or Edge, set `BROWSER_EXECUTABLE_PATH` instead of installing Chromium. Set `PREVIEW_DEV_URL` to include a running HTTP preview in the checks. `npm test -- --update-gallery` also refreshes gallery screenshots.
|
||||
|
||||
Before a release, test generated overrides in an isolated Gitea instance matching the locked version and capture a real password-reset or notification email. The administration test-email button bypasses custom templates.
|
||||
|
||||
The optional `tools/integration` test uses disposable SQLite data, users, Git/SSH paths and loopback SMTP. Set `GITEA_SMOKE_BINARY` to a checksum-verified official binary matching the lock, then run `go test ./integration -v -count=1` from `tools/`. It captures mail locally without sending to real users. Without this variable, the test is skipped. The release workflow does not run the optional browser or real-Gitea checks automatically.
|
||||
|
||||
### Preparing a Release
|
||||
|
||||
Release tags must match the locked Gitea version. The current source refactor is unreleased; retain existing v28.0.0 and historical assets.
|
||||
|
||||
1. Complete automated checks, preview review and the matching-instance smoke test.
|
||||
2. Add reviewed notes at `.github/release-notes/vX.Y.Z.md` and update compatibility records with the verification results.
|
||||
1. Complete the Go tests, documentation checks and preview generation.
|
||||
2. Update documentation and compatibility records with the verification results. Release notes are optional and are not used as the Release body.
|
||||
3. Generate all themes and language bundles with `go run . preview all` from `tools/`.
|
||||
4. Package the release and verify its contents before publication.
|
||||
|
||||
@@ -187,15 +170,15 @@ python .github/scripts/package_release.py --version vX.Y.Z --output <new-output-
|
||||
|
||||
Replace the version and output placeholder with the reviewed tag and a new directory. The script checks source and generated hashes, includes all language bundles, excludes stale theme builds, and refuses to overwrite existing archives.
|
||||
|
||||
The release workflow uses the same script to package templates, previews, documentation, the upstream license and provenance. It also updates managed release labels. Confirm Actions support and write permissions on the configured Gitea host before relying on automated publication. See [version tracking](COMPATIBILITY.md#version-tracking) for the managed Markdown blocks.
|
||||
The release workflow uses the same script to package templates, previews, documentation, the upstream license and provenance. It publishes only the archives, with the tag as the Release title and an empty body. Version labels, badges and compatibility records are maintained manually; review archive documentation before tagging. Confirm Actions support and write permissions on the configured Gitea host before relying on automated publication. See [version maintenance](COMPATIBILITY.md#version-maintenance).
|
||||
|
||||
### Gitea Workflow Configuration
|
||||
|
||||
Both workflows use the `linux-amd64-docker-small` runner label. The job image must support the Node.js actions used for checkout and toolchain setup, as well as Git and a POSIX shell. Go and Python are installed by the setup steps.
|
||||
The release workflow uses the `linux-amd64-docker-small` runner label. The job image must support the Node.js actions used for checkout and toolchain setup, as well as Git and a POSIX shell. Go and Python are installed by the setup steps.
|
||||
|
||||
PR creation and release uploads use `.github/scripts/gitea_actions.py` and the instance's `/api/v1` API. The workflows pass the instance URL, repository and built-in `GITEA_TOKEN`; repository settings must allow the requested code, release and pull-request writes. The optional `UPSTREAM_GITHUB_TOKEN` secret is used only to query official releases on GitHub. Without it, those queries use GitHub's unauthenticated API limit.
|
||||
Publication uses [`gitea-release-action@v1.3.7`](https://gitea.com/actions/gitea-release-action/src/tag/v1.3.7/action.yml) directly, with the instance URL, repository, built-in `GITEA_TOKEN`, tag, title and the two archive paths. The Release body is empty when created; no notes file or Issue reminder is required. The repository must allow release writes. Action URLs explicitly use `https://gitea.com` rather than depending on `DEFAULT_ACTIONS_URL`.
|
||||
|
||||
The tracker reuses an existing branch when its content matches and reuses an open PR for that branch. A differing branch requires manual review; the workflow does not force-push. Release publication refuses any existing release, including a draft. New releases remain drafts until both archives upload successfully. If an upload fails, inspect the draft before retrying; published releases and assets must remain unchanged.
|
||||
Before publication, `actions/setup-node@v4` prepares Node.js 22. The current Gitea runner executes JavaScript actions with `node` from `PATH`; this provides the runtime interfaces used by the release action without `--experimental-fetch`. On repeated publication of an existing tag, the action preserves an existing body and replaces same-name attachments. It does not provide the previous script's draft-until-all-uploads-complete behavior. Review the release and attachments before retrying a failed publication.
|
||||
|
||||
## Reporting Problems
|
||||
|
||||
|
||||
@@ -1,7 +1,5 @@
|
||||
# 贡献指南
|
||||
|
||||
[English](../CONTRIBUTING.md) · [项目概览](README.zh-CN.md) · [兼容性](../COMPATIBILITY.md)
|
||||
|
||||
欢迎改进主题、工具、测试、文档和翻译。本指南介绍当前源码架构的开发流程;安装和版本选择请参阅 [README](README.zh-CN.md#安装)。
|
||||
|
||||
## 本地开发
|
||||
@@ -18,7 +16,7 @@ go run . preview all
|
||||
|
||||
在浏览器中打开 `preview/index.html`,或在 `tools/` 中运行 `go run . dev`,访问 [http://127.0.0.1:3456](http://127.0.0.1:3456) 使用实时预览。开发服务器监听主题、框架、锁文件与缓存、预览测试数据的变化。
|
||||
|
||||
CLI 使用 urfave/cli 和 x/net HTML 解析器。文档与打包检查使用 Python 3.11 或更高版本;只有浏览器检查需要 Node.js 和 `tools/qa` 中的依赖。
|
||||
CLI 使用 urfave/cli 和 x/net HTML 解析器。文档与打包检查使用 Python 3.11 或更高版本。
|
||||
|
||||
### 常用命令
|
||||
|
||||
@@ -114,7 +112,7 @@ go test ./...
|
||||
go run . preview all
|
||||
```
|
||||
|
||||
评审其他版本时,明确指定对应标签。检查锁文件差异,按需更新框架适配逻辑和测试数据,完成检查及同版本实例冒烟测试后,再更新兼容性记录。`sync` 只修改缓存和锁文件,文档更新与版本发布需单独完成。仅缺少缓存时使用 `prepare`。
|
||||
评审其他版本时,明确指定对应标签。检查锁文件差异,按需更新框架适配逻辑和测试数据,完成检查后,再更新兼容性记录。`sync` 只修改缓存和锁文件,文档更新与版本发布需单独完成。仅缺少缓存时使用 `prepare`。
|
||||
|
||||
已评审的翻译或邮件渲染参考源码发生变化时,须先评审适配逻辑,再更新参考哈希。官方英文必须包含所有引用的翻译键;其他语言缺少的翻译回退为英文。新增邮件类型需要补充框架适配和 `tools/data/templates_config.json` 中的测试数据,该文件提供预览元数据和示例上下文。JSON 测试数据中的整数应保持整数形式,以便 Go 正确格式化。
|
||||
|
||||
@@ -145,7 +143,7 @@ Gitea v28.0.0 的波兰语 `mail.team_invite.text_1` 存在占位符缺陷。预
|
||||
|
||||
在 `tools/` 中运行 `go test ./...` 和 `go run . preview all`。测试覆盖生成结果的确定性、操作锚点变化、翻译键,以及全部主题和语言的通知主题行、正文与链接。测试数据包含推送、评审、回复、工作流和附件分支;共享控件与品牌展示作为附加内容单独处理。
|
||||
|
||||
修改文档、追踪脚本或打包流程时,在仓库根目录执行:
|
||||
修改文档或打包流程时,在仓库根目录执行:
|
||||
|
||||
```bash
|
||||
python -B -m unittest discover -s .github/scripts -p 'test_*.py'
|
||||
@@ -153,29 +151,12 @@ python -B -m unittest discover -s .github/scripts -p 'test_*.py'
|
||||
|
||||
调整通用说明时,同步更新英文和简体中文指南。拉取请求应说明改动内容及相关检查结果,涉及视觉变化时附上截图。
|
||||
|
||||
### 浏览器与 Gitea 实例检查
|
||||
|
||||
生成预览数据后,可运行浏览器检查:
|
||||
|
||||
```bash
|
||||
cd tools/qa
|
||||
npm install
|
||||
npx playwright install chromium
|
||||
npm test
|
||||
```
|
||||
|
||||
如需使用已安装的 Chrome 或 Edge,设置 `BROWSER_EXECUTABLE_PATH`,无需再安装 Chromium。设置 `PREVIEW_DEV_URL` 可同时检查运行中的 HTTP 预览。`npm test -- --update-gallery` 会一并更新画廊截图。
|
||||
|
||||
发布前,在与锁定版本一致的隔离 Gitea 实例中加载生成的模板,捕获真实的密码重置或通知邮件。管理后台的测试邮件按钮不使用自定义模板。
|
||||
|
||||
可选的 `tools/integration` 测试使用临时 SQLite 数据、用户、Git/SSH 路径和回环 SMTP。将 `GITEA_SMOKE_BINARY` 设为已校验官方校验值、版本与锁文件一致的 Gitea 可执行文件,再在 `tools/` 中运行 `go test ./integration -v -count=1`。邮件仅在本地捕获,不发送给真实用户。未设置该变量时会跳过此测试。发布工作流不会自动运行可选的浏览器和真实 Gitea 实例检查。
|
||||
|
||||
### 准备发行版
|
||||
|
||||
发行标签必须与锁定的 Gitea 版本一致。当前源码重构尚未发布,已有 v28.0.0 和历史版本的附件应保留。
|
||||
|
||||
1. 完成自动化检查、预览检查和同版本实例冒烟测试。
|
||||
2. 在 `.github/release-notes/vX.Y.Z.md` 添加已评审的发行说明,并按验证结果更新兼容性记录。
|
||||
1. 完成 Go 测试、文档检查和预览生成。
|
||||
2. 按验证结果更新文档和兼容性记录。发行说明为可选内容,不用于 Release 正文。
|
||||
3. 在 `tools/` 中运行 `go run . preview all`,生成全部主题和语言数据。
|
||||
4. 打包并检查发行包内容后再发布。
|
||||
|
||||
@@ -187,15 +168,15 @@ python .github/scripts/package_release.py --version vX.Y.Z --output <new-output-
|
||||
|
||||
将版本和输出目录占位符替换为已评审的标签及新的目录。脚本会检查源码与产物哈希,包含所有语言数据包,排除残留的旧主题构建,并拒绝覆盖已有压缩包。
|
||||
|
||||
发布工作流使用同一脚本打包模板、预览、文档、官方许可证和来源信息,并更新受管理的版本标记。依赖自动发布前,请确认所用 Gitea 主机的 Actions 支持和写入权限。Markdown 管理区块的说明见[版本追踪](../COMPATIBILITY.md#version-tracking)。
|
||||
发布工作流使用同一脚本打包模板、预览、文档、官方许可证和来源信息,仅上传发行归档,以标签作为 Release 标题,新建 Release 的正文为空。版本标记、徽章和兼容性记录均由维护者手动修改,归档文档应在打标签前检查。依赖自动发布前,请确认所用 Gitea 主机的 Actions 支持和写入权限。工作流行为见[版本维护](COMPATIBILITY.zh-CN.md#版本维护)。
|
||||
|
||||
### Gitea 工作流配置
|
||||
|
||||
两个工作流均使用 `linux-amd64-docker-small` Runner 标签。任务镜像需要支持检出和工具链安装步骤使用的 Node.js Action,并提供 Git 和 POSIX Shell。Go 与 Python 由安装步骤准备。
|
||||
发布工作流使用 `linux-amd64-docker-small` Runner 标签。任务镜像需要支持检出和工具链安装步骤使用的 Node.js Action,并提供 Git 和 POSIX Shell。Go 与 Python 由安装步骤准备。
|
||||
|
||||
PR 创建和发行附件上传通过 `.github/scripts/gitea_actions.py` 调用实例的 `/api/v1` API。工作流传入实例地址、仓库名称和内置 `GITEA_TOKEN`,仓库设置需要允许所请求的代码、发行版及拉取请求写入权限。可选的 `UPSTREAM_GITHUB_TOKEN` Secret 仅用于查询 GitHub 上的官方发行版;未配置时使用 GitHub 的匿名 API 限额。
|
||||
发布直接使用 [`gitea-release-action@v1.3.7`](https://gitea.com/actions/gitea-release-action/src/tag/v1.3.7/action.yml),传入实例地址、仓库、内置 `GITEA_TOKEN`、标签、标题和两个归档路径。新建 Release 的正文为空,不要求发行说明文件,也不创建提醒 Issue。仓库需允许发行版写入。Action 地址显式使用 `https://gitea.com`,不依赖 `DEFAULT_ACTIONS_URL` 配置。
|
||||
|
||||
追踪工作流会复用内容相同的已有分支及对应的未关闭 PR。分支内容不同时需要人工检查,工作流不会强制推送。发布流程拒绝修改任何已有发行版,包括草稿;新版本在两个压缩包上传成功后才从草稿转为发布状态。上传失败时,重试前先检查草稿;已发布版本及附件应保持不变。
|
||||
发布前通过 `actions/setup-node@v4` 准备 Node.js 22。当前 Gitea runner 使用 `PATH` 中的 `node` 执行 JavaScript Action,提供发布 Action 所需的运行接口,无需 `--experimental-fetch`。重复发布已有标签时,Action 保留已有正文并替换同名附件,不具备原脚本在全部附件上传完成前保持草稿的行为。发布失败后,重试前应检查发行版和附件。
|
||||
|
||||
## 报告问题
|
||||
|
||||
|
||||
+174
-63
@@ -29,6 +29,11 @@ body{font-family:system-ui,-apple-system,sans-serif;background:var(--bg);color:v
|
||||
#topbar .btn-group button+button{border-left:none}
|
||||
#topbar .btn-group button.on{background:var(--accent);color:#000;border-color:var(--accent);font-weight:600}
|
||||
#topbar .hint{font-size:10px;color:var(--muted);opacity:.5;white-space:nowrap}
|
||||
#btn-screenshot{display:inline-flex;align-items:center;gap:6px;background:var(--bg);color:var(--text);border:1px solid var(--border);border-radius:var(--rad);padding:6px 12px;font-size:12px;cursor:pointer}
|
||||
#btn-screenshot svg{width:16px;height:16px;fill:none;stroke:currentColor;stroke-width:1.8;flex-shrink:0}
|
||||
#btn-screenshot:hover:not(:disabled){border-color:var(--accent)}
|
||||
#btn-screenshot:disabled{opacity:.45;cursor:wait}
|
||||
button:focus-visible{outline:2px solid var(--accent);outline-offset:3px}
|
||||
|
||||
/* Topbar responsive — progressively compact as width shrinks */
|
||||
@media(max-width:900px){#topbar .hint{display:none}}
|
||||
@@ -49,32 +54,29 @@ body{font-family:system-ui,-apple-system,sans-serif;background:var(--bg);color:v
|
||||
|
||||
/* Main layout */
|
||||
#main{flex:1;display:flex;position:relative;min-height:0;overflow:hidden}
|
||||
#preview-area{flex:1;display:flex;align-items:flex-start;justify-content:center;padding:24px;overflow:auto;background:linear-gradient(135deg,#0b1120,#131c30,#0d1525);transition:padding-right .3s cubic-bezier(.4,0,.2,1)}
|
||||
#preview-area{flex:1;min-width:0;min-height:0;display:flex;align-items:flex-start;justify-content:center;padding:24px;overflow:auto;background:linear-gradient(135deg,#0b1120,#131c30,#0d1525)}
|
||||
|
||||
/* --- Floating panel --- */
|
||||
/* Panel and preview share the available width; the handle occupies its own gutter. */
|
||||
#panel{
|
||||
position:absolute;right:12px;top:12px;bottom:12px;
|
||||
width:var(--panel-w);
|
||||
--panel-w:min(440px,40vw);
|
||||
position:relative;flex:0 0 var(--panel-w);width:var(--panel-w);min-width:0;
|
||||
margin:12px 12px 12px 40px;
|
||||
background:var(--surface);
|
||||
border:1px solid var(--border);
|
||||
border-radius:10px;
|
||||
box-shadow:-4px 4px 32px rgba(0,0,0,.5),0 0 0 1px rgba(255,255,255,.03) inset;
|
||||
z-index:20;
|
||||
display:flex;flex-direction:column;
|
||||
overflow:hidden;
|
||||
transition:transform .35s cubic-bezier(.4,0,.2,1),opacity .35s ease,box-shadow .35s ease;
|
||||
transition:flex-basis .3s ease,width .3s ease;
|
||||
}
|
||||
#panel.collapsed{
|
||||
transform:translateX(calc(var(--panel-w) - 36px));
|
||||
box-shadow:-2px 2px 16px rgba(0,0,0,.35),0 0 0 1px rgba(255,255,255,.03) inset;
|
||||
opacity:.92;
|
||||
flex-basis:0;width:0;border-width:0;background:transparent;box-shadow:none;
|
||||
}
|
||||
#panel.collapsed:hover{opacity:1}
|
||||
#panel.collapsed #panel-body{visibility:hidden}
|
||||
|
||||
/* Panel drag-handle / collapse tab */
|
||||
#panel-handle{
|
||||
position:absolute;left:0;top:50%;transform:translateY(-50%);
|
||||
width:28px;height:64px;
|
||||
position:absolute;left:-40px;top:50%;transform:translateY(-50%);
|
||||
width:40px;height:80px;
|
||||
background:var(--surface);
|
||||
border:1px solid var(--border);
|
||||
border-right:none;
|
||||
@@ -82,17 +84,11 @@ body{font-family:system-ui,-apple-system,sans-serif;background:var(--bg);color:v
|
||||
cursor:pointer;
|
||||
display:flex;align-items:center;justify-content:center;
|
||||
transition:background .15s;
|
||||
z-index:21;
|
||||
/* sit just outside the panel's left edge */
|
||||
margin-left:-1px;
|
||||
}
|
||||
#panel.collapsed #panel-handle{
|
||||
/* when collapsed, handle moves with panel, peeking from right edge */
|
||||
left:1px;
|
||||
color:var(--muted);
|
||||
}
|
||||
#panel-handle:hover{background:var(--bg)}
|
||||
#panel-handle svg{
|
||||
width:14px;height:14px;
|
||||
width:20px;height:20px;
|
||||
stroke:var(--muted);
|
||||
fill:none;stroke-width:2;
|
||||
transition:transform .35s cubic-bezier(.4,0,.2,1),stroke .15s;
|
||||
@@ -101,22 +97,7 @@ body{font-family:system-ui,-apple-system,sans-serif;background:var(--bg);color:v
|
||||
#panel.collapsed #panel-handle svg{transform:rotate(180deg)}
|
||||
|
||||
/* Panel inner scroll */
|
||||
#panel-body{flex:1;overflow-y:auto;overflow-x:hidden}
|
||||
|
||||
/* Panel close button (top-right) */
|
||||
#panel-close{
|
||||
position:absolute;right:8px;top:8px;
|
||||
width:24px;height:24px;
|
||||
background:none;border:none;
|
||||
cursor:pointer;
|
||||
display:flex;align-items:center;justify-content:center;
|
||||
border-radius:4px;
|
||||
color:var(--muted);
|
||||
font-size:16px;line-height:1;
|
||||
transition:background .15s,color .15s;
|
||||
z-index:2;
|
||||
}
|
||||
#panel-close:hover{background:rgba(255,255,255,.06);color:var(--text)}
|
||||
#panel-body{flex:1;min-height:0;overflow-y:auto;overflow-x:hidden;border-radius:10px}
|
||||
|
||||
/* Section */
|
||||
#panel section{padding:12px 14px;border-bottom:1px solid var(--border)}
|
||||
@@ -148,17 +129,12 @@ section.collapsed .section-chevron{transform:rotate(-90deg)}
|
||||
|
||||
/* Collapsible content wrapper */
|
||||
.section-content{
|
||||
overflow:hidden;
|
||||
transition:max-height .3s ease,opacity .25s ease,margin-top .3s ease;
|
||||
max-height:2000px;
|
||||
opacity:1;
|
||||
margin-top:10px;
|
||||
}
|
||||
section.collapsed .section-content{
|
||||
max-height:0;
|
||||
opacity:0;
|
||||
margin-top:0;
|
||||
display:none;
|
||||
}
|
||||
#sec-params .section-content{max-height:50vh;overflow:auto;overscroll-behavior:contain}
|
||||
|
||||
#panel .card{background:var(--bg);border-radius:var(--rad);padding:10px 12px;margin-bottom:8px}
|
||||
#panel .card:last-child{margin-bottom:0}
|
||||
@@ -166,17 +142,19 @@ section.collapsed .section-content{
|
||||
#panel .card .value{font-size:12px;color:var(--text)}
|
||||
#panel table{width:100%;border-collapse:collapse}
|
||||
#panel table td{padding:4px 6px;font-size:11px;border-bottom:1px solid rgba(255,255,255,.03);vertical-align:top}
|
||||
#panel table td:first-child{font-family:monospace;color:var(--accent);font-size:10px;width:0;white-space:nowrap}
|
||||
#panel table td:last-child{color:var(--muted);text-align:right;font-size:10px;word-break:break-all}
|
||||
#panel table td:first-child{font-family:monospace;color:var(--accent);font-size:10px;overflow-wrap:anywhere}
|
||||
#panel table td:nth-child(2){color:var(--muted);font-size:10px;overflow-wrap:anywhere}
|
||||
#panel table td:last-child{text-align:right;width:1%}
|
||||
#panel .badge{display:inline-block;font-size:9px;padding:1px 6px;border-radius:3px;font-weight:600;letter-spacing:.2px;white-space:nowrap}
|
||||
.badge-req{background:rgba(52,211,153,.12);color:var(--green)}
|
||||
.badge-opt{background:rgba(107,125,153,.1);color:var(--muted)}
|
||||
#panel .stat{font-size:10px;color:var(--muted);margin-top:6px}
|
||||
|
||||
/* Viewport */
|
||||
#viewport{border-radius:var(--rad);box-shadow:0 8px 32px rgba(0,0,0,.45);transition:all .3s;flex-shrink:0;overflow:hidden;background:#fff}
|
||||
#viewport.desktop{width:1386px;height:780px}
|
||||
#viewport{border-radius:var(--rad);box-shadow:0 8px 32px rgba(0,0,0,.45);flex-shrink:0;max-width:100%;overflow:hidden;background:#fff}
|
||||
#viewport.desktop{width:100%;max-width:1386px;height:780px}
|
||||
#viewport.mobile{width:390px;height:780px;border-radius:28px;border:3px solid #1e293b;box-shadow:0 8px 32px rgba(0,0,0,.5),inset 0 0 0 1px #0f172a;display:flex;flex-direction:column}
|
||||
#viewport.mobile #preview-frame{flex:1;min-height:0}
|
||||
#viewport.mobile::before{content:'';display:block;height:24px;background:#1e293b;flex-shrink:0}
|
||||
#preview-frame{width:100%;height:100%;border:none;display:block;background:#fff}
|
||||
#viewport.desktop #preview-frame{border-radius:var(--rad)}
|
||||
@@ -193,7 +171,7 @@ section.collapsed .section-content{
|
||||
.message code{background:rgba(0,0,0,0.12);padding:1px 6px;border-radius:3px}
|
||||
|
||||
/* Scrollbar — neutral gray, consistent across all browsers */
|
||||
html,body,#preview-area,#panel-body{
|
||||
html,body,#preview-area,#panel-body,#sec-params .section-content{
|
||||
scrollbar-width:thin;
|
||||
scrollbar-color:rgba(107,125,153,.25) transparent;
|
||||
}
|
||||
@@ -201,27 +179,30 @@ html,body,#preview-area,#panel-body{
|
||||
-ms-overflow-style:-ms-autohiding-scrollbar;
|
||||
}
|
||||
#preview-area::-webkit-scrollbar,
|
||||
#sec-params .section-content::-webkit-scrollbar,
|
||||
#panel-body::-webkit-scrollbar { width:6px; height:6px }
|
||||
#preview-area::-webkit-scrollbar-track,
|
||||
#sec-params .section-content::-webkit-scrollbar-track,
|
||||
#panel-body::-webkit-scrollbar-track { background:transparent }
|
||||
#preview-area::-webkit-scrollbar-thumb,
|
||||
#sec-params .section-content::-webkit-scrollbar-thumb,
|
||||
#panel-body::-webkit-scrollbar-thumb {
|
||||
background-color:rgba(107,125,153,.25);
|
||||
border-radius:3px;
|
||||
border:1px solid rgba(255,255,255,.06);
|
||||
}
|
||||
#preview-area::-webkit-scrollbar-thumb:hover,
|
||||
#sec-params .section-content::-webkit-scrollbar-thumb:hover,
|
||||
#panel-body::-webkit-scrollbar-thumb:hover { background-color:rgba(107,125,153,.45) }
|
||||
#preview-area::-webkit-scrollbar-corner,
|
||||
#sec-params .section-content::-webkit-scrollbar-corner,
|
||||
#panel-body::-webkit-scrollbar-corner { background:transparent }
|
||||
|
||||
@media(max-width:900px){
|
||||
#panel{--panel-w:380px;right:6px;top:6px;bottom:6px}
|
||||
#panel.collapsed{transform:translateX(calc(var(--panel-w) - 36px))}
|
||||
}
|
||||
@media(max-width:700px){
|
||||
#panel{display:none}
|
||||
#panel{--panel-w:50vw;margin-top:6px;margin-bottom:6px;margin-right:6px}
|
||||
#preview-area{padding:12px}
|
||||
}
|
||||
@media(prefers-reduced-motion:reduce){#panel,#panel-handle svg{transition:none}}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
@@ -256,6 +237,10 @@ html,body,#preview-area,#panel-body{
|
||||
<button id="btn-desk" class="on" onclick="setViewport('desktop')">Desktop</button>
|
||||
<button id="btn-mob" onclick="setViewport('mobile')">Mobile</button>
|
||||
</div>
|
||||
<button id="btn-screenshot" type="button" onclick="capturePreview()" disabled>
|
||||
<svg viewBox="0 0 24 24" aria-hidden="true"><path d="M8 5l1.5-2h5L16 5h4a2 2 0 0 1 2 2v12a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2V7a2 2 0 0 1 2-2z"/><circle cx="12" cy="13" r="4"/></svg>
|
||||
<span id="screenshot-label">Screenshot</span>
|
||||
</button>
|
||||
<span class="hint">keys: d/m ←→ tab ↑↓ select p toggle panel</span>
|
||||
</nav>
|
||||
|
||||
@@ -274,12 +259,9 @@ html,body,#preview-area,#panel-body{
|
||||
|
||||
<aside id="panel">
|
||||
<!-- Collapse handle tab on the left edge -->
|
||||
<div id="panel-handle" title="Toggle panel" onclick="togglePanel()">
|
||||
<svg viewBox="0 0 24 24"><polyline points="15 18 9 12 15 6"/></svg>
|
||||
</div>
|
||||
|
||||
<!-- Close button (top-right) -->
|
||||
<button id="panel-close" title="Close panel" onclick="togglePanel()">×</button>
|
||||
<button id="panel-handle" type="button" title="Collapse panel" aria-label="Collapse panel" aria-expanded="true" aria-controls="panel-body" onclick="togglePanel()">
|
||||
<svg viewBox="0 0 24 24" aria-hidden="true"><polyline points="9 18 15 12 9 6"/></svg>
|
||||
</button>
|
||||
|
||||
<div id="panel-body">
|
||||
<section id="sec-info">
|
||||
@@ -323,6 +305,7 @@ html,body,#preview-area,#panel-body{
|
||||
</aside>
|
||||
</div>
|
||||
|
||||
<script src="lib/html2canvas/html2canvas.min.js"></script>
|
||||
<script src="rendered.js"></script>
|
||||
<script>
|
||||
//
|
||||
@@ -337,6 +320,122 @@ let localeRequest = 0;
|
||||
let renderRequest = 0, renderTimer;
|
||||
const localeLoads = new Map();
|
||||
let devMode = false; // true once SSE connects
|
||||
let previewReady = false;
|
||||
let capturing = false;
|
||||
|
||||
function updateCaptureButton() {
|
||||
document.getElementById('btn-screenshot').disabled = !previewReady || capturing;
|
||||
}
|
||||
|
||||
// Capture only the visible viewport, including the mobile frame when selected.
|
||||
async function capturePreview() {
|
||||
if (!previewReady || capturing) return;
|
||||
const label = document.getElementById('screenshot-label');
|
||||
const selection = { ...state };
|
||||
const request = renderRequest;
|
||||
const frame = document.getElementById('preview-frame');
|
||||
const viewport = document.getElementById('viewport');
|
||||
capturing = true;
|
||||
label.textContent = 'Capturing…';
|
||||
updateCaptureButton();
|
||||
document.getElementById('capture-message')?.remove();
|
||||
try {
|
||||
if (typeof html2canvas !== 'function') throw new Error('Screenshot library unavailable; restore preview/lib/html2canvas.');
|
||||
const doc = frame.contentDocument;
|
||||
if (!doc) throw new Error('Preview document is not accessible.');
|
||||
if (doc.fonts) await doc.fonts.ready;
|
||||
await Promise.all(Array.from(doc.images, image => image.decode().catch(() => {})));
|
||||
if (request !== renderRequest || !previewReady) throw new Error('Preview changed; capture again after it finishes loading.');
|
||||
const width = viewport.offsetWidth;
|
||||
const height = viewport.offsetHeight;
|
||||
const frameWidth = frame.clientWidth;
|
||||
const frameHeight = frame.clientHeight;
|
||||
const scrollX = frame.contentWindow.scrollX;
|
||||
const scrollY = frame.contentWindow.scrollY;
|
||||
const viewportBounds = viewport.getBoundingClientRect();
|
||||
const frameBounds = frame.getBoundingClientRect();
|
||||
const frameLeft = frameBounds.left - viewportBounds.left;
|
||||
const frameTop = frameBounds.top - viewportBounds.top;
|
||||
const scale = Math.min(window.devicePixelRatio || 1, 2);
|
||||
// Render in the mail document's own coordinates. Rendering nested iframes
|
||||
// with the outer document's context can shift centered tables and text.
|
||||
const mailCanvas = await html2canvas(doc.documentElement, {
|
||||
backgroundColor: '#fff',
|
||||
scale,
|
||||
width: frameWidth,
|
||||
height: frameHeight,
|
||||
windowWidth: frameWidth,
|
||||
windowHeight: frameHeight,
|
||||
x: scrollX,
|
||||
y: scrollY,
|
||||
scrollX,
|
||||
scrollY,
|
||||
useCORS: true,
|
||||
logging: false
|
||||
});
|
||||
const canvas = await html2canvas(viewport, {
|
||||
backgroundColor: null,
|
||||
scale,
|
||||
width,
|
||||
height,
|
||||
useCORS: true,
|
||||
logging: false,
|
||||
ignoreElements: element => element.id === 'preview-frame',
|
||||
onclone: clone => {
|
||||
const clonedViewport = clone.getElementById('viewport');
|
||||
clonedViewport.style.width = width + 'px';
|
||||
clonedViewport.style.maxWidth = 'none';
|
||||
clonedViewport.style.height = height + 'px';
|
||||
}
|
||||
});
|
||||
if (request !== renderRequest || !previewReady) throw new Error('Preview changed; capture again after it finishes loading.');
|
||||
const context = canvas.getContext('2d');
|
||||
if (!context) throw new Error('Could not create the screenshot canvas.');
|
||||
const style = getComputedStyle(viewport);
|
||||
const border = parseFloat(style.borderLeftWidth) || 0;
|
||||
const radius = Math.max(0, (parseFloat(style.borderTopLeftRadius) || 0) - border);
|
||||
// Clip the composite to the container's inner rounded border, including
|
||||
// the mobile frame. No top bar or sidebar enters the exported image.
|
||||
const left = border, top = border;
|
||||
const right = width - border, bottom = height - border;
|
||||
const rounding = Math.min(radius, (right - left) / 2, (bottom - top) / 2);
|
||||
context.save();
|
||||
context.scale(scale, scale);
|
||||
context.beginPath();
|
||||
context.moveTo(left + rounding, top);
|
||||
context.arcTo(right, top, right, bottom, rounding);
|
||||
context.arcTo(right, bottom, left, bottom, rounding);
|
||||
context.arcTo(left, bottom, left, top, rounding);
|
||||
context.arcTo(left, top, right, top, rounding);
|
||||
context.closePath();
|
||||
context.clip();
|
||||
context.drawImage(mailCanvas, frameLeft, frameTop, frameWidth, frameHeight);
|
||||
context.restore();
|
||||
const blob = await new Promise((resolve, reject) => canvas.toBlob(
|
||||
value => value ? resolve(value) : reject(new Error('Could not encode the screenshot.')),
|
||||
'image/png'
|
||||
));
|
||||
const filename = [selection.theme, selection.template, selection.locale]
|
||||
.map(value => value.replace(/[<>:"/\\|?*\x00-\x1f]/g, '-')).join('_') + '.png';
|
||||
const url = URL.createObjectURL(blob);
|
||||
const link = document.createElement('a');
|
||||
link.href = url;
|
||||
link.download = filename;
|
||||
document.body.appendChild(link);
|
||||
link.click();
|
||||
link.remove();
|
||||
// Give the browser time to start reading the download before releasing it.
|
||||
setTimeout(() => URL.revokeObjectURL(url), 60000);
|
||||
} catch (error) {
|
||||
const message = showMessage('', 'error');
|
||||
message.id = 'capture-message';
|
||||
message.textContent = 'Screenshot failed: ' + String(error.message || error);
|
||||
} finally {
|
||||
capturing = false;
|
||||
label.textContent = 'Screenshot';
|
||||
updateCaptureButton();
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
// Client transforms
|
||||
@@ -371,7 +470,10 @@ function render() {
|
||||
const loading = document.getElementById('loading');
|
||||
if(!rendered) return;
|
||||
|
||||
frame.setAttribute('sandbox', '');
|
||||
// Same-origin DOM access is required for capture; scripts remain disabled.
|
||||
frame.setAttribute('sandbox', 'allow-same-origin');
|
||||
previewReady = false;
|
||||
updateCaptureButton();
|
||||
|
||||
frame.style.display = 'none';
|
||||
loading.style.display = 'flex';
|
||||
@@ -388,6 +490,8 @@ function render() {
|
||||
loading.style.display = 'none';
|
||||
frame.style.display = 'block';
|
||||
frame.onload = null;
|
||||
previewReady = true;
|
||||
updateCaptureButton();
|
||||
}
|
||||
frame.onload = finish;
|
||||
frame.srcdoc = content;
|
||||
@@ -400,7 +504,12 @@ function render() {
|
||||
//
|
||||
function togglePanel() {
|
||||
const panel = document.getElementById('panel');
|
||||
panel.classList.toggle('collapsed');
|
||||
const collapsed = panel.classList.toggle('collapsed');
|
||||
const handle = document.getElementById('panel-handle');
|
||||
handle.setAttribute('aria-expanded', String(!collapsed));
|
||||
handle.setAttribute('aria-label', collapsed ? 'Expand panel' : 'Collapse panel');
|
||||
handle.title = collapsed ? 'Expand panel' : 'Collapse panel';
|
||||
document.getElementById('panel-body').inert = collapsed;
|
||||
}
|
||||
|
||||
function toggleSection(id) {
|
||||
@@ -461,7 +570,7 @@ document.addEventListener('keydown',e=>{
|
||||
// Viewport shortcuts (no modifiers)
|
||||
if(e.key==='d'&&!e.ctrlKey&&!e.metaKey&&!e.altKey){ setViewport('desktop'); return; }
|
||||
if(e.key==='m'&&!e.ctrlKey&&!e.metaKey&&!e.altKey){ setViewport('mobile'); return; }
|
||||
// 'p' to toggle floating panel
|
||||
// 'p' to toggle the side panel
|
||||
if(e.key==='p'&&!e.ctrlKey&&!e.metaKey&&!e.altKey){ togglePanel(); return; }
|
||||
|
||||
// ← → cycle focus between Theme / Template / Client selects
|
||||
@@ -541,6 +650,8 @@ function loadLocale(lang) {
|
||||
async function switchLocale(lang) {
|
||||
if (!manifest?.languages.includes(lang)) return;
|
||||
state.locale=lang; rendered=null;
|
||||
previewReady=false;
|
||||
updateCaptureButton();
|
||||
const request=++localeRequest;
|
||||
document.getElementById('preview-frame').style.display='none';
|
||||
document.getElementById('loading').style.display='flex';
|
||||
|
||||
@@ -0,0 +1,22 @@
|
||||
Copyright (c) 2012 Niklas von Hertzen
|
||||
|
||||
Permission is hereby granted, free of charge, to any person
|
||||
obtaining a copy of this software and associated documentation
|
||||
files (the "Software"), to deal in the Software without
|
||||
restriction, including without limitation the rights to use,
|
||||
copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the
|
||||
Software is furnished to do so, subject to the following
|
||||
conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be
|
||||
included in all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
|
||||
OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
||||
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
|
||||
HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
|
||||
WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
|
||||
OTHER DEALINGS IN THE SOFTWARE.
|
||||
@@ -0,0 +1,11 @@
|
||||
# html2canvas
|
||||
|
||||
Version: **1.4.1**, distributed under the [MIT license](LICENSE).
|
||||
|
||||
The preview uses this local copy to export the visible email container as PNG without a CDN connection. Release archives include the library and its license.
|
||||
|
||||
- Project: https://github.com/niklasvh/html2canvas
|
||||
- Distribution: https://cdn.jsdelivr.net/npm/html2canvas@1.4.1/dist/html2canvas.min.js
|
||||
- SHA-256: `e87e550794322e574a1fda0c1549a3c70dae5a93d9113417a429016838eab8cb`
|
||||
|
||||
Capture uses DOM rendering, so CSS support and cross-origin images follow [html2canvas's documented limitations](https://html2canvas.hertzen.com/documentation). The iframe permits same-origin DOM access while keeping scripts disabled. Keep the version, license and checksum together when updating the library.
|
||||
+20
@@ -0,0 +1,20 @@
|
||||
/*!
|
||||
* html2canvas 1.4.1 <https://html2canvas.hertzen.com>
|
||||
* Copyright (c) 2022 Niklas von Hertzen <https://hertzen.com>
|
||||
* Released under MIT License
|
||||
*/
|
||||
!function(A,e){"object"==typeof exports&&"undefined"!=typeof module?module.exports=e():"function"==typeof define&&define.amd?define(e):(A="undefined"!=typeof globalThis?globalThis:A||self).html2canvas=e()}(this,function(){"use strict";
|
||||
/*! *****************************************************************************
|
||||
Copyright (c) Microsoft Corporation.
|
||||
|
||||
Permission to use, copy, modify, and/or distribute this software for any
|
||||
purpose with or without fee is hereby granted.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
|
||||
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
|
||||
AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
|
||||
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
|
||||
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
|
||||
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
||||
PERFORMANCE OF THIS SOFTWARE.
|
||||
***************************************************************************** */var r=function(A,e){return(r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(A,e){A.__proto__=e}||function(A,e){for(var t in e)Object.prototype.hasOwnProperty.call(e,t)&&(A[t]=e[t])})(A,e)};function A(A,e){if("function"!=typeof e&&null!==e)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");function t(){this.constructor=A}r(A,e),A.prototype=null===e?Object.create(e):(t.prototype=e.prototype,new t)}var h=function(){return(h=Object.assign||function(A){for(var e,t=1,r=arguments.length;t<r;t++)for(var B in e=arguments[t])Object.prototype.hasOwnProperty.call(e,B)&&(A[B]=e[B]);return A}).apply(this,arguments)};function a(A,s,o,i){return new(o=o||Promise)(function(t,e){function r(A){try{n(i.next(A))}catch(A){e(A)}}function B(A){try{n(i.throw(A))}catch(A){e(A)}}function n(A){var e;A.done?t(A.value):((e=A.value)instanceof o?e:new o(function(A){A(e)})).then(r,B)}n((i=i.apply(A,s||[])).next())})}function H(t,r){var B,n,s,o={label:0,sent:function(){if(1&s[0])throw s[1];return s[1]},trys:[],ops:[]},A={next:e(0),throw:e(1),return:e(2)};return"function"==typeof Symbol&&(A[Symbol.iterator]=function(){return this}),A;function e(e){return function(A){return function(e){if(B)throw new TypeError("Generator is already executing.");for(;o;)try{if(B=1,n&&(s=2&e[0]?n.return:e[0]?n.throw||((s=n.return)&&s.call(n),0):n.next)&&!(s=s.call(n,e[1])).done)return s;switch(n=0,(e=s?[2&e[0],s.value]:e)[0]){case 0:case 1:s=e;break;case 4:return o.label++,{value:e[1],done:!1};case 5:o.label++,n=e[1],e=[0];continue;case 7:e=o.ops.pop(),o.trys.pop();continue;default:if(!(s=0<(s=o.trys).length&&s[s.length-1])&&(6===e[0]||2===e[0])){o=0;continue}if(3===e[0]&&(!s||e[1]>s[0]&&e[1]<s[3])){o.label=e[1];break}if(6===e[0]&&o.label<s[1]){o.label=s[1],s=e;break}if(s&&o.label<s[2]){o.label=s[2],o.ops.push(e);break}s[2]&&o.ops.pop(),o.trys.pop();continue}e=r.call(t,o)}catch(A){e=[6,A],n=0}finally{B=s=0}if(5&e[0])throw e[1];return{value:e[0]?e[1]:void 0,done:!0}}([e,A])}}}function t(A,e,t){if(t||2===arguments.length)for(var r,B=0,n=e.length;B<n;B++)!r&&B in e||((r=r||Array.prototype.slice.call(e,0,B))[B]=e[B]);return A.concat(r||e)}var d=(B.prototype.add=function(A,e,t,r){return new B(this.left+A,this.top+e,this.width+t,this.height+r)},B.fromClientRect=function(A,e){return new B(e.left+A.windowBounds.left,e.top+A.windowBounds.top,e.width,e.height)},B.fromDOMRectList=function(A,e){e=Array.from(e).find(function(A){return 0!==A.width});return e?new B(e.left+A.windowBounds.left,e.top+A.windowBounds.top,e.width,e.height):B.EMPTY},B.EMPTY=new B(0,0,0,0),B);function B(A,e,t,r){this.left=A,this.top=e,this.width=t,this.height=r}for(var f=function(A,e){return d.fromClientRect(A,e.getBoundingClientRect())},Q=function(A){for(var e=[],t=0,r=A.length;t<r;){var B,n=A.charCodeAt(t++);55296<=n&&n<=56319&&t<r?56320==(64512&(B=A.charCodeAt(t++)))?e.push(((1023&n)<<10)+(1023&B)+65536):(e.push(n),t--):e.push(n)}return e},g=function(){for(var A=[],e=0;e<arguments.length;e++)A[e]=arguments[e];if(String.fromCodePoint)return String.fromCodePoint.apply(String,A);var t=A.length;if(!t)return"";for(var r=[],B=-1,n="";++B<t;){var s=A[B];s<=65535?r.push(s):(s-=65536,r.push(55296+(s>>10),s%1024+56320)),(B+1===t||16384<r.length)&&(n+=String.fromCharCode.apply(String,r),r.length=0)}return n},e="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",n="undefined"==typeof Uint8Array?[]:new Uint8Array(256),s=0;s<e.length;s++)n[e.charCodeAt(s)]=s;for(var o="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",c="undefined"==typeof Uint8Array?[]:new Uint8Array(256),i=0;i<o.length;i++)c[o.charCodeAt(i)]=i;function w(A,e,t){return A.slice?A.slice(e,t):new Uint16Array(Array.prototype.slice.call(A,e,t))}var U=(l.prototype.get=function(A){var e;if(0<=A){if(A<55296||56319<A&&A<=65535)return e=this.index[A>>5],this.data[e=(e<<2)+(31&A)];if(A<=65535)return e=this.index[2048+(A-55296>>5)],this.data[e=(e<<2)+(31&A)];if(A<this.highStart)return e=this.index[e=2080+(A>>11)],e=this.index[e+=A>>5&63],this.data[e=(e<<2)+(31&A)];if(A<=1114111)return this.data[this.highValueIndex]}return this.errorValue},l);function l(A,e,t,r,B,n){this.initialValue=A,this.errorValue=e,this.highStart=t,this.highValueIndex=r,this.index=B,this.data=n}for(var C="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",u="undefined"==typeof Uint8Array?[]:new Uint8Array(256),F=0;F<C.length;F++)u[C.charCodeAt(F)]=F;function p(A,e,t,r){var B=r[t];if(Array.isArray(A)?-1!==A.indexOf(B):A===B)for(var n=t;n<=r.length;){if((o=r[++n])===e)return 1;if(o!==D)break}if(B===D)for(n=t;0<n;){var s=r[--n];if(Array.isArray(A)?-1!==A.indexOf(s):A===s)for(var o,i=t;i<=r.length;){if((o=r[++i])===e)return 1;if(o!==D)break}if(s!==D)break}}function E(A,e){for(var t=A;0<=t;){var r=e[t];if(r!==D)return r;t--}return 0}function I(t,A){var e=(B=function(A,r){void 0===r&&(r="strict");var B=[],n=[],sLine truncated
|
||||
Reference in new issue
Block a user