@pygmalionjs/pygmalion 0.7.3 → 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.
Files changed (133) hide show
  1. package/README.ko.md +17 -2
  2. package/README.md +18 -2
  3. package/dist-lib/CameraLayer-nkNrazn8.js +159 -0
  4. package/dist-lib/pygmalion.js +14562 -16919
  5. package/dist-lib/runtime-DdYnT6k4.js +19705 -0
  6. package/dist-lib/style.css +1 -1
  7. package/dist-lib/testing.js +20 -21
  8. package/dist-lib/types/EditorShell.d.ts +1 -1
  9. package/dist-lib/types/canvas/CameraLayer.d.ts +3 -3
  10. package/dist-lib/types/canvas/Canvas.d.ts +2 -2
  11. package/dist-lib/types/canvas/FrameLabelBanner.d.ts +1 -1
  12. package/dist-lib/types/canvas/FrameView.d.ts +8 -2
  13. package/dist-lib/types/canvas/FrozenRoutePreview.d.ts +1 -1
  14. package/dist-lib/types/canvas/InspectOverlay.d.ts +4 -2
  15. package/dist-lib/types/canvas/LightweightCanvas.d.ts +1 -1
  16. package/dist-lib/types/canvas/SectionBoxes.d.ts +1 -1
  17. package/dist-lib/types/canvas/ShadowRoutePreview.d.ts +2 -2
  18. package/dist-lib/types/canvas/useFlowSession.d.ts +1 -1
  19. package/dist-lib/types/canvas/useFrameLod.d.ts +1 -1
  20. package/dist-lib/types/contract/transport.d.ts +5 -5
  21. package/dist-lib/types/contract/types.d.ts +1 -1
  22. package/dist-lib/types/contract/validate.d.ts +3 -3
  23. package/dist-lib/types/core/context.d.ts +2 -2
  24. package/dist-lib/types/core/debug.d.ts +14 -14
  25. package/dist-lib/types/core/hostBindings.d.ts +2 -2
  26. package/dist-lib/types/core/runtime.d.ts +34 -3
  27. package/dist-lib/types/core/runtimeContext.d.ts +3 -3
  28. package/dist-lib/types/core/schedulers.d.ts +67 -0
  29. package/dist-lib/types/editor/assetEditing.d.ts +2 -2
  30. package/dist-lib/types/editor/automaticMotion.d.ts +0 -11
  31. package/dist-lib/types/editor/automaticPseudoStates.d.ts +8 -2
  32. package/dist-lib/types/editor/captureSupply.d.ts +25 -7
  33. package/dist-lib/types/editor/catalog.d.ts +2 -2
  34. package/dist-lib/types/editor/codegen.d.ts +6 -3
  35. package/dist-lib/types/editor/componentConnections.d.ts +13 -8
  36. package/dist-lib/types/editor/componentInstances.d.ts +2 -2
  37. package/dist-lib/types/editor/declarations.d.ts +107 -0
  38. package/dist-lib/types/editor/designCompiler.d.ts +9 -4
  39. package/dist-lib/types/editor/designImport.d.ts +48 -12
  40. package/dist-lib/types/editor/documentSync.d.ts +28 -25
  41. package/dist-lib/types/editor/domImport.d.ts +2 -2
  42. package/dist-lib/types/editor/fiberMap.d.ts +1 -1
  43. package/dist-lib/types/editor/flowSessionScheduler.d.ts +106 -159
  44. package/dist-lib/types/editor/flowSessions.d.ts +147 -84
  45. package/dist-lib/types/editor/frameInteraction.d.ts +22 -32
  46. package/dist-lib/types/editor/frameLabels.d.ts +11 -5
  47. package/dist-lib/types/editor/frameLanes.d.ts +14 -17
  48. package/dist-lib/types/editor/frameLod.d.ts +17 -0
  49. package/dist-lib/types/editor/frameLodRuntime.d.ts +38 -38
  50. package/dist-lib/types/editor/framePreviewKeys.d.ts +14 -5
  51. package/dist-lib/types/editor/frozenImport.d.ts +13 -14
  52. package/dist-lib/types/editor/heldPseudoStates.d.ts +1 -1
  53. package/dist-lib/types/editor/host.d.ts +10 -55
  54. package/dist-lib/types/editor/implementationSourceMap.d.ts +2 -2
  55. package/dist-lib/types/editor/importFidelity.d.ts +1 -1
  56. package/dist-lib/types/editor/inspect.d.ts +7 -2
  57. package/dist-lib/types/editor/interactiveSessionSurface.d.ts +26 -34
  58. package/dist-lib/types/editor/interactiveStates.d.ts +12 -10
  59. package/dist-lib/types/editor/livePreviewInstances.d.ts +13 -3
  60. package/dist-lib/types/editor/liveScreens.d.ts +25 -16
  61. package/dist-lib/types/editor/mountScheduler.d.ts +8 -11
  62. package/dist-lib/types/editor/nodeSelector.d.ts +1 -1
  63. package/dist-lib/types/editor/pendingSourceChanges.d.ts +19 -0
  64. package/dist-lib/types/editor/previewBootstrap.d.ts +12 -22
  65. package/dist-lib/types/editor/previewCaptureProgress.d.ts +10 -6
  66. package/dist-lib/types/editor/previewEnvironmentControls.d.ts +14 -17
  67. package/dist-lib/types/editor/previewIntent.d.ts +11 -16
  68. package/dist-lib/types/editor/previewSweep.d.ts +7 -3
  69. package/dist-lib/types/editor/previewWarmup.d.ts +19 -7
  70. package/dist-lib/types/editor/projectRuntime.d.ts +2 -2
  71. package/dist-lib/types/editor/registry.d.ts +6 -2
  72. package/dist-lib/types/editor/revisionCatalog.d.ts +19 -19
  73. package/dist-lib/types/editor/revisionCatalogInstall.d.ts +18 -17
  74. package/dist-lib/types/editor/routePreview.d.ts +85 -139
  75. package/dist-lib/types/editor/scenarioCoverage.d.ts +52 -20
  76. package/dist-lib/types/editor/screenCards.d.ts +10 -6
  77. package/dist-lib/types/editor/screenDimensions.d.ts +9 -5
  78. package/dist-lib/types/editor/screenFlows.d.ts +8 -5
  79. package/dist-lib/types/editor/screenInteractions.d.ts +9 -1
  80. package/dist-lib/types/editor/screenLists.d.ts +8 -4
  81. package/dist-lib/types/editor/screenStateGroups.d.ts +1 -1
  82. package/dist-lib/types/editor/sectionHeaders.d.ts +10 -6
  83. package/dist-lib/types/editor/sessionPresets.d.ts +12 -32
  84. package/dist-lib/types/editor/shadowPreview.d.ts +7 -10
  85. package/dist-lib/types/editor/sharedSource.d.ts +4 -2
  86. package/dist-lib/types/editor/sourceChangeSummary.d.ts +1 -1
  87. package/dist-lib/types/editor/sourceJournal.d.ts +2 -2
  88. package/dist-lib/types/editor/stateSwitchMetrics.d.ts +68 -82
  89. package/dist-lib/types/editor/store.d.ts +88 -22
  90. package/dist-lib/types/editor/storyboardAuthored.d.ts +2 -2
  91. package/dist-lib/types/editor/storyboardDiscovery.d.ts +4 -3
  92. package/dist-lib/types/editor/storyboardEnvironment.d.ts +9 -5
  93. package/dist-lib/types/editor/storyboardGraph.d.ts +1 -1
  94. package/dist-lib/types/editor/storyboardGraphRuntime.d.ts +8 -10
  95. package/dist-lib/types/editor/storyboardGraphView.d.ts +1 -1
  96. package/dist-lib/types/editor/storyboardJourney.d.ts +1 -1
  97. package/dist-lib/types/editor/surfaceDemands.d.ts +196 -31
  98. package/dist-lib/types/editor/tokens.d.ts +24 -25
  99. package/dist-lib/types/editor/variantAxes.d.ts +70 -0
  100. package/dist-lib/types/editor/variantPrefetch.d.ts +26 -43
  101. package/dist-lib/types/editor/viewportPresets.d.ts +6 -6
  102. package/dist-lib/types/editor/visualQa.d.ts +2 -2
  103. package/dist-lib/types/lib.d.ts +104 -108
  104. package/dist-lib/types/shell/CatalogAssetPanel.d.ts +1 -1
  105. package/dist-lib/types/shell/CodePanel.d.ts +1 -1
  106. package/dist-lib/types/shell/ComponentStateControls.d.ts +7 -53
  107. package/dist-lib/types/shell/FrameInspector.d.ts +17 -0
  108. package/dist-lib/types/shell/FrameReviewDetails.d.ts +28 -0
  109. package/dist-lib/types/shell/LayerTree.d.ts +1 -1
  110. package/dist-lib/types/shell/StoryboardGraphPanel.d.ts +2 -2
  111. package/dist-lib/types/shell/VariantPanel.d.ts +23 -0
  112. package/dist-lib/types/shell/inspectorControls.d.ts +34 -0
  113. package/dist-lib/types/shell/qaPresentation.d.ts +1 -1
  114. package/dist-lib/types/testing.d.ts +5 -6
  115. package/dist-lib/types/ui/SourceRefControl.d.ts +1 -1
  116. package/docs/coverage-contracts.md +431 -0
  117. package/docs/screen-state-contract.md +14 -16
  118. package/node/component-branches.mjs +7 -13
  119. package/node/design-session.mjs +3 -5
  120. package/node/dev-mirror.mjs +9 -6
  121. package/node/envelope.mjs +43 -0
  122. package/node/impact-frames.mjs +94 -0
  123. package/node/inspect-plugin.mjs +12 -6
  124. package/node/preview-artifact-plugin.mjs +3 -9
  125. package/node/qa-capture-plugin.mjs +3 -6
  126. package/node/source-graph.mjs +1 -0
  127. package/node/storyboard-environment.mjs +33 -6
  128. package/node/vite.mjs +1 -0
  129. package/package.json +7 -2
  130. package/dist-lib/CameraLayer-D2wrEPwG.js +0 -415
  131. package/dist-lib/frameLodRuntime-CU0IYaSu.js +0 -272
  132. package/dist-lib/runtime-DRkTU9eq.js +0 -16195
  133. package/dist-lib/types/core/defaultRuntime.d.ts +0 -3
@@ -1,5 +1,9 @@
1
- import type { RegistryPropValue } from './registry';
2
- import type { EditorStore } from './store';
1
+ import type { InteractiveStates } from './interactiveStates.js';
2
+ import type { RegistryPropValue } from './registry.js';
3
+ import { type ScreenCards } from './screenCards.js';
4
+ import { type ScreenLists } from './screenLists.js';
5
+ import type { EditorStore } from './store.js';
6
+ import type { ViewportPresets } from './viewportPresets.js';
3
7
  export type ScenarioCoverageClaim = {
4
8
  scenarioId: string;
5
9
  kind: 'frame';
@@ -85,9 +89,22 @@ export type ScenarioCoverageClaim = {
85
89
  kind: 'todo';
86
90
  reason: string;
87
91
  };
92
+ /**
93
+ * What a diagnostic is about, as a value. `unknown-*` codes name a target
94
+ * the claim referenced that the context does not declare; `target` carries
95
+ * the referenced id so the host joins it back without parsing the message.
96
+ */
97
+ export type ScenarioCoverageDiagnosticCode = 'unknown-scenario' | 'insufficient-reason' | 'unknown-screen' | 'not-a-state-group' | 'unknown-component' | 'unknown-prop' | 'unknown-value' | 'unknown-preset' | 'unknown-axis' | 'unknown-option' | 'base-option' | 'unknown-card' | 'unknown-slot' | 'unknown-list' | 'count-out-of-range' | 'duplicate-claim' | 'unclaimed';
88
98
  export interface ScenarioCoverageDiagnostic {
89
99
  severity: 'error' | 'warning';
100
+ code: ScenarioCoverageDiagnosticCode;
90
101
  scenarioId: string;
102
+ /** The claim's kind, when the diagnostic is about one claim. */
103
+ kind?: ScenarioCoverageClaim['kind'];
104
+ /** The screen the claim named, when it named one. */
105
+ screenId?: string;
106
+ /** The declaration the claim referenced and the context lacks. */
107
+ target?: string;
91
108
  message: string;
92
109
  }
93
110
  export interface ScenarioCoverageContext {
@@ -144,25 +161,40 @@ export interface ScenarioCoverageContext {
144
161
  * prop and value in the registry, preset among the host's declarations.
145
162
  */
146
163
  export declare function validateScenarioCoverage(claims: readonly ScenarioCoverageClaim[], context: ScenarioCoverageContext): ScenarioCoverageDiagnostic[];
164
+ /**
165
+ * Counts by outcome, over the scenario inventory.
166
+ *
167
+ * A scenario is `covered` only when its one claim reproduces a reviewed
168
+ * state and validates clean. `behavior` and `todo` are visible in their own
169
+ * counts and never in `covered` — a todo is an admission, not a
170
+ * verification. A scenario whose claims carry an error (an unknown target,
171
+ * a duplicate) is `invalid`, again never `covered`. Claims naming scenarios
172
+ * the inventory lacks are listed under `unknownIds`; they are outside `total`.
173
+ */
174
+ export interface ScenarioCoverageSummary {
175
+ total: number;
176
+ covered: number;
177
+ behavior: number;
178
+ todo: number;
179
+ invalid: number;
180
+ unclaimed: number;
181
+ behaviorIds: string[];
182
+ todoIds: string[];
183
+ invalidIds: string[];
184
+ unclaimedIds: string[];
185
+ unknownIds: string[];
186
+ }
187
+ export declare function summarizeScenarioCoverage(claims: readonly ScenarioCoverageClaim[], context: ScenarioCoverageContext): ScenarioCoverageSummary;
147
188
  export interface ApplyCoverageResult {
148
189
  status: 'applied' | 'pending-import' | 'failed';
149
190
  message?: string;
150
191
  }
151
- /**
152
- * Reproduces the reviewed state a claim describes, through the same actions
153
- * the panels use: frame/screen-state claims activate the frame (activation
154
- * reveals folded variants), viewport claims apply the preset resize, an
155
- * interactive-state claim flips the axis, card-slot and list-length claims
156
- * edit the imported tree, and component-state claims flip the registry prop
157
- * on the imported instance.
158
- */
159
- export declare function applyScenarioCoverageClaim(editor: EditorStore, claim: ScenarioCoverageClaim): ApplyCoverageResult;
160
- export declare function setScenarioCoverageClaims(claims: readonly ScenarioCoverageClaim[]): void;
161
- export declare function getScenarioCoverageClaims(): readonly ScenarioCoverageClaim[];
162
- /** Claims verified on one screen — the right panel's coverage section. */
163
- export declare function coverageClaimsForScreen(screenId: string): readonly ScenarioCoverageClaim[];
164
- /**
165
- * Scenario ids a component prop control demonstrates on the given screen —
166
- * rendered as chips beside the control so the panel shows WHY it exists.
167
- */
168
- export declare function coverageBadgesForComponentProp(screenId: string, componentName: string, prop: string): readonly string[];
192
+ /** One editor's scenario coverage claims, validated against its other declarations. */
193
+ export declare function createScenarioCoverage(deps: Pick<InteractiveStates, 'getInteractiveStates'> & Pick<ScreenCards, 'getScreenCards'> & Pick<ScreenLists, 'getScreenLists'> & Pick<ViewportPresets, 'getViewportPresets'>): {
194
+ applyScenarioCoverageClaim: (editor: EditorStore, claim: ScenarioCoverageClaim) => ApplyCoverageResult;
195
+ setScenarioCoverageClaims: (claims: readonly ScenarioCoverageClaim[]) => void;
196
+ getScenarioCoverageClaims: () => readonly ScenarioCoverageClaim[];
197
+ coverageClaimsForScreen: (screenId: string) => readonly ScenarioCoverageClaim[];
198
+ coverageBadgesForComponentProp: (screenId: string, componentName: string, prop: string) => readonly string[];
199
+ };
200
+ export type ScenarioCoverage = ReturnType<typeof createScenarioCoverage>;
@@ -1,7 +1,7 @@
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';
1
+ import { type NodeSelector } from './nodeSelector.js';
2
+ import type { ComponentBranch } from './screenDimensions.js';
3
+ import type { RegistryPropValue } from './registry.js';
4
+ import type { NodeModel, PageModel } from './store.js';
5
5
  export interface CardBadgeOption {
6
6
  id: string;
7
7
  /** Panel chip text, and the witness looked for in the product source. */
@@ -97,5 +97,9 @@ export declare function findSlotPlacement(card: NodeModel, slot: CardSlotDef): {
97
97
  } | null;
98
98
  /** Insertion point for an anchored badge, or the end of the slot. */
99
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[];
100
+ /** One editor's declared screen cards. */
101
+ export declare function createScreenCards(): {
102
+ setScreenCards: (defs: readonly ScreenCardDef[]) => void;
103
+ getScreenCards: () => readonly ScreenCardDef[];
104
+ };
105
+ export type ScreenCards = ReturnType<typeof createScreenCards>;
@@ -1,6 +1,6 @@
1
- import { type NodeSelector } from './nodeSelector';
2
- import type { RegistryPropValue } from './registry';
3
- import type { NodeModel, PageModel } from './store';
1
+ import { type NodeSelector } from './nodeSelector.js';
2
+ import type { RegistryPropValue } from './registry.js';
3
+ import type { NodeModel, PageModel } from './store.js';
4
4
  export interface ScreenDimensionOption {
5
5
  label: string;
6
6
  props: Readonly<Record<string, RegistryPropValue>>;
@@ -59,5 +59,9 @@ export declare function findDimensionNode(page: PageModel, dimension: ScreenDime
59
59
  export declare function dimensionPropsForValue(dimension: ScreenDimensionDef, value: string): Readonly<Record<string, RegistryPropValue>> | null;
60
60
  /** Current value of a dimension on a node, or null for the captured state. */
61
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[];
62
+ /** One editor's declared screen dimensions. */
63
+ export declare function createScreenDimensions(): {
64
+ setScreenDimensions: (dimensions: readonly ScreenDimensionDef[]) => void;
65
+ getScreenDimensions: () => readonly ScreenDimensionDef[];
66
+ };
67
+ export type ScreenDimensions = ReturnType<typeof createScreenDimensions>;
@@ -1,4 +1,4 @@
1
- import type { DesignScreenInteraction, StoryboardEnvironment } from './designImport';
1
+ import type { DesignScreenInteraction, StoryboardEnvironment } from './designImport.js';
2
2
  export interface ScreenFlowWaypoint {
3
3
  /** Catalog id of the screen this waypoint materializes (importPageId). */
4
4
  screenId: string;
@@ -43,7 +43,10 @@ export declare function validateScreenFlows(paths: readonly ScreenFlowPath[], sc
43
43
  export declare function orderFlowPaths<T extends {
44
44
  waypoints: readonly ScreenFlowWaypoint[];
45
45
  }>(paths: readonly T[], priorityScreenIds: ReadonlySet<string>): T[];
46
- export declare function setScreenFlows(paths: readonly ScreenFlowPath[]): void;
47
- export declare function getScreenFlows(): readonly ScreenFlowPath[];
48
- /** The path that delivers a screen, or null when no flow claims it. */
49
- export declare function flowPathForScreen(screenId: string): ScreenFlowPath | null;
46
+ /** One editor's declared screen flows. */
47
+ export declare function createScreenFlows(): {
48
+ setScreenFlows: (paths: readonly ScreenFlowPath[]) => void;
49
+ getScreenFlows: () => readonly ScreenFlowPath[];
50
+ flowPathForScreen: (screenId: string) => ScreenFlowPath | null;
51
+ };
52
+ export type ScreenFlows = ReturnType<typeof createScreenFlows>;
@@ -1,4 +1,12 @@
1
- import type { DesignScreenInteraction, DesignScreenInteractionRunOptions, DesignScreenInteractionReport } from './designImport';
1
+ import type { DesignScreenInteraction, DesignScreenInteractionRunOptions, DesignScreenInteractionReport } from './designImport.js';
2
+ /**
3
+ * The pause after an action under the `live` settle policy: enough for the
4
+ * application's handlers and one paint, in place of the authored settle a
5
+ * capture would wait for.
6
+ */
7
+ export declare const LIVE_ACTION_SETTLE_MS = 80;
8
+ /** The most a timer-only wait keeps under the `live` settle policy. */
9
+ export declare const LIVE_TIMER_WAIT_CAP_MS = 250;
2
10
  export declare function settleScreen(iframe: HTMLIFrameElement, settleMs: number): Promise<void>;
3
11
  export declare function elementVisible(element: Element): boolean;
4
12
  export declare function runScreenInteractions(iframe: HTMLIFrameElement, interactions: readonly DesignScreenInteraction[], options?: DesignScreenInteractionRunOptions): Promise<DesignScreenInteractionReport>;
@@ -1,5 +1,5 @@
1
- import { type NodeSelector } from './nodeSelector';
2
- import type { NodeModel, PageModel } from './store';
1
+ import { type NodeSelector } from './nodeSelector.js';
2
+ import type { NodeModel, PageModel } from './store.js';
3
3
  export interface ScreenListDef {
4
4
  id: string;
5
5
  label: string;
@@ -36,5 +36,9 @@ export declare function rowAdvance(parent: NodeModel, item: NodeModel): number;
36
36
  * gains a scrollbar exactly while its content overflows.
37
37
  */
38
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[];
39
+ /** One editor's declared screen lists. */
40
+ export declare function createScreenLists(): {
41
+ setScreenLists: (defs: readonly ScreenListDef[]) => void;
42
+ getScreenLists: () => readonly ScreenListDef[];
43
+ };
44
+ export type ScreenLists = ReturnType<typeof createScreenLists>;
@@ -29,7 +29,7 @@ export interface ScreenStateGroupDiagnostic {
29
29
  * Validates every declared screen-state group among the given pages. Only
30
30
  * pages that actually declare membership participate: a page without a
31
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
32
+ * screen (mirrors the variant panel's gate). Diagnostics come back with
33
33
  * warnings before infos, then ordered by scenario, so the first entry is
34
34
  * always the most actionable one.
35
35
  */
@@ -1,5 +1,5 @@
1
- import { lightenHex } from './bannerStyle';
2
- import type { PageModel } from './store';
1
+ import { lightenHex } from './bannerStyle.js';
2
+ import type { PageModel } from './store.js';
3
3
  export { lightenHex };
4
4
  /** Host-declared description of one canvas section. */
5
5
  export interface SectionHeaderDef {
@@ -111,7 +111,11 @@ export declare const SECTION_HEADER_RESERVE = 176;
111
111
  * measure a reader can take in at once and stops.
112
112
  */
113
113
  export declare const SECTION_HEADER_MAX_WIDTH = 1280;
114
- export declare function setSectionHeaders(defs: readonly SectionHeaderDef[], labels?: SectionHeaderLabels): void;
115
- export declare function getSectionHeaders(): readonly SectionHeaderDef[];
116
- export declare function getSectionHeaderLabels(): SectionHeaderLabels | undefined;
117
- export declare function sectionHeaderFor(section: string): SectionHeaderDef | null;
114
+ /** One editor's declared section headers and their labels. */
115
+ export declare function createSectionHeaders(): {
116
+ setSectionHeaders: (defs: readonly SectionHeaderDef[], labels?: SectionHeaderLabels) => void;
117
+ getSectionHeaders: () => readonly SectionHeaderDef[];
118
+ getSectionHeaderLabels: () => SectionHeaderLabels | undefined;
119
+ sectionHeaderFor: (section: string) => SectionHeaderDef | null;
120
+ };
121
+ export type SectionHeaders = ReturnType<typeof createSectionHeaders>;
@@ -1,4 +1,5 @@
1
- import type { StoryboardEnvironment } from './designImport';
1
+ import type { StoryboardEnvironment } from './designImport.js';
2
+ import type { StoryboardEnvironmentState } from './storyboardEnvironment.js';
2
3
  /**
3
4
  * One runtime the whole catalog can be seen under.
4
5
  *
@@ -31,34 +32,13 @@ export interface SessionPresetDef {
31
32
  /** Tooltip text. */
32
33
  description?: string;
33
34
  }
34
- /**
35
- * Declares the preset list. A malformed entry throws here rather than producing
36
- * a button that silently captures the catalog under nothing — the host
37
- * configures this once at mount.
38
- */
39
- export declare function setSessionPresets(next: readonly SessionPresetDef[]): void;
40
- export declare function getSessionPresets(): SessionPresetDef[];
41
- export declare function getSelectedSessionPreset(): number | null;
42
- /**
43
- * Puts the catalog under one preset, or back under the product's default.
44
- *
45
- * The baseline is what every frame's identity is derived from, so changing it
46
- * is what makes the catalog re-resolve rather than keep showing what was
47
- * captured under the previous runtime — setting it already retires the frames
48
- * held from the runtime before.
49
- */
50
- export declare function selectSessionPreset(index: number | null): void;
51
- export declare function subscribeSessionPresets(listener: () => void): () => void;
52
- /**
53
- * Whether a screen belongs in the runtime currently selected.
54
- *
55
- * A screen that names no runtime exists in all of them — most do, and a product
56
- * that ships one build should not have to say so 75 times. Naming runtimes is
57
- * for the screens that only exist in some: an EMR-linked build has surfaces the
58
- * standalone one cannot reach at all, and showing them side by side reads as a
59
- * catalog of screens that do not exist.
60
- *
61
- * With no preset selected everything shows, because "the product's own default"
62
- * is not a claim about which runtime is running.
63
- */
64
- export declare function isInSelectedSessionPreset(runtimes: readonly string[] | undefined): boolean;
35
+ /** One editor's declared session presets and the selected one, which sets the baseline environment. */
36
+ export declare function createSessionPresets(deps: Pick<StoryboardEnvironmentState, 'setStoryboardBaselineEnvironment'>): {
37
+ setSessionPresets: (next: readonly SessionPresetDef[]) => void;
38
+ getSessionPresets: () => SessionPresetDef[];
39
+ getSelectedSessionPreset: () => number | null;
40
+ selectSessionPreset: (index: number | null) => void;
41
+ subscribeSessionPresets: (listener: () => void) => () => void;
42
+ isInSelectedSessionPreset: (runtimes: readonly string[] | undefined) => boolean;
43
+ };
44
+ export type SessionPresets = ReturnType<typeof createSessionPresets>;
@@ -1,5 +1,4 @@
1
- import type { DesignScreenInteraction } from './designImport';
2
- import type { PreviewMotionMode } from './automaticMotion';
1
+ import type { DesignScreenInteraction } from './designImport.js';
3
2
  export interface PreparedShadowPreview {
4
3
  bodyHtml: string;
5
4
  sharedCssText: string;
@@ -43,19 +42,17 @@ export interface ShadowPreviewHandle {
43
42
  refreshLinkedHeldPseudoCss(): void;
44
43
  /** Reapplies deterministic scroll endpoints after frozen layout settles. */
45
44
  restoreScrollInteractions(): readonly string[];
46
- updateMotion(state: ShadowPreviewMotionState): void;
47
- readMotionProgress(): number | null;
45
+ /**
46
+ * Holds every animation at its capture baseline: finite motion at its end,
47
+ * repeating motion at the start of its cycle. The frozen preview is a still
48
+ * image; a running screen is what a live frame is for.
49
+ */
50
+ settleMotion(): void;
48
51
  updateBodyHtml(bodyHtml: string, baseUrl?: string): void;
49
52
  updateOverrideCss(cssText: string): void;
50
53
  updateSharedCss(cssText: string): void;
51
54
  teardown(): void;
52
55
  }
53
- export interface ShadowPreviewMotionState {
54
- mode: PreviewMotionMode;
55
- progress: number;
56
- seekRevision: number;
57
- target?: Pick<import('./automaticMotion').AutomaticMotionTarget, 'selector' | 'index'>;
58
- }
59
56
  export interface ShadowDomMutation {
60
57
  key: string;
61
58
  selector: string;
@@ -1,4 +1,5 @@
1
- import type { NodeModel, PageModel } from './store';
1
+ import type { SourceEditScope } from './inspect.js';
2
+ import type { NodeModel, PageModel } from './store.js';
2
3
  /**
3
4
  * The smallest unit that connects DOMs rendered multiple times from one source.
4
5
  * - Within the registry component, importPath is used as scope.
@@ -10,7 +11,8 @@ import type { NodeModel, PageModel } from './store';
10
11
  export declare const SHARED_SOURCE_PATCH_KEYS: readonly ["type", "widthMode", "width", "heightMode", "height", "gap", "padding", "justify", "alignItems", "fill", "radius", "borderWidth", "borderColor", "opacity", "fontSize", "fontWeight", "color", "textAlign", "hidden", "text", "componentName", "componentProps", "childrenText", "domAttributes", "domStyle"];
11
12
  export type SharedSourcePatchKey = (typeof SHARED_SOURCE_PATCH_KEYS)[number];
12
13
  export type SharedSourcePatch = Partial<Pick<NodeModel, SharedSourcePatchKey>>;
13
- export type SharedSourceEditScope = 'shared' | 'instance';
14
+ /** Where an edit to a shared component's instance is written; one vocabulary with the source operations. */
15
+ export type SharedSourceEditScope = SourceEditScope;
14
16
  export interface SharedSourceFrameSummary {
15
17
  id: string;
16
18
  name: string;
@@ -1,4 +1,4 @@
1
- import type { InspectApplyPayload } from './inspect';
1
+ import type { InspectApplyPayload } from './inspect.js';
2
2
  /** Number of concrete source mutations represented by an inspect payload. */
3
3
  export declare function sourceChangeCount(payload: InspectApplyPayload): number;
4
4
  /** Changes attributable to one inventory source file. */
@@ -1,5 +1,5 @@
1
- import type { InspectApplyPayload, SourceEditScope, SourceIdentity } from './inspect';
2
- import type { NodeModel, PageModel } from './store';
1
+ import type { InspectApplyPayload, SourceEditScope, SourceIdentity } from './inspect.js';
2
+ import type { NodeModel, PageModel } from './store.js';
3
3
  type JournalNode = Pick<NodeModel, 'id' | 'type' | 'children' | 'domAttributes' | 'sourceStyle' | 'text' | 'gap' | 'padding' | 'justify' | 'alignItems' | 'fill' | 'radius' | 'borderWidth' | 'borderColor' | 'opacity' | 'fontSize' | 'fontWeight' | 'color' | 'textAlign' | 'domStyle' | 'sourceProps'>;
4
4
  type JournalPage = Pick<PageModel, 'id' | 'importPageId' | 'name' | 'root'>;
5
5
  type ParseSourceIdentity = (raw: string | null | undefined) => SourceIdentity | null;
@@ -1,7 +1,5 @@
1
1
  export type StateSwitchPhase = 'boot' | 'replay' | 'settle' | 'stability' | 'serialize' | 'publish';
2
2
  type Clock = () => number;
3
- /** Test hook: replace the phase clock (pass null to restore the default). */
4
- export declare function setStateSwitchMetricsClock(next: Clock | null): void;
5
3
  interface WaypointTiming {
6
4
  screenId: string;
7
5
  replayMs: number | null;
@@ -59,92 +57,80 @@ export interface WalkRecord {
59
57
  };
60
58
  waypoints: WaypointTiming[];
61
59
  }
62
- /** Opens a walk trace; called once per walkPath invocation. */
63
- export declare function beginStateSwitchWalk(runner: string, pathId: string, reused: boolean): StateSwitchWalkTrace;
64
- /** Opens the next waypoint's timing slot and drops any stale phase mark. */
65
- export declare function beginStateSwitchWaypoint(trace: StateSwitchWalkTrace, screenId: string): void;
66
- /** Stamps the start of the next phase; recordStateSwitchPhase reads it. */
67
- export declare function markStateSwitchPhase(trace: StateSwitchWalkTrace): void;
68
60
  /**
69
- * Closes the phase opened by the last mark: attributes the elapsed time to
70
- * the walk (boot) or the current waypoint, and feeds the aggregates. Without
71
- * a preceding mark this records nothing.
61
+ * One editor's state-switch metrics: the walk aggregates per runner, the
62
+ * bounded walk history, and the route-preview producer counters, behind the
63
+ * clock a test can replace. Every runtime owns one; its preview cache and
64
+ * flow-session runners record into it.
72
65
  */
73
- export declare function recordStateSwitchPhase(trace: StateSwitchWalkTrace, phase: StateSwitchPhase): void;
74
- /**
75
- * Closes the walk: bumps the walk counters and pushes one record into the
76
- * bounded history. Safe to call once per trace only; later calls no-op.
77
- */
78
- export declare function endStateSwitchWalk(trace: StateSwitchWalkTrace, completed: boolean): void;
79
- /**
80
- * One producer-gate evaluation. The gate is a pure predicate evaluated per
81
- * frame render, so `allowed` is an upper bound on actual producer starts;
82
- * the byTrigger ratio is the signal (which condition keeps opening the gate).
83
- */
84
- export declare function recordRoutePreviewProducerDecision(input: {
85
- endpointConfigured: boolean;
86
- detailActive: boolean;
87
- previewIntended: boolean;
88
- }): void;
89
- /**
90
- * Plain JSON-safe snapshot for the headless debug surface. `walks.recent` is
91
- * oldest-first and bounded to the last WALK_HISTORY_CAPACITY walks.
92
- */
93
- export declare function getStateSwitchMetricsSnapshot(): {
94
- walks: {
95
- byRunner: {
96
- [k: string]: {
97
- count: number;
98
- completed: number;
99
- coldBoots: number;
100
- warmReuses: number;
101
- stabilityTimeouts: number;
102
- phases: Record<StateSwitchPhase, PhaseAggregate>;
66
+ export declare function createStateSwitchMetrics(): {
67
+ setStateSwitchMetricsClock: (next: Clock | null) => void;
68
+ beginStateSwitchWalk: (runner: string, pathId: string, reused: boolean) => StateSwitchWalkTrace;
69
+ beginStateSwitchWaypoint: (trace: StateSwitchWalkTrace, screenId: string) => void;
70
+ markStateSwitchPhase: (trace: StateSwitchWalkTrace) => void;
71
+ recordStateSwitchPhase: (trace: StateSwitchWalkTrace, phase: StateSwitchPhase) => void;
72
+ endStateSwitchWalk: (trace: StateSwitchWalkTrace, completed: boolean) => void;
73
+ recordRoutePreviewProducerDecision: (input: {
74
+ endpointConfigured: boolean;
75
+ detailActive: boolean;
76
+ previewIntended: boolean;
77
+ }) => void;
78
+ getStateSwitchMetricsSnapshot: () => {
79
+ walks: {
80
+ byRunner: {
81
+ [k: string]: {
82
+ count: number;
83
+ completed: number;
84
+ coldBoots: number;
85
+ warmReuses: number;
86
+ stabilityTimeouts: number;
87
+ phases: Record<StateSwitchPhase, PhaseAggregate>;
88
+ };
103
89
  };
90
+ recent: {
91
+ totals: {
92
+ replayMs: number;
93
+ settleMs: number;
94
+ stabilityMs: number;
95
+ serializeMs: number;
96
+ publishMs: number;
97
+ };
98
+ waypoints: {
99
+ screenId: string;
100
+ replayMs: number | null;
101
+ settleMs: number | null;
102
+ stabilityMs: number | null;
103
+ stabilityTimedOut: boolean;
104
+ serializeMs: number | null;
105
+ publishMs: number | null;
106
+ }[];
107
+ runner: string;
108
+ pathId: string;
109
+ reused: boolean;
110
+ completed: boolean;
111
+ startedAtEpochMs: number;
112
+ totalMs: number;
113
+ bootMs: number | null;
114
+ }[];
115
+ count: number;
116
+ completed: number;
117
+ coldBoots: number;
118
+ warmReuses: number;
119
+ stabilityTimeouts: number;
120
+ phases: Record<StateSwitchPhase, PhaseAggregate>;
104
121
  };
105
- recent: {
106
- totals: {
107
- replayMs: number;
108
- settleMs: number;
109
- stabilityMs: number;
110
- serializeMs: number;
111
- publishMs: number;
122
+ routePreviewProducer: {
123
+ evaluations: number;
124
+ allowed: number;
125
+ suppressed: number;
126
+ byTrigger: {
127
+ endpointNotConfigured: number;
128
+ detailActive: number;
129
+ previewIntended: number;
112
130
  };
113
- waypoints: {
114
- screenId: string;
115
- replayMs: number | null;
116
- settleMs: number | null;
117
- stabilityMs: number | null;
118
- stabilityTimedOut: boolean;
119
- serializeMs: number | null;
120
- publishMs: number | null;
121
- }[];
122
- runner: string;
123
- pathId: string;
124
- reused: boolean;
125
- completed: boolean;
126
- startedAtEpochMs: number;
127
- totalMs: number;
128
- bootMs: number | null;
129
- }[];
130
- count: number;
131
- completed: number;
132
- coldBoots: number;
133
- warmReuses: number;
134
- stabilityTimeouts: number;
135
- phases: Record<StateSwitchPhase, PhaseAggregate>;
136
- };
137
- routePreviewProducer: {
138
- evaluations: number;
139
- allowed: number;
140
- suppressed: number;
141
- byTrigger: {
142
- endpointNotConfigured: number;
143
- detailActive: number;
144
- previewIntended: number;
145
131
  };
146
132
  };
133
+ resetStateSwitchMetrics: () => void;
147
134
  };
148
- /** Drops every counter and the walk history; test and audit boundary hook. */
149
- export declare function resetStateSwitchMetrics(): void;
135
+ export type StateSwitchMetrics = ReturnType<typeof createStateSwitchMetrics>;
150
136
  export {};