@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.
Files changed (164) hide show
  1. package/bundle/index.js +974 -1036
  2. package/dist/LikeC4CustomColors.js +2 -2
  3. package/dist/LikeC4Diagram.js +2 -2
  4. package/dist/LikeC4ModelProvider.js +1 -1
  5. package/dist/_virtual/index.js +5 -0
  6. package/dist/_virtual/index2.js +3 -0
  7. package/dist/_virtual/react.production.js +3 -0
  8. package/dist/base/BaseXYFlow.js +5 -5
  9. package/dist/base/primitives/compound/CompoundActionButton.js +1 -1
  10. package/dist/base/primitives/compound/CompoundDetailsButton.js +1 -1
  11. package/dist/base/primitives/compound/CompoundNodeContainer.d.ts +1 -1
  12. package/dist/base/primitives/compound/CompoundNodeContainer.js +2 -2
  13. package/dist/base/primitives/customEdge.js +2 -2
  14. package/dist/base/primitives/customNode.js +2 -2
  15. package/dist/base/primitives/edge/EdgeActionButton.d.ts +1 -2
  16. package/dist/base/primitives/edge/EdgeContainer.js +1 -1
  17. package/dist/base/primitives/edge/EdgeLabel.js +1 -1
  18. package/dist/base/primitives/edge/EdgeLabelContainer.js +1 -1
  19. package/dist/base/primitives/edge/EdgePath.d.ts +10 -42
  20. package/dist/base/primitives/edge/EdgePath.js +23 -16
  21. package/dist/base/primitives/edge/edge.css.js +1 -1
  22. package/dist/base/primitives/element/ElementActionButtons.d.ts +1 -1
  23. package/dist/base/primitives/element/ElementActionButtons.js +6 -5
  24. package/dist/base/primitives/element/ElementDetailsButton.js +5 -2
  25. package/dist/base/primitives/element/ElementNodeContainer.js +3 -3
  26. package/dist/base/updateEdges.js +7 -2
  27. package/dist/base/updateNodes.js +11 -3
  28. package/dist/bundle/LikeC4View.js +3 -3
  29. package/dist/bundle/ReactLikeC4.js +1 -1
  30. package/dist/bundle/ShadowRoot.js +3 -3
  31. package/dist/bundle/styles.css.js +4 -4
  32. package/dist/context/ControlsCustomLayout.js +1 -1
  33. package/dist/context/DiagramEventHandlers.js +5 -5
  34. package/dist/context/DiagramFeatures.js +7 -7
  35. package/dist/context/EnsureMantine.js +2 -2
  36. package/dist/context/FramerMotionConfig.js +2 -2
  37. package/dist/context/IconRenderer.js +4 -4
  38. package/dist/context/ReduceGraphics.js +2 -2
  39. package/dist/context/RootContainer.js +5 -9
  40. package/dist/hooks/safeContext.js +3 -3
  41. package/dist/hooks/useCurrentViewId.js +1 -1
  42. package/dist/hooks/useDiagram.d.ts +3 -7
  43. package/dist/hooks/useDiagram.js +2 -2
  44. package/dist/hooks/useMantinePortalProps.js +2 -2
  45. package/dist/hooks/useSetState.js +3 -3
  46. package/dist/hooks/useUpdateEffect.js +1 -1
  47. package/dist/likec4diagram/DiagramUI.js +2 -2
  48. package/dist/likec4diagram/DiagramXYFlow.js +2 -2
  49. package/dist/likec4diagram/custom/edges/NotePopover.js +2 -2
  50. package/dist/likec4diagram/custom/edges/RelationshipEdge.js +17 -7
  51. package/dist/likec4diagram/custom/edges/RelationshipsDropdownMenu.js +6 -6
  52. package/dist/likec4diagram/custom/nodes/toolbar/ColorButton.js +2 -2
  53. package/dist/likec4diagram/custom/nodes/toolbar/CompoundToolbar.js +3 -3
  54. package/dist/likec4diagram/custom/nodes/toolbar/_shared.js +2 -2
  55. package/dist/likec4diagram/ui/controls/ChangeAutoLayoutButton.js +4 -4
  56. package/dist/likec4diagram/ui/controls/Controls.js +6 -6
  57. package/dist/likec4diagram/ui/controls/NavigationButtons.js +1 -1
  58. package/dist/likec4diagram/ui/diagram-title/DiagramTitlePanel.js +1 -1
  59. package/dist/likec4diagram/ui/notation/NotationPanel.js +4 -5
  60. package/dist/likec4diagram/ui/search/ElementsColumn.js +88 -77
  61. package/dist/likec4diagram/ui/search/LikeC4Search.d.ts +2 -1
  62. package/dist/likec4diagram/ui/search/LikeC4Search.js +27 -24
  63. package/dist/likec4diagram/ui/search/SearchInput.js +1 -1
  64. package/dist/likec4diagram/ui/search/ViewsColum.js +3 -2
  65. package/dist/likec4diagram/ui/search/state.js +11 -9
  66. package/dist/likec4diagram/ui/walkthrough/DynamicViewWalkthrough.js +1 -1
  67. package/dist/likec4diagram/useLayoutConstraints.js +3 -3
  68. package/dist/likec4model/LikeC4ModelContext.js +2 -2
  69. package/dist/likec4model/useLikeC4ElementsTree.js +2 -2
  70. package/dist/likec4model/useLikeC4Model.js +2 -2
  71. package/dist/node_modules/.pnpm/react@19.0.0/node_modules/react/cjs/react.production.js +548 -0
  72. package/dist/node_modules/.pnpm/react@19.0.0/node_modules/react/index.js +15 -0
  73. package/dist/overlays/Overlays.js +8 -8
  74. package/dist/overlays/element-details/ElementDetailsCard.js +5 -5
  75. package/dist/overlays/element-details/TabPanelDeployments.js +7 -4
  76. package/dist/overlays/element-details/TabPanelRelationships.js +2 -2
  77. package/dist/overlays/element-details/TabPanelStructure.js +6 -3
  78. package/dist/overlays/element-details/actor.d.ts +301 -301
  79. package/dist/overlays/element-details/actorContext.js +3 -3
  80. package/dist/overlays/overlay/Overlay.css.d.ts +2 -25
  81. package/dist/overlays/overlay/Overlay.css.js +0 -40
  82. package/dist/overlays/overlay/Overlay.d.ts +1 -1
  83. package/dist/overlays/overlay/Overlay.js +99 -89
  84. package/dist/overlays/overlaysActor.js +4 -1
  85. package/dist/overlays/relationship-details/RelationshipDetails.js +28 -23
  86. package/dist/overlays/relationship-details/SelectEdge.js +3 -6
  87. package/dist/overlays/relationship-details/actor.d.ts +2 -0
  88. package/dist/overlays/relationship-details/custom/edgeTypes.js +1 -1
  89. package/dist/overlays/relationship-details/custom/nodeTypes.js +1 -1
  90. package/dist/overlays/relationship-details/hooks.d.ts +3 -1
  91. package/dist/overlays/relationship-details/hooks.js +4 -4
  92. package/dist/overlays/relationships-browser/RelationshipsBrowser.js +9 -11
  93. package/dist/overlays/relationships-browser/SelectElement.js +8 -5
  94. package/dist/overlays/relationships-browser/actor.d.ts +1 -1
  95. package/dist/overlays/relationships-browser/actor.js +6 -12
  96. package/dist/overlays/relationships-browser/const.d.ts +2 -1
  97. package/dist/overlays/relationships-browser/const.js +6 -1
  98. package/dist/overlays/relationships-browser/custom/edgeTypes.js +3 -4
  99. package/dist/overlays/relationships-browser/custom/nodeTypes.js +2 -2
  100. package/dist/overlays/relationships-browser/hooks.d.ts +1 -1
  101. package/dist/overlays/relationships-browser/hooks.js +4 -4
  102. package/dist/overlays/relationships-browser/layout.js +2 -2
  103. package/dist/overlays/relationships-browser/useViewToNodesEdges.js +1 -2
  104. package/dist/state/DiagramActorProvider.js +5 -3
  105. package/dist/state/diagram-machine.d.ts +2 -2
  106. package/dist/state/diagram-machine.js +3 -4
  107. package/dist/state/hotkeyActor.js +12 -3
  108. package/dist/styles.css.js +1 -1
  109. package/package.json +21 -17
  110. package/src/base/BaseXYFlow.tsx +2 -2
  111. package/src/base/primitives/compound/CompoundActionButton.tsx +1 -1
  112. package/src/base/primitives/compound/CompoundDetailsButton.tsx +1 -1
  113. package/src/base/primitives/compound/CompoundNodeContainer.css.ts +0 -3
  114. package/src/base/primitives/compound/CompoundNodeContainer.tsx +1 -1
  115. package/src/base/primitives/edge/EdgeActionButton.tsx +1 -2
  116. package/src/base/primitives/edge/EdgePath.tsx +22 -14
  117. package/src/base/primitives/edge/edge.css.ts +1 -1
  118. package/src/base/primitives/element/ElementActionButtons.tsx +7 -5
  119. package/src/base/primitives/element/ElementDetailsButton.tsx +5 -1
  120. package/src/base/primitives/element/ElementNodeContainer.css.ts +0 -18
  121. package/src/base/primitives/element/ElementNodeContainer.tsx +1 -1
  122. package/src/base/updateEdges.ts +6 -9
  123. package/src/base/updateNodes.ts +10 -14
  124. package/src/bundle/styles.css.ts +7 -2
  125. package/src/components/SearchControl.css.ts +4 -8
  126. package/src/context/FramerMotionConfig.tsx +1 -1
  127. package/src/context/RootContainer.tsx +0 -4
  128. package/src/hooks/useDiagram.ts +1 -1
  129. package/src/likec4diagram/custom/edges/RelationshipEdge.tsx +8 -2
  130. package/src/likec4diagram/custom/edges/RelationshipsDropdownMenu.tsx +1 -1
  131. package/src/likec4diagram/custom/edges/edges.css.ts +0 -2
  132. package/src/likec4diagram/ui/controls/Controls.tsx +53 -55
  133. package/src/likec4diagram/ui/controls/NavigationButtons.tsx +1 -1
  134. package/src/likec4diagram/ui/diagram-title/DiagramTitlePanel.tsx +1 -1
  135. package/src/likec4diagram/ui/notation/NotationPanel.css.ts +0 -4
  136. package/src/likec4diagram/ui/notation/NotationPanel.tsx +1 -2
  137. package/src/likec4diagram/ui/search/ElementsColumn.tsx +94 -71
  138. package/src/likec4diagram/ui/search/LikeC4Search.tsx +48 -55
  139. package/src/likec4diagram/ui/search/ViewsColum.tsx +2 -2
  140. package/src/likec4diagram/ui/search/ViewsColumn.css.ts +0 -4
  141. package/src/likec4diagram/ui/search/state.ts +8 -6
  142. package/src/likec4diagram/ui/walkthrough/DynamicViewWalkthrough.tsx +1 -1
  143. package/src/overlays/Overlays.tsx +4 -4
  144. package/src/overlays/element-details/ElementDetailsCard.tsx +1 -1
  145. package/src/overlays/element-details/TabPanelDeployments.tsx +2 -0
  146. package/src/overlays/element-details/TabPanelStructure.tsx +2 -1
  147. package/src/overlays/overlay/Overlay.css.ts +0 -40
  148. package/src/overlays/overlay/Overlay.tsx +109 -99
  149. package/src/overlays/overlaysActor.ts +5 -1
  150. package/src/overlays/relationship-details/RelationshipDetails.tsx +25 -16
  151. package/src/overlays/relationship-details/SelectEdge.tsx +0 -14
  152. package/src/overlays/relationship-details/actor.ts +2 -1
  153. package/src/overlays/relationship-details/custom/edgeTypes.tsx +1 -1
  154. package/src/overlays/relationship-details/custom/nodeTypes.tsx +1 -1
  155. package/src/overlays/relationships-browser/RelationshipsBrowser.tsx +1 -3
  156. package/src/overlays/relationships-browser/SelectElement.tsx +2 -0
  157. package/src/overlays/relationships-browser/actor.ts +8 -13
  158. package/src/overlays/relationships-browser/const.ts +8 -1
  159. package/src/overlays/relationships-browser/custom/edgeTypes.tsx +2 -3
  160. package/src/overlays/relationships-browser/custom/nodeTypes.tsx +2 -2
  161. package/src/overlays/relationships-browser/useViewToNodesEdges.ts +1 -2
  162. package/src/state/DiagramActorProvider.tsx +4 -1
  163. package/src/state/diagram-machine.ts +2 -3
  164. 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.27.3",
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.3",
46
- "@mantine/hooks": "7.17.3",
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.0",
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.2",
52
- "@xyflow/system": "^0.0.53",
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
- "framer-motion": "^12.6.2",
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.38.0",
62
+ "type-fest": "^4.39.1",
65
63
  "xstate": "^5.19.2",
66
- "@likec4/core": "1.27.3",
67
- "@likec4/styles": "1.27.3"
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.28",
78
+ "@types/node": "^20.17.30",
77
79
  "@vitejs/plugin-react": "^4.3.4",
78
80
  "postcss": "^8.5.3",
79
- "typescript": "^5.8.2",
80
- "vite": "^6.2.4",
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.0.9",
86
+ "vitest": "^3.1.1",
83
87
  "wireit": "^0.14.11",
84
- "@likec4/tsconfig": "1.27.3"
88
+ "@likec4/tsconfig": "1.28.1"
85
89
  },
86
90
  "scripts": {
87
91
  "generate": "panda codegen",
@@ -143,8 +143,8 @@ export const BaseXYFlow = <
143
143
  edgesFocusable={false}
144
144
  nodesDraggable={nodesDraggable}
145
145
  nodeDragThreshold={4}
146
- nodeClickDistance={1.9}
147
- paneClickDistance={1.9}
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 { m } from 'framer-motion'
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 { m } from 'framer-motion'
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 'framer-motion'
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 = EdgeProps & {
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 = EdgeProps<Data> & {
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
- id,
27
- data: {
28
- line,
29
- dir,
30
- tail,
31
- head,
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('react-flow__edge-interaction', hideOnReducedGraphics)}
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}>
@@ -71,7 +71,7 @@ export const markerContext = css({
71
71
  })
72
72
 
73
73
  export const cssEdgePath = css({
74
- fill: '[none]',
74
+ fill: '[none!]',
75
75
  strokeDashoffset: 10,
76
76
  _noReduceGraphics: {
77
77
  transition: 'stroke 130ms ease-out,stroke-width 130ms ease-out',
@@ -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 { m } from 'framer-motion'
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={`action-button-${id}-${button.key ?? index}`}
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 { m } from 'framer-motion'
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 { m } from 'framer-motion'
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'
@@ -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 === next.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
- // return {
21
- // ...omit(existing, ['hidden', 'zIndex']),
22
- // ...next,
23
- // data: {
24
- // ...existing.data,
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
  })
@@ -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(existing.type, update.type)
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
- // return {
24
- // ...omit(existing, ['measured', 'parentId', 'hidden', 'zIndex']),
25
- // ...update,
26
- // // Force dimensions from update
27
- // width: update.initialWidth,
28
- // height: update.initialHeight,
29
- // data: {
30
- // ...existing.data,
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
  })
@@ -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 { useColorScheme as usePreferredColorScheme, useDebouncedCallback, useMutationObserver } from '@mantine/hooks'
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 { useId, useState } from 'react'
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 as style } from '@likec4/styles/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
- // const transparent = createVar('transparent')
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 = style({
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 = style({
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 'framer-motion'
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,
@@ -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, useTransition } from 'react'
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 {...props} svgPath={edgePath} ref={svgPathRef} onEdgePointerDown={onEdgePointerDown} />
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.relationship(id)
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,6 +1,4 @@
1
1
  import { css } from '@likec4/styles/css'
2
- // import { globalStyle, style } from '@vanilla-extract/css'
3
- // import { mantine, xyvars } from '../../../theme-vars'
4
2
 
5
3
  const isSelected = '.react-flow__edge.selected'
6
4
 
@@ -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 { AnimatePresence, LayoutGroup, m } from 'framer-motion'
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
- <LayoutGroup inherit={false}>
94
- <AnimatePresence initial={false} mode="wait">
95
- {isNotActiveWalkthrough && (
96
- <ControlsLayout
97
- burgerMenu={onBurgerMenuClick && (
98
- <ActionIcon
99
- onClick={e => {
100
- e.stopPropagation()
101
- onBurgerMenuClick()
102
- }}>
103
- <IconMenu2 />
104
- </ActionIcon>
105
- )}
106
- navigationButtons={enableNavigationButtons && <NavigationButtons />}
107
- search={enableSearch && <LikeC4Search />}
108
- syncInProgressBadge={<SyncLayoutBadge />}
109
- actionsGroup={
110
- <ActionIconGroup className={css.actionIconGroup} orientation="vertical">
111
- {enableVscode && (
112
- <Tooltip label="Open source" {...portalProps}>
113
- <ActionIcon
114
- onClick={e => {
115
- e.stopPropagation()
116
- onOpenSource?.({ view: viewId })
117
- }}>
118
- <IconFileSymlink stroke={1.5} />
119
- </ActionIcon>
120
- </Tooltip>
121
- )}
122
- {enableControls && <ToggleReadonly />}
123
- {enableControls && hasLayoutDrift && <LayoutDriftNotification {...portalProps} />}
124
- {enableControls && notReadOnly && (
125
- <>
126
- <ChangeAutoLayoutButton {...portalProps} />
127
- <ManualLayoutToolsButton {...portalProps} />
128
- </>
129
- )}
130
- {enableControls && (
131
- <Tooltip label={viewportChanged ? 'Center camera' : 'Camera is centered'} {...portalProps}>
132
- <ActionIcon
133
- onClick={e => {
134
- e.stopPropagation()
135
- diagram.fitDiagram()
136
- }}>
137
- <IconFocusCentered />
138
- </ActionIcon>
139
- </Tooltip>
140
- )}
141
- </ActionIconGroup>
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