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,19 +1,212 @@
1
- import { i as __name } from "./rolldown-runtime.mjs";
2
- import { c as useNavigate } from "./libs/@tanstack.mjs";
3
- import { A as r, E as IconSparkles, M as t$1, O as t, T as IconPlayerStopFilled, _ as useStore, b as useTimeoutEffect, c as Markdown, m as useDiagram, t as useCurrentProject } from "./hooks.mjs";
4
- import { At as ScrollAreaAutosize, C as Modal, F as Textarea, H as FloatingWindow, Z as Button, _t as CloseButton, b as Notification, et as Badge, nn as useLocalStorage, r as Title, v as Tooltip, vt as ActionIcon } from "./libs/@mantine.mjs";
5
- import { C as HStack, L as css, T as VStack, y as Txt } from "./styled-system.mjs";
6
- import { i as nanostoresGlobal, n as onMount, r as atom } from "./libs/nanostores.mjs";
7
- import { i as m, m as AnimatePresence } from "./libs/framer.mjs";
8
- import { a as literal, c as string, i as discriminatedUnion, n as array, o as number, r as boolean, s as object, t as _enum } from "./libs/zod.mjs";
1
+ import { r as __name } from "./rolldown-runtime.mjs";
2
+ import { f as css, i as HStack, o as VStack, r as Txt } from "./styled-system.mjs";
3
+ import { t as useSyncedRef } from "./useSyncedRef.mjs";
4
+ import { v as createReactComponent } from "./libs/@tabler/icons-react.mjs";
9
5
  import { a as toolDefinition, i as fetchServerSentEvents, n as useChat$1, r as clientTools, t as ChatMessage$1 } from "./libs/@tanstack-ai.mjs";
10
- import { createContext, use, useEffect, useRef, useState } from "react";
6
+ import { t as useStore } from "./react.mjs";
7
+ import { i as nanostoresGlobal, n as onMount, r as atom } from "./libs/nanostores.mjs";
8
+ import { c as useNavigate } from "./libs/@tanstack.mjs";
9
+ import { a as a$2, c as r$1, i as t, l as t$1, n as e, o as e$1, r as n, s as n$1, t as a$3 } from "./find.mjs";
10
+ import { t as useCurrentProject } from "./hooks.mjs";
11
+ import { createContext, use, useCallback, useEffect, useRef, useState } from "react";
11
12
  import { c } from "react/compiler-runtime";
12
- import { Fragment as Fragment$1, jsx, jsxs } from "react/jsx-runtime";
13
+ import { Fragment, jsx, jsxs } from "react/jsx-runtime";
14
+ import { ActionIcon, Badge, Button, CloseButton, FloatingWindow, Modal, Notification, ScrollAreaAutosize, Textarea, Title, Tooltip } from "@mantine/core";
15
+ import { Markdown, useDiagram } from "likec4/react";
16
+ import { useLocalStorage } from "@mantine/hooks";
17
+ import { z } from "zod";
18
+ import { AnimatePresence, m } from "motion/react";
13
19
  import { RichText, nonNullable, nonexhaustive } from "@likec4/core";
14
- import { ElementShapes } from "@likec4/core/styles";
15
20
  import { AIAdapter } from "likec4:rpc";
16
- //#region ../../node_modules/.pnpm/nanostores@1.5.5/node_modules/nanostores/computed/index.js
21
+ import { ElementShapes } from "@likec4/core/styles";
22
+ // ../../node_modules/.pnpm/remeda@2.52.0/node_modules/remeda/dist/map.js
23
+ function r(...t$2) {
24
+ return t(i, t$2, a$1);
25
+ }
26
+ var i = (e, t) => e.map(t);
27
+ var a$1 = /* @__PURE__ */ __name((e$2) => n(e$2) ? e((t, n, r) => e$2(t, n, r)) : e$2, "a");
28
+ // ../../node_modules/.pnpm/remeda@2.52.0/node_modules/remeda/dist/pipe-D-eT-Ko7.js
29
+ var a = "Remeda: unexpected access to a callback's `data` argument during lazy evaluation.";
30
+ var o = /^(?:0|[1-9]\d*)$/u;
31
+ var s = new Proxy([{ error: a }], {
32
+ get: c$1,
33
+ getOwnPropertyDescriptor: c$1,
34
+ has: c$1,
35
+ ownKeys: l,
36
+ defineProperty: l,
37
+ deleteProperty: l,
38
+ preventExtensions: l,
39
+ set: l,
40
+ setPrototypeOf: l
41
+ });
42
+ function c$1(e, t) {
43
+ (t in Array.prototype || o.test(String(t))) && l();
44
+ }
45
+ __name(c$1, "c");
46
+ function l() {
47
+ throw Error(a);
48
+ }
49
+ function u(t, n, r) {
50
+ let i = n(...r);
51
+ let a = i.requiresData ? [] : void 0;
52
+ let o = a ?? s;
53
+ let c = a$2();
54
+ let l = [];
55
+ let u = 0;
56
+ if (Array.isArray(t)) for (let e of t) {
57
+ a?.push(e);
58
+ let t = d(i(e, u, o, c), l, c);
59
+ if (u += 1, t) break;
60
+ }
61
+ else for (let e of t) {
62
+ a?.push(e);
63
+ let t = d(i(e, u, o, c), l, c);
64
+ if (u += 1, t) break;
65
+ }
66
+ return n.single ? l[0] : l;
67
+ }
68
+ function d(e, a, o) {
69
+ if (typeof e == `symbol`) {
70
+ if (e === e$1) return !1;
71
+ if (e === r$1) {
72
+ for (let e of o.values) a.push(e);
73
+ return !1;
74
+ }
75
+ if (e === n$1) return a.push(o.value), !0;
76
+ if (e === t$1) return !0;
77
+ }
78
+ return a.push(e), !1;
79
+ }
80
+ function f(e, ...t) {
81
+ if (t.length === 0) return e;
82
+ if (t.length === 1) {
83
+ let n = t[0];
84
+ return `lazy` in n ? u(e, n.lazy, n.lazyArgs) : n(e);
85
+ }
86
+ let n = e;
87
+ let r = 0;
88
+ for (; r < t.length;) {
89
+ let e = t[r];
90
+ if (!(`lazy` in e)) {
91
+ n = e(n), r += 1;
92
+ continue;
93
+ }
94
+ let i = t[r + 1];
95
+ if (i === void 0 || !(`lazy` in i) || e.lazy.single) {
96
+ n = u(n, e.lazy, e.lazyArgs), r += 1;
97
+ continue;
98
+ }
99
+ let a = p(t, r);
100
+ n = m$1(n, a), r += a.length, t[r - 1].lazy.single && (n = n[0]);
101
+ }
102
+ return n;
103
+ }
104
+ function p(e, t) {
105
+ let n = [];
106
+ for (let r = t; r < e.length; r++) {
107
+ let t = e[r];
108
+ if (!(`lazy` in t)) break;
109
+ let i = t.lazy(...t.lazyArgs);
110
+ if (n.push(i.requiresData ? {
111
+ lazyEvaluator: i,
112
+ index: 0,
113
+ requiresData: !0,
114
+ items: []
115
+ } : {
116
+ lazyEvaluator: i,
117
+ index: 0,
118
+ requiresData: !1,
119
+ items: s
120
+ }), t.lazy.single) break;
121
+ }
122
+ return n;
123
+ }
124
+ function m$1(t, n) {
125
+ let r = [];
126
+ let i = a$2();
127
+ if (Array.isArray(t)) {
128
+ for (let e of t) if (h(n, r, e, i, 0)) break;
129
+ } else for (let e of t) if (h(n, r, e, i, 0)) break;
130
+ return r;
131
+ }
132
+ __name(m$1, "m");
133
+ function h(e, a, o, s, c) {
134
+ let l = o;
135
+ let u = !1;
136
+ for (let o = c; o < e.length; o++) {
137
+ let c = e[o];
138
+ c.requiresData && c.items.push(l);
139
+ let { lazyEvaluator: d } = c, f = d(l, c.index, c.items, s);
140
+ if (c.index += 1, typeof f == `symbol`) {
141
+ if (f === e$1) return u;
142
+ if (f === r$1) {
143
+ for (let t of s.values) if (h(e, a, t, s, o + 1)) return !0;
144
+ return u;
145
+ }
146
+ if (f === n$1) {
147
+ l = s.value, u = !0;
148
+ continue;
149
+ }
150
+ if (f === t$1) return !0;
151
+ }
152
+ l = f;
153
+ }
154
+ return a.push(l), u;
155
+ }
156
+ /**
157
+ * @license @tabler/icons-react v3.49.0 - MIT
158
+ *
159
+ * This source code is licensed under the MIT license.
160
+ * See the LICENSE file in the root directory of this source tree.
161
+ */
162
+ var IconSparkles = createReactComponent("outline", "sparkles", "Sparkles", [["path", {
163
+ "d": "M16 18a2 2 0 0 1 2 2a2 2 0 0 1 2 -2a2 2 0 0 1 -2 -2a2 2 0 0 1 -2 2m0 -12a2 2 0 0 1 2 2a2 2 0 0 1 2 -2a2 2 0 0 1 -2 -2a2 2 0 0 1 -2 2m-7 12a6 6 0 0 1 6 -6a6 6 0 0 1 -6 -6a6 6 0 0 1 -6 6a6 6 0 0 1 6 6",
164
+ "key": "svg-0"
165
+ }]]);
166
+ /**
167
+ * @license @tabler/icons-react v3.49.0 - MIT
168
+ *
169
+ * This source code is licensed under the MIT license.
170
+ * See the LICENSE file in the root directory of this source tree.
171
+ */
172
+ var IconPlayerStopFilled = createReactComponent("filled", "player-stop-filled", "PlayerStopFilled", [["path", {
173
+ "d": "M17 4h-10a3 3 0 0 0 -3 3v10a3 3 0 0 0 3 3h10a3 3 0 0 0 3 -3v-10a3 3 0 0 0 -3 -3z",
174
+ "key": "svg-0"
175
+ }]]);
176
+ // ../../node_modules/.pnpm/@react-hookz+web@26.1.0_react-dom@19.3.1_react@19.3.1__react@19.3.1/node_modules/@react-hookz/web/dist/useTimeoutEffect/index.js
177
+ var cancelTimeout = (id) => {
178
+ if (id) clearTimeout(id);
179
+ };
180
+ /**
181
+ * Like `setTimeout` but in the form of a react hook.
182
+ *
183
+ * @param callback Callback to be called after the timeout. Changing this
184
+ * will not reset the timeout.
185
+ * @param ms Timeout delay in milliseconds. `undefined` disables the timeout.
186
+ * Keep in mind, that changing this parameter will re-set timeout, meaning
187
+ * that it will be set as new after the change.
188
+ */
189
+ function useTimeoutEffect(callback, ms) {
190
+ const cbRef = useSyncedRef(callback);
191
+ const msRef = useSyncedRef(ms);
192
+ const timeoutIdRef = useRef(null);
193
+ const cancel = useCallback(() => {
194
+ cancelTimeout(timeoutIdRef.current);
195
+ }, []);
196
+ const reset = useCallback(() => {
197
+ if (msRef.current === void 0) return;
198
+ cancel();
199
+ timeoutIdRef.current = setTimeout(() => {
200
+ cbRef.current();
201
+ }, msRef.current);
202
+ }, []);
203
+ useEffect(() => {
204
+ reset();
205
+ return cancel;
206
+ }, [ms]);
207
+ return [cancel, reset];
208
+ }
209
+ // ../../node_modules/.pnpm/nanostores@1.5.5/node_modules/nanostores/computed/index.js
17
210
  var computedStore = (stores, cb, batched) => {
18
211
  if (!Array.isArray(stores)) stores = [stores];
19
212
  let previousArgs;
@@ -55,14 +248,12 @@ var computedStore = (stores, cb, batched) => {
55
248
  return $computed;
56
249
  };
57
250
  var batched = /* @__NO_SIDE_EFFECTS__ */ (stores, fn) => computedStore(stores, fn, true);
58
- //#endregion
59
- //#region src/aichat/ChatContext.tsx
251
+ // src/aichat/ChatContext.tsx
60
252
  var ChatContext = createContext(null);
61
253
  function useChatContext() {
62
254
  return nonNullable(use(ChatContext), "useChatContext: ChatProvider is not provided");
63
255
  }
64
- //#endregion
65
- //#region src/aichat/ChatInput.tsx
256
+ // src/aichat/ChatInput.tsx
66
257
  function ChatInput() {
67
258
  const $ = c(22);
68
259
  const { sendMessage, isLoading, messages, clear, stop } = useChatContext();
@@ -157,8 +348,7 @@ function ChatInput() {
157
348
  } else t6 = $[21];
158
349
  return t6;
159
350
  }
160
- //#endregion
161
- //#region src/aichat/ChatMessage.tsx
351
+ // src/aichat/ChatMessage.tsx
162
352
  function ChatMessages() {
163
353
  const $ = c(7);
164
354
  const { messages, error } = useChatContext();
@@ -188,7 +378,7 @@ function ChatMessages() {
188
378
  } else t1 = $[3];
189
379
  let t2;
190
380
  if ($[4] !== t0 || $[5] !== t1) {
191
- t2 = /* @__PURE__ */ jsxs(Fragment$1, { children: [t0, t1] });
381
+ t2 = /* @__PURE__ */ jsxs(Fragment, { children: [t0, t1] });
192
382
  $[4] = t0;
193
383
  $[5] = t1;
194
384
  $[6] = t2;
@@ -235,7 +425,7 @@ var UserMessageTextPart = (t0) => {
235
425
  const { content } = t0;
236
426
  let t1;
237
427
  if ($[0] !== content) {
238
- t1 = /* @__PURE__ */ jsx(Fragment$1, { children: content });
428
+ t1 = /* @__PURE__ */ jsx(Fragment, { children: content });
239
429
  $[0] = content;
240
430
  $[1] = t1;
241
431
  } else t1 = $[1];
@@ -261,8 +451,7 @@ var MarkdownTextPart = (t0) => {
261
451
  } else t2 = $[3];
262
452
  return t2;
263
453
  };
264
- //#endregion
265
- //#region src/aichat/semantic-layout-log-state.ts
454
+ // src/aichat/semantic-layout-log-state.ts
266
455
  var $log = /* @__PURE__ */ atom("");
267
456
  var $status = /* @__PURE__ */ atom("closed");
268
457
  var $state = /* @__PURE__ */ batched([$log, $status], (log, status) => ({
@@ -276,8 +465,7 @@ function closeSemanticLayoutLog() {
276
465
  $status.set("closed");
277
466
  $log.set("");
278
467
  }
279
- //#endregion
280
- //#region src/aichat/SemanticLayoutLog.tsx
468
+ // src/aichat/SemanticLayoutLog.tsx
281
469
  /**
282
470
  * Modal that shows the log of the semantic layout application
283
471
  * (For internal debugging purposes)
@@ -323,67 +511,65 @@ function SemanticLayoutLog() {
323
511
  } else t3 = $[5];
324
512
  return t3;
325
513
  }
326
- //#endregion
327
- //#region ../vite-plugin/src/ai/tools.ts
328
- var nodeSchema = object({
329
- id: string().meta({ description: "Node ID" }),
330
- title: string(),
331
- shape: _enum(ElementShapes),
332
- color: string().meta({ description: "Node color, from theme or custom" }),
333
- icon: string().nullish(),
334
- parentId: string().nullish().meta({ description: "Parent node ID (if node is nested)" }),
335
- children: array(string()).nullish().meta({ description: "Nested node IDs (if node is compound)" }),
336
- x: number(),
337
- y: number(),
338
- width: number(),
339
- height: number(),
340
- modelFqn: string().nullish().meta({ description: "Model element FQN (if node has reference)" })
514
+ // ../vite-plugin/src/ai/tools.ts
515
+ var nodeSchema = z.object({
516
+ id: z.string().meta({ description: "Node ID" }),
517
+ title: z.string(),
518
+ shape: z.enum(ElementShapes),
519
+ color: z.string().meta({ description: "Node color, from theme or custom" }),
520
+ icon: z.string().nullish(),
521
+ parentId: z.string().nullish().meta({ description: "Parent node ID (if node is nested)" }),
522
+ children: z.array(z.string()).nullish().meta({ description: "Nested node IDs (if node is compound)" }),
523
+ x: z.number(),
524
+ y: z.number(),
525
+ width: z.number(),
526
+ height: z.number(),
527
+ modelFqn: z.string().nullish().meta({ description: "Model element FQN (if node has reference)" })
341
528
  });
342
529
  var readUiStateDef = toolDefinition({
343
530
  name: "read_ui",
344
531
  description: "Read current UI state. Use arguments to include additional data.",
345
532
  needsApproval: false,
346
- inputSchema: object({
347
- selectedNode: boolean().default(false).meta({ description: "Include selected node (if any)" }),
348
- nodes: boolean().default(false).meta({ description: "Include all nodes from the view" })
533
+ inputSchema: z.object({
534
+ selectedNode: z.boolean().default(false).meta({ description: "Include selected node (if any)" }),
535
+ nodes: z.boolean().default(false).meta({ description: "Include all nodes from the view" })
349
536
  }),
350
- outputSchema: object({
351
- projectId: string(),
352
- editMode: boolean().meta({ description: "Whether the UI is in edit mode" }),
353
- view: object({
354
- id: string(),
355
- title: string(),
356
- type: _enum([
537
+ outputSchema: z.object({
538
+ projectId: z.string(),
539
+ editMode: z.boolean().meta({ description: "Whether the UI is in edit mode" }),
540
+ view: z.object({
541
+ id: z.string(),
542
+ title: z.string(),
543
+ type: z.enum([
357
544
  "element",
358
545
  "deployment",
359
546
  "dynamic"
360
547
  ]).meta({ description: "Type of the current view" })
361
548
  }).meta({ description: "Current view" }),
362
- nodes: array(nodeSchema).nullish(),
549
+ nodes: z.array(nodeSchema).nullish(),
363
550
  selectedNode: nodeSchema.nullish()
364
551
  })
365
552
  });
366
- var focusCommand = object({
367
- type: literal("focus"),
368
- elementId: string().meta({ description: "Element ID (FQN)" })
553
+ var focusCommand = z.object({
554
+ type: z.literal("focus"),
555
+ elementId: z.string().meta({ description: "Element ID (FQN)" })
369
556
  }).meta({ description: "Focus UI on an element by its FQN" });
370
- var fitViewCommand = object({ type: literal("fitview") }).meta({ description: "Zoom out to fit all elements in the viewport, and clear any selection/focus" });
557
+ var fitViewCommand = z.object({ type: z.literal("fitview") }).meta({ description: "Zoom out to fit all elements in the viewport, and clear any selection/focus" });
371
558
  var updateUiStateDef = toolDefinition({
372
559
  name: "update_ui",
373
560
  description: "Update UI state by executing a command.",
374
561
  needsApproval: false,
375
- inputSchema: object({ command: discriminatedUnion("type", [focusCommand, fitViewCommand]) }),
376
- outputSchema: object({})
562
+ inputSchema: z.object({ command: z.discriminatedUnion("type", [focusCommand, fitViewCommand]) }),
563
+ outputSchema: z.object({})
377
564
  });
378
565
  var navigateToDef = toolDefinition({
379
566
  name: "navigate_to",
380
567
  description: "Navigates UI to another view",
381
568
  needsApproval: false,
382
- inputSchema: object({ viewId: string().meta({ description: "View ID" }) }),
383
- outputSchema: object({})
569
+ inputSchema: z.object({ viewId: z.string().meta({ description: "View ID" }) }),
570
+ outputSchema: z.object({})
384
571
  });
385
- //#endregion
386
- //#region ../../node_modules/.pnpm/superjson@2.2.6/node_modules/superjson/dist/double-indexed-kv.js
572
+ // ../../node_modules/.pnpm/superjson@2.2.6/node_modules/superjson/dist/double-indexed-kv.js
387
573
  var DoubleIndexedKV = class {
388
574
  constructor() {
389
575
  this.keyToValue = /* @__PURE__ */ new Map();
@@ -404,8 +590,7 @@ var DoubleIndexedKV = class {
404
590
  this.valueToKey.clear();
405
591
  }
406
592
  };
407
- //#endregion
408
- //#region ../../node_modules/.pnpm/superjson@2.2.6/node_modules/superjson/dist/registry.js
593
+ // ../../node_modules/.pnpm/superjson@2.2.6/node_modules/superjson/dist/registry.js
409
594
  var Registry = class {
410
595
  constructor(generateIdentifier) {
411
596
  this.generateIdentifier = generateIdentifier;
@@ -426,8 +611,7 @@ var Registry = class {
426
611
  return this.kv.getByKey(identifier);
427
612
  }
428
613
  };
429
- //#endregion
430
- //#region ../../node_modules/.pnpm/superjson@2.2.6/node_modules/superjson/dist/class-registry.js
614
+ // ../../node_modules/.pnpm/superjson@2.2.6/node_modules/superjson/dist/class-registry.js
431
615
  var ClassRegistry = class extends Registry {
432
616
  constructor() {
433
617
  super((c) => c.name);
@@ -443,8 +627,7 @@ var ClassRegistry = class extends Registry {
443
627
  return this.classToAllowedProps.get(value);
444
628
  }
445
629
  };
446
- //#endregion
447
- //#region ../../node_modules/.pnpm/superjson@2.2.6/node_modules/superjson/dist/util.js
630
+ // ../../node_modules/.pnpm/superjson@2.2.6/node_modules/superjson/dist/util.js
448
631
  function valuesOfObj(record) {
449
632
  if ("values" in Object) return Object.values(record);
450
633
  const values = [];
@@ -472,8 +655,7 @@ function findArr(record, predicate) {
472
655
  if (predicate(value)) return value;
473
656
  }
474
657
  }
475
- //#endregion
476
- //#region ../../node_modules/.pnpm/superjson@2.2.6/node_modules/superjson/dist/custom-transformer-registry.js
658
+ // ../../node_modules/.pnpm/superjson@2.2.6/node_modules/superjson/dist/custom-transformer-registry.js
477
659
  var CustomTransformerRegistry = class {
478
660
  constructor() {
479
661
  this.transfomers = {};
@@ -488,8 +670,7 @@ var CustomTransformerRegistry = class {
488
670
  return this.transfomers[name];
489
671
  }
490
672
  };
491
- //#endregion
492
- //#region ../../node_modules/.pnpm/superjson@2.2.6/node_modules/superjson/dist/is.js
673
+ // ../../node_modules/.pnpm/superjson@2.2.6/node_modules/superjson/dist/is.js
493
674
  var getType$1 = /* @__PURE__ */ __name((payload) => Object.prototype.toString.call(payload).slice(8, -1), "getType");
494
675
  var isUndefined = (payload) => typeof payload === "undefined";
495
676
  var isNull = (payload) => payload === null;
@@ -516,8 +697,7 @@ var isBigint = (payload) => typeof payload === "bigint";
516
697
  var isInfinite = (payload) => payload === Infinity || payload === -Infinity;
517
698
  var isTypedArray = (payload) => ArrayBuffer.isView(payload) && !(payload instanceof DataView);
518
699
  var isURL = (payload) => payload instanceof URL;
519
- //#endregion
520
- //#region ../../node_modules/.pnpm/superjson@2.2.6/node_modules/superjson/dist/pathstringifier.js
700
+ // ../../node_modules/.pnpm/superjson@2.2.6/node_modules/superjson/dist/pathstringifier.js
521
701
  var escapeKey = (key) => key.replace(/\\/g, "\\\\").replace(/\./g, "\\.");
522
702
  var stringifyPath = (path) => path.map(String).map(escapeKey).join(".");
523
703
  var parsePath = (string, legacyPaths) => {
@@ -549,8 +729,7 @@ var parsePath = (string, legacyPaths) => {
549
729
  result.push(lastSegment);
550
730
  return result;
551
731
  };
552
- //#endregion
553
- //#region ../../node_modules/.pnpm/superjson@2.2.6/node_modules/superjson/dist/transformer.js
732
+ // ../../node_modules/.pnpm/superjson@2.2.6/node_modules/superjson/dist/transformer.js
554
733
  function simpleTransformation(isApplicable, annotation, transform, untransform) {
555
734
  return {
556
735
  isApplicable,
@@ -706,8 +885,7 @@ var untransformValue = (json, type, superJson) => {
706
885
  return transformation.untransform(json, superJson);
707
886
  }
708
887
  };
709
- //#endregion
710
- //#region ../../node_modules/.pnpm/superjson@2.2.6/node_modules/superjson/dist/accessDeep.js
888
+ // ../../node_modules/.pnpm/superjson@2.2.6/node_modules/superjson/dist/accessDeep.js
711
889
  var getNthKey = (value, n) => {
712
890
  if (n > value.size) throw new Error("index out of bounds");
713
891
  const keys = value.keys();
@@ -793,8 +971,7 @@ var setDeep = (object, path, mapper) => {
793
971
  }
794
972
  return object;
795
973
  };
796
- //#endregion
797
- //#region ../../node_modules/.pnpm/superjson@2.2.6/node_modules/superjson/dist/plainer.js
974
+ // ../../node_modules/.pnpm/superjson@2.2.6/node_modules/superjson/dist/plainer.js
798
975
  var enableLegacyPaths = (version) => version < 1;
799
976
  function traverse(tree, walker, version, origin = []) {
800
977
  if (!tree) return;
@@ -893,20 +1070,17 @@ var walker = (object, identities, superJson, dedupe, path = [], objectsInThisPat
893
1070
  if (!primitive) seenObjects.set(object, result);
894
1071
  return result;
895
1072
  };
896
- //#endregion
897
- //#region ../../node_modules/.pnpm/is-what@5.5.0/node_modules/is-what/dist/getType.js
1073
+ // ../../node_modules/.pnpm/is-what@5.5.0/node_modules/is-what/dist/getType.js
898
1074
  /** Returns the object type of the given payload */
899
1075
  function getType(payload) {
900
1076
  return Object.prototype.toString.call(payload).slice(8, -1);
901
1077
  }
902
- //#endregion
903
- //#region ../../node_modules/.pnpm/is-what@5.5.0/node_modules/is-what/dist/isArray.js
1078
+ // ../../node_modules/.pnpm/is-what@5.5.0/node_modules/is-what/dist/isArray.js
904
1079
  /** Returns whether the payload is an array */
905
1080
  function isArray(payload) {
906
1081
  return getType(payload) === "Array";
907
1082
  }
908
- //#endregion
909
- //#region ../../node_modules/.pnpm/is-what@5.5.0/node_modules/is-what/dist/isPlainObject.js
1083
+ // ../../node_modules/.pnpm/is-what@5.5.0/node_modules/is-what/dist/isPlainObject.js
910
1084
  /**
911
1085
  * Returns whether the payload is a plain JavaScript object (excluding special classes or objects
912
1086
  * with other prototypes)
@@ -916,8 +1090,7 @@ function isPlainObject(payload) {
916
1090
  const prototype = Object.getPrototypeOf(payload);
917
1091
  return !!prototype && prototype.constructor === Object && prototype === Object.prototype;
918
1092
  }
919
- //#endregion
920
- //#region ../../node_modules/.pnpm/copy-anything@4.0.5/node_modules/copy-anything/dist/index.js
1093
+ // ../../node_modules/.pnpm/copy-anything@4.0.5/node_modules/copy-anything/dist/index.js
921
1094
  function assignProp(carry, key, newVal, originalObject, includeNonenumerable) {
922
1095
  const propType = {}.propertyIsEnumerable.call(originalObject, key) ? "enumerable" : "nonenumerable";
923
1096
  if (propType === "enumerable") carry[key] = newVal;
@@ -955,8 +1128,7 @@ function copy(target, options = {}) {
955
1128
  return carry;
956
1129
  }, {});
957
1130
  }
958
- //#endregion
959
- //#region ../../node_modules/.pnpm/superjson@2.2.6/node_modules/superjson/dist/index.js
1131
+ // ../../node_modules/.pnpm/superjson@2.2.6/node_modules/superjson/dist/index.js
960
1132
  var SuperJSON = class {
961
1133
  /**
962
1134
  * @param dedupeReferentialEqualities If true, SuperJSON will make sure only one instance of referentially equal objects are serialized and the rest are replaced with `null`.
@@ -1030,8 +1202,7 @@ SuperJSON.registerClass;
1030
1202
  SuperJSON.registerCustom;
1031
1203
  SuperJSON.registerSymbol;
1032
1204
  SuperJSON.allowErrorProps;
1033
- //#endregion
1034
- //#region src/aichat/useChat.tsx
1205
+ // src/aichat/useChat.tsx
1035
1206
  function mapToNodeData(storeState) {
1036
1207
  return ({ id, data, ...node }) => {
1037
1208
  let icon = data.icon ?? void 0;
@@ -1082,8 +1253,8 @@ function useChatTools() {
1082
1253
  const { view, focusedNode, xynodes, xystore, toggledFeatures, features } = diagram.getContext();
1083
1254
  const isReadOnly = toggledFeatures.enableReadOnly ?? features.enableReadOnly;
1084
1255
  const toNodeData = mapToNodeData(xystore.getState());
1085
- const nodes = params.nodes === true && t(xynodes, toNodeData) || void 0;
1086
- const selectedNode = params.selectedNode === true && t$1(xynodes, r((n) => !!n.selected || n.id === focusedNode), (n_0) => n_0 ? toNodeData(n_0) : void 0);
1256
+ const nodes = params.nodes === true && r(xynodes, toNodeData) || void 0;
1257
+ const selectedNode = params.selectedNode === true && f(xynodes, a$3((n) => !!n.selected || n.id === focusedNode), (n_0) => n_0 ? toNodeData(n_0) : void 0);
1087
1258
  return {
1088
1259
  projectId,
1089
1260
  editMode: !isReadOnly,
@@ -1148,7 +1319,7 @@ var storage$1 = {
1148
1319
  }
1149
1320
  };
1150
1321
  function useChat(options) {
1151
- const $ = c(7);
1322
+ const $ = c(9);
1152
1323
  let t0;
1153
1324
  if ($[0] === Symbol.for("react.memo_cache_sentinel")) {
1154
1325
  t0 = {
@@ -1158,38 +1329,43 @@ function useChat(options) {
1158
1329
  $[0] = t0;
1159
1330
  } else t0 = $[0];
1160
1331
  const memoProps = t0;
1161
- const t1 = useChatTools();
1162
- let t2;
1163
- if ($[1] !== options || $[2] !== t1) {
1164
- t2 = {
1165
- ...memoProps,
1166
- ...options,
1167
- tools: t1
1168
- };
1332
+ let t1;
1333
+ if ($[1] !== options) {
1334
+ t1 = options ?? {};
1169
1335
  $[1] = options;
1170
1336
  $[2] = t1;
1171
- $[3] = t2;
1172
- } else t2 = $[3];
1173
- const chat = useChat$1(t2);
1337
+ } else t1 = $[2];
1338
+ const t2 = useChatTools();
1174
1339
  let t3;
1340
+ if ($[3] !== t1 || $[4] !== t2) {
1341
+ t3 = {
1342
+ ...memoProps,
1343
+ ...t1,
1344
+ tools: t2
1345
+ };
1346
+ $[3] = t1;
1347
+ $[4] = t2;
1348
+ $[5] = t3;
1349
+ } else t3 = $[5];
1350
+ const chat = useChat$1(t3);
1175
1351
  let t4;
1176
- if ($[4] !== chat.messages) {
1177
- t3 = () => {
1352
+ let t5;
1353
+ if ($[6] !== chat.messages) {
1354
+ t4 = () => {
1178
1355
  storage$1.write(chat.messages);
1179
1356
  };
1180
- t4 = [chat.messages];
1181
- $[4] = chat.messages;
1182
- $[5] = t3;
1183
- $[6] = t4;
1357
+ t5 = [chat.messages];
1358
+ $[6] = chat.messages;
1359
+ $[7] = t4;
1360
+ $[8] = t5;
1184
1361
  } else {
1185
- t3 = $[5];
1186
- t4 = $[6];
1362
+ t4 = $[7];
1363
+ t5 = $[8];
1187
1364
  }
1188
- useEffect(t3, t4);
1365
+ useEffect(t4, t5);
1189
1366
  return chat;
1190
1367
  }
1191
- //#endregion
1192
- //#region src/aichat/AIChat.tsx
1368
+ // src/aichat/AIChat.tsx
1193
1369
  var storage = {
1194
1370
  key: "likec4.ai.chat.position",
1195
1371
  read() {
@@ -1228,7 +1404,7 @@ function AIChatComponent() {
1228
1404
  key: "likec4.ai.chat.collapsed",
1229
1405
  defaultValue: true
1230
1406
  });
1231
- return /* @__PURE__ */ jsxs(Fragment$1, { children: [/* @__PURE__ */ jsxs(AnimatePresence, { children: [!isCollapsed && /* @__PURE__ */ jsx(FloatingWindow, {
1407
+ return /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsxs(AnimatePresence, { children: [!isCollapsed && /* @__PURE__ */ jsx(FloatingWindow, {
1232
1408
  w: 300,
1233
1409
  pos: "fixed",
1234
1410
  className: css({
@@ -1388,5 +1564,4 @@ function AIChatWindowContent(t0) {
1388
1564
  } else t11 = $[14];
1389
1565
  return t11;
1390
1566
  }
1391
- //#endregion
1392
1567
  export { AIChatComponent as default };