@laraveladmin/dsh-stay-awake 0.2.13 → 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 +19 -0
- package/client.js +30 -19
- package/docs/VERIFICATION.md +16 -0
- package/market/index.json +2 -2
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,24 @@
|
|
|
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
|
+
|
|
3
22
|
## 0.2.13 — 2026-12-03
|
|
4
23
|
|
|
5
24
|
### 优化
|
package/client.js
CHANGED
|
@@ -166,10 +166,17 @@ window.__ModuleLoader__.load({
|
|
|
166
166
|
.dsa-button:disabled{opacity:.5;cursor:default}
|
|
167
167
|
.dsa-button:focus-visible{outline:2px solid var(--dsw-alias-brand-primary);outline-offset:2px}
|
|
168
168
|
.dsa-note{color:var(--dsw-alias-label-tertiary);margin-top:8px}
|
|
169
|
-
|
|
170
|
-
|
|
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}
|
|
171
178
|
.dsa-ok{color:var(--dsw-alias-label-secondary)}
|
|
172
|
-
@media (prefers-reduced-motion:reduce){.dsa-status{
|
|
179
|
+
@media (prefers-reduced-motion:reduce){.dsa-status-hint,.dsa-status-note{transition:none}}
|
|
173
180
|
.dsa-error{color:var(--dsw-alias-state-error-primary)}
|
|
174
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}
|
|
175
182
|
.dsa-foot .dsa-grow{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
|
|
@@ -181,7 +188,7 @@ window.__ModuleLoader__.load({
|
|
|
181
188
|
`
|
|
182
189
|
|
|
183
190
|
function createStore() {
|
|
184
|
-
let state = { open: false, status: null, failures: 0,
|
|
191
|
+
let state = { open: false, status: null, failures: 0, notice: null, localeRevision: 0 }
|
|
185
192
|
const listeners = new Set()
|
|
186
193
|
const store = {
|
|
187
194
|
get: () => state,
|
|
@@ -392,7 +399,6 @@ window.__ModuleLoader__.load({
|
|
|
392
399
|
const enabled = status === null ? true : status.enabled !== false
|
|
393
400
|
const allowDisplaySleep = (status === null ? 'system' : status.scope) === 'system'
|
|
394
401
|
const soundOn = status === null ? true : status.sound !== false
|
|
395
|
-
const busy = snapshot.busy === true
|
|
396
402
|
const staleHost = status !== null && status.protocol !== 2
|
|
397
403
|
const counts = status && status.counts ? status.counts : { agents: 0, maintenance: 0, jobs: 0 }
|
|
398
404
|
const holdLeft = status && typeof status.manualUntil === 'number' && status.manualUntil > Date.now()
|
|
@@ -440,7 +446,7 @@ window.__ModuleLoader__.load({
|
|
|
440
446
|
role: 'switch',
|
|
441
447
|
'aria-checked': checked,
|
|
442
448
|
'aria-label': label,
|
|
443
|
-
disabled:
|
|
449
|
+
disabled: unreachable || extraDisabled,
|
|
444
450
|
onClick,
|
|
445
451
|
})
|
|
446
452
|
|
|
@@ -498,7 +504,7 @@ window.__ModuleLoader__.load({
|
|
|
498
504
|
h('button', {
|
|
499
505
|
type: 'button',
|
|
500
506
|
className: 'dsa-button',
|
|
501
|
-
disabled:
|
|
507
|
+
disabled: unreachable,
|
|
502
508
|
onClick: () => act({ action: 'test-sound' }),
|
|
503
509
|
}, t('panel.testSound')),
|
|
504
510
|
switchOf(soundOn, () => act({ action: 'set-sound', enabled: !soundOn }), t('panel.sound')),
|
|
@@ -513,19 +519,19 @@ window.__ModuleLoader__.load({
|
|
|
513
519
|
{ className: 'dsa-actions' },
|
|
514
520
|
h('button', {
|
|
515
521
|
type: 'button', className: 'dsa-button',
|
|
516
|
-
disabled:
|
|
522
|
+
disabled: unreachable || !enabled,
|
|
517
523
|
title: enabled ? undefined : t('panel.holdDisabled'),
|
|
518
524
|
onClick: () => act({ action: 'hold', minutes: 30 }),
|
|
519
525
|
}, t('panel.hold30')),
|
|
520
526
|
h('button', {
|
|
521
527
|
type: 'button', className: 'dsa-button',
|
|
522
|
-
disabled:
|
|
528
|
+
disabled: unreachable || !enabled,
|
|
523
529
|
title: enabled ? undefined : t('panel.holdDisabled'),
|
|
524
530
|
onClick: () => act({ action: 'hold', minutes: 120 }),
|
|
525
531
|
}, t('panel.hold120')),
|
|
526
532
|
holdLeft === null ? null : h('button', {
|
|
527
533
|
type: 'button', className: 'dsa-button',
|
|
528
|
-
disabled:
|
|
534
|
+
disabled: unreachable,
|
|
529
535
|
onClick: () => act({ action: 'cancel-hold' }),
|
|
530
536
|
}, t('panel.holdCancel')),
|
|
531
537
|
),
|
|
@@ -534,14 +540,21 @@ window.__ModuleLoader__.load({
|
|
|
534
540
|
'div',
|
|
535
541
|
{ className: 'dsa-foot', key: 'foot' },
|
|
536
542
|
h('span', {
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
|
|
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',
|
|
541
555
|
role: 'status',
|
|
542
556
|
'aria-live': 'polite',
|
|
543
|
-
|
|
544
|
-
}, notice === null ? t('panel.advanced') : notice.text),
|
|
557
|
+
}, notice === null ? '' : notice.text)),
|
|
545
558
|
h('a', {
|
|
546
559
|
className: 'dsa-icon-link',
|
|
547
560
|
href: REPO_URL,
|
|
@@ -683,7 +696,6 @@ window.__ModuleLoader__.load({
|
|
|
683
696
|
}
|
|
684
697
|
|
|
685
698
|
async function act(body) {
|
|
686
|
-
store.set({ busy: true, notice: null, noticeStatus: null })
|
|
687
699
|
let statusCode = 'network'
|
|
688
700
|
try {
|
|
689
701
|
const response = await globalThis.fetch(ROUTE, {
|
|
@@ -703,11 +715,10 @@ window.__ModuleLoader__.load({
|
|
|
703
715
|
throw new Error(reason === 'invalid-action' ? 'stale-host' : `HTTP ${response.status}`)
|
|
704
716
|
}
|
|
705
717
|
const value = await response.json()
|
|
706
|
-
store.set({ status: value, failures: 0
|
|
718
|
+
store.set({ status: value, failures: 0 })
|
|
707
719
|
flashNotice(noticeFor(body, value), null)
|
|
708
720
|
} catch (error) {
|
|
709
721
|
const stale = error instanceof Error && error.message === 'stale-host'
|
|
710
|
-
store.set({ busy: false })
|
|
711
722
|
flashNotice(stale ? 'stale' : 'failed', statusCode)
|
|
712
723
|
}
|
|
713
724
|
}
|
package/docs/VERIFICATION.md
CHANGED
|
@@ -151,6 +151,22 @@
|
|
|
151
151
|
中英字典各 45 键、键集合一致、无空值、英文无 CJK 残留。
|
|
152
152
|
- 未验证:动画观感、面板是否确实零跳动、省略号在窄面板下的表现,需宿主重启后目视确认(本会话无浏览器控制权)。
|
|
153
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
|
+
|
|
154
170
|
## 未验证(明确记录,不代替验证)
|
|
155
171
|
|
|
156
172
|
| ID / 项 | 原因 | 何时可验 |
|
package/market/index.json
CHANGED