@pygmalionjs/pygmalion 0.8.1 → 0.10.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/README.md +34 -0
- package/binding-source.d.ts +25 -0
- package/dist-lib/{CameraLayer-B2D29VXQ.js → CameraLayer-BUOlJcUa.js} +17 -17
- package/dist-lib/pygmalion.js +24524 -12555
- package/dist-lib/{runtime-BAy8W1mJ.js → runtime-BOfDlGPR.js} +12438 -11118
- package/dist-lib/style.css +1 -1
- package/dist-lib/testing.js +19 -19
- package/dist-lib/types/binding/catalog.d.ts +10 -0
- package/dist-lib/types/binding/contracts.d.ts +202 -0
- package/dist-lib/types/binding/documentCommands.d.ts +38 -0
- package/dist-lib/types/binding/duplicateMetadata.d.ts +8 -0
- package/dist-lib/types/binding/index.d.ts +7 -0
- package/dist-lib/types/binding/preview.d.ts +37 -0
- package/dist-lib/types/binding/source.d.ts +109 -0
- package/dist-lib/types/binding/useDataProjection.d.ts +9 -0
- package/dist-lib/types/binding/validate.d.ts +8 -0
- package/dist-lib/types/core/runtime.d.ts +6 -0
- package/dist-lib/types/document/appearance.d.ts +112 -0
- package/dist-lib/types/document/assets.d.ts +204 -0
- package/dist-lib/types/document/components.d.ts +169 -0
- package/dist-lib/types/document/contracts.d.ts +171 -0
- package/dist-lib/types/document/engine.d.ts +20 -0
- package/dist-lib/types/document/exportSettings.d.ts +45 -0
- package/dist-lib/types/document/geometry.d.ts +11 -0
- package/dist-lib/types/document/layout.d.ts +53 -0
- package/dist-lib/types/document/prototype.d.ts +424 -0
- package/dist-lib/types/document/prototypeReferences.d.ts +3 -0
- package/dist-lib/types/document/richText.d.ts +185 -0
- package/dist-lib/types/document/styles.d.ts +216 -0
- package/dist-lib/types/document/svgImport.d.ts +17 -0
- package/dist-lib/types/document/vector.d.ts +222 -0
- package/dist-lib/types/editor/designCompiler.d.ts +7 -0
- package/dist-lib/types/editor/designImport.d.ts +7 -0
- package/dist-lib/types/editor/inspect.d.ts +8 -0
- package/dist-lib/types/editor/revisionCatalogInstall.d.ts +1 -1
- package/dist-lib/types/editor/screenInteractions.d.ts +3 -3
- package/dist-lib/types/editor/store.d.ts +1 -1
- package/dist-lib/types/host/project.d.ts +44 -0
- package/dist-lib/types/host/registryConnections.d.ts +11 -0
- package/dist-lib/types/host/sourceFilePlan.d.ts +15 -0
- package/dist-lib/types/host/sourceWriteback.d.ts +50 -0
- package/dist-lib/types/lib.d.ts +103 -3
- package/dist-lib/types/token-library/bindings.d.ts +62 -0
- package/dist-lib/types/token-library/contracts.d.ts +117 -0
- package/dist-lib/types/token-library/engine.d.ts +13 -0
- package/dist-lib/types/token-library/valueResolver.d.ts +19 -0
- package/dist-lib/types/workspace/WorkspaceShell.d.ts +9 -0
- package/dist-lib/types/workspace/application/ApplicationWorkspace.d.ts +3 -0
- package/dist-lib/types/workspace/configuration.d.ts +47 -0
- package/dist-lib/types/workspace/contracts.d.ts +64 -0
- package/dist-lib/types/workspace/controller.d.ts +35 -0
- package/dist-lib/types/workspace/documentSessions.d.ts +42 -0
- package/dist-lib/types/workspace/edit/AppearancePanel.d.ts +23 -0
- package/dist-lib/types/workspace/edit/ArrangeLayers.d.ts +10 -0
- package/dist-lib/types/workspace/edit/AssetsPanel.d.ts +16 -0
- package/dist-lib/types/workspace/edit/CanvasGuides.d.ts +19 -0
- package/dist-lib/types/workspace/edit/ComponentPanel.d.ts +11 -0
- package/dist-lib/types/workspace/edit/DataPanel.d.ts +16 -0
- package/dist-lib/types/workspace/edit/DesignWorkspace.d.ts +10 -0
- package/dist-lib/types/workspace/edit/LayerTree.d.ts +14 -0
- package/dist-lib/types/workspace/edit/LayoutPanel.d.ts +13 -0
- package/dist-lib/types/workspace/edit/PrototypePanel.d.ts +12 -0
- package/dist-lib/types/workspace/edit/ScopeTransferDialog.d.ts +40 -0
- package/dist-lib/types/workspace/edit/SelectionHandles.d.ts +52 -0
- package/dist-lib/types/workspace/edit/StylesPanel.d.ts +8 -0
- package/dist-lib/types/workspace/edit/TextEditor.d.ts +50 -0
- package/dist-lib/types/workspace/edit/VectorEditor.d.ts +89 -0
- package/dist-lib/types/workspace/edit/VectorToolbar.d.ts +5 -0
- package/dist-lib/types/workspace/edit/canvasGuideModel.d.ts +102 -0
- package/dist-lib/types/workspace/edit/clipboard.d.ts +35 -0
- package/dist-lib/types/workspace/edit/duplicateMetadata.d.ts +2 -0
- package/dist-lib/types/workspace/edit/geometryHandles.d.ts +224 -0
- package/dist-lib/types/workspace/edit/layerArrangement.d.ts +39 -0
- package/dist-lib/types/workspace/edit/layerMoves.d.ts +44 -0
- package/dist-lib/types/workspace/edit/projection.d.ts +12 -0
- package/dist-lib/types/workspace/edit/scopeTransfer.d.ts +96 -0
- package/dist-lib/types/workspace/edit/textStyles.d.ts +75 -0
- package/dist-lib/types/workspace/edit/vectorTools.d.ts +136 -0
- package/dist-lib/types/workspace/legacyModeAdapter.d.ts +13 -0
- package/dist-lib/types/workspace/source/ResponsiveLayoutPanel.d.ts +20 -0
- package/dist-lib/types/workspace/source/SourceReview.d.ts +11 -0
- package/dist-lib/types/workspace/source/appearanceSource.d.ts +19 -0
- package/dist-lib/types/workspace/source/compiler.d.ts +5 -0
- package/dist-lib/types/workspace/source/contracts.d.ts +156 -0
- package/dist-lib/types/workspace/source/controller.d.ts +50 -0
- package/dist-lib/types/workspace/source/documentRevision.d.ts +2 -0
- package/dist-lib/types/workspace/source/draftPreviewClient.d.ts +13 -0
- package/dist-lib/types/workspace/source/draftRecipe.d.ts +30 -0
- package/dist-lib/types/workspace/source/flowContracts.d.ts +72 -0
- package/dist-lib/types/workspace/source/prototypeSource.d.ts +4 -0
- package/dist-lib/types/workspace/source/responsive.d.ts +13 -0
- package/dist-lib/types/workspace/source/responsiveContracts.d.ts +78 -0
- package/dist-lib/types/workspace/source/structure.d.ts +21 -0
- package/dist-lib/types/workspace/source/textSource.d.ts +28 -0
- package/dist-lib/types/workspace/tokens/TokenLibraryContext.d.ts +11 -0
- package/dist-lib/types/workspace/tokens/TokenLibraryWorkspace.d.ts +14 -0
- package/dist-lib/types/workspace/tokens/contracts.d.ts +74 -0
- package/dist-lib/types/workspace/tokens/controller.d.ts +44 -0
- package/dist-lib/types/workspace/view/PrototypePlayer.d.ts +17 -0
- package/dist-lib/types/workspace/view/StoryboardWorkspace.d.ts +3 -0
- package/dist-lib/types/workspace/view/prototypePlayback.d.ts +46 -0
- package/draft-preview.d.ts +54 -0
- package/host-runtime.d.ts +73 -0
- package/inspect.d.ts +2 -0
- package/jsx-source-reconciler.d.ts +35 -0
- package/node/design-session.mjs +3 -0
- package/node/host-runtime.mjs +4 -0
- package/node/inspect-plugin.mjs +3 -1
- package/node/inspect-writeback.mjs +18 -2
- package/node/jsx-source-reconciler.mjs +155 -0
- package/node/preview-artifact-store.mjs +10 -7
- package/node/revision-catalog-resolver.mjs +159 -0
- package/node/source-archive-runtime.mjs +63 -0
- package/node/source-archive.mjs +88 -0
- package/node/source-bindings.mjs +65 -0
- package/node/source-file-lock.mjs +15 -0
- package/node/source-file-plan.mjs +162 -0
- package/node/source-file-proofs.mjs +44 -0
- package/node/source-module.mjs +17 -0
- package/node/source-responsive-codec.d.mts +17 -0
- package/node/source-responsive-codec.mjs +133 -0
- package/node/source-responsive.mjs +189 -0
- package/node/source-service-inputs.mjs +81 -0
- package/node/source-service-plugin.mjs +57 -0
- package/node/source-service.mjs +4 -0
- package/node/source-structure-reconcile.mjs +186 -0
- package/node/source-structure-wrapper-codec.d.mts +20 -0
- package/node/source-structure-wrapper-codec.mjs +205 -0
- package/node/source-structure.mjs +404 -0
- package/node/token-source-references.mjs +136 -0
- package/node/token-source-service.mjs +151 -0
- package/node/workspace-draft-entry.mjs +52 -0
- package/node/workspace-draft-preview-plugin.mjs +70 -0
- package/node/workspace-draft-preview.mjs +232 -0
- package/node/workspace-draft-process.mjs +129 -0
- package/node/workspace-draft-runtime.mjs +67 -0
- package/node/workspace-source-identity.d.mts +1 -0
- package/node/workspace-source-identity.mjs +21 -0
- package/node/workspace-source-plan.mjs +195 -0
- package/node/workspace-source-session.mjs +187 -0
- package/package.json +90 -6
- package/source-files.d.ts +35 -0
- package/source-module.d.ts +16 -0
- package/source-responsive.d.ts +10 -0
- package/source-service.d.ts +92 -0
- package/source-structure.d.ts +155 -0
- package/workspace-draft-entry.d.ts +15 -0
- package/workspace-source-plan.d.ts +44 -0
- package/docs/coverage-contracts.md +0 -444
- package/docs/screen-state-contract.md +0 -252
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
export interface SourceModuleBuildResult {
|
|
2
|
+
outputFiles?: readonly { text: string }[];
|
|
3
|
+
}
|
|
4
|
+
|
|
5
|
+
export interface BundledSourceModuleOptions {
|
|
6
|
+
/** A trusted bundler supplied by the consuming build tool. */
|
|
7
|
+
build(options: Record<string, unknown>): Promise<SourceModuleBuildResult>;
|
|
8
|
+
/** Application aliases, plugins, dependency paths, loaders, and entry declaration. */
|
|
9
|
+
buildOptions: Record<string, unknown>;
|
|
10
|
+
/** Absolute logical filename used by CommonJS resolution; no output file is written. */
|
|
11
|
+
filename: string;
|
|
12
|
+
require?: (id: string) => unknown;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
/** Executes trusted source code in the current process. This is not an execution sandbox. */
|
|
16
|
+
export declare function evaluateBundledSourceModule<T = unknown>(options: BundledSourceModuleOptions): Promise<T>;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { InspectApplyPayload } from './dist-lib/types/editor/inspect.js';
|
|
2
|
+
import type { SourceFilePlan } from './dist-lib/types/host/sourceFilePlan.js';
|
|
3
|
+
import type { ResponsiveLayoutDocument, ResponsiveLayoutRange, ResponsiveLayoutSourceTarget, WorkspaceResponsiveSourceMapping } from './dist-lib/types/workspace/source/responsiveContracts.js';
|
|
4
|
+
export interface ResponsiveSourceInputFile { file: string; source: string; sha256: string }
|
|
5
|
+
export declare function readResponsiveLayoutSource(input: { files: readonly ResponsiveSourceInputFile[]; ranges: readonly ResponsiveLayoutRange[]; targets: readonly ResponsiveLayoutSourceTarget[] }): ResponsiveLayoutDocument;
|
|
6
|
+
export declare function compileResponsiveSourcePlan(input: {
|
|
7
|
+
appRoot: string; sourceRevision: string; mapping: WorkspaceResponsiveSourceMapping;
|
|
8
|
+
before: ResponsiveLayoutDocument; after: ResponsiveLayoutDocument;
|
|
9
|
+
additionalStyles?: InspectApplyPayload['styles']; signal?: AbortSignal;
|
|
10
|
+
}): Promise<SourceFilePlan>;
|
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
import type { Plugin, ViteDevServer } from 'vite';
|
|
2
|
+
import type { DesignDocument } from './dist-lib/types/document/contracts.js';
|
|
3
|
+
import type { SourceFilePlan } from './dist-lib/types/host/sourceFilePlan.js';
|
|
4
|
+
import type { InspectApplyResult, InspectPreviewResult } from './dist-lib/types/editor/host.js';
|
|
5
|
+
import type { WorkspaceTarget } from './dist-lib/types/workspace/contracts.js';
|
|
6
|
+
import type { WorkspaceFileSourceRequest, WorkspaceSourceBaseline, WorkspaceSourceReconcileInput, WorkspaceSourceReconcileResult } from './dist-lib/types/workspace/source/flowContracts.js';
|
|
7
|
+
import type { WorkspaceTokenLibraryBaseline, WorkspaceTokenSourceRequest } from './dist-lib/types/workspace/tokens/contracts.js';
|
|
8
|
+
import type { TokenLibraryDocument } from './dist-lib/types/token-library/contracts.js';
|
|
9
|
+
import type { SourceFilePlanOptions } from './source-files.js';
|
|
10
|
+
import type { WorkspaceSourcePlanService } from './workspace-source-plan.js';
|
|
11
|
+
|
|
12
|
+
export type SourceInputs = Readonly<Record<string, string | null>>;
|
|
13
|
+
export type SourceArchive = <T>(sourceRevision: string, signal: AbortSignal,
|
|
14
|
+
operation: (context: { appRoot: string; sourceRevision?: string; signal?: AbortSignal }) => Promise<T>) => Promise<T>;
|
|
15
|
+
export interface SourceInputOptions { optionalFiles?: readonly string[]; signal?: AbortSignal; maxBytes?: number }
|
|
16
|
+
export declare function assertSourceInputParent(root: string, file: string): Promise<void>;
|
|
17
|
+
export declare function readSourceInputs(appRoot: string, files: readonly string[], options?: SourceInputOptions): Promise<Record<string, string | null>>;
|
|
18
|
+
export declare function readProvenSourceFiles(appRoot: string, proofs: SourceFilePlan['proofs'], options?: SourceInputOptions): Promise<Map<string, { file: string; sha256: string | null; source: string | null }>>;
|
|
19
|
+
export declare function withSourceFiles<T>(options: { files: Map<string, string>; signal?: AbortSignal }, operation: (root: string) => Promise<T>): Promise<T>;
|
|
20
|
+
|
|
21
|
+
interface SourceWriters {
|
|
22
|
+
previewPlan?(root: string, plan: SourceFilePlan, options: SourceFilePlanOptions): Promise<Pick<InspectPreviewResult, 'files' | 'affectedFiles'>>;
|
|
23
|
+
applyPlan?(root: string, plan: SourceFilePlan, options: SourceFilePlanOptions): Promise<{ applied: number }>;
|
|
24
|
+
}
|
|
25
|
+
export interface WorkspaceSourceSessionOptions<Codec, Projection = unknown, Identity = unknown> extends SourceWriters {
|
|
26
|
+
appRoot: string;
|
|
27
|
+
allowedFiles: readonly string[];
|
|
28
|
+
overlayFiles?: readonly string[];
|
|
29
|
+
optionalFiles?: readonly string[];
|
|
30
|
+
inputFiles(codec: Codec): readonly string[];
|
|
31
|
+
loadCodec(): Promise<Codec>;
|
|
32
|
+
assertTarget(target: WorkspaceTarget, signal: AbortSignal): void | Promise<void>;
|
|
33
|
+
archive: SourceArchive;
|
|
34
|
+
currentRevision(): Promise<string>;
|
|
35
|
+
projectBaseline(input: { codec: Codec; target: WorkspaceTarget; sourceInputs: SourceInputs; projectedStructure?: Projection }, signal: AbortSignal): Promise<WorkspaceSourceBaseline>;
|
|
36
|
+
compilePlan(input: { appRoot: string; sourceRevision: string; before: DesignDocument; after: DesignDocument; mapping: WorkspaceSourceBaseline['mapping']; signal: AbortSignal; reconciledIdentity?: Identity }): Promise<SourceFilePlan>;
|
|
37
|
+
reconcile(input: WorkspaceSourceReconcileInput & {
|
|
38
|
+
baselineInputs: SourceInputs; externalInputs: SourceInputs; baselineIdentity?: Identity;
|
|
39
|
+
loadBaseline(input: { target: WorkspaceTarget; sourceInputs: SourceInputs; projectedStructure?: Projection }, signal: AbortSignal): Promise<WorkspaceSourceBaseline>;
|
|
40
|
+
}, signal: AbortSignal): Promise<WorkspaceSourceReconcileResult>;
|
|
41
|
+
projectReconcileInputs(input: { baselineInputs: SourceInputs; externalInputs: SourceInputs; baselineIdentity?: Identity }): { projectedStructure: Projection; identity: Identity };
|
|
42
|
+
applyMessage?: string;
|
|
43
|
+
}
|
|
44
|
+
export interface WorkspaceSourceSession extends WorkspaceSourcePlanService {
|
|
45
|
+
reconcile(input: WorkspaceSourceReconcileInput, signal?: AbortSignal): Promise<WorkspaceSourceReconcileResult>;
|
|
46
|
+
/** Validates the retained review before overlaying reconciled bytes into an isolated root. */
|
|
47
|
+
preparePreviewSource(input: WorkspaceFileSourceRequest, root: string, signal?: AbortSignal): Promise<void>;
|
|
48
|
+
}
|
|
49
|
+
export declare function createWorkspaceSourceSession<Codec, Projection = unknown, Identity = unknown>(options: WorkspaceSourceSessionOptions<Codec, Projection, Identity>): WorkspaceSourceSession;
|
|
50
|
+
|
|
51
|
+
export interface LoadedTokenSource<SourceFiles = unknown, Ledger = unknown> extends WorkspaceTokenLibraryBaseline {
|
|
52
|
+
sourceFiles: SourceFiles;
|
|
53
|
+
ledger: Ledger;
|
|
54
|
+
consumerFiles: readonly string[];
|
|
55
|
+
}
|
|
56
|
+
export interface TokenSourceServiceOptions<Codec, SourceFiles = unknown, Ledger = unknown> extends SourceWriters {
|
|
57
|
+
appRoot: string;
|
|
58
|
+
loadCodec(): Promise<Codec>;
|
|
59
|
+
assertRevision(sourceRevision: string, signal?: AbortSignal): void | Promise<void>;
|
|
60
|
+
assertTarget(target: WorkspaceTarget, signal: AbortSignal): void | Promise<void>;
|
|
61
|
+
archive: SourceArchive;
|
|
62
|
+
loadSource(input: { appRoot: string; sourceRevision: string; codec: Codec; signal: AbortSignal }): Promise<LoadedTokenSource<SourceFiles, Ledger>>;
|
|
63
|
+
compilePlan(input: { appRoot: string; sourceRevision: string; before: TokenLibraryDocument; after: TokenLibraryDocument; codec: Codec; signal: AbortSignal; dependenciesReady: true }): Promise<SourceFilePlan>;
|
|
64
|
+
listConsumers(appRoot: string, signal: AbortSignal): Promise<readonly string[]>;
|
|
65
|
+
currentRevision(): Promise<string>;
|
|
66
|
+
regenerate(signal: AbortSignal): Promise<unknown>;
|
|
67
|
+
install(root: string, signal: AbortSignal): Promise<unknown>;
|
|
68
|
+
applyMessage?: string;
|
|
69
|
+
regenerationFailureMessage?(error: unknown): string;
|
|
70
|
+
}
|
|
71
|
+
export interface TokenSourceService<SourceFiles = unknown, Ledger = unknown> {
|
|
72
|
+
load(sourceRevision: string, signal?: AbortSignal): Promise<WorkspaceTokenLibraryBaseline & { sourceFiles: SourceFiles; ledger: Ledger }>;
|
|
73
|
+
compile(input: { baseline: WorkspaceTokenLibraryBaseline; document: TokenLibraryDocument }, signal?: AbortSignal): Promise<SourceFilePlan>;
|
|
74
|
+
preview(request: WorkspaceTokenSourceRequest, signal?: AbortSignal): Promise<InspectPreviewResult>;
|
|
75
|
+
validatePreviewRequest(request: WorkspaceTokenSourceRequest, signal?: AbortSignal): Promise<WorkspaceTokenSourceRequest>;
|
|
76
|
+
apply(request: WorkspaceTokenSourceRequest, signal?: AbortSignal): Promise<InspectApplyResult>;
|
|
77
|
+
dispose(): void;
|
|
78
|
+
}
|
|
79
|
+
export declare function createTokenSourceService<Codec, SourceFiles = unknown, Ledger = unknown>(options: TokenSourceServiceOptions<Codec, SourceFiles, Ledger>): TokenSourceService<SourceFiles, Ledger>;
|
|
80
|
+
|
|
81
|
+
export declare function sourceServicePlugin<Service extends { dispose(): void | Promise<void> }>(options: {
|
|
82
|
+
name?: string;
|
|
83
|
+
endpoint: string;
|
|
84
|
+
operations: readonly (keyof Service & string)[];
|
|
85
|
+
createService(server: ViteDevServer): Service;
|
|
86
|
+
transformInput?(operation: keyof Service & string, input: unknown): unknown;
|
|
87
|
+
maxBytes?: number;
|
|
88
|
+
}): {
|
|
89
|
+
plugin: Plugin;
|
|
90
|
+
validatePreviewRequest: Service extends { validatePreviewRequest: infer Method } ? Method : never;
|
|
91
|
+
preparePreviewSource: Service extends { preparePreviewSource: infer Method } ? Method : never;
|
|
92
|
+
};
|
|
@@ -0,0 +1,155 @@
|
|
|
1
|
+
import type { SourceFilePlan } from './dist-lib/types/host/sourceFilePlan.js';
|
|
2
|
+
import type { WorkspaceStructureGroupLayout, WorkspaceStructureWrapperDeclaration } from './dist-lib/types/workspace/source/contracts.js';
|
|
3
|
+
|
|
4
|
+
export interface JsxStructureAnchor { nodeId: string; file: string; start: number; end: number; expected: string }
|
|
5
|
+
export type JsxStructureGroupLayout = WorkspaceStructureGroupLayout;
|
|
6
|
+
/**
|
|
7
|
+
* Host declaration for element wrappers. A group with a layout compiles to
|
|
8
|
+
* `<tagName className={styleAlias.<derived class>}>` plus one managed block in the
|
|
9
|
+
* stylesheet; spacing pairs document pixel values with the host's exact CSS spellings.
|
|
10
|
+
*/
|
|
11
|
+
export type JsxStructureWrapperContract = WorkspaceStructureWrapperDeclaration;
|
|
12
|
+
/** The contract and the complete stylesheet bytes matching the JSX source being read. */
|
|
13
|
+
export interface JsxStructureWrapperEvidence { contract: JsxStructureWrapperContract; source: string }
|
|
14
|
+
export type JsxStructureOperation =
|
|
15
|
+
| { kind: 'reorder'; parentId: string; children: readonly string[] }
|
|
16
|
+
/** Index addresses the final list after removing the node from its original parent. */
|
|
17
|
+
| { kind: 'reparent'; nodeId: string; parentId: string; index: number }
|
|
18
|
+
/** A layout requires the plan's wrapper contract; without one the group is an anonymous fragment. */
|
|
19
|
+
| { kind: 'group'; nodeIds: readonly string[]; groupId: string; layout?: JsxStructureGroupLayout }
|
|
20
|
+
/** Removes an anonymous fragment or a generated wrapper element together with its managed block. */
|
|
21
|
+
| { kind: 'ungroup'; nodeId: string };
|
|
22
|
+
export interface JsxStructureDiagnostic { code: string; message: string; file?: string; nodeId?: string }
|
|
23
|
+
export interface JsxStructureSourceNode {
|
|
24
|
+
nodeId: string; parentId: string | null; children: string[];
|
|
25
|
+
kind: 'element' | 'expression' | 'fragment' | 'text';
|
|
26
|
+
tagName?: string;
|
|
27
|
+
/** Only a static string literal is reported; bindings and CSS module expressions are not evaluated. */
|
|
28
|
+
className?: string;
|
|
29
|
+
/** Present only for a generated wrapper element proved against its managed stylesheet block. */
|
|
30
|
+
layout?: JsxStructureGroupLayout;
|
|
31
|
+
wrapper?: { className: string };
|
|
32
|
+
runtimePath: number[]; start: number; end: number;
|
|
33
|
+
}
|
|
34
|
+
/** Persist alongside the source in the same reviewed file plan; offsets are UTF-16 source positions. */
|
|
35
|
+
export interface JsxStructureIdentity {
|
|
36
|
+
version: 1;
|
|
37
|
+
file: string;
|
|
38
|
+
sourceSha256: string;
|
|
39
|
+
rootId: string;
|
|
40
|
+
opaqueNodeIds: string[];
|
|
41
|
+
anchors: { nodeId: string; start: number; end: number }[];
|
|
42
|
+
/** Generated wrapper groups; absent when the island has none. */
|
|
43
|
+
wrappers?: { nodeId: string; className: string }[];
|
|
44
|
+
}
|
|
45
|
+
/** Checks the supplied anchor snippets and full AST projection before returning serializable evidence. */
|
|
46
|
+
export declare function createJsxStructureIdentity(input: {
|
|
47
|
+
file: string; source: string; rootId: string; anchors: readonly JsxStructureAnchor[]; opaqueNodeIds?: readonly string[];
|
|
48
|
+
/** Required to record wrapper groups; the stylesheet must be the bytes reviewed with this source. */
|
|
49
|
+
wrapper?: JsxStructureWrapperEvidence;
|
|
50
|
+
}): JsxStructureIdentity;
|
|
51
|
+
/**
|
|
52
|
+
* Throws on stale bytes, malformed identity, missing nodes or ambiguous ranges. Never guesses IDs.
|
|
53
|
+
* Recorded wrappers require the wrapper evidence; a wrapper whose element or managed block was
|
|
54
|
+
* edited by hand fails closed instead of degrading to a plain element.
|
|
55
|
+
*/
|
|
56
|
+
export declare function reimportJsxStructureSource(input: {
|
|
57
|
+
file: string; source: string; identity: JsxStructureIdentity; wrapper?: JsxStructureWrapperEvidence;
|
|
58
|
+
}): { anchors: JsxStructureAnchor[]; nodes: JsxStructureSourceNode[] };
|
|
59
|
+
/**
|
|
60
|
+
* Throws for invalid source, ambiguous roots, or opaque offsets outside the projected tree.
|
|
61
|
+
* Runtime paths exclude blank multiline indentation and comment-only expressions. Expressions
|
|
62
|
+
* that evaluate to false or undefined still occupy one slot; their values are never evaluated.
|
|
63
|
+
*/
|
|
64
|
+
export declare function inspectJsxStructureSource(input: {
|
|
65
|
+
file: string; source: string; rootStart: number; opaqueNodeStarts?: readonly number[];
|
|
66
|
+
}): { anchors: JsxStructureAnchor[]; nodes: JsxStructureSourceNode[] };
|
|
67
|
+
/**
|
|
68
|
+
* Pure source compilation; the host audits allowed containers and the complete canonical-document delta.
|
|
69
|
+
* Expressions move only as complete opaque chunks within one static JSX tree. Rendered text and
|
|
70
|
+
* standalone comments in an edited parent block ambiguous hierarchy changes. Groups without a layout
|
|
71
|
+
* are anonymous fragments, which do not provide a DOM box. With a wrapper contract, a group with a
|
|
72
|
+
* layout emits one intrinsic element and a managed block in the contract stylesheet, which must be
|
|
73
|
+
* supplied in `files` and allowed for writing. Neither form certifies preservation of component
|
|
74
|
+
* reconciliation state across a React remount. Props, handlers, and expression source are preserved
|
|
75
|
+
* without evaluation or fixture substitution.
|
|
76
|
+
*/
|
|
77
|
+
export declare function compileJsxStructurePlan(input: {
|
|
78
|
+
sourceRevision: string;
|
|
79
|
+
files: readonly { file: string; source: string; sha256: string }[];
|
|
80
|
+
anchors: readonly JsxStructureAnchor[];
|
|
81
|
+
operations: readonly JsxStructureOperation[];
|
|
82
|
+
allowedFiles: readonly string[];
|
|
83
|
+
excludedSourcePrefixes?: readonly string[];
|
|
84
|
+
wrapper?: JsxStructureWrapperContract;
|
|
85
|
+
}): { status: 'ready'; payload: SourceFilePlan; anchors: JsxStructureAnchor[] }
|
|
86
|
+
| { status: 'unchanged'; anchors: JsxStructureAnchor[] }
|
|
87
|
+
| { status: 'blocked'; diagnostics: JsxStructureDiagnostic[] };
|
|
88
|
+
|
|
89
|
+
export interface JsxStructureReconciliationInput {
|
|
90
|
+
file: string;
|
|
91
|
+
baseline: { sourceRevision: string; source: string; identity: JsxStructureIdentity };
|
|
92
|
+
external: {
|
|
93
|
+
/** May equal the baseline commit for explicitly checked working-copy changes. */
|
|
94
|
+
sourceRevision: string;
|
|
95
|
+
source: string;
|
|
96
|
+
sha256: string;
|
|
97
|
+
/**
|
|
98
|
+
* Complete host-supplied correspondence to the current AST. Retained IDs explicitly mean
|
|
99
|
+
* the same source-owned nodes; new IDs must be fresh. Core never infers this mapping from
|
|
100
|
+
* names, positions, snippets, runtime values, or example data. Every range and hash is checked.
|
|
101
|
+
*/
|
|
102
|
+
identity: JsxStructureIdentity;
|
|
103
|
+
};
|
|
104
|
+
/** Complete audited draft structure relative to baseline; the host checks other document deltas. */
|
|
105
|
+
operations: readonly JsxStructureOperation[];
|
|
106
|
+
allowedFiles: readonly string[];
|
|
107
|
+
excludedSourcePrefixes?: readonly string[];
|
|
108
|
+
/** Required when either identity records wrapper groups or the draft adds one. */
|
|
109
|
+
wrapper?: {
|
|
110
|
+
contract: JsxStructureWrapperContract;
|
|
111
|
+
baselineSource: string;
|
|
112
|
+
externalSource: string;
|
|
113
|
+
externalSha256: string;
|
|
114
|
+
};
|
|
115
|
+
}
|
|
116
|
+
export interface JsxStructureReconciliationShape {
|
|
117
|
+
kind: JsxStructureSourceNode['kind'];
|
|
118
|
+
parentId: string | null;
|
|
119
|
+
children: string[];
|
|
120
|
+
layout: JsxStructureGroupLayout | null;
|
|
121
|
+
}
|
|
122
|
+
export interface JsxStructureReconciliationDiagnostic extends JsxStructureDiagnostic {
|
|
123
|
+
action: 'refresh-source' | 'map-identities' | 'resolve-overlap';
|
|
124
|
+
baseline?: JsxStructureReconciliationShape | null;
|
|
125
|
+
external?: JsxStructureReconciliationShape | null;
|
|
126
|
+
draft?: JsxStructureReconciliationShape | null;
|
|
127
|
+
}
|
|
128
|
+
export interface ReconciledJsxStructureSource {
|
|
129
|
+
file: string;
|
|
130
|
+
baselineSourceRevision: string;
|
|
131
|
+
baselineSourceSha256: string;
|
|
132
|
+
/** The external revision is retained; the baseline is never silently relabeled. */
|
|
133
|
+
sourceRevision: string;
|
|
134
|
+
externalSourceSha256: string;
|
|
135
|
+
source: string;
|
|
136
|
+
/** Persist with the resulting source using a separately reviewed, exact file plan. */
|
|
137
|
+
identity: JsxStructureIdentity;
|
|
138
|
+
/** The contract stylesheet after the merge; present only when wrapper input was supplied. */
|
|
139
|
+
stylesheetSource?: string;
|
|
140
|
+
anchors: JsxStructureAnchor[];
|
|
141
|
+
nodes: JsxStructureSourceNode[];
|
|
142
|
+
diagnostics: readonly [];
|
|
143
|
+
}
|
|
144
|
+
export type JsxStructureReconciliationResult =
|
|
145
|
+
| (ReconciledJsxStructureSource & { status: 'ready'; payload: SourceFilePlan })
|
|
146
|
+
| (ReconciledJsxStructureSource & { status: 'unchanged' })
|
|
147
|
+
| { status: 'conflict'; diagnostics: readonly JsxStructureReconciliationDiagnostic[] };
|
|
148
|
+
/**
|
|
149
|
+
* Pure, explicit three-way reconciliation. Disjoint child-list changes merge; overlapping lists,
|
|
150
|
+
* removals, incompatible boundaries, competing wrapper layouts and ambiguous identities require
|
|
151
|
+
* explicit conflict resolution. External props and expression bytes survive structure-only edits.
|
|
152
|
+
* Host source ownership and document/binding validation still apply. A ready plan proves the
|
|
153
|
+
* latest external bytes only.
|
|
154
|
+
*/
|
|
155
|
+
export declare function reconcileJsxStructurePlan(input: JsxStructureReconciliationInput): JsxStructureReconciliationResult;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import type { WorkspaceDraftRecipe } from './dist-lib/types/workspace/source/draftRecipe.js';
|
|
2
|
+
|
|
3
|
+
/** Trusted build-time declarations for the mounted application's browser entry. */
|
|
4
|
+
export interface WorkspaceDraftEntryOptions {
|
|
5
|
+
documentRevision: string;
|
|
6
|
+
recipe: WorkspaceDraftRecipe;
|
|
7
|
+
/** Module resolving the SDK recipe runner. Defaults to the public package. */
|
|
8
|
+
sdkModule?: string;
|
|
9
|
+
/** An application module exporting its desired-state adapter. */
|
|
10
|
+
desiredStateAdapter?: { module: string; exportName: string };
|
|
11
|
+
failureMessage?: string;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
/** Returns ESM source for a virtual build entry; the application supplies its own bundler and boot setup. */
|
|
15
|
+
export declare function createWorkspaceDraftEntry(options: WorkspaceDraftEntryOptions): string;
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import type { DesignDocument } from './dist-lib/types/document/contracts.js';
|
|
2
|
+
import type { SourceFilePlan } from './dist-lib/types/host/sourceFilePlan.js';
|
|
3
|
+
import type { InspectApplyResult, InspectPreviewResult } from './dist-lib/types/editor/host.js';
|
|
4
|
+
import type { WorkspaceTarget } from './dist-lib/types/workspace/contracts.js';
|
|
5
|
+
import type { WorkspaceFileSourceRequest, WorkspaceSourceBaseline } from './dist-lib/types/workspace/source/flowContracts.js';
|
|
6
|
+
|
|
7
|
+
export interface WorkspaceSourcePlanCompileInput {
|
|
8
|
+
target: WorkspaceTarget;
|
|
9
|
+
baseline: WorkspaceSourceBaseline;
|
|
10
|
+
document: DesignDocument;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
export interface WorkspaceSourcePlanServiceOptions {
|
|
14
|
+
/** Callbacks receive detached, deeply frozen JSON captures and must settle on cancellation. */
|
|
15
|
+
loadBaseline(target: WorkspaceTarget, signal: AbortSignal): Promise<WorkspaceSourceBaseline>;
|
|
16
|
+
/** Owns full document validation and the source semantics of every changed field. */
|
|
17
|
+
compilePlan(input: WorkspaceSourcePlanCompileInput, signal: AbortSignal): Promise<SourceFilePlan>;
|
|
18
|
+
/** Must check current file proofs; the service checks complete, nonempty diff coverage. */
|
|
19
|
+
previewPlan(plan: SourceFilePlan, target: WorkspaceTarget, signal: AbortSignal): Promise<Pick<InspectPreviewResult, 'files' | 'affectedFiles'> & Partial<Pick<InspectPreviewResult, 'qa'>>>;
|
|
20
|
+
/** Must recheck current source revision and proofs and apply the complete plan atomically. */
|
|
21
|
+
applyPlan(plan: SourceFilePlan, target: WorkspaceTarget, signal: AbortSignal): Promise<InspectApplyResult>;
|
|
22
|
+
assertTarget(target: WorkspaceTarget, signal: AbortSignal): void | Promise<void>;
|
|
23
|
+
/** Default and maximum: 30 minutes. Review never extends this lifetime. */
|
|
24
|
+
receiptTtlMs?: number;
|
|
25
|
+
/** Default and maximum: 8 compiled document receipts. */
|
|
26
|
+
maxReceipts?: number;
|
|
27
|
+
now?: () => number;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
export interface WorkspaceSourcePlanService {
|
|
31
|
+
/** Loads may run concurrently; every other operation is mutually exclusive. */
|
|
32
|
+
load(target: WorkspaceTarget, signal?: AbortSignal): Promise<WorkspaceSourceBaseline>;
|
|
33
|
+
/** Reloads and compares the complete baseline before issuing a bounded server receipt. */
|
|
34
|
+
compile(input: WorkspaceSourcePlanCompileInput, signal?: AbortSignal): Promise<SourceFilePlan>;
|
|
35
|
+
preview(request: WorkspaceFileSourceRequest, signal?: AbortSignal): Promise<InspectPreviewResult>;
|
|
36
|
+
/** A writer attempt consumes all receipts. Cancellation does not establish rollback. */
|
|
37
|
+
apply(request: WorkspaceFileSourceRequest, signal?: AbortSignal): Promise<InspectApplyResult>;
|
|
38
|
+
/** Required before preparing an immutable built artifact from a browser-supplied file plan. */
|
|
39
|
+
validatePreviewRequest(request: WorkspaceFileSourceRequest, signal?: AbortSignal): Promise<WorkspaceFileSourceRequest>;
|
|
40
|
+
/** Aborts in-flight callbacks, clears receipts, and rejects their later completions. */
|
|
41
|
+
dispose(): void;
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
export declare function createWorkspaceSourcePlanService(options: WorkspaceSourcePlanServiceOptions): WorkspaceSourcePlanService;
|