soma-core 1.5.0 → 1.6.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 (133) hide show
  1. package/app/SomaPageClient.tsx +28 -9
  2. package/app/soma/manifest/route.ts +3 -0
  3. package/bin/migrate.cjs +71 -1
  4. package/bin/soma-lsp.cjs +8 -1
  5. package/core/build/blocks/block-compile.ts +23 -5
  6. package/core/build/compiler/full-manifest-builder.ts +15 -0
  7. package/core/build/compiler/page-assets.ts +17 -1
  8. package/core/build/compiler/page-declaration-compiler.ts +67 -11
  9. package/core/build/compiler/precompiled-manifest-loader.ts +7 -0
  10. package/core/build/compiler/soma-manifest-webpack-plugin.js +7 -0
  11. package/core/build/compiler/soma-precompile.js +30 -6
  12. package/core/build/component/package-loader.ts +35 -4
  13. package/core/build/component-tree/artifact-codec.ts +192 -0
  14. package/core/build/component-tree/binding-bridge.ts +272 -0
  15. package/core/build/component-tree/collection-binding-lowerer.ts +65 -0
  16. package/core/build/component-tree/definition-preparation.ts +320 -0
  17. package/core/build/component-tree/migration-files.ts +214 -0
  18. package/core/build/component-tree/migration.ts +170 -0
  19. package/core/build/component-tree/parser.ts +362 -0
  20. package/core/build/component-tree/registry-snapshot.ts +317 -0
  21. package/core/build/component-tree/source-preflight.ts +132 -0
  22. package/core/build/component-tree/structure-topology.ts +63 -0
  23. package/core/build/component-tree/validator.ts +318 -0
  24. package/core/build/layout/css-emitter.ts +14 -1
  25. package/core/build/lsp/component-tree-service.ts +79 -0
  26. package/core/build/lsp/component-tree.cjs +42 -0
  27. package/core/build/lsp/cross-file-diagnostics.cjs +15 -3
  28. package/core/build/lsp/extra-completion.cjs +7 -0
  29. package/core/client/compiler/manifest-compiler.ts +2 -0
  30. package/core/client/component/ai-catalog.ts +41 -3
  31. package/core/client/component/catalog-examples.ts +60 -0
  32. package/core/client/component/component-definition.types.ts +9 -0
  33. package/core/client/component/component-expander.ts +39 -8
  34. package/core/client/component/component-manager.ts +107 -16
  35. package/core/client/component/component-registry.ts +10 -1
  36. package/core/client/component/scoped-adapter.ts +29 -2
  37. package/core/client/component/structure-adapter.ts +207 -0
  38. package/core/client/component/verify-pack.ts +64 -1
  39. package/core/client/engine/asset-resolver.ts +1 -1
  40. package/core/client/engine/dom-renderer.ts +283 -0
  41. package/core/client/engine/event-engine.ts +28 -9
  42. package/core/client/engine/render-engine.ts +2 -0
  43. package/core/client/engine/row-range.ts +62 -0
  44. package/core/client/engine/row-scope.ts +77 -0
  45. package/core/client/engine/runtime-builder.ts +2 -0
  46. package/core/client/engine/soma-bootstrap.ts +146 -1
  47. package/core/client/parser/blocks/page-parser.ts +9 -2
  48. package/core/client/parser/ui-config-parser.ts +38 -6
  49. package/core/client/registry/declaration-renderer.ts +32 -24
  50. package/core/client/registry/remote-page.ts +1 -1
  51. package/core/client/theme/theme-engine.ts +61 -1
  52. package/core/client/validation/contract-validator.ts +1 -1
  53. package/core/index.ts +9 -1
  54. package/core/server/host/page-markup-config.ts +42 -0
  55. package/core/server/host/published-page-artifact-cache.ts +36 -4
  56. package/core/server/host/published-page-assets.ts +13 -7
  57. package/core/server/host/resolve-host-tree-context.ts +43 -0
  58. package/core/server/host/server-page-assets.ts +23 -4
  59. package/core/server/host/soma-page-compile.ts +10 -0
  60. package/core/server/page-declaration.ts +7 -0
  61. package/core/server/registry/declaration-precompiler.ts +35 -3
  62. package/core/server/registry/page-registry-repository.ts +31 -3
  63. package/core/server/registry/page-registry-store.ts +64 -7
  64. package/core/server/registry/publish-asset-pin.ts +6 -1
  65. package/core/server/registry/services/pages/Get.ts +11 -6
  66. package/core/server/registry/validation/compile-gate.ts +10 -1
  67. package/core/shared/component-tree-artifact.ts +237 -0
  68. package/core/shared/component-tree-errors.ts +52 -0
  69. package/core/shared/types/component-contract.types.ts +51 -0
  70. package/core/shared/types/component-tree-artifact.types.ts +121 -0
  71. package/core/shared/types/component-tree.types.ts +170 -0
  72. package/core/shared/types/engine.types.ts +5 -0
  73. package/core/shared/types/manifest.types.ts +4 -0
  74. package/core/shared/types/ui-config.types.ts +8 -0
  75. package/dist/cli/soma.js +1 -1
  76. package/dist/core/index.cjs +1976 -692
  77. package/dist/lsp/component-tree.cjs +20807 -0
  78. package/dist/types/build/blocks/block-compile.d.ts +10 -1
  79. package/dist/types/build/compiler/full-manifest-builder.d.ts +9 -0
  80. package/dist/types/build/compiler/page-assets.d.ts +6 -1
  81. package/dist/types/build/compiler/page-declaration-compiler.d.ts +11 -1
  82. package/dist/types/build/component/package-loader.d.ts +4 -1
  83. package/dist/types/build/component-tree/artifact-codec.d.ts +50 -0
  84. package/dist/types/build/component-tree/binding-bridge.d.ts +19 -0
  85. package/dist/types/build/component-tree/collection-binding-lowerer.d.ts +18 -0
  86. package/dist/types/build/component-tree/definition-preparation.d.ts +11 -0
  87. package/dist/types/build/component-tree/migration-files.d.ts +35 -0
  88. package/dist/types/build/component-tree/migration.d.ts +28 -0
  89. package/dist/types/build/component-tree/parser.d.ts +13 -0
  90. package/dist/types/build/component-tree/registry-snapshot.d.ts +15 -0
  91. package/dist/types/build/component-tree/source-preflight.d.ts +22 -0
  92. package/dist/types/build/component-tree/structure-topology.d.ts +7 -0
  93. package/dist/types/build/component-tree/validator.d.ts +9 -0
  94. package/dist/types/build/lsp/component-tree-service.d.ts +34 -0
  95. package/dist/types/client/component/ai-catalog.d.ts +18 -1
  96. package/dist/types/client/component/catalog-examples.d.ts +18 -0
  97. package/dist/types/client/component/component-definition.types.d.ts +9 -0
  98. package/dist/types/client/component/component-expander.d.ts +3 -1
  99. package/dist/types/client/component/component-manager.d.ts +11 -0
  100. package/dist/types/client/component/scoped-adapter.d.ts +1 -0
  101. package/dist/types/client/component/structure-adapter.d.ts +17 -0
  102. package/dist/types/client/engine/dom-renderer.d.ts +15 -0
  103. package/dist/types/client/engine/event-engine.d.ts +1 -0
  104. package/dist/types/client/engine/render-engine.d.ts +1 -0
  105. package/dist/types/client/engine/row-range.d.ts +13 -0
  106. package/dist/types/client/engine/row-scope.d.ts +20 -0
  107. package/dist/types/client/engine/runtime-builder.d.ts +1 -0
  108. package/dist/types/client/engine/soma-bootstrap.d.ts +4 -1
  109. package/dist/types/client/parser/ui-config-parser.d.ts +2 -0
  110. package/dist/types/client/registry/declaration-renderer.d.ts +5 -1
  111. package/dist/types/client/registry/remote-page.d.ts +1 -1
  112. package/dist/types/index.d.ts +3 -2
  113. package/dist/types/server/host/page-markup-config.d.ts +6 -0
  114. package/dist/types/server/host/published-page-artifact-cache.d.ts +9 -1
  115. package/dist/types/server/host/published-page-assets.d.ts +5 -3
  116. package/dist/types/server/host/resolve-host-tree-context.d.ts +8 -0
  117. package/dist/types/server/host/server-page-assets.d.ts +6 -0
  118. package/dist/types/server/host/soma-page-compile.d.ts +10 -1
  119. package/dist/types/server/page-declaration.d.ts +6 -0
  120. package/dist/types/server/registry/declaration-precompiler.d.ts +8 -3
  121. package/dist/types/server/registry/page-registry-repository.d.ts +5 -0
  122. package/dist/types/server/registry/page-registry-store.d.ts +11 -1
  123. package/dist/types/server/registry/publish-asset-pin.d.ts +4 -0
  124. package/dist/types/server/registry/validation/compile-gate.d.ts +4 -1
  125. package/dist/types/shared/component-tree-artifact.d.ts +5 -0
  126. package/dist/types/shared/component-tree-errors.d.ts +22 -0
  127. package/dist/types/shared/types/component-contract.types.d.ts +42 -0
  128. package/dist/types/shared/types/component-tree-artifact.types.d.ts +104 -0
  129. package/dist/types/shared/types/component-tree.types.d.ts +149 -0
  130. package/dist/types/shared/types/engine.types.d.ts +5 -0
  131. package/dist/types/shared/types/manifest.types.d.ts +4 -0
  132. package/dist/types/shared/types/ui-config.types.d.ts +8 -0
  133. package/package.json +3 -1
@@ -98,6 +98,39 @@ export interface SomaContractSlot {
98
98
  required?: boolean;
99
99
  }
100
100
 
101
+ /** Core 拥有的非交互结构语义词汇;组件只能收窄,不能传入任意标签。 */
102
+ export type SomaStructureSemanticToken =
103
+ | 'root' | 'main' | 'section' | 'article' | 'div' | 'flow'
104
+ | 'aside' | 'header' | 'footer' | 'nav'
105
+ | 'navigation' | 'complementary' | 'contentinfo' | 'region' | 'none'
106
+ | 'unordered' | 'ordered';
107
+
108
+ export interface SomaStructureSemantics {
109
+ target: 'host';
110
+ default: SomaStructureSemanticToken;
111
+ allowed: SomaStructureSemanticToken[];
112
+ /** 仅支持 Core 已定义的 as/landmark/ordered 封闭转换,不接受脚本。 */
113
+ staticProp?: string;
114
+ }
115
+
116
+ export interface SomaStructureSlot {
117
+ kind: 'projection' | 'collection';
118
+ /** 受信组件实现键,不是页面提供的 CSS selector。 */
119
+ layoutRoot?: string;
120
+ directChildren: boolean;
121
+ /** 仅集合槽可声明,集合槽必须明确是否需要语义行容器。 */
122
+ rowContainer?: 'none' | 'list-item';
123
+ }
124
+
125
+ /** 可选的新树结构契约;缺省保持旧组件行为,不自动推断结构能力。 */
126
+ export interface SomaContractStructure {
127
+ kind: 'element' | 'fragment-macro';
128
+ rootless: boolean;
129
+ tree_mount: 'legacy-host' | 'controlled-host' | 'single-host' | 'erase';
130
+ semantics?: SomaStructureSemantics;
131
+ slots?: Record<string, SomaStructureSlot>;
132
+ }
133
+
101
134
  /**
102
135
  * 组件级令牌(三级令牌的第三级,REQ-009 M-1)。
103
136
  *
@@ -119,11 +152,27 @@ export interface SomaContractToken {
119
152
  * AI 目录段(契约规范第 11 章):AI 生成页面前查表选组件的依据。
120
153
  * when_to_use / example 为目录质量线;when_not_to_use 用于同族组件消歧。
121
154
  */
155
+ export type SomaContractExample = {
156
+ format: 'legacy-html';
157
+ grammarVersion?: never;
158
+ html: string;
159
+ canonicalUi: string;
160
+ capabilities?: readonly string[];
161
+ } | {
162
+ format: 'component-tree';
163
+ grammarVersion: 1;
164
+ html: string;
165
+ canonicalUi: string;
166
+ capabilities?: readonly string[];
167
+ };
168
+
122
169
  export interface SomaContractAiSection {
123
170
  when_to_use: string;
124
171
  when_not_to_use?: string;
125
172
  /** 三行真实用法:html / ui / event 各一行 */
126
173
  example: string;
174
+ /** Full examples are format- and capability-negotiated; legacy example remains compatible. */
175
+ examples?: readonly SomaContractExample[];
127
176
  anti_patterns?: string[];
128
177
  }
129
178
 
@@ -139,6 +188,8 @@ export interface SomaComponentContract {
139
188
  props?: Record<string, SomaContractProp>;
140
189
  emits?: Record<string, SomaContractEmit>;
141
190
  slots?: Record<string, SomaContractSlot>;
191
+ /** REQ-016:构建期验证的宿主、语义、投影/集合结构能力。 */
192
+ structure?: SomaContractStructure;
142
193
  /**
143
194
  * 组件级令牌:key 为 kebab-case,装配期写出 `--soma-<组件名 kebab>-<key>`。
144
195
  * 主题输入的 `components.<组件名>.<key>` 覆盖它,`ThemeScope` 可按子树覆盖。
@@ -0,0 +1,121 @@
1
+ // REQ-016 shared wire protocol. No DOM, Node, component factories or compiler imports.
2
+ import type { SomaStructureSemanticToken } from './component-contract.types';
3
+ import type { CollectionStatusPlan, SomaPageMarkup } from './component-tree.types';
4
+
5
+ export const COMPONENT_TREE_CAPABILITIES = [
6
+ 'component-tree:1', 'structure-host:1', 'fragment-erasure:1',
7
+ 'repeat-range:1', 'row-bindings:1', 'definition-repeat:1',
8
+ ] as const;
9
+
10
+ export type ComponentTreeCapability = typeof COMPONENT_TREE_CAPABILITIES[number];
11
+
12
+ /** Trusted component implementation keys; never page-provided selectors. */
13
+ export interface SomaStructureAdapterDefinition {
14
+ rootAnchor?: string;
15
+ layoutRoots: Record<string, string>;
16
+ }
17
+
18
+ export interface SlotPlan {
19
+ name: string;
20
+ kind: 'projection' | 'collection';
21
+ ownerSymbol: string;
22
+ layoutRootKey?: string;
23
+ directChildren: boolean;
24
+ rowContainer?: 'none' | 'list-item';
25
+ }
26
+
27
+ export interface StructurePlan {
28
+ /** The emitted template symbol, shared by HTML anchors and compiled bindings. */
29
+ instanceSymbol: string;
30
+ componentName: string;
31
+ mountMode: 'legacy-host' | 'controlled-host' | 'single-host';
32
+ semanticToken?: SomaStructureSemanticToken;
33
+ hostTag: string;
34
+ slotPlans: SlotPlan[];
35
+ internalRootId?: string;
36
+ structureDigest: string;
37
+ /** Compiled static semantic props; runtime defaults/updates may not change them. */
38
+ staticProps?: Record<string, string | boolean>;
39
+ }
40
+
41
+ export interface CollectionDeclarationScope {
42
+ kind: 'page' | 'component';
43
+ ownerSymbol: string;
44
+ parentScopeId?: string;
45
+ /** Domain name for pages, __component for trusted component definitions. */
46
+ readerRoot: string;
47
+ emitOwnerSymbol: string;
48
+ }
49
+
50
+ export interface CollectionConsumerOwner {
51
+ instanceSymbol: string;
52
+ componentName: string;
53
+ slotName: string;
54
+ layoutRootKey: string;
55
+ rowContainer: 'none' | 'list-item';
56
+ }
57
+
58
+ export interface RepeatPlan {
59
+ planId: string;
60
+ scopeId: string;
61
+ parentPlanId?: string;
62
+ declarationScope: CollectionDeclarationScope;
63
+ consumerOwner: CollectionConsumerOwner;
64
+ sourcePath: string;
65
+ statusPlan: CollectionStatusPlan;
66
+ itemAlias: string;
67
+ /** Full current-item path (for example row.id), not a second author input. */
68
+ keyPath: string;
69
+ rowTemplateId: string;
70
+ /** Local source id -> emitted unique template symbol. */
71
+ localSymbols: Record<string, string>;
72
+ limits: {
73
+ maxRows: number;
74
+ maxPageRows: number;
75
+ maxKeyLength: number;
76
+ maxDepth: number;
77
+ };
78
+ }
79
+
80
+ export interface DefinitionRepeatPlan extends RepeatPlan {
81
+ definitionName: string;
82
+ definitionPlanId: string;
83
+ }
84
+
85
+ export interface DefinitionPreparation {
86
+ schemaVersion: 1;
87
+ requiredCapabilities: ComponentTreeCapability[];
88
+ dependencyDigests: Record<string, string>;
89
+ definitionDigest: string;
90
+ }
91
+
92
+ export interface ComponentRef {
93
+ name: string;
94
+ packName?: string;
95
+ packVersion?: string;
96
+ contractDigest: string;
97
+ structureDigest: string;
98
+ uses: string[];
99
+ }
100
+
101
+ export interface TreeArtifact {
102
+ schemaVersion: 1;
103
+ grammarVersion: 1;
104
+ compilerVersion: string;
105
+ sourceDigest: string;
106
+ registrySnapshotDigest: string;
107
+ policyDigest: string;
108
+ assetSupplyKey: string;
109
+ capabilities: ComponentTreeCapability[];
110
+ componentRefs: ComponentRef[];
111
+ structurePlan: StructurePlan[];
112
+ repeatPlans: RepeatPlan[];
113
+ artifactDigest: string;
114
+ }
115
+
116
+ /** Compatible legacy inputs may omit the mode; newly compiled outputs always carry it. */
117
+ export interface ComponentTreeRuntimeEnvelope {
118
+ sourceMarkup?: SomaPageMarkup;
119
+ html?: string;
120
+ artifact?: TreeArtifact;
121
+ }
@@ -0,0 +1,170 @@
1
+ // REQ-016: pure source protocol. No DOM, Node, component factories or build imports.
2
+ import type { SomaComponentContract, SomaComponentLayer, SomaContractField } from './component-contract.types';
3
+ import type { SomaStructureAdapterDefinition } from './component-tree-artifact.types';
4
+
5
+ export type SomaPageMarkup = 'legacy-html' | 'component-tree';
6
+
7
+ export interface SourceSpan {
8
+ sourceId: string;
9
+ /** UTF-16 offsets; end is exclusive. Lines and columns are one-based. */
10
+ start: number;
11
+ end: number;
12
+ startLine: number;
13
+ startColumn: number;
14
+ endLine: number;
15
+ endColumn: number;
16
+ }
17
+
18
+ export interface NodeMeta {
19
+ nodeId: string;
20
+ span: SourceSpan;
21
+ nodePath: string;
22
+ }
23
+
24
+ export interface HostNode {
25
+ kind: 'host';
26
+ name: string;
27
+ id?: string;
28
+ as: string;
29
+ children: TreeNode[];
30
+ meta: NodeMeta;
31
+ }
32
+
33
+ export interface ComponentNode {
34
+ kind: 'component';
35
+ component: string;
36
+ id: string;
37
+ as?: string;
38
+ mount: 'host' | 'fragment';
39
+ slots: SlotNode[];
40
+ meta: NodeMeta;
41
+ }
42
+
43
+ export interface SlotNode {
44
+ kind: 'slot';
45
+ name: string;
46
+ children: TreeNode[];
47
+ meta: NodeMeta;
48
+ }
49
+
50
+ export interface FragmentNode {
51
+ kind: 'fragment';
52
+ children: TreeNode[];
53
+ meta: NodeMeta;
54
+ }
55
+
56
+ export interface RepeatNode {
57
+ kind: 'repeat';
58
+ source: string;
59
+ item: string;
60
+ key: string;
61
+ child: ComponentNode | FragmentNode;
62
+ meta: NodeMeta;
63
+ }
64
+
65
+ export type TreeNode = HostNode | ComponentNode | SlotNode | FragmentNode | RepeatNode;
66
+
67
+ export interface SomaComponentTree {
68
+ grammarVersion: 1;
69
+ sourceId: string;
70
+ host: HostNode;
71
+ }
72
+
73
+ /** Trusted deployment limits, never accepted as attributes in source markup. */
74
+ export interface TreeLimits {
75
+ maxSourceBytes: number;
76
+ maxNodes: number;
77
+ maxDepth: number;
78
+ maxAttributes: number;
79
+ maxRepeatDepth: number;
80
+ maxRowsPerCollection: number;
81
+ maxRowsPerPage: number;
82
+ maxKeyLength: number;
83
+ maxArtifactBytes: number;
84
+ maxDiagnostics: number;
85
+ }
86
+
87
+ export const DEFAULT_TREE_LIMITS: Readonly<TreeLimits> = Object.freeze({
88
+ maxSourceBytes: 128 * 1024,
89
+ maxNodes: 4096,
90
+ maxDepth: 64,
91
+ maxAttributes: 5,
92
+ maxRepeatDepth: 4,
93
+ maxRowsPerCollection: 1000,
94
+ maxRowsPerPage: 5000,
95
+ maxKeyLength: 256,
96
+ maxArtifactBytes: 2 * 1024 * 1024,
97
+ maxDiagnostics: 50,
98
+ });
99
+
100
+ export interface TreeComponentSnapshot {
101
+ readonly name: string;
102
+ readonly layer: SomaComponentLayer;
103
+ readonly version: string;
104
+ readonly contract: SomaComponentContract;
105
+ readonly packName?: string;
106
+ readonly packVersion?: string;
107
+ readonly structureDigest: string;
108
+ readonly contractDigest?: string;
109
+ readonly internalRootId?: string;
110
+ readonly templateRootTag?: string;
111
+ readonly structureAdapter?: SomaStructureAdapterDefinition;
112
+ }
113
+
114
+ export interface TreeRegistrySnapshot {
115
+ readonly components: Readonly<Record<string, TreeComponentSnapshot>>;
116
+ readonly digest: string;
117
+ }
118
+
119
+ export interface TreeSlotPolicy {
120
+ readonly component: string;
121
+ readonly slot: string;
122
+ readonly allowedComponents?: readonly string[];
123
+ readonly allowedLayers?: readonly SomaComponentLayer[];
124
+ /** Some Host shell slots distinguish direct shells from business descendants. */
125
+ readonly descendantAllowedComponents?: readonly string[];
126
+ readonly descendantAllowedLayers?: readonly SomaComponentLayer[];
127
+ readonly forbidden?: boolean;
128
+ }
129
+
130
+ export interface TreeCompositionPolicy {
131
+ readonly policyId: string;
132
+ readonly version: string;
133
+ readonly roots: readonly string[];
134
+ readonly allowedComponents?: readonly string[];
135
+ readonly allowedLayers?: readonly SomaComponentLayer[];
136
+ /** A matched slot rule remains in force through transparent/nested content. */
137
+ readonly slotRules?: readonly TreeSlotPolicy[];
138
+ }
139
+
140
+ export type CollectionStatusPlan =
141
+ | { readonly kind: 'sync' }
142
+ | { readonly kind: 'async'; readonly statePath: string };
143
+
144
+ export interface TreeCollectionSource {
145
+ readonly path: string;
146
+ /** The collection is always an array; item describes its element schema. */
147
+ readonly item: SomaContractField;
148
+ readonly statusPlan: CollectionStatusPlan;
149
+ }
150
+
151
+ export interface TreeCompileContext {
152
+ readonly registrySnapshot: TreeRegistrySnapshot;
153
+ readonly compositionPolicy: TreeCompositionPolicy;
154
+ readonly collectionSources?: readonly TreeCollectionSource[];
155
+ readonly limits?: Partial<TreeLimits>;
156
+ /** Trusted deployment identity; otherwise derived from the actual Registry snapshot. */
157
+ readonly assetSupplyKey?: string;
158
+ }
159
+
160
+ /** Preflight output, deliberately not a runtime asset or a compiled tree plan. */
161
+ export interface TreeValidationResult {
162
+ readonly tree: SomaComponentTree;
163
+ readonly componentNames: readonly string[];
164
+ }
165
+
166
+ /** Build diagnostics only; never included in runtimeAssets or content-addressed payloads. */
167
+ export interface ComponentTreeTrace {
168
+ sources: readonly { nodeId: string; nodePath: string; span: SourceSpan; symbol?: string }[];
169
+ edges: readonly { fromId: string; relation: 'derives' | 'normalizes' | 'binds' | 'projects' | 'scopes' | 'consumes' | 'invalidates' | 'verifies'; toId: string }[];
170
+ }
@@ -25,6 +25,11 @@ export interface BindingEntry {
25
25
  pipes?: import('./scope-manifest.types').SomaPipeCall[];
26
26
  /** 异构列表模板选择器(行相对路径) */
27
27
  roleBy?: string;
28
+ keyPath?: string;
29
+ itemAlias?: string;
30
+ repeatPlanId?: string;
31
+ repeatPlan?: import('./component-tree-artifact.types').RepeatPlan;
32
+ collectionOwner?: HTMLElement;
28
33
  /** 变体模板表:'item' 默认 + 'item:变体'(异构列表用;同构列表仅 templateCache) */
29
34
  templatesByRole?: Record<string, DocumentFragment>;
30
35
 
@@ -21,6 +21,10 @@ export interface SomaCompiledBinding {
21
21
  pipes?: SomaPipeCall[];
22
22
  /** 异构列表模板选择器(行相对路径,list 绑定专用) */
23
23
  roleBy?: string;
24
+ /** Explicit stable identity and lexical alias (absent on legacy lists). */
25
+ keyPath?: string;
26
+ itemAlias?: string;
27
+ repeatPlanId?: string;
24
28
  }
25
29
 
26
30
  export interface SomaCompiledEvent extends ParsedEvent {
@@ -22,6 +22,12 @@ export interface BindDeclaration {
22
22
  * 取值匹配 <template data-soma-role="item:取值">,无匹配回落 item 默认模板。
23
23
  */
24
24
  role_by?: string;
25
+ /** Explicit stable row identity. Must start with this binding's var. */
26
+ key?: string;
27
+ /** Prepared collection plan reference; never combined with source key/slot. */
28
+ repeatPlanId?: string;
29
+ /** Trusted component-definition source only; lowered before browser delivery. */
30
+ collectionSlot?: string;
25
31
  }
26
32
 
27
33
  /**
@@ -42,6 +48,8 @@ export type ShowValue =
42
48
  * 用于对象或列表级别的子作用域绑定
43
49
  */
44
50
  export interface NestedShowMapping {
51
+ /** The collection consumer's own props, not its row component props. */
52
+ props?: Record<string, unknown>;
45
53
  /** 子作用域声明 */
46
54
  bind: BindDeclaration;
47
55
  /** 子级展示映射 */
package/dist/cli/soma.js CHANGED
@@ -25,7 +25,7 @@ if (command === 'db') {
25
25
  const child = (0, node_child_process_1.spawnSync)(process.execPath, [node_path_1.default.join(packageRoot, 'bin', 'soma-db.cjs'), ...args.slice(1)], { cwd: process.cwd(), stdio: 'inherit', env: process.env });
26
26
  process.exit(child.status === null ? 1 : child.status);
27
27
  }
28
- // `soma migrate`(平铺 → 块声明)。与 db 同一分派方式:自有 bin、独立进程、只读写页面声明。
28
+ // `soma migrate`(平铺 → 块声明 / component-tree 检查与显式迁移)。两种子命令共用同一安全写入口。
29
29
  // 曾经只有 soma-inline.cjs 路由它——而发布入口走的是本文件编译出的 dist/cli/soma.js,
30
30
  // 装出去的包里 `soma migrate` 直接落进 Usage,手册里写着的命令用户一条都跑不起来。
31
31
  if (command === 'migrate') {