@laraveladmin/dsh-stay-awake 0.2.0 → 0.2.2
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 +19 -0
- package/README.en.md +3 -3
- package/README.md +3 -3
- package/client.js +89 -109
- package/docs/VERIFICATION.md +17 -1
- package/docs/images/indicator.svg +7 -9
- package/docs/images/panel.svg +58 -56
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,24 @@
|
|
|
1
1
|
# 变更记录 · Changelog
|
|
2
2
|
|
|
3
|
+
## 0.2.2 — 2026-12-03
|
|
4
|
+
|
|
5
|
+
### 修复
|
|
6
|
+
|
|
7
|
+
- 按实际宿主浮层(如「Token 用量」)再对齐:标题行右侧数值使用 `label-primary`,
|
|
8
|
+
去掉自加的关闭按钮(与宿主一致:Esc / 点外部关闭),移除分组间的额外界线,只保留标题下一条细分隔线。
|
|
9
|
+
|
|
10
|
+
## 0.2.1 — 2026-12-03
|
|
11
|
+
|
|
12
|
+
### 修复
|
|
13
|
+
|
|
14
|
+
- 设置弹层改为**锚定在状态栏触发点上方弹出**(CSS anchor positioning,DSH 自身的统计弹层用同一机制),
|
|
15
|
+
桌面端右侧、窄屏自动翻转;不再固定在窗口底部居中,避免与其它功能点交互不一致。
|
|
16
|
+
- 弹层表面改用 DSH 浮动面板的统一 token:`--dsw-specific-menu` 背景 + `--dsw-menu-backdrop-filter` +
|
|
17
|
+
`--dsw-elevation-prominent` 阴影 + `--dsw-radius-lg` 圆角 + 16px 内边距,标题/字段排版对齐宿主弹层。
|
|
18
|
+
- 状态栏触发点改为与 `activity` / `usage` 一致的 pill 样式(`--dsw-radius-sm`、`1px 8px` 内边距、
|
|
19
|
+
`label-tertiary` 文字、hover/展开态 `--dsw-alias-interactive-bg-hover` 背景)。
|
|
20
|
+
- 多语言:中英字典逐键核对(42 键、双向对称、无硬编码文案、英文无中文残留),清理 3 个失效键。
|
|
21
|
+
|
|
3
22
|
## 0.2.0 — 2026-12-03
|
|
4
23
|
|
|
5
24
|
### 新功能
|
package/README.en.md
CHANGED
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
`@laraveladmin/dsh-stay-awake` · macOS / Windows / Linux
|
|
8
8
|
|
|
9
9
|
<p>
|
|
10
|
-
<img alt="version" src="https://img.shields.io/badge/version-0.2.
|
|
10
|
+
<img alt="version" src="https://img.shields.io/badge/version-0.2.2-blue">
|
|
11
11
|
<img alt="platform" src="https://img.shields.io/badge/platform-macOS%20%7C%20Windows%20%7C%20Linux-4c6ef5">
|
|
12
12
|
<img alt="license" src="https://img.shields.io/badge/license-MIT-green">
|
|
13
13
|
</p>
|
|
@@ -63,7 +63,7 @@ A short alert when a task finishes, played on the machine that runs the DSH host
|
|
|
63
63
|
|
|
64
64
|
**Requirements**: DSH 0.2.x (Desktop or `dsh web`). The plugin has no third-party runtime dependencies and needs no Node toolchain.
|
|
65
65
|
|
|
66
|
-
Published on npm: [`@laraveladmin/dsh-stay-awake@0.2.
|
|
66
|
+
Published on npm: [`@laraveladmin/dsh-stay-awake@0.2.2`](https://www.npmjs.com/package/@laraveladmin/dsh-stay-awake)
|
|
67
67
|
|
|
68
68
|
### Option 1 — install from npm (recommended)
|
|
69
69
|
|
|
@@ -143,7 +143,7 @@ Invalid values fall back to their defaults with a warning; a bad config never bl
|
|
|
143
143
|
|
|
144
144
|
### Settings panel
|
|
145
145
|
|
|
146
|
-
Clicking the icon or the "Stay awake" label opens a panel
|
|
146
|
+
Clicking the icon or the "Stay awake" label opens a panel **above the status bar**, using the same surface, radius, shadow and typography as the shipped `activity` / `usage` popovers:
|
|
147
147
|
|
|
148
148
|
| Control | Effect |
|
|
149
149
|
|---|---|
|
package/README.md
CHANGED
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
`@laraveladmin/dsh-stay-awake` · macOS / Windows / Linux
|
|
8
8
|
|
|
9
9
|
<p>
|
|
10
|
-
<img alt="version" src="https://img.shields.io/badge/version-0.2.
|
|
10
|
+
<img alt="version" src="https://img.shields.io/badge/version-0.2.2-blue">
|
|
11
11
|
<img alt="platform" src="https://img.shields.io/badge/platform-macOS%20%7C%20Windows%20%7C%20Linux-4c6ef5">
|
|
12
12
|
<img alt="license" src="https://img.shields.io/badge/license-MIT-green">
|
|
13
13
|
</p>
|
|
@@ -64,7 +64,7 @@ DSH 跑长任务时你离开电脑,系统按空闲策略休眠:进程被挂
|
|
|
64
64
|
|
|
65
65
|
**前置条件**:DSH 0.2.x(Desktop 或 `dsh web`)。插件零第三方运行时依赖,不需要 Node 工具链。
|
|
66
66
|
|
|
67
|
-
已发布到 npm:[`@laraveladmin/dsh-stay-awake@0.2.
|
|
67
|
+
已发布到 npm:[`@laraveladmin/dsh-stay-awake@0.2.2`](https://www.npmjs.com/package/@laraveladmin/dsh-stay-awake)
|
|
68
68
|
|
|
69
69
|
### 方式一:从 npm 安装(推荐)
|
|
70
70
|
|
|
@@ -144,7 +144,7 @@ plugin_manager action: install_bundle target: @laraveladmin/dsh-stay-awake
|
|
|
144
144
|
|
|
145
145
|
### 设置弹层
|
|
146
146
|
|
|
147
|
-
|
|
147
|
+
点状态栏的「守夜」图标或文字,面板会从状态栏**右侧上方弹出**,与 `activity` / `usage` 的弹层使用同一套表面、圆角、阴影与排版(DSH 的浮动面板样式):
|
|
148
148
|
|
|
149
149
|
| 项 | 作用 |
|
|
150
150
|
|---|---|
|
package/client.js
CHANGED
|
@@ -34,14 +34,11 @@ window.__ModuleLoader__.load({
|
|
|
34
34
|
'state.failed': '异常',
|
|
35
35
|
'state.disabled': '已关闭',
|
|
36
36
|
'state.unknown': '状态未知',
|
|
37
|
-
'detail.state': '状态',
|
|
38
37
|
'detail.backend': '后端',
|
|
39
38
|
'detail.scope': '范围',
|
|
40
39
|
'detail.sources': '活跃源',
|
|
41
40
|
'detail.since': '已持续',
|
|
42
41
|
'detail.error': '原因',
|
|
43
|
-
'detail.version': '版本',
|
|
44
|
-
'link.repo': '查看源码',
|
|
45
42
|
'sources.agents': '会话',
|
|
46
43
|
'sources.maintenance': '维护',
|
|
47
44
|
'sources.jobs': '后台任务',
|
|
@@ -66,7 +63,6 @@ window.__ModuleLoader__.load({
|
|
|
66
63
|
'panel.saved': '已保存',
|
|
67
64
|
'panel.saveFailed': '保存失败,请重试',
|
|
68
65
|
'panel.staleHost': '宿主端未加载最新版本:请在插件页禁用再启用「守夜」,或重启 DSH',
|
|
69
|
-
'panel.close': '关闭',
|
|
70
66
|
'panel.advanced': '防抖、兜底时长等高级参数在 profile 的 cordis.patch.yml 中配置',
|
|
71
67
|
'panel.repo': '打开代码仓库',
|
|
72
68
|
'panel.npm': '在 npm 查看该版本',
|
|
@@ -81,14 +77,11 @@ window.__ModuleLoader__.load({
|
|
|
81
77
|
'state.failed': 'Error',
|
|
82
78
|
'state.disabled': 'Off',
|
|
83
79
|
'state.unknown': 'Unknown',
|
|
84
|
-
'detail.state': 'State',
|
|
85
80
|
'detail.backend': 'Backend',
|
|
86
81
|
'detail.scope': 'Scope',
|
|
87
82
|
'detail.sources': 'Sources',
|
|
88
83
|
'detail.since': 'Held for',
|
|
89
84
|
'detail.error': 'Reason',
|
|
90
|
-
'detail.version': 'Version',
|
|
91
|
-
'link.repo': 'View source',
|
|
92
85
|
'sources.agents': 'Agents',
|
|
93
86
|
'sources.maintenance': 'Maintenance',
|
|
94
87
|
'sources.jobs': 'Jobs',
|
|
@@ -113,47 +106,58 @@ window.__ModuleLoader__.load({
|
|
|
113
106
|
'panel.saved': 'Saved',
|
|
114
107
|
'panel.saveFailed': 'Could not save, please retry',
|
|
115
108
|
'panel.staleHost': 'The host half is running an older build: disable and re-enable Stay awake in Plugins, or restart DSH',
|
|
116
|
-
'panel.close': 'Close',
|
|
117
109
|
'panel.advanced': 'Debounce, hold cap and other advanced options live in the profile cordis.patch.yml',
|
|
118
110
|
'panel.repo': 'Open the source repository',
|
|
119
111
|
'panel.npm': 'View this version on npm',
|
|
120
112
|
}
|
|
121
113
|
|
|
122
114
|
const CSS = `
|
|
123
|
-
.dsa-
|
|
124
|
-
.dsa-
|
|
125
|
-
.dsa-
|
|
126
|
-
.dsa-
|
|
127
|
-
.dsa-
|
|
128
|
-
.dsa-
|
|
129
|
-
.dsa-
|
|
130
|
-
|
|
131
|
-
.dsa-
|
|
115
|
+
.dsa-pill{box-sizing:border-box;border-radius:var(--dsw-radius-sm);max-width:100%;color:var(--dsw-alias-label-tertiary);font:inherit;font-variant-numeric:tabular-nums;line-height:inherit;white-space:nowrap;background:0 0;border:none;align-items:center;gap:6px;padding:1px 8px;display:inline-flex;cursor:pointer;anchor-name:--dsh-stay-awake-panel}
|
|
116
|
+
.dsa-pill[aria-expanded="true"]{background:var(--dsw-alias-interactive-bg-hover);color:var(--dsw-alias-label-secondary)}
|
|
117
|
+
@media (hover:hover){.dsa-pill:hover{background:var(--dsw-alias-interactive-bg-hover);color:var(--dsw-alias-label-secondary)}}
|
|
118
|
+
.dsa-pill:focus-visible{outline:2px solid var(--dsw-alias-brand-primary);outline-offset:2px}
|
|
119
|
+
.dsa-pill svg{flex:none;width:14px;height:14px}
|
|
120
|
+
.dsa-label{text-overflow:ellipsis;min-width:0;overflow:hidden}
|
|
121
|
+
.dsa-panel{position:fixed;left:50%;bottom:150px;transform:translateX(-50%);z-index:1100;box-sizing:border-box;border:0;border-radius:var(--dsw-radius-lg);background:var(--dsw-specific-menu);backdrop-filter:var(--dsw-menu-backdrop-filter);--dsw-elevation-stroke-color:var(--dsw-alias-border-l1);box-shadow:var(--dsw-elevation-prominent);color:var(--dsw-alias-label-secondary);width:max-content;min-width:min(300px,100vw - 24px);max-width:min(440px,100vw - 24px);max-height:calc(100dvh - 24px);overflow:hidden auto;margin:0;padding:16px;font-size:12px;line-height:18px;cursor:default;pointer-events:auto;text-align:left}
|
|
122
|
+
@supports (position-anchor: --dsh-stay-awake-panel){
|
|
123
|
+
.dsa-panel{position-anchor:--dsh-stay-awake-panel;top:max(12px, var(--dsh-frame-overlay-top,12px));bottom:max(12px, calc(anchor(top) + 8px));left:max(12px, anchor(left));right:12px;transform:none;position-try-fallbacks:flip-block, flip-inline;max-height:calc(100dvh - 12px - max(12px, var(--dsh-frame-overlay-top,12px)))}
|
|
124
|
+
}
|
|
125
|
+
.dsa-head{display:flex;align-items:center;justify-content:space-between;gap:16px;margin-bottom:8px;color:var(--dsw-alias-label-primary);font-weight:500}
|
|
126
|
+
.dsa-head-label{display:inline-flex;align-items:center;gap:6px;min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
|
|
127
|
+
.dsa-head-label svg{flex:none;width:14px;height:14px}
|
|
128
|
+
.dsa-head-value{display:inline-flex;align-items:center;gap:8px;color:var(--dsw-alias-label-primary);font-weight:400;flex:none}
|
|
129
|
+
.dsa-state{font-variant-numeric:tabular-nums}
|
|
130
|
+
|
|
131
|
+
|
|
132
|
+
.dsa-rule{border-top:.5px solid var(--dsw-alias-border-l2);margin:0 0 10px}
|
|
133
|
+
.dsa-grid{display:grid;grid-template-columns:minmax(76px,auto) minmax(0,1fr);gap:6px 16px;margin:0}
|
|
134
|
+
.dsa-key{color:var(--dsw-alias-label-tertiary);margin:0;min-width:0}
|
|
135
|
+
.dsa-val{color:var(--dsw-alias-label-secondary);font-variant-numeric:tabular-nums;text-align:right;margin:0;min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
|
|
136
|
+
.dsa-section{margin-top:14px}
|
|
137
|
+
.dsa-row{display:flex;align-items:center;gap:12px;min-height:24px}
|
|
138
|
+
.dsa-row+.dsa-row{margin-top:6px}
|
|
132
139
|
.dsa-grow{flex:1 1 auto;min-width:0}
|
|
133
|
-
.dsa-
|
|
134
|
-
.dsa-switch{flex:0 0 auto;width:34px;height:18px;border-radius:9px;border:
|
|
140
|
+
.dsa-sub{color:var(--dsw-alias-label-tertiary);font-size:11px;line-height:16px}
|
|
141
|
+
.dsa-switch{flex:0 0 auto;width:34px;height:18px;border-radius:9px;border:0;background:var(--dsw-alias-state-idle-primary);position:relative;cursor:pointer;padding:0;transition:background .15s ease}
|
|
135
142
|
.dsa-switch::after{content:'';position:absolute;top:2px;left:2px;width:12px;height:12px;border-radius:50%;background:var(--dsw-alias-bg-base);transition:transform .15s ease}
|
|
136
|
-
.dsa-switch[aria-checked="true"]{background:var(--dsw-alias-state-success-primary)
|
|
143
|
+
.dsa-switch[aria-checked="true"]{background:var(--dsw-alias-state-success-primary)}
|
|
137
144
|
.dsa-switch[aria-checked="true"]::after{transform:translateX(16px)}
|
|
138
145
|
.dsa-switch:disabled{opacity:.5;cursor:default}
|
|
139
|
-
.dsa-
|
|
140
|
-
.dsa-
|
|
141
|
-
.dsa-button:
|
|
146
|
+
.dsa-switch:focus-visible{outline:2px solid var(--dsw-alias-brand-primary);outline-offset:2px}
|
|
147
|
+
.dsa-actions{display:flex;gap:6px;flex-wrap:wrap;margin-top:6px}
|
|
148
|
+
.dsa-button{border:0;background:var(--dsw-alias-bg-layer-2);color:var(--dsw-alias-label-primary);border-radius:var(--dsw-radius-sm);padding:4px 10px;cursor:pointer;font:inherit;line-height:16px}
|
|
149
|
+
.dsa-button:hover{background:var(--dsw-alias-interactive-bg-hover)}
|
|
142
150
|
.dsa-button:disabled{opacity:.5;cursor:default}
|
|
143
|
-
.dsa-button:focus-visible
|
|
144
|
-
.dsa-note{color:var(--dsw-alias-label-
|
|
151
|
+
.dsa-button:focus-visible{outline:2px solid var(--dsw-alias-brand-primary);outline-offset:2px}
|
|
152
|
+
.dsa-note{color:var(--dsw-alias-label-tertiary);margin-top:8px}
|
|
145
153
|
.dsa-error{color:var(--dsw-alias-state-error-primary)}
|
|
146
|
-
.dsa-foot{display:flex;gap:10px;align-items:center;margin-top:10px;
|
|
147
|
-
.dsa-foot .dsa-
|
|
148
|
-
.dsa-icon-link{display:inline-flex;align-items:center;justify-content:center;width:20px;height:20px;border-radius:
|
|
149
|
-
.dsa-icon-link:hover{background:var(--dsw-alias-bg-
|
|
150
|
-
.dsa-
|
|
151
|
-
.dsa-version
|
|
152
|
-
.dsa-
|
|
153
|
-
.dsa-link:hover{text-decoration:underline}
|
|
154
|
-
.dsa-line{display:inline-flex;align-items:center;gap:6px;min-width:0;white-space:nowrap;font-size:calc(var(--dsh-content-font-size-secondary,13px) - 1px);line-height:calc(20px + var(--dsh-content-font-delta-secondary,0px))}
|
|
155
|
-
.dsa-indicator{display:inline-flex;align-items:center;min-width:0;flex:0 1 auto;background:transparent;border:0;padding:0;font:inherit;cursor:pointer;border-radius:6px}
|
|
156
|
-
.dsa-indicator:focus-visible{outline:2px solid var(--dsw-alias-brand-primary);outline-offset:2px}
|
|
154
|
+
.dsa-foot{display:flex;gap:10px;align-items:center;margin-top:14px;padding-top:10px;border-top:.5px solid var(--dsw-alias-border-l2);color:var(--dsw-alias-label-tertiary);font-size:11px;line-height:16px}
|
|
155
|
+
.dsa-foot .dsa-grow{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
|
|
156
|
+
.dsa-icon-link{display:inline-flex;align-items:center;justify-content:center;width:20px;height:20px;border-radius:var(--dsw-radius-sm);color:var(--dsw-alias-label-tertiary);text-decoration:none;flex:none}
|
|
157
|
+
.dsa-icon-link:hover{background:var(--dsw-alias-interactive-bg-hover);color:var(--dsw-alias-label-secondary)}
|
|
158
|
+
.dsa-icon-link:focus-visible{outline:2px solid var(--dsw-alias-brand-primary);outline-offset:2px}
|
|
159
|
+
.dsa-version{color:var(--dsw-alias-label-tertiary);text-decoration:none;flex:none;font-variant-numeric:tabular-nums}
|
|
160
|
+
.dsa-version:hover{color:var(--dsw-alias-label-secondary);text-decoration:underline}
|
|
157
161
|
`
|
|
158
162
|
|
|
159
163
|
function createStore() {
|
|
@@ -296,10 +300,6 @@ window.__ModuleLoader__.load({
|
|
|
296
300
|
function Indicator({ store, t }) {
|
|
297
301
|
const snapshot = useStore(store)
|
|
298
302
|
const view = classify(snapshot.status, snapshot.failures)
|
|
299
|
-
const color = toneColor(view.tone)
|
|
300
|
-
const textColor = view.tone === 'error'
|
|
301
|
-
? 'var(--dsw-alias-state-error-primary)'
|
|
302
|
-
: 'var(--dsw-alias-label-secondary)'
|
|
303
303
|
return h(
|
|
304
304
|
React.Fragment,
|
|
305
305
|
null,
|
|
@@ -308,13 +308,13 @@ window.__ModuleLoader__.load({
|
|
|
308
308
|
'button',
|
|
309
309
|
{
|
|
310
310
|
type: 'button',
|
|
311
|
-
className: 'dsa-
|
|
311
|
+
className: 'dsa-pill dsa-root',
|
|
312
312
|
'aria-expanded': snapshot.open === true,
|
|
313
313
|
'aria-haspopup': 'dialog',
|
|
314
|
-
style: { color: textColor },
|
|
315
314
|
onClick: () => store.toggle(),
|
|
316
315
|
},
|
|
317
|
-
h(
|
|
316
|
+
h(Moon, { key: 'icon', color: toneColor(view.tone) }),
|
|
317
|
+
h('span', { key: 'label', className: 'dsa-label' }, `${t('brand')} · ${t(`state.${view.key}`)}`),
|
|
318
318
|
),
|
|
319
319
|
)
|
|
320
320
|
}
|
|
@@ -329,9 +329,9 @@ window.__ModuleLoader__.load({
|
|
|
329
329
|
const unreachable = status === null || failures >= UNKNOWN_AFTER_FAILURES
|
|
330
330
|
const enabled = status === null ? true : status.enabled !== false
|
|
331
331
|
const allowDisplaySleep = (status === null ? 'system' : status.scope) === 'system'
|
|
332
|
+
const soundOn = status === null ? true : status.sound !== false
|
|
332
333
|
const busy = snapshot.busy === true
|
|
333
334
|
const staleHost = status !== null && status.protocol !== 2
|
|
334
|
-
const soundOn = status === null ? true : status.sound !== false
|
|
335
335
|
const counts = status && status.counts ? status.counts : { agents: 0, maintenance: 0, jobs: 0 }
|
|
336
336
|
const holdLeft = status && typeof status.manualUntil === 'number' && status.manualUntil > Date.now()
|
|
337
337
|
? status.manualUntil - Date.now()
|
|
@@ -358,7 +358,6 @@ window.__ModuleLoader__.load({
|
|
|
358
358
|
if (!open) return null
|
|
359
359
|
|
|
360
360
|
const rows = [
|
|
361
|
-
[t('detail.state'), t(`state.${view.key}`)],
|
|
362
361
|
[t('detail.sources'), `${t('sources.agents')} ${counts.agents ?? 0} · ${t('sources.maintenance')} ${counts.maintenance ?? 0} · ${t('sources.jobs')} ${counts.jobs ?? 0}`],
|
|
363
362
|
[t('detail.scope'), allowDisplaySleep ? t('scope.system') : t('scope.display')],
|
|
364
363
|
[t('detail.backend'), status && status.backend ? status.backend : t('unit.none')],
|
|
@@ -370,6 +369,16 @@ window.__ModuleLoader__.load({
|
|
|
370
369
|
const reason = status !== null && !unreachable ? errorText(t, status) : null
|
|
371
370
|
if (reason !== null) rows.push([t('detail.error'), reason])
|
|
372
371
|
|
|
372
|
+
const switchOf = (checked, onClick, label, extraDisabled = false) => h('button', {
|
|
373
|
+
type: 'button',
|
|
374
|
+
className: 'dsa-switch',
|
|
375
|
+
role: 'switch',
|
|
376
|
+
'aria-checked': checked,
|
|
377
|
+
'aria-label': label,
|
|
378
|
+
disabled: busy || unreachable || extraDisabled,
|
|
379
|
+
onClick,
|
|
380
|
+
})
|
|
381
|
+
|
|
373
382
|
return h(
|
|
374
383
|
'div',
|
|
375
384
|
{ className: 'dsa-panel', role: 'dialog', 'aria-label': t('brand') },
|
|
@@ -377,41 +386,36 @@ window.__ModuleLoader__.load({
|
|
|
377
386
|
h(
|
|
378
387
|
'div',
|
|
379
388
|
{ className: 'dsa-head', key: 'head' },
|
|
380
|
-
h(
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
}, '×'),
|
|
388
|
-
),
|
|
389
|
-
h(
|
|
390
|
-
'div',
|
|
391
|
-
{ className: 'dsa-box', key: 'status' },
|
|
392
|
-
unreachable
|
|
393
|
-
? h('div', { className: 'dsa-note dsa-error' }, t('hint.unreachable'))
|
|
394
|
-
: h('div', { className: 'dsa-grid' }, rows.flatMap(([key, value], index) => [
|
|
395
|
-
h('div', { key: `k${index}`, className: 'dsa-key' }, key),
|
|
396
|
-
h('div', { key: `v${index}`, className: 'dsa-val', title: value }, value),
|
|
397
|
-
])),
|
|
389
|
+
h(
|
|
390
|
+
'span',
|
|
391
|
+
{ className: 'dsa-head-label' },
|
|
392
|
+
h(Moon, { key: 'icon', color: toneColor(view.tone) }),
|
|
393
|
+
t('brand'),
|
|
394
|
+
),
|
|
395
|
+
h('span', { className: 'dsa-head-value' }, h('span', { className: 'dsa-state' }, t(`state.${view.key}`))),
|
|
398
396
|
),
|
|
397
|
+
h('div', { className: 'dsa-rule', key: 'rule' }),
|
|
398
|
+
staleHost || snapshot.notice === 'stale'
|
|
399
|
+
? h('div', { className: 'dsa-note dsa-error', key: 'stale' }, t('panel.staleHost'))
|
|
400
|
+
: null,
|
|
401
|
+
unreachable
|
|
402
|
+
? h('div', { className: 'dsa-note dsa-error', key: 'unreachable' }, t('hint.unreachable'))
|
|
403
|
+
: h(
|
|
404
|
+
'dl',
|
|
405
|
+
{ className: 'dsa-grid', key: 'grid' },
|
|
406
|
+
rows.flatMap(([key, value], index) => [
|
|
407
|
+
h('dt', { key: `k${index}`, className: 'dsa-key' }, key),
|
|
408
|
+
h('dd', { key: `v${index}`, className: 'dsa-val', title: value }, value),
|
|
409
|
+
]),
|
|
410
|
+
),
|
|
399
411
|
h(
|
|
400
412
|
'div',
|
|
401
|
-
{ className: 'dsa-
|
|
413
|
+
{ className: 'dsa-section', key: 'switches' },
|
|
402
414
|
h(
|
|
403
415
|
'div',
|
|
404
416
|
{ className: 'dsa-row' },
|
|
405
417
|
h('span', { className: 'dsa-grow' }, t('panel.enabled')),
|
|
406
|
-
|
|
407
|
-
type: 'button',
|
|
408
|
-
className: 'dsa-switch',
|
|
409
|
-
role: 'switch',
|
|
410
|
-
'aria-checked': enabled,
|
|
411
|
-
'aria-label': t('panel.enabled'),
|
|
412
|
-
disabled: busy || unreachable,
|
|
413
|
-
onClick: () => act({ action: 'set-enabled', enabled: !enabled }),
|
|
414
|
-
}),
|
|
418
|
+
switchOf(enabled, () => act({ action: 'set-enabled', enabled: !enabled }), t('panel.enabled')),
|
|
415
419
|
),
|
|
416
420
|
h(
|
|
417
421
|
'div',
|
|
@@ -420,15 +424,7 @@ window.__ModuleLoader__.load({
|
|
|
420
424
|
h('div', null, t('panel.allowDisplaySleep')),
|
|
421
425
|
h('div', { className: 'dsa-sub' }, t('panel.allowDisplaySleepHint')),
|
|
422
426
|
),
|
|
423
|
-
|
|
424
|
-
type: 'button',
|
|
425
|
-
className: 'dsa-switch',
|
|
426
|
-
role: 'switch',
|
|
427
|
-
'aria-checked': allowDisplaySleep,
|
|
428
|
-
'aria-label': t('panel.allowDisplaySleep'),
|
|
429
|
-
disabled: busy || unreachable,
|
|
430
|
-
onClick: () => act({ action: 'set-scope', scope: allowDisplaySleep ? 'display' : 'system' }),
|
|
431
|
-
}),
|
|
427
|
+
switchOf(allowDisplaySleep, () => act({ action: 'set-scope', scope: allowDisplaySleep ? 'display' : 'system' }), t('panel.allowDisplaySleep')),
|
|
432
428
|
),
|
|
433
429
|
h(
|
|
434
430
|
'div',
|
|
@@ -440,60 +436,44 @@ window.__ModuleLoader__.load({
|
|
|
440
436
|
disabled: busy || unreachable,
|
|
441
437
|
onClick: () => act({ action: 'test-sound' }),
|
|
442
438
|
}, t('panel.testSound')),
|
|
443
|
-
|
|
444
|
-
type: 'button',
|
|
445
|
-
className: 'dsa-switch',
|
|
446
|
-
role: 'switch',
|
|
447
|
-
'aria-checked': soundOn,
|
|
448
|
-
'aria-label': t('panel.sound'),
|
|
449
|
-
disabled: busy || unreachable,
|
|
450
|
-
onClick: () => act({ action: 'set-sound', enabled: !soundOn }),
|
|
451
|
-
}),
|
|
439
|
+
switchOf(soundOn, () => act({ action: 'set-sound', enabled: !soundOn }), t('panel.sound')),
|
|
452
440
|
),
|
|
453
441
|
),
|
|
454
442
|
h(
|
|
455
443
|
'div',
|
|
456
|
-
{ className: 'dsa-
|
|
444
|
+
{ className: 'dsa-section', key: 'hold' },
|
|
457
445
|
h('div', { className: 'dsa-sub' }, t('panel.hold')),
|
|
458
446
|
h(
|
|
459
447
|
'div',
|
|
460
448
|
{ className: 'dsa-actions' },
|
|
461
449
|
h('button', {
|
|
462
|
-
type: 'button',
|
|
463
|
-
className: 'dsa-button',
|
|
450
|
+
type: 'button', className: 'dsa-button',
|
|
464
451
|
disabled: busy || unreachable || !enabled,
|
|
465
452
|
title: enabled ? undefined : t('panel.holdDisabled'),
|
|
466
453
|
onClick: () => act({ action: 'hold', minutes: 30 }),
|
|
467
454
|
}, t('panel.hold30')),
|
|
468
455
|
h('button', {
|
|
469
|
-
type: 'button',
|
|
470
|
-
className: 'dsa-button',
|
|
456
|
+
type: 'button', className: 'dsa-button',
|
|
471
457
|
disabled: busy || unreachable || !enabled,
|
|
472
458
|
title: enabled ? undefined : t('panel.holdDisabled'),
|
|
473
459
|
onClick: () => act({ action: 'hold', minutes: 120 }),
|
|
474
460
|
}, t('panel.hold120')),
|
|
475
|
-
holdLeft === null
|
|
476
|
-
|
|
477
|
-
:
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
disabled: busy || unreachable,
|
|
481
|
-
onClick: () => act({ action: 'cancel-hold' }),
|
|
482
|
-
}, t('panel.holdCancel')),
|
|
461
|
+
holdLeft === null ? null : h('button', {
|
|
462
|
+
type: 'button', className: 'dsa-button',
|
|
463
|
+
disabled: busy || unreachable,
|
|
464
|
+
onClick: () => act({ action: 'cancel-hold' }),
|
|
465
|
+
}, t('panel.holdCancel')),
|
|
483
466
|
),
|
|
484
467
|
snapshot.notice === 'saved'
|
|
485
468
|
? h('div', { className: 'dsa-note' }, t('panel.saved'))
|
|
486
469
|
: snapshot.notice === 'failed'
|
|
487
|
-
? h('div', { className: 'dsa-note dsa-error' }, t('panel.saveFailed'))
|
|
470
|
+
? h('div', { className: 'dsa-note dsa-error' }, `${t('panel.saveFailed')}${snapshot.noticeStatus ? ` (${snapshot.noticeStatus})` : ''}`)
|
|
488
471
|
: null,
|
|
489
472
|
),
|
|
490
473
|
h(
|
|
491
474
|
'div',
|
|
492
475
|
{ className: 'dsa-foot', key: 'foot' },
|
|
493
|
-
h('span', {
|
|
494
|
-
className: 'dsa-grow',
|
|
495
|
-
style: { overflow: 'hidden', textOverflow: 'ellipsis', whiteSpace: 'nowrap' },
|
|
496
|
-
}, t('panel.advanced')),
|
|
476
|
+
h('span', { className: 'dsa-grow', title: t('panel.advanced') }, t('panel.advanced')),
|
|
497
477
|
h('a', {
|
|
498
478
|
className: 'dsa-icon-link',
|
|
499
479
|
href: REPO_URL,
|
package/docs/VERIFICATION.md
CHANGED
|
@@ -107,7 +107,23 @@
|
|
|
107
107
|
- 真机(macOS):`createSound().play('success')` 返回 true,系统中出现
|
|
108
108
|
`64593 /usr/bin/afplay /System/Library/Sounds/Glass.aiff` 进程,说明命令拼装、系统音效文件与调度链路可用;
|
|
109
109
|
实际能否听见取决于音量与音频输出设备(用户确认)。
|
|
110
|
-
-
|
|
110
|
+
- 插件热重载:禁用再启用后宿主重新持有断言(`caffeinate -i -w 48389`,pid 64764),新宿主代码已生效;浏览器侧新开关需刷新页面后可见。
|
|
111
|
+
- **已发布 npm 0.2.0**:`dist-tags.latest = 0.2.0`,`dist.shasum = 219c56e84bc0c48023586967974638333e2eb2d1`;从干净的已提交工作树重建的 tarball 与该 shasum 完全一致,解包内容与 npm 拉取包逐文件相同;对发布包做冒烟:用户消息 → running → idle 触发一次 `success` 音效调用(SMOKE OK)。
|
|
112
|
+
- 未验证:Windows `SystemSounds` 与 Linux `paplay` 未在真机验证;新开关在亮/暗主题下的观感需目视确认;实际听觉(音量/输出设备)需用户确认。
|
|
113
|
+
|
|
114
|
+
## 0.2.1 界面统一与多语言核对(2026-12-03)
|
|
115
|
+
|
|
116
|
+
- **弹层位置与外观对齐宿主**:改用 CSS anchor positioning(DSH 内置统计弹层 `mR10tW_panel` 用的同一机制),
|
|
117
|
+
面板锚定在状态栏触发点上方 `anchor(top) + 8px`,`@supports` 不支持时回退到窗口底部居中;
|
|
118
|
+
表面改为 `--dsw-specific-menu` + `--dsw-menu-backdrop-filter` + `--dsw-elevation-prominent` +
|
|
119
|
+
`--dsw-radius-lg` + 16px 内边距,标题、分隔线、`dl` 字段网格与字段右对齐方式均照搬宿主样式。
|
|
120
|
+
- **触发点对齐**:改为宿主 dock pill 同款样式(`--dsw-radius-sm`、`1px 8px` 内边距、`label-tertiary` 文字、
|
|
121
|
+
hover 与 `aria-expanded` 时的 `--dsw-alias-interactive-bg-hover` 背景、14px 图标、6px 间距)。
|
|
122
|
+
- **多语言核对**:中英字典各 41 键、顺序与键集合完全一致,无缺失键、无未使用键、无空值、
|
|
123
|
+
英文值无中文残留;组件内无字典外的可见文案(CJK 扫描为空);插件管理器标题/描述由 `locale/zh.json`、
|
|
124
|
+
`locale/en.json` 提供。DSH 仅内置 zh/en,其它语言按 DSH 回退链落到英文。
|
|
125
|
+
- **自动化**:75 个单测/接线测试保持全绿;`npm pack` 产物 24 个文件。
|
|
126
|
+
- 未验证:弹层实际锚定位置与观感需刷新页面后目视确认(本会话无浏览器控制权)。
|
|
111
127
|
|
|
112
128
|
## 未验证(明确记录,不代替验证)
|
|
113
129
|
|
|
@@ -1,19 +1,17 @@
|
|
|
1
1
|
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 420 96" width="420" height="96" role="img" aria-label="状态栏指示器示意">
|
|
2
2
|
<rect width="420" height="96" rx="10" fill="#f7f8fa"/>
|
|
3
|
-
<text x="18" y="26" font-family="PingFang SC, Noto Sans SC, Helvetica, Arial, sans-serif" font-size="11" fill="#8a8f98"
|
|
3
|
+
<text x="18" y="26" font-family="PingFang SC, Noto Sans SC, Helvetica, Arial, sans-serif" font-size="11" fill="#8a8f98">输入框下方状态栏(与 activity / usage 同一排)</text>
|
|
4
4
|
|
|
5
|
-
<!--
|
|
5
|
+
<!-- composer dock line -->
|
|
6
6
|
<rect x="18" y="40" width="384" height="34" rx="8" fill="#ffffff" stroke="#e4e6eb"/>
|
|
7
7
|
<text x="34" y="61" font-family="PingFang SC, Noto Sans SC, Helvetica, Arial, sans-serif" font-size="11" fill="#b4b8c0">12.3k tokens · 2 个任务</text>
|
|
8
8
|
|
|
9
|
-
<!--
|
|
10
|
-
<g transform="translate(
|
|
11
|
-
<path d="
|
|
12
|
-
<text x="
|
|
13
|
-
<circle cx="116" cy="16" r="2.6" fill="#22c55e"/>
|
|
9
|
+
<!-- trigger pill: same pill styling as the shipped dock entries -->
|
|
10
|
+
<g transform="translate(258,46)">
|
|
11
|
+
<path d="M9 1.5a6 6 0 1 0 3.7 9A4.9 4.9 0 0 1 9 1.5z" fill="#22c55e" transform="scale(1.1)"/>
|
|
12
|
+
<text x="17" y="16" font-family="PingFang SC, Noto Sans SC, Helvetica, Arial, sans-serif" font-size="12" fill="#9aa0a8">守夜 · 保持中</text>
|
|
14
13
|
</g>
|
|
15
14
|
|
|
16
|
-
<!-- callouts -->
|
|
17
15
|
<line x1="300" y1="40" x2="300" y2="30" stroke="#c9ced6"/>
|
|
18
|
-
<text x="238" y="26" font-family="PingFang SC, Noto Sans SC, Helvetica, Arial, sans-serif" font-size="10" fill="#8a8f98"
|
|
16
|
+
<text x="238" y="26" font-family="PingFang SC, Noto Sans SC, Helvetica, Arial, sans-serif" font-size="10" fill="#8a8f98">点击在状态栏上方弹出面板</text>
|
|
19
17
|
</svg>
|
package/docs/images/panel.svg
CHANGED
|
@@ -1,71 +1,73 @@
|
|
|
1
|
-
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0
|
|
1
|
+
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 420 424" width="420" height="424" role="img" aria-label="设置弹层示意">
|
|
2
|
+
<defs>
|
|
3
|
+
<filter id="sh" x="-20%" y="-20%" width="140%" height="140%">
|
|
4
|
+
<feDropShadow dx="0" dy="8" stdDeviation="14" flood-color="#0b1220" flood-opacity="0.16"/>
|
|
5
|
+
</filter>
|
|
6
|
+
</defs>
|
|
2
7
|
<style>
|
|
3
|
-
.bg{fill:#eef0f3}
|
|
4
|
-
.panel{fill:#ffffff}
|
|
5
8
|
.t{font-family:"PingFang SC","Noto Sans SC",Helvetica,Arial,sans-serif}
|
|
6
|
-
.title{font-size:
|
|
7
|
-
.key{font-size:
|
|
8
|
-
.val{font-size:
|
|
9
|
-
.label{font-size:12px;fill:#
|
|
10
|
-
.sub{font-size:
|
|
11
|
-
.
|
|
12
|
-
.btntext{font-size:11px;fill:#3c4149}
|
|
9
|
+
.title{font-size:13px;font-weight:500;fill:#111827}
|
|
10
|
+
.key{font-size:12px;fill:#9aa0a8}
|
|
11
|
+
.val{font-size:12px;fill:#4b5563}
|
|
12
|
+
.label{font-size:12px;fill:#374151}
|
|
13
|
+
.sub{font-size:11px;fill:#9aa0a8}
|
|
14
|
+
.rule{stroke:#e5e7eb;stroke-width:1}
|
|
13
15
|
</style>
|
|
14
16
|
|
|
15
|
-
<rect
|
|
16
|
-
<rect class="panel" x="10" y="10" width="360" height="356" rx="12"/>
|
|
17
|
+
<rect width="420" height="424" fill="#eef0f3"/>
|
|
17
18
|
|
|
18
|
-
<!--
|
|
19
|
-
<
|
|
20
|
-
|
|
21
|
-
<
|
|
22
|
-
<
|
|
19
|
+
<!-- composer dock with the trigger pill, to show the anchor relationship -->
|
|
20
|
+
<rect x="30" y="30" width="360" height="30" rx="8" fill="#ffffff" stroke="#e4e6eb"/>
|
|
21
|
+
<g transform="translate(196,36)">
|
|
22
|
+
<path d="M9 1.5a6 6 0 1 0 3.7 9A4.9 4.9 0 0 1 9 1.5z" fill="#22c55e" transform="scale(1.1)"/>
|
|
23
|
+
<text class="t" x="16" y="15" font-size="12" fill="#9aa0a8">守夜 · 保持中</text>
|
|
23
24
|
</g>
|
|
24
|
-
<text class="t" x="352" y="40" font-size="15" fill="#9aa0a8" text-anchor="middle">×</text>
|
|
25
25
|
|
|
26
|
-
<!--
|
|
27
|
-
<g
|
|
28
|
-
<
|
|
29
|
-
<text class="key" x="24" y="92">活跃源</text><text class="val" x="86" y="92">会话 1 · 维护 0 · 后台任务 0</text>
|
|
30
|
-
<text class="key" x="24" y="112">范围</text><text class="val" x="86" y="112">仅系统</text>
|
|
31
|
-
<text class="key" x="24" y="132">后端</text><text class="val" x="86" y="132">caffeinate</text>
|
|
32
|
-
<text class="key" x="24" y="152">已持续</text><text class="val" x="86" y="152">00:12:31</text>
|
|
26
|
+
<!-- popover panel: anchored above the pill, host dialog styling -->
|
|
27
|
+
<g filter="url(#sh)">
|
|
28
|
+
<rect x="30" y="76" width="360" height="318" rx="12" fill="#ffffff"/>
|
|
33
29
|
</g>
|
|
34
|
-
|
|
35
|
-
<!-- toggles -->
|
|
36
30
|
<g class="t">
|
|
37
|
-
|
|
38
|
-
<
|
|
39
|
-
<
|
|
31
|
+
<!-- title row -->
|
|
32
|
+
<path d="M46 90a7 7 0 1 0 4.4 10.5A5.8 5.8 0 0 1 46 90z" fill="#22c55e"/>
|
|
33
|
+
<text class="t title" x="62" y="101">守夜</text>
|
|
34
|
+
<text class="t" x="300" y="101" text-anchor="end" font-size="13" fill="#111827">保持中</text>
|
|
35
|
+
<text class="t" x="352" y="102" text-anchor="middle" font-size="15" fill="#9aa0a8">×</text>
|
|
40
36
|
|
|
41
|
-
<
|
|
42
|
-
<text class="sub" x="24" y="222">只防系统休眠,屏幕按系统设置熄灭</text>
|
|
43
|
-
<rect x="320" y="196" width="34" height="18" rx="9" fill="#22c55e"/>
|
|
44
|
-
<circle cx="345" cy="205" r="6" fill="#ffffff"/>
|
|
37
|
+
<line class="rule" x1="46" y1="114" x2="374" y2="114"/>
|
|
45
38
|
|
|
46
|
-
|
|
47
|
-
<
|
|
48
|
-
<text class="
|
|
49
|
-
<
|
|
50
|
-
<
|
|
51
|
-
</g>
|
|
39
|
+
<!-- details grid -->
|
|
40
|
+
<text class="key" x="46" y="138">活跃源</text><text class="val" x="374" y="138" text-anchor="end">会话 1 · 维护 0 · 后台任务 0</text>
|
|
41
|
+
<text class="key" x="46" y="162">范围</text><text class="val" x="374" y="162" text-anchor="end">仅系统</text>
|
|
42
|
+
<text class="key" x="46" y="186">后端</text><text class="val" x="374" y="186" text-anchor="end">caffeinate</text>
|
|
43
|
+
<text class="key" x="46" y="210">已持续</text><text class="val" x="374" y="210" text-anchor="end">00:12:31</text>
|
|
52
44
|
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
<
|
|
56
|
-
<
|
|
57
|
-
<text class="btntext" x="56" y="297" text-anchor="middle">30 分钟</text>
|
|
58
|
-
<rect class="btn" x="94" y="282" width="58" height="22" rx="8"/>
|
|
59
|
-
<text class="btntext" x="123" y="297" text-anchor="middle">2 小时</text>
|
|
60
|
-
<rect class="btn" x="158" y="282" width="50" height="22" rx="8"/>
|
|
61
|
-
<text class="btntext" x="183" y="297" text-anchor="middle">取消</text>
|
|
62
|
-
</g>
|
|
45
|
+
<!-- switches -->
|
|
46
|
+
<text class="label" x="46" y="258">总开关</text>
|
|
47
|
+
<rect x="340" y="247" width="34" height="18" rx="9" fill="#22c55e"/>
|
|
48
|
+
<circle cx="365" cy="256" r="6" fill="#ffffff"/>
|
|
63
49
|
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
<
|
|
67
|
-
<
|
|
68
|
-
|
|
69
|
-
<text class="
|
|
50
|
+
<text class="label" x="46" y="286">允许屏幕休眠</text>
|
|
51
|
+
<text class="sub" x="46" y="301">只防系统休眠,屏幕按系统设置熄灭</text>
|
|
52
|
+
<rect x="340" y="275" width="34" height="18" rx="9" fill="#22c55e"/>
|
|
53
|
+
<circle cx="365" cy="284" r="6" fill="#ffffff"/>
|
|
54
|
+
|
|
55
|
+
<text class="label" x="46" y="330">完成提示音</text>
|
|
56
|
+
<rect x="266" y="317" width="56" height="22" rx="6" fill="#f3f4f6"/>
|
|
57
|
+
<text class="t" x="294" y="332" text-anchor="middle" font-size="12" fill="#374151">试听</text>
|
|
58
|
+
<rect x="340" y="319" width="34" height="18" rx="9" fill="#22c55e"/>
|
|
59
|
+
<circle cx="365" cy="328" r="6" fill="#ffffff"/>
|
|
60
|
+
|
|
61
|
+
<!-- hold -->
|
|
62
|
+
<text class="sub" x="46" y="368">临时保持</text>
|
|
63
|
+
<rect x="46" y="376" width="64" height="22" rx="6" fill="#f3f4f6"/>
|
|
64
|
+
<text class="t" x="78" y="391" text-anchor="middle" font-size="12" fill="#374151">30 分钟</text>
|
|
65
|
+
<rect x="116" y="376" width="58" height="22" rx="6" fill="#f3f4f6"/>
|
|
66
|
+
<text class="t" x="145" y="391" text-anchor="middle" font-size="12" fill="#374151">2 小时</text>
|
|
67
|
+
|
|
68
|
+
<line class="rule" x1="46" y1="410" x2="374" y2="410"/>
|
|
69
|
+
<text class="sub" x="46" y="428">防抖、音效等高级参数在 cordis.patch.yml 中配置</text>
|
|
70
|
+
<path d="M332 419 l-3 3.2 3 3.2 M338 419 l3 3.2 -3 3.2" fill="none" stroke="#9aa0a8" stroke-width="1.4" stroke-linecap="round" stroke-linejoin="round"/>
|
|
71
|
+
<text class="sub" x="352" y="428">v0.2.2</text>
|
|
70
72
|
</g>
|
|
71
73
|
</svg>
|