soma-core 1.4.1 → 1.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.
@@ -76,6 +76,7 @@ __export(index_exports, {
76
76
  SomaDiagnostics: () => SomaDiagnostics,
77
77
  SomaDict: () => SomaDict,
78
78
  SomaEntity: () => SomaEntity,
79
+ SomaFieldLinesError: () => SomaFieldLinesError,
79
80
  SomaHttpClient: () => SomaHttpClient,
80
81
  SomaLocaleOnlyPageRoot: () => SomaLocaleOnlyPageRoot,
81
82
  SomaMiddlewareChain: () => SomaMiddlewareChain,
@@ -122,8 +123,11 @@ __export(index_exports, {
122
123
  createWindow: () => createWindow,
123
124
  decodePageState: () => decodePageState,
124
125
  defaultPipeRegistry: () => defaultPipeRegistry,
126
+ deriveContractSample: () => deriveContractSample,
127
+ deriveFieldSample: () => deriveFieldSample,
125
128
  deriveKeyboardMatrix: () => deriveKeyboardMatrix,
126
129
  deriveTheme: () => deriveTheme,
130
+ describeHttpErrorBody: () => describeHttpErrorBody,
127
131
  describeNode: () => describeNode,
128
132
  dictHash: () => dictHash,
129
133
  encodePageState: () => encodePageState,
@@ -147,6 +151,7 @@ __export(index_exports, {
147
151
  getShowMetadata: () => getShowMetadata,
148
152
  hasBlockedScheme: () => hasBlockedScheme,
149
153
  hasPageMetadata: () => hasPageMetadata,
154
+ hasRenderableSample: () => hasRenderableSample,
150
155
  inferCalcType: () => inferCalcType,
151
156
  installSomaErrorReporter: () => installSomaErrorReporter,
152
157
  isArithSegment: () => isArithSegment,
@@ -168,11 +173,14 @@ __export(index_exports, {
168
173
  parseDataConfig: () => parseDataConfig,
169
174
  parseDataRef: () => parseDataRef,
170
175
  parseDataYaml: () => parseDataYaml,
176
+ parseEmitLines: () => parseEmitLines,
177
+ parseFieldLines: () => parseFieldLines,
171
178
  parseLayoutConstraint: () => parseLayoutConstraint,
172
179
  parseListPath: () => parseListPath,
173
180
  parsePageBlock: () => parsePageBlock,
174
181
  parsePageState: () => parsePageState,
175
182
  parseReactions: () => parseReactions,
183
+ parseSlotLines: () => parseSlotLines,
176
184
  parseStateValue: () => parseStateValue,
177
185
  parseSteps: () => parseSteps,
178
186
  parseUseBlock: () => parseUseBlock,
@@ -183,6 +191,7 @@ __export(index_exports, {
183
191
  readBootTimings: () => readBootTimings,
184
192
  readListPath: () => readListPath,
185
193
  recordMetric: () => recordMetric,
194
+ renderFieldLines: () => renderFieldLines,
186
195
  renderKeyboardMatrixLine: () => renderKeyboardMatrixLine,
187
196
  renderPublishedPage: () => renderPublishedPage,
188
197
  resetBootTimings: () => resetBootTimings,
@@ -201,7 +210,10 @@ __export(index_exports, {
201
210
  scopeHasVar: () => scopeHasVar,
202
211
  setActiveTelemetry: () => setActiveTelemetry,
203
212
  setSomaHtmlSanitizer: () => setSomaHtmlSanitizer,
213
+ somaEmits: () => somaEmits,
214
+ somaFields: () => somaFields,
204
215
  somaRollupPlugin: () => somaRollupPlugin,
216
+ somaSlots: () => somaSlots,
205
217
  startBootTimings: () => startBootTimings,
206
218
  themeRootAttributes: () => themeRootAttributes,
207
219
  validateListPath: () => validateListPath,
@@ -403,9 +415,9 @@ var SomaDict = class {
403
415
  */
404
416
  async get(key, forceRefresh = false) {
405
417
  if (!forceRefresh) {
406
- const cached = this.cache.get(key);
407
- if (cached && !this.isExpired(cached)) {
408
- return cached.data;
418
+ const cached2 = this.cache.get(key);
419
+ if (cached2 && !this.isExpired(cached2)) {
420
+ return cached2.data;
409
421
  }
410
422
  }
411
423
  const inflight = this.pending.get(key);
@@ -469,8 +481,8 @@ var SomaDict = class {
469
481
  * @returns 是否有有效缓存
470
482
  */
471
483
  has(key) {
472
- const cached = this.cache.get(key);
473
- return cached != null && !this.isExpired(cached);
484
+ const cached2 = this.cache.get(key);
485
+ return cached2 != null && !this.isExpired(cached2);
474
486
  }
475
487
  /**
476
488
  * 加载数据并写入缓存
@@ -521,6 +533,21 @@ var SomaEntity = class {
521
533
  };
522
534
 
523
535
  // core/client/base/SomaHttpClient.ts
536
+ var ERROR_BODY_MAX_LENGTH = 500;
537
+ function describeHttpErrorBody(body, statusText) {
538
+ const text = (body ?? "").trim();
539
+ if (text === "") return statusText;
540
+ let message = text;
541
+ try {
542
+ const parsed = JSON.parse(text);
543
+ if (parsed && typeof parsed === "object") {
544
+ const field = parsed.error ?? parsed.message;
545
+ if (typeof field === "string" && field.trim() !== "") message = field.trim();
546
+ }
547
+ } catch {
548
+ }
549
+ return message.length > ERROR_BODY_MAX_LENGTH ? `${message.slice(0, ERROR_BODY_MAX_LENGTH)}\u2026` : message;
550
+ }
524
551
  var SomaHttpClient = class {
525
552
  constructor(config) {
526
553
  this.abortControllers = /* @__PURE__ */ new Set();
@@ -591,7 +618,8 @@ var SomaHttpClient = class {
591
618
  }
592
619
  const res = await fetch(url, options);
593
620
  if (!res.ok) {
594
- throw new Error(`HTTP ${res.status}: ${res.statusText}`);
621
+ const errorBody = typeof res.text === "function" ? await res.text().catch(() => "") : "";
622
+ throw new Error(`HTTP ${res.status}: ${describeHttpErrorBody(errorBody, res.statusText)}`);
595
623
  }
596
624
  return await res.json();
597
625
  } finally {
@@ -1040,8 +1068,8 @@ var SomaContainerAdapter = class {
1040
1068
  now() {
1041
1069
  return globalThis.performance?.now?.() ?? Date.now();
1042
1070
  }
1043
- resolveIncludes(container, includes) {
1044
- const elements = container.querySelectorAll("[data-soma-include]");
1071
+ resolveIncludes(root, includes) {
1072
+ const elements = root.querySelectorAll("[data-soma-include]");
1045
1073
  for (const element of elements) {
1046
1074
  const includePath = element.getAttribute("data-soma-include");
1047
1075
  if (!includePath || !includes[includePath]) {
@@ -1051,6 +1079,9 @@ var SomaContainerAdapter = class {
1051
1079
  element.removeAttribute("data-soma-include");
1052
1080
  this.resolveIncludes(element, includes);
1053
1081
  }
1082
+ for (const template of root.querySelectorAll("template")) {
1083
+ this.resolveIncludes(template.content, includes);
1084
+ }
1054
1085
  }
1055
1086
  };
1056
1087
 
@@ -1607,7 +1638,7 @@ var SomaSnapshotStore = class {
1607
1638
  }
1608
1639
  };
1609
1640
 
1610
- // ../node_modules/js-yaml/dist/js-yaml.mjs
1641
+ // node_modules/js-yaml/dist/js-yaml.mjs
1611
1642
  function getDefaultExportFromCjs(x) {
1612
1643
  return x && x.__esModule && Object.prototype.hasOwnProperty.call(x, "default") ? x["default"] : x;
1613
1644
  }
@@ -2885,16 +2916,21 @@ function requireLoader() {
2885
2916
  state2.result += _result;
2886
2917
  }
2887
2918
  }
2919
+ function chargeMergeWork(state2) {
2920
+ state2.totalMergeKeys++;
2921
+ if (state2.maxTotalMergeKeys !== -1 && state2.totalMergeKeys > state2.maxTotalMergeKeys) {
2922
+ throwError(state2, "merge keys exceeded maxTotalMergeKeys (" + state2.maxTotalMergeKeys + ")");
2923
+ }
2924
+ }
2888
2925
  function mergeMappings(state2, destination, source, overridableKeys) {
2889
2926
  if (!common2.isObject(source)) {
2890
2927
  throwError(state2, "cannot merge mappings; the provided source object is unacceptable");
2891
2928
  }
2929
+ chargeMergeWork(state2);
2892
2930
  const sourceKeys = Object.keys(source);
2893
2931
  for (let index = 0, quantity = sourceKeys.length; index < quantity; index += 1) {
2894
2932
  const key = sourceKeys[index];
2895
- if (state2.maxTotalMergeKeys !== -1 && ++state2.totalMergeKeys > state2.maxTotalMergeKeys) {
2896
- throwError(state2, "merge keys exceeded maxTotalMergeKeys (" + state2.maxTotalMergeKeys + ")");
2897
- }
2933
+ chargeMergeWork(state2);
2898
2934
  if (!_hasOwnProperty.call(destination, key)) {
2899
2935
  setProperty(destination, key, source[key]);
2900
2936
  overridableKeys[key] = true;
@@ -2922,6 +2958,9 @@ function requireLoader() {
2922
2958
  }
2923
2959
  if (keyTag === "tag:yaml.org,2002:merge") {
2924
2960
  if (Array.isArray(valueNode)) {
2961
+ if (valueNode.length > 100) {
2962
+ throwError(state2, "abnormal merge sequence size");
2963
+ }
2925
2964
  for (let index = 0, quantity = valueNode.length; index < quantity; index += 1) {
2926
2965
  mergeMappings(state2, _result, valueNode[index], overridableKeys);
2927
2966
  }
@@ -4839,8 +4878,8 @@ function regexOf(source) {
4839
4878
  return compiled;
4840
4879
  }
4841
4880
  function evaluateCondition(condition, values) {
4842
- const raw = values[condition.field];
4843
- const actual = condition.path ? readPath(raw, condition.path) : raw;
4881
+ const raw2 = values[condition.field];
4882
+ const actual = condition.path ? readPath(raw2, condition.path) : raw2;
4844
4883
  switch (condition.op) {
4845
4884
  case "empty":
4846
4885
  return isEmpty(actual);
@@ -4927,21 +4966,21 @@ function evaluateNode(predicate, values, named, visiting, depth) {
4927
4966
  return evaluateCondition(predicate, values);
4928
4967
  }
4929
4968
  var PATH_PATTERN = /^[A-Za-z_][\w]*(?:\[\d+\])*(?:\.[A-Za-z_][\w]*(?:\[\d+\])*)*$/;
4930
- function checkCondition(raw, fieldKeys, path, options) {
4969
+ function checkCondition(raw2, fieldKeys, path, options) {
4931
4970
  const issues = [];
4932
- const field = typeof raw.field === "string" ? raw.field.trim() : "";
4971
+ const field = typeof raw2.field === "string" ? raw2.field.trim() : "";
4933
4972
  if (field === "") {
4934
4973
  issues.push(`${path}.field \u5FC5\u987B\u662F\u975E\u7A7A\u5B57\u6BB5\u540D`);
4935
4974
  } else if (!fieldKeys.includes(field)) {
4936
4975
  issues.push(`${path}.field \u5F15\u7528\u4E86\u4E0D\u5B58\u5728\u7684\u5B57\u6BB5 "${field}"`);
4937
4976
  }
4938
- const op = String(raw.op ?? "");
4977
+ const op = String(raw2.op ?? "");
4939
4978
  if (!SOMA_FIELD_PREDICATE_OPS.includes(op)) {
4940
4979
  issues.push(`${path}.op \u53EA\u80FD\u662F ${SOMA_FIELD_PREDICATE_OPS.join(" / ")}\uFF0C\u6536\u5230 "${op}"`);
4941
4980
  return issues;
4942
4981
  }
4943
4982
  const kind = options.fieldTypes?.[field];
4944
- if (kind && !raw.path) {
4983
+ if (kind && !raw2.path) {
4945
4984
  const allowed = OPS_BY_KIND[kind];
4946
4985
  if (allowed && !allowed.includes(op)) {
4947
4986
  issues.push(
@@ -4949,12 +4988,12 @@ function checkCondition(raw, fieldKeys, path, options) {
4949
4988
  );
4950
4989
  }
4951
4990
  }
4952
- if (raw.path !== void 0) {
4953
- if (typeof raw.path !== "string" || !PATH_PATTERN.test(raw.path)) {
4954
- issues.push(`${path}.path \u53EA\u5141\u8BB8 a.b.c \u4E0E a[0].b \u4E24\u79CD\u5199\u6CD5\uFF0C\u6536\u5230 ${JSON.stringify(raw.path)}`);
4991
+ if (raw2.path !== void 0) {
4992
+ if (typeof raw2.path !== "string" || !PATH_PATTERN.test(raw2.path)) {
4993
+ issues.push(`${path}.path \u53EA\u5141\u8BB8 a.b.c \u4E0E a[0].b \u4E24\u79CD\u5199\u6CD5\uFF0C\u6536\u5230 ${JSON.stringify(raw2.path)}`);
4955
4994
  }
4956
4995
  }
4957
- const value = raw.value;
4996
+ const value = raw2.value;
4958
4997
  if ((op === "in" || op === "not_in") && !Array.isArray(value)) {
4959
4998
  issues.push(`${path}.value \u5728 op=${op} \u65F6\u5FC5\u987B\u662F\u6570\u7EC4`);
4960
4999
  }
@@ -5070,9 +5109,9 @@ function producesArray(pipelineType) {
5070
5109
  return pipelineType === "UI_REFRESH" || pipelineType === "NAV_ACTION" || pipelineType === "ACTION";
5071
5110
  }
5072
5111
  function parseSteps(input, deps) {
5073
- const { raw, payloadFields, path } = input;
5112
+ const { raw: raw2, payloadFields, path } = input;
5074
5113
  const fail2 = deps.fail;
5075
- if (!Array.isArray(raw) || raw.length === 0) {
5114
+ if (!Array.isArray(raw2) || raw2.length === 0) {
5076
5115
  fail2("steps \u5FC5\u987B\u662F\u975E\u7A7A\u6570\u7EC4", path);
5077
5116
  }
5078
5117
  const slots = {};
@@ -5119,11 +5158,11 @@ function parseSteps(input, deps) {
5119
5158
  };
5120
5159
  const parseOnError = (value, at, total, index) => {
5121
5160
  if (value === void 0) return "stop";
5122
- const raw2 = String(value);
5123
- if (raw2 === "stop" || raw2 === "continue") return raw2;
5124
- const match = /^goto:(\d+)$/.exec(raw2);
5161
+ const raw22 = String(value);
5162
+ if (raw22 === "stop" || raw22 === "continue") return raw22;
5163
+ const match = /^goto:(\d+)$/.exec(raw22);
5125
5164
  if (!match) {
5126
- fail2(`${at}.on_error \u53EA\u80FD\u662F stop / continue / goto:<\u6B65\u9AA4\u5E8F\u53F7>\uFF08\u6536\u5230 "${raw2}"\uFF09`, `${at}.on_error`);
5165
+ fail2(`${at}.on_error \u53EA\u80FD\u662F stop / continue / goto:<\u6B65\u9AA4\u5E8F\u53F7>\uFF08\u6536\u5230 "${raw22}"\uFF09`, `${at}.on_error`);
5127
5166
  }
5128
5167
  const target = Number(match[1]);
5129
5168
  if (target <= index + 1) {
@@ -5274,7 +5313,7 @@ function parseSteps(input, deps) {
5274
5313
  }
5275
5314
  return out;
5276
5315
  };
5277
- const steps = walk(raw, path, 0, false);
5316
+ const steps = walk(raw2, path, 0, false);
5278
5317
  if (input.actionNames !== void 0) {
5279
5318
  const known = new Set(input.actionNames);
5280
5319
  const visit = (list) => {
@@ -5590,11 +5629,11 @@ var SomaTimerParseError = class extends Error {
5590
5629
  this.name = "SomaTimerParseError";
5591
5630
  }
5592
5631
  };
5593
- function parseTimerItem(raw, index) {
5594
- if (!raw || typeof raw !== "object") {
5632
+ function parseTimerItem(raw2, index) {
5633
+ if (!raw2 || typeof raw2 !== "object") {
5595
5634
  throw new SomaTimerParseError(`timers[${index}] \u5FC5\u987B\u662F\u5BF9\u8C61`);
5596
5635
  }
5597
- const item = raw;
5636
+ const item = raw2;
5598
5637
  if (typeof item.id !== "string" || !item.id.trim()) {
5599
5638
  throw new SomaTimerParseError(`timers[${index}].id \u5FC5\u987B\u662F\u975E\u7A7A\u5B57\u7B26\u4E32`);
5600
5639
  }
@@ -5622,14 +5661,14 @@ function parseTimerItem(raw, index) {
5622
5661
  pipeline: parsePipelineBody(tick.trim())
5623
5662
  };
5624
5663
  }
5625
- function parseTimers(raw) {
5626
- if (raw === void 0 || raw === null) {
5664
+ function parseTimers(raw2) {
5665
+ if (raw2 === void 0 || raw2 === null) {
5627
5666
  return [];
5628
5667
  }
5629
- if (!Array.isArray(raw)) {
5668
+ if (!Array.isArray(raw2)) {
5630
5669
  throw new SomaTimerParseError("timers \u5FC5\u987B\u662F\u6570\u7EC4");
5631
5670
  }
5632
- return raw.map((item, index) => parseTimerItem(item, index));
5671
+ return raw2.map((item, index) => parseTimerItem(item, index));
5633
5672
  }
5634
5673
  function compileTimer(timer) {
5635
5674
  const somaId = `@timer.${timer.id}`;
@@ -5648,11 +5687,11 @@ var SomaTriggerParseError = class extends Error {
5648
5687
  this.name = "SomaTriggerParseError";
5649
5688
  }
5650
5689
  };
5651
- function parseTriggerItem(raw, index) {
5652
- if (!raw || typeof raw !== "object") {
5690
+ function parseTriggerItem(raw2, index) {
5691
+ if (!raw2 || typeof raw2 !== "object") {
5653
5692
  throw new SomaTriggerParseError(`triggers[${index}] \u5FC5\u987B\u662F\u5BF9\u8C61`);
5654
5693
  }
5655
- const item = raw;
5694
+ const item = raw2;
5656
5695
  if (typeof item.condition !== "string" || !item.condition.trim()) {
5657
5696
  throw new SomaTriggerParseError(`triggers[${index}].condition \u5FC5\u987B\u662F\u975E\u7A7A\u5B57\u7B26\u4E32`);
5658
5697
  }
@@ -5685,20 +5724,20 @@ function parseTriggerItem(raw, index) {
5685
5724
  }
5686
5725
  return trigger;
5687
5726
  }
5688
- function parseTriggers(raw) {
5689
- if (raw === void 0 || raw === null) {
5727
+ function parseTriggers(raw2) {
5728
+ if (raw2 === void 0 || raw2 === null) {
5690
5729
  return [];
5691
5730
  }
5692
- if (!Array.isArray(raw)) {
5731
+ if (!Array.isArray(raw2)) {
5693
5732
  throw new SomaTriggerParseError("triggers \u5FC5\u987B\u662F\u6570\u7EC4");
5694
5733
  }
5695
- return raw.map((item, index) => parseTriggerItem(item, index));
5734
+ return raw2.map((item, index) => parseTriggerItem(item, index));
5696
5735
  }
5697
- function splitEventConfigRaw(raw) {
5698
- if (!raw || typeof raw !== "object" || Array.isArray(raw)) {
5736
+ function splitEventConfigRaw(raw2) {
5737
+ if (!raw2 || typeof raw2 !== "object" || Array.isArray(raw2)) {
5699
5738
  return { eventsRaw: {}, triggers: [], timers: [] };
5700
5739
  }
5701
- const { triggers: triggersRaw, timers: timersRaw, ...eventsRaw } = raw;
5740
+ const { triggers: triggersRaw, timers: timersRaw, ...eventsRaw } = raw2;
5702
5741
  return {
5703
5742
  eventsRaw,
5704
5743
  triggers: parseTriggers(triggersRaw),
@@ -5754,13 +5793,13 @@ function validateSomaId(somaId, path) {
5754
5793
  throw new SomaStyleConfigError(`data-soma-id \u4E0D\u80FD\u4E3A\u7A7A`, path);
5755
5794
  }
5756
5795
  }
5757
- function parseBase(raw, path) {
5758
- if (!raw) return {};
5759
- if (typeof raw !== "object" || Array.isArray(raw)) {
5796
+ function parseBase(raw2, path) {
5797
+ if (!raw2) return {};
5798
+ if (typeof raw2 !== "object" || Array.isArray(raw2)) {
5760
5799
  throw new SomaStyleConfigError(`base \u5FC5\u987B\u662F\u5BF9\u8C61\uFF08somaId \u2192 \u7C7B\u540D\u5B57\u7B26\u4E32\uFF09`, path);
5761
5800
  }
5762
5801
  const result = {};
5763
- for (const [somaId, classes] of Object.entries(raw)) {
5802
+ for (const [somaId, classes] of Object.entries(raw2)) {
5764
5803
  validateSomaId(somaId, `${path}.${somaId}`);
5765
5804
  if (typeof classes !== "string") {
5766
5805
  throw new SomaStyleConfigError(
@@ -5773,11 +5812,11 @@ function parseBase(raw, path) {
5773
5812
  }
5774
5813
  return result;
5775
5814
  }
5776
- function parseStateRule(raw, path) {
5777
- if (!raw || typeof raw !== "object" || Array.isArray(raw)) {
5815
+ function parseStateRule(raw2, path) {
5816
+ if (!raw2 || typeof raw2 !== "object" || Array.isArray(raw2)) {
5778
5817
  throw new SomaStyleConfigError(`\u72B6\u6001\u89C4\u5219\u5FC5\u987B\u662F\u5BF9\u8C61`, path);
5779
5818
  }
5780
- const obj = raw;
5819
+ const obj = raw2;
5781
5820
  if (!obj.condition || typeof obj.condition !== "string") {
5782
5821
  throw new SomaStyleConfigError(
5783
5822
  `condition \u5FC5\u987B\u662F\u975E\u7A7A\u5B57\u7B26\u4E32\uFF0C\u5F53\u524D\u503C: ${JSON.stringify(obj.condition)}`,
@@ -5812,13 +5851,13 @@ function parseStateRule(raw, path) {
5812
5851
  apply: obj.apply
5813
5852
  };
5814
5853
  }
5815
- function parseStates(raw, path) {
5816
- if (!raw) return {};
5817
- if (typeof raw !== "object" || Array.isArray(raw)) {
5854
+ function parseStates(raw2, path) {
5855
+ if (!raw2) return {};
5856
+ if (typeof raw2 !== "object" || Array.isArray(raw2)) {
5818
5857
  throw new SomaStyleConfigError(`states \u5FC5\u987B\u662F\u5BF9\u8C61\uFF08somaId \u2192 \u89C4\u5219\u6570\u7EC4\uFF09`, path);
5819
5858
  }
5820
5859
  const result = {};
5821
- for (const [somaId, rules] of Object.entries(raw)) {
5860
+ for (const [somaId, rules] of Object.entries(raw2)) {
5822
5861
  validateSomaId(somaId, `${path}.${somaId}`);
5823
5862
  if (!Array.isArray(rules)) {
5824
5863
  throw new SomaStyleConfigError(
@@ -5832,11 +5871,11 @@ function parseStates(raw, path) {
5832
5871
  }
5833
5872
  return result;
5834
5873
  }
5835
- function parseTransition(raw, somaId, path) {
5836
- if (!raw || typeof raw !== "object" || Array.isArray(raw)) {
5874
+ function parseTransition(raw2, somaId, path) {
5875
+ if (!raw2 || typeof raw2 !== "object" || Array.isArray(raw2)) {
5837
5876
  throw new SomaStyleConfigError(`\u8FC7\u6E21\u914D\u7F6E\u5FC5\u987B\u662F\u5BF9\u8C61`, path);
5838
5877
  }
5839
- const obj = raw;
5878
+ const obj = raw2;
5840
5879
  if (!obj.trigger || typeof obj.trigger !== "string") {
5841
5880
  throw new SomaStyleConfigError(
5842
5881
  `trigger \u5FC5\u987B\u662F\u975E\u7A7A\u5B57\u7B26\u4E32\uFF0C\u5F53\u524D\u503C: ${JSON.stringify(obj.trigger)}`,
@@ -5890,23 +5929,23 @@ function parseTransition(raw, somaId, path) {
5890
5929
  }
5891
5930
  return result;
5892
5931
  }
5893
- function parseTransitions(raw, path) {
5894
- if (!raw) return {};
5895
- if (typeof raw !== "object" || Array.isArray(raw)) {
5932
+ function parseTransitions(raw2, path) {
5933
+ if (!raw2) return {};
5934
+ if (typeof raw2 !== "object" || Array.isArray(raw2)) {
5896
5935
  throw new SomaStyleConfigError(`transitions \u5FC5\u987B\u662F\u5BF9\u8C61\uFF08somaId \u2192 \u8FC7\u6E21\u914D\u7F6E\uFF09`, path);
5897
5936
  }
5898
5937
  const result = {};
5899
- for (const [somaId, config] of Object.entries(raw)) {
5938
+ for (const [somaId, config] of Object.entries(raw2)) {
5900
5939
  validateSomaId(somaId, `${path}.${somaId}`);
5901
5940
  result[somaId] = parseTransition(config, somaId, `${path}.${somaId}`);
5902
5941
  }
5903
5942
  return result;
5904
5943
  }
5905
- function parseTheme(raw, themeName, path) {
5906
- if (!raw || typeof raw !== "object" || Array.isArray(raw)) {
5944
+ function parseTheme(raw2, themeName, path) {
5945
+ if (!raw2 || typeof raw2 !== "object" || Array.isArray(raw2)) {
5907
5946
  throw new SomaStyleConfigError(`\u4E3B\u9898 "${themeName}" \u5FC5\u987B\u662F\u5BF9\u8C61`, path);
5908
5947
  }
5909
- const obj = raw;
5948
+ const obj = raw2;
5910
5949
  const base = {};
5911
5950
  const states = {};
5912
5951
  let vars;
@@ -5954,13 +5993,13 @@ function parseTheme(raw, themeName, path) {
5954
5993
  }
5955
5994
  return { base, states, vars };
5956
5995
  }
5957
- function parseThemes(raw, path) {
5958
- if (!raw) return {};
5959
- if (typeof raw !== "object" || Array.isArray(raw)) {
5996
+ function parseThemes(raw2, path) {
5997
+ if (!raw2) return {};
5998
+ if (typeof raw2 !== "object" || Array.isArray(raw2)) {
5960
5999
  throw new SomaStyleConfigError(`themes \u5FC5\u987B\u662F\u5BF9\u8C61\uFF08\u4E3B\u9898\u540D \u2192 \u914D\u7F6E\uFF09`, path);
5961
6000
  }
5962
6001
  const result = {};
5963
- for (const [themeName, config] of Object.entries(raw)) {
6002
+ for (const [themeName, config] of Object.entries(raw2)) {
5964
6003
  if (!themeName) {
5965
6004
  throw new SomaStyleConfigError(`\u4E3B\u9898\u540D\u4E0D\u80FD\u4E3A\u7A7A`, path);
5966
6005
  }
@@ -5968,11 +6007,11 @@ function parseThemes(raw, path) {
5968
6007
  }
5969
6008
  return result;
5970
6009
  }
5971
- function parseStyleConfig(raw) {
5972
- if (!raw || typeof raw !== "object" || Array.isArray(raw)) {
6010
+ function parseStyleConfig(raw2) {
6011
+ if (!raw2 || typeof raw2 !== "object" || Array.isArray(raw2)) {
5973
6012
  throw new SomaStyleConfigError(`\u6837\u5F0F\u914D\u7F6E\u5FC5\u987B\u662F\u5BF9\u8C61`);
5974
6013
  }
5975
- const obj = raw;
6014
+ const obj = raw2;
5976
6015
  if (!obj.host || typeof obj.host !== "string") {
5977
6016
  throw new SomaStyleConfigError(
5978
6017
  `host \u5FC5\u987B\u662F\u975E\u7A7A\u5B57\u7B26\u4E32\uFF0C\u5F53\u524D\u503C: ${JSON.stringify(obj.host)}`,
@@ -6020,32 +6059,32 @@ function createAdaptiveVocabulary(...sources) {
6020
6059
  }
6021
6060
  return merged;
6022
6061
  }
6023
- function assertPlainObject(raw, what, path) {
6024
- if (!raw || typeof raw !== "object" || Array.isArray(raw)) {
6062
+ function assertPlainObject(raw2, what, path) {
6063
+ if (!raw2 || typeof raw2 !== "object" || Array.isArray(raw2)) {
6025
6064
  throw new SomaAdaptiveConfigError(
6026
- `${what} \u5FC5\u987B\u662F\u5BF9\u8C61\uFF0C\u5F53\u524D\u503C: ${JSON.stringify(raw)}`,
6065
+ `${what} \u5FC5\u987B\u662F\u5BF9\u8C61\uFF0C\u5F53\u524D\u503C: ${JSON.stringify(raw2)}`,
6027
6066
  path
6028
6067
  );
6029
6068
  }
6030
- return raw;
6069
+ return raw2;
6031
6070
  }
6032
- function parseProfile(raw, path) {
6033
- if (typeof raw !== "string" || !raw.trim()) {
6071
+ function parseProfile(raw2, path) {
6072
+ if (typeof raw2 !== "string" || !raw2.trim()) {
6034
6073
  throw new SomaAdaptiveConfigError(
6035
6074
  `profile \u5FC5\u987B\u662F\u975E\u7A7A\u5B57\u7B26\u4E32\uFF0C\u5408\u6CD5\u53D6\u503C: ${SOMA_ADAPTIVE_PROFILES.join(" | ")}`,
6036
6075
  path
6037
6076
  );
6038
6077
  }
6039
- if (!SOMA_ADAPTIVE_PROFILES.includes(raw)) {
6078
+ if (!SOMA_ADAPTIVE_PROFILES.includes(raw2)) {
6040
6079
  throw new SomaAdaptiveConfigError(
6041
- `\u672A\u77E5\u7684 profile "${raw}"\uFF0C\u5408\u6CD5\u53D6\u503C: ${SOMA_ADAPTIVE_PROFILES.join(" | ")}`,
6080
+ `\u672A\u77E5\u7684 profile "${raw2}"\uFF0C\u5408\u6CD5\u53D6\u503C: ${SOMA_ADAPTIVE_PROFILES.join(" | ")}`,
6042
6081
  path
6043
6082
  );
6044
6083
  }
6045
- return raw;
6084
+ return raw2;
6046
6085
  }
6047
- function parseLevel(raw, path) {
6048
- const obj = assertPlainObject(raw, "\u9636\u68AF\u7684\u6BCF\u4E00\u7EA7", path);
6086
+ function parseLevel(raw2, path) {
6087
+ const obj = assertPlainObject(raw2, "\u9636\u68AF\u7684\u6BCF\u4E00\u7EA7", path);
6049
6088
  const keys = Object.keys(obj);
6050
6089
  if (keys.length !== 1) {
6051
6090
  throw new SomaAdaptiveConfigError(
@@ -6066,20 +6105,20 @@ function parseLevel(raw, path) {
6066
6105
  }
6067
6106
  return { slot, value };
6068
6107
  }
6069
- function parseLadder(raw, vocabulary, path, vocabularyRequired) {
6070
- if (!Array.isArray(raw)) {
6108
+ function parseLadder(raw2, vocabulary, path, vocabularyRequired) {
6109
+ if (!Array.isArray(raw2)) {
6071
6110
  throw new SomaAdaptiveConfigError(
6072
- `ladder \u5FC5\u987B\u662F\u6570\u7EC4\uFF08\u7EA7\u5E8F\uFF09\uFF0C\u5F53\u524D\u7C7B\u578B: ${typeof raw}`,
6111
+ `ladder \u5FC5\u987B\u662F\u6570\u7EC4\uFF08\u7EA7\u5E8F\uFF09\uFF0C\u5F53\u524D\u7C7B\u578B: ${typeof raw2}`,
6073
6112
  path
6074
6113
  );
6075
6114
  }
6076
- if (raw.length > SOMA_ADAPTIVE_MAX_LADDER) {
6115
+ if (raw2.length > SOMA_ADAPTIVE_MAX_LADDER) {
6077
6116
  throw new SomaAdaptiveConfigError(
6078
- `\u9636\u68AF\u7EA7\u6570 ${raw.length} \u8D85\u8FC7\u4E0A\u9650 ${SOMA_ADAPTIVE_MAX_LADDER}\uFF1A\u8D85\u8FC7 ${SOMA_ADAPTIVE_MAX_LADDER} \u7EA7\u8BF4\u660E\u9875\u9762\u4FE1\u606F\u8FC7\u8F7D\uFF0C\u5E94\u62C6\u9875\u800C\u4E0D\u662F\u52A0\u7EA7`,
6117
+ `\u9636\u68AF\u7EA7\u6570 ${raw2.length} \u8D85\u8FC7\u4E0A\u9650 ${SOMA_ADAPTIVE_MAX_LADDER}\uFF1A\u8D85\u8FC7 ${SOMA_ADAPTIVE_MAX_LADDER} \u7EA7\u8BF4\u660E\u9875\u9762\u4FE1\u606F\u8FC7\u8F7D\uFF0C\u5E94\u62C6\u9875\u800C\u4E0D\u662F\u52A0\u7EA7`,
6079
6118
  path
6080
6119
  );
6081
6120
  }
6082
- const levels = raw.map((item, index) => parseLevel(item, `${path}[${index}]`));
6121
+ const levels = raw2.map((item, index) => parseLevel(item, `${path}[${index}]`));
6083
6122
  if (levels.length > 0 && !vocabulary) {
6084
6123
  if (vocabularyRequired) {
6085
6124
  throw new SomaAdaptiveConfigError(
@@ -6107,15 +6146,15 @@ function parseLadder(raw, vocabulary, path, vocabularyRequired) {
6107
6146
  });
6108
6147
  return levels;
6109
6148
  }
6110
- function parsePin(raw, path) {
6111
- if (!Array.isArray(raw)) {
6149
+ function parsePin(raw2, path) {
6150
+ if (!Array.isArray(raw2)) {
6112
6151
  throw new SomaAdaptiveConfigError(
6113
- `pin \u5FC5\u987B\u662F\u6570\u7EC4\uFF08\u8C41\u514D\u69FD\u951A\u70B9\u540D\uFF09\uFF0C\u5F53\u524D\u7C7B\u578B: ${typeof raw}`,
6152
+ `pin \u5FC5\u987B\u662F\u6570\u7EC4\uFF08\u8C41\u514D\u69FD\u951A\u70B9\u540D\uFF09\uFF0C\u5F53\u524D\u7C7B\u578B: ${typeof raw2}`,
6114
6153
  path
6115
6154
  );
6116
6155
  }
6117
6156
  const pinned = [];
6118
- raw.forEach((item, index) => {
6157
+ raw2.forEach((item, index) => {
6119
6158
  if (typeof item !== "string" || !item.trim()) {
6120
6159
  throw new SomaAdaptiveConfigError(
6121
6160
  `pin \u6761\u76EE\u5FC5\u987B\u662F\u975E\u7A7A\u951A\u70B9\u540D\uFF0C\u5F53\u524D\u503C: ${JSON.stringify(item)}`,
@@ -6129,9 +6168,9 @@ function parsePin(raw, path) {
6129
6168
  });
6130
6169
  return pinned;
6131
6170
  }
6132
- function parseAdaptiveConfig(raw, vocabulary, path = "adaptive", options) {
6171
+ function parseAdaptiveConfig(raw2, vocabulary, path = "adaptive", options) {
6133
6172
  const vocabularyRequired = options?.vocabularyRequired !== false;
6134
- const obj = assertPlainObject(raw, "adaptive", path);
6173
+ const obj = assertPlainObject(raw2, "adaptive", path);
6135
6174
  if (!("profile" in obj) && "ladder" in obj) {
6136
6175
  throw new SomaAdaptiveConfigError(
6137
6176
  `\u58F0\u660E\u4E86 ladder \u5374\u7F3A\u5C11 profile\uFF1A\u9636\u68AF\u5FC5\u987B\u6302\u5728\u4E00\u4E2A\u7248\u5F0F\u753B\u50CF\u4E0A\uFF0C\u8BF7\u8865 profile\uFF08${SOMA_ADAPTIVE_PROFILES.join(" | ")}\uFF09\u6216\u5220\u9664 ladder`,
@@ -6167,15 +6206,15 @@ function isPlainObject2(value) {
6167
6206
  return value !== null && typeof value === "object" && !Array.isArray(value);
6168
6207
  }
6169
6208
  function parsePageState(input, deps) {
6170
- const { raw, objectNames, anchorIds, path } = input;
6209
+ const { raw: raw2, objectNames, anchorIds, path } = input;
6171
6210
  const fail2 = deps.fail;
6172
- if (!isPlainObject2(raw)) fail2("state \u5FC5\u987B\u662F\u6620\u5C04", path);
6173
- for (const key of Object.keys(raw)) {
6211
+ if (!isPlainObject2(raw2)) fail2("state \u5FC5\u987B\u662F\u6620\u5C04", path);
6212
+ for (const key of Object.keys(raw2)) {
6174
6213
  if (!CONFIG_KEYS.has(key)) {
6175
6214
  fail2(`\u672A\u77E5\u7684 state \u5B57\u6BB5 "${key}"\uFF08\u652F\u6301: ${[...CONFIG_KEYS].join(" / ")}\uFF09`, `${path}.${key}`);
6176
6215
  }
6177
6216
  }
6178
- const version = raw.version;
6217
+ const version = raw2.version;
6179
6218
  if (!Number.isInteger(version) || version < 1) {
6180
6219
  fail2("state.version \u5FC5\u586B\uFF0C\u4E14\u5FC5\u987B\u662F \u2265 1 \u7684\u6574\u6570\uFF08\u5B83\u51B3\u5B9A\u4E00\u4EFD\u65E7\u72B6\u6001\u8BE5\u4E0D\u8BE5\u88AB\u4E22\u5F03\uFF09", `${path}.version`);
6181
6220
  }
@@ -6190,30 +6229,30 @@ function parsePageState(input, deps) {
6190
6229
  return name;
6191
6230
  });
6192
6231
  };
6193
- const windows = names(raw.window, `${path}.window`, objectNames, "\u672C\u9875\u58F0\u660E\u8FC7\u7684\u6570\u636E\u5BF9\u8C61");
6194
- const columns = anchorIds === void 0 ? Array.isArray(raw.columns) ? raw.columns.map(String) : [] : names(raw.columns, `${path}.columns`, anchorIds, "\u672C\u9875\u7684\u951A\u70B9");
6232
+ const windows = names(raw2.window, `${path}.window`, objectNames, "\u672C\u9875\u58F0\u660E\u8FC7\u7684\u6570\u636E\u5BF9\u8C61");
6233
+ const columns = anchorIds === void 0 ? Array.isArray(raw2.columns) ? raw2.columns.map(String) : [] : names(raw2.columns, `${path}.columns`, anchorIds, "\u672C\u9875\u7684\u951A\u70B9");
6195
6234
  const config = { version };
6196
6235
  if (windows.length > 0) config.window = windows;
6197
6236
  if (columns.length > 0) config.columns = columns;
6198
- if (raw.density !== void 0) config.density = raw.density === true;
6199
- if (raw.expanded !== void 0) config.expanded = raw.expanded === true;
6200
- if (raw.url !== void 0) config.url = raw.url === true;
6201
- if (raw.initial_state !== void 0) {
6202
- config.initial_state = parseStateValue(raw.initial_state, `${path}.initial_state`, config, fail2);
6237
+ if (raw2.density !== void 0) config.density = raw2.density === true;
6238
+ if (raw2.expanded !== void 0) config.expanded = raw2.expanded === true;
6239
+ if (raw2.url !== void 0) config.url = raw2.url === true;
6240
+ if (raw2.initial_state !== void 0) {
6241
+ config.initial_state = parseStateValue(raw2.initial_state, `${path}.initial_state`, config, fail2);
6203
6242
  }
6204
6243
  return config;
6205
6244
  }
6206
- function parseStateValue(raw, path, config, fail2) {
6207
- if (!isPlainObject2(raw)) fail2(`${path} \u5FC5\u987B\u662F\u6620\u5C04`, path);
6245
+ function parseStateValue(raw2, path, config, fail2) {
6246
+ if (!isPlainObject2(raw2)) fail2(`${path} \u5FC5\u987B\u662F\u6620\u5C04`, path);
6208
6247
  const state2 = { version: config.version };
6209
- if (raw.version !== void 0 && raw.version !== config.version) {
6210
- state2.version = raw.version;
6248
+ if (raw2.version !== void 0 && raw2.version !== config.version) {
6249
+ state2.version = raw2.version;
6211
6250
  return state2;
6212
6251
  }
6213
- if (isPlainObject2(raw.window)) {
6252
+ if (isPlainObject2(raw2.window)) {
6214
6253
  const allowed = config.window ?? [];
6215
6254
  const windows = {};
6216
- for (const [name, slice] of Object.entries(raw.window)) {
6255
+ for (const [name, slice] of Object.entries(raw2.window)) {
6217
6256
  if (!allowed.includes(name)) continue;
6218
6257
  windows[name] = slice;
6219
6258
  }
@@ -6221,10 +6260,10 @@ function parseStateValue(raw, path, config, fail2) {
6221
6260
  state2.window = windows;
6222
6261
  }
6223
6262
  }
6224
- if (isPlainObject2(raw.columns)) {
6263
+ if (isPlainObject2(raw2.columns)) {
6225
6264
  const allowed = config.columns ?? [];
6226
6265
  const columns = {};
6227
- for (const [name, slice] of Object.entries(raw.columns)) {
6266
+ for (const [name, slice] of Object.entries(raw2.columns)) {
6228
6267
  if (!allowed.includes(name)) continue;
6229
6268
  columns[name] = slice;
6230
6269
  }
@@ -6232,11 +6271,11 @@ function parseStateValue(raw, path, config, fail2) {
6232
6271
  state2.columns = columns;
6233
6272
  }
6234
6273
  }
6235
- if (config.density && typeof raw.density === "string" && DENSITIES.has(raw.density)) {
6236
- state2.density = raw.density;
6274
+ if (config.density && typeof raw2.density === "string" && DENSITIES.has(raw2.density)) {
6275
+ state2.density = raw2.density;
6237
6276
  }
6238
- if (config.expanded && Array.isArray(raw.expanded)) {
6239
- state2.expanded = raw.expanded.map(String);
6277
+ if (config.expanded && Array.isArray(raw2.expanded)) {
6278
+ state2.expanded = raw2.expanded.map(String);
6240
6279
  }
6241
6280
  return state2;
6242
6281
  }
@@ -6281,15 +6320,15 @@ function isPlainObject3(value) {
6281
6320
  return value !== null && typeof value === "object" && !Array.isArray(value);
6282
6321
  }
6283
6322
  function parseLayoutConstraint(input, deps) {
6284
- const { raw, path } = input;
6323
+ const { raw: raw2, path } = input;
6285
6324
  const fail2 = deps.fail;
6286
- if (!isPlainObject3(raw)) fail2("layout \u5FC5\u987B\u662F\u6620\u5C04", path);
6287
- const explicit = isPlainObject3(raw.nodes) ? raw.nodes : null;
6325
+ if (!isPlainObject3(raw2)) fail2("layout \u5FC5\u987B\u662F\u6620\u5C04", path);
6326
+ const explicit = isPlainObject3(raw2.nodes) ? raw2.nodes : null;
6288
6327
  const source = explicit ?? Object.fromEntries(
6289
- Object.entries(raw).filter(([key]) => !SECTION_KEYS.has(key))
6328
+ Object.entries(raw2).filter(([key]) => !SECTION_KEYS.has(key))
6290
6329
  );
6291
6330
  if (explicit === null) {
6292
- for (const key of Object.keys(raw)) {
6331
+ for (const key of Object.keys(raw2)) {
6293
6332
  if (SECTION_KEYS.has(key)) continue;
6294
6333
  if (!NAME_PATTERN.test(key)) {
6295
6334
  fail2(
@@ -6343,32 +6382,32 @@ function parseLayoutConstraint(input, deps) {
6343
6382
  fail2(`${path} \u81F3\u5C11\u8981\u6709\u4E00\u4E2A\u5B50\u9879`, path);
6344
6383
  }
6345
6384
  const constraint = { nodes };
6346
- if (raw.gap !== void 0) {
6347
- const gap = String(raw.gap);
6385
+ if (raw2.gap !== void 0) {
6386
+ const gap = String(raw2.gap);
6348
6387
  if (!/^\d+(?:\.\d+)?(rem|%|cqi)$/.test(gap)) {
6349
6388
  fail2(`${path}.gap \u7684\u957F\u5EA6 "${gap}" \u975E\u6CD5\u2014\u2014\u53EA\u8BA4 rem / % / cqi`, `${path}.gap`);
6350
6389
  }
6351
6390
  constraint.gap = gap;
6352
6391
  }
6353
- if (raw.wrap !== void 0) {
6354
- const wrap = String(raw.wrap);
6392
+ if (raw2.wrap !== void 0) {
6393
+ const wrap = String(raw2.wrap);
6355
6394
  if (!WRAPS.has(wrap)) {
6356
- fail2(`${path}.wrap \u53EA\u80FD\u662F ${[...WRAPS].join(" / ")}\uFF08\u6536\u5230 ${JSON.stringify(raw.wrap)}\uFF09`, `${path}.wrap`);
6395
+ fail2(`${path}.wrap \u53EA\u80FD\u662F ${[...WRAPS].join(" / ")}\uFF08\u6536\u5230 ${JSON.stringify(raw2.wrap)}\uFF09`, `${path}.wrap`);
6357
6396
  }
6358
6397
  constraint.wrap = wrap;
6359
6398
  }
6360
- if (raw.align !== void 0) {
6361
- const align = String(raw.align);
6399
+ if (raw2.align !== void 0) {
6400
+ const align = String(raw2.align);
6362
6401
  if (!SOMA_LAYOUT_ALIGNS.includes(align)) {
6363
6402
  fail2(
6364
- `${path}.align \u53EA\u80FD\u662F ${SOMA_LAYOUT_ALIGNS.join(" / ")}\uFF08\u6536\u5230 ${JSON.stringify(raw.align)}\uFF09`,
6403
+ `${path}.align \u53EA\u80FD\u662F ${SOMA_LAYOUT_ALIGNS.join(" / ")}\uFF08\u6536\u5230 ${JSON.stringify(raw2.align)}\uFF09`,
6365
6404
  `${path}.align`
6366
6405
  );
6367
6406
  }
6368
6407
  constraint.align = align;
6369
6408
  }
6370
- if (raw.container_name !== void 0) {
6371
- const containerName = String(raw.container_name);
6409
+ if (raw2.container_name !== void 0) {
6410
+ const containerName = String(raw2.container_name);
6372
6411
  if (!/^[a-z][a-z0-9-]*$/.test(containerName)) {
6373
6412
  fail2(
6374
6413
  `${path}.container_name "${containerName}" \u4E0D\u662F\u5408\u6CD5\u7684\u5BB9\u5668\u540D\uFF08\u5C0F\u5199\u5B57\u6BCD\u5F00\u5934\u3001\u8FDE\u5B57\u7B26\u5206\u9694\uFF1B\u5B83\u8981\u51FA\u73B0\u5728 CSS \u7684 container-name \u4E0A\uFF09`,
@@ -6409,11 +6448,11 @@ function validateBind(bind, path) {
6409
6448
  parseOnChangeRules(bind.onChange, `${path}.onChange`);
6410
6449
  }
6411
6450
  }
6412
- function parseOnChangeRules(raw, path) {
6413
- if (!Array.isArray(raw)) {
6451
+ function parseOnChangeRules(raw2, path) {
6452
+ if (!Array.isArray(raw2)) {
6414
6453
  throw new SomaUiConfigError("onChange \u5FC5\u987B\u662F\u6570\u7EC4", path);
6415
6454
  }
6416
- return raw.map((item, index) => {
6455
+ return raw2.map((item, index) => {
6417
6456
  const itemPath = `${path}[${index}]`;
6418
6457
  if (!item || typeof item !== "object") {
6419
6458
  throw new SomaUiConfigError("onChange \u6761\u76EE\u5FC5\u987B\u662F\u5BF9\u8C61", itemPath);
@@ -6444,12 +6483,12 @@ function parseOnChangeRules(raw, path) {
6444
6483
  return parsed;
6445
6484
  });
6446
6485
  }
6447
- function parseInitProps(raw, path) {
6448
- if (!raw || typeof raw !== "object" || Array.isArray(raw)) {
6486
+ function parseInitProps(raw2, path) {
6487
+ if (!raw2 || typeof raw2 !== "object" || Array.isArray(raw2)) {
6449
6488
  throw new SomaUiConfigError("initProps \u5FC5\u987B\u662F\u5BF9\u8C61", path);
6450
6489
  }
6451
6490
  const result = {};
6452
- for (const [key, value] of Object.entries(raw)) {
6491
+ for (const [key, value] of Object.entries(raw2)) {
6453
6492
  if (!key.trim()) {
6454
6493
  throw new SomaUiConfigError("initProps \u7684\u952E\u4E0D\u80FD\u4E3A\u7A7A", path);
6455
6494
  }
@@ -6580,37 +6619,37 @@ function parseShowMapping(rawShow, path) {
6580
6619
  }
6581
6620
  return result;
6582
6621
  }
6583
- function parseUiConfig(raw, options) {
6584
- if (!raw || typeof raw !== "object") {
6622
+ function parseUiConfig(raw2, options) {
6623
+ if (!raw2 || typeof raw2 !== "object") {
6585
6624
  throw new SomaUiConfigError(`UI \u914D\u7F6E\u5FC5\u987B\u662F\u5BF9\u8C61`);
6586
6625
  }
6587
- if (!("bind" in raw)) {
6626
+ if (!("bind" in raw2)) {
6588
6627
  throw new SomaUiConfigError(`UI \u914D\u7F6E\u7F3A\u5C11\u5FC5\u586B\u5B57\u6BB5 bind`);
6589
6628
  }
6590
- validateBind(raw.bind, "bind");
6591
- if (!("show" in raw)) {
6629
+ validateBind(raw2.bind, "bind");
6630
+ if (!("show" in raw2)) {
6592
6631
  throw new SomaUiConfigError(`UI \u914D\u7F6E\u7F3A\u5C11\u5FC5\u586B\u5B57\u6BB5 show`);
6593
6632
  }
6594
6633
  const bind = {
6595
- obj: raw.bind.obj,
6596
- var: raw.bind.var
6634
+ obj: raw2.bind.obj,
6635
+ var: raw2.bind.var
6597
6636
  };
6598
- if (Array.isArray(raw.bind.onChange)) {
6599
- bind.onChange = parseOnChangeRules(raw.bind.onChange, "bind.onChange");
6637
+ if (Array.isArray(raw2.bind.onChange)) {
6638
+ bind.onChange = parseOnChangeRules(raw2.bind.onChange, "bind.onChange");
6600
6639
  }
6601
- const show = parseShowMapping(raw.show, "show");
6640
+ const show = parseShowMapping(raw2.show, "show");
6602
6641
  const config = { bind, show };
6603
- if ("initProps" in raw && raw.initProps !== void 0) {
6604
- config.initProps = parseInitProps(raw.initProps, "initProps");
6642
+ if ("initProps" in raw2 && raw2.initProps !== void 0) {
6643
+ config.initProps = parseInitProps(raw2.initProps, "initProps");
6605
6644
  }
6606
- if ("adaptive" in raw && raw.adaptive !== void 0) {
6607
- config.adaptive = parseAdaptiveConfig(raw.adaptive, options?.adaptiveVocabulary, "adaptive", {
6645
+ if ("adaptive" in raw2 && raw2.adaptive !== void 0) {
6646
+ config.adaptive = parseAdaptiveConfig(raw2.adaptive, options?.adaptiveVocabulary, "adaptive", {
6608
6647
  vocabularyRequired: options?.adaptiveVocabularyRequired !== false
6609
6648
  });
6610
6649
  }
6611
- if ("state" in raw && raw.state !== void 0) {
6650
+ if ("state" in raw2 && raw2.state !== void 0) {
6612
6651
  config.state = parsePageState(
6613
- { raw: raw.state, objectNames: options?.dataObjectNames ?? [], path: "state" },
6652
+ { raw: raw2.state, objectNames: options?.dataObjectNames ?? [], path: "state" },
6614
6653
  {
6615
6654
  fail(message) {
6616
6655
  throw new SomaUiConfigError(message);
@@ -6618,23 +6657,23 @@ function parseUiConfig(raw, options) {
6618
6657
  }
6619
6658
  );
6620
6659
  }
6621
- if ("layout" in raw && raw.layout !== void 0) {
6622
- config.layout = parseLayoutSection(raw.layout);
6660
+ if ("layout" in raw2 && raw2.layout !== void 0) {
6661
+ config.layout = parseLayoutSection(raw2.layout);
6623
6662
  }
6624
- if ("layout_css" in raw && raw.layout_css !== void 0) {
6625
- if (typeof raw.layout_css !== "string") {
6663
+ if ("layout_css" in raw2 && raw2.layout_css !== void 0) {
6664
+ if (typeof raw2.layout_css !== "string") {
6626
6665
  throw new SomaUiConfigError("layout_css \u5FC5\u987B\u662F\u5B57\u7B26\u4E32\uFF08\u6784\u5EFA\u671F\u6C42\u89E3\u4EA7\u7269\uFF0C\u4E0D\u624B\u5199\uFF09", "layout_css");
6627
6666
  }
6628
- config.layoutCss = raw.layout_css;
6667
+ config.layoutCss = raw2.layout_css;
6629
6668
  }
6630
6669
  return config;
6631
6670
  }
6632
- function parseLayoutSection(raw) {
6633
- if (!raw || typeof raw !== "object" || Array.isArray(raw)) {
6671
+ function parseLayoutSection(raw2) {
6672
+ if (!raw2 || typeof raw2 !== "object" || Array.isArray(raw2)) {
6634
6673
  throw new SomaUiConfigError("layout \u5FC5\u987B\u662F\u6620\u5C04\uFF1A{ <\u951A\u70B9id>: { gap, wrap, <\u5B50\u9879>: { sizing, \u2026 } } }", "layout");
6635
6674
  }
6636
6675
  const out = {};
6637
- for (const [anchor, spec] of Object.entries(raw)) {
6676
+ for (const [anchor, spec] of Object.entries(raw2)) {
6638
6677
  if (!/^[A-Za-z_][A-Za-z0-9_-]*$/.test(anchor)) {
6639
6678
  throw new SomaUiConfigError(`layout \u7684\u952E\u5FC5\u987B\u662F\u951A\u70B9 id\uFF08data-soma-id\uFF09\uFF0C\u6536\u5230 "${anchor}"`, `layout.${anchor}`);
6640
6679
  }
@@ -6693,13 +6732,13 @@ function extractEvents(ctor, scopeVar) {
6693
6732
  ({ methodName, pipeline }) => parseAnnotatedPipeline(methodName, scopeVar, pipeline)
6694
6733
  );
6695
6734
  }
6696
- function parseAnnotatedPipeline(methodName, scopeVar, raw) {
6697
- const colonIdx = raw.indexOf(":");
6735
+ function parseAnnotatedPipeline(methodName, scopeVar, raw2) {
6736
+ const colonIdx = raw2.indexOf(":");
6698
6737
  if (colonIdx === -1) {
6699
- throw new Error(`[SOMA Annotation] \u65E0\u6548\u7684 @Event \u683C\u5F0F\uFF0C\u7F3A\u5C11\u5192\u53F7: "${raw}"`);
6738
+ throw new Error(`[SOMA Annotation] \u65E0\u6548\u7684 @Event \u683C\u5F0F\uFF0C\u7F3A\u5C11\u5192\u53F7: "${raw2}"`);
6700
6739
  }
6701
- const selector = raw.slice(0, colonIdx).trim();
6702
- const expression = raw.slice(colonIdx + 1).trim();
6740
+ const selector = raw2.slice(0, colonIdx).trim();
6741
+ const expression = raw2.slice(colonIdx + 1).trim();
6703
6742
  const defaultFunc = `${scopeVar}.${methodName}`;
6704
6743
  const parts = expression.split("|").map((s) => s.trim());
6705
6744
  const type2 = parts[0];
@@ -6750,9 +6789,9 @@ var SomaAssetResolver = class {
6750
6789
  };
6751
6790
  }
6752
6791
  const cacheKey = `${uiYaml}\0${eventYaml}\0${localeYaml}\0${assets.appConfigYaml ?? ""}\0${assets.styleYaml ?? ""}`;
6753
- const cached = this.cache.get(cacheKey);
6754
- if (cached) {
6755
- return cached;
6792
+ const cached2 = this.cache.get(cacheKey);
6793
+ if (cached2) {
6794
+ return cached2;
6756
6795
  }
6757
6796
  const eventRaw = eventYaml.trim() ? yaml.load(eventYaml) : {};
6758
6797
  const { eventsRaw, triggers, timers } = splitEventConfigRaw(eventRaw);
@@ -6780,9 +6819,9 @@ var SomaAssetResolver = class {
6780
6819
  }
6781
6820
  parseStyleConfig(styleYaml) {
6782
6821
  if (!styleYaml) return void 0;
6783
- const raw = yaml.load(styleYaml);
6784
- if (!raw) return void 0;
6785
- return parseStyleConfig(raw);
6822
+ const raw2 = yaml.load(styleYaml);
6823
+ if (!raw2) return void 0;
6824
+ return parseStyleConfig(raw2);
6786
6825
  }
6787
6826
  };
6788
6827
 
@@ -6861,8 +6900,8 @@ var SomaReactiveProxy = class {
6861
6900
  */
6862
6901
  wrap(obj, basePath = "") {
6863
6902
  if (this.shouldSkip(obj)) return obj;
6864
- const cached = this.cache.get(obj);
6865
- if (cached) return cached;
6903
+ const cached2 = this.cache.get(obj);
6904
+ if (cached2) return cached2;
6866
6905
  const proxy = new Proxy(obj, this.createHandler(basePath));
6867
6906
  this.cache.set(obj, proxy);
6868
6907
  return proxy;
@@ -6965,9 +7004,9 @@ function hasPipes(rawValue) {
6965
7004
  var parseCache = /* @__PURE__ */ new Map();
6966
7005
  function parsePipedValue(rawValue, hasVar) {
6967
7006
  const cacheKey = rawValue;
6968
- const cached = parseCache.get(cacheKey);
6969
- if (cached) {
6970
- return cached;
7007
+ const cached2 = parseCache.get(cacheKey);
7008
+ if (cached2) {
7009
+ return cached2;
6971
7010
  }
6972
7011
  const segments = rawValue.split(/\s+\|\s+/);
6973
7012
  const basePath = segments[0].trim();
@@ -8695,8 +8734,8 @@ var SomaDomRenderer = class {
8695
8734
  }
8696
8735
  if (typeof config.when === "string") {
8697
8736
  const { path, negate } = this.parseConditionalPath(config.when);
8698
- const raw = this.resolveShowValue(path, data);
8699
- const visible = negate ? !raw : Boolean(raw);
8737
+ const raw2 = this.resolveShowValue(path, data);
8738
+ const visible = negate ? !raw2 : Boolean(raw2);
8700
8739
  this.adapter.setVisibility(element, visible);
8701
8740
  if (!visible) return;
8702
8741
  }
@@ -8793,12 +8832,12 @@ var SomaDomRenderer = class {
8793
8832
  }
8794
8833
  }
8795
8834
  /** 行作用域展示值:透明处理管道(`item.price | money`),无管道走原路径 */
8796
- resolveRowValue(raw, itemData) {
8797
- if (!hasPipes(raw)) {
8798
- return this.resolveShowValue(raw, itemData);
8835
+ resolveRowValue(raw2, itemData) {
8836
+ if (!hasPipes(raw2)) {
8837
+ return this.resolveShowValue(raw2, itemData);
8799
8838
  }
8800
8839
  const resolver = this.resolver;
8801
- const parsed = parsePipedValue(raw, (seg) => resolver?.hasVar(seg) ?? false);
8840
+ const parsed = parsePipedValue(raw2, (seg) => resolver?.hasVar(seg) ?? false);
8802
8841
  const base = this.resolveShowValue(parsed.basePath, itemData);
8803
8842
  const ctx = {
8804
8843
  read: (path) => this.resolveShowValue(path, itemData),
@@ -9288,8 +9327,8 @@ var SomaScopeResolver = class {
9288
9327
  */
9289
9328
  compileGetter(path) {
9290
9329
  if (!path) return (root) => root;
9291
- const cached = this.getterCache.get(path);
9292
- if (cached) return cached;
9330
+ const cached2 = this.getterCache.get(path);
9331
+ if (cached2) return cached2;
9293
9332
  const segments = path.split(".");
9294
9333
  let getter;
9295
9334
  switch (segments.length) {
@@ -10306,7 +10345,7 @@ var SomaHttpService = class {
10306
10345
  if (!res.ok) {
10307
10346
  const body2 = typeof res.text === "function" ? await res.text().catch(() => "") : "";
10308
10347
  this.onHttpError?.(res.status, body2 || res.statusText);
10309
- throw new Error(`HTTP ${res.status}: ${res.statusText}`);
10348
+ throw new Error(`HTTP ${res.status}: ${describeHttpErrorBody(body2, res.statusText)}`);
10310
10349
  }
10311
10350
  return await res.json();
10312
10351
  } finally {
@@ -10650,10 +10689,10 @@ var SessionStorageService = class {
10650
10689
  return sessionStorage;
10651
10690
  }
10652
10691
  get(key) {
10653
- const raw = this.session?.getItem(key) ?? this.fallback.get(key);
10654
- if (raw == null) return null;
10692
+ const raw2 = this.session?.getItem(key) ?? this.fallback.get(key);
10693
+ if (raw2 == null) return null;
10655
10694
  try {
10656
- const entry = JSON.parse(raw);
10695
+ const entry = JSON.parse(raw2);
10657
10696
  if (entry.expiresAt !== null && Date.now() > entry.expiresAt) {
10658
10697
  this.remove(key);
10659
10698
  return null;
@@ -11646,10 +11685,10 @@ var PATCH_KEYS = /* @__PURE__ */ new Set(["visible", "display", "pattern", "requ
11646
11685
  var CONFIG_KEYS2 = /* @__PURE__ */ new Set(["when", "depends", "on", "target", "fulfill", "otherwise"]);
11647
11686
  var CALC_WRITABLE = /* @__PURE__ */ new Set(["int", "float", "money", "percent", "progress", "text", "url", "enum", "date", "datetime"]);
11648
11687
  function parseReactions(input, deps) {
11649
- const { raw, fields, named, path } = input;
11688
+ const { raw: raw2, fields, named, path } = input;
11650
11689
  const { fail: fail2 } = deps;
11651
- if (!Array.isArray(raw)) fail2("reactions \u5FC5\u987B\u662F\u6570\u7EC4", path);
11652
- const list = raw;
11690
+ if (!Array.isArray(raw2)) fail2("reactions \u5FC5\u987B\u662F\u6570\u7EC4", path);
11691
+ const list = raw2;
11653
11692
  const fieldKeys = Object.keys(fields);
11654
11693
  const fieldTypes = Object.fromEntries(
11655
11694
  fieldKeys.map((key) => [key, fields[key].type])
@@ -11765,11 +11804,11 @@ function parseReactions(input, deps) {
11765
11804
  provenance: buildProvenance(reactions, fieldKeys, input.sourceApiOf ?? {})
11766
11805
  };
11767
11806
  }
11768
- function checkFormPatch(raw, path, fail2) {
11769
- if (!raw || typeof raw !== "object" || Array.isArray(raw)) {
11807
+ function checkFormPatch(raw2, path, fail2) {
11808
+ if (!raw2 || typeof raw2 !== "object" || Array.isArray(raw2)) {
11770
11809
  fail2("submit \u7684 patch \u5FC5\u987B\u662F\u5BF9\u8C61 { disabled: \u5E03\u5C14 }", path);
11771
11810
  }
11772
- const box = raw;
11811
+ const box = raw2;
11773
11812
  for (const key of Object.keys(box)) {
11774
11813
  if (key !== "disabled") fail2(`submit \u53EA\u652F\u6301 disabled\uFF0C\u6536\u5230 "${key}"`, `${path}.${key}`);
11775
11814
  }
@@ -11777,11 +11816,11 @@ function checkFormPatch(raw, path, fail2) {
11777
11816
  fail2("submit.disabled \u5FC5\u987B\u662F\u5E03\u5C14", `${path}.disabled`);
11778
11817
  }
11779
11818
  }
11780
- function checkFieldPatch(raw, target, field, fieldKeys, fieldTypes, path, fail2) {
11781
- if (!raw || typeof raw !== "object" || Array.isArray(raw)) {
11819
+ function checkFieldPatch(raw2, target, field, fieldKeys, fieldTypes, path, fail2) {
11820
+ if (!raw2 || typeof raw2 !== "object" || Array.isArray(raw2)) {
11782
11821
  fail2("patch \u5FC5\u987B\u662F\u5BF9\u8C61", path);
11783
11822
  }
11784
- const patch = raw;
11823
+ const patch = raw2;
11785
11824
  for (const key of Object.keys(patch)) {
11786
11825
  if (!PATCH_KEYS.has(key)) {
11787
11826
  fail2(`\u672A\u77E5\u7684 patch \u952E "${key}"\uFF08\u652F\u6301: ${[...PATCH_KEYS].join(" / ")}\uFF09`, `${path}.${key}`);
@@ -11961,10 +12000,10 @@ var SOMA_AGGREGATE_FNS = ["sum", "avg", "min", "max", "count"];
11961
12000
  var SOMA_SELECT_ALL_MODES = ["all", "filtered", "current_page"];
11962
12001
 
11963
12002
  // core/client/parser/duration.ts
11964
- function parseDuration(raw, where, fail2) {
11965
- const match = /^(\d+(?:\.\d+)?)(ms|s|m)$/.exec(raw.trim());
12003
+ function parseDuration(raw2, where, fail2) {
12004
+ const match = /^(\d+(?:\.\d+)?)(ms|s|m)$/.exec(raw2.trim());
11966
12005
  if (!match) {
11967
- fail2(`${where} \u7684\u65F6\u957F "${raw}" \u975E\u6CD5\u2014\u2014\u5F62\u5982 500ms / 30s / 5m\uFF08\u5355\u4F4D\u5FC5\u586B\uFF0C\u4E0D\u731C\uFF09`);
12006
+ fail2(`${where} \u7684\u65F6\u957F "${raw2}" \u975E\u6CD5\u2014\u2014\u5F62\u5982 500ms / 30s / 5m\uFF08\u5355\u4F4D\u5FC5\u586B\uFF0C\u4E0D\u731C\uFF09`);
11968
12007
  }
11969
12008
  const value = Number(match[1]);
11970
12009
  const unit = match[2];
@@ -11991,10 +12030,10 @@ function isPlainObject4(value) {
11991
12030
  return value !== null && typeof value === "object" && !Array.isArray(value);
11992
12031
  }
11993
12032
  function parseWindow(input, deps) {
11994
- const { raw, fields, path } = input;
12033
+ const { raw: raw2, fields, path } = input;
11995
12034
  const fail2 = deps.fail;
11996
- if (!isPlainObject4(raw)) fail2("window \u5FC5\u987B\u662F\u6620\u5C04", path);
11997
- const section = raw;
12035
+ if (!isPlainObject4(raw2)) fail2("window \u5FC5\u987B\u662F\u6620\u5C04", path);
12036
+ const section = raw2;
11998
12037
  for (const key of Object.keys(section)) {
11999
12038
  if (!CONFIG_KEYS3.has(key)) {
12000
12039
  fail2(`\u672A\u77E5\u7684 window \u5B57\u6BB5 "${key}"\uFF08\u652F\u6301: ${[...CONFIG_KEYS3].join(" / ")}\uFF09`, `${path}.${key}`);
@@ -12128,11 +12167,11 @@ function parseWindow(input, deps) {
12128
12167
  if (section.block !== void 0) {
12129
12168
  const at = `${path}.block`;
12130
12169
  if (!isPlainObject4(section.block)) fail2(`${at} \u5FC5\u987B\u662F\u6620\u5C04`, at);
12131
- const positive = (raw2, key, fallback) => {
12132
- if (raw2 === void 0) return fallback;
12133
- const value = Number(raw2);
12170
+ const positive = (raw22, key, fallback) => {
12171
+ if (raw22 === void 0) return fallback;
12172
+ const value = Number(raw22);
12134
12173
  if (!Number.isInteger(value) || value <= 0) {
12135
- fail2(`${at}.${key} \u5FC5\u987B\u662F\u6B63\u6574\u6570\uFF08\u6536\u5230 ${JSON.stringify(raw2)}\uFF09`, `${at}.${key}`);
12174
+ fail2(`${at}.${key} \u5FC5\u987B\u662F\u6B63\u6574\u6570\uFF08\u6536\u5230 ${JSON.stringify(raw22)}\uFF09`, `${at}.${key}`);
12136
12175
  }
12137
12176
  return value;
12138
12177
  };
@@ -12255,10 +12294,10 @@ function validateParamRefs(value, path, objectNames, selfName, deps) {
12255
12294
  }
12256
12295
  }
12257
12296
  }
12258
- function parseSource(raw, path, objectNames, selfName, deps) {
12259
- assertPlainObject2(raw, "\u53D6\u6570\u6765\u6E90", path);
12297
+ function parseSource(raw2, path, objectNames, selfName, deps) {
12298
+ assertPlainObject2(raw2, "\u53D6\u6570\u6765\u6E90", path);
12260
12299
  const source = { api: "" };
12261
- for (const [key, value] of Object.entries(raw)) {
12300
+ for (const [key, value] of Object.entries(raw2)) {
12262
12301
  if (key === "api") {
12263
12302
  if (typeof value !== "string" || !value.trim()) {
12264
12303
  throw new SomaDataConfigError(`api \u5FC5\u987B\u662F\u975E\u7A7A\u5B57\u7B26\u4E32`, `${path}.api`);
@@ -12285,10 +12324,10 @@ function parseSource(raw, path, objectNames, selfName, deps) {
12285
12324
  }
12286
12325
  return source;
12287
12326
  }
12288
- function parseTransform(raw, path) {
12289
- assertPlainObject2(raw, "transform", path);
12327
+ function parseTransform(raw2, path) {
12328
+ assertPlainObject2(raw2, "transform", path);
12290
12329
  const result = {};
12291
- for (const [key, value] of Object.entries(raw)) {
12330
+ for (const [key, value] of Object.entries(raw2)) {
12292
12331
  if (typeof value !== "string" || !value.trim()) {
12293
12332
  throw new SomaDataConfigError(
12294
12333
  `\u6D3E\u751F\u5B57\u6BB5\u7684\u503C\u5FC5\u987B\u662F "\u5B57\u6BB5\u8DEF\u5F84 | \u7BA1\u9053\u94FE" \u5B57\u7B26\u4E32\uFF0C\u5F53\u524D\u503C: ${JSON.stringify(value)}`,
@@ -12310,11 +12349,11 @@ function parseTransform(raw, path) {
12310
12349
  }
12311
12350
  return result;
12312
12351
  }
12313
- function parseRule(raw, path) {
12314
- assertPlainObject2(raw, "\u6821\u9A8C\u89C4\u5219", path);
12315
- const keys = Object.keys(raw);
12352
+ function parseRule(raw2, path) {
12353
+ assertPlainObject2(raw2, "\u6821\u9A8C\u89C4\u5219", path);
12354
+ const keys = Object.keys(raw2);
12316
12355
  const ruleKeys = keys.filter((key) => key !== "message");
12317
- if (typeof raw.message !== "string" || !raw.message) {
12356
+ if (typeof raw2.message !== "string" || !raw2.message) {
12318
12357
  throw new SomaDataConfigError(`\u6BCF\u6761\u89C4\u5219\u5FC5\u987B\u643A\u5E26 message \u63D0\u793A\u6587\u6848`, `${path}.message`);
12319
12358
  }
12320
12359
  if (ruleKeys.length !== 1) {
@@ -12331,20 +12370,20 @@ function parseRule(raw, path) {
12331
12370
  `${path}.${ruleKey}`
12332
12371
  );
12333
12372
  }
12334
- const ruleValue = raw[ruleKey];
12373
+ const ruleValue = raw2[ruleKey];
12335
12374
  if (typeof ruleValue !== expected) {
12336
12375
  throw new SomaDataConfigError(
12337
12376
  `\u89C4\u5219 ${ruleKey} \u7684\u503C\u5FC5\u987B\u662F ${expected}\uFF0C\u5F53\u524D\u503C: ${JSON.stringify(ruleValue)}`,
12338
12377
  `${path}.${ruleKey}`
12339
12378
  );
12340
12379
  }
12341
- return { [ruleKey]: ruleValue, message: raw.message };
12380
+ return { [ruleKey]: ruleValue, message: raw2.message };
12342
12381
  }
12343
- function parseOptions(raw, path) {
12344
- if (!Array.isArray(raw)) {
12382
+ function parseOptions(raw2, path) {
12383
+ if (!Array.isArray(raw2)) {
12345
12384
  throw new SomaDataConfigError(`options \u5FC5\u987B\u662F\u6570\u7EC4\uFF08{ key, label } \u5217\u8868\uFF09`, path);
12346
12385
  }
12347
- return raw.map((item, index) => {
12386
+ return raw2.map((item, index) => {
12348
12387
  const itemPath = `${path}[${index}]`;
12349
12388
  assertPlainObject2(item, "\u679A\u4E3E\u5019\u9009\u9879", itemPath);
12350
12389
  if (item.key === void 0 || item.key === null || item.key === "") {
@@ -12357,10 +12396,10 @@ function parseOptions(raw, path) {
12357
12396
  return option;
12358
12397
  });
12359
12398
  }
12360
- function parseField(raw, path) {
12361
- assertPlainObject2(raw, "\u5B57\u6BB5\u5B57\u5178\u6761\u76EE", path);
12399
+ function parseField(raw2, path) {
12400
+ assertPlainObject2(raw2, "\u5B57\u6BB5\u5B57\u5178\u6761\u76EE", path);
12362
12401
  const field = {};
12363
- for (const [key, value] of Object.entries(raw)) {
12402
+ for (const [key, value] of Object.entries(raw2)) {
12364
12403
  if (key === "name") {
12365
12404
  if (typeof value !== "string") {
12366
12405
  throw new SomaDataConfigError(`name \u5FC5\u987B\u662F\u5B57\u7B26\u4E32`, `${path}.name`);
@@ -12479,10 +12518,10 @@ function validateDerivedFields(fields, path) {
12479
12518
  for (const key of derived) walk(key);
12480
12519
  }
12481
12520
  var WRITE_METHODS = /* @__PURE__ */ new Set(["POST", "PUT", "PATCH"]);
12482
- function parseWrite(raw, fields, path, objectNames) {
12483
- assertPlainObject2(raw, "write", path);
12521
+ function parseWrite(raw2, fields, path, objectNames) {
12522
+ assertPlainObject2(raw2, "write", path);
12484
12523
  const write = {};
12485
- for (const [key, value] of Object.entries(raw)) {
12524
+ for (const [key, value] of Object.entries(raw2)) {
12486
12525
  if (key === "create" || key === "update") {
12487
12526
  write[key] = parseWriteEndpoint(value, `${path}.${key}`);
12488
12527
  } else if (key === "version") {
@@ -12565,10 +12604,10 @@ function parseWrite(raw, fields, path, objectNames) {
12565
12604
  }
12566
12605
  return write;
12567
12606
  }
12568
- function parseWriteEndpoint(raw, path) {
12569
- assertPlainObject2(raw, "\u5199\u7AEF\u70B9", path);
12570
- const api = raw.api;
12571
- const method = raw.method ?? "POST";
12607
+ function parseWriteEndpoint(raw2, path) {
12608
+ assertPlainObject2(raw2, "\u5199\u7AEF\u70B9", path);
12609
+ const api = raw2.api;
12610
+ const method = raw2.method ?? "POST";
12572
12611
  if (typeof api !== "string" || !api.trim()) {
12573
12612
  throw new SomaDataConfigError("\u5199\u7AEF\u70B9\u7F3A\u5C11 api\uFF08\u540E\u7AEF\u63A5\u53E3\u662F\u552F\u4E00\u6570\u636E\u8FB9\u754C\uFF09", `${path}.api`);
12574
12613
  }
@@ -12578,25 +12617,25 @@ function parseWriteEndpoint(raw, path) {
12578
12617
  `${path}.method`
12579
12618
  );
12580
12619
  }
12581
- for (const key of Object.keys(raw)) {
12620
+ for (const key of Object.keys(raw2)) {
12582
12621
  if (key !== "api" && key !== "method") {
12583
12622
  throw new SomaDataConfigError(`\u672A\u77E5\u7684\u5199\u7AEF\u70B9\u5B57\u6BB5 "${key}"\uFF08\u652F\u6301: api / method\uFF09`, `${path}.${key}`);
12584
12623
  }
12585
12624
  }
12586
12625
  return { api, method };
12587
12626
  }
12588
- function parseObject(name, raw, path, objectNames) {
12627
+ function parseObject(name, raw2, path, objectNames) {
12589
12628
  if (!IDENTIFIER_PATTERN.test(name)) {
12590
12629
  throw new SomaDataConfigError(`\u5BF9\u8C61\u540D "${name}" \u4E0D\u5408\u6CD5\uFF08\u5B57\u6BCD/\u4E0B\u5212\u7EBF\u5F00\u5934\u7684\u6807\u8BC6\u7B26\uFF09`, path);
12591
12630
  }
12592
- assertPlainObject2(raw, "\u6570\u636E\u5BF9\u8C61\u58F0\u660E", path);
12631
+ assertPlainObject2(raw2, "\u6570\u636E\u5BF9\u8C61\u58F0\u660E", path);
12593
12632
  const deps = /* @__PURE__ */ new Set();
12594
12633
  const config = { name, from: [], deps: [] };
12595
12634
  let writeRaw;
12596
12635
  let predicatesRaw;
12597
12636
  let reactionsRaw;
12598
12637
  let windowRaw;
12599
- for (const [key, value] of Object.entries(raw)) {
12638
+ for (const [key, value] of Object.entries(raw2)) {
12600
12639
  if (key === "from") {
12601
12640
  if (!Array.isArray(value) || value.length === 0) {
12602
12641
  throw new SomaDataConfigError(`from \u5FC5\u987B\u662F\u975E\u7A7A\u6570\u7EC4\uFF08\u53D6\u6570\u6765\u6E90\u5217\u8868\uFF09`, `${path}.from`);
@@ -12681,12 +12720,12 @@ function parseObject(name, raw, path, objectNames) {
12681
12720
  config.deps = [...deps];
12682
12721
  return config;
12683
12722
  }
12684
- function parseDataConfig(raw) {
12685
- if (raw === null || raw === void 0) {
12723
+ function parseDataConfig(raw2) {
12724
+ if (raw2 === null || raw2 === void 0) {
12686
12725
  return { objects: {} };
12687
12726
  }
12688
- assertPlainObject2(raw, "\u6570\u636E\u5BF9\u8C61\u914D\u7F6E", "");
12689
- const dataRaw = raw.data;
12727
+ assertPlainObject2(raw2, "\u6570\u636E\u5BF9\u8C61\u914D\u7F6E", "");
12728
+ const dataRaw = raw2.data;
12690
12729
  if (dataRaw === void 0 || dataRaw === null) {
12691
12730
  return { objects: {} };
12692
12731
  }
@@ -12795,19 +12834,19 @@ function createWindow(spec, deps) {
12795
12834
  loading = true;
12796
12835
  notify();
12797
12836
  try {
12798
- const raw = await deps.http.get(deps.api, {
12837
+ const raw2 = await deps.http.get(deps.api, {
12799
12838
  // 请求体作为一个 JSON 串下发:GET 的载荷位只有 query,而窗口意图是结构化的。
12800
12839
  // 拆成十几个扁平 query 参数的话,`filter` 的递归结构在 URL 里就没法表达了。
12801
12840
  params: { window: JSON.stringify(request) }
12802
12841
  });
12803
12842
  if (destroyed || token !== generation) return;
12804
- const rows = Array.isArray(raw?.rows) ? raw.rows : [];
12843
+ const rows = Array.isArray(raw2?.rows) ? raw2.rows : [];
12805
12844
  for (let index = fromBlock; index <= toBlock; index += 1) {
12806
12845
  const offset = (index - fromBlock) * spec.block.size;
12807
12846
  const slice = rows.slice(offset, offset + spec.block.size);
12808
12847
  if (slice.length > 0) blocks.set(index, { rows: slice, at: now2(), fetchedAt: now2() });
12809
12848
  }
12810
- if (typeof raw?.total === "number") total = raw.total;
12849
+ if (typeof raw2?.total === "number") total = raw2.total;
12811
12850
  else if (rows.length < to - from) total = from + rows.length;
12812
12851
  error = "";
12813
12852
  evictIfNeeded();
@@ -13482,17 +13521,17 @@ var SomaDataObjectResolver = class {
13482
13521
  resolveParams(params, selfName, selfValue) {
13483
13522
  if (!params) return void 0;
13484
13523
  const resolved = {};
13485
- for (const [key, raw] of Object.entries(params)) {
13486
- const value = this.resolveParamValue(raw, selfName, selfValue);
13524
+ for (const [key, raw2] of Object.entries(params)) {
13525
+ const value = this.resolveParamValue(raw2, selfName, selfValue);
13487
13526
  if (value === void 0 || value === null) continue;
13488
13527
  resolved[key] = typeof value === "object" ? JSON.stringify(value) : String(value);
13489
13528
  }
13490
13529
  return Object.keys(resolved).length > 0 ? resolved : void 0;
13491
13530
  }
13492
- resolveParamValue(raw, selfName, selfValue) {
13493
- if (typeof raw === "string" && raw.startsWith("$")) {
13494
- const ref = parseDataRef(raw);
13495
- if (!ref) return raw;
13531
+ resolveParamValue(raw2, selfName, selfValue) {
13532
+ if (typeof raw2 === "string" && raw2.startsWith("$")) {
13533
+ const ref = parseDataRef(raw2);
13534
+ if (!ref) return raw2;
13496
13535
  if (ref.source === "query") {
13497
13536
  return this.readQuery(ref.path.join("."));
13498
13537
  }
@@ -13502,17 +13541,17 @@ var SomaDataObjectResolver = class {
13502
13541
  const target = ref.object === selfName ? selfValue : this.objects[ref.object];
13503
13542
  return readPath2(target, ref.path);
13504
13543
  }
13505
- if (Array.isArray(raw)) {
13506
- return raw.map((item) => this.resolveParamValue(item, selfName, selfValue));
13544
+ if (Array.isArray(raw2)) {
13545
+ return raw2.map((item) => this.resolveParamValue(item, selfName, selfValue));
13507
13546
  }
13508
- if (isPlainObject5(raw)) {
13547
+ if (isPlainObject5(raw2)) {
13509
13548
  const result = {};
13510
- for (const [key, item] of Object.entries(raw)) {
13549
+ for (const [key, item] of Object.entries(raw2)) {
13511
13550
  result[key] = this.resolveParamValue(item, selfName, selfValue);
13512
13551
  }
13513
13552
  return result;
13514
13553
  }
13515
- return raw;
13554
+ return raw2;
13516
13555
  }
13517
13556
  readQuery(key) {
13518
13557
  if (typeof this.queryOption === "function") {
@@ -14598,9 +14637,9 @@ function collectPagePropsDecls(show, into = /* @__PURE__ */ new Map()) {
14598
14637
  }
14599
14638
  function collectBindingPaths(value, resolver, into) {
14600
14639
  if (typeof value === "string") {
14601
- const raw = value.startsWith("!") ? value.slice(1) : value;
14602
- if (resolver.hasVar(raw.split(".")[0])) {
14603
- into.add(raw);
14640
+ const raw2 = value.startsWith("!") ? value.slice(1) : value;
14641
+ if (resolver.hasVar(raw2.split(".")[0])) {
14642
+ into.add(raw2);
14604
14643
  }
14605
14644
  return;
14606
14645
  }
@@ -15052,8 +15091,8 @@ function oklchToHex(color) {
15052
15091
  return `#${rgb.map((v) => to255(v).toString(16).padStart(2, "0")).join("")}`;
15053
15092
  }
15054
15093
  function parseHex(hex) {
15055
- const raw = hex.trim().replace(/^#/, "");
15056
- const full = raw.length === 3 ? raw.split("").map((ch) => ch + ch).join("") : raw;
15094
+ const raw2 = hex.trim().replace(/^#/, "");
15095
+ const full = raw2.length === 3 ? raw2.split("").map((ch) => ch + ch).join("") : raw2;
15057
15096
  if (!/^[0-9a-fA-F]{6}$/.test(full)) {
15058
15097
  throw new Error(`[SomaTheme] \u975E\u6CD5\u989C\u8272\u503C: "${hex}"\uFF08\u9700 #rgb \u6216 #rrggbb\uFF09`);
15059
15098
  }
@@ -16071,9 +16110,9 @@ var SomaBootstrap = class {
16071
16110
  this.setupComponentManager(this.container, merged, parsed.uiConfig);
16072
16111
  if (overrides.DomainClass) {
16073
16112
  this.proxy?.dispose();
16074
- const raw = this.createDomainInstance(merged.DomainClass, parsed, merged.routerPath);
16113
+ const raw2 = this.createDomainInstance(merged.DomainClass, parsed, merged.routerPath);
16075
16114
  this.proxy = new SomaReactiveProxy(void 0, this.diagnostics);
16076
- this.domainInstance = this.proxy.wrap(raw);
16115
+ this.domainInstance = this.proxy.wrap(raw2);
16077
16116
  } else {
16078
16117
  if (!options?.preserveState || overrides.localeYaml !== void 0) {
16079
16118
  this.domainInstance._locale = parsed.locale;
@@ -16234,26 +16273,26 @@ var SomaBootstrap = class {
16234
16273
  this.errorReporter?.capture(error, "runtime");
16235
16274
  }
16236
16275
  createDomainInstance(DomainClass, parsed, routerPath) {
16237
- const raw = new DomainClass();
16238
- raw._locale = parsed.locale;
16276
+ const raw2 = new DomainClass();
16277
+ raw2._locale = parsed.locale;
16239
16278
  if (parsed.appConfig) {
16240
- raw._config = parsed.appConfig;
16279
+ raw2._config = parsed.appConfig;
16241
16280
  }
16242
- applyLocaleMetadata(raw);
16243
- raw._services = createDefaultRuntimeServices({
16281
+ applyLocaleMetadata(raw2);
16282
+ raw2._services = createDefaultRuntimeServices({
16244
16283
  appConfig: parsed.appConfig,
16245
16284
  locale: parsed.locale,
16246
16285
  initialPath: routerPath ?? getBrowserUrlPath()
16247
16286
  });
16248
- this.wireRouter(raw);
16287
+ this.wireRouter(raw2);
16249
16288
  if (parsed.uiConfig.initProps) {
16250
16289
  const preResolver = new SomaScopeResolver();
16251
- preResolver.build(parsed.uiConfig, raw);
16290
+ preResolver.build(parsed.uiConfig, raw2);
16252
16291
  for (const [path, value] of Object.entries(parsed.uiConfig.initProps)) {
16253
16292
  preResolver.writeToRoot(path, value);
16254
16293
  }
16255
16294
  }
16256
- return raw;
16295
+ return raw2;
16257
16296
  }
16258
16297
  // ─── 数据对象层(*_data.yaml,可选件) ─────────────────────
16259
16298
  /**
@@ -16615,8 +16654,8 @@ ${featureIssues.map((issue) => ` \xB7 ${issue}`).join("\n")}`
16615
16654
  this.timerEngine.stop(this.domainInstance._services.timer);
16616
16655
  }
16617
16656
  }
16618
- wireRouter(raw) {
16619
- const services = raw._services;
16657
+ wireRouter(raw2) {
16658
+ const services = raw2._services;
16620
16659
  if (!services) return;
16621
16660
  this.routerUnsubscribe?.();
16622
16661
  this.adapter.setNavigateHandler?.((url) => {
@@ -16719,6 +16758,411 @@ function deriveBlockExample(componentName, example) {
16719
16758
  return lines.join("\n");
16720
16759
  }
16721
16760
 
16761
+ // core/shared/component/field-lines.ts
16762
+ var INDENT_UNIT = 2;
16763
+ var PROP_TYPES = /* @__PURE__ */ new Set([
16764
+ "string",
16765
+ "number",
16766
+ "boolean",
16767
+ "enum",
16768
+ "object",
16769
+ "array"
16770
+ ]);
16771
+ var SomaFieldLinesError = class extends Error {
16772
+ constructor(message, line) {
16773
+ super(`\u5B57\u6BB5\u884C\u7B2C ${line} \u884C\uFF1A${message}`);
16774
+ this.line = line;
16775
+ this.name = "SomaFieldLinesError";
16776
+ }
16777
+ };
16778
+ function tokenize2(text) {
16779
+ const roots = [];
16780
+ const stack = [];
16781
+ const lines = text.split("\n");
16782
+ let baseIndent = Infinity;
16783
+ for (const raw2 of lines) {
16784
+ if (!raw2.trim() || raw2.trimStart().startsWith("#")) continue;
16785
+ baseIndent = Math.min(baseIndent, raw2.length - raw2.trimStart().length);
16786
+ }
16787
+ if (!Number.isFinite(baseIndent)) baseIndent = 0;
16788
+ for (let i = 0; i < lines.length; i += 1) {
16789
+ const raw2 = lines[i];
16790
+ const lineNo = i + 1;
16791
+ if (!raw2.trim()) continue;
16792
+ if (raw2.trimStart().startsWith("#")) continue;
16793
+ if (raw2.includes(" ")) {
16794
+ throw new SomaFieldLinesError("\u4E0D\u80FD\u7528 Tab \u7F29\u8FDB\u2014\u2014\u7F29\u8FDB\u56FA\u5B9A\u4E24\u4E2A\u7A7A\u683C", lineNo);
16795
+ }
16796
+ const spaces = raw2.length - raw2.trimStart().length - baseIndent;
16797
+ if (spaces % INDENT_UNIT !== 0) {
16798
+ throw new SomaFieldLinesError(`\u7F29\u8FDB\u6BD4\u540C\u5757\u9996\u5C42\u591A ${spaces} \u4E2A\u7A7A\u683C\uFF0C\u4E0D\u662F ${INDENT_UNIT} \u7684\u500D\u6570`, lineNo);
16799
+ }
16800
+ const depth = spaces / INDENT_UNIT;
16801
+ const body = raw2.trim();
16802
+ const colon = body.indexOf(":");
16803
+ if (colon <= 0) {
16804
+ throw new SomaFieldLinesError(`\u7F3A\u5C11\u5192\u53F7\u2014\u2014\u5199\u6CD5\u662F\u300C\u540D: \u7C7B\u578B, \u63CF\u8FF0, \u2026\u300D\uFF0C\u5B9E\u9645\u662F "${body}"`, lineNo);
16805
+ }
16806
+ const name = body.slice(0, colon).trim();
16807
+ const rest = body.slice(colon + 1).trim();
16808
+ if (!/^[a-z][a-z0-9_]*$/.test(name)) {
16809
+ throw new SomaFieldLinesError(`\u540D\u5B57 "${name}" \u975E\u6CD5\u2014\u2014\u53EA\u5141\u8BB8 ^[a-z][a-z0-9_]*$\uFF08\u5B83\u662F\u8FD0\u884C\u65F6\u6570\u636E\u952E\uFF09`, lineNo);
16810
+ }
16811
+ const node = { line: lineNo, depth, name, rest, children: [] };
16812
+ while (stack.length > 0 && stack[stack.length - 1].depth >= depth) stack.pop();
16813
+ if (depth === 0) {
16814
+ roots.push(node);
16815
+ } else {
16816
+ const parent = stack[stack.length - 1];
16817
+ if (!parent || parent.depth !== depth - 1) {
16818
+ throw new SomaFieldLinesError("\u7F29\u8FDB\u8DF3\u7EA7\u2014\u2014\u5B50\u5B57\u6BB5\u53EA\u80FD\u6BD4\u7236\u5B57\u6BB5\u6DF1\u4E00\u7EA7", lineNo);
16819
+ }
16820
+ parent.children.push(node);
16821
+ }
16822
+ stack.push(node);
16823
+ }
16824
+ return roots;
16825
+ }
16826
+ function parseValue(raw2, line) {
16827
+ const text = raw2.trim();
16828
+ if (!text) return "";
16829
+ if (text === "null" || text === "~") return null;
16830
+ if (text === "true") return true;
16831
+ if (text === "false") return false;
16832
+ if (/^-?\d+(\.\d+)?$/.test(text)) return Number(text);
16833
+ if (text.startsWith('"') && text.endsWith('"') && text.length >= 2 || text.startsWith("'") && text.endsWith("'") && text.length >= 2) {
16834
+ return text.slice(1, -1);
16835
+ }
16836
+ if (text.startsWith("[") && text.endsWith("]")) {
16837
+ const inner = text.slice(1, -1).trim();
16838
+ if (!inner) return [];
16839
+ return splitFlow(inner, line).map((item) => parseValue(item, line));
16840
+ }
16841
+ if (text.startsWith("{") && text.endsWith("}")) {
16842
+ const inner = text.slice(1, -1).trim();
16843
+ if (!inner) return {};
16844
+ const out = {};
16845
+ for (const pair of splitFlow(inner, line)) {
16846
+ const colon = pair.indexOf(":");
16847
+ if (colon <= 0) throw new SomaFieldLinesError(`\u6D41\u5F0F\u5BF9\u8C61\u91CC\u7684 "${pair}" \u7F3A\u5C11\u5192\u53F7`, line);
16848
+ out[unquote(pair.slice(0, colon).trim())] = parseValue(pair.slice(colon + 1), line);
16849
+ }
16850
+ return out;
16851
+ }
16852
+ return text;
16853
+ }
16854
+ function unquote(key) {
16855
+ if (key.length >= 2 && (key.startsWith('"') && key.endsWith('"') || key.startsWith("'") && key.endsWith("'"))) {
16856
+ return key.slice(1, -1);
16857
+ }
16858
+ return key;
16859
+ }
16860
+ function splitFlow(inner, line) {
16861
+ const parts = [];
16862
+ let depth = 0;
16863
+ let quote = null;
16864
+ let start = 0;
16865
+ for (let i = 0; i < inner.length; i += 1) {
16866
+ const ch = inner[i];
16867
+ if (quote) {
16868
+ if (ch === quote) quote = null;
16869
+ continue;
16870
+ }
16871
+ if (ch === '"' || ch === "'") {
16872
+ quote = ch;
16873
+ continue;
16874
+ }
16875
+ if (ch === "[" || ch === "{") depth += 1;
16876
+ else if (ch === "]" || ch === "}") depth -= 1;
16877
+ else if (ch === "," && depth === 0) {
16878
+ parts.push(inner.slice(start, i).trim());
16879
+ start = i + 1;
16880
+ }
16881
+ }
16882
+ if (depth !== 0) throw new SomaFieldLinesError(`\u6D41\u5F0F\u96C6\u5408\u62EC\u53F7\u4E0D\u914D\u5BF9\uFF1A"${inner}"`, line);
16883
+ parts.push(inner.slice(start).trim());
16884
+ return parts.filter((part) => part.length > 0);
16885
+ }
16886
+ function coerce(value, type2) {
16887
+ if (type2 === "number" && typeof value === "string" && /^-?\d+(\.\d+)?$/.test(value.trim())) {
16888
+ return Number(value);
16889
+ }
16890
+ if (type2 === "boolean" && typeof value === "string") {
16891
+ if (value.trim() === "true") return true;
16892
+ if (value.trim() === "false") return false;
16893
+ }
16894
+ if (type2 === "array" && !Array.isArray(value) && value !== void 0 && value !== "") {
16895
+ return [value];
16896
+ }
16897
+ return value;
16898
+ }
16899
+ function parseType(raw2, line) {
16900
+ const text = raw2.trim();
16901
+ const enumMatch = /^enum\((.*)\)$/.exec(text);
16902
+ if (enumMatch) {
16903
+ const values = enumMatch[1].split("|").map((item) => item.trim()).filter(Boolean);
16904
+ if (values.length === 0) throw new SomaFieldLinesError("enum(...) \u91CC\u4E00\u4E2A\u53D6\u503C\u90FD\u6CA1\u6709", line);
16905
+ return { type: "enum", values };
16906
+ }
16907
+ const arrayMatch = /^array(?:<(.+)>)?$/.exec(text);
16908
+ if (arrayMatch) {
16909
+ const inner = arrayMatch[1]?.trim();
16910
+ if (!inner) return { type: "array" };
16911
+ if (!PROP_TYPES.has(inner)) {
16912
+ throw new SomaFieldLinesError(
16913
+ `array<${inner}> \u7684\u5143\u7D20\u7C7B\u578B\u975E\u6CD5\u2014\u2014\u53EA\u5141\u8BB8 ${[...PROP_TYPES].join(" | ")}`,
16914
+ line
16915
+ );
16916
+ }
16917
+ return { type: "array", itemType: inner };
16918
+ }
16919
+ if (!PROP_TYPES.has(text)) {
16920
+ throw new SomaFieldLinesError(
16921
+ `\u7C7B\u578B "${text}" \u975E\u6CD5\u2014\u2014\u53EA\u5141\u8BB8 string | number | boolean | enum(a|b|c) | object | array<\u7C7B\u578B>`,
16922
+ line
16923
+ );
16924
+ }
16925
+ return { type: text };
16926
+ }
16927
+ function splitSegments(rest, line) {
16928
+ const parts = rest.split(", ");
16929
+ const exampleAt = parts.findIndex((part) => part.startsWith("\u793A\u4F8B ") || part === "\u793A\u4F8B");
16930
+ if (exampleAt < 0) return parts.map((part) => part.trim());
16931
+ const head = parts.slice(0, exampleAt).map((part) => part.trim());
16932
+ const example = parts.slice(exampleAt).join(", ").trim();
16933
+ if (example === "\u793A\u4F8B") throw new SomaFieldLinesError("\u300C\u793A\u4F8B\u300D\u540E\u9762\u6CA1\u6709\u503C", line);
16934
+ return [...head, example];
16935
+ }
16936
+ function buildField(node, isProp) {
16937
+ const segments = splitSegments(node.rest, node.line);
16938
+ if (segments.length === 0 || !segments[0]) {
16939
+ throw new SomaFieldLinesError(`\u5B57\u6BB5 "${node.name}" \u6CA1\u6709\u7C7B\u578B`, node.line);
16940
+ }
16941
+ const parsedType = parseType(segments[0], node.line);
16942
+ const field = { type: parsedType.type };
16943
+ if (parsedType.values) field.values = parsedType.values;
16944
+ if (segments.length >= 2 && segments[1] && !isModifier(segments[1])) {
16945
+ field.desc = segments[1];
16946
+ }
16947
+ const modifiers = segments.slice(field.desc === void 0 ? 1 : 2);
16948
+ for (const modifier of modifiers) {
16949
+ if (!modifier) continue;
16950
+ if (modifier === "\u5FC5\u586B") {
16951
+ field.required = true;
16952
+ } else if (modifier === "\u53CC\u5411") {
16953
+ if (!isProp) throw new SomaFieldLinesError("\u300C\u53CC\u5411\u300D\u53EA\u80FD\u5199\u5728 prop \u4E00\u5C42", node.line);
16954
+ field.mode = "model";
16955
+ } else if (modifier.startsWith("\u9ED8\u8BA4 ")) {
16956
+ field.default = coerce(parseValue(modifier.slice("\u9ED8\u8BA4 ".length), node.line), field.type);
16957
+ } else if (modifier.startsWith("\u793A\u4F8B ")) {
16958
+ field.example = coerce(parseValue(modifier.slice("\u793A\u4F8B ".length), node.line), field.type);
16959
+ } else {
16960
+ throw new SomaFieldLinesError(
16961
+ `\u4FEE\u9970 "${modifier}" \u4E0D\u8BA4\u8BC6\u2014\u2014\u53EA\u6709 \u5FC5\u586B / \u9ED8\u8BA4 x / \u793A\u4F8B y / \u53CC\u5411\uFF08\u63CF\u8FF0\u91CC\u82E5\u8981\u5199\u9017\u53F7\u8BF7\u7528\u5168\u89D2\u300C\uFF0C\u300D\uFF09`,
16962
+ node.line
16963
+ );
16964
+ }
16965
+ }
16966
+ if (field.required === true && field.default !== void 0) {
16967
+ throw new SomaFieldLinesError(`\u5B57\u6BB5 "${node.name}" \u540C\u65F6\u5199\u4E86 \u5FC5\u586B \u4E0E \u9ED8\u8BA4\u2014\u2014\u4E8C\u9009\u4E00`, node.line);
16968
+ }
16969
+ if (field.type === "object") {
16970
+ if (node.children.length > 0) {
16971
+ field.fields = buildFieldMap(node.children, false);
16972
+ }
16973
+ } else if (field.type === "array") {
16974
+ const itemType = parsedType.itemType;
16975
+ if (node.children.length > 0) {
16976
+ if (itemType !== void 0 && itemType !== "object") {
16977
+ throw new SomaFieldLinesError(
16978
+ `array<${itemType}> \u662F\u6807\u91CF\u6570\u7EC4\uFF0C\u4E0D\u8BE5\u6709\u4E0B\u4E00\u7EA7\u5B57\u6BB5\u2014\u2014\u8981\u5199\u5143\u7D20\u5B57\u6BB5\u8BF7\u7528 array<object>`,
16979
+ node.line
16980
+ );
16981
+ }
16982
+ field.items = { type: "object", fields: buildFieldMap(node.children, false) };
16983
+ } else if (itemType) {
16984
+ field.items = { type: itemType };
16985
+ }
16986
+ } else if (node.children.length > 0) {
16987
+ throw new SomaFieldLinesError(
16988
+ `\u5B57\u6BB5 "${node.name}" \u662F ${field.type}\uFF0C\u4E0D\u80FD\u6709\u4E0B\u4E00\u7EA7\u2014\u2014\u53EA\u6709 object \u4E0E array<object> \u53EF\u4EE5\u4E0B\u94BB`,
16989
+ node.line
16990
+ );
16991
+ }
16992
+ return field;
16993
+ }
16994
+ function isModifier(segment) {
16995
+ return segment === "\u5FC5\u586B" || segment === "\u53CC\u5411" || segment.startsWith("\u9ED8\u8BA4 ") || segment.startsWith("\u793A\u4F8B ");
16996
+ }
16997
+ function buildFieldMap(nodes, isProp) {
16998
+ const out = {};
16999
+ for (const node of nodes) {
17000
+ if (out[node.name]) throw new SomaFieldLinesError(`\u5B57\u6BB5 "${node.name}" \u91CD\u590D`, node.line);
17001
+ out[node.name] = buildField(node, isProp);
17002
+ }
17003
+ return out;
17004
+ }
17005
+ function parseFieldLines(text) {
17006
+ return buildFieldMap(tokenize2(text), true);
17007
+ }
17008
+ function parseEmitLines(text) {
17009
+ const out = {};
17010
+ for (const node of tokenize2(text)) {
17011
+ if (out[node.name]) throw new SomaFieldLinesError(`\u4E8B\u4EF6 "${node.name}" \u91CD\u590D`, node.line);
17012
+ const emit = {};
17013
+ if (node.rest) emit.desc = node.rest;
17014
+ if (node.children.length > 0) {
17015
+ emit.payload = {};
17016
+ for (const child of node.children) {
17017
+ const segments = splitSegments(child.rest, child.line);
17018
+ if (!segments[0]) throw new SomaFieldLinesError(`\u8F7D\u8377 "${child.name}" \u6CA1\u6709\u7C7B\u578B`, child.line);
17019
+ const parsed = parseType(segments[0], child.line);
17020
+ emit.payload[child.name] = {
17021
+ type: parsed.type,
17022
+ ...segments[1] && !isModifier(segments[1]) ? { desc: segments[1] } : {}
17023
+ };
17024
+ }
17025
+ }
17026
+ out[node.name] = emit;
17027
+ }
17028
+ return out;
17029
+ }
17030
+ function parseSlotLines(text) {
17031
+ const out = {};
17032
+ for (const node of tokenize2(text)) {
17033
+ if (out[node.name]) throw new SomaFieldLinesError(`\u63D2\u69FD "${node.name}" \u91CD\u590D`, node.line);
17034
+ if (node.children.length > 0) {
17035
+ throw new SomaFieldLinesError(`\u63D2\u69FD "${node.name}" \u4E0D\u80FD\u6709\u4E0B\u4E00\u7EA7`, node.line);
17036
+ }
17037
+ const segments = node.rest.split(", ").map((part) => part.trim()).filter(Boolean);
17038
+ const slot = {};
17039
+ const desc = segments.filter((part) => part !== "\u5FC5\u586B").join("\uFF0C");
17040
+ if (desc) slot.desc = desc;
17041
+ if (segments.includes("\u5FC5\u586B")) slot.required = true;
17042
+ out[node.name] = slot;
17043
+ }
17044
+ return out;
17045
+ }
17046
+ function renderValue(value) {
17047
+ if (value === null) return "null";
17048
+ if (typeof value === "string") return value === "" ? '""' : value;
17049
+ if (Array.isArray(value)) return `[${value.map(renderValue).join(", ")}]`;
17050
+ if (typeof value === "object") {
17051
+ const entries = Object.entries(value);
17052
+ if (entries.length === 0) return "{}";
17053
+ return `{ ${entries.map(([key, item]) => `${key}: ${renderValue(item)}`).join(", ")} }`;
17054
+ }
17055
+ return String(value);
17056
+ }
17057
+ function renderTypeLabel(field) {
17058
+ if (field.type === "enum") return `enum(${(field.values ?? []).join("|")})`;
17059
+ if (field.type === "array") {
17060
+ const itemType = field.items?.type;
17061
+ return itemType ? `array<${itemType}>` : "array";
17062
+ }
17063
+ return field.type;
17064
+ }
17065
+ function renderFieldNode(name, field, depth, out) {
17066
+ const segments = [renderTypeLabel(field)];
17067
+ if (field.desc) segments.push(field.desc);
17068
+ if (field.required === true) segments.push("\u5FC5\u586B");
17069
+ else if (field.default !== void 0) segments.push(`\u9ED8\u8BA4 ${renderValue(field.default)}`);
17070
+ if (field.example !== void 0) segments.push(`\u793A\u4F8B ${renderValue(field.example)}`);
17071
+ if (field.mode === "model") segments.push("\u53CC\u5411");
17072
+ out.push(`${" ".repeat(depth * INDENT_UNIT)}${name}: ${segments.join(", ")}`);
17073
+ const children = field.type === "array" ? field.items?.fields : field.fields;
17074
+ for (const [childName, child] of Object.entries(children ?? {})) {
17075
+ renderFieldNode(childName, child, depth + 1, out);
17076
+ }
17077
+ }
17078
+ function renderFieldLines(fields) {
17079
+ const out = [];
17080
+ for (const [name, field] of Object.entries(fields ?? {})) {
17081
+ renderFieldNode(name, field, 0, out);
17082
+ }
17083
+ return out.join("\n");
17084
+ }
17085
+ function raw(strings, values) {
17086
+ return strings.reduce((acc, part, i) => acc + part + (i < values.length ? String(values[i]) : ""), "");
17087
+ }
17088
+ var PARSE_CACHE = /* @__PURE__ */ new WeakMap();
17089
+ function cached(strings, values, parse) {
17090
+ if (values.length > 0) return parse(raw(strings, values));
17091
+ const hit = PARSE_CACHE.get(strings);
17092
+ if (hit !== void 0) return hit;
17093
+ const parsed = parse(raw(strings, values));
17094
+ PARSE_CACHE.set(strings, parsed);
17095
+ return parsed;
17096
+ }
17097
+ function somaFields(strings, ...values) {
17098
+ return cached(strings, values, parseFieldLines);
17099
+ }
17100
+ function somaEmits(strings, ...values) {
17101
+ return cached(strings, values, parseEmitLines);
17102
+ }
17103
+ function somaSlots(strings, ...values) {
17104
+ return cached(strings, values, parseSlotLines);
17105
+ }
17106
+
17107
+ // core/shared/component/derive-sample.ts
17108
+ function deriveField(field, path, gaps) {
17109
+ if (field.example !== void 0) return clone(field.example);
17110
+ if (field.type === "object") {
17111
+ const fields = field.fields;
17112
+ if (fields && Object.keys(fields).length > 0) {
17113
+ const out = {};
17114
+ for (const [name, child] of Object.entries(fields)) {
17115
+ const value = deriveField(child, `${path}.${name}`, gaps);
17116
+ if (value !== void 0) out[name] = value;
17117
+ }
17118
+ return out;
17119
+ }
17120
+ }
17121
+ if (field.type === "array") {
17122
+ const items = field.items;
17123
+ if (items) {
17124
+ const element = deriveField(items, `${path}[]`, gaps);
17125
+ if (element !== void 0) return [element];
17126
+ }
17127
+ }
17128
+ if (field.default !== void 0) return clone(field.default);
17129
+ if (field.type === "enum" && field.values && field.values.length > 0) {
17130
+ return field.values[0];
17131
+ }
17132
+ if (field.required === true) {
17133
+ gaps.push({
17134
+ path,
17135
+ reason: "\u5FC5\u586B\u5B57\u6BB5\u65E2\u6CA1\u6709 \u793A\u4F8B \u4E5F\u6CA1\u6709 \u9ED8\u8BA4\u2014\u2014\u6837\u5F20\u6E32\u67D3\u4E0D\u51FA\u8FD9\u4E00\u683C"
17136
+ });
17137
+ }
17138
+ return void 0;
17139
+ }
17140
+ function clone(value) {
17141
+ if (value === null || typeof value !== "object") return value;
17142
+ return JSON.parse(JSON.stringify(value));
17143
+ }
17144
+ function deriveContractSample(contract) {
17145
+ const gaps = [];
17146
+ const props = {};
17147
+ for (const [name, prop] of Object.entries(contract.props ?? {})) {
17148
+ const value = deriveField(prop, name, gaps);
17149
+ if (value !== void 0) props[name] = value;
17150
+ }
17151
+ return { props, gaps };
17152
+ }
17153
+ function deriveFieldSample(field) {
17154
+ return deriveField(field, "", []);
17155
+ }
17156
+ function hasRenderableSample(contract) {
17157
+ const seen = (field) => {
17158
+ if (field.example !== void 0) return true;
17159
+ if (field.fields && Object.values(field.fields).some(seen)) return true;
17160
+ if (field.items && seen(field.items)) return true;
17161
+ return false;
17162
+ };
17163
+ return Object.values(contract.props ?? {}).some(seen);
17164
+ }
17165
+
16722
17166
  // core/client/component/keyboard-matrix.ts
16723
17167
  var SOMA_KEYBOARD_INTENTS = [
16724
17168
  "next",
@@ -16837,6 +17281,13 @@ function renderKeyboardMatrixLine(keyboard) {
16837
17281
  }
16838
17282
 
16839
17283
  // core/client/component/ai-catalog.ts
17284
+ function hasFieldSpec(contract) {
17285
+ const seen = (field) => {
17286
+ if (field.fields !== void 0 || field.items !== void 0 || field.example !== void 0) return true;
17287
+ return false;
17288
+ };
17289
+ return Object.values(contract.props ?? {}).some(seen);
17290
+ }
16840
17291
  function inferGeometryFamily(contract) {
16841
17292
  const name = contract.name;
16842
17293
  if (/^(Alert|Toast|Collapse|Accordion|ResultPanel|ValidationMessage|NotificationCenter)$/.test(name)) {
@@ -16906,7 +17357,10 @@ function buildCatalogEntry(contract) {
16906
17357
  whenNotToUse: contract.ai.when_not_to_use,
16907
17358
  example: contract.ai.example,
16908
17359
  antiPatterns: contract.ai.anti_patterns
16909
- } : void 0
17360
+ } : void 0,
17361
+ // 两个可选段(REQ-012):缺席时连键都不写,目录 JSON 的形状对存量消费者逐键不变
17362
+ ...hasFieldSpec(contract) ? { spec: renderFieldLines(contract.props ?? {}) } : {},
17363
+ ...hasRenderableSample(contract) ? { sample: deriveContractSample(contract).props } : {}
16910
17364
  };
16911
17365
  }
16912
17366
  function generateAiCatalog(defs, options) {
@@ -16995,6 +17449,20 @@ function renderMarkdown(entries, conventions) {
16995
17449
  lines.push(`| ${prop.name} | ${prop.type} | ${prop.required ? "\u662F" : "\u5426"} | ${dft} | ${prop.desc}${mode} |`);
16996
17450
  }
16997
17451
  }
17452
+ if (entry.spec) {
17453
+ lines.push("");
17454
+ lines.push("\u5B57\u6BB5\u5F62\u72B6\uFF08\u540D: \u7C7B\u578B, \u63CF\u8FF0, \u5FC5\u586B \u6216 \u9ED8\u8BA4 x, \u793A\u4F8B y\uFF1B\u7F29\u8FDB\u5373\u5D4C\u5957\uFF09\uFF1A");
17455
+ lines.push("```");
17456
+ lines.push(entry.spec);
17457
+ lines.push("```");
17458
+ }
17459
+ if (entry.sample) {
17460
+ lines.push("");
17461
+ lines.push("\u6837\u5F20\uFF08\u7531\u793A\u4F8B\u503C\u6D3E\u751F\uFF0C\u5C55\u793A\u9875\u4E0E\u89C6\u89C9\u77E9\u9635\u5582\u7684\u5C31\u662F\u5B83\uFF09\uFF1A");
17462
+ lines.push("```json");
17463
+ lines.push(JSON.stringify(entry.sample, null, 2));
17464
+ lines.push("```");
17465
+ }
16998
17466
  if (entry.emits.length) {
16999
17467
  lines.push("");
17000
17468
  lines.push("| emit | payload | \u8BF4\u660E |");
@@ -17482,7 +17950,7 @@ function loadSomaFile(input) {
17482
17950
  seen.add(blockId);
17483
17951
  blocks.push({ blockId, body, line, source: "inline" });
17484
17952
  }
17485
- for (const [blockId, raw] of input.externalBlocks ?? /* @__PURE__ */ new Map()) {
17953
+ for (const [blockId, raw2] of input.externalBlocks ?? /* @__PURE__ */ new Map()) {
17486
17954
  assertBlockId(blockId, input.htmlIndex, 0);
17487
17955
  if (seen.has(blockId)) {
17488
17956
  throw new SomaBlockParseError(
@@ -17492,7 +17960,7 @@ function loadSomaFile(input) {
17492
17960
  }
17493
17961
  let body;
17494
17962
  try {
17495
- body = yaml.load(raw);
17963
+ body = yaml.load(raw2);
17496
17964
  } catch (error) {
17497
17965
  throw new SomaBlockParseError(
17498
17966
  `\u5916\u7F6E\u5757 blocks/${blockId}.yaml \u89E3\u6790\u5931\u8D25: ${error.message}`,
@@ -17533,8 +18001,8 @@ function precompileUiModule(yamlStr) {
17533
18001
  parseSomaBlockContainer(yamlStr);
17534
18002
  return "null";
17535
18003
  }
17536
- function compileEventConfigFromRaw(raw) {
17537
- const { eventsRaw, triggers, timers } = splitEventConfigRaw(raw);
18004
+ function compileEventConfigFromRaw(raw2) {
18005
+ const { eventsRaw, triggers, timers } = splitEventConfigRaw(raw2);
17538
18006
  return {
17539
18007
  events: parseEventConfig(eventsRaw),
17540
18008
  triggers,
@@ -18662,8 +19130,12 @@ function verifyComponentPack(pack, options = {}) {
18662
19130
  if (Object.keys(pack.components).length === 0) {
18663
19131
  issues.push("[\u5305] \u4E00\u4E2A\u7EC4\u4EF6\u90FD\u6CA1\u6709");
18664
19132
  }
19133
+ const pending2 = new Set(options.samplePending ?? []);
18665
19134
  for (const [key, definition] of Object.entries(pack.components)) {
18666
19135
  issues.push(...verifyDefinition(key, definition));
19136
+ if (options.requireSamples !== false && !pending2.has(key)) {
19137
+ issues.push(...verifySample(key, definition));
19138
+ }
18667
19139
  }
18668
19140
  issues.push(...verifyStyleRegistration(pack));
18669
19141
  if (!options.skipStyleChecks) {
@@ -18720,6 +19192,7 @@ function verifyDefinition(key, definition) {
18720
19192
  `[\u5951\u7EA6] ${label} \u7684 prop "${propName}" default.${nestedMutablePath} \u662F\u5D4C\u5957\u53EF\u53D8\u9ED8\u8BA4\u503C\u2014\u2014\u8FD0\u884C\u65F6\u53EA\u9694\u79BB\u6700\u5916\u5C42\uFF08\u89C4\u5219 C4a\uFF09`
18721
19193
  );
18722
19194
  }
19195
+ issues.push(...verifyFieldTree(label, propName, prop));
18723
19196
  }
18724
19197
  const ai = contract.ai;
18725
19198
  if (!ai || typeof ai !== "object") {
@@ -18757,6 +19230,84 @@ function verifyDefinition(key, definition) {
18757
19230
  }
18758
19231
  return issues;
18759
19232
  }
19233
+ function verifyFieldTree(label, path, field) {
19234
+ const issues = [];
19235
+ if (!field || typeof field !== "object") return issues;
19236
+ if (field.type === "object" && field.fields === void 0 && field.example === void 0) {
19237
+ issues.push(
19238
+ `[\u5B57\u6BB5] ${label} \u7684 "${path}" \u662F object \u5374\u65E2\u6CA1\u6709 fields \u4E5F\u6CA1\u6709 example\u2014\u2014\u5BF9\u8C61\u7684\u5F62\u72B6\u5FC5\u987B\u5199\u51FA\u6765,\u5426\u5219\u5C55\u793A\u9875\u4E0E AI \u53EA\u80FD\u731C`
19239
+ );
19240
+ }
19241
+ if (field.type === "array" && field.items === void 0 && field.example === void 0) {
19242
+ issues.push(
19243
+ `[\u5B57\u6BB5] ${label} \u7684 "${path}" \u662F array \u5374\u65E2\u6CA1\u6709 items \u4E5F\u6CA1\u6709 example\u2014\u2014\u5143\u7D20\u5F62\u72B6\u5FC5\u987B\u5199\u51FA\u6765`
19244
+ );
19245
+ }
19246
+ if (field.type === "enum" && (!field.values || field.values.length === 0)) {
19247
+ issues.push(`[\u5B57\u6BB5] ${label} \u7684 "${path}" \u662F enum \u5374\u6CA1\u6709 values`);
19248
+ }
19249
+ if (field.example !== void 0) {
19250
+ const mismatch = exampleTypeMismatch(field.example, field);
19251
+ if (mismatch) issues.push(`[\u5B57\u6BB5] ${label} \u7684 "${path}" \u793A\u4F8B\u503C${mismatch}`);
19252
+ }
19253
+ if (field.required === true && field.default !== void 0) {
19254
+ issues.push(`[\u5B57\u6BB5] ${label} \u7684 "${path}" \u540C\u65F6\u662F\u5FC5\u586B\u4E0E\u6709\u9ED8\u8BA4\u503C\u2014\u2014\u4E8C\u9009\u4E00`);
19255
+ }
19256
+ for (const [name, child] of Object.entries(field.fields ?? {})) {
19257
+ issues.push(...verifyFieldTree(label, `${path}.${name}`, child));
19258
+ }
19259
+ if (field.items) {
19260
+ issues.push(...verifyFieldTree(label, `${path}[]`, field.items));
19261
+ }
19262
+ return issues;
19263
+ }
19264
+ function exampleTypeMismatch(value, field) {
19265
+ switch (field.type) {
19266
+ case "string":
19267
+ return typeof value === "string" ? null : `\u5E94\u8BE5\u662F\u5B57\u7B26\u4E32,\u5B9E\u9645\u662F ${typeName(value)}`;
19268
+ case "number":
19269
+ return typeof value === "number" ? null : `\u5E94\u8BE5\u662F\u6570\u5B57,\u5B9E\u9645\u662F ${typeName(value)}`;
19270
+ case "boolean":
19271
+ return typeof value === "boolean" ? null : `\u5E94\u8BE5\u662F\u5E03\u5C14,\u5B9E\u9645\u662F ${typeName(value)}`;
19272
+ case "array":
19273
+ return Array.isArray(value) ? null : `\u5E94\u8BE5\u662F\u6570\u7EC4,\u5B9E\u9645\u662F ${typeName(value)}`;
19274
+ case "object":
19275
+ return value !== null && typeof value === "object" && !Array.isArray(value) ? null : `\u5E94\u8BE5\u662F\u5BF9\u8C61,\u5B9E\u9645\u662F ${typeName(value)}`;
19276
+ case "enum": {
19277
+ const values = field.values ?? [];
19278
+ if (values.length === 0) return null;
19279
+ return values.includes(value) ? null : `\u4E0D\u5728\u53D6\u503C\u96C6\u5408\u91CC(${values.join(" | ")})`;
19280
+ }
19281
+ default:
19282
+ return null;
19283
+ }
19284
+ }
19285
+ function typeName(value) {
19286
+ if (value === null) return "null";
19287
+ if (Array.isArray(value)) return "\u6570\u7EC4";
19288
+ const names = {
19289
+ string: "\u5B57\u7B26\u4E32",
19290
+ number: "\u6570\u5B57",
19291
+ boolean: "\u5E03\u5C14",
19292
+ object: "\u5BF9\u8C61"
19293
+ };
19294
+ return names[typeof value] ?? typeof value;
19295
+ }
19296
+ function verifySample(key, definition) {
19297
+ const contract = definition?.contract;
19298
+ if (!contract || contract.layer !== "solution") return [];
19299
+ const issues = [];
19300
+ if (!hasRenderableSample(contract)) {
19301
+ issues.push(
19302
+ `[\u6837\u5F20] \u7EC4\u4EF6 ${key} \u7684 props \u4E00\u4E2A example \u90FD\u6CA1\u6709\u2014\u2014\u5C55\u793A\u9875\u53EA\u4F1A\u6E32\u67D3\u51FA\u4E00\u4E2A\u7A7A\u58F3,\u89C6\u89C9\u77E9\u9635\u91CF\u4E0D\u51FA\u771F\u5B9E\u9AD8\u5EA6,AI \u4E5F\u770B\u4E0D\u5230\u6570\u636E\u5F62\u72B6(REQ-012)`
19303
+ );
19304
+ return issues;
19305
+ }
19306
+ for (const gap of deriveContractSample(contract).gaps) {
19307
+ issues.push(`[\u6837\u5F20] \u7EC4\u4EF6 ${key} \u7684 "${gap.path}"\uFF1A${gap.reason}`);
19308
+ }
19309
+ return issues;
19310
+ }
18760
19311
  function verifyStyleRegistration(pack) {
18761
19312
  const issues = [];
18762
19313
  const styles = pack.styles;
@@ -18827,20 +19378,20 @@ function physicalDirections(css) {
18827
19378
 
18828
19379
  // core/client/parser/value-lang.ts
18829
19380
  var SomaValueLangError = class extends Error {
18830
- constructor(message, raw) {
18831
- super(`[soma-core][\u5F15\u64CE] ${message}\uFF08\u503C: "${raw}"\uFF09`);
18832
- this.raw = raw;
19381
+ constructor(message, raw2) {
19382
+ super(`[soma-core][\u5F15\u64CE] ${message}\uFF08\u503C: "${raw2}"\uFF09`);
19383
+ this.raw = raw2;
18833
19384
  this.name = "SomaValueLangError";
18834
19385
  }
18835
19386
  };
18836
19387
  var ARITH_HINT = /[+\-*/()]/;
18837
19388
  var FORBIDDEN = /(>=|<=|==|!=|&&|\|\||[<>?])/;
18838
19389
  var PATH_SHAPE = /^[A-Za-z_][A-Za-z0-9_]*(\.[A-Za-z0-9_]+)*$/;
18839
- function tokenize2(raw, source) {
19390
+ function tokenize3(raw2, source) {
18840
19391
  const tokens = [];
18841
19392
  let i = 0;
18842
- while (i < raw.length) {
18843
- const ch = raw[i];
19393
+ while (i < raw2.length) {
19394
+ const ch = raw2[i];
18844
19395
  if (ch === " " || ch === " ") {
18845
19396
  i += 1;
18846
19397
  continue;
@@ -18857,8 +19408,8 @@ function tokenize2(raw, source) {
18857
19408
  }
18858
19409
  if (/[0-9]/.test(ch)) {
18859
19410
  let j = i;
18860
- while (j < raw.length && /[0-9.]/.test(raw[j])) j += 1;
18861
- const text = raw.slice(i, j);
19411
+ while (j < raw2.length && /[0-9.]/.test(raw2[j])) j += 1;
19412
+ const text = raw2.slice(i, j);
18862
19413
  const value = Number(text);
18863
19414
  if (!Number.isFinite(value)) {
18864
19415
  throw new SomaValueLangError(`\u6570\u5B57\u5B57\u9762\u91CF\u975E\u6CD5: "${text}"`, source);
@@ -18869,8 +19420,8 @@ function tokenize2(raw, source) {
18869
19420
  }
18870
19421
  if (/[A-Za-z_]/.test(ch)) {
18871
19422
  let j = i;
18872
- while (j < raw.length && /[A-Za-z0-9_.]/.test(raw[j])) j += 1;
18873
- tokens.push({ t: "id", v: raw.slice(i, j) });
19423
+ while (j < raw2.length && /[A-Za-z0-9_.]/.test(raw2[j])) j += 1;
19424
+ tokens.push({ t: "id", v: raw2.slice(i, j) });
18874
19425
  i = j;
18875
19426
  continue;
18876
19427
  }
@@ -18970,35 +19521,35 @@ function isArithSegment(segment) {
18970
19521
  return ARITH_HINT.test(segment);
18971
19522
  }
18972
19523
  function parseValueSegment(segment, hasVar, position = "display", source = segment) {
18973
- const raw = segment.trim();
18974
- if (!raw) {
19524
+ const raw2 = segment.trim();
19525
+ if (!raw2) {
18975
19526
  throw new SomaValueLangError("\u503C\u6BB5\u4E3A\u7A7A", source);
18976
19527
  }
18977
- const forbidden = raw.match(FORBIDDEN);
19528
+ const forbidden = raw2.match(FORBIDDEN);
18978
19529
  if (forbidden) {
18979
19530
  throw new SomaValueLangError(
18980
19531
  `\u4E0D\u652F\u6301\u7684\u8FD0\u7B97\u7B26 "${forbidden[0]}"\u2014\u2014\u6BD4\u8F83\u4E0E\u5E03\u5C14\u8FD0\u7B97\u4E0D\u8FDB DSL\uFF0C\u5224\u65AD\u5199\u8FDB Domain\uFF08\u663E\u9690\u7528 when + ! \u524D\u7F00\uFF0C\u591A\u5206\u652F\u7528 match \u7BA1\u9053\u6216\u7EC4\u4EF6\u591A\u6001\uFF09`,
18981
19532
  source
18982
19533
  );
18983
19534
  }
18984
- if (!isArithSegment(raw)) {
18985
- if (/^-?\d+(\.\d+)?$/.test(raw)) {
18986
- return { node: { kind: "lit", value: Number(raw) }, paths: [] };
19535
+ if (!isArithSegment(raw2)) {
19536
+ if (/^-?\d+(\.\d+)?$/.test(raw2)) {
19537
+ return { node: { kind: "lit", value: Number(raw2) }, paths: [] };
18987
19538
  }
18988
- if (raw === "true" || raw === "false") {
18989
- return { node: { kind: "lit", value: raw === "true" }, paths: [] };
19539
+ if (raw2 === "true" || raw2 === "false") {
19540
+ return { node: { kind: "lit", value: raw2 === "true" }, paths: [] };
18990
19541
  }
18991
- const head = raw.split(/[.\s]/)[0];
19542
+ const head = raw2.split(/[.\s]/)[0];
18992
19543
  if (hasVar(head)) {
18993
- if (!PATH_SHAPE.test(raw)) {
19544
+ if (!PATH_SHAPE.test(raw2)) {
18994
19545
  throw new SomaValueLangError(
18995
- `\u8DEF\u5F84 "${raw}" \u542B\u975E\u6CD5\u5B57\u7B26\u2014\u2014\u8DEF\u5F84\u53EA\u5141\u8BB8\u5B57\u6BCD\u3001\u6570\u5B57\u3001\u4E0B\u5212\u7EBF\u4E0E\u70B9\uFF08\u82E5\u672C\u610F\u662F\u5B57\u9762\u91CF\u6587\u6848\uFF0C\u8BF7\u6362\u4E00\u4E2A\u4E0D\u4EE5\u4F5C\u7528\u57DF\u53D8\u91CF\u5F00\u5934\u7684\u5199\u6CD5\u6216\u52A0\u5F15\u53F7\uFF09`,
19546
+ `\u8DEF\u5F84 "${raw2}" \u542B\u975E\u6CD5\u5B57\u7B26\u2014\u2014\u8DEF\u5F84\u53EA\u5141\u8BB8\u5B57\u6BCD\u3001\u6570\u5B57\u3001\u4E0B\u5212\u7EBF\u4E0E\u70B9\uFF08\u82E5\u672C\u610F\u662F\u5B57\u9762\u91CF\u6587\u6848\uFF0C\u8BF7\u6362\u4E00\u4E2A\u4E0D\u4EE5\u4F5C\u7528\u57DF\u53D8\u91CF\u5F00\u5934\u7684\u5199\u6CD5\u6216\u52A0\u5F15\u53F7\uFF09`,
18996
19547
  source
18997
19548
  );
18998
19549
  }
18999
- return { node: { kind: "path", path: raw }, paths: [raw] };
19550
+ return { node: { kind: "path", path: raw2 }, paths: [raw2] };
19000
19551
  }
19001
- return { node: { kind: "lit", value: raw }, paths: [] };
19552
+ return { node: { kind: "lit", value: raw2 }, paths: [] };
19002
19553
  }
19003
19554
  if (position !== "display") {
19004
19555
  throw new SomaValueLangError(
@@ -19007,7 +19558,7 @@ function parseValueSegment(segment, hasVar, position = "display", source = segme
19007
19558
  );
19008
19559
  }
19009
19560
  const paths = [];
19010
- const node = new Parser(tokenize2(raw, source), source, hasVar, paths).parse();
19561
+ const node = new Parser(tokenize3(raw2, source), source, hasVar, paths).parse();
19011
19562
  return { node, paths };
19012
19563
  }
19013
19564
  function isPlainPath(node) {
@@ -19166,8 +19717,8 @@ function buildBlockScope(input) {
19166
19717
  );
19167
19718
  }
19168
19719
  }
19169
- for (const [name, raw] of Object.entries(input.aliasRaw ?? {})) {
19170
- if (typeof raw !== "string" || raw.trim() === "") {
19720
+ for (const [name, raw2] of Object.entries(input.aliasRaw ?? {})) {
19721
+ if (typeof raw2 !== "string" || raw2.trim() === "") {
19171
19722
  throw new SomaScopeError(`alias "${name}" \u7684\u503C\u5FC5\u987B\u662F\u975E\u7A7A\u5B57\u7B26\u4E32`, blockId);
19172
19723
  }
19173
19724
  if (!NAME_RE.test(name)) {
@@ -19179,7 +19730,7 @@ function buildBlockScope(input) {
19179
19730
  blockId
19180
19731
  );
19181
19732
  }
19182
- const target = raw.trim();
19733
+ const target = raw2.trim();
19183
19734
  const kind = target.startsWith("/") ? "api" : "path";
19184
19735
  if (kind === "path") {
19185
19736
  const head = target.split(".")[0];
@@ -19194,8 +19745,8 @@ function buildBlockScope(input) {
19194
19745
  }
19195
19746
  return { blockId, dataNames, aliases, rowVars, pageVar: "page" };
19196
19747
  }
19197
- function resolvePath(raw, scope) {
19198
- const text = raw.trim();
19748
+ function resolvePath(raw2, scope) {
19749
+ const text = raw2.trim();
19199
19750
  if (text === "") return { kind: "literal" };
19200
19751
  const segments = text.split(".");
19201
19752
  const head = segments[0];
@@ -19226,8 +19777,8 @@ function resolvePath(raw, scope) {
19226
19777
  if (isPage) return { kind: "page", full: text };
19227
19778
  return { kind: "literal" };
19228
19779
  }
19229
- function resolveApiRef(raw, scope) {
19230
- const text = raw.trim();
19780
+ function resolveApiRef(raw2, scope) {
19781
+ const text = raw2.trim();
19231
19782
  const alias = scope.aliases.get(text);
19232
19783
  if (alias) {
19233
19784
  if (alias.kind !== "api") {
@@ -19247,9 +19798,9 @@ function scopeHasVar(scope) {
19247
19798
  return scope.dataNames.has(segment) || scope.rowVars.has(segment) || segment === scope.pageVar;
19248
19799
  };
19249
19800
  }
19250
- function expandPath(raw, scope) {
19251
- const resolved = resolvePath(raw, scope);
19252
- return resolved.kind === "literal" ? raw.trim() : resolved.full;
19801
+ function expandPath(raw2, scope) {
19802
+ const resolved = resolvePath(raw2, scope);
19803
+ return resolved.kind === "literal" ? raw2.trim() : resolved.full;
19253
19804
  }
19254
19805
 
19255
19806
  // core/client/parser/blocks/page-parser.ts
@@ -19361,11 +19912,11 @@ function parsePageBlock(input) {
19361
19912
  scope
19362
19913
  };
19363
19914
  }
19364
- function parseShowLevel(raw, target, scope, input, where) {
19915
+ function parseShowLevel(raw2, target, scope, input, where) {
19365
19916
  const fail2 = (message) => {
19366
19917
  throw new SomaBlockParseError(message, "page");
19367
19918
  };
19368
- for (const [key, value] of Object.entries(raw)) {
19919
+ for (const [key, value] of Object.entries(raw2)) {
19369
19920
  if (key === "each") continue;
19370
19921
  const { anchor, suffix, attr } = splitKey(key);
19371
19922
  if (input.instances.has(anchor)) {
@@ -19414,10 +19965,10 @@ function parseEachBlock(block, scope, input, anchor) {
19414
19965
  const fail2 = (message) => {
19415
19966
  throw new SomaBlockParseError(message, "page");
19416
19967
  };
19417
- const raw = String(block.each);
19418
- const match = /^(\S+)\s+as\s+([A-Za-z_][A-Za-z0-9_]*)(?:\s+by\s+(\S+))?(?:\s+key\s+(\S+))?$/.exec(raw.trim());
19968
+ const raw2 = String(block.each);
19969
+ const match = /^(\S+)\s+as\s+([A-Za-z_][A-Za-z0-9_]*)(?:\s+by\s+(\S+))?(?:\s+key\s+(\S+))?$/.exec(raw2.trim());
19419
19970
  if (!match) {
19420
- fail2(`each \u8BED\u6CD5\u9519\u8BEF: "${raw}"\uFF08\u5E94\u4E3A each: \u8DEF\u5F84 as \u53D8\u91CF [by \u8DEF\u5F84] [key \u5B57\u6BB5]\uFF09`);
19971
+ fail2(`each \u8BED\u6CD5\u9519\u8BEF: "${raw2}"\uFF08\u5E94\u4E3A each: \u8DEF\u5F84 as \u53D8\u91CF [by \u8DEF\u5F84] [key \u5B57\u6BB5]\uFF09`);
19421
19972
  }
19422
19973
  const [, sourcePath, rowVar, byPath] = match;
19423
19974
  const bind = {
@@ -19475,8 +20026,8 @@ function applySuffix(target, suffix, value, scope, fail2) {
19475
20026
  }
19476
20027
  target.model = expandPath(String(value), scope);
19477
20028
  }
19478
- function expandCondition(raw, scope) {
19479
- const text = raw.trim();
20029
+ function expandCondition(raw2, scope) {
20030
+ const text = raw2.trim();
19480
20031
  const negated = text.startsWith("!");
19481
20032
  const bare = negated ? text.slice(1).trim() : text;
19482
20033
  return `${negated ? "!" : ""}${expandPath(bare, scope)}`;
@@ -19488,12 +20039,12 @@ function expandValue(value, scope, fail2) {
19488
20039
  segments[0] = expandPath(segments[0], scope);
19489
20040
  return segments.join(" | ");
19490
20041
  }
19491
- function normalizeEventSection(raw, input, fail2) {
19492
- if (raw === void 0) return {};
19493
- if (raw === null || typeof raw !== "object" || Array.isArray(raw)) {
20042
+ function normalizeEventSection(raw2, input, fail2) {
20043
+ if (raw2 === void 0) return {};
20044
+ if (raw2 === null || typeof raw2 !== "object" || Array.isArray(raw2)) {
19494
20045
  fail2("event \u6BB5\u5FC5\u987B\u662F\u6620\u5C04\uFF08\u5B50\u952E on / timers / triggers\uFF09");
19495
20046
  }
19496
- const section = raw;
20047
+ const section = raw2;
19497
20048
  for (const key of Object.keys(section)) {
19498
20049
  if (!["on", "timers", "triggers"].includes(key)) {
19499
20050
  fail2(`page \u5757\u7684 event \u6BB5\u4E0D\u652F\u6301\u5B50\u952E "${key}"\uFF08\u53EF\u7528\uFF1Aon / timers / triggers\uFF09`);
@@ -19558,15 +20109,15 @@ function parseUseBlock(input) {
19558
20109
  const { actions, emitRoutes } = parseEventSection(body.event, blockId, scope, fail2);
19559
20110
  const dataObjects = [];
19560
20111
  const dataImports = [];
19561
- for (const [localName, raw] of Object.entries(dataRaw)) {
19562
- if (typeof raw === "string") {
19563
- dataImports.push({ localName, targetPath: expandPath(raw, { ...scope, dataNames: /* @__PURE__ */ new Set() }) });
20112
+ for (const [localName, raw2] of Object.entries(dataRaw)) {
20113
+ if (typeof raw2 === "string") {
20114
+ dataImports.push({ localName, targetPath: expandPath(raw2, { ...scope, dataNames: /* @__PURE__ */ new Set() }) });
19564
20115
  continue;
19565
20116
  }
19566
- if (raw === null || typeof raw !== "object" || Array.isArray(raw)) {
20117
+ if (raw2 === null || typeof raw2 !== "object" || Array.isArray(raw2)) {
19567
20118
  fail2(`data.${localName} \u5FC5\u987B\u662F\u6620\u5C04\uFF08\u58F0\u660E\uFF09\u6216\u5B57\u7B26\u4E32\u8DEF\u5F84\uFF08\u5F15\u5165\uFF09`);
19568
20119
  }
19569
- dataObjects.push(parseDataObject(localName, raw, blockId, scope, actions, fail2));
20120
+ dataObjects.push(parseDataObject(localName, raw2, blockId, scope, actions, fail2));
19570
20121
  }
19571
20122
  const uiRaw = body.ui ?? {};
19572
20123
  if (typeof uiRaw !== "object" || Array.isArray(uiRaw)) fail2("ui \u6BB5\u5FC5\u987B\u662F\u6620\u5C04");
@@ -19589,14 +20140,14 @@ function parseUseBlock(input) {
19589
20140
  };
19590
20141
  return ast;
19591
20142
  }
19592
- function parseDataObject(localName, raw, blockId, scope, actions, fail2) {
19593
- for (const key of Object.keys(raw)) {
20143
+ function parseDataObject(localName, raw2, blockId, scope, actions, fail2) {
20144
+ for (const key of Object.keys(raw2)) {
19594
20145
  if (!DATA_OBJECT_KEYS.has(key)) {
19595
20146
  fail2(`data.${localName} \u4E0D\u652F\u6301\u952E "${key}"\uFF08\u53EF\u7528\uFF1A${[...DATA_OBJECT_KEYS].join("/")}\uFF09`);
19596
20147
  }
19597
20148
  }
19598
20149
  const decl = { localName, fullName: `${blockId}.${localName}` };
19599
- const from = raw.from;
20150
+ const from = raw2.from;
19600
20151
  if (from !== void 0) {
19601
20152
  if (typeof from !== "object" || Array.isArray(from)) fail2(`data.${localName}.from \u5FC5\u987B\u662F\u6620\u5C04`);
19602
20153
  const api = from.api;
@@ -19607,7 +20158,7 @@ function parseDataObject(localName, raw, blockId, scope, actions, fail2) {
19607
20158
  }
19608
20159
  decl.from = { api: resolveApiRef(String(api), scope), params };
19609
20160
  }
19610
- const save = raw.save;
20161
+ const save = raw2.save;
19611
20162
  if (save !== void 0) {
19612
20163
  if (typeof save !== "object" || Array.isArray(save)) fail2(`data.${localName}.save \u5FC5\u987B\u662F\u6620\u5C04`);
19613
20164
  const api = save.api;
@@ -19630,13 +20181,13 @@ function parseDataObject(localName, raw, blockId, scope, actions, fail2) {
19630
20181
  ...Array.isArray(save.fields) ? { fields: save.fields.map(String) } : {}
19631
20182
  };
19632
20183
  }
19633
- if (raw.refresh !== void 0) decl.refreshMs = parseDuration(String(raw.refresh), localName, fail2);
19634
- if (raw.reload_on !== void 0) {
19635
- if (!Array.isArray(raw.reload_on)) fail2(`data.${localName}.reload_on \u5FC5\u987B\u662F\u6570\u7EC4`);
19636
- decl.reloadOn = raw.reload_on.map((item) => expandPath(String(item), scope));
20184
+ if (raw2.refresh !== void 0) decl.refreshMs = parseDuration(String(raw2.refresh), localName, fail2);
20185
+ if (raw2.reload_on !== void 0) {
20186
+ if (!Array.isArray(raw2.reload_on)) fail2(`data.${localName}.reload_on \u5FC5\u987B\u662F\u6570\u7EC4`);
20187
+ decl.reloadOn = raw2.reload_on.map((item) => expandPath(String(item), scope));
19637
20188
  }
19638
- if (raw.fields !== void 0) {
19639
- const fieldsRaw = raw.fields;
20189
+ if (raw2.fields !== void 0) {
20190
+ const fieldsRaw = raw2.fields;
19640
20191
  if (typeof fieldsRaw !== "object" || Array.isArray(fieldsRaw)) {
19641
20192
  fail2(`data.${localName}.fields \u5FC5\u987B\u662F\u6620\u5C04`);
19642
20193
  }
@@ -19648,11 +20199,11 @@ function parseDataObject(localName, raw, blockId, scope, actions, fail2) {
19648
20199
  }
19649
20200
  return decl;
19650
20201
  }
19651
- function parseField2(objectName, fieldName, raw, fail2) {
19652
- if (raw === null || typeof raw !== "object" || Array.isArray(raw)) {
20202
+ function parseField2(objectName, fieldName, raw2, fail2) {
20203
+ if (raw2 === null || typeof raw2 !== "object" || Array.isArray(raw2)) {
19653
20204
  fail2(`\u5B57\u6BB5\u5B57\u5178 ${objectName}.${fieldName} \u5FC5\u987B\u662F\u6620\u5C04`);
19654
20205
  }
19655
- const field = raw;
20206
+ const field = raw2;
19656
20207
  for (const key of Object.keys(field)) {
19657
20208
  if (!FIELD_KEYS.has(key)) {
19658
20209
  fail2(`\u5B57\u6BB5 ${objectName}.${fieldName} \u4E0D\u652F\u6301\u952E "${key}"\uFF08\u53EF\u7528\uFF1A${[...FIELD_KEYS].join("/")}\uFF09`);
@@ -19686,14 +20237,14 @@ function parseField2(objectName, fieldName, raw, fail2) {
19686
20237
  ...field.rules ? { rules: field.rules } : {}
19687
20238
  };
19688
20239
  }
19689
- function parseEventSection(raw, blockId, scope, fail2) {
20240
+ function parseEventSection(raw2, blockId, scope, fail2) {
19690
20241
  const actions = /* @__PURE__ */ new Map();
19691
20242
  const emitRoutes = {};
19692
- if (raw === void 0) return { actions, emitRoutes };
19693
- if (raw === null || typeof raw !== "object" || Array.isArray(raw)) {
20243
+ if (raw2 === void 0) return { actions, emitRoutes };
20244
+ if (raw2 === null || typeof raw2 !== "object" || Array.isArray(raw2)) {
19694
20245
  fail2("event \u6BB5\u5FC5\u987B\u662F\u6620\u5C04\uFF08\u5B50\u952E actions / on\uFF09");
19695
20246
  }
19696
- const section = raw;
20247
+ const section = raw2;
19697
20248
  for (const key of Object.keys(section)) {
19698
20249
  if (!EVENT_KEYS.has(key)) {
19699
20250
  fail2(`event \u6BB5\u4E0D\u652F\u6301\u5B50\u952E "${key}"\uFF08\u53EF\u7528\uFF1Aactions / on\uFF09\u2014\u2014\u5B9A\u4E49\u4E0E\u8DEF\u7531\u5206\u5F00\u4F4F\uFF0C\u4E0D\u9760\u503C\u5F62\u72B6\u731C`);
@@ -19747,8 +20298,8 @@ function withPageDefaultInPipeline(expr) {
19747
20298
  ""
19748
20299
  );
19749
20300
  }
19750
- function expandCondition2(raw, scope) {
19751
- const text = raw.trim();
20301
+ function expandCondition2(raw2, scope) {
20302
+ const text = raw2.trim();
19752
20303
  const negated = text.startsWith("!");
19753
20304
  const bare = negated ? text.slice(1).trim() : text;
19754
20305
  return `${negated ? "!" : ""}${expandPath(bare, scope)}`;
@@ -19804,19 +20355,19 @@ function compileSomaBlocks(input) {
19804
20355
  data[name] = decl;
19805
20356
  }
19806
20357
  const blocks = /* @__PURE__ */ new Map();
19807
- for (const raw of rawBlocks) {
19808
- if (raw.blockId === PAGE_BLOCK_ID) continue;
19809
- const info = htmlIndex.anchors.get(raw.blockId);
20358
+ for (const raw2 of rawBlocks) {
20359
+ if (raw2.blockId === PAGE_BLOCK_ID) continue;
20360
+ const info = htmlIndex.anchors.get(raw2.blockId);
19810
20361
  const ast = parseUseBlock({
19811
- blockId: raw.blockId,
19812
- body: raw.body,
20362
+ blockId: raw2.blockId,
20363
+ body: raw2.body,
19813
20364
  ...info?.component ? { htmlComponent: info.component } : {},
19814
- rowVars: rowVarsFor(raw.blockId, htmlIndex, ui)
20365
+ rowVars: rowVarsFor(raw2.blockId, htmlIndex, ui)
19815
20366
  });
19816
- blocks.set(raw.blockId, ast);
19817
- attachInstance(ui, raw.blockId, ast, htmlIndex);
20367
+ blocks.set(raw2.blockId, ast);
20368
+ attachInstance(ui, raw2.blockId, ast, htmlIndex);
19818
20369
  for (const [emitName, expr] of Object.entries(ast.emitRoutes)) {
19819
- event[`${raw.blockId}.${emitName}`] = expr;
20370
+ event[`${raw2.blockId}.${emitName}`] = expr;
19820
20371
  }
19821
20372
  for (const object of ast.dataObjects) {
19822
20373
  data[object.fullName] = {
@@ -20166,13 +20717,13 @@ function anchorSelector(hostClass, anchor) {
20166
20717
  return `[data-soma-host="${hostClass}"] [data-soma-id="${anchor}"]`;
20167
20718
  }
20168
20719
  function compilePageLayout(input) {
20169
- const { raw, htmlIndex, hostClass } = input;
20170
- if (!raw || typeof raw !== "object" || Array.isArray(raw)) {
20720
+ const { raw: raw2, htmlIndex, hostClass } = input;
20721
+ if (!raw2 || typeof raw2 !== "object" || Array.isArray(raw2)) {
20171
20722
  fail("layout \u5FC5\u987B\u662F\u6620\u5C04\uFF1A{ <\u951A\u70B9id>: { gap, wrap, <\u5B50\u9879>: { sizing, \u2026 } } }", "layout");
20172
20723
  }
20173
20724
  const constraints = {};
20174
20725
  const chunks = [];
20175
- for (const [anchor, spec] of Object.entries(raw)) {
20726
+ for (const [anchor, spec] of Object.entries(raw2)) {
20176
20727
  const path = `layout.${anchor}`;
20177
20728
  if (!htmlIndex.anchors.has(anchor)) {
20178
20729
  fail(`\u951A\u70B9 "${anchor}" \u4E0D\u5B58\u5728\u4E8E HTML\uFF08data-soma-id\uFF09`, path);
@@ -20316,6 +20867,7 @@ function compilePageAssets(assets) {
20316
20867
  SomaDiagnostics,
20317
20868
  SomaDict,
20318
20869
  SomaEntity,
20870
+ SomaFieldLinesError,
20319
20871
  SomaHttpClient,
20320
20872
  SomaLocaleOnlyPageRoot,
20321
20873
  SomaMiddlewareChain,
@@ -20362,8 +20914,11 @@ function compilePageAssets(assets) {
20362
20914
  createWindow,
20363
20915
  decodePageState,
20364
20916
  defaultPipeRegistry,
20917
+ deriveContractSample,
20918
+ deriveFieldSample,
20365
20919
  deriveKeyboardMatrix,
20366
20920
  deriveTheme,
20921
+ describeHttpErrorBody,
20367
20922
  describeNode,
20368
20923
  dictHash,
20369
20924
  encodePageState,
@@ -20387,6 +20942,7 @@ function compilePageAssets(assets) {
20387
20942
  getShowMetadata,
20388
20943
  hasBlockedScheme,
20389
20944
  hasPageMetadata,
20945
+ hasRenderableSample,
20390
20946
  inferCalcType,
20391
20947
  installSomaErrorReporter,
20392
20948
  isArithSegment,
@@ -20408,11 +20964,14 @@ function compilePageAssets(assets) {
20408
20964
  parseDataConfig,
20409
20965
  parseDataRef,
20410
20966
  parseDataYaml,
20967
+ parseEmitLines,
20968
+ parseFieldLines,
20411
20969
  parseLayoutConstraint,
20412
20970
  parseListPath,
20413
20971
  parsePageBlock,
20414
20972
  parsePageState,
20415
20973
  parseReactions,
20974
+ parseSlotLines,
20416
20975
  parseStateValue,
20417
20976
  parseSteps,
20418
20977
  parseUseBlock,
@@ -20423,6 +20982,7 @@ function compilePageAssets(assets) {
20423
20982
  readBootTimings,
20424
20983
  readListPath,
20425
20984
  recordMetric,
20985
+ renderFieldLines,
20426
20986
  renderKeyboardMatrixLine,
20427
20987
  renderPublishedPage,
20428
20988
  resetBootTimings,
@@ -20441,7 +21001,10 @@ function compilePageAssets(assets) {
20441
21001
  scopeHasVar,
20442
21002
  setActiveTelemetry,
20443
21003
  setSomaHtmlSanitizer,
21004
+ somaEmits,
21005
+ somaFields,
20444
21006
  somaRollupPlugin,
21007
+ somaSlots,
20445
21008
  startBootTimings,
20446
21009
  themeRootAttributes,
20447
21010
  validateListPath,