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,438 @@
1
+ import "./rolldown-runtime.mjs";
2
+ import { t as useSyncedRef } from "./useSyncedRef.mjs";
3
+ import { c as useNavigate, d as useRouter, l as useSearch } from "./libs/@tanstack.mjs";
4
+ import { CompareModelProvider } from "../components/model-diff/CompareModelProvider.mjs";
5
+ import { ModelDiffPanel, useCompareView } from "../components/model-diff/ModelDiffPanel.mjs";
6
+ import { NotFound } from "../components/NotFound.mjs";
7
+ import { headerOps } from "../components/view-page/state.mjs";
8
+ import { n as useCurrentView, t as useCurrentProject } from "./hooks.mjs";
9
+ import { t as useRelationshipBrowserScope } from "./scope.mjs";
10
+ import { useCallback, useEffect, useRef } from "react";
11
+ import { c } from "react/compiler-runtime";
12
+ import { jsx, jsxs } from "react/jsx-runtime";
13
+ import { pageTitle } from "likec4:app-config";
14
+ import { LikeC4Diagram, selectDiagramContext, useDiagram, useDiagramSelector, useLikeC4Model, useOnDiagramEvent, useUpdateEffect } from "likec4/react";
15
+ import { useCallbackRef, useDocumentTitle } from "@mantine/hooks";
16
+ // ../../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/useUnmountEffect/index.js
17
+ /**
18
+ * Run effect only when component is unmounted.
19
+ *
20
+ * @param effect Effector to run on unmount
21
+ */
22
+ function useUnmountEffect(effect) {
23
+ const effectRef = useSyncedRef(effect);
24
+ useEffect(() => () => {
25
+ effectRef.current();
26
+ }, []);
27
+ }
28
+ // ../../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/useIsMounted/index.js
29
+ /**
30
+ * Returns a function that returns the current mount state. This hook is useful when you have to
31
+ * detect component mount state within async effects.
32
+ *
33
+ * @param initialValue Initial value.
34
+ *
35
+ * @return Function that returns `true` only if the component is mounted.
36
+ */
37
+ function useIsMounted(initialValue = false) {
38
+ const isMounted = useRef(initialValue);
39
+ const get = useCallback(() => isMounted.current, []);
40
+ useEffect(() => {
41
+ isMounted.current = true;
42
+ return () => {
43
+ isMounted.current = false;
44
+ };
45
+ }, []);
46
+ return get;
47
+ }
48
+ // src/pages/ViewReact.tsx
49
+ function ViewReact() {
50
+ const $ = c(34);
51
+ const navigate = useNavigate();
52
+ const project = useCurrentProject();
53
+ const [view, setLayoutType] = useCurrentView();
54
+ const [relationshipBrowserScope, setRelationshipBrowserScope] = useRelationshipBrowserScope(project);
55
+ const model = useLikeC4Model();
56
+ let t0;
57
+ if ($[0] === Symbol.for("react.memo_cache_sentinel")) {
58
+ t0 = { from: "__root__" };
59
+ $[0] = t0;
60
+ } else t0 = $[0];
61
+ const { dynamic } = useSearch(t0);
62
+ const compareView = useCompareView(view?.id);
63
+ let t1;
64
+ if ($[1] !== navigate) {
65
+ t1 = (viewId) => {
66
+ navigate({
67
+ to: "./",
68
+ viewTransition: false,
69
+ params: (current) => ({
70
+ ...current,
71
+ viewId
72
+ }),
73
+ search: true
74
+ });
75
+ };
76
+ $[1] = navigate;
77
+ $[2] = t1;
78
+ } else t1 = $[2];
79
+ const onNavigateTo = useCallbackRef(t1);
80
+ const title = view ? view.title ?? view.id : "View not found";
81
+ const pageTitle$1 = model.project.title ?? pageTitle;
82
+ useDocumentTitle(`${title} - ${pageTitle$1}`);
83
+ if (!view) {
84
+ let t2;
85
+ if ($[3] === Symbol.for("react.memo_cache_sentinel")) {
86
+ t2 = /* @__PURE__ */ jsx(NotFound, {});
87
+ $[3] = t2;
88
+ } else t2 = $[3];
89
+ return t2;
90
+ }
91
+ let t2;
92
+ if ($[4] !== view.notation?.nodes) {
93
+ t2 = view.notation?.nodes ?? [];
94
+ $[4] = view.notation?.nodes;
95
+ $[5] = t2;
96
+ } else t2 = $[5];
97
+ const hasNotations = t2.length > 0;
98
+ const isComparing = compareView !== null;
99
+ let t3;
100
+ if ($[6] === Symbol.for("react.memo_cache_sentinel")) {
101
+ t3 = {
102
+ position: "relative",
103
+ width: "100%",
104
+ height: "100%"
105
+ };
106
+ $[6] = t3;
107
+ } else t3 = $[6];
108
+ const t4 = compareView ?? view;
109
+ let t5;
110
+ if ($[7] === Symbol.for("react.memo_cache_sentinel")) {
111
+ t5 = {
112
+ top: "70px",
113
+ bottom: "32px",
114
+ left: "32px",
115
+ right: "32px"
116
+ };
117
+ $[7] = t5;
118
+ } else t5 = $[7];
119
+ const t6 = !isComparing;
120
+ const t7 = !isComparing;
121
+ let t8;
122
+ if ($[8] !== navigate) {
123
+ t8 = () => {
124
+ navigate({ to: "/" });
125
+ };
126
+ $[8] = navigate;
127
+ $[9] = t8;
128
+ } else t8 = $[9];
129
+ let t9;
130
+ if ($[10] === Symbol.for("react.memo_cache_sentinel")) {
131
+ t9 = /* @__PURE__ */ jsx(ListenForDiagramStateChanges, {});
132
+ $[10] = t9;
133
+ } else t9 = $[10];
134
+ let t10;
135
+ if ($[11] !== relationshipBrowserScope) {
136
+ t10 = /* @__PURE__ */ jsx(OpenRelationshipBrowserFromUrl, { relationshipBrowserScope });
137
+ $[11] = relationshipBrowserScope;
138
+ $[12] = t10;
139
+ } else t10 = $[12];
140
+ let t11;
141
+ if ($[13] === Symbol.for("react.memo_cache_sentinel")) {
142
+ t11 = /* @__PURE__ */ jsx(FocusElementFromUrl, {});
143
+ $[13] = t11;
144
+ } else t11 = $[13];
145
+ let t12;
146
+ if ($[14] !== dynamic || $[15] !== hasNotations || $[16] !== onNavigateTo || $[17] !== relationshipBrowserScope || $[18] !== setLayoutType || $[19] !== setRelationshipBrowserScope || $[20] !== t10 || $[21] !== t4 || $[22] !== t6 || $[23] !== t7 || $[24] !== t8) {
147
+ t12 = /* @__PURE__ */ jsxs(LikeC4Diagram, {
148
+ view: t4,
149
+ zoomable: true,
150
+ pannable: true,
151
+ controls: true,
152
+ fitViewPadding: t5,
153
+ showNavigationButtons: true,
154
+ enableSearch: true,
155
+ enableFocusMode: true,
156
+ enableDynamicViewWalkthrough: t6,
157
+ dynamicViewVariant: dynamic,
158
+ enableElementDetails: true,
159
+ enableRelationshipDetails: true,
160
+ enableRelationshipBrowser: true,
161
+ relationshipBrowserScope,
162
+ onRelationshipBrowserScopeChange: setRelationshipBrowserScope,
163
+ enableElementTags: true,
164
+ enableCompareWithLatest: t7,
165
+ enableNotations: hasNotations,
166
+ nodesSelectable: true,
167
+ onNavigateTo,
168
+ onLayoutTypeChange: setLayoutType,
169
+ onLogoClick: t8,
170
+ children: [
171
+ t9,
172
+ t10,
173
+ t11
174
+ ]
175
+ });
176
+ $[14] = dynamic;
177
+ $[15] = hasNotations;
178
+ $[16] = onNavigateTo;
179
+ $[17] = relationshipBrowserScope;
180
+ $[18] = setLayoutType;
181
+ $[19] = setRelationshipBrowserScope;
182
+ $[20] = t10;
183
+ $[21] = t4;
184
+ $[22] = t6;
185
+ $[23] = t7;
186
+ $[24] = t8;
187
+ $[25] = t12;
188
+ } else t12 = $[25];
189
+ let t13;
190
+ if ($[26] !== t12 || $[27] !== view.id) {
191
+ t13 = /* @__PURE__ */ jsx(CompareModelProvider, {
192
+ viewId: view.id,
193
+ children: t12
194
+ });
195
+ $[26] = t12;
196
+ $[27] = view.id;
197
+ $[28] = t13;
198
+ } else t13 = $[28];
199
+ let t14;
200
+ if ($[29] !== view.id) {
201
+ t14 = /* @__PURE__ */ jsx(ModelDiffPanel, { viewId: view.id });
202
+ $[29] = view.id;
203
+ $[30] = t14;
204
+ } else t14 = $[30];
205
+ let t15;
206
+ if ($[31] !== t13 || $[32] !== t14) {
207
+ t15 = /* @__PURE__ */ jsxs("div", {
208
+ style: t3,
209
+ children: [t13, t14]
210
+ });
211
+ $[31] = t13;
212
+ $[32] = t14;
213
+ $[33] = t15;
214
+ } else t15 = $[33];
215
+ return t15;
216
+ }
217
+ /**
218
+ * Opens Relationship Browser when `?relationships={elementFqn}` URL parameter is present.
219
+ * Handles both initial load and parameter changes during navigation.
220
+ * Clears the URL parameters after opening to prevent reopening on navigation.
221
+ */
222
+ function OpenRelationshipBrowserFromUrl(t0) {
223
+ const $ = c(20);
224
+ const { relationshipBrowserScope } = t0;
225
+ const router = useRouter();
226
+ const diagram = useDiagram();
227
+ let t1;
228
+ if ($[0] === Symbol.for("react.memo_cache_sentinel")) {
229
+ t1 = { from: "__root__" };
230
+ $[0] = t1;
231
+ } else t1 = $[0];
232
+ const { relationships, relationshipsScope } = useSearch(t1);
233
+ const processedRef = useRef(null);
234
+ const isInitializedRef = useRef(false);
235
+ let t2;
236
+ if ($[1] === Symbol.for("react.memo_cache_sentinel")) {
237
+ t2 = Promise.resolve();
238
+ $[1] = t2;
239
+ } else t2 = $[1];
240
+ const isProcessingRef = useRef(t2);
241
+ const isMounted = useIsMounted();
242
+ let t3;
243
+ if ($[2] !== diagram || $[3] !== isMounted || $[4] !== relationshipBrowserScope || $[5] !== relationshipsScope || $[6] !== router) {
244
+ t3 = (fqn) => {
245
+ const scope = relationshipsScope ?? relationshipBrowserScope;
246
+ const requestKey = `${fqn}:${scope}`;
247
+ isProcessingRef.current = isProcessingRef.current.then(async () => {
248
+ if (!isMounted() || processedRef.current === requestKey) return;
249
+ try {
250
+ processedRef.current = requestKey;
251
+ diagram.openRelationshipsBrowser(fqn, scope);
252
+ await router.buildAndCommitLocation({
253
+ search: _temp,
254
+ replace: true,
255
+ viewTransition: false
256
+ });
257
+ } catch (t4) {
258
+ console.error("Failed to open relationship browser:", t4);
259
+ }
260
+ });
261
+ };
262
+ $[2] = diagram;
263
+ $[3] = isMounted;
264
+ $[4] = relationshipBrowserScope;
265
+ $[5] = relationshipsScope;
266
+ $[6] = router;
267
+ $[7] = t3;
268
+ } else t3 = $[7];
269
+ const openAndClear = t3;
270
+ let t4;
271
+ if ($[8] !== openAndClear || $[9] !== relationshipBrowserScope || $[10] !== relationships || $[11] !== relationshipsScope) {
272
+ t4 = () => {
273
+ if (!relationships) {
274
+ processedRef.current = null;
275
+ return;
276
+ }
277
+ const requestKey_0 = `${relationships}:${relationshipsScope ?? relationshipBrowserScope}`;
278
+ if (processedRef.current !== requestKey_0) openAndClear(relationships);
279
+ };
280
+ $[8] = openAndClear;
281
+ $[9] = relationshipBrowserScope;
282
+ $[10] = relationships;
283
+ $[11] = relationshipsScope;
284
+ $[12] = t4;
285
+ } else t4 = $[12];
286
+ const process = t4;
287
+ let t5;
288
+ if ($[13] !== process) {
289
+ t5 = () => {
290
+ isInitializedRef.current = true;
291
+ process();
292
+ };
293
+ $[13] = process;
294
+ $[14] = t5;
295
+ } else t5 = $[14];
296
+ useOnDiagramEvent("initialized", t5);
297
+ let t6;
298
+ if ($[15] !== process) {
299
+ t6 = () => {
300
+ process();
301
+ };
302
+ $[15] = process;
303
+ $[16] = t6;
304
+ } else t6 = $[16];
305
+ let t7;
306
+ if ($[17] !== relationships || $[18] !== relationshipsScope) {
307
+ t7 = [relationships, relationshipsScope];
308
+ $[17] = relationships;
309
+ $[18] = relationshipsScope;
310
+ $[19] = t7;
311
+ } else t7 = $[19];
312
+ useUpdateEffect(t6, t7);
313
+ return null;
314
+ }
315
+ function _temp(s) {
316
+ const { relationships: _, relationshipsScope: __, ...rest } = s;
317
+ return rest;
318
+ }
319
+ /**
320
+ * Focuses on an element when `?focusOnElement={elementFqn}` URL parameter is present.
321
+ * Used when navigating from the overview search with an element target.
322
+ * Clears the parameter after focusing to prevent refocusing on navigation.
323
+ */
324
+ function FocusElementFromUrl() {
325
+ const $ = c(10);
326
+ const router = useRouter();
327
+ const diagram = useDiagram();
328
+ let t0;
329
+ if ($[0] === Symbol.for("react.memo_cache_sentinel")) {
330
+ t0 = { from: "__root__" };
331
+ $[0] = t0;
332
+ } else t0 = $[0];
333
+ const { focusOnElement } = useSearch(t0);
334
+ const processedRef = useRef(null);
335
+ let t1;
336
+ if ($[1] !== diagram || $[2] !== router) {
337
+ t1 = (fqn) => {
338
+ try {
339
+ if (processedRef.current === fqn) return;
340
+ processedRef.current = fqn;
341
+ diagram.focusOnElement(fqn);
342
+ router.buildAndCommitLocation({
343
+ search: _temp2,
344
+ replace: true,
345
+ viewTransition: false
346
+ });
347
+ } catch (t2) {
348
+ console.error("focusOnElement failed:", t2);
349
+ }
350
+ };
351
+ $[1] = diagram;
352
+ $[2] = router;
353
+ $[3] = t1;
354
+ } else t1 = $[3];
355
+ const focusAndClear = useCallbackRef(t1);
356
+ let t2;
357
+ if ($[4] !== focusAndClear || $[5] !== focusOnElement) {
358
+ t2 = () => {
359
+ if (focusOnElement && processedRef.current !== focusOnElement) focusAndClear(focusOnElement);
360
+ };
361
+ $[4] = focusAndClear;
362
+ $[5] = focusOnElement;
363
+ $[6] = t2;
364
+ } else t2 = $[6];
365
+ useOnDiagramEvent("initialized", t2);
366
+ let t3;
367
+ let t4;
368
+ if ($[7] !== focusOnElement) {
369
+ t3 = () => {
370
+ if (!focusOnElement) processedRef.current = null;
371
+ };
372
+ t4 = [focusOnElement];
373
+ $[7] = focusOnElement;
374
+ $[8] = t3;
375
+ $[9] = t4;
376
+ } else {
377
+ t3 = $[8];
378
+ t4 = $[9];
379
+ }
380
+ useUpdateEffect(t3, t4);
381
+ return null;
382
+ }
383
+ function _temp2(s) {
384
+ const { focusOnElement: _, ...rest } = s;
385
+ return rest;
386
+ }
387
+ var selectDiagramState = selectDiagramContext((c) => ({
388
+ dynamicViewVariant: c.dynamicViewVariant,
389
+ isWalkthroughActive: !!c.activeWalkthrough
390
+ }));
391
+ function ListenForDiagramStateChanges() {
392
+ const $ = c(8);
393
+ const router = useRouter();
394
+ const { dynamicViewVariant, isWalkthroughActive } = useDiagramSelector(selectDiagramState);
395
+ let t0;
396
+ if ($[0] !== dynamicViewVariant || $[1] !== router) {
397
+ t0 = () => {
398
+ if ((router.latestLocation.search.dynamic ?? "diagram") !== dynamicViewVariant) router.buildAndCommitLocation({
399
+ search: (current) => ({
400
+ ...current,
401
+ dynamic: dynamicViewVariant
402
+ }),
403
+ viewTransition: false
404
+ });
405
+ };
406
+ $[0] = dynamicViewVariant;
407
+ $[1] = router;
408
+ $[2] = t0;
409
+ } else t0 = $[2];
410
+ let t1;
411
+ if ($[3] !== dynamicViewVariant) {
412
+ t1 = [dynamicViewVariant];
413
+ $[3] = dynamicViewVariant;
414
+ $[4] = t1;
415
+ } else t1 = $[4];
416
+ useUpdateEffect(t0, t1);
417
+ let t2;
418
+ let t3;
419
+ if ($[5] !== isWalkthroughActive) {
420
+ t2 = () => {
421
+ headerOps.toggle(!isWalkthroughActive);
422
+ };
423
+ t3 = [isWalkthroughActive];
424
+ $[5] = isWalkthroughActive;
425
+ $[6] = t2;
426
+ $[7] = t3;
427
+ } else {
428
+ t2 = $[6];
429
+ t3 = $[7];
430
+ }
431
+ useEffect(t2, t3);
432
+ useUnmountEffect(_temp3);
433
+ return null;
434
+ }
435
+ function _temp3() {
436
+ headerOps.show();
437
+ }
438
+ export { ViewReact as i, ListenForDiagramStateChanges as n, OpenRelationshipBrowserFromUrl as r, FocusElementFromUrl as t };
@@ -0,0 +1,38 @@
1
+ import { r as __name } from "./rolldown-runtime.mjs";
2
+ // ../../node_modules/.pnpm/remeda@2.52.0/node_modules/remeda/dist/dataLastImplementation-D-BXl-Tn.js
3
+ var e$3 = /* @__PURE__ */ __name((e, t) => t.length === 1 ? (n) => e(n, t[0]) : (n) => e(n, ...t), "e");
4
+ // ../../node_modules/.pnpm/remeda@2.52.0/node_modules/remeda/dist/lazyControl-BA0LgJso.js
5
+ var e$2 = Symbol.for(`remeda/lazy/skip`);
6
+ var t$3 = Symbol.for(`remeda/lazy/stop`);
7
+ var n$1 = Symbol.for(`remeda/lazy/last`);
8
+ var r = Symbol.for(`remeda/lazy/many`);
9
+ var i = [];
10
+ var a$1 = /* @__PURE__ */ __name(() => ({
11
+ value: void 0,
12
+ values: i
13
+ }), "a");
14
+ function s$1(e, t) {
15
+ return t.value = e, n$1;
16
+ }
17
+ __name(s$1, "s");
18
+ // ../../node_modules/.pnpm/remeda@2.52.0/node_modules/remeda/dist/lazyDataLastImplementation-DFviQKyZ.js
19
+ function t$2(t, n, r) {
20
+ let i = e$3(t, n);
21
+ return i.lazy = r, i.lazyArgs = n, i;
22
+ }
23
+ __name(t$2, "t");
24
+ // ../../node_modules/.pnpm/remeda@2.52.0/node_modules/remeda/dist/purryWithLazy-CKUoTFu0.js
25
+ var t$1 = /* @__PURE__ */ __name((t, n, r) => n.length >= t.length ? t(...n) : t$2(t, n, r), "t");
26
+ // ../../node_modules/.pnpm/remeda@2.52.0/node_modules/remeda/dist/requireData-CnnPAgxf.js
27
+ var e$1 = /* @__PURE__ */ __name((e) => (e.requiresData = !0, e), "e");
28
+ var t = (t, r, { dataParameterIndex: i = 2 } = {}) => n(t, i) ? e$1(r) : r;
29
+ var n = ({ length: e }, t = 2) => e === 0 || e > t;
30
+ // ../../node_modules/.pnpm/remeda@2.52.0/node_modules/remeda/dist/toSingle-DiQSixar.js
31
+ var e = (e) => Object.assign(e, { single: !0 });
32
+ // ../../node_modules/.pnpm/remeda@2.52.0/node_modules/remeda/dist/find.js
33
+ function a(...e) {
34
+ return t$1(o, e, s);
35
+ }
36
+ var o = (e, t) => e.find(t);
37
+ var s = e((n) => t(n, (r, i, a, o) => n(r, i, a) ? s$1(r, o) : e$2));
38
+ export { a$1 as a, r as c, t$1 as i, t$3 as l, e$1 as n, e$2 as o, n as r, n$1 as s, a as t, e$3 as u };