@likec4/diagram 1.29.1 → 1.31.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-BBzMXzCg.js +21383 -0
- package/bundle/custom.js +62 -0
- package/bundle/index.js +17459 -38163
- package/dist/LikeC4CustomColors.js +2 -2
- package/dist/LikeC4Diagram.d.ts +1 -1
- package/dist/LikeC4Diagram.js +4 -2
- package/dist/LikeC4Diagram.props.d.ts +6 -1
- package/dist/LikeC4ModelProvider.d.ts +3 -3
- package/dist/LikeC4ModelProvider.js +0 -1
- package/dist/StaticLikeC4Diagram.d.ts +1 -1
- package/dist/base/BaseXYFlow.js +3 -3
- package/dist/base/primitives/compound/CompoundActionButton.d.ts +3 -2
- package/dist/base/primitives/compound/CompoundDetailsButton.d.ts +3 -2
- package/dist/base/primitives/compound/CompoundNodeContainer.d.ts +7 -3
- package/dist/base/primitives/compound/CompoundNodeContainer.js +3 -2
- 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.js +0 -1
- package/dist/base/primitives/edge/EdgeLabel.js +0 -1
- package/dist/base/primitives/edge/EdgeLabelContainer.js +0 -2
- package/dist/base/primitives/edge/EdgePath.js +2 -2
- 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/ElementTitle.css.d.ts +1 -1
- package/dist/base/primitives/element/ElementTitle.js +0 -1
- package/dist/base/types.d.ts +5 -5
- package/dist/bundle/LikeC4View.js +6 -3
- package/dist/bundle/LikeC4View.props.d.ts +5 -1
- package/dist/bundle/ReactLikeC4.js +1 -2
- 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/SearchControl.js +2 -2
- package/dist/context/ControlsCustomLayout.js +0 -1
- package/dist/context/DiagramEventHandlers.js +5 -5
- package/dist/context/DiagramFeatures.d.ts +2 -4
- package/dist/context/DiagramFeatures.js +15 -16
- package/dist/context/EnsureMantine.js +9 -4
- package/dist/context/FramerMotionConfig.js +0 -1
- package/dist/context/IconRenderer.js +7 -7
- package/dist/context/ReduceGraphics.js +6 -6
- package/dist/context/RootContainer.js +5 -5
- package/dist/context/index.d.ts +1 -1
- package/dist/custom/components.d.ts +5 -0
- package/dist/custom/customNodes.d.ts +218 -0
- package/dist/custom/hooks.d.ts +10 -0
- package/dist/custom/index.d.ts +4 -0
- 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 +14 -12544
- package/dist/hooks/useDiagram.js +3 -5
- package/dist/hooks/useMantinePortalProps.js +2 -2
- package/dist/hooks/useSetState.js +3 -3
- package/dist/hooks/useUpdateEffect.js +0 -1
- package/dist/hooks/useXYFlow.d.ts +64 -64
- package/dist/hooks/useXYFlow.js +2 -2
- package/dist/index.d.ts +2 -4
- package/dist/index.js +8 -3
- package/dist/likec4diagram/DiagramUI.js +2 -2
- package/dist/likec4diagram/DiagramXYFlow.d.ts +1 -1
- package/dist/likec4diagram/DiagramXYFlow.js +25 -7
- package/dist/likec4diagram/custom/edges/NotePopover.js +2 -2
- package/dist/likec4diagram/custom/edges/RelationshipEdge.d.ts +9 -13
- package/dist/likec4diagram/custom/edges/RelationshipEdge.js +8 -8
- package/dist/likec4diagram/custom/edges/RelationshipsDropdownMenu.js +14 -12
- package/dist/likec4diagram/custom/index.d.ts +15 -19
- 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/{nodeTypes.js → nodes.js} +39 -39
- 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 +2 -2
- package/dist/likec4diagram/custom/nodes/toolbar/_shared.js +2 -2
- package/dist/likec4diagram/types.d.ts +15 -7
- package/dist/likec4diagram/ui/controls/ChangeAutoLayoutButton.js +4 -4
- package/dist/likec4diagram/ui/controls/Controls.js +2 -2
- package/dist/likec4diagram/ui/diagram-title/DiagramTitlePanel.js +2 -2
- package/dist/likec4diagram/ui/notation/NotationPanel.js +6 -8
- package/dist/likec4diagram/ui/search/ElementsColumn.js +6 -7
- package/dist/likec4diagram/ui/search/LikeC4Search.js +3 -3
- package/dist/likec4diagram/ui/search/SearchInput.js +0 -1
- package/dist/likec4diagram/ui/search/_shared.css.d.ts +1 -1
- package/dist/likec4diagram/ui/search/state.js +3 -4
- package/dist/likec4diagram/ui/walkthrough/DynamicViewWalkthrough.js +4 -4
- package/dist/likec4diagram/useLayoutConstraints.js +3 -4
- package/dist/likec4diagram/useViewToNodesEdges.js +2 -0
- 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 +3 -3
- package/dist/likec4model/useLikeC4Model.d.ts +1 -1
- package/dist/likec4model/useLikeC4Model.js +2 -2
- package/dist/overlays/Overlays.d.ts +2 -3
- package/dist/overlays/Overlays.js +5 -6
- package/dist/overlays/element-details/ElementDetailsCard.css.js +13 -9
- package/dist/overlays/element-details/ElementDetailsCard.js +98 -105
- package/dist/overlays/element-details/TabPanelDeployments.js +4 -4
- package/dist/overlays/element-details/TabPanelRelationships.js +2 -2
- package/dist/overlays/element-details/TabPanelStructure.js +3 -3
- package/dist/overlays/element-details/actor.d.ts +6905 -19690
- package/dist/overlays/element-details/actor.js +0 -2
- package/dist/overlays/element-details/actorContext.js +3 -3
- package/dist/overlays/overlay/Overlay.d.ts +11 -1
- package/dist/overlays/overlay/Overlay.js +8 -8
- package/dist/overlays/overlaysActor.d.ts +4 -2
- package/dist/overlays/overlaysActor.js +2 -1
- package/dist/overlays/relationship-details/RelationshipDetails.d.ts +4 -8
- package/dist/overlays/relationship-details/RelationshipDetails.js +12 -12
- package/dist/overlays/relationship-details/SelectEdge.js +2 -3
- package/dist/overlays/relationship-details/_types.d.ts +6 -5
- package/dist/overlays/relationship-details/actor.d.ts +3 -3
- package/dist/overlays/relationship-details/compute.js +3 -3
- package/dist/overlays/relationship-details/custom/edgeTypes.d.ts +4 -8
- 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/hooks.d.ts +27 -27
- package/dist/overlays/relationship-details/hooks.js +4 -4
- package/dist/overlays/relationship-details/layout.js +2 -3
- package/dist/overlays/relationships-browser/RelationshipsBrowser.d.ts +4 -8
- package/dist/overlays/relationships-browser/RelationshipsBrowser.js +8 -8
- package/dist/overlays/relationships-browser/SelectElement.js +5 -5
- package/dist/overlays/relationships-browser/_types.d.ts +6 -5
- package/dist/overlays/relationships-browser/actor.d.ts +63 -428
- package/dist/overlays/relationships-browser/custom/edgeTypes.d.ts +4 -8
- package/dist/overlays/relationships-browser/custom/edgeTypes.js +2 -2
- package/dist/overlays/relationships-browser/custom/nodeTypes.d.ts +10 -14
- package/dist/overlays/relationships-browser/custom/nodeTypes.js +1 -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.js +3 -4
- package/dist/state/DiagramActorProvider.js +3 -3
- package/dist/state/diagram-machine.d.ts +186 -10369
- package/dist/state/diagram-machine.js +2 -1
- package/dist/state/hotkeyActor.d.ts +4 -2
- package/dist/state/syncManualLayoutActor.d.ts +14 -3
- package/dist/state/syncManualLayoutActor.js +2 -1
- package/dist/state/types.d.ts +5 -4
- package/dist/state/utils.d.ts +1 -1
- 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 +46 -21
- package/panda.buildinfo.json +979 -0
- package/src/LikeC4Diagram.props.ts +7 -1
- package/src/LikeC4Diagram.tsx +2 -0
- package/src/LikeC4ModelProvider.tsx +3 -3
- package/src/StaticLikeC4Diagram.tsx +1 -0
- package/src/base/Background.tsx +0 -4
- package/src/base/primitives/compound/CompoundActionButton.tsx +7 -4
- package/src/base/primitives/compound/CompoundDetailsButton.tsx +7 -4
- package/src/base/primitives/compound/CompoundNodeContainer.tsx +8 -7
- package/src/base/primitives/customEdge.ts +1 -1
- package/src/base/primitives/{customNode.ts → customNode.tsx} +11 -3
- package/src/base/primitives/element/ElementNodeContainer.tsx +87 -80
- package/src/base/primitives/element/ElementShape.tsx +11 -10
- package/src/base/types.ts +28 -33
- package/src/bundle/LikeC4View.props.ts +6 -1
- package/src/bundle/LikeC4View.tsx +3 -0
- package/src/bundle/ReactLikeC4.tsx +1 -1
- 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/SearchControl.tsx +1 -1
- package/src/context/DiagramFeatures.tsx +12 -8
- package/src/context/EnsureMantine.tsx +13 -3
- package/src/context/IconRenderer.tsx +4 -2
- package/src/context/ReduceGraphics.tsx +6 -6
- package/src/context/index.ts +0 -1
- package/src/custom/components.ts +47 -0
- package/src/custom/customNodes.tsx +244 -0
- package/src/custom/hooks.ts +35 -0
- package/src/custom/index.ts +5 -0
- package/src/hooks/useCurrentViewId.ts +9 -1
- package/src/hooks/useDiagram.ts +30 -9
- package/src/index.ts +4 -8
- package/src/likec4diagram/DiagramXYFlow.tsx +28 -5
- package/src/likec4diagram/custom/edges/RelationshipEdge.tsx +1 -1
- package/src/likec4diagram/custom/edges/RelationshipsDropdownMenu.tsx +9 -7
- 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/{nodeTypes.tsx → nodes.tsx} +52 -36
- 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/types.ts +19 -9
- package/src/likec4diagram/ui/diagram-title/DiagramTitlePanel.tsx +1 -1
- package/src/likec4diagram/ui/notation/NotationPanel.tsx +1 -2
- package/src/likec4diagram/ui/search/ElementsColumn.tsx +2 -4
- package/src/likec4diagram/ui/walkthrough/DynamicViewWalkthrough.tsx +1 -1
- package/src/likec4diagram/useViewToNodesEdges.ts +2 -0
- package/src/likec4model/LikeC4ModelContext.ts +2 -2
- package/src/likec4model/useLikeC4ElementsTree.ts +3 -1
- package/src/likec4model/useLikeC4Model.ts +1 -1
- package/src/overlays/Overlays.tsx +2 -3
- package/src/overlays/element-details/ElementDetailsCard.css.ts +14 -22
- package/src/overlays/element-details/ElementDetailsCard.tsx +18 -16
- package/src/overlays/overlay/Overlay.tsx +3 -4
- package/src/overlays/overlaysActor.ts +4 -3
- package/src/overlays/relationship-details/RelationshipDetails.tsx +1 -1
- package/src/overlays/relationship-details/SelectEdge.tsx +0 -2
- package/src/overlays/relationship-details/_types.ts +16 -13
- package/src/overlays/relationship-details/custom/edgeTypes.tsx +2 -2
- package/src/overlays/relationships-browser/_types.ts +18 -15
- 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 +1 -2
- package/src/state/DiagramActorProvider.tsx +2 -2
- package/src/state/diagram-machine.ts +13 -8
- package/src/state/hotkeyActor.ts +4 -2
- package/src/state/syncManualLayoutActor.ts +9 -3
- package/src/state/types.ts +9 -3
- package/src/state/utils.ts +3 -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/xyflowMachine.d.ts +0 -212
- package/dist/likec4diagram/custom/nodes/nodeTypes.d.ts +0 -8
- 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/dist/{bundle/font.css.js → styles-font.css2.js} +0 -0
- /package/src/{bundle/font.css → styles-font.css} +0 -0
|
@@ -2,10 +2,10 @@ import {
|
|
|
2
2
|
type EdgeId,
|
|
3
3
|
nonNullable,
|
|
4
4
|
} from '@likec4/core'
|
|
5
|
+
import { cx as clsx } from '@likec4/styles/css'
|
|
5
6
|
import { useDebouncedEffect } from '@react-hookz/web'
|
|
6
7
|
import type { XYPosition } from '@xyflow/react'
|
|
7
8
|
import { EdgeLabelRenderer } from '@xyflow/react'
|
|
8
|
-
import clsx from 'clsx'
|
|
9
9
|
import { curveCatmullRomOpen, line as d3line } from 'd3-shape'
|
|
10
10
|
import { type PointerEvent as ReactPointerEvent, useEffect, useRef, useState } from 'react'
|
|
11
11
|
import { first, isTruthy, last } from 'remeda'
|
|
@@ -28,7 +28,7 @@ import { IconArrowRight, IconFileSymlink, IconInfoCircle, IconZoomScan } from '@
|
|
|
28
28
|
import { type MouseEventHandler, type PropsWithChildren, forwardRef, Fragment, memo, useCallback } from 'react'
|
|
29
29
|
import { filter, isTruthy, map, partition, pipe } from 'remeda'
|
|
30
30
|
import { Link } from '../../../components/Link'
|
|
31
|
-
import { IfEnabled, useDiagramEventHandlers,
|
|
31
|
+
import { IfEnabled, useDiagramEventHandlers, useEnabledFeatures } from '../../../context'
|
|
32
32
|
import { useMantinePortalProps } from '../../../hooks'
|
|
33
33
|
import { useDiagram, useDiagramContext } from '../../../hooks/useDiagram'
|
|
34
34
|
import { useLikeC4Model } from '../../../likec4model'
|
|
@@ -62,11 +62,13 @@ export const RelationshipsDropdownMenu = memo((
|
|
|
62
62
|
disabled?: boolean | undefined
|
|
63
63
|
}>,
|
|
64
64
|
) => {
|
|
65
|
-
const { diagramEdge, sourceNode, targetNode } = useDiagramContext(
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
65
|
+
const { diagramEdge, sourceNode, targetNode } = useDiagramContext(
|
|
66
|
+
useCallback(ctx => ({
|
|
67
|
+
diagramEdge: findDiagramEdge(ctx, edgeId),
|
|
68
|
+
sourceNode: findDiagramNode(ctx, source),
|
|
69
|
+
targetNode: findDiagramNode(ctx, target),
|
|
70
|
+
}), [edgeId, source, target]),
|
|
71
|
+
)
|
|
70
72
|
const likec4model = useLikeC4Model(true)
|
|
71
73
|
const diagram = useDiagram()
|
|
72
74
|
|
|
@@ -188,7 +190,7 @@ const Relationship = forwardRef<
|
|
|
188
190
|
...props
|
|
189
191
|
}, ref) => {
|
|
190
192
|
const diagram = useDiagram()
|
|
191
|
-
const { enableNavigateTo } =
|
|
193
|
+
const { enableNavigateTo } = useEnabledFeatures()
|
|
192
194
|
const { onOpenSource } = useDiagramEventHandlers()
|
|
193
195
|
const viewId = diagram.currentView.id
|
|
194
196
|
|
|
@@ -6,9 +6,9 @@ import {
|
|
|
6
6
|
DeploymentNode,
|
|
7
7
|
ElementNode,
|
|
8
8
|
ViewGroupNode,
|
|
9
|
-
} from './nodes/
|
|
9
|
+
} from './nodes/nodes'
|
|
10
10
|
|
|
11
|
-
export const
|
|
11
|
+
export const BuiltinNodes = {
|
|
12
12
|
element: ElementNode,
|
|
13
13
|
deployment: DeploymentNode,
|
|
14
14
|
'compound-element': CompoundElementNode,
|
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
import type { NodeId } from '@likec4/core'
|
|
2
2
|
import { CompoundActionButton } from '../../../base/primitives'
|
|
3
3
|
import type { NodeProps } from '../../../base/types'
|
|
4
|
-
import {
|
|
4
|
+
import { useEnabledFeatures } from '../../../context/DiagramFeatures'
|
|
5
5
|
import { useDiagram } from '../../../hooks/useDiagram'
|
|
6
6
|
import type { Types } from '../../types'
|
|
7
7
|
|
|
8
8
|
type CompoundActionsProps = NodeProps<Types.CompoundElementNodeData | Types.CompoundDeploymentNodeData>
|
|
9
9
|
|
|
10
10
|
export const CompoundActions = (props: CompoundActionsProps) => {
|
|
11
|
-
const { enableNavigateTo } =
|
|
11
|
+
const { enableNavigateTo } = useEnabledFeatures()
|
|
12
12
|
const diagram = useDiagram()
|
|
13
13
|
|
|
14
14
|
const { navigateTo } = props.data
|
|
@@ -1,74 +1,117 @@
|
|
|
1
|
-
import type
|
|
1
|
+
import { type NodeId, hasAtLeast } from '@likec4/core'
|
|
2
2
|
import { IconTransform, IconZoomScan } from '@tabler/icons-react'
|
|
3
|
+
import { useMemo } from 'react'
|
|
3
4
|
import { ElementActionButtons } from '../../../base/primitives'
|
|
4
5
|
import type { NodeProps } from '../../../base/types'
|
|
5
|
-
import {
|
|
6
|
+
import { useEnabledFeatures } from '../../../context/DiagramFeatures'
|
|
6
7
|
import { useDiagram } from '../../../hooks/useDiagram'
|
|
7
8
|
import type { Types } from '../../types'
|
|
8
9
|
|
|
9
|
-
type
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
10
|
+
type WithExtraButtons = {
|
|
11
|
+
/**
|
|
12
|
+
* Add extra action buttons
|
|
13
|
+
* @example
|
|
14
|
+
* ```tsx
|
|
15
|
+
* <ElementActions
|
|
16
|
+
* extraButtons={[
|
|
17
|
+
* {
|
|
18
|
+
* key: 'extra',
|
|
19
|
+
* icon: <IconZoomScan />,
|
|
20
|
+
* onClick: (e) => {
|
|
21
|
+
* e.stopPropagation()
|
|
22
|
+
* console.log('extra action clicked')
|
|
23
|
+
* },
|
|
24
|
+
* },
|
|
25
|
+
* },
|
|
26
|
+
* ]}
|
|
27
|
+
* />
|
|
28
|
+
* ```
|
|
29
|
+
*/
|
|
30
|
+
extraButtons?: ElementActionButtons.Item[]
|
|
31
|
+
}
|
|
13
32
|
|
|
14
|
-
|
|
33
|
+
export type ElementActionsProps = NodeProps<Types.ElementNodeData> & WithExtraButtons
|
|
15
34
|
|
|
35
|
+
export const ElementActions = ({
|
|
36
|
+
extraButtons,
|
|
37
|
+
...props
|
|
38
|
+
}: ElementActionsProps) => {
|
|
39
|
+
const { enableNavigateTo, enableRelationshipBrowser } = useEnabledFeatures()
|
|
40
|
+
const diagram = useDiagram()
|
|
16
41
|
const { navigateTo, modelFqn } = props.data
|
|
17
|
-
|
|
18
|
-
buttons.
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
42
|
+
let buttons = useMemo(() => {
|
|
43
|
+
const buttons = [] as ElementActionButtons.Item[]
|
|
44
|
+
|
|
45
|
+
if (navigateTo && enableNavigateTo) {
|
|
46
|
+
buttons.push({
|
|
47
|
+
key: 'navigate',
|
|
48
|
+
icon: <IconZoomScan />,
|
|
49
|
+
onClick: (e) => {
|
|
50
|
+
e.stopPropagation()
|
|
51
|
+
diagram.navigateTo(navigateTo, props.id as NodeId)
|
|
52
|
+
},
|
|
53
|
+
})
|
|
54
|
+
}
|
|
55
|
+
if (enableRelationshipBrowser) {
|
|
56
|
+
buttons.push({
|
|
57
|
+
key: 'relationships',
|
|
58
|
+
icon: <IconTransform />,
|
|
59
|
+
onClick: (e) => {
|
|
60
|
+
e.stopPropagation()
|
|
61
|
+
diagram.openRelationshipsBrowser(modelFqn)
|
|
62
|
+
},
|
|
63
|
+
})
|
|
64
|
+
}
|
|
65
|
+
return buttons
|
|
66
|
+
}, [enableNavigateTo, enableRelationshipBrowser, diagram, modelFqn, navigateTo, props.id])
|
|
67
|
+
|
|
68
|
+
if (extraButtons && hasAtLeast(extraButtons, 1)) {
|
|
69
|
+
buttons = [...buttons, ...extraButtons]
|
|
36
70
|
}
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
{...props}
|
|
41
|
-
/>
|
|
42
|
-
)
|
|
71
|
+
|
|
72
|
+
// Spread all ReactFlow node props and override buttons with our computed buttons
|
|
73
|
+
return <ElementActionButtons {...props} buttons={buttons} />
|
|
43
74
|
}
|
|
44
75
|
|
|
45
|
-
type DeploymentElementActionsProps = NodeProps<Types.DeploymentElementNodeData>
|
|
46
|
-
export const DeploymentElementActions = (
|
|
47
|
-
|
|
76
|
+
export type DeploymentElementActionsProps = NodeProps<Types.DeploymentElementNodeData> & WithExtraButtons
|
|
77
|
+
export const DeploymentElementActions = ({
|
|
78
|
+
extraButtons,
|
|
79
|
+
...props
|
|
80
|
+
}: DeploymentElementActionsProps) => {
|
|
81
|
+
const { enableNavigateTo, enableRelationshipBrowser } = useEnabledFeatures()
|
|
48
82
|
const diagram = useDiagram()
|
|
83
|
+
const { navigateTo, modelFqn } = props.data
|
|
49
84
|
|
|
50
|
-
|
|
85
|
+
let buttons = useMemo(() => {
|
|
86
|
+
const buttons = [] as ElementActionButtons.Item[]
|
|
51
87
|
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
}
|
|
61
|
-
}
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
}
|
|
71
|
-
}
|
|
88
|
+
if (navigateTo && enableNavigateTo) {
|
|
89
|
+
buttons.push({
|
|
90
|
+
key: 'navigate',
|
|
91
|
+
icon: <IconZoomScan />,
|
|
92
|
+
onClick: (e) => {
|
|
93
|
+
e.stopPropagation()
|
|
94
|
+
diagram.navigateTo(navigateTo, props.id as NodeId)
|
|
95
|
+
},
|
|
96
|
+
})
|
|
97
|
+
}
|
|
98
|
+
if (enableRelationshipBrowser && !!modelFqn) {
|
|
99
|
+
buttons.push({
|
|
100
|
+
key: 'relationships',
|
|
101
|
+
icon: <IconTransform />,
|
|
102
|
+
onClick: (e) => {
|
|
103
|
+
e.stopPropagation()
|
|
104
|
+
diagram.openRelationshipsBrowser(modelFqn)
|
|
105
|
+
},
|
|
106
|
+
})
|
|
107
|
+
}
|
|
108
|
+
return buttons
|
|
109
|
+
}, [enableNavigateTo, enableRelationshipBrowser, diagram, modelFqn, navigateTo, props.id])
|
|
110
|
+
|
|
111
|
+
if (extraButtons && hasAtLeast(extraButtons, 1)) {
|
|
112
|
+
buttons = [...buttons, ...extraButtons]
|
|
72
113
|
}
|
|
73
|
-
|
|
114
|
+
|
|
115
|
+
// Spread all ReactFlow node props and override buttons with our computed buttons
|
|
116
|
+
return <ElementActionButtons {...props} buttons={buttons} />
|
|
74
117
|
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
export { CompoundActions } from './CompoundActions'
|
|
2
|
+
export { DeploymentElementActions, ElementActions } from './ElementActions'
|
|
3
|
+
export {
|
|
4
|
+
CompoundDeploymentNode,
|
|
5
|
+
CompoundDetailsButtonWithHandler,
|
|
6
|
+
CompoundElementNode,
|
|
7
|
+
DeploymentNode,
|
|
8
|
+
ElementDetailsButtonWithHandler,
|
|
9
|
+
ElementNode,
|
|
10
|
+
ViewGroupNode,
|
|
11
|
+
} from './nodes'
|
|
12
|
+
|
|
13
|
+
export * from './CompoundActions'
|
|
14
|
+
export * from './ElementActions'
|
|
15
|
+
export * from './toolbar/CompoundToolbar'
|
|
16
|
+
export * from './toolbar/ElementToolbar'
|
|
17
|
+
export * from './toolbar/Toolbar'
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { type
|
|
1
|
+
import { type NodeId } from '@likec4/core'
|
|
2
2
|
import type { NodeProps } from '../../../base'
|
|
3
3
|
import {
|
|
4
4
|
CompoundDetailsButton,
|
|
@@ -11,7 +11,7 @@ import {
|
|
|
11
11
|
ElementShape,
|
|
12
12
|
ElementTitle,
|
|
13
13
|
} from '../../../base/primitives'
|
|
14
|
-
import { IfEnabled,
|
|
14
|
+
import { IfEnabled, IfNotReadOnly, useEnabledFeatures } from '../../../context/DiagramFeatures'
|
|
15
15
|
import { useDiagram } from '../../../hooks/useDiagram'
|
|
16
16
|
import type { Types } from '../../types'
|
|
17
17
|
import { CompoundActions } from './CompoundActions'
|
|
@@ -19,11 +19,14 @@ import { DeploymentElementActions, ElementActions } from './ElementActions'
|
|
|
19
19
|
import { CompoundDeploymentToolbar, CompoundElementToolbar } from './toolbar/CompoundToolbar'
|
|
20
20
|
import { DeploymentElementToolbar, ElementToolbar } from './toolbar/ElementToolbar'
|
|
21
21
|
|
|
22
|
-
|
|
23
|
-
|
|
22
|
+
export function ElementDetailsButtonWithHandler(
|
|
23
|
+
props: NodeProps<Types.ElementNodeData | Types.DeploymentElementNodeData>,
|
|
24
|
+
) {
|
|
25
|
+
const { enableElementDetails } = useEnabledFeatures()
|
|
24
26
|
const diagram = useDiagram()
|
|
27
|
+
const fqn = props.data.modelFqn
|
|
25
28
|
|
|
26
|
-
if (!enableElementDetails) return null
|
|
29
|
+
if (!enableElementDetails || !fqn) return null
|
|
27
30
|
|
|
28
31
|
return (
|
|
29
32
|
<ElementDetailsButton
|
|
@@ -31,79 +34,92 @@ const ElementDetailsButtonWithHandler = ({ fqn, ...props }: NodeProps<Types.Node
|
|
|
31
34
|
onClick={e => {
|
|
32
35
|
e.stopPropagation()
|
|
33
36
|
diagram.openElementDetails(fqn, props.id as NodeId)
|
|
34
|
-
}}
|
|
35
|
-
/>
|
|
37
|
+
}} />
|
|
36
38
|
)
|
|
37
39
|
}
|
|
38
40
|
|
|
39
|
-
export
|
|
41
|
+
export function CompoundDetailsButtonWithHandler(
|
|
42
|
+
props: NodeProps<Types.CompoundElementNodeData | Types.CompoundDeploymentNodeData>,
|
|
43
|
+
) {
|
|
44
|
+
const { enableElementDetails } = useEnabledFeatures()
|
|
45
|
+
const diagram = useDiagram()
|
|
46
|
+
const fqn = props.data.modelFqn
|
|
47
|
+
|
|
48
|
+
if (!enableElementDetails || !fqn) return null
|
|
49
|
+
|
|
50
|
+
return (
|
|
51
|
+
<CompoundDetailsButton
|
|
52
|
+
{...props}
|
|
53
|
+
onClick={e => {
|
|
54
|
+
e.stopPropagation()
|
|
55
|
+
diagram.openElementDetails(fqn, props.id as NodeId)
|
|
56
|
+
}} />
|
|
57
|
+
)
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
export const ElementNode = customNode<Types.ElementNodeData, 'element'>((props) => (
|
|
40
61
|
<ElementNodeContainer nodeProps={props}>
|
|
41
|
-
<ElementShape {...props}
|
|
62
|
+
<ElementShape {...props} />
|
|
42
63
|
<ElementTitle {...props} />
|
|
43
64
|
<ElementActions {...props} />
|
|
44
|
-
<ElementDetailsButtonWithHandler
|
|
45
|
-
|
|
46
|
-
{...props} />
|
|
47
|
-
<IfNotEnabled feature="ReadOnly">
|
|
65
|
+
<ElementDetailsButtonWithHandler {...props} />
|
|
66
|
+
<IfNotReadOnly>
|
|
48
67
|
<ElementToolbar {...props} />
|
|
49
|
-
</
|
|
68
|
+
</IfNotReadOnly>
|
|
50
69
|
<DefaultHandles />
|
|
51
70
|
</ElementNodeContainer>
|
|
52
71
|
))
|
|
72
|
+
ElementNode.displayName = 'ElementNode'
|
|
53
73
|
|
|
54
|
-
export const DeploymentNode = customNode<Types.DeploymentElementNodeData>((props) => (
|
|
74
|
+
export const DeploymentNode = customNode<Types.DeploymentElementNodeData, 'deployment'>((props) => (
|
|
55
75
|
<ElementNodeContainer nodeProps={props}>
|
|
56
|
-
<ElementShape {...props}
|
|
76
|
+
<ElementShape {...props} />
|
|
57
77
|
<ElementTitle {...props} />
|
|
58
78
|
<DeploymentElementActions {...props} />
|
|
59
|
-
{
|
|
60
|
-
|
|
61
|
-
fqn={props.data.modelFqn}
|
|
62
|
-
{...props} />
|
|
63
|
-
)}
|
|
64
|
-
<IfNotEnabled feature="ReadOnly">
|
|
79
|
+
<ElementDetailsButtonWithHandler {...props} />
|
|
80
|
+
<IfNotReadOnly>
|
|
65
81
|
<DeploymentElementToolbar {...props} />
|
|
66
|
-
</
|
|
82
|
+
</IfNotReadOnly>
|
|
67
83
|
<DefaultHandles />
|
|
68
84
|
</ElementNodeContainer>
|
|
69
85
|
))
|
|
86
|
+
DeploymentNode.displayName = 'DeploymentNode'
|
|
70
87
|
|
|
71
|
-
export const CompoundElementNode = customNode<Types.CompoundElementNodeData>((props) => {
|
|
88
|
+
export const CompoundElementNode = customNode<Types.CompoundElementNodeData, 'compound-element'>((props) => {
|
|
72
89
|
const diagram = useDiagram()
|
|
90
|
+
|
|
73
91
|
return (
|
|
74
92
|
<CompoundNodeContainer nodeProps={props}>
|
|
75
93
|
<CompoundTitle {...props} />
|
|
76
94
|
<CompoundActions {...props} />
|
|
77
95
|
<IfEnabled feature="ElementDetails">
|
|
78
|
-
<
|
|
79
|
-
{...props}
|
|
80
|
-
onClick={e => {
|
|
81
|
-
e.stopPropagation()
|
|
82
|
-
diagram.openElementDetails(props.data.modelFqn, props.id as NodeId)
|
|
83
|
-
}} />
|
|
96
|
+
<CompoundDetailsButtonWithHandler {...props} />
|
|
84
97
|
</IfEnabled>
|
|
85
|
-
<
|
|
98
|
+
<IfNotReadOnly>
|
|
86
99
|
<CompoundElementToolbar {...props} />
|
|
87
|
-
</
|
|
100
|
+
</IfNotReadOnly>
|
|
88
101
|
<DefaultHandles />
|
|
89
102
|
</CompoundNodeContainer>
|
|
90
103
|
)
|
|
91
104
|
})
|
|
105
|
+
CompoundElementNode.displayName = 'CompoundElementNode'
|
|
92
106
|
|
|
93
|
-
export const CompoundDeploymentNode = customNode<Types.CompoundDeploymentNodeData>((props) => (
|
|
107
|
+
export const CompoundDeploymentNode = customNode<Types.CompoundDeploymentNodeData, 'compound-deployment'>((props) => (
|
|
94
108
|
<CompoundNodeContainer nodeProps={props}>
|
|
95
109
|
<CompoundTitle {...props} />
|
|
96
110
|
<CompoundActions {...props} />
|
|
97
|
-
<
|
|
111
|
+
<IfNotReadOnly>
|
|
98
112
|
<CompoundDeploymentToolbar {...props} />
|
|
99
|
-
</
|
|
113
|
+
</IfNotReadOnly>
|
|
100
114
|
<DefaultHandles />
|
|
101
115
|
</CompoundNodeContainer>
|
|
102
116
|
))
|
|
117
|
+
CompoundDeploymentNode.displayName = 'CompoundDeploymentNode'
|
|
103
118
|
|
|
104
|
-
export const ViewGroupNode = customNode<Types.ViewGroupNodeData>((props) => (
|
|
119
|
+
export const ViewGroupNode = customNode<Types.ViewGroupNodeData, 'view-group'>((props) => (
|
|
105
120
|
<CompoundNodeContainer nodeProps={props}>
|
|
106
121
|
<CompoundTitle {...props} />
|
|
107
122
|
<DefaultHandles />
|
|
108
123
|
</CompoundNodeContainer>
|
|
109
124
|
))
|
|
125
|
+
ViewGroupNode.displayName = 'ViewGroupNode'
|
|
@@ -2,7 +2,7 @@ import { type BorderStyle } from '@likec4/core'
|
|
|
2
2
|
import { Box, SegmentedControl } from '@mantine/core'
|
|
3
3
|
import { useEffect, useState } from 'react'
|
|
4
4
|
import type { NodeProps } from '../../../../base/types'
|
|
5
|
-
import {
|
|
5
|
+
import { useEnabledFeatures } from '../../../../context/DiagramFeatures'
|
|
6
6
|
import type { Types } from '../../../types'
|
|
7
7
|
import type { OnStyleChange } from './_shared'
|
|
8
8
|
import { BrowseRelationshipsButton, GoToSourceButton, useHandlers } from './_shared'
|
|
@@ -11,7 +11,7 @@ import { Toolbar } from './Toolbar'
|
|
|
11
11
|
|
|
12
12
|
type CompoundElementToolbarProps = NodeProps<Types.CompoundElementNodeData>
|
|
13
13
|
export function CompoundElementToolbar(props: CompoundElementToolbarProps) {
|
|
14
|
-
const { enableVscode, enableRelationshipBrowser } =
|
|
14
|
+
const { enableVscode, enableRelationshipBrowser } = useEnabledFeatures()
|
|
15
15
|
const {
|
|
16
16
|
data: {
|
|
17
17
|
style,
|
|
@@ -20,7 +20,6 @@ export function CompoundElementToolbar(props: CompoundElementToolbarProps) {
|
|
|
20
20
|
} = props
|
|
21
21
|
|
|
22
22
|
const { elementColor, onColorPreview, onChange } = useHandlers(modelFqn, props)
|
|
23
|
-
|
|
24
23
|
return (
|
|
25
24
|
<Toolbar
|
|
26
25
|
nodeProps={props}
|
|
@@ -46,7 +45,7 @@ export function CompoundElementToolbar(props: CompoundElementToolbarProps) {
|
|
|
46
45
|
|
|
47
46
|
type CompoundDeploymentToolbarProps = NodeProps<Types.CompoundDeploymentNodeData>
|
|
48
47
|
export function CompoundDeploymentToolbar(props: CompoundDeploymentToolbarProps) {
|
|
49
|
-
const { enableVscode, enableRelationshipBrowser } =
|
|
48
|
+
const { enableVscode, enableRelationshipBrowser } = useEnabledFeatures()
|
|
50
49
|
const {
|
|
51
50
|
data: {
|
|
52
51
|
deploymentFqn,
|
|
@@ -2,7 +2,7 @@ import { type ElementShape, ElementShapes } from '@likec4/core'
|
|
|
2
2
|
import { Button, Menu, MenuDropdown, MenuItem, MenuTarget } from '@mantine/core'
|
|
3
3
|
import { IconCheck, IconSelector } from '@tabler/icons-react'
|
|
4
4
|
import type { NodeProps } from '../../../../base/types'
|
|
5
|
-
import {
|
|
5
|
+
import { useEnabledFeatures } from '../../../../context/DiagramFeatures'
|
|
6
6
|
import { stopPropagation } from '../../../../utils/xyflow'
|
|
7
7
|
import type { Types } from '../../../types'
|
|
8
8
|
import type { OnStyleChange } from './_shared'
|
|
@@ -12,7 +12,7 @@ import { Toolbar } from './Toolbar'
|
|
|
12
12
|
|
|
13
13
|
type ElementToolbarProps = NodeProps<Types.ElementNodeData>
|
|
14
14
|
export function ElementToolbar(props: ElementToolbarProps) {
|
|
15
|
-
const { enableVscode, enableRelationshipBrowser } =
|
|
15
|
+
const { enableVscode, enableRelationshipBrowser } = useEnabledFeatures()
|
|
16
16
|
const {
|
|
17
17
|
data: {
|
|
18
18
|
shape,
|
|
@@ -45,7 +45,7 @@ export function ElementToolbar(props: ElementToolbarProps) {
|
|
|
45
45
|
|
|
46
46
|
type DeploymentElementToolbarProps = NodeProps<Types.DeploymentElementNodeData>
|
|
47
47
|
export function DeploymentElementToolbar(props: DeploymentElementToolbarProps) {
|
|
48
|
-
const { enableVscode, enableRelationshipBrowser } =
|
|
48
|
+
const { enableVscode, enableRelationshipBrowser } = useEnabledFeatures()
|
|
49
49
|
const {
|
|
50
50
|
data: {
|
|
51
51
|
shape,
|
|
@@ -1,15 +1,16 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { cx as clsx } from '@likec4/styles/css'
|
|
2
|
+
import { Box, Group, Paper, Stack, Text } from '@mantine/core'
|
|
2
3
|
import { useDebouncedValue } from '@mantine/hooks'
|
|
3
4
|
import { type NodeToolbarProps, NodeToolbar } from '@xyflow/react'
|
|
4
|
-
import clsx from 'clsx'
|
|
5
5
|
import type { ReactNode } from 'react'
|
|
6
|
-
import type {
|
|
6
|
+
import type { NodeProps } from '../../../../base/types'
|
|
7
7
|
import { useDiagramContext } from '../../../../hooks/useDiagram'
|
|
8
8
|
import { stopPropagation } from '../../../../utils/xyflow'
|
|
9
|
+
import type { Types } from '../../../types'
|
|
9
10
|
import * as styles from './styles.css'
|
|
10
11
|
|
|
11
12
|
export type ToolbarProps = Omit<NodeToolbarProps, 'title'> & {
|
|
12
|
-
nodeProps:
|
|
13
|
+
nodeProps: NodeProps<Types.NodeData>
|
|
13
14
|
title: ReactNode
|
|
14
15
|
}
|
|
15
16
|
|
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
import type { DiagramEdge, DiagramNode, Fqn, IconUrl, ViewId } from '@likec4/core'
|
|
2
2
|
import type { XYPosition } from '@xyflow/system'
|
|
3
3
|
import type { OptionalKeysOf, Simplify } from 'type-fest'
|
|
4
|
-
import type { Base } from '../base'
|
|
5
|
-
import type { ReactFlowEdge, ReactFlowNode } from '../base/types'
|
|
4
|
+
import type { Base, ReactFlowEdge, ReactFlowNode } from '../base/types'
|
|
6
5
|
|
|
7
6
|
type NonOptional<T extends object> = Simplify<
|
|
8
7
|
& {
|
|
@@ -14,7 +13,8 @@ type NonOptional<T extends object> = Simplify<
|
|
|
14
13
|
>
|
|
15
14
|
|
|
16
15
|
export namespace Types {
|
|
17
|
-
export type LeafNodeData =
|
|
16
|
+
export type LeafNodeData =
|
|
17
|
+
& Base.NodeData
|
|
18
18
|
& NonOptional<
|
|
19
19
|
Pick<
|
|
20
20
|
DiagramNode,
|
|
@@ -32,10 +32,13 @@ export namespace Types {
|
|
|
32
32
|
>
|
|
33
33
|
>
|
|
34
34
|
& {
|
|
35
|
+
/**
|
|
36
|
+
* View this node belongs to
|
|
37
|
+
*/
|
|
38
|
+
viewId: ViewId
|
|
35
39
|
isMultiple?: boolean | undefined
|
|
36
40
|
icon: string | null
|
|
37
41
|
}
|
|
38
|
-
>
|
|
39
42
|
|
|
40
43
|
/**
|
|
41
44
|
* Represents element from logical model
|
|
@@ -61,7 +64,8 @@ export namespace Types {
|
|
|
61
64
|
modelFqn: Fqn | null
|
|
62
65
|
}
|
|
63
66
|
|
|
64
|
-
export type CompoundNodeData =
|
|
67
|
+
export type CompoundNodeData =
|
|
68
|
+
& Base.NodeData
|
|
65
69
|
& NonOptional<
|
|
66
70
|
Pick<
|
|
67
71
|
DiagramNode,
|
|
@@ -74,10 +78,13 @@ export namespace Types {
|
|
|
74
78
|
>
|
|
75
79
|
>
|
|
76
80
|
& {
|
|
81
|
+
/**
|
|
82
|
+
* View this node belongs to
|
|
83
|
+
*/
|
|
84
|
+
viewId: ViewId
|
|
77
85
|
depth: number
|
|
78
86
|
icon?: IconUrl
|
|
79
87
|
}
|
|
80
|
-
>
|
|
81
88
|
|
|
82
89
|
export type CompoundElementNodeData = CompoundNodeData & {
|
|
83
90
|
modelFqn: Fqn
|
|
@@ -116,8 +123,9 @@ export namespace Types {
|
|
|
116
123
|
|
|
117
124
|
export type NodeData = Node['data']
|
|
118
125
|
|
|
119
|
-
export type RelationshipEdgeData =
|
|
120
|
-
|
|
126
|
+
export type RelationshipEdgeData = Simplify<
|
|
127
|
+
& Base.EdgeData
|
|
128
|
+
& NonOptional<
|
|
121
129
|
Pick<
|
|
122
130
|
DiagramEdge,
|
|
123
131
|
| 'id'
|
|
@@ -133,7 +141,8 @@ export namespace Types {
|
|
|
133
141
|
| 'navigateTo'
|
|
134
142
|
| 'notes'
|
|
135
143
|
>
|
|
136
|
-
>
|
|
144
|
+
>
|
|
145
|
+
& {
|
|
137
146
|
labelXY: XYPosition | null
|
|
138
147
|
controlPoints: XYPosition[] | undefined | null
|
|
139
148
|
}
|
|
@@ -142,4 +151,5 @@ export namespace Types {
|
|
|
142
151
|
export type RelationshipEdge = ReactFlowEdge<RelationshipEdgeData, 'relationship'>
|
|
143
152
|
|
|
144
153
|
export type Edge = RelationshipEdge
|
|
154
|
+
export type EdgeData = RelationshipEdgeData
|
|
145
155
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
+
import { cx as clsx } from '@likec4/styles/css'
|
|
1
2
|
import { Button, Card, CardSection, Group, Spoiler, Stack, Text } from '@mantine/core'
|
|
2
3
|
import { useLocalStorage } from '@mantine/hooks'
|
|
3
4
|
import { IconMenu } from '@tabler/icons-react'
|
|
4
|
-
import clsx from 'clsx'
|
|
5
5
|
import { AnimatePresence, m } from 'motion/react'
|
|
6
6
|
import { Link } from '../../../components/Link'
|
|
7
7
|
import { useDiagramContext } from '../../../hooks/useDiagram'
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { type ComputedNode, type ElementNotation as ElementNotationData } from '@likec4/core'
|
|
2
|
-
import { css, cx } from '@likec4/styles/css'
|
|
2
|
+
import { css, cx, cx as clsx } from '@likec4/styles/css'
|
|
3
3
|
import {
|
|
4
4
|
ActionIcon,
|
|
5
5
|
Badge,
|
|
@@ -19,7 +19,6 @@ import {
|
|
|
19
19
|
} from '@mantine/core'
|
|
20
20
|
import { useLocalStorage } from '@mantine/hooks'
|
|
21
21
|
import { IconAlertTriangle, IconArrowDownRight, IconHelpCircle } from '@tabler/icons-react'
|
|
22
|
-
import clsx from 'clsx'
|
|
23
22
|
import { AnimatePresence, m } from 'motion/react'
|
|
24
23
|
import { memo, useState } from 'react'
|
|
25
24
|
import { ceil, isNonNullish } from 'remeda'
|
|
@@ -5,9 +5,8 @@ import {
|
|
|
5
5
|
isAncestor,
|
|
6
6
|
nameFromFqn,
|
|
7
7
|
sortParentsFirst,
|
|
8
|
-
toArray,
|
|
9
8
|
} from '@likec4/core'
|
|
10
|
-
import { cx } from '@likec4/styles/css'
|
|
9
|
+
import { cx, cx as clsx } from '@likec4/styles/css'
|
|
11
10
|
import {
|
|
12
11
|
type RenderTreeNodePayload,
|
|
13
12
|
ActionIcon,
|
|
@@ -22,10 +21,9 @@ import {
|
|
|
22
21
|
} from '@mantine/core'
|
|
23
22
|
import { useCallbackRef } from '@mantine/hooks'
|
|
24
23
|
import { IconChevronRight } from '@tabler/icons-react'
|
|
25
|
-
import clsx from 'clsx'
|
|
26
24
|
import * as m from 'motion/react-m'
|
|
27
25
|
import { type KeyboardEventHandler, useCallback, useEffect, useMemo } from 'react'
|
|
28
|
-
import { first,
|
|
26
|
+
import { first, isEmpty, only, partition, pipe, reduce } from 'remeda'
|
|
29
27
|
import { IconOrShapeRenderer } from '../../../context/IconRenderer'
|
|
30
28
|
import { sortByLabel } from '../../../likec4model/useLikeC4ElementsTree'
|
|
31
29
|
import { useLikeC4Model } from '../../../likec4model/useLikeC4Model'
|