dsh-session-superagent 0.9.266 → 0.9.268
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/CHANGELOG.md +75 -0
- package/README.md +6 -4
- package/client.js +430 -52
- package/lib/index.js +1 -1
- package/package.json +4 -2
- package/ui-host-primitives.js +11 -0
- package/ui-orbit-popover.js +202 -0
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,81 @@
|
|
|
2
2
|
|
|
3
3
|
格式参照 [Keep a Changelog](https://keepachangelog.com/zh-CN/1.1.0/),版本号遵循 [语义化版本](https://semver.org/lang/zh-CN/)。
|
|
4
4
|
|
|
5
|
+
## [0.9.268] - 2026-11-05 —— InfoTip 与卫星环接入 DSH 原生浮层
|
|
6
|
+
|
|
7
|
+
### InfoTip → DSH Tooltip
|
|
8
|
+
|
|
9
|
+
- 保留 `{text,icon,warn}` 与原 trigger;使用 `top / portal / openOnClick / gap=8`;
|
|
10
|
+
- capture scroll → remount key 清掉 pinned,effect 对称清理;
|
|
11
|
+
- DSH 的 `aria-describedby` 映射为 `aria-expanded`;不添加受控 open 假 API;
|
|
12
|
+
- 仅缺 Tooltip 时只回退 InfoTip,不连带降级 Modal/Toast。
|
|
13
|
+
|
|
14
|
+
### StatusOrbit → OrbitPopover
|
|
15
|
+
|
|
16
|
+
新增 `ui-orbit-popover.js` 与 UMD 同源适配:
|
|
17
|
+
|
|
18
|
+
- `useAnchoredPosition + useDismissOnOutsidePointer + MenuSurface`;
|
|
19
|
+
- `top / end / gap=8 / margin=8`,不传 center,不宣称自动 flip;
|
|
20
|
+
- 主 surface 通过宿主 `react-dom.createPortal` 到 body,`role=dialog`;
|
|
21
|
+
- 空态 252 / 常规 368、watcher rows、轮询和动作全部保留;
|
|
22
|
+
- DSH 路径不再使用手算 left/bottom 或极大 z-index;缺原语时完整保留旧实现。
|
|
23
|
+
|
|
24
|
+
删除确认改为「先关 orbit → 独立 ConfirmDialog → 取消/完成后回焦圆环」,
|
|
25
|
+
不再让浮层层级压住确认框,也不把焦点还给已卸载的删除按钮。
|
|
26
|
+
|
|
27
|
+
### 证据
|
|
28
|
+
|
|
29
|
+
```
|
|
30
|
+
Tooltip 定向 5/5;Orbit 适配 10/10;Orbit 集成 7/7;主线锚点 2/2
|
|
31
|
+
npm test → 524/524
|
|
32
|
+
scripts/ui-audit.mjs → 11/11,100 分
|
|
33
|
+
对比度 → 浅色 16 组 ≤ 基线 16;深色 13 组 ≤ 基线 13
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
真实 WebView 的 portal、键鼠、焦点、读屏与叠层仍列入走查,不宣称已验。
|
|
37
|
+
|
|
38
|
+
## [0.9.267] - 2026-11-05 —— 修掉行内编辑透明遮挡,主面板接入 DSH Modal/Toast
|
|
39
|
+
|
|
40
|
+
### 修复「展开后只能看,不能改」
|
|
41
|
+
|
|
42
|
+
根因不是 `disabled`:官方 `.dt-open::after` 是整行透明点击层,展开表单被它盖住,
|
|
43
|
+
点击 input 实际命中标题按钮并触发收起。
|
|
44
|
+
|
|
45
|
+
Chromium 实测:
|
|
46
|
+
|
|
47
|
+
```text
|
|
48
|
+
修复前 elementFromPoint → button.dt-open
|
|
49
|
+
修复后 elementFromPoint → input[type=number]
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
修复:`.dt-ticket-body .dt-form { position:relative; z-index:1; }`;
|
|
53
|
+
WatcherForm 外壳改为官方 DraftEditor 的 `form.dt-card + Fields + SaveBar`。
|
|
54
|
+
预览新增「行内编辑 / 行内编辑(已修改)」两个永久场景,并加点击层回归测试。
|
|
55
|
+
|
|
56
|
+
### 主面板接入 DSH 原语
|
|
57
|
+
|
|
58
|
+
- `factory(require)` 可选探测 `@deepseek-ai/dsh-client-ui-primitives`;
|
|
59
|
+
- 主面板 ConfirmButton 内部使用 DSH Modal,保留 busy、成功才关闭和错误反馈;
|
|
60
|
+
- orbit 的确认框暂保留 superagent 同源实现,直到 orbit 与 Modal 的焦点/层级策略验收;
|
|
61
|
+
- Toast 使用 keyed DSH Toast + `holdMs=3000` + `onDone(id)` id guard;
|
|
62
|
+
- 老宿主缺少原语时完整回退到原有 Modal/Toast,不影响加载。
|
|
63
|
+
|
|
64
|
+
### UI 硬约束与适配层
|
|
65
|
+
|
|
66
|
+
`AGENTS.md` 新增「原生 DSH 优先,最小自制」硬约束:先查官方结构树和素材,
|
|
67
|
+
能直接复用就直接复用,必须适配时只包一层,官方无同物才允许最小 derived 并登记证据。
|
|
68
|
+
独立 Tooltip 适配增加 capture scroll → remount key 的 scroll-close 和 effect 对称清理。
|
|
69
|
+
|
|
70
|
+
### 证据
|
|
71
|
+
|
|
72
|
+
```
|
|
73
|
+
npm test → 500/500
|
|
74
|
+
scripts/ui-audit.mjs → 11/11,100 分
|
|
75
|
+
对比度 → 浅色 16 组 ≤ 基线 16;深色 13 组 ≤ 基线 13
|
|
76
|
+
```
|
|
77
|
+
|
|
78
|
+
真实 WebView 的连续打字、IME 与保存后刷新仍列入走查,不用测试桩冒充真机验收。
|
|
79
|
+
|
|
5
80
|
## [0.9.266] - 2026-11-05 —— 新增/编辑共用 WatcherForm,宿主原语适配层就位
|
|
6
81
|
|
|
7
82
|
### 共用表单,不再两套字段
|
package/README.md
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
<img src="assets/icon-180.png" width="88" height="88" alt="">
|
|
4
4
|
|
|
5
5
|
[](LICENSE)
|
|
6
|
-
[](https://github.com/MYCF711/dsh-session-superagent/releases)
|
|
7
7
|
[](https://www.npmjs.com/package/dsh-session-superagent)
|
|
8
8
|
[](https://github.com/topics/dsh-plugin)
|
|
9
9
|
[](https://github.com/awesome-dsh-plugin/awesome-dsh-plugin)
|
|
@@ -46,11 +46,13 @@ GitHub 有新动态 → watcher 轮询 → Agent.followup(消息) → 会话跑
|
|
|
46
46
|
| 位置 | 是什么 |
|
|
47
47
|
|---|---|
|
|
48
48
|
| 输入框下面那一行的**最左端**(`轮/步 · token · 上下文环` 同一行) | **总卫星环**:一个环代表这台机器,环上每一颗卫星 = 一个在运行的会话级 superagent。绿=主理中,琥珀=已暂停,红=上次轮询失败;一圈转起来说明至少还有一个在盯。**点一下**展开详情:仓库 / 会话标题 / 间隔 / 上次轮询 / 上次唤醒 / 状态 / 错误原文。 |
|
|
49
|
-
| 中间栏「主理鱼」标签页 |
|
|
49
|
+
| 中间栏「主理鱼」标签页 | **DSH 原生结构树、素材与设计语言**(superagent 同源控件作为适配):总览 / 判定 / 触发 / 设置;Modal、Toast 等优先使用宿主 primitives,官方确无同物才最小 derived |
|
|
50
50
|
| 会话头部 | 不再挂徽章(0.3.2 起移到上面那行) |
|
|
51
51
|
|
|
52
52
|
没有主理鱼时这里画一个**灰色空环**(不转、无卫星),点开提示怎么添加 —— 不占位但也不消失,免得看着像功能坏了。
|
|
53
53
|
|
|
54
|
+
UI 开发先读 `AGENTS.md` 的「原生 DSH 优先,最小自制」;`dsh-session-superagent/host-primitives` 与 `dsh-session-superagent/orbit-popover` 导出经测试的薄适配,不实现第二套弹层。
|
|
55
|
+
|
|
54
56
|
## 环境要求
|
|
55
57
|
|
|
56
58
|
- DSH ≥ 0.2.1-rc.5(`engines.dsh`)
|
|
@@ -146,7 +148,7 @@ Gitee 私有仓库要在「设置 → 凭证」填私人令牌;公开仓库不
|
|
|
146
148
|
## 开发
|
|
147
149
|
|
|
148
150
|
```sh
|
|
149
|
-
npm test #
|
|
151
|
+
npm test # 524 项单测(带离线开关;裸 node --test 会真去 spawn gh,两分半)
|
|
150
152
|
```
|
|
151
153
|
|
|
152
154
|
### 工具输出:文本给人和 agent,JSON 给程序
|
|
@@ -206,7 +208,7 @@ dsh plugin --profile <profile> add dsh-session-superagent@latest
|
|
|
206
208
|
|
|
207
209
|
|
|
208
210
|
```bash
|
|
209
|
-
npm test #
|
|
211
|
+
npm test # 524 项单测(带离线开关,约 1.6 秒)
|
|
210
212
|
node scripts/ui-audit.mjs # 11 项 UI 指标(写死颜色 / 自造 token / 官方结构采用 …)
|
|
211
213
|
node scripts/preflight.mjs # 41 项门禁(含上面两条,外加 profile 一致性、路由面、包内容)
|
|
212
214
|
node scripts/render-preview.mjs preview.html # 双主题静态预览,直接浏览器打开
|
package/client.js
CHANGED
|
@@ -13,8 +13,317 @@ window.__ModuleLoader__.load({
|
|
|
13
13
|
const h = React.createElement
|
|
14
14
|
const { useCallback, useEffect, useRef, useState } = React
|
|
15
15
|
|
|
16
|
+
// client.js 是 UMD:宿主原语只能走 factory 注入的 require,不能 import 相对 ESM 适配模块。
|
|
17
|
+
// 这里的参数与 ui-host-primitives.js 的 createHostUi 保持一致,仅接入本面板需要的 Modal/Toast/Tooltip。
|
|
18
|
+
function dismissToast(current, id) {
|
|
19
|
+
return current && current.id === id ? null : current
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
function createHostUi({ React: HostReact, primitives } = {}) {
|
|
23
|
+
if (!HostReact || typeof HostReact.createElement !== 'function' || typeof HostReact.isValidElement !== 'function') {
|
|
24
|
+
throw new TypeError('createHostUi 需要宿主 React.createElement 与 React.isValidElement')
|
|
25
|
+
}
|
|
26
|
+
if (!primitives || (typeof primitives !== 'object' && typeof primitives !== 'function')) {
|
|
27
|
+
throw new TypeError('createHostUi 需要 DSH primitives')
|
|
28
|
+
}
|
|
29
|
+
const hostH = HostReact.createElement
|
|
30
|
+
const primitive = (name) => {
|
|
31
|
+
const value = primitives[name]
|
|
32
|
+
if (!value) throw new Error('DSH primitives.' + name + ' 不可用')
|
|
33
|
+
return value
|
|
34
|
+
}
|
|
35
|
+
const HostModal = ({ open, title, description, footer, onClose, className, children } = {}) => {
|
|
36
|
+
if (!open) return null
|
|
37
|
+
return hostH(primitive('Modal'), {
|
|
38
|
+
open, title, description, footer, onClose, className, closeLabel: '关闭',
|
|
39
|
+
}, children)
|
|
40
|
+
}
|
|
41
|
+
const HostToast = ({ item, onDone } = {}) => {
|
|
42
|
+
if (item === null || item === undefined) return null
|
|
43
|
+
return hostH(primitive('Toast'), {
|
|
44
|
+
key: item.id,
|
|
45
|
+
text: item.text,
|
|
46
|
+
tone: item.tone,
|
|
47
|
+
holdMs: 3000,
|
|
48
|
+
// success 使用宿主内建勾;error 必须显式使用官方 warning icon。
|
|
49
|
+
icon: item.tone === 'error' ? hostH(primitive('IconWarningOutlineMedium')) : undefined,
|
|
50
|
+
// 宿主 onDone 不带参数;由 dismiss 按 id 防止旧回调清除新通知。
|
|
51
|
+
onDone: () => onDone(item.id),
|
|
52
|
+
})
|
|
53
|
+
}
|
|
54
|
+
// DSH 只给 trigger 合并 aria-describedby,不维护 aria-expanded。
|
|
55
|
+
// forwardRef 把宿主 ref/事件原样落到原 button;expanded 仅映射 DSH 已管理的 describedby,不另管 open。
|
|
56
|
+
const TooltipTrigger = primitives.Tooltip && typeof HostReact.forwardRef === 'function'
|
|
57
|
+
? HostReact.forwardRef(function InfoTipTrigger({ text, icon = 'question', warn, 'aria-describedby': describedBy, ...triggerProps }, ref) {
|
|
58
|
+
const triggerIcon = HostReact.isValidElement(icon) ? icon : hostH(Icon, { name: icon, size: 14 })
|
|
59
|
+
return hostH('button', {
|
|
60
|
+
...triggerProps,
|
|
61
|
+
ref,
|
|
62
|
+
type: 'button',
|
|
63
|
+
className: cx('dt-info', warn && 'dt-info-warn'),
|
|
64
|
+
'aria-label': text,
|
|
65
|
+
'aria-describedby': describedBy,
|
|
66
|
+
'aria-expanded': Boolean(describedBy),
|
|
67
|
+
}, triggerIcon)
|
|
68
|
+
})
|
|
69
|
+
: null
|
|
70
|
+
const HostTooltip = ({ text, icon = 'question', warn = false } = {}) => {
|
|
71
|
+
const TooltipPrimitive = primitive('Tooltip')
|
|
72
|
+
if (!TooltipTrigger) throw new Error('DSH Tooltip 需要宿主 React.forwardRef')
|
|
73
|
+
const [remountKey, setRemountKey] = HostReact.useState(0)
|
|
74
|
+
HostReact.useEffect(() => {
|
|
75
|
+
if (typeof window === 'undefined') return undefined
|
|
76
|
+
const closeOnScroll = () => setRemountKey((current) => current + 1)
|
|
77
|
+
// Tooltip 没有受控 open API;capture 覆盖主面板及任意嵌套滚动容器。
|
|
78
|
+
window.addEventListener('scroll', closeOnScroll, true)
|
|
79
|
+
return () => window.removeEventListener('scroll', closeOnScroll, true)
|
|
80
|
+
}, [])
|
|
81
|
+
return hostH(TooltipPrimitive, {
|
|
82
|
+
key: remountKey,
|
|
83
|
+
label: text,
|
|
84
|
+
side: 'top',
|
|
85
|
+
portal: true,
|
|
86
|
+
openOnClick: true,
|
|
87
|
+
gap: 8,
|
|
88
|
+
}, hostH(TooltipTrigger, { text, icon, warn }))
|
|
89
|
+
}
|
|
90
|
+
const createToastState = () => {
|
|
91
|
+
const [item, setItem] = HostReact.useState(null)
|
|
92
|
+
const sequence = HostReact.useRef(0)
|
|
93
|
+
const notify = HostReact.useCallback((text, tone = 'info') => {
|
|
94
|
+
sequence.current += 1
|
|
95
|
+
const id = sequence.current
|
|
96
|
+
setItem({ id, text, tone })
|
|
97
|
+
return id
|
|
98
|
+
}, [])
|
|
99
|
+
const dismiss = HostReact.useCallback((id) => {
|
|
100
|
+
setItem((current) => dismissToast(current, id))
|
|
101
|
+
}, [])
|
|
102
|
+
return { item, notify, dismiss }
|
|
103
|
+
}
|
|
104
|
+
return { Modal: HostModal, Toast: HostToast, Tooltip: HostTooltip, createToastState }
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
// 以下来源:ui-orbit-popover.js(L84e)的同一薄适配,因 client.js 是 UMD 而在 factory 内镜像。
|
|
108
|
+
// createOrbitPopover({React, primitives}) 的参数、OrbitPopover/useOrbitConfirm 调用面与来源模块一致;
|
|
109
|
+
// React.createPortal 由调用方用宿主 require('react-dom').createPortal 注入,不伪造 primitives.createPortal。
|
|
110
|
+
const DEFAULT_ORBIT_Z_INDEX = 1100
|
|
111
|
+
|
|
112
|
+
function focusIfConnected(node) {
|
|
113
|
+
if (!node || typeof node.focus !== 'function') return false
|
|
114
|
+
if ('isConnected' in node && !node.isConnected) return false
|
|
115
|
+
try {
|
|
116
|
+
node.focus()
|
|
117
|
+
return true
|
|
118
|
+
} catch {
|
|
119
|
+
return false
|
|
120
|
+
}
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
function closeReason(detail) {
|
|
124
|
+
if (detail === false) return { reason: 'outside-pointer' }
|
|
125
|
+
if (typeof detail === 'string') return { reason: detail }
|
|
126
|
+
if (detail && typeof detail === 'object' && typeof detail.reason === 'string') return detail
|
|
127
|
+
return { reason: 'dismiss' }
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
// 单独抽出确认 hook 只为让 StatusOrbit 在 fallback 也无条件执行同样数量的 hooks;
|
|
131
|
+
// 弹层创建仍严格要求完整 DSH 能力,缺少能力不会创建替代 Popover。
|
|
132
|
+
function createOrbitConfirm({ React: HostReact }) {
|
|
133
|
+
return function useOrbitConfirm({ orbitRef, onCloseOrbit, onRequestConfirm } = {}) {
|
|
134
|
+
const orbitRefRef = HostReact.useRef(orbitRef)
|
|
135
|
+
const onCloseOrbitRef = HostReact.useRef(onCloseOrbit)
|
|
136
|
+
const onRequestConfirmRef = HostReact.useRef(onRequestConfirm)
|
|
137
|
+
const restoreFocusRef = HostReact.useRef(null)
|
|
138
|
+
orbitRefRef.current = orbitRef
|
|
139
|
+
onCloseOrbitRef.current = onCloseOrbit
|
|
140
|
+
onRequestConfirmRef.current = onRequestConfirm
|
|
141
|
+
|
|
142
|
+
const requestConfirm = HostReact.useCallback((detail = {}) => {
|
|
143
|
+
restoreFocusRef.current = 'orbit'
|
|
144
|
+
if (typeof onCloseOrbitRef.current === 'function') {
|
|
145
|
+
onCloseOrbitRef.current({ reason: 'confirm' })
|
|
146
|
+
}
|
|
147
|
+
const request = onRequestConfirmRef.current
|
|
148
|
+
if (typeof request === 'function') {
|
|
149
|
+
const extra = detail && typeof detail === 'object' ? detail : { value: detail }
|
|
150
|
+
return request({ ...extra, reason: 'confirm', restoreFocus: 'orbit' })
|
|
151
|
+
}
|
|
152
|
+
return undefined
|
|
153
|
+
}, [])
|
|
154
|
+
|
|
155
|
+
const onConfirmClose = HostReact.useCallback(() => {
|
|
156
|
+
if (restoreFocusRef.current !== 'orbit') return false
|
|
157
|
+
restoreFocusRef.current = null
|
|
158
|
+
const ref = orbitRefRef.current
|
|
159
|
+
return focusIfConnected(ref && ref.current)
|
|
160
|
+
}, [])
|
|
161
|
+
|
|
162
|
+
return {
|
|
163
|
+
onRequestConfirm: requestConfirm,
|
|
164
|
+
onConfirmClose,
|
|
165
|
+
restoreFocus: restoreFocusRef.current,
|
|
166
|
+
}
|
|
167
|
+
}
|
|
168
|
+
}
|
|
169
|
+
|
|
170
|
+
const useOrbitConfirm = createOrbitConfirm({ React })
|
|
171
|
+
|
|
172
|
+
function createOrbitPopover({ React: HostReact, primitives } = {}) {
|
|
173
|
+
if (!HostReact || typeof HostReact.createElement !== 'function') {
|
|
174
|
+
throw new TypeError('createOrbitPopover 需要宿主 React.createElement')
|
|
175
|
+
}
|
|
176
|
+
for (const hook of ['useRef', 'useCallback', 'useEffect']) {
|
|
177
|
+
if (typeof HostReact[hook] !== 'function') {
|
|
178
|
+
throw new TypeError(`createOrbitPopover 需要宿主 React.${hook}`)
|
|
179
|
+
}
|
|
180
|
+
}
|
|
181
|
+
if (typeof HostReact.createPortal !== 'function') {
|
|
182
|
+
throw new TypeError('createOrbitPopover 需要宿主 React.createPortal(从 react-dom 注入)')
|
|
183
|
+
}
|
|
184
|
+
if (!primitives || (typeof primitives !== 'object' && typeof primitives !== 'function')) {
|
|
185
|
+
throw new TypeError('createOrbitPopover 需要 DSH primitives')
|
|
186
|
+
}
|
|
187
|
+
|
|
188
|
+
const primitive = (name, kind) => {
|
|
189
|
+
const value = primitives[name]
|
|
190
|
+
if (kind === 'function' ? typeof value !== 'function' : !value) {
|
|
191
|
+
throw new Error(`DSH primitives.${name} 不可用;OrbitPopover 不会创建替代弹层`)
|
|
192
|
+
}
|
|
193
|
+
return value
|
|
194
|
+
}
|
|
195
|
+
const useAnchoredPosition = primitive('useAnchoredPosition', 'function')
|
|
196
|
+
const useDismissOnOutsidePointer = primitive('useDismissOnOutsidePointer', 'function')
|
|
197
|
+
const MenuSurface = primitive('MenuSurface')
|
|
198
|
+
const hostH = HostReact.createElement
|
|
199
|
+
const createPortal = HostReact.createPortal
|
|
200
|
+
|
|
201
|
+
function OrbitPopover({
|
|
202
|
+
open,
|
|
203
|
+
anchorRef,
|
|
204
|
+
orbitRef,
|
|
205
|
+
panelRef: suppliedPanelRef,
|
|
206
|
+
onClose,
|
|
207
|
+
width,
|
|
208
|
+
zIndex = DEFAULT_ORBIT_Z_INDEX,
|
|
209
|
+
portalTarget: suppliedPortalTarget,
|
|
210
|
+
className,
|
|
211
|
+
style,
|
|
212
|
+
ariaLabel,
|
|
213
|
+
children,
|
|
214
|
+
} = {}) {
|
|
215
|
+
const internalPanelRef = HostReact.useRef(null)
|
|
216
|
+
const panelRef = suppliedPanelRef || internalPanelRef
|
|
217
|
+
const returnFocusRef = orbitRef || anchorRef
|
|
218
|
+
const onCloseRef = HostReact.useRef(onClose)
|
|
219
|
+
onCloseRef.current = onClose
|
|
220
|
+
|
|
221
|
+
const close = HostReact.useCallback((detail) => {
|
|
222
|
+
const callback = onCloseRef.current
|
|
223
|
+
if (typeof callback === 'function') callback(closeReason(detail))
|
|
224
|
+
}, [])
|
|
225
|
+
|
|
226
|
+
// 与来源适配器一致:宿主 hooks 和本地 effect 都在 open 分支前无条件调用。
|
|
227
|
+
const position = useAnchoredPosition({
|
|
228
|
+
open: Boolean(open),
|
|
229
|
+
anchorRef,
|
|
230
|
+
panelRef,
|
|
231
|
+
side: 'top',
|
|
232
|
+
align: 'end',
|
|
233
|
+
gap: 8,
|
|
234
|
+
margin: 8,
|
|
235
|
+
})
|
|
236
|
+
useDismissOnOutsidePointer(panelRef, Boolean(open), close, anchorRef)
|
|
237
|
+
|
|
238
|
+
const portalTarget = suppliedPortalTarget === undefined
|
|
239
|
+
? (typeof document !== 'undefined' ? document.body : null)
|
|
240
|
+
: suppliedPortalTarget
|
|
241
|
+
const ownerDocument = portalTarget && portalTarget.ownerDocument
|
|
242
|
+
? portalTarget.ownerDocument
|
|
243
|
+
: (typeof document !== 'undefined' ? document : null)
|
|
244
|
+
|
|
245
|
+
HostReact.useEffect(() => {
|
|
246
|
+
if (!open || !ownerDocument || typeof ownerDocument.addEventListener !== 'function') return undefined
|
|
247
|
+
focusIfConnected(panelRef.current)
|
|
248
|
+
const onKeyDown = (event) => {
|
|
249
|
+
if (!event || event.key !== 'Escape' || event.repeat) return
|
|
250
|
+
if (typeof event.preventDefault === 'function') event.preventDefault()
|
|
251
|
+
if (typeof event.stopPropagation === 'function') event.stopPropagation()
|
|
252
|
+
close({ reason: 'escape' })
|
|
253
|
+
}
|
|
254
|
+
ownerDocument.addEventListener('keydown', onKeyDown, true)
|
|
255
|
+
return () => {
|
|
256
|
+
ownerDocument.removeEventListener('keydown', onKeyDown, true)
|
|
257
|
+
focusIfConnected(returnFocusRef && returnFocusRef.current)
|
|
258
|
+
}
|
|
259
|
+
}, [open, close, ownerDocument, panelRef, returnFocusRef])
|
|
260
|
+
|
|
261
|
+
if (!open) return null
|
|
262
|
+
if (!anchorRef || typeof anchorRef !== 'object') {
|
|
263
|
+
throw new TypeError('OrbitPopover 需要调用方传入 anchorRef')
|
|
264
|
+
}
|
|
265
|
+
if (!Number.isFinite(width) || width <= 0) {
|
|
266
|
+
throw new TypeError('OrbitPopover 需要调用方传入正数 width;适配器不推导业务宽度')
|
|
267
|
+
}
|
|
268
|
+
if (!portalTarget) {
|
|
269
|
+
throw new Error('OrbitPopover portal target 不可用;不会退化为非 portal surface')
|
|
270
|
+
}
|
|
271
|
+
|
|
272
|
+
const surface = hostH(MenuSurface, {
|
|
273
|
+
ref: panelRef,
|
|
274
|
+
role: 'dialog',
|
|
275
|
+
'aria-label': ariaLabel,
|
|
276
|
+
tabIndex: -1,
|
|
277
|
+
className,
|
|
278
|
+
style: {
|
|
279
|
+
...style,
|
|
280
|
+
position: 'fixed',
|
|
281
|
+
left: position ? position.left : 0,
|
|
282
|
+
top: position ? position.top : 0,
|
|
283
|
+
width,
|
|
284
|
+
zIndex,
|
|
285
|
+
visibility: position ? 'visible' : 'hidden',
|
|
286
|
+
},
|
|
287
|
+
}, children)
|
|
288
|
+
return createPortal(surface, portalTarget)
|
|
289
|
+
}
|
|
290
|
+
|
|
291
|
+
return { OrbitPopover, useOrbitConfirm: createOrbitConfirm({ React: HostReact }) }
|
|
292
|
+
}
|
|
293
|
+
|
|
294
|
+
// 老宿主没有这个映射时 require 会抛错;可选探测失败必须完整保留本地实现。
|
|
295
|
+
let hostUi = null
|
|
296
|
+
let hostTooltip = null
|
|
297
|
+
let hostOrbit = null
|
|
298
|
+
try {
|
|
299
|
+
const primitives = require('@deepseek-ai/dsh-client-ui-primitives')
|
|
300
|
+
if (primitives && primitives.Modal && primitives.Toast && primitives.IconWarningOutlineMedium) {
|
|
301
|
+
hostUi = createHostUi({ React, primitives })
|
|
302
|
+
// Tooltip 独立探测:缺少它只回退 InfoTip,不把已接入的 Modal/Toast 一起降级。
|
|
303
|
+
if (primitives.Tooltip && typeof React.forwardRef === 'function') hostTooltip = hostUi.Tooltip
|
|
304
|
+
}
|
|
305
|
+
} catch {
|
|
306
|
+
hostUi = null
|
|
307
|
+
hostTooltip = null
|
|
308
|
+
}
|
|
309
|
+
|
|
310
|
+
// Orbit 独立探测:缺 MenuSurface/定位/外点 hook 或 react-dom.createPortal 任一能力,完整保留旧 StatusOrbit。
|
|
311
|
+
try {
|
|
312
|
+
const primitives = require('@deepseek-ai/dsh-client-ui-primitives')
|
|
313
|
+
if (primitives && primitives.MenuSurface
|
|
314
|
+
&& typeof primitives.useAnchoredPosition === 'function'
|
|
315
|
+
&& typeof primitives.useDismissOnOutsidePointer === 'function') {
|
|
316
|
+
const reactDom = require('react-dom')
|
|
317
|
+
if (reactDom && typeof reactDom.createPortal === 'function') {
|
|
318
|
+
hostOrbit = createOrbitPopover({ React: { ...React, createPortal: reactDom.createPortal }, primitives })
|
|
319
|
+
}
|
|
320
|
+
}
|
|
321
|
+
} catch {
|
|
322
|
+
hostOrbit = null
|
|
323
|
+
}
|
|
324
|
+
|
|
16
325
|
// 客户端版本探针:每次模块加载写一次,用来确认浏览器里跑的是哪一版
|
|
17
|
-
const CLIENT_VERSION = '0.9.
|
|
326
|
+
const CLIENT_VERSION = '0.9.268'
|
|
18
327
|
let BASE = '/session-superagent'
|
|
19
328
|
/**
|
|
20
329
|
* 挑「最新的那个服务端实例」。
|
|
@@ -117,7 +426,7 @@ window.__ModuleLoader__.load({
|
|
|
117
426
|
// 官方 GUI 的 376 条选择器 / 40KB 样式原样搬过来,类名统一 `dt-` 前缀,不污染宿主。
|
|
118
427
|
// 两个表单都有这个开关:文案只写一份,改的时候不会漏掉另一处
|
|
119
428
|
const ISOLATED_HINT = '隔离执行(每次唤醒开一个临时副本;在副本里改,用完自动回收)'
|
|
120
|
-
const PORTED_CSS = "/* Panel layout and local UI controls styled with DSH `--dsw-alias-*` design tokens; one rule per line. */\n.dt-page { box-sizing: border-box; height: 100%; overflow: auto; scrollbar-gutter: stable; scroll-padding: 48px 0 72px; container-type: inline-size; padding: 28px clamp(24px, 4vw, 48px) 0; color: var(--dsw-alias-label-primary); }\n/* Deployment page rendered inside DSH Plugin Manager, which owns scrolling and padding. */\n.dt-embedded { container-type: inline-size; color: var(--dsw-alias-label-primary); }\n/* Disable sticky positioning inside DSH Plugin Manager, where the host container owns scrolling and bottom padding. */\n.dt-embedded .dt-savebar { position: static; }\n.dt-page > * + * { margin-top: 16px; }\n.dt-page > .dt-column { max-width: 960px; margin: 0 auto; padding-bottom: 48px; display: flex; flex-direction: column; gap: 24px; }\n.dt-head { position: relative; z-index: 3; display: flex; align-items: flex-start; justify-content: space-between; gap: 8px 16px; flex-wrap: wrap; }\n.dt-search { position: relative; width: 240px; max-width: 100%; }\n.dt-search-results { position: absolute; top: calc(100% + 6px); right: 0; width: min(560px, 90cqw); max-height: 60vh; overflow: auto; padding: 8px 16px; border: 0.5px solid var(--dsw-alias-border-l3); border-radius: 12px; background: var(--dsw-alias-bg-layer-2); box-shadow: var(--dsw-elevation-prominent); z-index: 5; display: flex; flex-direction: column; gap: 8px; }\n.dt-mark { background: color-mix(in srgb, var(--dsw-alias-state-warn-primary) 25%, transparent); color: inherit; border-radius: 2px; }\n[data-platform='darwin'] .dt-page .dt-head { padding-top: var(--dsh-frame-top-clearance, 0px); }\n.dt-title { margin: 0; font-size: 15px; line-height: 22px; font-weight: 600; color: var(--dsw-alias-label-secondary); }\n.dt-toolbar { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; justify-content: flex-end; }\n.dt-page .dt-tabs { overflow-x: auto; display: flex; gap: 20px; max-width: none; padding: 0; border-radius: 0; background: none; border-bottom: 0.5px solid var(--dsw-alias-border-l3); }\n.dt-segmented { width: 100%; max-width: 420px; box-sizing: border-box; display: inline-grid; gap: 2px; padding: 3px; border-radius: 9px; background: var(--dsw-alias-interactive-bg-hover); }\n.dt-form.dt-block { padding: 16px; border: 0.5px solid var(--dsw-alias-border-l3); border-radius: 16px; gap: 16px; }\n.dt-block-title { display: flex; align-items: center; gap: 4px; margin: 0; font-size: 16px; line-height: 24px; font-weight: 500; }\n.dt-section { display: flex; flex-direction: column; gap: 8px; min-width: 0; }\n.dt-section-title { margin: 0; display: flex; flex-wrap: wrap; align-items: center; gap: 8px; font-size: 14px; line-height: 22px; font-weight: 600; color: var(--dsw-alias-label-primary); }\n.dt-section-name { white-space: nowrap; }\n.dt-count { font-size: 14px; color: var(--dsw-alias-label-caption); font-variant-numeric: tabular-nums; font-weight: 400; } .dt-section-sub { font-size: 12px; line-height: 18px; font-weight: 400; color: var(--dsw-alias-label-caption); }\n.dt-hint { margin: 0; font-size: 13px; line-height: 20px; color: var(--dsw-alias-label-tertiary); }\n.dt-error { margin: 0; font-size: 13px; line-height: 20px; color: var(--dsw-alias-state-error-primary); }\n.dt-banner { margin: 0; padding: 8px 12px; border-radius: 10px; font-size: 13px; line-height: 20px; background: color-mix(in srgb, var(--dsw-alias-state-warn-primary) 10%, transparent); overflow-wrap: anywhere; }\n.dt-banner.dt-danger { background: color-mix(in srgb, var(--dsw-alias-state-error-primary) 10%, transparent); color: var(--dsw-alias-state-error-primary); }\n.dt-list { list-style: none; margin: 0 -8px; padding: 0; display: flex; flex-direction: column; gap: 2px; }\n.dt-row { position: relative; min-width: 0; border-radius: 12px; padding: 10px 8px; display: flex; flex-wrap: wrap; gap: 4px 12px; align-items: flex-start; }\n.dt-row.dt-link:hover { background: var(--dsw-alias-interactive-bg-hover); }\n.dt-row-main { flex: 1 1 200px; min-width: 0; display: flex; flex-direction: column; gap: 4px; }\n.dt-disclosure-body .dt-row-main { flex-basis: 0; }\n.dt-row-title { display: flex; align-items: center; gap: 8px; min-width: 0; font-size: 14px; line-height: 20px; font-weight: 500; }\n.dt-open { max-width: 100%; padding: 0; border: 0; background: transparent; color: inherit; font: inherit; font-size: 14px; line-height: 20px; font-weight: 500; text-align: left; cursor: pointer; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }\n.dt-open::after { content: ''; position: absolute; inset: 0; border-radius: 12px; }\n.dt-open:focus-visible { outline: none; }\n.dt-open-wrap { white-space: normal; }\n.dt-open:focus-visible::after { outline: 2px solid var(--dsw-alias-brand-primary); outline-offset: 2px; }\n.dt-row-meta { display: flex; align-items: center; flex-wrap: wrap; gap: 4px 10px; font-size: 12px; line-height: 18px; color: var(--dsw-alias-label-caption); overflow-wrap: anywhere; }\n.dt-row-quote { font-size: 13px; line-height: 20px; color: var(--dsw-alias-label-secondary); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }\n.dt-clamp { display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }\n/* Transparent block borders preserve vertical spacing when line clamping clips padding. */\n.dt-banner:is(.dt-clamp, .dt-clamp-8) { padding-block: 0; border-block: 8px solid transparent; }\n.dt-banner-label { font-weight: 500; }\n.dt-banner .dt-md { display: inline; }\n.dt-banner .dt-md > p:first-child { display: inline; }\n.dt-row-buttons { position: relative; z-index: 1; gap: 8px; margin-top: 4px; }\n.dt-row-actions { position: relative; z-index: 1; display: flex; align-items: center; gap: 4px; flex: none; margin-left: auto; font-size: 13px; line-height: 20px; }\n.dt-dot { flex: none; margin-top: 5px; }\n.dt-inline-link { position: relative; z-index: 1; color: var(--dsw-alias-link); text-decoration: none; }\n.dt-inline-link:hover { text-decoration: underline; }\n.dt-textlink { padding: 0; border: 0; background: none; font: inherit; color: var(--dsw-alias-link); cursor: pointer; text-align: left; }\n.dt-textlink:hover { text-decoration: underline; }\n.dt-actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; font-size: 13px; line-height: 20px; }\n.dt-kv { display: grid; grid-template-columns: max-content 1fr; gap: 6px 16px; margin: 0; font-size: 13px; line-height: 20px; }\n.dt-kv dt { color: var(--dsw-alias-label-tertiary); }\n.dt-kv dd { margin: 0; min-width: 0; overflow-wrap: anywhere; }\n@container (max-width: 640px) { .dt-kv dt { margin-top: 4px; } .dt-kv dt:first-of-type { margin-top: 0; } }\n.dt-timeline-day { position: sticky; top: 0; z-index: 1; padding: 6px 0 2px; font-size: 12px; line-height: 18px; color: var(--dsw-alias-label-secondary); font-weight: 500; list-style: none; background: var(--dsw-alias-bg-base); }\n.dt-event-head { display: flex; align-items: baseline; gap: 8px; min-width: 0; }\n.dt-event-head .dt-event-time { margin-left: auto; flex: none; font-size: 12px; color: var(--dsw-alias-label-secondary); font-variant-numeric: tabular-nums; }\n.dt-event-nums { color: var(--dsw-alias-label-secondary); font-variant-numeric: tabular-nums; }\n.dt-timeline { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; }\n.dt-event { padding: 12px 0; border-bottom: 0.5px solid var(--dsw-alias-border-l2); display: flex; flex-direction: column; gap: 6px; min-width: 0; }\n.dt-event:last-child { border-bottom: 0; }\n.dt-event.dt-highlight { background: var(--dsw-alias-interactive-bg-hover); border-radius: 8px; padding-inline: 8px; margin-inline: -8px; }\n.dt-event-text { margin: 0; font-size: 13px; line-height: 20px; white-space: pre-wrap; overflow-wrap: anywhere; }\n.dt-event-actor { font-weight: 500; color: var(--dsw-alias-label-secondary); }\n.dt-event-quiet .dt-event-text { color: var(--dsw-alias-label-tertiary); }\n.dt-flow { margin: 0; font-size: 13px; line-height: 20px; color: var(--dsw-alias-label-secondary); }\n.dt-clamp-8 { display: -webkit-box; -webkit-line-clamp: 8; -webkit-box-orient: vertical; overflow: hidden; }\n.dt-more { align-self: flex-start; font-size: 12px; }\n.dt-reveal { opacity: 0; }\n.dt-event:hover .dt-reveal, .dt-reveal:focus-visible { opacity: 1; }\n@media (hover: none) {\n .dt-reveal { opacity: 1; }\n}\n.dt-event-foot { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; font-size: 12px; line-height: 18px; color: var(--dsw-alias-label-tertiary); }\n.dt-filters { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }\n.dt-filters .dt-search { margin-left: auto; }\n.dt-form { display: flex; flex-direction: column; gap: 24px; }\n.dt-fieldset { display: flex; flex-direction: column; gap: inherit; min-width: 0; margin: 0; padding: 0; border: 0; }\n.dt-field { display: flex; flex-direction: column; gap: 6px; font-size: 13px; line-height: 20px; min-width: 0; }\n.dt-field small { color: var(--dsw-alias-label-caption); font-size: 12px; }\n.dt-textarea { box-sizing: border-box; width: 100%; min-width: 0; border: 0.5px solid var(--dsw-alias-border-l3); border-radius: 10px; padding: 8px 12px; font: inherit; font-size: 13px; line-height: 20px; color: var(--dsw-alias-label-primary); background: var(--dsw-alias-bg-layer-1, transparent); resize: vertical; }\n.dt-select { box-sizing: border-box; width: 100%; min-width: 0; height: 32px; border: 0.5px solid var(--dsw-alias-border-l4); border-radius: 8px; padding: 0 28px 0 8px; text-overflow: ellipsis; font: inherit; font-size: 14px; line-height: 22px; color: var(--dsw-alias-label-primary); background: var(--dsw-alias-bg-layer-1, transparent); }\n.dt-textarea:focus-visible, .dt-select:focus-visible { outline: 2px solid var(--dsw-alias-brand-primary); outline-offset: 1px; }\n.dt-mono { font-family: var(--ds-font-family-code, Menlo, monospace); font-size: 12px; overflow-wrap: anywhere; }\n.dt-detail { margin-top: 2px; color: var(--dsw-alias-label-secondary); }\n.dt-savebar .dt-error { white-space: pre-line; }\n.dt-switch-row { display: flex; align-items: center; justify-content: space-between; gap: 16px; min-height: 36px; font-size: 13px; }\n.dt-subhead-actions { display: inline-flex; align-items: center; gap: 4px; }\n.dt-btn-busy .dt-btn-icon svg { animation: dt-spin 1s linear infinite; }\n.dt-subhead { display: flex; align-items: center; justify-content: space-between; gap: 8px; flex-wrap: wrap; font-size: 13px; line-height: 20px; color: var(--dsw-alias-label-secondary); }\n.dt-rules, .dt-changes { list-style: none; margin: 0; padding: 0; }\n.dt-field-head { display: inline-flex; align-items: center; gap: 4px; color: var(--dsw-alias-label-secondary); }\n.dt-info { display: inline-flex; align-items: center; justify-content: center; width: 16px; height: 16px; padding: 0; border: 0; background: none; color: var(--dsw-alias-label-caption); cursor: help; }\n.dt-info:hover, .dt-info:focus-visible { color: var(--dsw-alias-label-secondary); }\n.dt-info:focus-visible { outline: 2px solid var(--dsw-alias-brand-primary); outline-offset: 2px; border-radius: 50%; }\n.dt-tooltip { position: fixed; z-index: 1100; width: max-content; max-width: min(320px, calc(100vw - 24px)); padding: 3px 7px; border-radius: 8px; background: var(--dsw-alias-tooltip-bg); color: var(--dsw-static-neutral-bluish-00); font-size: 13px; line-height: 20px; overflow-wrap: break-word; pointer-events: none; animation: dt-tooltip-in 150ms ease-in-out; }\n@keyframes dt-tooltip-in { from { opacity: 0; } }\n.dt-rules { border-top: 0.5px solid var(--dsw-alias-border-l2); }\n.dt-rule { display: flex; align-items: flex-start; gap: 12px; padding: 6px 0; border-bottom: 0.5px solid var(--dsw-alias-border-l2); }\n.dt-rule > :first-child { flex: 1; min-width: 0; }\n.dt-rule-preview { flex: 1; min-width: 0; margin-left: 8px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 12px; color: var(--dsw-alias-label-caption); }\n.dt-rule-switch { margin-top: 2px; flex: none; }\n.dt-rule-dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--dsw-alias-label-caption); }\n.dt-rule-dot[data-enabled] { background: var(--dsw-alias-brand-primary); }\n.dt-rule-body { display: flex; flex-direction: column; gap: 12px; padding: 8px 0 8px 28px; }\n.dt-model { display: flex; flex-direction: column; gap: 6px; }\n.dt-grid3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }\n.dt-changes { display: flex; flex-direction: column; gap: 2px; font-size: 13px; line-height: 20px; }\n.dt-changes li::before { content: '· '; color: var(--dsw-alias-label-caption); }\n.dt-main { display: flex; flex-direction: column; gap: 24px; min-width: 0; }\n.dt-modal.dt-glossary-modal { width: min(680px, 100%); }\n.dt-nav-item { display: flex; align-items: center; justify-content: space-between; gap: 8px; width: 100%; min-height: 32px; padding: 6px 10px; border: 0; border-radius: 8px; background: transparent; color: var(--dsw-alias-label-secondary); font: inherit; font-size: 13px; line-height: 20px; text-align: left; cursor: pointer; }\n.dt-nav-item:hover { background: var(--dsw-alias-interactive-bg-hover); }\n.dt-nav-item[aria-current='true'] { background: var(--dsw-alias-interactive-bg-hover); color: var(--dsw-alias-label-primary); font-weight: 500; }\n.dt-nav-item:focus-visible { outline: 2px solid var(--dsw-alias-brand-primary); outline-offset: -2px; }\n.dt-changed-dot { width: 6px; height: 6px; border-radius: 50%; background: var(--dsw-alias-brand-primary); flex: none; }\n.dt-add-skill { display: flex; flex-direction: column; gap: 6px; margin-top: 8px; padding-top: 8px; border-top: 0.5px solid var(--dsw-alias-border-l2); }\n.dt-prompt-main { display: flex; flex-direction: column; gap: 12px; min-width: 0; }\n.dt-editor { min-height: 360px; }\n.dt-inline-select { width: auto; }\n.dt-preview-part { display: flex; flex-direction: column; gap: 6px; padding: 2px 0 2px 12px; border-left: 2px solid var(--dsw-alias-border-l3); }\n.dt-preview-head { font-size: 13px; line-height: 20px; display: flex; align-items: baseline; gap: 8px; }\ndiv.dt-preview-head { color: var(--dsw-alias-label-secondary); }\n.dt-card { display: flex; flex-direction: column; gap: 12px; padding: 16px; border: 0.5px solid var(--dsw-alias-border-l3); border-radius: 16px; min-width: 0; }\n.dt-card-head { display: flex; align-items: center; gap: 12px; min-height: 28px; }\n.dt-card-head .dt-row-main { flex: 1 1 0; min-width: 64px; }\n.dt-card-title { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }\n.dt-row-label { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 13px; font-weight: 500; }\n.dt-rows { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }\n.dt-rows-item { display: grid; grid-template-columns: repeat(var(--dt-columns), minmax(0, 1fr)) auto; gap: 8px; align-items: center; }\n.dt-filter-gap { flex: 1; }\n.dt-page-head { display: flex; flex-wrap: wrap; align-items: flex-start; justify-content: space-between; gap: 8px 16px; width: 100%; }\n.dt-page-head > div:first-child { display: flex; flex-direction: column; gap: 4px; min-width: 0; }\n.dt-page-head .dt-toolbar { flex: 0 1 auto; margin-left: auto; }\n.dt-page-head > .dt-btn { margin-left: -10px; }\n.dt-page-title { display: flex; align-items: center; gap: 8px 16px; flex-wrap: wrap; width: 100%; }\n.dt-page-title h2 { margin: 0; flex: 1 1 auto; min-width: 0; font-size: 20px; line-height: 28px; font-weight: 500; overflow-wrap: anywhere; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }\n.dt-status-line { margin-top: -16px; }\n.dt-plain-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; font-size: 13px; line-height: 20px; }\n.dt-plain-list > li { position: relative; padding-left: 12px; }\n.dt-plain-list > li::before { content: ''; position: absolute; left: 0; top: 5px; bottom: 5px; width: 2px; border-radius: 1px; background: currentColor; opacity: 0.45; }\n.dt-details { display: flex; flex-direction: column; gap: 2px; border-top: 0.5px solid var(--dsw-alias-border-l2); padding-top: 8px; }\n.dt-danger-zone { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; padding-top: 16px; border-top: 0.5px solid var(--dsw-alias-border-l2); }\n.dt-danger-zone .dt-btn { color: var(--dsw-alias-state-error-primary); }\n.dt-md { display: flex; flex-direction: column; gap: 6px; font-size: 13px; line-height: 20px; overflow-wrap: anywhere; }\n.dt-md p, .dt-md ul, .dt-md ol { margin: 0; }\n.dt-md ul, .dt-md ol { padding-left: 20px; display: flex; flex-direction: column; gap: 2px; }\n.dt-md-heading { font-weight: 500; }\n.dt-code { font-family: var(--ds-font-family-code, Menlo, monospace); font-size: 12px; padding: 0 4px; border-radius: 4px; background: var(--dsw-alias-bg-module-platform); }\n.dt-dot-wrap { display: inline-flex; flex: none; }\n.dt-search-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; }\n.dt-ellipsis { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 280px; }\n.dt-legend-title { margin: 16px 0 6px; font-size: 13px; color: var(--dsw-alias-label-tertiary); }\n.dt-legend { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 6px 16px; font-size: 13px; }\n.dt-legend li { display: flex; align-items: center; gap: 6px; }\n.dt-legend .dt-dot { margin-top: 0; }\n.dt-savebar { position: sticky; bottom: 0; z-index: 2; display: flex; align-items: center; justify-content: flex-end; gap: 8px; flex-wrap: wrap; padding: 12px 0; background: var(--dsw-alias-bg-base, var(--dsw-alias-bg-layer-1)); border-top: 0.5px solid var(--dsw-alias-border-l2); }\n.dt-savebar .dt-hint { margin-right: auto; }\n.dt-card > .dt-savebar, .dt-block > .dt-savebar { margin: 0 -16px -16px; padding: 12px 16px; border-radius: 0 0 16px 16px; }\n.dt-glossary { width: 100%; border-collapse: collapse; font-size: 13px; line-height: 20px; }\n.dt-glossary th, .dt-glossary td { text-align: left; padding: 6px 8px; border-bottom: 0.5px solid var(--dsw-alias-border-l2); vertical-align: top; }\n.dt-glossary th { color: var(--dsw-alias-label-tertiary); font-weight: 400; }\n.dt-glossary th.dt-glossary-group { color: var(--dsw-alias-label-secondary); font-weight: 600; padding-top: 14px; }\n.dt-glossary th:nth-child(-n+2), .dt-glossary td:nth-child(-n+2) { white-space: nowrap; }\n.dt-values { display: grid; grid-template-columns: max-content 1fr; gap: 6px 16px; margin: 16px 0 0; font-size: 13px; }\n.dt-values dt { color: var(--dsw-alias-label-tertiary); }\n.dt-values dd { margin: 0; }\n.dt-pre { margin: 0; padding: 12px; border-radius: 10px; background: var(--dsw-alias-bg-module-platform); font-family: var(--ds-font-family-code, Menlo, monospace); font-size: 12px; line-height: 18px; white-space: pre-wrap; overflow-wrap: anywhere; max-height: 480px; overflow: auto; }\n.dt-pre ins { background: color-mix(in srgb, var(--dsw-alias-state-success-primary, green) 18%, transparent); text-decoration: none; }\n.dt-pre del { background: color-mix(in srgb, var(--dsw-alias-state-error-primary) 18%, transparent); text-decoration: none; }\n.dt-prompt { display: grid; grid-template-columns: 200px minmax(0, 1fr); gap: 20px; align-items: start; }\n.dt-prompt-nav { display: flex; flex-direction: column; gap: 2px; }\n.dt-prompt-nav button { justify-content: flex-start; }\n.dt-disclosure-body { padding: 8px 0 8px 28px; display: flex; flex-direction: column; gap: 8px; }\n@container (max-width: 640px) {\n .dt-tab { padding: 0 8px; font-size: 13px; }\n .dt-segment { padding: 0 10px; }\n .dt-head { align-items: center; }\n .dt-search-results { right: auto; left: 0; width: 100%; }\n .dt-page-title h2 { font-size: 17px; line-height: 24px; }\n .dt-status-line { margin-top: -12px; }\n .dt-page .dt-tabs { display: flex; flex-wrap: nowrap; scrollbar-width: thin; }\n .dt-page .dt-tab { flex: none; }\n .dt-page .dt-tabs[data-more='end'] { mask-image: linear-gradient(to right, #000 calc(100% - 40px), transparent); }\n .dt-page .dt-tabs[data-more='start'] { mask-image: linear-gradient(to right, transparent, #000 40px); }\n .dt-page .dt-tabs[data-more='both'] { mask-image: linear-gradient(to right, transparent, #000 40px, #000 calc(100% - 40px), transparent); }\n .dt-kv { grid-template-columns: 1fr; gap: 6px; }\n .dt-grid3, .dt-prompt { grid-template-columns: 1fr; }\n .dt-search { width: 100%; }\n .dt-filters .dt-search { margin-left: 0; }\n}\n/* Local UI primitive styles (see controls.tsx). */\n.dt-btn { display: inline-flex; align-items: center; justify-content: center; gap: 4px; border: none; border-radius: 18px; cursor: pointer; font: inherit; font-size: 14px; line-height: 22px; color: var(--dsw-alias-label-primary); background: transparent; padding: 0 14px; white-space: nowrap; }\n.dt-btn:disabled { cursor: not-allowed; opacity: 0.4; }\n.dt-btn:focus-visible { outline: 2px solid var(--dsw-alias-brand-primary); outline-offset: 2px; }\n.dt-btn-md { height: 36px; }\n.dt-btn-sm { height: 28px; font-size: 12px; line-height: 18px; padding: 0 10px; border-radius: 14px; }\n/* 主按钮:深色下 label-primary-foreground(深色)压绿底只有 4.09 —— 深色主题里前景该是浅的。 */\n/* 往白色混 70%:浅色下仍是浅字(4.5+),深色下变浅(>4.5),两边都过。 */\n.dt-btn-primary { background: var(--dsw-alias-button-primary-fill); color: var(--dsw-static-neutral-bluish-00); }\n.dt-btn-primary:hover:not(:disabled) { background: var(--dsw-alias-button-primary-hover); }\n.dt-btn-ghost { background: transparent; border: 0.5px solid var(--dsw-alias-border-l3); color: var(--dsw-alias-label-secondary); }\n.dt-btn-ghost:hover:not(:disabled), .dt-btn-outline:hover:not(:disabled) { background: var(--dsw-alias-interactive-bg-hover); }\n.dt-btn-ghost:active:not(:disabled) { background: var(--dsw-alias-interactive-bg-active); }\n.dt-btn-outline { border: 0.5px solid var(--dsw-alias-border-l3); }\n.dt-btn-icon { display: inline-flex; width: 16px; height: 16px; align-items: center; justify-content: center; }\n.dt-tag { display: inline-flex; align-items: center; border-radius: 999px; padding: 1px 8px; font-size: 11px; line-height: 17px; font-weight: 500; white-space: nowrap; }\n.dt-tag[data-tone='outline'] { border: 0.5px solid var(--dsw-alias-border-l4); color: var(--dsw-alias-label-tertiary); }\n.dt-tag[data-tone='neutral'] { background: var(--dsw-alias-bg-module-platform); color: var(--dsw-alias-label-secondary); }\n.dt-tag[data-tone='quiet'] { color: var(--dsw-alias-label-tertiary); }\n.dt-tag[data-tone='success'] { background: color-mix(in srgb, var(--dsw-alias-state-success-primary) 10%, transparent); color: color-mix(in srgb, var(--dsw-alias-state-success-primary) 72%, var(--dsw-alias-label-primary)); }\n.dt-tag[data-tone='info'] { background: color-mix(in srgb, var(--dsw-alias-state-business-primary) 10%, transparent); color: var(--dsw-alias-state-business-primary); }\n/* 胶囊是「暂停/退避/判断」唯一的状态色:文字与 12% 同色底叠起来,浅色下警告只有 4.17。 */\n/* 往 label-primary 混 28%:浅色变深、深色变浅,两档都留出余量。 */\n.dt-tag[data-tone='warning'] { background: color-mix(in srgb, var(--dsw-alias-state-warn-primary) 12%, transparent); color: color-mix(in srgb, var(--dsw-alias-state-warn-primary) 72%, var(--dsw-alias-label-primary)); }\n.dt-tag[data-tone='danger'] { background: color-mix(in srgb, var(--dsw-alias-state-error-primary) 10%, transparent); color: color-mix(in srgb, var(--dsw-alias-state-error-primary) 76%, var(--dsw-alias-label-primary)); }\n.dt-pill { display: inline-flex; align-items: center; gap: 4px; height: 24px; padding: 0 8px; border: none; border-radius: 12px; font: inherit; font-size: 12px; line-height: 18px; color: var(--dsw-alias-label-secondary); background: var(--dsw-alias-bg-layer-2); cursor: pointer; }\n.dt-pill:hover { background: var(--dsw-alias-interactive-bg-hover); }\n.dt-pill-active, .dt-pill-active:hover { color: var(--dsw-alias-label-primary); background: var(--dsw-alias-button-ghost-active-fill); box-shadow: inset 0 0 0 1px var(--dsw-alias-button-ghost-active-border); }\n.dt-tabs { display: grid; padding: 4px; border-radius: 12px; background: var(--dsw-alias-bg-module-platform); }\n.dt-tab { box-sizing: border-box; height: 34px; padding: 0 12px; border: 0.5px solid transparent; border-radius: 8px; background: transparent; color: var(--dsw-alias-label-secondary); font: inherit; font-size: 14px; line-height: 20px; white-space: nowrap; cursor: pointer; transition: color 180ms ease, background 180ms ease; }\n.dt-tab:hover { color: var(--dsw-alias-label-primary); }\n.dt-tab[aria-selected='true'] { color: var(--dsw-alias-label-primary); font-weight: 600; background: var(--dsw-alias-bg-layer-3); border-color: var(--dsw-alias-border-l3); }\n.dt-tab:focus-visible { outline: none; text-decoration: underline; text-underline-offset: 4px; }\n.dt-segment { height: 28px; padding: 0 16px; border: 0; border-radius: 7px; background: transparent; color: var(--dsw-alias-label-secondary); font: inherit; font-size: 13px; line-height: 20px; font-weight: 500; white-space: nowrap; cursor: pointer; transition: color 120ms ease, background 160ms ease; }\n.dt-segment:hover:not(:disabled), .dt-segment[aria-selected='true'] { color: var(--dsw-alias-label-primary); }\n.dt-segment[aria-selected='true'] { background: var(--dsw-alias-bg-layer-1); box-shadow: var(--dsw-elevation-soft); }\n.dt-segment:disabled { cursor: default; opacity: 0.4; }\n.dt-segment:focus-visible { outline: 2px solid var(--dsw-alias-brand-primary); outline-offset: -2px; }\n.dt-input { box-sizing: border-box; display: inline-flex; align-items: center; gap: 6px; height: 32px; min-width: 0; padding: 0 8px; border: 0.5px solid var(--dsw-alias-border-l4); border-radius: 8px; background: var(--dsw-alias-bg-layer-1); }\n.dt-input:focus-within { border-color: var(--dsw-alias-brand-primary); }\n.dt-input-icon { display: inline-flex; width: 16px; height: 16px; align-items: center; justify-content: center; color: var(--dsw-alias-label-tertiary); }\n.dt-input input { flex: 1; min-width: 0; border: none; outline: none; background: transparent; font: inherit; font-size: 14px; line-height: 22px; color: var(--dsw-alias-label-primary); }\n.dt-input input/* 占位符:label-dimmed 在浅色下只有 2.17(深色 3.81),必须能读出来才叫占位符。 */\n/* 往 label-tertiary 混 60%:浅色变深、深色变浅,两档都过 4.5。 */\n::placeholder { color: color-mix(in srgb, var(--dsw-alias-label-dimmed) 40%, var(--dsw-alias-label-tertiary)); }\n.dt-input input::-webkit-search-cancel-button { -webkit-appearance: none; appearance: none; }\n.dt-field .dt-input, .dt-search .dt-input, .dt-add-skill .dt-input { display: flex; width: 100%; }\n.dt-switch { box-sizing: border-box; flex: 0 0 auto; width: 36px; height: 20px; padding: 2px; border: 0; border-radius: 10px; background: var(--dsw-alias-border-l3); cursor: pointer; }\n.dt-switch[aria-checked='true'] { background: var(--dsw-alias-brand-primary); }\n.dt-switch:focus-visible { outline: 2px solid var(--dsw-alias-brand-primary); outline-offset: 2px; }\n.dt-switch-thumb { display: block; width: 16px; height: 16px; border-radius: 50%; background: var(--dsw-alias-label-primary-foreground); transition: transform 120ms ease; }\n.dt-switch[aria-checked='true'] .dt-switch-thumb { transform: translateX(16px); }\n.dt-state-dot { position: relative; display: inline-block; flex: none; width: 10px; height: 10px; color: var(--dsw-alias-state-idle-primary); }\n.dt-state-dot::after { content: ''; position: absolute; inset: 20%; border-radius: 50%; background: currentColor; }\n.dt-state-dot[data-state='done'] { color: var(--dsw-alias-state-success-primary); }\n.dt-state-dot[data-state='warning'] { color: var(--dsw-alias-state-warn-primary); }\n.dt-state-dot[data-state='error'] { color: var(--dsw-alias-state-error-primary); }\n.dt-spinner { flex: none; color: var(--dsw-alias-label-tertiary); }\n.dt-spinner g { transform-origin: center; animation: dt-spin 1.5s linear infinite; }\n.dt-spinner circle { fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; }\n.dt-spinner circle:first-child { opacity: 0.25; }\n.dt-spinner circle:last-child { stroke-dasharray: 18 150; }\n@keyframes dt-spin { to { transform: rotate(360deg); } }\n.dt-disclosure-row { display: flex; align-items: center; gap: 4px; min-height: 28px; min-width: 0; border-radius: 8px; cursor: pointer; font-size: 13px; line-height: 20px; color: var(--dsw-alias-label-secondary); }\n.dt-disclosure-row:hover { color: var(--dsw-alias-label-primary); }\n.dt-disclosure-row:focus-visible { outline: 2px solid var(--dsw-alias-brand-primary); outline-offset: 2px; }\n.dt-disclosure-lead { position: relative; display: inline-flex; flex: none; width: 24px; height: 24px; align-items: center; justify-content: center; }\n.dt-disclosure-icon { display: inline-flex; align-items: center; justify-content: center; }\n.dt-disclosure-chevron { position: absolute; inset: 0; display: none; align-items: center; justify-content: center; }\n.dt-disclosure-row:hover .dt-disclosure-icon, .dt-disclosure[data-open] .dt-disclosure-icon { visibility: hidden; }\n.dt-disclosure-row:hover .dt-disclosure-chevron, .dt-disclosure[data-open] .dt-disclosure-chevron { display: inline-flex; }\n.dt-disclosure-title { flex: 0 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }\n.dt-modal-root { position: fixed; inset: 0; z-index: 1000; display: flex; align-items: center; justify-content: center; padding: max(24px, var(--dsh-frame-top-clearance, 24px)) 24px; }\n.dt-modal-mask { position: absolute; inset: 0; background: var(--dsw-alias-bg-mask-1); backdrop-filter: var(--dsw-mask-blur); }\n.dt-modal { position: relative; z-index: 1; display: flex; flex-direction: column; gap: 20px; width: min(380px, 100%); max-height: 100%; padding: 0 0 24px; overflow: hidden; border-radius: 24px; background: var(--dsw-alias-bg-layer-2); box-shadow: var(--dsw-elevation-prominent); color: var(--dsw-alias-label-primary); outline: none; }\n.dt-modal-header { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 22px 14px 0 24px; }\n.dt-modal-header h2 { margin: 0; font-size: 16px; line-height: 24px; font-weight: 500; }\n.dt-modal-close { display: inline-flex; align-items: center; justify-content: center; width: 28px; height: 28px; border: none; border-radius: 8px; background: transparent; cursor: pointer; color: var(--dsw-alias-label-secondary); }\n.dt-modal-close:hover { background: var(--dsw-alias-interactive-bg-hover); }\n.dt-modal-description { margin: -8px 0 0; padding: 0 24px; font-size: 14px; line-height: 22px; }\n.dt-modal-body { min-width: 0; min-height: 0; overflow: auto; padding: 0 24px; }\n.dt-modal-footer { display: flex; align-items: center; justify-content: flex-end; gap: 8px; padding: 0 24px; }\n.dt-toast { position: fixed; top: 40px; left: 50%; z-index: 1100; pointer-events: none; width: max-content; max-width: min(640px, calc(100vw - 48px)); padding: 12px 16px; border-radius: 14px; background: var(--dsw-alias-toast-bg); color: var(--dsw-static-neutral-bluish-00); font-size: 14px; line-height: 22px; box-shadow: var(--dsw-shadow-lv3); transform: translateX(-50%); animation: dt-toast-in 160ms ease-out, dt-toast-fade 1000ms ease var(--dt-toast-hold, 3000ms) forwards; }\n@keyframes dt-toast-in { from { opacity: 0; transform: translate(-50%, -6px); } to { opacity: 1; transform: translate(-50%, 0); } }\n@keyframes dt-toast-fade { to { opacity: 0; visibility: hidden; } }\n@media (prefers-reduced-motion: reduce) {\n .dt-tab, .dt-segment, .dt-switch-thumb, .dt-spinner g, .dt-btn-busy .dt-btn-icon svg, .dt-tooltip { transition: none; animation: none; }\n .dt-toast { animation: dt-toast-fade 1000ms ease var(--dt-toast-hold, 3000ms) forwards; }\n}\n.dt-page .dt-tab { height: 34px; padding: 0 2px; border: 0; border-radius: 0; color: var(--dsw-alias-label-tertiary); font-size: 14px; }\n.dt-page .dt-tab[aria-selected='true'] { background: none; color: var(--dsw-alias-label-primary); font-weight: 500; box-shadow: inset 0 -1.5px 0 var(--dsw-alias-label-primary); }\n.dt-status-head { display: flex; align-items: center; gap: 8px; }\n.dt-status-title { margin: 0; flex: 1; display: flex; align-items: center; gap: 4px; font-size: 15px; line-height: 22px; font-weight: 600; }\n.dt-status-text { margin-left: auto; flex: none; font-size: 12px; font-weight: 400; color: var(--dsw-alias-label-secondary); }\n.dt-status-line .dt-status-text { margin-left: 0; }\n.dt-status-text[data-state='warning'] { color: var(--dsw-alias-state-warn-primary); }\n.dt-status-text[data-state='error'] { color: var(--dsw-alias-state-error-primary); }\n.dt-row-name { min-width: 0; overflow: hidden; text-overflow: ellipsis; }\n.dt-lv { white-space: nowrap; }\n.dt-lv-label { color: var(--dsw-alias-label-caption); }\n.dt-lv-value { color: var(--dsw-alias-label-secondary); font-variant-numeric: tabular-nums; }\n.dt-chip { display: inline-flex; flex-wrap: wrap; max-width: 100%; border: 0.5px solid var(--dsw-alias-border-l3); border-radius: 6px; overflow: hidden; font-size: 11px; line-height: 18px; color: var(--dsw-alias-label-secondary); }\n.dt-chip-source { padding: 0 6px; color: var(--dsw-alias-label-tertiary); background: var(--dsw-alias-bg-module-platform); }\n.dt-chip-fact { padding: 0 6px; border-left: 0.5px solid var(--dsw-alias-border-l3); white-space: nowrap; }\n.dt-chip-label { margin-right: 4px; color: var(--dsw-alias-label-caption); }\n.dt-chip-link { position: relative; z-index: 1; text-decoration: none; cursor: pointer; transition: border-color 120ms ease; }\n.dt-chip-link:hover { border-color: var(--dsw-alias-brand-primary); }\n.dt-chip-link:focus-visible { outline: 2px solid var(--dsw-alias-brand-primary); outline-offset: 1px; }\n.dt-chip-open { display: inline-flex; align-items: center; padding: 0 5px; border-left: 0.5px solid var(--dsw-alias-border-l3); color: var(--dsw-alias-brand-primary); }\n.dt-chip-problem, .dt-chip-problem .dt-chip-label { color: var(--dsw-alias-state-error-primary); }\n.dt-cards { gap: 8px; }\n.dt-att .dt-inline-link { font-size: 13px; font-weight: 500; }\n.dt-list > .dt-att { margin: 2px 8px; }\n.dt-att { padding: 10px 12px 10px 16px; border: 0; border-radius: 0; border-bottom: 0.5px solid var(--dsw-alias-border-l3); }\n.dt-att::before { content: ''; position: absolute; left: 6px; top: 10px; bottom: 10px; width: 2px; border-radius: 1px; background: var(--dsw-alias-state-warn-primary); opacity: 0.7; }\n.dt-att-error::before { background: var(--dsw-alias-state-error-primary); }\n.dt-att-what { font-size: 12px; line-height: 18px; font-weight: 500; color: var(--dsw-alias-state-warn-primary); }\n.dt-att-error .dt-att-what, .dt-att-error .dt-att-what .dt-open { color: var(--dsw-alias-state-error-primary); }\n.dt-stats { display: flex; flex-wrap: wrap; gap: 6px 24px; padding: 10px 14px; border: 0.5px solid var(--dsw-alias-border-l3); border-radius: 12px; background: var(--dsw-alias-bg-module-platform); }\n.dt-stat { display: inline-flex; align-items: baseline; gap: 6px; font-size: 12px; color: var(--dsw-alias-label-caption); }\n/* 可点的统计数字:去掉原生按钮外观,保留文字排版;选中时用浅底提示 */\n.dt-stat-btn { border: 0; background: none; padding: 2px 6px; margin: -2px -6px; border-radius: 8px; font: inherit; color: inherit; cursor: pointer; }\n.dt-stat-btn:hover { background: var(--dsw-alias-interactive-bg-hover); }\n/* 浅色下 interactive-bg-hover 与白底只差 1.03:点了统计数字在按筛选,零视觉反馈。 */\n/* 换成品牌色 12% 底 + 0.5px 品牌色描边(两个主题都分得开)。 */\n.dt-stat-btn[aria-pressed='true'] { background: color-mix(in srgb, var(--dsw-alias-brand-primary) 12%, transparent); box-shadow: inset 0 0 0 0.5px var(--dsw-alias-brand-primary); }\n.dt-stat-btn:focus-visible { outline: 2px solid var(--dsw-alias-brand-primary); outline-offset: 1px; }\n/* 统计条单位:按钮上的 color:inherit 会把单位染成数字色,所以单位单独一档。 */\n/* 浅色下 caption(#818b98)在白底只有 3.14–3.45,深色下同一档 4.34–5.07。 */\n/* 往 label-primary 混 30%:浅色变深、深色变浅,两个主题的对比度同时变好(不用新 token)。 */\n/* 注意选择器**不带** .dt-stat-btn 前缀 —— 带前缀就只作用于可点的格子,不可点的仍是旧色(真机踩过)。 */\n.dt-stat-unit { color: color-mix(in srgb, var(--dsw-alias-label-caption) 70%, var(--dsw-alias-label-primary)); }\n/* 选中的统计格:品牌色 12% 底会把单位压到 4.20,再往主色多混 10% 拉回来。 */\n.dt-stat-btn[aria-pressed='true'] .dt-stat-unit { color: color-mix(in srgb, var(--dsw-alias-label-caption) 58%, var(--dsw-alias-label-primary)); }\n.dt-stat-value { font-size: 14px; font-weight: 500; color: var(--dsw-alias-label-primary); font-variant-numeric: tabular-nums; }\n.dt-more-link { font-size: 12px; font-weight: 400; }\n.dt-settings { display: grid; grid-template-columns: 140px minmax(0, 1fr); gap: 24px; align-items: start; }\n.dt-settings-nav { position: sticky; top: 0; display: flex; flex-direction: column; gap: 2px; }\n.dt-settings-link { padding: 6px 10px; border: 0; border-radius: 8px; background: none; color: var(--dsw-alias-label-secondary); font: inherit; font-size: 13px; line-height: 20px; text-align: left; cursor: pointer; }\n.dt-settings-link:hover { color: var(--dsw-alias-label-primary); }\n.dt-settings-link[aria-current='page'] { background: var(--dsw-alias-bg-module-platform); color: var(--dsw-alias-label-primary); font-weight: 500; }\n.dt-settings-link[data-stage] + .dt-settings-link:not([data-stage]) { margin-top: 10px; }\n.dt-settings-body { display: flex; flex-direction: column; gap: 16px; min-width: 0; padding: 16px; border: 0.5px solid var(--dsw-alias-border-l3); border-radius: 16px; background: var(--dsw-alias-bg-layer-1); }\n.dt-settings-title { margin: 0; font-size: 15px; line-height: 22px; font-weight: 600; }\n.dt-settings-body .dt-section-title { font-size: 15px; line-height: 22px; }\n.dt-subtabs { display: flex; gap: 16px; border-bottom: 0.5px solid var(--dsw-alias-border-l3); }\n.dt-subtab { padding: 0 0 6px; border: 0; background: none; color: var(--dsw-alias-label-tertiary); font: inherit; font-size: 13px; cursor: pointer; }\n.dt-subtab[aria-selected='true'] { color: var(--dsw-alias-label-primary); font-weight: 500; box-shadow: inset 0 -1.5px 0 var(--dsw-alias-label-primary); }\n.dt-part { display: flex; flex-direction: column; gap: 12px; }\n.dt-rows-summary { text-align: left; color: var(--dsw-alias-label-secondary); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 100%; }\n.dt-table { width: 100%; border-collapse: collapse; font-size: 12px; line-height: 18px; }\n.dt-table th { text-align: left; font-weight: 400; color: var(--dsw-alias-label-caption); padding: 2px 8px 2px 0; }\n.dt-table td { padding: 4px 8px 4px 0; border-top: 0.5px solid var(--dsw-alias-border-l3); vertical-align: top; color: var(--dsw-alias-label-secondary); overflow-wrap: anywhere; }\n@container (max-width: 640px) {\n .dt-settings { grid-template-columns: 1fr; gap: 12px; }\n .dt-settings-nav { position: static; flex-direction: row; flex-wrap: wrap; }\n .dt-settings-link[data-stage] + .dt-settings-link:not([data-stage]) { margin-top: 0; }\n .dt-page .dt-tabs { gap: 14px; }\n}\n.dt-list > .dt-ticket { display: grid; grid-template-columns: 112px minmax(0, 1fr); column-gap: 12px; align-items: start; margin: 0; padding: 12px 8px 12px 18px; border-radius: 0; border-bottom: 0.5px solid var(--dsw-alias-border-l3); }\n.dt-list > .dt-ticket[data-state]::before { content: ''; position: absolute; left: 6px; top: 12px; bottom: 12px; width: 2px; border-radius: 1px; background: var(--dsw-alias-state-warn-primary); opacity: 0.7; }\n.dt-list > .dt-ticket[data-state='error']::before { background: var(--dsw-alias-state-error-primary); }\n.dt-ticket-stage { align-self: stretch; padding-top: 1px; border-right: 0.5px solid var(--dsw-alias-border-l3); }\n.dt-ticket-body { display: flex; flex-direction: column; gap: 4px; min-width: 0; }\n.dt-ticket-body .dt-row-title .dt-open { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }\n.dt-ticket-meta { flex-wrap: nowrap; overflow: hidden; white-space: nowrap; }\n.dt-ticket-meta .dt-chip { flex: none; }\n.dt-ticket-meta .dt-ticket-actions { margin-top: 0; margin-left: auto; min-height: 0; flex-wrap: nowrap; }\n@container (max-width: 640px) { .dt-ticket-meta { flex-wrap: wrap; white-space: normal; } .dt-ticket-meta .dt-ticket-actions { flex-wrap: wrap; } }\n.dt-ticket-note { min-width: 0; overflow: hidden; text-overflow: ellipsis; color: var(--dsw-alias-label-primary); }\n.dt-ticket-note-error { color: var(--dsw-alias-state-error-primary); }\n.dt-ticket-note-pause { font-weight: 500; color: var(--dsw-alias-state-warn-primary); }\n.dt-ticket-actions { position: relative; z-index: 1; display: flex; flex-wrap: wrap; gap: 8px; min-height: 30px; margin-top: 2px; }\n/* Pass pointer events through action containers to the row link, keeping only child controls interactive. */\n.dt-ticket-actions, .dt-row-buttons, .dt-row-actions { pointer-events: none; }\n.dt-ticket-actions > *, .dt-row-buttons > *, .dt-row-actions > * { pointer-events: auto; }\n.dt-line { min-height: 20px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }\n.dt-row-meta.dt-line { flex-wrap: nowrap; }\n.dt-line-text { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--dsw-alias-label-secondary); }\n.dt-error-text { color: var(--dsw-alias-state-error-primary); }\n.dt-stage { display: inline-flex; align-items: flex-start; gap: 5px; font-size: 12px; line-height: 18px; font-weight: 500; color: var(--dsw-alias-label-secondary); }\n.dt-stage svg { flex: none; margin-top: 2px; }\n.dt-stage[data-state='warning'] { color: var(--dsw-alias-state-warn-primary); }\n.dt-stage[data-state='error'] { color: var(--dsw-alias-state-error-primary); }\n.dt-stage[data-state='ongoing'] { color: var(--dsw-alias-state-business-primary); }\n.dt-icon-link { display: inline-flex; align-items: center; gap: 4px; }\na.dt-btn, a.dt-btn:hover { text-decoration: none; }\n.dt-section-icon { display: inline-flex; align-self: center; color: var(--dsw-alias-label-tertiary); }\n.dt-trigger-link { display: flex; flex-direction: column; gap: 2px; width: 100%; margin: -4px 0 -4px -8px; padding: 4px 8px; border: 0; border-radius: 8px; background: none; font: inherit; color: inherit; text-align: left; cursor: pointer; }\n.dt-trigger-link:hover { background: var(--dsw-alias-interactive-bg-hover); }\n.dt-trigger-link:focus-visible { outline: 2px solid var(--dsw-alias-brand-primary); outline-offset: 1px; }\n.dt-trigger-text { display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }\n.dt-kv-stack { display: flex; flex-direction: column; gap: 2px; min-width: 0; }\n.dt-banner-actions { margin-top: 6px; }\n@container (max-width: 640px) {\n .dt-list > .dt-ticket { grid-template-columns: 1fr; row-gap: 4px; }\n .dt-ticket-stage { border-right: 0; }\n}\n.dt-nav-group { margin: 10px 10px 2px; font-size: 12px; font-weight: 600; color: var(--dsw-alias-label-secondary); }\n.dt-nav-group:first-child { margin-top: 0; }\n.dt-prompt-nav .dt-nav-item { flex-direction: column; align-items: flex-start; gap: 2px; text-align: left; }\n.dt-nav-item > span { display: inline-flex; align-items: center; gap: 6px; }\n.dt-nav-item small { font-size: 12px; line-height: 18px; font-weight: 400; color: var(--dsw-alias-label-caption); }\n.dt-preview-part[data-editable] { border-left-color: var(--dsw-alias-brand-primary); }\n.dt-preview-head b { font-weight: 500; }\n.dt-preview-head > span { font-size: 12px; color: var(--dsw-alias-label-caption); }\n.dt-changed-tag { margin-left: 6px; padding: 0 5px; border: 0.5px solid var(--dsw-alias-border-l3); border-radius: 4px; font-size: 11px; line-height: 16px; font-weight: 400; color: var(--dsw-alias-label-secondary); }\n.dt-updated-tag { border-color: var(--dsw-alias-state-warn-primary); color: var(--dsw-alias-state-warn-primary); }\n.dt-default-updated { display: flex; flex-direction: column; gap: 6px; padding: 2px 0 2px 12px; border-left: 2px solid var(--dsw-alias-state-warn-primary); }\n.dt-diff-fold { color: var(--dsw-alias-label-caption); font-style: italic; }\n.dt-compare { margin-left: auto; }\n.dt-admission th { white-space: nowrap; }\n.dt-admission thead tr:first-child th:not(:first-child) { color: var(--dsw-alias-label-secondary); font-weight: 500; }\n.dt-admission td { vertical-align: middle; }\n.dt-admission-scope { color: var(--dsw-alias-label-primary); font-size: 13px; }\n.dt-admission-scope small { display: block; font-size: 11px; color: var(--dsw-alias-label-caption); }\n.dt-admission-na { color: var(--dsw-alias-label-caption); }\n.dt-admission-cell { display: flex; align-items: center; gap: 4px; }\n.dt-admission-cell .dt-select { flex: 1; min-width: 0; }\n.dt-admission-slot { display: inline-flex; flex: none; width: 16px; }\n.dt-info-warn { color: var(--dsw-alias-state-warn-primary); }\n.dt-field-segmented { max-width: 240px; }\n/* 活跃时段:两个原生 time 选择器 + 全天按钮 */\n/* 表单控件不必满宽:短数字撑到 900px 只会显得空 */\n.dt-form > .dt-field > .dt-input { max-width: 480px; }\n.dt-error-card { border-color: color-mix(in srgb, var(--dsw-alias-state-error-primary) 35%, var(--dsw-alias-border-l3)); }\n.dt-error-card .dt-card-title { color: var(--dsw-alias-state-error-primary); }\n/* 空态引导:圆形步骤号 + 标题 + 说明,替代「① + 列表符号」的重复 */\n.dt-steps { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 12px; counter-reset: none; }\n.dt-step { display: flex; align-items: flex-start; gap: 10px; min-width: 0; }\n.dt-step-num { flex: none; display: inline-flex; align-items: center; justify-content: center; width: 20px; height: 20px; border-radius: 50%; background: var(--dsw-alias-bg-module-platform); color: var(--dsw-alias-label-secondary); font-size: 12px; line-height: 1; font-variant-numeric: tabular-nums; }\n.dt-step-body { display: flex; flex-direction: column; gap: 2px; min-width: 0; }\n.dt-step-title { font-size: 13px; line-height: 20px; font-weight: 500; color: var(--dsw-alias-label-primary); }\n.dt-empty { display: flex; flex-direction: column; gap: 6px; padding: 16px; border: 0.5px solid var(--dsw-alias-border-l3); border-radius: 12px; }\n.dt-step-detail { font-size: 12px; line-height: 18px; color: var(--dsw-alias-label-tertiary); }\n.dt-hours { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }\n.dt-time { box-sizing: border-box; height: 32px; padding: 0 8px; border: 0.5px solid var(--dsw-alias-border-l4); border-radius: 8px; background: var(--dsw-alias-bg-layer-1); color: var(--dsw-alias-label-primary); font: inherit; font-size: 13px; font-variant-numeric: tabular-nums; }\n.dt-time:focus-visible { outline: 2px solid var(--dsw-alias-brand-primary); outline-offset: 1px; }\n.dt-hours-sep { color: var(--dsw-alias-label-tertiary); }\n.dt-hours-hint { font-size: 12px; color: var(--dsw-alias-label-caption); }\n/* 分诊信号表(设置 → 诊断):左列「名字 + 两个标签」成组,右列 `+N 分` 定宽贴右、数字等宽。只挂局部类,全局 .dt-row-title 一行没动 —— 别的列表还在用它。 */\n.dt-signal-title { display: grid; grid-template-columns: minmax(0, 1fr) 4.5em; align-items: baseline; column-gap: 12px; }\n.dt-signal-lead { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 8px; min-width: 0; }\n.dt-signal-meta { display: block; justify-self: stretch; text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }\n/* 同一个维度(默认开/关)的两档要等权:`默认关` 原本是 49×19 的裸字,`默认开` 是 51×21 的描边胶囊。 */\n.dt-signal-lead .dt-tag[data-tone='quiet'] { border: 0.5px solid var(--dsw-alias-border-l4); }\n";
|
|
429
|
+
const PORTED_CSS = "/* Panel layout and local UI controls styled with DSH `--dsw-alias-*` design tokens; one rule per line. */\n.dt-page { box-sizing: border-box; height: 100%; overflow: auto; scrollbar-gutter: stable; scroll-padding: 48px 0 72px; container-type: inline-size; padding: 28px clamp(24px, 4vw, 48px) 0; color: var(--dsw-alias-label-primary); }\n/* Deployment page rendered inside DSH Plugin Manager, which owns scrolling and padding. */\n.dt-embedded { container-type: inline-size; color: var(--dsw-alias-label-primary); }\n/* Disable sticky positioning inside DSH Plugin Manager, where the host container owns scrolling and bottom padding. */\n.dt-embedded .dt-savebar { position: static; }\n.dt-page > * + * { margin-top: 16px; }\n.dt-page > .dt-column { max-width: 960px; margin: 0 auto; padding-bottom: 48px; display: flex; flex-direction: column; gap: 24px; }\n.dt-head { position: relative; z-index: 3; display: flex; align-items: flex-start; justify-content: space-between; gap: 8px 16px; flex-wrap: wrap; }\n.dt-search { position: relative; width: 240px; max-width: 100%; }\n.dt-search-results { position: absolute; top: calc(100% + 6px); right: 0; width: min(560px, 90cqw); max-height: 60vh; overflow: auto; padding: 8px 16px; border: 0.5px solid var(--dsw-alias-border-l3); border-radius: 12px; background: var(--dsw-alias-bg-layer-2); box-shadow: var(--dsw-elevation-prominent); z-index: 5; display: flex; flex-direction: column; gap: 8px; }\n.dt-mark { background: color-mix(in srgb, var(--dsw-alias-state-warn-primary) 25%, transparent); color: inherit; border-radius: 2px; }\n[data-platform='darwin'] .dt-page .dt-head { padding-top: var(--dsh-frame-top-clearance, 0px); }\n.dt-title { margin: 0; font-size: 15px; line-height: 22px; font-weight: 600; color: var(--dsw-alias-label-secondary); }\n.dt-toolbar { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; justify-content: flex-end; }\n.dt-page .dt-tabs { overflow-x: auto; display: flex; gap: 20px; max-width: none; padding: 0; border-radius: 0; background: none; border-bottom: 0.5px solid var(--dsw-alias-border-l3); }\n.dt-segmented { width: 100%; max-width: 420px; box-sizing: border-box; display: inline-grid; gap: 2px; padding: 3px; border-radius: 9px; background: var(--dsw-alias-interactive-bg-hover); }\n.dt-ticket-body .dt-form { position: relative; z-index: 1; }\n.dt-form.dt-block { padding: 16px; border: 0.5px solid var(--dsw-alias-border-l3); border-radius: 16px; gap: 16px; }\n.dt-block-title { display: flex; align-items: center; gap: 4px; margin: 0; font-size: 16px; line-height: 24px; font-weight: 500; }\n.dt-section { display: flex; flex-direction: column; gap: 8px; min-width: 0; }\n.dt-section-title { margin: 0; display: flex; flex-wrap: wrap; align-items: center; gap: 8px; font-size: 14px; line-height: 22px; font-weight: 600; color: var(--dsw-alias-label-primary); }\n.dt-section-name { white-space: nowrap; }\n.dt-count { font-size: 14px; color: var(--dsw-alias-label-caption); font-variant-numeric: tabular-nums; font-weight: 400; } .dt-section-sub { font-size: 12px; line-height: 18px; font-weight: 400; color: var(--dsw-alias-label-caption); }\n.dt-hint { margin: 0; font-size: 13px; line-height: 20px; color: var(--dsw-alias-label-tertiary); }\n.dt-error { margin: 0; font-size: 13px; line-height: 20px; color: var(--dsw-alias-state-error-primary); }\n.dt-banner { margin: 0; padding: 8px 12px; border-radius: 10px; font-size: 13px; line-height: 20px; background: color-mix(in srgb, var(--dsw-alias-state-warn-primary) 10%, transparent); overflow-wrap: anywhere; }\n.dt-banner.dt-danger { background: color-mix(in srgb, var(--dsw-alias-state-error-primary) 10%, transparent); color: var(--dsw-alias-state-error-primary); }\n.dt-list { list-style: none; margin: 0 -8px; padding: 0; display: flex; flex-direction: column; gap: 2px; }\n.dt-row { position: relative; min-width: 0; border-radius: 12px; padding: 10px 8px; display: flex; flex-wrap: wrap; gap: 4px 12px; align-items: flex-start; }\n.dt-row.dt-link:hover { background: var(--dsw-alias-interactive-bg-hover); }\n.dt-row-main { flex: 1 1 200px; min-width: 0; display: flex; flex-direction: column; gap: 4px; }\n.dt-disclosure-body .dt-row-main { flex-basis: 0; }\n.dt-row-title { display: flex; align-items: center; gap: 8px; min-width: 0; font-size: 14px; line-height: 20px; font-weight: 500; }\n.dt-open { max-width: 100%; padding: 0; border: 0; background: transparent; color: inherit; font: inherit; font-size: 14px; line-height: 20px; font-weight: 500; text-align: left; cursor: pointer; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }\n.dt-open::after { content: ''; position: absolute; inset: 0; border-radius: 12px; }\n.dt-open:focus-visible { outline: none; }\n.dt-open-wrap { white-space: normal; }\n.dt-open:focus-visible::after { outline: 2px solid var(--dsw-alias-brand-primary); outline-offset: 2px; }\n.dt-row-meta { display: flex; align-items: center; flex-wrap: wrap; gap: 4px 10px; font-size: 12px; line-height: 18px; color: var(--dsw-alias-label-caption); overflow-wrap: anywhere; }\n.dt-row-quote { font-size: 13px; line-height: 20px; color: var(--dsw-alias-label-secondary); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }\n.dt-clamp { display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }\n/* Transparent block borders preserve vertical spacing when line clamping clips padding. */\n.dt-banner:is(.dt-clamp, .dt-clamp-8) { padding-block: 0; border-block: 8px solid transparent; }\n.dt-banner-label { font-weight: 500; }\n.dt-banner .dt-md { display: inline; }\n.dt-banner .dt-md > p:first-child { display: inline; }\n.dt-row-buttons { position: relative; z-index: 1; gap: 8px; margin-top: 4px; }\n.dt-row-actions { position: relative; z-index: 1; display: flex; align-items: center; gap: 4px; flex: none; margin-left: auto; font-size: 13px; line-height: 20px; }\n.dt-dot { flex: none; margin-top: 5px; }\n.dt-inline-link { position: relative; z-index: 1; color: var(--dsw-alias-link); text-decoration: none; }\n.dt-inline-link:hover { text-decoration: underline; }\n.dt-textlink { padding: 0; border: 0; background: none; font: inherit; color: var(--dsw-alias-link); cursor: pointer; text-align: left; }\n.dt-textlink:hover { text-decoration: underline; }\n.dt-actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; font-size: 13px; line-height: 20px; }\n.dt-kv { display: grid; grid-template-columns: max-content 1fr; gap: 6px 16px; margin: 0; font-size: 13px; line-height: 20px; }\n.dt-kv dt { color: var(--dsw-alias-label-tertiary); }\n.dt-kv dd { margin: 0; min-width: 0; overflow-wrap: anywhere; }\n@container (max-width: 640px) { .dt-kv dt { margin-top: 4px; } .dt-kv dt:first-of-type { margin-top: 0; } }\n.dt-timeline-day { position: sticky; top: 0; z-index: 1; padding: 6px 0 2px; font-size: 12px; line-height: 18px; color: var(--dsw-alias-label-secondary); font-weight: 500; list-style: none; background: var(--dsw-alias-bg-base); }\n.dt-event-head { display: flex; align-items: baseline; gap: 8px; min-width: 0; }\n.dt-event-head .dt-event-time { margin-left: auto; flex: none; font-size: 12px; color: var(--dsw-alias-label-secondary); font-variant-numeric: tabular-nums; }\n.dt-event-nums { color: var(--dsw-alias-label-secondary); font-variant-numeric: tabular-nums; }\n.dt-timeline { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; }\n.dt-event { padding: 12px 0; border-bottom: 0.5px solid var(--dsw-alias-border-l2); display: flex; flex-direction: column; gap: 6px; min-width: 0; }\n.dt-event:last-child { border-bottom: 0; }\n.dt-event.dt-highlight { background: var(--dsw-alias-interactive-bg-hover); border-radius: 8px; padding-inline: 8px; margin-inline: -8px; }\n.dt-event-text { margin: 0; font-size: 13px; line-height: 20px; white-space: pre-wrap; overflow-wrap: anywhere; }\n.dt-event-actor { font-weight: 500; color: var(--dsw-alias-label-secondary); }\n.dt-event-quiet .dt-event-text { color: var(--dsw-alias-label-tertiary); }\n.dt-flow { margin: 0; font-size: 13px; line-height: 20px; color: var(--dsw-alias-label-secondary); }\n.dt-clamp-8 { display: -webkit-box; -webkit-line-clamp: 8; -webkit-box-orient: vertical; overflow: hidden; }\n.dt-more { align-self: flex-start; font-size: 12px; }\n.dt-reveal { opacity: 0; }\n.dt-event:hover .dt-reveal, .dt-reveal:focus-visible { opacity: 1; }\n@media (hover: none) {\n .dt-reveal { opacity: 1; }\n}\n.dt-event-foot { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; font-size: 12px; line-height: 18px; color: var(--dsw-alias-label-tertiary); }\n.dt-filters { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }\n.dt-filters .dt-search { margin-left: auto; }\n.dt-form { display: flex; flex-direction: column; gap: 24px; }\n.dt-fieldset { display: flex; flex-direction: column; gap: inherit; min-width: 0; margin: 0; padding: 0; border: 0; }\n.dt-field { display: flex; flex-direction: column; gap: 6px; font-size: 13px; line-height: 20px; min-width: 0; }\n.dt-field small { color: var(--dsw-alias-label-caption); font-size: 12px; }\n.dt-textarea { box-sizing: border-box; width: 100%; min-width: 0; border: 0.5px solid var(--dsw-alias-border-l3); border-radius: 10px; padding: 8px 12px; font: inherit; font-size: 13px; line-height: 20px; color: var(--dsw-alias-label-primary); background: var(--dsw-alias-bg-layer-1, transparent); resize: vertical; }\n.dt-select { box-sizing: border-box; width: 100%; min-width: 0; height: 32px; border: 0.5px solid var(--dsw-alias-border-l4); border-radius: 8px; padding: 0 28px 0 8px; text-overflow: ellipsis; font: inherit; font-size: 14px; line-height: 22px; color: var(--dsw-alias-label-primary); background: var(--dsw-alias-bg-layer-1, transparent); }\n.dt-textarea:focus-visible, .dt-select:focus-visible { outline: 2px solid var(--dsw-alias-brand-primary); outline-offset: 1px; }\n.dt-mono { font-family: var(--ds-font-family-code, Menlo, monospace); font-size: 12px; overflow-wrap: anywhere; }\n.dt-detail { margin-top: 2px; color: var(--dsw-alias-label-secondary); }\n.dt-savebar .dt-error { white-space: pre-line; }\n.dt-switch-row { display: flex; align-items: center; justify-content: space-between; gap: 16px; min-height: 36px; font-size: 13px; }\n.dt-subhead-actions { display: inline-flex; align-items: center; gap: 4px; }\n.dt-btn-busy .dt-btn-icon svg { animation: dt-spin 1s linear infinite; }\n.dt-subhead { display: flex; align-items: center; justify-content: space-between; gap: 8px; flex-wrap: wrap; font-size: 13px; line-height: 20px; color: var(--dsw-alias-label-secondary); }\n.dt-rules, .dt-changes { list-style: none; margin: 0; padding: 0; }\n.dt-field-head { display: inline-flex; align-items: center; gap: 4px; color: var(--dsw-alias-label-secondary); }\n.dt-info { display: inline-flex; align-items: center; justify-content: center; width: 16px; height: 16px; padding: 0; border: 0; background: none; color: var(--dsw-alias-label-caption); cursor: help; }\n.dt-info:hover, .dt-info:focus-visible { color: var(--dsw-alias-label-secondary); }\n.dt-info:focus-visible { outline: 2px solid var(--dsw-alias-brand-primary); outline-offset: 2px; border-radius: 50%; }\n.dt-tooltip { position: fixed; z-index: 1100; width: max-content; max-width: min(320px, calc(100vw - 24px)); padding: 3px 7px; border-radius: 8px; background: var(--dsw-alias-tooltip-bg); color: var(--dsw-static-neutral-bluish-00); font-size: 13px; line-height: 20px; overflow-wrap: break-word; pointer-events: none; animation: dt-tooltip-in 150ms ease-in-out; }\n@keyframes dt-tooltip-in { from { opacity: 0; } }\n.dt-rules { border-top: 0.5px solid var(--dsw-alias-border-l2); }\n.dt-rule { display: flex; align-items: flex-start; gap: 12px; padding: 6px 0; border-bottom: 0.5px solid var(--dsw-alias-border-l2); }\n.dt-rule > :first-child { flex: 1; min-width: 0; }\n.dt-rule-preview { flex: 1; min-width: 0; margin-left: 8px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 12px; color: var(--dsw-alias-label-caption); }\n.dt-rule-switch { margin-top: 2px; flex: none; }\n.dt-rule-dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--dsw-alias-label-caption); }\n.dt-rule-dot[data-enabled] { background: var(--dsw-alias-brand-primary); }\n.dt-rule-body { display: flex; flex-direction: column; gap: 12px; padding: 8px 0 8px 28px; }\n.dt-model { display: flex; flex-direction: column; gap: 6px; }\n.dt-grid3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }\n.dt-changes { display: flex; flex-direction: column; gap: 2px; font-size: 13px; line-height: 20px; }\n.dt-changes li::before { content: '· '; color: var(--dsw-alias-label-caption); }\n.dt-main { display: flex; flex-direction: column; gap: 24px; min-width: 0; }\n.dt-modal.dt-glossary-modal { width: min(680px, 100%); }\n.dt-nav-item { display: flex; align-items: center; justify-content: space-between; gap: 8px; width: 100%; min-height: 32px; padding: 6px 10px; border: 0; border-radius: 8px; background: transparent; color: var(--dsw-alias-label-secondary); font: inherit; font-size: 13px; line-height: 20px; text-align: left; cursor: pointer; }\n.dt-nav-item:hover { background: var(--dsw-alias-interactive-bg-hover); }\n.dt-nav-item[aria-current='true'] { background: var(--dsw-alias-interactive-bg-hover); color: var(--dsw-alias-label-primary); font-weight: 500; }\n.dt-nav-item:focus-visible { outline: 2px solid var(--dsw-alias-brand-primary); outline-offset: -2px; }\n.dt-changed-dot { width: 6px; height: 6px; border-radius: 50%; background: var(--dsw-alias-brand-primary); flex: none; }\n.dt-add-skill { display: flex; flex-direction: column; gap: 6px; margin-top: 8px; padding-top: 8px; border-top: 0.5px solid var(--dsw-alias-border-l2); }\n.dt-prompt-main { display: flex; flex-direction: column; gap: 12px; min-width: 0; }\n.dt-editor { min-height: 360px; }\n.dt-inline-select { width: auto; }\n.dt-preview-part { display: flex; flex-direction: column; gap: 6px; padding: 2px 0 2px 12px; border-left: 2px solid var(--dsw-alias-border-l3); }\n.dt-preview-head { font-size: 13px; line-height: 20px; display: flex; align-items: baseline; gap: 8px; }\ndiv.dt-preview-head { color: var(--dsw-alias-label-secondary); }\n.dt-card { display: flex; flex-direction: column; gap: 12px; padding: 16px; border: 0.5px solid var(--dsw-alias-border-l3); border-radius: 16px; min-width: 0; }\n.dt-card-head { display: flex; align-items: center; gap: 12px; min-height: 28px; }\n.dt-card-head .dt-row-main { flex: 1 1 0; min-width: 64px; }\n.dt-card-title { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }\n.dt-row-label { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 13px; font-weight: 500; }\n.dt-rows { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }\n.dt-rows-item { display: grid; grid-template-columns: repeat(var(--dt-columns), minmax(0, 1fr)) auto; gap: 8px; align-items: center; }\n.dt-filter-gap { flex: 1; }\n.dt-page-head { display: flex; flex-wrap: wrap; align-items: flex-start; justify-content: space-between; gap: 8px 16px; width: 100%; }\n.dt-page-head > div:first-child { display: flex; flex-direction: column; gap: 4px; min-width: 0; }\n.dt-page-head .dt-toolbar { flex: 0 1 auto; margin-left: auto; }\n.dt-page-head > .dt-btn { margin-left: -10px; }\n.dt-page-title { display: flex; align-items: center; gap: 8px 16px; flex-wrap: wrap; width: 100%; }\n.dt-page-title h2 { margin: 0; flex: 1 1 auto; min-width: 0; font-size: 20px; line-height: 28px; font-weight: 500; overflow-wrap: anywhere; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }\n.dt-status-line { margin-top: -16px; }\n.dt-plain-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; font-size: 13px; line-height: 20px; }\n.dt-plain-list > li { position: relative; padding-left: 12px; }\n.dt-plain-list > li::before { content: ''; position: absolute; left: 0; top: 5px; bottom: 5px; width: 2px; border-radius: 1px; background: currentColor; opacity: 0.45; }\n.dt-details { display: flex; flex-direction: column; gap: 2px; border-top: 0.5px solid var(--dsw-alias-border-l2); padding-top: 8px; }\n.dt-danger-zone { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; padding-top: 16px; border-top: 0.5px solid var(--dsw-alias-border-l2); }\n.dt-danger-zone .dt-btn { color: var(--dsw-alias-state-error-primary); }\n.dt-md { display: flex; flex-direction: column; gap: 6px; font-size: 13px; line-height: 20px; overflow-wrap: anywhere; }\n.dt-md p, .dt-md ul, .dt-md ol { margin: 0; }\n.dt-md ul, .dt-md ol { padding-left: 20px; display: flex; flex-direction: column; gap: 2px; }\n.dt-md-heading { font-weight: 500; }\n.dt-code { font-family: var(--ds-font-family-code, Menlo, monospace); font-size: 12px; padding: 0 4px; border-radius: 4px; background: var(--dsw-alias-bg-module-platform); }\n.dt-dot-wrap { display: inline-flex; flex: none; }\n.dt-search-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; }\n.dt-ellipsis { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 280px; }\n.dt-legend-title { margin: 16px 0 6px; font-size: 13px; color: var(--dsw-alias-label-tertiary); }\n.dt-legend { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 6px 16px; font-size: 13px; }\n.dt-legend li { display: flex; align-items: center; gap: 6px; }\n.dt-legend .dt-dot { margin-top: 0; }\n.dt-savebar { position: sticky; bottom: 0; z-index: 2; display: flex; align-items: center; justify-content: flex-end; gap: 8px; flex-wrap: wrap; padding: 12px 0; background: var(--dsw-alias-bg-base, var(--dsw-alias-bg-layer-1)); border-top: 0.5px solid var(--dsw-alias-border-l2); }\n.dt-savebar .dt-hint { margin-right: auto; }\n.dt-card > .dt-savebar, .dt-block > .dt-savebar { margin: 0 -16px -16px; padding: 12px 16px; border-radius: 0 0 16px 16px; }\n.dt-glossary { width: 100%; border-collapse: collapse; font-size: 13px; line-height: 20px; }\n.dt-glossary th, .dt-glossary td { text-align: left; padding: 6px 8px; border-bottom: 0.5px solid var(--dsw-alias-border-l2); vertical-align: top; }\n.dt-glossary th { color: var(--dsw-alias-label-tertiary); font-weight: 400; }\n.dt-glossary th.dt-glossary-group { color: var(--dsw-alias-label-secondary); font-weight: 600; padding-top: 14px; }\n.dt-glossary th:nth-child(-n+2), .dt-glossary td:nth-child(-n+2) { white-space: nowrap; }\n.dt-values { display: grid; grid-template-columns: max-content 1fr; gap: 6px 16px; margin: 16px 0 0; font-size: 13px; }\n.dt-values dt { color: var(--dsw-alias-label-tertiary); }\n.dt-values dd { margin: 0; }\n.dt-pre { margin: 0; padding: 12px; border-radius: 10px; background: var(--dsw-alias-bg-module-platform); font-family: var(--ds-font-family-code, Menlo, monospace); font-size: 12px; line-height: 18px; white-space: pre-wrap; overflow-wrap: anywhere; max-height: 480px; overflow: auto; }\n.dt-pre ins { background: color-mix(in srgb, var(--dsw-alias-state-success-primary, green) 18%, transparent); text-decoration: none; }\n.dt-pre del { background: color-mix(in srgb, var(--dsw-alias-state-error-primary) 18%, transparent); text-decoration: none; }\n.dt-prompt { display: grid; grid-template-columns: 200px minmax(0, 1fr); gap: 20px; align-items: start; }\n.dt-prompt-nav { display: flex; flex-direction: column; gap: 2px; }\n.dt-prompt-nav button { justify-content: flex-start; }\n.dt-disclosure-body { padding: 8px 0 8px 28px; display: flex; flex-direction: column; gap: 8px; }\n@container (max-width: 640px) {\n .dt-tab { padding: 0 8px; font-size: 13px; }\n .dt-segment { padding: 0 10px; }\n .dt-head { align-items: center; }\n .dt-search-results { right: auto; left: 0; width: 100%; }\n .dt-page-title h2 { font-size: 17px; line-height: 24px; }\n .dt-status-line { margin-top: -12px; }\n .dt-page .dt-tabs { display: flex; flex-wrap: nowrap; scrollbar-width: thin; }\n .dt-page .dt-tab { flex: none; }\n .dt-page .dt-tabs[data-more='end'] { mask-image: linear-gradient(to right, #000 calc(100% - 40px), transparent); }\n .dt-page .dt-tabs[data-more='start'] { mask-image: linear-gradient(to right, transparent, #000 40px); }\n .dt-page .dt-tabs[data-more='both'] { mask-image: linear-gradient(to right, transparent, #000 40px, #000 calc(100% - 40px), transparent); }\n .dt-kv { grid-template-columns: 1fr; gap: 6px; }\n .dt-grid3, .dt-prompt { grid-template-columns: 1fr; }\n .dt-search { width: 100%; }\n .dt-filters .dt-search { margin-left: 0; }\n}\n/* Local UI primitive styles (see controls.tsx). */\n.dt-btn { display: inline-flex; align-items: center; justify-content: center; gap: 4px; border: none; border-radius: 18px; cursor: pointer; font: inherit; font-size: 14px; line-height: 22px; color: var(--dsw-alias-label-primary); background: transparent; padding: 0 14px; white-space: nowrap; }\n.dt-btn:disabled { cursor: not-allowed; opacity: 0.4; }\n.dt-btn:focus-visible { outline: 2px solid var(--dsw-alias-brand-primary); outline-offset: 2px; }\n.dt-btn-md { height: 36px; }\n.dt-btn-sm { height: 28px; font-size: 12px; line-height: 18px; padding: 0 10px; border-radius: 14px; }\n/* 主按钮:深色下 label-primary-foreground(深色)压绿底只有 4.09 —— 深色主题里前景该是浅的。 */\n/* 往白色混 70%:浅色下仍是浅字(4.5+),深色下变浅(>4.5),两边都过。 */\n.dt-btn-primary { background: var(--dsw-alias-button-primary-fill); color: var(--dsw-static-neutral-bluish-00); }\n.dt-btn-primary:hover:not(:disabled) { background: var(--dsw-alias-button-primary-hover); }\n.dt-btn-ghost { background: transparent; border: 0.5px solid var(--dsw-alias-border-l3); color: var(--dsw-alias-label-secondary); }\n.dt-btn-ghost:hover:not(:disabled), .dt-btn-outline:hover:not(:disabled) { background: var(--dsw-alias-interactive-bg-hover); }\n.dt-btn-ghost:active:not(:disabled) { background: var(--dsw-alias-interactive-bg-active); }\n.dt-btn-outline { border: 0.5px solid var(--dsw-alias-border-l3); }\n.dt-btn-icon { display: inline-flex; width: 16px; height: 16px; align-items: center; justify-content: center; }\n.dt-tag { display: inline-flex; align-items: center; border-radius: 999px; padding: 1px 8px; font-size: 11px; line-height: 17px; font-weight: 500; white-space: nowrap; }\n.dt-tag[data-tone='outline'] { border: 0.5px solid var(--dsw-alias-border-l4); color: var(--dsw-alias-label-tertiary); }\n.dt-tag[data-tone='neutral'] { background: var(--dsw-alias-bg-module-platform); color: var(--dsw-alias-label-secondary); }\n.dt-tag[data-tone='quiet'] { color: var(--dsw-alias-label-tertiary); }\n.dt-tag[data-tone='success'] { background: color-mix(in srgb, var(--dsw-alias-state-success-primary) 10%, transparent); color: color-mix(in srgb, var(--dsw-alias-state-success-primary) 72%, var(--dsw-alias-label-primary)); }\n.dt-tag[data-tone='info'] { background: color-mix(in srgb, var(--dsw-alias-state-business-primary) 10%, transparent); color: var(--dsw-alias-state-business-primary); }\n/* 胶囊是「暂停/退避/判断」唯一的状态色:文字与 12% 同色底叠起来,浅色下警告只有 4.17。 */\n/* 往 label-primary 混 28%:浅色变深、深色变浅,两档都留出余量。 */\n.dt-tag[data-tone='warning'] { background: color-mix(in srgb, var(--dsw-alias-state-warn-primary) 12%, transparent); color: color-mix(in srgb, var(--dsw-alias-state-warn-primary) 72%, var(--dsw-alias-label-primary)); }\n.dt-tag[data-tone='danger'] { background: color-mix(in srgb, var(--dsw-alias-state-error-primary) 10%, transparent); color: color-mix(in srgb, var(--dsw-alias-state-error-primary) 76%, var(--dsw-alias-label-primary)); }\n.dt-pill { display: inline-flex; align-items: center; gap: 4px; height: 24px; padding: 0 8px; border: none; border-radius: 12px; font: inherit; font-size: 12px; line-height: 18px; color: var(--dsw-alias-label-secondary); background: var(--dsw-alias-bg-layer-2); cursor: pointer; }\n.dt-pill:hover { background: var(--dsw-alias-interactive-bg-hover); }\n.dt-pill-active, .dt-pill-active:hover { color: var(--dsw-alias-label-primary); background: var(--dsw-alias-button-ghost-active-fill); box-shadow: inset 0 0 0 1px var(--dsw-alias-button-ghost-active-border); }\n.dt-tabs { display: grid; padding: 4px; border-radius: 12px; background: var(--dsw-alias-bg-module-platform); }\n.dt-tab { box-sizing: border-box; height: 34px; padding: 0 12px; border: 0.5px solid transparent; border-radius: 8px; background: transparent; color: var(--dsw-alias-label-secondary); font: inherit; font-size: 14px; line-height: 20px; white-space: nowrap; cursor: pointer; transition: color 180ms ease, background 180ms ease; }\n.dt-tab:hover { color: var(--dsw-alias-label-primary); }\n.dt-tab[aria-selected='true'] { color: var(--dsw-alias-label-primary); font-weight: 600; background: var(--dsw-alias-bg-layer-3); border-color: var(--dsw-alias-border-l3); }\n.dt-tab:focus-visible { outline: none; text-decoration: underline; text-underline-offset: 4px; }\n.dt-segment { height: 28px; padding: 0 16px; border: 0; border-radius: 7px; background: transparent; color: var(--dsw-alias-label-secondary); font: inherit; font-size: 13px; line-height: 20px; font-weight: 500; white-space: nowrap; cursor: pointer; transition: color 120ms ease, background 160ms ease; }\n.dt-segment:hover:not(:disabled), .dt-segment[aria-selected='true'] { color: var(--dsw-alias-label-primary); }\n.dt-segment[aria-selected='true'] { background: var(--dsw-alias-bg-layer-1); box-shadow: var(--dsw-elevation-soft); }\n.dt-segment:disabled { cursor: default; opacity: 0.4; }\n.dt-segment:focus-visible { outline: 2px solid var(--dsw-alias-brand-primary); outline-offset: -2px; }\n.dt-input { box-sizing: border-box; display: inline-flex; align-items: center; gap: 6px; height: 32px; min-width: 0; padding: 0 8px; border: 0.5px solid var(--dsw-alias-border-l4); border-radius: 8px; background: var(--dsw-alias-bg-layer-1); }\n.dt-input:focus-within { border-color: var(--dsw-alias-brand-primary); }\n.dt-input-icon { display: inline-flex; width: 16px; height: 16px; align-items: center; justify-content: center; color: var(--dsw-alias-label-tertiary); }\n.dt-input input { flex: 1; min-width: 0; border: none; outline: none; background: transparent; font: inherit; font-size: 14px; line-height: 22px; color: var(--dsw-alias-label-primary); }\n.dt-input input/* 占位符:label-dimmed 在浅色下只有 2.17(深色 3.81),必须能读出来才叫占位符。 */\n/* 往 label-tertiary 混 60%:浅色变深、深色变浅,两档都过 4.5。 */\n::placeholder { color: color-mix(in srgb, var(--dsw-alias-label-dimmed) 40%, var(--dsw-alias-label-tertiary)); }\n.dt-input input::-webkit-search-cancel-button { -webkit-appearance: none; appearance: none; }\n.dt-field .dt-input, .dt-search .dt-input, .dt-add-skill .dt-input { display: flex; width: 100%; }\n.dt-switch { box-sizing: border-box; flex: 0 0 auto; width: 36px; height: 20px; padding: 2px; border: 0; border-radius: 10px; background: var(--dsw-alias-border-l3); cursor: pointer; }\n.dt-switch[aria-checked='true'] { background: var(--dsw-alias-brand-primary); }\n.dt-switch:focus-visible { outline: 2px solid var(--dsw-alias-brand-primary); outline-offset: 2px; }\n.dt-switch-thumb { display: block; width: 16px; height: 16px; border-radius: 50%; background: var(--dsw-alias-label-primary-foreground); transition: transform 120ms ease; }\n.dt-switch[aria-checked='true'] .dt-switch-thumb { transform: translateX(16px); }\n.dt-state-dot { position: relative; display: inline-block; flex: none; width: 10px; height: 10px; color: var(--dsw-alias-state-idle-primary); }\n.dt-state-dot::after { content: ''; position: absolute; inset: 20%; border-radius: 50%; background: currentColor; }\n.dt-state-dot[data-state='done'] { color: var(--dsw-alias-state-success-primary); }\n.dt-state-dot[data-state='warning'] { color: var(--dsw-alias-state-warn-primary); }\n.dt-state-dot[data-state='error'] { color: var(--dsw-alias-state-error-primary); }\n.dt-spinner { flex: none; color: var(--dsw-alias-label-tertiary); }\n.dt-spinner g { transform-origin: center; animation: dt-spin 1.5s linear infinite; }\n.dt-spinner circle { fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; }\n.dt-spinner circle:first-child { opacity: 0.25; }\n.dt-spinner circle:last-child { stroke-dasharray: 18 150; }\n@keyframes dt-spin { to { transform: rotate(360deg); } }\n.dt-disclosure-row { display: flex; align-items: center; gap: 4px; min-height: 28px; min-width: 0; border-radius: 8px; cursor: pointer; font-size: 13px; line-height: 20px; color: var(--dsw-alias-label-secondary); }\n.dt-disclosure-row:hover { color: var(--dsw-alias-label-primary); }\n.dt-disclosure-row:focus-visible { outline: 2px solid var(--dsw-alias-brand-primary); outline-offset: 2px; }\n.dt-disclosure-lead { position: relative; display: inline-flex; flex: none; width: 24px; height: 24px; align-items: center; justify-content: center; }\n.dt-disclosure-icon { display: inline-flex; align-items: center; justify-content: center; }\n.dt-disclosure-chevron { position: absolute; inset: 0; display: none; align-items: center; justify-content: center; }\n.dt-disclosure-row:hover .dt-disclosure-icon, .dt-disclosure[data-open] .dt-disclosure-icon { visibility: hidden; }\n.dt-disclosure-row:hover .dt-disclosure-chevron, .dt-disclosure[data-open] .dt-disclosure-chevron { display: inline-flex; }\n.dt-disclosure-title { flex: 0 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }\n.dt-modal-root { position: fixed; inset: 0; z-index: 1000; display: flex; align-items: center; justify-content: center; padding: max(24px, var(--dsh-frame-top-clearance, 24px)) 24px; }\n.dt-modal-mask { position: absolute; inset: 0; background: var(--dsw-alias-bg-mask-1); backdrop-filter: var(--dsw-mask-blur); }\n.dt-modal { position: relative; z-index: 1; display: flex; flex-direction: column; gap: 20px; width: min(380px, 100%); max-height: 100%; padding: 0 0 24px; overflow: hidden; border-radius: 24px; background: var(--dsw-alias-bg-layer-2); box-shadow: var(--dsw-elevation-prominent); color: var(--dsw-alias-label-primary); outline: none; }\n.dt-modal-header { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 22px 14px 0 24px; }\n.dt-modal-header h2 { margin: 0; font-size: 16px; line-height: 24px; font-weight: 500; }\n.dt-modal-close { display: inline-flex; align-items: center; justify-content: center; width: 28px; height: 28px; border: none; border-radius: 8px; background: transparent; cursor: pointer; color: var(--dsw-alias-label-secondary); }\n.dt-modal-close:hover { background: var(--dsw-alias-interactive-bg-hover); }\n.dt-modal-description { margin: -8px 0 0; padding: 0 24px; font-size: 14px; line-height: 22px; }\n.dt-modal-body { min-width: 0; min-height: 0; overflow: auto; padding: 0 24px; }\n.dt-modal-footer { display: flex; align-items: center; justify-content: flex-end; gap: 8px; padding: 0 24px; }\n.dt-toast { position: fixed; top: 40px; left: 50%; z-index: 1100; pointer-events: none; width: max-content; max-width: min(640px, calc(100vw - 48px)); padding: 12px 16px; border-radius: 14px; background: var(--dsw-alias-toast-bg); color: var(--dsw-static-neutral-bluish-00); font-size: 14px; line-height: 22px; box-shadow: var(--dsw-shadow-lv3); transform: translateX(-50%); animation: dt-toast-in 160ms ease-out, dt-toast-fade 1000ms ease var(--dt-toast-hold, 3000ms) forwards; }\n@keyframes dt-toast-in { from { opacity: 0; transform: translate(-50%, -6px); } to { opacity: 1; transform: translate(-50%, 0); } }\n@keyframes dt-toast-fade { to { opacity: 0; visibility: hidden; } }\n@media (prefers-reduced-motion: reduce) {\n .dt-tab, .dt-segment, .dt-switch-thumb, .dt-spinner g, .dt-btn-busy .dt-btn-icon svg, .dt-tooltip { transition: none; animation: none; }\n .dt-toast { animation: dt-toast-fade 1000ms ease var(--dt-toast-hold, 3000ms) forwards; }\n}\n.dt-page .dt-tab { height: 34px; padding: 0 2px; border: 0; border-radius: 0; color: var(--dsw-alias-label-tertiary); font-size: 14px; }\n.dt-page .dt-tab[aria-selected='true'] { background: none; color: var(--dsw-alias-label-primary); font-weight: 500; box-shadow: inset 0 -1.5px 0 var(--dsw-alias-label-primary); }\n.dt-status-head { display: flex; align-items: center; gap: 8px; }\n.dt-status-title { margin: 0; flex: 1; display: flex; align-items: center; gap: 4px; font-size: 15px; line-height: 22px; font-weight: 600; }\n.dt-status-text { margin-left: auto; flex: none; font-size: 12px; font-weight: 400; color: var(--dsw-alias-label-secondary); }\n.dt-status-line .dt-status-text { margin-left: 0; }\n.dt-status-text[data-state='warning'] { color: var(--dsw-alias-state-warn-primary); }\n.dt-status-text[data-state='error'] { color: var(--dsw-alias-state-error-primary); }\n.dt-row-name { min-width: 0; overflow: hidden; text-overflow: ellipsis; }\n.dt-lv { white-space: nowrap; }\n.dt-lv-label { color: var(--dsw-alias-label-caption); }\n.dt-lv-value { color: var(--dsw-alias-label-secondary); font-variant-numeric: tabular-nums; }\n.dt-chip { display: inline-flex; flex-wrap: wrap; max-width: 100%; border: 0.5px solid var(--dsw-alias-border-l3); border-radius: 6px; overflow: hidden; font-size: 11px; line-height: 18px; color: var(--dsw-alias-label-secondary); }\n.dt-chip-source { padding: 0 6px; color: var(--dsw-alias-label-tertiary); background: var(--dsw-alias-bg-module-platform); }\n.dt-chip-fact { padding: 0 6px; border-left: 0.5px solid var(--dsw-alias-border-l3); white-space: nowrap; }\n.dt-chip-label { margin-right: 4px; color: var(--dsw-alias-label-caption); }\n.dt-chip-link { position: relative; z-index: 1; text-decoration: none; cursor: pointer; transition: border-color 120ms ease; }\n.dt-chip-link:hover { border-color: var(--dsw-alias-brand-primary); }\n.dt-chip-link:focus-visible { outline: 2px solid var(--dsw-alias-brand-primary); outline-offset: 1px; }\n.dt-chip-open { display: inline-flex; align-items: center; padding: 0 5px; border-left: 0.5px solid var(--dsw-alias-border-l3); color: var(--dsw-alias-brand-primary); }\n.dt-chip-problem, .dt-chip-problem .dt-chip-label { color: var(--dsw-alias-state-error-primary); }\n.dt-cards { gap: 8px; }\n.dt-att .dt-inline-link { font-size: 13px; font-weight: 500; }\n.dt-list > .dt-att { margin: 2px 8px; }\n.dt-att { padding: 10px 12px 10px 16px; border: 0; border-radius: 0; border-bottom: 0.5px solid var(--dsw-alias-border-l3); }\n.dt-att::before { content: ''; position: absolute; left: 6px; top: 10px; bottom: 10px; width: 2px; border-radius: 1px; background: var(--dsw-alias-state-warn-primary); opacity: 0.7; }\n.dt-att-error::before { background: var(--dsw-alias-state-error-primary); }\n.dt-att-what { font-size: 12px; line-height: 18px; font-weight: 500; color: var(--dsw-alias-state-warn-primary); }\n.dt-att-error .dt-att-what, .dt-att-error .dt-att-what .dt-open { color: var(--dsw-alias-state-error-primary); }\n.dt-stats { display: flex; flex-wrap: wrap; gap: 6px 24px; padding: 10px 14px; border: 0.5px solid var(--dsw-alias-border-l3); border-radius: 12px; background: var(--dsw-alias-bg-module-platform); }\n.dt-stat { display: inline-flex; align-items: baseline; gap: 6px; font-size: 12px; color: var(--dsw-alias-label-caption); }\n/* 可点的统计数字:去掉原生按钮外观,保留文字排版;选中时用浅底提示 */\n.dt-stat-btn { border: 0; background: none; padding: 2px 6px; margin: -2px -6px; border-radius: 8px; font: inherit; color: inherit; cursor: pointer; }\n.dt-stat-btn:hover { background: var(--dsw-alias-interactive-bg-hover); }\n/* 浅色下 interactive-bg-hover 与白底只差 1.03:点了统计数字在按筛选,零视觉反馈。 */\n/* 换成品牌色 12% 底 + 0.5px 品牌色描边(两个主题都分得开)。 */\n.dt-stat-btn[aria-pressed='true'] { background: color-mix(in srgb, var(--dsw-alias-brand-primary) 12%, transparent); box-shadow: inset 0 0 0 0.5px var(--dsw-alias-brand-primary); }\n.dt-stat-btn:focus-visible { outline: 2px solid var(--dsw-alias-brand-primary); outline-offset: 1px; }\n/* 统计条单位:按钮上的 color:inherit 会把单位染成数字色,所以单位单独一档。 */\n/* 浅色下 caption(#818b98)在白底只有 3.14–3.45,深色下同一档 4.34–5.07。 */\n/* 往 label-primary 混 30%:浅色变深、深色变浅,两个主题的对比度同时变好(不用新 token)。 */\n/* 注意选择器**不带** .dt-stat-btn 前缀 —— 带前缀就只作用于可点的格子,不可点的仍是旧色(真机踩过)。 */\n.dt-stat-unit { color: color-mix(in srgb, var(--dsw-alias-label-caption) 70%, var(--dsw-alias-label-primary)); }\n/* 选中的统计格:品牌色 12% 底会把单位压到 4.20,再往主色多混 10% 拉回来。 */\n.dt-stat-btn[aria-pressed='true'] .dt-stat-unit { color: color-mix(in srgb, var(--dsw-alias-label-caption) 58%, var(--dsw-alias-label-primary)); }\n.dt-stat-value { font-size: 14px; font-weight: 500; color: var(--dsw-alias-label-primary); font-variant-numeric: tabular-nums; }\n.dt-more-link { font-size: 12px; font-weight: 400; }\n.dt-settings { display: grid; grid-template-columns: 140px minmax(0, 1fr); gap: 24px; align-items: start; }\n.dt-settings-nav { position: sticky; top: 0; display: flex; flex-direction: column; gap: 2px; }\n.dt-settings-link { padding: 6px 10px; border: 0; border-radius: 8px; background: none; color: var(--dsw-alias-label-secondary); font: inherit; font-size: 13px; line-height: 20px; text-align: left; cursor: pointer; }\n.dt-settings-link:hover { color: var(--dsw-alias-label-primary); }\n.dt-settings-link[aria-current='page'] { background: var(--dsw-alias-bg-module-platform); color: var(--dsw-alias-label-primary); font-weight: 500; }\n.dt-settings-link[data-stage] + .dt-settings-link:not([data-stage]) { margin-top: 10px; }\n.dt-settings-body { display: flex; flex-direction: column; gap: 16px; min-width: 0; padding: 16px; border: 0.5px solid var(--dsw-alias-border-l3); border-radius: 16px; background: var(--dsw-alias-bg-layer-1); }\n.dt-settings-title { margin: 0; font-size: 15px; line-height: 22px; font-weight: 600; }\n.dt-settings-body .dt-section-title { font-size: 15px; line-height: 22px; }\n.dt-subtabs { display: flex; gap: 16px; border-bottom: 0.5px solid var(--dsw-alias-border-l3); }\n.dt-subtab { padding: 0 0 6px; border: 0; background: none; color: var(--dsw-alias-label-tertiary); font: inherit; font-size: 13px; cursor: pointer; }\n.dt-subtab[aria-selected='true'] { color: var(--dsw-alias-label-primary); font-weight: 500; box-shadow: inset 0 -1.5px 0 var(--dsw-alias-label-primary); }\n.dt-part { display: flex; flex-direction: column; gap: 12px; }\n.dt-rows-summary { text-align: left; color: var(--dsw-alias-label-secondary); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 100%; }\n.dt-table { width: 100%; border-collapse: collapse; font-size: 12px; line-height: 18px; }\n.dt-table th { text-align: left; font-weight: 400; color: var(--dsw-alias-label-caption); padding: 2px 8px 2px 0; }\n.dt-table td { padding: 4px 8px 4px 0; border-top: 0.5px solid var(--dsw-alias-border-l3); vertical-align: top; color: var(--dsw-alias-label-secondary); overflow-wrap: anywhere; }\n@container (max-width: 640px) {\n .dt-settings { grid-template-columns: 1fr; gap: 12px; }\n .dt-settings-nav { position: static; flex-direction: row; flex-wrap: wrap; }\n .dt-settings-link[data-stage] + .dt-settings-link:not([data-stage]) { margin-top: 0; }\n .dt-page .dt-tabs { gap: 14px; }\n}\n.dt-list > .dt-ticket { display: grid; grid-template-columns: 112px minmax(0, 1fr); column-gap: 12px; align-items: start; margin: 0; padding: 12px 8px 12px 18px; border-radius: 0; border-bottom: 0.5px solid var(--dsw-alias-border-l3); }\n.dt-list > .dt-ticket[data-state]::before { content: ''; position: absolute; left: 6px; top: 12px; bottom: 12px; width: 2px; border-radius: 1px; background: var(--dsw-alias-state-warn-primary); opacity: 0.7; }\n.dt-list > .dt-ticket[data-state='error']::before { background: var(--dsw-alias-state-error-primary); }\n.dt-ticket-stage { align-self: stretch; padding-top: 1px; border-right: 0.5px solid var(--dsw-alias-border-l3); }\n.dt-ticket-body { display: flex; flex-direction: column; gap: 4px; min-width: 0; }\n.dt-ticket-body .dt-row-title .dt-open { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }\n.dt-ticket-meta { flex-wrap: nowrap; overflow: hidden; white-space: nowrap; }\n.dt-ticket-meta .dt-chip { flex: none; }\n.dt-ticket-meta .dt-ticket-actions { margin-top: 0; margin-left: auto; min-height: 0; flex-wrap: nowrap; }\n@container (max-width: 640px) { .dt-ticket-meta { flex-wrap: wrap; white-space: normal; } .dt-ticket-meta .dt-ticket-actions { flex-wrap: wrap; } }\n.dt-ticket-note { min-width: 0; overflow: hidden; text-overflow: ellipsis; color: var(--dsw-alias-label-primary); }\n.dt-ticket-note-error { color: var(--dsw-alias-state-error-primary); }\n.dt-ticket-note-pause { font-weight: 500; color: var(--dsw-alias-state-warn-primary); }\n.dt-ticket-actions { position: relative; z-index: 1; display: flex; flex-wrap: wrap; gap: 8px; min-height: 30px; margin-top: 2px; }\n/* Pass pointer events through action containers to the row link, keeping only child controls interactive. */\n.dt-ticket-actions, .dt-row-buttons, .dt-row-actions { pointer-events: none; }\n.dt-ticket-actions > *, .dt-row-buttons > *, .dt-row-actions > * { pointer-events: auto; }\n.dt-line { min-height: 20px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }\n.dt-row-meta.dt-line { flex-wrap: nowrap; }\n.dt-line-text { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--dsw-alias-label-secondary); }\n.dt-error-text { color: var(--dsw-alias-state-error-primary); }\n.dt-stage { display: inline-flex; align-items: flex-start; gap: 5px; font-size: 12px; line-height: 18px; font-weight: 500; color: var(--dsw-alias-label-secondary); }\n.dt-stage svg { flex: none; margin-top: 2px; }\n.dt-stage[data-state='warning'] { color: var(--dsw-alias-state-warn-primary); }\n.dt-stage[data-state='error'] { color: var(--dsw-alias-state-error-primary); }\n.dt-stage[data-state='ongoing'] { color: var(--dsw-alias-state-business-primary); }\n.dt-icon-link { display: inline-flex; align-items: center; gap: 4px; }\na.dt-btn, a.dt-btn:hover { text-decoration: none; }\n.dt-section-icon { display: inline-flex; align-self: center; color: var(--dsw-alias-label-tertiary); }\n.dt-trigger-link { display: flex; flex-direction: column; gap: 2px; width: 100%; margin: -4px 0 -4px -8px; padding: 4px 8px; border: 0; border-radius: 8px; background: none; font: inherit; color: inherit; text-align: left; cursor: pointer; }\n.dt-trigger-link:hover { background: var(--dsw-alias-interactive-bg-hover); }\n.dt-trigger-link:focus-visible { outline: 2px solid var(--dsw-alias-brand-primary); outline-offset: 1px; }\n.dt-trigger-text { display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }\n.dt-kv-stack { display: flex; flex-direction: column; gap: 2px; min-width: 0; }\n.dt-banner-actions { margin-top: 6px; }\n@container (max-width: 640px) {\n .dt-list > .dt-ticket { grid-template-columns: 1fr; row-gap: 4px; }\n .dt-ticket-stage { border-right: 0; }\n}\n.dt-nav-group { margin: 10px 10px 2px; font-size: 12px; font-weight: 600; color: var(--dsw-alias-label-secondary); }\n.dt-nav-group:first-child { margin-top: 0; }\n.dt-prompt-nav .dt-nav-item { flex-direction: column; align-items: flex-start; gap: 2px; text-align: left; }\n.dt-nav-item > span { display: inline-flex; align-items: center; gap: 6px; }\n.dt-nav-item small { font-size: 12px; line-height: 18px; font-weight: 400; color: var(--dsw-alias-label-caption); }\n.dt-preview-part[data-editable] { border-left-color: var(--dsw-alias-brand-primary); }\n.dt-preview-head b { font-weight: 500; }\n.dt-preview-head > span { font-size: 12px; color: var(--dsw-alias-label-caption); }\n.dt-changed-tag { margin-left: 6px; padding: 0 5px; border: 0.5px solid var(--dsw-alias-border-l3); border-radius: 4px; font-size: 11px; line-height: 16px; font-weight: 400; color: var(--dsw-alias-label-secondary); }\n.dt-updated-tag { border-color: var(--dsw-alias-state-warn-primary); color: var(--dsw-alias-state-warn-primary); }\n.dt-default-updated { display: flex; flex-direction: column; gap: 6px; padding: 2px 0 2px 12px; border-left: 2px solid var(--dsw-alias-state-warn-primary); }\n.dt-diff-fold { color: var(--dsw-alias-label-caption); font-style: italic; }\n.dt-compare { margin-left: auto; }\n.dt-admission th { white-space: nowrap; }\n.dt-admission thead tr:first-child th:not(:first-child) { color: var(--dsw-alias-label-secondary); font-weight: 500; }\n.dt-admission td { vertical-align: middle; }\n.dt-admission-scope { color: var(--dsw-alias-label-primary); font-size: 13px; }\n.dt-admission-scope small { display: block; font-size: 11px; color: var(--dsw-alias-label-caption); }\n.dt-admission-na { color: var(--dsw-alias-label-caption); }\n.dt-admission-cell { display: flex; align-items: center; gap: 4px; }\n.dt-admission-cell .dt-select { flex: 1; min-width: 0; }\n.dt-admission-slot { display: inline-flex; flex: none; width: 16px; }\n.dt-info-warn { color: var(--dsw-alias-state-warn-primary); }\n.dt-field-segmented { max-width: 240px; }\n/* 活跃时段:两个原生 time 选择器 + 全天按钮 */\n/* 表单控件不必满宽:短数字撑到 900px 只会显得空 */\n.dt-form > .dt-field > .dt-input { max-width: 480px; }\n.dt-error-card { border-color: color-mix(in srgb, var(--dsw-alias-state-error-primary) 35%, var(--dsw-alias-border-l3)); }\n.dt-error-card .dt-card-title { color: var(--dsw-alias-state-error-primary); }\n/* 空态引导:圆形步骤号 + 标题 + 说明,替代「① + 列表符号」的重复 */\n.dt-steps { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 12px; counter-reset: none; }\n.dt-step { display: flex; align-items: flex-start; gap: 10px; min-width: 0; }\n.dt-step-num { flex: none; display: inline-flex; align-items: center; justify-content: center; width: 20px; height: 20px; border-radius: 50%; background: var(--dsw-alias-bg-module-platform); color: var(--dsw-alias-label-secondary); font-size: 12px; line-height: 1; font-variant-numeric: tabular-nums; }\n.dt-step-body { display: flex; flex-direction: column; gap: 2px; min-width: 0; }\n.dt-step-title { font-size: 13px; line-height: 20px; font-weight: 500; color: var(--dsw-alias-label-primary); }\n.dt-empty { display: flex; flex-direction: column; gap: 6px; padding: 16px; border: 0.5px solid var(--dsw-alias-border-l3); border-radius: 12px; }\n.dt-step-detail { font-size: 12px; line-height: 18px; color: var(--dsw-alias-label-tertiary); }\n.dt-hours { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }\n.dt-time { box-sizing: border-box; height: 32px; padding: 0 8px; border: 0.5px solid var(--dsw-alias-border-l4); border-radius: 8px; background: var(--dsw-alias-bg-layer-1); color: var(--dsw-alias-label-primary); font: inherit; font-size: 13px; font-variant-numeric: tabular-nums; }\n.dt-time:focus-visible { outline: 2px solid var(--dsw-alias-brand-primary); outline-offset: 1px; }\n.dt-hours-sep { color: var(--dsw-alias-label-tertiary); }\n.dt-hours-hint { font-size: 12px; color: var(--dsw-alias-label-caption); }\n/* 分诊信号表(设置 → 诊断):左列「名字 + 两个标签」成组,右列 `+N 分` 定宽贴右、数字等宽。只挂局部类,全局 .dt-row-title 一行没动 —— 别的列表还在用它。 */\n.dt-signal-title { display: grid; grid-template-columns: minmax(0, 1fr) 4.5em; align-items: baseline; column-gap: 12px; }\n.dt-signal-lead { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 8px; min-width: 0; }\n.dt-signal-meta { display: block; justify-self: stretch; text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }\n/* 同一个维度(默认开/关)的两档要等权:`默认关` 原本是 49×19 的裸字,`默认开` 是 51×21 的描边胶囊。 */\n.dt-signal-lead .dt-tag[data-tone='quiet'] { border: 0.5px solid var(--dsw-alias-border-l4); }\n";
|
|
121
430
|
|
|
122
431
|
/** 把移植过来的样式挂到 document 上,只挂一次。 */
|
|
123
432
|
/**
|
|
@@ -418,8 +727,8 @@ window.__ModuleLoader__.load({
|
|
|
418
727
|
open ? children : null)
|
|
419
728
|
}
|
|
420
729
|
|
|
421
|
-
/**
|
|
422
|
-
function
|
|
730
|
+
/** 无 DSH Tooltip 时完整保留原实现:原 trigger、点击/失焦与本地气泡都不改写。 */
|
|
731
|
+
function FallbackInfoTip({ text, icon = 'question', warn }) {
|
|
423
732
|
const [open, setOpen] = useState(false)
|
|
424
733
|
return h('span', { style: { position: 'relative', display: 'inline-flex' } },
|
|
425
734
|
h('button', {
|
|
@@ -430,6 +739,11 @@ window.__ModuleLoader__.load({
|
|
|
430
739
|
open ? h('span', { className: 'dt-tooltip', role: 'tooltip', style: { position: 'absolute', bottom: '130%', left: 0, visibility: 'visible' } }, text) : null)
|
|
431
740
|
}
|
|
432
741
|
|
|
742
|
+
// 保持 InfoTip({text,icon,warn}) 调用面;静态分支不会在组件生命周期内改变 hooks 顺序。
|
|
743
|
+
function InfoTip(props) {
|
|
744
|
+
return hostTooltip ? h(hostTooltip, props) : h(FallbackInfoTip, props)
|
|
745
|
+
}
|
|
746
|
+
|
|
433
747
|
const Hint = ({ children }) => h('p', { className: 'dt-hint' }, children)
|
|
434
748
|
|
|
435
749
|
// ── L84c WatcherForm:新增与行内编辑共用的一份字段 schema 与草稿控件 ──
|
|
@@ -666,7 +980,7 @@ window.__ModuleLoader__.load({
|
|
|
666
980
|
return h('span', { key: spec.key, className: 'dt-hint', placeholder }, spec.label + ' ' + placeholder)
|
|
667
981
|
}))
|
|
668
982
|
const submitFromClick = (event) => submit(event)
|
|
669
|
-
return h('form', { id: idPrefix, className: 'dt-form', 'data-mode': mode, onSubmit: submit },
|
|
983
|
+
return h('form', { id: idPrefix, className: 'dt-form dt-card', 'data-mode': mode, onSubmit: submit },
|
|
670
984
|
h(Fields, { disabled: busy || disabled },
|
|
671
985
|
basic,
|
|
672
986
|
h(DisclosureRow, {
|
|
@@ -752,12 +1066,14 @@ window.__ModuleLoader__.load({
|
|
|
752
1066
|
footer !== undefined ? h('div', { className: 'dt-modal-footer' }, footer) : null))
|
|
753
1067
|
}
|
|
754
1068
|
|
|
755
|
-
|
|
756
|
-
|
|
757
|
-
|
|
1069
|
+
// 主面板使用 DSH Modal;没有宿主原语时回退到上面的 superagent 同源实现。
|
|
1070
|
+
// 直接别名而不是 h(Component, props) 转发,避免测试桩与真 React 的 children 处理差异。
|
|
1071
|
+
const PanelModal = hostUi ? hostUi.Modal : Modal
|
|
1072
|
+
|
|
1073
|
+
/** 确认层与触发器分离:DSH orbit 关闭后,同一个本地 Modal 仍能由 StatusOrbit 持有。 */
|
|
1074
|
+
function ConfirmDialog({ open, label, confirmLabel = '确定执行', title = confirmLabel, message, onConfirm, onClose, modalContext = 'panel' }) {
|
|
758
1075
|
const [busy, setBusy] = useState(false)
|
|
759
1076
|
const busyRef = useRef(false)
|
|
760
|
-
const close = useCallback(() => setOpen(false), [])
|
|
761
1077
|
const confirm = async () => {
|
|
762
1078
|
// state 还没来得及重渲染时也可能连点;同步 ref 是第二道锁。
|
|
763
1079
|
if (busyRef.current) return false
|
|
@@ -765,13 +1081,38 @@ window.__ModuleLoader__.load({
|
|
|
765
1081
|
setBusy(true)
|
|
766
1082
|
try {
|
|
767
1083
|
const done = await onConfirm()
|
|
768
|
-
if (done)
|
|
1084
|
+
if (done) onClose()
|
|
769
1085
|
return done
|
|
770
1086
|
} finally {
|
|
771
1087
|
busyRef.current = false
|
|
772
1088
|
setBusy(false)
|
|
773
1089
|
}
|
|
774
1090
|
}
|
|
1091
|
+
// orbit 删除明确保留 superagent 同源 Modal;普通主面板删除仍走 PanelModal,不换 RiskConfirmation。
|
|
1092
|
+
const ModalView = modalContext === 'orbit' ? Modal : PanelModal
|
|
1093
|
+
return h(ModalView, {
|
|
1094
|
+
open,
|
|
1095
|
+
title,
|
|
1096
|
+
description: message || ('确定要执行「' + label + '」操作吗?'),
|
|
1097
|
+
onClose,
|
|
1098
|
+
children: null,
|
|
1099
|
+
footer: h(React.Fragment, null,
|
|
1100
|
+
h(Btn, { variant: 'ghost', onClick: onClose }, '取消'),
|
|
1101
|
+
h(Btn, {
|
|
1102
|
+
variant: 'primary',
|
|
1103
|
+
className: cx('dt-danger', busy && 'dt-btn-busy'),
|
|
1104
|
+
disabled: busy,
|
|
1105
|
+
'aria-label': confirmLabel,
|
|
1106
|
+
'aria-busy': busy ? 'true' : undefined,
|
|
1107
|
+
onClick: confirm,
|
|
1108
|
+
}, confirmLabel)),
|
|
1109
|
+
})
|
|
1110
|
+
}
|
|
1111
|
+
|
|
1112
|
+
/** 官方 ConfirmButton 动线:触发按钮只开 Modal,取消不执行,确认期间 busy 防重复。 */
|
|
1113
|
+
function ConfirmButton({ label, confirmLabel = '确定执行', title = confirmLabel, message, onConfirm, variant = 'ghost', icon, size, modalContext = 'panel' }) {
|
|
1114
|
+
const [open, setOpen] = useState(false)
|
|
1115
|
+
const close = useCallback(() => setOpen(false), [])
|
|
775
1116
|
return h(React.Fragment, null,
|
|
776
1117
|
h(Btn, {
|
|
777
1118
|
variant,
|
|
@@ -781,23 +1122,7 @@ window.__ModuleLoader__.load({
|
|
|
781
1122
|
'aria-haspopup': 'dialog',
|
|
782
1123
|
onClick: () => setOpen(true),
|
|
783
1124
|
}, label),
|
|
784
|
-
h(
|
|
785
|
-
open,
|
|
786
|
-
title,
|
|
787
|
-
description: message || ('确定要执行「' + label + '」操作吗?'),
|
|
788
|
-
onClose: close,
|
|
789
|
-
children: null,
|
|
790
|
-
footer: h(React.Fragment, null,
|
|
791
|
-
h(Btn, { variant: 'ghost', onClick: close }, '取消'),
|
|
792
|
-
h(Btn, {
|
|
793
|
-
variant: 'primary',
|
|
794
|
-
className: cx('dt-danger', busy && 'dt-btn-busy'),
|
|
795
|
-
disabled: busy,
|
|
796
|
-
'aria-label': confirmLabel,
|
|
797
|
-
'aria-busy': busy ? 'true' : undefined,
|
|
798
|
-
onClick: confirm,
|
|
799
|
-
}, confirmLabel)),
|
|
800
|
-
}))
|
|
1125
|
+
h(ConfirmDialog, { open, label, confirmLabel, title, message, onConfirm, onClose: close, modalContext }))
|
|
801
1126
|
}
|
|
802
1127
|
|
|
803
1128
|
const watcherId = (w) => (w && w.id) || String((w && w.repo) || '') + '#' + String((w && w.sessionId) || '')
|
|
@@ -1006,6 +1331,12 @@ window.__ModuleLoader__.load({
|
|
|
1006
1331
|
const [anchor, setAnchor] = useState(null)
|
|
1007
1332
|
const btnRef = useRef(null)
|
|
1008
1333
|
const panelRef = useRef(null)
|
|
1334
|
+
const orbitConfirm = useOrbitConfirm({
|
|
1335
|
+
orbitRef: btnRef,
|
|
1336
|
+
onCloseOrbit: () => setOpen(false),
|
|
1337
|
+
// DSH 路径复用旧 anchor 槽保存待删 watcher;fallback 仍只保存手算坐标,状态槽位不变。
|
|
1338
|
+
onRequestConfirm: ({ watcher }) => setAnchor(watcher),
|
|
1339
|
+
})
|
|
1009
1340
|
|
|
1010
1341
|
// 弹层的样式(DOCK_CSS)挂在 PORTED_CSS 同一张 <style> 里,而那张表以前只有「主理鱼」面板挂载时才注入。
|
|
1011
1342
|
// 用户从没打开过面板就直接点状态栏圆环时,弹层就是一堆无样式的裸文字(真机复现过)。
|
|
@@ -1032,7 +1363,8 @@ window.__ModuleLoader__.load({
|
|
|
1032
1363
|
useEffect(() => { if (open) ensurePortedCss(true) }, [open])
|
|
1033
1364
|
|
|
1034
1365
|
useEffect(() => {
|
|
1035
|
-
|
|
1366
|
+
// 仅旧路径保留 capture mousedown / 手算焦点;DSH 由 OrbitPopover 与宿主 dismiss hook 接管。
|
|
1367
|
+
if (!open || hostOrbit) return undefined
|
|
1036
1368
|
const onDown = (event) => {
|
|
1037
1369
|
const target = event.target
|
|
1038
1370
|
if (panelRef.current && panelRef.current.contains(target)) return
|
|
@@ -1069,10 +1401,12 @@ window.__ModuleLoader__.load({
|
|
|
1069
1401
|
+ '(共 ' + list.length + ' 条)'
|
|
1070
1402
|
|
|
1071
1403
|
const toggle = () => {
|
|
1072
|
-
|
|
1073
|
-
|
|
1074
|
-
|
|
1075
|
-
|
|
1404
|
+
if (!hostOrbit) {
|
|
1405
|
+
const el = btnRef.current
|
|
1406
|
+
if (el) {
|
|
1407
|
+
const rect = el.getBoundingClientRect()
|
|
1408
|
+
setAnchor({ x: rect.left + rect.width / 2, y: rect.top })
|
|
1409
|
+
}
|
|
1076
1410
|
}
|
|
1077
1411
|
setOpen((value) => !value)
|
|
1078
1412
|
}
|
|
@@ -1095,16 +1429,15 @@ window.__ModuleLoader__.load({
|
|
|
1095
1429
|
},
|
|
1096
1430
|
}, h(OrbitMark, { watchers: list }))
|
|
1097
1431
|
|
|
1098
|
-
|
|
1099
|
-
|
|
1100
|
-
// 空态没什么内容,窄一点更像提示而不是一张空表格
|
|
1101
|
-
// 弹层宽度是固定的,但窗口可能更窄:按可视宽度夹一下,别溢出屏幕
|
|
1432
|
+
// DSH 固定业务宽度 252/368,坐标全部交给 useAnchoredPosition;只有 fallback 保留视口夹紧与手算 bottom。
|
|
1102
1433
|
const viewport = Number(window && window.innerWidth) || 1200
|
|
1103
|
-
const width =
|
|
1104
|
-
|
|
1434
|
+
const width = hostOrbit
|
|
1435
|
+
? (list.length === 0 ? 252 : PANEL_W)
|
|
1436
|
+
: Math.min(list.length === 0 ? 252 : PANEL_W, Math.max(240, viewport - 16))
|
|
1437
|
+
const left = !hostOrbit && anchor
|
|
1105
1438
|
? Math.max(8, Math.min(anchor.x - width / 2, (window.innerWidth || 1200) - width - 8))
|
|
1106
1439
|
: 8
|
|
1107
|
-
const bottom = anchor ? Math.max(8, (window.innerHeight || 800) - anchor.y + 8) : 64
|
|
1440
|
+
const bottom = !hostOrbit && anchor ? Math.max(8, (window.innerHeight || 800) - anchor.y + 8) : 64
|
|
1108
1441
|
|
|
1109
1442
|
const act = async (w, action) => {
|
|
1110
1443
|
// 删除只走 ConfirmButton + Modal;不要再叠一层原生确认框(同一动作问两次)。
|
|
@@ -1127,6 +1460,13 @@ window.__ModuleLoader__.load({
|
|
|
1127
1460
|
return true
|
|
1128
1461
|
}
|
|
1129
1462
|
|
|
1463
|
+
// fallback 完全保留原提前返回;DSH 即使 orbit 已关,也要继续渲染由本组件持有的确认 Modal。
|
|
1464
|
+
if (!open && !hostOrbit) return button
|
|
1465
|
+
const closeConfirm = () => {
|
|
1466
|
+
setAnchor(null)
|
|
1467
|
+
orbitConfirm.onConfirmClose()
|
|
1468
|
+
}
|
|
1469
|
+
|
|
1130
1470
|
// 悬浮面板也走移植来的 dt-* 设计系统(以前这里是一套自成体系的 inline style,
|
|
1131
1471
|
// 和原生界面放在一起能看出断层;ui-audit ⑥ 就是在盯这件事)。
|
|
1132
1472
|
// 摘要行(官方弹层的写法):主名一行 + 一行 muted 细节,细节超长就省略号。
|
|
@@ -1176,11 +1516,18 @@ window.__ModuleLoader__.load({
|
|
|
1176
1516
|
h(Btn, { size: 'sm', variant: 'ghost', onClick: () => act(w, 'poll') }, '立刻'),
|
|
1177
1517
|
h(Btn, { size: 'sm', variant: 'ghost', onClick: () => act(w, w.enabled ? 'pause' : 'resume') },
|
|
1178
1518
|
w.enabled ? '暂停' : '恢复'),
|
|
1179
|
-
|
|
1180
|
-
|
|
1181
|
-
|
|
1182
|
-
|
|
1183
|
-
|
|
1519
|
+
hostOrbit
|
|
1520
|
+
? h(Btn, {
|
|
1521
|
+
variant: 'ghost', size: 'sm', icon: h(Icon, { name: 'trash' }),
|
|
1522
|
+
'aria-label': '删除', 'aria-haspopup': 'dialog',
|
|
1523
|
+
// 适配器保证先 onCloseOrbit,再由 onRequestConfirm 选中待删 watcher。
|
|
1524
|
+
onClick: () => orbitConfirm.onRequestConfirm({ watcher: w }),
|
|
1525
|
+
}, '删除')
|
|
1526
|
+
: h(ConfirmButton, {
|
|
1527
|
+
label: '删除', confirmLabel: '确认删除', variant: 'ghost', size: 'sm', modalContext: 'orbit',
|
|
1528
|
+
icon: h(Icon, { name: 'trash' }),
|
|
1529
|
+
onConfirm: () => act(w, 'delete'),
|
|
1530
|
+
})))
|
|
1184
1531
|
})
|
|
1185
1532
|
|
|
1186
1533
|
// 比例条:和官方的「上下文已用」同一种表达(一眼看出多少在跑)
|
|
@@ -1190,10 +1537,7 @@ window.__ModuleLoader__.load({
|
|
|
1190
1537
|
const bar = barCounts.length === 0 ? null : h('div', { className: 'sa-dock-bar', 'aria-hidden': 'true' },
|
|
1191
1538
|
barCounts.map(([tone, n]) => h('span', { key: tone, 'data-tone': tone, style: { flexGrow: n } })))
|
|
1192
1539
|
|
|
1193
|
-
const
|
|
1194
|
-
ref: panelRef, role: 'dialog', 'aria-label': summary, tabIndex: -1, className: 'dt-card sa-dock-panel',
|
|
1195
|
-
style: { position: 'fixed', left, bottom, width, zIndex: 2147483000 },
|
|
1196
|
-
},
|
|
1540
|
+
const panelBody = h(React.Fragment, null,
|
|
1197
1541
|
h('div', { className: 'sa-dock-head' },
|
|
1198
1542
|
h('span', { className: 'sa-dock-title' }, '主理鱼'),
|
|
1199
1543
|
// 和面板统计条同一套官方素材:dt-stat(数值强 + 单位弱),不再自己发明 sa-dock-metric-*
|
|
@@ -1208,8 +1552,36 @@ window.__ModuleLoader__.load({
|
|
|
1208
1552
|
? h('div', { className: 'sa-dock-foot' }, '详细状态与凭证在「主理鱼」标签页')
|
|
1209
1553
|
: null)
|
|
1210
1554
|
|
|
1555
|
+
const panel = hostOrbit
|
|
1556
|
+
? h(hostOrbit.OrbitPopover, {
|
|
1557
|
+
open,
|
|
1558
|
+
anchorRef: btnRef,
|
|
1559
|
+
orbitRef: btnRef,
|
|
1560
|
+
panelRef,
|
|
1561
|
+
onClose: () => setOpen(false),
|
|
1562
|
+
width,
|
|
1563
|
+
className: 'dt-card sa-dock-panel',
|
|
1564
|
+
ariaLabel: summary,
|
|
1565
|
+
}, panelBody)
|
|
1566
|
+
: h('div', {
|
|
1567
|
+
ref: panelRef, role: 'dialog', 'aria-label': summary, tabIndex: -1, className: 'dt-card sa-dock-panel',
|
|
1568
|
+
style: { position: 'fixed', left, bottom, width, zIndex: 2147483000 },
|
|
1569
|
+
}, panelBody)
|
|
1570
|
+
|
|
1571
|
+
// 选中待删 watcher 时 open 已被适配器先置 false:portal surface 卸载,本地确认 Modal 才打开。
|
|
1572
|
+
const confirmation = hostOrbit && anchor
|
|
1573
|
+
? h(ConfirmDialog, {
|
|
1574
|
+
open: true,
|
|
1575
|
+
label: '删除',
|
|
1576
|
+
confirmLabel: '确认删除',
|
|
1577
|
+
title: '确认删除',
|
|
1578
|
+
modalContext: 'orbit',
|
|
1579
|
+
onConfirm: () => act(anchor, 'delete'),
|
|
1580
|
+
onClose: closeConfirm,
|
|
1581
|
+
})
|
|
1582
|
+
: null
|
|
1211
1583
|
|
|
1212
|
-
return h(React.Fragment, null, button, panel)
|
|
1584
|
+
return h(React.Fragment, null, button, panel, confirmation)
|
|
1213
1585
|
}
|
|
1214
1586
|
|
|
1215
1587
|
|
|
@@ -1246,8 +1618,14 @@ window.__ModuleLoader__.load({
|
|
|
1246
1618
|
}, [intervalMs])
|
|
1247
1619
|
}
|
|
1248
1620
|
|
|
1249
|
-
/** 轻量 Toast
|
|
1621
|
+
/** 轻量 Toast:DSH 可用时由宿主计时;fallback 保留原有 4 秒自动消失。 */
|
|
1250
1622
|
function useToast() {
|
|
1623
|
+
if (hostUi) {
|
|
1624
|
+
const { item, notify, dismiss } = hostUi.createToastState()
|
|
1625
|
+
// 保持 [view, notify] 调用面;item 替换加 key 保证同时只有最新一条。
|
|
1626
|
+
const view = h(hostUi.Toast, { item, onDone: dismiss })
|
|
1627
|
+
return [view, notify]
|
|
1628
|
+
}
|
|
1251
1629
|
// 官方 .dt-toast 是 position:fixed 顶部居中、且带自动淡出动画 —— 同时挂两条会重叠,
|
|
1252
1630
|
// 所以这里保持「同一时刻只有最新一条」,停留时长用官方的 --dt-toast-hold 控制。
|
|
1253
1631
|
const [item, setItem] = useState(null)
|
|
@@ -2578,7 +2956,7 @@ window.__ModuleLoader__.load({
|
|
|
2578
2956
|
tab === 'judge' ? timeline : null,
|
|
2579
2957
|
tab === 'trigger' ? trigger : null,
|
|
2580
2958
|
tab === 'settings' ? settings : null,
|
|
2581
|
-
typeof glossary === 'string' ? h(
|
|
2959
|
+
typeof glossary === 'string' ? h(PanelModal, {
|
|
2582
2960
|
open: true,
|
|
2583
2961
|
title: '建议追加到 ' + String(glossary).replace('rules:', '') + ' 的 AGENTS.md',
|
|
2584
2962
|
onClose: () => setGlossary(false),
|
|
@@ -2592,7 +2970,7 @@ window.__ModuleLoader__.load({
|
|
|
2592
2970
|
onClick: () => copyText(AGENTS_SNIPPET, '规则已复制,粘贴到 AGENTS.md 末尾即可'),
|
|
2593
2971
|
}, '复制这段规则'),
|
|
2594
2972
|
h(Btn, { size: 'sm', variant: 'ghost', onClick: () => setGlossary(false) }, '关闭'))) : null,
|
|
2595
|
-
h(
|
|
2973
|
+
h(PanelModal, { open: glossary === true, title: '主理鱼术语表', onClose: () => setGlossary(false) },
|
|
2596
2974
|
h(KeyValues, { rows: [
|
|
2597
2975
|
['主理鱼', '一条「盯办」绑定:某个仓库 → 某个会话'],
|
|
2598
2976
|
['盯', '轮询 issue/PR、按水位去重、冷却期吸收自己的操作'],
|
package/lib/index.js
CHANGED
|
@@ -47,7 +47,7 @@ import {
|
|
|
47
47
|
|
|
48
48
|
export const name = 'dsh-session-superagent'
|
|
49
49
|
/** 服务端版本:随 package.json 同步(meta 测试守着)。客户端据此挑「最新的那个实例」。 */
|
|
50
|
-
export const SERVER_VERSION = '0.9.
|
|
50
|
+
export const SERVER_VERSION = '0.9.268'
|
|
51
51
|
export const inject = ['tools', 'agents', 'webServer']
|
|
52
52
|
/** 一条会话每小时最多被唤醒几次(跨所有守累计)。单守上限挡不住多守叠加。 */
|
|
53
53
|
// 本进程启动时刻:用来区分「刚重启还没轮到」与「定时器真的丢了」
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "dsh-session-superagent",
|
|
3
|
-
"version": "0.9.
|
|
3
|
+
"version": "0.9.268",
|
|
4
4
|
"description": "Session-level superagent for DeepSeek Harness: watch a GitHub repository and wake a session when something needs doing. Credentials never reach the model.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "lib/index.js",
|
|
@@ -10,7 +10,8 @@
|
|
|
10
10
|
"./redact": "./lib/redact.js",
|
|
11
11
|
"./package.json": "./package.json",
|
|
12
12
|
"./client": "./client.js",
|
|
13
|
-
"./host-primitives": "./ui-host-primitives.js"
|
|
13
|
+
"./host-primitives": "./ui-host-primitives.js",
|
|
14
|
+
"./orbit-popover": "./ui-orbit-popover.js"
|
|
14
15
|
},
|
|
15
16
|
"files": [
|
|
16
17
|
"lib/index.js",
|
|
@@ -27,6 +28,7 @@
|
|
|
27
28
|
"LICENSE",
|
|
28
29
|
"client.js",
|
|
29
30
|
"ui-host-primitives.js",
|
|
31
|
+
"ui-orbit-popover.js",
|
|
30
32
|
"bin/check.mjs",
|
|
31
33
|
"assets/icon-180.png",
|
|
32
34
|
"docs/whats-new-0.9.md",
|
package/ui-host-primitives.js
CHANGED
|
@@ -71,6 +71,15 @@ export function createHostUi({ React, primitives } = {}) {
|
|
|
71
71
|
|
|
72
72
|
function Tooltip({ text, icon = 'question', warn = false, children } = {}) {
|
|
73
73
|
const HostTooltip = primitive('Tooltip')
|
|
74
|
+
const [remountKey, setRemountKey] = React.useState(0)
|
|
75
|
+
React.useEffect(() => {
|
|
76
|
+
if (typeof window === 'undefined') return undefined
|
|
77
|
+
const target = window
|
|
78
|
+
const closeOnScroll = () => setRemountKey((current) => current + 1)
|
|
79
|
+
// DSH Tooltip 没有受控 open 或 scroll listener;capture 可同时覆盖嵌套滚动容器。
|
|
80
|
+
target.addEventListener('scroll', closeOnScroll, true)
|
|
81
|
+
return () => target.removeEventListener('scroll', closeOnScroll, true)
|
|
82
|
+
}, [])
|
|
74
83
|
// children 可替换 trigger;省略时保留 InfoTip 的 button / dt-info 调用面。
|
|
75
84
|
const trigger = children === undefined
|
|
76
85
|
? h('button', {
|
|
@@ -82,7 +91,9 @@ export function createHostUi({ React, primitives } = {}) {
|
|
|
82
91
|
if (!React.isValidElement(trigger)) {
|
|
83
92
|
throw new TypeError('Tooltip children 必须是单个 React element')
|
|
84
93
|
}
|
|
94
|
+
// 只以 key 重挂载宿主 Tooltip 来清掉内部 pinned 状态;不克隆 trigger、不增加 DOM 或事件层。
|
|
85
95
|
return h(HostTooltip, {
|
|
96
|
+
key: remountKey,
|
|
86
97
|
label: text,
|
|
87
98
|
side: 'top',
|
|
88
99
|
portal: true,
|
|
@@ -0,0 +1,202 @@
|
|
|
1
|
+
// L84e:StatusOrbit 的宿主弹层薄适配器。
|
|
2
|
+
// 定位与外点交给 DSH primitives;portal 交给宿主 react-dom 注入的 createPortal。
|
|
3
|
+
// 这里不包含 watcher 轮询、行数据、删除请求、确认 Modal 或另一套定位实现。
|
|
4
|
+
|
|
5
|
+
const DEFAULT_ORBIT_Z_INDEX = 1100
|
|
6
|
+
|
|
7
|
+
function focusIfConnected(node) {
|
|
8
|
+
if (!node || typeof node.focus !== 'function') return false
|
|
9
|
+
if ('isConnected' in node && !node.isConnected) return false
|
|
10
|
+
try {
|
|
11
|
+
node.focus()
|
|
12
|
+
return true
|
|
13
|
+
} catch {
|
|
14
|
+
return false
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
function closeReason(detail) {
|
|
19
|
+
// DSH useDismissOnOutsidePointer 固定调用 close(false)。
|
|
20
|
+
if (detail === false) return { reason: 'outside-pointer' }
|
|
21
|
+
if (typeof detail === 'string') return { reason: detail }
|
|
22
|
+
if (detail && typeof detail === 'object' && typeof detail.reason === 'string') return detail
|
|
23
|
+
return { reason: 'dismiss' }
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
/**
|
|
27
|
+
* 用宿主注入的 React 与 @deepseek-ai/dsh-client-ui-primitives 创建 Orbit 弹层。
|
|
28
|
+
*
|
|
29
|
+
* React.createPortal 必须由调用方从宿主 react-dom 注入;普通 React export 没有它。
|
|
30
|
+
* 缺少任何必需能力都会显式报错,由调用方决定是否完整保留旧实现。
|
|
31
|
+
*/
|
|
32
|
+
export function createOrbitPopover({ React, primitives } = {}) {
|
|
33
|
+
if (!React || typeof React.createElement !== 'function') {
|
|
34
|
+
throw new TypeError('createOrbitPopover 需要宿主 React.createElement')
|
|
35
|
+
}
|
|
36
|
+
for (const hook of ['useRef', 'useCallback', 'useEffect']) {
|
|
37
|
+
if (typeof React[hook] !== 'function') {
|
|
38
|
+
throw new TypeError(`createOrbitPopover 需要宿主 React.${hook}`)
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
if (typeof React.createPortal !== 'function') {
|
|
42
|
+
throw new TypeError('createOrbitPopover 需要宿主 React.createPortal(从 react-dom 注入)')
|
|
43
|
+
}
|
|
44
|
+
if (!primitives || (typeof primitives !== 'object' && typeof primitives !== 'function')) {
|
|
45
|
+
throw new TypeError('createOrbitPopover 需要 DSH primitives')
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
const primitive = (name, kind) => {
|
|
49
|
+
const value = primitives[name]
|
|
50
|
+
if (kind === 'function' ? typeof value !== 'function' : !value) {
|
|
51
|
+
throw new Error(`DSH primitives.${name} 不可用;OrbitPopover 不会创建替代弹层`)
|
|
52
|
+
}
|
|
53
|
+
return value
|
|
54
|
+
}
|
|
55
|
+
const useAnchoredPosition = primitive('useAnchoredPosition', 'function')
|
|
56
|
+
const useDismissOnOutsidePointer = primitive('useDismissOnOutsidePointer', 'function')
|
|
57
|
+
const MenuSurface = primitive('MenuSurface')
|
|
58
|
+
const h = React.createElement
|
|
59
|
+
const createPortal = React.createPortal
|
|
60
|
+
|
|
61
|
+
/**
|
|
62
|
+
* 非 Modal 的 orbit 主 surface。width 必须由调用方按业务内容给出(例如 252/368)。
|
|
63
|
+
* side/align 不开放成 props,避免误传宿主未实现的 center 或虚构自动 flip。
|
|
64
|
+
*/
|
|
65
|
+
function OrbitPopover({
|
|
66
|
+
open,
|
|
67
|
+
anchorRef,
|
|
68
|
+
orbitRef,
|
|
69
|
+
panelRef: suppliedPanelRef,
|
|
70
|
+
onClose,
|
|
71
|
+
width,
|
|
72
|
+
zIndex = DEFAULT_ORBIT_Z_INDEX,
|
|
73
|
+
portalTarget: suppliedPortalTarget,
|
|
74
|
+
className,
|
|
75
|
+
style,
|
|
76
|
+
ariaLabel,
|
|
77
|
+
children,
|
|
78
|
+
} = {}) {
|
|
79
|
+
const internalPanelRef = React.useRef(null)
|
|
80
|
+
const panelRef = suppliedPanelRef || internalPanelRef
|
|
81
|
+
const returnFocusRef = orbitRef || anchorRef
|
|
82
|
+
const onCloseRef = React.useRef(onClose)
|
|
83
|
+
onCloseRef.current = onClose
|
|
84
|
+
|
|
85
|
+
// stable close:父级轮询重渲染只更新 ref,不重建外点 effect 或焦点 effect。
|
|
86
|
+
const close = React.useCallback((detail) => {
|
|
87
|
+
const callback = onCloseRef.current
|
|
88
|
+
if (typeof callback === 'function') callback(closeReason(detail))
|
|
89
|
+
}, [])
|
|
90
|
+
|
|
91
|
+
// 两个宿主 hooks 与本地 effect 都在 if (!open) return 之前无条件调用。
|
|
92
|
+
const position = useAnchoredPosition({
|
|
93
|
+
open: Boolean(open),
|
|
94
|
+
anchorRef,
|
|
95
|
+
panelRef,
|
|
96
|
+
side: 'top',
|
|
97
|
+
align: 'end',
|
|
98
|
+
gap: 8,
|
|
99
|
+
margin: 8,
|
|
100
|
+
})
|
|
101
|
+
useDismissOnOutsidePointer(panelRef, Boolean(open), close, anchorRef)
|
|
102
|
+
|
|
103
|
+
const portalTarget = suppliedPortalTarget === undefined
|
|
104
|
+
? (typeof document !== 'undefined' ? document.body : null)
|
|
105
|
+
: suppliedPortalTarget
|
|
106
|
+
const ownerDocument = portalTarget && portalTarget.ownerDocument
|
|
107
|
+
? portalTarget.ownerDocument
|
|
108
|
+
: (typeof document !== 'undefined' ? document : null)
|
|
109
|
+
|
|
110
|
+
React.useEffect(() => {
|
|
111
|
+
if (!open || !ownerDocument || typeof ownerDocument.addEventListener !== 'function') return undefined
|
|
112
|
+
|
|
113
|
+
// effect 在 portal mount 后运行;非 Modal dialog 自身接收初始焦点,不做焦点陷阱。
|
|
114
|
+
focusIfConnected(panelRef.current)
|
|
115
|
+
const onKeyDown = (event) => {
|
|
116
|
+
if (!event || event.key !== 'Escape' || event.repeat) return
|
|
117
|
+
if (typeof event.preventDefault === 'function') event.preventDefault()
|
|
118
|
+
if (typeof event.stopPropagation === 'function') event.stopPropagation()
|
|
119
|
+
close({ reason: 'escape' })
|
|
120
|
+
}
|
|
121
|
+
ownerDocument.addEventListener('keydown', onKeyDown, true)
|
|
122
|
+
return () => {
|
|
123
|
+
ownerDocument.removeEventListener('keydown', onKeyDown, true)
|
|
124
|
+
// 永远回圆环,不回面板里可能已随关闭/删除卸载的按钮。
|
|
125
|
+
focusIfConnected(returnFocusRef && returnFocusRef.current)
|
|
126
|
+
}
|
|
127
|
+
}, [open, close, ownerDocument, panelRef, returnFocusRef])
|
|
128
|
+
|
|
129
|
+
if (!open) return null
|
|
130
|
+
if (!anchorRef || typeof anchorRef !== 'object') {
|
|
131
|
+
throw new TypeError('OrbitPopover 需要调用方传入 anchorRef')
|
|
132
|
+
}
|
|
133
|
+
if (!Number.isFinite(width) || width <= 0) {
|
|
134
|
+
throw new TypeError('OrbitPopover 需要调用方传入正数 width;适配器不推导业务宽度')
|
|
135
|
+
}
|
|
136
|
+
if (!portalTarget) {
|
|
137
|
+
throw new Error('OrbitPopover portal target 不可用;不会退化为非 portal surface')
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
const surface = h(MenuSurface, {
|
|
141
|
+
ref: panelRef,
|
|
142
|
+
role: 'dialog',
|
|
143
|
+
'aria-label': ariaLabel,
|
|
144
|
+
tabIndex: -1,
|
|
145
|
+
className,
|
|
146
|
+
style: {
|
|
147
|
+
...style,
|
|
148
|
+
position: 'fixed',
|
|
149
|
+
left: position ? position.left : 0,
|
|
150
|
+
top: position ? position.top : 0,
|
|
151
|
+
width,
|
|
152
|
+
zIndex,
|
|
153
|
+
// useAnchoredPosition 首帧尚未测量时不在 0,0 闪现;不自行计算另一套坐标。
|
|
154
|
+
visibility: position ? 'visible' : 'hidden',
|
|
155
|
+
},
|
|
156
|
+
}, children)
|
|
157
|
+
return createPortal(surface, portalTarget)
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
/**
|
|
161
|
+
* 删除确认的调用方策略。此 hook 不创建 Modal,也不保存 watcher/请求状态。
|
|
162
|
+
* requestConfirm 永远先关闭 orbit,再调用可选 onRequestConfirm 打开调用方的确认层。
|
|
163
|
+
*/
|
|
164
|
+
function useOrbitConfirm({ orbitRef, onCloseOrbit, onRequestConfirm } = {}) {
|
|
165
|
+
const orbitRefRef = React.useRef(orbitRef)
|
|
166
|
+
const onCloseOrbitRef = React.useRef(onCloseOrbit)
|
|
167
|
+
const onRequestConfirmRef = React.useRef(onRequestConfirm)
|
|
168
|
+
const restoreFocusRef = React.useRef(null)
|
|
169
|
+
orbitRefRef.current = orbitRef
|
|
170
|
+
onCloseOrbitRef.current = onCloseOrbit
|
|
171
|
+
onRequestConfirmRef.current = onRequestConfirm
|
|
172
|
+
|
|
173
|
+
const requestConfirm = React.useCallback((detail = {}) => {
|
|
174
|
+
restoreFocusRef.current = 'orbit'
|
|
175
|
+
if (typeof onCloseOrbitRef.current === 'function') {
|
|
176
|
+
onCloseOrbitRef.current({ reason: 'confirm' })
|
|
177
|
+
}
|
|
178
|
+
const request = onRequestConfirmRef.current
|
|
179
|
+
if (typeof request === 'function') {
|
|
180
|
+
const extra = detail && typeof detail === 'object' ? detail : { value: detail }
|
|
181
|
+
return request({ ...extra, reason: 'confirm', restoreFocus: 'orbit' })
|
|
182
|
+
}
|
|
183
|
+
return undefined
|
|
184
|
+
}, [])
|
|
185
|
+
|
|
186
|
+
const onConfirmClose = React.useCallback(() => {
|
|
187
|
+
if (restoreFocusRef.current !== 'orbit') return false
|
|
188
|
+
restoreFocusRef.current = null
|
|
189
|
+
const ref = orbitRefRef.current
|
|
190
|
+
// 特意只读取圆环 ref;requestConfirm 的删除按钮/opener 不参与焦点归还。
|
|
191
|
+
return focusIfConnected(ref && ref.current)
|
|
192
|
+
}, [])
|
|
193
|
+
|
|
194
|
+
return {
|
|
195
|
+
onRequestConfirm: requestConfirm,
|
|
196
|
+
onConfirmClose,
|
|
197
|
+
restoreFocus: restoreFocusRef.current,
|
|
198
|
+
}
|
|
199
|
+
}
|
|
200
|
+
|
|
201
|
+
return { OrbitPopover, useOrbitConfirm }
|
|
202
|
+
}
|