likec4 1.49.0 → 1.51.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 (99) hide show
  1. package/__app__/src/likec4.js +33 -62
  2. package/__app__/src/main.js +2 -56
  3. package/__app__/src/routes/index.js +81 -16
  4. package/__app__/src/routes/single.js +43 -23
  5. package/__app__/src/style.css +1 -1
  6. package/__app__/src/vendors.js +17891 -17752
  7. package/config/schema.json +16 -0
  8. package/dist/THIRD-PARTY-LICENSES.md +192 -62
  9. package/dist/_chunks/LikeC4.mjs +1 -0
  10. package/dist/_chunks/filesystem.mjs +1230 -0
  11. package/dist/_chunks/index.d.mts +11 -12
  12. package/dist/_chunks/index2.d.mts +173 -84
  13. package/dist/_chunks/libs/@chevrotain/cst-dts-gen.mjs +30 -0
  14. package/dist/_chunks/libs/@chevrotain/regexp-to-ast.mjs +8 -8
  15. package/dist/_chunks/libs/@chevrotain/types.d.mts +1 -0
  16. package/dist/_chunks/libs/@chevrotain/utils.mjs +1 -1
  17. package/dist/_chunks/libs/@hono/mcp.mjs +8 -8
  18. package/dist/_chunks/libs/@hono/node-server.mjs +1 -1
  19. package/dist/_chunks/libs/@logtape/logtape.mjs +3 -3
  20. package/dist/_chunks/libs/@lume/kiwi.mjs +1 -1
  21. package/dist/_chunks/libs/@modelcontextprotocol/sdk.d.mts +114 -14
  22. package/dist/_chunks/libs/@modelcontextprotocol/sdk.mjs +7 -7
  23. package/dist/_chunks/libs/@msgpack/msgpack.mjs +1 -1
  24. package/dist/_chunks/libs/@nanostores/react.d.mts +61 -1
  25. package/dist/_chunks/libs/@nanostores/react.mjs +1 -1
  26. package/dist/_chunks/libs/@smithy/is-array-buffer.mjs +1 -0
  27. package/dist/_chunks/libs/@smithy/util-base64.mjs +1 -1
  28. package/dist/_chunks/libs/ajv.mjs +1 -1
  29. package/dist/_chunks/libs/ansi-align.mjs +2 -0
  30. package/dist/_chunks/libs/ansi-regex.mjs +1 -0
  31. package/dist/_chunks/libs/ansi-styles.mjs +1 -0
  32. package/dist/_chunks/libs/atomically.mjs +1 -1
  33. package/dist/_chunks/libs/birpc.mjs +1 -1
  34. package/dist/_chunks/libs/boxen.d.mts +1 -0
  35. package/dist/_chunks/libs/boxen.mjs +22 -0
  36. package/dist/_chunks/libs/chevrotain-allstar.mjs +2 -2
  37. package/dist/_chunks/libs/chevrotain.mjs +35 -35
  38. package/dist/_chunks/libs/conf.mjs +1 -1
  39. package/dist/_chunks/libs/defu.mjs +1 -1
  40. package/dist/_chunks/libs/esm-env.mjs +1 -1
  41. package/dist/_chunks/libs/eventemitter3.mjs +1 -1
  42. package/dist/_chunks/libs/fast-equals.mjs +1 -1
  43. package/dist/_chunks/libs/find-up-simple.mjs +1 -1
  44. package/dist/_chunks/libs/get-port.mjs +1 -1
  45. package/dist/_chunks/libs/is-docker.mjs +1 -1
  46. package/dist/_chunks/libs/is-error-instance.mjs +1 -1
  47. package/dist/_chunks/libs/is-inside-container.mjs +1 -1
  48. package/dist/_chunks/libs/is-plain-obj.mjs +1 -1
  49. package/dist/_chunks/libs/isexe.mjs +1 -1
  50. package/dist/_chunks/libs/json5.mjs +10 -10
  51. package/dist/_chunks/libs/khroma.mjs +1 -1
  52. package/dist/_chunks/libs/ky.mjs +2 -2
  53. package/dist/_chunks/libs/langium.d.mts +5 -4
  54. package/dist/_chunks/libs/langium.mjs +20 -19
  55. package/dist/_chunks/libs/merge-error-cause.mjs +2 -2
  56. package/dist/_chunks/libs/p-limit.mjs +1 -1
  57. package/dist/_chunks/libs/p-queue.mjs +1 -1
  58. package/dist/_chunks/libs/package-manager-detector.mjs +1 -1
  59. package/dist/_chunks/libs/package-up.mjs +1 -1
  60. package/dist/_chunks/libs/pako.mjs +1 -0
  61. package/dist/_chunks/libs/parse-ms.mjs +1 -1
  62. package/dist/_chunks/libs/pathe.mjs +1 -1
  63. package/dist/_chunks/libs/picomatch.mjs +1 -1
  64. package/dist/_chunks/libs/pretty-ms.mjs +1 -1
  65. package/dist/_chunks/libs/remeda.mjs +2 -1
  66. package/dist/_chunks/libs/safe-stringify.mjs +1 -1
  67. package/dist/_chunks/libs/strip-indent.mjs +1 -1
  68. package/dist/_chunks/libs/tinyrainbow.mjs +1 -1
  69. package/dist/_chunks/libs/ts-graphviz.mjs +3 -3
  70. package/dist/_chunks/libs/ufo.mjs +1 -1
  71. package/dist/_chunks/libs/vscode-languageserver.mjs +1 -0
  72. package/dist/_chunks/libs/which.mjs +1 -1
  73. package/dist/_chunks/libs/word-wrap.mjs +2 -2
  74. package/dist/_chunks/rolldown-runtime.mjs +1 -1
  75. package/dist/_chunks/sequence.mjs +1 -0
  76. package/dist/_chunks/src.mjs +15 -0
  77. package/dist/_chunks/src2.mjs +499 -0
  78. package/dist/cli/index.mjs +84 -231
  79. package/dist/config/index.mjs +1 -1
  80. package/dist/index.d.mts +810 -4
  81. package/dist/index.mjs +1 -1
  82. package/dist/model/index.mjs +1 -1
  83. package/dist/vite-plugin/index.d.mts +3 -0
  84. package/dist/vite-plugin/index.mjs +1 -1
  85. package/dist/vite-plugin/internal.d.mts +1 -2
  86. package/dist/vite-plugin/internal.mjs +1 -1
  87. package/package.json +28 -29
  88. package/react/index.d.mts +2 -2
  89. package/react/index.mjs +52 -76
  90. package/vite-plugin-modules.d.ts +5 -0
  91. package/dist/_chunks/GraphvizBinaryAdapter.mjs +0 -72
  92. package/dist/_chunks/filenames.mjs +0 -14
  93. package/dist/_chunks/libs/@chevrotain/gast.mjs +0 -1
  94. package/dist/_chunks/libs/@logtape/logtape.d.mts +0 -741
  95. package/dist/_chunks/libs/nanostores.d.mts +0 -63
  96. package/dist/_chunks/libs/nanostores.mjs +0 -1
  97. package/dist/_chunks/node.mjs +0 -481
  98. package/dist/_chunks/plugin.mjs +0 -322
  99. package/dist/_chunks/sequence-view.mjs +0 -1
@@ -1,13 +1,14 @@
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, dg as useMatches, dh as useIsomorphicLayoutEffect, d3 as useDocumentTitle, di as SimpleGrid, dj as useInViewport, dk as e$3, ci as Card, aQ as Box, d2 as redirect, k as useMantineColorScheme, dl as useComputedColorScheme, aA as ActionIcon, aF as MotionDiv, cN as isValidMotionProp, aD as Menu, bc as MenuTarget, bd as MenuDropdown, be as MenuItem, dm as MenuDivider, bp as Stack, b5 as CopyButton$1, dn as Select, dp as ModalRoot, dq as ModalOverlay, dr as ModalContent, ds as ModalBody, bL as Tabs, bM as TabsList, bN as TabsTab, bO as TabsPanel, dt as useMantineTheme, du as useMediaQuery, cq as useDisclosure, aG as Divider, dv as MenuLabel, dw as useSearch, dx as LoadingOverlay, dy as toBlob, c$ as stripSearchParams, cZ as z, cY as useNavigate, bS as useCallbackRef, aL as useIsMounted, T as Tooltip, dz as useAsync, dA as It, dB as Ot, bP as ScrollArea, dC as Nt, dD as notFound } from "../vendors.js";
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, dg as useMatches, dh as useIsomorphicLayoutEffect, d3 as useDocumentTitle, di as SimpleGrid, dj as useInViewport, dk as e$3, ci as Card, aQ as Box, d2 as redirect, k as useMantineColorScheme, dl as useComputedColorScheme, cY as useNavigate, aA as ActionIcon, aF as MotionDiv, cN as isValidMotionProp, aD as Menu, bc as MenuTarget, bd as MenuDropdown, be as MenuItem, dm as MenuDivider, bp as Stack, b5 as CopyButton$1, dn as Select, dp as ModalRoot, dq as ModalOverlay, dr as ModalContent, ds as ModalBody, bL as Tabs, bM as TabsList, bN as TabsTab, bO as TabsPanel, dt as useMantineTheme, du as useMediaQuery, cq as useDisclosure, aG as Divider, dv as MenuLabel, dw as useSearch, dx as LoadingOverlay, dy as toBlob, c$ as stripSearchParams, cZ as z, bS as useCallbackRef, aL as useIsMounted, T as Tooltip, dz as useAsync, dA as Tt, dB as _t, bP as ScrollArea, dC as Ht, dD as notFound } from "../vendors.js";
3
3
  import { loadModel } from "likec4:model";
4
4
  import { c as css, s as styled, I as IconRendererProvider, a as LikeC4ModelProvider, u as useUpdateEffect, S as StaticLikeC4Diagram, M as Markdown, b as LikeC4AdHocViewEditor, B as Box$1, d as IconMoonStars, e as IconSun, f as createStyleContext, n as navigationPanel, i as isCssProperty, g as useLikeC4Projects$1, h as IconChevronDown, j as IconAlertTriangle, k as IconCheck, l as IconCopy, m as IconExternalLink, o as IconShare, p as pickViewBounds, q as LikeC4Diagram, r as useLikeC4Model, t as useDiagramContext, v as useDiagram, w as useOnDiagramEvent, x as LikeC4EditorProvider } from "../likec4.js";
5
5
  import { getProjectIcons } from "likec4:icons";
6
- import { useMemo, createContext, useContext, useState, useEffect, memo, useRef } from "react";
6
+ import { useMemo, createContext, useContext, useState, useEffect, useRef, memo, useCallback } from "react";
7
7
  import { useStore } from "likec4/vite-plugin/internal";
8
8
  import { RichText } from "@likec4/core/types";
9
9
  import { pageTitle, ComponentName, useHashHistory, isDevelopment, krokiPumlSvgUrl, krokiD2SvgUrl } from "../const.js";
10
10
  import { likec4rpc, isRpcAvailable } from "likec4:rpc";
11
+ import { R as Route$c, r as resolveForceColorScheme } from "./index.js";
11
12
  import { useLikeC4Projects } from "likec4:projects";
12
13
  function Fallback({ error: _error, resetErrorBoundary }) {
13
14
  const router = useRouter(), params = useParams({
@@ -438,15 +439,27 @@ function WebcomponentPage() {
438
439
  function ColorSchemeToggle() {
439
440
  const { setColorScheme } = useMantineColorScheme({
440
441
  keepTransitions: !0
441
- }), computedColorScheme = useComputedColorScheme("light");
442
- return /* @__PURE__ */ jsxs(
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(
443
446
  ActionIcon,
444
447
  {
445
448
  visibleFrom: "sm",
446
449
  size: "md",
447
450
  variant: "subtle",
448
451
  color: "gray",
449
- onClick: () => setColorScheme(computedColorScheme === "light" ? "dark" : "light"),
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
+ },
450
463
  "aria-label": "Toggle color scheme",
451
464
  children: [
452
465
  /* @__PURE__ */ jsx(IconMoonStars, { stroke: 1.5, display: computedColorScheme === "light" ? "block" : "none" }),
@@ -740,7 +753,14 @@ const Header = memo(() => {
740
753
  function ExportButton() {
741
754
  const isInsideProject = useMatches({
742
755
  select: (matches) => matches.some(({ routeId }) => routeId === "/project/$projectId")
743
- });
756
+ }), project = useCurrentProject(), viewId = useCurrentViewId(), handleDrawioExport = useCallback(async () => {
757
+ try {
758
+ const { loadDrawioSources } = await import("likec4:drawio"), { drawioEditUrl } = await loadDrawioSources(project.id), url = drawioEditUrl(viewId);
759
+ window.open(url, "_blank", "noopener,noreferrer");
760
+ } catch (error) {
761
+ console.error("Failed to export to Draw.io:", error);
762
+ }
763
+ }, [project.id, viewId]);
744
764
  return /* @__PURE__ */ jsxs(Menu, { shadow: "md", width: 200, trigger: "click-hover", openDelay: 200, children: [
745
765
  /* @__PURE__ */ jsx(MenuTarget, { children: /* @__PURE__ */ jsx(
746
766
  Button,
@@ -827,7 +847,7 @@ function ExportButton() {
827
847
  children: "Export as .puml"
828
848
  }
829
849
  ),
830
- /* @__PURE__ */ jsx(MenuItem, { disabled: !0, children: "Export to Draw.io" }),
850
+ /* @__PURE__ */ jsx(MenuItem, { onClick: handleDrawioExport, children: "Export to Draw.io" }),
831
851
  /* @__PURE__ */ jsx(MenuItem, { disabled: !0, children: "Export to Miro" }),
832
852
  /* @__PURE__ */ jsx(MenuItem, { disabled: !0, children: "Export to Notion" })
833
853
  ] })
@@ -1222,12 +1242,12 @@ const svgContainer = css({
1222
1242
  function ViewAsPuml({ pumlSource }) {
1223
1243
  const [krokiSvg, { execute }] = useAsync(fetchFromKroki$1, null);
1224
1244
  return /* @__PURE__ */ jsx(Fragment, { children: /* @__PURE__ */ jsxs(
1225
- It,
1245
+ Tt,
1226
1246
  {
1227
1247
  className: viewWithTopPadding,
1228
1248
  orientation: "horizontal",
1229
1249
  children: [
1230
- /* @__PURE__ */ jsx(Ot, { children: /* @__PURE__ */ jsxs(
1250
+ /* @__PURE__ */ jsx(_t, { children: /* @__PURE__ */ jsxs(
1231
1251
  ScrollArea,
1232
1252
  {
1233
1253
  className: cssScrollArea,
@@ -1244,14 +1264,14 @@ function ViewAsPuml({ pumlSource }) {
1244
1264
  }
1245
1265
  ) }),
1246
1266
  /* @__PURE__ */ jsx(
1247
- Nt,
1267
+ Ht,
1248
1268
  {
1249
1269
  style: {
1250
1270
  width: 10
1251
1271
  }
1252
1272
  }
1253
1273
  ),
1254
- /* @__PURE__ */ jsx(Ot, { children: /* @__PURE__ */ jsxs(ScrollArea, { h: "100%", children: [
1274
+ /* @__PURE__ */ jsx(_t, { children: /* @__PURE__ */ jsxs(ScrollArea, { h: "100%", children: [
1255
1275
  krokiSvg.status !== "success" && /* @__PURE__ */ jsxs(Fragment, { children: [
1256
1276
  /* @__PURE__ */ jsx(
1257
1277
  Button,
@@ -1305,12 +1325,12 @@ function ViewAsMmd({ viewId, mmdSource }) {
1305
1325
  return useEffect(() => {
1306
1326
  execute(viewId, mmdSource);
1307
1327
  }, [mmdSource]), /* @__PURE__ */ jsx(Fragment, { children: /* @__PURE__ */ jsxs(
1308
- It,
1328
+ Tt,
1309
1329
  {
1310
1330
  className: viewWithTopPadding,
1311
1331
  orientation: "horizontal",
1312
1332
  children: [
1313
- /* @__PURE__ */ jsx(Ot, { children: /* @__PURE__ */ jsxs(
1333
+ /* @__PURE__ */ jsx(_t, { children: /* @__PURE__ */ jsxs(
1314
1334
  ScrollArea,
1315
1335
  {
1316
1336
  className: cssScrollArea,
@@ -1327,14 +1347,14 @@ function ViewAsMmd({ viewId, mmdSource }) {
1327
1347
  }
1328
1348
  ) }),
1329
1349
  /* @__PURE__ */ jsx(
1330
- Nt,
1350
+ Ht,
1331
1351
  {
1332
1352
  style: {
1333
1353
  width: 10
1334
1354
  }
1335
1355
  }
1336
1356
  ),
1337
- /* @__PURE__ */ jsx(Ot, { children: /* @__PURE__ */ jsx(ScrollArea, { h: "100%", children: mmdSvg.result && /* @__PURE__ */ jsx(Box$1, { className: svgContainer, dangerouslySetInnerHTML: { __html: mmdSvg.result } }) }) })
1357
+ /* @__PURE__ */ jsx(_t, { children: /* @__PURE__ */ jsx(ScrollArea, { h: "100%", children: mmdSvg.result && /* @__PURE__ */ jsx(Box$1, { className: svgContainer, dangerouslySetInnerHTML: { __html: mmdSvg.result } }) }) })
1338
1358
  ]
1339
1359
  }
1340
1360
  ) });
@@ -1359,8 +1379,8 @@ function Page$2() {
1359
1379
  return /* @__PURE__ */ jsx(ViewAsMmd, { viewId, mmdSource: source });
1360
1380
  }
1361
1381
  function ViewAsDot({ dot, dotSvg }) {
1362
- return /* @__PURE__ */ jsx(Fragment, { children: /* @__PURE__ */ jsxs(It, { className: viewWithTopPadding, children: [
1363
- /* @__PURE__ */ jsx(Ot, { children: /* @__PURE__ */ jsxs(
1382
+ return /* @__PURE__ */ jsx(Fragment, { children: /* @__PURE__ */ jsxs(Tt, { className: viewWithTopPadding, children: [
1383
+ /* @__PURE__ */ jsx(_t, { children: /* @__PURE__ */ jsxs(
1364
1384
  ScrollArea,
1365
1385
  {
1366
1386
  className: cssScrollArea,
@@ -1377,14 +1397,14 @@ function ViewAsDot({ dot, dotSvg }) {
1377
1397
  }
1378
1398
  ) }),
1379
1399
  /* @__PURE__ */ jsx(
1380
- Nt,
1400
+ Ht,
1381
1401
  {
1382
1402
  style: {
1383
1403
  width: 10
1384
1404
  }
1385
1405
  }
1386
1406
  ),
1387
- /* @__PURE__ */ jsx(Ot, { children: /* @__PURE__ */ jsx(ScrollArea, { h: "100%", children: /* @__PURE__ */ jsx("div", { className: svgContainer, dangerouslySetInnerHTML: { __html: dotSvg } }) }) })
1407
+ /* @__PURE__ */ jsx(_t, { children: /* @__PURE__ */ jsx(ScrollArea, { h: "100%", children: /* @__PURE__ */ jsx("div", { className: svgContainer, dangerouslySetInnerHTML: { __html: dotSvg } }) }) })
1388
1408
  ] }) });
1389
1409
  }
1390
1410
  const Route$1 = createFileRoute("/_single/view/$viewId/dot")({
@@ -1424,12 +1444,12 @@ const fetchFromKroki = async (d2) => await (await fetch(krokiD2SvgUrl, {
1424
1444
  function ViewAsD2({ d2Source }) {
1425
1445
  const [krokiSvg, { execute }] = useAsync(fetchFromKroki, null);
1426
1446
  return /* @__PURE__ */ jsx(Fragment, { children: /* @__PURE__ */ jsxs(
1427
- It,
1447
+ Tt,
1428
1448
  {
1429
1449
  className: viewWithTopPadding,
1430
1450
  orientation: "horizontal",
1431
1451
  children: [
1432
- /* @__PURE__ */ jsx(Ot, { children: /* @__PURE__ */ jsxs(
1452
+ /* @__PURE__ */ jsx(_t, { children: /* @__PURE__ */ jsxs(
1433
1453
  ScrollArea,
1434
1454
  {
1435
1455
  className: cssScrollArea,
@@ -1446,14 +1466,14 @@ function ViewAsD2({ d2Source }) {
1446
1466
  }
1447
1467
  ) }),
1448
1468
  /* @__PURE__ */ jsx(
1449
- Nt,
1469
+ Ht,
1450
1470
  {
1451
1471
  style: {
1452
1472
  width: 10
1453
1473
  }
1454
1474
  }
1455
1475
  ),
1456
- /* @__PURE__ */ jsx(Ot, { children: /* @__PURE__ */ jsxs(ScrollArea, { h: "100%", children: [
1476
+ /* @__PURE__ */ jsx(_t, { children: /* @__PURE__ */ jsxs(ScrollArea, { h: "100%", children: [
1457
1477
  krokiSvg.status !== "success" && /* @__PURE__ */ jsxs(Fragment, { children: [
1458
1478
  /* @__PURE__ */ jsx(
1459
1479
  Button,