@likec4/diagram 1.27.2 → 1.27.3
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 +153 -175
- package/dist/base/primitives/edge/EdgeLabelContainer.js +3 -2
- package/dist/base/primitives/element/ElementActionButtons.js +6 -4
- package/dist/hooks/useDiagram.d.ts +5 -1
- package/dist/hooks/useDiagram.js +9 -20
- package/dist/likec4diagram/DiagramXYFlow.js +6 -6
- package/dist/overlays/overlay/Overlay.css.js +3 -3
- package/dist/overlays/overlay/Overlay.js +1 -3
- package/dist/overlays/relationship-details/actor.d.ts +15 -5
- package/dist/overlays/relationship-details/actor.js +1 -6
- package/dist/overlays/relationship-details/hooks.js +2 -5
- package/dist/overlays/relationship-details/layout-to-xyflow.js +0 -4
- package/dist/overlays/relationships-browser/hooks.js +5 -8
- package/dist/overlays/relationships-browser/layout.d.ts +1 -1
- package/dist/overlays/relationships-browser/layout.js +2 -6
- package/dist/styles.css.js +1 -1
- package/dist/utils/index.d.ts +0 -1
- package/package.json +4 -4
- package/src/base/primitives/edge/EdgeLabelContainer.tsx +7 -5
- package/src/base/primitives/element/ElementActionButtons.tsx +7 -7
- package/src/hooks/useDiagram.ts +8 -19
- package/src/likec4diagram/DiagramXYFlow.tsx +6 -6
- package/src/overlays/Overlays.tsx +1 -1
- package/src/overlays/overlay/Overlay.css.ts +3 -3
- package/src/overlays/overlay/Overlay.tsx +2 -4
- package/src/overlays/relationship-details/actor.ts +1 -6
- package/src/overlays/relationship-details/hooks.ts +2 -5
- package/src/overlays/relationship-details/layout-to-xyflow.ts +2 -25
- package/src/overlays/relationships-browser/hooks.ts +5 -8
- package/src/overlays/relationships-browser/layout.ts +3 -20
- package/src/utils/index.ts +0 -1
- package/dist/utils/types.d.ts +0 -8
- package/src/utils/types.ts +0 -6
package/dist/utils/index.d.ts
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
export type { AddEdgeData, AddNodeData } from './types';
|
|
2
1
|
export { vector, VectorImpl } from './vector';
|
|
3
2
|
export type { Vector } from './vector';
|
|
4
3
|
export { bezierControlPoints, bezierPath, centerXYInternalNode, distance, distanceBetweenPoints, isInside, isSamePoint, nodeToRect, stopPropagation, toDomPrecision, } from './xyflow';
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@likec4/diagram",
|
|
3
|
-
"version": "1.27.
|
|
3
|
+
"version": "1.27.3",
|
|
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/core": "1.27.
|
|
67
|
-
"@likec4/styles": "1.27.
|
|
66
|
+
"@likec4/core": "1.27.3",
|
|
67
|
+
"@likec4/styles": "1.27.3"
|
|
68
68
|
},
|
|
69
69
|
"devDependencies": {
|
|
70
70
|
"@pandacss/dev": "^0.53.3",
|
|
@@ -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.3"
|
|
85
85
|
},
|
|
86
86
|
"scripts": {
|
|
87
87
|
"generate": "panda codegen",
|
|
@@ -101,14 +101,16 @@ export function EdgeLabelContainer({
|
|
|
101
101
|
}}
|
|
102
102
|
{...rest}
|
|
103
103
|
>
|
|
104
|
-
{/* Work around to keep same global selector data-likec4-dimmed */}
|
|
105
104
|
<div
|
|
106
|
-
|
|
105
|
+
style={{
|
|
107
106
|
display: 'contents',
|
|
108
|
-
})}
|
|
109
|
-
{...isDimmed !== false && {
|
|
110
|
-
'data-likec4-dimmed': isDimmed,
|
|
111
107
|
}}
|
|
108
|
+
{
|
|
109
|
+
// Work around to keep same global selector data-likec4-dimmed
|
|
110
|
+
...isDimmed !== false && {
|
|
111
|
+
'data-likec4-dimmed': isDimmed,
|
|
112
|
+
}
|
|
113
|
+
}
|
|
112
114
|
>
|
|
113
115
|
{children}
|
|
114
116
|
</div>
|
|
@@ -63,22 +63,22 @@ export function ElementActionButtons({
|
|
|
63
63
|
className={cx('nodrag nopan', actionButtons)}
|
|
64
64
|
>
|
|
65
65
|
{buttons.map((button, index) => (
|
|
66
|
-
<
|
|
66
|
+
<ActionIcon
|
|
67
|
+
component={m.button}
|
|
68
|
+
layout
|
|
69
|
+
className={actionBtn({})}
|
|
67
70
|
key={`action-button-${id}-${button.key ?? index}`}
|
|
68
71
|
initial={false}
|
|
69
72
|
whileTap={{ scale: 1 }}
|
|
70
73
|
whileHover={{
|
|
71
74
|
scale: 1.3,
|
|
72
75
|
}}
|
|
73
|
-
onTap={e => button.onClick(e as unknown as React.MouseEvent)}
|
|
74
76
|
// Otherwise node receives click event and is selected
|
|
75
|
-
onClick={
|
|
77
|
+
onClick={button.onClick}
|
|
76
78
|
onDoubleClick={stopPropagation}
|
|
77
79
|
>
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
</ActionIcon>
|
|
81
|
-
</m.div>
|
|
80
|
+
{button.icon}
|
|
81
|
+
</ActionIcon>
|
|
82
82
|
))}
|
|
83
83
|
</Box>
|
|
84
84
|
</Box>
|
package/src/hooks/useDiagram.ts
CHANGED
|
@@ -16,38 +16,27 @@ export { useDiagramActorRef }
|
|
|
16
16
|
|
|
17
17
|
export function useDiagram() {
|
|
18
18
|
const actor = useDiagramActorRef()
|
|
19
|
-
const [, startTransition] = useTransition()
|
|
20
19
|
return useMemo(() => ({
|
|
21
20
|
actor,
|
|
22
21
|
send: actor.send,
|
|
23
22
|
navigateTo: (viewId: ViewId, fromNode?: NodeId) => {
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
...(fromNode && { fromNode }),
|
|
29
|
-
})
|
|
23
|
+
actor.send({
|
|
24
|
+
type: 'navigate.to',
|
|
25
|
+
viewId,
|
|
26
|
+
...(fromNode && { fromNode }),
|
|
30
27
|
})
|
|
31
28
|
},
|
|
32
29
|
navigate: (direction: 'back' | 'forward') => {
|
|
33
|
-
|
|
34
|
-
actor.send({ type: `navigate.${direction}` })
|
|
35
|
-
})
|
|
30
|
+
actor.send({ type: `navigate.${direction}` })
|
|
36
31
|
},
|
|
37
32
|
fitDiagram: (duration = 350) => {
|
|
38
|
-
|
|
39
|
-
actor.send({ type: 'fitDiagram', duration })
|
|
40
|
-
})
|
|
33
|
+
actor.send({ type: 'fitDiagram', duration })
|
|
41
34
|
},
|
|
42
35
|
openRelationshipsBrowser: (fqn: Fqn) => {
|
|
43
|
-
|
|
44
|
-
actor.send({ type: 'open.relationshipsBrowser', fqn })
|
|
45
|
-
})
|
|
36
|
+
actor.send({ type: 'open.relationshipsBrowser', fqn })
|
|
46
37
|
},
|
|
47
38
|
openSource: (params: OpenSourceParams) => {
|
|
48
|
-
|
|
49
|
-
actor.send({ type: 'open.source', ...params })
|
|
50
|
-
})
|
|
39
|
+
actor.send({ type: 'open.source', ...params })
|
|
51
40
|
},
|
|
52
41
|
openElementDetails: (fqn: Fqn, fromNode?: NodeId) => {
|
|
53
42
|
actor.send({ type: 'open.elementDetails', fqn, fromNode })
|
|
@@ -91,16 +91,14 @@ export const LikeC4DiagramXYFlow = memo<LikeC4DiagramXYFlowProps>(({
|
|
|
91
91
|
layoutConstraints = useLayoutConstraints(),
|
|
92
92
|
$isPanning = usePanningAtom(),
|
|
93
93
|
isPanning = useTimeout(() => {
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
}
|
|
97
|
-
}, isReducedGraphics ? 150 : 350),
|
|
94
|
+
$isPanning.set(true)
|
|
95
|
+
}, isReducedGraphics ? 100 : 200),
|
|
98
96
|
notPanning = useDebouncedCallback(() => {
|
|
99
97
|
isPanning.clear()
|
|
100
98
|
if ($isPanning.get()) {
|
|
101
99
|
$isPanning.set(false)
|
|
102
100
|
}
|
|
103
|
-
},
|
|
101
|
+
}, 200),
|
|
104
102
|
onMove: OnMove = useCallbackRef((event) => {
|
|
105
103
|
if (!event) {
|
|
106
104
|
return
|
|
@@ -111,7 +109,9 @@ export const LikeC4DiagramXYFlow = memo<LikeC4DiagramXYFlowProps>(({
|
|
|
111
109
|
notPanning()
|
|
112
110
|
}),
|
|
113
111
|
onMoveEnd: OnMoveEnd = useCallbackRef((event, viewport) => {
|
|
114
|
-
|
|
112
|
+
if (!!event) {
|
|
113
|
+
notPanning.flush()
|
|
114
|
+
}
|
|
115
115
|
diagram.send({ type: 'xyflow.viewportMoved', viewport, manually: !!event })
|
|
116
116
|
}),
|
|
117
117
|
onViewportResize = useCallbackRef(() => {
|
|
@@ -2,7 +2,7 @@ import { nonexhaustive } from '@likec4/core'
|
|
|
2
2
|
import { Box, Button, Code, Group, Notification, ScrollAreaAutosize } from '@mantine/core'
|
|
3
3
|
import { IconX } from '@tabler/icons-react'
|
|
4
4
|
import { useSelector } from '@xstate/react'
|
|
5
|
-
import { AnimatePresence, LayoutGroup,
|
|
5
|
+
import { AnimatePresence, LayoutGroup, useReducedMotionConfig } from 'framer-motion'
|
|
6
6
|
import { animate } from 'framer-motion/dom'
|
|
7
7
|
import { memo, useEffect, useMemo } from 'react'
|
|
8
8
|
import { type FallbackProps, ErrorBoundary } from 'react-error-boundary'
|
|
@@ -24,7 +24,7 @@ const dialog = css.raw({
|
|
|
24
24
|
[backdropBlur]: '0px',
|
|
25
25
|
[level]: '0',
|
|
26
26
|
[offset]: '0px',
|
|
27
|
-
[inset]: 'calc((1 + var(--_level) * 0.
|
|
27
|
+
[inset]: 'calc((1 + var(--_level) * 0.75) * var(--_offset))',
|
|
28
28
|
[backdropOpacity]: '0%',
|
|
29
29
|
_backdrop: {
|
|
30
30
|
cursor: 'zoom-out',
|
|
@@ -45,8 +45,8 @@ const dialog = css.raw({
|
|
|
45
45
|
height: '100vh',
|
|
46
46
|
},
|
|
47
47
|
sm: {
|
|
48
|
-
inset: '[var(--_inset) var(--
|
|
49
|
-
width: 'calc(100vw -
|
|
48
|
+
inset: '[var(--_inset) var(--_inset) var(--_offset) var(--_inset)]',
|
|
49
|
+
width: 'calc(100vw - 2 * var(--_inset))',
|
|
50
50
|
height: 'calc(100vh - var(--_offset) - var(--_inset))',
|
|
51
51
|
[borderRadius]: '6px',
|
|
52
52
|
padding: '6px',
|
|
@@ -5,7 +5,7 @@ import {
|
|
|
5
5
|
} from '@mantine/core'
|
|
6
6
|
import { useMergedRef } from '@mantine/hooks'
|
|
7
7
|
import { useDebouncedCallback, useSyncedRef, useTimeoutEffect } from '@react-hookz/web'
|
|
8
|
-
import {
|
|
8
|
+
import { m, useReducedMotionConfig } from 'framer-motion'
|
|
9
9
|
import { type PropsWithChildren, forwardRef, useLayoutEffect, useRef, useState } from 'react'
|
|
10
10
|
import { stopPropagation } from '../../utils'
|
|
11
11
|
import { backdropBlur, backdropOpacity, overlay as overlayCVA } from './Overlay.css'
|
|
@@ -84,15 +84,13 @@ export const Overlay = forwardRef<HTMLDialogElement, OverlayProps>(
|
|
|
84
84
|
[backdropOpacity]: overlayLevel > 0 ? '50%' : '60%',
|
|
85
85
|
scale: 1,
|
|
86
86
|
opacity: 1,
|
|
87
|
-
translateY: 0,
|
|
88
87
|
transition: {
|
|
89
88
|
delay: 0.075,
|
|
90
89
|
},
|
|
91
90
|
},
|
|
92
91
|
exit: {
|
|
93
|
-
scale: 1.
|
|
92
|
+
scale: 1.2,
|
|
94
93
|
opacity: 0,
|
|
95
|
-
translateY: -10,
|
|
96
94
|
[backdropBlur]: '0px',
|
|
97
95
|
[backdropOpacity]: '0%',
|
|
98
96
|
},
|
|
@@ -321,12 +321,7 @@ export const relationshipDetailsLogic = setup({
|
|
|
321
321
|
actions: [
|
|
322
322
|
'updateLayoutData',
|
|
323
323
|
cancel('fitDiagram'),
|
|
324
|
-
{
|
|
325
|
-
type: 'xyflow:fitDiagram',
|
|
326
|
-
params: {
|
|
327
|
-
duration: 0,
|
|
328
|
-
},
|
|
329
|
-
},
|
|
324
|
+
raise({ type: 'fitDiagram', duration: 0 }, { id: 'fitDiagram', delay: 50 }),
|
|
330
325
|
raise({ type: 'xyflow.updateNodeInternals' }, { delay: 75 }),
|
|
331
326
|
],
|
|
332
327
|
},
|
|
@@ -2,7 +2,7 @@ import { type EdgeId, type Fqn, nonNullable } from '@likec4/core'
|
|
|
2
2
|
import { useCallbackRef } from '@mantine/hooks'
|
|
3
3
|
import { useSelector } from '@xstate/react'
|
|
4
4
|
import { shallowEqual } from 'fast-equals'
|
|
5
|
-
import { createContext, useContext, useMemo
|
|
5
|
+
import { createContext, useContext, useMemo } from 'react'
|
|
6
6
|
import type { OverlaysActorRef } from '../overlaysActor'
|
|
7
7
|
import type { RelationshipDetailsActorRef, RelationshipDetailsSnapshot } from './actor'
|
|
8
8
|
|
|
@@ -23,7 +23,6 @@ export function useRelationshipDetailsState<T = unknown>(
|
|
|
23
23
|
|
|
24
24
|
export function useRelationshipDetails() {
|
|
25
25
|
const actor = useRelationshipDetailsActor()
|
|
26
|
-
const [, startTransition] = useTransition()
|
|
27
26
|
return useMemo(() => ({
|
|
28
27
|
actor,
|
|
29
28
|
get rootElementId(): string {
|
|
@@ -39,9 +38,7 @@ export function useRelationshipDetails() {
|
|
|
39
38
|
}
|
|
40
39
|
},
|
|
41
40
|
fitDiagram: () => {
|
|
42
|
-
|
|
43
|
-
actor.send({ type: 'fitDiagram' })
|
|
44
|
-
})
|
|
41
|
+
actor.send({ type: 'fitDiagram' })
|
|
45
42
|
},
|
|
46
43
|
close: () => {
|
|
47
44
|
if (actor._parent) {
|
|
@@ -1,35 +1,12 @@
|
|
|
1
|
-
import dagre, { type GraphLabel, type Label } from '@dagrejs/dagre'
|
|
2
1
|
import {
|
|
3
|
-
type AbstractRelation,
|
|
4
|
-
type DiagramEdge,
|
|
5
|
-
type DiagramView,
|
|
6
|
-
type EdgeId,
|
|
7
2
|
type Fqn,
|
|
8
|
-
type LikeC4Model,
|
|
9
|
-
type XYPoint,
|
|
10
|
-
compareFqnHierarchically,
|
|
11
|
-
compareRelations,
|
|
12
|
-
DiagramNode,
|
|
13
|
-
invariant,
|
|
14
|
-
isAncestor,
|
|
15
3
|
nonNullable,
|
|
16
4
|
Queue,
|
|
17
5
|
} from '@likec4/core'
|
|
18
|
-
import {
|
|
19
|
-
import { deepEqual } from 'fast-equals'
|
|
20
|
-
import { useMemo } from 'react'
|
|
21
|
-
import { filter, first, forEach, hasAtLeast, isTruthy, map, pipe, prop, reverse, sort, sortBy, takeWhile } from 'remeda'
|
|
6
|
+
import { hasAtLeast } from 'remeda'
|
|
22
7
|
import { ZIndexes } from '../../base/const'
|
|
23
|
-
import { useLikeC4Model } from '../../likec4model'
|
|
24
8
|
import type { RelationshipDetailsTypes } from './_types'
|
|
25
|
-
import type
|
|
26
|
-
import {
|
|
27
|
-
type RelationshipDetailsViewData,
|
|
28
|
-
computeEdgeDetailsViewData,
|
|
29
|
-
computeRelationshipDetailsViewData,
|
|
30
|
-
} from './compute'
|
|
31
|
-
import { useRelationshipDetailsActor, useRelationshipDetailsState } from './hooks'
|
|
32
|
-
import { type LayoutResult, layoutRelationshipDetails } from './layout'
|
|
9
|
+
import { type LayoutResult } from './layout'
|
|
33
10
|
|
|
34
11
|
// const nodeZIndex = (node: DiagramNode) => node.level - (node.children.length > 0 ? 1 : 0)
|
|
35
12
|
export function layoutResultToXYFlow(
|
|
@@ -2,7 +2,7 @@ import { type Fqn, nonNullable } from '@likec4/core'
|
|
|
2
2
|
import { useCallbackRef } from '@mantine/hooks'
|
|
3
3
|
import { useSelector } from '@xstate/react'
|
|
4
4
|
import { shallowEqual } from 'fast-equals'
|
|
5
|
-
import { createContext, useContext, useMemo
|
|
5
|
+
import { createContext, useContext, useMemo } from 'react'
|
|
6
6
|
import type { OverlaysActorRef } from '../overlaysActor'
|
|
7
7
|
import type { RelationshipsBrowserActorRef, RelationshipsBrowserSnapshot } from './actor'
|
|
8
8
|
import type { LayoutRelationshipsViewResult } from './layout'
|
|
@@ -23,7 +23,6 @@ export function useRelationshipsBrowserState<T>(
|
|
|
23
23
|
|
|
24
24
|
export function useRelationshipsBrowser() {
|
|
25
25
|
const actor = useRelationshipsBrowserActor()
|
|
26
|
-
const [, startTransition] = useTransition()
|
|
27
26
|
return useMemo(() => ({
|
|
28
27
|
actor,
|
|
29
28
|
get rootElementId(): string {
|
|
@@ -44,12 +43,10 @@ export function useRelationshipsBrowser() {
|
|
|
44
43
|
})
|
|
45
44
|
},
|
|
46
45
|
navigateTo: (subject: Fqn, fromNode?: string) => {
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
fromNode,
|
|
52
|
-
})
|
|
46
|
+
actor.send({
|
|
47
|
+
type: 'navigate.to',
|
|
48
|
+
subject,
|
|
49
|
+
fromNode,
|
|
53
50
|
})
|
|
54
51
|
},
|
|
55
52
|
fitDiagram: () => {
|
|
@@ -55,7 +55,7 @@ const Sizes = {
|
|
|
55
55
|
edgesep: 25,
|
|
56
56
|
} satisfies GraphLabel,
|
|
57
57
|
edgeLabel: {
|
|
58
|
-
width:
|
|
58
|
+
width: 140,
|
|
59
59
|
height: 10,
|
|
60
60
|
minlen: 1,
|
|
61
61
|
weight: 1,
|
|
@@ -97,19 +97,6 @@ function createGraph() {
|
|
|
97
97
|
g.setDefaultEdgeLabel(() => ({ ...Sizes.edgeLabel }))
|
|
98
98
|
g.setDefaultNodeLabel(() => ({}))
|
|
99
99
|
|
|
100
|
-
// columns.reduce((prev, column) => {
|
|
101
|
-
// const c = graphColumn(column)
|
|
102
|
-
// g.setNode(c.id, {})
|
|
103
|
-
// g.setNode(c.anchor, { width: 40, height: 2 })
|
|
104
|
-
// g.setParent(c.anchor, c.id)
|
|
105
|
-
// if (prev) {
|
|
106
|
-
// g.setEdge(prev, c.anchor, {
|
|
107
|
-
// width: 0
|
|
108
|
-
// })
|
|
109
|
-
// }
|
|
110
|
-
// return c.anchor
|
|
111
|
-
// }, null as string | null)
|
|
112
|
-
|
|
113
100
|
return g
|
|
114
101
|
}
|
|
115
102
|
type G = ReturnType<typeof createGraph>
|
|
@@ -212,7 +199,7 @@ export type LayoutRelationshipsViewResult = {
|
|
|
212
199
|
export namespace LayoutRelationshipsViewResult {
|
|
213
200
|
export const Empty = '@empty' as ElementKind
|
|
214
201
|
|
|
215
|
-
export type Node = DiagramNode & {
|
|
202
|
+
export type Node = Omit<DiagramNode, 'deploymentRef' | 'inEdges' | 'outEdges'> & {
|
|
216
203
|
column: RelationshipsBrowserTypes.Column
|
|
217
204
|
ports: RelationshipsBrowserTypes.Ports
|
|
218
205
|
existsInCurrentView: boolean
|
|
@@ -368,7 +355,7 @@ export function layoutRelationshipsView(
|
|
|
368
355
|
for (const edge of g.edges()) {
|
|
369
356
|
g.setEdge(edge, {
|
|
370
357
|
...Sizes.edgeLabel,
|
|
371
|
-
width: edgeCount >
|
|
358
|
+
width: edgeCount > 25 ? 800 : 400,
|
|
372
359
|
})
|
|
373
360
|
}
|
|
374
361
|
}
|
|
@@ -492,8 +479,6 @@ export function layoutRelationshipsView(
|
|
|
492
479
|
width: width,
|
|
493
480
|
height: height,
|
|
494
481
|
},
|
|
495
|
-
inEdges: [],
|
|
496
|
-
outEdges: [],
|
|
497
482
|
children: [],
|
|
498
483
|
width,
|
|
499
484
|
height,
|
|
@@ -546,8 +531,6 @@ export function layoutRelationshipsView(
|
|
|
546
531
|
...element.$element.style,
|
|
547
532
|
},
|
|
548
533
|
navigateTo,
|
|
549
|
-
inEdges: [],
|
|
550
|
-
outEdges: [],
|
|
551
534
|
...(children.length > 0 && { depth: nodeDepth(id) }),
|
|
552
535
|
children,
|
|
553
536
|
width,
|
package/src/utils/index.ts
CHANGED
package/dist/utils/types.d.ts
DELETED
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
import { Edge, Node } from '@xyflow/react';
|
|
2
|
-
import { Merge } from 'type-fest';
|
|
3
|
-
export type AddNodeData<T extends Node, Data> = Omit<T, 'data'> & {
|
|
4
|
-
data: Merge<T['data'], Data>;
|
|
5
|
-
};
|
|
6
|
-
export type AddEdgeData<T extends Edge, Data> = Omit<T, 'data'> & {
|
|
7
|
-
data: Merge<T['data'], Data>;
|
|
8
|
-
};
|
package/src/utils/types.ts
DELETED
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
import type { Edge, Node } from '@xyflow/react'
|
|
2
|
-
import type { Merge } from 'type-fest'
|
|
3
|
-
|
|
4
|
-
export type AddNodeData<T extends Node, Data> = Omit<T, 'data'> & { data: Merge<T['data'], Data> }
|
|
5
|
-
|
|
6
|
-
export type AddEdgeData<T extends Edge, Data> = Omit<T, 'data'> & { data: Merge<T['data'], Data> }
|