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
@@ -0,0 +1,264 @@
1
+ import "../../../chunks/rolldown-runtime.mjs";
2
+ import { f as IconExternalLink } from "../../../chunks/libs/@tabler/icons-react.mjs";
3
+ import { d as useRouter } from "../../../chunks/libs/@tanstack.mjs";
4
+ import { AlertLocalhost } from "./AlertLocalhost.mjs";
5
+ import { CopyButtonChild } from "./CopyButtonChild.mjs";
6
+ import { c } from "react/compiler-runtime";
7
+ import { jsx, jsxs } from "react/jsx-runtime";
8
+ import { ComponentName } from "likec4:app-config";
9
+ import { ActionIcon, Box, Code, CopyButton, Group, Stack, Text } from "@mantine/core";
10
+ // src/components/view-page/share-modal/WebcomponentsPanel.tsx
11
+ function WebcomponentsPanel(t0) {
12
+ const $ = c(48);
13
+ const { diagram } = t0;
14
+ const router = useRouter();
15
+ let t1;
16
+ if ($[0] !== router.basepath) {
17
+ t1 = router.basepath.endsWith("/") ? router.basepath : `${router.basepath}/`;
18
+ $[0] = router.basepath;
19
+ $[1] = t1;
20
+ } else t1 = $[1];
21
+ const t2 = `${t1}likec4-views.js`;
22
+ let t3;
23
+ if ($[2] !== t2) {
24
+ t3 = new URL(t2, window.location.href);
25
+ $[2] = t2;
26
+ $[3] = t3;
27
+ } else t3 = $[3];
28
+ const href = t3.href;
29
+ let T0;
30
+ let htmlCode;
31
+ let jscode;
32
+ let t4;
33
+ let webcomponentPreview;
34
+ if ($[4] !== diagram.id || $[5] !== href || $[6] !== router) {
35
+ jscode = `
36
+ <script module src="${href}"><\/script>
37
+ `.trim();
38
+ const t5 = `
39
+ <${ComponentName.View}
40
+ view-id="${encodeURIComponent(diagram.id)}"
41
+ browser="true"
42
+ dynamic-variant="sequence">
43
+ </${ComponentName.View}>
44
+ `;
45
+ let t6;
46
+ if ($[12] !== t5) {
47
+ t6 = t5.trim();
48
+ $[12] = t5;
49
+ $[13] = t6;
50
+ } else t6 = $[13];
51
+ htmlCode = t6;
52
+ let t7;
53
+ if ($[14] !== diagram.id || $[15] !== router) {
54
+ t7 = router.buildLocation({
55
+ to: "/webcomponent/$/",
56
+ params: { _splat: diagram.id },
57
+ search: true
58
+ });
59
+ $[14] = diagram.id;
60
+ $[15] = router;
61
+ $[16] = t7;
62
+ } else t7 = $[16];
63
+ webcomponentPreview = t7;
64
+ T0 = Stack;
65
+ t4 = jscode.includes("http://localhost") && /* @__PURE__ */ jsx(AlertLocalhost, {});
66
+ $[4] = diagram.id;
67
+ $[5] = href;
68
+ $[6] = router;
69
+ $[7] = T0;
70
+ $[8] = htmlCode;
71
+ $[9] = jscode;
72
+ $[10] = t4;
73
+ $[11] = webcomponentPreview;
74
+ } else {
75
+ T0 = $[7];
76
+ htmlCode = $[8];
77
+ jscode = $[9];
78
+ t4 = $[10];
79
+ webcomponentPreview = $[11];
80
+ }
81
+ let t5;
82
+ if ($[17] === Symbol.for("react.memo_cache_sentinel")) {
83
+ t5 = /* @__PURE__ */ jsx(Box, { children: /* @__PURE__ */ jsx(Text, {
84
+ size: "sm",
85
+ children: "Add this script to your page:"
86
+ }) });
87
+ $[17] = t5;
88
+ } else t5 = $[17];
89
+ let t6;
90
+ if ($[18] === Symbol.for("react.memo_cache_sentinel")) {
91
+ t6 = /* @__PURE__ */ jsx(Box, { children: /* @__PURE__ */ jsx(Text, {
92
+ fw: "500",
93
+ size: "sm",
94
+ children: "JavaScript"
95
+ }) });
96
+ $[18] = t6;
97
+ } else t6 = $[18];
98
+ let t7;
99
+ if ($[19] === Symbol.for("react.memo_cache_sentinel")) {
100
+ t7 = /* @__PURE__ */ jsx(IconExternalLink, {});
101
+ $[19] = t7;
102
+ } else t7 = $[19];
103
+ let t8;
104
+ if ($[20] !== webcomponentPreview.publicHref) {
105
+ t8 = /* @__PURE__ */ jsx(ActionIcon, {
106
+ component: "a",
107
+ href: webcomponentPreview.publicHref,
108
+ target: "_blank",
109
+ variant: "light",
110
+ color: "gray",
111
+ children: t7
112
+ });
113
+ $[20] = webcomponentPreview.publicHref;
114
+ $[21] = t8;
115
+ } else t8 = $[21];
116
+ let t9;
117
+ if ($[22] !== jscode) {
118
+ t9 = /* @__PURE__ */ jsx(CopyButton, {
119
+ value: jscode,
120
+ timeout: 1500,
121
+ children: CopyButtonChild
122
+ });
123
+ $[22] = jscode;
124
+ $[23] = t9;
125
+ } else t9 = $[23];
126
+ let t10;
127
+ if ($[24] !== t8 || $[25] !== t9) {
128
+ t10 = /* @__PURE__ */ jsxs(Group, {
129
+ justify: "space-between",
130
+ children: [t6, /* @__PURE__ */ jsxs(Group, {
131
+ gap: "xs",
132
+ children: [t8, t9]
133
+ })]
134
+ });
135
+ $[24] = t8;
136
+ $[25] = t9;
137
+ $[26] = t10;
138
+ } else t10 = $[26];
139
+ let t11;
140
+ if ($[27] !== jscode) {
141
+ t11 = /* @__PURE__ */ jsx(Code, {
142
+ block: true,
143
+ children: jscode
144
+ });
145
+ $[27] = jscode;
146
+ $[28] = t11;
147
+ } else t11 = $[28];
148
+ let t12;
149
+ if ($[29] === Symbol.for("react.memo_cache_sentinel")) {
150
+ t12 = /* @__PURE__ */ jsx("br", {});
151
+ $[29] = t12;
152
+ } else t12 = $[29];
153
+ let t13;
154
+ if ($[30] === Symbol.for("react.memo_cache_sentinel")) {
155
+ t13 = /* @__PURE__ */ jsx("code", { children: "<head>" });
156
+ $[30] = t13;
157
+ } else t13 = $[30];
158
+ let t14;
159
+ if ($[31] === Symbol.for("react.memo_cache_sentinel")) {
160
+ t14 = /* @__PURE__ */ jsx(Box, { children: /* @__PURE__ */ jsxs(Text, {
161
+ size: "sm",
162
+ c: "dimmed",
163
+ children: [
164
+ "This script defines a custom element (webcomponent) that renders your diagrams.",
165
+ t12,
166
+ "Script must be inserted once in the ",
167
+ t13,
168
+ " or at the end of the ",
169
+ /* @__PURE__ */ jsx("code", { children: "<body>" }),
170
+ " ",
171
+ "tag."
172
+ ]
173
+ }) });
174
+ $[31] = t14;
175
+ } else t14 = $[31];
176
+ let t15;
177
+ if ($[32] !== t10 || $[33] !== t11) {
178
+ t15 = /* @__PURE__ */ jsxs(Stack, {
179
+ gap: "xs",
180
+ children: [
181
+ t10,
182
+ t11,
183
+ t14
184
+ ]
185
+ });
186
+ $[32] = t10;
187
+ $[33] = t11;
188
+ $[34] = t15;
189
+ } else t15 = $[34];
190
+ let t16;
191
+ if ($[35] === Symbol.for("react.memo_cache_sentinel")) {
192
+ t16 = /* @__PURE__ */ jsx(Box, { children: /* @__PURE__ */ jsx(Text, {
193
+ fw: "500",
194
+ size: "sm",
195
+ children: "HTML"
196
+ }) });
197
+ $[35] = t16;
198
+ } else t16 = $[35];
199
+ let t17;
200
+ let t18;
201
+ if ($[36] !== htmlCode) {
202
+ t17 = /* @__PURE__ */ jsxs(Group, {
203
+ justify: "space-between",
204
+ children: [t16, /* @__PURE__ */ jsx(Box, { children: /* @__PURE__ */ jsx(CopyButton, {
205
+ value: htmlCode,
206
+ timeout: 1500,
207
+ children: CopyButtonChild
208
+ }) })]
209
+ });
210
+ t18 = /* @__PURE__ */ jsx(Code, {
211
+ block: true,
212
+ children: htmlCode
213
+ });
214
+ $[36] = htmlCode;
215
+ $[37] = t17;
216
+ $[38] = t18;
217
+ } else {
218
+ t17 = $[37];
219
+ t18 = $[38];
220
+ }
221
+ let t19;
222
+ if ($[39] === Symbol.for("react.memo_cache_sentinel")) {
223
+ t19 = /* @__PURE__ */ jsx(Box, { children: /* @__PURE__ */ jsxs(Text, {
224
+ size: "sm",
225
+ c: "dimmed",
226
+ children: [
227
+ "Insert this code to your page. Page may have multiple ",
228
+ /* @__PURE__ */ jsx("code", { children: "<likec4-view>" }),
229
+ "."
230
+ ]
231
+ }) });
232
+ $[39] = t19;
233
+ } else t19 = $[39];
234
+ let t20;
235
+ if ($[40] !== t17 || $[41] !== t18) {
236
+ t20 = /* @__PURE__ */ jsxs(Stack, {
237
+ gap: "xs",
238
+ children: [
239
+ t17,
240
+ t18,
241
+ t19
242
+ ]
243
+ });
244
+ $[40] = t17;
245
+ $[41] = t18;
246
+ $[42] = t20;
247
+ } else t20 = $[42];
248
+ let t21;
249
+ if ($[43] !== T0 || $[44] !== t15 || $[45] !== t20 || $[46] !== t4) {
250
+ t21 = /* @__PURE__ */ jsxs(T0, { children: [
251
+ t4,
252
+ t5,
253
+ t15,
254
+ t20
255
+ ] });
256
+ $[43] = T0;
257
+ $[44] = t15;
258
+ $[45] = t20;
259
+ $[46] = t4;
260
+ $[47] = t21;
261
+ } else t21 = $[47];
262
+ return t21;
263
+ }
264
+ export { WebcomponentsPanel };
@@ -0,0 +1,17 @@
1
+ import "../../chunks/rolldown-runtime.mjs";
2
+ import { t as useStore } from "../../chunks/react.mjs";
3
+ import { n as onMount, r as atom } from "../../chunks/libs/nanostores.mjs";
4
+ // src/components/view-page/state.ts
5
+ var headerVisibleAtom = /* @__PURE__ */ atom(true);
6
+ onMount(headerVisibleAtom, () => {
7
+ headerVisibleAtom.set(true);
8
+ });
9
+ var useHeaderVisible = () => {
10
+ return useStore(headerVisibleAtom);
11
+ };
12
+ var headerOps = {
13
+ toggle: (value) => headerVisibleAtom.set(value ?? !headerVisibleAtom.get()),
14
+ show: () => headerVisibleAtom.set(true),
15
+ hide: () => headerVisibleAtom.set(false)
16
+ };
17
+ export { headerOps, useHeaderVisible };
@@ -0,0 +1,26 @@
1
+ import "../chunks/rolldown-runtime.mjs";
2
+ import { c } from "react/compiler-runtime";
3
+ import { jsx } from "react/jsx-runtime";
4
+ import { CustomizationProvider } from "likec4/react";
5
+ import { useCustomComponents } from "likec4:customization";
6
+ // src/context/LikeC4CustomizationContext.tsx
7
+ /**
8
+ * Applies UI overrides from the customization file configured in the LikeC4 Vite plugin
9
+ */
10
+ function LikeC4CustomizationContext(t0) {
11
+ const $ = c(3);
12
+ const { children } = t0;
13
+ const components = useCustomComponents();
14
+ let t1;
15
+ if ($[0] !== children || $[1] !== components) {
16
+ t1 = /* @__PURE__ */ jsx(CustomizationProvider, {
17
+ components,
18
+ children
19
+ });
20
+ $[0] = children;
21
+ $[1] = components;
22
+ $[2] = t1;
23
+ } else t1 = $[2];
24
+ return t1;
25
+ }
26
+ export { LikeC4CustomizationContext };
@@ -0,0 +1,29 @@
1
+ import "../chunks/rolldown-runtime.mjs";
2
+ import { c } from "react/compiler-runtime";
3
+ import { jsx } from "react/jsx-runtime";
4
+ import { IconRendererProvider } from "likec4/react";
5
+ import { getProjectIcons } from "likec4:icons";
6
+ // src/context/LikeC4IconRendererContext.tsx
7
+ function LikeC4IconRendererContext(t0) {
8
+ const $ = c(5);
9
+ const { children, projectId } = t0;
10
+ let t1;
11
+ if ($[0] !== projectId) {
12
+ t1 = getProjectIcons(projectId);
13
+ $[0] = projectId;
14
+ $[1] = t1;
15
+ } else t1 = $[1];
16
+ const IconRenderer = t1;
17
+ let t2;
18
+ if ($[2] !== IconRenderer || $[3] !== children) {
19
+ t2 = /* @__PURE__ */ jsx(IconRendererProvider, {
20
+ value: IconRenderer,
21
+ children
22
+ });
23
+ $[2] = IconRenderer;
24
+ $[3] = children;
25
+ $[4] = t2;
26
+ } else t2 = $[4];
27
+ return t2;
28
+ }
29
+ export { LikeC4IconRendererContext };
@@ -0,0 +1,34 @@
1
+ import "../chunks/rolldown-runtime.mjs";
2
+ import { t as useStore } from "../chunks/react.mjs";
3
+ import { LikeC4ModelDataContextProvider } from "./safeCtx.mjs";
4
+ import { c } from "react/compiler-runtime";
5
+ import { jsx } from "react/jsx-runtime";
6
+ import { LikeC4ModelProvider } from "likec4/react";
7
+ // src/context/LikeC4ModelContext.tsx
8
+ function LikeC4ModelContext(t0) {
9
+ const $ = c(6);
10
+ const { likec4model, children } = t0;
11
+ const model = useStore(likec4model);
12
+ let t1;
13
+ if ($[0] !== children || $[1] !== model) {
14
+ t1 = /* @__PURE__ */ jsx(LikeC4ModelProvider, {
15
+ likec4model: model,
16
+ children
17
+ });
18
+ $[0] = children;
19
+ $[1] = model;
20
+ $[2] = t1;
21
+ } else t1 = $[2];
22
+ let t2;
23
+ if ($[3] !== likec4model || $[4] !== t1) {
24
+ t2 = /* @__PURE__ */ jsx(LikeC4ModelDataContextProvider, {
25
+ value: likec4model,
26
+ children: t1
27
+ });
28
+ $[3] = likec4model;
29
+ $[4] = t1;
30
+ $[5] = t2;
31
+ } else t2 = $[5];
32
+ return t2;
33
+ }
34
+ export { LikeC4ModelContext };
@@ -0,0 +1,40 @@
1
+ import "../chunks/rolldown-runtime.mjs";
2
+ import { c as useNavigate } from "../chunks/libs/@tanstack.mjs";
3
+ import { c } from "react/compiler-runtime";
4
+ import { jsx } from "react/jsx-runtime";
5
+ import { useLikeC4Projects } from "likec4:projects";
6
+ import { LikeC4ProjectsProvider } from "likec4/react";
7
+ import { useCallbackRef } from "@mantine/hooks";
8
+ // src/context/LikeC4ProjectsContext.tsx
9
+ function LikeC4ProjectsContext(t0) {
10
+ const $ = c(6);
11
+ const { children } = t0;
12
+ const projects = useLikeC4Projects();
13
+ const navigate = useNavigate();
14
+ let t1;
15
+ if ($[0] !== navigate) {
16
+ t1 = (projectId) => {
17
+ navigate({
18
+ to: "/project/$projectId/",
19
+ params: { projectId }
20
+ }).catch(console.error);
21
+ };
22
+ $[0] = navigate;
23
+ $[1] = t1;
24
+ } else t1 = $[1];
25
+ const onProjectChange = useCallbackRef(t1);
26
+ let t2;
27
+ if ($[2] !== children || $[3] !== onProjectChange || $[4] !== projects) {
28
+ t2 = /* @__PURE__ */ jsx(LikeC4ProjectsProvider, {
29
+ projects,
30
+ onProjectChange,
31
+ children
32
+ });
33
+ $[2] = children;
34
+ $[3] = onProjectChange;
35
+ $[4] = projects;
36
+ $[5] = t2;
37
+ } else t2 = $[5];
38
+ return t2;
39
+ }
40
+ export { LikeC4ProjectsContext };
@@ -0,0 +1,33 @@
1
+ import "../chunks/rolldown-runtime.mjs";
2
+ import { t as useStore } from "../chunks/react.mjs";
3
+ import { r as atom } from "../chunks/libs/nanostores.mjs";
4
+ import { createContext, useContext } from "react";
5
+ import { c } from "react/compiler-runtime";
6
+ import { jsx } from "react/jsx-runtime";
7
+ // src/context/ModelDiffsContext.tsx
8
+ var ModelDiffsCtx = createContext(/* @__PURE__ */ atom({
9
+ diffs: [],
10
+ views: {}
11
+ }));
12
+ /**
13
+ * Provides the diffs of the project with their compare views
14
+ */
15
+ function ModelDiffsContext(t0) {
16
+ const $ = c(3);
17
+ const { diffs, children } = t0;
18
+ let t1;
19
+ if ($[0] !== children || $[1] !== diffs) {
20
+ t1 = /* @__PURE__ */ jsx(ModelDiffsCtx.Provider, {
21
+ value: diffs,
22
+ children
23
+ });
24
+ $[0] = children;
25
+ $[1] = diffs;
26
+ $[2] = t1;
27
+ } else t1 = $[2];
28
+ return t1;
29
+ }
30
+ var useModelDiffs = () => {
31
+ return useStore(useContext(ModelDiffsCtx));
32
+ };
33
+ export { ModelDiffsContext, useModelDiffs };
@@ -0,0 +1,14 @@
1
+ import "../chunks/rolldown-runtime.mjs";
2
+ import { createContext, useContext } from "react";
3
+ // src/context/safeCtx.ts
4
+ /**
5
+ * To improve experience with HMR, we move context to separate files and use as a boundary for hooks
6
+ */
7
+ var LikeC4ModelDataContext = createContext(null);
8
+ var LikeC4ModelDataContextProvider = LikeC4ModelDataContext.Provider;
9
+ var useLikeC4ModelAtom = () => {
10
+ const ctx = useContext(LikeC4ModelDataContext);
11
+ if (ctx === null) throw new Error("LikeC4ModelAtom is not provided");
12
+ return ctx;
13
+ };
14
+ export { LikeC4ModelDataContextProvider, useLikeC4ModelAtom };
@@ -0,0 +1 @@
1
+ export { t as useCurrentProject, n as useCurrentView, r as useCurrentViewId, i as useLikeC4Views, a as useTransparentBackground } from "./chunks/hooks.mjs";