@pygmalionjs/pygmalion 0.7.4 → 0.8.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.ko.md +17 -2
- package/README.md +18 -2
- package/dist-lib/CameraLayer-nkNrazn8.js +159 -0
- package/dist-lib/pygmalion.js +14628 -16995
- package/dist-lib/runtime-DdYnT6k4.js +19705 -0
- package/dist-lib/style.css +1 -1
- package/dist-lib/testing.js +20 -21
- package/dist-lib/types/EditorShell.d.ts +1 -1
- package/dist-lib/types/canvas/CameraLayer.d.ts +3 -3
- package/dist-lib/types/canvas/Canvas.d.ts +2 -2
- package/dist-lib/types/canvas/FrameLabelBanner.d.ts +1 -1
- package/dist-lib/types/canvas/FrameView.d.ts +8 -2
- package/dist-lib/types/canvas/FrozenRoutePreview.d.ts +1 -1
- package/dist-lib/types/canvas/InspectOverlay.d.ts +4 -2
- package/dist-lib/types/canvas/LightweightCanvas.d.ts +1 -1
- package/dist-lib/types/canvas/SectionBoxes.d.ts +1 -1
- package/dist-lib/types/canvas/ShadowRoutePreview.d.ts +2 -2
- package/dist-lib/types/canvas/useFlowSession.d.ts +1 -1
- package/dist-lib/types/canvas/useFrameLod.d.ts +1 -1
- package/dist-lib/types/contract/transport.d.ts +5 -5
- package/dist-lib/types/contract/types.d.ts +1 -1
- package/dist-lib/types/contract/validate.d.ts +3 -3
- package/dist-lib/types/core/context.d.ts +2 -2
- package/dist-lib/types/core/debug.d.ts +14 -14
- package/dist-lib/types/core/hostBindings.d.ts +2 -2
- package/dist-lib/types/core/runtime.d.ts +34 -3
- package/dist-lib/types/core/runtimeContext.d.ts +3 -3
- package/dist-lib/types/core/schedulers.d.ts +67 -0
- package/dist-lib/types/editor/assetEditing.d.ts +2 -2
- package/dist-lib/types/editor/automaticMotion.d.ts +0 -11
- package/dist-lib/types/editor/automaticPseudoStates.d.ts +8 -2
- package/dist-lib/types/editor/captureSupply.d.ts +16 -7
- package/dist-lib/types/editor/catalog.d.ts +2 -2
- package/dist-lib/types/editor/codegen.d.ts +6 -3
- package/dist-lib/types/editor/componentConnections.d.ts +13 -8
- package/dist-lib/types/editor/componentInstances.d.ts +2 -2
- package/dist-lib/types/editor/declarations.d.ts +107 -0
- package/dist-lib/types/editor/designCompiler.d.ts +9 -4
- package/dist-lib/types/editor/designImport.d.ts +48 -12
- package/dist-lib/types/editor/documentSync.d.ts +28 -25
- package/dist-lib/types/editor/domImport.d.ts +2 -2
- package/dist-lib/types/editor/fiberMap.d.ts +1 -1
- package/dist-lib/types/editor/flowSessionScheduler.d.ts +106 -159
- package/dist-lib/types/editor/flowSessions.d.ts +147 -84
- package/dist-lib/types/editor/frameInteraction.d.ts +22 -32
- package/dist-lib/types/editor/frameLabels.d.ts +11 -5
- package/dist-lib/types/editor/frameLanes.d.ts +14 -17
- package/dist-lib/types/editor/frameLod.d.ts +17 -0
- package/dist-lib/types/editor/frameLodRuntime.d.ts +38 -38
- package/dist-lib/types/editor/framePreviewKeys.d.ts +14 -5
- package/dist-lib/types/editor/frozenImport.d.ts +13 -14
- package/dist-lib/types/editor/heldPseudoStates.d.ts +1 -1
- package/dist-lib/types/editor/host.d.ts +10 -55
- package/dist-lib/types/editor/implementationSourceMap.d.ts +2 -2
- package/dist-lib/types/editor/importFidelity.d.ts +1 -1
- package/dist-lib/types/editor/inspect.d.ts +7 -2
- package/dist-lib/types/editor/interactiveSessionSurface.d.ts +26 -34
- package/dist-lib/types/editor/interactiveStates.d.ts +12 -10
- package/dist-lib/types/editor/livePreviewInstances.d.ts +13 -3
- package/dist-lib/types/editor/liveScreens.d.ts +25 -16
- package/dist-lib/types/editor/mountScheduler.d.ts +8 -11
- package/dist-lib/types/editor/nodeSelector.d.ts +1 -1
- package/dist-lib/types/editor/pendingSourceChanges.d.ts +19 -0
- package/dist-lib/types/editor/previewBootstrap.d.ts +12 -22
- package/dist-lib/types/editor/previewCaptureProgress.d.ts +10 -6
- package/dist-lib/types/editor/previewEnvironmentControls.d.ts +14 -17
- package/dist-lib/types/editor/previewIntent.d.ts +11 -16
- package/dist-lib/types/editor/previewSweep.d.ts +7 -3
- package/dist-lib/types/editor/previewWarmup.d.ts +19 -7
- package/dist-lib/types/editor/projectRuntime.d.ts +2 -2
- package/dist-lib/types/editor/registry.d.ts +6 -2
- package/dist-lib/types/editor/revisionCatalog.d.ts +19 -19
- package/dist-lib/types/editor/revisionCatalogInstall.d.ts +18 -17
- package/dist-lib/types/editor/routePreview.d.ts +85 -139
- package/dist-lib/types/editor/scenarioCoverage.d.ts +52 -20
- package/dist-lib/types/editor/screenCards.d.ts +10 -6
- package/dist-lib/types/editor/screenDimensions.d.ts +9 -5
- package/dist-lib/types/editor/screenFlows.d.ts +8 -5
- package/dist-lib/types/editor/screenInteractions.d.ts +9 -1
- package/dist-lib/types/editor/screenLists.d.ts +8 -4
- package/dist-lib/types/editor/screenStateGroups.d.ts +1 -1
- package/dist-lib/types/editor/sectionHeaders.d.ts +10 -6
- package/dist-lib/types/editor/sessionPresets.d.ts +12 -32
- package/dist-lib/types/editor/shadowPreview.d.ts +7 -10
- package/dist-lib/types/editor/sharedSource.d.ts +4 -2
- package/dist-lib/types/editor/sourceChangeSummary.d.ts +1 -1
- package/dist-lib/types/editor/sourceJournal.d.ts +2 -2
- package/dist-lib/types/editor/stateSwitchMetrics.d.ts +68 -82
- package/dist-lib/types/editor/store.d.ts +88 -22
- package/dist-lib/types/editor/storyboardAuthored.d.ts +2 -2
- package/dist-lib/types/editor/storyboardDiscovery.d.ts +4 -3
- package/dist-lib/types/editor/storyboardEnvironment.d.ts +9 -5
- package/dist-lib/types/editor/storyboardGraph.d.ts +1 -1
- package/dist-lib/types/editor/storyboardGraphRuntime.d.ts +8 -10
- package/dist-lib/types/editor/storyboardGraphView.d.ts +1 -1
- package/dist-lib/types/editor/storyboardJourney.d.ts +1 -1
- package/dist-lib/types/editor/surfaceDemands.d.ts +196 -31
- package/dist-lib/types/editor/tokens.d.ts +24 -25
- package/dist-lib/types/editor/variantAxes.d.ts +70 -0
- package/dist-lib/types/editor/variantPrefetch.d.ts +26 -43
- package/dist-lib/types/editor/viewportPresets.d.ts +6 -6
- package/dist-lib/types/editor/visualQa.d.ts +2 -2
- package/dist-lib/types/lib.d.ts +104 -108
- package/dist-lib/types/shell/CatalogAssetPanel.d.ts +1 -1
- package/dist-lib/types/shell/CodePanel.d.ts +1 -1
- package/dist-lib/types/shell/ComponentStateControls.d.ts +7 -53
- package/dist-lib/types/shell/FrameInspector.d.ts +17 -0
- package/dist-lib/types/shell/FrameReviewDetails.d.ts +28 -0
- package/dist-lib/types/shell/LayerTree.d.ts +1 -1
- package/dist-lib/types/shell/StoryboardGraphPanel.d.ts +2 -2
- package/dist-lib/types/shell/VariantPanel.d.ts +23 -0
- package/dist-lib/types/shell/inspectorControls.d.ts +34 -0
- package/dist-lib/types/shell/qaPresentation.d.ts +1 -1
- package/dist-lib/types/testing.d.ts +5 -6
- package/dist-lib/types/ui/SourceRefControl.d.ts +1 -1
- package/docs/coverage-contracts.md +431 -0
- package/docs/screen-state-contract.md +14 -16
- package/node/component-branches.mjs +7 -13
- package/node/design-session.mjs +3 -5
- package/node/dev-mirror.mjs +9 -6
- package/node/envelope.mjs +43 -0
- package/node/impact-frames.mjs +94 -0
- package/node/inspect-plugin.mjs +12 -6
- package/node/preview-artifact-plugin.mjs +3 -9
- package/node/qa-capture-plugin.mjs +3 -6
- package/node/source-graph.mjs +1 -0
- package/node/storyboard-environment.mjs +33 -6
- package/node/vite.mjs +1 -0
- package/package.json +7 -2
- package/dist-lib/CameraLayer-D2wrEPwG.js +0 -415
- package/dist-lib/frameLodRuntime-CU0IYaSu.js +0 -272
- package/dist-lib/runtime-DRkTU9eq.js +0 -16195
- package/dist-lib/types/core/defaultRuntime.d.ts +0 -3
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import type { EditorStore } from '../editor/store';
|
|
2
|
-
import type { HostBindings, HostCallbacks } from './hostBindings';
|
|
3
|
-
import type { EditorRuntime } from './runtime';
|
|
1
|
+
import type { EditorStore } from '../editor/store.js';
|
|
2
|
+
import type { HostBindings, HostCallbacks } from './hostBindings.js';
|
|
3
|
+
import type { EditorRuntime } from './runtime.js';
|
|
4
4
|
export declare const EditorRuntimeContext: import("react").Context<EditorRuntime | null>;
|
|
5
5
|
export declare function useEditorRuntime(): EditorRuntime;
|
|
6
6
|
export declare function useEditorStore(): EditorStore;
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
import { type CaptureSupply } from '../editor/captureSupply.js';
|
|
2
|
+
import { type FrameInteraction } from '../editor/frameInteraction.js';
|
|
3
|
+
import { type FrameLodRuntime } from '../editor/frameLodRuntime.js';
|
|
4
|
+
import { type LivePreviewInstances } from '../editor/livePreviewInstances.js';
|
|
5
|
+
import { type LiveScreens } from '../editor/liveScreens.js';
|
|
6
|
+
import { type MountScheduler } from '../editor/mountScheduler.js';
|
|
7
|
+
import type { MountedShadowPreviews } from '../editor/frozenImport.js';
|
|
8
|
+
import { type PreviewIntent } from '../editor/previewIntent.js';
|
|
9
|
+
import { type PreviewSweepChannel } from '../editor/previewSweep.js';
|
|
10
|
+
import { type PreviewCaptureProgress } from '../editor/previewCaptureProgress.js';
|
|
11
|
+
import type { StateSwitchMetrics } from '../editor/stateSwitchMetrics.js';
|
|
12
|
+
import type { InteractiveSessionSurfaces } from '../editor/interactiveSessionSurface.js';
|
|
13
|
+
import { type FlowSessions } from '../editor/flowSessions.js';
|
|
14
|
+
import { type FlowSessionScheduler } from '../editor/flowSessionScheduler.js';
|
|
15
|
+
import { type VariantPrefetch } from '../editor/variantPrefetch.js';
|
|
16
|
+
import type { EditorStore } from '../editor/store.js';
|
|
17
|
+
import type { EditorDeclarations } from '../editor/declarations.js';
|
|
18
|
+
import type { HostBindings } from './hostBindings.js';
|
|
19
|
+
import type { RoutePreviewCache } from '../editor/routePreview.js';
|
|
20
|
+
export interface EditorSchedulers {
|
|
21
|
+
/** Which frame the designer is inside, and the scroll it carries. */
|
|
22
|
+
readonly interaction: FrameInteraction;
|
|
23
|
+
/** Published lifecycle tier and magnification per frame. */
|
|
24
|
+
readonly frameLod: FrameLodRuntime;
|
|
25
|
+
/** Which screens hold a live iframe, under the host's budget. */
|
|
26
|
+
readonly liveScreens: LiveScreens;
|
|
27
|
+
/** The capture supply mode and the status the canvas probe shows. */
|
|
28
|
+
readonly captureSupply: CaptureSupply;
|
|
29
|
+
/** The pool of live application instances frames borrow. */
|
|
30
|
+
readonly livePreviews: LivePreviewInstances;
|
|
31
|
+
/** Walk timings and producer decisions, recorded by the previews and the runners. */
|
|
32
|
+
readonly metrics: StateSwitchMetrics;
|
|
33
|
+
/** Live documents presenting a screen state, and the direct-state handlers. */
|
|
34
|
+
readonly surfaces: InteractiveSessionSurfaces;
|
|
35
|
+
/** The warm pool, the runner factory, and the canonical canvas runner. */
|
|
36
|
+
readonly sessions: FlowSessions;
|
|
37
|
+
/** The canvas fill, activation warm, viewport and interactive runners, direct-state paths. */
|
|
38
|
+
readonly flows: FlowSessionScheduler;
|
|
39
|
+
/** Speculative walks of the active frame's sibling states. */
|
|
40
|
+
readonly prefetch: VariantPrefetch;
|
|
41
|
+
/** The per-animation-frame budget for mounting frozen previews. */
|
|
42
|
+
readonly mounts: MountScheduler;
|
|
43
|
+
/** The frozen previews mounted for this editor's pages, by page id. */
|
|
44
|
+
readonly shadowMounts: MountedShadowPreviews;
|
|
45
|
+
/** The frames a reader means to see next. */
|
|
46
|
+
readonly previewIntent: PreviewIntent;
|
|
47
|
+
/** The canvas sweep status and the sweeper factory. */
|
|
48
|
+
readonly previewSweep: PreviewSweepChannel;
|
|
49
|
+
/** Catalog capture progress, published by the canvas probe and read by the host hook. */
|
|
50
|
+
readonly captureProgress: PreviewCaptureProgress;
|
|
51
|
+
}
|
|
52
|
+
export interface EditorSchedulerDeps {
|
|
53
|
+
/** Created before the preview cache, which records into it. */
|
|
54
|
+
metrics: StateSwitchMetrics;
|
|
55
|
+
/** Created before the store, whose option clicks request through it. */
|
|
56
|
+
surfaces: InteractiveSessionSurfaces;
|
|
57
|
+
/** The cache runners publish into. */
|
|
58
|
+
previews: RoutePreviewCache;
|
|
59
|
+
/** The store and host the schedulers read pages, origins, and revisions from. */
|
|
60
|
+
store: EditorStore;
|
|
61
|
+
host: HostBindings;
|
|
62
|
+
/** The host declarations the schedulers resolve flows and environments from. */
|
|
63
|
+
declarations: EditorDeclarations;
|
|
64
|
+
/** Created before the store, which reads mounted handles from it. */
|
|
65
|
+
shadowMounts: MountedShadowPreviews;
|
|
66
|
+
}
|
|
67
|
+
export declare function createEditorSchedulers(deps: EditorSchedulerDeps): EditorSchedulers;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import type { DesignImportAsset, DesignImportKind } from './designImport';
|
|
2
|
-
import type { NodeModel, PageModel } from './store';
|
|
1
|
+
import type { DesignImportAsset, DesignImportKind } from './designImport.js';
|
|
2
|
+
import type { NodeModel, PageModel } from './store.js';
|
|
3
3
|
export interface DesignAssetEditRequest {
|
|
4
4
|
kind: DesignImportKind;
|
|
5
5
|
asset: DesignImportAsset;
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import type { PageModel } from './store';
|
|
2
1
|
export declare const AUTOMATIC_MOTION_METADATA_ATTRIBUTE = "data-pygmalion-auto-motion";
|
|
3
2
|
export declare const AUTOMATIC_MOTION_LEDGER_ATTRIBUTE = "data-pygmalion-auto-motions";
|
|
4
3
|
export declare const MOTION_DECLARATION_ATTRIBUTE = "data-pygmalion-motion";
|
|
@@ -8,17 +7,7 @@ export interface AutomaticMotionTarget {
|
|
|
8
7
|
selector: string;
|
|
9
8
|
index: number;
|
|
10
9
|
}
|
|
11
|
-
export type PreviewMotionMode = 'frozen' | 'playing' | 'paused';
|
|
12
|
-
export interface PreviewMotionState {
|
|
13
|
-
mode: PreviewMotionMode;
|
|
14
|
-
targetId?: string;
|
|
15
|
-
progress: number;
|
|
16
|
-
seekRevision: number;
|
|
17
|
-
}
|
|
18
|
-
export declare const DEFAULT_PREVIEW_MOTION_STATE: Readonly<PreviewMotionState>;
|
|
19
10
|
/** Discovers every visible rendered element that owns CSS or Web Animation motion. */
|
|
20
11
|
export declare function discoverAutomaticMotionTargets(document: Document): AutomaticMotionTarget[];
|
|
21
12
|
/** Writes discovery metadata onto the parallel serialization clone. */
|
|
22
13
|
export declare function stampAutomaticMotionTargets(source: Document, clone: HTMLElement): AutomaticMotionTarget[];
|
|
23
|
-
/** Reads all automatically stamped motion targets from one imported screen. */
|
|
24
|
-
export declare function automaticMotionTargetsForPage(page: Pick<PageModel, 'root'>): AutomaticMotionTarget[];
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import type { InteractiveStateDef, ScreenStateAxisDef } from './interactiveStates';
|
|
2
|
-
import type { PageModel } from './store';
|
|
1
|
+
import type { InteractiveStateDef, ScreenStateAxisDef } from './interactiveStates.js';
|
|
2
|
+
import type { PageModel } from './store.js';
|
|
3
3
|
export declare const AUTOMATIC_PSEUDO_METADATA_ATTRIBUTE = "data-pygmalion-auto-pseudo";
|
|
4
4
|
export declare const AUTOMATIC_PSEUDO_LEDGER_ATTRIBUTE = "data-pygmalion-auto-pseudos";
|
|
5
5
|
export declare const PSEUDO_EVENT_ATTRIBUTE = "data-pygmalion-pseudo-events";
|
|
@@ -19,3 +19,9 @@ export declare function stampAutomaticPseudoTargets(source: Document, clone: HTM
|
|
|
19
19
|
export declare function automaticPseudoTargetsForPage(page: Pick<PageModel, 'root'>): AutomaticPseudoTarget[];
|
|
20
20
|
/** Synthesizes right-panel axes and suppresses states a host already labels. */
|
|
21
21
|
export declare function automaticPseudoStatesForPage(page: Pick<PageModel, 'root'>, declared?: readonly InteractiveStateDef[]): ScreenStateAxisDef[];
|
|
22
|
+
/**
|
|
23
|
+
* The discovered target a picked DOM element belongs to: the element itself
|
|
24
|
+
* or its closest stamped ancestor. Selectors come from serialized markup, so
|
|
25
|
+
* one the live document cannot parse is skipped rather than thrown.
|
|
26
|
+
*/
|
|
27
|
+
export declare function pseudoTargetForElement(targets: readonly AutomaticPseudoTarget[], element: Element): AutomaticPseudoTarget | undefined;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import type { RoutePreviewFrameRecipe } from './previewBootstrap';
|
|
2
|
-
import type { RoutePreviewArtifactFrameIdentity, RoutePreviewArtifactResolution } from './routePreview';
|
|
1
|
+
import type { RoutePreviewFrameRecipe } from './previewBootstrap.js';
|
|
2
|
+
import type { RoutePreviewArtifactFrameIdentity, RoutePreviewArtifactResolution } from './routePreview.js';
|
|
3
3
|
/**
|
|
4
4
|
* Who fills a canvas first.
|
|
5
5
|
*
|
|
@@ -11,8 +11,6 @@ import type { RoutePreviewArtifactFrameIdentity, RoutePreviewArtifactResolution
|
|
|
11
11
|
* `auto` picks worker-first when an artifact endpoint is configured.
|
|
12
12
|
*/
|
|
13
13
|
export type CaptureSupplyMode = 'worker-first' | 'browser-first';
|
|
14
|
-
export declare function setCaptureSupplyMode(mode: CaptureSupplyMode | 'auto' | undefined): void;
|
|
15
|
-
export declare function resolveCaptureSupplyMode(endpointConfigured: boolean): CaptureSupplyMode;
|
|
16
14
|
export interface CaptureSupplyFrame {
|
|
17
15
|
pageId: string;
|
|
18
16
|
/** Catalog screen id the capture is stored under. */
|
|
@@ -113,6 +111,17 @@ export interface CaptureSupplyDriver {
|
|
|
113
111
|
cancel(): void;
|
|
114
112
|
status(): CaptureSupplyStatus;
|
|
115
113
|
}
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
114
|
+
/**
|
|
115
|
+
* The capture supply of one editor runtime: the host's mode choice and the
|
|
116
|
+
* status channel its drivers publish on. Lives on
|
|
117
|
+
* `runtime.schedulers.captureSupply`, so two editors on one page never
|
|
118
|
+
* share a listener set or a mode.
|
|
119
|
+
*/
|
|
120
|
+
export declare function createCaptureSupply(): {
|
|
121
|
+
setCaptureSupplyMode: (mode: CaptureSupplyMode | "auto" | undefined) => void;
|
|
122
|
+
resolveCaptureSupplyMode: (endpointConfigured: boolean) => CaptureSupplyMode;
|
|
123
|
+
getCaptureSupplyStatus: () => CaptureSupplyStatus;
|
|
124
|
+
subscribeCaptureSupply: (listener: () => void) => () => void;
|
|
125
|
+
createCaptureSupplyDriver: (deps: CaptureSupplyDriverDeps, options?: CaptureSupplyDriverOptions) => CaptureSupplyDriver;
|
|
126
|
+
};
|
|
127
|
+
export type CaptureSupply = ReturnType<typeof createCaptureSupply>;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { type CSSProperties, type ReactNode } from 'react';
|
|
2
|
-
import type { DesignImportCollection } from './designImport';
|
|
3
|
-
import type { ComponentRegistry, RegistryEntry, RegistryPropValue } from './registry';
|
|
2
|
+
import type { DesignImportCollection } from './designImport.js';
|
|
3
|
+
import type { ComponentRegistry, RegistryEntry, RegistryPropValue } from './registry.js';
|
|
4
4
|
export type DesignCatalogKind = 'icons' | 'design-tokens' | 'atoms' | 'components';
|
|
5
5
|
export interface DesignCatalogItem {
|
|
6
6
|
id: string;
|
|
@@ -1,4 +1,7 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { EditorDeclarations } from './declarations.js';
|
|
2
|
+
/** What code generation reads from the editor's declarations. */
|
|
3
|
+
export type CodegenDeclarations = Pick<EditorDeclarations, 'getRegistry' | 'getDesignComponentConnectionForComponent'>;
|
|
4
|
+
import type { NodeJSON, NodeModel } from './store.js';
|
|
2
5
|
export type CodegenNode = NodeModel | NodeJSON;
|
|
3
6
|
export interface CodegenFrameOptions {
|
|
4
7
|
fill?: string;
|
|
@@ -6,6 +9,6 @@ export interface CodegenFrameOptions {
|
|
|
6
9
|
radius?: number;
|
|
7
10
|
clipContent?: boolean;
|
|
8
11
|
}
|
|
9
|
-
export declare function codegen(node: CodegenNode, indent?: number): string;
|
|
12
|
+
export declare function codegen(declarations: CodegenDeclarations, node: CodegenNode, indent?: number): string;
|
|
10
13
|
/** Generates the built-in target and keeps the historical string API stable. */
|
|
11
|
-
export declare function codegenDocument(root: CodegenNode, frame?: CodegenFrameOptions): string;
|
|
14
|
+
export declare function codegenDocument(declarations: CodegenDeclarations, root: CodegenNode, frame?: CodegenFrameOptions): string;
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { Registry } from './registry.js';
|
|
1
2
|
export type DesignConnectionPropertyKind = 'text' | 'boolean' | 'variant' | 'instance' | 'slot';
|
|
2
3
|
export interface DesignComponentReference {
|
|
3
4
|
/** External design system name. Use "figma" for a Figma library. */
|
|
@@ -53,11 +54,15 @@ export interface DesignComponentConnectionCases {
|
|
|
53
54
|
} | null;
|
|
54
55
|
diagnostics: readonly DesignConnectionDiagnostic[];
|
|
55
56
|
}
|
|
56
|
-
|
|
57
|
-
export declare function
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
57
|
+
/** One editor's component connections, validated against its registry. */
|
|
58
|
+
export declare function createComponentConnections(deps: Pick<Registry, 'getRegistry'>): {
|
|
59
|
+
setDesignComponentConnections: (next: readonly DesignComponentConnectionDef[]) => void;
|
|
60
|
+
getDesignComponentConnections: () => readonly DesignComponentConnectionDef[];
|
|
61
|
+
getDesignComponentConnection: (connectionId: string) => DesignComponentConnectionDef | undefined;
|
|
62
|
+
getDesignComponentConnectionForComponent: (componentName: string) => DesignComponentConnectionDef | undefined;
|
|
63
|
+
validateDesignComponentConnections: () => readonly DesignConnectionDiagnostic[];
|
|
64
|
+
enumerateDesignComponentConnectionCases: (connectionId: string, options?: {
|
|
65
|
+
limit?: number;
|
|
66
|
+
}) => DesignComponentConnectionCases;
|
|
67
|
+
};
|
|
68
|
+
export type ComponentConnections = ReturnType<typeof createComponentConnections>;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import type { ComponentRegistry, RegistryEntry, RegistryPropValue } from './registry';
|
|
2
|
-
import type { NodeModel, PageModel } from './store';
|
|
1
|
+
import type { ComponentRegistry, RegistryEntry, RegistryPropValue } from './registry.js';
|
|
2
|
+
import type { NodeModel, PageModel } from './store.js';
|
|
3
3
|
/** One controllable component instance found in a page tree. */
|
|
4
4
|
export interface ComponentInstanceSummary {
|
|
5
5
|
nodeId: string;
|
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
export declare function createEditorDeclarations(): {
|
|
2
|
+
setPreviewDependencyDigests: (routes: readonly {
|
|
3
|
+
path?: string;
|
|
4
|
+
dependencyDigest?: string;
|
|
5
|
+
}[] | null) => void;
|
|
6
|
+
previewDependencyDigest: (route: string) => string | undefined;
|
|
7
|
+
routePreviewFrameRecipe: (page: import("./previewBootstrap.js").PreviewFramePage, baselineEnvironment?: import("./designImport.js").StoryboardEnvironment) => import("./previewBootstrap.js").RoutePreviewFrameRecipe;
|
|
8
|
+
createRoutePreviewFrameFingerprint: (page: import("./previewBootstrap.js").PreviewFramePage, previewRevision: string, baselineEnvironment?: import("./designImport.js").StoryboardEnvironment) => string;
|
|
9
|
+
setDesignImportController: (controller: import("./designImport.js").DesignImportController | null) => void;
|
|
10
|
+
getDesignImportController: () => import("./designImport.js").DesignImportController | null;
|
|
11
|
+
setSurfaceClassifications: (classifications: readonly import("./surfaceDemands.js").SurfaceClassification[] | undefined) => void;
|
|
12
|
+
getSurfaceClassifications: () => readonly import("./surfaceDemands.js").SurfaceClassification[];
|
|
13
|
+
setObservedRequests: (frameId: string, requests: readonly import("./surfaceDemands.js").ObservedRequest[]) => void;
|
|
14
|
+
getObservedRequests: (frameId: string) => readonly import("./surfaceDemands.js").ObservedRequest[];
|
|
15
|
+
frameSurfaceDemands: (frameId: string, root?: (import("./surfaceDemands.js").ControlNodeLike & {
|
|
16
|
+
children?: readonly import("./surfaceDemands.js").ControlNodeLike[];
|
|
17
|
+
}) | null, classifications?: readonly import("./surfaceDemands.js").SurfaceClassification[]) => import("./surfaceDemands.js").FrameSurfaceDemands;
|
|
18
|
+
setStoryboardGraph: (graph: import("./storyboardGraph.js").StoryboardGraph | null) => void;
|
|
19
|
+
getStoryboardGraph: () => import("./storyboardGraph.js").StoryboardGraph | null;
|
|
20
|
+
subscribeStoryboardGraph: (listener: () => void) => () => void;
|
|
21
|
+
bumpPreviewIdentityEpoch: () => void;
|
|
22
|
+
getPreviewIdentityEpoch: () => number;
|
|
23
|
+
setStoryboardBaselineEnvironment: (environment?: import("./designImport.js").StoryboardEnvironment) => void;
|
|
24
|
+
getStoryboardBaselineEnvironment: () => import("./designImport.js").StoryboardEnvironment | undefined;
|
|
25
|
+
setPreviewEnvironmentControls: (next: readonly import("./previewEnvironmentControls.js").PreviewEnvironmentControlDef[]) => void;
|
|
26
|
+
getPreviewEnvironmentControls: () => readonly import("./previewEnvironmentControls.js").PreviewEnvironmentControlDef[];
|
|
27
|
+
getPreviewEnvironmentControlSelections: () => Readonly<Record<string, string>>;
|
|
28
|
+
getPreviewEnvironmentControlValue: (controlId: string) => string | undefined;
|
|
29
|
+
setPreviewEnvironmentControlValue: (controlId: string, value: string) => void;
|
|
30
|
+
clearPreviewEnvironmentControlValues: () => void;
|
|
31
|
+
getPreviewEnvironmentOverride: () => import("./designImport.js").StoryboardEnvironment | undefined;
|
|
32
|
+
subscribePreviewEnvironmentControls: (listener: () => void) => () => void;
|
|
33
|
+
getPreviewEnvironmentControlRevision: () => number;
|
|
34
|
+
setSessionPresets: (next: readonly import("./sessionPresets.js").SessionPresetDef[]) => void;
|
|
35
|
+
getSessionPresets: () => import("./sessionPresets.js").SessionPresetDef[];
|
|
36
|
+
getSelectedSessionPreset: () => number | null;
|
|
37
|
+
selectSessionPreset: (index: number | null) => void;
|
|
38
|
+
subscribeSessionPresets: (listener: () => void) => () => void;
|
|
39
|
+
isInSelectedSessionPreset: (runtimes: readonly string[] | undefined) => boolean;
|
|
40
|
+
applyScenarioCoverageClaim: (editor: import("./store.js").EditorStore, claim: import("./scenarioCoverage.js").ScenarioCoverageClaim) => import("./scenarioCoverage.js").ApplyCoverageResult;
|
|
41
|
+
setScenarioCoverageClaims: (claims: readonly import("./scenarioCoverage.js").ScenarioCoverageClaim[]) => void;
|
|
42
|
+
getScenarioCoverageClaims: () => readonly import("./scenarioCoverage.js").ScenarioCoverageClaim[];
|
|
43
|
+
coverageClaimsForScreen: (screenId: string) => readonly import("./scenarioCoverage.js").ScenarioCoverageClaim[];
|
|
44
|
+
coverageBadgesForComponentProp: (screenId: string, componentName: string, prop: string) => readonly string[];
|
|
45
|
+
directInteractiveStateAxisForPage: (page: import("./store.js").PageModel, defs?: readonly import("./interactiveStates.js").InteractiveStateDef[]) => import("./interactiveStates.js").InteractiveStateDef | undefined;
|
|
46
|
+
setScreenStateAxes: (defs: readonly import("./interactiveStates.js").InteractiveStateDef[] | undefined) => void;
|
|
47
|
+
setInteractiveStates: (defs: readonly import("./interactiveStates.js").InteractiveStateDef[] | undefined) => void;
|
|
48
|
+
getInteractiveStates: () => readonly import("./interactiveStates.js").InteractiveStateDef[];
|
|
49
|
+
getScreenStateAxes: () => readonly import("./interactiveStates.js").InteractiveStateDef[];
|
|
50
|
+
setScreenFlows: (paths: readonly import("./screenFlows.js").ScreenFlowPath[]) => void;
|
|
51
|
+
getScreenFlows: () => readonly import("./screenFlows.js").ScreenFlowPath[];
|
|
52
|
+
flowPathForScreen: (screenId: string) => import("./screenFlows.js").ScreenFlowPath | null;
|
|
53
|
+
setScreenLanes: (lanes: readonly import("./frameLanes.js").ScreenLaneDef[] | undefined) => void;
|
|
54
|
+
getScreenLanes: () => readonly import("./frameLanes.js").ScreenLaneDef[];
|
|
55
|
+
lanesForSection: (section: string) => import("./frameLanes.js").ScreenLaneDef[];
|
|
56
|
+
laneCaptionFor: (section: string, laneId: string) => import("./frameLanes.js").ScreenLaneDef | null;
|
|
57
|
+
groupByLane: <T extends {
|
|
58
|
+
lane?: string;
|
|
59
|
+
}>(section: string, frames: readonly T[]) => {
|
|
60
|
+
laneId: string;
|
|
61
|
+
frames: T[];
|
|
62
|
+
}[];
|
|
63
|
+
setFrameBranchKinds: (defs: readonly import("./frameLabels.js").FrameBranchKindDef[], labels?: import("./frameLabels.js").FrameLabelLabels) => void;
|
|
64
|
+
getFrameBranchKinds: () => readonly import("./frameLabels.js").FrameBranchKindDef[];
|
|
65
|
+
getFrameLabelLabels: () => import("./frameLabels.js").FrameLabelLabels | undefined;
|
|
66
|
+
frameBranchKindFor: (kind: string) => import("./frameLabels.js").FrameBranchKindDef;
|
|
67
|
+
setSectionHeaders: (defs: readonly import("./sectionHeaders.js").SectionHeaderDef[], labels?: import("./sectionHeaders.js").SectionHeaderLabels) => void;
|
|
68
|
+
getSectionHeaders: () => readonly import("./sectionHeaders.js").SectionHeaderDef[];
|
|
69
|
+
getSectionHeaderLabels: () => import("./sectionHeaders.js").SectionHeaderLabels | undefined;
|
|
70
|
+
sectionHeaderFor: (section: string) => import("./sectionHeaders.js").SectionHeaderDef | null;
|
|
71
|
+
setScreenDimensions: (dimensions: readonly import("./screenDimensions.js").ScreenDimensionDef[]) => void;
|
|
72
|
+
getScreenDimensions: () => readonly import("./screenDimensions.js").ScreenDimensionDef[];
|
|
73
|
+
setScreenCards: (defs: readonly import("./screenCards.js").ScreenCardDef[]) => void;
|
|
74
|
+
getScreenCards: () => readonly import("./screenCards.js").ScreenCardDef[];
|
|
75
|
+
setScreenLists: (defs: readonly import("./screenLists.js").ScreenListDef[]) => void;
|
|
76
|
+
getScreenLists: () => readonly import("./screenLists.js").ScreenListDef[];
|
|
77
|
+
setViewportPresets: (next: readonly import("./viewportPresets.js").ViewportPresetDef[]) => void;
|
|
78
|
+
getViewportPresets: () => import("./viewportPresets.js").ViewportPresetDef[];
|
|
79
|
+
setDesignComponentConnections: (next: readonly import("./componentConnections.js").DesignComponentConnectionDef[]) => void;
|
|
80
|
+
getDesignComponentConnections: () => readonly import("./componentConnections.js").DesignComponentConnectionDef[];
|
|
81
|
+
getDesignComponentConnection: (connectionId: string) => import("./componentConnections.js").DesignComponentConnectionDef | undefined;
|
|
82
|
+
getDesignComponentConnectionForComponent: (componentName: string) => import("./componentConnections.js").DesignComponentConnectionDef | undefined;
|
|
83
|
+
validateDesignComponentConnections: () => readonly import("./componentConnections.js").DesignConnectionDiagnostic[];
|
|
84
|
+
enumerateDesignComponentConnectionCases: (connectionId: string, options?: {
|
|
85
|
+
limit?: number;
|
|
86
|
+
}) => import("./componentConnections.js").DesignComponentConnectionCases;
|
|
87
|
+
setComponentRegistry: (r: import("./registry.js").ComponentRegistry) => void;
|
|
88
|
+
getRegistry: () => import("./registry.js").ComponentRegistry;
|
|
89
|
+
setTokens: (t: import("./tokens.js").TokenDef[]) => void;
|
|
90
|
+
getTokens: () => import("./tokens.js").TokenDef[];
|
|
91
|
+
setOnTokensChange: (cb: ((changed: {
|
|
92
|
+
name: string;
|
|
93
|
+
value: string;
|
|
94
|
+
}[]) => void) | null) => void;
|
|
95
|
+
getTokenValue: (name: string) => string;
|
|
96
|
+
getTokenOverrides: () => {
|
|
97
|
+
name: string;
|
|
98
|
+
value: string;
|
|
99
|
+
}[];
|
|
100
|
+
replaceTokenOverrides: (next: readonly {
|
|
101
|
+
name: string;
|
|
102
|
+
value: string;
|
|
103
|
+
}[]) => void;
|
|
104
|
+
applyTokenOverride: (sync: import("./tokens.js").TokenSyncQueue, name: string, value: string) => void;
|
|
105
|
+
resetTokenOverrides: (sync: import("./tokens.js").TokenSyncQueue) => void;
|
|
106
|
+
};
|
|
107
|
+
export type EditorDeclarations = ReturnType<typeof createEditorDeclarations>;
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
import { type CodegenFrameOptions, type CodegenNode } from './codegen';
|
|
2
|
-
import {
|
|
1
|
+
import { type CodegenFrameOptions, type CodegenNode } from './codegen.js';
|
|
2
|
+
import type { EditorDeclarations } from './declarations.js';
|
|
3
|
+
import { type NodeJSON } from './store.js';
|
|
3
4
|
export declare const DESIGN_IR_SCHEMA: "pygmalion.design-ir";
|
|
4
5
|
export declare const DESIGN_IR_VERSION: 1;
|
|
5
6
|
export declare const DESIGN_CODEGEN_PROJECT_SCHEMA: "pygmalion.codegen-project";
|
|
@@ -129,6 +130,8 @@ export interface DesignCompileLimits {
|
|
|
129
130
|
export declare const DEFAULT_DESIGN_COMPILE_LIMITS: Readonly<DesignCompileLimits>;
|
|
130
131
|
export interface DesignCodegenAdapterContext extends DesignCodegenRuntimeContext {
|
|
131
132
|
document: DesignIntermediateDocumentV1;
|
|
133
|
+
/** The editor's declarations the adapter generates against. */
|
|
134
|
+
declarations: CompileDeclarations;
|
|
132
135
|
}
|
|
133
136
|
export interface DesignCodegenAdapterOutput {
|
|
134
137
|
code: string;
|
|
@@ -199,7 +202,9 @@ export interface DesignCompileResult {
|
|
|
199
202
|
};
|
|
200
203
|
validation?: DesignCodegenValidationRequest;
|
|
201
204
|
}
|
|
202
|
-
|
|
205
|
+
/** What compilation reads from the editor's declarations. */
|
|
206
|
+
export type CompileDeclarations = Pick<EditorDeclarations, 'getRegistry' | 'getDesignComponentConnectionForComponent' | 'validateDesignComponentConnections'>;
|
|
207
|
+
export declare function createDesignIntermediateDocument(declarations: CompileDeclarations, root: CodegenNode, frame?: CodegenFrameOptions): DesignIntermediateDocumentV1;
|
|
203
208
|
export declare function registerDesignCodegenAdapter(adapter: DesignCodegenAdapter): () => void;
|
|
204
209
|
export declare function getDesignCodegenAdapters(): readonly DesignCodegenAdapter[];
|
|
205
|
-
export declare function compileDesignDocument(root: CodegenNode, options?: DesignCompileOptions): DesignCompileResult;
|
|
210
|
+
export declare function compileDesignDocument(declarations: CompileDeclarations, root: CodegenNode, options?: DesignCompileOptions): DesignCompileResult;
|
|
@@ -1,13 +1,14 @@
|
|
|
1
|
-
import { type DomImportOptions, type DomImportResult } from './domImport';
|
|
2
|
-
import { type DocumentChurnEntry, type DocumentStabilityOptions } from './documentStability';
|
|
3
|
-
import type { DesignFrameHeightMode } from './frameHeight';
|
|
4
|
-
import {
|
|
5
|
-
import type { ComponentRegistry } from './registry';
|
|
6
|
-
import type {
|
|
1
|
+
import { type DomImportOptions, type DomImportResult } from './domImport.js';
|
|
2
|
+
import { type DocumentChurnEntry, type DocumentStabilityOptions } from './documentStability.js';
|
|
3
|
+
import type { DesignFrameHeightMode } from './frameHeight.js';
|
|
4
|
+
import type { ScreenLaneDef } from './frameLanes.js';
|
|
5
|
+
import type { ComponentRegistry } from './registry.js';
|
|
6
|
+
import type { DeclaredScreenRoute } from './surfaceDemands.js';
|
|
7
|
+
import type { TokenDef } from './tokens.js';
|
|
7
8
|
export declare const DESIGN_IMPORT_KINDS: readonly ["icons", "design-tokens", "atoms", "components", "screens"];
|
|
8
9
|
export type DesignImportKind = (typeof DESIGN_IMPORT_KINDS)[number];
|
|
9
10
|
export type DesignFrameSizeMode = 'fixed' | 'content';
|
|
10
|
-
export type { DesignFrameHeightMode } from './frameHeight';
|
|
11
|
+
export type { DesignFrameHeightMode } from './frameHeight.js';
|
|
11
12
|
/** Individual assets discovered at source. Connect to which designer sheet it can be viewed using pageId. */
|
|
12
13
|
export interface DesignImportAsset {
|
|
13
14
|
id: string;
|
|
@@ -75,8 +76,13 @@ export interface DesignScreenInteractionRunOptions {
|
|
|
75
76
|
* timer-only wait remain authoritative. Capture replay keeps the default
|
|
76
77
|
* `authored` policy, while an already-visible interactive transition can use
|
|
77
78
|
* `target-driven` and let the final stability pass protect serialization.
|
|
79
|
+
* `live` prepares a screen that is about to be shown running: authored
|
|
80
|
+
* settles are replaced by one short pause after each action, matched waits
|
|
81
|
+
* synchronize on their target, and a timer-only wait is capped. The screen
|
|
82
|
+
* arrives as soon as its recipe has been reproduced; a capture taken from
|
|
83
|
+
* it afterwards must run the stability pass itself.
|
|
78
84
|
*/
|
|
79
|
-
settlePolicy?: 'authored' | 'target-driven';
|
|
85
|
+
settlePolicy?: 'authored' | 'target-driven' | 'live';
|
|
80
86
|
/** Called after boot presets succeed and immediately before actions begin. */
|
|
81
87
|
onBeforeInteractions?: () => void;
|
|
82
88
|
/**
|
|
@@ -294,7 +300,13 @@ export interface DesignScreenCase extends DesignImportPage {
|
|
|
294
300
|
scenarioIds?: readonly string[];
|
|
295
301
|
sourcePath?: string;
|
|
296
302
|
codeName?: string;
|
|
297
|
-
/**
|
|
303
|
+
/**
|
|
304
|
+
* Source routes this visual state explicitly represents, by the discovered
|
|
305
|
+
* route's id or its path. A case that renders a registered component
|
|
306
|
+
* (`componentName`) covers a guarded or dynamic route this way without a
|
|
307
|
+
* navigation URL; a case booted at one concrete `route` claims the dynamic
|
|
308
|
+
* pattern it instantiates. `auditRouteCoverage` reads them.
|
|
309
|
+
*/
|
|
298
310
|
coverageRoutes?: readonly string[];
|
|
299
311
|
}
|
|
300
312
|
/** Operational scenarios such as network, storage, bridge, etc. without separate visual state. */
|
|
@@ -311,7 +323,16 @@ export interface DesignScenarioCoverage {
|
|
|
311
323
|
}
|
|
312
324
|
export interface DesignScreenCollectionResult {
|
|
313
325
|
collection: DesignImportCollection;
|
|
326
|
+
/** Scenario classification only: every supplied scenario, exactly once. */
|
|
314
327
|
coverage: DesignScenarioCoverage;
|
|
328
|
+
/**
|
|
329
|
+
* What each case said about source routes, kept beside the pages the
|
|
330
|
+
* collection strips it from: `id`, the canonical `route`, `componentName`,
|
|
331
|
+
* and `coverageRoutes`. Hand it to `auditRouteCoverage` as
|
|
332
|
+
* `declaredScreens` to check the discovered route inventory against the
|
|
333
|
+
* same declarations the editor will show.
|
|
334
|
+
*/
|
|
335
|
+
routeMappings: readonly DeclaredScreenRoute[];
|
|
315
336
|
}
|
|
316
337
|
/** A portable viewport variant used to render the same authored screen recipe responsively. */
|
|
317
338
|
export interface DesignScreenViewport {
|
|
@@ -506,6 +527,12 @@ export interface DesignImportController {
|
|
|
506
527
|
/** Reproduces and verifies state without waiting for capture-only stability. */
|
|
507
528
|
prepareScreenState?(iframe: HTMLIFrameElement, spec: DesignScreenCaptureSpec, options?: DesignScreenInteractionRunOptions): Promise<DesignScreenCaptureReport>;
|
|
508
529
|
prepareScreenCapture(iframe: HTMLIFrameElement, spec: DesignScreenCaptureSpec): Promise<DesignScreenCaptureReport>;
|
|
530
|
+
/**
|
|
531
|
+
* The capture-only stability pass on its own, for a caller that showed the
|
|
532
|
+
* screen before freezing it. Resolves false when the document never settled
|
|
533
|
+
* within the ceiling.
|
|
534
|
+
*/
|
|
535
|
+
waitForStableDocument?(document: Document): Promise<boolean>;
|
|
509
536
|
}
|
|
510
537
|
/**
|
|
511
538
|
* Which canvas a screen belongs to.
|
|
@@ -526,7 +553,7 @@ export interface DesignImportController {
|
|
|
526
553
|
export declare function screensCanvasName(page: {
|
|
527
554
|
section?: string;
|
|
528
555
|
lane?: string;
|
|
529
|
-
}, partition: CreateDesignImportOptions['screensCanvasPartition'], lanes?: readonly ScreenLaneDef[]): string;
|
|
556
|
+
}, partition: CreateDesignImportOptions['screensCanvasPartition'], lanes?: readonly ScreenLaneDef[], resolveLane?: (section: string, laneId: string) => ScreenLaneDef | null): string;
|
|
530
557
|
export interface CreateDesignImportOptions {
|
|
531
558
|
/** Default budget for full layer mode. The host can explicitly increase it according to the screen size. */
|
|
532
559
|
layerOptions?: DomImportOptions;
|
|
@@ -549,6 +576,11 @@ export interface CreateDesignImportOptions {
|
|
|
549
576
|
* canvas named at that moment cannot wait for a later registration.
|
|
550
577
|
*/
|
|
551
578
|
screenLanes?: readonly ScreenLaneDef[];
|
|
579
|
+
/**
|
|
580
|
+
* Fallback lane lookup for a host that registers lanes on the editor rather
|
|
581
|
+
* than passing them here; typically `runtime.declarations.laneCaptionFor`.
|
|
582
|
+
*/
|
|
583
|
+
resolveScreenLane?: (section: string, laneId: string) => ScreenLaneDef | null;
|
|
552
584
|
/**
|
|
553
585
|
* What the editor's own capture treats as movement, and how long it waits for
|
|
554
586
|
* the screen to stop. The Playwright capture answers the same question with
|
|
@@ -582,5 +614,9 @@ export declare function createDesignScreenCollection({ cases, scenarios, behavio
|
|
|
582
614
|
/** Host basic environment + override for each case. Objects are recursively merged and arrays/primitives are replaced by cases. */
|
|
583
615
|
export declare function mergeScreenPresets(defaults?: DesignScreenPreset, override?: DesignScreenPreset): DesignScreenPreset;
|
|
584
616
|
export declare function createDesignImportController(manifest: DesignImportManifest, options?: CreateDesignImportOptions): DesignImportController;
|
|
585
|
-
|
|
586
|
-
export declare function
|
|
617
|
+
/** The design import controller the host installed for one editor. */
|
|
618
|
+
export declare function createDesignImportRegistry(): {
|
|
619
|
+
setDesignImportController: (controller: DesignImportController | null) => void;
|
|
620
|
+
getDesignImportController: () => DesignImportController | null;
|
|
621
|
+
};
|
|
622
|
+
export type DesignImportRegistry = ReturnType<typeof createDesignImportRegistry>;
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import type {
|
|
1
|
+
import type { DesignChangeHandler } from '../core/hostBindings.js';
|
|
2
|
+
import type { EditorDeclarations } from './declarations.js';
|
|
3
|
+
import type { EditorStore } from './store.js';
|
|
3
4
|
type SyncStatus = 'idle' | 'saving' | 'saved' | 'error';
|
|
4
5
|
declare class DesignSyncState {
|
|
5
6
|
status: SyncStatus;
|
|
@@ -9,34 +10,36 @@ declare class DesignSyncState {
|
|
|
9
10
|
setPending(pending: number): void;
|
|
10
11
|
setStatus(status: SyncStatus, message: string): void;
|
|
11
12
|
}
|
|
12
|
-
/** General purpose status to show code autosave status in right panel. */
|
|
13
|
-
export declare const designSyncState: DesignSyncState;
|
|
14
13
|
export interface DocumentSyncOptions {
|
|
15
14
|
/** Exact checkout identity attached to every batch from this session. */
|
|
16
15
|
sourceRevision?: string;
|
|
17
16
|
/** Pin this session to its host callback instead of reading a later one. */
|
|
18
|
-
onDesignChange?:
|
|
17
|
+
onDesignChange?: DesignChangeHandler | null;
|
|
18
|
+
}
|
|
19
|
+
/** What document sync reads from the host: the callback a batch is delivered to. */
|
|
20
|
+
export interface DocumentSyncHost {
|
|
21
|
+
readonly onDesignChange: DesignChangeHandler | null;
|
|
22
|
+
}
|
|
23
|
+
export interface DocumentSyncDeps {
|
|
24
|
+
host: DocumentSyncHost;
|
|
25
|
+
/** The declarations code generation reads (registry, connections). */
|
|
26
|
+
declarations: EditorDeclarations;
|
|
19
27
|
}
|
|
20
28
|
/**
|
|
21
|
-
*
|
|
22
|
-
*
|
|
23
|
-
*
|
|
24
|
-
*
|
|
25
|
-
*/
|
|
26
|
-
export declare function resetDocumentSync(): void;
|
|
27
|
-
/**
|
|
28
|
-
* It observes the entire edited document, but only sends the final state of changed elements to the host.
|
|
29
|
-
* Continuous typing/dragging and undo/redo are combined with the same element key, so the save history and edit history are separated.
|
|
30
|
-
*/
|
|
31
|
-
export declare function startDocumentSync(editor: EditorStore, options?: DocumentSyncOptions): () => void;
|
|
32
|
-
/** Tokens also use the same element change queue as canvas documents. */
|
|
33
|
-
export declare function queueTokenDesignChange(tokens: {
|
|
34
|
-
name: string;
|
|
35
|
-
value: string;
|
|
36
|
-
}[]): void;
|
|
37
|
-
/**
|
|
38
|
-
* Clear all remaining debounce/asynchronous storage just before final reflection.
|
|
39
|
-
* Save failures are propagated to the caller, and any saved pendings are retried on the next flush.
|
|
29
|
+
* One editor's code autosave: the baseline of syncable documents, the pending
|
|
30
|
+
* element changes, the debounce timer, the retirement epoch, and the status
|
|
31
|
+
* the panels show. `host.onDesignChange` is read when a batch is sent unless
|
|
32
|
+
* `startDocumentSync` pinned a handler. Every runtime owns one.
|
|
40
33
|
*/
|
|
41
|
-
export declare function
|
|
34
|
+
export declare function createDocumentSync(deps: DocumentSyncDeps): {
|
|
35
|
+
designSyncState: DesignSyncState;
|
|
36
|
+
resetDocumentSync: () => void;
|
|
37
|
+
startDocumentSync: (editor: EditorStore, options?: DocumentSyncOptions) => () => void;
|
|
38
|
+
queueTokenDesignChange: (tokens: {
|
|
39
|
+
name: string;
|
|
40
|
+
value: string;
|
|
41
|
+
}[]) => void;
|
|
42
|
+
flushDesignChanges: () => Promise<void>;
|
|
43
|
+
};
|
|
44
|
+
export type DocumentSync = ReturnType<typeof createDocumentSync>;
|
|
42
45
|
export {};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import type { InstanceHit, InstanceResolver } from './fiberMap';
|
|
2
|
-
import type { NodeJSON } from './store';
|
|
1
|
+
import type { InstanceHit, InstanceResolver } from './fiberMap.js';
|
|
2
|
+
import type { NodeJSON } from './store.js';
|
|
3
3
|
/** Keeps a real 0 — the value that hides hover-only affordances. */
|
|
4
4
|
export declare function clampOpacity(value: string): number;
|
|
5
5
|
/**
|