@likec4/diagram 1.57.0 → 1.59.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 +1 -1
- package/dist/LikeC4Diagram.props.d.ts +1 -1
- package/dist/LikeC4Styles.js +1 -1
- package/dist/LikeC4View.js +2 -2
- package/dist/ReactLikeC4.d.ts +1 -1
- package/dist/base/Base.d.ts +3 -2
- package/dist/base/Base.js +14 -26
- package/dist/base/BaseXYFlow.d.ts +2 -1
- package/dist/base/BaseXYFlow.js +63 -4
- package/dist/base/keyboardZoom.d.ts +3 -0
- package/dist/base/keyboardZoom.js +20 -0
- package/dist/base/updateEdges.js +7 -16
- package/dist/base/updateNodes.js +3 -9
- 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 +2 -1
- package/dist/base-primitives/compound/CompoundActionButton.js +5 -2
- package/dist/base-primitives/compound/CompoundDetailsButton.d.ts +2 -1
- package/dist/base-primitives/compound/CompoundDetailsButton.js +5 -2
- package/dist/base-primitives/compound/CompoundNodeContainer.d.ts +1 -1
- package/dist/base-primitives/compound/CompoundTitle.d.ts +7 -1
- package/dist/base-primitives/compound/CompoundTitle.js +2 -1
- package/dist/base-primitives/compound/actionbtns.css.d.ts +1 -1
- package/dist/base-primitives/edge/EdgeActionButton.d.ts +2 -1
- package/dist/base-primitives/edge/EdgeActionButton.js +2 -1
- package/dist/base-primitives/edge/EdgeContainer.d.ts +1 -1
- package/dist/base-primitives/edge/EdgeContainer.js +4 -2
- package/dist/base-primitives/edge/EdgeLabel.d.ts +2 -0
- package/dist/base-primitives/edge/EdgeLabel.js +2 -5
- 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 +2 -1
- package/dist/base-primitives/element/ElementActionButtons.js +4 -1
- package/dist/base-primitives/element/ElementData.d.ts +4 -2
- package/dist/base-primitives/element/ElementData.js +2 -1
- package/dist/base-primitives/element/ElementDetailsButton.d.ts +2 -1
- package/dist/base-primitives/element/ElementDetailsButton.js +5 -2
- package/dist/base-primitives/element/ElementNodeContainer.js +1 -1
- package/dist/base-primitives/element/ElementShape.d.ts +1 -1
- package/dist/base-primitives/element/ElementShape.js +3 -0
- 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/ErrorFallback.js +3 -5
- package/dist/components/Link.js +6 -6
- package/dist/components/NavigationPanel.d.ts +2 -2
- package/dist/components/NavigationPanel.js +1 -1
- package/dist/components/PortalToContainer.d.ts +1 -1
- package/dist/components/RootContainer.d.ts +1 -1
- package/dist/components/SearchControl.css.js +11 -11
- 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/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/TagStylesContext.d.ts +4 -3
- package/dist/context/TagStylesContext.js +20 -22
- package/dist/custom/index.d.ts +1 -0
- package/dist/custom/index.js +3 -2
- package/dist/editor/LikeC4EditorProvider.d.ts +2 -2
- package/dist/editor/actor/actions.d.ts +74 -15
- package/dist/editor/actor/actions.js +91 -25
- package/dist/editor/actor/hotkey.d.ts +1 -1
- package/dist/editor/actor/hotkey.js +7 -0
- package/dist/editor/actor/machine.d.ts +4 -6
- package/dist/editor/actor/machine.js +1 -0
- package/dist/editor/actor/setup.d.ts +25 -4
- package/dist/editor/actor/setup.js +8 -6
- package/dist/editor/actor/state.editor.d.ts +64 -14
- package/dist/editor/actor/state.editor.js +12 -11
- package/dist/editor/actor/state.sync-queue.d.ts +283 -91
- package/dist/editor/actor/state.sync-queue.js +93 -56
- package/dist/editor/actor/types.d.ts +6 -1
- package/dist/editor/actor/types.js +1 -1
- package/dist/editor/useEditorActorLogic.js +14 -2
- package/dist/hooks/index.d.ts +1 -1
- package/dist/hooks/safeContext.d.ts +156 -3
- package/dist/hooks/safeContext.js +60 -12
- package/dist/hooks/useCurrentViewModel.js +1 -1
- package/dist/hooks/useDiagram.d.ts +8 -0
- package/dist/hooks/useDiagram.js +9 -2
- package/dist/hooks/useEditorActor.d.ts +5 -0
- package/dist/hooks/useEditorActor.js +4 -3
- package/dist/hooks/useLikeC4ElementsTree.js +1 -1
- package/dist/hooks/useLikeC4Model.js +1 -1
- package/dist/hooks/useXYFlow.d.ts +1 -0
- package/dist/hooks/useXYFlow.js +5 -3
- package/dist/index.d.ts +3 -1
- package/dist/index.js +4 -2
- package/dist/likec4diagram/DiagramUI.d.ts +1 -1
- package/dist/likec4diagram/DiagramUI.js +19 -6
- package/dist/likec4diagram/DiagramXYFlow.js +54 -17
- package/dist/likec4diagram/convert-to-xyflow.d.ts +3 -5
- package/dist/likec4diagram/convert-to-xyflow.js +29 -10
- package/dist/likec4diagram/custom/edges/EdgeDrifts.d.ts +1 -1
- package/dist/likec4diagram/custom/edges/RelationshipEdge.js +140 -18
- package/dist/likec4diagram/custom/edges/SequenceStepEdge.d.ts +1 -1
- package/dist/likec4diagram/custom/edges/SequenceStepEdge.js +11 -4
- package/dist/likec4diagram/custom/edges/edges.css.d.ts +1 -0
- package/dist/likec4diagram/custom/edges/edges.css.js +6 -2
- package/dist/likec4diagram/custom/index.d.ts +2 -1
- package/dist/likec4diagram/custom/index.js +5 -3
- package/dist/likec4diagram/custom/nodes/CompoundActions.d.ts +1 -1
- package/dist/likec4diagram/custom/nodes/CompoundActions.js +1 -0
- package/dist/likec4diagram/custom/nodes/ElementActions.d.ts +4 -4
- package/dist/likec4diagram/custom/nodes/ElementActions.js +13 -3
- 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/NodeNotes.js +0 -4
- package/dist/likec4diagram/custom/nodes/SequenceActorNode.d.ts +2 -2
- package/dist/likec4diagram/custom/nodes/SequenceActorNode.js +32 -19
- package/dist/likec4diagram/custom/nodes/SequenceSubFlow.d.ts +2 -0
- package/dist/likec4diagram/custom/nodes/SequenceSubFlow.js +234 -0
- package/dist/likec4diagram/custom/nodes/index.d.ts +1 -0
- package/dist/likec4diagram/custom/nodes/nodes.d.ts +7 -7
- package/dist/likec4diagram/custom/nodes/nodes.js +20 -5
- package/dist/likec4diagram/custom/nodes/toolbar/ColorButton.d.ts +3 -3
- package/dist/likec4diagram/custom/nodes/toolbar/ColorButton.js +1 -1
- 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/custom/nodes/toolbar/_shared.js +1 -1
- package/dist/likec4diagram/relationship-popover/RelationshipPopover.d.ts +1 -1
- package/dist/likec4diagram/relationship-popover/RelationshipPopover.js +15 -14
- package/dist/likec4diagram/relationship-popover/components.d.ts +2 -2
- package/dist/likec4diagram/state/DiagramActorProvider.d.ts +1 -1
- package/dist/likec4diagram/state/DiagramActorProvider.js +11 -20
- package/dist/likec4diagram/state/aligners.js +1 -1
- package/dist/likec4diagram/state/assign.d.ts +1 -1
- package/dist/likec4diagram/state/assign.js +1 -1
- package/dist/likec4diagram/state/createViewChange.js +2 -1
- package/dist/likec4diagram/state/diagram-api.d.ts +18 -10
- package/dist/likec4diagram/state/diagram-api.js +333 -229
- package/dist/likec4diagram/state/machine.actions.d.ts +1026 -332
- package/dist/likec4diagram/state/machine.actions.js +118 -46
- package/dist/likec4diagram/state/machine.actions.layout.d.ts +123 -51
- package/dist/likec4diagram/state/machine.actions.layout.js +40 -33
- package/dist/likec4diagram/state/machine.d.ts +154 -16
- package/dist/likec4diagram/state/machine.js +5 -41
- package/dist/likec4diagram/state/machine.setup.d.ts +84 -19
- package/dist/likec4diagram/state/machine.setup.js +65 -12
- package/dist/likec4diagram/state/machine.state.initializing.d.ts +59 -33
- package/dist/likec4diagram/state/machine.state.navigating.js +7 -3
- package/dist/likec4diagram/state/machine.state.ready.d.ts +1540 -476
- package/dist/likec4diagram/state/machine.state.ready.focused.d.ts +294 -53
- package/dist/likec4diagram/state/machine.state.ready.focused.js +3 -3
- package/dist/likec4diagram/state/machine.state.ready.idle.d.ts +264 -73
- package/dist/likec4diagram/state/machine.state.ready.idle.js +31 -6
- package/dist/likec4diagram/state/machine.state.ready.js +22 -16
- package/dist/likec4diagram/state/machine.state.ready.printing.d.ts +23 -9
- package/dist/likec4diagram/state/machine.state.ready.walkthrough.d.ts +288 -84
- package/dist/likec4diagram/state/machine.state.ready.walkthrough.js +135 -66
- package/dist/likec4diagram/state/types.d.ts +4 -2
- package/dist/likec4diagram/state/utils.d.ts +7 -0
- package/dist/likec4diagram/state/utils.js +36 -34
- package/dist/likec4diagram/types.d.ts +49 -3
- package/dist/likec4diagram/ui/FloatingSequenceActors.d.ts +6 -0
- package/dist/likec4diagram/ui/FloatingSequenceActors.js +155 -0
- package/dist/likec4diagram/ui/LayoutDriftFrame.d.ts +1 -1
- package/dist/likec4diagram/ui/LayoutDriftFrame.js +2 -2
- package/dist/likec4diagram/ui/index.d.ts +2 -0
- package/dist/likec4diagram/ui/notation/NotationPanel.css.js +5 -5
- package/dist/likec4diagram/ui/notation/NotationPanel.d.ts +1 -1
- package/dist/likec4diagram/ui/sequence-outline/SequenceOutlinePanel.d.ts +2 -0
- package/dist/likec4diagram/ui/sequence-outline/SequenceOutlinePanel.js +519 -0
- package/dist/likec4diagram/ui/sequence-outline/state.d.ts +36 -0
- package/dist/likec4diagram/ui/sequence-outline/state.js +55 -0
- package/dist/likec4diagram/xyflow-diagram/diagram-view.d.ts +1 -1
- package/dist/likec4diagram/xyflow-diagram/diagram-view.js +116 -62
- package/dist/likec4diagram/xyflow-sequence/_types.d.ts +55 -5
- package/dist/likec4diagram/xyflow-sequence/const.d.ts +5 -5
- package/dist/likec4diagram/xyflow-sequence/const.js +4 -4
- package/dist/likec4diagram/xyflow-sequence/layouter.d.ts +30 -6
- package/dist/likec4diagram/xyflow-sequence/layouter.js +561 -0
- package/dist/likec4diagram/xyflow-sequence/{sequence-layout.d.ts → sequence-view-to-xy.d.ts} +8 -2
- package/dist/likec4diagram/xyflow-sequence/{sequence-layout.js → sequence-view-to-xy.js} +112 -14
- package/dist/likec4diagram/xyflow-sequence/sequence-view.d.ts +2 -7
- package/dist/likec4diagram/xyflow-sequence/sequence-view.js +144 -0
- package/dist/likec4diagram/xyflow-sequence/utils.d.ts +9 -1
- package/dist/likec4diagram/xyflow-sequence/utils.js +96 -0
- package/dist/navigationpanel/NavigationPanel.d.ts +5 -2
- package/dist/navigationpanel/NavigationPanel.js +58 -59
- package/dist/navigationpanel/NavigationPanelControls.d.ts +1 -1
- package/dist/navigationpanel/NavigationPanelDropdown.d.ts +1 -1
- package/dist/navigationpanel/NavigationPanelDropdown.js +47 -40
- package/dist/navigationpanel/_common.d.ts +2 -2
- package/dist/navigationpanel/_common.js +2 -2
- package/dist/navigationpanel/actor.actions.d.ts +19 -0
- package/dist/navigationpanel/actor.actions.js +45 -0
- package/dist/navigationpanel/actor.d.ts +34 -96
- package/dist/navigationpanel/actor.js +21 -84
- package/dist/navigationpanel/actor.setup.d.ts +98 -0
- package/dist/navigationpanel/actor.setup.js +31 -0
- 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/DriftsSummary.js +4 -5
- package/dist/navigationpanel/comparepanel/LayoutTypeSwitcher.d.ts +1 -1
- package/dist/navigationpanel/controls/DetailsControls.d.ts +1 -1
- package/dist/navigationpanel/controls/DetailsControls.js +7 -8
- 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/dropdown/ProjectsMenu.js +1 -1
- 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/ManualLayoutToolsButton.d.ts +1 -1
- package/dist/navigationpanel/editorpanel/ToggleReadonly.d.ts +1 -1
- package/dist/navigationpanel/editorpanel/styles.js +8 -8
- package/dist/navigationpanel/hooks.d.ts +20 -5
- package/dist/navigationpanel/hooks.js +4 -18
- package/dist/navigationpanel/styles.css.d.ts +1 -1
- package/dist/navigationpanel/walkthrough/ActiveWalkthroughControls.d.ts +1 -1
- package/dist/navigationpanel/walkthrough/ActiveWalkthroughControls.js +2 -2
- package/dist/navigationpanel/walkthrough/DynamicViewControls.d.ts +5 -5
- package/dist/navigationpanel/walkthrough/DynamicViewControls.js +23 -25
- package/dist/navigationpanel/walkthrough/WalkthroughPanel.d.ts +1 -1
- package/dist/navigationpanel/walkthrough/WalkthroughPanel.js +5 -5
- package/dist/overlays/Overlays.d.ts +4 -2
- package/dist/overlays/Overlays.js +10 -10
- package/dist/overlays/element-details/ElementDetails.d.ts +1 -1
- package/dist/overlays/element-details/ElementDetailsCard.css.js +17 -17
- 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/MetadataValue.js +15 -15
- package/dist/overlays/element-details/TabPanelDeployments.css.js +5 -5
- package/dist/overlays/element-details/TabPanelRelationships.css.js +11 -11
- package/dist/overlays/element-details/TabPanelRelationships.d.ts +1 -1
- package/dist/overlays/element-details/TabPanelRelationships.js +1 -1
- package/dist/overlays/element-details/TabPanelStructure.css.js +2 -2
- package/dist/overlays/element-details/TabPanelStructure.d.ts +2 -2
- package/dist/overlays/element-details/TabPanelStructure.js +1 -1
- package/dist/overlays/element-details/actor.d.ts +2 -3
- package/dist/overlays/hooks.d.ts +28 -0
- package/dist/overlays/hooks.js +5 -0
- package/dist/overlays/overlay/Overlay.js +34 -25
- package/dist/overlays/overlaysActor.js +0 -1
- 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 -4
- package/dist/overlays/relationship-details/custom/nodeTypes.js +1 -1
- package/dist/overlays/relationship-details/layout.js +1 -1
- package/dist/overlays/relationships-browser/RelationshipsBrowser.d.ts +1 -1
- package/dist/overlays/relationships-browser/SelectElement.css.js +2 -2
- package/dist/overlays/relationships-browser/SelectElement.d.ts +1 -1
- package/dist/overlays/relationships-browser/actor.js +79 -78
- 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/overlays/relationships-browser/custom/nodeTypes.js +1 -1
- package/dist/overlays/relationships-browser/hooks.js +1 -1
- package/dist/overlays/relationships-browser/layout.js +2 -2
- package/dist/projects-overview/ProjectsOverview.d.ts +1 -1
- package/dist/projects-overview/actor.js +4 -4
- 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 +1 -1
- package/dist/search/Search.js +1 -1
- package/dist/search/XStateSearchAdapter.d.ts +1 -1
- package/dist/search/components/ElementsColumn.css.js +2 -2
- package/dist/search/components/ElementsColumn.d.ts +1 -1
- 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/ViewsColum.js +1 -1
- package/dist/search/components/_shared.css.d.ts +1 -1
- package/dist/search/components/_shared.css.js +23 -23
- package/dist/search/components/styles.css.js +4 -4
- package/dist/shadowroot/ShadowRoot.d.ts +2 -3
- package/dist/shadowroot/ShadowRoot.js +95 -41
- package/dist/shadowroot/index.d.ts +1 -0
- package/dist/styles2.js +1 -1
- package/dist/utils/defineActors.d.ts +21 -0
- package/dist/utils/defineActors.js +13 -0
- package/dist/utils/index.d.ts +1 -0
- package/dist/utils/index.js +5 -4
- package/dist/utils/readableText.d.ts +11 -0
- package/dist/utils/readableText.js +18 -0
- package/package.json +30 -43
- package/panda.buildinfo.json +271 -295
- package/styles-min.css +1 -1
- package/styles-xyflow.css +1 -1
- package/styles.css +1 -1
- package/adhoc-editor/package.json +0 -4
- package/dist/adhoc-editor/EditorPanel.d.ts +0 -1
- package/dist/adhoc-editor/EditorPanel.js +0 -106
- package/dist/adhoc-editor/ElementsTree.d.ts +0 -2
- package/dist/adhoc-editor/ElementsTree.js +0 -112
- package/dist/adhoc-editor/LikeC4AdHocViewEditor.d.ts +0 -4
- package/dist/adhoc-editor/LikeC4AdHocViewEditor.js +0 -83
- package/dist/adhoc-editor/components/Tree.d.ts +0 -48
- package/dist/adhoc-editor/components/Tree.js +0 -213
- package/dist/adhoc-editor/hooks.d.ts +0 -14
- package/dist/adhoc-editor/hooks.js +0 -34
- package/dist/adhoc-editor/index.d.ts +0 -2
- package/dist/adhoc-editor/index.js +0 -2
- package/dist/adhoc-editor/state/ActorProvider.d.ts +0 -5
- package/dist/adhoc-editor/state/ActorProvider.js +0 -37
- package/dist/adhoc-editor/state/actor.d.ts +0 -13
- package/dist/adhoc-editor/state/actor.editor.d.ts +0 -56
- package/dist/adhoc-editor/state/actor.editor.js +0 -167
- package/dist/adhoc-editor/state/actor.js +0 -14
- package/dist/adhoc-editor/state/actor.layouter.d.ts +0 -51
- package/dist/adhoc-editor/state/actor.layouter.js +0 -54
- package/dist/adhoc-editor/state/actor.types.d.ts +0 -63
- package/dist/adhoc-editor/state/actor.types.js +0 -25
- package/dist/adhoc-editor/state/panel.d.ts +0 -95
- package/dist/adhoc-editor/state/panel.js +0 -124
- package/dist/adhoc-editor/state/utils.d.ts +0 -17
- package/dist/adhoc-editor/state/utils.js +0 -25
- package/dist/adhoc-editor/useElementsTree.d.ts +0 -18
- package/dist/adhoc-editor/useElementsTree.js +0 -98
- package/dist/adhoc-editor/viewrules/ViewRulesPanel.d.ts +0 -6
- package/dist/shadowroot/styles.css.d.ts +0 -12
- package/dist/shadowroot/styles.css.js +0 -59
|
@@ -24,11 +24,11 @@ export type LikeC4EditorProviderProps = PropsWithChildren<{
|
|
|
24
24
|
* </LikeC4EditorProvider>
|
|
25
25
|
* ```
|
|
26
26
|
*/
|
|
27
|
-
export declare function LikeC4EditorProvider({ children, editor }: LikeC4EditorProviderProps): import("react
|
|
27
|
+
export declare function LikeC4EditorProvider({ children, editor }: LikeC4EditorProviderProps): import("react").JSX.Element;
|
|
28
28
|
/**
|
|
29
29
|
* Component that ensures the editor context is available.
|
|
30
30
|
*
|
|
31
31
|
* @param children - The children to render.
|
|
32
32
|
*/
|
|
33
|
-
export declare function EnsureEditorContext({ children }: PropsWithChildren): import("react
|
|
33
|
+
export declare function EnsureEditorContext({ children }: PropsWithChildren): import("react").JSX.Element | null;
|
|
34
34
|
export declare function useOptionalLikeC4Editor(): LikeC4EditorCallbacks | null;
|
|
@@ -1,23 +1,18 @@
|
|
|
1
|
-
import { ActorSystem, ActionFunction, CancelAction, PromiseActorLogic, EventObject
|
|
2
|
-
import {
|
|
3
|
-
import { Snapshot, EditorActorContext, EditorActorEvent, EditorActorEmitedEvent } from './types';
|
|
1
|
+
import { ActorSystem, ActionFunction, CancelAction, PromiseActorLogic, EventObject } from 'xstate';
|
|
2
|
+
import { Snapshot, SyncOp, EditorActorContext, EditorActorEvent, EditorActorEmitedEvent } from './types';
|
|
4
3
|
import { HotkeyActorLogic } from './hotkey';
|
|
5
4
|
import type * as t from '@likec4/core/types';
|
|
6
|
-
/**
|
|
7
|
-
* Actually this is DiagramActorRef
|
|
8
|
-
* But we can't use it here due to circular type inference
|
|
9
|
-
*/
|
|
10
|
-
export declare const diagramActorRef: (system: ActorSystem<any>) => DiagramMachineRef;
|
|
11
5
|
export declare function makeSnapshot(system: ActorSystem<any>): Snapshot;
|
|
12
6
|
type LayoutChanges = t.ViewChange.ResetManualLayout | t.ViewChange.SaveViewSnapshot;
|
|
13
7
|
export declare const isLayoutChange: (change: t.ViewChange) => change is LayoutChanges;
|
|
8
|
+
export declare const isLayoutChangeOp: <T extends SyncOp>(op: T) => op is Extract<T, string | LayoutChanges>;
|
|
14
9
|
export declare const withoutSnapshotChanges: (data: t.ViewChange[]) => (t.ViewChange.ChangeElementStyle | t.ViewChange.ChangeAutoLayout | t.ViewChange.ChangeProperty)[];
|
|
15
10
|
export declare const scheduleSync: (delay?: number) => ActionFunction<EditorActorContext, EditorActorEvent, EditorActorEvent, undefined, never, never, never, "500ms" | "wait-after-edit", never>;
|
|
16
11
|
export declare const cancelSync: () => CancelAction<EditorActorContext, EditorActorEvent, undefined, EditorActorEvent>;
|
|
17
12
|
/**
|
|
18
13
|
* Save the state before editing starts
|
|
19
14
|
*/
|
|
20
|
-
export declare const saveBeforeEditing: ActionFunction<EditorActorContext, EditorActorEvent, EditorActorEvent, undefined, {
|
|
15
|
+
export declare const saveBeforeEditing: () => ActionFunction<EditorActorContext, EditorActorEvent, EditorActorEvent, undefined, {
|
|
21
16
|
src: "hotkey";
|
|
22
17
|
logic: HotkeyActorLogic;
|
|
23
18
|
id: "hotkey";
|
|
@@ -27,7 +22,7 @@ export declare const saveBeforeEditing: ActionFunction<EditorActorContext, Edito
|
|
|
27
22
|
id: string | undefined;
|
|
28
23
|
} | {
|
|
29
24
|
src: "executeChange";
|
|
30
|
-
logic: PromiseActorLogic<
|
|
25
|
+
logic: PromiseActorLogic<import("./setup").EditorCalls.ExecuteChange.Output, import("./setup").EditorCalls.ExecuteChange.Input, EventObject>;
|
|
31
26
|
id: string | undefined;
|
|
32
27
|
} | {
|
|
33
28
|
src: "applySemanticLayout";
|
|
@@ -47,13 +42,22 @@ export declare const pushHistory: () => ActionFunction<EditorActorContext, Edito
|
|
|
47
42
|
id: string | undefined;
|
|
48
43
|
} | {
|
|
49
44
|
src: "executeChange";
|
|
50
|
-
logic: PromiseActorLogic<
|
|
45
|
+
logic: PromiseActorLogic<import("./setup").EditorCalls.ExecuteChange.Output, import("./setup").EditorCalls.ExecuteChange.Input, EventObject>;
|
|
51
46
|
id: string | undefined;
|
|
52
47
|
} | {
|
|
53
48
|
src: "applySemanticLayout";
|
|
54
49
|
logic: PromiseActorLogic<import("./setup").EditorCalls.ApplySemanticLayout.Output, import("./setup").EditorCalls.ApplySemanticLayout.Input, EventObject>;
|
|
55
50
|
id: string | undefined;
|
|
56
|
-
}, never,
|
|
51
|
+
}, never, {
|
|
52
|
+
type: "has pending";
|
|
53
|
+
params: unknown;
|
|
54
|
+
} | {
|
|
55
|
+
type: "can undo";
|
|
56
|
+
params: unknown;
|
|
57
|
+
} | {
|
|
58
|
+
type: "can redo";
|
|
59
|
+
params: unknown;
|
|
60
|
+
}, "500ms" | "wait-after-edit", EditorActorEmitedEvent>;
|
|
57
61
|
export declare const reschedule: (delay?: number) => ActionFunction<EditorActorContext, EditorActorEvent, EditorActorEvent, undefined, never, never, never, "500ms" | "wait-after-edit", never>;
|
|
58
62
|
export declare const undo: () => ActionFunction<EditorActorContext, EditorActorEvent, EditorActorEvent, undefined, {
|
|
59
63
|
src: "hotkey";
|
|
@@ -65,7 +69,59 @@ export declare const undo: () => ActionFunction<EditorActorContext, EditorActorE
|
|
|
65
69
|
id: string | undefined;
|
|
66
70
|
} | {
|
|
67
71
|
src: "executeChange";
|
|
68
|
-
logic: PromiseActorLogic<
|
|
72
|
+
logic: PromiseActorLogic<import("./setup").EditorCalls.ExecuteChange.Output, import("./setup").EditorCalls.ExecuteChange.Input, EventObject>;
|
|
73
|
+
id: string | undefined;
|
|
74
|
+
} | {
|
|
75
|
+
src: "applySemanticLayout";
|
|
76
|
+
logic: PromiseActorLogic<import("./setup").EditorCalls.ApplySemanticLayout.Output, import("./setup").EditorCalls.ApplySemanticLayout.Input, EventObject>;
|
|
77
|
+
id: string | undefined;
|
|
78
|
+
}, never, {
|
|
79
|
+
type: "has pending";
|
|
80
|
+
params: unknown;
|
|
81
|
+
} | {
|
|
82
|
+
type: "can undo";
|
|
83
|
+
params: unknown;
|
|
84
|
+
} | {
|
|
85
|
+
type: "can redo";
|
|
86
|
+
params: unknown;
|
|
87
|
+
}, "500ms" | "wait-after-edit", EditorActorEmitedEvent>;
|
|
88
|
+
export declare const redo: () => ActionFunction<EditorActorContext, EditorActorEvent, EditorActorEvent, undefined, {
|
|
89
|
+
src: "hotkey";
|
|
90
|
+
logic: HotkeyActorLogic;
|
|
91
|
+
id: "hotkey";
|
|
92
|
+
} | {
|
|
93
|
+
src: "applyLatest";
|
|
94
|
+
logic: PromiseActorLogic<import("./setup").EditorCalls.ApplyLatestToManual.Output, import("./setup").EditorCalls.ApplyLatestToManual.Input, EventObject>;
|
|
95
|
+
id: string | undefined;
|
|
96
|
+
} | {
|
|
97
|
+
src: "executeChange";
|
|
98
|
+
logic: PromiseActorLogic<import("./setup").EditorCalls.ExecuteChange.Output, import("./setup").EditorCalls.ExecuteChange.Input, EventObject>;
|
|
99
|
+
id: string | undefined;
|
|
100
|
+
} | {
|
|
101
|
+
src: "applySemanticLayout";
|
|
102
|
+
logic: PromiseActorLogic<import("./setup").EditorCalls.ApplySemanticLayout.Output, import("./setup").EditorCalls.ApplySemanticLayout.Input, EventObject>;
|
|
103
|
+
id: string | undefined;
|
|
104
|
+
}, never, {
|
|
105
|
+
type: "has pending";
|
|
106
|
+
params: unknown;
|
|
107
|
+
} | {
|
|
108
|
+
type: "can undo";
|
|
109
|
+
params: unknown;
|
|
110
|
+
} | {
|
|
111
|
+
type: "can redo";
|
|
112
|
+
params: unknown;
|
|
113
|
+
}, "500ms" | "wait-after-edit", EditorActorEmitedEvent>;
|
|
114
|
+
export declare const deleteNodesAndEdges: () => ActionFunction<EditorActorContext, EditorActorEvent, EditorActorEvent, undefined, {
|
|
115
|
+
src: "hotkey";
|
|
116
|
+
logic: HotkeyActorLogic;
|
|
117
|
+
id: "hotkey";
|
|
118
|
+
} | {
|
|
119
|
+
src: "applyLatest";
|
|
120
|
+
logic: PromiseActorLogic<import("./setup").EditorCalls.ApplyLatestToManual.Output, import("./setup").EditorCalls.ApplyLatestToManual.Input, EventObject>;
|
|
121
|
+
id: string | undefined;
|
|
122
|
+
} | {
|
|
123
|
+
src: "executeChange";
|
|
124
|
+
logic: PromiseActorLogic<import("./setup").EditorCalls.ExecuteChange.Output, import("./setup").EditorCalls.ExecuteChange.Input, EventObject>;
|
|
69
125
|
id: string | undefined;
|
|
70
126
|
} | {
|
|
71
127
|
src: "applySemanticLayout";
|
|
@@ -77,6 +133,9 @@ export declare const undo: () => ActionFunction<EditorActorContext, EditorActorE
|
|
|
77
133
|
} | {
|
|
78
134
|
type: "can undo";
|
|
79
135
|
params: unknown;
|
|
136
|
+
} | {
|
|
137
|
+
type: "can redo";
|
|
138
|
+
params: unknown;
|
|
80
139
|
}, "500ms" | "wait-after-edit", EditorActorEmitedEvent>;
|
|
81
140
|
export declare const pushToSyncQueue: () => ActionFunction<EditorActorContext, EditorActorEvent, EditorActorEvent, undefined, {
|
|
82
141
|
src: "hotkey";
|
|
@@ -88,7 +147,7 @@ export declare const pushToSyncQueue: () => ActionFunction<EditorActorContext, E
|
|
|
88
147
|
id: string | undefined;
|
|
89
148
|
} | {
|
|
90
149
|
src: "executeChange";
|
|
91
|
-
logic: PromiseActorLogic<
|
|
150
|
+
logic: PromiseActorLogic<import("./setup").EditorCalls.ExecuteChange.Output, import("./setup").EditorCalls.ExecuteChange.Input, EventObject>;
|
|
92
151
|
id: string | undefined;
|
|
93
152
|
} | {
|
|
94
153
|
src: "applySemanticLayout";
|
|
@@ -105,7 +164,7 @@ export declare const clearQueue: () => ActionFunction<EditorActorContext, Editor
|
|
|
105
164
|
id: string | undefined;
|
|
106
165
|
} | {
|
|
107
166
|
src: "executeChange";
|
|
108
|
-
logic: PromiseActorLogic<
|
|
167
|
+
logic: PromiseActorLogic<import("./setup").EditorCalls.ExecuteChange.Output, import("./setup").EditorCalls.ExecuteChange.Input, EventObject>;
|
|
109
168
|
id: string | undefined;
|
|
110
169
|
} | {
|
|
111
170
|
src: "applySemanticLayout";
|
|
@@ -2,7 +2,6 @@ import "../../_virtual/_rolldown/runtime.js";
|
|
|
2
2
|
import { machine } from "./setup.js";
|
|
3
3
|
import { createViewChange } from "../../likec4diagram/state/createViewChange.js";
|
|
4
4
|
import { typedSystem } from "../../likec4diagram/state/utils.js";
|
|
5
|
-
import { isViewChange } from "./types.js";
|
|
6
5
|
import { filter, isNot, omit } from "remeda";
|
|
7
6
|
import { assertEvent } from "xstate";
|
|
8
7
|
//#region src/editor/actor/actions.ts
|
|
@@ -40,6 +39,7 @@ function makeSnapshot(system) {
|
|
|
40
39
|
};
|
|
41
40
|
}
|
|
42
41
|
var isLayoutChange = (change) => change.op === "reset-manual-layout" || change.op === "save-view-snapshot";
|
|
42
|
+
var isLayoutChangeOp = (op) => op === "apply-latest-to-manual" || op === "apply-semantic-layout" || op === "sync-snapshot" || isLayoutChange(op);
|
|
43
43
|
filter(isNot(isLayoutChange));
|
|
44
44
|
var scheduleSync = (delay = 50) => {
|
|
45
45
|
return machine.raise({ type: "change.sync-snapshot" }, delay ? {
|
|
@@ -47,10 +47,13 @@ var scheduleSync = (delay = 50) => {
|
|
|
47
47
|
id: "sync-snapshot"
|
|
48
48
|
} : void 0);
|
|
49
49
|
};
|
|
50
|
+
var cancelSync = () => {
|
|
51
|
+
return machine.cancel("sync-snapshot");
|
|
52
|
+
};
|
|
50
53
|
/**
|
|
51
54
|
* Save the state before editing starts
|
|
52
55
|
*/
|
|
53
|
-
var saveBeforeEditing = machine.assign(({ system, event }) => {
|
|
56
|
+
var saveBeforeEditing = () => machine.assign(({ system, event }) => {
|
|
54
57
|
assertEvent(event, "edit.move.start");
|
|
55
58
|
return { editing: {
|
|
56
59
|
subject: event.subject,
|
|
@@ -60,22 +63,52 @@ var saveBeforeEditing = machine.assign(({ system, event }) => {
|
|
|
60
63
|
/**
|
|
61
64
|
* When editing finishes, push the "beforeEditing" state to the history stack
|
|
62
65
|
*/
|
|
63
|
-
var pushHistory = () => machine.
|
|
66
|
+
var pushHistory = () => machine.enqueueActions(({ context, enqueue }) => {
|
|
64
67
|
const editing = context.editing;
|
|
65
|
-
if (editing)
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
68
|
+
if (editing) {
|
|
69
|
+
enqueue.assign({
|
|
70
|
+
editing: null,
|
|
71
|
+
history: {
|
|
72
|
+
head: editing.before,
|
|
73
|
+
tail: context.history
|
|
74
|
+
},
|
|
75
|
+
redo: null
|
|
76
|
+
});
|
|
77
|
+
enqueue(scheduleSync());
|
|
78
|
+
}
|
|
73
79
|
});
|
|
74
|
-
var
|
|
75
|
-
var undo = () => machine.enqueueActions(({ context: { history }, enqueue }) => {
|
|
80
|
+
var undo = () => machine.enqueueActions(({ context: { history, redo }, system, enqueue }) => {
|
|
76
81
|
if (!history) return;
|
|
77
82
|
const last = history.head;
|
|
78
|
-
enqueue.assign({
|
|
83
|
+
enqueue.assign({
|
|
84
|
+
history: history.tail,
|
|
85
|
+
redo: {
|
|
86
|
+
head: makeSnapshot(system),
|
|
87
|
+
tail: redo
|
|
88
|
+
}
|
|
89
|
+
});
|
|
90
|
+
enqueue(cancelSync());
|
|
91
|
+
enqueue(scheduleSync(100));
|
|
92
|
+
enqueue.sendTo(typedSystem.diagramActor, {
|
|
93
|
+
type: "update.view",
|
|
94
|
+
view: last.view,
|
|
95
|
+
xyedges: last.xyedges,
|
|
96
|
+
xynodes: last.xynodes,
|
|
97
|
+
source: "editor"
|
|
98
|
+
});
|
|
99
|
+
});
|
|
100
|
+
var redo = () => machine.enqueueActions(({ context: { history, redo }, system, enqueue }) => {
|
|
101
|
+
if (!redo) return;
|
|
102
|
+
const last = redo.head;
|
|
103
|
+
enqueue.assign({
|
|
104
|
+
history: {
|
|
105
|
+
head: makeSnapshot(system),
|
|
106
|
+
tail: history
|
|
107
|
+
},
|
|
108
|
+
redo: redo.tail
|
|
109
|
+
});
|
|
110
|
+
enqueue(cancelSync());
|
|
111
|
+
enqueue(scheduleSync(100));
|
|
79
112
|
enqueue.sendTo(typedSystem.diagramActor, {
|
|
80
113
|
type: "update.view",
|
|
81
114
|
view: last.view,
|
|
@@ -83,13 +116,41 @@ var undo = () => machine.enqueueActions(({ context: { history }, enqueue }) => {
|
|
|
83
116
|
xynodes: last.xynodes,
|
|
84
117
|
source: "editor"
|
|
85
118
|
});
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
119
|
+
});
|
|
120
|
+
var deleteNodesAndEdges = () => machine.enqueueActions(({ context, system, event, enqueue }) => {
|
|
121
|
+
assertEvent(event, "delete.nodes-edges");
|
|
122
|
+
const deletedNodeIds = new Set(event.nodeIds);
|
|
123
|
+
const willNotBeDeletedNode = (node) => !deletedNodeIds.has(typeof node === "string" ? node : node.id);
|
|
124
|
+
const snapshot = makeSnapshot(system);
|
|
125
|
+
const deletedEdgeIds = new Set(event.edgeIds);
|
|
126
|
+
for (const edge of snapshot.view.edges) if (deletedNodeIds.has(edge.source) || deletedNodeIds.has(edge.target)) deletedEdgeIds.add(edge.id);
|
|
127
|
+
const willNotBeDeletedEdge = (edge) => !deletedEdgeIds.has(typeof edge === "string" ? edge : edge.id);
|
|
128
|
+
enqueue.assign({
|
|
129
|
+
history: {
|
|
130
|
+
head: snapshot,
|
|
131
|
+
tail: context.history
|
|
132
|
+
},
|
|
133
|
+
redo: null
|
|
134
|
+
});
|
|
135
|
+
const cleanupNode = (node) => {
|
|
136
|
+
if (node.children.every(willNotBeDeletedNode) && node.inEdges.every(willNotBeDeletedEdge) && node.outEdges.every(willNotBeDeletedEdge)) return node;
|
|
137
|
+
return {
|
|
138
|
+
...node,
|
|
139
|
+
children: node.children.filter(willNotBeDeletedNode),
|
|
140
|
+
inEdges: node.inEdges.filter(willNotBeDeletedEdge),
|
|
141
|
+
outEdges: node.outEdges.filter(willNotBeDeletedEdge)
|
|
142
|
+
};
|
|
143
|
+
};
|
|
144
|
+
enqueue(cancelSync());
|
|
145
|
+
enqueue(scheduleSync());
|
|
146
|
+
enqueue.sendTo(typedSystem.diagramActor, {
|
|
147
|
+
type: "update.view",
|
|
148
|
+
view: {
|
|
149
|
+
...snapshot.view,
|
|
150
|
+
nodes: snapshot.view.nodes.filter(willNotBeDeletedNode).map(cleanupNode),
|
|
151
|
+
edges: snapshot.view.edges.filter(willNotBeDeletedEdge)
|
|
152
|
+
},
|
|
153
|
+
source: "editor"
|
|
93
154
|
});
|
|
94
155
|
});
|
|
95
156
|
var pushToSyncQueue = () => machine.assign(({ context: { syncQueue }, event }) => {
|
|
@@ -102,7 +163,7 @@ var pushToSyncQueue = () => machine.assign(({ context: { syncQueue }, event }) =
|
|
|
102
163
|
nextOp = "apply-semantic-layout";
|
|
103
164
|
break;
|
|
104
165
|
case "change.latest-to-manual":
|
|
105
|
-
nextOp = "apply-
|
|
166
|
+
nextOp = "apply-latest-to-manual";
|
|
106
167
|
break;
|
|
107
168
|
case "change.sync-snapshot":
|
|
108
169
|
nextOp = "sync-snapshot";
|
|
@@ -110,13 +171,18 @@ var pushToSyncQueue = () => machine.assign(({ context: { syncQueue }, event }) =
|
|
|
110
171
|
default: throw new Error(`Invalid event type: ${event.type}`);
|
|
111
172
|
}
|
|
112
173
|
if (syncQueue.length === 0) return { syncQueue: [nextOp] };
|
|
113
|
-
|
|
174
|
+
if (syncQueue.length === 1 && syncQueue[0] === nextOp) return {};
|
|
175
|
+
const isNextLayoutChange = isLayoutChangeOp(nextOp);
|
|
114
176
|
let pending = syncQueue.filter((existingOp) => {
|
|
115
177
|
if (existingOp === nextOp) return false;
|
|
116
|
-
if (isNextLayoutChange &&
|
|
178
|
+
if (isNextLayoutChange && isLayoutChangeOp(existingOp)) return false;
|
|
117
179
|
return true;
|
|
118
180
|
});
|
|
119
181
|
return { syncQueue: pending.length > 0 ? [...pending, nextOp] : [nextOp] };
|
|
120
182
|
});
|
|
183
|
+
var clearQueue = () => machine.assign({
|
|
184
|
+
syncQueue: [],
|
|
185
|
+
processing: null
|
|
186
|
+
});
|
|
121
187
|
//#endregion
|
|
122
|
-
export { makeSnapshot, pushHistory, pushToSyncQueue,
|
|
188
|
+
export { cancelSync, clearQueue, deleteNodesAndEdges, isLayoutChange, isLayoutChangeOp, makeSnapshot, pushHistory, pushToSyncQueue, redo, saveBeforeEditing, scheduleSync, undo };
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { AnyEventObject, CallbackActorLogic, NonReducibleUnknown } from 'xstate';
|
|
2
2
|
export type HotKeyEvent = {
|
|
3
|
-
type: 'undo';
|
|
3
|
+
type: 'undo' | 'redo';
|
|
4
4
|
};
|
|
5
5
|
export interface HotkeyActorLogic extends CallbackActorLogic<AnyEventObject, NonReducibleUnknown, HotKeyEvent> {
|
|
6
6
|
}
|
|
@@ -10,6 +10,13 @@ var hotkey = fromCallback(({ sendBack }) => {
|
|
|
10
10
|
sendBack({ type: "undo" });
|
|
11
11
|
},
|
|
12
12
|
{ preventDefault: true }
|
|
13
|
+
], [
|
|
14
|
+
"mod + shift + z",
|
|
15
|
+
(event) => {
|
|
16
|
+
event.stopPropagation();
|
|
17
|
+
sendBack({ type: "redo" });
|
|
18
|
+
},
|
|
19
|
+
{ preventDefault: true }
|
|
13
20
|
]]);
|
|
14
21
|
document.body.addEventListener("keydown", ctrlZHandler, { capture: true });
|
|
15
22
|
return () => {
|
|
@@ -1,9 +1,7 @@
|
|
|
1
|
-
import { ActorRef, SnapshotFrom
|
|
2
|
-
import {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
syncQueue: 'idle' | 'pending' | 'suspended' | 'process';
|
|
6
|
-
}, EditorActorStateTag, EditorActorInput, any, EditorActorEmitedEvent, any, any> {
|
|
1
|
+
import { ActorRef, SnapshotFrom } from 'xstate';
|
|
2
|
+
import { BaseEditorActorLogic } from './setup';
|
|
3
|
+
import { EditorActorEmitedEvent, EditorActorEvent } from './types';
|
|
4
|
+
export interface EditorActorLogic extends BaseEditorActorLogic {
|
|
7
5
|
}
|
|
8
6
|
export declare const editorActorLogic: EditorActorLogic;
|
|
9
7
|
export type EditorActorSnapshot = SnapshotFrom<EditorActorLogic>;
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { ActorRefFromLogic, StateMachine, StateValue, PromiseActorLogic, EventObject, SetupReturn, NonReducibleUnknown, MetaObject } from 'xstate';
|
|
2
|
+
import { inferChildrenRef, inferProvidedActor } from '../../utils/defineActors';
|
|
2
3
|
import { EditorActorContext, EditorActorEmitedEvent, EditorActorEvent, EditorActorInput, EditorActorStateTag } from './types';
|
|
3
4
|
import { HotkeyActorLogic } from './hotkey';
|
|
4
5
|
import type * as t from '@likec4/core/types';
|
|
@@ -32,17 +33,37 @@ export declare namespace EditorCalls {
|
|
|
32
33
|
viewId: t.ViewId;
|
|
33
34
|
changes: t.ViewChange[];
|
|
34
35
|
};
|
|
35
|
-
|
|
36
|
+
/**
|
|
37
|
+
* Returns the changes that were applied to the view
|
|
38
|
+
*/
|
|
39
|
+
type Output = {
|
|
40
|
+
requested: t.ViewChange[];
|
|
41
|
+
applied: t.ViewChange[];
|
|
42
|
+
};
|
|
36
43
|
}
|
|
37
44
|
}
|
|
38
|
-
|
|
45
|
+
declare const actors: {
|
|
46
|
+
hotkey: HotkeyActorLogic;
|
|
39
47
|
applyLatest: PromiseActorLogic<EditorCalls.ApplyLatestToManual.Output, EditorCalls.ApplyLatestToManual.Input, EventObject>;
|
|
40
|
-
executeChange: PromiseActorLogic<
|
|
48
|
+
executeChange: PromiseActorLogic<EditorCalls.ExecuteChange.Output, EditorCalls.ExecuteChange.Input, EventObject>;
|
|
41
49
|
applySemanticLayout: PromiseActorLogic<EditorCalls.ApplySemanticLayout.Output, EditorCalls.ApplySemanticLayout.Input, EventObject>;
|
|
50
|
+
};
|
|
51
|
+
export declare const machine: SetupReturn<EditorActorContext, EditorActorEvent, {
|
|
42
52
|
hotkey: HotkeyActorLogic;
|
|
53
|
+
applyLatest: PromiseActorLogic<EditorCalls.ApplyLatestToManual.Output, EditorCalls.ApplyLatestToManual.Input, EventObject>;
|
|
54
|
+
executeChange: PromiseActorLogic<EditorCalls.ExecuteChange.Output, EditorCalls.ExecuteChange.Input, EventObject>;
|
|
55
|
+
applySemanticLayout: PromiseActorLogic<EditorCalls.ApplySemanticLayout.Output, EditorCalls.ApplySemanticLayout.Input, EventObject>;
|
|
43
56
|
}, {
|
|
44
57
|
hotkey: "hotkey";
|
|
45
58
|
}, {}, {
|
|
46
59
|
'has pending': unknown;
|
|
47
60
|
'can undo': unknown;
|
|
61
|
+
'can redo': unknown;
|
|
48
62
|
}, "500ms" | "wait-after-edit", EditorActorStateTag, EditorActorInput, NonReducibleUnknown, EditorActorEmitedEvent, MetaObject>;
|
|
63
|
+
/**
|
|
64
|
+
* to workaround circular dependency issue between editor and diagram packages
|
|
65
|
+
*/
|
|
66
|
+
export interface BaseEditorActorLogic<State extends StateValue = any> extends StateMachine<EditorActorContext, EditorActorEvent, inferChildrenRef<typeof actors>, inferProvidedActor<typeof actors>, never, never, never, State, EditorActorStateTag, EditorActorInput, never, EditorActorEmitedEvent, never, never> {
|
|
67
|
+
}
|
|
68
|
+
export type BaseEditorActorRef = ActorRefFromLogic<BaseEditorActorLogic>;
|
|
69
|
+
export {};
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import "../../_virtual/_rolldown/runtime.js";
|
|
2
|
+
import { defineActors } from "../../utils/defineActors.js";
|
|
2
3
|
import { hotkey } from "./hotkey.js";
|
|
3
4
|
import { fromPromise, setup } from "xstate";
|
|
4
5
|
var machine = setup({
|
|
@@ -10,7 +11,8 @@ var machine = setup({
|
|
|
10
11
|
children: {},
|
|
11
12
|
tags: ""
|
|
12
13
|
},
|
|
13
|
-
actors: {
|
|
14
|
+
actors: defineActors({
|
|
15
|
+
hotkey,
|
|
14
16
|
applyLatest: fromPromise(() => {
|
|
15
17
|
throw new Error("Not implemented");
|
|
16
18
|
}),
|
|
@@ -19,16 +21,16 @@ var machine = setup({
|
|
|
19
21
|
}),
|
|
20
22
|
applySemanticLayout: fromPromise(() => {
|
|
21
23
|
throw new Error("Not implemented");
|
|
22
|
-
})
|
|
23
|
-
|
|
24
|
-
},
|
|
24
|
+
})
|
|
25
|
+
}),
|
|
25
26
|
delays: {
|
|
26
27
|
"500ms": 500,
|
|
27
28
|
"wait-after-edit": 1e3
|
|
28
29
|
},
|
|
29
30
|
guards: {
|
|
30
|
-
"has pending": ({ context }) => context.syncQueue.length > 0
|
|
31
|
-
"can undo": ({ context }) => context.history !== null
|
|
31
|
+
"has pending": ({ context }) => context.syncQueue.length > 0,
|
|
32
|
+
"can undo": ({ context }) => context.history !== null,
|
|
33
|
+
"can redo": ({ context }) => context.redo !== null
|
|
32
34
|
}
|
|
33
35
|
});
|
|
34
36
|
//#endregion
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { StopAction, ActionFunction, PromiseActorLogic, EventObject
|
|
1
|
+
import { StopAction, ActionFunction, PromiseActorLogic, EventObject } from 'xstate';
|
|
2
2
|
import { EditorActorContext, EditorActorEvent, EditorActorEmitedEvent } from './types';
|
|
3
3
|
import { HotkeyActorLogic } from './hotkey';
|
|
4
4
|
export declare const editor: {
|
|
@@ -14,10 +14,36 @@ export declare const editor: {
|
|
|
14
14
|
};
|
|
15
15
|
moving: {
|
|
16
16
|
entry: StopAction<EditorActorContext, EditorActorEvent, undefined, EditorActorEvent>[];
|
|
17
|
+
exit: ActionFunction<EditorActorContext, EditorActorEvent, EditorActorEvent, undefined, {
|
|
18
|
+
src: "hotkey";
|
|
19
|
+
logic: HotkeyActorLogic;
|
|
20
|
+
id: "hotkey";
|
|
21
|
+
} | {
|
|
22
|
+
src: "applyLatest";
|
|
23
|
+
logic: PromiseActorLogic<import("./setup").EditorCalls.ApplyLatestToManual.Output, import("./setup").EditorCalls.ApplyLatestToManual.Input, EventObject>;
|
|
24
|
+
id: string | undefined;
|
|
25
|
+
} | {
|
|
26
|
+
src: "executeChange";
|
|
27
|
+
logic: PromiseActorLogic<import("./setup").EditorCalls.ExecuteChange.Output, import("./setup").EditorCalls.ExecuteChange.Input, EventObject>;
|
|
28
|
+
id: string | undefined;
|
|
29
|
+
} | {
|
|
30
|
+
src: "applySemanticLayout";
|
|
31
|
+
logic: PromiseActorLogic<import("./setup").EditorCalls.ApplySemanticLayout.Output, import("./setup").EditorCalls.ApplySemanticLayout.Input, EventObject>;
|
|
32
|
+
id: string | undefined;
|
|
33
|
+
}, never, {
|
|
34
|
+
type: "has pending";
|
|
35
|
+
params: unknown;
|
|
36
|
+
} | {
|
|
37
|
+
type: "can undo";
|
|
38
|
+
params: unknown;
|
|
39
|
+
} | {
|
|
40
|
+
type: "can redo";
|
|
41
|
+
params: unknown;
|
|
42
|
+
}, "500ms" | "wait-after-edit", EditorActorEmitedEvent>[];
|
|
17
43
|
on: {
|
|
18
44
|
'edit.move.end': {
|
|
19
45
|
target: "#idle";
|
|
20
|
-
actions:
|
|
46
|
+
actions: ActionFunction<EditorActorContext, EditorActorEvent, EditorActorEvent, undefined, {
|
|
21
47
|
src: "hotkey";
|
|
22
48
|
logic: HotkeyActorLogic;
|
|
23
49
|
id: "hotkey";
|
|
@@ -27,19 +53,26 @@ export declare const editor: {
|
|
|
27
53
|
id: string | undefined;
|
|
28
54
|
} | {
|
|
29
55
|
src: "executeChange";
|
|
30
|
-
logic: PromiseActorLogic<
|
|
56
|
+
logic: PromiseActorLogic<import("./setup").EditorCalls.ExecuteChange.Output, import("./setup").EditorCalls.ExecuteChange.Input, EventObject>;
|
|
31
57
|
id: string | undefined;
|
|
32
58
|
} | {
|
|
33
59
|
src: "applySemanticLayout";
|
|
34
60
|
logic: PromiseActorLogic<import("./setup").EditorCalls.ApplySemanticLayout.Output, import("./setup").EditorCalls.ApplySemanticLayout.Input, EventObject>;
|
|
35
61
|
id: string | undefined;
|
|
36
|
-
}, never,
|
|
62
|
+
}, never, {
|
|
63
|
+
type: "has pending";
|
|
64
|
+
params: unknown;
|
|
65
|
+
} | {
|
|
66
|
+
type: "can undo";
|
|
67
|
+
params: unknown;
|
|
68
|
+
} | {
|
|
69
|
+
type: "can redo";
|
|
70
|
+
params: unknown;
|
|
71
|
+
}, "500ms" | "wait-after-edit", EditorActorEmitedEvent>;
|
|
37
72
|
};
|
|
38
73
|
'edit.move.cancel': {
|
|
39
74
|
target: "#idle";
|
|
40
|
-
actions: ActionFunction<EditorActorContext, {
|
|
41
|
-
type: "edit.move.cancel";
|
|
42
|
-
}, EditorActorEvent, undefined, {
|
|
75
|
+
actions: ActionFunction<EditorActorContext, EditorActorEvent, EditorActorEvent, undefined, {
|
|
43
76
|
src: "hotkey";
|
|
44
77
|
logic: HotkeyActorLogic;
|
|
45
78
|
id: "hotkey";
|
|
@@ -49,25 +82,39 @@ export declare const editor: {
|
|
|
49
82
|
id: string | undefined;
|
|
50
83
|
} | {
|
|
51
84
|
src: "executeChange";
|
|
52
|
-
logic: PromiseActorLogic<
|
|
85
|
+
logic: PromiseActorLogic<import("./setup").EditorCalls.ExecuteChange.Output, import("./setup").EditorCalls.ExecuteChange.Input, EventObject>;
|
|
53
86
|
id: string | undefined;
|
|
54
87
|
} | {
|
|
55
88
|
src: "applySemanticLayout";
|
|
56
89
|
logic: PromiseActorLogic<import("./setup").EditorCalls.ApplySemanticLayout.Output, import("./setup").EditorCalls.ApplySemanticLayout.Input, EventObject>;
|
|
57
90
|
id: string | undefined;
|
|
58
|
-
}, never, never, never, never
|
|
91
|
+
}, never, never, never, never>;
|
|
59
92
|
};
|
|
60
|
-
|
|
93
|
+
cancel: {
|
|
61
94
|
target: "#idle";
|
|
95
|
+
actions: ActionFunction<EditorActorContext, EditorActorEvent, EditorActorEvent, undefined, {
|
|
96
|
+
src: "hotkey";
|
|
97
|
+
logic: HotkeyActorLogic;
|
|
98
|
+
id: "hotkey";
|
|
99
|
+
} | {
|
|
100
|
+
src: "applyLatest";
|
|
101
|
+
logic: PromiseActorLogic<import("./setup").EditorCalls.ApplyLatestToManual.Output, import("./setup").EditorCalls.ApplyLatestToManual.Input, EventObject>;
|
|
102
|
+
id: string | undefined;
|
|
103
|
+
} | {
|
|
104
|
+
src: "executeChange";
|
|
105
|
+
logic: PromiseActorLogic<import("./setup").EditorCalls.ExecuteChange.Output, import("./setup").EditorCalls.ExecuteChange.Input, EventObject>;
|
|
106
|
+
id: string | undefined;
|
|
107
|
+
} | {
|
|
108
|
+
src: "applySemanticLayout";
|
|
109
|
+
logic: PromiseActorLogic<import("./setup").EditorCalls.ApplySemanticLayout.Output, import("./setup").EditorCalls.ApplySemanticLayout.Input, EventObject>;
|
|
110
|
+
id: string | undefined;
|
|
111
|
+
}, never, never, never, never>;
|
|
62
112
|
};
|
|
63
113
|
};
|
|
64
114
|
id: string;
|
|
65
115
|
};
|
|
66
116
|
};
|
|
67
117
|
on: {
|
|
68
|
-
cancel: {
|
|
69
|
-
target: "#idle";
|
|
70
|
-
};
|
|
71
118
|
'*': {
|
|
72
119
|
actions: ActionFunction<EditorActorContext, EditorActorEvent, EditorActorEvent, undefined, {
|
|
73
120
|
src: "hotkey";
|
|
@@ -79,7 +126,7 @@ export declare const editor: {
|
|
|
79
126
|
id: string | undefined;
|
|
80
127
|
} | {
|
|
81
128
|
src: "executeChange";
|
|
82
|
-
logic: PromiseActorLogic<
|
|
129
|
+
logic: PromiseActorLogic<import("./setup").EditorCalls.ExecuteChange.Output, import("./setup").EditorCalls.ExecuteChange.Input, EventObject>;
|
|
83
130
|
id: string | undefined;
|
|
84
131
|
} | {
|
|
85
132
|
src: "applySemanticLayout";
|
|
@@ -91,6 +138,9 @@ export declare const editor: {
|
|
|
91
138
|
} | {
|
|
92
139
|
type: "can undo";
|
|
93
140
|
params: unknown;
|
|
141
|
+
} | {
|
|
142
|
+
type: "can redo";
|
|
143
|
+
params: unknown;
|
|
94
144
|
}, "500ms" | "wait-after-edit", EditorActorEmitedEvent>;
|
|
95
145
|
};
|
|
96
146
|
};
|