@pygmalionjs/pygmalion 0.16.0 → 0.17.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 -3
- package/dist-lib/{CameraLayer-BNw26sgR.js → CameraLayer-Clqgdcjb.js} +1 -1
- package/dist-lib/pygmalion.js +11341 -11100
- 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/lib.d.ts +1 -0
- 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/NodeExportPanel.d.ts +3 -1
- package/dist-lib/types/workspace/edit/TextStyleCatalog.d.ts +6 -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 +50 -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>;
|
package/dist-lib/types/lib.d.ts
CHANGED
|
@@ -445,4 +445,5 @@ export type { PrototypeInputFrame } from './workspace/view/prototypeInputFrame.j
|
|
|
445
445
|
export { createPrototypeProjectionContext } from './workspace/edit/prototypeProjection.js';
|
|
446
446
|
export type { PrototypeProjectionContext } from './workspace/edit/prototypeProjection.js';
|
|
447
447
|
export * from './workspace/edit/rasterExport.js';
|
|
448
|
+
export type { PreparedTextRasterFaceReference, TextRasterFaceResolver } from './workspace/edit/staticTextRaster.js';
|
|
448
449
|
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;
|
|
@@ -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;
|
|
@@ -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,50 @@
|
|
|
1
|
+
import { type RasterExportRequest } from '../../document/exportSettings.js';
|
|
2
|
+
import { type TextFontFaceRequest } from '../../document/richText.js';
|
|
3
|
+
import type { TextFontPreparationRuntime } from './textFontRuntime.js';
|
|
4
|
+
export interface PreparedTextRasterFaceReference {
|
|
5
|
+
readonly environmentId: string;
|
|
6
|
+
readonly faceId: string;
|
|
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;
|
|
14
|
+
export interface StaticTextRasterPlan {
|
|
15
|
+
readonly nodeId: string;
|
|
16
|
+
readonly width: number;
|
|
17
|
+
readonly height: number;
|
|
18
|
+
readonly outputWidth: number;
|
|
19
|
+
readonly outputHeight: number;
|
|
20
|
+
readonly font: TextFontFaceRequest;
|
|
21
|
+
readonly fontSize: number;
|
|
22
|
+
readonly lineHeight: number;
|
|
23
|
+
readonly align: 'start' | 'center' | 'end';
|
|
24
|
+
readonly color: string;
|
|
25
|
+
readonly opacity: number;
|
|
26
|
+
}
|
|
27
|
+
/** The first text raster slice is a single authored, fixed-size, undecorated line with explicit typography. */
|
|
28
|
+
export declare function createStaticTextRasterPlan(request: RasterExportRequest, options?: {
|
|
29
|
+
sourceMapped?: boolean;
|
|
30
|
+
}): 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
|
+
/** Matches the SVG renderer's default xMidYMid meet behavior after output dimension rounding. */
|
|
36
|
+
export declare function staticTextRasterViewport(plan: Pick<StaticTextRasterPlan, 'width' | 'height' | 'outputWidth' | 'outputHeight'>): {
|
|
37
|
+
scale: number;
|
|
38
|
+
x: number;
|
|
39
|
+
y: number;
|
|
40
|
+
};
|
|
41
|
+
/** Measures the same pre-wrap line box as TextNodeSurface, using a zero-height inline baseline marker. */
|
|
42
|
+
export declare function measureStaticTextRaster(plan: StaticTextRasterPlan, family: string, owner: Document): {
|
|
43
|
+
x: number;
|
|
44
|
+
baseline: number;
|
|
45
|
+
};
|
|
46
|
+
/** A ready explicit provider plus a registered browser face is required; platform fallback checks are insufficient. */
|
|
47
|
+
export declare function renderStaticTextRaster(request: RasterExportRequest, runtime: TextFontPreparationRuntime, options?: {
|
|
48
|
+
sourceMapped?: boolean;
|
|
49
|
+
resolvePreparedFace?: TextRasterFaceResolver;
|
|
50
|
+
}): Promise<Uint8Array>;
|