@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,50 @@
|
|
|
1
|
+
import type { InspectApplyPayload } from '../editor/inspect.js';
|
|
2
|
+
import type { InspectApplyResult, InspectPreviewResult } from '../editor/host.js';
|
|
3
|
+
export type SourceWriteErrorCode = 'invalid-path' | 'empty-change' | 'excluded-source' | 'empty-diff' | 'unexpected-file' | 'missing-file' | 'review-required' | 'stale-preview' | 'busy' | 'not-applied';
|
|
4
|
+
export declare class SourceWriteError extends Error {
|
|
5
|
+
readonly code: SourceWriteErrorCode;
|
|
6
|
+
readonly path?: string;
|
|
7
|
+
constructor(code: SourceWriteErrorCode, message: string, path?: string);
|
|
8
|
+
}
|
|
9
|
+
export interface SourceWritePolicy {
|
|
10
|
+
/** Repository-owned recovery outputs that must never count as source changes. */
|
|
11
|
+
excludedSourcePrefixes?: readonly string[];
|
|
12
|
+
requireBranch?: boolean;
|
|
13
|
+
/** Optional workspace identity; a change invalidates a reviewed payload. */
|
|
14
|
+
scope?: () => string;
|
|
15
|
+
}
|
|
16
|
+
export interface InspectSourceRuntime {
|
|
17
|
+
previewVisual(payload: InspectApplyPayload): Promise<InspectPreviewResult>;
|
|
18
|
+
applyVisual(payload: InspectApplyPayload): Promise<InspectApplyResult>;
|
|
19
|
+
}
|
|
20
|
+
/** Payloads must be JSON-serializable. Each runtime call receives an independent snapshot. */
|
|
21
|
+
export interface ReviewedSourceOperationRuntime<TPayload> {
|
|
22
|
+
preview(payload: TPayload): Promise<InspectPreviewResult>;
|
|
23
|
+
apply(payload: TPayload): Promise<InspectApplyResult>;
|
|
24
|
+
}
|
|
25
|
+
export interface ReviewedSourceOperationFiles {
|
|
26
|
+
/** Existing inputs whose paths must satisfy the source policy, including read-only dependencies. */
|
|
27
|
+
proofFiles: readonly string[];
|
|
28
|
+
/** The only files this operation may change, including newly created files. */
|
|
29
|
+
changedFiles: readonly string[];
|
|
30
|
+
}
|
|
31
|
+
export interface ReviewedSourceOperationPolicy<TPayload> extends SourceWritePolicy {
|
|
32
|
+
/** A synchronous, side-effect-free declaration for the captured payload. */
|
|
33
|
+
files(payload: TPayload): ReviewedSourceOperationFiles;
|
|
34
|
+
/** Additional payload validation, run before preview and apply. */
|
|
35
|
+
validate?(payload: TPayload): void;
|
|
36
|
+
/** Require each changed file exactly once in both diffs and affectedFiles. Defaults to false. */
|
|
37
|
+
requireCompletePreview?: boolean;
|
|
38
|
+
}
|
|
39
|
+
export declare function inspectPayloadSourceFiles(payload: InspectApplyPayload): string[];
|
|
40
|
+
export declare function assertInspectSourcePayload(payload: InspectApplyPayload, policy?: SourceWritePolicy): void;
|
|
41
|
+
/** Review tickets are single-use and survive neither a new preview nor a workspace change. */
|
|
42
|
+
export declare function createReviewedSourceOperation<TPayload>(runtime: ReviewedSourceOperationRuntime<TPayload>, policy: ReviewedSourceOperationPolicy<TPayload>): {
|
|
43
|
+
preview: (payload: TPayload) => Promise<InspectPreviewResult>;
|
|
44
|
+
apply: (payload: TPayload) => Promise<InspectApplyResult>;
|
|
45
|
+
};
|
|
46
|
+
/** Compatibility adapter for visual Inspect payloads; unchanged files may be omitted from a preview. */
|
|
47
|
+
export declare function createReviewedSourceWriter(runtime: InspectSourceRuntime, policy?: SourceWritePolicy): {
|
|
48
|
+
preview: (payload: InspectApplyPayload) => Promise<InspectPreviewResult>;
|
|
49
|
+
apply: (payload: InspectApplyPayload) => Promise<InspectApplyResult>;
|
|
50
|
+
};
|
package/dist-lib/types/lib.d.ts
CHANGED
|
@@ -1,3 +1,74 @@
|
|
|
1
|
+
export * from './document/components.js';
|
|
2
|
+
export * from './token-library/bindings.js';
|
|
3
|
+
export { STYLE_KINDS, STYLE_SLOTS, STYLE_SLOT_KIND, STYLE_KIND_LABEL, STYLE_SLOT_LABEL, TEXT_STYLE_CHARACTER_KEYS, TEXT_STYLE_PARAGRAPH_KEYS, TEXT_STYLE_KEYS, StyleError, isStylePaint, isTextStyleValue, isStyleEffect, isStyleValue, isDesignStyle, isStylesMetadata, isStyleReferences, validateStyleLibrary, EMPTY_STYLES, documentStyles, documentStyle, documentStylesOfKind, nodeStyleReferences, styleSlotsFor, documentStyleDiagnostics, createStyle, renameStyle, describeStyle, setStyleValue, removeStyle, detachStyleFromLibrary, projectStyle, detachStyleReference, styleValueFromNode, styleConsumers, propagateStyle, applyStylePropagation, writeStyles, applyStylePatch, detachStylePatch, commitCreateStyle, commitStyleValue, commitRenameStyle, commitRemoveStyle, commitApplyStyle, commitDetachStyle, commitStyleFromNode, importLibraryStyle, planStyleLibraryUpdate, commitStyleLibraryUpdate, stylesDuplicateRemapper, STYLES_METADATA_KEY, STYLE_SIDECAR_PROPERTY_KEYS, stylesSourceDiagnostics } from './document/styles.js';
|
|
4
|
+
export type { StyleKind, StyleSlot, StylePaint, PaintStyleValue, TextStyleValue, StyleEffect, EffectStyleValue, GridStyleValue, StyleValue, StyleValueByKind, StyleOrigin, DesignStyle, StylesMetadata, StyleLibraryDocument, StyleReferences, StyleConsumer, StylePropagation, StyleLibraryChange, StyleLibraryUpdatePlan } from './document/styles.js';
|
|
5
|
+
export { componentOverrideTarget, remapComponentOverrideAddress } from './document/engine.js';
|
|
6
|
+
export { ComponentPanel } from './workspace/edit/ComponentPanel.js';
|
|
7
|
+
export type { ComponentPanelProps } from './workspace/edit/ComponentPanel.js';
|
|
8
|
+
export { StylesPanel } from './workspace/edit/StylesPanel.js';
|
|
9
|
+
export type { StylesPanelProps } from './workspace/edit/StylesPanel.js';
|
|
10
|
+
export { TokenLibraryProvider, useTokenLibraryController, useHasTokenLibraryProvider } from './workspace/tokens/TokenLibraryContext.js';
|
|
11
|
+
export { createTokenLibraryEngine, reopenTokenLibrary, validateTokenLibraryDocument, resolveTokenLibraryValue, tokenValueEditability, TokenLibraryValidationError } from './token-library/engine.js';
|
|
12
|
+
export type * from './token-library/contracts.js';
|
|
13
|
+
export { createTokenValueResolver } from './token-library/valueResolver.js';
|
|
14
|
+
export type { TokenValueReferenceRange, TokenValueResolverOptions, ResolvedTokenText } from './token-library/valueResolver.js';
|
|
15
|
+
export type * from './workspace/tokens/contracts.js';
|
|
16
|
+
export { WorkspaceTokenLibraryController } from './workspace/tokens/controller.js';
|
|
17
|
+
export type { WorkspaceTokenLibraryState } from './workspace/tokens/controller.js';
|
|
18
|
+
export { createReviewedSourceOperation } from './host/sourceWriteback.js';
|
|
19
|
+
export type { ReviewedSourceOperationRuntime, ReviewedSourceOperationPolicy, ReviewedSourceOperationFiles } from './host/sourceWriteback.js';
|
|
20
|
+
export type { SourceFilePlan } from './host/sourceFilePlan.js';
|
|
21
|
+
export type { WorkspaceDraftPreviewClient } from './workspace/source/draftPreviewClient.js';
|
|
22
|
+
import { type PygmalionHostProject } from './host/project.js';
|
|
23
|
+
export { createPygmalionHostProject, createPygmalionRevisionCatalog, PYGMALION_HOST_PROJECT_VERSION, } from './host/project.js';
|
|
24
|
+
export type { PygmalionHostProject, PygmalionHostProjectDefinition, PygmalionHostStoryboard, PygmalionHostDesign, } from './host/project.js';
|
|
25
|
+
export { createDesignRegistryConnections } from './host/registryConnections.js';
|
|
26
|
+
export type { DesignRegistryInventoryEntry } from './host/registryConnections.js';
|
|
27
|
+
export { createReviewedSourceWriter, assertInspectSourcePayload, inspectPayloadSourceFiles, SourceWriteError, } from './host/sourceWriteback.js';
|
|
28
|
+
export type { InspectSourceRuntime, SourceWritePolicy, SourceWriteErrorCode } from './host/sourceWriteback.js';
|
|
29
|
+
export { WorkspaceController } from './workspace/controller.js';
|
|
30
|
+
export { createLegacyModeAdapter } from './workspace/legacyModeAdapter.js';
|
|
31
|
+
export type * from './workspace/contracts.js';
|
|
32
|
+
export { createWorkspaceTargetResolver, resolveWorkspaceTarget } from './workspace/configuration.js';
|
|
33
|
+
export type { WorkspaceConfiguration, WorkspaceTargetConfiguration, WorkspaceTargetResolverOptions } from './workspace/configuration.js';
|
|
34
|
+
export { compileWorkspaceVisualSource, workspaceSourceFingerprint } from './workspace/source/compiler.js';
|
|
35
|
+
export { compileWorkspaceDocumentSource, jsxStructureWrapperClassName } from './workspace/source/structure.js';
|
|
36
|
+
export { compileWorkspaceResponsiveSource, resolveResponsiveLayout, setResponsiveLayoutOverride } from './workspace/source/responsive.js';
|
|
37
|
+
export { describeResponsiveValueContract, responsiveRangePreviewWidth, sortResponsiveRanges } from './workspace/source/responsive.js';
|
|
38
|
+
export { useWorkspaceResponsiveViewport } from './workspace/source/ResponsiveLayoutPanel.js';
|
|
39
|
+
export type * from './workspace/source/responsiveContracts.js';
|
|
40
|
+
export type { WorkspaceDocumentSourceChanges } from './workspace/source/structure.js';
|
|
41
|
+
export { WorkspaceSourceReviewController } from './workspace/source/controller.js';
|
|
42
|
+
export { createWorkspaceDraftPreviewClient } from './workspace/source/draftPreviewClient.js';
|
|
43
|
+
export { runWorkspaceDraftRecipe, WorkspaceDraftRecipeError } from './workspace/source/draftRecipe.js';
|
|
44
|
+
export type { WorkspaceDraftDocumentContext, WorkspaceDraftRecipe, WorkspaceDraftRecipeOptions, WorkspaceDraftRecipeReport } from './workspace/source/draftRecipe.js';
|
|
45
|
+
export type * from './workspace/source/contracts.js';
|
|
46
|
+
export type * from './workspace/source/flowContracts.js';
|
|
47
|
+
export type { WorkspaceSourceReviewState } from './workspace/source/controller.js';
|
|
48
|
+
export * from './binding/index.js';
|
|
49
|
+
export { planScopeTransfer, resolveScopeTransfer, applyScopeTransfer } from './workspace/edit/scopeTransfer.js';
|
|
50
|
+
export type { ScopeTransferPlan, ScopeTransferDecisionPlan, ScopeTransferItem, ScopeTransferChoice, ScopeTransferDecision, ScopeTransferOptions, ResolvedScopeTransfer } from './workspace/edit/scopeTransfer.js';
|
|
51
|
+
export { planDocumentLayerMove, applyDocumentLayerMove, normalizeDocumentLayerSelection } from './workspace/edit/layerMoves.js';
|
|
52
|
+
export type { DocumentLayerMoveRequest, DocumentLayerMovePlan, DocumentLayerMoveOperation, ReadyDocumentLayerMove } from './workspace/edit/layerMoves.js';
|
|
53
|
+
export { TEXT_CHARACTER_KEYS, TEXT_PARAGRAPH_KEYS, TEXT_RESIZE_MODES, RICH_TEXT_CASES, RICH_TEXT_LISTS, RICH_TEXT_ALIGNMENTS, TEXT_PARAGRAPH_PROPERTY, TEXT_NODE_PROPERTY_KEYS, isTextLink, isTextResizeMode, isRichTextCharacterValue, isRichTextParagraphValue, isRichTextCharacterStyle, isRichTextParagraphStyle, isRichTextRun, isRichTextParagraph, isRichText, richTextPlain, richTextLength, richTextFromPlain, normalizeRichText, applyRichTextCharacterStyle, clearRichTextCharacterStyle, setRichTextParagraphStyle, clearRichTextParagraphStyle, richTextInheritedStyle, insertRichText, deleteRichText, replaceRichText, splitRichTextParagraph, mergeRichTextParagraphs, applyPlainTextEdit, richTextCharacterStyleAt, richTextParagraphStyleAt, richTextVaryingKeys, textNodeStyle, textResizeMode, textNodePlain, textNodeModel, isRichTextTrivial, hoistRichTextStyle, richTextValue, normalizeTextProperties, plainTextProperties, textFontRequirements, documentFontRequirements, textNodeFontRequirements, loadTextFonts, loadDocumentFonts, fontFaceSetLoader, } from './document/richText.js';
|
|
54
|
+
export type * from './document/richText.js';
|
|
55
|
+
export { VECTOR_SHAPES, VECTOR_BOOLEAN_OPERATIONS, VECTOR_FLATNESS, VECTOR_MERGE_DISTANCE, VECTOR_SIDE_SAMPLE, isVectorProperties, parseVector, serializeVector, vectorPathAnchors, vectorPathFromAnchors, vectorPathSegments, vectorBounds, transformVector, translateVector, vectorFitTransform, normalizeVectorOrigin, fitVectorNode, rectangleVector, ellipseVector, arcVector, lineVector, polygonVector, starVector, createShapeVector, roundVectorCorners, vectorPathData, vectorAnchorMode, moveVectorAnchor, moveVectorHandle, setVectorAnchorMode, insertVectorAnchor, deleteVectorAnchor, canSplitVectorPath, splitVectorPath, canJoinVectorPaths, joinVectorPaths, nearestVectorSegmentPoint, flattenVector, vectorContainsPoint, vectorArea, booleanRings, booleanVectors, booleanVectorPrecision, vectorRenderTransform, } from './document/vector.js';
|
|
56
|
+
export type * from './document/vector.js';
|
|
57
|
+
export { VectorEditor, VectorInspector, VectorNodeSurface, useVectorEditing } from './workspace/edit/VectorEditor.js';
|
|
58
|
+
export type { VectorEditing, VectorEditingInput, VectorEditingSession, VectorEditorProps, VectorGeometryPreview } from './workspace/edit/VectorEditor.js';
|
|
59
|
+
export { VectorToolbar } from './workspace/edit/VectorToolbar.js';
|
|
60
|
+
export { VECTOR_TOOLS, VECTOR_SHAPE_LABELS, VECTOR_BOOLEAN_LABELS, VECTOR_DEFAULT_FILL, VECTOR_DEFAULT_STROKE, VECTOR_NO_ANCHOR_ACTIONS, vectorNodeGeometry, vectorBoxGeometry, vectorRenderModel, vectorGeometryPatch, vectorStylePatch, renderedWorldTransform, vectorInsertParent, shapeInsertion, penClosesOnFirst, penPathNode, penDragAnchor, vectorAnchorsInBox, planVectorEdit, vectorAnchorActions, applyVectorAnchorAction, planVectorBoolean, vectorBooleanNode, vectorBooleanPrecision, applyVectorBoolean, vectorMaskClips, } from './workspace/edit/vectorTools.js';
|
|
61
|
+
export type { VectorTool, VectorAnchorAction, VectorStyle, VectorRenderModel, VectorEditTarget, VectorEditPlan, VectorAnchorActions, VectorAnchorActionResult, VectorBooleanPlan, VectorInsertion } from './workspace/edit/vectorTools.js';
|
|
62
|
+
export { richTextSourceDiagnostics, richTextSourceProjection, TEXT_SOURCE_MAPPED_PROPERTIES } from './workspace/source/textSource.js';
|
|
63
|
+
export type { RichTextSourceProjection } from './workspace/source/textSource.js';
|
|
64
|
+
export { TextEditor, TextInlineEditor, TextNodeSurface, useTextFontStatus } from './workspace/edit/TextEditor.js';
|
|
65
|
+
export type { TextEditorProps, TextInlineEditorProps } from './workspace/edit/TextEditor.js';
|
|
66
|
+
export { applyTextCharacterStyle, applyTextParagraphStyle, characterStyleCss, commitTextEdit, decorationCss, isBoundTextNode, paragraphStyleCss, richTextBlocks, setTextResize, textEditorModel, textResizeCss, textStyleTarget, textStyleValues, TEXT_ALIGN_OPTIONS, TEXT_CASE_OPTIONS, TEXT_FONT_WEIGHT_OPTIONS, TEXT_INDENT_STEP, TEXT_LIST_OPTIONS, TEXT_RESIZE_OPTIONS, } from './workspace/edit/textStyles.js';
|
|
67
|
+
export type { TextBlock, TextStyleTarget, TextStyleValues } from './workspace/edit/textStyles.js';
|
|
68
|
+
export * from './document/contracts.js';
|
|
69
|
+
export * from './document/geometry.js';
|
|
70
|
+
export { createDesignDocument, createDocumentNode, createDocumentEngine, reopenDesignDocument, resolveDocumentNode, projectDesignDocument, validateDesignDocument, DocumentValidationError, } from './document/engine.js';
|
|
71
|
+
import type { WorkspaceConfiguration } from './workspace/configuration.js';
|
|
1
72
|
import type { DesignImportController, DesignImportInitialPage, DesignScenarioSource } from './editor/designImport.js';
|
|
2
73
|
import type { ComponentRegistry } from './editor/registry.js';
|
|
3
74
|
import type { DesignComponentConnectionDef } from './editor/componentConnections.js';
|
|
@@ -80,7 +151,7 @@ export { createStoryboardRouteScenarioId, createStoryboardGraphFromDiscovery, ge
|
|
|
80
151
|
export type { LoadStoryboardDiscoveryOptions, StoryboardDiscoveryCandidate, StoryboardDiscoveryEdge, StoryboardDiscoveryGraphOptions, StoryboardDiscoveryManifest, StoryboardDiscoveryResult, StoryboardDiscoveryRoute, StoryboardDiscoveryScenario, StoryboardResolvedPage, } from './editor/storyboardDiscovery.js';
|
|
81
152
|
export { createStoryboardGraphViewModel } from './editor/storyboardGraphView.js';
|
|
82
153
|
export type { StoryboardFrameReference, StoryboardGraphCanonicalView, StoryboardGraphFrameView, StoryboardGraphSourceView, StoryboardGraphTransitionView, StoryboardGraphViewModel, } from './editor/storyboardGraphView.js';
|
|
83
|
-
export { createStoryboardRouteUrl, mergeStoryboardEnvironment, STORYBOARD_ENVIRONMENT_CONTROL, STORYBOARD_ENVIRONMENT_QUERY, } from './editor/storyboardEnvironment.js';
|
|
154
|
+
export { createStoryboardRouteUrl, mergeStoryboardEnvironment, resolveStoryboardBootEnvironment, STORYBOARD_ENVIRONMENT_CONTROL, STORYBOARD_ENVIRONMENT_QUERY, } from './editor/storyboardEnvironment.js';
|
|
84
155
|
export type { ApplyPayload, DesignChangePayload, DesignChangeResult, DesignCodeDocument, DesignElementChange, DesignElementDocument, DesignTokenDocument, InspectApplyResult, InspectImpactFrame, InspectImpactResult, InspectPreviewResult, } from './editor/host.js';
|
|
85
156
|
export type { InspectApplyPayload, PrimitiveSourceValue, PrimitiveSourceValueType, SourceAffectedFrame, SourceEditOperation, SourceEditScope, SourceIdentity, SourceInsertComponent, } from './editor/inspect.js';
|
|
86
157
|
export type { InspectQaArtifactHash, InspectQaCaptureRequest, InspectQaFailure, InspectQaFrameResult, InspectQaPixelDiff, InspectQaPixelDimensions, InspectQaResult, } from './editor/visualQa.js';
|
|
@@ -103,7 +174,9 @@ export type { SharedSourceEditScope, SharedSourceFrameSummary, SharedSourceImpac
|
|
|
103
174
|
export type { NodeJSON } from './editor/store.js';
|
|
104
175
|
export interface InitialPageDef extends DesignImportInitialPage {
|
|
105
176
|
}
|
|
106
|
-
export
|
|
177
|
+
export interface PygmalionEditorProps {
|
|
178
|
+
/** Host-owned inventory, storyboard, reproduction and design bindings. */
|
|
179
|
+
project?: PygmalionHostProject;
|
|
107
180
|
/**
|
|
108
181
|
* The runtime this editor renders. Create one with `createEditorRuntime()`
|
|
109
182
|
* and keep it for the editor's lifetime; two editors on one page each take
|
|
@@ -129,6 +202,8 @@ export declare function PygmalionEditor({ runtime, registry, tokens, initialPage
|
|
|
129
202
|
* once rather than re-asserting over whatever the designer picked.
|
|
130
203
|
*/
|
|
131
204
|
initialEditMode?: 'edit' | 'view-only';
|
|
205
|
+
/** The redesigned workspaces use a canonical document and separate run state. */
|
|
206
|
+
workspace?: WorkspaceConfiguration;
|
|
132
207
|
/** Explicit external-design to registered-code component mappings. */
|
|
133
208
|
componentConnections?: readonly DesignComponentConnectionDef[];
|
|
134
209
|
/**
|
|
@@ -323,4 +398,29 @@ export declare function PygmalionEditor({ runtime, registry, tokens, initialPage
|
|
|
323
398
|
* environment service.
|
|
324
399
|
*/
|
|
325
400
|
storyboardDiscovery?: boolean;
|
|
326
|
-
}
|
|
401
|
+
}
|
|
402
|
+
export declare function PygmalionEditor(props: PygmalionEditorProps): import("react").JSX.Element;
|
|
403
|
+
export { applyLayout, layoutHugAxes, layoutProblem, layoutChildProblem, layoutChild, isAbsoluteLayoutChild, participatesInLayout } from './document/layout.js';
|
|
404
|
+
export type { LayoutSpec, LayoutChild, LayoutPlacement, LayoutResult } from './document/layout.js';
|
|
405
|
+
export { LayoutPanel } from './workspace/edit/LayoutPanel.js';
|
|
406
|
+
export type { LayoutPanelProps } from './workspace/edit/LayoutPanel.js';
|
|
407
|
+
export { CanvasGuides, CanvasGuidesPanel } from './workspace/edit/CanvasGuides.js';
|
|
408
|
+
export { nodeGuides, guidesPatch, nodeLayoutGrids, layoutGridsPatch, isCanvasGuide, isLayoutGrid, defaultLayoutGrid, rulerTicks, rulerScale } from './workspace/edit/canvasGuideModel.js';
|
|
409
|
+
export type { CanvasGuide, LayoutGrid, LayoutGridTracks, LayoutGridPixels } from './workspace/edit/canvasGuideModel.js';
|
|
410
|
+
export * from './document/appearance.js';
|
|
411
|
+
export { AppearancePanel, AppearanceSurface, AppearanceVectorSurface } from './workspace/edit/AppearancePanel.js';
|
|
412
|
+
export type { AppearancePanelProps } from './workspace/edit/AppearancePanel.js';
|
|
413
|
+
export * from './workspace/source/appearanceSource.js';
|
|
414
|
+
export { assetInteropSourceDeltaDiagnostics, ASSETS_METADATA_KEY, ASSET_STORE_VERSION, IMAGE_MEDIA_TYPES, IMAGE_SCALE_MODES, IMAGE_SCALE_MODE_LABELS, createImageAsset, createSvgAsset, documentAssets, resolveAsset, addAsset, removeAsset, renameAsset, mergeAssetStores, assetStoreDiagnostics, serializeAssetStore, writeDocumentAssets, addDocumentAsset, nodeImagePaints, nodeAssetIds, assetReferences, unusedAssetIds, pruneUnusedAssets, missingAssetIds, assetsDuplicateMetadata, assetSourceUrl, imagePaint, imagePaintCss, nodeImageCss, imageNode, isImageNode, importAssetFiles, assetsFromInventory } from './document/assets.js';
|
|
415
|
+
export type { DocumentAsset, ImageAsset, SvgAsset, AssetStore, ImageAssetInput, SvgAssetInput, AssetFileLike, InventoryAssetMedia, InventoryAssetEntry } from './document/assets.js';
|
|
416
|
+
export * from './document/svgImport.js';
|
|
417
|
+
export * from './document/exportSettings.js';
|
|
418
|
+
export * from './workspace/edit/clipboard.js';
|
|
419
|
+
export { AssetsPanel } from './workspace/edit/AssetsPanel.js';
|
|
420
|
+
export type { AssetsPanelProps } from './workspace/edit/AssetsPanel.js';
|
|
421
|
+
export * from './document/prototype.js';
|
|
422
|
+
export { remapPrototypeProperties } from './document/prototypeReferences.js';
|
|
423
|
+
export { PrototypePanel } from './workspace/edit/PrototypePanel.js';
|
|
424
|
+
export { PrototypePlayer } from './workspace/view/PrototypePlayer.js';
|
|
425
|
+
export type { PrototypePlayerProps } from './workspace/view/PrototypePlayer.js';
|
|
426
|
+
export * from './workspace/view/prototypePlayback.js';
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
import type { DesignDocument, DocumentDiagnostic, DocumentNode, DocumentNodePatch, DocumentTransaction, DocumentValue } from '../document/contracts.js';
|
|
2
|
+
import type { TokenLibraryDocument, TokenValueResolution } from './contracts.js';
|
|
3
|
+
export type VariableScalar = string | number | boolean;
|
|
4
|
+
export interface VariableBinding {
|
|
5
|
+
libraryId: string;
|
|
6
|
+
tokenId: string;
|
|
7
|
+
modeId?: string;
|
|
8
|
+
}
|
|
9
|
+
export type VariableBindings = Record<string, VariableBinding>;
|
|
10
|
+
export type VariableValueCodec = (library: TokenLibraryDocument, resolved: TokenValueResolution) => VariableScalar;
|
|
11
|
+
export interface VariableChange {
|
|
12
|
+
nodeId: string;
|
|
13
|
+
overrideAddress?: string;
|
|
14
|
+
property: string;
|
|
15
|
+
tokenId: string;
|
|
16
|
+
before: DocumentValue | undefined;
|
|
17
|
+
after: VariableScalar;
|
|
18
|
+
}
|
|
19
|
+
export interface VariableUpdatePlan {
|
|
20
|
+
documentFingerprint: string;
|
|
21
|
+
libraryId: string;
|
|
22
|
+
sourceRevision: string;
|
|
23
|
+
libraryFingerprint: string;
|
|
24
|
+
patches: {
|
|
25
|
+
nodeId: string;
|
|
26
|
+
overrideAddress?: string;
|
|
27
|
+
patch: DocumentNodePatch;
|
|
28
|
+
}[];
|
|
29
|
+
changes: VariableChange[];
|
|
30
|
+
diagnostics: DocumentDiagnostic[];
|
|
31
|
+
}
|
|
32
|
+
export declare const VARIABLE_TARGETS: {
|
|
33
|
+
readonly width: "number";
|
|
34
|
+
readonly height: "number";
|
|
35
|
+
readonly radius: "number";
|
|
36
|
+
readonly opacity: "number";
|
|
37
|
+
readonly fontSize: "number";
|
|
38
|
+
readonly fontWeight: "number";
|
|
39
|
+
readonly lineHeight: "number";
|
|
40
|
+
readonly letterSpacing: "number";
|
|
41
|
+
readonly text: "string";
|
|
42
|
+
readonly fontFamily: "string";
|
|
43
|
+
readonly fill: "string";
|
|
44
|
+
readonly color: "string";
|
|
45
|
+
readonly hidden: "boolean";
|
|
46
|
+
readonly clip: "boolean";
|
|
47
|
+
};
|
|
48
|
+
export type VariableTarget = keyof typeof VARIABLE_TARGETS;
|
|
49
|
+
export declare function isVariableBinding(value: unknown): value is VariableBinding;
|
|
50
|
+
export declare function nodeVariableBindings(node: Pick<DocumentNode, 'properties'>): VariableBindings;
|
|
51
|
+
/** Built-in values are JSON scalars. Other syntax remains the host codec's responsibility. */
|
|
52
|
+
export declare function resolveScalarVariable(library: TokenLibraryDocument, resolved: TokenValueResolution, seen?: Set<string>): VariableScalar;
|
|
53
|
+
export declare function variableModeForNode(document: DesignDocument, nodeId: string, library: TokenLibraryDocument, tokenId: string, explicit?: string): string;
|
|
54
|
+
export declare function variableTargetsForNode(node: DocumentNode): VariableTarget[];
|
|
55
|
+
export declare function bindVariablePatch(document: DesignDocument, nodeId: string, property: VariableTarget, library: TokenLibraryDocument, binding: VariableBinding, codec?: VariableValueCodec): DocumentNodePatch;
|
|
56
|
+
export declare function detachVariablePatch(node: DocumentNode, property: VariableTarget): DocumentNodePatch;
|
|
57
|
+
/** A refresh plan records all affected nodes before the caller commits one history entry. */
|
|
58
|
+
export declare function planVariableLibraryUpdate(document: DesignDocument, library: TokenLibraryDocument, codec?: VariableValueCodec): VariableUpdatePlan;
|
|
59
|
+
export declare function commitVariableLibraryUpdate(tx: DocumentTransaction, document: DesignDocument, plan: VariableUpdatePlan): void;
|
|
60
|
+
export declare function commitVariableMode(tx: DocumentTransaction, document: DesignDocument, nodeId: string, library: TokenLibraryDocument, collectionId: string, modeId: string | null, codec?: VariableValueCodec): void;
|
|
61
|
+
/** Literal projection does not claim that source code preserves the binding or mode relationship. */
|
|
62
|
+
export declare function variablesSourceDiagnostics(after: DesignDocument, before: DesignDocument): DocumentDiagnostic[];
|
|
@@ -0,0 +1,117 @@
|
|
|
1
|
+
/** Authored token state. Source paths, CSS names, and codecs belong to the host baseline. */
|
|
2
|
+
export interface TokenLibraryDocument {
|
|
3
|
+
schemaVersion: 1;
|
|
4
|
+
id: string;
|
|
5
|
+
sourceRevision: string;
|
|
6
|
+
collections: Record<string, TokenCollection>;
|
|
7
|
+
tokens: Record<string, LibraryToken>;
|
|
8
|
+
}
|
|
9
|
+
export interface TokenCollection {
|
|
10
|
+
id: string;
|
|
11
|
+
name: string;
|
|
12
|
+
defaultModeId: string;
|
|
13
|
+
modes: TokenMode[];
|
|
14
|
+
}
|
|
15
|
+
export interface TokenMode {
|
|
16
|
+
id: string;
|
|
17
|
+
name: string;
|
|
18
|
+
/** An absent authored value may inherit from this mode. Empty text is still authored. */
|
|
19
|
+
fallbackModeId?: string;
|
|
20
|
+
}
|
|
21
|
+
export interface LibraryToken {
|
|
22
|
+
/** Stable across rename, draft persistence, and source regeneration. */
|
|
23
|
+
id: string;
|
|
24
|
+
collectionId: string;
|
|
25
|
+
name: string;
|
|
26
|
+
/** The host's declared value type, preserved without inferring it from text. */
|
|
27
|
+
type: string;
|
|
28
|
+
valuesByMode: Record<string, TokenValue>;
|
|
29
|
+
}
|
|
30
|
+
export interface TokenReferenceSpan {
|
|
31
|
+
/** Non-overlapping UTF-16 offsets in the exact authored text. Syntax belongs to the codec. */
|
|
32
|
+
start: number;
|
|
33
|
+
end: number;
|
|
34
|
+
tokenId: string;
|
|
35
|
+
/** Omission keeps the requested evaluation mode, including through inherited values. */
|
|
36
|
+
modeId?: string;
|
|
37
|
+
}
|
|
38
|
+
export interface TokenValue {
|
|
39
|
+
kind: 'literal' | 'alias' | 'expression' | 'opaque';
|
|
40
|
+
/** Exact authored value text; codecs preserve delimiters, units, and embedded expressions. */
|
|
41
|
+
text: string;
|
|
42
|
+
/** An opaque host codec identity. The core never parses or formats this syntax. */
|
|
43
|
+
format: string;
|
|
44
|
+
references: TokenReferenceSpan[];
|
|
45
|
+
}
|
|
46
|
+
export interface ResolvedTokenReference extends TokenReferenceSpan {
|
|
47
|
+
modeId: string;
|
|
48
|
+
}
|
|
49
|
+
/** Resolves authorship and graph edges, not host value syntax or computed CSS. */
|
|
50
|
+
export interface TokenValueResolution {
|
|
51
|
+
tokenId: string;
|
|
52
|
+
collectionId: string;
|
|
53
|
+
modeId: string;
|
|
54
|
+
authoredModeId: string;
|
|
55
|
+
inherited: boolean;
|
|
56
|
+
value: TokenValue;
|
|
57
|
+
references: ResolvedTokenReference[];
|
|
58
|
+
}
|
|
59
|
+
export interface TokenLibraryDiagnostic {
|
|
60
|
+
code: string;
|
|
61
|
+
message: string;
|
|
62
|
+
tokenId?: string;
|
|
63
|
+
collectionId?: string;
|
|
64
|
+
modeId?: string;
|
|
65
|
+
}
|
|
66
|
+
export interface TokenLibraryValidationResult {
|
|
67
|
+
valid: boolean;
|
|
68
|
+
diagnostics: readonly TokenLibraryDiagnostic[];
|
|
69
|
+
}
|
|
70
|
+
export interface TokenValueEditability {
|
|
71
|
+
editable: boolean;
|
|
72
|
+
reason?: 'opaque-value';
|
|
73
|
+
}
|
|
74
|
+
export interface TokenLibraryTransaction {
|
|
75
|
+
createCollection(collection: TokenCollection): void;
|
|
76
|
+
renameCollection(collectionId: string, name: string): void;
|
|
77
|
+
/** Only an empty collection may be removed. */
|
|
78
|
+
removeCollection(collectionId: string): void;
|
|
79
|
+
addMode(collectionId: string, mode: TokenMode): void;
|
|
80
|
+
renameMode(collectionId: string, modeId: string, name: string): void;
|
|
81
|
+
/** Referenced/default modes must be retargeted explicitly before removal. */
|
|
82
|
+
removeMode(collectionId: string, modeId: string): void;
|
|
83
|
+
setDefaultMode(collectionId: string, modeId: string): void;
|
|
84
|
+
setModeFallback(collectionId: string, modeId: string, fallbackModeId: string | null): void;
|
|
85
|
+
create(token: LibraryToken): void;
|
|
86
|
+
/** Creates an authored override when this mode previously inherited a value. */
|
|
87
|
+
setValue(tokenId: string, modeId: string, value: TokenValue): void;
|
|
88
|
+
/** Removes an authored override; validation requires every mode to remain resolvable. */
|
|
89
|
+
clearValue(tokenId: string, modeId: string): void;
|
|
90
|
+
/** Stable references remain attached to the same token; the host formats source names. */
|
|
91
|
+
rename(tokenId: string, name: string): void;
|
|
92
|
+
/** Referenced tokens, including references in inactive modes, cannot be removed. */
|
|
93
|
+
remove(tokenId: string): void;
|
|
94
|
+
/** Restores a same-library, same-source snapshot as one undoable transaction. */
|
|
95
|
+
replaceDocument(document: TokenLibraryDocument): void;
|
|
96
|
+
}
|
|
97
|
+
export interface TokenLibraryEngineOptions {
|
|
98
|
+
historyLimit?: number;
|
|
99
|
+
/** Pure host policy checks run before the entire transaction commits. */
|
|
100
|
+
preflight?(input: {
|
|
101
|
+
before: TokenLibraryDocument;
|
|
102
|
+
after: TokenLibraryDocument;
|
|
103
|
+
operations: readonly string[];
|
|
104
|
+
}): readonly TokenLibraryDiagnostic[];
|
|
105
|
+
}
|
|
106
|
+
export interface TokenLibraryEngine {
|
|
107
|
+
readonly snapshot: TokenLibraryDocument;
|
|
108
|
+
readonly revision: number;
|
|
109
|
+
readonly canUndo: boolean;
|
|
110
|
+
readonly canRedo: boolean;
|
|
111
|
+
transact(label: string, apply: (transaction: TokenLibraryTransaction) => void): boolean;
|
|
112
|
+
undo(): boolean;
|
|
113
|
+
redo(): boolean;
|
|
114
|
+
/** Serializes the library only; the internal history envelope is not a public format. */
|
|
115
|
+
serialize(): string;
|
|
116
|
+
subscribe(listener: () => void): () => void;
|
|
117
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { TokenLibraryDiagnostic, TokenLibraryDocument, TokenLibraryEngine, TokenLibraryEngineOptions, TokenLibraryValidationResult, TokenValueEditability, TokenValueResolution } from './contracts.js';
|
|
2
|
+
export declare class TokenLibraryValidationError extends Error {
|
|
3
|
+
readonly diagnostics: readonly TokenLibraryDiagnostic[];
|
|
4
|
+
constructor(diagnostics: readonly TokenLibraryDiagnostic[]);
|
|
5
|
+
}
|
|
6
|
+
/** Validate authored syntax boundaries and the complete token/mode reference graph. */
|
|
7
|
+
export declare function validateTokenLibraryDocument(input: unknown): TokenLibraryValidationResult;
|
|
8
|
+
/** A lightweight lookup for an already validated library; returned data is detached and frozen. */
|
|
9
|
+
export declare function resolveTokenLibraryValue(document: TokenLibraryDocument, tokenId: string, modeId: string): TokenValueResolution;
|
|
10
|
+
export declare function tokenValueEditability(document: TokenLibraryDocument, tokenId: string, modeId: string): TokenValueEditability;
|
|
11
|
+
/** Separate library sessions share the existing document transaction and history implementation. */
|
|
12
|
+
export declare function createTokenLibraryEngine(document: TokenLibraryDocument, options?: TokenLibraryEngineOptions): TokenLibraryEngine;
|
|
13
|
+
export declare function reopenTokenLibrary(serialized: string, options?: TokenLibraryEngineOptions): TokenLibraryEngine;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import type { ResolvedTokenReference, TokenLibraryDiagnostic, TokenLibraryDocument, TokenValueResolution } from './contracts.js';
|
|
2
|
+
export interface TokenValueReferenceRange {
|
|
3
|
+
start: number;
|
|
4
|
+
end: number;
|
|
5
|
+
/** Must be one of the resolution's declared references. */
|
|
6
|
+
reference: ResolvedTokenReference;
|
|
7
|
+
}
|
|
8
|
+
export interface TokenValueResolverOptions {
|
|
9
|
+
/** Extend a reference's replacement range to host-owned surrounding syntax, such as a function call. */
|
|
10
|
+
referenceRanges?(resolution: TokenValueResolution): readonly TokenValueReferenceRange[];
|
|
11
|
+
}
|
|
12
|
+
export interface ResolvedTokenText {
|
|
13
|
+
status: 'resolved' | 'blocked';
|
|
14
|
+
text?: string;
|
|
15
|
+
resolution?: TokenValueResolution;
|
|
16
|
+
diagnostics: readonly TokenLibraryDiagnostic[];
|
|
17
|
+
}
|
|
18
|
+
/** Resolves a captured library's declared reference graph and caches text by token and requested mode. */
|
|
19
|
+
export declare function createTokenValueResolver(input: TokenLibraryDocument, options?: TokenValueResolverOptions): (tokenId: string, modeId: string) => ResolvedTokenText;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { WorkspaceConfiguration } from './configuration.js';
|
|
2
|
+
|
|
3
|
+
export interface WorkspaceShellProps {
|
|
4
|
+
configuration: WorkspaceConfiguration;
|
|
5
|
+
sourceRevision: string;
|
|
6
|
+
previewIdentityReady: boolean;
|
|
7
|
+
previewOpen?: boolean;
|
|
8
|
+
}
|
|
9
|
+
export declare const WorkspaceShell: import("react").FunctionComponent<WorkspaceShellProps>;
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import type { ReactNode } from 'react';
|
|
2
|
+
import type { HostDataCapabilities } from '../binding/contracts.js';
|
|
3
|
+
import type { DesignDocument, DocumentNode, DocumentDuplicateMetadataRemapper } from '../document/contracts.js';
|
|
4
|
+
import type { WorkspaceSourceCapabilities } from './source/flowContracts.js';
|
|
5
|
+
import type { WorkspaceTarget } from './contracts.js';
|
|
6
|
+
import type { WorkspaceTokenLibraryCapabilities } from './tokens/contracts.js';
|
|
7
|
+
/** One target's source, data, rendering, and persistence capabilities travel together. */
|
|
8
|
+
export interface WorkspaceTargetConfiguration {
|
|
9
|
+
data?: HostDataCapabilities;
|
|
10
|
+
source?: WorkspaceSourceCapabilities;
|
|
11
|
+
duplicateMetadata?: DocumentDuplicateMetadataRemapper;
|
|
12
|
+
loadDocument?(target: WorkspaceTarget, options: {
|
|
13
|
+
signal: AbortSignal;
|
|
14
|
+
}): Promise<DesignDocument>;
|
|
15
|
+
/** Persist the versioned design draft; this is not permission to write source. */
|
|
16
|
+
saveDocument?(target: WorkspaceTarget, serializedDocument: string): Promise<void>;
|
|
17
|
+
/** Render the actual registered implementation with resolved input props. */
|
|
18
|
+
renderComponent?(node: DocumentNode, props: Readonly<Record<string, unknown>>, context: {
|
|
19
|
+
document: DesignDocument;
|
|
20
|
+
}): ReactNode;
|
|
21
|
+
onRequestData?(request: {
|
|
22
|
+
screenId: string;
|
|
23
|
+
description: string;
|
|
24
|
+
}): void;
|
|
25
|
+
}
|
|
26
|
+
/** Source loading and product interpretation stay with the host adapter. */
|
|
27
|
+
export interface WorkspaceConfiguration extends WorkspaceTargetConfiguration {
|
|
28
|
+
/** One shared token library, independent of per-screen visual document drafts. */
|
|
29
|
+
tokenLibrary?: WorkspaceTokenLibraryCapabilities;
|
|
30
|
+
initialMode?: 'view' | 'edit';
|
|
31
|
+
/** Host source/session controls occupy the shared header, outside mode panels. */
|
|
32
|
+
chrome?: ReactNode;
|
|
33
|
+
/** Undefined explicitly marks an unsupported screen or source revision. */
|
|
34
|
+
resolveTarget?(target: WorkspaceTarget): WorkspaceTargetConfiguration | undefined;
|
|
35
|
+
}
|
|
36
|
+
export interface WorkspaceTargetResolverOptions {
|
|
37
|
+
/** The host decides whether this screen and revision have usable capabilities. */
|
|
38
|
+
resolve(target: Readonly<WorkspaceTarget>): WorkspaceTargetConfiguration | undefined;
|
|
39
|
+
/** Maximum retained target configurations; zero disables caching. Default: 8. */
|
|
40
|
+
maxEntries?: number;
|
|
41
|
+
}
|
|
42
|
+
/** Retain capability identities per screen and revision; unsupported targets remain retryable. */
|
|
43
|
+
export declare function createWorkspaceTargetResolver({ resolve, maxEntries }: WorkspaceTargetResolverOptions): (target: WorkspaceTarget) => WorkspaceTargetConfiguration | undefined;
|
|
44
|
+
/** An explicit target resolver never inherits capabilities from the root configuration. */
|
|
45
|
+
export declare function resolveWorkspaceTarget(configuration: WorkspaceConfiguration, target: WorkspaceTarget): WorkspaceTargetConfiguration | undefined;
|
|
46
|
+
/** Compares captured capability identities without invoking any host callbacks. */
|
|
47
|
+
export declare function sameWorkspaceTargetConfiguration(left: WorkspaceTargetConfiguration | undefined, right: WorkspaceTargetConfiguration | undefined): boolean;
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
/** Navigation state belongs to the workspace, never to document history. */
|
|
2
|
+
export type WorkspaceMode = 'view' | 'edit' | 'application';
|
|
3
|
+
export interface WorkspaceTarget {
|
|
4
|
+
screenId: string;
|
|
5
|
+
sourceRevision: string;
|
|
6
|
+
}
|
|
7
|
+
export interface WorkspaceCamera {
|
|
8
|
+
x: number;
|
|
9
|
+
y: number;
|
|
10
|
+
zoom: number;
|
|
11
|
+
}
|
|
12
|
+
export interface WorkspaceDesignContext {
|
|
13
|
+
target: WorkspaceTarget;
|
|
14
|
+
selection: readonly string[];
|
|
15
|
+
camera: WorkspaceCamera;
|
|
16
|
+
}
|
|
17
|
+
export interface WorkspaceApplicationSurface {
|
|
18
|
+
/** An implementation URL or a built draft URL supplied by the host. */
|
|
19
|
+
url: string;
|
|
20
|
+
/** A built draft must identify the exact document revision it executes. */
|
|
21
|
+
documentRevision?: string;
|
|
22
|
+
/** The artifact must confirm that its declared screen recipe has completed. */
|
|
23
|
+
waitForReady?: boolean;
|
|
24
|
+
}
|
|
25
|
+
/** A fixed CSS viewport width for an executed surface; the host application still owns its own layout. */
|
|
26
|
+
export interface WorkspaceRunViewport {
|
|
27
|
+
width: number;
|
|
28
|
+
label?: string;
|
|
29
|
+
}
|
|
30
|
+
export interface WorkspaceApplicationRun {
|
|
31
|
+
id: number;
|
|
32
|
+
target: WorkspaceTarget;
|
|
33
|
+
kind: 'implementation' | 'built-draft';
|
|
34
|
+
documentRevision?: string;
|
|
35
|
+
viewport?: WorkspaceRunViewport;
|
|
36
|
+
status: 'preparing' | 'ready' | 'failed';
|
|
37
|
+
surface?: WorkspaceApplicationSurface;
|
|
38
|
+
error?: string;
|
|
39
|
+
/** Run navigation cannot change the selected storyboard or design target. */
|
|
40
|
+
locations: readonly string[];
|
|
41
|
+
locationIndex: number;
|
|
42
|
+
}
|
|
43
|
+
export interface WorkspaceSnapshot {
|
|
44
|
+
mode: WorkspaceMode;
|
|
45
|
+
view: {
|
|
46
|
+
target: WorkspaceTarget | null;
|
|
47
|
+
camera: WorkspaceCamera;
|
|
48
|
+
};
|
|
49
|
+
design: WorkspaceDesignContext | null;
|
|
50
|
+
application: WorkspaceApplicationRun | null;
|
|
51
|
+
returnMode: 'view' | 'edit';
|
|
52
|
+
}
|
|
53
|
+
export interface WorkspaceRunRequest {
|
|
54
|
+
target: WorkspaceTarget;
|
|
55
|
+
kind?: WorkspaceApplicationRun['kind'];
|
|
56
|
+
documentRevision?: string;
|
|
57
|
+
/** Requested execution width; omitted means the surface fills the workspace. */
|
|
58
|
+
viewport?: WorkspaceRunViewport;
|
|
59
|
+
}
|
|
60
|
+
export type WorkspaceApplicationPreparer = (
|
|
61
|
+
/** Captured run identity; caller mutations cannot retarget preparation. */
|
|
62
|
+
request: WorkspaceRunRequest,
|
|
63
|
+
/** Return, replacement, and disposal abort pending work. */
|
|
64
|
+
signal: AbortSignal) => Promise<WorkspaceApplicationSurface>;
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import type { WorkspaceApplicationPreparer, WorkspaceRunViewport, WorkspaceApplicationSurface, WorkspaceCamera, WorkspaceMode, WorkspaceRunRequest, WorkspaceSnapshot, WorkspaceTarget } from './contracts.js';
|
|
2
|
+
/** Runtime-scoped navigation with independent design and application contexts. */
|
|
3
|
+
export declare class WorkspaceController {
|
|
4
|
+
private value;
|
|
5
|
+
private listeners;
|
|
6
|
+
private designContexts;
|
|
7
|
+
private runSequence;
|
|
8
|
+
/** Owns both pending preparation and the lifetime of its ready surface. */
|
|
9
|
+
private activeRunController;
|
|
10
|
+
private cancellingPreparation;
|
|
11
|
+
private disposed;
|
|
12
|
+
constructor(initialMode?: 'view' | 'edit');
|
|
13
|
+
getSnapshot: () => WorkspaceSnapshot;
|
|
14
|
+
subscribe: (listener: () => void) => (() => void);
|
|
15
|
+
private update;
|
|
16
|
+
selectView(target: WorkspaceTarget): void;
|
|
17
|
+
edit(target?: WorkspaceTarget | null): void;
|
|
18
|
+
setMode(mode: Exclude<WorkspaceMode, 'application'>): void;
|
|
19
|
+
setSelection(selection: readonly string[]): void;
|
|
20
|
+
setCamera(mode: 'view' | 'edit', next: WorkspaceCamera): void;
|
|
21
|
+
beginApplication(request: WorkspaceRunRequest): number;
|
|
22
|
+
private startApplication;
|
|
23
|
+
completeApplication(id: number, surface: WorkspaceApplicationSurface): boolean;
|
|
24
|
+
failApplication(id: number, error: string): boolean;
|
|
25
|
+
invalidateApplication(id: number, error: string): boolean;
|
|
26
|
+
prepareApplication(request: WorkspaceRunRequest, prepare: WorkspaceApplicationPreparer): Promise<boolean>;
|
|
27
|
+
/** Resizing the executed surface is view state; it never restarts or re-prepares the run. */
|
|
28
|
+
setApplicationViewport(id: number, viewport: WorkspaceRunViewport | undefined): boolean;
|
|
29
|
+
navigateApplication(id: number, location: string): boolean;
|
|
30
|
+
backApplication(): boolean;
|
|
31
|
+
returnFromApplication(): void;
|
|
32
|
+
private cancelPreparation;
|
|
33
|
+
private abortRunController;
|
|
34
|
+
dispose(): void;
|
|
35
|
+
}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import type { BindingNodeContext, HostDataCapabilities } from '../binding/contracts.js';
|
|
2
|
+
import type { DesignDocument, DocumentDiagnostic, DocumentEngine } from '../document/contracts.js';
|
|
3
|
+
import { type WorkspaceConfiguration, type WorkspaceTargetConfiguration } from './configuration.js';
|
|
4
|
+
import type { WorkspaceTarget } from './contracts.js';
|
|
5
|
+
export interface WorkspaceDocumentSession {
|
|
6
|
+
target: WorkspaceTarget;
|
|
7
|
+
status: 'idle' | 'loading' | 'ready' | 'error';
|
|
8
|
+
engine?: DocumentEngine;
|
|
9
|
+
error?: string;
|
|
10
|
+
saving: boolean;
|
|
11
|
+
savedRevision: number;
|
|
12
|
+
dirty: boolean;
|
|
13
|
+
configuration?: WorkspaceTargetConfiguration;
|
|
14
|
+
configurationRevision: number;
|
|
15
|
+
}
|
|
16
|
+
export declare function documentBindingNodes(document: DesignDocument): BindingNodeContext[];
|
|
17
|
+
/** Bindings participate in the document commit, never in a parallel history. */
|
|
18
|
+
export declare function documentBindingPreflight(capabilities: HostDataCapabilities | undefined | (() => HostDataCapabilities | undefined)): ({ before, after }: {
|
|
19
|
+
before: DesignDocument;
|
|
20
|
+
after: DesignDocument;
|
|
21
|
+
}) => readonly DocumentDiagnostic[];
|
|
22
|
+
/** A runtime owns this collection; mode switches do not destroy its draft engines. */
|
|
23
|
+
export declare class WorkspaceDocumentSessions {
|
|
24
|
+
private sessions;
|
|
25
|
+
private pending;
|
|
26
|
+
private subscriptions;
|
|
27
|
+
private configurations;
|
|
28
|
+
private baselines;
|
|
29
|
+
private savedSnapshots;
|
|
30
|
+
private pendingSaves;
|
|
31
|
+
private listeners;
|
|
32
|
+
private disposed;
|
|
33
|
+
subscribe: (listener: () => void) => () => void;
|
|
34
|
+
getSnapshot: (target: WorkspaceTarget) => WorkspaceDocumentSession;
|
|
35
|
+
private update;
|
|
36
|
+
load(target: WorkspaceTarget, configuration: WorkspaceConfiguration): Promise<DocumentEngine | null>;
|
|
37
|
+
save(target: WorkspaceTarget, explicitSave?: NonNullable<WorkspaceTargetConfiguration['saveDocument']>): Promise<boolean>;
|
|
38
|
+
/** Reset means the snapshot first loaded for this target, including a persisted draft. */
|
|
39
|
+
reset(target: WorkspaceTarget): boolean;
|
|
40
|
+
hasUnsavedChanges(): boolean;
|
|
41
|
+
dispose(): void;
|
|
42
|
+
}
|