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,22 @@
1
+ import "./rolldown-runtime.mjs";
2
+ import { t as listenKeys } from "./libs/nanostores.mjs";
3
+ import { useCallback, useRef, useSyncExternalStore } from "react";
4
+ // ../../node_modules/.pnpm/@nanostores+react@2.0.1_nanostores@1.5.5_react@19.3.1/node_modules/@nanostores/react/index.js
5
+ var emit = (snapshotRef, onChange) => (value) => {
6
+ if (snapshotRef.current === value) return;
7
+ snapshotRef.current = value;
8
+ onChange();
9
+ };
10
+ function useStore(store, { keys, deps = [store, keys], ssr } = {}) {
11
+ let snapshotRef = useRef();
12
+ snapshotRef.current = store.get();
13
+ let subscribe = useCallback((onChange) => {
14
+ emit(snapshotRef, onChange)(store.value);
15
+ return keys?.length > 0 ? listenKeys(store, keys, emit(snapshotRef, onChange)) : store.listen(emit(snapshotRef, onChange));
16
+ }, deps);
17
+ let get = () => snapshotRef.current;
18
+ let server = get;
19
+ if (ssr && "init" in store) server = ssr === "initial" ? () => store.init : ssr;
20
+ return useSyncExternalStore(subscribe, get, server);
21
+ }
22
+ export { useStore as t };
@@ -1,30 +1,17 @@
1
- //#region \0rolldown/runtime.js
2
- var e = Object.create, t = Object.defineProperty, __name = (e, n) => t(e, "name", {
3
- value: n,
4
- configurable: !0
5
- }), n = Object.getOwnPropertyDescriptor, r = Object.getOwnPropertyNames, i = Object.getPrototypeOf, a = Object.prototype.hasOwnProperty, __esmMin = (e, t, n) => () => {
6
- if (n) throw n[0];
7
- try {
8
- return e && (t = e(e = 0)), t;
9
- } catch (e) {
10
- throw n = [e], e;
11
- }
12
- }, __commonJSMin = (e, t) => () => (t || (e((t = { exports: {} }).exports, t), e = null), t.exports), __exportAll = (e, n) => {
13
- let r = {};
14
- for (var i in e) t(r, i, {
15
- get: e[i],
16
- enumerable: !0
1
+ // \0rolldown/runtime.js
2
+ var __defProp = Object.defineProperty;
3
+ var __name = (target, value) => __defProp(target, "name", {
4
+ value,
5
+ configurable: true
6
+ });
7
+ var __commonJSMin = (cb, mod) => () => (mod || (cb((mod = { exports: {} }).exports, mod, mod.exports), cb = null), mod.exports);
8
+ var __exportAll = (all, no_symbols) => {
9
+ let target = {};
10
+ for (var name in all) __defProp(target, name, {
11
+ get: all[name],
12
+ enumerable: true
17
13
  });
18
- return n || t(r, Symbol.toStringTag, { value: "Module" }), r;
19
- }, __copyProps = (e, i, o, s) => {
20
- if (i && typeof i == "object" || typeof i == "function") for (var c = r(i), l = 0, u = c.length, d; l < u; l++) d = c[l], !a.call(e, d) && d !== o && t(e, d, {
21
- get: ((e) => i[e]).bind(null, d),
22
- enumerable: !(s = n(i, d)) || s.enumerable
23
- });
24
- return e;
25
- }, __toESM = (n, r, o) => (o = n == null ? {} : e(i(n)), __copyProps(r || !n || !n.__esModule || !a.call(n, "default") ? t(o, "default", {
26
- value: n,
27
- enumerable: !0
28
- }) : o, n)), __toCommonJS = (e) => a.call(e, "module.exports") ? e["module.exports"] : __copyProps(t({}, "__esModule", { value: !0 }), e);
29
- //#endregion
30
- export { __toCommonJS as a, __name as i, __esmMin as n, __toESM as o, __exportAll as r, __commonJSMin as t };
14
+ if (!no_symbols) __defProp(target, Symbol.toStringTag, { value: "Module" });
15
+ return target;
16
+ };
17
+ export { __exportAll as n, __name as r, __commonJSMin as t };
@@ -0,0 +1,106 @@
1
+ import { r as __name } from "./rolldown-runtime.mjs";
2
+ import { m as createHashHistory, n as createRouter, p as createBrowserHistory, t as RouterProvider } from "./libs/@tanstack.mjs";
3
+ import { u as e } from "./find.mjs";
4
+ import { NotFound } from "../components/NotFound.mjs";
5
+ import { LikeC4ProjectsContext } from "../context/LikeC4ProjectsContext.mjs";
6
+ import { routeTree } from "../routeTree.gen.mjs";
7
+ import { c } from "react/compiler-runtime";
8
+ import { jsx } from "react/jsx-runtime";
9
+ import { basepath, useHashHistory } from "likec4:app-config";
10
+ import { isSingleProject, projects } from "likec4:projects";
11
+ // ../../node_modules/.pnpm/remeda@2.52.0/node_modules/remeda/dist/purry.js
12
+ var t$1 = /* @__PURE__ */ __name((t, n) => n.length >= t.length ? t(...n) : e(t, n), "t");
13
+ // ../../node_modules/.pnpm/remeda@2.52.0/node_modules/remeda/dist/hasAtLeast.js
14
+ function t(...t) {
15
+ return t$1(n, t);
16
+ }
17
+ var n = (e, t) => e.length >= t;
18
+ // src/rewrite-single-project.ts
19
+ var REWRITTEN_SEGMENTS = [
20
+ "view",
21
+ "embed",
22
+ "export"
23
+ ];
24
+ function projectPrefix(firstProjectId) {
25
+ return `/project/${firstProjectId}`;
26
+ }
27
+ function shouldRewriteInputPath(pathname) {
28
+ for (const segment of REWRITTEN_SEGMENTS) if (pathname === `/${segment}` || pathname.startsWith(`/${segment}/`)) return true;
29
+ return false;
30
+ }
31
+ /**
32
+ * Maps public single-project URLs (`/view/...`, `/embed/...`, `/export/...`)
33
+ * onto the canonical multi-project tree under `/project/<id>/...`.
34
+ *
35
+ * Leaves `/`, `/projects`, `/project/...`, `/single-index`, `/webcomponent` alone.
36
+ * Does not rewrite `/` → `/project/<id>/` (avoids a root redirect loop).
37
+ * Does not add/strip trailing slashes; preserves search and hash.
38
+ */
39
+ function rewriteSingleProjectInput(url, options) {
40
+ if (!options.enabled) return;
41
+ const { pathname } = url;
42
+ if (!shouldRewriteInputPath(pathname)) return;
43
+ const next = new URL(url.href);
44
+ next.pathname = `${projectPrefix(options.firstProjectId)}${pathname}`;
45
+ return next;
46
+ }
47
+ /**
48
+ * Strips `/project/<id>` from internal locations so the public URL stays
49
+ * without the project prefix in single-project mode.
50
+ *
51
+ * Maps bare `prefix` / `prefix/` → `/`.
52
+ * Does not add/strip trailing slashes on other paths; preserves search and hash.
53
+ */
54
+ function rewriteSingleProjectOutput(url, options) {
55
+ if (!options.enabled) return;
56
+ const prefix = projectPrefix(options.firstProjectId);
57
+ const { pathname } = url;
58
+ if (pathname === prefix || pathname === `${prefix}/`) {
59
+ const next = new URL(url.href);
60
+ next.pathname = "/";
61
+ return next;
62
+ }
63
+ if (pathname.startsWith(`${prefix}/`)) {
64
+ const next = new URL(url.href);
65
+ next.pathname = pathname.slice(prefix.length);
66
+ return next;
67
+ }
68
+ }
69
+ // src/router.tsx
70
+ var projectIds = projects.map((p) => p.id);
71
+ var _projects = t(projectIds, 1) ? projectIds : ["default"];
72
+ var firstProjectId = _projects[0];
73
+ var rewriteOptions = {
74
+ enabled: isSingleProject,
75
+ firstProjectId
76
+ };
77
+ var router = createRouter({
78
+ routeTree,
79
+ context: {
80
+ projectId: firstProjectId,
81
+ projects: _projects
82
+ },
83
+ InnerWrap: LikeC4ProjectsContext,
84
+ basepath,
85
+ trailingSlash: "always",
86
+ defaultViewTransition: false,
87
+ history: useHashHistory ? createHashHistory() : createBrowserHistory(),
88
+ defaultStaleTime: Infinity,
89
+ defaultNotFoundComponent: () => {
90
+ return /* @__PURE__ */ jsx(NotFound, {});
91
+ },
92
+ ...isSingleProject ? { rewrite: {
93
+ input: ({ url }) => rewriteSingleProjectInput(url, rewriteOptions),
94
+ output: ({ url }) => rewriteSingleProjectOutput(url, rewriteOptions)
95
+ } } : {}
96
+ });
97
+ function Routes() {
98
+ const $ = c(1);
99
+ let t0;
100
+ if ($[0] === Symbol.for("react.memo_cache_sentinel")) {
101
+ t0 = /* @__PURE__ */ jsx(RouterProvider, { router });
102
+ $[0] = t0;
103
+ } else t0 = $[0];
104
+ return t0;
105
+ }
106
+ export { Routes as t };
@@ -0,0 +1,106 @@
1
+ import "./rolldown-runtime.mjs";
2
+ import { useEffect, useState } from "react";
3
+ import { c } from "react/compiler-runtime";
4
+ // src/relationship-browser/scope.ts
5
+ function isRelationshipBrowserScope(value) {
6
+ return value === "global" || value === "view";
7
+ }
8
+ function relationshipBrowserScopeStorageKey(projectId) {
9
+ return `likec4.relationshipsBrowser.scope:${projectId}`;
10
+ }
11
+ function resolveRelationshipBrowserScope(input) {
12
+ return input.urlScope ?? input.savedScope ?? input.configuredScope ?? "view";
13
+ }
14
+ /**
15
+ * Reads the relationship browser scope saved for one project.
16
+ *
17
+ * Storage is optional to keep server rendering and unavailable browser storage safe.
18
+ */
19
+ function readRelationshipBrowserScope(projectId, storage = browserLocalStorage()) {
20
+ if (!storage) return void 0;
21
+ try {
22
+ const value = storage.getItem(relationshipBrowserScopeStorageKey(projectId));
23
+ return isRelationshipBrowserScope(value) ? value : void 0;
24
+ } catch {
25
+ return;
26
+ }
27
+ }
28
+ /**
29
+ * Saves a user-selected relationship browser scope for one project.
30
+ */
31
+ function saveRelationshipBrowserScope(projectId, scope, storage = browserLocalStorage()) {
32
+ if (!storage || !isRelationshipBrowserScope(scope)) return false;
33
+ try {
34
+ storage.setItem(relationshipBrowserScopeStorageKey(projectId), scope);
35
+ return true;
36
+ } catch {
37
+ return false;
38
+ }
39
+ }
40
+ /**
41
+ * Returns the saved project scope, or its configured default when no preference exists.
42
+ *
43
+ * Only calls to `setScope` save a value. Initial values and configuration updates do not.
44
+ */
45
+ function useRelationshipBrowserScope(project) {
46
+ const $ = c(12);
47
+ const configuredScope = project.relationshipBrowserDefaultScope;
48
+ let t0;
49
+ if ($[0] !== project) {
50
+ t0 = () => resolveProjectRelationshipBrowserScope(project);
51
+ $[0] = project;
52
+ $[1] = t0;
53
+ } else t0 = $[1];
54
+ const [scope, setScope] = useState(t0);
55
+ let t1;
56
+ if ($[2] !== project) {
57
+ t1 = () => {
58
+ setScope(resolveProjectRelationshipBrowserScope(project));
59
+ };
60
+ $[2] = project;
61
+ $[3] = t1;
62
+ } else t1 = $[3];
63
+ let t2;
64
+ if ($[4] !== configuredScope || $[5] !== project.id) {
65
+ t2 = [project.id, configuredScope];
66
+ $[4] = configuredScope;
67
+ $[5] = project.id;
68
+ $[6] = t2;
69
+ } else t2 = $[6];
70
+ useEffect(t1, t2);
71
+ let t3;
72
+ if ($[7] !== project.id) {
73
+ t3 = (nextScope) => {
74
+ if (!isRelationshipBrowserScope(nextScope)) return;
75
+ setScope(nextScope);
76
+ saveRelationshipBrowserScope(project.id, nextScope);
77
+ };
78
+ $[7] = project.id;
79
+ $[8] = t3;
80
+ } else t3 = $[8];
81
+ const setUserScope = t3;
82
+ let t4;
83
+ if ($[9] !== scope || $[10] !== setUserScope) {
84
+ t4 = [scope, setUserScope];
85
+ $[9] = scope;
86
+ $[10] = setUserScope;
87
+ $[11] = t4;
88
+ } else t4 = $[11];
89
+ return t4;
90
+ }
91
+ function resolveProjectRelationshipBrowserScope(project) {
92
+ const savedScope = readRelationshipBrowserScope(project.id);
93
+ return resolveRelationshipBrowserScope({
94
+ ...savedScope ? { savedScope } : {},
95
+ configuredScope: project.relationshipBrowserDefaultScope
96
+ });
97
+ }
98
+ function browserLocalStorage() {
99
+ if (typeof window === "undefined") return void 0;
100
+ try {
101
+ return window.localStorage;
102
+ } catch {
103
+ return;
104
+ }
105
+ }
106
+ export { useRelationshipBrowserScope as t };
@@ -0,0 +1,29 @@
1
+ import "./rolldown-runtime.mjs";
2
+ import { z } from "zod";
3
+ // src/searchParams.ts
4
+ var searchParamsSchema = z.object({
5
+ theme: z.enum([
6
+ "light",
7
+ "dark",
8
+ "auto"
9
+ ]).optional().catch(void 0),
10
+ dynamic: z.enum(["diagram", "sequence"]).optional().catch(void 0),
11
+ padding: z.number().min(0).default(20).catch(20),
12
+ relationshipsScope: z.enum(["global", "view"]).optional().catch(void 0),
13
+ relationships: z.string().nonempty().optional().catch(void 0).transform((v) => v),
14
+ focusOnElement: z.string().nonempty().optional().catch(void 0).transform((v) => v)
15
+ });
16
+ /**
17
+ * Derives the Mantine `forceColorScheme` value from the parsed `?theme=` param.
18
+ *
19
+ * - `'light'` / `'dark'` → force that scheme (overrides localStorage, read-only)
20
+ * - `'auto'` or `undefined` → no force (Mantine uses localStorage / system preference)
21
+ */
22
+ function resolveForceColorScheme(theme) {
23
+ switch (theme) {
24
+ case "light":
25
+ case "dark": return theme;
26
+ default: return;
27
+ }
28
+ }
29
+ export { searchParamsSchema as n, resolveForceColorScheme as t };