@likec4/diagram 1.36.1 → 1.38.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 (173) hide show
  1. package/bundle/{chunk-DHvr-RGh.js → chunk-BZV0K82k.js} +870 -900
  2. package/bundle/custom.js +64 -56
  3. package/bundle/index.js +3565 -3327
  4. package/dist/LikeC4Diagram.props.d.ts +5 -5
  5. package/dist/LikeC4Styles.js +17 -15
  6. package/dist/StaticLikeC4Diagram.d.ts +1 -1
  7. package/dist/StaticLikeC4Diagram.js +3 -0
  8. package/dist/base/BaseXYFlow.d.ts +1 -1
  9. package/dist/base/BaseXYFlow.js +25 -27
  10. package/dist/base/const.d.ts +4 -4
  11. package/dist/base/const.js +5 -4
  12. package/dist/base/primitives/MarkdownBlock.js +4 -1
  13. package/dist/base/primitives/compound/CompoundActionButton.js +27 -42
  14. package/dist/base/primitives/compound/CompoundDetailsButton.js +23 -48
  15. package/dist/base/primitives/compound/CompoundNodeContainer.js +16 -48
  16. package/dist/base/primitives/compound/CompoundTitle.js +5 -80
  17. package/dist/base/primitives/compound/actionbtns.css.js +1 -13
  18. package/dist/base/primitives/customEdge.d.ts +1 -1
  19. package/dist/base/primitives/customNode.d.ts +4 -4
  20. package/dist/base/primitives/customNode.js +7 -7
  21. package/dist/base/primitives/edge/EdgeLabel.d.ts +5 -4
  22. package/dist/base/primitives/edge/EdgeLabel.js +39 -21
  23. package/dist/base/primitives/edge/EdgeLabelContainer.js +11 -23
  24. package/dist/base/primitives/edge/edge.css.js +19 -11
  25. package/dist/base/primitives/element/ElementShape.js +38 -18
  26. package/dist/base/primitives/element/ElementTags.js +7 -4
  27. package/dist/base/primitives/element/ElementTitle.js +10 -2
  28. package/dist/base/types.d.ts +17 -21
  29. package/dist/bundle/LikeC4View.d.ts +2 -2
  30. package/dist/bundle/LikeC4View.js +4 -1
  31. package/dist/bundle/LikeC4View.props.d.ts +2 -2
  32. package/dist/bundle/ReactLikeC4.d.ts +3 -3
  33. package/dist/bundle/custom.js +2 -1
  34. package/dist/bundle/index.js +2 -1
  35. package/dist/components/Link.js +3 -2
  36. package/dist/context/ReduceGraphics.js +2 -5
  37. package/dist/context/RootContainer.js +1 -5
  38. package/dist/custom/customNodes.d.ts +32 -26
  39. package/dist/custom/customNodes.js +12 -8
  40. package/dist/custom/hooks.d.ts +2 -1
  41. package/dist/custom/index.js +2 -1
  42. package/dist/globals.css.js +1 -1
  43. package/dist/hooks/index.d.ts +1 -1
  44. package/dist/hooks/useDiagram.d.ts +18 -1
  45. package/dist/hooks/useDiagram.js +18 -2
  46. package/dist/hooks/useXYFlow.d.ts +40 -21
  47. package/dist/index.d.ts +1 -1
  48. package/dist/index.js +2 -1
  49. package/dist/likec4diagram/DiagramUI.js +5 -2
  50. package/dist/likec4diagram/DiagramXYFlow.js +9 -9
  51. package/dist/likec4diagram/custom/edges/RelationshipEdge.d.ts +3 -3
  52. package/dist/likec4diagram/custom/edges/RelationshipEdge.js +27 -44
  53. package/dist/likec4diagram/custom/index.js +3 -3
  54. package/dist/likec4diagram/custom/nodes/nodes.d.ts +8 -6
  55. package/dist/likec4diagram/custom/nodes/nodes.js +13 -14
  56. package/dist/likec4diagram/custom/nodes/toolbar/CompoundToolbar.js +3 -2
  57. package/dist/likec4diagram/custom/nodes/toolbar/_shared.d.ts +2 -2
  58. package/dist/likec4diagram/relationship-popover/RelationshipPopover.d.ts +2 -0
  59. package/dist/likec4diagram/relationship-popover/RelationshipPopover.js +441 -0
  60. package/dist/likec4diagram/relationship-popover/actor.d.ts +177 -0
  61. package/dist/likec4diagram/relationship-popover/actor.js +155 -0
  62. package/dist/likec4diagram/relationship-popover/styles.css.d.ts +2 -0
  63. package/dist/likec4diagram/{custom/edges/RelationshipsDropdownMenu.css.js → relationship-popover/styles.css.js} +4 -17
  64. package/dist/likec4diagram/useLayoutConstraints.js +0 -1
  65. package/dist/likec4model/useLikeC4ElementsTree.js +1 -1
  66. package/dist/likec4model/useLikeC4Project.js +15 -1
  67. package/dist/navigationpanel/NavigationPanelDropdown.js +1 -2
  68. package/dist/navigationpanel/actor.js +1 -2
  69. package/dist/navigationpanel/controls/NavigationButtons.js +1 -5
  70. package/dist/navigationpanel/controls/ViewDetailsCard.js +2 -0
  71. package/dist/overlays/element-details/actor.d.ts +564 -8
  72. package/dist/overlays/overlay/Overlay.css.d.ts +1 -1
  73. package/dist/overlays/relationship-details/actor.d.ts +3 -1
  74. package/dist/overlays/relationship-details/hooks.d.ts +19 -1
  75. package/dist/overlays/relationship-details/layout-to-xyflow.js +0 -1
  76. package/dist/overlays/relationship-details/layout.js +1 -2
  77. package/dist/overlays/relationships-browser/actor.d.ts +26 -2
  78. package/dist/overlays/relationships-browser/custom/nodeTypes.d.ts +16 -0
  79. package/dist/overlays/relationships-browser/custom/nodeTypes.js +18 -8
  80. package/dist/overlays/relationships-browser/useViewToNodesEdges.js +0 -1
  81. package/dist/search/components/_shared.css.d.ts +1 -1
  82. package/dist/state/DiagramActorProvider.js +2 -19
  83. package/dist/state/assign.js +24 -10
  84. package/dist/state/diagram-machine.d.ts +149 -474
  85. package/dist/state/diagram-machine.js +94 -54
  86. package/dist/state/types.d.ts +1 -1
  87. package/dist/styles-min.css +1 -1
  88. package/dist/styles-xyflow.css +1 -1
  89. package/dist/styles.css +1 -1
  90. package/dist/styles.css2.js +1 -1
  91. package/dist/utils/index.d.ts +2 -1
  92. package/dist/utils/roundDpr.d.ts +1 -0
  93. package/dist/utils/roundDpr.js +20 -0
  94. package/dist/utils/xyflow.d.ts +0 -1
  95. package/dist/utils/xyflow.js +1 -7
  96. package/package.json +16 -15
  97. package/panda.buildinfo.json +91 -156
  98. package/src/LikeC4Diagram.props.ts +5 -5
  99. package/src/LikeC4Styles.tsx +22 -14
  100. package/src/StaticLikeC4Diagram.tsx +3 -0
  101. package/src/base/BaseXYFlow.tsx +26 -29
  102. package/src/base/const.ts +5 -4
  103. package/src/base/primitives/MarkdownBlock.tsx +6 -1
  104. package/src/base/primitives/compound/CompoundActionButton.tsx +31 -43
  105. package/src/base/primitives/compound/CompoundDetailsButton.tsx +26 -48
  106. package/src/base/primitives/compound/CompoundNodeContainer.tsx +15 -43
  107. package/src/base/primitives/compound/CompoundTitle.tsx +4 -76
  108. package/src/base/primitives/compound/actionbtns.css.ts +0 -12
  109. package/src/base/primitives/customEdge.ts +1 -1
  110. package/src/base/primitives/customNode.tsx +20 -24
  111. package/src/base/primitives/edge/EdgeLabel.tsx +23 -8
  112. package/src/base/primitives/edge/EdgeLabelContainer.tsx +9 -21
  113. package/src/base/primitives/edge/edge.css.ts +19 -11
  114. package/src/base/primitives/element/ElementShape.tsx +40 -18
  115. package/src/base/primitives/element/ElementTags.tsx +7 -4
  116. package/src/base/primitives/element/ElementTitle.tsx +23 -11
  117. package/src/base/types.ts +21 -25
  118. package/src/bundle/LikeC4View.props.ts +2 -2
  119. package/src/bundle/LikeC4View.tsx +8 -5
  120. package/src/bundle/ReactLikeC4.tsx +3 -3
  121. package/src/components/Link.tsx +3 -2
  122. package/src/context/RootContainer.tsx +1 -5
  123. package/src/context/TagStylesContext.tsx +2 -0
  124. package/src/custom/{customNodes.tsx → customNodes.ts} +58 -52
  125. package/src/custom/hooks.ts +7 -0
  126. package/src/globals.css +58 -5
  127. package/src/hooks/index.ts +1 -1
  128. package/src/hooks/useDiagram.ts +39 -5
  129. package/src/hooks/useXYFlow.ts +3 -1
  130. package/src/index.ts +1 -0
  131. package/src/likec4diagram/DiagramUI.tsx +3 -0
  132. package/src/likec4diagram/DiagramXYFlow.tsx +9 -11
  133. package/src/likec4diagram/custom/edges/RelationshipEdge.tsx +25 -49
  134. package/src/likec4diagram/custom/index.ts +5 -4
  135. package/src/likec4diagram/custom/nodes/nodes.tsx +13 -11
  136. package/src/likec4diagram/custom/nodes/toolbar/CompoundToolbar.tsx +3 -2
  137. package/src/likec4diagram/relationship-popover/RelationshipPopover.tsx +535 -0
  138. package/src/likec4diagram/relationship-popover/actor.ts +192 -0
  139. package/src/likec4diagram/{custom/edges/RelationshipsDropdownMenu.css.ts → relationship-popover/styles.css.ts} +3 -19
  140. package/src/likec4diagram/useLayoutConstraints.ts +0 -1
  141. package/src/likec4model/useLikeC4ElementsTree.ts +1 -1
  142. package/src/navigationpanel/NavigationPanelDropdown.tsx +1 -2
  143. package/src/navigationpanel/actor.ts +2 -2
  144. package/src/navigationpanel/controls/NavigationButtons.tsx +1 -5
  145. package/src/navigationpanel/controls/ViewDetailsCard.tsx +2 -0
  146. package/src/overlays/relationship-details/layout-to-xyflow.ts +0 -1
  147. package/src/overlays/relationship-details/layout.ts +4 -3
  148. package/src/overlays/relationships-browser/custom/nodeTypes.tsx +22 -8
  149. package/src/overlays/relationships-browser/useViewToNodesEdges.ts +0 -1
  150. package/src/state/DiagramActorProvider.tsx +2 -20
  151. package/src/state/assign.ts +24 -10
  152. package/src/state/diagram-machine.ts +101 -53
  153. package/src/state/types.ts +4 -1
  154. package/src/utils/index.ts +2 -1
  155. package/src/utils/roundDpr.ts +27 -0
  156. package/src/utils/xyflow.ts +0 -7
  157. package/dist/base/primitives/compound/CompoundNodeContainer.css.d.ts +0 -35
  158. package/dist/base/primitives/compound/CompoundNodeContainer.css.js +0 -132
  159. package/dist/base/primitives/edge/EdgeLabel.css.d.ts +0 -7
  160. package/dist/base/primitives/edge/EdgeLabel.css.js +0 -57
  161. package/dist/base/primitives/element/ElementShape.css.d.ts +0 -6
  162. package/dist/base/primitives/element/ElementShape.css.js +0 -107
  163. package/dist/likec4diagram/custom/edges/NotePopover.css.js +0 -21
  164. package/dist/likec4diagram/custom/edges/NotePopover.js +0 -91
  165. package/dist/likec4diagram/custom/edges/RelationshipsDropdownMenu.css.d.ts +0 -5
  166. package/dist/likec4diagram/custom/edges/RelationshipsDropdownMenu.d.ts +0 -13
  167. package/dist/likec4diagram/custom/edges/RelationshipsDropdownMenu.js +0 -215
  168. package/dist/likec4diagram/custom/index.d.ts +0 -62
  169. package/dist/overlays/relationship-details/custom/nodeTypes.d.ts +0 -10
  170. package/src/base/primitives/compound/CompoundNodeContainer.css.ts +0 -138
  171. package/src/base/primitives/edge/EdgeLabel.css.ts +0 -64
  172. package/src/base/primitives/element/ElementShape.css.ts +0 -112
  173. package/src/likec4diagram/custom/edges/RelationshipsDropdownMenu.tsx +0 -281
@@ -1,3 +1,4 @@
1
1
  export { vector, VectorImpl } from './vector';
2
2
  export type { Vector } from './vector';
3
- export { bezierControlPoints, bezierPath, centerXYInternalNode, distance, distanceBetweenPoints, isInside, isSamePoint, nodeToRect, stopPropagation, toDomPrecision, } from './xyflow';
3
+ export { bezierControlPoints, bezierPath, centerXYInternalNode, distance, distanceBetweenPoints, isInside, isSamePoint, nodeToRect, stopPropagation, } from './xyflow';
4
+ export { roundDpr } from './roundDpr';
@@ -0,0 +1 @@
1
+ export declare function roundDpr(v: number): number;
@@ -0,0 +1,20 @@
1
+ import { clamp } from 'remeda';
2
+
3
+ function getDevicePixelRatio() {
4
+ const hasDprProp = typeof window !== "undefined" && typeof window.devicePixelRatio === "number";
5
+ const dpr = hasDprProp ? window.devicePixelRatio : 1;
6
+ return clamp(Math.floor(dpr), {
7
+ min: 1,
8
+ max: 4
9
+ });
10
+ }
11
+ let knownDpr;
12
+ function roundDpr(v) {
13
+ knownDpr ??= getDevicePixelRatio();
14
+ if (knownDpr < 2) {
15
+ return Math.round(v);
16
+ }
17
+ return Math.round(v * knownDpr) / knownDpr;
18
+ }
19
+
20
+ export { roundDpr };
@@ -1,6 +1,5 @@
1
1
  import { DiagramEdge, NonEmptyArray, Point } from '@likec4/core';
2
2
  import { InternalNode, Rect, XYPosition } from '@xyflow/react';
3
- export declare function toDomPrecision(v: number | null): number;
4
3
  export declare function distance(a: XYPosition, b: XYPosition): number;
5
4
  export declare const nodeToRect: (nd: InternalNode) => Rect;
6
5
  /**
@@ -3,12 +3,6 @@ import { getNodeDimensions } from '@xyflow/system';
3
3
  import { Bezier } from 'bezier-js';
4
4
  import { isArray } from 'remeda';
5
5
 
6
- function toDomPrecision(v) {
7
- if (v === null) {
8
- return 0.01;
9
- }
10
- return Math.round(v * 100) / 100;
11
- }
12
6
  function bezierControlPoints(diagramEdge) {
13
7
  let [start, ...bezierPoints] = diagramEdge.points;
14
8
  invariant(start, "start should be defined");
@@ -66,4 +60,4 @@ function bezierPath(bezierSpline) {
66
60
  return path;
67
61
  }
68
62
 
69
- export { bezierControlPoints, bezierPath, centerXYInternalNode, isSamePoint, stopPropagation, toDomPrecision };
63
+ export { bezierControlPoints, bezierPath, centerXYInternalNode, isSamePoint, stopPropagation };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@likec4/diagram",
3
- "version": "1.36.1",
3
+ "version": "1.38.0",
4
4
  "license": "MIT",
5
5
  "bugs": "https://github.com/likec4/likec4/issues",
6
6
  "homepage": "https://likec4.dev",
@@ -68,30 +68,31 @@
68
68
  },
69
69
  "dependencies": {
70
70
  "@dagrejs/dagre": "1.1.5",
71
- "@mantine/core": "8.2.2",
72
- "@mantine/hooks": "8.2.2",
71
+ "@floating-ui/dom": "^1.7.3",
72
+ "@mantine/core": "8.2.4",
73
+ "@mantine/hooks": "8.2.4",
73
74
  "@nanostores/react": "1.0.0",
74
75
  "@react-hookz/web": "^25.1.1",
75
76
  "@xstate/react": "^5.0.5",
76
- "@xyflow/react": "12.6.4",
77
- "@xyflow/system": "0.0.61",
78
- "khroma": "2.1.0",
77
+ "@xyflow/react": "12.8.3",
78
+ "@xyflow/system": "0.0.67",
79
79
  "bezier-js": "^6.1.4",
80
- "esm-env": "^1.2.2",
81
80
  "d3-shape": "^3.2.0",
81
+ "esm-env": "^1.2.2",
82
82
  "fast-equals": "^5.2.2",
83
- "motion": "^12.23.11",
83
+ "khroma": "2.1.0",
84
+ "motion": "^12.23.12",
84
85
  "nanostores": "1.0.1",
85
86
  "react-error-boundary": "^6.0.0",
86
87
  "react-shadow": "^20.6.0",
87
88
  "remeda": "^2.23.1",
88
89
  "type-fest": "^4.41.0",
89
- "xstate": "^5.20.1",
90
- "@likec4/core": "1.36.1",
91
- "@likec4/styles": "1.36.1"
90
+ "xstate": "^5.20.2",
91
+ "@likec4/core": "1.38.0",
92
+ "@likec4/styles": "1.38.0"
92
93
  },
93
94
  "peerDependencies": {
94
- "@pandacss/dev": "^0.54.0",
95
+ "@pandacss/dev": "^1.0.1",
95
96
  "react": "^18.x || ^19.x",
96
97
  "react-dom": "^18.x || ^19.x"
97
98
  },
@@ -101,13 +102,13 @@
101
102
  }
102
103
  },
103
104
  "devDependencies": {
104
- "@pandacss/dev": "^0.54.0",
105
+ "@pandacss/dev": "^1.0.1",
105
106
  "@statelyai/inspect": "^0.4.0",
106
107
  "@tabler/icons-react": "3.34.1",
107
108
  "@types/bezier-js": "^4.1.3",
108
109
  "@types/d3-shape": "^3.1.7",
109
110
  "@types/node": "~20.19.2",
110
- "@types/react": "19.1.9",
111
+ "@types/react": "19.1.10",
111
112
  "@types/react-dom": "19.1.7",
112
113
  "@vitejs/plugin-react": "^4.6.0",
113
114
  "postcss": "8.5.5",
@@ -118,7 +119,7 @@
118
119
  "vite-plugin-dts": "^4.5.4",
119
120
  "vitest": "3.2.4",
120
121
  "wireit": "0.14.12",
121
- "@likec4/tsconfig": "1.36.1"
122
+ "@likec4/tsconfig": "1.38.0"
122
123
  },
123
124
  "scripts": {
124
125
  "typecheck": "tsc --build --verbose",
@@ -1,16 +1,10 @@
1
1
  {
2
- "schemaVersion": "0.54.0",
2
+ "schemaVersion": "1.0.1",
3
3
  "styles": {
4
4
  "atomic": [
5
5
  "background]___[value:dots",
6
6
  "background]___[value:transparent",
7
7
  "gap]___[value:20",
8
- "WebkitUserSelect]___[value:none]___[cond:& .react-flow__pane",
9
- "display]___[value:none]___[cond:& .react-flow__attribution",
10
- "background]___[value:transparent !important",
11
- "--xy-background-color]___[value:transparent !important",
12
- "--xy-background-color]___[value:{colors.likec4.background}",
13
- "--xy-background-pattern-color]___[value:{colors.likec4.background.pattern}",
14
8
  "position]___[value:absolute",
15
9
  "top]___[value:1rem",
16
10
  "right]___[value:1rem",
@@ -38,6 +32,7 @@
38
32
  "maxWidth]___[value:500",
39
33
  "userSelect]___[value:all",
40
34
  "paddingRight]___[value:0",
35
+ "backgroundColor]___[value:transparent",
41
36
  "backgroundColor]___[value:mantine.colors.gray[1]]___[cond:_hover",
42
37
  "backgroundColor]___[value:mantine.colors.dark[5]]___[cond:_hover<___>_dark",
43
38
  "color]___[value:mantine.colors.dimmed]___[cond:&:is([data-position=\"left\"])",
@@ -197,34 +192,64 @@
197
192
  "gap]___[value:10px",
198
193
  "order]___[value:6",
199
194
  "paddingRight]___[value:xs",
200
- "display]___[value:flex]___[cond:@likec4-root/sm",
195
+ "borderBlockEndWidth]___[value:var(--thickness)",
196
+ "width]___[value:max-content",
197
+ "cursor]___[value:default",
198
+ "gap]___[value:3.5",
199
+ "padding]___[value:4",
200
+ "paddingTop]___[value:2.5",
201
+ "--bleed-x]___[value:token(spacing.2, 2)",
202
+ "--bleed-y]___[value:token(spacing.2, 2)",
203
+ "marginInline]___[value:calc(var(--bleed-x, 0) * -1)",
204
+ "marginBlock]___[value:calc(var(--bleed-y, 0) * -1)",
205
+ "paddingBlock]___[value:2",
206
+ "paddingInline]___[value:2",
207
+ "gap]___[value:1",
208
+ "backgroundColor]___[value:mantine.colors.dark[5]/70]___[cond:_hover<___>_dark",
209
+ "gap]___[value:0.5",
210
+ "gap]___[value:2",
211
+ "flexWrap]___[value:wrap",
212
+ "opacity]___[value:0.65",
213
+ "paddingLeft]___[value:2.5",
214
+ "paddingBlock]___[value:1.5",
215
+ "borderLeft]___[value:2px dotted",
216
+ "borderLeftColor]___[value:mantine.colors.gray[3]",
217
+ "borderLeftColor]___[value:mantine.colors.dark[4]]___[cond:_dark",
218
+ "display]___[value:inline-block",
219
+ "fontSize]___[value:xxs",
220
+ "lineHeight]___[value:[1.11]",
221
+ "display]___[value:block",
222
+ "whiteSpace]___[value:nowrap",
223
+ "padding]___[value:[2px 4px]",
224
+ "borderRadius]___[value:[2px]",
225
+ "background]___[value:var(--likec4-palette-fill)/30",
226
+ "mixBlendMode]___[value:hard-light",
227
+ "color]___[value:[color-mix(in srgb, var(--likec4-palette-stroke), {colors.likec4.mixColor} 60%)]]___[cond:_light",
228
+ "color]___[value:var(--likec4-palette-loContrast)]___[cond:_dark",
229
+ "whiteSpaceCollapse]___[value:preserve-breaks",
230
+ "lineHeight]___[value:sm",
201
231
  "color]___[value:likec4.panel.action-icon.text",
202
232
  "color]___[value:likec4.panel.action-icon.text.hover]___[cond:_hover",
203
233
  "backgroundColor]___[value:likec4.panel.action-icon.bg",
204
234
  "backgroundColor]___[value:likec4.panel.action-icon.bg.hover]___[cond:_hover",
205
235
  "opacity]___[value:0.8",
206
- "whiteSpace]___[value:nowrap",
207
- "gap]___[value:0.5",
208
236
  "paddingInline]___[value:xxs",
209
237
  "position]___[value:bottom-end",
210
238
  "boxShadow]___[value:xl",
211
239
  "display]___[value:flex]___[cond:@/xs",
212
- "gap]___[value:2",
213
240
  "alignItems]___[value:baseline",
214
241
  "stroke]___[value:1.8",
215
242
  "marginTop]___[value:1",
216
- "flexWrap]___[value:wrap",
217
243
  "fontSize]___[value:xs",
218
244
  "marginBottom]___[value:xxs",
219
- "fontSize]___[value:xxs",
220
245
  "gap]___[value:md",
221
246
  "margin]___[value:xs",
222
247
  "padding]___[value:md",
223
248
  "maxWidth]___[value:calc(100cqw - 32px)",
224
249
  "minWidth]___[value:calc(100cqw - 50px)",
225
250
  "maxHeight]___[value:calc(100cqh - 100px)",
226
- "width]___[value:max-content",
227
- "cursor]___[value:default",
251
+ "overflow]___[value:auto",
252
+ "overscrollBehavior]___[value:contain",
228
253
  "minWidth]___[value:400]___[cond:@/sm",
229
254
  "maxWidth]___[value:550]___[cond:@/sm",
230
255
  "maxWidth]___[value:700]___[cond:@/lg",
@@ -287,7 +312,6 @@
287
312
  "borderRadius]___[value:3",
288
313
  "transform]___[value:translate(-50%, -50%)",
289
314
  "flexShrink]___[value:0",
290
- "display]___[value:block",
291
315
  "marginRight]___[value:sm",
292
316
  "borderColor]___[value:mantine.colors.orange[6]",
293
317
  "borderWidth]___[value:4]___[cond:md",
@@ -305,6 +329,7 @@
305
329
  "backgroundColor]___[value:mantine.colors.dark[6]]___[cond:_dark",
306
330
  "border]___[value:none",
307
331
  "backgroundImage]___[value: linear-gradient(180deg, color-mix(in srgb, var(--likec4-palette-fill) 60%, transparent), color-mix(in srgb, var(--likec4-palette-fill) 20%, transparent) 8px, color-mix(in srgb, var(--likec4-palette-fill) 14%, transparent) 20px, transparent 80px ), linear-gradient(180deg, var(--likec4-palette-fill), var(--likec4-palette-fill) 4px, transparent 4px) ",
332
+ "display]___[value:none]___[cond:& .react-flow__attribution",
308
333
  "flex]___[value:0",
309
334
  "cursor]___[value:move",
310
335
  "fontFamily]___[value:likec4.element",
@@ -390,7 +415,6 @@
390
415
  "marginTop]___[value:6",
391
416
  "stroke]___[value:1.6",
392
417
  "paddingTop]___[value:xs",
393
- "borderBlockEndWidth]___[value:var(--thickness)",
394
418
  "gap]___[value:[4px 4px]",
395
419
  "paddingRight]___[value:xxs",
396
420
  "transitionProperty]___[value:all",
@@ -421,8 +445,6 @@
421
445
  "stroke]___[value:1.2",
422
446
  "offset]___[value:0",
423
447
  "paddingBlock]___[value:4",
424
- "opacity]___[value:0.65",
425
- "display]___[value:inline-block",
426
448
  "padding]___[value:[3px 6px]",
427
449
  "background]___[value:var(--likec4-palette-fill)/75",
428
450
  "lineHeight]___[value:1.2",
@@ -538,7 +560,6 @@
538
560
  "containerName]___[value:likec4-tree",
539
561
  "containerType]___[value:inline-size",
540
562
  "outline]___[value:none !important",
541
- "gap]___[value:1",
542
563
  "flexDirection]___[value:column-reverse]___[cond:@container likec4-tree (max-width: 450px)",
543
564
  "alignItems]___[value:flex-start]___[cond:@container likec4-tree (max-width: 450px)",
544
565
  "gap]___[value:0.5]___[cond:@container likec4-tree (max-width: 450px)",
@@ -633,98 +654,20 @@
633
654
  "transform]___[value:translateX(-50%)",
634
655
  "zIndex]___[value:903",
635
656
  "marginTop]___[value:[32px]]___[cond:& + &",
636
- "top]___[value:[5px]",
637
- "left]___[value:[4px]",
638
- "display]___[value:none]___[cond:_smallZoom",
639
- "top]___[value:0.5",
640
- "opacity]___[value:0.75]___[cond:_whenHovered",
641
- "borderRadius]___[value:var(--_border-radius, 4px)]___[cond:_before",
642
- "content]___[value:\" \"]___[cond:_before",
643
- "left]___[value:0]___[cond:_before",
644
- "width]___[value:100%]___[cond:_before",
645
- "height]___[value:100%]___[cond:_before",
646
- "border]___[value:transparent]___[cond:_before",
647
- "background]___[value:var(--likec4-palette-fill)]___[cond:_before",
648
- "backgroundClip]___[value:padding-box]___[cond:_before",
649
- "transitionDelay]___[value:.075ms]___[cond:_before",
650
- "transition]___[value:all {durations.slow} {easings.inOut}]___[cond:_noReduceGraphics<___>_before",
651
- "transitionDelay]___[value:.2s]___[cond:_noReduceGraphics<___>&[data-likec4-hovered='true']<___>_before",
652
- "transitionTimingFunction]___[value:in]___[cond:_noReduceGraphics<___>&[data-likec4-hovered='true']<___>_before",
653
- "opacity]___[value:var(--_compound-opacity, 1)]___[cond:&:is([data-compound-transparent])<___>_before",
654
- "borderWidth]___[value:calc(var(--_border-width, 2px) - 1px)]___[cond:&:is([data-compound-transparent])<___>_before",
655
- "borderRadius]___[value:var(--_border-radius, 4px)",
656
- "transition]___[value:all 250ms {easings.inOut}",
657
- "borderStyle]___[value:dashed",
658
- "borderWidth]___[value:[var(--_border-width, 2px)]",
659
- "borderColor]___[value:[color-mix(in srgb, var(--likec4-palette-stroke) var(--_border-opacity-percent, 100%), transparent)]",
660
- "visibility]___[value:hidden",
661
- "visibility]___[value:visible]___[cond:_whenFocused",
662
- "visibility]___[value:visible]___[cond:_whenSelected",
663
- "display]___[value:none]___[cond:_whenPanning",
664
- "stroke]___[value:[color-mix(in srgb, var(--likec4-palette-stroke) 60%, var(--likec4-palette-hiContrast))]",
665
- "strokeWidth]___[value:4",
666
- "fill]___[value:[none]",
667
- "animationStyle]___[value:indicator",
668
- "stroke]___[value:[color-mix(in srgb, var(--likec4-palette-stroke) 80%, var(--likec4-palette-hiContrast))]]___[cond:_light",
669
- "boxShadow]___[value:0 4px 10px 0.5px rgba(0,0,0,0.1) , 0 2px 2px -1px rgba(0,0,0,0.4)]___[cond:_before<___>_noReduceGraphics",
670
- "boxShadow]___[value:none]___[cond:_before<___>_whenSelected",
671
- "boxShadow]___[value:none !important]___[cond:_before<___>_whenPanning",
672
- "left]___[value:[14px]",
673
- "top]___[value:[4px]",
674
- "right]___[value:[30px]",
675
- "width]___[value:auto",
676
- "minHeight]___[value:30px",
677
- "pointerEvents]___[value:all]___[cond::where(.react-flow__node.draggable) &",
678
- "cursor]___[value:grab]___[cond::where(.react-flow__node.draggable) &",
679
- "paddingLeft]___[value:[22px]]___[cond:.likec4-compound-node:has(.compound-action) &",
680
- "fontFamily]___[value:likec4.compound",
681
- "textTransform]___[value:uppercase",
682
- "letterSpacing]___[value:0.2px",
683
- "color]___[value:var(--likec4-palette-loContrast)",
684
- "color]___[value:[color-mix(in srgb, var(--likec4-palette-loContrast) 60%, var(--likec4-palette-fill))]]___[cond:[data-compound-title-inverse] &",
685
- "color]___[value:var(--likec4-palette-stroke)]___[cond:[data-compound-title-inverse] &<___>_light",
686
- "flex]___[value:0 0 20px",
687
- "height]___[value:20px",
688
- "width]___[value:20px",
689
- "mixBlendMode]___[value:hard-light",
690
- "mixBlendMode]___[value:normal]___[cond:_reduceGraphicsOnPan",
691
- "filter]___[value:drop-shadow(0 0 3px rgb(0 0 0 / 12%))]___[cond:& svg, & img",
692
- "filter]___[value:drop-shadow(0 1px 8px rgb(0 0 0 / 8%))]___[cond:& svg, & img<___>xs",
693
- "filter]___[value:drop-shadow(1px 1px 16px rgb(0 0 0 / 3%))]___[cond:& svg, & img<___>sm",
694
- "filter]___[value:none]___[cond:& svg, & img<___>_reduceGraphicsOnPan",
695
657
  "transitionDuration]___[value:normal",
696
- "--actionbtn-color]___[value:color-mix(in srgb, var(--likec4-palette-loContrast) 60%, var(--likec4-palette-fill))]___[cond:[data-compound-title-inverse] &<___>_dark",
697
- "--actionbtn-color]___[value:var(--likec4-palette-stroke)]___[cond:[data-compound-title-inverse] &<___>_light",
698
- "--actionbtn-color-hovered]___[value:var(--likec4-palette-stroke)]___[cond:[data-compound-title-inverse] &<___>_light",
699
- "--actionbtn-color-hovered-btn]___[value:var(--likec4-palette-hiContrast)]___[cond:[data-compound-title-inverse] &<___>_light",
700
- "--actionbtn-bg-hovered]___[value:var(--likec4-palette-fill)/50]___[cond:[data-compound-title-inverse] &<___>_light",
701
- "--actionbtn-bg-hovered-btn]___[value:var(--likec4-palette-fill)]___[cond:[data-compound-title-inverse] &<___>_light",
702
658
  "transitionDelay]___[value:0.2s",
703
659
  "transitionDelay]___[value:0s]___[cond:_hover",
704
- "top]___[value:1",
705
- "right]___[value:1",
706
- "textAlign]___[value:left",
707
- "whiteSpaceCollapse]___[value:preserve-breaks",
708
- "textWrap]___[value:pretty",
709
- "lineHeight]___[value:1.25",
710
- "--text-fz]___[value:{fontSizes.sm}",
711
- "--text-fz]___[value:{fontSizes.md}]___[cond:md",
712
- "background]___[value:[var(--xy-edge-label-background-color)]",
713
- "color]___[value:[var(--xy-edge-label-color)]",
714
- "border]___[value:0px solid transparent",
715
- "transform]___[value:var(--edge-translate)",
716
- "transition]___[value:all 190ms {easings.inOut}]___[cond:&:is([data-likec4-hovered='true'])",
717
- "transform]___[value:var(--edge-translate, translate(0px, 0px)) scale(1.12)]___[cond:&:is([data-likec4-hovered='true'])",
718
- "transitionDelay]___[value:100ms]___[cond:&:is([data-likec4-hovered='true'])",
719
- "mixBlendMode]___[value:plus-lighter]___[cond:_noReduceGraphics<___>_dark",
720
- "mixBlendMode]___[value:screen]___[cond:_noReduceGraphics<___>_light",
721
- "display]___[value:none]___[cond:_reduceGraphicsOnPan",
722
660
  "lineClamp]___[value:5",
661
+ "display]___[value:none]___[cond:_reduceGraphicsOnPan",
662
+ "display]___[value:none]___[cond:_smallZoom",
663
+ "fill]___[value:[none]",
723
664
  "strokeOpacity]___[value:0",
724
665
  "transition]___[value:none]___[cond:_reduceGraphics",
725
666
  "strokeWidth]___[value:calc(var(--xy-edge-stroke-width) + 2)",
726
667
  "strokeOpacity]___[value:0.08",
727
- "transitionProperty]___[value:stroke-width, stroke-opacity",
668
+ "transitionProperty]___[value:stroke-width, stroke-opacity]___[cond:_noReduceGraphics",
669
+ "transitionDuration]___[value:fast]___[cond:_noReduceGraphics",
670
+ "transitionTimingFunction]___[value:inOut]___[cond:_noReduceGraphics",
728
671
  "transitionTimingFunction]___[value:out]___[cond:_whenHovered",
729
672
  "strokeWidth]___[value:calc(var(--xy-edge-stroke-width) + 4)]___[cond:_whenHovered",
730
673
  "strokeOpacity]___[value:0.2]___[cond:_whenHovered",
@@ -735,59 +678,37 @@
735
678
  "stroke]___[value:[var(--xy-edge-stroke)]",
736
679
  "fill]___[value:[none!]",
737
680
  "strokeDashoffset]___[value:10",
681
+ "animationStyle]___[value:xyedgeAnimated]___[cond:_noReduceGraphics",
682
+ "animationPlayState]___[value:paused]___[cond:_noReduceGraphics",
738
683
  "transition]___[value:stroke 130ms ease-out,stroke-width 130ms ease-out]___[cond:_noReduceGraphics",
739
- "animationStyle]___[value:xyedgeAnimated]___[cond:_whenHovered",
740
- "animationDelay]___[value:450ms]___[cond:_whenHovered",
741
- "animationStyle]___[value:xyedgeAnimated]___[cond::where(.react-flow__edge.selected, [data-edge-active='true'], [data-edge-animated='true']) &",
742
- "animationDelay]___[value:0ms]___[cond::where(.react-flow__edge.selected, [data-edge-active='true'], [data-edge-animated='true']) &",
743
684
  "animationDirection]___[value:reverse]___[cond::where([data-edge-dir='back']) &",
685
+ "animationPlayState]___[value:running]___[cond:_whenHovered<___>_noReduceGraphics",
686
+ "animationDelay]___[value:450ms]___[cond:_whenHovered<___>_noReduceGraphics",
687
+ "animationPlayState]___[value:running]___[cond::where(.react-flow__edge.selected, [data-edge-active='true'], [data-edge-animated='true']) &<___>_noReduceGraphics",
688
+ "animationDelay]___[value:0ms]___[cond::where(.react-flow__edge.selected, [data-edge-active='true'], [data-edge-animated='true']) &<___>_noReduceGraphics",
744
689
  "animationPlayState]___[value:paused]___[cond:_whenDimmed",
745
690
  "animationName]___[value:none]___[cond:_smallZoom",
746
691
  "strokeDasharray]___[value:none !important]___[cond:_whenPanning",
747
- "animationName]___[value:none]___[cond:_whenPanning",
692
+ "animationPlayState]___[value:paused]___[cond:_whenPanning",
748
693
  "top]___[value:[calc(100% - 30px)]",
694
+ "width]___[value:auto",
695
+ "minHeight]___[value:30px",
696
+ "top]___[value:0.5",
749
697
  "right]___[value:[5px]]___[cond:_shapeBrowser",
750
698
  "top]___[value:[14px]]___[cond:_shapeCylinder",
751
699
  "top]___[value:[14px]]___[cond:_shapeStorage",
752
700
  "top]___[value:[1px]]___[cond:_shapeQueue",
753
701
  "right]___[value:3]___[cond:_shapeQueue",
702
+ "content]___[value:\" \"]___[cond:_before",
754
703
  "top]___[value:[calc(100% - 4px)]]___[cond:_before",
704
+ "left]___[value:0]___[cond:_before",
705
+ "width]___[value:100%]___[cond:_before",
755
706
  "height]___[value:24px]___[cond:_before",
756
707
  "background]___[value:[transparent]]___[cond:_before",
757
708
  "pointerEvents]___[value:all]___[cond:_before",
758
709
  "outline]___[value:none]___[cond:_focusVisible",
759
710
  "display]___[value:none]___[cond:_reduceGraphicsOnPan<___>_before",
760
711
  "cursor]___[value:pointer]___[cond::where(.react-flow__node.selectable:not(.dragging)) &",
761
- "visibility]___[value:hidden]___[cond:_smallZoom",
762
- "stroke]___[value:var(--likec4-palette-loContrast)",
763
- "strokeWidth]___[value:8",
764
- "strokeOpacity]___[value:0.8",
765
- "stroke]___[value:[color-mix(in srgb, var(--likec4-palette-fill) 50%,rgb(121, 121, 121))]]___[cond:_light",
766
- "visibility]___[value:visible]___[cond:_groupFocusVisible",
767
- "animationStyle]___[value:indicator]___[cond:_whenSelected",
768
- "fill]___[value:var(--likec4-palette-fill)",
769
- "fill]___[value:var(--likec4-palette-stroke)",
770
- "fill]___[value:[color-mix(in srgb, var(--likec4-palette-stroke) 90%, var(--likec4-palette-fill))]",
771
- "fill]___[value:var(--likec4-palette-fill)]___[cond:.shape-svg-multiple &",
772
- "stroke]___[value:var(--likec4-palette-stroke)",
773
- "transformOrigin]___[value:50% 50%",
774
- "transformOrigin]___[value:75% 25%]___[cond:_shapeQueue",
775
- "transformOrigin]___[value:50% 100%]___[cond:_shapeCylinder",
776
- "transformOrigin]___[value:50% 100%]___[cond:_shapeStorage",
777
- "transform]___[value:translate(14px, 14px) perspective(300px) translateZ(-8px)",
778
- "filter]___[value:brightness(0.65) saturate(0.8)",
779
- "stroke]___[value:[none]",
780
- "display]___[value:none]___[cond:_whenSelected",
781
- "display]___[value:none]___[cond:_whenFocused",
782
- "transition]___[value:fill 120ms linear, filter 130ms {easings.inOut}",
783
- "transitionDelay]___[value:0ms",
784
- "filter]___[value: drop-shadow(0 2px 1px rgba(0, 0, 0, 0.21)) drop-shadow(0 1px 1px color-mix(in srgb, var(--likec4-palette-stroke) 40%, transparent)) drop-shadow(0 5px 3px rgba(0, 0, 0, 0.1)) ",
785
- "filter]___[value: drop-shadow(0 2px 1px rgba(0, 0, 0, 0.25)) drop-shadow(0 8px 3px rgba(0, 0, 0, 0.1)) drop-shadow(0 10px 10px rgba(0, 0, 0, 0.05)) ]___[cond:_whenHovered",
786
- "filter]___[value: drop-shadow(0 2px 1px rgba(0, 0, 0, 0.25)) drop-shadow(0 8px 3px rgba(0, 0, 0, 0.1)) drop-shadow(0 10px 10px rgba(0, 0, 0, 0.05)) ]___[cond::where([data-likec4-level='true']) &",
787
- "filter]___[value:none]___[cond:_whenSelected",
788
- "filter]___[value:none]___[cond:_smallZoom",
789
- "transition]___[value:none]___[cond:_whenPanning",
790
- "filter]___[value:none]___[cond:_whenPanning",
791
712
  "bottom]___[value:0",
792
713
  "bottom]___[value:[5px]]___[cond:_shapeCylinder",
793
714
  "bottom]___[value:[5px]]___[cond:_shapeStorage",
@@ -811,21 +732,12 @@
811
732
  "top]___[value:[1px]",
812
733
  "right]___[value:[1px]",
813
734
  "zIndex]___[value:9",
735
+ "textAlign]___[value:left",
736
+ "textWrap]___[value:pretty",
737
+ "lineHeight]___[value:1.25",
738
+ "--text-fz]___[value:{fontSizes.sm}",
739
+ "--text-fz]___[value:{fontSizes.md}]___[cond:md",
814
740
  "offset]___[value:16",
815
- "padding]___[value:4",
816
- "overflowY]___[value:scroll",
817
- "minWidth]___[value:250px",
818
- "maxWidth]___[value:min(90vw, 500px)",
819
- "padding]___[value:[2px 4px]",
820
- "borderRadius]___[value:[2px]",
821
- "background]___[value:var(--likec4-palette-fill)/30",
822
- "lineHeight]___[value:[1.11]",
823
- "color]___[value:[color-mix(in srgb, var(--likec4-palette-stroke), {colors.likec4.mixColor} 60%)]]___[cond:_light",
824
- "color]___[value:var(--likec4-palette-loContrast)]___[cond:_dark",
825
- "top]___[value:5",
826
- "right]___[value:6",
827
- "gap]___[value:3",
828
- "width]___[value:xs",
829
741
  "mixBlendMode]___[value:normal",
830
742
  "fill]___[value:var(--likec4-palette-relation-stroke)",
831
743
  "stroke]___[value:var(--likec4-palette-relation-stroke)",
@@ -833,6 +745,7 @@
833
745
  "strokeWidth]___[value:1",
834
746
  "cursor]___[value:grab",
835
747
  "pointerEvents]___[value:auto",
748
+ "visibility]___[value:hidden",
836
749
  "fillOpacity]___[value:1]___[cond:_hover",
837
750
  "stroke]___[value:mantine.colors.primary.filledHover]___[cond:_hover",
838
751
  "strokeWidth]___[value:10]___[cond:_hover",
@@ -859,7 +772,6 @@
859
772
  "padding]___[value:sm",
860
773
  "marginBottom]___[value:xs",
861
774
  "height]___[value:sm",
862
- "paddingBlock]___[value:2",
863
775
  "opacity]___[value:0.7",
864
776
  "flex]___[value:0 0 auto",
865
777
  "maxHeight]___[value:60",
@@ -871,12 +783,14 @@
871
783
  "minWidth]___[value:300]___[cond:sm",
872
784
  "maxWidth]___[value:65vw]___[cond:sm",
873
785
  "maxWidth]___[value:40vw]___[cond:md",
874
- "backgroundColor]___[value:transparent",
875
786
  "transition]___[value:all 100ms ease-in",
876
787
  "transition]___[value:all 120ms ease-out]___[cond:_hover",
877
788
  "backgroundColor]___[value:mantine.colors.primary[2]/50]___[cond:_hover",
878
789
  "backgroundColor]___[value:mantine.colors.dark[3]/40]___[cond:_dark<___>_hover",
790
+ "fill]___[value:var(--likec4-palette-fill)",
791
+ "stroke]___[value:var(--likec4-palette-stroke)",
879
792
  "filter]___[value: drop-shadow(0 2px 3px rgb(0 0 0 / 22%)) drop-shadow(0 1px 8px rgb(0 0 0 / 10%)) ",
793
+ "letterSpacing]___[value:0.2px",
880
794
  "paddingTop]___[value:0",
881
795
  "paddingBottom]___[value:0",
882
796
  "textTransform]___[value:lowercase",
@@ -912,6 +826,7 @@
912
826
  "paddingLeft]___[value:lg",
913
827
  "paddingRight]___[value:lg",
914
828
  "borderWidth]___[value:3px",
829
+ "borderStyle]___[value:dashed",
915
830
  "strokeWidth]___[value:5",
916
831
  "border]___[value:3px dashed",
917
832
  "position]___[value:right-end",
@@ -950,19 +865,39 @@
950
865
  "actionBtn": [
951
866
  "size]___[value:md]___[recipe:actionBtn",
952
867
  "radius]___[value:md]___[recipe:actionBtn",
953
- "variant]___[value:filled]___[recipe:actionBtn",
954
868
  "variant]___[value:transparent]___[recipe:actionBtn",
869
+ "variant]___[value:filled]___[recipe:actionBtn",
955
870
  "*]___[value:md]___[recipe:actionBtn",
956
871
  "*]___[value:transparent]___[recipe:actionBtn",
957
872
  "*]___[value:filled]___[recipe:actionBtn"
958
873
  ],
874
+ "compoundNode": [
875
+ "isTransparent]___[value:99]___[recipe:compoundNode",
876
+ "inverseColor]___[value:60]___[recipe:compoundNode",
877
+ "borderStyle]___[value:dashed]___[recipe:compoundNode",
878
+ "borderStyle]___[value:none]___[recipe:compoundNode",
879
+ "isTransparent]___[value:false]___[recipe:compoundNode",
880
+ "isTransparent]___[value:true]___[recipe:compoundNode",
881
+ "inverseColor]___[value:true]___[recipe:compoundNode",
882
+ "inverseColor]___[value:false]___[recipe:compoundNode",
883
+ "borderStyle]___[value:solid]___[recipe:compoundNode",
884
+ "borderStyle]___[value:dotted]___[recipe:compoundNode"
885
+ ],
959
886
  "edgeActionBtn": [],
960
887
  "edgeLabel": [
961
888
  "isStepEdge]___[value:false]___[recipe:edgeLabel",
889
+ "cursor]___[value:pointer]___[recipe:edgeLabel",
890
+ "cursor]___[value:default]___[recipe:edgeLabel",
962
891
  "*]___[value:false]___[recipe:edgeLabel",
963
892
  "isStepEdge]___[value:true]___[recipe:edgeLabel",
964
893
  "*]___[value:true]___[recipe:edgeLabel"
965
894
  ],
895
+ "elementShapeRecipe": [
896
+ "shapetype]___[value:html]___[recipe:elementShapeRecipe",
897
+ "shapetype]___[value:svg]___[recipe:elementShapeRecipe",
898
+ "*]___[value:html]___[recipe:elementShapeRecipe",
899
+ "*]___[value:svg]___[recipe:elementShapeRecipe"
900
+ ],
966
901
  "likec4tag": [
967
902
  "autoTextColor]___[value:false]___[recipe:likec4tag",
968
903
  "autoTextColor]___[value:true]___[recipe:likec4tag",
@@ -17,7 +17,7 @@ export type { CustomNodes, WhereOperator }
17
17
 
18
18
  export type DiagramNodeWithNavigate<A extends Any> = SetRequired<DiagramNode<A>, 'navigateTo'>
19
19
 
20
- type ElementIconRendererProps = {
20
+ export type ElementIconRendererProps = {
21
21
  node: {
22
22
  id: string
23
23
  title: string
@@ -28,19 +28,19 @@ type ElementIconRendererProps = {
28
28
 
29
29
  export type ElementIconRenderer = (props: ElementIconRendererProps) => ReactNode
30
30
 
31
- export type OnNavigateTo<A extends Any> = (
31
+ export type OnNavigateTo<A extends Any = Any> = (
32
32
  to: aux.ViewId<A>,
33
33
  // These fields present if navigateTo triggered by a node click
34
34
  event?: ReactMouseEvent,
35
35
  element?: DiagramNodeWithNavigate<A>,
36
36
  ) => void
37
37
 
38
- export type OnNodeClick<A extends Any> = (
38
+ export type OnNodeClick<A extends Any = Any> = (
39
39
  node: DiagramNode<A>,
40
40
  event: ReactMouseEvent,
41
41
  ) => void
42
42
 
43
- export type OnEdgeClick<A extends Any> = (
43
+ export type OnEdgeClick<A extends Any = Any> = (
44
44
  edge: DiagramEdge<A>,
45
45
  event: ReactMouseEvent,
46
46
  ) => void
@@ -106,7 +106,7 @@ export type ViewPadding = PaddingWithUnit | {
106
106
  y?: PaddingWithUnit
107
107
  }
108
108
 
109
- export interface LikeC4DiagramProperties<A extends aux.Any> {
109
+ export interface LikeC4DiagramProperties<A extends Any = Any> {
110
110
  view: LayoutedView<A>
111
111
 
112
112
  className?: string | undefined
@@ -6,6 +6,7 @@ import {
6
6
  } from '@likec4/core'
7
7
  import { useMantineStyleNonce } from '@mantine/core'
8
8
  import { mix, scale, toHex, toRgba } from 'khroma'
9
+ import { memo } from 'react'
9
10
  import { entries, join, map, pipe, range } from 'remeda'
10
11
  import globalsCss from './globals.css?inline'
11
12
  import { useLikeC4Specification } from './likec4model'
@@ -88,20 +89,27 @@ function generateCustomColorStyles(customColors: CustomColorDefinitions) {
88
89
  export function LikeC4Styles() {
89
90
  const nonce = useMantineStyleNonce()?.()
90
91
 
91
- const customColors = useLikeC4Specification().customColors
92
+ const { customColors } = useLikeC4Specification()
92
93
  const customColorsStyles = customColors ? generateCustomColorStyles(customColors) : ''
93
94
 
94
- return (
95
- <>
96
- <style type="text/css" data-likec4-global dangerouslySetInnerHTML={{ __html: globalsCss }} nonce={nonce} />
97
- <style type="text/css" data-likec4-colors dangerouslySetInnerHTML={{ __html: builtInColors }} nonce={nonce} />
98
- {customColorsStyles && (
99
- <style
100
- type="text/css"
101
- data-likec4-custom-colors
102
- dangerouslySetInnerHTML={{ __html: customColorsStyles }}
103
- nonce={nonce} />
104
- )}
105
- </>
106
- )
95
+ return <MemoizedStyles nonce={nonce} customColorsStyles={customColorsStyles} builtInColors={builtInColors} />
107
96
  }
97
+
98
+ /**
99
+ * @internal This gives a performance boost during development
100
+ */
101
+ const MemoizedStyles = memo<{ nonce: string | undefined; customColorsStyles: string; builtInColors: string }>((
102
+ { nonce, customColorsStyles, builtInColors },
103
+ ) => (
104
+ <>
105
+ <style type="text/css" data-likec4-global dangerouslySetInnerHTML={{ __html: globalsCss }} nonce={nonce} />
106
+ <style type="text/css" data-likec4-colors dangerouslySetInnerHTML={{ __html: builtInColors }} nonce={nonce} />
107
+ {customColorsStyles && (
108
+ <style
109
+ type="text/css"
110
+ data-likec4-custom-colors
111
+ dangerouslySetInnerHTML={{ __html: customColorsStyles }}
112
+ nonce={nonce} />
113
+ )}
114
+ </>
115
+ ))