@pygmalionjs/pygmalion 0.2.11 → 0.2.13

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/types.d.ts CHANGED
@@ -1,6 +1,11 @@
1
1
  // Package public type — used by the host repo's tsc to interpret pygmalion import.
2
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 { ComponentType, ReactElement } from 'react';
3
+ import type {
4
+ ComponentType,
5
+ CSSProperties,
6
+ ReactElement,
7
+ ReactNode,
8
+ } from 'react';
4
9
 
5
10
  export interface RegistryEntry {
6
11
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
@@ -26,6 +31,126 @@ export interface RegistryEntry {
26
31
 
27
32
  export type ComponentRegistry = Record<string, RegistryEntry>;
28
33
 
34
+ export type DesignCatalogKind =
35
+ 'icons' | 'design-tokens' | 'atoms' | 'components';
36
+
37
+ export interface DesignCatalogItem {
38
+ id: string;
39
+ name: string;
40
+ section: string;
41
+ sourcePath?: string;
42
+ codeName?: string;
43
+ description?: string;
44
+ }
45
+
46
+ export interface DesignCatalogPageDescriptor {
47
+ id: string;
48
+ name: string;
49
+ section: string;
50
+ }
51
+
52
+ export interface DesignCatalogFrame {
53
+ width: number;
54
+ height: number;
55
+ }
56
+
57
+ export interface DesignCatalogBuild {
58
+ registry: ComponentRegistry;
59
+ collection: DesignImportCollection;
60
+ }
61
+
62
+ export interface DesignGalleryCatalogOptions<T extends DesignCatalogItem> {
63
+ kind: 'icons' | 'design-tokens';
64
+ items: readonly T[];
65
+ expectedCount?: number;
66
+ pageFor: (item: T) => DesignCatalogPageDescriptor;
67
+ renderPreview: (item: T) => ReactNode;
68
+ secondaryLabel?: (item: T) => ReactNode;
69
+ frame?:
70
+ | DesignCatalogFrame
71
+ | ((
72
+ page: DesignCatalogPageDescriptor,
73
+ items: readonly T[],
74
+ ) => DesignCatalogFrame);
75
+ minimumColumnWidth?: number;
76
+ registryPrefix?: string;
77
+ }
78
+
79
+ export interface DesignComponentCatalogOptions {
80
+ kind: 'atoms' | 'components';
81
+ items: readonly DesignCatalogItem[];
82
+ registry: ComponentRegistry;
83
+ expectedCount?: number;
84
+ maxVariantCells?: number;
85
+ registryPrefix?: string;
86
+ }
87
+
88
+ export interface DesignComponentVariantMatrix {
89
+ row?: readonly [name: string, values: readonly string[]];
90
+ column?: readonly [name: string, values: readonly string[]];
91
+ fixed: readonly (readonly [name: string, value: string])[];
92
+ additional: readonly (readonly [name: string, values: readonly string[]])[];
93
+ }
94
+
95
+ export interface PygmalionCatalogDocumentProps {
96
+ title: ReactNode;
97
+ eyebrow?: ReactNode;
98
+ description?: ReactNode;
99
+ version?: ReactNode;
100
+ meta?: ReactNode;
101
+ children: ReactNode;
102
+ headerBackground?: string;
103
+ headerColor?: string;
104
+ bodyBackground?: string;
105
+ bodyGap?: number;
106
+ }
107
+
108
+ export interface PygmalionCatalogSectionProps {
109
+ title: ReactNode;
110
+ count?: number;
111
+ description?: ReactNode;
112
+ children: ReactNode;
113
+ tone?: 'plain' | 'tinted';
114
+ }
115
+
116
+ export interface PygmalionCatalogMatrixProps {
117
+ rows: readonly string[];
118
+ columns: readonly string[];
119
+ cornerLabel?: ReactNode;
120
+ renderCell: (row: string, column: string) => ReactNode;
121
+ renderRowLabel?: (row: string) => ReactNode;
122
+ renderColumnLabel?: (column: string) => ReactNode;
123
+ boundary?: boolean;
124
+ cellStyle?: CSSProperties;
125
+ }
126
+
127
+ export declare function PygmalionCatalogDocument(
128
+ props: PygmalionCatalogDocumentProps,
129
+ ): ReactElement;
130
+ export declare function PygmalionCatalogSection(
131
+ props: PygmalionCatalogSectionProps,
132
+ ): ReactElement;
133
+ export declare function PygmalionCatalogMatrix(
134
+ props: PygmalionCatalogMatrixProps,
135
+ ): ReactElement;
136
+
137
+ export declare function designCatalogKey(value: string): string;
138
+ export declare function designCatalogRegistryName(
139
+ kind: DesignCatalogKind,
140
+ id: string,
141
+ prefix?: string,
142
+ ): string;
143
+ export declare function createDesignGalleryCatalog<T extends DesignCatalogItem>(
144
+ options: DesignGalleryCatalogOptions<T>,
145
+ ): DesignCatalogBuild;
146
+ export declare function createDesignComponentVariantMatrix(
147
+ entry: RegistryEntry | undefined,
148
+ maxCells?: number,
149
+ ): DesignComponentVariantMatrix;
150
+ export declare function createDesignComponentCatalog(
151
+ options: DesignComponentCatalogOptions,
152
+ ): DesignCatalogBuild;
153
+
29
154
  export interface TokenDef {
30
155
  /** CSS variable name — e.g. `--app-color-surface-brand`. */
31
156
  name: string;
@@ -36,8 +161,16 @@ export interface TokenDef {
36
161
  group?: string;
37
162
  }
38
163
 
39
- export const DESIGN_IMPORT_KINDS: readonly ['icons', 'design-tokens', 'atoms', 'components', 'screens'];
164
+ export const DESIGN_IMPORT_KINDS: readonly [
165
+ 'icons',
166
+ 'design-tokens',
167
+ 'atoms',
168
+ 'components',
169
+ 'screens',
170
+ ];
40
171
  export type DesignImportKind = (typeof DESIGN_IMPORT_KINDS)[number];
172
+ export type DesignFrameSizeMode = 'fixed' | 'content';
173
+ export type DesignFrameHeightMode = 'fixed' | 'document';
41
174
 
42
175
  export interface DesignImportAsset {
43
176
  id: string;
@@ -52,13 +185,7 @@ export interface DesignImportAsset {
52
185
  }
53
186
 
54
187
  export type DesignScreenInteractionAction =
55
- | 'click'
56
- | 'focus'
57
- | 'fill'
58
- | 'check'
59
- | 'press'
60
- | 'wait'
61
- | 'storage';
188
+ 'click' | 'focus' | 'fill' | 'check' | 'press' | 'wait' | 'storage';
62
189
 
63
190
  export interface DesignScreenInteraction {
64
191
  action: DesignScreenInteractionAction;
@@ -88,10 +215,7 @@ export type DesignSerializable =
88
215
  export type DesignScreenPreset = Readonly<Record<string, DesignSerializable>>;
89
216
  export type StoryboardPermissionState = 'granted' | 'denied' | 'prompt';
90
217
  export type StoryboardMediaFailure =
91
- | 'not-allowed'
92
- | 'not-found'
93
- | 'not-readable'
94
- | 'overconstrained';
218
+ 'not-allowed' | 'not-found' | 'not-readable' | 'overconstrained';
95
219
 
96
220
  export interface StoryboardMediaDevice {
97
221
  kind: 'audioinput' | 'audiooutput' | 'videoinput';
@@ -143,6 +267,12 @@ export interface DesignImportPage {
143
267
  publish?: boolean;
144
268
  width?: number;
145
269
  height?: number;
270
+ /** `content` replaces the 1×1 measurement seed with actual rendered DOM bounds. */
271
+ frameSizeMode?: DesignFrameSizeMode;
272
+ /** `document` expands the frame to the rendered document height. The default remains a fixed viewport. */
273
+ heightMode?: DesignFrameHeightMode;
274
+ /** Safety limit used only by document-height frames. Defaults to 12,000px and is capped at 32,000px. */
275
+ maxHeight?: number;
146
276
  flow?: string;
147
277
  scenario?: string;
148
278
  state?: string;
@@ -194,6 +324,39 @@ export interface DesignScreenCollectionResult {
194
324
  coverage: DesignScenarioCoverage;
195
325
  }
196
326
 
327
+ export interface DesignScreenViewport {
328
+ id: string;
329
+ label: string;
330
+ width: number;
331
+ height: number;
332
+ heightMode?: DesignFrameHeightMode;
333
+ maxHeight?: number;
334
+ }
335
+
336
+ export type DesignScreenViewportPagePatch = Partial<
337
+ Omit<DesignImportPage, 'id' | 'name' | 'section' | 'width' | 'height'>
338
+ >;
339
+
340
+ export interface DesignScreenViewportExpansionOptions {
341
+ include?: (page: DesignImportPage, viewport: DesignScreenViewport) => boolean;
342
+ transformPage?: (
343
+ page: DesignImportPage,
344
+ viewport: DesignScreenViewport,
345
+ ) => DesignScreenViewportPagePatch | undefined;
346
+ createPageId?: (
347
+ page: DesignImportPage,
348
+ viewport: DesignScreenViewport,
349
+ ) => string;
350
+ createPageName?: (
351
+ page: DesignImportPage,
352
+ viewport: DesignScreenViewport,
353
+ ) => string;
354
+ createSection?: (
355
+ page: DesignImportPage,
356
+ viewport: DesignScreenViewport,
357
+ ) => string;
358
+ }
359
+
197
360
  export interface DesignImportManifest {
198
361
  sourceSha?: string;
199
362
  registry: ComponentRegistry;
@@ -208,7 +371,10 @@ export interface DesignImportCoverageItem {
208
371
  missing: number;
209
372
  }
210
373
 
211
- export type DesignImportCoverage = Record<DesignImportKind, DesignImportCoverageItem> & {
374
+ export type DesignImportCoverage = Record<
375
+ DesignImportKind,
376
+ DesignImportCoverageItem
377
+ > & {
212
378
  sourceSha?: string;
213
379
  complete: boolean;
214
380
  };
@@ -221,7 +387,8 @@ export interface DesignScreenInteractionReport {
221
387
  error?: string;
222
388
  }
223
389
 
224
- export type DesignScreenCaptureFailureStage = 'preset' | 'interaction' | 'assertion';
390
+ export type DesignScreenCaptureFailureStage =
391
+ 'preset' | 'interaction' | 'assertion';
225
392
  export type DesignScreenCaptureFailureCode =
226
393
  | 'preset_executor_missing'
227
394
  | 'preset_rejected'
@@ -280,7 +447,10 @@ export interface DesignScreenPresetExecutionResult {
280
447
  export type DesignScreenPresetExecutor = (
281
448
  request: DesignScreenPresetRequest,
282
449
  context: DesignScreenPresetContext,
283
- ) => Promise<DesignScreenPresetExecutionResult | void> | DesignScreenPresetExecutionResult | void;
450
+ ) =>
451
+ | Promise<DesignScreenPresetExecutionResult | void>
452
+ | DesignScreenPresetExecutionResult
453
+ | void;
284
454
 
285
455
  export interface DesignScreenCaptureSpec {
286
456
  pageId: string;
@@ -391,11 +561,22 @@ export interface DesignImportController {
391
561
  getInitialPages(): DesignImportInitialPage[];
392
562
  getCoverage(): DesignImportCoverage;
393
563
  assertComplete(): void;
394
- captureElement(element: Element, win?: Window, options?: DomImportOptions): DomImportResult | null;
395
- captureIframe(iframe: HTMLIFrameElement, options?: DomImportOptions): DomImportResult | null;
564
+ captureElement(
565
+ element: Element,
566
+ win?: Window,
567
+ options?: DomImportOptions,
568
+ ): DomImportResult | null;
569
+ captureIframe(
570
+ iframe: HTMLIFrameElement,
571
+ options?: DomImportOptions,
572
+ ): DomImportResult | null;
396
573
  captureIframeWhenStable(
397
574
  iframe: HTMLIFrameElement,
398
- options?: DomImportOptions & { settleMs?: number; timeoutMs?: number; minElementCount?: number },
575
+ options?: DomImportOptions & {
576
+ settleMs?: number;
577
+ timeoutMs?: number;
578
+ minElementCount?: number;
579
+ },
399
580
  ): Promise<DomImportResult | null>;
400
581
  runScreenInteractions(
401
582
  iframe: HTMLIFrameElement,
@@ -423,6 +604,16 @@ export declare function createDesignScreenCollection(options: {
423
604
  captureDefaults?: DesignScreenCaptureDefaults;
424
605
  captureRequirements?: DesignScreenCaptureRequirements;
425
606
  }): DesignScreenCollectionResult;
607
+ export declare function expandDesignScreenCasesViewports(
608
+ cases: readonly DesignScreenCase[],
609
+ viewports: readonly DesignScreenViewport[],
610
+ options?: DesignScreenViewportExpansionOptions,
611
+ ): DesignScreenCase[];
612
+ export declare function expandDesignScreenCollectionViewports(
613
+ collection: DesignImportCollection,
614
+ viewports: readonly DesignScreenViewport[],
615
+ options?: DesignScreenViewportExpansionOptions,
616
+ ): DesignImportCollection;
426
617
  export declare function mergeScreenPresets(
427
618
  defaults?: DesignScreenPreset,
428
619
  override?: DesignScreenPreset,
@@ -439,12 +630,10 @@ export declare function setPygmalionPreviewRevision(revision: string): void;
439
630
  /** Sets the number of actual app iframes to run simultaneously in the entire editor. */
440
631
  export declare function setPygmalionPreviewConcurrency(value: number): void;
441
632
  /** Returns the adaptive live-preview lane count for the current browser. */
442
- export declare function getRecommendedPygmalionPreviewConcurrency(
443
- capabilities?: {
444
- hardwareConcurrency?: number;
445
- deviceMemory?: number;
446
- },
447
- ): number;
633
+ export declare function getRecommendedPygmalionPreviewConcurrency(capabilities?: {
634
+ hardwareConcurrency?: number;
635
+ deviceMemory?: number;
636
+ }): number;
448
637
  /** Removes all route screens fixed in memory and IndexedDB. If a namespace is given, only the corresponding cache is deleted. */
449
638
  export declare function clearPygmalionPreviewCache(namespace?: string): void;
450
639
  export declare const STORYBOARD_ENVIRONMENT_QUERY: string;
@@ -458,8 +647,7 @@ export declare function setStoryboardBaselineEnvironment(
458
647
  environment?: StoryboardEnvironment,
459
648
  ): void;
460
649
  export declare function getStoryboardBaselineEnvironment():
461
- | StoryboardEnvironment
462
- | undefined;
650
+ StoryboardEnvironment | undefined;
463
651
  export declare function mergeStoryboardEnvironment(
464
652
  base?: StoryboardEnvironment,
465
653
  override?: StoryboardEnvironment,
@@ -501,9 +689,494 @@ export interface RoutePreviewArtifactBundleV2 {
501
689
  >;
502
690
  }
503
691
 
692
+ export type RoutePreviewArtifactV3Status =
693
+ 'ready' | 'rendered-with-qa-failure' | 'capture-error';
694
+ export type RoutePreviewArtifactV3ScreenshotMediaType =
695
+ 'image/png' | 'image/webp';
696
+
697
+ export interface RoutePreviewArtifactV3Viewport {
698
+ readonly width: number;
699
+ readonly height: number;
700
+ }
701
+
702
+ export interface RoutePreviewArtifactV3Diagnostic {
703
+ readonly stage: string;
704
+ readonly code: string;
705
+ readonly selector?: string;
706
+ readonly label?: string;
707
+ readonly message?: string;
708
+ readonly viewport: RoutePreviewArtifactV3Viewport;
709
+ }
710
+
711
+ export interface RoutePreviewArtifactV3ScreenshotReference {
712
+ readonly hash: `sha256-${string}`;
713
+ readonly mediaType: RoutePreviewArtifactV3ScreenshotMediaType;
714
+ readonly width: number;
715
+ readonly height: number;
716
+ }
717
+
718
+ export interface RoutePreviewArtifactV3ScreenshotAsset {
719
+ readonly mediaType: RoutePreviewArtifactV3ScreenshotMediaType;
720
+ readonly width: number;
721
+ readonly height: number;
722
+ readonly data: string;
723
+ readonly byteLength: number;
724
+ }
725
+
726
+ export interface RoutePreviewArtifactV3Frame {
727
+ readonly status: RoutePreviewArtifactV3Status;
728
+ readonly viewport: RoutePreviewArtifactV3Viewport;
729
+ readonly snapshot?: RoutePreviewArtifactBundleV2['frames'][string];
730
+ readonly screenshot?: RoutePreviewArtifactV3ScreenshotReference;
731
+ readonly diagnostics: readonly RoutePreviewArtifactV3Diagnostic[];
732
+ }
733
+
734
+ export interface RoutePreviewArtifactBundleV3 {
735
+ readonly version: 3;
736
+ readonly namespace: string;
737
+ readonly sourceRevision?: string;
738
+ readonly assets: {
739
+ readonly head: RoutePreviewArtifactBundleV2['assets']['head'];
740
+ readonly stylesheets: RoutePreviewArtifactBundleV2['assets']['stylesheets'];
741
+ readonly screenshots: Readonly<
742
+ Record<string, RoutePreviewArtifactV3ScreenshotAsset>
743
+ >;
744
+ };
745
+ readonly frames: Readonly<Record<string, RoutePreviewArtifactV3Frame>>;
746
+ }
747
+
748
+ export interface RoutePreviewArtifactV3ValidationResult {
749
+ readonly valid: boolean;
750
+ readonly errors: string[];
751
+ readonly bytes: number;
752
+ }
753
+
754
+ export interface RoutePreviewArtifactV3ReconstructedScreenshot {
755
+ readonly mediaType: RoutePreviewArtifactV3ScreenshotMediaType;
756
+ readonly width: number;
757
+ readonly height: number;
758
+ readonly dataUrl: string;
759
+ }
760
+
504
761
  export type RoutePreviewArtifactBundle =
505
762
  | RoutePreviewArtifactBundleV1
506
- | RoutePreviewArtifactBundleV2;
763
+ | RoutePreviewArtifactBundleV2
764
+ | RoutePreviewArtifactBundleV3;
765
+
766
+ export declare function validateRoutePreviewArtifactV3Browser(
767
+ value: unknown,
768
+ ): RoutePreviewArtifactV3ValidationResult;
769
+ export declare function reconstructRoutePreviewArtifactSnapshotV3(
770
+ value: unknown,
771
+ frameId: string,
772
+ ): string | null;
773
+ export declare function reconstructRoutePreviewArtifactScreenshotV3(
774
+ value: unknown,
775
+ frameId: string,
776
+ ): RoutePreviewArtifactV3ReconstructedScreenshot | null;
777
+
778
+ export interface PreviewRecipeIdentity {
779
+ id: string;
780
+ recipe: unknown;
781
+ }
782
+
783
+ export interface PreviewCacheNamespaceOptions {
784
+ sourceRevision: string;
785
+ recipes: readonly PreviewRecipeIdentity[];
786
+ recipeVersion?: number;
787
+ scope?: string;
788
+ }
789
+
790
+ export type StoryboardCaptureRecipeInput = Pick<
791
+ DesignScreenCase,
792
+ | 'route'
793
+ | 'path'
794
+ | 'componentName'
795
+ | 'gallery'
796
+ | 'width'
797
+ | 'height'
798
+ | 'environment'
799
+ | 'preset'
800
+ | 'interactions'
801
+ | 'assertions'
802
+ >;
803
+
804
+ export interface PreviewArtifactExpectation {
805
+ namespace: string;
806
+ sourceRevision: string;
807
+ }
808
+
809
+ export interface PreviewArtifactTransportRequest extends PreviewArtifactExpectation {
810
+ signal?: AbortSignal;
811
+ captureBaseUrl?: string;
812
+ }
813
+
814
+ export type PreviewArtifactTransport = (
815
+ request: PreviewArtifactTransportRequest,
816
+ ) => Promise<unknown | null | undefined>;
817
+
818
+ export interface PreviewArtifactHttpResponse {
819
+ readonly ok: boolean;
820
+ json(): Promise<unknown>;
821
+ }
822
+
823
+ export type PreviewArtifactFetch = (
824
+ input: string,
825
+ init: {
826
+ method: 'GET';
827
+ headers: { accept: 'application/json' };
828
+ cache: 'no-store';
829
+ signal?: AbortSignal;
830
+ },
831
+ ) => Promise<PreviewArtifactHttpResponse>;
832
+
833
+ export interface PreviewArtifactHttpTransportOptions {
834
+ endpoint: string;
835
+ fetcher?: PreviewArtifactFetch;
836
+ captureBaseUrl?: string;
837
+ }
838
+
839
+ export type PreviewArtifactValidationReason =
840
+ 'invalid-bundle' | 'namespace-mismatch' | 'revision-mismatch';
841
+
842
+ export type PreviewArtifactValidationResult =
843
+ | {
844
+ valid: true;
845
+ artifact: RoutePreviewArtifactBundle;
846
+ errors: readonly [];
847
+ }
848
+ | {
849
+ valid: false;
850
+ artifact: null;
851
+ reason: PreviewArtifactValidationReason;
852
+ errors: readonly string[];
853
+ };
854
+
855
+ export type PreviewArtifactBootstrapResult =
856
+ | {
857
+ status: 'accepted';
858
+ artifact: RoutePreviewArtifactBundle;
859
+ }
860
+ | {
861
+ status: 'unavailable';
862
+ artifact: null;
863
+ error?: unknown;
864
+ }
865
+ | {
866
+ status: 'rejected';
867
+ artifact: null;
868
+ reason: PreviewArtifactValidationReason;
869
+ errors: readonly string[];
870
+ };
871
+
872
+ export declare function createPreviewRecipeFingerprint(
873
+ recipes: readonly PreviewRecipeIdentity[],
874
+ ): string;
875
+ export declare function createPreviewCacheNamespace(
876
+ options: PreviewCacheNamespaceOptions,
877
+ ): string;
878
+ export declare function createStoryboardCaptureRecipeIdentity(
879
+ screen: StoryboardCaptureRecipeInput,
880
+ ): unknown;
881
+ export declare function createPreviewArtifactHttpTransport(
882
+ options: PreviewArtifactHttpTransportOptions,
883
+ ): PreviewArtifactTransport;
884
+ export declare function validatePreviewArtifactBundle(
885
+ value: unknown,
886
+ expectation?: PreviewArtifactExpectation,
887
+ ): PreviewArtifactValidationResult;
888
+ export declare function bootstrapPreviewArtifact(
889
+ options: PreviewArtifactExpectation & {
890
+ transport: PreviewArtifactTransport;
891
+ signal?: AbortSignal;
892
+ },
893
+ ): Promise<PreviewArtifactBootstrapResult>;
894
+
895
+ export type StoryboardGraphEdgeOrigin = 'explicit' | 'inferred';
896
+
897
+ export interface StoryboardGraphEdgeInput {
898
+ id?: string;
899
+ from: string;
900
+ to: string;
901
+ kind?: string;
902
+ label?: string;
903
+ }
904
+
905
+ export interface StoryboardGraphBuildOptions {
906
+ screens: readonly DesignScreenCase[];
907
+ assets?: readonly DesignImportAsset[];
908
+ scenarios?: readonly DesignScenarioSource[];
909
+ explicitEdges?: readonly StoryboardGraphEdgeInput[];
910
+ inferredEdges?: readonly StoryboardGraphEdgeInput[];
911
+ startScreenIds?: readonly string[];
912
+ nonVisualScenarioIds?: readonly string[];
913
+ recipeKey?: (screen: DesignScreenCase) => string;
914
+ }
915
+
916
+ export interface StoryboardGraphNode {
917
+ id: string;
918
+ canonicalScreenId: string;
919
+ screenIds: readonly string[];
920
+ names: readonly string[];
921
+ recipeKey: string;
922
+ routes: readonly string[];
923
+ scenarioIds: readonly string[];
924
+ sourceKeys: readonly string[];
925
+ flows: readonly string[];
926
+ states: readonly string[];
927
+ }
928
+
929
+ export interface StoryboardGraphEdge {
930
+ id: string;
931
+ from: string;
932
+ to: string;
933
+ kind?: string;
934
+ label?: string;
935
+ origin: StoryboardGraphEdgeOrigin;
936
+ sourceEdgeIds: readonly string[];
937
+ }
938
+
939
+ export interface StoryboardGraphSourceGroup {
940
+ sourceKey: string;
941
+ nodeIds: readonly string[];
942
+ screenIds: readonly string[];
943
+ shared: boolean;
944
+ }
945
+
946
+ export interface StoryboardGraphBranch {
947
+ nodeId: string;
948
+ edgeIds: readonly string[];
949
+ targetNodeIds: readonly string[];
950
+ }
951
+
952
+ export type StoryboardGraphWarningCode =
953
+ | 'duplicate-screen-id'
954
+ | 'invalid-recipe'
955
+ | 'unknown-edge-source'
956
+ | 'unknown-edge-target'
957
+ | 'ambiguous-edge-source'
958
+ | 'ambiguous-edge-target'
959
+ | 'unknown-start-screen'
960
+ | 'disconnected-screen'
961
+ | 'missing-code-scenario';
962
+
963
+ export interface StoryboardGraphWarning {
964
+ code: StoryboardGraphWarningCode;
965
+ severity: 'warning' | 'error';
966
+ message: string;
967
+ screenId?: string;
968
+ nodeId?: string;
969
+ edgeId?: string;
970
+ scenarioId?: string;
971
+ }
972
+
973
+ export interface StoryboardGraphCoverage {
974
+ screens: number;
975
+ canonicalNodes: number;
976
+ mergedScreens: number;
977
+ edges: number;
978
+ connectedNodes: number;
979
+ disconnectedScreens: readonly string[];
980
+ codeScenarios: number;
981
+ representedScenarios: number;
982
+ missingScenarios: readonly string[];
983
+ complete: boolean;
984
+ }
985
+
986
+ export interface StoryboardGraph {
987
+ version: 1;
988
+ nodes: readonly StoryboardGraphNode[];
989
+ edges: readonly StoryboardGraphEdge[];
990
+ aliases: Readonly<Record<string, string>>;
991
+ sourceGroups: readonly StoryboardGraphSourceGroup[];
992
+ startNodeIds: readonly string[];
993
+ branches: readonly StoryboardGraphBranch[];
994
+ warnings: readonly StoryboardGraphWarning[];
995
+ coverage: StoryboardGraphCoverage;
996
+ }
997
+
998
+ export declare function storyboardScreenRecipeKey(
999
+ screen: DesignScreenCase,
1000
+ ): string;
1001
+ export declare function createStoryboardGraph(
1002
+ options: StoryboardGraphBuildOptions,
1003
+ ): StoryboardGraph;
1004
+
1005
+ export interface StoryboardFrameReference {
1006
+ frameId: string;
1007
+ screenId: string;
1008
+ name: string;
1009
+ }
1010
+
1011
+ export interface StoryboardGraphFrameView {
1012
+ frameId: string;
1013
+ screenId: string;
1014
+ name: string;
1015
+ nodeId: string;
1016
+ canonicalScreenId: string;
1017
+ canonicalFrameId?: string;
1018
+ isCanonical: boolean;
1019
+ isStart: boolean;
1020
+ isBranch: boolean;
1021
+ aliasScreenIds: readonly string[];
1022
+ relatedFrameIds: readonly string[];
1023
+ branchTargetFrameIds: readonly string[];
1024
+ warnings: readonly StoryboardGraphWarning[];
1025
+ }
1026
+
1027
+ export interface StoryboardGraphCanonicalView {
1028
+ nodeId: string;
1029
+ canonicalScreenId: string;
1030
+ canonicalFrameId?: string;
1031
+ aliasScreenIds: readonly string[];
1032
+ aliasFrameIds: readonly string[];
1033
+ }
1034
+
1035
+ export interface StoryboardGraphSourceView {
1036
+ sourceKey: string;
1037
+ frameIds: readonly string[];
1038
+ nodeIds: readonly string[];
1039
+ }
1040
+
1041
+ export interface StoryboardGraphViewModel {
1042
+ frames: readonly StoryboardGraphFrameView[];
1043
+ canonicalGroups: readonly StoryboardGraphCanonicalView[];
1044
+ sharedSources: readonly StoryboardGraphSourceView[];
1045
+ startFrameIds: readonly string[];
1046
+ branchFrameIds: readonly string[];
1047
+ warnings: readonly StoryboardGraphWarning[];
1048
+ unresolvedWarnings: readonly StoryboardGraphWarning[];
1049
+ coverage: StoryboardGraphCoverage;
1050
+ }
1051
+
1052
+ export declare function createStoryboardGraphViewModel(
1053
+ graph: StoryboardGraph,
1054
+ frameReferences: readonly StoryboardFrameReference[],
1055
+ ): StoryboardGraphViewModel;
1056
+ export declare function setStoryboardGraph(graph: StoryboardGraph | null): void;
1057
+ export declare function getStoryboardGraph(): StoryboardGraph | null;
1058
+ export declare function subscribeStoryboardGraph(
1059
+ listener: () => void,
1060
+ ): () => void;
1061
+
1062
+ export interface StoryboardDiscoveryScenario {
1063
+ id?: string;
1064
+ name?: string;
1065
+ section?: string;
1066
+ flow?: string;
1067
+ sourcePath?: string;
1068
+ description?: string;
1069
+ environment?: StoryboardEnvironment;
1070
+ }
1071
+
1072
+ export interface StoryboardDiscoveryCandidate {
1073
+ id?: string;
1074
+ route?: string;
1075
+ scenarioId?: string;
1076
+ environment?: StoryboardEnvironment;
1077
+ }
1078
+
1079
+ export interface StoryboardDiscoveryEdge {
1080
+ id?: string;
1081
+ from?: string;
1082
+ to?: string;
1083
+ kind?: string;
1084
+ label?: string;
1085
+ unresolvedTarget?: boolean;
1086
+ }
1087
+
1088
+ export interface StoryboardDiscoveryRoute {
1089
+ id?: string;
1090
+ path?: string;
1091
+ }
1092
+
1093
+ export interface StoryboardDiscoveryManifest {
1094
+ version?: number;
1095
+ routes?: readonly StoryboardDiscoveryRoute[];
1096
+ scenarios?: readonly StoryboardDiscoveryScenario[];
1097
+ candidates?: readonly StoryboardDiscoveryCandidate[];
1098
+ edges?: readonly StoryboardDiscoveryEdge[];
1099
+ }
1100
+
1101
+ export interface StoryboardResolvedPage {
1102
+ id: string;
1103
+ name: string;
1104
+ canvas?: string;
1105
+ section?: string;
1106
+ importKind?: DesignImportKind;
1107
+ componentName?: string;
1108
+ gallery?: string[];
1109
+ route?: string;
1110
+ path?: string;
1111
+ publish?: boolean;
1112
+ width?: number;
1113
+ height?: number;
1114
+ frameSizeMode?: DesignFrameSizeMode;
1115
+ heightMode?: DesignFrameHeightMode;
1116
+ maxHeight?: number;
1117
+ sourcePaths?: string[];
1118
+ flow?: string;
1119
+ scenario?: string;
1120
+ state?: string;
1121
+ scenarioId?: string;
1122
+ interactions?: readonly DesignScreenInteraction[];
1123
+ environment?: StoryboardEnvironment;
1124
+ preset?: DesignScreenPreset;
1125
+ assertions?: readonly DesignScreenAssertion[];
1126
+ }
1127
+
1128
+ export interface StoryboardDiscoveryGraphOptions {
1129
+ manifest: StoryboardDiscoveryManifest;
1130
+ pages: readonly StoryboardResolvedPage[];
1131
+ assets?: readonly DesignImportAsset[];
1132
+ }
1133
+
1134
+ export interface StoryboardDiscoveryResult {
1135
+ manifest: StoryboardDiscoveryManifest;
1136
+ baselineEnvironment?: StoryboardEnvironment;
1137
+ graph: StoryboardGraph;
1138
+ }
1139
+
1140
+ export interface StoryboardDiscoveryResponse {
1141
+ ok: boolean;
1142
+ status: number;
1143
+ json(): Promise<unknown>;
1144
+ }
1145
+
1146
+ export type StoryboardDiscoveryFetch = (
1147
+ endpoint: string,
1148
+ init: {
1149
+ headers: { accept: 'application/json' };
1150
+ cache: 'no-store';
1151
+ signal?: AbortSignal;
1152
+ },
1153
+ ) => Promise<StoryboardDiscoveryResponse>;
1154
+
1155
+ export interface LoadStoryboardDiscoveryOptions extends Omit<
1156
+ StoryboardDiscoveryGraphOptions,
1157
+ 'manifest'
1158
+ > {
1159
+ endpoint: string;
1160
+ signal?: AbortSignal;
1161
+ fetcher?: StoryboardDiscoveryFetch;
1162
+ }
1163
+
1164
+ export declare function resolveStoryboardScreenCases(
1165
+ pages: readonly StoryboardResolvedPage[],
1166
+ manifest: StoryboardDiscoveryManifest,
1167
+ ): DesignScreenCase[];
1168
+ export declare function getStoryboardDiscoveryBaselineEnvironment(
1169
+ manifest: StoryboardDiscoveryManifest,
1170
+ ): StoryboardEnvironment | undefined;
1171
+ export declare function createStoryboardGraphFromDiscovery(
1172
+ options: StoryboardDiscoveryGraphOptions,
1173
+ ): StoryboardGraph;
1174
+ export declare function loadStoryboardDiscovery(
1175
+ options: LoadStoryboardDiscoveryOptions,
1176
+ ): Promise<StoryboardDiscoveryResult>;
1177
+ export declare function publishStoryboardDiscovery(
1178
+ options: LoadStoryboardDiscoveryOptions,
1179
+ ): Promise<StoryboardDiscoveryResult>;
507
1180
 
508
1181
  export interface InitialPageDef {
509
1182
  name: string;
@@ -524,6 +1197,9 @@ export interface InitialPageDef {
524
1197
  /** Frame size (px) — 390×600 (mobile) if not specified. */
525
1198
  width?: number;
526
1199
  height?: number;
1200
+ frameSizeMode?: DesignFrameSizeMode;
1201
+ heightMode?: DesignFrameHeightMode;
1202
+ maxHeight?: number;
527
1203
  /** Immediately after the first render, the entire actual DOM is imported into the layer tree. */
528
1204
  importLayers?: boolean;
529
1205
  importPageId?: string;
@@ -701,7 +1377,8 @@ export interface InspectApplyResult {
701
1377
  /** Modification session branch created by the host. */
702
1378
  branch?: string;
703
1379
  /** Result of merging with latest development code. */
704
- integration?: 'up_to_date' | 'auto_merged' | 'review_required' | 'conflict' | 'offline';
1380
+ integration?:
1381
+ 'up_to_date' | 'auto_merged' | 'review_required' | 'conflict' | 'offline';
705
1382
  /** Text of application results to show to the designer. */
706
1383
  message?: string;
707
1384
  /** Comparison of DOM·PNG recapture of the impact screen immediately after application. */
@@ -772,11 +1449,7 @@ export interface InspectQaCaptureRequest {
772
1449
  }
773
1450
 
774
1451
  export type PygmalionIntegrationState =
775
- | 'up_to_date'
776
- | 'auto_merged'
777
- | 'review_required'
778
- | 'conflict'
779
- | 'offline';
1452
+ 'up_to_date' | 'auto_merged' | 'review_required' | 'conflict' | 'offline';
780
1453
 
781
1454
  export interface PygmalionDevMirrorStatus {
782
1455
  state: 'idle' | 'syncing' | 'ready' | 'error';
@@ -814,8 +1487,7 @@ export interface PygmalionVisualRevertOperation {
814
1487
  }
815
1488
 
816
1489
  export type PygmalionSessionOperation =
817
- | PygmalionVisualOperation
818
- | PygmalionVisualRevertOperation;
1490
+ PygmalionVisualOperation | PygmalionVisualRevertOperation;
819
1491
 
820
1492
  export interface PygmalionDesignSessionStatus {
821
1493
  id: string;
@@ -904,6 +1576,8 @@ export declare function PygmalionEditor(props: {
904
1576
  previewCacheNamespace?: string;
905
1577
  /** A canonical screen snapshot created during build. When the namespace matches, it is injected into the cache before the first render. */
906
1578
  previewArtifacts?: RoutePreviewArtifactBundle;
1579
+ /** Same-origin endpoint that resolves an exact namespace and source revision. */
1580
+ previewArtifactEndpoint?: string;
907
1581
  /** Number of actual app previews to run simultaneously. Defaults to an adaptive 12–32 lanes. */
908
1582
  previewConcurrency?: number;
909
1583
  /** Controlled by external status such as host route ▶ Whether the preview is opened or not. */
@@ -915,11 +1589,17 @@ export declare function PygmalionEditor(props: {
915
1589
  /** Reflect button — Returns { branch } after the host saves the file and commits the branch (push is done directly by the user). */
916
1590
  onApply?: (payload: ApplyPayload) => Promise<{ branch: string } | void>;
917
1591
  /** Code auto-save path that does not differentiate between icon/token/atom/component/screen. */
918
- onDesignChange?: (payload: DesignChangePayload) => Promise<DesignChangeResult | void>;
1592
+ onDesignChange?: (
1593
+ payload: DesignChangePayload,
1594
+ ) => Promise<DesignChangeResult | void>;
919
1595
  /** Apply inspection edits through the host write-back endpoint. */
920
- onInspectApply?: (payload: InspectApplyPayload) => Promise<InspectApplyResult | void>;
1596
+ onInspectApply?: (
1597
+ payload: InspectApplyPayload,
1598
+ ) => Promise<InspectApplyResult | void>;
921
1599
  /** Preview the code diff before applying. If connected, the Apply button is locked before confirmation. */
922
- onInspectPreview?: (payload: InspectApplyPayload) => Promise<InspectPreviewResult>;
1600
+ onInspectPreview?: (
1601
+ payload: InspectApplyPayload,
1602
+ ) => Promise<InspectPreviewResult>;
923
1603
  /** Check the reverse dependency closure of the changed source file. */
924
1604
  onInspectImpact?: (componentFiles: string[]) => Promise<InspectImpactResult>;
925
1605
  /** Detect portable browser branches from source before route frames boot. Default true. */
@@ -944,4 +1624,8 @@ export declare function pygmalionResetCurrentEdits(): boolean;
944
1624
 
945
1625
  /** For host debugging — editor store·mobx inspection utility (instance in bundle). */
946
1626
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
947
- export declare const __debug: { editor: any; getObserverTree: any; isObservableProp: any };
1627
+ export declare const __debug: {
1628
+ editor: any;
1629
+ getObserverTree: any;
1630
+ isObservableProp: any;
1631
+ };