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.
Files changed (43) hide show
  1. package/__app__/src/ProjectsOverview.js +1 -1
  2. package/__app__/src/likec4.js +295 -190
  3. package/__app__/src/routes/index.js +11 -2
  4. package/__app__/src/routes/projects.js +1 -1
  5. package/__app__/src/routes/single.js +460 -81
  6. package/__app__/src/style.css +1 -1
  7. package/__app__/src/vendors.js +2206 -1685
  8. package/__app__/src/webcomponent.js +1 -1
  9. package/config/schema.json +57 -1
  10. package/dist/THIRD-PARTY-LICENSES.md +32 -226
  11. package/dist/_chunks/filesystem.mjs +71 -70
  12. package/dist/_chunks/index.d.mts +10 -1
  13. package/dist/_chunks/index2.d.mts +112 -8
  14. package/dist/_chunks/libs/@hono/mcp.mjs +9 -9
  15. package/dist/_chunks/libs/@hono/node-server.mjs +1 -1
  16. package/dist/_chunks/libs/@logtape/logtape.d.mts +1021 -0
  17. package/dist/_chunks/libs/@logtape/logtape.mjs +4 -6
  18. package/dist/_chunks/libs/@modelcontextprotocol/sdk.d.mts +14 -14
  19. package/dist/_chunks/libs/@nanostores/react.d.mts +5 -5
  20. package/dist/_chunks/libs/destr.mjs +1 -0
  21. package/dist/_chunks/libs/fast-equals.mjs +1 -1
  22. package/dist/_chunks/libs/langium.mjs +1 -1
  23. package/dist/_chunks/libs/remeda.mjs +2 -2
  24. package/dist/_chunks/libs/tinyrainbow.mjs +1 -1
  25. package/dist/_chunks/libs/unstorage.mjs +1 -0
  26. package/dist/_chunks/node.mjs +1 -0
  27. package/dist/_chunks/sequence.mjs +1 -1
  28. package/dist/_chunks/src.mjs +14 -12
  29. package/dist/_chunks/src2.mjs +46 -46
  30. package/dist/cli/index.mjs +164 -83
  31. package/dist/index.d.mts +47 -819
  32. package/dist/index.mjs +1 -1
  33. package/dist/vite-plugin/index.mjs +1 -1
  34. package/dist/vite-plugin/internal.mjs +1 -1
  35. package/package.json +38 -37
  36. package/react/index.d.mts +80 -22
  37. package/react/index.mjs +692 -465
  38. package/vite-plugin-modules.d.ts +5 -0
  39. package/dist/_chunks/LikeC4.mjs +0 -1
  40. package/dist/_chunks/libs/@msgpack/msgpack.mjs +0 -1
  41. package/dist/_chunks/libs/@smithy/is-array-buffer.mjs +0 -1
  42. package/dist/_chunks/libs/@smithy/util-base64.mjs +0 -1
  43. package/dist/_chunks/libs/boxen.d.mts +0 -1
@@ -1,7 +1,7 @@
1
1
  import { forwardRef, createElement, useContext, createContext as createContext$1, memo as memo$1, useRef, useMemo, useCallback, useState, useEffect, Fragment as Fragment$1, useDeferredValue, useLayoutEffect, Suspense, Profiler } from "react";
2
2
  import { BBox, vector, convertPoint } from "@likec4/core/geometry";
3
3
  import { jsx, Fragment, jsxs } from "react/jsx-runtime";
4
- import { B as Background$1, a as BackgroundVariant, d as deepEqual, u as useFirstMountState, b as useCustomCompareEffect, s as shallowEqual, c as useStore, e as useStoreApi, f as useReactFlow, t, g as e, h as t$1, i as Bezier, j as getNodeDimensions, n, k as useMantineColorScheme, l as index, m as e$1, o as t$2, p as t$3, q as createSafeContext$1, r as atom, v as useStore$1, w as useSyncedRef, x as e$2, y as t$4, z as t$5, M as MantineProvider, A as createTheme, T as Tooltip$7, P as Portal, S as SegmentedControl, C as MantineContext, D as useMantineStyleNonce, L as LazyMotion, E as domMax, F as MotionConfig, G as useSelector, H as e$3, I as t$6, J as t$7, K as t$8, N as t$9, O as useId$1, Q as m, R as ThemeIcon, U as Text, V as ScrollAreaAutosize, W as Button, X as setup, Y as emit, Z as assign, _ as raise, $ as assertEvent, a0 as t$a, a1 as fromCallback, a2 as getHotkeyHandler, a3 as fromPromise, a4 as t$b, a5 as n$1, a6 as n$2, a7 as e$4, a8 as enqueueActions, a9 as r, aa as log, ab as sendTo, ac as getViewportForBounds, ad as getNodesBounds, ae as getEdgePosition, af as t$c, ag as t$d, ah as e$5, ai as t$e, aj as t$f, ak as n$3, al as dagre, am as t$g, an as t$h, ao as t$i, ap as cancel, aq as applyEdgeChanges, ar as applyNodeChanges, as as e$6, at as stopChild, au as spawnChild, av as e$7, aw as not, ax as t$j, ay as t$k, az as e$8, aA as ActionIcon, aB as MotionButton, aC as Breadcrumbs, aD as Menu, aE as UnstyledButton, aF as MotionDiv, aG as Divider$2, aH as useDebouncedCallback, aI as AnimatePresence, aJ as m$1, aK as stagger, aL as useIsMounted, aM as useHover, aN as Popover, aO as PopoverTarget, aP as PopoverDropdown, aQ as Box$1, aR as FloatingIndicator, aS as Flex$1, aT as useDebouncedCallback$1, aU as useUncontrolled, aV as clampUseMovePosition, aW as useMove, aX as useMergedRef, aY as TooltipGroup, aZ as useDebouncedValue, a_ as EdgeLabelRenderer, a$ as e$9, b0 as useDebouncedState, b1 as NodeToolbar, b2 as Position, b3 as Handle, b4 as Badge, b5 as CopyButton, b6 as HoverCard, b7 as HoverCardTarget, b8 as HoverCardDropdown, b9 as Notification, ba as isMacOs, bb as NavLink, bc as MenuTarget, bd as MenuDropdown, be as MenuItem, bf as useThrottledCallback, bg as Input, bh as rem, bi as t$l, bj as createScopedKeydownHandler, bk as Highlight, bl as useMountEffect, bm as e$a, bn as useActorRef, bo as LayoutGroup, bp as Stack, bq as useTree, br as Alert, bs as Tree$1, bt as Group, bu as getBezierPath, bv as ReactFlowProvider, bw as useStateHistory, bx as Panel, by as useClipboard, bz as Paper, bA as Anchor, bB as Pill, bC as useViewportSize, bD as useSessionStorage, bE as t$m, bF as useDragControls, bG as useMotionValue, bH as useTimeoutEffect, bI as ReactRemoveScroll, bJ as CloseButton, bK as ActionIconGroup, bL as Tabs, bM as TabsList, bN as TabsTab, bO as TabsPanel, bP as ScrollArea, bQ as useFocusTrap, bR as useReducedMotionConfig, bS as useCallbackRef$1, bT as animate, bU as e$b, bV as VisuallyHidden, bW as n$4, bX as useWindowEvent, bY as FocusTrap, bZ as Title$1, b_ as useFocusWithin, b$ as useCombobox, c0 as ComboboxOption, c1 as Combobox, c2 as ComboboxTarget, c3 as ComboboxDropdown, c4 as ComboboxOptions, c5 as ComboboxEmpty, c6 as createEmptyActor, c7 as useHotkeys, c8 as usePresence, c9 as Grid, ca as GridCol, cb as autoUpdate, cc as computePosition, cd as offset, ce as autoPlacement, cf as size, cg as hide, ch as useLocalStorage, ci as Card, cj as n$5, ck as useRerender, cl as d3line, cm as curveCatmullRomOpen, cn as useRafEffect, co as getSmoothStepPath, cp as e$c, cq as useDisclosure, cr as ViewportPortal, cs as ColorSwatch, ct as Space, cu as CheckIcon, cv as useUpdateEffect$1, cw as Slider, cx as r$1, cy as produce, cz as useTimeout, cA as useCustomCompareMemo, cB as setAutoFreeze, cC as castDraft, cD as n$6, cE as t$n, cF as nodeToRect$1, cG as and, cH as or, cI as e$d, cJ as e$e, cK as motionValue, cL as mapValue, cM as styleEffect, cN as isValidMotionProp, cO as collection, cP as useMachine, cQ as machine$6, cR as connect, cS as normalizeProps, cT as createStore, cU as shallowEqual$1, cV as useSelector$1, cW as mergeProps$1, cX as t$o } from "./vendors.js";
4
+ import { B as Background$1, a as BackgroundVariant, d as deepEqual, u as useFirstMountState, b as useCustomCompareEffect, s as shallowEqual, c as useStore, e as useStoreApi, f as useReactFlow, t, g as e, h as t$1, i as Bezier, j as getNodeDimensions, n, k as useMantineColorScheme, l as index, m as e$1, o as t$2, p as t$3, q as createSafeContext$1, r as atom, v as useStore$1, w as useSyncedRef, x as e$2, y as t$4, z as t$5, M as MantineProvider, A as createTheme, T as Tooltip$7, P as Portal, S as SegmentedControl, C as MantineContext, D as useMantineStyleNonce, L as LazyMotion, E as domMax, F as MotionConfig, G as useSelector, H as e$3, I as t$6, J as t$7, K as t$8, N as t$9, O as useId$1, Q as m, R as ThemeIcon, U as Text, V as ScrollAreaAutosize, W as Button, X as setup, Y as emit, Z as assign, _ as raise, $ as assertEvent, a0 as t$a, a1 as fromCallback, a2 as getHotkeyHandler, a3 as fromPromise, a4 as t$b, a5 as n$1, a6 as n$2, a7 as e$4, a8 as enqueueActions, a9 as r, aa as log, ab as sendTo, ac as getViewportForBounds, ad as getNodesBounds, ae as getEdgePosition, af as t$c, ag as t$d, ah as e$5, ai as t$e, aj as t$f, ak as n$3, al as dagre, am as t$g, an as t$h, ao as t$i, ap as cancel, aq as applyEdgeChanges, ar as applyNodeChanges, as as e$6, at as stopChild, au as spawnChild, av as e$7, aw as not, ax as t$j, ay as t$k, az as e$8, aA as ActionIcon, aB as MotionButton, aC as Breadcrumbs, aD as Menu, aE as UnstyledButton, aF as MotionDiv, aG as Divider$2, aH as useDebouncedCallback, aI as AnimatePresence, aJ as m$1, aK as stagger, aL as useIsMounted, aM as useHover, aN as Popover, aO as PopoverTarget, aP as PopoverDropdown, aQ as Box$1, aR as FloatingIndicator, aS as Flex$1, aT as useDebouncedCallback$1, aU as useUncontrolled, aV as clampUseMovePosition, aW as useMove, aX as useMergedRef, aY as TooltipGroup, aZ as useDebouncedValue, a_ as EdgeLabelRenderer, a$ as e$9, b0 as useDebouncedState, b1 as NodeToolbar, b2 as Position, b3 as Handle, b4 as Badge, b5 as CopyButton, b6 as HoverCard, b7 as HoverCardTarget, b8 as HoverCardDropdown, b9 as Notification, ba as isMacOs, bb as NavLink, bc as MenuTarget, bd as MenuDropdown, be as MenuItem, bf as useThrottledCallback, bg as Input, bh as rem, bi as t$l, bj as createScopedKeydownHandler, bk as Highlight, bl as useMountEffect, bm as e$a, bn as useActorRef, bo as LayoutGroup, bp as Stack, bq as useTree, br as Alert, bs as Tree$1, bt as Group, bu as getBezierPath, bv as ReactFlowProvider, bw as useStateHistory, bx as Panel, by as useClipboard, bz as Paper, bA as Anchor, bB as Pill, bC as useViewportSize, bD as useSessionStorage, bE as t$m, bF as useDragControls, bG as useMotionValue, bH as useTimeoutEffect, bI as ReactRemoveScroll, bJ as CloseButton, bK as ActionIconGroup, bL as Tabs, bM as TabsList, bN as TabsTab, bO as TabsPanel, bP as ScrollArea, bQ as useFocusTrap, bR as useReducedMotionConfig, bS as useCallbackRef$1, bT as animate, bU as e$b, bV as VisuallyHidden, bW as n$4, bX as useWindowEvent, bY as FocusTrap, bZ as Title$1, b_ as useFocusWithin, b$ as useCombobox, c0 as ComboboxOption, c1 as Combobox, c2 as ComboboxTarget, c3 as ComboboxDropdown, c4 as ComboboxOptions, c5 as ComboboxEmpty, c6 as Grid, c7 as GridCol, c8 as createEmptyActor, c9 as useHotkeys, ca as usePresence, cb as autoUpdate, cc as computePosition, cd as offset, ce as autoPlacement, cf as size, cg as hide, ch as useLocalStorage, ci as Card, cj as n$5, ck as useRerender, cl as d3line, cm as curveCatmullRomOpen, cn as useRafEffect, co as getSmoothStepPath, cp as e$c, cq as useDisclosure, cr as ViewportPortal, cs as ColorSwatch, ct as Space, cu as CheckIcon, cv as useUpdateEffect$1, cw as Slider, cx as r$1, cy as produce, cz as useTimeout, cA as useCustomCompareMemo, cB as setAutoFreeze, cC as castDraft, cD as n$6, cE as t$n, cF as nodeToRect$1, cG as and, cH as or, cI as e$d, cJ as e$e, cK as motionValue, cL as mapValue, cM as styleEffect, cN as isValidMotionProp, cO as collection, cP as useMachine, cQ as machine$6, cR as connect, cS as normalizeProps, cT as createStore, cU as shallowEqual$1, cV as useSelector$1, cW as mergeProps$1, cX as t$o } from "./vendors.js";
5
5
  import { nonexhaustive, isTagColorSpecified, invariant as invariant$1, Queue, GroupElementKind, nonNullable as nonNullable$1, isStepEdgeId, extractStep, RichText as RichText$1, ancestorsFqn, nameFromFqn, isAncestor as isAncestor$1, hasProp, DefaultMap as DefaultMap$1, whereOperatorAsPredicate, isNonEmptyArray, BBox as BBox$1, exact as exact$1, getParallelStepsPrefix, ModelFqnExpr } from "@likec4/core";
6
6
  import { invariant, nonNullable, nonexhaustive as nonexhaustive$1, toArray, ifind, DefaultMap, delay, ifirst, ifilter, compareNaturalHierarchically, compareNatural, isAncestor, sortParentsFirst, imap, stringHash, nameFromFqn as nameFromFqn$1, isome, difference, toSet, objectHash } from "@likec4/core/utils";
7
7
  import { computeRelationshipsView, treeFromElements } from "@likec4/core/compute-view";
@@ -370,23 +370,25 @@ const createReactComponent = (type, iconName, iconNamePascal, iconNode) => {
370
370
  );
371
371
  return Component.displayName = `${iconNamePascal}`, Component;
372
372
  };
373
- const __iconNode$R = [["path", { d: "M12 9v4", key: "svg-0" }], ["path", { d: "M10.363 3.591l-8.106 13.534a1.914 1.914 0 0 0 1.636 2.871h16.214a1.914 1.914 0 0 0 1.636 -2.87l-8.106 -13.536a1.914 1.914 0 0 0 -3.274 0", key: "svg-1" }], ["path", { d: "M12 16h.01", key: "svg-2" }]], IconAlertTriangle = createReactComponent("outline", "alert-triangle", "AlertTriangle", __iconNode$R);
374
- const __iconNode$Q = [["path", { d: "M7 7l10 10", key: "svg-0" }], ["path", { d: "M17 8l0 9l-9 0", key: "svg-1" }]], IconArrowDownRight = createReactComponent("outline", "arrow-down-right", "ArrowDownRight", __iconNode$Q);
375
- const __iconNode$P = [["path", { d: "M5 12l14 0", key: "svg-0" }], ["path", { d: "M5 12l6 6", key: "svg-1" }], ["path", { d: "M5 12l6 -6", key: "svg-2" }]], IconArrowLeft = createReactComponent("outline", "arrow-left", "ArrowLeft", __iconNode$P);
376
- const __iconNode$O = [["path", { d: "M5 12l14 0", key: "svg-0" }], ["path", { d: "M13 18l6 -6", key: "svg-1" }], ["path", { d: "M13 6l6 6", key: "svg-2" }]], IconArrowRight = createReactComponent("outline", "arrow-right", "ArrowRight", __iconNode$O);
377
- const __iconNode$N = [["path", { d: "M13 3l0 7l6 0l-8 11l0 -7l-6 0l8 -11", key: "svg-0" }]], IconBolt = createReactComponent("outline", "bolt", "Bolt", __iconNode$N);
378
- const __iconNode$M = [["path", { d: "M4 8h16", key: "svg-0" }], ["path", { d: "M4 6a2 2 0 0 1 2 -2h12a2 2 0 0 1 2 2v12a2 2 0 0 1 -2 2h-12a2 2 0 0 1 -2 -2l0 -12", key: "svg-1" }], ["path", { d: "M8 4v4", key: "svg-2" }]], IconBrowser = createReactComponent("outline", "browser", "Browser", __iconNode$M);
379
- const __iconNode$L = [["path", { d: "M5 12l5 5l10 -10", key: "svg-0" }]], IconCheck = createReactComponent("outline", "check", "Check", __iconNode$L);
380
- const __iconNode$K = [["path", { d: "M6 9l6 6l6 -6", key: "svg-0" }]], IconChevronDown = createReactComponent("outline", "chevron-down", "ChevronDown", __iconNode$K);
381
- const __iconNode$J = [["path", { d: "M15 6l-6 6l6 6", key: "svg-0" }]], IconChevronLeft = createReactComponent("outline", "chevron-left", "ChevronLeft", __iconNode$J);
382
- const __iconNode$I = [["path", { d: "M9 6l6 6l-6 6", key: "svg-0" }]], IconChevronRight = createReactComponent("outline", "chevron-right", "ChevronRight", __iconNode$I);
383
- const __iconNode$H = [["path", { d: "M7 9.667a2.667 2.667 0 0 1 2.667 -2.667h8.666a2.667 2.667 0 0 1 2.667 2.667v8.666a2.667 2.667 0 0 1 -2.667 2.667h-8.666a2.667 2.667 0 0 1 -2.667 -2.667l0 -8.666", key: "svg-0" }], ["path", { d: "M4.012 16.737a2.005 2.005 0 0 1 -1.012 -1.737v-10c0 -1.1 .9 -2 2 -2h10c.75 0 1.158 .385 1.5 1", key: "svg-1" }]], IconCopy = createReactComponent("outline", "copy", "Copy", __iconNode$H);
384
- const __iconNode$G = [["path", { d: "M5 6a7 3 0 1 0 14 0a7 3 0 1 0 -14 0", key: "svg-0" }], ["path", { d: "M5 6v12c0 1.657 3.134 3 7 3s7 -1.343 7 -3v-12", key: "svg-1" }]], IconCylinder = createReactComponent("outline", "cylinder", "Cylinder", __iconNode$G);
385
- const __iconNode$F = [["path", { d: "M6 5a2 2 0 0 1 2 -2h8a2 2 0 0 1 2 2v14a2 2 0 0 1 -2 2h-8a2 2 0 0 1 -2 -2v-14", key: "svg-0" }], ["path", { d: "M11 4h2", key: "svg-1" }], ["path", { d: "M12 17v.01", key: "svg-2" }]], IconDeviceMobile = createReactComponent("outline", "device-mobile", "DeviceMobile", __iconNode$F);
386
- const __iconNode$E = [["path", { d: "M12 6h-6a2 2 0 0 0 -2 2v10a2 2 0 0 0 2 2h10a2 2 0 0 0 2 -2v-6", key: "svg-0" }], ["path", { d: "M11 13l9 -9", key: "svg-1" }], ["path", { d: "M15 4h5v5", key: "svg-2" }]], IconExternalLink = createReactComponent("outline", "external-link", "ExternalLink", __iconNode$E);
387
- const __iconNode$D = [["path", { d: "M4 21v-4a3 3 0 0 1 3 -3h5", key: "svg-0" }], ["path", { d: "M9 17l3 -3l-3 -3", key: "svg-1" }], ["path", { d: "M14 3v4a1 1 0 0 0 1 1h4", key: "svg-2" }], ["path", { d: "M5 11v-6a2 2 0 0 1 2 -2h7l5 5v11a2 2 0 0 1 -2 2h-9.5", key: "svg-3" }]], IconFileSymlink = createReactComponent("outline", "file-symlink", "FileSymlink", __iconNode$D);
388
- const __iconNode$C = [["path", { d: "M14 3v4a1 1 0 0 0 1 1h4", key: "svg-0" }], ["path", { d: "M17 21h-10a2 2 0 0 1 -2 -2v-14a2 2 0 0 1 2 -2h7l5 5v11a2 2 0 0 1 -2 2", key: "svg-1" }], ["path", { d: "M9 9l1 0", key: "svg-2" }], ["path", { d: "M9 13l6 0", key: "svg-3" }], ["path", { d: "M9 17l6 0", key: "svg-4" }]], IconFileText = createReactComponent("outline", "file-text", "FileText", __iconNode$C);
389
- const __iconNode$B = [["path", { d: "M11 12a1 1 0 1 0 2 0a1 1 0 1 0 -2 0", key: "svg-0" }], ["path", { d: "M4 8v-2a2 2 0 0 1 2 -2h2", key: "svg-1" }], ["path", { d: "M4 16v2a2 2 0 0 0 2 2h2", key: "svg-2" }], ["path", { d: "M16 4h2a2 2 0 0 1 2 2v2", key: "svg-3" }], ["path", { d: "M16 20h2a2 2 0 0 0 2 -2v-2", key: "svg-4" }]], IconFocusCentered = createReactComponent("outline", "focus-centered", "FocusCentered", __iconNode$B);
373
+ const __iconNode$T = [["path", { d: "M12 9v4", key: "svg-0" }], ["path", { d: "M10.363 3.591l-8.106 13.534a1.914 1.914 0 0 0 1.636 2.871h16.214a1.914 1.914 0 0 0 1.636 -2.87l-8.106 -13.536a1.914 1.914 0 0 0 -3.274 0", key: "svg-1" }], ["path", { d: "M12 16h.01", key: "svg-2" }]], IconAlertTriangle = createReactComponent("outline", "alert-triangle", "AlertTriangle", __iconNode$T);
374
+ const __iconNode$S = [["path", { d: "M7 7l10 10", key: "svg-0" }], ["path", { d: "M17 8l0 9l-9 0", key: "svg-1" }]], IconArrowDownRight = createReactComponent("outline", "arrow-down-right", "ArrowDownRight", __iconNode$S);
375
+ const __iconNode$R = [["path", { d: "M5 12l14 0", key: "svg-0" }], ["path", { d: "M5 12l6 6", key: "svg-1" }], ["path", { d: "M5 12l6 -6", key: "svg-2" }]], IconArrowLeft = createReactComponent("outline", "arrow-left", "ArrowLeft", __iconNode$R);
376
+ const __iconNode$Q = [["path", { d: "M5 12l14 0", key: "svg-0" }], ["path", { d: "M13 18l6 -6", key: "svg-1" }], ["path", { d: "M13 6l6 6", key: "svg-2" }]], IconArrowRight = createReactComponent("outline", "arrow-right", "ArrowRight", __iconNode$Q);
377
+ const __iconNode$P = [["path", { d: "M13 3l0 7l6 0l-8 11l0 -7l-6 0l8 -11", key: "svg-0" }]], IconBolt = createReactComponent("outline", "bolt", "Bolt", __iconNode$P);
378
+ const __iconNode$O = [["path", { d: "M4 8h16", key: "svg-0" }], ["path", { d: "M4 6a2 2 0 0 1 2 -2h12a2 2 0 0 1 2 2v12a2 2 0 0 1 -2 2h-12a2 2 0 0 1 -2 -2l0 -12", key: "svg-1" }], ["path", { d: "M8 4v4", key: "svg-2" }]], IconBrowser = createReactComponent("outline", "browser", "Browser", __iconNode$O);
379
+ const __iconNode$N = [["path", { d: "M5 12l5 5l10 -10", key: "svg-0" }]], IconCheck = createReactComponent("outline", "check", "Check", __iconNode$N);
380
+ const __iconNode$M = [["path", { d: "M6 9l6 6l6 -6", key: "svg-0" }]], IconChevronDown = createReactComponent("outline", "chevron-down", "ChevronDown", __iconNode$M);
381
+ const __iconNode$L = [["path", { d: "M15 6l-6 6l6 6", key: "svg-0" }]], IconChevronLeft = createReactComponent("outline", "chevron-left", "ChevronLeft", __iconNode$L);
382
+ const __iconNode$K = [["path", { d: "M9 6l6 6l-6 6", key: "svg-0" }]], IconChevronRight = createReactComponent("outline", "chevron-right", "ChevronRight", __iconNode$K);
383
+ const __iconNode$J = [["path", { d: "M7 9.667a2.667 2.667 0 0 1 2.667 -2.667h8.666a2.667 2.667 0 0 1 2.667 2.667v8.666a2.667 2.667 0 0 1 -2.667 2.667h-8.666a2.667 2.667 0 0 1 -2.667 -2.667l0 -8.666", key: "svg-0" }], ["path", { d: "M4.012 16.737a2.005 2.005 0 0 1 -1.012 -1.737v-10c0 -1.1 .9 -2 2 -2h10c.75 0 1.158 .385 1.5 1", key: "svg-1" }]], IconCopy = createReactComponent("outline", "copy", "Copy", __iconNode$J);
384
+ const __iconNode$I = [["path", { d: "M5 6a7 3 0 1 0 14 0a7 3 0 1 0 -14 0", key: "svg-0" }], ["path", { d: "M5 6v12c0 1.657 3.134 3 7 3s7 -1.343 7 -3v-12", key: "svg-1" }]], IconCylinder = createReactComponent("outline", "cylinder", "Cylinder", __iconNode$I);
385
+ const __iconNode$H = [["path", { d: "M6 5a2 2 0 0 1 2 -2h8a2 2 0 0 1 2 2v14a2 2 0 0 1 -2 2h-8a2 2 0 0 1 -2 -2v-14", key: "svg-0" }], ["path", { d: "M11 4h2", key: "svg-1" }], ["path", { d: "M12 17v.01", key: "svg-2" }]], IconDeviceMobile = createReactComponent("outline", "device-mobile", "DeviceMobile", __iconNode$H);
386
+ const __iconNode$G = [["path", { d: "M12 6h-6a2 2 0 0 0 -2 2v10a2 2 0 0 0 2 2h10a2 2 0 0 0 2 -2v-6", key: "svg-0" }], ["path", { d: "M11 13l9 -9", key: "svg-1" }], ["path", { d: "M15 4h5v5", key: "svg-2" }]], IconExternalLink = createReactComponent("outline", "external-link", "ExternalLink", __iconNode$G);
387
+ const __iconNode$F = [["path", { d: "M14 3v4a1 1 0 0 0 1 1h4", key: "svg-0" }], ["path", { d: "M17 21h-10a2 2 0 0 1 -2 -2v-14a2 2 0 0 1 2 -2h7l5 5v11a2 2 0 0 1 -2 2", key: "svg-1" }], ["path", { d: "M10 13l-1 2l1 2", key: "svg-2" }], ["path", { d: "M14 13l1 2l-1 2", key: "svg-3" }]], IconFileCode = createReactComponent("outline", "file-code", "FileCode", __iconNode$F);
388
+ const __iconNode$E = [["path", { d: "M4 21v-4a3 3 0 0 1 3 -3h5", key: "svg-0" }], ["path", { d: "M9 17l3 -3l-3 -3", key: "svg-1" }], ["path", { d: "M14 3v4a1 1 0 0 0 1 1h4", key: "svg-2" }], ["path", { d: "M5 11v-6a2 2 0 0 1 2 -2h7l5 5v11a2 2 0 0 1 -2 2h-9.5", key: "svg-3" }]], IconFileSymlink = createReactComponent("outline", "file-symlink", "FileSymlink", __iconNode$E);
389
+ const __iconNode$D = [["path", { d: "M14 3v4a1 1 0 0 0 1 1h4", key: "svg-0" }], ["path", { d: "M17 21h-10a2 2 0 0 1 -2 -2v-14a2 2 0 0 1 2 -2h7l5 5v11a2 2 0 0 1 -2 2", key: "svg-1" }], ["path", { d: "M9 9l1 0", key: "svg-2" }], ["path", { d: "M9 13l6 0", key: "svg-3" }], ["path", { d: "M9 17l6 0", key: "svg-4" }]], IconFileText = createReactComponent("outline", "file-text", "FileText", __iconNode$D);
390
+ const __iconNode$C = [["path", { d: "M11 12a1 1 0 1 0 2 0a1 1 0 1 0 -2 0", key: "svg-0" }], ["path", { d: "M4 8v-2a2 2 0 0 1 2 -2h2", key: "svg-1" }], ["path", { d: "M4 16v2a2 2 0 0 0 2 2h2", key: "svg-2" }], ["path", { d: "M16 4h2a2 2 0 0 1 2 2v2", key: "svg-3" }], ["path", { d: "M16 20h2a2 2 0 0 0 2 -2v-2", key: "svg-4" }]], IconFocusCentered = createReactComponent("outline", "focus-centered", "FocusCentered", __iconNode$C);
391
+ const __iconNode$B = [["path", { d: "M5 19l2.757 -7.351a1 1 0 0 1 .936 -.649h12.307a1 1 0 0 1 .986 1.164l-.996 5.211a2 2 0 0 1 -1.964 1.625h-14.026a2 2 0 0 1 -2 -2v-11a2 2 0 0 1 2 -2h4l3 3h7a2 2 0 0 1 2 2v2", key: "svg-0" }]], IconFolderOpen = createReactComponent("outline", "folder-open", "FolderOpen", __iconNode$B);
390
392
  const __iconNode$A = [["path", { d: "M3 12a9 9 0 1 0 18 0a9 9 0 0 0 -18 0", key: "svg-0" }], ["path", { d: "M12 16v.01", key: "svg-1" }], ["path", { d: "M12 13a2 2 0 0 0 .914 -3.782a1.98 1.98 0 0 0 -2.414 .483", key: "svg-2" }]], IconHelpCircle = createReactComponent("outline", "help-circle", "HelpCircle", __iconNode$A);
391
393
  const __iconNode$z = [["path", { d: "M3 7a3 3 0 0 1 3 -3h12a3 3 0 0 1 3 3v10a3 3 0 0 1 -3 3h-12a3 3 0 0 1 -3 -3l0 -10", key: "svg-0" }], ["path", { d: "M7 10a2 2 0 1 0 4 0a2 2 0 1 0 -4 0", key: "svg-1" }], ["path", { d: "M15 8l2 0", key: "svg-2" }], ["path", { d: "M15 12l2 0", key: "svg-3" }], ["path", { d: "M7 16l10 0", key: "svg-4" }]], IconId = createReactComponent("outline", "id", "Id", __iconNode$z);
392
394
  const __iconNode$y = [["path", { d: "M3 12a9 9 0 1 0 18 0a9 9 0 0 0 -18 0", key: "svg-0" }], ["path", { d: "M12 9h.01", key: "svg-1" }], ["path", { d: "M11 12h1v4h1", key: "svg-2" }]], IconInfoCircle = createReactComponent("outline", "info-circle", "InfoCircle", __iconNode$y);
@@ -4159,14 +4161,14 @@ const ViewPadding = {
4159
4161
  return context2.view.id === event.view.id;
4160
4162
  if (event.type === "navigate.to")
4161
4163
  return context2.view.id === event.viewId;
4162
- nonexhaustive(event.type);
4164
+ nonexhaustive(event);
4163
4165
  },
4164
4166
  "is another view": ({ context: context2, event }) => {
4165
4167
  if (assertEvent(event, ["update.view", "navigate.to"]), event.type === "update.view")
4166
4168
  return context2.view.id !== event.view.id;
4167
4169
  if (event.type === "navigate.to")
4168
4170
  return context2.view.id !== event.viewId;
4169
- nonexhaustive(event.type);
4171
+ nonexhaustive(event);
4170
4172
  },
4171
4173
  "click: node has modelFqn": ({ event }) => (assertEvent(event, "xyflow.nodeClick"), "modelFqn" in event.node.data),
4172
4174
  "click: selected node": ({ event }) => (assertEvent(event, "xyflow.nodeClick"), event.node.selected === !0),
@@ -7862,7 +7864,7 @@ const Logo$1 = forwardRef(
7862
7864
  }
7863
7865
  ) }) : null;
7864
7866
  };
7865
- function SearchControl() {
7867
+ function SearchControl$1() {
7866
7868
  const diagram = useDiagram(), isMac = isMacOs();
7867
7869
  return /* @__PURE__ */ jsxs(
7868
7870
  UnstyledButton,
@@ -8325,7 +8327,7 @@ const selectBreadcrumbs = ({ context: context2 }) => {
8325
8327
  "actions"
8326
8328
  ),
8327
8329
  enableDynamicViewWalkthrough && isDynamicView && /* @__PURE__ */ jsx(DynamicViewControls, {}, "dynamic-view-controls"),
8328
- enableSearch && !enableCompareWithLatest && /* @__PURE__ */ jsx(SearchControl, {}, "search-control"),
8330
+ enableSearch && !enableCompareWithLatest && /* @__PURE__ */ jsx(SearchControl$1, {}, "search-control"),
8329
8331
  /* @__PURE__ */ jsx(LayoutWarning, {}, "outdated-manual-layout-warning")
8330
8332
  ] });
8331
8333
  });
@@ -8876,8 +8878,26 @@ const WalkthroughPanel = memo$1(() => {
8876
8878
  m$1.div,
8877
8879
  {
8878
8880
  layout: "position",
8879
- className: css({
8880
- 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
+ }
8881
8901
  }),
8882
8902
  initial: {
8883
8903
  opacity: 0,
@@ -8891,48 +8911,17 @@ const WalkthroughPanel = memo$1(() => {
8891
8911
  opacity: 0,
8892
8912
  translateX: -20
8893
8913
  },
8894
- children: /* @__PURE__ */ jsxs(
8895
- ScrollAreaAutosize,
8896
- {
8897
- className: vstack({
8898
- position: "absolute",
8899
- layerStyle: "likec4.dropdown",
8900
- gap: "sm",
8901
- padding: "md",
8902
- paddingTop: "xxs",
8903
- pointerEvents: "all",
8904
- maxWidth: "calc(100cqw - 32px)",
8905
- minWidth: "calc(100cqw - 50px)",
8906
- maxHeight: "calc(100cqh - 100px)",
8907
- width: "max-content",
8908
- cursor: "default",
8909
- overflow: "auto",
8910
- overscrollBehavior: "contain",
8911
- "@/sm": {
8912
- minWidth: 400,
8913
- maxWidth: 550
8914
- },
8915
- "@/lg": {
8916
- maxWidth: 700
8917
- }
8918
- }),
8919
- type: "scroll",
8920
- children: [
8921
- /* @__PURE__ */ jsx(SectionHeader, { children: "Notes" }),
8922
- /* @__PURE__ */ jsx(
8923
- Markdown,
8924
- {
8925
- value: notes,
8926
- fontSize: "sm",
8927
- emptyText: "No description",
8928
- className: css({
8929
- userSelect: "all"
8930
- })
8931
- }
8932
- )
8933
- ]
8934
- }
8935
- )
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
+ ] })
8936
8925
  }
8937
8926
  ) });
8938
8927
  }), NavigationPanel$1 = memo$1(() => {
@@ -9037,7 +9026,7 @@ const useElementDetailsActorRef = () => {
9037
9026
  if (ctx === null)
9038
9027
  throw new Error("ElementDetailsActorRef is not provided");
9039
9028
  return ctx;
9040
- }, backdropBlur$1 = "--_blur", backdropOpacity$1 = "--_opacity", dialog$1 = css({
9029
+ }, backdropBlur$1 = "--_blur", backdropOpacity$1 = "--_opacity", dialog = css({
9041
9030
  boxSizing: "border-box",
9042
9031
  margin: "0",
9043
9032
  padding: "0",
@@ -10001,7 +9990,7 @@ const node = css({
10001
9990
  color: "white"
10002
9991
  }
10003
9992
  }
10004
- }), scrollArea$2 = css({
9993
+ }), scrollArea$1 = css({
10005
9994
  maxHeight: [
10006
9995
  "70vh",
10007
9996
  "calc(100cqh - 70px)"
@@ -10010,7 +9999,7 @@ const node = css({
10010
9999
  __proto__: null,
10011
10000
  label,
10012
10001
  node,
10013
- scrollArea: scrollArea$2
10002
+ scrollArea: scrollArea$1
10014
10003
  }, Symbol.toStringTag, { value: "Module" })), selector2$1 = (state) => {
10015
10004
  const subjectExistsInScope = state.context.layouted?.subjectExistsInScope ?? !1;
10016
10005
  return {
@@ -10030,14 +10019,14 @@ const node = css({
10030
10019
  subjectExistsInScope,
10031
10020
  enableSelectSubject,
10032
10021
  enableChangeScope
10033
- } = useRelationshipsBrowserState(selector2$1), root = useRef(null), viewport = useRef(null), subject = useLikeC4Model().findElement(subjectId), data2 = useLikeC4ElementsTree(scope === "view" && viewId ? viewId : void 0), tree2 = useTree({
10022
+ } = useRelationshipsBrowserState(selector2$1), root2 = useRef(null), viewport = useRef(null), subject = useLikeC4Model().findElement(subjectId), data2 = useLikeC4ElementsTree(scope === "view" && viewId ? viewId : void 0), tree2 = useTree({
10034
10023
  multiple: !1
10035
10024
  });
10036
10025
  return tree2.setHoveredNode = setHoveredNode$2, useEffect(() => {
10037
10026
  ancestorsFqn(subjectId).reverse().forEach((id) => {
10038
10027
  tree2.expand(id);
10039
10028
  }), tree2.select(subjectId);
10040
- }, [subjectId]), /* @__PURE__ */ jsxs(Group, { ref: root, gap: "xs", pos: "relative", children: [
10029
+ }, [subjectId]), /* @__PURE__ */ jsxs(Group, { ref: root2, gap: "xs", pos: "relative", children: [
10041
10030
  enableSelectSubject && /* @__PURE__ */ jsxs(Group, { gap: 4, wrap: "nowrap", children: [
10042
10031
  /* @__PURE__ */ jsx(
10043
10032
  Box$1,
@@ -10074,7 +10063,7 @@ const node = css({
10074
10063
  children: /* @__PURE__ */ jsx(Text, { fz: "xs", fw: "500", truncate: !0, children: subject?.title ?? "???" })
10075
10064
  }
10076
10065
  ) }),
10077
- /* @__PURE__ */ jsx(PopoverDropdown, { p: 0, miw: 250, maw: 400, children: /* @__PURE__ */ jsx(ScrollAreaAutosize, { scrollbars: "y", type: "never", viewportRef: viewport, className: scrollArea$2, children: /* @__PURE__ */ jsx(
10066
+ /* @__PURE__ */ jsx(PopoverDropdown, { p: 0, miw: 250, maw: 400, children: /* @__PURE__ */ jsx(ScrollAreaAutosize, { scrollbars: "y", type: "never", viewportRef: viewport, className: scrollArea$1, children: /* @__PURE__ */ jsx(
10078
10067
  Tree$1,
10079
10068
  {
10080
10069
  allowRangeSelection: !1,
@@ -10169,7 +10158,7 @@ const node = css({
10169
10158
  position: "bottom-start",
10170
10159
  disabled: subjectExistsInScope,
10171
10160
  portalProps: {
10172
- target: root.current
10161
+ target: root2.current
10173
10162
  },
10174
10163
  children: /* @__PURE__ */ jsx(
10175
10164
  SegmentedControl,
@@ -10835,7 +10824,7 @@ function ElementDetailsCard({
10835
10824
  m$1.dialog,
10836
10825
  {
10837
10826
  ref,
10838
- className: cx(dialog$1, ReactRemoveScroll.classNames.fullWidth),
10827
+ className: cx(dialog, ReactRemoveScroll.classNames.fullWidth),
10839
10828
  layout: !0,
10840
10829
  initial: {
10841
10830
  [backdropBlur$1]: "0px",
@@ -11880,7 +11869,7 @@ css({
11880
11869
  alignItems: "baseline",
11881
11870
  justifyItems: "start"
11882
11871
  });
11883
- const scrollArea$1 = css({
11872
+ const scrollArea = css({
11884
11873
  maxHeight: [
11885
11874
  "70vh",
11886
11875
  "calc(100cqh - 70px)"
@@ -11950,7 +11939,7 @@ const scrollArea$1 = css({
11950
11939
  ]
11951
11940
  }
11952
11941
  ) }),
11953
- /* @__PURE__ */ jsx(PopoverDropdown, { p: 0, miw: 250, maw: 400, children: /* @__PURE__ */ jsx(ScrollAreaAutosize, { className: scrollArea$1, scrollbars: "y", type: "never", viewportRef: viewport, children: /* @__PURE__ */ jsx(Box$1, { className: edgeGrid, p: "xs", maw: 400, children: edges.map((e2) => /* @__PURE__ */ jsxs(
11942
+ /* @__PURE__ */ jsx(PopoverDropdown, { p: 0, miw: 250, maw: 400, children: /* @__PURE__ */ jsx(ScrollAreaAutosize, { className: scrollArea, scrollbars: "y", type: "never", viewportRef: viewport, children: /* @__PURE__ */ jsx(Box$1, { className: edgeGrid, p: "xs", maw: 400, children: edges.map((e2) => /* @__PURE__ */ jsxs(
11954
11943
  "div",
11955
11944
  {
11956
11945
  className: edgeRow,
@@ -12261,32 +12250,27 @@ const select$1 = (s) => s.children.search ?? null;
12261
12250
  function useSearchActorRef() {
12262
12251
  return useDiagramSnapshot(select$1, Object.is);
12263
12252
  }
12264
- function useSearchActor() {
12265
- const searchActorRef = useSearchActorRef();
12266
- if (!searchActorRef)
12267
- throw new Error("Search actor not found");
12268
- return searchActorRef;
12253
+ const SearchContext = createContext$1(null);
12254
+ function useSearchContext() {
12255
+ const ctx = useContext(SearchContext);
12256
+ if (!ctx)
12257
+ throw new Error("useSearchContext must be used within a SearchContext.Provider");
12258
+ return ctx;
12269
12259
  }
12270
- const selectSearchValue = (s) => s.context.searchValue;
12271
- function useSearch() {
12272
- const searchActorRef = useSearchActor(), searchValue = useSelector(searchActorRef, selectSearchValue), updateSearch = useCallback((search) => {
12273
- searchActorRef.send({ type: "change.search", search });
12274
- }, [searchActorRef]);
12275
- return [searchValue, updateSearch];
12260
+ function normalizeSearch(value) {
12261
+ if (value === "") return value;
12262
+ const v = value.trim().toLowerCase();
12263
+ return v.startsWith("#") && v.length <= 2 ? "" : v.length > 1 ? v : "";
12276
12264
  }
12277
- const selectNormalizedSearchValue = (s) => {
12278
- let v = selectSearchValue(s);
12279
- return v === "" ? v : (v = v.trim().toLowerCase(), v.startsWith("#") && v.length <= 2 ? "" : v.length > 1 ? v : "");
12280
- };
12281
12265
  function useNormalizedSearch() {
12282
- const searchActorRef = useSearchActor();
12283
- return useDeferredValue(useSelector(searchActorRef, selectNormalizedSearchValue));
12266
+ const ctx = useSearchContext();
12267
+ return useDeferredValue(ctx.normalizedSearch);
12284
12268
  }
12285
12269
  function useUpdateSearch() {
12286
- const searchActorRef = useSearchActor();
12270
+ const { setSearchValue } = useSearchContext();
12287
12271
  return useCallback((search) => {
12288
- searchActorRef.send({ type: "change.search", search });
12289
- }, [searchActorRef]);
12272
+ setSearchValue(search);
12273
+ }, [setSearchValue]);
12290
12274
  }
12291
12275
  const buttonFocused = css.raw({
12292
12276
  outline: "none",
@@ -12502,12 +12486,12 @@ function moveFocusToSearchInput(from) {
12502
12486
  console.error("moveFocusToSearchInput: from is null or undefined");
12503
12487
  return;
12504
12488
  }
12505
- const root = from.getRootNode();
12506
- if (!e$2(root.querySelector)) {
12489
+ const root2 = from.getRootNode();
12490
+ if (!e$2(root2.querySelector)) {
12507
12491
  console.error("moveFocusToSearchInput: root.querySelector is not a function");
12508
12492
  return;
12509
12493
  }
12510
- let input2 = root.querySelector("[data-likec4-search-input]");
12494
+ let input2 = root2.querySelector("[data-likec4-search-input]");
12511
12495
  if (input2) {
12512
12496
  const length = input2.value.length;
12513
12497
  input2.focus(), input2.setSelectionRange(length, length);
@@ -12518,18 +12502,18 @@ function focusToFirstFoundElement(from) {
12518
12502
  console.error("focusToFirstFoundElement: from is null or undefined");
12519
12503
  return;
12520
12504
  }
12521
- const root = from.getRootNode();
12522
- if (!e$2(root.querySelector)) {
12505
+ const root2 = from.getRootNode();
12506
+ if (!e$2(root2.querySelector)) {
12523
12507
  console.error("focusToFirstFoundElement: root.querySelector is not a function");
12524
12508
  return;
12525
12509
  }
12526
- root.querySelector(`[data-likec4-search] .${focusable}`)?.focus();
12510
+ root2.querySelector(`[data-likec4-search] .${focusable}`)?.focus();
12527
12511
  }
12528
12512
  function queryAllFocusable(from, where, selector3 = `.${focusable}`) {
12529
12513
  if (!from)
12530
12514
  return console.error("queryAllFocusable: from is null or undefined"), [];
12531
- const root = from.getRootNode();
12532
- return e$2(root.querySelectorAll) ? [...root.querySelectorAll(`[data-likec4-search-${where}] ${selector3}`)] : (console.error("queryAllFocusable: root.querySelectorAll is not a function"), []);
12515
+ const root2 = from.getRootNode();
12516
+ return e$2(root2.querySelectorAll) ? [...root2.querySelectorAll(`[data-likec4-search-${where}] ${selector3}`)] : (console.error("queryAllFocusable: root.querySelectorAll is not a function"), []);
12533
12517
  }
12534
12518
  const _viewBtn = "likec4-view-btn", viewButton = cx(
12535
12519
  css({
@@ -12556,7 +12540,7 @@ css({
12556
12540
  }
12557
12541
  });
12558
12542
  const NothingFound = () => /* @__PURE__ */ jsx(Box, { className: emptyBoX, children: "Nothing found" }), useFoundViews = () => {
12559
- const currentViewId = useCurrentViewId(), likec4model = useLikeC4Model(), search = useNormalizedSearch();
12543
+ const { currentViewId } = useSearchContext(), likec4model = useLikeC4Model(), search = useNormalizedSearch();
12560
12544
  return useMemo(() => {
12561
12545
  let views = [...likec4model.views()];
12562
12546
  if (search)
@@ -12606,7 +12590,7 @@ const NothingFound = () => /* @__PURE__ */ jsx(Box, { className: emptyBoX, child
12606
12590
  ViewButton,
12607
12591
  {
12608
12592
  view,
12609
- currentViewId,
12593
+ currentViewId: currentViewId ?? "",
12610
12594
  search,
12611
12595
  tabIndex: i === 0 ? 0 : -1
12612
12596
  }
@@ -12616,12 +12600,8 @@ const NothingFound = () => /* @__PURE__ */ jsx(Box, { className: emptyBoX, child
12616
12600
  );
12617
12601
  }), btn$1 = buttonsva();
12618
12602
  function ViewButton({ className, view, loop = !1, search, focusOnElement, currentViewId, ...props }) {
12619
- const searchActorRef = useSearchActor(), nextViewId = view.id, isCurrentView = nextViewId === currentViewId, navigate = () => {
12620
- searchActorRef.send({
12621
- type: "navigate.to",
12622
- viewId: nextViewId,
12623
- focusOnElement
12624
- });
12603
+ const ctx = useSearchContext(), nextViewId = view.id, isCurrentView = nextViewId === currentViewId, navigate = () => {
12604
+ ctx.navigateTo(nextViewId, focusOnElement);
12625
12605
  };
12626
12606
  return /* @__PURE__ */ jsxs(
12627
12607
  UnstyledButton,
@@ -12711,7 +12691,7 @@ function useElementsColumnData() {
12711
12691
  elements,
12712
12692
  t$g((acc, treeItem) => {
12713
12693
  treeItem.children = [], byid[treeItem.value] = treeItem;
12714
- const parent = acc.all.findLast((root) => isAncestor(root.value, treeItem.value));
12694
+ const parent = acc.all.findLast((root2) => isAncestor(root2.value, treeItem.value));
12715
12695
  return parent ? parent.children.push(treeItem) : acc.roots.push(treeItem), acc.all.push(treeItem), acc.hash = stringHash(acc.hash + treeItem.value), acc;
12716
12696
  }, {
12717
12697
  hash: "empty",
@@ -12877,21 +12857,17 @@ function ElementTreeNode({ node: node2, elementProps, hasChildren, expanded, han
12877
12857
  ] });
12878
12858
  }
12879
12859
  function useHandleElementSelection() {
12880
- const searchActorRef = useSearchActor();
12860
+ const ctx = useSearchContext();
12881
12861
  return useCallbackRef((element) => {
12882
12862
  const views = [...element.views()];
12883
12863
  if (views.length === 0)
12884
12864
  return;
12885
12865
  const elementFqn = element.id, onlyOneViewId = t$f(views)?.id;
12886
12866
  if (!onlyOneViewId) {
12887
- searchActorRef.send({ type: "pickview.open", elementFqn });
12867
+ ctx.openPickView(elementFqn);
12888
12868
  return;
12889
12869
  }
12890
- searchActorRef.send({
12891
- type: "navigate.to",
12892
- viewId: onlyOneViewId,
12893
- focusOnElement: elementFqn
12894
- });
12870
+ ctx.navigateTo(onlyOneViewId, elementFqn);
12895
12871
  });
12896
12872
  }
12897
12873
  const input = css({
@@ -12948,14 +12924,13 @@ css({
12948
12924
  }
12949
12925
  });
12950
12926
  function PickView({
12951
- searchActorRef,
12952
12927
  elementFqn
12953
12928
  }) {
12954
- const currentViewId = useCurrentViewId(), element = useLikeC4Model().element(elementFqn), scoped = [], others = [];
12929
+ const ctx = useSearchContext(), currentViewId = ctx.currentViewId ?? "", element = useLikeC4Model().element(elementFqn), scoped = [], others = [];
12955
12930
  for (const view of element.views())
12956
12931
  view.viewOf === element ? scoped.push(view) : others.push(view);
12957
12932
  const closePickView = () => {
12958
- searchActorRef.send({ type: "pickview.close" });
12933
+ ctx.closePickView();
12959
12934
  };
12960
12935
  return useWindowEvent(
12961
12936
  "keydown",
@@ -13137,7 +13112,7 @@ function startingWithKind(search) {
13137
13112
  return search.match(/^(k|ki|kin|kind|kind:)$/) != null;
13138
13113
  }
13139
13114
  const SEARCH_PREFIXES = ["#", "kind:"], LikeC4SearchInput = memo$1(() => {
13140
- const searchActorRef = useSearchActor(), likec4model = useLikeC4Model(), inputRef = useRef(null), { ref, focused: focused2 } = useFocusWithin(), [search, setSearch] = useSearch(), combobox = useCombobox({
13115
+ const searchCtx = useSearchContext(), likec4model = useLikeC4Model(), inputRef = useRef(null), { ref, focused: focused2 } = useFocusWithin(), { searchValue: search, setSearchValue: setSearch } = searchCtx, combobox = useCombobox({
13141
13116
  scrollBehavior: "smooth",
13142
13117
  loop: !1
13143
13118
  });
@@ -13222,9 +13197,7 @@ const SEARCH_PREFIXES = ["#", "kind:"], LikeC4SearchInput = memo$1(() => {
13222
13197
  Input.ClearButton,
13223
13198
  {
13224
13199
  onClick: (e2) => {
13225
- e2.stopPropagation();
13226
- const openedWithSearch = searchActorRef.getSnapshot().context.openedWithSearch;
13227
- search === "" || search === openedWithSearch ? searchActorRef.send({ type: "close" }) : setSearch("");
13200
+ e2.stopPropagation(), search === "" || search === searchCtx.openedWithSearch ? searchCtx.close() : setSearch("");
13228
13201
  }
13229
13202
  }
13230
13203
  ),
@@ -13275,23 +13248,58 @@ const SEARCH_PREFIXES = ["#", "kind:"], LikeC4SearchInput = memo$1(() => {
13275
13248
  ]
13276
13249
  }
13277
13250
  );
13278
- }), dialog = css({
13251
+ }), selectSearchValue = (s) => s.context.searchValue, selectPickViewFor = (s) => s.context.pickViewFor, selectOpenedWithSearch = (s) => s.context.openedWithSearch;
13252
+ function XStateSearchAdapter({
13253
+ searchActorRef,
13254
+ children
13255
+ }) {
13256
+ const searchValue = useSelector(searchActorRef, selectSearchValue), pickViewFor = useSelector(searchActorRef, selectPickViewFor), openedWithSearch = useSelector(searchActorRef, selectOpenedWithSearch), currentViewId = useCurrentViewId(), setSearchValue = useCallbackRef((search) => {
13257
+ searchActorRef.send({ type: "change.search", search });
13258
+ }), navigateTo = useCallbackRef((viewId, focusOnElement) => {
13259
+ searchActorRef.send({
13260
+ type: "navigate.to",
13261
+ viewId,
13262
+ focusOnElement
13263
+ });
13264
+ }), openPickView = useCallbackRef((elementFqn) => {
13265
+ searchActorRef.send({ type: "pickview.open", elementFqn });
13266
+ }), closePickView = useCallbackRef(() => {
13267
+ searchActorRef.send({ type: "pickview.close" });
13268
+ }), close = useCallbackRef(() => {
13269
+ searchActorRef.send({ type: "close" });
13270
+ }), value = useMemo(() => ({
13271
+ searchValue,
13272
+ setSearchValue,
13273
+ normalizedSearch: normalizeSearch(searchValue),
13274
+ navigateTo,
13275
+ openPickView,
13276
+ closePickView,
13277
+ pickViewFor,
13278
+ close,
13279
+ currentViewId,
13280
+ openedWithSearch
13281
+ }), [
13282
+ searchValue,
13283
+ pickViewFor,
13284
+ currentViewId,
13285
+ openedWithSearch,
13286
+ // stable refs from useCallbackRef — listed for exhaustive-deps lint rule
13287
+ setSearchValue,
13288
+ navigateTo,
13289
+ openPickView,
13290
+ closePickView,
13291
+ close
13292
+ ]);
13293
+ return /* @__PURE__ */ jsx(SearchContext.Provider, { value, children });
13294
+ }
13295
+ const dialogCss = css({
13279
13296
  backgroundColor: "[rgb(34 34 34 / var(--_opacity, 95%))]",
13280
13297
  _light: {
13281
13298
  backgroundColor: "[rgb(250 250 250 / var(--_opacity, 95%))]"
13282
13299
  },
13283
13300
  backdropFilter: "auto",
13284
13301
  backdropBlur: "var(--_blur, 10px)"
13285
- // base: `[rgb(34 34 34 / var(${backdropOpacity}))]`,
13286
- // _light: `[rgb(255 255 255/ var(${backdropOpacity}))]`,
13287
- // },
13288
- }), body = css({
13289
- // containerName: 'likec4-search',
13290
- // containerType: 'size',
13291
- // position: 'fixed',
13292
- // zIndex: 901,
13293
- // top: '0',
13294
- // left: '0',
13302
+ }), bodyCss = css({
13295
13303
  width: "100%",
13296
13304
  height: "100%",
13297
13305
  maxHeight: "100vh",
@@ -13305,11 +13313,7 @@ const SEARCH_PREFIXES = ["#", "kind:"], LikeC4SearchInput = memo$1(() => {
13305
13313
  paddingRight: "md",
13306
13314
  paddingBottom: "sm",
13307
13315
  background: "transparent"
13308
- // backgroundColor: {
13309
- // _dark: `[rgb(34 34 34 / 0.95)]`,
13310
- // _light: `[rgb(255 255 255/ 0.95)]`,
13311
- // },
13312
- }), scrollArea = css({
13316
+ }), scrollAreaCss = css({
13313
13317
  height: [
13314
13318
  "100%",
13315
13319
  "100cqh"
@@ -13352,33 +13356,20 @@ const SEARCH_PREFIXES = ["#", "kind:"], LikeC4SearchInput = memo$1(() => {
13352
13356
  opacity: 0.9
13353
13357
  },
13354
13358
  classes: {
13355
- dialog,
13356
- body
13359
+ dialog: dialogCss,
13360
+ body: bodyCss
13357
13361
  },
13358
13362
  openDelay: 0,
13359
13363
  onClose: close,
13360
13364
  "data-likec4-search": "true",
13361
- children: /* @__PURE__ */ jsx(SearchOverlayBody, { searchActorRef })
13365
+ children: /* @__PURE__ */ jsx(XStateSearchAdapter, { searchActorRef, children: /* @__PURE__ */ jsx(SearchOverlayBody, { searchActorRef }) })
13362
13366
  }
13363
13367
  ) });
13364
13368
  });
13365
13369
  Search.displayName = "Search";
13366
- const selectPickViewFor = (s) => s.context.pickViewFor, SearchOverlayBody = memo$1(({ searchActorRef }) => {
13367
- const ref = useRef(null), pickViewFor = useSelector(searchActorRef, selectPickViewFor);
13368
- useTimeoutEffect(() => {
13369
- e$8(searchActorRef.getSnapshot().context.openedWithSearch) && focusToFirstFoundElement(ref.current);
13370
- }, 150);
13371
- const [isPresent, safeToRemove] = usePresence();
13372
- return useEffect(() => {
13373
- if (!isPresent) {
13374
- safeToRemove();
13375
- try {
13376
- searchActorRef.send({ type: "animation.presence.end" });
13377
- } catch (e2) {
13378
- console.debug("SearchOverlayBody: animation.presence.end failed", e2);
13379
- }
13380
- }
13381
- }, [isPresent, searchActorRef, safeToRemove]), /* @__PURE__ */ jsxs(Box, { ref, display: "contents", children: [
13370
+ const SearchPanelContent = memo$1(() => {
13371
+ const ref = useRef(null), { pickViewFor } = useSearchContext();
13372
+ return /* @__PURE__ */ jsxs(Box, { ref, display: "contents", children: [
13382
13373
  /* @__PURE__ */ jsx(
13383
13374
  Group,
13384
13375
  {
@@ -13411,7 +13402,7 @@ const selectPickViewFor = (s) => s.context.pickViewFor, SearchOverlayBody = memo
13411
13402
  ScrollArea,
13412
13403
  {
13413
13404
  type: "scroll",
13414
- className: scrollArea,
13405
+ className: scrollAreaCss,
13415
13406
  pr: "xs",
13416
13407
  scrollbars: "y",
13417
13408
  children: /* @__PURE__ */ jsx(LayoutGroup, { id: "likec4-search-elements", children: /* @__PURE__ */ jsx(Suspense, { children: /* @__PURE__ */ jsx(ElementsColumn, {}) }) })
@@ -13421,7 +13412,7 @@ const selectPickViewFor = (s) => s.context.pickViewFor, SearchOverlayBody = memo
13421
13412
  ScrollArea,
13422
13413
  {
13423
13414
  type: "scroll",
13424
- className: scrollArea,
13415
+ className: scrollAreaCss,
13425
13416
  pr: "xs",
13426
13417
  scrollbars: "y",
13427
13418
  children: /* @__PURE__ */ jsx(Suspense, { children: /* @__PURE__ */ jsx(LayoutGroup, { id: "likec4-search-views", children: /* @__PURE__ */ jsx(ViewsColumn, {}) }) })
@@ -13430,9 +13421,27 @@ const selectPickViewFor = (s) => s.context.pickViewFor, SearchOverlayBody = memo
13430
13421
  ]
13431
13422
  }
13432
13423
  ),
13433
- pickViewFor && /* @__PURE__ */ jsx(PickView, { searchActorRef, elementFqn: pickViewFor })
13424
+ pickViewFor && /* @__PURE__ */ jsx(PickView, { elementFqn: pickViewFor })
13434
13425
  ] });
13435
13426
  });
13427
+ SearchPanelContent.displayName = "SearchPanelContent";
13428
+ const SearchOverlayBody = memo$1(function({ searchActorRef }) {
13429
+ const ref = useRef(null);
13430
+ useTimeoutEffect(() => {
13431
+ e$8(searchActorRef.getSnapshot().context.openedWithSearch) && focusToFirstFoundElement(ref.current);
13432
+ }, 150);
13433
+ const [isPresent, safeToRemove] = usePresence();
13434
+ return useEffect(() => {
13435
+ if (!isPresent) {
13436
+ safeToRemove();
13437
+ try {
13438
+ searchActorRef.send({ type: "animation.presence.end" });
13439
+ } catch (e2) {
13440
+ console.debug("SearchOverlayBody: animation.presence.end failed", e2);
13441
+ }
13442
+ }
13443
+ }, [isPresent, searchActorRef, safeToRemove]), /* @__PURE__ */ jsx(Box, { ref, display: "contents", children: /* @__PURE__ */ jsx(SearchPanelContent, {}) });
13444
+ });
13436
13445
  function PortalToContainer({ children }) {
13437
13446
  const ctx = useRootContainerContext();
13438
13447
  if (!ctx)
@@ -16944,8 +16953,7 @@ function diagramToXY(opts) {
16944
16953
  data: {
16945
16954
  isViewGroup: !0,
16946
16955
  ...compoundData
16947
- },
16948
- dragHandle: ".likec4-compound-title-container"
16956
+ }
16949
16957
  });
16950
16958
  continue;
16951
16959
  }
@@ -20073,6 +20081,87 @@ function LikeC4ProjectsOverview({
20073
20081
  ) })
20074
20082
  ] }) });
20075
20083
  }
20084
+ const root = css({
20085
+ height: "30px",
20086
+ paddingLeft: "sm",
20087
+ paddingRight: "1",
20088
+ borderRadius: "sm",
20089
+ // TODO
20090
+ // color: fallbackVar('var(--search-color)', 'mantine.colors.placeholder)',
20091
+ border: "1px solid",
20092
+ borderColor: {
20093
+ base: "default.border",
20094
+ _light: "mantine.colors.gray[4]",
20095
+ _dark: "mantine.colors.dark[4]",
20096
+ _hover: "default.border"
20097
+ },
20098
+ cursor: "pointer",
20099
+ background: {
20100
+ base: "default",
20101
+ _light: "white",
20102
+ _dark: "mantine.colors.dark[6]",
20103
+ _hover: "default.hover"
20104
+ },
20105
+ width: "100%",
20106
+ "& .tabler-icon": {
20107
+ color: "text"
20108
+ },
20109
+ transition: {
20110
+ base: "fast",
20111
+ _whenPanning: "none !important"
20112
+ },
20113
+ boxShadow: {
20114
+ base: "xs",
20115
+ _hover: "sm",
20116
+ _whenPanning: "none !important"
20117
+ }
20118
+ }), placeholder = css({
20119
+ fontSize: "sm",
20120
+ // mantine.fontSizes.sm,
20121
+ fontWeight: "medium",
20122
+ paddingRight: "2.5",
20123
+ // 10px
20124
+ color: "text.placeholder",
20125
+ flex: "1",
20126
+ sm: {
20127
+ paddingRight: "[30px]"
20128
+ },
20129
+ md: {
20130
+ paddingRight: "[50px]"
20131
+ }
20132
+ }), shortcut = css({
20133
+ fontSize: "11px",
20134
+ fontWeight: "bold",
20135
+ lineHeight: 1,
20136
+ padding: "[4px 7px]",
20137
+ borderRadius: "sm",
20138
+ border: "1px solid",
20139
+ transition: "fast",
20140
+ _light: {
20141
+ color: "mantine.colors.gray[7]",
20142
+ borderColor: "mantine.colors.gray[2]"
20143
+ },
20144
+ _dark: {
20145
+ color: "mantine.colors.dark[0]",
20146
+ borderColor: "mantine.colors.dark[7]"
20147
+ },
20148
+ backgroundColor: {
20149
+ _light: "mantine.colors.gray[2]/70",
20150
+ _dark: "mantine.colors.dark[8]/70",
20151
+ _groupHover: {
20152
+ _light: "mantine.colors.gray[2]",
20153
+ _dark: "mantine.colors.dark[8]"
20154
+ }
20155
+ }
20156
+ });
20157
+ function SearchControl({ className, ...others }) {
20158
+ const isMac = isMacOs();
20159
+ return /* @__PURE__ */ jsx(UnstyledButton, { ...others, className: cx("group", root, className), children: /* @__PURE__ */ jsxs(Group, { gap: "xs", children: [
20160
+ /* @__PURE__ */ jsx(IconSearch, { style: { width: "15px", height: "15px" }, stroke: 2 }),
20161
+ /* @__PURE__ */ jsx(Text, { component: "div", className: placeholder, children: "Search" }),
20162
+ /* @__PURE__ */ jsx(Text, { component: "div", className: shortcut, children: isMac ? "⌘ + K" : "Ctrl + K" })
20163
+ ] }) });
20164
+ }
20076
20165
  const statebtn = cva({
20077
20166
  base: {
20078
20167
  border: "none",
@@ -21082,35 +21171,51 @@ const LikeC4AdHocView = memo$1(({ id }) => {
21082
21171
  }, [actorRef, diagram]), null;
21083
21172
  });
21084
21173
  export {
21174
+ IconAlertTriangle as A,
21085
21175
  Box as B,
21176
+ IconCheck as C,
21177
+ IconCopy as D,
21178
+ IconExternalLink as E,
21179
+ FramerMotionConfig as F,
21180
+ IconShare as G,
21181
+ pickViewBounds as H,
21086
21182
  IconRendererProvider as I,
21183
+ LikeC4Diagram as J,
21184
+ useDiagramContext as K,
21087
21185
  LikeC4ProjectsProvider as L,
21088
21186
  Markdown as M,
21089
- StaticLikeC4Diagram as S,
21187
+ NavigationPanel as N,
21188
+ Overlay as O,
21189
+ useDiagram as P,
21190
+ useOnDiagramEvent as Q,
21191
+ LikeC4EditorProvider as R,
21192
+ SearchContext as S,
21193
+ useChangeLikeC4Project as T,
21194
+ LikeC4ProjectsOverview as U,
21090
21195
  LikeC4ModelProvider as a,
21091
- LikeC4AdHocViewEditor as b,
21196
+ IconMoonStars as b,
21092
21197
  css as c,
21093
- IconMoonStars as d,
21094
- IconSun as e,
21095
- createStyleContext as f,
21096
- useLikeC4Projects as g,
21097
- IconChevronDown as h,
21098
- isCssProperty as i,
21099
- IconAlertTriangle as j,
21100
- IconCheck as k,
21101
- IconCopy as l,
21102
- IconExternalLink as m,
21103
- navigationPanel as n,
21104
- IconShare as o,
21105
- pickViewBounds as p,
21106
- LikeC4Diagram as q,
21107
- useLikeC4Model as r,
21198
+ IconSun as d,
21199
+ SearchControl as e,
21200
+ bodyCss as f,
21201
+ dialogCss as g,
21202
+ SearchPanelContent as h,
21203
+ useLikeC4Model as i,
21204
+ StaticLikeC4Diagram as j,
21205
+ IconStarFilled as k,
21206
+ IconStack2 as l,
21207
+ IconLayoutDashboard as m,
21208
+ normalizeSearch as n,
21209
+ IconFileCode as o,
21210
+ IconFolderOpen as p,
21211
+ IconFolderFilled as q,
21212
+ IconArrowLeft as r,
21108
21213
  styled as s,
21109
- useDiagramContext as t,
21214
+ LikeC4AdHocViewEditor as t,
21110
21215
  useUpdateEffect as u,
21111
- useDiagram as v,
21112
- useOnDiagramEvent as w,
21113
- LikeC4EditorProvider as x,
21114
- useChangeLikeC4Project as y,
21115
- LikeC4ProjectsOverview as z
21216
+ createStyleContext as v,
21217
+ navigationPanel as w,
21218
+ isCssProperty as x,
21219
+ useLikeC4Projects as y,
21220
+ IconChevronDown as z
21116
21221
  };