@pygmalionjs/pygmalion 0.6.34 → 0.7.1
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/LICENSE +190 -0
- package/README.ko.md +309 -28
- package/README.md +37 -16
- package/dist-lib/CameraLayer-D2wrEPwG.js +415 -0
- package/dist-lib/frameLodRuntime-CU0IYaSu.js +272 -0
- package/dist-lib/pygmalion.js +11670 -16016
- package/dist-lib/routePreviewStatus-DTr-UJhV.js +64 -0
- package/dist-lib/{FrozenRoutePreview-BbF5Ov5K.js → runtime-DRkTU9eq.js} +9515 -5306
- package/dist-lib/testing.js +46 -6
- package/dist-lib/types/{App.d.ts → EditorShell.d.ts} +1 -1
- package/dist-lib/types/canvas/CameraLayer.d.ts +2 -1
- package/dist-lib/types/canvas/FrameLabelBanner.d.ts +1 -1
- package/dist-lib/types/canvas/FrameView.d.ts +1 -1
- package/dist-lib/types/canvas/FrozenRoutePreview.d.ts +1 -1
- package/dist-lib/types/canvas/SectionBoxes.d.ts +2 -1
- package/dist-lib/types/canvas/ShadowRoutePreview.d.ts +1 -1
- package/dist-lib/types/contract/errors.d.ts +30 -0
- package/dist-lib/types/contract/index.d.ts +5 -0
- package/dist-lib/types/contract/memoryTransport.d.ts +19 -0
- package/dist-lib/types/contract/paths.d.ts +57 -0
- package/dist-lib/types/contract/transport.d.ts +69 -0
- package/dist-lib/types/contract/types.d.ts +150 -0
- package/dist-lib/types/contract/validate.d.ts +15 -0
- package/dist-lib/types/contract/viteTransport.d.ts +10 -0
- package/dist-lib/types/core/context.d.ts +12 -0
- package/dist-lib/types/core/debug.d.ts +187 -0
- package/dist-lib/types/core/defaultRuntime.d.ts +3 -0
- package/dist-lib/types/core/hostBindings.d.ts +90 -0
- package/dist-lib/types/core/runtime.d.ts +36 -0
- package/dist-lib/types/core/runtimeContext.d.ts +13 -0
- package/dist-lib/types/editor/flowSessionScheduler.d.ts +21 -7
- package/dist-lib/types/editor/framePreviewKeys.d.ts +10 -10
- package/dist-lib/types/editor/host.d.ts +31 -26
- package/dist-lib/types/editor/previewBootstrap.d.ts +5 -15
- package/dist-lib/types/editor/previewCaptureProgress.d.ts +7 -2
- package/dist-lib/types/editor/projectBootGate.d.ts +17 -4
- package/dist-lib/types/editor/projectRuntime.d.ts +11 -95
- package/dist-lib/types/editor/revisionCatalog.d.ts +8 -9
- package/dist-lib/types/editor/scenarioCoverage.d.ts +2 -1
- package/dist-lib/types/editor/store.d.ts +17 -2
- package/dist-lib/types/editor/storyboardComposition.d.ts +1 -5
- package/dist-lib/types/editor/storyboardDiscovery.d.ts +6 -16
- package/dist-lib/types/editor/storyboardEnvironment.d.ts +2 -2
- package/dist-lib/types/editor/variantPrefetch.d.ts +3 -2
- package/dist-lib/types/editor/visualQa.d.ts +7 -2
- package/dist-lib/types/lib.d.ts +25 -204
- package/dist-lib/types/shell/ComponentStateControls.d.ts +1 -1
- package/dist-lib/types/testing.d.ts +5 -1
- package/node/component-branches.mjs +3 -3
- package/node/contract.d.mts +63 -0
- package/node/contract.mjs +175 -0
- package/node/design-session.mjs +4 -2
- package/node/dev-mirror.mjs +27 -14
- package/node/inspect-plugin.mjs +3 -2
- package/node/preview-artifact-plugin.mjs +13 -16
- package/node/preview-artifact-store.mjs +4 -2
- package/node/qa-capture-plugin.mjs +3 -2
- package/node/storyboard-canonical.mjs +2 -2
- package/node/storyboard-capture-runtime.mjs +2 -2
- package/node/storyboard-environment.mjs +9 -6
- package/node/vite.mjs +2 -13
- package/package.json +24 -4
- package/storyboard.d.ts +11 -0
|
@@ -0,0 +1,187 @@
|
|
|
1
|
+
import { getObserverTree, isObservableProp } from 'mobx';
|
|
2
|
+
import type { EditorRuntime } from './runtime';
|
|
3
|
+
export interface EditorRuntimeDiagnostics {
|
|
4
|
+
/** Whether the preview identity had settled at the last render. */
|
|
5
|
+
previewIdentityReady: boolean;
|
|
6
|
+
/** The preview revision the last render resolved frames against. */
|
|
7
|
+
resolvedPreviewRevision: string;
|
|
8
|
+
}
|
|
9
|
+
export declare function createEditorDebug(runtime: EditorRuntime): {
|
|
10
|
+
/** The runtime's store, under the name the first host automation used. */
|
|
11
|
+
readonly editor: import("../testing").EditorStore;
|
|
12
|
+
readonly store: import("../testing").EditorStore;
|
|
13
|
+
readonly host: import("./hostBindings").HostBindings;
|
|
14
|
+
/** Render inputs the frames were last given, mirrored for headless diagnosis. */
|
|
15
|
+
diagnostics: EditorRuntimeDiagnostics;
|
|
16
|
+
getObserverTree: typeof getObserverTree;
|
|
17
|
+
isObservableProp: typeof isObservableProp;
|
|
18
|
+
/** Preview-surface introspection for headless diagnosis of frame surfaces. */
|
|
19
|
+
preview(frameId: string): Promise<{
|
|
20
|
+
key: string;
|
|
21
|
+
hasOutcome: boolean;
|
|
22
|
+
screenshot: {
|
|
23
|
+
width: number;
|
|
24
|
+
height: number;
|
|
25
|
+
} | null;
|
|
26
|
+
hasShadowArtifact: boolean;
|
|
27
|
+
hasSnapshot: boolean;
|
|
28
|
+
keys: {
|
|
29
|
+
which: "active" | "inactive";
|
|
30
|
+
sameAsDebugKey: boolean;
|
|
31
|
+
hasShadowArtifact: boolean;
|
|
32
|
+
hasSnapshot: boolean;
|
|
33
|
+
}[];
|
|
34
|
+
isActivePage: boolean;
|
|
35
|
+
snapshotShape: {
|
|
36
|
+
length: number;
|
|
37
|
+
bodyLength: number;
|
|
38
|
+
elements: number;
|
|
39
|
+
basePlaceholderLeft: boolean;
|
|
40
|
+
baseHref: string | null;
|
|
41
|
+
head: string;
|
|
42
|
+
} | null;
|
|
43
|
+
previewIdentityReady: boolean;
|
|
44
|
+
seedRevision: string;
|
|
45
|
+
hostRevision: string;
|
|
46
|
+
staticSurface: import("../editor/routePreviewStatus").StaticRoutePreviewSurface;
|
|
47
|
+
tier: import("../editor/frameLod").FrameLifecycleTier;
|
|
48
|
+
magnified: boolean;
|
|
49
|
+
promotion: {
|
|
50
|
+
mounted: boolean;
|
|
51
|
+
stamped: boolean | null;
|
|
52
|
+
};
|
|
53
|
+
lodState: {
|
|
54
|
+
tiers: [string, import("../editor/frameLod").FrameLifecycleTier][];
|
|
55
|
+
magnified: [string, boolean][];
|
|
56
|
+
lastRecompute: {
|
|
57
|
+
displayDensity?: number;
|
|
58
|
+
overview?: boolean;
|
|
59
|
+
frames?: {
|
|
60
|
+
id: string;
|
|
61
|
+
screenshotDensity: number | null | undefined;
|
|
62
|
+
tier: string;
|
|
63
|
+
}[];
|
|
64
|
+
};
|
|
65
|
+
};
|
|
66
|
+
readFramesNow: (import("../editor/frameLod").FrameLodFrame & {
|
|
67
|
+
memoKey?: string;
|
|
68
|
+
}) | undefined;
|
|
69
|
+
} | null>;
|
|
70
|
+
/** Flow-session delivery states for headless diagnosis of the captureless supply. */
|
|
71
|
+
flowSessions(): Promise<{
|
|
72
|
+
declaredPaths: number;
|
|
73
|
+
scheduler: {
|
|
74
|
+
calls: number;
|
|
75
|
+
lastCanvas: string;
|
|
76
|
+
lastFlows: number;
|
|
77
|
+
lastCandidates: number;
|
|
78
|
+
lastQueued: number;
|
|
79
|
+
};
|
|
80
|
+
states: Record<string, import("../editor/flowSessions").FlowScreenState>;
|
|
81
|
+
viewport: {
|
|
82
|
+
commit: {
|
|
83
|
+
requested: number;
|
|
84
|
+
resolvedNull: number;
|
|
85
|
+
controllerMissing: number;
|
|
86
|
+
markerGone: number;
|
|
87
|
+
editsWon: number;
|
|
88
|
+
captureNull: number;
|
|
89
|
+
committed: number;
|
|
90
|
+
};
|
|
91
|
+
states: Record<string, unknown>;
|
|
92
|
+
};
|
|
93
|
+
interactive: {
|
|
94
|
+
requests: {
|
|
95
|
+
requested: number;
|
|
96
|
+
noPath: number;
|
|
97
|
+
resolvedNull: number;
|
|
98
|
+
queued: number;
|
|
99
|
+
reparkQueued: number;
|
|
100
|
+
reparkAlreadyParked: number;
|
|
101
|
+
reparkNoExtraSteps: number;
|
|
102
|
+
};
|
|
103
|
+
states: Record<string, unknown>;
|
|
104
|
+
};
|
|
105
|
+
warming: {
|
|
106
|
+
requested: number;
|
|
107
|
+
noPath: number;
|
|
108
|
+
resolvedNull: number;
|
|
109
|
+
alreadyWarm: number;
|
|
110
|
+
queued: number;
|
|
111
|
+
};
|
|
112
|
+
warm: {
|
|
113
|
+
bootsByRunner: {
|
|
114
|
+
[x: string]: number;
|
|
115
|
+
};
|
|
116
|
+
parked: number;
|
|
117
|
+
boots: number;
|
|
118
|
+
reuses: number;
|
|
119
|
+
parks: number;
|
|
120
|
+
evictions: number;
|
|
121
|
+
refreshes: number;
|
|
122
|
+
};
|
|
123
|
+
}>;
|
|
124
|
+
/**
|
|
125
|
+
* State-switch instrumentation: phase timings of recent flow-session walks
|
|
126
|
+
* (boot/replay/settle/stability/serialize/publish, per runner label, warm
|
|
127
|
+
* reuse vs cold boot) plus route-preview producer-gate counters. JSON-safe.
|
|
128
|
+
*/
|
|
129
|
+
stateSwitchMetrics(): Promise<{
|
|
130
|
+
walks: {
|
|
131
|
+
byRunner: {
|
|
132
|
+
[k: string]: {
|
|
133
|
+
count: number;
|
|
134
|
+
completed: number;
|
|
135
|
+
coldBoots: number;
|
|
136
|
+
warmReuses: number;
|
|
137
|
+
stabilityTimeouts: number;
|
|
138
|
+
phases: Record<import("../editor/stateSwitchMetrics").StateSwitchPhase, import("../editor/stateSwitchMetrics").PhaseAggregate>;
|
|
139
|
+
};
|
|
140
|
+
};
|
|
141
|
+
recent: {
|
|
142
|
+
totals: {
|
|
143
|
+
replayMs: number;
|
|
144
|
+
settleMs: number;
|
|
145
|
+
stabilityMs: number;
|
|
146
|
+
serializeMs: number;
|
|
147
|
+
publishMs: number;
|
|
148
|
+
};
|
|
149
|
+
waypoints: {
|
|
150
|
+
screenId: string;
|
|
151
|
+
replayMs: number | null;
|
|
152
|
+
settleMs: number | null;
|
|
153
|
+
stabilityMs: number | null;
|
|
154
|
+
stabilityTimedOut: boolean;
|
|
155
|
+
serializeMs: number | null;
|
|
156
|
+
publishMs: number | null;
|
|
157
|
+
}[];
|
|
158
|
+
runner: string;
|
|
159
|
+
pathId: string;
|
|
160
|
+
reused: boolean;
|
|
161
|
+
completed: boolean;
|
|
162
|
+
startedAtEpochMs: number;
|
|
163
|
+
totalMs: number;
|
|
164
|
+
bootMs: number | null;
|
|
165
|
+
}[];
|
|
166
|
+
count: number;
|
|
167
|
+
completed: number;
|
|
168
|
+
coldBoots: number;
|
|
169
|
+
warmReuses: number;
|
|
170
|
+
stabilityTimeouts: number;
|
|
171
|
+
phases: Record<import("../editor/stateSwitchMetrics").StateSwitchPhase, import("../editor/stateSwitchMetrics").PhaseAggregate>;
|
|
172
|
+
};
|
|
173
|
+
routePreviewProducer: {
|
|
174
|
+
evaluations: number;
|
|
175
|
+
allowed: number;
|
|
176
|
+
suppressed: number;
|
|
177
|
+
byTrigger: {
|
|
178
|
+
endpointNotConfigured: number;
|
|
179
|
+
detailActive: number;
|
|
180
|
+
previewIntended: number;
|
|
181
|
+
};
|
|
182
|
+
};
|
|
183
|
+
}>;
|
|
184
|
+
/** Clears the state-switch metrics between headless audit scenarios. */
|
|
185
|
+
resetStateSwitchMetrics(): Promise<void>;
|
|
186
|
+
};
|
|
187
|
+
export type EditorRuntimeDebug = ReturnType<typeof createEditorDebug>;
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
import type { ApplyPayload, DesignChangePayload, DesignChangeResult, InspectApplyResult, InspectImpactResult, InspectPreviewResult } from '../editor/host';
|
|
2
|
+
import type { InspectApplyPayload } from '../editor/inspect';
|
|
3
|
+
export type ApplyHandler = (payload: ApplyPayload) => Promise<{
|
|
4
|
+
branch: string;
|
|
5
|
+
} | void>;
|
|
6
|
+
export type InspectApplyHandler = (payload: InspectApplyPayload) => Promise<InspectApplyResult | void>;
|
|
7
|
+
export type InspectPreviewHandler = (payload: InspectApplyPayload) => Promise<InspectPreviewResult>;
|
|
8
|
+
export type InspectImpactHandler = (componentFiles: string[]) => Promise<InspectImpactResult>;
|
|
9
|
+
export type DesignChangeHandler = (payload: DesignChangePayload) => Promise<DesignChangeResult | void>;
|
|
10
|
+
export type PreviewOpenChangeHandler = (open: boolean) => void;
|
|
11
|
+
/** The six host callbacks, as one immutable object so a render can subscribe to "any of them changed". */
|
|
12
|
+
export interface HostCallbacks {
|
|
13
|
+
readonly onApply: ApplyHandler | null;
|
|
14
|
+
readonly onInspectApply: InspectApplyHandler | null;
|
|
15
|
+
readonly onInspectPreview: InspectPreviewHandler | null;
|
|
16
|
+
readonly onInspectImpact: InspectImpactHandler | null;
|
|
17
|
+
readonly onDesignChange: DesignChangeHandler | null;
|
|
18
|
+
readonly onPreviewOpenChange: PreviewOpenChangeHandler | null;
|
|
19
|
+
}
|
|
20
|
+
export type StaticFrameSurface = 'bitmap' | 'dom';
|
|
21
|
+
export interface HostBindingsInit {
|
|
22
|
+
appOrigin?: string;
|
|
23
|
+
artifactOrigin?: string;
|
|
24
|
+
previewRevision?: string;
|
|
25
|
+
flowCanvas?: string;
|
|
26
|
+
staticFrameSurface?: StaticFrameSurface;
|
|
27
|
+
}
|
|
28
|
+
export declare class HostBindings {
|
|
29
|
+
private appOriginValue;
|
|
30
|
+
private artifactOriginValue;
|
|
31
|
+
private previewRevisionValue;
|
|
32
|
+
private callbacksValue;
|
|
33
|
+
private callbackVersionValue;
|
|
34
|
+
private readonly appOriginListeners;
|
|
35
|
+
private readonly artifactOriginListeners;
|
|
36
|
+
private readonly previewRevisionListeners;
|
|
37
|
+
private readonly callbackListeners;
|
|
38
|
+
/**
|
|
39
|
+
* The canvas the full-screen preview always plays: entering it from a sheet
|
|
40
|
+
* or token canvas still opens the application flow. Empty plays the active
|
|
41
|
+
* page as before.
|
|
42
|
+
*/
|
|
43
|
+
flowCanvas: string;
|
|
44
|
+
/**
|
|
45
|
+
* The default static surface for route frames. `bitmap` renders captured
|
|
46
|
+
* screenshots and reconstructs frozen DOM only on demand; `dom` mounts the
|
|
47
|
+
* frozen DOM from the start, which suits per-section canvases where every
|
|
48
|
+
* activation must be promotion-ready without a mount wait.
|
|
49
|
+
*/
|
|
50
|
+
staticFrameSurface: StaticFrameSurface;
|
|
51
|
+
constructor(init?: HostBindingsInit);
|
|
52
|
+
get appOrigin(): string;
|
|
53
|
+
setAppOrigin: (origin: string) => void;
|
|
54
|
+
subscribeAppOrigin: (listener: () => void) => (() => void);
|
|
55
|
+
/**
|
|
56
|
+
* Origin a captured snapshot resolves its relative assets against.
|
|
57
|
+
*
|
|
58
|
+
* This is not the same question as "where does the live screen run". A
|
|
59
|
+
* capture is already rendered and needs somewhere to fetch the images and
|
|
60
|
+
* fonts its markup points at, while a live frame needs the checkout of a
|
|
61
|
+
* specific revision. The order is most-accurate-first: an origin the host
|
|
62
|
+
* declared, then the live one once a runtime exists, then the editor's own,
|
|
63
|
+
* which serves the same application and lets the catalog paint immediately.
|
|
64
|
+
*/
|
|
65
|
+
get artifactOrigin(): string;
|
|
66
|
+
setArtifactOrigin: (origin: string) => void;
|
|
67
|
+
subscribeArtifactOrigin: (listener: () => void) => (() => void);
|
|
68
|
+
/** Baseline code version of the preview. A change creates a new static screen cache for the same URL. */
|
|
69
|
+
get previewRevision(): string;
|
|
70
|
+
setPreviewRevision: (revision: string) => void;
|
|
71
|
+
subscribePreviewRevision: (listener: () => void) => (() => void);
|
|
72
|
+
setFlowCanvas: (canvas: string) => void;
|
|
73
|
+
setStaticFrameSurface: (surface: StaticFrameSurface) => void;
|
|
74
|
+
get callbacks(): HostCallbacks;
|
|
75
|
+
get callbackVersion(): number;
|
|
76
|
+
subscribeCallbacks: (listener: () => void) => (() => void);
|
|
77
|
+
get onApply(): ApplyHandler | null;
|
|
78
|
+
get onInspectApply(): InspectApplyHandler | null;
|
|
79
|
+
get onInspectPreview(): InspectPreviewHandler | null;
|
|
80
|
+
get onInspectImpact(): InspectImpactHandler | null;
|
|
81
|
+
get onDesignChange(): DesignChangeHandler | null;
|
|
82
|
+
get onPreviewOpenChange(): PreviewOpenChangeHandler | null;
|
|
83
|
+
setOnApply: (callback: ApplyHandler | null) => void;
|
|
84
|
+
setOnInspectApply: (callback: InspectApplyHandler | null) => void;
|
|
85
|
+
setOnInspectPreview: (callback: InspectPreviewHandler | null) => void;
|
|
86
|
+
setOnInspectImpact: (callback: InspectImpactHandler | null) => void;
|
|
87
|
+
setOnDesignChange: (callback: DesignChangeHandler | null) => void;
|
|
88
|
+
setOnPreviewOpenChange: (callback: PreviewOpenChangeHandler | null) => void;
|
|
89
|
+
private setCallback;
|
|
90
|
+
}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { EditorStore } from '../editor/store';
|
|
2
|
+
import { HostBindings, type HostBindingsInit } from './hostBindings';
|
|
3
|
+
import { type EditorRuntimeDebug } from './debug';
|
|
4
|
+
import type { EditorTransport } from '../contract/transport.js';
|
|
5
|
+
export interface EditorRuntimeOptions {
|
|
6
|
+
/** Initial host values; every one can also be set later through `runtime.host`. */
|
|
7
|
+
host?: HostBindingsInit;
|
|
8
|
+
/**
|
|
9
|
+
* How this editor reaches the Node side. Defaults to the same-origin Vite
|
|
10
|
+
* transport; pass `createViteTransport({ endpoints, fetch })` to move paths
|
|
11
|
+
* or stub the network, or another implementation of the interface.
|
|
12
|
+
*/
|
|
13
|
+
transport?: EditorTransport;
|
|
14
|
+
}
|
|
15
|
+
export interface EditorRuntime {
|
|
16
|
+
readonly store: EditorStore;
|
|
17
|
+
readonly host: HostBindings;
|
|
18
|
+
readonly transport: EditorTransport;
|
|
19
|
+
/** Headless diagnosis surface, the former module-level `__debug`. */
|
|
20
|
+
readonly debug: EditorRuntimeDebug;
|
|
21
|
+
/** Switches to the page with this name, in the editor and the preview alike. */
|
|
22
|
+
navigate(pageName: string): void;
|
|
23
|
+
/** Opens the prototype preview, for hosts that place their own entry button. */
|
|
24
|
+
openPreview(): void;
|
|
25
|
+
/** Discards unapplied canvas and inspection edits made since the latest source load or apply. */
|
|
26
|
+
resetCurrentEdits(): boolean;
|
|
27
|
+
/**
|
|
28
|
+
* Installs the module-level registrations this runtime needs while an editor
|
|
29
|
+
* is mounted on it, and returns the function that removes them. Attaching
|
|
30
|
+
* one runtime from two mounted editors at once is an error.
|
|
31
|
+
*/
|
|
32
|
+
attach(): () => void;
|
|
33
|
+
/** Releases what the store holds (reactions, persistence subscriptions). */
|
|
34
|
+
dispose(): void;
|
|
35
|
+
}
|
|
36
|
+
export declare function createEditorRuntime(options?: EditorRuntimeOptions): EditorRuntime;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { EditorStore } from '../editor/store';
|
|
2
|
+
import type { HostBindings, HostCallbacks } from './hostBindings';
|
|
3
|
+
import type { EditorRuntime } from './runtime';
|
|
4
|
+
export declare const EditorRuntimeContext: import("react").Context<EditorRuntime | null>;
|
|
5
|
+
export declare function useEditorRuntime(): EditorRuntime;
|
|
6
|
+
export declare function useEditorStore(): EditorStore;
|
|
7
|
+
export declare function useHostBindings(): HostBindings;
|
|
8
|
+
/**
|
|
9
|
+
* The host callbacks as a render-time value. They are installed from props in
|
|
10
|
+
* a layout effect, so a component that decides on first paint whether a diff
|
|
11
|
+
* review is required subscribes here rather than reading a getter once.
|
|
12
|
+
*/
|
|
13
|
+
export declare function useHostCallbacks(): HostCallbacks;
|
|
@@ -1,9 +1,17 @@
|
|
|
1
1
|
import { type DesignImportController, type DesignScreenCaptureSpec } from './designImport';
|
|
2
2
|
import type { FlowSessionRunner, ResolvedFlowPath } from './flowSessions';
|
|
3
3
|
import type { ScreenFlowPath } from './screenFlows';
|
|
4
|
-
import {
|
|
4
|
+
import type { EditorStore, PageModel } from './store';
|
|
5
|
+
/** What the scheduler needs from an editor runtime; `EditorRuntime` satisfies it. */
|
|
6
|
+
export interface FlowSessionRuntime {
|
|
7
|
+
readonly store: EditorStore;
|
|
8
|
+
readonly host: {
|
|
9
|
+
readonly appOrigin: string;
|
|
10
|
+
readonly previewRevision: string;
|
|
11
|
+
};
|
|
12
|
+
}
|
|
5
13
|
/** Applies the active frame's own boot condition to a path-specific session. */
|
|
6
|
-
export declare function resolveActivePagePath(resolved: ResolvedFlowPath, path: ScreenFlowPath, page: PageModel): ResolvedFlowPath;
|
|
14
|
+
export declare function resolveActivePagePath(resolved: ResolvedFlowPath, path: ScreenFlowPath, page: PageModel, appOrigin: string): ResolvedFlowPath;
|
|
7
15
|
/** Diagnostic counters for the headless debug surface. */
|
|
8
16
|
export declare const __flowSchedulerDebug: {
|
|
9
17
|
calls: number;
|
|
@@ -17,7 +25,7 @@ export declare const __flowSchedulerDebug: {
|
|
|
17
25
|
* frozen snapshot. Paths delivering the active frame's screen run first.
|
|
18
26
|
* Returns the number of paths queued.
|
|
19
27
|
*/
|
|
20
|
-
export declare function materializeCanvasFlows(input: {
|
|
28
|
+
export declare function materializeCanvasFlows(runtime: FlowSessionRuntime, input: {
|
|
21
29
|
canvas: string;
|
|
22
30
|
previewRevision: string;
|
|
23
31
|
/**
|
|
@@ -37,7 +45,7 @@ export declare function flowSessionWillDeliverPage(page: {
|
|
|
37
45
|
* it, unless a parked instance already serves that path. Returns true when a
|
|
38
46
|
* warming walk was queued.
|
|
39
47
|
*/
|
|
40
|
-
export declare function warmActiveFrameInstance(page: PageModel, previewRevision: string): boolean;
|
|
48
|
+
export declare function warmActiveFrameInstance(runtime: FlowSessionRuntime, page: PageModel, previewRevision: string): boolean;
|
|
41
49
|
/** Diagnostic counters for activation warming. */
|
|
42
50
|
export declare const __warmingDebug: {
|
|
43
51
|
requested: number;
|
|
@@ -53,7 +61,7 @@ export declare const __warmingDebug: {
|
|
|
53
61
|
* after the size change commits. Returns false when no flow claims the
|
|
54
62
|
* screen (the live re-import fallback stays for those).
|
|
55
63
|
*/
|
|
56
|
-
export declare function materializePageViewport(page: PageModel, viewport: {
|
|
64
|
+
export declare function materializePageViewport(runtime: FlowSessionRuntime, page: PageModel, viewport: {
|
|
57
65
|
width: number;
|
|
58
66
|
height: number;
|
|
59
67
|
}, previewRevision: string): boolean;
|
|
@@ -103,7 +111,7 @@ export declare function interactiveSessionSurfaceId(page: {
|
|
|
103
111
|
* Returns false when no flow claims the screen — those frames keep the live
|
|
104
112
|
* boot fallback.
|
|
105
113
|
*/
|
|
106
|
-
export declare function materializePageInteractiveState(page: PageModel, previewRevision: string, targetCacheKey?: string): boolean;
|
|
114
|
+
export declare function materializePageInteractiveState(runtime: FlowSessionRuntime, page: PageModel, previewRevision: string, targetCacheKey?: string): boolean;
|
|
107
115
|
/** True while an interactive-state session still owes this page its snapshot. */
|
|
108
116
|
export declare function interactiveSessionWillDeliver(page: {
|
|
109
117
|
id: string;
|
|
@@ -142,7 +150,7 @@ export declare function interactiveSessionTracksVariant(variantPage: {
|
|
|
142
150
|
* most one speculative walk is therefore ever queued or running, and a real
|
|
143
151
|
* selection made meanwhile queues behind that single walk at worst.
|
|
144
152
|
*/
|
|
145
|
-
export declare function prefetchPageInteractiveVariant(variantPage: PageModel, previewRevision: string): InteractiveVariantPrefetchOutcome;
|
|
153
|
+
export declare function prefetchPageInteractiveVariant(runtime: FlowSessionRuntime, variantPage: PageModel, previewRevision: string): InteractiveVariantPrefetchOutcome;
|
|
146
154
|
/** Diagnostic counters for the interactive-state path. */
|
|
147
155
|
export declare const __interactiveSessionDebug: {
|
|
148
156
|
requested: number;
|
|
@@ -170,4 +178,10 @@ export declare const __viewportCommitDebug: {
|
|
|
170
178
|
};
|
|
171
179
|
/** Viewport-runner delivery states for the headless debug surface. */
|
|
172
180
|
export declare function __debugViewportSessionStates(): Record<string, unknown>;
|
|
181
|
+
/**
|
|
182
|
+
* Installs the direct-state handlers for one runtime and returns their
|
|
183
|
+
* remover. Called from `runtime.attach()`, so a mounted editor owns them and
|
|
184
|
+
* an unmounted one releases them.
|
|
185
|
+
*/
|
|
186
|
+
export declare function installDirectInteractiveStateHandlers(runtime: FlowSessionRuntime): () => void;
|
|
173
187
|
export {};
|
|
@@ -1,21 +1,21 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import type { PageModel } from './store';
|
|
2
2
|
/**
|
|
3
3
|
* The preview environment of one page: its own declared environment, plus the
|
|
4
4
|
* host's preview-environment override when the page is the active one.
|
|
5
5
|
*
|
|
6
|
-
* `active`
|
|
7
|
-
*
|
|
8
|
-
*
|
|
9
|
-
* click
|
|
10
|
-
*
|
|
11
|
-
*
|
|
6
|
+
* `active` is required rather than looked up. This module used to default it
|
|
7
|
+
* to a read of the store's active page, and inside a MobX observer render that
|
|
8
|
+
* read subscribed the component to every selection change — which is how a
|
|
9
|
+
* single click once re-rendered all 79 frames. A caller knows whether its page
|
|
10
|
+
* is active (FrameView receives it as a prop; a store-side caller compares
|
|
11
|
+
* ids), and passing it keeps the computation free of any store.
|
|
12
12
|
*/
|
|
13
|
-
export declare function pagePreviewEnvironment(page: PageModel, active
|
|
13
|
+
export declare function pagePreviewEnvironment(page: PageModel, active: boolean): import("./designImport").StoryboardEnvironment | undefined;
|
|
14
14
|
/**
|
|
15
15
|
* The recipe cache key of one page. `active` is forwarded to
|
|
16
16
|
* pagePreviewEnvironment — see its note on selection reactivity.
|
|
17
17
|
*/
|
|
18
|
-
export declare function routePreviewCacheKey(page: PageModel, previewRevision: string, viewport?: {
|
|
18
|
+
export declare function routePreviewCacheKey(page: PageModel, previewRevision: string, active: boolean, viewport?: {
|
|
19
19
|
width: number;
|
|
20
20
|
height: number;
|
|
21
|
-
}
|
|
21
|
+
}): string;
|
|
@@ -93,50 +93,55 @@ export interface DesignChangeResult {
|
|
|
93
93
|
files?: string[];
|
|
94
94
|
message?: string;
|
|
95
95
|
}
|
|
96
|
+
/** @deprecated Use `runtime.host.setAppOrigin`. */
|
|
96
97
|
export declare function setAppOrigin(origin: string): void;
|
|
98
|
+
/** @deprecated Use `runtime.host.appOrigin`. */
|
|
97
99
|
export declare function getAppOrigin(): string;
|
|
100
|
+
/** @deprecated Use `runtime.host.subscribeAppOrigin`. */
|
|
98
101
|
export declare function subscribeAppOrigin(listener: () => void): () => void;
|
|
102
|
+
/** @deprecated Use `runtime.host.setArtifactOrigin`. */
|
|
99
103
|
export declare function setArtifactOrigin(origin: string): void;
|
|
100
|
-
/**
|
|
101
|
-
* Origin a captured snapshot resolves its relative assets against.
|
|
102
|
-
*
|
|
103
|
-
* This is not the same question as "where does the live screen run". A capture is
|
|
104
|
-
* already rendered — it needs somewhere to fetch the images and fonts its markup
|
|
105
|
-
* still points at — while a live frame needs the checkout of a specific revision.
|
|
106
|
-
* Answering both with one value tied the catalog to a checkout that takes minutes
|
|
107
|
-
* to build, so opening the editor showed a spinner instead of the frames sitting
|
|
108
|
-
* on disk.
|
|
109
|
-
*
|
|
110
|
-
* The order is most-accurate-first: an origin the host declared, then the live
|
|
111
|
-
* one once a runtime exists, then the editor's own — which serves the same
|
|
112
|
-
* application and lets the catalog paint immediately. Assets it cannot resolve
|
|
113
|
-
* are the ones the working tree no longer has; the live origin replaces them the
|
|
114
|
-
* moment it comes up, because these readers re-run when it does.
|
|
115
|
-
*/
|
|
104
|
+
/** @deprecated Use `runtime.host.artifactOrigin`; see its documentation for the fallback order. */
|
|
116
105
|
export declare function getArtifactOrigin(): string;
|
|
106
|
+
/** @deprecated Use `runtime.host.subscribeArtifactOrigin`. */
|
|
117
107
|
export declare function subscribeArtifactOrigin(listener: () => void): () => void;
|
|
118
|
-
/**
|
|
108
|
+
/** @deprecated Use `runtime.host.setPreviewRevision`. */
|
|
119
109
|
export declare function setPreviewRevision(revision: string): void;
|
|
110
|
+
/** @deprecated Use `runtime.host.previewRevision`. */
|
|
120
111
|
export declare function getPreviewRevision(): string;
|
|
112
|
+
/** @deprecated Use `runtime.host.subscribePreviewRevision`. */
|
|
121
113
|
export declare function subscribePreviewRevision(listener: () => void): () => void;
|
|
114
|
+
/** @deprecated Use `runtime.host.setFlowCanvas`. */
|
|
122
115
|
export declare function setFlowCanvas(canvas: string): void;
|
|
116
|
+
/** @deprecated Use `runtime.host.flowCanvas`. */
|
|
123
117
|
export declare function getFlowCanvas(): string;
|
|
118
|
+
/** @deprecated Use `runtime.host.setStaticFrameSurface`. */
|
|
124
119
|
export declare function setStaticFrameSurface(surface: 'bitmap' | 'dom'): void;
|
|
120
|
+
/** @deprecated Use `runtime.host.staticFrameSurface`. */
|
|
125
121
|
export declare function getStaticFrameSurface(): 'bitmap' | 'dom';
|
|
122
|
+
/** @deprecated Use `runtime.host.setOnApply`. */
|
|
126
123
|
export declare function setOnApply(cb: ((payload: ApplyPayload) => Promise<{
|
|
127
124
|
branch: string;
|
|
128
125
|
} | void>) | null): void;
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
126
|
+
/** @deprecated Use `runtime.host.onApply`. */
|
|
127
|
+
export declare function getOnApply(): import("../core/hostBindings").ApplyHandler | null;
|
|
128
|
+
/** @deprecated Use `runtime.host.setOnInspectApply`. */
|
|
132
129
|
export declare function setOnInspectApply(cb: ((payload: InspectApplyPayload) => Promise<InspectApplyResult | void>) | null): void;
|
|
133
|
-
|
|
130
|
+
/** @deprecated Use `runtime.host.onInspectApply`. */
|
|
131
|
+
export declare function getOnInspectApply(): import("../core/hostBindings").InspectApplyHandler | null;
|
|
132
|
+
/** @deprecated Use `runtime.host.setOnInspectPreview`. */
|
|
134
133
|
export declare function setOnInspectPreview(cb: ((payload: InspectApplyPayload) => Promise<InspectPreviewResult>) | null): void;
|
|
135
|
-
|
|
134
|
+
/** @deprecated Use `runtime.host.onInspectPreview`. */
|
|
135
|
+
export declare function getOnInspectPreview(): import("../core/hostBindings").InspectPreviewHandler | null;
|
|
136
|
+
/** @deprecated Use `runtime.host.setOnInspectImpact`. */
|
|
136
137
|
export declare function setOnInspectImpact(cb: ((componentFiles: string[]) => Promise<InspectImpactResult>) | null): void;
|
|
137
|
-
|
|
138
|
+
/** @deprecated Use `runtime.host.onInspectImpact`. */
|
|
139
|
+
export declare function getOnInspectImpact(): import("../core/hostBindings").InspectImpactHandler | null;
|
|
140
|
+
/** @deprecated Use `runtime.host.setOnDesignChange`. */
|
|
138
141
|
export declare function setOnDesignChange(cb: ((payload: DesignChangePayload) => Promise<DesignChangeResult | void>) | null): void;
|
|
139
|
-
|
|
140
|
-
|
|
142
|
+
/** @deprecated Use `runtime.host.onDesignChange`. */
|
|
143
|
+
export declare function getOnDesignChange(): import("../core/hostBindings").DesignChangeHandler | null;
|
|
144
|
+
/** @deprecated Use `runtime.host.setOnPreviewOpenChange`. */
|
|
141
145
|
export declare function setOnPreviewOpenChange(cb: ((open: boolean) => void) | null): void;
|
|
142
|
-
|
|
146
|
+
/** @deprecated Use `runtime.host.onPreviewOpenChange`. */
|
|
147
|
+
export declare function getOnPreviewOpenChange(): import("../core/hostBindings").PreviewOpenChangeHandler | null;
|
|
@@ -23,21 +23,7 @@ export interface PreviewArtifactFrameRequest {
|
|
|
23
23
|
/** The recipe the fingerprint stands for; travels only where a capture may run. */
|
|
24
24
|
recipe?: RoutePreviewFrameRecipe;
|
|
25
25
|
}
|
|
26
|
-
|
|
27
|
-
* Where a capture request sits among captures waiting on the same identity.
|
|
28
|
-
* Smaller runs first. Mirrors `PREVIEW_CAPTURE_PRIORITY` in
|
|
29
|
-
* `node/preview-artifact-plugin.mjs` (browser code cannot import the Node
|
|
30
|
-
* plugin); a shared test pins the pair.
|
|
31
|
-
*/
|
|
32
|
-
export declare const PREVIEW_CAPTURE_PRIORITY: Readonly<{
|
|
33
|
-
/** A frame the designer selected: whatever else is queued waits. */
|
|
34
|
-
selected: 0;
|
|
35
|
-
/** The canvas in front of the designer being filled. */
|
|
36
|
-
canvas: 10;
|
|
37
|
-
/** A canvas nobody is looking at yet. */
|
|
38
|
-
background: 20;
|
|
39
|
-
}>;
|
|
40
|
-
export type PreviewCapturePriority = (typeof PREVIEW_CAPTURE_PRIORITY)[keyof typeof PREVIEW_CAPTURE_PRIORITY];
|
|
26
|
+
export { PREVIEW_CAPTURE_PRIORITY, type PreviewCapturePriority } from '../contract/paths.js';
|
|
41
27
|
export interface PreviewArtifactTransportRequest extends PreviewArtifactExpectation {
|
|
42
28
|
/** Frames to fetch. Omitted asks for the whole bundle, as earlier versions did. */
|
|
43
29
|
frames?: readonly PreviewArtifactFrameRequest[];
|
|
@@ -242,6 +228,10 @@ export declare function createStoryboardCaptureRecipeIdentity(screen: Storyboard
|
|
|
242
228
|
* Creates the default same-origin HTTP transport for preview artifacts.
|
|
243
229
|
* Hosts provide only an endpoint; identity query parameters and safe fetch
|
|
244
230
|
* semantics remain owned by Pygmalion.
|
|
231
|
+
*
|
|
232
|
+
* An adapter over `createViteTransport().preview.artifact`, kept so a host
|
|
233
|
+
* that assembled its own transport from an endpoint and a fetcher still can.
|
|
234
|
+
* An absolute endpoint splits into the transport's origin and path.
|
|
245
235
|
*/
|
|
246
236
|
export declare function createPreviewArtifactHttpTransport({ endpoint, fetcher, captureBaseUrl, }: PreviewArtifactHttpTransportOptions): PreviewArtifactTransport;
|
|
247
237
|
/** Resolves frame freshness without downloading or validating snapshot payloads. */
|
|
@@ -1,4 +1,6 @@
|
|
|
1
|
-
|
|
1
|
+
import { PYGMALION_PREVIEW_CAPTURE_PROGRESS_SUFFIX } from '../contract/paths.js';
|
|
2
|
+
import type { EditorTransport } from '../contract/transport.js';
|
|
3
|
+
export { PYGMALION_PREVIEW_CAPTURE_PROGRESS_SUFFIX };
|
|
2
4
|
export type PygmalionPreviewCaptureProgressPhase = 'idle' | 'queued' | 'preparing' | 'capturing' | 'retrying' | 'finalizing';
|
|
3
5
|
export interface PygmalionPreviewCaptureProgress {
|
|
4
6
|
active: boolean;
|
|
@@ -43,5 +45,8 @@ export declare function mergePreviewCaptureProgress(worker: PygmalionPreviewCapt
|
|
|
43
45
|
* Reads the local preview worker's current progress from the artifact plugin.
|
|
44
46
|
* Idle polling is deliberately slower; an active capture tightens the interval
|
|
45
47
|
* so a multi-minute job stays legible without holding a streaming connection.
|
|
48
|
+
*
|
|
49
|
+
* Polls the given transport, or the mounted editor's when rendered inside
|
|
50
|
+
* one, and only while that transport has a progress endpoint configured.
|
|
46
51
|
*/
|
|
47
|
-
export declare function usePygmalionPreviewCaptureProgress(
|
|
52
|
+
export declare function usePygmalionPreviewCaptureProgress(transport?: EditorTransport | null): PygmalionPreviewCaptureProgress;
|
|
@@ -31,17 +31,30 @@ export interface MirrorGateStatus {
|
|
|
31
31
|
export interface IdleMirrorSourceStatus extends MirrorGateStatus {
|
|
32
32
|
sourceRef: string | null;
|
|
33
33
|
}
|
|
34
|
+
/** One listed ref whose exact revision can start a lazy checkout. */
|
|
35
|
+
export interface IdleMirrorListedSourceRef {
|
|
36
|
+
name: string;
|
|
37
|
+
fullName?: string;
|
|
38
|
+
sourceRevision?: string;
|
|
39
|
+
}
|
|
40
|
+
/** The ref-list fields needed to resolve an idle named source. */
|
|
41
|
+
export interface IdleMirrorSourceRefs {
|
|
42
|
+
refs: readonly IdleMirrorListedSourceRef[];
|
|
43
|
+
defaultRef: string | null;
|
|
44
|
+
worktreeRef?: string | null;
|
|
45
|
+
}
|
|
34
46
|
/**
|
|
35
47
|
* Returns an immutable source revision that can safely create the first lazy
|
|
36
48
|
* preview demand.
|
|
37
49
|
*
|
|
38
50
|
* An idle mirror has no checked-out `commit` yet. When it was configured with
|
|
39
51
|
* a full Git object id, however, that ref already names the exact revision the
|
|
40
|
-
* catalog endpoint will verify after preparation.
|
|
41
|
-
*
|
|
42
|
-
*
|
|
52
|
+
* catalog endpoint will verify after preparation. A named ref can also create
|
|
53
|
+
* that first demand when the ref-list endpoint supplies its full object id.
|
|
54
|
+
* The abbreviated display commit is intentionally ignored: it can be
|
|
55
|
+
* ambiguous and cannot satisfy the exact source lease.
|
|
43
56
|
*/
|
|
44
|
-
export declare function idleMirrorSourceRevision(status: IdleMirrorSourceStatus): string | null;
|
|
57
|
+
export declare function idleMirrorSourceRevision(status: IdleMirrorSourceStatus, sourceRefs?: IdleMirrorSourceRefs): string | null;
|
|
45
58
|
export interface SettleMirrorStatusOptions<S extends MirrorGateStatus> {
|
|
46
59
|
/** Status of the initial request; returned as-is when already settled. */
|
|
47
60
|
initial: S;
|