@pygmalionjs/pygmalion 0.6.18 → 0.6.19

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.
@@ -1,4 +1,4 @@
1
- import { F as s, N as a, e as r, s as i, a as t } from "./FrozenRoutePreview-CZSFEQgN.js";
1
+ import { F as s, N as a, e as r, s as i, a as t } from "./FrozenRoutePreview-B6UY1aLt.js";
2
2
  export {
3
3
  s as FrozenRoutePreviewView,
4
4
  a as NodeModel,
@@ -1,3 +1,4 @@
1
+ import { type InteractiveSessionSurface } from '../editor/interactiveSessionSurface';
1
2
  /**
2
3
  * True while a flow session still owes this screen its snapshot. Frames use
3
4
  * it exactly like the artifact-hydration gate: activation waits for the
@@ -24,11 +25,18 @@ export declare function useViewportSessionPending(page: {
24
25
  * itself — the session does that work in one instance the warm pool keeps.
25
26
  */
26
27
  export declare function useInteractiveSessionPending(page: {
27
- importPageId?: string;
28
28
  id: string;
29
29
  interactiveStateId?: string;
30
30
  interactiveOptionId?: string;
31
- }): boolean;
31
+ interactiveOptionIds?: readonly string[];
32
+ }, targetCacheKey?: string): boolean;
33
+ /** The runner-owned live document currently reproducing this state. */
34
+ export declare function useInteractiveSessionSurface(page: {
35
+ id: string;
36
+ interactiveStateId?: string;
37
+ interactiveOptionId?: string;
38
+ interactiveOptionIds?: readonly string[];
39
+ }): InteractiveSessionSurface | null;
32
40
  /**
33
41
  * True while this frame holds one of the host's live screen slots, meaning it
34
42
  * renders the running app rather than its frozen capture.
@@ -67,6 +67,8 @@ export interface DesignScreenInteractionRunOptions {
67
67
  * The capture default is 600ms. A step's explicit `settleMs` always wins.
68
68
  */
69
69
  defaultActionSettleMs?: number;
70
+ /** Called after boot presets succeed and immediately before actions begin. */
71
+ onBeforeInteractions?: () => void;
70
72
  }
71
73
  /** A JSON-compatible value that conveys host-specific meaning without Pygmalion interpreting it. */
72
74
  export type DesignSerializable = string | number | boolean | null | readonly DesignSerializable[] | {
@@ -1,5 +1,9 @@
1
1
  import { type DesignImportController, type DesignScreenCaptureSpec } from './designImport';
2
+ import type { ResolvedFlowPath } from './flowSessions';
3
+ import type { ScreenFlowPath } from './screenFlows';
2
4
  import { type PageModel } from './store';
5
+ /** 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;
3
7
  /** Diagnostic counters for the headless debug surface. */
4
8
  export declare const __flowSchedulerDebug: {
5
9
  calls: number;
@@ -69,7 +73,13 @@ type InteractivePreparationController = Pick<DesignImportController, 'prepareScr
69
73
  * The runner already waits for a trailing paint and stable geometry before it
70
74
  * serializes, so repeating the capture stability pass only delays the panel.
71
75
  */
72
- export declare function prepareInteractiveSessionState(iframe: HTMLIFrameElement, spec: DesignScreenCaptureSpec, controller?: InteractivePreparationController | null): Promise<import("./designImport").DesignScreenCaptureReport>;
76
+ export declare function prepareInteractiveSessionState(iframe: HTMLIFrameElement, spec: DesignScreenCaptureSpec, controller?: InteractivePreparationController | null, onBeforeInteractions?: () => void): Promise<import("./designImport").DesignScreenCaptureReport>;
77
+ export declare function interactiveSessionScreenId(page: {
78
+ id: string;
79
+ interactiveStateId?: string;
80
+ interactiveOptionId?: string;
81
+ interactiveOptionIds?: readonly string[];
82
+ }): string;
73
83
  /**
74
84
  * Materializes one screen in its declared interactive state through the
75
85
  * screen's flow path. The prefix walks as pass-through; the target publishes
@@ -78,14 +88,14 @@ export declare function prepareInteractiveSessionState(iframe: HTMLIFrameElement
78
88
  * Returns false when no flow claims the screen — those frames keep the live
79
89
  * boot fallback.
80
90
  */
81
- export declare function materializePageInteractiveState(page: PageModel, previewRevision: string): boolean;
91
+ export declare function materializePageInteractiveState(page: PageModel, previewRevision: string, targetCacheKey?: string): boolean;
82
92
  /** True while an interactive-state session still owes this page its snapshot. */
83
93
  export declare function interactiveSessionWillDeliver(page: {
84
- importPageId?: string;
85
94
  id: string;
86
95
  interactiveStateId?: string;
87
96
  interactiveOptionId?: string;
88
- }): boolean;
97
+ interactiveOptionIds?: readonly string[];
98
+ }, targetCacheKey?: string): boolean;
89
99
  /** Subscribe to interactive-state delivery changes. */
90
100
  export declare function subscribeInteractiveSessions(listener: () => void): () => void;
91
101
  /** Diagnostic counters for the interactive-state path. */
@@ -87,7 +87,7 @@ export interface FlowSessionRunnerOptions {
87
87
  preset?: DesignScreenPreset;
88
88
  interactions?: readonly DesignScreenInteraction[];
89
89
  assertions?: readonly DesignScreenAssertion[];
90
- }) => Promise<DesignScreenCaptureReport>;
90
+ }, waypoint: ResolvedFlowWaypoint) => Promise<DesignScreenCaptureReport>;
91
91
  /** Extra settle before serializing a waypoint (fonts, trailing paints). */
92
92
  settle?: (iframe: HTMLIFrameElement, ms: number) => Promise<void>;
93
93
  /** Layout-stability wait before serializing. Defaults to waitForGeometryStability. */
@@ -95,6 +95,8 @@ export interface FlowSessionRunnerOptions {
95
95
  serialize?: (iframe: HTMLIFrameElement, fallbackUrl: string) => string | null;
96
96
  /** Writes one waypoint snapshot into the route preview store. */
97
97
  publish?: (cacheKey: string, snapshot: string) => boolean;
98
+ /** Releases a live document after its delivery finishes or is abandoned. */
99
+ onWaypointFinish?: (iframe: HTMLIFrameElement, waypoint: ResolvedFlowWaypoint, outcome: 'completed' | 'failed' | 'cancelled') => void;
98
100
  onError?: (pathId: string, error: unknown) => void;
99
101
  }
100
102
  /**
@@ -144,6 +146,11 @@ export declare function createFlowSessionRunner(options?: FlowSessionRunnerOptio
144
146
  setConcurrency(next: number): void;
145
147
  /** Session state of one screen, or null when no session claims it. */
146
148
  screenState(screenId: string): FlowScreenState | null;
149
+ /**
150
+ * Forgets a terminal delivery whose external snapshot was evicted. A
151
+ * running or queued screen keeps its claim and cannot be invalidated.
152
+ */
153
+ forgetScreen(screenId: string): boolean;
147
154
  /** True while the session still owes this screen its snapshot. */
148
155
  willDeliver(screenId: string): boolean;
149
156
  subscribe(listener: () => void): () => void;
@@ -0,0 +1,18 @@
1
+ /**
2
+ * The live document currently reproducing a right-panel screen state.
3
+ *
4
+ * State preservation and state presentation are intentionally separate. The
5
+ * flow runner keeps this iframe alive until its exact frozen snapshot is
6
+ * published, while the active frame may mirror the running document
7
+ * immediately so capture stability never becomes interaction latency.
8
+ */
9
+ export interface InteractiveSessionSurface {
10
+ iframe: HTMLIFrameElement;
11
+ screenId: string;
12
+ }
13
+ /** Exposes a runner-owned iframe without transferring its ownership. */
14
+ export declare function exposeInteractiveSessionSurface(screenId: string, iframe: HTMLIFrameElement): void;
15
+ /** Releases a surface only when the caller still owns the registered iframe. */
16
+ export declare function releaseInteractiveSessionSurface(screenId: string, iframe: HTMLIFrameElement): void;
17
+ export declare function getInteractiveSessionSurface(screenId: string): InteractiveSessionSurface | null;
18
+ export declare function subscribeInteractiveSessionSurface(screenId: string, listener: () => void): () => void;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pygmalionjs/pygmalion",
3
- "version": "0.6.18",
3
+ "version": "0.6.19",
4
4
  "description": "Code-backed DOM design sandbox and visual QA editor",
5
5
  "license": "UNLICENSED",
6
6
  "publishConfig": {