@likec4/diagram 1.18.0 → 1.19.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 (277) hide show
  1. package/LICENSE +1 -1
  2. package/dist/LikeC4CustomColors.d.ts +7 -0
  3. package/dist/LikeC4CustomColors.js +30 -0
  4. package/dist/LikeC4Diagram.css.d.ts +5 -0
  5. package/dist/LikeC4Diagram.css.js +13 -0
  6. package/dist/LikeC4Diagram.d.ts +6 -0
  7. package/dist/LikeC4Diagram.js +194 -0
  8. package/dist/LikeC4Diagram.props.d.ts +166 -0
  9. package/dist/LikeC4ModelProvider.d.ts +9 -0
  10. package/dist/LikeC4ModelProvider.js +12 -0
  11. package/dist/LikeC4Search.css.d.ts +1 -0
  12. package/dist/LikeC4Search.css.js +5 -0
  13. package/dist/LikeC4Search.d.ts +2 -0
  14. package/dist/LikeC4Search.js +96 -0
  15. package/dist/StaticLikeC4Diagram.d.ts +3 -0
  16. package/dist/StaticLikeC4Diagram.js +41 -0
  17. package/dist/_virtual/_commonjsHelpers.js +6 -0
  18. package/dist/controls/Text.d.ts +2 -0
  19. package/dist/controls/Text.js +7 -0
  20. package/dist/controls/action-button-bar/ActionButtonBar.css.d.ts +1 -0
  21. package/dist/controls/action-button-bar/ActionButtonBar.css.js +5 -0
  22. package/dist/controls/action-button-bar/ActionButtonBar.d.ts +9 -0
  23. package/dist/controls/action-button-bar/ActionButtonBar.js +100 -0
  24. package/dist/controls/action-button-bar/useActionButtonBarCtx.d.ts +10 -0
  25. package/dist/controls/action-button-bar/useActionButtonBarCtx.js +9 -0
  26. package/dist/controls/action-buttons/ActionButton.css.d.ts +1 -0
  27. package/dist/controls/action-buttons/ActionButton.css.js +5 -0
  28. package/dist/controls/action-buttons/ActionButton.d.ts +9 -0
  29. package/dist/controls/action-buttons/ActionButton.js +66 -0
  30. package/dist/controls/action-buttons/ActionButtons.d.ts +12 -0
  31. package/dist/controls/action-buttons/ActionButtons.js +99 -0
  32. package/dist/globals.css.d.ts +1 -0
  33. package/dist/globals.css.js +92 -0
  34. package/dist/hooks/index.d.ts +5 -0
  35. package/dist/hooks/useDiagramState.d.ts +6 -0
  36. package/dist/hooks/useDiagramState.js +27 -0
  37. package/dist/hooks/useMantinePortalProps.d.ts +9 -0
  38. package/dist/hooks/useMantinePortalProps.js +9 -0
  39. package/dist/hooks/useSetState.d.ts +2 -0
  40. package/dist/hooks/useSetState.js +19 -0
  41. package/dist/hooks/useUpdateEffect.d.ts +4 -0
  42. package/dist/hooks/useUpdateEffect.js +32 -0
  43. package/dist/hooks/useXYFlow.d.ts +270 -0
  44. package/dist/hooks/useXYFlow.js +20 -0
  45. package/dist/index.d.ts +11 -0
  46. package/dist/index.js +25 -0
  47. package/dist/likec4model/LikeC4ModelContext.d.ts +3 -0
  48. package/dist/likec4model/LikeC4ModelContext.js +5 -0
  49. package/dist/likec4model/index.d.ts +2 -0
  50. package/dist/likec4model/useLikeC4ElementsTree.d.ts +12 -0
  51. package/dist/likec4model/useLikeC4ElementsTree.js +25 -0
  52. package/dist/likec4model/useLikeC4Model.d.ts +20 -0
  53. package/dist/likec4model/useLikeC4Model.js +55 -0
  54. package/dist/overlays/OverlayContext.d.ts +10 -0
  55. package/dist/overlays/OverlayContext.js +9 -0
  56. package/dist/overlays/Overlays.css.d.ts +3 -0
  57. package/dist/overlays/Overlays.css.js +7 -0
  58. package/dist/overlays/Overlays.d.ts +2 -0
  59. package/dist/overlays/Overlays.js +137 -0
  60. package/dist/overlays/edge-details/EdgeDetailsXYFlow.d.ts +5 -0
  61. package/dist/overlays/edge-details/EdgeDetailsXYFlow.js +185 -0
  62. package/dist/overlays/edge-details/SelectEdge.css.d.ts +7 -0
  63. package/dist/overlays/edge-details/SelectEdge.css.js +17 -0
  64. package/dist/overlays/edge-details/SelectEdge.d.ts +5 -0
  65. package/dist/overlays/edge-details/SelectEdge.js +129 -0
  66. package/dist/overlays/edge-details/_types.d.ts +14 -0
  67. package/dist/overlays/edge-details/use-layouted-edge-details.d.ts +21 -0
  68. package/dist/overlays/edge-details/use-layouted-edge-details.js +270 -0
  69. package/dist/overlays/edge-details/xyflow/CompoundNode.d.ts +5 -0
  70. package/dist/overlays/edge-details/xyflow/CompoundNode.js +76 -0
  71. package/dist/overlays/edge-details/xyflow/ElementNode.d.ts +5 -0
  72. package/dist/overlays/edge-details/xyflow/ElementNode.js +159 -0
  73. package/dist/overlays/edge-details/xyflow/RelationshipEdge.d.ts +3 -0
  74. package/dist/overlays/edge-details/xyflow/RelationshipEdge.js +84 -0
  75. package/dist/overlays/edge-details/xyflow/styles.css.d.ts +9 -0
  76. package/dist/overlays/edge-details/xyflow/styles.css.js +21 -0
  77. package/dist/overlays/element-details/ElementDetailsCard.css.d.ts +16 -0
  78. package/dist/overlays/element-details/ElementDetailsCard.css.js +33 -0
  79. package/dist/overlays/element-details/ElementDetailsCard.d.ts +7 -0
  80. package/dist/overlays/element-details/ElementDetailsCard.js +484 -0
  81. package/dist/overlays/element-details/TabPanelDeployments.css.d.ts +4 -0
  82. package/dist/overlays/element-details/TabPanelDeployments.css.js +11 -0
  83. package/dist/overlays/element-details/TabPanelDeployments.d.ts +7 -0
  84. package/dist/overlays/element-details/TabPanelDeployments.js +173 -0
  85. package/dist/overlays/element-details/TabPanelRelationships.css.d.ts +5 -0
  86. package/dist/overlays/element-details/TabPanelRelationships.css.js +11 -0
  87. package/dist/overlays/element-details/TabPanelRelationships.d.ts +8 -0
  88. package/dist/overlays/element-details/TabPanelRelationships.js +157 -0
  89. package/dist/overlays/element-details/TabPanelStructure.css.d.ts +2 -0
  90. package/dist/overlays/element-details/TabPanelStructure.css.js +7 -0
  91. package/dist/overlays/element-details/TabPanelStructure.d.ts +25 -0
  92. package/dist/overlays/element-details/TabPanelStructure.js +91 -0
  93. package/dist/overlays/index.d.ts +1 -0
  94. package/dist/overlays/relationships-of/RelationshipsOverlay.d.ts +5 -0
  95. package/dist/overlays/relationships-of/RelationshipsOverlay.js +193 -0
  96. package/dist/overlays/relationships-of/RelationshipsXYFlow.d.ts +19 -0
  97. package/dist/overlays/relationships-of/RelationshipsXYFlow.js +290 -0
  98. package/dist/overlays/relationships-of/SelectElement.css.d.ts +2 -0
  99. package/dist/overlays/relationships-of/SelectElement.css.js +7 -0
  100. package/dist/overlays/relationships-of/SelectElement.d.ts +7 -0
  101. package/dist/overlays/relationships-of/SelectElement.js +126 -0
  102. package/dist/overlays/relationships-of/_types.d.ts +28 -0
  103. package/dist/overlays/relationships-of/use-layouted-relationships.d.ts +22 -0
  104. package/dist/overlays/relationships-of/use-layouted-relationships.js +496 -0
  105. package/dist/overlays/relationships-of/xyflow/CompoundNode.d.ts +6 -0
  106. package/dist/overlays/relationships-of/xyflow/CompoundNode.js +120 -0
  107. package/dist/overlays/relationships-of/xyflow/ElementNode.d.ts +6 -0
  108. package/dist/overlays/relationships-of/xyflow/ElementNode.js +194 -0
  109. package/dist/overlays/relationships-of/xyflow/EmptyNode.d.ts +5 -0
  110. package/dist/overlays/relationships-of/xyflow/EmptyNode.js +18 -0
  111. package/dist/overlays/relationships-of/xyflow/RelationshipEdge.d.ts +3 -0
  112. package/dist/overlays/relationships-of/xyflow/RelationshipEdge.js +123 -0
  113. package/dist/overlays/relationships-of/xyflow/styles.css.d.ts +14 -0
  114. package/dist/overlays/relationships-of/xyflow/styles.css.js +24 -0
  115. package/dist/overlays/shared/xyflow/RelationshipEdge.css.d.ts +4 -0
  116. package/dist/overlays/shared/xyflow/RelationshipEdge.css.js +12 -0
  117. package/dist/overlays/shared/xyflow/_types.d.ts +77 -0
  118. package/dist/state/DiagramContext.d.ts +1609 -0
  119. package/dist/state/DiagramContext.js +101 -0
  120. package/dist/state/aligners.d.ts +42 -0
  121. package/dist/state/aligners.js +349 -0
  122. package/dist/state/diagram-to-xyflow.d.ts +11 -0
  123. package/dist/state/diagram-to-xyflow.js +113 -0
  124. package/dist/state/diagramStore.d.ts +1705 -0
  125. package/dist/state/diagramStore.js +808 -0
  126. package/dist/state/diagramStore.layout.d.ts +4 -0
  127. package/dist/state/diagramStore.layout.js +56 -0
  128. package/dist/style.css +1 -0
  129. package/dist/theme-vars.css.d.ts +72 -0
  130. package/dist/theme-vars.css.js +6 -0
  131. package/dist/theme-vars.css.ts.vanilla.css.js +1 -0
  132. package/dist/theme-vars.d.ts +3 -0
  133. package/dist/theme-vars.js +5 -0
  134. package/dist/ui/DiagramTitlePanel.css.d.ts +4 -0
  135. package/dist/ui/DiagramTitlePanel.css.js +11 -0
  136. package/dist/ui/DiagramTitlePanel.d.ts +1 -0
  137. package/dist/ui/DiagramTitlePanel.js +159 -0
  138. package/dist/ui/DynamicViewWalkthrough.css.d.ts +4 -0
  139. package/dist/ui/DynamicViewWalkthrough.css.js +11 -0
  140. package/dist/ui/DynamicViewWalkthrough.d.ts +1 -0
  141. package/dist/ui/DynamicViewWalkthrough.js +156 -0
  142. package/dist/ui/EnsureMantine.d.ts +7 -0
  143. package/dist/ui/EnsureMantine.js +14 -0
  144. package/dist/ui/FramerMotionConfig.d.ts +2 -0
  145. package/dist/ui/FramerMotionConfig.js +14 -0
  146. package/dist/ui/Link.d.ts +4 -0
  147. package/dist/ui/Link.js +36 -0
  148. package/dist/ui/notation/NotationPanel.css.d.ts +6 -0
  149. package/dist/ui/notation/NotationPanel.css.js +16 -0
  150. package/dist/ui/notation/NotationPanel.d.ts +1 -0
  151. package/dist/ui/notation/NotationPanel.js +250 -0
  152. package/dist/ui/notation/index.d.ts +1 -0
  153. package/dist/ui/top-left/ChangeAutoLayoutButton.d.ts +2 -0
  154. package/dist/ui/top-left/ChangeAutoLayoutButton.js +159 -0
  155. package/dist/ui/top-left/ManualLayoutToolsButton.d.ts +2 -0
  156. package/dist/ui/top-left/ManualLayoutToolsButton.js +137 -0
  157. package/dist/ui/top-left/TopLeftPanel.d.ts +4 -0
  158. package/dist/ui/top-left/TopLeftPanel.js +211 -0
  159. package/dist/ui/top-left/_shared.d.ts +7 -0
  160. package/dist/ui/top-left/_shared.js +22 -0
  161. package/dist/ui/top-left/styles.css.d.ts +8 -0
  162. package/dist/ui/top-left/styles.css.js +17 -0
  163. package/dist/utils/types.d.ts +8 -0
  164. package/dist/utils/vector.d.ts +24 -0
  165. package/dist/utils/vector.js +55 -0
  166. package/dist/xyflow/EdgeMarkers.d.ts +12 -0
  167. package/dist/xyflow/EdgeMarkers.js +192 -0
  168. package/dist/xyflow/FitviewOnDiagramChange.d.ts +4 -0
  169. package/dist/xyflow/FitviewOnDiagramChange.js +72 -0
  170. package/dist/xyflow/SelectEdgesOnNodeFocus.d.ts +1 -0
  171. package/dist/xyflow/SelectEdgesOnNodeFocus.js +96 -0
  172. package/dist/xyflow/XYFlow.d.ts +8 -0
  173. package/dist/xyflow/XYFlow.js +145 -0
  174. package/dist/xyflow/XYFlowBackground.d.ts +10 -0
  175. package/dist/xyflow/XYFlowBackground.js +25 -0
  176. package/dist/xyflow/XYFlowInner.d.ts +8 -0
  177. package/dist/xyflow/XYFlowInner.js +41 -0
  178. package/dist/xyflow/const.d.ts +7 -0
  179. package/dist/xyflow/const.js +12 -0
  180. package/dist/xyflow/edges/EdgeLabel.d.ts +7 -0
  181. package/dist/xyflow/edges/EdgeLabel.js +160 -0
  182. package/dist/xyflow/edges/RelationshipEdge.d.ts +6 -0
  183. package/dist/xyflow/edges/RelationshipEdge.js +443 -0
  184. package/dist/xyflow/edges/RelationshipsDropdownMenu.css.d.ts +4 -0
  185. package/dist/xyflow/edges/RelationshipsDropdownMenu.css.js +11 -0
  186. package/dist/xyflow/edges/RelationshipsDropdownMenu.d.ts +13 -0
  187. package/dist/xyflow/edges/RelationshipsDropdownMenu.js +211 -0
  188. package/dist/xyflow/edges/edges.css.d.ts +17 -0
  189. package/dist/xyflow/edges/edges.css.js +37 -0
  190. package/dist/xyflow/edges/utils.d.ts +16 -0
  191. package/dist/xyflow/edges/utils.js +24 -0
  192. package/dist/xyflow/nodes/AnimateVariants.d.ts +1313 -0
  193. package/dist/xyflow/nodes/AnimateVariants.js +123 -0
  194. package/dist/xyflow/nodes/Node.css.d.ts +3 -0
  195. package/dist/xyflow/nodes/Node.css.js +9 -0
  196. package/dist/xyflow/nodes/compound/CompoundNode.css.d.ts +14 -0
  197. package/dist/xyflow/nodes/compound/CompoundNode.css.js +27 -0
  198. package/dist/xyflow/nodes/compound/CompoundNode.d.ts +6 -0
  199. package/dist/xyflow/nodes/compound/CompoundNode.js +216 -0
  200. package/dist/xyflow/nodes/compound/index.d.ts +1 -0
  201. package/dist/xyflow/nodes/element/ElementLink.css.d.ts +3 -0
  202. package/dist/xyflow/nodes/element/ElementLink.d.ts +6 -0
  203. package/dist/xyflow/nodes/element/ElementNode.d.ts +6 -0
  204. package/dist/xyflow/nodes/element/ElementNode.js +190 -0
  205. package/dist/xyflow/nodes/element/ElementShapeSvg.d.ts +17 -0
  206. package/dist/xyflow/nodes/element/ElementShapeSvg.js +175 -0
  207. package/dist/xyflow/nodes/element/element.css.d.ts +18 -0
  208. package/dist/xyflow/nodes/element/element.css.js +31 -0
  209. package/dist/xyflow/nodes/element/index.d.ts +1 -0
  210. package/dist/xyflow/nodes/shared/ElementIcon.d.ts +8 -0
  211. package/dist/xyflow/nodes/shared/ElementIcon.js +38 -0
  212. package/dist/xyflow/nodes/shared/Toolbar.d.ts +9 -0
  213. package/dist/xyflow/nodes/shared/Toolbar.js +436 -0
  214. package/dist/xyflow/types.d.ts +36 -0
  215. package/dist/xyflow/useLayoutConstraints.d.ts +42 -0
  216. package/dist/xyflow/useLayoutConstraints.js +226 -0
  217. package/dist/xyflow/useXYFlowEvents.d.ts +160 -0
  218. package/dist/xyflow/useXYFlowEvents.js +275 -0
  219. package/dist/xyflow/utils.d.ts +22 -0
  220. package/dist/xyflow/utils.js +72 -0
  221. package/package.json +34 -27
  222. package/src/LikeC4Diagram.tsx +4 -4
  223. package/src/LikeC4Search.css.ts +12 -0
  224. package/src/LikeC4Search.tsx +39 -90
  225. package/src/controls/Text.ts +5 -0
  226. package/src/controls/action-button-bar/ActionButtonBar.css.ts +13 -0
  227. package/src/controls/action-button-bar/ActionButtonBar.tsx +138 -0
  228. package/src/controls/action-button-bar/useActionButtonBarCtx.ts +13 -0
  229. package/src/controls/action-buttons/ActionButton.css.ts +29 -0
  230. package/src/controls/action-buttons/ActionButton.tsx +66 -0
  231. package/src/controls/action-buttons/ActionButtons.tsx +138 -0
  232. package/src/hooks/useXYFlow.ts +8 -8
  233. package/src/index.ts +12 -6
  234. package/src/likec4model/index.ts +12 -2
  235. package/src/overlays/edge-details/EdgeDetailsXYFlow.tsx +18 -12
  236. package/src/overlays/edge-details/_types.ts +13 -37
  237. package/src/overlays/edge-details/use-layouted-edge-details.ts +16 -14
  238. package/src/overlays/edge-details/xyflow/CompoundNode.tsx +3 -11
  239. package/src/overlays/edge-details/xyflow/ElementNode.tsx +4 -11
  240. package/src/overlays/edge-details/xyflow/RelationshipEdge.tsx +3 -3
  241. package/src/overlays/edge-details/xyflow/styles.css.ts +1 -59
  242. package/src/overlays/relationships-of/RelationshipsXYFlow.tsx +23 -23
  243. package/src/overlays/relationships-of/_types.ts +20 -58
  244. package/src/overlays/relationships-of/use-layouted-relationships.ts +36 -40
  245. package/src/overlays/relationships-of/xyflow/CompoundNode.tsx +9 -13
  246. package/src/overlays/relationships-of/xyflow/ElementNode.tsx +12 -15
  247. package/src/overlays/relationships-of/xyflow/EmptyNode.tsx +4 -7
  248. package/src/overlays/relationships-of/xyflow/RelationshipEdge.tsx +16 -14
  249. package/src/overlays/shared/xyflow/RelationshipEdge.css.ts +60 -0
  250. package/src/overlays/shared/xyflow/_types.ts +87 -0
  251. package/src/state/diagram-to-xyflow.ts +6 -7
  252. package/src/state/diagramStore.layout.ts +3 -4
  253. package/src/state/diagramStore.ts +35 -37
  254. package/src/theme-vars.css.ts +81 -0
  255. package/src/theme-vars.ts +8 -81
  256. package/src/ui/DiagramTitlePanel.tsx +6 -6
  257. package/src/utils/types.ts +6 -0
  258. package/src/xyflow/SelectEdgesOnNodeFocus.tsx +3 -3
  259. package/src/xyflow/XYFlow.tsx +2 -2
  260. package/src/xyflow/edges/EdgeLabel.tsx +25 -18
  261. package/src/xyflow/edges/RelationshipEdge.tsx +5 -3
  262. package/src/xyflow/edges/RelationshipsDropdownMenu.tsx +3 -3
  263. package/src/xyflow/edges/edges.css.ts +68 -74
  264. package/src/xyflow/edges/utils.ts +6 -6
  265. package/src/xyflow/nodes/AnimateVariants.ts +143 -0
  266. package/src/xyflow/nodes/Node.css.ts +44 -0
  267. package/src/xyflow/nodes/compound/CompoundNode.css.ts +1 -64
  268. package/src/xyflow/nodes/compound/CompoundNode.tsx +69 -182
  269. package/src/xyflow/nodes/element/ElementLink.tsx +2 -3
  270. package/src/xyflow/nodes/element/ElementNode.tsx +64 -266
  271. package/src/xyflow/nodes/element/element.css.ts +0 -57
  272. package/src/xyflow/nodes/shared/Toolbar.tsx +30 -30
  273. package/src/xyflow/types.ts +48 -51
  274. package/src/xyflow/useLayoutConstraints.ts +9 -9
  275. package/src/xyflow/useXYFlowEvents.ts +13 -30
  276. package/src/xyflow/utils.ts +2 -2
  277. package/src/xyflow/nodes/use-animate-variants.tsx +0 -64
@@ -1,14 +1,14 @@
1
1
  import { ActionIcon, Box, Group, Stack, Text, ThemeIcon, Tooltip as MantineTooltip } from '@mantine/core'
2
2
  import { IconBoxMultipleFilled, IconZoomScan } from '@tabler/icons-react'
3
- import { BaseEdge, EdgeLabelRenderer, type EdgeProps, getBezierPath } from '@xyflow/react'
3
+ import { type EdgeProps, BaseEdge, EdgeLabelRenderer, getBezierPath } from '@xyflow/react'
4
4
  import clsx from 'clsx'
5
5
  import { only } from 'remeda'
6
6
  import { useDiagramState } from '../../../hooks/useDiagramState'
7
7
  import { stopPropagation } from '../../../xyflow/utils'
8
8
  import { useOverlayDialog } from '../../OverlayContext'
9
- import type { XYFlowTypes } from '../_types'
9
+ import * as css from '../../shared/xyflow/RelationshipEdge.css'
10
+ import type { RelationshipsOfFlowTypes } from '../_types'
10
11
  import { ZIndexes } from '../use-layouted-relationships'
11
- import * as css from './styles.css'
12
12
 
13
13
  const Tooltip = MantineTooltip.withProps({
14
14
  color: 'dark',
@@ -18,20 +18,22 @@ const Tooltip = MantineTooltip.withProps({
18
18
  withinPortal: false,
19
19
  label: '',
20
20
  children: null,
21
- offset: 4
21
+ offset: 4,
22
22
  })
23
23
 
24
24
  export function RelationshipEdge({
25
25
  data,
26
26
  label,
27
+ // Exclude the following props from the rest
28
+ animated: _animated,
27
29
  ...props
28
- }: EdgeProps<XYFlowTypes.Edge>) {
30
+ }: EdgeProps<RelationshipsOfFlowTypes.Edge>) {
29
31
  const {
30
32
  viewId,
31
- onNavigateTo
33
+ onNavigateTo,
32
34
  } = useDiagramState(s => ({
33
35
  viewId: s.view.id,
34
- onNavigateTo: s.onNavigateTo
36
+ onNavigateTo: s.onNavigateTo,
35
37
  }))
36
38
  const overlay = useOverlayDialog()
37
39
  const [edgePath, labelX, labelY] = getBezierPath(props)
@@ -45,7 +47,7 @@ export function RelationshipEdge({
45
47
  className={css.edgeContainer}
46
48
  data-edge-dimmed={data.dimmed}
47
49
  data-edge-hovered={data.hovered}
48
- data-likec4-color={data.includedInCurrentView ? 'gray' : 'amber'}
50
+ data-likec4-color={data.existsInCurrentView ? 'gray' : 'amber'}
49
51
  >
50
52
  <BaseEdge
51
53
  path={edgePath}
@@ -59,19 +61,19 @@ export function RelationshipEdge({
59
61
  position: 'absolute',
60
62
  transform: `translate(-50%, -50%) translate(${labelX}px,${labelY}px)`,
61
63
  maxWidth: Math.abs(props.targetX - props.sourceX - 70),
62
- zIndex: ZIndexes.max
64
+ zIndex: ZIndexes.max,
63
65
  }}
64
66
  className={clsx([
65
67
  css.edgeLabel,
66
- 'nodrag nopan'
68
+ 'nodrag nopan',
67
69
  ])}
68
70
  data-edge-dimmed={data.dimmed}
69
71
  data-edge-hovered={data.hovered}
70
- data-likec4-color={data.includedInCurrentView ? 'gray' : 'amber'}
71
- // {...data.includedInCurrentView === false && { 'data-likec4-color': 'amber' }}
72
+ data-likec4-color={data.existsInCurrentView ? 'gray' : 'amber'}
73
+ // {...data.existsInCurrentView === false && { 'data-likec4-color': 'amber' }}
72
74
  >
73
75
  {label && (
74
- <Tooltip label="Not included in current view" disabled={data.includedInCurrentView} color={'orange'}>
76
+ <Tooltip label="Not included in current view" disabled={data.existsInCurrentView} color={'orange'}>
75
77
  <Group gap={6} wrap="nowrap">
76
78
  {isMultiRelation && (
77
79
  <ThemeIcon size={'sm'} variant="transparent" color="orange">
@@ -81,7 +83,7 @@ export function RelationshipEdge({
81
83
  <Text
82
84
  fw={isMultiRelation ? '500' : '400'}
83
85
  style={{
84
- whiteSpace: isMultiRelation ? 'nowrap' : undefined
86
+ whiteSpace: isMultiRelation ? 'nowrap' : undefined,
85
87
  }}
86
88
  component={'div'}
87
89
  className={css.edgeLabelText}
@@ -0,0 +1,60 @@
1
+ import { style } from '@vanilla-extract/css'
2
+ import { mantine, transitions, vars, whereDark, xyvars } from '../../../theme-vars'
3
+ import { mixColor } from '../../Overlays.css'
4
+
5
+ const DimmedTransitionDelay = '400ms'
6
+
7
+ export const edgeContainer = style({
8
+ opacity: 1,
9
+ transition: transitions.fast,
10
+ vars: {
11
+ [xyvars.edge.stroke]: vars.relation.lineColor,
12
+ [xyvars.edge.strokeSelected]: `color-mix(in srgb, ${vars.relation.lineColor}, ${mixColor} 35%)`,
13
+ [xyvars.edge.labelColor]: `color-mix(in srgb, ${vars.relation.labelColor}, rgba(255 255 255 / 0.85) 50%)`,
14
+ [xyvars.edge.labelBgColor]: `color-mix(in srgb, ${vars.relation.labelBgColor}, transparent 20%)`
15
+ },
16
+ selectors: {
17
+ [`&[data-edge-dimmed='true']`]: {
18
+ opacity: 0.2,
19
+ transitionDelay: DimmedTransitionDelay
20
+ },
21
+ [`&[data-edge-dimmed='immediate']`]: {
22
+ opacity: 0.2
23
+ },
24
+ [`${whereDark} &`]: {
25
+ vars: {
26
+ [xyvars.edge.labelBgColor]: `color-mix(in srgb, ${vars.relation.labelBgColor}, transparent 50%)`
27
+ }
28
+ }
29
+ }
30
+ })
31
+
32
+ export const edgeLabel = style([edgeContainer, {
33
+ padding: '2px 5px',
34
+ fontFamily: vars.likec4.font,
35
+ position: 'absolute',
36
+ cursor: 'pointer',
37
+ width: 'fit-content',
38
+ color: xyvars.edge.labelColor,
39
+ backgroundColor: xyvars.edge.labelBgColor,
40
+ borderRadius: 4,
41
+ // everything inside EdgeLabelRenderer has no pointer events by default
42
+ // if you have an interactive element, set pointer-events: all
43
+ pointerEvents: 'all',
44
+ textWrap: 'pretty',
45
+ whiteSpace: 'preserve-breaks'
46
+ }])
47
+
48
+ export const edgeLabelText = style({
49
+ textAlign: 'center',
50
+ whiteSpaceCollapse: 'preserve-breaks',
51
+ fontSize: mantine.fontSizes.md,
52
+ lineHeight: mantine.lineHeights.xs
53
+ })
54
+
55
+ export const edgeLabelTechnology = style({
56
+ textAlign: 'center',
57
+ whiteSpaceCollapse: 'preserve-breaks',
58
+ fontSize: mantine.fontSizes.sm,
59
+ lineHeight: 1
60
+ })
@@ -0,0 +1,87 @@
1
+ import type { AbstractRelation, ComputedNode, Fqn, ViewId } from '@likec4/core'
2
+ import type { Edge as ReactFlowEdge, Node as ReactFlowNode } from '@xyflow/react'
3
+ import type { SetRequired } from 'type-fest'
4
+
5
+ export namespace SharedFlowTypes {
6
+ export type EmptyNodeData = {
7
+ /**
8
+ * Whether the cursor is hovering over the node
9
+ */
10
+ hovered?: boolean
11
+ /**
12
+ * Whether the node is currently leaving the overlay
13
+ */
14
+ leaving?: boolean
15
+ /**
16
+ * Whether the node is currently entering the overlay
17
+ * @default true
18
+ */
19
+ entering?: boolean
20
+ /**
21
+ * Whether the node is dimmed
22
+ * 'immediate' means that the node is dimmed without delay
23
+ */
24
+ dimmed?: 'immediate' | boolean
25
+ }
26
+
27
+ export type NonEmptyNodeData = EmptyNodeData & {
28
+ /**
29
+ * The node's fully qualified name
30
+ */
31
+ fqn: Fqn
32
+ }
33
+
34
+ export type OverlayNodeData = NonEmptyNodeData & {
35
+ /**
36
+ * The ComputedNode backing this node
37
+ */
38
+ element: Pick<ComputedNode, 'color' | 'title' | 'description' | 'shape' | 'kind'>
39
+ /**
40
+ * The node's incoming and outgoing ports
41
+ */
42
+ ports: {
43
+ in: string[]
44
+ out: string[]
45
+ }
46
+ /**
47
+ * The id of the view that should be navigated to when clicking the navigate button
48
+ */
49
+ navigateTo: ViewId | null
50
+ /**
51
+ * The node's visual depth on the screen, 1 being the highest
52
+ */
53
+ depth?: number
54
+ }
55
+
56
+ export type ElementNode = SetRequired<ReactFlowNode<OverlayNodeData, 'element'>, 'type'>
57
+
58
+ export type CompoundNode = SetRequired<ReactFlowNode<OverlayNodeData, 'compound'>, 'type'>
59
+
60
+ export type NonEmptyNode = ElementNode | CompoundNode
61
+
62
+ export type EmptyNode = SetRequired<ReactFlowNode<EmptyNodeData, 'empty'>, 'type'>
63
+
64
+ export type Node = NonEmptyNode | EmptyNode
65
+
66
+ export type EdgeData = {
67
+ /**
68
+ * The model's relations represented by this edge
69
+ */
70
+ relations: [AbstractRelation, ...AbstractRelation[]]
71
+ /**
72
+ * Whether the cursor is hovering over the node
73
+ */
74
+ hovered?: boolean
75
+ /**
76
+ * Whether the node is dimmed
77
+ * 'immediate' means that the node is dimmed without delay
78
+ */
79
+ dimmed?: 'immediate' | boolean
80
+ /**
81
+ * The id of the view that should be navigated to when clicking the edge
82
+ */
83
+ navigateTo?: ViewId | null
84
+ }
85
+
86
+ export type Edge = SetRequired<ReactFlowEdge<EdgeData, 'relation'>, 'data' | 'type'>
87
+ }
@@ -1,10 +1,9 @@
1
1
  import { type DiagramEdge, DiagramNode, type DiagramView, ElementKind, type Fqn } from '@likec4/core'
2
2
  import { nonNullable, whereOperatorAsPredicate } from '@likec4/core'
3
3
  import { hasAtLeast } from 'remeda'
4
- import type { UnionToIntersection } from 'type-fest'
5
4
  import type { WhereOperator } from '../LikeC4Diagram.props'
6
5
  import { ZIndexes } from '../xyflow/const'
7
- import type { XYFlowEdge, XYFlowNode } from '../xyflow/types'
6
+ import type { DiagramFlowTypes } from '../xyflow/types'
8
7
 
9
8
  // const nodeZIndex = (node: DiagramNode) => node.level - (node.children.length > 0 ? 1 : 0)
10
9
 
@@ -16,12 +15,12 @@ export function diagramViewToXYFlowData(
16
15
  selectable: boolean
17
16
  }
18
17
  ): {
19
- xynodes: XYFlowNode[]
20
- xyedges: XYFlowEdge[]
18
+ xynodes: DiagramFlowTypes.Node[]
19
+ xyedges: DiagramFlowTypes.Edge[]
21
20
  } {
22
21
  const isDynamicView = view.__ === 'dynamic',
23
- xynodes = [] as XYFlowNode[],
24
- xyedges = [] as XYFlowEdge[],
22
+ xynodes = [] as DiagramFlowTypes.Node[],
23
+ xyedges = [] as DiagramFlowTypes.Edge[],
25
24
  nodeLookup = new Map<Fqn, DiagramNode>()
26
25
 
27
26
  const traverse = view.nodes.reduce(
@@ -72,7 +71,7 @@ export function diagramViewToXYFlowData(
72
71
 
73
72
  const id = ns + node.id
74
73
 
75
- const base: Omit<UnionToIntersection<XYFlowNode>, 'data'> = {
74
+ const base: Omit<DiagramFlowTypes.Node, 'data' | 'type'> = {
76
75
  id,
77
76
  draggable: opts.draggable,
78
77
  selectable: opts.selectable && node.kind !== ElementKind.Group,
@@ -1,11 +1,10 @@
1
1
  import { nonexhaustive } from '@likec4/core'
2
- import type { InternalNode } from '@xyflow/react'
3
2
  import { getNodeDimensions } from '@xyflow/system'
4
3
  import { hasAtLeast } from 'remeda'
5
4
  import type { DiagramState } from '../hooks'
6
- import type { XYFlowNode } from '../xyflow/types'
7
5
  import { createLayoutConstraints } from '../xyflow/useLayoutConstraints'
8
6
  import { type Aligner, getLinearAligner, GridAligner, type GridAlignmentMode, type LinearAlignmentMode, type NodeRect } from './aligners'
7
+ import type { DiagramFlowTypes } from '../xyflow/types'
9
8
 
10
9
  export type AlignmentMode = LinearAlignmentMode | GridAlignmentMode
11
10
 
@@ -40,7 +39,7 @@ export function align(get: () => DiagramState) {
40
39
  }
41
40
  }
42
41
 
43
- function toNodeRect(node: InternalNode<XYFlowNode>): NodeRect {
42
+ function toNodeRect(node: DiagramFlowTypes.InternalNode): NodeRect {
44
43
  return {
45
44
  ...node.internals.positionAbsolute,
46
45
  id: node.id,
@@ -64,4 +63,4 @@ function getAligner(mode: AlignmentMode): Aligner {
64
63
  default:
65
64
  nonexhaustive(mode)
66
65
  }
67
- }
66
+ }
@@ -42,9 +42,9 @@ import type {
42
42
  LikeC4DiagramEventHandlers,
43
43
  WhereOperator
44
44
  } from '../LikeC4Diagram.props'
45
- import { type Vector, vector } from '../utils/vector'
45
+ import { type Vector, vector, VectorImpl } from '../utils/vector'
46
46
  import { MinZoom } from '../xyflow/const'
47
- import type { XYFlowEdge, XYFlowInstance, XYFlowNode } from '../xyflow/types'
47
+ import type { DiagramFlowTypes } from '../xyflow/types'
48
48
  import { bezierControlPoints, isInside, isSamePoint, toDomPrecision } from '../xyflow/utils'
49
49
  import { diagramViewToXYFlowData } from './diagram-to-xyflow'
50
50
  import { align, type AlignmentMode } from './diagramStore.layout'
@@ -78,7 +78,7 @@ export type DiagramInitialState = {
78
78
  // If Dynamic View
79
79
  enableDynamicViewWalkthrough: boolean
80
80
 
81
- xyflow: XYFlowInstance
81
+ xyflow: DiagramFlowTypes.XYFlowInstance
82
82
  xystore: XYStoreApi
83
83
 
84
84
  // Diagram Container, for Mantine Portal
@@ -94,8 +94,8 @@ export type DiagramState = Simplify<
94
94
  readonly storeDevId: string
95
95
 
96
96
  // Internal state
97
- xynodes: XYFlowNode[]
98
- xyedges: XYFlowEdge[]
97
+ xynodes: DiagramFlowTypes.Node[]
98
+ xyedges: DiagramFlowTypes.Edge[]
99
99
  viewSyncDebounceTimeout: number | null
100
100
  viewportChanged: boolean
101
101
 
@@ -125,7 +125,6 @@ export type DiagramState = Simplify<
125
125
  lastClickedNodeId: string | null
126
126
  lastClickedEdgeId: string | null
127
127
  focusedNodeId: string | null
128
- hoveredNodeId: string | null
129
128
  hoveredEdgeId: string | null
130
129
 
131
130
  // id's of nodes / edges that
@@ -151,7 +150,6 @@ export type DiagramState = Simplify<
151
150
  */
152
151
  focusOnNode: (nodeId: string | false) => void
153
152
 
154
- setHoveredNode: (nodeId: string | null) => void
155
153
  setHoveredEdge: (edgeId: string | null) => void
156
154
 
157
155
  setLastClickedNode: (nodeId: string | null) => void
@@ -176,15 +174,15 @@ export type DiagramState = Simplify<
176
174
  goForward: () => void
177
175
 
178
176
  nextDynamicStep: (increment?: number) => void
179
- activateWalkthrough: (step: EdgeId | XYFlowEdge) => void
177
+ activateWalkthrough: (step: EdgeId | DiagramFlowTypes.Edge) => void
180
178
  stopWalkthrough: () => void
181
179
 
182
180
  openOverlay: (overlay: NonNullable<DiagramState['activeOverlay']>) => void
183
181
  closeOverlay: () => void
184
182
 
185
- onInit: (xyflow: XYFlowInstance) => void
186
- onNodesChange: OnNodesChange<XYFlowNode>
187
- onEdgesChange: OnEdgesChange<XYFlowEdge>
183
+ onInit: (xyflow: DiagramFlowTypes.XYFlowInstance) => void
184
+ onNodesChange: OnNodesChange<DiagramFlowTypes.Node>
185
+ onEdgesChange: OnEdgesChange<DiagramFlowTypes.Edge>
188
186
 
189
187
  highlightByElementNotation: (notation: ElementNotation, onlyOfKind?: NodeKind) => void
190
188
 
@@ -209,7 +207,6 @@ const DEFAULT_PROPS: Except<
209
207
  activeOverlay: null,
210
208
  activeWalkthrough: null,
211
209
  focusedNodeId: null,
212
- hoveredNodeId: null,
213
210
  hoveredEdgeId: null,
214
211
  lastClickedNodeId: null,
215
212
  lastClickedEdgeId: null,
@@ -285,7 +282,6 @@ export function createDiagramStore(props: DiagramInitialState) {
285
282
  nodesDraggable,
286
283
  nodesSelectable,
287
284
  hoveredEdgeId,
288
- hoveredNodeId,
289
285
  xyedges,
290
286
  xynodes
291
287
  } = get()
@@ -304,9 +300,6 @@ export function createDiagramStore(props: DiagramInitialState) {
304
300
  if (lastClickedNodeId && !nodeIds.has(lastClickedNodeId)) {
305
301
  lastClickedNodeId = null
306
302
  }
307
- if (hoveredNodeId && !nodeIds.has(hoveredNodeId)) {
308
- hoveredNodeId = null
309
- }
310
303
  if (focusedNodeId && !nodeIds.has(focusedNodeId)) {
311
304
  focusedNodeId = null
312
305
  dimmed = EmptyStringSet
@@ -385,7 +378,6 @@ export function createDiagramStore(props: DiagramInitialState) {
385
378
  lastClickedEdgeId = null
386
379
  lastClickedNodeId = null
387
380
  hoveredEdgeId = null
388
- hoveredNodeId = null
389
381
  focusedNodeId = null
390
382
  activeWalkthrough = null
391
383
  activeOverlay = null
@@ -417,14 +409,14 @@ export function createDiagramStore(props: DiagramInitialState) {
417
409
  return {
418
410
  ...existing,
419
411
  ...update
420
- } as XYFlowNode
412
+ } as DiagramFlowTypes.Node
421
413
  }
422
414
  return update
423
415
  })
424
416
  // Merge with existing edges, but only if the view is the same
425
417
  // and the edges have no layout drift
426
418
  if (isSameView && !nextView.hasLayoutDrift) {
427
- update.xyedges = update.xyedges.map((update): XYFlowEdge => {
419
+ update.xyedges = update.xyedges.map((update): DiagramFlowTypes.Edge => {
428
420
  const existing = xyedges.find(n => n.id === update.id)
429
421
  if (existing) {
430
422
  if (
@@ -460,7 +452,6 @@ export function createDiagramStore(props: DiagramInitialState) {
460
452
  lastClickedEdgeId,
461
453
  focusedNodeId,
462
454
  hoveredEdgeId,
463
- hoveredNodeId,
464
455
  navigationHistory,
465
456
  navigationHistoryIndex,
466
457
  dimmed,
@@ -518,12 +509,6 @@ export function createDiagramStore(props: DiagramInitialState) {
518
509
  }
519
510
  },
520
511
 
521
- setHoveredNode: (nodeId) => {
522
- if (nodeId !== get().hoveredNodeId) {
523
- set({ hoveredNodeId: nodeId })
524
- }
525
- },
526
-
527
512
  setHoveredEdge: (edgeId) => {
528
513
  if (edgeId !== get().hoveredEdgeId) {
529
514
  set({ hoveredEdgeId: edgeId })
@@ -919,7 +904,7 @@ export function createDiagramStore(props: DiagramInitialState) {
919
904
  }
920
905
  },
921
906
 
922
- activateWalkthrough: (step: EdgeId | XYFlowEdge) => {
907
+ activateWalkthrough: (step: EdgeId | DiagramFlowTypes.Edge) => {
923
908
  const stepId = typeof step === 'string' ? step : step.data.edge.id
924
909
  invariant(isStepEdgeId(stepId), `stepId ${stepId} is not a step edge id`)
925
910
  let {
@@ -949,7 +934,7 @@ export function createDiagramStore(props: DiagramInitialState) {
949
934
  )
950
935
  .map(({ id }) => id)
951
936
  )
952
- const selected = [] as XYFlowNode[]
937
+ const selected = [] as DiagramFlowTypes.Node[]
953
938
  for (const n of xyflow.getNodes()) {
954
939
  if (n.id === edge.source || n.id === edge.target) {
955
940
  selected.push(n)
@@ -1035,7 +1020,7 @@ export function createDiagramStore(props: DiagramInitialState) {
1035
1020
 
1036
1021
  scheduleSaveManualLayout()
1037
1022
 
1038
- function getNodeCenter(node: XYFlowNode, nodes: XYFlowNode[]) {
1023
+ function getNodeCenter(node: DiagramFlowTypes.Node, nodes: DiagramFlowTypes.Node[]) {
1039
1024
  const dimensions = vector({ x: node.width || 0, y: node.height || 0 })
1040
1025
  let position = vector(node.position)
1041
1026
  .add(dimensions.mul(0.5))
@@ -1055,7 +1040,7 @@ export function createDiagramStore(props: DiagramInitialState) {
1055
1040
  return position
1056
1041
  }
1057
1042
 
1058
- function getControlPointForEdge(edge: XYFlowEdge): XYPoint[] {
1043
+ function getControlPointForEdge(edge: DiagramFlowTypes.Edge): XYPoint[] {
1059
1044
  const source = xynodes.find(x => x.id == edge.source)
1060
1045
  const target = xynodes.find(x => x.id == edge.target)
1061
1046
  if (!source || !target) {
@@ -1065,18 +1050,31 @@ export function createDiagramStore(props: DiagramInitialState) {
1065
1050
  const sourceCenter = getNodeCenter(source, xynodes)
1066
1051
  const targetCenter = getNodeCenter(target, xynodes)
1067
1052
 
1068
- if (sourceCenter && targetCenter) {
1069
- const sourceToTargetVector = targetCenter.sub(sourceCenter)
1070
- const sourceBorderPoint = getBorderPointOnVector(source, sourceCenter, sourceToTargetVector)
1071
- const targetBorderPoint = getBorderPointOnVector(target, targetCenter, sourceToTargetVector.mul(-1))
1053
+ if (!sourceCenter || !targetCenter) {
1054
+ return []
1055
+ }
1056
+
1057
+ // Edge is a loop
1058
+ if(source == target) {
1059
+ const loopSize = 80
1060
+ const centerOfTopBoundary = new VectorImpl(0, source.height || 0)
1061
+ .mul(-0.5)
1062
+ .add(sourceCenter)
1072
1063
 
1073
- return [sourceBorderPoint.add(targetBorderPoint.sub(sourceBorderPoint).mul(0.3))]
1064
+ return [
1065
+ centerOfTopBoundary.add(new VectorImpl(-loopSize / 2.5, -loopSize)),
1066
+ centerOfTopBoundary.add(new VectorImpl(loopSize / 2.5, -loopSize))
1067
+ ]
1074
1068
  }
1075
1069
 
1076
- return []
1070
+ const sourceToTargetVector = targetCenter.sub(sourceCenter)
1071
+ const sourceBorderPoint = getBorderPointOnVector(source, sourceCenter, sourceToTargetVector)
1072
+ const targetBorderPoint = getBorderPointOnVector(target, targetCenter, sourceToTargetVector.mul(-1))
1073
+
1074
+ return [sourceBorderPoint.add(targetBorderPoint.sub(sourceBorderPoint).mul(0.3))]
1077
1075
  }
1078
1076
 
1079
- function getBorderPointOnVector(node: XYFlowNode, nodeCenter: Vector, v: Vector) {
1077
+ function getBorderPointOnVector(node: DiagramFlowTypes.Node, nodeCenter: Vector, v: Vector) {
1080
1078
  const xScale = (node.width || 0) / 2 / v.x
1081
1079
  const yScale = (node.height || 0) / 2 / v.y
1082
1080
 
@@ -0,0 +1,81 @@
1
+ import { createGlobalThemeContract } from '@vanilla-extract/css'
2
+
3
+ export const vars = createGlobalThemeContract({
4
+ safariAnimationHook: 'safari-animation-hook',
5
+ default: {
6
+ font: 'default-font-family',
7
+ },
8
+ likec4: {
9
+ font: 'font-family',
10
+ background: {
11
+ color: 'background-color',
12
+ pattern: {
13
+ color: 'background-pattern-color',
14
+ },
15
+ },
16
+ },
17
+ compound: {
18
+ font: 'compound-font-family',
19
+ titleColor: 'compound-title-color',
20
+ },
21
+ element: {
22
+ font: 'element-font-family',
23
+ fill: 'element-fill',
24
+ stroke: 'element-stroke',
25
+ hiContrast: 'element-hiContrast',
26
+ loContrast: 'element-loContrast',
27
+ },
28
+ relation: {
29
+ lineColor: 'relation-lineColor',
30
+ labelColor: 'relation-labelColor',
31
+ labelBgColor: 'relation-labelBg',
32
+ },
33
+ optionsPanel: {
34
+ top: 'options-webview-top',
35
+ right: 'options-webview-right',
36
+ },
37
+ navigationPanel: {
38
+ top: 'navigation-webview-top',
39
+ left: 'navigation-webview-left',
40
+ },
41
+ }, (value) => `likec4-${value}`)
42
+
43
+ export const xyvars = createGlobalThemeContract({
44
+ background: {
45
+ color: 'background-color',
46
+ pattern: {
47
+ color: 'background-pattern-color',
48
+ // dots: 'background-pattern-dots-color',
49
+ // lines: 'background-pattern-lines-color',
50
+ // cross: 'background-pattern-cross-color'
51
+ },
52
+ },
53
+ edge: {
54
+ stroke: 'edge-stroke',
55
+ strokeSelected: 'edge-stroke-selected',
56
+ labelColor: 'edge-label-color',
57
+ labelBgColor: 'edge-label-background-color',
58
+ strokeWidth: 'edge-stroke-width',
59
+ },
60
+ node: {
61
+ color: 'node-color',
62
+ border: 'node-border',
63
+ backgroundColor: 'node-background-color',
64
+ groupBackgroundColor: 'node-group-background-color',
65
+ boxshadowHover: 'node-boxshadow-hover',
66
+ boxshadowSelected: 'node-boxshadow-selected',
67
+ borderRadius: 'node-border-radius',
68
+ },
69
+ }, (value) => `xy-${value}`)
70
+
71
+ export const whereLight = ':where([data-mantine-color-scheme="light"])'
72
+ export const whereDark = ':where([data-mantine-color-scheme="dark"])'
73
+
74
+ export const easings = {
75
+ out: 'cubic-bezier(0, 0, 0.40, 1)',
76
+ inOut: 'cubic-bezier(0.50, 0, 0.2, 1)',
77
+ }
78
+
79
+ export const transitions = {
80
+ fast: `all 130ms ${easings.inOut}`,
81
+ }
package/src/theme-vars.ts CHANGED
@@ -1,85 +1,12 @@
1
1
  import { themeToVars } from '@mantine/vanilla-extract'
2
- import { createGlobalThemeContract } from '@vanilla-extract/css'
3
2
 
4
- export const vars = createGlobalThemeContract({
5
- safariAnimationHook: 'safari-animation-hook',
6
- default: {
7
- font: 'default-font-family'
8
- },
9
- likec4: {
10
- font: 'font-family',
11
- background: {
12
- color: 'background-color',
13
- pattern: {
14
- color: 'background-pattern-color'
15
- }
16
- }
17
- },
18
- compound: {
19
- font: 'compound-font-family',
20
- titleColor: 'compound-title-color'
21
- },
22
- element: {
23
- font: 'element-font-family',
24
- fill: 'element-fill',
25
- stroke: 'element-stroke',
26
- hiContrast: 'element-hiContrast',
27
- loContrast: 'element-loContrast'
28
- },
29
- relation: {
30
- lineColor: 'relation-lineColor',
31
- labelColor: 'relation-labelColor',
32
- labelBgColor: 'relation-labelBg'
33
- },
34
- optionsPanel: {
35
- top: 'options-webview-top',
36
- right: 'options-webview-right'
37
- },
38
- navigationPanel: {
39
- top: 'navigation-webview-top',
40
- left: 'navigation-webview-left'
41
- }
42
- }, (value) => `likec4-${value}`)
3
+ export {
4
+ easings,
5
+ transitions,
6
+ vars,
7
+ whereDark,
8
+ whereLight,
9
+ xyvars,
10
+ } from './theme-vars.css'
43
11
 
44
- export const xyvars = createGlobalThemeContract({
45
- background: {
46
- color: 'background-color',
47
- pattern: {
48
- color: 'background-pattern-color'
49
- // dots: 'background-pattern-dots-color',
50
- // lines: 'background-pattern-lines-color',
51
- // cross: 'background-pattern-cross-color'
52
- }
53
- },
54
- edge: {
55
- stroke: 'edge-stroke',
56
- strokeSelected: 'edge-stroke-selected',
57
- labelColor: 'edge-label-color',
58
- labelBgColor: 'edge-label-background-color',
59
- strokeWidth: 'edge-stroke-width'
60
- },
61
- node: {
62
- color: 'node-color',
63
- border: 'node-border',
64
- backgroundColor: 'node-background-color',
65
- groupBackgroundColor: 'node-group-background-color',
66
- boxshadowHover: 'node-boxshadow-hover',
67
- boxshadowSelected: 'node-boxshadow-selected',
68
- borderRadius: 'node-border-radius'
69
- }
70
- }, (value) => `xy-${value}`)
71
-
72
- export const whereLight = ':where([data-mantine-color-scheme="light"])'
73
- export const whereDark = ':where([data-mantine-color-scheme="dark"])'
74
-
75
- export const easings = {
76
- out: 'cubic-bezier(0, 0, 0.40, 1)',
77
- inOut: 'cubic-bezier(0.50, 0, 0.2, 1)'
78
- }
79
-
80
- export const transitions = {
81
- fast: `all 130ms ${easings.inOut}`
82
- }
83
-
84
- // we need only variables names
85
12
  export const mantine = themeToVars({})