dsh-session-superagent 0.9.265 → 0.9.266
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 +33 -0
- package/README.md +3 -3
- package/client.js +374 -148
- package/lib/index.js +1 -1
- package/package.json +4 -2
- package/ui-host-primitives.js +111 -0
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,39 @@
|
|
|
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.266] - 2026-11-05 —— 新增/编辑共用 WatcherForm,宿主原语适配层就位
|
|
6
|
+
|
|
7
|
+
### 共用表单,不再两套字段
|
|
8
|
+
|
|
9
|
+
新增 `WatcherForm / Field / Fields / SaveBar` 与统一 schema:
|
|
10
|
+
|
|
11
|
+
- `div.dt-field + label[htmlFor]` 对应唯一 input id,label 内不嵌交互按钮;
|
|
12
|
+
- 高级限额、优先级、隔离保留策略进入 Disclosure,默认收起;
|
|
13
|
+
- 数字字段显式 `type=number / min / max`,optional 空值保持空;
|
|
14
|
+
- 干净无 SaveBar,修改出现,放弃恢复完整打开快照,保存中禁用;
|
|
15
|
+
- 保存仍走 `/watch`,只提交 touched 字段,不改 API。
|
|
16
|
+
|
|
17
|
+
新增 11 条定向用例 + 8 条独立验收;独立验收还修复了跨 VM realm 的 style 原型误判,未放宽断言。
|
|
18
|
+
|
|
19
|
+
### DSH 原语薄适配层
|
|
20
|
+
|
|
21
|
+
新增 `ui-host-primitives.js`:
|
|
22
|
+
|
|
23
|
+
- `createHostUi()`:Modal / Toast / Tooltip 的真实 props 适配;
|
|
24
|
+
- Toast 必须 `key=item.id`,`onDone` 只回传 id,旧回调不能清新通知;
|
|
25
|
+
- `dismissToast()` 纯函数 id guard,无第二套 timer;
|
|
26
|
+
- Tooltip 固定 `top / portal / openOnClick / gap=8`,缺原语显式报错,不自造第三套。
|
|
27
|
+
|
|
28
|
+
该模块已随包导出,下一批再接入现有调用面;浏览器焦点、计时、scroll-close 仍明确未验。
|
|
29
|
+
|
|
30
|
+
### 证据
|
|
31
|
+
|
|
32
|
+
```
|
|
33
|
+
npm test → 486/486(WatcherForm 11 + 独立验收 8 + 宿主适配 8,另含原有全部用例)
|
|
34
|
+
scripts/ui-audit.mjs → 11/11,100 分
|
|
35
|
+
浅色对比度 → 15 组 ≤ 基线 16;深色 → 12 组 ≤ 基线 13
|
|
36
|
+
```
|
|
37
|
+
|
|
5
38
|
## [0.9.265] - 2026-11-05 —— 确认统一走 Modal,判定日志改 DecisionLine
|
|
6
39
|
|
|
7
40
|
### ConfirmButton:一次触发,一次确认
|
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)
|
|
@@ -146,7 +146,7 @@ Gitee 私有仓库要在「设置 → 凭证」填私人令牌;公开仓库不
|
|
|
146
146
|
## 开发
|
|
147
147
|
|
|
148
148
|
```sh
|
|
149
|
-
npm test #
|
|
149
|
+
npm test # 486 项单测(带离线开关;裸 node --test 会真去 spawn gh,两分半)
|
|
150
150
|
```
|
|
151
151
|
|
|
152
152
|
### 工具输出:文本给人和 agent,JSON 给程序
|
|
@@ -206,7 +206,7 @@ dsh plugin --profile <profile> add dsh-session-superagent@latest
|
|
|
206
206
|
|
|
207
207
|
|
|
208
208
|
```bash
|
|
209
|
-
npm test #
|
|
209
|
+
npm test # 486 项单测(带离线开关,约 1.6 秒)
|
|
210
210
|
node scripts/ui-audit.mjs # 11 项 UI 指标(写死颜色 / 自造 token / 官方结构采用 …)
|
|
211
211
|
node scripts/preflight.mjs # 41 项门禁(含上面两条,外加 profile 一致性、路由面、包内容)
|
|
212
212
|
node scripts/render-preview.mjs preview.html # 双主题静态预览,直接浏览器打开
|
package/client.js
CHANGED
|
@@ -14,7 +14,7 @@ window.__ModuleLoader__.load({
|
|
|
14
14
|
const { useCallback, useEffect, useRef, useState } = React
|
|
15
15
|
|
|
16
16
|
// 客户端版本探针:每次模块加载写一次,用来确认浏览器里跑的是哪一版
|
|
17
|
-
const CLIENT_VERSION = '0.9.
|
|
17
|
+
const CLIENT_VERSION = '0.9.266'
|
|
18
18
|
let BASE = '/session-superagent'
|
|
19
19
|
/**
|
|
20
20
|
* 挑「最新的那个服务端实例」。
|
|
@@ -117,7 +117,7 @@ window.__ModuleLoader__.load({
|
|
|
117
117
|
// 官方 GUI 的 376 条选择器 / 40KB 样式原样搬过来,类名统一 `dt-` 前缀,不污染宿主。
|
|
118
118
|
// 两个表单都有这个开关:文案只写一份,改的时候不会漏掉另一处
|
|
119
119
|
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: color-mix(in srgb, var(--dsw-alias-label-primary-foreground) 30%, #ffffff); }\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";
|
|
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";
|
|
121
121
|
|
|
122
122
|
/** 把移植过来的样式挂到 document 上,只挂一次。 */
|
|
123
123
|
/**
|
|
@@ -287,10 +287,10 @@ window.__ModuleLoader__.load({
|
|
|
287
287
|
h('input', rest))
|
|
288
288
|
}
|
|
289
289
|
|
|
290
|
-
function Toggle({ checked, onChange, label }) {
|
|
290
|
+
function Toggle({ checked, onChange, label, id, disabled }) {
|
|
291
291
|
return h('button', {
|
|
292
|
-
type: 'button', role: 'switch', 'aria-checked': !!checked, 'aria-label': label,
|
|
293
|
-
className: 'dt-switch', onClick: () => onChange(!checked),
|
|
292
|
+
id, type: 'button', role: 'switch', 'aria-checked': !!checked, 'aria-label': label,
|
|
293
|
+
className: 'dt-switch', disabled, onClick: () => onChange(!checked),
|
|
294
294
|
}, h('span', { className: 'dt-switch-thumb' }))
|
|
295
295
|
}
|
|
296
296
|
|
|
@@ -432,6 +432,258 @@ window.__ModuleLoader__.load({
|
|
|
432
432
|
|
|
433
433
|
const Hint = ({ children }) => h('p', { className: 'dt-hint' }, children)
|
|
434
434
|
|
|
435
|
+
// ── L84c WatcherForm:新增与行内编辑共用的一份字段 schema 与草稿控件 ──
|
|
436
|
+
// 这里刻意不引入 DSH InlineEditor:watcher 是多字段表单,不是单文本编辑器。
|
|
437
|
+
const AUTHOR_LIST_PLACEHOLDER = 'GitHub 登录名,逗号分隔,留空 = 谁都算'
|
|
438
|
+
const PRIORITY_LABEL = '优先级(在「单次最多唤醒条数」内先挑谁)'
|
|
439
|
+
const CREATE_WATCHER_VALUES = {
|
|
440
|
+
repo: '', intervalSec: '60', labels: '', ignoreLabels: '', assignee: '',
|
|
441
|
+
activeHours: '', goal: '', ackLabel: '', onlyAssigned: false, allowAuthors: '',
|
|
442
|
+
observe: false, isolated: false, workdir: '', batchLimit: '', maxWakesPerHour: '',
|
|
443
|
+
sessionMaxWakes: '', isolateKeepDays: '', maxIsolated: '',
|
|
444
|
+
priorityReopened: true, priorityComments: true, priorityLabels: true,
|
|
445
|
+
priorityUnassigned: false, priorityStale: false,
|
|
446
|
+
}
|
|
447
|
+
const watcherNumberText = (value) => value === undefined || value === null || value === '' ? '' : String(value)
|
|
448
|
+
const numberOrUndefined = (value) => {
|
|
449
|
+
if (value === undefined || value === null || String(value).trim() === '') return undefined
|
|
450
|
+
const parsed = Number(value)
|
|
451
|
+
return Number.isFinite(parsed) ? parsed : undefined
|
|
452
|
+
}
|
|
453
|
+
const watcherValuesFrom = (watcher) => ({
|
|
454
|
+
repo: watcher.repo || '',
|
|
455
|
+
intervalSec: watcherNumberText(watcher.intervalSec ?? 60),
|
|
456
|
+
labels: (watcher.filters && Array.isArray(watcher.filters.labels) ? watcher.filters.labels : []).join(','),
|
|
457
|
+
ignoreLabels: (watcher.filters && Array.isArray(watcher.filters.ignoreLabels) ? watcher.filters.ignoreLabels : []).join(','),
|
|
458
|
+
assignee: (watcher.filters && watcher.filters.assignee) || '',
|
|
459
|
+
activeHours: watcher.activeHours || '',
|
|
460
|
+
goal: watcher.note || (typeof watcher.goal === 'string' ? watcher.goal : (watcher.goal && watcher.goal.objective) || ''),
|
|
461
|
+
ackLabel: watcher.ackLabel || (watcher.provider === 'gitee' ? '主理鱼-已处理' : '主理鱼:已处理'),
|
|
462
|
+
onlyAssigned: !!(watcher.filters && watcher.filters.onlyAssigned),
|
|
463
|
+
allowAuthors: (watcher.filters && Array.isArray(watcher.filters.allowAuthors) ? watcher.filters.allowAuthors : []).join(', '),
|
|
464
|
+
observe: !!watcher.observe,
|
|
465
|
+
isolated: !!watcher.isolated,
|
|
466
|
+
workdir: watcher.workdir || '',
|
|
467
|
+
batchLimit: watcherNumberText(watcher.batchLimit),
|
|
468
|
+
maxWakesPerHour: watcherNumberText(watcher.maxWakesPerHour),
|
|
469
|
+
sessionMaxWakes: watcherNumberText(watcher.sessionMaxWakes),
|
|
470
|
+
isolateKeepDays: watcherNumberText(watcher.isolateKeepDays),
|
|
471
|
+
maxIsolated: watcherNumberText(watcher.maxIsolated),
|
|
472
|
+
priorityReopened: (watcher.priority && watcher.priority.reopened) !== false,
|
|
473
|
+
priorityComments: (watcher.priority && watcher.priority.comments) !== false,
|
|
474
|
+
priorityLabels: (watcher.priority && watcher.priority.labels) !== false,
|
|
475
|
+
priorityUnassigned: Boolean(watcher.priority && watcher.priority.unassigned) === true,
|
|
476
|
+
priorityStale: Boolean(watcher.priority && watcher.priority.stale) === true,
|
|
477
|
+
})
|
|
478
|
+
const watcherSameValue = (left, right) => String(left ?? '') === String(right ?? '')
|
|
479
|
+
const watcherDirty = (value, snapshot) => Object.keys(snapshot || {}).some((key) => !watcherSameValue(value && value[key], snapshot[key]))
|
|
480
|
+
|
|
481
|
+
// label/hint/note/control 的顺序只在这里声明一次;两个调用点只负责提供值与回调。
|
|
482
|
+
const WATCHER_FIELD_SCHEMA = [
|
|
483
|
+
{ key: 'repo', label: '仓库', kind: 'text', modes: ['create'], required: true, placeholder: 'owner/name,或 gitee:owner/name' },
|
|
484
|
+
{ key: 'intervalSec', label: '间隔(秒)', kind: 'number', min: 30, max: 3600, required: true, hint: '多长时间检查一次这个仓库,最小 30 秒' },
|
|
485
|
+
{ key: 'labels', label: '只处理这些标签', kind: 'text', placeholder: '逗号分隔,留空 = 全部' },
|
|
486
|
+
{ key: 'ignoreLabels', label: '排除这些标签', kind: 'text', placeholder: '逗号分隔,留空 = 不排除', hint: '命中任意一个就跳过,优先级高于上面的白名单' },
|
|
487
|
+
{ key: 'allowAuthors', label: '只理这些人提的', kind: 'text', placeholder: AUTHOR_LIST_PLACEHOLDER, hint: '不在名单里的人提的 issue/PR 不会叫醒你(Gitee 也可以填)' },
|
|
488
|
+
{ key: 'activeHours', label: '活跃时段', kind: 'hours', hint: '只在这个时间段内唤醒;窗口外只攒条目,不打扰' },
|
|
489
|
+
{ key: 'goal', label: '目标/规则', kind: 'text', placeholder: '可选,会附在唤醒消息里' },
|
|
490
|
+
{ key: 'ackLabel', label: '已处理标签', kind: 'text', placeholder: '主理鱼:已处理', hint: 'watch_ack 会把同名标签打到 issue/PR 上;改名字等于换一套已处理标记' },
|
|
491
|
+
{ key: 'onlyAssigned', label: '只看已指派', kind: 'switch', hint: '只处理已指派给人的条目' },
|
|
492
|
+
{ key: 'assignee', label: '只看指派给谁', kind: 'text', when: (value) => !!value.onlyAssigned, placeholder: 'GitHub 登录名,留空 = 只要有指派就行' },
|
|
493
|
+
{ key: 'observe', label: '仅观察', kind: 'switch', hint: '仅观察(只记录本会唤醒哪几条,不真唤醒)' },
|
|
494
|
+
{ key: 'isolated', label: '隔离执行', kind: 'switch', hint: ISOLATED_HINT },
|
|
495
|
+
{ key: 'batchLimit', label: '单次最多唤醒条数', kind: 'number', advanced: true, min: 1, max: 20, placeholder: (defaults) => String(defaults.batchLimit ?? 5) + '(1-20)' },
|
|
496
|
+
{ key: 'maxWakesPerHour', label: '每小时最多唤醒次数', kind: 'number', advanced: true, min: 1, max: 60, placeholder: (defaults) => String(defaults.maxWakesPerHour ?? 6) + '(1-60)' },
|
|
497
|
+
{ key: 'sessionMaxWakes', label: '这条会话每小时最多被唤醒', kind: 'number', advanced: true, min: 1, max: 60, placeholder: (defaults) => String(defaults.sessionMaxWakes ?? 12) + '(1-60)', hint: '跨所有守累计:守 5 个仓库时,光有单守上限挡不住叠加' },
|
|
498
|
+
{ key: 'priority', label: PRIORITY_LABEL, kind: 'priority', advanced: true, hint: '全部关掉时按 GitHub 的「最近更新」顺序处理' },
|
|
499
|
+
{ key: 'workdir', label: '隔离工作目录', kind: 'text', advanced: true, when: (value) => !!value.isolated, placeholder: '绝对路径,留空 = 当前工作目录' },
|
|
500
|
+
{ key: 'isolateKeepDays', label: '隔离区保留天数', kind: 'number', advanced: true, when: (value) => !!value.isolated, min: 1, max: 30, placeholder: (defaults) => String(defaults.isolateKeepDays ?? 3) + '(1-30)', hint: '每次唤醒前回收这个天数之前的一次性工作区;留空用默认天数' },
|
|
501
|
+
{ key: 'maxIsolated', label: '最多保留几个隔离区', kind: 'number', advanced: true, when: (value) => !!value.isolated, min: 1, max: 50, placeholder: '5(1-50)', hint: '天数之外的第二道线:超出就回收最旧的(不影响正在用的那个)' },
|
|
502
|
+
]
|
|
503
|
+
|
|
504
|
+
/** superagent Field 的 DOM:label 与 InfoTip 是兄弟节点,控件拿同一个唯一 id。 */
|
|
505
|
+
let watcherFieldSerial = 0
|
|
506
|
+
function Field({ id, label, hint, note, children }) {
|
|
507
|
+
const generated = useRef(null)
|
|
508
|
+
if (!generated.current) {
|
|
509
|
+
watcherFieldSerial += 1
|
|
510
|
+
generated.current = id || ('dt-watcher-field-' + watcherFieldSerial)
|
|
511
|
+
}
|
|
512
|
+
const fieldId = id || generated.current
|
|
513
|
+
const child = Array.isArray(children) ? children[0] : children
|
|
514
|
+
const control = child && typeof child === 'object'
|
|
515
|
+
? { ...child, props: { ...(child.props || {}), id: (child.props && child.props.id) || fieldId } }
|
|
516
|
+
: child
|
|
517
|
+
return h('div', { className: 'dt-field' },
|
|
518
|
+
h('span', { className: 'dt-field-head' },
|
|
519
|
+
h('label', { htmlFor: fieldId }, label),
|
|
520
|
+
hint ? h(InfoTip, { text: hint }) : null),
|
|
521
|
+
control,
|
|
522
|
+
note ? h('small', null, note) : null)
|
|
523
|
+
}
|
|
524
|
+
|
|
525
|
+
/** superagent Fields:保存期间由原生 fieldset 统一禁用所有字段。 */
|
|
526
|
+
function Fields({ disabled, children }) {
|
|
527
|
+
return h('fieldset', { className: 'dt-fieldset', disabled: !!disabled }, children)
|
|
528
|
+
}
|
|
529
|
+
|
|
530
|
+
/** superagent SaveBar 的精简草稿状态:clean 不挂载,dirty/busy/error 才挂载。 */
|
|
531
|
+
function SaveBar({ dirty, busy, error, disabled, onDiscard, onSave, saveLabel = '保存' }) {
|
|
532
|
+
if (!dirty && !busy && !error) return null
|
|
533
|
+
return h('div', { className: 'dt-savebar' },
|
|
534
|
+
error
|
|
535
|
+
? h('p', { className: 'dt-error', role: 'alert' }, error)
|
|
536
|
+
: h('p', { className: 'dt-hint', 'aria-live': 'polite' }, busy ? '保存中…' : '未保存'),
|
|
537
|
+
h(Btn, { size: 'sm', variant: 'ghost', disabled: !dirty || !!busy || !!disabled, onClick: onDiscard }, '放弃'),
|
|
538
|
+
h(Btn, { size: 'sm', variant: 'primary', type: 'submit', disabled: !dirty || !!busy || !!disabled, onClick: onSave }, busy ? '保存中…' : saveLabel))
|
|
539
|
+
}
|
|
540
|
+
|
|
541
|
+
/** derived HoursField:两个原生时间控件,Field 的 label 只关联起始控件。 */
|
|
542
|
+
function HoursField({ value, onChange, id, disabled }) {
|
|
543
|
+
const match = String(value || '').match(/^(\d{1,2}):(\d{2})\s*-\s*(\d{1,2}):(\d{2})$/)
|
|
544
|
+
const start = match ? String(match[1]).padStart(2, '0') + ':' + match[2] : ''
|
|
545
|
+
const end = match ? String(match[3]).padStart(2, '0') + ':' + match[4] : ''
|
|
546
|
+
const write = (nextStart, nextEnd) => onChange(nextStart && nextEnd ? nextStart + '-' + nextEnd : '')
|
|
547
|
+
const overnight = Boolean(start && end && end <= start)
|
|
548
|
+
return h('div', { className: 'dt-hours' },
|
|
549
|
+
h('input', {
|
|
550
|
+
id, type: 'time', className: 'dt-time', value: start, 'aria-label': '起始时间', disabled,
|
|
551
|
+
onChange: (event) => write(event.target.value, end || '23:00'),
|
|
552
|
+
}),
|
|
553
|
+
h('span', { className: 'dt-hours-sep' }, '→'),
|
|
554
|
+
h('input', {
|
|
555
|
+
id: id ? id + '-end' : undefined, type: 'time', className: 'dt-time', value: end, 'aria-label': '结束时间', disabled,
|
|
556
|
+
onChange: (event) => write(start || '09:00', event.target.value),
|
|
557
|
+
}),
|
|
558
|
+
value
|
|
559
|
+
? h('button', {
|
|
560
|
+
type: 'button', className: 'dt-btn dt-btn-sm dt-btn-ghost', disabled,
|
|
561
|
+
onClick: () => onChange(''),
|
|
562
|
+
}, '全天')
|
|
563
|
+
: h('span', { className: 'dt-hours-hint' }, '留空 = 全天'),
|
|
564
|
+
overnight ? h('span', { className: 'dt-hours-hint' }, '跨夜窗口') : null)
|
|
565
|
+
}
|
|
566
|
+
|
|
567
|
+
function WatcherSwitch({ spec, value, onChange, disabled, id }) {
|
|
568
|
+
return h('div', { className: 'dt-switch-row' },
|
|
569
|
+
h('div', { className: 'dt-field-head' }, h('span', null, spec.label), spec.hint ? h(InfoTip, { text: spec.hint }) : null),
|
|
570
|
+
h(Toggle, { id, checked: !!value, onChange, label: spec.label, disabled }),
|
|
571
|
+
// 隔离的回收语义原本是可见说明,不能因迁移到 SwitchRow 而藏进 tooltip。
|
|
572
|
+
spec.key === 'isolated' ? h('span', { className: 'dt-hint' }, spec.hint) : null)
|
|
573
|
+
}
|
|
574
|
+
|
|
575
|
+
function WatcherPriority({ value, onChange, disabled, idPrefix }) {
|
|
576
|
+
const items = [
|
|
577
|
+
['priorityReopened', '重开优先', '被重开的排最前'],
|
|
578
|
+
['priorityComments', '评论优先', '有人在等回应的靠前'],
|
|
579
|
+
['priorityLabels', '标签优先', '带标签的靠前'],
|
|
580
|
+
['priorityUnassigned', '未认领优先', '没人认领的靠前(默认关:这是我们的判断,不是规则)'],
|
|
581
|
+
['priorityStale', '积压优先', '躺了 30 天以上的靠前(默认关,只展示)'],
|
|
582
|
+
]
|
|
583
|
+
return h('div', { className: 'dt-actions' },
|
|
584
|
+
h('div', { className: 'dt-field-head' }, h('span', null, PRIORITY_LABEL),
|
|
585
|
+
h(InfoTip, { text: '全部关掉时按 GitHub 的「最近更新」顺序处理' })),
|
|
586
|
+
h('div', { className: 'dt-actions' }, items.map(([key, label, hint]) => h('div', { className: 'dt-switch-row', key },
|
|
587
|
+
h('div', { className: 'dt-field-head' }, h('span', null, hint)),
|
|
588
|
+
h(Toggle, { id: idPrefix + '-' + key, checked: key === 'priorityUnassigned' || key === 'priorityStale' ? value[key] === true : value[key] !== false,
|
|
589
|
+
onChange: (next) => onChange(key, next), label, disabled })))))
|
|
590
|
+
}
|
|
591
|
+
|
|
592
|
+
function WatcherForm({ mode = 'edit', idPrefix = 'watcher', value, snapshot, defaults = {}, disabled = false,
|
|
593
|
+
onChange, onSave, onDiscard, submitLabel = '保存', sessionId }) {
|
|
594
|
+
const [advancedOpen, setAdvancedOpen] = useState(false)
|
|
595
|
+
const [busy, setBusy] = useState(false)
|
|
596
|
+
const [error, setError] = useState(null)
|
|
597
|
+
const busyRef = useRef(false)
|
|
598
|
+
const values = value || {}
|
|
599
|
+
const opening = snapshot || values
|
|
600
|
+
const dirty = watcherDirty(values, opening)
|
|
601
|
+
const change = (key, next) => { setError(null); onChange(key, next) }
|
|
602
|
+
const submit = async (event) => {
|
|
603
|
+
if (event && typeof event.preventDefault === 'function') event.preventDefault()
|
|
604
|
+
// 原生点击保存时仍执行 constraints;测试桩没有 form,直接走同一提交函数。
|
|
605
|
+
const form = event && event.currentTarget && event.currentTarget.form
|
|
606
|
+
if (form && typeof form.checkValidity === 'function' && !form.checkValidity()) return false
|
|
607
|
+
if (busyRef.current || disabled || (mode === 'edit' && !dirty)) return false
|
|
608
|
+
if (mode === 'create' && (!sessionId || !String(values.repo || '').trim())) return false
|
|
609
|
+
busyRef.current = true
|
|
610
|
+
setBusy(true)
|
|
611
|
+
setError(null)
|
|
612
|
+
try {
|
|
613
|
+
const result = await onSave(values)
|
|
614
|
+
if (result === false) throw new Error('保存失败,请重试')
|
|
615
|
+
return result
|
|
616
|
+
} catch (failure) {
|
|
617
|
+
setError(String((failure && failure.message) || failure || '保存失败,请重试'))
|
|
618
|
+
return false
|
|
619
|
+
} finally {
|
|
620
|
+
busyRef.current = false
|
|
621
|
+
setBusy(false)
|
|
622
|
+
}
|
|
623
|
+
}
|
|
624
|
+
const discard = () => {
|
|
625
|
+
if (busyRef.current) return
|
|
626
|
+
setError(null)
|
|
627
|
+
onDiscard(opening)
|
|
628
|
+
}
|
|
629
|
+
const renderField = (spec) => {
|
|
630
|
+
if (spec.modes && !spec.modes.includes(mode)) return null
|
|
631
|
+
if (spec.when && !spec.when(values)) return null
|
|
632
|
+
const id = idPrefix + '-' + spec.key
|
|
633
|
+
if (spec.kind === 'switch') {
|
|
634
|
+
return h(WatcherSwitch, { key: spec.key, spec, value: values[spec.key], disabled: busy || disabled, id,
|
|
635
|
+
onChange: (next) => change(spec.key, next) })
|
|
636
|
+
}
|
|
637
|
+
if (spec.kind === 'priority') {
|
|
638
|
+
return h(WatcherPriority, { key: spec.key, value: values, disabled: busy || disabled, idPrefix,
|
|
639
|
+
onChange: change })
|
|
640
|
+
}
|
|
641
|
+
const common = {
|
|
642
|
+
value: spec.kind === 'hours' ? (values[spec.key] || '') : watcherNumberText(values[spec.key]),
|
|
643
|
+
disabled: busy || disabled,
|
|
644
|
+
onChange: (next) => change(spec.key, next),
|
|
645
|
+
}
|
|
646
|
+
const control = spec.kind === 'hours'
|
|
647
|
+
? h(HoursField, common)
|
|
648
|
+
: h(Input, {
|
|
649
|
+
type: spec.kind === 'number' ? 'number' : 'text',
|
|
650
|
+
value: common.value,
|
|
651
|
+
min: spec.min, max: spec.max, step: spec.kind === 'number' ? 1 : undefined,
|
|
652
|
+
required: !!spec.required,
|
|
653
|
+
placeholder: typeof spec.placeholder === 'function' ? spec.placeholder(defaults) : spec.placeholder,
|
|
654
|
+
disabled: busy || disabled,
|
|
655
|
+
onChange: (event) => change(spec.key, event.target.value),
|
|
656
|
+
})
|
|
657
|
+
return h(Field, { key: spec.key, id, label: spec.label, hint: spec.hint, note: spec.note }, control)
|
|
658
|
+
}
|
|
659
|
+
const basic = WATCHER_FIELD_SCHEMA.filter((spec) => !spec.advanced).map(renderField)
|
|
660
|
+
const advanced = WATCHER_FIELD_SCHEMA.filter((spec) => spec.advanced).map(renderField)
|
|
661
|
+
const collapsedAdvanced = h('span', { className: 'dt-row-meta' },
|
|
662
|
+
h('span', { className: 'dt-hint' }, '限额、优先级与隔离保留策略'),
|
|
663
|
+
// 收起时只展示默认值摘要,不挂载高级 input;默认值仍来自 /state.defaults。
|
|
664
|
+
WATCHER_FIELD_SCHEMA.filter((spec) => spec.advanced && spec.kind === 'number').map((spec) => {
|
|
665
|
+
const placeholder = typeof spec.placeholder === 'function' ? spec.placeholder(defaults) : spec.placeholder
|
|
666
|
+
return h('span', { key: spec.key, className: 'dt-hint', placeholder }, spec.label + ' ' + placeholder)
|
|
667
|
+
}))
|
|
668
|
+
const submitFromClick = (event) => submit(event)
|
|
669
|
+
return h('form', { id: idPrefix, className: 'dt-form', 'data-mode': mode, onSubmit: submit },
|
|
670
|
+
h(Fields, { disabled: busy || disabled },
|
|
671
|
+
basic,
|
|
672
|
+
h(DisclosureRow, {
|
|
673
|
+
icon: h(Icon, { name: 'settings' }), title: '高级设置', open: advancedOpen,
|
|
674
|
+
onToggle: () => { if (!busy && !disabled) setAdvancedOpen(!advancedOpen) },
|
|
675
|
+
collapsedContent: collapsedAdvanced,
|
|
676
|
+
}, h('div', { className: 'dt-disclosure-body' }, advanced))),
|
|
677
|
+
h(SaveBar, { dirty, busy, error, disabled, onDiscard: discard, onSave: submitFromClick, saveLabel: submitLabel }),
|
|
678
|
+
// 新建空白表单也要给入口;开始输入后由 SaveBar 接管,不在屏幕上重复两个提交按钮。
|
|
679
|
+
mode === 'create' && !dirty && !busy && !error
|
|
680
|
+
? h('div', { className: 'dt-actions' }, h(Btn, {
|
|
681
|
+
variant: 'primary', icon: h(Icon, { name: 'plus' }), type: 'submit', onClick: submitFromClick,
|
|
682
|
+
'aria-label': submitLabel, disabled: disabled || !String(values.repo || '').trim(),
|
|
683
|
+
}, submitLabel))
|
|
684
|
+
: null)
|
|
685
|
+
}
|
|
686
|
+
|
|
435
687
|
function KeyValues({ rows }) {
|
|
436
688
|
return h('dl', { className: 'dt-kv' },
|
|
437
689
|
rows.filter(Boolean).flatMap(([key, value]) => [
|
|
@@ -1056,18 +1308,10 @@ window.__ModuleLoader__.load({
|
|
|
1056
1308
|
'cap-watcher': '撞单守上限',
|
|
1057
1309
|
busy: '会话忙',
|
|
1058
1310
|
}
|
|
1059
|
-
// 新建与编辑共用:同一个输入提示写两份,改一处忘另一处就会漂移(文案门禁会拦)。
|
|
1060
|
-
const AUTHOR_LIST_PLACEHOLDER = 'GitHub 登录名,逗号分隔,留空 = 谁都算'
|
|
1061
|
-
|
|
1062
1311
|
const [snap, setSnap] = useState({ loading: true, error: null, body: null })
|
|
1063
1312
|
const [tab, setTab] = useState('overview')
|
|
1064
1313
|
const [notice, setNotice] = useState(null)
|
|
1065
|
-
const [form, setForm] = useState({
|
|
1066
|
-
repo: '', intervalSec: '60', goal: '', labels: '', onlyAssigned: false,
|
|
1067
|
-
activeHours: '', isolated: false, workdir: '',
|
|
1068
|
-
// 新建时就要能定:先建再改会多一步,尤其隔离区天数/数量不该先用默认值跑一轮。
|
|
1069
|
-
allowAuthors: '', sessionMaxWakes: '', isolateKeepDays: '', maxIsolated: '',
|
|
1070
|
-
})
|
|
1314
|
+
const [form, setForm] = useState({ ...CREATE_WATCHER_VALUES })
|
|
1071
1315
|
const [token, setToken] = useState('')
|
|
1072
1316
|
const [goalDraft, setGoalDraft] = useState('')
|
|
1073
1317
|
const [goalTouched, setGoalTouched] = useState(false)
|
|
@@ -1088,12 +1332,22 @@ window.__ModuleLoader__.load({
|
|
|
1088
1332
|
// 审核 M2:记下「这次编辑真的改过哪些字段」—— 保存时只发改过的,
|
|
1089
1333
|
// 否则全量 PUT 会把别处刚改的值按打开那一刻的旧快照写回(lost update)。
|
|
1090
1334
|
const touchedRef = useRef(new Set())
|
|
1335
|
+
const createTouchedRef = useRef(new Set())
|
|
1336
|
+
const createSnapshotRef = useRef({ ...CREATE_WATCHER_VALUES })
|
|
1337
|
+
const editSnapshotRef = useRef(null)
|
|
1091
1338
|
const setField = (next) => {
|
|
1339
|
+
const opening = editSnapshotRef.current && editSnapshotRef.current.values
|
|
1092
1340
|
for (const key of Object.keys(next)) {
|
|
1093
|
-
if (next[key]
|
|
1341
|
+
if (opening && watcherSameValue(next[key], opening[key])) touchedRef.current.delete(key)
|
|
1342
|
+
else if (next[key] !== draft[key]) touchedRef.current.add(key)
|
|
1094
1343
|
}
|
|
1095
1344
|
setDraft(next)
|
|
1096
1345
|
}
|
|
1346
|
+
const setCreateField = (key, value) => {
|
|
1347
|
+
if (watcherSameValue(value, createSnapshotRef.current[key])) createTouchedRef.current.delete(key)
|
|
1348
|
+
else createTouchedRef.current.add(key)
|
|
1349
|
+
setForm({ ...form, [key]: value })
|
|
1350
|
+
}
|
|
1097
1351
|
const [search, setSearch] = useState('')
|
|
1098
1352
|
const [glossary, setGlossary] = useState(false)
|
|
1099
1353
|
// 版本检查结果(只读):面板里直接告诉客户「有没有新版本、该跑什么命令」
|
|
@@ -1170,10 +1424,15 @@ window.__ModuleLoader__.load({
|
|
|
1170
1424
|
}, [goalTouched, sessionGoal])
|
|
1171
1425
|
|
|
1172
1426
|
const busyRef = useRef(false)
|
|
1173
|
-
const run = async (work, done) => {
|
|
1427
|
+
const run = async (work, done, options = {}) => {
|
|
1174
1428
|
// 审核 T22 B3:上一件事没跑完时点了会**静默丢弃**(界面毫无反应,客户以为按钮坏了)。
|
|
1175
1429
|
// 至少说一句「还在处理」—— 不说的话没人知道该等。
|
|
1176
|
-
if (busyRef.current) {
|
|
1430
|
+
if (busyRef.current) {
|
|
1431
|
+
const error = new Error('上一件事还在处理,请稍等再点')
|
|
1432
|
+
setNotice({ ok: false, text: error.message })
|
|
1433
|
+
if (options.rethrow) throw error
|
|
1434
|
+
return false
|
|
1435
|
+
}
|
|
1177
1436
|
busyRef.current = true
|
|
1178
1437
|
setNotice(null)
|
|
1179
1438
|
try {
|
|
@@ -1188,6 +1447,8 @@ window.__ModuleLoader__.load({
|
|
|
1188
1447
|
// 审核 T22 B3:失败后不回读 —— 批量操作「一半成功一半失败」时 UI 停在旧状态,
|
|
1189
1448
|
// 客户看到的是「全都失败了」。回读一次,让已经成功的那些如实显示。
|
|
1190
1449
|
try { await load() } catch { /* 回读失败不影响错误提示本身 */ }
|
|
1450
|
+
// WatcherForm 需要原始错误来留在自己的 SaveBar;其它动作保留旧的 false 契约。
|
|
1451
|
+
if (options.rethrow) throw error
|
|
1191
1452
|
return false
|
|
1192
1453
|
} finally {
|
|
1193
1454
|
busyRef.current = false
|
|
@@ -1198,30 +1459,28 @@ window.__ModuleLoader__.load({
|
|
|
1198
1459
|
const saveEdit = (watcher) => run(async () => {
|
|
1199
1460
|
await call('/watch', {
|
|
1200
1461
|
method: 'POST',
|
|
1201
|
-
//
|
|
1202
|
-
// 以前是全量 PUT:别处刚改的 intervalSec / goal 会被打开那一刻的旧快照静默覆盖。
|
|
1462
|
+
// 只发 touched 字段;repo/sessionId 只是现有 /watch 的定位键,不是全量快照。
|
|
1203
1463
|
body: JSON.stringify((() => {
|
|
1204
|
-
const full = {
|
|
1464
|
+
const full = {
|
|
1205
1465
|
repo: watcher.repo,
|
|
1206
1466
|
sessionId: watcher.sessionId,
|
|
1207
|
-
intervalSec:
|
|
1467
|
+
intervalSec: numberOrUndefined(draft.intervalSec) ?? watcher.intervalSec,
|
|
1208
1468
|
filters: {
|
|
1209
|
-
labels: String(draft.labels
|
|
1469
|
+
labels: String(draft.labels ?? '').split(',').map((v) => v.trim()).filter(Boolean),
|
|
1210
1470
|
// filters 整块发送,三个名单都必须带上,否则改标签会顺带清空另外两项。
|
|
1211
|
-
ignoreLabels: String(draft.ignoreLabels
|
|
1471
|
+
ignoreLabels: String(draft.ignoreLabels ?? '').split(',').map((v) => v.trim()).filter(Boolean),
|
|
1212
1472
|
onlyAssigned: !!draft.onlyAssigned,
|
|
1213
|
-
assignee: String(draft.assignee
|
|
1214
|
-
allowAuthors: String(draft.allowAuthors
|
|
1473
|
+
assignee: String(draft.assignee ?? '').trim().replace(/^@/, '') || null,
|
|
1474
|
+
allowAuthors: String(draft.allowAuthors ?? '').split(',').map((v) => v.trim().replace(/^@/, '')).filter(Boolean),
|
|
1215
1475
|
},
|
|
1216
1476
|
activeHours: draft.activeHours || '',
|
|
1217
1477
|
goal: draft.goal || '',
|
|
1218
|
-
|
|
1219
|
-
ackLabel: String(draft.ackLabel || '').trim() || undefined,
|
|
1478
|
+
ackLabel: String(draft.ackLabel ?? '').trim() || undefined,
|
|
1220
1479
|
isolated: !!draft.isolated,
|
|
1221
1480
|
workdir: draft.workdir || '',
|
|
1222
1481
|
observe: !!draft.observe,
|
|
1223
|
-
isolateKeepDays:
|
|
1224
|
-
maxIsolated:
|
|
1482
|
+
isolateKeepDays: numberOrUndefined(draft.isolateKeepDays),
|
|
1483
|
+
maxIsolated: numberOrUndefined(draft.maxIsolated),
|
|
1225
1484
|
priority: {
|
|
1226
1485
|
reopened: draft.priorityReopened !== false,
|
|
1227
1486
|
comments: draft.priorityComments !== false,
|
|
@@ -1229,13 +1488,11 @@ window.__ModuleLoader__.load({
|
|
|
1229
1488
|
unassigned: draft.priorityUnassigned === true,
|
|
1230
1489
|
stale: draft.priorityStale === true,
|
|
1231
1490
|
},
|
|
1232
|
-
batchLimit:
|
|
1233
|
-
maxWakesPerHour:
|
|
1234
|
-
sessionMaxWakes:
|
|
1491
|
+
batchLimit: numberOrUndefined(draft.batchLimit),
|
|
1492
|
+
maxWakesPerHour: numberOrUndefined(draft.maxWakesPerHour),
|
|
1493
|
+
sessionMaxWakes: numberOrUndefined(draft.sessionMaxWakes),
|
|
1235
1494
|
}
|
|
1236
|
-
//
|
|
1237
|
-
// 而 full 的键是**字段名**(filters / priority)—— 两套名字对不上,这几个控件就永远发不出去,
|
|
1238
|
-
// 而 Toast 照样说「已保存」。这里显式做一次「控件名 → 字段名」的映射。
|
|
1495
|
+
// 控件名 → API 字段名:一个 filters/priority 子项被触碰时保留整块其它原值。
|
|
1239
1496
|
const CONTROL_TO_FIELD = {
|
|
1240
1497
|
labels: "filters",
|
|
1241
1498
|
ignoreLabels: "filters",
|
|
@@ -1260,7 +1517,9 @@ window.__ModuleLoader__.load({
|
|
|
1260
1517
|
})()),
|
|
1261
1518
|
})
|
|
1262
1519
|
setEditing(null)
|
|
1263
|
-
|
|
1520
|
+
touchedRef.current = new Set()
|
|
1521
|
+
editSnapshotRef.current = null
|
|
1522
|
+
}, '已保存:' + watcher.repo, { rethrow: true })
|
|
1264
1523
|
|
|
1265
1524
|
const act = (watcher, action) => run(async () => {
|
|
1266
1525
|
await call('/watch', { method: 'POST', body: JSON.stringify({ action, id: watcherId(watcher) }) })
|
|
@@ -1282,37 +1541,55 @@ window.__ModuleLoader__.load({
|
|
|
1282
1541
|
}, action === 'pause' ? '全部已暂停' : '全部已恢复')
|
|
1283
1542
|
|
|
1284
1543
|
const addWatcher = () => run(async () => {
|
|
1544
|
+
const value = { ...CREATE_WATCHER_VALUES, ...form }
|
|
1285
1545
|
const created = await call('/watch', {
|
|
1286
1546
|
method: 'POST',
|
|
1287
|
-
body: JSON.stringify({
|
|
1288
|
-
|
|
1289
|
-
|
|
1290
|
-
|
|
1291
|
-
|
|
1292
|
-
|
|
1293
|
-
|
|
1294
|
-
|
|
1295
|
-
|
|
1296
|
-
|
|
1297
|
-
|
|
1298
|
-
|
|
1299
|
-
|
|
1300
|
-
|
|
1301
|
-
|
|
1302
|
-
|
|
1303
|
-
|
|
1304
|
-
|
|
1305
|
-
|
|
1306
|
-
|
|
1547
|
+
body: JSON.stringify((() => {
|
|
1548
|
+
const valueDirty = (key) => createTouchedRef.current.has(key) || !watcherSameValue(value[key], createSnapshotRef.current[key])
|
|
1549
|
+
const payload = { repo: value.repo.trim(), sessionId }
|
|
1550
|
+
// 新建也必须只提交实际输入过的配置;服务端负责未提供项的默认值。
|
|
1551
|
+
if (valueDirty('intervalSec')) payload.intervalSec = numberOrUndefined(value.intervalSec) ?? 60
|
|
1552
|
+
if (valueDirty('goal')) payload.goal = value.goal || ''
|
|
1553
|
+
if (['labels', 'ignoreLabels', 'onlyAssigned', 'assignee', 'allowAuthors'].some(valueDirty)) {
|
|
1554
|
+
payload.filters = {
|
|
1555
|
+
labels: String(value.labels ?? '').split(',').map((v) => v.trim()).filter(Boolean),
|
|
1556
|
+
ignoreLabels: String(value.ignoreLabels ?? '').split(',').map((v) => v.trim()).filter(Boolean),
|
|
1557
|
+
onlyAssigned: !!value.onlyAssigned,
|
|
1558
|
+
assignee: String(value.assignee ?? '').trim().replace(/^@/, '') || null,
|
|
1559
|
+
allowAuthors: String(value.allowAuthors ?? '').split(',').map((v) => v.trim().replace(/^@/, '')).filter(Boolean),
|
|
1560
|
+
}
|
|
1561
|
+
}
|
|
1562
|
+
if (valueDirty('activeHours')) payload.activeHours = value.activeHours || ''
|
|
1563
|
+
if (valueDirty('ackLabel')) payload.ackLabel = String(value.ackLabel ?? '').trim() || undefined
|
|
1564
|
+
if (valueDirty('isolated')) payload.isolated = !!value.isolated
|
|
1565
|
+
if (valueDirty('workdir')) payload.workdir = value.workdir || ''
|
|
1566
|
+
if (valueDirty('observe')) payload.observe = !!value.observe
|
|
1567
|
+
if (['priorityReopened', 'priorityComments', 'priorityLabels', 'priorityUnassigned', 'priorityStale'].some(valueDirty)) {
|
|
1568
|
+
payload.priority = {
|
|
1569
|
+
reopened: value.priorityReopened !== false,
|
|
1570
|
+
comments: value.priorityComments !== false,
|
|
1571
|
+
labels: value.priorityLabels !== false,
|
|
1572
|
+
unassigned: value.priorityUnassigned === true,
|
|
1573
|
+
stale: value.priorityStale === true,
|
|
1574
|
+
}
|
|
1575
|
+
}
|
|
1576
|
+
for (const key of ['batchLimit', 'maxWakesPerHour', 'sessionMaxWakes', 'isolateKeepDays', 'maxIsolated']) {
|
|
1577
|
+
if (valueDirty(key)) payload[key] = numberOrUndefined(value[key])
|
|
1578
|
+
}
|
|
1579
|
+
return payload
|
|
1580
|
+
})()),
|
|
1307
1581
|
})
|
|
1308
|
-
//
|
|
1309
|
-
|
|
1310
|
-
|
|
1582
|
+
// 只重置既定仓库相关字段;限额、隔离策略和时段保留,连续添加不用重填。
|
|
1583
|
+
const nextForm = { ...form, repo: '', goal: '', labels: '', onlyAssigned: false, allowAuthors: '' }
|
|
1584
|
+
setForm(nextForm)
|
|
1585
|
+
// 这些保留下来的值已经由本次 /watch 保存,成为下一次新增的全新基线。
|
|
1586
|
+
createSnapshotRef.current = { ...CREATE_WATCHER_VALUES, ...nextForm }
|
|
1587
|
+
createTouchedRef.current = new Set()
|
|
1311
1588
|
const warnings = (created && Array.isArray(created.warnings)) ? created.warnings : []
|
|
1312
1589
|
if (warnings.length > 0) notify('已添加,但注意:' + warnings.join(' / '), 'error')
|
|
1313
1590
|
else notify('已添加,首轮立即开始轮询', 'info')
|
|
1314
1591
|
return warnings
|
|
1315
|
-
}, null)
|
|
1592
|
+
}, null, { rethrow: true })
|
|
1316
1593
|
|
|
1317
1594
|
const saveCredentials = () => run(async () => {
|
|
1318
1595
|
const payload = {}
|
|
@@ -1387,8 +1664,9 @@ window.__ModuleLoader__.load({
|
|
|
1387
1664
|
'aria-expanded': editing === key, onClick: () => {
|
|
1388
1665
|
setEditing(editing === key ? null : key)
|
|
1389
1666
|
touchedRef.current = new Set()
|
|
1667
|
+
editSnapshotRef.current = editing === key ? null : { key, values: watcherValuesFrom(watcher) }
|
|
1390
1668
|
setDraft({
|
|
1391
|
-
intervalSec:
|
|
1669
|
+
intervalSec: watcherNumberText(watcher.intervalSec ?? 60),
|
|
1392
1670
|
labels: (watcher.filters && watcher.filters.labels ? watcher.filters.labels : []).join(','),
|
|
1393
1671
|
ignoreLabels: (watcher.filters && watcher.filters.ignoreLabels ? watcher.filters.ignoreLabels : []).join(','),
|
|
1394
1672
|
assignee: (watcher.filters && watcher.filters.assignee) || '',
|
|
@@ -1403,11 +1681,11 @@ window.__ModuleLoader__.load({
|
|
|
1403
1681
|
observe: !!watcher.observe,
|
|
1404
1682
|
isolated: !!watcher.isolated,
|
|
1405
1683
|
workdir: watcher.workdir || '',
|
|
1406
|
-
batchLimit:
|
|
1407
|
-
maxWakesPerHour:
|
|
1408
|
-
sessionMaxWakes:
|
|
1409
|
-
isolateKeepDays:
|
|
1410
|
-
maxIsolated:
|
|
1684
|
+
batchLimit: watcherNumberText(watcher.batchLimit),
|
|
1685
|
+
maxWakesPerHour: watcherNumberText(watcher.maxWakesPerHour),
|
|
1686
|
+
sessionMaxWakes: watcherNumberText(watcher.sessionMaxWakes),
|
|
1687
|
+
isolateKeepDays: watcherNumberText(watcher.isolateKeepDays),
|
|
1688
|
+
maxIsolated: watcherNumberText(watcher.maxIsolated),
|
|
1411
1689
|
priorityReopened: (watcher.priority && watcher.priority.reopened) !== false,
|
|
1412
1690
|
priorityComments: (watcher.priority && watcher.priority.comments) !== false,
|
|
1413
1691
|
priorityLabels: (watcher.priority && watcher.priority.labels) !== false,
|
|
@@ -1501,35 +1779,23 @@ window.__ModuleLoader__.load({
|
|
|
1501
1779
|
size: 'sm', variant: 'ghost', icon: h(Icon, { name: 'trash' }), label: '删除',
|
|
1502
1780
|
confirmLabel: '确认删除', onConfirm: () => act(watcher, 'delete'),
|
|
1503
1781
|
})))
|
|
1782
|
+
const opening = editSnapshotRef.current && editSnapshotRef.current.key === key
|
|
1783
|
+
? editSnapshotRef.current.values
|
|
1784
|
+
: watcherValuesFrom(watcher)
|
|
1785
|
+
const editorValue = { ...opening, ...draft }
|
|
1504
1786
|
const editor = editing === key
|
|
1505
|
-
? h(
|
|
1506
|
-
|
|
1507
|
-
|
|
1508
|
-
|
|
1509
|
-
|
|
1510
|
-
|
|
1511
|
-
|
|
1512
|
-
|
|
1513
|
-
|
|
1514
|
-
|
|
1515
|
-
|
|
1516
|
-
|
|
1517
|
-
field('每小时最多唤醒次数', h(Input, { value: draft.maxWakesPerHour || '', placeholder: String(DEFAULTS.maxWakesPerHour || 6) + '(1-60)', onChange: (e) => setField({ ...draft, maxWakesPerHour: e.target.value }) })),
|
|
1518
|
-
field('这条会话每小时最多被唤醒', h(Input, { value: draft.sessionMaxWakes || '', placeholder: String(DEFAULTS.sessionMaxWakes || 12) + '(1-60)', onChange: (e) => setField({ ...draft, sessionMaxWakes: e.target.value }) }), '跨所有守累计:守 5 个仓库时,光有单守上限挡不住叠加'),
|
|
1519
|
-
field('优先级(在「单次最多唤醒条数」内先挑谁)', h('div', { className: 'dt-actions' },
|
|
1520
|
-
h('label', { className: 'dt-switch-row' }, h(Toggle, { checked: draft.priorityReopened !== false, onChange: (v) => setField({ ...draft, priorityReopened: v }), label: '重开优先' }), '被重开的排最前'),
|
|
1521
|
-
h('label', { className: 'dt-switch-row' }, h(Toggle, { checked: draft.priorityComments !== false, onChange: (v) => setField({ ...draft, priorityComments: v }), label: '评论优先' }), '有人在等回应的靠前'),
|
|
1522
|
-
h('label', { className: 'dt-switch-row' }, h(Toggle, { checked: draft.priorityLabels !== false, onChange: (v) => setField({ ...draft, priorityLabels: v }), label: '标签优先' }), '带标签的靠前'),
|
|
1523
|
-
h('label', { className: 'dt-switch-row' }, h(Toggle, { checked: draft.priorityUnassigned === true, onChange: (v) => setField({ ...draft, priorityUnassigned: v }), label: '未认领优先' }), '没人认领的靠前(默认关:这是我们的判断,不是规则)'),
|
|
1524
|
-
h('label', { className: 'dt-switch-row' }, h(Toggle, { checked: draft.priorityStale === true, onChange: (v) => setField({ ...draft, priorityStale: v }), label: '积压优先' }), '躺了 30 天以上的靠前(默认关,只展示)')), '全部关掉时按 GitHub 的「最近更新」顺序处理'),
|
|
1525
|
-
h('label', { className: 'dt-switch-row' }, h(Toggle, { checked: !!draft.observe, onChange: (v) => setField({ ...draft, observe: v }), label: '仅观察' }), '仅观察(只记录不唤醒)'),
|
|
1526
|
-
h('label', { className: 'dt-switch-row' }, h(Toggle, { checked: !!draft.isolated, onChange: (v) => setField({ ...draft, isolated: v }), label: '隔离执行' }), ISOLATED_HINT),
|
|
1527
|
-
draft.isolated ? field('隔离工作目录', h(Input, { value: draft.workdir || '', placeholder: '绝对路径,留空 = 当前工作目录', onChange: (e) => setField({ ...draft, workdir: e.target.value }) })) : null,
|
|
1528
|
-
draft.isolated ? field('隔离区保留天数', h(Input, { value: draft.isolateKeepDays || '', placeholder: String(DEFAULTS.isolateKeepDays || 3) + '(1-30)', onChange: (e) => setField({ ...draft, isolateKeepDays: e.target.value }) }), '每次唤醒前回收这个天数之前的一次性工作区;留空用默认 ' + (DEFAULTS.isolateKeepDays || 3) + ' 天') : null,
|
|
1529
|
-
draft.isolated ? field('最多保留几个隔离区', h(Input, { value: draft.maxIsolated || '', placeholder: '5(1-50)', onChange: (e) => setField({ ...draft, maxIsolated: e.target.value }) }), '天数之外的第二道线:超出就回收最旧的(不影响正在用的那个)') : null,
|
|
1530
|
-
h('div', { className: 'dt-actions' },
|
|
1531
|
-
h(Btn, { size: 'sm', variant: 'primary', onClick: () => saveEdit(watcher) }, '保存'),
|
|
1532
|
-
h(Btn, { size: 'sm', onClick: () => setEditing(null) }, '放弃')))
|
|
1787
|
+
? h(WatcherForm, {
|
|
1788
|
+
mode: 'edit', idPrefix: 'watcher-edit-' + encodeURIComponent(key),
|
|
1789
|
+
value: editorValue, snapshot: opening, defaults: DEFAULTS, sessionId,
|
|
1790
|
+
submitLabel: '保存',
|
|
1791
|
+
onChange: (name, next) => setField({ ...draft, [name]: next }),
|
|
1792
|
+
onSave: () => saveEdit(watcher),
|
|
1793
|
+
onDiscard: (snapshot) => {
|
|
1794
|
+
setDraft({ ...snapshot })
|
|
1795
|
+
touchedRef.current = new Set()
|
|
1796
|
+
setNotice(null)
|
|
1797
|
+
},
|
|
1798
|
+
})
|
|
1533
1799
|
: null
|
|
1534
1800
|
// 官方 TicketLine 是 <li class="dt-row dt-link dt-ticket"> 里套「状态列 + 正文列」,
|
|
1535
1801
|
// 展开的表单跟在正文列里,不破坏两列网格。
|
|
@@ -1969,25 +2235,18 @@ window.__ModuleLoader__.load({
|
|
|
1969
2235
|
group.errors > 0 ? h('span', { className: 'dt-error-text' }, group.errors + ' 条报错') : null))))))
|
|
1970
2236
|
|
|
1971
2237
|
const trigger = h(Section, { title: '新增主理鱼' },
|
|
1972
|
-
h(
|
|
1973
|
-
|
|
1974
|
-
|
|
1975
|
-
|
|
1976
|
-
|
|
1977
|
-
|
|
1978
|
-
|
|
1979
|
-
|
|
1980
|
-
|
|
1981
|
-
|
|
1982
|
-
|
|
1983
|
-
|
|
1984
|
-
h('label', { className: 'dt-switch-row' }, h(Toggle, { checked: form.isolated, onChange: (v) => setForm({ ...form, isolated: v }), label: '隔离执行' }), ISOLATED_HINT),
|
|
1985
|
-
form.isolated ? field('隔离工作目录', h(Input, { value: form.workdir, placeholder: '绝对路径,留空 = 当前工作目录', onChange: (e) => setForm({ ...form, workdir: e.target.value }) })) : null,
|
|
1986
|
-
form.isolated ? field('隔离区保留天数', h(Input, { value: form.isolateKeepDays || '', placeholder: String(DEFAULTS.isolateKeepDays || 3) + '(1-30)', onChange: (e) => setForm({ ...form, isolateKeepDays: e.target.value }) }), '每次唤醒前回收这个天数之前的一次性工作区') : null,
|
|
1987
|
-
form.isolated ? field('最多保留几个隔离区', h(Input, { value: form.maxIsolated || '', placeholder: '5(1-50)', onChange: (e) => setForm({ ...form, maxIsolated: e.target.value }) }), '超出就回收最旧的,不影响正在使用的那个') : null,
|
|
1988
|
-
h('div', { className: 'dt-actions' },
|
|
1989
|
-
h(Btn, { variant: 'primary', icon: h(Icon, { name: 'plus' }), onClick: addWatcher, disabled: !sessionId || !form.repo.trim() },
|
|
1990
|
-
sessionId ? '添加到当前会话' : '先打开一个会话'))))
|
|
2238
|
+
h(WatcherForm, {
|
|
2239
|
+
mode: 'create', idPrefix: 'watcher-new', value: { ...CREATE_WATCHER_VALUES, ...form },
|
|
2240
|
+
snapshot: createSnapshotRef.current, defaults: DEFAULTS, disabled: !sessionId, sessionId,
|
|
2241
|
+
submitLabel: sessionId ? '添加到当前会话' : '先打开一个会话',
|
|
2242
|
+
onChange: setCreateField,
|
|
2243
|
+
onSave: addWatcher,
|
|
2244
|
+
onDiscard: () => {
|
|
2245
|
+
setForm({ ...createSnapshotRef.current })
|
|
2246
|
+
createTouchedRef.current = new Set()
|
|
2247
|
+
setNotice(null)
|
|
2248
|
+
},
|
|
2249
|
+
}))
|
|
1991
2250
|
|
|
1992
2251
|
// 「仓库」行:先给条数,再看名字;超过 3 条截断成「… 等」。
|
|
1993
2252
|
// 原先用 ", " 把三个 owner/name 粘成一行(实测 518px / 可用 541px),
|
|
@@ -2251,42 +2510,9 @@ window.__ModuleLoader__.load({
|
|
|
2251
2510
|
return (value / 1024 / 1024 / 1024).toFixed(2) + ' GB'
|
|
2252
2511
|
}
|
|
2253
2512
|
|
|
2254
|
-
//
|
|
2255
|
-
// 我们之前只有 label,说明只能塞进 placeholder —— 用户看不到「这个字段到底什么意思」。
|
|
2256
|
-
/**
|
|
2257
|
-
* 活跃时段:两个原生时间选择器(起 / 止),不再让人手打 "09:00-23:00"。
|
|
2258
|
-
* 空 = 全天;止 <= 起 表示跨夜(22:00-06:00),提示里会写出来。
|
|
2259
|
-
*/
|
|
2260
|
-
function HoursField({ value, onChange }) {
|
|
2261
|
-
const match = String(value || '').match(/^(\d{1,2}):(\d{2})\s*-\s*(\d{1,2}):(\d{2})$/)
|
|
2262
|
-
const start = match ? String(match[1]).padStart(2, '0') + ':' + match[2] : ''
|
|
2263
|
-
const end = match ? String(match[3]).padStart(2, '0') + ':' + match[4] : ''
|
|
2264
|
-
const write = (nextStart, nextEnd) => onChange(nextStart && nextEnd ? nextStart + '-' + nextEnd : '')
|
|
2265
|
-
const overnight = Boolean(start && end && end <= start)
|
|
2266
|
-
return h('div', { className: 'dt-hours' },
|
|
2267
|
-
h('input', {
|
|
2268
|
-
type: 'time', className: 'dt-time', value: start, 'aria-label': '起始时间',
|
|
2269
|
-
onChange: (e) => write(e.target.value, end || '23:00'),
|
|
2270
|
-
}),
|
|
2271
|
-
h('span', { className: 'dt-hours-sep' }, '→'),
|
|
2272
|
-
h('input', {
|
|
2273
|
-
type: 'time', className: 'dt-time', value: end, 'aria-label': '结束时间',
|
|
2274
|
-
onChange: (e) => write(start || '09:00', e.target.value),
|
|
2275
|
-
}),
|
|
2276
|
-
value
|
|
2277
|
-
? h('button', {
|
|
2278
|
-
type: 'button', className: 'dt-btn dt-btn-sm dt-btn-ghost',
|
|
2279
|
-
onClick: () => onChange(''),
|
|
2280
|
-
}, '全天')
|
|
2281
|
-
: h('span', { className: 'dt-hours-hint' }, '留空 = 全天'),
|
|
2282
|
-
overnight ? h('span', { className: 'dt-hours-hint' }, '跨夜窗口') : null)
|
|
2283
|
-
}
|
|
2284
|
-
|
|
2513
|
+
// 设置页的旧调用面保留,但 DOM 也统一走共享 Field,避免再生成嵌套 label。
|
|
2285
2514
|
function field(label, control, hint, note) {
|
|
2286
|
-
return h(
|
|
2287
|
-
h('span', { className: 'dt-field-head' }, label, hint ? h(InfoTip, { text: hint }) : null),
|
|
2288
|
-
control,
|
|
2289
|
-
note ? h('small', null, note) : null)
|
|
2515
|
+
return h(Field, { key: label, label, hint, note }, control)
|
|
2290
2516
|
}
|
|
2291
2517
|
|
|
2292
2518
|
return h('div', { className: 'dt-page' },
|
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.266'
|
|
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.266",
|
|
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",
|
|
@@ -9,7 +9,8 @@
|
|
|
9
9
|
"./watch": "./lib/watch.js",
|
|
10
10
|
"./redact": "./lib/redact.js",
|
|
11
11
|
"./package.json": "./package.json",
|
|
12
|
-
"./client": "./client.js"
|
|
12
|
+
"./client": "./client.js",
|
|
13
|
+
"./host-primitives": "./ui-host-primitives.js"
|
|
13
14
|
},
|
|
14
15
|
"files": [
|
|
15
16
|
"lib/index.js",
|
|
@@ -25,6 +26,7 @@
|
|
|
25
26
|
"CHANGELOG.md",
|
|
26
27
|
"LICENSE",
|
|
27
28
|
"client.js",
|
|
29
|
+
"ui-host-primitives.js",
|
|
28
30
|
"bin/check.mjs",
|
|
29
31
|
"assets/icon-180.png",
|
|
30
32
|
"docs/whats-new-0.9.md",
|
|
@@ -0,0 +1,111 @@
|
|
|
1
|
+
// L84d:DSH 宿主原语的薄适配层。
|
|
2
|
+
// 这里只转换调用面,不实现焦点圈、portal、定位、计时或第二套弹层。
|
|
3
|
+
|
|
4
|
+
const TOOLTIP_ICONS = Object.freeze({
|
|
5
|
+
question: 'IconQuestionOutlineMedium',
|
|
6
|
+
info: 'IconInfoOutlineMedium',
|
|
7
|
+
warn: 'IconWarningOutlineMedium',
|
|
8
|
+
warning: 'IconWarningOutlineMedium',
|
|
9
|
+
alert: 'IconWarningOutlineMedium',
|
|
10
|
+
})
|
|
11
|
+
|
|
12
|
+
/** 只清除 id 仍相同的 Toast;旧 Toast 的完成回调不能清除新通知。 */
|
|
13
|
+
export function dismissToast(current, id) {
|
|
14
|
+
return current && current.id === id ? null : current
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
/**
|
|
18
|
+
* 用宿主注入的 React 与 @deepseek-ai/dsh-client-ui-primitives 创建适配器。
|
|
19
|
+
* 原语必须由调用方通过 factory require 取得;本模块不做文件系统包解析。
|
|
20
|
+
*/
|
|
21
|
+
export function createHostUi({ React, primitives } = {}) {
|
|
22
|
+
if (!React || typeof React.createElement !== 'function' || typeof React.isValidElement !== 'function') {
|
|
23
|
+
throw new TypeError('createHostUi 需要宿主 React.createElement 与 React.isValidElement')
|
|
24
|
+
}
|
|
25
|
+
if (!primitives || (typeof primitives !== 'object' && typeof primitives !== 'function')) {
|
|
26
|
+
throw new TypeError('createHostUi 需要 DSH primitives')
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
const h = React.createElement
|
|
30
|
+
const primitive = (name) => {
|
|
31
|
+
const value = primitives[name]
|
|
32
|
+
if (!value) {
|
|
33
|
+
throw new Error(`DSH primitives.${name} 不可用;适配层不会创建替代弹层`)
|
|
34
|
+
}
|
|
35
|
+
return value
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
function Modal({ open, title, description, footer, onClose, className, children } = {}) {
|
|
39
|
+
if (!open) return null
|
|
40
|
+
return h(primitive('Modal'), {
|
|
41
|
+
open,
|
|
42
|
+
title,
|
|
43
|
+
description,
|
|
44
|
+
footer,
|
|
45
|
+
onClose,
|
|
46
|
+
className,
|
|
47
|
+
closeLabel: '关闭',
|
|
48
|
+
}, children)
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
function Toast({ item, onDone } = {}) {
|
|
52
|
+
if (item === null || item === undefined) return null
|
|
53
|
+
return h(primitive('Toast'), {
|
|
54
|
+
key: item.id,
|
|
55
|
+
text: item.text,
|
|
56
|
+
tone: item.tone,
|
|
57
|
+
holdMs: 3000,
|
|
58
|
+
// success 由宿主生成内建勾;error 必须显式使用官方 warning icon。
|
|
59
|
+
icon: item.tone === 'error' ? h(primitive('IconWarningOutlineMedium')) : undefined,
|
|
60
|
+
// 宿主 onDone 不带参数;这里只把完成项 id 交回调用方做 id guard。
|
|
61
|
+
onDone: () => onDone(item.id),
|
|
62
|
+
})
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
const defaultTooltipIcon = (icon) => {
|
|
66
|
+
if (React.isValidElement(icon)) return icon
|
|
67
|
+
// 与现有 InfoTip 一样,未识别的字符串回退到 question,但不自绘 SVG。
|
|
68
|
+
const exportName = TOOLTIP_ICONS[icon] || TOOLTIP_ICONS.question
|
|
69
|
+
return h(primitive(exportName))
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
function Tooltip({ text, icon = 'question', warn = false, children } = {}) {
|
|
73
|
+
const HostTooltip = primitive('Tooltip')
|
|
74
|
+
// children 可替换 trigger;省略时保留 InfoTip 的 button / dt-info 调用面。
|
|
75
|
+
const trigger = children === undefined
|
|
76
|
+
? h('button', {
|
|
77
|
+
type: 'button',
|
|
78
|
+
className: ['dt-info', warn && 'dt-info-warn'].filter(Boolean).join(' '),
|
|
79
|
+
'aria-label': text,
|
|
80
|
+
}, defaultTooltipIcon(icon))
|
|
81
|
+
: children
|
|
82
|
+
if (!React.isValidElement(trigger)) {
|
|
83
|
+
throw new TypeError('Tooltip children 必须是单个 React element')
|
|
84
|
+
}
|
|
85
|
+
return h(HostTooltip, {
|
|
86
|
+
label: text,
|
|
87
|
+
side: 'top',
|
|
88
|
+
portal: true,
|
|
89
|
+
openOnClick: true,
|
|
90
|
+
gap: 8,
|
|
91
|
+
}, trigger)
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
// 无第二套 timer:notify 只替换当前项,dismiss 交给 Toast.onDone(id) 调用。
|
|
95
|
+
function createToastState() {
|
|
96
|
+
const [item, setItem] = React.useState(null)
|
|
97
|
+
const sequence = React.useRef(0)
|
|
98
|
+
const notify = React.useCallback((text, tone = 'info') => {
|
|
99
|
+
sequence.current += 1
|
|
100
|
+
const id = sequence.current
|
|
101
|
+
setItem({ id, text, tone })
|
|
102
|
+
return id
|
|
103
|
+
}, [])
|
|
104
|
+
const dismiss = React.useCallback((id) => {
|
|
105
|
+
setItem((current) => dismissToast(current, id))
|
|
106
|
+
}, [])
|
|
107
|
+
return { item, notify, dismiss }
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
return { Modal, Toast, Tooltip, createToastState, dismissToast }
|
|
111
|
+
}
|