@likec4/diagram 1.56.0 → 1.58.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/dist/LikeC4Diagram.js +3 -1
- package/dist/LikeC4View.js +47 -55
- package/dist/adhoc-editor/EditorPanel.d.ts +1 -1
- package/dist/adhoc-editor/ElementsTree.d.ts +1 -1
- package/dist/adhoc-editor/ElementsTree.js +2 -6
- package/dist/adhoc-editor/LikeC4AdHocViewEditor.d.ts +1 -1
- package/dist/adhoc-editor/components/Tree.d.ts +5 -5
- package/dist/adhoc-editor/state/ActorProvider.d.ts +1 -1
- package/dist/adhoc-editor/state/panel.d.ts +1 -1
- package/dist/adhoc-editor/viewrules/ViewRulesPanel.d.ts +1 -1
- package/dist/base/BaseXYFlow.d.ts +1 -1
- package/dist/base-primitives/Markdown.d.ts +1 -1
- package/dist/base-primitives/NodeHandles.d.ts +1 -1
- package/dist/base-primitives/compound/CompoundActionButton.d.ts +1 -1
- package/dist/base-primitives/compound/CompoundDetailsButton.d.ts +1 -1
- package/dist/base-primitives/compound/CompoundNodeContainer.d.ts +1 -1
- package/dist/base-primitives/compound/CompoundTitle.d.ts +1 -1
- package/dist/base-primitives/compound/actionbtns.css.d.ts +1 -1
- package/dist/base-primitives/edge/EdgeActionButton.d.ts +1 -1
- package/dist/base-primitives/edge/EdgeContainer.d.ts +1 -1
- package/dist/base-primitives/edge/EdgeLabelContainer.d.ts +1 -1
- package/dist/base-primitives/edge/EdgeMarkers.d.ts +8 -8
- package/dist/base-primitives/element/ElementActionButtons.d.ts +1 -1
- package/dist/base-primitives/element/ElementData.d.ts +2 -2
- package/dist/base-primitives/element/ElementDetailsButton.d.ts +1 -1
- package/dist/base-primitives/element/ElementShape.d.ts +1 -1
- package/dist/base-primitives/element/ElementTags.d.ts +1 -1
- package/dist/base-primitives/element/ElementTags.js +1 -3
- package/dist/components/ErrorFallback.d.ts +2 -2
- package/dist/components/NavigationPanel.d.ts +2 -2
- package/dist/components/PortalToContainer.d.ts +1 -1
- package/dist/components/RootContainer.d.ts +1 -1
- package/dist/components/RootContainer.js +19 -18
- package/dist/components/SearchControl.d.ts +2 -2
- package/dist/components/ViewNotFound.d.ts +2 -2
- package/dist/context/CurrentViewModelProvider.d.ts +1 -1
- package/dist/context/DefaultMantineProvider.d.ts +1 -1
- package/dist/context/DiagramEventHandlers.d.ts +1 -1
- package/dist/context/DiagramFeatures.d.ts +1 -1
- package/dist/context/DiagramFeatures.js +5 -0
- package/dist/context/EnsureMantine.d.ts +1 -1
- package/dist/context/FramerMotionConfig.d.ts +3 -3
- package/dist/context/FramerMotionConfig.js +2 -2
- package/dist/context/IconRenderer.d.ts +2 -2
- package/dist/context/IconRenderer.js +32 -12
- package/dist/context/LikeC4ModelContext.d.ts +1 -1
- package/dist/context/RootContainerContext.d.ts +10 -17
- package/dist/context/RootContainerContext.js +1 -13
- package/dist/context/ShadowRootContext.d.ts +3 -0
- package/dist/context/ShadowRootContext.js +5 -0
- package/dist/context/TagStylesContext.d.ts +2 -1
- package/dist/context/TagStylesContext.js +5 -7
- package/dist/custom/index.d.ts +1 -1
- package/dist/custom/index.js +1 -2
- package/dist/editor/LikeC4EditorCallbacks.d.ts +5 -0
- package/dist/editor/LikeC4EditorProvider.d.ts +2 -2
- package/dist/editor/actor/actions.d.ts +174 -0
- package/dist/editor/actor/actions.js +188 -0
- package/dist/editor/{hotkeyActor.d.ts → actor/hotkey.d.ts} +2 -2
- package/dist/editor/{hotkeyActor.js → actor/hotkey.js} +11 -4
- package/dist/editor/{editorActor.states.d.ts → actor/machine.d.ts} +5 -3
- package/dist/editor/actor/machine.js +23 -0
- package/dist/editor/actor/setup.d.ts +55 -0
- package/dist/editor/{editorActor.setup.js → actor/setup.js} +14 -10
- package/dist/editor/actor/state.editor.d.ts +147 -0
- package/dist/editor/actor/state.editor.js +56 -0
- package/dist/editor/actor/state.sync-queue.d.ts +612 -0
- package/dist/editor/actor/state.sync-queue.js +272 -0
- package/dist/editor/actor/types.d.ts +64 -0
- package/dist/editor/actor/types.js +5 -0
- package/dist/editor/applyChangesToManualLayout.js +1 -1
- package/dist/editor/index.d.ts +2 -1
- package/dist/editor/useEditorActorLogic.d.ts +8 -2
- package/dist/editor/useEditorActorLogic.js +39 -7
- package/dist/hooks/useDiagram.js +6 -1
- package/dist/hooks/useDiagramCompareLayout.js +1 -1
- package/dist/hooks/useEditorActor.d.ts +9 -0
- package/dist/hooks/useEditorActor.js +27 -0
- package/dist/hooks/useLikeC4ElementsTree.d.ts +3 -2
- package/dist/hooks/useLikeC4ElementsTree.js +3 -1
- package/dist/index.d.ts +2 -0
- package/dist/index.js +3 -1
- package/dist/likec4diagram/DiagramUI.d.ts +1 -1
- package/dist/likec4diagram/DiagramUI.js +8 -4
- package/dist/likec4diagram/DiagramXYFlow.js +26 -14
- package/dist/likec4diagram/custom/edges/EdgeDrifts.d.ts +1 -1
- package/dist/likec4diagram/custom/edges/RelationshipEdge.js +127 -14
- package/dist/likec4diagram/custom/edges/SequenceStepEdge.d.ts +1 -1
- package/dist/likec4diagram/custom/edges/edges.css.d.ts +1 -0
- package/dist/likec4diagram/custom/edges/edges.css.js +5 -1
- package/dist/likec4diagram/custom/nodes/CompoundActions.d.ts +1 -1
- package/dist/likec4diagram/custom/nodes/ElementActions.d.ts +2 -2
- package/dist/likec4diagram/custom/nodes/NodeDrifts.d.ts +1 -1
- package/dist/likec4diagram/custom/nodes/NodeNotes.d.ts +1 -1
- package/dist/likec4diagram/custom/nodes/SequenceActorNode.d.ts +2 -2
- package/dist/likec4diagram/custom/nodes/nodes.d.ts +7 -7
- package/dist/likec4diagram/custom/nodes/toolbar/ColorButton.d.ts +3 -3
- package/dist/likec4diagram/custom/nodes/toolbar/CompoundToolbar.d.ts +2 -2
- package/dist/likec4diagram/custom/nodes/toolbar/ElementToolbar.d.ts +2 -2
- package/dist/likec4diagram/custom/nodes/toolbar/Toolbar.d.ts +1 -1
- package/dist/likec4diagram/custom/nodes/toolbar/_shared.d.ts +3 -3
- package/dist/likec4diagram/relationship-popover/RelationshipPopover.d.ts +1 -1
- package/dist/likec4diagram/relationship-popover/components.d.ts +2 -2
- package/dist/likec4diagram/state/DiagramActorProvider.d.ts +1 -1
- package/dist/likec4diagram/state/aligners.js +3 -0
- package/dist/likec4diagram/state/assign.js +1 -1
- package/dist/likec4diagram/state/createViewChange.js +1 -0
- package/dist/likec4diagram/state/diagram-api.d.ts +16 -0
- package/dist/likec4diagram/state/diagram-api.js +13 -7
- package/dist/likec4diagram/state/machine.actions.js +10 -10
- package/dist/likec4diagram/state/machine.d.ts +1 -1
- package/dist/likec4diagram/state/machine.setup.js +1 -1
- package/dist/likec4diagram/state/types.d.ts +1 -1
- package/dist/likec4diagram/state/utils.d.ts +1 -1
- package/dist/likec4diagram/types.d.ts +2 -0
- package/dist/likec4diagram/ui/LayoutDriftFrame.d.ts +1 -1
- package/dist/likec4diagram/ui/notation/NotationPanel.d.ts +1 -1
- package/dist/likec4diagram/useLayoutConstraints.js +2 -0
- package/dist/likec4diagram/xyflow-diagram/diagram-view.js +4 -2
- package/dist/likec4diagram/xyflow-sequence/sequence-layout.js +1 -0
- package/dist/navigationpanel/NavigationPanel.d.ts +1 -1
- package/dist/navigationpanel/NavigationPanelControls.d.ts +1 -1
- package/dist/navigationpanel/NavigationPanelDropdown.d.ts +1 -1
- package/dist/navigationpanel/NavigationPanelDropdown.js +2 -2
- package/dist/navigationpanel/_common.d.ts +2 -2
- package/dist/navigationpanel/comparepanel/CompareActionsMenu.d.ts +1 -1
- package/dist/navigationpanel/comparepanel/ComparePanel.d.ts +1 -1
- package/dist/navigationpanel/comparepanel/ComparePanelControls.d.ts +1 -1
- package/dist/navigationpanel/comparepanel/DriftsSummary.d.ts +1 -1
- package/dist/navigationpanel/comparepanel/LayoutTypeSwitcher.d.ts +1 -1
- package/dist/navigationpanel/controls/DetailsControls.d.ts +1 -1
- package/dist/navigationpanel/controls/LayoutWarning.d.ts +1 -1
- package/dist/navigationpanel/controls/LogoButton.d.ts +1 -1
- package/dist/navigationpanel/controls/NavigationButtons.d.ts +1 -1
- package/dist/navigationpanel/controls/OpenSource.d.ts +1 -1
- package/dist/navigationpanel/controls/SearchControl.d.ts +1 -1
- package/dist/navigationpanel/controls/ToggleReadonly.d.ts +1 -1
- package/dist/navigationpanel/controls/ToggleReadonly.js +4 -2
- package/dist/navigationpanel/editorpanel/ApplySemanticLayout.d.ts +4 -0
- package/dist/navigationpanel/editorpanel/ApplySemanticLayout.js +36 -0
- package/dist/navigationpanel/editorpanel/CenterCamera.d.ts +1 -1
- package/dist/navigationpanel/editorpanel/ChangeAutoLayoutButton.d.ts +1 -1
- package/dist/navigationpanel/editorpanel/EditorPanel.d.ts +1 -1
- package/dist/navigationpanel/editorpanel/EditorPanel.js +45 -33
- package/dist/navigationpanel/editorpanel/ManualLayoutToolsButton.d.ts +1 -1
- package/dist/navigationpanel/editorpanel/ToggleReadonly.d.ts +1 -1
- package/dist/navigationpanel/styles.css.d.ts +1 -1
- package/dist/navigationpanel/walkthrough/ActiveWalkthroughControls.d.ts +1 -1
- package/dist/navigationpanel/walkthrough/DynamicViewControls.d.ts +62 -62
- package/dist/navigationpanel/walkthrough/WalkthroughPanel.d.ts +1 -1
- package/dist/overlays/Overlays.d.ts +1 -1
- package/dist/overlays/element-details/ElementDetails.d.ts +1 -1
- package/dist/overlays/element-details/ElementDetailsCard.d.ts +1 -1
- package/dist/overlays/element-details/MetadataValue.d.ts +2 -2
- package/dist/overlays/element-details/TabPanelRelationships.d.ts +1 -1
- package/dist/overlays/element-details/TabPanelStructure.d.ts +2 -2
- package/dist/overlays/overlay/Overlay.d.ts +16 -0
- package/dist/overlays/overlay/Overlay.js +50 -52
- package/dist/overlays/overlaysActor.js +28 -27
- package/dist/overlays/relationship-details/RelationshipDetails.d.ts +1 -1
- package/dist/overlays/relationship-details/SelectEdge.d.ts +1 -1
- package/dist/overlays/relationship-details/custom/ElementActions.d.ts +1 -1
- package/dist/overlays/relationship-details/custom/nodeTypes.d.ts +4 -5
- package/dist/overlays/relationship-details/custom/nodeTypes.js +25 -24
- package/dist/overlays/relationships-browser/RelationshipsBrowser.d.ts +1 -1
- package/dist/overlays/relationships-browser/SelectElement.d.ts +1 -1
- package/dist/overlays/relationships-browser/SelectElement.js +2 -2
- package/dist/overlays/relationships-browser/custom/ElementActions.d.ts +1 -1
- package/dist/overlays/relationships-browser/custom/EmptyNode.d.ts +1 -1
- package/dist/overlays/relationships-browser/custom/nodeTypes.d.ts +4 -4
- package/dist/projects-overview/ProjectsOverview.d.ts +1 -1
- package/dist/projects-overview/custom/nodeTypes.d.ts +1 -1
- package/dist/projects-overview/panel/ProjectsOverviewPanel.d.ts +1 -1
- package/dist/search/Search.d.ts +6 -3
- package/dist/search/Search.js +60 -71
- package/dist/search/XStateSearchAdapter.d.ts +1 -1
- package/dist/search/components/ElementsColumn.d.ts +1 -1
- package/dist/search/components/ElementsColumn.js +12 -8
- package/dist/search/components/PickView.d.ts +1 -1
- package/dist/search/components/SearchByTags.d.ts +1 -1
- package/dist/search/components/SearchInput.d.ts +1 -1
- package/dist/search/components/ViewsColum.d.ts +3 -3
- package/dist/search/components/_shared.css.d.ts +1 -1
- package/dist/search/searchActor.js +30 -26
- package/dist/shadowroot/ShadowRoot.d.ts +6 -6
- package/dist/shadowroot/ShadowRoot.js +68 -23
- package/dist/shadowroot/index.d.ts +1 -0
- package/dist/shadowroot/styles.d.ts +13 -0
- package/dist/shadowroot/styles.js +60 -0
- package/dist/styles2.js +1 -1
- package/package.json +33 -40
- package/panda.buildinfo.json +19 -22
- package/src/styles-font.css +114 -0
- package/src/styles-min.css +2 -0
- package/src/styles-xyflow.css +1 -0
- package/src/styles.css +3 -0
- package/styles-min.css +1 -1
- package/styles-xyflow.css +1 -1
- package/styles.css +1 -1
- package/dist/bundle/index.d.ts +0 -1
- package/dist/editor/editorActor.actions.d.ts +0 -153
- package/dist/editor/editorActor.actions.js +0 -133
- package/dist/editor/editorActor.setup.d.ts +0 -84
- package/dist/editor/editorActor.states.js +0 -219
- package/dist/hooks/useOverlaysActor.js +0 -11
- package/dist/hooks/useSearchActor.js +0 -11
- package/dist/shadowroot/styles.css.d.ts +0 -4
- package/dist/shadowroot/styles.css.js +0 -62
package/dist/bundle/index.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from '../index';
|
|
@@ -1,153 +0,0 @@
|
|
|
1
|
-
import { ViewChange } from '@likec4/core/types';
|
|
2
|
-
import { ActionFunction, CancelAction, PromiseActorLogic, EventObject, NonReducibleUnknown, StopAction } from 'xstate';
|
|
3
|
-
import { EditorActorContext, EditorActorEvent, EditorActorEmitedEvent } from './editorActor.setup';
|
|
4
|
-
import { HotkeyActorLogic } from './hotkeyActor';
|
|
5
|
-
export declare const raiseSync: () => ActionFunction<EditorActorContext, EditorActorEvent, EditorActorEvent, undefined, never, never, never, "500ms" | "waitBeforeSync", never>;
|
|
6
|
-
export declare const cancelSync: () => CancelAction<EditorActorContext, EditorActorEvent, undefined, EditorActorEvent>;
|
|
7
|
-
export declare const reschedule: (delay?: number) => ActionFunction<EditorActorContext, EditorActorEvent, EditorActorEvent, undefined, never, never, never, "500ms" | "waitBeforeSync", never>;
|
|
8
|
-
type LayoutChanges = ViewChange.ResetManualLayout | ViewChange.SaveViewSnapshot;
|
|
9
|
-
export declare const isLayoutChange: (change: ViewChange) => change is LayoutChanges;
|
|
10
|
-
export declare const withoutSnapshotChanges: (data: ViewChange[]) => (ViewChange.ChangeElementStyle | ViewChange.ChangeAutoLayout)[];
|
|
11
|
-
export declare const saveStateBeforeEdit: () => ActionFunction<EditorActorContext, EditorActorEvent, EditorActorEvent, undefined, {
|
|
12
|
-
src: "hotkey";
|
|
13
|
-
logic: HotkeyActorLogic;
|
|
14
|
-
id: "hotkey";
|
|
15
|
-
} | {
|
|
16
|
-
src: "applyLatest";
|
|
17
|
-
logic: PromiseActorLogic<import("./editorActor.setup").EditorCalls.ApplyLatestToManual.Output, import("./editorActor.setup").EditorCalls.ApplyLatestToManual.Input, EventObject>;
|
|
18
|
-
id: string | undefined;
|
|
19
|
-
} | {
|
|
20
|
-
src: "executeChange";
|
|
21
|
-
logic: PromiseActorLogic<NonReducibleUnknown, import("./editorActor.setup").EditorCalls.ExecuteChange.Input, EventObject>;
|
|
22
|
-
id: string | undefined;
|
|
23
|
-
}, never, never, never, never>;
|
|
24
|
-
export declare const startEditing: () => ActionFunction<EditorActorContext, EditorActorEvent, EditorActorEvent, undefined, {
|
|
25
|
-
src: "hotkey";
|
|
26
|
-
logic: HotkeyActorLogic;
|
|
27
|
-
id: "hotkey";
|
|
28
|
-
} | {
|
|
29
|
-
src: "applyLatest";
|
|
30
|
-
logic: PromiseActorLogic<import("./editorActor.setup").EditorCalls.ApplyLatestToManual.Output, import("./editorActor.setup").EditorCalls.ApplyLatestToManual.Input, EventObject>;
|
|
31
|
-
id: string | undefined;
|
|
32
|
-
} | {
|
|
33
|
-
src: "executeChange";
|
|
34
|
-
logic: PromiseActorLogic<NonReducibleUnknown, import("./editorActor.setup").EditorCalls.ExecuteChange.Input, EventObject>;
|
|
35
|
-
id: string | undefined;
|
|
36
|
-
}, never, {
|
|
37
|
-
type: "has pending";
|
|
38
|
-
params: unknown;
|
|
39
|
-
} | {
|
|
40
|
-
type: "can undo";
|
|
41
|
-
params: unknown;
|
|
42
|
-
}, "500ms" | "waitBeforeSync", EditorActorEmitedEvent>;
|
|
43
|
-
export declare const stopHotkey: () => StopAction<EditorActorContext, EditorActorEvent, undefined, EditorActorEvent>;
|
|
44
|
-
export declare const ensureHotKey: () => ActionFunction<EditorActorContext, EditorActorEvent, EditorActorEvent, undefined, {
|
|
45
|
-
src: "hotkey";
|
|
46
|
-
logic: HotkeyActorLogic;
|
|
47
|
-
id: "hotkey";
|
|
48
|
-
} | {
|
|
49
|
-
src: "applyLatest";
|
|
50
|
-
logic: PromiseActorLogic<import("./editorActor.setup").EditorCalls.ApplyLatestToManual.Output, import("./editorActor.setup").EditorCalls.ApplyLatestToManual.Input, EventObject>;
|
|
51
|
-
id: string | undefined;
|
|
52
|
-
} | {
|
|
53
|
-
src: "executeChange";
|
|
54
|
-
logic: PromiseActorLogic<NonReducibleUnknown, import("./editorActor.setup").EditorCalls.ExecuteChange.Input, EventObject>;
|
|
55
|
-
id: string | undefined;
|
|
56
|
-
}, never, {
|
|
57
|
-
type: "has pending";
|
|
58
|
-
params: unknown;
|
|
59
|
-
} | {
|
|
60
|
-
type: "can undo";
|
|
61
|
-
params: unknown;
|
|
62
|
-
}, "500ms" | "waitBeforeSync", EditorActorEmitedEvent>;
|
|
63
|
-
export declare const pushHistory: () => ActionFunction<EditorActorContext, EditorActorEvent, EditorActorEvent, undefined, {
|
|
64
|
-
src: "hotkey";
|
|
65
|
-
logic: HotkeyActorLogic;
|
|
66
|
-
id: "hotkey";
|
|
67
|
-
} | {
|
|
68
|
-
src: "applyLatest";
|
|
69
|
-
logic: PromiseActorLogic<import("./editorActor.setup").EditorCalls.ApplyLatestToManual.Output, import("./editorActor.setup").EditorCalls.ApplyLatestToManual.Input, EventObject>;
|
|
70
|
-
id: string | undefined;
|
|
71
|
-
} | {
|
|
72
|
-
src: "executeChange";
|
|
73
|
-
logic: PromiseActorLogic<NonReducibleUnknown, import("./editorActor.setup").EditorCalls.ExecuteChange.Input, EventObject>;
|
|
74
|
-
id: string | undefined;
|
|
75
|
-
}, never, never, never, never>;
|
|
76
|
-
export declare const stopEditing: () => ActionFunction<EditorActorContext, EditorActorEvent, EditorActorEvent, undefined, {
|
|
77
|
-
src: "hotkey";
|
|
78
|
-
logic: HotkeyActorLogic;
|
|
79
|
-
id: "hotkey";
|
|
80
|
-
} | {
|
|
81
|
-
src: "applyLatest";
|
|
82
|
-
logic: PromiseActorLogic<import("./editorActor.setup").EditorCalls.ApplyLatestToManual.Output, import("./editorActor.setup").EditorCalls.ApplyLatestToManual.Input, EventObject>;
|
|
83
|
-
id: string | undefined;
|
|
84
|
-
} | {
|
|
85
|
-
src: "executeChange";
|
|
86
|
-
logic: PromiseActorLogic<NonReducibleUnknown, import("./editorActor.setup").EditorCalls.ExecuteChange.Input, EventObject>;
|
|
87
|
-
id: string | undefined;
|
|
88
|
-
}, never, {
|
|
89
|
-
type: "has pending";
|
|
90
|
-
params: unknown;
|
|
91
|
-
} | {
|
|
92
|
-
type: "can undo";
|
|
93
|
-
params: unknown;
|
|
94
|
-
}, "500ms" | "waitBeforeSync", EditorActorEmitedEvent>;
|
|
95
|
-
export declare const markHistoryAsSynched: () => ActionFunction<EditorActorContext, EditorActorEvent, EditorActorEvent, undefined, {
|
|
96
|
-
src: "hotkey";
|
|
97
|
-
logic: HotkeyActorLogic;
|
|
98
|
-
id: "hotkey";
|
|
99
|
-
} | {
|
|
100
|
-
src: "applyLatest";
|
|
101
|
-
logic: PromiseActorLogic<import("./editorActor.setup").EditorCalls.ApplyLatestToManual.Output, import("./editorActor.setup").EditorCalls.ApplyLatestToManual.Input, EventObject>;
|
|
102
|
-
id: string | undefined;
|
|
103
|
-
} | {
|
|
104
|
-
src: "executeChange";
|
|
105
|
-
logic: PromiseActorLogic<NonReducibleUnknown, import("./editorActor.setup").EditorCalls.ExecuteChange.Input, EventObject>;
|
|
106
|
-
id: string | undefined;
|
|
107
|
-
}, never, never, never, never>;
|
|
108
|
-
export declare const popHistory: () => ActionFunction<EditorActorContext, EditorActorEvent, EditorActorEvent, undefined, {
|
|
109
|
-
src: "hotkey";
|
|
110
|
-
logic: HotkeyActorLogic;
|
|
111
|
-
id: "hotkey";
|
|
112
|
-
} | {
|
|
113
|
-
src: "applyLatest";
|
|
114
|
-
logic: PromiseActorLogic<import("./editorActor.setup").EditorCalls.ApplyLatestToManual.Output, import("./editorActor.setup").EditorCalls.ApplyLatestToManual.Input, EventObject>;
|
|
115
|
-
id: string | undefined;
|
|
116
|
-
} | {
|
|
117
|
-
src: "executeChange";
|
|
118
|
-
logic: PromiseActorLogic<NonReducibleUnknown, import("./editorActor.setup").EditorCalls.ExecuteChange.Input, EventObject>;
|
|
119
|
-
id: string | undefined;
|
|
120
|
-
}, never, never, never, never>;
|
|
121
|
-
export declare const undo: () => ActionFunction<EditorActorContext, EditorActorEvent, EditorActorEvent, undefined, {
|
|
122
|
-
src: "hotkey";
|
|
123
|
-
logic: HotkeyActorLogic;
|
|
124
|
-
id: "hotkey";
|
|
125
|
-
} | {
|
|
126
|
-
src: "applyLatest";
|
|
127
|
-
logic: PromiseActorLogic<import("./editorActor.setup").EditorCalls.ApplyLatestToManual.Output, import("./editorActor.setup").EditorCalls.ApplyLatestToManual.Input, EventObject>;
|
|
128
|
-
id: string | undefined;
|
|
129
|
-
} | {
|
|
130
|
-
src: "executeChange";
|
|
131
|
-
logic: PromiseActorLogic<NonReducibleUnknown, import("./editorActor.setup").EditorCalls.ExecuteChange.Input, EventObject>;
|
|
132
|
-
id: string | undefined;
|
|
133
|
-
}, never, {
|
|
134
|
-
type: "has pending";
|
|
135
|
-
params: unknown;
|
|
136
|
-
} | {
|
|
137
|
-
type: "can undo";
|
|
138
|
-
params: unknown;
|
|
139
|
-
}, "500ms" | "waitBeforeSync", EditorActorEmitedEvent>;
|
|
140
|
-
export declare const addSnapshotToPendingChanges: () => ActionFunction<EditorActorContext, EditorActorEvent, EditorActorEvent, undefined, {
|
|
141
|
-
src: "hotkey";
|
|
142
|
-
logic: HotkeyActorLogic;
|
|
143
|
-
id: "hotkey";
|
|
144
|
-
} | {
|
|
145
|
-
src: "applyLatest";
|
|
146
|
-
logic: PromiseActorLogic<import("./editorActor.setup").EditorCalls.ApplyLatestToManual.Output, import("./editorActor.setup").EditorCalls.ApplyLatestToManual.Input, EventObject>;
|
|
147
|
-
id: string | undefined;
|
|
148
|
-
} | {
|
|
149
|
-
src: "executeChange";
|
|
150
|
-
logic: PromiseActorLogic<NonReducibleUnknown, import("./editorActor.setup").EditorCalls.ExecuteChange.Input, EventObject>;
|
|
151
|
-
id: string | undefined;
|
|
152
|
-
}, never, never, never, never>;
|
|
153
|
-
export {};
|
|
@@ -1,133 +0,0 @@
|
|
|
1
|
-
import "../_virtual/_rolldown/runtime.js";
|
|
2
|
-
import { createViewChange } from "../likec4diagram/state/createViewChange.js";
|
|
3
|
-
import { machine } from "./editorActor.setup.js";
|
|
4
|
-
import { filter, isNot, last, omit } from "remeda";
|
|
5
|
-
//#region src/editor/editorActor.actions.ts
|
|
6
|
-
/**
|
|
7
|
-
* Actually this is DiagramActorRef
|
|
8
|
-
* But we can't use it here due to circular type inference
|
|
9
|
-
*/
|
|
10
|
-
var diagramActorRef = (system) => {
|
|
11
|
-
return system.get("diagram");
|
|
12
|
-
};
|
|
13
|
-
/**
|
|
14
|
-
* Actually this is DiagramActorRef
|
|
15
|
-
* But we can't use it here due to circular type inference
|
|
16
|
-
*/
|
|
17
|
-
var getDiagramContext = function(system) {
|
|
18
|
-
return system.get("diagram").getSnapshot().context;
|
|
19
|
-
};
|
|
20
|
-
var raiseSync = () => machine.raise({ type: "sync" }, {
|
|
21
|
-
delay: 200,
|
|
22
|
-
id: "sync"
|
|
23
|
-
});
|
|
24
|
-
var cancelSync = () => machine.cancel("sync");
|
|
25
|
-
var reschedule = (delay = 350) => machine.raise(({ event }) => event, { delay });
|
|
26
|
-
var isLayoutChange = (change) => change.op === "reset-manual-layout" || change.op === "save-view-snapshot";
|
|
27
|
-
var withoutSnapshotChanges = filter(isNot(isLayoutChange));
|
|
28
|
-
var saveStateBeforeEdit = () => machine.assign(({ system }) => {
|
|
29
|
-
const parentContext = getDiagramContext(system);
|
|
30
|
-
return { beforeEditing: {
|
|
31
|
-
xynodes: parentContext.xynodes.map(({ measured, data, ...n }) => ({
|
|
32
|
-
...omit(n, [
|
|
33
|
-
"selected",
|
|
34
|
-
"dragging",
|
|
35
|
-
"resizing"
|
|
36
|
-
]),
|
|
37
|
-
data: omit(data, ["dimmed", "hovered"]),
|
|
38
|
-
measured,
|
|
39
|
-
initialWidth: measured?.width ?? n.width ?? n.initialWidth,
|
|
40
|
-
initialHeight: measured?.height ?? n.height ?? n.initialHeight
|
|
41
|
-
})),
|
|
42
|
-
xyedges: parentContext.xyedges.map(({ data, ...e }) => ({
|
|
43
|
-
...omit(e, ["selected"]),
|
|
44
|
-
data: omit(data, [
|
|
45
|
-
"active",
|
|
46
|
-
"dimmed",
|
|
47
|
-
"hovered"
|
|
48
|
-
])
|
|
49
|
-
})),
|
|
50
|
-
change: createViewChange(parentContext),
|
|
51
|
-
view: parentContext.view,
|
|
52
|
-
synched: false
|
|
53
|
-
} };
|
|
54
|
-
});
|
|
55
|
-
var startEditing = () => machine.enqueueActions(({ enqueue, event }) => {
|
|
56
|
-
enqueue(saveStateBeforeEdit());
|
|
57
|
-
if (event.type === "edit.start") enqueue.assign({ editing: event.subject });
|
|
58
|
-
});
|
|
59
|
-
var stopHotkey = () => machine.stopChild("hotkey");
|
|
60
|
-
var ensureHotKey = () => machine.enqueueActions(({ check, enqueue, self }) => {
|
|
61
|
-
const hasUndo = check("can undo");
|
|
62
|
-
const hotkey = self.getSnapshot().children["hotkey"];
|
|
63
|
-
if (!hasUndo && hotkey) {
|
|
64
|
-
enqueue.stopChild(hotkey);
|
|
65
|
-
return;
|
|
66
|
-
}
|
|
67
|
-
if (hasUndo && !hotkey) enqueue.spawnChild("hotkey", { id: "hotkey" });
|
|
68
|
-
});
|
|
69
|
-
var pushHistory = () => machine.assign(({ context }) => {
|
|
70
|
-
const snapshot = context.beforeEditing;
|
|
71
|
-
if (!snapshot) return { editing: null };
|
|
72
|
-
const history = [...context.history, snapshot];
|
|
73
|
-
if (history.length > 50) history.shift();
|
|
74
|
-
return {
|
|
75
|
-
beforeEditing: null,
|
|
76
|
-
editing: null,
|
|
77
|
-
history
|
|
78
|
-
};
|
|
79
|
-
});
|
|
80
|
-
var stopEditing = () => machine.enqueueActions(({ event, enqueue }) => {
|
|
81
|
-
if (event.type === "edit.finish" && event.wasChanged) {
|
|
82
|
-
enqueue(pushHistory());
|
|
83
|
-
enqueue(raiseSync());
|
|
84
|
-
return;
|
|
85
|
-
}
|
|
86
|
-
enqueue.assign({
|
|
87
|
-
beforeEditing: null,
|
|
88
|
-
editing: null
|
|
89
|
-
});
|
|
90
|
-
});
|
|
91
|
-
var markHistoryAsSynched = () => machine.assign(({ context }) => {
|
|
92
|
-
return {
|
|
93
|
-
beforeEditing: context.beforeEditing && context.beforeEditing.synched === false ? {
|
|
94
|
-
...context.beforeEditing,
|
|
95
|
-
synched: true
|
|
96
|
-
} : context.beforeEditing,
|
|
97
|
-
history: context.history.map((i) => ({
|
|
98
|
-
...i,
|
|
99
|
-
synched: true
|
|
100
|
-
}))
|
|
101
|
-
};
|
|
102
|
-
});
|
|
103
|
-
var popHistory = () => machine.assign(({ context }) => {
|
|
104
|
-
if (context.history.length <= 1) return { history: [] };
|
|
105
|
-
return { history: context.history.slice(0, context.history.length - 1) };
|
|
106
|
-
});
|
|
107
|
-
var undo = () => machine.enqueueActions(({ context, enqueue, system }) => {
|
|
108
|
-
const lastHistoryItem = last(context.history);
|
|
109
|
-
if (!lastHistoryItem) return;
|
|
110
|
-
enqueue(cancelSync());
|
|
111
|
-
enqueue(popHistory());
|
|
112
|
-
enqueue(ensureHotKey());
|
|
113
|
-
const diagramActor = diagramActorRef(system);
|
|
114
|
-
enqueue.sendTo(diagramActor, {
|
|
115
|
-
type: "update.view",
|
|
116
|
-
view: lastHistoryItem.view,
|
|
117
|
-
xyedges: lastHistoryItem.xyedges,
|
|
118
|
-
xynodes: lastHistoryItem.xynodes,
|
|
119
|
-
source: "editor"
|
|
120
|
-
});
|
|
121
|
-
enqueue.assign({ pendingChanges: [] });
|
|
122
|
-
if (lastHistoryItem.synched) enqueue.raise({
|
|
123
|
-
type: "change",
|
|
124
|
-
change: lastHistoryItem.change
|
|
125
|
-
}, { delay: 50 });
|
|
126
|
-
else enqueue(raiseSync());
|
|
127
|
-
});
|
|
128
|
-
var addSnapshotToPendingChanges = () => machine.assign(({ context, system }) => {
|
|
129
|
-
const change = createViewChange(getDiagramContext(system));
|
|
130
|
-
return { pendingChanges: [...withoutSnapshotChanges(context.pendingChanges), change] };
|
|
131
|
-
});
|
|
132
|
-
//#endregion
|
|
133
|
-
export { addSnapshotToPendingChanges, cancelSync, ensureHotKey, isLayoutChange, markHistoryAsSynched, pushHistory, reschedule, saveStateBeforeEdit, startEditing, stopEditing, stopHotkey, undo, withoutSnapshotChanges };
|
|
@@ -1,84 +0,0 @@
|
|
|
1
|
-
import { NonReducibleUnknown, SetupReturn, PromiseActorLogic, EventObject, MetaObject } from 'xstate';
|
|
2
|
-
import { Types } from '../likec4diagram/types';
|
|
3
|
-
import { HotKeyEvent, HotkeyActorLogic } from './hotkeyActor';
|
|
4
|
-
import type * as t from '@likec4/core/types';
|
|
5
|
-
export declare namespace EditorCalls {
|
|
6
|
-
type ApplyLatestToManual = (params: {
|
|
7
|
-
input: ApplyLatestToManual.Input;
|
|
8
|
-
}) => Promise<ApplyLatestToManual.Output>;
|
|
9
|
-
namespace ApplyLatestToManual {
|
|
10
|
-
type Input = {
|
|
11
|
-
viewId: t.ViewId;
|
|
12
|
-
current: t.LayoutedView | undefined;
|
|
13
|
-
};
|
|
14
|
-
type Output = {
|
|
15
|
-
updated: t.LayoutedView;
|
|
16
|
-
};
|
|
17
|
-
}
|
|
18
|
-
type ExecuteChange = (params: {
|
|
19
|
-
input: ExecuteChange.Input;
|
|
20
|
-
}) => Promise<ExecuteChange.Output>;
|
|
21
|
-
namespace ExecuteChange {
|
|
22
|
-
type Input = {
|
|
23
|
-
viewId: t.ViewId;
|
|
24
|
-
changes: t.ViewChange[];
|
|
25
|
-
};
|
|
26
|
-
type Output = NonReducibleUnknown;
|
|
27
|
-
}
|
|
28
|
-
}
|
|
29
|
-
export type EditorActorEvent = {
|
|
30
|
-
type: 'sync';
|
|
31
|
-
} | {
|
|
32
|
-
type: 'change';
|
|
33
|
-
change: t.ViewChange;
|
|
34
|
-
} | {
|
|
35
|
-
type: 'edit.start';
|
|
36
|
-
subject: 'node' | 'edge';
|
|
37
|
-
} | {
|
|
38
|
-
type: 'edit.finish';
|
|
39
|
-
wasChanged?: boolean;
|
|
40
|
-
} | {
|
|
41
|
-
type: 'applyLatestToManual';
|
|
42
|
-
} | {
|
|
43
|
-
type: 'synced';
|
|
44
|
-
} | {
|
|
45
|
-
type: 'cancel';
|
|
46
|
-
} | {
|
|
47
|
-
type: 'reset';
|
|
48
|
-
} | HotKeyEvent;
|
|
49
|
-
export type HistorySnapshot = {
|
|
50
|
-
view: t.LayoutedView;
|
|
51
|
-
change: t.ViewChange.SaveViewSnapshot;
|
|
52
|
-
xynodes: Types.Node[];
|
|
53
|
-
xyedges: Types.Edge[];
|
|
54
|
-
synched: boolean;
|
|
55
|
-
};
|
|
56
|
-
export interface EditorActorInput {
|
|
57
|
-
viewId: t.ViewId;
|
|
58
|
-
}
|
|
59
|
-
export interface EditorActorContext {
|
|
60
|
-
viewId: t.ViewId;
|
|
61
|
-
pendingChanges: t.ViewChange[];
|
|
62
|
-
history: ReadonlyArray<HistorySnapshot>;
|
|
63
|
-
/**
|
|
64
|
-
* The state before editing started
|
|
65
|
-
*/
|
|
66
|
-
beforeEditing: HistorySnapshot | null;
|
|
67
|
-
/**
|
|
68
|
-
* The subject of the edit
|
|
69
|
-
*/
|
|
70
|
-
editing: 'node' | 'edge' | null;
|
|
71
|
-
}
|
|
72
|
-
export type EditorActorEmitedEvent = {
|
|
73
|
-
type: 'idle';
|
|
74
|
-
};
|
|
75
|
-
export declare const machine: SetupReturn<EditorActorContext, EditorActorEvent, {
|
|
76
|
-
applyLatest: PromiseActorLogic<EditorCalls.ApplyLatestToManual.Output, EditorCalls.ApplyLatestToManual.Input, EventObject>;
|
|
77
|
-
executeChange: PromiseActorLogic<NonReducibleUnknown, EditorCalls.ExecuteChange.Input, EventObject>;
|
|
78
|
-
hotkey: HotkeyActorLogic;
|
|
79
|
-
}, {
|
|
80
|
-
hotkey: "hotkey";
|
|
81
|
-
}, {}, {
|
|
82
|
-
'has pending': unknown;
|
|
83
|
-
'can undo': unknown;
|
|
84
|
-
}, "500ms" | "waitBeforeSync", "pending", EditorActorInput, NonReducibleUnknown, EditorActorEmitedEvent, MetaObject>;
|
|
@@ -1,219 +0,0 @@
|
|
|
1
|
-
import "../_virtual/_rolldown/runtime.js";
|
|
2
|
-
import { machine } from "./editorActor.setup.js";
|
|
3
|
-
import { addSnapshotToPendingChanges, cancelSync, ensureHotKey, isLayoutChange, markHistoryAsSynched, pushHistory, reschedule, saveStateBeforeEdit, startEditing, stopEditing, stopHotkey, undo, withoutSnapshotChanges } from "./editorActor.actions.js";
|
|
4
|
-
import { find } from "remeda";
|
|
5
|
-
import { assign, enqueueActions, log, sendTo } from "xstate";
|
|
6
|
-
//#region src/editor/editorActor.states.ts
|
|
7
|
-
/**
|
|
8
|
-
* Actually this is DiagramActorRef
|
|
9
|
-
* But we can't use it here due to circular type inference
|
|
10
|
-
*/
|
|
11
|
-
var diagramActorRef = function(params) {
|
|
12
|
-
return params.system.get("diagram");
|
|
13
|
-
};
|
|
14
|
-
var to = {
|
|
15
|
-
idle: { target: "#idle" },
|
|
16
|
-
editing: { target: "#editing" },
|
|
17
|
-
afterEdit: { target: "#afterEdit" },
|
|
18
|
-
pending: { target: "#pending" },
|
|
19
|
-
applyLatestToManual: { target: "#applyLatestToManual" },
|
|
20
|
-
executeChanges: { target: "#executeChanges" }
|
|
21
|
-
};
|
|
22
|
-
/**
|
|
23
|
-
* Idle state, no pending operations
|
|
24
|
-
*/
|
|
25
|
-
var idle = machine.createStateConfig({
|
|
26
|
-
id: "idle",
|
|
27
|
-
on: {
|
|
28
|
-
"sync": { ...to.pending },
|
|
29
|
-
"edit.start": { ...to.editing }
|
|
30
|
-
}
|
|
31
|
-
});
|
|
32
|
-
/**
|
|
33
|
-
* Edit state, some operation is in progress, come to this state from idle
|
|
34
|
-
*/
|
|
35
|
-
var editing = machine.createStateConfig({
|
|
36
|
-
id: "editing",
|
|
37
|
-
tags: "pending",
|
|
38
|
-
entry: [startEditing(), cancelSync()],
|
|
39
|
-
on: {
|
|
40
|
-
change: {
|
|
41
|
-
actions: stopEditing(),
|
|
42
|
-
...to.executeChanges
|
|
43
|
-
},
|
|
44
|
-
"edit.finish": {
|
|
45
|
-
actions: stopEditing(),
|
|
46
|
-
...to.afterEdit
|
|
47
|
-
},
|
|
48
|
-
"undo": {
|
|
49
|
-
actions: stopEditing(),
|
|
50
|
-
...to.idle
|
|
51
|
-
}
|
|
52
|
-
}
|
|
53
|
-
});
|
|
54
|
-
/**
|
|
55
|
-
* Syncing state, some edits are not yet synced
|
|
56
|
-
*/
|
|
57
|
-
var pending = machine.createStateConfig({
|
|
58
|
-
id: "pending",
|
|
59
|
-
tags: ["pending"],
|
|
60
|
-
entry: ensureHotKey(),
|
|
61
|
-
on: {
|
|
62
|
-
"sync": {
|
|
63
|
-
reenter: true,
|
|
64
|
-
...to.pending
|
|
65
|
-
},
|
|
66
|
-
"edit.start": {
|
|
67
|
-
actions: [addSnapshotToPendingChanges()],
|
|
68
|
-
...to.editing
|
|
69
|
-
}
|
|
70
|
-
},
|
|
71
|
-
after: { "waitBeforeSync": {
|
|
72
|
-
actions: [addSnapshotToPendingChanges()],
|
|
73
|
-
...to.executeChanges
|
|
74
|
-
} }
|
|
75
|
-
});
|
|
76
|
-
/**
|
|
77
|
-
* Decide where to go next
|
|
78
|
-
*/
|
|
79
|
-
var afterEdit = machine.createStateConfig({
|
|
80
|
-
id: "afterEdit",
|
|
81
|
-
always: [{
|
|
82
|
-
guard: "has pending",
|
|
83
|
-
...to.pending
|
|
84
|
-
}, { ...to.idle }]
|
|
85
|
-
});
|
|
86
|
-
/**
|
|
87
|
-
* Syncing state, some edits are not yet synced
|
|
88
|
-
*/
|
|
89
|
-
var applyLatestToManual = machine.createStateConfig({
|
|
90
|
-
id: "applyLatestToManual",
|
|
91
|
-
entry: [cancelSync(), saveStateBeforeEdit()],
|
|
92
|
-
initial: "call",
|
|
93
|
-
states: {
|
|
94
|
-
call: { invoke: {
|
|
95
|
-
src: "applyLatest",
|
|
96
|
-
input: ({ context }) => {
|
|
97
|
-
const current = context.beforeEditing?.change.layout;
|
|
98
|
-
return {
|
|
99
|
-
current: current && current._layout === "manual" ? current : void 0,
|
|
100
|
-
viewId: context.viewId
|
|
101
|
-
};
|
|
102
|
-
},
|
|
103
|
-
onDone: {
|
|
104
|
-
actions: sendTo(diagramActorRef, ({ event }) => ({
|
|
105
|
-
type: "update.view",
|
|
106
|
-
view: event.output.updated
|
|
107
|
-
}), { delay: 10 }),
|
|
108
|
-
target: "wait"
|
|
109
|
-
},
|
|
110
|
-
onError: {
|
|
111
|
-
actions: [assign({
|
|
112
|
-
beforeEditing: null,
|
|
113
|
-
pendingChanges: []
|
|
114
|
-
}), ({ event }) => {
|
|
115
|
-
console.error(event.error);
|
|
116
|
-
}],
|
|
117
|
-
...to.idle
|
|
118
|
-
}
|
|
119
|
-
} },
|
|
120
|
-
wait: {
|
|
121
|
-
entry: pushHistory(),
|
|
122
|
-
on: { "*": { actions: [log(({ event }) => `wait received unexpected event: ${event.type}`), reschedule(500)] } },
|
|
123
|
-
after: { "500ms": {
|
|
124
|
-
actions: [addSnapshotToPendingChanges(), ensureHotKey()],
|
|
125
|
-
...to.executeChanges
|
|
126
|
-
} }
|
|
127
|
-
}
|
|
128
|
-
}
|
|
129
|
-
});
|
|
130
|
-
/**
|
|
131
|
-
* Calls `executeChange` to save the snapshot
|
|
132
|
-
*/
|
|
133
|
-
var executeChanges = machine.createStateConfig({
|
|
134
|
-
id: "executeChanges",
|
|
135
|
-
entry: [assign(({ event, context }) => {
|
|
136
|
-
if (event.type === "change") {
|
|
137
|
-
if (isLayoutChange(event.change)) return { pendingChanges: [...withoutSnapshotChanges(context.pendingChanges), event.change] };
|
|
138
|
-
if (!context.pendingChanges.includes(event.change)) return { pendingChanges: [...context.pendingChanges, event.change] };
|
|
139
|
-
}
|
|
140
|
-
return {};
|
|
141
|
-
}), cancelSync()],
|
|
142
|
-
invoke: {
|
|
143
|
-
src: "executeChange",
|
|
144
|
-
input: ({ context }) => ({
|
|
145
|
-
changes: context.pendingChanges,
|
|
146
|
-
viewId: context.viewId
|
|
147
|
-
}),
|
|
148
|
-
onDone: {
|
|
149
|
-
actions: enqueueActions(({ context, event, enqueue }) => {
|
|
150
|
-
const snapshot = find(context.pendingChanges, (c) => c.op === "save-view-snapshot");
|
|
151
|
-
if (snapshot) enqueue.sendTo(diagramActorRef, {
|
|
152
|
-
type: "update.view-bounds",
|
|
153
|
-
bounds: snapshot.layout.bounds
|
|
154
|
-
});
|
|
155
|
-
enqueue.assign({ pendingChanges: [] });
|
|
156
|
-
}),
|
|
157
|
-
...to.idle
|
|
158
|
-
},
|
|
159
|
-
onError: {
|
|
160
|
-
actions: assign(({ event }) => {
|
|
161
|
-
console.error("executeChanges onError", { error: event.error });
|
|
162
|
-
return { pendingChanges: [] };
|
|
163
|
-
}),
|
|
164
|
-
...to.idle
|
|
165
|
-
}
|
|
166
|
-
}
|
|
167
|
-
});
|
|
168
|
-
var editorActorLogic = machine.createMachine({
|
|
169
|
-
id: "editor",
|
|
170
|
-
context: ({ input }) => ({
|
|
171
|
-
viewId: input.viewId,
|
|
172
|
-
beforeEditing: null,
|
|
173
|
-
editing: null,
|
|
174
|
-
pendingChanges: [],
|
|
175
|
-
history: []
|
|
176
|
-
}),
|
|
177
|
-
initial: "idle",
|
|
178
|
-
states: {
|
|
179
|
-
idle,
|
|
180
|
-
editing,
|
|
181
|
-
pending,
|
|
182
|
-
afterEdit,
|
|
183
|
-
applyLatestToManual,
|
|
184
|
-
executeChanges
|
|
185
|
-
},
|
|
186
|
-
on: {
|
|
187
|
-
cancel: {
|
|
188
|
-
actions: [cancelSync(), assign({
|
|
189
|
-
editing: null,
|
|
190
|
-
beforeEditing: null,
|
|
191
|
-
pendingChanges: []
|
|
192
|
-
})],
|
|
193
|
-
...to.idle
|
|
194
|
-
},
|
|
195
|
-
synced: { actions: markHistoryAsSynched() },
|
|
196
|
-
undo: {
|
|
197
|
-
guard: "can undo",
|
|
198
|
-
actions: undo(),
|
|
199
|
-
...to.idle
|
|
200
|
-
},
|
|
201
|
-
change: { ...to.executeChanges },
|
|
202
|
-
"applyLatestToManual": { ...to.applyLatestToManual },
|
|
203
|
-
reset: {
|
|
204
|
-
actions: [
|
|
205
|
-
cancelSync(),
|
|
206
|
-
assign({
|
|
207
|
-
history: [],
|
|
208
|
-
editing: null,
|
|
209
|
-
beforeEditing: null,
|
|
210
|
-
pendingChanges: []
|
|
211
|
-
}),
|
|
212
|
-
stopHotkey()
|
|
213
|
-
],
|
|
214
|
-
...to.idle
|
|
215
|
-
}
|
|
216
|
-
}
|
|
217
|
-
});
|
|
218
|
-
//#endregion
|
|
219
|
-
export { editorActorLogic };
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import "../_virtual/_rolldown/runtime.js";
|
|
2
|
-
import { selectDiagramActor, useDiagramSnapshot } from "./useDiagram.js";
|
|
3
|
-
//#region src/hooks/useOverlaysActor.ts
|
|
4
|
-
var select = selectDiagramActor((s) => {
|
|
5
|
-
return s.children.overlays;
|
|
6
|
-
});
|
|
7
|
-
function useOverlaysActorRef() {
|
|
8
|
-
return useDiagramSnapshot(select, Object.is);
|
|
9
|
-
}
|
|
10
|
-
//#endregion
|
|
11
|
-
export { useOverlaysActorRef };
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import "../_virtual/_rolldown/runtime.js";
|
|
2
|
-
import { selectDiagramActor, useDiagramSnapshot } from "./useDiagram.js";
|
|
3
|
-
//#region src/hooks/useSearchActor.ts
|
|
4
|
-
var select = selectDiagramActor((s) => {
|
|
5
|
-
return s.children.search ?? null;
|
|
6
|
-
});
|
|
7
|
-
function useSearchActorRef() {
|
|
8
|
-
return useDiagramSnapshot(select, Object.is);
|
|
9
|
-
}
|
|
10
|
-
//#endregion
|
|
11
|
-
export { useSearchActorRef };
|
|
@@ -1,4 +0,0 @@
|
|
|
1
|
-
export declare const cssInteractive: string;
|
|
2
|
-
export declare function useBundledStyleSheet(injectFontCss: boolean, styleNonce?: string | (() => string) | undefined): CSSStyleSheet[];
|
|
3
|
-
export type ColorScheme = 'light' | 'dark';
|
|
4
|
-
export declare function useColorScheme(explicit?: ColorScheme): ColorScheme;
|
|
@@ -1,62 +0,0 @@
|
|
|
1
|
-
import { __name } from "../_virtual/_rolldown/runtime.js";
|
|
2
|
-
import { useCallbackRef as useCallbackRef$1 } from "../hooks/useCallbackRef.js";
|
|
3
|
-
import styles_font_default from "../styles-font2.js";
|
|
4
|
-
import styles_default from "../styles2.js";
|
|
5
|
-
import { css } from "@likec4/styles/css";
|
|
6
|
-
import { useState } from "react";
|
|
7
|
-
import { useIsomorphicLayoutEffect } from "@react-hookz/web";
|
|
8
|
-
import { first, isFunction, isString } from "remeda";
|
|
9
|
-
import { useColorScheme, useMutationObserverTarget } from "@mantine/hooks";
|
|
10
|
-
css({
|
|
11
|
-
cursor: "pointer",
|
|
12
|
-
["--mantine-cursor-pointer"]: "pointer",
|
|
13
|
-
"& :where(.likec4-diagram, .likec4-compound-node, .likec4-element-node)": { cursor: "pointer" }
|
|
14
|
-
});
|
|
15
|
-
function useBundledStyleSheet(injectFontCss, styleNonce) {
|
|
16
|
-
const [styleSheets] = useState(() => {
|
|
17
|
-
const css = new CSSStyleSheet();
|
|
18
|
-
css.replaceSync(
|
|
19
|
-
styles_default
|
|
20
|
-
/**
|
|
21
|
-
* replace only top-level body selectors, for example
|
|
22
|
-
* `body { }` should be replaced with `.likec4-shadow-root { }`
|
|
23
|
-
* but `.likec4-overlay-body { }` - not
|
|
24
|
-
*/
|
|
25
|
-
);
|
|
26
|
-
return [css];
|
|
27
|
-
});
|
|
28
|
-
useIsomorphicLayoutEffect(() => {
|
|
29
|
-
if (injectFontCss && !document.querySelector(`style[data-likec4-font]`)) {
|
|
30
|
-
const style = document.createElement("style");
|
|
31
|
-
style.setAttribute("type", "text/css");
|
|
32
|
-
style.setAttribute("data-likec4-font", "");
|
|
33
|
-
let nonce;
|
|
34
|
-
if (isString(styleNonce)) nonce = styleNonce;
|
|
35
|
-
if (isFunction(styleNonce)) nonce = styleNonce();
|
|
36
|
-
if (nonce) style.setAttribute("nonce", nonce);
|
|
37
|
-
style.appendChild(document.createTextNode(styles_font_default));
|
|
38
|
-
document.head.appendChild(style);
|
|
39
|
-
}
|
|
40
|
-
}, [injectFontCss]);
|
|
41
|
-
return styleSheets;
|
|
42
|
-
}
|
|
43
|
-
var getComputedColorScheme = () => {
|
|
44
|
-
try {
|
|
45
|
-
const colorScheme = first((window.getComputedStyle(document.documentElement).colorScheme ?? "").split(" "));
|
|
46
|
-
if (colorScheme === "light" || colorScheme === "dark") return colorScheme;
|
|
47
|
-
} catch {}
|
|
48
|
-
return null;
|
|
49
|
-
};
|
|
50
|
-
function useColorScheme$1(explicit) {
|
|
51
|
-
const preferred = useColorScheme();
|
|
52
|
-
const [computed, setComputed] = useState(getComputedColorScheme);
|
|
53
|
-
useMutationObserverTarget(useCallbackRef$1(() => setComputed(getComputedColorScheme)), {
|
|
54
|
-
attributes: true,
|
|
55
|
-
childList: false,
|
|
56
|
-
subtree: false
|
|
57
|
-
}, () => document.documentElement);
|
|
58
|
-
return explicit ?? computed ?? preferred;
|
|
59
|
-
}
|
|
60
|
-
__name(useColorScheme$1, "useColorScheme");
|
|
61
|
-
//#endregion
|
|
62
|
-
export { useBundledStyleSheet, useColorScheme$1 as useColorScheme };
|