soma-core 1.3.2 → 1.3.3

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 (229) hide show
  1. package/README.md +42 -0
  2. package/app/SomaPageClient.tsx +26 -2
  3. package/app/[...path]/page.tsx +7 -6
  4. package/app/api/[...path]/route.ts +3 -3
  5. package/app/api/soma-registry/[...path]/route.ts +67 -0
  6. package/app/components/SomaHostPage.tsx +3 -8
  7. package/app/components/SomaPageClientBoundary.tsx +13 -0
  8. package/app/layout.tsx +6 -1
  9. package/app/page.tsx +3 -3
  10. package/app/soma/manifest/route.ts +1 -0
  11. package/app/soma/page-object/route.ts +1 -1
  12. package/core/build/compiler/full-manifest-builder.ts +6 -1
  13. package/core/build/compiler/rollup-plugin-soma.ts +6 -0
  14. package/core/build/compiler/soma-manifest-webpack-plugin.js +4 -0
  15. package/core/build/compiler/soma-precompile.js +3507 -2387
  16. package/core/build/compiler/soma-precompile.ts +31 -2
  17. package/core/build/compiler/soma-rspack-yaml-loader.js +3 -0
  18. package/core/build/compiler/soma-webpack-loader.js +7 -1
  19. package/core/build/compiler/vite-plugin-soma.ts +11 -1
  20. package/core/build/component/package-loader.ts +135 -0
  21. package/core/build/eject/apply-eject.ts +133 -0
  22. package/core/build/eject/plan-eject.ts +139 -0
  23. package/core/client/adaptive/flush-scheduler.ts +96 -0
  24. package/core/client/adaptive/hysteresis.ts +56 -0
  25. package/core/client/adaptive/index.ts +23 -0
  26. package/core/client/adaptive/observer-pool.ts +90 -0
  27. package/core/client/base/SomaPageRootBase.ts +50 -0
  28. package/core/client/compiler/adaptive-compile.ts +136 -0
  29. package/core/client/compiler/manifest-compiler.ts +155 -27
  30. package/core/client/component/ai-catalog.ts +262 -0
  31. package/core/client/component/component-definition.types.ts +65 -0
  32. package/core/client/component/component-expander.ts +119 -0
  33. package/core/client/component/component-manager.ts +933 -0
  34. package/core/client/component/component-pack.ts +271 -0
  35. package/core/client/component/component-registry.ts +71 -0
  36. package/core/client/component/pack-styles.ts +94 -0
  37. package/core/client/component/scoped-adapter.ts +85 -0
  38. package/core/client/component/verify-pack.ts +247 -0
  39. package/core/client/container/MiniProgramContainerAdapter.ts +15 -1
  40. package/core/client/container/ReactNativeContainerAdapter.ts +15 -1
  41. package/core/client/container/SomaContainerAdapter.ts +186 -180
  42. package/core/client/data/data-object-resolver.ts +417 -0
  43. package/core/client/diagnostics/SomaDiagnostics.ts +187 -186
  44. package/core/client/diagnostics/boot-timings.ts +152 -0
  45. package/core/client/engine/asset-resolver.ts +12 -2
  46. package/core/client/engine/dom-renderer.ts +235 -16
  47. package/core/client/engine/emit-event.ts +21 -0
  48. package/core/client/engine/event-engine.ts +34 -4
  49. package/core/client/engine/on-change-engine.ts +1 -1
  50. package/core/client/engine/property-watcher.ts +1 -1
  51. package/core/client/engine/reactive-proxy.ts +3 -3
  52. package/core/client/engine/render-engine.ts +39 -4
  53. package/core/client/engine/runtime-builder.ts +23 -0
  54. package/core/client/engine/soma-bootstrap.ts +359 -4
  55. package/core/client/engine/style-binder.ts +47 -1
  56. package/core/client/host-bridge/empty-host/data/README.md +17 -0
  57. package/core/client/observability/error-reporter.ts +173 -0
  58. package/core/client/parser/adaptive-parser.ts +264 -0
  59. package/core/client/parser/data-config-parser.ts +396 -0
  60. package/core/client/parser/pipeline-parser.ts +15 -3
  61. package/core/client/parser/style-config-parser.ts +65 -2
  62. package/core/client/parser/ui-config-parser.ts +52 -3
  63. package/core/client/pipes/pipe-registry.ts +249 -0
  64. package/core/client/quality/SomaQualityRegistry.ts +3 -0
  65. package/core/client/registry/declaration-renderer.ts +159 -0
  66. package/core/client/registry/index.ts +28 -0
  67. package/core/client/registry/page-lifecycle.ts +171 -0
  68. package/core/client/registry/remote-page.ts +139 -0
  69. package/core/client/runtime/SomaRuntimeServices.ts +24 -0
  70. package/core/client/security/attribute-presence.ts +70 -0
  71. package/core/client/security/html-sanitizer.ts +113 -0
  72. package/core/client/security/url-guard.ts +0 -0
  73. package/core/client/theme/theme-engine.ts +936 -0
  74. package/core/client/typography/typography-base.ts +34 -0
  75. package/core/client/validation/contract-validator.ts +48 -5
  76. package/core/index.ts +190 -2
  77. package/core/server/api/IService.ts +18 -6
  78. package/core/server/api/load-host-service.ts +3 -3
  79. package/core/server/host/content-security-policy.ts +190 -0
  80. package/core/server/host/csp-nonce-metadata.ts +75 -0
  81. package/core/server/host/resolve-host-request-hook.ts +5 -0
  82. package/core/server/host/server-page-assets.ts +10 -0
  83. package/core/server/index.ts +30 -1
  84. package/core/server/infra/cache/ServerFileCache.ts +1 -1
  85. package/core/server/mock/node/cli.mjs +2 -2
  86. package/core/server/registry/api-registry-store.ts +518 -0
  87. package/core/server/registry/conditional-object-store.ts +29 -0
  88. package/core/server/registry/declaration-precompiler.ts +129 -0
  89. package/core/server/registry/in-memory-conditional-object-store.ts +43 -0
  90. package/core/server/registry/index.ts +142 -0
  91. package/core/server/registry/page-registry-repository.ts +373 -0
  92. package/core/server/registry/page-registry-store.ts +903 -0
  93. package/core/server/registry/registry-error.ts +17 -0
  94. package/core/server/registry/registry-file-lock.ts +173 -0
  95. package/core/server/registry/registry-response.ts +71 -0
  96. package/core/server/registry/registry-subjects.ts +194 -0
  97. package/core/server/registry/registry-write-pipeline.ts +240 -0
  98. package/core/server/registry/request-body-limit.ts +99 -0
  99. package/core/server/registry/services/apis/Get.ts +25 -0
  100. package/core/server/registry/services/apis/List.ts +41 -0
  101. package/core/server/registry/services/apis/Register.ts +39 -0
  102. package/core/server/registry/services/apis/Unregister.ts +24 -0
  103. package/core/server/registry/services/index.ts +40 -0
  104. package/core/server/registry/services/pages/Get.ts +86 -0
  105. package/core/server/registry/services/pages/List.ts +53 -0
  106. package/core/server/registry/services/pages/Register.ts +49 -0
  107. package/core/server/registry/services/pages/Rollback.ts +36 -0
  108. package/core/server/registry/services/pages/Unregister.ts +23 -0
  109. package/core/server/registry/services/service-utils.ts +21 -0
  110. package/core/server/registry/validation/compile-gate.ts +71 -0
  111. package/core/server/registry/validation/component-existence.ts +55 -0
  112. package/core/server/registry/validation/credential-ban.ts +86 -0
  113. package/core/server/registry/validation/cross-check.ts +77 -0
  114. package/core/server/registry/validation/declaration-safety-scan.ts +102 -0
  115. package/core/shared/types/adaptive.types.ts +109 -0
  116. package/core/shared/types/component-contract.types.ts +110 -0
  117. package/core/shared/types/data-config.types.ts +105 -0
  118. package/core/shared/types/domain.types.ts +6 -0
  119. package/core/shared/types/engine.types.ts +41 -35
  120. package/core/shared/types/manifest.types.ts +55 -32
  121. package/core/shared/types/scope-manifest.types.ts +96 -0
  122. package/core/shared/types/style-config.types.ts +9 -0
  123. package/core/shared/types/ui-config.types.ts +118 -98
  124. package/dist/cli/soma.js +20 -5
  125. package/dist/core/index.cjs +5341 -894
  126. package/dist/types/build/compiler/full-manifest-builder.d.ts +4 -0
  127. package/dist/types/build/compiler/rollup-plugin-soma.d.ts +1 -0
  128. package/dist/types/build/compiler/soma-precompile.d.ts +9 -0
  129. package/dist/types/build/compiler/vite-plugin-soma.d.ts +3 -0
  130. package/dist/types/build/component/package-loader.d.ts +9 -0
  131. package/dist/types/build/eject/apply-eject.d.ts +22 -0
  132. package/dist/types/build/eject/plan-eject.d.ts +32 -0
  133. package/dist/types/client/adaptive/flush-scheduler.d.ts +13 -0
  134. package/dist/types/client/adaptive/hysteresis.d.ts +16 -0
  135. package/dist/types/client/adaptive/index.d.ts +5 -0
  136. package/dist/types/client/adaptive/observer-pool.d.ts +15 -0
  137. package/dist/types/client/base/SomaPageRootBase.d.ts +33 -0
  138. package/dist/types/client/compiler/adaptive-compile.d.ts +26 -0
  139. package/dist/types/client/compiler/manifest-compiler.d.ts +13 -2
  140. package/dist/types/client/component/ai-catalog.d.ts +73 -0
  141. package/dist/types/client/component/component-definition.types.d.ts +54 -0
  142. package/dist/types/client/component/component-expander.d.ts +25 -0
  143. package/dist/types/client/component/component-manager.d.ts +160 -0
  144. package/dist/types/client/component/component-pack.d.ts +90 -0
  145. package/dist/types/client/component/component-registry.d.ts +12 -0
  146. package/dist/types/client/component/pack-styles.d.ts +22 -0
  147. package/dist/types/client/component/scoped-adapter.d.ts +18 -0
  148. package/dist/types/client/component/verify-pack.d.ts +14 -0
  149. package/dist/types/client/data/data-object-resolver.d.ts +71 -0
  150. package/dist/types/client/diagnostics/SomaDiagnostics.d.ts +2 -1
  151. package/dist/types/client/diagnostics/boot-timings.d.ts +30 -0
  152. package/dist/types/client/engine/asset-resolver.d.ts +7 -1
  153. package/dist/types/client/engine/dom-renderer.d.ts +49 -1
  154. package/dist/types/client/engine/emit-event.d.ts +6 -0
  155. package/dist/types/client/engine/event-engine.d.ts +6 -0
  156. package/dist/types/client/engine/render-engine.d.ts +25 -1
  157. package/dist/types/client/engine/runtime-builder.d.ts +7 -0
  158. package/dist/types/client/engine/soma-bootstrap.d.ts +116 -0
  159. package/dist/types/client/observability/error-reporter.d.ts +51 -0
  160. package/dist/types/client/parser/adaptive-parser.d.ts +28 -0
  161. package/dist/types/client/parser/data-config-parser.d.ts +34 -0
  162. package/dist/types/client/parser/pipeline-parser.d.ts +2 -0
  163. package/dist/types/client/parser/style-config-parser.d.ts +5 -3
  164. package/dist/types/client/parser/ui-config-parser.d.ts +22 -1
  165. package/dist/types/client/pipes/pipe-registry.d.ts +38 -0
  166. package/dist/types/client/registry/declaration-renderer.d.ts +51 -0
  167. package/dist/types/client/registry/index.d.ts +10 -0
  168. package/dist/types/client/registry/page-lifecycle.d.ts +61 -0
  169. package/dist/types/client/registry/remote-page.d.ts +52 -0
  170. package/dist/types/client/runtime/SomaRuntimeServices.d.ts +16 -0
  171. package/dist/types/client/security/attribute-presence.d.ts +7 -0
  172. package/dist/types/client/security/html-sanitizer.d.ts +37 -0
  173. package/dist/types/client/security/url-guard.d.ts +11 -0
  174. package/dist/types/client/theme/theme-engine.d.ts +49 -0
  175. package/dist/types/client/typography/typography-base.d.ts +15 -0
  176. package/dist/types/client/validation/contract-validator.d.ts +2 -0
  177. package/dist/types/index.d.ts +36 -2
  178. package/dist/types/server/api/IService.d.ts +18 -6
  179. package/dist/types/server/host/content-security-policy.d.ts +53 -0
  180. package/dist/types/server/host/csp-nonce-metadata.d.ts +32 -0
  181. package/dist/types/server/host/resolve-host-request-hook.d.ts +5 -0
  182. package/dist/types/server/host/server-page-assets.d.ts +5 -0
  183. package/dist/types/server/index.d.ts +4 -1
  184. package/dist/types/server/registry/api-registry-store.d.ts +141 -0
  185. package/dist/types/server/registry/conditional-object-store.d.ts +27 -0
  186. package/dist/types/server/registry/declaration-precompiler.d.ts +30 -0
  187. package/dist/types/server/registry/in-memory-conditional-object-store.d.ts +8 -0
  188. package/dist/types/server/registry/index.d.ts +29 -0
  189. package/dist/types/server/registry/page-registry-repository.d.ts +58 -0
  190. package/dist/types/server/registry/page-registry-store.d.ts +259 -0
  191. package/dist/types/server/registry/registry-error.d.ts +12 -0
  192. package/dist/types/server/registry/registry-file-lock.d.ts +20 -0
  193. package/dist/types/server/registry/registry-response.d.ts +18 -0
  194. package/dist/types/server/registry/registry-subjects.d.ts +59 -0
  195. package/dist/types/server/registry/registry-write-pipeline.d.ts +48 -0
  196. package/dist/types/server/registry/request-body-limit.d.ts +31 -0
  197. package/dist/types/server/registry/services/apis/Get.d.ts +10 -0
  198. package/dist/types/server/registry/services/apis/List.d.ts +10 -0
  199. package/dist/types/server/registry/services/apis/Register.d.ts +13 -0
  200. package/dist/types/server/registry/services/apis/Unregister.d.ts +12 -0
  201. package/dist/types/server/registry/services/index.d.ts +3 -0
  202. package/dist/types/server/registry/services/pages/Get.d.ts +10 -0
  203. package/dist/types/server/registry/services/pages/List.d.ts +13 -0
  204. package/dist/types/server/registry/services/pages/Register.d.ts +11 -0
  205. package/dist/types/server/registry/services/pages/Rollback.d.ts +9 -0
  206. package/dist/types/server/registry/services/pages/Unregister.d.ts +9 -0
  207. package/dist/types/server/registry/services/service-utils.d.ts +10 -0
  208. package/dist/types/server/registry/validation/compile-gate.d.ts +10 -0
  209. package/dist/types/server/registry/validation/component-existence.d.ts +14 -0
  210. package/dist/types/server/registry/validation/credential-ban.d.ts +15 -0
  211. package/dist/types/server/registry/validation/cross-check.d.ts +16 -0
  212. package/dist/types/server/registry/validation/declaration-safety-scan.d.ts +15 -0
  213. package/dist/types/shared/types/adaptive.types.d.ts +88 -0
  214. package/dist/types/shared/types/component-contract.types.d.ts +68 -0
  215. package/dist/types/shared/types/data-config.types.d.ts +81 -0
  216. package/dist/types/shared/types/domain.types.d.ts +6 -0
  217. package/dist/types/shared/types/engine.types.d.ts +6 -0
  218. package/dist/types/shared/types/manifest.types.d.ts +23 -0
  219. package/dist/types/shared/types/scope-manifest.types.d.ts +82 -0
  220. package/dist/types/shared/types/style-config.types.d.ts +8 -0
  221. package/dist/types/shared/types/ui-config.types.d.ts +20 -0
  222. package/global.d.ts +4 -0
  223. package/next.config.js +76 -1
  224. package/package.json +32 -11
  225. package/proxy.ts +62 -0
  226. package/core/client/engine/theme-variables.ts +0 -37
  227. package/dist/tsconfig.types.tsbuildinfo +0 -1
  228. package/dist/types/client/engine/theme-variables.d.ts +0 -3
  229. package/middleware.ts +0 -33
@@ -0,0 +1,51 @@
1
+ /** 页面身份:错误归因的最小事实 */
2
+ export interface SomaPageIdentity {
3
+ /** 页面名(声明仓库里的 name;文件态页面用路由路径) */
4
+ name: string;
5
+ /** 声明版本号(声明态页面才有) */
6
+ version?: number;
7
+ /** 声明来源:file=文件态四件套 / registry=声明仓库 / preview=即时预览 */
8
+ source?: 'file' | 'registry' | 'preview';
9
+ }
10
+ /** 规范化后的错误事件 */
11
+ export interface SomaErrorEvent {
12
+ kind: 'runtime' | 'promise' | 'resource';
13
+ message: string;
14
+ stack?: string;
15
+ /** 资源类错误的地址 */
16
+ source?: string;
17
+ line?: number;
18
+ column?: number;
19
+ page: SomaPageIdentity;
20
+ /** 事件时间(毫秒时间戳,由采集器打点) */
21
+ at: number;
22
+ /** 页面地址(去掉 hash 与 query 的路径部分,避免带出敏感参数) */
23
+ path?: string;
24
+ }
25
+ export interface SomaErrorReporterOptions {
26
+ page: SomaPageIdentity;
27
+ /** 上报通道:Host 注入(接口/console/第三方 SDK 皆可) */
28
+ report: (event: SomaErrorEvent) => void;
29
+ /** 同签名错误的去重窗口(毫秒,默认 60s) */
30
+ dedupeWindowMs?: number;
31
+ /** 单页最多上报条数(默认 50,防错误风暴) */
32
+ maxEvents?: number;
33
+ }
34
+ export interface SomaErrorReporterHandle {
35
+ /** 更新页面身份(发布新版本后重渲时调用) */
36
+ setPage(page: SomaPageIdentity): void;
37
+ /** 手动上报一条(业务侧捕获的异常也能进同一通道) */
38
+ capture(error: unknown, kind?: SomaErrorEvent['kind']): void;
39
+ /** 卸载全局监听 */
40
+ dispose(): void;
41
+ }
42
+ /**
43
+ * 安装前端错误采集器。返回句柄用于更新页面身份与卸载。
44
+ *
45
+ * 用法(Host 侧):
46
+ * const reporter = installSomaErrorReporter({
47
+ * page: { name: 'order-console', version: 3, source: 'registry' },
48
+ * report: (e) => navigator.sendBeacon('/api/observability/error', JSON.stringify(e)),
49
+ * });
50
+ */
51
+ export declare function installSomaErrorReporter(options: SomaErrorReporterOptions): SomaErrorReporterHandle;
@@ -0,0 +1,28 @@
1
+ import { type SomaAdaptiveConfig, type SomaAdaptiveVocabulary } from '../../shared/types/adaptive.types';
2
+ /** 阶梯声明错误(ERR-02):携带违规位置,文案必须给出合法取值或接线点 */
3
+ export declare class SomaAdaptiveConfigError extends Error {
4
+ readonly path: string;
5
+ constructor(message: string, path?: string);
6
+ }
7
+ /**
8
+ * 合并多份词汇来源为一张词汇表。
9
+ *
10
+ * 同名级语义被注册两次即显式冲突报错,不做"后者覆盖前者"——
11
+ * 静默覆盖会让"实际生效的级语义"取决于注册顺序,那是第二份事实。
12
+ */
13
+ export declare function createAdaptiveVocabulary(...sources: SomaAdaptiveVocabulary[]): SomaAdaptiveVocabulary;
14
+ /**
15
+ * 解析并校验 `_ui.yaml` 顶层 `adaptive` 键。
16
+ *
17
+ * 解析期四项快速失败校验(F-08):
18
+ * 1. 级数 ≤ 5;
19
+ * 2. 每一级的槽与级值 ∈ 已注册词汇表(词汇未注册 = 词汇未知);
20
+ * 3. pin 条目合法且不重复;
21
+ * 4. pin 与 ladder 冲突(同槽既被钉住又被列入降级序)即非法。
22
+ *
23
+ * `pin` 与 ladder 槽的**锚点存在性**不在此校验——解析期看不到 DOM,
24
+ * 那一项在编译期做(见 adaptive-compile.ts),归属仍是 F-08。
25
+ */
26
+ export declare function parseAdaptiveConfig(raw: unknown, vocabulary?: SomaAdaptiveVocabulary, path?: string, options?: {
27
+ vocabularyRequired?: boolean;
28
+ }): SomaAdaptiveConfig;
@@ -0,0 +1,34 @@
1
+ import type { SomaDataConfig } from '../../shared/types/data-config.types';
2
+ export declare class SomaDataConfigError extends Error {
3
+ readonly path: string;
4
+ constructor(message: string, path?: string);
5
+ }
6
+ /** 解析后的 `$` 引用:三源之一 + 字段路径段 */
7
+ export interface SomaDataRef {
8
+ /** query:URL 参数;page:Domain 字段;object:已解析数据对象 */
9
+ source: 'query' | 'page' | 'object';
10
+ /** source 为 object 时的对象名 */
11
+ object?: string;
12
+ /** 引用的字段路径段(`$order.trace.no` → ['trace', 'no']) */
13
+ path: string[];
14
+ }
15
+ /**
16
+ * 解析 `$` 引用语法:`$query.<键>` / `$page.<路径>` / `$<数据对象>.<字段路径>`。
17
+ * 语法非法时返回 null(由调用方按上下文报带定位的声明错误)。
18
+ */
19
+ export declare function parseDataRef(text: string): SomaDataRef | null;
20
+ /**
21
+ * 归一化 transform 值中的管道段:规格允许 `date: 'YYYY-MM-DD'` 的冒号简写,
22
+ * 统一改写成 pipe-registry 的标准语法 `date('YYYY-MM-DD')` 后复用其解析器。
23
+ * 首段(字段路径)原样保留。
24
+ */
25
+ export declare function normalizeDataPipeValue(rawValue: string): string;
26
+ /**
27
+ * 解析 *_data.yaml 的原始对象(yaml.load 产物)→ SomaDataConfig。
28
+ * 空输入(null/undefined)返回空声明;结构非法抛 SomaDataConfigError。
29
+ */
30
+ export declare function parseDataConfig(raw: unknown): SomaDataConfig;
31
+ /**
32
+ * 解析 *_data.yaml 字符串 → SomaDataConfig(运行时字符串模式入口)。
33
+ */
34
+ export declare function parseDataYaml(yamlStr: string): SomaDataConfig;
@@ -7,6 +7,8 @@ export declare class SomaEventParseError extends Error {
7
7
  readonly rawExpression: string;
8
8
  constructor(message: string, rawExpression: string);
9
9
  }
10
+ /** 是否为已知 DOM 事件(组件管理器区分 DOM 订阅与疑似 emit 订阅用) */
11
+ export declare function isKnownDomEvent(name: string): boolean;
10
12
  /**
11
13
  * 解析事件选择器字符串
12
14
  *
@@ -1,7 +1,9 @@
1
- import type { StyleConfig } from '../../shared/types/style-config.types';
1
+ import type { SomaStyleViolationKind, StyleConfig } from '../../shared/types/style-config.types';
2
2
  export declare class SomaStyleConfigError extends Error {
3
3
  readonly path: string;
4
- constructor(message: string, path?: string);
4
+ /** 违规类别;仅结构化校验失败时缺省(那类失败没有"类别"可言) */
5
+ readonly kind?: SomaStyleViolationKind;
6
+ constructor(message: string, path?: string, kind?: SomaStyleViolationKind);
5
7
  }
6
8
  /**
7
9
  * 将 YAML 解析后的原始对象转换为类型安全的 StyleConfig
@@ -11,7 +13,7 @@ export declare class SomaStyleConfigError extends Error {
11
13
  * - base 的值必须是纯 Tailwind 类名字符串
12
14
  * - states 的 condition 必须是纯属性路径,value 必须是基础类型
13
15
  * - transitions 的 trigger 必须是有效枚举值
14
- * - themes 仅允许覆盖视觉类名,不可引入新的布局类
16
+ * - base / themes 命中布局类模式即失败;states / transitions 放行显隐对(F-06)
15
17
  *
16
18
  * @param raw - YAML 解析后的原始对象
17
19
  * @returns 类型安全的 StyleConfig
@@ -1,4 +1,5 @@
1
1
  import type { UiConfig, ShowMapping, ParsedShowEntry } from '../../shared/types/ui-config.types';
2
+ import type { SomaAdaptiveVocabulary } from '../../shared/types/adaptive.types';
2
3
  /**
3
4
  * UI 配置解析错误
4
5
  * 携带错误路径信息以便定位问题
@@ -7,6 +8,23 @@ export declare class SomaUiConfigError extends Error {
7
8
  readonly path: string;
8
9
  constructor(message: string, path?: string);
9
10
  }
11
+ export interface SomaUiConfigParseOptions {
12
+ /**
13
+ * 阶梯词汇表(F-09)。core 不内置任何级语义,词汇由宿主 bootstrap 注入;
14
+ * 不传而页面声明了 `adaptive.ladder` 时,按"词汇未知"快速失败。
15
+ */
16
+ adaptiveVocabulary?: SomaAdaptiveVocabulary;
17
+ /**
18
+ * 词汇是否必须在本次解析时到位。默认 true(页面装载路径)。
19
+ *
20
+ * 构建期预编译是唯一的 false 场景:那一刻宿主 bootstrap 尚未加载,
21
+ * 词汇无处可取。此时结构校验(级数 / 单键 / pin 冲突 / profile)照做,
22
+ * 只把**词汇归属**这一项推迟到编译期 `compileAdaptive` ——
23
+ * 那里词汇必然在手,未注册同样报错、同样指路,
24
+ * 所以推迟的是报错时机,不是报错本身。
25
+ */
26
+ adaptiveVocabularyRequired?: boolean;
27
+ }
10
28
  /**
11
29
  * 将 YAML 解析后的原始对象转换为类型安全的 UiConfig
12
30
  *
@@ -16,12 +34,15 @@ export declare class SomaUiConfigError extends Error {
16
34
  * - show 键不能为空
17
35
  * - 嵌套绑定的 bind 和 show 必须成对出现
18
36
  * - 处理 somaId@attr 扩展语法
37
+ * - 可选的 adaptive 保留键按阶梯 schema 校验(缺席则完全旁路,产物不变)
19
38
  *
20
39
  * @param raw - YAML 解析后的原始对象(通常来自 yaml-loader)
40
+ * @param options - 解析上下文;adaptiveVocabulary 由宿主 bootstrap 注入
21
41
  * @returns 类型安全的 UiConfig 对象
22
42
  * @throws SomaUiConfigError 格式不合法时抛出
43
+ * @throws SomaAdaptiveConfigError adaptive 声明不合法时抛出
23
44
  */
24
- export declare function parseUiConfig(raw: any): UiConfig;
45
+ export declare function parseUiConfig(raw: any, options?: SomaUiConfigParseOptions): UiConfig;
25
46
  /**
26
47
  * 解析 show 键中的 somaId@attr 语法
27
48
  *
@@ -0,0 +1,38 @@
1
+ import type { SomaPipeCall } from '../../shared/types/scope-manifest.types';
2
+ export interface SomaPipeContext {
3
+ /** 读取绑定路径当前值(页面作用域=根实例;行作用域=行数据语义) */
4
+ read(path: string): unknown;
5
+ /** 当前 locale 表(货币符号、免费文案等本地化取值) */
6
+ locale(): Record<string, unknown> | undefined;
7
+ }
8
+ /** 管道函数:纯函数,入值 + 已求值实参 → 展示字符串 */
9
+ export type SomaPipeFn = (value: unknown, args: Record<string, unknown>, ctx: SomaPipeContext) => string;
10
+ export declare class SomaPipeError extends Error {
11
+ constructor(message: string);
12
+ }
13
+ export interface ParsedPipedValue {
14
+ /** 管道前的绑定路径(原样,未经 resolver) */
15
+ basePath: string;
16
+ pipes: SomaPipeCall[];
17
+ /** 实参中的绑定路径(原样),供 watchPaths 注册 */
18
+ argPaths: string[];
19
+ }
20
+ /** 值是否携带管道(展示位置专用判断) */
21
+ export declare function hasPipes(rawValue: string): boolean;
22
+ /**
23
+ * 解析 `path | pipe1 | pipe2(k: v, 字面量)` 形式的值。
24
+ * 实参判定:首段是已注册 var 的视为绑定路径,其余为字面量(数字/布尔自动转型)。
25
+ * 结果按原始串缓存(编译路径与行内解释路径共享)。
26
+ */
27
+ export declare function parsePipedValue(rawValue: string, hasVar: (seg: string) => boolean): ParsedPipedValue;
28
+ export declare class SomaPipeRegistry {
29
+ private readonly fns;
30
+ constructor(custom?: Record<string, SomaPipeFn>);
31
+ has(name: string): boolean;
32
+ /** 编译期白名单校验:未注册名直接抛错(fail fast) */
33
+ assertKnown(pipes: SomaPipeCall[], where: string): void;
34
+ /** 链式应用(从左到右);单个管道异常时降级为原值字符串并告警,不中断渲染 */
35
+ apply(value: unknown, pipes: SomaPipeCall[], ctx: SomaPipeContext): string;
36
+ }
37
+ /** 默认注册表(仅内置管道),未传自定义管道时全局共享 */
38
+ export declare const defaultPipeRegistry: SomaPipeRegistry;
@@ -0,0 +1,51 @@
1
+ import type { SomaComponentDefinition } from '../component/component-definition.types';
2
+ import type { SomaAdaptiveVocabulary } from '../../shared/types/adaptive.types';
3
+ import type { SomaErrorEvent, SomaPageIdentity } from '../observability/error-reporter';
4
+ /**
5
+ * 注册中心落库的预编译产物(P-a)。渲染时若版本对得上就直接喂给引擎,省掉一次 YAML 解析;
6
+ * 对不上则整份忽略——**缓存不是真理**,拿旧编译器的产物渲染新语义比慢一点危险得多。
7
+ */
8
+ export interface PrecompiledDeclarationAssets {
9
+ uiConfig?: unknown;
10
+ eventConfig?: unknown;
11
+ triggerConfig?: unknown;
12
+ timerConfig?: unknown;
13
+ styleConfig?: unknown;
14
+ dataConfig?: unknown;
15
+ }
16
+ export interface GeneratedPageDeclarations {
17
+ html: string;
18
+ uiYaml: string;
19
+ eventYaml?: string;
20
+ styleYaml?: string;
21
+ }
22
+ /**
23
+ * 错误采集开关(默认关闭)。
24
+ * 声明态页面是"注册即生效"的——出错时唯一有价值的问题是"哪个版本引入的"。
25
+ * 页面名与版本号只有渲染通道知道,不在这里盖戳,后面任何一层都补不回来。
26
+ */
27
+ export interface PreviewObservabilityOptions {
28
+ /** 页面身份缺省值;renderPublishedPage 会用真实的 name@version 覆盖 */
29
+ page?: SomaPageIdentity;
30
+ /** 上报通道;缺省走 soma-core 的 console 单行 JSON 通道 */
31
+ report?: (event: SomaErrorEvent) => void;
32
+ /** 同签名错误去重窗口(毫秒) */
33
+ dedupeWindowMs?: number;
34
+ /** 单页上报条数上限 */
35
+ maxEvents?: number;
36
+ }
37
+ export interface GeneratedPagePreviewOptions {
38
+ /** 给了就开启错误采集(`{ observability: {} }` 即为一行开启,用默认通道) */
39
+ observability?: PreviewObservabilityOptions;
40
+ /** 页面声明含 adaptive.ladder 时由 Host 注入的组件词汇。 */
41
+ adaptiveVocabulary?: SomaAdaptiveVocabulary;
42
+ }
43
+ export interface PreviewHandle {
44
+ /**
45
+ * 用新产物重新渲染(先卸载旧页面)。
46
+ * page 传入时覆盖本次渲染的页面身份——发布页拉到版本号后才知道该盖什么戳。
47
+ */
48
+ render(decl: GeneratedPageDeclarations, page?: SomaPageIdentity, compiled?: PrecompiledDeclarationAssets): Promise<void>;
49
+ destroy(): Promise<void>;
50
+ }
51
+ export declare function createGeneratedPagePreview(target: HTMLElement | string, components: Record<string, SomaComponentDefinition>, options?: GeneratedPagePreviewOptions): PreviewHandle;
@@ -0,0 +1,10 @@
1
+ /**
2
+ * 运行时注册中心(客户端桶,'soma-core/registry')。
3
+ *
4
+ * REQ-002:声明 → 运行页面是引擎能力。两条消费路径:
5
+ * - createGeneratedPagePreview:拿着内存里的声明直接渲染(生成即渲、应用自组织的临时页);
6
+ * - renderPublishedPage:按名从注册中心拉取声明再渲染(注册即生效的共享页)。
7
+ */
8
+ export { createGeneratedPagePreview, type GeneratedPageDeclarations, type GeneratedPagePreviewOptions, type PrecompiledDeclarationAssets, type PreviewHandle, type PreviewObservabilityOptions, } from './declaration-renderer';
9
+ export { createSomaPageLifecycle, SomaPageLifecycle, type MountedPageInfo, type RegisterDeclarationOptions, type SomaPageLifecycleOptions, } from './page-lifecycle';
10
+ export { renderPublishedPage, type PublishedPageHandle, type PublishedPageRecord, type RenderPublishedPageOptions, } from './remote-page';
@@ -0,0 +1,61 @@
1
+ import type { SomaComponentDefinition } from '../component/component-definition.types';
2
+ import type { SomaAdaptiveVocabulary } from '../../shared/types/adaptive.types';
3
+ import type { SomaPageIdentity } from '../observability/error-reporter';
4
+ import { type GeneratedPageDeclarations, type PrecompiledDeclarationAssets, type PreviewObservabilityOptions } from './declaration-renderer';
5
+ export interface SomaPageLifecycleOptions {
6
+ /** 组件定义表(通常是 createSomaUiComponents() 加宿主自治组件) */
7
+ components: Record<string, SomaComponentDefinition>;
8
+ /** 页面声明含 adaptive.ladder 时由 Host 注入的组件词汇 */
9
+ adaptiveVocabulary?: SomaAdaptiveVocabulary;
10
+ /** 错误采集(默认关闭);页面身份会自动盖上注册名 */
11
+ observability?: PreviewObservabilityOptions;
12
+ }
13
+ export interface RegisterDeclarationOptions {
14
+ /** 预编译产物(注册中心取页时会带回来),有就省一次解析 */
15
+ compiled?: PrecompiledDeclarationAssets;
16
+ /** 页面身份戳(缺省用注册名);注册中心来的声明应带上真实版本号 */
17
+ page?: SomaPageIdentity;
18
+ }
19
+ export interface MountedPageInfo {
20
+ /** 注册名 */
21
+ name: string;
22
+ /** 挂载点 id */
23
+ mountId: string;
24
+ }
25
+ /**
26
+ * 实例表。**纯内存、纯客户端**:进程内活着,刷新即空——
27
+ * 需要跨刷新存活的声明属于注册中心那一侧的事(按名拉取)。
28
+ */
29
+ export declare class SomaPageLifecycle {
30
+ private readonly options;
31
+ private readonly entries;
32
+ constructor(options: SomaPageLifecycleOptions);
33
+ /**
34
+ * 登记一份声明(同名即替换)。替换时会先把它已有的挂载全部卸掉——
35
+ * 否则屏幕上留着旧内容而表里已是新声明,是最难查的那类不一致。
36
+ */
37
+ register(name: string, declaration: GeneratedPageDeclarations, options?: RegisterDeclarationOptions): Promise<void>;
38
+ /** 这个名字登记过吗 */
39
+ has(name: string): boolean;
40
+ /** 已登记的名字(按登记顺序) */
41
+ names(): string[];
42
+ /** 当前挂着的实例清单(名字 + 挂载点) */
43
+ mounted(): MountedPageInfo[];
44
+ /**
45
+ * 把已登记的声明挂到某个挂载点。
46
+ * 同一挂载点重复 mount 会先卸掉那里的旧实例(挂载点是唯一的,不叠加)。
47
+ */
48
+ mount(name: string, mountId: string): Promise<void>;
49
+ /**
50
+ * 卸载。给 mountId 只卸那一处,不给则卸这个名字的全部实例。
51
+ * 卸载**必须真还内存**:句柄 destroy 会 unmount 引擎并清空挂载点 DOM,
52
+ * 这里再把句柄从表里删掉——表还拿着引用,GC 就收不走。
53
+ */
54
+ unmount(name: string, mountId?: string): Promise<void>;
55
+ /** 注销:先卸全部实例,再把声明从表里丢掉 */
56
+ unregister(name: string): Promise<void>;
57
+ /** 全清:页面离开时调一次,别把整张表连同声明一起漏在内存里 */
58
+ destroyAll(): Promise<void>;
59
+ }
60
+ /** 建一个实例表(与 createSomaUiComponents() 一起用) */
61
+ export declare function createSomaPageLifecycle(options: SomaPageLifecycleOptions): SomaPageLifecycle;
@@ -0,0 +1,52 @@
1
+ import type { SomaComponentDefinition } from '../component/component-definition.types';
2
+ import type { SomaAdaptiveVocabulary } from '../../shared/types/adaptive.types';
3
+ import { type GeneratedPageDeclarations, type PrecompiledDeclarationAssets, type PreviewObservabilityOptions } from './declaration-renderer';
4
+ /** 服务端返回的版本记录(与注册中心 PageVersionRecord 同构) */
5
+ export interface PublishedPageRecord {
6
+ name: string;
7
+ version: number;
8
+ declaration: GeneratedPageDeclarations & {
9
+ notes?: string;
10
+ };
11
+ status: 'published' | 'draft';
12
+ createdAt: number;
13
+ /**
14
+ * 注册期预编译产物(P-a)。服务端已做过版本闸:发下来就是能用的,
15
+ * 没发下来就说明版本对不上或压根没编译过——客户端照常运行时解析。
16
+ */
17
+ compiled?: PrecompiledDeclarationAssets;
18
+ }
19
+ export interface RenderPublishedPageOptions {
20
+ /** 指定版本号;缺省拉最新 published 版本 */
21
+ version?: number;
22
+ /** 可注入 fetch(测试 / 自定义传输),默认 globalThis.fetch */
23
+ http?: typeof globalThis.fetch;
24
+ /** 拉取端点,默认 /api/soma-registry/pages/get */
25
+ endpoint?: string;
26
+ /**
27
+ * 非敏感请求头(例如 Host 的页面来源标识)。用于让服务端能力网关识别调用页面;
28
+ * 禁止放 Authorization、签名密钥或任何长期凭据。
29
+ */
30
+ requestHeaders?: Readonly<Record<string, string>>;
31
+ /**
32
+ * 错误采集(默认关闭;给了就开启,`observability: {}` 即为一行开启)。
33
+ * 页面身份由本函数按拉取结果自动盖戳 `{ name, version, source: 'registry' }`——
34
+ * 声明可以随时注册新版本,只有这里知道渲染的究竟是哪一版。
35
+ */
36
+ observability?: PreviewObservabilityOptions;
37
+ /** 页面声明含 adaptive.ladder 时由 Host 注入的组件词汇。 */
38
+ adaptiveVocabulary?: SomaAdaptiveVocabulary;
39
+ }
40
+ export interface PublishedPageHandle {
41
+ /** 实际渲染的页面名 */
42
+ name: string;
43
+ /** 实际渲染的版本号(缺省拉取时即最新 published 版本) */
44
+ version: number;
45
+ /** 卸载页面并清空挂载点 */
46
+ destroy(): Promise<void>;
47
+ }
48
+ /**
49
+ * 拉取注册页面声明并渲染到 mountId 对应的挂载点。
50
+ * 任何拉取 / 解析失败都会抛出带页面名上下文的 Error(调用方 catch 后兜底展示)。
51
+ */
52
+ export declare function renderPublishedPage(mountId: string, name: string, components: Record<string, SomaComponentDefinition>, options?: RenderPublishedPageOptions): Promise<PublishedPageHandle>;
@@ -27,6 +27,22 @@ export interface SomaRuntimeServices {
27
27
  permission: SomaPermission;
28
28
  i18n: DefaultI18n;
29
29
  realtime: IRealtimeService;
30
+ /**
31
+ * 界面中途提交:把此刻改过的页面状态立刻上屏,**不结束**当前事件事务。
32
+ *
33
+ * 存在的理由:一次事件 = 一次原子提交是刻意的设计(避免中间态闪烁、出错整体回滚),
34
+ * 代价是**长任务里的中途进展播不出去**——实测 AI 生成 P50 约 40 秒,期间 Domain
35
+ * 改多少次状态,界面一次都不动,连"生成中"都看不到。
36
+ *
37
+ * 它是**自愿**的:不调用,行为与过去逐字节一致;调用了,就等于声明
38
+ * "已上屏的这部分不再享有失败回滚"。这个取舍只能由业务自己做。
39
+ * 引擎未接线时(纯 Node 单测、无渲染宿主)为空操作,调用方不必判空。
40
+ */
41
+ ui: SomaUiService;
42
+ }
43
+ /** 界面中途提交服务(见 SomaRuntimeServices.ui) */
44
+ export interface SomaUiService {
45
+ publish(): Promise<void>;
30
46
  }
31
47
  export declare function createDefaultRuntimeServices(options?: {
32
48
  appConfig?: unknown;
@@ -0,0 +1,7 @@
1
+ /** 空串是否意味着「删除该属性」 */
2
+ export declare function isAbsentWhenEmpty(attrName: string): boolean;
3
+ /**
4
+ * 属性写入前的存在性判定。
5
+ * 返回 true = 应删除属性(而非写入空串)。
6
+ */
7
+ export declare function shouldRemoveAttribute(attrName: string, value: string): boolean;
@@ -0,0 +1,37 @@
1
+ /** 宿主可注入的净化器最小面:一个纯函数级的 sanitize */
2
+ export interface SomaHtmlSanitizer {
3
+ sanitize(html: string): string;
4
+ }
5
+ /**
6
+ * 统一 sanitize 策略:全站一份,不许各页面自配。
7
+ *
8
+ * 取舍说明:
9
+ * - `script` / `style` 一律剔除——声明态页面的样式走 `_style.yaml` 与主题令牌,
10
+ * 富文本里出现 `<style>` 只可能是越权改版面(模板纯度闸门在手写侧也是这条规矩);
11
+ * - `style` 属性剔除:内联样式既是 CSP `style-src` 的敌人,也是颜色纪律的漏口;
12
+ * - 表单/框架类标签剔除:富文本没有合法理由携带 `<form>` / `<iframe>` / `<base>`;
13
+ * - `ALLOW_DATA_ATTR: false`:data-soma-* 是引擎的锚点命名空间,不能被内容伪造。
14
+ * DOMPurify 默认已剔除 on* 事件属性与 `javascript:` URL,此处不重复声明,只做加严。
15
+ */
16
+ export declare const SOMA_PURIFY_PROFILE: Record<string, unknown>;
17
+ /**
18
+ * 宿主注入净化器(在 bootstrap 里调用一次)。
19
+ * 传 null 复位为「未注入」,便于测试与运行期关停。
20
+ */
21
+ export declare function setSomaHtmlSanitizer(sanitizer: SomaHtmlSanitizer | null): void;
22
+ /** 当前生效的净化器;返回 null 表示将走转义降级 */
23
+ export declare function resolveSomaHtmlSanitizer(): SomaHtmlSanitizer | null;
24
+ /** 纯字符串转义,不经 DOM——降级路径与非 Web 容器共用 */
25
+ export declare function escapeSomaHtml(value: string): string;
26
+ /** 净化结果:`sanitized=false` 表示走了转义降级(内容以纯文本呈现) */
27
+ export interface SomaHtmlSanitizeResult {
28
+ html: string;
29
+ sanitized: boolean;
30
+ }
31
+ /**
32
+ * `@html` 落地前的统一净化。
33
+ *
34
+ * 降级时给一次 console.warn(只警告一次,避免长列表刷屏):
35
+ * 静默降级会让富文本页面「显示成源码」而没人知道为什么,这是实测最难排查的一类困惑。
36
+ */
37
+ export declare function sanitizeSomaHtml(value: string): SomaHtmlSanitizeResult;
@@ -0,0 +1,11 @@
1
+ /** 拦截后写入的安全占位值 */
2
+ export declare const BLOCKED_URL_PLACEHOLDER = "about:blank";
3
+ /** 事件处理器属性(onclick/onerror/…):DSL 永不允许通过绑定写入 */
4
+ export declare function isEventHandlerAttribute(attrName: string): boolean;
5
+ /** 该属性值是否含危险 scheme */
6
+ export declare function hasBlockedScheme(attrName: string, value: string): boolean;
7
+ /**
8
+ * 属性写入前的统一净化。
9
+ * 返回 null = 该属性禁止写入(事件处理器);否则返回应写入的值(可能被替换为占位值)。
10
+ */
11
+ export declare function sanitizeAttributeWrite(attrName: string, value: string): string | null;
@@ -0,0 +1,49 @@
1
+ export interface SomaThemeInput {
2
+ /** 品牌主色(#rgb / #rrggbb) */
3
+ brand: string;
4
+ /** 中性灰气质:warm 暖灰 / cool 冷灰 / neutral 跟随品牌色相(默认) */
5
+ mode?: 'warm' | 'cool' | 'neutral';
6
+ /** 应用暗色令牌(applyTheme 时生效;deriveTheme 恒产出亮暗两套) */
7
+ dark?: boolean;
8
+ /** 逐令牌精调通道:最后合并进 cssVars 与 darkCssVars,优先级最高(亮暗同时生效) */
9
+ overrides?: Record<string, string>;
10
+ }
11
+ export interface SomaDerivedTheme {
12
+ /** 品牌色阶 50~950(11 档 hex) */
13
+ scale: Record<string, string>;
14
+ /** 语义令牌 → CSS 变量表(--soma-*),soma-ui 全组件消费面(亮色) */
15
+ cssVars: Record<string, string>;
16
+ /** 暗色令牌(同名变量的暗色重映射:主色提亮、深色基底、文字反转) */
17
+ darkCssVars: Record<string, string>;
18
+ /** 对比度报告:主色上文字的 WCAG 对比度(亮/暗均保障 ≥ 4.5) */
19
+ contrast: {
20
+ primaryFg: number;
21
+ darkPrimaryFg: number;
22
+ };
23
+ }
24
+ interface Oklch {
25
+ l: number;
26
+ c: number;
27
+ h: number;
28
+ }
29
+ export declare function hexToOklch(hex: string): Oklch;
30
+ /** OKLCH → hex;超 sRGB 色域时压缩 chroma 直到入域(保色相/亮度) */
31
+ export declare function oklchToHex(color: Oklch): string;
32
+ export declare function contrastRatio(hexA: string, hexB: string): number;
33
+ export declare function deriveTheme(input: SomaThemeInput): SomaDerivedTheme;
34
+ /**
35
+ * 换肤期间挂在根节点上的过渡抑制类名(生产化强化 §6,作业单 P-4)。
36
+ *
37
+ * 为什么需要:一次换肤要改 86 个 CSS 变量,而组件库里大量元素带 `transition`
38
+ * (按钮/输入框的 background、border、color 都在过渡列表里)。变量一改,
39
+ * 这些元素会同时进入过渡——视觉上是"整页缓慢褪色",且几百个元素并发过渡实打实吃 CPU。
40
+ * 换肤是一次状态切换,不是一次交互反馈,它本来就不该有动画。
41
+ *
42
+ * 配套 CSS 规则由 soma-ui 的聚合样式表提供(`THEME_SWITCHING_CSS`):
43
+ * 类名是两包之间的契约,改名要两边一起改。未接入 soma-ui 的 Host 只是拿不到抑制效果,
44
+ * 不会因此出错——挂一个没有规则匹配的类不产生任何副作用。
45
+ */
46
+ export declare const THEME_SWITCHING_CLASS = "soma-theme-switching";
47
+ /** 把派生令牌注入 :root(运行时换肤/切暗色:重复调用即时生效) */
48
+ export declare function applyTheme(input: SomaThemeInput, root?: HTMLElement): SomaDerivedTheme;
49
+ export {};
@@ -0,0 +1,15 @@
1
+ /**
2
+ * 中文排版基线样式。Host 集成时随主题一并注入。
3
+ *
4
+ * 条款与理由:
5
+ * - `text-autospace`:中西文之间的自动空隙(盘古之白)。
6
+ * 由排版引擎产生,手敲空格是内容污染——空格会进搜索索引、进复制粘贴、进后端字段。
7
+ * - `line-break: strict`:行首行尾禁则(避免"。"落行首、"("落行尾)。
8
+ * - `word-break: normal` + `overflow-wrap: break-word`:
9
+ * 中文按正常规则断,长 URL / 哈希这类无空格长串才允许强断,两者缺一都会出问题。
10
+ * - `hanging-punctuation: first last`:标点悬挂,让首尾行的文字边缘对齐。
11
+ *
12
+ * 不承诺竖排(`writing-mode`);繁体 / 日文的禁则差异走 i18n 层 locale 排版参数,
13
+ * 本资产只预留概念位。
14
+ */
15
+ export declare const TYPOGRAPHY_BASE_CSS = "[data-soma-host] {\n text-autospace: normal;\n line-break: strict;\n word-break: normal;\n overflow-wrap: break-word;\n hanging-punctuation: first last;\n}";
@@ -25,6 +25,8 @@ export declare class SomaContractValidator {
25
25
  constructor(diagnostics?: SomaDiagnostics);
26
26
  validate(input: SomaContractValidationInput): SomaContractReport;
27
27
  private collectAnchorStats;
28
+ /** 展示值可携带格式化管道:仅校验管道前的基础路径与绑定型实参路径 */
29
+ private validatePipedPath;
28
30
  private validateShowMapping;
29
31
  private validateEvents;
30
32
  private validateReadablePath;
@@ -3,12 +3,40 @@
3
3
  */
4
4
  export * from './client/base/index';
5
5
  export type { SomaAppConfig, SomaPageRoot } from './shared/types/domain.types';
6
- export type { IService } from './server/api/IService';
6
+ export type { IService, SomaServiceRequest } from './server/api/IService';
7
7
  export { SomaBootstrap } from './client/engine/soma-bootstrap';
8
- export type { SomaPageAssets, SomaBootstrapOptions } from './client/engine/soma-bootstrap';
8
+ export type { SomaPageAssets, SomaBootstrapOptions, SomaBootstrapErrorReporting, } from './client/engine/soma-bootstrap';
9
+ export { SomaComponentRegistry } from './client/component/component-registry';
10
+ export { SomaComponentManager } from './client/component/component-manager';
11
+ export { generateAiCatalog, buildCatalogEntry } from './client/component/ai-catalog';
12
+ export type { SomaAiCatalog, SomaAiCatalogEntry, GenerateAiCatalogOptions, } from './client/component/ai-catalog';
13
+ export { SomaPipeRegistry, defaultPipeRegistry } from './client/pipes/pipe-registry';
14
+ export type { SomaPipeFn, SomaPipeContext } from './client/pipes/pipe-registry';
15
+ export { SomaDataObjectResolver, SomaDataCycleError, isSomaMockEnabled, } from './client/data/data-object-resolver';
16
+ export type { SomaDataHttpLike, SomaDataResolverOptions, SomaDataResolveResult, } from './client/data/data-object-resolver';
17
+ export { parseDataConfig, parseDataYaml, parseDataRef, normalizeDataPipeValue, SomaDataConfigError, } from './client/parser/data-config-parser';
18
+ export type { SomaDataRef } from './client/parser/data-config-parser';
19
+ export type { SomaDataConfig, SomaDataObjectConfig, SomaDataSourceConfig, SomaDataFieldConfig, SomaDataFieldRule, SomaDataFieldOption, SomaDataFieldType, SomaDataFieldPermission, SomaDataDicts, } from './shared/types/data-config.types';
20
+ export { deriveTheme, applyTheme, contrastRatio, THEME_SWITCHING_CLASS, } from './client/theme/theme-engine';
21
+ export type { SomaThemeInput, SomaDerivedTheme } from './client/theme/theme-engine';
22
+ export { TYPOGRAPHY_BASE_CSS } from './client/typography/typography-base';
23
+ export { parseAdaptiveConfig, createAdaptiveVocabulary, SomaAdaptiveConfigError, } from './client/parser/adaptive-parser';
24
+ export { compileAdaptive, applyCompiledAdaptive, SOMA_ADAPTIVE_PROFILE_ATTR, } from './client/compiler/adaptive-compile';
25
+ export { SOMA_ADAPTIVE_PROFILES, SOMA_ADAPTIVE_MAX_LADDER, } from './shared/types/adaptive.types';
26
+ export type { SomaAdaptiveProfile, SomaAdaptiveConfig, SomaAdaptiveLevel, SomaAdaptiveLevelKind, SomaAdaptiveLevelDefinition, SomaAdaptiveVocabulary, SomaAdaptiveScopeClass, SomaAdaptiveExecutorConfig, SomaCompiledAdaptive, } from './shared/types/adaptive.types';
27
+ export { createAdaptiveObserverPool, scheduleAdaptiveFlush, resolveTierWithHysteresis, SOMA_DEFAULT_HYSTERESIS, } from './client/adaptive/index';
28
+ export type { SomaAdaptiveObserverPool, SomaAdaptiveSize, SomaAdaptiveSizeCallback, SomaAdaptiveTask, } from './client/adaptive/index';
29
+ export type { SomaComponentDefinition, SomaComponentControllerContext, SomaComponentControllerFactory, } from './client/component/component-definition.types';
30
+ export type { SomaComponentContract, SomaComponentLayer, SomaGeometryFamily, SomaContractProp, SomaContractEmit, SomaContractSlot, } from './shared/types/component-contract.types';
31
+ export { findNestedMutableContractDefault } from './shared/types/component-contract.types';
9
32
  export { createDefaultRuntimeServices } from './client/runtime/SomaRuntimeServices';
10
33
  export type { SomaRuntimeServices } from './client/runtime/SomaRuntimeServices';
11
34
  export { SomaDiagnostics } from './client/diagnostics/SomaDiagnostics';
35
+ export { installSomaErrorReporter } from './client/observability/error-reporter';
36
+ export type { SomaErrorEvent, SomaPageIdentity, SomaErrorReporterOptions, SomaErrorReporterHandle, } from './client/observability/error-reporter';
37
+ export { sanitizeAttributeWrite, hasBlockedScheme, isEventHandlerAttribute } from './client/security/url-guard';
38
+ export { setSomaHtmlSanitizer, resolveSomaHtmlSanitizer, sanitizeSomaHtml, escapeSomaHtml, SOMA_PURIFY_PROFILE, } from './client/security/html-sanitizer';
39
+ export type { SomaHtmlSanitizer, SomaHtmlSanitizeResult } from './client/security/html-sanitizer';
12
40
  export type { SomaDiagnosticsSnapshot } from './client/diagnostics/SomaDiagnostics';
13
41
  export { matchGlobPath } from './client/engine/property-watcher';
14
42
  export { extractConfigFromDomainClass } from './client/parser/annotation-extractor';
@@ -19,6 +47,8 @@ export type { AsyncStateHost } from './client/base/runAsync';
19
47
  export { SomaQualityRegistry } from './client/quality/SomaQualityRegistry';
20
48
  export { SomaTelemetry } from './client/diagnostics/SomaTelemetry';
21
49
  export { setActiveTelemetry, recordMetric } from './client/diagnostics/telemetry-context';
50
+ export { startBootTimings, maybeStartBootTimings, markBootPhase, readBootTimings, resetBootTimings, isBootTimingsEnabled, } from './client/diagnostics/boot-timings';
51
+ export type { SomaBootTimings, SomaBootPhase } from './client/diagnostics/boot-timings';
22
52
  export type { IContainerAdapter, SomaAnchorStats } from './client/container/IContainerAdapter';
23
53
  export { SomaContainerAdapter } from './client/container/SomaContainerAdapter';
24
54
  export { ReactNativeContainerAdapter } from './client/container/ReactNativeContainerAdapter';
@@ -36,3 +66,7 @@ export { resolveHostBootstrapOptions } from './client/host-bridge/resolve-host-b
36
66
  export type { SomaHostRequestContext, SomaHostRequestKind, SomaRequestHook, } from './server/host/resolve-host-request-hook';
37
67
  export type { SomaDomainLoadContext, SomaDomainLoader, SomaDomainLoaderMap, SomaDomainLoaderModule, SomaDomainModule, SomaDomainModuleResolver, } from './client/host-bridge/soma-domain-loaders';
38
68
  export { createSomaDomainLoaderKey, findSomaDomainLoader, loadSomaDomainModuleFromRegistry, } from './client/host-bridge/soma-domain-loaders';
69
+ export { createGeneratedPagePreview, createSomaPageLifecycle, renderPublishedPage, SomaPageLifecycle, type GeneratedPageDeclarations, type GeneratedPagePreviewOptions, type PrecompiledDeclarationAssets, type PreviewHandle, type PreviewObservabilityOptions, type MountedPageInfo, type PublishedPageHandle, type PublishedPageRecord, type RegisterDeclarationOptions, type RenderPublishedPageOptions, type SomaPageLifecycleOptions, } from './client/registry/index';
70
+ export { composeComponentPacks, generatePackCatalog, ComponentPackError, PACK_NAME_PATTERN, type ComposedComponentPacks, type ComposePacksOptions, type SomaComponentPack, type SomaComponentPackStyles, } from './client/component/component-pack';
71
+ export { verifyComponentPack, type VerifyPackOptions } from './client/component/verify-pack';
72
+ export { attachPackStyles, ensurePackBaseStyles, resetPackStyleInjection, type PackStyleOptions, } from './client/component/pack-styles';