soma-core 2.2.5 → 2.2.7

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 (283) hide show
  1. package/README.md +5 -6
  2. package/bin/soma.cjs +2 -2
  3. package/core/build/compiler/flat-page.ts +16 -0
  4. package/core/build/compiler/full-manifest-builder.ts +0 -3
  5. package/core/build/compiler/page-assets.ts +0 -1
  6. package/core/build/compiler/page-closure.ts +245 -0
  7. package/core/build/compiler/page-declaration-compiler.ts +2 -5
  8. package/core/build/compiler/soma-precompile.js +1972 -3312
  9. package/core/build/compiler/soma-precompile.ts +4 -7
  10. package/core/build/component-tree/artifact-codec.ts +4 -8
  11. package/core/build/lsp/soma-declaration.cjs +1 -1
  12. package/core/build/lsp/std-completion.generated.json +3 -3
  13. package/core/client/a11y/a11y-config.ts +2 -1
  14. package/core/client/a11y/dom-id.ts +1 -1
  15. package/core/client/base/SomaHttpClient.ts +11 -3
  16. package/core/client/base/SomaPageRootBase.ts +6 -0
  17. package/core/client/base/defineSomaView.ts +178 -0
  18. package/core/client/base/index.ts +13 -0
  19. package/core/client/base/view-context.ts +328 -0
  20. package/core/client/behavior/adapter-collection.ts +2 -2
  21. package/core/client/compiler/manifest-compiler.ts +5 -36
  22. package/core/client/component/component-definition.types.ts +2 -1
  23. package/core/client/component/component-manager.ts +110 -20
  24. package/core/client/component/structure-adapter.ts +3 -7
  25. package/core/client/container/IContainerAdapter.ts +4 -0
  26. package/core/client/container/SomaContainerAdapter.ts +52 -3
  27. package/core/client/data/data-object-resolver.ts +523 -184
  28. package/core/client/data/data-write-actions.ts +79 -15
  29. package/core/client/data/format-config.ts +3 -1
  30. package/core/client/data/region-scope-port.ts +11 -0
  31. package/core/client/engine/asset-resolver.ts +2 -5
  32. package/core/client/engine/dom-renderer.ts +7 -40
  33. package/core/client/engine/event-engine.ts +29 -108
  34. package/core/client/engine/property-watcher.ts +1 -1
  35. package/core/client/engine/reactive-proxy.ts +78 -17
  36. package/core/client/engine/runtime-builder.ts +0 -14
  37. package/core/client/engine/scope-resolver.ts +18 -0
  38. package/core/client/engine/soma-bootstrap.ts +387 -99
  39. package/core/client/engine/style-binder.ts +49 -106
  40. package/core/client/engine/timer-engine.ts +11 -1
  41. package/core/client/host-bridge/load-host-domain-class.ts +2 -1
  42. package/core/client/infra/http/SomaHttpService.ts +15 -4
  43. package/core/client/infra/i18n/pack-locales.ts +2 -2
  44. package/core/client/infra/notify/DefaultNotifyService.ts +2 -2
  45. package/core/client/mount/domain-rule.ts +7 -3
  46. package/core/client/mount/mount-page.ts +38 -5
  47. package/core/client/mount/types.ts +2 -0
  48. package/core/client/parser/confirm-spec.ts +100 -7
  49. package/core/client/parser/data-config-parser.ts +28 -211
  50. package/core/client/parser/pipeline-parser.ts +16 -60
  51. package/core/client/parser/style-config-parser.ts +101 -95
  52. package/core/client/parser/timer-parser.ts +21 -0
  53. package/core/client/parser/ui-config-parser.ts +64 -12
  54. package/core/client/registry/declaration-renderer.ts +1 -1
  55. package/core/client/render-ports/hide-transition.ts +9 -0
  56. package/core/client/render-ports/index.ts +4 -0
  57. package/core/client/render-ports/notify-renderer.ts +2 -1
  58. package/core/client/runtime/SomaRuntimeServices.ts +2 -1
  59. package/core/client/runtime/SomaSnapshotStore.ts +5 -0
  60. package/core/client/security/url-guard.ts +71 -11
  61. package/core/client/validation/async-check-registry.ts +2 -1
  62. package/core/client/validation/contract-validator.ts +2 -6
  63. package/core/client/validation/field-rules.ts +3 -13
  64. package/core/client/validation/object-rules.ts +2 -10
  65. package/core/index.ts +17 -39
  66. package/core/inspect/check-product.ts +5 -5
  67. package/core/inspect/runtime.ts +2 -1
  68. package/core/server/api/dispatch-service-api.ts +35 -36
  69. package/core/server/api/load-host-service.ts +8 -4
  70. package/core/server/api/paged-list.ts +259 -0
  71. package/core/server/compile-port.ts +1 -1
  72. package/core/server/host/app-config-composer.ts +2 -1
  73. package/core/server/host/empty-host-bootstrap.mjs +3 -0
  74. package/core/server/host/host-assembly-entry.ts +1 -0
  75. package/core/server/host/host-assembly.ts +50 -3
  76. package/core/server/host/host-caller.ts +2 -1
  77. package/core/server/host/host-dir.ts +9 -0
  78. package/core/server/host/host-response-headers.ts +2 -1
  79. package/core/server/host/invoke-host-request-hook.ts +28 -4
  80. package/core/server/host/published-page-assets.ts +2 -1
  81. package/core/server/host/resolve-host-request-hook.ts +25 -7
  82. package/core/server/host/server-page-assets.ts +4 -4
  83. package/core/server/host/source-aliases.cjs +345 -0
  84. package/core/server/host/source-aliases.ts +32 -0
  85. package/core/server/host/source-packages.cjs +1 -0
  86. package/core/server/host/virtual-pages.ts +3 -2
  87. package/core/server/infra/cache/ServerFileCache.ts +83 -10
  88. package/core/server/node.ts +10 -0
  89. package/core/server/registry/api-registry-store.ts +3 -1
  90. package/core/server/registry/declaration-precompiler.ts +0 -2
  91. package/core/server/registry/page-registry-repository.ts +2 -1
  92. package/core/server/registry/page-registry-store.ts +2 -1
  93. package/core/server/registry/registry-error.ts +6 -1
  94. package/core/server/registry/registry-file-lock.ts +296 -23
  95. package/core/server/registry/request-body-limit.ts +3 -2
  96. package/core/server/registry/validation/declaration-safety-scan.ts +151 -27
  97. package/core/server/runtime-space/access-gate.ts +21 -7
  98. package/core/server/runtime-space/bindings.ts +3 -6
  99. package/core/server/runtime-space/dynamic-pages.ts +181 -49
  100. package/core/server/runtime-space/errors.ts +3 -0
  101. package/core/server/runtime-space/inject.ts +78 -16
  102. package/core/server/runtime-space/page-grants.ts +7 -1
  103. package/core/server/runtime-space/resolve.ts +66 -19
  104. package/core/server/runtime-space/store.ts +32 -3
  105. package/core/server/runtime-space/submit-steps.ts +2 -1
  106. package/core/server/runtime-space/types.ts +3 -1
  107. package/core/shared/component-tree-errors.ts +2 -1
  108. package/core/shared/contract-a11y.ts +1 -1
  109. package/core/shared/contract-sections.ts +2 -2
  110. package/core/shared/core-diagnostic-codes.ts +14 -0
  111. package/core/shared/data-declaration-checks.ts +29 -3
  112. package/core/shared/declaration-keys.ts +1 -1
  113. package/core/shared/engines/engine-error.ts +2 -1
  114. package/core/shared/generation-error.ts +2 -1
  115. package/core/shared/page-envelope.ts +1 -1
  116. package/core/shared/pure-binding.ts +88 -0
  117. package/core/shared/registry-generated/diagnostic-registry-index.ts +21 -19
  118. package/core/shared/registry-generated/diagnostic-registry.ts +170 -177
  119. package/core/shared/registry-generated/limits.ts +65 -13
  120. package/core/shared/registry-generated/std-grammar-completion.ts +0 -4
  121. package/core/shared/registry-generated/std-grammar-views.ts +40 -10
  122. package/core/shared/registry-generated/std-grammar.ts +43 -21
  123. package/core/shared/soma-error.ts +36 -0
  124. package/core/shared/types/compile-port.types.ts +1 -1
  125. package/core/shared/types/data-config.types.ts +20 -18
  126. package/core/shared/types/engine.types.ts +0 -3
  127. package/core/shared/types/event.types.ts +10 -11
  128. package/core/shared/types/generation-error.types.ts +5 -1
  129. package/core/shared/types/host-assembly.types.ts +7 -1
  130. package/core/shared/types/manifest.types.ts +0 -3
  131. package/core/shared/types/region-scope.types.ts +5 -1
  132. package/core/shared/types/scope-manifest.types.ts +0 -2
  133. package/core/shared/types/style-config.types.ts +21 -21
  134. package/core/shared/types/ui-config.types.ts +4 -5
  135. package/core/shared/types/watcher.types.ts +1 -1
  136. package/dist/browser/runtime-bundle.manifest.json +11 -13
  137. package/dist/browser/soma-runtime.js +2733 -2712
  138. package/dist/core/index.cjs +5665 -5534
  139. package/dist/host-native/aot-builder.cjs +330 -1
  140. package/dist/host-native/native-server.cjs +5434 -4726
  141. package/dist/lsp/component-tree.cjs +5868 -7040
  142. package/dist/types/build/compiler/full-manifest-builder.d.ts +0 -2
  143. package/dist/types/build/compiler/page-closure.d.ts +21 -0
  144. package/dist/types/build/compiler/page-declaration-compiler.d.ts +2 -4
  145. package/dist/types/build/compiler/soma-precompile.d.ts +1 -3
  146. package/dist/types/build/component-tree/artifact-codec.d.ts +0 -2
  147. package/dist/types/client/a11y/a11y-config.d.ts +2 -1
  148. package/dist/types/client/base/SomaHttpClient.d.ts +1 -1
  149. package/dist/types/client/base/SomaPageRootBase.d.ts +5 -0
  150. package/dist/types/client/base/defineSomaView.d.ts +46 -0
  151. package/dist/types/client/base/index.d.ts +2 -0
  152. package/dist/types/client/base/view-context.d.ts +136 -0
  153. package/dist/types/client/behavior/adapter-collection.d.ts +1 -1
  154. package/dist/types/client/compiler/manifest-compiler.d.ts +0 -3
  155. package/dist/types/client/component/component-definition.types.d.ts +2 -1
  156. package/dist/types/client/component/component-manager.d.ts +29 -0
  157. package/dist/types/client/container/IContainerAdapter.d.ts +3 -0
  158. package/dist/types/client/container/SomaContainerAdapter.d.ts +5 -0
  159. package/dist/types/client/data/data-object-resolver.d.ts +93 -31
  160. package/dist/types/client/data/format-config.d.ts +2 -1
  161. package/dist/types/client/engine/dom-renderer.d.ts +1 -2
  162. package/dist/types/client/engine/event-engine.d.ts +0 -7
  163. package/dist/types/client/engine/reactive-proxy.d.ts +11 -4
  164. package/dist/types/client/engine/runtime-builder.d.ts +0 -4
  165. package/dist/types/client/engine/soma-bootstrap.d.ts +44 -6
  166. package/dist/types/client/engine/style-binder.d.ts +8 -4
  167. package/dist/types/client/host-bridge/load-host-domain-class.d.ts +2 -1
  168. package/dist/types/client/mount/domain-rule.d.ts +2 -0
  169. package/dist/types/client/mount/mount-page.d.ts +2 -1
  170. package/dist/types/client/mount/types.d.ts +2 -0
  171. package/dist/types/client/parser/confirm-spec.d.ts +27 -3
  172. package/dist/types/client/parser/data-config-parser.d.ts +6 -5
  173. package/dist/types/client/parser/style-config-parser.d.ts +7 -3
  174. package/dist/types/client/parser/timer-parser.d.ts +5 -0
  175. package/dist/types/client/parser/ui-config-parser.d.ts +6 -2
  176. package/dist/types/client/render-ports/hide-transition.d.ts +9 -0
  177. package/dist/types/client/render-ports/index.d.ts +4 -0
  178. package/dist/types/client/render-ports/notify-renderer.d.ts +2 -1
  179. package/dist/types/client/runtime/SomaSnapshotStore.d.ts +2 -0
  180. package/dist/types/client/security/url-guard.d.ts +14 -0
  181. package/dist/types/client/validation/async-check-registry.d.ts +2 -1
  182. package/dist/types/client/validation/object-rules.d.ts +0 -5
  183. package/dist/types/index.d.ts +6 -11
  184. package/dist/types/inspect/runtime.d.ts +2 -1
  185. package/dist/types/server/api/dispatch-service-api.d.ts +5 -0
  186. package/dist/types/server/api/load-host-service.d.ts +1 -1
  187. package/dist/types/server/api/paged-list.d.ts +101 -0
  188. package/dist/types/server/compile-port.d.ts +1 -1
  189. package/dist/types/server/host/host-assembly-entry.d.ts +1 -1
  190. package/dist/types/server/host/host-assembly.d.ts +2 -0
  191. package/dist/types/server/host/host-dir.d.ts +2 -0
  192. package/dist/types/server/host/invoke-host-request-hook.d.ts +10 -3
  193. package/dist/types/server/host/published-page-assets.d.ts +2 -1
  194. package/dist/types/server/host/resolve-host-request-hook.d.ts +18 -5
  195. package/dist/types/server/host/server-page-assets.d.ts +2 -1
  196. package/dist/types/server/host/source-aliases.d.cts +53 -0
  197. package/dist/types/server/host/source-aliases.d.ts +30 -0
  198. package/dist/types/server/host/source-packages.d.cts +2 -0
  199. package/dist/types/server/infra/cache/ServerFileCache.d.ts +8 -0
  200. package/dist/types/server/node.d.ts +1 -0
  201. package/dist/types/server/registry/declaration-precompiler.d.ts +0 -1
  202. package/dist/types/server/registry/registry-error.d.ts +5 -1
  203. package/dist/types/server/registry/registry-file-lock.d.ts +30 -0
  204. package/dist/types/server/registry/request-body-limit.d.ts +3 -2
  205. package/dist/types/server/registry/validation/declaration-safety-scan.d.ts +3 -0
  206. package/dist/types/server/runtime-space/access-gate.d.ts +7 -0
  207. package/dist/types/server/runtime-space/bindings.d.ts +3 -2
  208. package/dist/types/server/runtime-space/dynamic-pages.d.ts +6 -1
  209. package/dist/types/server/runtime-space/errors.d.ts +1 -1
  210. package/dist/types/server/runtime-space/resolve.d.ts +2 -0
  211. package/dist/types/server/runtime-space/store.d.ts +8 -1
  212. package/dist/types/server/runtime-space/submit-steps.d.ts +2 -1
  213. package/dist/types/server/runtime-space/types.d.ts +3 -1
  214. package/dist/types/shared/component-tree-errors.d.ts +2 -1
  215. package/dist/types/shared/core-diagnostic-codes.d.ts +1 -1
  216. package/dist/types/shared/declaration-keys.d.ts +1 -1
  217. package/dist/types/shared/engines/engine-error.d.ts +2 -1
  218. package/dist/types/shared/generation-error.d.ts +2 -1
  219. package/dist/types/shared/pure-binding.d.ts +48 -0
  220. package/dist/types/shared/registry-generated/diagnostic-registry.d.ts +149 -158
  221. package/dist/types/shared/registry-generated/limits.d.ts +54 -10
  222. package/dist/types/shared/registry-generated/std-grammar-completion.d.ts +0 -30
  223. package/dist/types/shared/registry-generated/std-grammar-views.d.ts +97 -23
  224. package/dist/types/shared/registry-generated/std-grammar.d.ts +110 -242
  225. package/dist/types/shared/soma-error.d.ts +15 -0
  226. package/dist/types/shared/types/data-config.types.d.ts +17 -17
  227. package/dist/types/shared/types/engine.types.d.ts +0 -3
  228. package/dist/types/shared/types/event.types.d.ts +9 -7
  229. package/dist/types/shared/types/generation-error.types.d.ts +1 -1
  230. package/dist/types/shared/types/host-assembly.types.d.ts +2 -0
  231. package/dist/types/shared/types/manifest.types.d.ts +0 -3
  232. package/dist/types/shared/types/region-scope.types.d.ts +4 -1
  233. package/dist/types/shared/types/scope-manifest.types.d.ts +0 -2
  234. package/dist/types/shared/types/style-config.types.d.ts +17 -19
  235. package/dist/types/shared/types/ui-config.types.d.ts +4 -5
  236. package/host-native/bin/host-native.cjs +22 -1
  237. package/host-native/client/browser-entry.ts +21 -172
  238. package/host-native/src/aot-builder.ts +75 -0
  239. package/host-native/src/host-prepare.ts +39 -5
  240. package/host-native/src/manifest-http.ts +2 -3
  241. package/host-native/src/native-server.ts +812 -174
  242. package/host-native/src/page-http.ts +3 -3
  243. package/host-native/src/public-packages.cjs +0 -1
  244. package/host-native/src/registry-handler.ts +12 -5
  245. package/host-native/src/static-file.ts +203 -53
  246. package/host-native/styles/globals.css +30 -28
  247. package/package.json +14 -2
  248. package/core/client/engine/step-runner.ts +0 -212
  249. package/core/client/engine/trigger-engine.ts +0 -55
  250. package/core/client/format/zoned.ts +0 -10
  251. package/core/client/parser/step-parser.ts +0 -359
  252. package/core/client/parser/trigger-parser.ts +0 -90
  253. package/core/client/parser/value-lang.ts +0 -340
  254. package/core/client/time/instant.ts +0 -2
  255. package/core/shared/calc/coerce.ts +0 -2
  256. package/core/shared/calc/errors.ts +0 -40
  257. package/core/shared/calc/evaluator.ts +0 -113
  258. package/core/shared/calc/index.ts +0 -11
  259. package/core/shared/calc/lexer.ts +0 -189
  260. package/core/shared/calc/parser.ts +0 -193
  261. package/core/shared/calc/typer.ts +0 -171
  262. package/core/shared/date-parts.ts +0 -2
  263. package/core/shared/show-when.ts +0 -77
  264. package/core/shared/types/step.types.ts +0 -91
  265. package/core/shared/types/trigger.types.ts +0 -14
  266. package/dist/types/client/engine/step-runner.d.ts +0 -42
  267. package/dist/types/client/engine/trigger-engine.d.ts +0 -16
  268. package/dist/types/client/format/zoned.d.ts +0 -1
  269. package/dist/types/client/parser/step-parser.d.ts +0 -23
  270. package/dist/types/client/parser/trigger-parser.d.ts +0 -13
  271. package/dist/types/client/parser/value-lang.d.ts +0 -63
  272. package/dist/types/client/time/instant.d.ts +0 -1
  273. package/dist/types/shared/calc/coerce.d.ts +0 -1
  274. package/dist/types/shared/calc/errors.d.ts +0 -14
  275. package/dist/types/shared/calc/evaluator.d.ts +0 -2
  276. package/dist/types/shared/calc/index.d.ts +0 -6
  277. package/dist/types/shared/calc/lexer.d.ts +0 -19
  278. package/dist/types/shared/calc/parser.d.ts +0 -43
  279. package/dist/types/shared/calc/typer.d.ts +0 -11
  280. package/dist/types/shared/date-parts.d.ts +0 -1
  281. package/dist/types/shared/show-when.d.ts +0 -21
  282. package/dist/types/shared/types/step.types.d.ts +0 -76
  283. package/dist/types/shared/types/trigger.types.d.ts +0 -12
@@ -1,6 +1,5 @@
1
1
  import type { UiConfig } from '../../shared/types/ui-config.types';
2
2
  import type { ParsedEvent } from '../../shared/types/event.types';
3
- import type { PropertyTrigger } from '../../shared/types/trigger.types';
4
3
  import type { ParsedTimer } from '../../shared/types/timer.types';
5
4
  import type { StyleConfig } from '../../shared/types/style-config.types';
6
5
  import type { SomaDataConfig } from '../../shared/types/data-config.types';
@@ -19,7 +18,6 @@ export interface SomaPrecompiledPage {
19
18
  artifact?: TreeArtifact;
20
19
  uiConfig: UiConfig;
21
20
  eventConfig: ParsedEvent[];
22
- triggers: PropertyTrigger[];
23
21
  timers: ParsedTimer[];
24
22
  styleConfig?: StyleConfig;
25
23
  appConfig?: unknown;
@@ -0,0 +1,21 @@
1
+ export type SomaPageClosureCode = 'CORE-INJECT-PAGE-LOGIC' | 'CORE-INJECT-PAGE-CLOSURE';
2
+ export interface SomaPageClosureIssue {
3
+ readonly code: SomaPageClosureCode;
4
+ /** 声明内路径,形如 `ui:show.title.when` / `event:triggers` / `style:states` */
5
+ readonly path: string;
6
+ readonly message: string;
7
+ }
8
+ export interface SomaPageDocs {
9
+ readonly ui: Record<string, unknown>;
10
+ readonly event?: Record<string, unknown>;
11
+ readonly style?: Record<string, unknown>;
12
+ }
13
+ /**
14
+ * 对一页四件套(已读成映射)做闭集校验,返回全部问题(空 = 通过)。
15
+ * 先扫逻辑键(带码、带「原来是什么」),再跑各 parser 的严格闭集;两类问题分开报,调用方按 `code` 判。
16
+ */
17
+ export declare function inspectPageClosure(docs: SomaPageDocs): SomaPageClosureIssue[];
18
+ /** 把问题收成一条人读文案(码 + 路径 + 说明,逐条一行) */
19
+ export declare function formatPageClosureIssues(issues: readonly SomaPageClosureIssue[]): string;
20
+ /** 取问题里的主码:有逻辑写法报 LOGIC,否则 CLOSURE */
21
+ export declare function primaryPageClosureCode(issues: readonly SomaPageClosureIssue[]): SomaPageClosureCode;
@@ -1,7 +1,6 @@
1
1
  import { type SomaFlatDoc } from './flat-page';
2
2
  import type { SomaDataConfig } from '../../shared/types/data-config.types';
3
3
  import type { ParsedEvent } from '../../shared/types/event.types';
4
- import type { PropertyTrigger } from '../../shared/types/trigger.types';
5
4
  import type { StyleConfig } from '../../shared/types/style-config.types';
6
5
  import type { ParsedTimer } from '../../shared/types/timer.types';
7
6
  import type { SomaCompiledStyle, SomaDegradedRegion, SomaPageFragments, UiConfig } from '../../shared/types/ui-config.types';
@@ -14,7 +13,7 @@ import type { SomaPageMarkup, TreeCompileContext, ComponentTreeTrace } from '../
14
13
  import type { ComponentTreeRuntimeEnvelope, SomaArtifactEnvelopeHead } from '../../shared/types/component-tree-artifact.types';
15
14
  /**
16
15
  * 页面级装配输入:四件套。
17
- * `html` + `uiYaml`(平铺,含顶层保留键)+ `eventYaml`(事件管道 / triggers / timers)+ `styleYaml`(状态样式 / 过渡 / 页面级主题)。
16
+ * `html` + `uiYaml`(平铺,含顶层保留键)+ `eventYaml`(事件管道 / timers)+ `styleYaml`(状态样式 / 过渡 / 页面级主题)。
18
17
  * 三份声明都可以是平铺文本或已解析对象;`eventYaml` / `styleYaml` 缺省 = 该件不存在。
19
18
  */
20
19
  export interface SomaPageSource {
@@ -68,7 +67,6 @@ export interface SomaCompiledPageAssets {
68
67
  treeTrace?: ComponentTreeTrace;
69
68
  uiConfig: UiConfig;
70
69
  eventConfig: ParsedEvent[];
71
- triggers: PropertyTrigger[];
72
70
  timers: ParsedTimer[];
73
71
  styleConfig?: StyleConfig;
74
72
  dataConfig?: SomaDataConfig;
@@ -103,7 +101,7 @@ export declare const SOMA_UNKNOWN_COMPILE_IDENTITY = "";
103
101
  * 编译一整页四件套(html + 平铺 uiYaml + eventYaml? + styleYaml?,只认 core 标准格式)。块声明、非白名单顶层键、形状不合法的侧车在唯一入口直接拒绝。
104
102
  *
105
103
  * include 展开、组件树标记、运行期 DSL 解析留在 core;page 块里白名单之外的键(方言声明)由块解析当场拒收——
106
- * 方言(soma-ui / soma-lite)在运行期把自己的页面编译成标准格式,再按 URL 注入 core。
104
+ * 方言(soma-ui / soma-kit)在运行期把自己的页面编译成标准格式,再按 URL 注入 core。
107
105
  */
108
106
  export declare function compilePageDeclaration(source: SomaPageSource, options?: SomaPageCompileOptions): SomaPageCompileResult;
109
107
  /**
@@ -1,12 +1,10 @@
1
1
  import type { SomaDataConfig } from '../../shared/types/data-config.types';
2
2
  import type { UiConfig } from '../../shared/types/ui-config.types';
3
3
  import type { ParsedEvent } from '../../shared/types/event.types';
4
- import type { PropertyTrigger } from '../../shared/types/trigger.types';
5
4
  import type { ParsedTimer } from '../../shared/types/timer.types';
6
5
  /** _event.yaml 预编译产物 */
7
6
  export interface CompiledEventConfig {
8
7
  events: ParsedEvent[];
9
- triggers: PropertyTrigger[];
10
8
  timers: ParsedTimer[];
11
9
  }
12
10
  import type { StyleConfig } from '../../shared/types/style-config.types';
@@ -23,7 +21,7 @@ export declare function precompileUiYaml(yamlStr: string): string;
23
21
  */
24
22
  export declare function precompileUiModule(yamlStr: string): string;
25
23
  /**
26
- * 预编译 Event YAML → JSON 字符串(含 events + triggers)
24
+ * 预编译 Event YAML → JSON 字符串(含 events + timers)
27
25
  */
28
26
  export declare function precompileEventYaml(yamlStr: string): string;
29
27
  /**
@@ -9,8 +9,6 @@ export interface RuntimeConfigInput {
9
9
  uiYaml?: string;
10
10
  eventConfig?: unknown;
11
11
  eventYaml?: string;
12
- triggers?: unknown;
13
- triggerConfig?: unknown;
14
12
  timers?: unknown;
15
13
  timerConfig?: unknown;
16
14
  dataConfig?: unknown;
@@ -1,3 +1,4 @@
1
+ import { SomaError } from '../../shared/soma-error';
1
2
  import type { MotionOverride } from './motion';
2
3
  /** `a11y:` 的封闭键集 */
3
4
  export declare const SOMA_A11Y_APP_CONFIG_KEYS: readonly ["motion"];
@@ -6,7 +7,7 @@ export declare const SOMA_A11Y_MOTION_VALUES: readonly ["auto", "reduce", "none"
6
7
  export interface SomaA11yConfig {
7
8
  readonly motion: MotionOverride;
8
9
  }
9
- export declare class SomaA11yConfigError extends Error {
10
+ export declare class SomaA11yConfigError extends SomaError {
10
11
  readonly code: "CORE-A11Y-CONFIG";
11
12
  readonly path: string;
12
13
  constructor(message: string, path: string);
@@ -4,7 +4,7 @@
4
4
  export interface SomaHttpClientConfig {
5
5
  /** API 基础地址(如 "https://api.example.com") */
6
6
  baseURL: string;
7
- /** 请求超时时间(毫秒),默认 30000 */
7
+ /** 请求超时时间(毫秒),缺省取 soma-foundation/values 的 Host HTTP 默认值 */
8
8
  timeout?: number;
9
9
  /** Generic headers supplied by the host runtime, such as page context. */
10
10
  defaultHeaders?: Record<string, string> | (() => Record<string, string>);
@@ -44,6 +44,11 @@ export declare abstract class SomaPageRootBase implements SomaPageRoot {
44
44
  * 以非枚举属性挂载:不进入页面状态序列化/快照,存量行为零变化。
45
45
  */
46
46
  data: Record<string, unknown>;
47
+ /**
48
+ * 展示对象的宿主面(`defineSomaView` 的 ctx 经它调具名动作、读 / 重取数据、旁路订阅组件事件)。
49
+ * 由 bootstrap 在创建页面根时以非枚举属性注入;非展示对象的页面根不使用。
50
+ */
51
+ _viewHost?: import('./view-context').SomaViewHost;
47
52
  /** 由 bootstrap 注入的数据对象重取钩子(无 `data:` 声明时保持未定义) */
48
53
  _reloadData?: () => Promise<void>;
49
54
  /**
@@ -0,0 +1,46 @@
1
+ import { SomaError } from '../../shared/soma-error';
2
+ import { type ViewStateShape } from 'soma-foundation/view-state';
3
+ import { SomaPageRootBase } from './SomaPageRootBase';
4
+ import { type SomaViewContext } from './view-context';
5
+ /** 深只读:数组与其元素一路只读(元素没有被代理,改了也不刷新),函数原样 */
6
+ export type DeepReadonly<T> = T extends (...args: never[]) => unknown ? T : T extends readonly (infer U)[] ? ReadonlyArray<DeepReadonly<U>> : T extends object ? {
7
+ readonly [K in keyof T]: DeepReadonly<T[K]>;
8
+ } : T;
9
+ /**
10
+ * data 对象(展示对象 state)的形状推导出的成员类型:数组成员一律 `ReadonlyArray<DeepReadonly<元素>>`
11
+ * (`push` / 下标赋值 / `rows[3].status = …` 在 tsc 下直接报错),对象成员保持可写(字段写入触发刷新),标量原样。
12
+ * 整体赋值 `view.rows = [...view.rows, x]` / `view.rows = view.rows.map(...)` 仍允许。
13
+ * 原生 Domain 类(SomaPageRootBase 子类)把数组字段标成 `SomaState<{...}>['rows']` 或直接 `ReadonlyArray<...>` 获得同样的拦截。
14
+ * 初值 `[]` 会被推成 `never[]`,请写 `[] as Row[]`。
15
+ */
16
+ export type SomaState<S> = {
17
+ [K in keyof S]: S[K] extends (...args: never[]) => unknown ? S[K] : S[K] extends readonly (infer U)[] ? ReadonlyArray<DeepReadonly<U>> : S[K] extends object ? SomaState<S[K]> : S[K];
18
+ };
19
+ export interface SomaViewDefinition<S extends Record<string, unknown>, M extends Record<string, (view: any, payload: any, ctx: SomaViewContext) => unknown> = Record<string, (view: SomaPageRootBase & SomaState<S>, payload: any, ctx: SomaViewContext) => unknown>> {
20
+ /** 类名:页面 `domain:` / `bind.obj` 写的就是它,也是 pageRoots 表的键 */
21
+ readonly name: string;
22
+ /** 可绑定的成员与初值(页面路径只能指向这里声明过的成员);初值须是 JSON 值,每个实例各拷一份 */
23
+ readonly state: S;
24
+ /** 方法:`(view, payload, ctx) => void | false`;`view` 是响应式页面根,改成员即触发被动刷新;`ctx` 是能力上下文(调业务对象、改下层对象、在下层注册事件、托管计时) */
25
+ readonly methods?: M;
26
+ /** 页面挂载后调用一次:在这里用 ctx 注册事件订阅、定时器;订阅与计时随卸载自动撤销 */
27
+ readonly onMount?: (view: SomaPageRootBase & SomaState<S>, ctx: SomaViewContext) => void | Promise<void>;
28
+ /** 页面卸载时调用(先于 ctx 自动撤销订阅与计时) */
29
+ readonly onUnmount?: (view: SomaPageRootBase & SomaState<S>, ctx: SomaViewContext) => void;
30
+ }
31
+ export interface SomaViewMeta {
32
+ readonly name: string;
33
+ readonly stateKeys: readonly string[];
34
+ /** state 初值扫出的形状表(路径 → scalar / object / array):页面绑定性质核对与检查层写入核对读它 */
35
+ readonly shape: ViewStateShape;
36
+ readonly methodNames: readonly string[];
37
+ }
38
+ export declare class SomaViewDefineError extends SomaError {
39
+ readonly code = "CORE-VIEW-DEFINE";
40
+ constructor(message: string);
41
+ }
42
+ /** 读一个展示对象类的元信息;不是 defineSomaView 生成的类返回 undefined */
43
+ export declare function readSomaViewMeta(cls: unknown): SomaViewMeta | undefined;
44
+ export declare function defineSomaView<S extends Record<string, unknown>, M extends Record<string, (view: SomaPageRootBase & SomaState<S>, payload: any, ctx: SomaViewContext) => unknown> = Record<string, (view: SomaPageRootBase & SomaState<S>, payload: any, ctx: SomaViewContext) => unknown>>(definition: SomaViewDefinition<S, M>): (new () => SomaPageRootBase & SomaState<S>) & {
45
+ readonly viewName: string;
46
+ };
@@ -5,5 +5,7 @@ export { SomaEntity } from './SomaEntity';
5
5
  export { SomaHttpClient, describeHttpErrorBody, type SomaHttpClientConfig } from './SomaHttpClient';
6
6
  export { SomaPageRootBase } from './SomaPageRootBase';
7
7
  export { SomaValidator } from './SomaValidator';
8
+ export { defineSomaView, readSomaViewMeta, SomaViewDefineError, type SomaViewDefinition, type SomaViewMeta, type SomaState, type DeepReadonly } from './defineSomaView';
8
9
  export { runAsync, type AsyncStateHost } from './runAsync';
9
10
  export * from './decorators/index';
11
+ export { createViewContext, SomaViewContextError, type SomaViewContext, type SomaViewContextHandle, type SomaViewHost, type SomaViewHttp, type SomaViewComponentHandle, type SomaViewDataHandle, type SomaViewLatest, type SomaViewDebounced, } from './view-context';
@@ -0,0 +1,136 @@
1
+ import { SomaError } from '../../shared/soma-error';
2
+ import type { SomaWriteOutcomeView } from '../../shared/types/write-outcome-view.types';
3
+ import type { SomaDataReadState, SomaDataReadStatus } from '../../shared/types/data-config.types';
4
+ export declare class SomaViewContextError extends SomaError {
5
+ readonly code = "CORE-VIEW-CTX";
6
+ constructor(message: string);
7
+ }
8
+ /** 请求面(页面 http 服务的最小形状):绝对路径 `/api/...` 与 baseURL 重叠时已去重 */
9
+ export interface SomaViewHttp {
10
+ get<T = unknown>(url: string, config?: {
11
+ params?: Record<string, string>;
12
+ }): Promise<T>;
13
+ post<T = unknown>(url: string, body?: unknown): Promise<T>;
14
+ put<T = unknown>(url: string, body?: unknown): Promise<T>;
15
+ patch<T = unknown>(url: string, body?: unknown): Promise<T>;
16
+ delete<T = unknown>(url: string): Promise<T>;
17
+ }
18
+ /**
19
+ * 引擎侧的宿主面(SomaBootstrap 在创建页面根时以非枚举属性 `_viewHost` 注入)。
20
+ * 展示对象不直接碰它,只经 {@link SomaViewContext};单测可以手工给一个替身。
21
+ */
22
+ export interface SomaViewHost {
23
+ readonly http: SomaViewHttp;
24
+ /** 调具名动作(browserMount.actions 登记的,或内置 data.submit / data.orderMove);未登记 reject */
25
+ action(name: string, payload: Record<string, unknown>): Promise<unknown>;
26
+ /** 数据对象当前值 */
27
+ readData(name: string): unknown;
28
+ /** 数据对象当前完整读状态(可选) */
29
+ readDataStatus?(name: string): SomaDataReadStatus | undefined;
30
+ /** 重取数据对象(缺省 = 全部);依赖它的下游随 DAG 一起重取 */
31
+ reloadData(names?: readonly string[]): Promise<void>;
32
+ /** 数据到达(首轮取数、重取、推送刷新、轮询)后通知 */
33
+ onData(listener: () => void): () => void;
34
+ /** 组件是否已挂载(按页面 data-soma-id 或组件内静态子组件 id) */
35
+ componentMounted(id: string): boolean;
36
+ /** 组件当前 props(页面求值后的);未挂载 undefined */
37
+ componentProps(id: string): Readonly<Record<string, unknown>> | undefined;
38
+ /** 调组件控制器公开的方法(ctrl.handle[method]);组件未挂载 → found: false;挂载了却没公开该方法 → missing */
39
+ componentCall(id: string, method: string, args: readonly unknown[]): {
40
+ readonly found: boolean;
41
+ readonly missing?: true;
42
+ readonly result?: unknown;
43
+ };
44
+ /** 旁路订阅组件契约 emit(不要求页面 `_event` 声明订阅;组件重新挂载后仍有效) */
45
+ onComponentEmit(id: string, emit: string, listener: (payload: unknown) => void): () => void;
46
+ /** 写入结果(请求 / 提交的结果槽)的当前视图 */
47
+ outcome(scope: string): SomaWriteOutcomeView | undefined;
48
+ /** 写入结果变化通知(所有范围;按范围过滤由 ctx 做) */
49
+ onOutcome(listener: (scope: string) => void): () => void;
50
+ /** 向区域作用域发语义事件(与 `SCOPE | semantic` 管道同一条通道);作用域未声明空操作 */
51
+ emitSemantic(scope: string, name: string, payload: Readonly<Record<string, unknown>>): void;
52
+ }
53
+ /** 组件句柄:稳定壳,组件未挂载 / 重新挂载都不失效 */
54
+ export interface SomaViewComponentHandle {
55
+ readonly id: string;
56
+ /** 组件此刻是否挂载 */
57
+ mounted(): boolean;
58
+ /** 组件当前 props(只读快照);未挂载 undefined */
59
+ props(): Readonly<Record<string, unknown>> | undefined;
60
+ /**
61
+ * 调组件控制器公开的方法(组件在控制器上以 `handle: { 方法 }` 公开,写下层对象就走它)。
62
+ * 组件未挂载返回 undefined(不抛);挂载了但没公开该方法抛 CORE-VIEW-CTX(拼写错误不静默)。
63
+ */
64
+ call<T = unknown>(method: string, ...args: unknown[]): T | undefined;
65
+ /** 订阅组件抛出的契约事件;返回取消订阅。页面是否订阅该 emit 不影响;ctx 卸载时自动取消 */
66
+ on<P = unknown>(emit: string, listener: (payload: P) => void): () => void;
67
+ }
68
+ /** 数据对象句柄 */
69
+ export interface SomaViewDataHandle<T = unknown> {
70
+ readonly name: string;
71
+ /** 当前值(数据未到 undefined) */
72
+ get(): T | undefined;
73
+ /** 当前完整读状态(idle / loading / ready / error / forbidden / partial) */
74
+ status(): SomaDataReadStatus;
75
+ readonly readState: SomaDataReadState;
76
+ readonly loading: boolean;
77
+ readonly ready: boolean;
78
+ readonly errorMessage: string | undefined;
79
+ readonly errorStatus: number | undefined;
80
+ /** 重取这个对象(下游随 DAG 重取) */
81
+ reload(): Promise<void>;
82
+ /** 重试读取(等价于 reload) */
83
+ retry(): Promise<void>;
84
+ /** 数据到达 / 重取完成后通知(回调拿到最新值);返回取消订阅 */
85
+ onChange(listener: (value: T | undefined) => void): () => void;
86
+ }
87
+ /** 只认最新一次的异步任务:新任务开始后,旧任务的结果被丢弃(不 apply、不 fail) */
88
+ export interface SomaViewLatest {
89
+ run<T>(task: () => Promise<T>, apply: (value: T) => void, fail?: (error: unknown) => void): Promise<void>;
90
+ /** 丢弃在途任务的结果 */
91
+ cancel(): void;
92
+ }
93
+ export interface SomaViewDebounced<A extends unknown[]> {
94
+ (...args: A): void;
95
+ cancel(): void;
96
+ }
97
+ export interface SomaViewContext {
98
+ /** 页面还在(卸载后恒为 false;异步回调里可据此自查) */
99
+ readonly alive: boolean;
100
+ /** 业务对象:请求已登记接口(绝对路径 `/api/...`),返回 Promise */
101
+ readonly http: SomaViewHttp;
102
+ /** 业务对象:调具名动作(kit defineKitActions 登记的名字),返回动作结果;动作抛错 / 未登记 → reject */
103
+ action(name: string, payload?: Record<string, unknown>): Promise<unknown>;
104
+ /** 数据对象(读、重取、到达通知) */
105
+ data<T = unknown>(name: string): SomaViewDataHandle<T>;
106
+ /** 重取数据对象(缺省 = 全部) */
107
+ reload(names?: readonly string[]): Promise<void>;
108
+ /** 组件句柄(按页面 data-soma-id):调公开方法(写下层)、订阅事件(在下层注册事件) */
109
+ component(id: string): SomaViewComponentHandle;
110
+ /** 请求 / 提交结果槽的当前视图 */
111
+ outcome(scope: string): SomaWriteOutcomeView | undefined;
112
+ /** 触发下层的语义事件(页面级宿主 / 协调组件订阅的那一条通道,如触发一个声明式请求动作);作用域未声明空操作 */
113
+ emitSemantic(scope: string, name: string, payload?: Readonly<Record<string, unknown>>): void;
114
+ /**
115
+ * 请求完成回调:范围(字符串 = 精确;函数 = 自定判定,用于逐行分槽的结果)的写入结果变化时调用,
116
+ * 参数是该范围最新视图(status: pending / saved / failed / conflict / cancelled)与范围名。返回取消订阅。
117
+ */
118
+ onOutcome(scope: string | ((scope: string) => boolean), listener: (view: SomaWriteOutcomeView, scope: string) => void): () => void;
119
+ /** 托管定时器:每 ms 毫秒调一次 fn;毫秒数由作者在代码里写;返回停止函数,卸载自动清理 */
120
+ every(ms: number, fn: () => void | Promise<void>): () => void;
121
+ /** 托管一次性定时器;返回取消函数,卸载自动清理 */
122
+ after(ms: number, fn: () => void | Promise<void>): () => void;
123
+ /** 托管防抖:停 ms 毫秒后才调 fn;卸载自动取消 */
124
+ debounce<A extends unknown[]>(ms: number, fn: (...args: A) => void | Promise<void>): SomaViewDebounced<A>;
125
+ /** 新建一个「只认最新」的异步闸(丢弃旧结果) */
126
+ latest(): SomaViewLatest;
127
+ /** 登记卸载时的清理函数 */
128
+ onDispose(fn: () => void): void;
129
+ }
130
+ export interface SomaViewContextHandle {
131
+ readonly ctx: SomaViewContext;
132
+ /** 卸载:撤销全部订阅与计时(幂等) */
133
+ dispose(): void;
134
+ }
135
+ /** 造一个展示对象的 ctx;`host` 在用到时才取(引擎先造页面根、后注入宿主面) */
136
+ export declare function createViewContext(getHost: () => SomaViewHost | undefined): SomaViewContextHandle;
@@ -13,7 +13,7 @@ export interface BehaviorCollectionFactory {
13
13
  list<T>(options: CollectionFactoryOptions<T>): ZagCollectionLike<T>;
14
14
  grid<T>(options: GridCollectionFactoryOptions<T>): ZagGridCollectionLike<T>;
15
15
  }
16
- /** Zag `ListCollection`(@zag-js/collection 1.x)在 core 眼里的最小形状:只列 lite / ui 实际要读的成员 */
16
+ /** Zag `ListCollection`(@zag-js/collection 1.x)在 core 眼里的最小形状:只列 ui 实际要读的成员 */
17
17
  export interface ZagCollectionLike<T> {
18
18
  readonly items: T[];
19
19
  readonly size: number;
@@ -25,9 +25,6 @@ export declare class SomaManifestCompiler {
25
25
  /** 列表/对象子作用域配置的管道预校验(行内解释执行前的编译期 fail fast) */
26
26
  private validateScopedPipes;
27
27
  private parseSomaKey;
28
- /** `when` 两种写法:字符串(真值 / `!` 取反)或对象谓词(路径取 field,算子与值进 whenTest) */
29
- private compileWhen;
30
- private parseConditionalPath;
31
28
  private resolveBindingType;
32
29
  /**
33
30
  * 判断 dataPath 是否为静态(初始化后不会变化)。
@@ -74,9 +74,10 @@ export interface SomaComponentStyleFeature {
74
74
  * `validation` 是校验服务(`ctx.services.validation.asyncCheck(name)` → 应用经 `browserMount.asyncChecks` 登记的异步字段检查器,未登记为 null)。
75
75
  * `identity` 是当前身份只读端口(`get(field)` / `userId()`,字段闭集 id / team)。
76
76
  * 与 `soma-design/spec/component-contract.json` 的 `enums.serviceName` 逐值对账(顺序一致)。
77
+ * `actions` 是具名动作调用端口(`ctx.services.actions.run(名字, 载荷)` → 应用经 `browserMount.actions` 登记的具名动作的结果;`has(名字)`;与页面 `ACTION | 名字` 是同一张表)。
77
78
  * `nav` 是导航目录只读端口(`ctx.services.nav` → `SomaNavPort`:`view()` / `entries()` / `groups()` / `activeOf()`;外壳类组件读它渲染菜单与高亮,目录随取页下发、按身份裁剪、不含角色值)。
78
79
  */
79
- export type SomaComponentServiceName = 'http' | 'auth' | 'notify' | 'router' | 'i18n' | 'permission' | 'storage' | 'observation' | 'data' | 'region' | 'engines' | 'format' | 'nav' | 'validation' | 'identity' | 'navHistory' | 'shortcuts';
80
+ export type SomaComponentServiceName = 'http' | 'auth' | 'notify' | 'router' | 'i18n' | 'permission' | 'storage' | 'observation' | 'data' | 'region' | 'engines' | 'format' | 'nav' | 'validation' | 'identity' | 'navHistory' | 'shortcuts' | 'actions';
80
81
  export interface SomaComponentDefinition {
81
82
  /** 契约:core 只读 core 段(`SomaComponentContractCore`),其余段不透明、原样透传(KI-18) */
82
83
  contract: SomaComponentContractCore;
@@ -45,6 +45,11 @@ export interface SomaComponentManagerOptions {
45
45
  styleOptions?: PackStyleOptions;
46
46
  /** 分级确认执行口(typed / consent;与页面级事件引擎同一个,缺省则组件内回落 plain) */
47
47
  confirmGraded?: (spec: SomaConfirmSpec) => boolean | Promise<boolean>;
48
+ /**
49
+ * 旁路事件窥口:任何实例上抛契约 emit 时先调它(不要求页面 `_event` 订阅)。展示对象经 ctx.component(id).on 订阅,
50
+ * 订阅表由 bootstrap 持有(组件管理器换新、组件重新挂载后订阅仍有效)。回调抛错已隔离。
51
+ */
52
+ emitTap?: (instanceId: string, emitName: string, payload: unknown) => void;
48
53
  }
49
54
  export declare class SomaComponentManager {
50
55
  private readonly registry;
@@ -56,6 +61,7 @@ export declare class SomaComponentManager {
56
61
  private readonly observer?;
57
62
  private readonly i18n?;
58
63
  private readonly confirmGraded?;
64
+ private readonly emitTap?;
59
65
  private readonly expander;
60
66
  private readonly treeArtifact?;
61
67
  private readonly preparedDefinitions;
@@ -64,8 +70,13 @@ export declare class SomaComponentManager {
64
70
  private readonly instances;
65
71
  private readonly hostInstances;
66
72
  private readonly watchDisposers;
73
+ /** 页面级实例的「源路径 + 重推 props 闭包」;与 watchDisposers 同生同灭(destroy 整体清空,实例释放时摘除) */
74
+ private propBindings;
67
75
  private page;
68
76
  constructor(options: SomaComponentManagerOptions);
77
+ private tap;
78
+ /** 按页面 data-soma-id 或静态子组件 id 找存活实例(展示对象的组件句柄用);找不到 undefined */
79
+ findInstance(id: string): SomaComponentInstance | undefined;
69
80
  /**
70
81
  * 阶段 A(页面引擎构建前):展开容器内全部静态实例的模板。
71
82
  * 组件嵌套(插槽内容里再放组件)通过多轮扫描收敛,超过深度上限报错。
@@ -87,6 +98,13 @@ export declare class SomaComponentManager {
87
98
  * 组件的 ctrl 派生 getter 本来就是幂等的纯读,重算一遍是安全的。
88
99
  */
89
100
  refreshAll(): void;
101
+ /**
102
+ * 这些源路径下的数据对象没有被替换、但其上的非响应式信息变了(如读状态以不可枚举属性改写):
103
+ * 给绑定到这些路径(相同、之下、或绑定了更上层对象)的页面级实例重新解析并下推一次 props。
104
+ * 只重推 props,不触发页面渲染,也不触发响应式监听;行内实例不在此列。
105
+ * `prefixes` 是已归一的源路径(如 `data.<对象名>`)。
106
+ */
107
+ refreshPropsBoundTo(prefixes: readonly string[]): void;
90
108
  /** 本次存活实例的有限初始化;初始化重渲新建的子实例也在同一生命周期内收敛。 */
91
109
  whenInitialized(): Promise<void>;
92
110
  isInitialized(): boolean;
@@ -226,6 +244,17 @@ export declare class SomaComponentInstance {
226
244
  private rerender;
227
245
  /** props 下行更新:浅合并后整树重渲(ctrl 派生 getter 自然重算) */
228
246
  setProps(next: Record<string, unknown>): void;
247
+ /**
248
+ * 展示对象的调用口:调控制器以 `handle` 公开的方法。
249
+ * 组件把「可被上层对象调用」的方法放在 ctrl.handle 上(对象 { 方法名: 函数 }),不公开的内部方法不可达。
250
+ */
251
+ callHandle(method: string, args: readonly unknown[]): {
252
+ readonly found: true;
253
+ readonly result?: unknown;
254
+ } | {
255
+ readonly found: true;
256
+ readonly missing: true;
257
+ };
229
258
  getScopeRoot(): Record<string, unknown>;
230
259
  setSourceReader(readProps: () => Record<string, unknown>, readRows: () => readonly SomaRowScope[]): void;
231
260
  readProps(): Record<string, unknown>;
@@ -1,3 +1,4 @@
1
+ import type { HideTransition } from '../render-ports/hide-transition';
1
2
  /** 容器适配层协议 — 端口:Web 适配器为缺省实现,其他容器由调用方实现 */
2
3
  export interface SomaAnchorStats {
3
4
  anchors: Set<string>;
@@ -29,6 +30,8 @@ export interface IContainerAdapter {
29
30
  replace?: boolean;
30
31
  }): void;
31
32
  now(): number;
33
+ /** 注入隐藏前过渡钩子(`renderPorts.hideTransition`);传 null 清除。未注入时 setVisibility 立即写 hidden */
34
+ setHideTransition?(hook: HideTransition | null): void;
32
35
  setNavigateHandler?(handler: (url: string, options?: {
33
36
  replace?: boolean;
34
37
  }) => void): void;
@@ -1,7 +1,11 @@
1
1
  import type { IContainerAdapter, SomaAnchorStats } from './IContainerAdapter';
2
+ import type { HideTransition } from '../render-ports/hide-transition';
2
3
  export type { SomaAnchorStats } from './IContainerAdapter';
3
4
  export declare class SomaContainerAdapter implements IContainerAdapter {
4
5
  private navigateHandler;
6
+ private hideTransition;
7
+ /** 正在「隐藏前过渡」的元素 -> 取消控制器(显示时 abort,作废旧 Promise) */
8
+ private readonly pendingHides;
5
9
  /** 注入自定义导航处理器(如 SomaRouter + Next.js 路由) */
6
10
  setNavigateHandler(handler: (url: string, options?: {
7
11
  replace?: boolean;
@@ -22,6 +26,7 @@ export declare class SomaContainerAdapter implements IContainerAdapter {
22
26
  /** 显隐只有 `hidden` 属性这一个机制:不写内联样式、不切类名;元素自带的 display 规则压不过 `[hidden]`,见 host-next/app/globals.css(宿主壳样式) */
23
27
  setVisibility(element: HTMLElement, visible: boolean): void;
24
28
  isVisible(element: HTMLElement): boolean;
29
+ setHideTransition(hook: HideTransition | null): void;
25
30
  toggleClasses(element: HTMLElement, classes: string[], enabled: boolean): void;
26
31
  setValue(element: HTMLElement, value: string): void;
27
32
  getValue(element: HTMLElement): string;