@pygmalionjs/pygmalion 0.5.14 → 0.5.15

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 (108) hide show
  1. package/dist-lib/types/App.d.ts +5 -0
  2. package/dist-lib/types/canvas/CameraLayer.d.ts +9 -0
  3. package/dist-lib/types/canvas/Canvas.d.ts +19 -0
  4. package/dist-lib/types/canvas/FrameLabelBanner.d.ts +7 -0
  5. package/dist-lib/types/canvas/FrameView.d.ts +9 -0
  6. package/dist-lib/types/canvas/FrozenRoutePreview.d.ts +12 -0
  7. package/dist-lib/types/canvas/InspectOverlay.d.ts +10 -0
  8. package/dist-lib/types/canvas/LightweightCanvas.d.ts +10 -0
  9. package/dist-lib/types/canvas/ObjectControls.d.ts +22 -0
  10. package/dist-lib/types/canvas/Preview.d.ts +3 -0
  11. package/dist-lib/types/canvas/SectionBoxes.d.ts +24 -0
  12. package/dist-lib/types/canvas/ShadowRoutePreview.d.ts +14 -0
  13. package/dist-lib/types/canvas/StoryboardConnections.d.ts +31 -0
  14. package/dist-lib/types/canvas/cameraPlacement.d.ts +45 -0
  15. package/dist-lib/types/canvas/domTags.d.ts +10 -0
  16. package/dist-lib/types/canvas/layoutContext.d.ts +9 -0
  17. package/dist-lib/types/canvas/useFlowSession.d.ts +36 -0
  18. package/dist-lib/types/canvas/useFrameLod.d.ts +35 -0
  19. package/dist-lib/types/editor/adaptiveFrameLayout.d.ts +67 -0
  20. package/dist-lib/types/editor/assetEditing.d.ts +10 -0
  21. package/dist-lib/types/editor/bannerStyle.d.ts +18 -0
  22. package/dist-lib/types/editor/catalog.d.ts +101 -0
  23. package/dist-lib/types/editor/codegen.d.ts +11 -0
  24. package/dist-lib/types/editor/componentConnections.d.ts +63 -0
  25. package/dist-lib/types/editor/componentInstances.d.ts +27 -0
  26. package/dist-lib/types/editor/contentBounds.d.ts +34 -0
  27. package/dist-lib/types/editor/designCompiler.d.ts +100 -0
  28. package/dist-lib/types/editor/designImport.d.ts +448 -0
  29. package/dist-lib/types/editor/documentSync.d.ts +28 -0
  30. package/dist-lib/types/editor/domImport.d.ts +58 -0
  31. package/dist-lib/types/editor/editModePolicy.d.ts +17 -0
  32. package/dist-lib/types/editor/fiberMap.d.ts +16 -0
  33. package/dist-lib/types/editor/flowSessionScheduler.d.ts +97 -0
  34. package/dist-lib/types/editor/flowSessions.d.ts +137 -0
  35. package/dist-lib/types/editor/frameHeight.d.ts +14 -0
  36. package/dist-lib/types/editor/frameIdentity.d.ts +9 -0
  37. package/dist-lib/types/editor/frameLabels.d.ts +124 -0
  38. package/dist-lib/types/editor/frameLanes.d.ts +62 -0
  39. package/dist-lib/types/editor/frameLod.d.ts +123 -0
  40. package/dist-lib/types/editor/frameLodRuntime.d.ts +64 -0
  41. package/dist-lib/types/editor/framePointerHit.d.ts +67 -0
  42. package/dist-lib/types/editor/framePointerIntent.d.ts +53 -0
  43. package/dist-lib/types/editor/framePreviewChannels.d.ts +26 -0
  44. package/dist-lib/types/editor/framePreviewKeys.d.ts +21 -0
  45. package/dist-lib/types/editor/frameWheelRouting.d.ts +16 -0
  46. package/dist-lib/types/editor/frozenImport.d.ts +70 -0
  47. package/dist-lib/types/editor/host.d.ts +114 -0
  48. package/dist-lib/types/editor/inspect.d.ts +225 -0
  49. package/dist-lib/types/editor/interactiveStates.d.ts +103 -0
  50. package/dist-lib/types/editor/livePreviewInstances.d.ts +93 -0
  51. package/dist-lib/types/editor/liveScreens.d.ts +20 -0
  52. package/dist-lib/types/editor/nodeSelector.d.ts +20 -0
  53. package/dist-lib/types/editor/previewBootstrap.d.ts +189 -0
  54. package/dist-lib/types/editor/previewEnvironmentControls.d.ts +33 -0
  55. package/dist-lib/types/editor/previewHydration.d.ts +5 -0
  56. package/dist-lib/types/editor/previewIntent.d.ts +17 -0
  57. package/dist-lib/types/editor/previewSweep.d.ts +129 -0
  58. package/dist-lib/types/editor/previewWarmup.d.ts +77 -0
  59. package/dist-lib/types/editor/projectBootGate.d.ts +45 -0
  60. package/dist-lib/types/editor/projectRuntime.d.ts +138 -0
  61. package/dist-lib/types/editor/registry.d.ts +38 -0
  62. package/dist-lib/types/editor/routePreview.d.ts +285 -0
  63. package/dist-lib/types/editor/routePreviewArtifactV2.d.ts +34 -0
  64. package/dist-lib/types/editor/routePreviewArtifactV3.d.ts +64 -0
  65. package/dist-lib/types/editor/routePreviewPlacement.d.ts +9 -0
  66. package/dist-lib/types/editor/routePreviewStatus.d.ts +48 -0
  67. package/dist-lib/types/editor/scenarioCoverage.d.ts +167 -0
  68. package/dist-lib/types/editor/screenCards.d.ts +101 -0
  69. package/dist-lib/types/editor/screenDimensions.d.ts +63 -0
  70. package/dist-lib/types/editor/screenFlows.d.ts +47 -0
  71. package/dist-lib/types/editor/screenInteractions.d.ts +4 -0
  72. package/dist-lib/types/editor/screenLists.d.ts +40 -0
  73. package/dist-lib/types/editor/screenStateGroups.d.ts +36 -0
  74. package/dist-lib/types/editor/screenshotBitmaps.d.ts +20 -0
  75. package/dist-lib/types/editor/sectionHeaders.d.ts +117 -0
  76. package/dist-lib/types/editor/shadowPreview.d.ts +103 -0
  77. package/dist-lib/types/editor/sharedSource.d.ts +40 -0
  78. package/dist-lib/types/editor/sourceJournal.d.ts +27 -0
  79. package/dist-lib/types/editor/store.d.ts +838 -0
  80. package/dist-lib/types/editor/storyboardComposition.d.ts +116 -0
  81. package/dist-lib/types/editor/storyboardDiscovery.d.ts +105 -0
  82. package/dist-lib/types/editor/storyboardEnvironment.d.ts +22 -0
  83. package/dist-lib/types/editor/storyboardGraph.d.ts +120 -0
  84. package/dist-lib/types/editor/storyboardGraphRuntime.d.ts +12 -0
  85. package/dist-lib/types/editor/storyboardGraphView.d.ts +104 -0
  86. package/dist-lib/types/editor/surfaceDemands.d.ts +138 -0
  87. package/dist-lib/types/editor/tokens.d.ts +26 -0
  88. package/dist-lib/types/editor/useObserved.d.ts +1 -0
  89. package/dist-lib/types/editor/viewportPresets.d.ts +21 -0
  90. package/dist-lib/types/editor/visualQa.d.ts +50 -0
  91. package/dist-lib/types/lib.d.ts +345 -0
  92. package/dist-lib/types/shell/ApplyPanel.d.ts +1 -0
  93. package/dist-lib/types/shell/AssetsPanel.d.ts +3 -0
  94. package/dist-lib/types/shell/CanvasStatusProbe.d.ts +5 -0
  95. package/dist-lib/types/shell/CodePanel.d.ts +1 -0
  96. package/dist-lib/types/shell/ComponentStateControls.d.ts +108 -0
  97. package/dist-lib/types/shell/ContextMenu.d.ts +1 -0
  98. package/dist-lib/types/shell/LayerTree.d.ts +7 -0
  99. package/dist-lib/types/shell/PropsPanel.d.ts +1 -0
  100. package/dist-lib/types/shell/StoryboardGraphPanel.d.ts +23 -0
  101. package/dist-lib/types/shell/ZoomIndicator.d.ts +4 -0
  102. package/dist-lib/types/shell/qaPresentation.d.ts +9 -0
  103. package/dist-lib/types/testing.d.ts +8 -0
  104. package/dist-lib/types/ui/SourceRefControl.d.ts +38 -0
  105. package/dist-lib/types/ui/icons.d.ts +30 -0
  106. package/package.json +7 -8
  107. package/testing.d.ts +0 -26
  108. package/types.d.ts +0 -2675
package/types.d.ts DELETED
@@ -1,2675 +0,0 @@
1
- // Package public type — used by the host repo's tsc to interpret pygmalion import.
2
- // (lib build doesn't generate d.ts , so keep it by hand — in sync with src/lib.tsx · src/editor/registry.ts )
3
- import type {
4
- ComponentType,
5
- CSSProperties,
6
- ReactElement,
7
- ReactNode,
8
- } from 'react';
9
-
10
- export interface RegistryEntry {
11
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
12
- component: ComponentType<any>;
13
- /** Previewable props. Boolean vocabularies become On/Off controls; other values become selects. */
14
- props?: Record<string, readonly RegistryPropValue[]>;
15
- /** Optional human-readable labels for preview controls. */
16
- propLabels?: Readonly<Record<string, string>>;
17
- /** Default props when inserting. */
18
- defaultProps?: Record<string, RegistryPropValue>;
19
- /** 'text' = children Edit string · 'nodes' = Place canvas nodes as children (Card, etc.). */
20
- children?: 'text' | 'none' | 'nodes';
21
- /**
22
- * Whether a captured screen subtree may be REPLACED by this entry when a
23
- * screen is imported. Declare it only for entries that render the real
24
- * component from literal props — a catalog demo or a fixture-seeded adapter
25
- * draws its own sample content, so collapsing into it swaps the captured
26
- * screen for that sample. Default false.
27
- */
28
- collapsible?: boolean;
29
- /** Static children default values ​​to use when inserting from the palette. */
30
- defaultChildren?: string;
31
- /** Path for generating codegen import statements. */
32
- importPath?: string;
33
- /** In inspection mode, only actually valid dynamic cases are exposed. */
34
- casePreview?: {
35
- /** Whether the text varies in length at runtime, such as user input/API response. */
36
- text?: boolean;
37
- /** A preview of what states the component actually supports. */
38
- states?: readonly ('selected' | 'disabled' | 'loading')[];
39
- };
40
- }
41
-
42
- export type ComponentRegistry = Record<string, RegistryEntry>;
43
- export type RegistryPropValue = string | number | boolean;
44
-
45
- export type DesignConnectionPropertyKind =
46
- | 'text'
47
- | 'boolean'
48
- | 'variant'
49
- | 'instance'
50
- | 'slot';
51
-
52
- export interface DesignComponentReference {
53
- provider: string;
54
- documentId?: string;
55
- nodeId: string;
56
- url?: string;
57
- name?: string;
58
- }
59
-
60
- export interface DesignConnectionPropertyDef {
61
- designName: string;
62
- kind: DesignConnectionPropertyKind;
63
- values?: readonly string[];
64
- defaultValue?: string | boolean;
65
- codeProperty?: string;
66
- valueMap?: Readonly<Record<string, string | boolean>>;
67
- omitReason?: string;
68
- }
69
-
70
- export interface DesignComponentConnectionDef {
71
- id: string;
72
- componentName: string;
73
- design: DesignComponentReference;
74
- code?: { sourcePath?: string; importPath?: string };
75
- properties?: readonly DesignConnectionPropertyDef[];
76
- }
77
-
78
- export interface DesignConnectionDiagnostic {
79
- severity: 'warning' | 'error';
80
- code: string;
81
- message: string;
82
- connectionId: string;
83
- property?: string;
84
- }
85
-
86
- export interface DesignComponentConnectionCase {
87
- id: string;
88
- label: string;
89
- designValues: Readonly<Record<string, string | boolean>>;
90
- codeProps: Readonly<Record<string, string | boolean>>;
91
- }
92
-
93
- export interface DesignComponentConnectionCases {
94
- connectionId: string;
95
- cases: readonly DesignComponentConnectionCase[];
96
- total: number;
97
- truncated: { total: number; limit: number } | null;
98
- diagnostics: readonly DesignConnectionDiagnostic[];
99
- }
100
-
101
- export interface CodegenFrameOptions {
102
- fill?: string;
103
- opacity?: number;
104
- radius?: number;
105
- clipContent?: boolean;
106
- }
107
-
108
- export type DesignCompilePurpose = 'interactive' | 'export';
109
- export type DesignCompileSeverity = 'info' | 'warning' | 'error';
110
- export type DesignCompileStage =
111
- | 'normalize'
112
- | 'analyze'
113
- | 'generate'
114
- | 'resource';
115
- export type DesignCompileStatus = 'ready' | 'deferred' | 'blocked';
116
-
117
- export interface DesignCompileDiagnostic {
118
- severity: DesignCompileSeverity;
119
- stage: DesignCompileStage;
120
- code: string;
121
- message: string;
122
- nodeId?: string;
123
- nodePath?: string;
124
- details?: Readonly<Record<string, string | number | boolean>>;
125
- }
126
-
127
- export interface DesignIRAsset {
128
- id: string;
129
- kind: 'image' | 'video' | 'background';
130
- source: string;
131
- portability: 'embedded' | 'remote' | 'project' | 'ephemeral';
132
- nodeIds: readonly string[];
133
- }
134
-
135
- export interface DesignIRComponent {
136
- name: string;
137
- importPath: string;
138
- registered: boolean;
139
- connectionId?: string;
140
- sourcePath?: string;
141
- design?: {
142
- provider: string;
143
- documentId?: string;
144
- nodeId: string;
145
- url?: string;
146
- };
147
- nodeIds: readonly string[];
148
- }
149
-
150
- export interface DesignIRMetrics {
151
- nodeCount: number;
152
- maxDepth: number;
153
- hiddenNodeCount: number;
154
- componentCount: number;
155
- assetCount: number;
156
- }
157
-
158
- export interface DesignIntermediateDocumentV1 {
159
- schema: 'pygmalion.design-ir';
160
- version: 1;
161
- root: NodeJSON;
162
- frame?: CodegenFrameOptions;
163
- components: readonly DesignIRComponent[];
164
- assets: readonly DesignIRAsset[];
165
- metrics: DesignIRMetrics;
166
- }
167
-
168
- export interface DesignCompileLimits {
169
- previewNodeLimit: number;
170
- maxNodes: number;
171
- maxDepth: number;
172
- maxOutputBytes: number;
173
- }
174
-
175
- export interface DesignCodegenAdapterContext {
176
- document: DesignIntermediateDocumentV1;
177
- }
178
-
179
- export interface DesignCodegenAdapterOutput {
180
- code: string;
181
- diagnostics?: readonly DesignCompileDiagnostic[];
182
- }
183
-
184
- export interface DesignCodegenAdapter {
185
- id: string;
186
- label: string;
187
- language: string;
188
- extension: string;
189
- generate(
190
- context: DesignCodegenAdapterContext,
191
- ): string | DesignCodegenAdapterOutput;
192
- }
193
-
194
- export interface DesignCompileOptions {
195
- target?: string;
196
- purpose?: DesignCompilePurpose;
197
- force?: boolean;
198
- frame?: CodegenFrameOptions;
199
- limits?: Partial<DesignCompileLimits>;
200
- }
201
-
202
- export interface DesignCompileResult {
203
- target: string;
204
- status: DesignCompileStatus;
205
- code: string;
206
- language?: string;
207
- extension?: string;
208
- document: DesignIntermediateDocumentV1;
209
- diagnostics: readonly DesignCompileDiagnostic[];
210
- metrics: DesignIRMetrics & { outputBytes: number };
211
- }
212
-
213
- export const DESIGN_IR_SCHEMA: 'pygmalion.design-ir';
214
- export const DESIGN_IR_VERSION: 1;
215
- export const DEFAULT_DESIGN_COMPILE_LIMITS: Readonly<DesignCompileLimits>;
216
-
217
- export type DesignCatalogKind =
218
- 'icons' | 'design-tokens' | 'atoms' | 'components';
219
-
220
- export interface DesignCatalogItem {
221
- id: string;
222
- name: string;
223
- section: string;
224
- sourcePath?: string;
225
- codeName?: string;
226
- description?: string;
227
- }
228
-
229
- export interface DesignCatalogPageDescriptor {
230
- id: string;
231
- name: string;
232
- section: string;
233
- }
234
-
235
- export interface DesignCatalogFrame {
236
- width: number;
237
- height: number;
238
- }
239
-
240
- export interface DesignCatalogBuild {
241
- registry: ComponentRegistry;
242
- collection: DesignImportCollection;
243
- }
244
-
245
- export interface DesignGalleryCatalogOptions<T extends DesignCatalogItem> {
246
- kind: 'icons' | 'design-tokens';
247
- items: readonly T[];
248
- expectedCount?: number;
249
- pageFor: (item: T) => DesignCatalogPageDescriptor;
250
- renderPreview: (item: T) => ReactNode;
251
- secondaryLabel?: (item: T) => ReactNode;
252
- frame?:
253
- | DesignCatalogFrame
254
- | ((
255
- page: DesignCatalogPageDescriptor,
256
- items: readonly T[],
257
- ) => DesignCatalogFrame);
258
- minimumColumnWidth?: number;
259
- registryPrefix?: string;
260
- }
261
-
262
- export interface DesignComponentCatalogOptions {
263
- kind: 'atoms' | 'components';
264
- items: readonly DesignCatalogItem[];
265
- registry: ComponentRegistry;
266
- expectedCount?: number;
267
- maxVariantCells?: number;
268
- registryPrefix?: string;
269
- }
270
-
271
- export interface DesignComponentVariantMatrix {
272
- row?: readonly [name: string, values: readonly RegistryPropValue[]];
273
- column?: readonly [name: string, values: readonly RegistryPropValue[]];
274
- fixed: readonly (readonly [name: string, value: RegistryPropValue])[];
275
- additional: readonly (readonly [name: string, values: readonly RegistryPropValue[]])[];
276
- }
277
-
278
- export interface PygmalionCatalogDocumentProps {
279
- title: ReactNode;
280
- eyebrow?: ReactNode;
281
- description?: ReactNode;
282
- version?: ReactNode;
283
- meta?: ReactNode;
284
- children: ReactNode;
285
- headerBackground?: string;
286
- headerColor?: string;
287
- bodyBackground?: string;
288
- bodyGap?: number;
289
- }
290
-
291
- export interface PygmalionCatalogSectionProps {
292
- title: ReactNode;
293
- /** Inventory id used to select this item when it is opened from Assets. */
294
- itemId?: string;
295
- count?: number;
296
- description?: ReactNode;
297
- children: ReactNode;
298
- tone?: 'plain' | 'tinted';
299
- }
300
-
301
- export interface PygmalionCatalogMatrixProps {
302
- rows: readonly RegistryPropValue[];
303
- columns: readonly RegistryPropValue[];
304
- cornerLabel?: ReactNode;
305
- renderCell: (row: RegistryPropValue, column: RegistryPropValue) => ReactNode;
306
- renderRowLabel?: (row: RegistryPropValue) => ReactNode;
307
- renderColumnLabel?: (column: RegistryPropValue) => ReactNode;
308
- boundary?: boolean;
309
- cellStyle?: CSSProperties;
310
- }
311
-
312
- export declare function PygmalionCatalogDocument(
313
- props: PygmalionCatalogDocumentProps,
314
- ): ReactElement;
315
- export declare function PygmalionCatalogSection(
316
- props: PygmalionCatalogSectionProps,
317
- ): ReactElement;
318
- export declare function PygmalionCatalogMatrix(
319
- props: PygmalionCatalogMatrixProps,
320
- ): ReactElement;
321
-
322
- export declare function designCatalogKey(value: string): string;
323
- export declare function designCatalogRegistryName(
324
- kind: DesignCatalogKind,
325
- id: string,
326
- prefix?: string,
327
- ): string;
328
- export declare function createDesignGalleryCatalog<T extends DesignCatalogItem>(
329
- options: DesignGalleryCatalogOptions<T>,
330
- ): DesignCatalogBuild;
331
- export declare function createDesignComponentVariantMatrix(
332
- entry: RegistryEntry | undefined,
333
- maxCells?: number,
334
- ): DesignComponentVariantMatrix;
335
- export declare function createDesignComponentCatalog(
336
- options: DesignComponentCatalogOptions,
337
- ): DesignCatalogBuild;
338
-
339
- export interface TokenDef {
340
- /** CSS variable name — e.g. `--app-color-surface-brand`. */
341
- name: string;
342
- /** Value for swatch display (hex, etc., light). Canvas is rendered with var(name). */
343
- value: string;
344
- /** Dark mode value (swatch half-and-half display). */
345
- dark?: string;
346
- group?: string;
347
- }
348
-
349
- export interface ViewportPresetDef {
350
- /** Button text. The panel column is narrow, so keep it to a few characters. */
351
- label: string;
352
- /** Frame width in CSS pixels. */
353
- width: number;
354
- /** Frame height. Omit to resize width only and leave the current height alone. */
355
- height?: number;
356
- /** Tooltip text. Defaults to the dimensions. */
357
- description?: string;
358
- }
359
-
360
- export interface PreviewEnvironmentControlOptionDef {
361
- value: string;
362
- label: string;
363
- description?: string;
364
- environment?: StoryboardEnvironment;
365
- }
366
-
367
- export interface PreviewEnvironmentControlDef {
368
- id: string;
369
- label: string;
370
- description?: string;
371
- defaultValue: string;
372
- options: readonly PreviewEnvironmentControlOptionDef[];
373
- }
374
-
375
- export const DESIGN_IMPORT_KINDS: readonly [
376
- 'icons',
377
- 'design-tokens',
378
- 'atoms',
379
- 'components',
380
- 'screens',
381
- ];
382
- export type DesignImportKind = (typeof DESIGN_IMPORT_KINDS)[number];
383
- export type DesignFrameSizeMode = 'fixed' | 'content';
384
- export type DesignFrameHeightMode = 'fixed' | 'document';
385
-
386
- export interface DesignImportAsset {
387
- id: string;
388
- name: string;
389
- section: string;
390
- pageId: string;
391
- sourcePath?: string;
392
- codeName?: string;
393
- flow?: string;
394
- scenarioId?: string;
395
- description?: string;
396
- }
397
-
398
- export type DesignScreenInteractionAction =
399
- 'click' | 'focus' | 'fill' | 'check' | 'press' | 'wait' | 'storage';
400
-
401
- export interface DesignScreenInteraction {
402
- action: DesignScreenInteractionAction;
403
- label: string;
404
- selector?: string;
405
- text?: string;
406
- exact?: boolean;
407
- index?: number;
408
- /** A wait step observes visible elements by default. Use attached to wait for DOM insertion only. */
409
- waitState?: 'visible' | 'attached';
410
- value?: string;
411
- key?: string;
412
- storage?: 'local' | 'session';
413
- timeoutMs?: number;
414
- settleMs?: number;
415
- optional?: boolean;
416
- }
417
-
418
- export type DesignSerializable =
419
- | string
420
- | number
421
- | boolean
422
- | null
423
- | readonly DesignSerializable[]
424
- | { readonly [key: string]: DesignSerializable };
425
-
426
- export type DesignScreenPreset = Readonly<Record<string, DesignSerializable>>;
427
- export type StoryboardPermissionState = 'granted' | 'denied' | 'prompt';
428
- export type StoryboardMediaFailure =
429
- 'not-allowed' | 'not-found' | 'not-readable' | 'overconstrained';
430
-
431
- export interface StoryboardMediaDevice {
432
- kind: 'audioinput' | 'audiooutput' | 'videoinput';
433
- deviceId: string;
434
- groupId?: string;
435
- label?: string;
436
- }
437
-
438
- export interface StoryboardEnvironment {
439
- localStorage?: Readonly<Record<string, string | null>>;
440
- sessionStorage?: Readonly<Record<string, string | null>>;
441
- permissions?: Readonly<Record<string, StoryboardPermissionState>>;
442
- mediaDevices?: {
443
- devices?: readonly StoryboardMediaDevice[];
444
- getUserMedia?: 'passthrough' | StoryboardMediaFailure;
445
- };
446
- /**
447
- * 'sandbox' virtualizes the whole origin storage for the document: reads
448
- * of undeclared keys see a pristine profile and writes never reach the
449
- * shared storage. Hidden preview instances set it so persisted UI state
450
- * from one walk cannot poison sibling instances or the designer's tab.
451
- */
452
- storageIsolation?: 'sandbox';
453
- /**
454
- * Host screen preset installed as `window.__PYGMALION_SCREEN_PRESET__` before
455
- * application modules execute.
456
- */
457
- screenPreset?: Readonly<Record<string, unknown>>;
458
- /**
459
- * Request outcomes, applied by patching fetch and XMLHttpRequest before
460
- * application modules execute. A failed request, an empty result, a slow
461
- * response — states the product spends real time in that a designer cannot
462
- * click their way into. The host says which request, not how to fake it.
463
- */
464
- network?: StoryboardNetwork;
465
- }
466
-
467
- export type StoryboardRequestOutcome =
468
- | { kind: 'fail'; status?: number; message?: string }
469
- | { kind: 'empty'; status?: number; body?: string }
470
- | { kind: 'slow'; delayMs: number };
471
-
472
- export interface StoryboardRequestCondition {
473
- /** Matched against the request URL as a substring. */
474
- match: string;
475
- method?: string;
476
- outcome: StoryboardRequestOutcome;
477
- }
478
-
479
- export interface StoryboardNetwork {
480
- conditions?: readonly StoryboardRequestCondition[];
481
- }
482
-
483
- export type DesignScreenAssertionVisibility = 'visible' | 'hidden';
484
-
485
- export interface DesignScreenAttributeAssertion {
486
- name: string;
487
- value?: string;
488
- match?: 'equals' | 'contains';
489
- present?: boolean;
490
- }
491
-
492
- export interface DesignScreenAssertion {
493
- label: string;
494
- selector: string;
495
- index?: number;
496
- exists?: boolean;
497
- text?: string;
498
- exact?: boolean;
499
- attribute?: DesignScreenAttributeAssertion;
500
- visibility?: DesignScreenAssertionVisibility;
501
- timeoutMs?: number;
502
- optional?: boolean;
503
- }
504
-
505
- export interface DesignImportPage {
506
- id: string;
507
- name: string;
508
- section: string;
509
- componentName?: string;
510
- gallery?: string[];
511
- route?: string;
512
- path?: string;
513
- publish?: boolean;
514
- width?: number;
515
- height?: number;
516
- /** `content` replaces the 1×1 measurement seed with actual rendered DOM bounds. */
517
- frameSizeMode?: DesignFrameSizeMode;
518
- /** `document` expands the frame to the rendered document height. The default remains a fixed viewport. */
519
- heightMode?: DesignFrameHeightMode;
520
- /** Safety limit used only by document-height frames. Defaults to 12,000px and is capped at 32,000px. */
521
- maxHeight?: number;
522
- flow?: string;
523
- scenario?: string;
524
- state?: string;
525
- /** Host-declared kind of the state branch (overlay, badge, layout, ...). Presentation hint for the Screen states control. */
526
- stateKind?: string;
527
- /** Host-declared situation lane the canvas arranges the frame into. */
528
- lane?: string;
529
- scenarioId?: string;
530
- /** Every scenario the screen demonstrates; coverage counts this set. */
531
- scenarioIds?: readonly string[];
532
- interactions?: readonly DesignScreenInteraction[];
533
- environment?: StoryboardEnvironment;
534
- preset?: DesignScreenPreset;
535
- assertions?: readonly DesignScreenAssertion[];
536
- }
537
-
538
- export interface DesignImportCollection {
539
- assets: readonly DesignImportAsset[];
540
- pages: readonly DesignImportPage[];
541
- expectedCount: number;
542
- }
543
-
544
- export interface DesignScenarioSource {
545
- id: string;
546
- name?: string;
547
- section: string;
548
- flow?: string;
549
- sourcePath?: string;
550
- codeName?: string;
551
- description?: string;
552
- }
553
-
554
- export interface DesignScreenCase extends DesignImportPage {
555
- scenarioIds?: readonly string[];
556
- sourcePath?: string;
557
- codeName?: string;
558
- coverageRoutes?: readonly string[];
559
- /** Names a group of screens that can be captured on one booted page. */
560
- session?: string;
561
- }
562
-
563
- export interface DesignBehaviorScenario {
564
- id: string;
565
- reason: string;
566
- }
567
-
568
- export interface DesignScenarioCoverage {
569
- total: number;
570
- screen: number;
571
- behavior: number;
572
- missing: readonly string[];
573
- complete: boolean;
574
- }
575
-
576
- export interface DesignScreenCollectionResult {
577
- collection: DesignImportCollection;
578
- coverage: DesignScenarioCoverage;
579
- }
580
-
581
- export interface DesignScreenViewport {
582
- id: string;
583
- label: string;
584
- width: number;
585
- height: number;
586
- heightMode?: DesignFrameHeightMode;
587
- maxHeight?: number;
588
- }
589
-
590
- export type DesignScreenViewportPagePatch = Partial<
591
- Omit<DesignImportPage, 'id' | 'name' | 'section' | 'width' | 'height'>
592
- >;
593
-
594
- export interface DesignScreenViewportExpansionOptions {
595
- include?: (page: DesignImportPage, viewport: DesignScreenViewport) => boolean;
596
- transformPage?: (
597
- page: DesignImportPage,
598
- viewport: DesignScreenViewport,
599
- ) => DesignScreenViewportPagePatch | undefined;
600
- createPageId?: (
601
- page: DesignImportPage,
602
- viewport: DesignScreenViewport,
603
- ) => string;
604
- createPageName?: (
605
- page: DesignImportPage,
606
- viewport: DesignScreenViewport,
607
- ) => string;
608
- createSection?: (
609
- page: DesignImportPage,
610
- viewport: DesignScreenViewport,
611
- ) => string;
612
- }
613
-
614
- export interface DesignImportManifest {
615
- sourceSha?: string;
616
- registry: ComponentRegistry;
617
- tokens: readonly TokenDef[];
618
- collections: Record<DesignImportKind, DesignImportCollection>;
619
- }
620
-
621
- export interface DesignImportCoverageItem {
622
- expected: number;
623
- imported: number;
624
- pages: number;
625
- missing: number;
626
- }
627
-
628
- export type DesignImportCoverage = Record<
629
- DesignImportKind,
630
- DesignImportCoverageItem
631
- > & {
632
- sourceSha?: string;
633
- complete: boolean;
634
- };
635
-
636
- export interface DesignScreenInteractionReport {
637
- complete: boolean;
638
- completed: number;
639
- total: number;
640
- failedLabel?: string;
641
- error?: string;
642
- }
643
-
644
- export type DesignScreenCaptureFailureStage =
645
- 'preset' | 'interaction' | 'assertion';
646
- export type DesignScreenCaptureFailureCode =
647
- | 'preset_executor_missing'
648
- | 'preset_rejected'
649
- | 'preset_error'
650
- | 'interaction_failed'
651
- | 'invalid_selector'
652
- | 'existence_mismatch'
653
- | 'text_mismatch'
654
- | 'attribute_mismatch'
655
- | 'visibility_mismatch';
656
-
657
- export interface DesignScreenCaptureFailure {
658
- stage: DesignScreenCaptureFailureStage;
659
- code: DesignScreenCaptureFailureCode;
660
- message: string;
661
- label?: string;
662
- index?: number;
663
- selector?: string;
664
- expected?: DesignSerializable;
665
- actual?: DesignSerializable;
666
- }
667
-
668
- export interface DesignScreenAssertionReport {
669
- complete: boolean;
670
- completed: number;
671
- total: number;
672
- failures: DesignScreenCaptureFailure[];
673
- }
674
-
675
- export interface DesignScreenCaptureReport {
676
- complete: boolean;
677
- presetApplied: boolean;
678
- interactions: DesignScreenInteractionReport;
679
- assertions: DesignScreenAssertionReport;
680
- failures: DesignScreenCaptureFailure[];
681
- failedLabel?: string;
682
- error?: string;
683
- }
684
-
685
- export interface DesignScreenPresetRequest {
686
- pageId: string;
687
- route?: string;
688
- preset: DesignScreenPreset;
689
- }
690
-
691
- export interface DesignScreenPresetContext {
692
- iframe: HTMLIFrameElement;
693
- }
694
-
695
- export interface DesignScreenPresetExecutionResult {
696
- complete: boolean;
697
- message?: string;
698
- details?: DesignSerializable;
699
- }
700
-
701
- export type DesignScreenPresetExecutor = (
702
- request: DesignScreenPresetRequest,
703
- context: DesignScreenPresetContext,
704
- ) =>
705
- | Promise<DesignScreenPresetExecutionResult | void>
706
- | DesignScreenPresetExecutionResult
707
- | void;
708
-
709
- export interface DesignScreenCaptureSpec {
710
- pageId: string;
711
- route?: string;
712
- preset?: DesignScreenPreset;
713
- interactions?: readonly DesignScreenInteraction[];
714
- assertions?: readonly DesignScreenAssertion[];
715
- }
716
-
717
- export interface DesignScreenCaptureDefaults {
718
- preset?: DesignScreenPreset;
719
- assertions?: readonly DesignScreenAssertion[];
720
- }
721
-
722
- export interface DesignScreenCaptureRequirements {
723
- preset?: boolean;
724
- assertions?: boolean;
725
- }
726
-
727
- export interface DomImportOptions {
728
- instanceMode?: 'collapse' | 'expand' | 'ignore';
729
- exclude?: ReadonlySet<string>;
730
- scale?: number;
731
- maxDepth?: number;
732
- maxNodes?: number;
733
- includeHidden?: boolean;
734
- includeZeroSize?: boolean;
735
- mediaMode?: 'placeholder' | 'layers';
736
- }
737
-
738
- export interface NodeJSON {
739
- id: string;
740
- type: 'rows' | 'columns' | 'text' | 'component';
741
- name: string;
742
- widthMode: 'fill' | 'fit' | 'fixed';
743
- width: number;
744
- heightMode: 'fill' | 'fit' | 'fixed';
745
- height: number;
746
- gap: number;
747
- padding: number;
748
- justify: 'start' | 'center' | 'end' | 'between';
749
- alignItems: 'start' | 'center' | 'end';
750
- fill: string;
751
- radius: number;
752
- borderWidth: number;
753
- borderColor: string;
754
- opacity: number;
755
- hidden: boolean;
756
- locked: boolean;
757
- text: string;
758
- fontSize: number;
759
- fontWeight: number;
760
- color: string;
761
- textAlign: 'left' | 'center' | 'right';
762
- componentName: string;
763
- componentProps: Record<string, RegistryPropValue>;
764
- childrenText: string;
765
- domTag: string;
766
- domAttributes: Record<string, string>;
767
- domStyle: Record<string, string>;
768
- sourceComponent?: string;
769
- sourceStyle?: string;
770
- sourceKey?: string;
771
- sourceProps?: Record<string, PrimitiveSourceValue>;
772
- linkTo: string;
773
- children: NodeJSON[];
774
- }
775
-
776
- export interface DomImportResult {
777
- root: NodeJSON;
778
- count: number;
779
- truncated: boolean;
780
- diagnostics: readonly DomImportDiagnostic[];
781
- metrics: DomImportMetrics;
782
- }
783
-
784
- export interface DomImportDiagnostic {
785
- severity: 'warning';
786
- stage: 'capture';
787
- code: 'max-nodes' | 'max-depth';
788
- message: string;
789
- limit: number;
790
- actual: number;
791
- }
792
-
793
- export interface DomImportMetrics {
794
- nodeCount: number;
795
- maxDepth: number;
796
- }
797
-
798
- export type SharedSourceEditScope = 'shared' | 'instance';
799
-
800
- export interface SharedSourceFrameSummary {
801
- id: string;
802
- name: string;
803
- }
804
-
805
- export interface SharedSourceImpact {
806
- sourceKey: string;
807
- frames: SharedSourceFrameSummary[];
808
- nodeCount: number;
809
- }
810
-
811
- export interface DesignImportInitialPage extends InitialPageDef {
812
- importLayers?: boolean;
813
- importPageId?: string;
814
- importKind?: DesignImportKind;
815
- assetIds?: string[];
816
- sourcePaths?: string[];
817
- flow?: string;
818
- scenario?: string;
819
- state?: string;
820
- /** Host-declared kind of the state branch (overlay, badge, layout, ...). Presentation hint for the Screen states control. */
821
- stateKind?: string;
822
- /** Host-declared situation lane the canvas arranges the frame into. */
823
- lane?: string;
824
- scenarioId?: string;
825
- interactions?: DesignScreenInteraction[];
826
- environment?: StoryboardEnvironment;
827
- preset?: DesignScreenPreset;
828
- assertions?: DesignScreenAssertion[];
829
- }
830
-
831
- export interface DesignImportController {
832
- readonly sourceSha?: string;
833
- getRegistry(): ComponentRegistry;
834
- getTokens(): TokenDef[];
835
- getAssets(kind?: DesignImportKind): DesignImportAsset[];
836
- getInitialPages(): DesignImportInitialPage[];
837
- getCoverage(): DesignImportCoverage;
838
- assertComplete(): void;
839
- captureElement(
840
- element: Element,
841
- win?: Window,
842
- options?: DomImportOptions,
843
- ): DomImportResult | null;
844
- captureIframe(
845
- iframe: HTMLIFrameElement,
846
- options?: DomImportOptions,
847
- ): DomImportResult | null;
848
- captureIframeWhenStable(
849
- iframe: HTMLIFrameElement,
850
- options?: DomImportOptions & {
851
- settleMs?: number;
852
- timeoutMs?: number;
853
- minElementCount?: number;
854
- },
855
- ): Promise<DomImportResult | null>;
856
- runScreenInteractions(
857
- iframe: HTMLIFrameElement,
858
- interactions: readonly DesignScreenInteraction[],
859
- ): Promise<DesignScreenInteractionReport>;
860
- prepareScreenCapture(
861
- iframe: HTMLIFrameElement,
862
- spec: DesignScreenCaptureSpec,
863
- ): Promise<DesignScreenCaptureReport>;
864
- }
865
-
866
- export interface CreateDesignImportOptions {
867
- layerOptions?: DomImportOptions;
868
- executeScreenPreset?: DesignScreenPresetExecutor;
869
- /**
870
- * `section` gives each screen section its own canvas
871
- * (`<screens canvas> · <section>`), so the camera, the LOD budget, and
872
- * decoded previews scale with a section instead of the whole catalog.
873
- */
874
- screensCanvasPartition?: 'single' | 'section';
875
- }
876
-
877
- export declare function createDesignImportController(
878
- manifest: DesignImportManifest,
879
- options?: CreateDesignImportOptions,
880
- ): DesignImportController;
881
- export declare function createDesignScreenCollection(options: {
882
- cases: readonly DesignScreenCase[];
883
- scenarios: readonly DesignScenarioSource[];
884
- behaviorScenarios?: readonly DesignBehaviorScenario[];
885
- captureDefaults?: DesignScreenCaptureDefaults;
886
- captureRequirements?: DesignScreenCaptureRequirements;
887
- }): DesignScreenCollectionResult;
888
- export declare function expandDesignScreenCasesViewports(
889
- cases: readonly DesignScreenCase[],
890
- viewports: readonly DesignScreenViewport[],
891
- options?: DesignScreenViewportExpansionOptions,
892
- ): DesignScreenCase[];
893
- export declare function expandDesignScreenCollectionViewports(
894
- collection: DesignImportCollection,
895
- viewports: readonly DesignScreenViewport[],
896
- options?: DesignScreenViewportExpansionOptions,
897
- ): DesignImportCollection;
898
- export declare function mergeScreenPresets(
899
- defaults?: DesignScreenPreset,
900
- override?: DesignScreenPreset,
901
- ): DesignScreenPreset;
902
-
903
- export declare function setComponentRegistry(r: ComponentRegistry): void;
904
- export declare function setDesignComponentConnections(
905
- connections: readonly DesignComponentConnectionDef[],
906
- ): void;
907
- export declare function getDesignComponentConnections(): readonly DesignComponentConnectionDef[];
908
- export declare function getDesignComponentConnection(
909
- connectionId: string,
910
- ): DesignComponentConnectionDef | undefined;
911
- export declare function getDesignComponentConnectionForComponent(
912
- componentName: string,
913
- ): DesignComponentConnectionDef | undefined;
914
- export declare function validateDesignComponentConnections(): readonly DesignConnectionDiagnostic[];
915
- export declare function enumerateDesignComponentConnectionCases(
916
- connectionId: string,
917
- options?: { limit?: number },
918
- ): DesignComponentConnectionCases;
919
- export declare function registerDesignCodegenAdapter(
920
- adapter: DesignCodegenAdapter,
921
- ): () => void;
922
- export declare function getDesignCodegenAdapters(): readonly DesignCodegenAdapter[];
923
- export declare function createDesignIntermediateDocument(
924
- root: NodeJSON,
925
- frame?: CodegenFrameOptions,
926
- ): DesignIntermediateDocumentV1;
927
- export declare function compileDesignDocument(
928
- root: NodeJSON,
929
- options?: DesignCompileOptions,
930
- ): DesignCompileResult;
931
-
932
- export declare function setTokens(t: TokenDef[]): void;
933
-
934
- /** Declares the frame widths the panel offers. A malformed entry throws at mount. */
935
- export declare function setViewportPresets(
936
- presets: readonly ViewportPresetDef[],
937
- ): void;
938
- export declare function getViewportPresets(): ViewportPresetDef[];
939
- export declare function setPreviewEnvironmentControls(
940
- controls: readonly PreviewEnvironmentControlDef[],
941
- ): void;
942
- export declare function getPreviewEnvironmentControls(): readonly PreviewEnvironmentControlDef[];
943
- export declare function getPreviewEnvironmentControlValue(
944
- controlId: string,
945
- ): string | undefined;
946
- export declare function setPreviewEnvironmentControlValue(
947
- controlId: string,
948
- value: string,
949
- ): void;
950
- export declare function clearPreviewEnvironmentControlValues(): void;
951
- export declare function getPreviewEnvironmentOverride(): StoryboardEnvironment | undefined;
952
- export declare function subscribePreviewEnvironmentControls(
953
- listener: () => void,
954
- ): () => void;
955
-
956
- /** Updates the standard route of the running route iframe. The existing editing status is maintained. */
957
- export declare function setPygmalionAppOrigin(origin: string): void;
958
- /** Update the static screen cache when a preview of the same URL points to a new code version. */
959
- export declare function setPygmalionPreviewRevision(revision: string): void;
960
- /** Sets the number of actual app iframes to run simultaneously in the entire editor. */
961
- export declare function setPygmalionPreviewConcurrency(value: number): void;
962
- /** Returns the adaptive live-preview lane count for the current browser. */
963
- export declare function getRecommendedPygmalionPreviewConcurrency(capabilities?: {
964
- hardwareConcurrency?: number;
965
- deviceMemory?: number;
966
- }): number;
967
- /** Removes all route screens fixed in memory and IndexedDB. If a namespace is given, only the corresponding cache is deleted. */
968
- export declare function clearPygmalionPreviewCache(namespace?: string): void;
969
- export declare const STORYBOARD_ENVIRONMENT_QUERY: string;
970
- export declare const STORYBOARD_ENVIRONMENT_CONTROL: string;
971
- export declare function createStoryboardRouteUrl(
972
- appOrigin: string,
973
- route: string,
974
- environment?: StoryboardEnvironment,
975
- ): string;
976
- export declare function setStoryboardBaselineEnvironment(
977
- environment?: StoryboardEnvironment,
978
- ): void;
979
- export declare function getStoryboardBaselineEnvironment():
980
- StoryboardEnvironment | undefined;
981
- export declare function mergeStoryboardEnvironment(
982
- base?: StoryboardEnvironment,
983
- override?: StoryboardEnvironment,
984
- ): StoryboardEnvironment | undefined;
985
-
986
- export interface RoutePreviewArtifactBundleV1 {
987
- version: 1;
988
- namespace: string;
989
- /** Source SHA at the time of creation. It must match the value before the first ':' of runtime previewRevision. */
990
- sourceRevision?: string;
991
- snapshots: Record<string, string>;
992
- }
993
-
994
- export interface RoutePreviewArtifactBundleV2 {
995
- readonly version: 2;
996
- readonly namespace: string;
997
- readonly sourceRevision?: string;
998
- readonly assets: {
999
- readonly head: Readonly<Record<string, string>>;
1000
- readonly stylesheets: Readonly<Record<string, string>>;
1001
- };
1002
- readonly frames: Readonly<
1003
- Record<
1004
- string,
1005
- {
1006
- readonly document: {
1007
- readonly doctype: string;
1008
- readonly htmlAttributes: string;
1009
- readonly headAttributes: string;
1010
- readonly bodyAttributes: string;
1011
- };
1012
- readonly head: readonly {
1013
- readonly kind: 'head' | 'stylesheet';
1014
- readonly hash: string;
1015
- }[];
1016
- readonly body: string;
1017
- }
1018
- >
1019
- >;
1020
- }
1021
-
1022
- export type RoutePreviewArtifactV3Status =
1023
- 'ready' | 'rendered-with-qa-failure' | 'capture-error';
1024
- export type RoutePreviewArtifactV3ScreenshotMediaType =
1025
- 'image/png' | 'image/webp';
1026
-
1027
- export interface RoutePreviewArtifactV3Viewport {
1028
- readonly width: number;
1029
- readonly height: number;
1030
- }
1031
-
1032
- export interface RoutePreviewArtifactV3Diagnostic {
1033
- readonly stage: string;
1034
- readonly code: string;
1035
- readonly selector?: string;
1036
- readonly label?: string;
1037
- readonly message?: string;
1038
- readonly viewport: RoutePreviewArtifactV3Viewport;
1039
- }
1040
-
1041
- export interface RoutePreviewArtifactV3ScreenshotReference {
1042
- readonly hash: `sha256-${string}`;
1043
- readonly mediaType: RoutePreviewArtifactV3ScreenshotMediaType;
1044
- readonly width: number;
1045
- readonly height: number;
1046
- }
1047
-
1048
- export interface RoutePreviewArtifactV3ScreenshotAsset {
1049
- readonly mediaType: RoutePreviewArtifactV3ScreenshotMediaType;
1050
- readonly width: number;
1051
- readonly height: number;
1052
- readonly data: string;
1053
- readonly byteLength: number;
1054
- }
1055
-
1056
- export interface RoutePreviewArtifactV3Frame {
1057
- readonly status: RoutePreviewArtifactV3Status;
1058
- readonly viewport: RoutePreviewArtifactV3Viewport;
1059
- readonly sourceRevision?: string;
1060
- readonly fingerprint?: string;
1061
- readonly snapshot?: RoutePreviewArtifactBundleV2['frames'][string];
1062
- readonly screenshot?: RoutePreviewArtifactV3ScreenshotReference;
1063
- readonly diagnostics: readonly RoutePreviewArtifactV3Diagnostic[];
1064
- }
1065
-
1066
- export interface RoutePreviewArtifactBundleV3 {
1067
- readonly version: 3;
1068
- readonly namespace: string;
1069
- readonly sourceRevision?: string;
1070
- readonly assets: {
1071
- readonly head: RoutePreviewArtifactBundleV2['assets']['head'];
1072
- readonly stylesheets: RoutePreviewArtifactBundleV2['assets']['stylesheets'];
1073
- readonly screenshots: Readonly<
1074
- Record<string, RoutePreviewArtifactV3ScreenshotAsset>
1075
- >;
1076
- };
1077
- readonly frames: Readonly<Record<string, RoutePreviewArtifactV3Frame>>;
1078
- }
1079
-
1080
- export interface RoutePreviewArtifactV3ValidationResult {
1081
- readonly valid: boolean;
1082
- readonly errors: string[];
1083
- readonly bytes: number;
1084
- }
1085
-
1086
- export interface RoutePreviewArtifactV3ReconstructedScreenshot {
1087
- readonly mediaType: RoutePreviewArtifactV3ScreenshotMediaType;
1088
- readonly width: number;
1089
- readonly height: number;
1090
- readonly dataUrl: string;
1091
- }
1092
-
1093
- export type RoutePreviewArtifactBundle =
1094
- | RoutePreviewArtifactBundleV1
1095
- | RoutePreviewArtifactBundleV2
1096
- | RoutePreviewArtifactBundleV3;
1097
-
1098
- export declare function validateRoutePreviewArtifactV3Browser(
1099
- value: unknown,
1100
- ): RoutePreviewArtifactV3ValidationResult;
1101
- export declare function reconstructRoutePreviewArtifactSnapshotV3(
1102
- value: unknown,
1103
- frameId: string,
1104
- ): string | null;
1105
- export declare function reconstructRoutePreviewArtifactScreenshotV3(
1106
- value: unknown,
1107
- frameId: string,
1108
- ): RoutePreviewArtifactV3ReconstructedScreenshot | null;
1109
-
1110
- export interface PreviewRecipeIdentity {
1111
- id: string;
1112
- recipe: unknown;
1113
- }
1114
-
1115
- export interface PreviewCacheNamespaceOptions {
1116
- sourceRevision: string;
1117
- recipes: readonly PreviewRecipeIdentity[];
1118
- recipeVersion?: number;
1119
- scope?: string;
1120
- }
1121
-
1122
- export type StoryboardCaptureRecipeInput = Pick<
1123
- DesignScreenCase,
1124
- | 'route'
1125
- | 'path'
1126
- | 'componentName'
1127
- | 'gallery'
1128
- | 'width'
1129
- | 'height'
1130
- | 'environment'
1131
- | 'preset'
1132
- | 'interactions'
1133
- | 'assertions'
1134
- >;
1135
-
1136
- export interface PreviewArtifactExpectation {
1137
- namespace: string;
1138
- sourceRevision: string;
1139
- }
1140
-
1141
- export interface PreviewArtifactFrameRequest {
1142
- id: string;
1143
- fingerprint?: string;
1144
- }
1145
-
1146
- export interface PreviewArtifactTransportRequest extends PreviewArtifactExpectation {
1147
- signal?: AbortSignal;
1148
- captureBaseUrl?: string;
1149
- /** Frames to fetch. Omitted asks for the whole bundle, as earlier versions did. */
1150
- frames?: readonly PreviewArtifactFrameRequest[];
1151
- /** Set false to seed only what exists instead of capturing what is absent. */
1152
- generate?: boolean;
1153
- }
1154
-
1155
- export type PreviewArtifactTransport = (
1156
- request: PreviewArtifactTransportRequest,
1157
- ) => Promise<unknown | null | undefined>;
1158
-
1159
- export interface PreviewArtifactHttpResponse {
1160
- readonly ok: boolean;
1161
- readonly status?: number;
1162
- readonly statusText?: string;
1163
- json(): Promise<unknown>;
1164
- }
1165
-
1166
- export type PreviewArtifactFetch = (
1167
- input: string,
1168
- init: {
1169
- method: 'GET';
1170
- headers: { accept: 'application/json' };
1171
- cache: 'no-store';
1172
- signal?: AbortSignal;
1173
- },
1174
- ) => Promise<PreviewArtifactHttpResponse>;
1175
-
1176
- export interface PreviewArtifactHttpTransportOptions {
1177
- endpoint: string;
1178
- fetcher?: PreviewArtifactFetch;
1179
- captureBaseUrl?: string;
1180
- }
1181
-
1182
- export type PreviewArtifactValidationReason =
1183
- 'invalid-bundle' | 'namespace-mismatch' | 'revision-mismatch';
1184
-
1185
- export interface PreviewArtifactFrameResolution {
1186
- exact: readonly string[];
1187
- missing: readonly string[];
1188
- stale: readonly string[];
1189
- }
1190
-
1191
- export type PreviewArtifactValidationResult =
1192
- | {
1193
- valid: true;
1194
- artifact: RoutePreviewArtifactBundle;
1195
- errors: readonly [];
1196
- }
1197
- | {
1198
- valid: false;
1199
- artifact: null;
1200
- reason: PreviewArtifactValidationReason;
1201
- errors: readonly string[];
1202
- };
1203
-
1204
- export type PreviewArtifactBootstrapResult =
1205
- | {
1206
- status: 'accepted';
1207
- artifact: RoutePreviewArtifactBundle;
1208
- frameResolution?: PreviewArtifactFrameResolution;
1209
- }
1210
- | {
1211
- status: 'unavailable';
1212
- artifact: null;
1213
- error?: unknown;
1214
- }
1215
- | {
1216
- status: 'rejected';
1217
- artifact: null;
1218
- reason: PreviewArtifactValidationReason;
1219
- errors: readonly string[];
1220
- };
1221
-
1222
- export declare function createPreviewRecipeFingerprint(
1223
- recipes: readonly PreviewRecipeIdentity[],
1224
- ): string;
1225
- export declare function createPreviewFrameFingerprint(
1226
- screen: StoryboardCaptureRecipeInput & { id?: string },
1227
- options?: { dependencyDigest?: string },
1228
- ): string;
1229
- export declare function createPreviewCacheNamespace(
1230
- options: PreviewCacheNamespaceOptions,
1231
- ): string;
1232
- export declare function createStoryboardCaptureRecipeIdentity(
1233
- screen: StoryboardCaptureRecipeInput,
1234
- ): unknown;
1235
- /** The declaration-relevant slice of a page: everything grouping keys off. */
1236
- export interface ScreenStateGroupInput {
1237
- name: string;
1238
- canvas?: string;
1239
- route?: string;
1240
- scenario?: string;
1241
- state?: string;
1242
- width?: number;
1243
- height?: number;
1244
- }
1245
- export interface ScreenStateGroupDiagnostic {
1246
- severity: 'warning' | 'info';
1247
- code: 'mixed-viewport' | 'duplicate-state' | 'cross-canvas' | 'singleton-group';
1248
- scenario: string;
1249
- message: string;
1250
- }
1251
- /**
1252
- * Validates host-declared screen-state groups against the contract the
1253
- * Screen states panel enforces — same canvas, one frame per state label, a
1254
- * shared viewport, at least one sibling. Hosts own membership; the core
1255
- * validates the declaration.
1256
- */
1257
- export declare function validateScreenStateGroups(
1258
- pages: readonly ScreenStateGroupInput[],
1259
- ): ScreenStateGroupDiagnostic[];
1260
- /** One waypoint of a flow path: the screen it materializes and the walk delta reaching it. */
1261
- export interface ScreenFlowWaypoint {
1262
- /** Catalog id of the screen this waypoint materializes (importPageId). */
1263
- screenId: string;
1264
- /** Interactions from the previous waypoint (or the boot) to this screen's state. */
1265
- steps?: readonly DesignScreenInteraction[];
1266
- }
1267
- /**
1268
- * One captureless surface path: a hidden live instance boots `route` with
1269
- * `environment` and walks the waypoints in order, publishing one frozen
1270
- * snapshot per screen. A single-waypoint path is a per-screen recipe; a
1271
- * multi-waypoint path amortizes one boot across a user journey.
1272
- */
1273
- export interface ScreenFlowPath {
1274
- id: string;
1275
- route: string;
1276
- environment?: StoryboardEnvironment;
1277
- waypoints: readonly ScreenFlowWaypoint[];
1278
- }
1279
- export interface ScreenFlowDiagnostic {
1280
- severity: 'error' | 'warning';
1281
- pathId: string;
1282
- message: string;
1283
- }
1284
- /** Structural validation of flow paths against the screen catalog. */
1285
- export declare function validateScreenFlows(
1286
- paths: readonly ScreenFlowPath[],
1287
- screens: readonly { id: string }[],
1288
- ): ScreenFlowDiagnostic[];
1289
- /**
1290
- * Where one QA scenario is verified: a dedicated frame, a folded screen
1291
- * state, a component toggle, a viewport preset, or a declared behavior/todo.
1292
- * Claims are host-declared, core-validated, and executable in the editor.
1293
- */
1294
- export type ScenarioCoverageClaim =
1295
- | { scenarioId: string; kind: 'frame'; screenId: string; reason?: string }
1296
- | { scenarioId: string; kind: 'screen-state'; screenId: string; reason?: string }
1297
- | {
1298
- scenarioId: string;
1299
- kind: 'component-state';
1300
- screenId: string;
1301
- componentName: string;
1302
- prop: string;
1303
- value: RegistryPropValue;
1304
- reason?: string;
1305
- }
1306
- | {
1307
- scenarioId: string;
1308
- kind: 'viewport';
1309
- screenId: string;
1310
- preset: string;
1311
- reason?: string;
1312
- }
1313
- | { scenarioId: string; kind: 'catalog'; screenId: string; reason?: string }
1314
- | {
1315
- scenarioId: string;
1316
- /** A declared interactive axis reaches the scenario in one gesture. */
1317
- kind: 'interactive-state';
1318
- /** InteractiveStateDef id. */
1319
- interaction: string;
1320
- /** InteractiveStateOption id within that axis. */
1321
- option: string;
1322
- screenId: string;
1323
- reason?: string;
1324
- }
1325
- | {
1326
- scenarioId: string;
1327
- /** A badge composition on the screen's repeated card demonstrates it. */
1328
- kind: 'card-slot';
1329
- /** ScreenCardDef id. */
1330
- card: string;
1331
- /** CardSlotDef id within that card. */
1332
- slot: string;
1333
- /** CardBadgeOption id within that slot. */
1334
- option: string;
1335
- screenId: string;
1336
- reason?: string;
1337
- }
1338
- | {
1339
- scenarioId: string;
1340
- /** A row count on the screen's declared list demonstrates it. */
1341
- kind: 'list-length';
1342
- /** ScreenListDef id. */
1343
- list: string;
1344
- count: number;
1345
- screenId: string;
1346
- reason?: string;
1347
- }
1348
- | { scenarioId: string; kind: 'behavior'; reason: string }
1349
- | { scenarioId: string; kind: 'todo'; reason: string };
1350
- export interface ScenarioCoverageDiagnostic {
1351
- severity: 'error' | 'warning';
1352
- scenarioId: string;
1353
- message: string;
1354
- }
1355
- export interface ScenarioCoverageContext {
1356
- scenarios: readonly { id: string }[];
1357
- screens: readonly { id: string; scenario?: string; state?: string }[];
1358
- registry: Readonly<
1359
- Record<string, { props?: Readonly<Record<string, readonly RegistryPropValue[]>> }>
1360
- >;
1361
- viewportPresets: readonly { label: string }[];
1362
- catalogPages?: readonly { id: string }[];
1363
- /** Host-declared interactive axes, for interactive-state claims. */
1364
- interactiveStates?: readonly {
1365
- id: string;
1366
- options: readonly { id: string; steps?: readonly unknown[] }[];
1367
- }[];
1368
- /** Host-declared card compositions, for card-slot claims. */
1369
- screenCards?: readonly {
1370
- id: string;
1371
- slots: readonly { id: string; options: readonly { id: string }[] }[];
1372
- }[];
1373
- /** Host-declared list axes, for list-length claims. */
1374
- screenLists?: readonly { id: string; min?: number; max?: number }[];
1375
- }
1376
- export declare function validateScenarioCoverage(
1377
- claims: readonly ScenarioCoverageClaim[],
1378
- context: ScenarioCoverageContext,
1379
- ): ScenarioCoverageDiagnostic[];
1380
-
1381
- // Surface demands — the editor asks, the host answers. The coverage ledger above
1382
- // checks declarations against declarations; these enumerate what exists, so an
1383
- // undeclared surface is a hole rather than an absence.
1384
- export type SurfaceDemandKind = 'route' | 'control' | 'request';
1385
- export interface SurfaceCandidate {
1386
- kind: SurfaceDemandKind;
1387
- id: string;
1388
- frameId?: string;
1389
- /**
1390
- * Frame-independent form of the same surface. A verdict on this id answers the
1391
- * surface in every frame it appears in; a frame-scoped verdict still wins when
1392
- * the answer differs there.
1393
- */
1394
- matchId?: string;
1395
- detail: string;
1396
- }
1397
- export type SurfaceVerdict =
1398
- | { verdict: 'covered'; by: string }
1399
- | { verdict: 'excluded'; reason: string };
1400
- export type SurfaceClassification = SurfaceVerdict & { id: string };
1401
- export interface SurfaceDemandDiagnostic {
1402
- severity: 'error' | 'warning';
1403
- kind: SurfaceDemandKind | 'unknown';
1404
- candidateId: string;
1405
- message: string;
1406
- }
1407
- export declare const MIN_SURFACE_REASON_LENGTH: number;
1408
- export declare function validateSurfaceDemands(
1409
- candidates: readonly SurfaceCandidate[],
1410
- classifications: readonly SurfaceClassification[],
1411
- ): SurfaceDemandDiagnostic[];
1412
- export declare function unclassifiedSurfaces(
1413
- candidates: readonly SurfaceCandidate[],
1414
- classifications: readonly SurfaceClassification[],
1415
- ): SurfaceCandidate[];
1416
- export interface RouteEnumerationInput {
1417
- routes: readonly { path?: string; id?: string }[];
1418
- declaredScreens: readonly { id: string; route?: string }[];
1419
- }
1420
- export declare function enumerateRouteCandidates(
1421
- input: RouteEnumerationInput,
1422
- ): SurfaceCandidate[];
1423
- export interface ControlNodeLike {
1424
- id: string;
1425
- domTag?: string;
1426
- domAttributes?: Readonly<Record<string, string>>;
1427
- hidden?: boolean;
1428
- }
1429
- export declare function enumerateControlCandidates(
1430
- frameId: string,
1431
- nodes: readonly ControlNodeLike[],
1432
- ): SurfaceCandidate[];
1433
- export interface ObservedRequest {
1434
- url: string;
1435
- method?: string;
1436
- }
1437
- export declare function requestEndpointShape(url: string): string;
1438
- export declare function enumerateRequestCandidates(
1439
- frameId: string,
1440
- requests: readonly ObservedRequest[],
1441
- ): SurfaceCandidate[];
1442
- export declare function setSurfaceClassifications(
1443
- classifications: readonly SurfaceClassification[] | undefined,
1444
- ): void;
1445
- export declare function getSurfaceClassifications(): readonly SurfaceClassification[];
1446
- export declare function setObservedRequests(
1447
- frameId: string,
1448
- requests: readonly ObservedRequest[],
1449
- ): void;
1450
- export declare function getObservedRequests(
1451
- frameId: string,
1452
- ): readonly ObservedRequest[];
1453
- export interface FrameSurfaceDemands {
1454
- candidates: SurfaceCandidate[];
1455
- unclassified: SurfaceCandidate[];
1456
- }
1457
- export declare function frameSurfaceDemands(
1458
- frameId: string,
1459
- root?: (ControlNodeLike & { children?: readonly ControlNodeLike[] }) | null,
1460
- classifications?: readonly SurfaceClassification[],
1461
- ): FrameSurfaceDemands;
1462
- /** One discovered conditional-render branch from the component scanner. */
1463
- export interface ComponentBranch {
1464
- kind: 'conditional' | 'enum';
1465
- condition: string;
1466
- element?: string;
1467
- renders?: string;
1468
- values?: readonly string[];
1469
- line?: number;
1470
- }
1471
- export interface ScreenDimensionOption {
1472
- label: string;
1473
- props: Readonly<Record<string, RegistryPropValue>>;
1474
- }
1475
- /**
1476
- * Points at captured markup by a test id or css-module class prefix. A list
1477
- * of prefixes matches any one of them, which lets a single axis cover
1478
- * sibling elements the product renders from different branches.
1479
- */
1480
- export interface NodeSelector {
1481
- testId?: string;
1482
- classIncludes?: string | readonly string[];
1483
- }
1484
- /**
1485
- * A curated right-panel control that swaps a captured piece's state by
1486
- * adopting the matched node into a registry adapter instance.
1487
- */
1488
- export interface ScreenDimensionDef {
1489
- id: string;
1490
- label: string;
1491
- component: string;
1492
- prop?: string;
1493
- options?: readonly ScreenDimensionOption[];
1494
- match: NodeSelector;
1495
- /**
1496
- * 'first' (default) drives the one piece a screen shows once; 'each'
1497
- * opens a control per match, which is what a list of rows needs.
1498
- */
1499
- sourcePath?: string;
1500
- }
1501
- export interface ScreenDimensionDiagnostic {
1502
- severity: 'error' | 'warning';
1503
- dimensionId: string;
1504
- message: string;
1505
- }
1506
- export declare function validateScreenDimensions(
1507
- dimensions: readonly ScreenDimensionDef[],
1508
- context: {
1509
- registry: Readonly<
1510
- Record<string, { props?: Readonly<Record<string, readonly RegistryPropValue[]>> }>
1511
- >;
1512
- scansBySource?: Readonly<Record<string, readonly ComponentBranch[]>>;
1513
- },
1514
- ): ScreenDimensionDiagnostic[];
1515
- /**
1516
- * A repeating list whose row count becomes a right-panel control. Growing
1517
- * clones the last row (identical on purpose — the per-row dimension
1518
- * controls are what make rows differ); shrinking drops trailing rows. It
1519
- * edits the captured tree, so it applies instantly and undoes in one step.
1520
- */
1521
- export interface ScreenListDef {
1522
- id: string;
1523
- label: string;
1524
- container: NodeSelector;
1525
- item: NodeSelector;
1526
- /** Fewest rows the control offers. Default 0. */
1527
- min?: number;
1528
- /** Most rows the control offers. Default 12. */
1529
- max?: number;
1530
- }
1531
- export interface ScreenListDiagnostic {
1532
- severity: 'error' | 'warning';
1533
- listId: string;
1534
- message: string;
1535
- }
1536
- export declare function validateScreenLists(
1537
- defs: readonly ScreenListDef[],
1538
- ): ScreenListDiagnostic[];
1539
- /**
1540
- * One badge a card slot may hold. `match` recognizes the captured element;
1541
- * `component`/`props` build it from the registry when the screen has no
1542
- * captured instance to clone; `anchor` is its fixed position in the slot.
1543
- */
1544
- export interface CardBadgeOption {
1545
- id: string;
1546
- label: string;
1547
- component: string;
1548
- props: Readonly<Record<string, RegistryPropValue>>;
1549
- match: NodeSelector;
1550
- anchor?: { before?: NodeSelector; after?: NodeSelector };
1551
- }
1552
- /** A region of a card with its own vocabulary and capacity. */
1553
- export interface CardSlotDef {
1554
- id: string;
1555
- label: string;
1556
- container: NodeSelector;
1557
- /** 'multiple' (the default) when the product can show several at once. */
1558
- arity?: 'single' | 'multiple';
1559
- /** The product renders the container only when it has content. */
1560
- hideWhenEmpty?: boolean;
1561
- /** Where to create the container on a card that lacks one. */
1562
- placement?: { parent: NodeSelector; before?: NodeSelector; after?: NodeSelector };
1563
- options: readonly CardBadgeOption[];
1564
- }
1565
- /**
1566
- * The badge composition of a repeated card, declared the way the component
1567
- * is built: slots, what each may hold, how many at once.
1568
- */
1569
- export interface ScreenCardDef {
1570
- id: string;
1571
- label: string;
1572
- card: NodeSelector;
1573
- slots: readonly CardSlotDef[];
1574
- sourcePath?: string;
1575
- }
1576
- export interface ScreenCardDiagnostic {
1577
- severity: 'error' | 'warning';
1578
- cardId: string;
1579
- message: string;
1580
- }
1581
- export declare function validateScreenCards(
1582
- defs: readonly ScreenCardDef[],
1583
- context: {
1584
- registry: Readonly<
1585
- Record<string, { props?: Readonly<Record<string, readonly RegistryPropValue[]>> }>
1586
- >;
1587
- scansBySource?: Readonly<Record<string, readonly ComponentBranch[]>>;
1588
- },
1589
- ): ScreenCardDiagnostic[];
1590
- /**
1591
- * An axis a screen reaches by acting on it (folding the sidebar, hovering a
1592
- * row) rather than by being a separate captured frame. Selecting an option
1593
- * appends its steps to the frame's recipe, so the ordinary supply produces
1594
- * the variant.
1595
- */
1596
- export interface InteractiveStateOption {
1597
- id: string;
1598
- label: string;
1599
- /** Absent or empty marks the base state — the screen as captured. */
1600
- steps?: readonly DesignScreenInteraction[];
1601
- /**
1602
- * Boot condition for states no gesture can reach — a failed request, an empty
1603
- * result, a stalled stream. Merged into the frame's environment, which already
1604
- * belongs to the recipe identity, so the existing supply path reproduces it.
1605
- * The base is the option with neither steps nor a condition.
1606
- */
1607
- environment?: StoryboardEnvironment;
1608
- /**
1609
- * Recognizes this option in the CAPTURED tree, making the base a property of
1610
- * the frame instead of the axis. Declare it on every option (each with its own
1611
- * steps) when the frames an axis covers were captured in different states —
1612
- * otherwise the axis is a no-op wherever the capture is not the declared base.
1613
- */
1614
- capturedWhen?: { testId: string; attribute?: { name: string; value: string } };
1615
- }
1616
- export interface InteractiveStateDef {
1617
- id: string;
1618
- label: string;
1619
- /** Frames the axis applies to: exact route and/or a test id in the tree. */
1620
- requires?: { testId?: string; route?: string };
1621
- options: readonly InteractiveStateOption[];
1622
- }
1623
- export interface InteractiveStateDiagnostic {
1624
- severity: 'error' | 'warning';
1625
- interactionId: string;
1626
- message: string;
1627
- }
1628
- export declare function validateInteractiveStates(
1629
- defs: readonly InteractiveStateDef[],
1630
- ): InteractiveStateDiagnostic[];
1631
- /**
1632
- * Host-declared description of one canvas section — the band above its box.
1633
- * The core counts frames, folded variants, scenarios and viewport itself.
1634
- */
1635
- /**
1636
- * A situation group within one section. Declaration order is lane order, and
1637
- * one lane is one row of the canvas — the axis that replaces area packing so
1638
- * an arrangement reads as the product's structure.
1639
- */
1640
- export interface ScreenLaneDef {
1641
- /** Unique within its section. */
1642
- id: string;
1643
- /** Human-readable, drawn as the lane caption. */
1644
- label: string;
1645
- /** Section name exactly as the frames carry it. */
1646
- section: string;
1647
- /** Caption rule colour (hex). Defaults to a neutral. */
1648
- accent?: string;
1649
- }
1650
- export interface ScreenLaneDiagnostic {
1651
- severity: 'error' | 'warning';
1652
- laneId: string;
1653
- message: string;
1654
- }
1655
- export declare function validateScreenLanes(
1656
- lanes: readonly ScreenLaneDef[],
1657
- context?: { sections?: readonly string[] },
1658
- ): ScreenLaneDiagnostic[];
1659
- export interface SectionHeaderDef {
1660
- /** Section name exactly as the frames carry it — the join key. */
1661
- section: string;
1662
- /** Short handle shown large, e.g. "02". */
1663
- code: string;
1664
- /** Section title. */
1665
- title: string;
1666
- /** Secondary clause after the title: what kind of group this is. */
1667
- kind?: string;
1668
- /** One line a planner needs: what the section covers. */
1669
- purpose: string;
1670
- /** Accent colour (hex) for the rule and the category pill. */
1671
- accent: string;
1672
- /** Category shown in the pill. */
1673
- pill?: string;
1674
- }
1675
- /** Words for the facts a section header counts. Defaults are English. */
1676
- export interface SectionHeaderLabels {
1677
- code?: string;
1678
- frames?: string;
1679
- folded?: string;
1680
- scenarios?: string;
1681
- flows?: string;
1682
- }
1683
- export interface SectionHeaderDiagnostic {
1684
- severity: 'error' | 'warning';
1685
- section: string;
1686
- message: string;
1687
- }
1688
- export interface SectionHeaderFacts {
1689
- frameCount: number;
1690
- foldedCount: number;
1691
- scenarioCount: number;
1692
- flows: string[];
1693
- viewport: string | null;
1694
- }
1695
- export declare function validateSectionHeaders(
1696
- defs: readonly SectionHeaderDef[],
1697
- context: { sections: readonly string[] },
1698
- ): SectionHeaderDiagnostic[];
1699
- /**
1700
- * Presentation of one branch kind a frame label can carry: a state kind the
1701
- * catalog declares, or the core's own `step` (a plain screen) and `variant`
1702
- * (a numbered branch that declares no state kind).
1703
- */
1704
- export interface FrameBranchKindDef {
1705
- kind: string;
1706
- /** Word shown in the label's pill. */
1707
- label: string;
1708
- /** Accent colour for the rule and the pill text. */
1709
- accent: string;
1710
- }
1711
- /** Words for the facts a frame label counts. English by default. */
1712
- export interface FrameLabelLabels {
1713
- layers?: string;
1714
- noScenario?: string;
1715
- omissions?: string;
1716
- checkFlow?: string;
1717
- }
1718
- export interface FrameBranchKindDiagnostic {
1719
- severity: 'error' | 'warning';
1720
- kind: string;
1721
- message: string;
1722
- }
1723
- export declare function validateFrameBranchKinds(
1724
- defs: readonly FrameBranchKindDef[],
1725
- context?: { stateKinds?: readonly string[] },
1726
- ): FrameBranchKindDiagnostic[];
1727
- /** Screen frames claiming no scenario at all — the holes in the ledger. */
1728
- export declare function framesMissingScenario(
1729
- pages: readonly { route?: string; scenarioId?: string; scenarioIds?: readonly string[] }[],
1730
- ): readonly { name: string; section?: string }[];
1731
- export interface ApplyCoverageResult {
1732
- status: 'applied' | 'pending-import' | 'failed';
1733
- message?: string;
1734
- }
1735
- /** Reproduces the reviewed state a claim describes inside the editor. */
1736
- export declare function applyScenarioCoverageClaim(
1737
- claim: ScenarioCoverageClaim,
1738
- ): ApplyCoverageResult;
1739
- export declare function createPreviewArtifactHttpTransport(
1740
- options: PreviewArtifactHttpTransportOptions,
1741
- ): PreviewArtifactTransport;
1742
- export declare function validatePreviewArtifactBundle(
1743
- value: unknown,
1744
- expectation?: PreviewArtifactExpectation,
1745
- options?: { perFrameIdentity?: boolean },
1746
- ): PreviewArtifactValidationResult;
1747
- export declare function resolvePreviewArtifactFrames(
1748
- artifact: RoutePreviewArtifactBundle,
1749
- expectation: PreviewArtifactExpectation,
1750
- frames: readonly PreviewArtifactFrameRequest[],
1751
- ): PreviewArtifactFrameResolution;
1752
- export declare function bootstrapPreviewArtifact(
1753
- options: PreviewArtifactExpectation & {
1754
- transport: PreviewArtifactTransport;
1755
- signal?: AbortSignal;
1756
- frames?: readonly PreviewArtifactFrameRequest[];
1757
- generate?: boolean;
1758
- },
1759
- ): Promise<PreviewArtifactBootstrapResult>;
1760
-
1761
- export type StoryboardGraphEdgeOrigin = 'explicit' | 'inferred';
1762
-
1763
- export interface StoryboardGraphEdgeInput {
1764
- id?: string;
1765
- from: string;
1766
- to: string;
1767
- /** Screen or node identities that inherit this outgoing route connection. */
1768
- fromScope?: readonly string[];
1769
- /** Screen or node identities that inherit this incoming route connection. */
1770
- toScope?: readonly string[];
1771
- kind?: string;
1772
- label?: string;
1773
- }
1774
-
1775
- export interface StoryboardPathInput {
1776
- /** Stable author-owned identity used as the edge id prefix. */
1777
- id: string;
1778
- /** Ordered screen ids visited by this path. */
1779
- screenIds: readonly string[];
1780
- kind?: string;
1781
- label?: string;
1782
- }
1783
-
1784
- export interface StoryboardDefinition {
1785
- paths?: readonly StoryboardPathInput[];
1786
- edges?: readonly StoryboardGraphEdgeInput[];
1787
- startScreenIds?: readonly string[];
1788
- nonVisualScenarioIds?: readonly string[];
1789
- }
1790
-
1791
- export declare function createStoryboardPathEdges(
1792
- paths: readonly StoryboardPathInput[],
1793
- ): StoryboardGraphEdgeInput[];
1794
-
1795
- export interface StoryboardGraphBuildOptions {
1796
- screens: readonly DesignScreenCase[];
1797
- assets?: readonly DesignImportAsset[];
1798
- scenarios?: readonly DesignScenarioSource[];
1799
- explicitEdges?: readonly StoryboardGraphEdgeInput[];
1800
- inferredEdges?: readonly StoryboardGraphEdgeInput[];
1801
- startScreenIds?: readonly string[];
1802
- nonVisualScenarioIds?: readonly string[];
1803
- recipeKey?: (screen: DesignScreenCase) => string;
1804
- }
1805
-
1806
- export interface StoryboardGraphNode {
1807
- id: string;
1808
- canonicalScreenId: string;
1809
- screenIds: readonly string[];
1810
- names: readonly string[];
1811
- recipeKey: string;
1812
- routes: readonly string[];
1813
- scenarioIds: readonly string[];
1814
- sourceKeys: readonly string[];
1815
- flows: readonly string[];
1816
- states: readonly string[];
1817
- }
1818
-
1819
- export interface StoryboardGraphEdge {
1820
- id: string;
1821
- from: string;
1822
- to: string;
1823
- /** Canonical nodes that expose this edge as an outgoing connection. */
1824
- fromNodeIds?: readonly string[];
1825
- /** Canonical nodes that expose this edge as an incoming connection. */
1826
- toNodeIds?: readonly string[];
1827
- kind?: string;
1828
- label?: string;
1829
- origin: StoryboardGraphEdgeOrigin;
1830
- sourceEdgeIds: readonly string[];
1831
- }
1832
-
1833
- export interface StoryboardGraphSourceGroup {
1834
- sourceKey: string;
1835
- nodeIds: readonly string[];
1836
- screenIds: readonly string[];
1837
- shared: boolean;
1838
- }
1839
-
1840
- export interface StoryboardGraphBranch {
1841
- nodeId: string;
1842
- edgeIds: readonly string[];
1843
- targetNodeIds: readonly string[];
1844
- }
1845
-
1846
- export type StoryboardGraphWarningCode =
1847
- | 'duplicate-screen-id'
1848
- | 'invalid-recipe'
1849
- | 'unknown-edge-source'
1850
- | 'unknown-edge-target'
1851
- | 'ambiguous-edge-source'
1852
- | 'ambiguous-edge-target'
1853
- | 'unknown-start-screen'
1854
- | 'disconnected-screen'
1855
- | 'missing-code-scenario';
1856
-
1857
- export interface StoryboardGraphWarning {
1858
- code: StoryboardGraphWarningCode;
1859
- severity: 'warning' | 'error';
1860
- message: string;
1861
- screenId?: string;
1862
- nodeId?: string;
1863
- edgeId?: string;
1864
- scenarioId?: string;
1865
- }
1866
-
1867
- export interface StoryboardGraphCoverage {
1868
- screens: number;
1869
- canonicalNodes: number;
1870
- mergedScreens: number;
1871
- edges: number;
1872
- connectedNodes: number;
1873
- disconnectedScreens: readonly string[];
1874
- codeScenarios: number;
1875
- representedScenarios: number;
1876
- missingScenarios: readonly string[];
1877
- complete: boolean;
1878
- }
1879
-
1880
- export interface StoryboardGraph {
1881
- version: 1;
1882
- nodes: readonly StoryboardGraphNode[];
1883
- edges: readonly StoryboardGraphEdge[];
1884
- aliases: Readonly<Record<string, string>>;
1885
- sourceGroups: readonly StoryboardGraphSourceGroup[];
1886
- startNodeIds: readonly string[];
1887
- branches: readonly StoryboardGraphBranch[];
1888
- warnings: readonly StoryboardGraphWarning[];
1889
- coverage: StoryboardGraphCoverage;
1890
- }
1891
-
1892
- export declare function storyboardScreenRecipeKey(
1893
- screen: DesignScreenCase,
1894
- ): string;
1895
- export declare function createStoryboardGraph(
1896
- options: StoryboardGraphBuildOptions,
1897
- ): StoryboardGraph;
1898
-
1899
- export interface StoryboardFrameReference {
1900
- frameId: string;
1901
- screenId: string;
1902
- name: string;
1903
- }
1904
-
1905
- export interface StoryboardGraphFrameView {
1906
- frameId: string;
1907
- screenId: string;
1908
- name: string;
1909
- nodeId: string;
1910
- canonicalScreenId: string;
1911
- canonicalFrameId?: string;
1912
- isCanonical: boolean;
1913
- isStart: boolean;
1914
- isBranch: boolean;
1915
- routes: readonly string[];
1916
- flows: readonly string[];
1917
- states: readonly string[];
1918
- depth?: number;
1919
- aliasScreenIds: readonly string[];
1920
- relatedFrameIds: readonly string[];
1921
- branchTargetFrameIds: readonly string[];
1922
- incomingTransitions: readonly StoryboardGraphTransitionView[];
1923
- outgoingTransitions: readonly StoryboardGraphTransitionView[];
1924
- warnings: readonly StoryboardGraphWarning[];
1925
- }
1926
-
1927
- export interface StoryboardGraphTransitionView {
1928
- edgeId: string;
1929
- sourceFrameId: string;
1930
- targetFrameId: string;
1931
- label?: string;
1932
- kind?: string;
1933
- origin: StoryboardGraphEdgeOrigin;
1934
- }
1935
-
1936
- export interface StoryboardGraphCanonicalView {
1937
- nodeId: string;
1938
- canonicalScreenId: string;
1939
- canonicalFrameId?: string;
1940
- aliasScreenIds: readonly string[];
1941
- aliasFrameIds: readonly string[];
1942
- }
1943
-
1944
- export interface StoryboardGraphSourceView {
1945
- sourceKey: string;
1946
- frameIds: readonly string[];
1947
- nodeIds: readonly string[];
1948
- }
1949
-
1950
- export interface StoryboardGraphViewModel {
1951
- frames: readonly StoryboardGraphFrameView[];
1952
- canonicalGroups: readonly StoryboardGraphCanonicalView[];
1953
- sharedSources: readonly StoryboardGraphSourceView[];
1954
- startFrameIds: readonly string[];
1955
- branchFrameIds: readonly string[];
1956
- warnings: readonly StoryboardGraphWarning[];
1957
- unresolvedWarnings: readonly StoryboardGraphWarning[];
1958
- coverage: StoryboardGraphCoverage;
1959
- }
1960
-
1961
- export declare function createStoryboardGraphViewModel(
1962
- graph: StoryboardGraph,
1963
- frameReferences: readonly StoryboardFrameReference[],
1964
- ): StoryboardGraphViewModel;
1965
- export declare function setStoryboardGraph(graph: StoryboardGraph | null): void;
1966
- export declare function getStoryboardGraph(): StoryboardGraph | null;
1967
- export declare function subscribeStoryboardGraph(
1968
- listener: () => void,
1969
- ): () => void;
1970
-
1971
- export interface StoryboardDiscoveryScenario {
1972
- id?: string;
1973
- name?: string;
1974
- section?: string;
1975
- flow?: string;
1976
- sourcePath?: string;
1977
- description?: string;
1978
- environment?: StoryboardEnvironment;
1979
- }
1980
-
1981
- export interface StoryboardDiscoveryCandidate {
1982
- id?: string;
1983
- route?: string;
1984
- scenarioId?: string;
1985
- environment?: StoryboardEnvironment;
1986
- }
1987
-
1988
- export interface StoryboardDiscoveryEdge {
1989
- id?: string;
1990
- from?: string;
1991
- to?: string;
1992
- kind?: string;
1993
- label?: string;
1994
- unresolvedTarget?: boolean;
1995
- }
1996
-
1997
- export interface StoryboardDiscoveryRoute {
1998
- id?: string;
1999
- path?: string;
2000
- }
2001
-
2002
- export interface StoryboardDiscoveryManifest {
2003
- version?: number;
2004
- routes?: readonly StoryboardDiscoveryRoute[];
2005
- scenarios?: readonly StoryboardDiscoveryScenario[];
2006
- candidates?: readonly StoryboardDiscoveryCandidate[];
2007
- edges?: readonly StoryboardDiscoveryEdge[];
2008
- }
2009
-
2010
- export interface StoryboardResolvedPage {
2011
- id: string;
2012
- name: string;
2013
- canvas?: string;
2014
- section?: string;
2015
- importKind?: DesignImportKind;
2016
- componentName?: string;
2017
- gallery?: string[];
2018
- route?: string;
2019
- path?: string;
2020
- publish?: boolean;
2021
- width?: number;
2022
- height?: number;
2023
- frameSizeMode?: DesignFrameSizeMode;
2024
- heightMode?: DesignFrameHeightMode;
2025
- maxHeight?: number;
2026
- sourcePaths?: string[];
2027
- flow?: string;
2028
- scenario?: string;
2029
- state?: string;
2030
- /** Host-declared kind of the state branch (overlay, badge, layout, ...). Presentation hint for the Screen states control. */
2031
- stateKind?: string;
2032
- scenarioId?: string;
2033
- interactions?: readonly DesignScreenInteraction[];
2034
- environment?: StoryboardEnvironment;
2035
- preset?: DesignScreenPreset;
2036
- assertions?: readonly DesignScreenAssertion[];
2037
- }
2038
-
2039
- export interface StoryboardDiscoveryGraphOptions {
2040
- manifest: StoryboardDiscoveryManifest;
2041
- pages: readonly StoryboardResolvedPage[];
2042
- assets?: readonly DesignImportAsset[];
2043
- /** Host-authored user journeys layered over source-inferred transitions. */
2044
- storyboard?: StoryboardDefinition;
2045
- }
2046
-
2047
- export interface StoryboardDiscoveryResult {
2048
- manifest: StoryboardDiscoveryManifest;
2049
- baselineEnvironment?: StoryboardEnvironment;
2050
- graph: StoryboardGraph;
2051
- }
2052
-
2053
- export interface StoryboardDiscoveryResponse {
2054
- ok: boolean;
2055
- status: number;
2056
- json(): Promise<unknown>;
2057
- }
2058
-
2059
- export type StoryboardDiscoveryFetch = (
2060
- endpoint: string,
2061
- init: {
2062
- headers: { accept: 'application/json' };
2063
- cache: 'no-store';
2064
- signal?: AbortSignal;
2065
- },
2066
- ) => Promise<StoryboardDiscoveryResponse>;
2067
-
2068
- export interface LoadStoryboardDiscoveryOptions extends Omit<
2069
- StoryboardDiscoveryGraphOptions,
2070
- 'manifest'
2071
- > {
2072
- endpoint: string;
2073
- signal?: AbortSignal;
2074
- fetcher?: StoryboardDiscoveryFetch;
2075
- }
2076
-
2077
- export declare function resolveStoryboardScreenCases(
2078
- pages: readonly StoryboardResolvedPage[],
2079
- manifest: StoryboardDiscoveryManifest,
2080
- ): DesignScreenCase[];
2081
- export declare function createStoryboardRouteScenarioId(route: string): string;
2082
- export declare function getStoryboardDiscoveryBaselineEnvironment(
2083
- manifest: StoryboardDiscoveryManifest,
2084
- ): StoryboardEnvironment | undefined;
2085
- export declare function createStoryboardGraphFromDiscovery(
2086
- options: StoryboardDiscoveryGraphOptions,
2087
- ): StoryboardGraph;
2088
- export declare function loadStoryboardDiscovery(
2089
- options: LoadStoryboardDiscoveryOptions,
2090
- ): Promise<StoryboardDiscoveryResult>;
2091
- export declare function publishStoryboardDiscovery(
2092
- options: LoadStoryboardDiscoveryOptions,
2093
- ): Promise<StoryboardDiscoveryResult>;
2094
-
2095
- export interface InitialPageDef {
2096
- name: string;
2097
- /** Owning canvas, such as 'Design System' or 'Screens'. Defaults to 'default'. */
2098
- canvas?: string;
2099
- /** Page = 1 of this registry component (screen injection). */
2100
- componentName?: string;
2101
- /** Page = Vertical gallery of registry names (Components gallery page). */
2102
- gallery?: string[];
2103
- /** Page = actual running app route (see iframe — non-editable, preview actual routing). */
2104
- route?: string;
2105
- /** Publishing path in creation screen. */
2106
- path?: string;
2107
- /** If false, excluded from reflected output. */
2108
- publish?: boolean;
2109
- /** Optional section header shown in the page list. */
2110
- section?: string;
2111
- /** Frame size (px) — 390×600 (mobile) if not specified. */
2112
- width?: number;
2113
- height?: number;
2114
- frameSizeMode?: DesignFrameSizeMode;
2115
- heightMode?: DesignFrameHeightMode;
2116
- maxHeight?: number;
2117
- /** Immediately after the first render, the entire actual DOM is imported into the layer tree. */
2118
- importLayers?: boolean;
2119
- importPageId?: string;
2120
- importKind?: DesignImportKind;
2121
- assetIds?: string[];
2122
- sourcePaths?: string[];
2123
- flow?: string;
2124
- scenario?: string;
2125
- state?: string;
2126
- /** Host-declared kind of the state branch (overlay, badge, layout, ...). Presentation hint for the Screen states control. */
2127
- stateKind?: string;
2128
- /** Host-declared situation lane the canvas arranges the frame into. */
2129
- lane?: string;
2130
- scenarioId?: string;
2131
- interactions?: DesignScreenInteraction[];
2132
- environment?: StoryboardEnvironment;
2133
- preset?: DesignScreenPreset;
2134
- assertions?: DesignScreenAssertion[];
2135
- }
2136
-
2137
- export interface ApplyPayload {
2138
- tokens: { name: string; value: string }[];
2139
- pages: {
2140
- id: string;
2141
- name: string;
2142
- path: string;
2143
- width: number;
2144
- height: number;
2145
- canvas: string;
2146
- section?: string;
2147
- jsx: string;
2148
- }[];
2149
- }
2150
-
2151
- export interface DesignCodeDocument {
2152
- type: 'document';
2153
- id: string;
2154
- kind: DesignImportKind;
2155
- name: string;
2156
- canvas: string;
2157
- section?: string;
2158
- path?: string;
2159
- route?: string;
2160
- width: number;
2161
- height: number;
2162
- assetIds: string[];
2163
- sourcePaths: string[];
2164
- jsx: string;
2165
- }
2166
-
2167
- export interface DesignTokenDocument {
2168
- type: 'token';
2169
- id: string;
2170
- kind: 'design-tokens';
2171
- name: string;
2172
- value: string;
2173
- }
2174
-
2175
- export type DesignElementDocument = DesignCodeDocument | DesignTokenDocument;
2176
-
2177
- export interface DesignElementChange {
2178
- operation: 'upsert' | 'delete';
2179
- element: DesignElementDocument;
2180
- }
2181
-
2182
- export interface DesignChangePayload {
2183
- revision: number;
2184
- changes: DesignElementChange[];
2185
- }
2186
-
2187
- export interface DesignChangeResult {
2188
- saved: number;
2189
- files?: string[];
2190
- message?: string;
2191
- }
2192
-
2193
- export interface SourceIdentity {
2194
- componentFile: string;
2195
- sourceStart: number;
2196
- elementName: string;
2197
- }
2198
-
2199
- export interface SourceAffectedFrame {
2200
- id: string;
2201
- name: string;
2202
- }
2203
-
2204
- export type SourceEditScope = 'instance' | 'shared-source';
2205
- export type PrimitiveSourceValue = string | number | boolean;
2206
- export type PrimitiveSourceValueType = 'string' | 'number' | 'boolean';
2207
-
2208
- export interface SourceInsertComponent {
2209
- name: string;
2210
- importPath: string;
2211
- importKind: 'named';
2212
- props: Record<string, PrimitiveSourceValue>;
2213
- children?: string;
2214
- }
2215
-
2216
- export type SourceEditOperation =
2217
- | {
2218
- kind: 'prop';
2219
- identity: SourceIdentity;
2220
- prop: string;
2221
- from: PrimitiveSourceValue;
2222
- to: PrimitiveSourceValue;
2223
- valueType: PrimitiveSourceValueType;
2224
- scope: SourceEditScope;
2225
- affectedFrames: SourceAffectedFrame[];
2226
- }
2227
- | {
2228
- kind: 'text';
2229
- identity: SourceIdentity;
2230
- from: string;
2231
- to: string;
2232
- scope: SourceEditScope;
2233
- affectedFrames: SourceAffectedFrame[];
2234
- }
2235
- | {
2236
- kind: 'insert';
2237
- mode: 'clone';
2238
- identity: SourceIdentity;
2239
- fromIndex: number;
2240
- toIndex: number;
2241
- scope: SourceEditScope;
2242
- affectedFrames: SourceAffectedFrame[];
2243
- }
2244
- | {
2245
- kind: 'insert';
2246
- mode: 'component';
2247
- identity: SourceIdentity;
2248
- slot: 'children';
2249
- toIndex: number;
2250
- component: SourceInsertComponent;
2251
- scope: SourceEditScope;
2252
- affectedFrames: SourceAffectedFrame[];
2253
- }
2254
- | {
2255
- kind: 'remove';
2256
- identity: SourceIdentity;
2257
- fromIndex: number;
2258
- scope: SourceEditScope;
2259
- affectedFrames: SourceAffectedFrame[];
2260
- }
2261
- | {
2262
- kind: 'move';
2263
- identity: SourceIdentity;
2264
- fromIndex: number;
2265
- toIndex: number;
2266
- scope: SourceEditScope;
2267
- affectedFrames: SourceAffectedFrame[];
2268
- };
2269
-
2270
- /** Source edit payload sent through the host write-back endpoint. */
2271
- export interface InspectApplyPayload {
2272
- /** Final CSS declaration bundle per (scss file, css module local class). */
2273
- styles: {
2274
- file: string;
2275
- className: string;
2276
- componentFile: string;
2277
- declarations: Record<string, string>;
2278
- affectedFrames: SourceAffectedFrame[];
2279
- media?: { minWidth?: number; maxWidth?: number };
2280
- }[];
2281
- /** Initial text for each element → Final text (assuming one-time exact matching substitution in the source). */
2282
- texts: {
2283
- componentFile: string;
2284
- oldText: string;
2285
- newText: string;
2286
- affectedFrames: SourceAffectedFrame[];
2287
- }[];
2288
- /** Atomic modification of prop·children based on JSX/TSX source location. */
2289
- operations: SourceEditOperation[];
2290
- }
2291
-
2292
- /** Result returned after the host applies source edits. */
2293
- export interface InspectApplyResult {
2294
- applied: number;
2295
- /** Modification session branch created by the host. */
2296
- branch?: string;
2297
- /** Result of merging with latest development code. */
2298
- integration?:
2299
- 'up_to_date' | 'auto_merged' | 'review_required' | 'conflict' | 'offline';
2300
- /** Text of application results to show to the designer. */
2301
- message?: string;
2302
- /** Comparison of DOM·PNG recapture of the impact screen immediately after application. */
2303
- qa?: InspectQaResult;
2304
- }
2305
-
2306
- export interface InspectPreviewResult {
2307
- revision: number;
2308
- files: { file: string; diff: string }[];
2309
- affectedFiles: string[];
2310
- /** Based on comparison of impact screens captured in current revision. */
2311
- qa?: InspectQaResult;
2312
- }
2313
-
2314
- export interface InspectImpactResult {
2315
- files: string[];
2316
- }
2317
-
2318
- export interface InspectQaArtifactHash {
2319
- domStructureHash: string;
2320
- screenshotHash: string;
2321
- screenshotUrl?: string;
2322
- }
2323
-
2324
- export interface InspectQaPixelDimensions {
2325
- width: number;
2326
- height: number;
2327
- }
2328
-
2329
- export interface InspectQaPixelDiff {
2330
- before: InspectQaPixelDimensions;
2331
- after: InspectQaPixelDimensions;
2332
- dimensionsMatch: boolean;
2333
- changedPixels: number;
2334
- totalPixels: number;
2335
- diffRatio: number;
2336
- threshold: number;
2337
- heatmapUrl: string | null;
2338
- }
2339
-
2340
- export interface InspectQaFrameResult {
2341
- id: string;
2342
- before: InspectQaArtifactHash;
2343
- after?: InspectQaArtifactHash;
2344
- domChanged?: boolean;
2345
- screenshotChanged?: boolean;
2346
- pixelDiff?: InspectQaPixelDiff;
2347
- }
2348
-
2349
- export interface InspectQaFailure {
2350
- id: string;
2351
- error: string;
2352
- }
2353
-
2354
- export interface InspectQaResult {
2355
- phase: 'baseline' | 'changed';
2356
- baselineId: string;
2357
- complete: boolean;
2358
- frames: InspectQaFrameResult[];
2359
- failures: InspectQaFailure[];
2360
- }
2361
-
2362
- export interface InspectQaCaptureRequest {
2363
- phase: 'baseline' | 'changed';
2364
- basePath: string;
2365
- frameIds: string[];
2366
- baselineId?: string;
2367
- }
2368
-
2369
- export type PygmalionIntegrationState =
2370
- 'up_to_date' | 'auto_merged' | 'review_required' | 'conflict' | 'offline';
2371
-
2372
- export interface PygmalionDevMirrorStatus {
2373
- state: 'idle' | 'syncing' | 'ready' | 'error';
2374
- commit: string | null;
2375
- shortCommit: string | null;
2376
- /** Git ref the mirror is tracking, or null when it follows the source branch. */
2377
- sourceRef: string | null;
2378
- syncedAt: string | null;
2379
- updated: boolean;
2380
- warning: string | null;
2381
- error: string | null;
2382
- appOrigin: string | null;
2383
- }
2384
-
2385
- export interface PygmalionVisualOperation {
2386
- id: string;
2387
- revision: number;
2388
- kind: 'visual';
2389
- createdAt: string;
2390
- commitSha: string;
2391
- files: string[];
2392
- integrationState: PygmalionIntegrationState;
2393
- }
2394
-
2395
- export interface PygmalionVisualRevertOperation {
2396
- id: string;
2397
- revision: number;
2398
- kind: 'visual-revert';
2399
- createdAt: string;
2400
- commitSha: string;
2401
- revertsOperationId: string;
2402
- revertsRevision: number;
2403
- revertsCommitSha: string;
2404
- recordedCommitSha: string;
2405
- files: string[];
2406
- integrationState: PygmalionIntegrationState;
2407
- }
2408
-
2409
- export type PygmalionSessionOperation =
2410
- PygmalionVisualOperation | PygmalionVisualRevertOperation;
2411
-
2412
- export interface PygmalionDesignSessionStatus {
2413
- id: string;
2414
- createdAt: string;
2415
- updatedAt: string;
2416
- createdFromSha: string;
2417
- baseDevSha: string;
2418
- branchName: string | null;
2419
- headSha: string | null;
2420
- revision: number;
2421
- integration: {
2422
- state: PygmalionIntegrationState;
2423
- latestDevSha: string;
2424
- checkedAt: string;
2425
- affectedFiles: string[];
2426
- conflictFiles: string[];
2427
- error?: string;
2428
- };
2429
- lastOperation: PygmalionSessionOperation | null;
2430
- canRevert: boolean;
2431
- lastRevertableOperation: PygmalionVisualOperation | null;
2432
- lastRevert: PygmalionVisualRevertOperation | null;
2433
- appOrigin: string | null;
2434
- previewError: string | null;
2435
- }
2436
-
2437
- export interface PygmalionRevertResult {
2438
- reverted: true;
2439
- operation: PygmalionVisualRevertOperation;
2440
- session: PygmalionDesignSessionStatus;
2441
- }
2442
-
2443
- export interface PygmalionProjectEndpoints {
2444
- mirror: string;
2445
- sessions: string;
2446
- inspect: string;
2447
- }
2448
-
2449
- export interface PygmalionProjectRuntimeOptions {
2450
- endpoints?: Partial<PygmalionProjectEndpoints>;
2451
- sessionId?: string;
2452
- sessionStorageKey?: string;
2453
- autoStart?: boolean;
2454
- fetcher?: typeof fetch;
2455
- /** Automatically compare DOM and PNG hashes for affected screens before and after apply. */
2456
- visualQa?: {
2457
- endpoint?: string;
2458
- eligibleFrameIds: readonly string[];
2459
- };
2460
- formatApplyMessage?: (
2461
- session: PygmalionDesignSessionStatus,
2462
- applied: number,
2463
- ) => string | undefined;
2464
- }
2465
-
2466
- /** One revision the mirror can be repointed at. */
2467
- export interface PygmalionSourceRef {
2468
- name: string;
2469
- commit: string;
2470
- fullName: string;
2471
- kind: 'local' | 'remote';
2472
- }
2473
-
2474
- /** Revisions available to `switchSource`, listed from the mirror repository. */
2475
- export interface PygmalionSourceRefs {
2476
- refs: readonly PygmalionSourceRef[];
2477
- /** Revision followed when none is pinned. */
2478
- defaultRef: string | null;
2479
- /** Ref that renders uncommitted work. */
2480
- worktreeRef: string | null;
2481
- }
2482
-
2483
- export interface SourceRefControlProps {
2484
- value: string | null;
2485
- /** Commit currently rendered by the mirror. Used to expose a newer ref tip. */
2486
- currentCommit?: string | null;
2487
- refs: readonly PygmalionSourceRef[];
2488
- onChange(ref: string): void;
2489
- busy?: boolean;
2490
- defaultRef?: string | null;
2491
- worktreeRef?: string | null;
2492
- label?: string;
2493
- /** Menu label for reloading the selected revision after its tip moves. */
2494
- refreshLabel?: string;
2495
- /** Trigger content. Defaults to the selected revision. */
2496
- children?: ReactNode;
2497
- className?: string;
2498
- }
2499
-
2500
- /** Selects the revision the dev mirror follows. Owned by Pygmalion, not by the host. */
2501
- export declare function SourceRefControl(props: SourceRefControlProps): ReactElement;
2502
-
2503
- export interface PygmalionProjectRuntime {
2504
- mirror: PygmalionDevMirrorStatus;
2505
- session: PygmalionDesignSessionStatus | null;
2506
- ready: boolean;
2507
- appOrigin: string | null;
2508
- previewRevision: string;
2509
- /**
2510
- * Source SHA of previewRevision, without the session mutation counter.
2511
- * Artifact bundles are stamped with this, so hosts must build artifact cache
2512
- * namespaces from it instead of parsing previewRevision themselves.
2513
- */
2514
- previewSourceRevision: string;
2515
- refresh(manual?: boolean, sourceRef?: string): Promise<void>;
2516
- /**
2517
- * Repoints the mirror at another git ref without restarting the dev server.
2518
- * Pass PYGMALION_WORKTREE_SOURCE_REF to preview uncommitted work.
2519
- * The artifact cache is keyed by source SHA, so a switch invalidates it.
2520
- */
2521
- switchSource(
2522
- sourceRef: string,
2523
- options?: { discardEdits?: boolean },
2524
- ): Promise<void>;
2525
- /**
2526
- * Revisions `switchSource` can be given. Empty until listed, so a host can
2527
- * offer a choice instead of asking for a ref string.
2528
- */
2529
- sourceRefs: PygmalionSourceRefs;
2530
- loadSourceRefs(): Promise<PygmalionSourceRefs>;
2531
- previewVisual(payload: InspectApplyPayload): Promise<InspectPreviewResult>;
2532
- inspectImpact(componentFiles: string[]): Promise<InspectImpactResult>;
2533
- applyVisual(payload: InspectApplyPayload): Promise<InspectApplyResult>;
2534
- revertLastVisual(): Promise<PygmalionRevertResult>;
2535
- }
2536
-
2537
- export declare function usePygmalionProject(
2538
- options?: PygmalionProjectRuntimeOptions,
2539
- ): PygmalionProjectRuntime;
2540
-
2541
- export declare function PygmalionEditor(props: {
2542
- registry?: ComponentRegistry;
2543
- tokens?: TokenDef[];
2544
- initialPages?: InitialPageDef[];
2545
- /** Canvas shown on first mount. Useful when an earlier catalog canvas is expensive to render. */
2546
- initialCanvas?: string;
2547
- /**
2548
- * Mode the editor opens in. Defaults to 'edit'. Declare 'view-only' when the
2549
- * editor is a review surface: it applies once, so the toggle still belongs to
2550
- * the designer, and nothing is persisted across reloads.
2551
- */
2552
- initialEditMode?: 'edit' | 'view-only';
2553
- /** Explicit external-design to registered-code component mappings. */
2554
- componentConnections?: readonly DesignComponentConnectionDef[];
2555
- /** Named frame widths the application supports — rendered as one-click buttons beside the W/H boxes. */
2556
- viewportPresets?: readonly ViewportPresetDef[];
2557
- /** Host-declared browser conditions shown in the active frame's Preview inspector. */
2558
- previewEnvironmentControls?: readonly PreviewEnvironmentControlDef[];
2559
- /** icons/tokens/atoms/components/screens Controller for getting inventory and full DOM layers. */
2560
- designImport?: DesignImportController;
2561
- /** Called with cumulative changes when editing asset panel tokens — Host is responsible for write-back (file saving). */
2562
- onTokensChange?: (changed: { name: string; value: string }[]) => void;
2563
- /** The standard origin of the route page iframe ('' if same-origin). */
2564
- appOrigin?: string;
2565
- /** Code version as of preview (dev SHA, etc.). Even if the URL is the same, if the value changes, the screen cache is updated. */
2566
- previewRevision?: string;
2567
- /** Project/branch boundaries for screen caches that are persistent in the browser. Stable string separate from random dev port. */
2568
- previewCacheNamespace?: string;
2569
- /** A canonical screen snapshot created during build. When the namespace matches, it is injected into the cache before the first render. */
2570
- previewArtifacts?: RoutePreviewArtifactBundle;
2571
- /** Same-origin endpoint that resolves an exact namespace and source revision. Stale embedded previews remain visibly last-known until this endpoint returns an exact frame. */
2572
- previewArtifactEndpoint?: string;
2573
- /** Number of actual app previews to run simultaneously. Defaults to an adaptive 12–32 lanes. */
2574
- previewConcurrency?: number;
2575
- /** Controlled by external status such as host route ▶ Whether the preview is opened or not. */
2576
- previewOpen?: boolean;
2577
- /** ▶ Called when the preview is opened or closed — allows the host to synchronize URLs. */
2578
- onPreviewOpenChange?: (open: boolean) => void;
2579
- /** ▶ The name of the “app screen flow” canvas that the preview will always play — Enter this canvas screen even if you press it on another canvas. */
2580
- flowCanvas?: string;
2581
- /**
2582
- * Static surface for route frames: `bitmap` (default) renders captured
2583
- * screenshots and reconstructs frozen DOM on demand; `dom` mounts the
2584
- * frozen DOM from the start — recommended with per-section canvases.
2585
- */
2586
- frameSurface?: 'bitmap' | 'dom';
2587
- /**
2588
- * Host-declared flow paths — the captureless surface supply. One hidden
2589
- * live instance walks each path and publishes a frozen snapshot per
2590
- * waypoint; frames a flow claims wait for delivery instead of booting
2591
- * live. Screens no flow claims keep the artifact/sweep/boot supply.
2592
- */
2593
- screenFlows?: readonly ScreenFlowPath[];
2594
- /**
2595
- * Host-declared scenario coverage ledger. The right panel lists a screen's
2596
- * claims as executable rows and badges component controls with the
2597
- * scenarios they demonstrate.
2598
- */
2599
- scenarioCoverage?: readonly ScenarioCoverageClaim[];
2600
- /** Curated per-screen dimension controls (see ScreenDimensionDef). */
2601
- screenDimensions?: readonly ScreenDimensionDef[];
2602
- /** Row-count controls for repeating lists (see ScreenListDef). */
2603
- screenLists?: readonly ScreenListDef[];
2604
- /** Section header bands (see SectionHeaderDef). */
2605
- sectionHeaders?: readonly SectionHeaderDef[];
2606
- /** Situation lanes: one lane is one canvas row (see ScreenLaneDef). */
2607
- screenLanes?: readonly ScreenLaneDef[];
2608
- /** Branch-kind presentation for frame labels (see FrameBranchKindDef). */
2609
- frameBranchKinds?: readonly FrameBranchKindDef[];
2610
- /** Words for the facts a frame label counts. */
2611
- frameLabelLabels?: FrameLabelLabels;
2612
- /** Words for the facts a section header counts. */
2613
- sectionHeaderLabels?: SectionHeaderLabels;
2614
- /** Badge composition per repeated card (see ScreenCardDef). */
2615
- screenCards?: readonly ScreenCardDef[];
2616
- /**
2617
- * How many frames may render the running application instead of their
2618
- * capture. Default 0 — every frame is served from its capture. Raise it
2619
- * to keep the frames in use interactive; the least recently activated
2620
- * holder gives its slot back.
2621
- */
2622
- liveScreenBudget?: number;
2623
- /** Interactive axes reachable by acting on a screen (see InteractiveStateDef). */
2624
- interactiveStates?: readonly InteractiveStateDef[];
2625
- /**
2626
- * Host verdicts for the surfaces the editor asks about. Each either names the
2627
- * declaration that covers it or excludes it with a reason; anything
2628
- * unanswered shows on the frame as an unclassified surface.
2629
- */
2630
- surfaceClassifications?: readonly SurfaceClassification[];
2631
- /** Reflect button — Returns { branch } after the host saves the file and commits the branch (push is done directly by the user). */
2632
- onApply?: (payload: ApplyPayload) => Promise<{ branch: string } | void>;
2633
- /** Code auto-save path that does not differentiate between icon/token/atom/component/screen. */
2634
- onDesignChange?: (
2635
- payload: DesignChangePayload,
2636
- ) => Promise<DesignChangeResult | void>;
2637
- /** Apply inspection edits through the host write-back endpoint. */
2638
- onInspectApply?: (
2639
- payload: InspectApplyPayload,
2640
- ) => Promise<InspectApplyResult | void>;
2641
- /** Preview the code diff before applying. If connected, the Apply button is locked before confirmation. */
2642
- onInspectPreview?: (
2643
- payload: InspectApplyPayload,
2644
- ) => Promise<InspectPreviewResult>;
2645
- /** Check the reverse dependency closure of the changed source file. */
2646
- onInspectImpact?: (componentFiles: string[]) => Promise<InspectImpactResult>;
2647
- /** Authored screen paths and starts merged with source-discovered navigation. */
2648
- storyboard?: StoryboardDefinition;
2649
- /** Detect portable browser branches from source before route frames boot. Default true. */
2650
- storyboardDiscovery?: boolean;
2651
- /** Vite endpoint that returns the generated generic storyboard environment manifest. */
2652
- storyboardDiscoveryEndpoint?: string;
2653
- }): ReactElement;
2654
-
2655
- /** Edit token values ​​in code (live override + onTokensChange notification). */
2656
- export declare function applyTokenOverride(name: string, value: string): void;
2657
-
2658
- /** Disable all token overrides. */
2659
- export declare function resetTokenOverrides(): void;
2660
-
2661
- /** Called from the actual button handler of the host screen fixture — Switches to the name matching page (common in editor and preview). */
2662
- export declare function pygmalionNavigate(pageName: string): void;
2663
-
2664
- /** Open the prototype preview (▶) in the code. */
2665
- export declare function pygmalionOpenPreview(): void;
2666
- /** Discard unapplied canvas and inspection edits created after the latest source load or apply. */
2667
- export declare function pygmalionResetCurrentEdits(): boolean;
2668
-
2669
- /** For host debugging — editor store·mobx inspection utility (instance in bundle). */
2670
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
2671
- export declare const __debug: {
2672
- editor: any;
2673
- getObserverTree: any;
2674
- isObservableProp: any;
2675
- };