@laraveladmin/dsh-stay-awake 0.2.12 → 0.2.13

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,22 @@
1
1
  # 变更记录 · Changelog
2
2
 
3
+ ## 0.2.13 — 2026-12-03
4
+
5
+ ### 优化
6
+
7
+ - 操作反馈不再新增一行:试听/保存的结果改为替换弹层底部那行说明文字(`✓ 试听已播放`、`✓ 已保存`,
8
+ 失败用宿主错误色),160ms 淡入 + 上移 2px,2.5 秒后切回原说明。弹层是 `height: fit-content` 且底部
9
+ 锚定,之前每点一次都会把面板顶边顶高一截,现在高度恒定、不再跳动。
10
+ - 「试听失败」缩短为「没有可用的播放器」,完整文案放进 `title`;状态行加 `role="status"` 与
11
+ `aria-live="polite"`,读屏也会播报。
12
+ - 按钮补 `:active` 按压反馈(宿主 `--dsw-alias-interactive-bg-hover`)。
13
+ - 顶部「宿主未加载最新版本」这类持久错误保持原位:它不是瞬态反馈,2.5 秒后消失反而有害。
14
+
15
+ ### 测试
16
+
17
+ - 81 项单测/接线测试保持全绿;`node --check` 通过。
18
+
19
+
3
20
  ## 0.2.12 — 2026-12-03
4
21
 
5
22
  ### 修复
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 sound failed: no audio player on this system',
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,15 @@ 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
+ .dsa-status{animation:dsa-status-in .16s ease-out}
170
+ @keyframes dsa-status-in{from{opacity:0;transform:translateY(2px)}to{opacity:1;transform:translateY(0)}}
171
+ .dsa-ok{color:var(--dsw-alias-label-secondary)}
172
+ @media (prefers-reduced-motion:reduce){.dsa-status{animation:none}}
168
173
  .dsa-error{color:var(--dsw-alias-state-error-primary)}
169
174
  .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
175
  .dsa-foot .dsa-grow{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
@@ -262,22 +267,23 @@ window.__ModuleLoader__.load({
262
267
  }
263
268
 
264
269
  /**
265
- * One transient line under the switches. `stale` is rendered next to the
266
- * status grid instead — it is about the host build, not about an action.
270
+ * Transient feedback, rendered by replacing the footer's hint line instead
271
+ * of adding a row: the panel is bottom-anchored with `height: fit-content`,
272
+ * so a new row moved its top edge on every click. `stale` is not transient
273
+ * (it asks the user to restart something) and keeps its own persistent row.
267
274
  */
268
- function noticeOf(t, snapshot) {
275
+ function noticeStatus(t, snapshot) {
269
276
  const notice = snapshot.notice
270
277
  if (notice === null || notice === undefined || notice === 'stale') return null
271
- if (notice === 'testPlayed') return h('div', { className: 'dsa-note' }, t('panel.testPlayed'))
272
- if (notice === 'testUnavailable') return h('div', { className: 'dsa-note dsa-error' }, t('panel.testUnavailable'))
278
+ if (notice === 'testPlayed') return { text: `\u2713 ${t('panel.testPlayed')}` }
279
+ if (notice === 'testUnavailable') return { text: t('panel.testUnavailable'), tone: 'error' }
273
280
  if (notice === 'failed') {
274
- return h(
275
- 'div',
276
- { className: 'dsa-note dsa-error' },
277
- `${t('panel.saveFailed')}${snapshot.noticeStatus ? ` (${snapshot.noticeStatus})` : ''}`,
278
- )
281
+ return {
282
+ text: `${t('panel.saveFailed')}${snapshot.noticeStatus ? ` (${snapshot.noticeStatus})` : ''}`,
283
+ tone: 'error',
284
+ }
279
285
  }
280
- return h('div', { className: 'dsa-note' }, t('panel.saved'))
286
+ return { text: `\u2713 ${t('panel.saved')}` }
281
287
  }
282
288
 
283
289
  function Moon({ color }) {
@@ -426,6 +432,8 @@ window.__ModuleLoader__.load({
426
432
  const reason = status !== null && !unreachable ? errorInfo(t, status) : null
427
433
  if (reason !== null) rows.push([t('detail.error'), reason.text, reason.raw])
428
434
 
435
+ const notice = noticeStatus(t, snapshot)
436
+
429
437
  const switchOf = (checked, onClick, label, extraDisabled = false) => h('button', {
430
438
  type: 'button',
431
439
  className: 'dsa-switch',
@@ -495,7 +503,6 @@ window.__ModuleLoader__.load({
495
503
  }, t('panel.testSound')),
496
504
  switchOf(soundOn, () => act({ action: 'set-sound', enabled: !soundOn }), t('panel.sound')),
497
505
  ),
498
- noticeOf(t, snapshot),
499
506
  ),
500
507
  h(
501
508
  'div',
@@ -526,7 +533,15 @@ window.__ModuleLoader__.load({
526
533
  h(
527
534
  'div',
528
535
  { className: 'dsa-foot', key: 'foot' },
529
- h('span', { className: 'dsa-grow', title: t('panel.advanced') }, t('panel.advanced')),
536
+ h('span', {
537
+ // Remounted on every notice change so the entry animation replays;
538
+ // the line keeps its height either way, so the panel never resizes.
539
+ key: notice === null ? 'hint' : `notice:${snapshot.notice}`,
540
+ className: `dsa-grow dsa-status${notice === null ? '' : notice.tone === 'error' ? ' dsa-error' : ' dsa-ok'}`,
541
+ role: 'status',
542
+ 'aria-live': 'polite',
543
+ title: notice === null ? t('panel.advanced') : notice.text,
544
+ }, notice === null ? t('panel.advanced') : notice.text),
530
545
  h('a', {
531
546
  className: 'dsa-icon-link',
532
547
  href: REPO_URL,
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 # 79 项;含索引与 manifest 的一致性检查
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
 
@@ -125,6 +125,32 @@
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
+
128
154
  ## 未验证(明确记录,不代替验证)
129
155
 
130
156
  | ID / 项 | 原因 | 何时可验 |
package/market/index.json CHANGED
@@ -51,8 +51,8 @@
51
51
  },
52
52
  "versions": [
53
53
  {
54
- "version": "0.2.12",
55
- "publishTimestamp": 1796290611,
54
+ "version": "0.2.13",
55
+ "publishTimestamp": 1796291435,
56
56
  "source": {
57
57
  "type": "npm"
58
58
  },
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@laraveladmin/dsh-stay-awake",
3
- "version": "0.2.12",
3
+ "version": "0.2.13",
4
4
  "description": "DeepSeek Harness plugin that keeps the machine awake only while unattended work runs.",
5
5
  "keywords": [
6
6
  "dsh-plugin",