@likec4/diagram 1.43.0 → 1.44.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 +5746 -4674
- package/dist/LikeC4Diagram.d.ts +1 -1
- package/dist/LikeC4Diagram.js +13 -10
- package/dist/LikeC4Diagram.props.d.ts +16 -7
- package/dist/LikeC4ProjectsProvider.js +1 -1
- package/dist/LikeC4View.d.ts +5 -0
- package/dist/LikeC4View.js +22 -11
- 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 +4 -3
- package/dist/base/updateNodes.js +3 -2
- package/dist/base-primitives/compound/CompoundActionButton.js +1 -1
- package/dist/base-primitives/compound/CompoundDetailsButton.js +1 -1
- 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 +4 -0
- package/dist/base-primitives/edge/EdgeLabel.d.ts +1 -0
- 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 +9 -5
- package/dist/base-primitives/element/ElementActionButtons.d.ts +3 -2
- package/dist/base-primitives/element/ElementActionButtons.js +1 -1
- package/dist/base-primitives/element/ElementDetailsButton.js +2 -5
- package/dist/base-primitives/element/ElementNodeContainer.css.js +15 -27
- 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 +24 -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 +2 -18
- package/dist/context/index.d.ts +1 -1
- package/dist/custom/customNodes.js +3 -2
- package/dist/custom/hooks.d.ts +1 -1
- package/dist/custom/index.d.ts +1 -1
- package/dist/custom/index.js +4 -4
- package/dist/editor/LikeC4EditorContext.d.ts +21 -0
- package/dist/editor/index.d.ts +2 -0
- package/dist/hooks/index.d.ts +2 -1
- 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 +60 -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 +54 -51
- package/dist/likec4diagram/convert-to-xyflow.d.ts +0 -1
- package/dist/likec4diagram/custom/edges/RelationshipEdge.js +249 -220
- package/dist/likec4diagram/custom/edges/SequenceStepEdge.js +7 -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/ElementNodeDrifts.d.ts +4 -0
- package/dist/likec4diagram/custom/nodes/ElementNodeDrifts.js +46 -0
- package/dist/likec4diagram/custom/nodes/SequenceActorNode.js +4 -1
- package/dist/likec4diagram/custom/nodes/nodes.d.ts +9 -1
- package/dist/likec4diagram/custom/nodes/nodes.js +13 -9
- 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 +5 -7
- package/dist/likec4diagram/state/DiagramActorProvider.d.ts +3 -2
- package/dist/likec4diagram/state/DiagramActorProvider.js +96 -70
- package/dist/likec4diagram/state/assign.d.ts +4 -2
- package/dist/likec4diagram/state/assign.js +39 -103
- package/dist/likec4diagram/state/createViewChange.d.ts +3 -0
- package/dist/likec4diagram/state/createViewChange.js +90 -0
- package/dist/likec4diagram/state/diagram-api.d.ts +113 -0
- package/dist/likec4diagram/state/diagram-api.js +134 -0
- package/dist/likec4diagram/state/hotkeyActor.d.ts +7 -0
- package/dist/likec4diagram/state/hotkeyActor.js +17 -1
- package/dist/likec4diagram/state/machine.actions.d.ts +2099 -0
- package/dist/likec4diagram/state/machine.actions.js +735 -0
- package/dist/likec4diagram/state/machine.d.ts +3717 -0
- package/dist/likec4diagram/state/machine.js +141 -0
- package/dist/likec4diagram/state/machine.setup.d.ts +284 -0
- package/dist/likec4diagram/state/machine.setup.js +71 -0
- package/dist/likec4diagram/state/machine.state.initializing.d.ts +183 -0
- package/dist/likec4diagram/state/machine.state.initializing.js +55 -0
- package/dist/likec4diagram/state/machine.state.navigating.d.ts +117 -0
- package/dist/likec4diagram/state/machine.state.navigating.js +45 -0
- package/dist/likec4diagram/state/machine.state.ready.d.ts +3666 -0
- package/dist/likec4diagram/state/machine.state.ready.js +437 -0
- package/dist/likec4diagram/state/syncManualLayoutActor.d.ts +220 -63
- package/dist/likec4diagram/state/syncManualLayoutActor.js +218 -143
- package/dist/likec4diagram/state/types.d.ts +4 -7
- package/dist/likec4diagram/state/utils.d.ts +4 -2
- package/dist/likec4diagram/state/utils.js +4 -1
- package/dist/likec4diagram/types.d.ts +6 -1
- 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.js +5 -4
- package/dist/likec4diagram/useLayoutConstraints.d.ts +10 -5
- package/dist/likec4diagram/useLayoutConstraints.js +225 -54
- package/dist/likec4diagram/xyflow-diagram/diagram-view.d.ts +0 -1
- package/dist/likec4diagram/xyflow-diagram/diagram-view.js +15 -15
- package/dist/navigationpanel/NavigationPanel.js +11 -7
- 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 +11 -7
- package/dist/navigationpanel/actor.js +5 -4
- 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 +19 -16
- 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 +10 -10
- package/dist/navigationpanel/walkthrough/DynamicViewControls.js +31 -14
- package/dist/navigationpanel/walkthrough/WalkthroughPanel.d.ts +2 -1
- package/dist/navigationpanel/walkthrough/WalkthroughPanel.js +66 -49
- 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.js +7 -5
- 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 +3 -2
- package/dist/overlays/overlaysActor.d.ts +304 -62
- package/dist/overlays/overlaysActor.js +132 -131
- package/dist/overlays/relationship-details/RelationshipDetails.js +4 -3
- package/dist/overlays/relationship-details/SelectEdge.js +2 -2
- package/dist/overlays/relationship-details/actor.d.ts +14 -2
- package/dist/overlays/relationship-details/actor.js +17 -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/relationships-browser/RelationshipsBrowser.js +6 -4
- package/dist/overlays/relationships-browser/SelectElement.js +2 -2
- package/dist/overlays/relationships-browser/actor.d.ts +239 -173
- 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/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/shadowroot/ShadowRoot.js +1 -1
- package/dist/styles.css2.js +1 -1
- package/dist/utils/index.d.ts +4 -4
- package/dist/utils/vector.d.ts +78 -21
- package/dist/utils/vector.js +91 -24
- package/dist/utils/view-bounds.d.ts +8 -0
- package/dist/utils/view-bounds.js +57 -0
- package/dist/utils/xyflow.d.ts +49 -7
- package/dist/utils/xyflow.js +63 -11
- package/package.json +19 -18
- package/panda.buildinfo.json +107 -66
- 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
package/dist/LikeC4Diagram.d.ts
CHANGED
|
@@ -8,4 +8,4 @@ export type LikeC4DiagramProps<A extends Any = Any> = PropsWithChildren<LikeC4Di
|
|
|
8
8
|
*
|
|
9
9
|
* Use {@link ReactLikeC4} or {@link LikeC4View} for ready-to-use component
|
|
10
10
|
*/
|
|
11
|
-
export declare function LikeC4Diagram<A extends Any = Any>({ onCanvasClick, onCanvasContextMenu, onCanvasDblClick, onEdgeClick, onChange, onEdgeContextMenu, onNavigateTo, onNodeClick, onNodeContextMenu, onOpenSource, onBurgerMenuClick, onInitialized, view, className, readonly, controls, fitView, fitViewPadding: _fitViewPadding, pannable, zoomable, background, enableElementTags, enableFocusMode, enableElementDetails, enableRelationshipDetails, enableRelationshipBrowser, nodesDraggable, nodesSelectable, enableNotations, showNavigationButtons, enableDynamicViewWalkthrough, dynamicViewVariant, enableSearch, initialWidth, initialHeight,
|
|
11
|
+
export declare function LikeC4Diagram<A extends Any = Any>({ onCanvasClick, onCanvasContextMenu, onCanvasDblClick, onEdgeClick, onChange, onEdgeContextMenu, onNavigateTo, onNodeClick, onNodeContextMenu, onOpenSource, onBurgerMenuClick, onLayoutTypeChange, onInitialized, view, className, readonly, controls, fitView, fitViewPadding: _fitViewPadding, pannable, zoomable, background, enableElementTags, enableFocusMode, enableElementDetails, enableRelationshipDetails, enableRelationshipBrowser, enableCompareWithLatest, nodesDraggable, nodesSelectable, enableNotations, showNavigationButtons, enableDynamicViewWalkthrough, dynamicViewVariant, enableSearch, initialWidth, initialHeight, reduceGraphics, renderIcon, where, reactFlowProps, renderNodes, children, }: LikeC4DiagramProps<A>): import("react/jsx-runtime").JSX.Element;
|
package/dist/LikeC4Diagram.js
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import { jsx, jsxs } from 'react/jsx-runtime';
|
|
2
2
|
import { useCustomCompareMemo } from '@react-hookz/web';
|
|
3
3
|
import { ReactFlowProvider } from '@xyflow/react';
|
|
4
|
-
import { deepEqual } from 'fast-equals';
|
|
5
4
|
import { useRef } from 'react';
|
|
6
5
|
import { isPlainObject, mapValues } from 'remeda';
|
|
7
6
|
import { RootContainer } from './components/RootContainer.js';
|
|
@@ -11,7 +10,7 @@ import { LikeC4DiagramUI } from './likec4diagram/DiagramUI.js';
|
|
|
11
10
|
import { LikeC4DiagramXYFlow } from './likec4diagram/DiagramXYFlow.js';
|
|
12
11
|
import { DiagramActorProvider } from './likec4diagram/state/DiagramActorProvider.js';
|
|
13
12
|
import { LikeC4Styles } from './LikeC4Styles.js';
|
|
14
|
-
import {
|
|
13
|
+
import { pickViewBounds } from './utils/view-bounds.js';
|
|
15
14
|
import { MinZoom, MaxZoom, FitViewPaddings } from './base/const.js';
|
|
16
15
|
import { EnsureMantine } from './context/EnsureMantine.js';
|
|
17
16
|
import { FramerMotionConfig } from './context/FramerMotionConfig.js';
|
|
@@ -31,6 +30,7 @@ function LikeC4Diagram({
|
|
|
31
30
|
onNodeContextMenu,
|
|
32
31
|
onOpenSource,
|
|
33
32
|
onBurgerMenuClick,
|
|
33
|
+
onLayoutTypeChange,
|
|
34
34
|
onInitialized,
|
|
35
35
|
view,
|
|
36
36
|
className,
|
|
@@ -46,6 +46,7 @@ function LikeC4Diagram({
|
|
|
46
46
|
enableElementDetails = false,
|
|
47
47
|
enableRelationshipDetails = false,
|
|
48
48
|
enableRelationshipBrowser = false,
|
|
49
|
+
enableCompareWithLatest = !!onLayoutTypeChange,
|
|
49
50
|
nodesDraggable = !readonly,
|
|
50
51
|
nodesSelectable = !readonly || enableFocusMode || !!onNavigateTo || !!onNodeClick,
|
|
51
52
|
enableNotations = false,
|
|
@@ -55,7 +56,6 @@ function LikeC4Diagram({
|
|
|
55
56
|
enableSearch = false,
|
|
56
57
|
initialWidth,
|
|
57
58
|
initialHeight,
|
|
58
|
-
experimentalEdgeEditing = !readonly,
|
|
59
59
|
reduceGraphics = "auto",
|
|
60
60
|
renderIcon,
|
|
61
61
|
where,
|
|
@@ -65,7 +65,7 @@ function LikeC4Diagram({
|
|
|
65
65
|
}) {
|
|
66
66
|
const id = useId();
|
|
67
67
|
const initialRef = useRef(null);
|
|
68
|
-
const bounds =
|
|
68
|
+
const bounds = pickViewBounds(view, dynamicViewVariant);
|
|
69
69
|
const fitViewPadding = useNormalizedViewPadding(_fitViewPadding);
|
|
70
70
|
if (initialRef.current == null) {
|
|
71
71
|
initialRef.current = {
|
|
@@ -101,11 +101,11 @@ function LikeC4Diagram({
|
|
|
101
101
|
enableSearch,
|
|
102
102
|
enableNavigationButtons: showNavigationButtons && !!onNavigateTo,
|
|
103
103
|
enableDynamicViewWalkthrough: view._type === "dynamic" && enableDynamicViewWalkthrough,
|
|
104
|
-
enableEdgeEditing: experimentalEdgeEditing,
|
|
105
104
|
enableNotations,
|
|
106
105
|
enableVscode: !!onOpenSource,
|
|
107
106
|
enableControls: controls,
|
|
108
|
-
enableElementTags
|
|
107
|
+
enableElementTags,
|
|
108
|
+
enableCompareWithLatest: enableCompareWithLatest && !!onLayoutTypeChange
|
|
109
109
|
},
|
|
110
110
|
children: /* @__PURE__ */ jsxs(
|
|
111
111
|
DiagramEventHandlers,
|
|
@@ -122,7 +122,8 @@ function LikeC4Diagram({
|
|
|
122
122
|
onNodeContextMenu,
|
|
123
123
|
onOpenSource,
|
|
124
124
|
onBurgerMenuClick,
|
|
125
|
-
onInitialized
|
|
125
|
+
onInitialized,
|
|
126
|
+
onLayoutTypeChange
|
|
126
127
|
},
|
|
127
128
|
children: [
|
|
128
129
|
/* @__PURE__ */ jsx(LikeC4Styles, { id }),
|
|
@@ -138,6 +139,7 @@ function LikeC4Diagram({
|
|
|
138
139
|
zoomable,
|
|
139
140
|
pannable,
|
|
140
141
|
fitViewPadding,
|
|
142
|
+
nodesDraggable,
|
|
141
143
|
nodesSelectable,
|
|
142
144
|
where: where ?? null,
|
|
143
145
|
dynamicViewVariant,
|
|
@@ -145,8 +147,6 @@ function LikeC4Diagram({
|
|
|
145
147
|
/* @__PURE__ */ jsx(
|
|
146
148
|
LikeC4DiagramXYFlow,
|
|
147
149
|
{
|
|
148
|
-
nodesDraggable,
|
|
149
|
-
nodesSelectable,
|
|
150
150
|
background,
|
|
151
151
|
reactFlowProps,
|
|
152
152
|
renderNodes,
|
|
@@ -182,8 +182,11 @@ function useNormalizedViewPadding(raw) {
|
|
|
182
182
|
return toLiteralPaddingWithUnit(raw);
|
|
183
183
|
},
|
|
184
184
|
[raw],
|
|
185
|
-
|
|
185
|
+
compareViewPaddingObject
|
|
186
186
|
);
|
|
187
187
|
}
|
|
188
|
+
const compareViewPaddingObject = ([a], [b]) => {
|
|
189
|
+
return a === b || isPlainObject(a) && isPlainObject(b) && a.bottom == b.bottom && a.left == b.left && a.right == b.right && a.top == b.top;
|
|
190
|
+
};
|
|
188
191
|
|
|
189
192
|
export { LikeC4Diagram };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { DiagramEdge, DiagramNode, DynamicViewDisplayVariant, LayoutedView, ViewChange, WhereOperator } from '@likec4/core/types';
|
|
1
|
+
import { DiagramEdge, DiagramNode, DynamicViewDisplayVariant, LayoutedView, LayoutType, ViewChange, WhereOperator } from '@likec4/core/types';
|
|
2
2
|
import { ReactFlowProps } from '@xyflow/react';
|
|
3
3
|
import { MouseEvent as ReactMouseEvent, ReactNode } from 'react';
|
|
4
4
|
import { CamelCasedProperties, SetRequired } from 'type-fest';
|
|
@@ -174,6 +174,11 @@ export interface LikeC4DiagramProperties<A extends Any = Unknown> {
|
|
|
174
174
|
* @default false
|
|
175
175
|
*/
|
|
176
176
|
enableDynamicViewWalkthrough?: boolean | undefined;
|
|
177
|
+
/**
|
|
178
|
+
* Enable "Compare with auto layout" action when view was manually modified and out of sync with latest model
|
|
179
|
+
* @default true if `onLayoutTypeChange` is set, false otherwise
|
|
180
|
+
*/
|
|
181
|
+
enableCompareWithLatest?: boolean | undefined;
|
|
177
182
|
/**
|
|
178
183
|
* Default dynamic view display variant
|
|
179
184
|
* @default 'diagram'
|
|
@@ -184,11 +189,6 @@ export interface LikeC4DiagramProperties<A extends Any = Unknown> {
|
|
|
184
189
|
* @default false
|
|
185
190
|
*/
|
|
186
191
|
enableElementTags?: boolean | undefined;
|
|
187
|
-
/**
|
|
188
|
-
* Experimental feature to enable edge editing
|
|
189
|
-
* @default false
|
|
190
|
-
*/
|
|
191
|
-
experimentalEdgeEditing?: boolean | undefined;
|
|
192
192
|
/**
|
|
193
193
|
* Improve performance by hiding certain elements and reducing visual effects (disable mix-blend, shadows, animations)
|
|
194
194
|
* Enable it if you have a large or static view
|
|
@@ -240,6 +240,7 @@ export type OnEdgeClick<A extends Any = Unknown> = (edge: DiagramEdge<A>, event:
|
|
|
240
240
|
* On pane/canvas click (not on any node or edge)
|
|
241
241
|
*/
|
|
242
242
|
export type OnCanvasClick = (event: ReactMouseEvent) => void;
|
|
243
|
+
export type OnCanvasContextMenu = (event: ReactMouseEvent | MouseEvent) => void;
|
|
243
244
|
export type ChangeEvent = {
|
|
244
245
|
change: ViewChange;
|
|
245
246
|
};
|
|
@@ -248,12 +249,13 @@ export type OnInitialized = (params: {
|
|
|
248
249
|
diagram: DiagramApi;
|
|
249
250
|
xyflow: XYFlowInstance;
|
|
250
251
|
}) => void;
|
|
252
|
+
export type OnLayoutTypeChange = (layoutType: LayoutType) => void;
|
|
251
253
|
export interface LikeC4DiagramEventHandlers<A extends Any = Unknown> {
|
|
252
254
|
onChange?: OnChange | null | undefined;
|
|
253
255
|
onNavigateTo?: OnNavigateTo<A> | null | undefined;
|
|
254
256
|
onNodeClick?: OnNodeClick<A> | null | undefined;
|
|
255
257
|
onNodeContextMenu?: OnNodeClick<A> | null | undefined;
|
|
256
|
-
onCanvasContextMenu?:
|
|
258
|
+
onCanvasContextMenu?: OnCanvasContextMenu | null | undefined;
|
|
257
259
|
onEdgeClick?: OnEdgeClick<A> | null | undefined;
|
|
258
260
|
onEdgeContextMenu?: OnEdgeClick<A> | null | undefined;
|
|
259
261
|
onCanvasClick?: OnCanvasClick | null | undefined;
|
|
@@ -261,4 +263,11 @@ export interface LikeC4DiagramEventHandlers<A extends Any = Unknown> {
|
|
|
261
263
|
onBurgerMenuClick?: null | undefined | (() => void);
|
|
262
264
|
onOpenSource?: OnOpenSource<A> | null | undefined;
|
|
263
265
|
onInitialized?: OnInitialized | null | undefined;
|
|
266
|
+
/**
|
|
267
|
+
* Triggered when user changes layout type (e.g. from 'manual' to 'auto')
|
|
268
|
+
* Expected another `view` to be passed to the diagram
|
|
269
|
+
*
|
|
270
|
+
* @param layoutType new layout type
|
|
271
|
+
*/
|
|
272
|
+
onLayoutTypeChange?: OnLayoutTypeChange | null | undefined;
|
|
264
273
|
}
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { jsx } from 'react/jsx-runtime';
|
|
2
|
-
import { useCallbackRef } from '@mantine/hooks';
|
|
3
2
|
import { useCustomCompareMemo } from '@react-hookz/web';
|
|
4
3
|
import { shallowEqual } from 'fast-equals';
|
|
5
4
|
import { useContext } from 'react';
|
|
6
5
|
import { LikeC4ProjectsContext } from './context/LikeC4ProjectsContext.js';
|
|
6
|
+
import { useCallbackRef } from './hooks/useCallbackRef.js';
|
|
7
7
|
|
|
8
8
|
function LikeC4ProjectsProvider({
|
|
9
9
|
children,
|
package/dist/LikeC4View.d.ts
CHANGED
|
@@ -230,6 +230,11 @@ export interface LikeC4BrowserProps {
|
|
|
230
230
|
* @default true
|
|
231
231
|
*/
|
|
232
232
|
enableNotations?: boolean | undefined;
|
|
233
|
+
/**
|
|
234
|
+
* Enable "Compare with auto layout" action when view was manually modified and out of sync with latest model
|
|
235
|
+
* @default true
|
|
236
|
+
*/
|
|
237
|
+
enableCompareWithLatest?: boolean | undefined;
|
|
233
238
|
/**
|
|
234
239
|
* Improve performance by hiding certain elements and reducing visual effects (disable mix-blend, shadows, animations)
|
|
235
240
|
*
|
package/dist/LikeC4View.js
CHANGED
|
@@ -1,18 +1,19 @@
|
|
|
1
1
|
import { jsx, jsxs } from 'react/jsx-runtime';
|
|
2
2
|
import { cx, css } from '@likec4/styles/css';
|
|
3
|
-
import { Box
|
|
4
|
-
import {
|
|
3
|
+
import { Box } from '@likec4/styles/jsx';
|
|
4
|
+
import { ActionIcon } from '@mantine/core';
|
|
5
5
|
import { useState } from 'react';
|
|
6
6
|
import { isBoolean } from 'remeda';
|
|
7
7
|
import { FitViewPaddings } from './base/const.js';
|
|
8
8
|
import { ErrorMessage, ViewNotFound } from './components/ViewNotFound.js';
|
|
9
9
|
import { FramerMotionConfig } from './context/FramerMotionConfig.js';
|
|
10
|
+
import { useCallbackRef } from './hooks/useCallbackRef.js';
|
|
10
11
|
import { useOptionalLikeC4Model } from './hooks/useLikeC4Model.js';
|
|
11
12
|
import { LikeC4Diagram } from './LikeC4Diagram.js';
|
|
12
13
|
import { Overlay } from './overlays/overlay/Overlay.js';
|
|
13
14
|
import { ShadowRoot } from './shadowroot/ShadowRoot.js';
|
|
14
|
-
import {
|
|
15
|
-
import IconX from './node_modules/.pnpm/@tabler_icons-react@3.35.0_react@19.
|
|
15
|
+
import { pickViewBounds } from './utils/view-bounds.js';
|
|
16
|
+
import IconX from './node_modules/.pnpm/@tabler_icons-react@3.35.0_react@19.2.0/node_modules/@tabler/icons-react/dist/esm/icons/IconX.js';
|
|
16
17
|
|
|
17
18
|
const cssInteractive = css({
|
|
18
19
|
cursor: "pointer",
|
|
@@ -49,14 +50,21 @@ function LikeC4View({
|
|
|
49
50
|
...props
|
|
50
51
|
}) {
|
|
51
52
|
const likec4model = useOptionalLikeC4Model();
|
|
52
|
-
const [
|
|
53
|
+
const [layoutType, setLayoutType] = useState("manual");
|
|
54
|
+
const [browserViewId, _onNavigateTo] = useState(null);
|
|
55
|
+
const onNavigateTo = useCallbackRef((viewId2) => {
|
|
56
|
+
if (viewId2 && viewId2 !== browserViewId) {
|
|
57
|
+
setLayoutType("manual");
|
|
58
|
+
}
|
|
59
|
+
_onNavigateTo(viewId2);
|
|
60
|
+
});
|
|
53
61
|
const onNavigateToThisView = useCallbackRef(() => {
|
|
54
62
|
onNavigateTo(viewId);
|
|
55
63
|
});
|
|
56
64
|
if (!likec4model) {
|
|
57
65
|
return /* @__PURE__ */ jsx(ErrorMessage, { children: "LikeC4Model not found. Make sure you provided LikeC4ModelProvider." });
|
|
58
66
|
}
|
|
59
|
-
const view = likec4model.findView(viewId)?.$
|
|
67
|
+
const view = likec4model.findView(viewId)?.$layouted;
|
|
60
68
|
if (!view) {
|
|
61
69
|
return /* @__PURE__ */ jsx(ViewNotFound, { viewId });
|
|
62
70
|
}
|
|
@@ -67,12 +75,13 @@ function LikeC4View({
|
|
|
67
75
|
'" is not layouted. Make sure you have LikeC4ModelProvider with layouted model.'
|
|
68
76
|
] });
|
|
69
77
|
}
|
|
70
|
-
const
|
|
78
|
+
const browserViewModel = browserViewId ? likec4model.findView(browserViewId) : null;
|
|
79
|
+
const browserView = layoutType === "manual" ? browserViewModel?.$layouted : browserViewModel?.$view;
|
|
71
80
|
const hasNotations = !!enableNotations && (view.notation?.nodes?.length ?? 0) > 0;
|
|
72
81
|
const browserViewHasNotations = (browserView?.notation?.nodes?.length ?? 0) > 0;
|
|
73
82
|
const isBrowserEnabled = browser !== false;
|
|
74
83
|
const browserProps = isBoolean(browser) ? {} : browser;
|
|
75
|
-
const bounds =
|
|
84
|
+
const bounds = pickViewBounds(view, props.dynamicViewVariant);
|
|
76
85
|
return /* @__PURE__ */ jsx(
|
|
77
86
|
ShadowRoot,
|
|
78
87
|
{
|
|
@@ -100,7 +109,7 @@ function LikeC4View({
|
|
|
100
109
|
enableNotations: hasNotations,
|
|
101
110
|
enableDynamicViewWalkthrough,
|
|
102
111
|
showNavigationButtons,
|
|
103
|
-
|
|
112
|
+
enableCompareWithLatest: false,
|
|
104
113
|
enableFocusMode,
|
|
105
114
|
enableRelationshipDetails,
|
|
106
115
|
enableElementDetails,
|
|
@@ -141,6 +150,7 @@ function LikeC4View({
|
|
|
141
150
|
enableRelationshipDetails: true,
|
|
142
151
|
enableSearch: true,
|
|
143
152
|
enableElementTags: true,
|
|
153
|
+
enableCompareWithLatest: true,
|
|
144
154
|
controls: true,
|
|
145
155
|
readonly: true,
|
|
146
156
|
nodesDraggable: false,
|
|
@@ -149,10 +159,11 @@ function LikeC4View({
|
|
|
149
159
|
fitViewPadding: FitViewPaddings.withControls,
|
|
150
160
|
...browserProps,
|
|
151
161
|
enableNotations: browserViewHasNotations && (browserProps.enableNotations ?? true),
|
|
152
|
-
renderNodes
|
|
162
|
+
renderNodes,
|
|
163
|
+
onLayoutTypeChange: setLayoutType
|
|
153
164
|
}
|
|
154
165
|
),
|
|
155
|
-
/* @__PURE__ */ jsx(Box, { pos: "absolute", top: "
|
|
166
|
+
/* @__PURE__ */ jsx(Box, { pos: "absolute", top: "4", right: "4", zIndex: "999", children: /* @__PURE__ */ jsx(
|
|
156
167
|
ActionIcon,
|
|
157
168
|
{
|
|
158
169
|
variant: "default",
|
package/dist/ReactLikeC4.js
CHANGED
|
@@ -4,7 +4,7 @@ import { ErrorMessage, ViewNotFound } from './components/ViewNotFound.js';
|
|
|
4
4
|
import { useOptionalLikeC4Model } from './hooks/useLikeC4Model.js';
|
|
5
5
|
import { LikeC4Diagram } from './LikeC4Diagram.js';
|
|
6
6
|
import { ShadowRoot } from './shadowroot/ShadowRoot.js';
|
|
7
|
-
import {
|
|
7
|
+
import { pickViewBounds } from './utils/view-bounds.js';
|
|
8
8
|
|
|
9
9
|
function ReactLikeC4({
|
|
10
10
|
viewId,
|
|
@@ -33,7 +33,7 @@ function ReactLikeC4({
|
|
|
33
33
|
'" is not layouted. Make sure you have LikeC4ModelProvider with layouted model.'
|
|
34
34
|
] });
|
|
35
35
|
}
|
|
36
|
-
const bounds =
|
|
36
|
+
const bounds = pickViewBounds(view, props.dynamicViewVariant);
|
|
37
37
|
const hasNotations = !!enableNotations && (view.notation?.nodes?.length ?? 0) > 0;
|
|
38
38
|
return /* @__PURE__ */ jsx(
|
|
39
39
|
ShadowRoot,
|
|
@@ -30,7 +30,7 @@ function StaticLikeC4Diagram({
|
|
|
30
30
|
enableRelationshipBrowser,
|
|
31
31
|
enableDynamicViewWalkthrough: false,
|
|
32
32
|
showNavigationButtons: false,
|
|
33
|
-
|
|
33
|
+
enableCompareWithLatest: false,
|
|
34
34
|
enableFocusMode: false,
|
|
35
35
|
enableSearch: false,
|
|
36
36
|
nodesSelectable: false,
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { __require as requireXstateActions_cjs } from '../node_modules/.pnpm/xstate@5.24.0_patch_hash_3a1bd6d012ec67bf6e38a00c3226d1be77089442f83aeb6e424b00ca2a11d21c/node_modules/xstate/actions/dist/xstate-actions.cjs.js';
|
|
2
|
+
|
|
3
|
+
var xstateActions_cjsExports = requireXstateActions_cjs();
|
|
4
|
+
|
|
5
|
+
export { xstateActions_cjsExports as x };
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { __require as requireXstateGuards_cjs } from '../node_modules/.pnpm/xstate@5.24.0_patch_hash_3a1bd6d012ec67bf6e38a00c3226d1be77089442f83aeb6e424b00ca2a11d21c/node_modules/xstate/guards/dist/xstate-guards.cjs.js';
|
|
2
|
+
|
|
3
|
+
var xstateGuards_cjsExports = requireXstateGuards_cjs();
|
|
4
|
+
|
|
5
|
+
export { xstateGuards_cjsExports as x };
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import { BackgroundProps } from '@xyflow/react';
|
|
2
|
+
import { NamedExoticComponent } from 'react';
|
|
2
3
|
export type XYBackgroundVariant = 'dots' | 'lines' | 'cross';
|
|
3
4
|
export type XYBackground = XYBackgroundVariant | BackgroundProps;
|
|
4
5
|
export type XYBackgroundProps = {
|
|
5
6
|
background: XYBackground;
|
|
6
7
|
};
|
|
7
|
-
export declare
|
|
8
|
+
export declare const Background: NamedExoticComponent<XYBackgroundProps>;
|
package/dist/base/Background.js
CHANGED
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import { jsx } from 'react/jsx-runtime';
|
|
2
2
|
import { nonexhaustive } from '@likec4/core';
|
|
3
3
|
import { Background as Background$1, BackgroundVariant } from '@xyflow/react';
|
|
4
|
+
import { deepEqual } from 'fast-equals';
|
|
5
|
+
import { memo } from 'react';
|
|
4
6
|
|
|
5
7
|
function literalToEnum(value) {
|
|
6
8
|
switch (value) {
|
|
@@ -14,11 +16,18 @@ function literalToEnum(value) {
|
|
|
14
16
|
nonexhaustive(value);
|
|
15
17
|
}
|
|
16
18
|
}
|
|
17
|
-
|
|
19
|
+
const compareProps = (prev, next) => {
|
|
20
|
+
if (typeof prev.background === "string" && typeof next.background === "string") {
|
|
21
|
+
return prev.background === next.background;
|
|
22
|
+
}
|
|
23
|
+
return deepEqual(prev.background, next.background);
|
|
24
|
+
};
|
|
25
|
+
const Background = memo(({ background }) => {
|
|
18
26
|
if (typeof background === "string") {
|
|
19
27
|
return /* @__PURE__ */ jsx(Background$1, { variant: literalToEnum(background), size: 2, gap: 20 });
|
|
20
28
|
}
|
|
21
29
|
return /* @__PURE__ */ jsx(Background$1, { ...background });
|
|
22
|
-
}
|
|
30
|
+
}, compareProps);
|
|
31
|
+
Background.displayName = "Background";
|
|
23
32
|
|
|
24
33
|
export { Background };
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
type WithDimmed = {
|
|
2
|
+
data: {
|
|
3
|
+
dimmed?: Base.Dimmed;
|
|
4
|
+
};
|
|
5
|
+
};
|
|
6
|
+
type WithHovered = {
|
|
7
|
+
data: {
|
|
8
|
+
hovered?: boolean;
|
|
9
|
+
};
|
|
10
|
+
};
|
|
11
|
+
declare function setDimmed<T extends WithDimmed>(value: T, dimmed: 'immediate' | boolean): T;
|
|
12
|
+
declare function setDimmed(dimmed: 'immediate' | boolean): <T extends WithDimmed>(value: T) => T;
|
|
13
|
+
declare function setHovered<T extends WithHovered>(value: T, hovered: boolean): T;
|
|
14
|
+
declare function setHovered(hovered: boolean): <T extends WithHovered>(value: T) => T;
|
|
15
|
+
type WithData<D> = {
|
|
16
|
+
data: D;
|
|
17
|
+
};
|
|
18
|
+
declare function setData<E extends WithData<any>>(value: E, state: Partial<E['data']>): E;
|
|
19
|
+
declare function setData<E extends WithData<any>>(state: Partial<E['data']>): (value: E) => E;
|
|
20
|
+
export declare const Base: {
|
|
21
|
+
setDimmed: typeof setDimmed;
|
|
22
|
+
setHovered: typeof setHovered;
|
|
23
|
+
setData: typeof setData;
|
|
24
|
+
};
|
|
25
|
+
export declare namespace Base {
|
|
26
|
+
type Dimmed = 'immediate' | boolean;
|
|
27
|
+
}
|
|
28
|
+
export {};
|
|
@@ -4,12 +4,12 @@ import { ViewPadding } from '../LikeC4Diagram.props';
|
|
|
4
4
|
import { XYBackground } from './Background';
|
|
5
5
|
import { BaseEdge, BaseNode } from './types';
|
|
6
6
|
export type BaseXYFlowProps<NodeType extends BaseNode, EdgeType extends BaseEdge> = Simplify<{
|
|
7
|
-
pannable
|
|
8
|
-
zoomable
|
|
9
|
-
nodesSelectable
|
|
10
|
-
nodesDraggable
|
|
7
|
+
pannable: boolean;
|
|
8
|
+
zoomable: boolean;
|
|
9
|
+
nodesSelectable: boolean;
|
|
10
|
+
nodesDraggable: boolean;
|
|
11
11
|
background?: 'transparent' | 'solid' | XYBackground;
|
|
12
12
|
fitViewPadding?: ViewPadding | undefined;
|
|
13
13
|
onViewportResize?: undefined | (() => void);
|
|
14
|
-
} & SetRequired<Omit<ReactFlowProps<NodeType, EdgeType>, 'defaultNodes' | 'defaultEdges' | '
|
|
14
|
+
} & SetRequired<Omit<ReactFlowProps<NodeType, EdgeType>, 'defaultNodes' | 'defaultEdges' | 'fitViewOptions' | 'nodesSelectable' | 'nodesDraggable'>, 'nodes' | 'edges' | 'onNodesChange' | 'onEdgesChange'>>;
|
|
15
15
|
export declare function BaseXYFlow<NodeType extends BaseNode, EdgeType extends BaseEdge>({ nodes, edges, onEdgesChange, onNodesChange, className, pannable, zoomable, nodesSelectable, nodesDraggable, background, children, colorMode, fitViewPadding, fitView, zoomOnDoubleClick, onViewportResize, onMoveEnd, onNodeMouseEnter, onNodeMouseLeave, onEdgeMouseEnter, onEdgeMouseLeave, ...props }: BaseXYFlowProps<NodeType, EdgeType>): import("react/jsx-runtime").JSX.Element;
|
package/dist/base/BaseXYFlow.js
CHANGED
|
@@ -1,15 +1,16 @@
|
|
|
1
1
|
import { jsxs, jsx } from 'react/jsx-runtime';
|
|
2
2
|
import { cx } from '@likec4/styles/css';
|
|
3
3
|
import { useMantineColorScheme } from '@mantine/core';
|
|
4
|
-
import { useCallbackRef } from '@mantine/hooks';
|
|
5
4
|
import { ReactFlow, useStore } from '@xyflow/react';
|
|
5
|
+
import { useMemo } from 'react';
|
|
6
|
+
import { useCallbackRef } from '../hooks/useCallbackRef.js';
|
|
6
7
|
import { useUpdateEffect } from '../hooks/useUpdateEffect.js';
|
|
7
8
|
import { useIsZoomTooSmall, useXYStoreApi } from '../hooks/useXYFlow.js';
|
|
8
9
|
import { roundDpr } from '../utils/roundDpr.js';
|
|
9
10
|
import { stopPropagation } from '../utils/xyflow.js';
|
|
10
11
|
import { Background } from './Background.js';
|
|
12
|
+
import { Base } from './Base.js';
|
|
11
13
|
import { MinZoom, MaxZoom } from './const.js';
|
|
12
|
-
import { Base } from './types.js';
|
|
13
14
|
|
|
14
15
|
function BaseXYFlow({
|
|
15
16
|
nodes,
|
|
@@ -35,6 +36,12 @@ function BaseXYFlow({
|
|
|
35
36
|
onEdgeMouseLeave,
|
|
36
37
|
...props
|
|
37
38
|
}) {
|
|
39
|
+
const fitViewOptions = useMemo(() => ({
|
|
40
|
+
minZoom: MinZoom,
|
|
41
|
+
maxZoom: 1,
|
|
42
|
+
padding: fitViewPadding,
|
|
43
|
+
includeHiddenNodes: false
|
|
44
|
+
}), [fitViewPadding]);
|
|
38
45
|
const isBgWithPattern = background !== "transparent" && background !== "solid";
|
|
39
46
|
const isZoomTooSmall = useIsZoomTooSmall();
|
|
40
47
|
const xystore = useXYStoreApi();
|
|
@@ -64,12 +71,7 @@ function BaseXYFlow({
|
|
|
64
71
|
maxZoom: zoomable ? MaxZoom : 1,
|
|
65
72
|
minZoom: zoomable ? MinZoom : 1,
|
|
66
73
|
fitView,
|
|
67
|
-
fitViewOptions
|
|
68
|
-
minZoom: MinZoom,
|
|
69
|
-
maxZoom: 1,
|
|
70
|
-
padding: fitViewPadding,
|
|
71
|
-
includeHiddenNodes: false
|
|
72
|
-
},
|
|
74
|
+
fitViewOptions,
|
|
73
75
|
preventScrolling: zoomable || pannable,
|
|
74
76
|
defaultMarkerColor: "var(--xy-edge-stroke)",
|
|
75
77
|
noDragClassName: "nodrag",
|
|
@@ -99,57 +101,49 @@ function BaseXYFlow({
|
|
|
99
101
|
}
|
|
100
102
|
onMoveEnd?.(event, { x: roundedX, y: roundedY, zoom });
|
|
101
103
|
}),
|
|
102
|
-
onNodeMouseEnter: useCallbackRef((
|
|
104
|
+
onNodeMouseEnter: useCallbackRef((event, node) => {
|
|
103
105
|
if (onNodeMouseEnter) {
|
|
104
|
-
onNodeMouseEnter(
|
|
106
|
+
onNodeMouseEnter(event, node);
|
|
105
107
|
return;
|
|
106
108
|
}
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
}]);
|
|
113
|
-
}
|
|
109
|
+
onNodesChange([{
|
|
110
|
+
id: node.id,
|
|
111
|
+
type: "replace",
|
|
112
|
+
item: Base.setHovered(node, true)
|
|
113
|
+
}]);
|
|
114
114
|
}),
|
|
115
|
-
onNodeMouseLeave: useCallbackRef((
|
|
115
|
+
onNodeMouseLeave: useCallbackRef((event, node) => {
|
|
116
116
|
if (onNodeMouseLeave) {
|
|
117
|
-
onNodeMouseLeave(
|
|
117
|
+
onNodeMouseLeave(event, node);
|
|
118
118
|
return;
|
|
119
119
|
}
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
}]);
|
|
126
|
-
}
|
|
120
|
+
onNodesChange([{
|
|
121
|
+
id: node.id,
|
|
122
|
+
type: "replace",
|
|
123
|
+
item: Base.setHovered(node, false)
|
|
124
|
+
}]);
|
|
127
125
|
}),
|
|
128
|
-
onEdgeMouseEnter: useCallbackRef((
|
|
126
|
+
onEdgeMouseEnter: useCallbackRef((event, edge) => {
|
|
129
127
|
if (onEdgeMouseEnter) {
|
|
130
|
-
onEdgeMouseEnter(
|
|
128
|
+
onEdgeMouseEnter(event, edge);
|
|
131
129
|
return;
|
|
132
130
|
}
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
}]);
|
|
139
|
-
}
|
|
131
|
+
onEdgesChange([{
|
|
132
|
+
id: edge.id,
|
|
133
|
+
type: "replace",
|
|
134
|
+
item: Base.setHovered(edge, true)
|
|
135
|
+
}]);
|
|
140
136
|
}),
|
|
141
|
-
onEdgeMouseLeave: useCallbackRef((
|
|
137
|
+
onEdgeMouseLeave: useCallbackRef((event, edge) => {
|
|
142
138
|
if (onEdgeMouseLeave) {
|
|
143
|
-
onEdgeMouseLeave(
|
|
139
|
+
onEdgeMouseLeave(event, edge);
|
|
144
140
|
return;
|
|
145
141
|
}
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
}]);
|
|
152
|
-
}
|
|
142
|
+
onEdgesChange([{
|
|
143
|
+
id: edge.id,
|
|
144
|
+
type: "replace",
|
|
145
|
+
item: Base.setHovered(edge, false)
|
|
146
|
+
}]);
|
|
153
147
|
}),
|
|
154
148
|
onNodeDoubleClick: stopPropagation,
|
|
155
149
|
onEdgeDoubleClick: stopPropagation,
|
package/dist/base/index.d.ts
CHANGED
|
@@ -1,3 +1,7 @@
|
|
|
1
|
-
export {
|
|
2
|
-
export
|
|
1
|
+
export { Background, type XYBackground, type XYBackgroundProps, type XYBackgroundVariant, } from './Background';
|
|
2
|
+
export { BaseXYFlow, type BaseXYFlowProps, } from './BaseXYFlow';
|
|
3
|
+
export * from './Base';
|
|
3
4
|
export * from './const';
|
|
5
|
+
export * from './types';
|
|
6
|
+
export { updateEdges } from './updateEdges';
|
|
7
|
+
export { updateNodes } from './updateNodes';
|
package/dist/base/types.d.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { Edge, EdgeProps, Node, NodeProps } from '@xyflow/react';
|
|
2
2
|
import { OptionalKeysOf, SetRequired, Simplify } from 'type-fest';
|
|
3
|
+
import { Base } from './Base';
|
|
3
4
|
export type BaseNodeData = {
|
|
4
5
|
/**
|
|
5
6
|
* Whether the cursor is hovering over the node
|
|
@@ -41,33 +42,6 @@ export type BaseNodePropsWithData<Data extends Record<string, unknown>> = BaseNo
|
|
|
41
42
|
export interface BaseEdgeProps<E extends BaseEdge = BaseEdge> extends EdgeProps<E> {
|
|
42
43
|
}
|
|
43
44
|
export type BaseEdgePropsWithData<Data extends Record<string, unknown>> = BaseEdgeProps<BaseEdge<Data>>;
|
|
44
|
-
type WithDimmed = {
|
|
45
|
-
data: {
|
|
46
|
-
dimmed?: Base.Dimmed;
|
|
47
|
-
};
|
|
48
|
-
};
|
|
49
|
-
type WithHovered = {
|
|
50
|
-
data: {
|
|
51
|
-
hovered?: boolean;
|
|
52
|
-
};
|
|
53
|
-
};
|
|
54
|
-
declare function setDimmed<T extends WithDimmed>(value: T, dimmed: 'immediate' | boolean): T;
|
|
55
|
-
declare function setDimmed(dimmed: 'immediate' | boolean): <T extends WithDimmed>(value: T) => T;
|
|
56
|
-
declare function setHovered<T extends WithHovered>(value: T, hovered: boolean): T;
|
|
57
|
-
declare function setHovered(hovered: boolean): <T extends WithHovered>(value: T) => T;
|
|
58
|
-
type WithData<D> = {
|
|
59
|
-
data: D;
|
|
60
|
-
};
|
|
61
|
-
declare function setData<E extends WithData<any>>(value: E, state: Partial<E['data']>): E;
|
|
62
|
-
declare function setData<E extends WithData<any>>(state: Partial<E['data']>): (value: E) => E;
|
|
63
|
-
export declare const Base: {
|
|
64
|
-
setDimmed: typeof setDimmed;
|
|
65
|
-
setHovered: typeof setHovered;
|
|
66
|
-
setData: typeof setData;
|
|
67
|
-
};
|
|
68
|
-
export declare namespace Base {
|
|
69
|
-
type Dimmed = 'immediate' | boolean;
|
|
70
|
-
}
|
|
71
45
|
/**
|
|
72
46
|
* To cooperate with `exactOptionalPropertyTypes` in `tsconfig.json`
|
|
73
47
|
*
|
|
@@ -90,4 +64,3 @@ export type NonOptional<T extends object, Keys extends OptionalKeysOf<T> = Optio
|
|
|
90
64
|
} & {
|
|
91
65
|
[P in Keys]-?: T[P] | undefined;
|
|
92
66
|
}>;
|
|
93
|
-
export {};
|