nudge-ui 0.2.2 → 0.2.3
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.md +164 -46
- package/dist/client.mjs +252 -61
- package/dist/css/value-semantics/colorSemantics.d.ts +4 -0
- package/dist/css/value-semantics/colorSemantics.js +17 -0
- package/dist/hosts/astro/astroRuntimeConfig.js +1 -0
- package/dist/hosts/astro/clientTransport.js +38 -32
- package/dist/hosts/astro/integration.js +5 -1
- package/dist/hosts/astro/markdownIdentity.d.ts +28 -0
- package/dist/hosts/astro/markdownIdentity.js +81 -0
- package/dist/hosts/next/manifest.js +1 -1
- package/dist/hosts/next/sidecar.js +5 -1
- package/dist/hosts/static/manifest.js +1 -1
- package/dist/hosts/static/server.js +3 -0
- package/dist/hosts/vite/vite.d.ts +3 -0
- package/dist/hosts/vite/vite.js +24 -4
- package/dist/inspector/agent/McpConnectionDialog.js +13 -19
- package/dist/inspector/agent/activity.d.ts +18 -0
- package/dist/inspector/agent/activity.js +70 -0
- package/dist/inspector/agent/client.d.ts +2 -0
- package/dist/inspector/agent/client.js +29 -1
- package/dist/inspector/agent/connectionStatus.js +1 -1
- package/dist/inspector/agent/httpTransport.js +9 -2
- package/dist/inspector/agent/protocol.d.ts +6 -3
- package/dist/inspector/agent/protocol.js +1 -1
- package/dist/inspector/agent/verification.d.ts +11 -1
- package/dist/inspector/agent/verification.js +53 -25
- package/dist/inspector/canvas/AgentActivityOverlay.d.ts +13 -0
- package/dist/inspector/canvas/AgentActivityOverlay.js +111 -0
- package/dist/inspector/canvas/CanvasCard.d.ts +9 -2
- package/dist/inspector/canvas/CanvasCard.js +133 -38
- package/dist/inspector/canvas/CanvasElementOverlay.js +152 -16
- package/dist/inspector/canvas/CanvasToolIcons.d.ts +10 -0
- package/dist/inspector/canvas/CanvasToolIcons.js +20 -0
- package/dist/inspector/canvas/CanvasToolbar.js +8 -4
- package/dist/inspector/canvas/CanvasWorkspace.js +225 -57
- package/dist/inspector/canvas/StaleChangeIndicator.js +3 -13
- package/dist/inspector/canvas/agentPresentation.d.ts +8 -8
- package/dist/inspector/canvas/agentPresentation.js +64 -52
- package/dist/inspector/canvas/canvasGestures.d.ts +1 -1
- package/dist/inspector/canvas/canvasGestures.js +1 -1
- package/dist/inspector/canvas/canvasStore.d.ts +46 -82
- package/dist/inspector/canvas/canvasStore.js +251 -284
- package/dist/inspector/canvas/frameContent.d.ts +21 -0
- package/dist/inspector/canvas/frameContent.js +44 -0
- package/dist/inspector/canvas/frameProtocol.d.ts +21 -4
- package/dist/inspector/canvas/frameProtocol.js +3 -3
- package/dist/inspector/canvas/keyboardShortcuts.d.ts +3 -1
- package/dist/inspector/canvas/keyboardShortcuts.js +4 -4
- package/dist/inspector/canvas/layout.d.ts +52 -0
- package/dist/inspector/canvas/layout.js +106 -0
- package/dist/inspector/canvas/projection.d.ts +15 -5
- package/dist/inspector/canvas/projection.js +69 -13
- package/dist/inspector/canvas/rendererBootstrap.js +32 -4
- package/dist/inspector/canvas/rendererElementSelector.js +47 -6
- package/dist/inspector/canvas/rendererStylesheet.js +2 -2
- package/dist/inspector/canvas/resizeHandleScale.js +1 -1
- package/dist/inspector/canvas/sessionStore.d.ts +11 -26
- package/dist/inspector/canvas/sessionStore.js +43 -183
- package/dist/inspector/canvas/staleChangeDetector.js +9 -3
- package/dist/inspector/canvas/useCanvasLayoutAnimation.d.ts +5 -0
- package/dist/inspector/canvas/useCanvasLayoutAnimation.js +107 -0
- package/dist/inspector/canvas/viewStore.d.ts +38 -0
- package/dist/inspector/canvas/viewStore.js +104 -0
- package/dist/inspector/canvas/wheelPan.d.ts +8 -0
- package/dist/inspector/canvas/wheelPan.js +8 -0
- package/dist/inspector/changes/changesLog.d.ts +6 -5
- package/dist/inspector/changes/changesLog.js +40 -32
- package/dist/inspector/changes/draftChanges.d.ts +56 -0
- package/dist/inspector/changes/draftChanges.js +300 -0
- package/dist/inspector/changes/previewDiagnostics.d.ts +4 -2
- package/dist/inspector/changes/previewDiagnostics.js +11 -25
- package/dist/inspector/clientManifest.d.ts +1 -1
- package/dist/inspector/comments/CommentsOverlay.d.ts +2 -0
- package/dist/inspector/comments/CommentsOverlay.js +250 -0
- package/dist/inspector/comments/element.d.ts +6 -0
- package/dist/inspector/comments/element.js +47 -0
- package/dist/inspector/comments/store.d.ts +29 -0
- package/dist/inspector/comments/store.js +121 -0
- package/dist/inspector/comments/verification.d.ts +5 -0
- package/dist/inspector/comments/verification.js +52 -0
- package/dist/inspector/drafts/model.d.ts +35 -0
- package/dist/inspector/drafts/model.js +45 -0
- package/dist/inspector/drafts/store.d.ts +28 -0
- package/dist/inspector/drafts/store.js +231 -0
- package/dist/inspector/index.js +20 -27
- package/dist/inspector/inline-text/inlineTextEditor.js +7 -0
- package/dist/inspector/inspection/useBrowserCssInspection.js +15 -1
- package/dist/inspector/iterations/capture.d.ts +2 -0
- package/dist/inspector/iterations/capture.js +173 -0
- package/dist/inspector/iterations/client.d.ts +7 -0
- package/dist/inspector/iterations/client.js +52 -0
- package/dist/inspector/iterations/coordinator.d.ts +15 -0
- package/dist/inspector/iterations/coordinator.js +130 -0
- package/dist/inspector/iterations/prompt.d.ts +3 -0
- package/dist/inspector/iterations/prompt.js +26 -0
- package/dist/inspector/overlay/DomNavigator.js +21 -15
- package/dist/inspector/overlay/interactionStyles.js +3 -1
- package/dist/inspector/overlay/spacingGestures.d.ts +13 -1
- package/dist/inspector/overlay/spacingGestures.js +82 -5
- package/dist/inspector/projection/{workspaceProjection.d.ts → draftProjection.d.ts} +6 -6
- package/dist/inspector/projection/{workspaceProjection.js → draftProjection.js} +4 -4
- package/dist/inspector/projection/renderedInstance.d.ts +2 -1
- package/dist/inspector/projection/renderedInstance.js +9 -5
- package/dist/inspector/projection/structuralProjection.d.ts +2 -1
- package/dist/inspector/projection/structuralProjection.js +19 -15
- package/dist/inspector/projection/textProjection.d.ts +2 -1
- package/dist/inspector/projection/textProjection.js +8 -4
- package/dist/inspector/prompt/PromptSettingsDialog.js +1 -5
- package/dist/inspector/prompt/clipboardHandoff.d.ts +10 -18
- package/dist/inspector/prompt/clipboardHandoff.js +92 -143
- package/dist/inspector/prompt/generatePrompt.d.ts +4 -1
- package/dist/inspector/prompt/generatePrompt.js +17 -16
- package/dist/inspector/runtime/runtimeConfig.d.ts +9 -0
- package/dist/inspector/runtime/runtimeConfig.js +24 -0
- package/dist/inspector/settings/SettingsDialog.js +21 -8
- package/dist/inspector/shell/AgentStatusButton.d.ts +11 -0
- package/dist/inspector/shell/AgentStatusButton.js +36 -0
- package/dist/inspector/shell/AppShell.js +4 -2
- package/dist/inspector/shell/ChangesLog.js +46 -26
- package/dist/inspector/shell/CopyPromptButton.js +138 -89
- package/dist/inspector/shell/EmptyState.js +9 -8
- package/dist/inspector/shell/InspectorShell.js +13 -21
- package/dist/inspector/shell/PeekOriginalButton.js +24 -23
- package/dist/inspector/shell/originalPreview.js +5 -5
- package/dist/inspector/shell/shortcuts.d.ts +3 -0
- package/dist/inspector/shell/shortcuts.js +11 -0
- package/dist/inspector/sketch/SketchEditor.js +14 -14
- package/dist/inspector/sketch/SketchEntryButton.js +1 -1
- package/dist/inspector/sketch/SketchFrameOverlay.d.ts +3 -1
- package/dist/inspector/sketch/SketchFrameOverlay.js +11 -8
- package/dist/inspector/sketch/SketchLayersPanel.js +13 -5
- package/dist/inspector/sketch/SketchOverlay.js +7 -7
- package/dist/inspector/sketch/SketchWorkspace.js +18 -12
- package/dist/inspector/sketch/interaction.d.ts +1 -0
- package/dist/inspector/sketch/interaction.js +8 -4
- package/dist/inspector/sketch/model.d.ts +5 -0
- package/dist/inspector/sketch/model.js +6 -2
- package/dist/inspector/sketch/raster.d.ts +1 -2
- package/dist/inspector/sketch/raster.js +68 -4
- package/dist/inspector/styleEditors/BackgroundEditor.d.ts +4 -0
- package/dist/inspector/styleEditors/BackgroundEditor.js +195 -0
- package/dist/inspector/styleEditors/BorderEditor.js +49 -78
- package/dist/inspector/styleEditors/BorderRadiusEditor.js +6 -1
- package/dist/inspector/styleEditors/BoxShadowEditor.d.ts +1 -2
- package/dist/inspector/styleEditors/BoxShadowEditor.js +132 -4
- package/dist/inspector/styleEditors/ColorPicker.d.ts +5 -1
- package/dist/inspector/styleEditors/ColorPicker.js +10 -4
- package/dist/inspector/styleEditors/GapField.js +3 -5
- package/dist/inspector/styleEditors/GridChildSection.d.ts +1 -1
- package/dist/inspector/styleEditors/GridChildSection.js +18 -9
- package/dist/inspector/styleEditors/GridPicker.d.ts +1 -1
- package/dist/inspector/styleEditors/GridPicker.js +8 -2
- package/dist/inspector/styleEditors/GridSection.js +1 -1
- package/dist/inspector/styleEditors/GridValueField.js +19 -14
- package/dist/inspector/styleEditors/ImageBackgroundEditor.d.ts +18 -0
- package/dist/inspector/styleEditors/ImageBackgroundEditor.js +118 -0
- package/dist/inspector/styleEditors/LayoutBlockedIndicator.d.ts +2 -2
- package/dist/inspector/styleEditors/LayoutBlockedIndicator.js +3 -3
- package/dist/inspector/styleEditors/LayoutComboField.js +6 -4
- package/dist/inspector/styleEditors/LayoutDropdown.js +6 -3
- package/dist/inspector/styleEditors/LayoutSection.js +32 -11
- package/dist/inspector/styleEditors/SpacingBox.js +7 -5
- package/dist/inspector/styleEditors/Typography.js +11 -3
- package/dist/inspector/styleEditors/backgroundLayers.d.ts +24 -0
- package/dist/inspector/styleEditors/backgroundLayers.js +51 -0
- package/dist/inspector/styleEditors/gradientValue.d.ts +17 -0
- package/dist/inspector/styleEditors/gradientValue.js +114 -0
- package/dist/inspector/styleEditors/inlineAuthored.d.ts +10 -0
- package/dist/inspector/styleEditors/inlineAuthored.js +114 -0
- package/dist/inspector/styleEditors/layoutValue.d.ts +0 -8
- package/dist/inspector/styleEditors/layoutValue.js +0 -42
- package/dist/inspector/styleEditors/nudgeValue.d.ts +2 -2
- package/dist/inspector/styleEditors/nudgeValue.js +36 -8
- package/dist/inspector/tokens/TokenField.d.ts +7 -0
- package/dist/inspector/tokens/TokenField.js +29 -21
- package/dist/inspector/tokens/TokenLabel.js +5 -14
- package/dist/inspector/tokens/editActions.d.ts +1 -1
- package/dist/inspector/tokens/editActions.js +1 -1
- package/dist/inspector/ui/AtRuleContext.js +4 -6
- package/dist/inspector/ui/Button.d.ts +6 -2
- package/dist/inspector/ui/Button.js +4 -3
- package/dist/inspector/ui/ControlSurface.d.ts +2 -2
- package/dist/inspector/ui/ControlSurface.js +4 -3
- package/dist/inspector/ui/InlineStyleWarning.d.ts +11 -0
- package/dist/inspector/ui/InlineStyleWarning.js +13 -0
- package/dist/inspector/ui/InspectorPopover.d.ts +2 -1
- package/dist/inspector/ui/InspectorPopover.js +4 -5
- package/dist/inspector/ui/PopoverListbox.d.ts +2 -1
- package/dist/inspector/ui/PopoverListbox.js +8 -7
- package/dist/inspector/ui/SegmentedControl.d.ts +2 -1
- package/dist/inspector/ui/SegmentedControl.js +2 -2
- package/dist/inspector/ui/Select.d.ts +6 -1
- package/dist/inspector/ui/Select.js +7 -11
- package/dist/inspector/ui/SideValuesField.js +1 -1
- package/dist/inspector/ui/Tooltip.d.ts +26 -0
- package/dist/inspector/ui/Tooltip.js +32 -0
- package/dist/inspector/ui/classNames.d.ts +2 -0
- package/dist/inspector/ui/classNames.js +4 -0
- package/dist/inspector/ui/customCursors.d.ts +23 -0
- package/dist/inspector/ui/customCursors.js +122 -0
- package/dist/inspector/ui/dragCursor.d.ts +0 -2
- package/dist/inspector/ui/dragCursor.js +2 -10
- package/dist/inspector/ui/portalContainer.d.ts +2 -0
- package/dist/inspector/ui/portalContainer.js +6 -0
- package/dist/inspector/ui/styles.js +29 -21
- package/dist/inspector/workspace/commands.d.ts +9 -0
- package/dist/inspector/workspace/commands.js +82 -0
- package/dist/inspector/workspace/controller.d.ts +4 -0
- package/dist/inspector/workspace/controller.js +66 -0
- package/dist/inspector/workspace/handoff.d.ts +42 -0
- package/dist/inspector/workspace/handoff.js +115 -0
- package/dist/inspector/workspace/timeline.d.ts +30 -0
- package/dist/inspector/workspace/timeline.js +108 -0
- package/dist/internal/agent-protocol.d.ts +19 -2
- package/dist/internal/agent-protocol.js +13 -0
- package/dist/nudge-ui.mjs +558 -311
- package/dist/project/artifacts.d.ts +13 -0
- package/dist/project/artifacts.js +253 -0
- package/dist/transport/artifacts.d.ts +8 -0
- package/dist/transport/artifacts.js +9 -0
- package/dist/transport/editor.js +3 -1
- package/dist/transport/routes.d.ts +2 -0
- package/dist/transport/routes.js +2 -0
- package/package.json +6 -2
- package/dist/inspector/changes/workspaceChanges.d.ts +0 -47
- package/dist/inspector/changes/workspaceChanges.js +0 -265
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
import { iterationId } from "./frameContent.js";
|
|
2
|
+
import { useEffect, useLayoutEffect, useRef } from "react";
|
|
3
|
+
import {} from "./canvasStore.js";
|
|
4
|
+
import { setCanvasLayoutTransitioning } from "./viewStore.js";
|
|
5
|
+
const SLIDE_OPTIONS = { duration: 300, easing: "ease-out" };
|
|
6
|
+
const CAMERA_OPTIONS = { duration: 150, easing: "ease-out" };
|
|
7
|
+
/** Animates frame creation and layout changes without delaying direct manipulation. */
|
|
8
|
+
export function useCanvasLayoutAnimation(boardRef, cards, camera, presentation) {
|
|
9
|
+
const previous = useRef({ cards, camera, presentation });
|
|
10
|
+
const animations = useRef([]);
|
|
11
|
+
const generation = useRef(0);
|
|
12
|
+
useEffect(() => {
|
|
13
|
+
const board = boardRef.current;
|
|
14
|
+
const cancel = () => {
|
|
15
|
+
generation.current += 1;
|
|
16
|
+
setCanvasLayoutTransitioning(false);
|
|
17
|
+
for (const animation of animations.current)
|
|
18
|
+
animation.cancel();
|
|
19
|
+
animations.current = [];
|
|
20
|
+
};
|
|
21
|
+
const cancelWheel = (event) => {
|
|
22
|
+
if (board && event.composedPath().includes(board))
|
|
23
|
+
cancel();
|
|
24
|
+
};
|
|
25
|
+
board?.addEventListener("pointerdown", cancel, true);
|
|
26
|
+
window.addEventListener("wheel", cancelWheel, true);
|
|
27
|
+
return () => {
|
|
28
|
+
cancel();
|
|
29
|
+
board?.removeEventListener("pointerdown", cancel, true);
|
|
30
|
+
window.removeEventListener("wheel", cancelWheel, true);
|
|
31
|
+
};
|
|
32
|
+
}, [boardRef]);
|
|
33
|
+
useLayoutEffect(() => {
|
|
34
|
+
const before = previous.current;
|
|
35
|
+
previous.current = { cards, camera, presentation };
|
|
36
|
+
const oldCards = new Map(before.cards.map((card) => [card.id, card]));
|
|
37
|
+
const layoutChanged = cards.some((card) => {
|
|
38
|
+
const old = oldCards.get(card.id);
|
|
39
|
+
return (!old && card.animateEntrance !== false && (card.entrance === "linked" || iterationId(card.content))) || (old && iterationId(card.content) && iterationId(old.content) !== iterationId(card.content));
|
|
40
|
+
});
|
|
41
|
+
const cameraChanged = camera.x !== before.camera.x || camera.y !== before.camera.y || camera.zoom !== before.camera.zoom;
|
|
42
|
+
const shouldAnimate = (layoutChanged || (cameraChanged && animations.current.length > 0))
|
|
43
|
+
&& presentation === "canvas" && before.presentation === "canvas"
|
|
44
|
+
&& !window.matchMedia?.("(prefers-reduced-motion: reduce)").matches;
|
|
45
|
+
const board = boardRef.current;
|
|
46
|
+
const animate = (element, frames, options = SLIDE_OPTIONS) => {
|
|
47
|
+
if (shouldAnimate && typeof element.animate === "function") {
|
|
48
|
+
animations.current.push(element.animate(frames, options));
|
|
49
|
+
}
|
|
50
|
+
};
|
|
51
|
+
if (shouldAnimate) {
|
|
52
|
+
generation.current += 1;
|
|
53
|
+
setCanvasLayoutTransitioning(true);
|
|
54
|
+
if (layoutChanged) {
|
|
55
|
+
for (const animation of animations.current)
|
|
56
|
+
animation.cancel();
|
|
57
|
+
animations.current = [];
|
|
58
|
+
}
|
|
59
|
+
for (const element of board?.querySelectorAll(".canvas-card") ?? []) {
|
|
60
|
+
const card = cards.find((item) => item.id === element.dataset.cardId);
|
|
61
|
+
if (!card)
|
|
62
|
+
continue;
|
|
63
|
+
const old = oldCards.get(card.id);
|
|
64
|
+
if (!old) {
|
|
65
|
+
if (card.animateEntrance === false)
|
|
66
|
+
continue;
|
|
67
|
+
const slideRight = Boolean(card.entrance === "linked");
|
|
68
|
+
animate(element, [
|
|
69
|
+
{ left: `${card.x - (slideRight ? 200 : 0)}px`, top: `${card.y - (slideRight ? 0 : 200)}px`, opacity: 0 },
|
|
70
|
+
{ left: `${card.x}px`, top: `${card.y}px`, opacity: 1 },
|
|
71
|
+
]);
|
|
72
|
+
}
|
|
73
|
+
else if (old.x !== card.x || old.y !== card.y) {
|
|
74
|
+
animate(element, [{ left: `${old.x}px`, top: `${old.y}px` }, { left: `${card.x}px`, top: `${card.y}px` }]);
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
const content = board?.querySelector(".canvas-workspace__board-content");
|
|
78
|
+
if (content && cameraChanged) {
|
|
79
|
+
const current = animations.current.find((animation) => animation.playState === "running"
|
|
80
|
+
&& animation.effect?.target === content);
|
|
81
|
+
const from = current ? getComputedStyle(content).transform
|
|
82
|
+
: `translate(${before.camera.x}px, ${before.camera.y}px) scale(${before.camera.zoom})`;
|
|
83
|
+
current?.cancel();
|
|
84
|
+
animate(content, [
|
|
85
|
+
{ transform: from },
|
|
86
|
+
{ transform: `translate(${camera.x}px, ${camera.y}px) scale(${camera.zoom})` },
|
|
87
|
+
], CAMERA_OPTIONS);
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
if (shouldAnimate) {
|
|
91
|
+
const current = generation.current;
|
|
92
|
+
void Promise.all(animations.current.map((animation) => animation.finished.catch(() => undefined))).then(() => {
|
|
93
|
+
if (generation.current !== current)
|
|
94
|
+
return;
|
|
95
|
+
animations.current = [];
|
|
96
|
+
setCanvasLayoutTransitioning(false);
|
|
97
|
+
});
|
|
98
|
+
}
|
|
99
|
+
else if (presentation !== before.presentation) {
|
|
100
|
+
generation.current += 1;
|
|
101
|
+
for (const animation of animations.current)
|
|
102
|
+
animation.cancel();
|
|
103
|
+
animations.current = [];
|
|
104
|
+
setCanvasLayoutTransitioning(false);
|
|
105
|
+
}
|
|
106
|
+
}, [boardRef, cards, camera, presentation]);
|
|
107
|
+
}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
export type CanvasMode = "inspect" | "canvas";
|
|
2
|
+
export type CanvasPresentation = "focus" | "canvas";
|
|
3
|
+
export interface CanvasCamera {
|
|
4
|
+
x: number;
|
|
5
|
+
y: number;
|
|
6
|
+
zoom: number;
|
|
7
|
+
}
|
|
8
|
+
export declare const MIN_CAMERA_ZOOM = 0.25;
|
|
9
|
+
export declare const MAX_CAMERA_ZOOM = 3;
|
|
10
|
+
export declare const DEFAULT_CAMERA: CanvasCamera;
|
|
11
|
+
export declare function subscribeCanvasView(listener: () => void): () => void;
|
|
12
|
+
export declare function getCanvasMode(): CanvasMode;
|
|
13
|
+
export declare function setCanvasMode(next: CanvasMode): void;
|
|
14
|
+
export declare function getCanvasPresentation(): CanvasPresentation;
|
|
15
|
+
export declare function setCanvasPresentation(next: CanvasPresentation): void;
|
|
16
|
+
/** Holding A temporarily enables app interaction without changing the selected tool. */
|
|
17
|
+
export declare function setTemporaryAppInteraction(value: boolean): void;
|
|
18
|
+
/** Element interactions pause while frame and camera geometry are animated. */
|
|
19
|
+
export declare function setCanvasLayoutTransitioning(value: boolean): void;
|
|
20
|
+
export declare function getCanvasLayoutTransitioning(): boolean;
|
|
21
|
+
export declare function getBoardCamera(): CanvasCamera;
|
|
22
|
+
export declare function setBoardCamera(next: CanvasCamera): void;
|
|
23
|
+
export declare function updateBoardCamera(partial: Partial<CanvasCamera>): void;
|
|
24
|
+
/** Moves the camera to frame content; the initial fit-all then no longer runs. */
|
|
25
|
+
export declare function placeBoardCamera(next: CanvasCamera): void;
|
|
26
|
+
export declare function hasFitAllRan(): boolean;
|
|
27
|
+
export declare function resetFitAllFlag(): void;
|
|
28
|
+
export declare function restoreCanvasView(next: {
|
|
29
|
+
mode: CanvasMode;
|
|
30
|
+
presentation: CanvasPresentation;
|
|
31
|
+
camera: CanvasCamera;
|
|
32
|
+
}): void;
|
|
33
|
+
export declare function useCanvasMode(): CanvasMode;
|
|
34
|
+
export declare function useCanvasPresentation(): CanvasPresentation;
|
|
35
|
+
export declare function useCanvasPresentationTransitioning(): boolean;
|
|
36
|
+
export declare function useTemporaryAppInteraction(): boolean;
|
|
37
|
+
export declare function useCanvasLayoutTransitioning(): boolean;
|
|
38
|
+
export declare function useBoardCamera(): CanvasCamera;
|
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
import { useSyncExternalStore } from "react";
|
|
2
|
+
export const MIN_CAMERA_ZOOM = 0.25;
|
|
3
|
+
export const MAX_CAMERA_ZOOM = 3;
|
|
4
|
+
export const DEFAULT_CAMERA = { x: 0, y: 0, zoom: 1 };
|
|
5
|
+
/** How the canvas is viewed. Frames, groups, and selection live in the canvas store. */
|
|
6
|
+
let mode = "inspect";
|
|
7
|
+
let presentation = "focus";
|
|
8
|
+
let presentationTransitioning = false;
|
|
9
|
+
let presentationTransitionTimer = null;
|
|
10
|
+
let layoutTransitioning = false;
|
|
11
|
+
let temporaryAppInteraction = false;
|
|
12
|
+
let camera = { ...DEFAULT_CAMERA };
|
|
13
|
+
let cameraPlaced = false;
|
|
14
|
+
const listeners = new Set();
|
|
15
|
+
function notify() {
|
|
16
|
+
for (const listener of listeners)
|
|
17
|
+
listener();
|
|
18
|
+
}
|
|
19
|
+
export function subscribeCanvasView(listener) {
|
|
20
|
+
listeners.add(listener);
|
|
21
|
+
return () => listeners.delete(listener);
|
|
22
|
+
}
|
|
23
|
+
function clampZoom(zoom) {
|
|
24
|
+
return Math.max(MIN_CAMERA_ZOOM, Math.min(MAX_CAMERA_ZOOM, zoom));
|
|
25
|
+
}
|
|
26
|
+
export function getCanvasMode() { return mode; }
|
|
27
|
+
export function setCanvasMode(next) {
|
|
28
|
+
if (mode === next)
|
|
29
|
+
return;
|
|
30
|
+
mode = next;
|
|
31
|
+
notify();
|
|
32
|
+
}
|
|
33
|
+
export function getCanvasPresentation() { return presentation; }
|
|
34
|
+
export function setCanvasPresentation(next) {
|
|
35
|
+
if (presentation === next)
|
|
36
|
+
return;
|
|
37
|
+
presentation = next;
|
|
38
|
+
presentationTransitioning = !window.matchMedia?.("(prefers-reduced-motion: reduce)").matches;
|
|
39
|
+
if (presentationTransitionTimer !== null)
|
|
40
|
+
window.clearTimeout(presentationTransitionTimer);
|
|
41
|
+
presentationTransitionTimer = presentationTransitioning
|
|
42
|
+
? window.setTimeout(() => {
|
|
43
|
+
presentationTransitionTimer = null;
|
|
44
|
+
presentationTransitioning = false;
|
|
45
|
+
notify();
|
|
46
|
+
}, 220)
|
|
47
|
+
: null;
|
|
48
|
+
notify();
|
|
49
|
+
}
|
|
50
|
+
/** Holding A temporarily enables app interaction without changing the selected tool. */
|
|
51
|
+
export function setTemporaryAppInteraction(value) {
|
|
52
|
+
if (temporaryAppInteraction === value)
|
|
53
|
+
return;
|
|
54
|
+
temporaryAppInteraction = value;
|
|
55
|
+
notify();
|
|
56
|
+
}
|
|
57
|
+
/** Element interactions pause while frame and camera geometry are animated. */
|
|
58
|
+
export function setCanvasLayoutTransitioning(value) {
|
|
59
|
+
if (layoutTransitioning === value)
|
|
60
|
+
return;
|
|
61
|
+
layoutTransitioning = value;
|
|
62
|
+
notify();
|
|
63
|
+
}
|
|
64
|
+
export function getCanvasLayoutTransitioning() { return layoutTransitioning; }
|
|
65
|
+
export function getBoardCamera() { return camera; }
|
|
66
|
+
export function setBoardCamera(next) {
|
|
67
|
+
camera = { x: next.x, y: next.y, zoom: clampZoom(next.zoom) };
|
|
68
|
+
notify();
|
|
69
|
+
}
|
|
70
|
+
export function updateBoardCamera(partial) {
|
|
71
|
+
setBoardCamera({ ...camera, ...partial });
|
|
72
|
+
}
|
|
73
|
+
/** Moves the camera to frame content; the initial fit-all then no longer runs. */
|
|
74
|
+
export function placeBoardCamera(next) {
|
|
75
|
+
cameraPlaced = true;
|
|
76
|
+
setBoardCamera(next);
|
|
77
|
+
}
|
|
78
|
+
export function hasFitAllRan() { return cameraPlaced; }
|
|
79
|
+
export function resetFitAllFlag() { cameraPlaced = false; }
|
|
80
|
+
export function restoreCanvasView(next) {
|
|
81
|
+
mode = next.mode;
|
|
82
|
+
presentation = next.presentation;
|
|
83
|
+
camera = { ...next.camera };
|
|
84
|
+
cameraPlaced = true;
|
|
85
|
+
notify();
|
|
86
|
+
}
|
|
87
|
+
export function useCanvasMode() {
|
|
88
|
+
return useSyncExternalStore(subscribeCanvasView, getCanvasMode, getCanvasMode);
|
|
89
|
+
}
|
|
90
|
+
export function useCanvasPresentation() {
|
|
91
|
+
return useSyncExternalStore(subscribeCanvasView, getCanvasPresentation, getCanvasPresentation);
|
|
92
|
+
}
|
|
93
|
+
export function useCanvasPresentationTransitioning() {
|
|
94
|
+
return useSyncExternalStore(subscribeCanvasView, () => presentationTransitioning, () => presentationTransitioning);
|
|
95
|
+
}
|
|
96
|
+
export function useTemporaryAppInteraction() {
|
|
97
|
+
return useSyncExternalStore(subscribeCanvasView, () => temporaryAppInteraction, () => temporaryAppInteraction);
|
|
98
|
+
}
|
|
99
|
+
export function useCanvasLayoutTransitioning() {
|
|
100
|
+
return useSyncExternalStore(subscribeCanvasView, getCanvasLayoutTransitioning, getCanvasLayoutTransitioning);
|
|
101
|
+
}
|
|
102
|
+
export function useBoardCamera() {
|
|
103
|
+
return useSyncExternalStore(subscribeCanvasView, getBoardCamera, getBoardCamera);
|
|
104
|
+
}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/** Converts wheel units to pixel distances for consistent canvas panning. */
|
|
2
|
+
export declare function wheelPanDelta(event: Pick<WheelEvent, "deltaX" | "deltaY" | "deltaMode" | "shiftKey">, viewport: {
|
|
3
|
+
width: number;
|
|
4
|
+
height: number;
|
|
5
|
+
}): {
|
|
6
|
+
x: number;
|
|
7
|
+
y: number;
|
|
8
|
+
};
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/** Converts wheel units to pixel distances for consistent canvas panning. */
|
|
2
|
+
export function wheelPanDelta(event, viewport) {
|
|
3
|
+
const xUnit = event.deltaMode === 1 ? 16 : event.deltaMode === 2 ? viewport.width : 1;
|
|
4
|
+
const yUnit = event.deltaMode === 1 ? 16 : event.deltaMode === 2 ? viewport.height : 1;
|
|
5
|
+
const x = event.deltaX * xUnit;
|
|
6
|
+
const y = event.deltaY * yUnit;
|
|
7
|
+
return event.shiftKey && x === 0 ? { x: y, y: 0 } : { x, y };
|
|
8
|
+
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { StyleRule } from "../projection/managedStylesheet.js";
|
|
2
2
|
import type { ChangeRecord } from "./types.js";
|
|
3
|
-
import { type CommitResult } from "./
|
|
3
|
+
import { type CommitResult } from "./draftChanges.js";
|
|
4
4
|
import type { StructuralChange } from "./structuralTypes.js";
|
|
5
5
|
export { isComponentChange, isElementChange, isTextContentChange, isTextContentChangeValue, isPreviewableChange, isTokenChange, } from "./types.js";
|
|
6
6
|
export type { ChangeRecord, ComponentChangeRecord, ElementChangeRecord, PreviewableChangeRecord, TextContentChangeRecord, TokenChangeRecord, RuntimeElementEvidence, } from "./types.js";
|
|
@@ -25,7 +25,7 @@ export declare function revertChange(change: ChangeRecord): void;
|
|
|
25
25
|
*/
|
|
26
26
|
export declare function reconcileVerifiedChanges(verifiedKeys: ReadonlySet<string>): number;
|
|
27
27
|
/** Atomically reconciles ordinary and structural intent from one agent handoff. */
|
|
28
|
-
export declare function
|
|
28
|
+
export declare function reconcileVerifiedDraftChanges(verifiedKeys: ReadonlySet<string>, verifiedStructuralIds: ReadonlySet<string>): number;
|
|
29
29
|
export declare function discardChangesForSelector(selector: string): void;
|
|
30
30
|
/** Relink removes every CSS declaration owned by one durable rendered target. */
|
|
31
31
|
export declare function discardChangesForInstanceOverride(overrideId: string): void;
|
|
@@ -38,9 +38,10 @@ export declare function redo(): boolean;
|
|
|
38
38
|
*/
|
|
39
39
|
export declare function restoreChangeRecords(incoming: ChangeRecord[]): void;
|
|
40
40
|
/** Restores every canonical workspace intent as one subscriber-visible snapshot. */
|
|
41
|
-
export declare function
|
|
42
|
-
/** Clears
|
|
43
|
-
export declare function
|
|
41
|
+
export declare function loadActiveDraftChanges(incoming: readonly ChangeRecord[], structuralChanges: readonly StructuralChange[], preserveHistory?: boolean): void;
|
|
42
|
+
/** Clears the active draft and its edit steps, preserving other session history. */
|
|
43
|
+
export declare function clearActiveDraft(): void;
|
|
44
44
|
export declare function getChangesList(): ChangeRecord[];
|
|
45
45
|
export { subscribe as subscribeChanges, getChangesSnapshot as getChanges };
|
|
46
46
|
export declare function useChanges(): ChangeRecord[];
|
|
47
|
+
export declare function refreshDraftPreview(): void;
|
|
@@ -1,13 +1,14 @@
|
|
|
1
|
+
import { canEditDraft } from "./draftChanges.js";
|
|
1
2
|
import { useSyncExternalStore } from "react";
|
|
2
3
|
import { getSelectedElement } from "../selection/selectionStore.js";
|
|
3
4
|
import { changeKey, } from "./model.js";
|
|
4
5
|
import { buildManagedStyleRules, verifyManagedStyleProjection, } from "./managedStyleProjection.js";
|
|
5
6
|
import { isPreviewableChange } from "./types.js";
|
|
6
7
|
import { cancelInlineTextForClear } from "../inline-text/inlineTextLifecycle.js";
|
|
7
|
-
import {
|
|
8
|
+
import { draftChangeStore, } from "./draftChanges.js";
|
|
8
9
|
import { beginPreviewAttempt, clearPreviewDiagnostics, getHostPreviewDocument, publishPreviewDiagnostic, } from "./previewDiagnostics.js";
|
|
9
10
|
import { clearStructuralProjectionReports, pruneStructuralProjectionReports } from "../projection/structuralProjection.js";
|
|
10
|
-
import {
|
|
11
|
+
import { applyHostDraftProjection, compileDraftProjection, } from "../projection/draftProjection.js";
|
|
11
12
|
import { isEditorShellDocument } from "../runtime/editorShell.js";
|
|
12
13
|
import { isOriginalPreviewActive, subscribeOriginalPreview, } from "../shell/originalPreview.js";
|
|
13
14
|
export { isComponentChange, isElementChange, isTextContentChange, isTextContentChangeValue, isPreviewableChange, isTokenChange, } from "./types.js";
|
|
@@ -19,12 +20,12 @@ export { isComponentChange, isElementChange, isTextContentChange, isTextContentC
|
|
|
19
20
|
let pendingVerificationTargets = new Map();
|
|
20
21
|
let verificationHandle = null;
|
|
21
22
|
function subscribe(cb) {
|
|
22
|
-
return
|
|
23
|
+
return draftChangeStore.subscribe(cb);
|
|
23
24
|
}
|
|
24
25
|
function getChangesSnapshot() {
|
|
25
26
|
// SAFETY: The public change model is the concrete record union stored by
|
|
26
27
|
// the workspace snapshot; this module preserves the mutable array facade.
|
|
27
|
-
return
|
|
28
|
+
return draftChangeStore.getSnapshot().changes;
|
|
28
29
|
}
|
|
29
30
|
export function getPendingRules() {
|
|
30
31
|
return buildManagedStyleRules(getChangesSnapshot());
|
|
@@ -36,7 +37,7 @@ function reapply(workspace) {
|
|
|
36
37
|
if (isOriginalPreviewActive())
|
|
37
38
|
return;
|
|
38
39
|
if (!isEditorShellDocument())
|
|
39
|
-
|
|
40
|
+
applyHostDraftProjection(compileDraftProjection(workspace));
|
|
40
41
|
}
|
|
41
42
|
function flushVerification() {
|
|
42
43
|
verificationHandle = null;
|
|
@@ -53,7 +54,7 @@ function flushVerification() {
|
|
|
53
54
|
if (isEditorShellDocument())
|
|
54
55
|
return;
|
|
55
56
|
const current = getChangesSnapshot();
|
|
56
|
-
const attempt = beginPreviewAttempt(getHostPreviewDocument(),
|
|
57
|
+
const attempt = beginPreviewAttempt(getHostPreviewDocument(), draftChangeStore.getSnapshot().revision);
|
|
57
58
|
if (!attempt)
|
|
58
59
|
return;
|
|
59
60
|
for (let i = 0; i < current.length; i++) {
|
|
@@ -125,10 +126,10 @@ subscribeOriginalPreview(() => {
|
|
|
125
126
|
});
|
|
126
127
|
/** Append records and report whether canonical workspace state changed. */
|
|
127
128
|
export function appendChanges(incoming, options = {}) {
|
|
128
|
-
const result =
|
|
129
|
+
const result = draftChangeStore.commitChangeRecords(incoming);
|
|
129
130
|
if (result !== "applied")
|
|
130
131
|
return result;
|
|
131
|
-
reapply(
|
|
132
|
+
reapply(draftChangeStore.getSnapshot());
|
|
132
133
|
// Re-verify the full surviving set so earlier diagnostics are refreshed at
|
|
133
134
|
// the new revision instead of being orphaned at the old one.
|
|
134
135
|
markForVerification(getChangesSnapshot().map(changeKey), options.verificationTargets);
|
|
@@ -138,9 +139,9 @@ export function appendChange(change) {
|
|
|
138
139
|
return appendChanges([change]);
|
|
139
140
|
}
|
|
140
141
|
export function revertChange(change) {
|
|
141
|
-
if (!
|
|
142
|
+
if (!draftChangeStore.revertChangeRecord(change))
|
|
142
143
|
return;
|
|
143
|
-
reapply(
|
|
144
|
+
reapply(draftChangeStore.getSnapshot());
|
|
144
145
|
markForVerification(getChangesSnapshot().map(changeKey));
|
|
145
146
|
}
|
|
146
147
|
/**
|
|
@@ -152,46 +153,46 @@ export function revertChange(change) {
|
|
|
152
153
|
* preserving newer, unsent edits and their remaining undo history.
|
|
153
154
|
*/
|
|
154
155
|
export function reconcileVerifiedChanges(verifiedKeys) {
|
|
155
|
-
const removed =
|
|
156
|
+
const removed = reconcileVerifiedDraftChanges(verifiedKeys, new Set());
|
|
156
157
|
if (removed === 0)
|
|
157
158
|
return 0;
|
|
158
159
|
return removed;
|
|
159
160
|
}
|
|
160
161
|
/** Atomically reconciles ordinary and structural intent from one agent handoff. */
|
|
161
|
-
export function
|
|
162
|
-
const removed =
|
|
162
|
+
export function reconcileVerifiedDraftChanges(verifiedKeys, verifiedStructuralIds) {
|
|
163
|
+
const removed = draftChangeStore.reconcileActiveDraftChanges(verifiedKeys, verifiedStructuralIds);
|
|
163
164
|
if (removed === 0)
|
|
164
165
|
return 0;
|
|
165
|
-
reapply(
|
|
166
|
+
reapply(draftChangeStore.getSnapshot());
|
|
166
167
|
pruneStructuralProjectionReports(verifiedStructuralIds);
|
|
167
168
|
markForVerification(getChangesSnapshot().map(changeKey));
|
|
168
169
|
return removed;
|
|
169
170
|
}
|
|
170
171
|
export function discardChangesForSelector(selector) {
|
|
171
|
-
if (!
|
|
172
|
+
if (!draftChangeStore.discardChangeRecords({ kind: "selector", selector }))
|
|
172
173
|
return;
|
|
173
|
-
reapply(
|
|
174
|
+
reapply(draftChangeStore.getSnapshot());
|
|
174
175
|
markForVerification(getChangesSnapshot().map(changeKey));
|
|
175
176
|
}
|
|
176
177
|
/** Relink removes every CSS declaration owned by one durable rendered target. */
|
|
177
178
|
export function discardChangesForInstanceOverride(overrideId) {
|
|
178
|
-
if (!
|
|
179
|
+
if (!draftChangeStore.discardChangeRecords({ kind: "instance-override", id: overrideId }))
|
|
179
180
|
return;
|
|
180
|
-
reapply(
|
|
181
|
+
reapply(draftChangeStore.getSnapshot());
|
|
181
182
|
markForVerification(getChangesSnapshot().map(changeKey));
|
|
182
183
|
}
|
|
183
184
|
export function undo() {
|
|
184
|
-
const undone =
|
|
185
|
+
const undone = draftChangeStore.undoChange();
|
|
185
186
|
if (undone)
|
|
186
|
-
reapply(
|
|
187
|
+
reapply(draftChangeStore.getSnapshot());
|
|
187
188
|
if (undone)
|
|
188
189
|
markForVerification(getChangesSnapshot().map(changeKey));
|
|
189
190
|
return undone;
|
|
190
191
|
}
|
|
191
192
|
export function redo() {
|
|
192
|
-
const redone =
|
|
193
|
+
const redone = draftChangeStore.redoChange();
|
|
193
194
|
if (redone)
|
|
194
|
-
reapply(
|
|
195
|
+
reapply(draftChangeStore.getSnapshot());
|
|
195
196
|
if (redone)
|
|
196
197
|
markForVerification(getChangesSnapshot().map(changeKey));
|
|
197
198
|
return redone;
|
|
@@ -207,28 +208,30 @@ export function restoreChangeRecords(incoming) {
|
|
|
207
208
|
// inspect a newly loaded record with its old selection context.
|
|
208
209
|
pendingVerificationTargets.clear();
|
|
209
210
|
clearPreviewDiagnostics();
|
|
210
|
-
const workspace =
|
|
211
|
-
|
|
212
|
-
reapply(
|
|
211
|
+
const workspace = draftChangeStore.getSnapshot();
|
|
212
|
+
draftChangeStore.restoreActiveDraftChanges({ changes: incoming, structuralChanges: workspace.structuralChanges });
|
|
213
|
+
reapply(draftChangeStore.getSnapshot());
|
|
213
214
|
}
|
|
214
215
|
/** Restores every canonical workspace intent as one subscriber-visible snapshot. */
|
|
215
|
-
export function
|
|
216
|
+
export function loadActiveDraftChanges(incoming, structuralChanges, preserveHistory = false) {
|
|
216
217
|
pendingVerificationTargets.clear();
|
|
217
218
|
clearPreviewDiagnostics();
|
|
218
219
|
clearStructuralProjectionReports();
|
|
219
|
-
|
|
220
|
-
reapply(
|
|
220
|
+
draftChangeStore.restoreActiveDraftChanges({ changes: incoming, structuralChanges }, preserveHistory);
|
|
221
|
+
reapply(draftChangeStore.getSnapshot());
|
|
221
222
|
}
|
|
222
|
-
/** Clears
|
|
223
|
-
export function
|
|
223
|
+
/** Clears the active draft and its edit steps, preserving other session history. */
|
|
224
|
+
export function clearActiveDraft() {
|
|
225
|
+
if (!canEditDraft())
|
|
226
|
+
return;
|
|
224
227
|
// A pending blur/composition timer must not be able to append a draft after
|
|
225
228
|
// the canonical set has been cleared.
|
|
226
229
|
cancelInlineTextForClear();
|
|
227
230
|
pendingVerificationTargets.clear();
|
|
228
231
|
clearPreviewDiagnostics();
|
|
229
232
|
clearStructuralProjectionReports();
|
|
230
|
-
|
|
231
|
-
reapply(
|
|
233
|
+
draftChangeStore.clearActiveDraftChanges();
|
|
234
|
+
reapply(draftChangeStore.getSnapshot());
|
|
232
235
|
}
|
|
233
236
|
export function getChangesList() {
|
|
234
237
|
return [...getChangesSnapshot()];
|
|
@@ -237,3 +240,8 @@ export { subscribe as subscribeChanges, getChangesSnapshot as getChanges };
|
|
|
237
240
|
export function useChanges() {
|
|
238
241
|
return useSyncExternalStore(subscribe, getChangesSnapshot, getChangesSnapshot);
|
|
239
242
|
}
|
|
243
|
+
export function refreshDraftPreview() {
|
|
244
|
+
pendingVerificationTargets.clear();
|
|
245
|
+
reapply(draftChangeStore.getSnapshot());
|
|
246
|
+
markForVerification(getChangesSnapshot().map(changeKey));
|
|
247
|
+
}
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import { type ChangeRecord } from "./types.js";
|
|
2
|
+
import type { StructuralChange } from "./structuralTypes.js";
|
|
3
|
+
export { recordCanvasChange, discardCanvasHistory, discardDraftHistory, clearSessionUndoHistory, createChangeHistoryGroup, } from "../workspace/timeline.js";
|
|
4
|
+
export interface DraftContents {
|
|
5
|
+
readonly changes: readonly ChangeRecord[];
|
|
6
|
+
readonly structuralChanges: readonly StructuralChange[];
|
|
7
|
+
}
|
|
8
|
+
export interface DraftChangesSnapshot extends DraftContents {
|
|
9
|
+
readonly draftId: string;
|
|
10
|
+
readonly revision: number;
|
|
11
|
+
readonly canUndo: boolean;
|
|
12
|
+
readonly canRedo: boolean;
|
|
13
|
+
}
|
|
14
|
+
export declare function lockDraft(id: string): () => void;
|
|
15
|
+
export declare function isDraftLocked(id?: string): boolean;
|
|
16
|
+
export declare function canEditDraft(id?: string): boolean;
|
|
17
|
+
export declare function setActiveDraft(id: string, activate?: () => void): void;
|
|
18
|
+
export type DraftProjector = (snapshot: DraftChangesSnapshot) => void;
|
|
19
|
+
export type CommitResult = "applied" | "unchanged" | "blocked";
|
|
20
|
+
export interface DraftChangeStore {
|
|
21
|
+
getSnapshot(): DraftChangesSnapshot;
|
|
22
|
+
subscribe(listener: () => void): () => void;
|
|
23
|
+
commitChangeRecords(incoming: readonly ChangeRecord[]): CommitResult;
|
|
24
|
+
revertChangeRecord(change: ChangeRecord): boolean;
|
|
25
|
+
discardChangeRecords(target: {
|
|
26
|
+
kind: "selector";
|
|
27
|
+
selector: string;
|
|
28
|
+
} | {
|
|
29
|
+
kind: "instance-override";
|
|
30
|
+
id: string;
|
|
31
|
+
}): boolean;
|
|
32
|
+
commitStructuralChange(change: StructuralChange): boolean;
|
|
33
|
+
revertStructuralChangeRecord(changeId: string): boolean;
|
|
34
|
+
reconcileActiveDraftChanges(verifiedKeys: ReadonlySet<string>, verifiedStructuralIds: ReadonlySet<string>): number;
|
|
35
|
+
undoChange(): boolean;
|
|
36
|
+
redoChange(): boolean;
|
|
37
|
+
restoreActiveDraftChanges(next: DraftContents, preserveHistory?: boolean): void;
|
|
38
|
+
clearActiveDraftChanges(): void;
|
|
39
|
+
}
|
|
40
|
+
export declare function subscribeDraftChanges(listener: (draftId: string) => void): () => void;
|
|
41
|
+
export declare function getDraftChanges(id: string): DraftChangesSnapshot;
|
|
42
|
+
export declare function restoreDraftChanges(id: string, next: DraftContents, revision?: number): void;
|
|
43
|
+
export declare function reconcileDraftChanges(id: string, verifiedKeys: ReadonlySet<string>, verifiedStructuralIds: ReadonlySet<string>): number;
|
|
44
|
+
export declare function clearDraftChanges(id: string, expectedRevision?: number): boolean;
|
|
45
|
+
export declare function listDraftIds(): readonly string[];
|
|
46
|
+
/** Drops a draft whose content no longer exists, such as a deleted iteration. */
|
|
47
|
+
export declare function forgetDraft(id: string): void;
|
|
48
|
+
export declare const draftChangeStore: DraftChangeStore;
|
|
49
|
+
export declare function getActiveDraftChanges(): DraftChangesSnapshot;
|
|
50
|
+
export declare function subscribeActiveDraftChanges(listener: () => void): () => void;
|
|
51
|
+
export declare function commitChangeRecords(incoming: readonly ChangeRecord[], project: DraftProjector): CommitResult;
|
|
52
|
+
export declare function commitStructuralChange(change: StructuralChange, project: DraftProjector): boolean;
|
|
53
|
+
export declare function undoChange(project: DraftProjector): boolean;
|
|
54
|
+
export declare function redoChange(project: DraftProjector): boolean;
|
|
55
|
+
export declare function restoreActiveDraftChanges(next: DraftContents, project: DraftProjector): void;
|
|
56
|
+
export declare function resetDraftChanges(): void;
|