- 右上角持久按钮簇:横向排列、独立 glyph(底栏/侧拉)、始终钉在视口右上角(侧边栏展开时位于其标签条右端,真实挤占 Tab 空间) - 底部面板:独立工作台,只挤占中间 Agent 输出区(不覆盖左右侧边栏),右缘分割线、关闭 x、首展自动开终端(二级设置开关,默认开) - 两面板拐角双向拖动调节尺寸;拖动改为 rAF 节流直写 DOM,消除卡顿;面板尺寸互钳制防丢失 - 跨面板拖 Tab(合并/拆分落点),moveTab/moveTabToEdge 支持跨树移动 - 欢迎卡片改响应式网格;布局/几何全部按会话持久化,旧状态平滑迁移
62 lines
1.9 KiB
TypeScript
62 lines
1.9 KiB
TypeScript
/**
|
|
* Browser globals for specs that pull browser-bound modules. Import this
|
|
* FIRST in a spec file: unlike statements after imports (which vitest
|
|
* hoists above the module body), an import statement evaluates in order,
|
|
* so this runs before any later import's module graph (xterm's UMD wrapper
|
|
* checks `self` and its color defaults probe `document` at evaluation time;
|
|
* window/localStorage are only touched at runtime by the store).
|
|
*/
|
|
const g = globalThis as Record<string, unknown>
|
|
|
|
if (g.self === undefined) g.self = globalThis
|
|
|
|
const elementStub = (): Record<string, unknown> => ({
|
|
style: {},
|
|
classList: { add: () => {}, remove: () => {}, contains: () => false },
|
|
setAttribute: () => {},
|
|
getAttribute: () => null,
|
|
hasAttribute: () => false,
|
|
appendChild: () => {},
|
|
addEventListener: () => {},
|
|
removeEventListener: () => {},
|
|
getBoundingClientRect: () => ({ left: 0, top: 0, width: 0, height: 0 }),
|
|
// xterm's color palette probe measures a canvas context at module load.
|
|
getContext: () => null,
|
|
})
|
|
|
|
if (g.document === undefined) {
|
|
g.document = {
|
|
createElement: () => elementStub(),
|
|
createDocumentFragment: () => elementStub(),
|
|
addEventListener: () => {},
|
|
removeEventListener: () => {},
|
|
defaultView: globalThis,
|
|
body: elementStub(),
|
|
// CodeMirror's view module probes the UA and injects styles at load.
|
|
documentElement: elementStub(),
|
|
head: elementStub(),
|
|
styleSheets: [],
|
|
}
|
|
}
|
|
|
|
if (g.navigator === undefined) {
|
|
g.navigator = { userAgent: 'node', platform: 'node', vendor: '', maxTouchPoints: 0 }
|
|
}
|
|
|
|
if (g.window === undefined) {
|
|
g.window = {
|
|
clearTimeout: () => {},
|
|
setTimeout: (_fn: () => void) => 0,
|
|
innerWidth: 1024,
|
|
innerHeight: 768,
|
|
getComputedStyle: () => ({ getPropertyValue: () => '' }),
|
|
}
|
|
}
|
|
|
|
if (g.localStorage === undefined) {
|
|
g.localStorage = {
|
|
getItem: () => null,
|
|
setItem: () => {},
|
|
}
|
|
}
|