dsh-theme-palette 1.5.0 → 1.5.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 +18 -0
- package/client.js +52 -20
- package/package.json +3 -2
package/CHANGELOG.md
CHANGED
|
@@ -13,6 +13,24 @@
|
|
|
13
13
|
复核宿主源码发现它带 `includePrerelease`,结论相反。现在这条判断固化进脚本,不再靠手算
|
|
14
14
|
- 该改动只影响本地发版工具,**不进 npm 包**(`files` 不含 `tools/`),故不升版本号
|
|
15
15
|
|
|
16
|
+
### 1.5.2
|
|
17
|
+
设置页交互重排(用户反馈:自定义不该埋在「更多选项」里、取色看不到即时效果):
|
|
18
|
+
|
|
19
|
+
- **自定义配色提为一级区块**:选中「自定义」卡片后,面板直接出现在卡片网格下方,
|
|
20
|
+
不再需要展开「更多选项」
|
|
21
|
+
- **取色实时生效**:同时接 `onInput`(拖动过程中)与 `onChange`(确认后),
|
|
22
|
+
一次 `buildTokens` 实测 **0.15 ms**,整页配色随取色实时变化,不需要"确认"动作
|
|
23
|
+
- **色块放大**:`input[type=color]` 变成 44px 高的圆角色块(隐藏原生 swatch 边框),
|
|
24
|
+
下方显示字段名与十六进制值;三个色块一排,窄屏自动堆叠
|
|
25
|
+
- **恢复默认**:面板右上角一键回到出厂三色
|
|
26
|
+
- 修:预览渲染器不输出 `value`/`placeholder`/`readonly`,导致静态预览里色块是黑的、
|
|
27
|
+
导出码框是空的(真实应用不受影响)
|
|
28
|
+
|
|
29
|
+
### 1.5.1
|
|
30
|
+
- `dsh.compatibility.profiles` 补 `web`:在 web profile 上实测 5 张卡片(含「自定义」)正常显示,
|
|
31
|
+
与 desktop 一致;`dshOperations` 的 install/start 保持 `passed`,uninstall/rollback 仍如实 `unknown`
|
|
32
|
+
- 只改声明,无运行时改动
|
|
33
|
+
|
|
16
34
|
### 1.5.0
|
|
17
35
|
反哺 A-2 / A-3 / A-4 / A-5 —— 把"能调"扩成"可迁移、可自定义、可无障碍、可回归":
|
|
18
36
|
|
package/client.js
CHANGED
|
@@ -27,7 +27,7 @@ window.__ModuleLoader__.load({
|
|
|
27
27
|
const React = require('react')
|
|
28
28
|
const h = React.createElement
|
|
29
29
|
|
|
30
|
-
const PLUGIN_VERSION = '1.5.
|
|
30
|
+
const PLUGIN_VERSION = '1.5.2'
|
|
31
31
|
const STORE_KEY = 'dsh-theme-palette.v1'
|
|
32
32
|
const OVERRIDE_SOURCE = 'dsh-theme-palette'
|
|
33
33
|
|
|
@@ -903,7 +903,18 @@ body[data-ds-dark-theme] .dsh-tp-check{background:var(--t-accent-d);color:var(--
|
|
|
903
903
|
.dsh-tp-input::placeholder{color:var(--dsw-alias-label-tertiary)}
|
|
904
904
|
.dsh-tp-mini{font:inherit;font-size:12.5px;line-height:20px;padding:5px 12px;border-radius:8px;border:.5px solid var(--dsw-alias-border-l4);background:var(--dsw-alias-interactive-bg-hover);color:var(--dsw-alias-label-primary);cursor:pointer}
|
|
905
905
|
.dsh-tp-mini:hover{background:var(--dsw-alias-bg-layer-1)}
|
|
906
|
-
.dsh-tp-
|
|
906
|
+
.dsh-tp-custom{display:flex;flex-direction:column;gap:10px;padding:12px;border-radius:14px;border:.5px solid var(--dsw-alias-border-l4);background:var(--dsw-alias-interactive-bg-hover)}
|
|
907
|
+
.dsh-tp-custom-head{display:flex;align-items:center;justify-content:space-between;gap:8px}
|
|
908
|
+
.dsh-tp-custom-head b{font-size:13.5px;font-weight:500}
|
|
909
|
+
.dsh-tp-swatches{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:10px}
|
|
910
|
+
@media (max-width:520px){.dsh-tp-swatches{grid-template-columns:1fr}}
|
|
911
|
+
.dsh-tp-swatch{display:flex;flex-direction:column;gap:6px;cursor:pointer}
|
|
912
|
+
.dsh-tp-color{width:100%;height:44px;padding:0;border:.5px solid var(--dsw-alias-border-l4);border-radius:10px;background:transparent;cursor:pointer}
|
|
913
|
+
.dsh-tp-color::-webkit-color-swatch-wrapper{padding:3px}
|
|
914
|
+
.dsh-tp-color::-webkit-color-swatch{border:none;border-radius:8px}
|
|
915
|
+
.dsh-tp-swatch-name{font-size:12px;color:var(--dsw-alias-label-secondary)}
|
|
916
|
+
.dsh-tp-hex{font:11.5px/1 ui-monospace,Consolas,monospace;color:var(--dsw-alias-label-tertiary)}
|
|
917
|
+
.dsh-tp-custom-hint{margin:0;font-size:11.5px;line-height:17px;color:var(--dsw-alias-label-tertiary)}
|
|
907
918
|
.dsh-tp-note{font-size:11.5px;color:var(--dsw-alias-label-tertiary)}
|
|
908
919
|
.dsh-tp-status{margin:0;font-size:11.5px;line-height:18px;color:var(--dsw-alias-label-tertiary)}
|
|
909
920
|
.dsh-tp-status.is-bad{color:var(--dsw-alias-state-error-primary)}
|
|
@@ -1190,6 +1201,7 @@ body[data-ds-dark-theme] .dsh-tp-check{background:var(--t-accent-d);color:var(--
|
|
|
1190
1201
|
customHint: '取三个色的色相与色度;明度由引擎按明暗模式算,对比度仍由求解器兜底。',
|
|
1191
1202
|
config: '配置',
|
|
1192
1203
|
configHint: '导出这台机器的配色选择,或粘贴短码导入;导入会覆盖全部 8 项。',
|
|
1204
|
+
reset: '恢复默认',
|
|
1193
1205
|
copy: '复制',
|
|
1194
1206
|
applyImport: '导入',
|
|
1195
1207
|
copied: '已复制',
|
|
@@ -1233,6 +1245,7 @@ body[data-ds-dark-theme] .dsh-tp-check{background:var(--t-accent-d);color:var(--
|
|
|
1233
1245
|
customHint: '取三個色的色相與色度;明度由引擎依明暗模式計算,對比度仍由求解器兜底。',
|
|
1234
1246
|
config: '設定',
|
|
1235
1247
|
configHint: '匯出這台機器的配色選擇,或貼上短碼匯入;匯入會覆蓋全部 8 項。',
|
|
1248
|
+
reset: '恢復預設',
|
|
1236
1249
|
copy: '複製',
|
|
1237
1250
|
applyImport: '匯入',
|
|
1238
1251
|
copied: '已複製',
|
|
@@ -1276,6 +1289,7 @@ body[data-ds-dark-theme] .dsh-tp-check{background:var(--t-accent-d);color:var(--
|
|
|
1276
1289
|
customHint: 'Takes hue and chroma from three colours; lightness comes from the engine per mode and contrast is still solved.',
|
|
1277
1290
|
config: 'Config',
|
|
1278
1291
|
configHint: 'Export this machine’s choices, or paste a short code to import. Import overwrites all 8 settings.',
|
|
1292
|
+
reset: 'Reset',
|
|
1279
1293
|
copy: 'Copy',
|
|
1280
1294
|
applyImport: 'Import',
|
|
1281
1295
|
copied: 'Copied',
|
|
@@ -1319,6 +1333,7 @@ body[data-ds-dark-theme] .dsh-tp-check{background:var(--t-accent-d);color:var(--
|
|
|
1319
1333
|
customHint: '3 色の色相と彩度だけを使います。明度はモードごとにエンジンが決め、コントラストは従来どおり求解します。',
|
|
1320
1334
|
config: '設定の共有',
|
|
1321
1335
|
configHint: 'この端末の配色設定を書き出す/短いコードを貼り付けて読み込みます(8 項目すべて上書き)。',
|
|
1336
|
+
reset: 'リセット',
|
|
1322
1337
|
copy: 'コピー',
|
|
1323
1338
|
applyImport: '読み込み',
|
|
1324
1339
|
copied: 'コピーしました',
|
|
@@ -1426,6 +1441,34 @@ body[data-ds-dark-theme] .dsh-tp-check{background:var(--t-accent-d);color:var(--
|
|
|
1426
1441
|
control,
|
|
1427
1442
|
)
|
|
1428
1443
|
|
|
1444
|
+
const customColors = props.getCustomColors()
|
|
1445
|
+
const customPanel = current === 'custom' && h(
|
|
1446
|
+
'div',
|
|
1447
|
+
{ className: 'dsh-tp-custom' },
|
|
1448
|
+
h('div', { className: 'dsh-tp-custom-head' },
|
|
1449
|
+
h('b', null, txt.custom),
|
|
1450
|
+
h('button', {
|
|
1451
|
+
type: 'button',
|
|
1452
|
+
className: 'dsh-tp-mini',
|
|
1453
|
+
onClick: () => props.resetCustom(),
|
|
1454
|
+
}, txt.reset)),
|
|
1455
|
+
h('div', { className: 'dsh-tp-swatches' },
|
|
1456
|
+
['bg', 'text', 'accent'].map((field) => h('label', { key: field, className: 'dsh-tp-swatch' },
|
|
1457
|
+
h('input', {
|
|
1458
|
+
type: 'color',
|
|
1459
|
+
className: 'dsh-tp-color',
|
|
1460
|
+
value: customColors[field],
|
|
1461
|
+
// input 是"拖动过程中"就触发,change 是"确认后"触发;两个都接,
|
|
1462
|
+
// 拖动时实时看到整页变化,松手/确认后不会再跳一次
|
|
1463
|
+
onInput: (e) => props.setCustomColor(field, e.target.value),
|
|
1464
|
+
onChange: (e) => props.setCustomColor(field, e.target.value),
|
|
1465
|
+
'aria-label': (lb.custom && lb.custom[field]) || field,
|
|
1466
|
+
}),
|
|
1467
|
+
h('span', { className: 'dsh-tp-swatch-name' }, (lb.custom && lb.custom[field]) || field),
|
|
1468
|
+
h('code', { className: 'dsh-tp-hex' }, customColors[field])))),
|
|
1469
|
+
h('p', { className: 'dsh-tp-custom-hint' }, txt.customHint),
|
|
1470
|
+
)
|
|
1471
|
+
|
|
1429
1472
|
const card = (scheme) => {
|
|
1430
1473
|
const picked = scheme.id === current
|
|
1431
1474
|
const c = cardColors(scheme, textMode)
|
|
@@ -1462,6 +1505,7 @@ body[data-ds-dark-theme] .dsh-tp-check{background:var(--t-accent-d);color:var(--
|
|
|
1462
1505
|
h('span', { className: 'dsh-tp-badge' }, 'v' + PLUGIN_VERSION)),
|
|
1463
1506
|
h('p', { className: 'dsh-tp-sub' }, txt.hint),
|
|
1464
1507
|
h('div', { className: 'dsh-tp-grid' }, SCHEMES.map(card)),
|
|
1508
|
+
customPanel,
|
|
1465
1509
|
row(txt.text, txt.textSub, seg(TEXT_MODES, textMode, props.setTextMode, lb.text)),
|
|
1466
1510
|
row(txt.sidebar, txt.sidebarSub, seg(SIDEBAR_MODES, sidebarMode, props.setSidebarMode, lb.sidebar)),
|
|
1467
1511
|
row(txt.rightbar, txt.rightbarSub, seg(RIGHTBAR_MODES, rightbarMode, props.setRightbarMode, lb.rightbar)),
|
|
@@ -1480,24 +1524,6 @@ body[data-ds-dark-theme] .dsh-tp-check{background:var(--t-accent-d);color:var(--
|
|
|
1480
1524
|
advanced && h(
|
|
1481
1525
|
'div',
|
|
1482
1526
|
{ className: 'dsh-tp-adv' },
|
|
1483
|
-
current === 'custom' && h(
|
|
1484
|
-
'div',
|
|
1485
|
-
{ style: { display: 'flex', flexDirection: 'column', gap: 6 } },
|
|
1486
|
-
h('div', { style: { fontSize: 14, lineHeight: '22px' } }, txt.custom),
|
|
1487
|
-
h('div', { style: { display: 'flex', gap: 10, flexWrap: 'wrap', alignItems: 'center' } },
|
|
1488
|
-
['bg', 'text', 'accent'].map((field) => h('label', {
|
|
1489
|
-
key: field,
|
|
1490
|
-
style: { display: 'inline-flex', alignItems: 'center', gap: 6, fontSize: 12.5, color: 'var(--dsw-alias-label-secondary)' },
|
|
1491
|
-
},
|
|
1492
|
-
h('input', {
|
|
1493
|
-
type: 'color',
|
|
1494
|
-
className: 'dsh-tp-color',
|
|
1495
|
-
value: props.getCustomColors()[field],
|
|
1496
|
-
onChange: (e) => props.setCustomColor(field, e.target.value),
|
|
1497
|
-
}),
|
|
1498
|
-
(lb.custom && lb.custom[field]) || field))),
|
|
1499
|
-
h('p', { style: { margin: 0, fontSize: 12, lineHeight: '18px', color: 'var(--dsw-alias-label-tertiary)' } }, txt.customHint),
|
|
1500
|
-
),
|
|
1501
1527
|
row(txt.lang, txt.langSub, seg(LANG_OPTIONS, langPref, props.setLangPref, lb.lang)),
|
|
1502
1528
|
h(
|
|
1503
1529
|
'div',
|
|
@@ -1820,6 +1846,11 @@ body[data-ds-dark-theme] .dsh-tp-check{background:var(--t-accent-d);color:var(--
|
|
|
1820
1846
|
return true
|
|
1821
1847
|
}
|
|
1822
1848
|
const getCustomColors = () => readCustom()
|
|
1849
|
+
const resetCustom = () => {
|
|
1850
|
+
writeCustom(Object.assign({}, CUSTOM_DEFAULT))
|
|
1851
|
+
applyAll('custom:reset')
|
|
1852
|
+
emit()
|
|
1853
|
+
}
|
|
1823
1854
|
const setCustomColor = (field, hex) => {
|
|
1824
1855
|
if (CUSTOM_FIELDS.indexOf(field) === -1) return
|
|
1825
1856
|
if (typeof hex !== 'string' || !HEX_RE.test(hex)) return
|
|
@@ -1962,6 +1993,7 @@ body[data-ds-dark-theme] .dsh-tp-check{background:var(--t-accent-d);color:var(--
|
|
|
1962
1993
|
applyConfigCode,
|
|
1963
1994
|
getCustomColors,
|
|
1964
1995
|
setCustomColor,
|
|
1996
|
+
resetCustom,
|
|
1965
1997
|
getLangPref,
|
|
1966
1998
|
getLocale,
|
|
1967
1999
|
subscribeLocale,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "dsh-theme-palette",
|
|
3
|
-
"version": "1.5.
|
|
3
|
+
"version": "1.5.2",
|
|
4
4
|
"description": "DSH 主题配色:4 套配色 × 明暗两模式,OKLCH 色域安全重建 + 真实承载面对比度求解,可调强度与面板表面。",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "index.js",
|
|
@@ -64,7 +64,8 @@
|
|
|
64
64
|
}
|
|
65
65
|
},
|
|
66
66
|
"profiles": [
|
|
67
|
-
"desktop"
|
|
67
|
+
"desktop",
|
|
68
|
+
"web"
|
|
68
69
|
]
|
|
69
70
|
}
|
|
70
71
|
},
|