@pygmalionjs/pygmalion 0.5.14 → 0.5.16
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist-lib/{FrozenRoutePreview-BR5CBAD3.js → FrozenRoutePreview-CZOpvN6z.js} +1545 -1515
- package/dist-lib/pygmalion.js +5034 -4955
- package/dist-lib/testing.js +1 -1
- package/dist-lib/types/App.d.ts +5 -0
- package/dist-lib/types/canvas/CameraLayer.d.ts +9 -0
- package/dist-lib/types/canvas/Canvas.d.ts +19 -0
- package/dist-lib/types/canvas/FrameLabelBanner.d.ts +7 -0
- package/dist-lib/types/canvas/FrameView.d.ts +9 -0
- package/dist-lib/types/canvas/FrozenRoutePreview.d.ts +12 -0
- package/dist-lib/types/canvas/InspectOverlay.d.ts +10 -0
- package/dist-lib/types/canvas/LightweightCanvas.d.ts +10 -0
- package/dist-lib/types/canvas/ObjectControls.d.ts +22 -0
- package/dist-lib/types/canvas/Preview.d.ts +3 -0
- package/dist-lib/types/canvas/SectionBoxes.d.ts +24 -0
- package/dist-lib/types/canvas/ShadowRoutePreview.d.ts +14 -0
- package/dist-lib/types/canvas/StoryboardConnections.d.ts +31 -0
- package/dist-lib/types/canvas/cameraPlacement.d.ts +45 -0
- package/dist-lib/types/canvas/domTags.d.ts +10 -0
- package/dist-lib/types/canvas/layoutContext.d.ts +9 -0
- package/dist-lib/types/canvas/useFlowSession.d.ts +36 -0
- package/dist-lib/types/canvas/useFrameLod.d.ts +35 -0
- package/dist-lib/types/editor/adaptiveFrameLayout.d.ts +67 -0
- package/dist-lib/types/editor/assetEditing.d.ts +10 -0
- package/dist-lib/types/editor/bannerStyle.d.ts +18 -0
- package/dist-lib/types/editor/catalog.d.ts +101 -0
- package/dist-lib/types/editor/codegen.d.ts +11 -0
- package/dist-lib/types/editor/componentConnections.d.ts +63 -0
- package/dist-lib/types/editor/componentInstances.d.ts +27 -0
- package/dist-lib/types/editor/contentBounds.d.ts +34 -0
- package/dist-lib/types/editor/designCompiler.d.ts +100 -0
- package/dist-lib/types/editor/designImport.d.ts +448 -0
- package/dist-lib/types/editor/documentSync.d.ts +28 -0
- package/dist-lib/types/editor/domImport.d.ts +58 -0
- package/dist-lib/types/editor/editModePolicy.d.ts +17 -0
- package/dist-lib/types/editor/fiberMap.d.ts +16 -0
- package/dist-lib/types/editor/flowSessionScheduler.d.ts +97 -0
- package/dist-lib/types/editor/flowSessions.d.ts +137 -0
- package/dist-lib/types/editor/frameHeight.d.ts +14 -0
- package/dist-lib/types/editor/frameIdentity.d.ts +9 -0
- package/dist-lib/types/editor/frameLabels.d.ts +124 -0
- package/dist-lib/types/editor/frameLanes.d.ts +62 -0
- package/dist-lib/types/editor/frameLod.d.ts +123 -0
- package/dist-lib/types/editor/frameLodRuntime.d.ts +64 -0
- package/dist-lib/types/editor/framePointerHit.d.ts +67 -0
- package/dist-lib/types/editor/framePointerIntent.d.ts +53 -0
- package/dist-lib/types/editor/framePreviewChannels.d.ts +26 -0
- package/dist-lib/types/editor/framePreviewKeys.d.ts +21 -0
- package/dist-lib/types/editor/frameWheelRouting.d.ts +16 -0
- package/dist-lib/types/editor/frozenImport.d.ts +70 -0
- package/dist-lib/types/editor/host.d.ts +133 -0
- package/dist-lib/types/editor/inspect.d.ts +225 -0
- package/dist-lib/types/editor/interactiveStates.d.ts +103 -0
- package/dist-lib/types/editor/livePreviewInstances.d.ts +93 -0
- package/dist-lib/types/editor/liveScreens.d.ts +20 -0
- package/dist-lib/types/editor/nodeSelector.d.ts +20 -0
- package/dist-lib/types/editor/previewBootstrap.d.ts +189 -0
- package/dist-lib/types/editor/previewEnvironmentControls.d.ts +33 -0
- package/dist-lib/types/editor/previewHydration.d.ts +5 -0
- package/dist-lib/types/editor/previewIntent.d.ts +17 -0
- package/dist-lib/types/editor/previewSweep.d.ts +129 -0
- package/dist-lib/types/editor/previewWarmup.d.ts +77 -0
- package/dist-lib/types/editor/projectBootGate.d.ts +45 -0
- package/dist-lib/types/editor/projectRuntime.d.ts +138 -0
- package/dist-lib/types/editor/registry.d.ts +38 -0
- package/dist-lib/types/editor/routePreview.d.ts +285 -0
- package/dist-lib/types/editor/routePreviewArtifactV2.d.ts +34 -0
- package/dist-lib/types/editor/routePreviewArtifactV3.d.ts +64 -0
- package/dist-lib/types/editor/routePreviewPlacement.d.ts +9 -0
- package/dist-lib/types/editor/routePreviewStatus.d.ts +48 -0
- package/dist-lib/types/editor/scenarioCoverage.d.ts +167 -0
- package/dist-lib/types/editor/screenCards.d.ts +101 -0
- package/dist-lib/types/editor/screenDimensions.d.ts +63 -0
- package/dist-lib/types/editor/screenFlows.d.ts +47 -0
- package/dist-lib/types/editor/screenInteractions.d.ts +4 -0
- package/dist-lib/types/editor/screenLists.d.ts +40 -0
- package/dist-lib/types/editor/screenStateGroups.d.ts +36 -0
- package/dist-lib/types/editor/screenshotBitmaps.d.ts +20 -0
- package/dist-lib/types/editor/sectionHeaders.d.ts +117 -0
- package/dist-lib/types/editor/shadowPreview.d.ts +103 -0
- package/dist-lib/types/editor/sharedSource.d.ts +40 -0
- package/dist-lib/types/editor/sourceJournal.d.ts +27 -0
- package/dist-lib/types/editor/store.d.ts +838 -0
- package/dist-lib/types/editor/storyboardComposition.d.ts +116 -0
- package/dist-lib/types/editor/storyboardDiscovery.d.ts +105 -0
- package/dist-lib/types/editor/storyboardEnvironment.d.ts +22 -0
- package/dist-lib/types/editor/storyboardGraph.d.ts +120 -0
- package/dist-lib/types/editor/storyboardGraphRuntime.d.ts +12 -0
- package/dist-lib/types/editor/storyboardGraphView.d.ts +104 -0
- package/dist-lib/types/editor/surfaceDemands.d.ts +138 -0
- package/dist-lib/types/editor/tokens.d.ts +26 -0
- package/dist-lib/types/editor/useObserved.d.ts +1 -0
- package/dist-lib/types/editor/viewportPresets.d.ts +21 -0
- package/dist-lib/types/editor/visualQa.d.ts +50 -0
- package/dist-lib/types/lib.d.ts +365 -0
- package/dist-lib/types/shell/ApplyPanel.d.ts +1 -0
- package/dist-lib/types/shell/AssetsPanel.d.ts +3 -0
- package/dist-lib/types/shell/CanvasStatusProbe.d.ts +5 -0
- package/dist-lib/types/shell/CodePanel.d.ts +1 -0
- package/dist-lib/types/shell/ComponentStateControls.d.ts +108 -0
- package/dist-lib/types/shell/ContextMenu.d.ts +1 -0
- package/dist-lib/types/shell/LayerTree.d.ts +7 -0
- package/dist-lib/types/shell/PropsPanel.d.ts +1 -0
- package/dist-lib/types/shell/StoryboardGraphPanel.d.ts +23 -0
- package/dist-lib/types/shell/ZoomIndicator.d.ts +4 -0
- package/dist-lib/types/shell/qaPresentation.d.ts +9 -0
- package/dist-lib/types/testing.d.ts +8 -0
- package/dist-lib/types/ui/SourceRefControl.d.ts +38 -0
- package/dist-lib/types/ui/icons.d.ts +30 -0
- package/node/dev-mirror.mjs +63 -17
- package/package.json +7 -8
- package/testing.d.ts +0 -26
- package/types.d.ts +0 -2675
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
import { type RoutePreviewArtifactBundleV2, type RoutePreviewArtifactV2Frame, type RoutePreviewArtifactV2Hash } from './routePreviewArtifactV2.js';
|
|
2
|
+
export type RoutePreviewArtifactV3Status = 'ready' | 'rendered-with-qa-failure' | 'capture-error';
|
|
3
|
+
export type RoutePreviewArtifactV3ScreenshotMediaType = 'image/png' | 'image/webp';
|
|
4
|
+
export interface RoutePreviewArtifactV3Viewport {
|
|
5
|
+
readonly width: number;
|
|
6
|
+
readonly height: number;
|
|
7
|
+
}
|
|
8
|
+
export interface RoutePreviewArtifactV3Diagnostic {
|
|
9
|
+
readonly stage: string;
|
|
10
|
+
readonly code: string;
|
|
11
|
+
readonly selector?: string;
|
|
12
|
+
readonly label?: string;
|
|
13
|
+
readonly message?: string;
|
|
14
|
+
readonly viewport: RoutePreviewArtifactV3Viewport;
|
|
15
|
+
}
|
|
16
|
+
export interface RoutePreviewArtifactV3ScreenshotReference {
|
|
17
|
+
readonly hash: RoutePreviewArtifactV2Hash;
|
|
18
|
+
readonly mediaType: RoutePreviewArtifactV3ScreenshotMediaType;
|
|
19
|
+
readonly width: number;
|
|
20
|
+
readonly height: number;
|
|
21
|
+
}
|
|
22
|
+
export interface RoutePreviewArtifactV3ScreenshotAsset {
|
|
23
|
+
readonly mediaType: RoutePreviewArtifactV3ScreenshotMediaType;
|
|
24
|
+
readonly width: number;
|
|
25
|
+
readonly height: number;
|
|
26
|
+
readonly data: string;
|
|
27
|
+
readonly byteLength: number;
|
|
28
|
+
}
|
|
29
|
+
export interface RoutePreviewArtifactV3Frame {
|
|
30
|
+
readonly status: RoutePreviewArtifactV3Status;
|
|
31
|
+
readonly viewport: RoutePreviewArtifactV3Viewport;
|
|
32
|
+
/** Revision that produced this frame, retained when bundles mix provenance. */
|
|
33
|
+
readonly sourceRevision?: string;
|
|
34
|
+
/** What this frame was captured from, so freshness is decided per frame. */
|
|
35
|
+
readonly fingerprint?: string;
|
|
36
|
+
readonly snapshot?: RoutePreviewArtifactV2Frame;
|
|
37
|
+
readonly screenshot?: RoutePreviewArtifactV3ScreenshotReference;
|
|
38
|
+
readonly diagnostics: readonly RoutePreviewArtifactV3Diagnostic[];
|
|
39
|
+
}
|
|
40
|
+
export interface RoutePreviewArtifactBundleV3 {
|
|
41
|
+
readonly version: 3;
|
|
42
|
+
readonly namespace: string;
|
|
43
|
+
readonly sourceRevision?: string;
|
|
44
|
+
readonly assets: {
|
|
45
|
+
readonly head: RoutePreviewArtifactBundleV2['assets']['head'];
|
|
46
|
+
readonly stylesheets: RoutePreviewArtifactBundleV2['assets']['stylesheets'];
|
|
47
|
+
readonly screenshots: Readonly<Record<RoutePreviewArtifactV2Hash, RoutePreviewArtifactV3ScreenshotAsset>>;
|
|
48
|
+
};
|
|
49
|
+
readonly frames: Readonly<Record<string, RoutePreviewArtifactV3Frame>>;
|
|
50
|
+
}
|
|
51
|
+
export interface RoutePreviewArtifactV3ValidationResult {
|
|
52
|
+
readonly valid: boolean;
|
|
53
|
+
readonly errors: string[];
|
|
54
|
+
readonly bytes: number;
|
|
55
|
+
}
|
|
56
|
+
export interface RoutePreviewArtifactV3ReconstructedScreenshot {
|
|
57
|
+
readonly mediaType: RoutePreviewArtifactV3ScreenshotMediaType;
|
|
58
|
+
readonly width: number;
|
|
59
|
+
readonly height: number;
|
|
60
|
+
readonly dataUrl: string;
|
|
61
|
+
}
|
|
62
|
+
export declare function validateRoutePreviewArtifactV3Browser(value: unknown): RoutePreviewArtifactV3ValidationResult;
|
|
63
|
+
export declare function reconstructRoutePreviewArtifactSnapshotV3(value: unknown, frameId: string): string | null;
|
|
64
|
+
export declare function reconstructRoutePreviewArtifactScreenshotV3(value: unknown, frameId: string): RoutePreviewArtifactV3ReconstructedScreenshot | null;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
export type RoutePreviewPlacement = 'canvas' | 'isolated-producer' | 'none';
|
|
2
|
+
/**
|
|
3
|
+
* A running route belongs inside the transformed canvas only while its frame is active.
|
|
4
|
+
* Background cache producers must stay outside that camera boundary.
|
|
5
|
+
*/
|
|
6
|
+
export declare function resolveRoutePreviewPlacement({ active, live, }: {
|
|
7
|
+
active: boolean;
|
|
8
|
+
live: boolean;
|
|
9
|
+
}): RoutePreviewPlacement;
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import type { RoutePreviewArtifactResolution } from './routePreview.js';
|
|
2
|
+
import type { RoutePreviewArtifactV3Status } from './routePreviewArtifactV3.js';
|
|
3
|
+
export interface RoutePreviewArtifactStatusInput {
|
|
4
|
+
stale: boolean;
|
|
5
|
+
resolution: RoutePreviewArtifactResolution;
|
|
6
|
+
captureStatus?: RoutePreviewArtifactV3Status;
|
|
7
|
+
diagnostic?: string;
|
|
8
|
+
}
|
|
9
|
+
export interface RoutePreviewArtifactStatusPresentation {
|
|
10
|
+
title: string;
|
|
11
|
+
detail: string;
|
|
12
|
+
tone: 'info' | 'warning' | 'error';
|
|
13
|
+
role: 'status' | 'alert';
|
|
14
|
+
retryable: boolean;
|
|
15
|
+
}
|
|
16
|
+
export type StaticRoutePreviewSurface = 'screenshot' | 'dom' | 'none';
|
|
17
|
+
/**
|
|
18
|
+
* Background canvas frames prefer the already captured bitmap. Reconstructing
|
|
19
|
+
* every frozen DOM tree at once blocks the editor main thread; the selected
|
|
20
|
+
* frame still promotes to the live/detailed path independently.
|
|
21
|
+
*
|
|
22
|
+
* The bitmap stops being enough when the camera magnifies a frame beyond the
|
|
23
|
+
* screenshot's pixel density — a design surface must not look like a blurry
|
|
24
|
+
* screenshot under zoom. `magnifiedPastBitmap` (the frame LOD controller's
|
|
25
|
+
* density signal, gated on the `full` tier) trades the screenshot for the
|
|
26
|
+
* frozen DOM tree; at magnifying zoom levels only a handful of frames fit the
|
|
27
|
+
* viewport, so reconstruction stays bounded.
|
|
28
|
+
*
|
|
29
|
+
* A frame under preview intent (`preparedForPromotion`) also mounts its
|
|
30
|
+
* frozen DOM: the mounted preview is what the D2 bootless promotion imports
|
|
31
|
+
* from, so hovering prepares a ~50ms activation instead of a live boot.
|
|
32
|
+
* Intent slots are LRU-bounded, so preparation stays bounded too.
|
|
33
|
+
*/
|
|
34
|
+
export declare function resolveStaticRoutePreviewSurface({ hasScreenshot, hasDomSnapshot, magnifiedPastBitmap, preparedForPromotion, preferDom, }: {
|
|
35
|
+
hasScreenshot: boolean;
|
|
36
|
+
hasDomSnapshot: boolean;
|
|
37
|
+
magnifiedPastBitmap?: boolean;
|
|
38
|
+
preparedForPromotion?: boolean;
|
|
39
|
+
/**
|
|
40
|
+
* Host preference: mount the frozen DOM from the start. On per-section
|
|
41
|
+
* canvases a canvas holds a section's worth of frames, so the whole-catalog
|
|
42
|
+
* reconstruction concern behind bitmap-first no longer applies, and every
|
|
43
|
+
* frame stays promotion-ready without a mount wait.
|
|
44
|
+
*/
|
|
45
|
+
preferDom?: boolean;
|
|
46
|
+
}): StaticRoutePreviewSurface;
|
|
47
|
+
/** Turns artifact freshness and capture state into one unambiguous frame badge. */
|
|
48
|
+
export declare function resolveRoutePreviewArtifactStatus({ stale, resolution, captureStatus, diagnostic, }: RoutePreviewArtifactStatusInput): RoutePreviewArtifactStatusPresentation | null;
|
|
@@ -0,0 +1,167 @@
|
|
|
1
|
+
import type { RegistryPropValue } from './registry';
|
|
2
|
+
export type ScenarioCoverageClaim = {
|
|
3
|
+
scenarioId: string;
|
|
4
|
+
kind: 'frame';
|
|
5
|
+
screenId: string;
|
|
6
|
+
reason?: string;
|
|
7
|
+
} | {
|
|
8
|
+
scenarioId: string;
|
|
9
|
+
/** A folded screen-state sibling demonstrates the scenario. */
|
|
10
|
+
kind: 'screen-state';
|
|
11
|
+
screenId: string;
|
|
12
|
+
reason?: string;
|
|
13
|
+
} | {
|
|
14
|
+
scenarioId: string;
|
|
15
|
+
/** A registry-typed component prop on the screen demonstrates it. */
|
|
16
|
+
kind: 'component-state';
|
|
17
|
+
screenId: string;
|
|
18
|
+
componentName: string;
|
|
19
|
+
prop: string;
|
|
20
|
+
value: RegistryPropValue;
|
|
21
|
+
reason?: string;
|
|
22
|
+
} | {
|
|
23
|
+
scenarioId: string;
|
|
24
|
+
/** A named viewport preset on the screen demonstrates it. */
|
|
25
|
+
kind: 'viewport';
|
|
26
|
+
screenId: string;
|
|
27
|
+
/** ViewportPresetDef label, e.g. "Minimum". */
|
|
28
|
+
preset: string;
|
|
29
|
+
reason?: string;
|
|
30
|
+
} | {
|
|
31
|
+
scenarioId: string;
|
|
32
|
+
/**
|
|
33
|
+
* A component catalog sheet demonstrates it — the surface for preview
|
|
34
|
+
* adapters whose product DOM is unstamped plain markup, so no screen
|
|
35
|
+
* instance exists to toggle.
|
|
36
|
+
*/
|
|
37
|
+
kind: 'catalog';
|
|
38
|
+
screenId: string;
|
|
39
|
+
reason?: string;
|
|
40
|
+
} | {
|
|
41
|
+
scenarioId: string;
|
|
42
|
+
/**
|
|
43
|
+
* A declared interactive axis demonstrates it: the scenario is one
|
|
44
|
+
* gesture away from the captured screen (a folded sidebar, a hover),
|
|
45
|
+
* so it needs a control rather than a frame of its own.
|
|
46
|
+
*/
|
|
47
|
+
kind: 'interactive-state';
|
|
48
|
+
/** InteractiveStateDef id. */
|
|
49
|
+
interaction: string;
|
|
50
|
+
/** InteractiveStateOption id within that axis. */
|
|
51
|
+
option: string;
|
|
52
|
+
screenId: string;
|
|
53
|
+
reason?: string;
|
|
54
|
+
} | {
|
|
55
|
+
scenarioId: string;
|
|
56
|
+
/**
|
|
57
|
+
* A badge composition on the screen's repeated card demonstrates it —
|
|
58
|
+
* which chips a row carries is a slot decision, not a screen.
|
|
59
|
+
*/
|
|
60
|
+
kind: 'card-slot';
|
|
61
|
+
/** ScreenCardDef id. */
|
|
62
|
+
card: string;
|
|
63
|
+
/** CardSlotDef id within that card. */
|
|
64
|
+
slot: string;
|
|
65
|
+
/** CardBadgeOption id within that slot. */
|
|
66
|
+
option: string;
|
|
67
|
+
screenId: string;
|
|
68
|
+
reason?: string;
|
|
69
|
+
} | {
|
|
70
|
+
scenarioId: string;
|
|
71
|
+
/** A row count on the screen's declared list demonstrates it. */
|
|
72
|
+
kind: 'list-length';
|
|
73
|
+
/** ScreenListDef id. */
|
|
74
|
+
list: string;
|
|
75
|
+
count: number;
|
|
76
|
+
screenId: string;
|
|
77
|
+
reason?: string;
|
|
78
|
+
} | {
|
|
79
|
+
scenarioId: string;
|
|
80
|
+
kind: 'behavior';
|
|
81
|
+
reason: string;
|
|
82
|
+
} | {
|
|
83
|
+
scenarioId: string;
|
|
84
|
+
kind: 'todo';
|
|
85
|
+
reason: string;
|
|
86
|
+
};
|
|
87
|
+
export interface ScenarioCoverageDiagnostic {
|
|
88
|
+
severity: 'error' | 'warning';
|
|
89
|
+
scenarioId: string;
|
|
90
|
+
message: string;
|
|
91
|
+
}
|
|
92
|
+
export interface ScenarioCoverageContext {
|
|
93
|
+
/** The scenario inventory every claim must classify exactly once. */
|
|
94
|
+
scenarios: readonly {
|
|
95
|
+
id: string;
|
|
96
|
+
}[];
|
|
97
|
+
/** Screen catalog with state-group metadata. */
|
|
98
|
+
screens: readonly {
|
|
99
|
+
id: string;
|
|
100
|
+
scenario?: string;
|
|
101
|
+
state?: string;
|
|
102
|
+
}[];
|
|
103
|
+
/** Registry prop declarations, for component-state claims. */
|
|
104
|
+
registry: Readonly<Record<string, {
|
|
105
|
+
props?: Readonly<Record<string, readonly RegistryPropValue[]>>;
|
|
106
|
+
}>>;
|
|
107
|
+
/** Host-declared viewport presets, for viewport claims. */
|
|
108
|
+
viewportPresets: readonly {
|
|
109
|
+
label: string;
|
|
110
|
+
}[];
|
|
111
|
+
/** Catalog sheet pages, for catalog claims. */
|
|
112
|
+
catalogPages?: readonly {
|
|
113
|
+
id: string;
|
|
114
|
+
}[];
|
|
115
|
+
/** Host-declared interactive axes, for interactive-state claims. */
|
|
116
|
+
interactiveStates?: readonly {
|
|
117
|
+
id: string;
|
|
118
|
+
options: readonly {
|
|
119
|
+
id: string;
|
|
120
|
+
steps?: readonly unknown[];
|
|
121
|
+
}[];
|
|
122
|
+
}[];
|
|
123
|
+
/** Host-declared card compositions, for card-slot claims. */
|
|
124
|
+
screenCards?: readonly {
|
|
125
|
+
id: string;
|
|
126
|
+
slots: readonly {
|
|
127
|
+
id: string;
|
|
128
|
+
options: readonly {
|
|
129
|
+
id: string;
|
|
130
|
+
}[];
|
|
131
|
+
}[];
|
|
132
|
+
}[];
|
|
133
|
+
/** Host-declared list axes, for list-length claims. */
|
|
134
|
+
screenLists?: readonly {
|
|
135
|
+
id: string;
|
|
136
|
+
min?: number;
|
|
137
|
+
max?: number;
|
|
138
|
+
}[];
|
|
139
|
+
}
|
|
140
|
+
/**
|
|
141
|
+
* Validates the ledger: every scenario classified exactly once, and every
|
|
142
|
+
* claim's target actually exists — screen in the catalog, state in a group,
|
|
143
|
+
* prop and value in the registry, preset among the host's declarations.
|
|
144
|
+
*/
|
|
145
|
+
export declare function validateScenarioCoverage(claims: readonly ScenarioCoverageClaim[], context: ScenarioCoverageContext): ScenarioCoverageDiagnostic[];
|
|
146
|
+
export interface ApplyCoverageResult {
|
|
147
|
+
status: 'applied' | 'pending-import' | 'failed';
|
|
148
|
+
message?: string;
|
|
149
|
+
}
|
|
150
|
+
/**
|
|
151
|
+
* Reproduces the reviewed state a claim describes, through the same actions
|
|
152
|
+
* the panels use: frame/screen-state claims activate the frame (activation
|
|
153
|
+
* reveals folded variants), viewport claims apply the preset resize, an
|
|
154
|
+
* interactive-state claim flips the axis, card-slot and list-length claims
|
|
155
|
+
* edit the imported tree, and component-state claims flip the registry prop
|
|
156
|
+
* on the imported instance.
|
|
157
|
+
*/
|
|
158
|
+
export declare function applyScenarioCoverageClaim(claim: ScenarioCoverageClaim): ApplyCoverageResult;
|
|
159
|
+
export declare function setScenarioCoverageClaims(claims: readonly ScenarioCoverageClaim[]): void;
|
|
160
|
+
export declare function getScenarioCoverageClaims(): readonly ScenarioCoverageClaim[];
|
|
161
|
+
/** Claims verified on one screen — the right panel's coverage section. */
|
|
162
|
+
export declare function coverageClaimsForScreen(screenId: string): readonly ScenarioCoverageClaim[];
|
|
163
|
+
/**
|
|
164
|
+
* Scenario ids a component prop control demonstrates on the given screen —
|
|
165
|
+
* rendered as chips beside the control so the panel shows WHY it exists.
|
|
166
|
+
*/
|
|
167
|
+
export declare function coverageBadgesForComponentProp(screenId: string, componentName: string, prop: string): readonly string[];
|
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
import { type NodeSelector } from './nodeSelector';
|
|
2
|
+
import type { ComponentBranch } from './screenDimensions';
|
|
3
|
+
import type { RegistryPropValue } from './registry';
|
|
4
|
+
import type { NodeModel, PageModel } from './store';
|
|
5
|
+
export interface CardBadgeOption {
|
|
6
|
+
id: string;
|
|
7
|
+
/** Panel chip text, and the witness looked for in the product source. */
|
|
8
|
+
label: string;
|
|
9
|
+
/** Registry adapter used when the capture has no donor to clone. */
|
|
10
|
+
component: string;
|
|
11
|
+
props: Readonly<Record<string, RegistryPropValue>>;
|
|
12
|
+
/** Recognizes this badge in captured markup. */
|
|
13
|
+
match: NodeSelector;
|
|
14
|
+
/**
|
|
15
|
+
* Fixed position within the slot, mirroring the component's JSX order — the
|
|
16
|
+
* duplicate-name mark sits before the name, the "new" mark after it.
|
|
17
|
+
* Without an anchor the badge is appended, which is what a list-shaped slot
|
|
18
|
+
* (the status chips) wants.
|
|
19
|
+
*/
|
|
20
|
+
anchor?: {
|
|
21
|
+
before?: NodeSelector;
|
|
22
|
+
after?: NodeSelector;
|
|
23
|
+
};
|
|
24
|
+
}
|
|
25
|
+
export interface CardSlotDef {
|
|
26
|
+
id: string;
|
|
27
|
+
label: string;
|
|
28
|
+
/** The element inside the card that holds these badges. */
|
|
29
|
+
container: NodeSelector;
|
|
30
|
+
/** 'multiple' (the default) when the product can show several at once. */
|
|
31
|
+
arity?: 'single' | 'multiple';
|
|
32
|
+
/**
|
|
33
|
+
* True when the product renders the container only if it has content — an
|
|
34
|
+
* empty one left behind would still take its gap and padding.
|
|
35
|
+
*/
|
|
36
|
+
hideWhenEmpty?: boolean;
|
|
37
|
+
/**
|
|
38
|
+
* Where the container belongs when a card does not have one, mirroring the
|
|
39
|
+
* component's JSX. Required for a `hideWhenEmpty` slot, since those cards
|
|
40
|
+
* are exactly the ones missing it.
|
|
41
|
+
*/
|
|
42
|
+
placement?: {
|
|
43
|
+
parent: NodeSelector;
|
|
44
|
+
before?: NodeSelector;
|
|
45
|
+
after?: NodeSelector;
|
|
46
|
+
};
|
|
47
|
+
options: readonly CardBadgeOption[];
|
|
48
|
+
}
|
|
49
|
+
export interface ScreenCardDef {
|
|
50
|
+
id: string;
|
|
51
|
+
label: string;
|
|
52
|
+
/** The repeated card this composition applies to. */
|
|
53
|
+
card: NodeSelector;
|
|
54
|
+
slots: readonly CardSlotDef[];
|
|
55
|
+
/** Product source the branch scanner validates the vocabulary against. */
|
|
56
|
+
sourcePath?: string;
|
|
57
|
+
}
|
|
58
|
+
export interface ScreenCardDiagnostic {
|
|
59
|
+
severity: 'error' | 'warning';
|
|
60
|
+
cardId: string;
|
|
61
|
+
message: string;
|
|
62
|
+
}
|
|
63
|
+
/** Cards one declaration may open controls for. */
|
|
64
|
+
export declare const MAX_CARD_MATCHES = 12;
|
|
65
|
+
export declare function validateScreenCards(defs: readonly ScreenCardDef[], context: {
|
|
66
|
+
registry: Readonly<Record<string, {
|
|
67
|
+
props?: Readonly<Record<string, readonly RegistryPropValue[]>>;
|
|
68
|
+
}>>;
|
|
69
|
+
scansBySource?: Readonly<Record<string, readonly ComponentBranch[]>>;
|
|
70
|
+
}): ScreenCardDiagnostic[];
|
|
71
|
+
export declare function findScreenCards(page: PageModel, def: ScreenCardDef): NodeModel[];
|
|
72
|
+
export declare function findCardSlot(card: NodeModel, slot: CardSlotDef): NodeModel | null;
|
|
73
|
+
/**
|
|
74
|
+
* A badge is present either as the captured element or as an adapter instance
|
|
75
|
+
* carrying this option's props — adding one can produce either.
|
|
76
|
+
*/
|
|
77
|
+
export declare function nodeIsBadgeOption(node: NodeModel, option: CardBadgeOption): boolean;
|
|
78
|
+
/** Option ids the card currently shows in this slot. */
|
|
79
|
+
export declare function cardSlotSelection(card: NodeModel, slot: CardSlotDef): string[];
|
|
80
|
+
export declare function describeScreenCard(card: NodeModel, index: number): string;
|
|
81
|
+
/**
|
|
82
|
+
* A captured instance of this badge somewhere else on the screen. Cloning a
|
|
83
|
+
* real one keeps the product's classes and box; only a badge no card shows
|
|
84
|
+
* has to be built from the adapter.
|
|
85
|
+
*/
|
|
86
|
+
export declare function findBadgeDonor(page: PageModel, option: CardBadgeOption, exclude: NodeModel): NodeModel | null;
|
|
87
|
+
/** A captured slot container from another card, used when this card lacks one. */
|
|
88
|
+
export declare function findSlotDonor(page: PageModel, slot: CardSlotDef, exclude: NodeModel): NodeModel | null;
|
|
89
|
+
/**
|
|
90
|
+
* Parent and index where a missing slot container belongs on this card,
|
|
91
|
+
* from the declared placement. Null when the card has no such parent or the
|
|
92
|
+
* slot never declared one.
|
|
93
|
+
*/
|
|
94
|
+
export declare function findSlotPlacement(card: NodeModel, slot: CardSlotDef): {
|
|
95
|
+
parent: NodeModel;
|
|
96
|
+
index: number;
|
|
97
|
+
} | null;
|
|
98
|
+
/** Insertion point for an anchored badge, or the end of the slot. */
|
|
99
|
+
export declare function badgeInsertIndex(container: NodeModel, option: CardBadgeOption): number;
|
|
100
|
+
export declare function setScreenCards(defs: readonly ScreenCardDef[]): void;
|
|
101
|
+
export declare function getScreenCards(): readonly ScreenCardDef[];
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
import { type NodeSelector } from './nodeSelector';
|
|
2
|
+
import type { RegistryPropValue } from './registry';
|
|
3
|
+
import type { NodeModel, PageModel } from './store';
|
|
4
|
+
export interface ScreenDimensionOption {
|
|
5
|
+
label: string;
|
|
6
|
+
props: Readonly<Record<string, RegistryPropValue>>;
|
|
7
|
+
}
|
|
8
|
+
export interface ScreenDimensionDef {
|
|
9
|
+
id: string;
|
|
10
|
+
label: string;
|
|
11
|
+
/** Registry adapter that renders every state of this piece. */
|
|
12
|
+
component: string;
|
|
13
|
+
/** Enum axis: an existing registry prop (options come from the registry). */
|
|
14
|
+
prop?: string;
|
|
15
|
+
/** Dictionary axis: named cases mapped onto adapter props. */
|
|
16
|
+
options?: readonly ScreenDimensionOption[];
|
|
17
|
+
/**
|
|
18
|
+
* Raw-node matcher: the captured stand-in this dimension adopts. Class
|
|
19
|
+
* matching uses the css-module prefix (`_bar_`), which survives hash
|
|
20
|
+
* churn; testId matches `data-testid`.
|
|
21
|
+
*/
|
|
22
|
+
match: NodeSelector;
|
|
23
|
+
/** Product source the branch scanner validates this declaration against. */
|
|
24
|
+
sourcePath?: string;
|
|
25
|
+
}
|
|
26
|
+
/** Panel controls a single declaration may open. */
|
|
27
|
+
export declare const MAX_DIMENSION_MATCHES = 24;
|
|
28
|
+
export interface ScreenDimensionDiagnostic {
|
|
29
|
+
severity: 'error' | 'warning';
|
|
30
|
+
dimensionId: string;
|
|
31
|
+
message: string;
|
|
32
|
+
}
|
|
33
|
+
/** One discovered branch from the node-side component scanner. */
|
|
34
|
+
export interface ComponentBranch {
|
|
35
|
+
kind: 'conditional' | 'enum';
|
|
36
|
+
condition: string;
|
|
37
|
+
element?: string;
|
|
38
|
+
renders?: string;
|
|
39
|
+
values?: readonly string[];
|
|
40
|
+
line?: number;
|
|
41
|
+
}
|
|
42
|
+
/**
|
|
43
|
+
* Validates dimension declarations against the registry and the component
|
|
44
|
+
* branch scans: the adapter and its axis must exist, and every dictionary
|
|
45
|
+
* option should correspond to a branch discovered in the declared source.
|
|
46
|
+
*/
|
|
47
|
+
export declare function validateScreenDimensions(dimensions: readonly ScreenDimensionDef[], context: {
|
|
48
|
+
registry: Readonly<Record<string, {
|
|
49
|
+
props?: Readonly<Record<string, readonly RegistryPropValue[]>>;
|
|
50
|
+
}>>;
|
|
51
|
+
scansBySource?: Readonly<Record<string, readonly ComponentBranch[]>>;
|
|
52
|
+
}): ScreenDimensionDiagnostic[];
|
|
53
|
+
export declare function nodeMatchesDimension(node: NodeModel, dimension: ScreenDimensionDef): boolean;
|
|
54
|
+
/** Every matching node in document order (adopted instances included). */
|
|
55
|
+
export declare function findDimensionNodes(page: PageModel, dimension: ScreenDimensionDef): NodeModel[];
|
|
56
|
+
/** First matching node (adopted adapter instance or raw captured stand-in). */
|
|
57
|
+
export declare function findDimensionNode(page: PageModel, dimension: ScreenDimensionDef): NodeModel | null;
|
|
58
|
+
/** Props payload for a chosen dimension value. */
|
|
59
|
+
export declare function dimensionPropsForValue(dimension: ScreenDimensionDef, value: string): Readonly<Record<string, RegistryPropValue>> | null;
|
|
60
|
+
/** Current value of a dimension on a node, or null for the captured state. */
|
|
61
|
+
export declare function dimensionValueOfNode(dimension: ScreenDimensionDef, node: NodeModel): string | null;
|
|
62
|
+
export declare function setScreenDimensions(dimensions: readonly ScreenDimensionDef[]): void;
|
|
63
|
+
export declare function getScreenDimensions(): readonly ScreenDimensionDef[];
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import type { DesignScreenInteraction, StoryboardEnvironment } from './designImport';
|
|
2
|
+
export interface ScreenFlowWaypoint {
|
|
3
|
+
/** Catalog id of the screen this waypoint materializes (importPageId). */
|
|
4
|
+
screenId: string;
|
|
5
|
+
/**
|
|
6
|
+
* The walk delta: interactions leading from the previous waypoint (or the
|
|
7
|
+
* boot, for the first waypoint) to this screen's state.
|
|
8
|
+
*/
|
|
9
|
+
steps?: readonly DesignScreenInteraction[];
|
|
10
|
+
}
|
|
11
|
+
export interface ScreenFlowPath {
|
|
12
|
+
id: string;
|
|
13
|
+
/** Route the instance boots on. */
|
|
14
|
+
route: string;
|
|
15
|
+
/**
|
|
16
|
+
* Declarative browser environment of the whole instance, merged over the
|
|
17
|
+
* storyboard baseline. Branch paths (error states, special fixtures)
|
|
18
|
+
* declare their overrides here and pay their own boot.
|
|
19
|
+
*/
|
|
20
|
+
environment?: StoryboardEnvironment;
|
|
21
|
+
waypoints: readonly ScreenFlowWaypoint[];
|
|
22
|
+
}
|
|
23
|
+
export interface ScreenFlowDiagnostic {
|
|
24
|
+
severity: 'error' | 'warning';
|
|
25
|
+
pathId: string;
|
|
26
|
+
message: string;
|
|
27
|
+
}
|
|
28
|
+
/**
|
|
29
|
+
* Structural validation of host-declared flow paths against the screen
|
|
30
|
+
* catalog. Errors mark paths the runner will refuse; warnings surface
|
|
31
|
+
* declarations that will behave surprisingly but still run.
|
|
32
|
+
*/
|
|
33
|
+
export declare function validateScreenFlows(paths: readonly ScreenFlowPath[], screens: readonly {
|
|
34
|
+
id: string;
|
|
35
|
+
}[]): ScreenFlowDiagnostic[];
|
|
36
|
+
/**
|
|
37
|
+
* Orders paths for a materialization round: paths that deliver a priority
|
|
38
|
+
* screen (the active frame, the hovered frame) run first; the declared order
|
|
39
|
+
* is kept otherwise.
|
|
40
|
+
*/
|
|
41
|
+
export declare function orderFlowPaths<T extends {
|
|
42
|
+
waypoints: readonly ScreenFlowWaypoint[];
|
|
43
|
+
}>(paths: readonly T[], priorityScreenIds: ReadonlySet<string>): T[];
|
|
44
|
+
export declare function setScreenFlows(paths: readonly ScreenFlowPath[]): void;
|
|
45
|
+
export declare function getScreenFlows(): readonly ScreenFlowPath[];
|
|
46
|
+
/** The path that delivers a screen, or null when no flow claims it. */
|
|
47
|
+
export declare function flowPathForScreen(screenId: string): ScreenFlowPath | null;
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import type { DesignScreenInteraction, DesignScreenInteractionReport } from './designImport';
|
|
2
|
+
export declare function settleScreen(iframe: HTMLIFrameElement, settleMs: number): Promise<void>;
|
|
3
|
+
export declare function elementVisible(element: Element): boolean;
|
|
4
|
+
export declare function runScreenInteractions(iframe: HTMLIFrameElement, interactions: readonly DesignScreenInteraction[]): Promise<DesignScreenInteractionReport>;
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { type NodeSelector } from './nodeSelector';
|
|
2
|
+
import type { NodeModel, PageModel } from './store';
|
|
3
|
+
export interface ScreenListDef {
|
|
4
|
+
id: string;
|
|
5
|
+
label: string;
|
|
6
|
+
/** The repeating list's own element. */
|
|
7
|
+
container: NodeSelector;
|
|
8
|
+
/** One repeated row inside it. */
|
|
9
|
+
item: NodeSelector;
|
|
10
|
+
/** Fewest rows the control offers. Default 0. */
|
|
11
|
+
min?: number;
|
|
12
|
+
/** Most rows the control offers. Default 12. */
|
|
13
|
+
max?: number;
|
|
14
|
+
}
|
|
15
|
+
export interface ScreenListDiagnostic {
|
|
16
|
+
severity: 'error' | 'warning';
|
|
17
|
+
listId: string;
|
|
18
|
+
message: string;
|
|
19
|
+
}
|
|
20
|
+
/** Range a list offers when the declaration leaves it open. */
|
|
21
|
+
export declare const SCREEN_LIST_DEFAULT_MIN = 0;
|
|
22
|
+
export declare const SCREEN_LIST_DEFAULT_MAX = 12;
|
|
23
|
+
export declare function validateScreenLists(defs: readonly ScreenListDef[]): ScreenListDiagnostic[];
|
|
24
|
+
export declare function findScreenListContainer(page: PageModel, def: ScreenListDef): NodeModel | null;
|
|
25
|
+
/** Repeated rows inside the container, in document order. */
|
|
26
|
+
export declare function screenListItems(container: NodeModel, def: ScreenListDef): NodeModel[];
|
|
27
|
+
/** Current row count, or null when the screen has no such list. */
|
|
28
|
+
export declare function screenListLength(page: PageModel, def: ScreenListDef): number | null;
|
|
29
|
+
export declare function clampScreenListLength(def: ScreenListDef, count: number): number;
|
|
30
|
+
/** Vertical room one row takes from its parent: its own box plus the gap. */
|
|
31
|
+
export declare function rowAdvance(parent: NodeModel, item: NodeModel): number;
|
|
32
|
+
/**
|
|
33
|
+
* Absorbs a row-count change into the captured geometry. Pinned heights
|
|
34
|
+
* between the rows and the scroll boundary take the delta; the boundary and
|
|
35
|
+
* everything above keep the size the product gave them, and the boundary
|
|
36
|
+
* gains a scrollbar exactly while its content overflows.
|
|
37
|
+
*/
|
|
38
|
+
export declare function applyListHeightDelta(root: NodeModel, itemParent: NodeModel, delta: number): void;
|
|
39
|
+
export declare function setScreenLists(defs: readonly ScreenListDef[]): void;
|
|
40
|
+
export declare function getScreenLists(): readonly ScreenListDef[];
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Screen-state group declarations are host-owned: the host names which frames
|
|
3
|
+
* belong to a scenario (the capture pipeline proposes, the declaration on the
|
|
4
|
+
* page decides), and the core never infers membership from names, routes, or
|
|
5
|
+
* layout proximity. What the core CAN do is hold the declaration to the
|
|
6
|
+
* contract the Screen states panel actually enforces — same canvas, one frame
|
|
7
|
+
* per state label, a shared viewport, at least one sibling to flip to. A
|
|
8
|
+
* declaration that breaks the contract does not error at runtime; it just
|
|
9
|
+
* silently renders a confusing panel (or none at all), so validation surfaces
|
|
10
|
+
* those mismatches as diagnostics the host can fix at declaration time.
|
|
11
|
+
*/
|
|
12
|
+
/** The declaration-relevant slice of a page: everything grouping keys off. */
|
|
13
|
+
export interface ScreenStateGroupInput {
|
|
14
|
+
name: string;
|
|
15
|
+
canvas?: string;
|
|
16
|
+
route?: string;
|
|
17
|
+
scenario?: string;
|
|
18
|
+
state?: string;
|
|
19
|
+
width?: number;
|
|
20
|
+
height?: number;
|
|
21
|
+
}
|
|
22
|
+
export interface ScreenStateGroupDiagnostic {
|
|
23
|
+
severity: 'warning' | 'info';
|
|
24
|
+
code: 'mixed-viewport' | 'duplicate-state' | 'cross-canvas' | 'singleton-group';
|
|
25
|
+
scenario: string;
|
|
26
|
+
message: string;
|
|
27
|
+
}
|
|
28
|
+
/**
|
|
29
|
+
* Validates every declared screen-state group among the given pages. Only
|
|
30
|
+
* pages that actually declare membership participate: a page without a
|
|
31
|
+
* scenario has made no claim, and a page without a route is not a captured
|
|
32
|
+
* screen (mirrors the FrameScreenStates gate). Diagnostics come back with
|
|
33
|
+
* warnings before infos, then ordered by scenario, so the first entry is
|
|
34
|
+
* always the most actionable one.
|
|
35
|
+
*/
|
|
36
|
+
export declare function validateScreenStateGroups(pages: readonly ScreenStateGroupInput[]): ScreenStateGroupDiagnostic[];
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Display-resolution cache for frame screenshots. Captures are taken above
|
|
3
|
+
* 1:1 so zoomed frames stay sharp, but an overview showing every frame keeps
|
|
4
|
+
* the full decoded bitmaps resident — gigabytes for a large storyboard, and
|
|
5
|
+
* the canvas pans like it is buffering. When the camera draws below one
|
|
6
|
+
* device pixel per CSS pixel, frames display a CSS-resolution downscale
|
|
7
|
+
* generated here once per screenshot and cached as an object URL.
|
|
8
|
+
*
|
|
9
|
+
* Generation is best-effort: environments without OffscreenCanvas (server
|
|
10
|
+
* rendering, test realms) simply keep the native bitmap.
|
|
11
|
+
*/
|
|
12
|
+
export declare function subscribeScreenshotBitmaps(listener: () => void): () => void;
|
|
13
|
+
/**
|
|
14
|
+
* The CSS-resolution URL for a screenshot, or null while it generates (or
|
|
15
|
+
* when it cannot be generated) — callers fall back to the native bitmap.
|
|
16
|
+
* `width`/`height` are the frame's CSS dimensions.
|
|
17
|
+
*/
|
|
18
|
+
export declare function getDownscaledScreenshotUrl(key: string, dataUrl: string, width: number, height: number): string | null;
|
|
19
|
+
/** Test seam: forget cached and failed entries (object URLs are revoked). */
|
|
20
|
+
export declare function __resetScreenshotBitmapsForTest(): void;
|