@likec4/diagram 1.47.0 → 1.48.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 +1 -1
- package/bundle/index.js +5489 -4909
- package/dist/LikeC4Diagram.js +18 -12
- package/dist/LikeC4Diagram.props.d.ts +1 -5
- package/dist/LikeC4ProjectsProvider.js +7 -5
- package/dist/LikeC4Styles.d.ts +2 -6
- package/dist/LikeC4Styles.js +44 -43
- package/dist/LikeC4View.d.ts +9 -1
- package/dist/LikeC4View.js +10 -8
- package/dist/ReactLikeC4.d.ts +12 -2
- package/dist/ReactLikeC4.js +5 -3
- package/dist/adhoc-editor/ActorProvider.d.ts +7 -0
- package/dist/adhoc-editor/ActorProvider.js +41 -0
- package/dist/adhoc-editor/EditorNavigationPanel.d.ts +1 -0
- package/dist/adhoc-editor/EditorNavigationPanel.js +32 -0
- package/dist/adhoc-editor/LikeC4AdHocViewEditor.d.ts +4 -0
- package/dist/adhoc-editor/LikeC4AdHocViewEditor.js +71 -0
- package/dist/adhoc-editor/SelectElementOverlay.d.ts +1 -0
- package/dist/adhoc-editor/SelectElementOverlay.js +124 -0
- package/dist/adhoc-editor/actor.d.ts +131 -0
- package/dist/adhoc-editor/actor.editor.d.ts +54 -0
- package/dist/adhoc-editor/actor.editor.js +96 -0
- package/dist/adhoc-editor/actor.js +20 -0
- package/dist/adhoc-editor/actor.layouter.d.ts +48 -0
- package/dist/adhoc-editor/actor.layouter.js +66 -0
- package/dist/adhoc-editor/actor.types.d.ts +57 -0
- package/dist/adhoc-editor/actor.types.js +22 -0
- package/dist/adhoc-editor/hooks.d.ts +14 -0
- package/dist/adhoc-editor/hooks.js +47 -0
- package/dist/adhoc-editor/index.d.ts +2 -0
- package/dist/adhoc-editor/viewrules/ViewRulesPanel.d.ts +6 -0
- package/dist/adhoc-editor/viewrules/ViewRulesPanel.js +104 -0
- package/dist/base/const.d.ts +1 -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 +3 -1
- package/dist/base-primitives/compound/CompoundDetailsButton.js +3 -1
- package/dist/base-primitives/compound/CompoundNodeContainer.js +6 -4
- 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/EdgeLabelContainer.js +5 -1
- package/dist/base-primitives/element/ElementActionButtons.js +31 -58
- 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 +2 -1
- package/dist/base-primitives/element/ElementNodeContainer.d.ts +2 -2
- package/dist/base-primitives/element/ElementNodeContainer.js +1 -0
- 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 +2 -2
- package/dist/components/Logo.js +1 -1
- package/dist/components/NavigationPanel.d.ts +2 -2
- package/dist/components/NavigationPanel.js +9 -28
- package/dist/components/RootContainer.js +5 -8
- package/dist/context/DefaultMantineProvider.d.ts +2 -0
- package/dist/context/DefaultMantineProvider.js +66 -0
- package/dist/context/DiagramFeatures.js +12 -11
- package/dist/context/EnsureMantine.d.ts +0 -3
- package/dist/context/EnsureMantine.js +3 -4
- package/dist/context/IconRenderer.d.ts +14 -0
- package/dist/context/IconRenderer.js +8 -8
- package/dist/context/TagStylesContext.js +12 -4
- package/dist/custom/hooks.d.ts +2 -2
- package/dist/custom/index.d.ts +1 -1
- package/dist/custom/index.js +2 -2
- 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 +2 -2
- package/dist/editor/applyChangesToManualLayout.js +1 -0
- package/dist/editor/editorActor.actions.d.ts +25 -25
- package/dist/editor/editorActor.actions.js +2 -2
- 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} +22 -64
- package/dist/editor/index.d.ts +4 -3
- package/dist/editor/useEditorActorLogic.d.ts +2 -564
- package/dist/editor/useEditorActorLogic.js +8 -12
- package/dist/hooks/index.d.ts +1 -1
- package/dist/hooks/useCallbackRef.d.ts +6 -0
- package/dist/hooks/useCurrentViewModel.d.ts +10 -0
- package/dist/hooks/useDiagram.js +2 -2
- package/dist/hooks/useDiagramCompareLayout.d.ts +1 -1
- package/dist/hooks/useDiagramCompareLayout.js +1 -1
- package/dist/hooks/useLikeC4ElementsTree.js +1 -1
- package/dist/hooks/useLikeC4Model.js +2 -2
- 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 +7 -4
- package/dist/index.js +4 -2
- package/dist/likec4diagram/DiagramUI.js +1 -3
- package/dist/likec4diagram/DiagramXYFlow.js +25 -12
- 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 +13 -14
- 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 +68 -35
- package/dist/likec4diagram/custom/nodes/ElementActions.d.ts +1 -2
- package/dist/likec4diagram/custom/nodes/ElementActions.js +7 -10
- package/dist/likec4diagram/custom/nodes/SequenceActorNode.js +7 -5
- package/dist/likec4diagram/custom/nodes/nodes.js +25 -6
- 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 +7 -6
- package/dist/likec4diagram/custom/nodes/toolbar/_shared.js +3 -3
- package/dist/likec4diagram/custom/nodes/toolbar/styles.css.js +2 -2
- package/dist/likec4diagram/relationship-popover/RelationshipPopover.js +15 -15
- 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 +14 -15
- package/dist/likec4diagram/state/assign.d.ts +1 -1
- package/dist/likec4diagram/state/createViewChange.js +16 -4
- package/dist/likec4diagram/state/machine.actions.d.ts +65 -0
- package/dist/likec4diagram/state/machine.actions.js +51 -39
- package/dist/likec4diagram/state/machine.actions.layout.d.ts +22 -2
- package/dist/likec4diagram/state/machine.actions.layout.js +32 -14
- package/dist/likec4diagram/state/machine.d.ts +1 -1
- package/dist/likec4diagram/state/machine.js +31 -30
- package/dist/likec4diagram/state/machine.setup.d.ts +21 -5
- 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 +81 -49
- package/dist/likec4diagram/state/machine.state.ready.d.ts +508 -582
- 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 +80 -69
- 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 +13 -14
- package/dist/likec4diagram/state/utils.js +11 -3
- package/dist/likec4diagram/types.d.ts +9 -1
- package/dist/likec4diagram/ui/notation/NotationPanel.css.js +1 -1
- package/dist/likec4diagram/ui/notation/NotationPanel.js +3 -3
- package/dist/likec4diagram/useLayoutConstraints.js +4 -1
- package/dist/likec4diagram/xyflow-diagram/diagram-view.d.ts +11 -3
- package/dist/likec4diagram/xyflow-diagram/diagram-view.js +5 -3
- package/dist/likec4diagram/xyflow-sequence/sequence-layout.d.ts +7 -3
- package/dist/likec4diagram/xyflow-sequence/sequence-layout.js +10 -8
- package/dist/navigationpanel/NavigationPanel.js +2 -1
- package/dist/navigationpanel/NavigationPanelControls.js +4 -2
- package/dist/navigationpanel/NavigationPanelDropdown.js +7 -7
- package/dist/navigationpanel/_common.d.ts +1 -1
- package/dist/navigationpanel/_common.js +1 -2
- package/dist/navigationpanel/comparepanel/CompareActionsMenu.js +2 -2
- package/dist/navigationpanel/comparepanel/ComparePanelControls.js +1 -1
- package/dist/navigationpanel/comparepanel/LayoutTypeSwitcher.js +4 -5
- package/dist/navigationpanel/controls/DetailsControls.js +5 -5
- package/dist/navigationpanel/controls/LayoutWarning.js +2 -2
- 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 +4 -5
- 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 +3 -3
- package/dist/navigationpanel/walkthrough/DynamicViewControls.d.ts +67 -67
- package/dist/navigationpanel/walkthrough/DynamicViewControls.js +1 -1
- package/dist/navigationpanel/walkthrough/WalkthroughPanel.js +1 -1
- package/dist/node_modules/.pnpm/@tabler_icons-react@3.36.0_react@19.2.4/node_modules/@tabler/icons-react/dist/esm/icons/IconCirclePlus.js +14 -0
- package/dist/node_modules/.pnpm/@tabler_icons-react@3.36.0_react@19.2.4/node_modules/@tabler/icons-react/dist/esm/icons/IconTrash.js +14 -0
- package/dist/overlays/element-details/ElementDetailsCard.css.js +4 -4
- package/dist/overlays/element-details/ElementDetailsCard.js +4 -4
- package/dist/overlays/element-details/MetadataValue.js +6 -7
- package/dist/overlays/element-details/TabPanelDeployments.js +7 -5
- package/dist/overlays/element-details/TabPanelRelationships.css.js +5 -25
- package/dist/overlays/element-details/TabPanelRelationships.js +3 -3
- package/dist/overlays/element-details/TabPanelStructure.js +3 -2
- package/dist/overlays/overlaysActor.js +18 -0
- 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 +2 -2
- 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.js +2 -2
- 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/projects-overview/actor.js +8 -31
- package/dist/projects-overview/custom/nodeTypes.js +1 -1
- package/dist/projects-overview/panel/ProjectsOverviewPanel.js +1 -1
- package/dist/search/Search.d.ts +1 -4
- package/dist/search/Search.js +89 -87
- package/dist/search/components/ElementsColumn.css.js +3 -3
- package/dist/search/components/ElementsColumn.js +3 -4
- package/dist/search/components/PickView.d.ts +3 -1
- package/dist/search/components/PickView.js +5 -4
- package/dist/search/components/SearchByTags.js +1 -1
- package/dist/search/components/SearchInput.js +1 -1
- package/dist/search/components/ViewsColum.js +2 -2
- package/dist/search/components/_shared.css.d.ts +1 -1
- package/dist/search/components/_shared.css.js +1 -1
- package/dist/search/components/utils.js +1 -1
- package/dist/search/hooks.d.ts +1 -6
- package/dist/search/hooks.js +12 -9
- package/dist/search/searchActor.d.ts +1 -1
- package/dist/shadowroot/ShadowRoot.js +20 -19
- package/dist/shadowroot/styles.css.d.ts +0 -2
- package/dist/shadowroot/styles.css.js +1 -34
- package/dist/styles-font.css2.js +1 -1
- package/dist/styles.css2.js +1 -1
- package/dist/utils/view-bounds.js +9 -5
- package/dist/utils/xyflow.d.ts +19 -3
- package/dist/utils/xyflow.js +52 -9
- package/package.json +21 -20
- package/panda.buildinfo.json +80 -104
- package/styles-font.css +1 -1
- package/styles-min.css +1 -1
- package/styles.css +1 -1
- 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/overlays/relationships-browser/custom/styles.css.d.ts +0 -1
- package/dist/overlays/relationships-browser/custom/styles.css.js +0 -14
- /package/dist/node_modules/.pnpm/{@tabler_icons-react@3.36.0_react@19.2.3 → @tabler_icons-react@3.36.0_react@19.2.4}/node_modules/@tabler/icons-react/dist/esm/createReactComponent.js +0 -0
- /package/dist/node_modules/.pnpm/{@tabler_icons-react@3.36.0_react@19.2.3 → @tabler_icons-react@3.36.0_react@19.2.4}/node_modules/@tabler/icons-react/dist/esm/defaultAttributes.js +0 -0
- /package/dist/node_modules/.pnpm/{@tabler_icons-react@3.36.0_react@19.2.3 → @tabler_icons-react@3.36.0_react@19.2.4}/node_modules/@tabler/icons-react/dist/esm/icons/IconAlertTriangle.js +0 -0
- /package/dist/node_modules/.pnpm/{@tabler_icons-react@3.36.0_react@19.2.3 → @tabler_icons-react@3.36.0_react@19.2.4}/node_modules/@tabler/icons-react/dist/esm/icons/IconArrowDownRight.js +0 -0
- /package/dist/node_modules/.pnpm/{@tabler_icons-react@3.36.0_react@19.2.3 → @tabler_icons-react@3.36.0_react@19.2.4}/node_modules/@tabler/icons-react/dist/esm/icons/IconArrowLeft.js +0 -0
- /package/dist/node_modules/.pnpm/{@tabler_icons-react@3.36.0_react@19.2.3 → @tabler_icons-react@3.36.0_react@19.2.4}/node_modules/@tabler/icons-react/dist/esm/icons/IconArrowRight.js +0 -0
- /package/dist/node_modules/.pnpm/{@tabler_icons-react@3.36.0_react@19.2.3 → @tabler_icons-react@3.36.0_react@19.2.4}/node_modules/@tabler/icons-react/dist/esm/icons/IconBolt.js +0 -0
- /package/dist/node_modules/.pnpm/{@tabler_icons-react@3.36.0_react@19.2.3 → @tabler_icons-react@3.36.0_react@19.2.4}/node_modules/@tabler/icons-react/dist/esm/icons/IconBrowser.js +0 -0
- /package/dist/node_modules/.pnpm/{@tabler_icons-react@3.36.0_react@19.2.3 → @tabler_icons-react@3.36.0_react@19.2.4}/node_modules/@tabler/icons-react/dist/esm/icons/IconCheck.js +0 -0
- /package/dist/node_modules/.pnpm/{@tabler_icons-react@3.36.0_react@19.2.3 → @tabler_icons-react@3.36.0_react@19.2.4}/node_modules/@tabler/icons-react/dist/esm/icons/IconChevronDown.js +0 -0
- /package/dist/node_modules/.pnpm/{@tabler_icons-react@3.36.0_react@19.2.3 → @tabler_icons-react@3.36.0_react@19.2.4}/node_modules/@tabler/icons-react/dist/esm/icons/IconChevronLeft.js +0 -0
- /package/dist/node_modules/.pnpm/{@tabler_icons-react@3.36.0_react@19.2.3 → @tabler_icons-react@3.36.0_react@19.2.4}/node_modules/@tabler/icons-react/dist/esm/icons/IconChevronRight.js +0 -0
- /package/dist/node_modules/.pnpm/{@tabler_icons-react@3.36.0_react@19.2.3 → @tabler_icons-react@3.36.0_react@19.2.4}/node_modules/@tabler/icons-react/dist/esm/icons/IconCopy.js +0 -0
- /package/dist/node_modules/.pnpm/{@tabler_icons-react@3.36.0_react@19.2.3 → @tabler_icons-react@3.36.0_react@19.2.4}/node_modules/@tabler/icons-react/dist/esm/icons/IconCylinder.js +0 -0
- /package/dist/node_modules/.pnpm/{@tabler_icons-react@3.36.0_react@19.2.3 → @tabler_icons-react@3.36.0_react@19.2.4}/node_modules/@tabler/icons-react/dist/esm/icons/IconDeviceMobile.js +0 -0
- /package/dist/node_modules/.pnpm/{@tabler_icons-react@3.36.0_react@19.2.3 → @tabler_icons-react@3.36.0_react@19.2.4}/node_modules/@tabler/icons-react/dist/esm/icons/IconDirectionSignFilled.js +0 -0
- /package/dist/node_modules/.pnpm/{@tabler_icons-react@3.36.0_react@19.2.3 → @tabler_icons-react@3.36.0_react@19.2.4}/node_modules/@tabler/icons-react/dist/esm/icons/IconExternalLink.js +0 -0
- /package/dist/node_modules/.pnpm/{@tabler_icons-react@3.36.0_react@19.2.3 → @tabler_icons-react@3.36.0_react@19.2.4}/node_modules/@tabler/icons-react/dist/esm/icons/IconFileSymlink.js +0 -0
- /package/dist/node_modules/.pnpm/{@tabler_icons-react@3.36.0_react@19.2.3 → @tabler_icons-react@3.36.0_react@19.2.4}/node_modules/@tabler/icons-react/dist/esm/icons/IconFileText.js +0 -0
- /package/dist/node_modules/.pnpm/{@tabler_icons-react@3.36.0_react@19.2.3 → @tabler_icons-react@3.36.0_react@19.2.4}/node_modules/@tabler/icons-react/dist/esm/icons/IconFocusCentered.js +0 -0
- /package/dist/node_modules/.pnpm/{@tabler_icons-react@3.36.0_react@19.2.3 → @tabler_icons-react@3.36.0_react@19.2.4}/node_modules/@tabler/icons-react/dist/esm/icons/IconFolderFilled.js +0 -0
- /package/dist/node_modules/.pnpm/{@tabler_icons-react@3.36.0_react@19.2.3 → @tabler_icons-react@3.36.0_react@19.2.4}/node_modules/@tabler/icons-react/dist/esm/icons/IconHelpCircle.js +0 -0
- /package/dist/node_modules/.pnpm/{@tabler_icons-react@3.36.0_react@19.2.3 → @tabler_icons-react@3.36.0_react@19.2.4}/node_modules/@tabler/icons-react/dist/esm/icons/IconId.js +0 -0
- /package/dist/node_modules/.pnpm/{@tabler_icons-react@3.36.0_react@19.2.3 → @tabler_icons-react@3.36.0_react@19.2.4}/node_modules/@tabler/icons-react/dist/esm/icons/IconInfoCircle.js +0 -0
- /package/dist/node_modules/.pnpm/{@tabler_icons-react@3.36.0_react@19.2.3 → @tabler_icons-react@3.36.0_react@19.2.4}/node_modules/@tabler/icons-react/dist/esm/icons/IconLayoutAlignBottom.js +0 -0
- /package/dist/node_modules/.pnpm/{@tabler_icons-react@3.36.0_react@19.2.3 → @tabler_icons-react@3.36.0_react@19.2.4}/node_modules/@tabler/icons-react/dist/esm/icons/IconLayoutAlignCenter.js +0 -0
- /package/dist/node_modules/.pnpm/{@tabler_icons-react@3.36.0_react@19.2.3 → @tabler_icons-react@3.36.0_react@19.2.4}/node_modules/@tabler/icons-react/dist/esm/icons/IconLayoutAlignLeft.js +0 -0
- /package/dist/node_modules/.pnpm/{@tabler_icons-react@3.36.0_react@19.2.3 → @tabler_icons-react@3.36.0_react@19.2.4}/node_modules/@tabler/icons-react/dist/esm/icons/IconLayoutAlignMiddle.js +0 -0
- /package/dist/node_modules/.pnpm/{@tabler_icons-react@3.36.0_react@19.2.3 → @tabler_icons-react@3.36.0_react@19.2.4}/node_modules/@tabler/icons-react/dist/esm/icons/IconLayoutAlignRight.js +0 -0
- /package/dist/node_modules/.pnpm/{@tabler_icons-react@3.36.0_react@19.2.3 → @tabler_icons-react@3.36.0_react@19.2.4}/node_modules/@tabler/icons-react/dist/esm/icons/IconLayoutAlignTop.js +0 -0
- /package/dist/node_modules/.pnpm/{@tabler_icons-react@3.36.0_react@19.2.3 → @tabler_icons-react@3.36.0_react@19.2.4}/node_modules/@tabler/icons-react/dist/esm/icons/IconLayoutBoardSplit.js +0 -0
- /package/dist/node_modules/.pnpm/{@tabler_icons-react@3.36.0_react@19.2.3 → @tabler_icons-react@3.36.0_react@19.2.4}/node_modules/@tabler/icons-react/dist/esm/icons/IconLayoutCollage.js +0 -0
- /package/dist/node_modules/.pnpm/{@tabler_icons-react@3.36.0_react@19.2.3 → @tabler_icons-react@3.36.0_react@19.2.4}/node_modules/@tabler/icons-react/dist/esm/icons/IconLayoutDashboard.js +0 -0
- /package/dist/node_modules/.pnpm/{@tabler_icons-react@3.36.0_react@19.2.3 → @tabler_icons-react@3.36.0_react@19.2.4}/node_modules/@tabler/icons-react/dist/esm/icons/IconLink.js +0 -0
- /package/dist/node_modules/.pnpm/{@tabler_icons-react@3.36.0_react@19.2.3 → @tabler_icons-react@3.36.0_react@19.2.4}/node_modules/@tabler/icons-react/dist/esm/icons/IconLock.js +0 -0
- /package/dist/node_modules/.pnpm/{@tabler_icons-react@3.36.0_react@19.2.3 → @tabler_icons-react@3.36.0_react@19.2.4}/node_modules/@tabler/icons-react/dist/esm/icons/IconLockOpen2.js +0 -0
- /package/dist/node_modules/.pnpm/{@tabler_icons-react@3.36.0_react@19.2.3 → @tabler_icons-react@3.36.0_react@19.2.4}/node_modules/@tabler/icons-react/dist/esm/icons/IconPlayerPlayFilled.js +0 -0
- /package/dist/node_modules/.pnpm/{@tabler_icons-react@3.36.0_react@19.2.3 → @tabler_icons-react@3.36.0_react@19.2.4}/node_modules/@tabler/icons-react/dist/esm/icons/IconPlayerSkipBackFilled.js +0 -0
- /package/dist/node_modules/.pnpm/{@tabler_icons-react@3.36.0_react@19.2.3 → @tabler_icons-react@3.36.0_react@19.2.4}/node_modules/@tabler/icons-react/dist/esm/icons/IconPlayerSkipForwardFilled.js +0 -0
- /package/dist/node_modules/.pnpm/{@tabler_icons-react@3.36.0_react@19.2.3 → @tabler_icons-react@3.36.0_react@19.2.4}/node_modules/@tabler/icons-react/dist/esm/icons/IconPlayerStopFilled.js +0 -0
- /package/dist/node_modules/.pnpm/{@tabler_icons-react@3.36.0_react@19.2.3 → @tabler_icons-react@3.36.0_react@19.2.4}/node_modules/@tabler/icons-react/dist/esm/icons/IconRectangularPrism.js +0 -0
- /package/dist/node_modules/.pnpm/{@tabler_icons-react@3.36.0_react@19.2.3 → @tabler_icons-react@3.36.0_react@19.2.4}/node_modules/@tabler/icons-react/dist/esm/icons/IconReorder.js +0 -0
- /package/dist/node_modules/.pnpm/{@tabler_icons-react@3.36.0_react@19.2.3 → @tabler_icons-react@3.36.0_react@19.2.4}/node_modules/@tabler/icons-react/dist/esm/icons/IconRouteOff.js +0 -0
- /package/dist/node_modules/.pnpm/{@tabler_icons-react@3.36.0_react@19.2.3 → @tabler_icons-react@3.36.0_react@19.2.4}/node_modules/@tabler/icons-react/dist/esm/icons/IconSearch.js +0 -0
- /package/dist/node_modules/.pnpm/{@tabler_icons-react@3.36.0_react@19.2.3 → @tabler_icons-react@3.36.0_react@19.2.4}/node_modules/@tabler/icons-react/dist/esm/icons/IconSelector.js +0 -0
- /package/dist/node_modules/.pnpm/{@tabler_icons-react@3.36.0_react@19.2.3 → @tabler_icons-react@3.36.0_react@19.2.4}/node_modules/@tabler/icons-react/dist/esm/icons/IconStack2.js +0 -0
- /package/dist/node_modules/.pnpm/{@tabler_icons-react@3.36.0_react@19.2.3 → @tabler_icons-react@3.36.0_react@19.2.4}/node_modules/@tabler/icons-react/dist/esm/icons/IconStarFilled.js +0 -0
- /package/dist/node_modules/.pnpm/{@tabler_icons-react@3.36.0_react@19.2.3 → @tabler_icons-react@3.36.0_react@19.2.4}/node_modules/@tabler/icons-react/dist/esm/icons/IconTarget.js +0 -0
- /package/dist/node_modules/.pnpm/{@tabler_icons-react@3.36.0_react@19.2.3 → @tabler_icons-react@3.36.0_react@19.2.4}/node_modules/@tabler/icons-react/dist/esm/icons/IconTransform.js +0 -0
- /package/dist/node_modules/.pnpm/{@tabler_icons-react@3.36.0_react@19.2.3 → @tabler_icons-react@3.36.0_react@19.2.4}/node_modules/@tabler/icons-react/dist/esm/icons/IconUser.js +0 -0
- /package/dist/node_modules/.pnpm/{@tabler_icons-react@3.36.0_react@19.2.3 → @tabler_icons-react@3.36.0_react@19.2.4}/node_modules/@tabler/icons-react/dist/esm/icons/IconX.js +0 -0
- /package/dist/node_modules/.pnpm/{@tabler_icons-react@3.36.0_react@19.2.3 → @tabler_icons-react@3.36.0_react@19.2.4}/node_modules/@tabler/icons-react/dist/esm/icons/IconZoomScan.js +0 -0
|
@@ -18,9 +18,9 @@ function useLikeC4ViewModel(viewId) {
|
|
|
18
18
|
}
|
|
19
19
|
function useLikeC4Specification() {
|
|
20
20
|
const model = useLikeC4Model();
|
|
21
|
-
const [specification, setSpecification] = useState(model
|
|
21
|
+
const [specification, setSpecification] = useState(model.specification);
|
|
22
22
|
useEffect(() => {
|
|
23
|
-
setSpecification((current) => deepEqual(current, model
|
|
23
|
+
setSpecification((current) => deepEqual(current, model.specification) ? current : model.specification);
|
|
24
24
|
}, [model]);
|
|
25
25
|
return specification;
|
|
26
26
|
}
|
|
@@ -1,2 +1,7 @@
|
|
|
1
1
|
import { NonEmptyObject } from 'type-fest';
|
|
2
|
-
|
|
2
|
+
/**
|
|
3
|
+
* Differs from useState in that:
|
|
4
|
+
* - it uses custom equal function (shallowEqual by default) to determine whether the state has changed.
|
|
5
|
+
* - allows partial updates to the state
|
|
6
|
+
*/
|
|
7
|
+
export declare function useSetState<T extends object>(initialState: T | (() => T), equal?: (a: T, b: T) => boolean): readonly [T, (statePartial: NonEmptyObject<Partial<T>> | ((current: T) => NonEmptyObject<Partial<T>>)) => void];
|
|
@@ -1,17 +1,20 @@
|
|
|
1
1
|
import { shallowEqual } from 'fast-equals';
|
|
2
|
-
import { useState, useCallback } from 'react';
|
|
2
|
+
import { useState, useRef, useCallback } from 'react';
|
|
3
3
|
|
|
4
|
-
function useSetState(initialState) {
|
|
4
|
+
function useSetState(initialState, equal) {
|
|
5
5
|
const [state, _setState] = useState(initialState);
|
|
6
|
+
const equalFn = equal ?? shallowEqual;
|
|
7
|
+
const equalFnRef = useRef(equalFn);
|
|
8
|
+
equalFnRef.current = equalFn;
|
|
6
9
|
const setState = useCallback(
|
|
7
10
|
(statePartial) => _setState((current) => {
|
|
8
11
|
const next = {
|
|
9
12
|
...current,
|
|
10
13
|
...typeof statePartial === "function" ? statePartial(current) : statePartial
|
|
11
14
|
};
|
|
12
|
-
return
|
|
15
|
+
return equalFnRef.current(current, next) ? current : next;
|
|
13
16
|
}),
|
|
14
|
-
[]
|
|
17
|
+
[_setState]
|
|
15
18
|
);
|
|
16
19
|
return [state, setState];
|
|
17
20
|
}
|
|
@@ -12,5 +12,11 @@ export type XYStoreApi = {
|
|
|
12
12
|
};
|
|
13
13
|
export type XYInternalNode = InternalNode<Types.AnyNode>;
|
|
14
14
|
export declare function useXYInternalNode(id: string): XYInternalNode | undefined;
|
|
15
|
-
|
|
15
|
+
/**
|
|
16
|
+
* Returns the current zoom level of the flow.
|
|
17
|
+
* @param precision The number of decimal places to round to, defaults to 2 (i.e. 1.23)
|
|
18
|
+
* @returns The current zoom level of the flow.
|
|
19
|
+
*/
|
|
20
|
+
export declare function useCurrentZoom(precision?: number): number;
|
|
21
|
+
export declare function useCurrentZoomAtLeast(minZoom: number): boolean;
|
|
16
22
|
export declare function useIsZoomTooSmall(): boolean;
|
package/dist/hooks/useXYFlow.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { useStore, useStoreApi, useReactFlow } from '@xyflow/react';
|
|
2
2
|
import { shallowEqual } from 'fast-equals';
|
|
3
|
+
import { useCallback } from 'react';
|
|
3
4
|
import { useCallbackRef } from './useCallbackRef.js';
|
|
4
5
|
|
|
5
6
|
function useXYFlow() {
|
|
@@ -14,13 +15,12 @@ function useXYStore(selector, equalityFn) {
|
|
|
14
15
|
function useXYStoreApi() {
|
|
15
16
|
return useStoreApi();
|
|
16
17
|
}
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
return useStore(selectCurrentZoom);
|
|
18
|
+
function useCurrentZoomAtLeast(minZoom) {
|
|
19
|
+
return useStore(useCallback((state) => state.transform[2] >= minZoom, [minZoom]));
|
|
20
20
|
}
|
|
21
21
|
const selectZoom = (state) => state.transform[2] < 0.2;
|
|
22
22
|
function useIsZoomTooSmall() {
|
|
23
23
|
return useStore(selectZoom);
|
|
24
24
|
}
|
|
25
25
|
|
|
26
|
-
export {
|
|
26
|
+
export { useCurrentZoomAtLeast, useIsZoomTooSmall, useXYFlow, useXYStore, useXYStoreApi };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
export { IconRendererProvider } from './context/IconRenderer';
|
|
2
2
|
export { LikeC4Diagram, type LikeC4DiagramProps, } from './LikeC4Diagram';
|
|
3
|
-
export type { ElementIconRenderer, ElementIconRendererProps, LikeC4ColorScheme, NodeRenderers, OnCanvasClick,
|
|
3
|
+
export type { ElementIconRenderer, ElementIconRendererProps, LikeC4ColorScheme, NodeRenderers, OnCanvasClick, OnEdgeClick, OnInitialized, OnNavigateTo, OnNodeClick, OnOpenSource, PaddingWithUnit, ViewPadding, WhereOperator, } from './LikeC4Diagram.props';
|
|
4
4
|
export { LikeC4ModelProvider, type LikeC4ModelProviderProps, } from './LikeC4ModelProvider';
|
|
5
|
-
export {
|
|
5
|
+
export { LikeC4EditorProvider, type LikeC4EditorProviderProps, } from './editor/LikeC4EditorProvider';
|
|
6
|
+
export { createLikeC4Editor, type LikeC4EditorCallbacks, } from './editor/LikeC4EditorCallbacks';
|
|
6
7
|
export { LikeC4ProjectsProvider, type LikeC4ProjectsProviderProps, } from './LikeC4ProjectsProvider';
|
|
7
8
|
export { type DiagramApi, type DiagramContext, useDiagram, useDiagramContext, useOnDiagramEvent, } from './hooks/useDiagram';
|
|
8
9
|
export { useLikeC4Model, useLikeC4Specification, useLikeC4ViewModel, } from './hooks/useLikeC4Model';
|
|
9
|
-
export { useCurrentViewModel } from './hooks/useCurrentViewModel';
|
|
10
|
+
export { type CurrentViewModel, useCurrentViewModel, useOptionalCurrentViewModel, } from './hooks/useCurrentViewModel';
|
|
10
11
|
export { useChangeLikeC4Project, useHasProjects, useLikeC4Project, useLikeC4ProjectId, useLikeC4Projects, useLikeC4ProjectsContext, } from './hooks/useLikeC4Project';
|
|
11
12
|
export { useLikeC4Styles } from './hooks/useLikeC4Styles';
|
|
12
13
|
export { useUpdateEffect } from './hooks/useUpdateEffect';
|
|
@@ -15,6 +16,8 @@ export { StaticLikeC4Diagram } from './StaticLikeC4Diagram';
|
|
|
15
16
|
export { LikeC4View } from './LikeC4View';
|
|
16
17
|
export type { LikeC4BrowserProps, LikeC4ViewProps } from './LikeC4View';
|
|
17
18
|
export { ReactLikeC4, type ReactLikeC4Props } from './ReactLikeC4';
|
|
18
|
-
export { useCurrentViewId } from './hooks/useCurrentView';
|
|
19
|
+
export { useCurrentView, useCurrentViewId, } from './hooks/useCurrentView';
|
|
19
20
|
export { pickViewBounds } from './utils/view-bounds';
|
|
20
21
|
export { LikeC4ProjectsOverview, type LikeC4ProjectsOverviewProps, } from './LikeC4ProjectsOverview';
|
|
22
|
+
export type { AdhocViewService, } from './adhoc-editor/actor.types';
|
|
23
|
+
export { LikeC4AdHocViewEditor, } from './adhoc-editor/LikeC4AdHocViewEditor';
|
package/dist/index.js
CHANGED
|
@@ -2,17 +2,19 @@ export { IconRendererProvider } from './context/IconRenderer.js';
|
|
|
2
2
|
export { LikeC4Diagram } from './LikeC4Diagram.js';
|
|
3
3
|
export { LikeC4ModelProvider } from './LikeC4ModelProvider.js';
|
|
4
4
|
export { LikeC4EditorProvider } from './editor/LikeC4EditorProvider.js';
|
|
5
|
+
export { createLikeC4Editor } from './editor/LikeC4EditorCallbacks.js';
|
|
5
6
|
export { LikeC4ProjectsProvider } from './LikeC4ProjectsProvider.js';
|
|
6
7
|
export { useDiagramContext, useOnDiagramEvent } from './hooks/useDiagram.js';
|
|
7
8
|
export { useLikeC4Model, useLikeC4Specification, useLikeC4ViewModel } from './hooks/useLikeC4Model.js';
|
|
8
|
-
export { useCurrentViewModel } from './hooks/useCurrentViewModel.js';
|
|
9
|
+
export { useCurrentViewModel, useOptionalCurrentViewModel } from './hooks/useCurrentViewModel.js';
|
|
9
10
|
export { useChangeLikeC4Project, useHasProjects, useLikeC4Project, useLikeC4ProjectId, useLikeC4Projects, useLikeC4ProjectsContext } from './hooks/useLikeC4Project.js';
|
|
10
11
|
export { useLikeC4Styles } from './hooks/useLikeC4Styles.js';
|
|
11
12
|
export { useUpdateEffect } from './hooks/useUpdateEffect.js';
|
|
12
13
|
export { StaticLikeC4Diagram } from './StaticLikeC4Diagram.js';
|
|
13
14
|
export { LikeC4View } from './LikeC4View.js';
|
|
14
15
|
export { ReactLikeC4 } from './ReactLikeC4.js';
|
|
15
|
-
export { useCurrentViewId } from './hooks/useCurrentView.js';
|
|
16
|
+
export { useCurrentView, useCurrentViewId } from './hooks/useCurrentView.js';
|
|
16
17
|
export { pickViewBounds } from './utils/view-bounds.js';
|
|
17
18
|
export { LikeC4ProjectsOverview } from './LikeC4ProjectsOverview.js';
|
|
19
|
+
export { LikeC4AdHocViewEditor } from './adhoc-editor/LikeC4AdHocViewEditor.js';
|
|
18
20
|
export { useDiagram } from './hooks/safeContext.js';
|
|
@@ -4,7 +4,6 @@ import { memo, useCallback } from 'react';
|
|
|
4
4
|
import { ErrorBoundary } from '../components/ErrorFallback.js';
|
|
5
5
|
import { useEnabledFeatures } from '../context/DiagramFeatures.js';
|
|
6
6
|
import { useOverlaysActorRef } from '../hooks/useOverlaysActor.js';
|
|
7
|
-
import { useSearchActorRef } from '../hooks/useSearchActor.js';
|
|
8
7
|
import { Overlays } from '../overlays/Overlays.js';
|
|
9
8
|
import { Search } from '../search/Search.js';
|
|
10
9
|
import { RelationshipPopover } from './relationship-popover/RelationshipPopover.js';
|
|
@@ -23,7 +22,6 @@ const LikeC4DiagramUI = memo(() => {
|
|
|
23
22
|
} = useEnabledFeatures();
|
|
24
23
|
const rerender = useRerender();
|
|
25
24
|
const overlaysActorRef = useOverlaysActorRef();
|
|
26
|
-
const searchActorRef = useSearchActorRef();
|
|
27
25
|
const handleReset = useCallback(() => {
|
|
28
26
|
console.warn("DiagramUI: resetting error boundary and rerendering...");
|
|
29
27
|
rerender();
|
|
@@ -32,7 +30,7 @@ const LikeC4DiagramUI = memo(() => {
|
|
|
32
30
|
enableControls && /* @__PURE__ */ jsx(NavigationPanel, {}),
|
|
33
31
|
overlaysActorRef && /* @__PURE__ */ jsx(Overlays, { overlaysActorRef }),
|
|
34
32
|
enableNotations && /* @__PURE__ */ jsx(NotationPanel, {}),
|
|
35
|
-
enableSearch &&
|
|
33
|
+
enableSearch && /* @__PURE__ */ jsx(Search, {}),
|
|
36
34
|
enableRelationshipDetails && enableReadOnly && /* @__PURE__ */ jsx(RelationshipPopover, {}),
|
|
37
35
|
enableCompareWithLatest && /* @__PURE__ */ jsx(LayoutDriftFrame, {})
|
|
38
36
|
] });
|
|
@@ -12,6 +12,7 @@ import { useDiagramActorSnapshot } from '../hooks/useDiagram.js';
|
|
|
12
12
|
import { depsShallowEqual, useUpdateEffect } from '../hooks/useUpdateEffect.js';
|
|
13
13
|
import { BuiltinEdges, BuiltinNodes } from './custom/index.js';
|
|
14
14
|
import { deriveToggledFeatures } from './state/machine.setup.js';
|
|
15
|
+
import { viewBounds } from './state/utils.js';
|
|
15
16
|
import { useLayoutConstraints } from './useLayoutConstraints.js';
|
|
16
17
|
import { useDiagram } from '../hooks/safeContext.js';
|
|
17
18
|
import { useDiagramEventHandlers } from '../context/DiagramEventHandlers.js';
|
|
@@ -44,9 +45,21 @@ function prepareNodeTypes(nodeTypes) {
|
|
|
44
45
|
"seq-parallel": nodeTypes.seqParallel ?? builtinNodes["seq-parallel"]
|
|
45
46
|
};
|
|
46
47
|
}
|
|
48
|
+
const viewportToTopLeft = (ctx) => {
|
|
49
|
+
const bounds = viewBounds(ctx);
|
|
50
|
+
return {
|
|
51
|
+
x: -bounds.x,
|
|
52
|
+
y: -bounds.y,
|
|
53
|
+
zoom: 1
|
|
54
|
+
};
|
|
55
|
+
};
|
|
47
56
|
const selectXYProps = ({ context: ctx, children }) => {
|
|
48
57
|
const { enableReadOnly } = deriveToggledFeatures(ctx);
|
|
49
58
|
const isNotEditingEdge = enableReadOnly || children.editor?.getSnapshot().context.editing !== "edge";
|
|
59
|
+
let nodesDraggable = !enableReadOnly && ctx.nodesDraggable;
|
|
60
|
+
if (ctx.dynamicViewVariant === "sequence" && ctx.view._type === "dynamic") {
|
|
61
|
+
nodesDraggable = false;
|
|
62
|
+
}
|
|
50
63
|
return {
|
|
51
64
|
enableReadOnly,
|
|
52
65
|
initialized: ctx.initialized.xydata && ctx.initialized.xyflow,
|
|
@@ -54,16 +67,12 @@ const selectXYProps = ({ context: ctx, children }) => {
|
|
|
54
67
|
edges: ctx.xyedges,
|
|
55
68
|
pannable: ctx.pannable,
|
|
56
69
|
zoomable: ctx.zoomable,
|
|
57
|
-
nodesDraggable
|
|
70
|
+
nodesDraggable,
|
|
58
71
|
nodesSelectable: ctx.nodesSelectable && isNotEditingEdge,
|
|
59
72
|
fitViewPadding: ctx.fitViewPadding,
|
|
60
73
|
enableFitView: ctx.features.enableFitView,
|
|
61
74
|
...!ctx.features.enableFitView && {
|
|
62
|
-
viewport:
|
|
63
|
-
x: -ctx.view.bounds.x,
|
|
64
|
-
y: -ctx.view.bounds.y,
|
|
65
|
-
zoom: 1
|
|
66
|
-
}
|
|
75
|
+
viewport: viewportToTopLeft(ctx)
|
|
67
76
|
}
|
|
68
77
|
};
|
|
69
78
|
};
|
|
@@ -96,19 +105,23 @@ function LikeC4DiagramXYFlow({
|
|
|
96
105
|
} = useDiagramEventHandlers();
|
|
97
106
|
const isReducedGraphics = useIsReducedGraphics(), layoutConstraints = useLayoutConstraints(), $isPanning = usePanningAtom(), isPanning = useTimeout(() => {
|
|
98
107
|
$isPanning.set(true);
|
|
99
|
-
}, isReducedGraphics ?
|
|
108
|
+
}, isReducedGraphics ? 200 : 800), notPanning = useDebouncedCallback(() => {
|
|
100
109
|
isPanning.clear();
|
|
101
110
|
$isPanning.set(false);
|
|
102
|
-
},
|
|
111
|
+
}, { delay: 200 }), onMove = useCallbackRef((event) => {
|
|
103
112
|
if (!event) {
|
|
113
|
+
isPanning.clear();
|
|
104
114
|
return;
|
|
105
115
|
}
|
|
106
116
|
if (!$isPanning.get()) {
|
|
107
117
|
isPanning.start();
|
|
118
|
+
} else {
|
|
119
|
+
notPanning();
|
|
108
120
|
}
|
|
109
|
-
notPanning();
|
|
110
121
|
}), onMoveEnd = useCallbackRef((event, viewport) => {
|
|
111
|
-
|
|
122
|
+
if (event) {
|
|
123
|
+
notPanning();
|
|
124
|
+
}
|
|
112
125
|
diagram.send({
|
|
113
126
|
type: "xyflow.viewportMoved",
|
|
114
127
|
viewport,
|
|
@@ -133,10 +146,10 @@ function LikeC4DiagramXYFlow({
|
|
|
133
146
|
nodeTypes,
|
|
134
147
|
edgeTypes,
|
|
135
148
|
onNodesChange: useCallbackRef((changes) => {
|
|
136
|
-
diagram.send({ type: "xyflow.
|
|
149
|
+
diagram.send({ type: "xyflow.applyChanges", nodes: changes });
|
|
137
150
|
}),
|
|
138
151
|
onEdgesChange: useCallbackRef((changes) => {
|
|
139
|
-
diagram.send({ type: "xyflow.
|
|
152
|
+
diagram.send({ type: "xyflow.applyChanges", edges: changes });
|
|
140
153
|
}),
|
|
141
154
|
background: initialized ? background : "transparent",
|
|
142
155
|
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: {
|
|
@@ -294,11 +294,10 @@ function ControlPoints({
|
|
|
294
294
|
});
|
|
295
295
|
};
|
|
296
296
|
const onRmbControlPointerDown = (index, e) => {
|
|
297
|
-
if (controlPoints.length <= 1) {
|
|
297
|
+
if (controlPoints.length <= 1 || index >= controlPoints.length) {
|
|
298
298
|
return;
|
|
299
299
|
}
|
|
300
|
-
e
|
|
301
|
-
e.preventDefault();
|
|
300
|
+
stopAndPrevent(e);
|
|
302
301
|
const newControlPoints = controlPoints.slice();
|
|
303
302
|
newControlPoints.splice(index, 1);
|
|
304
303
|
setTimeout(() => {
|
|
@@ -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,13 @@
|
|
|
1
|
-
import { nonNullable } from '@likec4/core';
|
|
1
|
+
import { nonNullable, vector } from '@likec4/core';
|
|
2
|
+
import { getNodeDimensions } from '@xyflow/system';
|
|
2
3
|
import { line, curveCatmullRomOpen } from 'd3-shape';
|
|
3
|
-
import {
|
|
4
|
+
import { shallowEqual } from 'fast-equals';
|
|
5
|
+
import { useCallback, useMemo } from 'react';
|
|
4
6
|
import { isTruthy, first, last } from 'remeda';
|
|
5
7
|
import { useXYStore } from '../../../hooks/useXYFlow.js';
|
|
6
|
-
import {
|
|
8
|
+
import { bezierPath, getNodeIntersectionFromCenterToPoint } from '../../../utils/xyflow.js';
|
|
7
9
|
|
|
8
10
|
const curve = line().curve(curveCatmullRomOpen.alpha(0.7)).x((d) => Math.round(d.x)).y((d) => Math.round(d.y));
|
|
9
|
-
const isSameRects = (a, b) => isEqualRects(a.sourceNode, b.sourceNode) && isEqualRects(a.targetNode, b.targetNode);
|
|
10
11
|
function useRelationshipEdgePath({
|
|
11
12
|
props: {
|
|
12
13
|
sourceX,
|
|
@@ -20,41 +21,73 @@ function useRelationshipEdgePath({
|
|
|
20
21
|
controlPoints,
|
|
21
22
|
isControlPointDragging
|
|
22
23
|
}) {
|
|
23
|
-
const
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
24
|
+
const [
|
|
25
|
+
sourceNodeWidth,
|
|
26
|
+
sourceNodeHeight,
|
|
27
|
+
targetNodeWidth,
|
|
28
|
+
targetNodeHeight
|
|
29
|
+
] = useXYStore(
|
|
27
30
|
useCallback(({ nodeLookup }) => {
|
|
28
|
-
const
|
|
29
|
-
const
|
|
30
|
-
return
|
|
31
|
-
sourceNode
|
|
32
|
-
|
|
33
|
-
|
|
31
|
+
const sourceNode = getNodeDimensions(nonNullable(nodeLookup.get(source), `source node ${source} not found`));
|
|
32
|
+
const targetNode = getNodeDimensions(nonNullable(nodeLookup.get(target), `target node ${target} not found`));
|
|
33
|
+
return [
|
|
34
|
+
Math.round(sourceNode.width),
|
|
35
|
+
Math.round(sourceNode.height),
|
|
36
|
+
Math.round(targetNode.width),
|
|
37
|
+
Math.round(targetNode.height)
|
|
38
|
+
];
|
|
34
39
|
}, [source, target]),
|
|
35
|
-
|
|
40
|
+
shallowEqual
|
|
36
41
|
);
|
|
37
42
|
const isModified = isTruthy(data.controlPoints) || isControlPointDragging;
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
43
|
+
return useMemo(
|
|
44
|
+
() => {
|
|
45
|
+
if (!isModified) {
|
|
46
|
+
return bezierPath(data.points);
|
|
47
|
+
}
|
|
48
|
+
const sourceCenterPos = { x: sourceX, y: sourceY };
|
|
49
|
+
const targetCenterPos = { x: targetX, y: targetY };
|
|
50
|
+
const sourceNd = {
|
|
51
|
+
...vector(sourceX, sourceY).subtract(vector(sourceNodeWidth, sourceNodeHeight).divide(2)).round().toObject(),
|
|
52
|
+
width: sourceNodeWidth,
|
|
53
|
+
height: sourceNodeHeight
|
|
54
|
+
};
|
|
55
|
+
const targetNd = {
|
|
56
|
+
...vector(targetX, targetY).subtract(vector(targetNodeWidth, targetNodeHeight).divide(2)).round().toObject(),
|
|
57
|
+
width: targetNodeWidth,
|
|
58
|
+
height: targetNodeHeight
|
|
59
|
+
};
|
|
60
|
+
const nodeMargin = 6;
|
|
61
|
+
const points = data.dir === "back" ? [
|
|
62
|
+
targetCenterPos,
|
|
63
|
+
getNodeIntersectionFromCenterToPoint(targetNd, first(controlPoints) ?? sourceCenterPos, nodeMargin),
|
|
64
|
+
...controlPoints,
|
|
65
|
+
getNodeIntersectionFromCenterToPoint(sourceNd, last(controlPoints) ?? targetCenterPos, nodeMargin),
|
|
66
|
+
sourceCenterPos
|
|
67
|
+
] : [
|
|
68
|
+
sourceCenterPos,
|
|
69
|
+
getNodeIntersectionFromCenterToPoint(sourceNd, first(controlPoints) ?? targetCenterPos, nodeMargin),
|
|
70
|
+
...controlPoints,
|
|
71
|
+
getNodeIntersectionFromCenterToPoint(targetNd, last(controlPoints) ?? sourceCenterPos, nodeMargin),
|
|
72
|
+
targetCenterPos
|
|
73
|
+
];
|
|
74
|
+
return nonNullable(curve(points));
|
|
75
|
+
},
|
|
76
|
+
[
|
|
77
|
+
data.points,
|
|
78
|
+
isModified,
|
|
79
|
+
isModified ? sourceX : void 0,
|
|
80
|
+
isModified ? sourceY : void 0,
|
|
81
|
+
isModified ? targetX : void 0,
|
|
82
|
+
isModified ? targetY : void 0,
|
|
83
|
+
isModified ? sourceNodeWidth : void 0,
|
|
84
|
+
isModified ? sourceNodeHeight : void 0,
|
|
85
|
+
isModified ? targetNodeWidth : void 0,
|
|
86
|
+
isModified ? targetNodeHeight : void 0,
|
|
87
|
+
isModified ? data.dir : void 0,
|
|
88
|
+
isModified ? controlPoints : void 0
|
|
89
|
+
]
|
|
90
|
+
);
|
|
58
91
|
}
|
|
59
92
|
|
|
60
93
|
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.0_react@19.2.
|
|
9
|
-
import IconTransform from '../../../node_modules/.pnpm/@tabler_icons-react@3.36.0_react@19.2.
|
|
8
|
+
import IconZoomScan from '../../../node_modules/.pnpm/@tabler_icons-react@3.36.0_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.0_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
|
|
@@ -7,6 +7,7 @@ import { useEnabledFeatures } from '../../../context/DiagramFeatures.js';
|
|
|
7
7
|
import { ElementActions } from './ElementActions.js';
|
|
8
8
|
import { NodeDrifts } from './NodeDrifts.js';
|
|
9
9
|
import { ElementDetailsButtonWithHandler } from './nodes.js';
|
|
10
|
+
import { ElementToolbar } from './toolbar/ElementToolbar.js';
|
|
10
11
|
import { ElementNodeContainer } from '../../../base-primitives/element/ElementNodeContainer.js';
|
|
11
12
|
import { ElementShape } from '../../../base-primitives/element/ElementShape.js';
|
|
12
13
|
import { ElementData } from '../../../base-primitives/element/ElementData.js';
|
|
@@ -67,9 +68,9 @@ const ActorStepPort = ({
|
|
|
67
68
|
)
|
|
68
69
|
] });
|
|
69
70
|
};
|
|
70
|
-
const hasModelFqn = (
|
|
71
|
+
const hasModelFqn = (node) => "modelFqn" in node.data && isTruthy(node.data.modelFqn);
|
|
71
72
|
function SequenceActorNode(props) {
|
|
72
|
-
const { enableElementDetails, enableCompareWithLatest } = useEnabledFeatures();
|
|
73
|
+
const { enableElementDetails, enableReadOnly, enableCompareWithLatest } = useEnabledFeatures();
|
|
73
74
|
const data = props.data;
|
|
74
75
|
const {
|
|
75
76
|
id,
|
|
@@ -109,9 +110,10 @@ function SequenceActorNode(props) {
|
|
|
109
110
|
enableCompareWithLatest && /* @__PURE__ */ jsx(NodeDrifts, { nodeProps: props }),
|
|
110
111
|
/* @__PURE__ */ jsx(ElementShape, { ...props }),
|
|
111
112
|
/* @__PURE__ */ jsx(ElementData, { ...props }),
|
|
112
|
-
hasModelFqn(
|
|
113
|
-
/* @__PURE__ */ jsx(ElementActions, { ...props
|
|
114
|
-
enableElementDetails && /* @__PURE__ */ jsx(ElementDetailsButtonWithHandler, { id, data })
|
|
113
|
+
hasModelFqn(props) && /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
114
|
+
/* @__PURE__ */ jsx(ElementActions, { ...props }),
|
|
115
|
+
enableElementDetails && /* @__PURE__ */ jsx(ElementDetailsButtonWithHandler, { id, data }),
|
|
116
|
+
!enableReadOnly && /* @__PURE__ */ jsx(ElementToolbar, { ...props })
|
|
115
117
|
] })
|
|
116
118
|
] }),
|
|
117
119
|
ports.map((p) => /* @__PURE__ */ jsx(ActorStepPort, { port: p, data: props.data }, p.id))
|