likec4 1.46.4 → 1.47.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.
- package/__app__/src/ProjectsOverview.js +16 -0
- package/__app__/src/likec4.js +1301 -502
- package/__app__/src/main.js +249 -219
- package/__app__/src/style.css +1 -1
- package/__app__/src/vendors.js +2690 -2349
- package/__app__/src/webcomponent.js +1 -1
- package/config/schema.json +3 -1
- package/dist/cli/index.mjs +339 -339
- package/dist/config/index.d.mts +1 -1
- package/dist/config/index.mjs +1 -1
- package/dist/index.d.mts +13 -4
- package/dist/index.mjs +1 -1
- package/dist/model/index.d.mts +1 -0
- package/dist/shared/likec4.CDVXAxDx.mjs +3573 -0
- package/dist/shared/likec4.CRP-WAuw.mjs +330 -0
- package/dist/shared/likec4.CXTvqtC-.mjs +207 -0
- package/dist/shared/{likec4.6kvTI22o.d.mts → likec4.DqDU0qex.d.mts} +648 -57
- package/dist/shared/{likec4.DobqFzmV.d.mts → likec4.iedqayBZ.d.mts} +6958 -11665
- package/dist/vite-plugin/index.d.mts +3 -3
- package/dist/vite-plugin/index.mjs +1 -1
- package/package.json +17 -20
- package/react/index.d.ts +41 -5
- package/react/index.js +1441 -497
- package/vite-plugin-modules.d.ts +8 -0
- package/dist/shared/likec4.BJupup6Q.mjs +0 -4211
- package/dist/shared/likec4.DASl7M77.mjs +0 -183
- package/dist/shared/likec4.DwZEQeLv.mjs +0 -272
package/__app__/src/main.js
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { jsx, jsxs, Fragment } from "react/jsx-runtime";
|
|
2
2
|
import { useEffect, lazy, Suspense, createContext, useContext, useState, useMemo, memo, useRef, StrictMode } from "react";
|
|
3
3
|
import { createRoot } from "react-dom/client";
|
|
4
|
-
import {
|
|
5
|
-
import { c as css, L as LikeC4ProjectsProvider,
|
|
4
|
+
import { cN as useRouter, cO as isNotFound, cP as Container, bx as Alert, R as Text, cQ as Code, U as Button, bz as Group, bb as rem, b_ as Title, cR as Link, cS as useNavigate, bT as useCallbackRef, cT as createRootRouteWithContext, cU as stripSearchParams, $ as t, ax as e, cV as Outlet, k as useMantineColorScheme, cW as createFileRoute, cX as redirect, cY as useDocumentTitle, cZ as Loader, c_ as useStore, O as ErrorBoundary, c$ as Navigate, d as deepEqual, s as shallowEqual, d0 as useParams, d1 as useMatches, v as useIsomorphicLayoutEffect, d2 as SimpleGrid, d3 as useInViewport, d4 as e$1, ch as Card, aL as Box$1, b9 as Stack, d5 as notFound, a7 as r, bw as useTree, d6 as useComputedColorScheme, by as Tree, b1 as HoverCard, b2 as HoverCardTarget, b3 as HoverCardDropdown, Q as ThemeIcon, d7 as onMount, r as atom, cg as useLocalStorage, d8 as Drawer, bS as ScrollArea, aE as SegmentedControl, ay as ActionIcon, aC as Menu, bf as MenuTarget, bg as MenuDropdown, bh as MenuItem, d9 as MenuDivider, b0 as CopyButton$1, da as Select, db as ModalRoot, dc as ModalOverlay, dd as ModalContent, de as ModalBody, bO as Tabs, bP as TabsList, bQ as TabsTab, bR as TabsPanel, df as useMantineTheme, dg as useMediaQuery, dh as useDisclosure, aF as Divider, b8 as Space, di as useParentMatches, dj as MenuLabel, dk as useSearch, aO as useDebouncedCallback, dl as LoadingOverlay, dm as toBlob, T as Tooltip, dn as useAsync, dp as Gt, dq as _t, dr as $t, ds as Burger, dt as createRouter, du as createHashHistory, dv as createBrowserHistory, dw as RouterProvider, A as createTheme, P as Portal, C as MantineProvider } from "./vendors.js";
|
|
5
|
+
import { c as css, L as LikeC4ProjectsProvider, B as Box, I as IconRendererProvider, a as LikeC4ModelProvider, u as useUpdateEffect, S as StaticLikeC4Diagram, M as Markdown, b as useLikeC4Model, d as IconStarFilled, e as IconStack2, f as IconLayoutDashboard, g as IconFileCode, h as IconFolderOpen, i as IconFolderFilled, j as IconArrowLeft, k as IconMoonStars, l as IconSun, m as useLikeC4Projects$1, n as IconChevronDown, o as IconAlertTriangle, p as IconCheck, q as IconCopy, r as IconExternalLink, s as IconShare, t as pickViewBounds, v as LikeC4Diagram, w as useDiagramContext, x as LikeC4EditorProvider } from "./likec4.js";
|
|
6
6
|
import { pageTitle, ComponentName, useHashHistory, withOverviewGraph, isDevelopment, onViewChangeViaPlugin, isHotEnabled, krokiPumlSvgUrl, krokiD2SvgUrl, basepath } from "./const.js";
|
|
7
|
-
import { projects } from "likec4:projects";
|
|
7
|
+
import { useLikeC4Projects, projects } from "likec4:projects";
|
|
8
8
|
import { RichText } from "@likec4/core/types";
|
|
9
9
|
import { loadModel } from "likec4:model";
|
|
10
10
|
import { nonexhaustive, compareNatural } from "@likec4/core/utils";
|
|
@@ -84,13 +84,13 @@ function NotFound() {
|
|
|
84
84
|
] }) });
|
|
85
85
|
}
|
|
86
86
|
function LikeC4ProjectsContext({ children }) {
|
|
87
|
-
const navigate = useNavigate(), onProjectChange = useCallbackRef((
|
|
88
|
-
navigate({ to: "/project/$projectId/", params: { projectId } }).catch(console.error);
|
|
87
|
+
const projects2 = useLikeC4Projects(), navigate = useNavigate(), onProjectChange = useCallbackRef((projectId2) => {
|
|
88
|
+
navigate({ to: "/project/$projectId/", params: { projectId: projectId2 } }).catch(console.error);
|
|
89
89
|
});
|
|
90
90
|
return /* @__PURE__ */ jsx(
|
|
91
91
|
LikeC4ProjectsProvider,
|
|
92
92
|
{
|
|
93
|
-
projects,
|
|
93
|
+
projects: projects2,
|
|
94
94
|
onProjectChange,
|
|
95
95
|
children
|
|
96
96
|
}
|
|
@@ -135,10 +135,11 @@ const asTheme = (v) => {
|
|
|
135
135
|
})
|
|
136
136
|
]
|
|
137
137
|
},
|
|
138
|
-
beforeLoad:
|
|
139
|
-
const
|
|
138
|
+
beforeLoad: () => {
|
|
139
|
+
const _projects = projects.length > 0 ? t(projects, (p) => p.id) : ["default"];
|
|
140
140
|
return {
|
|
141
|
-
|
|
141
|
+
projects: _projects,
|
|
142
|
+
projectId: _projects[0]
|
|
142
143
|
};
|
|
143
144
|
},
|
|
144
145
|
component: RootComponent
|
|
@@ -154,30 +155,23 @@ const ThemeSync = () => {
|
|
|
154
155
|
return useEffect(() => {
|
|
155
156
|
theme2 && mantineColorScheme.setColorScheme(theme2);
|
|
156
157
|
}, [theme2]), null;
|
|
157
|
-
},
|
|
158
|
-
|
|
158
|
+
}, ProjectsOverviewPage = lazy(async () => {
|
|
159
|
+
const { ProjectsOverviewPage: ProjectsOverviewPage2 } = await import("./ProjectsOverview.js");
|
|
160
|
+
return {
|
|
161
|
+
default: ProjectsOverviewPage2
|
|
162
|
+
};
|
|
163
|
+
}), Route$k = createFileRoute("/projects")({
|
|
164
|
+
beforeLoad: async ({ context }) => {
|
|
165
|
+
if (context.projects.length < 2)
|
|
166
|
+
throw redirect({
|
|
167
|
+
to: "/single-index/"
|
|
168
|
+
});
|
|
169
|
+
},
|
|
170
|
+
component: RouteComponent$3,
|
|
171
|
+
wrapInSuspense: !0
|
|
159
172
|
});
|
|
160
173
|
function RouteComponent$3() {
|
|
161
|
-
|
|
162
|
-
return useDocumentTitle(`Projects - ${pageTitle}`), /* @__PURE__ */ jsx(Container, { size: "xs", py: "lg", children: /* @__PURE__ */ jsxs(Stack, { children: [
|
|
163
|
-
/* @__PURE__ */ jsx(Text, { fz: "lg", children: "Select a project" }),
|
|
164
|
-
projects2.map((v) => /* @__PURE__ */ jsx(
|
|
165
|
-
Button,
|
|
166
|
-
{
|
|
167
|
-
variant: "default",
|
|
168
|
-
size: "lg",
|
|
169
|
-
fw: 400,
|
|
170
|
-
renderRoot: (props) => /* @__PURE__ */ jsx(Link, { ...props, to: "/project/$projectId/", params: { projectId: v.id } }),
|
|
171
|
-
styles: {
|
|
172
|
-
inner: {
|
|
173
|
-
justifyContent: "flex-start"
|
|
174
|
-
}
|
|
175
|
-
},
|
|
176
|
-
children: v.title ?? v.id
|
|
177
|
-
},
|
|
178
|
-
v.id
|
|
179
|
-
))
|
|
180
|
-
] }) });
|
|
174
|
+
return useDocumentTitle(`Projects - ${pageTitle}`), /* @__PURE__ */ jsx(Box, { w: "100%", h: "100%", overflow: "hidden", children: /* @__PURE__ */ jsx(ProjectsOverviewPage, {}) });
|
|
181
175
|
}
|
|
182
176
|
const ProjectIcons = lazy(async () => {
|
|
183
177
|
const { ProjectIcons: ProjectIcons2 } = await import("likec4:icons");
|
|
@@ -186,8 +180,8 @@ const ProjectIcons = lazy(async () => {
|
|
|
186
180
|
};
|
|
187
181
|
}), ProjectIconRenderer = (props) => /* @__PURE__ */ jsx(Suspense, { fallback: /* @__PURE__ */ jsx(Loader, { className: "pending", type: "oval", size: "xs" }), children: /* @__PURE__ */ jsx(ProjectIcons, { ...props }) });
|
|
188
182
|
let _renderers = {};
|
|
189
|
-
function LikeC4IconRendererContext({ children, projectId }) {
|
|
190
|
-
const IconRenderer = _renderers[
|
|
183
|
+
function LikeC4IconRendererContext({ children, projectId: projectId2 }) {
|
|
184
|
+
const IconRenderer = _renderers[projectId2] ??= (props) => /* @__PURE__ */ jsx(ProjectIconRenderer, { ...props, projectId: projectId2 });
|
|
191
185
|
return /* @__PURE__ */ jsx(IconRendererProvider, { value: IconRenderer, children });
|
|
192
186
|
}
|
|
193
187
|
const LikeC4ModelDataContext = createContext(null), LikeC4ModelDataContextProvider = LikeC4ModelDataContext.Provider, useLikeC4ModelAtom = () => {
|
|
@@ -243,20 +237,29 @@ css({
|
|
|
243
237
|
const Route$j = createFileRoute("/_single")({
|
|
244
238
|
staleTime: 1 / 0,
|
|
245
239
|
loader: async ({ context }) => {
|
|
246
|
-
const { loadModel: loadModel2 } = await import("likec4:model"),
|
|
240
|
+
const { loadModel: loadModel2 } = await import("likec4:model"), projectId2 = context.projectId, { $likec4model } = await loadModel2(projectId2);
|
|
247
241
|
return {
|
|
248
242
|
$likec4model,
|
|
249
|
-
projectId
|
|
243
|
+
projectId: projectId2
|
|
250
244
|
};
|
|
251
245
|
},
|
|
252
246
|
component: RouteComponent$2
|
|
253
247
|
});
|
|
254
248
|
function RouteComponent$2() {
|
|
255
|
-
const { $likec4model, projectId } = Route$j.useLoaderData();
|
|
256
|
-
return /* @__PURE__ */ jsx("div", { className: cssViewOutlet, children: /* @__PURE__ */ jsx(ErrorBoundary, { FallbackComponent: Fallback$1, children: /* @__PURE__ */ jsx(LikeC4IconRendererContext, { projectId, children: /* @__PURE__ */ jsx(LikeC4ModelContext, { likec4model: $likec4model, children: /* @__PURE__ */ jsx(Outlet, {}) }) }) }) });
|
|
249
|
+
const { $likec4model, projectId: projectId2 } = Route$j.useLoaderData();
|
|
250
|
+
return /* @__PURE__ */ jsx("div", { className: cssViewOutlet, children: /* @__PURE__ */ jsx(ErrorBoundary, { FallbackComponent: Fallback$1, children: /* @__PURE__ */ jsx(LikeC4IconRendererContext, { projectId: projectId2, children: /* @__PURE__ */ jsx(LikeC4ModelContext, { likec4model: $likec4model, children: /* @__PURE__ */ jsx(Outlet, {}) }) }) }) });
|
|
257
251
|
}
|
|
258
252
|
const Route$i = createFileRoute("/")({
|
|
259
|
-
component: () => useLikeC4Projects().length > 1 ? /* @__PURE__ */ jsx(
|
|
253
|
+
component: () => useLikeC4Projects().length > 1 ? /* @__PURE__ */ jsx(
|
|
254
|
+
Navigate,
|
|
255
|
+
{
|
|
256
|
+
to: "/projects/",
|
|
257
|
+
mask: {
|
|
258
|
+
to: "/",
|
|
259
|
+
unmaskOnReload: !0
|
|
260
|
+
}
|
|
261
|
+
}
|
|
262
|
+
) : /* @__PURE__ */ jsx(
|
|
260
263
|
Navigate,
|
|
261
264
|
{
|
|
262
265
|
to: "/single-index/",
|
|
@@ -312,11 +315,10 @@ function useCurrentView() {
|
|
|
312
315
|
}), [$likec4model, viewId, layoutType]), [view, setLayoutType];
|
|
313
316
|
}
|
|
314
317
|
function useCurrentProject() {
|
|
315
|
-
const projects2 = useLikeC4Projects(),
|
|
316
|
-
select: (
|
|
317
|
-
strict: !1
|
|
318
|
+
const projects2 = useLikeC4Projects(), projectId2 = useMatches({
|
|
319
|
+
select: (m) => m.find((m2) => m2.routeId === "/project/$projectId")?.params?.projectId ?? m.at(-1)?.context.projectId ?? "default"
|
|
318
320
|
});
|
|
319
|
-
return projects2.find((p) => p.id ===
|
|
321
|
+
return projects2.find((p) => p.id === projectId2) ?? projects2[0];
|
|
320
322
|
}
|
|
321
323
|
css({
|
|
322
324
|
color: "mantine.colors.dimmed"
|
|
@@ -379,7 +381,7 @@ function ViewCard({ view }) {
|
|
|
379
381
|
className: "group",
|
|
380
382
|
withBorder: !0,
|
|
381
383
|
children: [
|
|
382
|
-
/* @__PURE__ */ jsx(Card.Section, { children: /* @__PURE__ */ jsx(Box, { className: previewBg, style: { height: 200 }, children: visible && /* @__PURE__ */ jsx(
|
|
384
|
+
/* @__PURE__ */ jsx(Card.Section, { children: /* @__PURE__ */ jsx(Box$1, { className: previewBg, style: { height: 200 }, children: visible && /* @__PURE__ */ jsx(
|
|
383
385
|
StaticLikeC4Diagram,
|
|
384
386
|
{
|
|
385
387
|
background: "transparent",
|
|
@@ -418,12 +420,12 @@ const Route$g = createFileRoute("/project/$projectId")({
|
|
|
418
420
|
projectId: params.projectId
|
|
419
421
|
}),
|
|
420
422
|
loader: async ({ context }) => {
|
|
421
|
-
const
|
|
423
|
+
const projectId2 = context.projectId;
|
|
422
424
|
try {
|
|
423
|
-
const { $likec4model } = await loadModel(
|
|
425
|
+
const { $likec4model } = await loadModel(projectId2);
|
|
424
426
|
return {
|
|
425
427
|
$likec4model,
|
|
426
|
-
projectId
|
|
428
|
+
projectId: projectId2
|
|
427
429
|
};
|
|
428
430
|
} catch (err) {
|
|
429
431
|
throw console.error(err), notFound();
|
|
@@ -436,19 +438,19 @@ const Route$g = createFileRoute("/project/$projectId")({
|
|
|
436
438
|
] }) }) })
|
|
437
439
|
});
|
|
438
440
|
function RouteComponent() {
|
|
439
|
-
const { $likec4model, projectId } = Route$g.useLoaderData();
|
|
440
|
-
return /* @__PURE__ */ jsx("div", { className: cssViewOutlet, children: /* @__PURE__ */ jsx(ErrorBoundary, { FallbackComponent: Fallback$1, children: /* @__PURE__ */ jsx(LikeC4IconRendererContext, { projectId, children: /* @__PURE__ */ jsx(LikeC4ModelContext, { likec4model: $likec4model, children: /* @__PURE__ */ jsx(Outlet, {}) }) }) }) });
|
|
441
|
+
const { $likec4model, projectId: projectId2 } = Route$g.useLoaderData();
|
|
442
|
+
return /* @__PURE__ */ jsx("div", { className: cssViewOutlet, children: /* @__PURE__ */ jsx(ErrorBoundary, { FallbackComponent: Fallback$1, children: /* @__PURE__ */ jsx(LikeC4IconRendererContext, { projectId: projectId2, children: /* @__PURE__ */ jsx(LikeC4ModelContext, { likec4model: $likec4model, children: /* @__PURE__ */ jsx(Outlet, {}) }) }) }) });
|
|
441
443
|
}
|
|
442
444
|
const Route$f = createFileRoute("/project/$projectId/")({
|
|
443
445
|
component: () => {
|
|
444
|
-
const { projectId } = Route$f.useParams();
|
|
446
|
+
const { projectId: projectId2 } = Route$f.useParams();
|
|
445
447
|
return /* @__PURE__ */ jsx(
|
|
446
448
|
Navigate,
|
|
447
449
|
{
|
|
448
450
|
to: "/project/$projectId/view/$viewId/",
|
|
449
451
|
replace: !0,
|
|
450
452
|
params: {
|
|
451
|
-
projectId,
|
|
453
|
+
projectId: projectId2,
|
|
452
454
|
viewId: "index"
|
|
453
455
|
}
|
|
454
456
|
}
|
|
@@ -497,7 +499,7 @@ function WebcomponentPage() {
|
|
|
497
499
|
</html>
|
|
498
500
|
`;
|
|
499
501
|
return /* @__PURE__ */ jsx(
|
|
500
|
-
Box
|
|
502
|
+
Box,
|
|
501
503
|
{
|
|
502
504
|
css: {
|
|
503
505
|
position: "fixed",
|
|
@@ -608,7 +610,7 @@ const isFile = (node) => isTreeNodeData(node) && node.type === "file", FolderIco
|
|
|
608
610
|
viewId && tree.select(viewId);
|
|
609
611
|
}, [viewId]);
|
|
610
612
|
const theme2 = useComputedColorScheme();
|
|
611
|
-
return /* @__PURE__ */ jsx(Box
|
|
613
|
+
return /* @__PURE__ */ jsx(Box, { children: /* @__PURE__ */ jsx(
|
|
612
614
|
Tree,
|
|
613
615
|
{
|
|
614
616
|
allowRangeSelection: !1,
|
|
@@ -803,7 +805,7 @@ const cssHeader = css({
|
|
|
803
805
|
}
|
|
804
806
|
});
|
|
805
807
|
function SelectProject() {
|
|
806
|
-
const projects2 = useLikeC4Projects(), project = useCurrentProject();
|
|
808
|
+
const projects2 = useLikeC4Projects$1(), project = useCurrentProject();
|
|
807
809
|
return projects2.length < 2 ? null : /* @__PURE__ */ jsxs(Menu, { shadow: "md", width: 200, trigger: "click-hover", openDelay: 200, children: [
|
|
808
810
|
/* @__PURE__ */ jsx(MenuTarget, { children: /* @__PURE__ */ jsx(
|
|
809
811
|
Button,
|
|
@@ -817,24 +819,40 @@ function SelectProject() {
|
|
|
817
819
|
children: project.title ?? project.id
|
|
818
820
|
}
|
|
819
821
|
) }),
|
|
820
|
-
/* @__PURE__ */
|
|
821
|
-
|
|
822
|
-
|
|
823
|
-
|
|
824
|
-
|
|
825
|
-
|
|
826
|
-
|
|
827
|
-
|
|
828
|
-
|
|
829
|
-
projectId: id,
|
|
830
|
-
viewId: "index"
|
|
822
|
+
/* @__PURE__ */ jsxs(MenuDropdown, { children: [
|
|
823
|
+
/* @__PURE__ */ jsx(
|
|
824
|
+
MenuItem,
|
|
825
|
+
{
|
|
826
|
+
renderRoot: (props) => /* @__PURE__ */ jsx(
|
|
827
|
+
Link,
|
|
828
|
+
{
|
|
829
|
+
...props,
|
|
830
|
+
to: "/projects"
|
|
831
831
|
}
|
|
832
|
-
|
|
833
|
-
|
|
834
|
-
|
|
835
|
-
|
|
836
|
-
|
|
837
|
-
|
|
832
|
+
),
|
|
833
|
+
children: "Projects overview"
|
|
834
|
+
}
|
|
835
|
+
),
|
|
836
|
+
/* @__PURE__ */ jsx(MenuDivider, {}),
|
|
837
|
+
projects2.map(({ id, title: title2 }) => /* @__PURE__ */ jsx(
|
|
838
|
+
MenuItem,
|
|
839
|
+
{
|
|
840
|
+
renderRoot: (props) => /* @__PURE__ */ jsx(
|
|
841
|
+
Link,
|
|
842
|
+
{
|
|
843
|
+
...props,
|
|
844
|
+
to: "/project/$projectId/view/$viewId/",
|
|
845
|
+
params: {
|
|
846
|
+
projectId: id,
|
|
847
|
+
viewId: "index"
|
|
848
|
+
}
|
|
849
|
+
}
|
|
850
|
+
),
|
|
851
|
+
children: title2 ?? id
|
|
852
|
+
},
|
|
853
|
+
id
|
|
854
|
+
))
|
|
855
|
+
] })
|
|
838
856
|
] });
|
|
839
857
|
}
|
|
840
858
|
const AlertLocalhost = () => /* @__PURE__ */ jsx(
|
|
@@ -876,10 +894,10 @@ const AlertLocalhost = () => /* @__PURE__ */ jsx(
|
|
|
876
894
|
`.trim();
|
|
877
895
|
return /* @__PURE__ */ jsxs(Stack, { children: [
|
|
878
896
|
code.includes("http://localhost") && /* @__PURE__ */ jsx(AlertLocalhost, {}),
|
|
879
|
-
/* @__PURE__ */ jsx(Box, { children: /* @__PURE__ */ jsx(Text, { size: "sm", children: "Embedded view is an iframe with a static diagram" }) }),
|
|
897
|
+
/* @__PURE__ */ jsx(Box$1, { children: /* @__PURE__ */ jsx(Text, { size: "sm", children: "Embedded view is an iframe with a static diagram" }) }),
|
|
880
898
|
/* @__PURE__ */ jsxs(Stack, { gap: "xs", children: [
|
|
881
899
|
/* @__PURE__ */ jsxs(Group, { justify: "space-between", children: [
|
|
882
|
-
/* @__PURE__ */ jsx(Box, { children: /* @__PURE__ */ jsx(Text, { fw: "500", size: "sm", children: "HTML" }) }),
|
|
900
|
+
/* @__PURE__ */ jsx(Box$1, { children: /* @__PURE__ */ jsx(Text, { fw: "500", size: "sm", children: "HTML" }) }),
|
|
883
901
|
/* @__PURE__ */ jsxs(Group, { gap: "xs", children: [
|
|
884
902
|
/* @__PURE__ */ jsx(ActionIcon, { component: "a", href, target: "_blank", variant: "light", color: "gray", children: /* @__PURE__ */ jsx(IconExternalLink, {}) }),
|
|
885
903
|
/* @__PURE__ */ jsx(CopyButton$1, { value: code, timeout: 1500, children: CopyButtonChild })
|
|
@@ -887,7 +905,7 @@ const AlertLocalhost = () => /* @__PURE__ */ jsx(
|
|
|
887
905
|
] }),
|
|
888
906
|
/* @__PURE__ */ jsx(Code, { block: !0, children: code }),
|
|
889
907
|
/* @__PURE__ */ jsx(
|
|
890
|
-
Box,
|
|
908
|
+
Box$1,
|
|
891
909
|
{
|
|
892
910
|
style: {
|
|
893
911
|
alignSelf: "flex-start"
|
|
@@ -935,10 +953,10 @@ function WebcomponentsPanel({ diagram }) {
|
|
|
935
953
|
);
|
|
936
954
|
return /* @__PURE__ */ jsxs(Stack, { children: [
|
|
937
955
|
jscode.includes("http://localhost") && /* @__PURE__ */ jsx(AlertLocalhost, {}),
|
|
938
|
-
/* @__PURE__ */ jsx(Box, { children: /* @__PURE__ */ jsx(Text, { size: "sm", children: "Add this script to your page:" }) }),
|
|
956
|
+
/* @__PURE__ */ jsx(Box$1, { children: /* @__PURE__ */ jsx(Text, { size: "sm", children: "Add this script to your page:" }) }),
|
|
939
957
|
/* @__PURE__ */ jsxs(Stack, { gap: "xs", children: [
|
|
940
958
|
/* @__PURE__ */ jsxs(Group, { justify: "space-between", children: [
|
|
941
|
-
/* @__PURE__ */ jsx(Box, { children: /* @__PURE__ */ jsx(Text, { fw: "500", size: "sm", children: "JavaScript" }) }),
|
|
959
|
+
/* @__PURE__ */ jsx(Box$1, { children: /* @__PURE__ */ jsx(Text, { fw: "500", size: "sm", children: "JavaScript" }) }),
|
|
942
960
|
/* @__PURE__ */ jsxs(Group, { gap: "xs", children: [
|
|
943
961
|
/* @__PURE__ */ jsx(ActionIcon, { component: "a", href: webcomponentPreview.href, target: "_blank", variant: "light", color: "gray", children: /* @__PURE__ */ jsx(IconExternalLink, {}) }),
|
|
944
962
|
/* @__PURE__ */ jsx(
|
|
@@ -952,7 +970,7 @@ function WebcomponentsPanel({ diagram }) {
|
|
|
952
970
|
] })
|
|
953
971
|
] }),
|
|
954
972
|
/* @__PURE__ */ jsx(Code, { block: !0, children: jscode }),
|
|
955
|
-
/* @__PURE__ */ jsx(Box, { children: /* @__PURE__ */ jsxs(Text, { size: "sm", c: "dimmed", children: [
|
|
973
|
+
/* @__PURE__ */ jsx(Box$1, { children: /* @__PURE__ */ jsxs(Text, { size: "sm", c: "dimmed", children: [
|
|
956
974
|
"This script defines a custom element (webcomponent) that renders your diagrams.",
|
|
957
975
|
/* @__PURE__ */ jsx("br", {}),
|
|
958
976
|
"Script must be inserted once in the ",
|
|
@@ -965,8 +983,8 @@ function WebcomponentsPanel({ diagram }) {
|
|
|
965
983
|
] }),
|
|
966
984
|
/* @__PURE__ */ jsxs(Stack, { gap: "xs", children: [
|
|
967
985
|
/* @__PURE__ */ jsxs(Group, { justify: "space-between", children: [
|
|
968
|
-
/* @__PURE__ */ jsx(Box, { children: /* @__PURE__ */ jsx(Text, { fw: "500", size: "sm", children: "HTML" }) }),
|
|
969
|
-
/* @__PURE__ */ jsx(Box, { children: /* @__PURE__ */ jsx(
|
|
986
|
+
/* @__PURE__ */ jsx(Box$1, { children: /* @__PURE__ */ jsx(Text, { fw: "500", size: "sm", children: "HTML" }) }),
|
|
987
|
+
/* @__PURE__ */ jsx(Box$1, { children: /* @__PURE__ */ jsx(
|
|
970
988
|
CopyButton$1,
|
|
971
989
|
{
|
|
972
990
|
value: htmlCode,
|
|
@@ -976,7 +994,7 @@ function WebcomponentsPanel({ diagram }) {
|
|
|
976
994
|
) })
|
|
977
995
|
] }),
|
|
978
996
|
/* @__PURE__ */ jsx(Code, { block: !0, children: htmlCode }),
|
|
979
|
-
/* @__PURE__ */ jsx(Box, { children: /* @__PURE__ */ jsxs(Text, { size: "sm", c: "dimmed", children: [
|
|
997
|
+
/* @__PURE__ */ jsx(Box$1, { children: /* @__PURE__ */ jsxs(Text, { size: "sm", c: "dimmed", children: [
|
|
980
998
|
"Insert this code to your page. Page may have multiple ",
|
|
981
999
|
/* @__PURE__ */ jsx("code", { children: "<likec4-view>" }),
|
|
982
1000
|
"."
|
|
@@ -1012,7 +1030,7 @@ function ShareModal({
|
|
|
1012
1030
|
) : null;
|
|
1013
1031
|
}
|
|
1014
1032
|
const Header = memo(() => {
|
|
1015
|
-
const projects2 = useLikeC4Projects(), isReactDiagramRoute = useMatches({
|
|
1033
|
+
const projects2 = useLikeC4Projects$1(), isReactDiagramRoute = useMatches({
|
|
1016
1034
|
select(matches) {
|
|
1017
1035
|
return matches.some(
|
|
1018
1036
|
({ routeId }) => routeId === "/_single/view/$viewId/" || routeId === "/_single/view/$viewId/editor" || routeId === "/project/$projectId/view/$viewId"
|
|
@@ -1020,7 +1038,7 @@ const Header = memo(() => {
|
|
|
1020
1038
|
}
|
|
1021
1039
|
}), { breakpoints } = useMantineTheme(), isTablet = useMediaQuery(`(min-width: ${breakpoints.md})`) ?? !1, [opened, { open, close }] = useDisclosure(!1);
|
|
1022
1040
|
return /* @__PURE__ */ jsxs(
|
|
1023
|
-
Box
|
|
1041
|
+
Box,
|
|
1024
1042
|
{
|
|
1025
1043
|
className: cssHeader,
|
|
1026
1044
|
children: [
|
|
@@ -1253,7 +1271,7 @@ function ExportPage() {
|
|
|
1253
1271
|
return /* @__PURE__ */ jsx("div", { children: "Loading..." });
|
|
1254
1272
|
const bounds = pickViewBounds(diagram, dynamic), extraPadding = 16, width = bounds.width + padding * 2 + extraPadding, height = bounds.height + padding * 2 + extraPadding;
|
|
1255
1273
|
return /* @__PURE__ */ jsxs(
|
|
1256
|
-
Box
|
|
1274
|
+
Box,
|
|
1257
1275
|
{
|
|
1258
1276
|
ref: viewportRef,
|
|
1259
1277
|
"data-testid": "export-page",
|
|
@@ -1375,72 +1393,6 @@ function EmbedPage() {
|
|
|
1375
1393
|
const Route$b = createFileRoute("/_single/embed/$viewId")({
|
|
1376
1394
|
component: EmbedPage
|
|
1377
1395
|
});
|
|
1378
|
-
function ViewEditor() {
|
|
1379
|
-
const navigate = useNavigate(), projectId = useCurrentProject().id, [view, setLayoutType] = useCurrentView(), $likec4model = useLikeC4ModelAtom(), onNavigateTo = useCallbackRef((viewId) => {
|
|
1380
|
-
navigate({
|
|
1381
|
-
to: "./",
|
|
1382
|
-
viewTransition: !1,
|
|
1383
|
-
params: (current) => ({
|
|
1384
|
-
...current,
|
|
1385
|
-
viewId
|
|
1386
|
-
}),
|
|
1387
|
-
search: !0
|
|
1388
|
-
});
|
|
1389
|
-
});
|
|
1390
|
-
if (!view)
|
|
1391
|
-
return /* @__PURE__ */ jsx(NotFound, {});
|
|
1392
|
-
const hasNotations = (view.notation?.nodes ?? []).length > 0, onChange = onViewChangeViaPlugin ?? void 0;
|
|
1393
|
-
return /* @__PURE__ */ jsx(
|
|
1394
|
-
LikeC4EditorProvider,
|
|
1395
|
-
{
|
|
1396
|
-
editor: {
|
|
1397
|
-
fetchView: (id, layout) => {
|
|
1398
|
-
const model = $likec4model.get().view(id);
|
|
1399
|
-
return layout === "auto" ? model.$view : model.$layouted;
|
|
1400
|
-
},
|
|
1401
|
-
handleChange: (viewId, change) => {
|
|
1402
|
-
onChange?.({
|
|
1403
|
-
projectId,
|
|
1404
|
-
viewId,
|
|
1405
|
-
change
|
|
1406
|
-
});
|
|
1407
|
-
}
|
|
1408
|
-
},
|
|
1409
|
-
children: /* @__PURE__ */ jsx(
|
|
1410
|
-
LikeC4Diagram,
|
|
1411
|
-
{
|
|
1412
|
-
view,
|
|
1413
|
-
zoomable: !0,
|
|
1414
|
-
pannable: !0,
|
|
1415
|
-
controls: !0,
|
|
1416
|
-
fitViewPadding: {
|
|
1417
|
-
top: "70px",
|
|
1418
|
-
bottom: "32px",
|
|
1419
|
-
left: "50px",
|
|
1420
|
-
right: "32px"
|
|
1421
|
-
},
|
|
1422
|
-
showNavigationButtons: !0,
|
|
1423
|
-
enableNotations: isDevelopment || hasNotations,
|
|
1424
|
-
enableSearch: !0,
|
|
1425
|
-
enableDynamicViewWalkthrough: !0,
|
|
1426
|
-
enableFocusMode: !0,
|
|
1427
|
-
enableElementDetails: !0,
|
|
1428
|
-
enableRelationshipDetails: !0,
|
|
1429
|
-
enableRelationshipBrowser: !0,
|
|
1430
|
-
enableElementTags: !0,
|
|
1431
|
-
enableCompareWithLatest: !0,
|
|
1432
|
-
onNavigateTo,
|
|
1433
|
-
onLayoutTypeChange: setLayoutType,
|
|
1434
|
-
onBurgerMenuClick: () => {
|
|
1435
|
-
navigate({
|
|
1436
|
-
to: "/"
|
|
1437
|
-
});
|
|
1438
|
-
}
|
|
1439
|
-
}
|
|
1440
|
-
)
|
|
1441
|
-
}
|
|
1442
|
-
);
|
|
1443
|
-
}
|
|
1444
1396
|
function ViewReact() {
|
|
1445
1397
|
const navigate = useNavigate(), [view, setLayoutType] = useCurrentView(), model = useLikeC4Model(), { dynamic } = useSearch({
|
|
1446
1398
|
from: "__root__"
|
|
@@ -1485,16 +1437,16 @@ function ViewReact() {
|
|
|
1485
1437
|
nodesSelectable: !0,
|
|
1486
1438
|
onNavigateTo,
|
|
1487
1439
|
onLayoutTypeChange: setLayoutType,
|
|
1488
|
-
|
|
1440
|
+
onLogoClick: () => {
|
|
1489
1441
|
navigate({
|
|
1490
1442
|
to: "/"
|
|
1491
1443
|
});
|
|
1492
1444
|
},
|
|
1493
|
-
children: /* @__PURE__ */ jsx(
|
|
1445
|
+
children: /* @__PURE__ */ jsx(ListenForDynamicVariantChange, {})
|
|
1494
1446
|
}
|
|
1495
1447
|
);
|
|
1496
1448
|
}
|
|
1497
|
-
function
|
|
1449
|
+
function ListenForDynamicVariantChange() {
|
|
1498
1450
|
const router2 = useRouter(), dynamicViewVariant = useDiagramContext((c) => c.dynamicViewVariant);
|
|
1499
1451
|
return useUpdateEffect(() => {
|
|
1500
1452
|
(router2.latestLocation.search.dynamic ?? "diagram") !== dynamicViewVariant && router2.buildAndCommitLocation({
|
|
@@ -1506,6 +1458,75 @@ function DiagramListener() {
|
|
|
1506
1458
|
});
|
|
1507
1459
|
}, [dynamicViewVariant]), null;
|
|
1508
1460
|
}
|
|
1461
|
+
function ViewEditor() {
|
|
1462
|
+
const navigate = useNavigate(), project = useCurrentProject(), [view, setLayoutType] = useCurrentView(), $likec4model = useLikeC4ModelAtom(), { dynamic } = useSearch({ strict: !1 }), onNavigateTo = useCallbackRef((viewId) => {
|
|
1463
|
+
navigate({
|
|
1464
|
+
to: "./",
|
|
1465
|
+
viewTransition: !1,
|
|
1466
|
+
params: (current) => ({
|
|
1467
|
+
...current,
|
|
1468
|
+
viewId
|
|
1469
|
+
}),
|
|
1470
|
+
search: !0
|
|
1471
|
+
});
|
|
1472
|
+
});
|
|
1473
|
+
if (!view)
|
|
1474
|
+
return /* @__PURE__ */ jsx(NotFound, {});
|
|
1475
|
+
const hasNotations = (view.notation?.nodes ?? []).length > 0, onChange = onViewChangeViaPlugin ?? void 0;
|
|
1476
|
+
return /* @__PURE__ */ jsx(
|
|
1477
|
+
LikeC4EditorProvider,
|
|
1478
|
+
{
|
|
1479
|
+
editor: {
|
|
1480
|
+
fetchView: (id, layout) => {
|
|
1481
|
+
const model = $likec4model.get().view(id);
|
|
1482
|
+
return layout === "auto" ? model.$view : model.$layouted;
|
|
1483
|
+
},
|
|
1484
|
+
handleChange: (viewId, change) => {
|
|
1485
|
+
const event = {
|
|
1486
|
+
projectId: project.id,
|
|
1487
|
+
viewId,
|
|
1488
|
+
change
|
|
1489
|
+
};
|
|
1490
|
+
onChange?.(event);
|
|
1491
|
+
}
|
|
1492
|
+
},
|
|
1493
|
+
children: /* @__PURE__ */ jsx(
|
|
1494
|
+
LikeC4Diagram,
|
|
1495
|
+
{
|
|
1496
|
+
view,
|
|
1497
|
+
zoomable: !0,
|
|
1498
|
+
pannable: !0,
|
|
1499
|
+
controls: !0,
|
|
1500
|
+
fitViewPadding: {
|
|
1501
|
+
top: "70px",
|
|
1502
|
+
bottom: "32px",
|
|
1503
|
+
left: "50px",
|
|
1504
|
+
right: "32px"
|
|
1505
|
+
},
|
|
1506
|
+
showNavigationButtons: !0,
|
|
1507
|
+
enableNotations: isDevelopment || hasNotations,
|
|
1508
|
+
enableSearch: !0,
|
|
1509
|
+
enableDynamicViewWalkthrough: !0,
|
|
1510
|
+
enableFocusMode: !0,
|
|
1511
|
+
enableElementDetails: !0,
|
|
1512
|
+
enableRelationshipDetails: !0,
|
|
1513
|
+
enableRelationshipBrowser: !0,
|
|
1514
|
+
enableElementTags: !0,
|
|
1515
|
+
enableCompareWithLatest: !0,
|
|
1516
|
+
dynamicViewVariant: dynamic,
|
|
1517
|
+
onNavigateTo,
|
|
1518
|
+
onLayoutTypeChange: setLayoutType,
|
|
1519
|
+
onLogoClick: () => {
|
|
1520
|
+
navigate({
|
|
1521
|
+
to: "/"
|
|
1522
|
+
});
|
|
1523
|
+
},
|
|
1524
|
+
children: /* @__PURE__ */ jsx(ListenForDynamicVariantChange, {})
|
|
1525
|
+
}
|
|
1526
|
+
)
|
|
1527
|
+
}
|
|
1528
|
+
);
|
|
1529
|
+
}
|
|
1509
1530
|
const Route$a = createFileRoute("/_single/view/$viewId/")({
|
|
1510
1531
|
component: isHotEnabled ? ViewEditor : ViewReact
|
|
1511
1532
|
}), Route$9 = createFileRoute("/project/$projectId/view/$viewId")({
|
|
@@ -1535,7 +1556,7 @@ function CopyButton({ text }) {
|
|
|
1535
1556
|
return /* @__PURE__ */ jsx(CopyButton$1, { value: text, timeout: 2e3, children: ({ copied, copy }) => /* @__PURE__ */ jsx(Tooltip, { label: copied ? "Copied" : "Copy", withArrow: !0, position: "right", children: /* @__PURE__ */ jsx(ActionIcon, { color: copied ? "teal" : "gray", variant: copied ? "light" : "subtle", onClick: copy, children: copied ? /* @__PURE__ */ jsx(IconCheck, { style: { width: rem(16) } }) : /* @__PURE__ */ jsx(IconCopy, { style: { width: rem(16) } }) }) }) });
|
|
1536
1557
|
}
|
|
1537
1558
|
function CopyToClipboard({ text }) {
|
|
1538
|
-
return /* @__PURE__ */ jsx(Box, { pos: "absolute", top: "0", right: "0", p: "4", children: /* @__PURE__ */ jsx(CopyButton, { text }) });
|
|
1559
|
+
return /* @__PURE__ */ jsx(Box$1, { pos: "absolute", top: "0", right: "0", p: "4", children: /* @__PURE__ */ jsx(CopyButton, { text }) });
|
|
1539
1560
|
}
|
|
1540
1561
|
const cssScrollArea = css({
|
|
1541
1562
|
height: "100%",
|
|
@@ -1549,14 +1570,15 @@ const cssScrollArea = css({
|
|
|
1549
1570
|
}), cssCodeBlock = css({
|
|
1550
1571
|
minHeight: "100%"
|
|
1551
1572
|
}), viewWithTopPadding = css({
|
|
1573
|
+
height: "100%",
|
|
1552
1574
|
paddingTop: "[var(--header-height)]"
|
|
1553
1575
|
}), Route$6 = createFileRoute("/_single/view/$viewId/puml")({
|
|
1554
1576
|
component: ViewAsPuml,
|
|
1555
1577
|
staleTime: 1 / 0,
|
|
1556
1578
|
loader: async ({ params, context }) => {
|
|
1557
|
-
const
|
|
1579
|
+
const projectId2 = context.projectId, { viewId } = params, { loadPumlSources } = await import("likec4:puml");
|
|
1558
1580
|
try {
|
|
1559
|
-
const { pumlSource } = await loadPumlSources(
|
|
1581
|
+
const { pumlSource } = await loadPumlSources(projectId2);
|
|
1560
1582
|
return {
|
|
1561
1583
|
source: pumlSource(viewId)
|
|
1562
1584
|
};
|
|
@@ -1578,8 +1600,8 @@ const cssScrollArea = css({
|
|
|
1578
1600
|
function ViewAsPuml() {
|
|
1579
1601
|
const { source } = Route$6.useLoaderData(), [krokiSvg, { execute }] = useAsync(fetchFromKroki$1, null);
|
|
1580
1602
|
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
1581
|
-
/* @__PURE__ */ jsxs(
|
|
1582
|
-
/* @__PURE__ */ jsx(
|
|
1603
|
+
/* @__PURE__ */ jsxs(Gt, { className: viewWithTopPadding, children: [
|
|
1604
|
+
/* @__PURE__ */ jsx(_t, { children: /* @__PURE__ */ jsxs(
|
|
1583
1605
|
ScrollArea,
|
|
1584
1606
|
{
|
|
1585
1607
|
className: cssScrollArea,
|
|
@@ -1596,14 +1618,14 @@ function ViewAsPuml() {
|
|
|
1596
1618
|
}
|
|
1597
1619
|
) }),
|
|
1598
1620
|
/* @__PURE__ */ jsx(
|
|
1599
|
-
|
|
1621
|
+
$t,
|
|
1600
1622
|
{
|
|
1601
1623
|
style: {
|
|
1602
1624
|
width: 10
|
|
1603
1625
|
}
|
|
1604
1626
|
}
|
|
1605
1627
|
),
|
|
1606
|
-
/* @__PURE__ */ jsx(
|
|
1628
|
+
/* @__PURE__ */ jsx(_t, { children: /* @__PURE__ */ jsxs(ScrollArea, { h: "100%", children: [
|
|
1607
1629
|
krokiSvg.status !== "success" && /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
1608
1630
|
/* @__PURE__ */ jsx(
|
|
1609
1631
|
Button,
|
|
@@ -1617,13 +1639,13 @@ function ViewAsPuml() {
|
|
|
1617
1639
|
children: krokiSvg.status === "loading" ? "Loading..." : "Render with Kroki"
|
|
1618
1640
|
}
|
|
1619
1641
|
),
|
|
1620
|
-
krokiSvg.status === "error" && /* @__PURE__ */ jsx(Box, { children: krokiSvg.error?.message })
|
|
1642
|
+
krokiSvg.status === "error" && /* @__PURE__ */ jsx(Box$1, { children: krokiSvg.error?.message })
|
|
1621
1643
|
] }),
|
|
1622
|
-
krokiSvg.status === "success" && /* @__PURE__ */ jsx(Box, { className: svgContainer, children: krokiSvg.result ? /* @__PURE__ */ jsx("div", { dangerouslySetInnerHTML: { __html: krokiSvg.result } }) : /* @__PURE__ */ jsx(Box, { children: "Empty result" }) })
|
|
1644
|
+
krokiSvg.status === "success" && /* @__PURE__ */ jsx(Box$1, { className: svgContainer, children: krokiSvg.result ? /* @__PURE__ */ jsx("div", { dangerouslySetInnerHTML: { __html: krokiSvg.result } }) : /* @__PURE__ */ jsx(Box$1, { children: "Empty result" }) })
|
|
1623
1645
|
] }) })
|
|
1624
1646
|
] }),
|
|
1625
1647
|
/* @__PURE__ */ jsx(
|
|
1626
|
-
Box,
|
|
1648
|
+
Box$1,
|
|
1627
1649
|
{
|
|
1628
1650
|
pos: "fixed",
|
|
1629
1651
|
top: 14,
|
|
@@ -1644,9 +1666,9 @@ const Route$5 = createFileRoute("/_single/view/$viewId/mmd")({
|
|
|
1644
1666
|
component: ViewAsMmd,
|
|
1645
1667
|
staleTime: 1 / 0,
|
|
1646
1668
|
loader: async ({ params, context }) => {
|
|
1647
|
-
const
|
|
1669
|
+
const projectId2 = context.projectId, { viewId } = params, { loadMmdSources } = await import("likec4:mmd");
|
|
1648
1670
|
try {
|
|
1649
|
-
const { mmdSource } = await loadMmdSources(
|
|
1671
|
+
const { mmdSource } = await loadMmdSources(projectId2);
|
|
1650
1672
|
return {
|
|
1651
1673
|
source: mmdSource(viewId)
|
|
1652
1674
|
};
|
|
@@ -1667,8 +1689,8 @@ function ViewAsMmd() {
|
|
|
1667
1689
|
return useEffect(() => {
|
|
1668
1690
|
execute(viewId, source);
|
|
1669
1691
|
}, [source]), /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
1670
|
-
/* @__PURE__ */ jsxs(
|
|
1671
|
-
/* @__PURE__ */ jsx(
|
|
1692
|
+
/* @__PURE__ */ jsxs(Gt, { className: viewWithTopPadding, children: [
|
|
1693
|
+
/* @__PURE__ */ jsx(_t, { children: /* @__PURE__ */ jsxs(
|
|
1672
1694
|
ScrollArea,
|
|
1673
1695
|
{
|
|
1674
1696
|
className: cssScrollArea,
|
|
@@ -1685,17 +1707,17 @@ function ViewAsMmd() {
|
|
|
1685
1707
|
}
|
|
1686
1708
|
) }),
|
|
1687
1709
|
/* @__PURE__ */ jsx(
|
|
1688
|
-
|
|
1710
|
+
$t,
|
|
1689
1711
|
{
|
|
1690
1712
|
style: {
|
|
1691
1713
|
width: 10
|
|
1692
1714
|
}
|
|
1693
1715
|
}
|
|
1694
1716
|
),
|
|
1695
|
-
/* @__PURE__ */ jsx(
|
|
1717
|
+
/* @__PURE__ */ jsx(_t, { children: /* @__PURE__ */ jsx(ScrollArea, { h: "100%", children: mmdSvg.result && /* @__PURE__ */ jsx("div", { className: svgContainer, dangerouslySetInnerHTML: { __html: mmdSvg.result } }) }) })
|
|
1696
1718
|
] }),
|
|
1697
1719
|
/* @__PURE__ */ jsx(
|
|
1698
|
-
Box,
|
|
1720
|
+
Box$1,
|
|
1699
1721
|
{
|
|
1700
1722
|
pos: "fixed",
|
|
1701
1723
|
top: 14,
|
|
@@ -1718,9 +1740,9 @@ const Route$4 = createFileRoute("/_single/view/$viewId/editor")({
|
|
|
1718
1740
|
component: ViewAsDot,
|
|
1719
1741
|
staleTime: 1 / 0,
|
|
1720
1742
|
loader: async ({ params, context }) => {
|
|
1721
|
-
const
|
|
1743
|
+
const projectId2 = context.projectId, { viewId } = params, { loadDotSources } = await import("likec4:dot");
|
|
1722
1744
|
try {
|
|
1723
|
-
const { dotSource, svgSource } = await loadDotSources(
|
|
1745
|
+
const { dotSource, svgSource } = await loadDotSources(projectId2), dot = dotSource(viewId), dotSvg = svgSource(viewId);
|
|
1724
1746
|
return {
|
|
1725
1747
|
dot,
|
|
1726
1748
|
dotSvg
|
|
@@ -1733,8 +1755,8 @@ const Route$4 = createFileRoute("/_single/view/$viewId/editor")({
|
|
|
1733
1755
|
function ViewAsDot() {
|
|
1734
1756
|
const { dot, dotSvg } = Route$3.useLoaderData();
|
|
1735
1757
|
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
1736
|
-
/* @__PURE__ */ jsxs(
|
|
1737
|
-
/* @__PURE__ */ jsx(
|
|
1758
|
+
/* @__PURE__ */ jsxs(Gt, { className: viewWithTopPadding, children: [
|
|
1759
|
+
/* @__PURE__ */ jsx(_t, { children: /* @__PURE__ */ jsxs(
|
|
1738
1760
|
ScrollArea,
|
|
1739
1761
|
{
|
|
1740
1762
|
className: cssScrollArea,
|
|
@@ -1751,17 +1773,17 @@ function ViewAsDot() {
|
|
|
1751
1773
|
}
|
|
1752
1774
|
) }),
|
|
1753
1775
|
/* @__PURE__ */ jsx(
|
|
1754
|
-
|
|
1776
|
+
$t,
|
|
1755
1777
|
{
|
|
1756
1778
|
style: {
|
|
1757
1779
|
width: 10
|
|
1758
1780
|
}
|
|
1759
1781
|
}
|
|
1760
1782
|
),
|
|
1761
|
-
/* @__PURE__ */ jsx(
|
|
1783
|
+
/* @__PURE__ */ jsx(_t, { children: /* @__PURE__ */ jsx(ScrollArea, { h: "100%", children: /* @__PURE__ */ jsx("div", { className: svgContainer, dangerouslySetInnerHTML: { __html: dotSvg } }) }) })
|
|
1762
1784
|
] }),
|
|
1763
1785
|
/* @__PURE__ */ jsx(
|
|
1764
|
-
Box,
|
|
1786
|
+
Box$1,
|
|
1765
1787
|
{
|
|
1766
1788
|
pos: "fixed",
|
|
1767
1789
|
top: 14,
|
|
@@ -1782,9 +1804,9 @@ const Route$2 = createFileRoute("/_single/view/$viewId/d2")({
|
|
|
1782
1804
|
component: ViewAsD2,
|
|
1783
1805
|
staleTime: 1 / 0,
|
|
1784
1806
|
loader: async ({ context, params }) => {
|
|
1785
|
-
const
|
|
1807
|
+
const projectId2 = context.projectId, { viewId } = params, { loadD2Sources } = await import("likec4:d2");
|
|
1786
1808
|
try {
|
|
1787
|
-
const { d2Source } = await loadD2Sources(
|
|
1809
|
+
const { d2Source } = await loadD2Sources(projectId2);
|
|
1788
1810
|
return {
|
|
1789
1811
|
source: d2Source(viewId)
|
|
1790
1812
|
};
|
|
@@ -1809,52 +1831,59 @@ const Route$2 = createFileRoute("/_single/view/$viewId/d2")({
|
|
|
1809
1831
|
function ViewAsD2() {
|
|
1810
1832
|
const { source } = Route$2.useLoaderData(), [krokiSvg, { execute }] = useAsync(fetchFromKroki, null);
|
|
1811
1833
|
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
1812
|
-
/* @__PURE__ */ jsxs(
|
|
1813
|
-
|
|
1814
|
-
|
|
1815
|
-
|
|
1816
|
-
|
|
1817
|
-
|
|
1818
|
-
|
|
1819
|
-
|
|
1820
|
-
|
|
1834
|
+
/* @__PURE__ */ jsxs(
|
|
1835
|
+
Gt,
|
|
1836
|
+
{
|
|
1837
|
+
className: viewWithTopPadding,
|
|
1838
|
+
orientation: "horizontal",
|
|
1839
|
+
children: [
|
|
1840
|
+
/* @__PURE__ */ jsx(_t, { children: /* @__PURE__ */ jsxs(
|
|
1841
|
+
ScrollArea,
|
|
1842
|
+
{
|
|
1843
|
+
className: cssScrollArea,
|
|
1844
|
+
p: 5,
|
|
1845
|
+
styles: {
|
|
1846
|
+
viewport: {
|
|
1847
|
+
borderRadius: 6
|
|
1848
|
+
}
|
|
1849
|
+
},
|
|
1850
|
+
children: [
|
|
1851
|
+
/* @__PURE__ */ jsx(Code, { block: !0, className: cssCodeBlock, children: source }),
|
|
1852
|
+
/* @__PURE__ */ jsx(CopyToClipboard, { text: source })
|
|
1853
|
+
]
|
|
1821
1854
|
}
|
|
1822
|
-
},
|
|
1823
|
-
children: [
|
|
1824
|
-
/* @__PURE__ */ jsx(Code, { block: !0, className: cssCodeBlock, children: source }),
|
|
1825
|
-
/* @__PURE__ */ jsx(CopyToClipboard, { text: source })
|
|
1826
|
-
]
|
|
1827
|
-
}
|
|
1828
|
-
) }),
|
|
1829
|
-
/* @__PURE__ */ jsx(
|
|
1830
|
-
PanelResizeHandle,
|
|
1831
|
-
{
|
|
1832
|
-
style: {
|
|
1833
|
-
width: 10
|
|
1834
|
-
}
|
|
1835
|
-
}
|
|
1836
|
-
),
|
|
1837
|
-
/* @__PURE__ */ jsx(Panel, { children: /* @__PURE__ */ jsxs(ScrollArea, { h: "100%", children: [
|
|
1838
|
-
krokiSvg.status !== "success" && /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
1855
|
+
) }),
|
|
1839
1856
|
/* @__PURE__ */ jsx(
|
|
1840
|
-
|
|
1857
|
+
$t,
|
|
1841
1858
|
{
|
|
1842
|
-
|
|
1843
|
-
|
|
1844
|
-
|
|
1845
|
-
onClick: () => {
|
|
1846
|
-
execute(source);
|
|
1847
|
-
},
|
|
1848
|
-
children: krokiSvg.status === "loading" ? "Loading..." : "Render with Kroki"
|
|
1859
|
+
style: {
|
|
1860
|
+
width: 10
|
|
1861
|
+
}
|
|
1849
1862
|
}
|
|
1850
1863
|
),
|
|
1851
|
-
|
|
1852
|
-
|
|
1853
|
-
|
|
1854
|
-
|
|
1855
|
-
|
|
1864
|
+
/* @__PURE__ */ jsx(_t, { children: /* @__PURE__ */ jsxs(ScrollArea, { h: "100%", children: [
|
|
1865
|
+
krokiSvg.status !== "success" && /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
1866
|
+
/* @__PURE__ */ jsx(
|
|
1867
|
+
Button,
|
|
1868
|
+
{
|
|
1869
|
+
mt: "xs",
|
|
1870
|
+
variant: "light",
|
|
1871
|
+
disabled: krokiSvg.status === "loading",
|
|
1872
|
+
onClick: () => {
|
|
1873
|
+
execute(source);
|
|
1874
|
+
},
|
|
1875
|
+
children: krokiSvg.status === "loading" ? "Loading..." : "Render with Kroki"
|
|
1876
|
+
}
|
|
1877
|
+
),
|
|
1878
|
+
krokiSvg.status === "error" && /* @__PURE__ */ jsx(Box$1, { children: krokiSvg.error?.message })
|
|
1879
|
+
] }),
|
|
1880
|
+
krokiSvg.status === "success" && /* @__PURE__ */ jsx(Box$1, { className: svgContainer, children: krokiSvg.result ? /* @__PURE__ */ jsx("div", { dangerouslySetInnerHTML: { __html: krokiSvg.result } }) : /* @__PURE__ */ jsx(Box$1, { children: "Empty result" }) })
|
|
1881
|
+
] }) })
|
|
1882
|
+
]
|
|
1883
|
+
}
|
|
1884
|
+
),
|
|
1856
1885
|
/* @__PURE__ */ jsx(
|
|
1857
|
-
Box,
|
|
1886
|
+
Box$1,
|
|
1858
1887
|
{
|
|
1859
1888
|
pos: "fixed",
|
|
1860
1889
|
top: 14,
|
|
@@ -1992,10 +2021,11 @@ const Route$1 = createFileRoute("/project/$projectId/view/$viewId/")({
|
|
|
1992
2021
|
SingleRouteRoute: SingleRouteRouteWithChildren,
|
|
1993
2022
|
ProjectsRoute,
|
|
1994
2023
|
ProjectProjectIdRouteRoute: ProjectProjectIdRouteRouteWithChildren
|
|
1995
|
-
}, routeTree = Route$l._addFileChildren(rootRouteChildren)._addFileTypes(), router = createRouter({
|
|
2024
|
+
}, routeTree = Route$l._addFileChildren(rootRouteChildren)._addFileTypes(), projectId = "default", router = createRouter({
|
|
1996
2025
|
routeTree,
|
|
1997
2026
|
context: {
|
|
1998
|
-
projectId
|
|
2027
|
+
projectId,
|
|
2028
|
+
projects: [projectId]
|
|
1999
2029
|
},
|
|
2000
2030
|
basepath,
|
|
2001
2031
|
trailingSlash: "always",
|