@pygmalionjs/pygmalion 0.17.0 → 0.19.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 +71 -0
- package/dist-lib/{CameraLayer-Clqgdcjb.js → CameraLayer-Bv1TqRim.js} +1 -1
- package/dist-lib/pygmalion.js +17841 -16123
- package/dist-lib/{runtime-B8Qu1ung.js → runtime-DlZpODq8.js} +45 -45
- package/dist-lib/style.css +1 -1
- package/dist-lib/testing.js +5 -5
- package/dist-lib/types/document/textLayout.d.ts +77 -0
- package/dist-lib/types/lib.d.ts +11 -1
- package/dist-lib/types/token-library/bindings.d.ts +44 -0
- package/dist-lib/types/workspace/edit/ArrangeLayers.d.ts +5 -1
- package/dist-lib/types/workspace/edit/CanvasGuides.d.ts +5 -1
- package/dist-lib/types/workspace/edit/ClipboardRelationshipDialog.d.ts +21 -0
- package/dist-lib/types/workspace/edit/PrototypeWiring.d.ts +4 -0
- package/dist-lib/types/workspace/edit/SelectionHandles.d.ts +10 -2
- package/dist-lib/types/workspace/edit/VectorEditor.d.ts +12 -1
- package/dist-lib/types/workspace/edit/clipboard.d.ts +1 -0
- package/dist-lib/types/workspace/edit/clipboardGraph.d.ts +9 -0
- package/dist-lib/types/workspace/edit/clipboardPrototype.d.ts +55 -0
- package/dist-lib/types/workspace/edit/clipboardStyles.d.ts +46 -0
- package/dist-lib/types/workspace/edit/clipboardTransfer.d.ts +38 -0
- package/dist-lib/types/workspace/edit/editorCanvas.d.ts +6 -1
- package/dist-lib/types/workspace/edit/geometryHandles.d.ts +13 -1
- package/dist-lib/types/workspace/edit/layerArrangement.d.ts +4 -1
- package/dist-lib/types/workspace/edit/preparedTextFace.d.ts +31 -0
- package/dist-lib/types/workspace/edit/projection.d.ts +23 -1
- package/dist-lib/types/workspace/edit/prototypeWiringModel.d.ts +2 -1
- package/dist-lib/types/workspace/edit/staticTextRaster.d.ts +4 -15
- package/dist-lib/types/workspace/edit/textLayoutBrowser.d.ts +3 -0
- package/dist-lib/types/workspace/edit/textLayoutPlan.d.ts +12 -0
- package/dist-lib/types/workspace/edit/textLayoutProjection.d.ts +28 -0
- package/dist-lib/types/workspace/edit/textLayoutRuntime.d.ts +20 -0
- package/dist-lib/types/workspace/edit/useDesignClipboardPaste.d.ts +19 -0
- package/dist-lib/types/workspace/edit/useTextLayout.d.ts +19 -0
- package/dist-lib/types/workspace/edit/vectorTools.d.ts +9 -5
- package/package.json +1 -1
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import type { DataProjection } from '../../binding/preview.js';
|
|
2
2
|
import type { DesignDocument, DocumentTransaction } from '../../document/contracts.js';
|
|
3
3
|
import { type PrototypeAction, type PrototypeInteraction } from '../../document/prototype.js';
|
|
4
|
+
import { type ProjectedDocumentNode } from './projection.js';
|
|
4
5
|
export type PrototypeActionPath = readonly (number | 'branches' | 'actions' | 'otherwise')[];
|
|
5
6
|
export interface PrototypeConnectionSelection {
|
|
6
7
|
nodeId: string;
|
|
@@ -35,7 +36,7 @@ export declare const connectionKey: (value: PrototypeConnectionSelection) => str
|
|
|
35
36
|
/** Only explicit destination actions become wires. No flow or action is inferred. */
|
|
36
37
|
export declare function prototypeConnections(document: DesignDocument): PrototypeConnection[];
|
|
37
38
|
/** 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
|
+
export declare function planPrototypeWiring(document: DesignDocument, projection: DataProjection | null, selected?: readonly string[], visibleRootIds?: readonly string[], scene?: ProjectedDocumentNode): PrototypeWiringPlan;
|
|
39
40
|
/** Builds a complete detached edit before the caller opens its single history transaction. */
|
|
40
41
|
export declare function preparePrototypeConnection(document: DesignDocument, sourceId: string, destinationId: string | null, selection?: PrototypeConnectionSelection, interactionId?: string): PrototypeInteraction[];
|
|
41
42
|
export declare function writePrototypeConnection(transaction: DocumentTransaction, document: DesignDocument, sourceId: string, interactions: readonly PrototypeInteraction[]): void;
|
|
@@ -1,16 +1,9 @@
|
|
|
1
1
|
import { type RasterExportRequest } from '../../document/exportSettings.js';
|
|
2
2
|
import { type TextFontFaceRequest } from '../../document/richText.js';
|
|
3
3
|
import type { TextFontPreparationRuntime } from './textFontRuntime.js';
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
readonly family: string;
|
|
8
|
-
readonly weight: number;
|
|
9
|
-
readonly style: 'normal' | 'italic';
|
|
10
|
-
readonly sample: string;
|
|
11
|
-
}
|
|
12
|
-
/** The owner maps its exact prepared identity to the same FontFace object registered for drawing. */
|
|
13
|
-
export type TextRasterFaceResolver = (reference: PreparedTextRasterFaceReference) => FontFace | undefined;
|
|
4
|
+
import { type PreparedTextFaceResolver } from './preparedTextFace.js';
|
|
5
|
+
export { supportsPreparedTextFace as supportsStaticTextFace, preparedTextFaceCoversSample as staticTextFaceCoversSample } from './preparedTextFace.js';
|
|
6
|
+
export type { PreparedTextFaceReference as PreparedTextRasterFaceReference, PreparedTextFaceResolver as TextRasterFaceResolver } from './preparedTextFace.js';
|
|
14
7
|
export interface StaticTextRasterPlan {
|
|
15
8
|
readonly nodeId: string;
|
|
16
9
|
readonly width: number;
|
|
@@ -28,10 +21,6 @@ export interface StaticTextRasterPlan {
|
|
|
28
21
|
export declare function createStaticTextRasterPlan(request: RasterExportRequest, options?: {
|
|
29
22
|
sourceMapped?: boolean;
|
|
30
23
|
}): StaticTextRasterPlan;
|
|
31
|
-
/** Registered face descriptors must support the requested style and weight without synthesis. */
|
|
32
|
-
export declare function supportsStaticTextFace(face: Pick<FontFace, 'family' | 'style' | 'weight' | 'stretch' | 'status'>, family: string, request: TextFontFaceRequest): boolean;
|
|
33
|
-
/** Registered unicode-range restrictions are distinct from the provider's glyph-coverage attestation. */
|
|
34
|
-
export declare function staticTextFaceCoversSample(unicodeRange: string, sample: string): boolean;
|
|
35
24
|
/** Matches the SVG renderer's default xMidYMid meet behavior after output dimension rounding. */
|
|
36
25
|
export declare function staticTextRasterViewport(plan: Pick<StaticTextRasterPlan, 'width' | 'height' | 'outputWidth' | 'outputHeight'>): {
|
|
37
26
|
scale: number;
|
|
@@ -46,5 +35,5 @@ export declare function measureStaticTextRaster(plan: StaticTextRasterPlan, fami
|
|
|
46
35
|
/** A ready explicit provider plus a registered browser face is required; platform fallback checks are insufficient. */
|
|
47
36
|
export declare function renderStaticTextRaster(request: RasterExportRequest, runtime: TextFontPreparationRuntime, options?: {
|
|
48
37
|
sourceMapped?: boolean;
|
|
49
|
-
resolvePreparedFace?:
|
|
38
|
+
resolvePreparedFace?: PreparedTextFaceResolver;
|
|
50
39
|
}): Promise<Uint8Array>;
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import { type TextLayoutGeometry, type TextLayoutPlan } from '../../document/textLayout.js';
|
|
2
|
+
/** Reads a fully shaped native paragraph. No character is drawn or laid out independently. */
|
|
3
|
+
export declare function measureBrowserTextLayout(plan: TextLayoutPlan, family: string, owner: Document, signal?: AbortSignal): TextLayoutGeometry;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { DesignDocument } from '../../document/contracts.js';
|
|
2
|
+
import { type TextLayoutAddress, type TextLayoutPlan } from '../../document/textLayout.js';
|
|
3
|
+
import { type ProjectedDocumentNode } from './projection.js';
|
|
4
|
+
export interface TextLayoutPlanOptions {
|
|
5
|
+
readonly revisionKey: string;
|
|
6
|
+
readonly address: TextLayoutAddress;
|
|
7
|
+
readonly scene?: ProjectedDocumentNode;
|
|
8
|
+
readonly visibleRootIds?: readonly string[];
|
|
9
|
+
readonly sourceMapped?: boolean;
|
|
10
|
+
}
|
|
11
|
+
/** Selects one visible effective occurrence without changing canonical geometry or rewriting IDs. */
|
|
12
|
+
export declare function createTextLayoutPlan(document: DesignDocument, options: TextLayoutPlanOptions): TextLayoutPlan;
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import type { DataProjection } from '../../binding/preview.js';
|
|
2
|
+
import type { DesignDocument, DocumentDiagnostic } from '../../document/contracts.js';
|
|
3
|
+
import { type ProjectedDocumentNode, type ProjectedTextLayout } from './projection.js';
|
|
4
|
+
import type { TextLayoutRuntime } from './textLayoutRuntime.js';
|
|
5
|
+
export interface TextLayoutSceneOptions {
|
|
6
|
+
readonly scene: ProjectedDocumentNode;
|
|
7
|
+
readonly revisionKey: string;
|
|
8
|
+
readonly visibleRootIds?: readonly string[];
|
|
9
|
+
readonly projection?: DataProjection | null;
|
|
10
|
+
readonly sourceMapped?: boolean;
|
|
11
|
+
}
|
|
12
|
+
export interface TextLayoutScene {
|
|
13
|
+
readonly scene: ProjectedDocumentNode;
|
|
14
|
+
readonly status: ProjectedTextLayout['status'];
|
|
15
|
+
readonly diagnostics: readonly DocumentDiagnostic[];
|
|
16
|
+
}
|
|
17
|
+
/** Carries unresolved derived axes to ancestors before any asynchronous work starts. */
|
|
18
|
+
export declare function prepareTextLayoutScene(document: DesignDocument, options: TextLayoutSceneOptions, available?: boolean): TextLayoutScene;
|
|
19
|
+
/** One bounded disposable layout, shared by rendering and every geometry reader. */
|
|
20
|
+
export declare function measureTextLayoutScene(document: DesignDocument, options: TextLayoutSceneOptions & {
|
|
21
|
+
runtime: TextLayoutRuntime;
|
|
22
|
+
signal?: AbortSignal;
|
|
23
|
+
retry?: boolean;
|
|
24
|
+
}): Promise<TextLayoutScene>;
|
|
25
|
+
/** Position-only candidate validation. The caller must also retain the original scene lifetime guard. */
|
|
26
|
+
export declare function reuseTextLayoutScene(document: DesignDocument, options: TextLayoutSceneOptions & {
|
|
27
|
+
measuredScene: ProjectedDocumentNode;
|
|
28
|
+
}): TextLayoutScene;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { type TextLayoutPlan, type TextLayoutSnapshot } from '../../document/textLayout.js';
|
|
2
|
+
import { type PreparedTextFaceResolver } from './preparedTextFace.js';
|
|
3
|
+
import type { TextFontPreparationRuntime } from './textFontRuntime.js';
|
|
4
|
+
export interface TextLayoutRuntime {
|
|
5
|
+
readonly environmentId: string;
|
|
6
|
+
measure(plan: TextLayoutPlan, options?: {
|
|
7
|
+
signal?: AbortSignal;
|
|
8
|
+
retry?: boolean;
|
|
9
|
+
}): Promise<TextLayoutSnapshot>;
|
|
10
|
+
/** Invalidates this measurement cache; the injected font runtime keeps its own lifetime. */
|
|
11
|
+
clear(): void;
|
|
12
|
+
dispose(): void;
|
|
13
|
+
}
|
|
14
|
+
/** One runtime belongs to one browser font environment. Cached geometry still revalidates actual faces. */
|
|
15
|
+
export declare function createTextLayoutRuntime(options: {
|
|
16
|
+
textFontPreparation: TextFontPreparationRuntime;
|
|
17
|
+
resolvePreparedFace?: PreparedTextFaceResolver;
|
|
18
|
+
ownerDocument?: Document;
|
|
19
|
+
maxEntries?: number;
|
|
20
|
+
}): TextLayoutRuntime;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import type { DocumentEngine } from '../../document/contracts.js';
|
|
2
|
+
import { type DesignTransferPasteResult } from './clipboardTransfer.js';
|
|
3
|
+
interface ClipboardPasteOptions {
|
|
4
|
+
engine: DocumentEngine;
|
|
5
|
+
parentId: string;
|
|
6
|
+
pageId?: string;
|
|
7
|
+
allocateId: (sourceId: string) => string;
|
|
8
|
+
onApply: (plan: DesignTransferPasteResult) => boolean;
|
|
9
|
+
onError: (message: string) => void;
|
|
10
|
+
lifetimeKey?: string;
|
|
11
|
+
subscribeLifetime?: (invalidate: () => void) => () => void;
|
|
12
|
+
disabled?: boolean;
|
|
13
|
+
}
|
|
14
|
+
/** The mapping dialog is a pending operation, never a partial document mutation. */
|
|
15
|
+
export declare function useDesignClipboardPaste({ engine, parentId, pageId, allocateId, onApply, onError, lifetimeKey, subscribeLifetime, disabled }: ClipboardPasteOptions): {
|
|
16
|
+
paste: (text: string) => void;
|
|
17
|
+
dialog: import("react").JSX.Element | null;
|
|
18
|
+
};
|
|
19
|
+
export {};
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import type { DocumentEngine } from '../../document/contracts.js';
|
|
2
|
+
import { type TextLayoutScene, type TextLayoutSceneOptions } from './textLayoutProjection.js';
|
|
3
|
+
import type { TextLayoutRuntime } from './textLayoutRuntime.js';
|
|
4
|
+
export interface UseTextLayoutOptions extends TextLayoutSceneOptions {
|
|
5
|
+
readonly engine: DocumentEngine;
|
|
6
|
+
readonly runtime?: TextLayoutRuntime | null;
|
|
7
|
+
readonly lifetimeKey: string;
|
|
8
|
+
/** Fires synchronously for target, mode, page or provider transitions, including batched round trips. */
|
|
9
|
+
readonly subscribeLifetime?: (invalidate: () => void) => () => void;
|
|
10
|
+
readonly ownerDocument?: Document;
|
|
11
|
+
}
|
|
12
|
+
export interface TextLayoutState extends TextLayoutScene {
|
|
13
|
+
readonly geometryKey: string;
|
|
14
|
+
/** Capture this function at gesture start; a later render cannot revive that geometry. */
|
|
15
|
+
readonly isCurrent: () => boolean;
|
|
16
|
+
readonly retry: () => void;
|
|
17
|
+
}
|
|
18
|
+
/** One subscription owns the disposable scene and its synchronous invalidation epoch. */
|
|
19
|
+
export declare function useTextLayout(options: UseTextLayoutOptions): TextLayoutState;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import type { DataProjection } from '../../binding/preview.js';
|
|
2
2
|
import type { DesignDocument, DocumentDiagnostic, DocumentMatrix, DocumentNode, DocumentNodePatch, DocumentTransaction } from '../../document/contracts.js';
|
|
3
3
|
import { booleanVectorPrecision, type VectorAnchor, type VectorAnchorAddress, type VectorBooleanOperation, type VectorFillRule, type VectorPoint, type VectorProperties, type VectorShape, type VectorStroke } from '../../document/vector.js';
|
|
4
|
-
import { type LayerGeometry } from './geometryHandles.js';
|
|
5
|
-
import type
|
|
4
|
+
import { type LayerGeometry, type SnapCandidateOptions } from './geometryHandles.js';
|
|
5
|
+
import { type ProjectedDocumentNode } from './projection.js';
|
|
6
6
|
/**
|
|
7
7
|
* Pure editing model for `vector` layers. The document stores path data under
|
|
8
8
|
* `node.properties.vector` in the layer's own space; the layer box is the geometry's
|
|
@@ -91,7 +91,9 @@ export declare function vectorGeometryPatch(node: DocumentNode, next: VectorProp
|
|
|
91
91
|
/** Changes paint and corner keys without touching geometry; an `undefined` value removes the key. */
|
|
92
92
|
export declare function vectorStylePatch(node: DocumentNode, style: Partial<VectorStyle>): DocumentNodePatch;
|
|
93
93
|
/** Canvas placement of a layer: the world transform with the root's own transform removed, as the canvas renders it. */
|
|
94
|
-
export declare function renderedWorldTransform(document: DesignDocument, nodeId: string
|
|
94
|
+
export declare function renderedWorldTransform(document: DesignDocument, nodeId: string, options?: SnapCandidateOptions & {
|
|
95
|
+
projection?: DataProjection | null;
|
|
96
|
+
}): DocumentMatrix;
|
|
95
97
|
/** New layers join the selected container, or the root; the rule matches text insertion. */
|
|
96
98
|
export declare function vectorInsertParent(document: DesignDocument, selection: readonly string[]): string;
|
|
97
99
|
/** A default-sized shape placed inside the parent, offset by the number of existing children so repeated inserts stay visible. */
|
|
@@ -105,13 +107,15 @@ export declare function penPathNode(points: readonly VectorAnchor[], closed: boo
|
|
|
105
107
|
* selection handles use, so an auto layout child, a source layout fragment, or a repeated
|
|
106
108
|
* row is refused with the same diagnostic instead of a guessed box.
|
|
107
109
|
*/
|
|
108
|
-
export declare function planVectorEdit(document: DesignDocument, selection: readonly string[], projection: DataProjection | null): VectorEditPlan;
|
|
110
|
+
export declare function planVectorEdit(document: DesignDocument, selection: readonly string[], projection: DataProjection | null, options?: SnapCandidateOptions): VectorEditPlan;
|
|
109
111
|
/** Anchor operations the current anchor selection allows. */
|
|
110
112
|
export declare function vectorAnchorActions(vector: VectorProperties, anchors: readonly VectorAnchorAddress[]): VectorAnchorActions;
|
|
111
113
|
/** Applies one anchor action to the box geometry; the caller commits the result as one transaction. */
|
|
112
114
|
export declare function applyVectorAnchorAction(vector: VectorProperties, anchors: readonly VectorAnchorAddress[], action: VectorAnchorAction): VectorAnchorActionResult;
|
|
113
115
|
/** Two vector layers sharing a parent; the lower layer (earlier in the parent order) is the base of a subtraction. */
|
|
114
|
-
export declare function planVectorBoolean(document: DesignDocument, selection: readonly string[]
|
|
116
|
+
export declare function planVectorBoolean(document: DesignDocument, selection: readonly string[], options?: SnapCandidateOptions & {
|
|
117
|
+
projection?: DataProjection | null;
|
|
118
|
+
}): VectorBooleanPlan;
|
|
115
119
|
/** The combined layer, in the parent's space, with the lower layer's paint. Throws when the result has no shape. */
|
|
116
120
|
export declare function vectorBooleanNode(plan: Extract<VectorBooleanPlan, {
|
|
117
121
|
status: 'ready';
|