@likec4/diagram 1.47.0 → 1.49.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/LICENSE +1 -1
- package/README.md +8 -10
- package/adhoc-editor/package.json +4 -0
- package/dist/LikeC4Diagram.d.ts +2 -1
- package/dist/LikeC4Diagram.js +85 -81
- package/dist/LikeC4Diagram.props.d.ts +10 -6
- package/dist/LikeC4ModelProvider.d.ts +4 -4
- package/dist/LikeC4ModelProvider.js +2 -2
- package/dist/LikeC4ProjectsOverview.d.ts +3 -2
- package/dist/LikeC4ProjectsProvider.d.ts +2 -1
- package/dist/LikeC4ProjectsProvider.js +10 -8
- package/dist/LikeC4Styles.d.ts +3 -6
- package/dist/LikeC4Styles.js +44 -43
- package/dist/LikeC4View.d.ts +22 -1
- package/dist/LikeC4View.js +40 -25
- package/dist/ReactLikeC4.d.ts +13 -2
- package/dist/ReactLikeC4.js +8 -4
- package/dist/StaticLikeC4Diagram.d.ts +2 -1
- package/dist/StaticLikeC4Diagram.js +1 -0
- package/dist/_virtual/store-1b2fbb72.cjs.js +3 -0
- package/dist/_virtual/xstate-store-react.cjs.js +5 -0
- package/dist/_virtual/xstate-store-react.cjs2.js +3 -0
- package/dist/adhoc-editor/EditorPanel.d.ts +1 -0
- package/dist/adhoc-editor/EditorPanel.js +105 -0
- package/dist/adhoc-editor/ElementsTree.d.ts +2 -0
- package/dist/adhoc-editor/ElementsTree.js +142 -0
- package/dist/adhoc-editor/LikeC4AdHocViewEditor.d.ts +4 -0
- package/dist/adhoc-editor/LikeC4AdHocViewEditor.js +74 -0
- package/dist/adhoc-editor/components/Tree.d.ts +48 -0
- package/dist/adhoc-editor/components/Tree.js +296 -0
- package/dist/adhoc-editor/hooks.d.ts +14 -0
- package/dist/adhoc-editor/hooks.js +29 -0
- package/dist/adhoc-editor/index.d.ts +2 -0
- package/dist/adhoc-editor/index.js +1 -0
- package/dist/adhoc-editor/state/ActorProvider.d.ts +5 -0
- package/dist/adhoc-editor/state/ActorProvider.js +40 -0
- package/dist/adhoc-editor/state/actor.d.ts +13 -0
- package/dist/adhoc-editor/state/actor.editor.d.ts +56 -0
- package/dist/adhoc-editor/state/actor.editor.js +205 -0
- package/dist/adhoc-editor/state/actor.js +16 -0
- package/dist/adhoc-editor/state/actor.layouter.d.ts +51 -0
- package/dist/adhoc-editor/state/actor.layouter.js +70 -0
- package/dist/adhoc-editor/state/actor.types.d.ts +63 -0
- package/dist/adhoc-editor/state/actor.types.js +29 -0
- package/dist/adhoc-editor/state/panel.d.ts +95 -0
- package/dist/adhoc-editor/state/panel.js +139 -0
- package/dist/adhoc-editor/state/utils.d.ts +17 -0
- package/dist/adhoc-editor/state/utils.js +32 -0
- package/dist/adhoc-editor/useElementsTree.d.ts +18 -0
- package/dist/adhoc-editor/useElementsTree.js +130 -0
- package/dist/adhoc-editor/viewrules/ViewRulesPanel.d.ts +6 -0
- package/dist/base/const.d.ts +2 -0
- package/dist/base/const.js +2 -1
- package/dist/base/updateEdges.js +26 -3
- package/dist/base/updateNodes.js +8 -5
- package/dist/base-primitives/Markdown.d.ts +1 -1
- package/dist/base-primitives/Markdown.js +1 -1
- package/dist/base-primitives/NodeHandles.d.ts +4 -2
- package/dist/base-primitives/NodeHandles.js +46 -19
- package/dist/base-primitives/compound/CompoundActionButton.js +28 -12
- package/dist/base-primitives/compound/CompoundDetailsButton.js +24 -9
- package/dist/base-primitives/compound/CompoundNodeContainer.js +11 -8
- package/dist/base-primitives/compound/CompoundTitle.js +1 -2
- package/dist/base-primitives/compound/actionbtns.css.d.ts +1 -1
- package/dist/base-primitives/edge/EdgeActionButton.js +1 -1
- package/dist/base-primitives/edge/EdgeContainer.js +5 -2
- package/dist/base-primitives/edge/EdgeLabel.js +3 -4
- package/dist/base-primitives/edge/EdgeLabelContainer.d.ts +2 -1
- package/dist/base-primitives/edge/EdgeLabelContainer.js +17 -20
- package/dist/base-primitives/element/ElementActionButtons.js +57 -59
- package/dist/base-primitives/element/ElementData.d.ts +7 -7
- package/dist/base-primitives/element/ElementData.js +61 -48
- package/dist/base-primitives/element/ElementDetailsButton.js +48 -18
- package/dist/base-primitives/element/ElementNodeContainer.d.ts +5 -5
- package/dist/base-primitives/element/ElementNodeContainer.js +24 -10
- package/dist/base-primitives/element/ElementShape.d.ts +2 -2
- package/dist/base-primitives/element/ElementShape.js +70 -7
- package/dist/base-primitives/element/ElementTags.d.ts +6 -2
- package/dist/base-primitives/element/ElementTags.js +55 -32
- package/dist/base-primitives/index.d.ts +1 -1
- package/dist/base-primitives/memoEdge.js +1 -1
- package/dist/base-primitives/memoNode.js +1 -1
- package/dist/components/ErrorFallback.js +1 -1
- package/dist/components/Link.js +3 -3
- package/dist/components/NavigationPanel.d.ts +2 -2
- package/dist/components/NavigationPanel.js +5 -26
- package/dist/components/PortalToContainer.js +3 -4
- package/dist/components/RootContainer.js +9 -19
- package/dist/components/ViewNotFound.d.ts +3 -3
- package/dist/components/ViewNotFound.js +30 -26
- package/dist/context/CurrentViewModelProvider.d.ts +2 -0
- package/dist/context/CurrentViewModelProvider.js +12 -0
- package/dist/context/DefaultMantineProvider.d.ts +2 -0
- package/dist/context/DefaultMantineProvider.js +75 -0
- package/dist/context/DiagramEventHandlers.d.ts +5 -5
- package/dist/context/DiagramEventHandlers.js +10 -4
- package/dist/context/DiagramFeatures.d.ts +8 -7
- package/dist/context/DiagramFeatures.js +16 -13
- package/dist/context/EnsureMantine.d.ts +0 -3
- package/dist/context/EnsureMantine.js +3 -4
- package/dist/context/FramerMotionConfig.d.ts +1 -3
- package/dist/context/IconRenderer.d.ts +19 -4
- package/dist/context/IconRenderer.js +52 -25
- package/dist/context/LikeC4ModelContext.d.ts +10 -5
- package/dist/context/LikeC4ModelContext.js +11 -3
- package/dist/context/LikeC4ProjectsContext.d.ts +3 -2
- package/dist/context/LikeC4ProjectsContext.js +6 -2
- package/dist/context/RootContainerContext.d.ts +10 -3
- package/dist/context/RootContainerContext.js +8 -3
- package/dist/context/TagStylesContext.js +13 -5
- package/dist/custom/hooks.d.ts +2 -2
- package/dist/custom/index.d.ts +1 -1
- package/dist/custom/index.js +16 -15
- package/dist/editor/LikeC4EditorCallbacks.d.ts +18 -0
- package/dist/editor/LikeC4EditorCallbacks.js +5 -0
- package/dist/editor/LikeC4EditorProvider.d.ts +30 -18
- package/dist/editor/LikeC4EditorProvider.js +3 -3
- package/dist/editor/applyChangesToManualLayout.js +7 -6
- package/dist/editor/editorActor.actions.d.ts +25 -25
- package/dist/editor/editorActor.actions.js +22 -22
- package/dist/editor/editorActor.setup.d.ts +84 -0
- package/dist/editor/editorActor.setup.js +38 -0
- package/dist/editor/editorActor.states.d.ts +9 -0
- package/dist/editor/{editorActor.js → editorActor.states.js} +21 -72
- package/dist/editor/index.d.ts +4 -3
- package/dist/editor/useEditorActorLogic.d.ts +2 -565
- package/dist/editor/useEditorActorLogic.js +14 -21
- package/dist/hooks/index.d.ts +3 -3
- package/dist/hooks/safeContext.d.ts +4 -5
- package/dist/hooks/useCallbackRef.d.ts +6 -0
- package/dist/hooks/useCallbackRef.js +7 -6
- package/dist/hooks/useCurrentView.js +5 -10
- package/dist/hooks/useCurrentViewModel.d.ts +8 -2
- package/dist/hooks/useCurrentViewModel.js +3 -7
- package/dist/hooks/useDiagram.d.ts +9 -1
- package/dist/hooks/useDiagram.js +10 -4
- package/dist/hooks/useDiagramCompareLayout.d.ts +6 -6
- package/dist/hooks/useDiagramCompareLayout.js +1 -1
- package/dist/hooks/useLikeC4ElementsTree.d.ts +1 -1
- package/dist/hooks/useLikeC4ElementsTree.js +2 -2
- package/dist/hooks/useLikeC4Model.d.ts +6 -2
- package/dist/hooks/useLikeC4Model.js +7 -9
- package/dist/hooks/useLikeC4Project.d.ts +4 -6
- package/dist/hooks/useLikeC4Project.js +19 -31
- package/dist/hooks/useLikeC4Styles.js +3 -9
- package/dist/hooks/useMantinePortalProps.d.ts +1 -1
- package/dist/hooks/useMediaPrint.d.ts +0 -2
- package/dist/hooks/useOverlaysActor.js +4 -4
- package/dist/hooks/useSearchActor.js +4 -4
- package/dist/hooks/useSetState.d.ts +6 -1
- package/dist/hooks/useSetState.js +7 -4
- package/dist/hooks/useXYFlow.d.ts +7 -1
- package/dist/hooks/useXYFlow.js +4 -4
- package/dist/index.d.ts +5 -4
- package/dist/index.js +3 -1
- package/dist/likec4diagram/DiagramUI.js +1 -3
- package/dist/likec4diagram/DiagramXYFlow.d.ts +2 -1
- package/dist/likec4diagram/DiagramXYFlow.js +29 -18
- package/dist/likec4diagram/convert-to-xyflow.d.ts +2 -1
- package/dist/likec4diagram/convert-to-xyflow.js +2 -6
- package/dist/likec4diagram/custom/edges/RelationshipEdge.js +34 -37
- package/dist/likec4diagram/custom/edges/edges.css.js +2 -1
- package/dist/likec4diagram/custom/edges/useControlPoints.js +3 -3
- package/dist/likec4diagram/custom/edges/useRelationshipEdgePath.d.ts +3 -0
- package/dist/likec4diagram/custom/edges/useRelationshipEdgePath.js +52 -34
- package/dist/likec4diagram/custom/nodes/ElementActions.d.ts +1 -2
- package/dist/likec4diagram/custom/nodes/ElementActions.js +7 -10
- package/dist/likec4diagram/custom/nodes/NodeDrifts.d.ts +1 -2
- package/dist/likec4diagram/custom/nodes/NodeDrifts.js +3 -20
- package/dist/likec4diagram/custom/nodes/NodeNotes.d.ts +6 -0
- package/dist/likec4diagram/custom/nodes/NodeNotes.js +286 -0
- package/dist/likec4diagram/custom/nodes/SequenceActorNode.js +10 -6
- package/dist/likec4diagram/custom/nodes/nodes.js +30 -8
- package/dist/likec4diagram/custom/nodes/toolbar/ColorButton.js +5 -4
- package/dist/likec4diagram/custom/nodes/toolbar/ElementToolbar.d.ts +6 -1
- package/dist/likec4diagram/custom/nodes/toolbar/ElementToolbar.js +14 -9
- package/dist/likec4diagram/custom/nodes/toolbar/_shared.js +4 -4
- package/dist/likec4diagram/custom/nodes/toolbar/styles.css.js +3 -3
- package/dist/likec4diagram/relationship-popover/RelationshipPopover.js +16 -36
- package/dist/likec4diagram/relationship-popover/components.d.ts +7 -0
- package/dist/likec4diagram/relationship-popover/components.js +39 -0
- package/dist/likec4diagram/state/DiagramActorProvider.d.ts +4 -3
- package/dist/likec4diagram/state/DiagramActorProvider.js +39 -66
- package/dist/likec4diagram/state/assign.d.ts +1 -1
- package/dist/likec4diagram/state/createViewChange.js +16 -4
- package/dist/likec4diagram/state/diagram-api.d.ts +11 -0
- package/dist/likec4diagram/state/diagram-api.js +15 -0
- package/dist/likec4diagram/state/machine.actions.d.ts +92 -0
- package/dist/likec4diagram/state/machine.actions.js +127 -58
- package/dist/likec4diagram/state/machine.actions.layout.d.ts +23 -2
- package/dist/likec4diagram/state/machine.actions.layout.js +68 -15
- package/dist/likec4diagram/state/machine.d.ts +1 -1
- package/dist/likec4diagram/state/machine.js +35 -31
- package/dist/likec4diagram/state/machine.setup.d.ts +40 -7
- package/dist/likec4diagram/state/machine.setup.js +13 -4
- package/dist/likec4diagram/state/machine.state.initializing.d.ts +32 -2
- package/dist/likec4diagram/state/machine.state.navigating.d.ts +1 -1
- package/dist/likec4diagram/state/machine.state.navigating.js +82 -50
- package/dist/likec4diagram/state/machine.state.ready.d.ts +565 -579
- package/dist/likec4diagram/state/machine.state.ready.focused.d.ts +17 -148
- package/dist/likec4diagram/state/machine.state.ready.focused.js +6 -14
- package/dist/likec4diagram/state/machine.state.ready.idle.d.ts +11 -96
- package/dist/likec4diagram/state/machine.state.ready.idle.js +7 -12
- package/dist/likec4diagram/state/machine.state.ready.js +89 -70
- package/dist/likec4diagram/state/machine.state.ready.printing.d.ts +4 -0
- package/dist/likec4diagram/state/machine.state.ready.printing.js +4 -3
- package/dist/likec4diagram/state/machine.state.ready.walkthrough.d.ts +145 -2
- package/dist/likec4diagram/state/machine.state.ready.walkthrough.js +29 -21
- package/dist/likec4diagram/state/types.d.ts +1 -1
- package/dist/likec4diagram/state/utils.d.ts +14 -14
- package/dist/likec4diagram/state/utils.js +12 -4
- package/dist/likec4diagram/types.d.ts +11 -3
- package/dist/likec4diagram/ui/notation/NotationPanel.css.js +2 -2
- package/dist/likec4diagram/ui/notation/NotationPanel.js +3 -3
- package/dist/likec4diagram/useLayoutConstraints.d.ts +12 -12
- package/dist/likec4diagram/useLayoutConstraints.js +126 -84
- package/dist/likec4diagram/xyflow-diagram/diagram-view.d.ts +11 -3
- package/dist/likec4diagram/xyflow-diagram/diagram-view.js +7 -3
- package/dist/likec4diagram/xyflow-sequence/sequence-layout.d.ts +7 -3
- package/dist/likec4diagram/xyflow-sequence/sequence-layout.js +15 -8
- package/dist/navigationpanel/NavigationPanel.js +4 -3
- package/dist/navigationpanel/NavigationPanelControls.js +4 -2
- package/dist/navigationpanel/NavigationPanelDropdown.js +13 -13
- package/dist/navigationpanel/_common.d.ts +1 -1
- package/dist/navigationpanel/_common.js +2 -3
- package/dist/navigationpanel/actor.js +1 -1
- package/dist/navigationpanel/comparepanel/CompareActionsMenu.js +2 -2
- package/dist/navigationpanel/comparepanel/ComparePanel.js +155 -29
- package/dist/navigationpanel/comparepanel/ComparePanelControls.js +1 -1
- package/dist/navigationpanel/comparepanel/DriftsSummary.d.ts +1 -0
- package/dist/navigationpanel/comparepanel/DriftsSummary.js +264 -0
- package/dist/navigationpanel/comparepanel/LayoutTypeSwitcher.js +4 -5
- package/dist/navigationpanel/controls/DetailsControls.js +7 -7
- package/dist/navigationpanel/controls/LayoutWarning.js +2 -2
- package/dist/navigationpanel/controls/LogoButton.js +1 -1
- package/dist/navigationpanel/controls/NavigationButtons.js +2 -2
- package/dist/navigationpanel/controls/OpenSource.js +1 -1
- package/dist/navigationpanel/controls/SearchControl.d.ts +1 -2
- package/dist/navigationpanel/controls/SearchControl.js +8 -12
- package/dist/navigationpanel/controls/ToggleReadonly.js +5 -6
- package/dist/navigationpanel/dropdown/ProjectsMenu.js +12 -6
- 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/editorpanel/styles.js +4 -4
- package/dist/navigationpanel/styles.css.d.ts +1 -1
- package/dist/navigationpanel/styles.css.js +1 -1
- package/dist/navigationpanel/walkthrough/ActiveWalkthroughControls.js +6 -6
- package/dist/navigationpanel/walkthrough/DynamicViewControls.d.ts +77 -77
- package/dist/navigationpanel/walkthrough/DynamicViewControls.js +1 -1
- package/dist/navigationpanel/walkthrough/WalkthroughPanel.js +2 -2
- package/dist/node_modules/.pnpm/{@tabler_icons-react@3.36.0_react@19.2.3 → @tabler_icons-react@3.36.1_react@19.2.4}/node_modules/@tabler/icons-react/dist/esm/createReactComponent.js +1 -1
- package/dist/node_modules/.pnpm/{@tabler_icons-react@3.36.0_react@19.2.3 → @tabler_icons-react@3.36.1_react@19.2.4}/node_modules/@tabler/icons-react/dist/esm/defaultAttributes.js +1 -1
- package/dist/node_modules/.pnpm/{@tabler_icons-react@3.36.0_react@19.2.3 → @tabler_icons-react@3.36.1_react@19.2.4}/node_modules/@tabler/icons-react/dist/esm/icons/IconAlertTriangle.js +2 -2
- package/dist/node_modules/.pnpm/{@tabler_icons-react@3.36.0_react@19.2.3 → @tabler_icons-react@3.36.1_react@19.2.4}/node_modules/@tabler/icons-react/dist/esm/icons/IconArrowDownRight.js +1 -1
- package/dist/node_modules/.pnpm/{@tabler_icons-react@3.36.0_react@19.2.3 → @tabler_icons-react@3.36.1_react@19.2.4}/node_modules/@tabler/icons-react/dist/esm/icons/IconArrowLeft.js +1 -1
- package/dist/node_modules/.pnpm/{@tabler_icons-react@3.36.0_react@19.2.3 → @tabler_icons-react@3.36.1_react@19.2.4}/node_modules/@tabler/icons-react/dist/esm/icons/IconArrowRight.js +1 -1
- package/dist/node_modules/.pnpm/{@tabler_icons-react@3.36.0_react@19.2.3 → @tabler_icons-react@3.36.1_react@19.2.4}/node_modules/@tabler/icons-react/dist/esm/icons/IconBolt.js +1 -1
- package/dist/node_modules/.pnpm/{@tabler_icons-react@3.36.0_react@19.2.3 → @tabler_icons-react@3.36.1_react@19.2.4}/node_modules/@tabler/icons-react/dist/esm/icons/IconBrowser.js +2 -2
- package/dist/node_modules/.pnpm/{@tabler_icons-react@3.36.0_react@19.2.3 → @tabler_icons-react@3.36.1_react@19.2.4}/node_modules/@tabler/icons-react/dist/esm/icons/IconCheck.js +1 -1
- package/dist/node_modules/.pnpm/{@tabler_icons-react@3.36.0_react@19.2.3 → @tabler_icons-react@3.36.1_react@19.2.4}/node_modules/@tabler/icons-react/dist/esm/icons/IconChevronDown.js +1 -1
- package/dist/node_modules/.pnpm/{@tabler_icons-react@3.36.0_react@19.2.3 → @tabler_icons-react@3.36.1_react@19.2.4}/node_modules/@tabler/icons-react/dist/esm/icons/IconChevronLeft.js +1 -1
- package/dist/node_modules/.pnpm/{@tabler_icons-react@3.36.0_react@19.2.3 → @tabler_icons-react@3.36.1_react@19.2.4}/node_modules/@tabler/icons-react/dist/esm/icons/IconChevronRight.js +1 -1
- package/dist/node_modules/.pnpm/@tabler_icons-react@3.36.1_react@19.2.4/node_modules/@tabler/icons-react/dist/esm/icons/IconCopy.js +14 -0
- package/dist/node_modules/.pnpm/{@tabler_icons-react@3.36.0_react@19.2.3 → @tabler_icons-react@3.36.1_react@19.2.4}/node_modules/@tabler/icons-react/dist/esm/icons/IconCylinder.js +2 -2
- package/dist/node_modules/.pnpm/{@tabler_icons-react@3.36.0_react@19.2.3 → @tabler_icons-react@3.36.1_react@19.2.4}/node_modules/@tabler/icons-react/dist/esm/icons/IconDeviceMobile.js +2 -2
- package/dist/node_modules/.pnpm/{@tabler_icons-react@3.36.0_react@19.2.3 → @tabler_icons-react@3.36.1_react@19.2.4}/node_modules/@tabler/icons-react/dist/esm/icons/IconDirectionSignFilled.js +1 -1
- package/dist/node_modules/.pnpm/{@tabler_icons-react@3.36.0_react@19.2.3 → @tabler_icons-react@3.36.1_react@19.2.4}/node_modules/@tabler/icons-react/dist/esm/icons/IconExternalLink.js +1 -1
- package/dist/node_modules/.pnpm/{@tabler_icons-react@3.36.0_react@19.2.3 → @tabler_icons-react@3.36.1_react@19.2.4}/node_modules/@tabler/icons-react/dist/esm/icons/IconFileSymlink.js +1 -1
- package/dist/node_modules/.pnpm/{@tabler_icons-react@3.36.0_react@19.2.3 → @tabler_icons-react@3.36.1_react@19.2.4}/node_modules/@tabler/icons-react/dist/esm/icons/IconFileText.js +2 -2
- package/dist/node_modules/.pnpm/@tabler_icons-react@3.36.1_react@19.2.4/node_modules/@tabler/icons-react/dist/esm/icons/IconFocusCentered.js +14 -0
- package/dist/node_modules/.pnpm/{@tabler_icons-react@3.36.0_react@19.2.3 → @tabler_icons-react@3.36.1_react@19.2.4}/node_modules/@tabler/icons-react/dist/esm/icons/IconFolderFilled.js +1 -1
- package/dist/node_modules/.pnpm/{@tabler_icons-react@3.36.0_react@19.2.3 → @tabler_icons-react@3.36.1_react@19.2.4}/node_modules/@tabler/icons-react/dist/esm/icons/IconHelpCircle.js +1 -1
- package/dist/node_modules/.pnpm/@tabler_icons-react@3.36.1_react@19.2.4/node_modules/@tabler/icons-react/dist/esm/icons/IconId.js +14 -0
- package/dist/node_modules/.pnpm/{@tabler_icons-react@3.36.0_react@19.2.3 → @tabler_icons-react@3.36.1_react@19.2.4}/node_modules/@tabler/icons-react/dist/esm/icons/IconInfoCircle.js +1 -1
- package/dist/node_modules/.pnpm/{@tabler_icons-react@3.36.0_react@19.2.3 → @tabler_icons-react@3.36.1_react@19.2.4}/node_modules/@tabler/icons-react/dist/esm/icons/IconLayoutAlignBottom.js +2 -2
- package/dist/node_modules/.pnpm/{@tabler_icons-react@3.36.0_react@19.2.3 → @tabler_icons-react@3.36.1_react@19.2.4}/node_modules/@tabler/icons-react/dist/esm/icons/IconLayoutAlignCenter.js +2 -2
- package/dist/node_modules/.pnpm/{@tabler_icons-react@3.36.0_react@19.2.3 → @tabler_icons-react@3.36.1_react@19.2.4}/node_modules/@tabler/icons-react/dist/esm/icons/IconLayoutAlignLeft.js +2 -2
- package/dist/node_modules/.pnpm/{@tabler_icons-react@3.36.0_react@19.2.3 → @tabler_icons-react@3.36.1_react@19.2.4}/node_modules/@tabler/icons-react/dist/esm/icons/IconLayoutAlignMiddle.js +2 -2
- package/dist/node_modules/.pnpm/{@tabler_icons-react@3.36.0_react@19.2.3 → @tabler_icons-react@3.36.1_react@19.2.4}/node_modules/@tabler/icons-react/dist/esm/icons/IconLayoutAlignRight.js +2 -2
- package/dist/node_modules/.pnpm/{@tabler_icons-react@3.36.0_react@19.2.3 → @tabler_icons-react@3.36.1_react@19.2.4}/node_modules/@tabler/icons-react/dist/esm/icons/IconLayoutAlignTop.js +2 -2
- package/dist/node_modules/.pnpm/{@tabler_icons-react@3.36.0_react@19.2.3 → @tabler_icons-react@3.36.1_react@19.2.4}/node_modules/@tabler/icons-react/dist/esm/icons/IconLayoutBoardSplit.js +2 -2
- package/dist/node_modules/.pnpm/{@tabler_icons-react@3.36.0_react@19.2.3 → @tabler_icons-react@3.36.1_react@19.2.4}/node_modules/@tabler/icons-react/dist/esm/icons/IconLayoutCollage.js +2 -2
- package/dist/node_modules/.pnpm/{@tabler_icons-react@3.36.0_react@19.2.3 → @tabler_icons-react@3.36.1_react@19.2.4}/node_modules/@tabler/icons-react/dist/esm/icons/IconLayoutDashboard.js +1 -1
- package/dist/node_modules/.pnpm/{@tabler_icons-react@3.36.0_react@19.2.3 → @tabler_icons-react@3.36.1_react@19.2.4}/node_modules/@tabler/icons-react/dist/esm/icons/IconLink.js +1 -1
- package/dist/node_modules/.pnpm/{@tabler_icons-react@3.36.0_react@19.2.3 → @tabler_icons-react@3.36.1_react@19.2.4}/node_modules/@tabler/icons-react/dist/esm/icons/IconLock.js +2 -2
- package/dist/node_modules/.pnpm/{@tabler_icons-react@3.36.0_react@19.2.3 → @tabler_icons-react@3.36.1_react@19.2.4}/node_modules/@tabler/icons-react/dist/esm/icons/IconLockOpen2.js +2 -2
- package/dist/node_modules/.pnpm/{@tabler_icons-react@3.36.0_react@19.2.3 → @tabler_icons-react@3.36.1_react@19.2.4}/node_modules/@tabler/icons-react/dist/esm/icons/IconPlayerPlayFilled.js +1 -1
- package/dist/node_modules/.pnpm/{@tabler_icons-react@3.36.0_react@19.2.3 → @tabler_icons-react@3.36.1_react@19.2.4}/node_modules/@tabler/icons-react/dist/esm/icons/IconPlayerSkipBackFilled.js +1 -1
- package/dist/node_modules/.pnpm/{@tabler_icons-react@3.36.0_react@19.2.3 → @tabler_icons-react@3.36.1_react@19.2.4}/node_modules/@tabler/icons-react/dist/esm/icons/IconPlayerSkipForwardFilled.js +1 -1
- package/dist/node_modules/.pnpm/{@tabler_icons-react@3.36.0_react@19.2.3 → @tabler_icons-react@3.36.1_react@19.2.4}/node_modules/@tabler/icons-react/dist/esm/icons/IconPlayerStopFilled.js +1 -1
- package/dist/node_modules/.pnpm/{@tabler_icons-react@3.36.0_react@19.2.3 → @tabler_icons-react@3.36.1_react@19.2.4}/node_modules/@tabler/icons-react/dist/esm/icons/IconRectangularPrism.js +2 -2
- package/dist/node_modules/.pnpm/{@tabler_icons-react@3.36.0_react@19.2.3 → @tabler_icons-react@3.36.1_react@19.2.4}/node_modules/@tabler/icons-react/dist/esm/icons/IconReorder.js +2 -2
- package/dist/node_modules/.pnpm/@tabler_icons-react@3.36.1_react@19.2.4/node_modules/@tabler/icons-react/dist/esm/icons/IconRouteOff.js +14 -0
- package/dist/node_modules/.pnpm/{@tabler_icons-react@3.36.0_react@19.2.3 → @tabler_icons-react@3.36.1_react@19.2.4}/node_modules/@tabler/icons-react/dist/esm/icons/IconSearch.js +2 -2
- package/dist/node_modules/.pnpm/{@tabler_icons-react@3.36.0_react@19.2.3 → @tabler_icons-react@3.36.1_react@19.2.4}/node_modules/@tabler/icons-react/dist/esm/icons/IconSelector.js +1 -1
- package/dist/node_modules/.pnpm/{@tabler_icons-react@3.36.0_react@19.2.3 → @tabler_icons-react@3.36.1_react@19.2.4}/node_modules/@tabler/icons-react/dist/esm/icons/IconStack2.js +1 -1
- package/dist/node_modules/.pnpm/{@tabler_icons-react@3.36.0_react@19.2.3 → @tabler_icons-react@3.36.1_react@19.2.4}/node_modules/@tabler/icons-react/dist/esm/icons/IconStarFilled.js +1 -1
- package/dist/node_modules/.pnpm/{@tabler_icons-react@3.36.0_react@19.2.3 → @tabler_icons-react@3.36.1_react@19.2.4}/node_modules/@tabler/icons-react/dist/esm/icons/IconTarget.js +2 -2
- package/dist/node_modules/.pnpm/{@tabler_icons-react@3.36.0_react@19.2.3 → @tabler_icons-react@3.36.1_react@19.2.4}/node_modules/@tabler/icons-react/dist/esm/icons/IconTransform.js +1 -1
- package/dist/node_modules/.pnpm/@tabler_icons-react@3.36.1_react@19.2.4/node_modules/@tabler/icons-react/dist/esm/icons/IconTrash.js +14 -0
- package/dist/node_modules/.pnpm/{@tabler_icons-react@3.36.0_react@19.2.3 → @tabler_icons-react@3.36.1_react@19.2.4}/node_modules/@tabler/icons-react/dist/esm/icons/IconUser.js +1 -1
- package/dist/node_modules/.pnpm/{@tabler_icons-react@3.36.0_react@19.2.3 → @tabler_icons-react@3.36.1_react@19.2.4}/node_modules/@tabler/icons-react/dist/esm/icons/IconX.js +1 -1
- package/dist/node_modules/.pnpm/{@tabler_icons-react@3.36.0_react@19.2.3 → @tabler_icons-react@3.36.1_react@19.2.4}/node_modules/@tabler/icons-react/dist/esm/icons/IconZoomScan.js +1 -1
- package/dist/node_modules/.pnpm/@xstate_store@3.14.0_react@19.2.4/node_modules/@xstate/store/dist/store-1b2fbb72.cjs.js +742 -0
- package/dist/node_modules/.pnpm/@xstate_store@3.14.0_react@19.2.4/node_modules/@xstate/store/react/dist/xstate-store-react.cjs.js +175 -0
- package/dist/overlays/element-details/ElementDetailsCard.css.js +15 -15
- package/dist/overlays/element-details/ElementDetailsCard.js +39 -40
- package/dist/overlays/element-details/MetadataValue.js +11 -12
- package/dist/overlays/element-details/TabPanelDeployments.js +8 -6
- package/dist/overlays/element-details/TabPanelRelationships.css.js +10 -30
- package/dist/overlays/element-details/TabPanelRelationships.js +4 -5
- package/dist/overlays/element-details/TabPanelStructure.css.js +3 -3
- package/dist/overlays/element-details/TabPanelStructure.js +3 -2
- package/dist/overlays/overlaysActor.js +19 -1
- package/dist/overlays/relationship-details/RelationshipDetails.d.ts +0 -5
- package/dist/overlays/relationship-details/RelationshipDetails.js +4 -4
- package/dist/overlays/relationship-details/SelectEdge.css.js +6 -6
- package/dist/overlays/relationship-details/SelectEdge.js +2 -2
- package/dist/overlays/relationship-details/compute.js +1 -1
- package/dist/overlays/relationship-details/custom/ElementActions.js +3 -3
- package/dist/overlays/relationship-details/custom/nodeTypes.js +14 -1
- package/dist/overlays/relationship-details/layout.js +1 -1
- package/dist/overlays/relationships-browser/RelationshipsBrowser.d.ts +0 -5
- package/dist/overlays/relationships-browser/RelationshipsBrowser.js +116 -21
- package/dist/overlays/relationships-browser/SelectElement.css.js +2 -2
- package/dist/overlays/relationships-browser/SelectElement.js +2 -2
- package/dist/overlays/relationships-browser/actor.js +1 -1
- package/dist/overlays/relationships-browser/custom/ElementActions.js +3 -3
- package/dist/overlays/relationships-browser/custom/EmptyNode.js +21 -6
- package/dist/overlays/relationships-browser/custom/nodeTypes.js +14 -1
- package/dist/overlays/relationships-browser/layout.d.ts +1 -1
- package/dist/overlays/relationships-browser/layout.js +1 -1
- package/dist/overlays/relationships-browser/useViewToNodesEdges.js +1 -1
- package/dist/projects-overview/ProjectsOverview.js +2 -2
- package/dist/projects-overview/ProjectsOverviewXY.d.ts +1 -5
- package/dist/projects-overview/ProjectsOverviewXY.js +1 -1
- package/dist/projects-overview/actor.d.ts +1 -1
- package/dist/projects-overview/actor.js +8 -31
- package/dist/projects-overview/context.d.ts +2 -2
- package/dist/projects-overview/context.js +2 -1
- package/dist/projects-overview/custom/nodeTypes.js +1 -1
- package/dist/projects-overview/panel/ProjectsOverviewPanel.js +1 -1
- package/dist/search/Search.d.ts +2 -4
- package/dist/search/Search.js +67 -44
- package/dist/search/components/ElementsColumn.css.js +6 -6
- package/dist/search/components/ElementsColumn.js +93 -60
- package/dist/search/components/PickView.d.ts +3 -1
- package/dist/search/components/PickView.js +12 -7
- package/dist/search/components/SearchByTags.js +1 -1
- package/dist/search/components/SearchInput.js +2 -2
- package/dist/search/components/ViewsColum.d.ts +2 -1
- package/dist/search/components/ViewsColum.js +39 -35
- package/dist/search/components/ViewsColumn.css.js +1 -1
- package/dist/search/components/_shared.css.d.ts +1 -1
- package/dist/search/components/_shared.css.js +12 -12
- package/dist/search/components/utils.js +1 -4
- package/dist/search/hooks.d.ts +1 -6
- package/dist/search/hooks.js +15 -9
- package/dist/search/searchActor.d.ts +12 -2
- package/dist/search/searchActor.js +60 -4
- package/dist/shadowroot/ShadowRoot.d.ts +5 -2
- package/dist/shadowroot/ShadowRoot.js +25 -22
- package/dist/shadowroot/styles.css.d.ts +0 -2
- package/dist/shadowroot/styles.css.js +4 -36
- package/dist/styles-font.css2.js +1 -1
- package/dist/styles.css2.js +1 -1
- package/dist/utils/view-bounds.d.ts +3 -2
- package/dist/utils/view-bounds.js +10 -6
- package/dist/utils/xyflow.d.ts +27 -6
- package/dist/utils/xyflow.js +68 -23
- package/package.json +39 -37
- package/panda.buildinfo.json +226 -161
- package/styles-font.css +1 -1
- package/styles-min.css +1 -1
- package/styles.css +1 -1
- package/bundle/index.js +0 -51974
- package/bundle/package.json +0 -4
- package/dist/editor/__tests__/fixture.d.ts +0 -205
- package/dist/editor/editorActor.d.ts +0 -653
- package/dist/likec4diagram/relationship-popover/styles.css.d.ts +0 -2
- package/dist/likec4diagram/relationship-popover/styles.css.js +0 -28
- package/dist/node_modules/.pnpm/@tabler_icons-react@3.36.0_react@19.2.3/node_modules/@tabler/icons-react/dist/esm/icons/IconCopy.js +0 -14
- package/dist/node_modules/.pnpm/@tabler_icons-react@3.36.0_react@19.2.3/node_modules/@tabler/icons-react/dist/esm/icons/IconFocusCentered.js +0 -14
- package/dist/node_modules/.pnpm/@tabler_icons-react@3.36.0_react@19.2.3/node_modules/@tabler/icons-react/dist/esm/icons/IconId.js +0 -14
- package/dist/node_modules/.pnpm/@tabler_icons-react@3.36.0_react@19.2.3/node_modules/@tabler/icons-react/dist/esm/icons/IconRouteOff.js +0 -14
- package/dist/overlays/relationships-browser/custom/styles.css.d.ts +0 -1
- package/dist/overlays/relationships-browser/custom/styles.css.js +0 -14
|
@@ -3,15 +3,15 @@ import { nonNullable } from '@likec4/core';
|
|
|
3
3
|
import { cx } from '@likec4/styles/css';
|
|
4
4
|
import { useTimeout, useDebouncedCallback } from '@mantine/hooks';
|
|
5
5
|
import { useCustomCompareMemo } from '@react-hookz/web';
|
|
6
|
-
import { shallowEqual } from 'fast-equals';
|
|
7
6
|
import { isEmpty } from 'remeda';
|
|
8
7
|
import { memoNode } from '../base-primitives/memoNode.js';
|
|
9
8
|
import { BaseXYFlow } from '../base/BaseXYFlow.js';
|
|
10
9
|
import { useIsReducedGraphics, usePanningAtom } from '../context/RootContainerContext.js';
|
|
11
|
-
import {
|
|
10
|
+
import { useDiagramSnapshot, selectDiagramActor } from '../hooks/useDiagram.js';
|
|
12
11
|
import { depsShallowEqual, useUpdateEffect } from '../hooks/useUpdateEffect.js';
|
|
13
12
|
import { BuiltinEdges, BuiltinNodes } from './custom/index.js';
|
|
14
13
|
import { deriveToggledFeatures } from './state/machine.setup.js';
|
|
14
|
+
import { viewBounds } from './state/utils.js';
|
|
15
15
|
import { useLayoutConstraints } from './useLayoutConstraints.js';
|
|
16
16
|
import { useDiagram } from '../hooks/safeContext.js';
|
|
17
17
|
import { useDiagramEventHandlers } from '../context/DiagramEventHandlers.js';
|
|
@@ -44,9 +44,21 @@ function prepareNodeTypes(nodeTypes) {
|
|
|
44
44
|
"seq-parallel": nodeTypes.seqParallel ?? builtinNodes["seq-parallel"]
|
|
45
45
|
};
|
|
46
46
|
}
|
|
47
|
-
const
|
|
47
|
+
const viewportToTopLeft = (ctx) => {
|
|
48
|
+
const bounds = viewBounds(ctx);
|
|
49
|
+
return {
|
|
50
|
+
x: -bounds.x,
|
|
51
|
+
y: -bounds.y,
|
|
52
|
+
zoom: 1
|
|
53
|
+
};
|
|
54
|
+
};
|
|
55
|
+
const selectXYProps = selectDiagramActor(({ context: ctx, children }) => {
|
|
48
56
|
const { enableReadOnly } = deriveToggledFeatures(ctx);
|
|
49
57
|
const isNotEditingEdge = enableReadOnly || children.editor?.getSnapshot().context.editing !== "edge";
|
|
58
|
+
let nodesDraggable = !enableReadOnly && ctx.nodesDraggable;
|
|
59
|
+
if (ctx.dynamicViewVariant === "sequence" && ctx.view._type === "dynamic") {
|
|
60
|
+
nodesDraggable = false;
|
|
61
|
+
}
|
|
50
62
|
return {
|
|
51
63
|
enableReadOnly,
|
|
52
64
|
initialized: ctx.initialized.xydata && ctx.initialized.xyflow,
|
|
@@ -54,20 +66,15 @@ const selectXYProps = ({ context: ctx, children }) => {
|
|
|
54
66
|
edges: ctx.xyedges,
|
|
55
67
|
pannable: ctx.pannable,
|
|
56
68
|
zoomable: ctx.zoomable,
|
|
57
|
-
nodesDraggable
|
|
69
|
+
nodesDraggable,
|
|
58
70
|
nodesSelectable: ctx.nodesSelectable && isNotEditingEdge,
|
|
59
71
|
fitViewPadding: ctx.fitViewPadding,
|
|
60
72
|
enableFitView: ctx.features.enableFitView,
|
|
61
73
|
...!ctx.features.enableFitView && {
|
|
62
|
-
viewport:
|
|
63
|
-
x: -ctx.view.bounds.x,
|
|
64
|
-
y: -ctx.view.bounds.y,
|
|
65
|
-
zoom: 1
|
|
66
|
-
}
|
|
74
|
+
viewport: viewportToTopLeft(ctx)
|
|
67
75
|
}
|
|
68
76
|
};
|
|
69
|
-
};
|
|
70
|
-
const equalsXYProps = (a, b) => a.enableReadOnly === b.enableReadOnly && a.initialized === b.initialized && a.pannable === b.pannable && a.zoomable === b.zoomable && a.nodesDraggable === b.nodesDraggable && a.nodesSelectable === b.nodesSelectable && a.enableFitView === b.enableFitView && shallowEqual(a.fitViewPadding, b.fitViewPadding) && shallowEqual(a.nodes, b.nodes) && shallowEqual(a.edges, b.edges) && shallowEqual(a.viewport ?? null, b.viewport ?? null);
|
|
77
|
+
});
|
|
71
78
|
function LikeC4DiagramXYFlow({
|
|
72
79
|
background = "dots",
|
|
73
80
|
reactFlowProps = {},
|
|
@@ -84,7 +91,7 @@ function LikeC4DiagramXYFlow({
|
|
|
84
91
|
nodesDraggable,
|
|
85
92
|
nodesSelectable,
|
|
86
93
|
...props
|
|
87
|
-
} =
|
|
94
|
+
} = useDiagramSnapshot(selectXYProps);
|
|
88
95
|
const {
|
|
89
96
|
onNodeContextMenu,
|
|
90
97
|
onCanvasContextMenu,
|
|
@@ -96,19 +103,23 @@ function LikeC4DiagramXYFlow({
|
|
|
96
103
|
} = useDiagramEventHandlers();
|
|
97
104
|
const isReducedGraphics = useIsReducedGraphics(), layoutConstraints = useLayoutConstraints(), $isPanning = usePanningAtom(), isPanning = useTimeout(() => {
|
|
98
105
|
$isPanning.set(true);
|
|
99
|
-
}, isReducedGraphics ?
|
|
106
|
+
}, isReducedGraphics ? 200 : 800), notPanning = useDebouncedCallback(() => {
|
|
100
107
|
isPanning.clear();
|
|
101
108
|
$isPanning.set(false);
|
|
102
|
-
},
|
|
109
|
+
}, 200), onMove = useCallbackRef((event) => {
|
|
103
110
|
if (!event) {
|
|
111
|
+
isPanning.clear();
|
|
104
112
|
return;
|
|
105
113
|
}
|
|
106
114
|
if (!$isPanning.get()) {
|
|
107
115
|
isPanning.start();
|
|
116
|
+
} else {
|
|
117
|
+
notPanning();
|
|
108
118
|
}
|
|
109
|
-
notPanning();
|
|
110
119
|
}), onMoveEnd = useCallbackRef((event, viewport) => {
|
|
111
|
-
|
|
120
|
+
if (event) {
|
|
121
|
+
notPanning();
|
|
122
|
+
}
|
|
112
123
|
diagram.send({
|
|
113
124
|
type: "xyflow.viewportMoved",
|
|
114
125
|
viewport,
|
|
@@ -133,10 +144,10 @@ function LikeC4DiagramXYFlow({
|
|
|
133
144
|
nodeTypes,
|
|
134
145
|
edgeTypes,
|
|
135
146
|
onNodesChange: useCallbackRef((changes) => {
|
|
136
|
-
diagram.send({ type: "xyflow.
|
|
147
|
+
diagram.send({ type: "xyflow.applyChanges", nodes: changes });
|
|
137
148
|
}),
|
|
138
149
|
onEdgesChange: useCallbackRef((changes) => {
|
|
139
|
-
diagram.send({ type: "xyflow.
|
|
150
|
+
diagram.send({ type: "xyflow.applyChanges", edges: changes });
|
|
140
151
|
}),
|
|
141
152
|
background: initialized ? background : "transparent",
|
|
142
153
|
fitView: false,
|
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
import { DynamicViewDisplayVariant, LayoutedView, WhereOperator } from '@likec4/core/types';
|
|
1
|
+
import { DynamicViewDisplayVariant, LayoutedView, ViewId, WhereOperator } from '@likec4/core/types';
|
|
2
2
|
import { Types } from './types';
|
|
3
3
|
type ConvertToXYFlowInput = {
|
|
4
|
+
currentViewId: ViewId | undefined;
|
|
4
5
|
view: LayoutedView;
|
|
5
6
|
where: WhereOperator | null;
|
|
6
7
|
dynamicViewVariant: DynamicViewDisplayVariant;
|
|
@@ -4,12 +4,11 @@ import { sequenceLayoutToXY } from './xyflow-sequence/sequence-layout.js';
|
|
|
4
4
|
function convertToXYFlow({ dynamicViewVariant, ...params }) {
|
|
5
5
|
const view = params.view;
|
|
6
6
|
const isDynamic = view._type === "dynamic";
|
|
7
|
-
const {
|
|
7
|
+
const { xynodes, xyedges } = isDynamic && dynamicViewVariant === "sequence" ? sequenceLayoutToXY(view, params.currentViewId) : diagramToXY({ ...params });
|
|
8
8
|
if (isDynamic && view.variant !== dynamicViewVariant) {
|
|
9
9
|
return {
|
|
10
10
|
view: {
|
|
11
11
|
...view,
|
|
12
|
-
bounds,
|
|
13
12
|
variant: dynamicViewVariant
|
|
14
13
|
},
|
|
15
14
|
xynodes,
|
|
@@ -17,10 +16,7 @@ function convertToXYFlow({ dynamicViewVariant, ...params }) {
|
|
|
17
16
|
};
|
|
18
17
|
}
|
|
19
18
|
return {
|
|
20
|
-
view
|
|
21
|
-
...view,
|
|
22
|
-
bounds
|
|
23
|
-
},
|
|
19
|
+
view,
|
|
24
20
|
xynodes,
|
|
25
21
|
xyedges
|
|
26
22
|
};
|
|
@@ -1,12 +1,14 @@
|
|
|
1
1
|
import { jsxs, Fragment, jsx } from 'react/jsx-runtime';
|
|
2
2
|
import { css, cx } from '@likec4/styles/css';
|
|
3
|
+
import { useRafEffect } from '@react-hookz/web';
|
|
3
4
|
import { EdgeLabelRenderer } from '@xyflow/react';
|
|
4
|
-
import { useState, useRef
|
|
5
|
+
import { useState, useRef } from 'react';
|
|
5
6
|
import { useEnabledFeatures } from '../../../context/DiagramFeatures.js';
|
|
6
7
|
import { useCallbackRef } from '../../../hooks/useCallbackRef.js';
|
|
7
8
|
import '@xstate/react';
|
|
8
9
|
import 'fast-equals';
|
|
9
10
|
import { useDiagram } from '../../../hooks/safeContext.js';
|
|
11
|
+
import { useSetState } from '../../../hooks/useSetState.js';
|
|
10
12
|
import { useUpdateEffect } from '../../../hooks/useUpdateEffect.js';
|
|
11
13
|
import { useXYFlow, useXYStoreApi } from '../../../hooks/useXYFlow.js';
|
|
12
14
|
import { isSamePoint } from '../../../utils/xyflow.js';
|
|
@@ -61,30 +63,28 @@ const RelationshipEdge = memoEdge((props) => {
|
|
|
61
63
|
isControlPointDragging
|
|
62
64
|
});
|
|
63
65
|
let labelX = labelBBox?.x ?? 0, labelY = labelBBox?.y ?? 0;
|
|
64
|
-
const [labelPos, setLabelPos] =
|
|
66
|
+
const [labelPos, setLabelPos] = useSetState({
|
|
65
67
|
x: labelXY?.x ?? labelX,
|
|
66
68
|
y: labelXY?.y ?? labelY
|
|
67
|
-
});
|
|
69
|
+
}, isSamePoint);
|
|
68
70
|
useUpdateEffect(() => {
|
|
69
71
|
if (isControlPointDraggingRef.current) {
|
|
70
72
|
return;
|
|
71
73
|
}
|
|
72
|
-
|
|
74
|
+
setLabelPos({
|
|
73
75
|
x: labelX,
|
|
74
76
|
y: labelY
|
|
75
|
-
};
|
|
76
|
-
setLabelPos((current) => isSamePoint(current, next) ? current : next);
|
|
77
|
+
});
|
|
77
78
|
}, [labelX, labelY]);
|
|
78
79
|
const svgPathRef = useRef(null);
|
|
79
|
-
|
|
80
|
+
useRafEffect(() => {
|
|
80
81
|
const path = svgPathRef.current;
|
|
81
82
|
if (!path || !isControlPointDragging) return;
|
|
82
|
-
|
|
83
|
-
setLabelPos((current) => isSamePoint(current, next) ? current : next);
|
|
83
|
+
setLabelPos(getEdgeCenter(path));
|
|
84
84
|
}, [edgePath, isControlPointDragging]);
|
|
85
85
|
const updateEdgeData = useCallbackRef((controlPoints2) => {
|
|
86
|
-
const point = svgPathRef.current ? getEdgeCenter(svgPathRef.current) : null;
|
|
87
|
-
if (
|
|
86
|
+
const point = labelBBox && svgPathRef.current ? getEdgeCenter(svgPathRef.current) : null;
|
|
87
|
+
if (point) {
|
|
88
88
|
diagram.updateEdgeData(id, {
|
|
89
89
|
controlPoints: controlPoints2,
|
|
90
90
|
labelBBox: {
|
|
@@ -217,8 +217,7 @@ const RelationshipEdge = memoEdge((props) => {
|
|
|
217
217
|
onStartMove: onControlPointerStartMove,
|
|
218
218
|
onCancelMove: onControlPointerCancelMove,
|
|
219
219
|
onFinishMove: onControlPointerFinishMove,
|
|
220
|
-
onDelete: onControlPointerDelete
|
|
221
|
-
zIndex: 9999
|
|
220
|
+
onDelete: onControlPointerDelete
|
|
222
221
|
}
|
|
223
222
|
)
|
|
224
223
|
] });
|
|
@@ -232,35 +231,35 @@ function ControlPoints({
|
|
|
232
231
|
onStartMove,
|
|
233
232
|
onCancelMove,
|
|
234
233
|
onFinishMove,
|
|
235
|
-
onDelete
|
|
236
|
-
zIndex
|
|
234
|
+
onDelete
|
|
237
235
|
}) {
|
|
238
236
|
const xyflowStore = useXYStoreApi();
|
|
239
237
|
const xyflow = useXYFlow();
|
|
240
238
|
const edgeId = edgeProps.data.id;
|
|
239
|
+
const controlPointsRef = useRef(controlPoints);
|
|
240
|
+
controlPointsRef.current = controlPoints;
|
|
241
241
|
const onLmbControlPointerDown = (index, e, domNode) => {
|
|
242
242
|
let hasMoved = false;
|
|
243
|
-
let
|
|
243
|
+
let initialPoint = { x: e.clientX, y: e.clientY };
|
|
244
|
+
let clientPoint = { ...initialPoint };
|
|
244
245
|
let animationFrameId = null;
|
|
245
|
-
let cp =
|
|
246
|
+
let cp = [...controlPointsRef.current];
|
|
246
247
|
const onPointerMove = (e2) => {
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
if (!isSamePoint(pointer, clientPoint)) {
|
|
248
|
+
clientPoint.x = e2.clientX;
|
|
249
|
+
clientPoint.y = e2.clientY;
|
|
250
|
+
const isDragging = !isSamePoint(initialPoint, clientPoint);
|
|
251
|
+
if (isDragging) {
|
|
252
252
|
if (!hasMoved) {
|
|
253
253
|
hasMoved = true;
|
|
254
254
|
onStartMove();
|
|
255
255
|
}
|
|
256
|
-
pointer = clientPoint;
|
|
257
256
|
animationFrameId ??= requestAnimationFrame(() => {
|
|
258
257
|
animationFrameId = null;
|
|
259
|
-
|
|
260
|
-
|
|
258
|
+
const { x, y } = xyflow.screenToFlowPosition(clientPoint, { snapToGrid: false });
|
|
259
|
+
cp = [...cp];
|
|
261
260
|
cp[index] = {
|
|
262
|
-
x: Math.
|
|
263
|
-
y: Math.
|
|
261
|
+
x: Math.trunc(x),
|
|
262
|
+
y: Math.trunc(y)
|
|
264
263
|
};
|
|
265
264
|
onMove(cp);
|
|
266
265
|
});
|
|
@@ -275,6 +274,9 @@ function ControlPoints({
|
|
|
275
274
|
domNode.removeEventListener("click", stopAndPrevent, {
|
|
276
275
|
capture: true
|
|
277
276
|
});
|
|
277
|
+
if (animationFrameId !== null) {
|
|
278
|
+
cancelAnimationFrame(animationFrameId);
|
|
279
|
+
}
|
|
278
280
|
if (hasMoved) {
|
|
279
281
|
onFinishMove(cp);
|
|
280
282
|
} else {
|
|
@@ -294,12 +296,11 @@ function ControlPoints({
|
|
|
294
296
|
});
|
|
295
297
|
};
|
|
296
298
|
const onRmbControlPointerDown = (index, e) => {
|
|
297
|
-
|
|
299
|
+
const newControlPoints = [...controlPointsRef.current];
|
|
300
|
+
if (newControlPoints.length <= 1 || index >= newControlPoints.length) {
|
|
298
301
|
return;
|
|
299
302
|
}
|
|
300
|
-
e
|
|
301
|
-
e.preventDefault();
|
|
302
|
-
const newControlPoints = controlPoints.slice();
|
|
303
|
+
stopAndPrevent(e);
|
|
303
304
|
newControlPoints.splice(index, 1);
|
|
304
305
|
setTimeout(() => {
|
|
305
306
|
onDelete(newControlPoints);
|
|
@@ -330,12 +331,12 @@ function ControlPoints({
|
|
|
330
331
|
}
|
|
331
332
|
});
|
|
332
333
|
const onControlPointerDblClick = useCallbackRef((e) => {
|
|
333
|
-
|
|
334
|
-
if (!domNode || e.pointerType !== "mouse") {
|
|
334
|
+
if (e.pointerType !== "mouse") {
|
|
335
335
|
return;
|
|
336
336
|
}
|
|
337
337
|
const index = parseFloat(e.currentTarget.getAttribute("data-control-point-index") || "");
|
|
338
338
|
if (isNaN(index)) {
|
|
339
|
+
console.error(e.currentTarget);
|
|
339
340
|
throw new Error("data-control-point-index is not a number");
|
|
340
341
|
}
|
|
341
342
|
onRmbControlPointerDown(index, e);
|
|
@@ -346,10 +347,6 @@ function ControlPoints({
|
|
|
346
347
|
component: "svg",
|
|
347
348
|
className: controlPointsContainer,
|
|
348
349
|
...edgeProps,
|
|
349
|
-
style: {
|
|
350
|
-
...edgeProps.style,
|
|
351
|
-
zIndex
|
|
352
|
-
},
|
|
353
350
|
children: /* @__PURE__ */ jsx(
|
|
354
351
|
"g",
|
|
355
352
|
{
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
+
import { vector } from '@likec4/core/geometry';
|
|
1
2
|
import { deepEqual } from 'fast-equals';
|
|
2
3
|
import { useState } from 'react';
|
|
3
4
|
import { useCallbackRef } from '../../../hooks/useCallbackRef.js';
|
|
4
5
|
import { useUpdateEffect } from '../../../hooks/useUpdateEffect.js';
|
|
5
|
-
import { vector } from '@likec4/core/geometry';
|
|
6
6
|
import { bezierControlPoints } from '../../../utils/xyflow.js';
|
|
7
7
|
|
|
8
8
|
function useControlPoints({
|
|
@@ -19,8 +19,8 @@ function useControlPoints({
|
|
|
19
19
|
const next = data.controlPoints ?? bezierControlPoints(data.points);
|
|
20
20
|
setControlPoints((prev) => deepEqual(prev, next) ? prev : next);
|
|
21
21
|
}, [
|
|
22
|
-
data.
|
|
23
|
-
data.
|
|
22
|
+
data.points,
|
|
23
|
+
data.controlPoints ?? []
|
|
24
24
|
]);
|
|
25
25
|
const insertControlPoint = useCallbackRef(({ x, y }) => {
|
|
26
26
|
const sourceV = vector(sourceX, sourceY);
|
|
@@ -1,5 +1,8 @@
|
|
|
1
1
|
import { XYPosition } from '@xyflow/react';
|
|
2
2
|
import { Types } from '../../types';
|
|
3
|
+
/**
|
|
4
|
+
* @returns SVG path data string for relationship edge
|
|
5
|
+
*/
|
|
3
6
|
export declare function useRelationshipEdgePath({ props: { sourceX, sourceY, source, target, targetX, targetY, data, }, controlPoints, isControlPointDragging, }: {
|
|
4
7
|
props: Types.EdgeProps<'relationship'>;
|
|
5
8
|
controlPoints: XYPosition[];
|
|
@@ -1,12 +1,14 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { vector } from '@likec4/core/geometry';
|
|
2
|
+
import { nonNullable } from '@likec4/core/utils';
|
|
3
|
+
import { getNodeDimensions } from '@xyflow/system';
|
|
2
4
|
import { line, curveCatmullRomOpen } from 'd3-shape';
|
|
5
|
+
import { shallowEqual } from 'fast-equals';
|
|
3
6
|
import { useCallback } from 'react';
|
|
4
7
|
import { isTruthy, first, last } from 'remeda';
|
|
5
8
|
import { useXYStore } from '../../../hooks/useXYFlow.js';
|
|
6
|
-
import {
|
|
9
|
+
import { bezierPath, getNodeIntersectionFromCenterToPoint } from '../../../utils/xyflow.js';
|
|
7
10
|
|
|
8
|
-
const curve = line().curve(curveCatmullRomOpen.alpha(0.7)).x((d) => Math.
|
|
9
|
-
const isSameRects = (a, b) => isEqualRects(a.sourceNode, b.sourceNode) && isEqualRects(a.targetNode, b.targetNode);
|
|
11
|
+
const curve = line().curve(curveCatmullRomOpen.alpha(0.7)).x((d) => Math.trunc(d.x)).y((d) => Math.trunc(d.y));
|
|
10
12
|
function useRelationshipEdgePath({
|
|
11
13
|
props: {
|
|
12
14
|
sourceX,
|
|
@@ -20,41 +22,57 @@ function useRelationshipEdgePath({
|
|
|
20
22
|
controlPoints,
|
|
21
23
|
isControlPointDragging
|
|
22
24
|
}) {
|
|
23
|
-
const
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
25
|
+
const [
|
|
26
|
+
sourceNodeWidth,
|
|
27
|
+
sourceNodeHeight,
|
|
28
|
+
targetNodeWidth,
|
|
29
|
+
targetNodeHeight
|
|
30
|
+
] = useXYStore(
|
|
27
31
|
useCallback(({ nodeLookup }) => {
|
|
28
|
-
const
|
|
29
|
-
const
|
|
30
|
-
return
|
|
31
|
-
sourceNode
|
|
32
|
-
|
|
33
|
-
|
|
32
|
+
const sourceNode = getNodeDimensions(nonNullable(nodeLookup.get(source), `source node ${source} not found`));
|
|
33
|
+
const targetNode = getNodeDimensions(nonNullable(nodeLookup.get(target), `target node ${target} not found`));
|
|
34
|
+
return [
|
|
35
|
+
Math.ceil(sourceNode.width),
|
|
36
|
+
Math.ceil(sourceNode.height),
|
|
37
|
+
Math.ceil(targetNode.width),
|
|
38
|
+
Math.ceil(targetNode.height)
|
|
39
|
+
];
|
|
34
40
|
}, [source, target]),
|
|
35
|
-
|
|
41
|
+
shallowEqual
|
|
36
42
|
);
|
|
37
43
|
const isModified = isTruthy(data.controlPoints) || isControlPointDragging;
|
|
38
|
-
if (isModified) {
|
|
39
|
-
|
|
40
|
-
const targetCenterPos = { x: targetX, y: targetY };
|
|
41
|
-
const nodeMargin = 6;
|
|
42
|
-
const points = data.dir === "back" ? [
|
|
43
|
-
targetCenterPos,
|
|
44
|
-
getNodeIntersectionFromCenterToPoint(targetNode, first(controlPoints) ?? sourceCenterPos, nodeMargin),
|
|
45
|
-
...controlPoints,
|
|
46
|
-
getNodeIntersectionFromCenterToPoint(sourceNode, last(controlPoints) ?? targetCenterPos, nodeMargin),
|
|
47
|
-
sourceCenterPos
|
|
48
|
-
] : [
|
|
49
|
-
sourceCenterPos,
|
|
50
|
-
getNodeIntersectionFromCenterToPoint(sourceNode, first(controlPoints) ?? targetCenterPos, nodeMargin),
|
|
51
|
-
...controlPoints,
|
|
52
|
-
getNodeIntersectionFromCenterToPoint(targetNode, last(controlPoints) ?? sourceCenterPos, nodeMargin),
|
|
53
|
-
targetCenterPos
|
|
54
|
-
];
|
|
55
|
-
return nonNullable(curve(points));
|
|
44
|
+
if (!isModified) {
|
|
45
|
+
return bezierPath(data.points);
|
|
56
46
|
}
|
|
57
|
-
|
|
47
|
+
const sourceCenterPos = vector(sourceX, sourceY).trunc();
|
|
48
|
+
const targetCenterPos = vector(targetX, targetY).trunc();
|
|
49
|
+
const sourceNd = {
|
|
50
|
+
// Calculate node top-left from center position
|
|
51
|
+
...sourceCenterPos.subtract(vector(sourceNodeWidth, sourceNodeHeight).divide(2)).trunc().toObject(),
|
|
52
|
+
width: sourceNodeWidth,
|
|
53
|
+
height: sourceNodeHeight
|
|
54
|
+
};
|
|
55
|
+
const targetNd = {
|
|
56
|
+
// Calculate node top-left from center position
|
|
57
|
+
...targetCenterPos.subtract(vector(targetNodeWidth, targetNodeHeight).divide(2)).trunc().toObject(),
|
|
58
|
+
width: targetNodeWidth,
|
|
59
|
+
height: targetNodeHeight
|
|
60
|
+
};
|
|
61
|
+
const nodeMargin = 6;
|
|
62
|
+
const points = data.dir === "back" ? [
|
|
63
|
+
targetCenterPos,
|
|
64
|
+
getNodeIntersectionFromCenterToPoint(targetNd, first(controlPoints) ?? sourceCenterPos, nodeMargin),
|
|
65
|
+
...controlPoints,
|
|
66
|
+
getNodeIntersectionFromCenterToPoint(sourceNd, last(controlPoints) ?? targetCenterPos, nodeMargin),
|
|
67
|
+
sourceCenterPos
|
|
68
|
+
] : [
|
|
69
|
+
sourceCenterPos,
|
|
70
|
+
getNodeIntersectionFromCenterToPoint(sourceNd, first(controlPoints) ?? targetCenterPos, nodeMargin),
|
|
71
|
+
...controlPoints,
|
|
72
|
+
getNodeIntersectionFromCenterToPoint(targetNd, last(controlPoints) ?? sourceCenterPos, nodeMargin),
|
|
73
|
+
targetCenterPos
|
|
74
|
+
];
|
|
75
|
+
return nonNullable(curve(points));
|
|
58
76
|
}
|
|
59
77
|
|
|
60
78
|
export { useRelationshipEdgePath };
|
|
@@ -2,7 +2,6 @@ import { SimplifyDeep } from 'type-fest';
|
|
|
2
2
|
import { ElementActionButtons } from '../../../base-primitives';
|
|
3
3
|
import { BaseNodeData } from '../../../base/types';
|
|
4
4
|
import { Types } from '../../types';
|
|
5
|
-
import { NamedExoticComponent } from 'react';
|
|
6
5
|
type WithExtraButtons = {
|
|
7
6
|
/**
|
|
8
7
|
* Add extra action buttons
|
|
@@ -54,7 +53,7 @@ export type ElementActionsProps = SimplifyDeep<{
|
|
|
54
53
|
* />
|
|
55
54
|
* ```
|
|
56
55
|
*/
|
|
57
|
-
export declare
|
|
56
|
+
export declare function ElementActions({ extraButtons, ...props }: ElementActionsProps): import("react/jsx-runtime").JSX.Element;
|
|
58
57
|
export type DeploymentElementActionsProps = SimplifyDeep<{
|
|
59
58
|
selected?: boolean;
|
|
60
59
|
data: Pick<Types.DeploymentElementNodeData, 'id' | 'modelFqn' | 'navigateTo'> & BaseNodeData;
|
|
@@ -1,21 +1,18 @@
|
|
|
1
1
|
import { jsx } from 'react/jsx-runtime';
|
|
2
|
-
import {
|
|
3
|
-
import { memo, useMemo } from 'react';
|
|
2
|
+
import { useMemo } from 'react';
|
|
4
3
|
import { hasAtLeast } from 'remeda';
|
|
5
4
|
import { useEnabledFeatures } from '../../../context/DiagramFeatures.js';
|
|
6
5
|
import '@xstate/react';
|
|
6
|
+
import 'fast-equals';
|
|
7
7
|
import { useDiagram } from '../../../hooks/safeContext.js';
|
|
8
|
-
import IconZoomScan from '../../../node_modules/.pnpm/@tabler_icons-react@3.36.
|
|
9
|
-
import IconTransform from '../../../node_modules/.pnpm/@tabler_icons-react@3.36.
|
|
8
|
+
import IconZoomScan from '../../../node_modules/.pnpm/@tabler_icons-react@3.36.1_react@19.2.4/node_modules/@tabler/icons-react/dist/esm/icons/IconZoomScan.js';
|
|
9
|
+
import IconTransform from '../../../node_modules/.pnpm/@tabler_icons-react@3.36.1_react@19.2.4/node_modules/@tabler/icons-react/dist/esm/icons/IconTransform.js';
|
|
10
10
|
import { ElementActionButtons } from '../../../base-primitives/element/ElementActionButtons.js';
|
|
11
11
|
|
|
12
|
-
|
|
13
|
-
return deepEqual(a.data.id, b.data.id) && deepEqual(a.selected ?? false, b.selected ?? false) && deepEqual(a.data.modelFqn ?? null, b.data.modelFqn ?? null) && deepEqual(a.data.navigateTo ?? null, b.data.navigateTo ?? null) && deepEqual(a.data.hovered ?? false, b.data.hovered ?? false) && (!a.extraButtons && !b.extraButtons || shallowEqual(a.extraButtons, b.extraButtons));
|
|
14
|
-
};
|
|
15
|
-
const ElementActions = memo(({
|
|
12
|
+
function ElementActions({
|
|
16
13
|
extraButtons,
|
|
17
14
|
...props
|
|
18
|
-
})
|
|
15
|
+
}) {
|
|
19
16
|
const { enableNavigateTo, enableRelationshipBrowser } = useEnabledFeatures();
|
|
20
17
|
const diagram = useDiagram();
|
|
21
18
|
const { id, navigateTo, modelFqn } = props.data;
|
|
@@ -47,7 +44,7 @@ const ElementActions = memo(({
|
|
|
47
44
|
buttons = [...buttons, ...extraButtons];
|
|
48
45
|
}
|
|
49
46
|
return /* @__PURE__ */ jsx(ElementActionButtons, { ...props, buttons });
|
|
50
|
-
}
|
|
47
|
+
}
|
|
51
48
|
const DeploymentElementActions = ({
|
|
52
49
|
extraButtons,
|
|
53
50
|
...props
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { Types } from '../../types';
|
|
2
2
|
export type NodeDriftsProps = {
|
|
3
3
|
nodeProps: Types.NodeProps;
|
|
4
|
-
position?: 'top' | 'bottom';
|
|
5
4
|
};
|
|
6
|
-
export declare function NodeDrifts({ nodeProps: { data },
|
|
5
|
+
export declare function NodeDrifts({ nodeProps: { data }, }: NodeDriftsProps): import("react/jsx-runtime").JSX.Element | null;
|
|
@@ -1,17 +1,13 @@
|
|
|
1
|
-
import { jsx
|
|
1
|
+
import { jsx } from 'react/jsx-runtime';
|
|
2
2
|
import { Box } from '@likec4/styles/jsx';
|
|
3
|
-
import { Notification, Text } from '@mantine/core';
|
|
4
|
-
import { Position, NodeToolbar } from '@xyflow/react';
|
|
5
3
|
|
|
6
4
|
function NodeDrifts({
|
|
7
|
-
nodeProps: { data }
|
|
8
|
-
position = "bottom"
|
|
5
|
+
nodeProps: { data }
|
|
9
6
|
}) {
|
|
10
7
|
const drifts = data.drifts;
|
|
11
8
|
if (!drifts || drifts.length === 0) {
|
|
12
9
|
return null;
|
|
13
10
|
}
|
|
14
|
-
const toolbarPosition = position === "top" ? Position.Top : Position.Bottom;
|
|
15
11
|
return /* @__PURE__ */ jsx(
|
|
16
12
|
Box,
|
|
17
13
|
{
|
|
@@ -24,20 +20,7 @@ function NodeDrifts({
|
|
|
24
20
|
outlineStyle: "dashed",
|
|
25
21
|
outlineOffset: "1.5"
|
|
26
22
|
}
|
|
27
|
-
}
|
|
28
|
-
children: /* @__PURE__ */ jsx(NodeToolbar, { isVisible: data.hovered === true, align: "start", position: toolbarPosition, children: /* @__PURE__ */ jsx(
|
|
29
|
-
Notification,
|
|
30
|
-
{
|
|
31
|
-
color: "orange",
|
|
32
|
-
withBorder: false,
|
|
33
|
-
withCloseButton: false,
|
|
34
|
-
title: "Changes:",
|
|
35
|
-
children: drifts.map((drift) => /* @__PURE__ */ jsxs(Text, { mt: 2, size: "sm", lh: "xs", children: [
|
|
36
|
-
"- ",
|
|
37
|
-
drift
|
|
38
|
-
] }, drift))
|
|
39
|
-
}
|
|
40
|
-
) })
|
|
23
|
+
}
|
|
41
24
|
}
|
|
42
25
|
);
|
|
43
26
|
}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { BaseNodePropsWithData } from '../../../base/types';
|
|
2
|
+
import { Types } from '../../types';
|
|
3
|
+
type RequiredData = Pick<Types.NodeData, 'id' | 'notes' | 'width' | 'height' | 'x' | 'y'>;
|
|
4
|
+
export type NodeNotesProps = BaseNodePropsWithData<RequiredData>;
|
|
5
|
+
export declare function NodeNotes({ data }: NodeNotesProps): import("react/jsx-runtime").JSX.Element | null;
|
|
6
|
+
export {};
|