@pygmalionjs/pygmalion 0.7.4 → 0.8.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.ko.md +17 -2
- package/README.md +18 -2
- package/dist-lib/CameraLayer-nkNrazn8.js +159 -0
- package/dist-lib/pygmalion.js +14628 -16995
- package/dist-lib/runtime-DdYnT6k4.js +19705 -0
- package/dist-lib/style.css +1 -1
- package/dist-lib/testing.js +20 -21
- package/dist-lib/types/EditorShell.d.ts +1 -1
- package/dist-lib/types/canvas/CameraLayer.d.ts +3 -3
- package/dist-lib/types/canvas/Canvas.d.ts +2 -2
- package/dist-lib/types/canvas/FrameLabelBanner.d.ts +1 -1
- package/dist-lib/types/canvas/FrameView.d.ts +8 -2
- package/dist-lib/types/canvas/FrozenRoutePreview.d.ts +1 -1
- package/dist-lib/types/canvas/InspectOverlay.d.ts +4 -2
- package/dist-lib/types/canvas/LightweightCanvas.d.ts +1 -1
- package/dist-lib/types/canvas/SectionBoxes.d.ts +1 -1
- package/dist-lib/types/canvas/ShadowRoutePreview.d.ts +2 -2
- package/dist-lib/types/canvas/useFlowSession.d.ts +1 -1
- package/dist-lib/types/canvas/useFrameLod.d.ts +1 -1
- package/dist-lib/types/contract/transport.d.ts +5 -5
- package/dist-lib/types/contract/types.d.ts +1 -1
- package/dist-lib/types/contract/validate.d.ts +3 -3
- package/dist-lib/types/core/context.d.ts +2 -2
- package/dist-lib/types/core/debug.d.ts +14 -14
- package/dist-lib/types/core/hostBindings.d.ts +2 -2
- package/dist-lib/types/core/runtime.d.ts +34 -3
- package/dist-lib/types/core/runtimeContext.d.ts +3 -3
- package/dist-lib/types/core/schedulers.d.ts +67 -0
- package/dist-lib/types/editor/assetEditing.d.ts +2 -2
- package/dist-lib/types/editor/automaticMotion.d.ts +0 -11
- package/dist-lib/types/editor/automaticPseudoStates.d.ts +8 -2
- package/dist-lib/types/editor/captureSupply.d.ts +16 -7
- package/dist-lib/types/editor/catalog.d.ts +2 -2
- package/dist-lib/types/editor/codegen.d.ts +6 -3
- package/dist-lib/types/editor/componentConnections.d.ts +13 -8
- package/dist-lib/types/editor/componentInstances.d.ts +2 -2
- package/dist-lib/types/editor/declarations.d.ts +107 -0
- package/dist-lib/types/editor/designCompiler.d.ts +9 -4
- package/dist-lib/types/editor/designImport.d.ts +48 -12
- package/dist-lib/types/editor/documentSync.d.ts +28 -25
- package/dist-lib/types/editor/domImport.d.ts +2 -2
- package/dist-lib/types/editor/fiberMap.d.ts +1 -1
- package/dist-lib/types/editor/flowSessionScheduler.d.ts +106 -159
- package/dist-lib/types/editor/flowSessions.d.ts +147 -84
- package/dist-lib/types/editor/frameInteraction.d.ts +22 -32
- package/dist-lib/types/editor/frameLabels.d.ts +11 -5
- package/dist-lib/types/editor/frameLanes.d.ts +14 -17
- package/dist-lib/types/editor/frameLod.d.ts +17 -0
- package/dist-lib/types/editor/frameLodRuntime.d.ts +38 -38
- package/dist-lib/types/editor/framePreviewKeys.d.ts +14 -5
- package/dist-lib/types/editor/frozenImport.d.ts +13 -14
- package/dist-lib/types/editor/heldPseudoStates.d.ts +1 -1
- package/dist-lib/types/editor/host.d.ts +10 -55
- package/dist-lib/types/editor/implementationSourceMap.d.ts +2 -2
- package/dist-lib/types/editor/importFidelity.d.ts +1 -1
- package/dist-lib/types/editor/inspect.d.ts +7 -2
- package/dist-lib/types/editor/interactiveSessionSurface.d.ts +26 -34
- package/dist-lib/types/editor/interactiveStates.d.ts +12 -10
- package/dist-lib/types/editor/livePreviewInstances.d.ts +13 -3
- package/dist-lib/types/editor/liveScreens.d.ts +25 -16
- package/dist-lib/types/editor/mountScheduler.d.ts +8 -11
- package/dist-lib/types/editor/nodeSelector.d.ts +1 -1
- package/dist-lib/types/editor/pendingSourceChanges.d.ts +19 -0
- package/dist-lib/types/editor/previewBootstrap.d.ts +12 -22
- package/dist-lib/types/editor/previewCaptureProgress.d.ts +10 -6
- package/dist-lib/types/editor/previewEnvironmentControls.d.ts +14 -17
- package/dist-lib/types/editor/previewIntent.d.ts +11 -16
- package/dist-lib/types/editor/previewSweep.d.ts +7 -3
- package/dist-lib/types/editor/previewWarmup.d.ts +19 -7
- package/dist-lib/types/editor/projectRuntime.d.ts +2 -2
- package/dist-lib/types/editor/registry.d.ts +6 -2
- package/dist-lib/types/editor/revisionCatalog.d.ts +19 -19
- package/dist-lib/types/editor/revisionCatalogInstall.d.ts +18 -17
- package/dist-lib/types/editor/routePreview.d.ts +85 -139
- package/dist-lib/types/editor/scenarioCoverage.d.ts +52 -20
- package/dist-lib/types/editor/screenCards.d.ts +10 -6
- package/dist-lib/types/editor/screenDimensions.d.ts +9 -5
- package/dist-lib/types/editor/screenFlows.d.ts +8 -5
- package/dist-lib/types/editor/screenInteractions.d.ts +9 -1
- package/dist-lib/types/editor/screenLists.d.ts +8 -4
- package/dist-lib/types/editor/screenStateGroups.d.ts +1 -1
- package/dist-lib/types/editor/sectionHeaders.d.ts +10 -6
- package/dist-lib/types/editor/sessionPresets.d.ts +12 -32
- package/dist-lib/types/editor/shadowPreview.d.ts +7 -10
- package/dist-lib/types/editor/sharedSource.d.ts +4 -2
- package/dist-lib/types/editor/sourceChangeSummary.d.ts +1 -1
- package/dist-lib/types/editor/sourceJournal.d.ts +2 -2
- package/dist-lib/types/editor/stateSwitchMetrics.d.ts +68 -82
- package/dist-lib/types/editor/store.d.ts +88 -22
- package/dist-lib/types/editor/storyboardAuthored.d.ts +2 -2
- package/dist-lib/types/editor/storyboardDiscovery.d.ts +4 -3
- package/dist-lib/types/editor/storyboardEnvironment.d.ts +9 -5
- package/dist-lib/types/editor/storyboardGraph.d.ts +1 -1
- package/dist-lib/types/editor/storyboardGraphRuntime.d.ts +8 -10
- package/dist-lib/types/editor/storyboardGraphView.d.ts +1 -1
- package/dist-lib/types/editor/storyboardJourney.d.ts +1 -1
- package/dist-lib/types/editor/surfaceDemands.d.ts +196 -31
- package/dist-lib/types/editor/tokens.d.ts +24 -25
- package/dist-lib/types/editor/variantAxes.d.ts +70 -0
- package/dist-lib/types/editor/variantPrefetch.d.ts +26 -43
- package/dist-lib/types/editor/viewportPresets.d.ts +6 -6
- package/dist-lib/types/editor/visualQa.d.ts +2 -2
- package/dist-lib/types/lib.d.ts +104 -108
- package/dist-lib/types/shell/CatalogAssetPanel.d.ts +1 -1
- package/dist-lib/types/shell/CodePanel.d.ts +1 -1
- package/dist-lib/types/shell/ComponentStateControls.d.ts +7 -53
- package/dist-lib/types/shell/FrameInspector.d.ts +17 -0
- package/dist-lib/types/shell/FrameReviewDetails.d.ts +28 -0
- package/dist-lib/types/shell/LayerTree.d.ts +1 -1
- package/dist-lib/types/shell/StoryboardGraphPanel.d.ts +2 -2
- package/dist-lib/types/shell/VariantPanel.d.ts +23 -0
- package/dist-lib/types/shell/inspectorControls.d.ts +34 -0
- package/dist-lib/types/shell/qaPresentation.d.ts +1 -1
- package/dist-lib/types/testing.d.ts +5 -6
- package/dist-lib/types/ui/SourceRefControl.d.ts +1 -1
- package/docs/coverage-contracts.md +431 -0
- package/docs/screen-state-contract.md +14 -16
- package/node/component-branches.mjs +7 -13
- package/node/design-session.mjs +3 -5
- package/node/dev-mirror.mjs +9 -6
- package/node/envelope.mjs +43 -0
- package/node/impact-frames.mjs +94 -0
- package/node/inspect-plugin.mjs +12 -6
- package/node/preview-artifact-plugin.mjs +3 -9
- package/node/qa-capture-plugin.mjs +3 -6
- package/node/source-graph.mjs +1 -0
- package/node/storyboard-environment.mjs +33 -6
- package/node/vite.mjs +1 -0
- package/package.json +7 -2
- package/dist-lib/CameraLayer-D2wrEPwG.js +0 -415
- package/dist-lib/frameLodRuntime-CU0IYaSu.js +0 -272
- package/dist-lib/runtime-DRkTU9eq.js +0 -16195
- package/dist-lib/types/core/defaultRuntime.d.ts +0 -3
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { RoutePreviewArtifactBundle } from './routePreview.js';
|
|
2
|
-
import type { DesignScreenCase, StoryboardEnvironment } from './designImport';
|
|
2
|
+
import type { DesignScreenCase, StoryboardEnvironment } from './designImport.js';
|
|
3
3
|
export interface PreviewRecipeIdentity {
|
|
4
4
|
id: string;
|
|
5
5
|
recipe: unknown;
|
|
@@ -143,17 +143,6 @@ export declare function createPreviewFrameFingerprint(screen: StoryboardCaptureR
|
|
|
143
143
|
}, options?: {
|
|
144
144
|
dependencyDigest?: string;
|
|
145
145
|
}): string;
|
|
146
|
-
/**
|
|
147
|
-
* Per-route content digests published by the storyboard scan.
|
|
148
|
-
*
|
|
149
|
-
* A source revision remains the provenance boundary. Within that boundary, the
|
|
150
|
-
* route digest makes an edited screen move without invalidating unrelated ones.
|
|
151
|
-
*/
|
|
152
|
-
export declare function setPreviewDependencyDigests(routes: readonly {
|
|
153
|
-
path?: string;
|
|
154
|
-
dependencyDigest?: string;
|
|
155
|
-
}[] | null): void;
|
|
156
|
-
export declare function previewDependencyDigest(route: string): string | undefined;
|
|
157
146
|
export interface PreviewFramePage {
|
|
158
147
|
canonicalId: string;
|
|
159
148
|
route: string;
|
|
@@ -187,8 +176,6 @@ export interface RoutePreviewFrameRecipe {
|
|
|
187
176
|
interactions?: unknown;
|
|
188
177
|
assertions?: unknown;
|
|
189
178
|
}
|
|
190
|
-
/** The recipe behind createRoutePreviewFrameFingerprint, for the same page. */
|
|
191
|
-
export declare function routePreviewFrameRecipe(page: PreviewFramePage, baselineEnvironment?: StoryboardEnvironment): RoutePreviewFrameRecipe;
|
|
192
179
|
/**
|
|
193
180
|
* Resolves the page identity a returned frame must seed.
|
|
194
181
|
*
|
|
@@ -200,14 +187,6 @@ export declare function routePreviewFrameRecipe(page: PreviewFramePage, baseline
|
|
|
200
187
|
export declare function resolveRoutePreviewFrameRequestPage(request: PreviewArtifactFrameRequest, authored?: PreviewFramePage): (PreviewFramePage & {
|
|
201
188
|
fingerprint?: string;
|
|
202
189
|
}) | null;
|
|
203
|
-
/**
|
|
204
|
-
* Identity of one frame's capture, derived the same way wherever it is needed.
|
|
205
|
-
*
|
|
206
|
-
* The revision is folded in until a dependency-closure digest replaces it, so a
|
|
207
|
-
* frame is invalidated no less often than before; what changes is that a consumer
|
|
208
|
-
* now captures per frame instead of demanding the whole catalog up front.
|
|
209
|
-
*/
|
|
210
|
-
export declare function createRoutePreviewFrameFingerprint(page: PreviewFramePage, previewRevision: string, baselineEnvironment?: StoryboardEnvironment): string;
|
|
211
190
|
/** The reproducible capture recipe, kept separate from changing source content. */
|
|
212
191
|
export declare function createRoutePreviewFrameRecipeFingerprint(page: PreviewFramePage, baselineEnvironment?: StoryboardEnvironment): string;
|
|
213
192
|
export declare function createPreviewCacheNamespace({ sourceRevision, recipes, recipeVersion, scope, }: PreviewCacheNamespaceOptions): string;
|
|
@@ -260,3 +239,14 @@ export declare function bootstrapPreviewArtifact({ namespace, sourceRevision, tr
|
|
|
260
239
|
generate?: boolean;
|
|
261
240
|
priority?: number;
|
|
262
241
|
}): Promise<PreviewArtifactBootstrapResult>;
|
|
242
|
+
/** The route dependency digests the host declared for one editor's previews. */
|
|
243
|
+
export declare function createPreviewDependencyDigests(): {
|
|
244
|
+
setPreviewDependencyDigests: (routes: readonly {
|
|
245
|
+
path?: string;
|
|
246
|
+
dependencyDigest?: string;
|
|
247
|
+
}[] | null) => void;
|
|
248
|
+
previewDependencyDigest: (route: string) => string | undefined;
|
|
249
|
+
routePreviewFrameRecipe: (page: PreviewFramePage, baselineEnvironment?: StoryboardEnvironment) => RoutePreviewFrameRecipe;
|
|
250
|
+
createRoutePreviewFrameFingerprint: (page: PreviewFramePage, previewRevision: string, baselineEnvironment?: StoryboardEnvironment) => string;
|
|
251
|
+
};
|
|
252
|
+
export type PreviewDependencyDigests = ReturnType<typeof createPreviewDependencyDigests>;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { PYGMALION_PREVIEW_CAPTURE_PROGRESS_SUFFIX } from '../contract/paths.js';
|
|
2
|
-
import type {
|
|
2
|
+
import type { EditorRuntime } from '../core/runtime.js';
|
|
3
3
|
export { PYGMALION_PREVIEW_CAPTURE_PROGRESS_SUFFIX };
|
|
4
4
|
export type PygmalionPreviewCaptureProgressPhase = 'idle' | 'queued' | 'preparing' | 'capturing' | 'retrying' | 'finalizing';
|
|
5
5
|
export interface PygmalionPreviewCaptureProgress {
|
|
@@ -25,10 +25,6 @@ export interface PygmalionPreviewCaptureCatalogProgress {
|
|
|
25
25
|
jobCount: number;
|
|
26
26
|
updatedAt?: number;
|
|
27
27
|
}
|
|
28
|
-
export declare function getPreviewCaptureCatalogProgress(): PygmalionPreviewCaptureCatalogProgress;
|
|
29
|
-
export declare function subscribePreviewCaptureCatalogProgress(listener: () => void): () => void;
|
|
30
|
-
export declare function publishPreviewCaptureCatalogProgress(value: PygmalionPreviewCaptureCatalogProgress): void;
|
|
31
|
-
export declare function resetPreviewCaptureCatalogProgress(): void;
|
|
32
28
|
export declare function previewCaptureProgressEndpoint(artifactEndpoint: string): string;
|
|
33
29
|
export declare function normalizePreviewCaptureProgress(value: unknown): PygmalionPreviewCaptureProgress | null;
|
|
34
30
|
export interface PreviewCaptureProgressMergeState {
|
|
@@ -49,4 +45,12 @@ export declare function mergePreviewCaptureProgress(worker: PygmalionPreviewCapt
|
|
|
49
45
|
* Polls the given transport, or the mounted editor's when rendered inside
|
|
50
46
|
* one, and only while that transport has a progress endpoint configured.
|
|
51
47
|
*/
|
|
52
|
-
export declare function usePygmalionPreviewCaptureProgress(
|
|
48
|
+
export declare function usePygmalionPreviewCaptureProgress(runtime: EditorRuntime): PygmalionPreviewCaptureProgress;
|
|
49
|
+
/** One editor's catalog capture progress channel, published by the canvas probe. */
|
|
50
|
+
export declare function createPreviewCaptureProgress(): {
|
|
51
|
+
getPreviewCaptureCatalogProgress: () => PygmalionPreviewCaptureCatalogProgress;
|
|
52
|
+
subscribePreviewCaptureCatalogProgress: (listener: () => void) => () => void;
|
|
53
|
+
publishPreviewCaptureCatalogProgress: (value: PygmalionPreviewCaptureCatalogProgress) => void;
|
|
54
|
+
resetPreviewCaptureCatalogProgress: () => void;
|
|
55
|
+
};
|
|
56
|
+
export type PreviewCaptureProgress = ReturnType<typeof createPreviewCaptureProgress>;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { StoryboardEnvironment } from './designImport';
|
|
1
|
+
import type { StoryboardEnvironment } from './designImport.js';
|
|
2
2
|
/** A host-declared value for a portable browser condition such as color scheme. */
|
|
3
3
|
export interface PreviewEnvironmentControlOptionDef {
|
|
4
4
|
value: string;
|
|
@@ -17,19 +17,16 @@ export interface PreviewEnvironmentControlDef {
|
|
|
17
17
|
defaultValue: string;
|
|
18
18
|
options: readonly PreviewEnvironmentControlOptionDef[];
|
|
19
19
|
}
|
|
20
|
-
/**
|
|
21
|
-
export declare function
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
export declare function getPreviewEnvironmentOverride(): StoryboardEnvironment | undefined;
|
|
34
|
-
export declare function subscribePreviewEnvironmentControls(listener: () => void): () => void;
|
|
35
|
-
export declare function getPreviewEnvironmentControlRevision(): number;
|
|
20
|
+
/** One editor's declared preview environment controls and their selections. */
|
|
21
|
+
export declare function createPreviewEnvironmentControls(): {
|
|
22
|
+
setPreviewEnvironmentControls: (next: readonly PreviewEnvironmentControlDef[]) => void;
|
|
23
|
+
getPreviewEnvironmentControls: () => readonly PreviewEnvironmentControlDef[];
|
|
24
|
+
getPreviewEnvironmentControlSelections: () => Readonly<Record<string, string>>;
|
|
25
|
+
getPreviewEnvironmentControlValue: (controlId: string) => string | undefined;
|
|
26
|
+
setPreviewEnvironmentControlValue: (controlId: string, value: string) => void;
|
|
27
|
+
clearPreviewEnvironmentControlValues: () => void;
|
|
28
|
+
getPreviewEnvironmentOverride: () => StoryboardEnvironment | undefined;
|
|
29
|
+
subscribePreviewEnvironmentControls: (listener: () => void) => () => void;
|
|
30
|
+
getPreviewEnvironmentControlRevision: () => number;
|
|
31
|
+
};
|
|
32
|
+
export type PreviewEnvironmentControls = ReturnType<typeof createPreviewEnvironmentControls>;
|
|
@@ -1,17 +1,12 @@
|
|
|
1
1
|
export declare const PREVIEW_INTENT_LIMIT = 2;
|
|
2
|
-
/**
|
|
3
|
-
export declare function
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
export
|
|
13
|
-
export declare function getPreviewIntentSlots(): readonly string[];
|
|
14
|
-
export declare function subscribePreviewIntent(listener: () => void): () => void;
|
|
15
|
-
/** Fires only when this page enters or leaves the intent slots. */
|
|
16
|
-
export declare function subscribePreviewIntentFor(pageId: string, listener: () => void): () => void;
|
|
17
|
-
export declare function resetPreviewIntent(): void;
|
|
2
|
+
/** One editor's preview intent slots: the frames a reader means to see next. */
|
|
3
|
+
export declare function createPreviewIntent(): {
|
|
4
|
+
notePreviewIntent: (pageId: string, limit?: number) => boolean;
|
|
5
|
+
releasePreviewIntent: (pageId: string) => void;
|
|
6
|
+
hasPreviewIntent: (pageId: string) => boolean;
|
|
7
|
+
getPreviewIntentSlots: () => readonly string[];
|
|
8
|
+
subscribePreviewIntent: (listener: () => void) => () => void;
|
|
9
|
+
subscribePreviewIntentFor: (pageId: string, listener: () => void) => () => void;
|
|
10
|
+
resetPreviewIntent: () => void;
|
|
11
|
+
};
|
|
12
|
+
export type PreviewIntent = ReturnType<typeof createPreviewIntent>;
|
|
@@ -124,6 +124,10 @@ export interface PreviewSweeper {
|
|
|
124
124
|
}
|
|
125
125
|
export declare const SWEEP_INTERACTION_CHUNK_SIZE = 8;
|
|
126
126
|
export declare const SWEEP_INTERACTION_REQUEST_CAP = 32;
|
|
127
|
-
|
|
128
|
-
export declare function
|
|
129
|
-
|
|
127
|
+
/** One editor's sweep status channel and the sweeper factory that publishes into it. */
|
|
128
|
+
export declare function createPreviewSweepChannel(): {
|
|
129
|
+
getPreviewSweepStatus: () => PreviewSweepStatus;
|
|
130
|
+
subscribePreviewSweep: (listener: () => void) => () => void;
|
|
131
|
+
createPreviewSweeper: (deps: PreviewSweeperDeps, options?: PreviewSweeperOptions) => PreviewSweeper;
|
|
132
|
+
};
|
|
133
|
+
export type PreviewSweepChannel = ReturnType<typeof createPreviewSweepChannel>;
|
|
@@ -1,7 +1,9 @@
|
|
|
1
|
-
import type { StoryboardEnvironment } from './designImport';
|
|
2
|
-
import { type DesignFrameHeightMode } from './frameHeight';
|
|
3
|
-
import { type LivePreviewInstances } from './livePreviewInstances';
|
|
4
|
-
import type
|
|
1
|
+
import type { StoryboardEnvironment } from './designImport.js';
|
|
2
|
+
import { type DesignFrameHeightMode } from './frameHeight.js';
|
|
3
|
+
import { type LivePreviewInstances } from './livePreviewInstances.js';
|
|
4
|
+
import { type PreviewIntent } from './previewIntent.js';
|
|
5
|
+
import type { StoryboardGraph } from './storyboardGraph.js';
|
|
6
|
+
import type { StoryboardGraphRuntime } from './storyboardGraphRuntime.js';
|
|
5
7
|
/** The page facts warmup planning reads; a store PageModel satisfies it. */
|
|
6
8
|
export interface PreviewWarmupPage {
|
|
7
9
|
id: string;
|
|
@@ -55,8 +57,6 @@ export interface StartPreviewWarmupOptions {
|
|
|
55
57
|
getPages: () => readonly PreviewWarmupPage[];
|
|
56
58
|
appOrigin: string;
|
|
57
59
|
baselineEnvironment?: StoryboardEnvironment;
|
|
58
|
-
/** Test seam — defaults to the shared pool. */
|
|
59
|
-
instances?: Pick<LivePreviewInstances, 'warm'>;
|
|
60
60
|
/** Test seam — defaults to the published storyboard graph. */
|
|
61
61
|
getGraph?: () => StoryboardGraph | null;
|
|
62
62
|
/** Test seam — defaults to navigator.deviceMemory. */
|
|
@@ -66,6 +66,10 @@ export interface StartPreviewWarmupOptions {
|
|
|
66
66
|
* Warms the top instance group once and, from then on, prepares the
|
|
67
67
|
* storyboard successors of whichever screen becomes active.
|
|
68
68
|
*
|
|
69
|
+
* `livePreviews` is the pool of the runtime this warmup serves — the one its
|
|
70
|
+
* frames lease from, so the first real lease of a warmed group finds the
|
|
71
|
+
* running document.
|
|
72
|
+
*
|
|
69
73
|
* Returns a dispose function that stops the selection reaction. Warm boots
|
|
70
74
|
* already in flight finish on their own; the pool treats them as ordinary
|
|
71
75
|
* instances afterwards.
|
|
@@ -75,4 +79,12 @@ export interface StartPreviewWarmupOptions {
|
|
|
75
79
|
* because both end in an offscreen application document the device cannot
|
|
76
80
|
* spare (see the module comment for the measured cost).
|
|
77
81
|
*/
|
|
78
|
-
|
|
82
|
+
/** What a warmup needs from the runtime it serves. */
|
|
83
|
+
export interface PreviewWarmupRuntime {
|
|
84
|
+
readonly schedulers: {
|
|
85
|
+
readonly livePreviews: LivePreviewInstances;
|
|
86
|
+
readonly previewIntent: PreviewIntent;
|
|
87
|
+
};
|
|
88
|
+
readonly declarations: Pick<StoryboardGraphRuntime, 'getStoryboardGraph'>;
|
|
89
|
+
}
|
|
90
|
+
export declare function startPreviewWarmup(runtime: PreviewWarmupRuntime, options: StartPreviewWarmupOptions): () => void;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { EditorTransport } from '../contract/transport.js';
|
|
2
2
|
import type { PygmalionDesignSessionStatus, PygmalionDevMirrorStatus, PygmalionRevertResult, PygmalionSourceRefs } from '../contract/types.js';
|
|
3
|
-
import type { InspectApplyPayload } from './inspect';
|
|
4
|
-
import type { InspectApplyResult, InspectImpactResult, InspectPreviewResult } from './host';
|
|
3
|
+
import type { InspectApplyPayload } from './inspect.js';
|
|
4
|
+
import type { InspectApplyResult, InspectImpactResult, InspectPreviewResult } from './host.js';
|
|
5
5
|
export type { PygmalionDesignSessionStatus, PygmalionDevMirrorStatus, PygmalionIntegrationState, PygmalionRevertResult, PygmalionSessionOperation, PygmalionSourceRef, PygmalionSourceRefs, PygmalionVisualOperation, PygmalionVisualRevertOperation, } from '../contract/types.js';
|
|
6
6
|
export interface PygmalionProjectRuntimeOptions {
|
|
7
7
|
/**
|
|
@@ -34,5 +34,9 @@ export interface RegistryEntry {
|
|
|
34
34
|
};
|
|
35
35
|
}
|
|
36
36
|
export type ComponentRegistry = Record<string, RegistryEntry>;
|
|
37
|
-
|
|
38
|
-
export declare function
|
|
37
|
+
/** One editor's component registry: the components the host declared. */
|
|
38
|
+
export declare function createRegistry(): {
|
|
39
|
+
setComponentRegistry: (r: ComponentRegistry) => void;
|
|
40
|
+
getRegistry: () => ComponentRegistry;
|
|
41
|
+
};
|
|
42
|
+
export type Registry = ReturnType<typeof createRegistry>;
|
|
@@ -1,24 +1,24 @@
|
|
|
1
|
-
import type { DesignComponentConnectionDef } from './componentConnections';
|
|
1
|
+
import type { DesignComponentConnectionDef } from './componentConnections.js';
|
|
2
2
|
import { TransportError } from '../contract/errors.js';
|
|
3
3
|
import type { EditorTransport } from '../contract/transport.js';
|
|
4
|
-
import type { DesignCodegenProjectManifest } from './designCompiler';
|
|
5
|
-
import type { DesignImportAsset, DesignImportInitialPage, DesignScenarioSource } from './designImport';
|
|
6
|
-
import type { FrameBranchKindDef, FrameLabelLabels } from './frameLabels';
|
|
7
|
-
import type { ScreenLaneDef } from './frameLanes';
|
|
8
|
-
import { type ScreenStateAxisDef } from './interactiveStates';
|
|
9
|
-
import type { PreviewEnvironmentControlDef } from './previewEnvironmentControls';
|
|
10
|
-
import type { RegistryEntry } from './registry';
|
|
11
|
-
import type { ScenarioCoverageClaim } from './scenarioCoverage';
|
|
12
|
-
import type { ScreenCardDef } from './screenCards';
|
|
13
|
-
import type { ScreenDimensionDef } from './screenDimensions';
|
|
14
|
-
import type { ScreenFlowPath } from './screenFlows';
|
|
15
|
-
import type { ScreenListDef } from './screenLists';
|
|
16
|
-
import type { SectionHeaderDef, SectionHeaderLabels } from './sectionHeaders';
|
|
17
|
-
import type { SessionPresetDef } from './sessionPresets';
|
|
18
|
-
import type { StoryboardDefinition } from './storyboardGraph';
|
|
19
|
-
import type { SurfaceClassification } from './surfaceDemands';
|
|
20
|
-
import type { TokenDef } from './tokens';
|
|
21
|
-
import type { ViewportPresetDef } from './viewportPresets';
|
|
4
|
+
import type { DesignCodegenProjectManifest } from './designCompiler.js';
|
|
5
|
+
import type { DesignImportAsset, DesignImportInitialPage, DesignScenarioSource } from './designImport.js';
|
|
6
|
+
import type { FrameBranchKindDef, FrameLabelLabels } from './frameLabels.js';
|
|
7
|
+
import type { ScreenLaneDef } from './frameLanes.js';
|
|
8
|
+
import { type ScreenStateAxisDef } from './interactiveStates.js';
|
|
9
|
+
import type { PreviewEnvironmentControlDef } from './previewEnvironmentControls.js';
|
|
10
|
+
import type { RegistryEntry } from './registry.js';
|
|
11
|
+
import type { ScenarioCoverageClaim } from './scenarioCoverage.js';
|
|
12
|
+
import type { ScreenCardDef } from './screenCards.js';
|
|
13
|
+
import type { ScreenDimensionDef } from './screenDimensions.js';
|
|
14
|
+
import type { ScreenFlowPath } from './screenFlows.js';
|
|
15
|
+
import type { ScreenListDef } from './screenLists.js';
|
|
16
|
+
import type { SectionHeaderDef, SectionHeaderLabels } from './sectionHeaders.js';
|
|
17
|
+
import type { SessionPresetDef } from './sessionPresets.js';
|
|
18
|
+
import type { StoryboardDefinition } from './storyboardGraph.js';
|
|
19
|
+
import type { SurfaceClassification } from './surfaceDemands.js';
|
|
20
|
+
import type { TokenDef } from './tokens.js';
|
|
21
|
+
import type { ViewportPresetDef } from './viewportPresets.js';
|
|
22
22
|
export declare const PYGMALION_REVISION_CATALOG_VERSION: 1;
|
|
23
23
|
/** A routed page whose identity is complete at the JSON boundary. */
|
|
24
24
|
export interface PygmalionRevisionScreenPage extends DesignImportInitialPage {
|
|
@@ -1,19 +1,20 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
11
|
-
import {
|
|
12
|
-
import
|
|
13
|
-
import {
|
|
14
|
-
import {
|
|
15
|
-
import {
|
|
16
|
-
import {
|
|
1
|
+
import type { EditorDeclarations } from './declarations.js';
|
|
2
|
+
import type { DesignComponentConnectionDef } from './componentConnections.js';
|
|
3
|
+
import type { FrameBranchKindDef, FrameLabelLabels } from './frameLabels.js';
|
|
4
|
+
import type { ScreenLaneDef } from './frameLanes.js';
|
|
5
|
+
import type { ScreenStateAxisDef } from './interactiveStates.js';
|
|
6
|
+
import type { PreviewEnvironmentControlDef } from './previewEnvironmentControls.js';
|
|
7
|
+
import type { ComponentRegistry, RegistryEntry } from './registry.js';
|
|
8
|
+
import type { ScenarioCoverageClaim } from './scenarioCoverage.js';
|
|
9
|
+
import type { ScreenCardDef } from './screenCards.js';
|
|
10
|
+
import type { ScreenDimensionDef } from './screenDimensions.js';
|
|
11
|
+
import type { ScreenFlowPath } from './screenFlows.js';
|
|
12
|
+
import type { ScreenListDef } from './screenLists.js';
|
|
13
|
+
import type { SectionHeaderDef, SectionHeaderLabels } from './sectionHeaders.js';
|
|
14
|
+
import type { SessionPresetDef } from './sessionPresets.js';
|
|
15
|
+
import type { SurfaceClassification } from './surfaceDemands.js';
|
|
16
|
+
import type { TokenDef } from './tokens.js';
|
|
17
|
+
import type { ViewportPresetDef } from './viewportPresets.js';
|
|
17
18
|
/**
|
|
18
19
|
* Mutable declaration singletons that must move with one revision catalog.
|
|
19
20
|
* The component implementations remain supplied by the host bundle; the
|
|
@@ -59,4 +60,4 @@ export declare function bindRevisionComponentRegistry(manifest: Readonly<Record<
|
|
|
59
60
|
* restore it if a declaration installer or the page commit rejects. A failed
|
|
60
61
|
* revision therefore never remains half-installed for the next render.
|
|
61
62
|
*/
|
|
62
|
-
export declare function installRevisionCatalogSnapshot(declarations: RevisionCatalogDeclarations, pageCommit: (() => void) | RevisionCatalogPageCommit): void;
|
|
63
|
+
export declare function installRevisionCatalogSnapshot(declarations: EditorDeclarations, next: RevisionCatalogDeclarations, pageCommit: (() => void) | RevisionCatalogPageCommit): void;
|
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
import { type RoutePreviewArtifactBundleV2 } from './routePreviewArtifactV2.js';
|
|
2
2
|
import { type RoutePreviewArtifactBundleV3, type RoutePreviewArtifactV3Diagnostic, type RoutePreviewArtifactV3Status } from './routePreviewArtifactV3.js';
|
|
3
|
-
import type { StoryboardEnvironment } from './designImport';
|
|
4
|
-
import type { RoutePreviewFrameRecipe } from './previewBootstrap';
|
|
5
|
-
import { type InstanceResolver } from './fiberMap';
|
|
3
|
+
import type { StoryboardEnvironment } from './designImport.js';
|
|
4
|
+
import type { RoutePreviewFrameRecipe } from './previewBootstrap.js';
|
|
5
|
+
import { type InstanceResolver } from './fiberMap.js';
|
|
6
|
+
import { type StateSwitchMetrics } from './stateSwitchMetrics.js';
|
|
7
|
+
import { type EditorDeclarations } from './declarations.js';
|
|
6
8
|
type SlotRelease = () => void;
|
|
7
9
|
export interface RoutePreviewRecipe {
|
|
8
10
|
namespace?: string;
|
|
@@ -142,38 +144,6 @@ export declare function recommendedRoutePreviewConcurrency(capabilities?: {
|
|
|
142
144
|
hardwareConcurrency?: number;
|
|
143
145
|
deviceMemory?: number;
|
|
144
146
|
}): number;
|
|
145
|
-
/** Coalesces keyed notifications; nested batches flush once at the outermost end. */
|
|
146
|
-
export declare function beginSnapshotNotificationBatch(): void;
|
|
147
|
-
export declare function endSnapshotNotificationBatch(): void;
|
|
148
|
-
export declare function subscribeRoutePreviewSnapshots(listener: () => void): () => void;
|
|
149
|
-
export declare function getRoutePreviewSnapshotRevision(): number;
|
|
150
|
-
/** Fires for writes, hydration verdicts, and evictions of exactly this key. */
|
|
151
|
-
export declare function subscribeRoutePreviewSnapshotKey(key: string, listener: () => void): () => void;
|
|
152
|
-
/** Changes when this key's channel fires or a whole-store event bumps the epoch. */
|
|
153
|
-
export declare function getRoutePreviewSnapshotKeyVersion(key: string): number;
|
|
154
|
-
export declare function subscribeRoutePreviewArtifactKey(cacheKey: string, listener: () => void): () => void;
|
|
155
|
-
export declare function getRoutePreviewArtifactKeyVersion(cacheKey: string): number;
|
|
156
|
-
/** Artifact resolutions live in the frame-identity key space, not the recipe one. */
|
|
157
|
-
export declare function subscribeRoutePreviewArtifactIdentity(id: string, fingerprint: string | undefined, listener: () => void): () => void;
|
|
158
|
-
export declare function getRoutePreviewArtifactIdentityVersion(id: string, fingerprint?: string): number;
|
|
159
|
-
/** Pairs with getActiveRoutePreviewCount; slot events never reach the snapshot channel. */
|
|
160
|
-
export declare function subscribeRoutePreviewSlotCount(listener: () => void): () => void;
|
|
161
|
-
export declare function getActiveRoutePreviewCount(): number;
|
|
162
|
-
export declare function hasRoutePreviewSnapshot(key: string): boolean;
|
|
163
|
-
/** A last-known stale artifact is drawable, but it is not a current warm hit. */
|
|
164
|
-
export declare function hasExactRoutePreviewSnapshot(key: string): boolean;
|
|
165
|
-
export declare function getRoutePreviewArtifactOutcome(key: string): RoutePreviewArtifactOutcome | null;
|
|
166
|
-
/**
|
|
167
|
-
* Artifact outcomes change only when a bundle is seeded or cleared, so frames
|
|
168
|
-
* subscribe to this instead of the per-snapshot revision. Reading the outcome
|
|
169
|
-
* without it leaves memoized frames on a replaced bundle forever.
|
|
170
|
-
*/
|
|
171
|
-
export declare function getRoutePreviewArtifactRevision(): number;
|
|
172
|
-
export declare function subscribeRoutePreviewArtifacts(listener: () => void): () => void;
|
|
173
|
-
export declare function getRoutePreviewArtifactResolution(id: string, fingerprint?: string): RoutePreviewArtifactResolution;
|
|
174
|
-
/** Publishes cache-probe state for one or more exact frame identities. */
|
|
175
|
-
export declare function setRoutePreviewArtifactResolution(frames: readonly RoutePreviewArtifactFrameIdentity[], resolution: RoutePreviewArtifactResolution): void;
|
|
176
|
-
export declare function isRoutePreviewSnapshotHydrated(key: string): boolean;
|
|
177
147
|
/**
|
|
178
148
|
* Persistent cache identity excluding random mirror ports.
|
|
179
149
|
* By normalizing the object key order, the same screen recipe always uses the same key.
|
|
@@ -183,18 +153,6 @@ export interface RoutePreviewFrameRequestOptions {
|
|
|
183
153
|
priority?: number;
|
|
184
154
|
}
|
|
185
155
|
type RoutePreviewFrameRequester = (frames: readonly RoutePreviewArtifactFrameIdentity[], options?: RoutePreviewFrameRequestOptions) => RoutePreviewArtifactFrameRequestResult | Promise<RoutePreviewArtifactFrameRequestResult> | void;
|
|
186
|
-
/** Installed by the host adapter, which owns the transport. */
|
|
187
|
-
export declare function setRoutePreviewArtifactFrameRequester(requester: RoutePreviewFrameRequester | null): () => void;
|
|
188
|
-
/**
|
|
189
|
-
* When an exact artifact endpoint exists, background cache misses stay cheap:
|
|
190
|
-
* only an active or deliberately hovered frame may boot the live application.
|
|
191
|
-
*/
|
|
192
|
-
export declare function setRoutePreviewArtifactEndpointConfigured(configured: boolean): void;
|
|
193
|
-
export declare function isRoutePreviewArtifactEndpointConfigured(): boolean;
|
|
194
|
-
export declare function shouldStartRoutePreviewProducer({ detailActive, previewIntended, }: {
|
|
195
|
-
detailActive: boolean;
|
|
196
|
-
previewIntended: boolean;
|
|
197
|
-
}): boolean;
|
|
198
156
|
/** A persisted exact frozen snapshot already satisfies the active editor frame. */
|
|
199
157
|
export declare function shouldRequestRoutePreviewArtifactFrame({ cacheHydrated, detailActive, hasRoute, layersImported, hasExactArtifact, hasExactSnapshot, hasFingerprint, }: {
|
|
200
158
|
cacheHydrated: boolean;
|
|
@@ -205,97 +163,7 @@ export declare function shouldRequestRoutePreviewArtifactFrame({ cacheHydrated,
|
|
|
205
163
|
hasExactSnapshot: boolean;
|
|
206
164
|
hasFingerprint: boolean;
|
|
207
165
|
}): boolean;
|
|
208
|
-
/**
|
|
209
|
-
* Asks for one frame's capture, once per identity.
|
|
210
|
-
*
|
|
211
|
-
* Called when a frame becomes visible, which is why the editor no longer needs
|
|
212
|
-
* every screen captured before it can show anything. A changed fingerprint is a
|
|
213
|
-
* new identity, so an edited screen is requested again.
|
|
214
|
-
*/
|
|
215
|
-
export declare function requestRoutePreviewArtifactFrame(id: string, fingerprint?: string, options?: {
|
|
216
|
-
retry?: boolean;
|
|
217
|
-
recipeFingerprint?: string;
|
|
218
|
-
recipe?: RoutePreviewFrameRecipe;
|
|
219
|
-
priority?: number;
|
|
220
|
-
}): Promise<RoutePreviewArtifactResolution> | null;
|
|
221
|
-
/**
|
|
222
|
-
* Asks for many frames' captures in one requester call.
|
|
223
|
-
*
|
|
224
|
-
* A canvas being filled and the background sweep both name frames in chunks,
|
|
225
|
-
* and a chunk must not fan out into one transport round trip per frame — nor
|
|
226
|
-
* into one capture job per frame, which is what left the worker's lanes idle.
|
|
227
|
-
* Identities already resolved exactly, already generating, or already failed
|
|
228
|
-
* are skipped (an error is retried only on request); the remaining frames
|
|
229
|
-
* share a single requester call and a single resolution, and each identity
|
|
230
|
-
* joins the same in-flight dedupe map the single-frame request uses. Each
|
|
231
|
-
* frame's recipe travels with it, so a generator can reproduce a variant
|
|
232
|
-
* instead of re-capturing what the host declared for the id.
|
|
233
|
-
*/
|
|
234
|
-
export declare function requestRoutePreviewArtifactFrames(frames: readonly RoutePreviewArtifactFrameIdentity[], options?: {
|
|
235
|
-
retry?: boolean;
|
|
236
|
-
priority?: number;
|
|
237
|
-
}): Promise<RoutePreviewArtifactResolution> | null;
|
|
238
|
-
export declare function createRoutePreviewRecipeKey(recipe: RoutePreviewRecipe): string;
|
|
239
|
-
/**
|
|
240
|
-
* Returns the compact body plus pooled style input without reconstructing a
|
|
241
|
-
* complete HTML snapshot for every frame.
|
|
242
|
-
*/
|
|
243
|
-
export declare function getRoutePreviewShadowArtifact(key: string): RoutePreviewShadowArtifact | null;
|
|
244
|
-
/**
|
|
245
|
-
* Extracts the artifact source SHA from a runtime previewRevision.
|
|
246
|
-
* Runtime revisions are `<sourceSha>:<sessionRevision>`, while artifact bundles
|
|
247
|
-
* are stamped with the source SHA alone. Every identity comparison and every
|
|
248
|
-
* artifact request must go through this so both sides agree.
|
|
249
|
-
*/
|
|
250
|
-
export declare function routePreviewSourceRevision(previewRevision: string): string;
|
|
251
|
-
/**
|
|
252
|
-
* Synchronously inject build-time snapshots into the memory cache before mounting the app.
|
|
253
|
-
* IndexedDB storage uses the existing setRoutePreviewSnapshot write-through as is.
|
|
254
|
-
*/
|
|
255
|
-
export declare function seedRoutePreviewArtifacts(bundle: RoutePreviewArtifactBundle | null | undefined, options: {
|
|
256
|
-
namespace: string;
|
|
257
|
-
previewRevision: string;
|
|
258
|
-
appOrigin: string;
|
|
259
|
-
baselineEnvironment?: StoryboardEnvironment;
|
|
260
|
-
allowStaleIdentity?: boolean;
|
|
261
|
-
/** Endpoint-validated v3 subsets may prove freshness by frame fingerprint. */
|
|
262
|
-
allowMatchingFrameIdentity?: boolean;
|
|
263
|
-
pages: readonly RoutePreviewArtifactPage[];
|
|
264
|
-
}): RoutePreviewArtifactSeedResult;
|
|
265
|
-
export declare function setRoutePreviewCacheNamespace(namespace: string | null | undefined): void;
|
|
266
|
-
export declare function getRoutePreviewCacheNamespace(): string;
|
|
267
166
|
export declare function routePreviewPruneKeys(records: readonly Pick<RoutePreviewPersistentRecord, 'key' | 'bytes' | 'lastAccess'>[]): string[];
|
|
268
|
-
/** Persistence seam for node testing. It is not exposed to public package entrypoint. */
|
|
269
|
-
export declare function setRoutePreviewPersistenceForTests(persistence: RoutePreviewPersistence | null | undefined): void;
|
|
270
|
-
/**
|
|
271
|
-
* Several iframes are prepared in parallel, but computed style → NodeModel conversion is performed in parallel.
|
|
272
|
-
* Limited to 2-lane dedicated to main thread. Requests for the same screen are combined into one.
|
|
273
|
-
*/
|
|
274
|
-
export declare function scheduleRouteLayerCapture<T>(key: string, priority: number, task: () => Promise<T>): Promise<T>;
|
|
275
|
-
/** Limits the number of actual app iframes that will boot simultaneously across the entire editor. */
|
|
276
|
-
export declare function acquireRoutePreviewSlot(priority?: number): RoutePreviewSlotTicket;
|
|
277
|
-
export declare function setRoutePreviewConcurrency(value: number): void;
|
|
278
|
-
export declare function getRoutePreviewSnapshot(key: string): string | null;
|
|
279
|
-
/** Immediately records to memory and writes through to IndexedDB. */
|
|
280
|
-
export declare function setRoutePreviewSnapshot(key: string, snapshot: string): boolean;
|
|
281
|
-
/**
|
|
282
|
-
* Raise persistent hits to memory LRU. miss/corrupt does not resolve until judgment is complete
|
|
283
|
-
* It is possible to prevent a race in which the caller acquires the live iframe slot first.
|
|
284
|
-
*/
|
|
285
|
-
export declare function hydrateRoutePreviewSnapshot(key: string): Promise<string | null>;
|
|
286
|
-
/** Hydrates multiple screen recipes in parallel to fill the memory cache before the first paint. */
|
|
287
|
-
export declare function prehydrateRoutePreviewSnapshots(keys: readonly string[]): Promise<Map<string, string>>;
|
|
288
|
-
export declare function clearRoutePreviewSnapshots(namespace?: string): void;
|
|
289
|
-
/**
|
|
290
|
-
* Asynchronous operations with the same preview key share one slot and promise.
|
|
291
|
-
* The caller must complete the actual iframe preparation and serialization within the task.
|
|
292
|
-
*/
|
|
293
|
-
export declare function scheduleRoutePreviewTask<T>(key: string, priority: number, task: () => Promise<T>): Promise<T>;
|
|
294
|
-
/**
|
|
295
|
-
* High-level scheduling API that uses snapshot cache and in-flight dedupe together.
|
|
296
|
-
* The caller should only express priority as to whether or not it is nearViewport, and the call itself should not be blocked.
|
|
297
|
-
*/
|
|
298
|
-
export declare function scheduleRoutePreviewSnapshot(key: string, priority: number, task: () => Promise<string | null>, runtimeKey?: string): Promise<string | null>;
|
|
299
167
|
/** Maps live elements to their source metadata for stamping (docs/perf-contracts.md). */
|
|
300
168
|
export interface RoutePreviewSourceAnnotator {
|
|
301
169
|
/** Resolves the registry component instance rooted at an element. */
|
|
@@ -306,7 +174,85 @@ export interface RoutePreviewSourceAnnotator {
|
|
|
306
174
|
export interface SerializeRoutePreviewOptions {
|
|
307
175
|
annotate?: RoutePreviewSourceAnnotator;
|
|
308
176
|
}
|
|
309
|
-
/** Fix the running app document as a script-less srcDoc and terminate the API, timer, and React runtime. */
|
|
310
|
-
export declare function serializeRoutePreview(iframe: HTMLIFrameElement, fallbackUrl: string, options?: SerializeRoutePreviewOptions): string | null;
|
|
311
177
|
export declare function waitForRoutePreviewSettle(ms?: number): Promise<void>;
|
|
178
|
+
/**
|
|
179
|
+
* The per-runtime preview cache: snapshots and their persistence, artifact
|
|
180
|
+
* frames and outcomes, capture slots and the layer-capture queue, the frame
|
|
181
|
+
* requester, and the per-key invalidation channels components subscribe to.
|
|
182
|
+
* The bodies below are the former module-level functions, closed over
|
|
183
|
+
* instance state instead of module state.
|
|
184
|
+
*/
|
|
185
|
+
export interface RoutePreviewCacheOptions {
|
|
186
|
+
/** Where producer decisions are counted; the runtime passes its own metrics. */
|
|
187
|
+
metrics?: Pick<StateSwitchMetrics, 'recordRoutePreviewProducerDecision'>;
|
|
188
|
+
/** The host declarations this cache keys and installs against; the runtime passes its own. */
|
|
189
|
+
declarations?: EditorDeclarations;
|
|
190
|
+
}
|
|
191
|
+
export declare function createRoutePreviewCache(options?: RoutePreviewCacheOptions): {
|
|
192
|
+
beginSnapshotNotificationBatch: () => void;
|
|
193
|
+
endSnapshotNotificationBatch: () => void;
|
|
194
|
+
subscribeRoutePreviewSnapshots: (listener: () => void) => () => void;
|
|
195
|
+
getRoutePreviewSnapshotRevision: () => number;
|
|
196
|
+
subscribeRoutePreviewSnapshotKey: (key: string, listener: () => void) => () => void;
|
|
197
|
+
getRoutePreviewSnapshotKeyVersion: (key: string) => number;
|
|
198
|
+
subscribeRoutePreviewArtifactKey: (cacheKey: string, listener: () => void) => () => void;
|
|
199
|
+
getRoutePreviewArtifactKeyVersion: (cacheKey: string) => number;
|
|
200
|
+
subscribeRoutePreviewArtifactIdentity: (id: string, fingerprint: string | undefined, listener: () => void) => () => void;
|
|
201
|
+
getRoutePreviewArtifactIdentityVersion: (id: string, fingerprint?: string) => number;
|
|
202
|
+
subscribeRoutePreviewSlotCount: (listener: () => void) => () => void;
|
|
203
|
+
getActiveRoutePreviewCount: () => number;
|
|
204
|
+
hasRoutePreviewSnapshot: (key: string) => boolean;
|
|
205
|
+
hasExactRoutePreviewSnapshot: (key: string) => boolean;
|
|
206
|
+
getRoutePreviewArtifactOutcome: (key: string) => RoutePreviewArtifactOutcome | null;
|
|
207
|
+
getRoutePreviewArtifactRevision: () => number;
|
|
208
|
+
subscribeRoutePreviewArtifacts: (listener: () => void) => () => void;
|
|
209
|
+
getRoutePreviewArtifactResolution: (id: string, fingerprint?: string) => RoutePreviewArtifactResolution;
|
|
210
|
+
setRoutePreviewArtifactResolution: (frames: readonly RoutePreviewArtifactFrameIdentity[], resolution: RoutePreviewArtifactResolution) => void;
|
|
211
|
+
isRoutePreviewSnapshotHydrated: (key: string) => boolean;
|
|
212
|
+
setRoutePreviewArtifactFrameRequester: (requester: RoutePreviewFrameRequester | null) => () => void;
|
|
213
|
+
setRoutePreviewArtifactEndpointConfigured: (configured: boolean) => void;
|
|
214
|
+
isRoutePreviewArtifactEndpointConfigured: () => boolean;
|
|
215
|
+
shouldStartRoutePreviewProducer: ({ detailActive, previewIntended, }: {
|
|
216
|
+
detailActive: boolean;
|
|
217
|
+
previewIntended: boolean;
|
|
218
|
+
}) => boolean;
|
|
219
|
+
requestRoutePreviewArtifactFrame: (id: string, fingerprint?: string, options?: {
|
|
220
|
+
retry?: boolean;
|
|
221
|
+
recipeFingerprint?: string;
|
|
222
|
+
recipe?: RoutePreviewFrameRecipe;
|
|
223
|
+
priority?: number;
|
|
224
|
+
}) => Promise<RoutePreviewArtifactResolution> | null;
|
|
225
|
+
requestRoutePreviewArtifactFrames: (frames: readonly RoutePreviewArtifactFrameIdentity[], options?: {
|
|
226
|
+
retry?: boolean;
|
|
227
|
+
priority?: number;
|
|
228
|
+
}) => Promise<RoutePreviewArtifactResolution> | null;
|
|
229
|
+
createRoutePreviewRecipeKey: (recipe: RoutePreviewRecipe) => string;
|
|
230
|
+
getRoutePreviewShadowArtifact: (key: string) => RoutePreviewShadowArtifact | null;
|
|
231
|
+
routePreviewSourceRevision: (previewRevision: string) => string;
|
|
232
|
+
seedRoutePreviewArtifacts: (bundle: RoutePreviewArtifactBundle | null | undefined, options: {
|
|
233
|
+
namespace: string;
|
|
234
|
+
previewRevision: string;
|
|
235
|
+
appOrigin: string;
|
|
236
|
+
baselineEnvironment?: StoryboardEnvironment;
|
|
237
|
+
allowStaleIdentity?: boolean;
|
|
238
|
+
/** Endpoint-validated v3 subsets may prove freshness by frame fingerprint. */
|
|
239
|
+
allowMatchingFrameIdentity?: boolean;
|
|
240
|
+
pages: readonly RoutePreviewArtifactPage[];
|
|
241
|
+
}) => RoutePreviewArtifactSeedResult;
|
|
242
|
+
setRoutePreviewCacheNamespace: (namespace: string | null | undefined) => void;
|
|
243
|
+
getRoutePreviewCacheNamespace: () => string;
|
|
244
|
+
setRoutePreviewPersistenceForTests: (persistence: RoutePreviewPersistence | null | undefined) => void;
|
|
245
|
+
scheduleRouteLayerCapture: <T>(key: string, priority: number, task: () => Promise<T>) => Promise<T>;
|
|
246
|
+
acquireRoutePreviewSlot: (priority?: number) => RoutePreviewSlotTicket;
|
|
247
|
+
setRoutePreviewConcurrency: (value: number) => void;
|
|
248
|
+
getRoutePreviewSnapshot: (key: string) => string | null;
|
|
249
|
+
setRoutePreviewSnapshot: (key: string, snapshot: string) => boolean;
|
|
250
|
+
hydrateRoutePreviewSnapshot: (key: string) => Promise<string | null>;
|
|
251
|
+
prehydrateRoutePreviewSnapshots: (keys: readonly string[]) => Promise<Map<string, string>>;
|
|
252
|
+
clearRoutePreviewSnapshots: (namespace?: string) => void;
|
|
253
|
+
scheduleRoutePreviewTask: <T>(key: string, priority: number, task: () => Promise<T>) => Promise<T>;
|
|
254
|
+
scheduleRoutePreviewSnapshot: (key: string, priority: number, task: () => Promise<string | null>, runtimeKey?: string) => Promise<string | null>;
|
|
255
|
+
serializeRoutePreview: (iframe: HTMLIFrameElement, fallbackUrl: string, options?: SerializeRoutePreviewOptions) => string | null;
|
|
256
|
+
};
|
|
257
|
+
export type RoutePreviewCache = ReturnType<typeof createRoutePreviewCache>;
|
|
312
258
|
export {};
|