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,13 @@
|
|
|
1
|
+
import type { SomaRowScope } from './row-scope';
|
|
2
|
+
/** One keyed row is a complete DOM range, not an assumed first element. */
|
|
3
|
+
export declare class SomaRowRange {
|
|
4
|
+
readonly scope: SomaRowScope;
|
|
5
|
+
readonly variant: string;
|
|
6
|
+
readonly start: Comment;
|
|
7
|
+
readonly end: Comment;
|
|
8
|
+
readonly roots: readonly HTMLElement[];
|
|
9
|
+
private released;
|
|
10
|
+
constructor(fragment: DocumentFragment, scope: SomaRowScope, variant?: string);
|
|
11
|
+
moveBefore(parent: Node, before: Node | null): void;
|
|
12
|
+
release(releaseRoot: (root: HTMLElement) => void): void;
|
|
13
|
+
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
export type SomaTypedRowKey = string | number;
|
|
2
|
+
/** Lexical row identity is in memory only: no raw business keys in DOM attributes. */
|
|
3
|
+
export declare class SomaRowScope {
|
|
4
|
+
readonly alias: string;
|
|
5
|
+
readonly key: SomaTypedRowKey;
|
|
6
|
+
data: unknown;
|
|
7
|
+
readonly parent?: SomaRowScope | undefined;
|
|
8
|
+
active: boolean;
|
|
9
|
+
generation: number;
|
|
10
|
+
constructor(alias: string, key: SomaTypedRowKey, data: unknown, parent?: SomaRowScope | undefined);
|
|
11
|
+
has(alias: string): boolean;
|
|
12
|
+
read(path: string, fallback: (path: string) => unknown): unknown;
|
|
13
|
+
update(data: unknown): void;
|
|
14
|
+
dispose(): void;
|
|
15
|
+
}
|
|
16
|
+
export declare function readRowPath(value: unknown, parts: readonly string[]): unknown;
|
|
17
|
+
export declare function validateRowKeys(rows: unknown, keyPath: string, alias: string, limits?: {
|
|
18
|
+
maxRows?: number;
|
|
19
|
+
maxKeyLength?: number;
|
|
20
|
+
}): SomaTypedRowKey[];
|
|
@@ -19,6 +19,7 @@ import { SomaStyleBinder } from './style-binder';
|
|
|
19
19
|
import { SomaTriggerEngine } from './trigger-engine';
|
|
20
20
|
import { SomaTimerEngine } from './timer-engine';
|
|
21
21
|
export interface RuntimeBuildInput {
|
|
22
|
+
repeatPlans?: readonly import('../../shared/types/component-tree-artifact.types').RepeatPlan[];
|
|
22
23
|
container: HTMLElement;
|
|
23
24
|
adapter: IContainerAdapter;
|
|
24
25
|
uiConfig: UiConfig;
|
|
@@ -20,7 +20,8 @@ import type { SomaComponentDefinition } from '../component/component-definition.
|
|
|
20
20
|
import { type SomaComponentDefaults } from '../component/component-defaults';
|
|
21
21
|
import { type SomaPipeFn } from '../pipes/pipe-registry';
|
|
22
22
|
import { type SomaErrorEvent, type SomaPageIdentity } from '../observability/error-reporter';
|
|
23
|
-
|
|
23
|
+
import type { ComponentTreeRuntimeEnvelope } from '../../shared/types/component-tree-artifact.types';
|
|
24
|
+
export interface SomaPageAssets extends ComponentTreeRuntimeEnvelope {
|
|
24
25
|
html: string;
|
|
25
26
|
includes?: Record<string, string>;
|
|
26
27
|
DomainClass: new () => SomaPageRoot;
|
|
@@ -56,6 +57,8 @@ export interface SomaPageAssets {
|
|
|
56
57
|
*/
|
|
57
58
|
components?: Record<string, SomaComponentDefinition>;
|
|
58
59
|
}
|
|
60
|
+
/** Validate before mutating the current DOM or instantiating any business Domain. */
|
|
61
|
+
export declare function assertPageRuntimeAssets(assets: SomaPageAssets, hostComponents: Record<string, SomaComponentDefinition>): void;
|
|
59
62
|
/**
|
|
60
63
|
* 演绎区域已注入的标记。值是这份 html 的**内容指纹**,不是布尔。
|
|
61
64
|
*
|
|
@@ -9,6 +9,8 @@ export declare class SomaUiConfigError extends Error {
|
|
|
9
9
|
constructor(message: string, path?: string);
|
|
10
10
|
}
|
|
11
11
|
export interface SomaUiConfigParseOptions {
|
|
12
|
+
/** Raw collectionSlot is trusted package source only; runtimes consume plan references. */
|
|
13
|
+
collectionBindingStage?: 'definition-source' | 'runtime';
|
|
12
14
|
/**
|
|
13
15
|
* 阶梯词汇表(F-09)。core 不内置任何级语义,词汇由宿主 bootstrap 注入;
|
|
14
16
|
* 不传而页面声明了 `adaptive.ladder` 时,按"词汇未知"快速失败。
|
|
@@ -1,10 +1,12 @@
|
|
|
1
1
|
import type { SomaComponentDefinition } from '../component/component-definition.types';
|
|
2
2
|
import type { SomaAdaptiveVocabulary } from '../../shared/types/adaptive.types';
|
|
3
3
|
import type { SomaErrorEvent, SomaPageIdentity } from '../observability/error-reporter';
|
|
4
|
+
import type { ComponentTreeRuntimeEnvelope } from '../../shared/types/component-tree-artifact.types';
|
|
5
|
+
import type { SomaPageMarkup } from '../../shared/types/component-tree.types';
|
|
4
6
|
/**
|
|
5
7
|
* 服务端编译产物。浏览器不编译 SOMA DSL 源声明,缺失或不完整时明确拒绝。
|
|
6
8
|
*/
|
|
7
|
-
export interface PrecompiledDeclarationAssets {
|
|
9
|
+
export interface PrecompiledDeclarationAssets extends ComponentTreeRuntimeEnvelope {
|
|
8
10
|
uiConfig?: unknown;
|
|
9
11
|
eventConfig?: unknown;
|
|
10
12
|
triggerConfig?: unknown;
|
|
@@ -13,6 +15,8 @@ export interface PrecompiledDeclarationAssets {
|
|
|
13
15
|
dataConfig?: unknown;
|
|
14
16
|
}
|
|
15
17
|
export interface GeneratedPageDeclarations {
|
|
18
|
+
markup?: SomaPageMarkup;
|
|
19
|
+
grammarVersion?: number;
|
|
16
20
|
html: string;
|
|
17
21
|
uiYaml: string;
|
|
18
22
|
eventYaml?: string;
|
package/dist/types/index.d.ts
CHANGED
|
@@ -9,6 +9,8 @@ export type { SomaPageAssets, SomaBootstrapOptions, SomaBootstrapErrorReporting,
|
|
|
9
9
|
export { SomaComponentRegistry } from './client/component/component-registry';
|
|
10
10
|
export { SomaComponentManager } from './client/component/component-manager';
|
|
11
11
|
export { generateAiCatalog, buildCatalogEntry } from './client/component/ai-catalog';
|
|
12
|
+
export { selectSomaCatalogExample, formatSomaCatalogExample } from './client/component/catalog-examples';
|
|
13
|
+
export type { CatalogExampleCapabilities, CatalogExampleSource } from './client/component/catalog-examples';
|
|
12
14
|
export { deriveKeyboardMatrix, renderKeyboardMatrixLine, SOMA_KEYBOARD_INTENTS, } from './client/component/keyboard-matrix';
|
|
13
15
|
export type { SomaKeyboardIntent, SomaKeyboardMatrixRow } from './client/component/keyboard-matrix';
|
|
14
16
|
export type { SomaAiCatalog, SomaAiCatalogEntry, GenerateAiCatalogOptions, } from './client/component/ai-catalog';
|
|
@@ -59,7 +61,7 @@ export type { SomaAdaptiveProfile, SomaAdaptiveConfig, SomaAdaptiveLevel, SomaAd
|
|
|
59
61
|
export { createAdaptiveObserverPool, scheduleAdaptiveFlush, resolveTierWithHysteresis, SOMA_DEFAULT_HYSTERESIS, } from './client/adaptive/index';
|
|
60
62
|
export type { SomaAdaptiveObserverPool, SomaAdaptiveSize, SomaAdaptiveSizeCallback, SomaAdaptiveTask, } from './client/adaptive/index';
|
|
61
63
|
export type { SomaComponentDefinition, SomaComponentControllerContext, SomaComponentControllerFactory, } from './client/component/component-definition.types';
|
|
62
|
-
export type { SomaComponentContract, SomaComponentLayer, SomaGeometryFamily, SomaContractField, SomaContractProp, SomaContractEmit, SomaContractSlot, SomaContractKeyboard, SomaContractOverlay, SomaContractToken, } from './shared/types/component-contract.types';
|
|
64
|
+
export type { SomaComponentContract, SomaComponentLayer, SomaGeometryFamily, SomaContractField, SomaContractProp, SomaContractEmit, SomaContractSlot, SomaContractKeyboard, SomaContractOverlay, SomaContractToken, SomaContractExample, } from './shared/types/component-contract.types';
|
|
63
65
|
export { findNestedMutableContractDefault } from './shared/types/component-contract.types';
|
|
64
66
|
export { parseFieldLines, parseEmitLines, parseSlotLines, renderFieldLines, somaFields, somaEmits, somaSlots, SomaFieldLinesError, } from './shared/component/field-lines';
|
|
65
67
|
export { deriveContractSample, deriveContractPreviewSample, deriveFieldSample, hasRenderableSample, } from './shared/component/derive-sample';
|
|
@@ -76,7 +78,6 @@ export type { SomaHtmlSanitizer, SomaHtmlSanitizeResult } from './client/securit
|
|
|
76
78
|
export type { SomaDiagnosticsSnapshot } from './client/diagnostics/SomaDiagnostics';
|
|
77
79
|
export { matchGlobPath } from './client/engine/property-watcher';
|
|
78
80
|
export { extractConfigFromDomainClass } from './client/parser/annotation-extractor';
|
|
79
|
-
export { somaRollupPlugin } from './build/compiler/rollup-plugin-soma';
|
|
80
81
|
export { Page, Show, ShowList, Event } from './client/base/decorators';
|
|
81
82
|
export { runAsync } from './client/base/runAsync';
|
|
82
83
|
export type { AsyncStateHost } from './client/base/runAsync';
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import type { SomaPageMarkup } from '../../shared/types/component-tree.types';
|
|
2
|
+
/** Trusted Host/source-package source inventory; page declarations cannot change this file. */
|
|
3
|
+
export declare function loadPageMarkupConfig(configRoot: string, base: string): {
|
|
4
|
+
markup?: SomaPageMarkup;
|
|
5
|
+
grammarVersion?: number;
|
|
6
|
+
};
|
|
@@ -1,8 +1,12 @@
|
|
|
1
|
+
import type { SomaPageMarkup, TreeCompileContext } from '../../shared/types/component-tree.types';
|
|
2
|
+
import type { TreeArtifact } from '../../shared/types/component-tree-artifact.types';
|
|
1
3
|
/**
|
|
2
4
|
* 参与编译、因而必须参与哈希的声明字段闭集。
|
|
3
5
|
* `notes` 等元信息不进编译器,也不进键——把它算进去只会让相同产物反复重算。
|
|
4
6
|
*/
|
|
5
7
|
export interface PublishedPageDeclaration {
|
|
8
|
+
markup?: SomaPageMarkup;
|
|
9
|
+
grammarVersion?: number;
|
|
6
10
|
html: string;
|
|
7
11
|
uiYaml: string;
|
|
8
12
|
eventYaml?: string;
|
|
@@ -11,6 +15,9 @@ export interface PublishedPageDeclaration {
|
|
|
11
15
|
}
|
|
12
16
|
/** 浏览器最终收到的运行时资产。缓存条目一律冻结:共享对象被就地改写是另一种静默污染。 */
|
|
13
17
|
export interface PublishedPageArtifact {
|
|
18
|
+
readonly sourceMarkup: SomaPageMarkup;
|
|
19
|
+
readonly html: string;
|
|
20
|
+
readonly artifact?: TreeArtifact;
|
|
14
21
|
readonly uiYaml: string;
|
|
15
22
|
readonly eventYaml: string;
|
|
16
23
|
readonly dataYaml?: string;
|
|
@@ -48,7 +55,7 @@ export declare function publishedPageArtifactKey(declaration: PublishedPageDecla
|
|
|
48
55
|
* 传给编译器的字段与参与哈希的字段是同一个闭集——只有这样,
|
|
49
56
|
* 「键相同」才真的等价于「编译输入相同」。
|
|
50
57
|
*/
|
|
51
|
-
export declare function compilePublishedPageArtifact(declaration: PublishedPageDeclaration): PublishedPageArtifact;
|
|
58
|
+
export declare function compilePublishedPageArtifact(declaration: PublishedPageDeclaration, treeContext?: TreeCompileContext): PublishedPageArtifact;
|
|
52
59
|
/**
|
|
53
60
|
* 取产物:命中缓存直接返回,否则编译并落缓存。
|
|
54
61
|
*
|
|
@@ -57,6 +64,7 @@ export declare function compilePublishedPageArtifact(declaration: PublishedPageD
|
|
|
57
64
|
*/
|
|
58
65
|
export declare function resolvePublishedPageArtifact(declaration: PublishedPageDeclaration, options?: {
|
|
59
66
|
compilerVersion?: string;
|
|
67
|
+
treeContext?: TreeCompileContext;
|
|
60
68
|
}): PublishedPageArtifactResult;
|
|
61
69
|
/** 测试与排障用:清空缓存与计数。生产路径不调用。 */
|
|
62
70
|
export declare function resetPublishedPageArtifactCache(): void;
|
|
@@ -10,11 +10,13 @@ export declare function loadPublishedRegistryPageAssets(pagePath: string): Promi
|
|
|
10
10
|
version: number;
|
|
11
11
|
};
|
|
12
12
|
dataYaml?: string | undefined;
|
|
13
|
+
ui: string;
|
|
14
|
+
event: string;
|
|
15
|
+
styleYaml: string;
|
|
16
|
+
artifact?: import("../../shared/types/component-tree-artifact.types").TreeArtifact | undefined;
|
|
13
17
|
base: string;
|
|
14
18
|
sourceType: "registry";
|
|
15
19
|
sourcePackage: null;
|
|
20
|
+
sourceMarkup: import("../../shared/types/component-tree.types").SomaPageMarkup;
|
|
16
21
|
html: string;
|
|
17
|
-
ui: string;
|
|
18
|
-
event: string;
|
|
19
|
-
styleYaml: string;
|
|
20
22
|
} | null>;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { TreeCompileContext } from '../../shared/types/component-tree.types';
|
|
2
|
+
export interface SomaTreeContextRequest {
|
|
3
|
+
pageBase: string;
|
|
4
|
+
domain?: string;
|
|
5
|
+
app?: string;
|
|
6
|
+
}
|
|
7
|
+
/** Synchronous, server-only Host assembly hook. No page/request-provided module paths. */
|
|
8
|
+
export declare function resolveHostTreeCompileContext(hostDir: string | undefined, request: SomaTreeContextRequest): TreeCompileContext | undefined;
|
|
@@ -1,6 +1,10 @@
|
|
|
1
1
|
import { type SomaAssetSource } from './source-packages';
|
|
2
|
+
import type { SomaPageMarkup, TreeCompileContext } from '../../shared/types/component-tree.types';
|
|
3
|
+
import type { TreeArtifact } from '../../shared/types/component-tree-artifact.types';
|
|
2
4
|
export type SomaPageAssetLoadProfile = 'render' | 'headless';
|
|
3
5
|
export interface SomaServerPageAssets {
|
|
6
|
+
sourceMarkup: SomaPageMarkup;
|
|
7
|
+
artifact?: TreeArtifact;
|
|
4
8
|
base: string;
|
|
5
9
|
sourceType: SomaAssetSource['type'];
|
|
6
10
|
sourcePackage: string | null;
|
|
@@ -28,4 +32,6 @@ export declare function loadSomaServerPageAssets(options: {
|
|
|
28
32
|
urlPath: string;
|
|
29
33
|
profile?: SomaPageAssetLoadProfile;
|
|
30
34
|
watch?: boolean;
|
|
35
|
+
/** Trusted server context, never read from the page declaration or request body. */
|
|
36
|
+
treeContext?: TreeCompileContext;
|
|
31
37
|
}): SomaServerPageAssets;
|
|
@@ -1,7 +1,16 @@
|
|
|
1
|
+
import type { SomaPageMarkup, TreeCompileContext } from '../../shared/types/component-tree.types';
|
|
2
|
+
import type { TreeArtifact } from '../../shared/types/component-tree-artifact.types';
|
|
1
3
|
export interface SomaPageCompileResult {
|
|
4
|
+
sourceMarkup: SomaPageMarkup;
|
|
5
|
+
html: string;
|
|
6
|
+
artifact?: TreeArtifact;
|
|
2
7
|
ui: string;
|
|
3
8
|
event: string;
|
|
4
9
|
dataYaml?: string;
|
|
5
10
|
}
|
|
6
11
|
/** 外置块约定 `ui/{base}.blocks/*.yaml`,与页面声明同目录。 */
|
|
7
|
-
export declare function compileSomaPageAssets(uiRaw: string, html: string, uiDir: string, base: string, includes?: Readonly<Record<string, string
|
|
12
|
+
export declare function compileSomaPageAssets(uiRaw: string, html: string, uiDir: string, base: string, includes?: Readonly<Record<string, string>>, options?: {
|
|
13
|
+
markup?: SomaPageMarkup;
|
|
14
|
+
grammarVersion?: number;
|
|
15
|
+
treeContext?: TreeCompileContext;
|
|
16
|
+
}): SomaPageCompileResult;
|
|
@@ -12,3 +12,9 @@
|
|
|
12
12
|
* soma-core 自己的客户端依赖图够不到 core/server,由 verify:client-dep-graph 看守。
|
|
13
13
|
*/
|
|
14
14
|
export { compilePageDeclaration, type CompiledPageDeclaration, type SomaPageDeclarationInput, } from '../build/compiler/page-declaration-compiler';
|
|
15
|
+
/** Source diagnostics and trusted build-time component preparation. */
|
|
16
|
+
export { preflightComponentTree, type ComponentTreePreflightInput } from '../build/component-tree/source-preflight';
|
|
17
|
+
export { buildComponentTreeRegistrySnapshot } from '../build/component-tree/registry-snapshot';
|
|
18
|
+
export { prepareComponentTreeDefinitions } from '../build/component-tree/definition-preparation';
|
|
19
|
+
export { normalizeRuntimeConfig, computeTreeCompileKey, verifyTreeRuntimeAssets } from '../build/component-tree/artifact-codec';
|
|
20
|
+
export type { TreeCompileContext, TreeValidationResult } from '../shared/types/component-tree.types';
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
import { type CompiledPageDeclaration } from '../../build/compiler/page-declaration-compiler';
|
|
2
2
|
import type { PageRegistryDeclaration } from './page-registry-store';
|
|
3
|
+
import type { TreeCompileContext } from '../../shared/types/component-tree.types';
|
|
4
|
+
import type { ComponentTreeRuntimeEnvelope } from '../../shared/types/component-tree-artifact.types';
|
|
3
5
|
/**
|
|
4
6
|
* 编译器版本。与 soma-core 的包版本对齐——语义变更必然伴随版本号变化,
|
|
5
7
|
* 拿它当"这份缓存还能不能用"的判据,比自己再造一套指纹可靠。
|
|
@@ -10,7 +12,7 @@ import type { PageRegistryDeclaration } from './page-registry-store';
|
|
|
10
12
|
*/
|
|
11
13
|
export declare const DECLARATION_COMPILER_VERSION: string;
|
|
12
14
|
/** 落库的完整运行时产物。 */
|
|
13
|
-
export interface CompiledDeclaration {
|
|
15
|
+
export interface CompiledDeclaration extends ComponentTreeRuntimeEnvelope {
|
|
14
16
|
compilerVersion: string;
|
|
15
17
|
/**
|
|
16
18
|
* 供货指纹(词表版本那一维,可选)。缺席 = 编译那一刻宿主没报供货版本,
|
|
@@ -33,7 +35,7 @@ export interface CompiledDeclaration {
|
|
|
33
35
|
* 这里就不再编第二遍。产物由下面同一段映射得出,与自己编出来的逐字相同;
|
|
34
36
|
* 供货指纹仍在此刻读取,与自己编时同一时点。保证它编的是同一份声明,是传入方的责任。
|
|
35
37
|
*/
|
|
36
|
-
export declare function precompileDeclaration(declaration: PageRegistryDeclaration, compiledPage?: CompiledPageDeclaration): CompiledDeclaration | null;
|
|
38
|
+
export declare function precompileDeclaration(declaration: PageRegistryDeclaration, compiledPage?: CompiledPageDeclaration, treeContext?: TreeCompileContext): CompiledDeclaration | null;
|
|
37
39
|
/**
|
|
38
40
|
* 消费端的版本闸:编译器版本或供货版本对不上就整份丢弃。
|
|
39
41
|
* 这是"缓存不是真理"那条纪律的执行点。
|
|
@@ -47,4 +49,7 @@ export declare function precompileDeclaration(declaration: PageRegistryDeclarati
|
|
|
47
49
|
* 而运行时问不到自己的供货版本时判假,等于拿"我不知道"当"不一致"。
|
|
48
50
|
* 失败方向仍然安全:第三道闸判假只导致**重新编译**,不导致拒绝。
|
|
49
51
|
*/
|
|
50
|
-
export declare function isCompiledUsable(compiled: CompiledDeclaration | null | undefined, runtimeVersion?: string, runtimeSupplyKey?: string | undefined
|
|
52
|
+
export declare function isCompiledUsable(compiled: CompiledDeclaration | null | undefined, runtimeVersion?: string, runtimeSupplyKey?: string | undefined, options?: {
|
|
53
|
+
declaration?: PageRegistryDeclaration;
|
|
54
|
+
treeContext?: TreeCompileContext;
|
|
55
|
+
}): boolean;
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { type PageRegistryDeclaration, type PageRegistryListOptions, type PageRegistryListResult, type PageRegistryMeta, type PageRegistryPublishOptions, type PageRegistryStatus, type PageRegistryWriteOptions, type PageVersionRecord } from './page-registry-store';
|
|
2
2
|
import { type PageRegistryStore } from './page-registry-store';
|
|
3
3
|
import type { ConditionalObjectStore } from './conditional-object-store';
|
|
4
|
+
import type { TreeCompileContext } from '../../shared/types/component-tree.types';
|
|
4
5
|
export interface PublishResult {
|
|
5
6
|
record: PageVersionRecord;
|
|
6
7
|
}
|
|
@@ -9,6 +10,7 @@ export interface RollbackResult {
|
|
|
9
10
|
}
|
|
10
11
|
/** API 的唯一仓储门面;全部方法异步,后端可为共享文件系统或对象存储 CAS。 */
|
|
11
12
|
export interface PageRegistryRepository {
|
|
13
|
+
getTreeCompileContext?(name: string, app: string): TreeCompileContext | undefined;
|
|
12
14
|
publish(name: string, declaration: unknown, options?: PageRegistryStatus | PageRegistryPublishOptions): Promise<PublishResult>;
|
|
13
15
|
get(name: string, version?: number): Promise<PageVersionRecord>;
|
|
14
16
|
list(options?: PageRegistryListOptions): Promise<PageRegistryListResult>;
|
|
@@ -22,6 +24,7 @@ export interface PageRegistryRepository {
|
|
|
22
24
|
export declare class FilePageRegistryRepository implements PageRegistryRepository {
|
|
23
25
|
private readonly injectedPages?;
|
|
24
26
|
constructor(injectedPages?: PageRegistryStore | undefined);
|
|
27
|
+
getTreeCompileContext(name: string, app: string): TreeCompileContext | undefined;
|
|
25
28
|
publish(name: string, declaration: unknown, options?: PageRegistryStatus | PageRegistryPublishOptions): Promise<PublishResult>;
|
|
26
29
|
get(name: string, version?: number): Promise<PageVersionRecord>;
|
|
27
30
|
list(options?: PageRegistryListOptions): Promise<PageRegistryListResult>;
|
|
@@ -38,7 +41,9 @@ export declare class ConditionalPageRegistryRepository implements PageRegistryRe
|
|
|
38
41
|
prefix?: string;
|
|
39
42
|
now?: () => number;
|
|
40
43
|
maxAttempts?: number;
|
|
44
|
+
treeContextResolver?: (name: string, app: string) => TreeCompileContext | undefined;
|
|
41
45
|
});
|
|
46
|
+
getTreeCompileContext(name: string, app: string): TreeCompileContext | undefined;
|
|
42
47
|
publish(name: string, declaration: unknown, options?: PageRegistryStatus | PageRegistryPublishOptions): Promise<PublishResult>;
|
|
43
48
|
get(name: string, version?: number): Promise<PageVersionRecord>;
|
|
44
49
|
list(options?: PageRegistryListOptions): Promise<PageRegistryListResult>;
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import type { CompiledPageDeclaration } from '../../build/compiler/page-declaration-compiler';
|
|
2
|
+
import type { SomaPageMarkup, TreeCompileContext } from '../../shared/types/component-tree.types';
|
|
2
3
|
import { type CompiledDeclaration } from './declaration-precompiler';
|
|
3
4
|
import { type SomaAssetPin } from './publish-asset-pin';
|
|
4
5
|
import { RegistryError } from './registry-error';
|
|
@@ -65,6 +66,8 @@ export declare class PageRegistryError extends RegistryError {
|
|
|
65
66
|
}
|
|
66
67
|
/** 页面声明本体:与 /api/ai-page/generate 的产物同构(dataYaml 为数据对象绑定拓展位) */
|
|
67
68
|
export interface PageRegistryDeclaration {
|
|
69
|
+
markup?: SomaPageMarkup;
|
|
70
|
+
grammarVersion?: number;
|
|
68
71
|
html: string;
|
|
69
72
|
uiYaml: string;
|
|
70
73
|
eventYaml: string;
|
|
@@ -135,6 +138,7 @@ export interface PageRegistryWriteOptions {
|
|
|
135
138
|
}
|
|
136
139
|
/** 追加新版本时的规范化字段;文件后端与条件写后端共用同一状态机输入。 */
|
|
137
140
|
export interface PageVersionFields {
|
|
141
|
+
treeContext?: TreeCompileContext;
|
|
138
142
|
declaration: PageRegistryDeclaration;
|
|
139
143
|
status: PageRegistryStatus;
|
|
140
144
|
app: string;
|
|
@@ -199,12 +203,15 @@ export interface PageRegistryListResult {
|
|
|
199
203
|
total: number;
|
|
200
204
|
}
|
|
201
205
|
export interface PageRegistryStoreOptions {
|
|
206
|
+
/** Trusted server assembly only; never accepted through publish request options. */
|
|
207
|
+
treeContextResolver?: (name: string, app: string) => TreeCompileContext | undefined;
|
|
202
208
|
/** 持久化目录(每页面一个 <name>.json),默认 data/soma-runtime/pages */
|
|
203
209
|
baseDir?: string;
|
|
204
210
|
/** 时钟注入点,默认 Date.now;测试传确定性时钟 */
|
|
205
211
|
now?: () => number;
|
|
206
212
|
}
|
|
207
213
|
export declare class PageRegistryStore {
|
|
214
|
+
private readonly treeContextResolver;
|
|
208
215
|
private readonly baseDir;
|
|
209
216
|
private readonly now;
|
|
210
217
|
/**
|
|
@@ -216,6 +223,7 @@ export declare class PageRegistryStore {
|
|
|
216
223
|
*/
|
|
217
224
|
private readonly cache;
|
|
218
225
|
constructor(options?: PageRegistryStoreOptions);
|
|
226
|
+
getTreeCompileContext(name: string, app: string): TreeCompileContext | undefined;
|
|
219
227
|
/** 供共享 FS 聚合协调器使用;对象存储模式不依赖本地路径。 */
|
|
220
228
|
storageDirectory(): string;
|
|
221
229
|
/**
|
|
@@ -296,10 +304,12 @@ export declare function normalizePublishOptions(options: PageRegistryStatus | Pa
|
|
|
296
304
|
* **同一份归一化声明**、同一个纯函数,发布路径上相邻两步——第二遍只是重付一次编译代价
|
|
297
305
|
* (演绎链接进来之后这笔代价随声明规模长),而落库结果逐字相同,多编一遍不会让任何东西红。
|
|
298
306
|
*/
|
|
299
|
-
export declare function normalizeDeclaration(declaration: unknown): {
|
|
307
|
+
export declare function normalizeDeclaration(declaration: unknown, treeContext?: TreeCompileContext): {
|
|
300
308
|
declaration: PageRegistryDeclaration;
|
|
301
309
|
compiledPage: CompiledPageDeclaration;
|
|
302
310
|
};
|
|
311
|
+
/** Inspect only the format discriminator; the full declaration is validated by normalizeDeclaration. */
|
|
312
|
+
export declare function isTreeDeclaration(value: unknown): boolean;
|
|
303
313
|
/** 声明总字节数:UTF-8 计,涵盖 declaration 的全部字符串字段 */
|
|
304
314
|
export declare function declarationByteSize(declaration: PageRegistryDeclaration): number;
|
|
305
315
|
/** 存量 JSON 记录归一化:只补元数据;旧页面语法必须离线迁移,不在读取时自动转换。 */
|
|
@@ -81,6 +81,10 @@ export interface PinnableDeclaration {
|
|
|
81
81
|
html: string;
|
|
82
82
|
}
|
|
83
83
|
export interface PinPublishedAssetsOptions {
|
|
84
|
+
/** Tree compilation includes macros and the complete transitive uses closure. */
|
|
85
|
+
componentRefs?: readonly {
|
|
86
|
+
name: string;
|
|
87
|
+
}[];
|
|
84
88
|
/** 演绎产物。演绎选出的组件不在 `html` 里,不带上就会漏钉恰好是演绎选中的那些 */
|
|
85
89
|
artifact?: SomaPageOouiArtifact | undefined;
|
|
86
90
|
/** 资产库(缺省取进程共享库) */
|
|
@@ -1,5 +1,8 @@
|
|
|
1
1
|
import { type CompiledPageDeclaration } from '../../../build/compiler/page-declaration-compiler';
|
|
2
|
+
import type { SomaPageMarkup, TreeCompileContext } from '../../../shared/types/component-tree.types';
|
|
2
3
|
export interface CompilableDeclaration {
|
|
4
|
+
markup?: SomaPageMarkup;
|
|
5
|
+
grammarVersion?: number;
|
|
3
6
|
html: string;
|
|
4
7
|
uiYaml: string;
|
|
5
8
|
eventYaml?: string;
|
|
@@ -64,7 +67,7 @@ export interface CompileGateResult {
|
|
|
64
67
|
*
|
|
65
68
|
* `issues` 与 `dryRunCompile()` 逐字一致——两者是同一条判定,不是两套规则。
|
|
66
69
|
*/
|
|
67
|
-
export declare function dryRunCompileWithDiagnostics(declaration: CompilableDeclaration): CompileGateResult;
|
|
70
|
+
export declare function dryRunCompileWithDiagnostics(declaration: CompilableDeclaration, treeContext?: TreeCompileContext): CompileGateResult;
|
|
68
71
|
/**
|
|
69
72
|
* 干跑编译,返回中文问题清单(空数组 = 通过)。
|
|
70
73
|
* 与安全扫描同款约定:命中即拒,清单点名到具体哪一件、解析器原话是什么。
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { type ComponentTreeRuntimeEnvelope, type DefinitionPreparation } from './types/component-tree-artifact.types';
|
|
2
|
+
/** Pure browser/server schema gate. Hash/context verification remains build/server-owned. */
|
|
3
|
+
export declare function assertRuntimeArtifact(input: unknown): asserts input is ComponentTreeRuntimeEnvelope;
|
|
4
|
+
/** Definitions carry their own gate even when mounted from a legacy page. */
|
|
5
|
+
export declare function assertDefinitionPreparation(input: unknown): asserts input is DefinitionPreparation;
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import type { SourceSpan } from './types/component-tree.types';
|
|
2
|
+
export type ComponentTreeErrorCode = 'CT-SYNTAX-ROOT' | 'CT-SYNTAX-ELEMENT' | 'CT-SYNTAX-CLOSE' | 'CT-SYNTAX-ATTRIBUTE' | 'CT-IDENTITY-ID' | 'CT-IDENTITY-HOST' | 'CT-REGISTRY-CONTEXT' | 'CT-REGISTRY-COMPONENT' | 'CT-POLICY-COMPONENT' | 'CT-SLOT-CONTRACT' | 'CT-STRUCTURE-MOUNT' | 'CT-BINDING-SCOPE' | 'CT-BINDING-DUPLICATE' | 'CT-REPEAT-SOURCE' | 'CT-REPEAT-KEY' | 'CT-LIMIT' | 'CT-LAYOUT-PARENT' | 'CT-ARTIFACT-VERSION' | 'CT-ARTIFACT-CAPABILITY' | 'CT-ARTIFACT-INCOMPLETE' | 'CT-SYNTAX-LEAK' | 'CT-MIGRATION-UNSAFE';
|
|
3
|
+
export interface ComponentTreeDiagnostic {
|
|
4
|
+
code: ComponentTreeErrorCode;
|
|
5
|
+
phase: 'input' | 'parse' | 'registry' | 'validate' | 'bind' | 'lower' | 'emit' | 'artifact' | 'runtime' | 'migration';
|
|
6
|
+
sourceId: string;
|
|
7
|
+
nodePath: string;
|
|
8
|
+
span?: SourceSpan;
|
|
9
|
+
relatedSpans?: readonly SourceSpan[];
|
|
10
|
+
attribute?: string;
|
|
11
|
+
expected?: string;
|
|
12
|
+
/** Describe the invalid shape/token category, never copy business data or credentials. */
|
|
13
|
+
actualSummary?: string;
|
|
14
|
+
fixHint?: string;
|
|
15
|
+
}
|
|
16
|
+
/** Stable, serializable diagnostics without retaining the page source or context. */
|
|
17
|
+
export declare class SomaComponentTreeError extends Error {
|
|
18
|
+
readonly code: ComponentTreeErrorCode;
|
|
19
|
+
readonly diagnostic: Readonly<ComponentTreeDiagnostic>;
|
|
20
|
+
constructor(diagnostic: ComponentTreeDiagnostic);
|
|
21
|
+
toJSON(): Readonly<ComponentTreeDiagnostic>;
|
|
22
|
+
}
|
|
@@ -57,6 +57,31 @@ export interface SomaContractSlot {
|
|
|
57
57
|
desc?: string;
|
|
58
58
|
required?: boolean;
|
|
59
59
|
}
|
|
60
|
+
/** Core 拥有的非交互结构语义词汇;组件只能收窄,不能传入任意标签。 */
|
|
61
|
+
export type SomaStructureSemanticToken = 'root' | 'main' | 'section' | 'article' | 'div' | 'flow' | 'aside' | 'header' | 'footer' | 'nav' | 'navigation' | 'complementary' | 'contentinfo' | 'region' | 'none' | 'unordered' | 'ordered';
|
|
62
|
+
export interface SomaStructureSemantics {
|
|
63
|
+
target: 'host';
|
|
64
|
+
default: SomaStructureSemanticToken;
|
|
65
|
+
allowed: SomaStructureSemanticToken[];
|
|
66
|
+
/** 仅支持 Core 已定义的 as/landmark/ordered 封闭转换,不接受脚本。 */
|
|
67
|
+
staticProp?: string;
|
|
68
|
+
}
|
|
69
|
+
export interface SomaStructureSlot {
|
|
70
|
+
kind: 'projection' | 'collection';
|
|
71
|
+
/** 受信组件实现键,不是页面提供的 CSS selector。 */
|
|
72
|
+
layoutRoot?: string;
|
|
73
|
+
directChildren: boolean;
|
|
74
|
+
/** 仅集合槽可声明,集合槽必须明确是否需要语义行容器。 */
|
|
75
|
+
rowContainer?: 'none' | 'list-item';
|
|
76
|
+
}
|
|
77
|
+
/** 可选的新树结构契约;缺省保持旧组件行为,不自动推断结构能力。 */
|
|
78
|
+
export interface SomaContractStructure {
|
|
79
|
+
kind: 'element' | 'fragment-macro';
|
|
80
|
+
rootless: boolean;
|
|
81
|
+
tree_mount: 'legacy-host' | 'controlled-host' | 'single-host' | 'erase';
|
|
82
|
+
semantics?: SomaStructureSemantics;
|
|
83
|
+
slots?: Record<string, SomaStructureSlot>;
|
|
84
|
+
}
|
|
60
85
|
/**
|
|
61
86
|
* 组件级令牌(三级令牌的第三级,REQ-009 M-1)。
|
|
62
87
|
*
|
|
@@ -77,11 +102,26 @@ export interface SomaContractToken {
|
|
|
77
102
|
* AI 目录段(契约规范第 11 章):AI 生成页面前查表选组件的依据。
|
|
78
103
|
* when_to_use / example 为目录质量线;when_not_to_use 用于同族组件消歧。
|
|
79
104
|
*/
|
|
105
|
+
export type SomaContractExample = {
|
|
106
|
+
format: 'legacy-html';
|
|
107
|
+
grammarVersion?: never;
|
|
108
|
+
html: string;
|
|
109
|
+
canonicalUi: string;
|
|
110
|
+
capabilities?: readonly string[];
|
|
111
|
+
} | {
|
|
112
|
+
format: 'component-tree';
|
|
113
|
+
grammarVersion: 1;
|
|
114
|
+
html: string;
|
|
115
|
+
canonicalUi: string;
|
|
116
|
+
capabilities?: readonly string[];
|
|
117
|
+
};
|
|
80
118
|
export interface SomaContractAiSection {
|
|
81
119
|
when_to_use: string;
|
|
82
120
|
when_not_to_use?: string;
|
|
83
121
|
/** 三行真实用法:html / ui / event 各一行 */
|
|
84
122
|
example: string;
|
|
123
|
+
/** Full examples are format- and capability-negotiated; legacy example remains compatible. */
|
|
124
|
+
examples?: readonly SomaContractExample[];
|
|
85
125
|
anti_patterns?: string[];
|
|
86
126
|
}
|
|
87
127
|
export interface SomaComponentContract {
|
|
@@ -96,6 +136,8 @@ export interface SomaComponentContract {
|
|
|
96
136
|
props?: Record<string, SomaContractProp>;
|
|
97
137
|
emits?: Record<string, SomaContractEmit>;
|
|
98
138
|
slots?: Record<string, SomaContractSlot>;
|
|
139
|
+
/** REQ-016:构建期验证的宿主、语义、投影/集合结构能力。 */
|
|
140
|
+
structure?: SomaContractStructure;
|
|
99
141
|
/**
|
|
100
142
|
* 组件级令牌:key 为 kebab-case,装配期写出 `--soma-<组件名 kebab>-<key>`。
|
|
101
143
|
* 主题输入的 `components.<组件名>.<key>` 覆盖它,`ThemeScope` 可按子树覆盖。
|
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
import type { SomaStructureSemanticToken } from './component-contract.types';
|
|
2
|
+
import type { CollectionStatusPlan, SomaPageMarkup } from './component-tree.types';
|
|
3
|
+
export declare const COMPONENT_TREE_CAPABILITIES: readonly ["component-tree:1", "structure-host:1", "fragment-erasure:1", "repeat-range:1", "row-bindings:1", "definition-repeat:1"];
|
|
4
|
+
export type ComponentTreeCapability = typeof COMPONENT_TREE_CAPABILITIES[number];
|
|
5
|
+
/** Trusted component implementation keys; never page-provided selectors. */
|
|
6
|
+
export interface SomaStructureAdapterDefinition {
|
|
7
|
+
rootAnchor?: string;
|
|
8
|
+
layoutRoots: Record<string, string>;
|
|
9
|
+
}
|
|
10
|
+
export interface SlotPlan {
|
|
11
|
+
name: string;
|
|
12
|
+
kind: 'projection' | 'collection';
|
|
13
|
+
ownerSymbol: string;
|
|
14
|
+
layoutRootKey?: string;
|
|
15
|
+
directChildren: boolean;
|
|
16
|
+
rowContainer?: 'none' | 'list-item';
|
|
17
|
+
}
|
|
18
|
+
export interface StructurePlan {
|
|
19
|
+
/** The emitted template symbol, shared by HTML anchors and compiled bindings. */
|
|
20
|
+
instanceSymbol: string;
|
|
21
|
+
componentName: string;
|
|
22
|
+
mountMode: 'legacy-host' | 'controlled-host' | 'single-host';
|
|
23
|
+
semanticToken?: SomaStructureSemanticToken;
|
|
24
|
+
hostTag: string;
|
|
25
|
+
slotPlans: SlotPlan[];
|
|
26
|
+
internalRootId?: string;
|
|
27
|
+
structureDigest: string;
|
|
28
|
+
/** Compiled static semantic props; runtime defaults/updates may not change them. */
|
|
29
|
+
staticProps?: Record<string, string | boolean>;
|
|
30
|
+
}
|
|
31
|
+
export interface CollectionDeclarationScope {
|
|
32
|
+
kind: 'page' | 'component';
|
|
33
|
+
ownerSymbol: string;
|
|
34
|
+
parentScopeId?: string;
|
|
35
|
+
/** Domain name for pages, __component for trusted component definitions. */
|
|
36
|
+
readerRoot: string;
|
|
37
|
+
emitOwnerSymbol: string;
|
|
38
|
+
}
|
|
39
|
+
export interface CollectionConsumerOwner {
|
|
40
|
+
instanceSymbol: string;
|
|
41
|
+
componentName: string;
|
|
42
|
+
slotName: string;
|
|
43
|
+
layoutRootKey: string;
|
|
44
|
+
rowContainer: 'none' | 'list-item';
|
|
45
|
+
}
|
|
46
|
+
export interface RepeatPlan {
|
|
47
|
+
planId: string;
|
|
48
|
+
scopeId: string;
|
|
49
|
+
parentPlanId?: string;
|
|
50
|
+
declarationScope: CollectionDeclarationScope;
|
|
51
|
+
consumerOwner: CollectionConsumerOwner;
|
|
52
|
+
sourcePath: string;
|
|
53
|
+
statusPlan: CollectionStatusPlan;
|
|
54
|
+
itemAlias: string;
|
|
55
|
+
/** Full current-item path (for example row.id), not a second author input. */
|
|
56
|
+
keyPath: string;
|
|
57
|
+
rowTemplateId: string;
|
|
58
|
+
/** Local source id -> emitted unique template symbol. */
|
|
59
|
+
localSymbols: Record<string, string>;
|
|
60
|
+
limits: {
|
|
61
|
+
maxRows: number;
|
|
62
|
+
maxPageRows: number;
|
|
63
|
+
maxKeyLength: number;
|
|
64
|
+
maxDepth: number;
|
|
65
|
+
};
|
|
66
|
+
}
|
|
67
|
+
export interface DefinitionRepeatPlan extends RepeatPlan {
|
|
68
|
+
definitionName: string;
|
|
69
|
+
definitionPlanId: string;
|
|
70
|
+
}
|
|
71
|
+
export interface DefinitionPreparation {
|
|
72
|
+
schemaVersion: 1;
|
|
73
|
+
requiredCapabilities: ComponentTreeCapability[];
|
|
74
|
+
dependencyDigests: Record<string, string>;
|
|
75
|
+
definitionDigest: string;
|
|
76
|
+
}
|
|
77
|
+
export interface ComponentRef {
|
|
78
|
+
name: string;
|
|
79
|
+
packName?: string;
|
|
80
|
+
packVersion?: string;
|
|
81
|
+
contractDigest: string;
|
|
82
|
+
structureDigest: string;
|
|
83
|
+
uses: string[];
|
|
84
|
+
}
|
|
85
|
+
export interface TreeArtifact {
|
|
86
|
+
schemaVersion: 1;
|
|
87
|
+
grammarVersion: 1;
|
|
88
|
+
compilerVersion: string;
|
|
89
|
+
sourceDigest: string;
|
|
90
|
+
registrySnapshotDigest: string;
|
|
91
|
+
policyDigest: string;
|
|
92
|
+
assetSupplyKey: string;
|
|
93
|
+
capabilities: ComponentTreeCapability[];
|
|
94
|
+
componentRefs: ComponentRef[];
|
|
95
|
+
structurePlan: StructurePlan[];
|
|
96
|
+
repeatPlans: RepeatPlan[];
|
|
97
|
+
artifactDigest: string;
|
|
98
|
+
}
|
|
99
|
+
/** Compatible legacy inputs may omit the mode; newly compiled outputs always carry it. */
|
|
100
|
+
export interface ComponentTreeRuntimeEnvelope {
|
|
101
|
+
sourceMarkup?: SomaPageMarkup;
|
|
102
|
+
html?: string;
|
|
103
|
+
artifact?: TreeArtifact;
|
|
104
|
+
}
|