@laraveladmin/dsh-stay-awake 0.4.0 → 0.4.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 +22 -0
- package/README.en.md +1 -0
- package/README.md +1 -0
- package/client.js +31 -11
- package/docs/VERIFICATION.md +22 -0
- package/i18n/ar.json +2 -1
- package/market/index.json +2 -2
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,27 @@
|
|
|
1
1
|
# 变更记录 · Changelog
|
|
2
2
|
|
|
3
|
+
## 0.4.2 — 2026-12-06
|
|
4
|
+
|
|
5
|
+
### 修复
|
|
6
|
+
|
|
7
|
+
- 设置弹层里的**开关(toggle)圆点没有真正上下居中**:轨道 34×18、圆点 12px,原来 `top/left: 2px`
|
|
8
|
+
导致上边距 2px、下边距 4px,打开状态右边距也比左边宽 2px。改为 `top/left: 3px`(2×(3+12+3)=34/18,
|
|
9
|
+
`translateX(16px)` 保持对称),关闭与打开两个状态四周边距都严格相等。
|
|
10
|
+
- 纯样式改动,刷新页面即生效;不影响功能与其它组件。
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
## 0.4.1 — 2026-12-06
|
|
14
|
+
|
|
15
|
+
### 改进
|
|
16
|
+
|
|
17
|
+
- **阿拉伯语 RTL 布局**:弹层与状态栏指示器按当前语言切换 `dir="rtl"`,CSS 对齐改用逻辑属性
|
|
18
|
+
(`text-align: start/end`)使标签、数值、开关整行镜像;弹层定位改为锚定触发点右缘再按视口夹紧,
|
|
19
|
+
从右往左展开;`v0.4.0`、`cordis.patch.yml`、计数等拉丁/数字片段加 `dir="auto"` 保持自身方向。
|
|
20
|
+
- RTL 语言由翻译源声明(`i18n/ar.json` 的 `"rtl": true`),构建脚本生成 `RTL_LOCALES`;新增 1 项测试
|
|
21
|
+
锁定「声明 → 生成 → 客户端 dir 切换」这条链路,单测 125 → **126 全绿**。
|
|
22
|
+
- 纯客户端改动,刷新页面即生效。
|
|
23
|
+
|
|
24
|
+
|
|
3
25
|
## 0.4.0 — 2026-12-03
|
|
4
26
|
|
|
5
27
|
### 新功能:18 种语言
|
package/README.en.md
CHANGED
|
@@ -267,6 +267,7 @@ systemd-inhibit --list
|
|
|
267
267
|
- The indicator, the panel and the plugin-manager copy follow the active DSH locale and ship **18 languages**: Simplified Chinese, Traditional Chinese, English, Japanese, Korean, German, Spanish, French, Italian, Portuguese, Russian, Dutch, Polish, Turkish, Hindi, Indonesian, Vietnamese and Arabic.
|
|
268
268
|
- `zh / en / ja / es / fr / de / ru / pt` are DSH's own locales, so they apply completely. `zh-Hant / ko / it / nl / pl / tr / hi / id / vi / ar` are **contributed** by the plugin through `ctx.locale.addLanguage` (Traditional Chinese falls back to Simplified, the rest to English): the plugin's copy is fully translated while the rest of the GUI follows the fallback chain.
|
|
269
269
|
- Translations live in `i18n/<locale>.json` (one file per language); `npm run i18n` generates the embedded dictionaries and `locale/<locale>.json`, and `npm test` enforces an identical key set, no empty values, no CJK leftovers in Latin-script locales, and that the generated bundle matches the sources.
|
|
270
|
+
- **Arabic is laid out right-to-left**: the panel and the composer indicator switch to `dir="rtl"`, rows mirror (labels, values, switches) and the panel grows from the trigger's right edge; Latin fragments such as `v0.4.0` or `cordis.patch.yml` keep their own direction through `dir="auto"`. RTL locales are declared with `"rtl": true` in `i18n/<locale>.json` and generated from it.
|
|
270
271
|
- **Translations are AI-produced first drafts**, not reviewed by native speakers; corrections via a PR to the matching `i18n/<locale>.json` (then `npm run i18n`) are welcome.
|
|
271
272
|
|
|
272
273
|
## Development
|
package/README.md
CHANGED
|
@@ -270,6 +270,7 @@ systemd-inhibit --list
|
|
|
270
270
|
- 状态栏指示器、弹层与插件管理器文案跟随 DSH 当前语言,内置 **18 种语言**:简体中文、繁體中文、English、日本語、한국어、Deutsch、Español、Français、Italiano、Português、Русский、Nederlands、Polski、Türkçe、हिन्दी、Bahasa Indonesia、Tiếng Việt、العربية。
|
|
271
271
|
- 其中 `zh / en / ja / es / fr / de / ru / pt` 是 DSH 自带语言,切换即完整生效;`zh-Hant / ko / it / nl / pl / tr / hi / id / vi / ar` 由插件通过 `ctx.locale.addLanguage` **贡献**到语言列表(回退:繁中→简中,其余→英文)。选中这些语言时插件文案是完整母语,DSH 其余界面按回退链显示,仍然可用。
|
|
272
272
|
- 翻译源文件在 `i18n/<locale>.json`(一种语言一个文件),`npm run i18n` 生成内嵌字典与 `locale/<locale>.json`;`npm test` 会校验「键集合一致、无空值、拉丁语系无中日韩残留、生成结果与源同步」。
|
|
273
|
+
- **阿拉伯语按 RTL 布局**:弹层与状态栏指示器会切到 `dir="rtl"`,标签/数值/开关整行镜像、弹层从触发点右缘向左展开;`v0.4.0`、`cordis.patch.yml` 这类拉丁内容用 `dir="auto"` 保持自身方向。RTL 语言由 `i18n/<locale>.json` 的 `"rtl": true` 声明并生成。
|
|
273
274
|
- **翻译为 AI 初译**,未经过母语者审校;发现措辞问题欢迎提交 PR 修改对应的 `i18n/<locale>.json` 后跑一次 `npm run i18n`。
|
|
274
275
|
|
|
275
276
|
## 开发
|
package/client.js
CHANGED
|
@@ -1090,6 +1090,7 @@ window.__ModuleLoader__.load({
|
|
|
1090
1090
|
"fallback": "en"
|
|
1091
1091
|
}
|
|
1092
1092
|
]
|
|
1093
|
+
const RTL_LOCALES = ["ar"]
|
|
1093
1094
|
// i18n:end
|
|
1094
1095
|
|
|
1095
1096
|
const CSS = `
|
|
@@ -1100,7 +1101,7 @@ window.__ModuleLoader__.load({
|
|
|
1100
1101
|
.dsa-pill svg{flex:none;width:14px;height:14px}
|
|
1101
1102
|
.dsa-label{text-overflow:ellipsis;min-width:0;overflow:hidden}
|
|
1102
1103
|
.dsa-dot{width:5px;height:5px;border-radius:50%;flex:none}
|
|
1103
|
-
.dsa-panel{position:fixed;z-index:1100;box-sizing:border-box;height:fit-content;min-height:0;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:
|
|
1104
|
+
.dsa-panel{position:fixed;z-index:1100;box-sizing:border-box;height:fit-content;min-height:0;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:start;visibility:hidden}
|
|
1104
1105
|
.dsa-panel[data-positioned="true"]{visibility:visible}
|
|
1105
1106
|
.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}
|
|
1106
1107
|
.dsa-head-label{display:inline-flex;align-items:center;gap:6px;min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
|
|
@@ -1112,14 +1113,14 @@ window.__ModuleLoader__.load({
|
|
|
1112
1113
|
.dsa-rule{border-top:.5px solid var(--dsw-alias-border-l2);margin:0 0 10px}
|
|
1113
1114
|
.dsa-grid{display:grid;grid-template-columns:minmax(76px,auto) minmax(0,1fr);gap:6px 16px;margin:0}
|
|
1114
1115
|
.dsa-key{color:var(--dsw-alias-label-tertiary);margin:0;min-width:0}
|
|
1115
|
-
.dsa-val{color:var(--dsw-alias-label-secondary);font-variant-numeric:tabular-nums;text-align:
|
|
1116
|
+
.dsa-val{color:var(--dsw-alias-label-secondary);font-variant-numeric:tabular-nums;text-align:end;margin:0;min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
|
|
1116
1117
|
.dsa-section{margin-top:14px}
|
|
1117
1118
|
.dsa-row{display:flex;align-items:center;gap:12px;min-height:24px}
|
|
1118
1119
|
.dsa-row+.dsa-row{margin-top:6px}
|
|
1119
1120
|
.dsa-grow{flex:1 1 auto;min-width:0}
|
|
1120
1121
|
.dsa-sub{color:var(--dsw-alias-label-tertiary);font-size:11px;line-height:16px}
|
|
1121
1122
|
.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}
|
|
1122
|
-
.dsa-switch::after{content:'';position:absolute;top:
|
|
1123
|
+
.dsa-switch::after{content:'';position:absolute;top:3px;left:3px;width:12px;height:12px;border-radius:50%;background:var(--dsw-alias-bg-base);transition:transform .15s ease}
|
|
1123
1124
|
.dsa-switch[aria-checked="true"]{background:var(--dsw-alias-state-success-primary)}
|
|
1124
1125
|
.dsa-switch[aria-checked="true"]::after{transform:translateX(16px)}
|
|
1125
1126
|
.dsa-switch:disabled{opacity:.5;cursor:default}
|
|
@@ -1296,10 +1297,14 @@ window.__ModuleLoader__.load({
|
|
|
1296
1297
|
const rect = trigger && typeof trigger.getBoundingClientRect === 'function' ? trigger.getBoundingClientRect() : null
|
|
1297
1298
|
const anchored = rect !== null && (rect.width > 0 || rect.height > 0)
|
|
1298
1299
|
&& rect.bottom > 0 && rect.top < viewportH
|
|
1300
|
+
// RTL panels grow from the trigger's right edge, the same way an LTR
|
|
1301
|
+
// panel grows from its left edge.
|
|
1302
|
+
const rtl = panel.getAttribute('dir') === 'rtl'
|
|
1299
1303
|
let left
|
|
1300
1304
|
let top
|
|
1301
1305
|
if (anchored) {
|
|
1302
|
-
|
|
1306
|
+
const preferred = rtl ? rect.right - width : rect.left
|
|
1307
|
+
left = clamp(preferred, margin, Math.max(margin, viewportW - width - margin))
|
|
1303
1308
|
const above = rect.top - gap - height
|
|
1304
1309
|
if (above >= margin) {
|
|
1305
1310
|
top = above
|
|
@@ -1383,7 +1388,7 @@ window.__ModuleLoader__.load({
|
|
|
1383
1388
|
)
|
|
1384
1389
|
}
|
|
1385
1390
|
|
|
1386
|
-
function Indicator({ store, t }) {
|
|
1391
|
+
function Indicator({ store, t, rtl }) {
|
|
1387
1392
|
const snapshot = useStore(store)
|
|
1388
1393
|
const view = classify(snapshot.status, snapshot.failures)
|
|
1389
1394
|
return h(
|
|
@@ -1396,6 +1401,7 @@ window.__ModuleLoader__.load({
|
|
|
1396
1401
|
type: 'button',
|
|
1397
1402
|
className: 'dsa-pill dsa-root',
|
|
1398
1403
|
'data-dsa-anchor': 'stay-awake',
|
|
1404
|
+
dir: rtl ? 'rtl' : 'ltr',
|
|
1399
1405
|
'aria-expanded': snapshot.open === true,
|
|
1400
1406
|
'aria-haspopup': 'dialog',
|
|
1401
1407
|
onClick: () => store.toggle(),
|
|
@@ -1414,7 +1420,7 @@ window.__ModuleLoader__.load({
|
|
|
1414
1420
|
)
|
|
1415
1421
|
}
|
|
1416
1422
|
|
|
1417
|
-
function Panel({ store, t, act }) {
|
|
1423
|
+
function Panel({ store, t, act, rtl }) {
|
|
1418
1424
|
const snapshot = useStore(store)
|
|
1419
1425
|
const open = snapshot.open === true
|
|
1420
1426
|
const panelRef = React.useRef(null)
|
|
@@ -1522,7 +1528,7 @@ window.__ModuleLoader__.load({
|
|
|
1522
1528
|
|
|
1523
1529
|
return h(
|
|
1524
1530
|
'div',
|
|
1525
|
-
{ className: 'dsa-panel', role: 'dialog', 'aria-label': t('brand'), ref: panelRef },
|
|
1531
|
+
{ className: 'dsa-panel', role: 'dialog', 'aria-label': t('brand'), ref: panelRef, dir: rtl ? 'rtl' : 'ltr' },
|
|
1526
1532
|
stylesheet === null ? h('style', { key: 'css' }, CSS) : null,
|
|
1527
1533
|
h(
|
|
1528
1534
|
'div',
|
|
@@ -1533,7 +1539,7 @@ window.__ModuleLoader__.load({
|
|
|
1533
1539
|
h(Moon, { key: 'icon', color: toneColor(view.tone) }),
|
|
1534
1540
|
t('brand'),
|
|
1535
1541
|
),
|
|
1536
|
-
h('span', { className: 'dsa-head-value' }, h('span', { className: 'dsa-state' }, t(`state.${view.key}`))),
|
|
1542
|
+
h('span', { className: 'dsa-head-value' }, h('span', { className: 'dsa-state', dir: 'auto' }, t(`state.${view.key}`))),
|
|
1537
1543
|
),
|
|
1538
1544
|
h('div', { className: 'dsa-rule', key: 'rule' }),
|
|
1539
1545
|
staleHost || snapshot.notice === 'stale'
|
|
@@ -1546,7 +1552,7 @@ window.__ModuleLoader__.load({
|
|
|
1546
1552
|
{ className: 'dsa-grid', key: 'grid' },
|
|
1547
1553
|
rows.flatMap(([key, value, tip], index) => [
|
|
1548
1554
|
h('dt', { key: `k${index}`, className: 'dsa-key' }, key),
|
|
1549
|
-
h('dd', { key: `v${index}`, className: 'dsa-val', title: tip ?? value }, value),
|
|
1555
|
+
h('dd', { key: `v${index}`, className: 'dsa-val', title: tip ?? value, dir: 'auto' }, value),
|
|
1550
1556
|
]),
|
|
1551
1557
|
),
|
|
1552
1558
|
h(
|
|
@@ -1638,10 +1644,12 @@ window.__ModuleLoader__.load({
|
|
|
1638
1644
|
// Always in flow: it is the widest row in most panels, so keeping
|
|
1639
1645
|
// it mounted is what keeps the fit-content width steady.
|
|
1640
1646
|
className: 'dsa-status-hint',
|
|
1647
|
+
dir: 'auto',
|
|
1641
1648
|
'data-hidden': notice === null ? undefined : 'true',
|
|
1642
1649
|
}, t('panel.advanced')),
|
|
1643
1650
|
h('span', {
|
|
1644
1651
|
className: `dsa-status-note${notice === null ? '' : notice.tone === 'error' ? ' dsa-error' : ' dsa-ok'}`,
|
|
1652
|
+
dir: 'auto',
|
|
1645
1653
|
'data-visible': notice === null ? 'false' : 'true',
|
|
1646
1654
|
role: 'status',
|
|
1647
1655
|
'aria-live': 'polite',
|
|
@@ -1658,6 +1666,7 @@ window.__ModuleLoader__.load({
|
|
|
1658
1666
|
status && typeof status.version === 'string'
|
|
1659
1667
|
? h('a', {
|
|
1660
1668
|
className: 'dsa-version',
|
|
1669
|
+
dir: 'ltr',
|
|
1661
1670
|
href: `${NPM_URL}${status.version}`,
|
|
1662
1671
|
target: '_blank',
|
|
1663
1672
|
rel: 'noreferrer noopener',
|
|
@@ -1717,6 +1726,17 @@ window.__ModuleLoader__.load({
|
|
|
1717
1726
|
|
|
1718
1727
|
const store = createStore()
|
|
1719
1728
|
|
|
1729
|
+
// Locale direction is read live per render; the locale subscription
|
|
1730
|
+
// below bumps `localeRevision`, so switching to العربية re-renders the
|
|
1731
|
+
// pill and the panel with dir="rtl" without a reload.
|
|
1732
|
+
const rtlNow = () => {
|
|
1733
|
+
try {
|
|
1734
|
+
return RTL_LOCALES.includes(ctx.locale.getLocale().active)
|
|
1735
|
+
} catch {
|
|
1736
|
+
return false
|
|
1737
|
+
}
|
|
1738
|
+
}
|
|
1739
|
+
|
|
1720
1740
|
ctx.effect(() => {
|
|
1721
1741
|
try {
|
|
1722
1742
|
return ctx.locale.subscribe(() => store.set({ localeRevision: store.get().localeRevision + 1 }))
|
|
@@ -1839,7 +1859,7 @@ window.__ModuleLoader__.load({
|
|
|
1839
1859
|
ctx.slots.register(
|
|
1840
1860
|
{ name: 'conversation.composer.dock', id: 'stay-awake', order: 20 },
|
|
1841
1861
|
function DockIndicator() {
|
|
1842
|
-
return h(Indicator, { store, t })
|
|
1862
|
+
return h(Indicator, { store, t, rtl: rtlNow() })
|
|
1843
1863
|
},
|
|
1844
1864
|
),
|
|
1845
1865
|
)
|
|
@@ -1848,7 +1868,7 @@ window.__ModuleLoader__.load({
|
|
|
1848
1868
|
ctx.slots.register(
|
|
1849
1869
|
{ name: 'shell.overlay', id: 'stay-awake-panel', order: 40 },
|
|
1850
1870
|
function StayAwakePanel() {
|
|
1851
|
-
return h(Panel, { store, t, act })
|
|
1871
|
+
return h(Panel, { store, t, act, rtl: rtlNow() })
|
|
1852
1872
|
},
|
|
1853
1873
|
),
|
|
1854
1874
|
)
|
package/docs/VERIFICATION.md
CHANGED
|
@@ -298,6 +298,28 @@
|
|
|
298
298
|
- 未验证:非 DSH 自带语言在「设置 → 语言」中的实际显示效果、阿拉伯语 RTL 在 LTR 界面中的观感,
|
|
299
299
|
需刷新页面后目视确认(本会话无浏览器控制权)。
|
|
300
300
|
|
|
301
|
+
## 0.4.1 阿拉伯语 RTL(2026-12-06)
|
|
302
|
+
|
|
303
|
+
- **背景**:DSH 客户端没有任何 RTL 处理(遍历 `dsh-client-*` 源码无 `dir="rtl"` / direction 切换),
|
|
304
|
+
因此阿拉伯语此前只有文字方向正确、布局仍是 LTR。
|
|
305
|
+
- **改法**:翻译源 `i18n/ar.json` 声明 `"rtl": true`,构建脚本生成 `RTL_LOCALES`;客户端在每次渲染时读
|
|
306
|
+
`ctx.locale.getLocale().active` 判断方向(语言切换会通过 `localeRevision` 触发重渲染):
|
|
307
|
+
- 状态栏指示器与弹层设置 `dir="rtl"`;
|
|
308
|
+
- 面板 `.dsa-panel` 改 `text-align: start`、`.dsa-val` 改 `text-align: end`,栅格与 flex 行自动镜像;
|
|
309
|
+
- `placePanel` 在 RTL 下用 `left = trigger.right - width` 锚定再夹紧;
|
|
310
|
+
- 数值、状态文本、底部提示加 `dir="auto"`,版本号固定 `dir="ltr"`。
|
|
311
|
+
- 自动化:新增 1 项测试(只有 ar 声明 rtl、生成 `RTL_LOCALES`、客户端存在 dir 切换与逻辑对齐),
|
|
312
|
+
125 → **126 全绿**。
|
|
313
|
+
- 未验证:阿拉伯语下弹层面板镜像、右缘锚定与混排标点的实际观感需切换语言后目视确认。
|
|
314
|
+
|
|
315
|
+
## 0.4.2 开关圆点居中(2026-12-06)
|
|
316
|
+
|
|
317
|
+
- **问题**:用户反馈弹层里开关组件的圆点看着没有上下居中。实测几何:轨道 `34×18`、圆点 `12px`,
|
|
318
|
+
`top/left: 2px` → 上边距 2、下边距 4;打开状态 `translateX(16px)` 后右边距 4、左边距 2,两个方向各偏 1px。
|
|
319
|
+
- **改法**:`top/left: 3px`,`translateX` 保持 16px。校验:关闭态四周边距 3px;打开态左边距 3、右边距 3、
|
|
320
|
+
上下 3,严格居中。纯 CSS 改动。
|
|
321
|
+
- 未验证:实际观感需刷新页面后目视确认(本会话无浏览器控制权)。
|
|
322
|
+
|
|
301
323
|
## 未验证(明确记录,不代替验证)
|
|
302
324
|
|
|
303
325
|
| ID / 项 | 原因 | 何时可验 |
|
package/i18n/ar.json
CHANGED
package/market/index.json
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@laraveladmin/dsh-stay-awake",
|
|
3
|
-
"version": "0.4.
|
|
3
|
+
"version": "0.4.2",
|
|
4
4
|
"description": "DeepSeek Harness plugin that keeps the machine awake only while unattended work runs, and retries the turn that died with the network once it is back.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"dsh-plugin",
|