@likec4/diagram 1.44.0 → 1.46.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 +18847 -17876
- package/dist/LikeC4Diagram.d.ts +1 -1
- package/dist/LikeC4Diagram.js +15 -12
- package/dist/LikeC4Diagram.props.d.ts +13 -20
- package/dist/LikeC4ProjectsProvider.js +8 -4
- package/dist/LikeC4Styles.js +0 -3
- package/dist/LikeC4View.d.ts +3 -3
- package/dist/LikeC4View.js +8 -8
- package/dist/ReactLikeC4.d.ts +3 -6
- package/dist/StaticLikeC4Diagram.js +0 -2
- package/dist/base/Base.d.ts +1 -1
- package/dist/base/updateEdges.js +25 -15
- package/dist/base/updateNodes.d.ts +14 -0
- package/dist/base/updateNodes.js +51 -18
- package/dist/base-primitives/Markdown.d.ts +30 -4
- package/dist/base-primitives/Markdown.js +3 -2
- package/dist/base-primitives/NodeHandles.d.ts +2 -1
- package/dist/base-primitives/NodeHandles.js +22 -18
- 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 +6 -4
- package/dist/base-primitives/edge/EdgeLabel.d.ts +2 -2
- package/dist/base-primitives/edge/EdgeLabel.js +16 -16
- package/dist/base-primitives/edge/EdgeLabelContainer.d.ts +1 -1
- package/dist/base-primitives/edge/EdgeLabelContainer.js +5 -4
- package/dist/base-primitives/edge/EdgePath.js +27 -12
- package/dist/base-primitives/element/ElementActionButtons.d.ts +3 -2
- 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 +4 -1
- package/dist/base-primitives/element/ElementShape.js +5 -5
- package/dist/base-primitives/element/ElementTags.d.ts +6 -4
- package/dist/components/ErrorFallback.js +1 -1
- package/dist/components/Link.js +2 -2
- package/dist/context/DiagramEventHandlers.js +0 -1
- package/dist/context/DiagramFeatures.d.ts +2 -1
- package/dist/context/DiagramFeatures.js +1 -0
- package/dist/context/EnsureMantine.js +2 -1
- package/dist/context/IconRenderer.js +6 -6
- package/dist/context/TagStylesContext.js +1 -1
- package/dist/custom/hooks.d.ts +2 -2
- package/dist/custom/index.js +1 -1
- package/dist/editor/LikeC4EditorProvider.d.ts +22 -0
- package/dist/editor/LikeC4EditorProvider.js +12 -0
- package/dist/editor/__tests__/fixture.d.ts +205 -0
- package/dist/editor/applyChangesToManualLayout.d.ts +8 -0
- package/dist/editor/applyChangesToManualLayout.js +182 -0
- package/dist/editor/editorActor.actions.d.ts +201 -0
- package/dist/editor/editorActor.actions.js +149 -0
- package/dist/editor/editorActor.d.ts +653 -0
- package/dist/editor/editorActor.js +324 -0
- package/dist/editor/hotkeyActor.d.ts +7 -0
- package/dist/editor/hotkeyActor.js +19 -0
- package/dist/editor/index.d.ts +3 -2
- package/dist/editor/useEditorActorLogic.d.ts +565 -0
- package/dist/editor/useEditorActorLogic.js +54 -0
- package/dist/hooks/index.d.ts +2 -1
- package/dist/hooks/safeContext.d.ts +3 -2
- package/dist/hooks/safeContext.js +7 -4
- package/dist/hooks/useDiagram.d.ts +4 -2
- package/dist/hooks/useDiagram.js +19 -8
- package/dist/hooks/useDiagramCompareLayout.d.ts +8 -0
- package/dist/hooks/useDiagramCompareLayout.js +29 -4
- 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/index.d.ts +1 -0
- package/dist/index.js +1 -0
- package/dist/likec4diagram/DiagramXYFlow.js +11 -7
- package/dist/likec4diagram/custom/edges/EdgeDrifts.d.ts +6 -0
- package/dist/likec4diagram/custom/edges/EdgeDrifts.js +34 -0
- package/dist/likec4diagram/custom/edges/RelationshipEdge.js +90 -54
- package/dist/likec4diagram/custom/edges/SequenceStepEdge.js +3 -1
- package/dist/likec4diagram/custom/edges/edges.css.d.ts +0 -1
- package/dist/likec4diagram/custom/edges/edges.css.js +30 -24
- package/dist/likec4diagram/custom/edges/useControlPoints.js +5 -5
- package/dist/likec4diagram/custom/edges/useRelationshipEdgePath.js +5 -5
- package/dist/likec4diagram/custom/nodes/ElementActions.js +2 -2
- package/dist/likec4diagram/custom/nodes/NodeDrifts.d.ts +6 -0
- package/dist/likec4diagram/custom/nodes/{ElementNodeDrifts.js → NodeDrifts.js} +12 -13
- package/dist/likec4diagram/custom/nodes/SequenceActorNode.js +4 -2
- package/dist/likec4diagram/custom/nodes/index.d.ts +1 -0
- package/dist/likec4diagram/custom/nodes/nodes.js +61 -23
- package/dist/likec4diagram/custom/nodes/toolbar/ElementToolbar.js +2 -2
- package/dist/likec4diagram/custom/nodes/toolbar/_shared.js +2 -2
- package/dist/likec4diagram/relationship-popover/RelationshipPopover.js +128 -15
- package/dist/likec4diagram/relationship-popover/actor.d.ts +1 -1
- package/dist/likec4diagram/state/DiagramActorProvider.d.ts +2 -2
- package/dist/likec4diagram/state/DiagramActorProvider.js +63 -72
- package/dist/likec4diagram/state/assign.d.ts +14 -7
- package/dist/likec4diagram/state/assign.js +28 -200
- package/dist/likec4diagram/state/createViewChange.js +23 -30
- package/dist/likec4diagram/state/diagram-api.d.ts +20 -6
- package/dist/likec4diagram/state/diagram-api.js +58 -52
- package/dist/likec4diagram/state/hotkeyActor.d.ts +1 -8
- package/dist/likec4diagram/state/hotkeyActor.js +13 -17
- package/dist/likec4diagram/state/machine.actions.d.ts +1127 -864
- package/dist/likec4diagram/state/machine.actions.js +316 -296
- package/dist/likec4diagram/state/machine.actions.layout.d.ts +641 -0
- package/dist/likec4diagram/state/machine.actions.layout.js +141 -0
- package/dist/likec4diagram/state/machine.d.ts +18 -3712
- package/dist/likec4diagram/state/machine.js +64 -73
- package/dist/likec4diagram/state/machine.setup.d.ts +80 -26
- package/dist/likec4diagram/state/machine.setup.js +44 -7
- package/dist/likec4diagram/state/machine.state.initializing.d.ts +58 -17
- package/dist/likec4diagram/state/machine.state.initializing.js +14 -14
- package/dist/likec4diagram/state/machine.state.navigating.d.ts +5 -108
- package/dist/likec4diagram/state/machine.state.navigating.js +187 -35
- package/dist/likec4diagram/state/machine.state.ready.d.ts +2997 -2598
- package/dist/likec4diagram/state/machine.state.ready.focused.d.ts +710 -0
- package/dist/likec4diagram/state/machine.state.ready.focused.js +98 -0
- package/dist/likec4diagram/state/machine.state.ready.idle.d.ts +540 -0
- package/dist/likec4diagram/state/machine.state.ready.idle.js +105 -0
- package/dist/likec4diagram/state/machine.state.ready.js +95 -347
- package/dist/likec4diagram/state/machine.state.ready.printing.d.ts +140 -0
- package/dist/likec4diagram/state/machine.state.ready.printing.js +40 -0
- package/dist/likec4diagram/state/machine.state.ready.walkthrough.d.ts +684 -0
- package/dist/likec4diagram/state/machine.state.ready.walkthrough.js +190 -0
- package/dist/likec4diagram/state/mediaPrintActor.d.ts +12 -0
- package/dist/likec4diagram/state/mediaPrintActor.js +18 -0
- package/dist/likec4diagram/state/types.d.ts +11 -9
- package/dist/likec4diagram/state/utils.d.ts +44 -5
- package/dist/likec4diagram/state/utils.js +62 -6
- package/dist/likec4diagram/types.d.ts +8 -13
- package/dist/likec4diagram/ui/notation/NotationPanel.css.js +5 -2
- package/dist/likec4diagram/ui/notation/NotationPanel.js +3 -3
- package/dist/likec4diagram/useLayoutConstraints.js +104 -103
- package/dist/likec4diagram/xyflow-diagram/diagram-view.js +12 -15
- package/dist/likec4diagram/xyflow-sequence/sequence-layout.js +11 -8
- package/dist/navigationpanel/NavigationPanel.js +11 -10
- package/dist/navigationpanel/NavigationPanelDropdown.js +7 -7
- package/dist/navigationpanel/_common.js +1 -1
- package/dist/navigationpanel/actor.d.ts +4 -204
- package/dist/navigationpanel/actor.js +1 -1
- package/dist/navigationpanel/comparepanel/CompareActionsMenu.d.ts +3 -1
- package/dist/navigationpanel/comparepanel/CompareActionsMenu.js +40 -14
- package/dist/navigationpanel/comparepanel/ComparePanelControls.js +6 -4
- package/dist/navigationpanel/comparepanel/LayoutTypeSwitcher.js +2 -2
- package/dist/navigationpanel/controls/DetailsControls.js +2 -2
- package/dist/navigationpanel/controls/LayoutWarning.js +2 -1
- package/dist/navigationpanel/controls/NavigationButtons.js +2 -2
- package/dist/navigationpanel/controls/OpenSource.js +1 -1
- package/dist/navigationpanel/controls/SearchControl.js +2 -2
- package/dist/navigationpanel/controls/ToggleReadonly.js +32 -19
- package/dist/navigationpanel/dropdown/ProjectsMenu.js +1 -1
- package/dist/navigationpanel/editorpanel/CenterCamera.js +1 -1
- package/dist/navigationpanel/editorpanel/ChangeAutoLayoutButton.js +1 -1
- package/dist/navigationpanel/editorpanel/ManualLayoutToolsButton.js +9 -9
- package/dist/navigationpanel/editorpanel/ToggleReadonly.js +1 -1
- package/dist/navigationpanel/walkthrough/ActiveWalkthroughControls.js +3 -3
- package/dist/navigationpanel/walkthrough/DynamicViewControls.d.ts +9 -9
- package/dist/navigationpanel/walkthrough/DynamicViewControls.js +1 -1
- package/dist/navigationpanel/walkthrough/WalkthroughPanel.js +4 -3
- package/dist/overlays/Overlays.js +24 -12
- package/dist/overlays/element-details/ElementDetailsCard.css.js +3 -3
- package/dist/overlays/element-details/ElementDetailsCard.js +4 -4
- package/dist/overlays/element-details/MetadataValue.d.ts +2 -1
- package/dist/overlays/element-details/MetadataValue.js +4 -6
- package/dist/overlays/element-details/TabPanelDeployments.js +3 -3
- package/dist/overlays/element-details/TabPanelRelationships.js +12 -7
- package/dist/overlays/element-details/TabPanelStructure.js +1 -1
- package/dist/overlays/element-details/actor.d.ts +8 -83
- package/dist/overlays/element-details/actor.js +0 -8
- package/dist/overlays/overlay/Overlay.js +10 -10
- package/dist/overlays/overlaysActor.d.ts +7 -392
- package/dist/overlays/overlaysActor.js +73 -49
- package/dist/overlays/relationship-details/RelationshipDetails.js +3 -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 -562
- package/dist/overlays/relationship-details/actor.js +1 -0
- package/dist/overlays/relationship-details/custom/ElementActions.js +3 -3
- 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 +3 -3
- 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 -739
- package/dist/overlays/relationships-browser/custom/ElementActions.js +3 -3
- 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/components/ElementsColumn.js +7 -3
- package/dist/search/components/PickView.js +3 -1
- package/dist/search/components/SearchByTags.js +1 -1
- package/dist/search/components/SearchInput.js +1 -1
- package/dist/search/components/ViewsColum.d.ts +3 -1
- package/dist/search/components/ViewsColum.js +13 -7
- 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 +7 -5
- package/dist/shadowroot/styles.css.js +6 -1
- package/dist/styles.css2.js +1 -1
- package/dist/utils/index.d.ts +2 -2
- package/dist/utils/view-bounds.js +7 -6
- package/dist/utils/xyflow.d.ts +6 -5
- package/dist/utils/xyflow.js +26 -57
- package/package.json +24 -23
- package/panda.buildinfo.json +65 -71
- package/styles-min.css +1 -1
- package/styles.css +1 -1
- package/dist/base-primitives/edge/edge.css.d.ts +0 -4
- package/dist/base-primitives/edge/edge.css.js +0 -71
- package/dist/editor/LikeC4EditorContext.d.ts +0 -21
- package/dist/likec4diagram/custom/nodes/ElementNodeDrifts.d.ts +0 -4
- package/dist/likec4diagram/state/syncManualLayoutActor.d.ts +0 -280
- package/dist/likec4diagram/state/syncManualLayoutActor.js +0 -248
- package/dist/utils/vector.d.ts +0 -81
- package/dist/utils/vector.js +0 -120
- /package/dist/node_modules/.pnpm/{@tabler_icons-react@3.35.0_react@19.2.0 → @tabler_icons-react@3.35.0_react@19.2.1}/node_modules/@tabler/icons-react/dist/esm/createReactComponent.js +0 -0
- /package/dist/node_modules/.pnpm/{@tabler_icons-react@3.35.0_react@19.2.0 → @tabler_icons-react@3.35.0_react@19.2.1}/node_modules/@tabler/icons-react/dist/esm/defaultAttributes.js +0 -0
- /package/dist/node_modules/.pnpm/{@tabler_icons-react@3.35.0_react@19.2.0 → @tabler_icons-react@3.35.0_react@19.2.1}/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.2.0 → @tabler_icons-react@3.35.0_react@19.2.1}/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.2.0 → @tabler_icons-react@3.35.0_react@19.2.1}/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.2.0 → @tabler_icons-react@3.35.0_react@19.2.1}/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.2.0 → @tabler_icons-react@3.35.0_react@19.2.1}/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.2.0 → @tabler_icons-react@3.35.0_react@19.2.1}/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.2.0 → @tabler_icons-react@3.35.0_react@19.2.1}/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.2.0 → @tabler_icons-react@3.35.0_react@19.2.1}/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.2.0 → @tabler_icons-react@3.35.0_react@19.2.1}/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.2.0 → @tabler_icons-react@3.35.0_react@19.2.1}/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.2.0 → @tabler_icons-react@3.35.0_react@19.2.1}/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.2.0 → @tabler_icons-react@3.35.0_react@19.2.1}/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.2.0 → @tabler_icons-react@3.35.0_react@19.2.1}/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.2.0 → @tabler_icons-react@3.35.0_react@19.2.1}/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.2.0 → @tabler_icons-react@3.35.0_react@19.2.1}/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.2.0 → @tabler_icons-react@3.35.0_react@19.2.1}/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.2.0 → @tabler_icons-react@3.35.0_react@19.2.1}/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.2.0 → @tabler_icons-react@3.35.0_react@19.2.1}/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.2.0 → @tabler_icons-react@3.35.0_react@19.2.1}/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.2.0 → @tabler_icons-react@3.35.0_react@19.2.1}/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.2.0 → @tabler_icons-react@3.35.0_react@19.2.1}/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.2.0 → @tabler_icons-react@3.35.0_react@19.2.1}/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.2.0 → @tabler_icons-react@3.35.0_react@19.2.1}/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.2.0 → @tabler_icons-react@3.35.0_react@19.2.1}/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.2.0 → @tabler_icons-react@3.35.0_react@19.2.1}/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.2.0 → @tabler_icons-react@3.35.0_react@19.2.1}/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.2.0 → @tabler_icons-react@3.35.0_react@19.2.1}/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.2.0 → @tabler_icons-react@3.35.0_react@19.2.1}/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.2.0 → @tabler_icons-react@3.35.0_react@19.2.1}/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.2.0 → @tabler_icons-react@3.35.0_react@19.2.1}/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.2.0 → @tabler_icons-react@3.35.0_react@19.2.1}/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.2.0 → @tabler_icons-react@3.35.0_react@19.2.1}/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.2.0 → @tabler_icons-react@3.35.0_react@19.2.1}/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.2.0 → @tabler_icons-react@3.35.0_react@19.2.1}/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.2.0 → @tabler_icons-react@3.35.0_react@19.2.1}/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.2.0 → @tabler_icons-react@3.35.0_react@19.2.1}/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.2.0 → @tabler_icons-react@3.35.0_react@19.2.1}/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.2.0 → @tabler_icons-react@3.35.0_react@19.2.1}/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.2.0 → @tabler_icons-react@3.35.0_react@19.2.1}/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.2.0 → @tabler_icons-react@3.35.0_react@19.2.1}/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.2.0 → @tabler_icons-react@3.35.0_react@19.2.1}/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.2.0 → @tabler_icons-react@3.35.0_react@19.2.1}/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.2.0 → @tabler_icons-react@3.35.0_react@19.2.1}/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.2.0 → @tabler_icons-react@3.35.0_react@19.2.1}/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.2.0 → @tabler_icons-react@3.35.0_react@19.2.1}/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.2.0 → @tabler_icons-react@3.35.0_react@19.2.1}/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.2.0 → @tabler_icons-react@3.35.0_react@19.2.1}/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.2.0 → @tabler_icons-react@3.35.0_react@19.2.1}/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.2.0 → @tabler_icons-react@3.35.0_react@19.2.1}/node_modules/@tabler/icons-react/dist/esm/icons/IconZoomScan.js +0 -0
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { PropsWithChildren, Context } from 'react';
|
|
2
|
+
import type * as t from '@likec4/core/types';
|
|
3
|
+
export type LikeC4EditorPort = {
|
|
4
|
+
/**
|
|
5
|
+
* Fetch a view by its ID and layout type.
|
|
6
|
+
*
|
|
7
|
+
* @param viewId - The ID of the view to fetch.
|
|
8
|
+
* @param layout - The layout type to use when fetching the view.
|
|
9
|
+
*/
|
|
10
|
+
fetchView(viewId: t.ViewId, layout?: t.LayoutType): t.LayoutedView | Promise<t.LayoutedView>;
|
|
11
|
+
/**
|
|
12
|
+
* Callback invoked when the view changes.
|
|
13
|
+
*/
|
|
14
|
+
handleChange(viewId: t.ViewId, change: t.ViewChange): void | Promise<void>;
|
|
15
|
+
};
|
|
16
|
+
export type LikeC4EditorProviderProps = PropsWithChildren<{
|
|
17
|
+
editor: LikeC4EditorPort;
|
|
18
|
+
}>;
|
|
19
|
+
export declare const LikeC4EditorReactContext: Context<LikeC4EditorPort | null>;
|
|
20
|
+
export declare function LikeC4EditorProvider({ children, editor }: LikeC4EditorProviderProps): import("react/jsx-runtime").JSX.Element;
|
|
21
|
+
export declare function EnsureEditorContext({ children }: PropsWithChildren): import("react/jsx-runtime").JSX.Element | null;
|
|
22
|
+
export declare function useOptionalLikeC4EditorPort(): LikeC4EditorPort | null;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { jsx } from 'react/jsx-runtime';
|
|
2
|
+
import { createContext, useContext } from 'react';
|
|
3
|
+
|
|
4
|
+
const LikeC4EditorReactContext = createContext(null);
|
|
5
|
+
function LikeC4EditorProvider({ children, editor }) {
|
|
6
|
+
return /* @__PURE__ */ jsx(LikeC4EditorReactContext.Provider, { value: editor, children });
|
|
7
|
+
}
|
|
8
|
+
function useOptionalLikeC4EditorPort() {
|
|
9
|
+
return useContext(LikeC4EditorReactContext);
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
export { LikeC4EditorProvider, LikeC4EditorReactContext, useOptionalLikeC4EditorPort };
|
|
@@ -0,0 +1,205 @@
|
|
|
1
|
+
import { Types, Builder } from '@likec4/core/builder';
|
|
2
|
+
import { DiagramEdge, DiagramNode, LayoutedElementView } from '@likec4/core/types';
|
|
3
|
+
import { WritableDraft } from 'immer';
|
|
4
|
+
import { LiteralUnion } from 'type-fest';
|
|
5
|
+
/**
|
|
6
|
+
Snapshot {@link indexSnapshot} is built from the model below.
|
|
7
|
+
=======
|
|
8
|
+
specification {
|
|
9
|
+
element el
|
|
10
|
+
element app
|
|
11
|
+
tag tag-1
|
|
12
|
+
tag tag-2
|
|
13
|
+
tag tag-3
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
model {
|
|
17
|
+
el customer 'Customer' {
|
|
18
|
+
#tag-1 #tag-2
|
|
19
|
+
description 'Uses services online'
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
el saas {
|
|
23
|
+
#tag-1
|
|
24
|
+
title 'SaaS Application'
|
|
25
|
+
description 'Provides online services to customers'
|
|
26
|
+
|
|
27
|
+
el frontend {
|
|
28
|
+
#tag-2
|
|
29
|
+
title 'Frontend'
|
|
30
|
+
|
|
31
|
+
app spa {
|
|
32
|
+
#tag-2
|
|
33
|
+
title 'SPA'
|
|
34
|
+
description 'Single Page Application'
|
|
35
|
+
icon tech:react
|
|
36
|
+
|
|
37
|
+
-> api
|
|
38
|
+
}
|
|
39
|
+
app pwa {
|
|
40
|
+
#tag-2
|
|
41
|
+
title 'PWA'
|
|
42
|
+
description 'Progressive Web Application'
|
|
43
|
+
icon tech:react
|
|
44
|
+
|
|
45
|
+
-> api
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
el backend {
|
|
49
|
+
title 'Backend'
|
|
50
|
+
|
|
51
|
+
el auth {
|
|
52
|
+
title 'Auth'
|
|
53
|
+
description 'Authentication'
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
el api {
|
|
57
|
+
#tag-3
|
|
58
|
+
title 'API'
|
|
59
|
+
description 'REST API'
|
|
60
|
+
icon tech:nodejs
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
el worker {
|
|
64
|
+
title 'Worker'
|
|
65
|
+
description 'Background processing'
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
api -> auth
|
|
69
|
+
api -> worker
|
|
70
|
+
api -> external.database
|
|
71
|
+
worker -> external.email
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
frontend -> api {
|
|
75
|
+
title 'requests'
|
|
76
|
+
technology 'REST'
|
|
77
|
+
description '''
|
|
78
|
+
requests **data**
|
|
79
|
+
'''
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
el external {
|
|
84
|
+
title 'External'
|
|
85
|
+
description 'External system'
|
|
86
|
+
|
|
87
|
+
el email {
|
|
88
|
+
title 'Email'
|
|
89
|
+
description 'Email service'
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
el database {
|
|
93
|
+
title 'Database'
|
|
94
|
+
description 'External database'
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
customer -> saas.frontend 'uses'
|
|
99
|
+
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
views {
|
|
103
|
+
view index {
|
|
104
|
+
title 'Landscape'
|
|
105
|
+
description '''
|
|
106
|
+
System _Landscape_
|
|
107
|
+
|
|
108
|
+
'''
|
|
109
|
+
|
|
110
|
+
include
|
|
111
|
+
*,
|
|
112
|
+
saas.**,
|
|
113
|
+
external.**
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
*/
|
|
118
|
+
/**
|
|
119
|
+
* Builder that produces the model used to create {@link indexSnapshot}
|
|
120
|
+
* Here for type safety and easy maintenance of the snapshot.
|
|
121
|
+
*/
|
|
122
|
+
declare function simplebuilder(): Builder<Types<"el" | "app", "external" | "saas" | "customer" | "saas.frontend" | "saas.frontend.spa" | "saas.frontend.pwa" | "saas.backend" | "saas.backend.auth" | "saas.backend.api" | "saas.backend.worker" | "external.email" | "external.database", "index", never, "tag-1" | "tag-2" | "tag-3", never, never, never>>;
|
|
123
|
+
type A = Types.ToAux<ReturnType<typeof simplebuilder>['Types']>;
|
|
124
|
+
type ExistingNodes = A['ElementId'];
|
|
125
|
+
type WithoutNodesEdges<V = LayoutedElementView> = Omit<V, 'nodes' | 'edges'>;
|
|
126
|
+
export type NodeIds = LiteralUnion<ExistingNodes, string>;
|
|
127
|
+
type NodeUpdater = ((draft: WritableDraft<Omit<DiagramNode, 'id'>>) => void) | Partial<Omit<DiagramNode, 'id'>> | undefined | null;
|
|
128
|
+
type NodeIdFrom<N> = N extends infer L extends string ? L | ExistingNodes : ExistingNodes;
|
|
129
|
+
type ExistingEdges = 'edge1' | 'edge2' | 'edge3' | 'edge4' | 'edge5' | 'edge6' | 'edge7';
|
|
130
|
+
type UpdatableEdge<Node> = Omit<DiagramEdge, 'id' | 'source' | 'target'> & {
|
|
131
|
+
id: LiteralUnion<ExistingEdges, string>;
|
|
132
|
+
source: Node;
|
|
133
|
+
target: Node;
|
|
134
|
+
};
|
|
135
|
+
type EdgeUpdater<Node> = ((draft: WritableDraft<UpdatableEdge<Node>>) => void) | Partial<UpdatableEdge<Node>> | undefined | null;
|
|
136
|
+
export type Patches<N, E> = {
|
|
137
|
+
view?: Partial<WithoutNodesEdges> | ((draft: WritableDraft<WithoutNodesEdges>) => void);
|
|
138
|
+
nodes?: {
|
|
139
|
+
[Id in ExistingNodes]?: NodeUpdater;
|
|
140
|
+
} & {
|
|
141
|
+
[Id in N & string]?: NodeUpdater | undefined | null;
|
|
142
|
+
};
|
|
143
|
+
edges?: {
|
|
144
|
+
[Id in ExistingEdges]?: EdgeUpdater<NodeIdFrom<N>>;
|
|
145
|
+
} & {
|
|
146
|
+
[Id in E & string]?: EdgeUpdater<NodeIdFrom<N>>;
|
|
147
|
+
};
|
|
148
|
+
};
|
|
149
|
+
/**
|
|
150
|
+
* Helper to get a fixture with manual layout snapshot, and auto layouted view.
|
|
151
|
+
* It takes {@link indexSnapshot} as base, applies provided patches
|
|
152
|
+
* to return as auto-layouted.
|
|
153
|
+
*
|
|
154
|
+
* Patcher can modify view properties, nodes and edges by their ids.
|
|
155
|
+
*
|
|
156
|
+
* Nodes/Edges can be modified, removed (by setting to null/undefined), or added (by using new key).
|
|
157
|
+
*
|
|
158
|
+
* @example
|
|
159
|
+
* const { snapshot, layouted } = prepareFixtures({
|
|
160
|
+
* nodes: {
|
|
161
|
+
* // Merge changes to the node
|
|
162
|
+
* 'customer': {
|
|
163
|
+
* x: 100,
|
|
164
|
+
* },
|
|
165
|
+
* // Apply changes to existing node via immer
|
|
166
|
+
* 'saas.api': d => {
|
|
167
|
+
* d.color = 'secondary'
|
|
168
|
+
* },
|
|
169
|
+
* // Remove node from snapshot
|
|
170
|
+
* 'saas.frontend': null,
|
|
171
|
+
* // Add new node to layouted View
|
|
172
|
+
* 'another': d => {
|
|
173
|
+
* d.title = 'Another Node'
|
|
174
|
+
* },
|
|
175
|
+
* edges: {
|
|
176
|
+
* // Merge changes to existing edge
|
|
177
|
+
* 'edge1: customer to frontend': d => {
|
|
178
|
+
* d.source = 'another'
|
|
179
|
+
* },
|
|
180
|
+
* // Delete existing edge
|
|
181
|
+
* 'edge2: frontend to api': null,
|
|
182
|
+
* // Add new edge (TS will check source/target ids)
|
|
183
|
+
* 'customer -> another': {
|
|
184
|
+
* label: 'New Edge',
|
|
185
|
+
* source: 'customer',
|
|
186
|
+
* target: 'another',
|
|
187
|
+
* }
|
|
188
|
+
* }
|
|
189
|
+
* }
|
|
190
|
+
|
|
191
|
+
* })
|
|
192
|
+
*/
|
|
193
|
+
export declare function prepareFixtures<const N, E>(patcher?: Patches<N, E>): {
|
|
194
|
+
snapshot: LayoutedElementView;
|
|
195
|
+
snapshotNodes: Record<ExistingNodes, DiagramNode>;
|
|
196
|
+
snapshotEdges: Record<ExistingEdges, DiagramEdge>;
|
|
197
|
+
layouted: LayoutedElementView;
|
|
198
|
+
layoutedNodes: {
|
|
199
|
+
[Id in ExistingNodes | N & string]: DiagramNode;
|
|
200
|
+
};
|
|
201
|
+
layoutedEdges: {
|
|
202
|
+
[Id in ExistingEdges | E & string]: DiagramEdge;
|
|
203
|
+
};
|
|
204
|
+
};
|
|
205
|
+
export {};
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import * as t from '@likec4/core/types';
|
|
2
|
+
/**
|
|
3
|
+
* Applies changes to a manual layout.
|
|
4
|
+
*
|
|
5
|
+
* @param manual - The manual layout.
|
|
6
|
+
* @param latest - The latest layout.
|
|
7
|
+
*/
|
|
8
|
+
export declare function applyChangesToManualLayout(manualView: t.LayoutedView, latestView: t.LayoutedView): t.LayoutedView;
|
|
@@ -0,0 +1,182 @@
|
|
|
1
|
+
import { invariant, nonNullable } from '@likec4/core';
|
|
2
|
+
import { BBox, vector } from '@likec4/core/geometry';
|
|
3
|
+
import { setAutoFreeze, produce, castDraft } from 'immer';
|
|
4
|
+
import { isNullish } from 'remeda';
|
|
5
|
+
|
|
6
|
+
function applyChangesToManualLayout(manualView, latestView) {
|
|
7
|
+
try {
|
|
8
|
+
setAutoFreeze(false);
|
|
9
|
+
return _applyChangesToManualLayout(manualView, latestView);
|
|
10
|
+
} finally {
|
|
11
|
+
setAutoFreeze(true);
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
const isRootNode = (node) => isNullish(node.parent);
|
|
15
|
+
function _applyChangesToManualLayout(manualView, latestView) {
|
|
16
|
+
invariant(manualView.id === latestView.id, "View IDs do not match");
|
|
17
|
+
invariant(manualView._type === latestView._type, "View types do not match");
|
|
18
|
+
invariant(manualView._layout === "manual" && latestView._layout === "auto", "Views must be manual and auto");
|
|
19
|
+
const compounds = /* @__PURE__ */ new Set();
|
|
20
|
+
const newnodes = /* @__PURE__ */ new Set();
|
|
21
|
+
const isNotCompound = (node) => !compounds.has(typeof node === "string" ? node : node.id);
|
|
22
|
+
const isBetweenNewLeafNodes = (edge) => newnodes.has(edge.source) && newnodes.has(edge.target) && isNotCompound(edge.source) && isNotCompound(edge.target);
|
|
23
|
+
const nodesMap = new Map(
|
|
24
|
+
latestView.nodes.map((latest) => {
|
|
25
|
+
if (latest.children && latest.children.length > 0) {
|
|
26
|
+
compounds.add(latest.id);
|
|
27
|
+
}
|
|
28
|
+
const manual = manualView.nodes.find((n) => n.id === latest.id);
|
|
29
|
+
if (manual) {
|
|
30
|
+
return [latest.id, applyFromManualNode({ latest, manual })];
|
|
31
|
+
}
|
|
32
|
+
newnodes.add(latest.id);
|
|
33
|
+
return [latest.id, removeDrift(latest)];
|
|
34
|
+
})
|
|
35
|
+
);
|
|
36
|
+
const newNodesOnly = newnodes.size === nodesMap.size;
|
|
37
|
+
if (newNodesOnly) {
|
|
38
|
+
return produce(latestView, (draft) => {
|
|
39
|
+
draft._layout = "manual";
|
|
40
|
+
draft.nodes = castDraft([...nodesMap.values()]);
|
|
41
|
+
draft.edges = castDraft(latestView.edges.map(removeDrift));
|
|
42
|
+
delete draft.drifts;
|
|
43
|
+
});
|
|
44
|
+
}
|
|
45
|
+
if (compounds.size > 0) {
|
|
46
|
+
expandCompoundNodes(nodesMap);
|
|
47
|
+
}
|
|
48
|
+
const nodes = [...nodesMap.values()];
|
|
49
|
+
const edges = latestView.edges.map((latest) => {
|
|
50
|
+
const dir = latest.dir ?? "forward";
|
|
51
|
+
const hasSameEndpoints = (candidate) => candidate.source === latest.source && candidate.target === latest.target && (candidate.dir === dir || !candidate.dir && !latest.dir);
|
|
52
|
+
let manual = manualView.edges.find((e) => e.id === latest.id && hasSameEndpoints(e));
|
|
53
|
+
if (!manual) {
|
|
54
|
+
manual = manualView.edges.find((e) => hasSameEndpoints(e));
|
|
55
|
+
}
|
|
56
|
+
if (manual) {
|
|
57
|
+
return applyFromManualEdge({
|
|
58
|
+
latest,
|
|
59
|
+
manual
|
|
60
|
+
});
|
|
61
|
+
}
|
|
62
|
+
if (isBetweenNewLeafNodes(latest)) {
|
|
63
|
+
return removeDrift(latest);
|
|
64
|
+
}
|
|
65
|
+
const sourceNode = nodesMap.get(latest.source);
|
|
66
|
+
const targetNode = nodesMap.get(latest.target);
|
|
67
|
+
return makeAsStraightLine(latest, sourceNode, targetNode);
|
|
68
|
+
});
|
|
69
|
+
const bounds = BBox.merge(...nodes.filter(isRootNode));
|
|
70
|
+
return produce(latestView, (draft) => {
|
|
71
|
+
draft._layout = "manual";
|
|
72
|
+
draft.nodes = castDraft(nodes);
|
|
73
|
+
draft.edges = castDraft(edges);
|
|
74
|
+
draft.bounds = bounds;
|
|
75
|
+
delete draft.drifts;
|
|
76
|
+
});
|
|
77
|
+
}
|
|
78
|
+
const COMPOUND_PADDING = {
|
|
79
|
+
Left: 42,
|
|
80
|
+
Right: 42,
|
|
81
|
+
Top: 60,
|
|
82
|
+
Bottom: 42
|
|
83
|
+
};
|
|
84
|
+
function expandCompoundNodes(nodes) {
|
|
85
|
+
function expand(nodeId) {
|
|
86
|
+
const node = nonNullable(nodes.get(nodeId), `Node ${nodeId} not found`);
|
|
87
|
+
if (node.children.length === 0) {
|
|
88
|
+
return node;
|
|
89
|
+
}
|
|
90
|
+
const childBBoxes = [];
|
|
91
|
+
for (const childId of node.children) {
|
|
92
|
+
childBBoxes.push(
|
|
93
|
+
expand(childId)
|
|
94
|
+
);
|
|
95
|
+
}
|
|
96
|
+
const childrenBBox = BBox.merge(...childBBoxes);
|
|
97
|
+
node.x = childrenBBox.x - COMPOUND_PADDING.Left;
|
|
98
|
+
node.y = childrenBBox.y - COMPOUND_PADDING.Top;
|
|
99
|
+
node.width = childrenBBox.width + COMPOUND_PADDING.Left + COMPOUND_PADDING.Right;
|
|
100
|
+
node.height = childrenBBox.height + COMPOUND_PADDING.Top + COMPOUND_PADDING.Bottom;
|
|
101
|
+
return node;
|
|
102
|
+
}
|
|
103
|
+
for (const node of nodes.values()) {
|
|
104
|
+
if (!isRootNode(node) || node.children.length === 0) {
|
|
105
|
+
continue;
|
|
106
|
+
}
|
|
107
|
+
expand(node.id);
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
function applyFromManualNode({ latest, manual }) {
|
|
111
|
+
invariant(manual.id === latest.id, "Node IDs do not match");
|
|
112
|
+
return produce(latest, (next) => {
|
|
113
|
+
next.x = manual.x;
|
|
114
|
+
next.y = manual.y;
|
|
115
|
+
next.drifts = null;
|
|
116
|
+
});
|
|
117
|
+
}
|
|
118
|
+
function applyFromManualEdge(edges) {
|
|
119
|
+
const { manual, latest } = edges;
|
|
120
|
+
return produce(latest, (draft) => {
|
|
121
|
+
if (manual.controlPoints) {
|
|
122
|
+
draft.controlPoints = manual.controlPoints;
|
|
123
|
+
} else {
|
|
124
|
+
delete draft.controlPoints;
|
|
125
|
+
}
|
|
126
|
+
draft.points = castDraft(manual.points);
|
|
127
|
+
if (manual.labelBBox) {
|
|
128
|
+
draft.labelBBox = latest.labelBBox ?? manual.labelBBox;
|
|
129
|
+
draft.labelBBox.x = manual.labelBBox.x;
|
|
130
|
+
draft.labelBBox.y = manual.labelBBox.y;
|
|
131
|
+
}
|
|
132
|
+
draft.drifts = null;
|
|
133
|
+
});
|
|
134
|
+
}
|
|
135
|
+
function removeDrift(object) {
|
|
136
|
+
if ("drifts" in object && object.drifts !== null) {
|
|
137
|
+
const result = { ...object };
|
|
138
|
+
result.drifts = null;
|
|
139
|
+
return result;
|
|
140
|
+
}
|
|
141
|
+
return object;
|
|
142
|
+
}
|
|
143
|
+
function makeAsStraightLine(edge, sourceNode, targetNode) {
|
|
144
|
+
const controlPoints = edgeControlPoints(sourceNode, targetNode);
|
|
145
|
+
const labelPos = controlPoints[0];
|
|
146
|
+
return produce(edge, (draft) => {
|
|
147
|
+
draft.controlPoints = controlPoints;
|
|
148
|
+
if (edge.labelBBox) {
|
|
149
|
+
draft.labelBBox.x = labelPos.x;
|
|
150
|
+
draft.labelBBox.y = labelPos.y;
|
|
151
|
+
}
|
|
152
|
+
delete draft.drifts;
|
|
153
|
+
});
|
|
154
|
+
}
|
|
155
|
+
function getBorderPointOnVector(node, nodeCenter, v) {
|
|
156
|
+
const xScale = node.width / 2 / v.x;
|
|
157
|
+
const yScale = node.height / 2 / v.y;
|
|
158
|
+
const scale = Math.min(Math.abs(xScale), Math.abs(yScale));
|
|
159
|
+
return vector(v).multiply(scale).add(nodeCenter);
|
|
160
|
+
}
|
|
161
|
+
function edgeControlPoints(source, target) {
|
|
162
|
+
const sourceCenter = vector(BBox.center(source));
|
|
163
|
+
const targetCenter = vector(BBox.center(target));
|
|
164
|
+
if (source === target) {
|
|
165
|
+
const loopSize = 80;
|
|
166
|
+
const centerOfTopBoundary = vector(0, source.height || 0).multiply(-0.5).add(sourceCenter);
|
|
167
|
+
return [
|
|
168
|
+
centerOfTopBoundary.add(vector(-loopSize / 2.5, -loopSize)).round().toObject(),
|
|
169
|
+
centerOfTopBoundary.add(vector(loopSize / 2.5, -loopSize)).round().toObject()
|
|
170
|
+
];
|
|
171
|
+
}
|
|
172
|
+
const sourceToTargetVector = targetCenter.subtract(sourceCenter);
|
|
173
|
+
const sourceBorderPoint = getBorderPointOnVector(source, sourceCenter, sourceToTargetVector);
|
|
174
|
+
const targetBorderPoint = getBorderPointOnVector(target, targetCenter, sourceToTargetVector.multiply(-1));
|
|
175
|
+
const sourceToTarget = targetBorderPoint.subtract(sourceBorderPoint);
|
|
176
|
+
return [
|
|
177
|
+
sourceBorderPoint.add(sourceToTarget.multiply(0.4)).round().toObject(),
|
|
178
|
+
sourceBorderPoint.add(sourceToTarget.multiply(0.6)).round().toObject()
|
|
179
|
+
];
|
|
180
|
+
}
|
|
181
|
+
|
|
182
|
+
export { applyChangesToManualLayout };
|
|
@@ -0,0 +1,201 @@
|
|
|
1
|
+
import { ViewChange } from '@likec4/core/types';
|
|
2
|
+
import { ActionFunction, CancelAction, Values, PromiseActorLogic, EventObject, NonReducibleUnknown, StopAction } from 'xstate';
|
|
3
|
+
import { EditorActorContext, EditorActorEvent, EditorActorEmitedEvent } from './editorActor';
|
|
4
|
+
import { HotkeyActorLogic } from './hotkeyActor';
|
|
5
|
+
export declare const raiseSync: () => ActionFunction<EditorActorContext, EditorActorEvent, EditorActorEvent, undefined, never, never, never, "350ms" | "waitBeforeSync", never>;
|
|
6
|
+
export declare const cancelSync: () => CancelAction<EditorActorContext, EditorActorEvent, undefined, EditorActorEvent>;
|
|
7
|
+
export declare const reschedule: (delay?: number) => ActionFunction<EditorActorContext, EditorActorEvent, EditorActorEvent, undefined, never, never, never, "350ms" | "waitBeforeSync", never>;
|
|
8
|
+
type LayoutChanges = ViewChange.ResetManualLayout | ViewChange.SaveViewSnapshot;
|
|
9
|
+
export declare const isLayoutChange: (change: ViewChange) => change is LayoutChanges;
|
|
10
|
+
export declare const withoutSnapshotChanges: (data: ViewChange[]) => (ViewChange.ChangeElementStyle | ViewChange.ChangeAutoLayout)[];
|
|
11
|
+
export declare const saveStateBeforeEdit: () => ActionFunction<EditorActorContext, EditorActorEvent, EditorActorEvent, undefined, Values<{
|
|
12
|
+
hotkey: {
|
|
13
|
+
src: "hotkey";
|
|
14
|
+
logic: HotkeyActorLogic;
|
|
15
|
+
id: "hotkey";
|
|
16
|
+
};
|
|
17
|
+
applyLatest: {
|
|
18
|
+
src: "applyLatest";
|
|
19
|
+
logic: PromiseActorLogic<import("./editorActor").EditorCalls.ApplyLatestToManual.Output, import("./editorActor").EditorCalls.ApplyLatestToManual.Input, EventObject>;
|
|
20
|
+
id: string | undefined;
|
|
21
|
+
};
|
|
22
|
+
executeChange: {
|
|
23
|
+
src: "executeChange";
|
|
24
|
+
logic: PromiseActorLogic<NonReducibleUnknown, import("./editorActor").EditorCalls.ExecuteChange.Input, EventObject>;
|
|
25
|
+
id: string | undefined;
|
|
26
|
+
};
|
|
27
|
+
}>, never, never, never, never>;
|
|
28
|
+
export declare const startEditing: () => ActionFunction<EditorActorContext, EditorActorEvent, EditorActorEvent, undefined, Values<{
|
|
29
|
+
hotkey: {
|
|
30
|
+
src: "hotkey";
|
|
31
|
+
logic: HotkeyActorLogic;
|
|
32
|
+
id: "hotkey";
|
|
33
|
+
};
|
|
34
|
+
applyLatest: {
|
|
35
|
+
src: "applyLatest";
|
|
36
|
+
logic: PromiseActorLogic<import("./editorActor").EditorCalls.ApplyLatestToManual.Output, import("./editorActor").EditorCalls.ApplyLatestToManual.Input, EventObject>;
|
|
37
|
+
id: string | undefined;
|
|
38
|
+
};
|
|
39
|
+
executeChange: {
|
|
40
|
+
src: "executeChange";
|
|
41
|
+
logic: PromiseActorLogic<NonReducibleUnknown, import("./editorActor").EditorCalls.ExecuteChange.Input, EventObject>;
|
|
42
|
+
id: string | undefined;
|
|
43
|
+
};
|
|
44
|
+
}>, never, Values<{
|
|
45
|
+
"has pending": {
|
|
46
|
+
type: "has pending";
|
|
47
|
+
params: unknown;
|
|
48
|
+
};
|
|
49
|
+
"can undo": {
|
|
50
|
+
type: "can undo";
|
|
51
|
+
params: unknown;
|
|
52
|
+
};
|
|
53
|
+
}>, "350ms" | "waitBeforeSync", EditorActorEmitedEvent>;
|
|
54
|
+
export declare const stopHotkey: () => StopAction<EditorActorContext, EditorActorEvent, undefined, EditorActorEvent>;
|
|
55
|
+
export declare const ensureHotKey: () => ActionFunction<EditorActorContext, EditorActorEvent, EditorActorEvent, undefined, Values<{
|
|
56
|
+
hotkey: {
|
|
57
|
+
src: "hotkey";
|
|
58
|
+
logic: HotkeyActorLogic;
|
|
59
|
+
id: "hotkey";
|
|
60
|
+
};
|
|
61
|
+
applyLatest: {
|
|
62
|
+
src: "applyLatest";
|
|
63
|
+
logic: PromiseActorLogic<import("./editorActor").EditorCalls.ApplyLatestToManual.Output, import("./editorActor").EditorCalls.ApplyLatestToManual.Input, EventObject>;
|
|
64
|
+
id: string | undefined;
|
|
65
|
+
};
|
|
66
|
+
executeChange: {
|
|
67
|
+
src: "executeChange";
|
|
68
|
+
logic: PromiseActorLogic<NonReducibleUnknown, import("./editorActor").EditorCalls.ExecuteChange.Input, EventObject>;
|
|
69
|
+
id: string | undefined;
|
|
70
|
+
};
|
|
71
|
+
}>, never, Values<{
|
|
72
|
+
"has pending": {
|
|
73
|
+
type: "has pending";
|
|
74
|
+
params: unknown;
|
|
75
|
+
};
|
|
76
|
+
"can undo": {
|
|
77
|
+
type: "can undo";
|
|
78
|
+
params: unknown;
|
|
79
|
+
};
|
|
80
|
+
}>, "350ms" | "waitBeforeSync", EditorActorEmitedEvent>;
|
|
81
|
+
export declare const pushHistory: () => ActionFunction<EditorActorContext, EditorActorEvent, EditorActorEvent, undefined, Values<{
|
|
82
|
+
hotkey: {
|
|
83
|
+
src: "hotkey";
|
|
84
|
+
logic: HotkeyActorLogic;
|
|
85
|
+
id: "hotkey";
|
|
86
|
+
};
|
|
87
|
+
applyLatest: {
|
|
88
|
+
src: "applyLatest";
|
|
89
|
+
logic: PromiseActorLogic<import("./editorActor").EditorCalls.ApplyLatestToManual.Output, import("./editorActor").EditorCalls.ApplyLatestToManual.Input, EventObject>;
|
|
90
|
+
id: string | undefined;
|
|
91
|
+
};
|
|
92
|
+
executeChange: {
|
|
93
|
+
src: "executeChange";
|
|
94
|
+
logic: PromiseActorLogic<NonReducibleUnknown, import("./editorActor").EditorCalls.ExecuteChange.Input, EventObject>;
|
|
95
|
+
id: string | undefined;
|
|
96
|
+
};
|
|
97
|
+
}>, never, never, never, never>;
|
|
98
|
+
export declare const stopEditing: () => ActionFunction<EditorActorContext, EditorActorEvent, EditorActorEvent, undefined, Values<{
|
|
99
|
+
hotkey: {
|
|
100
|
+
src: "hotkey";
|
|
101
|
+
logic: HotkeyActorLogic;
|
|
102
|
+
id: "hotkey";
|
|
103
|
+
};
|
|
104
|
+
applyLatest: {
|
|
105
|
+
src: "applyLatest";
|
|
106
|
+
logic: PromiseActorLogic<import("./editorActor").EditorCalls.ApplyLatestToManual.Output, import("./editorActor").EditorCalls.ApplyLatestToManual.Input, EventObject>;
|
|
107
|
+
id: string | undefined;
|
|
108
|
+
};
|
|
109
|
+
executeChange: {
|
|
110
|
+
src: "executeChange";
|
|
111
|
+
logic: PromiseActorLogic<NonReducibleUnknown, import("./editorActor").EditorCalls.ExecuteChange.Input, EventObject>;
|
|
112
|
+
id: string | undefined;
|
|
113
|
+
};
|
|
114
|
+
}>, never, Values<{
|
|
115
|
+
"has pending": {
|
|
116
|
+
type: "has pending";
|
|
117
|
+
params: unknown;
|
|
118
|
+
};
|
|
119
|
+
"can undo": {
|
|
120
|
+
type: "can undo";
|
|
121
|
+
params: unknown;
|
|
122
|
+
};
|
|
123
|
+
}>, "350ms" | "waitBeforeSync", EditorActorEmitedEvent>;
|
|
124
|
+
export declare const markHistoryAsSynched: () => ActionFunction<EditorActorContext, EditorActorEvent, EditorActorEvent, undefined, Values<{
|
|
125
|
+
hotkey: {
|
|
126
|
+
src: "hotkey";
|
|
127
|
+
logic: HotkeyActorLogic;
|
|
128
|
+
id: "hotkey";
|
|
129
|
+
};
|
|
130
|
+
applyLatest: {
|
|
131
|
+
src: "applyLatest";
|
|
132
|
+
logic: PromiseActorLogic<import("./editorActor").EditorCalls.ApplyLatestToManual.Output, import("./editorActor").EditorCalls.ApplyLatestToManual.Input, EventObject>;
|
|
133
|
+
id: string | undefined;
|
|
134
|
+
};
|
|
135
|
+
executeChange: {
|
|
136
|
+
src: "executeChange";
|
|
137
|
+
logic: PromiseActorLogic<NonReducibleUnknown, import("./editorActor").EditorCalls.ExecuteChange.Input, EventObject>;
|
|
138
|
+
id: string | undefined;
|
|
139
|
+
};
|
|
140
|
+
}>, never, never, never, never>;
|
|
141
|
+
export declare const popHistory: () => ActionFunction<EditorActorContext, EditorActorEvent, EditorActorEvent, undefined, Values<{
|
|
142
|
+
hotkey: {
|
|
143
|
+
src: "hotkey";
|
|
144
|
+
logic: HotkeyActorLogic;
|
|
145
|
+
id: "hotkey";
|
|
146
|
+
};
|
|
147
|
+
applyLatest: {
|
|
148
|
+
src: "applyLatest";
|
|
149
|
+
logic: PromiseActorLogic<import("./editorActor").EditorCalls.ApplyLatestToManual.Output, import("./editorActor").EditorCalls.ApplyLatestToManual.Input, EventObject>;
|
|
150
|
+
id: string | undefined;
|
|
151
|
+
};
|
|
152
|
+
executeChange: {
|
|
153
|
+
src: "executeChange";
|
|
154
|
+
logic: PromiseActorLogic<NonReducibleUnknown, import("./editorActor").EditorCalls.ExecuteChange.Input, EventObject>;
|
|
155
|
+
id: string | undefined;
|
|
156
|
+
};
|
|
157
|
+
}>, never, never, never, never>;
|
|
158
|
+
export declare const undo: () => ActionFunction<EditorActorContext, EditorActorEvent, EditorActorEvent, undefined, Values<{
|
|
159
|
+
hotkey: {
|
|
160
|
+
src: "hotkey";
|
|
161
|
+
logic: HotkeyActorLogic;
|
|
162
|
+
id: "hotkey";
|
|
163
|
+
};
|
|
164
|
+
applyLatest: {
|
|
165
|
+
src: "applyLatest";
|
|
166
|
+
logic: PromiseActorLogic<import("./editorActor").EditorCalls.ApplyLatestToManual.Output, import("./editorActor").EditorCalls.ApplyLatestToManual.Input, EventObject>;
|
|
167
|
+
id: string | undefined;
|
|
168
|
+
};
|
|
169
|
+
executeChange: {
|
|
170
|
+
src: "executeChange";
|
|
171
|
+
logic: PromiseActorLogic<NonReducibleUnknown, import("./editorActor").EditorCalls.ExecuteChange.Input, EventObject>;
|
|
172
|
+
id: string | undefined;
|
|
173
|
+
};
|
|
174
|
+
}>, never, Values<{
|
|
175
|
+
"has pending": {
|
|
176
|
+
type: "has pending";
|
|
177
|
+
params: unknown;
|
|
178
|
+
};
|
|
179
|
+
"can undo": {
|
|
180
|
+
type: "can undo";
|
|
181
|
+
params: unknown;
|
|
182
|
+
};
|
|
183
|
+
}>, "350ms" | "waitBeforeSync", EditorActorEmitedEvent>;
|
|
184
|
+
export declare const addSnapshotToPendingChanges: () => ActionFunction<EditorActorContext, EditorActorEvent, EditorActorEvent, undefined, Values<{
|
|
185
|
+
hotkey: {
|
|
186
|
+
src: "hotkey";
|
|
187
|
+
logic: HotkeyActorLogic;
|
|
188
|
+
id: "hotkey";
|
|
189
|
+
};
|
|
190
|
+
applyLatest: {
|
|
191
|
+
src: "applyLatest";
|
|
192
|
+
logic: PromiseActorLogic<import("./editorActor").EditorCalls.ApplyLatestToManual.Output, import("./editorActor").EditorCalls.ApplyLatestToManual.Input, EventObject>;
|
|
193
|
+
id: string | undefined;
|
|
194
|
+
};
|
|
195
|
+
executeChange: {
|
|
196
|
+
src: "executeChange";
|
|
197
|
+
logic: PromiseActorLogic<NonReducibleUnknown, import("./editorActor").EditorCalls.ExecuteChange.Input, EventObject>;
|
|
198
|
+
id: string | undefined;
|
|
199
|
+
};
|
|
200
|
+
}>, never, never, never, never>;
|
|
201
|
+
export {};
|