@likec4/diagram 1.30.0 → 1.32.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/README.md +324 -5
- package/bundle/chunk-BvTQaUYl.js +21851 -0
- package/bundle/custom.js +65 -0
- package/bundle/index.js +19910 -40570
- package/dist/LikeC4CustomColors.d.ts +2 -7
- package/dist/LikeC4CustomColors.js +17 -6
- package/dist/LikeC4Diagram.d.ts +3 -2
- package/dist/LikeC4Diagram.js +14 -16
- package/dist/LikeC4Diagram.props.d.ts +34 -23
- package/dist/LikeC4ModelProvider.d.ts +5 -4
- package/dist/LikeC4ModelProvider.js +0 -1
- package/dist/StaticLikeC4Diagram.d.ts +3 -2
- package/dist/StaticLikeC4Diagram.js +2 -2
- package/dist/base/BaseXYFlow.js +8 -8
- package/dist/base/const.d.ts +1 -1
- package/dist/base/const.js +1 -1
- package/dist/base/index.d.ts +2 -1
- package/dist/base/primitives/compound/CompoundActionButton.d.ts +3 -2
- package/dist/base/primitives/compound/CompoundActionButton.js +2 -1
- package/dist/base/primitives/compound/CompoundDetailsButton.d.ts +3 -2
- package/dist/base/primitives/compound/CompoundDetailsButton.js +2 -1
- package/dist/base/primitives/compound/CompoundNodeContainer.d.ts +7 -3
- package/dist/base/primitives/compound/CompoundNodeContainer.js +3 -2
- package/dist/base/primitives/compound/CompoundTitle.d.ts +1 -1
- package/dist/base/primitives/compound/CompoundTitle.js +2 -1
- package/dist/base/primitives/customEdge.d.ts +2 -35
- package/dist/base/primitives/customEdge.js +2 -2
- package/dist/base/primitives/customNode.d.ts +2 -2
- package/dist/base/primitives/customNode.js +9 -2
- package/dist/base/primitives/edge/EdgeContainer.d.ts +1 -1
- package/dist/base/primitives/edge/EdgeContainer.js +0 -1
- package/dist/base/primitives/edge/EdgeLabel.css.js +1 -0
- package/dist/base/primitives/edge/EdgeLabel.d.ts +3 -3
- package/dist/base/primitives/edge/EdgeLabel.js +6 -5
- package/dist/base/primitives/edge/EdgeLabelContainer.d.ts +1 -1
- package/dist/base/primitives/edge/EdgeLabelContainer.js +0 -2
- package/dist/base/primitives/edge/EdgeMarkers.d.ts +1 -1
- package/dist/base/primitives/edge/EdgePath.d.ts +1 -1
- package/dist/base/primitives/edge/EdgePath.js +2 -2
- package/dist/base/primitives/element/ElementActionButtons.js +10 -9
- package/dist/base/primitives/element/ElementDetailsButton.js +2 -1
- package/dist/base/primitives/element/ElementNodeContainer.d.ts +24 -22
- package/dist/base/primitives/element/ElementNodeContainer.js +66 -68
- package/dist/base/primitives/element/ElementShape.d.ts +8 -4
- package/dist/base/primitives/element/ElementShape.js +4 -3
- package/dist/base/primitives/element/ElementTags.d.ts +14 -0
- package/dist/base/primitives/element/ElementTags.js +176 -0
- package/dist/base/primitives/element/ElementTitle.css.d.ts +1 -1
- package/dist/base/primitives/element/ElementTitle.d.ts +5 -4
- package/dist/base/primitives/element/ElementTitle.js +6 -7
- package/dist/base/primitives/index.d.ts +1 -0
- package/dist/base/types.Base.d.ts +54 -0
- package/dist/base/types.Base.js +48 -0
- package/dist/base/types.d.ts +3 -53
- package/dist/bundle/LikeC4View.d.ts +2 -1
- package/dist/bundle/LikeC4View.js +13 -8
- package/dist/bundle/LikeC4View.props.d.ts +20 -5
- package/dist/bundle/ReactLikeC4.d.ts +4 -7
- package/dist/bundle/ReactLikeC4.js +4 -4
- package/dist/bundle/ShadowRoot.js +3 -3
- package/dist/bundle/custom.d.ts +1 -0
- package/dist/bundle/index.d.ts +3 -1
- package/dist/bundle/index.js +9 -0
- package/dist/bundle/styles.css.js +5 -5
- package/dist/components/ErrorFallback.d.ts +2 -0
- package/dist/components/ErrorFallback.js +29 -0
- package/dist/components/SearchControl.js +2 -2
- package/dist/context/ControlsCustomLayout.js +0 -1
- package/dist/context/DiagramEventHandlers.d.ts +6 -5
- package/dist/context/DiagramEventHandlers.js +5 -5
- package/dist/context/DiagramFeatures.d.ts +3 -5
- package/dist/context/DiagramFeatures.js +11 -40
- package/dist/context/EnsureMantine.js +9 -4
- package/dist/context/FramerMotionConfig.js +0 -1
- package/dist/context/IconRenderer.js +8 -11
- package/dist/context/ReduceGraphics.js +6 -6
- package/dist/context/RootContainer.js +10 -6
- package/dist/context/TagStylesContext.d.ts +7 -0
- package/dist/context/TagStylesContext.js +85 -0
- package/dist/context/index.d.ts +1 -1
- package/dist/custom/components.d.ts +5 -0
- package/dist/custom/customNodes.d.ts +228 -0
- package/dist/custom/hooks.d.ts +10 -0
- package/dist/custom/index.d.ts +4 -0
- package/dist/hooks/index.d.ts +1 -1
- package/dist/hooks/safeContext.js +3 -3
- package/dist/hooks/useCurrentViewId.d.ts +5 -1
- package/dist/hooks/useCurrentViewId.js +1 -2
- package/dist/hooks/useDiagram.d.ts +77 -12572
- package/dist/hooks/useDiagram.js +9 -7
- package/dist/hooks/useMantinePortalProps.d.ts +2 -2
- package/dist/hooks/useMantinePortalProps.js +2 -2
- package/dist/hooks/useSearchActor.d.ts +2 -0
- package/dist/hooks/useSearchActor.js +10 -0
- package/dist/hooks/useSetState.js +3 -3
- package/dist/hooks/useUpdateEffect.js +3 -1
- package/dist/hooks/useXYFlow.d.ts +75 -73
- package/dist/hooks/useXYFlow.js +7 -3
- package/dist/index.d.ts +2 -4
- package/dist/index.js +8 -3
- package/dist/likec4diagram/DiagramUI.js +9 -4
- package/dist/likec4diagram/DiagramXYFlow.d.ts +4 -3
- package/dist/likec4diagram/DiagramXYFlow.js +124 -109
- package/dist/likec4diagram/custom/edges/NotePopover.js +2 -2
- package/dist/likec4diagram/custom/edges/RelationshipEdge.d.ts +12 -15
- package/dist/likec4diagram/custom/edges/RelationshipEdge.js +16 -8
- package/dist/likec4diagram/custom/edges/RelationshipsDropdownMenu.js +19 -15
- package/dist/likec4diagram/custom/index.d.ts +18 -21
- package/dist/likec4diagram/custom/index.js +3 -3
- package/dist/likec4diagram/custom/nodes/CompoundActions.js +2 -2
- package/dist/likec4diagram/custom/nodes/ElementActions.d.ts +27 -4
- package/dist/likec4diagram/custom/nodes/ElementActions.js +67 -53
- package/dist/likec4diagram/custom/nodes/index.d.ts +8 -0
- package/dist/likec4diagram/custom/nodes/nodes.d.ts +10 -0
- package/dist/likec4diagram/custom/nodes/nodes.js +105 -0
- package/dist/likec4diagram/custom/nodes/toolbar/ColorButton.js +2 -2
- package/dist/likec4diagram/custom/nodes/toolbar/CompoundToolbar.js +6 -7
- package/dist/likec4diagram/custom/nodes/toolbar/ElementToolbar.js +3 -3
- package/dist/likec4diagram/custom/nodes/toolbar/Toolbar.d.ts +3 -2
- package/dist/likec4diagram/custom/nodes/toolbar/Toolbar.js +2 -2
- package/dist/likec4diagram/custom/nodes/toolbar/_shared.d.ts +5 -5
- package/dist/likec4diagram/custom/nodes/toolbar/_shared.js +2 -2
- package/dist/likec4diagram/types.d.ts +18 -10
- package/dist/likec4diagram/ui/controls/ChangeAutoLayoutButton.js +4 -4
- package/dist/likec4diagram/ui/controls/Controls.js +14 -6
- package/dist/likec4diagram/ui/diagram-title/DiagramTitlePanel.js +2 -2
- package/dist/likec4diagram/ui/notation/NotationPanel.js +7 -9
- package/dist/likec4diagram/ui/walkthrough/DynamicViewWalkthrough.js +4 -4
- package/dist/likec4diagram/useLayoutConstraints.js +3 -4
- package/dist/likec4diagram/useViewToNodesEdges.d.ts +5 -3
- package/dist/likec4diagram/useViewToNodesEdges.js +22 -30
- package/dist/likec4model/LikeC4ModelContext.d.ts +2 -2
- package/dist/likec4model/LikeC4ModelContext.js +2 -2
- package/dist/likec4model/useLikeC4ElementsTree.d.ts +1 -1
- package/dist/likec4model/useLikeC4ElementsTree.js +4 -4
- package/dist/likec4model/useLikeC4Model.d.ts +22 -10
- package/dist/likec4model/useLikeC4Model.js +13 -9
- package/dist/overlays/Overlays.d.ts +2 -3
- package/dist/overlays/Overlays.js +9 -33
- package/dist/overlays/element-details/ElementDetailsCard.css.js +13 -9
- package/dist/overlays/element-details/ElementDetailsCard.d.ts +1 -1
- package/dist/overlays/element-details/ElementDetailsCard.js +110 -110
- package/dist/overlays/element-details/TabPanelDeployments.d.ts +1 -1
- package/dist/overlays/element-details/TabPanelDeployments.js +5 -5
- package/dist/overlays/element-details/TabPanelRelationships.d.ts +1 -1
- package/dist/overlays/element-details/TabPanelRelationships.js +2 -2
- package/dist/overlays/element-details/TabPanelStructure.d.ts +1 -1
- package/dist/overlays/element-details/TabPanelStructure.js +3 -3
- package/dist/overlays/element-details/actor.d.ts +5482 -18265
- package/dist/overlays/element-details/actor.js +0 -2
- package/dist/overlays/element-details/actorContext.js +3 -3
- package/dist/overlays/overlay/Overlay.css.d.ts +57 -2
- package/dist/overlays/overlay/Overlay.css.js +76 -39
- package/dist/overlays/overlay/Overlay.d.ts +23 -1
- package/dist/overlays/overlay/Overlay.js +40 -29
- package/dist/overlays/overlaysActor.d.ts +5 -3
- package/dist/overlays/overlaysActor.js +2 -1
- package/dist/overlays/relationship-details/RelationshipDetails.d.ts +6 -9
- package/dist/overlays/relationship-details/RelationshipDetails.js +15 -15
- package/dist/overlays/relationship-details/SelectEdge.js +2 -3
- package/dist/overlays/relationship-details/_types.d.ts +7 -6
- package/dist/overlays/relationship-details/actor.d.ts +3 -3
- package/dist/overlays/relationship-details/actor.js +7 -7
- package/dist/overlays/relationship-details/compute.js +3 -3
- package/dist/overlays/relationship-details/custom/edgeTypes.d.ts +6 -9
- package/dist/overlays/relationship-details/custom/edgeTypes.js +2 -2
- package/dist/overlays/relationship-details/custom/nodeTypes.d.ts +3 -31
- package/dist/overlays/relationship-details/custom/nodeTypes.js +4 -0
- package/dist/overlays/relationship-details/hooks.d.ts +28 -27
- package/dist/overlays/relationship-details/hooks.js +4 -4
- package/dist/overlays/relationship-details/layout-to-xyflow.js +1 -0
- package/dist/overlays/relationship-details/layout.js +5 -4
- package/dist/overlays/relationships-browser/RelationshipsBrowser.d.ts +6 -9
- package/dist/overlays/relationships-browser/RelationshipsBrowser.js +8 -8
- package/dist/overlays/relationships-browser/SelectElement.js +6 -6
- package/dist/overlays/relationships-browser/_types.d.ts +7 -6
- package/dist/overlays/relationships-browser/actor.d.ts +64 -429
- package/dist/overlays/relationships-browser/actor.js +7 -7
- package/dist/overlays/relationships-browser/custom/edgeTypes.d.ts +6 -9
- package/dist/overlays/relationships-browser/custom/edgeTypes.js +2 -2
- package/dist/overlays/relationships-browser/custom/nodeTypes.d.ts +17 -18
- package/dist/overlays/relationships-browser/custom/nodeTypes.js +5 -2
- package/dist/overlays/relationships-browser/hooks.d.ts +4 -61
- package/dist/overlays/relationships-browser/hooks.js +4 -4
- package/dist/overlays/relationships-browser/layout.d.ts +2 -2
- package/dist/overlays/relationships-browser/layout.js +13 -10
- package/dist/overlays/relationships-browser/useViewToNodesEdges.js +4 -3
- package/dist/search/Search.d.ts +5 -0
- package/dist/search/Search.js +192 -0
- package/dist/{likec4diagram/ui/search → search/components}/ElementsColumn.css.js +0 -1
- package/dist/search/components/ElementsColumn.d.ts +2 -0
- package/dist/{likec4diagram/ui/search → search/components}/ElementsColumn.js +26 -25
- package/dist/search/components/PickView.d.ts +4 -0
- package/dist/search/components/PickView.js +135 -0
- package/dist/search/components/SearchByTags.d.ts +1 -0
- package/dist/search/components/SearchByTags.js +116 -0
- package/dist/search/components/SearchInput.d.ts +2 -0
- package/dist/{likec4diagram/ui/search → search/components}/SearchInput.js +53 -35
- package/dist/{likec4diagram/ui/search → search/components}/ViewsColum.d.ts +3 -2
- package/dist/{likec4diagram/ui/search → search/components}/ViewsColum.js +14 -13
- package/dist/search/components/_shared.css.d.ts +4 -0
- package/dist/{likec4diagram/ui/search → search/components}/_shared.css.js +26 -35
- package/dist/{likec4diagram/ui/search/LikeC4Search.css.d.ts → search/components/styles.css.d.ts} +0 -2
- package/dist/search/components/styles.css.js +60 -0
- package/dist/{likec4diagram/ui/search → search/components}/utils.d.ts +1 -0
- package/dist/{likec4diagram/ui/search → search/components}/utils.js +7 -1
- package/dist/search/hooks.d.ts +16 -0
- package/dist/search/hooks.js +35 -0
- package/dist/search/searchActor.d.ts +90 -0
- package/dist/search/searchActor.js +75 -0
- package/dist/state/DiagramActorProvider.d.ts +9 -7
- package/dist/state/DiagramActorProvider.js +24 -18
- package/dist/state/assign.d.ts +0 -1
- package/dist/state/assign.js +9 -19
- package/dist/state/diagram-machine.d.ts +749 -10678
- package/dist/state/diagram-machine.js +121 -55
- package/dist/state/hotkeyActor.d.ts +4 -2
- package/dist/state/syncManualLayoutActor.d.ts +15 -4
- package/dist/state/syncManualLayoutActor.js +2 -1
- package/dist/state/types.d.ts +7 -4
- package/dist/state/utils.d.ts +3 -1
- package/dist/state/utils.js +3 -0
- package/dist/styles-font.css +1 -0
- package/dist/styles-min.css +1 -0
- package/dist/styles-xyflow.css +1 -0
- package/dist/styles.css +1 -0
- package/dist/styles.css2.js +3 -0
- package/package.json +50 -25
- package/panda.buildinfo.json +1002 -0
- package/src/LikeC4CustomColors.tsx +21 -6
- package/src/LikeC4Diagram.props.ts +42 -31
- package/src/LikeC4Diagram.tsx +21 -20
- package/src/LikeC4ModelProvider.tsx +7 -6
- package/src/StaticLikeC4Diagram.tsx +9 -6
- package/src/base/Background.tsx +0 -4
- package/src/base/const.ts +1 -1
- package/src/base/index.ts +2 -1
- package/src/base/primitives/compound/CompoundActionButton.tsx +9 -5
- package/src/base/primitives/compound/CompoundDetailsButton.tsx +9 -5
- package/src/base/primitives/compound/CompoundNodeContainer.tsx +8 -7
- package/src/base/primitives/compound/CompoundTitle.tsx +3 -2
- package/src/base/primitives/customEdge.ts +1 -1
- package/src/base/primitives/{customNode.ts → customNode.tsx} +11 -3
- package/src/base/primitives/edge/EdgeContainer.tsx +2 -1
- package/src/base/primitives/edge/EdgeLabel.css.ts +1 -0
- package/src/base/primitives/edge/EdgeLabel.tsx +20 -15
- package/src/base/primitives/edge/EdgeLabelContainer.tsx +1 -1
- package/src/base/primitives/edge/EdgeMarkers.tsx +2 -1
- package/src/base/primitives/edge/EdgePath.tsx +1 -1
- package/src/base/primitives/element/ElementActionButtons.tsx +11 -10
- package/src/base/primitives/element/ElementDetailsButton.tsx +2 -1
- package/src/base/primitives/element/ElementNodeContainer.tsx +87 -80
- package/src/base/primitives/element/ElementShape.tsx +12 -10
- package/src/base/primitives/element/ElementTags.tsx +182 -0
- package/src/base/primitives/element/ElementTitle.tsx +21 -15
- package/src/base/primitives/index.ts +1 -0
- package/src/base/types.Base.ts +104 -0
- package/src/base/types.ts +4 -106
- package/src/bundle/LikeC4View.props.ts +23 -5
- package/src/bundle/LikeC4View.tsx +20 -19
- package/src/bundle/ReactLikeC4.tsx +15 -27
- package/src/bundle/custom.ts +1 -0
- package/src/bundle/index.ts +20 -1
- package/src/bundle/styles.css.ts +1 -1
- package/src/components/ErrorFallback.tsx +30 -0
- package/src/components/SearchControl.tsx +1 -1
- package/src/context/DiagramEventHandlers.tsx +5 -4
- package/src/context/DiagramFeatures.tsx +15 -30
- package/src/context/EnsureMantine.tsx +13 -3
- package/src/context/IconRenderer.tsx +2 -5
- package/src/context/ReduceGraphics.tsx +6 -6
- package/src/context/RootContainer.tsx +9 -3
- package/src/context/TagStylesContext.tsx +96 -0
- package/src/context/index.ts +0 -1
- package/src/custom/components.ts +49 -0
- package/src/custom/customNodes.tsx +254 -0
- package/src/custom/hooks.ts +36 -0
- package/src/custom/index.ts +5 -0
- package/src/hooks/index.ts +1 -1
- package/src/hooks/useCurrentViewId.ts +6 -1
- package/src/hooks/useDiagram.ts +131 -18
- package/src/hooks/useMantinePortalProps.ts +10 -1
- package/src/hooks/useSearchActor.ts +11 -0
- package/src/hooks/useUpdateEffect.ts +7 -4
- package/src/hooks/useXYFlow.ts +5 -0
- package/src/index.ts +4 -8
- package/src/likec4diagram/DiagramUI.tsx +5 -0
- package/src/likec4diagram/DiagramXYFlow.tsx +135 -115
- package/src/likec4diagram/custom/edges/RelationshipEdge.tsx +10 -1
- package/src/likec4diagram/custom/edges/RelationshipsDropdownMenu.tsx +17 -14
- package/src/likec4diagram/custom/{index.tsx → index.ts} +2 -2
- package/src/likec4diagram/custom/nodes/CompoundActions.tsx +2 -2
- package/src/likec4diagram/custom/nodes/ElementActions.tsx +100 -57
- package/src/likec4diagram/custom/nodes/index.ts +17 -0
- package/src/likec4diagram/custom/nodes/nodes.tsx +127 -0
- package/src/likec4diagram/custom/nodes/toolbar/CompoundToolbar.tsx +3 -4
- package/src/likec4diagram/custom/nodes/toolbar/ElementToolbar.tsx +3 -3
- package/src/likec4diagram/custom/nodes/toolbar/Toolbar.tsx +5 -4
- package/src/likec4diagram/custom/nodes/toolbar/_shared.tsx +11 -3
- package/src/likec4diagram/types.ts +24 -12
- package/src/likec4diagram/ui/controls/Controls.tsx +11 -4
- package/src/likec4diagram/ui/diagram-title/DiagramTitlePanel.tsx +1 -1
- package/src/likec4diagram/ui/notation/NotationPanel.tsx +3 -4
- package/src/likec4diagram/ui/walkthrough/DynamicViewWalkthrough.tsx +1 -1
- package/src/likec4diagram/useViewToNodesEdges.ts +36 -36
- package/src/likec4model/LikeC4ModelContext.ts +2 -2
- package/src/likec4model/useLikeC4ElementsTree.ts +4 -2
- package/src/likec4model/useLikeC4Model.ts +18 -16
- package/src/overlays/Overlays.tsx +7 -35
- package/src/overlays/element-details/ElementDetailsCard.css.ts +14 -22
- package/src/overlays/element-details/ElementDetailsCard.tsx +43 -34
- package/src/overlays/element-details/TabPanelDeployments.tsx +3 -2
- package/src/overlays/element-details/TabPanelRelationships.tsx +2 -1
- package/src/overlays/element-details/TabPanelStructure.tsx +1 -1
- package/src/overlays/element-details/actor.ts +2 -2
- package/src/overlays/overlay/Overlay.css.ts +75 -38
- package/src/overlays/overlay/Overlay.tsx +45 -29
- package/src/overlays/overlaysActor.ts +5 -4
- package/src/overlays/relationship-details/RelationshipDetails.tsx +5 -5
- package/src/overlays/relationship-details/SelectEdge.tsx +0 -2
- package/src/overlays/relationship-details/_types.ts +18 -14
- package/src/overlays/relationship-details/custom/edgeTypes.tsx +2 -2
- package/src/overlays/relationship-details/custom/nodeTypes.tsx +4 -0
- package/src/overlays/relationship-details/layout-to-xyflow.ts +1 -0
- package/src/overlays/relationship-details/layout.ts +3 -1
- package/src/overlays/relationships-browser/SelectElement.tsx +1 -1
- package/src/overlays/relationships-browser/_types.ts +20 -16
- package/src/overlays/relationships-browser/actor.ts +2 -2
- package/src/overlays/relationships-browser/custom/edgeTypes.tsx +2 -2
- package/src/overlays/relationships-browser/custom/nodeTypes.tsx +5 -2
- package/src/overlays/relationships-browser/layout.ts +12 -7
- package/src/overlays/relationships-browser/useViewToNodesEdges.ts +4 -4
- package/src/search/Search.tsx +237 -0
- package/src/{likec4diagram/ui/search → search/components}/ElementsColumn.css.ts +0 -29
- package/src/{likec4diagram/ui/search → search/components}/ElementsColumn.tsx +25 -25
- package/src/search/components/PickView.tsx +140 -0
- package/src/search/components/SearchByTags.tsx +109 -0
- package/src/{likec4diagram/ui/search → search/components}/SearchInput.tsx +63 -36
- package/src/{likec4diagram/ui/search → search/components}/ViewsColum.tsx +17 -18
- package/src/{likec4diagram/ui/search → search/components}/_shared.css.ts +26 -37
- package/src/{likec4diagram/ui/search/LikeC4Search.css.ts → search/components/styles.css.ts} +9 -36
- package/src/{likec4diagram/ui/search → search/components}/utils.ts +7 -0
- package/src/search/hooks.ts +41 -0
- package/src/search/searchActor.ts +99 -0
- package/src/state/DiagramActorProvider.tsx +36 -25
- package/src/state/assign.ts +10 -10
- package/src/state/diagram-machine.ts +128 -60
- package/src/state/hotkeyActor.ts +4 -2
- package/src/state/syncManualLayoutActor.ts +10 -4
- package/src/state/types.ts +11 -3
- package/src/state/utils.ts +7 -3
- package/src/styles-min.css +2 -0
- package/src/styles-xyflow.css +1 -0
- package/dist/_virtual/_commonjsHelpers.js +0 -5
- package/dist/_virtual/default-map.js +0 -7
- package/dist/_virtual/index.js +0 -5
- package/dist/_virtual/index2.js +0 -3
- package/dist/_virtual/react.production.js +0 -3
- package/dist/_virtual/set.js +0 -5
- package/dist/_virtual/set2.js +0 -3
- package/dist/base/types.js +0 -54
- package/dist/base/xyflowMachine.d.ts +0 -212
- package/dist/likec4diagram/custom/nodes/nodeTypes.d.ts +0 -8
- package/dist/likec4diagram/custom/nodes/nodeTypes.js +0 -92
- package/dist/likec4diagram/ui/search/ElementsColumn.d.ts +0 -1
- package/dist/likec4diagram/ui/search/LikeC4Search.css.js +0 -87
- package/dist/likec4diagram/ui/search/LikeC4Search.d.ts +0 -2
- package/dist/likec4diagram/ui/search/LikeC4Search.js +0 -267
- package/dist/likec4diagram/ui/search/SearchInput.d.ts +0 -1
- package/dist/likec4diagram/ui/search/_shared.css.d.ts +0 -4
- package/dist/likec4diagram/ui/search/state.d.ts +0 -19
- package/dist/likec4diagram/ui/search/state.js +0 -64
- package/dist/node_modules/.pnpm/mnemonist@0.40.3_patch_hash_5c12abb43fcff6fd81e53021b89075d53249640d165a2556cc1e58d71201a13a/node_modules/mnemonist/default-map.js +0 -172
- package/dist/node_modules/.pnpm/mnemonist@0.40.3_patch_hash_5c12abb43fcff6fd81e53021b89075d53249640d165a2556cc1e58d71201a13a/node_modules/mnemonist/set.js +0 -369
- package/dist/node_modules/.pnpm/react@19.1.0/node_modules/react/cjs/react.production.js +0 -556
- package/dist/node_modules/.pnpm/react@19.1.0/node_modules/react/index.js +0 -15
- package/dist/packages/core/src/compute-view/relationships-view/compute.js +0 -123
- package/dist/packages/core/src/compute-view/relationships-view/utils.js +0 -68
- package/dist/packages/core/src/errors/index.js +0 -15
- package/dist/packages/core/src/model/connection/model/ConnectionModel.js +0 -121
- package/dist/packages/core/src/model/connection/model/find.js +0 -39
- package/dist/packages/core/src/model/connection/ops.js +0 -7
- package/dist/packages/core/src/utils/const.js +0 -3
- package/dist/packages/core/src/utils/fqn.js +0 -51
- package/dist/packages/core/src/utils/guards.js +0 -7
- package/dist/packages/core/src/utils/iterable/filter.js +0 -21
- package/dist/packages/core/src/utils/iterable/find.js +0 -21
- package/dist/packages/core/src/utils/iterable/map.js +0 -18
- package/dist/packages/core/src/utils/iterable/some.js +0 -21
- package/dist/packages/core/src/utils/iterable/to.js +0 -14
- package/dist/packages/core/src/utils/set.js +0 -48
- package/dist/packages/core/src/utils/string-hash.js +0 -13
- package/dist/styles.css.js +0 -3
- package/src/base/xyflowMachine.ts +0 -75
- package/src/likec4diagram/custom/nodes/nodeTypes.tsx +0 -109
- package/src/likec4diagram/ui/search/LikeC4Search.tsx +0 -301
- package/src/likec4diagram/ui/search/state.ts +0 -78
- /package/dist/{likec4diagram/ui/search → search/components}/ElementsColumn.css.d.ts +0 -0
- /package/dist/{likec4diagram/ui/search → search/components}/ViewsColumn.css.d.ts +0 -0
- /package/dist/{likec4diagram/ui/search → search/components}/ViewsColumn.css.js +0 -0
- /package/dist/{bundle/font.css.js → styles-font.css2.js} +0 -0
- /package/src/{likec4diagram/ui/search → search/components}/ViewsColumn.css.ts +0 -0
- /package/src/{bundle/font.css → styles-font.css} +0 -0
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { jsx, Fragment } from 'react/jsx-runtime';
|
|
2
2
|
import { shallowEqual } from 'fast-equals';
|
|
3
|
-
import {
|
|
4
|
-
import { mapToObj
|
|
3
|
+
import { useContext, createContext, useState, useEffect } from 'react';
|
|
4
|
+
import { mapToObj } from 'remeda';
|
|
5
5
|
|
|
6
6
|
const FeatureNames = [
|
|
7
7
|
"Controls",
|
|
@@ -18,47 +18,28 @@ const FeatureNames = [
|
|
|
18
18
|
"EdgeEditing",
|
|
19
19
|
"ViewTitle",
|
|
20
20
|
"FitView",
|
|
21
|
-
/**
|
|
22
|
-
* LikeC4Model is available in context
|
|
23
|
-
*/
|
|
24
|
-
"LikeC4Model",
|
|
25
21
|
/**
|
|
26
22
|
* Running in VSCode
|
|
27
23
|
*/
|
|
28
|
-
"Vscode"
|
|
24
|
+
"Vscode",
|
|
25
|
+
"ElementTags"
|
|
29
26
|
];
|
|
30
27
|
const AllDisabled = mapToObj(
|
|
31
28
|
FeatureNames,
|
|
32
29
|
(name) => [`enable${name}`, false]
|
|
33
30
|
);
|
|
34
|
-
const DiagramFeaturesContext =
|
|
31
|
+
const DiagramFeaturesContext = createContext(AllDisabled);
|
|
35
32
|
const validate = (features) => {
|
|
36
33
|
let {
|
|
37
34
|
enableReadOnly,
|
|
38
|
-
enableLikeC4Model,
|
|
39
|
-
enableElementDetails,
|
|
40
|
-
enableRelationshipDetails,
|
|
41
|
-
enableRelationshipBrowser,
|
|
42
|
-
enableSearch,
|
|
43
35
|
enableEdgeEditing,
|
|
44
36
|
...rest
|
|
45
37
|
} = features;
|
|
46
|
-
if (!enableLikeC4Model) {
|
|
47
|
-
enableElementDetails = false;
|
|
48
|
-
enableRelationshipDetails = false;
|
|
49
|
-
enableRelationshipBrowser = false;
|
|
50
|
-
enableSearch = false;
|
|
51
|
-
}
|
|
52
38
|
if (enableReadOnly) {
|
|
53
39
|
enableEdgeEditing = false;
|
|
54
40
|
}
|
|
55
41
|
return {
|
|
56
42
|
enableReadOnly,
|
|
57
|
-
enableLikeC4Model,
|
|
58
|
-
enableElementDetails,
|
|
59
|
-
enableRelationshipDetails,
|
|
60
|
-
enableRelationshipBrowser,
|
|
61
|
-
enableSearch,
|
|
62
43
|
enableEdgeEditing,
|
|
63
44
|
...rest
|
|
64
45
|
};
|
|
@@ -68,9 +49,9 @@ function DiagramFeatures({
|
|
|
68
49
|
features,
|
|
69
50
|
overrides
|
|
70
51
|
}) {
|
|
71
|
-
const outerScope =
|
|
72
|
-
const [scope, setScope] =
|
|
73
|
-
|
|
52
|
+
const outerScope = useContext(DiagramFeaturesContext);
|
|
53
|
+
const [scope, setScope] = useState(outerScope);
|
|
54
|
+
useEffect(
|
|
74
55
|
() => {
|
|
75
56
|
setScope((current) => {
|
|
76
57
|
const next = validate({
|
|
@@ -98,26 +79,16 @@ DiagramFeatures.Overlays = ({ children }) => {
|
|
|
98
79
|
}
|
|
99
80
|
);
|
|
100
81
|
};
|
|
101
|
-
function useEnabledFeature(...names) {
|
|
102
|
-
return pick(reactExports.useContext(DiagramFeaturesContext), map(names, (name) => `enable${name}`));
|
|
103
|
-
}
|
|
104
82
|
function useEnabledFeatures() {
|
|
105
|
-
return
|
|
83
|
+
return useContext(DiagramFeaturesContext);
|
|
106
84
|
}
|
|
107
85
|
function IfEnabled({
|
|
108
86
|
feature,
|
|
109
87
|
children,
|
|
110
88
|
and = true
|
|
111
89
|
}) {
|
|
112
|
-
const enabled =
|
|
90
|
+
const enabled = useEnabledFeatures()[`enable${feature}`] === true;
|
|
113
91
|
return enabled && and ? /* @__PURE__ */ jsx(Fragment, { children }) : null;
|
|
114
92
|
}
|
|
115
|
-
function IfNotEnabled({
|
|
116
|
-
feature,
|
|
117
|
-
children
|
|
118
|
-
}) {
|
|
119
|
-
const notEnabled = useEnabledFeature(feature)[`enable${feature}`] !== true;
|
|
120
|
-
return notEnabled ? /* @__PURE__ */ jsx(Fragment, { children }) : null;
|
|
121
|
-
}
|
|
122
93
|
|
|
123
|
-
export { AllDisabled, DiagramFeatures, IfEnabled,
|
|
94
|
+
export { AllDisabled, DiagramFeatures, IfEnabled, useEnabledFeatures };
|
|
@@ -1,11 +1,16 @@
|
|
|
1
1
|
import { jsx, Fragment } from 'react/jsx-runtime';
|
|
2
|
-
import { MantineContext } from '@mantine/core';
|
|
3
|
-
import {
|
|
2
|
+
import { MantineContext, MantineProvider } from '@mantine/core';
|
|
3
|
+
import { useContext, useEffect } from 'react';
|
|
4
4
|
|
|
5
5
|
function EnsureMantine({ children }) {
|
|
6
|
-
const mantineCtx =
|
|
6
|
+
const mantineCtx = useContext(MantineContext);
|
|
7
|
+
useEffect(() => {
|
|
8
|
+
if (!mantineCtx) {
|
|
9
|
+
console.warn("LikeC4Diagram must be a child of MantineProvider");
|
|
10
|
+
}
|
|
11
|
+
}, []);
|
|
7
12
|
if (!mantineCtx) {
|
|
8
|
-
|
|
13
|
+
return /* @__PURE__ */ jsx(MantineProvider, { defaultColorScheme: "auto", children });
|
|
9
14
|
}
|
|
10
15
|
return /* @__PURE__ */ jsx(Fragment, { children });
|
|
11
16
|
}
|
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
import { jsx, Fragment } from 'react/jsx-runtime';
|
|
2
|
+
import { cx } from '@likec4/styles/css';
|
|
2
3
|
import { IconCylinder, IconRectangularPrism, IconReorder, IconUser, IconDeviceMobile, IconBrowser } from '@tabler/icons-react';
|
|
3
|
-
import
|
|
4
|
-
import { r as reactExports } from '../_virtual/index.js';
|
|
4
|
+
import { useContext, createContext } from 'react';
|
|
5
5
|
|
|
6
|
-
const IconRendererContext =
|
|
6
|
+
const IconRendererContext = createContext(null);
|
|
7
7
|
function IconRendererProvider({
|
|
8
8
|
value,
|
|
9
9
|
children
|
|
10
10
|
}) {
|
|
11
|
-
const outerScope =
|
|
11
|
+
const outerScope = useContext(IconRendererContext);
|
|
12
12
|
if (outerScope) {
|
|
13
13
|
return /* @__PURE__ */ jsx(Fragment, { children });
|
|
14
14
|
}
|
|
@@ -18,7 +18,7 @@ function IconRenderer({
|
|
|
18
18
|
element,
|
|
19
19
|
className
|
|
20
20
|
}) {
|
|
21
|
-
const RenderIcon =
|
|
21
|
+
const RenderIcon = useContext(IconRendererContext);
|
|
22
22
|
if (!element || !element.icon || element.icon === "none") {
|
|
23
23
|
return null;
|
|
24
24
|
}
|
|
@@ -34,7 +34,7 @@ function IconRenderer({
|
|
|
34
34
|
return /* @__PURE__ */ jsx(
|
|
35
35
|
"div",
|
|
36
36
|
{
|
|
37
|
-
className:
|
|
37
|
+
className: cx(
|
|
38
38
|
className,
|
|
39
39
|
"likec4-element-icon"
|
|
40
40
|
),
|
|
@@ -56,10 +56,7 @@ function IconOrShapeRenderer({
|
|
|
56
56
|
element,
|
|
57
57
|
className
|
|
58
58
|
}) {
|
|
59
|
-
const icon = IconRenderer
|
|
60
|
-
element,
|
|
61
|
-
className
|
|
62
|
-
});
|
|
59
|
+
const icon = /* @__PURE__ */ jsx(IconRenderer, { element, className });
|
|
63
60
|
if (icon) {
|
|
64
61
|
return icon;
|
|
65
62
|
}
|
|
@@ -67,7 +64,7 @@ function IconOrShapeRenderer({
|
|
|
67
64
|
return /* @__PURE__ */ jsx(
|
|
68
65
|
"div",
|
|
69
66
|
{
|
|
70
|
-
className:
|
|
67
|
+
className: cx(
|
|
71
68
|
className,
|
|
72
69
|
"likec4-shape-icon"
|
|
73
70
|
),
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import { jsx } from 'react/jsx-runtime';
|
|
2
|
-
import { createSafeContext
|
|
2
|
+
import { createSafeContext } from '@mantine/core';
|
|
3
3
|
import { useStore } from '@nanostores/react';
|
|
4
4
|
import { atom } from 'nanostores';
|
|
5
|
-
import {
|
|
5
|
+
import { useRef, createContext, useContext } from 'react';
|
|
6
6
|
|
|
7
|
-
const
|
|
7
|
+
const ReduceGraphicsModeCtx = createContext(null);
|
|
8
8
|
function useIsReducedGraphics() {
|
|
9
|
-
const isReduced =
|
|
9
|
+
const isReduced = useContext(ReduceGraphicsModeCtx);
|
|
10
10
|
if (isReduced === null) {
|
|
11
11
|
console.warn("ReduceGraphicsMode is not provided");
|
|
12
12
|
}
|
|
@@ -16,11 +16,11 @@ const [PanningAtomSafeCtx, usePanningAtom] = createSafeContext(
|
|
|
16
16
|
"PanningAtomSafeCtx is not provided"
|
|
17
17
|
);
|
|
18
18
|
function ReduceGraphicsContext({ reduceGraphics, children }) {
|
|
19
|
-
const $isPanningRef =
|
|
19
|
+
const $isPanningRef = useRef(null);
|
|
20
20
|
if (!$isPanningRef.current) {
|
|
21
21
|
$isPanningRef.current = atom(reduceGraphics);
|
|
22
22
|
}
|
|
23
|
-
return /* @__PURE__ */ jsx(PanningAtomSafeCtx, { value: $isPanningRef.current, children: /* @__PURE__ */ jsx(ReduceGraphicsModeCtx, { value: reduceGraphics, children }) });
|
|
23
|
+
return /* @__PURE__ */ jsx(PanningAtomSafeCtx, { value: $isPanningRef.current, children: /* @__PURE__ */ jsx(ReduceGraphicsModeCtx.Provider, { value: reduceGraphics, children }) });
|
|
24
24
|
}
|
|
25
25
|
function useIsPanning() {
|
|
26
26
|
return useStore(usePanningAtom());
|
|
@@ -1,18 +1,21 @@
|
|
|
1
1
|
import { jsx } from 'react/jsx-runtime';
|
|
2
2
|
import { cx } from '@likec4/styles/css';
|
|
3
3
|
import { Box } from '@likec4/styles/jsx';
|
|
4
|
-
import {
|
|
4
|
+
import { useId } from '@mantine/hooks';
|
|
5
|
+
import { useRef, useEffect, createContext, useContext, createRef } from 'react';
|
|
5
6
|
import { usePanningAtom } from './ReduceGraphics.js';
|
|
7
|
+
import { TagStylesProvider } from './TagStylesContext.js';
|
|
6
8
|
|
|
7
|
-
const RootContainerContext =
|
|
9
|
+
const RootContainerContext = createContext(createRef());
|
|
8
10
|
function RootContainer({
|
|
9
11
|
className,
|
|
10
12
|
reduceGraphics = false,
|
|
11
13
|
children
|
|
12
14
|
}) {
|
|
13
|
-
const
|
|
15
|
+
const id = useId();
|
|
16
|
+
const ref = useRef(null);
|
|
14
17
|
const $isPanning = usePanningAtom();
|
|
15
|
-
|
|
18
|
+
useEffect(() => {
|
|
16
19
|
return $isPanning.listen((isPanning) => {
|
|
17
20
|
if (isPanning) {
|
|
18
21
|
ref.current?.setAttribute("data-likec4-diagram-panning", "true");
|
|
@@ -24,17 +27,18 @@ function RootContainer({
|
|
|
24
27
|
return /* @__PURE__ */ jsx(
|
|
25
28
|
Box,
|
|
26
29
|
{
|
|
30
|
+
id,
|
|
27
31
|
className: cx("likec4-root", className),
|
|
28
32
|
ref,
|
|
29
33
|
...reduceGraphics && {
|
|
30
34
|
["data-likec4-reduced-graphics"]: true
|
|
31
35
|
},
|
|
32
|
-
children: /* @__PURE__ */ jsx(RootContainerContext.Provider, { value: ref, children })
|
|
36
|
+
children: /* @__PURE__ */ jsx(TagStylesProvider, { rootSelector: `#${id}`, children: /* @__PURE__ */ jsx(RootContainerContext.Provider, { value: ref, children }) })
|
|
33
37
|
}
|
|
34
38
|
);
|
|
35
39
|
}
|
|
36
40
|
function useRootContainer() {
|
|
37
|
-
return
|
|
41
|
+
return useContext(RootContainerContext).current;
|
|
38
42
|
}
|
|
39
43
|
|
|
40
44
|
export { RootContainer, useRootContainer };
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { TagSpecification } from '@likec4/core';
|
|
2
|
+
import { PropsWithChildren } from 'react';
|
|
3
|
+
export declare function TagStylesProvider({ children, rootSelector }: PropsWithChildren<{
|
|
4
|
+
rootSelector: string;
|
|
5
|
+
}>): import("react/jsx-runtime").JSX.Element;
|
|
6
|
+
export declare function useTagSpecifications(): Record<string, TagSpecification>;
|
|
7
|
+
export declare function useTagSpecification(tag: string): TagSpecification;
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
import { jsxs, jsx } from 'react/jsx-runtime';
|
|
2
|
+
import { isTagColorSpecified } from '@likec4/core';
|
|
3
|
+
import { useMantineStyleNonce } from '@mantine/core';
|
|
4
|
+
import { useDeepCompareMemo } from '@react-hookz/web';
|
|
5
|
+
import { createContext, useContext } from 'react';
|
|
6
|
+
import { pipe, entries, flatMap, join } from 'remeda';
|
|
7
|
+
import { useLikeC4Specification } from '../likec4model/useLikeC4Model.js';
|
|
8
|
+
|
|
9
|
+
const TagStylesContext = createContext({});
|
|
10
|
+
const radixColors = [
|
|
11
|
+
"yellow",
|
|
12
|
+
"orange",
|
|
13
|
+
"amber",
|
|
14
|
+
"tomato",
|
|
15
|
+
"red",
|
|
16
|
+
"ruby",
|
|
17
|
+
"crimson",
|
|
18
|
+
"pink",
|
|
19
|
+
"pink",
|
|
20
|
+
"purple",
|
|
21
|
+
"violet",
|
|
22
|
+
"indigo",
|
|
23
|
+
"blue",
|
|
24
|
+
"teal",
|
|
25
|
+
"grass",
|
|
26
|
+
"lime"
|
|
27
|
+
];
|
|
28
|
+
const generateColorVars = (spec) => {
|
|
29
|
+
const color = spec.color;
|
|
30
|
+
if (isTagColorSpecified(spec)) {
|
|
31
|
+
return `
|
|
32
|
+
--colors-likec4-tag-bg: ${color};
|
|
33
|
+
--colors-likec4-tag-bg-hover: color-mix(in srgb, ${color}, var(--colors-likec4-mix-color) 20%);
|
|
34
|
+
`;
|
|
35
|
+
}
|
|
36
|
+
if (!radixColors.includes(color)) {
|
|
37
|
+
return "";
|
|
38
|
+
}
|
|
39
|
+
let textcolor = "12";
|
|
40
|
+
if (["mint", "grass", "lime", "yellow", "amber"].includes(color)) {
|
|
41
|
+
textcolor = "dark-2";
|
|
42
|
+
}
|
|
43
|
+
return `
|
|
44
|
+
--colors-likec4-tag-border: var(--colors-${color}-8);
|
|
45
|
+
--colors-likec4-tag-bg: var(--colors-${color}-9);
|
|
46
|
+
--colors-likec4-tag-bg-hover: var(--colors-${color}-10);
|
|
47
|
+
--colors-likec4-tag-text: var(--colors-${color}-${textcolor});
|
|
48
|
+
`;
|
|
49
|
+
};
|
|
50
|
+
function TagStylesProvider({ children, rootSelector }) {
|
|
51
|
+
const tags = useLikeC4Specification().tags;
|
|
52
|
+
const { specs, stylesheet } = useDeepCompareMemo(() => {
|
|
53
|
+
if (!tags) {
|
|
54
|
+
return { specs: {}, stylesheet: "" };
|
|
55
|
+
}
|
|
56
|
+
return {
|
|
57
|
+
specs: tags,
|
|
58
|
+
stylesheet: pipe(
|
|
59
|
+
entries(tags),
|
|
60
|
+
flatMap(([tag, spec]) => [
|
|
61
|
+
`:is(${rootSelector} [data-likec4-tag="${tag}"]) {`,
|
|
62
|
+
generateColorVars(spec),
|
|
63
|
+
"}"
|
|
64
|
+
]),
|
|
65
|
+
join("\n")
|
|
66
|
+
)
|
|
67
|
+
};
|
|
68
|
+
}, [tags, rootSelector]);
|
|
69
|
+
return /* @__PURE__ */ jsxs(TagStylesContext.Provider, { value: specs, children: [
|
|
70
|
+
stylesheet !== "" && /* @__PURE__ */ jsx(TagStylesheet, { stylesheet }),
|
|
71
|
+
children
|
|
72
|
+
] });
|
|
73
|
+
}
|
|
74
|
+
function TagStylesheet({ stylesheet }) {
|
|
75
|
+
const nonce = useMantineStyleNonce()?.();
|
|
76
|
+
return /* @__PURE__ */ jsx("style", { "data-likec4-tag-stylesheet": true, type: "text/css", dangerouslySetInnerHTML: { __html: stylesheet }, nonce });
|
|
77
|
+
}
|
|
78
|
+
function useTagSpecification(tag) {
|
|
79
|
+
const specs = useContext(TagStylesContext);
|
|
80
|
+
return specs[tag] ?? {
|
|
81
|
+
color: "tomato"
|
|
82
|
+
};
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
export { TagStylesProvider, useTagSpecification };
|
package/dist/context/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
export { DiagramEventHandlers, useDiagramEventHandlers } from './DiagramEventHandlers';
|
|
2
|
-
export { AllDisabled, DiagramFeatures, IfEnabled, IfNotEnabled,
|
|
2
|
+
export { AllDisabled, DiagramFeatures, IfEnabled, IfNotEnabled, useEnabledFeatures, } from './DiagramFeatures';
|
|
3
3
|
export type { EnabledFeatures } from './DiagramFeatures';
|
|
4
4
|
export { EnsureMantine } from './EnsureMantine';
|
|
5
5
|
export { FramerMotionConfig } from './FramerMotionConfig';
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
export { CompoundActionButton, CompoundDetailsButton, CompoundNodeContainer, CompoundTitle, DefaultHandles, ElementActionButtons, ElementDetailsButton, ElementNodeContainer, ElementShape, ElementTag, ElementTags, ElementTitle, } from '../base/primitives';
|
|
2
|
+
export { IconOrShapeRenderer, IconRenderer, IconRendererProvider, } from '../context/IconRenderer';
|
|
3
|
+
export { CompoundActions, CompoundDeploymentNode, CompoundDeploymentToolbar, CompoundDetailsButtonWithHandler, CompoundElementNode, CompoundElementToolbar, DeploymentElementActions, DeploymentElementToolbar, DeploymentNode, ElementActions, ElementDetailsButtonWithHandler, ElementNode, ElementToolbar, Toolbar, ViewGroupNode, } from '../likec4diagram/custom/nodes';
|
|
4
|
+
export { IfEnabled, IfNotEnabled, IfNotReadOnly, } from '../context/DiagramFeatures';
|
|
5
|
+
export { Overlay, type OverlayProps, } from '../overlays/overlay/Overlay';
|
|
@@ -0,0 +1,228 @@
|
|
|
1
|
+
import { NodeModel } from '@likec4/core/model';
|
|
2
|
+
import { Any } from '@likec4/core/types';
|
|
3
|
+
import { ReactNode } from 'react';
|
|
4
|
+
import { NodeProps } from '../base/types';
|
|
5
|
+
import { Types } from '../likec4diagram/types';
|
|
6
|
+
export type CustomElementNodeProps<M extends Any = Any> = {
|
|
7
|
+
nodeProps: NodeProps<Types.ElementNodeData, 'element'>;
|
|
8
|
+
nodeModel: NodeModel.WithElement<M>;
|
|
9
|
+
};
|
|
10
|
+
/**
|
|
11
|
+
* Node that will be used to render the element from the model.
|
|
12
|
+
* It is a leaf node, i.e. it does not have children.
|
|
13
|
+
*
|
|
14
|
+
* Custom node renderer receives these props:
|
|
15
|
+
* - `nodeProps`: props from XYFlow
|
|
16
|
+
* - `nodeModel`: LikeC4 {@link NodeModel.WithElement}
|
|
17
|
+
*
|
|
18
|
+
* @see [Default implementation](https://github.com/likec4/likec4/blob/main/packages/diagram/src/likec4diagram/custom/nodes/nodes.tsx)
|
|
19
|
+
*
|
|
20
|
+
* @example
|
|
21
|
+
* ```tsx
|
|
22
|
+
* import {
|
|
23
|
+
* elementNode,
|
|
24
|
+
* ElementNodeContainer,
|
|
25
|
+
* ElementShape,
|
|
26
|
+
* ElementTitle,
|
|
27
|
+
* ElementActions,
|
|
28
|
+
* ElementDetailsButtonWithHandler,
|
|
29
|
+
* IfNotReadOnly,
|
|
30
|
+
* ElementToolbar,
|
|
31
|
+
* DefaultHandles,
|
|
32
|
+
* } from '@likec4/diagram/custom'
|
|
33
|
+
*
|
|
34
|
+
* const CustomElementNode = elementNode(({ nodeProps, nodeModel }) => (
|
|
35
|
+
* <ElementNodeContainer nodeProps={nodeProps}>
|
|
36
|
+
* <ElementShape {...nodeProps} />
|
|
37
|
+
* <ElementTitle {...nodeProps} />
|
|
38
|
+
* <ElementActions
|
|
39
|
+
* {...nodeProps}
|
|
40
|
+
* extraButtons={[
|
|
41
|
+
* {
|
|
42
|
+
* key: 'plus',
|
|
43
|
+
* icon: <IconPlus />,
|
|
44
|
+
* onClick: () => console.log('extra'),
|
|
45
|
+
* },
|
|
46
|
+
* ]}
|
|
47
|
+
* />
|
|
48
|
+
* <ElementDetailsButtonWithHandler {...nodeProps} />
|
|
49
|
+
* {nodeModel.element.getMetadata('your-attr') === 'value' && <YourComponent />}
|
|
50
|
+
* <IfNotReadOnly>
|
|
51
|
+
* <ElementToolbar {...nodeProps} />
|
|
52
|
+
* </IfNotReadOnly>
|
|
53
|
+
* <DefaultHandles />
|
|
54
|
+
* </ElementNodeContainer>
|
|
55
|
+
* ))
|
|
56
|
+
* ```
|
|
57
|
+
*/
|
|
58
|
+
export declare const elementNode: (Node: (props: CustomElementNodeProps<Any>) => ReactNode) => (props: NodeProps<Types.ElementNodeData, "element">) => ReactNode;
|
|
59
|
+
export type CustomDeploymentNodeProps<M extends Any = Any> = {
|
|
60
|
+
nodeProps: NodeProps<Types.DeploymentElementNodeData, 'deployment'>;
|
|
61
|
+
nodeModel: NodeModel.WithDeploymentElement<M>;
|
|
62
|
+
};
|
|
63
|
+
/**
|
|
64
|
+
* Node that will be used to render the element from deployment model.
|
|
65
|
+
* It is a leaf node, i.e. it does not have children.
|
|
66
|
+
* Can be {@link DeploymentNodeModel} or {@link DeployedInstanceModel}.
|
|
67
|
+
*
|
|
68
|
+
* Custom node renderer receives these props:
|
|
69
|
+
* - `nodeProps`: props from XYFlow
|
|
70
|
+
* - `nodeModel`: {@link NodeModel.WithDeploymentElement}
|
|
71
|
+
*
|
|
72
|
+
* @see [Default implementation](https://github.com/likec4/likec4/blob/main/packages/diagram/src/likec4diagram/custom/nodes/nodes.tsx)
|
|
73
|
+
*
|
|
74
|
+
* @example
|
|
75
|
+
* ```tsx
|
|
76
|
+
* import {
|
|
77
|
+
* deploymentNode,
|
|
78
|
+
* ElementNodeContainer,
|
|
79
|
+
* ElementShape,
|
|
80
|
+
* ElementTitle,
|
|
81
|
+
* DeploymentElementActions,
|
|
82
|
+
* ElementDetailsButtonWithHandler,
|
|
83
|
+
* IfNotReadOnly,
|
|
84
|
+
* DeploymentElementToolbar,
|
|
85
|
+
* DefaultHandles,
|
|
86
|
+
* } from '@likec4/diagram/custom'
|
|
87
|
+
*
|
|
88
|
+
* const CustomDeploymentNode = deploymentNode(({ nodeProps, nodeModel }) => (
|
|
89
|
+
* <ElementNodeContainer nodeProps={nodeProps}>
|
|
90
|
+
* <ElementShape {...nodeProps} />
|
|
91
|
+
* <ElementTitle {...nodeProps} />
|
|
92
|
+
* <DeploymentElementActions
|
|
93
|
+
* {...nodeProps}
|
|
94
|
+
* extraButtons={[
|
|
95
|
+
* {
|
|
96
|
+
* key: 'plus',
|
|
97
|
+
* icon: <IconPlus />,
|
|
98
|
+
* onClick: () => console.log('extra'),
|
|
99
|
+
* },
|
|
100
|
+
* ]}
|
|
101
|
+
* />
|
|
102
|
+
* <ElementDetailsButtonWithHandler {...nodeProps} />
|
|
103
|
+
* <IfNotReadOnly>
|
|
104
|
+
* <DeploymentElementToolbar {...nodeProps} />
|
|
105
|
+
* </IfNotReadOnly>
|
|
106
|
+
* <DefaultHandles />
|
|
107
|
+
* </ElementNodeContainer>
|
|
108
|
+
* ))
|
|
109
|
+
* ```
|
|
110
|
+
*/
|
|
111
|
+
export declare const deploymentNode: (Node: (props: CustomDeploymentNodeProps<Any>) => ReactNode) => (props: NodeProps<Types.DeploymentElementNodeData, "deployment">) => ReactNode;
|
|
112
|
+
export type CustomCompoundElementNodeProps<M extends Any = Any> = {
|
|
113
|
+
nodeProps: NodeProps<Types.CompoundElementNodeData, 'compound-element'>;
|
|
114
|
+
nodeModel: NodeModel.WithElement<M>;
|
|
115
|
+
};
|
|
116
|
+
/**
|
|
117
|
+
* Node that will be used to render the compound element from the model.
|
|
118
|
+
* It is a container node, i.e. it has children.
|
|
119
|
+
*
|
|
120
|
+
* Custom node renderer receives these props:
|
|
121
|
+
* - `nodeProps`: props from XYFlow
|
|
122
|
+
* - `nodeModel`: LikeC4 {@link NodeModel.WithElement}
|
|
123
|
+
*
|
|
124
|
+
* @see [Default implementation](https://github.com/likec4/likec4/blob/main/packages/diagram/src/likec4diagram/custom/nodes/nodes.tsx)
|
|
125
|
+
*
|
|
126
|
+
* @example
|
|
127
|
+
* ```tsx
|
|
128
|
+
* import {
|
|
129
|
+
* compoundElementNode,
|
|
130
|
+
* CompoundNodeContainer,
|
|
131
|
+
* CompoundTitle,
|
|
132
|
+
* CompoundActions,
|
|
133
|
+
* CompoundDetailsButtonWithHandler,
|
|
134
|
+
* IfEnabled,
|
|
135
|
+
* CompoundElementToolbar,
|
|
136
|
+
* DefaultHandles,
|
|
137
|
+
* } from '@likec4/diagram/custom'
|
|
138
|
+
*
|
|
139
|
+
* const CustomCompoundElementNode = compoundElementNode(({ nodeProps, nodeModel }) => (
|
|
140
|
+
* <CompoundNodeContainer nodeProps={props}>
|
|
141
|
+
* <CompoundTitle {...props} />
|
|
142
|
+
* <CompoundActions {...props} />
|
|
143
|
+
* <IfEnabled feature="ElementDetails">
|
|
144
|
+
* <CompoundDetailsButtonWithHandler {...props} />
|
|
145
|
+
* </IfEnabled>
|
|
146
|
+
* <IfNotReadOnly>
|
|
147
|
+
* <CompoundElementToolbar {...props} />
|
|
148
|
+
* </IfNotReadOnly>
|
|
149
|
+
* <DefaultHandles />
|
|
150
|
+
* </CompoundNodeContainer>
|
|
151
|
+
* ))
|
|
152
|
+
* ```
|
|
153
|
+
*/
|
|
154
|
+
export declare const compoundElementNode: (Node: (props: CustomCompoundElementNodeProps<Any>) => ReactNode) => (props: NodeProps<Types.CompoundElementNodeData, "compound-element">) => ReactNode;
|
|
155
|
+
export type CustomCompoundDeploymentNodeProps<M extends Any = Any> = {
|
|
156
|
+
nodeProps: NodeProps<Types.CompoundDeploymentNodeData, 'compound-deployment'>;
|
|
157
|
+
nodeModel: NodeModel.WithDeploymentElement<M>;
|
|
158
|
+
};
|
|
159
|
+
/**
|
|
160
|
+
* Node that will be used to render the compound from the deployment model.
|
|
161
|
+
* It is a container node, i.e. it has children.
|
|
162
|
+
*
|
|
163
|
+
* Custom node renderer receives these props:
|
|
164
|
+
* - `nodeProps`: props from XYFlow
|
|
165
|
+
* - `nodeModel`: LikeC4 {@link NodeModel.WithDeploymentElement}
|
|
166
|
+
*
|
|
167
|
+
* @see [Default implementation](https://github.com/likec4/likec4/blob/main/packages/diagram/src/likec4diagram/custom/nodes/nodes.tsx)
|
|
168
|
+
*
|
|
169
|
+
* @example
|
|
170
|
+
* ```tsx
|
|
171
|
+
* import {
|
|
172
|
+
* compoundDeploymentNode,
|
|
173
|
+
* CompoundNodeContainer,
|
|
174
|
+
* CompoundTitle,
|
|
175
|
+
* CompoundActions,
|
|
176
|
+
* CompoundDeploymentToolbar,
|
|
177
|
+
* DefaultHandles,
|
|
178
|
+
* } from '@likec4/diagram/custom'
|
|
179
|
+
*
|
|
180
|
+
* const CustomCompoundDeploymentNode = compoundDeploymentNode(({ nodeProps, nodeModel }) => (
|
|
181
|
+
* <CompoundNodeContainer nodeProps={nodeProps}>
|
|
182
|
+
* <CompoundTitle {...nodeProps} />
|
|
183
|
+
* <CompoundActions {...nodeProps} />
|
|
184
|
+
* <IfNotReadOnly>
|
|
185
|
+
* <CompoundDeploymentToolbar {...nodeProps} />
|
|
186
|
+
* </IfNotReadOnly>
|
|
187
|
+
* <DefaultHandles />
|
|
188
|
+
* </CompoundNodeContainer>
|
|
189
|
+
* ```
|
|
190
|
+
*/
|
|
191
|
+
export declare const compoundDeploymentNode: (Node: (props: CustomCompoundDeploymentNodeProps<Any>) => ReactNode) => (props: NodeProps<Types.CompoundDeploymentNodeData, "compound-deployment">) => ReactNode;
|
|
192
|
+
export type CustomViewGroupNodeProps<M extends Any = Any> = {
|
|
193
|
+
nodeProps: NodeProps<Types.ViewGroupNodeData, 'view-group'>;
|
|
194
|
+
nodeModel: NodeModel.IsGroup<M>;
|
|
195
|
+
};
|
|
196
|
+
/**
|
|
197
|
+
* Node that will be used to render the view group from the model.
|
|
198
|
+
*
|
|
199
|
+
* Custom node renderer receives these props:
|
|
200
|
+
* - `nodeProps`: props from XYFlow
|
|
201
|
+
* - `nodeModel`: LikeC4 {@link NodeModel.IsGroup}
|
|
202
|
+
*
|
|
203
|
+
* @see [Default implementation](https://github.com/likec4/likec4/blob/main/packages/diagram/src/likec4diagram/custom/nodes/nodes.tsx)
|
|
204
|
+
*
|
|
205
|
+
* @example
|
|
206
|
+
* ```tsx
|
|
207
|
+
* import {
|
|
208
|
+
* viewGroupNode,
|
|
209
|
+
* CompoundNodeContainer,
|
|
210
|
+
* CompoundTitle,
|
|
211
|
+
* DefaultHandles,
|
|
212
|
+
* } from '@likec4/diagram/custom'
|
|
213
|
+
*
|
|
214
|
+
* const CustomViewGroupNode = viewGroupNode(({ nodeProps, nodeModel }) => (
|
|
215
|
+
* <CompoundNodeContainer nodeProps={nodeProps}>
|
|
216
|
+
* <CompoundTitle {...nodeProps} />
|
|
217
|
+
* <DefaultHandles />
|
|
218
|
+
* </CompoundNodeContainer>
|
|
219
|
+
* ```
|
|
220
|
+
*/
|
|
221
|
+
export declare const viewGroupNode: (Node: (props: CustomViewGroupNodeProps<Any>) => ReactNode) => (props: NodeProps<Types.ViewGroupNodeData, "view-group">) => ReactNode;
|
|
222
|
+
export interface CustomNodes {
|
|
223
|
+
element?: undefined | ((props: NodeProps<Types.ElementNodeData, 'element'>) => ReactNode);
|
|
224
|
+
deployment?: undefined | ((props: NodeProps<Types.DeploymentElementNodeData, 'deployment'>) => ReactNode);
|
|
225
|
+
compoundElement?: undefined | ((props: NodeProps<Types.CompoundElementNodeData, 'compound-element'>) => ReactNode);
|
|
226
|
+
compoundDeployment?: undefined | ((props: NodeProps<Types.CompoundDeploymentNodeData, 'compound-deployment'>) => ReactNode);
|
|
227
|
+
viewGroup?: undefined | ((props: NodeProps<Types.ViewGroupNodeData, 'view-group'>) => ReactNode);
|
|
228
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
export type { DiagramActorEvent, DiagramActorRef, DiagramContext, } from '../state/types';
|
|
2
|
+
export { useDiagramEventHandlers, } from '../context/DiagramEventHandlers';
|
|
3
|
+
export { type EnabledFeatures, useEnabledFeatures, } from '../context/DiagramFeatures';
|
|
4
|
+
export { useCurrentViewId, } from '../hooks/useCurrentViewId';
|
|
5
|
+
export { useDiagram, useDiagramContext, } from '../hooks/useDiagram';
|
|
6
|
+
export { useXYFlow, useXYInternalNode, useXYStore, useXYStoreApi, } from '../hooks/useXYFlow';
|
|
7
|
+
export { useLikeC4Model, useLikeC4Specification, } from '../likec4model/useLikeC4Model';
|
|
8
|
+
export { useMantinePortalProps } from '../hooks/useMantinePortalProps';
|
|
9
|
+
export { useSetState } from '../hooks/useSetState';
|
|
10
|
+
export { useUpdateEffect } from '../hooks/useUpdateEffect';
|
package/dist/hooks/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
export { useMantinePortalProps } from './useMantinePortalProps';
|
|
2
2
|
export { useSetState } from './useSetState';
|
|
3
3
|
export { useUpdateEffect } from './useUpdateEffect';
|
|
4
|
-
export { useXYFlow, useXYInternalNode, useXYStore, useXYStoreApi } from './useXYFlow';
|
|
4
|
+
export { useCurrentZoom, useIsZoomTooSmall, useXYFlow, useXYInternalNode, useXYStore, useXYStoreApi } from './useXYFlow';
|
|
5
5
|
export type { XYStoreApi } from './useXYFlow';
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { createContext, useContext } from 'react';
|
|
2
2
|
|
|
3
|
-
const DiagramActorSafeContext =
|
|
3
|
+
const DiagramActorSafeContext = createContext(null);
|
|
4
4
|
DiagramActorSafeContext.displayName = "DiagramActorSafeContext";
|
|
5
5
|
const DiagramActorContextProvider = DiagramActorSafeContext.Provider;
|
|
6
6
|
const useDiagramActorRef = () => {
|
|
7
|
-
const ctx =
|
|
7
|
+
const ctx = useContext(DiagramActorSafeContext);
|
|
8
8
|
if (ctx === null) {
|
|
9
9
|
throw new Error("DiagramActorRef is not provided");
|
|
10
10
|
}
|
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
import { useSelector } from '@xstate/react';
|
|
2
|
-
import '@likec4/core';
|
|
3
2
|
import '@mantine/hooks';
|
|
4
3
|
import 'fast-equals';
|
|
5
|
-
import '
|
|
4
|
+
import 'react';
|
|
6
5
|
import { useDiagramActorRef } from './safeContext.js';
|
|
7
6
|
|
|
8
7
|
const selectViewId = (s) => s.context.view.id;
|