@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,216 @@
|
|
|
1
|
+
import type { DesignDocument, DocumentDiagnostic, DocumentDuplicateMetadataRemapper, DocumentNode, DocumentNodePatch, DocumentTransaction, DocumentValue } from './contracts.js';
|
|
2
|
+
import { type Paint, type Effect } from './appearance.js';
|
|
3
|
+
import { type LayoutGrid } from '../workspace/edit/canvasGuideModel.js';
|
|
4
|
+
export type { LayoutGrid } from '../workspace/edit/canvasGuideModel.js';
|
|
5
|
+
import { type RichTextCase } from './richText.js';
|
|
6
|
+
/**
|
|
7
|
+
* Local and shared styles.
|
|
8
|
+
*
|
|
9
|
+
* A style is a named, reusable value of one kind (paint, text, effect, grid) stored once in
|
|
10
|
+
* `document.metadata.styles`. A node references a style by id in `node.properties.styles[slot]`
|
|
11
|
+
* and always keeps the *projected* value in its ordinary properties (`fill`, `color`, typography
|
|
12
|
+
* keys, `effects`, `layoutGrids`), so the canvas, the visual compiler, and every other module render
|
|
13
|
+
* and compile a styled node without knowing about styles at all. Editing a style re-projects it into
|
|
14
|
+
* every consumer; detaching removes the reference and keeps the projected value, exactly as Figma does.
|
|
15
|
+
*
|
|
16
|
+
* Shared styles come from a `StyleLibraryDocument`. An imported style remembers its origin; applying a
|
|
17
|
+
* newer library revision re-projects changed styles and reports the affected consumers before anything
|
|
18
|
+
* is written.
|
|
19
|
+
*/
|
|
20
|
+
export type StyleKind = 'paint' | 'text' | 'effect' | 'grid';
|
|
21
|
+
export declare const STYLE_KINDS: readonly StyleKind[];
|
|
22
|
+
/** Where a style can attach on a node. `fill` and `color` are both paint slots (layer fill, text colour). */
|
|
23
|
+
export type StyleSlot = 'fill' | 'color' | 'text' | 'effect' | 'grid';
|
|
24
|
+
export declare const STYLE_SLOTS: readonly StyleSlot[];
|
|
25
|
+
export declare const STYLE_SLOT_KIND: Readonly<Record<StyleSlot, StyleKind>>;
|
|
26
|
+
export declare const STYLE_KIND_LABEL: Readonly<Record<StyleKind, string>>;
|
|
27
|
+
export declare const STYLE_SLOT_LABEL: Readonly<Record<StyleSlot, string>>;
|
|
28
|
+
/** Paint styles reuse the appearance model, including ordered multi-paint stacks. */
|
|
29
|
+
export type StylePaint = Paint;
|
|
30
|
+
export type PaintStyleValue = StylePaint | {
|
|
31
|
+
paints: StylePaint[];
|
|
32
|
+
};
|
|
33
|
+
/** Node-level typography keys a text style may set. Colour is a paint style, links and lists are content. */
|
|
34
|
+
export interface TextStyleValue {
|
|
35
|
+
fontFamily?: string;
|
|
36
|
+
fontWeight?: number;
|
|
37
|
+
fontSize?: number;
|
|
38
|
+
italic?: boolean;
|
|
39
|
+
underline?: boolean;
|
|
40
|
+
strikethrough?: boolean;
|
|
41
|
+
textCase?: RichTextCase;
|
|
42
|
+
lineHeight?: number;
|
|
43
|
+
letterSpacing?: number;
|
|
44
|
+
indent?: number;
|
|
45
|
+
}
|
|
46
|
+
export declare const TEXT_STYLE_CHARACTER_KEYS: readonly ["fontFamily", "fontWeight", "fontSize", "italic", "underline", "strikethrough", "textCase"];
|
|
47
|
+
export declare const TEXT_STYLE_PARAGRAPH_KEYS: readonly ["lineHeight", "letterSpacing", "indent"];
|
|
48
|
+
export declare const TEXT_STYLE_KEYS: readonly (keyof TextStyleValue)[];
|
|
49
|
+
export type StyleEffect = Effect;
|
|
50
|
+
export interface EffectStyleValue {
|
|
51
|
+
effects: StyleEffect[];
|
|
52
|
+
}
|
|
53
|
+
export interface GridStyleValue {
|
|
54
|
+
grids: LayoutGrid[];
|
|
55
|
+
}
|
|
56
|
+
export type StyleValue = PaintStyleValue | TextStyleValue | EffectStyleValue | GridStyleValue;
|
|
57
|
+
export interface StyleValueByKind {
|
|
58
|
+
paint: PaintStyleValue;
|
|
59
|
+
text: TextStyleValue;
|
|
60
|
+
effect: EffectStyleValue;
|
|
61
|
+
grid: GridStyleValue;
|
|
62
|
+
}
|
|
63
|
+
export interface StyleOrigin {
|
|
64
|
+
libraryId: string;
|
|
65
|
+
styleId: string;
|
|
66
|
+
revision: string;
|
|
67
|
+
}
|
|
68
|
+
export interface DesignStyle {
|
|
69
|
+
id: string;
|
|
70
|
+
kind: StyleKind;
|
|
71
|
+
name: string;
|
|
72
|
+
value: StyleValue;
|
|
73
|
+
description?: string;
|
|
74
|
+
origin?: StyleOrigin;
|
|
75
|
+
}
|
|
76
|
+
export interface StylesMetadata {
|
|
77
|
+
version: 1;
|
|
78
|
+
styles: Record<string, DesignStyle>;
|
|
79
|
+
libraries?: Record<string, {
|
|
80
|
+
revision: string;
|
|
81
|
+
}>;
|
|
82
|
+
}
|
|
83
|
+
/** A published set of styles. Ids are stable across revisions; a document imports the ones it uses. */
|
|
84
|
+
export interface StyleLibraryDocument {
|
|
85
|
+
schemaVersion: 1;
|
|
86
|
+
id: string;
|
|
87
|
+
revision: string;
|
|
88
|
+
styles: Record<string, Omit<DesignStyle, 'origin'>>;
|
|
89
|
+
}
|
|
90
|
+
export type StyleReferences = Partial<Record<StyleSlot, string>>;
|
|
91
|
+
export type StyleConsumer = {
|
|
92
|
+
kind: 'node';
|
|
93
|
+
nodeId: string;
|
|
94
|
+
slot: StyleSlot;
|
|
95
|
+
} | {
|
|
96
|
+
kind: 'override';
|
|
97
|
+
instanceId: string;
|
|
98
|
+
definitionNodeId: string;
|
|
99
|
+
slot: StyleSlot;
|
|
100
|
+
};
|
|
101
|
+
export type StylePropagation = {
|
|
102
|
+
kind: 'node';
|
|
103
|
+
nodeId: string;
|
|
104
|
+
properties: Record<string, DocumentValue>;
|
|
105
|
+
} | {
|
|
106
|
+
kind: 'override';
|
|
107
|
+
instanceId: string;
|
|
108
|
+
definitionNodeId: string;
|
|
109
|
+
properties: Record<string, DocumentValue>;
|
|
110
|
+
};
|
|
111
|
+
export interface StyleLibraryChange {
|
|
112
|
+
styleId: string;
|
|
113
|
+
name: string;
|
|
114
|
+
kind: StyleKind;
|
|
115
|
+
status: 'updated' | 'renamed' | 'removed' | 'unchanged' | 'unavailable';
|
|
116
|
+
consumers: StyleConsumer[];
|
|
117
|
+
}
|
|
118
|
+
export interface StyleLibraryUpdatePlan {
|
|
119
|
+
documentFingerprint: string;
|
|
120
|
+
libraryId: string;
|
|
121
|
+
revision: string;
|
|
122
|
+
metadata: StylesMetadata;
|
|
123
|
+
propagations: StylePropagation[];
|
|
124
|
+
changes: StyleLibraryChange[];
|
|
125
|
+
}
|
|
126
|
+
export declare class StyleError extends Error {
|
|
127
|
+
readonly code: string;
|
|
128
|
+
readonly styleId?: string;
|
|
129
|
+
readonly nodeId?: string;
|
|
130
|
+
constructor(code: string, message: string, location?: {
|
|
131
|
+
styleId?: string;
|
|
132
|
+
nodeId?: string;
|
|
133
|
+
});
|
|
134
|
+
}
|
|
135
|
+
export declare function isStylePaint(value: unknown): value is StylePaint;
|
|
136
|
+
export declare function isTextStyleValue(value: unknown): value is TextStyleValue;
|
|
137
|
+
export declare function isStyleEffect(value: unknown): value is StyleEffect;
|
|
138
|
+
export declare function isLayoutGrid(value: unknown): value is LayoutGrid;
|
|
139
|
+
export declare function isStyleValue<K extends StyleKind>(kind: K, value: unknown): value is StyleValueByKind[K];
|
|
140
|
+
export declare function isDesignStyle(value: unknown): value is DesignStyle;
|
|
141
|
+
export declare function isStylesMetadata(value: unknown): value is StylesMetadata;
|
|
142
|
+
export declare function isStyleReferences(value: unknown): value is StyleReferences;
|
|
143
|
+
export declare function validateStyleLibrary(input: unknown): DocumentDiagnostic[];
|
|
144
|
+
export declare const EMPTY_STYLES: StylesMetadata;
|
|
145
|
+
/** The document's styles, or an empty set; an invalid sidecar is refused rather than guessed. */
|
|
146
|
+
export declare function documentStyles(document: DesignDocument): StylesMetadata;
|
|
147
|
+
export declare function documentStyle(document: DesignDocument, styleId: string): DesignStyle;
|
|
148
|
+
export declare function documentStylesOfKind(document: DesignDocument, kind: StyleKind): DesignStyle[];
|
|
149
|
+
export declare function nodeStyleReferences(node: Pick<DocumentNode, 'properties'>): StyleReferences;
|
|
150
|
+
/** Slots that make sense for a layer kind; the panel offers exactly these. */
|
|
151
|
+
export declare function styleSlotsFor(node: Pick<DocumentNode, 'kind'> & Partial<Pick<DocumentNode, 'properties'>>): StyleSlot[];
|
|
152
|
+
/** Validation of the sidecar and every reference; part of the document-level diagnostics a host may run on load. */
|
|
153
|
+
export declare function documentStyleDiagnostics(document: DesignDocument): DocumentDiagnostic[];
|
|
154
|
+
export declare function createStyle(metadata: StylesMetadata, style: DesignStyle): StylesMetadata;
|
|
155
|
+
export declare function renameStyle(metadata: StylesMetadata, styleId: string, name: string): StylesMetadata;
|
|
156
|
+
export declare function describeStyle(metadata: StylesMetadata, styleId: string, description: string | undefined): StylesMetadata;
|
|
157
|
+
export declare function setStyleValue(metadata: StylesMetadata, styleId: string, value: StyleValue): StylesMetadata;
|
|
158
|
+
export declare function removeStyle(metadata: StylesMetadata, styleId: string): StylesMetadata;
|
|
159
|
+
/** Cuts a shared style loose from its library: it stays in the document as a local style. */
|
|
160
|
+
export declare function detachStyleFromLibrary(metadata: StylesMetadata, styleId: string): StylesMetadata;
|
|
161
|
+
/**
|
|
162
|
+
* Writes a style's value into a node's properties and records the reference. Text styles pass through the
|
|
163
|
+
* typography normalizer so a key set on the layer is cleared from every run and the plain projection stays exact.
|
|
164
|
+
*/
|
|
165
|
+
export declare function projectStyle(properties: Readonly<Record<string, DocumentValue>>, style: DesignStyle, slot: StyleSlot, kind?: DocumentNode['kind']): Record<string, DocumentValue>;
|
|
166
|
+
/** Removes the reference and keeps the projected value on the layer. */
|
|
167
|
+
export declare function detachStyleReference(properties: Readonly<Record<string, DocumentValue>>, slot: StyleSlot): Record<string, DocumentValue>;
|
|
168
|
+
/** Reads a style value back out of a layer, so a style can be created from the selection. */
|
|
169
|
+
export declare function styleValueFromNode(node: Pick<DocumentNode, 'kind' | 'properties'>, kind: StyleKind, slot?: StyleSlot): StyleValue;
|
|
170
|
+
export declare function styleConsumers(document: DesignDocument, styleId: string): StyleConsumer[];
|
|
171
|
+
/**
|
|
172
|
+
* Re-projects a style (its current value, or `value` when the caller is about to change it) into every consumer.
|
|
173
|
+
* With `value === null` the consumers are detached instead: the reference goes, the projected values stay.
|
|
174
|
+
*/
|
|
175
|
+
export declare function propagateStyle(document: DesignDocument, styleId: string, value?: StyleValue | null | undefined): StylePropagation[];
|
|
176
|
+
export declare function applyStylePropagation(tx: DocumentTransaction, propagations: readonly StylePropagation[]): void;
|
|
177
|
+
/** Writes the sidecar; an empty set removes the key so documents without styles carry no metadata. */
|
|
178
|
+
export declare function writeStyles(tx: DocumentTransaction, metadata: StylesMetadata): void;
|
|
179
|
+
export declare function applyStylePatch(document: DesignDocument, nodeId: string, slot: StyleSlot, styleId: string): DocumentNodePatch;
|
|
180
|
+
export declare function detachStylePatch(document: DesignDocument, nodeId: string, slot: StyleSlot): DocumentNodePatch;
|
|
181
|
+
/** Creates a style and, when a layer is given, applies it to that layer in the same transaction. */
|
|
182
|
+
export declare function commitCreateStyle(tx: DocumentTransaction, document: DesignDocument, style: DesignStyle, applyTo?: {
|
|
183
|
+
nodeId: string;
|
|
184
|
+
slot: StyleSlot;
|
|
185
|
+
}): void;
|
|
186
|
+
export declare function commitStyleValue(tx: DocumentTransaction, document: DesignDocument, styleId: string, value: StyleValue): void;
|
|
187
|
+
export declare function commitRenameStyle(tx: DocumentTransaction, document: DesignDocument, styleId: string, name: string): void;
|
|
188
|
+
/** Deleting a style detaches its consumers; their projected values stay, as in Figma. */
|
|
189
|
+
export declare function commitRemoveStyle(tx: DocumentTransaction, document: DesignDocument, styleId: string): void;
|
|
190
|
+
export declare function commitApplyStyle(tx: DocumentTransaction, document: DesignDocument, nodeId: string, slot: StyleSlot, styleId: string): void;
|
|
191
|
+
export declare function commitDetachStyle(tx: DocumentTransaction, document: DesignDocument, nodeId: string, slot: StyleSlot): void;
|
|
192
|
+
/** Figma's "update style from selection": the layer's current value becomes the style's value everywhere. */
|
|
193
|
+
export declare function commitStyleFromNode(tx: DocumentTransaction, document: DesignDocument, styleId: string, nodeId: string, slot: StyleSlot): void;
|
|
194
|
+
/** Imports one library style as a shared style; the local id defaults to the library's stable id. */
|
|
195
|
+
export declare function importLibraryStyle(metadata: StylesMetadata, library: StyleLibraryDocument, styleId: string, localId?: string): StylesMetadata;
|
|
196
|
+
/**
|
|
197
|
+
* The diff of a newer library revision against the document: which imported styles change, which were removed
|
|
198
|
+
* from the library (they stay as local styles), and which consumers each change reaches. Nothing is written.
|
|
199
|
+
*/
|
|
200
|
+
export declare function planStyleLibraryUpdate(document: DesignDocument, library: StyleLibraryDocument): StyleLibraryUpdatePlan;
|
|
201
|
+
export declare function commitStyleLibraryUpdate(tx: DocumentTransaction, document: DesignDocument, plan: StyleLibraryUpdatePlan): void;
|
|
202
|
+
/**
|
|
203
|
+
* Styles never reference layers, so duplicating a subtree keeps the sidecar unchanged. Wrap a host remapper
|
|
204
|
+
* with this so the style sidecar survives duplication next to host-owned sidecars.
|
|
205
|
+
*/
|
|
206
|
+
export declare function stylesDuplicateRemapper(inner?: DocumentDuplicateMetadataRemapper): DocumentDuplicateMetadataRemapper;
|
|
207
|
+
/** The only metadata this module writes; a duplicate guard can treat this key as remap-free. */
|
|
208
|
+
export declare const STYLES_METADATA_KEY = "styles";
|
|
209
|
+
/** Node property keys owned by this module; they are sidecars with no source representation of their own. */
|
|
210
|
+
export declare const STYLE_SIDECAR_PROPERTY_KEYS: readonly string[];
|
|
211
|
+
/**
|
|
212
|
+
* Source review: a style reference has no representation in code — the projected value is what compiles. These
|
|
213
|
+
* diagnostics name a changed reference (or a changed style set) so the review controller can explain a blocked
|
|
214
|
+
* review instead of reporting an unmapped field, mirroring the typography diagnostics.
|
|
215
|
+
*/
|
|
216
|
+
export declare function stylesSourceDiagnostics(after: DesignDocument, before: DesignDocument): DocumentDiagnostic[];
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import type { DocumentMatrix, DocumentNode, DocumentTransaction } from './contracts.js';
|
|
2
|
+
import { type SvgAsset } from './assets.js';
|
|
3
|
+
import { type VectorPath } from './vector.js';
|
|
4
|
+
export declare function svgTransform(text?: string): DocumentMatrix;
|
|
5
|
+
/** SVG path parser. Quadratic and smooth segments become equivalent cubic control points. */
|
|
6
|
+
export declare function parseSvgPath(data: string): VectorPath[];
|
|
7
|
+
export interface SvgImportResult {
|
|
8
|
+
asset: SvgAsset;
|
|
9
|
+
rootId: string;
|
|
10
|
+
nodes: DocumentNode[];
|
|
11
|
+
}
|
|
12
|
+
/** Imports primitives and cubic paths as real editable vector/group nodes. Unsupported constructs reject atomically. */
|
|
13
|
+
export declare function importEditableSvg(markup: string, options: {
|
|
14
|
+
name?: string;
|
|
15
|
+
allocateId: (sourceId: string) => string;
|
|
16
|
+
}): SvgImportResult;
|
|
17
|
+
export declare function addImportedSvg(transaction: Pick<DocumentTransaction, 'add'>, result: SvgImportResult, parentId: string): void;
|
|
@@ -0,0 +1,222 @@
|
|
|
1
|
+
import type { DocumentMatrix, DocumentValue } from './contracts.js';
|
|
2
|
+
/**
|
|
3
|
+
* Pure path model for `vector` nodes. The document stores it under
|
|
4
|
+
* `node.properties.vector` as plain JSON: absolute coordinates in the node's
|
|
5
|
+
* own space, one entry per sub-path, cubic curves only (`M`/`L`/`C`/`Z`).
|
|
6
|
+
*
|
|
7
|
+
* Everything here is deterministic and free of DOM access. Editing operations
|
|
8
|
+
* return new values and never mutate their input, so a canvas gesture can
|
|
9
|
+
* preview a result and commit or drop it. Precision limits are documented on
|
|
10
|
+
* the boolean operations, which flatten curves before clipping.
|
|
11
|
+
*/
|
|
12
|
+
export type VectorFillRule = 'nonzero' | 'evenodd';
|
|
13
|
+
export type VectorBooleanOperation = 'union' | 'subtract' | 'intersect' | 'exclude';
|
|
14
|
+
export type VectorLineCap = 'butt' | 'round' | 'square';
|
|
15
|
+
export type VectorLineJoin = 'miter' | 'round' | 'bevel';
|
|
16
|
+
export type VectorShape = 'rectangle' | 'ellipse' | 'line' | 'polygon' | 'star' | 'arc';
|
|
17
|
+
export interface VectorPoint {
|
|
18
|
+
x: number;
|
|
19
|
+
y: number;
|
|
20
|
+
}
|
|
21
|
+
export type VectorCommand = {
|
|
22
|
+
type: 'M';
|
|
23
|
+
x: number;
|
|
24
|
+
y: number;
|
|
25
|
+
} | {
|
|
26
|
+
type: 'L';
|
|
27
|
+
x: number;
|
|
28
|
+
y: number;
|
|
29
|
+
} | {
|
|
30
|
+
type: 'C';
|
|
31
|
+
x1: number;
|
|
32
|
+
y1: number;
|
|
33
|
+
x2: number;
|
|
34
|
+
y2: number;
|
|
35
|
+
x: number;
|
|
36
|
+
y: number;
|
|
37
|
+
} | {
|
|
38
|
+
type: 'Z';
|
|
39
|
+
};
|
|
40
|
+
export interface VectorPath {
|
|
41
|
+
closed: boolean;
|
|
42
|
+
commands: VectorCommand[];
|
|
43
|
+
}
|
|
44
|
+
export interface VectorStroke {
|
|
45
|
+
width: number;
|
|
46
|
+
color: string;
|
|
47
|
+
cap?: VectorLineCap;
|
|
48
|
+
join?: VectorLineJoin;
|
|
49
|
+
}
|
|
50
|
+
export interface VectorProperties {
|
|
51
|
+
version: 1;
|
|
52
|
+
paths: VectorPath[];
|
|
53
|
+
fillRule?: VectorFillRule;
|
|
54
|
+
fill?: string;
|
|
55
|
+
stroke?: VectorStroke;
|
|
56
|
+
/** Non-destructive corner radius applied to straight corners at render time. */
|
|
57
|
+
corners?: number;
|
|
58
|
+
/** A mask clips the siblings rendered above it; its own paint is not shown. */
|
|
59
|
+
mask?: boolean;
|
|
60
|
+
/** Records the operation that produced this geometry; informational. */
|
|
61
|
+
booleanOp?: VectorBooleanOperation;
|
|
62
|
+
}
|
|
63
|
+
export interface VectorBounds {
|
|
64
|
+
x: number;
|
|
65
|
+
y: number;
|
|
66
|
+
width: number;
|
|
67
|
+
height: number;
|
|
68
|
+
}
|
|
69
|
+
/** Editing view of a path: anchors with optional absolute handles. `in` leads into the anchor, `out` leaves it. */
|
|
70
|
+
export interface VectorAnchor {
|
|
71
|
+
x: number;
|
|
72
|
+
y: number;
|
|
73
|
+
in?: VectorPoint;
|
|
74
|
+
out?: VectorPoint;
|
|
75
|
+
}
|
|
76
|
+
export interface VectorAnchorAddress {
|
|
77
|
+
path: number;
|
|
78
|
+
anchor: number;
|
|
79
|
+
}
|
|
80
|
+
export interface VectorSegmentAddress {
|
|
81
|
+
path: number;
|
|
82
|
+
segment: number;
|
|
83
|
+
}
|
|
84
|
+
export type VectorAnchorMode = 'corner' | 'smooth';
|
|
85
|
+
export type VectorHandleSide = 'in' | 'out';
|
|
86
|
+
export type VectorRing = VectorPoint[];
|
|
87
|
+
export interface VectorSegment {
|
|
88
|
+
from: number;
|
|
89
|
+
to: number;
|
|
90
|
+
curve: boolean;
|
|
91
|
+
/** Cubic control polygon; a line repeats its end points. */
|
|
92
|
+
points: [VectorPoint, VectorPoint, VectorPoint, VectorPoint];
|
|
93
|
+
}
|
|
94
|
+
export declare const VECTOR_SHAPES: readonly VectorShape[];
|
|
95
|
+
export declare const VECTOR_BOOLEAN_OPERATIONS: readonly VectorBooleanOperation[];
|
|
96
|
+
/** Curve flattening tolerance in canvas units for boolean operations and area. */
|
|
97
|
+
export declare const VECTOR_FLATNESS = 0.1;
|
|
98
|
+
/** Vertices closer than this are merged by the polygon clipper. */
|
|
99
|
+
export declare const VECTOR_MERGE_DISTANCE = 0.000001;
|
|
100
|
+
/** Features thinner than twice this distance are not resolved by the polygon clipper. */
|
|
101
|
+
export declare const VECTOR_SIDE_SAMPLE = 0.0001;
|
|
102
|
+
/** Strict structural check of stored path data; unknown keys and non-finite numbers are rejected. */
|
|
103
|
+
export declare function isVectorProperties(value: unknown): value is VectorProperties;
|
|
104
|
+
/** A detached copy of valid stored path data, or null. */
|
|
105
|
+
export declare function parseVector(value: unknown): VectorProperties | null;
|
|
106
|
+
/** Canonical JSON for `node.properties.vector`: known keys only, in a stable order, nothing undefined. */
|
|
107
|
+
export declare function serializeVector(vector: VectorProperties): {
|
|
108
|
+
[key: string]: DocumentValue;
|
|
109
|
+
};
|
|
110
|
+
/** Anchors of a path; a closed path never repeats its first anchor, the closing segment is implicit. */
|
|
111
|
+
export declare function vectorPathAnchors(path: VectorPath): VectorAnchor[];
|
|
112
|
+
/** Rebuilds commands from anchors; a curved closing segment is written explicitly before `Z`. */
|
|
113
|
+
export declare function vectorPathFromAnchors(anchors: readonly VectorAnchor[], closed: boolean): VectorPath;
|
|
114
|
+
/** Segments of a path in anchor order; the closing segment of a closed path comes last. */
|
|
115
|
+
export declare function vectorPathSegments(path: VectorPath): VectorSegment[];
|
|
116
|
+
/** Exact bounds of the geometry including curve extrema; null without anchors. Strokes and corners are not included. */
|
|
117
|
+
export declare function vectorBounds(vector: VectorProperties): VectorBounds | null;
|
|
118
|
+
/** Applies an affine matrix to every coordinate, control points included. Style keys are kept. */
|
|
119
|
+
export declare function transformVector(vector: VectorProperties, matrix: DocumentMatrix): VectorProperties;
|
|
120
|
+
export declare function translateVector(vector: VectorProperties, dx: number, dy: number): VectorProperties;
|
|
121
|
+
/** Matrix that maps the geometry's bounds onto a node box; a zero-extent axis keeps its scale. */
|
|
122
|
+
export declare function vectorFitTransform(bounds: VectorBounds, width: number, height: number): DocumentMatrix;
|
|
123
|
+
/** Moves the geometry so its bounds start at the origin and reports the node size it needs. */
|
|
124
|
+
export declare function normalizeVectorOrigin(vector: VectorProperties): {
|
|
125
|
+
vector: VectorProperties;
|
|
126
|
+
offset: VectorPoint;
|
|
127
|
+
width: number;
|
|
128
|
+
height: number;
|
|
129
|
+
};
|
|
130
|
+
/** Node placement after geometry changed: the local offset travels through the node's linear part. */
|
|
131
|
+
export declare function fitVectorNode(vector: VectorProperties, transform: DocumentMatrix): {
|
|
132
|
+
vector: VectorProperties;
|
|
133
|
+
transform: DocumentMatrix;
|
|
134
|
+
width: number;
|
|
135
|
+
height: number;
|
|
136
|
+
};
|
|
137
|
+
export declare function rectangleVector(width: number, height: number): VectorProperties;
|
|
138
|
+
export declare function ellipseVector(width: number, height: number): VectorProperties;
|
|
139
|
+
/** A straight segment from the node origin to its far corner; a zero height gives a horizontal line. */
|
|
140
|
+
export declare function lineVector(width: number, height: number): VectorProperties;
|
|
141
|
+
/** A regular polygon inscribed in the node box, first vertex at the top. */
|
|
142
|
+
export declare function polygonVector(width: number, height: number, sides?: number): VectorProperties;
|
|
143
|
+
/** A star with alternating outer and inner vertices; the inner ratio is relative to the outer radius. */
|
|
144
|
+
export declare function starVector(width: number, height: number, points?: number, innerRatio?: number): VectorProperties;
|
|
145
|
+
/** Elliptical sector or ring sector, with cubic segments no larger than a quarter turn.
|
|
146
|
+
* Angles are clockwise degrees in the local y-down coordinate system. Cubics approximate
|
|
147
|
+
* circular arcs with the same quarter-circle convention as ellipseVector.
|
|
148
|
+
*/
|
|
149
|
+
export declare function arcVector(width: number, height: number, start?: number, sweep?: number, innerRadius?: number): VectorProperties;
|
|
150
|
+
export declare function createShapeVector(shape: VectorShape, width: number, height: number): VectorProperties;
|
|
151
|
+
/**
|
|
152
|
+
* Replaces each straight corner with a circular arc approximated by one cubic. The tangent
|
|
153
|
+
* length is clamped to half of each adjacent segment so neighbouring arcs never overlap; two
|
|
154
|
+
* arcs that meet at the middle of a segment share one anchor (a square with a large radius
|
|
155
|
+
* becomes a circle, an oblong a pill). Corners between curved segments, path ends, and
|
|
156
|
+
* collinear anchors are left alone.
|
|
157
|
+
*/
|
|
158
|
+
export declare function roundVectorCorners(vector: VectorProperties, radius: number): VectorProperties;
|
|
159
|
+
/** SVG `d` attribute; corner rounding is applied unless `corners: false`. */
|
|
160
|
+
export declare function vectorPathData(vector: VectorProperties, options?: {
|
|
161
|
+
corners?: boolean;
|
|
162
|
+
}): string;
|
|
163
|
+
/** Smooth: both handles present and collinear through the anchor in opposite directions. */
|
|
164
|
+
export declare function vectorAnchorMode(anchor: VectorAnchor): VectorAnchorMode;
|
|
165
|
+
export declare function moveVectorAnchor(vector: VectorProperties, address: VectorAnchorAddress, target: VectorPoint): VectorProperties;
|
|
166
|
+
/** Moves one handle; with `mirror`, an existing opposite handle keeps the same length on the opposite side. */
|
|
167
|
+
export declare function moveVectorHandle(vector: VectorProperties, address: VectorAnchorAddress, side: VectorHandleSide, target: VectorPoint, mirror?: boolean): VectorProperties;
|
|
168
|
+
/** Corner drops both handles; smooth mirrors handles along the neighbour tangent, one third of the shorter side. */
|
|
169
|
+
export declare function setVectorAnchorMode(vector: VectorProperties, address: VectorAnchorAddress, mode: VectorAnchorMode): VectorProperties;
|
|
170
|
+
/** Splits a segment at parameter `t`; a cubic keeps its shape exactly (de Casteljau). */
|
|
171
|
+
export declare function insertVectorAnchor(vector: VectorProperties, address: VectorSegmentAddress, t?: number): VectorProperties;
|
|
172
|
+
/** Removes an anchor; neighbours keep their handles. A sub-path with fewer than two anchors is removed. */
|
|
173
|
+
export declare function deleteVectorAnchor(vector: VectorProperties, address: VectorAnchorAddress): VectorProperties;
|
|
174
|
+
/** A closed path can open at any anchor; an open path can split at an interior anchor. */
|
|
175
|
+
export declare function canSplitVectorPath(vector: VectorProperties, address: VectorAnchorAddress): boolean;
|
|
176
|
+
/** Opens a closed path at the anchor (it becomes both ends) or splits an open path into two at the anchor. */
|
|
177
|
+
export declare function splitVectorPath(vector: VectorProperties, address: VectorAnchorAddress): VectorProperties;
|
|
178
|
+
export declare function canJoinVectorPaths(vector: VectorProperties, from: number, to: number): boolean;
|
|
179
|
+
/**
|
|
180
|
+
* Joins the end of one open path to the start of another with a straight segment (coincident
|
|
181
|
+
* ends merge into one anchor). Joining a path to itself closes it.
|
|
182
|
+
*/
|
|
183
|
+
export declare function joinVectorPaths(vector: VectorProperties, from: number, to: number): VectorProperties;
|
|
184
|
+
/**
|
|
185
|
+
* Closest point on any segment; null without segments. Straight segments project exactly,
|
|
186
|
+
* curves sample 32 steps and then halve the step 24 times around the best sample.
|
|
187
|
+
*/
|
|
188
|
+
export declare function nearestVectorSegmentPoint(vector: VectorProperties, target: VectorPoint): {
|
|
189
|
+
path: number;
|
|
190
|
+
segment: number;
|
|
191
|
+
t: number;
|
|
192
|
+
point: VectorPoint;
|
|
193
|
+
distance: number;
|
|
194
|
+
} | null;
|
|
195
|
+
/** Closed sub-paths as polygons (corner rounding applied); open sub-paths are skipped. */
|
|
196
|
+
export declare function flattenVector(vector: VectorProperties, tolerance?: number): {
|
|
197
|
+
rings: VectorRing[];
|
|
198
|
+
fillRule: VectorFillRule;
|
|
199
|
+
};
|
|
200
|
+
/** Point containment using the fill rule, on the flattened geometry. */
|
|
201
|
+
export declare function vectorContainsPoint(vector: VectorProperties, target: VectorPoint, tolerance?: number): boolean;
|
|
202
|
+
/** Absolute sum of signed ring areas: exact for boolean results and simple shapes. */
|
|
203
|
+
export declare function vectorArea(vector: VectorProperties, tolerance?: number): number;
|
|
204
|
+
/**
|
|
205
|
+
* Polygon clipper on flattened rings. Every edge is split at every intersection (including
|
|
206
|
+
* collinear overlaps), duplicate edges are merged, and each remaining edge is classified by
|
|
207
|
+
* sampling a point on each side against both inputs with their fill rules. Edges whose sides
|
|
208
|
+
* disagree about the result form the boundary, oriented with the result on the left, and
|
|
209
|
+
* are chained into rings by taking the tightest turn at every vertex. Limits: O(n²) in the
|
|
210
|
+
* number of flattened edges, vertices within `VECTOR_MERGE_DISTANCE` are merged, and slivers
|
|
211
|
+
* thinner than twice `VECTOR_SIDE_SAMPLE` can be misclassified.
|
|
212
|
+
*/
|
|
213
|
+
export declare function booleanRings(a: readonly VectorRing[], aRule: VectorFillRule, b: readonly VectorRing[], bRule: VectorFillRule, operation: VectorBooleanOperation): VectorRing[];
|
|
214
|
+
/** Only identical paths or strictly separated exact bounds currently preserve curves. */
|
|
215
|
+
export declare function booleanVectorPrecision(a: VectorProperties, b: VectorProperties): 'curve-preserved' | 'polygon-approximation';
|
|
216
|
+
/** Boolean output keeps original cubic commands when equality or separated bounds proves
|
|
217
|
+
* the set operation. Intersecting or unproven geometry still uses the polygon approximation.
|
|
218
|
+
* Open sub-paths do not take part. The first operand supplies paint; an empty result has no paths.
|
|
219
|
+
*/
|
|
220
|
+
export declare function booleanVectors(a: VectorProperties, b: VectorProperties, operation: VectorBooleanOperation, tolerance?: number): VectorProperties;
|
|
221
|
+
/** World-space matrix of a node combined with the fit of its stored geometry onto its box. */
|
|
222
|
+
export declare function vectorRenderTransform(vector: VectorProperties, width: number, height: number, world?: DocumentMatrix): DocumentMatrix;
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { type CodegenFrameOptions, type CodegenNode } from './codegen.js';
|
|
2
2
|
import type { EditorDeclarations } from './declarations.js';
|
|
3
|
+
import type { BindingNodeContext, DataBindingDocument, DataCatalog } from '../binding/contracts.js';
|
|
3
4
|
import { type NodeJSON } from './store.js';
|
|
4
5
|
export declare const DESIGN_IR_SCHEMA: "pygmalion.design-ir";
|
|
5
6
|
export declare const DESIGN_IR_VERSION: 1;
|
|
@@ -181,6 +182,12 @@ export interface DesignCodegenAdapter {
|
|
|
181
182
|
generate(context: DesignCodegenAdapterContext): string | DesignCodegenAdapterOutput;
|
|
182
183
|
}
|
|
183
184
|
export interface DesignCompileOptions {
|
|
185
|
+
/** Dynamic documents use the structured binding source plan, never literal-prop output. */
|
|
186
|
+
bindings?: {
|
|
187
|
+
catalog: DataCatalog;
|
|
188
|
+
document: DataBindingDocument;
|
|
189
|
+
nodes: readonly BindingNodeContext[];
|
|
190
|
+
};
|
|
184
191
|
target?: string;
|
|
185
192
|
purpose?: DesignCompilePurpose;
|
|
186
193
|
force?: boolean;
|
|
@@ -63,6 +63,8 @@ export interface DesignScreenInteraction {
|
|
|
63
63
|
}
|
|
64
64
|
/** Timing policy for replaying a screen recipe outside the capture pipeline. */
|
|
65
65
|
export interface DesignScreenInteractionRunOptions {
|
|
66
|
+
/** Cancels waits and prevents subsequent recipe actions from reaching the document. */
|
|
67
|
+
signal?: AbortSignal;
|
|
66
68
|
/**
|
|
67
69
|
* Fallback pause after click, focus, hover, fill, check, and press steps.
|
|
68
70
|
* The capture default is 600ms. A step's explicit `settleMs` wins unless
|
|
@@ -92,6 +94,8 @@ export interface DesignScreenInteractionRunOptions {
|
|
|
92
94
|
*/
|
|
93
95
|
onAfterInteractions?: () => void | Promise<void>;
|
|
94
96
|
}
|
|
97
|
+
/** The existing recipe runners also operate inside an already mounted artifact. */
|
|
98
|
+
export type DesignScreenDocumentContext = Pick<HTMLIFrameElement, 'contentDocument' | 'contentWindow'>;
|
|
95
99
|
/** A JSON-compatible value that conveys host-specific meaning without Pygmalion interpreting it. */
|
|
96
100
|
export type DesignSerializable = string | number | boolean | null | readonly DesignSerializable[] | {
|
|
97
101
|
readonly [key: string]: DesignSerializable;
|
|
@@ -613,6 +617,9 @@ export declare function createDesignScreenCollection({ cases, scenarios, behavio
|
|
|
613
617
|
}): DesignScreenCollectionResult;
|
|
614
618
|
/** Host basic environment + override for each case. Objects are recursively merged and arrays/primitives are replaced by cases. */
|
|
615
619
|
export declare function mergeScreenPresets(defaults?: DesignScreenPreset, override?: DesignScreenPreset): DesignScreenPreset;
|
|
620
|
+
export declare function runScreenAssertions(iframe: DesignScreenDocumentContext, assertions: readonly DesignScreenAssertion[], options?: {
|
|
621
|
+
signal?: AbortSignal;
|
|
622
|
+
}): Promise<DesignScreenAssertionReport>;
|
|
616
623
|
export declare function createDesignImportController(manifest: DesignImportManifest, options?: CreateDesignImportOptions): DesignImportController;
|
|
617
624
|
/** The design import controller the host installed for one editor. */
|
|
618
625
|
export declare function createDesignImportRegistry(): {
|
|
@@ -144,6 +144,14 @@ export interface InspectMedia {
|
|
|
144
144
|
}
|
|
145
145
|
/** Source edit payload posted through a host-provided write-back endpoint. */
|
|
146
146
|
export interface InspectApplyPayload {
|
|
147
|
+
/** Optional exact source snapshot required by canonical document output. */
|
|
148
|
+
sourceProof?: {
|
|
149
|
+
sourceRevision: string;
|
|
150
|
+
files: readonly {
|
|
151
|
+
file: string;
|
|
152
|
+
sha256: string;
|
|
153
|
+
}[];
|
|
154
|
+
};
|
|
147
155
|
/** Final bundle of declarations per (scss file, local class). */
|
|
148
156
|
styles: {
|
|
149
157
|
file: string;
|
|
@@ -51,7 +51,7 @@ export interface RevisionCatalogPageCommit {
|
|
|
51
51
|
* previous revision's entry would make adoption and code generation lie about
|
|
52
52
|
* which component the selected checkout contains.
|
|
53
53
|
*/
|
|
54
|
-
export declare function bindRevisionComponentRegistry(manifest: Readonly<Record<string, Omit<RegistryEntry, 'component'>>> | undefined, hostRegistry: ComponentRegistry | undefined): ComponentRegistry | undefined;
|
|
54
|
+
export declare function bindRevisionComponentRegistry(manifest: Readonly<Record<string, Omit<RegistryEntry, 'component'>>> | undefined, hostRegistry: ComponentRegistry | undefined, hostLibraryComponents?: readonly string[]): ComponentRegistry | undefined;
|
|
55
55
|
/**
|
|
56
56
|
* Installs a catalog and its page commit as one recoverable boundary.
|
|
57
57
|
*
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { DesignScreenInteraction, DesignScreenInteractionRunOptions, DesignScreenInteractionReport } from './designImport.js';
|
|
1
|
+
import type { DesignScreenInteraction, DesignScreenInteractionRunOptions, DesignScreenInteractionReport, DesignScreenDocumentContext } from './designImport.js';
|
|
2
2
|
/**
|
|
3
3
|
* The pause after an action under the `live` settle policy: enough for the
|
|
4
4
|
* application's handlers and one paint, in place of the authored settle a
|
|
@@ -7,6 +7,6 @@ import type { DesignScreenInteraction, DesignScreenInteractionRunOptions, Design
|
|
|
7
7
|
export declare const LIVE_ACTION_SETTLE_MS = 80;
|
|
8
8
|
/** The most a timer-only wait keeps under the `live` settle policy. */
|
|
9
9
|
export declare const LIVE_TIMER_WAIT_CAP_MS = 250;
|
|
10
|
-
export declare function settleScreen(iframe:
|
|
10
|
+
export declare function settleScreen(iframe: DesignScreenDocumentContext, settleMs: number, signal?: AbortSignal): Promise<void>;
|
|
11
11
|
export declare function elementVisible(element: Element): boolean;
|
|
12
|
-
export declare function runScreenInteractions(iframe:
|
|
12
|
+
export declare function runScreenInteractions(iframe: DesignScreenDocumentContext, interactions: readonly DesignScreenInteraction[], options?: DesignScreenInteractionRunOptions): Promise<DesignScreenInteractionReport>;
|
|
@@ -16,7 +16,7 @@ import { type SharedSourceEditScope, type SharedSourceImpact } from './sharedSou
|
|
|
16
16
|
import { type DesignAssetEditRequest } from './assetEditing.js';
|
|
17
17
|
export type NodeType = 'rows' | 'columns' | 'text' | 'component';
|
|
18
18
|
/** Autolayout container type (with direction, gap, and alignment). */
|
|
19
|
-
export declare const isContainerType: (t: NodeType) => t is "
|
|
19
|
+
export declare const isContainerType: (t: NodeType) => t is "columns" | "rows";
|
|
20
20
|
/** Can contain child nodes — container + children:'nodes' components (Card, etc.). */
|
|
21
21
|
export declare const canHaveChildren: (declarations: Pick<EditorDeclarations, "getRegistry">, n: NodeModel) => boolean;
|
|
22
22
|
export type SizeMode = 'fill' | 'fit' | 'fixed';
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import { type CreateDesignImportOptions, type DesignImportController, type DesignImportManifest } from '../editor/designImport.js';
|
|
2
|
+
import { type PygmalionRevisionCatalog } from '../editor/revisionCatalog.js';
|
|
3
|
+
import type { WorkspaceConfiguration } from '../workspace/configuration.js';
|
|
4
|
+
export declare const PYGMALION_HOST_PROJECT_VERSION: 1;
|
|
5
|
+
/** Product declarations only. No editor session or executable mock handlers. */
|
|
6
|
+
export type PygmalionHostStoryboard = Omit<PygmalionRevisionCatalog, 'version' | 'namespace' | 'sourceRevision' | 'screens' | 'tokens' | 'componentRegistry' | 'componentConnections' | 'codegenProject'>;
|
|
7
|
+
export type PygmalionHostDesign = Pick<PygmalionRevisionCatalog, 'componentConnections' | 'codegenProject'>;
|
|
8
|
+
export interface PygmalionHostProjectDefinition {
|
|
9
|
+
version: typeof PYGMALION_HOST_PROJECT_VERSION;
|
|
10
|
+
/** Stable project identity, independent of a development server's port. */
|
|
11
|
+
id: string;
|
|
12
|
+
inventory: DesignImportManifest;
|
|
13
|
+
storyboard?: PygmalionHostStoryboard;
|
|
14
|
+
design?: PygmalionHostDesign;
|
|
15
|
+
/** Opaque product state is interpreted only by these host executors. */
|
|
16
|
+
reproduction?: Pick<CreateDesignImportOptions, 'executeScreenPreset' | 'executeDesiredState' | 'stability'>;
|
|
17
|
+
presentation?: Pick<CreateDesignImportOptions, 'screensCanvasPartition' | 'layerOptions'>;
|
|
18
|
+
/** Source/document and data adapters used only by the browser workspace. */
|
|
19
|
+
workspace?: WorkspaceConfiguration;
|
|
20
|
+
}
|
|
21
|
+
export interface PygmalionHostProject {
|
|
22
|
+
readonly version: typeof PYGMALION_HOST_PROJECT_VERSION;
|
|
23
|
+
readonly id: string;
|
|
24
|
+
readonly definition: PygmalionHostProjectDefinition;
|
|
25
|
+
readonly designImport: DesignImportController;
|
|
26
|
+
readonly editorProps: PygmalionHostStoryboard & PygmalionHostDesign & {
|
|
27
|
+
designImport: DesignImportController;
|
|
28
|
+
workspace?: WorkspaceConfiguration;
|
|
29
|
+
};
|
|
30
|
+
}
|
|
31
|
+
/** Owns the assembly shared by the browser editor and offline catalog jobs. */
|
|
32
|
+
export declare function createPygmalionHostProject(input: PygmalionHostProjectDefinition): PygmalionHostProject;
|
|
33
|
+
/**
|
|
34
|
+
* One-way projection from the same host definition, preserving the existing
|
|
35
|
+
* wire format. Executable adapters and React implementations never cross it.
|
|
36
|
+
*/
|
|
37
|
+
export declare function createPygmalionRevisionCatalog(project: PygmalionHostProject, identity: {
|
|
38
|
+
sourceRevision: string;
|
|
39
|
+
namespace?: string;
|
|
40
|
+
}): PygmalionRevisionCatalog;
|
|
41
|
+
/** Project and legacy declarations cannot silently compete for ownership. */
|
|
42
|
+
export declare function resolvePygmalionProjectProps<T extends {
|
|
43
|
+
project?: PygmalionHostProject;
|
|
44
|
+
}>(props: T): Omit<T, 'project'> & Partial<PygmalionHostProject['editorProps']>;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { DesignComponentConnectionDef } from '../editor/componentConnections.js';
|
|
2
|
+
import type { ComponentRegistry } from '../editor/registry.js';
|
|
3
|
+
export interface DesignRegistryInventoryEntry {
|
|
4
|
+
name: string;
|
|
5
|
+
kind: string;
|
|
6
|
+
source: string;
|
|
7
|
+
}
|
|
8
|
+
/** Portable inference from literal registry props; product vocabularies stay in the host. */
|
|
9
|
+
export declare function createDesignRegistryConnections(inventory: readonly DesignRegistryInventoryEntry[], registry: ComponentRegistry, options?: {
|
|
10
|
+
missing?: 'error' | 'skip';
|
|
11
|
+
}): DesignComponentConnectionDef[];
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/** Complete text-file changes compiled by a trusted host source adapter. */
|
|
2
|
+
export interface SourceFilePlan {
|
|
3
|
+
version: 1;
|
|
4
|
+
sourceRevision: string;
|
|
5
|
+
/** Null proves that a new source file does not exist yet. */
|
|
6
|
+
proofs: {
|
|
7
|
+
file: string;
|
|
8
|
+
sha256: string | null;
|
|
9
|
+
}[];
|
|
10
|
+
changes: {
|
|
11
|
+
file: string;
|
|
12
|
+
beforeSha256: string | null;
|
|
13
|
+
content: string;
|
|
14
|
+
}[];
|
|
15
|
+
}
|