likec4 1.59.4 → 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 (186) hide show
  1. package/README.md +2 -0
  2. package/__app__/codegen/react.mjs +4 -10
  3. package/__app__/codegen/webcomponent.mjs +6 -131
  4. package/__app__/index.html +15 -15
  5. package/__app__/src/aichat/index.mjs +11 -7
  6. package/__app__/src/chunks/AIChat.mjs +1355 -739
  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 +158 -472
  12. package/__app__/src/chunks/libs/@tabler/icons-react.mjs +340 -0
  13. package/__app__/src/chunks/libs/@tanstack-ai.mjs +11841 -1417
  14. package/__app__/src/chunks/libs/@tanstack.mjs +5110 -2404
  15. package/__app__/src/chunks/libs/fast-equals.mjs +507 -214
  16. package/__app__/src/chunks/libs/html-to-image.mjs +613 -0
  17. package/__app__/src/chunks/libs/nanostores.mjs +170 -0
  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 +16 -29
  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 +1826 -2528
  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/fonts.css +112 -1
  61. package/__app__/src/hooks.mjs +1 -0
  62. package/__app__/src/main.mjs +6 -29151
  63. package/__app__/src/pages/EmbedPage.mjs +93 -0
  64. package/__app__/src/pages/ExportPage.mjs +691 -0
  65. package/__app__/src/pages/ProjectsOverview.mjs +23 -0
  66. package/__app__/src/pages/ViewAsD2.mjs +105 -0
  67. package/__app__/src/pages/ViewAsDot.mjs +65 -0
  68. package/__app__/src/pages/ViewAsMmd.mjs +109 -0
  69. package/__app__/src/pages/ViewAsPuml.mjs +105 -0
  70. package/__app__/src/pages/ViewEditor.mjs +220 -0
  71. package/__app__/src/pages/ViewReact.mjs +1 -0
  72. package/__app__/src/pages/export-layout.mjs +95 -0
  73. package/__app__/src/pages/export-page-params.mjs +9 -0
  74. package/__app__/src/pages/styles.css.mjs +23 -0
  75. package/__app__/src/routeTree.gen.mjs +105 -0
  76. package/__app__/src/router.mjs +1 -0
  77. package/__app__/src/routes/__root.mjs +65 -0
  78. package/__app__/src/routes/index.css.mjs +29 -0
  79. package/__app__/src/routes/index.mjs +32 -0
  80. package/__app__/src/routes/project._projectId/-components.mjs +100 -0
  81. package/__app__/src/routes/project._projectId/embed._viewId.mjs +5 -0
  82. package/__app__/src/routes/project._projectId/export._viewId.mjs +24 -0
  83. package/__app__/src/routes/project._projectId/index.mjs +14 -0
  84. package/__app__/src/routes/project._projectId/route.mjs +93 -0
  85. package/__app__/src/routes/project._projectId/view._viewId.d2.mjs +34 -0
  86. package/__app__/src/routes/project._projectId/view._viewId.dot.mjs +41 -0
  87. package/__app__/src/routes/project._projectId/view._viewId.index.mjs +7 -0
  88. package/__app__/src/routes/project._projectId/view._viewId.mjs +23 -0
  89. package/__app__/src/routes/project._projectId/view._viewId.mmd.mjs +39 -0
  90. package/__app__/src/routes/project._projectId/view._viewId.puml.mjs +34 -0
  91. package/__app__/src/routes/projects.mjs +36 -0
  92. package/__app__/src/routes/single-index.mjs +1 -0
  93. package/__app__/src/routes/webcomponent._.mjs +94 -0
  94. package/__app__/src/style.css +18497 -1
  95. package/config/schema.json +146 -97
  96. package/dist/app/render-view-client.css +1 -1
  97. package/dist/app/render-view-client.js +394 -238
  98. package/dist/chunks/enableServer.mjs +1 -1
  99. package/dist/chunks/filenames.mjs +25 -17
  100. package/dist/chunks/generate-likec4.mjs +5 -0
  101. package/dist/chunks/index.d.mts +255 -194
  102. package/dist/chunks/index2.d.mts +8246 -3610
  103. package/dist/chunks/libs/@chenglou/pretext.mjs +9 -0
  104. package/dist/chunks/libs/@chevrotain/gast.mjs +27 -1
  105. package/dist/chunks/libs/@chevrotain/regexp-to-ast.mjs +81 -9
  106. package/dist/chunks/libs/@logtape/logtape.mjs +5 -4
  107. package/dist/chunks/libs/@lume/kiwi.mjs +1 -1
  108. package/dist/chunks/libs/@ts-graphviz/common.d.mts +2 -4
  109. package/dist/chunks/libs/@ts-graphviz/core.mjs +1 -1
  110. package/dist/chunks/libs/birpc.mjs +1 -1
  111. package/dist/chunks/libs/chevrotain-allstar.mjs +2 -2
  112. package/dist/chunks/libs/chevrotain.mjs +88 -36
  113. package/dist/chunks/libs/clone.mjs +1 -0
  114. package/dist/chunks/libs/eventemitter3.mjs +1 -1
  115. package/dist/chunks/libs/fast-equals.mjs +1 -0
  116. package/dist/chunks/libs/fontkit.mjs +1 -0
  117. package/dist/chunks/libs/json5.mjs +4 -4
  118. package/dist/chunks/libs/langium.d.mts +6707 -6715
  119. package/dist/chunks/libs/langium.mjs +16 -24
  120. package/dist/chunks/libs/merge-error-cause.mjs +1 -1
  121. package/dist/chunks/libs/p-limit.mjs +1 -0
  122. package/dist/chunks/libs/p-queue.mjs +1 -1
  123. package/dist/chunks/libs/package-manager-detector.mjs +1 -1
  124. package/dist/chunks/libs/pako.mjs +1 -1
  125. package/dist/chunks/libs/pathe.mjs +1 -1
  126. package/dist/chunks/libs/pretty-ms.mjs +1 -1
  127. package/dist/chunks/libs/remeda.mjs +1 -1
  128. package/dist/chunks/libs/ufo.mjs +1 -1
  129. package/dist/chunks/libs/unstorage.mjs +1 -1
  130. package/dist/chunks/libs/which.mjs +1 -1
  131. package/dist/chunks/node.mjs +111 -77
  132. package/dist/chunks/rolldown-runtime.mjs +1 -1
  133. package/dist/chunks/sequence-view.mjs +1 -1
  134. package/dist/chunks/vite-plugin.mjs +185 -166
  135. package/dist/cli/index.mjs +254 -1306
  136. package/dist/config/index.d.mts +66 -5
  137. package/dist/config/index.mjs +1 -1
  138. package/dist/generators/likec4.d.mts +6530 -0
  139. package/dist/generators/likec4.mjs +1 -0
  140. package/dist/index.d.mts +2 -4
  141. package/dist/model/index.d.mts +0 -7
  142. package/dist/vite-plugin/index.d.mts +83 -58
  143. package/dist/vite-plugin/index.mjs +1 -1
  144. package/dist/vite-plugin/internal/chunks/rolldown-runtime.mjs +8 -0
  145. package/dist/vite-plugin/internal/index.d.mts +92 -17
  146. package/dist/vite-plugin/internal/index.mjs +225 -126
  147. package/generators/likec4/package.json +4 -0
  148. package/package.json +134 -122
  149. package/react/index.d.mts +7496 -26659
  150. package/react/index.mjs +533 -63936
  151. package/react/rolldown-runtime-CfRud99p.js +1 -0
  152. package/skills/likec4-dsl/SKILL.md +474 -0
  153. package/skills/likec4-dsl/evals/evals-public.json +207 -0
  154. package/skills/likec4-dsl/evals/grading-spec.json +603 -0
  155. package/skills/likec4-dsl/references/bridge-leanix-drawio.md +42 -0
  156. package/skills/likec4-dsl/references/cli.md +168 -0
  157. package/skills/likec4-dsl/references/configuration.md +266 -0
  158. package/skills/likec4-dsl/references/deployment.md +160 -0
  159. package/skills/likec4-dsl/references/diffs.md +52 -0
  160. package/skills/likec4-dsl/references/dynamic-views.md +455 -0
  161. package/skills/likec4-dsl/references/examples.md +370 -0
  162. package/skills/likec4-dsl/references/identifier-validity.md +90 -0
  163. package/skills/likec4-dsl/references/include-predicates-wildcards.md +180 -0
  164. package/skills/likec4-dsl/references/model.md +182 -0
  165. package/skills/likec4-dsl/references/predicates.md +123 -0
  166. package/skills/likec4-dsl/references/relationships-bidirectional.md +176 -0
  167. package/skills/likec4-dsl/references/specification.md +79 -0
  168. package/skills/likec4-dsl/references/style-tokens-colors.md +150 -0
  169. package/skills/likec4-dsl/references/troubleshooting.md +101 -0
  170. package/skills/likec4-dsl/references/views.md +329 -0
  171. package/vite-plugin-modules.d.ts +126 -51
  172. package/__app__/src/chunks/LikeC4Styles.mjs +0 -2306
  173. package/__app__/src/chunks/ProjectsOverview.mjs +0 -537
  174. package/__app__/src/chunks/es.mjs +0 -439
  175. package/__app__/src/chunks/libs/@floating-ui.mjs +0 -2532
  176. package/__app__/src/chunks/libs/@mantine.mjs +0 -13868
  177. package/__app__/src/chunks/libs/@xstate/react.mjs +0 -2015
  178. package/__app__/src/chunks/libs/@xyflow/react.mjs +0 -5367
  179. package/__app__/src/chunks/libs/bezier-js.mjs +0 -1007
  180. package/__app__/src/chunks/libs/d3.mjs +0 -2817
  181. package/__app__/src/chunks/libs/framer.mjs +0 -5926
  182. package/__app__/src/chunks/libs/zod.mjs +0 -3176
  183. package/dist/chunks/libs/@chevrotain/types.d.mts +0 -108
  184. package/dist/chunks/libs/picomatch.mjs +0 -1
  185. package/dist/chunks/libs/zod.d.mts +0 -3840
  186. package/dist/chunks/libs/zod.mjs +0 -65
@@ -0,0 +1,258 @@
1
+ import "../../chunks/rolldown-runtime.mjs";
2
+ import { f as css, r as Txt } from "../../chunks/styled-system.mjs";
3
+ import { m as IconChevronDown, s as IconSearch } from "../../chunks/libs/@tabler/icons-react.mjs";
4
+ import { s as Link } from "../../chunks/libs/@tanstack.mjs";
5
+ import { t as useCurrentProject } from "../../chunks/hooks.mjs";
6
+ import { useState } from "react";
7
+ import { c } from "react/compiler-runtime";
8
+ import { jsx, jsxs } from "react/jsx-runtime";
9
+ import { Button, Highlight, Menu, MenuDivider, MenuDropdown, MenuItem, MenuSearch, MenuTarget, ScrollArea } from "@mantine/core";
10
+ import { filterProjects, projectSearchHighlights, useLikeC4Projects } from "likec4/react";
11
+ // src/components/view-page/SelectProject.tsx
12
+ function SelectProject() {
13
+ const $ = c(55);
14
+ const projects = useLikeC4Projects();
15
+ const currentProject = useCurrentProject();
16
+ const [search, setSearch] = useState("");
17
+ if (projects.length < 2) return null;
18
+ let T0;
19
+ let T1;
20
+ let T2;
21
+ let t0;
22
+ let t1;
23
+ let t10;
24
+ let t11;
25
+ let t2;
26
+ let t3;
27
+ let t4;
28
+ let t5;
29
+ let t6;
30
+ let t7;
31
+ let t8;
32
+ let t9;
33
+ if ($[0] !== currentProject.id || $[1] !== currentProject.title || $[2] !== projects || $[3] !== search) {
34
+ const found = filterProjects(projects, search);
35
+ let t12;
36
+ if ($[19] !== search) {
37
+ t12 = projectSearchHighlights(search);
38
+ $[19] = search;
39
+ $[20] = t12;
40
+ } else t12 = $[20];
41
+ const highlight = t12;
42
+ T2 = Menu;
43
+ t7 = "max-content";
44
+ t8 = "click";
45
+ t9 = "bottom-start";
46
+ if ($[21] === Symbol.for("react.memo_cache_sentinel")) {
47
+ t10 = { itemSection: css({ maxWidth: "[250px]" }) };
48
+ $[21] = t10;
49
+ } else t10 = $[21];
50
+ let t13;
51
+ if ($[22] === Symbol.for("react.memo_cache_sentinel")) {
52
+ t13 = /* @__PURE__ */ jsx(IconChevronDown, {
53
+ opacity: .5,
54
+ size: 14
55
+ });
56
+ $[22] = t13;
57
+ } else t13 = $[22];
58
+ const t14 = currentProject.title ?? currentProject.id;
59
+ if ($[23] !== t14) {
60
+ t11 = /* @__PURE__ */ jsx(MenuTarget, { children: /* @__PURE__ */ jsx(Button, {
61
+ variant: "subtle",
62
+ size: "compact-md",
63
+ fz: "sm",
64
+ color: "gray",
65
+ px: "sm",
66
+ maw: "250",
67
+ rightSection: t13,
68
+ visibleFrom: "md",
69
+ children: t14
70
+ }) });
71
+ $[23] = t14;
72
+ $[24] = t11;
73
+ } else t11 = $[24];
74
+ T1 = MenuDropdown;
75
+ const t15 = `Search ${projects.length} projects (* wildcard)`;
76
+ let t16;
77
+ if ($[25] === Symbol.for("react.memo_cache_sentinel")) {
78
+ t16 = /* @__PURE__ */ jsx(IconSearch, { size: 14 });
79
+ $[25] = t16;
80
+ } else t16 = $[25];
81
+ let t17;
82
+ if ($[26] === Symbol.for("react.memo_cache_sentinel")) {
83
+ t17 = (e) => setSearch(e.currentTarget.value);
84
+ $[26] = t17;
85
+ } else t17 = $[26];
86
+ if ($[27] !== search || $[28] !== t15) {
87
+ t4 = /* @__PURE__ */ jsx(MenuSearch, {
88
+ miw: 300,
89
+ mb: 4,
90
+ placeholder: t15,
91
+ leftSection: t16,
92
+ value: search,
93
+ onChange: t17
94
+ });
95
+ $[27] = search;
96
+ $[28] = t15;
97
+ $[29] = t4;
98
+ } else t4 = $[29];
99
+ if ($[30] === Symbol.for("react.memo_cache_sentinel")) {
100
+ t5 = /* @__PURE__ */ jsx(MenuItem, {
101
+ renderRoot: _temp,
102
+ children: "Overview"
103
+ });
104
+ t6 = /* @__PURE__ */ jsx(MenuDivider, {});
105
+ $[30] = t5;
106
+ $[31] = t6;
107
+ } else {
108
+ t5 = $[30];
109
+ t6 = $[31];
110
+ }
111
+ T0 = ScrollArea.Autosize;
112
+ t0 = "min(65vh, 560px)";
113
+ t1 = "auto";
114
+ t2 = found.length === 0 && /* @__PURE__ */ jsx(Txt, {
115
+ fontSize: "sm",
116
+ color: "text.dimmed",
117
+ px: "3",
118
+ py: "1.5",
119
+ children: "No matching project"
120
+ });
121
+ let t18;
122
+ if ($[32] !== currentProject.id || $[33] !== highlight) {
123
+ t18 = (t19) => {
124
+ const { id, title, path } = t19;
125
+ return /* @__PURE__ */ jsx(MenuItem, {
126
+ renderRoot: (props_0) => /* @__PURE__ */ jsx(Link, {
127
+ ...props_0,
128
+ to: "/project/$projectId/view/$viewId/",
129
+ params: {
130
+ projectId: id,
131
+ viewId: "index"
132
+ }
133
+ }),
134
+ rightSection: !!path && /* @__PURE__ */ jsx(Txt, {
135
+ fontSize: "xxs",
136
+ color: "text.non-essential",
137
+ truncate: true,
138
+ children: /* @__PURE__ */ jsx(Highlight, {
139
+ component: "span",
140
+ highlight,
141
+ inherit: true,
142
+ children: path
143
+ })
144
+ }),
145
+ children: /* @__PURE__ */ jsx(Txt, {
146
+ fontSize: "sm",
147
+ truncate: true,
148
+ maxWidth: "[300px]",
149
+ css: currentProject.id === id ? {
150
+ color: "text.bright",
151
+ fontWeight: "semibold"
152
+ } : {},
153
+ children: /* @__PURE__ */ jsx(Highlight, {
154
+ component: "span",
155
+ highlight,
156
+ inherit: true,
157
+ children: title ?? id
158
+ })
159
+ })
160
+ }, id);
161
+ };
162
+ $[32] = currentProject.id;
163
+ $[33] = highlight;
164
+ $[34] = t18;
165
+ } else t18 = $[34];
166
+ t3 = found.map(t18);
167
+ $[0] = currentProject.id;
168
+ $[1] = currentProject.title;
169
+ $[2] = projects;
170
+ $[3] = search;
171
+ $[4] = T0;
172
+ $[5] = T1;
173
+ $[6] = T2;
174
+ $[7] = t0;
175
+ $[8] = t1;
176
+ $[9] = t10;
177
+ $[10] = t11;
178
+ $[11] = t2;
179
+ $[12] = t3;
180
+ $[13] = t4;
181
+ $[14] = t5;
182
+ $[15] = t6;
183
+ $[16] = t7;
184
+ $[17] = t8;
185
+ $[18] = t9;
186
+ } else {
187
+ T0 = $[4];
188
+ T1 = $[5];
189
+ T2 = $[6];
190
+ t0 = $[7];
191
+ t1 = $[8];
192
+ t10 = $[9];
193
+ t11 = $[10];
194
+ t2 = $[11];
195
+ t3 = $[12];
196
+ t4 = $[13];
197
+ t5 = $[14];
198
+ t6 = $[15];
199
+ t7 = $[16];
200
+ t8 = $[17];
201
+ t9 = $[18];
202
+ }
203
+ let t12;
204
+ if ($[35] !== T0 || $[36] !== t0 || $[37] !== t1 || $[38] !== t2 || $[39] !== t3) {
205
+ t12 = /* @__PURE__ */ jsxs(T0, {
206
+ mah: t0,
207
+ type: t1,
208
+ children: [t2, t3]
209
+ });
210
+ $[35] = T0;
211
+ $[36] = t0;
212
+ $[37] = t1;
213
+ $[38] = t2;
214
+ $[39] = t3;
215
+ $[40] = t12;
216
+ } else t12 = $[40];
217
+ let t13;
218
+ if ($[41] !== T1 || $[42] !== t12 || $[43] !== t4 || $[44] !== t5 || $[45] !== t6) {
219
+ t13 = /* @__PURE__ */ jsxs(T1, { children: [
220
+ t4,
221
+ t5,
222
+ t6,
223
+ t12
224
+ ] });
225
+ $[41] = T1;
226
+ $[42] = t12;
227
+ $[43] = t4;
228
+ $[44] = t5;
229
+ $[45] = t6;
230
+ $[46] = t13;
231
+ } else t13 = $[46];
232
+ let t14;
233
+ if ($[47] !== T2 || $[48] !== t10 || $[49] !== t11 || $[50] !== t13 || $[51] !== t7 || $[52] !== t8 || $[53] !== t9) {
234
+ t14 = /* @__PURE__ */ jsxs(T2, {
235
+ width: t7,
236
+ trigger: t8,
237
+ position: t9,
238
+ classNames: t10,
239
+ children: [t11, t13]
240
+ });
241
+ $[47] = T2;
242
+ $[48] = t10;
243
+ $[49] = t11;
244
+ $[50] = t13;
245
+ $[51] = t7;
246
+ $[52] = t8;
247
+ $[53] = t9;
248
+ $[54] = t14;
249
+ } else t14 = $[54];
250
+ return t14;
251
+ }
252
+ function _temp(props) {
253
+ return /* @__PURE__ */ jsx(Link, {
254
+ ...props,
255
+ to: "/projects"
256
+ });
257
+ }
258
+ export { SelectProject };
@@ -0,0 +1,111 @@
1
+ import "../../chunks/rolldown-runtime.mjs";
2
+ import { n as useCurrentView } from "../../chunks/hooks.mjs";
3
+ import { EmbedPanel } from "./share-modal/EmbedPanel.mjs";
4
+ import { WebcomponentsPanel } from "./share-modal/WebcomponentsPanel.mjs";
5
+ import { useState } from "react";
6
+ import { c } from "react/compiler-runtime";
7
+ import { jsx, jsxs } from "react/jsx-runtime";
8
+ import { Button, Group, ModalBody, ModalContent, ModalOverlay, ModalRoot, Tabs, TabsList, TabsPanel, TabsTab } from "@mantine/core";
9
+ // src/components/view-page/ShareModal.tsx
10
+ function ShareModal(t0) {
11
+ const $ = c(19);
12
+ const { onClose } = t0;
13
+ const [diagram] = useCurrentView();
14
+ const [activeTab, setActiveTab] = useState("webcomponent");
15
+ if (!diagram) return null;
16
+ let t1;
17
+ if ($[0] === Symbol.for("react.memo_cache_sentinel")) {
18
+ t1 = /* @__PURE__ */ jsx(ModalOverlay, {
19
+ backgroundOpacity: .5,
20
+ blur: 3
21
+ });
22
+ $[0] = t1;
23
+ } else t1 = $[0];
24
+ let t2;
25
+ if ($[1] === Symbol.for("react.memo_cache_sentinel")) {
26
+ t2 = (tab) => setActiveTab(tab ?? "webcomponent");
27
+ $[1] = t2;
28
+ } else t2 = $[1];
29
+ let t3;
30
+ if ($[2] === Symbol.for("react.memo_cache_sentinel")) {
31
+ t3 = /* @__PURE__ */ jsxs(TabsList, { children: [/* @__PURE__ */ jsx(TabsTab, {
32
+ value: "webcomponent",
33
+ children: "Webcomponent"
34
+ }), /* @__PURE__ */ jsx(TabsTab, {
35
+ value: "embed",
36
+ children: "Embedded"
37
+ })] });
38
+ $[2] = t3;
39
+ } else t3 = $[2];
40
+ let t4;
41
+ if ($[3] !== diagram) {
42
+ t4 = /* @__PURE__ */ jsx(TabsPanel, {
43
+ value: "embed",
44
+ pt: "md",
45
+ children: /* @__PURE__ */ jsx(EmbedPanel, { diagram })
46
+ });
47
+ $[3] = diagram;
48
+ $[4] = t4;
49
+ } else t4 = $[4];
50
+ let t5;
51
+ if ($[5] !== diagram) {
52
+ t5 = /* @__PURE__ */ jsx(TabsPanel, {
53
+ value: "webcomponent",
54
+ pt: "md",
55
+ children: /* @__PURE__ */ jsx(WebcomponentsPanel, { diagram })
56
+ });
57
+ $[5] = diagram;
58
+ $[6] = t5;
59
+ } else t5 = $[6];
60
+ let t6;
61
+ if ($[7] !== activeTab || $[8] !== t4 || $[9] !== t5) {
62
+ t6 = /* @__PURE__ */ jsxs(Tabs, {
63
+ value: activeTab,
64
+ onChange: t2,
65
+ children: [
66
+ t3,
67
+ t4,
68
+ t5
69
+ ]
70
+ });
71
+ $[7] = activeTab;
72
+ $[8] = t4;
73
+ $[9] = t5;
74
+ $[10] = t6;
75
+ } else t6 = $[10];
76
+ let t7;
77
+ if ($[11] !== onClose) {
78
+ t7 = /* @__PURE__ */ jsx(Group, {
79
+ justify: "flex-end",
80
+ mt: "lg",
81
+ children: /* @__PURE__ */ jsx(Button, {
82
+ size: "sm",
83
+ onClick: onClose,
84
+ children: "Close"
85
+ })
86
+ });
87
+ $[11] = onClose;
88
+ $[12] = t7;
89
+ } else t7 = $[12];
90
+ let t8;
91
+ if ($[13] !== t6 || $[14] !== t7) {
92
+ t8 = /* @__PURE__ */ jsx(ModalContent, { children: /* @__PURE__ */ jsxs(ModalBody, { children: [t6, t7] }) });
93
+ $[13] = t6;
94
+ $[14] = t7;
95
+ $[15] = t8;
96
+ } else t8 = $[15];
97
+ let t9;
98
+ if ($[16] !== onClose || $[17] !== t8) {
99
+ t9 = /* @__PURE__ */ jsxs(ModalRoot, {
100
+ size: "xl",
101
+ opened: true,
102
+ onClose,
103
+ children: [t1, t8]
104
+ });
105
+ $[16] = onClose;
106
+ $[17] = t8;
107
+ $[18] = t9;
108
+ } else t9 = $[18];
109
+ return t9;
110
+ }
111
+ export { ShareModal };
@@ -0,0 +1,31 @@
1
+ import "../../../chunks/rolldown-runtime.mjs";
2
+ import { _ as IconAlertTriangle } from "../../../chunks/libs/@tabler/icons-react.mjs";
3
+ import { c } from "react/compiler-runtime";
4
+ import { jsx } from "react/jsx-runtime";
5
+ import { Alert, Text, rem } from "@mantine/core";
6
+ // src/components/view-page/share-modal/AlertLocalhost.tsx
7
+ var AlertLocalhost = () => {
8
+ const $ = c(2);
9
+ let t0;
10
+ if ($[0] === Symbol.for("react.memo_cache_sentinel")) {
11
+ t0 = /* @__PURE__ */ jsx(IconAlertTriangle, {});
12
+ $[0] = t0;
13
+ } else t0 = $[0];
14
+ let t1;
15
+ if ($[1] === Symbol.for("react.memo_cache_sentinel")) {
16
+ t1 = /* @__PURE__ */ jsx(Alert, {
17
+ color: "yellow",
18
+ icon: t0,
19
+ title: "Localhost URL",
20
+ styles: { body: { gap: rem(4) } },
21
+ children: /* @__PURE__ */ jsx(Text, {
22
+ c: "yellow",
23
+ size: "sm",
24
+ children: "You need to deploy your project to make it available on the internet"
25
+ })
26
+ });
27
+ $[1] = t1;
28
+ } else t1 = $[1];
29
+ return t1;
30
+ };
31
+ export { AlertLocalhost };
@@ -0,0 +1,36 @@
1
+ import "../../../chunks/rolldown-runtime.mjs";
2
+ import { h as IconCheck, p as IconCopy } from "../../../chunks/libs/@tabler/icons-react.mjs";
3
+ import { c } from "react/compiler-runtime";
4
+ import { jsx } from "react/jsx-runtime";
5
+ import { Button, rem } from "@mantine/core";
6
+ // src/components/view-page/share-modal/CopyButtonChild.tsx
7
+ var CopyButtonChild = (t0) => {
8
+ const $ = c(7);
9
+ const { copied, copy } = t0;
10
+ const t1 = copied ? "teal" : "gray";
11
+ let t2;
12
+ if ($[0] !== copied) {
13
+ t2 = copied ? /* @__PURE__ */ jsx(IconCheck, { style: { width: rem(16) } }) : /* @__PURE__ */ jsx(IconCopy, { style: { width: rem(16) } });
14
+ $[0] = copied;
15
+ $[1] = t2;
16
+ } else t2 = $[1];
17
+ const t3 = copied ? "Copied" : "Copy to clipboard";
18
+ let t4;
19
+ if ($[2] !== copy || $[3] !== t1 || $[4] !== t2 || $[5] !== t3) {
20
+ t4 = /* @__PURE__ */ jsx(Button, {
21
+ size: "xs",
22
+ color: t1,
23
+ variant: "light",
24
+ leftSection: t2,
25
+ onClick: copy,
26
+ children: t3
27
+ });
28
+ $[2] = copy;
29
+ $[3] = t1;
30
+ $[4] = t2;
31
+ $[5] = t3;
32
+ $[6] = t4;
33
+ } else t4 = $[6];
34
+ return t4;
35
+ };
36
+ export { CopyButtonChild };
@@ -0,0 +1,100 @@
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 { t as useCurrentProject } from "../../../chunks/hooks.mjs";
5
+ import { AlertLocalhost } from "./AlertLocalhost.mjs";
6
+ import { CopyButtonChild } from "./CopyButtonChild.mjs";
7
+ import { useState } from "react";
8
+ import { jsx, jsxs } from "react/jsx-runtime";
9
+ import { useHashHistory } from "likec4:app-config";
10
+ import { ActionIcon, Box, Code, CopyButton, Group, Select, Stack, Text, useMantineColorScheme } from "@mantine/core";
11
+ // src/components/view-page/share-modal/EmbedPanel.tsx
12
+ var EmbedPanel = ({ diagram }) => {
13
+ const router = useRouter();
14
+ const { id: projectId } = useCurrentProject();
15
+ const { colorScheme } = useMantineColorScheme();
16
+ const [theme, setTheme] = useState(colorScheme);
17
+ let location = router.buildLocation({
18
+ to: "/project/$projectId/embed/$viewId/",
19
+ params: {
20
+ projectId,
21
+ viewId: diagram.id
22
+ },
23
+ search: {
24
+ padding: 20,
25
+ ...theme !== "auto" ? { theme } : {}
26
+ }
27
+ }).publicHref;
28
+ location = useHashHistory ? `#${location}` : location;
29
+ const url = new URL(location, window.location.href);
30
+ const width = diagram.bounds.width + 40;
31
+ const height = diagram.bounds.height + 40;
32
+ const href = url.href;
33
+ const code = `
34
+ <div style="aspect-ratio:${width}/${height};width:100%;height:auto;max-width:${width}px;margin:0 auto">
35
+ <iframe src="${href}" width="100%" height="100%" style="border:0;background:transparent;"></iframe>
36
+ </div>
37
+ `.trim();
38
+ return /* @__PURE__ */ jsxs(Stack, { children: [
39
+ code.includes("http://localhost") && /* @__PURE__ */ jsx(AlertLocalhost, {}),
40
+ /* @__PURE__ */ jsx(Box, { children: /* @__PURE__ */ jsx(Text, {
41
+ size: "sm",
42
+ children: "Embedded view is an iframe with a static diagram"
43
+ }) }),
44
+ /* @__PURE__ */ jsxs(Stack, {
45
+ gap: "xs",
46
+ children: [
47
+ /* @__PURE__ */ jsxs(Group, {
48
+ justify: "space-between",
49
+ children: [/* @__PURE__ */ jsx(Box, { children: /* @__PURE__ */ jsx(Text, {
50
+ fw: "500",
51
+ size: "sm",
52
+ children: "HTML"
53
+ }) }), /* @__PURE__ */ jsxs(Group, {
54
+ gap: "xs",
55
+ children: [/* @__PURE__ */ jsx(ActionIcon, {
56
+ component: "a",
57
+ href,
58
+ target: "_blank",
59
+ variant: "light",
60
+ color: "gray",
61
+ children: /* @__PURE__ */ jsx(IconExternalLink, {})
62
+ }), /* @__PURE__ */ jsx(CopyButton, {
63
+ value: code,
64
+ timeout: 1500,
65
+ children: CopyButtonChild
66
+ })]
67
+ })]
68
+ }),
69
+ /* @__PURE__ */ jsx(Code, {
70
+ block: true,
71
+ children: code
72
+ }),
73
+ /* @__PURE__ */ jsx(Box, {
74
+ style: { "alignSelf": "flex-start" },
75
+ children: /* @__PURE__ */ jsx(Select, {
76
+ label: "Color scheme",
77
+ value: theme,
78
+ allowDeselect: false,
79
+ onChange: (v) => setTheme(v ?? "auto"),
80
+ data: [
81
+ {
82
+ value: "auto",
83
+ label: "Auto"
84
+ },
85
+ {
86
+ value: "light",
87
+ label: "Light"
88
+ },
89
+ {
90
+ value: "dark",
91
+ label: "Dark"
92
+ }
93
+ ]
94
+ })
95
+ })
96
+ ]
97
+ })
98
+ ] });
99
+ };
100
+ export { EmbedPanel };