@lace-cloud/canvas 0.31.2 → 0.32.1
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 +2 -2
- package/dist/{chunk-PABP6EXP.mjs → chunk-J5BZ7EOQ.mjs} +247 -247
- package/dist/chunk-J5BZ7EOQ.mjs.map +1 -0
- package/dist/engine/index.cjs +245 -245
- package/dist/engine/index.cjs.map +1 -1
- package/dist/engine/index.d.mts +4 -3
- package/dist/engine/index.d.ts +4 -3
- package/dist/engine/index.mjs +1 -1
- package/dist/index.cjs +332 -303
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.mts +7 -4
- package/dist/index.d.ts +7 -4
- package/dist/index.mjs +67 -31
- package/dist/index.mjs.map +1 -1
- package/dist/{registry-CCqHplDe.d.mts → registry-BLwYarIE.d.mts} +2054 -2045
- package/dist/{registry-CCqHplDe.d.ts → registry-BLwYarIE.d.ts} +2054 -2045
- package/package.json +12 -8
- package/dist/chunk-PABP6EXP.mjs.map +0 -1
package/dist/index.d.mts
CHANGED
|
@@ -4,8 +4,8 @@ export { Toast } from '@lace-cloud/ui/feedback';
|
|
|
4
4
|
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
5
5
|
import * as React from 'react';
|
|
6
6
|
import React__default, { FC, ReactNode } from 'react';
|
|
7
|
-
import {
|
|
8
|
-
export {
|
|
7
|
+
import { aZ as ContributionSet, a_ as PanelSpec, a$ as CanvasCtx, k as CanvasPorts, ab as ResultStore, S as SourcePort, A as ActionContribution, b0 as Badge, b1 as NodeDecoration, b2 as Decorations, $ as PendingForm, h as BoundPath, b3 as CommandRead, J as JsonOf, b4 as OverlayContribution, d as ActionTarget, r as CommandResult, l as CanvasSource, ap as SourceEnd, b as ActionRunner, b5 as Bundle, b6 as CanvasSelection, b7 as LayoutHandle } from './registry-BLwYarIE.mjs';
|
|
8
|
+
export { b8 as ActionIcon, c as ActionRunnerOptions, e as ApplyResult, f as ApplyUnobservedError, g as ArgsOf, B as BindingRuntime, i as BridgeEngineCaller, j as Busy, C as COMMANDS, b9 as ClipboardStore, m as CommandBinding, n as CommandDetachedError, o as CommandExitError, p as CommandFailure, q as CommandPath, s as CommandRun, t as CommandUnobservedError, u as CommandsPort, v as ConfirmSpec, w as ConnectCallerOptions, x as ConnectError, ba as ContextKey, y as ContextPort, z as CreatedRef, D as DirectEngineCaller, E as EMPTY_REPORT_FOLD, bb as EditorBinding, bc as EditorEnv, bd as EditorEnvExtras, F as EditorPort, G as EngineCaller, H as EngineMethodResponse, I as EngineSession, K as EngineSessionOptions, L as EngineTarget, M as ErasedCommand, N as FollowSlot, O as GENERATE_STAGES, P as GateChangeRequest, Q as GenerateEvent, R as GenerateStage, T as GeneratedTree, U as GraphError, V as HostBinding, X as Invocation, be as KeySpec, bf as Placement, a0 as PortName, a1 as PresenterPort, a2 as PreviewOutcome, a3 as PreviewSlot, a4 as Reason, a5 as ReportEntry, a6 as ReportFold, a7 as ReportPath, a8 as ReportSlot, a9 as ResultKind, aa as ResultSlots, ac as RunCtx, ad as RunOutcome, ae as RunSlot, ah as RunnerPorts, ai as RunningMark, aj as SCHEMAS, ak as Sink, al as SinkInput, am as SlotContext, an as SlotKind, ao as SourceConflict, aq as StackRef, ar as Started, as as ViewStatePort, at as WiringCandidate, au as WiringQuery, av as answering, aw as bridgeCaller, ax as carriesFailure, ay as commandPathOf, az as commandUnderWay, aA as connectCaller, aB as createActionRunner, aC as createResultStore, aD as currentReport, aE as defineCommand, aF as diagnosticsOf, bg as disabledReason, aI as foldReport, aJ as generatedTree, aK as isBoundPath, aM as openEngineCommands, aN as openEngineSession, aO as parseBound, aP as parseCommandFailure, aV as reportDiagnostics, bh as resolveContributions, bi as rowActions, aX as toArgv, aY as uniqueDiagnostics } from './registry-BLwYarIE.mjs';
|
|
9
9
|
import { NodeProps, Node } from '@xyflow/react';
|
|
10
10
|
import 'zod';
|
|
11
11
|
import '@bufbuild/protobuf/wire';
|
|
@@ -102,7 +102,7 @@ declare class ErrorBoundary extends React__default.Component<{
|
|
|
102
102
|
static getDerivedStateFromError(error: Error): {
|
|
103
103
|
error: Error;
|
|
104
104
|
};
|
|
105
|
-
render(): string | number | boolean | Iterable<React__default.ReactNode> |
|
|
105
|
+
render(): string | number | boolean | react_jsx_runtime.JSX.Element | Iterable<React__default.ReactNode> | null | undefined;
|
|
106
106
|
}
|
|
107
107
|
|
|
108
108
|
type InterfacePin = NodePin & {
|
|
@@ -312,6 +312,8 @@ type CommandReadState<P extends BoundPath> = {
|
|
|
312
312
|
};
|
|
313
313
|
declare function useCommandRead<P extends BoundPath>(read: CommandRead<P>, target?: ActionTarget): CommandReadState<P>;
|
|
314
314
|
|
|
315
|
+
declare function useEditing(runner: Pick<ActionRunner, 'editing' | 'onEditingChange'>): boolean;
|
|
316
|
+
|
|
315
317
|
type CanvasContextValue = {
|
|
316
318
|
ports: CanvasPorts;
|
|
317
319
|
bundle: Bundle;
|
|
@@ -331,4 +333,5 @@ type CanvasContextValue = {
|
|
|
331
333
|
declare const CanvasContext: React.Context<CanvasContextValue | null>;
|
|
332
334
|
declare function useCanvas(): CanvasContextValue;
|
|
333
335
|
|
|
334
|
-
export { AccordionSection, ActionContribution, ActionRunner, ActionTarget, App,
|
|
336
|
+
export { AccordionSection, ActionContribution, ActionRunner, ActionTarget, App, Badge, BoundPath, CanvasContext, CanvasCtx, CanvasPorts, CanvasSelection, CanvasSource, CommandArgsForm, CommandRead, CommandResult, ConflictBanner, ContextMenu, ContributionSet, Decorations, EdgeInspectorPanel, ErrorBoundary, ErrorState, GroupNode, JsonOf, LocalsContent, LocalsPanel, ModuleConfigPanel, ModuleInterfaceContent, ModuleInterfacePanel, ModuleNode, NodeConfigBusProvider, NodeDecoration, OverlayContribution, PanelScope, PanelSpec, PendingForm, ProvidersContent, ProvidersPanel, ResultStore, SnapshotFetchError, SourceEnd, SourcePort, SourceRefusedBanner, TerraformConfigContent, TerraformConfigPanel, UngeneratedMarker, UnifiedSettingsPanel, UnsavedMarker, conflictPanel, decorate, decorateDescribe, defineOverlay, describeOverlay, snapshotSource, sourceRefusedPanel, ungeneratedMarker, unsavedMarker, useCanvas, useCanvasSource, useCommandRead, useEditing, usePanelScope };
|
|
337
|
+
export type { AppProps, CanvasContextValue, CommandArgsFormProps, CommandReadState, Contributions, GroupNodeData, InterfacePin, ModuleNodeData, Panel, PanelProps, PanelScopeValue, SnapshotSourceInput };
|
package/dist/index.d.ts
CHANGED
|
@@ -4,8 +4,8 @@ export { Toast } from '@lace-cloud/ui/feedback';
|
|
|
4
4
|
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
5
5
|
import * as React from 'react';
|
|
6
6
|
import React__default, { FC, ReactNode } from 'react';
|
|
7
|
-
import {
|
|
8
|
-
export {
|
|
7
|
+
import { aZ as ContributionSet, a_ as PanelSpec, a$ as CanvasCtx, k as CanvasPorts, ab as ResultStore, S as SourcePort, A as ActionContribution, b0 as Badge, b1 as NodeDecoration, b2 as Decorations, $ as PendingForm, h as BoundPath, b3 as CommandRead, J as JsonOf, b4 as OverlayContribution, d as ActionTarget, r as CommandResult, l as CanvasSource, ap as SourceEnd, b as ActionRunner, b5 as Bundle, b6 as CanvasSelection, b7 as LayoutHandle } from './registry-BLwYarIE.js';
|
|
8
|
+
export { b8 as ActionIcon, c as ActionRunnerOptions, e as ApplyResult, f as ApplyUnobservedError, g as ArgsOf, B as BindingRuntime, i as BridgeEngineCaller, j as Busy, C as COMMANDS, b9 as ClipboardStore, m as CommandBinding, n as CommandDetachedError, o as CommandExitError, p as CommandFailure, q as CommandPath, s as CommandRun, t as CommandUnobservedError, u as CommandsPort, v as ConfirmSpec, w as ConnectCallerOptions, x as ConnectError, ba as ContextKey, y as ContextPort, z as CreatedRef, D as DirectEngineCaller, E as EMPTY_REPORT_FOLD, bb as EditorBinding, bc as EditorEnv, bd as EditorEnvExtras, F as EditorPort, G as EngineCaller, H as EngineMethodResponse, I as EngineSession, K as EngineSessionOptions, L as EngineTarget, M as ErasedCommand, N as FollowSlot, O as GENERATE_STAGES, P as GateChangeRequest, Q as GenerateEvent, R as GenerateStage, T as GeneratedTree, U as GraphError, V as HostBinding, X as Invocation, be as KeySpec, bf as Placement, a0 as PortName, a1 as PresenterPort, a2 as PreviewOutcome, a3 as PreviewSlot, a4 as Reason, a5 as ReportEntry, a6 as ReportFold, a7 as ReportPath, a8 as ReportSlot, a9 as ResultKind, aa as ResultSlots, ac as RunCtx, ad as RunOutcome, ae as RunSlot, ah as RunnerPorts, ai as RunningMark, aj as SCHEMAS, ak as Sink, al as SinkInput, am as SlotContext, an as SlotKind, ao as SourceConflict, aq as StackRef, ar as Started, as as ViewStatePort, at as WiringCandidate, au as WiringQuery, av as answering, aw as bridgeCaller, ax as carriesFailure, ay as commandPathOf, az as commandUnderWay, aA as connectCaller, aB as createActionRunner, aC as createResultStore, aD as currentReport, aE as defineCommand, aF as diagnosticsOf, bg as disabledReason, aI as foldReport, aJ as generatedTree, aK as isBoundPath, aM as openEngineCommands, aN as openEngineSession, aO as parseBound, aP as parseCommandFailure, aV as reportDiagnostics, bh as resolveContributions, bi as rowActions, aX as toArgv, aY as uniqueDiagnostics } from './registry-BLwYarIE.js';
|
|
9
9
|
import { NodeProps, Node } from '@xyflow/react';
|
|
10
10
|
import 'zod';
|
|
11
11
|
import '@bufbuild/protobuf/wire';
|
|
@@ -102,7 +102,7 @@ declare class ErrorBoundary extends React__default.Component<{
|
|
|
102
102
|
static getDerivedStateFromError(error: Error): {
|
|
103
103
|
error: Error;
|
|
104
104
|
};
|
|
105
|
-
render(): string | number | boolean | Iterable<React__default.ReactNode> |
|
|
105
|
+
render(): string | number | boolean | react_jsx_runtime.JSX.Element | Iterable<React__default.ReactNode> | null | undefined;
|
|
106
106
|
}
|
|
107
107
|
|
|
108
108
|
type InterfacePin = NodePin & {
|
|
@@ -312,6 +312,8 @@ type CommandReadState<P extends BoundPath> = {
|
|
|
312
312
|
};
|
|
313
313
|
declare function useCommandRead<P extends BoundPath>(read: CommandRead<P>, target?: ActionTarget): CommandReadState<P>;
|
|
314
314
|
|
|
315
|
+
declare function useEditing(runner: Pick<ActionRunner, 'editing' | 'onEditingChange'>): boolean;
|
|
316
|
+
|
|
315
317
|
type CanvasContextValue = {
|
|
316
318
|
ports: CanvasPorts;
|
|
317
319
|
bundle: Bundle;
|
|
@@ -331,4 +333,5 @@ type CanvasContextValue = {
|
|
|
331
333
|
declare const CanvasContext: React.Context<CanvasContextValue | null>;
|
|
332
334
|
declare function useCanvas(): CanvasContextValue;
|
|
333
335
|
|
|
334
|
-
export { AccordionSection, ActionContribution, ActionRunner, ActionTarget, App,
|
|
336
|
+
export { AccordionSection, ActionContribution, ActionRunner, ActionTarget, App, Badge, BoundPath, CanvasContext, CanvasCtx, CanvasPorts, CanvasSelection, CanvasSource, CommandArgsForm, CommandRead, CommandResult, ConflictBanner, ContextMenu, ContributionSet, Decorations, EdgeInspectorPanel, ErrorBoundary, ErrorState, GroupNode, JsonOf, LocalsContent, LocalsPanel, ModuleConfigPanel, ModuleInterfaceContent, ModuleInterfacePanel, ModuleNode, NodeConfigBusProvider, NodeDecoration, OverlayContribution, PanelScope, PanelSpec, PendingForm, ProvidersContent, ProvidersPanel, ResultStore, SnapshotFetchError, SourceEnd, SourcePort, SourceRefusedBanner, TerraformConfigContent, TerraformConfigPanel, UngeneratedMarker, UnifiedSettingsPanel, UnsavedMarker, conflictPanel, decorate, decorateDescribe, defineOverlay, describeOverlay, snapshotSource, sourceRefusedPanel, ungeneratedMarker, unsavedMarker, useCanvas, useCanvasSource, useCommandRead, useEditing, usePanelScope };
|
|
337
|
+
export type { AppProps, CanvasContextValue, CommandArgsFormProps, CommandReadState, Contributions, GroupNodeData, InterfacePin, ModuleNodeData, Panel, PanelProps, PanelScopeValue, SnapshotSourceInput };
|
package/dist/index.mjs
CHANGED
|
@@ -46,7 +46,7 @@ import {
|
|
|
46
46
|
rowActions,
|
|
47
47
|
toArgv,
|
|
48
48
|
uniqueDiagnostics
|
|
49
|
-
} from "./chunk-
|
|
49
|
+
} from "./chunk-J5BZ7EOQ.mjs";
|
|
50
50
|
|
|
51
51
|
// src/index.ts
|
|
52
52
|
import { projectCanvasView as projectCanvasView2 } from "@lace-cloud/proto";
|
|
@@ -57,11 +57,11 @@ import { ReactFlowProvider } from "@xyflow/react";
|
|
|
57
57
|
import {
|
|
58
58
|
Fragment as Fragment14,
|
|
59
59
|
useCallback as useCallback11,
|
|
60
|
-
useEffect as
|
|
60
|
+
useEffect as useEffect12,
|
|
61
61
|
useLayoutEffect as useLayoutEffect5,
|
|
62
62
|
useMemo as useMemo12,
|
|
63
63
|
useRef as useRef12,
|
|
64
|
-
useState as
|
|
64
|
+
useState as useState18,
|
|
65
65
|
useSyncExternalStore
|
|
66
66
|
} from "react";
|
|
67
67
|
import "./App-IFIOMNV7.css";
|
|
@@ -2497,20 +2497,32 @@ function sightOf(pane) {
|
|
|
2497
2497
|
function useViewport(pane, focusIds) {
|
|
2498
2498
|
const { fitView, getNode, getNodes, getNodesBounds, getViewport, setViewport } = useReactFlow2();
|
|
2499
2499
|
const headingRef = useRef7(null);
|
|
2500
|
+
const keptRevealRef = useRef7(null);
|
|
2500
2501
|
const heading = useCallback7(() => {
|
|
2501
2502
|
const h = headingRef.current;
|
|
2502
2503
|
return h && performance.now() < h.until ? h : null;
|
|
2503
2504
|
}, []);
|
|
2504
2505
|
const move = useCallback7(
|
|
2505
|
-
(viewport,
|
|
2506
|
-
headingRef.current = { viewport,
|
|
2506
|
+
(viewport, duration) => {
|
|
2507
|
+
headingRef.current = { viewport, until: performance.now() + duration };
|
|
2507
2508
|
void setViewport(viewport, { duration });
|
|
2508
2509
|
},
|
|
2509
2510
|
[setViewport]
|
|
2510
2511
|
);
|
|
2512
|
+
const moved = useCallback7(() => {
|
|
2513
|
+
headingRef.current = null;
|
|
2514
|
+
keptRevealRef.current = null;
|
|
2515
|
+
}, []);
|
|
2516
|
+
const onMoveStart = useCallback7(
|
|
2517
|
+
(event) => {
|
|
2518
|
+
if (event) moved();
|
|
2519
|
+
},
|
|
2520
|
+
[moved]
|
|
2521
|
+
);
|
|
2511
2522
|
const fit = useCallback7(() => {
|
|
2512
2523
|
if (!pane) return;
|
|
2513
2524
|
headingRef.current = null;
|
|
2525
|
+
keptRevealRef.current = null;
|
|
2514
2526
|
const { pane: size, visible } = sightOf(pane);
|
|
2515
2527
|
void fitView({ ...FIT, padding: fitPadding(size, visible) });
|
|
2516
2528
|
}, [pane, fitView]);
|
|
@@ -2519,9 +2531,10 @@ function useViewport(pane, focusIds) {
|
|
|
2519
2531
|
if (!pane) return;
|
|
2520
2532
|
const from = heading()?.viewport ?? getViewport();
|
|
2521
2533
|
const room = withMargin(rect, REVEAL_MARGIN, from.zoom);
|
|
2534
|
+
keptRevealRef.current = room;
|
|
2522
2535
|
const { dx, dy } = computeMinimalPanDelta(room, sightOf(pane).visible, from);
|
|
2523
2536
|
if (dx === 0 && dy === 0) return;
|
|
2524
|
-
move({ x: from.x + dx, y: from.y + dy, zoom: from.zoom },
|
|
2537
|
+
move({ x: from.x + dx, y: from.y + dy, zoom: from.zoom }, PAN_MS);
|
|
2525
2538
|
},
|
|
2526
2539
|
[pane, heading, getViewport, move]
|
|
2527
2540
|
);
|
|
@@ -2529,13 +2542,13 @@ function useViewport(pane, focusIds) {
|
|
|
2529
2542
|
});
|
|
2530
2543
|
useLayoutEffect2(() => {
|
|
2531
2544
|
resized.current = (was, after) => {
|
|
2532
|
-
const
|
|
2533
|
-
const from = pending?.viewport ?? getViewport();
|
|
2545
|
+
const from = heading()?.viewport ?? getViewport();
|
|
2534
2546
|
const drawn = getNodes().filter((n) => !n.hidden);
|
|
2535
2547
|
const selected = focusIds.filter((id) => getNode(id));
|
|
2548
|
+
const revealed = keptRevealRef.current;
|
|
2536
2549
|
const kept = [
|
|
2537
2550
|
...selected.length > 0 ? [withMargin(getNodesBounds(selected), REVEAL_MARGIN, from.zoom)] : [],
|
|
2538
|
-
...
|
|
2551
|
+
...revealed ? [revealed] : []
|
|
2539
2552
|
];
|
|
2540
2553
|
const outcome = viewportAfterResize(
|
|
2541
2554
|
from,
|
|
@@ -2545,7 +2558,7 @@ function useViewport(pane, focusIds) {
|
|
|
2545
2558
|
kept.length > 0 ? extentOf2(kept) : null
|
|
2546
2559
|
);
|
|
2547
2560
|
if (outcome.kind === "fit") fit();
|
|
2548
|
-
else if (outcome.kind === "move") move(outcome.viewport,
|
|
2561
|
+
else if (outcome.kind === "move") move(outcome.viewport, RESIZE_MS);
|
|
2549
2562
|
};
|
|
2550
2563
|
});
|
|
2551
2564
|
useEffect7(() => {
|
|
@@ -2556,8 +2569,13 @@ function useViewport(pane, focusIds) {
|
|
|
2556
2569
|
let held;
|
|
2557
2570
|
let pressed = false;
|
|
2558
2571
|
let releasedAt = Number.NEGATIVE_INFINITY;
|
|
2559
|
-
const
|
|
2572
|
+
const onChrome = (event) => event.target instanceof Element && event.target.closest(CHROME);
|
|
2573
|
+
const press = (event) => {
|
|
2560
2574
|
pressed = true;
|
|
2575
|
+
if (onChrome(event)) moved();
|
|
2576
|
+
};
|
|
2577
|
+
const wheel = (event) => {
|
|
2578
|
+
if (onChrome(event)) moved();
|
|
2561
2579
|
};
|
|
2562
2580
|
const release = () => {
|
|
2563
2581
|
pressed = false;
|
|
@@ -2586,6 +2604,7 @@ function useViewport(pane, focusIds) {
|
|
|
2586
2604
|
});
|
|
2587
2605
|
observer.observe(pane);
|
|
2588
2606
|
pane.addEventListener("pointerdown", press, true);
|
|
2607
|
+
pane.addEventListener("wheel", wheel, { capture: true, passive: true });
|
|
2589
2608
|
window.addEventListener("pointerup", release, true);
|
|
2590
2609
|
window.addEventListener("pointercancel", release, true);
|
|
2591
2610
|
return () => {
|
|
@@ -2593,11 +2612,12 @@ function useViewport(pane, focusIds) {
|
|
|
2593
2612
|
clearTimeout(held);
|
|
2594
2613
|
observer.disconnect();
|
|
2595
2614
|
pane.removeEventListener("pointerdown", press, true);
|
|
2615
|
+
pane.removeEventListener("wheel", wheel, true);
|
|
2596
2616
|
window.removeEventListener("pointerup", release, true);
|
|
2597
2617
|
window.removeEventListener("pointercancel", release, true);
|
|
2598
2618
|
};
|
|
2599
|
-
}, [pane]);
|
|
2600
|
-
return useMemo5(() => ({ fit, panIntoView }), [fit, panIntoView]);
|
|
2619
|
+
}, [pane, moved]);
|
|
2620
|
+
return useMemo5(() => ({ fit, panIntoView, onMoveStart }), [fit, panIntoView, onMoveStart]);
|
|
2601
2621
|
}
|
|
2602
2622
|
|
|
2603
2623
|
// src/Canvas.tsx
|
|
@@ -2759,6 +2779,7 @@ function CompositeEditor({
|
|
|
2759
2779
|
edgesReconnectable: editable,
|
|
2760
2780
|
deleteKeyCode: null,
|
|
2761
2781
|
fitView: false,
|
|
2782
|
+
onMoveStart: viewport.onMoveStart,
|
|
2762
2783
|
proOptions: { hideAttribution: true },
|
|
2763
2784
|
style: { background: "var(--lace-color-bg-canvas)" },
|
|
2764
2785
|
children: [
|
|
@@ -3681,14 +3702,17 @@ import { createElement as createElement2 } from "react";
|
|
|
3681
3702
|
|
|
3682
3703
|
// src/components/panels/ModuleConfigPanel.tsx
|
|
3683
3704
|
import { deriveNodeConfig, instanceAddress as instanceAddress6 } from "@lace-cloud/proto";
|
|
3684
|
-
import {
|
|
3705
|
+
import {
|
|
3706
|
+
assertNever,
|
|
3707
|
+
Button as Button12,
|
|
3708
|
+
IconButton as IconButton9,
|
|
3709
|
+
Input as Input8,
|
|
3710
|
+
ModeToggle,
|
|
3711
|
+
Panel as Panel6,
|
|
3712
|
+
Textarea as Textarea3
|
|
3713
|
+
} from "@lace-cloud/ui";
|
|
3685
3714
|
import { useMemo as useMemo11 } from "react";
|
|
3686
3715
|
|
|
3687
|
-
// src/exhaustive.ts
|
|
3688
|
-
function assertNever(value) {
|
|
3689
|
-
throw new Error(`Unhandled closed-enum branch: ${JSON.stringify(value)}`);
|
|
3690
|
-
}
|
|
3691
|
-
|
|
3692
3716
|
// src/hooks/useDraft.ts
|
|
3693
3717
|
import { useState as useState13 } from "react";
|
|
3694
3718
|
|
|
@@ -5833,6 +5857,17 @@ var CORE_CONTRIBUTIONS = {
|
|
|
5833
5857
|
actions: [...MODULE_COMMAND_ACTIONS, ...CORE_EDITOR_ACTIONS, disconnectEdge]
|
|
5834
5858
|
};
|
|
5835
5859
|
|
|
5860
|
+
// src/core/use-editing.ts
|
|
5861
|
+
import { useEffect as useEffect11, useState as useState17 } from "react";
|
|
5862
|
+
function useEditing(runner) {
|
|
5863
|
+
const [editing, setEditing] = useState17(() => runner.editing());
|
|
5864
|
+
useEffect11(() => {
|
|
5865
|
+
setEditing(runner.editing());
|
|
5866
|
+
return runner.onEditingChange(setEditing);
|
|
5867
|
+
}, [runner]);
|
|
5868
|
+
return editing;
|
|
5869
|
+
}
|
|
5870
|
+
|
|
5836
5871
|
// src/App.tsx
|
|
5837
5872
|
import { jsx as jsx37, jsxs as jsxs23 } from "react/jsx-runtime";
|
|
5838
5873
|
var EMPTY_CONTRIBUTIONS = { overlays: [], panels: [], actions: [] };
|
|
@@ -5861,14 +5896,14 @@ function OverlayDecorations({
|
|
|
5861
5896
|
onDecorations
|
|
5862
5897
|
}) {
|
|
5863
5898
|
const decorations = overlay.useDecorations(ctx);
|
|
5864
|
-
|
|
5899
|
+
useEffect12(() => {
|
|
5865
5900
|
onDecorations(overlay.id, decorations);
|
|
5866
5901
|
}, [overlay.id, decorations, onDecorations]);
|
|
5867
|
-
|
|
5902
|
+
useEffect12(() => () => onDecorations(overlay.id, null), [overlay.id, onDecorations]);
|
|
5868
5903
|
return null;
|
|
5869
5904
|
}
|
|
5870
5905
|
function PanelSlot({ panel, ctx, tick }) {
|
|
5871
|
-
const [readErrors, setReadErrors] =
|
|
5906
|
+
const [readErrors, setReadErrors] = useState18(/* @__PURE__ */ new Map());
|
|
5872
5907
|
const onReadError = useCallback11((path, error) => {
|
|
5873
5908
|
setReadErrors((prev) => {
|
|
5874
5909
|
if (error === null) {
|
|
@@ -5906,7 +5941,7 @@ function BottomTabs({
|
|
|
5906
5941
|
ctx,
|
|
5907
5942
|
tick
|
|
5908
5943
|
}) {
|
|
5909
|
-
const [manualId, setManualId] =
|
|
5944
|
+
const [manualId, setManualId] = useState18(null);
|
|
5910
5945
|
const manual = manualId !== null ? panels.find((p) => p.id === manualId) : void 0;
|
|
5911
5946
|
const active = manual ?? panels[0] ?? null;
|
|
5912
5947
|
if (panels.length === 0) return null;
|
|
@@ -5949,16 +5984,16 @@ function App({
|
|
|
5949
5984
|
);
|
|
5950
5985
|
const dropReport = useCallback11((session2) => results.detach("report", session2), [results]);
|
|
5951
5986
|
const { source, end, session } = useCanvasSource(ports.source, writeReport, dropReport);
|
|
5952
|
-
const [arrangement, setArrangement] =
|
|
5987
|
+
const [arrangement, setArrangement] = useState18(() => ports.viewState.load());
|
|
5953
5988
|
const stack = ports.context.stack;
|
|
5954
|
-
const [selection, setSelection] =
|
|
5955
|
-
const [settingsOpen, setSettingsOpen] =
|
|
5989
|
+
const [selection, setSelection] = useState18(NO_SELECTION);
|
|
5990
|
+
const [settingsOpen, setSettingsOpen] = useState18(false);
|
|
5956
5991
|
const select = useCallback11((next) => {
|
|
5957
5992
|
setSelection(next);
|
|
5958
5993
|
if (next.nodes.length > 0 || next.edges.length > 0) setSettingsOpen(false);
|
|
5959
5994
|
}, []);
|
|
5960
|
-
const [pendingForm, setPendingForm] =
|
|
5961
|
-
const [overlayDecorations, setOverlayDecorations] =
|
|
5995
|
+
const [pendingForm, setPendingForm] = useState18(null);
|
|
5996
|
+
const [overlayDecorations, setOverlayDecorations] = useState18({});
|
|
5962
5997
|
const layoutRef = useRef12({ panIntoView: () => {
|
|
5963
5998
|
} });
|
|
5964
5999
|
const { commands, presenter, editor } = ports;
|
|
@@ -5968,13 +6003,13 @@ function App({
|
|
|
5968
6003
|
}),
|
|
5969
6004
|
[commands, presenter, editor, results]
|
|
5970
6005
|
);
|
|
5971
|
-
|
|
6006
|
+
useEffect12(() => {
|
|
5972
6007
|
return () => {
|
|
5973
6008
|
runner.dispose();
|
|
5974
6009
|
};
|
|
5975
6010
|
}, [runner]);
|
|
5976
6011
|
const tick = useSyncExternalStore(results.subscribe, results.getTick);
|
|
5977
|
-
const editing =
|
|
6012
|
+
const editing = useEditing(runner);
|
|
5978
6013
|
const updateArrangement = useCallback11(
|
|
5979
6014
|
(next) => {
|
|
5980
6015
|
setArrangement(next);
|
|
@@ -6070,7 +6105,7 @@ function App({
|
|
|
6070
6105
|
resolved.panels.filter((panel) => panel.slot === "toolbar")
|
|
6071
6106
|
);
|
|
6072
6107
|
const rootRef = useRef12(null);
|
|
6073
|
-
|
|
6108
|
+
useEffect12(() => {
|
|
6074
6109
|
if (!ctx) return;
|
|
6075
6110
|
registerKeyTarget(ctx, "app", rootRef.current);
|
|
6076
6111
|
return () => registerKeyTarget(ctx, "app", null);
|
|
@@ -6282,6 +6317,7 @@ export {
|
|
|
6282
6317
|
useCanvas,
|
|
6283
6318
|
useCanvasSource,
|
|
6284
6319
|
useCommandRead,
|
|
6320
|
+
useEditing,
|
|
6285
6321
|
usePanelScope
|
|
6286
6322
|
};
|
|
6287
6323
|
//# sourceMappingURL=index.mjs.map
|