@capyclaw/caption-map 0.0.0-stage → 0.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +312 -2
- package/client/client.chat.js +441 -0
- package/client/client.js +1509 -0
- package/cordis.patch.yml +14 -0
- package/index.js +47 -0
- package/node_modules/@capyclaw/foundation/README.md +51 -0
- package/node_modules/@capyclaw/foundation/abi/bridge.mjs +86 -0
- package/node_modules/@capyclaw/foundation/abi/errors.mjs +63 -0
- package/node_modules/@capyclaw/foundation/abi/index.mjs +35 -0
- package/node_modules/@capyclaw/foundation/abi/kinds.mjs +271 -0
- package/node_modules/@capyclaw/foundation/abi/loader.mjs +345 -0
- package/node_modules/@capyclaw/foundation/abi/schema.mjs +98 -0
- package/node_modules/@capyclaw/foundation/abi/spec.mjs +255 -0
- package/node_modules/@capyclaw/foundation/abi/validate.mjs +24 -0
- package/node_modules/@capyclaw/foundation/abi/version.mjs +82 -0
- package/node_modules/@capyclaw/foundation/cordis.patch.yml +5 -0
- package/node_modules/@capyclaw/foundation/kit/index.mjs +6 -0
- package/node_modules/@capyclaw/foundation/lib/adapters/client-panel.mjs +98 -0
- package/node_modules/@capyclaw/foundation/lib/adapters/host-event.mjs +35 -0
- package/node_modules/@capyclaw/foundation/lib/adapters/http-router.mjs +69 -0
- package/node_modules/@capyclaw/foundation/lib/adapters/lifecycle-hook.mjs +55 -0
- package/node_modules/@capyclaw/foundation/lib/adapters/own-server.mjs +113 -0
- package/node_modules/@capyclaw/foundation/lib/adapters/raw.mjs +68 -0
- package/node_modules/@capyclaw/foundation/lib/adapters/runtime-driver.mjs +113 -0
- package/node_modules/@capyclaw/foundation/lib/adapters/service-provider.mjs +77 -0
- package/node_modules/@capyclaw/foundation/lib/adapters/skill-provider.mjs +56 -0
- package/node_modules/@capyclaw/foundation/lib/adapters/tool-provider.mjs +50 -0
- package/node_modules/@capyclaw/foundation/lib/adapters/ui-panel.mjs +64 -0
- package/node_modules/@capyclaw/foundation/lib/ctx-service.mjs +42 -0
- package/node_modules/@capyclaw/foundation/lib/host/caps.mjs +34 -0
- package/node_modules/@capyclaw/foundation/lib/host/contract.mjs +85 -0
- package/node_modules/@capyclaw/foundation/lib/host/dsh.mjs +50 -0
- package/node_modules/@capyclaw/foundation/lib/host/memory.mjs +160 -0
- package/node_modules/@capyclaw/foundation/lib/host.mjs +23 -0
- package/node_modules/@capyclaw/foundation/lib/kernel.mjs +185 -0
- package/node_modules/@capyclaw/foundation/lib/skill/scan.mjs +87 -0
- package/node_modules/@capyclaw/foundation/lib/subsystems/events.mjs +60 -0
- package/node_modules/@capyclaw/foundation/lib/subsystems/log.mjs +51 -0
- package/node_modules/@capyclaw/foundation/lib/subsystems/net.mjs +188 -0
- package/node_modules/@capyclaw/foundation/package.json +53 -0
- package/node_modules/@capyclaw/foundation/runtime/index.mjs +20 -0
- package/node_modules/@capyclaw/plugin-kit/INTEGRATION.md +100 -0
- package/node_modules/@capyclaw/plugin-kit/README.md +70 -0
- package/node_modules/@capyclaw/plugin-kit/bin/sync.mjs +103 -0
- package/node_modules/@capyclaw/plugin-kit/package.json +69 -0
- package/node_modules/@capyclaw/plugin-kit/src/cli.mjs +56 -0
- package/node_modules/@capyclaw/plugin-kit/src/config.mjs +142 -0
- package/node_modules/@capyclaw/plugin-kit/src/editor/heartbeat-worker.js +129 -0
- package/node_modules/@capyclaw/plugin-kit/src/editor/lease.mjs +139 -0
- package/node_modules/@capyclaw/plugin-kit/src/editor/shadow.mjs +219 -0
- package/node_modules/@capyclaw/plugin-kit/src/editor/transport.js +13 -0
- package/node_modules/@capyclaw/plugin-kit/src/index.mjs +13 -0
- package/node_modules/@capyclaw/plugin-kit/src/pack.mjs +230 -0
- package/node_modules/@capyclaw/plugin-kit/src/runtime/context.mjs +128 -0
- package/node_modules/@capyclaw/plugin-kit/src/self-contained.mjs +307 -0
- package/node_modules/@capyclaw/plugin-kit/src/service/api.mjs +45 -0
- package/node_modules/@capyclaw/plugin-kit/src/service/http.mjs +113 -0
- package/node_modules/@capyclaw/plugin-kit/src/service/mcp-http.mjs +150 -0
- package/node_modules/@capyclaw/plugin-kit/src/service/server.mjs +131 -0
- package/node_modules/@capyclaw/plugin-kit/src/skills/provider.mjs +82 -0
- package/node_modules/@capyclaw/plugin-kit/src/store/blob-store.mjs +109 -0
- package/node_modules/@capyclaw/plugin-kit/src/store/content-store.mjs +17 -0
- package/node_modules/@capyclaw/plugin-kit/src/store/journal-store.mjs +89 -0
- package/node_modules/@capyclaw/plugin-kit/src/tools/result.mjs +57 -0
- package/node_modules/@capyclaw/plugin-kit/src/tools/validate.mjs +150 -0
- package/node_modules/@capyclaw/plugin-kit/src/tuning.mjs +82 -0
- package/node_modules/@capyclaw/plugin-kit/src/util/fs-lock.mjs +132 -0
- package/node_modules/@capyclaw/plugin-kit/src/util/http.mjs +130 -0
- package/node_modules/@capyclaw/plugin-kit/src/workspace/manager.mjs +656 -0
- package/node_modules/@capyclaw/plugin-kit/src/zip.mjs +181 -0
- package/node_modules/@capyclaw/window-kit/README.md +91 -0
- package/node_modules/@capyclaw/window-kit/client/client.js +531 -0
- package/node_modules/@capyclaw/window-kit/cordis.patch.yml +9 -0
- package/node_modules/@capyclaw/window-kit/icon.svg +8 -0
- package/node_modules/@capyclaw/window-kit/index.js +11 -0
- package/node_modules/@capyclaw/window-kit/package.json +62 -0
- package/options.mjs +27 -0
- package/package.json +67 -4
package/client/client.js
ADDED
|
@@ -0,0 +1,1509 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @capyclaw/caption-map · 浏览器半
|
|
3
|
+
*
|
|
4
|
+
* 区域映射:把「底部入口行」「侧栏面板列表」「工作区列表」搬进 Windows 标题栏行。
|
|
5
|
+
* 1. 底部入口行(更多/设置 launcher + 手机/电脑远程等 footer 席位)→ 标题栏,
|
|
6
|
+
* 排「应用/编辑」菜单右侧;
|
|
7
|
+
* 2. 侧栏面板列表(插件 / 离线 ddr0 / 自动化任务 / 更多 …)→ 收进标题栏一枚
|
|
8
|
+
* 「其他」分组按钮,点开是这些面板的一行行选项;
|
|
9
|
+
* 3. 工作区列表(sidebar.workspaces 席位,WorkspaceBrowser)→ 收进「其他」右侧
|
|
10
|
+
* 一枚「工作区」收藏夹按钮,点开是独立浮窗:原生组头/会话行/搜索/添加原样
|
|
11
|
+
* 可用,点会话行打开会话并收起(浏览器书签行为)。
|
|
12
|
+
*
|
|
13
|
+
* 本包另一件事:侧栏底部的**聊天窗停靠**(`client/client.chat.js`,包内分块、按需加载)——
|
|
14
|
+
* 把会话面板(「标题 + 页签 + 正文 + 输入框」那一整块)搬进侧栏列底部的槽里。它是真·DOM
|
|
15
|
+
* 搬迁(输入框、菜单层叠要求同层),和上面的纯 CSS 映射是两条独立路径、两套门控:
|
|
16
|
+
* 映射只在 Windows 标题栏下生效,聊天窗停靠跨平台常驻。聊天窗停靠走 @capyclaw/window-kit
|
|
17
|
+
* 的页面账本;区域映射不依赖 window-kit(window-kit 被禁用时映射仍要工作)。停用插件即还原。
|
|
18
|
+
*
|
|
19
|
+
* 为什么是几何映射而不是插槽镜像:
|
|
20
|
+
* - 顶栏那一行不是 web 插槽。侧栏开关由 ui-sidebar 固定到标题栏左上
|
|
21
|
+
* (html[data-windows-titlebar]),「应用/编辑」菜单栏是 preload 直接注入
|
|
22
|
+
* document 的 fixed menubar(host 带 data-windows-menu 属性,见安装版
|
|
23
|
+
* lib/preload-app.cjs installWindowsMenu)。catalog 里没有任何落在标题栏行
|
|
24
|
+
* 的可注入席位(shell.leading 只在 drawer/darwin 折叠态挂载)。
|
|
25
|
+
* - 底部入口行 = ui-sidebar 的 foot:settings.launcher(更多/账户入口)与
|
|
26
|
+
* sidebar.footer.action 席位(手机/电脑远程等注册项)的公共容器行。
|
|
27
|
+
* - 面板列表 = SidebarRoot 的 nav.panelList,行来自 usePanels(各插件用
|
|
28
|
+
* ctx.slots.register({name:'sidebar.panellist'}) 注册),「更多」是
|
|
29
|
+
* PanelMoreMenu(sidebar.panellist.actions 席位)。它是侧栏内的普通流内块,
|
|
30
|
+
* 所以整块 position:fixed 到标题栏下方即成下拉,行本身仍是 React 节点。
|
|
31
|
+
* - 新会话按钮:展开态整格收起(侧栏整条「+ 新会话」不再占位,顶栏也不放
|
|
32
|
+
* ⊕——鲸鱼兼作新会话入口,用户选定);折叠态交给外壳自己钉⊕到 left:48px,
|
|
33
|
+
* 不插手。纯 CSS、卸载还原。
|
|
34
|
+
* - 品牌行(logoRow,deepseek HARNESS):标题栏模式下整行 height:0 收起
|
|
35
|
+
* (不能 display:none——Windows 的侧栏开关渲染在 logoRow 里,fixed 子级
|
|
36
|
+
* 需要行留在 DOM)。展开态鲸鱼图标钉顶栏 left:12px、只留图标;侧栏开关
|
|
37
|
+
* 让位到 48px、菜单栏起点 84px,左起两枚 12/48。折叠态交外壳原布局
|
|
38
|
+
* (开关 12 / 新会话 48,鲸鱼随行收起);drawer 不插手。门控与 active()
|
|
39
|
+
* 同条件,纯 web 不受影响。
|
|
40
|
+
*
|
|
41
|
+
* 做法(满足「不改占用方代码 + 未来注册自动跟随」):
|
|
42
|
+
* 1. 运行时按 data-slot / class 前缀找到席位 host、行、面板列表;
|
|
43
|
+
* 2. 只改 CSS(position:fixed 进标题栏行),不移动 DOM 节点——React 仍拥有
|
|
44
|
+
* 这些节点,卸载/重挂载不受影响;席位里未来新增的注册项渲染在同一容器
|
|
45
|
+
* 内,自动一起上顶栏/进「其他」;
|
|
46
|
+
* 3. 原位置因节点脱离文档流而自然收起,另把原父容器的 padding/边框收掉;
|
|
47
|
+
* 4. 左偏移运行时量 menubar 右缘,侧栏折叠(--dsh-windows-menu-start 变化)、
|
|
48
|
+
* 窗口 resize、语言切换(menubar 宽度变化)都会重算;
|
|
49
|
+
* 5. 仅 html[data-windows-titlebar] 且 menubar 在场时生效;纯 web / macOS
|
|
50
|
+
* 自动 no-op。禁用插件即还原全部内联样式并移除自己注入的按钮。
|
|
51
|
+
*
|
|
52
|
+
* 「其他」分组:顶栏没有可注入的插槽,所以触发按钮由本插件注入(document.body
|
|
53
|
+
* 下的 fixed 按钮),点开时把 nav.panelList 的显隐交给 html[data-capyclaw-others-
|
|
54
|
+
* open] 一条 CSS;行仍是原来的 React 按钮,点一下走原来的 selectPanel,
|
|
55
|
+
* active 高亮、更多菜单、未来新注册的面板全部自动生效。
|
|
56
|
+
*
|
|
57
|
+
* 「工作区」收藏夹:同一套注入按钮 + html[data-capyclaw-workspaces-open] 显隐
|
|
58
|
+
* 机制,把 WorkspaceBrowser 根(div:has(> [data-sidebar-workspace-header]))
|
|
59
|
+
* fixed 成独立浮窗。根用独立标记 data-capyclaw-workspaces-map——通用 [MARK]>*
|
|
60
|
+
* 横排规则会毁掉它的纵向布局。折叠/drawer 态列表内容卸载,整块交还原生 rail。
|
|
61
|
+
*
|
|
62
|
+
* 护栏:公共祖先若大到装进了会话列表/面板列表/输入框(说明两席位不在同一行),
|
|
63
|
+
* 放弃整行映射,退化为逐席位映射(手机/电脑仍上顶栏),绝不把整条侧栏搬走。
|
|
64
|
+
* drawer(侧栏当浮层)时面板列表留在抽屉里,不搬。
|
|
65
|
+
*
|
|
66
|
+
* ── 内部结构(方便拓展)─────────────────────────────────────────────
|
|
67
|
+
* 区域映射这条 effect 内部按「共享底座 + 特性模块 + 编排器」组织:
|
|
68
|
+
* · 共享底座 kit:门控谓词、样式账本 makeLedger、原父级收零 markSrc/releaseSrc、
|
|
69
|
+
* 容器隔离兜底 escapeContainment、左夹取 clampLeft、触发按钮工厂、下拉开合
|
|
70
|
+
* 状态 makeOpenState(自带互斥注册表)、样式表 styleTag。重复实现只此一份。
|
|
71
|
+
* · 特性模块:brand / newSession / seats / others / workspaces,各自持有自己的
|
|
72
|
+
* 样式账本与注入按钮,暴露 pass(…)(本轮摆好)与 yield()(让位还原)。彼此
|
|
73
|
+
* 不共享映射表,编排器不再需要「跳过哪些选择器」的耦合清单。
|
|
74
|
+
* · 编排器 pass():只算一次几何(capH/cursor),按序调各特性;让位时统一 yieldAll。
|
|
75
|
+
* · 点空白/Esc 收起:按特性注册的策略分发(dropdownFeatures),加新下拉不用改
|
|
76
|
+
* 一个巨大的 onClick。
|
|
77
|
+
* 新增一个「搬进标题栏」的特性:写一个 makeXxxFeature()(自己的账本 + pass/yield),
|
|
78
|
+
* 在编排器里调它的 pass,在 yieldAll 里调它的 yield;若是下拉,再注册开合状态与
|
|
79
|
+
* 点击/Esc 策略即可。新增底部席位:往 SEATS 加一行。
|
|
80
|
+
*
|
|
81
|
+
* 装载协议与 DSH 其它客户端插件一致:window.__ModuleLoader__.load({ id, factory })。
|
|
82
|
+
*/
|
|
83
|
+
window.__ModuleLoader__.load({
|
|
84
|
+
id: '@capyclaw/caption-map',
|
|
85
|
+
factory: function (require) {
|
|
86
|
+
var PACKAGE_ID = '@capyclaw/caption-map'
|
|
87
|
+
var MARK = 'data-capyclaw-caption-map'
|
|
88
|
+
var SRC_MARK = 'data-capyclaw-caption-map-src'
|
|
89
|
+
/** 底部区域的席位清单(顺序即顶栏排布顺序)。新增底部席位时往这里加一行。 */
|
|
90
|
+
var SEATS = ['settings.launcher', 'sidebar.footer.action']
|
|
91
|
+
var GAP = 6
|
|
92
|
+
/** 标题栏右侧原生 min/max/close 按钮预留宽度。 */
|
|
93
|
+
var CAPTION_RIGHT_RESERVE = 150
|
|
94
|
+
/** foot 竖排堆叠的高度上限;超过说明公共祖先取大了。 */
|
|
95
|
+
var ROW_MAX_HEIGHT = 240
|
|
96
|
+
/** 新会话整条按钮:CSS module 哈希前缀随版本变,后缀稳定;row/content 等不是 button,不会误中。 */
|
|
97
|
+
var NS_BTN = 'button[class*="newSession"]'
|
|
98
|
+
/** 品牌元素(鲸鱼图标载体,button 或 span):logoRow 的直接子级。 */
|
|
99
|
+
var BRAND_SEL = '[class*="logoRow"] > [class*="brand"]'
|
|
100
|
+
/** 展开态顶栏左起两枚:鲸鱼 12 / 侧栏开关 48(各 28px,菜单栏 84 起);
|
|
101
|
+
新会话整条按钮展开态整格收起(鲸鱼兼作新会话入口)。
|
|
102
|
+
折叠态不插手:外壳原布局 开关 12 / 新会话 48,鲸鱼随 logoRow 收起。 */
|
|
103
|
+
var BRAND_LEFT = 12
|
|
104
|
+
var TOGGLE_LEFT = 48
|
|
105
|
+
/** 面板列表:nav.panelList(module 哈希前缀,后缀稳定)。 */
|
|
106
|
+
var NAV_SEL = 'nav[class*="panelList"]'
|
|
107
|
+
/** 「其他」分组:注入的触发按钮 id / 展开态属性 / 文案 / 下拉宽度。 */
|
|
108
|
+
var TRIGGER_ID = 'capyclaw-others-trigger'
|
|
109
|
+
var TRIGGER_MARK = 'data-capyclaw-others-trigger'
|
|
110
|
+
var OPEN_ATTR = 'data-capyclaw-others-open'
|
|
111
|
+
var OTHERS_LABEL = '其他'
|
|
112
|
+
var NAV_WIDTH = 224
|
|
113
|
+
var CHEVRON = '<svg width="12" height="12" viewBox="0 0 12 12" aria-hidden="true">'
|
|
114
|
+
+ '<path d="M3 4.5 6 7.5 9 4.5" fill="none" stroke="currentColor" stroke-width="1.3"'
|
|
115
|
+
+ ' stroke-linecap="round" stroke-linejoin="round"/></svg>'
|
|
116
|
+
/** 预留栏位:「其他」右侧一枚占位场(内容待定,现为虚线占位盒)。 */
|
|
117
|
+
var EXTRA_SLOT_ID = 'capyclaw-extra-slot'
|
|
118
|
+
var EXTRA_SLOT_MARK = 'data-capyclaw-extra-slot'
|
|
119
|
+
var EXTRA_SLOT_MOUNT_MARK = 'data-capyclaw-extra-slot-mount'
|
|
120
|
+
var EXTRA_SLOT_LABEL = '预留栏位'
|
|
121
|
+
/** 工作区收藏夹:sidebar.workspaces 区域(WorkspaceBrowser 根)收成顶栏下拉。
|
|
122
|
+
根节点没有稳定属性,用「header 的直接父级」定位;header/listArea 有稳定 data 属性。
|
|
123
|
+
独立标记(不复用 MARK):通用 '[MARK] > *' 横排规则会毁掉根的纵向布局。
|
|
124
|
+
每个工作区分组一枚文件夹按钮(组头 data-row-key="workspace:…"),点开只显该组会话。 */
|
|
125
|
+
var WS_ROOT_SEL = 'div:has(> [data-sidebar-workspace-header])'
|
|
126
|
+
var WS_MARK = 'data-capyclaw-workspaces-map'
|
|
127
|
+
var WS_TRIGGER_MARK = 'data-capyclaw-workspaces-trigger'
|
|
128
|
+
var WS_BTN_PREFIX = 'capyclaw-ws-trigger-'
|
|
129
|
+
var WS_FILTER_ID = 'capyclaw-ws-filter'
|
|
130
|
+
var WS_OPEN_ATTR = 'data-capyclaw-workspaces-open'
|
|
131
|
+
var WS_WIDTH = 360
|
|
132
|
+
/** 第二行:文件夹按钮独占一行;frame 的 padding-top 加一行高,把下方画面整体挤下去 */
|
|
133
|
+
var WS_ROW_H = 36
|
|
134
|
+
var WS_ROW_ATTR = 'data-capyclaw-ws-row'
|
|
135
|
+
var WS_ROW_LEFT = 12
|
|
136
|
+
var FOLDER_ICON = '<svg width="12" height="12" viewBox="0 0 12 12" aria-hidden="true">'
|
|
137
|
+
+ '<path d="M1.5 3.2c0-.4.3-.7.7-.7h2.6l1 1.2h4c.4 0 .7.3.7.7v4.4c0 .4-.3.7-.7.7H2.2c-.4 0-.7-.3-.7-.7V3.2z"'
|
|
138
|
+
+ ' fill="none" stroke="currentColor" stroke-width="1.1" stroke-linejoin="round"/></svg>'
|
|
139
|
+
|
|
140
|
+
/** 「更多」收拢(展开态):把鲸鱼 / 侧栏开关 / 应用·编辑菜单栏 / 底部入口行
|
|
141
|
+
(Maple 账户 + 手机/电脑)/ 面板列表整簇收进标题栏左起一枚「更多」按钮,
|
|
142
|
+
点开是一枚统一浮窗,自上而下:新会话 / 折叠侧栏 / 应用·编辑 / 账户·设备 /
|
|
143
|
+
面板列表。原生菜单栏 host 与底部入口行整块 fixed 进浮窗(弹出菜单按可见
|
|
144
|
+
位置量锚点,行为不变);新会话/折叠侧栏是注入行,程序点真按钮。
|
|
145
|
+
折叠/drawer 态交还原布局(more 让位,brand/seats/others 照旧)。
|
|
146
|
+
独立标记(不复用 MARK):通用 [MARK] 横排/显隐规则会干扰浮窗纵向布局。 */
|
|
147
|
+
var MORE_TRIGGER_ID = 'capyclaw-more-trigger'
|
|
148
|
+
var MORE_OPEN_ATTR = 'data-capyclaw-more-open'
|
|
149
|
+
var MORE_LABEL = '更多'
|
|
150
|
+
var MORE_PANEL_MARK = 'data-capyclaw-more-panel'
|
|
151
|
+
var MORE_ITEM_MARK = 'data-capyclaw-more-item'
|
|
152
|
+
var MORE_ROW_MARK = 'data-capyclaw-more-row'
|
|
153
|
+
var MORE_SEATS_MARK = 'data-capyclaw-more-seats'
|
|
154
|
+
var MORE_LEFT = 12
|
|
155
|
+
var MORE_WIDTH = 240
|
|
156
|
+
var MORE_PAD = 6
|
|
157
|
+
var MORE_GAP = 2
|
|
158
|
+
var MORE_ROW_H = 32
|
|
159
|
+
var MORE_SEATS_H = 40
|
|
160
|
+
var PLUS_ICON = '<svg width="14" height="14" viewBox="0 0 14 14" aria-hidden="true">'
|
|
161
|
+
+ '<path d="M7 2.5v9M2.5 7h9" fill="none" stroke="currentColor" stroke-width="1.3" stroke-linecap="round"/></svg>'
|
|
162
|
+
var SIDEBAR_ICON = '<svg width="14" height="14" viewBox="0 0 14 14" aria-hidden="true">'
|
|
163
|
+
+ '<rect x="1.8" y="2.5" width="10.4" height="9" rx="1.6" fill="none" stroke="currentColor" stroke-width="1.2"/>'
|
|
164
|
+
+ '<path d="M5.2 2.5v9" fill="none" stroke="currentColor" stroke-width="1.2"/></svg>'
|
|
165
|
+
|
|
166
|
+
var CSS = [
|
|
167
|
+
/* 映射容器内部一律横排、撑满标题栏行高 */
|
|
168
|
+
'[' + MARK + '] > *,',
|
|
169
|
+
'[' + MARK + '] [data-slot="sidebar.footer.action"],',
|
|
170
|
+
'[' + MARK + '] [data-slot="sidebar.footer.action"] > * {',
|
|
171
|
+
'display:flex!important;flex-direction:row!important;align-items:center!important;',
|
|
172
|
+
'gap:2px!important;width:auto!important;height:100%!important;',
|
|
173
|
+
'margin:0!important;padding:0!important;min-height:0!important;',
|
|
174
|
+
'}',
|
|
175
|
+
'[' + MARK + '] button,[' + MARK + '] [role="button"]{flex:none!important}',
|
|
176
|
+
/* 标题栏整行是窗口拖拽区(frame::before app-region:drag)。Electron 的
|
|
177
|
+
app-region 是几何相减而非层叠:映射行必须声明 no-drag 把自己的盒子从
|
|
178
|
+
拖拽区里减掉,否则落在里面的按钮点击会被当成拖窗口而失效。 */
|
|
179
|
+
'[' + MARK + '],[' + MARK +'] *{-webkit-app-region:no-drag!important}',
|
|
180
|
+
/* 原父容器:节点脱流后收掉残留留白与分隔线 */
|
|
181
|
+
'[' + SRC_MARK + ']{padding:0!important;gap:0!important;min-height:0!important;border-top-width:0!important;margin:0!important}',
|
|
182
|
+
/* 新会话按钮若只留图标:文字/快捷键徽标隐藏,内容盒收拢。
|
|
183
|
+
注意 Label 选择器必须限定在 Content 的直接子级——[class*="newSessionLabel"]
|
|
184
|
+
会连带匹配 newSessionLabelMask(装图层的容器),把图标一起藏掉。 */
|
|
185
|
+
'[' + MARK + '][class*="newSession"] [class*="newSessionContent"] > [class*="newSessionLabel"],',
|
|
186
|
+
'[' + MARK + '][class*="newSession"] [class*="newSessionShortcut"]{display:none!important}',
|
|
187
|
+
'[' + MARK + '][class*="newSession"] [class*="newSessionContent"]{width:auto!important;gap:0!important}',
|
|
188
|
+
'[' + MARK + '][class*="newSession"]{border-radius:var(--dsw-radius-sm)!important}',
|
|
189
|
+
'@media (hover:hover){[' + MARK + '][class*="newSession"]:hover{background:var(--dsw-alias-interactive-bg-hover)!important}}',
|
|
190
|
+
/* 品牌行(deepseek HARNESS):标题栏模式下整行收起,侧栏顶部 40px 让位。
|
|
191
|
+
不能 display:none——Windows 的侧栏开关渲染在 logoRow 里(fixed 子级需要
|
|
192
|
+
行留在 DOM);height:0+overflow:hidden 收掉行,fixed 子级不受裁切。
|
|
193
|
+
门控与 active() 同条件;:has 外壳自己也在用(--dsh-windows-menu-start)。 */
|
|
194
|
+
'html[data-windows-titlebar]:has([data-windows-menu]) [class*="logoRow"]{height:0!important;min-height:0!important;margin:0!important;padding:0!important;overflow:hidden!important}',
|
|
195
|
+
/* 鲸鱼钉顶栏时只留图标:品牌名/版本徽标隐藏 */
|
|
196
|
+
'[' + MARK + '][class*="brand"] [class*="brandName"]{display:none!important}',
|
|
197
|
+
'[' + MARK + '][class*="brand"] [class*="brandIdentity"]{gap:0!important}',
|
|
198
|
+
'[' + MARK + '][class*="brand"]{border-radius:var(--dsw-radius-sm)!important}',
|
|
199
|
+
'@media (hover:hover){[' + MARK + '][class*="brand"]:hover{background:var(--dsw-alias-interactive-bg-hover)!important}}',
|
|
200
|
+
/* 展开态(非 drawer)左起两枚 12/48:开关让位到 48,菜单栏 84 起。
|
|
201
|
+
折叠态不覆盖:外壳原布局 12/48 + menu-start 84。 */
|
|
202
|
+
'html[data-windows-titlebar]:has([data-windows-menu]):not(:has([data-sidebar-collapsed="true"])):not(:has([data-sidebar-drawer])) [data-sidebar-toggle]{left:' + TOGGLE_LEFT + 'px!important}',
|
|
203
|
+
'html[data-windows-titlebar]:has([data-windows-menu]):not(:has([data-sidebar-collapsed="true"])):not(:has([data-sidebar-drawer])){--dsh-windows-menu-start:84px!important}',
|
|
204
|
+
|
|
205
|
+
/* ── 「其他」/「工作区」分组:标题栏触发按钮(两枚同款) ───────── */
|
|
206
|
+
/* 层级契约:宿主 dock≤70 / modal 1000 / 右键菜单 1100 / 子菜单 1101。caption 浮层一律 <1100:
|
|
207
|
+
触发/预留/席位 1080、更多背板 1088、下拉/浮窗/注入行 1090,避免压住宿主右键菜单及子菜单。 */
|
|
208
|
+
'[' + TRIGGER_MARK + '],[' + WS_TRIGGER_MARK + ']{position:fixed!important;z-index:1080!important;box-sizing:border-box!important;',
|
|
209
|
+
'display:inline-flex!important;align-items:center!important;gap:4px!important;',
|
|
210
|
+
'height:28px!important;width:auto!important;max-width:160px!important;margin:0!important;padding:0 8px!important;',
|
|
211
|
+
'border:0!important;border-radius:var(--dsw-radius-sm,6px)!important;background:transparent!important;',
|
|
212
|
+
'color:inherit!important;font:inherit!important;font-size:12px!important;line-height:1!important;',
|
|
213
|
+
'white-space:nowrap!important;cursor:pointer!important;-webkit-app-region:no-drag!important}',
|
|
214
|
+
'[' + TRIGGER_MARK + '] span,[' + WS_TRIGGER_MARK + '] span{overflow:hidden!important;text-overflow:ellipsis!important}',
|
|
215
|
+
'[' + TRIGGER_MARK + '] svg,[' + WS_TRIGGER_MARK + '] svg{display:block!important;flex:none!important;opacity:.55!important;transition:transform .12s ease!important}',
|
|
216
|
+
'[' + TRIGGER_MARK + '][aria-expanded="true"] svg:last-child,[' + WS_TRIGGER_MARK + '][aria-expanded="true"] svg:last-child{transform:rotate(180deg)!important;opacity:.9!important}',
|
|
217
|
+
/* 第二行占位:外壳 frame 靠 padding-top 给标题栏让位(AppFrame.module.css),
|
|
218
|
+
加一行高 = 下方侧栏/主区/右栏整体下移;frame 背景与标题栏条同色,第二行
|
|
219
|
+
天然融入 chrome。只覆盖 CSS,不碰 React 的内联轨道值;摘属性即还原。 */
|
|
220
|
+
'html[' + WS_ROW_ATTR + '] div:has(> [data-shell-bottom]){padding-top:calc(var(--dsh-windows-titlebar-height) + ' + WS_ROW_H + 'px)!important}',
|
|
221
|
+
'@media (hover:hover){[' + TRIGGER_MARK + ']:hover,[' + WS_TRIGGER_MARK + ']:hover{background:var(--dsw-alias-interactive-bg-hover,rgba(0,0,0,.06))!important}}',
|
|
222
|
+
'[' + TRIGGER_MARK + '][aria-expanded="true"],[' + WS_TRIGGER_MARK + '][aria-expanded="true"]{background:var(--dsw-alias-interactive-bg-active,rgba(0,0,0,.08))!important}',
|
|
223
|
+
|
|
224
|
+
/* ── 预留栏位:「其他」后的占位场(内容待定,虚线盒示意) ─────── */
|
|
225
|
+
'[' + EXTRA_SLOT_MARK + ']{position:fixed!important;z-index:1080!important;box-sizing:border-box!important;',
|
|
226
|
+
'display:inline-flex!important;align-items:center!important;gap:4px!important;',
|
|
227
|
+
'height:28px!important;width:auto!important;max-width:160px!important;margin:0!important;padding:0 8px!important;',
|
|
228
|
+
'border:1px dashed var(--dsw-alias-border-l2,rgba(0,0,0,.25))!important;border-radius:var(--dsw-radius-sm,6px)!important;',
|
|
229
|
+
'background:transparent!important;color:var(--dsw-alias-label-secondary,inherit)!important;font:inherit!important;font-size:12px!important;line-height:1!important;',
|
|
230
|
+
'white-space:nowrap!important;-webkit-app-region:no-drag!important}',
|
|
231
|
+
'[' + EXTRA_SLOT_MARK + '] span{overflow:hidden!important;text-overflow:ellipsis!important;opacity:.75!important}',
|
|
232
|
+
/* 被占用(挂载锚有消费者):去虚线/限宽,让内容自撑;内层 mount 承载消费者 React 根 */
|
|
233
|
+
'[' + EXTRA_SLOT_MARK + '][data-occupied]{border:none!important;max-width:none!important;padding:0!important;gap:0!important}',
|
|
234
|
+
'[' + EXTRA_SLOT_MOUNT_MARK + ']{display:flex!important;align-items:center!important;height:28px!important;',
|
|
235
|
+
'min-width:0!important;max-width:46vw!important;overflow:hidden!important;-webkit-app-region:no-drag!important}',
|
|
236
|
+
|
|
237
|
+
/* ── 「其他」分组:把 sidebar.panellist 收成下拉 ─────────────── */
|
|
238
|
+
'nav[' + MARK + ']{position:fixed!important;z-index:1090!important;box-sizing:border-box!important;',
|
|
239
|
+
'display:flex!important;flex-direction:column!important;gap:2px!important;',
|
|
240
|
+
'margin:0!important;padding:6px!important;width:' + NAV_WIDTH + 'px!important;',
|
|
241
|
+
'max-height:min(70vh,480px)!important;overflow-x:hidden!important;overflow-y:auto!important;',
|
|
242
|
+
'background:var(--dsw-menu-surface-fill,var(--dsw-alias-bg-layer-2,#fff))!important;',
|
|
243
|
+
'border:1px solid var(--dsw-alias-border-l2,rgba(0,0,0,.08))!important;',
|
|
244
|
+
'border-radius:var(--dsw-radius-lg,12px)!important;',
|
|
245
|
+
'box-shadow:var(--dsw-elevation-panel,0 8px 24px rgba(0,0,0,.14))!important;',
|
|
246
|
+
'opacity:0!important;visibility:hidden!important;pointer-events:none!important;transform:translateY(-4px)!important;',
|
|
247
|
+
'transition:opacity .12s ease,transform .12s ease!important;-webkit-app-region:no-drag!important}',
|
|
248
|
+
'html[' + OPEN_ATTR + '] nav[' + MARK + ']{opacity:1!important;visibility:visible!important;pointer-events:auto!important;transform:none!important}',
|
|
249
|
+
'nav[' + MARK + '] > *{flex:none!important}',
|
|
250
|
+
/* 行:入口层负责 hover/active 底色,按钮本身满宽左对齐 */
|
|
251
|
+
'nav[' + MARK + '] [class*="panelEntry"]{border-inline:0!important;border-radius:var(--dsw-radius-sm,6px)!important}',
|
|
252
|
+
'nav[' + MARK + '] button[class*="panelRow"],',
|
|
253
|
+
'nav[' + MARK + '] [class*="moreAnchor"] button{display:flex!important;align-items:center!important;justify-content:flex-start!important;',
|
|
254
|
+
'gap:8px!important;width:100%!important;height:30px!important;min-height:30px!important;margin:0!important;padding:0 8px!important;',
|
|
255
|
+
'border:0!important;background:transparent!important;color:inherit!important;font:inherit!important;font-size:13px!important;',
|
|
256
|
+
'line-height:1!important;text-align:left!important;cursor:pointer!important}',
|
|
257
|
+
'@media (hover:hover){nav[' + MARK + '] button[class*="panelRow"]:hover,',
|
|
258
|
+
'nav[' + MARK + '] [class*="moreAnchor"] button:hover{background:transparent!important}}',
|
|
259
|
+
/* 折叠态不渲染 panelTitle,标签统一由 aria-label 补上;展开态的 panelTitle 让位 */
|
|
260
|
+
'nav[' + MARK + '] [class*="panelTitle"]{display:none!important}',
|
|
261
|
+
'nav[' + MARK + '] button[class*="panelRow"]::after,',
|
|
262
|
+
'nav[' + MARK + '] [class*="moreAnchor"] button::after{content:attr(aria-label);flex:1 1 auto!important;min-width:0!important;',
|
|
263
|
+
'overflow:hidden!important;text-overflow:ellipsis!important;white-space:nowrap!important}',
|
|
264
|
+
'nav[' + MARK + '] [class*="panelGlyph"]{width:16px!important;height:16px!important;flex:none!important;',
|
|
265
|
+
'color:var(--dsw-alias-menu-icon,currentColor)!important}',
|
|
266
|
+
/* 下拉里不给行内「取消固定」小图标留位:固定与否仍由「更多」菜单管 */
|
|
267
|
+
'nav[' + MARK + '] [class*="panelUnpin"]{display:none!important}',
|
|
268
|
+
|
|
269
|
+
/* ── 工作区收藏夹:把 sidebar.workspaces 区域收成独立浮窗 ─────── */
|
|
270
|
+
'div[' + WS_MARK + ']{position:fixed!important;z-index:1090!important;box-sizing:border-box!important;',
|
|
271
|
+
'display:flex!important;flex-direction:column!important;height:auto!important;',
|
|
272
|
+
'margin:0!important;padding:6px!important;width:' + WS_WIDTH + 'px!important;',
|
|
273
|
+
'max-height:min(70vh,560px)!important;',
|
|
274
|
+
'background:var(--dsw-menu-surface-fill,var(--dsw-alias-bg-layer-2,#fff))!important;',
|
|
275
|
+
'border:1px solid var(--dsw-alias-border-l2,rgba(0,0,0,.08))!important;',
|
|
276
|
+
'border-radius:var(--dsw-radius-lg,12px)!important;',
|
|
277
|
+
'box-shadow:var(--dsw-elevation-panel,0 8px 24px rgba(0,0,0,.14))!important;',
|
|
278
|
+
'opacity:0!important;visibility:hidden!important;pointer-events:none!important;transform:translateY(-4px)!important;',
|
|
279
|
+
'transition:opacity .12s ease,transform .12s ease!important;-webkit-app-region:no-drag!important}',
|
|
280
|
+
'html[' + WS_OPEN_ATTR + '] div[' + WS_MARK + ']{opacity:1!important;visibility:visible!important;pointer-events:auto!important;transform:none!important}',
|
|
281
|
+
'div[' + WS_MARK + '] *{-webkit-app-region:no-drag!important}',
|
|
282
|
+
/* 列表席位:浮窗内独立滚动。原生 overflow-y 受 @container scroll-state 管辖,
|
|
283
|
+
脱离侧栏容器后该查询失效,这里强制 auto 兜底;负 margin 是贴合侧栏滚动条的,收掉。 */
|
|
284
|
+
'div[' + WS_MARK + '] [data-sidebar-list-area]{flex:1 1 auto!important;min-height:0!important;',
|
|
285
|
+
'overflow-x:hidden!important;overflow-y:auto!important;margin:0!important;padding:0 2px!important}',
|
|
286
|
+
/* 工具条(工作区标题/搜索/视图选项/添加):保持原生 36px 高,收掉负 margin */
|
|
287
|
+
'div[' + WS_MARK + '] [data-sidebar-workspace-header]{flex:none!important;margin:0!important}',
|
|
288
|
+
|
|
289
|
+
/* ── 「更多」收拢浮窗(展开态):一枚按钮收整簇 ─────────────────── */
|
|
290
|
+
/* 浮窗背板:菜单表面,overflow:visible 让账户/设备弹出菜单逃出去 */
|
|
291
|
+
'[' + MORE_PANEL_MARK + ']{position:fixed!important;z-index:1088!important;box-sizing:border-box!important;',
|
|
292
|
+
'background:var(--dsw-menu-surface-fill,var(--dsw-alias-bg-layer-2,#fff))!important;',
|
|
293
|
+
'border:1px solid var(--dsw-alias-border-l2,rgba(0,0,0,.08))!important;',
|
|
294
|
+
'border-radius:var(--dsw-radius-lg,12px)!important;',
|
|
295
|
+
'box-shadow:var(--dsw-elevation-panel,0 8px 24px rgba(0,0,0,.14))!important;',
|
|
296
|
+
'overflow:visible!important;-webkit-app-region:no-drag!important;',
|
|
297
|
+
'opacity:0!important;visibility:hidden!important;pointer-events:none!important;transform:translateY(-4px)!important;',
|
|
298
|
+
'transition:opacity .12s ease,transform .12s ease!important}',
|
|
299
|
+
'html[' + MORE_OPEN_ATTR + '] [' + MORE_PANEL_MARK + ']{opacity:1!important;visibility:visible!important;pointer-events:auto!important;transform:none!important}',
|
|
300
|
+
/* 收进浮窗的宿主节点(菜单栏/底部入口行/面板列表)与注入行:收起时隐形 */
|
|
301
|
+
'[' + MORE_ITEM_MARK + '],[' + MORE_ROW_MARK + ']{-webkit-app-region:no-drag!important;',
|
|
302
|
+
'opacity:0!important;visibility:hidden!important;pointer-events:none!important}',
|
|
303
|
+
'html[' + MORE_OPEN_ATTR + '] [' + MORE_ITEM_MARK + '],html[' + MORE_OPEN_ATTR + '] [' + MORE_ROW_MARK + ']{opacity:1!important;visibility:visible!important;pointer-events:auto!important}',
|
|
304
|
+
'[' + MORE_ITEM_MARK + '] *{-webkit-app-region:no-drag!important}',
|
|
305
|
+
/* 注入动作行(新会话 / 折叠侧栏):菜单行样式 */
|
|
306
|
+
'[' + MORE_ROW_MARK + ']{position:fixed!important;z-index:1090!important;box-sizing:border-box!important;',
|
|
307
|
+
'display:flex!important;align-items:center!important;gap:8px!important;',
|
|
308
|
+
'height:' + MORE_ROW_H + 'px!important;margin:0!important;padding:0 8px!important;',
|
|
309
|
+
'border:0!important;border-radius:var(--dsw-radius-sm,6px)!important;background:transparent!important;',
|
|
310
|
+
'color:inherit!important;font:inherit!important;font-size:13px!important;line-height:1!important;',
|
|
311
|
+
'text-align:left!important;cursor:pointer!important;white-space:nowrap!important}',
|
|
312
|
+
'[' + MORE_ROW_MARK + '] svg{flex:none!important;opacity:.7!important}',
|
|
313
|
+
'@media (hover:hover){[' + MORE_ROW_MARK + ']:hover{background:var(--dsw-alias-interactive-bg-hover,rgba(0,0,0,.06))!important}}',
|
|
314
|
+
/* 底部入口行(Maple 账户 + 手机/电脑)在浮窗内横排 */
|
|
315
|
+
'[' + MORE_ITEM_MARK + '][' + MORE_SEATS_MARK + ']{display:flex!important;flex-direction:row!important;align-items:center!important;gap:2px!important}',
|
|
316
|
+
'[' + MORE_ITEM_MARK + '][' + MORE_SEATS_MARK + '] > *{flex:0 1 auto!important;min-width:0!important;display:flex!important;align-items:center!important}',
|
|
317
|
+
/* 面板列表收进浮窗:去掉自身表面(背板统一提供),保留滚动 */
|
|
318
|
+
'nav[' + MORE_ITEM_MARK + ']{position:fixed!important;z-index:1090!important;box-sizing:border-box!important;',
|
|
319
|
+
'display:flex!important;flex-direction:column!important;gap:2px!important;height:auto!important;',
|
|
320
|
+
'background:transparent!important;border:0!important;box-shadow:none!important;',
|
|
321
|
+
'padding:0!important;margin:0!important;max-height:min(60vh,420px)!important;',
|
|
322
|
+
'overflow-x:hidden!important;overflow-y:auto!important;transform:none!important}',
|
|
323
|
+
'nav[' + MORE_ITEM_MARK + '] > *{flex:none!important}',
|
|
324
|
+
/* 面板行样式(复刻 nav[MARK] 那份,标记不同故独立一份) */
|
|
325
|
+
'nav[' + MORE_ITEM_MARK + '] [class*="panelEntry"]{border-inline:0!important;border-radius:var(--dsw-radius-sm,6px)!important}',
|
|
326
|
+
'nav[' + MORE_ITEM_MARK + '] button[class*="panelRow"],',
|
|
327
|
+
'nav[' + MORE_ITEM_MARK + '] [class*="moreAnchor"] button{display:flex!important;align-items:center!important;justify-content:flex-start!important;gap:8px!important;',
|
|
328
|
+
'width:100%!important;height:30px!important;min-height:30px!important;margin:0!important;padding:0 8px!important;',
|
|
329
|
+
'border:0!important;background:transparent!important;color:inherit!important;font:inherit!important;font-size:13px!important;line-height:1!important;',
|
|
330
|
+
'text-align:left!important;cursor:pointer!important}',
|
|
331
|
+
'@media (hover:hover){nav[' + MORE_ITEM_MARK + '] button[class*="panelRow"]:hover,',
|
|
332
|
+
'nav[' + MORE_ITEM_MARK + '] [class*="moreAnchor"] button:hover{background:transparent!important}}',
|
|
333
|
+
'nav[' + MORE_ITEM_MARK + '] [class*="panelTitle"]{display:none!important}',
|
|
334
|
+
'nav[' + MORE_ITEM_MARK + '] button[class*="panelRow"]::after,',
|
|
335
|
+
'nav[' + MORE_ITEM_MARK + '] [class*="moreAnchor"] button::after{content:attr(aria-label);flex:1 1 auto!important;min-width:0!important;',
|
|
336
|
+
'overflow:hidden!important;text-overflow:ellipsis!important;white-space:nowrap!important}',
|
|
337
|
+
'nav[' + MORE_ITEM_MARK + '] [class*="panelGlyph"]{width:16px!important;height:16px!important;flex:none!important;',
|
|
338
|
+
'color:var(--dsw-alias-menu-icon,currentColor)!important}',
|
|
339
|
+
'nav[' + MORE_ITEM_MARK + '] [class*="panelUnpin"]{display:none!important}',
|
|
340
|
+
].join('')
|
|
341
|
+
|
|
342
|
+
/** 注入一张归属本插件的样式表(卸载时调用方 remove)。id 可选(动态过滤表用)。 */
|
|
343
|
+
function styleTag(css, id) {
|
|
344
|
+
var t = document.createElement('style')
|
|
345
|
+
t.dataset.plugin = PACKAGE_ID
|
|
346
|
+
if (id) t.id = id
|
|
347
|
+
t.textContent = css
|
|
348
|
+
document.head.appendChild(t)
|
|
349
|
+
return t
|
|
350
|
+
}
|
|
351
|
+
|
|
352
|
+
return {
|
|
353
|
+
name: 'caption-map',
|
|
354
|
+
apply: function (ctx) {
|
|
355
|
+
/* macOS 让位:宿主 preload 在页面脚本前钉死 html[data-platform]。darwin 上
|
|
356
|
+
* 区域映射 / 挂载锚 / 固定侧栏 / 聊天停靠整体交给 @capyclaw/caption-map-macos
|
|
357
|
+
* (它只在 darwin 生效),本包四条 effect 全部早退、不设 owner 标记,避免双
|
|
358
|
+
* provide captionExtra / 双 owner / 双 fixed-sidebar 冲突。win32 / 纯 web 照旧。 */
|
|
359
|
+
var IS_DARWIN = document.documentElement.getAttribute('data-platform') === 'darwin'
|
|
360
|
+
|
|
361
|
+
/* 让位标记:聊天窗停靠由本包接管。老的 @capyclaw/chat-dock 见到它就自己退出,
|
|
362
|
+
* 两个包同时启用时不会各有一个人去搬同一块面板。darwin 上由 mac 包设标记。 */
|
|
363
|
+
if (!IS_DARWIN) {
|
|
364
|
+
try { window.__CAPYCLAW_CHAT_DOCK_OWNER__ = PACKAGE_ID } catch (error) { /* 忽略 */ }
|
|
365
|
+
}
|
|
366
|
+
|
|
367
|
+
/** 预留栏位 = 显式挂载锚:「其他」右侧一枚场。无消费者时是虚线占位盒;
|
|
368
|
+
消费者经 ctx.captionExtra 服务 acquire 后,内层 mount 节点交给它挂 React 根,
|
|
369
|
+
占位 span 隐藏、外盒去虚线自撑。纯自有节点:pass 注入/排布、yield 移除,
|
|
370
|
+
不需要样式账本(不钉宿主节点)。编排器把「其他」排布后的 cursor 传进来,故永远接在其右侧。
|
|
371
|
+
多租约可拓展:acquire/release/getMount 接受可选 owner 键,每个 owner 一枚独立
|
|
372
|
+
mount 子节点按 acquire 序横排;无参调用等价 owner='default'(向后兼容)。
|
|
373
|
+
服务在 apply 作用域创建(早于 region-map effect),保证消费者 inject 能尽早解析。 */
|
|
374
|
+
var extraSlot = (function () {
|
|
375
|
+
var el = null
|
|
376
|
+
var leases = [] /* 有序租约 [{key, el}],acquire 序即横排序 */
|
|
377
|
+
var dirty = false
|
|
378
|
+
var listeners = []
|
|
379
|
+
function norm(owner) { return owner || 'default' }
|
|
380
|
+
function find(key) { for (var i = 0; i < leases.length; i++) if (leases[i].key === key) return leases[i]; return null }
|
|
381
|
+
function notify() { dirty = false; for (var i = 0; i < listeners.length; i++) listeners[i]() }
|
|
382
|
+
function placeholder() { return el ? el.querySelector('span') : null }
|
|
383
|
+
function mountId(key) { return key === 'default' ? EXTRA_SLOT_ID + '-mount' : EXTRA_SLOT_ID + '-mount-' + key }
|
|
384
|
+
/** 外盒在场时,为每个租约保证一枚连着的 mount 子节点(让位重建后补建)。 */
|
|
385
|
+
function syncMounts() {
|
|
386
|
+
if (!el || !el.isConnected) return
|
|
387
|
+
for (var i = 0; i < leases.length; i++) {
|
|
388
|
+
var L = leases[i]
|
|
389
|
+
if (L.el && L.el.isConnected && L.el.parentNode === el) continue
|
|
390
|
+
var m = document.createElement('div')
|
|
391
|
+
m.id = mountId(L.key)
|
|
392
|
+
m.setAttribute(EXTRA_SLOT_MOUNT_MARK, '')
|
|
393
|
+
m.setAttribute('data-owner', L.key)
|
|
394
|
+
el.appendChild(m)
|
|
395
|
+
L.el = m
|
|
396
|
+
dirty = true
|
|
397
|
+
}
|
|
398
|
+
}
|
|
399
|
+
function visuals() {
|
|
400
|
+
if (!el) return
|
|
401
|
+
var ph = placeholder()
|
|
402
|
+
if (ph) ph.style.display = leases.length ? 'none' : ''
|
|
403
|
+
if (leases.length) { el.setAttribute('data-occupied', ''); el.setAttribute('role', 'group') }
|
|
404
|
+
else { el.removeAttribute('data-occupied'); el.setAttribute('role', 'status') }
|
|
405
|
+
}
|
|
406
|
+
function ensure() {
|
|
407
|
+
if (el && el.isConnected) { syncMounts(); return el }
|
|
408
|
+
var node = document.getElementById(EXTRA_SLOT_ID)
|
|
409
|
+
if (!node) {
|
|
410
|
+
node = document.createElement('div')
|
|
411
|
+
node.id = EXTRA_SLOT_ID
|
|
412
|
+
node.setAttribute(EXTRA_SLOT_MARK, '')
|
|
413
|
+
node.setAttribute('role', 'status')
|
|
414
|
+
node.setAttribute('aria-label', EXTRA_SLOT_LABEL)
|
|
415
|
+
node.title = EXTRA_SLOT_LABEL
|
|
416
|
+
node.innerHTML = '<span>' + EXTRA_SLOT_LABEL + '</span>'
|
|
417
|
+
document.body.appendChild(node)
|
|
418
|
+
}
|
|
419
|
+
el = node
|
|
420
|
+
syncMounts()
|
|
421
|
+
visuals()
|
|
422
|
+
return node
|
|
423
|
+
}
|
|
424
|
+
return {
|
|
425
|
+
pass: function (left, capH) {
|
|
426
|
+
var node = ensure()
|
|
427
|
+
var s = node.style
|
|
428
|
+
s.position = 'fixed'
|
|
429
|
+
s.top = ((capH - 28) / 2) + 'px'
|
|
430
|
+
s.left = left + 'px'
|
|
431
|
+
s.zIndex = '1080'
|
|
432
|
+
s.webkitAppRegion = 'no-drag'
|
|
433
|
+
/* 不挤占右侧原生 min/max/close 预留区:放不下整枚隐藏 */
|
|
434
|
+
var w = node.getBoundingClientRect().width
|
|
435
|
+
s.display = (left + w > window.innerWidth - CAPTION_RIGHT_RESERVE) ? 'none' : ''
|
|
436
|
+
if (dirty) notify()
|
|
437
|
+
return left + w + GAP
|
|
438
|
+
},
|
|
439
|
+
yield: function () { if (el) { el.remove(); el = null } dirty = true; notify() },
|
|
440
|
+
/* 唯一对外契约:挂载锚(多租约)。消费者只拿自己的 mount 节点,不读 caption-map 任何其它 DOM。 */
|
|
441
|
+
service: {
|
|
442
|
+
acquire: function (owner) {
|
|
443
|
+
var key = norm(owner)
|
|
444
|
+
if (find(key)) return true /* 幂等 */
|
|
445
|
+
leases.push({ key: key, el: null })
|
|
446
|
+
syncMounts()
|
|
447
|
+
visuals()
|
|
448
|
+
dirty = true
|
|
449
|
+
notify()
|
|
450
|
+
return true
|
|
451
|
+
},
|
|
452
|
+
release: function (owner) {
|
|
453
|
+
var key = norm(owner)
|
|
454
|
+
var L = find(key)
|
|
455
|
+
if (!L) return false
|
|
456
|
+
if (L.el) L.el.remove()
|
|
457
|
+
leases.splice(leases.indexOf(L), 1)
|
|
458
|
+
visuals()
|
|
459
|
+
dirty = true
|
|
460
|
+
notify()
|
|
461
|
+
return true
|
|
462
|
+
},
|
|
463
|
+
getMount: function (owner) {
|
|
464
|
+
var L = find(norm(owner))
|
|
465
|
+
return (L && el && el.isConnected && L.el && L.el.isConnected && L.el.parentNode === el) ? L.el : null
|
|
466
|
+
},
|
|
467
|
+
subscribe: function (fn) { listeners.push(fn); return function () { var i = listeners.indexOf(fn); if (i >= 0) listeners.splice(i, 1) } }
|
|
468
|
+
}
|
|
469
|
+
}
|
|
470
|
+
})()
|
|
471
|
+
|
|
472
|
+
/* 挂载锚服务:cordis provide,卸载对称 unprovide(消费者 inject 随之失效)。 */
|
|
473
|
+
ctx.effect(function () {
|
|
474
|
+
if (IS_DARWIN) return function () {} /* darwin 由 caption-map-macos 提供 */
|
|
475
|
+
var svc = extraSlot.service
|
|
476
|
+
var un = (typeof ctx.provide === 'function') ? ctx.provide('captionExtra', svc)
|
|
477
|
+
: (ctx.reflect && typeof ctx.reflect.provide === 'function') ? ctx.reflect.provide('captionExtra', svc) : null
|
|
478
|
+
return function () { if (typeof un === 'function') un() }
|
|
479
|
+
}, 'caption-map: extra slot mount service')
|
|
480
|
+
|
|
481
|
+
ctx.effect(function () {
|
|
482
|
+
if (IS_DARWIN) return function () {} /* darwin 区域映射由 caption-map-macos 接管 */
|
|
483
|
+
var tag = styleTag(CSS)
|
|
484
|
+
|
|
485
|
+
/* ── 共享底座 kit ─────────────────────────────────────────── */
|
|
486
|
+
|
|
487
|
+
function menubar() { return document.querySelector('[data-windows-menu]') }
|
|
488
|
+
function active() { return document.documentElement.hasAttribute('data-windows-titlebar') && !!menubar() }
|
|
489
|
+
function drawer() { return !!document.querySelector('[data-sidebar-drawer]') }
|
|
490
|
+
function collapsed() { return !!document.querySelector('[data-sidebar-collapsed="true"]') }
|
|
491
|
+
|
|
492
|
+
/** 每特性一份样式账本:adopt 记下原内联样式并打标记,restore 逐字还原。
|
|
493
|
+
各特性互不共享映射表——编排器无需「跳过哪些选择器」的耦合清单。 */
|
|
494
|
+
function makeLedger(mark) {
|
|
495
|
+
var saved = new Map()
|
|
496
|
+
var ledger = {
|
|
497
|
+
has: function (el) { return saved.has(el) },
|
|
498
|
+
adopt: function (el) {
|
|
499
|
+
if (!saved.has(el)) saved.set(el, el.style.cssText)
|
|
500
|
+
el.setAttribute(mark, '')
|
|
501
|
+
},
|
|
502
|
+
restore: function (el) {
|
|
503
|
+
var s = saved.get(el)
|
|
504
|
+
if (s === undefined) return
|
|
505
|
+
el.style.cssText = s
|
|
506
|
+
el.removeAttribute(mark)
|
|
507
|
+
saved.delete(el)
|
|
508
|
+
},
|
|
509
|
+
restoreAll: function () { saved.forEach(function (_s, el) { ledger.restore(el) }) },
|
|
510
|
+
/* 还原匹配 sel 的旧节点(侧栏重挂载后的残留),keep 除外。
|
|
511
|
+
已断连的节点无条件还原:带父级组合符的选择器(如 BRAND_SEL)
|
|
512
|
+
在节点脱 DOM 后 matches 永不命中,不兜底会留下带钉子的孤儿。 */
|
|
513
|
+
stale: function (keep, sel) {
|
|
514
|
+
saved.forEach(function (_s, el) {
|
|
515
|
+
if (el === keep) return
|
|
516
|
+
if (!el.isConnected || (el.matches && el.matches(sel))) ledger.restore(el)
|
|
517
|
+
})
|
|
518
|
+
},
|
|
519
|
+
/* 还原不再是 targets 或已断连的节点(席位/整行用) */
|
|
520
|
+
reconcile: function (targets) {
|
|
521
|
+
saved.forEach(function (_s, el) {
|
|
522
|
+
if (targets.indexOf(el) === -1 || !el.isConnected) ledger.restore(el)
|
|
523
|
+
})
|
|
524
|
+
},
|
|
525
|
+
}
|
|
526
|
+
return ledger
|
|
527
|
+
}
|
|
528
|
+
|
|
529
|
+
/** 原父容器收零(节点脱流后的留白/分隔线)。共享记账,卸载统一还原。 */
|
|
530
|
+
var markedParents = new Set()
|
|
531
|
+
function markSrc(el) {
|
|
532
|
+
var p = el.parentElement
|
|
533
|
+
if (!p || p === document.body) return null
|
|
534
|
+
if (!markedParents.has(p)) { p.setAttribute(SRC_MARK, ''); markedParents.add(p) }
|
|
535
|
+
return p
|
|
536
|
+
}
|
|
537
|
+
function releaseSrc(p) {
|
|
538
|
+
if (!p) return
|
|
539
|
+
p.removeAttribute(SRC_MARK)
|
|
540
|
+
markedParents.delete(p)
|
|
541
|
+
}
|
|
542
|
+
|
|
543
|
+
/** 被容器隔离的祖先(container-type 让 fixed 相对它定位)→ 原值。 */
|
|
544
|
+
var uncontained = new Map()
|
|
545
|
+
/** 容器隔离兜底:量出来 fixed 没落在期望位置,就把建立包含块的那层还原成
|
|
546
|
+
normal 再重排一次。paintNav / paintWs 共用这一份。 */
|
|
547
|
+
function escapeContainment(el, expectLeft, expectTop) {
|
|
548
|
+
var box = el.getBoundingClientRect()
|
|
549
|
+
if (Math.abs(box.left - expectLeft) <= 2 && Math.abs(box.top - expectTop) <= 2) return
|
|
550
|
+
var node = el.parentElement
|
|
551
|
+
while (node && node !== document.body) {
|
|
552
|
+
var ct = getComputedStyle(node).containerType
|
|
553
|
+
if (ct && ct !== 'normal') {
|
|
554
|
+
if (!uncontained.has(node)) uncontained.set(node, node.style.containerType)
|
|
555
|
+
node.style.containerType = 'normal'
|
|
556
|
+
schedule()
|
|
557
|
+
break
|
|
558
|
+
}
|
|
559
|
+
node = node.parentElement
|
|
560
|
+
}
|
|
561
|
+
}
|
|
562
|
+
|
|
563
|
+
/** 左夹取:下拉/浮窗不越过窗口右缘(留 8px)。 */
|
|
564
|
+
function clampLeft(left, width) {
|
|
565
|
+
if (left + width > window.innerWidth - 8) return Math.max(8, window.innerWidth - 8 - width)
|
|
566
|
+
return left
|
|
567
|
+
}
|
|
568
|
+
|
|
569
|
+
/** 触发按钮定位(「其他」与文件夹按钮同款)。top 缺省 = 标题栏行垂直居中。 */
|
|
570
|
+
function paintTrigger(btn, left, capH, top) {
|
|
571
|
+
var s = btn.style
|
|
572
|
+
s.position = 'fixed'
|
|
573
|
+
s.top = (top != null ? top : (capH - 28) / 2) + 'px'
|
|
574
|
+
s.left = left + 'px'
|
|
575
|
+
s.zIndex = '1080'
|
|
576
|
+
}
|
|
577
|
+
/** 注入一枚我们拥有的触发按钮(卸载时移除)。 */
|
|
578
|
+
function makeTriggerButton(opts) {
|
|
579
|
+
var btn = document.createElement('button')
|
|
580
|
+
btn.type = 'button'
|
|
581
|
+
if (opts.id) btn.id = opts.id
|
|
582
|
+
btn.setAttribute(opts.mark, '')
|
|
583
|
+
if (opts.group != null) btn.setAttribute('data-ws-group', opts.group)
|
|
584
|
+
btn.setAttribute('aria-haspopup', 'menu')
|
|
585
|
+
if (opts.expanded != null) btn.setAttribute('aria-expanded', opts.expanded)
|
|
586
|
+
btn.innerHTML = opts.html
|
|
587
|
+
btn.addEventListener('click', opts.onClick)
|
|
588
|
+
document.body.appendChild(btn)
|
|
589
|
+
return btn
|
|
590
|
+
}
|
|
591
|
+
|
|
592
|
+
/** 下拉开合状态 + 互斥注册表:开一个自动收其它。onChange 承接各特性的
|
|
593
|
+
aria 同步 / 过滤清理等副作用。新增下拉只需再 makeOpenState 一枚。 */
|
|
594
|
+
var dropdowns = []
|
|
595
|
+
function makeOpenState(attr, onChange) {
|
|
596
|
+
var state = {
|
|
597
|
+
isOpen: function () { return document.documentElement.hasAttribute(attr) },
|
|
598
|
+
set: function (open) {
|
|
599
|
+
if (open) {
|
|
600
|
+
for (var i = 0; i < dropdowns.length; i++) if (dropdowns[i] !== state) dropdowns[i].set(false)
|
|
601
|
+
document.documentElement.setAttribute(attr, '')
|
|
602
|
+
} else {
|
|
603
|
+
document.documentElement.removeAttribute(attr)
|
|
604
|
+
}
|
|
605
|
+
if (onChange) onChange(open)
|
|
606
|
+
},
|
|
607
|
+
clear: function () { document.documentElement.removeAttribute(attr) },
|
|
608
|
+
}
|
|
609
|
+
dropdowns.push(state)
|
|
610
|
+
return state
|
|
611
|
+
}
|
|
612
|
+
|
|
613
|
+
/* 点空白/Esc 收起的策略分发:每个下拉特性注册自己的 onClick/onEsc。 */
|
|
614
|
+
var dropdownFeatures = []
|
|
615
|
+
|
|
616
|
+
var timer = 0
|
|
617
|
+
var lastMode = ''
|
|
618
|
+
|
|
619
|
+
/* ── 特性模块 ─────────────────────────────────────────────── */
|
|
620
|
+
|
|
621
|
+
/** 鲸鱼图标:展开态钉顶栏 left:12 只留图标;折叠/drawer 交外壳。 */
|
|
622
|
+
var brand = (function () {
|
|
623
|
+
var ledger = makeLedger(MARK)
|
|
624
|
+
function target() {
|
|
625
|
+
var el = document.querySelector(BRAND_SEL)
|
|
626
|
+
if (!el || !el.isConnected || !active()) return null
|
|
627
|
+
if (drawer() || collapsed()) return null
|
|
628
|
+
var st = getComputedStyle(el)
|
|
629
|
+
if (!ledger.has(el) && (st.display === 'none' || st.visibility === 'hidden')) return null
|
|
630
|
+
return el
|
|
631
|
+
}
|
|
632
|
+
function paint(el) {
|
|
633
|
+
ledger.adopt(el)
|
|
634
|
+
var s = el.style
|
|
635
|
+
s.display = 'flex'
|
|
636
|
+
s.position = 'fixed'
|
|
637
|
+
s.left = BRAND_LEFT + 'px'
|
|
638
|
+
s.top = 'calc((var(--dsh-windows-titlebar-height, 40px) - 28px) / 2)'
|
|
639
|
+
s.width = '28px'
|
|
640
|
+
s.height = '28px'
|
|
641
|
+
s.margin = '0'
|
|
642
|
+
s.padding = '0'
|
|
643
|
+
s.border = 'none'
|
|
644
|
+
s.background = 'transparent'
|
|
645
|
+
s.alignItems = 'center'
|
|
646
|
+
s.justifyContent = 'center'
|
|
647
|
+
s.flex = 'none'
|
|
648
|
+
s.zIndex = '30'
|
|
649
|
+
s.webkitAppRegion = 'no-drag'
|
|
650
|
+
}
|
|
651
|
+
return {
|
|
652
|
+
pass: function () {
|
|
653
|
+
var el = target()
|
|
654
|
+
ledger.stale(el, BRAND_SEL)
|
|
655
|
+
if (el) paint(el)
|
|
656
|
+
},
|
|
657
|
+
yield: function () { ledger.restoreAll() },
|
|
658
|
+
}
|
|
659
|
+
})()
|
|
660
|
+
|
|
661
|
+
/** 新会话按钮:展开态整格收起(鲸鱼兼作入口);折叠/drawer 交外壳。 */
|
|
662
|
+
var newSession = (function () {
|
|
663
|
+
var ledger = makeLedger(MARK)
|
|
664
|
+
var parent = null
|
|
665
|
+
function target() {
|
|
666
|
+
var btn = document.querySelector(NS_BTN)
|
|
667
|
+
if (!btn || !btn.isConnected || !active()) return null
|
|
668
|
+
/* drawer 模式 shell.leading 自带 ⊕;折叠态外壳自己钉——都不插手 */
|
|
669
|
+
if (drawer() || collapsed()) return null
|
|
670
|
+
var st = getComputedStyle(btn)
|
|
671
|
+
/* 被外壳隐藏(visibility 等)不钉;我们自己藏的(账本里)要继续管 */
|
|
672
|
+
if (!ledger.has(btn) && (st.display === 'none' || st.visibility === 'hidden')) return null
|
|
673
|
+
return btn
|
|
674
|
+
}
|
|
675
|
+
function paint(btn) {
|
|
676
|
+
ledger.adopt(btn)
|
|
677
|
+
btn.style.display = 'none'
|
|
678
|
+
parent = markSrc(btn)
|
|
679
|
+
}
|
|
680
|
+
function release() { releaseSrc(parent); parent = null }
|
|
681
|
+
return {
|
|
682
|
+
pass: function () {
|
|
683
|
+
var btn = target()
|
|
684
|
+
ledger.stale(btn, NS_BTN)
|
|
685
|
+
if (btn) { paint(btn); return }
|
|
686
|
+
/* 不插手时把原父容器的留白压缩还回去(折叠态 rail 间距归外壳管) */
|
|
687
|
+
release()
|
|
688
|
+
},
|
|
689
|
+
yield: function () { ledger.restoreAll(); release() },
|
|
690
|
+
}
|
|
691
|
+
})()
|
|
692
|
+
|
|
693
|
+
/** 底部入口行 / 逐席位:fixed 进标题栏第一行,返回排布后的 cursor。 */
|
|
694
|
+
var seats = (function () {
|
|
695
|
+
var ledger = makeLedger(MARK)
|
|
696
|
+
function paint(el, left, capH, maxW) {
|
|
697
|
+
ledger.adopt(el)
|
|
698
|
+
var s = el.style
|
|
699
|
+
s.position = 'fixed'
|
|
700
|
+
s.top = '0px'
|
|
701
|
+
s.left = left + 'px'
|
|
702
|
+
s.height = capH + 'px'
|
|
703
|
+
s.width = 'auto'
|
|
704
|
+
s.maxWidth = maxW + 'px'
|
|
705
|
+
s.margin = '0'
|
|
706
|
+
s.padding = '0 2px'
|
|
707
|
+
s.display = 'flex'
|
|
708
|
+
s.flexDirection = 'row'
|
|
709
|
+
s.alignItems = 'center'
|
|
710
|
+
s.justifyContent = 'flex-start'
|
|
711
|
+
s.gap = '2px'
|
|
712
|
+
s.zIndex = '1080'
|
|
713
|
+
s.background = 'transparent'
|
|
714
|
+
s.border = '0'
|
|
715
|
+
s.boxShadow = 'none'
|
|
716
|
+
s.transform = 'none'
|
|
717
|
+
/* 不裁切:席位里的下拉/弹出菜单要能溢出映射行显示(overflow:hidden
|
|
718
|
+
会把菜单裁掉,表现为「按钮点了没反应」)。 */
|
|
719
|
+
s.overflow = 'visible'
|
|
720
|
+
s.flex = 'none'
|
|
721
|
+
s.webkitAppRegion = 'no-drag'
|
|
722
|
+
markSrc(el)
|
|
723
|
+
}
|
|
724
|
+
return {
|
|
725
|
+
owns: function (el) { return ledger.has(el) },
|
|
726
|
+
pass: function (targets, cursor, capH) {
|
|
727
|
+
ledger.reconcile(targets)
|
|
728
|
+
for (var i = 0; i < targets.length; i++) {
|
|
729
|
+
var maxW = Math.max(80, window.innerWidth - cursor - CAPTION_RIGHT_RESERVE)
|
|
730
|
+
paint(targets[i], cursor, capH, maxW)
|
|
731
|
+
cursor += targets[i].getBoundingClientRect().width + GAP
|
|
732
|
+
}
|
|
733
|
+
return cursor
|
|
734
|
+
},
|
|
735
|
+
yield: function () { ledger.restoreAll() },
|
|
736
|
+
}
|
|
737
|
+
})()
|
|
738
|
+
|
|
739
|
+
/** 「其他」分组:一枚触发按钮 + nav.panelList 下拉。 */
|
|
740
|
+
var others = (function () {
|
|
741
|
+
var ledger = makeLedger(MARK)
|
|
742
|
+
var trigger = null
|
|
743
|
+
var open = makeOpenState(OPEN_ATTR, function (isOpen) {
|
|
744
|
+
if (trigger) trigger.setAttribute('aria-expanded', isOpen ? 'true' : 'false')
|
|
745
|
+
})
|
|
746
|
+
function ensureTrigger() {
|
|
747
|
+
if (trigger && trigger.isConnected) return trigger
|
|
748
|
+
var btn = document.getElementById(TRIGGER_ID)
|
|
749
|
+
if (!btn) {
|
|
750
|
+
btn = makeTriggerButton({
|
|
751
|
+
id: TRIGGER_ID, mark: TRIGGER_MARK,
|
|
752
|
+
html: '<span>' + OTHERS_LABEL + '</span>' + CHEVRON,
|
|
753
|
+
onClick: function (event) {
|
|
754
|
+
/* 顶栏是拖拽区:别让事件继续冒到窗口拖动逻辑上 */
|
|
755
|
+
event.preventDefault()
|
|
756
|
+
event.stopPropagation()
|
|
757
|
+
open.set(!open.isOpen())
|
|
758
|
+
},
|
|
759
|
+
})
|
|
760
|
+
}
|
|
761
|
+
trigger = btn
|
|
762
|
+
if (btn.getAttribute('aria-expanded') === null) btn.setAttribute('aria-expanded', open.isOpen() ? 'true' : 'false')
|
|
763
|
+
return btn
|
|
764
|
+
}
|
|
765
|
+
function paintNav(el, left, capH) {
|
|
766
|
+
ledger.adopt(el)
|
|
767
|
+
var clamped = clampLeft(left, NAV_WIDTH)
|
|
768
|
+
var s = el.style
|
|
769
|
+
s.position = 'fixed'
|
|
770
|
+
s.top = (capH + 4) + 'px'
|
|
771
|
+
s.left = clamped + 'px'
|
|
772
|
+
s.width = NAV_WIDTH + 'px'
|
|
773
|
+
s.zIndex = '1090'
|
|
774
|
+
s.webkitAppRegion = 'no-drag'
|
|
775
|
+
escapeContainment(el, clamped, capH + 4)
|
|
776
|
+
}
|
|
777
|
+
return {
|
|
778
|
+
isOpen: open.isOpen,
|
|
779
|
+
pass: function (navEl, left, capH) {
|
|
780
|
+
if (!navEl) {
|
|
781
|
+
if (trigger) { open.set(false); trigger.remove(); trigger = null }
|
|
782
|
+
open.clear()
|
|
783
|
+
return left
|
|
784
|
+
}
|
|
785
|
+
/* 侧栏重挂载后旧 nav 会留在账本里:还原它,别留一枚隐藏的 fixed 空盒 */
|
|
786
|
+
ledger.stale(navEl, NAV_SEL)
|
|
787
|
+
var btn = ensureTrigger()
|
|
788
|
+
paintTrigger(btn, left, capH)
|
|
789
|
+
paintNav(navEl, left, capH)
|
|
790
|
+
return left + btn.getBoundingClientRect().width + GAP
|
|
791
|
+
},
|
|
792
|
+
yield: function () {
|
|
793
|
+
if (trigger) { trigger.remove(); trigger = null }
|
|
794
|
+
open.clear()
|
|
795
|
+
ledger.restoreAll()
|
|
796
|
+
},
|
|
797
|
+
onClick: function (target) {
|
|
798
|
+
if (!open.isOpen()) return
|
|
799
|
+
if (target.closest('#' + TRIGGER_ID)) return /* 触发按钮自己 toggle */
|
|
800
|
+
/* 「更多」自己弹菜单:让菜单按可见位置量锚点,别提前把列表藏起来 */
|
|
801
|
+
if (target.closest('nav[' + MARK + '] [aria-haspopup="menu"]')) return
|
|
802
|
+
open.set(false)
|
|
803
|
+
},
|
|
804
|
+
onEsc: function () { if (open.isOpen()) open.set(false) },
|
|
805
|
+
}
|
|
806
|
+
})()
|
|
807
|
+
|
|
808
|
+
/** 工作区收藏夹:每个分组一枚文件夹按钮 + 各自下拉浮窗。 */
|
|
809
|
+
var workspaces = (function () {
|
|
810
|
+
var ledger = makeLedger(WS_MARK)
|
|
811
|
+
var buttons = new Map() /* 分组 key → 注入的文件夹按钮 */
|
|
812
|
+
var openGroup = null /* 当前展开下拉的分组 key */
|
|
813
|
+
var filterTag = null /* 动态过滤样式:浮窗里只显目标分组的会话 */
|
|
814
|
+
var parent = null
|
|
815
|
+
var open = makeOpenState(WS_OPEN_ATTR, function (isOpen) {
|
|
816
|
+
if (!isOpen) {
|
|
817
|
+
openGroup = null
|
|
818
|
+
if (filterTag) filterTag.textContent = ''
|
|
819
|
+
}
|
|
820
|
+
buttons.forEach(function (btn, key) {
|
|
821
|
+
btn.setAttribute('aria-expanded', isOpen && key === openGroup ? 'true' : 'false')
|
|
822
|
+
})
|
|
823
|
+
})
|
|
824
|
+
/** 原生组头列表(DOM 序):key / 标签 / 组头节点。 */
|
|
825
|
+
function groups(root) {
|
|
826
|
+
var out = []
|
|
827
|
+
var heads = root.querySelectorAll('[data-row-key^="workspace:"]')
|
|
828
|
+
for (var i = 0; i < heads.length; i++) {
|
|
829
|
+
var h = heads[i]
|
|
830
|
+
var key = h.getAttribute('data-row-key').slice('workspace:'.length)
|
|
831
|
+
var text = h.querySelector('[class*="projectText"]')
|
|
832
|
+
out.push({ key: key, label: text ? text.textContent : key, header: h })
|
|
833
|
+
}
|
|
834
|
+
return out
|
|
835
|
+
}
|
|
836
|
+
/** 过滤样式:组头全藏(按钮已带组名),会话行只留目标分组的;
|
|
837
|
+
搜索结果行是全局搜索,照常显示。规则后写覆盖先写(同特异性)。 */
|
|
838
|
+
function applyFilter(root, key) {
|
|
839
|
+
if (!filterTag) filterTag = styleTag('', WS_FILTER_ID)
|
|
840
|
+
var show = []
|
|
841
|
+
var cur = null
|
|
842
|
+
var rows = root.querySelectorAll('[data-row-key]')
|
|
843
|
+
for (var i = 0; i < rows.length; i++) {
|
|
844
|
+
var rk = rows[i].getAttribute('data-row-key')
|
|
845
|
+
if (rk.indexOf('workspace:') === 0) { cur = rk.slice('workspace:'.length); continue }
|
|
846
|
+
if (cur !== key) continue
|
|
847
|
+
if (rk.indexOf('session:') === 0 || rk === 'overflow:' + key) show.push(rk)
|
|
848
|
+
}
|
|
849
|
+
var css = 'div[' + WS_MARK + '] [data-row-key^="workspace:"]{display:none!important}'
|
|
850
|
+
+ 'div[' + WS_MARK + '] [data-row-key^="session:"]{display:none!important}'
|
|
851
|
+
+ 'div[' + WS_MARK + '] [data-row-key^="overflow:"]{display:none!important}'
|
|
852
|
+
+ 'div[' + WS_MARK + '] [data-row-key="empty"]{display:none!important}'
|
|
853
|
+
+ 'div[' + WS_MARK + '] [class*="searchResultRow"]{display:flex!important}'
|
|
854
|
+
for (var j = 0; j < show.length; j++) {
|
|
855
|
+
css += 'div[' + WS_MARK + '] [data-row-key=' + JSON.stringify(show[j]) + ']{display:flex!important}'
|
|
856
|
+
}
|
|
857
|
+
filterTag.textContent = css
|
|
858
|
+
}
|
|
859
|
+
function paintWs(el, left, capH) {
|
|
860
|
+
ledger.adopt(el)
|
|
861
|
+
var clamped = clampLeft(left, WS_WIDTH)
|
|
862
|
+
var s = el.style
|
|
863
|
+
s.position = 'fixed'
|
|
864
|
+
s.top = (capH + WS_ROW_H + 4) + 'px'
|
|
865
|
+
s.left = clamped + 'px'
|
|
866
|
+
s.width = WS_WIDTH + 'px'
|
|
867
|
+
s.zIndex = '1090'
|
|
868
|
+
s.webkitAppRegion = 'no-drag'
|
|
869
|
+
escapeContainment(el, clamped, capH + WS_ROW_H + 4)
|
|
870
|
+
}
|
|
871
|
+
/** 文件夹按钮点击:开/关/切换该分组的下拉,浮窗锚在按钮下方。 */
|
|
872
|
+
function click(key) {
|
|
873
|
+
return function (event) {
|
|
874
|
+
event.preventDefault()
|
|
875
|
+
event.stopPropagation()
|
|
876
|
+
if (open.isOpen() && openGroup === key) { open.set(false); return }
|
|
877
|
+
openGroup = key
|
|
878
|
+
open.set(true) /* 互斥注册表顺带收起「其他」 */
|
|
879
|
+
var root = wsRoot()
|
|
880
|
+
if (!root) { open.set(false); return }
|
|
881
|
+
var head = null
|
|
882
|
+
var heads = root.querySelectorAll('[data-row-key^="workspace:"]')
|
|
883
|
+
for (var i = 0; i < heads.length; i++) {
|
|
884
|
+
if (heads[i].getAttribute('data-row-key') === 'workspace:' + key) { head = heads[i]; break }
|
|
885
|
+
}
|
|
886
|
+
/* 收起的分组原生不挂载会话行:替用户点一下组头展开(状态归 React 管) */
|
|
887
|
+
if (head && head.getAttribute('aria-expanded') === 'false') head.click()
|
|
888
|
+
var btn = buttons.get(key)
|
|
889
|
+
var mr = menubar().getBoundingClientRect()
|
|
890
|
+
paintWs(root, btn ? btn.getBoundingClientRect().left : 0, mr.height || 40)
|
|
891
|
+
applyFilter(root, key)
|
|
892
|
+
}
|
|
893
|
+
}
|
|
894
|
+
function release() { releaseSrc(parent); parent = null }
|
|
895
|
+
function dropButtons() { buttons.forEach(function (btn) { btn.remove() }); buttons.clear() }
|
|
896
|
+
function dropFilter() { if (filterTag) { filterTag.remove(); filterTag = null } }
|
|
897
|
+
return {
|
|
898
|
+
isOpen: open.isOpen,
|
|
899
|
+
pass: function (wsEl, left, capH) {
|
|
900
|
+
if (!wsEl) {
|
|
901
|
+
open.set(false)
|
|
902
|
+
document.documentElement.removeAttribute(WS_ROW_ATTR)
|
|
903
|
+
dropButtons()
|
|
904
|
+
dropFilter()
|
|
905
|
+
ledger.restoreAll()
|
|
906
|
+
/* 原父容器(regionArea)的留白压缩还回去 */
|
|
907
|
+
release()
|
|
908
|
+
return
|
|
909
|
+
}
|
|
910
|
+
/* 侧栏重挂载后旧根会留在账本里:还原它,别留一枚隐藏的 fixed 空盒 */
|
|
911
|
+
ledger.stale(wsEl, WS_ROOT_SEL)
|
|
912
|
+
document.documentElement.setAttribute(WS_ROW_ATTR, '')
|
|
913
|
+
var gs = groups(wsEl)
|
|
914
|
+
/* 搜索态原生树整棵卸载(组头没了):按钮保持上一轮,浮窗里走全局搜索结果 */
|
|
915
|
+
if (!gs.length && wsEl.querySelector('[class*="searchExpanded"]')) {
|
|
916
|
+
var ob = openGroup ? buttons.get(openGroup) : null
|
|
917
|
+
paintWs(wsEl, ob ? parseFloat(ob.style.left) || left : left, capH)
|
|
918
|
+
if (open.isOpen() && openGroup) applyFilter(wsEl, openGroup)
|
|
919
|
+
parent = markSrc(wsEl)
|
|
920
|
+
return
|
|
921
|
+
}
|
|
922
|
+
var seen = new Set()
|
|
923
|
+
var cursor = left
|
|
924
|
+
var anchorLeft = left
|
|
925
|
+
for (var i = 0; i < gs.length; i++) {
|
|
926
|
+
var g = gs[i]
|
|
927
|
+
seen.add(g.key)
|
|
928
|
+
var btn = buttons.get(g.key)
|
|
929
|
+
if (!btn) {
|
|
930
|
+
btn = makeTriggerButton({
|
|
931
|
+
id: WS_BTN_PREFIX + g.key, mark: WS_TRIGGER_MARK, group: g.key, expanded: 'false',
|
|
932
|
+
html: FOLDER_ICON + '<span></span>' + CHEVRON,
|
|
933
|
+
onClick: click(g.key),
|
|
934
|
+
})
|
|
935
|
+
buttons.set(g.key, btn)
|
|
936
|
+
}
|
|
937
|
+
var labelSpan = btn.querySelector('span')
|
|
938
|
+
if (labelSpan && labelSpan.textContent !== g.label) labelSpan.textContent = g.label
|
|
939
|
+
paintTrigger(btn, cursor, capH, capH + (WS_ROW_H - 28) / 2)
|
|
940
|
+
if (openGroup === g.key) anchorLeft = cursor
|
|
941
|
+
cursor += btn.getBoundingClientRect().width + GAP
|
|
942
|
+
}
|
|
943
|
+
buttons.forEach(function (btn, key) {
|
|
944
|
+
if (!seen.has(key)) { btn.remove(); buttons.delete(key) }
|
|
945
|
+
})
|
|
946
|
+
if (openGroup && !seen.has(openGroup)) open.set(false)
|
|
947
|
+
paintWs(wsEl, anchorLeft, capH)
|
|
948
|
+
/* 开着时每次重排都刷新过滤:会话增删/搜索切换/自动展开后的挂载都能跟上 */
|
|
949
|
+
if (open.isOpen() && openGroup) applyFilter(wsEl, openGroup)
|
|
950
|
+
parent = markSrc(wsEl)
|
|
951
|
+
},
|
|
952
|
+
yield: function () {
|
|
953
|
+
open.set(false)
|
|
954
|
+
document.documentElement.removeAttribute(WS_ROW_ATTR)
|
|
955
|
+
dropButtons()
|
|
956
|
+
dropFilter()
|
|
957
|
+
ledger.restoreAll()
|
|
958
|
+
release()
|
|
959
|
+
},
|
|
960
|
+
onClick: function (target) {
|
|
961
|
+
if (!open.isOpen()) return
|
|
962
|
+
if (target.closest('[' + WS_TRIGGER_MARK + ']')) return /* 文件夹按钮自己 toggle */
|
|
963
|
+
var box = target.closest('div[' + WS_MARK + ']')
|
|
964
|
+
if (!box) { open.set(false); return }
|
|
965
|
+
/* 浮窗内:点会话行/搜索结果行 = 打开会话,收起(书签行为);
|
|
966
|
+
行内操作条(固定/归档/菜单)、组头折叠、搜索、添加、视图选项、
|
|
967
|
+
overflow 加载更多都保持开。 */
|
|
968
|
+
if (target.closest('[class*="rowActions"]')) return
|
|
969
|
+
if (target.closest('[data-row-key^="session:"]') || target.closest('[class*="searchResultRow"]')) open.set(false)
|
|
970
|
+
},
|
|
971
|
+
onEsc: function (target) {
|
|
972
|
+
if (!open.isOpen()) return
|
|
973
|
+
/* 搜索展开时 Esc 先交给原生输入框收搜索,第二次才收浮窗 */
|
|
974
|
+
if (target instanceof Element && target.closest('div[' + WS_MARK + '] [class*="searchExpanded"]')) return
|
|
975
|
+
open.set(false)
|
|
976
|
+
},
|
|
977
|
+
}
|
|
978
|
+
})()
|
|
979
|
+
|
|
980
|
+
/** 「更多」收拢(展开态):标题栏左起一枚按钮,点开统一浮窗,自上而下
|
|
981
|
+
新会话 / 折叠侧栏 / 应用·编辑 / 账户·设备 / 面板列表。菜单栏 host 与
|
|
982
|
+
底部入口行整块 fixed 进浮窗(弹出菜单按可见位置量锚点,行为不变);
|
|
983
|
+
新会话/折叠侧栏是注入行,程序点真按钮。鲸鱼/侧栏开关本体藏起。 */
|
|
984
|
+
var more = (function () {
|
|
985
|
+
var ledger = makeLedger(MORE_ITEM_MARK)
|
|
986
|
+
var trigger = null
|
|
987
|
+
var panel = null
|
|
988
|
+
var rowNew = null
|
|
989
|
+
var rowSidebar = null
|
|
990
|
+
var parents = []
|
|
991
|
+
var open = makeOpenState(MORE_OPEN_ATTR, function (isOpen) {
|
|
992
|
+
if (trigger) trigger.setAttribute('aria-expanded', isOpen ? 'true' : 'false')
|
|
993
|
+
})
|
|
994
|
+
function ensureTrigger() {
|
|
995
|
+
if (trigger && trigger.isConnected) return trigger
|
|
996
|
+
var btn = document.getElementById(MORE_TRIGGER_ID)
|
|
997
|
+
if (!btn) {
|
|
998
|
+
btn = makeTriggerButton({
|
|
999
|
+
id: MORE_TRIGGER_ID, mark: TRIGGER_MARK,
|
|
1000
|
+
html: '<span>' + MORE_LABEL + '</span>' + CHEVRON,
|
|
1001
|
+
onClick: function (event) {
|
|
1002
|
+
event.preventDefault()
|
|
1003
|
+
event.stopPropagation()
|
|
1004
|
+
open.set(!open.isOpen())
|
|
1005
|
+
},
|
|
1006
|
+
})
|
|
1007
|
+
}
|
|
1008
|
+
trigger = btn
|
|
1009
|
+
if (btn.getAttribute('aria-expanded') === null) btn.setAttribute('aria-expanded', open.isOpen() ? 'true' : 'false')
|
|
1010
|
+
return btn
|
|
1011
|
+
}
|
|
1012
|
+
/** 宿主所在的堆叠上下文祖先:背板必须挂进同一上下文,
|
|
1013
|
+
否则宿主的 z1150 被侧栏 fixed 上下文困住,背板(z1140)反盖住宿主、抢点击。 */
|
|
1014
|
+
function stackAnchor(el) {
|
|
1015
|
+
var n = el && el.parentElement
|
|
1016
|
+
while (n && n !== document.body && n !== document.documentElement) {
|
|
1017
|
+
var cs = getComputedStyle(n)
|
|
1018
|
+
if (cs.position === 'fixed' || cs.position === 'sticky' ||
|
|
1019
|
+
((cs.position === 'absolute' || cs.position === 'relative') && cs.zIndex !== 'auto') ||
|
|
1020
|
+
cs.transform !== 'none' || cs.filter !== 'none' || cs.opacity !== '1' ||
|
|
1021
|
+
cs.containerType !== 'normal' || cs.isolation === 'isolate' ||
|
|
1022
|
+
cs.mixBlendMode !== 'normal' || /transform|filter|opacity|container/.test(cs.willChange)) return n
|
|
1023
|
+
n = n.parentElement
|
|
1024
|
+
}
|
|
1025
|
+
return document.body
|
|
1026
|
+
}
|
|
1027
|
+
function ensurePanel(anchor) {
|
|
1028
|
+
if (panel && panel.isConnected) {
|
|
1029
|
+
if (anchor && panel.parentElement !== anchor) anchor.appendChild(panel)
|
|
1030
|
+
return panel
|
|
1031
|
+
}
|
|
1032
|
+
panel = document.createElement('div')
|
|
1033
|
+
panel.setAttribute(MORE_PANEL_MARK, '')
|
|
1034
|
+
rowNew = document.createElement('button')
|
|
1035
|
+
rowNew.type = 'button'
|
|
1036
|
+
rowNew.setAttribute(MORE_ROW_MARK, '')
|
|
1037
|
+
rowNew.innerHTML = PLUS_ICON + '<span>新会话</span>'
|
|
1038
|
+
rowNew.addEventListener('click', function (event) {
|
|
1039
|
+
event.preventDefault()
|
|
1040
|
+
var ns = document.querySelector(NS_BTN)
|
|
1041
|
+
if (ns) ns.click()
|
|
1042
|
+
open.set(false)
|
|
1043
|
+
})
|
|
1044
|
+
rowSidebar = document.createElement('button')
|
|
1045
|
+
rowSidebar.type = 'button'
|
|
1046
|
+
rowSidebar.setAttribute(MORE_ROW_MARK, '')
|
|
1047
|
+
rowSidebar.innerHTML = SIDEBAR_ICON + '<span>折叠侧栏</span>'
|
|
1048
|
+
rowSidebar.addEventListener('click', function (event) {
|
|
1049
|
+
event.preventDefault()
|
|
1050
|
+
var tg = document.querySelector('[data-sidebar-toggle]')
|
|
1051
|
+
if (tg) tg.click()
|
|
1052
|
+
open.set(false)
|
|
1053
|
+
})
|
|
1054
|
+
panel.appendChild(rowNew)
|
|
1055
|
+
panel.appendChild(rowSidebar)
|
|
1056
|
+
;(anchor || document.body).appendChild(panel)
|
|
1057
|
+
return panel
|
|
1058
|
+
}
|
|
1059
|
+
/** 只摆位置(不记账):注入行 / 背板用。 */
|
|
1060
|
+
function box(el, left, top, width, height) {
|
|
1061
|
+
var s = el.style
|
|
1062
|
+
s.position = 'fixed'
|
|
1063
|
+
s.top = top + 'px'
|
|
1064
|
+
s.left = left + 'px'
|
|
1065
|
+
s.width = width + 'px'
|
|
1066
|
+
if (height != null) s.height = height + 'px'
|
|
1067
|
+
s.margin = '0'
|
|
1068
|
+
s.zIndex = '1090'
|
|
1069
|
+
s.webkitAppRegion = 'no-drag'
|
|
1070
|
+
}
|
|
1071
|
+
/** 宿主节点:记账 + 摆位 + 破容器隔离。 */
|
|
1072
|
+
function place(el, left, top, width, height) {
|
|
1073
|
+
ledger.adopt(el)
|
|
1074
|
+
box(el, left, top, width, height)
|
|
1075
|
+
escapeContainment(el, left, top)
|
|
1076
|
+
}
|
|
1077
|
+
function hideEl(el) {
|
|
1078
|
+
if (!el || !el.isConnected) return
|
|
1079
|
+
ledger.adopt(el)
|
|
1080
|
+
el.style.display = 'none'
|
|
1081
|
+
}
|
|
1082
|
+
function releaseParents() {
|
|
1083
|
+
for (var i = 0; i < parents.length; i++) releaseSrc(parents[i])
|
|
1084
|
+
parents = []
|
|
1085
|
+
}
|
|
1086
|
+
return {
|
|
1087
|
+
owns: function (el) { return ledger.has(el) },
|
|
1088
|
+
isOpen: open.isOpen,
|
|
1089
|
+
pass: function (targets, navEl, capH) {
|
|
1090
|
+
var btn = ensureTrigger()
|
|
1091
|
+
paintTrigger(btn, MORE_LEFT, capH)
|
|
1092
|
+
var pnl = ensurePanel(stackAnchor(navEl || targets[0] || menubar()))
|
|
1093
|
+
var panelLeft = clampLeft(MORE_LEFT, MORE_WIDTH)
|
|
1094
|
+
var panelTop = capH + 4
|
|
1095
|
+
var innerLeft = panelLeft + MORE_PAD
|
|
1096
|
+
var innerWidth = MORE_WIDTH - 2 * MORE_PAD
|
|
1097
|
+
/* 本轮要收进浮窗/藏起的宿主节点清单:reconcile 还原重挂载残留 */
|
|
1098
|
+
var whale = document.querySelector(BRAND_SEL)
|
|
1099
|
+
var toggle = document.querySelector('[data-sidebar-toggle]')
|
|
1100
|
+
var mb = menubar()
|
|
1101
|
+
var keep = []
|
|
1102
|
+
if (whale) keep.push(whale)
|
|
1103
|
+
if (toggle) keep.push(toggle)
|
|
1104
|
+
if (mb) keep.push(mb)
|
|
1105
|
+
for (var k = 0; k < targets.length; k++) keep.push(targets[k])
|
|
1106
|
+
if (navEl) keep.push(navEl)
|
|
1107
|
+
ledger.reconcile(keep)
|
|
1108
|
+
/* 鲸鱼 / 侧栏开关本体藏起(入口改由浮窗注入行提供) */
|
|
1109
|
+
hideEl(whale)
|
|
1110
|
+
hideEl(toggle)
|
|
1111
|
+
var y = panelTop + MORE_PAD
|
|
1112
|
+
/* ① 新会话 ② 折叠侧栏(注入行) */
|
|
1113
|
+
box(rowNew, innerLeft, y, innerWidth, MORE_ROW_H); y += MORE_ROW_H + MORE_GAP
|
|
1114
|
+
box(rowSidebar, innerLeft, y, innerWidth, MORE_ROW_H); y += MORE_ROW_H + MORE_GAP
|
|
1115
|
+
/* ③ 应用/编辑菜单栏 host:height 保持 capH,编排器量 capH 不漂移 */
|
|
1116
|
+
if (mb) { place(mb, innerLeft, y, innerWidth, capH); y += capH + MORE_GAP }
|
|
1117
|
+
/* ④ 底部入口行(Maple 账户 + 手机/电脑):横排,overflow 放行弹出菜单 */
|
|
1118
|
+
var seatsTop = y
|
|
1119
|
+
var sx = innerLeft
|
|
1120
|
+
for (var i = 0; i < targets.length; i++) {
|
|
1121
|
+
var el = targets[i]
|
|
1122
|
+
ledger.adopt(el)
|
|
1123
|
+
el.setAttribute(MORE_SEATS_MARK, '')
|
|
1124
|
+
var s = el.style
|
|
1125
|
+
s.position = 'fixed'
|
|
1126
|
+
s.top = seatsTop + 'px'
|
|
1127
|
+
s.left = sx + 'px'
|
|
1128
|
+
s.height = MORE_SEATS_H + 'px'
|
|
1129
|
+
s.width = 'auto'
|
|
1130
|
+
s.maxWidth = 'none'
|
|
1131
|
+
s.margin = '0'
|
|
1132
|
+
s.padding = '0 2px'
|
|
1133
|
+
s.zIndex = '1090'
|
|
1134
|
+
s.background = 'transparent'
|
|
1135
|
+
s.border = '0'
|
|
1136
|
+
s.boxShadow = 'none'
|
|
1137
|
+
s.transform = 'none'
|
|
1138
|
+
s.overflow = 'visible'
|
|
1139
|
+
s.flex = 'none'
|
|
1140
|
+
s.webkitAppRegion = 'no-drag'
|
|
1141
|
+
var p = markSrc(el)
|
|
1142
|
+
if (p && parents.indexOf(p) === -1) parents.push(p)
|
|
1143
|
+
escapeContainment(el, sx, seatsTop)
|
|
1144
|
+
sx += el.getBoundingClientRect().width + MORE_GAP
|
|
1145
|
+
}
|
|
1146
|
+
/* 浮窗宽度跟随底部入口行自适应(上限 320),保证第④行不撑出框外 */
|
|
1147
|
+
var seatsInner = sx - MORE_GAP - innerLeft
|
|
1148
|
+
if (seatsInner > innerWidth) innerWidth = Math.min(seatsInner, 308)
|
|
1149
|
+
if (targets.length === 1) targets[0].style.width = innerWidth + 'px'
|
|
1150
|
+
var panelWidth = innerWidth + 2 * MORE_PAD
|
|
1151
|
+
y = seatsTop + MORE_SEATS_H + MORE_GAP
|
|
1152
|
+
/* ⑤ 面板列表:去自身表面(背板统一提供),保留滚动 */
|
|
1153
|
+
if (navEl) {
|
|
1154
|
+
place(navEl, innerLeft, y, innerWidth, null)
|
|
1155
|
+
y += navEl.offsetHeight
|
|
1156
|
+
}
|
|
1157
|
+
/* 背板尺寸贴合内容 */
|
|
1158
|
+
pnl.style.position = 'fixed'
|
|
1159
|
+
pnl.style.top = panelTop + 'px'
|
|
1160
|
+
pnl.style.left = panelLeft + 'px'
|
|
1161
|
+
pnl.style.width = panelWidth + 'px'
|
|
1162
|
+
pnl.style.height = (y - panelTop + MORE_PAD) + 'px'
|
|
1163
|
+
pnl.style.zIndex = '1088'
|
|
1164
|
+
pnl.style.webkitAppRegion = 'no-drag'
|
|
1165
|
+
escapeContainment(pnl, panelLeft, panelTop)
|
|
1166
|
+
return MORE_LEFT + btn.getBoundingClientRect().width + GAP
|
|
1167
|
+
},
|
|
1168
|
+
yield: function () {
|
|
1169
|
+
if (trigger) { trigger.remove(); trigger = null }
|
|
1170
|
+
if (panel) { panel.remove(); panel = null; rowNew = null; rowSidebar = null }
|
|
1171
|
+
open.clear()
|
|
1172
|
+
ledger.restoreAll()
|
|
1173
|
+
var seatsEls = document.querySelectorAll('[' + MORE_SEATS_MARK + ']')
|
|
1174
|
+
for (var i = 0; i < seatsEls.length; i++) seatsEls[i].removeAttribute(MORE_SEATS_MARK)
|
|
1175
|
+
releaseParents()
|
|
1176
|
+
},
|
|
1177
|
+
onClick: function (target) {
|
|
1178
|
+
if (!open.isOpen()) return
|
|
1179
|
+
if (target.closest('#' + MORE_TRIGGER_ID)) return /* 触发按钮自己 toggle */
|
|
1180
|
+
if (target.closest('[data-windows-menu]')) return /* 应用/编辑弹原生菜单,保持开 */
|
|
1181
|
+
if (target.closest('[' + MORE_ITEM_MARK + ']')) {
|
|
1182
|
+
/* 面板列表:选中行收起;「更多」菜单锚点保持开。账户/设备保持开。 */
|
|
1183
|
+
if (target.closest('nav[' + MORE_ITEM_MARK + ']')) {
|
|
1184
|
+
if (target.closest('[aria-haspopup="menu"]')) return
|
|
1185
|
+
open.set(false)
|
|
1186
|
+
}
|
|
1187
|
+
return
|
|
1188
|
+
}
|
|
1189
|
+
if (target.closest('[' + MORE_PANEL_MARK + ']')) return /* 注入行自行收起 */
|
|
1190
|
+
open.set(false)
|
|
1191
|
+
},
|
|
1192
|
+
onEsc: function () { if (open.isOpen()) open.set(false) },
|
|
1193
|
+
}
|
|
1194
|
+
})()
|
|
1195
|
+
|
|
1196
|
+
dropdownFeatures.push(others, workspaces, more)
|
|
1197
|
+
|
|
1198
|
+
/* ── 探针:本轮哪些区域归我们管 ───────────────────────────── */
|
|
1199
|
+
|
|
1200
|
+
function seatHosts() {
|
|
1201
|
+
var out = []
|
|
1202
|
+
for (var i = 0; i < SEATS.length; i++) {
|
|
1203
|
+
var host = document.querySelector('[data-slot="' + SEATS[i] + '"]')
|
|
1204
|
+
if (host) out.push(host)
|
|
1205
|
+
}
|
|
1206
|
+
return out
|
|
1207
|
+
}
|
|
1208
|
+
/** 面板列表本轮是否归我们管;null = 不搬(drawer / 已卸载)。 */
|
|
1209
|
+
function panelNav() {
|
|
1210
|
+
var el = document.querySelector(NAV_SEL)
|
|
1211
|
+
if (!el || !el.isConnected) return null
|
|
1212
|
+
/* drawer 是把侧栏当浮层:面板列表留在抽屉里照常使用 */
|
|
1213
|
+
if (drawer()) return null
|
|
1214
|
+
return el
|
|
1215
|
+
}
|
|
1216
|
+
/** 工作区区域本轮是否归我们管;null = 不搬。
|
|
1217
|
+
折叠态 WorkspaceBrowser 走 rail(列表内容卸载),drawer 留在抽屉里——都交还原生。 */
|
|
1218
|
+
function wsRoot() {
|
|
1219
|
+
var el = document.querySelector(WS_ROOT_SEL)
|
|
1220
|
+
if (!el || !el.isConnected) return null
|
|
1221
|
+
if (drawer() || collapsed()) return null
|
|
1222
|
+
return el
|
|
1223
|
+
}
|
|
1224
|
+
/** 最近公共祖先行 + 护栏;取不到合法行返回 null(调用方退化为逐席位)。 */
|
|
1225
|
+
function findRow(hosts) {
|
|
1226
|
+
if (hosts.length < 2) return null
|
|
1227
|
+
var node = hosts[0].parentElement
|
|
1228
|
+
while (node && node !== document.body) {
|
|
1229
|
+
var all = true
|
|
1230
|
+
for (var i = 0; i < hosts.length; i++) if (!node.contains(hosts[i])) { all = false; break }
|
|
1231
|
+
if (all) break
|
|
1232
|
+
node = node.parentElement
|
|
1233
|
+
}
|
|
1234
|
+
if (!node || node === document.body || node === document.documentElement) return null
|
|
1235
|
+
if (node.querySelector('textarea,[data-slot="conversation.composer.bar"],[data-slot="sidebar.panellist"],[data-slot="sidebar.workspaces"],[data-slot="sidebar.session.action"],[data-windows-menu]')) return null
|
|
1236
|
+
if (node.hasAttribute('data-shell-bottom')) return null
|
|
1237
|
+
var rect = node.getBoundingClientRect()
|
|
1238
|
+
if (rect.height === 0) return null /* 祖先 display:none:本轮不映射 */
|
|
1239
|
+
if (rect.height > ROW_MAX_HEIGHT) return null
|
|
1240
|
+
return node
|
|
1241
|
+
}
|
|
1242
|
+
|
|
1243
|
+
/* ── 编排器 ───────────────────────────────────────────────── */
|
|
1244
|
+
|
|
1245
|
+
/** 让位/卸载:各特性还原自己的账本与按钮,再清共享的父级收零/容器隔离。 */
|
|
1246
|
+
function yieldAll() {
|
|
1247
|
+
brand.yield()
|
|
1248
|
+
newSession.yield()
|
|
1249
|
+
seats.yield()
|
|
1250
|
+
others.yield()
|
|
1251
|
+
more.yield()
|
|
1252
|
+
extraSlot.yield()
|
|
1253
|
+
workspaces.yield()
|
|
1254
|
+
markedParents.forEach(function (p) { p.removeAttribute(SRC_MARK) })
|
|
1255
|
+
markedParents.clear()
|
|
1256
|
+
uncontained.forEach(function (value, el) { el.style.containerType = value })
|
|
1257
|
+
uncontained.clear()
|
|
1258
|
+
}
|
|
1259
|
+
function pass() {
|
|
1260
|
+
timer = 0
|
|
1261
|
+
if (!active()) { yieldAll(); lastMode = ''; return }
|
|
1262
|
+
var hosts = seatHosts()
|
|
1263
|
+
var navEl = panelNav()
|
|
1264
|
+
var wsEl = wsRoot()
|
|
1265
|
+
if (!hosts.length && !navEl && !wsEl) { yieldAll(); lastMode = ''; return }
|
|
1266
|
+
var row = findRow(hosts)
|
|
1267
|
+
var targets = row ? [row] : hosts
|
|
1268
|
+
var mode = row ? 'row' : 'seats'
|
|
1269
|
+
/* 展开态走「更多」收拢;折叠/drawer 交还原布局 */
|
|
1270
|
+
var moreMode = !drawer() && !collapsed()
|
|
1271
|
+
/* 祖先隐藏(drawer 收起等)时整轮不映射,避免悬空 fixed 空盒 */
|
|
1272
|
+
if (targets.length && targets[0].getBoundingClientRect().width === 0 && !seats.owns(targets[0]) && !more.owns(targets[0]) && !navEl && !wsEl) {
|
|
1273
|
+
yieldAll(); lastMode = ''; return
|
|
1274
|
+
}
|
|
1275
|
+
var mr = menubar().getBoundingClientRect()
|
|
1276
|
+
var capH = mr.height || 40
|
|
1277
|
+
var cursor
|
|
1278
|
+
if (moreMode) {
|
|
1279
|
+
/* 「更多」接管鲸鱼/底部入口行/面板列表/菜单栏;让位特性幂等还原 */
|
|
1280
|
+
brand.yield()
|
|
1281
|
+
seats.yield()
|
|
1282
|
+
others.yield()
|
|
1283
|
+
newSession.pass()
|
|
1284
|
+
cursor = more.pass(targets, navEl, capH)
|
|
1285
|
+
} else {
|
|
1286
|
+
more.yield()
|
|
1287
|
+
brand.pass()
|
|
1288
|
+
newSession.pass()
|
|
1289
|
+
cursor = mr.right + GAP
|
|
1290
|
+
cursor = seats.pass(targets, cursor, capH)
|
|
1291
|
+
/* 「其他」接在底部入口行右侧(第一行);预留栏位再接「其他」右侧;
|
|
1292
|
+
文件夹按钮独占第二行,从窗左起排 */
|
|
1293
|
+
cursor = others.pass(navEl, cursor, capH)
|
|
1294
|
+
}
|
|
1295
|
+
if (navEl) extraSlot.pass(cursor, capH)
|
|
1296
|
+
else extraSlot.yield()
|
|
1297
|
+
workspaces.pass(wsEl, WS_ROW_LEFT, capH)
|
|
1298
|
+
if (mode !== lastMode) {
|
|
1299
|
+
lastMode = mode
|
|
1300
|
+
console.info('[caption-map] 底部入口行已映射到标题栏(' + mode + ' 模式,' + targets.length + ' 个容器)')
|
|
1301
|
+
}
|
|
1302
|
+
}
|
|
1303
|
+
function schedule() {
|
|
1304
|
+
if (timer) return
|
|
1305
|
+
timer = setTimeout(pass, 120)
|
|
1306
|
+
}
|
|
1307
|
+
|
|
1308
|
+
/* 点空白处 / Esc 收起下拉;点行本身让 React 先跑完选择再收。
|
|
1309
|
+
冒泡阶段:先让 React 的 selectPanel/菜单跑完,再收起,避免点在悬空节点上。 */
|
|
1310
|
+
function onClick(event) {
|
|
1311
|
+
var target = event.target
|
|
1312
|
+
if (!(target instanceof Element)) {
|
|
1313
|
+
for (var i = 0; i < dropdowns.length; i++) dropdowns[i].set(false)
|
|
1314
|
+
return
|
|
1315
|
+
}
|
|
1316
|
+
for (var j = 0; j < dropdownFeatures.length; j++) dropdownFeatures[j].onClick(target)
|
|
1317
|
+
}
|
|
1318
|
+
function onKeydown(event) {
|
|
1319
|
+
if (event.key !== 'Escape') return
|
|
1320
|
+
for (var i = 0; i < dropdownFeatures.length; i++) dropdownFeatures[i].onEsc(event.target)
|
|
1321
|
+
}
|
|
1322
|
+
document.addEventListener('click', onClick)
|
|
1323
|
+
document.addEventListener('keydown', onKeydown, true)
|
|
1324
|
+
|
|
1325
|
+
var mo = new MutationObserver(schedule)
|
|
1326
|
+
/* 不观察 style:自己的内联写入会触发死循环;class 变化覆盖侧栏折叠/路由 */
|
|
1327
|
+
mo.observe(document.body, {
|
|
1328
|
+
childList: true, subtree: true, characterData: true,
|
|
1329
|
+
attributes: true, attributeFilter: ['class', 'data-slot', 'data-windows-titlebar', 'data-sidebar-drawer', 'data-sidebar-collapsed'],
|
|
1330
|
+
})
|
|
1331
|
+
var ro = typeof ResizeObserver === 'function' ? new ResizeObserver(schedule) : null
|
|
1332
|
+
var mb = menubar()
|
|
1333
|
+
if (ro && mb) ro.observe(mb)
|
|
1334
|
+
window.addEventListener('resize', schedule)
|
|
1335
|
+
pass()
|
|
1336
|
+
|
|
1337
|
+
return function () {
|
|
1338
|
+
if (timer) clearTimeout(timer)
|
|
1339
|
+
mo.disconnect()
|
|
1340
|
+
if (ro) ro.disconnect()
|
|
1341
|
+
window.removeEventListener('resize', schedule)
|
|
1342
|
+
document.removeEventListener('click', onClick)
|
|
1343
|
+
document.removeEventListener('keydown', onKeydown, true)
|
|
1344
|
+
yieldAll()
|
|
1345
|
+
tag.remove()
|
|
1346
|
+
}
|
|
1347
|
+
}, 'caption-map: region map')
|
|
1348
|
+
|
|
1349
|
+
/* 侧栏宽度固定:config.fixedSidebarWidth(默认开)。宽度锁到外壳拖拽
|
|
1350
|
+
* 上限(dsh-client-ui-layout columns.ts SIDEBAR_MAX = 420),拖拽手柄藏掉。
|
|
1351
|
+
*
|
|
1352
|
+
* 做法不跟 React 抢内联样式:frame 的 gridTemplateColumns /
|
|
1353
|
+
* --dsh-windows-sidebar-width 由外壳每次渲染重写,直接改写会在折叠/
|
|
1354
|
+
* 卸载时留下脏值。这里只用 CSS !important 覆盖首轨与变量,其余两轨
|
|
1355
|
+
* (center/rightbar,随右栏开合动态变化)由 observer 从外壳内联值里
|
|
1356
|
+
* 镜像成 frame 上的两枚 CSS 变量供 !important 规则引用——外壳从不写
|
|
1357
|
+
* 这两枚变量,无死循环、无还原冲突。卸载 = 摘属性/变量/样式表,外壳
|
|
1358
|
+
* 内联值立即重新生效。
|
|
1359
|
+
*
|
|
1360
|
+
* 门控:折叠(rail/全隐)、drawer(浮层)、折叠屏横屏居中侧栏都不插手,
|
|
1361
|
+
* 交还原外壳布局。 */
|
|
1362
|
+
ctx.effect(function () {
|
|
1363
|
+
if (IS_DARWIN) return function () {} /* darwin 固定侧栏由 caption-map-macos 接管 */
|
|
1364
|
+
var opts = window.__DSH_CAPTION_MAP__ || {}
|
|
1365
|
+
if (opts.fixedSidebarWidth === false) return function () {}
|
|
1366
|
+
|
|
1367
|
+
var FIXED_ATTR = 'data-capyclaw-fixed-sidebar'
|
|
1368
|
+
/** 外壳 columns.ts SIDEBAR_MAX:拖拽能拉到的最宽值。 */
|
|
1369
|
+
var FIXED_WIDTH = 420
|
|
1370
|
+
var VAR_CENTER = '--capyclaw-cm-center'
|
|
1371
|
+
var VAR_RIGHT = '--capyclaw-cm-right'
|
|
1372
|
+
var FIXED_CSS = [
|
|
1373
|
+
/* 首轨锁死 420;其余两轨引用镜像变量(缺省兜底右栏关闭形态)。 */
|
|
1374
|
+
'html[' + FIXED_ATTR + '] div:has(> [data-shell-bottom]){',
|
|
1375
|
+
'grid-template-columns:' + FIXED_WIDTH + 'px var(' + VAR_CENTER + ',minmax(0px,1fr)) var(' + VAR_RIGHT + ',minmax(0px,0px))!important;',
|
|
1376
|
+
'--dsh-windows-sidebar-width:' + FIXED_WIDTH + 'px!important}',
|
|
1377
|
+
/* 侧栏根节点内联 width 是外壳存的偏好值:撑满被锁定的列宽。
|
|
1378
|
+
新版外壳在列与根之间包了一层 display:contents 的插槽 host
|
|
1379
|
+
(div[data-slot="sidebar"]),`> *` 会打在无盒子的 host 上失效,
|
|
1380
|
+
故两条选择器并存:旧壳直接子级、新壳经 host 取 occupant。 */
|
|
1381
|
+
'html[' + FIXED_ATTR + '] div:has(> [data-shell-bottom]) > div[class*="sidebarCol"] > *,',
|
|
1382
|
+
'html[' + FIXED_ATTR + '] div:has(> [data-shell-bottom]) > div[class*="sidebarCol"] [data-slot="sidebar"] > *{width:100%!important}',
|
|
1383
|
+
/* 拖拽手柄:宽度固定后不再提供调整入口。 */
|
|
1384
|
+
'html[' + FIXED_ATTR + '] div:has(> [data-shell-bottom]) > div[data-side="sidebar"]{display:none!important}',
|
|
1385
|
+
].join('')
|
|
1386
|
+
|
|
1387
|
+
var tag = styleTag(FIXED_CSS)
|
|
1388
|
+
|
|
1389
|
+
var frame = null
|
|
1390
|
+
var moFrame = null
|
|
1391
|
+
var folded = typeof window.matchMedia === 'function'
|
|
1392
|
+
? window.matchMedia('(device-posture: folded) and (orientation: landscape)')
|
|
1393
|
+
: null
|
|
1394
|
+
|
|
1395
|
+
/** 按顶层空格切 grid 轨道(minmax(...) 内部的空格不切)。 */
|
|
1396
|
+
function splitTracks(value) {
|
|
1397
|
+
var out = []
|
|
1398
|
+
var depth = 0
|
|
1399
|
+
var cur = ''
|
|
1400
|
+
for (var i = 0; i < value.length; i++) {
|
|
1401
|
+
var ch = value.charAt(i)
|
|
1402
|
+
if (ch === '(') depth++
|
|
1403
|
+
else if (ch === ')') depth--
|
|
1404
|
+
if (ch === ' ' && depth === 0) {
|
|
1405
|
+
if (cur) { out.push(cur); cur = '' }
|
|
1406
|
+
continue
|
|
1407
|
+
}
|
|
1408
|
+
cur += ch
|
|
1409
|
+
}
|
|
1410
|
+
if (cur) out.push(cur)
|
|
1411
|
+
return out
|
|
1412
|
+
}
|
|
1413
|
+
function setVar(el, name, value) {
|
|
1414
|
+
/* 等值守卫:自己的写入触发 observer 时一拍收敛,不死循环。 */
|
|
1415
|
+
if (el.style.getPropertyValue(name) !== value) el.style.setProperty(name, value)
|
|
1416
|
+
}
|
|
1417
|
+
function clearVars(el) {
|
|
1418
|
+
el.style.removeProperty(VAR_CENTER)
|
|
1419
|
+
el.style.removeProperty(VAR_RIGHT)
|
|
1420
|
+
}
|
|
1421
|
+
/** 本轮是否归我们管;null = 折叠/drawer/居中侧栏/ frame 不在场。 */
|
|
1422
|
+
function target() {
|
|
1423
|
+
var bottom = document.querySelector('[data-shell-bottom]')
|
|
1424
|
+
var f = bottom && bottom.parentElement
|
|
1425
|
+
if (!f || !f.isConnected) return null
|
|
1426
|
+
if (f.hasAttribute('data-sidebar-collapsed')) return null
|
|
1427
|
+
if (f.hasAttribute('data-sidebar-drawer')) return null
|
|
1428
|
+
if (folded && folded.matches && f.getBoundingClientRect().width >= 768) return null
|
|
1429
|
+
return f
|
|
1430
|
+
}
|
|
1431
|
+
function watch(f) {
|
|
1432
|
+
if (moFrame) { moFrame.disconnect(); moFrame = null }
|
|
1433
|
+
if (!f) return
|
|
1434
|
+
/* 盯外壳自己的写入:gtc 重写(store 变化)与折叠/drawer 属性。 */
|
|
1435
|
+
moFrame = new MutationObserver(pass)
|
|
1436
|
+
moFrame.observe(f, { attributes: true, attributeFilter: ['style', 'data-sidebar-collapsed', 'data-sidebar-drawer'] })
|
|
1437
|
+
}
|
|
1438
|
+
function pass() {
|
|
1439
|
+
var f = target()
|
|
1440
|
+
if (f && f !== frame) {
|
|
1441
|
+
if (frame) clearVars(frame)
|
|
1442
|
+
frame = f
|
|
1443
|
+
watch(f)
|
|
1444
|
+
}
|
|
1445
|
+
if (!f) {
|
|
1446
|
+
/* 让位:摘开关、清变量。frame 的 observer 留着——再展开时它先知道。 */
|
|
1447
|
+
document.documentElement.removeAttribute(FIXED_ATTR)
|
|
1448
|
+
if (frame) clearVars(frame)
|
|
1449
|
+
return
|
|
1450
|
+
}
|
|
1451
|
+
var tracks = splitTracks(f.style.gridTemplateColumns || '')
|
|
1452
|
+
if (tracks.length >= 3) {
|
|
1453
|
+
setVar(f, VAR_CENTER, tracks[1])
|
|
1454
|
+
setVar(f, VAR_RIGHT, tracks[2])
|
|
1455
|
+
}
|
|
1456
|
+
document.documentElement.setAttribute(FIXED_ATTR, '')
|
|
1457
|
+
}
|
|
1458
|
+
|
|
1459
|
+
/* frame 挂载/重建(childList);observer 回调同步跑完,先于绘制不闪。 */
|
|
1460
|
+
var moBody = new MutationObserver(pass)
|
|
1461
|
+
moBody.observe(document.body, { childList: true, subtree: true })
|
|
1462
|
+
if (folded) {
|
|
1463
|
+
if (typeof folded.addEventListener === 'function') folded.addEventListener('change', pass)
|
|
1464
|
+
else if (typeof folded.addListener === 'function') folded.addListener(pass)
|
|
1465
|
+
}
|
|
1466
|
+
window.addEventListener('resize', pass)
|
|
1467
|
+
pass()
|
|
1468
|
+
|
|
1469
|
+
return function () {
|
|
1470
|
+
moBody.disconnect()
|
|
1471
|
+
if (moFrame) moFrame.disconnect()
|
|
1472
|
+
if (folded) {
|
|
1473
|
+
if (typeof folded.removeEventListener === 'function') folded.removeEventListener('change', pass)
|
|
1474
|
+
else if (typeof folded.removeListener === 'function') folded.removeListener(pass)
|
|
1475
|
+
}
|
|
1476
|
+
window.removeEventListener('resize', pass)
|
|
1477
|
+
document.documentElement.removeAttribute(FIXED_ATTR)
|
|
1478
|
+
if (frame) clearVars(frame)
|
|
1479
|
+
frame = null
|
|
1480
|
+
tag.remove()
|
|
1481
|
+
}
|
|
1482
|
+
}, 'caption-map: fixed sidebar')
|
|
1483
|
+
|
|
1484
|
+
/* 聊天窗停靠:包内分块按需加载,与标题栏映射互不依赖(跨平台常驻)。
|
|
1485
|
+
* 独立一条 effect 管它的生命周期:分块还没到就卸载时,回来也不能再装。 */
|
|
1486
|
+
ctx.effect(function () {
|
|
1487
|
+
if (IS_DARWIN) return function () {} /* darwin 聊天停靠由 caption-map-macos 接管 */
|
|
1488
|
+
var dead = false
|
|
1489
|
+
var dock = null
|
|
1490
|
+
if (typeof require === 'function' && typeof require.async === 'function') {
|
|
1491
|
+
require.async('./client.chat.js').then(function (part) {
|
|
1492
|
+
if (dead || !part || typeof part.install !== 'function') return
|
|
1493
|
+
dock = part.install(ctx)
|
|
1494
|
+
}, function (error) {
|
|
1495
|
+
console.warn('[caption-map] 聊天窗停靠加载失败:', error && error.message)
|
|
1496
|
+
})
|
|
1497
|
+
}
|
|
1498
|
+
return function () {
|
|
1499
|
+
dead = true
|
|
1500
|
+
if (typeof dock === 'function') {
|
|
1501
|
+
try { dock() } catch (error) { /* 单个收尾出错不影响别的 */ }
|
|
1502
|
+
}
|
|
1503
|
+
dock = null
|
|
1504
|
+
}
|
|
1505
|
+
}, 'caption-map: chat dock')
|
|
1506
|
+
},
|
|
1507
|
+
}
|
|
1508
|
+
},
|
|
1509
|
+
})
|