@likec4/diagram 1.43.0 → 1.45.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/bundle/index.js +14727 -13166
- package/dist/LikeC4Diagram.d.ts +1 -1
- package/dist/LikeC4Diagram.js +14 -9
- package/dist/LikeC4Diagram.props.d.ts +25 -15
- package/dist/LikeC4ProjectsProvider.js +1 -1
- package/dist/LikeC4Styles.js +0 -3
- package/dist/LikeC4View.d.ts +8 -3
- package/dist/LikeC4View.js +29 -14
- package/dist/ReactLikeC4.d.ts +2 -2
- package/dist/ReactLikeC4.js +2 -2
- package/dist/StaticLikeC4Diagram.js +1 -1
- package/dist/_virtual/_commonjsHelpers.js +3 -0
- package/dist/_virtual/assign-dea9f7c8.cjs.js +3 -0
- package/dist/_virtual/log-ec8d4df4.cjs.js +3 -0
- package/dist/_virtual/raise-da5b247f.cjs.js +3 -0
- package/dist/_virtual/xstate-actions.cjs.js +5 -0
- package/dist/_virtual/xstate-actions.cjs2.js +3 -0
- package/dist/_virtual/xstate-dev.cjs.js +3 -0
- package/dist/_virtual/xstate-guards.cjs.js +5 -0
- package/dist/_virtual/xstate-guards.cjs2.js +3 -0
- package/dist/base/Background.d.ts +2 -1
- package/dist/base/Background.js +11 -2
- package/dist/base/Base.d.ts +28 -0
- package/dist/base/BaseXYFlow.d.ts +5 -5
- package/dist/base/BaseXYFlow.js +38 -44
- package/dist/base/index.d.ts +6 -2
- package/dist/base/types.d.ts +1 -28
- package/dist/base/updateEdges.js +25 -14
- package/dist/base/updateNodes.d.ts +14 -0
- package/dist/base/updateNodes.js +51 -17
- package/dist/base-primitives/Markdown.d.ts +30 -4
- package/dist/base-primitives/Markdown.js +3 -2
- package/dist/base-primitives/compound/CompoundActionButton.d.ts +3 -2
- package/dist/base-primitives/compound/CompoundActionButton.js +1 -1
- package/dist/base-primitives/compound/CompoundDetailsButton.d.ts +3 -2
- package/dist/base-primitives/compound/CompoundDetailsButton.js +1 -1
- package/dist/base-primitives/edge/EdgeActionButton.d.ts +3 -2
- package/dist/base-primitives/edge/EdgeActionButton.js +1 -1
- package/dist/base-primitives/edge/EdgeContainer.d.ts +1 -1
- package/dist/base-primitives/edge/EdgeContainer.js +8 -1
- package/dist/base-primitives/edge/EdgeLabel.d.ts +3 -2
- package/dist/base-primitives/edge/EdgeLabel.js +2 -0
- package/dist/base-primitives/edge/EdgeLabelContainer.d.ts +1 -1
- package/dist/base-primitives/edge/EdgeLabelContainer.js +4 -0
- package/dist/base-primitives/edge/EdgePath.d.ts +4 -0
- package/dist/base-primitives/edge/EdgePath.js +29 -5
- package/dist/base-primitives/element/ElementActionButtons.d.ts +6 -4
- package/dist/base-primitives/element/ElementActionButtons.js +3 -3
- package/dist/base-primitives/element/ElementData.d.ts +3 -3
- package/dist/base-primitives/element/ElementData.js +13 -7
- package/dist/base-primitives/element/ElementDetailsButton.d.ts +3 -2
- package/dist/base-primitives/element/ElementDetailsButton.js +5 -5
- package/dist/base-primitives/element/ElementNodeContainer.css.js +15 -27
- package/dist/base-primitives/element/ElementShape.js +5 -5
- package/dist/base-primitives/element/ElementTags.d.ts +6 -4
- package/dist/base-primitives/element/ElementTags.js +2 -1
- package/dist/base-primitives/memoEdge.js +4 -2
- package/dist/base-primitives/memoNode.d.ts +1 -1
- package/dist/base-primitives/memoNode.js +3 -3
- package/dist/components/ErrorFallback.js +52 -35
- package/dist/components/Link.js +2 -2
- package/dist/context/DiagramEventHandlers.js +2 -1
- package/dist/context/DiagramFeatures.d.ts +25 -6
- package/dist/context/DiagramFeatures.js +28 -56
- package/dist/context/IconRenderer.js +6 -6
- package/dist/context/LikeC4ModelContext.js +3 -10
- package/dist/context/TagStylesContext.js +3 -19
- package/dist/context/index.d.ts +1 -1
- package/dist/custom/customNodes.js +3 -2
- package/dist/custom/hooks.d.ts +3 -3
- package/dist/custom/index.d.ts +1 -1
- package/dist/custom/index.js +5 -5
- package/dist/editor/LikeC4EditorContext.d.ts +21 -0
- package/dist/editor/index.d.ts +2 -0
- package/dist/hooks/index.d.ts +4 -2
- package/dist/hooks/safeContext.d.ts +6 -3
- package/dist/hooks/safeContext.js +10 -3
- package/dist/hooks/useCallbackRef.d.ts +1 -0
- package/dist/hooks/useCallbackRef.js +13 -0
- package/dist/hooks/useCurrentView.d.ts +11 -0
- package/dist/hooks/{useCurrentViewId.js → useCurrentView.js} +7 -3
- package/dist/hooks/useCurrentViewModel.js +4 -1
- package/dist/hooks/useDiagram.d.ts +7 -113
- package/dist/hooks/useDiagram.js +7 -127
- package/dist/hooks/useDiagramCompareLayout.d.ts +35 -0
- package/dist/hooks/useDiagramCompareLayout.js +65 -0
- package/dist/hooks/useLikeC4Project.d.ts +6 -1
- package/dist/hooks/useLikeC4Project.js +14 -2
- package/dist/hooks/useMediaPrint.d.ts +6 -0
- package/dist/hooks/useUpdateEffect.js +2 -4
- package/dist/hooks/useXYFlow.d.ts +1 -0
- package/dist/hooks/useXYFlow.js +4 -7
- package/dist/index.d.ts +2 -2
- package/dist/index.js +4 -3
- package/dist/likec4diagram/DiagramUI.js +14 -7
- package/dist/likec4diagram/DiagramXYFlow.d.ts +2 -2
- package/dist/likec4diagram/DiagramXYFlow.js +60 -52
- package/dist/likec4diagram/convert-to-xyflow.d.ts +0 -1
- package/dist/likec4diagram/custom/edges/EdgeDrifts.d.ts +6 -0
- package/dist/likec4diagram/custom/edges/EdgeDrifts.js +38 -0
- package/dist/likec4diagram/custom/edges/RelationshipEdge.js +256 -217
- package/dist/likec4diagram/custom/edges/SequenceStepEdge.js +9 -2
- package/dist/likec4diagram/custom/edges/edges.css.js +3 -4
- package/dist/likec4diagram/custom/edges/useControlPoints.d.ts +8 -0
- package/dist/likec4diagram/custom/edges/useControlPoints.js +58 -0
- package/dist/likec4diagram/custom/edges/useRelationshipEdgePath.d.ts +7 -0
- package/dist/likec4diagram/custom/edges/useRelationshipEdgePath.js +60 -0
- package/dist/likec4diagram/custom/edges/utils.d.ts +0 -12
- package/dist/likec4diagram/custom/nodes/CompoundActions.js +4 -1
- package/dist/likec4diagram/custom/nodes/ElementActions.d.ts +2 -1
- package/dist/likec4diagram/custom/nodes/ElementActions.js +15 -10
- package/dist/likec4diagram/custom/nodes/NodeDrifts.d.ts +6 -0
- package/dist/likec4diagram/custom/nodes/NodeDrifts.js +50 -0
- package/dist/likec4diagram/custom/nodes/SequenceActorNode.js +7 -2
- package/dist/likec4diagram/custom/nodes/index.d.ts +1 -0
- package/dist/likec4diagram/custom/nodes/nodes.d.ts +9 -1
- package/dist/likec4diagram/custom/nodes/nodes.js +74 -29
- package/dist/likec4diagram/custom/nodes/toolbar/ColorButton.d.ts +1 -1
- package/dist/likec4diagram/custom/nodes/toolbar/ColorButton.js +1 -1
- package/dist/likec4diagram/custom/nodes/toolbar/CompoundToolbar.js +2 -1
- package/dist/likec4diagram/custom/nodes/toolbar/ElementToolbar.js +4 -3
- package/dist/likec4diagram/custom/nodes/toolbar/_shared.d.ts +1 -11
- package/dist/likec4diagram/custom/nodes/toolbar/_shared.js +7 -51
- package/dist/likec4diagram/custom/nodes/toolbar/types.d.ts +5 -0
- package/dist/likec4diagram/custom/nodes/toolbar/types.js +7 -0
- package/dist/likec4diagram/custom/nodes/toolbar/useHandlers.d.ts +8 -0
- package/dist/likec4diagram/custom/nodes/toolbar/useHandlers.js +44 -0
- package/dist/likec4diagram/relationship-popover/RelationshipPopover.js +8 -10
- package/dist/likec4diagram/relationship-popover/actor.d.ts +1 -1
- package/dist/likec4diagram/state/DiagramActorProvider.d.ts +4 -3
- package/dist/likec4diagram/state/DiagramActorProvider.js +95 -70
- package/dist/likec4diagram/state/assign.d.ts +13 -7
- package/dist/likec4diagram/state/assign.js +43 -282
- package/dist/likec4diagram/state/createViewChange.d.ts +3 -0
- package/dist/likec4diagram/state/createViewChange.js +79 -0
- package/dist/likec4diagram/state/diagram-api.d.ts +109 -0
- package/dist/likec4diagram/state/diagram-api.js +126 -0
- package/dist/likec4diagram/state/machine.actions.d.ts +1783 -0
- package/dist/likec4diagram/state/machine.actions.js +644 -0
- package/dist/likec4diagram/state/machine.actions.layout.d.ts +579 -0
- package/dist/likec4diagram/state/machine.actions.layout.js +129 -0
- package/dist/likec4diagram/state/machine.d.ts +22 -0
- package/dist/likec4diagram/state/machine.js +127 -0
- package/dist/likec4diagram/state/machine.setup.d.ts +327 -0
- package/dist/likec4diagram/state/machine.setup.js +93 -0
- package/dist/likec4diagram/state/machine.state.initializing.d.ts +208 -0
- package/dist/likec4diagram/state/machine.state.initializing.js +55 -0
- package/dist/likec4diagram/state/machine.state.navigating.d.ts +14 -0
- package/dist/likec4diagram/state/machine.state.navigating.js +178 -0
- package/dist/likec4diagram/state/machine.state.ready.d.ts +3131 -0
- package/dist/likec4diagram/state/machine.state.ready.focused.d.ts +386 -0
- package/dist/likec4diagram/state/machine.state.ready.focused.js +85 -0
- package/dist/likec4diagram/state/machine.state.ready.idle.d.ts +474 -0
- package/dist/likec4diagram/state/machine.state.ready.idle.js +96 -0
- package/dist/likec4diagram/state/machine.state.ready.js +262 -0
- package/dist/likec4diagram/state/machine.state.ready.printing.d.ts +128 -0
- package/dist/likec4diagram/state/machine.state.ready.printing.js +40 -0
- package/dist/likec4diagram/state/machine.state.ready.walkthrough.d.ts +511 -0
- package/dist/likec4diagram/state/machine.state.ready.walkthrough.js +177 -0
- package/dist/likec4diagram/state/mediaPrintActor.d.ts +12 -0
- package/dist/likec4diagram/state/mediaPrintActor.js +18 -0
- package/dist/likec4diagram/state/syncManualLayoutActor.d.ts +31 -108
- package/dist/likec4diagram/state/syncManualLayoutActor.js +278 -142
- package/dist/likec4diagram/state/types.d.ts +7 -12
- package/dist/likec4diagram/state/utils.d.ts +19 -4
- package/dist/likec4diagram/state/utils.js +47 -4
- package/dist/likec4diagram/types.d.ts +8 -8
- package/dist/likec4diagram/ui/LayoutDriftFrame.d.ts +2 -0
- package/dist/likec4diagram/ui/LayoutDriftFrame.js +66 -0
- package/dist/likec4diagram/ui/index.d.ts +1 -0
- package/dist/likec4diagram/ui/notation/NotationPanel.css.js +5 -2
- package/dist/likec4diagram/ui/notation/NotationPanel.js +5 -4
- package/dist/likec4diagram/useLayoutConstraints.d.ts +10 -5
- package/dist/likec4diagram/useLayoutConstraints.js +237 -61
- package/dist/likec4diagram/xyflow-diagram/diagram-view.d.ts +0 -1
- package/dist/likec4diagram/xyflow-diagram/diagram-view.js +14 -17
- package/dist/likec4diagram/xyflow-sequence/sequence-layout.js +11 -8
- package/dist/navigationpanel/NavigationPanel.js +16 -8
- package/dist/navigationpanel/NavigationPanelControls.d.ts +2 -1
- package/dist/navigationpanel/NavigationPanelControls.js +23 -17
- package/dist/navigationpanel/NavigationPanelDropdown.d.ts +2 -1
- package/dist/navigationpanel/NavigationPanelDropdown.js +62 -42
- package/dist/navigationpanel/_common.d.ts +1 -1
- package/dist/navigationpanel/_common.js +4 -2
- package/dist/navigationpanel/actor.d.ts +9 -205
- package/dist/navigationpanel/actor.js +6 -5
- package/dist/navigationpanel/comparepanel/CompareActionsMenu.d.ts +3 -0
- package/dist/navigationpanel/comparepanel/CompareActionsMenu.js +59 -0
- package/dist/navigationpanel/comparepanel/ComparePanel.d.ts +2 -0
- package/dist/navigationpanel/comparepanel/ComparePanel.js +42 -0
- package/dist/navigationpanel/comparepanel/ComparePanelControls.d.ts +1 -0
- package/dist/navigationpanel/comparepanel/ComparePanelControls.js +60 -0
- package/dist/navigationpanel/comparepanel/LayoutTypeSwitcher.d.ts +5 -0
- package/dist/navigationpanel/comparepanel/LayoutTypeSwitcher.js +38 -0
- package/dist/navigationpanel/comparepanel/index.d.ts +1 -0
- package/dist/navigationpanel/controls/{ViewDetailsCard.d.ts → DetailsControls.d.ts} +1 -1
- package/dist/navigationpanel/controls/{ViewDetailsCard.js → DetailsControls.js} +18 -14
- package/dist/navigationpanel/controls/LayoutWarning.d.ts +2 -0
- package/dist/navigationpanel/controls/LayoutWarning.js +102 -0
- package/dist/navigationpanel/controls/NavigationButtons.js +4 -3
- package/dist/navigationpanel/controls/OpenSource.js +2 -2
- package/dist/navigationpanel/controls/SearchControl.d.ts +2 -1
- package/dist/navigationpanel/controls/SearchControl.js +15 -17
- package/dist/navigationpanel/controls/ToggleReadonly.d.ts +1 -1
- package/dist/navigationpanel/controls/ToggleReadonly.js +26 -18
- package/dist/navigationpanel/controls/index.d.ts +2 -1
- package/dist/navigationpanel/dropdown/ProjectsMenu.d.ts +2 -2
- package/dist/navigationpanel/dropdown/ProjectsMenu.js +5 -5
- package/dist/navigationpanel/editorpanel/CenterCamera.js +5 -2
- package/dist/navigationpanel/editorpanel/ChangeAutoLayoutButton.d.ts +1 -1
- package/dist/navigationpanel/editorpanel/ChangeAutoLayoutButton.js +21 -20
- package/dist/navigationpanel/editorpanel/EditorPanel.js +3 -3
- package/dist/navigationpanel/editorpanel/ManualLayoutToolsButton.d.ts +2 -2
- package/dist/navigationpanel/editorpanel/ManualLayoutToolsButton.js +16 -13
- package/dist/navigationpanel/editorpanel/ToggleReadonly.d.ts +1 -0
- package/dist/navigationpanel/editorpanel/ToggleReadonly.js +15 -0
- package/dist/navigationpanel/styles.css.d.ts +2 -2
- package/dist/navigationpanel/styles.css.js +4 -4
- package/dist/navigationpanel/walkthrough/ActiveWalkthroughControls.js +14 -8
- package/dist/navigationpanel/walkthrough/DynamicViewControls.d.ts +66 -66
- package/dist/navigationpanel/walkthrough/DynamicViewControls.js +31 -14
- package/dist/navigationpanel/walkthrough/WalkthroughPanel.d.ts +2 -1
- package/dist/navigationpanel/walkthrough/WalkthroughPanel.js +68 -50
- package/dist/node_modules/.pnpm/xstate@5.24.0_patch_hash_3a1bd6d012ec67bf6e38a00c3226d1be77089442f83aeb6e424b00ca2a11d21c/node_modules/xstate/actions/dist/xstate-actions.cjs.js +37 -0
- package/dist/node_modules/.pnpm/xstate@5.24.0_patch_hash_3a1bd6d012ec67bf6e38a00c3226d1be77089442f83aeb6e424b00ca2a11d21c/node_modules/xstate/dev/dist/xstate-dev.cjs.js +59 -0
- package/dist/node_modules/.pnpm/xstate@5.24.0_patch_hash_3a1bd6d012ec67bf6e38a00c3226d1be77089442f83aeb6e424b00ca2a11d21c/node_modules/xstate/dist/assign-dea9f7c8.cjs.js +140 -0
- package/dist/node_modules/.pnpm/xstate@5.24.0_patch_hash_3a1bd6d012ec67bf6e38a00c3226d1be77089442f83aeb6e424b00ca2a11d21c/node_modules/xstate/dist/log-ec8d4df4.cjs.js +401 -0
- package/dist/node_modules/.pnpm/xstate@5.24.0_patch_hash_3a1bd6d012ec67bf6e38a00c3226d1be77089442f83aeb6e424b00ca2a11d21c/node_modules/xstate/dist/raise-da5b247f.cjs.js +2716 -0
- package/dist/node_modules/.pnpm/xstate@5.24.0_patch_hash_3a1bd6d012ec67bf6e38a00c3226d1be77089442f83aeb6e424b00ca2a11d21c/node_modules/xstate/guards/dist/xstate-guards.cjs.js +26 -0
- package/dist/overlays/element-details/ElementDetails.js +7 -7
- package/dist/overlays/element-details/ElementDetailsCard.css.js +3 -3
- package/dist/overlays/element-details/ElementDetailsCard.js +7 -5
- package/dist/overlays/element-details/MetadataValue.d.ts +2 -1
- package/dist/overlays/element-details/MetadataValue.js +2 -2
- package/dist/overlays/element-details/TabPanelDeployments.js +6 -4
- package/dist/overlays/element-details/TabPanelRelationships.js +3 -3
- package/dist/overlays/element-details/TabPanelStructure.js +1 -1
- package/dist/overlays/element-details/actor.d.ts +8 -82
- package/dist/overlays/element-details/actor.js +0 -8
- package/dist/overlays/overlay/Overlay.js +10 -10
- package/dist/overlays/overlaysActor.d.ts +7 -150
- package/dist/overlays/overlaysActor.js +183 -161
- package/dist/overlays/relationship-details/RelationshipDetails.js +4 -3
- package/dist/overlays/relationship-details/SelectEdge.js +2 -2
- package/dist/overlays/relationship-details/_types.d.ts +3 -4
- package/dist/overlays/relationship-details/actor.d.ts +6 -550
- package/dist/overlays/relationship-details/actor.js +18 -3
- package/dist/overlays/relationship-details/custom/ElementActions.js +8 -5
- package/dist/overlays/relationship-details/custom/edgeTypes.js +4 -1
- package/dist/overlays/relationship-details/custom/nodeTypes.js +4 -1
- package/dist/overlays/relationship-details/hooks.js +1 -1
- package/dist/overlays/relationship-details/layout-to-xyflow.js +3 -5
- package/dist/overlays/relationship-details/layout.d.ts +3 -3
- package/dist/overlays/relationship-details/layout.js +4 -4
- package/dist/overlays/relationships-browser/RelationshipsBrowser.js +6 -4
- package/dist/overlays/relationships-browser/SelectElement.js +2 -2
- package/dist/overlays/relationships-browser/_types.d.ts +2 -3
- package/dist/overlays/relationships-browser/actor.d.ts +7 -673
- package/dist/overlays/relationships-browser/actor.js +132 -110
- package/dist/overlays/relationships-browser/custom/ElementActions.js +44 -37
- package/dist/overlays/relationships-browser/custom/edgeTypes.js +4 -1
- package/dist/overlays/relationships-browser/custom/nodeTypes.js +4 -1
- package/dist/overlays/relationships-browser/hooks.js +7 -6
- package/dist/overlays/relationships-browser/layout.d.ts +2 -2
- package/dist/overlays/relationships-browser/layout.js +3 -3
- package/dist/overlays/relationships-browser/useViewToNodesEdges.js +0 -3
- package/dist/overlays/types.d.ts +12 -13
- package/dist/search/Search.js +2 -1
- package/dist/search/components/ElementsColumn.js +5 -3
- package/dist/search/components/PickView.js +1 -1
- package/dist/search/components/SearchByTags.js +21 -44
- package/dist/search/components/SearchInput.js +1 -1
- package/dist/search/components/ViewsColum.js +6 -4
- package/dist/search/components/_shared.css.d.ts +1 -1
- package/dist/search/searchActor.d.ts +3 -66
- package/dist/shadowroot/ShadowRoot.d.ts +5 -7
- package/dist/shadowroot/ShadowRoot.js +8 -6
- package/dist/styles.css2.js +1 -1
- package/dist/utils/index.d.ts +4 -4
- package/dist/utils/vector.d.ts +83 -21
- package/dist/utils/vector.js +98 -24
- package/dist/utils/view-bounds.d.ts +8 -0
- package/dist/utils/view-bounds.js +58 -0
- package/dist/utils/xyflow.d.ts +52 -8
- package/dist/utils/xyflow.js +31 -11
- package/package.json +26 -24
- package/panda.buildinfo.json +124 -71
- package/styles-min.css +1 -1
- package/styles.css +1 -1
- package/dist/hooks/useCurrentViewId.d.ts +0 -6
- package/dist/likec4diagram/custom/edges/utils.js +0 -23
- package/dist/likec4diagram/state/diagram-machine.d.ts +0 -2590
- package/dist/likec4diagram/state/diagram-machine.js +0 -1180
- package/dist/navigationpanel/editorpanel/LayoutDriftNotification.d.ts +0 -1
- package/dist/navigationpanel/editorpanel/LayoutDriftNotification.js +0 -56
- package/dist/utils/get-view-bounds.d.ts +0 -3
- package/dist/utils/get-view-bounds.js +0 -14
- /package/dist/base/{types.js → Base.js} +0 -0
- /package/dist/node_modules/.pnpm/{@tabler_icons-react@3.35.0_react@19.1.1 → @tabler_icons-react@3.35.0_react@19.2.0}/node_modules/@tabler/icons-react/dist/esm/createReactComponent.js +0 -0
- /package/dist/node_modules/.pnpm/{@tabler_icons-react@3.35.0_react@19.1.1 → @tabler_icons-react@3.35.0_react@19.2.0}/node_modules/@tabler/icons-react/dist/esm/defaultAttributes.js +0 -0
- /package/dist/node_modules/.pnpm/{@tabler_icons-react@3.35.0_react@19.1.1 → @tabler_icons-react@3.35.0_react@19.2.0}/node_modules/@tabler/icons-react/dist/esm/icons/IconAlertTriangle.js +0 -0
- /package/dist/node_modules/.pnpm/{@tabler_icons-react@3.35.0_react@19.1.1 → @tabler_icons-react@3.35.0_react@19.2.0}/node_modules/@tabler/icons-react/dist/esm/icons/IconArrowDownRight.js +0 -0
- /package/dist/node_modules/.pnpm/{@tabler_icons-react@3.35.0_react@19.1.1 → @tabler_icons-react@3.35.0_react@19.2.0}/node_modules/@tabler/icons-react/dist/esm/icons/IconArrowLeft.js +0 -0
- /package/dist/node_modules/.pnpm/{@tabler_icons-react@3.35.0_react@19.1.1 → @tabler_icons-react@3.35.0_react@19.2.0}/node_modules/@tabler/icons-react/dist/esm/icons/IconArrowRight.js +0 -0
- /package/dist/node_modules/.pnpm/{@tabler_icons-react@3.35.0_react@19.1.1 → @tabler_icons-react@3.35.0_react@19.2.0}/node_modules/@tabler/icons-react/dist/esm/icons/IconBolt.js +0 -0
- /package/dist/node_modules/.pnpm/{@tabler_icons-react@3.35.0_react@19.1.1 → @tabler_icons-react@3.35.0_react@19.2.0}/node_modules/@tabler/icons-react/dist/esm/icons/IconBrowser.js +0 -0
- /package/dist/node_modules/.pnpm/{@tabler_icons-react@3.35.0_react@19.1.1 → @tabler_icons-react@3.35.0_react@19.2.0}/node_modules/@tabler/icons-react/dist/esm/icons/IconCheck.js +0 -0
- /package/dist/node_modules/.pnpm/{@tabler_icons-react@3.35.0_react@19.1.1 → @tabler_icons-react@3.35.0_react@19.2.0}/node_modules/@tabler/icons-react/dist/esm/icons/IconChevronDown.js +0 -0
- /package/dist/node_modules/.pnpm/{@tabler_icons-react@3.35.0_react@19.1.1 → @tabler_icons-react@3.35.0_react@19.2.0}/node_modules/@tabler/icons-react/dist/esm/icons/IconChevronLeft.js +0 -0
- /package/dist/node_modules/.pnpm/{@tabler_icons-react@3.35.0_react@19.1.1 → @tabler_icons-react@3.35.0_react@19.2.0}/node_modules/@tabler/icons-react/dist/esm/icons/IconChevronRight.js +0 -0
- /package/dist/node_modules/.pnpm/{@tabler_icons-react@3.35.0_react@19.1.1 → @tabler_icons-react@3.35.0_react@19.2.0}/node_modules/@tabler/icons-react/dist/esm/icons/IconCopy.js +0 -0
- /package/dist/node_modules/.pnpm/{@tabler_icons-react@3.35.0_react@19.1.1 → @tabler_icons-react@3.35.0_react@19.2.0}/node_modules/@tabler/icons-react/dist/esm/icons/IconCylinder.js +0 -0
- /package/dist/node_modules/.pnpm/{@tabler_icons-react@3.35.0_react@19.1.1 → @tabler_icons-react@3.35.0_react@19.2.0}/node_modules/@tabler/icons-react/dist/esm/icons/IconDeviceMobile.js +0 -0
- /package/dist/node_modules/.pnpm/{@tabler_icons-react@3.35.0_react@19.1.1 → @tabler_icons-react@3.35.0_react@19.2.0}/node_modules/@tabler/icons-react/dist/esm/icons/IconDirectionSignFilled.js +0 -0
- /package/dist/node_modules/.pnpm/{@tabler_icons-react@3.35.0_react@19.1.1 → @tabler_icons-react@3.35.0_react@19.2.0}/node_modules/@tabler/icons-react/dist/esm/icons/IconExternalLink.js +0 -0
- /package/dist/node_modules/.pnpm/{@tabler_icons-react@3.35.0_react@19.1.1 → @tabler_icons-react@3.35.0_react@19.2.0}/node_modules/@tabler/icons-react/dist/esm/icons/IconFileSymlink.js +0 -0
- /package/dist/node_modules/.pnpm/{@tabler_icons-react@3.35.0_react@19.1.1 → @tabler_icons-react@3.35.0_react@19.2.0}/node_modules/@tabler/icons-react/dist/esm/icons/IconFocusCentered.js +0 -0
- /package/dist/node_modules/.pnpm/{@tabler_icons-react@3.35.0_react@19.1.1 → @tabler_icons-react@3.35.0_react@19.2.0}/node_modules/@tabler/icons-react/dist/esm/icons/IconFolderFilled.js +0 -0
- /package/dist/node_modules/.pnpm/{@tabler_icons-react@3.35.0_react@19.1.1 → @tabler_icons-react@3.35.0_react@19.2.0}/node_modules/@tabler/icons-react/dist/esm/icons/IconHelpCircle.js +0 -0
- /package/dist/node_modules/.pnpm/{@tabler_icons-react@3.35.0_react@19.1.1 → @tabler_icons-react@3.35.0_react@19.2.0}/node_modules/@tabler/icons-react/dist/esm/icons/IconId.js +0 -0
- /package/dist/node_modules/.pnpm/{@tabler_icons-react@3.35.0_react@19.1.1 → @tabler_icons-react@3.35.0_react@19.2.0}/node_modules/@tabler/icons-react/dist/esm/icons/IconInfoCircle.js +0 -0
- /package/dist/node_modules/.pnpm/{@tabler_icons-react@3.35.0_react@19.1.1 → @tabler_icons-react@3.35.0_react@19.2.0}/node_modules/@tabler/icons-react/dist/esm/icons/IconLayoutAlignBottom.js +0 -0
- /package/dist/node_modules/.pnpm/{@tabler_icons-react@3.35.0_react@19.1.1 → @tabler_icons-react@3.35.0_react@19.2.0}/node_modules/@tabler/icons-react/dist/esm/icons/IconLayoutAlignCenter.js +0 -0
- /package/dist/node_modules/.pnpm/{@tabler_icons-react@3.35.0_react@19.1.1 → @tabler_icons-react@3.35.0_react@19.2.0}/node_modules/@tabler/icons-react/dist/esm/icons/IconLayoutAlignLeft.js +0 -0
- /package/dist/node_modules/.pnpm/{@tabler_icons-react@3.35.0_react@19.1.1 → @tabler_icons-react@3.35.0_react@19.2.0}/node_modules/@tabler/icons-react/dist/esm/icons/IconLayoutAlignMiddle.js +0 -0
- /package/dist/node_modules/.pnpm/{@tabler_icons-react@3.35.0_react@19.1.1 → @tabler_icons-react@3.35.0_react@19.2.0}/node_modules/@tabler/icons-react/dist/esm/icons/IconLayoutAlignRight.js +0 -0
- /package/dist/node_modules/.pnpm/{@tabler_icons-react@3.35.0_react@19.1.1 → @tabler_icons-react@3.35.0_react@19.2.0}/node_modules/@tabler/icons-react/dist/esm/icons/IconLayoutAlignTop.js +0 -0
- /package/dist/node_modules/.pnpm/{@tabler_icons-react@3.35.0_react@19.1.1 → @tabler_icons-react@3.35.0_react@19.2.0}/node_modules/@tabler/icons-react/dist/esm/icons/IconLayoutBoardSplit.js +0 -0
- /package/dist/node_modules/.pnpm/{@tabler_icons-react@3.35.0_react@19.1.1 → @tabler_icons-react@3.35.0_react@19.2.0}/node_modules/@tabler/icons-react/dist/esm/icons/IconLayoutCollage.js +0 -0
- /package/dist/node_modules/.pnpm/{@tabler_icons-react@3.35.0_react@19.1.1 → @tabler_icons-react@3.35.0_react@19.2.0}/node_modules/@tabler/icons-react/dist/esm/icons/IconLayoutDashboard.js +0 -0
- /package/dist/node_modules/.pnpm/{@tabler_icons-react@3.35.0_react@19.1.1 → @tabler_icons-react@3.35.0_react@19.2.0}/node_modules/@tabler/icons-react/dist/esm/icons/IconLink.js +0 -0
- /package/dist/node_modules/.pnpm/{@tabler_icons-react@3.35.0_react@19.1.1 → @tabler_icons-react@3.35.0_react@19.2.0}/node_modules/@tabler/icons-react/dist/esm/icons/IconLock.js +0 -0
- /package/dist/node_modules/.pnpm/{@tabler_icons-react@3.35.0_react@19.1.1 → @tabler_icons-react@3.35.0_react@19.2.0}/node_modules/@tabler/icons-react/dist/esm/icons/IconLockOpen2.js +0 -0
- /package/dist/node_modules/.pnpm/{@tabler_icons-react@3.35.0_react@19.1.1 → @tabler_icons-react@3.35.0_react@19.2.0}/node_modules/@tabler/icons-react/dist/esm/icons/IconPlayerPlayFilled.js +0 -0
- /package/dist/node_modules/.pnpm/{@tabler_icons-react@3.35.0_react@19.1.1 → @tabler_icons-react@3.35.0_react@19.2.0}/node_modules/@tabler/icons-react/dist/esm/icons/IconPlayerSkipBackFilled.js +0 -0
- /package/dist/node_modules/.pnpm/{@tabler_icons-react@3.35.0_react@19.1.1 → @tabler_icons-react@3.35.0_react@19.2.0}/node_modules/@tabler/icons-react/dist/esm/icons/IconPlayerSkipForwardFilled.js +0 -0
- /package/dist/node_modules/.pnpm/{@tabler_icons-react@3.35.0_react@19.1.1 → @tabler_icons-react@3.35.0_react@19.2.0}/node_modules/@tabler/icons-react/dist/esm/icons/IconPlayerStopFilled.js +0 -0
- /package/dist/node_modules/.pnpm/{@tabler_icons-react@3.35.0_react@19.1.1 → @tabler_icons-react@3.35.0_react@19.2.0}/node_modules/@tabler/icons-react/dist/esm/icons/IconRectangularPrism.js +0 -0
- /package/dist/node_modules/.pnpm/{@tabler_icons-react@3.35.0_react@19.1.1 → @tabler_icons-react@3.35.0_react@19.2.0}/node_modules/@tabler/icons-react/dist/esm/icons/IconReorder.js +0 -0
- /package/dist/node_modules/.pnpm/{@tabler_icons-react@3.35.0_react@19.1.1 → @tabler_icons-react@3.35.0_react@19.2.0}/node_modules/@tabler/icons-react/dist/esm/icons/IconRouteOff.js +0 -0
- /package/dist/node_modules/.pnpm/{@tabler_icons-react@3.35.0_react@19.1.1 → @tabler_icons-react@3.35.0_react@19.2.0}/node_modules/@tabler/icons-react/dist/esm/icons/IconSearch.js +0 -0
- /package/dist/node_modules/.pnpm/{@tabler_icons-react@3.35.0_react@19.1.1 → @tabler_icons-react@3.35.0_react@19.2.0}/node_modules/@tabler/icons-react/dist/esm/icons/IconSelector.js +0 -0
- /package/dist/node_modules/.pnpm/{@tabler_icons-react@3.35.0_react@19.1.1 → @tabler_icons-react@3.35.0_react@19.2.0}/node_modules/@tabler/icons-react/dist/esm/icons/IconStack2.js +0 -0
- /package/dist/node_modules/.pnpm/{@tabler_icons-react@3.35.0_react@19.1.1 → @tabler_icons-react@3.35.0_react@19.2.0}/node_modules/@tabler/icons-react/dist/esm/icons/IconStarFilled.js +0 -0
- /package/dist/node_modules/.pnpm/{@tabler_icons-react@3.35.0_react@19.1.1 → @tabler_icons-react@3.35.0_react@19.2.0}/node_modules/@tabler/icons-react/dist/esm/icons/IconTarget.js +0 -0
- /package/dist/node_modules/.pnpm/{@tabler_icons-react@3.35.0_react@19.1.1 → @tabler_icons-react@3.35.0_react@19.2.0}/node_modules/@tabler/icons-react/dist/esm/icons/IconTransform.js +0 -0
- /package/dist/node_modules/.pnpm/{@tabler_icons-react@3.35.0_react@19.1.1 → @tabler_icons-react@3.35.0_react@19.2.0}/node_modules/@tabler/icons-react/dist/esm/icons/IconUser.js +0 -0
- /package/dist/node_modules/.pnpm/{@tabler_icons-react@3.35.0_react@19.1.1 → @tabler_icons-react@3.35.0_react@19.2.0}/node_modules/@tabler/icons-react/dist/esm/icons/IconX.js +0 -0
- /package/dist/node_modules/.pnpm/{@tabler_icons-react@3.35.0_react@19.1.1 → @tabler_icons-react@3.35.0_react@19.2.0}/node_modules/@tabler/icons-react/dist/esm/icons/IconZoomScan.js +0 -0
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
import { useSelector } from '@xstate/react';
|
|
2
|
+
import { shallowEqual } from 'fast-equals';
|
|
3
|
+
import { deriveToggledFeatures } from '../likec4diagram/state/machine.setup.js';
|
|
4
|
+
import { useDiagramActorRef } from './safeContext.js';
|
|
5
|
+
import { useCallbackRef } from './useCallbackRef.js';
|
|
6
|
+
|
|
7
|
+
const selectCompareLayoutState = ({ context }) => {
|
|
8
|
+
const drifts = context.view.drifts ?? null;
|
|
9
|
+
if (!context.features.enableCompareWithLatest || !drifts) {
|
|
10
|
+
return {
|
|
11
|
+
isEnabled: false,
|
|
12
|
+
isEditable: false,
|
|
13
|
+
isActive: false,
|
|
14
|
+
drifts: [],
|
|
15
|
+
layout: context.view._layout ?? "auto"
|
|
16
|
+
};
|
|
17
|
+
}
|
|
18
|
+
const {
|
|
19
|
+
enableCompareWithLatest,
|
|
20
|
+
enableReadOnly
|
|
21
|
+
} = deriveToggledFeatures(context);
|
|
22
|
+
return {
|
|
23
|
+
isEnabled: true,
|
|
24
|
+
isEditable: !enableReadOnly,
|
|
25
|
+
isActive: enableCompareWithLatest === true,
|
|
26
|
+
drifts,
|
|
27
|
+
layout: context.view._layout ?? "auto"
|
|
28
|
+
};
|
|
29
|
+
};
|
|
30
|
+
function useDiagramCompareLayout() {
|
|
31
|
+
const actorRef = useDiagramActorRef();
|
|
32
|
+
const state = useSelector(actorRef, selectCompareLayoutState, shallowEqual);
|
|
33
|
+
const switchLayout = useCallbackRef((layoutType) => {
|
|
34
|
+
if (!state.isEnabled) {
|
|
35
|
+
console.warn("Compare with latest feature is not enabled");
|
|
36
|
+
return;
|
|
37
|
+
}
|
|
38
|
+
actorRef.send({ type: "emit.onLayoutTypeChange", layoutType });
|
|
39
|
+
});
|
|
40
|
+
const toggleCompare = useCallbackRef((force) => {
|
|
41
|
+
if (!state.isEnabled) {
|
|
42
|
+
console.warn("Compare with latest feature is not enabled");
|
|
43
|
+
return;
|
|
44
|
+
}
|
|
45
|
+
const nextIsActive = force ? force === "on" : !state.isActive;
|
|
46
|
+
if (state.isActive && !nextIsActive && state.layout === "auto") {
|
|
47
|
+
switchLayout("manual");
|
|
48
|
+
}
|
|
49
|
+
actorRef.send({
|
|
50
|
+
type: "toggle.feature",
|
|
51
|
+
feature: "CompareWithLatest",
|
|
52
|
+
forceValue: nextIsActive
|
|
53
|
+
});
|
|
54
|
+
});
|
|
55
|
+
const resetManualLayout = useCallbackRef(() => {
|
|
56
|
+
if (!state.isEnabled) {
|
|
57
|
+
console.warn("Compare with latest feature is not enabled");
|
|
58
|
+
return;
|
|
59
|
+
}
|
|
60
|
+
actorRef.send({ type: "layout.resetManualLayout" });
|
|
61
|
+
});
|
|
62
|
+
return [state, { toggleCompare, switchLayout, resetManualLayout }];
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
export { useDiagramCompareLayout };
|
|
@@ -17,6 +17,11 @@ export declare function useLikeC4ProjectsContext(): LikeC4ProjectsContext;
|
|
|
17
17
|
*/
|
|
18
18
|
export declare function useHasProjects(): boolean;
|
|
19
19
|
/**
|
|
20
|
-
* @returns
|
|
20
|
+
* @returns Current project id, as provided by LikeC4Model
|
|
21
21
|
*/
|
|
22
22
|
export declare function useLikeC4ProjectId(): ProjectId;
|
|
23
|
+
/**
|
|
24
|
+
* Returns current LikeC4 project.
|
|
25
|
+
* Requires both LikeC4ModelProvider and LikeC4ProjectsProvider in the tree.*
|
|
26
|
+
*/
|
|
27
|
+
export declare function useLikeC4Project(): LikeC4Project;
|
|
@@ -29,9 +29,21 @@ function useHasProjects() {
|
|
|
29
29
|
function useLikeC4ProjectId() {
|
|
30
30
|
const ctx = useContext(LikeC4ModelContext);
|
|
31
31
|
if (!ctx) {
|
|
32
|
-
throw new Error("No
|
|
32
|
+
throw new Error("No LikeC4ModelProvider found");
|
|
33
33
|
}
|
|
34
34
|
return ctx.projectId;
|
|
35
35
|
}
|
|
36
|
+
function useLikeC4Project() {
|
|
37
|
+
const projectId = useLikeC4ProjectId();
|
|
38
|
+
const projectsCtx = useContext(LikeC4ProjectsContext);
|
|
39
|
+
if (!projectsCtx) {
|
|
40
|
+
throw new Error("No LikeC4ProjectsProvider found");
|
|
41
|
+
}
|
|
42
|
+
const project = projectsCtx.projects.find((p) => p.id === projectId);
|
|
43
|
+
if (!project) {
|
|
44
|
+
throw new Error(`Project with id '${projectId}' not found in LikeC4ProjectsProvider`);
|
|
45
|
+
}
|
|
46
|
+
return project;
|
|
47
|
+
}
|
|
36
48
|
|
|
37
|
-
export { useHasProjects, useLikeC4ProjectId, useLikeC4Projects, useLikeC4ProjectsContext };
|
|
49
|
+
export { useHasProjects, useLikeC4Project, useLikeC4ProjectId, useLikeC4Projects, useLikeC4ProjectsContext };
|
|
@@ -11,12 +11,10 @@ const depsShallowEqual = (d1, d2) => {
|
|
|
11
11
|
return false;
|
|
12
12
|
}
|
|
13
13
|
for (const [i, element] of d1.entries()) {
|
|
14
|
-
if (element === d2[i]) {
|
|
14
|
+
if (element === d2[i] || shallowEqual(element, d2[i])) {
|
|
15
15
|
continue;
|
|
16
16
|
}
|
|
17
|
-
|
|
18
|
-
return false;
|
|
19
|
-
}
|
|
17
|
+
return false;
|
|
20
18
|
}
|
|
21
19
|
return true;
|
|
22
20
|
};
|
|
@@ -8,6 +8,7 @@ export declare function useXYStoreApi(): XYStoreApi;
|
|
|
8
8
|
export type XYStoreApi = {
|
|
9
9
|
getState: () => XYStoreState;
|
|
10
10
|
setState: (state: Partial<XYStoreState> | ((state: XYStoreState) => Partial<XYStoreState>)) => void;
|
|
11
|
+
subscribe: (listener: (state: XYStoreState, prevState: XYStoreState) => void) => () => void;
|
|
11
12
|
};
|
|
12
13
|
export type XYInternalNode = InternalNode<Types.AnyNode>;
|
|
13
14
|
export declare function useXYInternalNode(id: string): XYInternalNode | undefined;
|
package/dist/hooks/useXYFlow.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { useStore, useStoreApi, useReactFlow, useInternalNode } from '@xyflow/react';
|
|
1
|
+
import { useStore, useStoreApi, useReactFlow } from '@xyflow/react';
|
|
3
2
|
import { shallowEqual } from 'fast-equals';
|
|
3
|
+
import { useCallbackRef } from './useCallbackRef.js';
|
|
4
4
|
|
|
5
5
|
function useXYFlow() {
|
|
6
6
|
return useReactFlow();
|
|
@@ -8,15 +8,12 @@ function useXYFlow() {
|
|
|
8
8
|
function useXYStore(selector, equalityFn) {
|
|
9
9
|
return useStore(
|
|
10
10
|
useCallbackRef(selector),
|
|
11
|
-
shallowEqual
|
|
11
|
+
equalityFn ?? shallowEqual
|
|
12
12
|
);
|
|
13
13
|
}
|
|
14
14
|
function useXYStoreApi() {
|
|
15
15
|
return useStoreApi();
|
|
16
16
|
}
|
|
17
|
-
function useXYInternalNode(id) {
|
|
18
|
-
return useInternalNode(id);
|
|
19
|
-
}
|
|
20
17
|
const selectCurrentZoom = (state) => Math.round(state.transform[2] * 100) / 100;
|
|
21
18
|
function useCurrentZoom() {
|
|
22
19
|
return useStore(selectCurrentZoom);
|
|
@@ -26,4 +23,4 @@ function useIsZoomTooSmall() {
|
|
|
26
23
|
return useStore(selectZoom);
|
|
27
24
|
}
|
|
28
25
|
|
|
29
|
-
export { useCurrentZoom, useIsZoomTooSmall, useXYFlow,
|
|
26
|
+
export { useCurrentZoom, useIsZoomTooSmall, useXYFlow, useXYStore, useXYStoreApi };
|
package/dist/index.d.ts
CHANGED
|
@@ -14,5 +14,5 @@ export { StaticLikeC4Diagram } from './StaticLikeC4Diagram';
|
|
|
14
14
|
export { LikeC4View } from './LikeC4View';
|
|
15
15
|
export type { LikeC4BrowserProps, LikeC4ViewProps } from './LikeC4View';
|
|
16
16
|
export { ReactLikeC4, type ReactLikeC4Props } from './ReactLikeC4';
|
|
17
|
-
export { useCurrentViewId } from './hooks/
|
|
18
|
-
export {
|
|
17
|
+
export { useCurrentViewId } from './hooks/useCurrentView';
|
|
18
|
+
export { pickViewBounds } from './utils/view-bounds';
|
package/dist/index.js
CHANGED
|
@@ -2,7 +2,7 @@ export { IconRendererProvider } from './context/IconRenderer.js';
|
|
|
2
2
|
export { LikeC4Diagram } from './LikeC4Diagram.js';
|
|
3
3
|
export { LikeC4ModelProvider } from './LikeC4ModelProvider.js';
|
|
4
4
|
export { LikeC4ProjectsProvider } from './LikeC4ProjectsProvider.js';
|
|
5
|
-
export {
|
|
5
|
+
export { useDiagramContext, useOnDiagramEvent } from './hooks/useDiagram.js';
|
|
6
6
|
export { useLikeC4Model, useLikeC4Specification, useLikeC4ViewModel } from './hooks/useLikeC4Model.js';
|
|
7
7
|
export { useCurrentViewModel } from './hooks/useCurrentViewModel.js';
|
|
8
8
|
export { useHasProjects, useLikeC4ProjectId, useLikeC4Projects, useLikeC4ProjectsContext } from './hooks/useLikeC4Project.js';
|
|
@@ -11,5 +11,6 @@ export { useUpdateEffect } from './hooks/useUpdateEffect.js';
|
|
|
11
11
|
export { StaticLikeC4Diagram } from './StaticLikeC4Diagram.js';
|
|
12
12
|
export { LikeC4View } from './LikeC4View.js';
|
|
13
13
|
export { ReactLikeC4 } from './ReactLikeC4.js';
|
|
14
|
-
export { useCurrentViewId } from './hooks/
|
|
15
|
-
export {
|
|
14
|
+
export { useCurrentViewId } from './hooks/useCurrentView.js';
|
|
15
|
+
export { pickViewBounds } from './utils/view-bounds.js';
|
|
16
|
+
export { useDiagram } from './hooks/safeContext.js';
|
|
@@ -1,33 +1,40 @@
|
|
|
1
1
|
import { jsxs, jsx } from 'react/jsx-runtime';
|
|
2
2
|
import { useRerender } from '@react-hookz/web';
|
|
3
|
-
import { memo } from 'react';
|
|
3
|
+
import { memo, useCallback } from 'react';
|
|
4
4
|
import { ErrorBoundary } from '../components/ErrorFallback.js';
|
|
5
|
-
import {
|
|
5
|
+
import { useEnabledFeatures } from '../context/DiagramFeatures.js';
|
|
6
6
|
import { useOverlaysActorRef } from '../hooks/useOverlaysActor.js';
|
|
7
7
|
import { useSearchActorRef } from '../hooks/useSearchActor.js';
|
|
8
8
|
import { Overlays } from '../overlays/Overlays.js';
|
|
9
9
|
import { Search } from '../search/Search.js';
|
|
10
10
|
import { RelationshipPopover } from './relationship-popover/RelationshipPopover.js';
|
|
11
|
-
import { useEnabledFeatures } from '../context/DiagramFeatures.js';
|
|
12
11
|
import { NavigationPanel } from '../navigationpanel/NavigationPanel.js';
|
|
13
12
|
import { NotationPanel } from './ui/notation/NotationPanel.js';
|
|
13
|
+
import { LayoutDriftFrame } from './ui/LayoutDriftFrame.js';
|
|
14
14
|
|
|
15
15
|
const LikeC4DiagramUI = memo(() => {
|
|
16
16
|
const {
|
|
17
17
|
enableControls,
|
|
18
18
|
enableNotations,
|
|
19
19
|
enableSearch,
|
|
20
|
-
enableRelationshipDetails
|
|
20
|
+
enableRelationshipDetails,
|
|
21
|
+
enableReadOnly,
|
|
22
|
+
enableCompareWithLatest
|
|
21
23
|
} = useEnabledFeatures();
|
|
22
24
|
const rerender = useRerender();
|
|
23
25
|
const overlaysActorRef = useOverlaysActorRef();
|
|
24
26
|
const searchActorRef = useSearchActorRef();
|
|
25
|
-
|
|
26
|
-
|
|
27
|
+
const handleReset = useCallback(() => {
|
|
28
|
+
console.warn("DiagramUI: resetting error boundary and rerendering...");
|
|
29
|
+
rerender();
|
|
30
|
+
}, []);
|
|
31
|
+
return /* @__PURE__ */ jsxs(ErrorBoundary, { onReset: handleReset, children: [
|
|
32
|
+
enableControls && /* @__PURE__ */ jsx(NavigationPanel, {}),
|
|
27
33
|
overlaysActorRef && /* @__PURE__ */ jsx(Overlays, { overlaysActorRef }),
|
|
28
34
|
enableNotations && /* @__PURE__ */ jsx(NotationPanel, {}),
|
|
29
35
|
enableSearch && searchActorRef && /* @__PURE__ */ jsx(Search, { searchActorRef }),
|
|
30
|
-
enableRelationshipDetails && /* @__PURE__ */ jsx(RelationshipPopover, {})
|
|
36
|
+
enableRelationshipDetails && enableReadOnly && /* @__PURE__ */ jsx(RelationshipPopover, {}),
|
|
37
|
+
enableCompareWithLatest && /* @__PURE__ */ jsx(LayoutDriftFrame, {})
|
|
31
38
|
] });
|
|
32
39
|
});
|
|
33
40
|
LikeC4DiagramUI.displayName = "DiagramUI";
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { PropsWithChildren } from 'react';
|
|
2
2
|
import { Simplify } from 'type-fest';
|
|
3
3
|
import { LikeC4DiagramProperties } from '../LikeC4Diagram.props';
|
|
4
|
-
export type LikeC4DiagramXYFlowProps = PropsWithChildren<Simplify<Pick<LikeC4DiagramProperties<any>, 'background' | '
|
|
5
|
-
export declare function LikeC4DiagramXYFlow({ background,
|
|
4
|
+
export type LikeC4DiagramXYFlowProps = PropsWithChildren<Simplify<Pick<LikeC4DiagramProperties<any>, 'background' | 'reactFlowProps' | 'renderNodes'>>>;
|
|
5
|
+
export declare function LikeC4DiagramXYFlow({ background, reactFlowProps, children, renderNodes, }: LikeC4DiagramXYFlowProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -1,18 +1,21 @@
|
|
|
1
1
|
import { jsx } from 'react/jsx-runtime';
|
|
2
2
|
import { nonNullable } from '@likec4/core';
|
|
3
3
|
import { cx } from '@likec4/styles/css';
|
|
4
|
-
import { useTimeout, useDebouncedCallback
|
|
4
|
+
import { useTimeout, useDebouncedCallback } from '@mantine/hooks';
|
|
5
5
|
import { useCustomCompareMemo } from '@react-hookz/web';
|
|
6
|
-
import {
|
|
6
|
+
import { shallowEqual } from 'fast-equals';
|
|
7
7
|
import { isEmpty } from 'remeda';
|
|
8
8
|
import { memoNode } from '../base-primitives/memoNode.js';
|
|
9
9
|
import { BaseXYFlow } from '../base/BaseXYFlow.js';
|
|
10
10
|
import { useIsReducedGraphics, usePanningAtom } from '../context/RootContainerContext.js';
|
|
11
|
-
import {
|
|
11
|
+
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
|
+
import { deriveToggledFeatures } from './state/machine.setup.js';
|
|
14
15
|
import { useLayoutConstraints } from './useLayoutConstraints.js';
|
|
16
|
+
import { useDiagram } from '../hooks/safeContext.js';
|
|
15
17
|
import { useDiagramEventHandlers } from '../context/DiagramEventHandlers.js';
|
|
18
|
+
import { useCallbackRef } from '../hooks/useCallbackRef.js';
|
|
16
19
|
|
|
17
20
|
const edgeTypes = {
|
|
18
21
|
relationship: BuiltinEdges.RelationshipEdge,
|
|
@@ -41,41 +44,48 @@ function prepareNodeTypes(nodeTypes) {
|
|
|
41
44
|
"seq-parallel": nodeTypes.seqParallel ?? builtinNodes["seq-parallel"]
|
|
42
45
|
};
|
|
43
46
|
}
|
|
44
|
-
const selectXYProps = (ctx) =>
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
47
|
+
const selectXYProps = ({ context: ctx, children }) => {
|
|
48
|
+
ctx.toggledFeatures;
|
|
49
|
+
const { enableReadOnly } = deriveToggledFeatures(ctx);
|
|
50
|
+
const isNotEditingEdge = enableReadOnly || children.syncLayout?.getSnapshot().context.editing !== "edge";
|
|
51
|
+
return {
|
|
52
|
+
enableReadOnly,
|
|
53
|
+
initialized: ctx.initialized.xydata && ctx.initialized.xyflow,
|
|
54
|
+
nodes: ctx.xynodes,
|
|
55
|
+
edges: ctx.xyedges,
|
|
56
|
+
pannable: ctx.pannable,
|
|
57
|
+
zoomable: ctx.zoomable,
|
|
58
|
+
nodesDraggable: !enableReadOnly && ctx.nodesDraggable,
|
|
59
|
+
nodesSelectable: ctx.nodesSelectable && isNotEditingEdge,
|
|
60
|
+
fitViewPadding: ctx.fitViewPadding,
|
|
61
|
+
enableFitView: ctx.features.enableFitView,
|
|
62
|
+
...!ctx.features.enableFitView && {
|
|
63
|
+
viewport: {
|
|
64
|
+
x: -ctx.view.bounds.x,
|
|
65
|
+
y: -ctx.view.bounds.y,
|
|
66
|
+
zoom: 1
|
|
67
|
+
}
|
|
58
68
|
}
|
|
59
|
-
}
|
|
60
|
-
}
|
|
61
|
-
const equalsXYProps = (a, b) => a.initialized === b.initialized && a.pannable === b.pannable && a.zoomable === b.zoomable && a.
|
|
69
|
+
};
|
|
70
|
+
};
|
|
71
|
+
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);
|
|
62
72
|
function LikeC4DiagramXYFlow({
|
|
63
73
|
background = "dots",
|
|
64
|
-
nodesDraggable = false,
|
|
65
|
-
nodesSelectable = false,
|
|
66
74
|
reactFlowProps = {},
|
|
67
75
|
children,
|
|
68
76
|
renderNodes
|
|
69
77
|
}) {
|
|
70
78
|
const diagram = useDiagram();
|
|
71
|
-
|
|
79
|
+
let {
|
|
80
|
+
enableReadOnly,
|
|
72
81
|
initialized,
|
|
73
82
|
nodes,
|
|
74
83
|
edges,
|
|
75
|
-
enableReadOnly,
|
|
76
84
|
enableFitView,
|
|
85
|
+
nodesDraggable,
|
|
86
|
+
nodesSelectable,
|
|
77
87
|
...props
|
|
78
|
-
} =
|
|
88
|
+
} = useDiagramActorSnapshot(selectXYProps, equalsXYProps);
|
|
79
89
|
const {
|
|
80
90
|
onNodeContextMenu,
|
|
81
91
|
onCanvasContextMenu,
|
|
@@ -85,13 +95,11 @@ function LikeC4DiagramXYFlow({
|
|
|
85
95
|
onCanvasClick,
|
|
86
96
|
onCanvasDblClick
|
|
87
97
|
} = useDiagramEventHandlers();
|
|
88
|
-
const
|
|
98
|
+
const isReducedGraphics = useIsReducedGraphics(), layoutConstraints = useLayoutConstraints(), $isPanning = usePanningAtom(), isPanning = useTimeout(() => {
|
|
89
99
|
$isPanning.set(true);
|
|
90
100
|
}, isReducedGraphics ? 120 : 400), notPanning = useDebouncedCallback(() => {
|
|
91
101
|
isPanning.clear();
|
|
92
|
-
|
|
93
|
-
$isPanning.set(false);
|
|
94
|
-
}
|
|
102
|
+
$isPanning.set(false);
|
|
95
103
|
}, isReducedGraphics ? 350 : 200), onMove = useCallbackRef((event) => {
|
|
96
104
|
if (!event) {
|
|
97
105
|
return;
|
|
@@ -102,7 +110,11 @@ function LikeC4DiagramXYFlow({
|
|
|
102
110
|
notPanning();
|
|
103
111
|
}), onMoveEnd = useCallbackRef((event, viewport) => {
|
|
104
112
|
isPanning.clear();
|
|
105
|
-
diagram.send({
|
|
113
|
+
diagram.send({
|
|
114
|
+
type: "xyflow.viewportMoved",
|
|
115
|
+
viewport,
|
|
116
|
+
manually: !!event
|
|
117
|
+
});
|
|
106
118
|
}), onViewportResize = useCallbackRef(() => {
|
|
107
119
|
diagram.send({ type: "xyflow.resized" });
|
|
108
120
|
}), nodeTypes = useCustomCompareMemo(
|
|
@@ -139,6 +151,10 @@ function LikeC4DiagramXYFlow({
|
|
|
139
151
|
diagram.send({ type: "xyflow.edgeClick", edge });
|
|
140
152
|
onEdgeClick?.(diagram.findDiagramEdge(edge.id), e);
|
|
141
153
|
}),
|
|
154
|
+
onEdgeDoubleClick: useCallbackRef((e, edge) => {
|
|
155
|
+
e.stopPropagation();
|
|
156
|
+
diagram.send({ type: "xyflow.edgeDoubleClick", edge });
|
|
157
|
+
}),
|
|
142
158
|
onPaneClick: useCallbackRef((e) => {
|
|
143
159
|
e.stopPropagation();
|
|
144
160
|
diagram.send({ type: "xyflow.paneClick" });
|
|
@@ -150,29 +166,21 @@ function LikeC4DiagramXYFlow({
|
|
|
150
166
|
diagram.send({ type: "xyflow.paneDblClick" });
|
|
151
167
|
onCanvasDblClick?.(e);
|
|
152
168
|
}),
|
|
153
|
-
onNodeMouseEnter: useCallbackRef((
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
diagram.send({ type: "xyflow.nodeMouseEnter", node });
|
|
157
|
-
}
|
|
169
|
+
onNodeMouseEnter: useCallbackRef((event, node) => {
|
|
170
|
+
event.stopPropagation();
|
|
171
|
+
diagram.send({ type: "xyflow.nodeMouseEnter", node });
|
|
158
172
|
}),
|
|
159
|
-
onNodeMouseLeave: useCallbackRef((
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
diagram.send({ type: "xyflow.nodeMouseLeave", node });
|
|
163
|
-
}
|
|
173
|
+
onNodeMouseLeave: useCallbackRef((event, node) => {
|
|
174
|
+
event.stopPropagation();
|
|
175
|
+
diagram.send({ type: "xyflow.nodeMouseLeave", node });
|
|
164
176
|
}),
|
|
165
177
|
onEdgeMouseEnter: useCallbackRef((event, edge) => {
|
|
166
178
|
event.stopPropagation();
|
|
167
|
-
|
|
168
|
-
diagram.send({ type: "xyflow.edgeMouseEnter", edge, event });
|
|
169
|
-
}
|
|
179
|
+
diagram.send({ type: "xyflow.edgeMouseEnter", edge, event });
|
|
170
180
|
}),
|
|
171
181
|
onEdgeMouseLeave: useCallbackRef((event, edge) => {
|
|
172
182
|
event.stopPropagation();
|
|
173
|
-
|
|
174
|
-
diagram.send({ type: "xyflow.edgeMouseLeave", edge, event });
|
|
175
|
-
}
|
|
183
|
+
diagram.send({ type: "xyflow.edgeMouseLeave", edge, event });
|
|
176
184
|
}),
|
|
177
185
|
onMove,
|
|
178
186
|
onMoveEnd,
|
|
@@ -193,16 +201,16 @@ function LikeC4DiagramXYFlow({
|
|
|
193
201
|
);
|
|
194
202
|
onEdgeContextMenu?.(diagramEdge, event);
|
|
195
203
|
}),
|
|
196
|
-
|
|
197
|
-
onCanvasContextMenu
|
|
198
|
-
}
|
|
204
|
+
...onCanvasContextMenu && {
|
|
205
|
+
onPaneContextMenu: onCanvasContextMenu
|
|
206
|
+
},
|
|
199
207
|
...enableFitView && {
|
|
200
208
|
onViewportResize
|
|
201
209
|
},
|
|
202
|
-
nodesDraggable
|
|
210
|
+
nodesDraggable,
|
|
203
211
|
nodesSelectable,
|
|
204
|
-
|
|
205
|
-
...
|
|
212
|
+
elevateEdgesOnSelect: !enableReadOnly,
|
|
213
|
+
...nodesDraggable && layoutConstraints,
|
|
206
214
|
...props,
|
|
207
215
|
...reactFlowProps,
|
|
208
216
|
children
|
|
@@ -3,7 +3,6 @@ import { Types } from './types';
|
|
|
3
3
|
type ConvertToXYFlowInput = {
|
|
4
4
|
view: LayoutedView;
|
|
5
5
|
where: WhereOperator | null;
|
|
6
|
-
nodesSelectable: boolean;
|
|
7
6
|
dynamicViewVariant: DynamicViewDisplayVariant;
|
|
8
7
|
};
|
|
9
8
|
export declare function convertToXYFlow({ dynamicViewVariant, ...params }: ConvertToXYFlowInput): {
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { jsx } from 'react/jsx-runtime';
|
|
2
|
+
import { cx, css } from '@likec4/styles/css';
|
|
3
|
+
|
|
4
|
+
function EdgeDrifts({
|
|
5
|
+
edgeProps: { data },
|
|
6
|
+
svgPath
|
|
7
|
+
}) {
|
|
8
|
+
const drifts = data.drifts;
|
|
9
|
+
if (!drifts || drifts.length === 0) {
|
|
10
|
+
return null;
|
|
11
|
+
}
|
|
12
|
+
return /* @__PURE__ */ jsx(
|
|
13
|
+
"path",
|
|
14
|
+
{
|
|
15
|
+
className: cx(
|
|
16
|
+
"react-flow__edge-path",
|
|
17
|
+
css({
|
|
18
|
+
pointerEvents: "none",
|
|
19
|
+
stroke: "likec4.compare.manual.outline",
|
|
20
|
+
fill: "none",
|
|
21
|
+
mixBlendMode: "plus-lighter",
|
|
22
|
+
strokeWidth: {
|
|
23
|
+
base: "8px",
|
|
24
|
+
_whenHovered: "12px"
|
|
25
|
+
},
|
|
26
|
+
strokeOpacity: {
|
|
27
|
+
base: 0.3,
|
|
28
|
+
_whenHovered: 0.5
|
|
29
|
+
}
|
|
30
|
+
})
|
|
31
|
+
),
|
|
32
|
+
d: svgPath,
|
|
33
|
+
strokeLinecap: "round"
|
|
34
|
+
}
|
|
35
|
+
);
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
export { EdgeDrifts };
|