@likec4/diagram 1.27.2 → 1.28.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.
Files changed (75) hide show
  1. package/bundle/index.js +715 -616
  2. package/dist/base/primitives/customEdge.d.ts +1 -1
  3. package/dist/base/primitives/edge/EdgeActionButton.d.ts +1 -2
  4. package/dist/base/primitives/edge/EdgeLabelContainer.js +3 -2
  5. package/dist/base/primitives/edge/EdgePath.d.ts +1 -1
  6. package/dist/base/primitives/element/ElementActionButtons.d.ts +1 -1
  7. package/dist/base/primitives/element/ElementActionButtons.js +11 -7
  8. package/dist/base/primitives/element/ElementDetailsButton.js +5 -1
  9. package/dist/bundle/styles.css.js +2 -2
  10. package/dist/hooks/useDiagram.d.ts +2 -2
  11. package/dist/hooks/useDiagram.js +9 -20
  12. package/dist/hooks/useXYFlow.d.ts +2 -2
  13. package/dist/likec4diagram/DiagramXYFlow.js +6 -6
  14. package/dist/likec4diagram/custom/edges/RelationshipEdge.d.ts +2 -2
  15. package/dist/likec4diagram/custom/edges/RelationshipEdge.js +11 -1
  16. package/dist/likec4diagram/custom/index.d.ts +2 -1
  17. package/dist/likec4diagram/ui/notation/NotationPanel.js +0 -1
  18. package/dist/overlays/Overlays.js +2 -2
  19. package/dist/overlays/element-details/actor.d.ts +303 -303
  20. package/dist/overlays/overlay/Overlay.css.d.ts +2 -25
  21. package/dist/overlays/overlay/Overlay.css.js +3 -43
  22. package/dist/overlays/overlay/Overlay.d.ts +1 -1
  23. package/dist/overlays/overlay/Overlay.js +97 -90
  24. package/dist/overlays/overlaysActor.js +4 -1
  25. package/dist/overlays/relationship-details/RelationshipDetails.d.ts +1 -1
  26. package/dist/overlays/relationship-details/actor.d.ts +16 -7
  27. package/dist/overlays/relationship-details/actor.js +1 -6
  28. package/dist/overlays/relationship-details/custom/edgeTypes.d.ts +1 -1
  29. package/dist/overlays/relationship-details/custom/nodeTypes.js +1 -1
  30. package/dist/overlays/relationship-details/hooks.d.ts +2 -3
  31. package/dist/overlays/relationship-details/hooks.js +2 -5
  32. package/dist/overlays/relationship-details/layout-to-xyflow.js +0 -4
  33. package/dist/overlays/relationships-browser/RelationshipsBrowser.d.ts +1 -1
  34. package/dist/overlays/relationships-browser/actor.d.ts +2 -3
  35. package/dist/overlays/relationships-browser/custom/edgeTypes.d.ts +1 -1
  36. package/dist/overlays/relationships-browser/custom/nodeTypes.js +1 -1
  37. package/dist/overlays/relationships-browser/hooks.d.ts +2 -3
  38. package/dist/overlays/relationships-browser/hooks.js +5 -8
  39. package/dist/overlays/relationships-browser/layout.d.ts +1 -1
  40. package/dist/overlays/relationships-browser/layout.js +2 -6
  41. package/dist/state/diagram-machine.d.ts +2 -2
  42. package/dist/state/hotkeyActor.js +12 -3
  43. package/dist/styles.css.js +1 -1
  44. package/dist/utils/index.d.ts +0 -1
  45. package/package.json +10 -10
  46. package/src/base/primitives/compound/CompoundNodeContainer.css.ts +0 -3
  47. package/src/base/primitives/edge/EdgeActionButton.tsx +1 -2
  48. package/src/base/primitives/edge/EdgeLabelContainer.tsx +7 -5
  49. package/src/base/primitives/element/ElementActionButtons.tsx +11 -9
  50. package/src/base/primitives/element/ElementDetailsButton.tsx +4 -0
  51. package/src/base/primitives/element/ElementNodeContainer.css.ts +0 -18
  52. package/src/bundle/styles.css.ts +7 -2
  53. package/src/components/SearchControl.css.ts +4 -8
  54. package/src/hooks/useDiagram.ts +9 -20
  55. package/src/likec4diagram/DiagramXYFlow.tsx +6 -6
  56. package/src/likec4diagram/custom/edges/RelationshipEdge.tsx +7 -1
  57. package/src/likec4diagram/custom/edges/edges.css.ts +0 -2
  58. package/src/likec4diagram/ui/notation/NotationPanel.css.ts +0 -4
  59. package/src/likec4diagram/ui/notation/NotationPanel.tsx +0 -1
  60. package/src/likec4diagram/ui/search/ViewsColumn.css.ts +0 -4
  61. package/src/overlays/Overlays.tsx +3 -3
  62. package/src/overlays/overlay/Overlay.css.ts +3 -43
  63. package/src/overlays/overlay/Overlay.tsx +108 -101
  64. package/src/overlays/overlaysActor.ts +5 -1
  65. package/src/overlays/relationship-details/actor.ts +1 -6
  66. package/src/overlays/relationship-details/custom/nodeTypes.tsx +1 -1
  67. package/src/overlays/relationship-details/hooks.ts +2 -5
  68. package/src/overlays/relationship-details/layout-to-xyflow.ts +2 -25
  69. package/src/overlays/relationships-browser/custom/nodeTypes.tsx +1 -1
  70. package/src/overlays/relationships-browser/hooks.ts +5 -8
  71. package/src/overlays/relationships-browser/layout.ts +3 -20
  72. package/src/state/hotkeyActor.ts +13 -3
  73. package/src/utils/index.ts +0 -1
  74. package/dist/utils/types.d.ts +0 -8
  75. package/src/utils/types.ts +0 -6
@@ -5,13 +5,13 @@ 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 { type HTMLMotionProps, m, useReducedMotionConfig } from 'framer-motion'
9
- import { type PropsWithChildren, forwardRef, useLayoutEffect, useRef, useState } from 'react'
8
+ import { m, useReducedMotionConfig } from 'framer-motion'
9
+ import { type PropsWithChildren, forwardRef, useEffect, useRef, useState } from 'react'
10
10
  import { stopPropagation } from '../../utils'
11
- import { backdropBlur, backdropOpacity, overlay as overlayCVA } from './Overlay.css'
11
+ import { backdropBlur, backdropOpacity, level as cssVarLevel, overlay as overlayCVA } from './Overlay.css'
12
12
 
13
13
  type OverlayProps = PropsWithChildren<{
14
- overlayLevel?: 0 | 1 | 2 | 3
14
+ overlayLevel?: number
15
15
  className?: string
16
16
  classes?: {
17
17
  dialog?: string
@@ -21,110 +21,117 @@ type OverlayProps = PropsWithChildren<{
21
21
  onClick?: never
22
22
  }>
23
23
 
24
- export const Overlay = forwardRef<HTMLDialogElement, OverlayProps>(
25
- ({ children, onClose, className, classes, overlayLevel = 0, ...rest }, ref) => {
26
- const [opened, setOpened] = useState(false)
27
- const dialogRef = useRef<HTMLDialogElement>(null)
28
- const isClosingRef = useRef(false)
24
+ export const Overlay = forwardRef<HTMLDialogElement, OverlayProps>(({
25
+ onClose,
26
+ className,
27
+ classes,
28
+ overlayLevel = 0,
29
+ children,
30
+ ...rest
31
+ }, ref) => {
32
+ const [opened, setOpened] = useState(false)
33
+ const dialogRef = useRef<HTMLDialogElement>(null)
34
+ const isClosingRef = useRef(false)
29
35
 
30
- const motionNotReduced = useReducedMotionConfig() !== true
36
+ const motionNotReduced = useReducedMotionConfig() !== true
31
37
 
32
- const onCloseRef = useSyncedRef(onClose)
33
- const close = useDebouncedCallback(
34
- () => {
35
- if (isClosingRef.current) return
36
- isClosingRef.current = true
37
- onCloseRef.current()
38
- },
39
- [],
40
- 50,
41
- )
38
+ const onCloseRef = useSyncedRef(onClose)
39
+ const close = useDebouncedCallback(
40
+ () => {
41
+ if (isClosingRef.current) return
42
+ isClosingRef.current = true
43
+ onCloseRef.current()
44
+ },
45
+ [],
46
+ 50,
47
+ )
42
48
 
43
- useLayoutEffect(() => {
44
- const cancel = (e: Event) => {
45
- e.preventDefault()
46
- close()
47
- }
48
- dialogRef.current?.addEventListener('cancel', cancel, { capture: true })
49
- return () => {
50
- dialogRef.current?.removeEventListener('cancel', cancel, { capture: true })
51
- }
52
- }, [])
49
+ useEffect(() => {
50
+ const cancel = (e: Event) => {
51
+ e.preventDefault()
52
+ close()
53
+ }
54
+ dialogRef.current?.addEventListener('cancel', cancel, { capture: true })
55
+ return () => {
56
+ dialogRef.current?.removeEventListener('cancel', cancel, { capture: true })
57
+ }
58
+ }, [])
53
59
 
54
- useTimeoutEffect(() => {
55
- if (!dialogRef.current?.open) {
56
- // Move dialog to the top of the DOM
57
- dialogRef.current?.showModal()
58
- }
59
- }, 20)
60
+ useTimeoutEffect(() => {
61
+ if (!dialogRef.current?.open) {
62
+ // Move dialog to the top of the DOM
63
+ dialogRef.current?.showModal()
64
+ }
65
+ }, 30)
60
66
 
61
- useTimeoutEffect(() => {
62
- setOpened(true)
63
- }, 120)
67
+ useTimeoutEffect(() => {
68
+ setOpened(true)
69
+ }, 120)
64
70
 
65
- const styles = overlayCVA({
66
- level: overlayLevel as 0 | 1 | 2 | 3,
67
- })
71
+ const styles = overlayCVA({
72
+ level: overlayLevel as 0 | 1 | 2 | 3,
73
+ })
68
74
 
69
- return (
70
- <m.dialog
71
- ref={useMergedRef(dialogRef, ref)}
72
- className={cx(RemoveScroll.classNames.fullWidth, styles.dialog, classes?.dialog, className)}
73
- layout
74
- {...motionNotReduced
75
- ? ({
76
- initial: {
77
- [backdropBlur]: '0px',
78
- [backdropOpacity]: '0%',
79
- scale: overlayLevel > 0 ? 0.9 : 1.075,
80
- opacity: 0,
81
- },
82
- animate: {
83
- [backdropBlur]: overlayLevel > 0 ? '4px' : '8px',
84
- [backdropOpacity]: overlayLevel > 0 ? '50%' : '60%',
85
- scale: 1,
86
- opacity: 1,
87
- translateY: 0,
88
- transition: {
89
- delay: 0.075,
90
- },
91
- },
92
- exit: {
93
- scale: 1.3,
94
- opacity: 0,
95
- translateY: -10,
96
- [backdropBlur]: '0px',
97
- [backdropOpacity]: '0%',
75
+ return (
76
+ <m.dialog
77
+ ref={useMergedRef(dialogRef, ref)}
78
+ className={cx(RemoveScroll.classNames.fullWidth, styles.dialog, classes?.dialog, className)}
79
+ layout
80
+ style={{
81
+ // @ts-ignore
82
+ [cssVarLevel]: overlayLevel,
83
+ }}
84
+ {...motionNotReduced
85
+ ? ({
86
+ initial: {
87
+ [backdropBlur]: '0px',
88
+ [backdropOpacity]: '0%',
89
+ scale: overlayLevel > 0 ? 0.9 : 1.075,
90
+ opacity: 0,
91
+ },
92
+ animate: {
93
+ [backdropBlur]: overlayLevel > 0 ? '4px' : '8px',
94
+ [backdropOpacity]: overlayLevel > 0 ? '50%' : '60%',
95
+ scale: 1,
96
+ opacity: 1,
97
+ transition: {
98
+ delay: 0.075,
98
99
  },
99
- })
100
- : {
101
- initial: {
102
- [backdropBlur]: '8px',
103
- [backdropOpacity]: '60%',
104
- },
105
- }}
106
- onClick={e => {
107
- e.stopPropagation()
108
- if ((e.target as any)?.nodeName?.toUpperCase() === 'DIALOG') {
109
- dialogRef.current?.close()
110
- return
111
- }
112
- }}
113
- onDoubleClick={stopPropagation}
114
- onPointerDown={stopPropagation}
115
- onClose={e => {
116
- e.stopPropagation()
117
- close()
100
+ },
101
+ exit: {
102
+ scale: 1.2,
103
+ opacity: 0,
104
+ [backdropBlur]: '0px',
105
+ [backdropOpacity]: '0%',
106
+ },
107
+ })
108
+ : {
109
+ initial: {
110
+ [backdropBlur]: '8px',
111
+ [backdropOpacity]: '60%',
112
+ },
118
113
  }}
119
- {...rest}
120
- >
121
- <RemoveScroll forwardProps removeScrollBar={false}>
122
- <Box className={cx(styles.body, 'overlay-body', classes?.body)}>
123
- {opened && <>{children}</>}
124
- </Box>
125
- </RemoveScroll>
126
- </m.dialog>
127
- )
128
- },
129
- )
114
+ onClick={e => {
115
+ e.stopPropagation()
116
+ if ((e.target as any)?.nodeName?.toUpperCase() === 'DIALOG') {
117
+ dialogRef.current?.close()
118
+ return
119
+ }
120
+ }}
121
+ onDoubleClick={stopPropagation}
122
+ onPointerDown={stopPropagation}
123
+ onClose={e => {
124
+ e.stopPropagation()
125
+ close()
126
+ }}
127
+ {...rest}
128
+ >
129
+ <RemoveScroll forwardProps removeScrollBar={false}>
130
+ <Box className={cx(styles.body, 'overlay-body', classes?.body)}>
131
+ {opened && <>{children}</>}
132
+ </Box>
133
+ </RemoveScroll>
134
+ </m.dialog>
135
+ )
136
+ })
130
137
  Overlay.displayName = 'Overlay'
@@ -1,5 +1,6 @@
1
1
  import type { Fqn } from '@likec4/core'
2
2
  import { getHotkeyHandler } from '@mantine/hooks'
3
+ import type { KeyboardEvent } from 'react'
3
4
  import { isString, last, reverse } from 'remeda'
4
5
  import {
5
6
  type ActorLogicFrom,
@@ -45,7 +46,10 @@ const hotkeyLogic = fromCallback(({ sendBack }: {
45
46
  sendBack: (event: HotKeyEvent) => void
46
47
  }) => {
47
48
  const handler = getHotkeyHandler([
48
- ['Escape', () => sendBack({ type: 'close' }), {
49
+ ['Escape', (event: KeyboardEvent) => {
50
+ event.stopPropagation()
51
+ sendBack({ type: 'close' })
52
+ }, {
49
53
  preventDefault: true,
50
54
  }],
51
55
  ])
@@ -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
  },
@@ -33,7 +33,7 @@ export const ElementNode = customNode<RelationshipDetailsTypes.ElementNodeData>(
33
33
  return (
34
34
  <ElementNodeContainer nodeProps={props}>
35
35
  <ElementShape {...props} />
36
- <ElementTitle {...props} iconSize={40} />
36
+ <ElementTitle {...props} />
37
37
  <ElementDetailsButtonWithHandler {...props} />
38
38
  <ElementActions {...props} />
39
39
  <ElementPorts {...props} />
@@ -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, useTransition } from 'react'
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
- startTransition(() => {
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 { useSelector } from '@xstate/react'
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 { RelationshipDetailsSnapshot } from './actor'
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(
@@ -36,7 +36,7 @@ export const ElementNode = customNode<RelationshipsBrowserTypes.ElementNodeData>
36
36
  return (
37
37
  <ElementNodeContainer key={props.id} component={m.div} layoutId={props.id} nodeProps={props}>
38
38
  <ElementShape {...props} />
39
- <ElementTitle {...props} iconSize={40} />
39
+ <ElementTitle {...props} />
40
40
  <ElementDetailsButtonWithHandler {...props} />
41
41
  <ElementActions {...props} />
42
42
  <ElementPorts {...props} />
@@ -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, useTransition } from 'react'
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
- startTransition(() => {
48
- actor.send({
49
- type: 'navigate.to',
50
- subject,
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: 120,
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 > 30 ? 800 : 400,
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,
@@ -1,4 +1,5 @@
1
1
  import { getHotkeyHandler } from '@mantine/hooks'
2
+ import type { KeyboardEvent } from 'react'
2
3
  import { type AnyEventObject, type NonReducibleUnknown, fromCallback } from 'xstate'
3
4
 
4
5
  export type HotKeyEvent = { type: 'key.esc' | `key.arrow.${'left' | 'right'}` }
@@ -7,16 +8,25 @@ export const hotkeyActorLogic = fromCallback<AnyEventObject, NonReducibleUnknown
7
8
  sendBack: (event: HotKeyEvent) => void
8
9
  }) => {
9
10
  const escHandler = getHotkeyHandler([
10
- ['Escape', () => sendBack({ type: 'key.esc' }), {
11
+ ['Escape', (event: KeyboardEvent) => {
12
+ event.stopPropagation()
13
+ sendBack({ type: 'key.esc' })
14
+ }, {
11
15
  preventDefault: true,
12
16
  }],
13
17
  ])
14
18
 
15
19
  const arrowshandler = getHotkeyHandler([
16
- ['ArrowLeft', () => sendBack({ type: 'key.arrow.left' }), {
20
+ ['ArrowLeft', (event: KeyboardEvent) => {
21
+ event.stopPropagation()
22
+ sendBack({ type: 'key.arrow.left' })
23
+ }, {
17
24
  preventDefault: true,
18
25
  }],
19
- ['ArrowRight', () => sendBack({ type: 'key.arrow.right' }), {
26
+ ['ArrowRight', (event: KeyboardEvent) => {
27
+ event.stopPropagation()
28
+ sendBack({ type: 'key.arrow.right' })
29
+ }, {
20
30
  preventDefault: true,
21
31
  }],
22
32
  ])
@@ -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 {
@@ -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
- };
@@ -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> }