@pygmalionjs/pygmalion 0.22.0 → 0.23.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/dist-lib/{CameraLayer-D4bW_2F_.js → CameraLayer-DtugUkJW.js} +1 -1
- package/dist-lib/pygmalion.js +10855 -10562
- package/dist-lib/{runtime-Du2Qf5G-.js → runtime-DLaOoI2y.js} +70 -70
- package/dist-lib/style.css +1 -1
- package/dist-lib/testing.js +5 -5
- package/dist-lib/types/document/screenImport.d.ts +6 -0
- package/dist-lib/types/lib.d.ts +5 -0
- package/dist-lib/types/workspace/WorkspaceShell.d.ts +3 -0
- package/dist-lib/types/workspace/capture/capturedScreenConfiguration.d.ts +15 -0
- package/dist-lib/types/workspace/capture/capturedScreenDocument.d.ts +4 -0
- package/dist-lib/types/workspace/capture/contracts.d.ts +55 -0
- package/dist-lib/types/workspace/configuration.d.ts +3 -0
- package/dist-lib/types/workspace/edit/ContentPanel.d.ts +24 -0
- package/package.json +1 -1
package/dist-lib/testing.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { b$ as
|
|
2
|
-
import {
|
|
1
|
+
import { b$ as l, T as u } from "./runtime-DLaOoI2y.js";
|
|
2
|
+
import { br as y, ch as b, ci as E, cj as P, bn as $, aw as T } from "./runtime-DLaOoI2y.js";
|
|
3
3
|
const v = {
|
|
4
4
|
mirror: ["status", "refresh", "refs"],
|
|
5
5
|
session: ["open", "check", "previewVisual", "applyVisual", "revertVisual"],
|
|
@@ -9,7 +9,7 @@ const v = {
|
|
|
9
9
|
storyboard: ["environment", "sourceUsage", "componentBranches"]
|
|
10
10
|
};
|
|
11
11
|
function h(m = {}, t = {}) {
|
|
12
|
-
const n = [],
|
|
12
|
+
const n = [], d = t.origin ?? "", r = (e) => {
|
|
13
13
|
var a;
|
|
14
14
|
const i = {};
|
|
15
15
|
for (const o of v[e]) {
|
|
@@ -26,8 +26,8 @@ function h(m = {}, t = {}) {
|
|
|
26
26
|
};
|
|
27
27
|
return {
|
|
28
28
|
calls: n,
|
|
29
|
-
endpoints:
|
|
30
|
-
resolveUrl: (e) => `${
|
|
29
|
+
endpoints: l(t.endpoints),
|
|
30
|
+
resolveUrl: (e) => `${d}${e}`,
|
|
31
31
|
mirror: r("mirror"),
|
|
32
32
|
session: r("session"),
|
|
33
33
|
inspect: r("inspect"),
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import type { DesignDocument } from './contracts.js';
|
|
2
|
+
import { type CapturedScreenMetadata, type ScreenImportResult, type ScreenImportSource } from '../workspace/capture/contracts.js';
|
|
3
|
+
/** Converts an imported screen (layer tree plus measured boxes) into a freely editable design document. */
|
|
4
|
+
export declare function screenDocumentFromImport(source: ScreenImportSource): ScreenImportResult;
|
|
5
|
+
/** The imported-screen marker of a document, when it has one. */
|
|
6
|
+
export declare function capturedScreenMetadata(document: Pick<DesignDocument, 'metadata'>): CapturedScreenMetadata | null;
|
package/dist-lib/types/lib.d.ts
CHANGED
|
@@ -36,6 +36,11 @@ export { createLegacyModeAdapter } from './workspace/legacyModeAdapter.js';
|
|
|
36
36
|
export type * from './workspace/contracts.js';
|
|
37
37
|
export { createWorkspaceTargetResolver, resolveWorkspaceTarget } from './workspace/configuration.js';
|
|
38
38
|
export type { WorkspaceConfiguration, WorkspaceTargetConfiguration, WorkspaceTargetResolverOptions } from './workspace/configuration.js';
|
|
39
|
+
export { capturedScreenMetadata, screenDocumentFromImport } from './document/screenImport.js';
|
|
40
|
+
export { createCapturedScreenDocumentLoader } from './workspace/capture/capturedScreenDocument.js';
|
|
41
|
+
export { withCapturedScreenDocuments } from './workspace/capture/capturedScreenConfiguration.js';
|
|
42
|
+
export { CAPTURED_SCREEN_METADATA_KEY } from './workspace/capture/contracts.js';
|
|
43
|
+
export type { CapturedScreenDocumentLoader, CapturedScreenDocumentOptions, CapturedScreenMetadata, ScreenImportResult, ScreenImportSource } from './workspace/capture/contracts.js';
|
|
39
44
|
export { compileWorkspaceVisualSource, workspaceSourceFingerprint } from './workspace/source/compiler.js';
|
|
40
45
|
export { compileWorkspaceDocumentSource, jsxStructureWrapperClassName } from './workspace/source/structure.js';
|
|
41
46
|
export { compileWorkspaceResponsiveSource, resolveResponsiveLayout, setResponsiveLayoutOverride } from './workspace/source/responsive.js';
|
|
@@ -1,9 +1,12 @@
|
|
|
1
1
|
import { type WorkspaceConfiguration } from './configuration.js';
|
|
2
|
+
import { type CapturedScreenConfigurationDependencies } from './capture/capturedScreenConfiguration.js';
|
|
2
3
|
|
|
3
4
|
export interface WorkspaceShellProps {
|
|
4
5
|
configuration: WorkspaceConfiguration;
|
|
5
6
|
sourceRevision: string;
|
|
6
7
|
previewIdentityReady: boolean;
|
|
7
8
|
previewOpen?: boolean;
|
|
9
|
+
/** Test seam for the captured-screen importer; production builds the offscreen loader. */
|
|
10
|
+
captureDependencies?: CapturedScreenConfigurationDependencies;
|
|
8
11
|
}
|
|
9
12
|
export declare const WorkspaceShell: import("react").FunctionComponent<WorkspaceShellProps>;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import type { EditorRuntime } from '../../core/runtime.js';
|
|
2
|
+
import { type WorkspaceConfiguration } from '../configuration.js';
|
|
3
|
+
import type { WorkspaceTarget } from '../contracts.js';
|
|
4
|
+
import { type CapturedScreenDocumentLoader, type CapturedScreenDocumentOptions } from './contracts.js';
|
|
5
|
+
export interface CapturedScreenConfigurationDependencies {
|
|
6
|
+
/** Test seam; production builds the offscreen importer. */
|
|
7
|
+
createLoader?(runtime: EditorRuntime, options: CapturedScreenDocumentOptions): CapturedScreenDocumentLoader;
|
|
8
|
+
}
|
|
9
|
+
/** Drafts live per screen and source revision; a new revision starts from a fresh import. */
|
|
10
|
+
export declare const capturedScreenDraftKey: (target: WorkspaceTarget) => string;
|
|
11
|
+
/**
|
|
12
|
+
* Wraps a host configuration so any routed screen the host does not resolve opens as an imported design
|
|
13
|
+
* document. Host-resolved targets always win; the fallback only fills targets the host leaves without a loader.
|
|
14
|
+
*/
|
|
15
|
+
export declare function withCapturedScreenDocuments(configuration: WorkspaceConfiguration, runtime: EditorRuntime, dependencies?: CapturedScreenConfigurationDependencies): WorkspaceConfiguration;
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import type { EditorRuntime } from '../../core/runtime.js';
|
|
2
|
+
import type { CapturedScreenDocumentLoader, CapturedScreenDocumentOptions } from './contracts.js';
|
|
3
|
+
/** Opens any routed screen as a design document by booting it offscreen and importing its DOM. */
|
|
4
|
+
export declare function createCapturedScreenDocumentLoader(runtime: EditorRuntime, options?: CapturedScreenDocumentOptions): CapturedScreenDocumentLoader;
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import type { DesignDocument, DocumentDiagnostic } from '../../document/contracts.js';
|
|
2
|
+
import type { ImportedGeometryEntry } from '../../editor/domImport.js';
|
|
3
|
+
import type { NodeJSON, PageModel } from '../../editor/store.js';
|
|
4
|
+
import type { WorkspaceTarget } from '../contracts.js';
|
|
5
|
+
/** What the DOM importer observed on a prepared screen; the converter turns it into a design document. */
|
|
6
|
+
export interface ScreenImportSource {
|
|
7
|
+
screenId: string;
|
|
8
|
+
sourceRevision: string;
|
|
9
|
+
/** Screen name shown as the root frame name. */
|
|
10
|
+
name: string;
|
|
11
|
+
route?: string;
|
|
12
|
+
width: number;
|
|
13
|
+
height: number;
|
|
14
|
+
root: NodeJSON;
|
|
15
|
+
geometry: readonly ImportedGeometryEntry[];
|
|
16
|
+
truncated?: boolean;
|
|
17
|
+
importDiagnostics?: readonly string[];
|
|
18
|
+
}
|
|
19
|
+
export interface ScreenImportResult {
|
|
20
|
+
document: DesignDocument;
|
|
21
|
+
diagnostics: DocumentDiagnostic[];
|
|
22
|
+
nodeCount: number;
|
|
23
|
+
}
|
|
24
|
+
export declare const CAPTURED_SCREEN_METADATA_KEY = "capturedScreen";
|
|
25
|
+
/** Stored under `document.metadata.capturedScreen`; marks a draft that began as an imported screen. */
|
|
26
|
+
export interface CapturedScreenMetadata {
|
|
27
|
+
version: 1;
|
|
28
|
+
screenId: string;
|
|
29
|
+
route?: string;
|
|
30
|
+
importedAt: string;
|
|
31
|
+
nodeCount: number;
|
|
32
|
+
truncated: boolean;
|
|
33
|
+
diagnostics: string[];
|
|
34
|
+
}
|
|
35
|
+
export interface CapturedScreenDocumentOptions {
|
|
36
|
+
/** Persists drafts when the host supplies no saveDocument; null disables persistence; default is window.localStorage when present. */
|
|
37
|
+
draftStorage?: Pick<Storage, 'getItem' | 'setItem' | 'removeItem'> | null;
|
|
38
|
+
/** Which routed screens may open this way; default: every page with a route or a screens import. */
|
|
39
|
+
canImport?(page: PageModel): boolean;
|
|
40
|
+
/** Import budget forwarded to the DOM importer; pure DOM by default so pixels match the running screen. */
|
|
41
|
+
import?: {
|
|
42
|
+
instanceMode?: 'ignore' | 'collapse' | 'expand';
|
|
43
|
+
};
|
|
44
|
+
/** Milliseconds to wait for the screen to load and prepare before giving up. Default 45000. */
|
|
45
|
+
timeoutMs?: number;
|
|
46
|
+
/** Where the offscreen frame mounts; default is the document body of the page running the editor. */
|
|
47
|
+
container?: HTMLElement;
|
|
48
|
+
}
|
|
49
|
+
export interface CapturedScreenDocumentLoader {
|
|
50
|
+
canImport(page: PageModel): boolean;
|
|
51
|
+
/** Boots the screen offscreen, prepares its declared state, imports the DOM, and returns the converted document. */
|
|
52
|
+
load(target: WorkspaceTarget, page: PageModel, options: {
|
|
53
|
+
signal: AbortSignal;
|
|
54
|
+
}): Promise<ScreenImportResult>;
|
|
55
|
+
}
|
|
@@ -6,6 +6,7 @@ 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
8
|
import type { TextRasterFaceResolver } from './edit/staticTextRaster.js';
|
|
9
|
+
import type { CapturedScreenDocumentOptions } from './capture/contracts.js';
|
|
9
10
|
/** One target's source, data, rendering, and persistence capabilities travel together. */
|
|
10
11
|
export interface WorkspaceTargetConfiguration {
|
|
11
12
|
data?: HostDataCapabilities;
|
|
@@ -38,6 +39,8 @@ export interface WorkspaceConfiguration extends WorkspaceTargetConfiguration {
|
|
|
38
39
|
chrome?: ReactNode;
|
|
39
40
|
/** Undefined explicitly marks an unsupported screen or source revision. */
|
|
40
41
|
resolveTarget?(target: WorkspaceTarget): WorkspaceTargetConfiguration | undefined;
|
|
42
|
+
/** Open any routed screen the host does not resolve as an imported design document; edits stay drafts until the host connects a source mapping. */
|
|
43
|
+
capturedScreens?: true | CapturedScreenDocumentOptions;
|
|
41
44
|
}
|
|
42
45
|
export interface WorkspaceTargetResolverOptions {
|
|
43
46
|
/** The host decides whether this screen and revision have usable capabilities. */
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import type { DesignDocument, DocumentNode, DocumentTransaction } from '../../document/contracts.js';
|
|
2
|
+
|
|
3
|
+
export interface ContentPanelProps {
|
|
4
|
+
document: DesignDocument;
|
|
5
|
+
act(label: string, apply: (transaction: DocumentTransaction) => void): unknown;
|
|
6
|
+
selected: readonly string[];
|
|
7
|
+
onSelect(ids: string[]): void;
|
|
8
|
+
}
|
|
9
|
+
interface ContentRow {
|
|
10
|
+
id: string;
|
|
11
|
+
name: string;
|
|
12
|
+
kind: DocumentNode['kind'];
|
|
13
|
+
hidden: boolean;
|
|
14
|
+
tagged: boolean;
|
|
15
|
+
}
|
|
16
|
+
interface ContentSection {
|
|
17
|
+
id: string;
|
|
18
|
+
name: string;
|
|
19
|
+
rows: ContentRow[];
|
|
20
|
+
}
|
|
21
|
+
export declare function contentSections(document: DesignDocument): ContentSection[];
|
|
22
|
+
/** Lists what the screen shows so a designer can pull content out of view or bring it back without touching the layer tree. */
|
|
23
|
+
export declare function ContentPanel({ document, act, selected, onSelect }: ContentPanelProps): import("react").JSX.Element;
|
|
24
|
+
export {};
|