@pygmalionjs/pygmalion 0.5.13 → 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 (110) 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/node/dev-mirror.mjs +142 -1
  107. package/node/dev-view.vite.mjs +37 -0
  108. package/package.json +7 -8
  109. package/testing.d.ts +0 -26
  110. package/types.d.ts +0 -2675
@@ -0,0 +1,117 @@
1
+ import { lightenHex } from './bannerStyle';
2
+ import type { PageModel } from './store';
3
+ export { lightenHex };
4
+ /** Host-declared description of one canvas section. */
5
+ export interface SectionHeaderDef {
6
+ /** Section name exactly as the frames carry it — the join key. */
7
+ section: string;
8
+ /** Short handle shown large, e.g. "02". */
9
+ code: string;
10
+ /** Section title, e.g. "care". */
11
+ title: string;
12
+ /** Secondary clause after the title: what kind of group this is. */
13
+ kind?: string;
14
+ /** One line a planner needs: what the section covers. */
15
+ purpose: string;
16
+ /** Accent colour for the rule and the category pill. */
17
+ accent: string;
18
+ /** Category shown in the pill. */
19
+ pill?: string;
20
+ }
21
+ /**
22
+ * Words for the facts the core counts. Defaults are English; a host renders
23
+ * its own language by declaring them, which is how the band stays localized
24
+ * without the core carrying any copy of its own.
25
+ */
26
+ export interface SectionHeaderLabels {
27
+ /** Caption above the code. Default "SECTION". */
28
+ code?: string;
29
+ /** Unit for the frame count. Default "frames". */
30
+ frames?: string;
31
+ /** Unit for folded state variants. Default "folded". */
32
+ folded?: string;
33
+ /** Unit for the scenario count. Default "scenarios". */
34
+ scenarios?: string;
35
+ /** Unit for the flow list. Default "flows". */
36
+ flows?: string;
37
+ }
38
+ export interface SectionHeaderDiagnostic {
39
+ severity: 'error' | 'warning';
40
+ section: string;
41
+ message: string;
42
+ }
43
+ export interface SectionHeaderFacts {
44
+ /** Every frame that belongs to the section, folded variants included. */
45
+ frameCount: number;
46
+ /** Members parked behind a slot holder rather than shown on the canvas. */
47
+ foldedCount: number;
48
+ /** Distinct canonical scenario ids among the members. */
49
+ scenarioCount: number;
50
+ /** Distinct flows, only worth showing when a section spans more than one. */
51
+ flows: string[];
52
+ /** Authored viewport shared by the members, or null when there is no one answer. */
53
+ viewport: string | null;
54
+ }
55
+ export declare function resolveSectionHeaderLabels(labels: SectionHeaderLabels | undefined): Required<SectionHeaderLabels>;
56
+ export declare function validateSectionHeaders(defs: readonly SectionHeaderDef[], context: {
57
+ sections: readonly string[];
58
+ }): SectionHeaderDiagnostic[];
59
+ /**
60
+ * What the core can see about a section without being told. `isShown` marks
61
+ * the members holding a canvas slot; the rest are folded state variants.
62
+ */
63
+ export declare function sectionHeaderFacts(pages: readonly PageModel[], options?: {
64
+ isShown?: (page: PageModel) => boolean;
65
+ }): SectionHeaderFacts;
66
+ /**
67
+ * The derived line, in the order a reviewer scans it. Facts that would only
68
+ * repeat the title are left out: a single flow is always the section itself,
69
+ * and a section with no scenarios has nothing to say about coverage.
70
+ */
71
+ export declare function sectionHeaderFactLine(facts: SectionHeaderFacts, labels: Required<SectionHeaderLabels>): string;
72
+ export declare const SECTION_HEADER_STYLE: {
73
+ readonly radius: 12;
74
+ readonly pillRadius: 999;
75
+ readonly ruleWidth: 6;
76
+ readonly gap: 24;
77
+ readonly paddingY: 20;
78
+ readonly paddingRight: 32;
79
+ readonly captionSize: 12;
80
+ readonly codeSize: 40;
81
+ readonly titleSize: 32;
82
+ readonly metaSize: 15;
83
+ readonly pillSize: 12;
84
+ readonly pillPaddingY: 6;
85
+ readonly pillPaddingX: 14;
86
+ readonly surface: "#343441";
87
+ readonly pillSurface: "#2e2c3a";
88
+ readonly caption: "#a1a1b3";
89
+ readonly code: "#ffffff";
90
+ readonly title: "#e7e7f0";
91
+ readonly titleMuted: "#a1a1b3";
92
+ readonly meta: "#bebecb";
93
+ readonly purpose: "#c4ccd8";
94
+ };
95
+ /**
96
+ * Room the band needs above a section box, in canvas units. Sections used to
97
+ * stack 120px apart with 28px of box padding at each end, leaving 64px — less
98
+ * than half a band — so the layout reserves this instead. Both the renderer
99
+ * and the layout read it from here so they cannot drift apart.
100
+ *
101
+ * Sized for a purpose line that wraps once at section width; a purpose long
102
+ * enough to take three lines is an authoring problem, not a layout one.
103
+ */
104
+ export declare const SECTION_HEADER_RESERVE = 176;
105
+ /**
106
+ * Widest a band is allowed to be, in canvas units.
107
+ *
108
+ * A band spanning its section reached 4333px on the care canvas, which put the
109
+ * category pill several screens to the right of the code it belongs to — the
110
+ * identity stopped reading as one object. A banner is a label, so it takes a
111
+ * measure a reader can take in at once and stops.
112
+ */
113
+ export declare const SECTION_HEADER_MAX_WIDTH = 1280;
114
+ export declare function setSectionHeaders(defs: readonly SectionHeaderDef[], labels?: SectionHeaderLabels): void;
115
+ export declare function getSectionHeaders(): readonly SectionHeaderDef[];
116
+ export declare function getSectionHeaderLabels(): SectionHeaderLabels | undefined;
117
+ export declare function sectionHeaderFor(section: string): SectionHeaderDef | null;
@@ -0,0 +1,103 @@
1
+ export interface PreparedShadowPreview {
2
+ bodyHtml: string;
3
+ sharedCssText: string;
4
+ stylesheetLinksHtml: string;
5
+ }
6
+ export interface ShadowPreviewMountInput {
7
+ /** A complete script-less document snapshot. */
8
+ snapshot?: string;
9
+ /** A body fragment to use instead of a complete snapshot. */
10
+ bodyHtml?: string;
11
+ /** Common CSS that is pooled with styles extracted from the snapshot. */
12
+ sharedCssText?: string;
13
+ /** Content-addressed styles attached independently without frame-level concatenation. */
14
+ sharedStylesheets?: readonly {
15
+ key: string;
16
+ cssText: string;
17
+ }[];
18
+ /** Serialized document attributes used by compact body-only artifacts. */
19
+ htmlAttributes?: string;
20
+ bodyAttributes?: string;
21
+ /** External stylesheet links retained by compact body-only artifacts. */
22
+ stylesheetLinksHtml?: string;
23
+ /** An optional verified cache identity for sharedCssText. */
24
+ sharedCssHash?: string;
25
+ /** A stable channel shared by related previews. */
26
+ overrideKey?: string;
27
+ /** CSS that can change without rebuilding or parsing the common stylesheet. */
28
+ overrideCssText?: string;
29
+ /** Resolves relative element and CSS resource URLs. */
30
+ baseUrl?: string;
31
+ }
32
+ export interface ShadowPreviewHandle {
33
+ readonly root: ShadowRoot;
34
+ readonly contentElement: HTMLElement;
35
+ readonly sharedCssHash: string;
36
+ readonly overrideKey: string;
37
+ updateBodyHtml(bodyHtml: string, baseUrl?: string): void;
38
+ updateOverrideCss(cssText: string): void;
39
+ updateSharedCss(cssText: string): void;
40
+ teardown(): void;
41
+ }
42
+ export interface ShadowDomMutation {
43
+ key: string;
44
+ selector: string;
45
+ text?: string;
46
+ textNodeOrdinal?: number;
47
+ hidden?: boolean;
48
+ attributes?: Record<string, string | null>;
49
+ replaceChildrenHtml?: string;
50
+ staleReason?: string;
51
+ }
52
+ export interface ShadowDomMutationResult {
53
+ cleanup(): void;
54
+ issues: string[];
55
+ }
56
+ interface AcquiredStyle {
57
+ release(): void;
58
+ }
59
+ /** A deterministic content hash suitable for in-memory stylesheet pooling. */
60
+ export declare function hashShadowPreviewCss(cssText: string): string;
61
+ /** Rejects active content before it reaches a live document or ShadowRoot. */
62
+ export declare function assertSafeShadowPreviewMarkup(markup: string): void;
63
+ /**
64
+ * Splits a safe document snapshot into the lightweight parts needed by a
65
+ * ShadowRoot. Inline styles become one pooled stylesheet instead of being
66
+ * repeated in every preview.
67
+ */
68
+ export declare function prepareShadowPreview(input: Pick<ShadowPreviewMountInput, 'snapshot' | 'bodyHtml' | 'sharedCssText'>): PreparedShadowPreview;
69
+ /** Resolves CSS url() and @import references without touching data/blob/hash URLs. */
70
+ export declare function rebaseShadowPreviewCss(cssText: string, baseUrl: string | undefined): string;
71
+ /**
72
+ * Applies serializable DOM edits to a frozen preview. The returned cleanup
73
+ * restores the exact previous DOM state in reverse mutation order.
74
+ */
75
+ export declare function applyShadowDomMutations(root: ParentNode, mutations: readonly ShadowDomMutation[], options?: {
76
+ baseUrl?: string;
77
+ }): ShadowDomMutationResult;
78
+ /**
79
+ * Owns content-addressed common styles and mutable override channels.
80
+ * Constructable stylesheets are shared by reference. Browsers without them
81
+ * receive one synchronized style element per mounted root.
82
+ */
83
+ export declare class ShadowPreviewStylePool {
84
+ private readonly sharedStyles;
85
+ private readonly overrideStyles;
86
+ private acquire;
87
+ private replaceEntryText;
88
+ acquireShared(root: ShadowRoot, hash: string, cssText: string): AcquiredStyle;
89
+ acquireSharedMany(root: ShadowRoot, styles: readonly {
90
+ key: string;
91
+ cssText: string;
92
+ }[]): AcquiredStyle;
93
+ acquireOverride(root: ShadowRoot, key: string, cssText: string): AcquiredStyle;
94
+ /** Updates every root using this shared style without rebuilding its DOM. */
95
+ updateSharedCss(hash: string, cssText: string): boolean;
96
+ /** Updates every mounted preview subscribed to the same override channel. */
97
+ updateOverrideCss(key: string, cssText: string): boolean;
98
+ dispose(): void;
99
+ }
100
+ export declare const defaultShadowPreviewStylePool: ShadowPreviewStylePool;
101
+ /** Mounts a script-less, non-interactive preview with pooled common styles. */
102
+ export declare function mountFrozenShadowPreview(host: HTMLElement, input: ShadowPreviewMountInput, stylePool?: ShadowPreviewStylePool): ShadowPreviewHandle;
103
+ export {};
@@ -0,0 +1,40 @@
1
+ import type { NodeModel, PageModel } from './store';
2
+ /**
3
+ * The smallest unit that connects DOMs rendered multiple times from one source.
4
+ * - Within the registry component, importPath is used as scope.
5
+ * - Other screen DOMs use structural paths within the same route.
6
+ * - If the editing range is shared, not only the style but also text/props/visibility are the same.
7
+ * It is immediately reflected in all source instances.
8
+ * - When the runtime state needs to be maintained for each screen, the user selects the instance range.
9
+ */
10
+ export declare const SHARED_SOURCE_PATCH_KEYS: readonly ["type", "widthMode", "width", "heightMode", "height", "gap", "padding", "justify", "alignItems", "fill", "radius", "borderWidth", "borderColor", "opacity", "fontSize", "fontWeight", "color", "textAlign", "hidden", "text", "componentName", "componentProps", "childrenText", "domAttributes", "domStyle"];
11
+ export type SharedSourcePatchKey = (typeof SHARED_SOURCE_PATCH_KEYS)[number];
12
+ export type SharedSourcePatch = Partial<Pick<NodeModel, SharedSourcePatchKey>>;
13
+ export type SharedSourceEditScope = 'shared' | 'instance';
14
+ export interface SharedSourceFrameSummary {
15
+ id: string;
16
+ name: string;
17
+ }
18
+ export interface SharedSourceImpact {
19
+ sourceKey: string;
20
+ frames: SharedSourceFrameSummary[];
21
+ nodeCount: number;
22
+ }
23
+ /** In the edit patch, copy only fields that can be safely shared in the actual source style. */
24
+ export declare function pickSharedSourcePatch(partial: Partial<NodeModel>): SharedSourcePatch;
25
+ export declare function cloneSharedSourcePatch(patch: SharedSourcePatch): SharedSourcePatch;
26
+ export declare function hasSharedSourcePatch(patch: SharedSourcePatch): boolean;
27
+ /** A safe CSS representation of a shared patch that can be immediately injected into a frozen DOM preview. */
28
+ export declare function sharedSourcePatchCssDeclarations(patch: SharedSourcePatch): Record<string, string>;
29
+ /** Page-only fallback scope. When a component scope is found, it is replaced in the corresponding subtree. */
30
+ export declare function sharedPageScope(page: Pick<PageModel, 'id' | 'route' | 'sourcePaths' | 'importPageId'>): string;
31
+ /**
32
+ * Provides a reproducible sourceKey to the DOM tree.
33
+ * Do not globally connect with the same tag/testid and be sure to
34
+ * Includes component/page scope + parent structure path + identical sibling occurrences.
35
+ */
36
+ export declare function bindSharedSourceTree(root: NodeModel, page: PageModel): void;
37
+ export declare function visitSourceNodes(root: NodeModel, visit: (node: NodeModel) => void): void;
38
+ /** How many frames and layers the sourceKey actually connects to. Used to display the UI influence range. */
39
+ export declare function sharedSourceImpact(pages: readonly PageModel[], sourceKey: string): SharedSourceImpact;
40
+ export declare function applySharedSourceOverrides(root: NodeModel, overrides: ReadonlyMap<string, SharedSourcePatch>): void;
@@ -0,0 +1,27 @@
1
+ import type { InspectApplyPayload, SourceEditScope, SourceIdentity } from './inspect';
2
+ import type { NodeModel, PageModel } from './store';
3
+ type JournalNode = Pick<NodeModel, 'id' | 'type' | 'children' | 'domAttributes' | 'sourceStyle' | 'text' | 'gap' | 'padding' | 'justify' | 'alignItems' | 'fill' | 'radius' | 'borderWidth' | 'borderColor' | 'opacity' | 'fontSize' | 'fontWeight' | 'color' | 'textAlign' | 'domStyle' | 'sourceProps'>;
4
+ type JournalPage = Pick<PageModel, 'id' | 'importPageId' | 'name' | 'root'>;
5
+ type ParseSourceIdentity = (raw: string | null | undefined) => SourceIdentity | null;
6
+ export interface SourceJournalSnapshot {
7
+ revision: number;
8
+ payload: InspectApplyPayload;
9
+ }
10
+ /**
11
+ * A source-backed baseline journal in a regular canvas patch.
12
+ * The baseline is maintained even after ack, so undo appears again as a reverse source change.
13
+ */
14
+ export declare class SourcePatchJournal {
15
+ private baselines;
16
+ private parseIdentity;
17
+ revision: number;
18
+ constructor(parseIdentity: ParseSourceIdentity);
19
+ captureBefore(pages: readonly JournalPage[], nodeId: string, partial: Partial<JournalNode>): boolean;
20
+ markContextChanged(): void;
21
+ /** After restoring the canvas based on the last reflection standard, the remaining pending baselines are also discarded. */
22
+ discard(): void;
23
+ markModelRestored(): void;
24
+ snapshot(pages: readonly JournalPage[], scopeForNode: (nodeId: string, identity: SourceIdentity) => SourceEditScope): SourceJournalSnapshot;
25
+ ack(expectedRevision: number, pages: readonly JournalPage[], scopeForNode: (nodeId: string, identity: SourceIdentity) => SourceEditScope): boolean;
26
+ }
27
+ export {};