@likec4/diagram 1.43.0 → 1.45.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/bundle/index.js +14727 -13166
- package/dist/LikeC4Diagram.d.ts +1 -1
- package/dist/LikeC4Diagram.js +14 -9
- package/dist/LikeC4Diagram.props.d.ts +25 -15
- package/dist/LikeC4ProjectsProvider.js +1 -1
- package/dist/LikeC4Styles.js +0 -3
- package/dist/LikeC4View.d.ts +8 -3
- package/dist/LikeC4View.js +29 -14
- package/dist/ReactLikeC4.d.ts +2 -2
- package/dist/ReactLikeC4.js +2 -2
- package/dist/StaticLikeC4Diagram.js +1 -1
- package/dist/_virtual/_commonjsHelpers.js +3 -0
- package/dist/_virtual/assign-dea9f7c8.cjs.js +3 -0
- package/dist/_virtual/log-ec8d4df4.cjs.js +3 -0
- package/dist/_virtual/raise-da5b247f.cjs.js +3 -0
- package/dist/_virtual/xstate-actions.cjs.js +5 -0
- package/dist/_virtual/xstate-actions.cjs2.js +3 -0
- package/dist/_virtual/xstate-dev.cjs.js +3 -0
- package/dist/_virtual/xstate-guards.cjs.js +5 -0
- package/dist/_virtual/xstate-guards.cjs2.js +3 -0
- package/dist/base/Background.d.ts +2 -1
- package/dist/base/Background.js +11 -2
- package/dist/base/Base.d.ts +28 -0
- package/dist/base/BaseXYFlow.d.ts +5 -5
- package/dist/base/BaseXYFlow.js +38 -44
- package/dist/base/index.d.ts +6 -2
- package/dist/base/types.d.ts +1 -28
- package/dist/base/updateEdges.js +25 -14
- package/dist/base/updateNodes.d.ts +14 -0
- package/dist/base/updateNodes.js +51 -17
- package/dist/base-primitives/Markdown.d.ts +30 -4
- package/dist/base-primitives/Markdown.js +3 -2
- package/dist/base-primitives/compound/CompoundActionButton.d.ts +3 -2
- package/dist/base-primitives/compound/CompoundActionButton.js +1 -1
- package/dist/base-primitives/compound/CompoundDetailsButton.d.ts +3 -2
- package/dist/base-primitives/compound/CompoundDetailsButton.js +1 -1
- package/dist/base-primitives/edge/EdgeActionButton.d.ts +3 -2
- package/dist/base-primitives/edge/EdgeActionButton.js +1 -1
- package/dist/base-primitives/edge/EdgeContainer.d.ts +1 -1
- package/dist/base-primitives/edge/EdgeContainer.js +8 -1
- package/dist/base-primitives/edge/EdgeLabel.d.ts +3 -2
- package/dist/base-primitives/edge/EdgeLabel.js +2 -0
- package/dist/base-primitives/edge/EdgeLabelContainer.d.ts +1 -1
- package/dist/base-primitives/edge/EdgeLabelContainer.js +4 -0
- package/dist/base-primitives/edge/EdgePath.d.ts +4 -0
- package/dist/base-primitives/edge/EdgePath.js +29 -5
- package/dist/base-primitives/element/ElementActionButtons.d.ts +6 -4
- package/dist/base-primitives/element/ElementActionButtons.js +3 -3
- package/dist/base-primitives/element/ElementData.d.ts +3 -3
- package/dist/base-primitives/element/ElementData.js +13 -7
- package/dist/base-primitives/element/ElementDetailsButton.d.ts +3 -2
- package/dist/base-primitives/element/ElementDetailsButton.js +5 -5
- package/dist/base-primitives/element/ElementNodeContainer.css.js +15 -27
- package/dist/base-primitives/element/ElementShape.js +5 -5
- package/dist/base-primitives/element/ElementTags.d.ts +6 -4
- package/dist/base-primitives/element/ElementTags.js +2 -1
- package/dist/base-primitives/memoEdge.js +4 -2
- package/dist/base-primitives/memoNode.d.ts +1 -1
- package/dist/base-primitives/memoNode.js +3 -3
- package/dist/components/ErrorFallback.js +52 -35
- package/dist/components/Link.js +2 -2
- package/dist/context/DiagramEventHandlers.js +2 -1
- package/dist/context/DiagramFeatures.d.ts +25 -6
- package/dist/context/DiagramFeatures.js +28 -56
- package/dist/context/IconRenderer.js +6 -6
- package/dist/context/LikeC4ModelContext.js +3 -10
- package/dist/context/TagStylesContext.js +3 -19
- package/dist/context/index.d.ts +1 -1
- package/dist/custom/customNodes.js +3 -2
- package/dist/custom/hooks.d.ts +3 -3
- package/dist/custom/index.d.ts +1 -1
- package/dist/custom/index.js +5 -5
- package/dist/editor/LikeC4EditorContext.d.ts +21 -0
- package/dist/editor/index.d.ts +2 -0
- package/dist/hooks/index.d.ts +4 -2
- package/dist/hooks/safeContext.d.ts +6 -3
- package/dist/hooks/safeContext.js +10 -3
- package/dist/hooks/useCallbackRef.d.ts +1 -0
- package/dist/hooks/useCallbackRef.js +13 -0
- package/dist/hooks/useCurrentView.d.ts +11 -0
- package/dist/hooks/{useCurrentViewId.js → useCurrentView.js} +7 -3
- package/dist/hooks/useCurrentViewModel.js +4 -1
- package/dist/hooks/useDiagram.d.ts +7 -113
- package/dist/hooks/useDiagram.js +7 -127
- package/dist/hooks/useDiagramCompareLayout.d.ts +35 -0
- package/dist/hooks/useDiagramCompareLayout.js +65 -0
- package/dist/hooks/useLikeC4Project.d.ts +6 -1
- package/dist/hooks/useLikeC4Project.js +14 -2
- package/dist/hooks/useMediaPrint.d.ts +6 -0
- package/dist/hooks/useUpdateEffect.js +2 -4
- package/dist/hooks/useXYFlow.d.ts +1 -0
- package/dist/hooks/useXYFlow.js +4 -7
- package/dist/index.d.ts +2 -2
- package/dist/index.js +4 -3
- package/dist/likec4diagram/DiagramUI.js +14 -7
- package/dist/likec4diagram/DiagramXYFlow.d.ts +2 -2
- package/dist/likec4diagram/DiagramXYFlow.js +60 -52
- package/dist/likec4diagram/convert-to-xyflow.d.ts +0 -1
- package/dist/likec4diagram/custom/edges/EdgeDrifts.d.ts +6 -0
- package/dist/likec4diagram/custom/edges/EdgeDrifts.js +38 -0
- package/dist/likec4diagram/custom/edges/RelationshipEdge.js +256 -217
- package/dist/likec4diagram/custom/edges/SequenceStepEdge.js +9 -2
- package/dist/likec4diagram/custom/edges/edges.css.js +3 -4
- package/dist/likec4diagram/custom/edges/useControlPoints.d.ts +8 -0
- package/dist/likec4diagram/custom/edges/useControlPoints.js +58 -0
- package/dist/likec4diagram/custom/edges/useRelationshipEdgePath.d.ts +7 -0
- package/dist/likec4diagram/custom/edges/useRelationshipEdgePath.js +60 -0
- package/dist/likec4diagram/custom/edges/utils.d.ts +0 -12
- package/dist/likec4diagram/custom/nodes/CompoundActions.js +4 -1
- package/dist/likec4diagram/custom/nodes/ElementActions.d.ts +2 -1
- package/dist/likec4diagram/custom/nodes/ElementActions.js +15 -10
- package/dist/likec4diagram/custom/nodes/NodeDrifts.d.ts +6 -0
- package/dist/likec4diagram/custom/nodes/NodeDrifts.js +50 -0
- package/dist/likec4diagram/custom/nodes/SequenceActorNode.js +7 -2
- package/dist/likec4diagram/custom/nodes/index.d.ts +1 -0
- package/dist/likec4diagram/custom/nodes/nodes.d.ts +9 -1
- package/dist/likec4diagram/custom/nodes/nodes.js +74 -29
- package/dist/likec4diagram/custom/nodes/toolbar/ColorButton.d.ts +1 -1
- package/dist/likec4diagram/custom/nodes/toolbar/ColorButton.js +1 -1
- package/dist/likec4diagram/custom/nodes/toolbar/CompoundToolbar.js +2 -1
- package/dist/likec4diagram/custom/nodes/toolbar/ElementToolbar.js +4 -3
- package/dist/likec4diagram/custom/nodes/toolbar/_shared.d.ts +1 -11
- package/dist/likec4diagram/custom/nodes/toolbar/_shared.js +7 -51
- package/dist/likec4diagram/custom/nodes/toolbar/types.d.ts +5 -0
- package/dist/likec4diagram/custom/nodes/toolbar/types.js +7 -0
- package/dist/likec4diagram/custom/nodes/toolbar/useHandlers.d.ts +8 -0
- package/dist/likec4diagram/custom/nodes/toolbar/useHandlers.js +44 -0
- package/dist/likec4diagram/relationship-popover/RelationshipPopover.js +8 -10
- package/dist/likec4diagram/relationship-popover/actor.d.ts +1 -1
- package/dist/likec4diagram/state/DiagramActorProvider.d.ts +4 -3
- package/dist/likec4diagram/state/DiagramActorProvider.js +95 -70
- package/dist/likec4diagram/state/assign.d.ts +13 -7
- package/dist/likec4diagram/state/assign.js +43 -282
- package/dist/likec4diagram/state/createViewChange.d.ts +3 -0
- package/dist/likec4diagram/state/createViewChange.js +79 -0
- package/dist/likec4diagram/state/diagram-api.d.ts +109 -0
- package/dist/likec4diagram/state/diagram-api.js +126 -0
- package/dist/likec4diagram/state/machine.actions.d.ts +1783 -0
- package/dist/likec4diagram/state/machine.actions.js +644 -0
- package/dist/likec4diagram/state/machine.actions.layout.d.ts +579 -0
- package/dist/likec4diagram/state/machine.actions.layout.js +129 -0
- package/dist/likec4diagram/state/machine.d.ts +22 -0
- package/dist/likec4diagram/state/machine.js +127 -0
- package/dist/likec4diagram/state/machine.setup.d.ts +327 -0
- package/dist/likec4diagram/state/machine.setup.js +93 -0
- package/dist/likec4diagram/state/machine.state.initializing.d.ts +208 -0
- package/dist/likec4diagram/state/machine.state.initializing.js +55 -0
- package/dist/likec4diagram/state/machine.state.navigating.d.ts +14 -0
- package/dist/likec4diagram/state/machine.state.navigating.js +178 -0
- package/dist/likec4diagram/state/machine.state.ready.d.ts +3131 -0
- package/dist/likec4diagram/state/machine.state.ready.focused.d.ts +386 -0
- package/dist/likec4diagram/state/machine.state.ready.focused.js +85 -0
- package/dist/likec4diagram/state/machine.state.ready.idle.d.ts +474 -0
- package/dist/likec4diagram/state/machine.state.ready.idle.js +96 -0
- package/dist/likec4diagram/state/machine.state.ready.js +262 -0
- package/dist/likec4diagram/state/machine.state.ready.printing.d.ts +128 -0
- package/dist/likec4diagram/state/machine.state.ready.printing.js +40 -0
- package/dist/likec4diagram/state/machine.state.ready.walkthrough.d.ts +511 -0
- package/dist/likec4diagram/state/machine.state.ready.walkthrough.js +177 -0
- package/dist/likec4diagram/state/mediaPrintActor.d.ts +12 -0
- package/dist/likec4diagram/state/mediaPrintActor.js +18 -0
- package/dist/likec4diagram/state/syncManualLayoutActor.d.ts +31 -108
- package/dist/likec4diagram/state/syncManualLayoutActor.js +278 -142
- package/dist/likec4diagram/state/types.d.ts +7 -12
- package/dist/likec4diagram/state/utils.d.ts +19 -4
- package/dist/likec4diagram/state/utils.js +47 -4
- package/dist/likec4diagram/types.d.ts +8 -8
- package/dist/likec4diagram/ui/LayoutDriftFrame.d.ts +2 -0
- package/dist/likec4diagram/ui/LayoutDriftFrame.js +66 -0
- package/dist/likec4diagram/ui/index.d.ts +1 -0
- package/dist/likec4diagram/ui/notation/NotationPanel.css.js +5 -2
- package/dist/likec4diagram/ui/notation/NotationPanel.js +5 -4
- package/dist/likec4diagram/useLayoutConstraints.d.ts +10 -5
- package/dist/likec4diagram/useLayoutConstraints.js +237 -61
- package/dist/likec4diagram/xyflow-diagram/diagram-view.d.ts +0 -1
- package/dist/likec4diagram/xyflow-diagram/diagram-view.js +14 -17
- package/dist/likec4diagram/xyflow-sequence/sequence-layout.js +11 -8
- package/dist/navigationpanel/NavigationPanel.js +16 -8
- package/dist/navigationpanel/NavigationPanelControls.d.ts +2 -1
- package/dist/navigationpanel/NavigationPanelControls.js +23 -17
- package/dist/navigationpanel/NavigationPanelDropdown.d.ts +2 -1
- package/dist/navigationpanel/NavigationPanelDropdown.js +62 -42
- package/dist/navigationpanel/_common.d.ts +1 -1
- package/dist/navigationpanel/_common.js +4 -2
- package/dist/navigationpanel/actor.d.ts +9 -205
- package/dist/navigationpanel/actor.js +6 -5
- package/dist/navigationpanel/comparepanel/CompareActionsMenu.d.ts +3 -0
- package/dist/navigationpanel/comparepanel/CompareActionsMenu.js +59 -0
- package/dist/navigationpanel/comparepanel/ComparePanel.d.ts +2 -0
- package/dist/navigationpanel/comparepanel/ComparePanel.js +42 -0
- package/dist/navigationpanel/comparepanel/ComparePanelControls.d.ts +1 -0
- package/dist/navigationpanel/comparepanel/ComparePanelControls.js +60 -0
- package/dist/navigationpanel/comparepanel/LayoutTypeSwitcher.d.ts +5 -0
- package/dist/navigationpanel/comparepanel/LayoutTypeSwitcher.js +38 -0
- package/dist/navigationpanel/comparepanel/index.d.ts +1 -0
- package/dist/navigationpanel/controls/{ViewDetailsCard.d.ts → DetailsControls.d.ts} +1 -1
- package/dist/navigationpanel/controls/{ViewDetailsCard.js → DetailsControls.js} +18 -14
- package/dist/navigationpanel/controls/LayoutWarning.d.ts +2 -0
- package/dist/navigationpanel/controls/LayoutWarning.js +102 -0
- package/dist/navigationpanel/controls/NavigationButtons.js +4 -3
- package/dist/navigationpanel/controls/OpenSource.js +2 -2
- package/dist/navigationpanel/controls/SearchControl.d.ts +2 -1
- package/dist/navigationpanel/controls/SearchControl.js +15 -17
- package/dist/navigationpanel/controls/ToggleReadonly.d.ts +1 -1
- package/dist/navigationpanel/controls/ToggleReadonly.js +26 -18
- package/dist/navigationpanel/controls/index.d.ts +2 -1
- package/dist/navigationpanel/dropdown/ProjectsMenu.d.ts +2 -2
- package/dist/navigationpanel/dropdown/ProjectsMenu.js +5 -5
- package/dist/navigationpanel/editorpanel/CenterCamera.js +5 -2
- package/dist/navigationpanel/editorpanel/ChangeAutoLayoutButton.d.ts +1 -1
- package/dist/navigationpanel/editorpanel/ChangeAutoLayoutButton.js +21 -20
- package/dist/navigationpanel/editorpanel/EditorPanel.js +3 -3
- package/dist/navigationpanel/editorpanel/ManualLayoutToolsButton.d.ts +2 -2
- package/dist/navigationpanel/editorpanel/ManualLayoutToolsButton.js +16 -13
- package/dist/navigationpanel/editorpanel/ToggleReadonly.d.ts +1 -0
- package/dist/navigationpanel/editorpanel/ToggleReadonly.js +15 -0
- package/dist/navigationpanel/styles.css.d.ts +2 -2
- package/dist/navigationpanel/styles.css.js +4 -4
- package/dist/navigationpanel/walkthrough/ActiveWalkthroughControls.js +14 -8
- package/dist/navigationpanel/walkthrough/DynamicViewControls.d.ts +66 -66
- package/dist/navigationpanel/walkthrough/DynamicViewControls.js +31 -14
- package/dist/navigationpanel/walkthrough/WalkthroughPanel.d.ts +2 -1
- package/dist/navigationpanel/walkthrough/WalkthroughPanel.js +68 -50
- package/dist/node_modules/.pnpm/xstate@5.24.0_patch_hash_3a1bd6d012ec67bf6e38a00c3226d1be77089442f83aeb6e424b00ca2a11d21c/node_modules/xstate/actions/dist/xstate-actions.cjs.js +37 -0
- package/dist/node_modules/.pnpm/xstate@5.24.0_patch_hash_3a1bd6d012ec67bf6e38a00c3226d1be77089442f83aeb6e424b00ca2a11d21c/node_modules/xstate/dev/dist/xstate-dev.cjs.js +59 -0
- package/dist/node_modules/.pnpm/xstate@5.24.0_patch_hash_3a1bd6d012ec67bf6e38a00c3226d1be77089442f83aeb6e424b00ca2a11d21c/node_modules/xstate/dist/assign-dea9f7c8.cjs.js +140 -0
- package/dist/node_modules/.pnpm/xstate@5.24.0_patch_hash_3a1bd6d012ec67bf6e38a00c3226d1be77089442f83aeb6e424b00ca2a11d21c/node_modules/xstate/dist/log-ec8d4df4.cjs.js +401 -0
- package/dist/node_modules/.pnpm/xstate@5.24.0_patch_hash_3a1bd6d012ec67bf6e38a00c3226d1be77089442f83aeb6e424b00ca2a11d21c/node_modules/xstate/dist/raise-da5b247f.cjs.js +2716 -0
- package/dist/node_modules/.pnpm/xstate@5.24.0_patch_hash_3a1bd6d012ec67bf6e38a00c3226d1be77089442f83aeb6e424b00ca2a11d21c/node_modules/xstate/guards/dist/xstate-guards.cjs.js +26 -0
- package/dist/overlays/element-details/ElementDetails.js +7 -7
- package/dist/overlays/element-details/ElementDetailsCard.css.js +3 -3
- package/dist/overlays/element-details/ElementDetailsCard.js +7 -5
- package/dist/overlays/element-details/MetadataValue.d.ts +2 -1
- package/dist/overlays/element-details/MetadataValue.js +2 -2
- package/dist/overlays/element-details/TabPanelDeployments.js +6 -4
- package/dist/overlays/element-details/TabPanelRelationships.js +3 -3
- package/dist/overlays/element-details/TabPanelStructure.js +1 -1
- package/dist/overlays/element-details/actor.d.ts +8 -82
- package/dist/overlays/element-details/actor.js +0 -8
- package/dist/overlays/overlay/Overlay.js +10 -10
- package/dist/overlays/overlaysActor.d.ts +7 -150
- package/dist/overlays/overlaysActor.js +183 -161
- package/dist/overlays/relationship-details/RelationshipDetails.js +4 -3
- package/dist/overlays/relationship-details/SelectEdge.js +2 -2
- package/dist/overlays/relationship-details/_types.d.ts +3 -4
- package/dist/overlays/relationship-details/actor.d.ts +6 -550
- package/dist/overlays/relationship-details/actor.js +18 -3
- package/dist/overlays/relationship-details/custom/ElementActions.js +8 -5
- package/dist/overlays/relationship-details/custom/edgeTypes.js +4 -1
- package/dist/overlays/relationship-details/custom/nodeTypes.js +4 -1
- package/dist/overlays/relationship-details/hooks.js +1 -1
- package/dist/overlays/relationship-details/layout-to-xyflow.js +3 -5
- package/dist/overlays/relationship-details/layout.d.ts +3 -3
- package/dist/overlays/relationship-details/layout.js +4 -4
- package/dist/overlays/relationships-browser/RelationshipsBrowser.js +6 -4
- package/dist/overlays/relationships-browser/SelectElement.js +2 -2
- package/dist/overlays/relationships-browser/_types.d.ts +2 -3
- package/dist/overlays/relationships-browser/actor.d.ts +7 -673
- package/dist/overlays/relationships-browser/actor.js +132 -110
- package/dist/overlays/relationships-browser/custom/ElementActions.js +44 -37
- package/dist/overlays/relationships-browser/custom/edgeTypes.js +4 -1
- package/dist/overlays/relationships-browser/custom/nodeTypes.js +4 -1
- package/dist/overlays/relationships-browser/hooks.js +7 -6
- package/dist/overlays/relationships-browser/layout.d.ts +2 -2
- package/dist/overlays/relationships-browser/layout.js +3 -3
- package/dist/overlays/relationships-browser/useViewToNodesEdges.js +0 -3
- package/dist/overlays/types.d.ts +12 -13
- package/dist/search/Search.js +2 -1
- package/dist/search/components/ElementsColumn.js +5 -3
- package/dist/search/components/PickView.js +1 -1
- package/dist/search/components/SearchByTags.js +21 -44
- package/dist/search/components/SearchInput.js +1 -1
- package/dist/search/components/ViewsColum.js +6 -4
- package/dist/search/components/_shared.css.d.ts +1 -1
- package/dist/search/searchActor.d.ts +3 -66
- package/dist/shadowroot/ShadowRoot.d.ts +5 -7
- package/dist/shadowroot/ShadowRoot.js +8 -6
- package/dist/styles.css2.js +1 -1
- package/dist/utils/index.d.ts +4 -4
- package/dist/utils/vector.d.ts +83 -21
- package/dist/utils/vector.js +98 -24
- package/dist/utils/view-bounds.d.ts +8 -0
- package/dist/utils/view-bounds.js +58 -0
- package/dist/utils/xyflow.d.ts +52 -8
- package/dist/utils/xyflow.js +31 -11
- package/package.json +26 -24
- package/panda.buildinfo.json +124 -71
- package/styles-min.css +1 -1
- package/styles.css +1 -1
- package/dist/hooks/useCurrentViewId.d.ts +0 -6
- package/dist/likec4diagram/custom/edges/utils.js +0 -23
- package/dist/likec4diagram/state/diagram-machine.d.ts +0 -2590
- package/dist/likec4diagram/state/diagram-machine.js +0 -1180
- package/dist/navigationpanel/editorpanel/LayoutDriftNotification.d.ts +0 -1
- package/dist/navigationpanel/editorpanel/LayoutDriftNotification.js +0 -56
- package/dist/utils/get-view-bounds.d.ts +0 -3
- package/dist/utils/get-view-bounds.js +0 -14
- /package/dist/base/{types.js → Base.js} +0 -0
- /package/dist/node_modules/.pnpm/{@tabler_icons-react@3.35.0_react@19.1.1 → @tabler_icons-react@3.35.0_react@19.2.0}/node_modules/@tabler/icons-react/dist/esm/createReactComponent.js +0 -0
- /package/dist/node_modules/.pnpm/{@tabler_icons-react@3.35.0_react@19.1.1 → @tabler_icons-react@3.35.0_react@19.2.0}/node_modules/@tabler/icons-react/dist/esm/defaultAttributes.js +0 -0
- /package/dist/node_modules/.pnpm/{@tabler_icons-react@3.35.0_react@19.1.1 → @tabler_icons-react@3.35.0_react@19.2.0}/node_modules/@tabler/icons-react/dist/esm/icons/IconAlertTriangle.js +0 -0
- /package/dist/node_modules/.pnpm/{@tabler_icons-react@3.35.0_react@19.1.1 → @tabler_icons-react@3.35.0_react@19.2.0}/node_modules/@tabler/icons-react/dist/esm/icons/IconArrowDownRight.js +0 -0
- /package/dist/node_modules/.pnpm/{@tabler_icons-react@3.35.0_react@19.1.1 → @tabler_icons-react@3.35.0_react@19.2.0}/node_modules/@tabler/icons-react/dist/esm/icons/IconArrowLeft.js +0 -0
- /package/dist/node_modules/.pnpm/{@tabler_icons-react@3.35.0_react@19.1.1 → @tabler_icons-react@3.35.0_react@19.2.0}/node_modules/@tabler/icons-react/dist/esm/icons/IconArrowRight.js +0 -0
- /package/dist/node_modules/.pnpm/{@tabler_icons-react@3.35.0_react@19.1.1 → @tabler_icons-react@3.35.0_react@19.2.0}/node_modules/@tabler/icons-react/dist/esm/icons/IconBolt.js +0 -0
- /package/dist/node_modules/.pnpm/{@tabler_icons-react@3.35.0_react@19.1.1 → @tabler_icons-react@3.35.0_react@19.2.0}/node_modules/@tabler/icons-react/dist/esm/icons/IconBrowser.js +0 -0
- /package/dist/node_modules/.pnpm/{@tabler_icons-react@3.35.0_react@19.1.1 → @tabler_icons-react@3.35.0_react@19.2.0}/node_modules/@tabler/icons-react/dist/esm/icons/IconCheck.js +0 -0
- /package/dist/node_modules/.pnpm/{@tabler_icons-react@3.35.0_react@19.1.1 → @tabler_icons-react@3.35.0_react@19.2.0}/node_modules/@tabler/icons-react/dist/esm/icons/IconChevronDown.js +0 -0
- /package/dist/node_modules/.pnpm/{@tabler_icons-react@3.35.0_react@19.1.1 → @tabler_icons-react@3.35.0_react@19.2.0}/node_modules/@tabler/icons-react/dist/esm/icons/IconChevronLeft.js +0 -0
- /package/dist/node_modules/.pnpm/{@tabler_icons-react@3.35.0_react@19.1.1 → @tabler_icons-react@3.35.0_react@19.2.0}/node_modules/@tabler/icons-react/dist/esm/icons/IconChevronRight.js +0 -0
- /package/dist/node_modules/.pnpm/{@tabler_icons-react@3.35.0_react@19.1.1 → @tabler_icons-react@3.35.0_react@19.2.0}/node_modules/@tabler/icons-react/dist/esm/icons/IconCopy.js +0 -0
- /package/dist/node_modules/.pnpm/{@tabler_icons-react@3.35.0_react@19.1.1 → @tabler_icons-react@3.35.0_react@19.2.0}/node_modules/@tabler/icons-react/dist/esm/icons/IconCylinder.js +0 -0
- /package/dist/node_modules/.pnpm/{@tabler_icons-react@3.35.0_react@19.1.1 → @tabler_icons-react@3.35.0_react@19.2.0}/node_modules/@tabler/icons-react/dist/esm/icons/IconDeviceMobile.js +0 -0
- /package/dist/node_modules/.pnpm/{@tabler_icons-react@3.35.0_react@19.1.1 → @tabler_icons-react@3.35.0_react@19.2.0}/node_modules/@tabler/icons-react/dist/esm/icons/IconDirectionSignFilled.js +0 -0
- /package/dist/node_modules/.pnpm/{@tabler_icons-react@3.35.0_react@19.1.1 → @tabler_icons-react@3.35.0_react@19.2.0}/node_modules/@tabler/icons-react/dist/esm/icons/IconExternalLink.js +0 -0
- /package/dist/node_modules/.pnpm/{@tabler_icons-react@3.35.0_react@19.1.1 → @tabler_icons-react@3.35.0_react@19.2.0}/node_modules/@tabler/icons-react/dist/esm/icons/IconFileSymlink.js +0 -0
- /package/dist/node_modules/.pnpm/{@tabler_icons-react@3.35.0_react@19.1.1 → @tabler_icons-react@3.35.0_react@19.2.0}/node_modules/@tabler/icons-react/dist/esm/icons/IconFocusCentered.js +0 -0
- /package/dist/node_modules/.pnpm/{@tabler_icons-react@3.35.0_react@19.1.1 → @tabler_icons-react@3.35.0_react@19.2.0}/node_modules/@tabler/icons-react/dist/esm/icons/IconFolderFilled.js +0 -0
- /package/dist/node_modules/.pnpm/{@tabler_icons-react@3.35.0_react@19.1.1 → @tabler_icons-react@3.35.0_react@19.2.0}/node_modules/@tabler/icons-react/dist/esm/icons/IconHelpCircle.js +0 -0
- /package/dist/node_modules/.pnpm/{@tabler_icons-react@3.35.0_react@19.1.1 → @tabler_icons-react@3.35.0_react@19.2.0}/node_modules/@tabler/icons-react/dist/esm/icons/IconId.js +0 -0
- /package/dist/node_modules/.pnpm/{@tabler_icons-react@3.35.0_react@19.1.1 → @tabler_icons-react@3.35.0_react@19.2.0}/node_modules/@tabler/icons-react/dist/esm/icons/IconInfoCircle.js +0 -0
- /package/dist/node_modules/.pnpm/{@tabler_icons-react@3.35.0_react@19.1.1 → @tabler_icons-react@3.35.0_react@19.2.0}/node_modules/@tabler/icons-react/dist/esm/icons/IconLayoutAlignBottom.js +0 -0
- /package/dist/node_modules/.pnpm/{@tabler_icons-react@3.35.0_react@19.1.1 → @tabler_icons-react@3.35.0_react@19.2.0}/node_modules/@tabler/icons-react/dist/esm/icons/IconLayoutAlignCenter.js +0 -0
- /package/dist/node_modules/.pnpm/{@tabler_icons-react@3.35.0_react@19.1.1 → @tabler_icons-react@3.35.0_react@19.2.0}/node_modules/@tabler/icons-react/dist/esm/icons/IconLayoutAlignLeft.js +0 -0
- /package/dist/node_modules/.pnpm/{@tabler_icons-react@3.35.0_react@19.1.1 → @tabler_icons-react@3.35.0_react@19.2.0}/node_modules/@tabler/icons-react/dist/esm/icons/IconLayoutAlignMiddle.js +0 -0
- /package/dist/node_modules/.pnpm/{@tabler_icons-react@3.35.0_react@19.1.1 → @tabler_icons-react@3.35.0_react@19.2.0}/node_modules/@tabler/icons-react/dist/esm/icons/IconLayoutAlignRight.js +0 -0
- /package/dist/node_modules/.pnpm/{@tabler_icons-react@3.35.0_react@19.1.1 → @tabler_icons-react@3.35.0_react@19.2.0}/node_modules/@tabler/icons-react/dist/esm/icons/IconLayoutAlignTop.js +0 -0
- /package/dist/node_modules/.pnpm/{@tabler_icons-react@3.35.0_react@19.1.1 → @tabler_icons-react@3.35.0_react@19.2.0}/node_modules/@tabler/icons-react/dist/esm/icons/IconLayoutBoardSplit.js +0 -0
- /package/dist/node_modules/.pnpm/{@tabler_icons-react@3.35.0_react@19.1.1 → @tabler_icons-react@3.35.0_react@19.2.0}/node_modules/@tabler/icons-react/dist/esm/icons/IconLayoutCollage.js +0 -0
- /package/dist/node_modules/.pnpm/{@tabler_icons-react@3.35.0_react@19.1.1 → @tabler_icons-react@3.35.0_react@19.2.0}/node_modules/@tabler/icons-react/dist/esm/icons/IconLayoutDashboard.js +0 -0
- /package/dist/node_modules/.pnpm/{@tabler_icons-react@3.35.0_react@19.1.1 → @tabler_icons-react@3.35.0_react@19.2.0}/node_modules/@tabler/icons-react/dist/esm/icons/IconLink.js +0 -0
- /package/dist/node_modules/.pnpm/{@tabler_icons-react@3.35.0_react@19.1.1 → @tabler_icons-react@3.35.0_react@19.2.0}/node_modules/@tabler/icons-react/dist/esm/icons/IconLock.js +0 -0
- /package/dist/node_modules/.pnpm/{@tabler_icons-react@3.35.0_react@19.1.1 → @tabler_icons-react@3.35.0_react@19.2.0}/node_modules/@tabler/icons-react/dist/esm/icons/IconLockOpen2.js +0 -0
- /package/dist/node_modules/.pnpm/{@tabler_icons-react@3.35.0_react@19.1.1 → @tabler_icons-react@3.35.0_react@19.2.0}/node_modules/@tabler/icons-react/dist/esm/icons/IconPlayerPlayFilled.js +0 -0
- /package/dist/node_modules/.pnpm/{@tabler_icons-react@3.35.0_react@19.1.1 → @tabler_icons-react@3.35.0_react@19.2.0}/node_modules/@tabler/icons-react/dist/esm/icons/IconPlayerSkipBackFilled.js +0 -0
- /package/dist/node_modules/.pnpm/{@tabler_icons-react@3.35.0_react@19.1.1 → @tabler_icons-react@3.35.0_react@19.2.0}/node_modules/@tabler/icons-react/dist/esm/icons/IconPlayerSkipForwardFilled.js +0 -0
- /package/dist/node_modules/.pnpm/{@tabler_icons-react@3.35.0_react@19.1.1 → @tabler_icons-react@3.35.0_react@19.2.0}/node_modules/@tabler/icons-react/dist/esm/icons/IconPlayerStopFilled.js +0 -0
- /package/dist/node_modules/.pnpm/{@tabler_icons-react@3.35.0_react@19.1.1 → @tabler_icons-react@3.35.0_react@19.2.0}/node_modules/@tabler/icons-react/dist/esm/icons/IconRectangularPrism.js +0 -0
- /package/dist/node_modules/.pnpm/{@tabler_icons-react@3.35.0_react@19.1.1 → @tabler_icons-react@3.35.0_react@19.2.0}/node_modules/@tabler/icons-react/dist/esm/icons/IconReorder.js +0 -0
- /package/dist/node_modules/.pnpm/{@tabler_icons-react@3.35.0_react@19.1.1 → @tabler_icons-react@3.35.0_react@19.2.0}/node_modules/@tabler/icons-react/dist/esm/icons/IconRouteOff.js +0 -0
- /package/dist/node_modules/.pnpm/{@tabler_icons-react@3.35.0_react@19.1.1 → @tabler_icons-react@3.35.0_react@19.2.0}/node_modules/@tabler/icons-react/dist/esm/icons/IconSearch.js +0 -0
- /package/dist/node_modules/.pnpm/{@tabler_icons-react@3.35.0_react@19.1.1 → @tabler_icons-react@3.35.0_react@19.2.0}/node_modules/@tabler/icons-react/dist/esm/icons/IconSelector.js +0 -0
- /package/dist/node_modules/.pnpm/{@tabler_icons-react@3.35.0_react@19.1.1 → @tabler_icons-react@3.35.0_react@19.2.0}/node_modules/@tabler/icons-react/dist/esm/icons/IconStack2.js +0 -0
- /package/dist/node_modules/.pnpm/{@tabler_icons-react@3.35.0_react@19.1.1 → @tabler_icons-react@3.35.0_react@19.2.0}/node_modules/@tabler/icons-react/dist/esm/icons/IconStarFilled.js +0 -0
- /package/dist/node_modules/.pnpm/{@tabler_icons-react@3.35.0_react@19.1.1 → @tabler_icons-react@3.35.0_react@19.2.0}/node_modules/@tabler/icons-react/dist/esm/icons/IconTarget.js +0 -0
- /package/dist/node_modules/.pnpm/{@tabler_icons-react@3.35.0_react@19.1.1 → @tabler_icons-react@3.35.0_react@19.2.0}/node_modules/@tabler/icons-react/dist/esm/icons/IconTransform.js +0 -0
- /package/dist/node_modules/.pnpm/{@tabler_icons-react@3.35.0_react@19.1.1 → @tabler_icons-react@3.35.0_react@19.2.0}/node_modules/@tabler/icons-react/dist/esm/icons/IconUser.js +0 -0
- /package/dist/node_modules/.pnpm/{@tabler_icons-react@3.35.0_react@19.1.1 → @tabler_icons-react@3.35.0_react@19.2.0}/node_modules/@tabler/icons-react/dist/esm/icons/IconX.js +0 -0
- /package/dist/node_modules/.pnpm/{@tabler_icons-react@3.35.0_react@19.1.1 → @tabler_icons-react@3.35.0_react@19.2.0}/node_modules/@tabler/icons-react/dist/esm/icons/IconZoomScan.js +0 -0
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { fromCallback } from 'xstate';
|
|
2
|
+
|
|
3
|
+
const mediaPrintActorLogic = fromCallback(({ sendBack }) => {
|
|
4
|
+
const beforePrint = () => {
|
|
5
|
+
sendBack({ type: "media.print.on" });
|
|
6
|
+
};
|
|
7
|
+
const afterPrint = () => {
|
|
8
|
+
sendBack({ type: "media.print.off" });
|
|
9
|
+
};
|
|
10
|
+
window.addEventListener("beforeprint", beforePrint);
|
|
11
|
+
window.addEventListener("afterprint", afterPrint);
|
|
12
|
+
return () => {
|
|
13
|
+
window.removeEventListener("beforeprint", beforePrint);
|
|
14
|
+
window.removeEventListener("afterprint", afterPrint);
|
|
15
|
+
};
|
|
16
|
+
});
|
|
17
|
+
|
|
18
|
+
export { mediaPrintActorLogic };
|
|
@@ -1,123 +1,46 @@
|
|
|
1
|
-
import { ViewChange, ViewId } from '@likec4/core/types';
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
1
|
+
import { LayoutedView, ViewChange, ViewId } from '@likec4/core/types';
|
|
2
|
+
import { ActorRef, MachineSnapshot, StateMachine } from 'xstate';
|
|
3
|
+
import { Types } from '../types';
|
|
4
4
|
export type Input = {
|
|
5
|
-
/**
|
|
6
|
-
* Actually this is DiagramActorRef
|
|
7
|
-
* But we can't use it here due to circular type inference
|
|
8
|
-
*/
|
|
9
|
-
parent: ActorRef<MachineSnapshot<DiagramContext, DiagramEvents, any, any, any, any, any, any>, DiagramEvents, any>;
|
|
10
5
|
viewId: ViewId;
|
|
11
6
|
};
|
|
12
|
-
|
|
7
|
+
type HistorySnapshot = {
|
|
8
|
+
view: LayoutedView;
|
|
9
|
+
change: ViewChange.SaveViewSnapshot;
|
|
10
|
+
xynodes: Types.Node[];
|
|
11
|
+
xyedges: Types.Edge[];
|
|
12
|
+
synched: boolean;
|
|
13
|
+
};
|
|
14
|
+
export type Context = Readonly<Input & {
|
|
15
|
+
history: ReadonlyArray<HistorySnapshot>;
|
|
16
|
+
beforeEditing: HistorySnapshot | null;
|
|
17
|
+
editing: 'node' | 'edge' | null;
|
|
18
|
+
}>;
|
|
13
19
|
export type Events = {
|
|
14
20
|
type: 'sync';
|
|
15
21
|
} | {
|
|
16
22
|
type: 'synced';
|
|
23
|
+
} | {
|
|
24
|
+
type: 'editing.start';
|
|
25
|
+
subject: 'node' | 'edge';
|
|
26
|
+
} | {
|
|
27
|
+
type: 'editing.stop';
|
|
28
|
+
wasChanged?: boolean;
|
|
17
29
|
} | {
|
|
18
30
|
type: 'cancel';
|
|
31
|
+
} | {
|
|
32
|
+
type: 'undo';
|
|
19
33
|
} | {
|
|
20
34
|
type: 'stop';
|
|
21
35
|
};
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
}, "timeout", "stopped" | "synced" | "pending" | "idle" | "paused", "pending" | "ready", Input, NonReducibleUnknown, EventObject, MetaObject, {
|
|
31
|
-
readonly initial: "idle";
|
|
32
|
-
readonly context: ({ input }: {
|
|
33
|
-
spawn: {
|
|
34
|
-
<TSrc extends never>(logic: TSrc, ...[options]: never): ActorRefFromLogic<never>;
|
|
35
|
-
<TLogic extends AnyActorLogic>(src: TLogic, ...[options]: ConditionalRequired<[options?: {
|
|
36
|
-
id?: never;
|
|
37
|
-
systemId?: string;
|
|
38
|
-
input?: InputFrom<TLogic>;
|
|
39
|
-
syncSnapshot?: boolean;
|
|
40
|
-
} & { [K in RequiredLogicInput<TLogic>]: unknown; }], IsNotNever<RequiredLogicInput<TLogic>>>): ActorRefFromLogic<TLogic>;
|
|
41
|
-
};
|
|
42
|
-
input: Input;
|
|
43
|
-
self: ActorRef<MachineSnapshot<Readonly<Input>, Events, Record<string, AnyActorRef | undefined>, StateValue, string, unknown, any, any>, Events, AnyEventObject>;
|
|
44
|
-
}) => {
|
|
45
|
-
/**
|
|
46
|
-
* Actually this is DiagramActorRef
|
|
47
|
-
* But we can't use it here due to circular type inference
|
|
48
|
-
*/
|
|
49
|
-
parent: ActorRef<MachineSnapshot<DiagramContext, DiagramEvents, any, any, any, any, any, any>, DiagramEvents, any>;
|
|
50
|
-
viewId: ViewId;
|
|
51
|
-
};
|
|
52
|
-
readonly states: {
|
|
53
|
-
readonly idle: {
|
|
54
|
-
readonly tags: "ready";
|
|
55
|
-
readonly on: {
|
|
56
|
-
readonly sync: {
|
|
57
|
-
readonly target: "pending";
|
|
58
|
-
};
|
|
59
|
-
};
|
|
60
|
-
};
|
|
61
|
-
readonly paused: {
|
|
62
|
-
readonly tags: "pending";
|
|
63
|
-
readonly on: {
|
|
64
|
-
readonly sync: {
|
|
65
|
-
readonly target: "pending";
|
|
66
|
-
};
|
|
67
|
-
};
|
|
68
|
-
};
|
|
69
|
-
readonly pending: {
|
|
70
|
-
readonly tags: "pending";
|
|
71
|
-
readonly on: {
|
|
72
|
-
readonly sync: {
|
|
73
|
-
readonly target: "pending";
|
|
74
|
-
readonly reenter: true;
|
|
75
|
-
};
|
|
76
|
-
readonly cancel: {
|
|
77
|
-
readonly target: "paused";
|
|
78
|
-
};
|
|
79
|
-
};
|
|
80
|
-
readonly after: {
|
|
81
|
-
readonly timeout: readonly [{
|
|
82
|
-
readonly guard: "same view";
|
|
83
|
-
readonly actions: {
|
|
84
|
-
readonly type: "trigger:OnChange";
|
|
85
|
-
readonly params: ({ context }: {
|
|
86
|
-
context: Readonly<Input>;
|
|
87
|
-
event: Events;
|
|
88
|
-
}) => {
|
|
89
|
-
change: ViewChange.SaveManualLayout;
|
|
90
|
-
};
|
|
91
|
-
};
|
|
92
|
-
readonly target: "synced";
|
|
93
|
-
}, {
|
|
94
|
-
readonly target: "stopped";
|
|
95
|
-
}];
|
|
96
|
-
};
|
|
97
|
-
};
|
|
98
|
-
readonly synced: {
|
|
99
|
-
readonly tags: "ready";
|
|
100
|
-
readonly on: {
|
|
101
|
-
readonly sync: {
|
|
102
|
-
readonly target: "pending";
|
|
103
|
-
};
|
|
104
|
-
};
|
|
105
|
-
};
|
|
106
|
-
readonly stopped: {
|
|
107
|
-
readonly entry: ActionFunction<Readonly<Input>, Events, Events, undefined, never, never, never, never, never>;
|
|
108
|
-
readonly type: "final";
|
|
109
|
-
};
|
|
110
|
-
};
|
|
111
|
-
readonly on: {
|
|
112
|
-
readonly synced: {
|
|
113
|
-
readonly target: ".synced";
|
|
114
|
-
};
|
|
115
|
-
readonly stop: {
|
|
116
|
-
readonly target: ".stopped";
|
|
117
|
-
};
|
|
118
|
-
};
|
|
119
|
-
}>;
|
|
120
|
-
export interface SyncLayoutActorLogic extends ActorLogicFrom<typeof _syncManualLayoutActorLogic> {
|
|
36
|
+
type Tags = 'pending' | 'ready';
|
|
37
|
+
/**
|
|
38
|
+
* Here is a trick to reduce inference types
|
|
39
|
+
*/
|
|
40
|
+
export interface SyncLayoutActorLogic extends StateMachine<Context, Events, {}, any, any, any, any, any, Tags, Input, any, any, any, any> {
|
|
41
|
+
}
|
|
42
|
+
export type SyncLayoutActorSnapshot = MachineSnapshot<Context, Events, {}, never, Tags, never, {}, {}>;
|
|
43
|
+
export interface SyncLayoutActorRef extends ActorRef<SyncLayoutActorSnapshot, Events> {
|
|
121
44
|
}
|
|
122
45
|
export declare const syncManualLayoutActorLogic: SyncLayoutActorLogic;
|
|
123
46
|
export {};
|
|
@@ -1,92 +1,303 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import { setup, assign } from 'xstate';
|
|
4
|
-
import {
|
|
1
|
+
import { getHotkeyHandler } from '@mantine/hooks';
|
|
2
|
+
import { last, omit } from 'remeda';
|
|
3
|
+
import { setup, assign, stopChild, fromCallback, assertEvent } from 'xstate';
|
|
4
|
+
import { createViewChange } from './createViewChange.js';
|
|
5
5
|
|
|
6
|
-
const
|
|
6
|
+
const undoHotKeyActorLogic = fromCallback(({ sendBack }) => {
|
|
7
|
+
const ctrlZHandler = getHotkeyHandler([
|
|
8
|
+
["mod + z", (event) => {
|
|
9
|
+
event.stopPropagation();
|
|
10
|
+
sendBack({ type: "undo" });
|
|
11
|
+
}, {
|
|
12
|
+
preventDefault: true
|
|
13
|
+
}]
|
|
14
|
+
]);
|
|
15
|
+
document.body.addEventListener("keydown", ctrlZHandler, { capture: true });
|
|
16
|
+
return () => {
|
|
17
|
+
document.body.removeEventListener("keydown", ctrlZHandler, { capture: true });
|
|
18
|
+
};
|
|
19
|
+
});
|
|
20
|
+
const diagramActorRef = function(system) {
|
|
21
|
+
return system.get("diagram");
|
|
22
|
+
};
|
|
23
|
+
const syncManualLayout = setup({
|
|
7
24
|
types: {
|
|
8
25
|
context: {},
|
|
9
26
|
input: {},
|
|
10
27
|
events: {},
|
|
11
|
-
tags: ""
|
|
28
|
+
tags: "",
|
|
29
|
+
children: {}
|
|
12
30
|
},
|
|
13
31
|
delays: {
|
|
14
32
|
"timeout": 2e3
|
|
15
33
|
},
|
|
16
|
-
actions: {
|
|
17
|
-
"trigger:OnChange": (_, _params) => {
|
|
18
|
-
}
|
|
19
|
-
},
|
|
20
34
|
guards: {
|
|
21
|
-
"
|
|
35
|
+
"can undo": ({ context }) => context.history.length > 0
|
|
36
|
+
},
|
|
37
|
+
actors: {
|
|
38
|
+
undoHotKeyActorLogic
|
|
22
39
|
}
|
|
23
|
-
})
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
40
|
+
});
|
|
41
|
+
const raiseSync = syncManualLayout.raise({ type: "sync" }, { delay: 300, id: "sync" });
|
|
42
|
+
const cancelSync = syncManualLayout.cancel("sync");
|
|
43
|
+
const startEditing = syncManualLayout.enqueueActions(({ check, enqueue, system, event, self, context }) => {
|
|
44
|
+
assertEvent(event, "editing.start");
|
|
45
|
+
const parentContext = diagramActorRef(system).getSnapshot().context;
|
|
46
|
+
enqueue.assign({
|
|
47
|
+
editing: event.subject,
|
|
48
|
+
beforeEditing: {
|
|
49
|
+
xynodes: parentContext.xynodes.map(
|
|
50
|
+
({ measured, style, ...n }) => ({
|
|
51
|
+
...omit(n, ["selected", "dragging", "resizing"]),
|
|
52
|
+
data: omit(n.data, ["dimmed", "hovered"]),
|
|
53
|
+
initialWidth: measured?.width ?? n.width ?? n.initialWidth,
|
|
54
|
+
initialHeight: measured?.height ?? n.height ?? n.initialHeight
|
|
55
|
+
})
|
|
56
|
+
),
|
|
57
|
+
xyedges: parentContext.xyedges.map(
|
|
58
|
+
(e) => ({
|
|
59
|
+
...omit(e, ["selected"]),
|
|
60
|
+
data: omit(e.data, ["active", "dimmed", "hovered"])
|
|
61
|
+
})
|
|
62
|
+
),
|
|
63
|
+
change: createViewChange(parentContext),
|
|
64
|
+
view: parentContext.view,
|
|
65
|
+
synched: false
|
|
66
|
+
}
|
|
67
|
+
});
|
|
68
|
+
});
|
|
69
|
+
const ensureHotKey = syncManualLayout.enqueueActions(({ check, context, enqueue, self }) => {
|
|
70
|
+
const hasUndo = context.history.length > 0;
|
|
71
|
+
const undoHotKey = self.getSnapshot().children["undoHotKey"];
|
|
72
|
+
if (undoHotKey && !hasUndo) {
|
|
73
|
+
enqueue.stopChild(undoHotKey);
|
|
74
|
+
return;
|
|
75
|
+
}
|
|
76
|
+
if (!undoHotKey && hasUndo) {
|
|
77
|
+
enqueue.spawnChild("undoHotKeyActorLogic", {
|
|
78
|
+
id: "undoHotKey"
|
|
79
|
+
});
|
|
80
|
+
}
|
|
81
|
+
});
|
|
82
|
+
const pushHistory = syncManualLayout.assign(({ context }) => {
|
|
83
|
+
const snapshot = context.beforeEditing;
|
|
84
|
+
if (!snapshot) {
|
|
85
|
+
return {
|
|
86
|
+
editing: null
|
|
87
|
+
};
|
|
88
|
+
}
|
|
89
|
+
return {
|
|
90
|
+
beforeEditing: null,
|
|
91
|
+
editing: null,
|
|
92
|
+
history: [
|
|
93
|
+
...context.history,
|
|
94
|
+
snapshot
|
|
95
|
+
]
|
|
96
|
+
};
|
|
97
|
+
});
|
|
98
|
+
const stopEditing = syncManualLayout.enqueueActions(({ event, enqueue }) => {
|
|
99
|
+
assertEvent(event, ["editing.stop", "cancel", "undo"]);
|
|
100
|
+
if (event.type === "editing.stop" && event.wasChanged) {
|
|
101
|
+
enqueue(pushHistory);
|
|
102
|
+
enqueue(ensureHotKey);
|
|
103
|
+
enqueue(raiseSync);
|
|
104
|
+
return;
|
|
105
|
+
}
|
|
106
|
+
enqueue.assign({
|
|
107
|
+
beforeEditing: null,
|
|
108
|
+
editing: null
|
|
109
|
+
});
|
|
110
|
+
});
|
|
111
|
+
const markHistoryAsSynched = syncManualLayout.assign(({ context, event }) => {
|
|
112
|
+
assertEvent(event, "synced");
|
|
113
|
+
return {
|
|
114
|
+
history: context.history.map((i) => ({
|
|
115
|
+
...i,
|
|
116
|
+
synched: true
|
|
117
|
+
}))
|
|
118
|
+
};
|
|
119
|
+
});
|
|
120
|
+
const popHistory = syncManualLayout.assign(({ context }) => {
|
|
121
|
+
if (context.history.length === 0 || context.history.length === 1) {
|
|
122
|
+
return {
|
|
123
|
+
history: []
|
|
124
|
+
};
|
|
125
|
+
}
|
|
126
|
+
return {
|
|
127
|
+
history: context.history.slice(0, context.history.length - 1)
|
|
128
|
+
};
|
|
129
|
+
});
|
|
130
|
+
const undo = syncManualLayout.enqueueActions(({ context, enqueue, system }) => {
|
|
131
|
+
enqueue(cancelSync);
|
|
132
|
+
const lastHistoryItem = last(context.history);
|
|
133
|
+
if (!lastHistoryItem) {
|
|
134
|
+
return;
|
|
135
|
+
}
|
|
136
|
+
enqueue(popHistory);
|
|
137
|
+
enqueue(ensureHotKey);
|
|
138
|
+
const diagramActor = diagramActorRef(system);
|
|
139
|
+
enqueue.sendTo(diagramActor, {
|
|
140
|
+
type: "update.view",
|
|
141
|
+
view: lastHistoryItem.view,
|
|
142
|
+
xyedges: lastHistoryItem.xyedges,
|
|
143
|
+
xynodes: lastHistoryItem.xynodes,
|
|
144
|
+
source: "internal"
|
|
145
|
+
});
|
|
146
|
+
if (lastHistoryItem.synched) {
|
|
147
|
+
enqueue.sendTo(
|
|
148
|
+
diagramActor,
|
|
149
|
+
{
|
|
150
|
+
type: "emit.onChange",
|
|
151
|
+
change: lastHistoryItem.change
|
|
35
152
|
}
|
|
153
|
+
);
|
|
154
|
+
} else {
|
|
155
|
+
enqueue(raiseSync);
|
|
156
|
+
}
|
|
157
|
+
});
|
|
158
|
+
const emitOnChange = syncManualLayout.enqueueActions(({ context, enqueue, system }) => {
|
|
159
|
+
enqueue(cancelSync);
|
|
160
|
+
const diagramActor = diagramActorRef(system);
|
|
161
|
+
const parentContext = diagramActor.getSnapshot().context;
|
|
162
|
+
const change = createViewChange(parentContext);
|
|
163
|
+
enqueue.sendTo(diagramActor, {
|
|
164
|
+
type: "update.view-bounds",
|
|
165
|
+
bounds: change.layout.bounds
|
|
166
|
+
});
|
|
167
|
+
enqueue.sendTo(diagramActor, {
|
|
168
|
+
type: "emit.onChange",
|
|
169
|
+
change
|
|
170
|
+
});
|
|
171
|
+
});
|
|
172
|
+
const idle = syncManualLayout.createStateConfig({
|
|
173
|
+
tags: "ready",
|
|
174
|
+
on: {
|
|
175
|
+
sync: {
|
|
176
|
+
target: "pending"
|
|
36
177
|
},
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
178
|
+
"editing.start": {
|
|
179
|
+
actions: startEditing,
|
|
180
|
+
target: "editing"
|
|
181
|
+
}
|
|
182
|
+
}
|
|
183
|
+
});
|
|
184
|
+
const editing = syncManualLayout.createStateConfig({
|
|
185
|
+
entry: [
|
|
186
|
+
cancelSync
|
|
187
|
+
],
|
|
188
|
+
on: {
|
|
189
|
+
cancel: {
|
|
190
|
+
actions: stopEditing,
|
|
191
|
+
target: "idle"
|
|
44
192
|
},
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
cancel: {
|
|
53
|
-
target: "paused"
|
|
54
|
-
}
|
|
55
|
-
},
|
|
56
|
-
after: {
|
|
57
|
-
"timeout": [{
|
|
58
|
-
guard: "same view",
|
|
59
|
-
actions: {
|
|
60
|
-
type: "trigger:OnChange",
|
|
61
|
-
params: ({ context }) => {
|
|
62
|
-
const change = createViewChange(context.parent.getSnapshot().context);
|
|
63
|
-
return { change };
|
|
64
|
-
}
|
|
65
|
-
},
|
|
66
|
-
target: "synced"
|
|
67
|
-
}, {
|
|
68
|
-
target: "stopped"
|
|
69
|
-
}]
|
|
70
|
-
}
|
|
193
|
+
"editing.stop": {
|
|
194
|
+
actions: stopEditing,
|
|
195
|
+
target: "idle"
|
|
196
|
+
},
|
|
197
|
+
undo: {
|
|
198
|
+
actions: stopEditing,
|
|
199
|
+
target: "idle"
|
|
71
200
|
},
|
|
72
201
|
synced: {
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
202
|
+
actions: [
|
|
203
|
+
markHistoryAsSynched
|
|
204
|
+
]
|
|
205
|
+
}
|
|
206
|
+
}
|
|
207
|
+
});
|
|
208
|
+
const pending = syncManualLayout.createStateConfig({
|
|
209
|
+
tags: "pending",
|
|
210
|
+
on: {
|
|
211
|
+
cancel: {
|
|
212
|
+
actions: cancelSync,
|
|
213
|
+
target: "idle"
|
|
214
|
+
},
|
|
215
|
+
sync: {
|
|
216
|
+
target: "pending",
|
|
217
|
+
reenter: true
|
|
218
|
+
},
|
|
219
|
+
"editing.start": {
|
|
220
|
+
target: "paused",
|
|
221
|
+
actions: startEditing
|
|
222
|
+
}
|
|
223
|
+
},
|
|
224
|
+
after: {
|
|
225
|
+
"timeout": {
|
|
226
|
+
target: "idle",
|
|
227
|
+
actions: emitOnChange
|
|
228
|
+
}
|
|
229
|
+
}
|
|
230
|
+
});
|
|
231
|
+
const paused = syncManualLayout.createStateConfig({
|
|
232
|
+
tags: "pending",
|
|
233
|
+
entry: [
|
|
234
|
+
cancelSync
|
|
235
|
+
],
|
|
236
|
+
on: {
|
|
237
|
+
cancel: {
|
|
238
|
+
actions: stopEditing,
|
|
239
|
+
target: "idle"
|
|
240
|
+
},
|
|
241
|
+
"editing.stop": {
|
|
242
|
+
actions: stopEditing,
|
|
243
|
+
target: "pending"
|
|
244
|
+
},
|
|
245
|
+
undo: {
|
|
246
|
+
actions: stopEditing,
|
|
247
|
+
target: "idle"
|
|
79
248
|
},
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
249
|
+
// When external sync is done while editing, we just mark history as synced
|
|
250
|
+
// but go to editing state (that does not return to pending)
|
|
251
|
+
synced: {
|
|
252
|
+
actions: [
|
|
253
|
+
markHistoryAsSynched
|
|
254
|
+
],
|
|
255
|
+
target: "editing"
|
|
256
|
+
}
|
|
257
|
+
}
|
|
258
|
+
});
|
|
259
|
+
const _syncManualLayoutActorLogic = syncManualLayout.createMachine({
|
|
260
|
+
initial: "idle",
|
|
261
|
+
context: ({ input }) => ({
|
|
262
|
+
...input,
|
|
263
|
+
history: [],
|
|
264
|
+
beforeEditing: null,
|
|
265
|
+
editing: null
|
|
266
|
+
}),
|
|
267
|
+
states: {
|
|
268
|
+
idle,
|
|
269
|
+
editing,
|
|
270
|
+
pending,
|
|
271
|
+
paused,
|
|
272
|
+
stopped: {
|
|
273
|
+
entry: [
|
|
274
|
+
assign({
|
|
275
|
+
beforeEditing: null,
|
|
276
|
+
history: []
|
|
277
|
+
}),
|
|
278
|
+
stopChild("undoHotKey")
|
|
279
|
+
],
|
|
84
280
|
type: "final"
|
|
85
281
|
}
|
|
86
282
|
},
|
|
87
283
|
on: {
|
|
284
|
+
cancel: {
|
|
285
|
+
actions: [
|
|
286
|
+
cancelSync
|
|
287
|
+
],
|
|
288
|
+
target: ".idle"
|
|
289
|
+
},
|
|
88
290
|
synced: {
|
|
89
|
-
|
|
291
|
+
actions: [
|
|
292
|
+
markHistoryAsSynched,
|
|
293
|
+
cancelSync
|
|
294
|
+
],
|
|
295
|
+
target: ".idle"
|
|
296
|
+
},
|
|
297
|
+
undo: {
|
|
298
|
+
guard: "can undo",
|
|
299
|
+
actions: undo,
|
|
300
|
+
target: ".idle"
|
|
90
301
|
},
|
|
91
302
|
stop: {
|
|
92
303
|
target: ".stopped"
|
|
@@ -94,80 +305,5 @@ const _syncManualLayoutActorLogic = setup({
|
|
|
94
305
|
}
|
|
95
306
|
});
|
|
96
307
|
const syncManualLayoutActorLogic = _syncManualLayoutActorLogic;
|
|
97
|
-
function createViewChange(parentContext) {
|
|
98
|
-
const { view, xystore, xyflow } = parentContext;
|
|
99
|
-
const { nodeLookup } = xystore.getState();
|
|
100
|
-
const movedNodes = /* @__PURE__ */ new Set();
|
|
101
|
-
let bounds;
|
|
102
|
-
const nodes = reduce([...nodeLookup.values()], (acc, node) => {
|
|
103
|
-
const dimensions = getNodeDimensions(node);
|
|
104
|
-
if (!isSamePoint(node.internals.positionAbsolute, node.data) || node.initialWidth !== dimensions.width || node.initialHeight !== dimensions.height) {
|
|
105
|
-
movedNodes.add(node.id);
|
|
106
|
-
}
|
|
107
|
-
const rect = acc[node.id] = {
|
|
108
|
-
isCompound: node.type !== "element" && node.type !== "deployment",
|
|
109
|
-
x: Math.floor(node.internals.positionAbsolute.x),
|
|
110
|
-
y: Math.floor(node.internals.positionAbsolute.y),
|
|
111
|
-
width: Math.ceil(dimensions.width),
|
|
112
|
-
height: Math.ceil(dimensions.height)
|
|
113
|
-
};
|
|
114
|
-
bounds = bounds ? getBoundsOfRects(bounds, rect) : rect;
|
|
115
|
-
return acc;
|
|
116
|
-
}, {});
|
|
117
|
-
const edges = reduce(xyflow?.getEdges() ?? [], (acc, { source, target, data }) => {
|
|
118
|
-
let controlPoints = data.controlPoints ?? [];
|
|
119
|
-
const sourceOrTargetMoved = movedNodes.has(source) || movedNodes.has(target);
|
|
120
|
-
if (controlPoints.length === 0 && sourceOrTargetMoved) {
|
|
121
|
-
controlPoints = bezierControlPoints(data);
|
|
122
|
-
}
|
|
123
|
-
if (data.points.length === 0 && controlPoints.length === 0) {
|
|
124
|
-
return acc;
|
|
125
|
-
}
|
|
126
|
-
const _updated = acc[data.id] = {
|
|
127
|
-
points: data.points
|
|
128
|
-
};
|
|
129
|
-
if (data.labelXY && data.labelBBox) {
|
|
130
|
-
_updated.labelBBox = {
|
|
131
|
-
...data.labelBBox,
|
|
132
|
-
...data.labelXY
|
|
133
|
-
};
|
|
134
|
-
}
|
|
135
|
-
if (data.labelBBox) {
|
|
136
|
-
_updated.labelBBox ??= data.labelBBox;
|
|
137
|
-
}
|
|
138
|
-
if (hasAtLeast(controlPoints, 1)) {
|
|
139
|
-
_updated.controlPoints = controlPoints;
|
|
140
|
-
}
|
|
141
|
-
const allX = [
|
|
142
|
-
...data.points.map((p) => p[0]),
|
|
143
|
-
...controlPoints.map((p) => p.x),
|
|
144
|
-
..._updated.labelBBox ? [_updated.labelBBox.x, _updated.labelBBox.x + _updated.labelBBox.width] : []
|
|
145
|
-
];
|
|
146
|
-
const allY = [
|
|
147
|
-
...data.points.map((p) => p[1]),
|
|
148
|
-
...controlPoints.map((p) => p.y),
|
|
149
|
-
..._updated.labelBBox ? [_updated.labelBBox.y, _updated.labelBBox.y + _updated.labelBBox.height] : []
|
|
150
|
-
];
|
|
151
|
-
const rect = boxToRect({
|
|
152
|
-
x: Math.floor(Math.min(...allX)),
|
|
153
|
-
y: Math.floor(Math.min(...allY)),
|
|
154
|
-
x2: Math.ceil(Math.max(...allX)),
|
|
155
|
-
y2: Math.ceil(Math.max(...allY))
|
|
156
|
-
});
|
|
157
|
-
bounds = bounds ? getBoundsOfRects(bounds, rect) : rect;
|
|
158
|
-
return acc;
|
|
159
|
-
}, {});
|
|
160
|
-
bounds ??= view.bounds;
|
|
161
|
-
return {
|
|
162
|
-
op: "save-manual-layout",
|
|
163
|
-
layout: {
|
|
164
|
-
hash: view.hash,
|
|
165
|
-
autoLayout: view.autoLayout,
|
|
166
|
-
nodes,
|
|
167
|
-
edges,
|
|
168
|
-
...bounds
|
|
169
|
-
}
|
|
170
|
-
};
|
|
171
|
-
}
|
|
172
308
|
|
|
173
309
|
export { syncManualLayoutActorLogic };
|
|
@@ -1,22 +1,17 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { ActorSystem } from 'xstate';
|
|
2
2
|
import { OverlaysActorRef } from '../../overlays/overlaysActor';
|
|
3
3
|
import { SearchActorRef } from '../../search/searchActor';
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
4
|
+
import { DiagramMachineRef } from './machine';
|
|
5
|
+
import { SyncLayoutActorRef } from './syncManualLayoutActor';
|
|
6
6
|
export type System = ActorSystem<{
|
|
7
7
|
actors: {
|
|
8
|
-
diagram:
|
|
8
|
+
diagram: DiagramMachineRef;
|
|
9
9
|
overlays: OverlaysActorRef;
|
|
10
10
|
search: SearchActorRef;
|
|
11
|
+
syncLayout: SyncLayoutActorRef;
|
|
11
12
|
};
|
|
12
13
|
}>;
|
|
13
|
-
export interface DiagramActorRef extends
|
|
14
|
+
export interface DiagramActorRef extends DiagramMachineRef {
|
|
14
15
|
system: System;
|
|
15
16
|
}
|
|
16
|
-
export type DiagramActorSnapshot
|
|
17
|
-
export type DiagramActorEvent = EventFromLogic<DiagramMachineLogic>;
|
|
18
|
-
export type { Context as DiagramContext, EmittedEvents as DiagramEmittedEvents, } from './diagram-machine';
|
|
19
|
-
export type SyncLayoutActorRef = Omit<ActorRefFromLogic<SyncLayoutActorLogic>, 'system'> & {
|
|
20
|
-
system: System;
|
|
21
|
-
};
|
|
22
|
-
export type SyncLayoutActorSnapshot = SnapshotFrom<SyncLayoutActorLogic>;
|
|
17
|
+
export type { DiagramContext, DiagramEmittedEvents, DiagramEvents, DiagramMachineSnapshot as DiagramActorSnapshot, } from './machine';
|
|
@@ -1,12 +1,17 @@
|
|
|
1
|
-
import { DiagramEdge, DiagramNode, BBox } from '@likec4/core/types';
|
|
1
|
+
import { DiagramEdge, DiagramNode, DiagramView, BBox } from '@likec4/core/types';
|
|
2
|
+
import { Viewport } from '@xyflow/system';
|
|
2
3
|
import { ActorSystem } from 'xstate';
|
|
3
4
|
import { OverlaysActorRef } from '../../overlays/overlaysActor';
|
|
4
5
|
import { SearchActorRef } from '../../search/searchActor';
|
|
5
|
-
import {
|
|
6
|
+
import { Types } from '../types';
|
|
7
|
+
import { Context } from './machine.setup';
|
|
8
|
+
import { SyncLayoutActorRef } from './syncManualLayoutActor';
|
|
6
9
|
import { DiagramActorRef } from './types';
|
|
10
|
+
import { Fqn, DeploymentFqn } from '@likec4/core';
|
|
7
11
|
export declare function typedSystem(system: ActorSystem<any>): {
|
|
12
|
+
readonly syncLayoutActorRef: SyncLayoutActorRef | null;
|
|
8
13
|
readonly overlaysActorRef: OverlaysActorRef | null;
|
|
9
|
-
readonly diagramActorRef: DiagramActorRef
|
|
14
|
+
readonly diagramActorRef: DiagramActorRef;
|
|
10
15
|
readonly searchActorRef: SearchActorRef | null;
|
|
11
16
|
};
|
|
12
17
|
export declare function findDiagramNode(ctx: Context, xynodeId: string): DiagramNode | null;
|
|
@@ -21,5 +26,15 @@ export declare function activeSequenceBounds(params: {
|
|
|
21
26
|
context: Context;
|
|
22
27
|
}): {
|
|
23
28
|
bounds: BBox;
|
|
24
|
-
duration
|
|
29
|
+
duration: number;
|
|
30
|
+
};
|
|
31
|
+
export declare function nodeRef(node: Types.Node): Fqn | DeploymentFqn | null;
|
|
32
|
+
export declare function findCorrespondingNode(context: Pick<Context, 'lastOnNavigate' | 'xynodes'>, event: {
|
|
33
|
+
view: DiagramView;
|
|
34
|
+
xynodes: Types.Node[];
|
|
35
|
+
}): {
|
|
36
|
+
fromNode: Types.Node<"element" | "deployment" | "compound-element" | "compound-deployment" | "view-group" | "seq-actor" | "seq-parallel"> | null | undefined;
|
|
37
|
+
toNode: Types.Node<"element" | "deployment" | "compound-element" | "compound-deployment" | "view-group" | "seq-actor" | "seq-parallel"> | null | undefined;
|
|
25
38
|
};
|
|
39
|
+
export declare function calcViewportForBounds(context: Pick<Context, 'xystore' | 'xyflow' | 'fitViewPadding'>, bounds: BBox): Viewport;
|
|
40
|
+
export declare function parseAsNumber(value: string | number | undefined): number;
|