@likec4/diagram 1.28.0 → 1.29.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 (162) hide show
  1. package/bundle/index.js +1040 -1190
  2. package/dist/LikeC4CustomColors.js +2 -2
  3. package/dist/LikeC4Diagram.js +2 -2
  4. package/dist/LikeC4ModelProvider.js +1 -1
  5. package/dist/_virtual/index.js +5 -0
  6. package/dist/_virtual/index2.js +3 -0
  7. package/dist/_virtual/react.production.js +3 -0
  8. package/dist/base/BaseXYFlow.js +5 -5
  9. package/dist/base/primitives/compound/CompoundActionButton.js +1 -1
  10. package/dist/base/primitives/compound/CompoundDetailsButton.js +1 -1
  11. package/dist/base/primitives/compound/CompoundNodeContainer.d.ts +1 -1
  12. package/dist/base/primitives/compound/CompoundNodeContainer.js +2 -2
  13. package/dist/base/primitives/customEdge.d.ts +1 -1
  14. package/dist/base/primitives/customEdge.js +3 -3
  15. package/dist/base/primitives/customNode.js +2 -2
  16. package/dist/base/primitives/edge/EdgeContainer.js +1 -1
  17. package/dist/base/primitives/edge/EdgeLabel.css.d.ts +3 -0
  18. package/dist/base/primitives/edge/EdgeLabel.css.js +3 -0
  19. package/dist/base/primitives/edge/EdgeLabel.d.ts +1 -1
  20. package/dist/base/primitives/edge/EdgeLabel.js +3 -2
  21. package/dist/base/primitives/edge/EdgeLabelContainer.js +1 -1
  22. package/dist/base/primitives/edge/EdgePath.d.ts +10 -42
  23. package/dist/base/primitives/edge/EdgePath.js +23 -16
  24. package/dist/base/primitives/edge/edge.css.js +1 -1
  25. package/dist/base/primitives/element/ElementActionButtons.js +1 -2
  26. package/dist/base/primitives/element/ElementDetailsButton.js +1 -2
  27. package/dist/base/primitives/element/ElementNodeContainer.js +3 -3
  28. package/dist/base/updateEdges.js +7 -2
  29. package/dist/base/updateNodes.js +11 -3
  30. package/dist/bundle/LikeC4View.js +3 -3
  31. package/dist/bundle/ReactLikeC4.js +1 -1
  32. package/dist/bundle/ShadowRoot.js +3 -3
  33. package/dist/bundle/styles.css.js +3 -3
  34. package/dist/context/ControlsCustomLayout.js +1 -1
  35. package/dist/context/DiagramEventHandlers.js +5 -5
  36. package/dist/context/DiagramFeatures.js +7 -7
  37. package/dist/context/EnsureMantine.js +2 -2
  38. package/dist/context/FramerMotionConfig.js +2 -2
  39. package/dist/context/IconRenderer.js +4 -4
  40. package/dist/context/ReduceGraphics.js +2 -2
  41. package/dist/context/RootContainer.js +5 -9
  42. package/dist/hooks/safeContext.d.ts +2 -5
  43. package/dist/hooks/safeContext.js +5 -4
  44. package/dist/hooks/useCurrentViewId.js +1 -1
  45. package/dist/hooks/useDiagram.d.ts +715 -150
  46. package/dist/hooks/useDiagram.js +2 -2
  47. package/dist/hooks/useMantinePortalProps.js +2 -2
  48. package/dist/hooks/useSetState.js +3 -3
  49. package/dist/hooks/useUpdateEffect.js +1 -1
  50. package/dist/hooks/useXYFlow.d.ts +2 -2
  51. package/dist/likec4diagram/DiagramUI.js +2 -2
  52. package/dist/likec4diagram/DiagramXYFlow.js +2 -2
  53. package/dist/likec4diagram/custom/edges/NotePopover.js +2 -2
  54. package/dist/likec4diagram/custom/edges/RelationshipEdge.d.ts +2 -2
  55. package/dist/likec4diagram/custom/edges/RelationshipEdge.js +7 -7
  56. package/dist/likec4diagram/custom/edges/RelationshipsDropdownMenu.js +6 -6
  57. package/dist/likec4diagram/custom/index.d.ts +1 -2
  58. package/dist/likec4diagram/custom/nodes/toolbar/ColorButton.js +2 -2
  59. package/dist/likec4diagram/custom/nodes/toolbar/CompoundToolbar.js +3 -3
  60. package/dist/likec4diagram/custom/nodes/toolbar/_shared.js +2 -2
  61. package/dist/likec4diagram/ui/controls/ChangeAutoLayoutButton.js +4 -4
  62. package/dist/likec4diagram/ui/controls/Controls.js +9 -9
  63. package/dist/likec4diagram/ui/controls/NavigationButtons.js +1 -1
  64. package/dist/likec4diagram/ui/diagram-title/DiagramTitlePanel.js +1 -1
  65. package/dist/likec4diagram/ui/notation/NotationPanel.js +4 -4
  66. package/dist/likec4diagram/ui/search/ElementsColumn.js +88 -77
  67. package/dist/likec4diagram/ui/search/LikeC4Search.d.ts +2 -1
  68. package/dist/likec4diagram/ui/search/LikeC4Search.js +27 -24
  69. package/dist/likec4diagram/ui/search/SearchInput.js +1 -1
  70. package/dist/likec4diagram/ui/search/ViewsColum.js +3 -2
  71. package/dist/likec4diagram/ui/search/state.js +11 -9
  72. package/dist/likec4diagram/ui/walkthrough/DynamicViewWalkthrough.js +1 -1
  73. package/dist/likec4diagram/useLayoutConstraints.js +3 -3
  74. package/dist/likec4model/LikeC4ModelContext.js +2 -2
  75. package/dist/likec4model/useLikeC4ElementsTree.js +2 -2
  76. package/dist/likec4model/useLikeC4Model.js +2 -2
  77. package/dist/node_modules/.pnpm/react@19.0.0/node_modules/react/cjs/react.production.js +548 -0
  78. package/dist/node_modules/.pnpm/react@19.0.0/node_modules/react/index.js +15 -0
  79. package/dist/overlays/Overlays.js +6 -6
  80. package/dist/overlays/element-details/ElementDetails.js +1 -1
  81. package/dist/overlays/element-details/ElementDetailsCard.js +5 -5
  82. package/dist/overlays/element-details/TabPanelDeployments.js +7 -4
  83. package/dist/overlays/element-details/TabPanelRelationships.js +2 -2
  84. package/dist/overlays/element-details/TabPanelStructure.js +6 -3
  85. package/dist/overlays/element-details/actor.d.ts +2 -2
  86. package/dist/overlays/element-details/actorContext.js +3 -3
  87. package/dist/overlays/overlay/Overlay.js +8 -7
  88. package/dist/overlays/relationship-details/RelationshipDetails.d.ts +1 -1
  89. package/dist/overlays/relationship-details/RelationshipDetails.js +28 -23
  90. package/dist/overlays/relationship-details/SelectEdge.js +3 -6
  91. package/dist/overlays/relationship-details/actor.d.ts +4 -1
  92. package/dist/overlays/relationship-details/custom/edgeTypes.d.ts +1 -1
  93. package/dist/overlays/relationship-details/custom/edgeTypes.js +1 -1
  94. package/dist/overlays/relationship-details/hooks.d.ts +4 -1
  95. package/dist/overlays/relationship-details/hooks.js +4 -4
  96. package/dist/overlays/relationships-browser/RelationshipsBrowser.d.ts +1 -1
  97. package/dist/overlays/relationships-browser/RelationshipsBrowser.js +9 -11
  98. package/dist/overlays/relationships-browser/SelectElement.js +8 -5
  99. package/dist/overlays/relationships-browser/actor.d.ts +2 -1
  100. package/dist/overlays/relationships-browser/actor.js +6 -12
  101. package/dist/overlays/relationships-browser/const.d.ts +2 -1
  102. package/dist/overlays/relationships-browser/const.js +6 -1
  103. package/dist/overlays/relationships-browser/custom/edgeTypes.d.ts +1 -1
  104. package/dist/overlays/relationships-browser/custom/edgeTypes.js +3 -4
  105. package/dist/overlays/relationships-browser/custom/nodeTypes.js +1 -1
  106. package/dist/overlays/relationships-browser/hooks.d.ts +2 -1
  107. package/dist/overlays/relationships-browser/hooks.js +4 -4
  108. package/dist/overlays/relationships-browser/layout.js +2 -2
  109. package/dist/overlays/relationships-browser/useViewToNodesEdges.js +1 -2
  110. package/dist/state/DiagramActorProvider.js +7 -5
  111. package/dist/state/diagram-machine.d.ts +719 -146
  112. package/dist/state/diagram-machine.js +51 -10
  113. package/dist/styles.css.js +1 -1
  114. package/package.json +20 -16
  115. package/src/LikeC4Diagram.tsx +0 -1
  116. package/src/base/BaseXYFlow.tsx +2 -2
  117. package/src/base/primitives/compound/CompoundActionButton.tsx +1 -1
  118. package/src/base/primitives/compound/CompoundDetailsButton.tsx +1 -1
  119. package/src/base/primitives/compound/CompoundNodeContainer.tsx +1 -1
  120. package/src/base/primitives/customEdge.ts +1 -0
  121. package/src/base/primitives/edge/EdgeLabel.css.ts +3 -0
  122. package/src/base/primitives/edge/EdgeLabel.tsx +2 -1
  123. package/src/base/primitives/edge/EdgePath.tsx +22 -14
  124. package/src/base/primitives/edge/edge.css.ts +1 -1
  125. package/src/base/primitives/element/ElementActionButtons.tsx +2 -2
  126. package/src/base/primitives/element/ElementDetailsButton.tsx +2 -2
  127. package/src/base/primitives/element/ElementNodeContainer.tsx +1 -1
  128. package/src/base/updateEdges.ts +6 -9
  129. package/src/base/updateNodes.ts +10 -14
  130. package/src/context/FramerMotionConfig.tsx +1 -1
  131. package/src/context/RootContainer.tsx +0 -4
  132. package/src/hooks/safeContext.tsx +3 -1
  133. package/src/likec4diagram/custom/edges/RelationshipEdge.tsx +2 -2
  134. package/src/likec4diagram/custom/edges/RelationshipsDropdownMenu.tsx +1 -1
  135. package/src/likec4diagram/ui/controls/Controls.tsx +56 -58
  136. package/src/likec4diagram/ui/controls/NavigationButtons.tsx +1 -1
  137. package/src/likec4diagram/ui/diagram-title/DiagramTitlePanel.tsx +1 -1
  138. package/src/likec4diagram/ui/notation/NotationPanel.tsx +1 -1
  139. package/src/likec4diagram/ui/search/ElementsColumn.tsx +94 -71
  140. package/src/likec4diagram/ui/search/LikeC4Search.tsx +48 -55
  141. package/src/likec4diagram/ui/search/ViewsColum.tsx +2 -2
  142. package/src/likec4diagram/ui/search/state.ts +8 -6
  143. package/src/likec4diagram/ui/walkthrough/DynamicViewWalkthrough.tsx +1 -1
  144. package/src/overlays/Overlays.tsx +2 -2
  145. package/src/overlays/element-details/ElementDetails.tsx +2 -2
  146. package/src/overlays/element-details/ElementDetailsCard.tsx +1 -1
  147. package/src/overlays/element-details/TabPanelDeployments.tsx +2 -0
  148. package/src/overlays/element-details/TabPanelStructure.tsx +2 -1
  149. package/src/overlays/overlay/Overlay.tsx +2 -1
  150. package/src/overlays/relationship-details/RelationshipDetails.tsx +25 -16
  151. package/src/overlays/relationship-details/SelectEdge.tsx +0 -14
  152. package/src/overlays/relationship-details/actor.ts +2 -1
  153. package/src/overlays/relationship-details/custom/edgeTypes.tsx +1 -1
  154. package/src/overlays/relationships-browser/RelationshipsBrowser.tsx +1 -3
  155. package/src/overlays/relationships-browser/SelectElement.tsx +2 -0
  156. package/src/overlays/relationships-browser/actor.ts +8 -13
  157. package/src/overlays/relationships-browser/const.ts +8 -1
  158. package/src/overlays/relationships-browser/custom/edgeTypes.tsx +2 -3
  159. package/src/overlays/relationships-browser/custom/nodeTypes.tsx +1 -1
  160. package/src/overlays/relationships-browser/useViewToNodesEdges.ts +1 -2
  161. package/src/state/DiagramActorProvider.tsx +7 -4
  162. package/src/state/diagram-machine.ts +50 -8
@@ -1,13 +1,13 @@
1
- import { jsxs, Fragment, jsx } from 'react/jsx-runtime';
2
- import { ifilter, toArray, sortParentsFirst, isAncestor, nameFromFqn } from '@likec4/core';
1
+ import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
2
+ import { ifilter, sortParentsFirst, isAncestor, nameFromFqn } from '@likec4/core';
3
3
  import { cx } from '@likec4/styles/css';
4
4
  import { useTree, Tree, ActionIcon, UnstyledButton, Box, Group, Highlight, Tooltip, Text } from '@mantine/core';
5
5
  import { useCallbackRef } from '@mantine/hooks';
6
6
  import { IconChevronRight } from '@tabler/icons-react';
7
7
  import clsx from 'clsx';
8
- import { m } from 'framer-motion';
9
- import { useMemo, useEffect } from 'react';
10
- import { isEmpty, pipe, reduce, indexBy, prop, first, only, partition } from 'remeda';
8
+ import * as m from 'motion/react-m';
9
+ import { r as reactExports } from '../../../_virtual/index.js';
10
+ import { isEmpty, pipe, reduce, only, partition, first } from 'remeda';
11
11
  import { IconOrShapeRenderer } from '../../../context/IconRenderer.js';
12
12
  import { sortByLabel } from '../../../likec4model/useLikeC4ElementsTree.js';
13
13
  import { useLikeC4Model } from '../../../likec4model/useLikeC4Model.js';
@@ -21,11 +21,7 @@ const btn = buttonsva();
21
21
  function ElementsColumn() {
22
22
  const search = useNormalizedSearch();
23
23
  const model = useLikeC4Model(true);
24
- const {
25
- all,
26
- byid,
27
- roots: data
28
- } = useMemo(() => {
24
+ const data = reactExports.useMemo(() => {
29
25
  const searchTerms = search.split(".");
30
26
  let elements;
31
27
  if (isEmpty(search) || search === "kind:") {
@@ -41,9 +37,9 @@ function ElementsColumn() {
41
37
  return (element.title + " " + element.id + " " + (element.description ?? "")).toLocaleLowerCase().includes(search);
42
38
  });
43
39
  }
44
- const { all: all2, roots } = pipe(
45
- elements,
46
- toArray(),
40
+ const byid = {};
41
+ const { all, roots } = pipe(
42
+ [...elements],
47
43
  sortParentsFirst,
48
44
  reduce((acc, element) => {
49
45
  const treeItem = {
@@ -53,6 +49,7 @@ function ElementsColumn() {
53
49
  searchTerms,
54
50
  children: []
55
51
  };
52
+ byid[treeItem.value] = treeItem;
56
53
  const parent = acc.all.findLast((root) => isAncestor(root.value, treeItem.value));
57
54
  if (parent) {
58
55
  parent.children.push(treeItem);
@@ -70,15 +67,32 @@ function ElementsColumn() {
70
67
  })
71
68
  );
72
69
  return {
73
- all: all2,
74
- byid: indexBy(all2, prop("value")),
70
+ all,
71
+ byid,
75
72
  roots: roots.sort(sortByLabel)
76
73
  };
77
74
  }, [model, search]);
75
+ const handleClick = useHandleElementSelection();
76
+ if (data.all.length === 0) {
77
+ return /* @__PURE__ */ jsx(NothingFound, {});
78
+ }
79
+ return /* @__PURE__ */ jsx(ElementsTree, { data, handleClick });
80
+ }
81
+ const setHoveredNode = () => {
82
+ };
83
+ function ElementsTree({
84
+ data: {
85
+ all,
86
+ byid,
87
+ roots
88
+ },
89
+ handleClick
90
+ }) {
78
91
  const tree = useTree({
79
92
  multiple: false
80
93
  });
81
- useEffect(() => {
94
+ tree.setHoveredNode = setHoveredNode;
95
+ reactExports.useEffect(() => {
82
96
  tree.collapseAllNodes();
83
97
  for (const nd of all) {
84
98
  if (nd.children.length > 0) {
@@ -86,65 +100,62 @@ function ElementsColumn() {
86
100
  }
87
101
  }
88
102
  }, [all]);
89
- const handleClick = useHandleElementSelection();
90
- return /* @__PURE__ */ jsxs(Fragment, { children: [
91
- data.length === 0 && /* @__PURE__ */ jsx(NothingFound, {}),
92
- /* @__PURE__ */ jsx(
93
- Tree,
94
- {
95
- "data-likec4-search-elements": true,
96
- allowRangeSelection: false,
97
- clearSelectionOnOutsideClick: true,
98
- selectOnClick: false,
99
- tree,
100
- data,
101
- levelOffset: "lg",
102
- classNames: {
103
- root: treeRoot,
104
- node: cx(focusable, treeNode),
105
- label: treeLabel,
106
- subtree: treeSubtree
107
- },
108
- onKeyDownCapture: (e) => {
109
- const target = e.target;
110
- const id = target.getAttribute("data-value");
111
- const node = !!id && byid[id];
112
- if (!node) return;
113
- if (e.key === "ArrowUp") {
114
- if (id === data[0]?.value) {
115
- stopAndPrevent(e);
116
- moveFocusToSearchInput();
117
- }
118
- return;
119
- }
120
- if (e.key === "ArrowRight") {
121
- const hasChildren = node.children.length > 0;
122
- if (hasChildren && tree.expandedState[id] === false) {
123
- return;
124
- }
125
- const label = e.target.querySelector(".mantine-Tree-label") ?? target;
126
- const maxY = label.getBoundingClientRect().y;
127
- const viewButtons = [...document.querySelectorAll(
128
- `[data-likec4-search-views] .${focusable}`
129
- )];
130
- let view = viewButtons.length > 1 ? viewButtons.find((el, i, all2) => centerY(el) > maxY || i === all2.length - 1) : null;
131
- view ??= first(viewButtons);
132
- if (view) {
133
- stopAndPrevent(e);
134
- view.focus();
135
- }
136
- return;
137
- }
138
- if (e.key === " " || e.key === "Enter") {
139
- stopAndPrevent(e);
140
- handleClick(node.element);
141
- return;
142
- }
143
- },
144
- renderNode: ElementTreeNode
103
+ const onKeyDownCapture = useCallbackRef((e) => {
104
+ const target = e.target;
105
+ const id = target.getAttribute("data-value");
106
+ const node = !!id && byid[id];
107
+ if (!node) return;
108
+ if (e.key === "ArrowUp") {
109
+ if (id === roots[0]?.value) {
110
+ stopAndPrevent(e);
111
+ moveFocusToSearchInput();
145
112
  }
146
- )
147
- ] });
113
+ return;
114
+ }
115
+ if (e.key === "ArrowRight") {
116
+ const hasChildren = node.children.length > 0;
117
+ if (hasChildren && tree.expandedState[id] === false) {
118
+ return;
119
+ }
120
+ const label = e.target.querySelector(".mantine-Tree-label") ?? target;
121
+ const maxY = label.getBoundingClientRect().y;
122
+ const viewButtons = [...document.querySelectorAll(
123
+ `[data-likec4-search-views] .${focusable}`
124
+ )];
125
+ let view = viewButtons.length > 1 ? viewButtons.find((el, i, all2) => centerY(el) > maxY || i === all2.length - 1) : null;
126
+ view ??= first(viewButtons);
127
+ if (view) {
128
+ stopAndPrevent(e);
129
+ view.focus();
130
+ }
131
+ return;
132
+ }
133
+ if (e.key === " " || e.key === "Enter") {
134
+ stopAndPrevent(e);
135
+ handleClick(node.element);
136
+ return;
137
+ }
138
+ });
139
+ return /* @__PURE__ */ jsx(
140
+ Tree,
141
+ {
142
+ "data-likec4-search-elements": true,
143
+ allowRangeSelection: false,
144
+ clearSelectionOnOutsideClick: true,
145
+ selectOnClick: false,
146
+ tree,
147
+ data: roots,
148
+ levelOffset: "lg",
149
+ classNames: {
150
+ root: treeRoot,
151
+ node: cx(focusable, treeNode),
152
+ label: treeLabel,
153
+ subtree: treeSubtree
154
+ },
155
+ onKeyDownCapture,
156
+ renderNode: ElementTreeNode
157
+ }
158
+ );
148
159
  }
149
160
  function ElementTreeNode({ node, elementProps, hasChildren, expanded }) {
150
161
  const { element, searchTerms } = node;
@@ -224,11 +235,11 @@ function ElementTreeNode({ node, elementProps, hasChildren, expanded }) {
224
235
  ]
225
236
  }
226
237
  )
227
- ] }, key);
238
+ ] });
228
239
  }
229
240
  function useHandleElementSelection() {
230
241
  const navigateTo = useCloseSearchAndNavigateTo();
231
- return useCallbackRef((element) => {
242
+ return reactExports.useCallback((element) => {
232
243
  const views = [...element.views()];
233
244
  if (views.length === 0) {
234
245
  return;
@@ -244,7 +255,7 @@ function useHandleElementSelection() {
244
255
  scoped,
245
256
  others
246
257
  });
247
- });
258
+ }, [setPickView, navigateTo]);
248
259
  }
249
260
 
250
261
  export { ElementsColumn };
@@ -1 +1,2 @@
1
- export declare function LikeC4Search(): import("react/jsx-runtime").JSX.Element;
1
+ import { MemoExoticComponent } from 'react';
2
+ export declare const LikeC4Search: MemoExoticComponent<() => import("react/jsx-runtime").JSX.Element>;
@@ -1,19 +1,21 @@
1
1
  import { jsxs, jsx, Fragment } from 'react/jsx-runtime';
2
- import { Portal, RemoveScroll, Group, Box, ActionIcon, Grid, GridCol, Title, ScrollArea, ScrollAreaAutosize, Stack } from '@mantine/core';
3
- import { useDisclosure, useHotkeys, useCallbackRef, useFocusTrap, useWindowEvent, useFocusReturn } from '@mantine/hooks';
2
+ import { css } from '@likec4/styles/css';
3
+ import { Box } from '@likec4/styles/jsx';
4
+ import { Portal, Group, ActionIcon, Grid, GridCol, Title, ScrollArea, ScrollAreaAutosize, Stack } from '@mantine/core';
5
+ import { useDisclosure, useHotkeys, useCallbackRef, useWindowEvent, useFocusTrap, useFocusReturn } from '@mantine/hooks';
4
6
  import { IconX } from '@tabler/icons-react';
5
- import { AnimatePresence, m, LayoutGroup } from 'framer-motion';
6
- import { useRef } from 'react';
7
+ import { AnimatePresence, m, LayoutGroup } from 'motion/react';
8
+ import { r as reactExports } from '../../../_virtual/index.js';
7
9
  import { SearchControl } from '../../../components/SearchControl.js';
8
10
  import { ElementsColumn } from './ElementsColumn.js';
9
11
  import { backdrop, root, scrollArea, pickviewBackdrop, pickview, pickviewGroup } from './LikeC4Search.css.js';
10
12
  import { LikeC4SearchInput } from './SearchInput.js';
11
- import { LikeC4SearchContext, useCloseSearch, wasResetPickView, usePickView, setPickView } from './state.js';
13
+ import { LikeC4SearchContext, useCloseSearch, useIsPickViewActive, wasResetPickView, usePickView, setPickView } from './state.js';
12
14
  import { stopAndPrevent } from './utils.js';
13
15
  import { ViewsColumn, ViewButton } from './ViewsColum.js';
14
16
  import { useMantinePortalProps } from '../../../hooks/useMantinePortalProps.js';
15
17
 
16
- function LikeC4Search() {
18
+ const LikeC4Search = reactExports.memo(() => {
17
19
  const [searchOpened, searchOps] = useDisclosure(false);
18
20
  useHotkeys([
19
21
  ["mod+k", () => searchOps.toggle(), {
@@ -23,7 +25,7 @@ function LikeC4Search() {
23
25
  preventDefault: true
24
26
  }]
25
27
  ]);
26
- const afterCloseCbRef = useRef(null);
28
+ const afterCloseCbRef = reactExports.useRef(null);
27
29
  const close = useCallbackRef((cb) => {
28
30
  afterCloseCbRef.current = cb ?? null;
29
31
  searchOps.close();
@@ -45,8 +47,8 @@ function LikeC4Search() {
45
47
  }
46
48
  }
47
49
  ),
48
- /* @__PURE__ */ jsx(Portal, { ...portalProps, children: /* @__PURE__ */ jsx(RemoveScroll, { enabled: searchOpened, children: /* @__PURE__ */ jsx(AnimatePresence, { onExitComplete, children: searchOpened && /* @__PURE__ */ jsxs(Fragment, { children: [
49
- /* @__PURE__ */ jsx(
50
+ /* @__PURE__ */ jsx(Portal, { ...portalProps, reuseTargetNode: true, children: /* @__PURE__ */ jsxs(AnimatePresence, { onExitComplete, children: [
51
+ searchOpened && /* @__PURE__ */ jsx(
50
52
  m.div,
51
53
  {
52
54
  className: backdrop,
@@ -54,25 +56,26 @@ function LikeC4Search() {
54
56
  animate: {
55
57
  opacity: 1,
56
58
  transition: {
57
- duration: 0.1
59
+ duration: 0.13
58
60
  }
59
61
  },
60
62
  exit: {
61
63
  opacity: 0,
62
64
  transition: {
63
- duration: 0.075
65
+ duration: 0.13
64
66
  }
65
67
  }
66
68
  },
67
69
  "backdrop"
68
70
  ),
69
- /* @__PURE__ */ jsx(LikeC4SearchOverlay, {}, "overlay")
70
- ] }) }) }) })
71
+ searchOpened && /* @__PURE__ */ jsx(LikeC4SearchOverlay, {}, "overlay")
72
+ ] }) })
71
73
  ] });
72
- }
73
- function LikeC4SearchOverlay() {
74
+ });
75
+ LikeC4Search.displayName = "LikeC4Search";
76
+ const LikeC4SearchOverlay = () => {
74
77
  const close = useCloseSearch();
75
- const ref = useFocusTrap();
78
+ const pickViewActive = useIsPickViewActive();
76
79
  useWindowEvent(
77
80
  "keydown",
78
81
  (event) => {
@@ -88,9 +91,9 @@ function LikeC4SearchOverlay() {
88
91
  return /* @__PURE__ */ jsxs(
89
92
  m.div,
90
93
  {
91
- ref,
92
94
  className: root,
93
- "data-likec4-search": true,
95
+ "data-likec4-search": "true",
96
+ initial: false,
94
97
  animate: {
95
98
  opacity: 1,
96
99
  scale: 1,
@@ -99,8 +102,9 @@ function LikeC4SearchOverlay() {
99
102
  exit: {
100
103
  opacity: 0,
101
104
  scale: 0.9,
105
+ translateY: -30,
102
106
  transition: {
103
- duration: 0.1
107
+ duration: 0.13
104
108
  }
105
109
  },
106
110
  children: [
@@ -126,12 +130,12 @@ function LikeC4SearchOverlay() {
126
130
  /* @__PURE__ */ jsxs(
127
131
  Grid,
128
132
  {
129
- style: {
133
+ className: css({
130
134
  containerName: "likec4-search-elements",
131
135
  containerType: "size",
132
136
  overflow: "hidden",
133
137
  flexGrow: 1
134
- },
138
+ }),
135
139
  children: [
136
140
  /* @__PURE__ */ jsx(GridCol, { span: 6, children: /* @__PURE__ */ jsx(
137
141
  ScrollArea,
@@ -156,12 +160,11 @@ function LikeC4SearchOverlay() {
156
160
  ]
157
161
  }
158
162
  ),
159
- /* @__PURE__ */ jsx(Box, {}),
160
- /* @__PURE__ */ jsx(PickView, {})
163
+ pickViewActive && /* @__PURE__ */ jsx(PickView, {})
161
164
  ]
162
165
  }
163
166
  );
164
- }
167
+ };
165
168
  function PickView() {
166
169
  const pickview$1 = usePickView();
167
170
  const focusTrapRef = useFocusTrap(!!pickview$1);
@@ -4,7 +4,7 @@ import { useCombobox, ComboboxOption, Text, Combobox, ComboboxTarget, Input, rem
4
4
  import { useFocusWithin, useIsFirstRender, useDebouncedValue, useWindowEvent } from '@mantine/hooks';
5
5
  import { usePreviousDistinct } from '@react-hookz/web';
6
6
  import { IconSearch } from '@tabler/icons-react';
7
- import 'react';
7
+ import '../../../_virtual/index.js';
8
8
  import { isString, keys, only } from 'remeda';
9
9
  import { useLikeC4Model } from '../../../likec4model/useLikeC4Model.js';
10
10
  import { input } from './LikeC4Search.css.js';
@@ -1,9 +1,10 @@
1
1
  import { jsx, jsxs } from 'react/jsx-runtime';
2
2
  import { isDeploymentView } from '@likec4/core';
3
3
  import { cx } from '@likec4/styles/css';
4
- import { Stack, VisuallyHidden, UnstyledButton, Box, createScopedKeydownHandler, ThemeIcon, Group, Highlight, Badge } from '@mantine/core';
4
+ import { Box } from '@likec4/styles/jsx';
5
+ import { Stack, VisuallyHidden, UnstyledButton, createScopedKeydownHandler, ThemeIcon, Group, Highlight, Badge } from '@mantine/core';
5
6
  import { IconStack2, IconZoomScan } from '@tabler/icons-react';
6
- import { m } from 'framer-motion';
7
+ import * as m from 'motion/react-m';
7
8
  import { first } from 'remeda';
8
9
  import { useCurrentViewId } from '../../../hooks/useCurrentViewId.js';
9
10
  import { useLikeC4Model } from '../../../likec4model/useLikeC4Model.js';
@@ -1,9 +1,9 @@
1
1
  import { DiagramNode } from '@likec4/core';
2
2
  import { createSafeContext } from '@mantine/core';
3
- import { useCallbackRef } from '@mantine/hooks';
3
+ import '@mantine/hooks';
4
4
  import { useStore } from '@nanostores/react';
5
- import { atom, computed, onMount } from 'nanostores';
6
- import { useDeferredValue } from 'react';
5
+ import { computed, atom, onMount } from 'nanostores';
6
+ import { r as reactExports } from '../../../_virtual/index.js';
7
7
  import { useDiagram } from '../../../hooks/useDiagram.js';
8
8
 
9
9
  const $search = atom("");
@@ -18,7 +18,7 @@ const $normalizedSearch = computed($search, (search) => {
18
18
  return v.length > 1 ? v : "";
19
19
  });
20
20
  function useNormalizedSearch() {
21
- return useDeferredValue(useStore($normalizedSearch));
21
+ return reactExports.useDeferredValue(useStore($normalizedSearch));
22
22
  }
23
23
  const [LikeC4SearchContext, useCloseSearch] = createSafeContext("LikeC4Search");
24
24
  const $pickView = atom(null);
@@ -45,18 +45,20 @@ function useIsPickViewActive() {
45
45
  function useCloseSearchAndNavigateTo() {
46
46
  const diagram = useDiagram();
47
47
  const close = useCloseSearch();
48
- return useCallbackRef((viewId, fromElementFqn) => {
48
+ return reactExports.useCallback((viewId, fromElementFqn) => {
49
49
  close(() => {
50
50
  fromElementFqn ??= $pickView.get()?.elementFqn;
51
51
  setPickView(null);
52
52
  const fromNode = fromElementFqn ? diagram.getContext().view.nodes.find((n) => DiagramNode.modelRef(n) === fromElementFqn)?.id : void 0;
53
- if (diagram.currentView.id === viewId && fromNode) {
54
- diagram.focusNode(fromNode);
53
+ if (diagram.currentView.id !== viewId) {
54
+ diagram.navigateTo(viewId, fromNode);
55
55
  return;
56
56
  }
57
- diagram.navigateTo(viewId, fromNode);
57
+ if (fromNode) {
58
+ diagram.focusNode(fromNode);
59
+ }
58
60
  });
59
- });
61
+ }, [close, diagram]);
60
62
  }
61
63
 
62
64
  export { LikeC4SearchContext, setPickView, setSearch, useCloseSearch, useCloseSearchAndNavigateTo, useIsPickViewActive, useNormalizedSearch, usePickView, useSearch, wasResetPickView };
@@ -2,7 +2,7 @@ import { jsxs, jsx } from 'react/jsx-runtime';
2
2
  import { Box, Button, Badge, ButtonGroup } from '@mantine/core';
3
3
  import { IconPlayerPlayFilled, IconPlayerSkipBackFilled, IconPlayerStopFilled, IconPlayerSkipForwardFilled } from '@tabler/icons-react';
4
4
  import clsx from 'clsx';
5
- import { AnimatePresence, m } from 'framer-motion';
5
+ import { AnimatePresence, m } from 'motion/react';
6
6
  import { isTruthy, isNonNull } from 'remeda';
7
7
  import { useDiagramContext, useDiagram } from '../../../hooks/useDiagram.js';
8
8
  import { parallelStateFrame, btn, buttons, container } from './DynamicViewWalkthrough.css.js';
@@ -1,7 +1,7 @@
1
1
  import { nonNullable } from '@likec4/core';
2
2
  import '@xyflow/react';
3
3
  import { getNodeDimensions } from '@xyflow/system';
4
- import { useRef, useMemo } from 'react';
4
+ import { r as reactExports } from '../_virtual/index.js';
5
5
  import { pipe, filter, hasAtLeast, map } from 'remeda';
6
6
  import { useDiagram } from '../hooks/useDiagram.js';
7
7
  import { useXYStoreApi } from '../hooks/useXYFlow.js';
@@ -186,8 +186,8 @@ function createLayoutConstraints(xyflowApi, editingNodeIds) {
186
186
  function useLayoutConstraints() {
187
187
  const xystore = useXYStoreApi();
188
188
  const diagram = useDiagram();
189
- const solverRef = useRef(void 0);
190
- return useMemo(() => {
189
+ const solverRef = reactExports.useRef(void 0);
190
+ return reactExports.useMemo(() => {
191
191
  let wasPending = false;
192
192
  const initial = { x: 0, y: 0 };
193
193
  let moved = false;
@@ -1,5 +1,5 @@
1
- import { createContext } from 'react';
1
+ import { r as reactExports } from '../_virtual/index.js';
2
2
 
3
- const LikeC4ModelContext = createContext(null);
3
+ const LikeC4ModelContext = reactExports.createContext(null);
4
4
 
5
5
  export { LikeC4ModelContext };
@@ -1,5 +1,5 @@
1
1
  import { compareNatural } from '@likec4/core';
2
- import { useMemo } from 'react';
2
+ import { r as reactExports } from '../_virtual/index.js';
3
3
  import { useLikeC4Model } from './useLikeC4Model.js';
4
4
 
5
5
  const sortByLabel = (a, b) => compareNatural(a.label, b.label);
@@ -12,7 +12,7 @@ function buildNode(element) {
12
12
  }
13
13
  function useLikeC4ElementsTree(viewId) {
14
14
  const model = useLikeC4Model(true);
15
- return useMemo(() => {
15
+ return reactExports.useMemo(() => {
16
16
  if (viewId) {
17
17
  const view = model.view(viewId);
18
18
  return [...view.roots()].map(buildNode).sort(sortByLabel);
@@ -1,9 +1,9 @@
1
- import { useContext } from 'react';
1
+ import { r as reactExports } from '../_virtual/index.js';
2
2
  import { isString, isNonNullish, isDefined } from 'remeda';
3
3
  import { LikeC4ModelContext } from './LikeC4ModelContext.js';
4
4
 
5
5
  function useLikeC4Model(strict, type) {
6
- const model = useContext(LikeC4ModelContext);
6
+ const model = reactExports.useContext(LikeC4ModelContext);
7
7
  if (isString(type) && isNonNullish(model) && model.type !== type) {
8
8
  throw new Error(`Invalid LikeC4ModelContext, expected "${type}" but got "${model.type}" in context`);
9
9
  }