likec4 1.51.0 → 1.53.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 +1 -1
- package/__app__/src/likec4.js +295 -190
- package/__app__/src/routes/index.js +11 -2
- package/__app__/src/routes/projects.js +1 -1
- package/__app__/src/routes/single.js +460 -81
- package/__app__/src/style.css +1 -1
- package/__app__/src/vendors.js +2206 -1685
- package/__app__/src/webcomponent.js +1 -1
- package/config/schema.json +57 -1
- package/dist/THIRD-PARTY-LICENSES.md +32 -226
- package/dist/_chunks/filesystem.mjs +71 -70
- package/dist/_chunks/index.d.mts +10 -1
- package/dist/_chunks/index2.d.mts +112 -8
- package/dist/_chunks/libs/@hono/mcp.mjs +9 -9
- package/dist/_chunks/libs/@hono/node-server.mjs +1 -1
- package/dist/_chunks/libs/@logtape/logtape.d.mts +1021 -0
- package/dist/_chunks/libs/@logtape/logtape.mjs +4 -6
- package/dist/_chunks/libs/@modelcontextprotocol/sdk.d.mts +14 -14
- package/dist/_chunks/libs/@nanostores/react.d.mts +5 -5
- package/dist/_chunks/libs/destr.mjs +1 -0
- package/dist/_chunks/libs/fast-equals.mjs +1 -1
- package/dist/_chunks/libs/langium.mjs +1 -1
- package/dist/_chunks/libs/remeda.mjs +2 -2
- package/dist/_chunks/libs/tinyrainbow.mjs +1 -1
- package/dist/_chunks/libs/unstorage.mjs +1 -0
- package/dist/_chunks/node.mjs +1 -0
- package/dist/_chunks/sequence.mjs +1 -1
- package/dist/_chunks/src.mjs +14 -12
- package/dist/_chunks/src2.mjs +46 -46
- package/dist/cli/index.mjs +164 -83
- package/dist/index.d.mts +47 -819
- package/dist/index.mjs +1 -1
- package/dist/vite-plugin/index.mjs +1 -1
- package/dist/vite-plugin/internal.mjs +1 -1
- package/package.json +38 -37
- package/react/index.d.mts +80 -22
- package/react/index.mjs +692 -465
- package/vite-plugin-modules.d.ts +5 -0
- package/dist/_chunks/LikeC4.mjs +0 -1
- package/dist/_chunks/libs/@msgpack/msgpack.mjs +0 -1
- package/dist/_chunks/libs/@smithy/is-array-buffer.mjs +0 -1
- package/dist/_chunks/libs/@smithy/util-base64.mjs +0 -1
- package/dist/_chunks/libs/boxen.d.mts +0 -1
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
import { jsx, jsxs, Fragment } from "react/jsx-runtime";
|
|
2
|
-
import { d8 as useRouter, d9 as useParams, da as isNotFound, db as Container, br as Alert, U as Text, dc as Code, W as Button, dd as e, de as e$1, as as e$2, bt as Group, bh as rem, df as Link, bZ as Title, d1 as createFileRoute, Q as m, d0 as Outlet, d as deepEqual, s as shallowEqual,
|
|
2
|
+
import { d8 as useRouter, d9 as useParams, da as isNotFound, db as Container, br as Alert, U as Text, dc as Code, W as Button, dd as e, de as e$1, as as e$2, bt as Group, bh as rem, df as Link, bZ as Title, d1 as createFileRoute, Q as m, d0 as Outlet, k as useMantineColorScheme, dg as useComputedColorScheme, cY as useNavigate, aA as ActionIcon, c9 as useHotkeys, aI as AnimatePresence, d as deepEqual, s as shallowEqual, dh as useMatches, di as useIsomorphicLayoutEffect, a9 as r, dj as onMount, v as useStore$1, r as atom, bq as useTree, bs as Tree, b6 as HoverCard, b7 as HoverCardTarget, b8 as HoverCardDropdown, R as ThemeIcon, ch as useLocalStorage, dk as Drawer, bP as ScrollArea, S as SegmentedControl, d3 as useDocumentTitle, dl as Burger, dm as SimpleGrid, dn as useInViewport, dp as e$3, ci as Card, aQ as Box$1, d2 as redirect, aF as MotionDiv, cN as isValidMotionProp, aD as Menu, bc as MenuTarget, bd as MenuDropdown, be as MenuItem, dq as MenuDivider, bp as Stack, b5 as CopyButton$1, dr as Select, ds as ModalRoot, dt as ModalOverlay, du as ModalContent, dv as ModalBody, bL as Tabs, bM as TabsList, bN as TabsTab, bO as TabsPanel, dw as useMantineTheme, dx as useMediaQuery, cq as useDisclosure, aG as Divider, dy as MenuLabel, dz as useSearch, dA as LoadingOverlay, dB as toBlob, c$ as stripSearchParams, cZ as z, bS as useCallbackRef, aL as useIsMounted, T as Tooltip, dC as useAsync, dD as Ut, dE as qt, dF as Zt, dG as notFound } from "../vendors.js";
|
|
3
3
|
import { loadModel } from "likec4:model";
|
|
4
|
-
import { c as css, s as styled, I as IconRendererProvider, a as LikeC4ModelProvider, u as useUpdateEffect,
|
|
4
|
+
import { c as css, s as styled, I as IconRendererProvider, a as LikeC4ModelProvider, b as IconMoonStars, d as IconSun, n as normalizeSearch, S as SearchContext, e as SearchControl, F as FramerMotionConfig, O as Overlay, f as bodyCss, g as dialogCss, h as SearchPanelContent, u as useUpdateEffect, i as useLikeC4Model, j as StaticLikeC4Diagram, B as Box, k as IconStarFilled, l as IconStack2, m as IconLayoutDashboard, o as IconFileCode, p as IconFolderOpen, q as IconFolderFilled, r as IconArrowLeft, N as NavigationPanel$1, M as Markdown, t as LikeC4AdHocViewEditor, v as createStyleContext, w as navigationPanel, x as isCssProperty, y as useLikeC4Projects$1, z as IconChevronDown, A as IconAlertTriangle, C as IconCheck, D as IconCopy, E as IconExternalLink, G as IconShare, H as pickViewBounds, J as LikeC4Diagram, K as useDiagramContext, P as useDiagram, Q as useOnDiagramEvent, R as LikeC4EditorProvider } from "../likec4.js";
|
|
5
5
|
import { getProjectIcons } from "likec4:icons";
|
|
6
|
-
import { useMemo, createContext, useContext,
|
|
6
|
+
import { useMemo, createContext, useContext, useRef, useEffect, useState, useCallback, memo } from "react";
|
|
7
7
|
import { useStore } from "likec4/vite-plugin/internal";
|
|
8
8
|
import { RichText } from "@likec4/core/types";
|
|
9
|
+
import { nonexhaustive, compareNatural } from "@likec4/core/utils";
|
|
9
10
|
import { pageTitle, ComponentName, useHashHistory, isDevelopment, krokiPumlSvgUrl, krokiD2SvgUrl } from "../const.js";
|
|
10
11
|
import { likec4rpc, isRpcAvailable } from "likec4:rpc";
|
|
11
12
|
import { R as Route$c, r as resolveForceColorScheme } from "./index.js";
|
|
@@ -198,6 +199,95 @@ function RouteComponent$1() {
|
|
|
198
199
|
const { $likec4model, projectId } = Route$b.useLoaderData();
|
|
199
200
|
return /* @__PURE__ */ jsx(ViewOutlet, { children: /* @__PURE__ */ jsx(m, { FallbackComponent: Fallback, children: /* @__PURE__ */ jsx(LikeC4IconRendererContext, { projectId, children: /* @__PURE__ */ jsx(LikeC4ModelContext, { likec4model: $likec4model, children: /* @__PURE__ */ jsx(Outlet, {}) }) }) }) });
|
|
200
201
|
}
|
|
202
|
+
function ColorSchemeToggle() {
|
|
203
|
+
const { setColorScheme } = useMantineColorScheme({
|
|
204
|
+
keepTransitions: !0
|
|
205
|
+
}), computedColorScheme = useComputedColorScheme("light"), navigate = useNavigate(), { theme: urlTheme } = Route$c.useSearch(), isForced = resolveForceColorScheme(urlTheme) != null, pendingScheme = useRef(null);
|
|
206
|
+
return useEffect(() => {
|
|
207
|
+
pendingScheme.current != null && !isForced && (setColorScheme(pendingScheme.current), pendingScheme.current = null);
|
|
208
|
+
}, [isForced, setColorScheme]), /* @__PURE__ */ jsxs(
|
|
209
|
+
ActionIcon,
|
|
210
|
+
{
|
|
211
|
+
size: "md",
|
|
212
|
+
variant: "subtle",
|
|
213
|
+
color: "gray",
|
|
214
|
+
onClick: () => {
|
|
215
|
+
if (pendingScheme.current != null) return;
|
|
216
|
+
const next = computedColorScheme === "light" ? "dark" : "light";
|
|
217
|
+
isForced ? (pendingScheme.current = next, navigate({
|
|
218
|
+
from: Route$c.fullPath,
|
|
219
|
+
search: (prev) => ({ ...prev, theme: void 0 }),
|
|
220
|
+
replace: !0
|
|
221
|
+
}).catch(() => {
|
|
222
|
+
pendingScheme.current = null;
|
|
223
|
+
})) : setColorScheme(next);
|
|
224
|
+
},
|
|
225
|
+
"aria-label": "Toggle color scheme",
|
|
226
|
+
children: [
|
|
227
|
+
/* @__PURE__ */ jsx(IconMoonStars, { stroke: 1.5, display: computedColorScheme === "light" ? "block" : "none" }),
|
|
228
|
+
/* @__PURE__ */ jsx(IconSun, { stroke: 1.5, display: computedColorScheme === "dark" ? "block" : "none" })
|
|
229
|
+
]
|
|
230
|
+
}
|
|
231
|
+
);
|
|
232
|
+
}
|
|
233
|
+
function OverviewSearchAdapter({
|
|
234
|
+
onClose,
|
|
235
|
+
children
|
|
236
|
+
}) {
|
|
237
|
+
const [searchValue, setSearchValue] = useState(""), [pickViewFor, setPickViewFor] = useState(null), navigate = useNavigate(), navigateTo = useCallback((viewId, focusOnElement) => {
|
|
238
|
+
onClose(), navigate({
|
|
239
|
+
to: "/view/$viewId/",
|
|
240
|
+
params: { viewId },
|
|
241
|
+
search: (prev) => ({
|
|
242
|
+
...prev,
|
|
243
|
+
...focusOnElement && { focusOnElement }
|
|
244
|
+
})
|
|
245
|
+
});
|
|
246
|
+
}, [navigate, onClose]), openPickView = useCallback((elementFqn) => {
|
|
247
|
+
setPickViewFor(elementFqn);
|
|
248
|
+
}, []), closePickView = useCallback(() => {
|
|
249
|
+
setPickViewFor(null);
|
|
250
|
+
}, []), value = useMemo(() => ({
|
|
251
|
+
searchValue,
|
|
252
|
+
setSearchValue,
|
|
253
|
+
normalizedSearch: normalizeSearch(searchValue),
|
|
254
|
+
navigateTo,
|
|
255
|
+
openPickView,
|
|
256
|
+
closePickView,
|
|
257
|
+
pickViewFor,
|
|
258
|
+
close: onClose,
|
|
259
|
+
currentViewId: null,
|
|
260
|
+
openedWithSearch: null
|
|
261
|
+
}), [searchValue, pickViewFor, navigateTo, openPickView, closePickView, onClose]);
|
|
262
|
+
return /* @__PURE__ */ jsx(SearchContext.Provider, { value, children });
|
|
263
|
+
}
|
|
264
|
+
const OverviewSearch = memo(() => {
|
|
265
|
+
const [isOpened, setIsOpened] = useState(!1), open = useCallback(() => setIsOpened(!0), []), close = useCallback(() => setIsOpened(!1), []);
|
|
266
|
+
return useHotkeys([
|
|
267
|
+
["mod+k", open, { preventDefault: !0 }]
|
|
268
|
+
]), /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
269
|
+
/* @__PURE__ */ jsx(SearchControl, { onClick: open }),
|
|
270
|
+
/* @__PURE__ */ jsx(FramerMotionConfig, { children: /* @__PURE__ */ jsx(AnimatePresence, { children: isOpened && /* @__PURE__ */ jsx(
|
|
271
|
+
Overlay,
|
|
272
|
+
{
|
|
273
|
+
fullscreen: !0,
|
|
274
|
+
withBackdrop: !1,
|
|
275
|
+
backdrop: {
|
|
276
|
+
opacity: 0.9
|
|
277
|
+
},
|
|
278
|
+
classes: {
|
|
279
|
+
dialog: dialogCss,
|
|
280
|
+
body: bodyCss
|
|
281
|
+
},
|
|
282
|
+
openDelay: 0,
|
|
283
|
+
onClose: close,
|
|
284
|
+
"data-likec4-search": "true",
|
|
285
|
+
children: /* @__PURE__ */ jsx(OverviewSearchAdapter, { onClose: close, children: /* @__PURE__ */ jsx(SearchPanelContent, {}) })
|
|
286
|
+
}
|
|
287
|
+
) }) })
|
|
288
|
+
] });
|
|
289
|
+
});
|
|
290
|
+
OverviewSearch.displayName = "OverviewSearch";
|
|
201
291
|
function useTransparentBackground(enabled = !0) {
|
|
202
292
|
useIsomorphicLayoutEffect(() => {
|
|
203
293
|
const htmlEl = document.body.parentElement;
|
|
@@ -248,6 +338,263 @@ function useCurrentProject() {
|
|
|
248
338
|
});
|
|
249
339
|
return projects.find((p) => p.id === projectId) ?? projects[0];
|
|
250
340
|
}
|
|
341
|
+
const isTreeNodeData = (node) => "type" in node && ["file", "folder", "view", "deployment-view"].includes(node.type);
|
|
342
|
+
function dropFilename(relativePath) {
|
|
343
|
+
return relativePath === "" ? "" : relativePath.split("/").slice(0, -1).join("/");
|
|
344
|
+
}
|
|
345
|
+
function compareTreeNodes(a, b) {
|
|
346
|
+
return a.children.length === 0 && b.children.length > 0 ? 1 : a.children.length > 0 && b.children.length === 0 ? -1 : compareNatural(a.label, b.label);
|
|
347
|
+
}
|
|
348
|
+
function buildDiagramTreeData(views, groupBy) {
|
|
349
|
+
const root2 = {
|
|
350
|
+
value: "",
|
|
351
|
+
label: "Diagrams",
|
|
352
|
+
type: "folder",
|
|
353
|
+
children: []
|
|
354
|
+
}, findParent = (path) => {
|
|
355
|
+
let parent = root2;
|
|
356
|
+
if (path === "")
|
|
357
|
+
return parent;
|
|
358
|
+
const segments = path.split("/"), traversed = ["@fs"];
|
|
359
|
+
for (; segments.length; ) {
|
|
360
|
+
const label = segments.shift();
|
|
361
|
+
traversed.push(label);
|
|
362
|
+
const value = traversed.join("/");
|
|
363
|
+
let node = r(parent.children, (n) => n.value === value);
|
|
364
|
+
node || (node = { label, value, type: "folder", children: [] }, parent.children.push(node)), parent = node;
|
|
365
|
+
}
|
|
366
|
+
return parent;
|
|
367
|
+
};
|
|
368
|
+
for (const view of views) {
|
|
369
|
+
let relativePath;
|
|
370
|
+
switch (groupBy) {
|
|
371
|
+
case "by-files":
|
|
372
|
+
relativePath = view.$view.sourcePath ?? "";
|
|
373
|
+
break;
|
|
374
|
+
case "by-folders":
|
|
375
|
+
relativePath = dropFilename(view.$view.sourcePath ?? "");
|
|
376
|
+
break;
|
|
377
|
+
case "none":
|
|
378
|
+
relativePath = "";
|
|
379
|
+
break;
|
|
380
|
+
default:
|
|
381
|
+
nonexhaustive(groupBy);
|
|
382
|
+
}
|
|
383
|
+
const parent = findParent(relativePath);
|
|
384
|
+
parent.children.push({
|
|
385
|
+
value: view.id,
|
|
386
|
+
label: view.title ?? view.id,
|
|
387
|
+
type: view.isDeploymentView() ? "deployment-view" : "view",
|
|
388
|
+
children: []
|
|
389
|
+
}), parent !== root2 && (parent.children.sort(compareTreeNodes), groupBy === "by-files" && parent.type !== "file" && (parent.type = "file"));
|
|
390
|
+
}
|
|
391
|
+
return root2.children.sort(compareTreeNodes);
|
|
392
|
+
}
|
|
393
|
+
function useDiagramsTreeData(groupBy = "by-files") {
|
|
394
|
+
const model = useLikeC4Model();
|
|
395
|
+
return useMemo(() => buildDiagramTreeData([...model.views()], groupBy), [model, groupBy]);
|
|
396
|
+
}
|
|
397
|
+
const drawerOpenedAtom = atom(!1);
|
|
398
|
+
onMount(drawerOpenedAtom, () => {
|
|
399
|
+
drawerOpenedAtom.set(!1);
|
|
400
|
+
});
|
|
401
|
+
const useDrawerOpened = () => useStore$1(drawerOpenedAtom), SidebarDrawerOps = {
|
|
402
|
+
open: () => drawerOpenedAtom.set(!0),
|
|
403
|
+
close: () => drawerOpenedAtom.set(!1)
|
|
404
|
+
}, isFile = (node) => isTreeNodeData(node) && node.type === "file", FolderIcon = ({ node, expanded }) => isFile(node) ? /* @__PURE__ */ jsx(ThemeIcon, { size: "sm", variant: "transparent", color: "indigo", children: /* @__PURE__ */ jsx(IconFileCode, { size: 16 }) }) : /* @__PURE__ */ jsx(ThemeIcon, { size: "sm", variant: "transparent", color: "violet", children: expanded ? /* @__PURE__ */ jsx(IconFolderOpen, { size: 16 }) : /* @__PURE__ */ jsx(IconFolderFilled, { size: 16 }) }), setHoveredNode = () => {
|
|
405
|
+
}, DiagramsTree = /* @__PURE__ */ memo(({ groupBy }) => {
|
|
406
|
+
const views = useLikeC4Views(), data = useDiagramsTreeData(groupBy), navigate = useNavigate(), navigateTo = (viewId2) => {
|
|
407
|
+
SidebarDrawerOps.close(), navigate({
|
|
408
|
+
to: "/view/$viewId/",
|
|
409
|
+
viewTransition: !1,
|
|
410
|
+
params: { viewId: viewId2 }
|
|
411
|
+
});
|
|
412
|
+
}, [diagram] = useCurrentView(), viewId = diagram?.id ?? null, tree = useTree({
|
|
413
|
+
multiple: !1
|
|
414
|
+
});
|
|
415
|
+
tree.setHoveredNode = setHoveredNode;
|
|
416
|
+
const sourcePath = diagram?.sourcePath ?? null;
|
|
417
|
+
useUpdateEffect(() => {
|
|
418
|
+
tree.collapseAllNodes();
|
|
419
|
+
}, [groupBy]), useEffect(() => {
|
|
420
|
+
if (sourcePath) {
|
|
421
|
+
const segments = sourcePath.split("/");
|
|
422
|
+
let path = "@fs";
|
|
423
|
+
for (const segment of segments)
|
|
424
|
+
path += `/${segment}`, tree.expand(path);
|
|
425
|
+
}
|
|
426
|
+
}, [sourcePath, groupBy]), useEffect(() => {
|
|
427
|
+
viewId && tree.select(viewId);
|
|
428
|
+
}, [viewId]);
|
|
429
|
+
const theme = useComputedColorScheme();
|
|
430
|
+
return /* @__PURE__ */ jsx(Box, { children: /* @__PURE__ */ jsx(
|
|
431
|
+
Tree,
|
|
432
|
+
{
|
|
433
|
+
allowRangeSelection: !1,
|
|
434
|
+
tree,
|
|
435
|
+
data,
|
|
436
|
+
styles: {
|
|
437
|
+
node: {
|
|
438
|
+
marginTop: 2,
|
|
439
|
+
marginBottom: 2
|
|
440
|
+
}
|
|
441
|
+
},
|
|
442
|
+
levelOffset: "md",
|
|
443
|
+
renderNode: ({ node, selected, expanded, elementProps, hasChildren }) => /* @__PURE__ */ jsx(DiagramPreviewHoverCard, { diagram: hasChildren ? void 0 : views.find((v) => v.id === node.value), children: /* @__PURE__ */ jsx(
|
|
444
|
+
Button,
|
|
445
|
+
{
|
|
446
|
+
fullWidth: !0,
|
|
447
|
+
color: theme === "light" ? "dark" : "gray",
|
|
448
|
+
variant: selected ? "transparent" : "subtle",
|
|
449
|
+
size: "sm",
|
|
450
|
+
fz: "sm",
|
|
451
|
+
fw: hasChildren ? "600" : "500",
|
|
452
|
+
justify: "flex-start",
|
|
453
|
+
styles: {
|
|
454
|
+
section: {
|
|
455
|
+
opacity: 0.5
|
|
456
|
+
}
|
|
457
|
+
},
|
|
458
|
+
leftSection: /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
459
|
+
!hasChildren && node.value === "index" && /* @__PURE__ */ jsx(IconStarFilled, { size: 14, opacity: 0.7 }),
|
|
460
|
+
!hasChildren && node.value !== "index" && isTreeNodeData(node) && /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
461
|
+
node.type === "deployment-view" && /* @__PURE__ */ jsx(IconStack2, { size: 14 }),
|
|
462
|
+
node.type === "view" && /* @__PURE__ */ jsx(IconLayoutDashboard, { size: 14 })
|
|
463
|
+
] }),
|
|
464
|
+
hasChildren && /* @__PURE__ */ jsx(FolderIcon, { node, expanded })
|
|
465
|
+
] }),
|
|
466
|
+
...elementProps,
|
|
467
|
+
...!hasChildren && {
|
|
468
|
+
onClick: (e2) => {
|
|
469
|
+
e2.stopPropagation(), navigateTo(node.value);
|
|
470
|
+
}
|
|
471
|
+
},
|
|
472
|
+
children: node.label
|
|
473
|
+
}
|
|
474
|
+
) })
|
|
475
|
+
}
|
|
476
|
+
) });
|
|
477
|
+
}, (prev, next) => prev.groupBy === next.groupBy);
|
|
478
|
+
function DiagramPreviewHoverCard({ diagram, children }) {
|
|
479
|
+
const ratio = diagram ? Math.max(diagram.bounds.width / 400, diagram.bounds.height / 300) : 1, width = diagram ? Math.round(diagram.bounds.width / ratio) : 0, height = diagram ? Math.round(diagram.bounds.height / ratio) : 0;
|
|
480
|
+
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
481
|
+
diagram && /* @__PURE__ */ jsxs(HoverCard, { position: "right-start", openDelay: 400, closeDelay: 100, keepMounted: !1, shadow: "lg", children: [
|
|
482
|
+
/* @__PURE__ */ jsx(HoverCardTarget, { children }),
|
|
483
|
+
/* @__PURE__ */ jsx(HoverCardDropdown, { style: { width, height }, p: "xs", children: /* @__PURE__ */ jsx(DiagramPreview, { diagram }) })
|
|
484
|
+
] }),
|
|
485
|
+
!diagram && children
|
|
486
|
+
] });
|
|
487
|
+
}
|
|
488
|
+
const DiagramPreview = memo(({ diagram }) => {
|
|
489
|
+
const ratio = Math.max(diagram.bounds.width / 400, diagram.bounds.height / 300), width = Math.round(diagram.bounds.width / ratio), height = Math.round(diagram.bounds.height / ratio);
|
|
490
|
+
return /* @__PURE__ */ jsx(
|
|
491
|
+
StaticLikeC4Diagram,
|
|
492
|
+
{
|
|
493
|
+
view: diagram,
|
|
494
|
+
fitView: !0,
|
|
495
|
+
fitViewPadding: "4px",
|
|
496
|
+
enableElementDetails: !1,
|
|
497
|
+
reduceGraphics: !0,
|
|
498
|
+
initialWidth: width,
|
|
499
|
+
initialHeight: height
|
|
500
|
+
}
|
|
501
|
+
);
|
|
502
|
+
}, (prev, next) => prev.diagram.id === next.diagram.id), SidebarDrawer = memo(() => {
|
|
503
|
+
const opened = useDrawerOpened(), [grouping, setGrouping] = useLocalStorage({
|
|
504
|
+
key: "sidebar-drawer-grouping",
|
|
505
|
+
defaultValue: "by-files"
|
|
506
|
+
}), isSingleProject = useMatches({
|
|
507
|
+
select: (matches) => matches.some((match) => match.routeId === "/_single")
|
|
508
|
+
});
|
|
509
|
+
return /* @__PURE__ */ jsxs(
|
|
510
|
+
Drawer.Root,
|
|
511
|
+
{
|
|
512
|
+
keepMounted: isSingleProject,
|
|
513
|
+
opened,
|
|
514
|
+
scrollAreaComponent: ScrollArea.Autosize,
|
|
515
|
+
onClose: SidebarDrawerOps.close,
|
|
516
|
+
children: [
|
|
517
|
+
/* @__PURE__ */ jsx(Drawer.Overlay, { blur: 2 }),
|
|
518
|
+
/* @__PURE__ */ jsxs(Drawer.Content, { children: [
|
|
519
|
+
/* @__PURE__ */ jsxs(Drawer.Header, { children: [
|
|
520
|
+
/* @__PURE__ */ jsxs(Group, { gap: "xs", children: [
|
|
521
|
+
/* @__PURE__ */ jsx(
|
|
522
|
+
Button,
|
|
523
|
+
{
|
|
524
|
+
component: Link,
|
|
525
|
+
to: "/",
|
|
526
|
+
leftSection: /* @__PURE__ */ jsx(IconArrowLeft, { size: 14 }),
|
|
527
|
+
color: "dimmed",
|
|
528
|
+
variant: "subtle",
|
|
529
|
+
px: rem(5),
|
|
530
|
+
styles: {
|
|
531
|
+
section: {
|
|
532
|
+
marginInlineEnd: 4
|
|
533
|
+
}
|
|
534
|
+
},
|
|
535
|
+
size: "xs",
|
|
536
|
+
children: "Overview"
|
|
537
|
+
}
|
|
538
|
+
),
|
|
539
|
+
/* @__PURE__ */ jsx(
|
|
540
|
+
SegmentedControl,
|
|
541
|
+
{
|
|
542
|
+
size: "xs",
|
|
543
|
+
withItemsBorders: !1,
|
|
544
|
+
value: grouping,
|
|
545
|
+
onChange: setGrouping,
|
|
546
|
+
data: [
|
|
547
|
+
{ label: "By files", value: "by-files" },
|
|
548
|
+
{ label: "By folders", value: "by-folders" },
|
|
549
|
+
{ label: "List", value: "none" }
|
|
550
|
+
]
|
|
551
|
+
}
|
|
552
|
+
),
|
|
553
|
+
/* @__PURE__ */ jsx(
|
|
554
|
+
Button,
|
|
555
|
+
{
|
|
556
|
+
leftSection: /* @__PURE__ */ jsx(IconStarFilled, { size: 12, stroke: 2 }),
|
|
557
|
+
color: "dimmed",
|
|
558
|
+
variant: "subtle",
|
|
559
|
+
px: rem(5),
|
|
560
|
+
styles: {
|
|
561
|
+
section: {
|
|
562
|
+
marginInlineEnd: 4
|
|
563
|
+
}
|
|
564
|
+
},
|
|
565
|
+
size: "xs",
|
|
566
|
+
renderRoot: (props) => /* @__PURE__ */ jsx(
|
|
567
|
+
Link,
|
|
568
|
+
{
|
|
569
|
+
to: "/view/$viewId",
|
|
570
|
+
params: { viewId: "index" },
|
|
571
|
+
...props
|
|
572
|
+
}
|
|
573
|
+
),
|
|
574
|
+
children: "Open index"
|
|
575
|
+
}
|
|
576
|
+
)
|
|
577
|
+
] }),
|
|
578
|
+
/* @__PURE__ */ jsx(Drawer.CloseButton, {})
|
|
579
|
+
] }),
|
|
580
|
+
/* @__PURE__ */ jsx(Drawer.Body, { children: /* @__PURE__ */ jsx(DiagramsTree, { groupBy: grouping }) })
|
|
581
|
+
] })
|
|
582
|
+
]
|
|
583
|
+
}
|
|
584
|
+
);
|
|
585
|
+
});
|
|
586
|
+
function filterLandingPageViews(views, filter) {
|
|
587
|
+
return filter ? "include" in filter ? views.filter((view) => matchesAny(view, filter.include)) : "exclude" in filter ? views.filter((view) => !matchesAny(view, filter.exclude)) : views : views;
|
|
588
|
+
}
|
|
589
|
+
function matchesAny(view, patterns) {
|
|
590
|
+
return patterns.some((pattern) => {
|
|
591
|
+
if (pattern.startsWith("#")) {
|
|
592
|
+
const tag = pattern.slice(1);
|
|
593
|
+
return view.tags?.some((t) => t === tag) ?? !1;
|
|
594
|
+
}
|
|
595
|
+
return view.id === pattern;
|
|
596
|
+
});
|
|
597
|
+
}
|
|
251
598
|
css({
|
|
252
599
|
color: "text.dimmed"
|
|
253
600
|
});
|
|
@@ -281,17 +628,55 @@ const previewBg = css({
|
|
|
281
628
|
});
|
|
282
629
|
function RouteComponent() {
|
|
283
630
|
useDocumentTitle(pageTitle);
|
|
284
|
-
const
|
|
285
|
-
return /* @__PURE__ */
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
631
|
+
const allViews = useLikeC4Views(), { landingPage } = useCurrentProject(), views = filterLandingPageViews(allViews, landingPage);
|
|
632
|
+
return /* @__PURE__ */ jsxs(Container, { size: "xl", children: [
|
|
633
|
+
/* @__PURE__ */ jsx(SidebarDrawer, {}),
|
|
634
|
+
/* @__PURE__ */ jsxs(
|
|
635
|
+
"div",
|
|
636
|
+
{
|
|
637
|
+
className: css({
|
|
638
|
+
containerName: "likec4-root",
|
|
639
|
+
containerType: "inline-size",
|
|
640
|
+
display: "flex",
|
|
641
|
+
alignItems: "flex-start",
|
|
642
|
+
justifyContent: "space-between",
|
|
643
|
+
padding: "xs",
|
|
644
|
+
gap: "xs",
|
|
645
|
+
position: "sticky",
|
|
646
|
+
top: "0",
|
|
647
|
+
zIndex: "10",
|
|
648
|
+
backgroundColor: "likec4.panel.bg/85",
|
|
649
|
+
backdropFilter: "blur(8px)"
|
|
650
|
+
}),
|
|
651
|
+
children: [
|
|
652
|
+
/* @__PURE__ */ jsx(NavigationPanel$1.Root, { css: { position: "relative", width: "max-content", margin: "0" }, children: /* @__PURE__ */ jsxs(NavigationPanel$1.Body, { children: [
|
|
653
|
+
/* @__PURE__ */ jsx("div", { style: { width: 0, height: 36 }, "aria-hidden": !0 }),
|
|
654
|
+
/* @__PURE__ */ jsx(Burger, { size: "sm", onClick: SidebarDrawerOps.open, "aria-label": "Toggle navigation" }),
|
|
655
|
+
/* @__PURE__ */ jsx(
|
|
656
|
+
NavigationPanel$1.Logo,
|
|
657
|
+
{
|
|
658
|
+
css: { flexShrink: 0 },
|
|
659
|
+
onClick: () => window.scrollTo({ top: 0, behavior: "smooth" })
|
|
660
|
+
}
|
|
661
|
+
),
|
|
662
|
+
/* @__PURE__ */ jsx(OverviewSearch, {})
|
|
663
|
+
] }) }),
|
|
664
|
+
/* @__PURE__ */ jsx(NavigationPanel$1.Root, { panelPosition: "right", css: { position: "relative", margin: "0" }, children: /* @__PURE__ */ jsx(NavigationPanel$1.Body, { children: /* @__PURE__ */ jsx("div", { style: { display: "flex", alignItems: "center", minHeight: 36 }, children: /* @__PURE__ */ jsx(ColorSchemeToggle, {}) }) }) })
|
|
665
|
+
]
|
|
666
|
+
}
|
|
667
|
+
),
|
|
668
|
+
/* @__PURE__ */ jsx(
|
|
669
|
+
SimpleGrid,
|
|
670
|
+
{
|
|
671
|
+
p: { base: "md", sm: "md" },
|
|
672
|
+
pt: { base: "sm", sm: "sm" },
|
|
673
|
+
cols: { base: 1, sm: 2, md: 3, xl: 4 },
|
|
674
|
+
spacing: { base: 10, sm: "xl" },
|
|
675
|
+
verticalSpacing: { base: "md", sm: "xl" },
|
|
676
|
+
children: views.map((v) => /* @__PURE__ */ jsx(ViewCard, { view: v }, v.id))
|
|
677
|
+
}
|
|
678
|
+
)
|
|
679
|
+
] });
|
|
295
680
|
}
|
|
296
681
|
function ViewCard({ view }) {
|
|
297
682
|
const [visible, setVisible] = useState(!1), { ref, inViewport } = useInViewport();
|
|
@@ -309,7 +694,7 @@ function ViewCard({ view }) {
|
|
|
309
694
|
className: "group",
|
|
310
695
|
withBorder: !0,
|
|
311
696
|
children: [
|
|
312
|
-
/* @__PURE__ */ jsx(Card.Section, { children: /* @__PURE__ */ jsx(Box, { className: previewBg, style: { height: 200 }, children: visible && /* @__PURE__ */ jsx(
|
|
697
|
+
/* @__PURE__ */ jsx(Card.Section, { children: /* @__PURE__ */ jsx(Box$1, { className: previewBg, style: { height: 200 }, children: visible && /* @__PURE__ */ jsx(
|
|
313
698
|
StaticLikeC4Diagram,
|
|
314
699
|
{
|
|
315
700
|
background: "transparent",
|
|
@@ -410,7 +795,7 @@ function WebcomponentPage() {
|
|
|
410
795
|
</html>
|
|
411
796
|
`;
|
|
412
797
|
return /* @__PURE__ */ jsx(
|
|
413
|
-
Box
|
|
798
|
+
Box,
|
|
414
799
|
{
|
|
415
800
|
css: {
|
|
416
801
|
position: "fixed",
|
|
@@ -436,38 +821,6 @@ function WebcomponentPage() {
|
|
|
436
821
|
}
|
|
437
822
|
);
|
|
438
823
|
}
|
|
439
|
-
function ColorSchemeToggle() {
|
|
440
|
-
const { setColorScheme } = useMantineColorScheme({
|
|
441
|
-
keepTransitions: !0
|
|
442
|
-
}), computedColorScheme = useComputedColorScheme("light"), navigate = useNavigate(), { theme: urlTheme } = Route$c.useSearch(), isForced = resolveForceColorScheme(urlTheme) != null, pendingScheme = useRef(null);
|
|
443
|
-
return useEffect(() => {
|
|
444
|
-
pendingScheme.current != null && !isForced && (setColorScheme(pendingScheme.current), pendingScheme.current = null);
|
|
445
|
-
}, [isForced, setColorScheme]), /* @__PURE__ */ jsxs(
|
|
446
|
-
ActionIcon,
|
|
447
|
-
{
|
|
448
|
-
visibleFrom: "sm",
|
|
449
|
-
size: "md",
|
|
450
|
-
variant: "subtle",
|
|
451
|
-
color: "gray",
|
|
452
|
-
onClick: () => {
|
|
453
|
-
if (pendingScheme.current != null) return;
|
|
454
|
-
const next = computedColorScheme === "light" ? "dark" : "light";
|
|
455
|
-
isForced ? (pendingScheme.current = next, navigate({
|
|
456
|
-
from: Route$c.fullPath,
|
|
457
|
-
search: (prev) => ({ ...prev, theme: void 0 }),
|
|
458
|
-
replace: !0
|
|
459
|
-
}).catch(() => {
|
|
460
|
-
pendingScheme.current = null;
|
|
461
|
-
})) : setColorScheme(next);
|
|
462
|
-
},
|
|
463
|
-
"aria-label": "Toggle color scheme",
|
|
464
|
-
children: [
|
|
465
|
-
/* @__PURE__ */ jsx(IconMoonStars, { stroke: 1.5, display: computedColorScheme === "light" ? "block" : "none" }),
|
|
466
|
-
/* @__PURE__ */ jsx(IconSun, { stroke: 1.5, display: computedColorScheme === "dark" ? "block" : "none" })
|
|
467
|
-
]
|
|
468
|
-
}
|
|
469
|
-
);
|
|
470
|
-
}
|
|
471
824
|
const { withProvider, withContext } = createStyleContext(navigationPanel), shouldForwardProp = (prop, variantKeys) => !variantKeys.includes(prop) && (isValidMotionProp(prop) || !isCssProperty(prop)), Root = withProvider(MotionDiv, "root", {
|
|
472
825
|
shouldForwardProp
|
|
473
826
|
}), Body = withContext(MotionDiv, "body", {
|
|
@@ -573,10 +926,10 @@ const AlertLocalhost = () => /* @__PURE__ */ jsx(
|
|
|
573
926
|
`.trim();
|
|
574
927
|
return /* @__PURE__ */ jsxs(Stack, { children: [
|
|
575
928
|
code.includes("http://localhost") && /* @__PURE__ */ jsx(AlertLocalhost, {}),
|
|
576
|
-
/* @__PURE__ */ jsx(Box, { children: /* @__PURE__ */ jsx(Text, { size: "sm", children: "Embedded view is an iframe with a static diagram" }) }),
|
|
929
|
+
/* @__PURE__ */ jsx(Box$1, { children: /* @__PURE__ */ jsx(Text, { size: "sm", children: "Embedded view is an iframe with a static diagram" }) }),
|
|
577
930
|
/* @__PURE__ */ jsxs(Stack, { gap: "xs", children: [
|
|
578
931
|
/* @__PURE__ */ jsxs(Group, { justify: "space-between", children: [
|
|
579
|
-
/* @__PURE__ */ jsx(Box, { children: /* @__PURE__ */ jsx(Text, { fw: "500", size: "sm", children: "HTML" }) }),
|
|
932
|
+
/* @__PURE__ */ jsx(Box$1, { children: /* @__PURE__ */ jsx(Text, { fw: "500", size: "sm", children: "HTML" }) }),
|
|
580
933
|
/* @__PURE__ */ jsxs(Group, { gap: "xs", children: [
|
|
581
934
|
/* @__PURE__ */ jsx(ActionIcon, { component: "a", href, target: "_blank", variant: "light", color: "gray", children: /* @__PURE__ */ jsx(IconExternalLink, {}) }),
|
|
582
935
|
/* @__PURE__ */ jsx(CopyButton$1, { value: code, timeout: 1500, children: CopyButtonChild })
|
|
@@ -584,7 +937,7 @@ const AlertLocalhost = () => /* @__PURE__ */ jsx(
|
|
|
584
937
|
] }),
|
|
585
938
|
/* @__PURE__ */ jsx(Code, { block: !0, children: code }),
|
|
586
939
|
/* @__PURE__ */ jsx(
|
|
587
|
-
Box,
|
|
940
|
+
Box$1,
|
|
588
941
|
{
|
|
589
942
|
style: {
|
|
590
943
|
alignSelf: "flex-start"
|
|
@@ -632,10 +985,10 @@ function WebcomponentsPanel({ diagram }) {
|
|
|
632
985
|
);
|
|
633
986
|
return /* @__PURE__ */ jsxs(Stack, { children: [
|
|
634
987
|
jscode.includes("http://localhost") && /* @__PURE__ */ jsx(AlertLocalhost, {}),
|
|
635
|
-
/* @__PURE__ */ jsx(Box, { children: /* @__PURE__ */ jsx(Text, { size: "sm", children: "Add this script to your page:" }) }),
|
|
988
|
+
/* @__PURE__ */ jsx(Box$1, { children: /* @__PURE__ */ jsx(Text, { size: "sm", children: "Add this script to your page:" }) }),
|
|
636
989
|
/* @__PURE__ */ jsxs(Stack, { gap: "xs", children: [
|
|
637
990
|
/* @__PURE__ */ jsxs(Group, { justify: "space-between", children: [
|
|
638
|
-
/* @__PURE__ */ jsx(Box, { children: /* @__PURE__ */ jsx(Text, { fw: "500", size: "sm", children: "JavaScript" }) }),
|
|
991
|
+
/* @__PURE__ */ jsx(Box$1, { children: /* @__PURE__ */ jsx(Text, { fw: "500", size: "sm", children: "JavaScript" }) }),
|
|
639
992
|
/* @__PURE__ */ jsxs(Group, { gap: "xs", children: [
|
|
640
993
|
/* @__PURE__ */ jsx(ActionIcon, { component: "a", href: webcomponentPreview.href, target: "_blank", variant: "light", color: "gray", children: /* @__PURE__ */ jsx(IconExternalLink, {}) }),
|
|
641
994
|
/* @__PURE__ */ jsx(
|
|
@@ -649,7 +1002,7 @@ function WebcomponentsPanel({ diagram }) {
|
|
|
649
1002
|
] })
|
|
650
1003
|
] }),
|
|
651
1004
|
/* @__PURE__ */ jsx(Code, { block: !0, children: jscode }),
|
|
652
|
-
/* @__PURE__ */ jsx(Box, { children: /* @__PURE__ */ jsxs(Text, { size: "sm", c: "dimmed", children: [
|
|
1005
|
+
/* @__PURE__ */ jsx(Box$1, { children: /* @__PURE__ */ jsxs(Text, { size: "sm", c: "dimmed", children: [
|
|
653
1006
|
"This script defines a custom element (webcomponent) that renders your diagrams.",
|
|
654
1007
|
/* @__PURE__ */ jsx("br", {}),
|
|
655
1008
|
"Script must be inserted once in the ",
|
|
@@ -662,8 +1015,8 @@ function WebcomponentsPanel({ diagram }) {
|
|
|
662
1015
|
] }),
|
|
663
1016
|
/* @__PURE__ */ jsxs(Stack, { gap: "xs", children: [
|
|
664
1017
|
/* @__PURE__ */ jsxs(Group, { justify: "space-between", children: [
|
|
665
|
-
/* @__PURE__ */ jsx(Box, { children: /* @__PURE__ */ jsx(Text, { fw: "500", size: "sm", children: "HTML" }) }),
|
|
666
|
-
/* @__PURE__ */ jsx(Box, { children: /* @__PURE__ */ jsx(
|
|
1018
|
+
/* @__PURE__ */ jsx(Box$1, { children: /* @__PURE__ */ jsx(Text, { fw: "500", size: "sm", children: "HTML" }) }),
|
|
1019
|
+
/* @__PURE__ */ jsx(Box$1, { children: /* @__PURE__ */ jsx(
|
|
667
1020
|
CopyButton$1,
|
|
668
1021
|
{
|
|
669
1022
|
value: htmlCode,
|
|
@@ -673,7 +1026,7 @@ function WebcomponentsPanel({ diagram }) {
|
|
|
673
1026
|
) })
|
|
674
1027
|
] }),
|
|
675
1028
|
/* @__PURE__ */ jsx(Code, { block: !0, children: htmlCode }),
|
|
676
|
-
/* @__PURE__ */ jsx(Box, { children: /* @__PURE__ */ jsxs(Text, { size: "sm", c: "dimmed", children: [
|
|
1029
|
+
/* @__PURE__ */ jsx(Box$1, { children: /* @__PURE__ */ jsxs(Text, { size: "sm", c: "dimmed", children: [
|
|
677
1030
|
"Insert this code to your page. Page may have multiple ",
|
|
678
1031
|
/* @__PURE__ */ jsx("code", { children: "<likec4-view>" }),
|
|
679
1032
|
"."
|
|
@@ -903,7 +1256,7 @@ function GuardedExportPage({ diagram }) {
|
|
|
903
1256
|
});
|
|
904
1257
|
}, extraPadding = 16, width = bounds.width + padding * 2 + extraPadding, height = bounds.height + padding * 2 + extraPadding;
|
|
905
1258
|
return /* @__PURE__ */ jsxs(
|
|
906
|
-
Box
|
|
1259
|
+
Box,
|
|
907
1260
|
{
|
|
908
1261
|
ref: viewportRef,
|
|
909
1262
|
"data-testid": "export-page",
|
|
@@ -1078,7 +1431,8 @@ function ViewReact() {
|
|
|
1078
1431
|
},
|
|
1079
1432
|
children: [
|
|
1080
1433
|
/* @__PURE__ */ jsx(ListenForDynamicVariantChange, {}),
|
|
1081
|
-
/* @__PURE__ */ jsx(OpenRelationshipBrowserFromUrl, {})
|
|
1434
|
+
/* @__PURE__ */ jsx(OpenRelationshipBrowserFromUrl, {}),
|
|
1435
|
+
/* @__PURE__ */ jsx(FocusElementFromUrl, {})
|
|
1082
1436
|
]
|
|
1083
1437
|
}
|
|
1084
1438
|
);
|
|
@@ -1115,6 +1469,30 @@ function OpenRelationshipBrowserFromUrl() {
|
|
|
1115
1469
|
process();
|
|
1116
1470
|
}, [relationships]), null;
|
|
1117
1471
|
}
|
|
1472
|
+
function FocusElementFromUrl() {
|
|
1473
|
+
const router = useRouter(), diagram = useDiagram(), { focusOnElement } = useSearch({
|
|
1474
|
+
from: "__root__"
|
|
1475
|
+
}), processedRef = useRef(null), focusAndClear = useCallbackRef((fqn) => {
|
|
1476
|
+
try {
|
|
1477
|
+
if (processedRef.current === fqn) return;
|
|
1478
|
+
processedRef.current = fqn, diagram.focusOnElement(fqn), router.buildAndCommitLocation({
|
|
1479
|
+
search: (s) => {
|
|
1480
|
+
const { focusOnElement: _, ...rest } = s;
|
|
1481
|
+
return rest;
|
|
1482
|
+
},
|
|
1483
|
+
replace: !0,
|
|
1484
|
+
viewTransition: !1
|
|
1485
|
+
});
|
|
1486
|
+
} catch (error) {
|
|
1487
|
+
console.error("focusOnElement failed:", error);
|
|
1488
|
+
}
|
|
1489
|
+
});
|
|
1490
|
+
return useOnDiagramEvent("initialized", () => {
|
|
1491
|
+
focusOnElement && processedRef.current !== focusOnElement && focusAndClear(focusOnElement);
|
|
1492
|
+
}), useUpdateEffect(() => {
|
|
1493
|
+
focusOnElement || (processedRef.current = null);
|
|
1494
|
+
}, [focusOnElement]), null;
|
|
1495
|
+
}
|
|
1118
1496
|
function ListenForDynamicVariantChange() {
|
|
1119
1497
|
const router = useRouter(), dynamicViewVariant = useDiagramContext((c) => c.dynamicViewVariant);
|
|
1120
1498
|
return useUpdateEffect(() => {
|
|
@@ -1192,7 +1570,8 @@ function ViewEditor() {
|
|
|
1192
1570
|
},
|
|
1193
1571
|
children: [
|
|
1194
1572
|
/* @__PURE__ */ jsx(ListenForDynamicVariantChange, {}),
|
|
1195
|
-
/* @__PURE__ */ jsx(OpenRelationshipBrowserFromUrl, {})
|
|
1573
|
+
/* @__PURE__ */ jsx(OpenRelationshipBrowserFromUrl, {}),
|
|
1574
|
+
/* @__PURE__ */ jsx(FocusElementFromUrl, {})
|
|
1196
1575
|
]
|
|
1197
1576
|
}
|
|
1198
1577
|
)
|
|
@@ -1206,7 +1585,7 @@ function CopyButton({ text }) {
|
|
|
1206
1585
|
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) } }) }) }) });
|
|
1207
1586
|
}
|
|
1208
1587
|
function CopyToClipboard({ text }) {
|
|
1209
|
-
return /* @__PURE__ */ jsx(Box, { pos: "absolute", top: "0", right: "0", p: "4", children: /* @__PURE__ */ jsx(CopyButton, { text }) });
|
|
1588
|
+
return /* @__PURE__ */ jsx(Box$1, { pos: "absolute", top: "0", right: "0", p: "4", children: /* @__PURE__ */ jsx(CopyButton, { text }) });
|
|
1210
1589
|
}
|
|
1211
1590
|
const svgContainer = css({
|
|
1212
1591
|
minWidth: 300,
|
|
@@ -1242,12 +1621,12 @@ const svgContainer = css({
|
|
|
1242
1621
|
function ViewAsPuml({ pumlSource }) {
|
|
1243
1622
|
const [krokiSvg, { execute }] = useAsync(fetchFromKroki$1, null);
|
|
1244
1623
|
return /* @__PURE__ */ jsx(Fragment, { children: /* @__PURE__ */ jsxs(
|
|
1245
|
-
|
|
1624
|
+
Ut,
|
|
1246
1625
|
{
|
|
1247
1626
|
className: viewWithTopPadding,
|
|
1248
1627
|
orientation: "horizontal",
|
|
1249
1628
|
children: [
|
|
1250
|
-
/* @__PURE__ */ jsx(
|
|
1629
|
+
/* @__PURE__ */ jsx(qt, { children: /* @__PURE__ */ jsxs(
|
|
1251
1630
|
ScrollArea,
|
|
1252
1631
|
{
|
|
1253
1632
|
className: cssScrollArea,
|
|
@@ -1264,14 +1643,14 @@ function ViewAsPuml({ pumlSource }) {
|
|
|
1264
1643
|
}
|
|
1265
1644
|
) }),
|
|
1266
1645
|
/* @__PURE__ */ jsx(
|
|
1267
|
-
|
|
1646
|
+
Zt,
|
|
1268
1647
|
{
|
|
1269
1648
|
style: {
|
|
1270
1649
|
width: 10
|
|
1271
1650
|
}
|
|
1272
1651
|
}
|
|
1273
1652
|
),
|
|
1274
|
-
/* @__PURE__ */ jsx(
|
|
1653
|
+
/* @__PURE__ */ jsx(qt, { children: /* @__PURE__ */ jsxs(ScrollArea, { h: "100%", children: [
|
|
1275
1654
|
krokiSvg.status !== "success" && /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
1276
1655
|
/* @__PURE__ */ jsx(
|
|
1277
1656
|
Button,
|
|
@@ -1285,9 +1664,9 @@ function ViewAsPuml({ pumlSource }) {
|
|
|
1285
1664
|
children: krokiSvg.status === "loading" ? "Loading..." : "Render with Kroki"
|
|
1286
1665
|
}
|
|
1287
1666
|
),
|
|
1288
|
-
krokiSvg.status === "error" && /* @__PURE__ */ jsx(Box
|
|
1667
|
+
krokiSvg.status === "error" && /* @__PURE__ */ jsx(Box, { children: krokiSvg.error?.message })
|
|
1289
1668
|
] }),
|
|
1290
|
-
krokiSvg.status === "success" && /* @__PURE__ */ jsx(Box
|
|
1669
|
+
krokiSvg.status === "success" && /* @__PURE__ */ jsx(Box, { className: svgContainer, children: krokiSvg.result ? /* @__PURE__ */ jsx("div", { dangerouslySetInnerHTML: { __html: krokiSvg.result } }) : /* @__PURE__ */ jsx(Box, { children: "Empty result" }) })
|
|
1291
1670
|
] }) })
|
|
1292
1671
|
]
|
|
1293
1672
|
}
|
|
@@ -1325,12 +1704,12 @@ function ViewAsMmd({ viewId, mmdSource }) {
|
|
|
1325
1704
|
return useEffect(() => {
|
|
1326
1705
|
execute(viewId, mmdSource);
|
|
1327
1706
|
}, [mmdSource]), /* @__PURE__ */ jsx(Fragment, { children: /* @__PURE__ */ jsxs(
|
|
1328
|
-
|
|
1707
|
+
Ut,
|
|
1329
1708
|
{
|
|
1330
1709
|
className: viewWithTopPadding,
|
|
1331
1710
|
orientation: "horizontal",
|
|
1332
1711
|
children: [
|
|
1333
|
-
/* @__PURE__ */ jsx(
|
|
1712
|
+
/* @__PURE__ */ jsx(qt, { children: /* @__PURE__ */ jsxs(
|
|
1334
1713
|
ScrollArea,
|
|
1335
1714
|
{
|
|
1336
1715
|
className: cssScrollArea,
|
|
@@ -1347,14 +1726,14 @@ function ViewAsMmd({ viewId, mmdSource }) {
|
|
|
1347
1726
|
}
|
|
1348
1727
|
) }),
|
|
1349
1728
|
/* @__PURE__ */ jsx(
|
|
1350
|
-
|
|
1729
|
+
Zt,
|
|
1351
1730
|
{
|
|
1352
1731
|
style: {
|
|
1353
1732
|
width: 10
|
|
1354
1733
|
}
|
|
1355
1734
|
}
|
|
1356
1735
|
),
|
|
1357
|
-
/* @__PURE__ */ jsx(
|
|
1736
|
+
/* @__PURE__ */ jsx(qt, { children: /* @__PURE__ */ jsx(ScrollArea, { h: "100%", children: mmdSvg.result && /* @__PURE__ */ jsx(Box, { className: svgContainer, dangerouslySetInnerHTML: { __html: mmdSvg.result } }) }) })
|
|
1358
1737
|
]
|
|
1359
1738
|
}
|
|
1360
1739
|
) });
|
|
@@ -1379,8 +1758,8 @@ function Page$2() {
|
|
|
1379
1758
|
return /* @__PURE__ */ jsx(ViewAsMmd, { viewId, mmdSource: source });
|
|
1380
1759
|
}
|
|
1381
1760
|
function ViewAsDot({ dot, dotSvg }) {
|
|
1382
|
-
return /* @__PURE__ */ jsx(Fragment, { children: /* @__PURE__ */ jsxs(
|
|
1383
|
-
/* @__PURE__ */ jsx(
|
|
1761
|
+
return /* @__PURE__ */ jsx(Fragment, { children: /* @__PURE__ */ jsxs(Ut, { className: viewWithTopPadding, children: [
|
|
1762
|
+
/* @__PURE__ */ jsx(qt, { children: /* @__PURE__ */ jsxs(
|
|
1384
1763
|
ScrollArea,
|
|
1385
1764
|
{
|
|
1386
1765
|
className: cssScrollArea,
|
|
@@ -1397,14 +1776,14 @@ function ViewAsDot({ dot, dotSvg }) {
|
|
|
1397
1776
|
}
|
|
1398
1777
|
) }),
|
|
1399
1778
|
/* @__PURE__ */ jsx(
|
|
1400
|
-
|
|
1779
|
+
Zt,
|
|
1401
1780
|
{
|
|
1402
1781
|
style: {
|
|
1403
1782
|
width: 10
|
|
1404
1783
|
}
|
|
1405
1784
|
}
|
|
1406
1785
|
),
|
|
1407
|
-
/* @__PURE__ */ jsx(
|
|
1786
|
+
/* @__PURE__ */ jsx(qt, { children: /* @__PURE__ */ jsx(ScrollArea, { h: "100%", children: /* @__PURE__ */ jsx("div", { className: svgContainer, dangerouslySetInnerHTML: { __html: dotSvg } }) }) })
|
|
1408
1787
|
] }) });
|
|
1409
1788
|
}
|
|
1410
1789
|
const Route$1 = createFileRoute("/_single/view/$viewId/dot")({
|
|
@@ -1444,12 +1823,12 @@ const fetchFromKroki = async (d2) => await (await fetch(krokiD2SvgUrl, {
|
|
|
1444
1823
|
function ViewAsD2({ d2Source }) {
|
|
1445
1824
|
const [krokiSvg, { execute }] = useAsync(fetchFromKroki, null);
|
|
1446
1825
|
return /* @__PURE__ */ jsx(Fragment, { children: /* @__PURE__ */ jsxs(
|
|
1447
|
-
|
|
1826
|
+
Ut,
|
|
1448
1827
|
{
|
|
1449
1828
|
className: viewWithTopPadding,
|
|
1450
1829
|
orientation: "horizontal",
|
|
1451
1830
|
children: [
|
|
1452
|
-
/* @__PURE__ */ jsx(
|
|
1831
|
+
/* @__PURE__ */ jsx(qt, { children: /* @__PURE__ */ jsxs(
|
|
1453
1832
|
ScrollArea,
|
|
1454
1833
|
{
|
|
1455
1834
|
className: cssScrollArea,
|
|
@@ -1466,14 +1845,14 @@ function ViewAsD2({ d2Source }) {
|
|
|
1466
1845
|
}
|
|
1467
1846
|
) }),
|
|
1468
1847
|
/* @__PURE__ */ jsx(
|
|
1469
|
-
|
|
1848
|
+
Zt,
|
|
1470
1849
|
{
|
|
1471
1850
|
style: {
|
|
1472
1851
|
width: 10
|
|
1473
1852
|
}
|
|
1474
1853
|
}
|
|
1475
1854
|
),
|
|
1476
|
-
/* @__PURE__ */ jsx(
|
|
1855
|
+
/* @__PURE__ */ jsx(qt, { children: /* @__PURE__ */ jsxs(ScrollArea, { h: "100%", children: [
|
|
1477
1856
|
krokiSvg.status !== "success" && /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
1478
1857
|
/* @__PURE__ */ jsx(
|
|
1479
1858
|
Button,
|
|
@@ -1487,9 +1866,9 @@ function ViewAsD2({ d2Source }) {
|
|
|
1487
1866
|
children: krokiSvg.status === "loading" ? "Loading..." : "Render with Kroki"
|
|
1488
1867
|
}
|
|
1489
1868
|
),
|
|
1490
|
-
krokiSvg.status === "error" && /* @__PURE__ */ jsx(Box
|
|
1869
|
+
krokiSvg.status === "error" && /* @__PURE__ */ jsx(Box, { children: krokiSvg.error?.message })
|
|
1491
1870
|
] }),
|
|
1492
|
-
krokiSvg.status === "success" && /* @__PURE__ */ jsx(Box
|
|
1871
|
+
krokiSvg.status === "success" && /* @__PURE__ */ jsx(Box, { className: svgContainer, children: krokiSvg.result ? /* @__PURE__ */ jsx("div", { dangerouslySetInnerHTML: { __html: krokiSvg.result } }) : /* @__PURE__ */ jsx(Box, { children: "Empty result" }) })
|
|
1493
1872
|
] }) })
|
|
1494
1873
|
]
|
|
1495
1874
|
}
|