@pygmalionjs/pygmalion 0.14.0 → 0.16.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 +22 -0
- package/dist-lib/{CameraLayer-CGW_FPQS.js → CameraLayer-BNw26sgR.js} +10 -10
- package/dist-lib/pygmalion.js +16093 -14331
- package/dist-lib/{runtime-DkCf4iKe.js → runtime-Bo5tncK_.js} +1919 -1878
- package/dist-lib/style.css +1 -1
- package/dist-lib/testing.js +8 -8
- package/dist-lib/types/document/appearance.d.ts +5 -2
- package/dist-lib/types/document/assets.d.ts +12 -4
- package/dist-lib/types/document/imagePaintGeometry.d.ts +23 -0
- package/dist-lib/types/document/pages.d.ts +48 -0
- package/dist-lib/types/document/pagesMetadata.d.ts +16 -0
- package/dist-lib/types/document/richText.d.ts +10 -0
- package/dist-lib/types/document/textFontPreparation.d.ts +36 -0
- package/dist-lib/types/lib.d.ts +11 -1
- package/dist-lib/types/workspace/configuration.d.ts +3 -0
- package/dist-lib/types/workspace/contracts.d.ts +6 -0
- package/dist-lib/types/workspace/controller.d.ts +1 -0
- package/dist-lib/types/workspace/edit/ArrangeLayers.d.ts +2 -1
- package/dist-lib/types/workspace/edit/AssetsPanel.d.ts +3 -2
- package/dist-lib/types/workspace/edit/CanvasGuides.d.ts +6 -3
- package/dist-lib/types/workspace/edit/EditViewport.d.ts +6 -0
- package/dist-lib/types/workspace/edit/EditorCommandMenu.d.ts +18 -0
- package/dist-lib/types/workspace/edit/ImageCropEditor.d.ts +13 -0
- package/dist-lib/types/workspace/edit/LayerTree.d.ts +5 -1
- package/dist-lib/types/workspace/edit/LayoutPanel.d.ts +2 -1
- package/dist-lib/types/workspace/edit/NodeExportPanel.d.ts +10 -0
- package/dist-lib/types/workspace/edit/PagesPanel.d.ts +12 -0
- package/dist-lib/types/workspace/edit/PanelResizeHandle.d.ts +12 -0
- package/dist-lib/types/workspace/edit/PrototypePanel.d.ts +5 -1
- package/dist-lib/types/workspace/edit/PrototypeWiring.d.ts +18 -0
- package/dist-lib/types/workspace/edit/SelectionHandles.d.ts +8 -4
- package/dist-lib/types/workspace/edit/TextEditor.d.ts +7 -1
- package/dist-lib/types/workspace/edit/canvasGuideModel.d.ts +16 -0
- package/dist-lib/types/workspace/edit/clipboard.d.ts +1 -0
- package/dist-lib/types/workspace/edit/editorCanvas.d.ts +1 -1
- package/dist-lib/types/workspace/edit/geometryHandles.d.ts +10 -3
- package/dist-lib/types/workspace/edit/prototypeWiringModel.d.ts +47 -0
- package/dist-lib/types/workspace/edit/rasterExport.d.ts +5 -0
- package/dist-lib/types/workspace/edit/textFontOccurrences.d.ts +34 -0
- package/dist-lib/types/workspace/edit/textFontRuntime.d.ts +15 -0
- package/dist-lib/types/workspace/edit/useTextFontPreparation.d.ts +12 -0
- package/dist-lib/types/workspace/view/prototypeMotionInterruption.d.ts +47 -0
- package/dist-lib/types/workspace/view/prototypePlayback.d.ts +8 -0
- package/dist-lib/types/workspace/view/storyboardCanvas.d.ts +16 -1
- package/package.json +1 -1
|
@@ -73,7 +73,7 @@ export interface SnapGap {
|
|
|
73
73
|
export interface SnapGuide {
|
|
74
74
|
readonly axis: 'x' | 'y';
|
|
75
75
|
readonly position: number;
|
|
76
|
-
/** `edge` and `center` come from boxes, `guide` from persisted guides, `grid` from layout
|
|
76
|
+
/** `edge` and `center` come from boxes, `guide` from persisted guides, `grid` from layout grids, `spacing` from equal sibling distances. */
|
|
77
77
|
readonly kind: 'edge' | 'center' | 'guide' | 'grid' | 'spacing';
|
|
78
78
|
readonly nodeId: string;
|
|
79
79
|
/** Extent along the other axis, for drawing the guide line; equal values mean "the moving box only". */
|
|
@@ -83,6 +83,11 @@ export interface SnapGuide {
|
|
|
83
83
|
readonly reference?: SnapReference;
|
|
84
84
|
/** The equal distances a `spacing` candidate reproduces, for drawing. */
|
|
85
85
|
readonly gaps?: readonly SnapGap[];
|
|
86
|
+
/** Candidate-only pixel lattice, starting at `position`; resolved feedback never contains this field. */
|
|
87
|
+
readonly lattice?: {
|
|
88
|
+
readonly step: number;
|
|
89
|
+
readonly extent: number;
|
|
90
|
+
};
|
|
86
91
|
}
|
|
87
92
|
export interface SnapResult {
|
|
88
93
|
readonly dx: number;
|
|
@@ -90,6 +95,8 @@ export interface SnapResult {
|
|
|
90
95
|
readonly guides: readonly SnapGuide[];
|
|
91
96
|
}
|
|
92
97
|
export interface SnapCandidateOptions {
|
|
98
|
+
/** Ordinary root layers visible on the current page; undefined retains the complete scene. */
|
|
99
|
+
readonly visibleRootIds?: readonly string[];
|
|
93
100
|
/** Include the moving layers' own children: right for a resize, wrong for a move (the children travel along). */
|
|
94
101
|
readonly children?: boolean;
|
|
95
102
|
}
|
|
@@ -105,7 +112,7 @@ export interface MoveSnapSession {
|
|
|
105
112
|
* refused with a diagnostic instead of guessed bounds. Derived sizes keep move and
|
|
106
113
|
* rotation but drop the resize handles.
|
|
107
114
|
*/
|
|
108
|
-
export declare function planSelectionHandles(document: DesignDocument, nodeIds: readonly string[], projection: DataProjection | null): SelectionHandlesPlan;
|
|
115
|
+
export declare function planSelectionHandles(document: DesignDocument, nodeIds: readonly string[], projection: DataProjection | null, options?: SnapCandidateOptions): SelectionHandlesPlan;
|
|
109
116
|
export declare function layerResizeHandles(layer: Pick<LayerGeometry, 'resizable' | 'resizeAxes'>): readonly GeometryHandle[];
|
|
110
117
|
/**
|
|
111
118
|
* Turn a handle drag into a new local size and placement. The handle's opposite edge or
|
|
@@ -202,7 +209,7 @@ export declare function snapResizeGesture(layer: LayerPlacement & {
|
|
|
202
209
|
* Snapshot for a move gesture: the moving box, its candidates (siblings, parent, guides, grids,
|
|
203
210
|
* and equal sibling distances for this box size), and the zoom-aware tolerance.
|
|
204
211
|
*/
|
|
205
|
-
export declare function beginMoveSnap(document: DesignDocument, nodeIds: readonly string[], projection: DataProjection | null, zoom: number): MoveSnapSession | null;
|
|
212
|
+
export declare function beginMoveSnap(document: DesignDocument, nodeIds: readonly string[], projection: DataProjection | null, zoom: number, options?: SnapCandidateOptions): MoveSnapSession | null;
|
|
206
213
|
/** Adjust world pointer travel so the moving box snaps; exact in one pass because only translation changes. */
|
|
207
214
|
export declare function snapMove(session: MoveSnapSession, delta: {
|
|
208
215
|
x: number;
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import type { DataProjection } from '../../binding/preview.js';
|
|
2
|
+
import type { DesignDocument, DocumentTransaction } from '../../document/contracts.js';
|
|
3
|
+
import { type PrototypeAction, type PrototypeInteraction } from '../../document/prototype.js';
|
|
4
|
+
export type PrototypeActionPath = readonly (number | 'branches' | 'actions' | 'otherwise')[];
|
|
5
|
+
export interface PrototypeConnectionSelection {
|
|
6
|
+
nodeId: string;
|
|
7
|
+
interactionId: string;
|
|
8
|
+
actionPath: PrototypeActionPath;
|
|
9
|
+
}
|
|
10
|
+
export interface PrototypeConnection extends PrototypeConnectionSelection {
|
|
11
|
+
destinationId: string;
|
|
12
|
+
action: PrototypeAction;
|
|
13
|
+
label: string;
|
|
14
|
+
}
|
|
15
|
+
export interface WiringPoint {
|
|
16
|
+
x: number;
|
|
17
|
+
y: number;
|
|
18
|
+
}
|
|
19
|
+
export interface WiringBounds extends WiringPoint {
|
|
20
|
+
width: number;
|
|
21
|
+
height: number;
|
|
22
|
+
}
|
|
23
|
+
export interface PrototypeWiringLayer {
|
|
24
|
+
nodeId: string;
|
|
25
|
+
name: string;
|
|
26
|
+
bounds: WiringBounds;
|
|
27
|
+
rootId: string;
|
|
28
|
+
visible: boolean;
|
|
29
|
+
}
|
|
30
|
+
export interface PrototypeWiringPlan {
|
|
31
|
+
layers: readonly PrototypeWiringLayer[];
|
|
32
|
+
diagnostics: readonly string[];
|
|
33
|
+
}
|
|
34
|
+
export declare const connectionKey: (value: PrototypeConnectionSelection) => string;
|
|
35
|
+
/** Only explicit destination actions become wires. No flow or action is inferred. */
|
|
36
|
+
export declare function prototypeConnections(document: DesignDocument): PrototypeConnection[];
|
|
37
|
+
/** Canonical, uniquely placed layers only; projected rows and instance leaves cannot acquire shared actions accidentally. */
|
|
38
|
+
export declare function planPrototypeWiring(document: DesignDocument, projection: DataProjection | null, selected?: readonly string[], visibleRootIds?: readonly string[]): PrototypeWiringPlan;
|
|
39
|
+
/** Builds a complete detached edit before the caller opens its single history transaction. */
|
|
40
|
+
export declare function preparePrototypeConnection(document: DesignDocument, sourceId: string, destinationId: string | null, selection?: PrototypeConnectionSelection, interactionId?: string): PrototypeInteraction[];
|
|
41
|
+
export declare function writePrototypeConnection(transaction: DocumentTransaction, document: DesignDocument, sourceId: string, interactions: readonly PrototypeInteraction[]): void;
|
|
42
|
+
export declare function prototypeWireCurve(source: WiringBounds, target: WiringBounds, lane: number, zoom: number, loop?: boolean): {
|
|
43
|
+
path: string;
|
|
44
|
+
start: WiringPoint;
|
|
45
|
+
end: WiringPoint;
|
|
46
|
+
middle: WiringPoint;
|
|
47
|
+
};
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { type RasterExportRenderer, type RasterExportRequest } from '../../document/exportSettings.js';
|
|
2
|
+
/** The same supported SVG geometry supplies browser raster output; unsupported visuals stay explicit. */
|
|
3
|
+
export declare function rasterExportSvg(request: RasterExportRequest): string;
|
|
4
|
+
/** Explicit browser renderer for supported geometry. It never captures a page or fetches external resources. */
|
|
5
|
+
export declare const renderDesignRaster: RasterExportRenderer;
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import type { DesignDocument, DocumentResolveOptions } from '../../document/contracts.js';
|
|
2
|
+
import type { DataProjection } from '../../binding/preview.js';
|
|
3
|
+
import { type TextFontFaceRequest } from '../../document/richText.js';
|
|
4
|
+
import { type ProjectedDocumentNode } from './projection.js';
|
|
5
|
+
export interface TextFontAddress {
|
|
6
|
+
readonly sourceNodeId: string;
|
|
7
|
+
readonly instancePath: readonly string[];
|
|
8
|
+
readonly rowPath: ProjectedDocumentNode['rowPath'];
|
|
9
|
+
}
|
|
10
|
+
export interface TextFontOccurrence extends TextFontAddress {
|
|
11
|
+
readonly origin: 'authored' | 'source' | 'bound';
|
|
12
|
+
readonly requests: readonly TextFontFaceRequest[];
|
|
13
|
+
}
|
|
14
|
+
export interface TextFontCollection {
|
|
15
|
+
readonly occurrences: readonly TextFontOccurrence[];
|
|
16
|
+
readonly diagnostics: readonly {
|
|
17
|
+
readonly code: string;
|
|
18
|
+
readonly message: string;
|
|
19
|
+
readonly address?: TextFontAddress;
|
|
20
|
+
}[];
|
|
21
|
+
}
|
|
22
|
+
export interface TextFontCollectionOptions {
|
|
23
|
+
readonly projection?: DataProjection | null;
|
|
24
|
+
readonly resolveOptions?: DocumentResolveOptions;
|
|
25
|
+
/** Supply the same resolved scene the canvas uses, when it has custom resolution. */
|
|
26
|
+
readonly scene?: ProjectedDocumentNode;
|
|
27
|
+
readonly visibleRootIds?: readonly string[];
|
|
28
|
+
readonly subtree?: TextFontAddress;
|
|
29
|
+
/** Required for connected/source content or case-transformed samples. It must describe rendered text. */
|
|
30
|
+
readonly resolveText?: (item: ProjectedDocumentNode, address: TextFontAddress) => string | undefined;
|
|
31
|
+
}
|
|
32
|
+
export declare const textFontAddressKey: (address: TextFontAddress) => string;
|
|
33
|
+
/** Read-only effective occurrences; hidden pages/rows and unselected shared definitions do not preload. */
|
|
34
|
+
export declare function collectTextFontOccurrences(document: DesignDocument, options?: TextFontCollectionOptions): TextFontCollection;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { type TextFontFaceResolver, type TextFontPreparationReport } from '../../document/textFontPreparation.js';
|
|
2
|
+
import type { TextFontFaceRequest } from '../../document/richText.js';
|
|
3
|
+
export interface TextFontPreparationRuntime {
|
|
4
|
+
readonly environmentId: string;
|
|
5
|
+
prepare(requests: readonly TextFontFaceRequest[], options?: {
|
|
6
|
+
signal?: AbortSignal;
|
|
7
|
+
retry?: boolean;
|
|
8
|
+
}): Promise<TextFontPreparationReport>;
|
|
9
|
+
clear(): void;
|
|
10
|
+
dispose(): void;
|
|
11
|
+
}
|
|
12
|
+
/** A bounded successful-result cache with shared in-flight work and independently cancellable readers. */
|
|
13
|
+
export declare function createTextFontPreparationRuntime(resolver: TextFontFaceResolver, options?: {
|
|
14
|
+
maxEntries?: number;
|
|
15
|
+
}): TextFontPreparationRuntime;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { DesignDocument, DocumentNode } from '../../document/contracts.js';
|
|
2
|
+
import type { TextFontPreparationReport } from '../../document/textFontPreparation.js';
|
|
3
|
+
import { type TextFontCollection } from './textFontOccurrences.js';
|
|
4
|
+
import type { TextFontPreparationRuntime } from './textFontRuntime.js';
|
|
5
|
+
export interface TextFontPreparationState {
|
|
6
|
+
readonly status: 'idle' | 'loading' | 'ready' | 'unavailable' | 'failed';
|
|
7
|
+
readonly messages: readonly string[];
|
|
8
|
+
readonly report?: TextFontPreparationReport;
|
|
9
|
+
retry(): void;
|
|
10
|
+
}
|
|
11
|
+
/** Exact readiness is opt-in; legacy font-set loading never becomes an identity attestation. */
|
|
12
|
+
export declare function useTextFontPreparation(document: DesignDocument, node: DocumentNode, runtime?: TextFontPreparationRuntime | null, supplied?: TextFontCollection): TextFontPreparationState;
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import type { PrototypeTransition } from '../../document/prototype.js';
|
|
2
|
+
export declare const prototypeMotionProperties: readonly ["transform", "width", "height", "opacity", "backgroundColor", "borderRadius"];
|
|
3
|
+
export type PrototypeMotionProperty = typeof prototypeMotionProperties[number];
|
|
4
|
+
export type PrototypeMotionStyles = Record<PrototypeMotionProperty, string>;
|
|
5
|
+
export interface PrototypeMotionCapture {
|
|
6
|
+
styles: PrototypeMotionStyles;
|
|
7
|
+
velocity: Partial<Record<PrototypeMotionProperty, readonly number[]>>;
|
|
8
|
+
}
|
|
9
|
+
export interface PrototypeMotionRecord {
|
|
10
|
+
element: HTMLElement;
|
|
11
|
+
animation: Animation;
|
|
12
|
+
frames: readonly Keyframe[];
|
|
13
|
+
durationMs: number;
|
|
14
|
+
easing(progress: number): number;
|
|
15
|
+
}
|
|
16
|
+
/** Mirrors the bounded CSS linear() samples used by the physical spring renderer. */
|
|
17
|
+
export declare function prototypeMotionTiming(transition: PrototypeTransition, durationMs: number): (progress: number) => number;
|
|
18
|
+
/** Reads presentation once. No time seeks, inline-style writes, frame history or DOM mutations. */
|
|
19
|
+
export declare function capturePrototypeMotionStyles(elements: readonly HTMLElement[], records: readonly PrototypeMotionRecord[], drag?: {
|
|
20
|
+
progress: number;
|
|
21
|
+
velocity: number;
|
|
22
|
+
} | null): Map<HTMLElement, PrototypeMotionCapture>;
|
|
23
|
+
export interface PrototypeInterruptedTiming {
|
|
24
|
+
readonly samples: readonly {
|
|
25
|
+
offset: number;
|
|
26
|
+
progress: number;
|
|
27
|
+
velocityResponse: number;
|
|
28
|
+
}[];
|
|
29
|
+
readonly initialSlope: number;
|
|
30
|
+
}
|
|
31
|
+
/** One shared timing table per interrupted transition, never one solver per layer/channel. */
|
|
32
|
+
export declare function createPrototypeInterruptedTiming(transition: PrototypeTransition, durationMs: number): PrototypeInterruptedTiming;
|
|
33
|
+
interface PrototypeInterruptedFrames {
|
|
34
|
+
frames: Keyframe[];
|
|
35
|
+
unsupported: PrototypeMotionProperty[];
|
|
36
|
+
}
|
|
37
|
+
interface PrototypeInterruptedFramePlannerOptions {
|
|
38
|
+
maxTracks?: number;
|
|
39
|
+
maxBytes?: number;
|
|
40
|
+
}
|
|
41
|
+
/** A single preparation pass owns this cache; it retains no DOM, captures or animation records.
|
|
42
|
+
* Limits bound cached track count and UTF-16 string payload bytes, not total JavaScript heap size.
|
|
43
|
+
* Returned frames are detached even when their immutable property strings are reused. */
|
|
44
|
+
export declare function createPrototypeInterruptedFramePlanner(inputTiming: PrototypeInterruptedTiming, options?: PrototypeInterruptedFramePlannerOptions): (captured: PrototypeMotionCapture, target: Partial<PrototypeMotionStyles>) => PrototypeInterruptedFrames;
|
|
45
|
+
/** Existing computed 2D/px/RGB tracks only. Unsupported values retain explicit diagnostics. */
|
|
46
|
+
export declare function createPrototypeInterruptedFrames(captured: PrototypeMotionCapture, target: Partial<PrototypeMotionStyles>, timing: PrototypeInterruptedTiming): PrototypeInterruptedFrames;
|
|
47
|
+
export {};
|
|
@@ -27,9 +27,17 @@ export interface PrototypePlayerOptions extends PrototypeStartOptions {
|
|
|
27
27
|
/** Effects describe intended links and scrolling; the adapter decides how to execute them. */
|
|
28
28
|
onEffect?(effect: PrototypeEffect): void;
|
|
29
29
|
}
|
|
30
|
+
export interface PrototypeTransitionChange {
|
|
31
|
+
previous: PrototypePlayerSnapshot;
|
|
32
|
+
next: PrototypeState;
|
|
33
|
+
interrupted: boolean;
|
|
34
|
+
reset: boolean;
|
|
35
|
+
}
|
|
30
36
|
export interface PrototypePlayerController {
|
|
31
37
|
getSnapshot(): PrototypePlayerSnapshot;
|
|
32
38
|
subscribe(listener: () => void): () => void;
|
|
39
|
+
/** Capture presentation before the old scene is replaced. Exceptions become diagnostics. */
|
|
40
|
+
subscribeBeforeTransition(listener: (change: PrototypeTransitionChange) => void): () => void;
|
|
33
41
|
dispatch(event: PrototypeEvent): void;
|
|
34
42
|
beginDrag(input: Omit<PrototypeDragStartInput, 'now'>): boolean;
|
|
35
43
|
updateDrag(input: Pick<PrototypeDragStartInput, 'pointerId' | 'point'>): void;
|
|
@@ -16,14 +16,25 @@ export interface StoryboardArtboard extends StoryboardBounds {
|
|
|
16
16
|
screenId: string;
|
|
17
17
|
group: string;
|
|
18
18
|
}
|
|
19
|
+
export interface StoryboardPoint {
|
|
20
|
+
x: number;
|
|
21
|
+
y: number;
|
|
22
|
+
}
|
|
19
23
|
export interface StoryboardConnection {
|
|
20
24
|
edge: StoryboardGraphEdge;
|
|
21
25
|
from: StoryboardArtboard;
|
|
22
26
|
to: StoryboardArtboard;
|
|
23
27
|
path: string;
|
|
28
|
+
points: readonly StoryboardPoint[];
|
|
24
29
|
labelX: number;
|
|
25
30
|
labelY: number;
|
|
26
31
|
}
|
|
32
|
+
export interface StoryboardExternalConnection {
|
|
33
|
+
edge: StoryboardGraphEdge;
|
|
34
|
+
frame: StoryboardArtboard;
|
|
35
|
+
page: PageModel;
|
|
36
|
+
direction: 'incoming' | 'outgoing';
|
|
37
|
+
}
|
|
27
38
|
export declare const storyboardFlow: (page: PageModel) => string;
|
|
28
39
|
/** Arrange source-sized screens in flow lanes; never rewrite authored page geometry. */
|
|
29
40
|
export declare function layoutStoryboard(pages: readonly PageModel[]): {
|
|
@@ -38,5 +49,9 @@ export declare function zoomStoryboard(camera: WorkspaceCamera, point: {
|
|
|
38
49
|
y: number;
|
|
39
50
|
}, requested: number): WorkspaceCamera;
|
|
40
51
|
export declare function visibleStoryboardFrames(frames: readonly StoryboardArtboard[], camera: WorkspaceCamera, viewport: StoryboardViewport): StoryboardArtboard[];
|
|
41
|
-
/** A line means an authored transition.
|
|
52
|
+
/** A line means an authored transition. Routing and proximity never create or reorder an edge. */
|
|
42
53
|
export declare function storyboardConnections(frames: readonly StoryboardArtboard[], graph: StoryboardGraph | null): StoryboardConnection[];
|
|
54
|
+
/** Portals expose real endpoints filtered from the canvas, only when available in the active catalog. */
|
|
55
|
+
export declare function storyboardExternalConnections(frames: readonly StoryboardArtboard[], graph: StoryboardGraph | null, pages: readonly PageModel[]): StoryboardExternalConnection[];
|
|
56
|
+
/** Include connector lanes in Overview without changing the authored artboard layout. */
|
|
57
|
+
export declare function storyboardConnectionBounds(bounds: StoryboardBounds, connections: readonly StoryboardConnection[]): StoryboardBounds;
|