| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990 |
- <!doctype html>
- <html>
- <head>
- <meta charset="utf-8" />
- <title>E2E entries view</title>
- <style>
- :root {
- color-scheme: light dark;
- }
- body {
- margin: 0;
- padding: 16px;
- font:
- 13px/1.5 system-ui,
- sans-serif;
- color: var(--color-text-primary, #1f2328);
- background: var(--color-background-primary, transparent);
- }
- h1 {
- margin: 0 0 8px;
- font-size: 15px;
- }
- dl {
- display: grid;
- grid-template-columns: max-content 1fr;
- gap: 4px 12px;
- margin: 0;
- }
- dt {
- color: var(--color-text-secondary, #59636e);
- }
- dd {
- margin: 0;
- font-family: ui-monospace, monospace;
- word-break: break-all;
- }
- </style>
- </head>
- <body data-ready="0">
- <h1 id="title">E2E entries view</h1>
- <dl>
- <dt>view</dt>
- <dd id="view">loading</dd>
- <dt>scope</dt>
- <dd id="scope"></dd>
- <dt>input</dt>
- <dd id="input"></dd>
- </dl>
- <script>
- // 页面脚本的错误记进 DOM,E2E 失败时能直接读到原因。
- window.__e2eErrors = [];
- window.addEventListener("error", (event) => window.__e2eErrors.push(String(event.message)));
- window.addEventListener("unhandledrejection", (event) =>
- window.__e2eErrors.push(String(event.reason?.message ?? event.reason)),
- );
- </script>
- <script>
- // 页面只经 window.zcode 读写;window.zcode 是不可配置的全局属性,顶层不再声明同名变量。
- const host = window.zcode;
- const applyHostStyles = () => {
- const variables = host.hostContext?.styles?.variables ?? {};
- for (const [name, value] of Object.entries(variables)) {
- if (typeof value === "string") document.documentElement.style.setProperty(name, value);
- }
- document.documentElement.dataset.theme = host.theme ?? "";
- };
- host.subscribe(applyHostStyles);
- host.ready().then(async () => {
- applyHostStyles();
- const result = await host.callTool("describe", {});
- const data = result.structuredContent ?? {};
- document.getElementById("title").textContent =
- data.viewId === "file" ? "E2E file viewer" : "E2E nav view";
- document.getElementById("view").textContent = data.viewId ?? "";
- document.getElementById("scope").textContent = data.scope ?? "";
- document.getElementById("input").textContent = data.input
- ? `${data.input.kind}: ${data.input.path}`
- : "none";
- Object.assign(document.body.dataset, {
- ready: "1",
- viewId: data.viewId ?? "",
- scope: data.scope ?? "",
- inputKind: data.input?.kind ?? "",
- inputPath: data.input?.path ?? "",
- inputWorkspace: data.input?.workspace?.workspacePath ?? "",
- });
- });
- </script>
- </body>
- </html>
|