likec4 1.52.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.
Files changed (36) hide show
  1. package/__app__/src/likec4.js +34 -48
  2. package/__app__/src/routes/index.js +7 -0
  3. package/__app__/src/routes/single.js +30 -18
  4. package/__app__/src/style.css +1 -1
  5. package/__app__/src/vendors.js +2065 -2809
  6. package/config/schema.json +56 -0
  7. package/dist/THIRD-PARTY-LICENSES.md +10 -2
  8. package/dist/_chunks/filesystem.mjs +70 -68
  9. package/dist/_chunks/index.d.mts +10 -1
  10. package/dist/_chunks/index2.d.mts +76 -4
  11. package/dist/_chunks/libs/@hono/mcp.mjs +1 -1
  12. package/dist/_chunks/libs/@logtape/logtape.d.mts +1021 -0
  13. package/dist/_chunks/libs/@logtape/logtape.mjs +4 -6
  14. package/dist/_chunks/libs/@modelcontextprotocol/sdk.d.mts +1 -1
  15. package/dist/_chunks/libs/@nanostores/react.d.mts +5 -5
  16. package/dist/_chunks/libs/destr.mjs +1 -0
  17. package/dist/_chunks/libs/fast-equals.mjs +1 -1
  18. package/dist/_chunks/libs/langium.mjs +1 -1
  19. package/dist/_chunks/libs/remeda.mjs +2 -2
  20. package/dist/_chunks/libs/tinyrainbow.mjs +1 -1
  21. package/dist/_chunks/libs/unstorage.mjs +1 -0
  22. package/dist/_chunks/node.mjs +1 -0
  23. package/dist/_chunks/sequence.mjs +1 -1
  24. package/dist/_chunks/src.mjs +14 -12
  25. package/dist/_chunks/src2.mjs +46 -46
  26. package/dist/cli/index.mjs +164 -84
  27. package/dist/index.d.mts +16 -819
  28. package/dist/index.mjs +1 -1
  29. package/dist/vite-plugin/index.mjs +1 -1
  30. package/dist/vite-plugin/internal.mjs +1 -1
  31. package/package.json +34 -33
  32. package/react/index.d.mts +24 -20
  33. package/react/index.mjs +969 -1728
  34. package/vite-plugin-modules.d.ts +5 -0
  35. package/dist/_chunks/LikeC4.mjs +0 -1
  36. package/dist/_chunks/libs/boxen.d.mts +0 -1
@@ -4161,14 +4161,14 @@ const ViewPadding = {
4161
4161
  return context2.view.id === event.view.id;
4162
4162
  if (event.type === "navigate.to")
4163
4163
  return context2.view.id === event.viewId;
4164
- nonexhaustive(event.type);
4164
+ nonexhaustive(event);
4165
4165
  },
4166
4166
  "is another view": ({ context: context2, event }) => {
4167
4167
  if (assertEvent(event, ["update.view", "navigate.to"]), event.type === "update.view")
4168
4168
  return context2.view.id !== event.view.id;
4169
4169
  if (event.type === "navigate.to")
4170
4170
  return context2.view.id !== event.viewId;
4171
- nonexhaustive(event.type);
4171
+ nonexhaustive(event);
4172
4172
  },
4173
4173
  "click: node has modelFqn": ({ event }) => (assertEvent(event, "xyflow.nodeClick"), "modelFqn" in event.node.data),
4174
4174
  "click: selected node": ({ event }) => (assertEvent(event, "xyflow.nodeClick"), event.node.selected === !0),
@@ -8878,8 +8878,26 @@ const WalkthroughPanel = memo$1(() => {
8878
8878
  m$1.div,
8879
8879
  {
8880
8880
  layout: "position",
8881
- className: css({
8882
- position: "relative"
8881
+ className: vstack({
8882
+ position: "relative",
8883
+ layerStyle: "likec4.dropdown",
8884
+ gap: "sm",
8885
+ padding: "md",
8886
+ paddingTop: "xxs",
8887
+ pointerEvents: "all",
8888
+ maxWidth: 300,
8889
+ height: "max-content",
8890
+ maxHeight: "calc(100cqh - 100px)",
8891
+ width: "max-content",
8892
+ cursor: "default",
8893
+ overflow: "hidden",
8894
+ "@/sm": {
8895
+ minWidth: 400,
8896
+ maxWidth: 550
8897
+ },
8898
+ "@/lg": {
8899
+ maxWidth: 700
8900
+ }
8883
8901
  }),
8884
8902
  initial: {
8885
8903
  opacity: 0,
@@ -8893,48 +8911,17 @@ const WalkthroughPanel = memo$1(() => {
8893
8911
  opacity: 0,
8894
8912
  translateX: -20
8895
8913
  },
8896
- children: /* @__PURE__ */ jsxs(
8897
- ScrollAreaAutosize,
8898
- {
8899
- className: vstack({
8900
- position: "absolute",
8901
- layerStyle: "likec4.dropdown",
8902
- gap: "sm",
8903
- padding: "md",
8904
- paddingTop: "xxs",
8905
- pointerEvents: "all",
8906
- maxWidth: "calc(100cqw - 32px)",
8907
- minWidth: "calc(100cqw - 50px)",
8908
- maxHeight: "calc(100cqh - 100px)",
8909
- width: "max-content",
8910
- cursor: "default",
8911
- overflow: "auto",
8912
- overscrollBehavior: "contain",
8913
- "@/sm": {
8914
- minWidth: 400,
8915
- maxWidth: 550
8916
- },
8917
- "@/lg": {
8918
- maxWidth: 700
8919
- }
8920
- }),
8921
- type: "scroll",
8922
- children: [
8923
- /* @__PURE__ */ jsx(SectionHeader, { children: "Notes" }),
8924
- /* @__PURE__ */ jsx(
8925
- Markdown,
8926
- {
8927
- value: notes,
8928
- fontSize: "sm",
8929
- emptyText: "No description",
8930
- className: css({
8931
- userSelect: "all"
8932
- })
8933
- }
8934
- )
8935
- ]
8936
- }
8937
- )
8914
+ children: /* @__PURE__ */ jsxs(ScrollAreaAutosize, { type: "scroll", overscrollBehavior: "contain", children: [
8915
+ /* @__PURE__ */ jsx(SectionHeader, { children: "Notes" }),
8916
+ /* @__PURE__ */ jsx(
8917
+ Markdown,
8918
+ {
8919
+ value: notes,
8920
+ fontSize: "sm",
8921
+ emptyText: "No description"
8922
+ }
8923
+ )
8924
+ ] })
8938
8925
  }
8939
8926
  ) });
8940
8927
  }), NavigationPanel$1 = memo$1(() => {
@@ -16966,8 +16953,7 @@ function diagramToXY(opts) {
16966
16953
  data: {
16967
16954
  isViewGroup: !0,
16968
16955
  ...compoundData
16969
- },
16970
- dragHandle: ".likec4-compound-title-container"
16956
+ }
16971
16957
  });
16972
16958
  continue;
16973
16959
  }
@@ -147,6 +147,13 @@ const Route = createFileRoute("/")({
147
147
  to: "/",
148
148
  unmaskOnReload: !0
149
149
  }
150
+ }) : projects[0]?.landingPage && "redirect" in projects[0].landingPage ? redirect({
151
+ to: "/view/$viewId/",
152
+ params: { viewId: "index" },
153
+ mask: {
154
+ to: "/",
155
+ unmaskOnReload: !0
156
+ }
150
157
  }) : redirect({
151
158
  to: "/single-index/",
152
159
  mask: {
@@ -1,5 +1,5 @@
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, 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 Tt, dE as _t, dF as Ht, dG 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, 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
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";
@@ -583,6 +583,18 @@ const DiagramPreview = memo(({ diagram }) => {
583
583
  }
584
584
  );
585
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
+ }
586
598
  css({
587
599
  color: "text.dimmed"
588
600
  });
@@ -616,7 +628,7 @@ const previewBg = css({
616
628
  });
617
629
  function RouteComponent() {
618
630
  useDocumentTitle(pageTitle);
619
- const views = useLikeC4Views();
631
+ const allViews = useLikeC4Views(), { landingPage } = useCurrentProject(), views = filterLandingPageViews(allViews, landingPage);
620
632
  return /* @__PURE__ */ jsxs(Container, { size: "xl", children: [
621
633
  /* @__PURE__ */ jsx(SidebarDrawer, {}),
622
634
  /* @__PURE__ */ jsxs(
@@ -1609,12 +1621,12 @@ const svgContainer = css({
1609
1621
  function ViewAsPuml({ pumlSource }) {
1610
1622
  const [krokiSvg, { execute }] = useAsync(fetchFromKroki$1, null);
1611
1623
  return /* @__PURE__ */ jsx(Fragment, { children: /* @__PURE__ */ jsxs(
1612
- Tt,
1624
+ Ut,
1613
1625
  {
1614
1626
  className: viewWithTopPadding,
1615
1627
  orientation: "horizontal",
1616
1628
  children: [
1617
- /* @__PURE__ */ jsx(_t, { children: /* @__PURE__ */ jsxs(
1629
+ /* @__PURE__ */ jsx(qt, { children: /* @__PURE__ */ jsxs(
1618
1630
  ScrollArea,
1619
1631
  {
1620
1632
  className: cssScrollArea,
@@ -1631,14 +1643,14 @@ function ViewAsPuml({ pumlSource }) {
1631
1643
  }
1632
1644
  ) }),
1633
1645
  /* @__PURE__ */ jsx(
1634
- Ht,
1646
+ Zt,
1635
1647
  {
1636
1648
  style: {
1637
1649
  width: 10
1638
1650
  }
1639
1651
  }
1640
1652
  ),
1641
- /* @__PURE__ */ jsx(_t, { children: /* @__PURE__ */ jsxs(ScrollArea, { h: "100%", children: [
1653
+ /* @__PURE__ */ jsx(qt, { children: /* @__PURE__ */ jsxs(ScrollArea, { h: "100%", children: [
1642
1654
  krokiSvg.status !== "success" && /* @__PURE__ */ jsxs(Fragment, { children: [
1643
1655
  /* @__PURE__ */ jsx(
1644
1656
  Button,
@@ -1692,12 +1704,12 @@ function ViewAsMmd({ viewId, mmdSource }) {
1692
1704
  return useEffect(() => {
1693
1705
  execute(viewId, mmdSource);
1694
1706
  }, [mmdSource]), /* @__PURE__ */ jsx(Fragment, { children: /* @__PURE__ */ jsxs(
1695
- Tt,
1707
+ Ut,
1696
1708
  {
1697
1709
  className: viewWithTopPadding,
1698
1710
  orientation: "horizontal",
1699
1711
  children: [
1700
- /* @__PURE__ */ jsx(_t, { children: /* @__PURE__ */ jsxs(
1712
+ /* @__PURE__ */ jsx(qt, { children: /* @__PURE__ */ jsxs(
1701
1713
  ScrollArea,
1702
1714
  {
1703
1715
  className: cssScrollArea,
@@ -1714,14 +1726,14 @@ function ViewAsMmd({ viewId, mmdSource }) {
1714
1726
  }
1715
1727
  ) }),
1716
1728
  /* @__PURE__ */ jsx(
1717
- Ht,
1729
+ Zt,
1718
1730
  {
1719
1731
  style: {
1720
1732
  width: 10
1721
1733
  }
1722
1734
  }
1723
1735
  ),
1724
- /* @__PURE__ */ jsx(_t, { children: /* @__PURE__ */ jsx(ScrollArea, { h: "100%", children: mmdSvg.result && /* @__PURE__ */ jsx(Box, { className: svgContainer, dangerouslySetInnerHTML: { __html: mmdSvg.result } }) }) })
1736
+ /* @__PURE__ */ jsx(qt, { children: /* @__PURE__ */ jsx(ScrollArea, { h: "100%", children: mmdSvg.result && /* @__PURE__ */ jsx(Box, { className: svgContainer, dangerouslySetInnerHTML: { __html: mmdSvg.result } }) }) })
1725
1737
  ]
1726
1738
  }
1727
1739
  ) });
@@ -1746,8 +1758,8 @@ function Page$2() {
1746
1758
  return /* @__PURE__ */ jsx(ViewAsMmd, { viewId, mmdSource: source });
1747
1759
  }
1748
1760
  function ViewAsDot({ dot, dotSvg }) {
1749
- return /* @__PURE__ */ jsx(Fragment, { children: /* @__PURE__ */ jsxs(Tt, { className: viewWithTopPadding, children: [
1750
- /* @__PURE__ */ jsx(_t, { children: /* @__PURE__ */ jsxs(
1761
+ return /* @__PURE__ */ jsx(Fragment, { children: /* @__PURE__ */ jsxs(Ut, { className: viewWithTopPadding, children: [
1762
+ /* @__PURE__ */ jsx(qt, { children: /* @__PURE__ */ jsxs(
1751
1763
  ScrollArea,
1752
1764
  {
1753
1765
  className: cssScrollArea,
@@ -1764,14 +1776,14 @@ function ViewAsDot({ dot, dotSvg }) {
1764
1776
  }
1765
1777
  ) }),
1766
1778
  /* @__PURE__ */ jsx(
1767
- Ht,
1779
+ Zt,
1768
1780
  {
1769
1781
  style: {
1770
1782
  width: 10
1771
1783
  }
1772
1784
  }
1773
1785
  ),
1774
- /* @__PURE__ */ jsx(_t, { children: /* @__PURE__ */ jsx(ScrollArea, { h: "100%", children: /* @__PURE__ */ jsx("div", { className: svgContainer, dangerouslySetInnerHTML: { __html: dotSvg } }) }) })
1786
+ /* @__PURE__ */ jsx(qt, { children: /* @__PURE__ */ jsx(ScrollArea, { h: "100%", children: /* @__PURE__ */ jsx("div", { className: svgContainer, dangerouslySetInnerHTML: { __html: dotSvg } }) }) })
1775
1787
  ] }) });
1776
1788
  }
1777
1789
  const Route$1 = createFileRoute("/_single/view/$viewId/dot")({
@@ -1811,12 +1823,12 @@ const fetchFromKroki = async (d2) => await (await fetch(krokiD2SvgUrl, {
1811
1823
  function ViewAsD2({ d2Source }) {
1812
1824
  const [krokiSvg, { execute }] = useAsync(fetchFromKroki, null);
1813
1825
  return /* @__PURE__ */ jsx(Fragment, { children: /* @__PURE__ */ jsxs(
1814
- Tt,
1826
+ Ut,
1815
1827
  {
1816
1828
  className: viewWithTopPadding,
1817
1829
  orientation: "horizontal",
1818
1830
  children: [
1819
- /* @__PURE__ */ jsx(_t, { children: /* @__PURE__ */ jsxs(
1831
+ /* @__PURE__ */ jsx(qt, { children: /* @__PURE__ */ jsxs(
1820
1832
  ScrollArea,
1821
1833
  {
1822
1834
  className: cssScrollArea,
@@ -1833,14 +1845,14 @@ function ViewAsD2({ d2Source }) {
1833
1845
  }
1834
1846
  ) }),
1835
1847
  /* @__PURE__ */ jsx(
1836
- Ht,
1848
+ Zt,
1837
1849
  {
1838
1850
  style: {
1839
1851
  width: 10
1840
1852
  }
1841
1853
  }
1842
1854
  ),
1843
- /* @__PURE__ */ jsx(_t, { children: /* @__PURE__ */ jsxs(ScrollArea, { h: "100%", children: [
1855
+ /* @__PURE__ */ jsx(qt, { children: /* @__PURE__ */ jsxs(ScrollArea, { h: "100%", children: [
1844
1856
  krokiSvg.status !== "success" && /* @__PURE__ */ jsxs(Fragment, { children: [
1845
1857
  /* @__PURE__ */ jsx(
1846
1858
  Button,