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.
- package/app/SomaPageClient.tsx +28 -9
- package/app/soma/manifest/route.ts +3 -0
- package/bin/migrate.cjs +71 -1
- package/bin/soma-lsp.cjs +8 -1
- package/core/build/blocks/block-compile.ts +23 -5
- package/core/build/compiler/full-manifest-builder.ts +15 -0
- package/core/build/compiler/page-assets.ts +17 -1
- package/core/build/compiler/page-declaration-compiler.ts +67 -11
- package/core/build/compiler/precompiled-manifest-loader.ts +7 -0
- package/core/build/compiler/soma-manifest-webpack-plugin.js +7 -0
- package/core/build/compiler/soma-precompile.js +30 -6
- package/core/build/component/package-loader.ts +35 -4
- package/core/build/component-tree/artifact-codec.ts +192 -0
- package/core/build/component-tree/binding-bridge.ts +272 -0
- package/core/build/component-tree/collection-binding-lowerer.ts +65 -0
- package/core/build/component-tree/definition-preparation.ts +320 -0
- package/core/build/component-tree/migration-files.ts +214 -0
- package/core/build/component-tree/migration.ts +170 -0
- package/core/build/component-tree/parser.ts +362 -0
- package/core/build/component-tree/registry-snapshot.ts +317 -0
- package/core/build/component-tree/source-preflight.ts +132 -0
- package/core/build/component-tree/structure-topology.ts +63 -0
- package/core/build/component-tree/validator.ts +318 -0
- package/core/build/layout/css-emitter.ts +14 -1
- package/core/build/lsp/component-tree-service.ts +79 -0
- package/core/build/lsp/component-tree.cjs +42 -0
- package/core/build/lsp/cross-file-diagnostics.cjs +15 -3
- package/core/build/lsp/extra-completion.cjs +7 -0
- package/core/client/compiler/manifest-compiler.ts +2 -0
- package/core/client/component/ai-catalog.ts +41 -3
- package/core/client/component/catalog-examples.ts +60 -0
- package/core/client/component/component-definition.types.ts +9 -0
- package/core/client/component/component-expander.ts +39 -8
- package/core/client/component/component-manager.ts +107 -16
- package/core/client/component/component-registry.ts +10 -1
- package/core/client/component/scoped-adapter.ts +29 -2
- package/core/client/component/structure-adapter.ts +207 -0
- package/core/client/component/verify-pack.ts +64 -1
- package/core/client/engine/asset-resolver.ts +1 -1
- package/core/client/engine/dom-renderer.ts +283 -0
- package/core/client/engine/event-engine.ts +28 -9
- package/core/client/engine/render-engine.ts +2 -0
- package/core/client/engine/row-range.ts +62 -0
- package/core/client/engine/row-scope.ts +77 -0
- package/core/client/engine/runtime-builder.ts +2 -0
- package/core/client/engine/soma-bootstrap.ts +146 -1
- package/core/client/parser/blocks/page-parser.ts +9 -2
- package/core/client/parser/ui-config-parser.ts +38 -6
- package/core/client/registry/declaration-renderer.ts +32 -24
- package/core/client/registry/remote-page.ts +1 -1
- package/core/client/theme/theme-engine.ts +61 -1
- package/core/client/validation/contract-validator.ts +1 -1
- package/core/index.ts +9 -1
- package/core/server/host/page-markup-config.ts +42 -0
- package/core/server/host/published-page-artifact-cache.ts +36 -4
- package/core/server/host/published-page-assets.ts +13 -7
- package/core/server/host/resolve-host-tree-context.ts +43 -0
- package/core/server/host/server-page-assets.ts +23 -4
- package/core/server/host/soma-page-compile.ts +10 -0
- package/core/server/page-declaration.ts +7 -0
- package/core/server/registry/declaration-precompiler.ts +35 -3
- package/core/server/registry/page-registry-repository.ts +31 -3
- package/core/server/registry/page-registry-store.ts +64 -7
- package/core/server/registry/publish-asset-pin.ts +6 -1
- package/core/server/registry/services/pages/Get.ts +11 -6
- package/core/server/registry/validation/compile-gate.ts +10 -1
- package/core/shared/component-tree-artifact.ts +237 -0
- package/core/shared/component-tree-errors.ts +52 -0
- package/core/shared/types/component-contract.types.ts +51 -0
- package/core/shared/types/component-tree-artifact.types.ts +121 -0
- package/core/shared/types/component-tree.types.ts +170 -0
- package/core/shared/types/engine.types.ts +5 -0
- package/core/shared/types/manifest.types.ts +4 -0
- package/core/shared/types/ui-config.types.ts +8 -0
- package/dist/cli/soma.js +1 -1
- package/dist/core/index.cjs +1976 -692
- package/dist/lsp/component-tree.cjs +20807 -0
- package/dist/types/build/blocks/block-compile.d.ts +10 -1
- package/dist/types/build/compiler/full-manifest-builder.d.ts +9 -0
- package/dist/types/build/compiler/page-assets.d.ts +6 -1
- package/dist/types/build/compiler/page-declaration-compiler.d.ts +11 -1
- package/dist/types/build/component/package-loader.d.ts +4 -1
- package/dist/types/build/component-tree/artifact-codec.d.ts +50 -0
- package/dist/types/build/component-tree/binding-bridge.d.ts +19 -0
- package/dist/types/build/component-tree/collection-binding-lowerer.d.ts +18 -0
- package/dist/types/build/component-tree/definition-preparation.d.ts +11 -0
- package/dist/types/build/component-tree/migration-files.d.ts +35 -0
- package/dist/types/build/component-tree/migration.d.ts +28 -0
- package/dist/types/build/component-tree/parser.d.ts +13 -0
- package/dist/types/build/component-tree/registry-snapshot.d.ts +15 -0
- package/dist/types/build/component-tree/source-preflight.d.ts +22 -0
- package/dist/types/build/component-tree/structure-topology.d.ts +7 -0
- package/dist/types/build/component-tree/validator.d.ts +9 -0
- package/dist/types/build/lsp/component-tree-service.d.ts +34 -0
- package/dist/types/client/component/ai-catalog.d.ts +18 -1
- package/dist/types/client/component/catalog-examples.d.ts +18 -0
- package/dist/types/client/component/component-definition.types.d.ts +9 -0
- package/dist/types/client/component/component-expander.d.ts +3 -1
- package/dist/types/client/component/component-manager.d.ts +11 -0
- package/dist/types/client/component/scoped-adapter.d.ts +1 -0
- package/dist/types/client/component/structure-adapter.d.ts +17 -0
- package/dist/types/client/engine/dom-renderer.d.ts +15 -0
- package/dist/types/client/engine/event-engine.d.ts +1 -0
- package/dist/types/client/engine/render-engine.d.ts +1 -0
- package/dist/types/client/engine/row-range.d.ts +13 -0
- package/dist/types/client/engine/row-scope.d.ts +20 -0
- package/dist/types/client/engine/runtime-builder.d.ts +1 -0
- package/dist/types/client/engine/soma-bootstrap.d.ts +4 -1
- package/dist/types/client/parser/ui-config-parser.d.ts +2 -0
- package/dist/types/client/registry/declaration-renderer.d.ts +5 -1
- package/dist/types/client/registry/remote-page.d.ts +1 -1
- package/dist/types/index.d.ts +3 -2
- package/dist/types/server/host/page-markup-config.d.ts +6 -0
- package/dist/types/server/host/published-page-artifact-cache.d.ts +9 -1
- package/dist/types/server/host/published-page-assets.d.ts +5 -3
- package/dist/types/server/host/resolve-host-tree-context.d.ts +8 -0
- package/dist/types/server/host/server-page-assets.d.ts +6 -0
- package/dist/types/server/host/soma-page-compile.d.ts +10 -1
- package/dist/types/server/page-declaration.d.ts +6 -0
- package/dist/types/server/registry/declaration-precompiler.d.ts +8 -3
- package/dist/types/server/registry/page-registry-repository.d.ts +5 -0
- package/dist/types/server/registry/page-registry-store.d.ts +11 -1
- package/dist/types/server/registry/publish-asset-pin.d.ts +4 -0
- package/dist/types/server/registry/validation/compile-gate.d.ts +4 -1
- package/dist/types/shared/component-tree-artifact.d.ts +5 -0
- package/dist/types/shared/component-tree-errors.d.ts +22 -0
- package/dist/types/shared/types/component-contract.types.d.ts +42 -0
- package/dist/types/shared/types/component-tree-artifact.types.d.ts +104 -0
- package/dist/types/shared/types/component-tree.types.d.ts +149 -0
- package/dist/types/shared/types/engine.types.d.ts +5 -0
- package/dist/types/shared/types/manifest.types.d.ts +4 -0
- package/dist/types/shared/types/ui-config.types.d.ts +8 -0
- package/package.json +3 -1
|
@@ -0,0 +1,149 @@
|
|
|
1
|
+
import type { SomaComponentContract, SomaComponentLayer, SomaContractField } from './component-contract.types';
|
|
2
|
+
import type { SomaStructureAdapterDefinition } from './component-tree-artifact.types';
|
|
3
|
+
export type SomaPageMarkup = 'legacy-html' | 'component-tree';
|
|
4
|
+
export interface SourceSpan {
|
|
5
|
+
sourceId: string;
|
|
6
|
+
/** UTF-16 offsets; end is exclusive. Lines and columns are one-based. */
|
|
7
|
+
start: number;
|
|
8
|
+
end: number;
|
|
9
|
+
startLine: number;
|
|
10
|
+
startColumn: number;
|
|
11
|
+
endLine: number;
|
|
12
|
+
endColumn: number;
|
|
13
|
+
}
|
|
14
|
+
export interface NodeMeta {
|
|
15
|
+
nodeId: string;
|
|
16
|
+
span: SourceSpan;
|
|
17
|
+
nodePath: string;
|
|
18
|
+
}
|
|
19
|
+
export interface HostNode {
|
|
20
|
+
kind: 'host';
|
|
21
|
+
name: string;
|
|
22
|
+
id?: string;
|
|
23
|
+
as: string;
|
|
24
|
+
children: TreeNode[];
|
|
25
|
+
meta: NodeMeta;
|
|
26
|
+
}
|
|
27
|
+
export interface ComponentNode {
|
|
28
|
+
kind: 'component';
|
|
29
|
+
component: string;
|
|
30
|
+
id: string;
|
|
31
|
+
as?: string;
|
|
32
|
+
mount: 'host' | 'fragment';
|
|
33
|
+
slots: SlotNode[];
|
|
34
|
+
meta: NodeMeta;
|
|
35
|
+
}
|
|
36
|
+
export interface SlotNode {
|
|
37
|
+
kind: 'slot';
|
|
38
|
+
name: string;
|
|
39
|
+
children: TreeNode[];
|
|
40
|
+
meta: NodeMeta;
|
|
41
|
+
}
|
|
42
|
+
export interface FragmentNode {
|
|
43
|
+
kind: 'fragment';
|
|
44
|
+
children: TreeNode[];
|
|
45
|
+
meta: NodeMeta;
|
|
46
|
+
}
|
|
47
|
+
export interface RepeatNode {
|
|
48
|
+
kind: 'repeat';
|
|
49
|
+
source: string;
|
|
50
|
+
item: string;
|
|
51
|
+
key: string;
|
|
52
|
+
child: ComponentNode | FragmentNode;
|
|
53
|
+
meta: NodeMeta;
|
|
54
|
+
}
|
|
55
|
+
export type TreeNode = HostNode | ComponentNode | SlotNode | FragmentNode | RepeatNode;
|
|
56
|
+
export interface SomaComponentTree {
|
|
57
|
+
grammarVersion: 1;
|
|
58
|
+
sourceId: string;
|
|
59
|
+
host: HostNode;
|
|
60
|
+
}
|
|
61
|
+
/** Trusted deployment limits, never accepted as attributes in source markup. */
|
|
62
|
+
export interface TreeLimits {
|
|
63
|
+
maxSourceBytes: number;
|
|
64
|
+
maxNodes: number;
|
|
65
|
+
maxDepth: number;
|
|
66
|
+
maxAttributes: number;
|
|
67
|
+
maxRepeatDepth: number;
|
|
68
|
+
maxRowsPerCollection: number;
|
|
69
|
+
maxRowsPerPage: number;
|
|
70
|
+
maxKeyLength: number;
|
|
71
|
+
maxArtifactBytes: number;
|
|
72
|
+
maxDiagnostics: number;
|
|
73
|
+
}
|
|
74
|
+
export declare const DEFAULT_TREE_LIMITS: Readonly<TreeLimits>;
|
|
75
|
+
export interface TreeComponentSnapshot {
|
|
76
|
+
readonly name: string;
|
|
77
|
+
readonly layer: SomaComponentLayer;
|
|
78
|
+
readonly version: string;
|
|
79
|
+
readonly contract: SomaComponentContract;
|
|
80
|
+
readonly packName?: string;
|
|
81
|
+
readonly packVersion?: string;
|
|
82
|
+
readonly structureDigest: string;
|
|
83
|
+
readonly contractDigest?: string;
|
|
84
|
+
readonly internalRootId?: string;
|
|
85
|
+
readonly templateRootTag?: string;
|
|
86
|
+
readonly structureAdapter?: SomaStructureAdapterDefinition;
|
|
87
|
+
}
|
|
88
|
+
export interface TreeRegistrySnapshot {
|
|
89
|
+
readonly components: Readonly<Record<string, TreeComponentSnapshot>>;
|
|
90
|
+
readonly digest: string;
|
|
91
|
+
}
|
|
92
|
+
export interface TreeSlotPolicy {
|
|
93
|
+
readonly component: string;
|
|
94
|
+
readonly slot: string;
|
|
95
|
+
readonly allowedComponents?: readonly string[];
|
|
96
|
+
readonly allowedLayers?: readonly SomaComponentLayer[];
|
|
97
|
+
/** Some Host shell slots distinguish direct shells from business descendants. */
|
|
98
|
+
readonly descendantAllowedComponents?: readonly string[];
|
|
99
|
+
readonly descendantAllowedLayers?: readonly SomaComponentLayer[];
|
|
100
|
+
readonly forbidden?: boolean;
|
|
101
|
+
}
|
|
102
|
+
export interface TreeCompositionPolicy {
|
|
103
|
+
readonly policyId: string;
|
|
104
|
+
readonly version: string;
|
|
105
|
+
readonly roots: readonly string[];
|
|
106
|
+
readonly allowedComponents?: readonly string[];
|
|
107
|
+
readonly allowedLayers?: readonly SomaComponentLayer[];
|
|
108
|
+
/** A matched slot rule remains in force through transparent/nested content. */
|
|
109
|
+
readonly slotRules?: readonly TreeSlotPolicy[];
|
|
110
|
+
}
|
|
111
|
+
export type CollectionStatusPlan = {
|
|
112
|
+
readonly kind: 'sync';
|
|
113
|
+
} | {
|
|
114
|
+
readonly kind: 'async';
|
|
115
|
+
readonly statePath: string;
|
|
116
|
+
};
|
|
117
|
+
export interface TreeCollectionSource {
|
|
118
|
+
readonly path: string;
|
|
119
|
+
/** The collection is always an array; item describes its element schema. */
|
|
120
|
+
readonly item: SomaContractField;
|
|
121
|
+
readonly statusPlan: CollectionStatusPlan;
|
|
122
|
+
}
|
|
123
|
+
export interface TreeCompileContext {
|
|
124
|
+
readonly registrySnapshot: TreeRegistrySnapshot;
|
|
125
|
+
readonly compositionPolicy: TreeCompositionPolicy;
|
|
126
|
+
readonly collectionSources?: readonly TreeCollectionSource[];
|
|
127
|
+
readonly limits?: Partial<TreeLimits>;
|
|
128
|
+
/** Trusted deployment identity; otherwise derived from the actual Registry snapshot. */
|
|
129
|
+
readonly assetSupplyKey?: string;
|
|
130
|
+
}
|
|
131
|
+
/** Preflight output, deliberately not a runtime asset or a compiled tree plan. */
|
|
132
|
+
export interface TreeValidationResult {
|
|
133
|
+
readonly tree: SomaComponentTree;
|
|
134
|
+
readonly componentNames: readonly string[];
|
|
135
|
+
}
|
|
136
|
+
/** Build diagnostics only; never included in runtimeAssets or content-addressed payloads. */
|
|
137
|
+
export interface ComponentTreeTrace {
|
|
138
|
+
sources: readonly {
|
|
139
|
+
nodeId: string;
|
|
140
|
+
nodePath: string;
|
|
141
|
+
span: SourceSpan;
|
|
142
|
+
symbol?: string;
|
|
143
|
+
}[];
|
|
144
|
+
edges: readonly {
|
|
145
|
+
fromId: string;
|
|
146
|
+
relation: 'derives' | 'normalizes' | 'binds' | 'projects' | 'scopes' | 'consumes' | 'invalidates' | 'verifies';
|
|
147
|
+
toId: string;
|
|
148
|
+
}[];
|
|
149
|
+
}
|
|
@@ -15,6 +15,11 @@ export interface BindingEntry {
|
|
|
15
15
|
pipes?: import('./scope-manifest.types').SomaPipeCall[];
|
|
16
16
|
/** 异构列表模板选择器(行相对路径) */
|
|
17
17
|
roleBy?: string;
|
|
18
|
+
keyPath?: string;
|
|
19
|
+
itemAlias?: string;
|
|
20
|
+
repeatPlanId?: string;
|
|
21
|
+
repeatPlan?: import('./component-tree-artifact.types').RepeatPlan;
|
|
22
|
+
collectionOwner?: HTMLElement;
|
|
18
23
|
/** 变体模板表:'item' 默认 + 'item:变体'(异构列表用;同构列表仅 templateCache) */
|
|
19
24
|
templatesByRole?: Record<string, DocumentFragment>;
|
|
20
25
|
/** 预编译的属性访问器:消除 path.split + 循环 */
|
|
@@ -20,6 +20,10 @@ export interface SomaCompiledBinding {
|
|
|
20
20
|
pipes?: SomaPipeCall[];
|
|
21
21
|
/** 异构列表模板选择器(行相对路径,list 绑定专用) */
|
|
22
22
|
roleBy?: string;
|
|
23
|
+
/** Explicit stable identity and lexical alias (absent on legacy lists). */
|
|
24
|
+
keyPath?: string;
|
|
25
|
+
itemAlias?: string;
|
|
26
|
+
repeatPlanId?: string;
|
|
23
27
|
}
|
|
24
28
|
export interface SomaCompiledEvent extends ParsedEvent {
|
|
25
29
|
/**
|
|
@@ -18,6 +18,12 @@ export interface BindDeclaration {
|
|
|
18
18
|
* 取值匹配 <template data-soma-role="item:取值">,无匹配回落 item 默认模板。
|
|
19
19
|
*/
|
|
20
20
|
role_by?: string;
|
|
21
|
+
/** Explicit stable row identity. Must start with this binding's var. */
|
|
22
|
+
key?: string;
|
|
23
|
+
/** Prepared collection plan reference; never combined with source key/slot. */
|
|
24
|
+
repeatPlanId?: string;
|
|
25
|
+
/** Trusted component-definition source only; lowered before browser delivery. */
|
|
26
|
+
collectionSlot?: string;
|
|
21
27
|
}
|
|
22
28
|
/**
|
|
23
29
|
* 展示映射值 - 支持多种绑定类型
|
|
@@ -33,6 +39,8 @@ export type ShowValue = string | NestedShowMapping | ExtendedShowValue;
|
|
|
33
39
|
* 用于对象或列表级别的子作用域绑定
|
|
34
40
|
*/
|
|
35
41
|
export interface NestedShowMapping {
|
|
42
|
+
/** The collection consumer's own props, not its row component props. */
|
|
43
|
+
props?: Record<string, unknown>;
|
|
36
44
|
/** 子作用域声明 */
|
|
37
45
|
bind: BindDeclaration;
|
|
38
46
|
/** 子级展示映射 */
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "soma-core",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.6.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",
|
|
@@ -55,6 +55,7 @@
|
|
|
55
55
|
"./adaptive-vocabulary": "./core/shared/types/adaptive.types.ts",
|
|
56
56
|
"./responsive-vocabulary": "./core/shared/container-breakpoints.ts",
|
|
57
57
|
"./compiler/vite": "./core/build/compiler/vite-plugin-soma.ts",
|
|
58
|
+
"./compiler/rollup": "./core/build/compiler/rollup-plugin-soma.ts",
|
|
58
59
|
"./compiler/precompile": "./core/build/compiler/soma-precompile.ts",
|
|
59
60
|
"./compiler/webpack-loader": "./core/build/compiler/soma-webpack-loader.js",
|
|
60
61
|
"./diagnostics": {
|
|
@@ -166,6 +167,7 @@
|
|
|
166
167
|
"jiti": "^1.21.7",
|
|
167
168
|
"js-yaml": "^4.3.2",
|
|
168
169
|
"msw": "2.15.0",
|
|
170
|
+
"parse5": "7.3.0",
|
|
169
171
|
"reflect-metadata": "^0.2.1",
|
|
170
172
|
"server-only": "^0.0.1"
|
|
171
173
|
},
|