soma-core 1.4.2 → 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 (212) 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 +431 -26
  9. package/core/build/component/component-graph.ts +28 -105
  10. package/core/build/component/package-loader.ts +18 -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/client/component/example-blocks.ts +1 -7
  58. package/core/client/component/theme-component-tokens.ts +12 -15
  59. package/core/client/data/data-object-resolver.ts +27 -8
  60. package/core/client/diagnostics/telemetry-context.ts +0 -4
  61. package/core/client/engine/asset-resolver.ts +0 -1
  62. package/core/client/engine/event-engine.ts +7 -3
  63. package/core/client/engine/soma-bootstrap.ts +292 -34
  64. package/core/client/engine/style-binder.ts +0 -1
  65. package/core/client/infra/http/IHttpClient.ts +0 -6
  66. package/core/client/infra/http/SomaHttpService.ts +4 -1
  67. package/core/client/infra/notify/DomNotifyService.ts +1 -1
  68. package/core/client/infra/router/router-path.ts +0 -6
  69. package/core/client/parser/annotation-extractor.ts +1 -1
  70. package/core/client/parser/blocks/namespace.ts +30 -5
  71. package/core/client/parser/blocks/page-parser.ts +44 -1
  72. package/core/client/parser/blocks/use-parser.ts +266 -46
  73. package/core/client/parser/data-config-parser.ts +71 -3
  74. package/core/client/parser/layout-parser.ts +4 -3
  75. package/core/client/parser/reaction-parser.ts +0 -1
  76. package/core/client/parser/ui-config-parser.ts +212 -74
  77. package/core/client/theme/scene-tokens.ts +9 -3
  78. package/core/client/theme/theme-axes.ts +74 -16
  79. package/core/client/theme/theme-engine.ts +280 -69
  80. package/core/client/theme/tone-solver.ts +9 -8
  81. package/core/index.ts +18 -4
  82. package/core/server/api/load-host-service.ts +8 -2
  83. package/core/server/declaration-safety.ts +11 -0
  84. package/core/server/host/page-response-request.ts +0 -2
  85. package/core/server/host/published-page-artifact-cache.ts +244 -0
  86. package/core/server/host/published-page-assets.ts +44 -5
  87. package/core/server/mock/node/cli.mjs +0 -1
  88. package/core/server/mock/node/schema-generator.mjs +0 -1
  89. package/core/server/ooui.ts +34 -0
  90. package/core/server/page-assets.ts +8 -0
  91. package/core/server/page-declaration.ts +18 -0
  92. package/core/server/registry/asset-store.ts +327 -0
  93. package/core/server/registry/declaration-precompiler.ts +49 -6
  94. package/core/server/registry/index.ts +47 -1
  95. package/core/server/registry/page-registry-repository.ts +6 -2
  96. package/core/server/registry/page-registry-store.ts +133 -19
  97. package/core/server/registry/publish-asset-pin.ts +557 -0
  98. package/core/server/registry/services/pages/List.ts +15 -3
  99. package/core/server/registry/validation/compile-gate.ts +180 -8
  100. package/core/server/registry/validation/declaration-safety-scan.ts +113 -23
  101. package/core/shared/component/derive-sample.ts +201 -16
  102. package/core/shared/component/field-lines.ts +98 -8
  103. package/core/shared/container-breakpoints.ts +46 -0
  104. package/core/shared/object-semantics.ts +240 -0
  105. package/core/shared/ooui-declaration.ts +235 -0
  106. package/core/shared/types/component-contract.types.ts +7 -6
  107. package/core/shared/types/data-config.types.ts +95 -0
  108. package/core/shared/types/domain.types.ts +0 -24
  109. package/core/shared/types/engine.types.ts +0 -5
  110. package/core/shared/types/layout-constraint.types.ts +16 -0
  111. package/core/shared/types/ui-config.types.ts +163 -13
  112. package/dist/cli/soma.js +24 -11
  113. package/dist/core/index.cjs +1563 -800
  114. package/dist/types/build/blocks/block-compile.d.ts +16 -1
  115. package/dist/types/build/blocks/migrate-flat.d.ts +17 -0
  116. package/dist/types/build/compiler/page-declaration-compiler.d.ts +46 -0
  117. package/dist/types/build/compiler/route-builder.d.ts +0 -1
  118. package/dist/types/build/component/component-graph.d.ts +17 -53
  119. package/dist/types/build/component/package-loader.d.ts +8 -1
  120. package/dist/types/build/layout/constraint-solver.d.ts +46 -4
  121. package/dist/types/build/ooui/artifact/artifact.types.d.ts +180 -0
  122. package/dist/types/build/ooui/artifact/emit-artifact.d.ts +58 -0
  123. package/dist/types/build/ooui/artifact/emit-html.d.ts +53 -0
  124. package/dist/types/build/ooui/artifact/index.d.ts +5 -0
  125. package/dist/types/build/ooui/artifact/spatial-tree.d.ts +48 -0
  126. package/dist/types/build/ooui/artifact/utility-class.d.ts +46 -0
  127. package/dist/types/build/ooui/composition/candidate.types.d.ts +206 -0
  128. package/dist/types/build/ooui/composition/control-model.d.ts +37 -0
  129. package/dist/types/build/ooui/composition/registry.d.ts +66 -0
  130. package/dist/types/build/ooui/composition/select.d.ts +63 -0
  131. package/dist/types/build/ooui/diagnostics/codes.d.ts +28 -0
  132. package/dist/types/build/ooui/diagnostics/error.d.ts +135 -0
  133. package/dist/types/build/ooui/diagnostics/format.d.ts +51 -0
  134. package/dist/types/build/ooui/diagnostics/index.d.ts +25 -0
  135. package/dist/types/build/ooui/diagnostics/issue.types.d.ts +56 -0
  136. package/dist/types/build/ooui/engine-slot.d.ts +41 -0
  137. package/dist/types/build/ooui/index.d.ts +286 -0
  138. package/dist/types/build/ooui/intent/derive-intent.d.ts +32 -0
  139. package/dist/types/build/ooui/intent/field-rules.d.ts +99 -0
  140. package/dist/types/build/ooui/intent/intent.types.d.ts +318 -0
  141. package/dist/types/build/ooui/intent/verb-events.d.ts +70 -0
  142. package/dist/types/build/ooui/page/budget.d.ts +28 -0
  143. package/dist/types/build/ooui/page/compose-page.d.ts +41 -0
  144. package/dist/types/build/ooui/page/index.d.ts +4 -0
  145. package/dist/types/build/ooui/page/page.types.d.ts +264 -0
  146. package/dist/types/build/ooui/page/region-row.d.ts +16 -0
  147. package/dist/types/build/ooui/semantic/expand-page-surface.d.ts +33 -0
  148. package/dist/types/build/ooui/semantic/kernel.types.d.ts +125 -0
  149. package/dist/types/build/ooui/semantic/normalize.d.ts +45 -0
  150. package/dist/types/build/ooui/semantic/origin.types.d.ts +95 -0
  151. package/dist/types/build/ooui/semantic/role-alias.d.ts +35 -0
  152. package/dist/types/build/ooui/semantic/shorthand.d.ts +60 -0
  153. package/dist/types/build/ooui/semantic/surface.types.d.ts +16 -0
  154. package/dist/types/build/ooui/semantic/validate-request.d.ts +19 -0
  155. package/dist/types/build/ooui/spatial/emit-utility.d.ts +43 -0
  156. package/dist/types/build/ooui/spatial/ir.types.d.ts +280 -0
  157. package/dist/types/build/ooui/spatial/registry.d.ts +110 -0
  158. package/dist/types/build/ooui/spatial/solve.d.ts +42 -0
  159. package/dist/types/build/ooui/spatial/utility.types.d.ts +191 -0
  160. package/dist/types/build/ooui/trace/index.d.ts +3 -0
  161. package/dist/types/build/ooui/trace/render.d.ts +42 -0
  162. package/dist/types/build/ooui/trace/source.types.d.ts +25 -0
  163. package/dist/types/build/ooui/trace/trace.types.d.ts +143 -0
  164. package/dist/types/client/component/example-blocks.d.ts +0 -2
  165. package/dist/types/client/component/theme-component-tokens.d.ts +8 -5
  166. package/dist/types/client/data/data-object-resolver.d.ts +10 -2
  167. package/dist/types/client/diagnostics/telemetry-context.d.ts +0 -1
  168. package/dist/types/client/engine/soma-bootstrap.d.ts +123 -10
  169. package/dist/types/client/infra/http/IHttpClient.d.ts +0 -5
  170. package/dist/types/client/infra/http/SomaHttpService.d.ts +1 -1
  171. package/dist/types/client/infra/router/router-path.d.ts +0 -2
  172. package/dist/types/client/parser/blocks/namespace.d.ts +20 -0
  173. package/dist/types/client/parser/blocks/page-parser.d.ts +9 -0
  174. package/dist/types/client/parser/blocks/use-parser.d.ts +38 -4
  175. package/dist/types/client/parser/data-config-parser.d.ts +13 -0
  176. package/dist/types/client/parser/ui-config-parser.d.ts +1 -11
  177. package/dist/types/client/theme/scene-tokens.d.ts +9 -3
  178. package/dist/types/client/theme/theme-axes.d.ts +64 -1
  179. package/dist/types/client/theme/theme-engine.d.ts +13 -8
  180. package/dist/types/client/theme/tone-solver.d.ts +9 -5
  181. package/dist/types/index.d.ts +4 -5
  182. package/dist/types/server/declaration-safety.d.ts +7 -0
  183. package/dist/types/server/host/page-response-request.d.ts +0 -1
  184. package/dist/types/server/host/published-page-artifact-cache.d.ts +64 -0
  185. package/dist/types/server/ooui.d.ts +18 -0
  186. package/dist/types/server/page-assets.d.ts +7 -0
  187. package/dist/types/server/page-declaration.d.ts +14 -0
  188. package/dist/types/server/registry/asset-store.d.ts +112 -0
  189. package/dist/types/server/registry/declaration-precompiler.d.ts +23 -3
  190. package/dist/types/server/registry/index.d.ts +3 -1
  191. package/dist/types/server/registry/page-registry-store.d.ts +57 -4
  192. package/dist/types/server/registry/publish-asset-pin.d.ts +166 -0
  193. package/dist/types/server/registry/services/pages/List.d.ts +9 -3
  194. package/dist/types/server/registry/validation/compile-gate.d.ts +63 -0
  195. package/dist/types/shared/component/derive-sample.d.ts +14 -0
  196. package/dist/types/shared/container-breakpoints.d.ts +42 -0
  197. package/dist/types/shared/object-semantics.d.ts +42 -0
  198. package/dist/types/shared/ooui-declaration.d.ts +135 -0
  199. package/dist/types/shared/types/component-contract.types.d.ts +7 -6
  200. package/dist/types/shared/types/data-config.types.d.ts +86 -0
  201. package/dist/types/shared/types/domain.types.d.ts +0 -21
  202. package/dist/types/shared/types/engine.types.d.ts +0 -4
  203. package/dist/types/shared/types/layout-constraint.types.d.ts +1 -0
  204. package/dist/types/shared/types/ui-config.types.d.ts +157 -12
  205. package/next.config.js +106 -13
  206. package/package.json +28 -2
  207. package/core/client/host-bridge/index.ts +0 -27
  208. package/core/client/parser/yaml-loader.ts +0 -36
  209. package/core/shared/manifest/manifest-contract.ts +0 -12
  210. package/dist/types/client/host-bridge/index.d.ts +0 -9
  211. package/dist/types/client/parser/yaml-loader.d.ts +0 -21
  212. package/dist/types/shared/manifest/manifest-contract.d.ts +0 -4
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "soma-core",
3
- "version": "1.4.2",
3
+ "version": "1.5.0",
4
4
  "description": "SOMA — Semantic Oriented Modular Architecture. A declarative frontend framework runtime built on Next.js 16 App Router.",
5
5
  "keywords": [
6
6
  "soma",
@@ -53,6 +53,7 @@
53
53
  "default": "./core/client/adaptive/index.ts"
54
54
  },
55
55
  "./adaptive-vocabulary": "./core/shared/types/adaptive.types.ts",
56
+ "./responsive-vocabulary": "./core/shared/container-breakpoints.ts",
56
57
  "./compiler/vite": "./core/build/compiler/vite-plugin-soma.ts",
57
58
  "./compiler/precompile": "./core/build/compiler/soma-precompile.ts",
58
59
  "./compiler/webpack-loader": "./core/build/compiler/soma-webpack-loader.js",
@@ -77,6 +78,26 @@
77
78
  "import": "./core/server/registry/index.ts",
78
79
  "default": "./core/server/registry/index.ts"
79
80
  },
81
+ "./server/page-declaration": {
82
+ "types": "./dist/types/server/page-declaration.d.ts",
83
+ "import": "./core/server/page-declaration.ts",
84
+ "default": "./core/server/page-declaration.ts"
85
+ },
86
+ "./server/page-assets": {
87
+ "types": "./dist/types/server/page-assets.d.ts",
88
+ "import": "./core/server/page-assets.ts",
89
+ "default": "./core/server/page-assets.ts"
90
+ },
91
+ "./server/ooui": {
92
+ "types": "./dist/types/server/ooui.d.ts",
93
+ "import": "./core/server/ooui.ts",
94
+ "default": "./core/server/ooui.ts"
95
+ },
96
+ "./server/declaration-safety": {
97
+ "types": "./dist/types/server/declaration-safety.d.ts",
98
+ "import": "./core/server/declaration-safety.ts",
99
+ "default": "./core/server/declaration-safety.ts"
100
+ },
80
101
  "./mock/node": {
81
102
  "types": "./core/server/mock/node/public.d.mts",
82
103
  "import": "./core/server/mock/node/public.mjs",
@@ -97,6 +118,9 @@
97
118
  "files": [
98
119
  "bin/soma.cjs",
99
120
  "bin/soma-db.cjs",
121
+ "bin/migrate.cjs",
122
+ "bin/component.cjs",
123
+ "bin/eject.cjs",
100
124
  "bin/soma-lsp.cjs",
101
125
  "bin/soma-sync.cjs",
102
126
  "bin/soma-mock.mjs",
@@ -129,6 +153,8 @@
129
153
  "verify:mock-pack": "node scripts/verify-mock-pack.mjs",
130
154
  "verify:client-boundary": "node scripts/verify-client-boundary.mjs",
131
155
  "verify:client-dep-graph": "node scripts/verify-client-dep-graph.mjs",
156
+ "verify:ooui-dep-graph": "node scripts/verify-ooui-dep-graph.mjs",
157
+ "verify:ooui-closure": "node scripts/verify-ooui-closure.mjs",
132
158
  "test:watch": "vitest",
133
159
  "typecheck": "tsc --noEmit",
134
160
  "verify:precompile": "node scripts/verify-precompile-fresh.mjs",
@@ -138,6 +164,7 @@
138
164
  "ajv": "8.20.0",
139
165
  "dompurify": "^3.4.12",
140
166
  "jiti": "^1.21.7",
167
+ "js-yaml": "^4.3.2",
141
168
  "msw": "2.15.0",
142
169
  "reflect-metadata": "^0.2.1",
143
170
  "server-only": "^0.0.1"
@@ -157,7 +184,6 @@
157
184
  "@vitest/coverage-v8": "^3.2.7",
158
185
  "ajv-formats": "3.0.1",
159
186
  "esbuild": "^0.25.12",
160
- "js-yaml": "^4.3.2",
161
187
  "jsdom": "^26.1.0",
162
188
  "next": "16.3.1",
163
189
  "playwright": "^1.62.1",
@@ -1,27 +0,0 @@
1
- /**
2
- * Browser-safe Host bridges used by the SOMA client entry.
3
- *
4
- * These modules may be imported from `'use client'` code.
5
- * They must not pull Node fs/jiti/server-only modules.
6
- */
7
- export {
8
- SomaDomainLoadError,
9
- loadHostDomainClass,
10
- resolveSomaDomainConstructor,
11
- type SomaDomainConstructor,
12
- } from './load-host-domain-class';
13
- export {
14
- resolveHostBootstrapOptions,
15
- type SomaBootstrapConfigurator,
16
- } from './resolve-host-bootstrap';
17
- export {
18
- createSomaDomainLoaderKey,
19
- findSomaDomainLoader,
20
- loadSomaDomainModuleFromRegistry,
21
- type SomaDomainLoadContext,
22
- type SomaDomainLoader,
23
- type SomaDomainLoaderMap,
24
- type SomaDomainLoaderModule,
25
- type SomaDomainModule,
26
- type SomaDomainModuleResolver,
27
- } from './soma-domain-loaders';
@@ -1,36 +0,0 @@
1
- // core/client/parser/yaml-loader.ts — YAML 文件加载和解析封装
2
- // 封装 js-yaml 库,提供异步文件加载和同步字符串解析
3
-
4
- import yaml from 'js-yaml';
5
-
6
- /**
7
- * 异步加载并解析 YAML 文件
8
- *
9
- * 使用 fetch API 获取文件内容,然后通过 js-yaml 解析为 JavaScript 对象。
10
- * 适用于浏览器环境中加载 YAML 配置文件。
11
- *
12
- * @param path - YAML 文件的 URL 路径
13
- * @returns 解析后的 JavaScript 对象
14
- * @throws Error 文件加载失败或 YAML 解析错误时抛出
15
- */
16
- export async function loadYamlFile(path: string): Promise<any> {
17
- const res = await fetch(path);
18
- if (!res.ok) {
19
- throw new Error(`Failed to load YAML: ${path} (${res.status})`);
20
- }
21
- const text = await res.text();
22
- return yaml.load(text);
23
- }
24
-
25
- /**
26
- * 同步解析 YAML 字符串
27
- *
28
- * 将 YAML 格式的文本直接解析为 JavaScript 对象。
29
- *
30
- * @param text - YAML 格式的字符串
31
- * @returns 解析后的 JavaScript 对象
32
- * @throws YAMLException YAML 语法错误时抛出
33
- */
34
- export function parseYamlString(text: string): any {
35
- return yaml.load(text);
36
- }
@@ -1,12 +0,0 @@
1
- /** SOMA runtime manifest version contract */
2
- export const SOMA_MANIFEST_VERSION = '1.0.0' as const;
3
-
4
- export type SomaManifestVersion = typeof SOMA_MANIFEST_VERSION;
5
-
6
- export function assertManifestVersion(version: string): void {
7
- if (version !== SOMA_MANIFEST_VERSION) {
8
- throw new Error(
9
- `[SOMA] Incompatible manifest version: expected ${SOMA_MANIFEST_VERSION}, got ${version}`,
10
- );
11
- }
12
- }
@@ -1,9 +0,0 @@
1
- /**
2
- * Browser-safe Host bridges used by the SOMA client entry.
3
- *
4
- * These modules may be imported from `'use client'` code.
5
- * They must not pull Node fs/jiti/server-only modules.
6
- */
7
- export { SomaDomainLoadError, loadHostDomainClass, resolveSomaDomainConstructor, type SomaDomainConstructor, } from './load-host-domain-class';
8
- export { resolveHostBootstrapOptions, type SomaBootstrapConfigurator, } from './resolve-host-bootstrap';
9
- export { createSomaDomainLoaderKey, findSomaDomainLoader, loadSomaDomainModuleFromRegistry, type SomaDomainLoadContext, type SomaDomainLoader, type SomaDomainLoaderMap, type SomaDomainLoaderModule, type SomaDomainModule, type SomaDomainModuleResolver, } from './soma-domain-loaders';
@@ -1,21 +0,0 @@
1
- /**
2
- * 异步加载并解析 YAML 文件
3
- *
4
- * 使用 fetch API 获取文件内容,然后通过 js-yaml 解析为 JavaScript 对象。
5
- * 适用于浏览器环境中加载 YAML 配置文件。
6
- *
7
- * @param path - YAML 文件的 URL 路径
8
- * @returns 解析后的 JavaScript 对象
9
- * @throws Error 文件加载失败或 YAML 解析错误时抛出
10
- */
11
- export declare function loadYamlFile(path: string): Promise<any>;
12
- /**
13
- * 同步解析 YAML 字符串
14
- *
15
- * 将 YAML 格式的文本直接解析为 JavaScript 对象。
16
- *
17
- * @param text - YAML 格式的字符串
18
- * @returns 解析后的 JavaScript 对象
19
- * @throws YAMLException YAML 语法错误时抛出
20
- */
21
- export declare function parseYamlString(text: string): any;
@@ -1,4 +0,0 @@
1
- /** SOMA runtime manifest version contract */
2
- export declare const SOMA_MANIFEST_VERSION: "1.0.0";
3
- export type SomaManifestVersion = typeof SOMA_MANIFEST_VERSION;
4
- export declare function assertManifestVersion(version: string): void;