@laraveladmin/dsh-stay-awake 0.2.12 → 0.2.14
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 +36 -0
- package/client.js +51 -25
- package/docs/RELEASING.md +1 -1
- package/docs/VERIFICATION.md +42 -0
- package/market/index.json +2 -2
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,41 @@
|
|
|
1
1
|
# 变更记录 · Changelog
|
|
2
2
|
|
|
3
|
+
## 0.2.14 — 2026-12-03
|
|
4
|
+
|
|
5
|
+
### 修复
|
|
6
|
+
|
|
7
|
+
- 0.2.13 把底部说明文字替换成反馈文案:高度不跳了,**宽度开始跳**——那行说明是面板里最宽的一行,
|
|
8
|
+
被换成短文案后 `width: max-content` 立刻收缩到次宽的行。现在说明文字始终留在流里(它决定面板宽度),
|
|
9
|
+
反馈改为绝对定位的浮层盖在它上面(`inset: 0`,不参与布局):说明 `opacity 1→0`(140ms),
|
|
10
|
+
浮层 `opacity 0→1` + `translateY(2px→0)`(160ms),2.5 秒后反向。弹层宽高全程不变。
|
|
11
|
+
- 浮层 `pointer-events: none`,不挡操作;`prefers-reduced-motion` 下取消过渡。
|
|
12
|
+
- 去掉「请求进行中」的全局禁用:以前一次开关点击会把整块面板(三个开关 + 试听 + 临时保持按钮)
|
|
13
|
+
同时置灰(`.dsa-button:disabled{opacity:.5}` / `.dsa-switch:disabled{opacity:.5}`),本地接口很快,
|
|
14
|
+
置灰只持续一两帧——所以看起来是「临时保持那块有时候闪一下」。现在飞行中的请求不再改变任何控件的
|
|
15
|
+
禁用态,只在回包后更新状态与底部反馈;语义禁用(宿主不可达、总开关关闭)保持不变。
|
|
16
|
+
|
|
17
|
+
### 测试
|
|
18
|
+
|
|
19
|
+
- 81 项单测/接线测试保持全绿;`node --check` 通过;中英字典键集合一致。
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
## 0.2.13 — 2026-12-03
|
|
23
|
+
|
|
24
|
+
### 优化
|
|
25
|
+
|
|
26
|
+
- 操作反馈不再新增一行:试听/保存的结果改为替换弹层底部那行说明文字(`✓ 试听已播放`、`✓ 已保存`,
|
|
27
|
+
失败用宿主错误色),160ms 淡入 + 上移 2px,2.5 秒后切回原说明。弹层是 `height: fit-content` 且底部
|
|
28
|
+
锚定,之前每点一次都会把面板顶边顶高一截,现在高度恒定、不再跳动。
|
|
29
|
+
- 「试听失败」缩短为「没有可用的播放器」,完整文案放进 `title`;状态行加 `role="status"` 与
|
|
30
|
+
`aria-live="polite"`,读屏也会播报。
|
|
31
|
+
- 按钮补 `:active` 按压反馈(宿主 `--dsw-alias-interactive-bg-hover`)。
|
|
32
|
+
- 顶部「宿主未加载最新版本」这类持久错误保持原位:它不是瞬态反馈,2.5 秒后消失反而有害。
|
|
33
|
+
|
|
34
|
+
### 测试
|
|
35
|
+
|
|
36
|
+
- 81 项单测/接线测试保持全绿;`node --check` 通过。
|
|
37
|
+
|
|
38
|
+
|
|
3
39
|
## 0.2.12 — 2026-12-03
|
|
4
40
|
|
|
5
41
|
### 修复
|
package/client.js
CHANGED
|
@@ -63,7 +63,7 @@ window.__ModuleLoader__.load({
|
|
|
63
63
|
'panel.sound': '完成提示音',
|
|
64
64
|
'panel.testSound': '试听',
|
|
65
65
|
'panel.testPlayed': '试听已播放',
|
|
66
|
-
'panel.testUnavailable': '
|
|
66
|
+
'panel.testUnavailable': '试听失败:没有可用的播放器',
|
|
67
67
|
'panel.holdDisabled': '总开关关闭时无法临时保持',
|
|
68
68
|
'panel.holdLeft': '剩余',
|
|
69
69
|
'panel.saved': '已保存',
|
|
@@ -112,7 +112,7 @@ window.__ModuleLoader__.load({
|
|
|
112
112
|
'panel.sound': 'Completion sound',
|
|
113
113
|
'panel.testSound': 'Test',
|
|
114
114
|
'panel.testPlayed': 'Test sound played',
|
|
115
|
-
'panel.testUnavailable': 'Test
|
|
115
|
+
'panel.testUnavailable': 'Test failed: no player found',
|
|
116
116
|
'panel.holdDisabled': 'Enable the plugin first to hold',
|
|
117
117
|
'panel.holdLeft': 'left',
|
|
118
118
|
'panel.saved': 'Saved',
|
|
@@ -161,10 +161,22 @@ window.__ModuleLoader__.load({
|
|
|
161
161
|
.dsa-switch:focus-visible{outline:2px solid var(--dsw-alias-brand-primary);outline-offset:2px}
|
|
162
162
|
.dsa-actions{display:flex;gap:6px;flex-wrap:wrap;margin-top:6px}
|
|
163
163
|
.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}
|
|
164
|
+
.dsa-button:active:not(:disabled){background:var(--dsw-alias-interactive-bg-hover)}
|
|
164
165
|
.dsa-button:hover{background:var(--dsw-alias-interactive-bg-hover)}
|
|
165
166
|
.dsa-button:disabled{opacity:.5;cursor:default}
|
|
166
167
|
.dsa-button:focus-visible{outline:2px solid var(--dsw-alias-brand-primary);outline-offset:2px}
|
|
167
168
|
.dsa-note{color:var(--dsw-alias-label-tertiary);margin-top:8px}
|
|
169
|
+
/* The hint stays in flow (it decides the panel width) and the transient notice
|
|
170
|
+
is layered on top of it: swapping the text instead resized the fit-content
|
|
171
|
+
panel, first in height, then in width. */
|
|
172
|
+
.dsa-status{position:relative;overflow:hidden}
|
|
173
|
+
.dsa-status-hint,.dsa-status-note{display:block;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
|
|
174
|
+
.dsa-status-hint{transition:opacity .14s ease}
|
|
175
|
+
.dsa-status-hint[data-hidden="true"]{opacity:0}
|
|
176
|
+
.dsa-status-note{position:absolute;inset:0;opacity:0;transform:translateY(2px);transition:opacity .16s ease,transform .16s ease;pointer-events:none}
|
|
177
|
+
.dsa-status-note[data-visible="true"]{opacity:1;transform:none}
|
|
178
|
+
.dsa-ok{color:var(--dsw-alias-label-secondary)}
|
|
179
|
+
@media (prefers-reduced-motion:reduce){.dsa-status-hint,.dsa-status-note{transition:none}}
|
|
168
180
|
.dsa-error{color:var(--dsw-alias-state-error-primary)}
|
|
169
181
|
.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}
|
|
170
182
|
.dsa-foot .dsa-grow{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
|
|
@@ -176,7 +188,7 @@ window.__ModuleLoader__.load({
|
|
|
176
188
|
`
|
|
177
189
|
|
|
178
190
|
function createStore() {
|
|
179
|
-
let state = { open: false, status: null, failures: 0,
|
|
191
|
+
let state = { open: false, status: null, failures: 0, notice: null, localeRevision: 0 }
|
|
180
192
|
const listeners = new Set()
|
|
181
193
|
const store = {
|
|
182
194
|
get: () => state,
|
|
@@ -262,22 +274,23 @@ window.__ModuleLoader__.load({
|
|
|
262
274
|
}
|
|
263
275
|
|
|
264
276
|
/**
|
|
265
|
-
*
|
|
266
|
-
*
|
|
277
|
+
* Transient feedback, rendered by replacing the footer's hint line instead
|
|
278
|
+
* of adding a row: the panel is bottom-anchored with `height: fit-content`,
|
|
279
|
+
* so a new row moved its top edge on every click. `stale` is not transient
|
|
280
|
+
* (it asks the user to restart something) and keeps its own persistent row.
|
|
267
281
|
*/
|
|
268
|
-
function
|
|
282
|
+
function noticeStatus(t, snapshot) {
|
|
269
283
|
const notice = snapshot.notice
|
|
270
284
|
if (notice === null || notice === undefined || notice === 'stale') return null
|
|
271
|
-
if (notice === 'testPlayed') return
|
|
272
|
-
if (notice === 'testUnavailable') return
|
|
285
|
+
if (notice === 'testPlayed') return { text: `\u2713 ${t('panel.testPlayed')}` }
|
|
286
|
+
if (notice === 'testUnavailable') return { text: t('panel.testUnavailable'), tone: 'error' }
|
|
273
287
|
if (notice === 'failed') {
|
|
274
|
-
return
|
|
275
|
-
'
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
)
|
|
288
|
+
return {
|
|
289
|
+
text: `${t('panel.saveFailed')}${snapshot.noticeStatus ? ` (${snapshot.noticeStatus})` : ''}`,
|
|
290
|
+
tone: 'error',
|
|
291
|
+
}
|
|
279
292
|
}
|
|
280
|
-
return
|
|
293
|
+
return { text: `\u2713 ${t('panel.saved')}` }
|
|
281
294
|
}
|
|
282
295
|
|
|
283
296
|
function Moon({ color }) {
|
|
@@ -386,7 +399,6 @@ window.__ModuleLoader__.load({
|
|
|
386
399
|
const enabled = status === null ? true : status.enabled !== false
|
|
387
400
|
const allowDisplaySleep = (status === null ? 'system' : status.scope) === 'system'
|
|
388
401
|
const soundOn = status === null ? true : status.sound !== false
|
|
389
|
-
const busy = snapshot.busy === true
|
|
390
402
|
const staleHost = status !== null && status.protocol !== 2
|
|
391
403
|
const counts = status && status.counts ? status.counts : { agents: 0, maintenance: 0, jobs: 0 }
|
|
392
404
|
const holdLeft = status && typeof status.manualUntil === 'number' && status.manualUntil > Date.now()
|
|
@@ -426,13 +438,15 @@ window.__ModuleLoader__.load({
|
|
|
426
438
|
const reason = status !== null && !unreachable ? errorInfo(t, status) : null
|
|
427
439
|
if (reason !== null) rows.push([t('detail.error'), reason.text, reason.raw])
|
|
428
440
|
|
|
441
|
+
const notice = noticeStatus(t, snapshot)
|
|
442
|
+
|
|
429
443
|
const switchOf = (checked, onClick, label, extraDisabled = false) => h('button', {
|
|
430
444
|
type: 'button',
|
|
431
445
|
className: 'dsa-switch',
|
|
432
446
|
role: 'switch',
|
|
433
447
|
'aria-checked': checked,
|
|
434
448
|
'aria-label': label,
|
|
435
|
-
disabled:
|
|
449
|
+
disabled: unreachable || extraDisabled,
|
|
436
450
|
onClick,
|
|
437
451
|
})
|
|
438
452
|
|
|
@@ -490,12 +504,11 @@ window.__ModuleLoader__.load({
|
|
|
490
504
|
h('button', {
|
|
491
505
|
type: 'button',
|
|
492
506
|
className: 'dsa-button',
|
|
493
|
-
disabled:
|
|
507
|
+
disabled: unreachable,
|
|
494
508
|
onClick: () => act({ action: 'test-sound' }),
|
|
495
509
|
}, t('panel.testSound')),
|
|
496
510
|
switchOf(soundOn, () => act({ action: 'set-sound', enabled: !soundOn }), t('panel.sound')),
|
|
497
511
|
),
|
|
498
|
-
noticeOf(t, snapshot),
|
|
499
512
|
),
|
|
500
513
|
h(
|
|
501
514
|
'div',
|
|
@@ -506,19 +519,19 @@ window.__ModuleLoader__.load({
|
|
|
506
519
|
{ className: 'dsa-actions' },
|
|
507
520
|
h('button', {
|
|
508
521
|
type: 'button', className: 'dsa-button',
|
|
509
|
-
disabled:
|
|
522
|
+
disabled: unreachable || !enabled,
|
|
510
523
|
title: enabled ? undefined : t('panel.holdDisabled'),
|
|
511
524
|
onClick: () => act({ action: 'hold', minutes: 30 }),
|
|
512
525
|
}, t('panel.hold30')),
|
|
513
526
|
h('button', {
|
|
514
527
|
type: 'button', className: 'dsa-button',
|
|
515
|
-
disabled:
|
|
528
|
+
disabled: unreachable || !enabled,
|
|
516
529
|
title: enabled ? undefined : t('panel.holdDisabled'),
|
|
517
530
|
onClick: () => act({ action: 'hold', minutes: 120 }),
|
|
518
531
|
}, t('panel.hold120')),
|
|
519
532
|
holdLeft === null ? null : h('button', {
|
|
520
533
|
type: 'button', className: 'dsa-button',
|
|
521
|
-
disabled:
|
|
534
|
+
disabled: unreachable,
|
|
522
535
|
onClick: () => act({ action: 'cancel-hold' }),
|
|
523
536
|
}, t('panel.holdCancel')),
|
|
524
537
|
),
|
|
@@ -526,7 +539,22 @@ window.__ModuleLoader__.load({
|
|
|
526
539
|
h(
|
|
527
540
|
'div',
|
|
528
541
|
{ className: 'dsa-foot', key: 'foot' },
|
|
529
|
-
h('span', {
|
|
542
|
+
h('span', {
|
|
543
|
+
className: 'dsa-grow dsa-status',
|
|
544
|
+
title: notice === null ? t('panel.advanced') : notice.text,
|
|
545
|
+
},
|
|
546
|
+
h('span', {
|
|
547
|
+
// Always in flow: it is the widest row in most panels, so keeping
|
|
548
|
+
// it mounted is what keeps the fit-content width steady.
|
|
549
|
+
className: 'dsa-status-hint',
|
|
550
|
+
'data-hidden': notice === null ? undefined : 'true',
|
|
551
|
+
}, t('panel.advanced')),
|
|
552
|
+
h('span', {
|
|
553
|
+
className: `dsa-status-note${notice === null ? '' : notice.tone === 'error' ? ' dsa-error' : ' dsa-ok'}`,
|
|
554
|
+
'data-visible': notice === null ? 'false' : 'true',
|
|
555
|
+
role: 'status',
|
|
556
|
+
'aria-live': 'polite',
|
|
557
|
+
}, notice === null ? '' : notice.text)),
|
|
530
558
|
h('a', {
|
|
531
559
|
className: 'dsa-icon-link',
|
|
532
560
|
href: REPO_URL,
|
|
@@ -668,7 +696,6 @@ window.__ModuleLoader__.load({
|
|
|
668
696
|
}
|
|
669
697
|
|
|
670
698
|
async function act(body) {
|
|
671
|
-
store.set({ busy: true, notice: null, noticeStatus: null })
|
|
672
699
|
let statusCode = 'network'
|
|
673
700
|
try {
|
|
674
701
|
const response = await globalThis.fetch(ROUTE, {
|
|
@@ -688,11 +715,10 @@ window.__ModuleLoader__.load({
|
|
|
688
715
|
throw new Error(reason === 'invalid-action' ? 'stale-host' : `HTTP ${response.status}`)
|
|
689
716
|
}
|
|
690
717
|
const value = await response.json()
|
|
691
|
-
store.set({ status: value, failures: 0
|
|
718
|
+
store.set({ status: value, failures: 0 })
|
|
692
719
|
flashNotice(noticeFor(body, value), null)
|
|
693
720
|
} catch (error) {
|
|
694
721
|
const stale = error instanceof Error && error.message === 'stale-host'
|
|
695
|
-
store.set({ busy: false })
|
|
696
722
|
flashNotice(stale ? 'stale' : 'failed', statusCode)
|
|
697
723
|
}
|
|
698
724
|
}
|
package/docs/RELEASING.md
CHANGED
|
@@ -12,7 +12,7 @@
|
|
|
12
12
|
|
|
13
13
|
```bash
|
|
14
14
|
node scripts/build-index.mjs # 由 package.json 生成 market/index.json
|
|
15
|
-
node --test test/*.test.js #
|
|
15
|
+
node --test test/*.test.js # 81 项;含索引与 manifest 的一致性检查
|
|
16
16
|
npm pack --dry-run # 确认 market/index.json、assets/icon-180.png 都在包里
|
|
17
17
|
```
|
|
18
18
|
|
package/docs/VERIFICATION.md
CHANGED
|
@@ -125,6 +125,48 @@
|
|
|
125
125
|
- **自动化**:75 个单测/接线测试保持全绿;`npm pack` 产物 24 个文件。
|
|
126
126
|
- 未验证:弹层实际锚定位置与观感需刷新页面后目视确认(本会话无浏览器控制权)。
|
|
127
127
|
|
|
128
|
+
## 0.2.12「试听」提示与节流修复(2026-12-03)
|
|
129
|
+
|
|
130
|
+
- **缺陷**:弹层「试听」与开关共用同一条成功提示,点击后显示「已保存」;且宿主的 1 秒节流会让连点的第二下
|
|
131
|
+
无声无息,前端仍按成功提示。另外该提示原本渲染在「临时保持」区块下方,位置与触发它的控件不对应。
|
|
132
|
+
- **修复**:宿主 `test-sound` 改为 `sound.play('success', { force: true })` 绕过节流,并在回包里带
|
|
133
|
+
`testSound: 'played' | 'unavailable'`;前端按 action 选择提示——「试听已播放」/「试听失败:当前系统没有可用的
|
|
134
|
+
提示音播放器」,提示移到开关区下方;`stale`、`failed` 仍常驻,其余提示 2.5 秒自动消失。
|
|
135
|
+
- 自动化:新增 2 项(服务端两种回包、`force` 绕过节流),单测 79 → 81,全绿;`node --check` 通过。
|
|
136
|
+
- 发布:npm `0.2.12`,`dist.shasum = 5e104df9408d371439f50c97f4fe05f55aa911ff`,本地 `npm pack` 与之一致;
|
|
137
|
+
拉取发布包确认 `client.js` 含新提示文案、`lib/sound.js` 含 `force`、`lib/server.js` 含 `testSound`;
|
|
138
|
+
GitHub raw 索引已指向 `0.2.12`,jsDelivr 备用索引 purge 返回 200。
|
|
139
|
+
- 未验证:实际点击「试听」的听觉与提示文案需宿主重启后目视/听感确认(本会话无浏览器控制权)。
|
|
140
|
+
|
|
141
|
+
## 0.2.13 反馈不再撑高弹层(2026-12-03)
|
|
142
|
+
|
|
143
|
+
- **问题**:0.2.12 把操作反馈渲染成开关区下方的新行;弹层是 `height: fit-content` 且底部锚定(CSS anchor
|
|
144
|
+
positioning),插一行就把顶边顶高,2.5 秒后再落回,观感是「窗口在抖」。
|
|
145
|
+
- **改法**:删掉这一行,改为替换弹层底部那行说明文字(`+` 号前面是勾号):默认 `panel.advanced`,
|
|
146
|
+
操作后 2.5 秒内显示 `✓ 试听已播放` / `✓ 已保存` / 失败文案(错误色),160ms 淡入 + `translateY(2px→0)`,
|
|
147
|
+
行高固定 16px、`nowrap` + 省略号,因此面板高度恒定;`prefers-reduced-motion` 下关闭动画。
|
|
148
|
+
持久错误(`stale` / `unreachable`)仍用原来的常驻行,不受影响。
|
|
149
|
+
- **可访问性**:状态行 `role="status"` + `aria-live="polite"`;省略时 `title` 给出完整文案;按钮补 `:active` 按压态。
|
|
150
|
+
- **自动化**:81 项单测/接线测试全绿(本次为纯前端改动,无新增用例);`node --check` 通过;
|
|
151
|
+
中英字典各 45 键、键集合一致、无空值、英文无 CJK 残留。
|
|
152
|
+
- 未验证:动画观感、面板是否确实零跳动、省略号在窄面板下的表现,需宿主重启后目视确认(本会话无浏览器控制权)。
|
|
153
|
+
|
|
154
|
+
## 0.2.14 反馈浮层(2026-12-03)
|
|
155
|
+
|
|
156
|
+
- **0.2.13 的遗留缺陷**:把底部说明文字原地替换成反馈文案后,高度稳定了,但宽度会跳——说明文字是面板里
|
|
157
|
+
最宽的一行(`width: max-content` 由它决定),被换成短文案后弹层立刻收窄,2.5 秒后又撑回去。
|
|
158
|
+
- **改法**:说明文字不再被替换或卸载(继续撑宽度),反馈改为 `.dsa-status-note` 绝对定位浮层(`inset: 0`,
|
|
159
|
+
不参与布局、`pointer-events: none`)。切换时说明 `opacity 1→0`(140ms),浮层 `opacity 0→1` +
|
|
160
|
+
`translateY(2px→0)`(160ms),2.5 秒后反向;`prefers-reduced-motion` 下取消过渡。
|
|
161
|
+
结果:弹层外框宽高全程不变,只有行内文字交叉淡入淡出。
|
|
162
|
+
- **真机目视确认(用户,2026-12-03)**:重启宿主后反复点「试听」与三个开关,反馈在原位切换、弹层边缘不动,
|
|
163
|
+
确认「没问题了」。
|
|
164
|
+
- **追加修复:飞行中不再置灰整块面板**。用户反馈点「提示音」开关后「临时保持」有时会闪:`act()` 在一次
|
|
165
|
+
请求期间把 `busy` 置真,面板所有按钮与开关同步落到 `:disabled`(`opacity: .5`),本地路由几十毫秒返回,
|
|
166
|
+
于是置灰只闪一两帧。现在删除 `busy` 这个概念,请求进行中不再改变任何控件的禁用态,只更新状态与底部反馈;
|
|
167
|
+
`unreachable`、`!enabled` 这类语义禁用保留。
|
|
168
|
+
- 自动化:81 项单测/接线测试全绿(纯前端改动,无新增用例)。
|
|
169
|
+
|
|
128
170
|
## 未验证(明确记录,不代替验证)
|
|
129
171
|
|
|
130
172
|
| ID / 项 | 原因 | 何时可验 |
|
package/market/index.json
CHANGED