soma-core 1.3.2 → 1.3.4

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 (281) hide show
  1. package/README.md +43 -0
  2. package/app/SomaPageClient.tsx +22 -68
  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/bin/soma-lsp.cjs +1 -4
  13. package/core/build/compiler/full-manifest-builder.ts +19 -23
  14. package/core/build/compiler/html-include-expander.ts +56 -0
  15. package/core/build/compiler/page-assets.ts +26 -0
  16. package/core/build/compiler/page-declaration-compiler.ts +85 -0
  17. package/core/build/compiler/rollup-plugin-soma.ts +4 -13
  18. package/core/build/compiler/route-builder.ts +0 -2
  19. package/core/build/compiler/rspack-plugin-soma.js +1 -10
  20. package/core/build/compiler/soma-manifest-webpack-plugin.js +54 -9
  21. package/core/build/compiler/soma-precompile.js +3581 -2387
  22. package/core/build/compiler/soma-precompile.ts +44 -2
  23. package/core/build/compiler/soma-rspack-yaml-loader.js +5 -8
  24. package/core/build/compiler/soma-webpack-loader.js +6 -15
  25. package/core/build/compiler/vite-plugin-soma.ts +9 -21
  26. package/core/build/component/pack-from-dir.ts +58 -0
  27. package/core/build/component/package-loader.ts +281 -0
  28. package/core/build/eject/apply-eject.ts +133 -0
  29. package/core/build/eject/plan-eject.ts +133 -0
  30. package/core/build/lsp/cross-file-diagnostics.cjs +82 -113
  31. package/core/build/lsp/extra-completion.cjs +14 -8
  32. package/core/build/lsp/lsp-navigation.cjs +50 -43
  33. package/core/build/lsp/soma-declaration.cjs +85 -0
  34. package/core/build/lsp/ui-yaml-completion.cjs +98 -104
  35. package/core/build/v2/block-compile.ts +200 -0
  36. package/core/build/v2/block-loader.ts +33 -0
  37. package/core/build/v2/html-index.ts +120 -0
  38. package/core/build/v2/migrate-v1.ts +370 -0
  39. package/core/build/v2/soma-file-loader.ts +216 -0
  40. package/core/client/adaptive/flush-scheduler.ts +96 -0
  41. package/core/client/adaptive/hysteresis.ts +56 -0
  42. package/core/client/adaptive/index.ts +23 -0
  43. package/core/client/adaptive/observer-pool.ts +90 -0
  44. package/core/client/base/SomaPageRootBase.ts +50 -0
  45. package/core/client/compiler/adaptive-compile.ts +136 -0
  46. package/core/client/compiler/manifest-compiler.ts +155 -27
  47. package/core/client/component/ai-catalog.ts +277 -0
  48. package/core/client/component/component-definition.types.ts +65 -0
  49. package/core/client/component/component-expander.ts +119 -0
  50. package/core/client/component/component-manager.ts +933 -0
  51. package/core/client/component/component-pack.ts +445 -0
  52. package/core/client/component/component-registry.ts +71 -0
  53. package/core/client/component/contract-compat.ts +132 -0
  54. package/core/client/component/example-v2.ts +132 -0
  55. package/core/client/component/pack-styles.ts +94 -0
  56. package/core/client/component/scoped-adapter.ts +85 -0
  57. package/core/client/component/verify-pack.ts +247 -0
  58. package/core/client/container/MiniProgramContainerAdapter.ts +15 -1
  59. package/core/client/container/ReactNativeContainerAdapter.ts +15 -1
  60. package/core/client/container/SomaContainerAdapter.ts +186 -180
  61. package/core/client/data/data-object-resolver.ts +417 -0
  62. package/core/client/diagnostics/SomaDiagnostics.ts +187 -186
  63. package/core/client/diagnostics/boot-timings.ts +152 -0
  64. package/core/client/engine/asset-resolver.ts +12 -2
  65. package/core/client/engine/dom-renderer.ts +249 -24
  66. package/core/client/engine/emit-event.ts +21 -0
  67. package/core/client/engine/event-engine.ts +34 -4
  68. package/core/client/engine/on-change-engine.ts +1 -1
  69. package/core/client/engine/property-watcher.ts +1 -1
  70. package/core/client/engine/reactive-proxy.ts +11 -10
  71. package/core/client/engine/render-engine.ts +39 -4
  72. package/core/client/engine/runtime-builder.ts +23 -0
  73. package/core/client/engine/soma-bootstrap.ts +380 -7
  74. package/core/client/engine/style-binder.ts +47 -1
  75. package/core/client/observability/error-reporter.ts +173 -0
  76. package/core/client/parser/adaptive-parser.ts +264 -0
  77. package/core/client/parser/data-config-parser.ts +396 -0
  78. package/core/client/parser/pipeline-parser.ts +15 -3
  79. package/core/client/parser/style-config-parser.ts +65 -2
  80. package/core/client/parser/ui-config-parser.ts +52 -3
  81. package/core/client/parser/v2/namespace.ts +182 -0
  82. package/core/client/parser/v2/page-parser.ts +359 -0
  83. package/core/client/parser/v2/use-parser.ts +412 -0
  84. package/core/client/parser/value-lang.ts +340 -0
  85. package/core/client/pipes/pipe-registry.ts +249 -0
  86. package/core/client/quality/SomaQualityRegistry.ts +3 -0
  87. package/core/client/registry/declaration-renderer.ts +161 -0
  88. package/core/client/registry/index.ts +28 -0
  89. package/core/client/registry/page-lifecycle.ts +171 -0
  90. package/core/client/registry/remote-page.ts +139 -0
  91. package/core/client/runtime/SomaRuntimeServices.ts +24 -0
  92. package/core/client/security/attribute-presence.ts +70 -0
  93. package/core/client/security/html-sanitizer.ts +113 -0
  94. package/core/client/security/url-guard.ts +0 -0
  95. package/core/client/theme/harmony.ts +307 -0
  96. package/core/client/theme/scene-tokens.ts +134 -0
  97. package/core/client/theme/theme-axes.ts +228 -0
  98. package/core/client/theme/theme-engine.ts +1196 -0
  99. package/core/client/theme/tone-solver.ts +118 -0
  100. package/core/client/typography/typography-base.ts +34 -0
  101. package/core/client/validation/contract-validator.ts +48 -5
  102. package/core/index.ts +262 -2
  103. package/core/server/api/IService.ts +18 -6
  104. package/core/server/api/load-host-service.ts +3 -3
  105. package/core/server/host/content-security-policy.ts +190 -0
  106. package/core/server/host/csp-nonce-metadata.ts +75 -0
  107. package/core/server/host/resolve-host-request-hook.ts +5 -0
  108. package/core/server/host/server-page-assets.ts +34 -7
  109. package/core/server/host/soma-page-compile.ts +33 -0
  110. package/core/server/index.ts +45 -1
  111. package/core/server/infra/cache/ServerFileCache.ts +1 -1
  112. package/core/server/mock/node/cli.mjs +2 -2
  113. package/core/server/registry/api-registry-store.ts +518 -0
  114. package/core/server/registry/conditional-object-store.ts +29 -0
  115. package/core/server/registry/declaration-precompiler.ts +99 -0
  116. package/core/server/registry/in-memory-conditional-object-store.ts +43 -0
  117. package/core/server/registry/index.ts +142 -0
  118. package/core/server/registry/page-registry-repository.ts +373 -0
  119. package/core/server/registry/page-registry-store.ts +932 -0
  120. package/core/server/registry/registry-error.ts +17 -0
  121. package/core/server/registry/registry-file-lock.ts +173 -0
  122. package/core/server/registry/registry-response.ts +71 -0
  123. package/core/server/registry/registry-subjects.ts +194 -0
  124. package/core/server/registry/registry-write-pipeline.ts +240 -0
  125. package/core/server/registry/request-body-limit.ts +99 -0
  126. package/core/server/registry/services/apis/Get.ts +25 -0
  127. package/core/server/registry/services/apis/List.ts +41 -0
  128. package/core/server/registry/services/apis/Register.ts +39 -0
  129. package/core/server/registry/services/apis/Unregister.ts +24 -0
  130. package/core/server/registry/services/index.ts +40 -0
  131. package/core/server/registry/services/pages/Get.ts +96 -0
  132. package/core/server/registry/services/pages/List.ts +53 -0
  133. package/core/server/registry/services/pages/Register.ts +49 -0
  134. package/core/server/registry/services/pages/Rollback.ts +36 -0
  135. package/core/server/registry/services/pages/Unregister.ts +23 -0
  136. package/core/server/registry/services/service-utils.ts +21 -0
  137. package/core/server/registry/validation/compile-gate.ts +54 -0
  138. package/core/server/registry/validation/component-existence.ts +55 -0
  139. package/core/server/registry/validation/credential-ban.ts +86 -0
  140. package/core/server/registry/validation/cross-check.ts +67 -0
  141. package/core/server/registry/validation/declaration-safety-scan.ts +102 -0
  142. package/core/shared/types/adaptive.types.ts +109 -0
  143. package/core/shared/types/component-contract.types.ts +120 -0
  144. package/core/shared/types/data-config.types.ts +105 -0
  145. package/core/shared/types/domain.types.ts +6 -0
  146. package/core/shared/types/engine.types.ts +41 -35
  147. package/core/shared/types/manifest.types.ts +55 -32
  148. package/core/shared/types/scope-manifest.types.ts +96 -0
  149. package/core/shared/types/style-config.types.ts +9 -0
  150. package/core/shared/types/ui-config.types.ts +118 -98
  151. package/dist/cli/soma.js +20 -5
  152. package/dist/core/index.cjs +7811 -1380
  153. package/dist/types/build/compiler/full-manifest-builder.d.ts +6 -2
  154. package/dist/types/build/compiler/html-include-expander.d.ts +19 -0
  155. package/dist/types/build/compiler/page-assets.d.ts +3 -0
  156. package/dist/types/build/compiler/page-declaration-compiler.d.ts +33 -0
  157. package/dist/types/build/compiler/rollup-plugin-soma.d.ts +0 -2
  158. package/dist/types/build/compiler/route-builder.d.ts +0 -1
  159. package/dist/types/build/compiler/soma-precompile.d.ts +17 -0
  160. package/dist/types/build/compiler/vite-plugin-soma.d.ts +2 -7
  161. package/dist/types/build/component/pack-from-dir.d.ts +17 -0
  162. package/dist/types/build/component/package-loader.d.ts +40 -0
  163. package/dist/types/build/eject/apply-eject.d.ts +22 -0
  164. package/dist/types/build/eject/plan-eject.d.ts +32 -0
  165. package/dist/types/build/v2/block-compile.d.ts +28 -0
  166. package/dist/types/build/v2/block-loader.d.ts +9 -0
  167. package/dist/types/build/v2/html-index.d.ts +37 -0
  168. package/dist/types/build/v2/migrate-v1.d.ts +32 -0
  169. package/dist/types/build/v2/soma-file-loader.d.ts +45 -0
  170. package/dist/types/client/adaptive/flush-scheduler.d.ts +13 -0
  171. package/dist/types/client/adaptive/hysteresis.d.ts +16 -0
  172. package/dist/types/client/adaptive/index.d.ts +5 -0
  173. package/dist/types/client/adaptive/observer-pool.d.ts +15 -0
  174. package/dist/types/client/base/SomaPageRootBase.d.ts +33 -0
  175. package/dist/types/client/compiler/adaptive-compile.d.ts +26 -0
  176. package/dist/types/client/compiler/manifest-compiler.d.ts +13 -2
  177. package/dist/types/client/component/ai-catalog.d.ts +73 -0
  178. package/dist/types/client/component/component-definition.types.d.ts +54 -0
  179. package/dist/types/client/component/component-expander.d.ts +25 -0
  180. package/dist/types/client/component/component-manager.d.ts +160 -0
  181. package/dist/types/client/component/component-pack.d.ts +110 -0
  182. package/dist/types/client/component/component-registry.d.ts +12 -0
  183. package/dist/types/client/component/contract-compat.d.ts +16 -0
  184. package/dist/types/client/component/example-v2.d.ts +9 -0
  185. package/dist/types/client/component/pack-styles.d.ts +22 -0
  186. package/dist/types/client/component/scoped-adapter.d.ts +18 -0
  187. package/dist/types/client/component/verify-pack.d.ts +14 -0
  188. package/dist/types/client/data/data-object-resolver.d.ts +71 -0
  189. package/dist/types/client/diagnostics/SomaDiagnostics.d.ts +2 -1
  190. package/dist/types/client/diagnostics/boot-timings.d.ts +30 -0
  191. package/dist/types/client/engine/asset-resolver.d.ts +7 -1
  192. package/dist/types/client/engine/dom-renderer.d.ts +51 -1
  193. package/dist/types/client/engine/emit-event.d.ts +6 -0
  194. package/dist/types/client/engine/event-engine.d.ts +6 -0
  195. package/dist/types/client/engine/render-engine.d.ts +25 -1
  196. package/dist/types/client/engine/runtime-builder.d.ts +7 -0
  197. package/dist/types/client/engine/soma-bootstrap.d.ts +118 -0
  198. package/dist/types/client/observability/error-reporter.d.ts +51 -0
  199. package/dist/types/client/parser/adaptive-parser.d.ts +28 -0
  200. package/dist/types/client/parser/data-config-parser.d.ts +34 -0
  201. package/dist/types/client/parser/pipeline-parser.d.ts +2 -0
  202. package/dist/types/client/parser/style-config-parser.d.ts +5 -3
  203. package/dist/types/client/parser/ui-config-parser.d.ts +22 -1
  204. package/dist/types/client/parser/v2/namespace.d.ts +52 -0
  205. package/dist/types/client/parser/v2/page-parser.d.ts +21 -0
  206. package/dist/types/client/parser/v2/use-parser.d.ts +72 -0
  207. package/dist/types/client/parser/value-lang.d.ts +63 -0
  208. package/dist/types/client/pipes/pipe-registry.d.ts +38 -0
  209. package/dist/types/client/registry/declaration-renderer.d.ts +50 -0
  210. package/dist/types/client/registry/index.d.ts +10 -0
  211. package/dist/types/client/registry/page-lifecycle.d.ts +61 -0
  212. package/dist/types/client/registry/remote-page.d.ts +52 -0
  213. package/dist/types/client/runtime/SomaRuntimeServices.d.ts +16 -0
  214. package/dist/types/client/security/attribute-presence.d.ts +7 -0
  215. package/dist/types/client/security/html-sanitizer.d.ts +37 -0
  216. package/dist/types/client/security/url-guard.d.ts +11 -0
  217. package/dist/types/client/theme/harmony.d.ts +77 -0
  218. package/dist/types/client/theme/scene-tokens.d.ts +25 -0
  219. package/dist/types/client/theme/theme-axes.d.ts +81 -0
  220. package/dist/types/client/theme/theme-engine.d.ts +77 -0
  221. package/dist/types/client/theme/tone-solver.d.ts +47 -0
  222. package/dist/types/client/typography/typography-base.d.ts +15 -0
  223. package/dist/types/client/validation/contract-validator.d.ts +2 -0
  224. package/dist/types/index.d.ts +47 -2
  225. package/dist/types/server/api/IService.d.ts +18 -6
  226. package/dist/types/server/host/content-security-policy.d.ts +53 -0
  227. package/dist/types/server/host/csp-nonce-metadata.d.ts +32 -0
  228. package/dist/types/server/host/resolve-host-request-hook.d.ts +5 -0
  229. package/dist/types/server/host/server-page-assets.d.ts +2 -0
  230. package/dist/types/server/host/soma-page-compile.d.ts +7 -0
  231. package/dist/types/server/index.d.ts +6 -1
  232. package/dist/types/server/registry/api-registry-store.d.ts +141 -0
  233. package/dist/types/server/registry/conditional-object-store.d.ts +27 -0
  234. package/dist/types/server/registry/declaration-precompiler.d.ts +30 -0
  235. package/dist/types/server/registry/in-memory-conditional-object-store.d.ts +8 -0
  236. package/dist/types/server/registry/index.d.ts +29 -0
  237. package/dist/types/server/registry/page-registry-repository.d.ts +58 -0
  238. package/dist/types/server/registry/page-registry-store.d.ts +259 -0
  239. package/dist/types/server/registry/registry-error.d.ts +12 -0
  240. package/dist/types/server/registry/registry-file-lock.d.ts +20 -0
  241. package/dist/types/server/registry/registry-response.d.ts +18 -0
  242. package/dist/types/server/registry/registry-subjects.d.ts +59 -0
  243. package/dist/types/server/registry/registry-write-pipeline.d.ts +48 -0
  244. package/dist/types/server/registry/request-body-limit.d.ts +31 -0
  245. package/dist/types/server/registry/services/apis/Get.d.ts +10 -0
  246. package/dist/types/server/registry/services/apis/List.d.ts +10 -0
  247. package/dist/types/server/registry/services/apis/Register.d.ts +13 -0
  248. package/dist/types/server/registry/services/apis/Unregister.d.ts +12 -0
  249. package/dist/types/server/registry/services/index.d.ts +3 -0
  250. package/dist/types/server/registry/services/pages/Get.d.ts +10 -0
  251. package/dist/types/server/registry/services/pages/List.d.ts +13 -0
  252. package/dist/types/server/registry/services/pages/Register.d.ts +11 -0
  253. package/dist/types/server/registry/services/pages/Rollback.d.ts +9 -0
  254. package/dist/types/server/registry/services/pages/Unregister.d.ts +9 -0
  255. package/dist/types/server/registry/services/service-utils.d.ts +10 -0
  256. package/dist/types/server/registry/validation/compile-gate.d.ts +12 -0
  257. package/dist/types/server/registry/validation/component-existence.d.ts +14 -0
  258. package/dist/types/server/registry/validation/credential-ban.d.ts +15 -0
  259. package/dist/types/server/registry/validation/cross-check.d.ts +16 -0
  260. package/dist/types/server/registry/validation/declaration-safety-scan.d.ts +15 -0
  261. package/dist/types/shared/types/adaptive.types.d.ts +88 -0
  262. package/dist/types/shared/types/component-contract.types.d.ts +78 -0
  263. package/dist/types/shared/types/data-config.types.d.ts +81 -0
  264. package/dist/types/shared/types/domain.types.d.ts +6 -0
  265. package/dist/types/shared/types/engine.types.d.ts +6 -0
  266. package/dist/types/shared/types/manifest.types.d.ts +23 -0
  267. package/dist/types/shared/types/scope-manifest.types.d.ts +82 -0
  268. package/dist/types/shared/types/style-config.types.d.ts +8 -0
  269. package/dist/types/shared/types/ui-config.types.d.ts +20 -0
  270. package/editor/vscode/package.json +1 -24
  271. package/global.d.ts +5 -11
  272. package/next.config.js +85 -28
  273. package/package.json +33 -11
  274. package/proxy.ts +62 -0
  275. package/tailwind.config.ts +0 -1
  276. package/core/build/lsp/event-yaml-completion.cjs +0 -106
  277. package/core/client/engine/theme-variables.ts +0 -37
  278. package/dist/tsconfig.types.tsbuildinfo +0 -1
  279. package/dist/types/client/engine/theme-variables.d.ts +0 -3
  280. package/editor/vscode/syntaxes/soma-event-yaml.tmLanguage.json +0 -30
  281. package/middleware.ts +0 -33
@@ -0,0 +1,9 @@
1
+ import type { IService, SomaServiceRequest } from '../../../api/IService';
2
+ /**
3
+ * POST /api/soma-registry/pages/rollback — 回滚:把指定历史版本的声明复制为新 published 版本。
4
+ * 也承担「草稿上架」语义:对 draft 版本执行即等于把草稿发布(复制为 published 新版)。
5
+ * 请求体:{ name, version }。响应:{ schemaVersion, name, version, status }。
6
+ */
7
+ export default class RollbackService implements IService {
8
+ post(req: SomaServiceRequest): Promise<Response>;
9
+ }
@@ -0,0 +1,9 @@
1
+ import type { IService, SomaServiceRequest } from '../../../api/IService';
2
+ /**
3
+ * POST /api/soma-registry/pages/unregister — 注销(下架):追加 archived 墓碑记录。
4
+ * 注销后缺省 list 消失、缺省 get 404;历史可按版本查;rollback 旧版本即恢复上架。
5
+ * 请求体:{ name }。响应:{ schemaVersion, name, version, status }。
6
+ */
7
+ export default class UnregisterService implements IService {
8
+ post(req: SomaServiceRequest): Promise<Response>;
9
+ }
@@ -0,0 +1,10 @@
1
+ /**
2
+ * 从请求读查询参数。优先 NextRequest 的 nextUrl.searchParams(真实宿主请求与
3
+ * 测试替身都带它),否则回落解析 req.url——注册端点不绑死任何一种请求实现。
4
+ */
5
+ export declare function readQueryParams(req: {
6
+ url?: string;
7
+ nextUrl?: {
8
+ searchParams: URLSearchParams;
9
+ };
10
+ }): Record<string, string>;
@@ -0,0 +1,12 @@
1
+ export interface CompilableDeclaration {
2
+ html: string;
3
+ uiYaml: string;
4
+ eventYaml?: string;
5
+ styleYaml?: string;
6
+ dataYaml?: string;
7
+ }
8
+ /**
9
+ * 干跑编译,返回中文问题清单(空数组 = 通过)。
10
+ * 与安全扫描同款约定:命中即拒,清单点名到具体哪一件、解析器原话是什么。
11
+ */
12
+ export declare function dryRunCompile(declaration: CompilableDeclaration): string[];
@@ -0,0 +1,14 @@
1
+ /** 组件清单来源;返回 null / 空表示"宿主没告诉我",此时不做判定 */
2
+ export type KnownComponentsResolver = () => Iterable<string> | null | undefined;
3
+ /**
4
+ * 注入组件清单来源(宿主服务端接线;传 null 复位为"不判定")。
5
+ * 清单可以随宿主热更新——每次校验都会重新问一次,不缓存。
6
+ */
7
+ export declare function setKnownComponentsResolver(next: KnownComponentsResolver | null): void;
8
+ /** 从 html 里收集引用到的组件名(去重、有序) */
9
+ export declare function collectReferencedComponents(html: string): string[];
10
+ /**
11
+ * 校验并返回中文问题清单(空数组 = 通过或未配置清单)。
12
+ * 与其它闸门同款约定:命中即拒,点名到具体组件名。
13
+ */
14
+ export declare function scanUnknownComponents(html: string): string[];
@@ -0,0 +1,15 @@
1
+ export interface CredentialScannable {
2
+ /** 接口路径(查询串里塞 token 是最常见的泄漏形态) */
3
+ path?: string;
4
+ /** 描述文本 */
5
+ description?: string;
6
+ /** 字段字典:键与 name 都要扫 */
7
+ fields?: Record<string, {
8
+ name?: string;
9
+ } | undefined>;
10
+ }
11
+ /**
12
+ * 扫描登记内容的凭据面,返回中文问题清单(空数组 = 通过)。
13
+ * 清单同时喂两处:注册闸门用它拒绝落库,排障时用它告诉人该改哪一项。
14
+ */
15
+ export declare function scanCredentialLeak(target: CredentialScannable): string[];
@@ -0,0 +1,16 @@
1
+ import type { SomaDataConfig } from '../../../shared/types/data-config.types';
2
+ /** 已注册路径的来源;测试与特殊宿主可替换(默认读共享 API 注册表) */
3
+ export type RegisteredPathsResolver = () => ReadonlySet<string>;
4
+ /** 替换判据来源(测试用;传 null 复位为共享注册表) */
5
+ export declare function setRegisteredPathsResolver(next: RegisteredPathsResolver | null): void;
6
+ /** 取数路径归一化:剥掉查询串与 hash,只留路径本体 */
7
+ export declare function normalizeApiPath(raw: string): string;
8
+ /**
9
+ * 收集统一声明编译产物里引用到的全部接口路径(已归一化,去重、有序)。
10
+ */
11
+ export declare function collectDeclaredApiPaths(config: SomaDataConfig | undefined): string[];
12
+ /**
13
+ * 交叉校验,返回中文问题清单(空数组 = 通过)。
14
+ * 与安全扫描同款约定:命中即拒,清单点名到具体路径与数据对象,便于自修复。
15
+ */
16
+ export declare function crossCheckDeclaredApis(config: SomaDataConfig | undefined): string[];
@@ -0,0 +1,15 @@
1
+ /** 声明的可扫描面(与 PageRegistryDeclaration / PageDeclarations 同构的子集) */
2
+ export interface ScannableDeclaration {
3
+ html: string;
4
+ uiYaml?: string;
5
+ eventYaml?: string;
6
+ styleYaml?: string;
7
+ dataYaml?: string;
8
+ }
9
+ /**
10
+ * 扫描声明的注入面,返回中文问题清单(空数组 = 通过)。
11
+ *
12
+ * 清单同时喂两处:发布管线用它拒绝落库,生成链闸门用它回喂模型自修复——
13
+ * 一把尺子量两处,规则不会各写一份而漂移。
14
+ */
15
+ export declare function scanDeclarationSafety(declaration: ScannableDeclaration): string[];
@@ -0,0 +1,88 @@
1
+ /**
2
+ * 版式画像:唯一封闭取值集。
3
+ * 只标注页面的信息形态,不携带任何几何档位(档位语义在 soma-ui)。
4
+ */
5
+ export declare const SOMA_ADAPTIVE_PROFILES: readonly ["dashboard", "form", "list", "console"];
6
+ export type SomaAdaptiveProfile = (typeof SOMA_ADAPTIVE_PROFILES)[number];
7
+ /**
8
+ * 阶梯级数上限。
9
+ * 取 5 不是性能阈值:超过五级说明页面本身过载,正确做法是拆页而不是加级。
10
+ */
11
+ export declare const SOMA_ADAPTIVE_MAX_LADDER = 5;
12
+ /**
13
+ * 阶梯的一级。
14
+ * YAML 上是单键对象 `{ 槽名: 级值 }`,解析后拍平为二元组——
15
+ * 单键对象在类型层无法表达"恰好一个键",拍平后级序才是可枚举、可快照的。
16
+ */
17
+ export interface SomaAdaptiveLevel {
18
+ /** 槽名,同时是展开目标锚点的 data-soma-id */
19
+ slot: string;
20
+ /** 级值;必须落在注册词汇表内,core 不解释其含义 */
21
+ value: string;
22
+ }
23
+ /**
24
+ * `_ui.yaml` 顶层保留键 `adaptive` 的解析结果。
25
+ * 整个键可选:未声明时编译产物与迁移前字节级一致(零破坏保证的类型锚点)。
26
+ */
27
+ export interface SomaAdaptiveConfig {
28
+ profile: SomaAdaptiveProfile;
29
+ /** 声明即全量覆盖默认阶梯,不深合并——深合并会让"实际生效的阶梯"失去单一可读处 */
30
+ ladder?: SomaAdaptiveLevel[];
31
+ /** 记名豁免槽:不参与降级 */
32
+ pin?: string[];
33
+ }
34
+ /**
35
+ * 级的展开方式。
36
+ * breakpoint:纯 CSS 作用域类,L1 自足,不经运行时解算;
37
+ * measure:需要测量,展开为执行器配置交 soma-ui 接线层消费。
38
+ */
39
+ export type SomaAdaptiveLevelKind = 'breakpoint' | 'measure';
40
+ export interface SomaAdaptiveLevelDefinition {
41
+ kind: SomaAdaptiveLevelKind;
42
+ /**
43
+ * 断点型级的触发档值,由词汇提供方声明,core 只透传不解释。
44
+ *
45
+ * 测量型级没有静态触发点,通常省略此字段;若宿主需要为调试/审计标注
46
+ * 一个业务触发标签,也只能作为不透明字符串携带,不能让 core 据此做布局决策。
47
+ */
48
+ trigger?: string;
49
+ /**
50
+ * 展开目标:断点型是预置作用域类名,测量型是执行器名。
51
+ * core 只做透传,不解释其内容(解释即等于把组件行为搬进引擎)。
52
+ */
53
+ target: string;
54
+ }
55
+ /**
56
+ * 阶梯词汇表:槽名 → 级值 → 定义。
57
+ * 由 `bootstrap` 与组件注册同点注入(`adaptiveVocabulary: createSomaUiAdaptiveVocabulary()`)。
58
+ * core 侧恒为空:未注册而页面声明 ladder 时按 ERR-02 快速失败。
59
+ */
60
+ export type SomaAdaptiveVocabulary = Readonly<Record<string, Readonly<Record<string, SomaAdaptiveLevelDefinition>>>>;
61
+ /** 断点型级的展开产物:目标锚点挂一个预置作用域类 */
62
+ export interface SomaAdaptiveScopeClass {
63
+ /** 目标锚点 data-soma-id(等于槽名) */
64
+ slot: string;
65
+ className: string;
66
+ /** 原始断点档值;core 只透传,供宿主闸门/调试工具观察,不参与运行期决策。 */
67
+ trigger?: string;
68
+ }
69
+ /** 测量型级的展开产物:交 soma-ui 接线层消费的执行器配置 */
70
+ export interface SomaAdaptiveExecutorConfig {
71
+ /** 目标锚点 data-soma-id(等于槽名) */
72
+ slot: string;
73
+ /** 原始级值,用于 ui 侧回溯声明 */
74
+ value: string;
75
+ /** 执行器名,由词汇表给出;core 不认识它做什么 */
76
+ executor: string;
77
+ }
78
+ /**
79
+ * 阶梯编译产物:确定性映射(同输入同输出,可快照)。
80
+ * 运行期不再做任何展开判断——这是"运行期零决策"的兑现处。
81
+ */
82
+ export interface SomaCompiledAdaptive {
83
+ profile: SomaAdaptiveProfile;
84
+ scopeClasses: SomaAdaptiveScopeClass[];
85
+ executors: SomaAdaptiveExecutorConfig[];
86
+ /** 记名豁免槽的原样透传(ui 侧仲裁链据此跳过) */
87
+ pinned: string[];
88
+ }
@@ -0,0 +1,78 @@
1
+ export type SomaComponentLayer = 'atom' | 'composite' | 'solution' | 'template';
2
+ /**
3
+ * 组件的主几何族。
4
+ *
5
+ * 这是生成链与组件目录之间的结构契约:页面生成器只根据族义务决定包裹方式,
6
+ * 不读取组件实现细节。字段保持可选以兼容尚未迁移的外部组件契约;目录编译器会
7
+ * 为缺省值生成一次性迁移归族结果,待组件逐步补齐后即可删掉该兼容路径。
8
+ */
9
+ export type SomaGeometryFamily = 'control' | 'surface' | 'message' | 'data' | 'overlay' | 'layout' | 'display';
10
+ export type SomaContractPropType = 'number' | 'string' | 'boolean' | 'enum' | 'object' | 'array';
11
+ export interface SomaContractProp {
12
+ type: SomaContractPropType;
13
+ required?: boolean;
14
+ /** 非 required 的 prop 必须有默认值(契约规则 C4:零 props 可渲染) */
15
+ default?: unknown;
16
+ desc?: string;
17
+ /** type === 'enum' 时的取值集合 */
18
+ values?: (string | number)[];
19
+ /** 绑定模式:oneway(默认)| model(双向,一个组件最多一个) */
20
+ mode?: 'oneway' | 'model';
21
+ }
22
+ /**
23
+ * 找出契约默认值中第二层及更深的引用型值。
24
+ *
25
+ * 运行时只隔离默认值的最外层数组/普通对象,避免擅自克隆 Date、类实例等带语义的值。
26
+ * 因而默认值允许 `[]`、`{}` 与一层标量字段,却不能再嵌套数组/对象;否则实例仍会
27
+ * 共享内部引用,组件控制器或 model 写入会跨实例、跨页面污染状态且不会报错。
28
+ *
29
+ * 返回相对 default 的首个违规路径;`null` 表示最外层浅拷贝已足够隔离。
30
+ */
31
+ export declare function findNestedMutableContractDefault(value: unknown): string | null;
32
+ export interface SomaContractEmitPayloadField {
33
+ type: SomaContractPropType;
34
+ desc?: string;
35
+ }
36
+ export interface SomaContractEmit {
37
+ payload?: Record<string, SomaContractEmitPayloadField>;
38
+ desc?: string;
39
+ }
40
+ export interface SomaContractSlot {
41
+ desc?: string;
42
+ required?: boolean;
43
+ }
44
+ /**
45
+ * AI 目录段(契约规范第 11 章):AI 生成页面前查表选组件的依据。
46
+ * when_to_use / example 为目录质量线;when_not_to_use 用于同族组件消歧。
47
+ */
48
+ export interface SomaContractAiSection {
49
+ when_to_use: string;
50
+ when_not_to_use?: string;
51
+ /** 三行真实用法:html / ui / event 各一行 */
52
+ example: string;
53
+ anti_patterns?: string[];
54
+ }
55
+ export interface SomaComponentContract {
56
+ /** 契约名,PascalCase,注册域内唯一 */
57
+ name: string;
58
+ layer: SomaComponentLayer;
59
+ /** semver;破坏性变更必须升 major(契约规则 C8) */
60
+ version: string;
61
+ description: string;
62
+ /** 主几何族;旧契约缺省时由目录编译器按组件层与名称推导迁移值。 */
63
+ geometry?: SomaGeometryFamily;
64
+ props?: Record<string, SomaContractProp>;
65
+ emits?: Record<string, SomaContractEmit>;
66
+ slots?: Record<string, SomaContractSlot>;
67
+ ai?: SomaContractAiSection;
68
+ /**
69
+ * 声明式覆盖:本组件有意替换该包里的同名组件(值为被覆盖组件的来源包名,如 'soma-ui')。
70
+ *
71
+ * 为什么写在契约上而不是宿主 bootstrap 里:覆盖意图与组件同处、随组件评审、
72
+ * 宿主零维护。合成时 `composeComponentPacks` 收集本字段构建覆盖表,并强制过
73
+ * 契约兼容闸门(props 超集 + emit 全保留),保证"优化存量组件、页面零改动"。
74
+ *
75
+ * 未声明的跨包撞名一律抛错——写出来的覆盖是设计决定,猜出来的覆盖是事故。
76
+ */
77
+ overrides?: string;
78
+ }
@@ -0,0 +1,81 @@
1
+ /** 字段类型枚举(决定 soma-ui 双态映射走哪个渲染组件) */
2
+ export type SomaDataFieldType = 'text' | 'int' | 'float' | 'money' | 'bool' | 'enum' | 'date' | 'datetime' | 'image' | 'url' | 'richtext';
3
+ /** 字段权限:r 只读 / w 可写(决定双态映射走 show 还是 edit 形态) */
4
+ export type SomaDataFieldPermission = 'r' | 'w';
5
+ /** 枚举字段候选项(type: enum 专用) */
6
+ export interface SomaDataFieldOption {
7
+ /** 枚举值 */
8
+ key: string;
9
+ /** 展示文案(缺省用 key) */
10
+ label?: string;
11
+ }
12
+ /**
13
+ * 字段校验规则:required / max_len / min_len / pattern / min / max 六种之一,
14
+ * 每条规则必须携带校验失败时的提示文案 message。
15
+ */
16
+ export interface SomaDataFieldRule {
17
+ /** 必填 */
18
+ required?: boolean;
19
+ /** 最大长度(字符串) */
20
+ max_len?: number;
21
+ /** 最小长度(字符串) */
22
+ min_len?: number;
23
+ /** 正则表达式(字符串形式) */
24
+ pattern?: string;
25
+ /** 最小值(数字) */
26
+ min?: number;
27
+ /** 最大值(数字) */
28
+ max?: number;
29
+ /** 校验失败提示文案 */
30
+ message: string;
31
+ }
32
+ /** 字段字典条目(驱动 UI 的元数据,全部可选;字典缺失时由 shape-infer 推断兜底) */
33
+ export interface SomaDataFieldConfig {
34
+ /** 业务名称(如「订单号」),速记列 label 的第一优先来源 */
35
+ name?: string;
36
+ /** 字段类型(缺省按 text 处理) */
37
+ type?: SomaDataFieldType;
38
+ /** 字段权限(缺省按只读处理) */
39
+ permission?: SomaDataFieldPermission;
40
+ /** 校验规则集 */
41
+ rules?: SomaDataFieldRule[];
42
+ /** 枚举候选项 */
43
+ options?: SomaDataFieldOption[];
44
+ }
45
+ /**
46
+ * 单个取数来源:一个后端接口 + 参数 + 聚合位置。
47
+ * params 值支持三源 `$` 引用:$query.*(URL 参数)、$page.*(Domain 字段)、
48
+ * $<数据对象>.*(依赖编排,决定对象间取数顺序)。
49
+ */
50
+ export interface SomaDataSourceConfig {
51
+ /** 后端接口路径(后端接口是唯一数据边界) */
52
+ api: string;
53
+ /** 取数参数:字面量或 `$` 引用(支持嵌套对象/数组) */
54
+ params?: Record<string, unknown>;
55
+ /** 结果聚合到对象子键(如 order.trace);缺省浅合并进对象根 */
56
+ into?: string;
57
+ }
58
+ /** 数据对象声明(*_data.yaml 中 data.<对象名> 的解析产物) */
59
+ export interface SomaDataObjectConfig {
60
+ /** 对象名(页面内唯一,即 data 下的键名) */
61
+ name: string;
62
+ /** 取数来源列表(mock 预览对象可为空数组) */
63
+ from: SomaDataSourceConfig[];
64
+ /**
65
+ * 派生字段:值为 "源字段路径 | 管道链"(复用 pipe-registry)。
66
+ * 解析期已归一化为标准管道语法(`date: 'x'` → `date('x')`)。
67
+ */
68
+ transform?: Record<string, string>;
69
+ /** 字段字典(字段名 → 字典条目) */
70
+ fields?: Record<string, SomaDataFieldConfig>;
71
+ /** mock 样本:SOMA_MOCK_ENABLED / 接口失败兜底 / 无接口预览 */
72
+ mock?: unknown;
73
+ /** 解析期提取:params 引用到的其他数据对象名(DAG 拓扑排序输入,不含自引用) */
74
+ deps: string[];
75
+ }
76
+ /** *_data.yaml 整体解析产物(对象名 → 声明) */
77
+ export interface SomaDataConfig {
78
+ objects: Record<string, SomaDataObjectConfig>;
79
+ }
80
+ /** 字段字典集合(对象名 → 字段名 → 字典条目),解析器产物 dicts 的形状 */
81
+ export type SomaDataDicts = Record<string, Record<string, SomaDataFieldConfig>>;
@@ -9,6 +9,12 @@ export interface SomaPageRoot {
9
9
  _config?: unknown;
10
10
  /** 运行时基础设施(引擎在 mount 时注入) */
11
11
  _services?: import('../../client/runtime/SomaRuntimeServices').SomaRuntimeServices;
12
+ /** 数据对象层解析产物挂载点(*_data.yaml 可选件;引擎解析完成后注入) */
13
+ data?: Record<string, unknown>;
14
+ /** 数据对象重取钩子(引擎在存在 *_data.yaml 声明时注入) */
15
+ _reloadData?: () => Promise<void>;
16
+ /** 重新执行数据对象取数(无声明时为空操作) */
17
+ reloadData?(): Promise<void>;
12
18
  /** 页面初始化(引擎在渲染完成后调用) */
13
19
  onMount?(): void | Promise<void>;
14
20
  /** 页面销毁前(引擎在卸载时调用) */
@@ -11,6 +11,12 @@ export interface BindingEntry {
11
11
  attrName?: string;
12
12
  negate?: boolean;
13
13
  classRules?: Record<string, string>;
14
+ /** 展示格式化管道链(text/attr 绑定,来自 SomaCompiledBinding.pipes) */
15
+ pipes?: import('./scope-manifest.types').SomaPipeCall[];
16
+ /** 异构列表模板选择器(行相对路径) */
17
+ roleBy?: string;
18
+ /** 变体模板表:'item' 默认 + 'item:变体'(异构列表用;同构列表仅 templateCache) */
19
+ templatesByRole?: Record<string, DocumentFragment>;
14
20
  /** 预编译的属性访问器:消除 path.split + 循环 */
15
21
  compiledGetter?: (root: any) => any;
16
22
  /** 预编译的渲染函数:消除 switch 分支 + 类型判断 */
@@ -2,6 +2,8 @@ import type { BindingType } from './engine.types';
2
2
  import type { ParsedEvent } from './event.types';
3
3
  import type { SomaTaskPriority } from './scheduler.types';
4
4
  import type { ShowMapping } from './ui-config.types';
5
+ import type { SomaPipeCall } from './scope-manifest.types';
6
+ import type { SomaCompiledAdaptive } from './adaptive.types';
5
7
  export interface SomaCompiledBinding {
6
8
  id: string;
7
9
  somaId: string;
@@ -14,10 +16,25 @@ export interface SomaCompiledBinding {
14
16
  childShowConfig?: ShowMapping;
15
17
  /** 静态提升标记:值在初始化后不会变化,不需要注册 watchPaths */
16
18
  static?: boolean;
19
+ /** 展示格式化管道链(text/attr 绑定专用,见 pipe-registry) */
20
+ pipes?: SomaPipeCall[];
21
+ /** 异构列表模板选择器(行相对路径,list 绑定专用) */
22
+ roleBy?: string;
17
23
  }
18
24
  export interface SomaCompiledEvent extends ParsedEvent {
25
+ /**
26
+ * 同锚点同 DOM 事件的多按键候选(仅当一个锚点绑了多个 keyModifier 时出现)。
27
+ * 派发侧按 event.key 从中挑一条;单绑定时不存在此字段,零额外开销。
28
+ */
29
+ keyVariants?: SomaCompiledEvent[];
19
30
  eventKey: string;
20
31
  priority: SomaTaskPriority;
32
+ /**
33
+ * 组件 emit 路由标记:somaId 为组件实例、domEvent 为契约 emit 名。
34
+ * 标记后不注册 DOM 监听、不响应冒泡 DOM 事件,仅由组件管理器 dispatchEmit 触发;
35
+ * Domain 处理器第二实参为 emit payload(DOM 路由保持 originalEvent)。
36
+ */
37
+ emitRoute?: boolean;
21
38
  }
22
39
  export interface SomaRuntimeManifest {
23
40
  bindings: SomaCompiledBinding[];
@@ -26,4 +43,10 @@ export interface SomaRuntimeManifest {
26
43
  eventIndex: Map<string, SomaCompiledEvent>;
27
44
  /** 启动时一次性初始化的属性(来自 _ui.yaml initProps) */
28
45
  initProps?: Record<string, unknown>;
46
+ /**
47
+ * 阶梯编译产物(来自 _ui.yaml adaptive)。
48
+ * 未声明 adaptive 时**此字段不存在**(不是空对象、不是 null)——
49
+ * 零破坏保证要求产物字节级不变,写一个空壳就已经破了。
50
+ */
51
+ adaptive?: SomaCompiledAdaptive;
29
52
  }
@@ -0,0 +1,82 @@
1
+ import type { SomaCompiledBinding, SomaCompiledEvent, SomaRuntimeManifest } from './manifest.types';
2
+ /**
3
+ * v2 作用域清单树(组件体系 P0)。
4
+ *
5
+ * 设计规范:soma-core/doc/soma 作用域清单树.md
6
+ * 兼容承诺:v1 清单(SomaRuntimeManifest)长期保留;无组件页面继续走 v1 原路径,
7
+ * 本文件只做类型新增,不修改任何既有类型。
8
+ *
9
+ * 节点结构保持可 JSON 序列化(仅数组/普通对象,无 Map)——构建期产物与
10
+ * 运行期客户端编译产物必须深度相等(规范 7.4),索引一律在运行时装配。
11
+ */
12
+ export type SomaScopeKind = 'page' | 'list' | 'component';
13
+ export type SomaPropMode = 'oneway' | 'model';
14
+ /** 管道实参:字面量,或取值自绑定路径 */
15
+ export interface SomaPipeArg {
16
+ kind: 'literal' | 'binding';
17
+ value: string | number | boolean;
18
+ }
19
+ /** 格式化管道调用(DSL 扩展规范第 3 章),按声明顺序从左到右执行 */
20
+ export interface SomaPipeCall {
21
+ name: string;
22
+ args?: Record<string, SomaPipeArg>;
23
+ }
24
+ /** 页面表达式 → 组件契约 prop 的绑定(下行通道) */
25
+ export interface SomaPropBinding {
26
+ prop: string;
27
+ /** 已解析的绑定路径;与 literal 二选一 */
28
+ source?: string;
29
+ literal?: unknown;
30
+ /** 布尔 prop 的 `!` 前缀(沿用 when 语义,不引入其他运算) */
31
+ negate?: boolean;
32
+ mode: SomaPropMode;
33
+ pipes?: SomaPipeCall[];
34
+ }
35
+ /**
36
+ * 契约 emit → 页面 Pipeline 的路由(上行通道)。
37
+ *
38
+ * 处理器分型(作用域清单树规范 1.1 R2):
39
+ * emit 路由的 Domain 处理器收 (currentVar, payload);
40
+ * DOM 事件路由保持既有 (currentVar, originalEvent),运行时按 kind 分发,不做猜测。
41
+ */
42
+ export interface SomaEmitRoute {
43
+ kind: 'emit';
44
+ emit: string;
45
+ /** 复用既有 Pipeline 编译产物;somaId 为实例锚点 id */
46
+ pipeline: SomaCompiledEvent;
47
+ }
48
+ /** 组件实例元数据(kind === 'component' 的节点持有) */
49
+ export interface SomaComponentInstanceMeta {
50
+ /** 契约名(PascalCase) */
51
+ name: string;
52
+ /** 契约 semver,升级破坏点定位用(契约规范 C8) */
53
+ version: string;
54
+ props: SomaPropBinding[];
55
+ emits: SomaEmitRoute[];
56
+ /**
57
+ * 插槽内容子树。插槽内容归父(页面/外层)作用域:其 bindings 的数据路径
58
+ * 相对父作用域求值,组件只决定投影位置与显隐(契约规范第 5 章)。
59
+ */
60
+ slots?: Record<string, SomaScopeNode>;
61
+ }
62
+ export interface SomaScopeNode {
63
+ kind: SomaScopeKind;
64
+ /** page: 页面 base;list/component: 宿主锚点 data-soma-id */
65
+ id: string;
66
+ component?: SomaComponentInstanceMeta;
67
+ /** kind === 'list':行变量名(currentVar 语义与既有列表一致) */
68
+ listVar?: string;
69
+ /** 异构列表模板选择器的绑定路径(DSL 扩展规范 2.1,行模板后缀 = 该路径取值) */
70
+ roleBy?: string;
71
+ /** 本作用域直属锚点的绑定(结构与 v1 逐字段同构) */
72
+ bindings: SomaCompiledBinding[];
73
+ events: SomaCompiledEvent[];
74
+ children: SomaScopeNode[];
75
+ }
76
+ export interface SomaRuntimeManifestV2 {
77
+ version: 2;
78
+ root: SomaScopeNode;
79
+ initProps?: Record<string, unknown>;
80
+ }
81
+ export type SomaAnyRuntimeManifest = SomaRuntimeManifest | SomaRuntimeManifestV2;
82
+ export declare function isManifestV2(manifest: SomaAnyRuntimeManifest): manifest is SomaRuntimeManifestV2;
@@ -1,3 +1,11 @@
1
+ /**
2
+ * 样式声明的违规类别(解析期硬校验用)。
3
+ *
4
+ * `layout-class`:`_style.yaml` 里出现了布局组装类。
5
+ * 布局的合法归宿是 HTML 骨架与布局原语;样式配置只承载视觉与显隐。
6
+ * 该类别不设 warn 档、不设开关——开关会立刻制造两份事实("开了的项目"与"没开的项目")。
7
+ */
8
+ export type SomaStyleViolationKind = 'layout-class';
1
9
  /**
2
10
  * 状态驱动的样式规则
3
11
  * 当 condition 路径的值等于 value 时,将 apply 中的类名应用到对应 DOM 节点
@@ -1,4 +1,5 @@
1
1
  import type { OnChangeRule } from './watcher.types';
2
+ import type { SomaAdaptiveConfig } from './adaptive.types';
2
3
  /**
3
4
  * 作用域声明
4
5
  * 定义数据源路径和当前作用域别名
@@ -10,6 +11,11 @@ export interface BindDeclaration {
10
11
  var: string;
11
12
  /** 属性变化时触发的 Domain 方法(声明式 watch) */
12
13
  onChange?: OnChangeRule[];
14
+ /**
15
+ * 异构列表模板选择器(行相对路径,如 msg.type):
16
+ * 取值匹配 <template data-soma-role="item:取值">,无匹配回落 item 默认模板。
17
+ */
18
+ role_by?: string;
13
19
  }
14
20
  /**
15
21
  * 展示映射值 - 支持多种绑定类型
@@ -29,6 +35,8 @@ export interface NestedShowMapping {
29
35
  bind: BindDeclaration;
30
36
  /** 子级展示映射 */
31
37
  show: ShowMapping;
38
+ /** 整块显隐:与 bind 同处一个配置对象(另起同名键会覆盖列表绑定) */
39
+ when?: string;
32
40
  }
33
41
  /**
34
42
  * 扩展绑定值
@@ -45,6 +53,12 @@ export interface ExtendedShowValue {
45
53
  class?: Record<string, string>;
46
54
  /** 子级展示映射 */
47
55
  show?: ShowMapping;
56
+ /**
57
+ * 组件实例 props(键为契约 prop 名)。
58
+ * 值:绑定路径字符串 / 字面量 / 一层嵌套对象与数组(字段值递归同规则)。
59
+ * 仅当锚点元素带 data-soma-component 时生效。
60
+ */
61
+ props?: Record<string, unknown>;
48
62
  }
49
63
  /**
50
64
  * 展示映射
@@ -70,6 +84,12 @@ export interface UiConfig {
70
84
  * 键为 var 别名路径(如 page.title),值为初始值
71
85
  */
72
86
  initProps?: Record<string, unknown>;
87
+ /**
88
+ * 降级阶梯声明(保留键,可选)。
89
+ * **未声明时编译产物与迁移前字节级一致**——这是零破坏保证的实现锚点,
90
+ * 所以此键必须保持可选,且缺席时不得在下游产生任何默认值。
91
+ */
92
+ adaptive?: SomaAdaptiveConfig;
73
93
  }
74
94
  /**
75
95
  * 解析后的 show 条目
@@ -4,7 +4,7 @@
4
4
 
5
5
  "displayName": "SOMA",
6
6
 
7
- "description": "SOMA Language Server — html/ui/event 锚点诊断、YAML 补全与高亮",
7
+ "description": "SOMA Language Server — HTML 与单一 SOMA DSL 声明的诊断、补全与导航",
8
8
 
9
9
  "version": "1.1.0",
10
10
 
@@ -32,18 +32,6 @@
32
32
 
33
33
  "configuration": "./language-configuration.json"
34
34
 
35
- },
36
-
37
- {
38
-
39
- "id": "soma-event-yaml",
40
-
41
- "aliases": ["SOMA Event YAML"],
42
-
43
- "extensions": ["_event.yaml"],
44
-
45
- "configuration": "./language-configuration.json"
46
-
47
35
  }
48
36
 
49
37
  ],
@@ -58,16 +46,6 @@
58
46
 
59
47
  "path": "./syntaxes/soma-ui-yaml.tmLanguage.json"
60
48
 
61
- },
62
-
63
- {
64
-
65
- "language": "soma-event-yaml",
66
-
67
- "scopeName": "source.soma-event-yaml",
68
-
69
- "path": "./syntaxes/soma-event-yaml.tmLanguage.json"
70
-
71
49
  }
72
50
 
73
51
  ],
@@ -95,4 +73,3 @@
95
73
  }
96
74
 
97
75
  }
98
-
package/global.d.ts CHANGED
@@ -42,17 +42,7 @@ declare module '@soma-host/bootstrap/soma-domain-loaders' {
42
42
  export default defaultExport;
43
43
  }
44
44
 
45
- declare module '@soma-host/config/locale.yaml' {
46
- const content: Record<string, unknown>;
47
- export default content;
48
- }
49
-
50
- declare module '@soma-host/config/app.config.yaml' {
51
- const content: Record<string, unknown>;
52
- export default content;
53
- }
54
-
55
- /** Host dynamic asset paths (domain/ui/event); runtime resolves via webpack alias */
45
+ /** Host bootstrap/domain dynamic paths; runtime resolves via webpack alias. */
56
46
  declare module '@soma-host/*' {
57
47
  const content: unknown;
58
48
  export default content;
@@ -63,6 +53,8 @@ interface SomaDevConsole {
63
53
  getDiagnosticsSnapshot: () => import('./core/client/diagnostics/SomaDiagnostics').SomaDiagnosticsSnapshot | null;
64
54
  getTelemetrySnapshot: () => Record<string, { count: number; avg: number; max: number; min: number }> | null;
65
55
  getAvailableThemes?: () => string[];
56
+ /** 首屏三段耗时(未开启打点时为 null,开启方式见 boot-timings.ts) */
57
+ getBootTimings?: () => import('./core/client/diagnostics/boot-timings').SomaBootTimings | null;
66
58
  getDomainInstance: () => unknown;
67
59
  captureSnapshot: () => number | null;
68
60
  restoreSnapshot: (id: number) => void;
@@ -79,4 +71,6 @@ interface SomaReadinessDiagnostics {
79
71
  isSettled: () => boolean;
80
72
  getDomainValue: (path: string) => unknown;
81
73
  getRegisteredSomaIds: () => string[];
74
+ /** 只读 CSP nonce 链(meta 为 meta[name=csp-nonce];styles 为带 nonce 的运行期样式元素) */
75
+ getCspNonceChain: () => { meta: string; styles: string[] };
82
76
  }