报告语言改成分段页签,切换后不留下上一种语言的正文。导出从右侧或底部滑出,不再显示文件大小和说明句。星历用箭头按钮按方向翻页,卡片边框不被裁掉。登录的输入、按钮和六位验证码换成组件库。星星汇聚不改。 自测:tsc 退出码 0;lint 0 error、122 个警告;相关测试 185 条里 184 通过,另 1 条是既有的 Windows 管理路径问题;英文版 10 条和删除 5 条重跑通过;build 后首页仍是 Static;首页 JS gzip-9 为 642174,相对 639609 多 0.40%。隐私标记测试通过。 Co-Authored-By: Grok (agent loop)
47 lines
1.6 KiB
TypeScript
47 lines
1.6 KiB
TypeScript
// Base UI chooses useLayoutEffect only when `document` already exists at module
|
|
// load. Sheet and menu portals never attach if that check runs in bare Node.
|
|
// This module has to be the first import of any test that mounts those portals.
|
|
// The placeholder is only for that check and for libraries that inject a style
|
|
// tag while loading. The lifecycle harness replaces it before rendering.
|
|
if (typeof globalThis.document === "undefined") {
|
|
type Placeholder = {
|
|
nodeType: number;
|
|
tagName?: string;
|
|
childNodes: Placeholder[];
|
|
parentNode: Placeholder | null;
|
|
style: Record<string, string>;
|
|
textContent: string;
|
|
appendChild: (child: Placeholder) => Placeholder;
|
|
};
|
|
const make = (tag: string): Placeholder => {
|
|
const node: Placeholder = {
|
|
nodeType: 1,
|
|
tagName: tag.toUpperCase(),
|
|
childNodes: [],
|
|
parentNode: null,
|
|
style: {},
|
|
textContent: "",
|
|
appendChild(child) {
|
|
child.parentNode = node;
|
|
node.childNodes.push(child);
|
|
return child;
|
|
},
|
|
};
|
|
return node;
|
|
};
|
|
const head = make("head");
|
|
const body = make("body");
|
|
const documentElement = make("html");
|
|
const document = {
|
|
nodeType: 9,
|
|
head,
|
|
body,
|
|
documentElement,
|
|
defaultView: null as unknown,
|
|
createElement: (tag: string) => make(tag),
|
|
createTextNode: (text: string) => ({ nodeType: 3, textContent: text, childNodes: [], parentNode: null, style: {}, appendChild(child: Placeholder) { return child; } }),
|
|
getElementsByTagName: () => [],
|
|
};
|
|
Object.defineProperty(globalThis, "document", { value: document, writable: true, configurable: true });
|
|
}
|