@likec4/diagram 1.27.3 → 1.28.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/bundle/index.js +974 -1036
- package/dist/LikeC4CustomColors.js +2 -2
- package/dist/LikeC4Diagram.js +2 -2
- package/dist/LikeC4ModelProvider.js +1 -1
- package/dist/_virtual/index.js +5 -0
- package/dist/_virtual/index2.js +3 -0
- package/dist/_virtual/react.production.js +3 -0
- package/dist/base/BaseXYFlow.js +5 -5
- package/dist/base/primitives/compound/CompoundActionButton.js +1 -1
- package/dist/base/primitives/compound/CompoundDetailsButton.js +1 -1
- package/dist/base/primitives/compound/CompoundNodeContainer.d.ts +1 -1
- package/dist/base/primitives/compound/CompoundNodeContainer.js +2 -2
- package/dist/base/primitives/customEdge.js +2 -2
- package/dist/base/primitives/customNode.js +2 -2
- package/dist/base/primitives/edge/EdgeActionButton.d.ts +1 -2
- package/dist/base/primitives/edge/EdgeContainer.js +1 -1
- package/dist/base/primitives/edge/EdgeLabel.js +1 -1
- package/dist/base/primitives/edge/EdgeLabelContainer.js +1 -1
- package/dist/base/primitives/edge/EdgePath.d.ts +10 -42
- package/dist/base/primitives/edge/EdgePath.js +23 -16
- package/dist/base/primitives/edge/edge.css.js +1 -1
- package/dist/base/primitives/element/ElementActionButtons.d.ts +1 -1
- package/dist/base/primitives/element/ElementActionButtons.js +6 -5
- package/dist/base/primitives/element/ElementDetailsButton.js +5 -2
- package/dist/base/primitives/element/ElementNodeContainer.js +3 -3
- package/dist/base/updateEdges.js +7 -2
- package/dist/base/updateNodes.js +11 -3
- package/dist/bundle/LikeC4View.js +3 -3
- package/dist/bundle/ReactLikeC4.js +1 -1
- package/dist/bundle/ShadowRoot.js +3 -3
- package/dist/bundle/styles.css.js +4 -4
- package/dist/context/ControlsCustomLayout.js +1 -1
- package/dist/context/DiagramEventHandlers.js +5 -5
- package/dist/context/DiagramFeatures.js +7 -7
- package/dist/context/EnsureMantine.js +2 -2
- package/dist/context/FramerMotionConfig.js +2 -2
- package/dist/context/IconRenderer.js +4 -4
- package/dist/context/ReduceGraphics.js +2 -2
- package/dist/context/RootContainer.js +5 -9
- package/dist/hooks/safeContext.js +3 -3
- package/dist/hooks/useCurrentViewId.js +1 -1
- package/dist/hooks/useDiagram.d.ts +3 -7
- package/dist/hooks/useDiagram.js +2 -2
- package/dist/hooks/useMantinePortalProps.js +2 -2
- package/dist/hooks/useSetState.js +3 -3
- package/dist/hooks/useUpdateEffect.js +1 -1
- package/dist/likec4diagram/DiagramUI.js +2 -2
- package/dist/likec4diagram/DiagramXYFlow.js +2 -2
- package/dist/likec4diagram/custom/edges/NotePopover.js +2 -2
- package/dist/likec4diagram/custom/edges/RelationshipEdge.js +17 -7
- package/dist/likec4diagram/custom/edges/RelationshipsDropdownMenu.js +6 -6
- package/dist/likec4diagram/custom/nodes/toolbar/ColorButton.js +2 -2
- package/dist/likec4diagram/custom/nodes/toolbar/CompoundToolbar.js +3 -3
- package/dist/likec4diagram/custom/nodes/toolbar/_shared.js +2 -2
- package/dist/likec4diagram/ui/controls/ChangeAutoLayoutButton.js +4 -4
- package/dist/likec4diagram/ui/controls/Controls.js +6 -6
- package/dist/likec4diagram/ui/controls/NavigationButtons.js +1 -1
- package/dist/likec4diagram/ui/diagram-title/DiagramTitlePanel.js +1 -1
- package/dist/likec4diagram/ui/notation/NotationPanel.js +4 -5
- package/dist/likec4diagram/ui/search/ElementsColumn.js +88 -77
- package/dist/likec4diagram/ui/search/LikeC4Search.d.ts +2 -1
- package/dist/likec4diagram/ui/search/LikeC4Search.js +27 -24
- package/dist/likec4diagram/ui/search/SearchInput.js +1 -1
- package/dist/likec4diagram/ui/search/ViewsColum.js +3 -2
- package/dist/likec4diagram/ui/search/state.js +11 -9
- package/dist/likec4diagram/ui/walkthrough/DynamicViewWalkthrough.js +1 -1
- package/dist/likec4diagram/useLayoutConstraints.js +3 -3
- package/dist/likec4model/LikeC4ModelContext.js +2 -2
- package/dist/likec4model/useLikeC4ElementsTree.js +2 -2
- package/dist/likec4model/useLikeC4Model.js +2 -2
- package/dist/node_modules/.pnpm/react@19.0.0/node_modules/react/cjs/react.production.js +548 -0
- package/dist/node_modules/.pnpm/react@19.0.0/node_modules/react/index.js +15 -0
- package/dist/overlays/Overlays.js +8 -8
- package/dist/overlays/element-details/ElementDetailsCard.js +5 -5
- package/dist/overlays/element-details/TabPanelDeployments.js +7 -4
- package/dist/overlays/element-details/TabPanelRelationships.js +2 -2
- package/dist/overlays/element-details/TabPanelStructure.js +6 -3
- package/dist/overlays/element-details/actor.d.ts +301 -301
- package/dist/overlays/element-details/actorContext.js +3 -3
- package/dist/overlays/overlay/Overlay.css.d.ts +2 -25
- package/dist/overlays/overlay/Overlay.css.js +0 -40
- package/dist/overlays/overlay/Overlay.d.ts +1 -1
- package/dist/overlays/overlay/Overlay.js +99 -89
- package/dist/overlays/overlaysActor.js +4 -1
- package/dist/overlays/relationship-details/RelationshipDetails.js +28 -23
- package/dist/overlays/relationship-details/SelectEdge.js +3 -6
- package/dist/overlays/relationship-details/actor.d.ts +2 -0
- package/dist/overlays/relationship-details/custom/edgeTypes.js +1 -1
- package/dist/overlays/relationship-details/custom/nodeTypes.js +1 -1
- package/dist/overlays/relationship-details/hooks.d.ts +3 -1
- package/dist/overlays/relationship-details/hooks.js +4 -4
- package/dist/overlays/relationships-browser/RelationshipsBrowser.js +9 -11
- package/dist/overlays/relationships-browser/SelectElement.js +8 -5
- package/dist/overlays/relationships-browser/actor.d.ts +1 -1
- package/dist/overlays/relationships-browser/actor.js +6 -12
- package/dist/overlays/relationships-browser/const.d.ts +2 -1
- package/dist/overlays/relationships-browser/const.js +6 -1
- package/dist/overlays/relationships-browser/custom/edgeTypes.js +3 -4
- package/dist/overlays/relationships-browser/custom/nodeTypes.js +2 -2
- package/dist/overlays/relationships-browser/hooks.d.ts +1 -1
- package/dist/overlays/relationships-browser/hooks.js +4 -4
- package/dist/overlays/relationships-browser/layout.js +2 -2
- package/dist/overlays/relationships-browser/useViewToNodesEdges.js +1 -2
- package/dist/state/DiagramActorProvider.js +5 -3
- package/dist/state/diagram-machine.d.ts +2 -2
- package/dist/state/diagram-machine.js +3 -4
- package/dist/state/hotkeyActor.js +12 -3
- package/dist/styles.css.js +1 -1
- package/package.json +21 -17
- package/src/base/BaseXYFlow.tsx +2 -2
- package/src/base/primitives/compound/CompoundActionButton.tsx +1 -1
- package/src/base/primitives/compound/CompoundDetailsButton.tsx +1 -1
- package/src/base/primitives/compound/CompoundNodeContainer.css.ts +0 -3
- package/src/base/primitives/compound/CompoundNodeContainer.tsx +1 -1
- package/src/base/primitives/edge/EdgeActionButton.tsx +1 -2
- package/src/base/primitives/edge/EdgePath.tsx +22 -14
- package/src/base/primitives/edge/edge.css.ts +1 -1
- package/src/base/primitives/element/ElementActionButtons.tsx +7 -5
- package/src/base/primitives/element/ElementDetailsButton.tsx +5 -1
- package/src/base/primitives/element/ElementNodeContainer.css.ts +0 -18
- package/src/base/primitives/element/ElementNodeContainer.tsx +1 -1
- package/src/base/updateEdges.ts +6 -9
- package/src/base/updateNodes.ts +10 -14
- package/src/bundle/styles.css.ts +7 -2
- package/src/components/SearchControl.css.ts +4 -8
- package/src/context/FramerMotionConfig.tsx +1 -1
- package/src/context/RootContainer.tsx +0 -4
- package/src/hooks/useDiagram.ts +1 -1
- package/src/likec4diagram/custom/edges/RelationshipEdge.tsx +8 -2
- package/src/likec4diagram/custom/edges/RelationshipsDropdownMenu.tsx +1 -1
- package/src/likec4diagram/custom/edges/edges.css.ts +0 -2
- package/src/likec4diagram/ui/controls/Controls.tsx +53 -55
- package/src/likec4diagram/ui/controls/NavigationButtons.tsx +1 -1
- package/src/likec4diagram/ui/diagram-title/DiagramTitlePanel.tsx +1 -1
- package/src/likec4diagram/ui/notation/NotationPanel.css.ts +0 -4
- package/src/likec4diagram/ui/notation/NotationPanel.tsx +1 -2
- package/src/likec4diagram/ui/search/ElementsColumn.tsx +94 -71
- package/src/likec4diagram/ui/search/LikeC4Search.tsx +48 -55
- package/src/likec4diagram/ui/search/ViewsColum.tsx +2 -2
- package/src/likec4diagram/ui/search/ViewsColumn.css.ts +0 -4
- package/src/likec4diagram/ui/search/state.ts +8 -6
- package/src/likec4diagram/ui/walkthrough/DynamicViewWalkthrough.tsx +1 -1
- package/src/overlays/Overlays.tsx +4 -4
- package/src/overlays/element-details/ElementDetailsCard.tsx +1 -1
- package/src/overlays/element-details/TabPanelDeployments.tsx +2 -0
- package/src/overlays/element-details/TabPanelStructure.tsx +2 -1
- package/src/overlays/overlay/Overlay.css.ts +0 -40
- package/src/overlays/overlay/Overlay.tsx +109 -99
- package/src/overlays/overlaysActor.ts +5 -1
- package/src/overlays/relationship-details/RelationshipDetails.tsx +25 -16
- package/src/overlays/relationship-details/SelectEdge.tsx +0 -14
- package/src/overlays/relationship-details/actor.ts +2 -1
- package/src/overlays/relationship-details/custom/edgeTypes.tsx +1 -1
- package/src/overlays/relationship-details/custom/nodeTypes.tsx +1 -1
- package/src/overlays/relationships-browser/RelationshipsBrowser.tsx +1 -3
- package/src/overlays/relationships-browser/SelectElement.tsx +2 -0
- package/src/overlays/relationships-browser/actor.ts +8 -13
- package/src/overlays/relationships-browser/const.ts +8 -1
- package/src/overlays/relationships-browser/custom/edgeTypes.tsx +2 -3
- package/src/overlays/relationships-browser/custom/nodeTypes.tsx +2 -2
- package/src/overlays/relationships-browser/useViewToNodesEdges.ts +1 -2
- package/src/state/DiagramActorProvider.tsx +4 -1
- package/src/state/diagram-machine.ts +2 -3
- package/src/state/hotkeyActor.ts +13 -3
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@likec4/diagram",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.28.1",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"bugs": "https://github.com/likec4/likec4/issues",
|
|
6
6
|
"homepage": "https://likec4.dev",
|
|
@@ -42,29 +42,31 @@
|
|
|
42
42
|
},
|
|
43
43
|
"dependencies": {
|
|
44
44
|
"@dagrejs/dagre": "1.1.4",
|
|
45
|
-
"@mantine/core": "7.17.
|
|
46
|
-
"@mantine/hooks": "7.17.
|
|
45
|
+
"@mantine/core": "7.17.4",
|
|
46
|
+
"@mantine/hooks": "7.17.4",
|
|
47
47
|
"@nanostores/react": "0.8.4",
|
|
48
|
-
"@react-hookz/web": "^25.1.
|
|
48
|
+
"@react-hookz/web": "^25.1.1",
|
|
49
49
|
"@tabler/icons-react": "3.31.0",
|
|
50
50
|
"@xstate/react": "^5.0.3",
|
|
51
|
-
"@xyflow/react": "^12.5.
|
|
52
|
-
"@xyflow/system": "^0.0.
|
|
51
|
+
"@xyflow/react": "^12.5.5",
|
|
52
|
+
"@xyflow/system": "^0.0.55",
|
|
53
53
|
"bezier-js": "^6.1.4",
|
|
54
54
|
"clsx": "^2.1.1",
|
|
55
55
|
"d3-shape": "^3.2.0",
|
|
56
56
|
"fast-equals": "^5.2.2",
|
|
57
|
-
"
|
|
57
|
+
"motion": "^12.6.3",
|
|
58
58
|
"nanostores": "0.11.4",
|
|
59
|
-
"react": "^19.0.0",
|
|
60
|
-
"react-dom": "^19.0.0",
|
|
61
59
|
"react-error-boundary": "^5.0.0",
|
|
62
60
|
"react-shadow": "^20.6.0",
|
|
63
61
|
"remeda": "^2.21.2",
|
|
64
|
-
"type-fest": "^4.
|
|
62
|
+
"type-fest": "^4.39.1",
|
|
65
63
|
"xstate": "^5.19.2",
|
|
66
|
-
"@likec4/core": "1.
|
|
67
|
-
"@likec4/styles": "1.
|
|
64
|
+
"@likec4/core": "1.28.1",
|
|
65
|
+
"@likec4/styles": "1.28.1"
|
|
66
|
+
},
|
|
67
|
+
"peerDependencies": {
|
|
68
|
+
"react": "^18.x || ^19.x",
|
|
69
|
+
"react-dom": "^18.x || ^19.x"
|
|
68
70
|
},
|
|
69
71
|
"devDependencies": {
|
|
70
72
|
"@pandacss/dev": "^0.53.3",
|
|
@@ -73,15 +75,17 @@
|
|
|
73
75
|
"@types/d3-shape": "^3.1.7",
|
|
74
76
|
"@types/react": "^19.0.12",
|
|
75
77
|
"@types/react-dom": "^19.0.4",
|
|
76
|
-
"@types/node": "^20.17.
|
|
78
|
+
"@types/node": "^20.17.30",
|
|
77
79
|
"@vitejs/plugin-react": "^4.3.4",
|
|
78
80
|
"postcss": "^8.5.3",
|
|
79
|
-
"
|
|
80
|
-
"
|
|
81
|
+
"react": "^19.0.0",
|
|
82
|
+
"react-dom": "^19.0.0",
|
|
83
|
+
"typescript": "^5.8.3",
|
|
84
|
+
"vite": "^6.2.5",
|
|
81
85
|
"vite-plugin-dts": "^4.5.3",
|
|
82
|
-
"vitest": "^3.
|
|
86
|
+
"vitest": "^3.1.1",
|
|
83
87
|
"wireit": "^0.14.11",
|
|
84
|
-
"@likec4/tsconfig": "1.
|
|
88
|
+
"@likec4/tsconfig": "1.28.1"
|
|
85
89
|
},
|
|
86
90
|
"scripts": {
|
|
87
91
|
"generate": "panda codegen",
|
package/src/base/BaseXYFlow.tsx
CHANGED
|
@@ -143,8 +143,8 @@ export const BaseXYFlow = <
|
|
|
143
143
|
edgesFocusable={false}
|
|
144
144
|
nodesDraggable={nodesDraggable}
|
|
145
145
|
nodeDragThreshold={4}
|
|
146
|
-
nodeClickDistance={
|
|
147
|
-
paneClickDistance={
|
|
146
|
+
nodeClickDistance={3}
|
|
147
|
+
paneClickDistance={3}
|
|
148
148
|
elevateNodesOnSelect={false} // or edges are not visible after select\
|
|
149
149
|
selectNodesOnDrag={false}
|
|
150
150
|
onNodesChange={onNodesChange}
|
|
@@ -3,7 +3,7 @@ import { actionBtn } from '@likec4/styles/recipes'
|
|
|
3
3
|
import { ActionIcon, Box } from '@mantine/core'
|
|
4
4
|
import { useDebouncedValue } from '@mantine/hooks'
|
|
5
5
|
import { IconZoomScan } from '@tabler/icons-react'
|
|
6
|
-
import
|
|
6
|
+
import * as m from 'motion/react-m'
|
|
7
7
|
import { stopPropagation } from '../../../utils/xyflow'
|
|
8
8
|
import type { NodeProps } from '../../types'
|
|
9
9
|
import { compoundActionBtn } from './actionbtns.css'
|
|
@@ -3,7 +3,7 @@ import { actionBtn } from '@likec4/styles/recipes'
|
|
|
3
3
|
import { ActionIcon, Box } from '@mantine/core'
|
|
4
4
|
import { useDebouncedValue } from '@mantine/hooks'
|
|
5
5
|
import { IconId } from '@tabler/icons-react'
|
|
6
|
-
import
|
|
6
|
+
import * as m from 'motion/react-m'
|
|
7
7
|
import { stopPropagation } from '../../../utils/xyflow'
|
|
8
8
|
import type { NodeProps } from '../../types'
|
|
9
9
|
import { compoundActionBtn } from './actionbtns.css'
|
|
@@ -1,7 +1,4 @@
|
|
|
1
1
|
import { css, sva } from '@likec4/styles/css'
|
|
2
|
-
// import { createVar, fallbackVar, globalStyle, keyframes, style } from '@vanilla-extract/css'
|
|
3
|
-
// import { calc } from '@vanilla-extract/css-utils'
|
|
4
|
-
// import { easings, vars, whereLight, whereNotReducedGraphics } from '../../../theme-vars'
|
|
5
2
|
|
|
6
3
|
// export const _compoundOpacity = '--_compound-opacity'
|
|
7
4
|
// const compoundOpacity = `var(${_compoundOpacity})`
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { DiagramNode } from '@likec4/core'
|
|
2
2
|
import { css, cx } from '@likec4/styles/css'
|
|
3
|
-
import { type HTMLMotionProps, m } from '
|
|
3
|
+
import { type HTMLMotionProps, m } from 'motion/react'
|
|
4
4
|
import { type PropsWithChildren } from 'react'
|
|
5
5
|
import { clamp, isNumber } from 'remeda'
|
|
6
6
|
import { useIsReducedGraphics } from '../../../hooks/useReducedGraphics'
|
|
@@ -2,10 +2,9 @@ import { cx } from '@likec4/styles/css'
|
|
|
2
2
|
import { ActionIcon } from '@mantine/core'
|
|
3
3
|
import { IconZoomScan } from '@tabler/icons-react'
|
|
4
4
|
import { stopPropagation } from '../../../utils/xyflow'
|
|
5
|
-
import type { EdgeProps } from '../../types'
|
|
6
5
|
import { actionBtn } from './edge.css'
|
|
7
6
|
|
|
8
|
-
type EdgeActionBtnProps =
|
|
7
|
+
type EdgeActionBtnProps = {
|
|
9
8
|
icon?: React.ReactNode
|
|
10
9
|
onClick: (e: React.MouseEvent) => void
|
|
11
10
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { DiagramEdge } from '@likec4/core'
|
|
2
|
-
import { cx } from '@likec4/styles/css'
|
|
2
|
+
import { css, cx } from '@likec4/styles/css'
|
|
3
3
|
import { type PointerEventHandler, forwardRef } from 'react'
|
|
4
4
|
import type { UndefinedOnPartialDeep } from 'type-fest'
|
|
5
5
|
import type { EdgeProps } from '../../types'
|
|
@@ -16,25 +16,28 @@ type Data = UndefinedOnPartialDeep<
|
|
|
16
16
|
>
|
|
17
17
|
>
|
|
18
18
|
|
|
19
|
-
type EdgePathProps =
|
|
19
|
+
type EdgePathProps = {
|
|
20
|
+
edgeProps: EdgeProps<Data>
|
|
20
21
|
svgPath: string
|
|
21
22
|
strokeWidth?: number
|
|
22
23
|
onEdgePointerDown?: PointerEventHandler<SVGGElement> | undefined
|
|
23
24
|
}
|
|
24
25
|
|
|
25
26
|
export const EdgePath = forwardRef<SVGPathElement, EdgePathProps>(({
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
27
|
+
edgeProps: {
|
|
28
|
+
id,
|
|
29
|
+
data: {
|
|
30
|
+
line,
|
|
31
|
+
dir,
|
|
32
|
+
tail,
|
|
33
|
+
head,
|
|
34
|
+
},
|
|
35
|
+
style,
|
|
36
|
+
interactionWidth,
|
|
32
37
|
},
|
|
38
|
+
onEdgePointerDown,
|
|
33
39
|
strokeWidth,
|
|
34
40
|
svgPath,
|
|
35
|
-
style,
|
|
36
|
-
interactionWidth,
|
|
37
|
-
onEdgePointerDown,
|
|
38
41
|
}, svgPathRef) => {
|
|
39
42
|
let markerStartName = arrowTypeToMarker(tail)
|
|
40
43
|
let markerEndName = arrowTypeToMarker(head ?? 'normal')
|
|
@@ -69,10 +72,15 @@ export const EdgePath = forwardRef<SVGPathElement, EdgePathProps>(({
|
|
|
69
72
|
return (
|
|
70
73
|
<>
|
|
71
74
|
<path
|
|
72
|
-
className={cx(
|
|
75
|
+
className={cx(
|
|
76
|
+
'react-flow__edge-interaction',
|
|
77
|
+
hideOnReducedGraphics,
|
|
78
|
+
css({
|
|
79
|
+
fill: '[none]',
|
|
80
|
+
strokeOpacity: 0,
|
|
81
|
+
}),
|
|
82
|
+
)}
|
|
73
83
|
d={svgPath}
|
|
74
|
-
fill="none"
|
|
75
|
-
stroke={'transparent'}
|
|
76
84
|
strokeWidth={interactionWidth ?? 10}
|
|
77
85
|
/>
|
|
78
86
|
<g className={markerContext} onPointerDown={onEdgePointerDown}>
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import { css, cx } from '@likec4/styles/css'
|
|
2
2
|
import { actionBtn } from '@likec4/styles/recipes'
|
|
3
3
|
import { ActionIcon, Box } from '@mantine/core'
|
|
4
|
-
import {
|
|
4
|
+
import { useId } from '@mantine/hooks'
|
|
5
|
+
import * as m from 'motion/react-m'
|
|
5
6
|
import { useIsZoomTooSmall } from '../../../hooks/useXYFlow'
|
|
6
7
|
import { stopPropagation } from '../../../utils/xyflow'
|
|
7
8
|
import type { NodeProps } from '../../types'
|
|
@@ -33,13 +34,13 @@ const actionButtons = css({
|
|
|
33
34
|
})
|
|
34
35
|
|
|
35
36
|
export function ElementActionButtons({
|
|
36
|
-
id,
|
|
37
37
|
selected = false,
|
|
38
38
|
data: {
|
|
39
39
|
hovered: isHovered = false,
|
|
40
40
|
},
|
|
41
41
|
buttons,
|
|
42
42
|
}: ElementActionButtonsProps) {
|
|
43
|
+
const id = useId()
|
|
43
44
|
const zoomTooSmall = useIsZoomTooSmall()
|
|
44
45
|
if (!buttons.length || zoomTooSmall) {
|
|
45
46
|
return null
|
|
@@ -49,6 +50,7 @@ export function ElementActionButtons({
|
|
|
49
50
|
<Box
|
|
50
51
|
component={m.div}
|
|
51
52
|
layoutRoot
|
|
53
|
+
key={`${id}-action-buttons`}
|
|
52
54
|
initial={false}
|
|
53
55
|
style={{
|
|
54
56
|
originY: 0,
|
|
@@ -65,16 +67,16 @@ export function ElementActionButtons({
|
|
|
65
67
|
{buttons.map((button, index) => (
|
|
66
68
|
<ActionIcon
|
|
67
69
|
component={m.button}
|
|
68
|
-
layout
|
|
70
|
+
// layout
|
|
69
71
|
className={actionBtn({})}
|
|
70
|
-
key={
|
|
72
|
+
key={`${id}-${button.key ?? index}`}
|
|
71
73
|
initial={false}
|
|
72
74
|
whileTap={{ scale: 1 }}
|
|
73
75
|
whileHover={{
|
|
74
76
|
scale: 1.3,
|
|
75
77
|
}}
|
|
76
|
-
// Otherwise node receives click event and is selected
|
|
77
78
|
onClick={button.onClick}
|
|
79
|
+
// Otherwise node receives click event and is selected
|
|
78
80
|
onDoubleClick={stopPropagation}
|
|
79
81
|
>
|
|
80
82
|
{button.icon}
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import { css, cx } from '@likec4/styles/css'
|
|
2
2
|
import { actionBtn } from '@likec4/styles/recipes'
|
|
3
3
|
import { ActionIcon, Box } from '@mantine/core'
|
|
4
|
+
import { useId } from '@mantine/hooks'
|
|
4
5
|
import { IconId } from '@tabler/icons-react'
|
|
5
|
-
import
|
|
6
|
+
import * as m from 'motion/react-m'
|
|
6
7
|
import { stopPropagation } from '../../../utils/xyflow'
|
|
7
8
|
import type { NodeProps } from '../../types'
|
|
8
9
|
|
|
@@ -41,11 +42,14 @@ export function ElementDetailsButton({
|
|
|
41
42
|
icon,
|
|
42
43
|
onClick,
|
|
43
44
|
}: ElementDetailsButtonProps) {
|
|
45
|
+
const id = useId()
|
|
44
46
|
return (
|
|
45
47
|
<Box className={cx(container, 'details-button')}>
|
|
46
48
|
<ActionIcon
|
|
49
|
+
key={id}
|
|
47
50
|
className={cx('nodrag nopan', actionBtn({ variant: 'transparent' }))}
|
|
48
51
|
component={m.button}
|
|
52
|
+
// layout
|
|
49
53
|
initial={false}
|
|
50
54
|
style={{
|
|
51
55
|
originX: 0.45,
|
|
@@ -1,7 +1,4 @@
|
|
|
1
1
|
import { css as style } from '@likec4/styles/css'
|
|
2
|
-
// import { createVar, fallbackVar, globalStyle, style } from '@vanilla-extract/css'
|
|
3
|
-
// import { easings, vars, whereReducedGraphics } from '../../../theme-vars'
|
|
4
|
-
// import { iconSize, paddingSize, textSize } from './vars.css'
|
|
5
2
|
|
|
6
3
|
export const container = style({
|
|
7
4
|
position: 'relative',
|
|
@@ -52,18 +49,3 @@ export const container = style({
|
|
|
52
49
|
cursor: 'pointer',
|
|
53
50
|
},
|
|
54
51
|
})
|
|
55
|
-
|
|
56
|
-
// const sizes = ['xs', 'sm', 'lg', 'xl'] as const
|
|
57
|
-
// sizes.forEach((size) => {
|
|
58
|
-
// globalStyle(`${container}[data-likec4-text-size="${size}"]`, {
|
|
59
|
-
// vars: {
|
|
60
|
-
// [textSize]: rem(defaultTheme.textSizes[size]),
|
|
61
|
-
// },
|
|
62
|
-
// })
|
|
63
|
-
|
|
64
|
-
// globalStyle(`${container}[data-likec4-padding="${size}"]`, {
|
|
65
|
-
// vars: {
|
|
66
|
-
// [paddingSize]: rem(defaultTheme.spacing[size]),
|
|
67
|
-
// },
|
|
68
|
-
// })
|
|
69
|
-
// })
|
|
@@ -7,7 +7,7 @@ import {
|
|
|
7
7
|
} from '@likec4/core'
|
|
8
8
|
import { css, cx } from '@likec4/styles/css'
|
|
9
9
|
import { type BoxProps, Box, createPolymorphicComponent } from '@mantine/core'
|
|
10
|
-
import
|
|
10
|
+
import * as m from 'motion/react-m'
|
|
11
11
|
import { type PropsWithChildren, forwardRef } from 'react'
|
|
12
12
|
import type { NodeProps } from '../../types'
|
|
13
13
|
import * as styles from './ElementNodeContainer.css'
|
package/src/base/updateEdges.ts
CHANGED
|
@@ -5,7 +5,7 @@ import type { Base } from './types'
|
|
|
5
5
|
function _update<E extends Base.Edge>(current: E[], update: E[]): E[] {
|
|
6
6
|
return update.map((next) => {
|
|
7
7
|
const existing = current.find(n => n.id === next.id)
|
|
8
|
-
if (existing && existing.type
|
|
8
|
+
if (existing && eq(existing.type, next.type)) {
|
|
9
9
|
if (
|
|
10
10
|
eq(existing.hidden ?? false, next.hidden ?? false)
|
|
11
11
|
&& eq(existing.source, next.source)
|
|
@@ -17,14 +17,11 @@ function _update<E extends Base.Edge>(current: E[], update: E[]): E[] {
|
|
|
17
17
|
) {
|
|
18
18
|
return existing
|
|
19
19
|
}
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
// ...next.data,
|
|
26
|
-
// },
|
|
27
|
-
// }
|
|
20
|
+
return {
|
|
21
|
+
...omit(existing, ['hidden', 'zIndex']),
|
|
22
|
+
...next,
|
|
23
|
+
data: next.data,
|
|
24
|
+
}
|
|
28
25
|
}
|
|
29
26
|
return next
|
|
30
27
|
})
|
package/src/base/updateNodes.ts
CHANGED
|
@@ -6,11 +6,10 @@ import type { Base } from './types'
|
|
|
6
6
|
function _update<N extends Base.Node>(current: N[], updated: N[]): N[] {
|
|
7
7
|
return updated.map((update) => {
|
|
8
8
|
const existing = current.find(n => n.id === update.id)
|
|
9
|
-
if (existing) {
|
|
9
|
+
if (existing && eq(existing.type, update.type)) {
|
|
10
10
|
const { width: existingWidth, height: existingHeight } = getNodeDimensions(existing)
|
|
11
11
|
if (
|
|
12
|
-
eq(
|
|
13
|
-
&& eq(existingWidth, update.initialWidth)
|
|
12
|
+
eq(existingWidth, update.initialWidth)
|
|
14
13
|
&& eq(existingHeight, update.initialHeight)
|
|
15
14
|
&& eq(existing.parentId ?? null, update.parentId ?? null)
|
|
16
15
|
&& eq(existing.hidden ?? false, update.hidden ?? false)
|
|
@@ -20,17 +19,14 @@ function _update<N extends Base.Node>(current: N[], updated: N[]): N[] {
|
|
|
20
19
|
) {
|
|
21
20
|
return existing
|
|
22
21
|
}
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
// ...update.data,
|
|
32
|
-
// },
|
|
33
|
-
// } as N
|
|
22
|
+
return {
|
|
23
|
+
...omit(existing, ['measured', 'parentId', 'hidden', 'zIndex']),
|
|
24
|
+
...update,
|
|
25
|
+
// Force dimensions from update
|
|
26
|
+
width: update.initialWidth,
|
|
27
|
+
height: update.initialHeight,
|
|
28
|
+
data: update.data,
|
|
29
|
+
} as N
|
|
34
30
|
}
|
|
35
31
|
return update
|
|
36
32
|
})
|
package/src/bundle/styles.css.ts
CHANGED
|
@@ -1,9 +1,14 @@
|
|
|
1
1
|
import type { DiagramView } from '@likec4/core'
|
|
2
2
|
import { css } from '@likec4/styles/css'
|
|
3
3
|
import { type MantineThemeOverride, createTheme, Portal } from '@mantine/core'
|
|
4
|
-
import {
|
|
4
|
+
import {
|
|
5
|
+
useColorScheme as usePreferredColorScheme,
|
|
6
|
+
useDebouncedCallback,
|
|
7
|
+
useId,
|
|
8
|
+
useMutationObserver,
|
|
9
|
+
} from '@mantine/hooks'
|
|
5
10
|
import { useIsomorphicLayoutEffect } from '@react-hookz/web'
|
|
6
|
-
import {
|
|
11
|
+
import { useState } from 'react'
|
|
7
12
|
import { first, isFunction, isString } from 'remeda'
|
|
8
13
|
import inlinedStyles from '../styles.css?inline'
|
|
9
14
|
import fontsCss from './font.css?inline'
|
|
@@ -1,10 +1,6 @@
|
|
|
1
|
-
import { css
|
|
2
|
-
// import { createVar, fallbackVar, globalStyle, style } from '@vanilla-extract/css'
|
|
3
|
-
// import { mantine, transitions, vars, whereDark, whereLight, whereNotReducedGraphics } from '../theme-vars'
|
|
1
|
+
import { css } from '@likec4/styles/css'
|
|
4
2
|
|
|
5
|
-
|
|
6
|
-
// const bgColor = createVar('bgcolor')
|
|
7
|
-
export const root = style({
|
|
3
|
+
export const root = css({
|
|
8
4
|
height: '30px',
|
|
9
5
|
paddingLeft: 'sm',
|
|
10
6
|
paddingRight: '4px',
|
|
@@ -42,7 +38,7 @@ export const root = style({
|
|
|
42
38
|
},
|
|
43
39
|
})
|
|
44
40
|
|
|
45
|
-
export const placeholder =
|
|
41
|
+
export const placeholder = css({
|
|
46
42
|
fontSize: 'sm', // mantine.fontSizes.sm,
|
|
47
43
|
fontWeight: 500,
|
|
48
44
|
paddingRight: '50px',
|
|
@@ -50,7 +46,7 @@ export const placeholder = style({
|
|
|
50
46
|
flex: '1',
|
|
51
47
|
})
|
|
52
48
|
|
|
53
|
-
export const shortcut =
|
|
49
|
+
export const shortcut = css({
|
|
54
50
|
fontSize: '11px',
|
|
55
51
|
fontWeight: 600,
|
|
56
52
|
lineHeight: 1,
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { useMantineStyleNonce } from '@mantine/core'
|
|
2
|
-
import { domMax, LazyMotion, MotionConfig } from '
|
|
2
|
+
import { domMax, LazyMotion, MotionConfig } from 'motion/react'
|
|
3
3
|
import { type PropsWithChildren } from 'react'
|
|
4
4
|
|
|
5
5
|
export const FramerMotionConfig = ({
|
|
@@ -29,10 +29,6 @@ export function RootContainer({
|
|
|
29
29
|
return (
|
|
30
30
|
<Box
|
|
31
31
|
className={cx('likec4-root', className)}
|
|
32
|
-
css={{
|
|
33
|
-
// '--likec4-background-color': 'mantine.colors.body',
|
|
34
|
-
// '--colors-likec4-background': 'var(--mantine-color-body)',
|
|
35
|
-
}}
|
|
36
32
|
ref={ref}
|
|
37
33
|
{...reduceGraphics && {
|
|
38
34
|
['data-likec4-reduced-graphics']: true,
|
package/src/hooks/useDiagram.ts
CHANGED
|
@@ -2,7 +2,7 @@ import { type DiagramView, type EdgeId, type ElementNotation, type Fqn, type Nod
|
|
|
2
2
|
import { useCallbackRef } from '@mantine/hooks'
|
|
3
3
|
import { useSelector as useXstateSelector } from '@xstate/react'
|
|
4
4
|
import { shallowEqual } from 'fast-equals'
|
|
5
|
-
import { useMemo
|
|
5
|
+
import { useMemo } from 'react'
|
|
6
6
|
import type { PartialDeep } from 'type-fest'
|
|
7
7
|
import type { FeatureName } from '../context/DiagramFeatures'
|
|
8
8
|
import type { OpenSourceParams } from '../LikeC4Diagram.props'
|
|
@@ -335,7 +335,13 @@ export const RelationshipEdge = customEdge<Types.RelationshipEdgeData>((props) =
|
|
|
335
335
|
return (
|
|
336
336
|
<>
|
|
337
337
|
<EdgeContainer {...props} className={clsx(isControlPointDragging && edgesCss.controlDragging)}>
|
|
338
|
-
<EdgePath
|
|
338
|
+
<EdgePath
|
|
339
|
+
edgeProps={props}
|
|
340
|
+
svgPath={edgePath}
|
|
341
|
+
ref={svgPathRef}
|
|
342
|
+
{...enableEdgeEditing && {
|
|
343
|
+
onEdgePointerDown,
|
|
344
|
+
}} />
|
|
339
345
|
<EdgeLabelContainer
|
|
340
346
|
edgeProps={props}
|
|
341
347
|
labelPosition={{
|
|
@@ -368,7 +374,7 @@ export const RelationshipEdge = customEdge<Types.RelationshipEdgeData>((props) =
|
|
|
368
374
|
<circle
|
|
369
375
|
onPointerDown={e => onControlPointerDown(i, e)}
|
|
370
376
|
className={clsx('nodrag nopan', edgesCss.controlPoint)}
|
|
371
|
-
key={i}
|
|
377
|
+
key={'controlPoints' + edgeId + '#' + i}
|
|
372
378
|
cx={Math.round(p.x)}
|
|
373
379
|
cy={Math.round(p.y)}
|
|
374
380
|
r={3}
|
|
@@ -89,7 +89,7 @@ export const RelationshipsDropdownMenu = memo((
|
|
|
89
89
|
diagramEdge.relations,
|
|
90
90
|
map(id => {
|
|
91
91
|
try {
|
|
92
|
-
return likec4model.
|
|
92
|
+
return likec4model.findRelationship(id)
|
|
93
93
|
} catch (e) {
|
|
94
94
|
// View was cached, but likec4model based on new data
|
|
95
95
|
console.error(
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { ActionIconGroup, Badge, Box, Group, Loader, Stack } from '@mantine/core'
|
|
2
2
|
import { IconFileSymlink, IconFocusCentered, IconMenu2 } from '@tabler/icons-react'
|
|
3
3
|
import { clsx } from 'clsx'
|
|
4
|
-
import {
|
|
4
|
+
import { LayoutGroup, m } from 'motion/react'
|
|
5
5
|
import { memo } from 'react'
|
|
6
6
|
import { useDiagramEventHandlers, useEnabledFeatures } from '../../../context'
|
|
7
7
|
import { type ControlsCustomLayout, useControlsCustomLayout } from '../../../context/ControlsCustomLayout'
|
|
@@ -90,60 +90,58 @@ export const Controls = memo(() => {
|
|
|
90
90
|
const portalProps = useMantinePortalProps()
|
|
91
91
|
const ControlsLayout = useControlsCustomLayout() ?? ControlsDefaultLayout
|
|
92
92
|
return (
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
<
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
{
|
|
131
|
-
<
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
</AnimatePresence>
|
|
146
|
-
</LayoutGroup>
|
|
93
|
+
<>
|
|
94
|
+
{isNotActiveWalkthrough && (
|
|
95
|
+
<ControlsLayout
|
|
96
|
+
burgerMenu={onBurgerMenuClick && (
|
|
97
|
+
<ActionIcon
|
|
98
|
+
onClick={e => {
|
|
99
|
+
e.stopPropagation()
|
|
100
|
+
onBurgerMenuClick()
|
|
101
|
+
}}>
|
|
102
|
+
<IconMenu2 />
|
|
103
|
+
</ActionIcon>
|
|
104
|
+
)}
|
|
105
|
+
navigationButtons={enableNavigationButtons && <NavigationButtons />}
|
|
106
|
+
search={enableSearch && <LikeC4Search />}
|
|
107
|
+
syncInProgressBadge={<SyncLayoutBadge />}
|
|
108
|
+
actionsGroup={
|
|
109
|
+
<ActionIconGroup className={css.actionIconGroup} orientation="vertical">
|
|
110
|
+
{enableVscode && (
|
|
111
|
+
<Tooltip label="Open source" {...portalProps}>
|
|
112
|
+
<ActionIcon
|
|
113
|
+
onClick={e => {
|
|
114
|
+
e.stopPropagation()
|
|
115
|
+
onOpenSource?.({ view: viewId })
|
|
116
|
+
}}>
|
|
117
|
+
<IconFileSymlink stroke={1.5} />
|
|
118
|
+
</ActionIcon>
|
|
119
|
+
</Tooltip>
|
|
120
|
+
)}
|
|
121
|
+
{enableControls && <ToggleReadonly />}
|
|
122
|
+
{enableControls && hasLayoutDrift && <LayoutDriftNotification {...portalProps} />}
|
|
123
|
+
{enableControls && notReadOnly && (
|
|
124
|
+
<>
|
|
125
|
+
<ChangeAutoLayoutButton {...portalProps} />
|
|
126
|
+
<ManualLayoutToolsButton {...portalProps} />
|
|
127
|
+
</>
|
|
128
|
+
)}
|
|
129
|
+
{enableControls && (
|
|
130
|
+
<Tooltip label={viewportChanged ? 'Center camera' : 'Camera is centered'} {...portalProps}>
|
|
131
|
+
<ActionIcon
|
|
132
|
+
onClick={e => {
|
|
133
|
+
e.stopPropagation()
|
|
134
|
+
diagram.fitDiagram()
|
|
135
|
+
}}>
|
|
136
|
+
<IconFocusCentered />
|
|
137
|
+
</ActionIcon>
|
|
138
|
+
</Tooltip>
|
|
139
|
+
)}
|
|
140
|
+
</ActionIconGroup>
|
|
141
|
+
}
|
|
142
|
+
/>
|
|
143
|
+
)}
|
|
144
|
+
</>
|
|
147
145
|
)
|
|
148
146
|
})
|
|
149
147
|
|