soma-core 1.4.1 → 1.5.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (221) hide show
  1. package/bin/component.cjs +240 -0
  2. package/bin/eject.cjs +174 -0
  3. package/bin/migrate.cjs +362 -0
  4. package/core/build/blocks/block-compile.ts +143 -17
  5. package/core/build/blocks/migrate-flat.ts +118 -25
  6. package/core/build/compiler/page-declaration-compiler.ts +149 -5
  7. package/core/build/compiler/route-builder.ts +0 -4
  8. package/core/build/compiler/soma-precompile.js +443 -30
  9. package/core/build/component/component-graph.ts +28 -105
  10. package/core/build/component/package-loader.ts +50 -4
  11. package/core/build/eject/component-eject.ts +8 -2
  12. package/core/build/layout/constraint-solver.ts +131 -16
  13. package/core/build/layout/css-emitter.ts +15 -9
  14. package/core/build/ooui/artifact/artifact.types.ts +275 -0
  15. package/core/build/ooui/artifact/emit-artifact.ts +269 -0
  16. package/core/build/ooui/artifact/emit-html.ts +204 -0
  17. package/core/build/ooui/artifact/index.ts +53 -0
  18. package/core/build/ooui/artifact/spatial-tree.ts +268 -0
  19. package/core/build/ooui/artifact/utility-class.ts +83 -0
  20. package/core/build/ooui/composition/candidate.types.ts +323 -0
  21. package/core/build/ooui/composition/control-model.ts +114 -0
  22. package/core/build/ooui/composition/registry.ts +520 -0
  23. package/core/build/ooui/composition/select.ts +232 -0
  24. package/core/build/ooui/diagnostics/codes.ts +230 -0
  25. package/core/build/ooui/diagnostics/error.ts +235 -0
  26. package/core/build/ooui/diagnostics/format.ts +106 -0
  27. package/core/build/ooui/diagnostics/index.ts +62 -0
  28. package/core/build/ooui/diagnostics/issue.types.ts +112 -0
  29. package/core/build/ooui/engine-slot.ts +184 -0
  30. package/core/build/ooui/index.ts +1427 -0
  31. package/core/build/ooui/intent/derive-intent.ts +450 -0
  32. package/core/build/ooui/intent/field-rules.ts +330 -0
  33. package/core/build/ooui/intent/intent.types.ts +476 -0
  34. package/core/build/ooui/intent/verb-events.ts +285 -0
  35. package/core/build/ooui/page/budget.ts +503 -0
  36. package/core/build/ooui/page/compose-page.ts +736 -0
  37. package/core/build/ooui/page/index.ts +66 -0
  38. package/core/build/ooui/page/page.types.ts +402 -0
  39. package/core/build/ooui/page/region-row.ts +241 -0
  40. package/core/build/ooui/semantic/expand-page-surface.ts +180 -0
  41. package/core/build/ooui/semantic/kernel.types.ts +187 -0
  42. package/core/build/ooui/semantic/normalize.ts +784 -0
  43. package/core/build/ooui/semantic/origin.types.ts +211 -0
  44. package/core/build/ooui/semantic/role-alias.ts +154 -0
  45. package/core/build/ooui/semantic/shorthand.ts +233 -0
  46. package/core/build/ooui/semantic/surface.types.ts +78 -0
  47. package/core/build/ooui/semantic/validate-request.ts +267 -0
  48. package/core/build/ooui/spatial/emit-utility.ts +480 -0
  49. package/core/build/ooui/spatial/ir.types.ts +443 -0
  50. package/core/build/ooui/spatial/registry.ts +565 -0
  51. package/core/build/ooui/spatial/solve.ts +769 -0
  52. package/core/build/ooui/spatial/utility.types.ts +242 -0
  53. package/core/build/ooui/trace/index.ts +40 -0
  54. package/core/build/ooui/trace/render.ts +190 -0
  55. package/core/build/ooui/trace/source.types.ts +69 -0
  56. package/core/build/ooui/trace/trace.types.ts +326 -0
  57. package/core/build/pack/pack-init.ts +19 -14
  58. package/core/client/base/SomaHttpClient.ts +34 -1
  59. package/core/client/component/ai-catalog.ts +42 -0
  60. package/core/client/component/example-blocks.ts +1 -7
  61. package/core/client/component/theme-component-tokens.ts +12 -15
  62. package/core/client/component/verify-pack.ts +120 -1
  63. package/core/client/container/SomaContainerAdapter.ts +6 -2
  64. package/core/client/data/data-object-resolver.ts +27 -8
  65. package/core/client/diagnostics/telemetry-context.ts +0 -4
  66. package/core/client/engine/asset-resolver.ts +0 -1
  67. package/core/client/engine/event-engine.ts +7 -3
  68. package/core/client/engine/soma-bootstrap.ts +292 -34
  69. package/core/client/engine/style-binder.ts +0 -1
  70. package/core/client/infra/http/IHttpClient.ts +0 -6
  71. package/core/client/infra/http/SomaHttpService.ts +5 -2
  72. package/core/client/infra/notify/DomNotifyService.ts +1 -1
  73. package/core/client/infra/router/router-path.ts +0 -6
  74. package/core/client/parser/annotation-extractor.ts +1 -1
  75. package/core/client/parser/blocks/namespace.ts +30 -5
  76. package/core/client/parser/blocks/page-parser.ts +44 -1
  77. package/core/client/parser/blocks/use-parser.ts +266 -46
  78. package/core/client/parser/data-config-parser.ts +71 -3
  79. package/core/client/parser/layout-parser.ts +4 -3
  80. package/core/client/parser/reaction-parser.ts +0 -1
  81. package/core/client/parser/ui-config-parser.ts +212 -74
  82. package/core/client/theme/scene-tokens.ts +9 -3
  83. package/core/client/theme/theme-axes.ts +74 -16
  84. package/core/client/theme/theme-engine.ts +280 -69
  85. package/core/client/theme/tone-solver.ts +9 -8
  86. package/core/index.ts +38 -3
  87. package/core/server/api/load-host-service.ts +8 -2
  88. package/core/server/declaration-safety.ts +11 -0
  89. package/core/server/host/page-response-request.ts +0 -2
  90. package/core/server/host/published-page-artifact-cache.ts +244 -0
  91. package/core/server/host/published-page-assets.ts +44 -5
  92. package/core/server/mock/node/cli.mjs +0 -1
  93. package/core/server/mock/node/schema-generator.mjs +0 -1
  94. package/core/server/ooui.ts +34 -0
  95. package/core/server/page-assets.ts +8 -0
  96. package/core/server/page-declaration.ts +18 -0
  97. package/core/server/registry/asset-store.ts +327 -0
  98. package/core/server/registry/declaration-precompiler.ts +49 -6
  99. package/core/server/registry/index.ts +47 -1
  100. package/core/server/registry/page-registry-repository.ts +6 -2
  101. package/core/server/registry/page-registry-store.ts +133 -19
  102. package/core/server/registry/publish-asset-pin.ts +557 -0
  103. package/core/server/registry/services/pages/List.ts +15 -3
  104. package/core/server/registry/validation/compile-gate.ts +180 -8
  105. package/core/server/registry/validation/declaration-safety-scan.ts +113 -23
  106. package/core/shared/component/derive-sample.ts +290 -0
  107. package/core/shared/component/field-lines.ts +563 -0
  108. package/core/shared/container-breakpoints.ts +46 -0
  109. package/core/shared/object-semantics.ts +240 -0
  110. package/core/shared/ooui-declaration.ts +235 -0
  111. package/core/shared/types/component-contract.types.ts +30 -13
  112. package/core/shared/types/data-config.types.ts +95 -0
  113. package/core/shared/types/domain.types.ts +0 -24
  114. package/core/shared/types/engine.types.ts +0 -5
  115. package/core/shared/types/layout-constraint.types.ts +16 -0
  116. package/core/shared/types/ui-config.types.ts +163 -13
  117. package/dist/cli/soma.js +24 -11
  118. package/dist/core/index.cjs +2424 -1098
  119. package/dist/types/build/blocks/block-compile.d.ts +16 -1
  120. package/dist/types/build/blocks/migrate-flat.d.ts +17 -0
  121. package/dist/types/build/compiler/page-declaration-compiler.d.ts +46 -0
  122. package/dist/types/build/compiler/route-builder.d.ts +0 -1
  123. package/dist/types/build/component/component-graph.d.ts +17 -53
  124. package/dist/types/build/component/package-loader.d.ts +8 -1
  125. package/dist/types/build/layout/constraint-solver.d.ts +46 -4
  126. package/dist/types/build/ooui/artifact/artifact.types.d.ts +180 -0
  127. package/dist/types/build/ooui/artifact/emit-artifact.d.ts +58 -0
  128. package/dist/types/build/ooui/artifact/emit-html.d.ts +53 -0
  129. package/dist/types/build/ooui/artifact/index.d.ts +5 -0
  130. package/dist/types/build/ooui/artifact/spatial-tree.d.ts +48 -0
  131. package/dist/types/build/ooui/artifact/utility-class.d.ts +46 -0
  132. package/dist/types/build/ooui/composition/candidate.types.d.ts +206 -0
  133. package/dist/types/build/ooui/composition/control-model.d.ts +37 -0
  134. package/dist/types/build/ooui/composition/registry.d.ts +66 -0
  135. package/dist/types/build/ooui/composition/select.d.ts +63 -0
  136. package/dist/types/build/ooui/diagnostics/codes.d.ts +28 -0
  137. package/dist/types/build/ooui/diagnostics/error.d.ts +135 -0
  138. package/dist/types/build/ooui/diagnostics/format.d.ts +51 -0
  139. package/dist/types/build/ooui/diagnostics/index.d.ts +25 -0
  140. package/dist/types/build/ooui/diagnostics/issue.types.d.ts +56 -0
  141. package/dist/types/build/ooui/engine-slot.d.ts +41 -0
  142. package/dist/types/build/ooui/index.d.ts +286 -0
  143. package/dist/types/build/ooui/intent/derive-intent.d.ts +32 -0
  144. package/dist/types/build/ooui/intent/field-rules.d.ts +99 -0
  145. package/dist/types/build/ooui/intent/intent.types.d.ts +318 -0
  146. package/dist/types/build/ooui/intent/verb-events.d.ts +70 -0
  147. package/dist/types/build/ooui/page/budget.d.ts +28 -0
  148. package/dist/types/build/ooui/page/compose-page.d.ts +41 -0
  149. package/dist/types/build/ooui/page/index.d.ts +4 -0
  150. package/dist/types/build/ooui/page/page.types.d.ts +264 -0
  151. package/dist/types/build/ooui/page/region-row.d.ts +16 -0
  152. package/dist/types/build/ooui/semantic/expand-page-surface.d.ts +33 -0
  153. package/dist/types/build/ooui/semantic/kernel.types.d.ts +125 -0
  154. package/dist/types/build/ooui/semantic/normalize.d.ts +45 -0
  155. package/dist/types/build/ooui/semantic/origin.types.d.ts +95 -0
  156. package/dist/types/build/ooui/semantic/role-alias.d.ts +35 -0
  157. package/dist/types/build/ooui/semantic/shorthand.d.ts +60 -0
  158. package/dist/types/build/ooui/semantic/surface.types.d.ts +16 -0
  159. package/dist/types/build/ooui/semantic/validate-request.d.ts +19 -0
  160. package/dist/types/build/ooui/spatial/emit-utility.d.ts +43 -0
  161. package/dist/types/build/ooui/spatial/ir.types.d.ts +280 -0
  162. package/dist/types/build/ooui/spatial/registry.d.ts +110 -0
  163. package/dist/types/build/ooui/spatial/solve.d.ts +42 -0
  164. package/dist/types/build/ooui/spatial/utility.types.d.ts +191 -0
  165. package/dist/types/build/ooui/trace/index.d.ts +3 -0
  166. package/dist/types/build/ooui/trace/render.d.ts +42 -0
  167. package/dist/types/build/ooui/trace/source.types.d.ts +25 -0
  168. package/dist/types/build/ooui/trace/trace.types.d.ts +143 -0
  169. package/dist/types/client/base/SomaHttpClient.d.ts +8 -0
  170. package/dist/types/client/component/ai-catalog.d.ts +9 -0
  171. package/dist/types/client/component/example-blocks.d.ts +0 -2
  172. package/dist/types/client/component/theme-component-tokens.d.ts +8 -5
  173. package/dist/types/client/component/verify-pack.d.ts +10 -0
  174. package/dist/types/client/data/data-object-resolver.d.ts +10 -2
  175. package/dist/types/client/diagnostics/telemetry-context.d.ts +0 -1
  176. package/dist/types/client/engine/soma-bootstrap.d.ts +123 -10
  177. package/dist/types/client/infra/http/IHttpClient.d.ts +0 -5
  178. package/dist/types/client/infra/http/SomaHttpService.d.ts +1 -1
  179. package/dist/types/client/infra/router/router-path.d.ts +0 -2
  180. package/dist/types/client/parser/blocks/namespace.d.ts +20 -0
  181. package/dist/types/client/parser/blocks/page-parser.d.ts +9 -0
  182. package/dist/types/client/parser/blocks/use-parser.d.ts +38 -4
  183. package/dist/types/client/parser/data-config-parser.d.ts +13 -0
  184. package/dist/types/client/parser/ui-config-parser.d.ts +1 -11
  185. package/dist/types/client/theme/scene-tokens.d.ts +9 -3
  186. package/dist/types/client/theme/theme-axes.d.ts +64 -1
  187. package/dist/types/client/theme/theme-engine.d.ts +13 -8
  188. package/dist/types/client/theme/tone-solver.d.ts +9 -5
  189. package/dist/types/index.d.ts +6 -4
  190. package/dist/types/server/declaration-safety.d.ts +7 -0
  191. package/dist/types/server/host/page-response-request.d.ts +0 -1
  192. package/dist/types/server/host/published-page-artifact-cache.d.ts +64 -0
  193. package/dist/types/server/ooui.d.ts +18 -0
  194. package/dist/types/server/page-assets.d.ts +7 -0
  195. package/dist/types/server/page-declaration.d.ts +14 -0
  196. package/dist/types/server/registry/asset-store.d.ts +112 -0
  197. package/dist/types/server/registry/declaration-precompiler.d.ts +23 -3
  198. package/dist/types/server/registry/index.d.ts +3 -1
  199. package/dist/types/server/registry/page-registry-store.d.ts +57 -4
  200. package/dist/types/server/registry/publish-asset-pin.d.ts +166 -0
  201. package/dist/types/server/registry/services/pages/List.d.ts +9 -3
  202. package/dist/types/server/registry/validation/compile-gate.d.ts +63 -0
  203. package/dist/types/shared/component/derive-sample.d.ts +37 -0
  204. package/dist/types/shared/component/field-lines.d.ts +19 -0
  205. package/dist/types/shared/container-breakpoints.d.ts +42 -0
  206. package/dist/types/shared/object-semantics.d.ts +42 -0
  207. package/dist/types/shared/ooui-declaration.d.ts +135 -0
  208. package/dist/types/shared/types/component-contract.types.d.ts +29 -12
  209. package/dist/types/shared/types/data-config.types.d.ts +86 -0
  210. package/dist/types/shared/types/domain.types.d.ts +0 -21
  211. package/dist/types/shared/types/engine.types.d.ts +0 -4
  212. package/dist/types/shared/types/layout-constraint.types.d.ts +1 -0
  213. package/dist/types/shared/types/ui-config.types.d.ts +157 -12
  214. package/next.config.js +106 -13
  215. package/package.json +28 -2
  216. package/core/client/host-bridge/index.ts +0 -27
  217. package/core/client/parser/yaml-loader.ts +0 -36
  218. package/core/shared/manifest/manifest-contract.ts +0 -12
  219. package/dist/types/client/host-bridge/index.d.ts +0 -9
  220. package/dist/types/client/parser/yaml-loader.d.ts +0 -21
  221. package/dist/types/shared/manifest/manifest-contract.d.ts +0 -4
@@ -56,6 +56,51 @@ export interface SomaPageAssets {
56
56
  */
57
57
  components?: Record<string, SomaComponentDefinition>;
58
58
  }
59
+ /**
60
+ * 演绎区域已注入的标记。值是这份 html 的**内容指纹**,不是布尔。
61
+ *
62
+ * 布尔标记的坏法:同一个锚点换了一份产物会被当成"已经注入过了"而跳过,
63
+ * 页面继续显示上一版 DOM——渲染正常、内容是旧的、控制台一行都没有。
64
+ * 与产物侧 `css_key` 用内容哈希是同一条理由,只是这一侧的作用域是单个锚点。
65
+ */
66
+ export declare const SOMA_OOUI_REGION_ATTR = "data-soma-ooui";
67
+ /**
68
+ * 产物 DOM 的标签允许集。**这就是 `emitRegionHtml` 今天产出的全集**
69
+ * (区域外壳恒为 `div`,根构件是组件时 `div`、是纯文本节点时 `span`)。
70
+ *
71
+ * 为什么是允许集不是禁用集:产物只有两种标签,禁用集只挡得住今天想得到的那几样,
72
+ * 而允许集把"想不到的那些"一并挡住。代价是发射器加新标签时这里会红——
73
+ * 那正是要的:红在写下的那天,而不是在某份被改过的资产送进 innerHTML 的那天。
74
+ */
75
+ export declare const SOMA_OOUI_ALLOWED_TAGS: ReadonlySet<string>;
76
+ /**
77
+ * 产物 DOM 的属性允许集(HTML 解析器会把属性名小写化,所以只写小写)。
78
+ *
79
+ * `on*`、`src`/`href` 这类属性一个都不在里面——引擎从不产出它们
80
+ * (事件走 `eventConfig`,不进 DOM 属性;架构 §24.1),所以它们出现在这里
81
+ * 只有一个含义:这份产物不是编译器产的。
82
+ */
83
+ export declare const SOMA_OOUI_ALLOWED_ATTRS: ReadonlySet<string>;
84
+ /**
85
+ * 结构闸门:返回 `null` 表示这份 DOM 就是产物该有的样子,否则返回违规描述。
86
+ *
87
+ * 三条判据:
88
+ * ① 顶层恰好一个元素(`emitRegionHtml` 恒产出单个区域外壳)。
89
+ * 不查这条的话,一份"外壳 + 一段裸文本"的产物会被照单全收,
90
+ * 而多出来的那段文本在页面上只是多了一行字。
91
+ * ② 每个元素的标签在允许集内;
92
+ * ③ 每个属性名在允许集内。
93
+ */
94
+ export declare function findOouiDomOffence(fragment: DocumentFragment): string | null;
95
+ /**
96
+ * 产物 html 的内容指纹(FNV-1a 32 位,8 位十六进制)。
97
+ *
98
+ * **不是安全边界**,只回答"这个锚点上挂的还是不是同一份产物"——
99
+ * 安全由上面那道结构闸门负责。所以这里不用 sha256:浏览器侧拿不到 node:crypto,
100
+ * 而 `crypto.subtle.digest` 是异步的,为一次同步的"变没变"判断引入异步
101
+ * 会把注入挪到组件展开之后(见 mount 的 2.4 与 2.5 的顺序)。
102
+ */
103
+ export declare function oouiHtmlFingerprint(html: string): string;
59
104
  /**
60
105
  * 错误采集接线声明(可观测性,默认关闭)。
61
106
  *
@@ -256,6 +301,24 @@ export declare class SomaBootstrap {
256
301
  * 主题是引擎内建路径,不是 bootstrap 可注册能力。
257
302
  */
258
303
  private applyHostTheme;
304
+ /**
305
+ * 组件令牌对账(REQ-009 M-1):`components: { Buton: { radius: … } }` 这样一个
306
+ * 拼写错误,不对账时的表现是**"改了没反应"**——变量确实写进了 :root,
307
+ * 只是没有任何组件读它。这类错误的排查成本远高于报错。
308
+ *
309
+ * 判据住在 `component/theme-component-tokens.ts`,而它此前**一个调用者都没有**
310
+ * (由 `verify:reachable` 查出)。这里是全仓唯一同时持有「主题输入」与
311
+ * 「这一页实际可用的组件表」的地方,所以对账只能发生在这一点上。
312
+ *
313
+ * 两条边界:
314
+ * · **只告警、不阻断换装**。主题是 app 级、全部页面共享的,组件表却是逐页的;
315
+ * 曾经对账与 applyTheme 同在一个 try 里,一条对不上就把整份品牌主题一起丢掉
316
+ * (全页回落默认令牌 + 一条"主题派生失败"),与"一个令牌没人读"的后果不成比例。
317
+ * · **组件表 = Host 级 + 页面级**,与 setupComponentManager 实际装配的那张表同一口径
318
+ * (页面同名胜出)。只看 Host 级的话,只在页面资产里注册的组件会被误报成未知组件。
319
+ * 拿不到组件表时(纯预览场景)按设计跳过,不猜。
320
+ */
321
+ private reconcileThemeComponentTokens;
259
322
  /**
260
323
  * 组件可见的服务表:页面运行时服务 + data 端口(M-5)。
261
324
  *
@@ -264,6 +327,62 @@ export declare class SomaBootstrap {
264
327
  * 它只为自治组件而生,并且仍受 services 白名单管辖(组件不声明就拿不到)。
265
328
  */
266
329
  private buildComponentServices;
330
+ /**
331
+ * 约束布局产物注入(REQ-011 接线 / CL-4)。
332
+ *
333
+ * 运行时只认 `layout_css`——构建期解好的 CSS——按宿主类名注入一次。
334
+ * 收到的若是 `layout` 声明本身而没有产物,说明这页没走 `compilePageDeclaration`
335
+ * (直接把源 YAML 喂给了浏览器)。这里**不**代为求解:求解器在 core/build/,
336
+ * 进 client 就等于把「运行期零求解」这条结构性承诺撤回去。只把这件事说出来。
337
+ */
338
+ private installLayoutCss;
339
+ /**
340
+ * OOUI 演绎产物的 DOM 落点(REQ-014 最后一公里)。
341
+ *
342
+ * ── 为什么"没有这一步"是一种静默失败 ─────────────────────────────
343
+ * 在它之前,整条演绎链止于 `deduce()` 的返回值:六层全绿、`ooui_artifact`
344
+ * 在资产里、样式表也注入了,**页面上什么都没有**。而"锚点空着"与
345
+ * "这块本来就没写内容"在浏览器里长得一模一样——没有异常、没有日志、
346
+ * 截图里也分不开。这是最像成功的那种失败,所以落点必须有断言守着。
347
+ *
348
+ * ── 运行时收到产物就用,收到声明就拒绝代算 ───────────────────────
349
+ * 与 `installLayoutCss` / `installOouiArtifact` 同一条范式:本方法**只搬运**。
350
+ * 它不认识形态、不认识候选表、不认识组件契约——那些词汇住在 soma-ui,
351
+ * 浏览器手里根本没有,代算出来的只会是一份猜的界面。
352
+ *
353
+ * ── 为什么"引擎生成的"不等于"可信的"(架构 §24.1)───────────────
354
+ * 这串 html 随 `_ui.yaml` 走。发布期的注入面静态扫描(`declaration-safety-scan.ts`)
355
+ * 如今对 YAML 面也跑 html 那四条判据(禁用标签 / on\* 处理器 / srcdoc / 伪协议),
356
+ * 门口已经拦得住一份被改过的 `_ui.yaml`。但门口只守 Registry 这一条写路径:
357
+ * 文件态 Host 的资产、预览器直接喂进来的资产都不经过它;而 innerHTML 插入的
358
+ * `<script>` 虽然不执行,`<img onerror=…>` 却会立刻执行。所以注入前必须再核一道——
359
+ * 这是纵深防御的最后一层,不因门口补齐而省掉。
360
+ *
361
+ * 核的方式是**允许集**不是禁用集:`emitRegionHtml` 今天只产出
362
+ * `div` / `span` 两种标签与四个 `class` / `data-soma-*` 属性,
363
+ * 把这个全集写死,任何多出来的东西一律拒收。禁用集在这种两标签的产物上
364
+ * 严格更差——它只挡得住今天想得到的那几样。发射器哪天真加了新标签,
365
+ * 这里会**当场红**(而不是静默放行),红在写下的那天,这正是要的。
366
+ *
367
+ * 解析走 `<template>`:template 的内容是**惰性的**——不加载图片、不跑脚本,
368
+ * 所以"先解析再检查"这个顺序本身不会触发任何东西。检查通过之后才搬进文档。
369
+ */
370
+ private installOouiHtml;
371
+ /**
372
+ * OOUI 演绎产物注入(REQ-014 接线)。
373
+ *
374
+ * 与 `installLayoutCss` 逐点同构:运行时只认**产物**,收到声明本身只告警。
375
+ * 演绎链住在 core/build/ooui/,进 client 就等于把「运行期零演绎」这条
376
+ * 结构性承诺撤回去——而且浏览器手里根本没有候选表与组件契约,
377
+ * 代算出来的只会是一份猜的界面。
378
+ *
379
+ * 注入键用产物自带的**内容哈希**(`ooui:<sha256 前 8 位>`),不用页面名:
380
+ * `injectStyleOnce` 没有内容冲突检测(同键不同内容静默保留第一份),
381
+ * 按页面名命名的话,SPA 内路由切到同名不同产物的页面会继续用上一页的 CSS,
382
+ * 页面看着渲染正常、间距全错、控制台一行都没有。
383
+ * 位置紧接 `installLayoutCss`——都在组件实例挂载**之前**,级联顺序才稳定。
384
+ */
385
+ private installOouiArtifact;
267
386
  /**
268
387
  * 页面态装配(REQ-010 F-37)。
269
388
  *
@@ -275,15 +394,6 @@ export declare class SomaBootstrap {
275
394
  * 版本对不上的 URL 状态整份丢弃并 warn 一次:恢复一份旧结构的状态会让界面进入
276
395
  * 一个谁都没设计过的样子,而那种坏法是静默的(列还在、但顺序是乱的)。
277
396
  */
278
- /**
279
- * 约束布局产物注入(REQ-011 接线 / CL-4)。
280
- *
281
- * 运行时只认 `layout_css`——构建期解好的 CSS——按宿主类名注入一次。
282
- * 收到的若是 `layout` 声明本身而没有产物,说明这页没走 `compilePageDeclaration`
283
- * (直接把源 YAML 喂给了浏览器)。这里**不**代为求解:求解器在 core/build/,
284
- * 进 client 就等于把「运行期零求解」这条结构性承诺撤回去。只把这件事说出来。
285
- */
286
- private installLayoutCss;
287
397
  private installPageState;
288
398
  /** 当前路由路径;无 router 时回落 location */
289
399
  private routerPath;
@@ -294,7 +404,10 @@ export declare class SomaBootstrap {
294
404
  * 点了那个按钮才暴露,而暴露的形式是"点了没反应"——最难报障也最难复现的一种。
295
405
  */
296
406
  private assertNamedActionsResolvable;
297
- /** 稳定的 data 端口壳:每次调用现取当前解析器 */
407
+ /**
408
+ * 稳定的 data 端口壳:每次调用现取当前解析器(解析器暂缺时的兜底住在 createSomaDataPort 里,
409
+ * 与端口的方法面同一处——测试守的就是这里注入的那一个端口)。
410
+ */
298
411
  private createStableDataPort;
299
412
  /** 组件管理器装配:无 components 资产时保持 null,组件能力整体旁路 */
300
413
  private setupComponentManager;
@@ -12,11 +12,6 @@ export interface UploadOptions {
12
12
  /** 额外表单字段 */
13
13
  fields?: Record<string, string>;
14
14
  }
15
- export interface HttpResponse<T = any> {
16
- data: T;
17
- status: number;
18
- headers: Record<string, string>;
19
- }
20
15
  export interface IHttpClient {
21
16
  get<T>(url: string, config?: HttpRequestConfig): Promise<T>;
22
17
  post<T>(url: string, data?: any, config?: HttpRequestConfig): Promise<T>;
@@ -1,4 +1,4 @@
1
- import { SomaHttpClientConfig } from '@/core/client/base/SomaHttpClient';
1
+ import { SomaHttpClientConfig } from 'soma-core/base';
2
2
  import { IHttpClient, HttpRequestConfig, UploadOptions } from './IHttpClient';
3
3
  /**
4
4
  * SomaHttpService — wraps the core SomaHttpClient and implements IHttpClient.
@@ -1,5 +1,3 @@
1
- /** Strip query/hash for router utilities */
2
- export declare function pathOnly(url: string): string;
3
1
  /** Browser location pathname + search (includes ?id= etc.) */
4
2
  export declare function getBrowserUrlPath(): string;
5
3
  /** Read a query parameter from router path or the browser address bar */
@@ -11,6 +11,12 @@ export interface BlockScope {
11
11
  blockId: string;
12
12
  /** 本块 data 段声明或引入的对象名 */
13
13
  dataNames: ReadonlySet<string>;
14
+ /**
15
+ * 本块 data 名 → 运行时绑定路径前缀。组件块由 use-parser 填:
16
+ * 声明 → `page.data.<块id__名>`,引入 → 引入目标路径。
17
+ * 缺省时回落 `块id.名`——那是 page 块沿用的既有口径,组件块不走这条。
18
+ */
19
+ dataPaths?: ReadonlyMap<string, string>;
14
20
  /** 块作用域别名 */
15
21
  aliases: ReadonlyMap<string, AliasEntry>;
16
22
  /** 按 HTML 位置可见的行变量(行内组件才有) */
@@ -18,6 +24,20 @@ export interface BlockScope {
18
24
  /** 页面变量固定名 */
19
25
  pageVar: string;
20
26
  }
27
+ /**
28
+ * 块私有数据对象的全局身份:扁平名 `块id__名`(标识符,不带点)。
29
+ *
30
+ * 为什么不是 `块id.名`:数据对象层的对象名是标识符(data-config-parser 的
31
+ * IDENTIFIER_PATTERN),`$` 引用与 `relations[].to` 也按标识符切;运行时
32
+ * `page.data.<对象>.<字段>` 的绑定按点号逐段下钻。带点的对象名在这几处各断一次——
33
+ * 页面要么发布不了,要么发布了取不到值、只剩一片空白。扁平名让块私有对象与页面级对象
34
+ * 走同一条解析、同一条取数、同一条绑定,下游一行不改。
35
+ *
36
+ * 规则只在这里定义一次:use-parser(对象键与绑定路径)与 block-compile(撞名检查、
37
+ * `relations[].to`)都调它,不各拼一遍。撞名(`a` 的 `b__c` 与 `a__b` 的 `c`)
38
+ * 由 block-compile 在合表时拦下。
39
+ */
40
+ export declare function blockDataObjectName(blockId: string, localName: string): string;
21
41
  export interface BuildScopeInput {
22
42
  blockId: string;
23
43
  dataNames?: Iterable<string>;
@@ -7,6 +7,15 @@ export interface PageBlockAst {
7
7
  eventRaw: Record<string, unknown>;
8
8
  /** 数据段原文(页面级共享对象,交数据对象层) */
9
9
  dataRaw?: Record<string, unknown>;
10
+ /**
11
+ * 表层对象声明原文(REQ-014 §38.5 断线 ②)。
12
+ *
13
+ * 与 `dataRaw` 是**同一件事的两种书写形态**,不是两套对象:构建期由
14
+ * `normalizeSurfaceObject()` 展开成核心层后并进 `data` 段,之后一路走
15
+ * 同一个数据解析器、同一份 API 白名单校验、同一份运行时资产。
16
+ * 分成两个字段只到编译期为止——再往下游只有核心层(§2.3 判据 3:转换只发生一次)。
17
+ */
18
+ surfaceRaw?: Record<string, unknown>;
10
19
  scope: BlockScope;
11
20
  }
12
21
  export interface ParsePageInput {
@@ -1,32 +1,61 @@
1
1
  import type { ExtendedShowValue } from '../../../shared/types/ui-config.types';
2
2
  import { parseDuration } from '../duration';
3
3
  export { parseDuration };
4
+ import type { SomaDataObjectRelation, SomaDataObjectRoles } from '../../../shared/types/data-config.types';
4
5
  import { type BlockScope } from './namespace';
6
+ /**
7
+ * 块声明的**对象级封闭键集**。导出是为了让"两条书写路径的键集差异"有一处可断言的地方
8
+ * ——平铺 `_data.yaml` 那侧是 `SOMA_DATA_OBJECT_KEYS`,两份键集此前只活在各自的
9
+ * `if/else` 里,谁多谁少没有任何东西看得见。差集本身由测试盯着,只减不增。
10
+ *
11
+ * `roles` / `relations` 随 REQ-014 期 2'.1 进表:不进的话,写 `roles:` 会当场报
12
+ * 「data.X 不支持键 "roles"」,而这个错经 `dryRunCompile` 被压成一句
13
+ * 「声明未通过编译闸门」,发布期直接拒收——报错离原因很远。
14
+ *
15
+ * `refresh` / `reload_on` 已移出:数据对象层没有对应物(不轮询、不监听路径),
16
+ * 收着它们就是「解析了、引擎不消费」——写了 `refresh: 30s` 的对象永远不会重取,且不报错。
17
+ * 现在写它们由 RETIRED_DATA_OBJECT_KEYS 当场拒收并指路。
18
+ */
19
+ export declare const USE_BLOCK_DATA_OBJECT_KEYS: readonly string[];
20
+ /** 块声明的**字段级封闭键集**(导出理由同上) */
21
+ export declare const USE_BLOCK_FIELD_KEYS: readonly string[];
5
22
  export interface DataObjectDecl {
6
23
  localName: string;
7
- /** 全局身份:块id.名 */
24
+ /**
25
+ * 全局身份:扁平名 `块id__名`(blockDataObjectName)。
26
+ * 它就是数据对象层的对象名,也是运行时 `page.data` 的键。
27
+ */
8
28
  fullName: string;
29
+ /** 取数来源(块里只有一个);params 已换成数据对象层的 `$` 引用或字面量 */
9
30
  from?: {
10
31
  api: string;
11
32
  params: Record<string, string>;
12
33
  };
34
+ /** 写通道(block-compile 归一为 `write`) */
13
35
  save?: {
14
36
  api: string;
15
37
  method: string;
16
38
  key?: string;
17
- trigger: string;
18
39
  fields?: string[];
19
40
  };
20
- refreshMs?: number;
21
- reloadOn?: string[];
22
41
  fields?: Record<string, FieldDecl>;
42
+ /** 对象级角色(REQ-014 §3.1.2):哪个字段是标题 / 状态 / 金额 / 对比基准 */
43
+ roles?: SomaDataObjectRoles;
44
+ /**
45
+ * 对象间关系(REQ-014 §3.1.2):compare / navigate 的作用路径。
46
+ * `to` 保留块内短名,block-compile 把指向本块对象的那些换成扁平名。
47
+ */
48
+ relations?: SomaDataObjectRelation[];
23
49
  }
24
50
  export interface FieldDecl {
25
51
  name?: string;
26
52
  type: string;
53
+ /** 值 → 显示文案(块拼写;block-compile 编成数据对象层的 `options` 数组) */
27
54
  values?: Record<string, string>;
28
55
  permission: 'r' | 'w';
29
56
  rules?: Array<Record<string, unknown>>;
57
+ /** 修饰关系(REQ-014 §15.3):本字段是另一个字段的语气 / 单位 / 图标,不独立占格 */
58
+ modifies?: string;
30
59
  }
31
60
  export interface ActionDecl {
32
61
  id: string;
@@ -68,5 +97,10 @@ export interface ParseUseInput {
68
97
  htmlComponent?: string;
69
98
  /** 该实例可见的行变量(由 HTML 位置决定) */
70
99
  rowVars?: Iterable<string>;
100
+ /**
101
+ * 该实例是否位于列表行模板内(由 HTML 位置决定)。
102
+ * 行内实例不得声明私有数据对象:每行渲染一个实例,而数据对象层没有「每行一个对象」。
103
+ */
104
+ inRowTemplate?: boolean;
71
105
  }
72
106
  export declare function parseUseBlock(input: ParseUseInput): UseBlockAst;
@@ -3,6 +3,19 @@ export declare class SomaDataConfigError extends Error {
3
3
  readonly path: string;
4
4
  constructor(message: string, path?: string);
5
5
  }
6
+ /**
7
+ * 平铺 `_data.yaml` 的**对象级封闭键集**。导出是为了让"两条书写路径的键集差异"
8
+ * 有一处可断言的地方——SOMA 有两条声明路径(块声明与平铺 YAML),
9
+ * 而它们的键集此前只存在于各自的 `if/else` 里,谁多谁少没有任何东西看得见。
10
+ *
11
+ * 未知键在这里被拒收,是因为拼错的键在 YAML 里**长得像生效了**:
12
+ * 写 `role:`(少个 s)不会有任何提示,只是那个对象永远没有角色。
13
+ * 而这个错经 `dryRunCompile` 会被压成一句"声明未通过编译闸门",发布期直接拒收——
14
+ * 报错离原因很远,所以这里的消息必须自己把可用键列全。
15
+ */
16
+ export declare const SOMA_DATA_OBJECT_KEYS: readonly string[];
17
+ /** 平铺 `_data.yaml` 的**字段级封闭键集**(导出理由同上) */
18
+ export declare const SOMA_DATA_FIELD_KEYS: readonly string[];
6
19
  /** 解析后的 `$` 引用:三源之一 + 字段路径段 */
7
20
  export interface SomaDataRef {
8
21
  /** query:URL 参数;page:Domain 字段;object:已解析数据对象 */
@@ -1,4 +1,4 @@
1
- import type { UiConfig, ShowMapping, ParsedShowEntry } from '../../shared/types/ui-config.types';
1
+ import type { UiConfig } from '../../shared/types/ui-config.types';
2
2
  import type { SomaAdaptiveVocabulary } from '../../shared/types/adaptive.types';
3
3
  /**
4
4
  * UI 配置解析错误
@@ -48,13 +48,3 @@ export interface SomaUiConfigParseOptions {
48
48
  * @throws SomaAdaptiveConfigError adaptive 声明不合法时抛出
49
49
  */
50
50
  export declare function parseUiConfig(raw: any, options?: SomaUiConfigParseOptions): UiConfig;
51
- /**
52
- * 解析 show 键中的 somaId@attr 语法
53
- *
54
- * 遍历 ShowMapping 中的所有键,将 `somaId@attr` 拆分为 somaId + attrName。
55
- * 用于引擎在绑定时判断是设置 textContent 还是 setAttribute。
56
- *
57
- * @param show - 已解析的 ShowMapping
58
- * @returns ParsedShowEntry 数组
59
- */
60
- export declare function parseShowKeys(show: ShowMapping): ParsedShowEntry[];
@@ -2,11 +2,17 @@ import type { SomaResolvedAxes } from './theme-axes';
2
2
  /**
3
3
  * S5:不含颜色的场景结构参数。
4
4
  *
5
- * 玻璃三档的 rgba 从引擎主体迁到这里(值一个没改)——它们是材质的结构属性,
6
- * 与 field/material 轴同族,散在派生链中间只会让人以为它们是色板的一部分。
5
+ * 玻璃三档的 rgba 与它同族、住在下面的 `glassTokens`(值一个没改,引擎主体的亮/暗两处
6
+ * 都经它取值)——它们是材质的结构属性,与 field/material 轴同族,
7
+ * 散在派生链中间只会让人以为它们是色板的一部分。
7
8
  */
8
9
  export declare function sceneStructureTokens(axes: SomaResolvedAxes): Record<string, string>;
9
- /** 暗色下的玻璃:半透明**黑**而不是白——白玻璃压在深底上会变成发光板 */
10
+ /**
11
+ * 玻璃三档(面 / 强面 / 弱面)。theme-engine 的亮、暗两套变量表都从这里取,值只此一份。
12
+ *
13
+ * 暗色下仍是白,但 alpha 只有 4%~10%(亮色 52%~88%)——高 alpha 的白玻璃压在深底上
14
+ * 会变成一块发光板,层级反而糊掉。
15
+ */
10
16
  export declare function glassTokens(dark: boolean): Record<string, string>;
11
17
  /**
12
18
  * S7′:场景颜色——吃 overrides 合并后的**最终**变量表。
@@ -56,7 +56,7 @@ export interface SomaAxisParams {
56
56
  readonly chromaMul: number;
57
57
  readonly targets: SomaContrastTargets;
58
58
  readonly darkTargets: SomaContrastTargets;
59
- /** contrast:soft 的粉彩明度带;null = 不约束(现状) */
59
+ /** contrast:soft 的粉彩明度带(**亮色侧专用**);null = 不约束 */
60
60
  readonly softLightnessBand: readonly [number, number] | null;
61
61
  /** 环境光三团的 alpha;null = flat(产 transparent) */
62
62
  readonly fieldAlphas: readonly [number, number, number] | null;
@@ -67,6 +67,69 @@ export interface SomaAxisParams {
67
67
  export declare class SomaThemeAxisError extends Error {
68
68
  constructor(message: string);
69
69
  }
70
+ /**
71
+ * 目标对比度组(Leonardo 路线:明度是解出来的,不是写死的)。
72
+ *
73
+ * ── 三个目标分属两层 ────────────────────────────────────────────────
74
+ * fgOnTone / textOnPage **硬保障**:AA 底线,用户关不掉
75
+ * (《soma 设计令牌与主题》§10.3 原则 4「硬保障不是输入」)。
76
+ * toneOnPage **气质目标**:语气实心底相对页面底有多沉。尽力而为,
77
+ * 被硬保障顶掉不报错;与粉彩带冲突时带让位(记 meta.bandBroken)。
78
+ *
79
+ * ── toneOnPage 三档怎么定的(下一个人照这条链复算) ──────────────────
80
+ *
81
+ * 1) 页面底的相对亮度(OKLab 对灰阶恒有 Y = L³):
82
+ * 亮档 `--soma-bg-page` = gray(0.965) → Y = 0.8986
83
+ * 暗档 `--soma-bg-page` = gray(0.18) → Y = 0.005832
84
+ * → 亮档 toneOnPage = 0.9486 / (Y_tone + 0.05)
85
+ * 暗档 toneOnPage = (Y_tone + 0.05) / 0.055832
86
+ * 彩色的 Y 由 OKLab 逆变换算:
87
+ * Y = -0.040794·l'³ + 1.112492·m'³ - 0.071718·s'³
88
+ * l' = L + 0.3963378a + 0.2158038b
89
+ * m' = L - 0.1055613a - 0.0638542b
90
+ * s' = L - 0.0894842a - 1.2914855b (a = c·cos h,b = c·sin h)
91
+ *
92
+ * 2) 求解器检查的是**种子**(banded / separatedL 之后、AA 之前),所以下界由
93
+ * 各语气的种子明度**上限**决定;明度越高(亮档)离页面底越近,对比度越低:
94
+ *
95
+ * 语气 亮档种子明度上限 该明度全色域最差 toneOnPage
96
+ * accent min(0.78, …) = 0.78 1.666 ← 亮档绑定项
97
+ * secondary min(0.72, …) = 0.72 2.08
98
+ * warning 0.72 2.27
99
+ * success 0.58(分离最多上推到 0.72) 2.15
100
+ * danger 0.60(分离最多上推到 0.74) 2.24
101
+ * info 0.60(固定) 3.48
102
+ *
103
+ * 暗档绑定项是 secondary:暗色种子 = min(0.78, 亮色成品 L + 0.08),
104
+ * 而亮色 secondary 的 L ≥ 0.45(0.45 处白字实测 7.5,AA 用不到推),
105
+ * 故暗档种子下限 0.53 → 该明度全色域最差 3.084。
106
+ * 暗色四个语义色常量(0.68/0.66/0.76/0.68)实测 6.2~8.8,不是绑定项。
107
+ *
108
+ * 3) 三档各取在谁之下:
109
+ * standard 1.6 / 3.0 取在**结构下界** 1.666 / 3.084 之下 ——
110
+ * 缺省档因此对任何品牌的正常派生都"一个语气都不推",
111
+ * 产出与接线前逐字节一致(theme-snapshot 闸门看守)。
112
+ * 它不是空转:分离闸把某个语气上推到 0.86 一带时
113
+ * (实测可掉到 1.27),这条线会把它压回可见范围。
114
+ * soft 1.2 / 2.8 亮档取在**粉彩带上界** L=0.86 处的最差值 1.271 之下,
115
+ * 带 [0.70, 0.86] 因此全区间达标、不会被目标顶穿。
116
+ * 柔光 = 语气浅、对页面底反差小,所以 soft 的目标**低于**
117
+ * standard,而不是高于——把它调高会让 soft 比 standard 还跳。
118
+ * 暗档不传带(见 softLightnessBand 的说明),2.8 是纯下界。
119
+ * strong 5.5 / 5.0 显式切换档,改变观感是预期内的。实算:fgOnTone 7.0 会把
120
+ * 走 AA 求解的五个语气推到 Y ≤ 0.10(toneOnPage 顺带 ≈6.3),
121
+ * 5.5 精确绑住**亮档唯一不过 AA 循环的 danger**(fg 恒白);
122
+ * 暗档 5.0 绑住**没有 AA 循环的 secondary/accent**
123
+ * (今天实测只有 3.1~3.8)。两个目标各管一半,覆盖完整。
124
+ *
125
+ * fgOnTone 4.5 是既有 `enforceContrastPairs` 的硬保障值;textOnPage 4.5 是既有 ④.2
126
+ * 的保障值;strong 的 7.0 是 AAA。这三个数不是新口径。
127
+ *
128
+ * 导出是为了让验收用例读真值而不是抄一份数字(与 SEPARATION_THRESHOLD 同一条纪律)。
129
+ */
130
+ export declare const CONTRAST_TARGETS: Record<SomaContrast, SomaContrastTargets>;
131
+ /** 暗色目标:页面底 Y=0.005832,方向相反(语气越亮反差越大)。推导同上 */
132
+ export declare const DARK_CONTRAST_TARGETS: Record<SomaContrast, SomaContrastTargets>;
70
133
  /**
71
134
  * 轴解析:词元 → 确定轴位 + 数值参数。
72
135
  *
@@ -41,7 +41,7 @@ export interface SomaThemeInput {
41
41
  * (页面永不可寻址组件内部,`scopeAnchors()` 的既定边界)。
42
42
  *
43
43
  * 引擎不认识组件,所以这里只做展平;「组件名 / 令牌名是否存在」由装配层的
44
- * `validateThemeComponentTokens` 在 bootstrap 期核对契约。
44
+ * `validateThemeComponentTokens` 在 bootstrap 期核对契约(对不上只告警,不阻断换装)。
45
45
  */
46
46
  components?: Record<string, Record<string, string>>;
47
47
  /** 组件令牌的暗色专属覆盖:与 `darkOverrides` 同一纪律,只并进 darkCssVars */
@@ -54,6 +54,18 @@ export interface SomaThemeMeta {
54
54
  readonly separationApplied: boolean;
55
55
  /** 被推开的语气 */
56
56
  readonly pushed: readonly SomaToneName[];
57
+ /**
58
+ * `contrast:soft` 的粉彩明度带被 toneOnPage 目标顶穿的语气(按名排序)。
59
+ *
60
+ * 不报错只上报:带是气质偏好,目标对比度是无障碍口径,冲突时对比度赢
61
+ * (《soma 设计令牌与主题》§10.3 原则 4「硬保障不是输入」)。留这条旁路是为了
62
+ * 让"带没生效"可观测——否则调参的人只看到颜色不对、不知道是谁让的位。
63
+ *
64
+ * 当前参数下它应当恒为空:soft 的 toneOnPage 1.2 取在带上界 L=0.86 处的
65
+ * 最差实测值 1.271 之下,带全区间达标。它变成非空 = 有人动了带或目标而没对齐。
66
+ * 暗色侧不参与(带只作用于亮色,暗色求解恒传 null)。
67
+ */
68
+ readonly bandBroken: readonly SomaToneName[];
57
69
  /** 本次写出的组件级令牌变量名(M-1)——快照与闸门的观测面 */
58
70
  readonly componentTokens: readonly string[];
59
71
  }
@@ -82,13 +94,6 @@ export declare function hexToOklch(hex: string): Oklch;
82
94
  export declare function oklchToHex(color: Oklch): string;
83
95
  export declare function contrastRatio(hexA: string, hexB: string): number;
84
96
  export declare function deriveTheme(input: SomaThemeInput): SomaDerivedTheme;
85
- /**
86
- * 引擎会写出的令牌名全集(静态令牌 + 派生令牌),不跑派生。
87
- *
88
- * 给 soma-ui 的 `token-existence-lint` 用:契约 `tokens.default` 引用的语义令牌
89
- * 必须真的存在,否则组件令牌指向一个空变量,回退值一路生效而没人发现。
90
- */
91
- export declare function listThemeTokenNames(): readonly string[];
92
97
  /**
93
98
  * 派生结果 → 根元素属性。
94
99
  *
@@ -1,4 +1,4 @@
1
- import type { SomaAxisParams, SomaContrastTargets } from './theme-axes';
1
+ import type { SomaContrastTargets } from './theme-axes';
2
2
  export interface Oklch {
3
3
  l: number;
4
4
  c: number;
@@ -36,12 +36,16 @@ export declare function ensureContrast(bg: string, deps: ToneSolverDeps, minRati
36
36
  * 前景(-fg)仍由既有 ④ 系代码解——那部分是实测校准过的 AA 保障,不在此重复。
37
37
  *
38
38
  * **裁决**:粉彩带约束与对比度目标冲突时**对比度赢**(AA 底线不随 contrast 档
39
- * 移动,是《主题属性设计》§3 原则 4 的承诺)。带被突破时通过返回值旁路上报,
40
- * 由编排者收进 meta,供观测——不报错,因为"带"是气质偏好不是硬约束。
39
+ * 移动,是《soma 设计令牌与主题》§10.3 原则 4「硬保障不是输入」的承诺)。
40
+ * 带被突破时通过返回值旁路上报,由编排者收进 `meta.bandBroken`,供观测——
41
+ * 不报错,因为"带"是气质偏好不是硬约束。
42
+ *
43
+ * **编排者的责任**(theme-engine 的 `solveOnPage`):本函数排在 AA 求解与分离闸
44
+ * 夹子的**上游**,那两条是硬保障、永远说了算;本函数解出的 toneOnPage 是气质
45
+ * 目标,被它们顶掉不报错。调用点还要把下游 `ensureContrast` 的方向钉在
46
+ * 「远离页面底」一侧,否则缺省启发会把刚解好的语气朝页面底推回去。
41
47
  */
42
48
  export declare function solveTone(seed: Oklch, pageHex: string, target: SomaContrastTargets, band: readonly [number, number] | null, deps: ToneSolverDeps): {
43
49
  tone: Oklch;
44
50
  bandBroken: boolean;
45
51
  };
46
- /** 彩度个性:把 chroma 轴的乘数应用到一个种子彩度上(下限护栏防止推成死灰) */
47
- export declare function applyChroma(baseChroma: number, params: SomaAxisParams): number;
@@ -18,8 +18,8 @@ export { SomaDataObjectResolver, SomaDataCycleError, isSomaMockEnabled, } from '
18
18
  export type { SomaDataHttpLike, SomaDataResolverOptions, SomaDataResolveResult, } from './client/data/data-object-resolver';
19
19
  export { parseDataConfig, parseDataYaml, parseDataRef, normalizeDataPipeValue, SomaDataConfigError, } from './client/parser/data-config-parser';
20
20
  export type { SomaDataRef } from './client/parser/data-config-parser';
21
- export type { SomaDataConfig, SomaDataObjectConfig, SomaDataSourceConfig, SomaDataFieldConfig, SomaDataFieldRule, SomaDataFieldOption, SomaDataFieldType, SomaDataFieldPermission, SomaDataDicts, SomaDataWriteConfig, SomaDataWriteEndpoint, SomaDataSubmitResult, SomaDataPort, } from './shared/types/data-config.types';
22
- export { SOMA_DATA_FIELD_TYPES, SOMA_DATA_FIELD_TYPE_ALIASES, } from './shared/types/data-config.types';
21
+ export type { SomaDataConfig, SomaDataObjectConfig, SomaDataSourceConfig, SomaDataFieldConfig, SomaDataFieldRule, SomaDataFieldOption, SomaDataFieldType, SomaDataFieldPermission, SomaDataDicts, SomaDataWriteConfig, SomaDataWriteEndpoint, SomaDataSubmitResult, SomaDataPort, SomaDataObjectRoles, SomaDataObjectRelation, SomaDataRelationCardinality, } from './shared/types/data-config.types';
22
+ export { SOMA_DATA_FIELD_TYPES, SOMA_DATA_FIELD_TYPE_ALIASES, SOMA_DATA_OBJECT_ROLES, SOMA_DATA_RELATION_CARDINALITIES, } from './shared/types/data-config.types';
23
23
  export { SOMA_FIELD_PREDICATE_OPS, evaluatePredicate, validatePredicate, validateNamedPredicates, collectPredicateFields, } from './shared/predicates';
24
24
  export type { SomaFieldPredicateOp, SomaFieldCondition, SomaFieldPredicateRef, SomaFieldPredicateAllOf, SomaFieldPredicateAnyOf, SomaFieldPredicateNoneOf, SomaFieldPredicate, SomaNamedPredicates, SomaPredicateValidateOptions, } from './shared/predicates';
25
25
  export { parseCalc, collectCalcRefs, inferCalcType, assertCalcResultType, evaluateCalc, SomaCalcSyntaxError, SomaCalcTypeError, CALC_FUNCTIONS, } from './shared/calc';
@@ -59,8 +59,11 @@ export type { SomaAdaptiveProfile, SomaAdaptiveConfig, SomaAdaptiveLevel, SomaAd
59
59
  export { createAdaptiveObserverPool, scheduleAdaptiveFlush, resolveTierWithHysteresis, SOMA_DEFAULT_HYSTERESIS, } from './client/adaptive/index';
60
60
  export type { SomaAdaptiveObserverPool, SomaAdaptiveSize, SomaAdaptiveSizeCallback, SomaAdaptiveTask, } from './client/adaptive/index';
61
61
  export type { SomaComponentDefinition, SomaComponentControllerContext, SomaComponentControllerFactory, } from './client/component/component-definition.types';
62
- export type { SomaComponentContract, SomaComponentLayer, SomaGeometryFamily, SomaContractProp, SomaContractEmit, SomaContractSlot, SomaContractKeyboard, SomaContractOverlay, SomaContractToken, } from './shared/types/component-contract.types';
62
+ export type { SomaComponentContract, SomaComponentLayer, SomaGeometryFamily, SomaContractField, SomaContractProp, SomaContractEmit, SomaContractSlot, SomaContractKeyboard, SomaContractOverlay, SomaContractToken, } from './shared/types/component-contract.types';
63
63
  export { findNestedMutableContractDefault } from './shared/types/component-contract.types';
64
+ export { parseFieldLines, parseEmitLines, parseSlotLines, renderFieldLines, somaFields, somaEmits, somaSlots, SomaFieldLinesError, } from './shared/component/field-lines';
65
+ export { deriveContractSample, deriveContractPreviewSample, deriveFieldSample, hasRenderableSample, } from './shared/component/derive-sample';
66
+ export type { DerivePreviewSampleResult, DeriveSampleResult, SampleGap, } from './shared/component/derive-sample';
64
67
  export { componentTokenPrefix, componentTokenVar, COMPONENT_TOKEN_KEY_PATTERN, } from './shared/types/component-contract.types';
65
68
  export { createDefaultRuntimeServices } from './client/runtime/SomaRuntimeServices';
66
69
  export type { SomaRuntimeServices } from './client/runtime/SomaRuntimeServices';
@@ -105,7 +108,6 @@ export { verifyComponentPack, type VerifyPackOptions } from './client/component/
105
108
  export { parseValueSegment, evaluateValueNode, isArithSegment, isPlainPath, describeNode, SomaValueLangError, type ValueNode, type PipedValue, type ValuePosition, type HasVarFn, type EvalOptions, } from './client/parser/value-lang';
106
109
  export { loadSomaFile, SomaBlockParseError, PAGE_BLOCK_ID, type RawBlock, type SomaFileLoadInput, } from './build/blocks/block-container';
107
110
  export { buildHtmlAnchorIndex, type HtmlAnchorIndex, type HtmlAnchorInfo, } from './build/blocks/html-index';
108
- export { compilePageAssets } from './build/compiler/page-assets';
109
111
  export { compileSomaBlocks, type CompiledSomaBlocks, type CompileSomaBlocksInput, } from './build/blocks/block-compile';
110
112
  export { parsePageBlock, type PageBlockAst, } from './client/parser/blocks/page-parser';
111
113
  export { parseUseBlock, type UseBlockAst, type DataObjectDecl, type FieldDecl, type ActionDecl, } from './client/parser/blocks/use-parser';
@@ -0,0 +1,7 @@
1
+ /**
2
+ * Server-only declaration injection scanner public entry.
3
+ *
4
+ * 刻意不 `import 'server-only'`:soma-ai 的声明校验器在经 jiti 加载的宿主服务里
5
+ * import 本入口,server-only 在纯 Node 语境下会抛错(理由同 `server/page-declaration.ts`)。
6
+ */
7
+ export { scanDeclarationSafety, type ScannableDeclaration, } from './registry/validation/declaration-safety-scan';
@@ -1,4 +1,3 @@
1
- export type SomaPageResponseMode = 'html' | 'json';
2
1
  export declare const SOMA_PAGE_REQUEST_URL_HEADER = "x-soma-page-request-url";
3
2
  export declare function isJsonPageResponseMode(mode: string | undefined): boolean;
4
3
  export declare function isSomaPageRequestPath(pathname: string): boolean;