@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
|
@@ -1,18 +1,13 @@
|
|
|
1
1
|
import { jsx } from 'react/jsx-runtime';
|
|
2
|
-
import { invariant } from '@likec4/core';
|
|
3
2
|
import { Tooltip as Tooltip$1, ActionIcon } from '@mantine/core';
|
|
4
|
-
import
|
|
5
|
-
import
|
|
6
|
-
import
|
|
3
|
+
import '@xstate/react';
|
|
4
|
+
import 'fast-equals';
|
|
5
|
+
import 'react';
|
|
6
|
+
import { useDiagram } from '../../../../hooks/safeContext.js';
|
|
7
7
|
import { useDiagramEventHandlers } from '../../../../context/DiagramEventHandlers.js';
|
|
8
|
-
import IconFileSymlink from '../../../../node_modules/.pnpm/@tabler_icons-react@3.35.0_react@19.
|
|
9
|
-
import IconTransform from '../../../../node_modules/.pnpm/@tabler_icons-react@3.35.0_react@19.
|
|
8
|
+
import IconFileSymlink from '../../../../node_modules/.pnpm/@tabler_icons-react@3.35.0_react@19.2.0/node_modules/@tabler/icons-react/dist/esm/icons/IconFileSymlink.js';
|
|
9
|
+
import IconTransform from '../../../../node_modules/.pnpm/@tabler_icons-react@3.35.0_react@19.2.0/node_modules/@tabler/icons-react/dist/esm/icons/IconTransform.js';
|
|
10
10
|
|
|
11
|
-
const SemanticColors = [
|
|
12
|
-
"primary",
|
|
13
|
-
"secondary",
|
|
14
|
-
"muted"
|
|
15
|
-
];
|
|
16
11
|
const Tooltip = Tooltip$1.withProps({
|
|
17
12
|
color: "dark",
|
|
18
13
|
fz: "xs",
|
|
@@ -23,45 +18,6 @@ const Tooltip = Tooltip$1.withProps({
|
|
|
23
18
|
offset: 4,
|
|
24
19
|
withinPortal: false
|
|
25
20
|
});
|
|
26
|
-
function useHandlers(target, props) {
|
|
27
|
-
const { onChange: triggerOnChange } = useDiagramEventHandlers();
|
|
28
|
-
const diagram = useDiagram();
|
|
29
|
-
const [originalColor, setOriginalColor] = useState(null);
|
|
30
|
-
const onColorPreview = useCallbackRef((color) => {
|
|
31
|
-
if (color === null) {
|
|
32
|
-
invariant(originalColor, "originalColor is null");
|
|
33
|
-
setOriginalColor(null);
|
|
34
|
-
diagram.updateNodeData(props.data.id, {
|
|
35
|
-
color: originalColor
|
|
36
|
-
});
|
|
37
|
-
return;
|
|
38
|
-
}
|
|
39
|
-
setOriginalColor((value) => value ?? props.data.color);
|
|
40
|
-
diagram.updateNodeData(props.data.id, {
|
|
41
|
-
color
|
|
42
|
-
});
|
|
43
|
-
});
|
|
44
|
-
const onChange = useCallbackRef((change) => {
|
|
45
|
-
triggerOnChange?.({
|
|
46
|
-
change: {
|
|
47
|
-
op: "change-element-style",
|
|
48
|
-
style: change,
|
|
49
|
-
targets: [target]
|
|
50
|
-
}
|
|
51
|
-
});
|
|
52
|
-
const { shape, color, ...style } = change;
|
|
53
|
-
diagram.updateNodeData(props.data.id, {
|
|
54
|
-
...shape && { shape },
|
|
55
|
-
...color && { color },
|
|
56
|
-
style
|
|
57
|
-
});
|
|
58
|
-
});
|
|
59
|
-
return {
|
|
60
|
-
elementColor: originalColor ?? props.data.color,
|
|
61
|
-
onColorPreview,
|
|
62
|
-
onChange
|
|
63
|
-
};
|
|
64
|
-
}
|
|
65
21
|
function BrowseRelationshipsButton({ fqn }) {
|
|
66
22
|
const diagram = useDiagram();
|
|
67
23
|
return /* @__PURE__ */ jsx(Tooltip, { label: "Browse relationships", children: /* @__PURE__ */ jsx(
|
|
@@ -113,4 +69,4 @@ function GoToSourceButton(props) {
|
|
|
113
69
|
) });
|
|
114
70
|
}
|
|
115
71
|
|
|
116
|
-
export { BrowseRelationshipsButton, GoToSourceButton,
|
|
72
|
+
export { BrowseRelationshipsButton, GoToSourceButton, Tooltip };
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { ThemeColor, ViewChange } from '@likec4/core/types';
|
|
2
|
+
export declare const SemanticColors: readonly ["primary", "secondary", "muted"];
|
|
3
|
+
export type OnStyleChange = (style: ViewChange.ChangeElementStyle['style']) => void;
|
|
4
|
+
export type ThemeColorKey = typeof SemanticColors[number];
|
|
5
|
+
export type ColorKey = Exclude<ThemeColor, ThemeColorKey>;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { DeploymentFqn, Fqn, ThemeColor } from '@likec4/core';
|
|
2
|
+
import { Types } from '../../../types';
|
|
3
|
+
import { OnStyleChange } from './types';
|
|
4
|
+
export declare function useHandlers(target: Fqn | DeploymentFqn, props: Types.NodeProps): {
|
|
5
|
+
elementColor: "amber" | "blue" | "gray" | "slate" | "green" | "indigo" | "muted" | "primary" | "red" | "secondary" | "sky";
|
|
6
|
+
onColorPreview: (color: ThemeColor | null) => void;
|
|
7
|
+
onChange: OnStyleChange;
|
|
8
|
+
};
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import { useState } from 'react';
|
|
2
|
+
import { useCallbackRef } from '../../../../hooks/useCallbackRef.js';
|
|
3
|
+
import '@xstate/react';
|
|
4
|
+
import 'fast-equals';
|
|
5
|
+
import { useDiagram } from '../../../../hooks/safeContext.js';
|
|
6
|
+
|
|
7
|
+
function useHandlers(target, props) {
|
|
8
|
+
const diagram = useDiagram();
|
|
9
|
+
const [originalColor, setOriginalColor] = useState(null);
|
|
10
|
+
const onColorPreview = useCallbackRef((color) => {
|
|
11
|
+
if (color === null) {
|
|
12
|
+
if (!originalColor) return;
|
|
13
|
+
setOriginalColor(null);
|
|
14
|
+
diagram.updateNodeData(props.data.id, {
|
|
15
|
+
color: originalColor
|
|
16
|
+
});
|
|
17
|
+
return;
|
|
18
|
+
}
|
|
19
|
+
setOriginalColor((value) => value ?? props.data.color);
|
|
20
|
+
diagram.updateNodeData(props.data.id, {
|
|
21
|
+
color
|
|
22
|
+
});
|
|
23
|
+
});
|
|
24
|
+
const onChange = useCallbackRef((change) => {
|
|
25
|
+
const { shape, color, ...style } = change;
|
|
26
|
+
diagram.updateNodeData(props.data.id, {
|
|
27
|
+
...shape && { shape },
|
|
28
|
+
...color && { color },
|
|
29
|
+
style
|
|
30
|
+
});
|
|
31
|
+
diagram.triggerChange({
|
|
32
|
+
op: "change-element-style",
|
|
33
|
+
style: change,
|
|
34
|
+
targets: [target]
|
|
35
|
+
});
|
|
36
|
+
});
|
|
37
|
+
return {
|
|
38
|
+
elementColor: originalColor ?? props.data.color,
|
|
39
|
+
onColorPreview,
|
|
40
|
+
onChange
|
|
41
|
+
};
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
export { useHandlers };
|
|
@@ -13,16 +13,17 @@ import { Link } from '../../components/Link.js';
|
|
|
13
13
|
import { PortalToContainer } from '../../components/PortalToContainer.js';
|
|
14
14
|
import { useDiagramEventHandlers } from '../../context/DiagramEventHandlers.js';
|
|
15
15
|
import { useEnabledFeatures } from '../../context/DiagramFeatures.js';
|
|
16
|
-
import {
|
|
16
|
+
import { useDiagramContext, useOnDiagramEvent } from '../../hooks/useDiagram.js';
|
|
17
17
|
import { useLikeC4Model } from '../../hooks/useLikeC4Model.js';
|
|
18
18
|
import { findDiagramEdge, findDiagramNode } from '../state/utils.js';
|
|
19
19
|
import { RelationshipPopoverActorLogic } from './actor.js';
|
|
20
20
|
import { endpoint, title } from './styles.css.js';
|
|
21
|
+
import { useDiagram } from '../../hooks/safeContext.js';
|
|
21
22
|
import { useRootContainerRef } from '../../context/RootContainerContext.js';
|
|
22
23
|
import { roundDpr } from '../../utils/roundDpr.js';
|
|
23
|
-
import IconArrowRight from '../../node_modules/.pnpm/@tabler_icons-react@3.35.0_react@19.
|
|
24
|
-
import IconZoomScan from '../../node_modules/.pnpm/@tabler_icons-react@3.35.0_react@19.
|
|
25
|
-
import IconFileSymlink from '../../node_modules/.pnpm/@tabler_icons-react@3.35.0_react@19.
|
|
24
|
+
import IconArrowRight from '../../node_modules/.pnpm/@tabler_icons-react@3.35.0_react@19.2.0/node_modules/@tabler/icons-react/dist/esm/icons/IconArrowRight.js';
|
|
25
|
+
import IconZoomScan from '../../node_modules/.pnpm/@tabler_icons-react@3.35.0_react@19.2.0/node_modules/@tabler/icons-react/dist/esm/icons/IconZoomScan.js';
|
|
26
|
+
import IconFileSymlink from '../../node_modules/.pnpm/@tabler_icons-react@3.35.0_react@19.2.0/node_modules/@tabler/icons-react/dist/esm/icons/IconFileSymlink.js';
|
|
26
27
|
import { Markdown } from '../../base-primitives/Markdown.js';
|
|
27
28
|
|
|
28
29
|
function selectDiagramContext(c) {
|
|
@@ -56,9 +57,6 @@ const RelationshipPopover = memo(() => {
|
|
|
56
57
|
useOnDiagramEvent("edgeMouseLeave", () => {
|
|
57
58
|
actorRef.send({ type: "xyedge.mouseLeave" });
|
|
58
59
|
});
|
|
59
|
-
useOnDiagramEvent("edgeEditingStarted", () => {
|
|
60
|
-
actorRef.send({ type: "close" });
|
|
61
|
-
});
|
|
62
60
|
useOnDiagramEvent("walkthroughStarted", () => {
|
|
63
61
|
actorRef.send({ type: "close" });
|
|
64
62
|
});
|
|
@@ -145,7 +143,7 @@ const RelationshipPopover = memo(() => {
|
|
|
145
143
|
) });
|
|
146
144
|
});
|
|
147
145
|
const getEdgeLabelElement = (edgeId, container) => {
|
|
148
|
-
return container?.querySelector(`.likec4-edge-label[data-edge-id="${edgeId}"]`) ?? null;
|
|
146
|
+
return container?.querySelector(`.likec4-edge-label[data-edge-id="${edgeId}"]`) ?? container?.querySelector(`.react-flow__edge[data-id="${edgeId}"] .edge-center-point`) ?? null;
|
|
149
147
|
};
|
|
150
148
|
const POPOVER_PADDING = 8;
|
|
151
149
|
const RelationshipPopoverInternal = ({
|
|
@@ -399,7 +397,7 @@ const Relationship = forwardRef(({
|
|
|
399
397
|
/* @__PURE__ */ jsx(Label, { children: "technology" }),
|
|
400
398
|
/* @__PURE__ */ jsx(Text, { size: "xs", className: css({ userSelect: "all" }), children: r.technology })
|
|
401
399
|
] }),
|
|
402
|
-
r.
|
|
400
|
+
r.summary.nonEmpty && /* @__PURE__ */ jsxs(Fragment$1, { children: [
|
|
403
401
|
/* @__PURE__ */ jsx(Label, { children: "description" }),
|
|
404
402
|
/* @__PURE__ */ jsx(
|
|
405
403
|
Box,
|
|
@@ -413,7 +411,7 @@ const Relationship = forwardRef(({
|
|
|
413
411
|
_dark: "mantine.colors.dark[4]"
|
|
414
412
|
}
|
|
415
413
|
},
|
|
416
|
-
children: /* @__PURE__ */ jsx(Markdown, { value: r.
|
|
414
|
+
children: /* @__PURE__ */ jsx(Markdown, { value: r.summary, fontSize: "sm" })
|
|
417
415
|
}
|
|
418
416
|
)
|
|
419
417
|
] }),
|
|
@@ -57,7 +57,7 @@ declare const _actorLogic: StateMachine<RelationshipPopoverActorContext, Relatio
|
|
|
57
57
|
params: unknown;
|
|
58
58
|
};
|
|
59
59
|
}>, "open timeout" | "close timeout" | "long idle", "idle" | "opening" | {
|
|
60
|
-
active: "
|
|
60
|
+
active: "hovered" | "opened" | "closing";
|
|
61
61
|
}, "opened", NonReducibleUnknown, NonReducibleUnknown, EventObject, MetaObject, {
|
|
62
62
|
readonly id: "breadcrumbs";
|
|
63
63
|
readonly context: () => {
|
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
import { DiagramView, DynamicViewDisplayVariant, WhereOperator } from '@likec4/core/types';
|
|
2
2
|
import { PropsWithChildren } from 'react';
|
|
3
|
-
import {
|
|
4
|
-
export declare function DiagramActorProvider({ view, zoomable, pannable,
|
|
3
|
+
import { ViewPaddings } from '../../LikeC4Diagram.props';
|
|
4
|
+
export declare function DiagramActorProvider({ view, zoomable, pannable, nodesDraggable, nodesSelectable, fitViewPadding, where, children, dynamicViewVariant: _defaultVariant, }: PropsWithChildren<{
|
|
5
5
|
view: DiagramView;
|
|
6
6
|
zoomable: boolean;
|
|
7
7
|
pannable: boolean;
|
|
8
|
-
|
|
8
|
+
nodesDraggable: boolean;
|
|
9
9
|
nodesSelectable: boolean;
|
|
10
|
+
fitViewPadding: ViewPaddings;
|
|
10
11
|
where: WhereOperator | null;
|
|
11
12
|
dynamicViewVariant: DynamicViewDisplayVariant | undefined;
|
|
12
13
|
}>): import("react/jsx-runtime").JSX.Element;
|
|
@@ -1,52 +1,37 @@
|
|
|
1
1
|
import { jsxs, jsx } from 'react/jsx-runtime';
|
|
2
|
-
import {
|
|
2
|
+
import { useRafEffect } from '@react-hookz/web';
|
|
3
3
|
import { useActorRef, useSelector } from '@xstate/react';
|
|
4
4
|
import { useStoreApi } from '@xyflow/react';
|
|
5
|
-
import { shallowEqual
|
|
6
|
-
import {
|
|
5
|
+
import { shallowEqual } from 'fast-equals';
|
|
6
|
+
import { useState, useEffect, memo, useRef } from 'react';
|
|
7
|
+
import { isNullish } from 'remeda';
|
|
7
8
|
import { ErrorBoundary } from '../../components/ErrorFallback.js';
|
|
8
9
|
import { useDiagramEventHandlers } from '../../context/DiagramEventHandlers.js';
|
|
9
10
|
import { useEnabledFeatures, DiagramFeatures } from '../../context/DiagramFeatures.js';
|
|
10
11
|
import { CurrentViewModelContext } from '../../context/LikeC4ModelContext.js';
|
|
11
|
-
import { DiagramActorContextProvider } from '../../hooks/safeContext.js';
|
|
12
|
-
import {
|
|
12
|
+
import { DiagramActorContextProvider, useDiagram } from '../../hooks/safeContext.js';
|
|
13
|
+
import { useOnDiagramEvent } from '../../hooks/useDiagram.js';
|
|
13
14
|
import { useLikeC4Model } from '../../hooks/useLikeC4Model.js';
|
|
14
15
|
import { useUpdateEffect } from '../../hooks/useUpdateEffect.js';
|
|
15
16
|
import { convertToXYFlow } from '../convert-to-xyflow.js';
|
|
16
|
-
import {
|
|
17
|
-
import {
|
|
17
|
+
import { makeDiagramApi } from './diagram-api.js';
|
|
18
|
+
import { diagramMachine } from './machine.js';
|
|
19
|
+
import { DiagramToggledFeaturesPersistence } from './persistence.js';
|
|
18
20
|
|
|
19
|
-
const selectDynamicViewVariant = (state) => {
|
|
20
|
-
return state.context.dynamicViewVariant;
|
|
21
|
-
};
|
|
22
21
|
function DiagramActorProvider({
|
|
23
22
|
view,
|
|
24
23
|
zoomable,
|
|
25
24
|
pannable,
|
|
26
|
-
|
|
25
|
+
nodesDraggable,
|
|
27
26
|
nodesSelectable,
|
|
27
|
+
fitViewPadding,
|
|
28
28
|
where,
|
|
29
29
|
children,
|
|
30
30
|
dynamicViewVariant: _defaultVariant
|
|
31
31
|
}) {
|
|
32
|
-
const { handlersRef } = useDiagramEventHandlers();
|
|
33
32
|
const xystore = useStoreApi();
|
|
34
|
-
const machineRef = useRef(null);
|
|
35
|
-
if (!machineRef.current) {
|
|
36
|
-
machineRef.current = diagramMachine.provide({
|
|
37
|
-
actors: {
|
|
38
|
-
syncManualLayoutActorLogic: syncManualLayoutActorLogic.provide({
|
|
39
|
-
actions: {
|
|
40
|
-
"trigger:OnChange": ((_, params) => {
|
|
41
|
-
handlersRef.current.onChange?.(params);
|
|
42
|
-
})
|
|
43
|
-
}
|
|
44
|
-
})
|
|
45
|
-
}
|
|
46
|
-
});
|
|
47
|
-
}
|
|
48
33
|
const actorRef = useActorRef(
|
|
49
|
-
|
|
34
|
+
diagramMachine,
|
|
50
35
|
{
|
|
51
36
|
id: `diagram`,
|
|
52
37
|
systemId: "diagram",
|
|
@@ -57,96 +42,136 @@ function DiagramActorProvider({
|
|
|
57
42
|
zoomable,
|
|
58
43
|
pannable,
|
|
59
44
|
fitViewPadding,
|
|
45
|
+
nodesDraggable,
|
|
60
46
|
nodesSelectable,
|
|
61
47
|
dynamicViewVariant: _defaultVariant
|
|
62
48
|
}
|
|
63
49
|
}
|
|
64
50
|
);
|
|
51
|
+
const [api, setApi] = useState(() => makeDiagramApi(actorRef));
|
|
52
|
+
useEffect(() => {
|
|
53
|
+
setApi((api2) => {
|
|
54
|
+
if (api2.actor === actorRef) return api2;
|
|
55
|
+
return makeDiagramApi(actorRef);
|
|
56
|
+
});
|
|
57
|
+
}, [actorRef]);
|
|
58
|
+
if (api.actor !== actorRef) {
|
|
59
|
+
console.warn("DiagramApi instance changed, this should not happen during the lifetime of the actor");
|
|
60
|
+
}
|
|
65
61
|
const features = useEnabledFeatures();
|
|
66
|
-
useCustomCompareEffect(
|
|
67
|
-
() => {
|
|
68
|
-
actorRef.send({ type: "update.features", features });
|
|
69
|
-
},
|
|
70
|
-
[features],
|
|
71
|
-
shallowEqual
|
|
72
|
-
);
|
|
73
62
|
useEffect(
|
|
74
|
-
() => {
|
|
75
|
-
|
|
76
|
-
},
|
|
77
|
-
[zoomable, pannable, fitViewPadding, nodesSelectable]
|
|
63
|
+
() => actorRef.send({ type: "update.features", features }),
|
|
64
|
+
[features, actorRef]
|
|
78
65
|
);
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
66
|
+
useEffect(
|
|
67
|
+
() => actorRef.send({
|
|
68
|
+
type: "update.inputs",
|
|
69
|
+
inputs: { zoomable, pannable, fitViewPadding, nodesDraggable, nodesSelectable }
|
|
70
|
+
}),
|
|
71
|
+
[zoomable, pannable, fitViewPadding, actorRef, nodesDraggable, nodesSelectable]
|
|
83
72
|
);
|
|
84
|
-
useRafEffect(() => {
|
|
85
|
-
actorRef.send({
|
|
86
|
-
type: "update.view",
|
|
87
|
-
...update
|
|
88
|
-
});
|
|
89
|
-
}, [actorRef, update]);
|
|
90
73
|
useUpdateEffect(() => {
|
|
91
74
|
if (!_defaultVariant) return;
|
|
92
75
|
actorRef.send({ type: "switch.dynamicViewVariant", variant: _defaultVariant });
|
|
93
|
-
}, [_defaultVariant]);
|
|
94
|
-
return /* @__PURE__ */ jsxs(DiagramActorContextProvider, { value:
|
|
95
|
-
/* @__PURE__ */
|
|
96
|
-
|
|
76
|
+
}, [_defaultVariant, actorRef]);
|
|
77
|
+
return /* @__PURE__ */ jsxs(DiagramActorContextProvider, { value: api, children: [
|
|
78
|
+
/* @__PURE__ */ jsxs(ErrorBoundary, { children: [
|
|
79
|
+
/* @__PURE__ */ jsx(
|
|
80
|
+
DiagramXYFlowSyncProvider,
|
|
81
|
+
{
|
|
82
|
+
view,
|
|
83
|
+
where,
|
|
84
|
+
actorRef
|
|
85
|
+
}
|
|
86
|
+
),
|
|
87
|
+
/* @__PURE__ */ jsx(CurrentViewModelProvider, { actorRef, children })
|
|
88
|
+
] }),
|
|
89
|
+
/* @__PURE__ */ jsx(DiagramActorEventListener, {})
|
|
97
90
|
] });
|
|
98
91
|
}
|
|
99
|
-
const
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
92
|
+
const selectFromActor = ({ context }) => {
|
|
93
|
+
let toggledFeatures = context.toggledFeatures;
|
|
94
|
+
const hasDrifts = context.view.drifts != null;
|
|
95
|
+
const enableCompareWithLatest = context.features.enableCompareWithLatest && (toggledFeatures.enableCompareWithLatest ?? false) && isNullish(context.activeWalkthrough) && hasDrifts;
|
|
96
|
+
const enableReadOnly = context.features.enableReadOnly || toggledFeatures.enableReadOnly || !!context.activeWalkthrough || context.dynamicViewVariant === "sequence" && context.view._type === "dynamic" || enableCompareWithLatest && context.view._layout === "auto";
|
|
97
|
+
if (toggledFeatures.enableReadOnly !== enableReadOnly || toggledFeatures.enableCompareWithLatest !== enableCompareWithLatest) {
|
|
98
|
+
toggledFeatures = {
|
|
99
|
+
...toggledFeatures,
|
|
100
|
+
enableCompareWithLatest,
|
|
101
|
+
enableReadOnly
|
|
107
102
|
};
|
|
108
103
|
}
|
|
109
104
|
return {
|
|
110
|
-
|
|
111
|
-
|
|
105
|
+
toggledFeatures,
|
|
106
|
+
viewId: context.view.id
|
|
112
107
|
};
|
|
113
108
|
};
|
|
109
|
+
const compareSelected = (a, b) => {
|
|
110
|
+
return a.viewId === b.viewId && shallowEqual(a.toggledFeatures, b.toggledFeatures);
|
|
111
|
+
};
|
|
114
112
|
function CurrentViewModelProvider({ children, actorRef }) {
|
|
115
|
-
const { viewId, toggledFeatures } = useSelector(
|
|
113
|
+
const { viewId, toggledFeatures } = useSelector(
|
|
114
|
+
actorRef,
|
|
115
|
+
selectFromActor,
|
|
116
|
+
compareSelected
|
|
117
|
+
);
|
|
118
|
+
useUpdateEffect(() => {
|
|
119
|
+
DiagramToggledFeaturesPersistence.write(toggledFeatures);
|
|
120
|
+
}, [toggledFeatures]);
|
|
116
121
|
const likec4model = useLikeC4Model();
|
|
117
122
|
const viewmodel = likec4model.findView(viewId);
|
|
118
123
|
return /* @__PURE__ */ jsx(CurrentViewModelContext.Provider, { value: viewmodel, children: /* @__PURE__ */ jsx(DiagramFeatures, { overrides: toggledFeatures, children }) });
|
|
119
124
|
}
|
|
120
|
-
|
|
125
|
+
const selectFromActor2 = (state) => {
|
|
126
|
+
return state.context.dynamicViewVariant;
|
|
127
|
+
};
|
|
128
|
+
function DiagramXYFlowSyncProvider({ view, where, actorRef }) {
|
|
129
|
+
const dynamicViewVariant = useSelector(actorRef, selectFromActor2);
|
|
130
|
+
useRafEffect(() => {
|
|
131
|
+
actorRef.send({
|
|
132
|
+
type: "update.view",
|
|
133
|
+
...convertToXYFlow({ view, where, dynamicViewVariant })
|
|
134
|
+
});
|
|
135
|
+
}, [view, where, dynamicViewVariant, actorRef]);
|
|
136
|
+
return null;
|
|
137
|
+
}
|
|
138
|
+
const DiagramActorEventListener = memo(() => {
|
|
121
139
|
const diagram = useDiagram();
|
|
122
140
|
const {
|
|
123
141
|
onNavigateTo,
|
|
124
142
|
onOpenSource,
|
|
143
|
+
onChange,
|
|
144
|
+
onLayoutTypeChange,
|
|
125
145
|
handlersRef
|
|
126
146
|
} = useDiagramEventHandlers();
|
|
127
147
|
useOnDiagramEvent("openSource", ({ params }) => onOpenSource?.(params));
|
|
128
148
|
useOnDiagramEvent("navigateTo", ({ viewId }) => onNavigateTo?.(viewId));
|
|
149
|
+
useOnDiagramEvent("onChange", ({ change }) => onChange?.({ change }));
|
|
150
|
+
useOnDiagramEvent("onLayoutTypeChange", ({ layoutType }) => {
|
|
151
|
+
onLayoutTypeChange?.(layoutType);
|
|
152
|
+
});
|
|
129
153
|
const wasEmitted = useRef(false);
|
|
130
154
|
useEffect(() => {
|
|
131
155
|
if (wasEmitted.current) return;
|
|
132
|
-
let subscription =
|
|
156
|
+
let subscription = diagram.actor.on(
|
|
133
157
|
"initialized",
|
|
134
158
|
({ instance: xyflow }) => {
|
|
135
159
|
try {
|
|
136
160
|
handlersRef.current.onInitialized?.({ diagram, xyflow });
|
|
137
161
|
} catch (error) {
|
|
138
162
|
console.error(error);
|
|
163
|
+
} finally {
|
|
164
|
+
wasEmitted.current = true;
|
|
165
|
+
subscription?.unsubscribe();
|
|
166
|
+
subscription = null;
|
|
139
167
|
}
|
|
140
|
-
wasEmitted.current = true;
|
|
141
|
-
subscription?.unsubscribe();
|
|
142
|
-
subscription = null;
|
|
143
168
|
}
|
|
144
169
|
);
|
|
145
170
|
return () => {
|
|
146
171
|
subscription?.unsubscribe();
|
|
147
172
|
};
|
|
148
|
-
}, [
|
|
173
|
+
}, [diagram]);
|
|
149
174
|
return null;
|
|
150
|
-
}
|
|
175
|
+
});
|
|
151
176
|
|
|
152
177
|
export { DiagramActorProvider };
|
|
@@ -1,17 +1,23 @@
|
|
|
1
|
+
import { LayoutedView, XYPoint } from '@likec4/core';
|
|
2
|
+
import { NodeLookup } from '@xyflow/system';
|
|
1
3
|
import { Types } from '../types';
|
|
2
|
-
import { ActionArg, Context as DiagramContext } from './
|
|
4
|
+
import { ActionArg, Context as DiagramContext } from './machine.setup';
|
|
3
5
|
export declare function lastClickedNode(params: {
|
|
4
6
|
context: DiagramContext;
|
|
5
7
|
event: {
|
|
6
8
|
node: Types.Node;
|
|
7
9
|
};
|
|
8
10
|
}): DiagramContext['lastClickedNode'];
|
|
9
|
-
export declare function mergeXYNodesEdges(
|
|
11
|
+
export declare function mergeXYNodesEdges(context: Pick<DiagramContext, 'xynodes' | 'xyedges' | 'view'>, event: {
|
|
12
|
+
view: LayoutedView;
|
|
13
|
+
xynodes: Types.Node[];
|
|
14
|
+
xyedges: Types.Edge[];
|
|
15
|
+
}): {
|
|
16
|
+
xynodes: Types.Node[];
|
|
17
|
+
xyedges: Types.Edge[];
|
|
18
|
+
view: LayoutedView;
|
|
19
|
+
};
|
|
10
20
|
export declare function focusNodesEdges(params: ActionArg): Partial<DiagramContext>;
|
|
11
|
-
export declare function updateNavigationHistory({ context, event }: ActionArg): Partial<DiagramContext>;
|
|
12
|
-
export declare function navigateBack({ context }: ActionArg): Partial<DiagramContext>;
|
|
13
|
-
export declare function navigateForward({ context }: ActionArg): Partial<DiagramContext>;
|
|
14
21
|
export declare function updateNodeData({ context, event }: ActionArg): Partial<DiagramContext>;
|
|
15
22
|
export declare function updateEdgeData({ context, event }: ActionArg): Partial<DiagramContext>;
|
|
16
|
-
export declare function resetEdgeControlPoints(
|
|
17
|
-
export declare function updateActiveWalkthrough({ context }: ActionArg): Partial<DiagramContext>;
|
|
23
|
+
export declare function resetEdgeControlPoints(nodeLookup: NodeLookup, edge: Types.Edge): [XYPoint] | [XYPoint, XYPoint];
|