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,9 @@
1
+ import "../chunks/rolldown-runtime.mjs";
2
+ // src/pages/export-page-params.ts
3
+ /**
4
+ * Normalizes boolean export search params that can arrive from TanStack Router or URL strings.
5
+ */
6
+ function isExportSearchFlagEnabled(value) {
7
+ return value === true || value === "true";
8
+ }
9
+ export { isExportSearchFlagEnabled };
@@ -0,0 +1,23 @@
1
+ import { f as css } from "../chunks/styled-system.mjs";
2
+ // src/pages/styles.css.ts
3
+ var svgContainer = css({
4
+ minWidth: "[300px]",
5
+ "& svg": {
6
+ width: "100%",
7
+ height: "auto"
8
+ }
9
+ });
10
+ var cssScrollArea = css({
11
+ height: "100%",
12
+ "& .mantine-ScrollArea-viewport": { minHeight: "100%" },
13
+ "& .mantine-ScrollArea-viewport > div": {
14
+ minHeight: "100%",
15
+ height: "100%"
16
+ }
17
+ });
18
+ var cssCodeBlock = css({ minHeight: "100%" });
19
+ var viewWithTopPadding = css({
20
+ height: "100%",
21
+ paddingTop: "[var(--header-height)]"
22
+ });
23
+ export { cssCodeBlock, cssScrollArea, svgContainer, viewWithTopPadding };
@@ -0,0 +1,105 @@
1
+ import "./chunks/rolldown-runtime.mjs";
2
+ import { Route } from "./routes/__root.mjs";
3
+ import { Route as Route$1 } from "./routes/index.mjs";
4
+ import { Route as Route$2 } from "./routes/projects.mjs";
5
+ import { t as Route$3 } from "./chunks/single-index.mjs";
6
+ import { Route as Route$4 } from "./routes/project._projectId/route.mjs";
7
+ import { Route as Route$5 } from "./routes/webcomponent._.mjs";
8
+ import { Route as Route$6 } from "./routes/project._projectId/index.mjs";
9
+ import { Route as Route$7 } from "./routes/project._projectId/embed._viewId.mjs";
10
+ import { Route as Route$8 } from "./routes/project._projectId/export._viewId.mjs";
11
+ import { Route as Route$9 } from "./routes/project._projectId/view._viewId.mjs";
12
+ import { Route as Route$10 } from "./routes/project._projectId/view._viewId.index.mjs";
13
+ import { Route as Route$11 } from "./routes/project._projectId/view._viewId.d2.mjs";
14
+ import { Route as Route$12 } from "./routes/project._projectId/view._viewId.dot.mjs";
15
+ import { Route as Route$13 } from "./routes/project._projectId/view._viewId.mmd.mjs";
16
+ import { Route as Route$14 } from "./routes/project._projectId/view._viewId.puml.mjs";
17
+ // src/routeTree.gen.ts
18
+ var IndexRoute = Route$1.update({
19
+ id: "/",
20
+ path: "/",
21
+ getParentRoute: () => Route
22
+ });
23
+ var ProjectsRoute = Route$2.update({
24
+ id: "/projects",
25
+ path: "/projects",
26
+ getParentRoute: () => Route
27
+ });
28
+ var SingleIndexRoute = Route$3.update({
29
+ id: "/single-index",
30
+ path: "/single-index",
31
+ getParentRoute: () => Route
32
+ });
33
+ var ProjectProjectIdRouteRoute = Route$4.update({
34
+ id: "/project/$projectId",
35
+ path: "/project/$projectId",
36
+ getParentRoute: () => Route
37
+ });
38
+ var WebcomponentSplatRoute = Route$5.update({
39
+ id: "/webcomponent/$",
40
+ path: "/webcomponent/$",
41
+ getParentRoute: () => Route
42
+ });
43
+ var ProjectProjectIdIndexRoute = Route$6.update({
44
+ id: "/",
45
+ path: "/",
46
+ getParentRoute: () => ProjectProjectIdRouteRoute
47
+ });
48
+ var ProjectProjectIdEmbedViewIdRoute = Route$7.update({
49
+ id: "/embed/$viewId",
50
+ path: "/embed/$viewId",
51
+ getParentRoute: () => ProjectProjectIdRouteRoute
52
+ });
53
+ var ProjectProjectIdExportViewIdRoute = Route$8.update({
54
+ id: "/export/$viewId",
55
+ path: "/export/$viewId",
56
+ getParentRoute: () => ProjectProjectIdRouteRoute
57
+ });
58
+ var ProjectProjectIdViewViewIdRoute = Route$9.update({
59
+ id: "/view/$viewId",
60
+ path: "/view/$viewId",
61
+ getParentRoute: () => ProjectProjectIdRouteRoute
62
+ });
63
+ var ProjectProjectIdViewViewIdIndexRoute = Route$10.update({
64
+ id: "/",
65
+ path: "/",
66
+ getParentRoute: () => ProjectProjectIdViewViewIdRoute
67
+ });
68
+ var ProjectProjectIdViewViewIdRouteChildren = {
69
+ ProjectProjectIdViewViewIdD2Route: Route$11.update({
70
+ id: "/d2",
71
+ path: "/d2",
72
+ getParentRoute: () => ProjectProjectIdViewViewIdRoute
73
+ }),
74
+ ProjectProjectIdViewViewIdDotRoute: Route$12.update({
75
+ id: "/dot",
76
+ path: "/dot",
77
+ getParentRoute: () => ProjectProjectIdViewViewIdRoute
78
+ }),
79
+ ProjectProjectIdViewViewIdMmdRoute: Route$13.update({
80
+ id: "/mmd",
81
+ path: "/mmd",
82
+ getParentRoute: () => ProjectProjectIdViewViewIdRoute
83
+ }),
84
+ ProjectProjectIdViewViewIdPumlRoute: Route$14.update({
85
+ id: "/puml",
86
+ path: "/puml",
87
+ getParentRoute: () => ProjectProjectIdViewViewIdRoute
88
+ }),
89
+ ProjectProjectIdViewViewIdIndexRoute
90
+ };
91
+ var ProjectProjectIdRouteRouteChildren = {
92
+ ProjectProjectIdIndexRoute,
93
+ ProjectProjectIdEmbedViewIdRoute,
94
+ ProjectProjectIdExportViewIdRoute,
95
+ ProjectProjectIdViewViewIdRoute: ProjectProjectIdViewViewIdRoute._addFileChildren(ProjectProjectIdViewViewIdRouteChildren)
96
+ };
97
+ var rootRouteChildren = {
98
+ IndexRoute,
99
+ ProjectsRoute,
100
+ SingleIndexRoute,
101
+ ProjectProjectIdRouteRoute: ProjectProjectIdRouteRoute._addFileChildren(ProjectProjectIdRouteRouteChildren),
102
+ WebcomponentSplatRoute
103
+ };
104
+ var routeTree = Route._addFileChildren(rootRouteChildren)._addFileTypes();
105
+ export { routeTree };
@@ -0,0 +1 @@
1
+ export { t as Routes } from "./chunks/router.mjs";
@@ -0,0 +1,65 @@
1
+ import "../chunks/rolldown-runtime.mjs";
2
+ import { f as stripSearchParams, i as Outlet, o as createRootRouteWithContext } from "../chunks/libs/@tanstack.mjs";
3
+ import { t as ErrorBoundary } from "../chunks/ErrorComponent.mjs";
4
+ import { LikeC4CustomizationContext } from "../context/LikeC4CustomizationContext.mjs";
5
+ import { n as searchParamsSchema, t as resolveForceColorScheme } from "../chunks/searchParams.mjs";
6
+ import { c } from "react/compiler-runtime";
7
+ import { jsx } from "react/jsx-runtime";
8
+ import { defaultTheme } from "likec4:app-config";
9
+ import { FramerMotionConfig, LikeC4MantineProvider } from "likec4/react";
10
+ // src/routes/__root.tsx
11
+ var Route = createRootRouteWithContext()({
12
+ validateSearch: searchParamsSchema,
13
+ search: { middlewares: [stripSearchParams({
14
+ padding: 20,
15
+ theme: void 0,
16
+ dynamic: void 0,
17
+ relationships: void 0,
18
+ focusOnElement: void 0
19
+ })] },
20
+ component: RootComponent
21
+ });
22
+ function RootComponent() {
23
+ const $ = c(9);
24
+ let t0;
25
+ if ($[0] === Symbol.for("react.memo_cache_sentinel")) {
26
+ t0 = { select: _temp };
27
+ $[0] = t0;
28
+ } else t0 = $[0];
29
+ const theme = Route.useSearch(t0);
30
+ let t1;
31
+ if ($[1] !== theme) {
32
+ t1 = resolveForceColorScheme(theme);
33
+ $[1] = theme;
34
+ $[2] = t1;
35
+ } else t1 = $[2];
36
+ const forceColorScheme = t1;
37
+ const defaultColorScheme = theme === "auto" ? "auto" : defaultTheme;
38
+ let t2;
39
+ if ($[3] !== forceColorScheme) {
40
+ t2 = forceColorScheme && { forceColorScheme };
41
+ $[3] = forceColorScheme;
42
+ $[4] = t2;
43
+ } else t2 = $[4];
44
+ let t3;
45
+ if ($[5] === Symbol.for("react.memo_cache_sentinel")) {
46
+ t3 = /* @__PURE__ */ jsx(FramerMotionConfig, { children: /* @__PURE__ */ jsx(ErrorBoundary, { children: /* @__PURE__ */ jsx(Outlet, {}) }) });
47
+ $[5] = t3;
48
+ } else t3 = $[5];
49
+ let t4;
50
+ if ($[6] !== defaultColorScheme || $[7] !== t2) {
51
+ t4 = /* @__PURE__ */ jsx(LikeC4CustomizationContext, { children: /* @__PURE__ */ jsx(LikeC4MantineProvider, {
52
+ defaultColorScheme,
53
+ ...t2,
54
+ children: t3
55
+ }) });
56
+ $[6] = defaultColorScheme;
57
+ $[7] = t2;
58
+ $[8] = t4;
59
+ } else t4 = $[8];
60
+ return t4;
61
+ }
62
+ function _temp(search) {
63
+ return search.theme;
64
+ }
65
+ export { Route };
@@ -0,0 +1,29 @@
1
+ import { f as css } from "../chunks/styled-system.mjs";
2
+ // src/routes/index.css.ts
3
+ var dimmed = css({ color: "text.dimmed" });
4
+ var header = css({});
5
+ var previewBg = css({
6
+ position: "relative",
7
+ overflow: "hidden",
8
+ padding: "0",
9
+ margin: "0",
10
+ backgroundOrigin: "padding-box",
11
+ backgroundImage: `radial-gradient({colors.border.default} 15%, {colors.body} 15%)`,
12
+ backgroundPosition: "0 0",
13
+ backgroundSize: "12px 12px",
14
+ _after: {
15
+ content: "\" \"",
16
+ position: "absolute",
17
+ top: "0",
18
+ left: "0",
19
+ right: "0",
20
+ bottom: "0",
21
+ zIndex: "[1]"
22
+ }
23
+ });
24
+ var cardLink = css({
25
+ position: "absolute",
26
+ inset: "0",
27
+ zIndex: "[5]"
28
+ });
29
+ export { cardLink, dimmed, header, previewBg };
@@ -0,0 +1,32 @@
1
+ import "../chunks/rolldown-runtime.mjs";
2
+ import { a as createFileRoute, h as redirect } from "../chunks/libs/@tanstack.mjs";
3
+ import { projects } from "likec4:projects";
4
+ // src/routes/index.tsx
5
+ var Route = createFileRoute("/")({ beforeLoad: ({ context }) => {
6
+ if (projects.length > 1) throw redirect({
7
+ to: "/projects/",
8
+ mask: {
9
+ to: "/",
10
+ unmaskOnReload: true
11
+ }
12
+ });
13
+ if (projects[0].landingPage && "redirect" in projects[0].landingPage) throw redirect({
14
+ to: "/project/$projectId/view/$viewId/",
15
+ params: {
16
+ projectId: context.projectId,
17
+ viewId: "index"
18
+ },
19
+ mask: {
20
+ to: "/",
21
+ unmaskOnReload: true
22
+ }
23
+ });
24
+ throw redirect({
25
+ to: "/single-index/",
26
+ mask: {
27
+ to: "/",
28
+ unmaskOnReload: true
29
+ }
30
+ });
31
+ } });
32
+ export { Route };
@@ -0,0 +1,100 @@
1
+ import "../../chunks/rolldown-runtime.mjs";
2
+ import { d as cx } from "../../chunks/styled-system.mjs";
3
+ import { c } from "react/compiler-runtime";
4
+ import { jsx } from "react/jsx-runtime";
5
+ import { Box, Group, UnstyledButton, createScopedKeydownHandler } from "@mantine/core";
6
+ // src/routes/project.$projectId/-components.tsx
7
+ function ProjectButton(t0) {
8
+ const $ = c(23);
9
+ let className;
10
+ let navigateTo;
11
+ let project;
12
+ let props;
13
+ if ($[0] !== t0) {
14
+ ({project, navigateTo, className, ...props} = t0);
15
+ $[0] = t0;
16
+ $[1] = className;
17
+ $[2] = navigateTo;
18
+ $[3] = project;
19
+ $[4] = props;
20
+ } else {
21
+ className = $[1];
22
+ navigateTo = $[2];
23
+ project = $[3];
24
+ props = $[4];
25
+ }
26
+ let t1;
27
+ if ($[5] !== className) {
28
+ t1 = cx(className);
29
+ $[5] = className;
30
+ $[6] = t1;
31
+ } else t1 = $[6];
32
+ let t2;
33
+ if ($[7] !== navigateTo || $[8] !== project) {
34
+ t2 = (e) => {
35
+ e.stopPropagation();
36
+ navigateTo(project);
37
+ };
38
+ $[7] = navigateTo;
39
+ $[8] = project;
40
+ $[9] = t2;
41
+ } else t2 = $[9];
42
+ let t3;
43
+ if ($[10] !== navigateTo || $[11] !== project) {
44
+ t3 = createScopedKeydownHandler({
45
+ siblingSelector: "[data-likec4-project]",
46
+ parentSelector: "[data-likec4-projects]",
47
+ activateOnFocus: false,
48
+ loop: true,
49
+ orientation: "vertical",
50
+ onKeyDown: (e_0) => {
51
+ if (e_0.nativeEvent.code === "Space") {
52
+ e_0.stopPropagation();
53
+ navigateTo(project);
54
+ }
55
+ }
56
+ });
57
+ $[10] = navigateTo;
58
+ $[11] = project;
59
+ $[12] = t3;
60
+ } else t3 = $[12];
61
+ let t4;
62
+ if ($[13] === Symbol.for("react.memo_cache_sentinel")) {
63
+ t4 = { flexGrow: 1 };
64
+ $[13] = t4;
65
+ } else t4 = $[13];
66
+ let t5;
67
+ if ($[14] !== project) {
68
+ t5 = /* @__PURE__ */ jsx(Box, {
69
+ style: t4,
70
+ children: /* @__PURE__ */ jsx(Group, {
71
+ gap: "xs",
72
+ wrap: "nowrap",
73
+ align: "center",
74
+ children: project
75
+ })
76
+ });
77
+ $[14] = project;
78
+ $[15] = t5;
79
+ } else t5 = $[15];
80
+ let t6;
81
+ if ($[16] !== project || $[17] !== props || $[18] !== t1 || $[19] !== t2 || $[20] !== t3 || $[21] !== t5) {
82
+ t6 = /* @__PURE__ */ jsx(UnstyledButton, {
83
+ ...props,
84
+ className: t1,
85
+ "data-likec4-project": project,
86
+ onClick: t2,
87
+ onKeyDown: t3,
88
+ children: t5
89
+ });
90
+ $[16] = project;
91
+ $[17] = props;
92
+ $[18] = t1;
93
+ $[19] = t2;
94
+ $[20] = t3;
95
+ $[21] = t5;
96
+ $[22] = t6;
97
+ } else t6 = $[22];
98
+ return t6;
99
+ }
100
+ export { ProjectButton };
@@ -0,0 +1,5 @@
1
+ import { a as createFileRoute } from "../../chunks/libs/@tanstack.mjs";
2
+ import { EmbedPage } from "../../pages/EmbedPage.mjs";
3
+ // src/routes/project.$projectId/embed.$viewId.tsx
4
+ var Route = createFileRoute("/project/$projectId/embed/$viewId")({ component: EmbedPage });
5
+ export { Route };
@@ -0,0 +1,24 @@
1
+ import { a as createFileRoute, f as stripSearchParams } from "../../chunks/libs/@tanstack.mjs";
2
+ import { n as ErrorComponent } from "../../chunks/ErrorComponent.mjs";
3
+ import { ExportPage } from "../../pages/ExportPage.mjs";
4
+ import { z } from "zod";
5
+ // src/routes/project.$projectId/export.$viewId.tsx
6
+ var Route = createFileRoute("/project/$projectId/export/$viewId")({
7
+ validateSearch: z.object({
8
+ description: z.boolean().optional().catch(false),
9
+ download: z.boolean().optional().catch(false),
10
+ format: z.enum(["png", "jpeg"]).optional().catch("png"),
11
+ notation: z.boolean().optional().catch(false),
12
+ quality: z.number().min(0).max(1).optional().catch(void 0)
13
+ }),
14
+ search: { middlewares: [stripSearchParams({
15
+ description: false,
16
+ download: false,
17
+ format: "png",
18
+ notation: false,
19
+ quality: void 0
20
+ })] },
21
+ component: ExportPage,
22
+ errorComponent: ErrorComponent
23
+ });
24
+ export { Route };
@@ -0,0 +1,14 @@
1
+ import "../../chunks/rolldown-runtime.mjs";
2
+ import { a as createFileRoute, h as redirect } from "../../chunks/libs/@tanstack.mjs";
3
+ // src/routes/project.$projectId/index.tsx
4
+ var Route = createFileRoute("/project/$projectId/")({ beforeLoad: ({ params }) => {
5
+ throw redirect({
6
+ to: "/project/$projectId/view/$viewId/",
7
+ replace: true,
8
+ params: {
9
+ projectId: params.projectId,
10
+ viewId: "index"
11
+ }
12
+ });
13
+ } });
14
+ export { Route };
@@ -0,0 +1,93 @@
1
+ import "../../chunks/rolldown-runtime.mjs";
2
+ import { _ as notFound, a as createFileRoute, h as redirect, i as Outlet, s as Link } from "../../chunks/libs/@tanstack.mjs";
3
+ import { n as ErrorComponent } from "../../chunks/ErrorComponent.mjs";
4
+ import { ViewOutlet } from "../../components/ViewOutlet.mjs";
5
+ import { LikeC4IconRendererContext } from "../../context/LikeC4IconRendererContext.mjs";
6
+ import { LikeC4ModelContext } from "../../context/LikeC4ModelContext.mjs";
7
+ import { ModelDiffsContext } from "../../context/ModelDiffsContext.mjs";
8
+ import { c } from "react/compiler-runtime";
9
+ import { jsx, jsxs } from "react/jsx-runtime";
10
+ import { Button, Container, Stack, Title } from "@mantine/core";
11
+ import { z } from "zod";
12
+ import { loadDiffs } from "likec4:diffs";
13
+ import { loadModel } from "likec4:model";
14
+ // src/routes/project.$projectId/route.tsx
15
+ var Route = createFileRoute("/project/$projectId")({
16
+ staleTime: Infinity,
17
+ params: z.object({ projectId: z.string().transform((v) => v) }),
18
+ beforeLoad: ({ params }) => ({ projectId: params.projectId }),
19
+ loader: async ({ params }) => {
20
+ const projectId = params.projectId;
21
+ const [likec4model, { $diffs }] = await Promise.all([loadModel(projectId).catch((error) => {
22
+ console.error(`Failed to load model for project ${projectId}`, error);
23
+ throw notFound();
24
+ }), loadDiffs(projectId)]);
25
+ const data = likec4model.$likec4data.value;
26
+ if (!data) throw notFound();
27
+ if (data.projectId !== projectId) throw redirect({
28
+ to: "/project/$projectId/",
29
+ search: true,
30
+ params: { projectId: data.projectId }
31
+ });
32
+ return {
33
+ $likec4model: likec4model.$likec4model,
34
+ $diffs,
35
+ projectId
36
+ };
37
+ },
38
+ component: RouteComponent,
39
+ errorComponent: ErrorComponent,
40
+ notFoundComponent: () => /* @__PURE__ */ jsx(ViewOutlet, { children: /* @__PURE__ */ jsx(Container, {
41
+ py: "xl",
42
+ children: /* @__PURE__ */ jsxs(Stack, {
43
+ align: "flex-start",
44
+ children: [/* @__PURE__ */ jsx(Title, { children: "Project not found" }), /* @__PURE__ */ jsx(Button, {
45
+ component: Link,
46
+ to: "/",
47
+ search: true,
48
+ size: "md",
49
+ children: "Open overview"
50
+ })]
51
+ })
52
+ }) })
53
+ });
54
+ function RouteComponent() {
55
+ const $ = c(9);
56
+ const { $likec4model, $diffs, projectId } = Route.useLoaderData();
57
+ let t0;
58
+ if ($[0] === Symbol.for("react.memo_cache_sentinel")) {
59
+ t0 = /* @__PURE__ */ jsx(Outlet, {});
60
+ $[0] = t0;
61
+ } else t0 = $[0];
62
+ let t1;
63
+ if ($[1] !== $diffs) {
64
+ t1 = /* @__PURE__ */ jsx(ModelDiffsContext, {
65
+ diffs: $diffs,
66
+ children: t0
67
+ });
68
+ $[1] = $diffs;
69
+ $[2] = t1;
70
+ } else t1 = $[2];
71
+ let t2;
72
+ if ($[3] !== $likec4model || $[4] !== t1) {
73
+ t2 = /* @__PURE__ */ jsx(LikeC4ModelContext, {
74
+ likec4model: $likec4model,
75
+ children: t1
76
+ });
77
+ $[3] = $likec4model;
78
+ $[4] = t1;
79
+ $[5] = t2;
80
+ } else t2 = $[5];
81
+ let t3;
82
+ if ($[6] !== projectId || $[7] !== t2) {
83
+ t3 = /* @__PURE__ */ jsx(ViewOutlet, { children: /* @__PURE__ */ jsx(LikeC4IconRendererContext, {
84
+ projectId,
85
+ children: t2
86
+ }) });
87
+ $[6] = projectId;
88
+ $[7] = t2;
89
+ $[8] = t3;
90
+ } else t3 = $[8];
91
+ return t3;
92
+ }
93
+ export { Route };
@@ -0,0 +1,34 @@
1
+ import "../../chunks/rolldown-runtime.mjs";
2
+ import { _ as notFound, a as createFileRoute } from "../../chunks/libs/@tanstack.mjs";
3
+ import { ViewAsD2 } from "../../pages/ViewAsD2.mjs";
4
+ import { c } from "react/compiler-runtime";
5
+ import { jsx } from "react/jsx-runtime";
6
+ import { loadD2Sources } from "likec4:d2";
7
+ // src/routes/project.$projectId/view.$viewId.d2.tsx
8
+ var Route = createFileRoute("/project/$projectId/view/$viewId/d2")({
9
+ staleTime: Infinity,
10
+ loader: async ({ context, params }) => {
11
+ const projectId = context.projectId;
12
+ const { viewId } = params;
13
+ try {
14
+ const { d2Source } = await loadD2Sources(projectId);
15
+ return { source: d2Source(viewId) };
16
+ } catch (error) {
17
+ console.error(error);
18
+ throw notFound();
19
+ }
20
+ },
21
+ component: Page
22
+ });
23
+ function Page() {
24
+ const $ = c(2);
25
+ const { source } = Route.useLoaderData();
26
+ let t0;
27
+ if ($[0] !== source) {
28
+ t0 = /* @__PURE__ */ jsx(ViewAsD2, { d2Source: source });
29
+ $[0] = source;
30
+ $[1] = t0;
31
+ } else t0 = $[1];
32
+ return t0;
33
+ }
34
+ export { Route };
@@ -0,0 +1,41 @@
1
+ import "../../chunks/rolldown-runtime.mjs";
2
+ import { _ as notFound, a as createFileRoute } from "../../chunks/libs/@tanstack.mjs";
3
+ import { ViewAsDot } from "../../pages/ViewAsDot.mjs";
4
+ import { c } from "react/compiler-runtime";
5
+ import { jsx } from "react/jsx-runtime";
6
+ import { loadDotSources } from "likec4:dot";
7
+ // src/routes/project.$projectId/view.$viewId.dot.tsx
8
+ var Route = createFileRoute("/project/$projectId/view/$viewId/dot")({
9
+ staleTime: Infinity,
10
+ component: Page,
11
+ loader: async ({ params, context }) => {
12
+ const projectId = context.projectId;
13
+ const { viewId } = params;
14
+ try {
15
+ const { dotSource, svgSource } = await loadDotSources(projectId);
16
+ return {
17
+ dot: dotSource(viewId),
18
+ dotSvg: svgSource(viewId)
19
+ };
20
+ } catch (error) {
21
+ console.error(error);
22
+ throw notFound();
23
+ }
24
+ }
25
+ });
26
+ function Page() {
27
+ const $ = c(3);
28
+ const { dot, dotSvg } = Route.useLoaderData();
29
+ let t0;
30
+ if ($[0] !== dot || $[1] !== dotSvg) {
31
+ t0 = /* @__PURE__ */ jsx(ViewAsDot, {
32
+ dot,
33
+ dotSvg
34
+ });
35
+ $[0] = dot;
36
+ $[1] = dotSvg;
37
+ $[2] = t0;
38
+ } else t0 = $[2];
39
+ return t0;
40
+ }
41
+ export { Route };
@@ -0,0 +1,7 @@
1
+ import { a as createFileRoute } from "../../chunks/libs/@tanstack.mjs";
2
+ import { ViewEditor } from "../../pages/ViewEditor.mjs";
3
+ import { i as ViewReact } from "../../chunks/ViewReact.mjs";
4
+ import { isRpcAvailable } from "likec4:rpc";
5
+ // src/routes/project.$projectId/view.$viewId.index.tsx
6
+ var Route = createFileRoute("/project/$projectId/view/$viewId/")({ component: isRpcAvailable ? ViewEditor : ViewReact });
7
+ export { Route };
@@ -0,0 +1,23 @@
1
+ import "../../chunks/rolldown-runtime.mjs";
2
+ import { a as createFileRoute, i as Outlet } from "../../chunks/libs/@tanstack.mjs";
3
+ import { n as ErrorComponent } from "../../chunks/ErrorComponent.mjs";
4
+ import { NotFound } from "../../components/NotFound.mjs";
5
+ import { t as Header } from "../../chunks/Header.mjs";
6
+ import { c } from "react/compiler-runtime";
7
+ import { Fragment, jsx, jsxs } from "react/jsx-runtime";
8
+ // src/routes/project.$projectId/view.$viewId.tsx
9
+ var Route = createFileRoute("/project/$projectId/view/$viewId")({
10
+ component: ViewLayout,
11
+ errorComponent: ErrorComponent,
12
+ notFoundComponent: () => /* @__PURE__ */ jsx(NotFound, {})
13
+ });
14
+ function ViewLayout() {
15
+ const $ = c(1);
16
+ let t0;
17
+ if ($[0] === Symbol.for("react.memo_cache_sentinel")) {
18
+ t0 = /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsx(Outlet, {}), /* @__PURE__ */ jsx(Header, {})] });
19
+ $[0] = t0;
20
+ } else t0 = $[0];
21
+ return t0;
22
+ }
23
+ export { Route };
@@ -0,0 +1,39 @@
1
+ import "../../chunks/rolldown-runtime.mjs";
2
+ import { _ as notFound, a as createFileRoute } from "../../chunks/libs/@tanstack.mjs";
3
+ import { ViewAsMmd } from "../../pages/ViewAsMmd.mjs";
4
+ import { c } from "react/compiler-runtime";
5
+ import { jsx } from "react/jsx-runtime";
6
+ import { loadMmdSources } from "likec4:mmd";
7
+ // src/routes/project.$projectId/view.$viewId.mmd.tsx
8
+ var Route = createFileRoute("/project/$projectId/view/$viewId/mmd")({
9
+ component: Page,
10
+ staleTime: Infinity,
11
+ loader: async ({ params, context }) => {
12
+ const projectId = context.projectId;
13
+ const { viewId } = params;
14
+ try {
15
+ const { mmdSource } = await loadMmdSources(projectId);
16
+ return { source: mmdSource(viewId) };
17
+ } catch (error) {
18
+ console.error(error);
19
+ throw notFound();
20
+ }
21
+ }
22
+ });
23
+ function Page() {
24
+ const $ = c(3);
25
+ const { viewId } = Route.useParams();
26
+ const { source } = Route.useLoaderData();
27
+ let t0;
28
+ if ($[0] !== source || $[1] !== viewId) {
29
+ t0 = /* @__PURE__ */ jsx(ViewAsMmd, {
30
+ viewId,
31
+ mmdSource: source
32
+ });
33
+ $[0] = source;
34
+ $[1] = viewId;
35
+ $[2] = t0;
36
+ } else t0 = $[2];
37
+ return t0;
38
+ }
39
+ export { Route };