@likec4/diagram 1.17.1 → 1.19.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/LICENSE +1 -1
- package/dist/LikeC4CustomColors.d.ts +7 -0
- package/dist/LikeC4CustomColors.js +30 -0
- package/dist/LikeC4Diagram.css.d.ts +5 -0
- package/dist/LikeC4Diagram.css.js +13 -0
- package/dist/LikeC4Diagram.d.ts +6 -0
- package/dist/LikeC4Diagram.js +194 -0
- package/dist/LikeC4Diagram.props.d.ts +166 -0
- package/dist/LikeC4ModelProvider.d.ts +9 -0
- package/dist/LikeC4ModelProvider.js +12 -0
- package/dist/LikeC4Search.css.d.ts +1 -0
- package/dist/LikeC4Search.css.js +5 -0
- package/dist/LikeC4Search.d.ts +2 -0
- package/dist/LikeC4Search.js +96 -0
- package/dist/StaticLikeC4Diagram.d.ts +3 -0
- package/dist/StaticLikeC4Diagram.js +41 -0
- package/dist/_virtual/_commonjsHelpers.js +6 -0
- package/dist/controls/Text.d.ts +2 -0
- package/dist/controls/Text.js +7 -0
- package/dist/controls/action-button-bar/ActionButtonBar.css.d.ts +1 -0
- package/dist/controls/action-button-bar/ActionButtonBar.css.js +5 -0
- package/dist/controls/action-button-bar/ActionButtonBar.d.ts +9 -0
- package/dist/controls/action-button-bar/ActionButtonBar.js +100 -0
- package/dist/controls/action-button-bar/useActionButtonBarCtx.d.ts +10 -0
- package/dist/controls/action-button-bar/useActionButtonBarCtx.js +9 -0
- package/dist/controls/action-buttons/ActionButton.css.d.ts +1 -0
- package/dist/controls/action-buttons/ActionButton.css.js +5 -0
- package/dist/controls/action-buttons/ActionButton.d.ts +9 -0
- package/dist/controls/action-buttons/ActionButton.js +66 -0
- package/dist/controls/action-buttons/ActionButtons.d.ts +12 -0
- package/dist/controls/action-buttons/ActionButtons.js +99 -0
- package/dist/globals.css.d.ts +1 -0
- package/dist/globals.css.js +92 -0
- package/dist/hooks/index.d.ts +5 -0
- package/dist/hooks/useDiagramState.d.ts +6 -0
- package/dist/hooks/useDiagramState.js +27 -0
- package/dist/hooks/useMantinePortalProps.d.ts +9 -0
- package/dist/hooks/useMantinePortalProps.js +9 -0
- package/dist/hooks/useSetState.d.ts +2 -0
- package/dist/hooks/useSetState.js +19 -0
- package/dist/hooks/useUpdateEffect.d.ts +4 -0
- package/dist/hooks/useUpdateEffect.js +32 -0
- package/dist/hooks/useXYFlow.d.ts +270 -0
- package/dist/hooks/useXYFlow.js +20 -0
- package/dist/index.d.ts +11 -0
- package/dist/index.js +25 -0
- package/dist/likec4model/LikeC4ModelContext.d.ts +3 -0
- package/dist/likec4model/LikeC4ModelContext.js +5 -0
- package/dist/likec4model/index.d.ts +2 -0
- package/dist/likec4model/useLikeC4ElementsTree.d.ts +12 -0
- package/dist/likec4model/useLikeC4ElementsTree.js +25 -0
- package/dist/likec4model/useLikeC4Model.d.ts +20 -0
- package/dist/likec4model/useLikeC4Model.js +55 -0
- package/dist/overlays/OverlayContext.d.ts +10 -0
- package/dist/overlays/OverlayContext.js +9 -0
- package/dist/overlays/Overlays.css.d.ts +3 -0
- package/dist/overlays/Overlays.css.js +7 -0
- package/dist/overlays/Overlays.d.ts +2 -0
- package/dist/overlays/Overlays.js +137 -0
- package/dist/overlays/edge-details/EdgeDetailsXYFlow.d.ts +5 -0
- package/dist/overlays/edge-details/EdgeDetailsXYFlow.js +185 -0
- package/dist/overlays/edge-details/SelectEdge.css.d.ts +7 -0
- package/dist/overlays/edge-details/SelectEdge.css.js +17 -0
- package/dist/overlays/edge-details/SelectEdge.d.ts +5 -0
- package/dist/overlays/edge-details/SelectEdge.js +129 -0
- package/dist/overlays/edge-details/_types.d.ts +14 -0
- package/dist/overlays/edge-details/use-layouted-edge-details.d.ts +21 -0
- package/dist/overlays/edge-details/use-layouted-edge-details.js +270 -0
- package/dist/overlays/edge-details/xyflow/CompoundNode.d.ts +5 -0
- package/dist/overlays/edge-details/xyflow/CompoundNode.js +76 -0
- package/dist/overlays/edge-details/xyflow/ElementNode.d.ts +5 -0
- package/dist/overlays/edge-details/xyflow/ElementNode.js +159 -0
- package/dist/overlays/edge-details/xyflow/RelationshipEdge.d.ts +3 -0
- package/dist/overlays/edge-details/xyflow/RelationshipEdge.js +84 -0
- package/dist/overlays/edge-details/xyflow/styles.css.d.ts +9 -0
- package/dist/overlays/edge-details/xyflow/styles.css.js +21 -0
- package/dist/overlays/element-details/ElementDetailsCard.css.d.ts +16 -0
- package/dist/overlays/element-details/ElementDetailsCard.css.js +33 -0
- package/dist/overlays/element-details/ElementDetailsCard.d.ts +7 -0
- package/dist/overlays/element-details/ElementDetailsCard.js +484 -0
- package/dist/overlays/element-details/TabPanelDeployments.css.d.ts +4 -0
- package/dist/overlays/element-details/TabPanelDeployments.css.js +11 -0
- package/dist/overlays/element-details/TabPanelDeployments.d.ts +7 -0
- package/dist/overlays/element-details/TabPanelDeployments.js +173 -0
- package/dist/overlays/element-details/TabPanelRelationships.css.d.ts +5 -0
- package/dist/overlays/element-details/TabPanelRelationships.css.js +11 -0
- package/dist/overlays/element-details/TabPanelRelationships.d.ts +8 -0
- package/dist/overlays/element-details/TabPanelRelationships.js +157 -0
- package/dist/overlays/element-details/TabPanelStructure.css.d.ts +2 -0
- package/dist/overlays/element-details/TabPanelStructure.css.js +7 -0
- package/dist/overlays/element-details/TabPanelStructure.d.ts +25 -0
- package/dist/overlays/element-details/TabPanelStructure.js +91 -0
- package/dist/overlays/index.d.ts +1 -0
- package/dist/overlays/relationships-of/RelationshipsOverlay.d.ts +5 -0
- package/dist/overlays/relationships-of/RelationshipsOverlay.js +193 -0
- package/dist/overlays/relationships-of/RelationshipsXYFlow.d.ts +19 -0
- package/dist/overlays/relationships-of/RelationshipsXYFlow.js +290 -0
- package/dist/overlays/relationships-of/SelectElement.css.d.ts +2 -0
- package/dist/overlays/relationships-of/SelectElement.css.js +7 -0
- package/dist/overlays/relationships-of/SelectElement.d.ts +7 -0
- package/dist/overlays/relationships-of/SelectElement.js +126 -0
- package/dist/overlays/relationships-of/_types.d.ts +28 -0
- package/dist/overlays/relationships-of/use-layouted-relationships.d.ts +22 -0
- package/dist/overlays/relationships-of/use-layouted-relationships.js +496 -0
- package/dist/overlays/relationships-of/xyflow/CompoundNode.d.ts +6 -0
- package/dist/overlays/relationships-of/xyflow/CompoundNode.js +120 -0
- package/dist/overlays/relationships-of/xyflow/ElementNode.d.ts +6 -0
- package/dist/overlays/relationships-of/xyflow/ElementNode.js +194 -0
- package/dist/overlays/relationships-of/xyflow/EmptyNode.d.ts +5 -0
- package/dist/overlays/relationships-of/xyflow/EmptyNode.js +18 -0
- package/dist/overlays/relationships-of/xyflow/RelationshipEdge.d.ts +3 -0
- package/dist/overlays/relationships-of/xyflow/RelationshipEdge.js +123 -0
- package/dist/overlays/relationships-of/xyflow/styles.css.d.ts +14 -0
- package/dist/overlays/relationships-of/xyflow/styles.css.js +24 -0
- package/dist/overlays/shared/xyflow/RelationshipEdge.css.d.ts +4 -0
- package/dist/overlays/shared/xyflow/RelationshipEdge.css.js +12 -0
- package/dist/overlays/shared/xyflow/_types.d.ts +77 -0
- package/dist/state/DiagramContext.d.ts +1609 -0
- package/dist/state/DiagramContext.js +101 -0
- package/dist/state/aligners.d.ts +42 -0
- package/dist/state/aligners.js +349 -0
- package/dist/state/diagram-to-xyflow.d.ts +11 -0
- package/dist/state/diagram-to-xyflow.js +113 -0
- package/dist/state/diagramStore.d.ts +1705 -0
- package/dist/state/diagramStore.js +808 -0
- package/dist/state/diagramStore.layout.d.ts +4 -0
- package/dist/state/diagramStore.layout.js +56 -0
- package/dist/style.css +1 -0
- package/dist/theme-vars.css.d.ts +72 -0
- package/dist/theme-vars.css.js +6 -0
- package/dist/theme-vars.css.ts.vanilla.css.js +1 -0
- package/dist/theme-vars.d.ts +3 -0
- package/dist/theme-vars.js +5 -0
- package/dist/ui/DiagramTitlePanel.css.d.ts +4 -0
- package/dist/ui/DiagramTitlePanel.css.js +11 -0
- package/dist/ui/DiagramTitlePanel.d.ts +1 -0
- package/dist/ui/DiagramTitlePanel.js +159 -0
- package/dist/ui/DynamicViewWalkthrough.css.d.ts +4 -0
- package/dist/ui/DynamicViewWalkthrough.css.js +11 -0
- package/dist/ui/DynamicViewWalkthrough.d.ts +1 -0
- package/dist/ui/DynamicViewWalkthrough.js +156 -0
- package/dist/ui/EnsureMantine.d.ts +7 -0
- package/dist/ui/EnsureMantine.js +14 -0
- package/dist/ui/FramerMotionConfig.d.ts +2 -0
- package/dist/ui/FramerMotionConfig.js +14 -0
- package/dist/ui/Link.d.ts +4 -0
- package/dist/ui/Link.js +36 -0
- package/dist/ui/notation/NotationPanel.css.d.ts +6 -0
- package/dist/ui/notation/NotationPanel.css.js +16 -0
- package/dist/ui/notation/NotationPanel.d.ts +1 -0
- package/dist/ui/notation/NotationPanel.js +250 -0
- package/dist/ui/notation/index.d.ts +1 -0
- package/dist/ui/top-left/ChangeAutoLayoutButton.d.ts +2 -0
- package/dist/ui/top-left/ChangeAutoLayoutButton.js +159 -0
- package/dist/ui/top-left/ManualLayoutToolsButton.d.ts +2 -0
- package/dist/ui/top-left/ManualLayoutToolsButton.js +137 -0
- package/dist/ui/top-left/TopLeftPanel.d.ts +4 -0
- package/dist/ui/top-left/TopLeftPanel.js +211 -0
- package/dist/ui/top-left/_shared.d.ts +7 -0
- package/dist/ui/top-left/_shared.js +22 -0
- package/dist/ui/top-left/styles.css.d.ts +8 -0
- package/dist/ui/top-left/styles.css.js +17 -0
- package/dist/utils/types.d.ts +8 -0
- package/dist/utils/vector.d.ts +24 -0
- package/dist/utils/vector.js +55 -0
- package/dist/xyflow/EdgeMarkers.d.ts +12 -0
- package/dist/xyflow/EdgeMarkers.js +192 -0
- package/dist/xyflow/FitviewOnDiagramChange.d.ts +4 -0
- package/dist/xyflow/FitviewOnDiagramChange.js +72 -0
- package/dist/xyflow/SelectEdgesOnNodeFocus.d.ts +1 -0
- package/dist/xyflow/SelectEdgesOnNodeFocus.js +96 -0
- package/dist/xyflow/XYFlow.d.ts +8 -0
- package/dist/xyflow/XYFlow.js +145 -0
- package/dist/xyflow/XYFlowBackground.d.ts +10 -0
- package/dist/xyflow/XYFlowBackground.js +25 -0
- package/dist/xyflow/XYFlowInner.d.ts +8 -0
- package/dist/xyflow/XYFlowInner.js +41 -0
- package/dist/xyflow/const.d.ts +7 -0
- package/dist/xyflow/const.js +12 -0
- package/dist/xyflow/edges/EdgeLabel.d.ts +7 -0
- package/dist/xyflow/edges/EdgeLabel.js +160 -0
- package/dist/xyflow/edges/RelationshipEdge.d.ts +6 -0
- package/dist/xyflow/edges/RelationshipEdge.js +443 -0
- package/dist/xyflow/edges/RelationshipsDropdownMenu.css.d.ts +4 -0
- package/dist/xyflow/edges/RelationshipsDropdownMenu.css.js +11 -0
- package/dist/xyflow/edges/RelationshipsDropdownMenu.d.ts +13 -0
- package/dist/xyflow/edges/RelationshipsDropdownMenu.js +211 -0
- package/dist/xyflow/edges/edges.css.d.ts +17 -0
- package/dist/xyflow/edges/edges.css.js +37 -0
- package/dist/xyflow/edges/utils.d.ts +16 -0
- package/dist/xyflow/edges/utils.js +24 -0
- package/dist/xyflow/nodes/AnimateVariants.d.ts +1313 -0
- package/dist/xyflow/nodes/AnimateVariants.js +123 -0
- package/dist/xyflow/nodes/Node.css.d.ts +3 -0
- package/dist/xyflow/nodes/Node.css.js +9 -0
- package/dist/xyflow/nodes/compound/CompoundNode.css.d.ts +14 -0
- package/dist/xyflow/nodes/compound/CompoundNode.css.js +27 -0
- package/dist/xyflow/nodes/compound/CompoundNode.d.ts +6 -0
- package/dist/xyflow/nodes/compound/CompoundNode.js +216 -0
- package/dist/xyflow/nodes/compound/index.d.ts +1 -0
- package/dist/xyflow/nodes/element/ElementLink.css.d.ts +3 -0
- package/dist/xyflow/nodes/element/ElementLink.d.ts +6 -0
- package/dist/xyflow/nodes/element/ElementNode.d.ts +6 -0
- package/dist/xyflow/nodes/element/ElementNode.js +190 -0
- package/dist/xyflow/nodes/element/ElementShapeSvg.d.ts +17 -0
- package/dist/xyflow/nodes/element/ElementShapeSvg.js +175 -0
- package/dist/xyflow/nodes/element/element.css.d.ts +18 -0
- package/dist/xyflow/nodes/element/element.css.js +31 -0
- package/dist/xyflow/nodes/element/index.d.ts +1 -0
- package/dist/xyflow/nodes/shared/ElementIcon.d.ts +8 -0
- package/dist/xyflow/nodes/shared/ElementIcon.js +38 -0
- package/dist/xyflow/nodes/shared/Toolbar.d.ts +9 -0
- package/dist/xyflow/nodes/shared/Toolbar.js +436 -0
- package/dist/xyflow/types.d.ts +36 -0
- package/dist/xyflow/useLayoutConstraints.d.ts +42 -0
- package/dist/xyflow/useLayoutConstraints.js +226 -0
- package/dist/xyflow/useXYFlowEvents.d.ts +160 -0
- package/dist/xyflow/useXYFlowEvents.js +275 -0
- package/dist/xyflow/utils.d.ts +22 -0
- package/dist/xyflow/utils.js +72 -0
- package/package.json +40 -31
- package/src/LikeC4Diagram.props.ts +21 -12
- package/src/LikeC4Diagram.tsx +8 -10
- package/src/LikeC4Search.css.ts +12 -0
- package/src/LikeC4Search.tsx +45 -93
- package/src/controls/Text.ts +5 -0
- package/src/controls/action-button-bar/ActionButtonBar.css.ts +13 -0
- package/src/controls/action-button-bar/ActionButtonBar.tsx +138 -0
- package/src/controls/action-button-bar/useActionButtonBarCtx.ts +13 -0
- package/src/controls/action-buttons/ActionButton.css.ts +29 -0
- package/src/controls/action-buttons/ActionButton.tsx +66 -0
- package/src/controls/action-buttons/ActionButtons.tsx +138 -0
- package/src/hooks/useDiagramState.ts +8 -3
- package/src/hooks/useXYFlow.ts +9 -8
- package/src/index.ts +12 -6
- package/src/likec4model/index.ts +12 -2
- package/src/likec4model/useLikeC4ElementsTree.ts +6 -13
- package/src/likec4model/useLikeC4Model.ts +21 -11
- package/src/overlays/Overlays.tsx +96 -63
- package/src/overlays/edge-details/EdgeDetailsXYFlow.tsx +18 -10
- package/src/overlays/edge-details/_types.ts +13 -33
- package/src/overlays/edge-details/use-layouted-edge-details.ts +35 -26
- package/src/overlays/edge-details/xyflow/CompoundNode.tsx +3 -11
- package/src/overlays/edge-details/xyflow/ElementNode.tsx +8 -13
- package/src/overlays/edge-details/xyflow/RelationshipEdge.tsx +7 -7
- package/src/overlays/edge-details/xyflow/styles.css.ts +1 -59
- package/src/overlays/element-details/ElementDetailsCard.tsx +91 -78
- package/src/overlays/element-details/TabPanelDeployments.css.ts +69 -0
- package/src/overlays/element-details/TabPanelDeployments.tsx +217 -0
- package/src/overlays/element-details/TabPanelRelationships.tsx +8 -9
- package/src/overlays/element-details/TabPanelStructure.tsx +10 -10
- package/src/overlays/relationships-of/RelationshipsOverlay.tsx +1 -1
- package/src/overlays/relationships-of/RelationshipsXYFlow.tsx +26 -34
- package/src/overlays/relationships-of/SelectElement.tsx +2 -2
- package/src/overlays/relationships-of/_types.ts +20 -58
- package/src/overlays/relationships-of/use-layouted-relationships.ts +54 -59
- package/src/overlays/relationships-of/xyflow/CompoundNode.tsx +10 -16
- package/src/overlays/relationships-of/xyflow/ElementNode.tsx +24 -21
- package/src/overlays/relationships-of/xyflow/EmptyNode.tsx +4 -7
- package/src/overlays/relationships-of/xyflow/RelationshipEdge.tsx +16 -15
- package/src/overlays/shared/xyflow/RelationshipEdge.css.ts +60 -0
- package/src/overlays/shared/xyflow/_types.ts +87 -0
- package/src/state/diagram-to-xyflow.ts +6 -7
- package/src/state/diagramStore.layout.ts +3 -4
- package/src/state/diagramStore.ts +63 -48
- package/src/theme-vars.css.ts +81 -0
- package/src/theme-vars.ts +8 -81
- package/src/ui/DiagramTitlePanel.tsx +7 -34
- package/src/ui/Link.tsx +40 -0
- package/src/ui/notation/NotationPanel.tsx +4 -2
- package/src/ui/top-left/ChangeAutoLayoutButton.tsx +2 -2
- package/src/ui/top-left/TopLeftPanel.tsx +5 -5
- package/src/utils/types.ts +6 -0
- package/src/xyflow/SelectEdgesOnNodeFocus.tsx +3 -3
- package/src/xyflow/XYFlow.tsx +2 -2
- package/src/xyflow/edges/EdgeLabel.tsx +26 -19
- package/src/xyflow/edges/RelationshipEdge.tsx +5 -3
- package/src/xyflow/edges/RelationshipsDropdownMenu.tsx +23 -10
- package/src/xyflow/edges/edges.css.ts +68 -74
- package/src/xyflow/edges/utils.ts +6 -6
- package/src/xyflow/nodes/AnimateVariants.ts +143 -0
- package/src/xyflow/nodes/Node.css.ts +44 -0
- package/src/xyflow/nodes/compound/CompoundNode.css.ts +27 -75
- package/src/xyflow/nodes/compound/CompoundNode.tsx +82 -163
- package/src/xyflow/nodes/element/ElementLink.tsx +2 -3
- package/src/xyflow/nodes/element/ElementNode.tsx +73 -252
- package/src/xyflow/nodes/element/element.css.ts +40 -64
- package/src/xyflow/nodes/shared/ElementIcon.tsx +1 -1
- package/src/xyflow/nodes/shared/Toolbar.tsx +51 -35
- package/src/xyflow/types.ts +48 -51
- package/src/xyflow/useLayoutConstraints.ts +10 -10
- package/src/xyflow/useXYFlowEvents.ts +31 -35
- package/src/xyflow/utils.ts +2 -2
- package/src/ui/OptionsPanel.css.ts +0 -9
- package/src/ui/OptionsPanel.tsx +0 -70
- package/src/ui/options/EdgeOptions.tsx +0 -142
- package/src/ui/options/NodeOptions.tsx +0 -362
- package/src/xyflow/nodes/element/ElementDetails.css.ts +0 -101
- package/src/xyflow/nodes/element/ElementDetails.tsx +0 -393
- package/src/xyflow/nodes/use-animate-variants.tsx +0 -64
|
@@ -1,26 +1,25 @@
|
|
|
1
|
-
import { type ThemeColor } from '@likec4/core'
|
|
2
|
-
import {
|
|
1
|
+
import { type ThemeColor, DiagramNode } from '@likec4/core'
|
|
2
|
+
import { Box, Text } from '@mantine/core'
|
|
3
3
|
import { useDebouncedValue } from '@mantine/hooks'
|
|
4
|
-
import { IconId, IconTransform, IconZoomScan } from '@tabler/icons-react'
|
|
5
4
|
import { assignInlineVars } from '@vanilla-extract/dynamic'
|
|
6
|
-
import {
|
|
5
|
+
import { type NodeProps, Handle, Position } from '@xyflow/react'
|
|
7
6
|
import clsx from 'clsx'
|
|
8
7
|
import { deepEqual as eq } from 'fast-equals'
|
|
9
|
-
import { m
|
|
10
|
-
import { memo,
|
|
11
|
-
import { clamp
|
|
8
|
+
import { m } from 'framer-motion'
|
|
9
|
+
import { memo, useState } from 'react'
|
|
10
|
+
import { clamp } from 'remeda'
|
|
11
|
+
import { ActionButtonBar } from '../../../controls/action-button-bar/ActionButtonBar'
|
|
12
|
+
import { NavigateToButton, OpenDetailsButton } from '../../../controls/action-buttons/ActionButtons'
|
|
12
13
|
import { useDiagramState } from '../../../hooks/useDiagramState'
|
|
13
|
-
import type {
|
|
14
|
-
import {
|
|
14
|
+
import type { DiagramFlowTypes } from '../../types'
|
|
15
|
+
import { toDomPrecision } from '../../utils'
|
|
16
|
+
import { type VariantKeys, NodeVariants, useFramerAnimateVariants } from '../AnimateVariants'
|
|
17
|
+
import * as nodeCss from '../Node.css'
|
|
15
18
|
import { ElementIcon } from '../shared/ElementIcon'
|
|
16
19
|
import { CompoundToolbar } from '../shared/Toolbar'
|
|
17
|
-
import { useFramerAnimateVariants } from '../use-animate-variants'
|
|
18
20
|
import * as css from './CompoundNode.css'
|
|
19
21
|
|
|
20
|
-
type CompoundNodeProps =
|
|
21
|
-
NodeProps<CompoundXYFlowNode>,
|
|
22
|
-
'id' | 'data' | 'selected' | 'dragging'
|
|
23
|
-
>
|
|
22
|
+
type CompoundNodeProps = NodeProps<DiagramFlowTypes.CompoundNode>
|
|
24
23
|
|
|
25
24
|
const isEqualProps = (prev: CompoundNodeProps, next: CompoundNodeProps) => (
|
|
26
25
|
prev.id === next.id
|
|
@@ -29,66 +28,6 @@ const isEqualProps = (prev: CompoundNodeProps, next: CompoundNodeProps) => (
|
|
|
29
28
|
&& eq(prev.data, next.data)
|
|
30
29
|
)
|
|
31
30
|
|
|
32
|
-
const VariantsRoot = {
|
|
33
|
-
idle: {
|
|
34
|
-
transition: {
|
|
35
|
-
delayChildren: .1
|
|
36
|
-
// stagger
|
|
37
|
-
}
|
|
38
|
-
},
|
|
39
|
-
selected: {},
|
|
40
|
-
hovered: {},
|
|
41
|
-
tap: {}
|
|
42
|
-
} satisfies Variants
|
|
43
|
-
|
|
44
|
-
const VariantsNavigate = {
|
|
45
|
-
idle: {
|
|
46
|
-
'--ai-bg': 'var(--ai-bg-idle)',
|
|
47
|
-
scale: 1,
|
|
48
|
-
opacity: 0.8,
|
|
49
|
-
originX: 1,
|
|
50
|
-
originY: 0.25,
|
|
51
|
-
translateX: 0,
|
|
52
|
-
translateY: 0
|
|
53
|
-
},
|
|
54
|
-
selected: {},
|
|
55
|
-
hovered: {
|
|
56
|
-
'--ai-bg': 'var(--ai-bg-hover)',
|
|
57
|
-
scale: 1.25,
|
|
58
|
-
opacity: 1,
|
|
59
|
-
translateX: -1
|
|
60
|
-
},
|
|
61
|
-
'hovered:navigate': {
|
|
62
|
-
scale: 1.42
|
|
63
|
-
},
|
|
64
|
-
'hovered:relations': {},
|
|
65
|
-
'tap:navigate': {
|
|
66
|
-
scale: 1.15
|
|
67
|
-
}
|
|
68
|
-
} satisfies Variants
|
|
69
|
-
VariantsNavigate['selected'] = VariantsNavigate['hovered']
|
|
70
|
-
|
|
71
|
-
const VariantsDetailsBtn = {
|
|
72
|
-
idle: {
|
|
73
|
-
'--ai-bg': 'var(--ai-bg-idle)',
|
|
74
|
-
scale: 1,
|
|
75
|
-
opacity: 0.3
|
|
76
|
-
},
|
|
77
|
-
selected: {},
|
|
78
|
-
hovered: {
|
|
79
|
-
scale: 1.2,
|
|
80
|
-
opacity: 0.6
|
|
81
|
-
},
|
|
82
|
-
'hovered:details': {
|
|
83
|
-
scale: 1.42,
|
|
84
|
-
opacity: 1
|
|
85
|
-
},
|
|
86
|
-
'tap:details': {
|
|
87
|
-
scale: 1.15
|
|
88
|
-
}
|
|
89
|
-
} satisfies Variants
|
|
90
|
-
VariantsDetailsBtn['selected'] = VariantsDetailsBtn['hovered']
|
|
91
|
-
|
|
92
31
|
export const CompoundNodeMemo = /* @__PURE__ */ memo<CompoundNodeProps>((
|
|
93
32
|
{
|
|
94
33
|
id,
|
|
@@ -96,125 +35,128 @@ export const CompoundNodeMemo = /* @__PURE__ */ memo<CompoundNodeProps>((
|
|
|
96
35
|
dragging = false,
|
|
97
36
|
data: {
|
|
98
37
|
isViewGroup,
|
|
99
|
-
element
|
|
100
|
-
}
|
|
101
|
-
|
|
38
|
+
element,
|
|
39
|
+
},
|
|
40
|
+
width,
|
|
41
|
+
height,
|
|
42
|
+
},
|
|
102
43
|
) => {
|
|
44
|
+
const modelRef = DiagramNode.modelRef(element)
|
|
103
45
|
const { depth, style, color } = element
|
|
104
46
|
const isNotViewGroup = !isViewGroup
|
|
105
47
|
const opacity = clamp((style.opacity ?? 100) / 100, {
|
|
106
48
|
min: 0,
|
|
107
|
-
max: 1
|
|
49
|
+
max: 1,
|
|
108
50
|
})
|
|
109
|
-
const
|
|
51
|
+
const MAX_TRANSPARENCY = 40
|
|
52
|
+
const borderTransparency = clamp(MAX_TRANSPARENCY - opacity * MAX_TRANSPARENCY, {
|
|
110
53
|
min: 0,
|
|
111
|
-
max:
|
|
54
|
+
max: MAX_TRANSPARENCY,
|
|
112
55
|
})
|
|
113
56
|
|
|
114
57
|
const {
|
|
115
58
|
viewId,
|
|
116
|
-
triggerOnNavigateTo,
|
|
117
|
-
openOverlay,
|
|
118
59
|
isEditable,
|
|
119
|
-
isHovered,
|
|
120
60
|
isDimmed,
|
|
121
61
|
isInteractive,
|
|
122
62
|
isNavigable,
|
|
123
63
|
renderIcon,
|
|
124
|
-
|
|
64
|
+
isInActiveOverlay,
|
|
65
|
+
enableElementDetails,
|
|
125
66
|
} = useDiagramState(s => ({
|
|
126
67
|
viewId: s.view.id,
|
|
127
|
-
triggerOnNavigateTo: s.triggerOnNavigateTo,
|
|
128
|
-
openOverlay: s.openOverlay,
|
|
129
68
|
isEditable: s.readonly !== true,
|
|
130
|
-
isHovered: s.hoveredNodeId === id,
|
|
131
69
|
isDimmed: s.dimmed.has(id),
|
|
132
70
|
isInteractive: s.nodesDraggable || s.nodesSelectable || s.enableElementDetails
|
|
133
71
|
|| (!!s.onNavigateTo && !!element.navigateTo),
|
|
134
72
|
// If this is a view group, we don't want to show the navigate button
|
|
135
73
|
isNavigable: isNotViewGroup && !!s.onNavigateTo && !!element.navigateTo,
|
|
136
74
|
renderIcon: s.renderIcon,
|
|
137
|
-
|
|
75
|
+
isInActiveOverlay: (s.activeOverlay?.elementDetails ?? s.activeOverlay?.relationshipsOf) === id,
|
|
76
|
+
enableElementDetails: isNotViewGroup && s.enableElementDetails,
|
|
138
77
|
}))
|
|
139
|
-
const _isToolbarVisible = isNotViewGroup && isEditable && (isHovered || (import.meta.env.DEV && selected))
|
|
140
|
-
const [isToolbarVisible] = useDebouncedValue(_isToolbarVisible, _isToolbarVisible ? 500 : 300)
|
|
141
78
|
|
|
142
|
-
const
|
|
79
|
+
const w = toDomPrecision(width ?? element.width)
|
|
80
|
+
const h = toDomPrecision(height ?? element.height)
|
|
143
81
|
|
|
144
|
-
let
|
|
82
|
+
let animateVariant: VariantKeys | string[]
|
|
145
83
|
switch (true) {
|
|
84
|
+
case isInActiveOverlay:
|
|
85
|
+
animateVariant = 'idle'
|
|
86
|
+
break
|
|
146
87
|
case dragging && selected:
|
|
147
|
-
|
|
88
|
+
animateVariant = 'selected'
|
|
148
89
|
break
|
|
149
90
|
case dragging:
|
|
150
|
-
|
|
91
|
+
animateVariant = 'idle'
|
|
151
92
|
break
|
|
152
|
-
case
|
|
153
|
-
|
|
93
|
+
case isDimmed:
|
|
94
|
+
animateVariant = 'dimmed'
|
|
154
95
|
break
|
|
155
96
|
case selected:
|
|
156
|
-
|
|
97
|
+
animateVariant = 'selected'
|
|
157
98
|
break
|
|
158
99
|
default:
|
|
159
|
-
|
|
100
|
+
animateVariant = 'idle'
|
|
160
101
|
}
|
|
161
102
|
|
|
162
|
-
const [
|
|
103
|
+
const [animateVariants, animateHandlers] = useFramerAnimateVariants()
|
|
104
|
+
if (!dragging && !isInActiveOverlay) {
|
|
105
|
+
animateVariant = animateVariants ?? animateVariant
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
const isHovered = Array.isArray(animateVariant) && animateVariant.includes('hovered')
|
|
109
|
+
|
|
110
|
+
const _isToolbarVisible = isNotViewGroup && ((selected && !dragging) || isHovered)
|
|
111
|
+
const [isToolbarVisible] = useDebouncedValue(_isToolbarVisible, _isToolbarVisible ? 500 : 300)
|
|
163
112
|
|
|
164
|
-
const
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
113
|
+
const nodeVariants = NodeVariants(w, h, {
|
|
114
|
+
selectedScaleBy: 0,
|
|
115
|
+
hoveredScaleBy: 0,
|
|
116
|
+
tapScaleBy: -10,
|
|
117
|
+
})
|
|
168
118
|
|
|
169
|
-
const
|
|
170
|
-
e.stopPropagation()
|
|
171
|
-
openOverlay({ elementDetails: element.id })
|
|
172
|
-
}, [openOverlay, element.id])
|
|
119
|
+
const [previewColor, setPreviewColor] = useState<ThemeColor | null>(null)
|
|
173
120
|
|
|
174
121
|
const elementIcon = ElementIcon({
|
|
175
122
|
element,
|
|
176
123
|
viewId,
|
|
177
124
|
className: css.elementIcon,
|
|
178
|
-
renderIcon
|
|
125
|
+
renderIcon,
|
|
179
126
|
})
|
|
180
127
|
|
|
181
128
|
return (
|
|
182
129
|
<>
|
|
183
|
-
{
|
|
130
|
+
{isEditable && (
|
|
184
131
|
<CompoundToolbar
|
|
185
|
-
isVisible
|
|
132
|
+
isVisible={isToolbarVisible}
|
|
186
133
|
element={element}
|
|
187
134
|
align="start"
|
|
188
135
|
onColorPreview={setPreviewColor} />
|
|
189
136
|
)}
|
|
190
137
|
<Box
|
|
191
138
|
component={m.div}
|
|
139
|
+
variants={nodeVariants}
|
|
192
140
|
key={`${viewId}:element:${id}`}
|
|
193
141
|
layoutId={`${viewId}:element:${id}`}
|
|
194
142
|
className={css.containerForFramer}>
|
|
195
143
|
<Box
|
|
196
144
|
component={m.div}
|
|
197
|
-
variants={VariantsRoot}
|
|
198
|
-
initial={false}
|
|
199
|
-
animate={(isHovered && !dragging) ? (animateVariants ?? animate) : animate}
|
|
200
145
|
className={clsx(
|
|
201
146
|
css.container,
|
|
202
147
|
'likec4-compound-node',
|
|
203
148
|
opacity < 1 && 'likec4-compound-transparent',
|
|
204
|
-
isDimmed && css.dimmed
|
|
205
149
|
)}
|
|
150
|
+
initial={false}
|
|
151
|
+
variants={nodeVariants}
|
|
152
|
+
animate={animateVariant}
|
|
153
|
+
{...isInteractive && animateHandlers}
|
|
206
154
|
mod={{
|
|
207
155
|
'animate-target': '',
|
|
208
156
|
'compound-depth': depth,
|
|
209
157
|
'likec4-color': previewColor ?? color,
|
|
210
|
-
hovered: isHovered
|
|
211
158
|
}}
|
|
212
159
|
tabIndex={-1}
|
|
213
|
-
{...(isInteractive && {
|
|
214
|
-
onTapStart: animateHandlers.onTapStart,
|
|
215
|
-
onTap: animateHandlers.onTap,
|
|
216
|
-
onTapCancel: animateHandlers.onTapCancel
|
|
217
|
-
})}
|
|
218
160
|
>
|
|
219
161
|
<svg className={css.indicator}>
|
|
220
162
|
<rect
|
|
@@ -229,23 +171,29 @@ export const CompoundNodeMemo = /* @__PURE__ */ memo<CompoundNodeProps>((
|
|
|
229
171
|
className={clsx(
|
|
230
172
|
css.compoundBody,
|
|
231
173
|
opacity < 1 && css.transparent,
|
|
232
|
-
'likec4-compound'
|
|
174
|
+
'likec4-compound',
|
|
233
175
|
)}
|
|
234
176
|
style={{
|
|
235
177
|
...(opacity < 1 && {
|
|
236
178
|
...assignInlineVars({
|
|
237
179
|
[css.varBorderTransparency]: `${borderTransparency}%`,
|
|
238
|
-
[css.varOpacity]: opacity.toFixed(2)
|
|
180
|
+
[css.varOpacity]: opacity.toFixed(2),
|
|
239
181
|
}),
|
|
240
|
-
|
|
241
|
-
|
|
182
|
+
...style.border === 'none'
|
|
183
|
+
? {
|
|
184
|
+
borderColor: 'transparent',
|
|
185
|
+
}
|
|
186
|
+
: {
|
|
187
|
+
borderStyle: style.border ?? 'dashed',
|
|
188
|
+
},
|
|
189
|
+
}),
|
|
242
190
|
}}
|
|
243
191
|
>
|
|
244
192
|
<Box
|
|
245
193
|
className={clsx(
|
|
246
194
|
css.compoundTitle,
|
|
247
195
|
isNavigable && css.withNavigation,
|
|
248
|
-
'likec4-compound-title'
|
|
196
|
+
'likec4-compound-title',
|
|
249
197
|
)}>
|
|
250
198
|
{elementIcon}
|
|
251
199
|
<Text
|
|
@@ -255,48 +203,19 @@ export const CompoundNodeMemo = /* @__PURE__ */ memo<CompoundNodeProps>((
|
|
|
255
203
|
className={css.title}>
|
|
256
204
|
{element.title}
|
|
257
205
|
</Text>
|
|
258
|
-
{enableElementDetails && (
|
|
259
|
-
<
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
label="Open details"
|
|
263
|
-
withinPortal={false}
|
|
264
|
-
offset={2}
|
|
265
|
-
openDelay={600}>
|
|
266
|
-
<ActionIcon
|
|
267
|
-
component={m.div}
|
|
268
|
-
variants={VariantsDetailsBtn}
|
|
269
|
-
data-animate-target="details"
|
|
270
|
-
className={clsx('nodrag nopan', css.detailsBtn)}
|
|
271
|
-
radius="md"
|
|
272
|
-
style={{ zIndex: 100 }}
|
|
273
|
-
role="button"
|
|
274
|
-
onClick={onOpenDetails}
|
|
275
|
-
onDoubleClick={stopPropagation}
|
|
276
|
-
{...isInteractive && animateHandlers}
|
|
277
|
-
>
|
|
278
|
-
<IconId stroke={1.8} style={{ width: '75%' }} />
|
|
279
|
-
</ActionIcon>
|
|
280
|
-
</Tooltip>
|
|
206
|
+
{enableElementDetails && !!modelRef && (
|
|
207
|
+
<Box className={clsx(nodeCss.topRightBtnContainer)}>
|
|
208
|
+
<OpenDetailsButton fqn={modelRef} {...isInteractive && animateHandlers} />
|
|
209
|
+
</Box>
|
|
281
210
|
)}
|
|
282
211
|
</Box>
|
|
283
212
|
</Box>
|
|
284
213
|
{isNavigable && (
|
|
285
|
-
<
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
className={clsx('nodrag nopan', css.navigateBtn)}
|
|
291
|
-
radius="md"
|
|
292
|
-
style={{ zIndex: 100 }}
|
|
293
|
-
onClick={onNavigateTo}
|
|
294
|
-
role="button"
|
|
295
|
-
onDoubleClick={stopPropagation}
|
|
296
|
-
{...isInteractive && animateHandlers}
|
|
297
|
-
>
|
|
298
|
-
<IconZoomScan style={{ width: '75%' }} />
|
|
299
|
-
</ActionIcon>
|
|
214
|
+
<Box className={clsx(nodeCss.topLeftBtnContainer)}>
|
|
215
|
+
<ActionButtonBar shiftX="left">
|
|
216
|
+
<NavigateToButton xynodeId={id} {...isInteractive && animateHandlers} />
|
|
217
|
+
</ActionButtonBar>
|
|
218
|
+
</Box>
|
|
300
219
|
)}
|
|
301
220
|
</Box>
|
|
302
221
|
</Box>
|
|
@@ -16,12 +16,11 @@ import clsx from 'clsx'
|
|
|
16
16
|
import { useId } from 'react'
|
|
17
17
|
import { clamp } from 'remeda'
|
|
18
18
|
import { useMantinePortalProps } from '../../../hooks/useMantinePortalProps'
|
|
19
|
-
import { type DiagramState } from '../../../state/diagramStore'
|
|
20
|
-
import type { XYFlowNode } from '../../types'
|
|
21
19
|
import { elementLink, trigger } from './ElementLink.css'
|
|
20
|
+
import type { DiagramFlowTypes } from '../../types'
|
|
22
21
|
|
|
23
22
|
type ElementLinkProps = {
|
|
24
|
-
element:
|
|
23
|
+
element: DiagramFlowTypes.Node['data']['element']
|
|
25
24
|
}
|
|
26
25
|
|
|
27
26
|
const stopEventPropagation = (e: React.MouseEvent) => e.stopPropagation()
|