@laraveladmin/dsh-stay-awake 0.2.0 → 0.2.1

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 CHANGED
@@ -1,5 +1,17 @@
1
1
  # 变更记录 · Changelog
2
2
 
3
+ ## 0.2.1 — 2026-12-03
4
+
5
+ ### 修复
6
+
7
+ - 设置弹层改为**锚定在状态栏触发点上方弹出**(CSS anchor positioning,DSH 自身的统计弹层用同一机制),
8
+ 桌面端右侧、窄屏自动翻转;不再固定在窗口底部居中,避免与其它功能点交互不一致。
9
+ - 弹层表面改用 DSH 浮动面板的统一 token:`--dsw-specific-menu` 背景 + `--dsw-menu-backdrop-filter` +
10
+ `--dsw-elevation-prominent` 阴影 + `--dsw-radius-lg` 圆角 + 16px 内边距,标题/字段排版对齐宿主弹层。
11
+ - 状态栏触发点改为与 `activity` / `usage` 一致的 pill 样式(`--dsw-radius-sm`、`1px 8px` 内边距、
12
+ `label-tertiary` 文字、hover/展开态 `--dsw-alias-interactive-bg-hover` 背景)。
13
+ - 多语言:中英字典逐键核对(42 键、双向对称、无硬编码文案、英文无中文残留),清理 3 个失效键。
14
+
3
15
  ## 0.2.0 — 2026-12-03
4
16
 
5
17
  ### 新功能
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.0-blue">
10
+ <img alt="version" src="https://img.shields.io/badge/version-0.2.1-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.0`](https://www.npmjs.com/package/@laraveladmin/dsh-stay-awake)
66
+ Published on npm: [`@laraveladmin/dsh-stay-awake@0.2.1`](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 at the bottom of the window:
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.0-blue">
10
+ <img alt="version" src="https://img.shields.io/badge/version-0.2.1-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.0`](https://www.npmjs.com/package/@laraveladmin/dsh-stay-awake)
67
+ 已发布到 npm:[`@laraveladmin/dsh-stay-awake@0.2.1`](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': '后台任务',
@@ -81,14 +78,11 @@ window.__ModuleLoader__.load({
81
78
  'state.failed': 'Error',
82
79
  'state.disabled': 'Off',
83
80
  'state.unknown': 'Unknown',
84
- 'detail.state': 'State',
85
81
  'detail.backend': 'Backend',
86
82
  'detail.scope': 'Scope',
87
83
  'detail.sources': 'Sources',
88
84
  'detail.since': 'Held for',
89
85
  'detail.error': 'Reason',
90
- 'detail.version': 'Version',
91
- 'link.repo': 'View source',
92
86
  'sources.agents': 'Agents',
93
87
  'sources.maintenance': 'Maintenance',
94
88
  'sources.jobs': 'Jobs',
@@ -120,40 +114,52 @@ window.__ModuleLoader__.load({
120
114
  }
121
115
 
122
116
  const CSS = `
123
- .dsa-panel{position:fixed;left:50%;bottom:150px;transform:translateX(-50%);width:min(360px,calc(100vw - 24px));box-sizing:border-box;background:var(--dsw-alias-bg-overlay);color:var(--dsw-alias-label-primary);border-radius:12px;padding:10px 12px;z-index:80;pointer-events:auto;font-size:calc(var(--dsh-content-font-size-secondary,13px) - 1px);line-height:calc(19px + var(--dsh-content-font-delta-secondary,0px))}
124
- .dsa-head{display:flex;align-items:center;gap:8px}
125
- .dsa-sub{color:var(--dsw-alias-label-secondary);font-size:calc(var(--dsh-content-font-size-secondary,13px) - 2px)}
126
- .dsa-close{margin-left:auto;border:0;background:transparent;color:var(--dsw-alias-label-secondary);cursor:pointer;font-size:16px;line-height:1;padding:2px 4px;border-radius:6px}
127
- .dsa-close:hover{background:var(--dsw-alias-bg-layer-2);color:var(--dsw-alias-label-primary)}
128
- .dsa-box{margin-top:8px}
129
- .dsa-grid{display:grid;grid-template-columns:auto 1fr;gap:2px 12px}
130
- .dsa-key{color:var(--dsw-alias-label-secondary)}
131
- .dsa-val{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
117
+ .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}
118
+ .dsa-pill[aria-expanded="true"]{background:var(--dsw-alias-interactive-bg-hover);color:var(--dsw-alias-label-secondary)}
119
+ @media (hover:hover){.dsa-pill:hover{background:var(--dsw-alias-interactive-bg-hover);color:var(--dsw-alias-label-secondary)}}
120
+ .dsa-pill:focus-visible{outline:2px solid var(--dsw-alias-brand-primary);outline-offset:2px}
121
+ .dsa-pill svg{flex:none;width:14px;height:14px}
122
+ .dsa-label{text-overflow:ellipsis;min-width:0;overflow:hidden}
123
+ .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}
124
+ @supports (position-anchor: --dsh-stay-awake-panel){
125
+ .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)))}
126
+ }
127
+ .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}
128
+ .dsa-head-label{display:inline-flex;align-items:center;gap:6px;min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
129
+ .dsa-head-label svg{flex:none;width:14px;height:14px}
130
+ .dsa-head-value{display:inline-flex;align-items:center;gap:8px;color:var(--dsw-alias-label-tertiary);font-weight:400;flex:none}
131
+ .dsa-state{font-variant-numeric:tabular-nums}
132
+ .dsa-close{border:0;background:0 0;color:var(--dsw-alias-label-tertiary);cursor:pointer;font:inherit;line-height:1;padding:2px 4px;border-radius:var(--dsw-radius-sm);margin-right:-4px}
133
+ .dsa-close:hover{background:var(--dsw-alias-interactive-bg-hover);color:var(--dsw-alias-label-secondary)}
134
+ .dsa-rule{border-top:.5px solid var(--dsw-alias-border-l2);margin:0 0 10px}
135
+ .dsa-grid{display:grid;grid-template-columns:minmax(76px,auto) minmax(0,1fr);gap:6px 16px;margin:0}
136
+ .dsa-key{color:var(--dsw-alias-label-tertiary);margin:0;min-width:0}
137
+ .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}
138
+ .dsa-section{margin-top:14px;padding-top:12px;border-top:.5px solid var(--dsw-alias-border-l2)}
139
+ .dsa-row{display:flex;align-items:center;gap:12px;min-height:24px}
140
+ .dsa-row+.dsa-row{margin-top:6px}
132
141
  .dsa-grow{flex:1 1 auto;min-width:0}
133
- .dsa-row{display:flex;align-items:center;gap:10px;padding:4px 0}
134
- .dsa-switch{flex:0 0 auto;width:34px;height:18px;border-radius:9px;border:1px solid var(--dsw-alias-border-l2);background:var(--dsw-alias-state-idle-primary);position:relative;cursor:pointer;padding:0}
142
+ .dsa-sub{color:var(--dsw-alias-label-tertiary);font-size:11px;line-height:16px}
143
+ .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
144
  .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);border-color:var(--dsw-alias-state-success-primary)}
145
+ .dsa-switch[aria-checked="true"]{background:var(--dsw-alias-state-success-primary)}
137
146
  .dsa-switch[aria-checked="true"]::after{transform:translateX(16px)}
138
147
  .dsa-switch:disabled{opacity:.5;cursor:default}
139
- .dsa-actions{display:flex;gap:6px;flex-wrap:wrap;padding-top:2px}
140
- .dsa-button{border:1px solid var(--dsw-alias-border-l1);background:var(--dsw-alias-bg-layer-1);color:var(--dsw-alias-label-primary);border-radius:8px;padding:3px 10px;cursor:pointer;font:inherit}
141
- .dsa-button:hover{background:var(--dsw-alias-bg-layer-2)}
148
+ .dsa-switch:focus-visible{outline:2px solid var(--dsw-alias-brand-primary);outline-offset:2px}
149
+ .dsa-actions{display:flex;gap:6px;flex-wrap:wrap;margin-top:6px}
150
+ .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}
151
+ .dsa-button:hover{background:var(--dsw-alias-interactive-bg-hover)}
142
152
  .dsa-button:disabled{opacity:.5;cursor:default}
143
- .dsa-button:focus-visible,.dsa-switch:focus-visible,.dsa-close:focus-visible,.dsa-link:focus-visible{outline:2px solid var(--dsw-alias-brand-primary);outline-offset:2px}
144
- .dsa-note{color:var(--dsw-alias-label-secondary);font-size:calc(var(--dsh-content-font-size-secondary,13px) - 2px);margin-top:6px}
153
+ .dsa-button:focus-visible{outline:2px solid var(--dsw-alias-brand-primary);outline-offset:2px}
154
+ .dsa-note{color:var(--dsw-alias-label-tertiary);margin-top:8px}
145
155
  .dsa-error{color:var(--dsw-alias-state-error-primary)}
146
- .dsa-foot{display:flex;gap:10px;align-items:center;margin-top:10px;color:var(--dsw-alias-label-secondary);font-size:calc(var(--dsh-content-font-size-secondary,13px) - 2px)}
147
- .dsa-foot .dsa-spacer{flex:1 1 auto}
148
- .dsa-icon-link{display:inline-flex;align-items:center;justify-content:center;width:20px;height:20px;border-radius:6px;color:var(--dsw-alias-label-secondary);text-decoration:none}
149
- .dsa-icon-link:hover{background:var(--dsw-alias-bg-layer-2);color:var(--dsw-alias-label-primary)}
150
- .dsa-version{color:var(--dsw-alias-label-secondary);text-decoration:none}
151
- .dsa-version:hover{color:var(--dsw-alias-label-primary);text-decoration:underline}
152
- .dsa-link{color:var(--dsw-alias-brand-primary);text-decoration:none}
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}
156
+ .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}
157
+ .dsa-foot .dsa-grow{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
158
+ .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}
159
+ .dsa-icon-link:hover{background:var(--dsw-alias-interactive-bg-hover);color:var(--dsw-alias-label-secondary)}
160
+ .dsa-icon-link:focus-visible{outline:2px solid var(--dsw-alias-brand-primary);outline-offset:2px}
161
+ .dsa-version{color:var(--dsw-alias-label-tertiary);text-decoration:none;flex:none;font-variant-numeric:tabular-nums}
162
+ .dsa-version:hover{color:var(--dsw-alias-label-secondary);text-decoration:underline}
157
163
  `
158
164
 
159
165
  function createStore() {
@@ -296,10 +302,6 @@ window.__ModuleLoader__.load({
296
302
  function Indicator({ store, t }) {
297
303
  const snapshot = useStore(store)
298
304
  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
305
  return h(
304
306
  React.Fragment,
305
307
  null,
@@ -308,13 +310,13 @@ window.__ModuleLoader__.load({
308
310
  'button',
309
311
  {
310
312
  type: 'button',
311
- className: 'dsa-indicator dsa-root',
313
+ className: 'dsa-pill dsa-root',
312
314
  'aria-expanded': snapshot.open === true,
313
315
  'aria-haspopup': 'dialog',
314
- style: { color: textColor },
315
316
  onClick: () => store.toggle(),
316
317
  },
317
- h(StatusLine, { t, view, color }),
318
+ h(Moon, { key: 'icon', color: toneColor(view.tone) }),
319
+ h('span', { key: 'label', className: 'dsa-label' }, `${t('brand')} · ${t(`state.${view.key}`)}`),
318
320
  ),
319
321
  )
320
322
  }
@@ -329,9 +331,9 @@ window.__ModuleLoader__.load({
329
331
  const unreachable = status === null || failures >= UNKNOWN_AFTER_FAILURES
330
332
  const enabled = status === null ? true : status.enabled !== false
331
333
  const allowDisplaySleep = (status === null ? 'system' : status.scope) === 'system'
334
+ const soundOn = status === null ? true : status.sound !== false
332
335
  const busy = snapshot.busy === true
333
336
  const staleHost = status !== null && status.protocol !== 2
334
- const soundOn = status === null ? true : status.sound !== false
335
337
  const counts = status && status.counts ? status.counts : { agents: 0, maintenance: 0, jobs: 0 }
336
338
  const holdLeft = status && typeof status.manualUntil === 'number' && status.manualUntil > Date.now()
337
339
  ? status.manualUntil - Date.now()
@@ -358,7 +360,6 @@ window.__ModuleLoader__.load({
358
360
  if (!open) return null
359
361
 
360
362
  const rows = [
361
- [t('detail.state'), t(`state.${view.key}`)],
362
363
  [t('detail.sources'), `${t('sources.agents')} ${counts.agents ?? 0} · ${t('sources.maintenance')} ${counts.maintenance ?? 0} · ${t('sources.jobs')} ${counts.jobs ?? 0}`],
363
364
  [t('detail.scope'), allowDisplaySleep ? t('scope.system') : t('scope.display')],
364
365
  [t('detail.backend'), status && status.backend ? status.backend : t('unit.none')],
@@ -370,6 +371,16 @@ window.__ModuleLoader__.load({
370
371
  const reason = status !== null && !unreachable ? errorText(t, status) : null
371
372
  if (reason !== null) rows.push([t('detail.error'), reason])
372
373
 
374
+ const switchOf = (checked, onClick, label, extraDisabled = false) => h('button', {
375
+ type: 'button',
376
+ className: 'dsa-switch',
377
+ role: 'switch',
378
+ 'aria-checked': checked,
379
+ 'aria-label': label,
380
+ disabled: busy || unreachable || extraDisabled,
381
+ onClick,
382
+ })
383
+
373
384
  return h(
374
385
  'div',
375
386
  { className: 'dsa-panel', role: 'dialog', 'aria-label': t('brand') },
@@ -377,41 +388,47 @@ window.__ModuleLoader__.load({
377
388
  h(
378
389
  'div',
379
390
  { className: 'dsa-head', key: 'head' },
380
- h(StatusLine, { key: 'line', t, view, color: toneColor(view.tone) }),
381
- h('button', {
382
- type: 'button',
383
- className: 'dsa-close',
384
- title: t('panel.close'),
385
- 'aria-label': t('panel.close'),
386
- onClick: () => store.close(),
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
- ])),
391
+ h(
392
+ 'span',
393
+ { className: 'dsa-head-label' },
394
+ h(Moon, { key: 'icon', color: toneColor(view.tone) }),
395
+ t('brand'),
396
+ ),
397
+ h(
398
+ 'span',
399
+ { className: 'dsa-head-value' },
400
+ h('span', { className: 'dsa-state' }, t(`state.${view.key}`)),
401
+ h('button', {
402
+ type: 'button',
403
+ className: 'dsa-close',
404
+ title: t('panel.close'),
405
+ 'aria-label': t('panel.close'),
406
+ onClick: () => store.close(),
407
+ }, '×'),
408
+ ),
398
409
  ),
410
+ h('div', { className: 'dsa-rule', key: 'rule' }),
411
+ staleHost || snapshot.notice === 'stale'
412
+ ? h('div', { className: 'dsa-note dsa-error', key: 'stale' }, t('panel.staleHost'))
413
+ : null,
414
+ unreachable
415
+ ? h('div', { className: 'dsa-note dsa-error', key: 'unreachable' }, t('hint.unreachable'))
416
+ : h(
417
+ 'dl',
418
+ { className: 'dsa-grid', key: 'grid' },
419
+ rows.flatMap(([key, value], index) => [
420
+ h('dt', { key: `k${index}`, className: 'dsa-key' }, key),
421
+ h('dd', { key: `v${index}`, className: 'dsa-val', title: value }, value),
422
+ ]),
423
+ ),
399
424
  h(
400
425
  'div',
401
- { className: 'dsa-box', key: 'toggles' },
426
+ { className: 'dsa-section', key: 'switches' },
402
427
  h(
403
428
  'div',
404
429
  { className: 'dsa-row' },
405
430
  h('span', { className: 'dsa-grow' }, t('panel.enabled')),
406
- h('button', {
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
- }),
431
+ switchOf(enabled, () => act({ action: 'set-enabled', enabled: !enabled }), t('panel.enabled')),
415
432
  ),
416
433
  h(
417
434
  'div',
@@ -420,15 +437,7 @@ window.__ModuleLoader__.load({
420
437
  h('div', null, t('panel.allowDisplaySleep')),
421
438
  h('div', { className: 'dsa-sub' }, t('panel.allowDisplaySleepHint')),
422
439
  ),
423
- h('button', {
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
- }),
440
+ switchOf(allowDisplaySleep, () => act({ action: 'set-scope', scope: allowDisplaySleep ? 'display' : 'system' }), t('panel.allowDisplaySleep')),
432
441
  ),
433
442
  h(
434
443
  'div',
@@ -440,60 +449,44 @@ window.__ModuleLoader__.load({
440
449
  disabled: busy || unreachable,
441
450
  onClick: () => act({ action: 'test-sound' }),
442
451
  }, t('panel.testSound')),
443
- h('button', {
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
- }),
452
+ switchOf(soundOn, () => act({ action: 'set-sound', enabled: !soundOn }), t('panel.sound')),
452
453
  ),
453
454
  ),
454
455
  h(
455
456
  'div',
456
- { className: 'dsa-box', key: 'hold' },
457
+ { className: 'dsa-section', key: 'hold' },
457
458
  h('div', { className: 'dsa-sub' }, t('panel.hold')),
458
459
  h(
459
460
  'div',
460
461
  { className: 'dsa-actions' },
461
462
  h('button', {
462
- type: 'button',
463
- className: 'dsa-button',
463
+ type: 'button', className: 'dsa-button',
464
464
  disabled: busy || unreachable || !enabled,
465
465
  title: enabled ? undefined : t('panel.holdDisabled'),
466
466
  onClick: () => act({ action: 'hold', minutes: 30 }),
467
467
  }, t('panel.hold30')),
468
468
  h('button', {
469
- type: 'button',
470
- className: 'dsa-button',
469
+ type: 'button', className: 'dsa-button',
471
470
  disabled: busy || unreachable || !enabled,
472
471
  title: enabled ? undefined : t('panel.holdDisabled'),
473
472
  onClick: () => act({ action: 'hold', minutes: 120 }),
474
473
  }, t('panel.hold120')),
475
- holdLeft === null
476
- ? null
477
- : h('button', {
478
- type: 'button',
479
- className: 'dsa-button',
480
- disabled: busy || unreachable,
481
- onClick: () => act({ action: 'cancel-hold' }),
482
- }, t('panel.holdCancel')),
474
+ holdLeft === null ? null : h('button', {
475
+ type: 'button', className: 'dsa-button',
476
+ disabled: busy || unreachable,
477
+ onClick: () => act({ action: 'cancel-hold' }),
478
+ }, t('panel.holdCancel')),
483
479
  ),
484
480
  snapshot.notice === 'saved'
485
481
  ? h('div', { className: 'dsa-note' }, t('panel.saved'))
486
482
  : snapshot.notice === 'failed'
487
- ? h('div', { className: 'dsa-note dsa-error' }, t('panel.saveFailed'))
483
+ ? h('div', { className: 'dsa-note dsa-error' }, `${t('panel.saveFailed')}${snapshot.noticeStatus ? ` (${snapshot.noticeStatus})` : ''}`)
488
484
  : null,
489
485
  ),
490
486
  h(
491
487
  'div',
492
488
  { className: 'dsa-foot', key: 'foot' },
493
- h('span', {
494
- className: 'dsa-grow',
495
- style: { overflow: 'hidden', textOverflow: 'ellipsis', whiteSpace: 'nowrap' },
496
- }, t('panel.advanced')),
489
+ h('span', { className: 'dsa-grow', title: t('panel.advanced') }, t('panel.advanced')),
497
490
  h('a', {
498
491
  className: 'dsa-icon-link',
499
492
  href: REPO_URL,
@@ -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
- - 未验证:Windows `SystemSounds` 与 Linux `paplay` 未在真机验证;新开关在亮/暗主题下的观感需目视确认。
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">输入框下方状态栏(activity / usage 之后)</text>
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
- <!-- fake composer dock line -->
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
- <!-- indicator, right aligned -->
10
- <g transform="translate(232,40)">
11
- <path d="M11 12a7.4 7.4 0 1 0 4.7 10.8A6.1 6.1 0 0 1 11 12z" fill="#22c55e"/>
12
- <text x="22" y="21" font-family="PingFang SC, Noto Sans SC, Helvetica, Arial, sans-serif" font-size="12" fill="#6b7280">守夜 · 保持中</text>
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">点击展开设置弹层</text>
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>
@@ -1,71 +1,77 @@
1
- <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 380 376" width="380" height="376" role="img" aria-label="设置弹层示意">
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:12px;fill:#6b7280}
7
- .key{font-size:11px;fill:#9aa0a8}
8
- .val{font-size:11px;fill:#3c4149}
9
- .label{font-size:12px;fill:#3c4149}
10
- .sub{font-size:10px;fill:#9aa0a8}
11
- .btn{fill:#f6f7f9;stroke:#e0e2e7}
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 class="bg" width="380" height="376"/>
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
- <!-- header: same status line as the collapsed indicator -->
19
- <g transform="translate(24,26)">
20
- <path d="M12 1.5a7.4 7.4 0 1 0 4.6 11A6.1 6.1 0 0 1 12 1.5z" fill="#22c55e" transform="scale(1.15)"/>
21
- <text class="t title" x="20" y="12">守夜 · 保持中</text>
22
- <circle cx="104" cy="8" r="2.4" fill="#22c55e"/>
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
- <!-- status grid -->
27
- <g class="t">
28
- <text class="key" x="24" y="72">状态</text><text class="val" x="86" y="72">保持中</text>
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
- <text class="label" x="24" y="182">总开关</text>
38
- <rect x="320" y="170" width="34" height="18" rx="9" fill="#22c55e"/>
39
- <circle cx="345" cy="179" r="6" fill="#ffffff"/>
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="sub" x="330" y="101" text-anchor="end">保持中</text>
35
+ <text class="t" x="352" y="102" text-anchor="middle" font-size="15" fill="#9aa0a8">×</text>
40
36
 
41
- <text class="label" x="24" y="208">允许屏幕休眠</text>
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
- <text class="label" x="24" y="246">完成提示音</text>
47
- <rect class="btn" x="244" y="233" width="60" height="22" rx="8"/>
48
- <text class="btntext" x="274" y="248" text-anchor="middle">试听</text>
49
- <rect x="320" y="234" width="34" height="18" rx="9" fill="#22c55e"/>
50
- <circle cx="345" cy="243" r="6" fill="#ffffff"/>
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
- <!-- hold row -->
54
- <g class="t">
55
- <text class="sub" x="24" y="274">临时保持</text>
56
- <rect class="btn" x="24" y="282" width="64" height="22" rx="8"/>
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
+ <line class="rule" x1="46" y1="232" x2="374" y2="232"/>
63
46
 
64
- <!-- footer: advanced hint + repo icon + npm version -->
65
- <g class="t">
66
- <text class="sub" x="24" y="332">防抖、兜底时长、音效等高级参数在 cordis.patch.yml 中配置</text>
67
- <path d="M306 322 l-3.4 3.6 3.4 3.6 M313 322 l3.4 3.6 -3.4 3.6"
68
- fill="none" stroke="#6b7280" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"/>
69
- <text class="sub" x="322" y="332" fill="#6b7280">v0.2.0</text>
47
+ <!-- switches -->
48
+ <text class="label" x="46" y="258">总开关</text>
49
+ <rect x="340" y="247" width="34" height="18" rx="9" fill="#22c55e"/>
50
+ <circle cx="365" cy="256" r="6" fill="#ffffff"/>
51
+
52
+ <text class="label" x="46" y="286">允许屏幕休眠</text>
53
+ <text class="sub" x="46" y="301">只防系统休眠,屏幕按系统设置熄灭</text>
54
+ <rect x="340" y="275" width="34" height="18" rx="9" fill="#22c55e"/>
55
+ <circle cx="365" cy="284" r="6" fill="#ffffff"/>
56
+
57
+ <text class="label" x="46" y="330">完成提示音</text>
58
+ <rect x="266" y="317" width="56" height="22" rx="6" fill="#f3f4f6"/>
59
+ <text class="t" x="294" y="332" text-anchor="middle" font-size="12" fill="#374151">试听</text>
60
+ <rect x="340" y="319" width="34" height="18" rx="9" fill="#22c55e"/>
61
+ <circle cx="365" cy="328" r="6" fill="#ffffff"/>
62
+
63
+ <line class="rule" x1="46" y1="348" x2="374" y2="348"/>
64
+
65
+ <!-- hold -->
66
+ <text class="sub" x="46" y="368">临时保持</text>
67
+ <rect x="46" y="376" width="64" height="22" rx="6" fill="#f3f4f6"/>
68
+ <text class="t" x="78" y="391" text-anchor="middle" font-size="12" fill="#374151">30 分钟</text>
69
+ <rect x="116" y="376" width="58" height="22" rx="6" fill="#f3f4f6"/>
70
+ <text class="t" x="145" y="391" text-anchor="middle" font-size="12" fill="#374151">2 小时</text>
71
+
72
+ <line class="rule" x1="46" y1="410" x2="374" y2="410"/>
73
+ <text class="sub" x="46" y="428">防抖、音效等高级参数在 cordis.patch.yml 中配置</text>
74
+ <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"/>
75
+ <text class="sub" x="352" y="428">v0.2.1</text>
70
76
  </g>
71
77
  </svg>
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@laraveladmin/dsh-stay-awake",
3
- "version": "0.2.0",
3
+ "version": "0.2.1",
4
4
  "description": "DeepSeek Harness plugin that keeps the machine awake only while unattended work runs.",
5
5
  "keywords": [
6
6
  "dsh-plugin",