@pygmalionjs/pygmalion 0.16.0 → 0.18.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 +84 -3
- package/dist-lib/{CameraLayer-BNw26sgR.js → CameraLayer-Clqgdcjb.js} +1 -1
- package/dist-lib/pygmalion.js +13962 -12665
- package/dist-lib/{runtime-Bo5tncK_.js → runtime-B8Qu1ung.js} +3 -2
- package/dist-lib/style.css +1 -1
- package/dist-lib/testing.js +2 -2
- package/dist-lib/types/document/exportSettings.d.ts +4 -1
- package/dist-lib/types/document/textLayout.d.ts +77 -0
- package/dist-lib/types/lib.d.ts +12 -1
- package/dist-lib/types/workspace/configuration.d.ts +3 -0
- package/dist-lib/types/workspace/edit/AssetsPanel.d.ts +3 -1
- package/dist-lib/types/workspace/edit/ClipboardRelationshipDialog.d.ts +21 -0
- package/dist-lib/types/workspace/edit/NodeExportPanel.d.ts +3 -1
- package/dist-lib/types/workspace/edit/TextStyleCatalog.d.ts +6 -0
- 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/preparedTextFace.d.ts +31 -0
- package/dist-lib/types/workspace/edit/rasterCanvas.d.ts +6 -0
- package/dist-lib/types/workspace/edit/rasterExport.d.ts +9 -1
- package/dist-lib/types/workspace/edit/staticTextRaster.d.ts +39 -0
- 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/textLayoutRuntime.d.ts +20 -0
- package/dist-lib/types/workspace/edit/useDesignClipboardPaste.d.ts +19 -0
- package/package.json +1 -1
|
@@ -34,6 +34,7 @@ export interface RasterExportRequest {
|
|
|
34
34
|
height: number;
|
|
35
35
|
scale: number;
|
|
36
36
|
contentsOnly: boolean;
|
|
37
|
+
signal?: AbortSignal;
|
|
37
38
|
}
|
|
38
39
|
export type RasterExportRenderer = (request: RasterExportRequest) => Promise<Uint8Array>;
|
|
39
40
|
export interface DesignExportArtifact {
|
|
@@ -42,4 +43,6 @@ export interface DesignExportArtifact {
|
|
|
42
43
|
bytes: Uint8Array;
|
|
43
44
|
}
|
|
44
45
|
/** Raster bytes come only from an explicit host renderer; no hidden capture or network access. */
|
|
45
|
-
export declare function exportDesignNode(document: DesignDocument, nodeId: string, setting: ExportSetting, renderer?: RasterExportRenderer
|
|
46
|
+
export declare function exportDesignNode(document: DesignDocument, nodeId: string, setting: ExportSetting, renderer?: RasterExportRenderer, options?: {
|
|
47
|
+
signal?: AbortSignal;
|
|
48
|
+
}): Promise<DesignExportArtifact>;
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
import type { TextFontFaceRequest, TextResizeMode } from './richText.js';
|
|
2
|
+
export interface TextLayoutAddress {
|
|
3
|
+
readonly sourceNodeId: string;
|
|
4
|
+
readonly instancePath: readonly string[];
|
|
5
|
+
readonly rowPath: readonly {
|
|
6
|
+
readonly repeatId: string;
|
|
7
|
+
readonly key: string | number;
|
|
8
|
+
}[];
|
|
9
|
+
}
|
|
10
|
+
export interface TextLayoutRect {
|
|
11
|
+
readonly x: number;
|
|
12
|
+
readonly y: number;
|
|
13
|
+
readonly width: number;
|
|
14
|
+
readonly height: number;
|
|
15
|
+
}
|
|
16
|
+
/** Captured effective input, not a replacement canonical node or a saved document sidecar. */
|
|
17
|
+
export interface TextLayoutPlan {
|
|
18
|
+
readonly documentId: string;
|
|
19
|
+
readonly sourceRevision: string;
|
|
20
|
+
readonly revisionKey: string;
|
|
21
|
+
readonly address: TextLayoutAddress;
|
|
22
|
+
readonly authoredBounds: TextLayoutRect;
|
|
23
|
+
readonly mode: TextResizeMode;
|
|
24
|
+
readonly text: string;
|
|
25
|
+
readonly font: Omit<TextFontFaceRequest, 'sample'>;
|
|
26
|
+
readonly fontSize: number;
|
|
27
|
+
readonly lineHeight: number;
|
|
28
|
+
readonly align: 'start' | 'center' | 'end';
|
|
29
|
+
}
|
|
30
|
+
export interface TextLayoutFace {
|
|
31
|
+
readonly environmentId: string;
|
|
32
|
+
readonly faceId: string;
|
|
33
|
+
readonly family: string;
|
|
34
|
+
readonly weight: number;
|
|
35
|
+
readonly style: 'normal' | 'italic';
|
|
36
|
+
readonly sample: string;
|
|
37
|
+
}
|
|
38
|
+
export interface TextLayoutRange {
|
|
39
|
+
/** UTF-16 offsets into the complete plain string; boundaries follow native grapheme segmentation. */
|
|
40
|
+
readonly start: number;
|
|
41
|
+
readonly end: number;
|
|
42
|
+
readonly line: number;
|
|
43
|
+
readonly rects: readonly TextLayoutRect[];
|
|
44
|
+
}
|
|
45
|
+
export interface TextLayoutLine {
|
|
46
|
+
readonly paragraph: number;
|
|
47
|
+
readonly start: number;
|
|
48
|
+
readonly end: number;
|
|
49
|
+
readonly box: TextLayoutRect;
|
|
50
|
+
readonly baseline: number;
|
|
51
|
+
readonly fragments: readonly TextLayoutRect[];
|
|
52
|
+
}
|
|
53
|
+
export interface TextLayoutGeometry {
|
|
54
|
+
/** Native advance/line extents, not glyph ink bounds or ancestor-clipped output extents. */
|
|
55
|
+
readonly effectiveBounds: TextLayoutRect;
|
|
56
|
+
readonly contentBounds: TextLayoutRect;
|
|
57
|
+
readonly lines: readonly TextLayoutLine[];
|
|
58
|
+
readonly ranges: readonly TextLayoutRange[];
|
|
59
|
+
}
|
|
60
|
+
/** All geometry is local CSS pixels. Apply the existing scene transform and ancestor clip at consumption. */
|
|
61
|
+
export interface TextLayoutSnapshot extends TextLayoutGeometry {
|
|
62
|
+
readonly inputKey: string;
|
|
63
|
+
readonly plan: TextLayoutPlan;
|
|
64
|
+
readonly environmentId: string;
|
|
65
|
+
readonly faces: readonly TextLayoutFace[];
|
|
66
|
+
}
|
|
67
|
+
export declare const TEXT_LAYOUT_MAX_UNITS = 32768;
|
|
68
|
+
export declare const TEXT_LAYOUT_MAX_RANGES = 8192;
|
|
69
|
+
export declare const TEXT_LAYOUT_MAX_LINES = 2048;
|
|
70
|
+
/** This initial LTR contract conservatively excludes bidi controls and RTL script blocks. */
|
|
71
|
+
export declare const textLayoutNeedsBidi: (text: string) => boolean;
|
|
72
|
+
/** Only immutable data is accepted; DOM objects and mutable resolver state never enter a snapshot. */
|
|
73
|
+
export declare function freezeTextLayout<T>(value: T): T;
|
|
74
|
+
export declare function captureTextLayoutPlan(value: TextLayoutPlan): TextLayoutPlan;
|
|
75
|
+
export declare const textLayoutInputKey: (plan: TextLayoutPlan) => string;
|
|
76
|
+
/** Empty paragraphs explicitly prepare the same face's space metric for their native strut. */
|
|
77
|
+
export declare function textLayoutFontRequests(plan: TextLayoutPlan): readonly TextFontFaceRequest[];
|
package/dist-lib/types/lib.d.ts
CHANGED
|
@@ -427,7 +427,17 @@ export { assetInteropSourceDeltaDiagnostics, ASSETS_METADATA_KEY, ASSET_STORE_VE
|
|
|
427
427
|
export type { DocumentAsset, ImageAsset, SvgAsset, AssetStore, ImageAssetInput, SvgAssetInput, AssetFileLike, InventoryAssetMedia, InventoryAssetEntry } from './document/assets.js';
|
|
428
428
|
export * from './document/svgImport.js';
|
|
429
429
|
export * from './document/exportSettings.js';
|
|
430
|
-
export
|
|
430
|
+
export { DESIGN_CLIPBOARD_FORMAT, DESIGN_INTERCHANGE_FORMAT, copyDesignSubtrees, serializeDesignClipboard, parseDesignClipboard, pasteDesignSubtrees, applyDesignPaste, exportDesignInterchange, importDesignInterchange } from './workspace/edit/clipboard.js';
|
|
431
|
+
export type { DesignClipboard, PasteDesignResult } from './workspace/edit/clipboard.js';
|
|
432
|
+
export * from './workspace/edit/clipboardTransfer.js';
|
|
433
|
+
export * from './workspace/edit/clipboardStyles.js';
|
|
434
|
+
export * from './workspace/edit/clipboardPrototype.js';
|
|
435
|
+
export { createTextLayoutPlan } from './workspace/edit/textLayoutPlan.js';
|
|
436
|
+
export type { TextLayoutPlanOptions } from './workspace/edit/textLayoutPlan.js';
|
|
437
|
+
export { createTextLayoutRuntime } from './workspace/edit/textLayoutRuntime.js';
|
|
438
|
+
export type { TextLayoutRuntime } from './workspace/edit/textLayoutRuntime.js';
|
|
439
|
+
export type { TextLayoutAddress, TextLayoutRect, TextLayoutPlan, TextLayoutFace, TextLayoutRange, TextLayoutLine, TextLayoutGeometry, TextLayoutSnapshot } from './document/textLayout.js';
|
|
440
|
+
export type { PreparedTextFaceReference, PreparedTextFaceResolver } from './workspace/edit/preparedTextFace.js';
|
|
431
441
|
export { AssetsPanel } from './workspace/edit/AssetsPanel.js';
|
|
432
442
|
export type { AssetsPanelProps } from './workspace/edit/AssetsPanel.js';
|
|
433
443
|
export * from './document/prototype.js';
|
|
@@ -445,4 +455,5 @@ export type { PrototypeInputFrame } from './workspace/view/prototypeInputFrame.j
|
|
|
445
455
|
export { createPrototypeProjectionContext } from './workspace/edit/prototypeProjection.js';
|
|
446
456
|
export type { PrototypeProjectionContext } from './workspace/edit/prototypeProjection.js';
|
|
447
457
|
export * from './workspace/edit/rasterExport.js';
|
|
458
|
+
export type { PreparedTextRasterFaceReference, TextRasterFaceResolver } from './workspace/edit/staticTextRaster.js';
|
|
448
459
|
export * from './document/imagePaintGeometry.js';
|
|
@@ -5,6 +5,7 @@ import type { WorkspaceSourceCapabilities } from './source/flowContracts.js';
|
|
|
5
5
|
import type { WorkspaceTarget } from './contracts.js';
|
|
6
6
|
import type { WorkspaceTokenLibraryCapabilities } from './tokens/contracts.js';
|
|
7
7
|
import type { TextFontPreparationRuntime } from './edit/textFontRuntime.js';
|
|
8
|
+
import type { TextRasterFaceResolver } from './edit/staticTextRaster.js';
|
|
8
9
|
/** One target's source, data, rendering, and persistence capabilities travel together. */
|
|
9
10
|
export interface WorkspaceTargetConfiguration {
|
|
10
11
|
data?: HostDataCapabilities;
|
|
@@ -12,6 +13,8 @@ export interface WorkspaceTargetConfiguration {
|
|
|
12
13
|
duplicateMetadata?: DocumentDuplicateMetadataRemapper;
|
|
13
14
|
/** Explicit font face and sample preparation; browser fallback rendering is not exact readiness. */
|
|
14
15
|
textFontPreparation?: TextFontPreparationRuntime;
|
|
16
|
+
/** Bind a prepared face identity to its exact registered browser FontFace for static text output. */
|
|
17
|
+
textRasterFaceResolver?: TextRasterFaceResolver;
|
|
15
18
|
loadDocument?(target: WorkspaceTarget, options: {
|
|
16
19
|
signal: AbortSignal;
|
|
17
20
|
}): Promise<DesignDocument>;
|
|
@@ -10,8 +10,10 @@ export interface AssetsPanelProps {
|
|
|
10
10
|
onSelect?: (nodeId: string) => void;
|
|
11
11
|
onExport?: (artifact: DesignExportArtifact) => void | Promise<void>;
|
|
12
12
|
rasterRenderer?: RasterExportRenderer;
|
|
13
|
+
lifetimeKey?: string;
|
|
14
|
+
subscribeLifetime?: (invalidate: () => void) => () => void;
|
|
13
15
|
disabled?: boolean;
|
|
14
16
|
}
|
|
15
|
-
export declare function AssetsPanel({ engine, pageId, parentId, selectedNodeId, allocateId, onSelect, onExport, rasterRenderer, disabled }: AssetsPanelProps): import("react").JSX.Element;
|
|
17
|
+
export declare function AssetsPanel({ engine, pageId, parentId, selectedNodeId, allocateId, onSelect, onExport, rasterRenderer, lifetimeKey, subscribeLifetime, disabled }: AssetsPanelProps): import("react").JSX.Element;
|
|
16
18
|
/** Explicit local download callback for the panel; raster output still needs a separate host renderer. */
|
|
17
19
|
export declare function downloadDesignArtifact(artifact: DesignExportArtifact): void;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import type { DesignDocument } from '../../document/contracts.js';
|
|
2
|
+
import type { DesignClipboardRelationshipMaps, DesignClipboardWithRelationships } from './clipboardTransfer.js';
|
|
3
|
+
import type { ClipboardPrototypeFlowPolicy } from './clipboardPrototype.js';
|
|
4
|
+
|
|
5
|
+
export interface ClipboardRelationshipChoice {
|
|
6
|
+
relationships: DesignClipboardRelationshipMaps;
|
|
7
|
+
flowPolicy: ClipboardPrototypeFlowPolicy;
|
|
8
|
+
}
|
|
9
|
+
export interface ClipboardRelationshipDialogProps {
|
|
10
|
+
document: DesignDocument;
|
|
11
|
+
payload: DesignClipboardWithRelationships;
|
|
12
|
+
error?: string;
|
|
13
|
+
disabled?: boolean;
|
|
14
|
+
onChoiceChange?(): void;
|
|
15
|
+
onConfirm(choice: ClipboardRelationshipChoice): void;
|
|
16
|
+
onCancel(): void;
|
|
17
|
+
}
|
|
18
|
+
/** Internal default for validated pastes that need no naming or destination decision. */
|
|
19
|
+
export declare function defaultClipboardRelationshipChoice(document: DesignDocument, payload: DesignClipboardWithRelationships): ClipboardRelationshipChoice;
|
|
20
|
+
/** Collects explicit relationship decisions. Only the caller may validate and commit a paste. */
|
|
21
|
+
export declare function ClipboardRelationshipDialog(props: ClipboardRelationshipDialogProps): import("react").JSX.Element | null;
|
|
@@ -1,10 +1,12 @@
|
|
|
1
1
|
import type { DocumentEngine } from '../../document/contracts.js';
|
|
2
2
|
import { type DesignExportArtifact, type RasterExportRenderer } from '../../document/exportSettings.js';
|
|
3
3
|
/** The inspector and asset browser share one persisted export-settings editor. */
|
|
4
|
-
export declare function NodeExportPanel({ engine, nodeId, onExport, rasterRenderer, disabled }: {
|
|
4
|
+
export declare function NodeExportPanel({ engine, nodeId, onExport, rasterRenderer, disabled, lifetimeKey, subscribeLifetime }: {
|
|
5
5
|
engine: DocumentEngine;
|
|
6
6
|
nodeId?: string;
|
|
7
7
|
onExport?(artifact: DesignExportArtifact): void | Promise<void>;
|
|
8
8
|
rasterRenderer?: RasterExportRenderer;
|
|
9
9
|
disabled?: boolean;
|
|
10
|
+
lifetimeKey?: string;
|
|
11
|
+
subscribeLifetime?: (invalidate: () => void) => () => void;
|
|
10
12
|
}): import("react").JSX.Element;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import type { DesignDocument } from '../../document/contracts.js';
|
|
2
|
+
|
|
3
|
+
/** Browse authored style metadata without selecting a layer or requesting fonts. */
|
|
4
|
+
export declare function TextStyleCatalog({ document }: {
|
|
5
|
+
document: DesignDocument;
|
|
6
|
+
}): import("react").JSX.Element;
|
|
@@ -15,6 +15,7 @@ export interface DesignClipboard {
|
|
|
15
15
|
/** Copies owned subtrees and the transitive component definitions they reference. */
|
|
16
16
|
export declare function copyDesignSubtrees(document: DesignDocument, selection: readonly string[]): DesignClipboard;
|
|
17
17
|
export declare function serializeDesignClipboard(payload: DesignClipboard): string;
|
|
18
|
+
export declare function designClipboardDocument(payload: DesignClipboard): DesignDocument;
|
|
18
19
|
export declare function parseDesignClipboard(serialized: string): DesignClipboard;
|
|
19
20
|
export interface PasteDesignResult {
|
|
20
21
|
document: DesignDocument;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { DesignDocument, DocumentNode } from '../../document/contracts.js';
|
|
2
|
+
export interface ClipboardGraph {
|
|
3
|
+
roots: string[];
|
|
4
|
+
nodes: DocumentNode[];
|
|
5
|
+
definitions: DocumentNode[];
|
|
6
|
+
includedNodeIds: string[];
|
|
7
|
+
}
|
|
8
|
+
/** Shared structural closure for a validated source; relationship planners use these exact IDs. */
|
|
9
|
+
export declare function collectClipboardGraph(document: DesignDocument, selection: readonly string[]): ClipboardGraph;
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import type { DesignDocument } from '../../document/contracts.js';
|
|
2
|
+
import { type PrototypeDocument, type PrototypeFlow, type PrototypeInteraction, type PrototypeVariable } from '../../document/prototype.js';
|
|
3
|
+
export type ClipboardPrototypeFlowPolicy = 'selected-starts' | 'none';
|
|
4
|
+
export type ClipboardPrototypeDestinationKind = 'navigate' | 'change-to' | 'open-overlay' | 'swap-overlay' | 'scroll-to';
|
|
5
|
+
export interface ClipboardPrototypeOwner {
|
|
6
|
+
readonly nodeId: string;
|
|
7
|
+
readonly targetNodeId: string;
|
|
8
|
+
/** Opaque source address; structural clipboard code remaps it through the component graph. */
|
|
9
|
+
readonly overrideAddress?: string;
|
|
10
|
+
readonly interactions: readonly PrototypeInteraction[];
|
|
11
|
+
}
|
|
12
|
+
export interface ClipboardPrototypeData {
|
|
13
|
+
readonly version: 1;
|
|
14
|
+
readonly includedNodeIds: readonly string[];
|
|
15
|
+
readonly copiedRoots: readonly string[];
|
|
16
|
+
readonly flowPolicy: ClipboardPrototypeFlowPolicy;
|
|
17
|
+
readonly owners: readonly ClipboardPrototypeOwner[];
|
|
18
|
+
readonly variables: readonly PrototypeVariable[];
|
|
19
|
+
readonly flows: readonly PrototypeFlow[];
|
|
20
|
+
readonly externalNodes: readonly {
|
|
21
|
+
readonly nodeId: string;
|
|
22
|
+
readonly kinds: readonly ClipboardPrototypeDestinationKind[];
|
|
23
|
+
}[];
|
|
24
|
+
}
|
|
25
|
+
export interface ClipboardPrototypeMaps {
|
|
26
|
+
readonly nodeIds: Readonly<Record<string, string>>;
|
|
27
|
+
readonly externalNodeIds: Readonly<Record<string, string>>;
|
|
28
|
+
readonly variableIds: Readonly<Record<string, string>>;
|
|
29
|
+
readonly flowIds: Readonly<Record<string, string>>;
|
|
30
|
+
readonly variableNames?: Readonly<Record<string, string>>;
|
|
31
|
+
}
|
|
32
|
+
export interface ClipboardPrototypeTransferPlan {
|
|
33
|
+
readonly prototype: PrototypeDocument;
|
|
34
|
+
readonly owners: readonly {
|
|
35
|
+
readonly sourceNodeId: string;
|
|
36
|
+
readonly sourceOverrideAddress?: string;
|
|
37
|
+
readonly nodeId: string;
|
|
38
|
+
readonly targetNodeId: string;
|
|
39
|
+
readonly interactions: readonly PrototypeInteraction[];
|
|
40
|
+
}[];
|
|
41
|
+
readonly nodeIds: Readonly<Record<string, string>>;
|
|
42
|
+
readonly externalNodeIds: Readonly<Record<string, string>>;
|
|
43
|
+
readonly variableIds: Readonly<Record<string, string>>;
|
|
44
|
+
readonly flowIds: Readonly<Record<string, string>>;
|
|
45
|
+
/** Source-wide presentation settings are intentionally not imported with a selection. */
|
|
46
|
+
readonly settingsPolicy: 'preserve-target';
|
|
47
|
+
}
|
|
48
|
+
/** The root collector supplies the exact structural/definition closure; this helper never adds nodes. */
|
|
49
|
+
export declare function collectClipboardPrototype(sourceInput: DesignDocument, includedNodeIdsInput: readonly string[], copiedRootsInput: readonly string[], options: {
|
|
50
|
+
flowPolicy: ClipboardPrototypeFlowPolicy;
|
|
51
|
+
}): ClipboardPrototypeData;
|
|
52
|
+
/** Validates untrusted serialized relationships without consulting or changing a document. */
|
|
53
|
+
export declare function validateClipboardPrototypeClosure(input: unknown): ClipboardPrototypeData;
|
|
54
|
+
/** Pure relationship plan for an already allocated structural candidate; callers commit atomically. */
|
|
55
|
+
export declare function planClipboardPrototypeTransfer(dataInput: ClipboardPrototypeData, targetInput: DesignDocument, mapsInput: ClipboardPrototypeMaps): ClipboardPrototypeTransferPlan;
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import type { DesignDocument, DocumentDiagnostic } from '../../document/contracts.js';
|
|
2
|
+
import { type StylesMetadata, type StyleSlot } from '../../document/styles.js';
|
|
3
|
+
import { type AssetStore } from '../../document/assets.js';
|
|
4
|
+
export interface ClipboardStyleReference {
|
|
5
|
+
nodeId: string;
|
|
6
|
+
overrideAddress?: string;
|
|
7
|
+
slot: StyleSlot;
|
|
8
|
+
styleId: string;
|
|
9
|
+
}
|
|
10
|
+
/** Only the style-owned closure. Graph selection and other sidecar guards belong to the clipboard coordinator. */
|
|
11
|
+
export interface ClipboardStyleClosure {
|
|
12
|
+
sourceDocumentId: string;
|
|
13
|
+
includedNodeIds: string[];
|
|
14
|
+
styleReferences: ClipboardStyleReference[];
|
|
15
|
+
metadata: StylesMetadata;
|
|
16
|
+
assets: AssetStore;
|
|
17
|
+
}
|
|
18
|
+
export interface ClipboardStyleOptions {
|
|
19
|
+
/** Complete source-style to destination-style mapping; no identity or name guessing. */
|
|
20
|
+
styleIds: Readonly<Record<string, string>>;
|
|
21
|
+
/** When present, declares the destination name for every source style. */
|
|
22
|
+
names?: Readonly<Record<string, string>>;
|
|
23
|
+
/** Source style IDs explicitly authorized to reuse an identical destination style. */
|
|
24
|
+
reuse?: readonly string[];
|
|
25
|
+
}
|
|
26
|
+
export interface ClipboardStyleDiagnostic extends DocumentDiagnostic {
|
|
27
|
+
styleId?: string;
|
|
28
|
+
targetStyleId?: string;
|
|
29
|
+
libraryId?: string;
|
|
30
|
+
}
|
|
31
|
+
export type ClipboardStylePlan = {
|
|
32
|
+
ok: true;
|
|
33
|
+
metadata: StylesMetadata;
|
|
34
|
+
assets: AssetStore;
|
|
35
|
+
styleIds: Record<string, string>;
|
|
36
|
+
targetFingerprint: string;
|
|
37
|
+
} | {
|
|
38
|
+
ok: false;
|
|
39
|
+
diagnostics: ClipboardStyleDiagnostic[];
|
|
40
|
+
};
|
|
41
|
+
/** Reads own properties and every declared opaque override address, including inactive component overrides. */
|
|
42
|
+
export declare function collectClipboardStyles(sourceInput: DesignDocument, includedNodeIdsInput: readonly string[]): ClipboardStyleClosure;
|
|
43
|
+
/** Validates serialized style-owned data; the coordinator additionally compares the references with its node payload. */
|
|
44
|
+
export declare function validateClipboardStylesClosure(input: unknown): ClipboardStyleDiagnostic[];
|
|
45
|
+
/** Pure merge plan. Existing target styles and consumers are never updated by a clipboard operation. */
|
|
46
|
+
export declare function planClipboardStyles(targetInput: DesignDocument, closureInput: ClipboardStyleClosure, optionsInput: ClipboardStyleOptions): ClipboardStylePlan;
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import type { DesignDocument, DocumentTransaction } from '../../document/contracts.js';
|
|
2
|
+
import { pasteDesignSubtrees, type DesignClipboard, type PasteDesignResult } from './clipboard.js';
|
|
3
|
+
import { type ClipboardStyleClosure, type ClipboardStyleOptions } from './clipboardStyles.js';
|
|
4
|
+
import { type ClipboardPrototypeData, type ClipboardPrototypeFlowPolicy, type ClipboardPrototypeMaps } from './clipboardPrototype.js';
|
|
5
|
+
export interface DesignClipboardWithRelationships extends Omit<DesignClipboard, 'version'> {
|
|
6
|
+
version: 2;
|
|
7
|
+
relationships: {
|
|
8
|
+
styles: ClipboardStyleClosure;
|
|
9
|
+
prototype: ClipboardPrototypeData;
|
|
10
|
+
};
|
|
11
|
+
}
|
|
12
|
+
export type DesignTransferClipboard = DesignClipboard | DesignClipboardWithRelationships;
|
|
13
|
+
export interface DesignClipboardRelationshipMaps {
|
|
14
|
+
styles: ClipboardStyleOptions;
|
|
15
|
+
prototype: Omit<ClipboardPrototypeMaps, 'nodeIds'>;
|
|
16
|
+
}
|
|
17
|
+
export interface DesignTransferPasteResult extends PasteDesignResult {
|
|
18
|
+
targetFingerprint: string;
|
|
19
|
+
styleIds: Readonly<Record<string, string>>;
|
|
20
|
+
variableIds: Readonly<Record<string, string>>;
|
|
21
|
+
flowIds: Readonly<Record<string, string>>;
|
|
22
|
+
externalNodeIds: Readonly<Record<string, string>>;
|
|
23
|
+
settingsPolicy: 'preserve-target';
|
|
24
|
+
}
|
|
25
|
+
/** Opt-in owned relationship transfer. Legacy copy retains its existing refusal boundary. */
|
|
26
|
+
export declare function copyDesignSubtreesWithRelationships(documentInput: DesignDocument, selectionInput: readonly string[], options: {
|
|
27
|
+
flowPolicy: ClipboardPrototypeFlowPolicy;
|
|
28
|
+
}): DesignTransferClipboard;
|
|
29
|
+
export declare function serializeDesignClipboardWithRelationships(payload: DesignTransferClipboard): string;
|
|
30
|
+
export declare function parseDesignClipboardWithRelationships(text: string): DesignTransferClipboard;
|
|
31
|
+
/** A reviewed paste may explicitly omit copied flow starts; absent source flows cannot be inferred. */
|
|
32
|
+
export declare function withDesignClipboardFlowPolicy(payload: DesignClipboardWithRelationships, flowPolicy: ClipboardPrototypeFlowPolicy): DesignClipboardWithRelationships;
|
|
33
|
+
/** Captures every caller input before allocation and returns one complete document transaction. */
|
|
34
|
+
export declare function pasteDesignSubtreesWithRelationships(targetInput: DesignDocument, payloadInput: DesignTransferClipboard, options: Parameters<typeof pasteDesignSubtrees>[2] & {
|
|
35
|
+
relationships?: DesignClipboardRelationshipMaps;
|
|
36
|
+
}): DesignTransferPasteResult;
|
|
37
|
+
/** New relationship plans must be applied against the exact target that was reviewed. */
|
|
38
|
+
export declare function applyDesignTransferPaste(transaction: Pick<DocumentTransaction, 'replaceDocument'>, current: DesignDocument, plan: DesignTransferPasteResult): void;
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import type { TextFontFaceRequest } from '../../document/richText.js';
|
|
2
|
+
import type { TextFontPreparationRuntime } from './textFontRuntime.js';
|
|
3
|
+
export interface PreparedTextFaceReference {
|
|
4
|
+
readonly environmentId: string;
|
|
5
|
+
readonly faceId: string;
|
|
6
|
+
readonly family: string;
|
|
7
|
+
readonly weight: number;
|
|
8
|
+
readonly style: 'normal' | 'italic';
|
|
9
|
+
readonly sample: string;
|
|
10
|
+
}
|
|
11
|
+
/** The owner maps its exact prepared identity to the same FontFace object registered for drawing. */
|
|
12
|
+
export type PreparedTextFaceResolver = (reference: PreparedTextFaceReference) => FontFace | undefined;
|
|
13
|
+
/** Registered face descriptors must support the requested style and weight without synthesis. */
|
|
14
|
+
export declare function supportsPreparedTextFace(face: Pick<FontFace, 'family' | 'style' | 'weight' | 'stretch' | 'status'>, family: string, request: TextFontFaceRequest): boolean;
|
|
15
|
+
/** Registered unicode-range restrictions are distinct from the provider's glyph-coverage attestation. */
|
|
16
|
+
export declare function preparedTextFaceCoversSample(unicodeRange: string, sample: string): boolean;
|
|
17
|
+
export interface PreparedBrowserTextFace {
|
|
18
|
+
readonly reference: PreparedTextFaceReference;
|
|
19
|
+
readonly face: FontFace;
|
|
20
|
+
readonly descriptor: string;
|
|
21
|
+
readonly owner: Document;
|
|
22
|
+
}
|
|
23
|
+
/** Revalidates the current browser registration even when preparation was served from a cache. */
|
|
24
|
+
export declare function prepareBrowserTextFace(font: TextFontFaceRequest, fontSize: number, runtime: TextFontPreparationRuntime, options: {
|
|
25
|
+
nodeId: string;
|
|
26
|
+
signal?: AbortSignal;
|
|
27
|
+
retry?: boolean;
|
|
28
|
+
ownerDocument?: Document;
|
|
29
|
+
resolvePreparedFace?: PreparedTextFaceResolver;
|
|
30
|
+
diagnosticPrefix?: string;
|
|
31
|
+
}): Promise<PreparedBrowserTextFace>;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import type { RasterExportRequest } from '../../document/exportSettings.js';
|
|
2
|
+
export declare function assertRasterActive(signal?: AbortSignal): void;
|
|
3
|
+
export declare function validateRasterSize(request: Pick<RasterExportRequest, 'width' | 'height'>): void;
|
|
4
|
+
/** Cancellation ends this reader even if a browser decode or encode cannot be interrupted internally. */
|
|
5
|
+
export declare function awaitRasterActive<T>(work: Promise<T>, signal?: AbortSignal): Promise<T>;
|
|
6
|
+
export declare function encodeRasterCanvas(canvas: HTMLCanvasElement, format: RasterExportRequest['format'], signal?: AbortSignal): Promise<Uint8Array>;
|
|
@@ -1,5 +1,13 @@
|
|
|
1
|
+
import { type TextRasterFaceResolver } from './staticTextRaster.js';
|
|
2
|
+
import type { TextFontPreparationRuntime } from './textFontRuntime.js';
|
|
1
3
|
import { type RasterExportRenderer, type RasterExportRequest } from '../../document/exportSettings.js';
|
|
2
4
|
/** The same supported SVG geometry supplies browser raster output; unsupported visuals stay explicit. */
|
|
3
5
|
export declare function rasterExportSvg(request: RasterExportRequest): string;
|
|
4
|
-
/**
|
|
6
|
+
/** Adds bounded authored text output only when an explicit exact-face provider is available. */
|
|
7
|
+
export declare function createDesignRasterRenderer(options?: {
|
|
8
|
+
textFontPreparation?: TextFontPreparationRuntime;
|
|
9
|
+
sourceMapped?: boolean;
|
|
10
|
+
resolvePreparedFace?: TextRasterFaceResolver;
|
|
11
|
+
}): RasterExportRenderer;
|
|
12
|
+
/** Backward-compatible geometry renderer. Exact text output is explicitly enabled through the factory. */
|
|
5
13
|
export declare const renderDesignRaster: RasterExportRenderer;
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import { type RasterExportRequest } from '../../document/exportSettings.js';
|
|
2
|
+
import { type TextFontFaceRequest } from '../../document/richText.js';
|
|
3
|
+
import type { TextFontPreparationRuntime } from './textFontRuntime.js';
|
|
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';
|
|
7
|
+
export interface StaticTextRasterPlan {
|
|
8
|
+
readonly nodeId: string;
|
|
9
|
+
readonly width: number;
|
|
10
|
+
readonly height: number;
|
|
11
|
+
readonly outputWidth: number;
|
|
12
|
+
readonly outputHeight: number;
|
|
13
|
+
readonly font: TextFontFaceRequest;
|
|
14
|
+
readonly fontSize: number;
|
|
15
|
+
readonly lineHeight: number;
|
|
16
|
+
readonly align: 'start' | 'center' | 'end';
|
|
17
|
+
readonly color: string;
|
|
18
|
+
readonly opacity: number;
|
|
19
|
+
}
|
|
20
|
+
/** The first text raster slice is a single authored, fixed-size, undecorated line with explicit typography. */
|
|
21
|
+
export declare function createStaticTextRasterPlan(request: RasterExportRequest, options?: {
|
|
22
|
+
sourceMapped?: boolean;
|
|
23
|
+
}): StaticTextRasterPlan;
|
|
24
|
+
/** Matches the SVG renderer's default xMidYMid meet behavior after output dimension rounding. */
|
|
25
|
+
export declare function staticTextRasterViewport(plan: Pick<StaticTextRasterPlan, 'width' | 'height' | 'outputWidth' | 'outputHeight'>): {
|
|
26
|
+
scale: number;
|
|
27
|
+
x: number;
|
|
28
|
+
y: number;
|
|
29
|
+
};
|
|
30
|
+
/** Measures the same pre-wrap line box as TextNodeSurface, using a zero-height inline baseline marker. */
|
|
31
|
+
export declare function measureStaticTextRaster(plan: StaticTextRasterPlan, family: string, owner: Document): {
|
|
32
|
+
x: number;
|
|
33
|
+
baseline: number;
|
|
34
|
+
};
|
|
35
|
+
/** A ready explicit provider plus a registered browser face is required; platform fallback checks are insufficient. */
|
|
36
|
+
export declare function renderStaticTextRaster(request: RasterExportRequest, runtime: TextFontPreparationRuntime, options?: {
|
|
37
|
+
sourceMapped?: boolean;
|
|
38
|
+
resolvePreparedFace?: PreparedTextFaceResolver;
|
|
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,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 {};
|