soma-core 1.3.5 → 1.4.1
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/README.md +20 -7
- package/app/SomaPageClient.tsx +4 -4
- package/app/components/SomaHostPage.tsx +5 -5
- package/app/components/SomaHydrationShell.tsx +4 -7
- package/app/globals.css +126 -3
- package/core/build/{v2 → blocks}/block-compile.ts +47 -18
- package/core/build/{v2/soma-file-loader.ts → blocks/block-container.ts} +28 -37
- package/core/build/{v2 → blocks}/block-loader.ts +1 -1
- package/core/build/{v2 → blocks}/html-index.ts +1 -1
- package/core/build/{v2/migrate-v1.ts → blocks/migrate-flat.ts} +27 -27
- package/core/build/compiler/host-config-sync.cjs +2 -9
- package/core/build/compiler/page-declaration-compiler.ts +32 -4
- package/core/build/compiler/soma-manifest-webpack-plugin.js +1 -1
- package/core/build/compiler/soma-precompile.js +2057 -35
- package/core/build/compiler/soma-precompile.ts +2 -2
- package/core/build/component/component-graph.ts +208 -0
- package/core/build/eject/component-eject.ts +473 -0
- package/core/build/eject/component-upgrade.ts +359 -0
- package/core/build/layout/constraint-solver.ts +235 -0
- package/core/build/layout/css-emitter.ts +116 -0
- package/core/build/layout/page-layout.ts +85 -0
- package/core/build/pack/pack-init.ts +265 -0
- package/core/client/base/SomaPageRootBase.ts +61 -0
- package/core/client/component/ai-catalog.ts +83 -8
- package/core/client/component/component-defaults.ts +100 -0
- package/core/client/component/component-definition.types.ts +39 -0
- package/core/client/component/component-manager.ts +79 -4
- package/core/client/component/component-pack.ts +126 -2
- package/core/client/component/contract-compat.ts +32 -3
- package/core/client/component/{example-v2.ts → example-blocks.ts} +19 -19
- package/core/client/component/keyboard-matrix.ts +144 -0
- package/core/client/component/pack-styles.ts +59 -1
- package/core/client/component/style-features.ts +131 -0
- package/core/client/component/theme-component-tokens.ts +83 -0
- package/core/client/data/data-object-resolver.ts +407 -4
- package/core/client/data/reaction-engine.ts +176 -0
- package/core/client/data/window-engine.ts +477 -0
- package/core/client/engine/event-engine.ts +98 -0
- package/core/client/engine/soma-bootstrap.ts +286 -7
- package/core/client/engine/step-runner.ts +134 -0
- package/core/client/engine/style-binder.ts +1 -1
- package/core/client/infra/notify/DomNotifyService.ts +2 -1
- package/core/client/infra/notify/INotifyTheme.ts +1 -1
- package/core/client/parser/{v2 → blocks}/namespace.ts +1 -1
- package/core/client/parser/{v2 → blocks}/page-parser.ts +30 -16
- package/core/client/parser/{v2 → blocks}/use-parser.ts +24 -25
- package/core/client/parser/data-config-parser.ts +316 -8
- package/core/client/parser/duration.ts +16 -0
- package/core/client/parser/layout-parser.ts +157 -0
- package/core/client/parser/page-state-parser.ts +166 -0
- package/core/client/parser/pipeline-parser.ts +76 -1
- package/core/client/parser/reaction-parser.ts +459 -0
- package/core/client/parser/reaction-sugar.ts +47 -0
- package/core/client/parser/step-parser.ts +359 -0
- package/core/client/parser/style-config-parser.ts +7 -7
- package/core/client/parser/ui-config-parser.ts +59 -0
- package/core/client/parser/value-lang.ts +1 -1
- package/core/client/parser/window-parser.ts +294 -0
- package/core/client/registry/index.ts +8 -0
- package/core/client/theme/theme-engine.ts +144 -16
- package/core/client/typography/typography-base.ts +1 -1
- package/core/index.ts +188 -13
- package/core/server/host/csp-nonce-metadata.ts +1 -1
- package/core/server/host/published-page-assets.ts +3 -8
- package/core/server/host/soma-page-compile.ts +1 -1
- package/core/server/index.ts +2 -2
- package/core/shared/block-errors.ts +11 -0
- package/core/shared/calc/coerce.ts +29 -0
- package/core/shared/calc/errors.ts +43 -0
- package/core/shared/calc/evaluator.ts +101 -0
- package/core/shared/calc/index.ts +12 -0
- package/core/shared/calc/lexer.ts +194 -0
- package/core/shared/calc/parser.ts +204 -0
- package/core/shared/calc/typer.ts +184 -0
- package/core/shared/path-algebra.ts +169 -0
- package/core/shared/predicates/index.ts +527 -0
- package/core/shared/published-page-route.ts +61 -0
- package/core/shared/types/adaptive.types.ts +1 -1
- package/core/shared/types/component-contract.types.ts +128 -2
- package/core/shared/types/data-config.types.ts +149 -2
- package/core/shared/types/domain.types.ts +13 -0
- package/core/shared/types/event.types.ts +22 -2
- package/core/shared/types/layout-constraint.types.ts +73 -0
- package/core/shared/types/page-state.types.ts +60 -0
- package/core/shared/types/reaction.types.ts +144 -0
- package/core/shared/types/scope-manifest.types.ts +11 -15
- package/core/shared/types/step.types.ts +91 -0
- package/core/shared/types/style-config.types.ts +4 -4
- package/core/shared/types/ui-config.types.ts +18 -0
- package/core/shared/types/window.types.ts +177 -0
- package/dist/cli/soma.js +28 -3
- package/dist/core/index.cjs +4829 -405
- package/dist/types/build/{v2 → blocks}/block-compile.d.ts +7 -7
- package/dist/types/build/{v2/soma-file-loader.d.ts → blocks/block-container.d.ts} +6 -11
- package/dist/types/build/{v2/migrate-v1.d.ts → blocks/migrate-flat.d.ts} +6 -6
- package/dist/types/build/compiler/page-declaration-compiler.d.ts +2 -0
- package/dist/types/build/component/component-graph.d.ts +85 -0
- package/dist/types/build/eject/component-eject.d.ts +121 -0
- package/dist/types/build/eject/component-upgrade.d.ts +43 -0
- package/dist/types/build/layout/constraint-solver.d.ts +36 -0
- package/dist/types/build/layout/css-emitter.d.ts +18 -0
- package/dist/types/build/layout/page-layout.d.ts +24 -0
- package/dist/types/build/pack/pack-init.d.ts +8 -0
- package/dist/types/client/base/SomaPageRootBase.d.ts +28 -0
- package/dist/types/client/component/ai-catalog.d.ts +24 -1
- package/dist/types/client/component/component-defaults.d.ts +15 -0
- package/dist/types/client/component/component-definition.types.d.ts +38 -0
- package/dist/types/client/component/component-manager.d.ts +36 -0
- package/dist/types/client/component/component-pack.d.ts +32 -2
- package/dist/types/client/component/contract-compat.d.ts +2 -2
- package/dist/types/client/component/example-blocks.d.ts +9 -0
- package/dist/types/client/component/keyboard-matrix.d.ts +24 -0
- package/dist/types/client/component/pack-styles.d.ts +21 -0
- package/dist/types/client/component/style-features.d.ts +26 -0
- package/dist/types/client/component/theme-component-tokens.d.ts +14 -0
- package/dist/types/client/data/data-object-resolver.d.ts +106 -1
- package/dist/types/client/data/reaction-engine.d.ts +21 -0
- package/dist/types/client/data/window-engine.d.ts +27 -0
- package/dist/types/client/engine/event-engine.d.ts +15 -0
- package/dist/types/client/engine/soma-bootstrap.d.ts +70 -0
- package/dist/types/client/engine/step-runner.d.ts +24 -0
- package/dist/types/client/infra/notify/DomNotifyService.d.ts +2 -1
- package/dist/types/client/infra/notify/INotifyTheme.d.ts +1 -1
- package/dist/types/client/parser/{v2 → blocks}/page-parser.d.ts +2 -2
- package/dist/types/client/parser/{v2 → blocks}/use-parser.d.ts +3 -3
- package/dist/types/client/parser/duration.d.ts +1 -0
- package/dist/types/client/parser/layout-parser.d.ts +9 -0
- package/dist/types/client/parser/page-state-parser.d.ts +32 -0
- package/dist/types/client/parser/reaction-parser.d.ts +16 -0
- package/dist/types/client/parser/reaction-sugar.d.ts +13 -0
- package/dist/types/client/parser/step-parser.d.ts +23 -0
- package/dist/types/client/parser/style-config-parser.d.ts +1 -1
- package/dist/types/client/parser/ui-config-parser.d.ts +5 -0
- package/dist/types/client/parser/window-parser.d.ts +25 -0
- package/dist/types/client/registry/index.d.ts +1 -0
- package/dist/types/client/theme/theme-engine.d.ts +37 -0
- package/dist/types/index.d.ts +40 -9
- package/dist/types/server/host/published-page-assets.d.ts +3 -2
- package/dist/types/server/index.d.ts +1 -1
- package/dist/types/shared/block-errors.d.ts +5 -0
- package/dist/types/shared/calc/coerce.d.ts +4 -0
- package/dist/types/shared/calc/errors.d.ts +14 -0
- package/dist/types/shared/calc/evaluator.d.ts +2 -0
- package/dist/types/shared/calc/index.d.ts +6 -0
- package/dist/types/shared/calc/lexer.d.ts +20 -0
- package/dist/types/shared/calc/parser.d.ts +49 -0
- package/dist/types/shared/calc/typer.d.ts +16 -0
- package/dist/types/shared/path-algebra.d.ts +56 -0
- package/dist/types/shared/predicates/index.d.ts +79 -0
- package/dist/types/shared/published-page-route.d.ts +21 -0
- package/dist/types/shared/types/component-contract.types.d.ts +112 -0
- package/dist/types/shared/types/data-config.types.d.ts +132 -2
- package/dist/types/shared/types/domain.types.d.ts +12 -0
- package/dist/types/shared/types/event.types.d.ts +8 -2
- package/dist/types/shared/types/layout-constraint.types.d.ts +52 -0
- package/dist/types/shared/types/page-state.types.d.ts +49 -0
- package/dist/types/shared/types/reaction.types.d.ts +115 -0
- package/dist/types/shared/types/scope-manifest.types.d.ts +11 -11
- package/dist/types/shared/types/step.types.d.ts +76 -0
- package/dist/types/shared/types/style-config.types.d.ts +4 -4
- package/dist/types/shared/types/ui-config.types.d.ts +18 -0
- package/dist/types/shared/types/window.types.d.ts +171 -0
- package/package.json +2 -6
- package/dist/types/client/component/example-v2.d.ts +0 -9
- package/postcss.config.js +0 -6
- package/tailwind.config.ts +0 -43
- /package/dist/types/build/{v2 → blocks}/block-loader.d.ts +0 -0
- /package/dist/types/build/{v2 → blocks}/html-index.d.ts +0 -0
- /package/dist/types/client/parser/{v2 → blocks}/namespace.d.ts +0 -0
|
@@ -0,0 +1,294 @@
|
|
|
1
|
+
// `window:` 段解析(REQ-010 S2)——把「怎么取这一屏」的意图编译成可校验的请求形状。
|
|
2
|
+
//
|
|
3
|
+
// 五步(《架构设计》§6.2):过滤 AST → 字段引用 → 选择态 → 派生列 → 字典哈希。
|
|
4
|
+
// 每一步的失败都在**声明期**抛,因为窗口的错误在运行期是看不见的:
|
|
5
|
+
// 一条 `op` 与字段类型不配的过滤条件,后端多半会照着执行并返回一个空列表,
|
|
6
|
+
// 而空列表和「这个条件确实没命中」长得一模一样。
|
|
7
|
+
|
|
8
|
+
import {
|
|
9
|
+
SOMA_AGGREGATE_FNS,
|
|
10
|
+
SOMA_SELECT_ALL_MODES,
|
|
11
|
+
type SomaAggregateFn,
|
|
12
|
+
type SomaFilterNode,
|
|
13
|
+
type SomaSelectAllMode,
|
|
14
|
+
type SomaWindowAggregate,
|
|
15
|
+
type SomaWindowConfig,
|
|
16
|
+
type SomaWindowSelection,
|
|
17
|
+
type SomaWindowSort,
|
|
18
|
+
} from '../../shared/types/window.types';
|
|
19
|
+
import type { SomaDataFieldConfig } from '../../shared/types/data-config.types';
|
|
20
|
+
import { validatePredicate } from '../../shared/predicates';
|
|
21
|
+
import { parseDuration } from './duration';
|
|
22
|
+
|
|
23
|
+
export interface WindowParseInput {
|
|
24
|
+
raw: unknown;
|
|
25
|
+
fields: Record<string, SomaDataFieldConfig>;
|
|
26
|
+
path: string;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
export interface WindowParseDeps {
|
|
30
|
+
fail(message: string, path: string): never;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
/** 过滤 AST 允许的最大嵌套层数——与谓词图同值,理由也相同:再深就没人读得懂了 */
|
|
34
|
+
const MAX_FILTER_DEPTH = 8;
|
|
35
|
+
|
|
36
|
+
const CONFIG_KEYS = new Set([
|
|
37
|
+
'mode', 'block', 'sort', 'filter', 'group', 'aggregate',
|
|
38
|
+
'selection', 'select_all', 'cache', 'revalidate',
|
|
39
|
+
]);
|
|
40
|
+
|
|
41
|
+
/** 只有这些字段类型能被聚合(`count` 除外,它数的是行不是值) */
|
|
42
|
+
const NUMERIC_TYPES = new Set(['int', 'float', 'money', 'percent', 'progress']);
|
|
43
|
+
|
|
44
|
+
const DEFAULT_BLOCK = { size: 100, max_blocks: 10, debounce_ms: 120 } as const;
|
|
45
|
+
|
|
46
|
+
function isPlainObject(value: unknown): value is Record<string, unknown> {
|
|
47
|
+
return value !== null && typeof value === 'object' && !Array.isArray(value);
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
export function parseWindow(input: WindowParseInput, deps: WindowParseDeps): SomaWindowConfig {
|
|
51
|
+
const { raw, fields, path } = input;
|
|
52
|
+
// 显式标注类型:解构出来的 `deps.fail` 不带控制流断言,TS 不会认为
|
|
53
|
+
// `if (!ok) fail(...)` 之后 `ok` 已收窄。少了这一行,下面每一处
|
|
54
|
+
// `fail` 兜底之后的类型收窄全部失效(而收窄失效的表现是十几条无关的类型错)。
|
|
55
|
+
const fail: (message: string, at: string) => never = deps.fail;
|
|
56
|
+
|
|
57
|
+
if (!isPlainObject(raw)) fail('window 必须是映射', path);
|
|
58
|
+
const section = raw as Record<string, unknown>;
|
|
59
|
+
|
|
60
|
+
for (const key of Object.keys(section)) {
|
|
61
|
+
if (!CONFIG_KEYS.has(key)) {
|
|
62
|
+
fail(`未知的 window 字段 "${key}"(支持: ${[...CONFIG_KEYS].join(' / ')})`, `${path}.${key}`);
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
// ── mode:只有 server ────────────────────────────────────────────────
|
|
67
|
+
// 客户端窗口不做。它与「业务逻辑归后端」直接冲突:一旦前端持有全量数据并自己
|
|
68
|
+
// 排序筛选,后端就失去了对"这个用户能看到哪些行"的最终裁决权。
|
|
69
|
+
const mode = section.mode === undefined ? 'server' : String(section.mode);
|
|
70
|
+
if (mode !== 'server') {
|
|
71
|
+
fail(`window.mode 只能是 server(收到 "${mode}")——客户端窗口不做,见《数据对象层》§11`, `${path}.mode`);
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
const fieldKeys = Object.keys(fields);
|
|
75
|
+
const fieldTypes: Record<string, string | undefined> = Object.fromEntries(
|
|
76
|
+
fieldKeys.map((key) => [key, fields[key].type]),
|
|
77
|
+
);
|
|
78
|
+
/** 字段引用统一在这里落地:报错要说清"有哪些可选",否则作者只能去翻另一个文件 */
|
|
79
|
+
const requireField = (name: unknown, at: string): string => {
|
|
80
|
+
const key = String(name ?? '');
|
|
81
|
+
if (!fieldKeys.includes(key)) {
|
|
82
|
+
fail(`${at} 引用了不存在的字段 "${key}"(本对象字典:${fieldKeys.join(' / ') || '空'})`, at);
|
|
83
|
+
}
|
|
84
|
+
return key;
|
|
85
|
+
};
|
|
86
|
+
|
|
87
|
+
// ── 步 1:过滤 AST ───────────────────────────────────────────────────
|
|
88
|
+
const parseFilter = (node: unknown, at: string, depth: number): SomaFilterNode => {
|
|
89
|
+
if (depth > MAX_FILTER_DEPTH) {
|
|
90
|
+
fail(`${at} 的过滤条件嵌套超过 ${MAX_FILTER_DEPTH} 层——再深就没人读得懂了`, at);
|
|
91
|
+
}
|
|
92
|
+
if (!isPlainObject(node)) fail(`${at} 必须是映射`, at);
|
|
93
|
+
|
|
94
|
+
if ('join' in node || 'conditions' in node) {
|
|
95
|
+
// `in` 收窄出来的是两个只含单键的 Record 的联合,读另一个键会被 TS 拒。
|
|
96
|
+
// 这里要的是「原始映射」而不是收窄结果,所以显式取一个宽类型的别名。
|
|
97
|
+
const branch = node as { join?: unknown; conditions?: unknown };
|
|
98
|
+
const join = String(branch.join ?? '');
|
|
99
|
+
if (join !== 'and' && join !== 'or') {
|
|
100
|
+
fail(`${at}.join 只能是 and / or(收到 ${JSON.stringify(branch.join)})`, `${at}.join`);
|
|
101
|
+
}
|
|
102
|
+
if (!Array.isArray(branch.conditions) || branch.conditions.length === 0) {
|
|
103
|
+
fail(`${at}.conditions 必须是非空数组`, `${at}.conditions`);
|
|
104
|
+
}
|
|
105
|
+
return {
|
|
106
|
+
join: join as 'and' | 'or',
|
|
107
|
+
conditions: (branch.conditions as unknown[]).map(
|
|
108
|
+
(child, index) => parseFilter(child, `${at}.conditions[${index}]`, depth + 1),
|
|
109
|
+
),
|
|
110
|
+
};
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
// 叶子:整条交给谓词图校验器,算子闭集与算子×类型配对都在那里,只有一份
|
|
114
|
+
const issues = validatePredicate(node, fieldKeys, at, { fieldTypes });
|
|
115
|
+
if (issues.length > 0) fail(issues.join(';'), at);
|
|
116
|
+
const leaf = node as { field: unknown; op: unknown; value?: unknown };
|
|
117
|
+
return {
|
|
118
|
+
field: String(leaf.field),
|
|
119
|
+
op: leaf.op as SomaFilterNode extends { op: infer O } ? O : never,
|
|
120
|
+
...(leaf.value === undefined ? {} : { value: leaf.value }),
|
|
121
|
+
} as SomaFilterNode;
|
|
122
|
+
};
|
|
123
|
+
|
|
124
|
+
const filter = section.filter === undefined || section.filter === null
|
|
125
|
+
? null
|
|
126
|
+
: parseFilter(section.filter, `${path}.filter`, 1);
|
|
127
|
+
|
|
128
|
+
// ── 步 2:sort / group / aggregate 的字段与函数 ──────────────────────
|
|
129
|
+
const sort: SomaWindowSort[] = [];
|
|
130
|
+
if (section.sort !== undefined) {
|
|
131
|
+
if (!Array.isArray(section.sort)) fail(`${path}.sort 必须是数组`, `${path}.sort`);
|
|
132
|
+
(section.sort as unknown[]).forEach((entry, index) => {
|
|
133
|
+
const at = `${path}.sort[${index}]`;
|
|
134
|
+
if (!isPlainObject(entry)) fail(`${at} 必须是 { field, order }`, at);
|
|
135
|
+
const order = String(entry.order ?? 'asc');
|
|
136
|
+
if (order !== 'asc' && order !== 'desc') {
|
|
137
|
+
fail(`${at}.order 只能是 asc / desc(收到 ${JSON.stringify(entry.order)})`, `${at}.order`);
|
|
138
|
+
}
|
|
139
|
+
sort.push({ field: requireField(entry.field, `${at}.field`), order: order as 'asc' | 'desc' });
|
|
140
|
+
});
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
let group: SomaWindowConfig['group'] = null;
|
|
144
|
+
if (section.group !== undefined && section.group !== null) {
|
|
145
|
+
const at = `${path}.group`;
|
|
146
|
+
if (!isPlainObject(section.group)) fail(`${at} 必须是 { by, keys? }`, at);
|
|
147
|
+
const by = section.group.by;
|
|
148
|
+
if (!Array.isArray(by) || by.length === 0) fail(`${at}.by 必须是非空数组`, `${at}.by`);
|
|
149
|
+
const keys = section.group.keys ?? [];
|
|
150
|
+
if (!Array.isArray(keys)) fail(`${at}.keys 必须是数组`, `${at}.keys`);
|
|
151
|
+
if (keys.length > by.length) {
|
|
152
|
+
// keys 是「展开到哪一层」的路径,它不可能比分组层数还深
|
|
153
|
+
fail(
|
|
154
|
+
`${at}.keys 有 ${keys.length} 段,但只按 ${by.length} 个字段分组——`
|
|
155
|
+
+ '展开路径不可能比分组层数深',
|
|
156
|
+
`${at}.keys`,
|
|
157
|
+
);
|
|
158
|
+
}
|
|
159
|
+
group = {
|
|
160
|
+
by: (by as unknown[]).map((name, index) => requireField(name, `${at}.by[${index}]`)),
|
|
161
|
+
keys: (keys as unknown[]).map((key) => String(key)),
|
|
162
|
+
};
|
|
163
|
+
}
|
|
164
|
+
|
|
165
|
+
const aggregate: SomaWindowAggregate[] = [];
|
|
166
|
+
if (section.aggregate !== undefined) {
|
|
167
|
+
if (!Array.isArray(section.aggregate)) fail(`${path}.aggregate 必须是数组`, `${path}.aggregate`);
|
|
168
|
+
(section.aggregate as unknown[]).forEach((entry, index) => {
|
|
169
|
+
const at = `${path}.aggregate[${index}]`;
|
|
170
|
+
if (!isPlainObject(entry)) fail(`${at} 必须是 { field, fn }`, at);
|
|
171
|
+
const fn = String(entry.fn ?? '');
|
|
172
|
+
if (!(SOMA_AGGREGATE_FNS as readonly string[]).includes(fn)) {
|
|
173
|
+
fail(`${at}.fn 只能是 ${SOMA_AGGREGATE_FNS.join(' / ')}(收到 ${JSON.stringify(entry.fn)})`, `${at}.fn`);
|
|
174
|
+
}
|
|
175
|
+
const field = requireField(entry.field, `${at}.field`);
|
|
176
|
+
const type = fieldTypes[field] ?? '';
|
|
177
|
+
// count 数的是行,什么类型都能数;其余四个是算术,非数值型上求和是没有意义的
|
|
178
|
+
if (fn !== 'count' && !NUMERIC_TYPES.has(type)) {
|
|
179
|
+
fail(
|
|
180
|
+
`${at}.fn=${fn} 不能用在 ${type || '未声明类型'} 的字段 "${field}" 上`
|
|
181
|
+
+ `(只有 ${[...NUMERIC_TYPES].join(' / ')} 能求和求均;要数行数请用 count)`,
|
|
182
|
+
`${at}.fn`,
|
|
183
|
+
);
|
|
184
|
+
}
|
|
185
|
+
aggregate.push({ field, fn: fn as SomaAggregateFn });
|
|
186
|
+
});
|
|
187
|
+
}
|
|
188
|
+
|
|
189
|
+
// ── 步 3:选择态 ────────────────────────────────────────────────────
|
|
190
|
+
let selection: SomaWindowSelection = { base: 'none', toggled: [] };
|
|
191
|
+
if (section.selection !== undefined) {
|
|
192
|
+
const at = `${path}.selection`;
|
|
193
|
+
if (!isPlainObject(section.selection)) fail(`${at} 必须是 { base, toggled }`, at);
|
|
194
|
+
const base = String(section.selection.base ?? 'none');
|
|
195
|
+
if (base !== 'none' && base !== 'all') {
|
|
196
|
+
fail(`${at}.base 只能是 none / all(收到 ${JSON.stringify(section.selection.base)})`, `${at}.base`);
|
|
197
|
+
}
|
|
198
|
+
const toggled = section.selection.toggled ?? [];
|
|
199
|
+
if (!Array.isArray(toggled)) fail(`${at}.toggled 必须是数组`, `${at}.toggled`);
|
|
200
|
+
selection = { base: base as 'none' | 'all', toggled: (toggled as unknown[]).map((id) => String(id)) };
|
|
201
|
+
}
|
|
202
|
+
|
|
203
|
+
const selectAll = String(section.select_all ?? 'filtered');
|
|
204
|
+
if (!(SOMA_SELECT_ALL_MODES as readonly string[]).includes(selectAll)) {
|
|
205
|
+
fail(
|
|
206
|
+
`${path}.select_all 只能是 ${SOMA_SELECT_ALL_MODES.join(' / ')}(收到 ${JSON.stringify(section.select_all)})`,
|
|
207
|
+
`${path}.select_all`,
|
|
208
|
+
);
|
|
209
|
+
}
|
|
210
|
+
// `current_page` 与「基线全选」在语义上互斥:只选当前页却又声明基线是"全部",
|
|
211
|
+
// 两个读者会读出两个意思,而这条歧义会在批量删除时兑现。
|
|
212
|
+
if (selectAll === 'current_page' && selection.base === 'all') {
|
|
213
|
+
fail(
|
|
214
|
+
`${path}.select_all=current_page 与 selection.base=all 冲突——`
|
|
215
|
+
+ '只选当前页时基线只能是 none(否则"全选"到底指哪些行说不清)',
|
|
216
|
+
`${path}.select_all`,
|
|
217
|
+
);
|
|
218
|
+
}
|
|
219
|
+
|
|
220
|
+
// ── 步 4:块 / 缓存 / 重验证 ────────────────────────────────────────
|
|
221
|
+
const block = { ...DEFAULT_BLOCK } as { size: number; max_blocks: number; debounce_ms: number };
|
|
222
|
+
if (section.block !== undefined) {
|
|
223
|
+
const at = `${path}.block`;
|
|
224
|
+
if (!isPlainObject(section.block)) fail(`${at} 必须是映射`, at);
|
|
225
|
+
const positive = (raw2: unknown, key: string, fallback: number): number => {
|
|
226
|
+
if (raw2 === undefined) return fallback;
|
|
227
|
+
const value = Number(raw2);
|
|
228
|
+
if (!Number.isInteger(value) || value <= 0) {
|
|
229
|
+
fail(`${at}.${key} 必须是正整数(收到 ${JSON.stringify(raw2)})`, `${at}.${key}`);
|
|
230
|
+
}
|
|
231
|
+
return value;
|
|
232
|
+
};
|
|
233
|
+
block.size = positive(section.block.size, 'size', DEFAULT_BLOCK.size);
|
|
234
|
+
block.max_blocks = positive(section.block.max_blocks, 'max_blocks', DEFAULT_BLOCK.max_blocks);
|
|
235
|
+
block.debounce_ms = section.block.debounce === undefined
|
|
236
|
+
? DEFAULT_BLOCK.debounce_ms
|
|
237
|
+
: parseDuration(String(section.block.debounce), `${at}.debounce`, (m) => fail(m, `${at}.debounce`));
|
|
238
|
+
}
|
|
239
|
+
|
|
240
|
+
const cache = { ttl_ms: null as number | null, keep_previous: false };
|
|
241
|
+
if (section.cache !== undefined) {
|
|
242
|
+
const at = `${path}.cache`;
|
|
243
|
+
if (!isPlainObject(section.cache)) fail(`${at} 必须是 { ttl?, keep_previous? }`, at);
|
|
244
|
+
if (section.cache.ttl !== undefined) {
|
|
245
|
+
cache.ttl_ms = parseDuration(String(section.cache.ttl), `${at}.ttl`, (m) => fail(m, `${at}.ttl`));
|
|
246
|
+
}
|
|
247
|
+
cache.keep_previous = section.cache.keep_previous === true;
|
|
248
|
+
}
|
|
249
|
+
|
|
250
|
+
const revalidateMs = section.revalidate === undefined
|
|
251
|
+
? null
|
|
252
|
+
: parseDuration(String(section.revalidate), `${path}.revalidate`, (m) => fail(m, `${path}.revalidate`));
|
|
253
|
+
|
|
254
|
+
return {
|
|
255
|
+
mode: 'server',
|
|
256
|
+
block,
|
|
257
|
+
sort,
|
|
258
|
+
filter,
|
|
259
|
+
group,
|
|
260
|
+
aggregate,
|
|
261
|
+
selection,
|
|
262
|
+
select_all: selectAll as SomaSelectAllMode,
|
|
263
|
+
cache,
|
|
264
|
+
revalidate_ms: revalidateMs,
|
|
265
|
+
dict_hash: dictHash(fields),
|
|
266
|
+
};
|
|
267
|
+
}
|
|
268
|
+
|
|
269
|
+
/**
|
|
270
|
+
* 字段字典的稳定哈希:字段名 + 类型 + 权限。
|
|
271
|
+
*
|
|
272
|
+
* 随每个请求下发,让后端能拒收「按一份它不认识的字典发来的意图」——这是本层唯一
|
|
273
|
+
* 对方结构上做不到的事(AG Grid 的列是函数,没有可哈希的字典)。
|
|
274
|
+
*
|
|
275
|
+
* 只取名/类型/权限三项:它们决定了**哪些意图是合法的**(能不能排序、能不能求和、
|
|
276
|
+
* 能不能进请求体)。`name` 这类展示位改了不该让后端拒收——那会把一次文案调整变成一次
|
|
277
|
+
* 前后端联合发布。字段先按名排序,声明顺序变化不改哈希,同理。
|
|
278
|
+
*
|
|
279
|
+
* 用 FNV-1a 而不是 sha256:这里要的是「字典变了没有」的指纹,不是抗碰撞的安全摘要,
|
|
280
|
+
* 而 `crypto.subtle` 是异步的——为一个同步的解析步骤引入异步是不划算的交换。
|
|
281
|
+
*/
|
|
282
|
+
export function dictHash(fields: Record<string, SomaDataFieldConfig>): string {
|
|
283
|
+
const canonical = Object.keys(fields)
|
|
284
|
+
.sort()
|
|
285
|
+
.map((key) => `${key}:${fields[key].type ?? ''}:${fields[key].permission ?? ''}`)
|
|
286
|
+
.join('|');
|
|
287
|
+
let hash = 0x811c9dc5;
|
|
288
|
+
for (let index = 0; index < canonical.length; index += 1) {
|
|
289
|
+
hash ^= canonical.charCodeAt(index);
|
|
290
|
+
// FNV 素数 16777619,用移位加法写以避免 32 位溢出丢精度
|
|
291
|
+
hash = (hash + (hash << 1) + (hash << 4) + (hash << 7) + (hash << 8) + (hash << 24)) >>> 0;
|
|
292
|
+
}
|
|
293
|
+
return `fnv1a-${hash.toString(16).padStart(8, '0')}`;
|
|
294
|
+
}
|
|
@@ -26,3 +26,11 @@ export {
|
|
|
26
26
|
type PublishedPageRecord,
|
|
27
27
|
type RenderPublishedPageOptions,
|
|
28
28
|
} from './remote-page';
|
|
29
|
+
export {
|
|
30
|
+
PUBLISHED_PAGE_SLUG_PATTERN,
|
|
31
|
+
RESERVED_PUBLISHED_PAGE_SLUGS,
|
|
32
|
+
isPublishedPageSlug,
|
|
33
|
+
normalizePublishedPageSlug,
|
|
34
|
+
publishedPagePath,
|
|
35
|
+
publishedPageSlugFromPath,
|
|
36
|
+
} from '../../shared/published-page-route';
|
|
@@ -33,6 +33,7 @@ import {
|
|
|
33
33
|
type SomaToneName,
|
|
34
34
|
} from './harmony';
|
|
35
35
|
import { ensureContrast } from './tone-solver';
|
|
36
|
+
import { componentTokenVar } from '../../shared/types/component-contract.types';
|
|
36
37
|
import { sceneColorTokens, sceneStructureTokens } from './scene-tokens';
|
|
37
38
|
|
|
38
39
|
export type { SomaPaletteAxes, SomaSceneAxes, SomaResolvedAxes } from './theme-axes';
|
|
@@ -54,6 +55,34 @@ export interface SomaThemeInput {
|
|
|
54
55
|
dark?: boolean;
|
|
55
56
|
/** 逐令牌精调通道:最后合并进 cssVars 与 darkCssVars,优先级最高(亮暗同时生效) */
|
|
56
57
|
overrides?: Record<string, string>;
|
|
58
|
+
/**
|
|
59
|
+
* 暗色专属精调:只并进 darkCssVars,在 `overrides` **之后**合并(同键胜出)。
|
|
60
|
+
*
|
|
61
|
+
* 为什么需要它:`overrides` 一份表同时盖亮暗两套,等于「一个令牌只能有一个值」。
|
|
62
|
+
* 后果不是理论问题——`soma-ui/src/daisy-presets.ts` 里 daisyLight / daisyDark 因此
|
|
63
|
+
* 被迫拆成两套完整独立预设,而 `ThemeScope` 的 `mode: 'system'` 只认一个预设名,
|
|
64
|
+
* 于是 35 套 daisy 主题的跟随系统亮暗**全部失效**。
|
|
65
|
+
*
|
|
66
|
+
* 缺省不给 = 行为与之前字节级一致(不影响任何既有预设)。
|
|
67
|
+
*/
|
|
68
|
+
darkOverrides?: Record<string, string>;
|
|
69
|
+
/**
|
|
70
|
+
* 组件级令牌覆盖(REQ-009 M-1):组件名 → { 令牌名: 值 }。
|
|
71
|
+
*
|
|
72
|
+
* 这是三级令牌的第三级在主题输入侧的入口。它存在的理由:今天想只改 Button 的圆角,
|
|
73
|
+
* 只能改全局 `--soma-radius-control`,于是**所有 control 族**跟着变。
|
|
74
|
+
*
|
|
75
|
+
* 与 MUI 的 `theme.components.MuiX.styleOverrides.<slot>` 的关键差别:
|
|
76
|
+
* 这里能改的只有**组件自己在契约 `tokens` 段声明过的旋钮**,
|
|
77
|
+
* 而不是任意内部元素的任意 CSS 声明。组件内部结构仍然封闭
|
|
78
|
+
* (页面永不可寻址组件内部,`scopeAnchors()` 的既定边界)。
|
|
79
|
+
*
|
|
80
|
+
* 引擎不认识组件,所以这里只做展平;「组件名 / 令牌名是否存在」由装配层的
|
|
81
|
+
* `validateThemeComponentTokens` 在 bootstrap 期核对契约。
|
|
82
|
+
*/
|
|
83
|
+
components?: Record<string, Record<string, string>>;
|
|
84
|
+
/** 组件令牌的暗色专属覆盖:与 `darkOverrides` 同一纪律,只并进 darkCssVars */
|
|
85
|
+
darkComponents?: Record<string, Record<string, string>>;
|
|
57
86
|
}
|
|
58
87
|
|
|
59
88
|
export interface SomaThemeMeta {
|
|
@@ -63,6 +92,8 @@ export interface SomaThemeMeta {
|
|
|
63
92
|
readonly separationApplied: boolean;
|
|
64
93
|
/** 被推开的语气 */
|
|
65
94
|
readonly pushed: readonly SomaToneName[];
|
|
95
|
+
/** 本次写出的组件级令牌变量名(M-1)——快照与闸门的观测面 */
|
|
96
|
+
readonly componentTokens: readonly string[];
|
|
66
97
|
}
|
|
67
98
|
|
|
68
99
|
export interface SomaDerivedTheme {
|
|
@@ -486,7 +517,7 @@ function chartSeries(
|
|
|
486
517
|
// 12~24px 的字阶)全部是 16 的整数分之一倍,换算**无一需要取整**,
|
|
487
518
|
// 因此 16px 根字号下输出值与迁移前逐令牌恒等,视觉基线零 diff。
|
|
488
519
|
const STATIC_TOKENS: Record<string, string> = {
|
|
489
|
-
// 字体排印:系统栈 +
|
|
520
|
+
// 字体排印:系统栈 + 八档字号 + AntD 标准行高 + 三档字重
|
|
490
521
|
'--soma-font-family':
|
|
491
522
|
"-apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei', sans-serif",
|
|
492
523
|
'--soma-font-size-xs': '0.75rem', // 12px
|
|
@@ -495,6 +526,10 @@ const STATIC_TOKENS: Record<string, string> = {
|
|
|
495
526
|
'--soma-font-size-lg': '1.125rem', // 18px
|
|
496
527
|
'--soma-font-size-xl': '1.25rem', // 20px
|
|
497
528
|
'--soma-font-size-xxl': '1.5rem', // 24px
|
|
529
|
+
// 页头/落地页标题用的两级。加在这里而不是让组件写死回退值:
|
|
530
|
+
// 写死的话换肤对标题字号无效,而"无效"看不出来——回退值本身就是个合理的数。
|
|
531
|
+
'--soma-font-size-3xl': '1.875rem', // 30px
|
|
532
|
+
'--soma-font-size-4xl': '2.25rem', // 36px
|
|
498
533
|
// 行高三档齐(tight 给标题 / KPI 大数字 / 控件单行文本,base 给正文与一切默认,
|
|
499
534
|
// loose 给成段长文阅读区)。行高由本层**独占**:soma-ui 不得再置
|
|
500
535
|
// `--soma-ui-line-height-*` 同义副本——排版阶梯换一套组件库也不该丢,
|
|
@@ -1007,13 +1042,22 @@ export function deriveTheme(input: SomaThemeInput): SomaDerivedTheme {
|
|
|
1007
1042
|
};
|
|
1008
1043
|
|
|
1009
1044
|
// ⑥ 用户逐令牌精调通道:最后合并;语义色背景保留,低于 AA 的配对前景随后自动校正
|
|
1045
|
+
//
|
|
1046
|
+
// 亮暗分列:`overrides` 是两套共用的基线,`darkOverrides` 只盖暗色且排在它之后。
|
|
1047
|
+
// 不给 darkOverrides 时 darkMerged === input.overrides,行为与分列之前完全一致。
|
|
1048
|
+
const darkMerged = input.darkOverrides
|
|
1049
|
+
? { ...input.overrides, ...input.darkOverrides }
|
|
1050
|
+
: input.overrides;
|
|
1010
1051
|
if (input.overrides) {
|
|
1011
1052
|
Object.assign(cssVars, input.overrides);
|
|
1012
|
-
|
|
1053
|
+
}
|
|
1054
|
+
if (darkMerged) {
|
|
1055
|
+
Object.assign(darkCssVars, darkMerged);
|
|
1013
1056
|
}
|
|
1014
1057
|
// ⑥.1 淡底跟随实心色的覆盖(否则 daisy 那 35 套预设的徽标底与字来自两个色系)
|
|
1058
|
+
// 暗色侧要吃合并后的表,否则 darkOverrides 换掉的实心色配不上淡底
|
|
1015
1059
|
syncSoftWithOverrides(cssVars, input.overrides);
|
|
1016
|
-
syncSoftWithOverrides(darkCssVars,
|
|
1060
|
+
syncSoftWithOverrides(darkCssVars, darkMerged);
|
|
1017
1061
|
enforceContrastPairs(cssVars);
|
|
1018
1062
|
enforceContrastPairs(darkCssVars);
|
|
1019
1063
|
// ⑥.2 淡底前景:必须在 overrides 之后算,AA 保障的是**最终生效**的那套底与那套色
|
|
@@ -1022,20 +1066,37 @@ export function deriveTheme(input: SomaThemeInput): SomaDerivedTheme {
|
|
|
1022
1066
|
|
|
1023
1067
|
// S7′ 场景颜色:与 ⑥.1/⑥.2 同一条纪律——吃最终变量表,不吃派生中途的值
|
|
1024
1068
|
/** 主色被 overrides 换过时按新主色重建色阶——光球才不会与表面分属两个色系 */
|
|
1025
|
-
const
|
|
1026
|
-
|
|
1027
|
-
|
|
1028
|
-
|
|
1029
|
-
|
|
1030
|
-
|
|
1031
|
-
|
|
1069
|
+
const makeRescale = (
|
|
1070
|
+
tokens: Record<string, string> | undefined,
|
|
1071
|
+
): ((primaryHex: string) => Record<string, string>) | null => (
|
|
1072
|
+
tokens?.['--soma-c-primary']
|
|
1073
|
+
? (primaryHex: string): Record<string, string> => {
|
|
1074
|
+
const p = hexToOklch(primaryHex);
|
|
1075
|
+
const rebuilt: Record<string, string> = {};
|
|
1076
|
+
STEPS.forEach((step, i) => {
|
|
1077
|
+
rebuilt[step] = oklchToHex({
|
|
1078
|
+
l: LIGHTNESS[i], c: Math.max(p.c, 0.02) * CHROMA_CURVE[i], h: p.h,
|
|
1079
|
+
});
|
|
1032
1080
|
});
|
|
1033
|
-
|
|
1034
|
-
|
|
1035
|
-
|
|
1036
|
-
|
|
1081
|
+
return rebuilt;
|
|
1082
|
+
}
|
|
1083
|
+
: null
|
|
1084
|
+
);
|
|
1085
|
+
// 亮暗各按自己那套最终 overrides 判定要不要重建色阶:
|
|
1086
|
+
// 只在 darkOverrides 里换主色时,亮色侧不该跟着重建。
|
|
1087
|
+
const rescale = makeRescale(input.overrides);
|
|
1088
|
+
const darkRescale = makeRescale(darkMerged);
|
|
1037
1089
|
Object.assign(cssVars, sceneColorTokens(cssVars, axes, params.fieldAlphas, hexWithAlpha, scale, rescale));
|
|
1038
|
-
Object.assign(darkCssVars, sceneColorTokens(darkCssVars, axes, params.fieldAlphas, hexWithAlpha, scale,
|
|
1090
|
+
Object.assign(darkCssVars, sceneColorTokens(darkCssVars, axes, params.fieldAlphas, hexWithAlpha, scale, darkRescale));
|
|
1091
|
+
|
|
1092
|
+
// ⑦ 组件级令牌(M-1):排在最后——它是「在最终语义令牌之上再收窄一档」,
|
|
1093
|
+
// 所以必须看得见 overrides 与场景色的最终结果。亮暗分列与 ⑥ 同纪律。
|
|
1094
|
+
const lightComponentTokens = flattenComponentTokens(input.components);
|
|
1095
|
+
const darkComponentTokens = flattenComponentTokens(
|
|
1096
|
+
input.darkComponents ? mergeComponentTokens(input.components, input.darkComponents) : input.components,
|
|
1097
|
+
);
|
|
1098
|
+
Object.assign(cssVars, lightComponentTokens);
|
|
1099
|
+
Object.assign(darkCssVars, darkComponentTokens);
|
|
1039
1100
|
|
|
1040
1101
|
return {
|
|
1041
1102
|
scale,
|
|
@@ -1045,10 +1106,77 @@ export function deriveTheme(input: SomaThemeInput): SomaDerivedTheme {
|
|
|
1045
1106
|
primaryFg: contrastRatio(cssVars['--soma-c-primary'], cssVars['--soma-c-primary-fg']),
|
|
1046
1107
|
darkPrimaryFg: contrastRatio(darkCssVars['--soma-c-primary'], darkCssVars['--soma-c-primary-fg']),
|
|
1047
1108
|
},
|
|
1048
|
-
meta: {
|
|
1109
|
+
meta: {
|
|
1110
|
+
axes,
|
|
1111
|
+
separationApplied: guard.applied,
|
|
1112
|
+
pushed: guard.pushed,
|
|
1113
|
+
componentTokens: Object.keys({ ...lightComponentTokens, ...darkComponentTokens }).sort(),
|
|
1114
|
+
},
|
|
1049
1115
|
};
|
|
1050
1116
|
}
|
|
1051
1117
|
|
|
1118
|
+
/**
|
|
1119
|
+
* 组件令牌表 → CSS 变量表:{ Button: { radius: 'var(--soma-radius-pill)' } }
|
|
1120
|
+
* → { '--soma-button-radius': 'var(--soma-radius-pill)' }
|
|
1121
|
+
*
|
|
1122
|
+
* 值必须是令牌引用或几何字面量。裸色值在这里就拦下——它是零裸色值禁令的延伸:
|
|
1123
|
+
* 组件令牌若能写死颜色,换肤就在这一层破了口子,而且破得很隐蔽(只有那一个组件不跟随)。
|
|
1124
|
+
*/
|
|
1125
|
+
function flattenComponentTokens(
|
|
1126
|
+
input: Record<string, Record<string, string>> | undefined,
|
|
1127
|
+
): Record<string, string> {
|
|
1128
|
+
if (!input) return {};
|
|
1129
|
+
const result: Record<string, string> = {};
|
|
1130
|
+
for (const [componentName, tokens] of Object.entries(input)) {
|
|
1131
|
+
for (const [key, value] of Object.entries(tokens ?? {})) {
|
|
1132
|
+
assertComponentTokenValue(componentName, key, value);
|
|
1133
|
+
result[componentTokenVar(componentName, key)] = value;
|
|
1134
|
+
}
|
|
1135
|
+
}
|
|
1136
|
+
return result;
|
|
1137
|
+
}
|
|
1138
|
+
|
|
1139
|
+
function mergeComponentTokens(
|
|
1140
|
+
base: Record<string, Record<string, string>> | undefined,
|
|
1141
|
+
patch: Record<string, Record<string, string>>,
|
|
1142
|
+
): Record<string, Record<string, string>> {
|
|
1143
|
+
const result: Record<string, Record<string, string>> = {};
|
|
1144
|
+
for (const [name, tokens] of Object.entries(base ?? {})) result[name] = { ...tokens };
|
|
1145
|
+
for (const [name, tokens] of Object.entries(patch)) {
|
|
1146
|
+
result[name] = { ...(result[name] ?? {}), ...tokens };
|
|
1147
|
+
}
|
|
1148
|
+
return result;
|
|
1149
|
+
}
|
|
1150
|
+
|
|
1151
|
+
/** 裸色值检测:#hex / rgb() / hsl() / oklch() / 具名色都不许直接写进组件令牌 */
|
|
1152
|
+
const NAKED_COLOR_PATTERN = /(^|[\s(,])(#[0-9a-fA-F]{3,8}\b|(rgba?|hsla?|oklch|oklab|lab|lch|color-mix)\s*\()/;
|
|
1153
|
+
|
|
1154
|
+
function assertComponentTokenValue(componentName: string, key: string, value: string): void {
|
|
1155
|
+
if (typeof value !== 'string' || !value.trim()) {
|
|
1156
|
+
throw new Error(
|
|
1157
|
+
`[soma-core][主题] 组件令牌 ${componentName}.${key} 的值必须是非空字符串`,
|
|
1158
|
+
);
|
|
1159
|
+
}
|
|
1160
|
+
if (NAKED_COLOR_PATTERN.test(value)) {
|
|
1161
|
+
throw new Error(
|
|
1162
|
+
`[soma-core][主题] 组件令牌 ${componentName}.${key} 写了裸色值 "${value}"。`
|
|
1163
|
+
+ '\n 组件令牌是语义令牌的收窄,不是新的颜色真源——'
|
|
1164
|
+
+ '写死颜色会让这一个组件不跟随换肤,而且很难发现。请改写 var(--soma-…)。',
|
|
1165
|
+
);
|
|
1166
|
+
}
|
|
1167
|
+
}
|
|
1168
|
+
|
|
1169
|
+
/**
|
|
1170
|
+
* 引擎会写出的令牌名全集(静态令牌 + 派生令牌),不跑派生。
|
|
1171
|
+
*
|
|
1172
|
+
* 给 soma-ui 的 `token-existence-lint` 用:契约 `tokens.default` 引用的语义令牌
|
|
1173
|
+
* 必须真的存在,否则组件令牌指向一个空变量,回退值一路生效而没人发现。
|
|
1174
|
+
*/
|
|
1175
|
+
export function listThemeTokenNames(): readonly string[] {
|
|
1176
|
+
const probe = deriveTheme({ brand: '#2563eb' });
|
|
1177
|
+
return Object.keys({ ...probe.cssVars, ...probe.darkCssVars }).sort();
|
|
1178
|
+
}
|
|
1179
|
+
|
|
1052
1180
|
/**
|
|
1053
1181
|
* 派生结果 → 根元素属性。
|
|
1054
1182
|
*
|