likec4 1.60.0 → 1.61.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 (157) hide show
  1. package/README.md +2 -0
  2. package/__app__/codegen/react.mjs +4 -10
  3. package/__app__/codegen/webcomponent.mjs +5 -208
  4. package/__app__/index.html +15 -15
  5. package/__app__/src/aichat/index.mjs +1 -2
  6. package/__app__/src/chunks/AIChat.mjs +292 -117
  7. package/__app__/src/chunks/ErrorComponent.mjs +444 -0
  8. package/__app__/src/chunks/Header.mjs +269 -0
  9. package/__app__/src/chunks/ViewReact.mjs +438 -0
  10. package/__app__/src/chunks/find.mjs +38 -0
  11. package/__app__/src/chunks/hooks.mjs +18 -541
  12. package/__app__/src/chunks/libs/@tabler/icons-react.mjs +340 -0
  13. package/__app__/src/chunks/libs/@tanstack-ai.mjs +11101 -1797
  14. package/__app__/src/chunks/libs/@tanstack.mjs +4563 -3083
  15. package/__app__/src/chunks/libs/fast-equals.mjs +140 -71
  16. package/__app__/src/chunks/{es.mjs → libs/html-to-image.mjs} +16 -22
  17. package/__app__/src/chunks/libs/nanostores.mjs +4 -8
  18. package/__app__/src/chunks/libs/react-resizable-panels.mjs +2792 -0
  19. package/__app__/src/chunks/react.mjs +22 -0
  20. package/__app__/src/chunks/rolldown-runtime.mjs +3 -32
  21. package/__app__/src/chunks/router.mjs +106 -0
  22. package/__app__/src/chunks/scope.mjs +106 -0
  23. package/__app__/src/chunks/searchParams.mjs +29 -0
  24. package/__app__/src/chunks/single-index.mjs +465 -0
  25. package/__app__/src/chunks/styled-system.mjs +1916 -2946
  26. package/__app__/src/chunks/useAsync.mjs +69 -0
  27. package/__app__/src/chunks/useSyncedRef.mjs +16 -0
  28. package/__app__/src/components/ColorSchemeToggle.mjs +124 -0
  29. package/__app__/src/components/CopyToClipboard.mjs +53 -0
  30. package/__app__/src/components/ErrorComponent.mjs +1 -0
  31. package/__app__/src/components/NavigationPanel.mjs +63 -0
  32. package/__app__/src/components/NotFound.mjs +155 -0
  33. package/__app__/src/components/ViewOutlet.mjs +9 -0
  34. package/__app__/src/components/model-diff/CompareModelProvider.mjs +44 -0
  35. package/__app__/src/components/model-diff/ModelDiffPanel.mjs +179 -0
  36. package/__app__/src/components/model-diff/compare-model.mjs +76 -0
  37. package/__app__/src/components/model-diff/state.mjs +45 -0
  38. package/__app__/src/components/search/OverviewSearch.mjs +92 -0
  39. package/__app__/src/components/search/OverviewSearchAdapter.mjs +94 -0
  40. package/__app__/src/components/sidebar/DiagramTree.css.mjs +48 -0
  41. package/__app__/src/components/sidebar/DiagramsTree.mjs +304 -0
  42. package/__app__/src/components/sidebar/Drawer.mjs +178 -0
  43. package/__app__/src/components/sidebar/SidebarBurger.mjs +28 -0
  44. package/__app__/src/components/sidebar/data.mjs +94 -0
  45. package/__app__/src/components/sidebar/state.mjs +16 -0
  46. package/__app__/src/components/view-page/Header.mjs +1 -0
  47. package/__app__/src/components/view-page/SelectProject.mjs +258 -0
  48. package/__app__/src/components/view-page/ShareModal.mjs +111 -0
  49. package/__app__/src/components/view-page/share-modal/AlertLocalhost.mjs +31 -0
  50. package/__app__/src/components/view-page/share-modal/CopyButtonChild.mjs +36 -0
  51. package/__app__/src/components/view-page/share-modal/EmbedPanel.mjs +100 -0
  52. package/__app__/src/components/view-page/share-modal/WebcomponentsPanel.mjs +264 -0
  53. package/__app__/src/components/view-page/state.mjs +17 -0
  54. package/__app__/src/context/LikeC4CustomizationContext.mjs +26 -0
  55. package/__app__/src/context/LikeC4IconRendererContext.mjs +29 -0
  56. package/__app__/src/context/LikeC4ModelContext.mjs +34 -0
  57. package/__app__/src/context/LikeC4ProjectsContext.mjs +40 -0
  58. package/__app__/src/context/ModelDiffsContext.mjs +33 -0
  59. package/__app__/src/context/safeCtx.mjs +14 -0
  60. package/__app__/src/hooks.mjs +1 -0
  61. package/__app__/src/main.mjs +4 -48126
  62. package/__app__/src/pages/EmbedPage.mjs +93 -0
  63. package/__app__/src/pages/ExportPage.mjs +691 -0
  64. package/__app__/src/pages/ProjectsOverview.mjs +23 -0
  65. package/__app__/src/pages/ViewAsD2.mjs +105 -0
  66. package/__app__/src/pages/ViewAsDot.mjs +65 -0
  67. package/__app__/src/pages/ViewAsMmd.mjs +109 -0
  68. package/__app__/src/pages/ViewAsPuml.mjs +105 -0
  69. package/__app__/src/pages/ViewEditor.mjs +220 -0
  70. package/__app__/src/pages/ViewReact.mjs +1 -0
  71. package/__app__/src/pages/export-layout.mjs +95 -0
  72. package/__app__/src/pages/export-page-params.mjs +9 -0
  73. package/__app__/src/pages/styles.css.mjs +23 -0
  74. package/__app__/src/routeTree.gen.mjs +105 -0
  75. package/__app__/src/router.mjs +1 -0
  76. package/__app__/src/routes/__root.mjs +65 -0
  77. package/__app__/src/routes/index.css.mjs +29 -0
  78. package/__app__/src/routes/index.mjs +32 -0
  79. package/__app__/src/routes/project._projectId/-components.mjs +100 -0
  80. package/__app__/src/routes/project._projectId/embed._viewId.mjs +5 -0
  81. package/__app__/src/routes/project._projectId/export._viewId.mjs +24 -0
  82. package/__app__/src/routes/project._projectId/index.mjs +14 -0
  83. package/__app__/src/routes/project._projectId/route.mjs +93 -0
  84. package/__app__/src/routes/project._projectId/view._viewId.d2.mjs +34 -0
  85. package/__app__/src/routes/project._projectId/view._viewId.dot.mjs +41 -0
  86. package/__app__/src/routes/project._projectId/view._viewId.index.mjs +7 -0
  87. package/__app__/src/routes/project._projectId/view._viewId.mjs +23 -0
  88. package/__app__/src/routes/project._projectId/view._viewId.mmd.mjs +39 -0
  89. package/__app__/src/routes/project._projectId/view._viewId.puml.mjs +34 -0
  90. package/__app__/src/routes/projects.mjs +36 -0
  91. package/__app__/src/routes/single-index.mjs +1 -0
  92. package/__app__/src/routes/webcomponent._.mjs +94 -0
  93. package/__app__/src/style.css +1156 -1147
  94. package/config/schema.json +26 -2
  95. package/dist/app/render-view-client.css +1 -1
  96. package/dist/app/render-view-client.js +375 -393
  97. package/dist/chunks/filenames.mjs +26 -20
  98. package/dist/chunks/generate-likec4.mjs +4 -4
  99. package/dist/chunks/index.d.mts +16 -15
  100. package/dist/chunks/index2.d.mts +7041 -3293
  101. package/dist/chunks/libs/@chenglou/pretext.mjs +9 -0
  102. package/dist/chunks/libs/@logtape/logtape.mjs +5 -5
  103. package/dist/chunks/libs/@ts-graphviz/common.d.mts +2 -4
  104. package/dist/chunks/libs/chevrotain.mjs +19 -19
  105. package/dist/chunks/libs/clone.mjs +1 -0
  106. package/dist/chunks/libs/eventemitter3.mjs +1 -1
  107. package/dist/chunks/libs/fast-equals.mjs +1 -0
  108. package/dist/chunks/libs/fontkit.mjs +1 -0
  109. package/dist/chunks/libs/langium.d.mts +80 -2933
  110. package/dist/chunks/libs/langium.mjs +6 -6
  111. package/dist/chunks/libs/pako.mjs +1 -1
  112. package/dist/chunks/libs/pathe.mjs +1 -1
  113. package/dist/chunks/libs/remeda.mjs +1 -1
  114. package/dist/chunks/node.mjs +110 -77
  115. package/dist/chunks/rolldown-runtime.mjs +1 -1
  116. package/dist/chunks/sequence-view.mjs +1 -1
  117. package/dist/chunks/vite-plugin.mjs +183 -164
  118. package/dist/cli/index.mjs +157 -101
  119. package/dist/config/index.d.mts +65 -4
  120. package/dist/config/index.mjs +1 -1
  121. package/dist/generators/likec4.d.mts +16 -64
  122. package/dist/index.d.mts +2 -4
  123. package/dist/model/index.d.mts +0 -10
  124. package/dist/vite-plugin/index.d.mts +83 -61
  125. package/dist/vite-plugin/internal/chunks/rolldown-runtime.mjs +1 -2
  126. package/dist/vite-plugin/internal/index.d.mts +91 -17
  127. package/dist/vite-plugin/internal/index.mjs +156 -110
  128. package/package.json +60 -55
  129. package/react/index.d.mts +3010 -4014
  130. package/react/index.mjs +170 -171
  131. package/react/rolldown-runtime-CfRud99p.js +1 -0
  132. package/skills/likec4-dsl/SKILL.md +71 -25
  133. package/skills/likec4-dsl/evals/evals-public.json +5 -0
  134. package/skills/likec4-dsl/evals/grading-spec.json +15 -1
  135. package/skills/likec4-dsl/references/cli.md +39 -10
  136. package/skills/likec4-dsl/references/configuration.md +5 -5
  137. package/skills/likec4-dsl/references/diffs.md +52 -0
  138. package/skills/likec4-dsl/references/examples.md +2 -2
  139. package/skills/likec4-dsl/references/identifier-validity.md +31 -31
  140. package/skills/likec4-dsl/references/include-predicates-wildcards.md +16 -15
  141. package/skills/likec4-dsl/references/model.md +42 -11
  142. package/skills/likec4-dsl/references/specification.md +11 -7
  143. package/skills/likec4-dsl/references/troubleshooting.md +47 -42
  144. package/skills/likec4-dsl/references/views.md +2 -2
  145. package/vite-plugin-modules.d.ts +126 -51
  146. package/__app__/src/chunks/LikeC4Styles.mjs +0 -4522
  147. package/__app__/src/chunks/ProjectsOverview.mjs +0 -827
  148. package/__app__/src/chunks/libs/@floating-ui.mjs +0 -3286
  149. package/__app__/src/chunks/libs/@mantine.mjs +0 -17731
  150. package/__app__/src/chunks/libs/@xstate/react.mjs +0 -3471
  151. package/__app__/src/chunks/libs/@xyflow/react.mjs +0 -7927
  152. package/__app__/src/chunks/libs/bezier-js.mjs +0 -1593
  153. package/__app__/src/chunks/libs/d3.mjs +0 -4531
  154. package/__app__/src/chunks/libs/framer.mjs +0 -11331
  155. package/__app__/src/chunks/libs/zod.mjs +0 -5404
  156. package/dist/chunks/libs/@chevrotain/types.d.mts +0 -111
  157. package/react/rolldown-runtime-DnkiqaRY.js +0 -1
@@ -1,4522 +0,0 @@
1
- import { i as __name } from "./rolldown-runtime.mjs";
2
- import { D as createReactComponent, F as t$6, M as t$8, O as t$7, _ as useStore, c as Markdown, y as useUpdateEffect } from "./hooks.mjs";
3
- import { Et as Paper, Lt as useMantineColorScheme, Mt as mergeThemeOverrides, Nt as createTheme, O as Menu, Pt as MantineProvider, Rt as MantineContext, X as Card, Y as Code, _ as SegmentedControl, in as useId$1$1, r as Title$1, u as Table, v as Tooltip, vt as ActionIcon, xt as Popover, zt as useMantineStyleNonce } from "./libs/@mantine.mjs";
4
- import { I as cx, L as css, N as token, _ as actionButtons, d as elementNodeData, f as elementNode, k as Box, m as edgeLabel, p as edgePath, u as elementShapeRecipe, v as actionBtn } from "./styled-system.mjs";
5
- import { _ as Position, a as Handle, b as getNodeDimensions, f as index, g as useStoreApi, h as useStore$1, i as EdgeLabelRenderer, m as useReactFlow, n as BackgroundVariant, t as Background$1 } from "./libs/@xyflow/react.mjs";
6
- import { n as shallowEqual, t as deepEqual } from "./libs/fast-equals.mjs";
7
- import { t as Bezier } from "./libs/bezier-js.mjs";
8
- import { r as atom } from "./libs/nanostores.mjs";
9
- import { f as LazyMotion, l as domMax, n as MotionButton, r as MotionDiv, u as MotionConfig } from "./libs/framer.mjs";
10
- import { createContext, forwardRef, memo, useContext, useEffect, useMemo, useRef, useState } from "react";
11
- import { c } from "react/compiler-runtime";
12
- import { Fragment as Fragment$1, jsx, jsxs } from "react/jsx-runtime";
13
- import { invariant, nonexhaustive } from "@likec4/core";
14
- import { BBox as BBox$1, vector } from "@likec4/core/geometry";
15
- import { invariant as invariant$1 } from "@likec4/core/utils";
16
- import { LikeC4Styles } from "@likec4/core/styles";
17
- import { RichText as RichText$1, ensureSizes as ensureSizes$1 } from "@likec4/core/types";
18
- //#region ../../node_modules/.pnpm/remeda@2.51.0/node_modules/remeda/dist/clamp.js
19
- function t$5(...t) {
20
- return t$6(n$3, t);
21
- }
22
- __name(t$5, "t");
23
- var n$3 = /* @__PURE__ */ __name((e, { min: t, max: n }) => t !== void 0 && e < t ? t : n !== void 0 && e > n ? n : e, "n");
24
- //#endregion
25
- //#region ../../node_modules/.pnpm/remeda@2.51.0/node_modules/remeda/dist/hasAtLeast.js
26
- function t$4(...t) {
27
- return t$6(n$2, t);
28
- }
29
- __name(t$4, "t");
30
- var n$2 = /* @__PURE__ */ __name((e, t) => e.length >= t, "n");
31
- //#endregion
32
- //#region ../../node_modules/.pnpm/remeda@2.51.0/node_modules/remeda/dist/entries.js
33
- function t$3(...t) {
34
- return t$6(Object.entries, t);
35
- }
36
- __name(t$3, "t");
37
- //#endregion
38
- //#region ../../node_modules/.pnpm/remeda@2.51.0/node_modules/remeda/dist/isArray.js
39
- function e$2(e) {
40
- return Array.isArray(e);
41
- }
42
- __name(e$2, "e");
43
- //#endregion
44
- //#region ../../node_modules/.pnpm/remeda@2.51.0/node_modules/remeda/dist/isNumber.js
45
- function e$1(e) {
46
- return typeof e == `number` && !Number.isNaN(e);
47
- }
48
- __name(e$1, "e");
49
- //#endregion
50
- //#region ../../node_modules/.pnpm/remeda@2.51.0/node_modules/remeda/dist/isTruthy.js
51
- function e(e) {
52
- return !!e;
53
- }
54
- //#endregion
55
- //#region ../../node_modules/.pnpm/remeda@2.51.0/node_modules/remeda/dist/join.js
56
- function t$2(...t) {
57
- return t$6(n$1, t);
58
- }
59
- __name(t$2, "t");
60
- var n$1 = /* @__PURE__ */ __name((e, t) => e.join(t), "n");
61
- //#endregion
62
- //#region ../../node_modules/.pnpm/remeda@2.51.0/node_modules/remeda/dist/pickBy.js
63
- function t$1(...t) {
64
- return t$6(n, t);
65
- }
66
- __name(t$1, "t");
67
- function n(e, t) {
68
- let n = {};
69
- for (let [r, i] of Object.entries(e)) t(i, r, e) && (n[r] = i);
70
- return n;
71
- }
72
- /**
73
- * @license @tabler/icons-react v3.49.0 - MIT
74
- *
75
- * This source code is licensed under the MIT license.
76
- * See the LICENSE file in the root directory of this source tree.
77
- */
78
- var IconBolt = createReactComponent("outline", "bolt", "Bolt", [["path", {
79
- "d": "M13 3l0 7l6 0l-8 11l0 -7l-6 0l8 -11",
80
- "key": "svg-0"
81
- }]]);
82
- /**
83
- * @license @tabler/icons-react v3.49.0 - MIT
84
- *
85
- * This source code is licensed under the MIT license.
86
- * See the LICENSE file in the root directory of this source tree.
87
- */
88
- var IconBrowser = createReactComponent("outline", "browser", "Browser", [
89
- ["path", {
90
- "d": "M4 8h16",
91
- "key": "svg-0"
92
- }],
93
- ["path", {
94
- "d": "M4 6a2 2 0 0 1 2 -2h12a2 2 0 0 1 2 2v12a2 2 0 0 1 -2 2h-12a2 2 0 0 1 -2 -2l0 -12",
95
- "key": "svg-1"
96
- }],
97
- ["path", {
98
- "d": "M8 4v4",
99
- "key": "svg-2"
100
- }]
101
- ]);
102
- /**
103
- * @license @tabler/icons-react v3.49.0 - MIT
104
- *
105
- * This source code is licensed under the MIT license.
106
- * See the LICENSE file in the root directory of this source tree.
107
- */
108
- var IconCylinder = createReactComponent("outline", "cylinder", "Cylinder", [["path", {
109
- "d": "M5 6a7 3 0 1 0 14 0a7 3 0 1 0 -14 0",
110
- "key": "svg-0"
111
- }], ["path", {
112
- "d": "M5 6v12c0 1.657 3.134 3 7 3s7 -1.343 7 -3v-12",
113
- "key": "svg-1"
114
- }]]);
115
- /**
116
- * @license @tabler/icons-react v3.49.0 - MIT
117
- *
118
- * This source code is licensed under the MIT license.
119
- * See the LICENSE file in the root directory of this source tree.
120
- */
121
- var IconDeviceMobile = createReactComponent("outline", "device-mobile", "DeviceMobile", [
122
- ["path", {
123
- "d": "M6 5a2 2 0 0 1 2 -2h8a2 2 0 0 1 2 2v14a2 2 0 0 1 -2 2h-8a2 2 0 0 1 -2 -2v-14",
124
- "key": "svg-0"
125
- }],
126
- ["path", {
127
- "d": "M11 4h2",
128
- "key": "svg-1"
129
- }],
130
- ["path", {
131
- "d": "M12 17v.01",
132
- "key": "svg-2"
133
- }]
134
- ]);
135
- /**
136
- * @license @tabler/icons-react v3.49.0 - MIT
137
- *
138
- * This source code is licensed under the MIT license.
139
- * See the LICENSE file in the root directory of this source tree.
140
- */
141
- var IconFileText = createReactComponent("outline", "file-text", "FileText", [
142
- ["path", {
143
- "d": "M14 3v4a1 1 0 0 0 1 1h4",
144
- "key": "svg-0"
145
- }],
146
- ["path", {
147
- "d": "M17 21h-10a2 2 0 0 1 -2 -2v-14a2 2 0 0 1 2 -2h7l5 5v11a2 2 0 0 1 -2 2",
148
- "key": "svg-1"
149
- }],
150
- ["path", {
151
- "d": "M9 9l1 0",
152
- "key": "svg-2"
153
- }],
154
- ["path", {
155
- "d": "M9 13l6 0",
156
- "key": "svg-3"
157
- }],
158
- ["path", {
159
- "d": "M9 17l6 0",
160
- "key": "svg-4"
161
- }]
162
- ]);
163
- /**
164
- * @license @tabler/icons-react v3.49.0 - MIT
165
- *
166
- * This source code is licensed under the MIT license.
167
- * See the LICENSE file in the root directory of this source tree.
168
- */
169
- var IconRectangularPrism = createReactComponent("outline", "rectangular-prism", "RectangularPrism", [
170
- ["path", {
171
- "d": "M21 14.008v-5.018a1.98 1.98 0 0 0 -1 -1.717l-4 -2.008a2.016 2.016 0 0 0 -2 0l-10 5.008c-.619 .355 -1 1.01 -1 1.718v5.018c0 .709 .381 1.363 1 1.717l4 2.008a2.016 2.016 0 0 0 2 0l10 -5.008c.619 -.355 1 -1.01 1 -1.718",
172
- "key": "svg-0"
173
- }],
174
- ["path", {
175
- "d": "M9 21v-7.5",
176
- "key": "svg-1"
177
- }],
178
- ["path", {
179
- "d": "M9 13.5l11.5 -5.5",
180
- "key": "svg-2"
181
- }],
182
- ["path", {
183
- "d": "M3.5 11l5.5 2.5",
184
- "key": "svg-3"
185
- }]
186
- ]);
187
- /**
188
- * @license @tabler/icons-react v3.49.0 - MIT
189
- *
190
- * This source code is licensed under the MIT license.
191
- * See the LICENSE file in the root directory of this source tree.
192
- */
193
- var IconReorder = createReactComponent("outline", "reorder", "Reorder", [
194
- ["path", {
195
- "d": "M3 16a1 1 0 0 1 1 -1h2a1 1 0 0 1 1 1v2a1 1 0 0 1 -1 1h-2a1 1 0 0 1 -1 -1l0 -2",
196
- "key": "svg-0"
197
- }],
198
- ["path", {
199
- "d": "M10 16a1 1 0 0 1 1 -1h2a1 1 0 0 1 1 1v2a1 1 0 0 1 -1 1h-2a1 1 0 0 1 -1 -1l0 -2",
200
- "key": "svg-1"
201
- }],
202
- ["path", {
203
- "d": "M17 16a1 1 0 0 1 1 -1h2a1 1 0 0 1 1 1v2a1 1 0 0 1 -1 1h-2a1 1 0 0 1 -1 -1l0 -2",
204
- "key": "svg-2"
205
- }],
206
- ["path", {
207
- "d": "M5 11v-3a3 3 0 0 1 3 -3h8a3 3 0 0 1 3 3v3",
208
- "key": "svg-3"
209
- }],
210
- ["path", {
211
- "d": "M16.5 8.5l2.5 2.5l2.5 -2.5",
212
- "key": "svg-4"
213
- }]
214
- ]);
215
- /**
216
- * @license @tabler/icons-react v3.49.0 - MIT
217
- *
218
- * This source code is licensed under the MIT license.
219
- * See the LICENSE file in the root directory of this source tree.
220
- */
221
- var IconRobot = createReactComponent("outline", "robot", "Robot", [
222
- ["path", {
223
- "d": "M6 6a2 2 0 0 1 2 -2h8a2 2 0 0 1 2 2v4a2 2 0 0 1 -2 2h-8a2 2 0 0 1 -2 -2l0 -4",
224
- "key": "svg-0"
225
- }],
226
- ["path", {
227
- "d": "M12 2v2",
228
- "key": "svg-1"
229
- }],
230
- ["path", {
231
- "d": "M9 12v9",
232
- "key": "svg-2"
233
- }],
234
- ["path", {
235
- "d": "M15 12v9",
236
- "key": "svg-3"
237
- }],
238
- ["path", {
239
- "d": "M5 16l4 -2",
240
- "key": "svg-4"
241
- }],
242
- ["path", {
243
- "d": "M15 14l4 2",
244
- "key": "svg-5"
245
- }],
246
- ["path", {
247
- "d": "M9 18h6",
248
- "key": "svg-6"
249
- }],
250
- ["path", {
251
- "d": "M10 8v.01",
252
- "key": "svg-7"
253
- }],
254
- ["path", {
255
- "d": "M14 8v.01",
256
- "key": "svg-8"
257
- }]
258
- ]);
259
- /**
260
- * @license @tabler/icons-react v3.49.0 - MIT
261
- *
262
- * This source code is licensed under the MIT license.
263
- * See the LICENSE file in the root directory of this source tree.
264
- */
265
- var IconUser = createReactComponent("outline", "user", "User", [["path", {
266
- "d": "M8 7a4 4 0 1 0 8 0a4 4 0 0 0 -8 0",
267
- "key": "svg-0"
268
- }], ["path", {
269
- "d": "M6 21v-2a4 4 0 0 1 4 -4h4a4 4 0 0 1 4 4v2",
270
- "key": "svg-1"
271
- }]]);
272
- /**
273
- * @license @tabler/icons-react v3.49.0 - MIT
274
- *
275
- * This source code is licensed under the MIT license.
276
- * See the LICENSE file in the root directory of this source tree.
277
- */
278
- var IconZoomScan = createReactComponent("outline", "zoom-scan", "ZoomScan", [
279
- ["path", {
280
- "d": "M8 11a3 3 0 1 0 6 0a3 3 0 0 0 -6 0",
281
- "key": "svg-0"
282
- }],
283
- ["path", {
284
- "d": "M16 16l-2.5 -2.5",
285
- "key": "svg-1"
286
- }],
287
- ["path", {
288
- "d": "M3 7v-2a2 2 0 0 1 2 -2h2",
289
- "key": "svg-2"
290
- }],
291
- ["path", {
292
- "d": "M3 17v2a2 2 0 0 0 2 2h2",
293
- "key": "svg-3"
294
- }],
295
- ["path", {
296
- "d": "M17 3h2a2 2 0 0 1 2 2v2",
297
- "key": "svg-4"
298
- }],
299
- ["path", {
300
- "d": "M17 21h2a2 2 0 0 0 2 -2v-2",
301
- "key": "svg-5"
302
- }]
303
- ]);
304
- //#endregion
305
- //#region ../diagram/src/context/IconRenderer.tsx
306
- var IconRendererContext = createContext(null);
307
- /**
308
- * Provider for custom element icon renderers
309
- *
310
- * @example
311
- * ```tsx
312
- * const MyIconRenderer: ElementIconRenderer = ({ node }) => {
313
- * return <div>{node.title}</div>
314
- * }
315
- *
316
- * <IconRendererProvider value={MyIconRenderer}>
317
- * <LikeC4Diagram />
318
- * </IconRendererProvider>
319
- * ```
320
- */
321
- function IconRendererProvider(t0) {
322
- const $ = c(5);
323
- const { value, children } = t0;
324
- if (useContext(IconRendererContext)) {
325
- let t1;
326
- if ($[0] !== children) {
327
- t1 = /* @__PURE__ */ jsx(Fragment$1, { children });
328
- $[0] = children;
329
- $[1] = t1;
330
- } else t1 = $[1];
331
- return t1;
332
- }
333
- let t1;
334
- if ($[2] !== children || $[3] !== value) {
335
- t1 = /* @__PURE__ */ jsx(IconRendererContext.Provider, {
336
- value,
337
- children
338
- });
339
- $[2] = children;
340
- $[3] = value;
341
- $[4] = t1;
342
- } else t1 = $[4];
343
- return t1;
344
- }
345
- function IconRenderer({ element, className, style }) {
346
- const RenderIcon = useContext(IconRendererContext);
347
- if (!element || !element.icon || element.icon === "none") return null;
348
- let icon;
349
- switch (true) {
350
- case element.icon.startsWith("data:image/svg+xml"):
351
- icon = /* @__PURE__ */ jsx(SvgDataUrlIcon, {
352
- dataUrl: element.icon,
353
- alt: element.title
354
- });
355
- break;
356
- case element.icon.startsWith("http://"):
357
- case element.icon.startsWith("https://"):
358
- case element.icon.startsWith("data:image"):
359
- icon = /* @__PURE__ */ jsx("img", {
360
- src: element.icon,
361
- alt: element.title
362
- });
363
- break;
364
- case !!RenderIcon:
365
- icon = /* @__PURE__ */ jsx(RenderIcon, { node: element });
366
- break;
367
- default: icon = /* @__PURE__ */ jsx(DefaultIconRenderer, { node: element });
368
- }
369
- if (!icon) return null;
370
- return /* @__PURE__ */ jsx("div", {
371
- className: cx(className, "likec4-element-icon"),
372
- "data-likec4-icon": element.icon,
373
- style,
374
- children: icon
375
- });
376
- }
377
- var ShapeIcons = {
378
- browser: IconBrowser,
379
- cylinder: IconCylinder,
380
- mobile: IconDeviceMobile,
381
- person: IconUser,
382
- queue: IconReorder,
383
- rectangle: IconRectangularPrism,
384
- storage: IconCylinder,
385
- bucket: IconCylinder,
386
- document: IconFileText,
387
- component: IconRectangularPrism,
388
- agent: IconRobot
389
- };
390
- function IconOrShapeRenderer(t0) {
391
- const $ = c(12);
392
- const { element, className, style } = t0;
393
- if (!element.icon || element.icon === "none") {
394
- const ShapeIcon = ShapeIcons[element.shape];
395
- let t1;
396
- if ($[0] !== className) {
397
- t1 = cx(className, "likec4-shape-icon");
398
- $[0] = className;
399
- $[1] = t1;
400
- } else t1 = $[1];
401
- let t2;
402
- if ($[2] !== ShapeIcon) {
403
- t2 = /* @__PURE__ */ jsx(ShapeIcon, {});
404
- $[2] = ShapeIcon;
405
- $[3] = t2;
406
- } else t2 = $[3];
407
- let t3;
408
- if ($[4] !== style || $[5] !== t1 || $[6] !== t2) {
409
- t3 = /* @__PURE__ */ jsx("div", {
410
- className: t1,
411
- style,
412
- children: t2
413
- });
414
- $[4] = style;
415
- $[5] = t1;
416
- $[6] = t2;
417
- $[7] = t3;
418
- } else t3 = $[7];
419
- return t3;
420
- }
421
- let t1;
422
- if ($[8] !== className || $[9] !== element || $[10] !== style) {
423
- t1 = /* @__PURE__ */ jsx(IconRenderer, {
424
- element,
425
- className,
426
- style
427
- });
428
- $[8] = className;
429
- $[9] = element;
430
- $[10] = style;
431
- $[11] = t1;
432
- } else t1 = $[11];
433
- return t1;
434
- }
435
- function SvgDataUrlIcon(t0) {
436
- const $ = c(11);
437
- const { dataUrl, alt } = t0;
438
- if (!hasCurrentColorReference(dataUrl)) {
439
- let t1;
440
- if ($[0] !== alt || $[1] !== dataUrl) {
441
- t1 = /* @__PURE__ */ jsx("img", {
442
- src: dataUrl,
443
- alt
444
- });
445
- $[0] = alt;
446
- $[1] = dataUrl;
447
- $[2] = t1;
448
- } else t1 = $[2];
449
- return t1;
450
- }
451
- let t1;
452
- if ($[3] !== dataUrl) {
453
- t1 = JSON.stringify(dataUrl);
454
- $[3] = dataUrl;
455
- $[4] = t1;
456
- } else t1 = $[4];
457
- const maskUrl = `url(${t1})`;
458
- const t2 = alt ? "img" : void 0;
459
- let t3;
460
- if ($[5] !== maskUrl) {
461
- t3 = {
462
- display: "inline-block",
463
- width: "100%",
464
- height: "100%",
465
- backgroundColor: "currentColor",
466
- maskImage: maskUrl,
467
- maskRepeat: "no-repeat",
468
- maskPosition: "center",
469
- maskSize: "contain",
470
- WebkitMaskImage: maskUrl,
471
- WebkitMaskRepeat: "no-repeat",
472
- WebkitMaskPosition: "center",
473
- WebkitMaskSize: "contain"
474
- };
475
- $[5] = maskUrl;
476
- $[6] = t3;
477
- } else t3 = $[6];
478
- let t4;
479
- if ($[7] !== alt || $[8] !== t2 || $[9] !== t3) {
480
- t4 = /* @__PURE__ */ jsx("span", {
481
- role: t2,
482
- "aria-label": alt,
483
- style: t3
484
- });
485
- $[7] = alt;
486
- $[8] = t2;
487
- $[9] = t3;
488
- $[10] = t4;
489
- } else t4 = $[10];
490
- return t4;
491
- }
492
- function hasCurrentColorReference(dataUrl) {
493
- return /currentcolor/i.test(decodeSvgDataUrl(dataUrl) ?? "");
494
- }
495
- function decodeSvgDataUrl(dataUrl) {
496
- if (!dataUrl.startsWith("data:image/svg+xml")) return null;
497
- try {
498
- const comma = dataUrl.indexOf(",");
499
- if (comma === -1) return null;
500
- const payload = dataUrl.slice(comma + 1);
501
- if (dataUrl.slice(0, comma).endsWith(";base64")) return new TextDecoder().decode(Uint8Array.from(atob(payload), (c) => c.charCodeAt(0)));
502
- try {
503
- return decodeURIComponent(payload);
504
- } catch {
505
- return payload;
506
- }
507
- } catch {
508
- return null;
509
- }
510
- }
511
- var iconUrl = (group, name) => `https://icons.like-c4.dev/${encodeURIComponent(group)}/${encodeURIComponent(name)}.svg`;
512
- function BootstrapIconMask(t0) {
513
- const $ = c(11);
514
- let name;
515
- let props;
516
- if ($[0] !== t0) {
517
- ({name, ...props} = t0);
518
- $[0] = t0;
519
- $[1] = name;
520
- $[2] = props;
521
- } else {
522
- name = $[1];
523
- props = $[2];
524
- }
525
- let t1;
526
- if ($[3] !== name) {
527
- t1 = iconUrl("bootstrap", name);
528
- $[3] = name;
529
- $[4] = t1;
530
- } else t1 = $[4];
531
- const url = t1;
532
- const t2 = `url("${url}")`;
533
- const t3 = `url("${url}")`;
534
- let t4;
535
- if ($[5] !== t2 || $[6] !== t3) {
536
- t4 = {
537
- display: "inline-block",
538
- width: "100%",
539
- height: "100%",
540
- backgroundColor: "currentColor",
541
- maskImage: t2,
542
- maskRepeat: "no-repeat",
543
- maskPosition: "center",
544
- maskSize: "contain",
545
- WebkitMaskImage: t3,
546
- WebkitMaskRepeat: "no-repeat",
547
- WebkitMaskPosition: "center",
548
- WebkitMaskSize: "contain"
549
- };
550
- $[5] = t2;
551
- $[6] = t3;
552
- $[7] = t4;
553
- } else t4 = $[7];
554
- const style = t4;
555
- let t5;
556
- if ($[8] !== props || $[9] !== style) {
557
- t5 = /* @__PURE__ */ jsx("span", {
558
- ...props,
559
- "aria-hidden": "true",
560
- style
561
- });
562
- $[8] = props;
563
- $[9] = style;
564
- $[10] = t5;
565
- } else t5 = $[10];
566
- return t5;
567
- }
568
- function DefaultIconRenderer(t0) {
569
- const $ = c(11);
570
- let node;
571
- let props;
572
- if ($[0] !== t0) {
573
- ({node, ...props} = t0);
574
- $[0] = t0;
575
- $[1] = node;
576
- $[2] = props;
577
- } else {
578
- node = $[1];
579
- props = $[2];
580
- }
581
- if (!node.icon || node.icon === "none") return null;
582
- const t1 = node.icon;
583
- let t2;
584
- let t3;
585
- let t4;
586
- if ($[3] !== node.icon || $[4] !== props) {
587
- t4 = Symbol.for("react.early_return_sentinel");
588
- bb0: {
589
- const [group, name, ...rest] = t1.split(":");
590
- if (!group || !name || rest.length > 0) {
591
- t4 = null;
592
- break bb0;
593
- }
594
- if (group === "bootstrap") {
595
- t4 = /* @__PURE__ */ jsx(BootstrapIconMask, {
596
- ...props,
597
- name
598
- });
599
- break bb0;
600
- }
601
- t2 = props;
602
- t3 = iconUrl(group, name);
603
- }
604
- $[3] = node.icon;
605
- $[4] = props;
606
- $[5] = t2;
607
- $[6] = t3;
608
- $[7] = t4;
609
- } else {
610
- t2 = $[5];
611
- t3 = $[6];
612
- t4 = $[7];
613
- }
614
- if (t4 !== Symbol.for("react.early_return_sentinel")) return t4;
615
- let t5;
616
- if ($[8] !== t2 || $[9] !== t3) {
617
- t5 = /* @__PURE__ */ jsx("img", {
618
- ...t2,
619
- src: t3
620
- });
621
- $[8] = t2;
622
- $[9] = t3;
623
- $[10] = t5;
624
- } else t5 = $[10];
625
- return t5;
626
- }
627
- //#endregion
628
- //#region ../diagram/src/base/const.ts
629
- var ZIndexes = {
630
- Compound: 1,
631
- Edge: 20,
632
- EdgeLabel: 25,
633
- Element: 20,
634
- Max: 30
635
- };
636
- var MinZoom = .05;
637
- var FitViewPaddings = {
638
- default: "16px",
639
- withControls: {
640
- top: "58px",
641
- left: "16px",
642
- right: "16px",
643
- bottom: "16px"
644
- }
645
- };
646
- var IS_SERVER = typeof window === "undefined";
647
- //#endregion
648
- //#region ../diagram/src/base/Background.tsx
649
- function literalToEnum(value) {
650
- switch (value) {
651
- case "dots": return BackgroundVariant.Dots;
652
- case "lines": return BackgroundVariant.Lines;
653
- case "cross": return BackgroundVariant.Cross;
654
- default: nonexhaustive(value);
655
- }
656
- }
657
- var compareProps = (prev, next) => {
658
- if (typeof prev.background === "string" && typeof next.background === "string") return prev.background === next.background;
659
- return deepEqual(prev.background, next.background);
660
- };
661
- var Background = memo((t0) => {
662
- const $ = c(6);
663
- const { background } = t0;
664
- if (typeof background === "string") {
665
- let t1;
666
- if ($[0] !== background) {
667
- t1 = literalToEnum(background);
668
- $[0] = background;
669
- $[1] = t1;
670
- } else t1 = $[1];
671
- let t2;
672
- if ($[2] !== t1) {
673
- t2 = /* @__PURE__ */ jsx(Background$1, {
674
- variant: t1,
675
- size: 2,
676
- gap: 20
677
- });
678
- $[2] = t1;
679
- $[3] = t2;
680
- } else t2 = $[3];
681
- return t2;
682
- }
683
- let t1;
684
- if ($[4] !== background) {
685
- t1 = /* @__PURE__ */ jsx(Background$1, { ...background });
686
- $[4] = background;
687
- $[5] = t1;
688
- } else t1 = $[5];
689
- return t1;
690
- }, compareProps);
691
- Background.displayName = "Background";
692
- //#endregion
693
- //#region ../diagram/src/hooks/useCallbackRef.ts
694
- /**
695
- * Memoizes a callback function so that it will not be recreated on every render.
696
- * The returned function is guaranteed to be the same reference across renders.
697
- * @param callback the callback function to memoize
698
- * @returns the memoized callback function
699
- */
700
- function useCallbackRef(callback) {
701
- const ref = useRef(callback);
702
- ref.current = callback;
703
- return useMemo(() => {
704
- function callbackRef(...args) {
705
- return ref.current?.(...args);
706
- }
707
- return callbackRef;
708
- }, []);
709
- }
710
- //#endregion
711
- //#region ../diagram/src/hooks/useXYFlow.ts
712
- function useXYFlow() {
713
- return useReactFlow();
714
- }
715
- function useXYStore(selector, equalityFn) {
716
- return useStore$1(selector, equalityFn ?? shallowEqual);
717
- }
718
- function selectXYStore(selector) {
719
- return selector;
720
- }
721
- function useXYStoreApi() {
722
- return useStoreApi();
723
- }
724
- function useCurrentZoomAtLeast(minZoom) {
725
- const $ = c(2);
726
- let t0;
727
- if ($[0] !== minZoom) {
728
- t0 = (state) => state.transform[2] >= minZoom;
729
- $[0] = minZoom;
730
- $[1] = t0;
731
- } else t0 = $[1];
732
- return useStore$1(t0);
733
- }
734
- var selectZoom = (state) => state.transform[2] < .2;
735
- function useIsZoomTooSmall() {
736
- return useStore$1(selectZoom);
737
- }
738
- //#endregion
739
- //#region ../diagram/src/utils/roundDpr.ts
740
- /**
741
- * Returns the current device pixel ratio (DPR) given the passed options
742
- *
743
- * @param options
744
- * @returns current device pixel ratio
745
- */
746
- function getDevicePixelRatio() {
747
- const dpr = typeof window !== "undefined" && typeof window.devicePixelRatio === "number" ? window.devicePixelRatio : 1;
748
- return t$5(Math.floor(dpr), {
749
- min: 1,
750
- max: 4
751
- });
752
- }
753
- var knownDpr;
754
- function roundDpr(v) {
755
- knownDpr ??= getDevicePixelRatio();
756
- if (knownDpr < 2) return Math.round(v);
757
- return Math.round(v * knownDpr) / knownDpr;
758
- }
759
- //#endregion
760
- //#region ../diagram/src/utils/xyflow.ts
761
- function isEqualRects(a, b) {
762
- return Math.trunc(a.x) === Math.trunc(b.x) && Math.trunc(a.y) === Math.trunc(b.y) && Math.trunc(a.width) === Math.trunc(b.width) && Math.trunc(a.height) === Math.trunc(b.height);
763
- }
764
- function isLeafNodeType(type) {
765
- return type !== "compound-element" && type !== "compound-deployment" && type !== "view-group";
766
- }
767
- function leafNodeRects(nodes) {
768
- const rects = [];
769
- for (const node of nodes) if (isLeafNodeType(node.type)) rects.push(nodeToRect(node));
770
- return rects;
771
- }
772
- function nodeToRect(nd) {
773
- return {
774
- x: Math.trunc(nd.internals.positionAbsolute.x),
775
- y: Math.trunc(nd.internals.positionAbsolute.y),
776
- width: Math.round(nd.measured?.width ?? nd.width ?? nd.initialWidth ?? 0),
777
- height: Math.round(nd.measured?.height ?? nd.height ?? nd.initialHeight ?? 0)
778
- };
779
- }
780
- function getNodeCenter(node) {
781
- const { width, height } = getNodeDimensions(node);
782
- const { x, y } = node.internals.positionAbsolute;
783
- return {
784
- x: Math.round(x + width / 2),
785
- y: Math.round(y + height / 2)
786
- };
787
- }
788
- /**
789
- * Helper function returns the intersection point
790
- * of the line between the center of the intersectionNode and the target
791
- *
792
- * @param intersectionNode the node that is the center of the line
793
- * @param target position of the target
794
- * @param nodeMargin the margin of the intersectionNode. The point will be placed at nodeMargin distance from the border of the node
795
- * @returns coordinates of the intersection point
796
- */
797
- function getNodeIntersectionFromCenterToPoint(intersectionNode, target, nodeMargin = 0) {
798
- const { width, height } = intersectionNode;
799
- const nodeCenter = BBox$1.center(intersectionNode);
800
- const v = vector(target.x, target.y).subtract(nodeCenter);
801
- const xScale = (nodeMargin + width / 2) / v.x;
802
- const yScale = (nodeMargin + height / 2) / v.y;
803
- const scale = Math.min(Math.abs(xScale), Math.abs(yScale));
804
- return vector(v).multiply(scale).add(nodeCenter).trunc().toObject();
805
- }
806
- function bezierControlPoints(points) {
807
- let [start, ...bezierPoints] = points;
808
- invariant$1(start, "start should be defined");
809
- const handles = [];
810
- while (t$4(bezierPoints, 3)) {
811
- const [cp1, cp2, end, ...rest] = bezierPoints;
812
- const bezier = new Bezier(start[0], start[1], cp1[0], cp1[1], cp2[0], cp2[1], end[0], end[1]);
813
- const inflections = bezier.inflections();
814
- if (inflections.length === 0) inflections.push(.5);
815
- inflections.forEach((t) => {
816
- const { x, y } = bezier.get(t);
817
- handles.push({
818
- x: Math.trunc(x),
819
- y: Math.trunc(y)
820
- });
821
- });
822
- bezierPoints = rest;
823
- start = end;
824
- }
825
- invariant$1(bezierPoints.length === 0, "all points should be consumed");
826
- invariant$1(t$4(handles, 1), "at least one control point should be generated");
827
- return handles;
828
- }
829
- /**
830
- * Checks if two points are the same, considering both XYPoint (object ) and Point (tuple) formats.
831
- * @returns `true` If points are within 2px
832
- */
833
- function isSamePoint(a, b) {
834
- if (a === b) return true;
835
- const [ax, ay] = e$2(a) ? a : [a.x, a.y];
836
- const [bx, by] = e$2(b) ? b : [b.x, b.y];
837
- return Math.hypot(bx - ax, by - ay) < 2.1;
838
- }
839
- function stopPropagation(e) {
840
- e.nativeEvent.stopImmediatePropagation();
841
- e.stopPropagation();
842
- }
843
- var printPoint = (point) => {
844
- return `${Math.trunc(point[0])},${Math.trunc(point[1])}`;
845
- };
846
- function bezierPath(bezierSpline) {
847
- let [start, ...points] = bezierSpline;
848
- invariant$1(start, "start should be defined");
849
- let path = `M ${printPoint(start)}`;
850
- while (t$4(points, 3)) {
851
- const [cp1, cp2, end, ...rest] = points;
852
- path = path + ` C ${printPoint(cp1)} ${printPoint(cp2)} ${printPoint(end)}`;
853
- points = rest;
854
- }
855
- invariant$1(points.length === 0, "all points should be consumed");
856
- return path;
857
- }
858
- /**
859
- * Parses a single padding value to a number
860
- * @internal
861
- * @param padding - Padding to parse
862
- * @param viewport - Width or height of the viewport
863
- * @returns The padding in pixels
864
- */
865
- function parsePadding(padding, viewport) {
866
- if (typeof padding === "number") return Math.floor((viewport - viewport / (1 + padding)) * .5);
867
- if (typeof padding === "string" && padding.endsWith("px")) {
868
- const paddingValue = parseFloat(padding);
869
- if (!Number.isNaN(paddingValue)) return Math.floor(paddingValue);
870
- }
871
- if (typeof padding === "string" && padding.endsWith("%")) {
872
- const paddingValue = parseFloat(padding);
873
- if (!Number.isNaN(paddingValue)) return Math.floor(viewport * paddingValue * .01);
874
- }
875
- console.error(`[React Flow] The padding value "${padding}" is invalid. Please provide a number or a string with a valid unit (px or %).`);
876
- return 0;
877
- }
878
- /**
879
- * Parses the paddings to an object with top, right, bottom, left, x and y paddings
880
- * @internal
881
- * @param padding - Padding to parse
882
- * @param width - Width of the viewport
883
- * @param height - Height of the viewport
884
- * @returns An object with the paddings in pixels
885
- */
886
- function parsePaddings(padding, width, height) {
887
- if (typeof padding === "string" || typeof padding === "number") {
888
- const paddingY = parsePadding(padding, height);
889
- const paddingX = parsePadding(padding, width);
890
- return {
891
- top: paddingY,
892
- right: paddingX,
893
- bottom: paddingY,
894
- left: paddingX,
895
- x: paddingX * 2,
896
- y: paddingY * 2
897
- };
898
- }
899
- if (typeof padding === "object") {
900
- const top = parsePadding(padding.top ?? padding.y ?? 0, height);
901
- const bottom = parsePadding(padding.bottom ?? padding.y ?? 0, height);
902
- const left = parsePadding(padding.left ?? padding.x ?? 0, width);
903
- const right = parsePadding(padding.right ?? padding.x ?? 0, width);
904
- return {
905
- top,
906
- right,
907
- bottom,
908
- left,
909
- x: left + right,
910
- y: top + bottom
911
- };
912
- }
913
- return {
914
- top: 0,
915
- right: 0,
916
- bottom: 0,
917
- left: 0,
918
- x: 0,
919
- y: 0
920
- };
921
- }
922
- //#endregion
923
- //#region ../diagram/src/base/Base.ts
924
- var mergeData = (v, data) => Object.assign({}, v, { data: Object.assign({}, v.data, data) });
925
- var _setDimmed = (v, dimmed) => (v.data.dimmed ?? false) === dimmed ? v : mergeData(v, { dimmed });
926
- function setDimmed(arg1, arg2) {
927
- if (arg2 !== void 0) return _setDimmed(arg1, arg2);
928
- return (v) => _setDimmed(v, arg1);
929
- }
930
- var _setHovered = (v, hovered) => (v.data.hovered ?? false) === hovered ? v : mergeData(v, { hovered });
931
- function setHovered(arg1, arg2) {
932
- if (arg2 !== void 0) return _setHovered(arg1, arg2);
933
- return (v) => _setHovered(v, arg1);
934
- }
935
- function hasSubObject(value, subobl) {
936
- return value === subobl || t$3(subobl).every(([key, v]) => deepEqual(value[key] ?? void 0, v));
937
- }
938
- function _setData(value, data) {
939
- if (hasSubObject(value.data, data)) return value;
940
- return mergeData(value, data);
941
- }
942
- function setData(arg1, arg2) {
943
- if (arg2 !== void 0) return _setData(arg1, arg2);
944
- return (edge) => _setData(edge, arg1);
945
- }
946
- var Base = {
947
- setDimmed,
948
- setHovered,
949
- setData
950
- };
951
- //#endregion
952
- //#region ../diagram/src/base/keyboardZoom.ts
953
- function isEditableKeyboardTarget(target) {
954
- if (!(target instanceof HTMLElement)) return false;
955
- const tagName = target.tagName.toLowerCase();
956
- return tagName === "input" || tagName === "textarea" || tagName === "select" || target.isContentEditable;
957
- }
958
- function getKeyboardZoomAction(event) {
959
- if (!event.ctrlKey && !event.metaKey || isEditableKeyboardTarget(event.target)) return null;
960
- switch (event.key) {
961
- case "+":
962
- case "=": return "zoom-in";
963
- case "-":
964
- case "_": return "zoom-out";
965
- case "0": return "reset";
966
- default: return null;
967
- }
968
- }
969
- //#endregion
970
- //#region ../diagram/src/base/BaseXYFlow.tsx
971
- var likec4AriaLabelConfig = {
972
- "node.a11yDescription.default": "Press Enter or Space to select this node and reveal its actions.",
973
- "node.a11yDescription.keyboardDisabled": "Keyboard activation is disabled.",
974
- "edge.a11yDescription.default": "Press Enter or Space to select this relationship and reveal its actions."
975
- };
976
- function activateFocusedElement(event) {
977
- if (event.repeat || event.key !== "Enter" && event.key !== " ") return;
978
- const target = event.target;
979
- if (!(target instanceof Element)) return;
980
- const interactive = target.closest("a,button,input,textarea,select,[role=\"button\"],[role=\"link\"],[contenteditable=\"true\"]");
981
- if (interactive && !interactive.classList.contains("react-flow__node") && !interactive.classList.contains("react-flow__edge")) return;
982
- const flowElement = target.closest(".react-flow__node[data-id], .react-flow__edge[data-id]");
983
- const view = flowElement?.ownerDocument.defaultView;
984
- if (!flowElement || !view) return;
985
- event.preventDefault();
986
- const rect = flowElement.getBoundingClientRect();
987
- flowElement.dispatchEvent(new view.MouseEvent("click", {
988
- bubbles: true,
989
- cancelable: true,
990
- button: 0,
991
- clientX: rect.left + rect.width / 2,
992
- clientY: rect.top + rect.height / 2,
993
- detail: 1,
994
- view
995
- }));
996
- }
997
- function BaseXYFlow(t0) {
998
- const $ = c(107);
999
- let ariaLabelConfig;
1000
- let children;
1001
- let className;
1002
- let colorMode;
1003
- let edges;
1004
- let nodes;
1005
- let onEdgeMouseEnter;
1006
- let onEdgeMouseLeave;
1007
- let onEdgesChange;
1008
- let onKeyDownCapture;
1009
- let onMoveEnd;
1010
- let onNodeMouseEnter;
1011
- let onNodeMouseLeave;
1012
- let onNodesChange;
1013
- let onViewportResize;
1014
- let props;
1015
- let t1;
1016
- let t10;
1017
- let t11;
1018
- let t12;
1019
- let t2;
1020
- let t3;
1021
- let t4;
1022
- let t5;
1023
- let t6;
1024
- let t7;
1025
- let t8;
1026
- let t9;
1027
- if ($[0] !== t0) {
1028
- ({nodes, edges, onEdgesChange, onNodesChange, className, pannable: t1, zoomable: t2, nodesSelectable: t3, nodesDraggable: t4, background: t5, children, colorMode, fitViewPadding: t6, zoomOnDoubleClick: t7, onViewportResize, onMoveEnd, onNodeMouseEnter, onNodeMouseLeave, onEdgeMouseEnter, onEdgeMouseLeave, onKeyDownCapture, ariaLabelConfig, nodesFocusable: t8, edgesFocusable: t9, showControls: t10, minZoom: t11, maxZoom: t12, ...props} = t0);
1029
- $[0] = t0;
1030
- $[1] = ariaLabelConfig;
1031
- $[2] = children;
1032
- $[3] = className;
1033
- $[4] = colorMode;
1034
- $[5] = edges;
1035
- $[6] = nodes;
1036
- $[7] = onEdgeMouseEnter;
1037
- $[8] = onEdgeMouseLeave;
1038
- $[9] = onEdgesChange;
1039
- $[10] = onKeyDownCapture;
1040
- $[11] = onMoveEnd;
1041
- $[12] = onNodeMouseEnter;
1042
- $[13] = onNodeMouseLeave;
1043
- $[14] = onNodesChange;
1044
- $[15] = onViewportResize;
1045
- $[16] = props;
1046
- $[17] = t1;
1047
- $[18] = t10;
1048
- $[19] = t11;
1049
- $[20] = t12;
1050
- $[21] = t2;
1051
- $[22] = t3;
1052
- $[23] = t4;
1053
- $[24] = t5;
1054
- $[25] = t6;
1055
- $[26] = t7;
1056
- $[27] = t8;
1057
- $[28] = t9;
1058
- } else {
1059
- ariaLabelConfig = $[1];
1060
- children = $[2];
1061
- className = $[3];
1062
- colorMode = $[4];
1063
- edges = $[5];
1064
- nodes = $[6];
1065
- onEdgeMouseEnter = $[7];
1066
- onEdgeMouseLeave = $[8];
1067
- onEdgesChange = $[9];
1068
- onKeyDownCapture = $[10];
1069
- onMoveEnd = $[11];
1070
- onNodeMouseEnter = $[12];
1071
- onNodeMouseLeave = $[13];
1072
- onNodesChange = $[14];
1073
- onViewportResize = $[15];
1074
- props = $[16];
1075
- t1 = $[17];
1076
- t10 = $[18];
1077
- t11 = $[19];
1078
- t12 = $[20];
1079
- t2 = $[21];
1080
- t3 = $[22];
1081
- t4 = $[23];
1082
- t5 = $[24];
1083
- t6 = $[25];
1084
- t7 = $[26];
1085
- t8 = $[27];
1086
- t9 = $[28];
1087
- }
1088
- const pannable = t1 === void 0 ? true : t1;
1089
- const zoomable = t2 === void 0 ? true : t2;
1090
- const nodesSelectable = t3 === void 0 ? true : t3;
1091
- const nodesDraggable = t4 === void 0 ? false : t4;
1092
- const background = t5 === void 0 ? "dots" : t5;
1093
- const fitViewPadding = t6 === void 0 ? 0 : t6;
1094
- const zoomOnDoubleClick = t7 === void 0 ? false : t7;
1095
- const nodesFocusable = t8 === void 0 ? nodesDraggable || nodesSelectable : t8;
1096
- const edgesFocusable = t9 === void 0 ? false : t9;
1097
- const minZoom = t11 === void 0 ? MinZoom : t11;
1098
- const maxZoom = t12 === void 0 ? 3 : t12;
1099
- const t13 = Math.min(maxZoom, 1);
1100
- let t14;
1101
- if ($[29] !== fitViewPadding || $[30] !== minZoom || $[31] !== t13) {
1102
- t14 = {
1103
- minZoom,
1104
- maxZoom: t13,
1105
- padding: fitViewPadding,
1106
- includeHiddenNodes: false
1107
- };
1108
- $[29] = fitViewPadding;
1109
- $[30] = minZoom;
1110
- $[31] = t13;
1111
- $[32] = t14;
1112
- } else t14 = $[32];
1113
- const fitViewOptions = t14;
1114
- const isBgWithPattern = background !== "transparent" && background !== "solid";
1115
- const isZoomTooSmall = useIsZoomTooSmall();
1116
- const xyflow = useXYFlow();
1117
- const xystore = useXYStoreApi();
1118
- const { colorScheme } = useMantineColorScheme();
1119
- if (!colorMode) colorMode = colorScheme === "auto" ? "system" : colorScheme;
1120
- const tabIndex = props.tabIndex ?? (zoomable ? 0 : void 0);
1121
- const ariaLabel = props["aria-label"] !== void 0 || props["aria-labelledby"] !== void 0 || tabIndex === void 0 ? props["aria-label"] : "Interactive diagram";
1122
- let t15;
1123
- if ($[33] !== fitViewOptions || $[34] !== props || $[35] !== xyflow || $[36] !== zoomable) {
1124
- t15 = (event) => {
1125
- props.onKeyDown?.(event);
1126
- if (event.defaultPrevented || !zoomable) return;
1127
- const action = getKeyboardZoomAction(event.nativeEvent);
1128
- if (!action) return;
1129
- event.preventDefault();
1130
- switch (action) {
1131
- case "zoom-in":
1132
- xyflow.zoomIn();
1133
- return;
1134
- case "zoom-out":
1135
- xyflow.zoomOut();
1136
- return;
1137
- case "reset":
1138
- xyflow.fitView(fitViewOptions);
1139
- return;
1140
- }
1141
- };
1142
- $[33] = fitViewOptions;
1143
- $[34] = props;
1144
- $[35] = xyflow;
1145
- $[36] = zoomable;
1146
- $[37] = t15;
1147
- } else t15 = $[37];
1148
- const onKeyDown = useCallbackRef(t15);
1149
- const t16 = colorMode;
1150
- const t17 = nodes;
1151
- const t18 = edges;
1152
- const t19 = background === "transparent" && "bg-transparent";
1153
- let t20;
1154
- if ($[38] !== className || $[39] !== t19) {
1155
- t20 = cx(t19, className);
1156
- $[38] = className;
1157
- $[39] = t19;
1158
- $[40] = t20;
1159
- } else t20 = $[40];
1160
- let t21;
1161
- if ($[41] !== isZoomTooSmall) {
1162
- t21 = isZoomTooSmall && { "data-likec4-zoom-small": true };
1163
- $[41] = isZoomTooSmall;
1164
- $[42] = t21;
1165
- } else t21 = $[42];
1166
- const t22 = !pannable && zoomable;
1167
- let t23;
1168
- if ($[43] !== zoomable) {
1169
- t23 = !zoomable && { zoomActivationKeyCode: null };
1170
- $[43] = zoomable;
1171
- $[44] = t23;
1172
- } else t23 = $[44];
1173
- const t24 = zoomable ? maxZoom : 1;
1174
- const t25 = zoomable ? minZoom : 1;
1175
- const t26 = zoomable || pannable;
1176
- let t27;
1177
- if ($[45] !== pannable) {
1178
- t27 = !pannable && {
1179
- panActivationKeyCode: null,
1180
- selectionKeyCode: null
1181
- };
1182
- $[45] = pannable;
1183
- $[46] = t27;
1184
- } else t27 = $[46];
1185
- let t28;
1186
- if ($[47] !== ariaLabelConfig) {
1187
- t28 = {
1188
- ...likec4AriaLabelConfig,
1189
- ...ariaLabelConfig
1190
- };
1191
- $[47] = ariaLabelConfig;
1192
- $[48] = t28;
1193
- } else t28 = $[48];
1194
- const t29 = onNodesChange;
1195
- const t30 = onEdgesChange;
1196
- let t31;
1197
- if ($[49] !== onMoveEnd || $[50] !== xystore) {
1198
- t31 = (event_0, t32) => {
1199
- const { x, y, zoom } = t32;
1200
- const roundedX = roundDpr(x);
1201
- const roundedY = roundDpr(y);
1202
- if (x !== roundedX || y !== roundedY) xystore.setState({ transform: [
1203
- roundedX,
1204
- roundedY,
1205
- zoom
1206
- ] });
1207
- onMoveEnd?.(event_0, {
1208
- x: roundedX,
1209
- y: roundedY,
1210
- zoom
1211
- });
1212
- };
1213
- $[49] = onMoveEnd;
1214
- $[50] = xystore;
1215
- $[51] = t31;
1216
- } else t31 = $[51];
1217
- const t32 = useCallbackRef(t31);
1218
- let t33;
1219
- if ($[52] !== onNodeMouseEnter || $[53] !== onNodesChange) {
1220
- t33 = (event_1, node) => {
1221
- if (onNodeMouseEnter) {
1222
- onNodeMouseEnter(event_1, node);
1223
- return;
1224
- }
1225
- onNodesChange([{
1226
- id: node.id,
1227
- type: "replace",
1228
- item: Base.setHovered(node, true)
1229
- }]);
1230
- };
1231
- $[52] = onNodeMouseEnter;
1232
- $[53] = onNodesChange;
1233
- $[54] = t33;
1234
- } else t33 = $[54];
1235
- const t34 = useCallbackRef(t33);
1236
- let t35;
1237
- if ($[55] !== onNodeMouseLeave || $[56] !== onNodesChange) {
1238
- t35 = (event_2, node_0) => {
1239
- if (onNodeMouseLeave) {
1240
- onNodeMouseLeave(event_2, node_0);
1241
- return;
1242
- }
1243
- onNodesChange([{
1244
- id: node_0.id,
1245
- type: "replace",
1246
- item: Base.setHovered(node_0, false)
1247
- }]);
1248
- };
1249
- $[55] = onNodeMouseLeave;
1250
- $[56] = onNodesChange;
1251
- $[57] = t35;
1252
- } else t35 = $[57];
1253
- const t36 = useCallbackRef(t35);
1254
- let t37;
1255
- if ($[58] !== onEdgeMouseEnter || $[59] !== onEdgesChange) {
1256
- t37 = (event_3, edge) => {
1257
- if (onEdgeMouseEnter) {
1258
- onEdgeMouseEnter(event_3, edge);
1259
- return;
1260
- }
1261
- onEdgesChange([{
1262
- id: edge.id,
1263
- type: "replace",
1264
- item: Base.setHovered(edge, true)
1265
- }]);
1266
- };
1267
- $[58] = onEdgeMouseEnter;
1268
- $[59] = onEdgesChange;
1269
- $[60] = t37;
1270
- } else t37 = $[60];
1271
- const t38 = useCallbackRef(t37);
1272
- let t39;
1273
- if ($[61] !== onEdgeMouseLeave || $[62] !== onEdgesChange) {
1274
- t39 = (event_4, edge_0) => {
1275
- if (onEdgeMouseLeave) {
1276
- onEdgeMouseLeave(event_4, edge_0);
1277
- return;
1278
- }
1279
- onEdgesChange([{
1280
- id: edge_0.id,
1281
- type: "replace",
1282
- item: Base.setHovered(edge_0, false)
1283
- }]);
1284
- };
1285
- $[61] = onEdgeMouseLeave;
1286
- $[62] = onEdgesChange;
1287
- $[63] = t39;
1288
- } else t39 = $[63];
1289
- const t40 = useCallbackRef(t39);
1290
- let t41;
1291
- if ($[64] !== onKeyDownCapture) {
1292
- t41 = (event_5) => {
1293
- onKeyDownCapture?.(event_5);
1294
- if (!event_5.defaultPrevented) activateFocusedElement(event_5);
1295
- };
1296
- $[64] = onKeyDownCapture;
1297
- $[65] = t41;
1298
- } else t41 = $[65];
1299
- const t42 = useCallbackRef(t41);
1300
- let t43;
1301
- if ($[66] !== background || $[67] !== isBgWithPattern) {
1302
- t43 = isBgWithPattern && /* @__PURE__ */ jsx(Background, { background });
1303
- $[66] = background;
1304
- $[67] = isBgWithPattern;
1305
- $[68] = t43;
1306
- } else t43 = $[68];
1307
- let t44;
1308
- if ($[69] !== onViewportResize) {
1309
- t44 = onViewportResize && /* @__PURE__ */ jsx(ViewportResizeHanlder, { onViewportResize });
1310
- $[69] = onViewportResize;
1311
- $[70] = t44;
1312
- } else t44 = $[70];
1313
- let t45;
1314
- if ($[71] !== ariaLabel || $[72] !== children || $[73] !== colorMode || $[74] !== edges || $[75] !== edgesFocusable || $[76] !== fitViewOptions || $[77] !== nodes || $[78] !== nodesDraggable || $[79] !== nodesFocusable || $[80] !== nodesSelectable || $[81] !== onEdgesChange || $[82] !== onKeyDown || $[83] !== onNodesChange || $[84] !== pannable || $[85] !== props || $[86] !== t20 || $[87] !== t21 || $[88] !== t22 || $[89] !== t23 || $[90] !== t24 || $[91] !== t25 || $[92] !== t26 || $[93] !== t27 || $[94] !== t28 || $[95] !== t32 || $[96] !== t34 || $[97] !== t36 || $[98] !== t38 || $[99] !== t40 || $[100] !== t42 || $[101] !== t43 || $[102] !== t44 || $[103] !== tabIndex || $[104] !== zoomOnDoubleClick || $[105] !== zoomable) {
1315
- t45 = /* @__PURE__ */ jsxs(index, {
1316
- colorMode: t16,
1317
- nodes: t17,
1318
- edges: t18,
1319
- className: t20,
1320
- ...t21,
1321
- zoomOnPinch: zoomable,
1322
- zoomOnScroll: t22,
1323
- ...t23,
1324
- zoomOnDoubleClick,
1325
- maxZoom: t24,
1326
- minZoom: t25,
1327
- fitViewOptions,
1328
- preventScrolling: t26,
1329
- defaultMarkerColor: "var(--xy-edge-stroke)",
1330
- noDragClassName: "nodrag",
1331
- noPanClassName: "nopan",
1332
- noWheelClassName: "nowheel",
1333
- panOnScroll: pannable,
1334
- panOnDrag: pannable,
1335
- ...t27,
1336
- elementsSelectable: nodesSelectable,
1337
- nodesFocusable,
1338
- edgesFocusable,
1339
- nodesDraggable,
1340
- ariaLabelConfig: t28,
1341
- nodeDragThreshold: 4,
1342
- nodeClickDistance: 3,
1343
- paneClickDistance: 3,
1344
- elevateNodesOnSelect: false,
1345
- selectNodesOnDrag: false,
1346
- onNodesChange: t29,
1347
- onEdgesChange: t30,
1348
- onMoveEnd: t32,
1349
- onNodeMouseEnter: t34,
1350
- onNodeMouseLeave: t36,
1351
- onEdgeMouseEnter: t38,
1352
- onEdgeMouseLeave: t40,
1353
- onNodeDoubleClick: stopPropagation,
1354
- onEdgeDoubleClick: stopPropagation,
1355
- onKeyDownCapture: t42,
1356
- ...props,
1357
- "aria-label": ariaLabel,
1358
- tabIndex,
1359
- onKeyDown,
1360
- children: [
1361
- t43,
1362
- t44,
1363
- children
1364
- ]
1365
- });
1366
- $[71] = ariaLabel;
1367
- $[72] = children;
1368
- $[73] = colorMode;
1369
- $[74] = edges;
1370
- $[75] = edgesFocusable;
1371
- $[76] = fitViewOptions;
1372
- $[77] = nodes;
1373
- $[78] = nodesDraggable;
1374
- $[79] = nodesFocusable;
1375
- $[80] = nodesSelectable;
1376
- $[81] = onEdgesChange;
1377
- $[82] = onKeyDown;
1378
- $[83] = onNodesChange;
1379
- $[84] = pannable;
1380
- $[85] = props;
1381
- $[86] = t20;
1382
- $[87] = t21;
1383
- $[88] = t22;
1384
- $[89] = t23;
1385
- $[90] = t24;
1386
- $[91] = t25;
1387
- $[92] = t26;
1388
- $[93] = t27;
1389
- $[94] = t28;
1390
- $[95] = t32;
1391
- $[96] = t34;
1392
- $[97] = t36;
1393
- $[98] = t38;
1394
- $[99] = t40;
1395
- $[100] = t42;
1396
- $[101] = t43;
1397
- $[102] = t44;
1398
- $[103] = tabIndex;
1399
- $[104] = zoomOnDoubleClick;
1400
- $[105] = zoomable;
1401
- $[106] = t45;
1402
- } else t45 = $[106];
1403
- return t45;
1404
- }
1405
- var selectDimensions = ({ width, height }) => (width || 1) * (height || 1);
1406
- var ViewportResizeHanlder = (t0) => {
1407
- const $ = c(2);
1408
- const { onViewportResize } = t0;
1409
- const square = useStore$1(selectDimensions);
1410
- let t1;
1411
- if ($[0] !== square) {
1412
- t1 = [square];
1413
- $[0] = square;
1414
- $[1] = t1;
1415
- } else t1 = $[1];
1416
- useUpdateEffect(onViewportResize, t1);
1417
- return null;
1418
- };
1419
- //#endregion
1420
- //#region ../diagram/src/context/RootContainerContext.tsx
1421
- var RootContainerContext = createContext(null);
1422
- var RootContainerContextProvider = RootContainerContext.Provider;
1423
- function useRootContainerContext() {
1424
- return useContext(RootContainerContext);
1425
- }
1426
- function useRootContainer() {
1427
- const ctx = useRootContainerContext();
1428
- if (!ctx) throw new Error("useRootContainer must be used within a RootContainer");
1429
- return ctx;
1430
- }
1431
- function useRootContainerRef() {
1432
- return useRootContainer().ref;
1433
- }
1434
- function useRootContainerElement() {
1435
- return useRootContainer().ref.current;
1436
- }
1437
- //#endregion
1438
- //#region ../diagram/src/components/RootContainer.tsx
1439
- function RootContainer(t0) {
1440
- const $ = c(18);
1441
- const { id, className, reduceGraphics: t1, children } = t0;
1442
- const reduceGraphics = t1 === void 0 ? false : t1;
1443
- const ref = useRef(null);
1444
- const [$isPanning] = useState(_temp$1);
1445
- const isPanning = useStore($isPanning);
1446
- const t2 = `#${id}`;
1447
- let t3;
1448
- if ($[0] !== $isPanning || $[1] !== id || $[2] !== reduceGraphics || $[3] !== t2) {
1449
- t3 = {
1450
- id,
1451
- ref,
1452
- selector: t2,
1453
- reducedGraphics: reduceGraphics,
1454
- $panning: $isPanning
1455
- };
1456
- $[0] = $isPanning;
1457
- $[1] = id;
1458
- $[2] = reduceGraphics;
1459
- $[3] = t2;
1460
- $[4] = t3;
1461
- } else t3 = $[4];
1462
- const ctx = t3;
1463
- let t4;
1464
- if ($[5] !== className) {
1465
- t4 = cx("likec4-root", className);
1466
- $[5] = className;
1467
- $[6] = t4;
1468
- } else t4 = $[6];
1469
- let t5;
1470
- if ($[7] !== reduceGraphics) {
1471
- t5 = reduceGraphics && { "data-likec4-reduced-graphics": true };
1472
- $[7] = reduceGraphics;
1473
- $[8] = t5;
1474
- } else t5 = $[8];
1475
- let t6;
1476
- if ($[9] !== children || $[10] !== ctx) {
1477
- t6 = /* @__PURE__ */ jsx(RootContainerContextProvider, {
1478
- value: ctx,
1479
- children
1480
- });
1481
- $[9] = children;
1482
- $[10] = ctx;
1483
- $[11] = t6;
1484
- } else t6 = $[11];
1485
- let t7;
1486
- if ($[12] !== id || $[13] !== isPanning || $[14] !== t4 || $[15] !== t5 || $[16] !== t6) {
1487
- t7 = /* @__PURE__ */ jsx("div", {
1488
- id,
1489
- className: t4,
1490
- ref,
1491
- "data-likec4-diagram-panning": isPanning,
1492
- ...t5,
1493
- children: t6
1494
- });
1495
- $[12] = id;
1496
- $[13] = isPanning;
1497
- $[14] = t4;
1498
- $[15] = t5;
1499
- $[16] = t6;
1500
- $[17] = t7;
1501
- } else t7 = $[17];
1502
- return t7;
1503
- }
1504
- function _temp$1() {
1505
- return /* @__PURE__ */ atom(false);
1506
- }
1507
- __name(_temp$1, "_temp");
1508
- //#endregion
1509
- //#region ../diagram/src/LikeC4MantineProvider.tsx
1510
- function t(name) {
1511
- return token.var(name);
1512
- }
1513
- var tshirts = [
1514
- "xs",
1515
- "sm",
1516
- "md",
1517
- "lg",
1518
- "xl"
1519
- ];
1520
- var sizes = (tokenCategory) => {
1521
- return Object.fromEntries(tshirts.map((size) => [size, t(`${tokenCategory}.${size}`)]));
1522
- };
1523
- var shades = [
1524
- 0,
1525
- 1,
1526
- 2,
1527
- 3,
1528
- 4,
1529
- 5,
1530
- 6,
1531
- 7,
1532
- 8,
1533
- 9
1534
- ];
1535
- var mapColor = (color) => {
1536
- return t$7(shades, (shade) => t(`colors.${color}.${shade}`));
1537
- };
1538
- var titles = [
1539
- css({ textStyle: "h1" }),
1540
- css({ textStyle: "h2" }),
1541
- css({ textStyle: "h3" }),
1542
- css({ textStyle: "h4" }),
1543
- css({ textStyle: "h5" }),
1544
- css({ textStyle: "h6" })
1545
- ];
1546
- var likec4Theme = createTheme({
1547
- primaryColor: "likec4",
1548
- cursorType: "pointer",
1549
- autoContrast: true,
1550
- primaryShade: {
1551
- light: 5,
1552
- dark: 6
1553
- },
1554
- colors: { likec4: mapColor("likec4.accent") },
1555
- fontFamily: t("fonts.body"),
1556
- fontFamilyMonospace: t("fonts.mono"),
1557
- headings: {
1558
- fontFamily: t("fonts.display"),
1559
- fontWeight: t("fontWeights.bold")
1560
- },
1561
- defaultRadius: "sm",
1562
- fontWeights: {
1563
- regular: t("fontWeights.normal"),
1564
- medium: t("fontWeights.medium"),
1565
- semibold: t("fontWeights.semibold"),
1566
- bold: t("fontWeights.bold")
1567
- },
1568
- fontSizes: {
1569
- ...sizes("fontSizes"),
1570
- xxs: t("fontSizes.xxs")
1571
- },
1572
- spacing: {
1573
- ...sizes("spacing"),
1574
- xxs: t("spacing.xxs")
1575
- },
1576
- radius: sizes("radii"),
1577
- shadows: sizes("shadows"),
1578
- lineHeights: sizes("lineHeights"),
1579
- components: {
1580
- Card: Card.extend({
1581
- defaultProps: { radius: "md" },
1582
- classNames: { root: css({ bg: "surface.default" }) }
1583
- }),
1584
- Paper: Paper.extend({
1585
- defaultProps: { radius: "md" },
1586
- classNames: { root: css({ bg: "surface.default" }) }
1587
- }),
1588
- Title: Title$1.extend({ classNames: (_theme, props) => ({ root: titles[(props.order ?? 1) - 1] }) }),
1589
- Code: Code.extend({ classNames: { root: css({ bg: "surface.code" }) } }),
1590
- Table: Table.extend({ classNames: { th: css({
1591
- fontSize: "xxs",
1592
- fontWeight: "bold",
1593
- color: "text.dimmed",
1594
- textTransform: "uppercase",
1595
- letterSpacing: "caps.sm"
1596
- }) } }),
1597
- Tooltip: Tooltip.extend({ defaultProps: {
1598
- color: "dark",
1599
- fz: "xs",
1600
- withArrow: false,
1601
- openDelay: 600,
1602
- closeDelay: 120,
1603
- offset: 8
1604
- } }),
1605
- SegmentedControl: SegmentedControl.extend({ vars: (theme, props) => ({ root: { "--sc-font-size": theme.fontSizes[props.fz ?? props.size] } }) }),
1606
- Popover: Popover.extend({ defaultProps: {
1607
- withArrow: false,
1608
- radius: "sm",
1609
- shadow: "lg"
1610
- } }),
1611
- Menu: Menu.extend({ defaultProps: {
1612
- radius: "sm",
1613
- shadow: "lg"
1614
- } })
1615
- }
1616
- });
1617
- var semantic = (variables) => ({
1618
- dark: variables,
1619
- light: variables
1620
- });
1621
- var resolver = (_) => ({
1622
- variables: { "--mantine-radius-default": t("radii.sm") },
1623
- ...semantic({
1624
- "--mantine-color-text": t("colors.text"),
1625
- "--mantine-color-body": t("colors.surface.default"),
1626
- "--mantine-color-placeholder": t("colors.text.non-essential"),
1627
- "--mantine-color-anchor": t("colors.text.link"),
1628
- "--mantine-color-disabled": t("colors.disabled.body"),
1629
- "--mantine-color-disabled-color": t("colors.disabled.text"),
1630
- "--mantine-color-disabled-hover": t("colors.disabled.body"),
1631
- "--mantine-color-disabled-border": t("colors.disabled.border"),
1632
- "--mantine-color-default": t("colors.surface.default"),
1633
- "--mantine-color-default-color": t("colors.text"),
1634
- "--mantine-color-default-border": t("colors.border.default"),
1635
- "--mantine-color-default-hover": t("colors.surface.hover")
1636
- })
1637
- });
1638
- /**
1639
- * LikeC4 Mantine provider with custom theme and CSS variables resolver
1640
- */
1641
- function LikeC4MantineProvider(t0) {
1642
- const $ = c(12);
1643
- let children;
1644
- let props;
1645
- let t1;
1646
- let theme;
1647
- if ($[0] !== t0) {
1648
- ({children, defaultColorScheme: t1, theme, ...props} = t0);
1649
- $[0] = t0;
1650
- $[1] = children;
1651
- $[2] = props;
1652
- $[3] = t1;
1653
- $[4] = theme;
1654
- } else {
1655
- children = $[1];
1656
- props = $[2];
1657
- t1 = $[3];
1658
- theme = $[4];
1659
- }
1660
- const defaultColorScheme = t1 === void 0 ? "auto" : t1;
1661
- let t2;
1662
- if ($[5] !== theme) {
1663
- t2 = theme ? mergeThemeOverrides(likec4Theme, theme) : likec4Theme;
1664
- $[5] = theme;
1665
- $[6] = t2;
1666
- } else t2 = $[6];
1667
- const mergedTheme = t2;
1668
- let t3;
1669
- if ($[7] !== children || $[8] !== defaultColorScheme || $[9] !== mergedTheme || $[10] !== props) {
1670
- t3 = /* @__PURE__ */ jsx(MantineProvider, {
1671
- defaultColorScheme,
1672
- theme: mergedTheme,
1673
- cssVariablesResolver: resolver,
1674
- ...props,
1675
- children
1676
- });
1677
- $[7] = children;
1678
- $[8] = defaultColorScheme;
1679
- $[9] = mergedTheme;
1680
- $[10] = props;
1681
- $[11] = t3;
1682
- } else t3 = $[11];
1683
- return t3;
1684
- }
1685
- //#endregion
1686
- //#region ../diagram/src/context/EnsureMantine.tsx
1687
- function EnsureMantine(t0) {
1688
- const $ = c(7);
1689
- const { children } = t0;
1690
- const mantineCtx = useContext(MantineContext);
1691
- let t1;
1692
- if ($[0] !== mantineCtx) {
1693
- t1 = () => {
1694
- if (!mantineCtx) console.warn("LikeC4Diagram must be a child of LikeC4MantineProvider");
1695
- };
1696
- $[0] = mantineCtx;
1697
- $[1] = t1;
1698
- } else t1 = $[1];
1699
- let t2;
1700
- if ($[2] === Symbol.for("react.memo_cache_sentinel")) {
1701
- t2 = [];
1702
- $[2] = t2;
1703
- } else t2 = $[2];
1704
- useEffect(t1, t2);
1705
- if (!mantineCtx) {
1706
- let t3;
1707
- if ($[3] !== children) {
1708
- t3 = /* @__PURE__ */ jsx(LikeC4MantineProvider, { children });
1709
- $[3] = children;
1710
- $[4] = t3;
1711
- } else t3 = $[4];
1712
- return t3;
1713
- }
1714
- let t3;
1715
- if ($[5] !== children) {
1716
- t3 = /* @__PURE__ */ jsx(Fragment$1, { children });
1717
- $[5] = children;
1718
- $[6] = t3;
1719
- } else t3 = $[6];
1720
- return t3;
1721
- }
1722
- //#endregion
1723
- //#region ../diagram/src/context/FramerMotionConfig.tsx
1724
- function FramerMotionConfig(t0) {
1725
- const $ = c(6);
1726
- const { reducedMotion: t1, children } = t0;
1727
- const reducedMotion = t1 === void 0 ? "user" : t1;
1728
- const nonce = useMantineStyleNonce()?.();
1729
- let t2;
1730
- if ($[0] !== nonce) {
1731
- t2 = nonce && { nonce };
1732
- $[0] = nonce;
1733
- $[1] = t2;
1734
- } else t2 = $[1];
1735
- let t3;
1736
- if ($[2] !== children || $[3] !== reducedMotion || $[4] !== t2) {
1737
- t3 = /* @__PURE__ */ jsx(LazyMotion, {
1738
- features: domMax,
1739
- strict: true,
1740
- children: /* @__PURE__ */ jsx(MotionConfig, {
1741
- reducedMotion,
1742
- ...t2,
1743
- children
1744
- })
1745
- });
1746
- $[2] = children;
1747
- $[3] = reducedMotion;
1748
- $[4] = t2;
1749
- $[5] = t3;
1750
- } else t3 = $[5];
1751
- return t3;
1752
- }
1753
- //#endregion
1754
- //#region ../diagram/src/context/LikeC4ModelContext.tsx
1755
- var LikeC4ModelContext = createContext(null);
1756
- var LikeC4ModelContextProvider = LikeC4ModelContext.Provider;
1757
- var CurrentViewModelCtx = createContext(null);
1758
- var CurrentViewModelContext = CurrentViewModelCtx.Provider;
1759
- /**
1760
- * @returns The LikeC4Model from context, or null if no LikeC4ModelProvider is found.
1761
- */
1762
- function useOptionalLikeC4Model() {
1763
- return useContext(LikeC4ModelContext);
1764
- }
1765
- function useOptionalCurrentViewModel() {
1766
- return useContext(CurrentViewModelCtx);
1767
- }
1768
- //#endregion
1769
- //#region ../diagram/src/hooks/useLikeC4Styles.ts
1770
- function useLikeC4Styles() {
1771
- return useOptionalLikeC4Model()?.$styles ?? LikeC4Styles.DEFAULT;
1772
- }
1773
- //#endregion
1774
- //#region ../diagram/src/hooks/useId.ts
1775
- function useId$1() {
1776
- const $ = c(2);
1777
- const t0 = useId$1$1();
1778
- let t1;
1779
- if ($[0] !== t0) {
1780
- t1 = t0.replace("mantine-", "likec4-");
1781
- $[0] = t0;
1782
- $[1] = t1;
1783
- } else t1 = $[1];
1784
- return t1;
1785
- }
1786
- __name(useId$1, "useId");
1787
- //#endregion
1788
- //#region ../diagram/src/context/LikeC4ProjectsContext.ts
1789
- var LikeC4ProjectsContext = createContext(null);
1790
- var LikeC4ProjectsContextProvider = LikeC4ProjectsContext.Provider;
1791
- function useOptionalProjectsContext() {
1792
- return useContext(LikeC4ProjectsContext);
1793
- }
1794
- //#endregion
1795
- //#region ../diagram/src/hooks/useLikeC4Project.ts
1796
- var emptyProjects = [];
1797
- function onProjectChange(id) {
1798
- console.warn(`Triggered callback to change project to ${id}, but no <LikeC4ProjectsProvider/> found`);
1799
- }
1800
- var emptyContext = {
1801
- projects: emptyProjects,
1802
- onProjectChange
1803
- };
1804
- function useLikeC4ProjectsContext() {
1805
- return useOptionalProjectsContext() ?? emptyContext;
1806
- }
1807
- /**
1808
- * @returns The list of available projects, or empty array if no projects are available.
1809
- */
1810
- function useLikeC4Projects() {
1811
- return useLikeC4ProjectsContext().projects;
1812
- }
1813
- /**
1814
- * @returns The callback to change current project, or a no-op if no LikeC4ProjectsProvider is found.
1815
- */
1816
- function useChangeLikeC4Project() {
1817
- return useLikeC4ProjectsContext().onProjectChange;
1818
- }
1819
- /**
1820
- * @returns Current project id, as provided by LikeC4Model
1821
- */
1822
- function useLikeC4ProjectId() {
1823
- const ctx = useOptionalLikeC4Model();
1824
- if (!ctx) throw new Error("No LikeC4ModelProvider found");
1825
- return ctx.projectId;
1826
- }
1827
- //#endregion
1828
- //#region ../diagram/src/components/Logo.tsx
1829
- var Logo = forwardRef((props, ref) => {
1830
- const $ = c(5);
1831
- let t0;
1832
- let t1;
1833
- if ($[0] === Symbol.for("react.memo_cache_sentinel")) {
1834
- t0 = /* @__PURE__ */ jsx("path", {
1835
- fill: "#5E98AF",
1836
- d: "M33.95 33.78V0H2.37A2.37 2.37 0 0 0 0 2.35V33.9h33.95v-.12ZM38.57 33.78H55.6v-14.6c0-1.3-1.06-2.35-2.36-2.35H38.57v16.95ZM33.95 38.37H17.04v14.6c0 1.29 1.06 2.35 2.36 2.35h14.67V38.37h-.12ZM38.57 38.37v16.95h14.67c1.3 0 2.36-1.06 2.36-2.36v-14.6H38.57Z"
1837
- });
1838
- t1 = /* @__PURE__ */ jsx("path", {
1839
- className: css({
1840
- fill: "[#FCFBF7]",
1841
- _light: { fill: "[#222221]" }
1842
- }),
1843
- d: "M71.61 12.08c-.06 3.61.3 29.95.23 31.87 0 1.8 0 3.6.06 5.41 0 .3.18.58.47.58 4.1.18 8.13-.17 12.22-.11 1.34.05 2.69 0 3.97 0 1.29-.06 1.4-.59 1.35-1.63-.06-1.63-.06-3.08-.06-4.65-.06-.82-.53-1.11-1.23-1.11-2.4.06-4.8-.06-7.19.06-.4.06-.82.06-1.23.06-.7-.06-.87-.24-.93-1v-.86c-.18-4.83.17-9.83.17-14.66-.06-4.07 0-7.73-.06-11.34 0-1.57 0-3.14-.05-4.65-.06-.93 0-1.92-.24-2.85-.11-.35-.29-.81-.7-.81h-5.5c-.93 0-1.22.64-1.28 1.57v4.12ZM103.81 35c-.17-6.63-.1-13.67-.05-20.24 0-2.04-.12-4.25-.12-6.28 0-2.21-.87-2.1-2.04-2.15-1.7-.06-2.46-.06-4.15-.06-1.11-.06-1.58.23-1.58 1.34 0 5.7-.18 21.8-.12 24.13.06 2.33.3 12.91.18 15.24-.06.81 0 1.62.06 2.44.05.29.23.58.7.58 1.93-.12 3.74-.12 5.67-.17.7-.06 1.28-.24 1.58-1 .05-.4-.12-11.04-.12-13.83Zm13.92 4.47c0-2.03-.3-7.56-.23-8.72 0-.17.11-.4.17-.4.12 0 .35.11.41.17 1.87 2.44 10.64 19.36 11.7 19.42.28.06.58.06.87.06 1.99-.12 3.74 0 5.73 0 2.04 0 .7-1.98.35-2.5-.53-.76-7.48-13.14-7.9-13.9-1.16-1.98-2.16-4.13-3.32-6.05-.12-.23-.24-.58-.18-.81.12-.7.3-1.34.59-1.98a93.18 93.18 0 0 1 4.55-8.14c1.88-2.97 2.93-4.83 4.45-7.5.35-.64.58-1.34.82-2.1.05-.29-.18-.58-.53-.58-1.11-.05-5.15 0-6.43 0-.59 0-1.17.12-1.46.64-.76 1.46-8.6 15.7-9.35 16.98-.06.12-.24.18-.41.18 0 0-.12-.18-.12-.3-.06-3.25.53-13.9.4-16.04-.05-1.28-.28-1.4-1.57-1.46-1.4-.05-3.33-.05-4.73-.05-1.3 0-1.4.7-1.58 1.62-.06.18-.06 5.64-.06 8.09 0 3.54-.3 25.76.11 32.8 0 .7.18 1.1.77 1.1 1.57-.12 3.91 0 5.49 0 1.11 0 1.29-.12 1.29-1.98 0-2.5.23-4.77.23-7.85 0-.23-.06-.46-.06-.7Zm25.66-1.4h-.06c0 1.46-.05 2.97 0 4.49.06 1.86.18 3.72.3 5.58 0 .64.17.81.76.93 1.22.29 2.4.35 3.62.35 3.16-.12 6.31.11 9.47 0 1.29-.06 1.87.06 3.16-.18 1.17-.23 1.58-.87 1.58-2.61-.12-1.1-.06-1.57-.06-2.91 0-1.92-1.35-2.56-2.52-2.5-.81.06-4.73-.06-6.31-.06-2.63.06-2.22.4-2.22-2.33 0-2.2.06-5.05.06-7.32 0-1.22.11-1.63 1.28-1.63h7.31c1.17.17 1.99-.64 1.99-1.86 0-1.22.12-1.28.12-2.5l-.18-1.75c-.12-.99-.47-1.33-1.46-1.33-.64 0-1.29.05-1.93.11-2.52.18-3.68-.17-6.14 0-.82 0-.93-.11-1-.87-.23-2.27 0-4.77.24-7.04.06-.93.3-1.1 1.17-1.16l8.24-.06c1.11-.11 1.46-.06 1.4-1.16-.11-1.69.06-3.43-.11-5.12-.12-.93-.41-1.1-1.46-1.1-1.76.05-2.17.05-3.92.17-1.75.06-8.77.06-10.46.06-2.46 0-2.63-.18-2.7 2.8-.1 2.32-.05 4.7-.05 7.09 0 4.07-.23 18.66-.12 21.92Zm47.76-24.82c.06-1.92 0-3.5 0-5.35 0-2.15-3.92-1.92-5.32-1.86a18.95 18.95 0 0 0-15.08 9.77c-.82 1.57-1.4 3.2-1.81 4.88a34 34 0 0 0-.59 12.15c.41 3.78 1.4 7.56 3.74 10.59 4.04 5.3 11.46 7.15 17.83 6.16.3-.06.59-.11.82-.29.18-.11.35-.35.35-.58l.18-3.31c.06-1.05 0-1 0-2.04 0-1.4-2.93-.35-4.74-.35-1.75 0-3.62-.06-5.2-.87-2.8-1.57-4.38-4.71-5.26-7.68-1-3.2-1.23-6.63-.64-9.88.7-4.25 2.74-9.13 7.25-10.59 2.57-.87 5.31-.58 7.89-.29.35.06.58-.17.58-.46Zm26.77 15.3c.06-2.5 0-14.84 0-18.38.06-.82 0-1.63-.11-2.45-.06-.99-.24-1.28-1.29-1.33h-4.44c-.82 0-1.35.4-1.82 1.27-1.34 3.2-10.75 24.02-12.15 26.58-.53.99-1 1.63-1 2.68v4.24c0 .76-.06 1.28 1.23 1.28l11.1-.06c1.47 0 1.47.3 1.47 1.1 0 .88-.12 4.9-.12 5.3 0 .58.12 1.16 1.23 1.16h5.08c1.23 0 1.23-.7 1.23-2.03.06-1.17-.06-3.5-.06-4.66 0-.93.18-.98 1.76-.98 1.22 0 1.75-.12 1.75-.88.06-1.57 0-2.67 0-4.42 0-1.04-.93-.98-2.92-.98-.65 0-.7-.18-.7-1.05-.12-1.8-.24-4.6-.24-6.4Zm-7.25-5.94c-.05.7-.11 10.82-.11 12.27-.06.81-.24 1.05-1 1.1-1.93.06-3.85.06-5.78.06-.47 0-.65-.4-.41-.87.23-.4 4.85-11.57 6.13-14.48.18-.17.24-.35.41-.52.18-.12.41-.18.59-.23.06 0 .23.29.23.46 0 .76-.06 1.51-.06 2.21Z"
1844
- });
1845
- $[0] = t0;
1846
- $[1] = t1;
1847
- } else {
1848
- t0 = $[0];
1849
- t1 = $[1];
1850
- }
1851
- let t2;
1852
- if ($[2] !== props || $[3] !== ref) {
1853
- t2 = /* @__PURE__ */ jsxs("svg", {
1854
- ref,
1855
- xmlns: "http://www.w3.org/2000/svg",
1856
- fill: "none",
1857
- viewBox: "0 0 222 56",
1858
- ...props,
1859
- children: [t0, t1]
1860
- });
1861
- $[2] = props;
1862
- $[3] = ref;
1863
- $[4] = t2;
1864
- } else t2 = $[4];
1865
- return t2;
1866
- });
1867
- var LogoIcon = forwardRef((props, ref) => {
1868
- const $ = c(4);
1869
- let t0;
1870
- if ($[0] === Symbol.for("react.memo_cache_sentinel")) {
1871
- t0 = /* @__PURE__ */ jsx("path", {
1872
- fill: "#5E98AF",
1873
- d: "M33.95 33.78V0H2.37A2.37 2.37 0 0 0 0 2.35V33.9h33.95v-.12ZM38.57 33.78H55.6v-14.6c0-1.3-1.06-2.35-2.36-2.35H38.57v16.95ZM33.95 38.37H17.04v14.6c0 1.29 1.06 2.35 2.36 2.35h14.67V38.37h-.12ZM38.57 38.37v16.95h14.67c1.3 0 2.36-1.06 2.36-2.36v-14.6H38.57Z"
1874
- });
1875
- $[0] = t0;
1876
- } else t0 = $[0];
1877
- let t1;
1878
- if ($[1] !== props || $[2] !== ref) {
1879
- t1 = /* @__PURE__ */ jsx("svg", {
1880
- ref,
1881
- xmlns: "http://www.w3.org/2000/svg",
1882
- fill: "none",
1883
- viewBox: "0 0 56 56",
1884
- ...props,
1885
- children: t0
1886
- });
1887
- $[1] = props;
1888
- $[2] = ref;
1889
- $[3] = t1;
1890
- } else t1 = $[3];
1891
- return t1;
1892
- });
1893
- //#endregion
1894
- //#region ../diagram/src/base-primitives/edge/EdgeContainer.tsx
1895
- function EdgeContainer(t0) {
1896
- const $ = c(47);
1897
- let children;
1898
- let component;
1899
- let style;
1900
- let t1;
1901
- let t2;
1902
- let t3;
1903
- let t4;
1904
- let t5;
1905
- let t6;
1906
- let t7;
1907
- let t8;
1908
- let t9;
1909
- if ($[0] !== t0) {
1910
- const { className, component: t10, selectable: t11, selected: t12, data: t13, animated: t14, children: t15, style: t16, ...rest } = t0;
1911
- children = t15;
1912
- style = t16;
1913
- component = t10 === void 0 ? "g" : t10;
1914
- const selectable = t11 === void 0 ? false : t11;
1915
- const selected = t12 === void 0 ? false : t12;
1916
- let data;
1917
- let t17;
1918
- let t18;
1919
- let t19;
1920
- let t20;
1921
- if ($[13] !== t13) {
1922
- ({color: t17, hovered: t18, active: t19, dimmed: t20, ...data} = t13);
1923
- $[13] = t13;
1924
- $[14] = data;
1925
- $[15] = t17;
1926
- $[16] = t18;
1927
- $[17] = t19;
1928
- $[18] = t20;
1929
- } else {
1930
- data = $[14];
1931
- t17 = $[15];
1932
- t18 = $[16];
1933
- t19 = $[17];
1934
- t20 = $[18];
1935
- }
1936
- const color = t17 === void 0 ? "gray" : t17;
1937
- const isHovered = t18 === void 0 ? false : t18;
1938
- const isActive = t19 === void 0 ? false : t19;
1939
- const isDimmed = t20 === void 0 ? false : t20;
1940
- let animated = t14 === void 0 ? false : t14;
1941
- animated = animated || isActive;
1942
- const t21 = selected && "selected";
1943
- const t22 = selectable && "selectable";
1944
- if ($[19] !== className || $[20] !== t21 || $[21] !== t22) {
1945
- t1 = cx(className, "likec4-edge-container", t21, t22);
1946
- $[19] = className;
1947
- $[20] = t21;
1948
- $[21] = t22;
1949
- $[22] = t1;
1950
- } else t1 = $[22];
1951
- t2 = color;
1952
- t3 = data.dir ?? "forward";
1953
- t4 = isActive;
1954
- t5 = isHovered;
1955
- if ($[23] !== animated) {
1956
- t6 = animated && { "data-likec4-animated": animated };
1957
- $[23] = animated;
1958
- $[24] = t6;
1959
- } else t6 = $[24];
1960
- if ($[25] !== selected) {
1961
- t7 = selected && { "data-likec4-selected": selected };
1962
- $[25] = selected;
1963
- $[26] = t7;
1964
- } else t7 = $[26];
1965
- if ($[27] !== isDimmed) {
1966
- t8 = isDimmed !== false && { "data-likec4-dimmed": isDimmed };
1967
- $[27] = isDimmed;
1968
- $[28] = t8;
1969
- } else t8 = $[28];
1970
- t9 = t$1(rest, _temp);
1971
- $[0] = t0;
1972
- $[1] = children;
1973
- $[2] = component;
1974
- $[3] = style;
1975
- $[4] = t1;
1976
- $[5] = t2;
1977
- $[6] = t3;
1978
- $[7] = t4;
1979
- $[8] = t5;
1980
- $[9] = t6;
1981
- $[10] = t7;
1982
- $[11] = t8;
1983
- $[12] = t9;
1984
- } else {
1985
- children = $[1];
1986
- component = $[2];
1987
- style = $[3];
1988
- t1 = $[4];
1989
- t2 = $[5];
1990
- t3 = $[6];
1991
- t4 = $[7];
1992
- t5 = $[8];
1993
- t6 = $[9];
1994
- t7 = $[10];
1995
- t8 = $[11];
1996
- t9 = $[12];
1997
- }
1998
- let t10;
1999
- if ($[29] !== t1 || $[30] !== t2 || $[31] !== t3 || $[32] !== t4 || $[33] !== t5 || $[34] !== t6 || $[35] !== t7 || $[36] !== t8 || $[37] !== t9) {
2000
- t10 = {
2001
- className: t1,
2002
- "data-likec4-color": t2,
2003
- "data-edge-dir": t3,
2004
- "data-edge-active": t4,
2005
- "data-likec4-hovered": t5,
2006
- ...t6,
2007
- ...t7,
2008
- ...t8,
2009
- ...t9
2010
- };
2011
- $[29] = t1;
2012
- $[30] = t2;
2013
- $[31] = t3;
2014
- $[32] = t4;
2015
- $[33] = t5;
2016
- $[34] = t6;
2017
- $[35] = t7;
2018
- $[36] = t8;
2019
- $[37] = t9;
2020
- $[38] = t10;
2021
- } else t10 = $[38];
2022
- const props = t10;
2023
- if (component === "svg") {
2024
- let t11;
2025
- if ($[39] !== children || $[40] !== props || $[41] !== style) {
2026
- t11 = /* @__PURE__ */ jsx("svg", {
2027
- style,
2028
- ...props,
2029
- children
2030
- });
2031
- $[39] = children;
2032
- $[40] = props;
2033
- $[41] = style;
2034
- $[42] = t11;
2035
- } else t11 = $[42];
2036
- return t11;
2037
- }
2038
- invariant(component === "g", "EdgeContainer: component must be \"g\" or \"svg\"");
2039
- let t11;
2040
- if ($[43] !== children || $[44] !== props || $[45] !== style) {
2041
- t11 = /* @__PURE__ */ jsx("g", {
2042
- style,
2043
- ...props,
2044
- children
2045
- });
2046
- $[43] = children;
2047
- $[44] = props;
2048
- $[45] = style;
2049
- $[46] = t11;
2050
- } else t11 = $[46];
2051
- return t11;
2052
- }
2053
- function _temp(value, key) {
2054
- return value !== void 0 && key.startsWith("data-");
2055
- }
2056
- //#endregion
2057
- //#region ../diagram/src/base-primitives/edge/EdgeLabel.tsx
2058
- var EdgeLabel = forwardRef((t0, ref) => {
2059
- const $ = c(34);
2060
- let children;
2061
- let className;
2062
- let rest;
2063
- let stepNum;
2064
- let t1;
2065
- let t2;
2066
- let t3;
2067
- if ($[0] !== t0) {
2068
- ({edgeProps: t1, isSequenceStep: t2, stepNum, pointerEvents: t3, className, children, ...rest} = t0);
2069
- $[0] = t0;
2070
- $[1] = children;
2071
- $[2] = className;
2072
- $[3] = rest;
2073
- $[4] = stepNum;
2074
- $[5] = t1;
2075
- $[6] = t2;
2076
- $[7] = t3;
2077
- } else {
2078
- children = $[1];
2079
- className = $[2];
2080
- rest = $[3];
2081
- stepNum = $[4];
2082
- t1 = $[5];
2083
- t2 = $[6];
2084
- t3 = $[7];
2085
- }
2086
- const { id, data: t4, selected: t5, selectable: t6 } = t1;
2087
- const { label, technology, hovered: t7 } = t4;
2088
- const isHovered = t7 === void 0 ? false : t7;
2089
- const selected = t5 === void 0 ? false : t5;
2090
- const selectable = t6 === void 0 ? false : t6;
2091
- const isStepEdge = t2 === void 0 ? false : t2;
2092
- const pointerEvents = t3 === void 0 ? "all" : t3;
2093
- let t8;
2094
- if ($[8] !== label || $[9] !== technology) {
2095
- t8 = e(label) || e(technology);
2096
- $[8] = label;
2097
- $[9] = technology;
2098
- $[10] = t8;
2099
- } else t8 = $[10];
2100
- const hasLabel = t8;
2101
- let t9;
2102
- if ($[11] !== className || $[12] !== isStepEdge || $[13] !== pointerEvents || $[14] !== selectable) {
2103
- t9 = cx("likec4-edge-label", edgeLabel({
2104
- pointerEvents,
2105
- isStepEdge,
2106
- cursor: selectable || isStepEdge ? "pointer" : "default"
2107
- }), className);
2108
- $[11] = className;
2109
- $[12] = isStepEdge;
2110
- $[13] = pointerEvents;
2111
- $[14] = selectable;
2112
- $[15] = t9;
2113
- } else t9 = $[15];
2114
- const t10 = isHovered && !selected ? 1.06 : 1;
2115
- let t11;
2116
- if ($[16] !== t10) {
2117
- t11 = { scale: t10 };
2118
- $[16] = t10;
2119
- $[17] = t11;
2120
- } else t11 = $[17];
2121
- let t12;
2122
- if ($[18] !== isStepEdge || $[19] !== stepNum) {
2123
- t12 = isStepEdge && stepNum && /* @__PURE__ */ jsx(Box, {
2124
- className: "likec4-edge-label__step-number",
2125
- children: stepNum
2126
- });
2127
- $[18] = isStepEdge;
2128
- $[19] = stepNum;
2129
- $[20] = t12;
2130
- } else t12 = $[20];
2131
- let t13;
2132
- if ($[21] !== children || $[22] !== hasLabel || $[23] !== label || $[24] !== technology) {
2133
- t13 = hasLabel && /* @__PURE__ */ jsxs(Box, {
2134
- className: "likec4-edge-label__contents",
2135
- children: [
2136
- e(label) && /* @__PURE__ */ jsx(Box, {
2137
- lineClamp: 5,
2138
- className: "likec4-edge-label__text",
2139
- children: label
2140
- }),
2141
- e(technology) && /* @__PURE__ */ jsx(Box, {
2142
- className: "likec4-edge-label__technology",
2143
- children: "[ " + technology + " ]"
2144
- }),
2145
- children
2146
- ]
2147
- });
2148
- $[21] = children;
2149
- $[22] = hasLabel;
2150
- $[23] = label;
2151
- $[24] = technology;
2152
- $[25] = t13;
2153
- } else t13 = $[25];
2154
- let t14;
2155
- if ($[26] !== id || $[27] !== ref || $[28] !== rest || $[29] !== t11 || $[30] !== t12 || $[31] !== t13 || $[32] !== t9) {
2156
- t14 = /* @__PURE__ */ jsxs(MotionDiv, {
2157
- ref,
2158
- className: t9,
2159
- "data-edge-id": id,
2160
- animate: t11,
2161
- ...rest,
2162
- children: [t12, t13]
2163
- });
2164
- $[26] = id;
2165
- $[27] = ref;
2166
- $[28] = rest;
2167
- $[29] = t11;
2168
- $[30] = t12;
2169
- $[31] = t13;
2170
- $[32] = t9;
2171
- $[33] = t14;
2172
- } else t14 = $[33];
2173
- return t14;
2174
- });
2175
- EdgeLabel.displayName = "EdgeLabel";
2176
- //#endregion
2177
- //#region ../diagram/src/base-primitives/edge/EdgeLabelContainer.tsx
2178
- var toCssVarValue = (value) => {
2179
- if (value === void 0) return "";
2180
- return e$1(value) ? `${Math.trunc(value)}px` : value;
2181
- };
2182
- function EdgeLabelContainer(t0) {
2183
- const $ = c(42);
2184
- let children;
2185
- let className;
2186
- let contentStyle;
2187
- let labelXY;
2188
- let rest;
2189
- let t1;
2190
- if ($[0] !== t0) {
2191
- ({edgeProps: t1, labelPosition: labelXY, className, style: contentStyle, children, ...rest} = t0);
2192
- $[0] = t0;
2193
- $[1] = children;
2194
- $[2] = className;
2195
- $[3] = contentStyle;
2196
- $[4] = labelXY;
2197
- $[5] = rest;
2198
- $[6] = t1;
2199
- } else {
2200
- children = $[1];
2201
- className = $[2];
2202
- contentStyle = $[3];
2203
- labelXY = $[4];
2204
- rest = $[5];
2205
- t1 = $[6];
2206
- }
2207
- let { id, selected: t2, data: t3, animated } = t1;
2208
- const selected = t2 === void 0 ? false : t2;
2209
- const { hovered: t4, active: t5, dimmed: t6, labelBBox, color: t7 } = t3;
2210
- const isHovered = t4 === void 0 ? false : t4;
2211
- const isActive = t5 === void 0 ? false : t5;
2212
- const isDimmed = t6 === void 0 ? false : t6;
2213
- const color = t7 === void 0 ? "gray" : t7;
2214
- const labelX = labelXY?.x ?? labelBBox?.x;
2215
- const labelY = labelXY?.y ?? labelBBox?.y;
2216
- if (labelX === void 0 || labelY === void 0) return null;
2217
- const translate = labelXY?.translate ?? "";
2218
- animated = animated || isActive;
2219
- const t8 = id;
2220
- let t9;
2221
- if ($[7] !== className) {
2222
- t9 = cx("nodrag nopan", "likec4-edge-label-container", className);
2223
- $[7] = className;
2224
- $[8] = t9;
2225
- } else t9 = $[8];
2226
- const t10 = animated || isActive;
2227
- let t11;
2228
- if ($[9] !== animated) {
2229
- t11 = animated && { "data-likec4-animated": animated };
2230
- $[9] = animated;
2231
- $[10] = t11;
2232
- } else t11 = $[10];
2233
- let t12;
2234
- if ($[11] !== selected) {
2235
- t12 = selected !== false && { "data-likec4-selected": selected };
2236
- $[11] = selected;
2237
- $[12] = t12;
2238
- } else t12 = $[12];
2239
- let t13;
2240
- if ($[13] !== isDimmed) {
2241
- t13 = isDimmed !== false && { "data-likec4-dimmed": isDimmed };
2242
- $[13] = isDimmed;
2243
- $[14] = t13;
2244
- } else t13 = $[14];
2245
- let t14;
2246
- if ($[15] !== labelX) {
2247
- t14 = toCssVarValue(labelX);
2248
- $[15] = labelX;
2249
- $[16] = t14;
2250
- } else t14 = $[16];
2251
- let t15;
2252
- if ($[17] !== labelY) {
2253
- t15 = toCssVarValue(labelY);
2254
- $[17] = labelY;
2255
- $[18] = t15;
2256
- } else t15 = $[18];
2257
- const t16 = `translate(${t14}, ${t15}) ${translate}`;
2258
- let t17;
2259
- if ($[19] !== t16) {
2260
- t17 = { transform: t16 };
2261
- $[19] = t16;
2262
- $[20] = t17;
2263
- } else t17 = $[20];
2264
- let t18;
2265
- if ($[21] !== labelBBox) {
2266
- t18 = labelBBox && { maxWidth: labelBBox.width + 20 };
2267
- $[21] = labelBBox;
2268
- $[22] = t18;
2269
- } else t18 = $[22];
2270
- let t19;
2271
- if ($[23] !== contentStyle || $[24] !== t18) {
2272
- t19 = {
2273
- ...contentStyle,
2274
- ...t18
2275
- };
2276
- $[23] = contentStyle;
2277
- $[24] = t18;
2278
- $[25] = t19;
2279
- } else t19 = $[25];
2280
- let t20;
2281
- if ($[26] !== children || $[27] !== t19) {
2282
- t20 = /* @__PURE__ */ jsx("div", {
2283
- style: t19,
2284
- children
2285
- });
2286
- $[26] = children;
2287
- $[27] = t19;
2288
- $[28] = t20;
2289
- } else t20 = $[28];
2290
- let t21;
2291
- if ($[29] !== color || $[30] !== id || $[31] !== isActive || $[32] !== isHovered || $[33] !== rest || $[34] !== t10 || $[35] !== t11 || $[36] !== t12 || $[37] !== t13 || $[38] !== t17 || $[39] !== t20 || $[40] !== t9) {
2292
- t21 = /* @__PURE__ */ jsx(EdgeLabelRenderer, { children: /* @__PURE__ */ jsx("div", {
2293
- ...rest,
2294
- className: t9,
2295
- "data-likec4-hovered": isHovered,
2296
- "data-likec4-color": color,
2297
- "data-edge-active": isActive,
2298
- "data-edge-animated": t10,
2299
- ...t11,
2300
- ...t12,
2301
- ...t13,
2302
- style: t17,
2303
- children: t20
2304
- }, t8) });
2305
- $[29] = color;
2306
- $[30] = id;
2307
- $[31] = isActive;
2308
- $[32] = isHovered;
2309
- $[33] = rest;
2310
- $[34] = t10;
2311
- $[35] = t11;
2312
- $[36] = t12;
2313
- $[37] = t13;
2314
- $[38] = t17;
2315
- $[39] = t20;
2316
- $[40] = t9;
2317
- $[41] = t21;
2318
- } else t21 = $[41];
2319
- return t21;
2320
- }
2321
- //#endregion
2322
- //#region ../diagram/src/base-primitives/edge/EdgeMarkers.tsx
2323
- var Open = (props) => {
2324
- const $ = c(3);
2325
- let t0;
2326
- if ($[0] === Symbol.for("react.memo_cache_sentinel")) {
2327
- t0 = /* @__PURE__ */ jsx("path", {
2328
- d: "M0,0 L7,4 L0,8 L4,4 Z",
2329
- stroke: "context-stroke",
2330
- fill: "context-stroke",
2331
- strokeDasharray: 0,
2332
- strokeWidth: 1,
2333
- strokeLinecap: "round"
2334
- });
2335
- $[0] = t0;
2336
- } else t0 = $[0];
2337
- let t1;
2338
- if ($[1] !== props) {
2339
- t1 = /* @__PURE__ */ jsx("marker", {
2340
- viewBox: "-4 -4 14 16",
2341
- refX: 5,
2342
- refY: 4,
2343
- markerWidth: "7",
2344
- markerHeight: "8",
2345
- preserveAspectRatio: "xMaxYMid meet",
2346
- orient: "auto-start-reverse",
2347
- ...props,
2348
- children: t0
2349
- });
2350
- $[1] = props;
2351
- $[2] = t1;
2352
- } else t1 = $[2];
2353
- return t1;
2354
- };
2355
- var Arrow = (props) => {
2356
- const $ = c(3);
2357
- let t0;
2358
- if ($[0] === Symbol.for("react.memo_cache_sentinel")) {
2359
- t0 = /* @__PURE__ */ jsx("path", {
2360
- d: "M 0 0 L 8 3 L 0 6 L 1 3 z",
2361
- fill: "context-stroke",
2362
- strokeWidth: 0
2363
- });
2364
- $[0] = t0;
2365
- } else t0 = $[0];
2366
- let t1;
2367
- if ($[1] !== props) {
2368
- t1 = /* @__PURE__ */ jsx("marker", {
2369
- viewBox: "-1 -1 12 10",
2370
- refX: 4,
2371
- refY: 3,
2372
- markerWidth: "8",
2373
- markerHeight: "6",
2374
- preserveAspectRatio: "xMaxYMid meet",
2375
- orient: "auto-start-reverse",
2376
- ...props,
2377
- children: t0
2378
- });
2379
- $[1] = props;
2380
- $[2] = t1;
2381
- } else t1 = $[2];
2382
- return t1;
2383
- };
2384
- var Crow = (props) => {
2385
- const $ = c(3);
2386
- let t0;
2387
- if ($[0] === Symbol.for("react.memo_cache_sentinel")) {
2388
- t0 = /* @__PURE__ */ jsx("path", {
2389
- d: "M 8 0 L 0 4 L 8 8 M 8 4 L 0 4",
2390
- fill: "none",
2391
- strokeWidth: 1
2392
- });
2393
- $[0] = t0;
2394
- } else t0 = $[0];
2395
- let t1;
2396
- if ($[1] !== props) {
2397
- t1 = /* @__PURE__ */ jsx("marker", {
2398
- viewBox: "-1 -1 12 12",
2399
- refX: 8,
2400
- refY: 4,
2401
- markerWidth: "8",
2402
- markerHeight: "8",
2403
- preserveAspectRatio: "xMaxYMid meet",
2404
- orient: "auto-start-reverse",
2405
- ...props,
2406
- children: t0
2407
- });
2408
- $[1] = props;
2409
- $[2] = t1;
2410
- } else t1 = $[2];
2411
- return t1;
2412
- };
2413
- var OArrow = (props) => {
2414
- const $ = c(3);
2415
- let t0;
2416
- if ($[0] === Symbol.for("react.memo_cache_sentinel")) {
2417
- t0 = /* @__PURE__ */ jsx("path", {
2418
- d: "M 0 0 L 8 3 L 0 6 L 1 3 z",
2419
- stroke: "context-stroke",
2420
- fill: "var(--likec4-background-color)",
2421
- strokeWidth: 1.25,
2422
- strokeLinejoin: "miter",
2423
- strokeLinecap: "square"
2424
- });
2425
- $[0] = t0;
2426
- } else t0 = $[0];
2427
- let t1;
2428
- if ($[1] !== props) {
2429
- t1 = /* @__PURE__ */ jsx("marker", {
2430
- viewBox: "-1 -1 12 10",
2431
- refX: 4,
2432
- refY: 3,
2433
- markerWidth: "8",
2434
- markerHeight: "6",
2435
- preserveAspectRatio: "xMaxYMid meet",
2436
- orient: "auto-start-reverse",
2437
- ...props,
2438
- children: t0
2439
- });
2440
- $[1] = props;
2441
- $[2] = t1;
2442
- } else t1 = $[2];
2443
- return t1;
2444
- };
2445
- var Diamond = (props) => {
2446
- const $ = c(3);
2447
- let t0;
2448
- if ($[0] === Symbol.for("react.memo_cache_sentinel")) {
2449
- t0 = /* @__PURE__ */ jsx("path", {
2450
- d: "M5,0 L10,4 L5,8 L0,4 Z",
2451
- fill: "context-stroke",
2452
- strokeWidth: 0,
2453
- strokeLinecap: "round"
2454
- });
2455
- $[0] = t0;
2456
- } else t0 = $[0];
2457
- let t1;
2458
- if ($[1] !== props) {
2459
- t1 = /* @__PURE__ */ jsx("marker", {
2460
- viewBox: "-4 -4 16 14",
2461
- refX: 5,
2462
- refY: 4,
2463
- markerWidth: "10",
2464
- markerHeight: "8",
2465
- preserveAspectRatio: "xMaxYMid meet",
2466
- orient: "auto-start-reverse",
2467
- ...props,
2468
- children: t0
2469
- });
2470
- $[1] = props;
2471
- $[2] = t1;
2472
- } else t1 = $[2];
2473
- return t1;
2474
- };
2475
- var ODiamond = (props) => {
2476
- const $ = c(3);
2477
- let t0;
2478
- if ($[0] === Symbol.for("react.memo_cache_sentinel")) {
2479
- t0 = /* @__PURE__ */ jsx("path", {
2480
- d: "M5,0 L10,4 L5,8 L0,4 Z",
2481
- stroke: "context-stroke",
2482
- fill: "var(--likec4-background-color)",
2483
- strokeWidth: 1.25,
2484
- strokeLinecap: "round"
2485
- });
2486
- $[0] = t0;
2487
- } else t0 = $[0];
2488
- let t1;
2489
- if ($[1] !== props) {
2490
- t1 = /* @__PURE__ */ jsx("marker", {
2491
- viewBox: "-4 -4 16 14",
2492
- refX: 6,
2493
- refY: 4,
2494
- markerWidth: "10",
2495
- markerHeight: "8",
2496
- preserveAspectRatio: "xMaxYMid meet",
2497
- orient: "auto-start-reverse",
2498
- ...props,
2499
- children: t0
2500
- });
2501
- $[1] = props;
2502
- $[2] = t1;
2503
- } else t1 = $[2];
2504
- return t1;
2505
- };
2506
- var Dot = (props) => {
2507
- const $ = c(3);
2508
- let t0;
2509
- if ($[0] === Symbol.for("react.memo_cache_sentinel")) {
2510
- t0 = /* @__PURE__ */ jsx("circle", {
2511
- strokeWidth: 0,
2512
- fill: "context-stroke",
2513
- cx: 4,
2514
- cy: 4,
2515
- r: 3
2516
- });
2517
- $[0] = t0;
2518
- } else t0 = $[0];
2519
- let t1;
2520
- if ($[1] !== props) {
2521
- t1 = /* @__PURE__ */ jsx("marker", {
2522
- viewBox: "0 0 10 10",
2523
- refX: 4,
2524
- refY: 4,
2525
- markerWidth: "6",
2526
- markerHeight: "6",
2527
- ...props,
2528
- children: t0
2529
- });
2530
- $[1] = props;
2531
- $[2] = t1;
2532
- } else t1 = $[2];
2533
- return t1;
2534
- };
2535
- var ODot = (props) => {
2536
- const $ = c(3);
2537
- let t0;
2538
- if ($[0] === Symbol.for("react.memo_cache_sentinel")) {
2539
- t0 = /* @__PURE__ */ jsx("circle", {
2540
- strokeWidth: 1.25,
2541
- stroke: "context-stroke",
2542
- fill: "var(--likec4-background-color)",
2543
- cx: 4,
2544
- cy: 4,
2545
- r: 3
2546
- });
2547
- $[0] = t0;
2548
- } else t0 = $[0];
2549
- let t1;
2550
- if ($[1] !== props) {
2551
- t1 = /* @__PURE__ */ jsx("marker", {
2552
- viewBox: "0 0 10 10",
2553
- refX: 4,
2554
- refY: 4,
2555
- markerWidth: "6",
2556
- markerHeight: "6",
2557
- ...props,
2558
- children: t0
2559
- });
2560
- $[1] = props;
2561
- $[2] = t1;
2562
- } else t1 = $[2];
2563
- return t1;
2564
- };
2565
- var EdgeMarkers = {
2566
- Arrow,
2567
- Crow,
2568
- OArrow,
2569
- Open,
2570
- Diamond,
2571
- ODiamond,
2572
- Dot,
2573
- ODot
2574
- };
2575
- function arrowTypeToMarker(arrowType) {
2576
- if (!arrowType || arrowType === "none") return;
2577
- switch (arrowType) {
2578
- case "normal": return "Arrow";
2579
- case "crow": return "Crow";
2580
- case "onormal": return "OArrow";
2581
- case "diamond": return "Diamond";
2582
- case "odiamond": return "ODiamond";
2583
- case "open":
2584
- case "vee": return "Open";
2585
- case "dot": return "Dot";
2586
- case "odot": return `ODot`;
2587
- default: nonexhaustive(arrowType);
2588
- }
2589
- }
2590
- //#endregion
2591
- //#region ../diagram/src/base-primitives/edge/EdgePath.tsx
2592
- var EdgePath = forwardRef((t0, svgPathRef) => {
2593
- const $ = c(54);
2594
- const { edgeProps: t1, isDragging: t2, onEdgePointerDown, strokeWidth, svgPath } = t0;
2595
- const { id, data: t3, selectable: t4, style, interactionWidth } = t1;
2596
- const { line, dir, tail, head } = t3;
2597
- const selectable = t4 === void 0 ? true : t4;
2598
- const isDragging = t2 === void 0 ? false : t2;
2599
- let markerStartName = arrowTypeToMarker(tail);
2600
- let markerEndName = arrowTypeToMarker(head ?? "normal");
2601
- if (dir === "back") [markerStartName, markerEndName] = [markerEndName, markerStartName];
2602
- const MarkerStart = markerStartName ? EdgeMarkers[markerStartName] : null;
2603
- const MarkerEnd = markerEndName ? EdgeMarkers[markerEndName] : null;
2604
- const isDotted = line === "dotted";
2605
- const isDashed = isDotted || line === "dashed";
2606
- let strokeDasharray;
2607
- if (isDotted) strokeDasharray = "1,8";
2608
- else if (isDashed) strokeDasharray = "8,10";
2609
- let t10;
2610
- let t11;
2611
- let t12;
2612
- let t5;
2613
- let t6;
2614
- let t7;
2615
- let t8;
2616
- let t9;
2617
- if ($[0] !== MarkerEnd || $[1] !== MarkerStart || $[2] !== id || $[3] !== interactionWidth || $[4] !== isDragging || $[5] !== onEdgePointerDown || $[6] !== selectable || $[7] !== style || $[8] !== svgPath || $[9] !== svgPathRef) {
2618
- const classes = edgePath();
2619
- if ($[18] !== interactionWidth || $[19] !== isDragging || $[20] !== onEdgePointerDown || $[21] !== selectable || $[22] !== svgPath) {
2620
- t11 = selectable && /* @__PURE__ */ jsx("path", {
2621
- className: cx("react-flow__edge-interaction", css({ fill: "none" })),
2622
- onPointerDown: onEdgePointerDown,
2623
- d: svgPath,
2624
- style: {
2625
- strokeWidth: interactionWidth ?? 10,
2626
- stroke: "currentcolor",
2627
- strokeOpacity: 0,
2628
- ...isDragging ? { display: "none" } : {}
2629
- }
2630
- });
2631
- $[18] = interactionWidth;
2632
- $[19] = isDragging;
2633
- $[20] = onEdgePointerDown;
2634
- $[21] = selectable;
2635
- $[22] = svgPath;
2636
- $[23] = t11;
2637
- } else t11 = $[23];
2638
- const t13 = `path("${svgPath}")`;
2639
- let t14;
2640
- if ($[24] !== t13) {
2641
- t14 = { offsetPath: t13 };
2642
- $[24] = t13;
2643
- $[25] = t14;
2644
- } else t14 = $[25];
2645
- t12 = /* @__PURE__ */ jsx("circle", {
2646
- className: cx("likec4-edge-middle-point", classes.middlePoint),
2647
- "data-edge-id": id,
2648
- style: t14
2649
- });
2650
- t7 = classes.markersCtx;
2651
- t8 = onEdgePointerDown;
2652
- let t15;
2653
- if ($[26] !== MarkerStart || $[27] !== id) {
2654
- t15 = MarkerStart && /* @__PURE__ */ jsx(MarkerStart, { id: "start" + id });
2655
- $[26] = MarkerStart;
2656
- $[27] = id;
2657
- $[28] = t15;
2658
- } else t15 = $[28];
2659
- let t16;
2660
- if ($[29] !== MarkerEnd || $[30] !== id) {
2661
- t16 = MarkerEnd && /* @__PURE__ */ jsx(MarkerEnd, { id: "end" + id });
2662
- $[29] = MarkerEnd;
2663
- $[30] = id;
2664
- $[31] = t16;
2665
- } else t16 = $[31];
2666
- if ($[32] !== t15 || $[33] !== t16) {
2667
- t9 = /* @__PURE__ */ jsxs("defs", { children: [t15, t16] });
2668
- $[32] = t15;
2669
- $[33] = t16;
2670
- $[34] = t9;
2671
- } else t9 = $[34];
2672
- t10 = /* @__PURE__ */ jsx("path", {
2673
- className: cx("react-flow__edge-path", "hide-on-reduced-graphics", classes.pathBg, isDragging && css({ display: "none" })),
2674
- d: svgPath,
2675
- style,
2676
- strokeLinecap: "round"
2677
- });
2678
- t5 = svgPathRef;
2679
- t6 = cx("react-flow__edge-path", classes.path, selectable && "react-flow__edge-interaction");
2680
- $[0] = MarkerEnd;
2681
- $[1] = MarkerStart;
2682
- $[2] = id;
2683
- $[3] = interactionWidth;
2684
- $[4] = isDragging;
2685
- $[5] = onEdgePointerDown;
2686
- $[6] = selectable;
2687
- $[7] = style;
2688
- $[8] = svgPath;
2689
- $[9] = svgPathRef;
2690
- $[10] = t10;
2691
- $[11] = t11;
2692
- $[12] = t12;
2693
- $[13] = t5;
2694
- $[14] = t6;
2695
- $[15] = t7;
2696
- $[16] = t8;
2697
- $[17] = t9;
2698
- } else {
2699
- t10 = $[10];
2700
- t11 = $[11];
2701
- t12 = $[12];
2702
- t5 = $[13];
2703
- t6 = $[14];
2704
- t7 = $[15];
2705
- t8 = $[16];
2706
- t9 = $[17];
2707
- }
2708
- const t13 = MarkerStart ? `url(#start${id})` : void 0;
2709
- const t14 = MarkerEnd ? `url(#end${id})` : void 0;
2710
- let t15;
2711
- if ($[35] !== strokeDasharray || $[36] !== strokeWidth || $[37] !== style || $[38] !== svgPath || $[39] !== t13 || $[40] !== t14 || $[41] !== t5 || $[42] !== t6) {
2712
- t15 = /* @__PURE__ */ jsx("path", {
2713
- ref: t5,
2714
- className: t6,
2715
- d: svgPath,
2716
- style,
2717
- strokeWidth,
2718
- strokeLinecap: "round",
2719
- strokeDasharray,
2720
- markerStart: t13,
2721
- markerEnd: t14
2722
- });
2723
- $[35] = strokeDasharray;
2724
- $[36] = strokeWidth;
2725
- $[37] = style;
2726
- $[38] = svgPath;
2727
- $[39] = t13;
2728
- $[40] = t14;
2729
- $[41] = t5;
2730
- $[42] = t6;
2731
- $[43] = t15;
2732
- } else t15 = $[43];
2733
- let t16;
2734
- if ($[44] !== t10 || $[45] !== t15 || $[46] !== t7 || $[47] !== t8 || $[48] !== t9) {
2735
- t16 = /* @__PURE__ */ jsxs("g", {
2736
- className: t7,
2737
- onPointerDown: t8,
2738
- children: [
2739
- t9,
2740
- t10,
2741
- t15
2742
- ]
2743
- });
2744
- $[44] = t10;
2745
- $[45] = t15;
2746
- $[46] = t7;
2747
- $[47] = t8;
2748
- $[48] = t9;
2749
- $[49] = t16;
2750
- } else t16 = $[49];
2751
- let t17;
2752
- if ($[50] !== t11 || $[51] !== t12 || $[52] !== t16) {
2753
- t17 = /* @__PURE__ */ jsxs(Fragment$1, { children: [
2754
- t11,
2755
- t12,
2756
- t16
2757
- ] });
2758
- $[50] = t11;
2759
- $[51] = t12;
2760
- $[52] = t16;
2761
- $[53] = t17;
2762
- } else t17 = $[53];
2763
- return t17;
2764
- });
2765
- EdgePath.displayName = "EdgePath";
2766
- //#endregion
2767
- //#region ../diagram/src/base-primitives/element/ElementActionButtons.tsx
2768
- var variants$1 = {
2769
- normal: {
2770
- originY: 0,
2771
- opacity: .75,
2772
- scale: .8,
2773
- y: 0
2774
- },
2775
- selected: {
2776
- originY: 0,
2777
- opacity: 1,
2778
- scale: .9,
2779
- y: 7
2780
- },
2781
- hovered: {
2782
- originY: 0,
2783
- opacity: 1,
2784
- scale: 1.12,
2785
- y: 7
2786
- }
2787
- };
2788
- /**
2789
- * Center-Bottom bar with action buttons. Intended to be used inside "leaf" nodes.
2790
- *
2791
- * @param selected - Whether the node is selected
2792
- * @param data - Node data
2793
- * @param buttons - Action buttons
2794
- *
2795
- * @example
2796
- * ```tsx
2797
- * <ElementActionButtons
2798
- * {...nodeProps}
2799
- * Buttons={[
2800
- * {
2801
- * key: 'action1',
2802
- * icon: <IconZoomScan />,
2803
- * onClick: (e) => {
2804
- * e.stopPropagation()
2805
- * console.log('action1 clicked')
2806
- * },
2807
- * },
2808
- * //...
2809
- * ]}
2810
- * />
2811
- * ```
2812
- */
2813
- function ElementActionButtons(t0) {
2814
- const $ = c(14);
2815
- const { selected: t1, data: t2, buttons } = t0;
2816
- const selected = t1 === void 0 ? false : t1;
2817
- const { hovered: t3 } = t2;
2818
- const isHovered = t3 === void 0 ? false : t3;
2819
- const id = useId$1$1();
2820
- if (!buttons.length) return null;
2821
- let variant;
2822
- bb0: switch (true) {
2823
- case isHovered:
2824
- variant = "hovered";
2825
- break bb0;
2826
- case selected:
2827
- variant = "selected";
2828
- break bb0;
2829
- default: variant = "normal";
2830
- }
2831
- const isActionVisible = isHovered || selected;
2832
- let t4;
2833
- if ($[0] === Symbol.for("react.memo_cache_sentinel")) {
2834
- t4 = actionButtons();
2835
- $[0] = t4;
2836
- } else t4 = $[0];
2837
- const t5 = variant;
2838
- const t6 = `${isHovered}-${selected}`;
2839
- let t7;
2840
- if ($[1] === Symbol.for("react.memo_cache_sentinel")) {
2841
- t7 = cx("nodrag nopan");
2842
- $[1] = t7;
2843
- } else t7 = $[1];
2844
- let t8;
2845
- if ($[2] !== buttons || $[3] !== id || $[4] !== isActionVisible) {
2846
- let t9;
2847
- if ($[6] !== id || $[7] !== isActionVisible) {
2848
- t9 = (button, index) => /* @__PURE__ */ jsx(ActionIcon, {
2849
- component: MotionButton,
2850
- className: actionBtn({}),
2851
- initial: false,
2852
- whileTap: { scale: 1 },
2853
- whileHover: { scale: 1.3 },
2854
- tabIndex: isActionVisible ? 0 : -1,
2855
- inert: isActionVisible ? void 0 : true,
2856
- "aria-label": button.ariaLabel ?? button.key ?? "Element action",
2857
- onClick: button.onClick,
2858
- onDoubleClick: stopPropagation,
2859
- children: button.icon || /* @__PURE__ */ jsx(IconBolt, {})
2860
- }, `${id}-${button.key ?? index}`);
2861
- $[6] = id;
2862
- $[7] = isActionVisible;
2863
- $[8] = t9;
2864
- } else t9 = $[8];
2865
- t8 = buttons.map(t9);
2866
- $[2] = buttons;
2867
- $[3] = id;
2868
- $[4] = isActionVisible;
2869
- $[5] = t8;
2870
- } else t8 = $[5];
2871
- let t9;
2872
- if ($[9] !== isHovered || $[10] !== t6 || $[11] !== t8 || $[12] !== variant) {
2873
- t9 = /* @__PURE__ */ jsx("div", {
2874
- className: t4,
2875
- children: /* @__PURE__ */ jsx(MotionDiv, {
2876
- layoutRoot: true,
2877
- initial: false,
2878
- variants: variants$1,
2879
- animate: t5,
2880
- layoutDependency: t6,
2881
- "data-likec4-hovered": isHovered,
2882
- className: t7,
2883
- onClick: stopPropagation,
2884
- children: t8
2885
- })
2886
- });
2887
- $[9] = isHovered;
2888
- $[10] = t6;
2889
- $[11] = t8;
2890
- $[12] = variant;
2891
- $[13] = t9;
2892
- } else t9 = $[13];
2893
- return t9;
2894
- }
2895
- //#endregion
2896
- //#region ../diagram/src/base-primitives/element/ElementData.tsx
2897
- /**
2898
- * Resolve the icon color based on the node's style and color.
2899
- *
2900
- * If the node's style icon color is not defined, returns undefined.
2901
- * If the node's style icon color is the same as the node's color, returns the stroke color.
2902
- * Otherwise, returns the fill color.
2903
- */
2904
- var resolveIconColor = (styles, data) => {
2905
- const iconColor = data.style.iconColor;
2906
- if (!iconColor) return;
2907
- const colors = styles.colors(iconColor).elements;
2908
- return iconColor === data.color ? colors.stroke : colors.fill;
2909
- };
2910
- function shouldBlendIconWithPalette(icon, hasIconColor) {
2911
- return !hasIconColor && icon?.startsWith("bootstrap:") === true;
2912
- }
2913
- var Root = forwardRef((t0, ref) => {
2914
- const $ = c(37);
2915
- let className;
2916
- let data;
2917
- let props;
2918
- let style;
2919
- if ($[0] !== t0) {
2920
- ({className, style, data, ...props} = t0);
2921
- $[0] = t0;
2922
- $[1] = className;
2923
- $[2] = data;
2924
- $[3] = props;
2925
- $[4] = style;
2926
- } else {
2927
- className = $[1];
2928
- data = $[2];
2929
- props = $[3];
2930
- style = $[4];
2931
- }
2932
- const styles = useLikeC4Styles();
2933
- let t1;
2934
- if ($[5] !== data || $[6] !== styles) {
2935
- t1 = data.style.sizing === "fixed" ? styles.fitNodeContent({
2936
- ...data,
2937
- shape: data.shape ?? styles.defaults.shape
2938
- }) : null;
2939
- $[5] = data;
2940
- $[6] = styles;
2941
- $[7] = t1;
2942
- } else t1 = $[7];
2943
- const fitted = t1;
2944
- let t2;
2945
- if ($[8] !== data.style || $[9] !== fitted?.iconSize || $[10] !== styles) {
2946
- t2 = fitted?.iconSize ?? (data.style.iconSize ? styles.nodeSizes(data.style).values.iconSize : void 0);
2947
- $[8] = data.style;
2948
- $[9] = fitted?.iconSize;
2949
- $[10] = styles;
2950
- $[11] = t2;
2951
- } else t2 = $[11];
2952
- const iconSize = t2;
2953
- let t3;
2954
- if ($[12] !== data || $[13] !== styles) {
2955
- t3 = resolveIconColor(styles, data);
2956
- $[12] = data;
2957
- $[13] = styles;
2958
- $[14] = t3;
2959
- } else t3 = $[14];
2960
- const resolvedIconColor = t3;
2961
- const hasIconColor = !!resolvedIconColor;
2962
- let t4;
2963
- if ($[15] !== className || $[16] !== data.icon || $[17] !== data.style.iconPosition || $[18] !== data.style.sizing || $[19] !== hasIconColor) {
2964
- t4 = cx(className, elementNodeData({
2965
- iconPosition: data.style.iconPosition,
2966
- withIconColor: hasIconColor,
2967
- withIconBlend: shouldBlendIconWithPalette(data.icon, hasIconColor),
2968
- sizing: data.style.sizing ?? "auto"
2969
- }), "likec4-element");
2970
- $[15] = className;
2971
- $[16] = data.icon;
2972
- $[17] = data.style.iconPosition;
2973
- $[18] = data.style.sizing;
2974
- $[19] = hasIconColor;
2975
- $[20] = t4;
2976
- } else t4 = $[20];
2977
- let t5;
2978
- if ($[21] !== iconSize) {
2979
- t5 = iconSize && { "--likec4-icon-size": `${iconSize}px` };
2980
- $[21] = iconSize;
2981
- $[22] = t5;
2982
- } else t5 = $[22];
2983
- let t6;
2984
- if ($[23] !== fitted) {
2985
- t6 = fitted && { "--likec4-text-size": `${fitted.textSize}px` };
2986
- $[23] = fitted;
2987
- $[24] = t6;
2988
- } else t6 = $[24];
2989
- let t7;
2990
- if ($[25] !== resolvedIconColor) {
2991
- t7 = resolvedIconColor && { "--likec4-icon-color": resolvedIconColor };
2992
- $[25] = resolvedIconColor;
2993
- $[26] = t7;
2994
- } else t7 = $[26];
2995
- let t8;
2996
- if ($[27] !== style || $[28] !== t5 || $[29] !== t6 || $[30] !== t7) {
2997
- t8 = {
2998
- ...style,
2999
- ...t5,
3000
- ...t6,
3001
- ...t7
3002
- };
3003
- $[27] = style;
3004
- $[28] = t5;
3005
- $[29] = t6;
3006
- $[30] = t7;
3007
- $[31] = t8;
3008
- } else t8 = $[31];
3009
- let t9;
3010
- if ($[32] !== props || $[33] !== ref || $[34] !== t4 || $[35] !== t8) {
3011
- t9 = /* @__PURE__ */ jsx("div", {
3012
- ...props,
3013
- ref,
3014
- className: t4,
3015
- style: t8
3016
- });
3017
- $[32] = props;
3018
- $[33] = ref;
3019
- $[34] = t4;
3020
- $[35] = t8;
3021
- $[36] = t9;
3022
- } else t9 = $[36];
3023
- return t9;
3024
- });
3025
- var Icon = (t0) => {
3026
- const $ = c(6);
3027
- let data;
3028
- let props;
3029
- if ($[0] !== t0) {
3030
- ({data, ...props} = t0);
3031
- $[0] = t0;
3032
- $[1] = data;
3033
- $[2] = props;
3034
- } else {
3035
- data = $[1];
3036
- props = $[2];
3037
- }
3038
- let t1;
3039
- if ($[3] !== data || $[4] !== props) {
3040
- t1 = /* @__PURE__ */ jsx(IconRenderer, {
3041
- element: data,
3042
- ...props
3043
- });
3044
- $[3] = data;
3045
- $[4] = props;
3046
- $[5] = t1;
3047
- } else t1 = $[5];
3048
- return t1;
3049
- };
3050
- var Content = forwardRef((t0, ref) => {
3051
- const $ = c(9);
3052
- let className;
3053
- let props;
3054
- if ($[0] !== t0) {
3055
- ({className, ...props} = t0);
3056
- $[0] = t0;
3057
- $[1] = className;
3058
- $[2] = props;
3059
- } else {
3060
- className = $[1];
3061
- props = $[2];
3062
- }
3063
- let t1;
3064
- if ($[3] !== className) {
3065
- t1 = cx(className, "likec4-element-node-content");
3066
- $[3] = className;
3067
- $[4] = t1;
3068
- } else t1 = $[4];
3069
- let t2;
3070
- if ($[5] !== props || $[6] !== ref || $[7] !== t1) {
3071
- t2 = /* @__PURE__ */ jsx("div", {
3072
- ...props,
3073
- className: t1,
3074
- ref
3075
- });
3076
- $[5] = props;
3077
- $[6] = ref;
3078
- $[7] = t1;
3079
- $[8] = t2;
3080
- } else t2 = $[8];
3081
- return t2;
3082
- });
3083
- var Title = forwardRef((t0, ref) => {
3084
- const $ = c(11);
3085
- let className;
3086
- let props;
3087
- let t1;
3088
- if ($[0] !== t0) {
3089
- ({data: t1, className, ...props} = t0);
3090
- $[0] = t0;
3091
- $[1] = className;
3092
- $[2] = props;
3093
- $[3] = t1;
3094
- } else {
3095
- className = $[1];
3096
- props = $[2];
3097
- t1 = $[3];
3098
- }
3099
- const { title } = t1;
3100
- let t2;
3101
- if ($[4] !== className) {
3102
- t2 = cx(className, "likec4-element-title");
3103
- $[4] = className;
3104
- $[5] = t2;
3105
- } else t2 = $[5];
3106
- let t3;
3107
- if ($[6] !== props || $[7] !== ref || $[8] !== t2 || $[9] !== title) {
3108
- t3 = /* @__PURE__ */ jsx("div", {
3109
- ...props,
3110
- className: t2,
3111
- "data-likec4-node-title": "",
3112
- ref,
3113
- children: title
3114
- });
3115
- $[6] = props;
3116
- $[7] = ref;
3117
- $[8] = t2;
3118
- $[9] = title;
3119
- $[10] = t3;
3120
- } else t3 = $[10];
3121
- return t3;
3122
- });
3123
- var Technology = forwardRef((t0, ref) => {
3124
- const $ = c(10);
3125
- let children;
3126
- let className;
3127
- let data;
3128
- let props;
3129
- if ($[0] !== t0) {
3130
- ({data, children, className, ...props} = t0);
3131
- $[0] = t0;
3132
- $[1] = children;
3133
- $[2] = className;
3134
- $[3] = data;
3135
- $[4] = props;
3136
- } else {
3137
- children = $[1];
3138
- className = $[2];
3139
- data = $[3];
3140
- props = $[4];
3141
- }
3142
- const text = data?.technology ?? children;
3143
- let t1;
3144
- if ($[5] !== className || $[6] !== props || $[7] !== ref || $[8] !== text) {
3145
- t1 = e(text) ? /* @__PURE__ */ jsx("div", {
3146
- ...props,
3147
- className: cx(className, "likec4-element-technology"),
3148
- "data-likec4-node-technology": "",
3149
- ref,
3150
- children: text
3151
- }) : null;
3152
- $[5] = className;
3153
- $[6] = props;
3154
- $[7] = ref;
3155
- $[8] = text;
3156
- $[9] = t1;
3157
- } else t1 = $[9];
3158
- return t1;
3159
- });
3160
- var Description = forwardRef((t0, ref) => {
3161
- const $ = c(16);
3162
- let className;
3163
- let props;
3164
- let t1;
3165
- if ($[0] !== t0) {
3166
- ({data: t1, className, ...props} = t0);
3167
- $[0] = t0;
3168
- $[1] = className;
3169
- $[2] = props;
3170
- $[3] = t1;
3171
- } else {
3172
- className = $[1];
3173
- props = $[2];
3174
- t1 = $[3];
3175
- }
3176
- const { description, style } = t1;
3177
- if (!description) return null;
3178
- let t2;
3179
- if ($[4] !== description) {
3180
- t2 = RichText$1.from(description);
3181
- $[4] = description;
3182
- $[5] = t2;
3183
- } else t2 = $[5];
3184
- const desc = t2;
3185
- let t3;
3186
- if ($[6] !== className) {
3187
- t3 = cx(className, "likec4-element-description");
3188
- $[6] = className;
3189
- $[7] = t3;
3190
- } else t3 = $[7];
3191
- const t4 = desc.isMarkdown ? style.sizing === "fixed" ? "calc(var(--likec4-text-size) * 0.74 * 1.2)" : "8rem" : void 0;
3192
- let t5;
3193
- if ($[8] !== t4) {
3194
- t5 = { maxHeight: t4 };
3195
- $[8] = t4;
3196
- $[9] = t5;
3197
- } else t5 = $[9];
3198
- let t6;
3199
- if ($[10] !== desc || $[11] !== props || $[12] !== ref || $[13] !== t3 || $[14] !== t5) {
3200
- t6 = /* @__PURE__ */ jsx(Markdown, {
3201
- ...props,
3202
- className: t3,
3203
- "data-likec4-node-description": "",
3204
- value: desc,
3205
- uselikec4palette: true,
3206
- hideIfEmpty: true,
3207
- style: t5,
3208
- ref
3209
- });
3210
- $[10] = desc;
3211
- $[11] = props;
3212
- $[12] = ref;
3213
- $[13] = t3;
3214
- $[14] = t5;
3215
- $[15] = t6;
3216
- } else t6 = $[15];
3217
- return t6;
3218
- });
3219
- /**
3220
- * Renders an element title, technology, description, and icon.
3221
- *
3222
- * @example
3223
- * ```tsx
3224
- * <ElementData {...nodeProps} />
3225
- * ```
3226
- * or
3227
- * ```tsx
3228
- * <ElementData.Root {...nodeProps} >
3229
- * <ElementData.Icon {...nodeProps} />
3230
- * <ElementData.Content>
3231
- * <ElementData.Title {...nodeProps} />
3232
- * <ElementData.Technology {...nodeProps} />
3233
- * <ElementData.Description {...nodeProps} />
3234
- * </ElementData.Content>
3235
- * </ElementData.Root>
3236
- * ```
3237
- */
3238
- function ElementData(t0) {
3239
- const $ = c(9);
3240
- const { data, "aria-hidden": ariaHidden } = t0;
3241
- let t1;
3242
- if ($[0] !== data) {
3243
- t1 = /* @__PURE__ */ jsx(Icon, { data });
3244
- $[0] = data;
3245
- $[1] = t1;
3246
- } else t1 = $[1];
3247
- let t2;
3248
- if ($[2] !== data) {
3249
- t2 = /* @__PURE__ */ jsxs(Content, { children: [
3250
- /* @__PURE__ */ jsx(Title, { data }),
3251
- /* @__PURE__ */ jsx(Technology, { data }),
3252
- /* @__PURE__ */ jsx(Description, { data })
3253
- ] });
3254
- $[2] = data;
3255
- $[3] = t2;
3256
- } else t2 = $[3];
3257
- let t3;
3258
- if ($[4] !== ariaHidden || $[5] !== data || $[6] !== t1 || $[7] !== t2) {
3259
- t3 = /* @__PURE__ */ jsxs(Root, {
3260
- data,
3261
- "aria-hidden": ariaHidden,
3262
- children: [t1, t2]
3263
- });
3264
- $[4] = ariaHidden;
3265
- $[5] = data;
3266
- $[6] = t1;
3267
- $[7] = t2;
3268
- $[8] = t3;
3269
- } else t3 = $[8];
3270
- return t3;
3271
- }
3272
- ElementData.Root = Root;
3273
- ElementData.Icon = Icon;
3274
- ElementData.Content = Content;
3275
- ElementData.Title = Title;
3276
- ElementData.Technology = Technology;
3277
- ElementData.Description = Description;
3278
- //#endregion
3279
- //#region ../diagram/src/base-primitives/element/ElementNodeContainer.tsx
3280
- var variants = {
3281
- normal: { scale: 1 },
3282
- hovered: { scale: 1.05 },
3283
- selected: { scale: 1.02 },
3284
- tap: { scale: .98 }
3285
- };
3286
- /**
3287
- * Top-level primitive to compose leaf nodes renderers.
3288
- * This container provides the state via data-* attributes
3289
- */
3290
- var ElementNodeContainer = forwardRef((t0, ref) => {
3291
- const $ = c(37);
3292
- let children;
3293
- let className;
3294
- let rest;
3295
- let style;
3296
- let t1;
3297
- if ($[0] !== t0) {
3298
- ({nodeProps: t1, className, style, children, ...rest} = t0);
3299
- $[0] = t0;
3300
- $[1] = children;
3301
- $[2] = className;
3302
- $[3] = rest;
3303
- $[4] = style;
3304
- $[5] = t1;
3305
- } else {
3306
- children = $[1];
3307
- className = $[2];
3308
- rest = $[3];
3309
- style = $[4];
3310
- t1 = $[5];
3311
- }
3312
- const { selected: t2, selectable: t3, data: t4 } = t1;
3313
- const selected = t2 === void 0 ? false : t2;
3314
- const selectable = t3 === void 0 ? false : t3;
3315
- let data;
3316
- let isDimmed;
3317
- let isHovered;
3318
- let t5;
3319
- let variant;
3320
- if ($[6] !== selected || $[7] !== t4) {
3321
- const { hovered: t6, dimmed: t7, ...t8 } = t4;
3322
- data = t8;
3323
- isHovered = t6 === void 0 ? false : t6;
3324
- isDimmed = t7 === void 0 ? false : t7;
3325
- bb0: switch (true) {
3326
- case isHovered:
3327
- variant = "hovered";
3328
- break bb0;
3329
- case selected:
3330
- variant = "selected";
3331
- break bb0;
3332
- default: variant = "normal";
3333
- }
3334
- t5 = ensureSizes$1(data.style ?? {});
3335
- $[6] = selected;
3336
- $[7] = t4;
3337
- $[8] = data;
3338
- $[9] = isDimmed;
3339
- $[10] = isHovered;
3340
- $[11] = t5;
3341
- $[12] = variant;
3342
- } else {
3343
- data = $[8];
3344
- isDimmed = $[9];
3345
- isHovered = $[10];
3346
- t5 = $[11];
3347
- variant = $[12];
3348
- }
3349
- const { size, padding, textSize } = t5;
3350
- let t6;
3351
- if ($[13] !== className) {
3352
- t6 = cx(elementNode(), "group", className);
3353
- $[13] = className;
3354
- $[14] = t6;
3355
- } else t6 = $[14];
3356
- let t7;
3357
- if ($[15] !== selectable || $[16] !== variant) {
3358
- t7 = selectable && {
3359
- animate: variant,
3360
- whileTap: "tap"
3361
- };
3362
- $[15] = selectable;
3363
- $[16] = variant;
3364
- $[17] = t7;
3365
- } else t7 = $[17];
3366
- let t8;
3367
- if ($[18] !== data.style?.sizing) {
3368
- t8 = data.style?.sizing === "fixed" && { "data-likec4-sizing": "fixed" };
3369
- $[18] = data.style?.sizing;
3370
- $[19] = t8;
3371
- } else t8 = $[19];
3372
- let t9;
3373
- if ($[20] !== isDimmed) {
3374
- t9 = isDimmed !== false && { "data-likec4-dimmed": isDimmed };
3375
- $[20] = isDimmed;
3376
- $[21] = t9;
3377
- } else t9 = $[21];
3378
- const t10 = style;
3379
- let t11;
3380
- if ($[22] !== children || $[23] !== data.color || $[24] !== data.shape || $[25] !== isHovered || $[26] !== padding || $[27] !== ref || $[28] !== rest || $[29] !== size || $[30] !== t10 || $[31] !== t6 || $[32] !== t7 || $[33] !== t8 || $[34] !== t9 || $[35] !== textSize) {
3381
- t11 = /* @__PURE__ */ jsx(MotionDiv, {
3382
- ref,
3383
- className: t6,
3384
- variants,
3385
- initial: false,
3386
- ...t7,
3387
- "data-likec4-hovered": isHovered,
3388
- "data-likec4-color": data.color,
3389
- "data-likec4-shape": data.shape,
3390
- "data-likec4-shape-size": size,
3391
- "data-likec4-spacing": padding,
3392
- "data-likec4-text-size": textSize,
3393
- ...t8,
3394
- ...t9,
3395
- style: t10,
3396
- tabIndex: -1,
3397
- ...rest,
3398
- children
3399
- });
3400
- $[22] = children;
3401
- $[23] = data.color;
3402
- $[24] = data.shape;
3403
- $[25] = isHovered;
3404
- $[26] = padding;
3405
- $[27] = ref;
3406
- $[28] = rest;
3407
- $[29] = size;
3408
- $[30] = t10;
3409
- $[31] = t6;
3410
- $[32] = t7;
3411
- $[33] = t8;
3412
- $[34] = t9;
3413
- $[35] = textSize;
3414
- $[36] = t11;
3415
- } else t11 = $[36];
3416
- return t11;
3417
- });
3418
- ElementNodeContainer.displayName = "ElementNodeContainer";
3419
- //#endregion
3420
- //#region ../diagram/src/base-primitives/element/ElementShape.tsx
3421
- function cylinderSVGPath(diameter, height, tilt = .07) {
3422
- const radius = Math.round(diameter / 2);
3423
- const rx = radius;
3424
- const ry = roundDpr(tilt * radius);
3425
- const tiltAdjustedHeight = height - 2 * ry;
3426
- return {
3427
- path: ` M ${diameter},${ry}
3428
- a ${rx},${ry} 0,0,0 ${-diameter} 0
3429
- l 0,${tiltAdjustedHeight}
3430
- a ${rx},${ry} 0,0,0 ${diameter} 0
3431
- l 0,${-tiltAdjustedHeight}
3432
- z
3433
- `.replace(/\s+/g, " ").trim(),
3434
- ry,
3435
- rx
3436
- };
3437
- }
3438
- function docSVGPath(width, height) {
3439
- const baseY = roundDpr(height - height / 8 / 2);
3440
- const amplitude = roundDpr(height / 6);
3441
- const radius = 6;
3442
- return { path: `
3443
- M 0 ${baseY}
3444
- V ${radius}
3445
- Q 0 0 ${radius} 0
3446
- H ${width - radius}
3447
- Q ${width} 0 ${width} ${radius}
3448
- V ${baseY}
3449
- C ${roundDpr(width * .75)} ${baseY + amplitude}, ${roundDpr(width * .5)} ${baseY - amplitude}, 0 ${baseY}
3450
- `.replace(/\s+/g, " ").trim() };
3451
- }
3452
- function bucketSVGPath(width, height) {
3453
- const cx = width / 2;
3454
- const topRx = roundDpr(cx);
3455
- const topRy = roundDpr(Math.min(height / 8, topRx * .08));
3456
- const bottomRx = roundDpr(topRx * .8);
3457
- const bottomRy = roundDpr(topRy * 1.05);
3458
- const topY = topRy;
3459
- const bottomY = height - bottomRy;
3460
- const leftBottomX = cx - bottomRx;
3461
- return {
3462
- path: `
3463
- M ${width},${topY}
3464
- a ${topRx},${topRy} 0,0,0 ${-width} 0
3465
- L ${leftBottomX},${bottomY}
3466
- a ${bottomRx},${bottomRy} 0,0,0 ${bottomRx * 2} 0
3467
- Z
3468
- `.replace(/\s+/g, " ").trim(),
3469
- topRx,
3470
- topRy,
3471
- bottomRx,
3472
- bottomRy
3473
- };
3474
- }
3475
- function queueSVGPath(width, height, tilt = .185) {
3476
- const diameter = height;
3477
- const ry = Math.round(diameter / 2);
3478
- const rx = roundDpr(diameter / 2 * tilt);
3479
- return {
3480
- path: `
3481
- M ${rx},0
3482
- a ${rx},${ry} 0,0,0 0 ${diameter}
3483
- l ${width - 2 * rx},0
3484
- a ${rx},${ry} 0,0,0 0 ${-diameter}
3485
- z`.replace(/\s+/g, " ").trim(),
3486
- ry,
3487
- rx
3488
- };
3489
- }
3490
- var agentGeometry = (h) => ({
3491
- earW: 14,
3492
- earH: Math.min(Math.round(h * .38), 150),
3493
- stemW: 6,
3494
- stemH: 22,
3495
- ballR: 9
3496
- });
3497
- /**
3498
- * Silhouette of the agent (body, ears and antenna), grown by `pad` on every side
3499
- */
3500
- function agentSVGPath(w, h, pad = 0) {
3501
- const { earW, stemW, stemH, ballR, earH } = agentGeometry(h);
3502
- const r = 6 + pad;
3503
- const er = 3 + pad;
3504
- const cx = w / 2;
3505
- const sw = stemW / 2 + pad;
3506
- const R = ballR + pad;
3507
- const jy = roundDpr(-stemH + Math.sqrt(R * R - sw * sw));
3508
- const left = -pad;
3509
- const right = w + pad;
3510
- const top = -pad;
3511
- const bottom = h + pad;
3512
- const earTop = (h - earH) / 2 - pad;
3513
- const earBottom = (h + earH) / 2 + pad;
3514
- const earLeft = -(earW - 2) - pad;
3515
- const earRight = w + (earW - 2) + pad;
3516
- return `
3517
- M ${left + r},${top}
3518
- H ${cx - sw}
3519
- V ${jy}
3520
- A ${R} ${R} 0 1 1 ${cx + sw} ${jy}
3521
- V ${top}
3522
- H ${right - r}
3523
- A ${r} ${r} 0 0 1 ${right} ${top + r}
3524
- V ${earTop}
3525
- H ${earRight - er}
3526
- A ${er} ${er} 0 0 1 ${earRight} ${earTop + er}
3527
- V ${earBottom - er}
3528
- A ${er} ${er} 0 0 1 ${earRight - er} ${earBottom}
3529
- H ${right}
3530
- V ${bottom - r}
3531
- A ${r} ${r} 0 0 1 ${right - r} ${bottom}
3532
- H ${left + r}
3533
- A ${r} ${r} 0 0 1 ${left} ${bottom - r}
3534
- V ${earBottom}
3535
- H ${earLeft + er}
3536
- A ${er} ${er} 0 0 1 ${earLeft} ${earBottom - er}
3537
- V ${earTop + er}
3538
- A ${er} ${er} 0 0 1 ${earLeft + er} ${earTop}
3539
- H ${left}
3540
- V ${top + r}
3541
- A ${r} ${r} 0 0 1 ${left + r} ${top}
3542
- Z
3543
- `.replace(/\s+/g, " ").trim();
3544
- }
3545
- var PersonIcon = {
3546
- width: 115,
3547
- height: 120,
3548
- path: `M57.9197 0C10.9124 0 33.5766 54.75 33.5766 54.75C38.6131 62.25 45.3285 60.75 45.3285 66C45.3285 70.5 39.4526 72 33.5766 72.75C24.3431 72.75 15.9489 71.25 7.55474 84.75C2.51825 93 0 120 0 120H115C115 120 112.482 93 108.285 84.75C99.8905 70.5 91.4963 72.75 82.2628 72C76.3869 71.25 70.5109 69.75 70.5109 65.25C70.5109 60.75 77.2263 62.25 82.2628 54C82.2628 54.75 104.927 0 57.9197 0V0Z`
3549
- };
3550
- var ComponentTopLeftRect = (t0) => {
3551
- const $ = c(5);
3552
- const { index, size } = t0;
3553
- let width;
3554
- let height;
3555
- let offsetX;
3556
- let offsetY;
3557
- let between;
3558
- bb0: switch (size) {
3559
- case "xs":
3560
- case "sm":
3561
- width = 40;
3562
- height = 18;
3563
- offsetX = -16;
3564
- offsetY = 16;
3565
- between = 10;
3566
- break bb0;
3567
- case "md":
3568
- width = 60;
3569
- height = 26;
3570
- offsetX = -20;
3571
- offsetY = 22;
3572
- between = 14;
3573
- break bb0;
3574
- case "lg":
3575
- case "xl":
3576
- width = 70;
3577
- height = 32;
3578
- offsetX = -24;
3579
- offsetY = 32;
3580
- between = 18;
3581
- break bb0;
3582
- default: nonexhaustive(size);
3583
- }
3584
- const t1 = offsetY + (height + between) * index;
3585
- let t2;
3586
- if ($[0] !== height || $[1] !== offsetX || $[2] !== t1 || $[3] !== width) {
3587
- t2 = /* @__PURE__ */ jsx("rect", {
3588
- x: offsetX,
3589
- y: t1,
3590
- width,
3591
- height,
3592
- rx: 3,
3593
- className: "top-left-rect",
3594
- strokeWidth: 2
3595
- });
3596
- $[0] = height;
3597
- $[1] = offsetX;
3598
- $[2] = t1;
3599
- $[3] = width;
3600
- $[4] = t2;
3601
- } else t2 = $[4];
3602
- return t2;
3603
- };
3604
- function ShapeSvg(t0) {
3605
- const $ = c(111);
3606
- const { shape, w, h, size: t1, isStacked: t2 } = t0;
3607
- const size = t1 === void 0 ? "md" : t1;
3608
- const isStacked = t2 === void 0 ? false : t2;
3609
- switch (shape) {
3610
- case "component": {
3611
- let t3;
3612
- if ($[0] !== h || $[1] !== w) {
3613
- t3 = /* @__PURE__ */ jsx("rect", {
3614
- width: w,
3615
- height: h,
3616
- rx: 6,
3617
- strokeWidth: 0
3618
- });
3619
- $[0] = h;
3620
- $[1] = w;
3621
- $[2] = t3;
3622
- } else t3 = $[2];
3623
- let t4;
3624
- let t5;
3625
- if ($[3] !== size) {
3626
- t4 = /* @__PURE__ */ jsx(ComponentTopLeftRect, {
3627
- index: 0,
3628
- size
3629
- });
3630
- t5 = /* @__PURE__ */ jsx(ComponentTopLeftRect, {
3631
- index: 1,
3632
- size
3633
- });
3634
- $[3] = size;
3635
- $[4] = t4;
3636
- $[5] = t5;
3637
- } else {
3638
- t4 = $[4];
3639
- t5 = $[5];
3640
- }
3641
- let t6;
3642
- if ($[6] !== t3 || $[7] !== t4 || $[8] !== t5) {
3643
- t6 = /* @__PURE__ */ jsxs(Fragment$1, { children: [
3644
- t3,
3645
- t4,
3646
- t5
3647
- ] });
3648
- $[6] = t3;
3649
- $[7] = t4;
3650
- $[8] = t5;
3651
- $[9] = t6;
3652
- } else t6 = $[9];
3653
- return t6;
3654
- }
3655
- case "mobile": {
3656
- let t3;
3657
- if ($[10] !== h || $[11] !== w) {
3658
- t3 = /* @__PURE__ */ jsx("rect", {
3659
- width: w,
3660
- height: h,
3661
- rx: 6,
3662
- "data-likec4-fill": "mix-stroke",
3663
- strokeWidth: 0
3664
- });
3665
- $[10] = h;
3666
- $[11] = w;
3667
- $[12] = t3;
3668
- } else t3 = $[12];
3669
- const t4 = h / 2;
3670
- let t5;
3671
- if ($[13] !== t4) {
3672
- t5 = /* @__PURE__ */ jsx("circle", {
3673
- cx: 17,
3674
- cy: t4,
3675
- r: 12
3676
- });
3677
- $[13] = t4;
3678
- $[14] = t5;
3679
- } else t5 = $[14];
3680
- const t6 = w - 44;
3681
- const t7 = h - 24;
3682
- let t8;
3683
- if ($[15] !== t6 || $[16] !== t7) {
3684
- t8 = /* @__PURE__ */ jsx("rect", {
3685
- x: 33,
3686
- y: 12,
3687
- width: t6,
3688
- height: t7,
3689
- rx: 5
3690
- });
3691
- $[15] = t6;
3692
- $[16] = t7;
3693
- $[17] = t8;
3694
- } else t8 = $[17];
3695
- let t9;
3696
- if ($[18] !== t5 || $[19] !== t8) {
3697
- t9 = /* @__PURE__ */ jsxs("g", {
3698
- "data-likec4-fill": "fill",
3699
- strokeWidth: 0,
3700
- children: [t5, t8]
3701
- });
3702
- $[18] = t5;
3703
- $[19] = t8;
3704
- $[20] = t9;
3705
- } else t9 = $[20];
3706
- let t10;
3707
- if ($[21] !== t3 || $[22] !== t9) {
3708
- t10 = /* @__PURE__ */ jsxs(Fragment$1, { children: [t3, t9] });
3709
- $[21] = t3;
3710
- $[22] = t9;
3711
- $[23] = t10;
3712
- } else t10 = $[23];
3713
- return t10;
3714
- }
3715
- case "document": {
3716
- let t3;
3717
- if ($[24] !== h || $[25] !== w) {
3718
- t3 = docSVGPath(w, h);
3719
- $[24] = h;
3720
- $[25] = w;
3721
- $[26] = t3;
3722
- } else t3 = $[26];
3723
- const { path: path_2 } = t3;
3724
- let t4;
3725
- if ($[27] !== path_2) {
3726
- t4 = /* @__PURE__ */ jsx("path", {
3727
- d: path_2,
3728
- "data-likec4-fill": "fill",
3729
- strokeWidth: 2
3730
- });
3731
- $[27] = path_2;
3732
- $[28] = t4;
3733
- } else t4 = $[28];
3734
- return t4;
3735
- }
3736
- case "browser": {
3737
- let t3;
3738
- if ($[29] !== h || $[30] !== w) {
3739
- t3 = /* @__PURE__ */ jsx("rect", {
3740
- width: w,
3741
- height: h,
3742
- rx: 6,
3743
- "data-likec4-fill": "mix-stroke",
3744
- strokeWidth: 0
3745
- });
3746
- $[29] = h;
3747
- $[30] = w;
3748
- $[31] = t3;
3749
- } else t3 = $[31];
3750
- let t4;
3751
- let t5;
3752
- let t6;
3753
- if ($[32] === Symbol.for("react.memo_cache_sentinel")) {
3754
- t4 = /* @__PURE__ */ jsx("circle", {
3755
- cx: 16,
3756
- cy: 17,
3757
- r: 7
3758
- });
3759
- t5 = /* @__PURE__ */ jsx("circle", {
3760
- cx: 36,
3761
- cy: 17,
3762
- r: 7
3763
- });
3764
- t6 = /* @__PURE__ */ jsx("circle", {
3765
- cx: 56,
3766
- cy: 17,
3767
- r: 7
3768
- });
3769
- $[32] = t4;
3770
- $[33] = t5;
3771
- $[34] = t6;
3772
- } else {
3773
- t4 = $[32];
3774
- t5 = $[33];
3775
- t6 = $[34];
3776
- }
3777
- const t7 = w - 80;
3778
- let t8;
3779
- if ($[35] !== t7) {
3780
- t8 = /* @__PURE__ */ jsx("rect", {
3781
- x: 70,
3782
- y: 8,
3783
- width: t7,
3784
- height: 17,
3785
- rx: 4
3786
- });
3787
- $[35] = t7;
3788
- $[36] = t8;
3789
- } else t8 = $[36];
3790
- const t9 = w - 20;
3791
- const t10 = h - 42;
3792
- let t11;
3793
- if ($[37] !== t10 || $[38] !== t9) {
3794
- t11 = /* @__PURE__ */ jsx("rect", {
3795
- x: 10,
3796
- y: 32,
3797
- width: t9,
3798
- height: t10,
3799
- rx: 4
3800
- });
3801
- $[37] = t10;
3802
- $[38] = t9;
3803
- $[39] = t11;
3804
- } else t11 = $[39];
3805
- let t12;
3806
- if ($[40] !== t11 || $[41] !== t8) {
3807
- t12 = /* @__PURE__ */ jsxs("g", {
3808
- "data-likec4-fill": "fill",
3809
- strokeWidth: 0,
3810
- children: [
3811
- t4,
3812
- t5,
3813
- t6,
3814
- t8,
3815
- t11
3816
- ]
3817
- });
3818
- $[40] = t11;
3819
- $[41] = t8;
3820
- $[42] = t12;
3821
- } else t12 = $[42];
3822
- let t13;
3823
- if ($[43] !== t12 || $[44] !== t3) {
3824
- t13 = /* @__PURE__ */ jsxs(Fragment$1, { children: [t3, t12] });
3825
- $[43] = t12;
3826
- $[44] = t3;
3827
- $[45] = t13;
3828
- } else t13 = $[45];
3829
- return t13;
3830
- }
3831
- case "person": {
3832
- let t3;
3833
- if ($[46] !== h || $[47] !== w) {
3834
- t3 = /* @__PURE__ */ jsx("rect", {
3835
- width: w,
3836
- height: h,
3837
- rx: 6,
3838
- strokeWidth: 0
3839
- });
3840
- $[46] = h;
3841
- $[47] = w;
3842
- $[48] = t3;
3843
- } else t3 = $[48];
3844
- const t4 = w - PersonIcon.width - 6;
3845
- const t5 = h - PersonIcon.height;
3846
- let t6;
3847
- if ($[49] === Symbol.for("react.memo_cache_sentinel")) {
3848
- t6 = /* @__PURE__ */ jsx("path", {
3849
- strokeWidth: 0,
3850
- d: PersonIcon.path
3851
- });
3852
- $[49] = t6;
3853
- } else t6 = $[49];
3854
- let t7;
3855
- if ($[50] !== t4 || $[51] !== t5) {
3856
- t7 = /* @__PURE__ */ jsx("svg", {
3857
- x: t4,
3858
- y: t5,
3859
- width: PersonIcon.width,
3860
- height: PersonIcon.height,
3861
- viewBox: `0 0 ${PersonIcon.width} ${PersonIcon.height}`,
3862
- "data-likec4-fill": "mix-stroke",
3863
- children: t6
3864
- });
3865
- $[50] = t4;
3866
- $[51] = t5;
3867
- $[52] = t7;
3868
- } else t7 = $[52];
3869
- let t8;
3870
- if ($[53] !== t3 || $[54] !== t7) {
3871
- t8 = /* @__PURE__ */ jsxs(Fragment$1, { children: [t3, t7] });
3872
- $[53] = t3;
3873
- $[54] = t7;
3874
- $[55] = t8;
3875
- } else t8 = $[55];
3876
- return t8;
3877
- }
3878
- case "queue": {
3879
- let t3;
3880
- if ($[56] !== h || $[57] !== w) {
3881
- t3 = queueSVGPath(w, h);
3882
- $[56] = h;
3883
- $[57] = w;
3884
- $[58] = t3;
3885
- } else t3 = $[58];
3886
- const { path: path_1, rx: rx_0, ry: ry_0 } = t3;
3887
- let t4;
3888
- if ($[59] !== path_1) {
3889
- t4 = /* @__PURE__ */ jsx("path", {
3890
- d: path_1,
3891
- strokeWidth: 2
3892
- });
3893
- $[59] = path_1;
3894
- $[60] = t4;
3895
- } else t4 = $[60];
3896
- const t5 = ry_0 - .75;
3897
- let t6;
3898
- if ($[61] !== rx_0 || $[62] !== ry_0 || $[63] !== t5) {
3899
- t6 = /* @__PURE__ */ jsx("ellipse", {
3900
- cx: rx_0,
3901
- cy: ry_0,
3902
- ry: t5,
3903
- rx: rx_0,
3904
- "data-likec4-fill": "mix-stroke",
3905
- strokeWidth: 2
3906
- });
3907
- $[61] = rx_0;
3908
- $[62] = ry_0;
3909
- $[63] = t5;
3910
- $[64] = t6;
3911
- } else t6 = $[64];
3912
- let t7;
3913
- if ($[65] !== t4 || $[66] !== t6) {
3914
- t7 = /* @__PURE__ */ jsxs(Fragment$1, { children: [t4, t6] });
3915
- $[65] = t4;
3916
- $[66] = t6;
3917
- $[67] = t7;
3918
- } else t7 = $[67];
3919
- return t7;
3920
- }
3921
- case "bucket": {
3922
- let t3;
3923
- if ($[68] !== h || $[69] !== w) {
3924
- t3 = bucketSVGPath(w, h);
3925
- $[68] = h;
3926
- $[69] = w;
3927
- $[70] = t3;
3928
- } else t3 = $[70];
3929
- const { path: path_0, topRx, topRy } = t3;
3930
- let t4;
3931
- if ($[71] !== path_0) {
3932
- t4 = /* @__PURE__ */ jsx("path", {
3933
- d: path_0,
3934
- strokeWidth: 2
3935
- });
3936
- $[71] = path_0;
3937
- $[72] = t4;
3938
- } else t4 = $[72];
3939
- const t5 = w / 2;
3940
- let t6;
3941
- if ($[73] !== t5 || $[74] !== topRx || $[75] !== topRy) {
3942
- t6 = /* @__PURE__ */ jsx("ellipse", {
3943
- cx: t5,
3944
- cy: topRy,
3945
- rx: topRx,
3946
- ry: topRy,
3947
- "data-likec4-fill": "mix-stroke",
3948
- strokeWidth: 2
3949
- });
3950
- $[73] = t5;
3951
- $[74] = topRx;
3952
- $[75] = topRy;
3953
- $[76] = t6;
3954
- } else t6 = $[76];
3955
- let t7;
3956
- if ($[77] !== t4 || $[78] !== t6) {
3957
- t7 = /* @__PURE__ */ jsxs(Fragment$1, { children: [t4, t6] });
3958
- $[77] = t4;
3959
- $[78] = t6;
3960
- $[79] = t7;
3961
- } else t7 = $[79];
3962
- return t7;
3963
- }
3964
- case "storage":
3965
- case "cylinder": {
3966
- let t3;
3967
- if ($[80] !== h || $[81] !== w) {
3968
- t3 = cylinderSVGPath(w, h);
3969
- $[80] = h;
3970
- $[81] = w;
3971
- $[82] = t3;
3972
- } else t3 = $[82];
3973
- const { path, rx, ry } = t3;
3974
- let t4;
3975
- if ($[83] !== path) {
3976
- t4 = /* @__PURE__ */ jsx("path", {
3977
- d: path,
3978
- strokeWidth: 2
3979
- });
3980
- $[83] = path;
3981
- $[84] = t4;
3982
- } else t4 = $[84];
3983
- const t5 = rx - .75;
3984
- let t6;
3985
- if ($[85] !== rx || $[86] !== ry || $[87] !== t5) {
3986
- t6 = /* @__PURE__ */ jsx("ellipse", {
3987
- cx: rx,
3988
- cy: ry,
3989
- ry,
3990
- rx: t5,
3991
- "data-likec4-fill": "mix-stroke",
3992
- strokeWidth: 2
3993
- });
3994
- $[85] = rx;
3995
- $[86] = ry;
3996
- $[87] = t5;
3997
- $[88] = t6;
3998
- } else t6 = $[88];
3999
- let t7;
4000
- if ($[89] !== t4 || $[90] !== t6) {
4001
- t7 = /* @__PURE__ */ jsxs(Fragment$1, { children: [t4, t6] });
4002
- $[89] = t4;
4003
- $[90] = t6;
4004
- $[91] = t7;
4005
- } else t7 = $[91];
4006
- return t7;
4007
- }
4008
- case "agent": {
4009
- let t3;
4010
- if ($[92] !== h) {
4011
- t3 = agentGeometry(h);
4012
- $[92] = h;
4013
- $[93] = t3;
4014
- } else t3 = $[93];
4015
- const { earW, earH, stemW, stemH, ballR } = t3;
4016
- const earY = (h - earH) / 2;
4017
- let t4;
4018
- if ($[94] !== ballR || $[95] !== earH || $[96] !== earW || $[97] !== earY || $[98] !== isStacked || $[99] !== stemH || $[100] !== stemW || $[101] !== w) {
4019
- t4 = !isStacked && /* @__PURE__ */ jsxs("g", {
4020
- "data-likec4-fill": "mix-stroke",
4021
- strokeWidth: 0,
4022
- children: [
4023
- /* @__PURE__ */ jsx("rect", {
4024
- x: -earW + 2,
4025
- y: earY,
4026
- width: earW,
4027
- height: earH,
4028
- rx: 3
4029
- }),
4030
- /* @__PURE__ */ jsx("rect", {
4031
- x: w - 2,
4032
- y: earY,
4033
- width: earW,
4034
- height: earH,
4035
- rx: 3
4036
- }),
4037
- /* @__PURE__ */ jsx("rect", {
4038
- x: (w - stemW) / 2,
4039
- y: -stemH,
4040
- width: stemW,
4041
- height: stemH + 2
4042
- }),
4043
- /* @__PURE__ */ jsx("circle", {
4044
- cx: w / 2,
4045
- cy: -stemH,
4046
- r: ballR
4047
- })
4048
- ]
4049
- });
4050
- $[94] = ballR;
4051
- $[95] = earH;
4052
- $[96] = earW;
4053
- $[97] = earY;
4054
- $[98] = isStacked;
4055
- $[99] = stemH;
4056
- $[100] = stemW;
4057
- $[101] = w;
4058
- $[102] = t4;
4059
- } else t4 = $[102];
4060
- let t5;
4061
- if ($[103] !== h || $[104] !== w) {
4062
- t5 = /* @__PURE__ */ jsx("rect", {
4063
- width: w,
4064
- height: h,
4065
- rx: 6,
4066
- strokeWidth: 0
4067
- });
4068
- $[103] = h;
4069
- $[104] = w;
4070
- $[105] = t5;
4071
- } else t5 = $[105];
4072
- let t6;
4073
- if ($[106] !== t4 || $[107] !== t5) {
4074
- t6 = /* @__PURE__ */ jsxs(Fragment$1, { children: [t4, t5] });
4075
- $[106] = t4;
4076
- $[107] = t5;
4077
- $[108] = t6;
4078
- } else t6 = $[108];
4079
- return t6;
4080
- }
4081
- default: {
4082
- let t3;
4083
- if ($[109] !== shape) {
4084
- t3 = nonexhaustive(shape);
4085
- $[109] = shape;
4086
- $[110] = t3;
4087
- } else t3 = $[110];
4088
- return t3;
4089
- }
4090
- }
4091
- }
4092
- /**
4093
- * When element is selected, this component is used to render the indicator
4094
- */
4095
- function ShapeSvgOutline(t0) {
4096
- const $ = c(30);
4097
- const { shape, w, h } = t0;
4098
- let svg;
4099
- bb0: switch (shape) {
4100
- case "bucket": {
4101
- const t1 = w + 6;
4102
- const t2 = h + 6;
4103
- let t3;
4104
- if ($[0] !== t1 || $[1] !== t2) {
4105
- t3 = bucketSVGPath(t1, t2);
4106
- $[0] = t1;
4107
- $[1] = t2;
4108
- $[2] = t3;
4109
- } else t3 = $[2];
4110
- let t4;
4111
- if ($[3] !== t3.path) {
4112
- t4 = /* @__PURE__ */ jsx("g", {
4113
- transform: "translate(-3 -3)",
4114
- children: /* @__PURE__ */ jsx("path", { d: t3.path })
4115
- });
4116
- $[3] = t3.path;
4117
- $[4] = t4;
4118
- } else t4 = $[4];
4119
- svg = t4;
4120
- break bb0;
4121
- }
4122
- case "queue": {
4123
- const t1 = w + 6;
4124
- const t2 = h + 6;
4125
- let t3;
4126
- if ($[5] !== t1 || $[6] !== t2) {
4127
- t3 = queueSVGPath(t1, t2);
4128
- $[5] = t1;
4129
- $[6] = t2;
4130
- $[7] = t3;
4131
- } else t3 = $[7];
4132
- let t4;
4133
- if ($[8] !== t3.path) {
4134
- t4 = /* @__PURE__ */ jsx("g", {
4135
- transform: "translate(-3 -3)",
4136
- children: /* @__PURE__ */ jsx("path", { d: t3.path })
4137
- });
4138
- $[8] = t3.path;
4139
- $[9] = t4;
4140
- } else t4 = $[9];
4141
- svg = t4;
4142
- break bb0;
4143
- }
4144
- case "document": {
4145
- const t1 = w + 6;
4146
- const t2 = h + 6;
4147
- let t3;
4148
- if ($[10] !== t1 || $[11] !== t2) {
4149
- t3 = docSVGPath(t1, t2);
4150
- $[10] = t1;
4151
- $[11] = t2;
4152
- $[12] = t3;
4153
- } else t3 = $[12];
4154
- let t4;
4155
- if ($[13] !== t3.path) {
4156
- t4 = /* @__PURE__ */ jsx("g", {
4157
- transform: "translate(-3 -3)",
4158
- children: /* @__PURE__ */ jsx("path", { d: t3.path })
4159
- });
4160
- $[13] = t3.path;
4161
- $[14] = t4;
4162
- } else t4 = $[14];
4163
- svg = t4;
4164
- break bb0;
4165
- }
4166
- case "agent": {
4167
- let t1;
4168
- if ($[15] !== h || $[16] !== w) {
4169
- t1 = agentSVGPath(w, h, 3);
4170
- $[15] = h;
4171
- $[16] = w;
4172
- $[17] = t1;
4173
- } else t1 = $[17];
4174
- let t2;
4175
- if ($[18] !== t1) {
4176
- t2 = /* @__PURE__ */ jsx("path", { d: t1 });
4177
- $[18] = t1;
4178
- $[19] = t2;
4179
- } else t2 = $[19];
4180
- svg = t2;
4181
- break bb0;
4182
- }
4183
- case "storage":
4184
- case "cylinder": {
4185
- const t1 = w + 6;
4186
- const t2 = h + 6;
4187
- let t3;
4188
- if ($[20] !== t1 || $[21] !== t2) {
4189
- t3 = cylinderSVGPath(t1, t2);
4190
- $[20] = t1;
4191
- $[21] = t2;
4192
- $[22] = t3;
4193
- } else t3 = $[22];
4194
- let t4;
4195
- if ($[23] !== t3.path) {
4196
- t4 = /* @__PURE__ */ jsx("g", {
4197
- transform: "translate(-3 -3)",
4198
- children: /* @__PURE__ */ jsx("path", { d: t3.path })
4199
- });
4200
- $[23] = t3.path;
4201
- $[24] = t4;
4202
- } else t4 = $[24];
4203
- svg = t4;
4204
- break bb0;
4205
- }
4206
- default: {
4207
- const t1 = w + 6;
4208
- const t2 = h + 6;
4209
- let t3;
4210
- if ($[25] !== t1 || $[26] !== t2) {
4211
- t3 = /* @__PURE__ */ jsx("rect", {
4212
- x: -3,
4213
- y: -3,
4214
- width: t1,
4215
- height: t2,
4216
- rx: 8
4217
- });
4218
- $[25] = t1;
4219
- $[26] = t2;
4220
- $[27] = t3;
4221
- } else t3 = $[27];
4222
- svg = t3;
4223
- }
4224
- }
4225
- let t1;
4226
- if ($[28] !== svg) {
4227
- t1 = /* @__PURE__ */ jsx("g", {
4228
- className: "likec4-shape-outline",
4229
- children: svg
4230
- });
4231
- $[28] = svg;
4232
- $[29] = t1;
4233
- } else t1 = $[29];
4234
- return t1;
4235
- }
4236
- function ElementShape(t0) {
4237
- const $ = c(38);
4238
- const { data, width, height, showSelectionOutline: t1 } = t0;
4239
- const showSelectionOutline = t1 === void 0 ? true : t1;
4240
- const w = !!width && width > 10 ? width : data.width;
4241
- const h = !!height && height > 10 ? height : data.height;
4242
- const isMultiple = data.style?.multiple ?? false;
4243
- const borderStyle = data.style?.border ?? "none";
4244
- const withBorder = borderStyle !== "none";
4245
- if (data.shape === "rectangle") {
4246
- let t2;
4247
- if ($[0] !== borderStyle) {
4248
- t2 = { borderStyle };
4249
- $[0] = borderStyle;
4250
- $[1] = t2;
4251
- } else t2 = $[1];
4252
- let t3;
4253
- if ($[2] !== showSelectionOutline || $[3] !== withBorder) {
4254
- t3 = elementShapeRecipe({
4255
- shapetype: "html",
4256
- withBorder,
4257
- withOutline: showSelectionOutline
4258
- });
4259
- $[2] = showSelectionOutline;
4260
- $[3] = withBorder;
4261
- $[4] = t3;
4262
- } else t3 = $[4];
4263
- let t4;
4264
- if ($[5] !== isMultiple) {
4265
- t4 = isMultiple && /* @__PURE__ */ jsx("div", { className: "likec4-shape-multiple" });
4266
- $[5] = isMultiple;
4267
- $[6] = t4;
4268
- } else t4 = $[6];
4269
- let t5;
4270
- if ($[7] === Symbol.for("react.memo_cache_sentinel")) {
4271
- t5 = /* @__PURE__ */ jsx("div", { className: "likec4-shape-outline" });
4272
- $[7] = t5;
4273
- } else t5 = $[7];
4274
- let t6;
4275
- if ($[8] !== t2 || $[9] !== t3 || $[10] !== t4) {
4276
- t6 = /* @__PURE__ */ jsxs("div", {
4277
- "aria-hidden": true,
4278
- style: t2,
4279
- className: t3,
4280
- children: [t4, t5]
4281
- });
4282
- $[8] = t2;
4283
- $[9] = t3;
4284
- $[10] = t4;
4285
- $[11] = t6;
4286
- } else t6 = $[11];
4287
- return t6;
4288
- }
4289
- let t2;
4290
- if ($[12] !== showSelectionOutline) {
4291
- t2 = elementShapeRecipe({
4292
- shapetype: "svg",
4293
- withOutline: showSelectionOutline
4294
- });
4295
- $[12] = showSelectionOutline;
4296
- $[13] = t2;
4297
- } else t2 = $[13];
4298
- const className = t2;
4299
- let t3;
4300
- if ($[14] !== className || $[15] !== data.shape || $[16] !== data.style?.size || $[17] !== h || $[18] !== isMultiple || $[19] !== w) {
4301
- t3 = isMultiple && /* @__PURE__ */ jsx("svg", {
4302
- "aria-hidden": true,
4303
- className,
4304
- "data-likec4-shape-multiple": "true",
4305
- viewBox: `0 0 ${w} ${h}`,
4306
- children: /* @__PURE__ */ jsx(ShapeSvg, {
4307
- shape: data.shape,
4308
- size: data.style?.size,
4309
- w,
4310
- h,
4311
- isStacked: true
4312
- })
4313
- });
4314
- $[14] = className;
4315
- $[15] = data.shape;
4316
- $[16] = data.style?.size;
4317
- $[17] = h;
4318
- $[18] = isMultiple;
4319
- $[19] = w;
4320
- $[20] = t3;
4321
- } else t3 = $[20];
4322
- const t4 = `0 0 ${w} ${h}`;
4323
- let t5;
4324
- if ($[21] !== data.shape || $[22] !== h || $[23] !== w) {
4325
- t5 = /* @__PURE__ */ jsx(ShapeSvgOutline, {
4326
- shape: data.shape,
4327
- w,
4328
- h
4329
- });
4330
- $[21] = data.shape;
4331
- $[22] = h;
4332
- $[23] = w;
4333
- $[24] = t5;
4334
- } else t5 = $[24];
4335
- const t6 = data.style?.size;
4336
- let t7;
4337
- if ($[25] !== data.shape || $[26] !== h || $[27] !== t6 || $[28] !== w) {
4338
- t7 = /* @__PURE__ */ jsx(ShapeSvg, {
4339
- shape: data.shape,
4340
- size: t6,
4341
- w,
4342
- h
4343
- });
4344
- $[25] = data.shape;
4345
- $[26] = h;
4346
- $[27] = t6;
4347
- $[28] = w;
4348
- $[29] = t7;
4349
- } else t7 = $[29];
4350
- let t8;
4351
- if ($[30] !== className || $[31] !== t4 || $[32] !== t5 || $[33] !== t7) {
4352
- t8 = /* @__PURE__ */ jsxs("svg", {
4353
- "aria-hidden": true,
4354
- className,
4355
- viewBox: t4,
4356
- children: [t5, t7]
4357
- });
4358
- $[30] = className;
4359
- $[31] = t4;
4360
- $[32] = t5;
4361
- $[33] = t7;
4362
- $[34] = t8;
4363
- } else t8 = $[34];
4364
- let t9;
4365
- if ($[35] !== t3 || $[36] !== t8) {
4366
- t9 = /* @__PURE__ */ jsxs(Fragment$1, { children: [t3, t8] });
4367
- $[35] = t3;
4368
- $[36] = t8;
4369
- $[37] = t9;
4370
- } else t9 = $[37];
4371
- return t9;
4372
- }
4373
- //#endregion
4374
- //#region ../diagram/src/base-primitives/memoEdge.ts
4375
- var isSame = (a, b) => {
4376
- return Math.abs(a - b) < 2.5;
4377
- };
4378
- var edgePropsEqual = (prev, next) => prev.id === next.id && deepEqual(prev.selected ?? false, next.selected ?? false) && deepEqual(prev.animated ?? false, next.animated ?? false) && deepEqual(prev.source, next.source) && deepEqual(prev.target, next.target) && isSame(prev.sourceX, next.sourceX) && isSame(prev.sourceY, next.sourceY) && isSame(prev.targetX, next.targetX) && isSame(prev.targetY, next.targetY) && deepEqual(prev.sourceHandleId ?? null, next.sourceHandleId ?? null) && deepEqual(prev.targetHandleId ?? null, next.targetHandleId ?? null) && deepEqual(prev.sourcePosition, next.sourcePosition) && deepEqual(prev.targetPosition, next.targetPosition) && deepEqual(prev.data, next.data);
4379
- function memoEdge(Edge) {
4380
- const Memo = memo(Edge, edgePropsEqual);
4381
- Memo.displayName = `MemoEdge(${Edge.displayName || Edge.name})`;
4382
- return Memo;
4383
- }
4384
- //#endregion
4385
- //#region ../diagram/src/base-primitives/NodeHandles.tsx
4386
- /**
4387
- * XYFlow requires handles to be defined on nodes.
4388
- */
4389
- function DefaultHandles(t0) {
4390
- const $ = c(7);
4391
- const { direction: t1 } = t0;
4392
- const direction = t1 === void 0 ? "TB" : t1;
4393
- let sourcePosition;
4394
- let targetPosition;
4395
- bb0: switch (direction) {
4396
- case "TB":
4397
- sourcePosition = Position.Bottom;
4398
- targetPosition = Position.Top;
4399
- break bb0;
4400
- case "BT":
4401
- sourcePosition = Position.Top;
4402
- targetPosition = Position.Bottom;
4403
- break bb0;
4404
- case "LR":
4405
- sourcePosition = Position.Right;
4406
- targetPosition = Position.Left;
4407
- break bb0;
4408
- case "RL":
4409
- sourcePosition = Position.Left;
4410
- targetPosition = Position.Right;
4411
- break bb0;
4412
- default: nonexhaustive(direction);
4413
- }
4414
- let t2;
4415
- if ($[0] !== sourcePosition) {
4416
- t2 = /* @__PURE__ */ jsx(Handle, {
4417
- type: "source",
4418
- position: sourcePosition,
4419
- className: "likec4-node-handle-center"
4420
- });
4421
- $[0] = sourcePosition;
4422
- $[1] = t2;
4423
- } else t2 = $[1];
4424
- let t3;
4425
- if ($[2] !== targetPosition) {
4426
- t3 = /* @__PURE__ */ jsx(Handle, {
4427
- type: "target",
4428
- position: targetPosition,
4429
- className: "likec4-node-handle-center"
4430
- });
4431
- $[2] = targetPosition;
4432
- $[3] = t3;
4433
- } else t3 = $[3];
4434
- let t4;
4435
- if ($[4] !== t2 || $[5] !== t3) {
4436
- t4 = /* @__PURE__ */ jsxs(Fragment$1, { children: [t2, t3] });
4437
- $[4] = t2;
4438
- $[5] = t3;
4439
- $[6] = t4;
4440
- } else t4 = $[6];
4441
- return t4;
4442
- }
4443
- //#endregion
4444
- //#region ../diagram/src/LikeC4Styles.tsx
4445
- var scheme = (scheme) => `[data-mantine-color-scheme="${scheme}"]`;
4446
- var whenDark = scheme("dark");
4447
- var generateCompoundColors = (rootSelector, name, colors, depth) => {
4448
- return `
4449
- ${`${rootSelector} :is([data-likec4-color="${name}"][data-compound-depth="${depth}"])`} {
4450
- --likec4-palette-fill: ${colors.fill};
4451
- --likec4-palette-stroke: ${colors.stroke};
4452
- }
4453
- `;
4454
- };
4455
- function toStyle(styles, params) {
4456
- const { rootSelector, name, colors } = params;
4457
- const { elements, relationships } = colors;
4458
- const selector = `${rootSelector} :is([data-likec4-color=${name}])`;
4459
- return [`
4460
- ${selector} {
4461
- --likec4-palette-fill: ${elements.fill};
4462
- --likec4-palette-stroke: ${elements.stroke};
4463
- --likec4-palette-hiContrast: ${elements.hiContrast};
4464
- --likec4-palette-loContrast: ${elements.loContrast};
4465
- --likec4-palette-relation-stroke: ${relationships.line};
4466
- --likec4-palette-relation-label: ${relationships.label};
4467
- --likec4-palette-relation-label-bg: ${relationships.labelBg};
4468
- --likec4-palette-relation-stroke-selected: oklch(from ${relationships.line} calc(l - 0.15) c h);
4469
- }
4470
- ${whenDark} ${selector} {
4471
- --likec4-palette-relation-stroke-selected: oklch(from ${relationships.line} calc(l + 0.15) c h);
4472
- }
4473
-
4474
- `, ...styles.colorsForCompounds(elements, 5).map((colors, depth) => generateCompoundColors(rootSelector, name, colors, depth + 1))].map((s) => s.trim()).join("\n");
4475
- }
4476
- function generateBuiltInColorStyles(styles, rootSelector) {
4477
- return t$8(styles.theme.colors, t$3(), t$7(([name, colors]) => toStyle(styles, {
4478
- rootSelector,
4479
- name,
4480
- colors
4481
- })), t$2("\n"));
4482
- }
4483
- /**
4484
- * Component that renders LikeC4 theme colors as CSS variables
4485
- * scoped to the provided root selector
4486
- */
4487
- function LikeC4Styles$1({ rootSelector }) {
4488
- const nonce = useMantineStyleNonce()?.();
4489
- const $styles = useLikeC4Styles();
4490
- const colorsStyles = useMemo(() => generateBuiltInColorStyles($styles, rootSelector), [rootSelector, $styles.fingerprint]);
4491
- return /* @__PURE__ */ jsx(MemoizedStyle, {
4492
- id: $styles.fingerprint,
4493
- nonce,
4494
- colorsStyles
4495
- });
4496
- }
4497
- __name(LikeC4Styles$1, "LikeC4Styles");
4498
- /**
4499
- * @internal Memoized styles gives a performance boost during development
4500
- */
4501
- var MemoizedStyle = memo((t0) => {
4502
- const $ = c(4);
4503
- const { id, nonce, colorsStyles } = t0;
4504
- const t1 = nonce || void 0;
4505
- let t2;
4506
- if ($[0] !== colorsStyles || $[1] !== id || $[2] !== t1) {
4507
- t2 = /* @__PURE__ */ jsx("style", {
4508
- type: "text/css",
4509
- "data-likec4-colors": id,
4510
- nonce: t1,
4511
- children: colorsStyles
4512
- });
4513
- $[0] = colorsStyles;
4514
- $[1] = id;
4515
- $[2] = t1;
4516
- $[3] = t2;
4517
- } else t2 = $[3];
4518
- return t2;
4519
- });
4520
- MemoizedStyle.displayName = "MemoizedStyle";
4521
- //#endregion
4522
- export { useCallbackRef as $, useRootContainer as A, getNodeIntersectionFromCenterToPoint as B, LikeC4ModelContextProvider as C, EnsureMantine as D, FramerMotionConfig as E, Base as F, parsePaddings as G, isSamePoint as H, hasSubObject as I, selectXYStore as J, stopPropagation as K, bezierControlPoints as L, useRootContainerElement as M, useRootContainerRef as N, LikeC4MantineProvider as O, BaseXYFlow as P, useXYStoreApi as Q, bezierPath as R, CurrentViewModelContext as S, useOptionalLikeC4Model as T, leafNodeRects as U, isEqualRects as V, nodeToRect as W, useXYFlow as X, useCurrentZoomAtLeast as Y, useXYStore as Z, useLikeC4ProjectsContext as _, ElementNodeContainer as a, IconRenderer as at, useId$1 as b, EdgePath as c, t$1 as ct, EdgeContainer as d, e$1 as dt, FitViewPaddings as et, Logo as f, e$2 as ft, useLikeC4Projects as g, useLikeC4ProjectId as h, t$5 as ht, ElementShape as i, IconOrShapeRenderer as it, useRootContainerContext as j, RootContainer as k, EdgeLabelContainer as l, t$2 as lt, useChangeLikeC4Project as m, t$4 as mt, DefaultHandles as n, MinZoom as nt, ElementData as o, IconRendererProvider as ot, LogoIcon as p, t$3 as pt, roundDpr as q, memoEdge as r, ZIndexes as rt, ElementActionButtons as s, IconZoomScan as st, LikeC4Styles$1 as t, IS_SERVER as tt, EdgeLabel as u, e as ut, LikeC4ProjectsContextProvider as v, useOptionalCurrentViewModel as w, useLikeC4Styles as x, useOptionalProjectsContext as y, getNodeCenter as z };