@likec4/diagram 1.27.0 → 1.27.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 +327 -281
- package/dist/LikeC4Diagram.js +2 -8
- package/dist/base/primitives/compound/CompoundNodeContainer.js +1 -1
- package/dist/base/primitives/edge/EdgeLabel.css.js +1 -4
- package/dist/base/primitives/edge/EdgeLabelContainer.js +1 -1
- package/dist/base/primitives/edge/EdgePath.js +0 -3
- package/dist/base/primitives/edge/edge.css.js +2 -0
- package/dist/base/primitives/element/ElementNodeContainer.css.js +1 -0
- package/dist/base/primitives/element/ElementShape.css.js +1 -12
- package/dist/base/primitives/element/ElementTitle.css.js +3 -2
- package/dist/base/types.js +2 -2
- package/dist/components/Link.js +1 -1
- package/dist/hooks/useDiagram.d.ts +320 -490
- package/dist/likec4diagram/DiagramXYFlow.js +10 -9
- package/dist/likec4diagram/custom/edges/RelationshipEdge.js +30 -41
- package/dist/likec4diagram/custom/nodes/toolbar/Toolbar.js +1 -1
- package/dist/likec4diagram/custom/nodes/toolbar/styles.css.js +6 -1
- package/dist/likec4diagram/ui/controls/LayoutDriftNotification.js +13 -5
- package/dist/likec4diagram/useLayoutConstraints.d.ts +11 -10
- package/dist/likec4diagram/useLayoutConstraints.js +64 -61
- package/dist/overlays/Overlays.js +2 -2
- package/dist/overlays/overlay/Overlay.css.js +31 -12
- package/dist/overlays/overlay/Overlay.js +30 -27
- package/dist/overlays/relationship-details/useLayoutedDetails.js +1 -1
- package/dist/overlays/relationships-browser/SelectElement.js +4 -4
- package/dist/state/DiagramActorProvider.d.ts +4 -2
- package/dist/state/DiagramActorProvider.js +30 -37
- package/dist/state/assign.js +2 -2
- package/dist/state/diagram-machine.d.ts +450 -608
- package/dist/state/diagram-machine.js +87 -57
- package/dist/styles.css.js +1 -1
- package/package.json +5 -5
- package/src/LikeC4Diagram.tsx +1 -7
- package/src/base/primitives/compound/CompoundNodeContainer.tsx +1 -1
- package/src/base/primitives/edge/EdgeLabel.css.ts +1 -4
- package/src/base/primitives/edge/EdgeLabelContainer.tsx +1 -1
- package/src/base/primitives/edge/EdgePath.tsx +0 -3
- package/src/base/primitives/edge/edge.css.ts +2 -0
- package/src/base/primitives/element/ElementNodeContainer.css.ts +1 -0
- package/src/base/primitives/element/ElementShape.css.ts +1 -12
- package/src/base/primitives/element/ElementTitle.css.ts +3 -2
- package/src/base/types.ts +2 -7
- package/src/components/Link.tsx +3 -1
- package/src/likec4diagram/DiagramXYFlow.tsx +11 -9
- package/src/likec4diagram/custom/edges/RelationshipEdge.tsx +39 -48
- package/src/likec4diagram/custom/nodes/toolbar/Toolbar.tsx +2 -2
- package/src/likec4diagram/custom/nodes/toolbar/styles.css.ts +5 -0
- package/src/likec4diagram/ui/controls/LayoutDriftNotification.tsx +8 -4
- package/src/likec4diagram/useLayoutConstraints.ts +84 -89
- package/src/overlays/Overlays.tsx +2 -2
- package/src/overlays/overlay/Overlay.css.ts +30 -12
- package/src/overlays/overlay/Overlay.tsx +35 -29
- package/src/overlays/relationship-details/useLayoutedDetails.ts +1 -1
- package/src/overlays/relationships-browser/SelectElement.tsx +5 -5
- package/src/state/DiagramActorProvider.tsx +40 -50
- package/src/state/assign.ts +2 -2
- package/src/state/diagram-machine.ts +100 -69
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@likec4/diagram",
|
|
3
|
-
"version": "1.27.
|
|
3
|
+
"version": "1.27.1",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"bugs": "https://github.com/likec4/likec4/issues",
|
|
6
6
|
"homepage": "https://likec4.dev",
|
|
@@ -63,8 +63,8 @@
|
|
|
63
63
|
"remeda": "^2.21.2",
|
|
64
64
|
"type-fest": "^4.38.0",
|
|
65
65
|
"xstate": "^5.19.2",
|
|
66
|
-
"@likec4/styles": "1.27.
|
|
67
|
-
"@likec4/core": "1.27.
|
|
66
|
+
"@likec4/styles": "1.27.1",
|
|
67
|
+
"@likec4/core": "1.27.1"
|
|
68
68
|
},
|
|
69
69
|
"devDependencies": {
|
|
70
70
|
"@pandacss/dev": "^0.53.3",
|
|
@@ -73,7 +73,7 @@
|
|
|
73
73
|
"@types/d3-shape": "^3.1.7",
|
|
74
74
|
"@types/react": "^19.0.12",
|
|
75
75
|
"@types/react-dom": "^19.0.4",
|
|
76
|
-
"@types/node": "^20.17.
|
|
76
|
+
"@types/node": "^20.17.27",
|
|
77
77
|
"@vitejs/plugin-react": "^4.3.4",
|
|
78
78
|
"postcss": "^8.5.3",
|
|
79
79
|
"typescript": "^5.8.2",
|
|
@@ -81,7 +81,7 @@
|
|
|
81
81
|
"vite-plugin-dts": "^4.5.3",
|
|
82
82
|
"vitest": "^3.0.9",
|
|
83
83
|
"wireit": "^0.14.11",
|
|
84
|
-
"@likec4/tsconfig": "1.27.
|
|
84
|
+
"@likec4/tsconfig": "1.27.1"
|
|
85
85
|
},
|
|
86
86
|
"scripts": {
|
|
87
87
|
"generate": "panda codegen",
|
package/src/LikeC4Diagram.tsx
CHANGED
|
@@ -70,12 +70,6 @@ export function LikeC4Diagram({
|
|
|
70
70
|
initialHeight: number
|
|
71
71
|
}>(null)
|
|
72
72
|
|
|
73
|
-
const xyNodesEdges = useViewToNodesEdges({
|
|
74
|
-
view,
|
|
75
|
-
where,
|
|
76
|
-
nodesSelectable,
|
|
77
|
-
})
|
|
78
|
-
|
|
79
73
|
const isDynamicView = view.__ === 'dynamic'
|
|
80
74
|
|
|
81
75
|
if (initialRef.current == null) {
|
|
@@ -147,8 +141,8 @@ export function LikeC4Diagram({
|
|
|
147
141
|
view,
|
|
148
142
|
pannable,
|
|
149
143
|
zoomable,
|
|
144
|
+
nodesSelectable,
|
|
150
145
|
fitViewPadding,
|
|
151
|
-
...xyNodesEdges,
|
|
152
146
|
}}>
|
|
153
147
|
<ControlsCustomLayoutProvider value={renderControls ?? null}>
|
|
154
148
|
<LikeC4DiagramXYFlow
|
|
@@ -50,7 +50,7 @@ export const edgeLabelContainer = css({
|
|
|
50
50
|
|
|
51
51
|
_noReduceGraphics: {
|
|
52
52
|
mixBlendMode: {
|
|
53
|
-
|
|
53
|
+
_dark: 'plus-lighter',
|
|
54
54
|
_light: 'screen',
|
|
55
55
|
},
|
|
56
56
|
},
|
|
@@ -61,9 +61,6 @@ export const edgeLabelContainer = css({
|
|
|
61
61
|
_reduceGraphicsOnPan: {
|
|
62
62
|
display: 'none',
|
|
63
63
|
},
|
|
64
|
-
_whenPanning: {
|
|
65
|
-
mixBlendMode: 'normal',
|
|
66
|
-
},
|
|
67
64
|
})
|
|
68
65
|
|
|
69
66
|
export const labelsva = sva({
|
|
@@ -32,7 +32,7 @@ type EdgeLabelContainerProps = HTMLAttributes<HTMLDivElement> & {
|
|
|
32
32
|
|
|
33
33
|
const toCssVarValue = (value: number | string | undefined) => {
|
|
34
34
|
if (value === undefined) return undefined
|
|
35
|
-
return isNumber(value) ? `${value}px` : value
|
|
35
|
+
return isNumber(value) ? `${Math.round(value)}px` : value
|
|
36
36
|
}
|
|
37
37
|
|
|
38
38
|
export function EdgeLabelContainer({
|
|
@@ -44,6 +44,7 @@ const _hideOnReducedGraphics = css.raw({
|
|
|
44
44
|
export const hideOnReducedGraphics = css(_hideOnReducedGraphics)
|
|
45
45
|
|
|
46
46
|
export const edgePathBg = css(_hideOnReducedGraphics, {
|
|
47
|
+
fill: '[none]',
|
|
47
48
|
strokeWidth: 'calc(var(--xy-edge-stroke-width) + 2)',
|
|
48
49
|
strokeOpacity: 0.08,
|
|
49
50
|
transitionProperty: 'stroke-width, stroke-opacity',
|
|
@@ -70,6 +71,7 @@ export const markerContext = css({
|
|
|
70
71
|
})
|
|
71
72
|
|
|
72
73
|
export const cssEdgePath = css({
|
|
74
|
+
fill: '[none]',
|
|
73
75
|
strokeDashoffset: 10,
|
|
74
76
|
_noReduceGraphics: {
|
|
75
77
|
transition: 'stroke 130ms ease-out,stroke-width 130ms ease-out',
|
|
@@ -7,7 +7,7 @@ export const indicator = css({
|
|
|
7
7
|
stroke: 'likec4.palette.loContrast',
|
|
8
8
|
fill: '[none]',
|
|
9
9
|
|
|
10
|
-
strokeWidth:
|
|
10
|
+
strokeWidth: 8,
|
|
11
11
|
strokeOpacity: 0.8,
|
|
12
12
|
visibility: 'hidden',
|
|
13
13
|
pointerEvents: 'none',
|
|
@@ -15,26 +15,15 @@ export const indicator = css({
|
|
|
15
15
|
stroke: `[color-mix(in srgb, {colors.likec4.palette.fill} 50%,rgb(121, 121, 121))]`,
|
|
16
16
|
},
|
|
17
17
|
_whenFocused: {
|
|
18
|
-
strokeWidth: 12,
|
|
19
18
|
visibility: 'visible',
|
|
20
19
|
},
|
|
21
20
|
_groupFocusVisible: {
|
|
22
|
-
strokeWidth: 12,
|
|
23
21
|
visibility: 'visible',
|
|
24
22
|
},
|
|
25
23
|
_whenSelected: {
|
|
26
24
|
animationStyle: 'indicator',
|
|
27
25
|
visibility: 'visible',
|
|
28
26
|
},
|
|
29
|
-
_shapeQueue: {
|
|
30
|
-
strokeWidth: 8,
|
|
31
|
-
},
|
|
32
|
-
_shapeCylinder: {
|
|
33
|
-
strokeWidth: 8,
|
|
34
|
-
},
|
|
35
|
-
_shapeStorage: {
|
|
36
|
-
strokeWidth: 8,
|
|
37
|
-
},
|
|
38
27
|
})
|
|
39
28
|
|
|
40
29
|
export const fillElementFill = css({
|
|
@@ -20,7 +20,7 @@ const description = css.raw({
|
|
|
20
20
|
display: 'none',
|
|
21
21
|
},
|
|
22
22
|
_smallZoom: {
|
|
23
|
-
|
|
23
|
+
display: 'none',
|
|
24
24
|
},
|
|
25
25
|
})
|
|
26
26
|
|
|
@@ -43,7 +43,7 @@ const technology = css.raw({
|
|
|
43
43
|
display: 'none',
|
|
44
44
|
},
|
|
45
45
|
_smallZoom: {
|
|
46
|
-
|
|
46
|
+
display: 'none',
|
|
47
47
|
},
|
|
48
48
|
})
|
|
49
49
|
|
|
@@ -97,6 +97,7 @@ export const elementTitle = sva({
|
|
|
97
97
|
paddingLeft: 'calc(var(--likec4-spacing) + 8px)',
|
|
98
98
|
paddingRight: 'calc(var(--likec4-spacing) + 8px)',
|
|
99
99
|
overflow: 'hidden',
|
|
100
|
+
pointerEvents: 'none',
|
|
100
101
|
gap: '12px',
|
|
101
102
|
_shapeQueue: {
|
|
102
103
|
paddingLeft: '46px',
|
package/src/base/types.ts
CHANGED
|
@@ -111,7 +111,7 @@ export namespace Base {
|
|
|
111
111
|
type WithHovered = { data: { hovered?: boolean } }
|
|
112
112
|
|
|
113
113
|
const _setDimmed = <T extends WithDimmed>(v: T, dimmed: Dimmed): T =>
|
|
114
|
-
v.data.dimmed === dimmed ? v : ({
|
|
114
|
+
(v.data.dimmed ?? false) === dimmed ? v : ({
|
|
115
115
|
...v,
|
|
116
116
|
data: {
|
|
117
117
|
...v.data,
|
|
@@ -129,7 +129,7 @@ export namespace Base {
|
|
|
129
129
|
}
|
|
130
130
|
|
|
131
131
|
const _setHovered = <T extends WithHovered>(v: T, hovered: boolean): T =>
|
|
132
|
-
v.data.hovered === hovered ? v : ({
|
|
132
|
+
(v.data.hovered ?? false) === hovered ? v : ({
|
|
133
133
|
...v,
|
|
134
134
|
data: {
|
|
135
135
|
...v.data,
|
|
@@ -167,8 +167,3 @@ export namespace Base {
|
|
|
167
167
|
return (edge: E) => _setData(edge, arg1 as Partial<EdgeData>)
|
|
168
168
|
}
|
|
169
169
|
}
|
|
170
|
-
|
|
171
|
-
// import type { ThemeColor } from '@likec4/core'
|
|
172
|
-
// import type { ColorPalette as AllColorPalette } from '@likec4/styles/tokens'
|
|
173
|
-
|
|
174
|
-
// export type ColorPalette = Extract<AllColorPalette, `likec4.${ThemeColor}` | `likec4.compound${number}.${ThemeColor}`>
|
package/src/components/Link.tsx
CHANGED
|
@@ -59,7 +59,9 @@ export function Link({
|
|
|
59
59
|
value: LinkData
|
|
60
60
|
}) {
|
|
61
61
|
const isNormalSize = size === 'md'
|
|
62
|
-
|
|
62
|
+
// If the url is already a full url, use it as is.
|
|
63
|
+
// Otherwise, it's a relative url and we need to make it absolute.
|
|
64
|
+
const url = value.url.includes('://') ? value.url : new window.URL(value.url, window.location.href).toString()
|
|
63
65
|
return (
|
|
64
66
|
<CopyButton value={url}>
|
|
65
67
|
{({ copied, copy }) => (
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import { type EdgeId, type NodeId, nonNullable } from '@likec4/core'
|
|
2
2
|
import { cx } from '@likec4/styles/css'
|
|
3
|
-
import { useCallbackRef, useTimeout } from '@mantine/hooks'
|
|
3
|
+
import { useCallbackRef, useDebouncedCallback, useTimeout } from '@mantine/hooks'
|
|
4
4
|
import type { OnMove, OnMoveEnd } from '@xyflow/system'
|
|
5
5
|
import { deepEqual, shallowEqual } from 'fast-equals'
|
|
6
6
|
import { type PropsWithChildren, memo } from 'react'
|
|
7
7
|
import { BaseXYFlow } from '../base/BaseXYFlow'
|
|
8
8
|
import { useDiagramEventHandlers } from '../context'
|
|
9
|
-
import { usePanningAtom } from '../context/ReduceGraphics'
|
|
9
|
+
import { useIsReducedGraphics, usePanningAtom } from '../context/ReduceGraphics'
|
|
10
10
|
import { useDiagram, useDiagramContext } from '../hooks/useDiagram'
|
|
11
11
|
import type { LikeC4DiagramProperties } from '../LikeC4Diagram.props'
|
|
12
12
|
import type { DiagramContext } from '../state/types'
|
|
@@ -16,7 +16,7 @@ import type { Types } from './types'
|
|
|
16
16
|
import { useLayoutConstraints } from './useLayoutConstraints'
|
|
17
17
|
|
|
18
18
|
const selectXYProps = (ctx: DiagramContext) => ({
|
|
19
|
-
initialized: ctx.initialized,
|
|
19
|
+
initialized: ctx.initialized.xydata && ctx.initialized.xyflow,
|
|
20
20
|
nodes: ctx.xynodes,
|
|
21
21
|
edges: ctx.xyedges,
|
|
22
22
|
pannable: ctx.pannable,
|
|
@@ -87,12 +87,15 @@ export const LikeC4DiagramXYFlow = memo<LikeC4DiagramXYFlowProps>(({
|
|
|
87
87
|
} = useDiagramEventHandlers()
|
|
88
88
|
|
|
89
89
|
const notReadOnly = !enableReadOnly,
|
|
90
|
+
isReducedGraphics = useIsReducedGraphics(),
|
|
90
91
|
layoutConstraints = useLayoutConstraints(),
|
|
91
92
|
$isPanning = usePanningAtom(),
|
|
92
93
|
isPanning = useTimeout(() => {
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
94
|
+
if (!$isPanning.get()) {
|
|
95
|
+
$isPanning.set(true)
|
|
96
|
+
}
|
|
97
|
+
}, isReducedGraphics ? 150 : 350),
|
|
98
|
+
notPanning = useDebouncedCallback(() => {
|
|
96
99
|
isPanning.clear()
|
|
97
100
|
if ($isPanning.get()) {
|
|
98
101
|
$isPanning.set(false)
|
|
@@ -105,11 +108,10 @@ export const LikeC4DiagramXYFlow = memo<LikeC4DiagramXYFlowProps>(({
|
|
|
105
108
|
if (!$isPanning.get()) {
|
|
106
109
|
isPanning.start()
|
|
107
110
|
}
|
|
108
|
-
notPanning
|
|
109
|
-
notPanning.start()
|
|
111
|
+
notPanning()
|
|
110
112
|
}),
|
|
111
113
|
onMoveEnd: OnMoveEnd = useCallbackRef((event, viewport) => {
|
|
112
|
-
notPanning.
|
|
114
|
+
notPanning.flush()
|
|
113
115
|
diagram.send({ type: 'xyflow.viewportMoved', viewport, manually: !!event })
|
|
114
116
|
}),
|
|
115
117
|
onViewportResize = useCallbackRef(() => {
|
|
@@ -132,7 +132,7 @@ export const RelationshipEdge = customEdge<Types.RelationshipEdgeData>((props) =
|
|
|
132
132
|
return
|
|
133
133
|
}
|
|
134
134
|
// This update stays only in internal xystate, not in diagram xstate
|
|
135
|
-
|
|
135
|
+
diagram.updateEdgeData(id as EdgeId, {
|
|
136
136
|
labelXY: {
|
|
137
137
|
x: labelPos.x,
|
|
138
138
|
y: labelPos.y,
|
|
@@ -169,15 +169,13 @@ export const RelationshipEdge = customEdge<Types.RelationshipEdgeData>((props) =
|
|
|
169
169
|
hasMoved = true
|
|
170
170
|
pointer = clientPoint
|
|
171
171
|
const { x, y } = xyflow.screenToFlowPosition(pointer, { snapToGrid: false })
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
controlPoints: cp,
|
|
180
|
-
}
|
|
172
|
+
const cp = controlPoints.slice()
|
|
173
|
+
cp[index] = {
|
|
174
|
+
x: Math.round(x),
|
|
175
|
+
y: Math.round(y),
|
|
176
|
+
}
|
|
177
|
+
diagram.updateEdgeData(id as EdgeId, {
|
|
178
|
+
controlPoints: cp,
|
|
181
179
|
})
|
|
182
180
|
}
|
|
183
181
|
e.stopPropagation()
|
|
@@ -216,14 +214,9 @@ export const RelationshipEdge = customEdge<Types.RelationshipEdgeData>((props) =
|
|
|
216
214
|
e.stopPropagation()
|
|
217
215
|
// Defer the update to avoid conflict with the pointerup event
|
|
218
216
|
setTimeout(() => {
|
|
219
|
-
|
|
217
|
+
diagram.updateEdgeData(id as EdgeId, { controlPoints: newControlPoints })
|
|
220
218
|
diagram.scheduleSaveManualLayout()
|
|
221
219
|
}, 10)
|
|
222
|
-
|
|
223
|
-
domNode.removeEventListener('pointerup', onPointerUp, {
|
|
224
|
-
capture: true,
|
|
225
|
-
})
|
|
226
|
-
e.stopPropagation()
|
|
227
220
|
}
|
|
228
221
|
|
|
229
222
|
domNode.addEventListener('pointerup', onPointerUp, {
|
|
@@ -259,42 +252,40 @@ export const RelationshipEdge = customEdge<Types.RelationshipEdgeData>((props) =
|
|
|
259
252
|
if (e.button !== 2) {
|
|
260
253
|
return
|
|
261
254
|
}
|
|
255
|
+
const points: VectorImpl[] = [
|
|
256
|
+
new VectorImpl(sourceX, sourceY),
|
|
257
|
+
...controlPoints.map(vector) || [],
|
|
258
|
+
new VectorImpl(targetX, targetY),
|
|
259
|
+
]
|
|
262
260
|
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
const
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
// Calculate distance by approximating edge segment with a staight line
|
|
284
|
-
const distanceToEdge = Math.abs(fromCurrentToNext.cross(fromCurrentToNew).abs() / fromCurrentToNext.abs())
|
|
285
|
-
|
|
286
|
-
if (distanceToEdge < minDistance) {
|
|
287
|
-
minDistance = distanceToEdge
|
|
288
|
-
insertionIndex = i
|
|
289
|
-
}
|
|
261
|
+
let pointer = { x: e.clientX, y: e.clientY }
|
|
262
|
+
const newPoint = vector(xyflow.screenToFlowPosition(pointer, { snapToGrid: false }))
|
|
263
|
+
|
|
264
|
+
let insertionIndex = 0
|
|
265
|
+
let minDistance = Infinity
|
|
266
|
+
for (let i = 0; i < points.length - 1; i++) {
|
|
267
|
+
const a = points[i]!,
|
|
268
|
+
b = points[i + 1]!,
|
|
269
|
+
fromCurrentToNext = b.sub(a),
|
|
270
|
+
fromCurrentToNew = newPoint.sub(a),
|
|
271
|
+
fromNextToNew = newPoint.sub(b)
|
|
272
|
+
|
|
273
|
+
// Is pointer above the current segment?
|
|
274
|
+
if (fromCurrentToNext.dot(fromCurrentToNew) * fromCurrentToNext.dot(fromNextToNew) < 0) {
|
|
275
|
+
// Calculate distance by approximating edge segment with a staight line
|
|
276
|
+
const distanceToEdge = Math.abs(fromCurrentToNext.cross(fromCurrentToNew).abs() / fromCurrentToNext.abs())
|
|
277
|
+
|
|
278
|
+
if (distanceToEdge < minDistance) {
|
|
279
|
+
minDistance = distanceToEdge
|
|
280
|
+
insertionIndex = i
|
|
290
281
|
}
|
|
291
282
|
}
|
|
283
|
+
}
|
|
292
284
|
|
|
293
|
-
|
|
294
|
-
|
|
285
|
+
const newControlPoints = controlPoints.slice() || []
|
|
286
|
+
newControlPoints.splice(insertionIndex, 0, newPoint)
|
|
295
287
|
|
|
296
|
-
|
|
297
|
-
})
|
|
288
|
+
diagram.updateEdgeData(id as EdgeId, { controlPoints: newControlPoints })
|
|
298
289
|
|
|
299
290
|
diagram.scheduleSaveManualLayout()
|
|
300
291
|
|
|
@@ -357,7 +348,7 @@ export const RelationshipEdge = customEdge<Types.RelationshipEdgeData>((props) =
|
|
|
357
348
|
</EdgeLabelContainer>
|
|
358
349
|
</EdgeContainer>
|
|
359
350
|
{/* Render control points above edge label */}
|
|
360
|
-
{enableEdgeEditing && controlPoints.length > 0 && (
|
|
351
|
+
{enableEdgeEditing && controlPoints.length > 0 && (selected || hovered || isControlPointDragging) && (
|
|
361
352
|
<EdgeLabelRenderer>
|
|
362
353
|
<EdgeContainer
|
|
363
354
|
component="svg"
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Box, Group, Paper, Stack, Text } from '@mantine/core'
|
|
1
|
+
import { Box, Group, Paper, Stack, Text, Tooltip } from '@mantine/core'
|
|
2
2
|
import { useDebouncedValue } from '@mantine/hooks'
|
|
3
3
|
import { type NodeToolbarProps, NodeToolbar } from '@xyflow/react'
|
|
4
4
|
import clsx from 'clsx'
|
|
@@ -69,7 +69,7 @@ export function Toolbar({ title, children, nodeProps, ...props }: ToolbarProps)
|
|
|
69
69
|
withBorder>
|
|
70
70
|
<Stack gap={'6px'}>
|
|
71
71
|
<Box px={'4px'}>
|
|
72
|
-
<Text
|
|
72
|
+
<Text className={styles.toolbarTitle}>{title}</Text>
|
|
73
73
|
</Box>
|
|
74
74
|
<Group gap={4}>
|
|
75
75
|
{children}
|
|
@@ -1,8 +1,13 @@
|
|
|
1
1
|
import { css } from '@likec4/styles/css'
|
|
2
2
|
|
|
3
3
|
export const toolbarTitle = css({
|
|
4
|
+
color: 'mantine.colors.dimmed',
|
|
4
5
|
fontSize: '10px',
|
|
5
6
|
fontWeight: 600,
|
|
7
|
+
maxWidth: '220px',
|
|
6
8
|
cursor: 'default',
|
|
7
9
|
userSelect: 'all',
|
|
10
|
+
textOverflow: 'ellipsis',
|
|
11
|
+
overflow: 'hidden',
|
|
12
|
+
whiteSpace: 'nowrap',
|
|
8
13
|
})
|
|
@@ -5,14 +5,13 @@ import {
|
|
|
5
5
|
HoverCardDropdown,
|
|
6
6
|
HoverCardTarget,
|
|
7
7
|
Notification,
|
|
8
|
-
Overlay,
|
|
9
8
|
Text,
|
|
10
9
|
} from '@mantine/core'
|
|
11
10
|
import {
|
|
12
11
|
IconAlertTriangle,
|
|
13
12
|
} from '@tabler/icons-react'
|
|
14
13
|
|
|
15
|
-
|
|
14
|
+
import { css } from '@likec4/styles/css'
|
|
16
15
|
import { ActionIcon } from './_shared'
|
|
17
16
|
|
|
18
17
|
export const LayoutDriftNotification = (props: PopoverProps) => (
|
|
@@ -22,8 +21,13 @@ export const LayoutDriftNotification = (props: PopoverProps) => (
|
|
|
22
21
|
closeDelay={100}
|
|
23
22
|
{...props}>
|
|
24
23
|
<HoverCardTarget>
|
|
25
|
-
<ActionIcon
|
|
26
|
-
|
|
24
|
+
<ActionIcon
|
|
25
|
+
color={'orange'}
|
|
26
|
+
c="orange"
|
|
27
|
+
className={css({
|
|
28
|
+
bg: 'mantine.colors.orange.light',
|
|
29
|
+
})}
|
|
30
|
+
>
|
|
27
31
|
<IconAlertTriangle />
|
|
28
32
|
</ActionIcon>
|
|
29
33
|
</HoverCardTarget>
|