dsh-config-manager 0.3.1 → 0.4.0
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/lib/client.d.ts +33 -1
- package/lib/client.js +1060 -835
- package/lib/core/env-lock-lifecycle.d.ts +45 -0
- package/lib/core/env-lock-lifecycle.js +43 -0
- package/lib/core/history-prune.d.ts +34 -0
- package/lib/core/history-prune.js +43 -0
- package/lib/core/index.d.ts +1 -1
- package/lib/core/index.js +1 -1
- package/lib/core/migration-history.d.ts +28 -2
- package/lib/core/migration-history.js +41 -4
- package/lib/index.d.ts +2 -2
- package/lib/index.js +24 -6
- package/lib/routes/history.js +70 -5
- package/lib/routes/index.d.ts +1 -1
- package/lib/routes/kit.d.ts +2 -2
- package/lib/routes/messages.d.ts +1 -0
- package/lib/routes/messages.js +3 -0
- package/lib/sync/autosync-scheduler.js +6 -0
- package/lib/sync/backup-scheduler.js +6 -0
- package/lib/sync/ui-prefs.d.ts +8 -0
- package/lib/sync/ui-prefs.js +8 -0
- package/lib/utils/env-lock.d.ts +55 -1
- package/lib/utils/env-lock.js +131 -2
- package/lib/utils/messages-utils.d.ts +3 -0
- package/lib/utils/messages-utils.js +6 -0
- package/package.json +1 -1
- package/src/client/common/InfoHint.tsx +12 -3
- package/src/client/common/Skeleton.tsx +45 -8
- package/src/client/common/info-hint-guard.test.ts +196 -0
- package/src/client/common/routes.ts +3 -1
- package/src/client/common/skeleton-guard.test.ts +58 -0
- package/src/client/common/ui.tsx +17 -4
- package/src/client/config-manager.module.css +256 -27
- package/src/client/css-motion-guard.test.ts +230 -0
- package/src/client/environment/EnvironmentPanel.tsx +41 -29
- package/src/client/environment/maintenance/DiskUsageCard.tsx +28 -33
- package/src/client/environment/profiles-incomplete-ui.test.ts +9 -5
- package/src/client/export/ExportView.tsx +6 -6
- package/src/client/history/HistoryPanel.tsx +87 -2
- package/src/client/history/history-api.ts +49 -3
- package/src/client/history/history-locales.ts +30 -0
- package/src/client/home/HomePanel.tsx +55 -23
- package/src/client/market/MyConfigsWizard.tsx +12 -3
- package/src/client/recovery/RecoveryPanel.tsx +93 -92
- package/src/client/recovery/RollbackCard.tsx +25 -16
- package/src/client/sync/AutosyncCard.tsx +12 -6
- package/src/client/sync/ChannelConfigDialog.tsx +45 -45
- package/src/client/sync/DecryptPasswordCard.tsx +3 -3
- package/src/client/sync/SecurityOptionsCard.tsx +3 -3
- package/src/client/sync/SyncSectionPickerDialog.tsx +3 -3
- package/src/core/env-lock-lifecycle.ts +73 -0
- package/src/core/history-prune.test.ts +115 -0
- package/src/core/history-prune.ts +61 -0
- package/src/core/index.ts +2 -0
- package/src/core/migration-history.test.ts +78 -0
- package/src/core/migration-history.ts +46 -4
- package/src/index.ts +25 -6
- package/src/routes/history.ts +81 -4
- package/src/routes/index.ts +1 -1
- package/src/routes/kit.ts +2 -2
- package/src/routes/messages.ts +3 -0
- package/src/sync/autosync-scheduler.ts +3 -0
- package/src/sync/backup-scheduler.ts +3 -0
- package/src/sync/ui-prefs.test.ts +32 -0
- package/src/sync/ui-prefs.ts +16 -0
- package/src/utils/env-lock.test.ts +107 -0
- package/src/utils/env-lock.ts +124 -2
- package/src/utils/messages-utils.ts +6 -0
|
@@ -914,3 +914,199 @@ test('t11-4(issue #70,CRLF 检出):扫描器与锚点必须与换行风
|
|
|
914
914
|
const crlfNoGate = crlf.replace(' if (!(from instanceof Node) || !dialog.contains(from)) return\r\n', '');
|
|
915
915
|
assert.ok(findFocusGateViolations(crlfNoGate).length >= 1, 'CRLF 下删掉 early return 必须报红');
|
|
916
916
|
});
|
|
917
|
+
|
|
918
|
+
/* ==================================================================== *
|
|
919
|
+
* t12(2026-11-04 用户反馈 ④):「ⓘ 必须脱离 <label>」的源码级守卫
|
|
920
|
+
*
|
|
921
|
+
* 用户原话:鼠标悬浮**选择框**时会一并触发 ⓘ 的 hover 效果。排查结论(写在
|
|
922
|
+
* common/ui.tsx 的 Field 注释里):<label> 只把「点击」转发给被包裹控件、**不转发 hover**,
|
|
923
|
+
* 所以真正的耦合是——ⓘ 被塞在 label 里,点它等于点了控件(勾选框被顺手切掉 / 下拉被打开),
|
|
924
|
+
* 而它的悬停观感又与控件区域视觉上连成一片。修法两条腿:结构上带 ⓘ 的字段壳不再是 label
|
|
925
|
+
* (t12-1),交互上 ⓘ 的 onClick 先 preventDefault 掐掉 label 激活(t12-2)。
|
|
926
|
+
*
|
|
927
|
+
* 还有一条**必须同时守住**的副作用:脱离 label 后控件就失去了「点标签文字聚焦控件」的免费
|
|
928
|
+
* 关联,无障碍名必须由调用点显式给(aria-label / Select 的 ariaLabel)⇒ t12-3。
|
|
929
|
+
*
|
|
930
|
+
* 已知边界(不修,靠 preventDefault 兜):ContentPicker / SyncSectionPickerDialog 把
|
|
931
|
+
* <InfoHint> 当 **Checkbox 的 label prop** 传进去,而 Checkbox 内部才是 <label>。本守卫只扫
|
|
932
|
+
* 本文件内的字面 <label>,看不到 Checkbox 内部 —— 这不是漏检,是那两处的结构代价:
|
|
933
|
+
* 改 Checkbox 要动公共 API + 破坏 .checkboxRow + .actionRow 相邻选择器。
|
|
934
|
+
* ==================================================================== */
|
|
935
|
+
|
|
936
|
+
/** JSX 标签的结束 `>`(跳过 {} 表达式与引号里的 >;属性里有箭头函数 => 时必备)。 */
|
|
937
|
+
function jsxTagEnd(text: string, at: number): number {
|
|
938
|
+
let depth = 0;
|
|
939
|
+
let quote = '';
|
|
940
|
+
for (let i = at; i < text.length; i++) {
|
|
941
|
+
const ch = text[i] ?? '';
|
|
942
|
+
if (quote !== '') {
|
|
943
|
+
if (ch === quote) quote = '';
|
|
944
|
+
continue;
|
|
945
|
+
}
|
|
946
|
+
if (ch === "'" || ch === '"') {
|
|
947
|
+
quote = ch;
|
|
948
|
+
continue;
|
|
949
|
+
}
|
|
950
|
+
if (ch === '{') depth++;
|
|
951
|
+
else if (ch === '}') depth--;
|
|
952
|
+
else if (ch === '>' && depth === 0) return i;
|
|
953
|
+
}
|
|
954
|
+
return -1;
|
|
955
|
+
}
|
|
956
|
+
|
|
957
|
+
/**
|
|
958
|
+
* 标签配对区间(`<div …>` 与 `</div>`)。
|
|
959
|
+
* 只用于「找字段壳」这类结构判断:别的元素(span/label)不参与,闭合同名元素才配对。
|
|
960
|
+
*/
|
|
961
|
+
function fieldDivBlocks(code: string): Array<{ start: number; end: number }> {
|
|
962
|
+
const re = /<div\b|<\/div>/g;
|
|
963
|
+
const stack: number[] = [];
|
|
964
|
+
const blocks: Array<{ start: number; end: number }> = [];
|
|
965
|
+
let m: RegExpExecArray | null;
|
|
966
|
+
while ((m = re.exec(code)) !== null) {
|
|
967
|
+
if (m[0] === '<div') {
|
|
968
|
+
stack.push(m.index);
|
|
969
|
+
continue;
|
|
970
|
+
}
|
|
971
|
+
const start = stack.pop();
|
|
972
|
+
if (start !== undefined) blocks.push({ start, end: m.index });
|
|
973
|
+
}
|
|
974
|
+
return blocks;
|
|
975
|
+
}
|
|
976
|
+
|
|
977
|
+
/**
|
|
978
|
+
* t12-1 扫描:`<InfoHint>` 落在字面 `<label>` 内部的位置(返回 文件:行 的「行」)。
|
|
979
|
+
* 栈式配对,嵌套 label 也算(历史上有 div.field > label.field 的写法)。
|
|
980
|
+
*/
|
|
981
|
+
function findHintInsideLabelViolations(code: string): number[] {
|
|
982
|
+
const re = /<label\b|<\/label>|<InfoHint\b/g;
|
|
983
|
+
const lines: number[] = [];
|
|
984
|
+
let depth = 0;
|
|
985
|
+
let m: RegExpExecArray | null;
|
|
986
|
+
while ((m = re.exec(code)) !== null) {
|
|
987
|
+
if (m[0] === '<label') depth++;
|
|
988
|
+
else if (m[0] === '</label>') depth = Math.max(0, depth - 1);
|
|
989
|
+
else if (depth > 0) lines.push(lineOf(code, m.index));
|
|
990
|
+
}
|
|
991
|
+
return lines;
|
|
992
|
+
}
|
|
993
|
+
|
|
994
|
+
test('t12-1 ⓘ 不得再被 <label> 包住(点 ⓘ 会顺手激活它包裹的控件)', () => {
|
|
995
|
+
const violations = readClientSources().flatMap((file) =>
|
|
996
|
+
findHintInsideLabelViolations(file.code).map((line) => file.rel + ':' + String(line)),
|
|
997
|
+
);
|
|
998
|
+
assert.deepEqual(
|
|
999
|
+
violations,
|
|
1000
|
+
[],
|
|
1001
|
+
'带 ⓘ 的字段壳必须是 <div className={css.field}>(label 会把点击转发给控件):\n' + violations.join('\n'),
|
|
1002
|
+
);
|
|
1003
|
+
// 合成片段负向自检:不依赖真实文件,规则本身必须能红
|
|
1004
|
+
const nested = "<label className={css.field}><InfoHint text={t('a.b')} /><input /></label>\n";
|
|
1005
|
+
assert.equal(findHintInsideLabelViolations(nested).length, 1, 'label 包住 ⓘ 必须报红');
|
|
1006
|
+
const deepNested = "<div className={css.field}><label className={css.field}>\n <InfoHint text={t('a.b')} />\n</label></div>\n";
|
|
1007
|
+
assert.equal(findHintInsideLabelViolations(deepNested).length, 1, '嵌套 label 里的 ⓘ 同样必须报红');
|
|
1008
|
+
const fixed = "<div className={css.field}><InfoHint text={t('a.b')} /><input aria-label={t('a.b')} /></div>\n";
|
|
1009
|
+
assert.deepEqual(findHintInsideLabelViolations(fixed), [], '改后的形态不得报红');
|
|
1010
|
+
});
|
|
1011
|
+
|
|
1012
|
+
/**
|
|
1013
|
+
* t12-2 扫描:`onClick` 必须收事件参数、并**第一件事就** `event.preventDefault()`。
|
|
1014
|
+
* 为什么是第一件事:label 激活发生在点击的默认行为里,任何提前 return(例如未固定时直接开)
|
|
1015
|
+
* 都拦不住它 —— 顺序写反等于没写。
|
|
1016
|
+
*/
|
|
1017
|
+
function findLabelActivationViolations(code: string): string[] {
|
|
1018
|
+
const violations: string[] = [];
|
|
1019
|
+
const head = /const onClick = \(event: ReactMouseEvent<HTMLButtonElement>\): void => \{\n/.exec(code);
|
|
1020
|
+
if (head === null) {
|
|
1021
|
+
violations.push('onClick 必须接收 event: ReactMouseEvent<HTMLButtonElement>(否则无从 preventDefault 掉 label 激活)');
|
|
1022
|
+
return violations;
|
|
1023
|
+
}
|
|
1024
|
+
const bodyStart = head.index + head[0].length;
|
|
1025
|
+
if (!/^\s*event\.preventDefault\(\)/m.test(code.slice(bodyStart, bodyStart + 120))) {
|
|
1026
|
+
violations.push('onClick 的第一条语句必须是 event.preventDefault()');
|
|
1027
|
+
}
|
|
1028
|
+
const body = code.slice(bodyStart, bodyStart + 600);
|
|
1029
|
+
const preventAt = body.indexOf('event.preventDefault()');
|
|
1030
|
+
const pinAt = body.indexOf('setPinned(');
|
|
1031
|
+
if (preventAt === -1) violations.push('onClick 里找不到 event.preventDefault()');
|
|
1032
|
+
else if (pinAt !== -1 && pinAt < preventAt) violations.push('preventDefault 必须在 setPinned 之前(否则状态先变、默认行为照样发生)');
|
|
1033
|
+
if (!code.includes('type MouseEvent as ReactMouseEvent')) {
|
|
1034
|
+
violations.push('必须 import type { MouseEvent as ReactMouseEvent }(事件参数的类型来源)');
|
|
1035
|
+
}
|
|
1036
|
+
return violations;
|
|
1037
|
+
}
|
|
1038
|
+
|
|
1039
|
+
test('t12-2 ⓘ 的点击必须先 preventDefault(掐掉 label 的激活转发)', () => {
|
|
1040
|
+
const hint = readClientSources().find((f) => f.rel === INFO_HINT_FILE);
|
|
1041
|
+
assert.ok(hint !== undefined, INFO_HINT_FILE + ' 必须存在');
|
|
1042
|
+
const violations = findLabelActivationViolations(hint.code);
|
|
1043
|
+
assert.deepEqual(violations, [], 'label 激活转发必须被掐断:\n' + violations.join('\n'));
|
|
1044
|
+
const noPrevent = mutate(hint.code, ' event.preventDefault()\n', '');
|
|
1045
|
+
assert.ok(findLabelActivationViolations(noPrevent).length >= 1, '删掉 preventDefault(点 ⓘ 会顺手切勾选框)必须报红');
|
|
1046
|
+
const noParam = mutate(hint.code, '(event: ReactMouseEvent<HTMLButtonElement>)', '()');
|
|
1047
|
+
assert.ok(findLabelActivationViolations(noParam).length >= 1, '收不到事件参数必须报红');
|
|
1048
|
+
});
|
|
1049
|
+
|
|
1050
|
+
/** `<label>` 的成对区间(用于「控件是否已被某个 label 关联」的判断)。 */
|
|
1051
|
+
function labelSpanRanges(code: string): Array<{ start: number; end: number }> {
|
|
1052
|
+
const re = /<label\b|<\/label>/g;
|
|
1053
|
+
const stack: number[] = [];
|
|
1054
|
+
const spans: Array<{ start: number; end: number }> = [];
|
|
1055
|
+
let m: RegExpExecArray | null;
|
|
1056
|
+
while ((m = re.exec(code)) !== null) {
|
|
1057
|
+
if (m[0] === '<label') {
|
|
1058
|
+
stack.push(m.index);
|
|
1059
|
+
continue;
|
|
1060
|
+
}
|
|
1061
|
+
const start = stack.pop();
|
|
1062
|
+
if (start !== undefined) spans.push({ start, end: m.index });
|
|
1063
|
+
}
|
|
1064
|
+
return spans;
|
|
1065
|
+
}
|
|
1066
|
+
|
|
1067
|
+
/**
|
|
1068
|
+
* t12-3 扫描:`<div className={css.field}>` 里既有 ⓘ 又有控件时,控件必须自带可访问名。
|
|
1069
|
+
* 这正是「脱离 label」的代价:label 包着控件时读屏靠 label 关联,换 div 后只能靠 aria-label。
|
|
1070
|
+
*
|
|
1071
|
+
* 例外:控件自己仍被**内层** `<label>` 包着(SyncRepositoryPicker 的「新建仓库」就是
|
|
1072
|
+
* div.field > groupLabel(带ⓘ) + label.field > input)—— 那种控件有名字,不该报红。
|
|
1073
|
+
*/
|
|
1074
|
+
function findFieldControlNameViolations(code: string): string[] {
|
|
1075
|
+
const violations: string[] = [];
|
|
1076
|
+
const labelSpans = labelSpanRanges(code);
|
|
1077
|
+
for (const block of fieldDivBlocks(code)) {
|
|
1078
|
+
const openEnd = jsxTagEnd(code, block.start);
|
|
1079
|
+
if (openEnd === -1) continue;
|
|
1080
|
+
if (code.slice(block.start, openEnd + 1) !== '<div className={css.field}>') continue;
|
|
1081
|
+
const body = code.slice(block.start, block.end);
|
|
1082
|
+
if (!body.includes('<InfoHint')) continue;
|
|
1083
|
+
const ctl = /<(input|textarea|Select)\b/.exec(body);
|
|
1084
|
+
if (ctl === null) continue; // 纯说明字段(无控件)不适用
|
|
1085
|
+
const at = block.start + ctl.index;
|
|
1086
|
+
if (labelSpans.some((span) => span.start < at && at < span.end)) continue; // 控件仍由内层 label 关联
|
|
1087
|
+
const end = jsxTagEnd(code, at);
|
|
1088
|
+
if (end === -1) continue;
|
|
1089
|
+
const tag = code.slice(at, end + 1);
|
|
1090
|
+
if (!/aria-label=|ariaLabel=/.test(tag)) {
|
|
1091
|
+
violations.push(
|
|
1092
|
+
code.slice(0, at).split('\n').length + ': 控件没有 aria-label/ariaLabel(脱离 label 后读屏拿不到名字):' + tag.replace(/\s+/g, ' ').slice(0, 80),
|
|
1093
|
+
);
|
|
1094
|
+
}
|
|
1095
|
+
}
|
|
1096
|
+
return violations;
|
|
1097
|
+
}
|
|
1098
|
+
|
|
1099
|
+
test('t12-3 带 ⓘ 的字段壳里,控件必须自带可访问名(label 关联已让位给 aria-label)', () => {
|
|
1100
|
+
const violations = readClientSources().flatMap((file) =>
|
|
1101
|
+
findFieldControlNameViolations(file.code).map((v) => file.rel + ':' + v),
|
|
1102
|
+
);
|
|
1103
|
+
assert.deepEqual(
|
|
1104
|
+
violations,
|
|
1105
|
+
[],
|
|
1106
|
+
'字段壳改成 div 后,控件必须显式给 aria-label(Select 用 ariaLabel):\n' + violations.join('\n'),
|
|
1107
|
+
);
|
|
1108
|
+
const unnamed = "<div className={css.field}>\n <InfoHint text={t('a.b')} />\n <input value={v} />\n</div>\n";
|
|
1109
|
+
assert.equal(findFieldControlNameViolations(unnamed).length, 1, '无名的控件必须报红');
|
|
1110
|
+
const named = "<div className={css.field}>\n <InfoHint text={t('a.b')} />\n <input aria-label={t('a.b')} />\n</div>\n";
|
|
1111
|
+
assert.deepEqual(findFieldControlNameViolations(named), [], '有 aria-label 不得报红');
|
|
1112
|
+
});
|
|
@@ -242,8 +242,10 @@ export const ROLLBACK_POINT_ROUTES = {
|
|
|
242
242
|
delete: { path: `${RECOVERY_API.rollbackPoints}/<id>/delete`, method: 'removeRollbackPoint' },
|
|
243
243
|
} as const;
|
|
244
244
|
|
|
245
|
-
/** 迁移历史审计路由族(只读列表 +
|
|
245
|
+
/** 迁移历史审计路由族(只读列表 + 导出 + 自动清理策略)。 */
|
|
246
246
|
export const HISTORY_API = {
|
|
247
247
|
list: `${API_BASE}/history`,
|
|
248
248
|
export: `${API_BASE}/history/export`,
|
|
249
|
+
/** 自动清理策略:GET 读当前上限 + 现状,POST 改上限并立即清理一次。 */
|
|
250
|
+
retention: `${API_BASE}/history/retention`,
|
|
249
251
|
} as const;
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* 骨架屏守卫(源码级、零依赖、只读):2026-11-04 用户第二条 ——
|
|
3
|
+
* 「删除骨架屏的所有关于加载的描述(如左下角的『加载中』),骨架屏只保留骨架」。
|
|
4
|
+
*
|
|
5
|
+
* 为什么值得一条守卫:可见文案是「二次反馈」——骨架已经说明正在加载,色块下面再写一行
|
|
6
|
+
* 「加载中…」既与 Spinner 的措辞重复,又会在数据到达时消失(旧的抖动来源)。删掉之后**不许**
|
|
7
|
+
* 再被『可访问性所以要可见文案』这类理由加回来:加载语义由外框的 role=status + aria-busy +
|
|
8
|
+
* aria-label 承担,读屏照样播报,视觉上只剩骨架。
|
|
9
|
+
*
|
|
10
|
+
* 复现:`node --test src/client/common/skeleton-guard.test.ts`
|
|
11
|
+
*/
|
|
12
|
+
import test from 'node:test';
|
|
13
|
+
import assert from 'node:assert/strict';
|
|
14
|
+
import fs from 'node:fs';
|
|
15
|
+
import path from 'node:path';
|
|
16
|
+
|
|
17
|
+
import { stripJsComments } from '../../utils/bundle-scan.ts';
|
|
18
|
+
|
|
19
|
+
const ROOT = path.resolve(import.meta.dirname, '../../..');
|
|
20
|
+
const SKELETON_FILE = 'src/client/common/Skeleton.tsx';
|
|
21
|
+
const HOME_FILE = 'src/client/home/HomePanel.tsx';
|
|
22
|
+
const STYLE_FILE = 'src/client/config-manager.module.css';
|
|
23
|
+
|
|
24
|
+
const read = (rel: string): string => fs.readFileSync(path.join(ROOT, rel), 'utf8').replace(/\r\n?/g, '\n');
|
|
25
|
+
|
|
26
|
+
function mutate(text: string, from: string, to: string): string {
|
|
27
|
+
assert.ok(text.includes(from), '负向自检锚点未命中(源码改写后需同步守卫):' + from);
|
|
28
|
+
return text.replace(from, to);
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
/** 可见加载文案的违规扫描(骨架侧)。 */
|
|
32
|
+
function findVisibleLoadingTextViolations(source: string): string[] {
|
|
33
|
+
const violations: string[] = [];
|
|
34
|
+
if (source.includes('skeletonCaption')) violations.push('骨架不得渲染可见的 caption(用户要求:骨架只保留骨架)');
|
|
35
|
+
if (!/aria-label=\{label\}/.test(source)) violations.push('骨架外框必须用 aria-label={label} 承担加载语义(删掉可见文案后这是唯一的读屏来源)');
|
|
36
|
+
return violations;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
test('t14-1 骨架不渲染可见加载文案(label 只做 aria-label)', () => {
|
|
40
|
+
const code = stripJsComments(read(SKELETON_FILE), true, false);
|
|
41
|
+
const violations = findVisibleLoadingTextViolations(code);
|
|
42
|
+
assert.deepEqual(violations, [], '骨架的加载反馈不干净:\n' + violations.join('\n'));
|
|
43
|
+
|
|
44
|
+
const withCaption = mutate(code, ' aria-label={label}', ' aria-label={label}\n >{label}</div><div');
|
|
45
|
+
assert.ok(findVisibleLoadingTextViolations(withCaption + 'skeletonCaption').length >= 1, '负向自检:把文案渲回可见位置必须报红');
|
|
46
|
+
const noName = code.split('aria-label={label}').join('');
|
|
47
|
+
assert.ok(findVisibleLoadingTextViolations(noName).length >= 1, '负向自检:删掉 aria-label 必须报红');
|
|
48
|
+
});
|
|
49
|
+
|
|
50
|
+
test('t14-2 样式表与首页不再留加载说明的落点', () => {
|
|
51
|
+
const css = read(STYLE_FILE);
|
|
52
|
+
assert.ok(!css.includes('.skeletonCaption'), '样式表里不应再有 .skeletonCaption 规则(骨架不渲染可见文案)');
|
|
53
|
+
assert.ok(!css.includes('.activityLoadingNote'), '样式表里不应再有 .activityLoadingNote(列头不挂加载说明)');
|
|
54
|
+
|
|
55
|
+
const home = stripJsComments(read(HOME_FILE), true, false);
|
|
56
|
+
assert.ok(!home.includes('activityLoadingNote'), '首页列头不应再挂加载说明');
|
|
57
|
+
assert.equal(home.includes('>{t(\'common.loading\')}<'), false, '首页不得把 common.loading 渲染成可见文本');
|
|
58
|
+
});
|
package/src/client/common/ui.tsx
CHANGED
|
@@ -70,6 +70,9 @@ export function Button({ variant = 'ghost', size, disabled, loading = false, onC
|
|
|
70
70
|
onClick={onClick}
|
|
71
71
|
// 按钮类无 text-decoration 规则,<a> 默认下划线破坏按钮外观
|
|
72
72
|
style={{ textDecoration: 'none' }}
|
|
73
|
+
// 按压回弹的选择器是 `button, [data-pressable]`:外链按钮渲染成 <a>,靠这个属性进同一套
|
|
74
|
+
// :active 缩放(正文里的行内 <a> 不加,否则报告/聊天里的链接点一下整行都抖)。
|
|
75
|
+
data-pressable=""
|
|
73
76
|
{...sizeProps}
|
|
74
77
|
>
|
|
75
78
|
{content}
|
|
@@ -304,15 +307,25 @@ export interface FieldProps {
|
|
|
304
307
|
children: ReactNode
|
|
305
308
|
}
|
|
306
309
|
|
|
307
|
-
/**
|
|
310
|
+
/**
|
|
311
|
+
* 表单字段(标签 + 控件 + 说明 / ⓘ)。
|
|
312
|
+
*
|
|
313
|
+
* **带 ⓘ 时外壳不是 `<label>`**(2026-11-04 用户反馈:悬停选择框会连带点亮 ⓘ)。
|
|
314
|
+
* 为什么:`<label>` 会把「指针在标签区域」、「点击」两件事都转发给它的控件 ——
|
|
315
|
+
* ⓘ 是个按钮,塞进 label 后它的悬停/点击与控件成了一件事(在这之前连「点 ⓘ 会顺手
|
|
316
|
+
* 切掉设置」都得靠调用点自己躲)。控件自己的无障碍名不靠这层标签:本仓库的控件一律
|
|
317
|
+
* 由调用点给 `aria-label` / `ariaLabel`(Select 的必填 prop、input 的 aria-label)。
|
|
318
|
+
* 不带 ⓘ 时仍是 `<label>`(点标签文字聚焦控件是免费的可用性),行为一字未改。
|
|
319
|
+
*/
|
|
308
320
|
export function Field({ label, hint, info, children }: FieldProps) {
|
|
309
|
-
|
|
310
|
-
|
|
321
|
+
const body = (
|
|
322
|
+
<>
|
|
311
323
|
<span className={css.fieldLabel}>{label}{info !== undefined ? <> {info}</> : null}</span>
|
|
312
324
|
{children}
|
|
313
325
|
{hint !== undefined && <span className={css.hint}>{hint}</span>}
|
|
314
|
-
|
|
326
|
+
</>
|
|
315
327
|
)
|
|
328
|
+
return info === undefined ? <label className={css.field}>{body}</label> : <div className={css.field}>{body}</div>
|
|
316
329
|
}
|
|
317
330
|
|
|
318
331
|
/* ---------------- SectionTitle ---------------- */
|