@likec4/diagram 1.59.3 → 1.59.4

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 (202) hide show
  1. package/dist/LikeC4Diagram.d.ts +1 -1
  2. package/dist/LikeC4Diagram.js +36 -21
  3. package/dist/LikeC4Diagram.props.d.ts +23 -0
  4. package/dist/LikeC4MantineProvider.d.ts +24 -0
  5. package/dist/LikeC4MantineProvider.js +156 -0
  6. package/dist/LikeC4ProjectsOverview.js +1 -1
  7. package/dist/LikeC4ProjectsProvider.d.ts +17 -2
  8. package/dist/LikeC4Styles.d.ts +13 -3
  9. package/dist/LikeC4Styles.js +8 -5
  10. package/dist/LikeC4View.js +2 -2
  11. package/dist/StaticLikeC4Diagram.d.ts +1 -1
  12. package/dist/base/BaseXYFlow.d.ts +1 -1
  13. package/dist/base/BaseXYFlow.js +11 -8
  14. package/dist/base/const.d.ts +1 -0
  15. package/dist/base/const.js +3 -1
  16. package/dist/base-primitives/Markdown.d.ts +3 -3
  17. package/dist/base-primitives/compound/actionbtns.css.d.ts +3 -3
  18. package/dist/base-primitives/compound/actionbtns.css.js +3 -3
  19. package/dist/base-primitives/element/ElementTags.d.ts +2 -2
  20. package/dist/base-primitives/element/ElementTags.js +5 -5
  21. package/dist/components/EmptyBox.d.ts +3 -0
  22. package/dist/components/EmptyBox.js +9 -0
  23. package/dist/components/ErrorFallback.js +7 -6
  24. package/dist/components/FloatingWindow.d.ts +18 -0
  25. package/dist/components/FloatingWindow.js +89 -0
  26. package/dist/components/Link.js +7 -7
  27. package/dist/components/NavigationPanel.d.ts +2 -2
  28. package/dist/components/NavigationPanel.js +5 -6
  29. package/dist/components/SearchControl.css.js +10 -12
  30. package/dist/components/ViewIcon.d.ts +11 -0
  31. package/dist/components/ViewIcon.js +71 -0
  32. package/dist/context/DiagramEventHandlers.js +2 -1
  33. package/dist/context/EnsureMantine.js +3 -3
  34. package/dist/context/IconRenderer.d.ts +2 -1
  35. package/dist/context/IconRenderer.js +38 -2
  36. package/dist/context/LikeC4ProjectsContext.d.ts +3 -2
  37. package/dist/context/TagStylesContext.d.ts +9 -3
  38. package/dist/context/TagStylesContext.js +19 -19
  39. package/dist/custom/index.d.ts +3 -0
  40. package/dist/custom/index.js +6 -3
  41. package/dist/editor/applyChangesToManualLayout.js +4 -1
  42. package/dist/hooks/safeContext.d.ts +12 -4
  43. package/dist/hooks/safeContext.js +2 -2
  44. package/dist/hooks/useCurrentView.js +5 -5
  45. package/dist/hooks/useDiagram.js +1 -23
  46. package/dist/hooks/useDiagramCompareLayout.d.ts +4 -4
  47. package/dist/hooks/useDiagramCompareLayout.js +14 -16
  48. package/dist/hooks/useEditorActor.js +3 -5
  49. package/dist/hooks/useLikeC4Model.js +8 -3
  50. package/dist/hooks/useLikeC4Project.d.ts +4 -3
  51. package/dist/hooks/useOverlaysActor.d.ts +1 -1
  52. package/dist/index.d.ts +4 -3
  53. package/dist/index.js +6 -5
  54. package/dist/likec4diagram/DiagramXYFlow.d.ts +5 -0
  55. package/dist/likec4diagram/DiagramXYFlow.js +20 -13
  56. package/dist/likec4diagram/custom/edges/EdgeDrifts.js +4 -4
  57. package/dist/likec4diagram/custom/edges/RelationshipEdge.js +1 -1
  58. package/dist/likec4diagram/custom/edges/edges.css.js +13 -13
  59. package/dist/likec4diagram/custom/nodes/NodeDrifts.js +2 -2
  60. package/dist/likec4diagram/custom/nodes/NodeNotes.js +4 -4
  61. package/dist/likec4diagram/custom/nodes/SequenceActorNode.js +2 -2
  62. package/dist/likec4diagram/custom/nodes/SequenceSubFlow.js +8 -5
  63. package/dist/likec4diagram/custom/nodes/nodes.js +2 -2
  64. package/dist/likec4diagram/custom/nodes/toolbar/ColorButton.js +2 -2
  65. package/dist/likec4diagram/custom/nodes/toolbar/Toolbar.js +5 -5
  66. package/dist/likec4diagram/custom/nodes/toolbar/styles.css.js +1 -1
  67. package/dist/likec4diagram/relationship-popover/RelationshipPopover.js +2 -0
  68. package/dist/likec4diagram/relationship-popover/components.d.ts +1 -1
  69. package/dist/likec4diagram/relationship-popover/components.js +6 -2
  70. package/dist/likec4diagram/state/DiagramActorProvider.d.ts +7 -2
  71. package/dist/likec4diagram/state/DiagramActorProvider.js +20 -4
  72. package/dist/likec4diagram/state/diagram-api.d.ts +2 -2
  73. package/dist/likec4diagram/state/diagram-api.js +3 -2
  74. package/dist/likec4diagram/state/machine.actions.js +9 -6
  75. package/dist/likec4diagram/state/machine.actions.layout.d.ts +1 -0
  76. package/dist/likec4diagram/state/machine.actions.layout.js +7 -5
  77. package/dist/likec4diagram/state/machine.setup.d.ts +10 -1
  78. package/dist/likec4diagram/state/machine.setup.js +6 -1
  79. package/dist/likec4diagram/state/machine.state.initializing.d.ts +2 -26
  80. package/dist/likec4diagram/state/machine.state.initializing.js +9 -6
  81. package/dist/likec4diagram/state/machine.state.navigating.js +1 -1
  82. package/dist/likec4diagram/state/machine.state.ready.d.ts +134 -3
  83. package/dist/likec4diagram/state/machine.state.ready.js +2 -1
  84. package/dist/likec4diagram/state/machine.state.ready.walkthrough.d.ts +106 -1
  85. package/dist/likec4diagram/state/machine.state.ready.walkthrough.js +39 -6
  86. package/dist/likec4diagram/state/utils.d.ts +1 -1
  87. package/dist/likec4diagram/state/utils.js +1 -2
  88. package/dist/likec4diagram/ui/LayoutDriftFrame.js +16 -10
  89. package/dist/likec4diagram/ui/index.d.ts +1 -1
  90. package/dist/likec4diagram/ui/notation/NotationPanel.css.js +13 -15
  91. package/dist/likec4diagram/ui/notation/NotationPanel.js +9 -9
  92. package/dist/likec4diagram/ui/sequence-outline/ActiveTrail.d.ts +9 -0
  93. package/dist/likec4diagram/ui/sequence-outline/ActiveTrail.js +81 -0
  94. package/dist/likec4diagram/ui/sequence-outline/FlowRow.d.ts +11 -0
  95. package/dist/likec4diagram/ui/sequence-outline/FlowRow.js +70 -0
  96. package/dist/likec4diagram/ui/sequence-outline/OutlineBody.d.ts +2 -0
  97. package/dist/likec4diagram/ui/sequence-outline/OutlineBody.js +106 -0
  98. package/dist/likec4diagram/ui/sequence-outline/OutlineHeader.d.ts +2 -0
  99. package/dist/likec4diagram/ui/sequence-outline/OutlineHeader.js +140 -0
  100. package/dist/likec4diagram/ui/sequence-outline/OutlineNodes.d.ts +17 -0
  101. package/dist/likec4diagram/ui/sequence-outline/OutlineNodes.js +83 -0
  102. package/dist/likec4diagram/ui/sequence-outline/SequenceOutlinePanel.d.ts +4 -0
  103. package/dist/likec4diagram/ui/sequence-outline/SequenceOutlinePanel.js +49 -527
  104. package/dist/likec4diagram/ui/sequence-outline/StepBadge.d.ts +8 -0
  105. package/dist/likec4diagram/ui/sequence-outline/StepBadge.js +52 -0
  106. package/dist/likec4diagram/ui/sequence-outline/StepRow.d.ts +7 -0
  107. package/dist/likec4diagram/ui/sequence-outline/StepRow.js +190 -0
  108. package/dist/likec4diagram/ui/sequence-outline/StoreProvider.d.ts +238 -0
  109. package/dist/likec4diagram/ui/sequence-outline/StoreProvider.js +94 -0
  110. package/dist/likec4diagram/ui/sequence-outline/depth-of-field.d.ts +21 -0
  111. package/dist/likec4diagram/ui/sequence-outline/depth-of-field.js +71 -0
  112. package/dist/likec4diagram/ui/sequence-outline/index.d.ts +2 -0
  113. package/dist/likec4diagram/ui/sequence-outline/motion.d.ts +13 -0
  114. package/dist/likec4diagram/ui/sequence-outline/motion.js +21 -0
  115. package/dist/likec4diagram/ui/sequence-outline/presentation.d.ts +10 -0
  116. package/dist/likec4diagram/ui/sequence-outline/presentation.js +80 -0
  117. package/dist/likec4diagram/ui/sequence-outline/tree.d.ts +9 -0
  118. package/dist/likec4diagram/ui/sequence-outline/tree.js +67 -0
  119. package/dist/likec4diagram/ui/sequence-outline/{state.d.ts → types.d.ts} +4 -2
  120. package/dist/likec4diagram/ui/sequence-outline/types.js +12 -0
  121. package/dist/likec4diagram/useLayoutConstraints.js +9 -12
  122. package/dist/likec4diagram/xyflow-sequence/sequence-view-to-xy.js +1 -0
  123. package/dist/likec4diagram/xyflow-sequence/utils.js +0 -1
  124. package/dist/navigationpanel/NavigationPanel.js +45 -41
  125. package/dist/navigationpanel/NavigationPanelControls.js +102 -63
  126. package/dist/navigationpanel/NavigationPanelDropdown.js +51 -77
  127. package/dist/navigationpanel/_common.d.ts +6 -6
  128. package/dist/navigationpanel/_common.js +31 -42
  129. package/dist/navigationpanel/actor.actions.js +6 -5
  130. package/dist/navigationpanel/actor.js +2 -2
  131. package/dist/navigationpanel/actor.setup.d.ts +6 -6
  132. package/dist/navigationpanel/actor.setup.js +2 -1
  133. package/dist/navigationpanel/comparepanel/CompareActionsMenu.js +2 -4
  134. package/dist/navigationpanel/comparepanel/ComparePanel.js +8 -10
  135. package/dist/navigationpanel/comparepanel/DriftsSummary.d.ts +1 -1
  136. package/dist/navigationpanel/comparepanel/DriftsSummary.js +11 -9
  137. package/dist/navigationpanel/controls/LayoutWarning.js +69 -72
  138. package/dist/navigationpanel/controls/NavigationButtons.d.ts +1 -1
  139. package/dist/navigationpanel/controls/NavigationButtons.js +8 -8
  140. package/dist/navigationpanel/controls/OpenSource.d.ts +1 -1
  141. package/dist/navigationpanel/controls/OpenSource.js +5 -8
  142. package/dist/navigationpanel/controls/SearchControl.js +24 -9
  143. package/dist/navigationpanel/controls/ToggleReadonly.d.ts +4 -1
  144. package/dist/navigationpanel/controls/ToggleReadonly.js +56 -76
  145. package/dist/navigationpanel/controls/ViewDetailsButton.d.ts +5 -0
  146. package/dist/navigationpanel/controls/ViewDetailsButton.js +121 -0
  147. package/dist/navigationpanel/controls/index.d.ts +1 -1
  148. package/dist/navigationpanel/dropdown/ProjectsMenu.js +27 -16
  149. package/dist/navigationpanel/editorpanel/ChangeAutoLayoutButton.js +10 -9
  150. package/dist/navigationpanel/editorpanel/ManualLayoutToolsButton.js +9 -8
  151. package/dist/navigationpanel/editorpanel/styles.js +8 -15
  152. package/dist/navigationpanel/hooks.d.ts +6 -2
  153. package/dist/navigationpanel/styles.css.d.ts +2 -2
  154. package/dist/navigationpanel/styles.css.js +0 -1
  155. package/dist/navigationpanel/walkthrough/ActiveWalkthroughControls.js +3 -2
  156. package/dist/navigationpanel/walkthrough/DynamicViewControls.d.ts +5 -4
  157. package/dist/navigationpanel/walkthrough/DynamicViewControls.js +9 -36
  158. package/dist/navigationpanel/walkthrough/DynamicViewModeSwitcher.d.ts +1 -0
  159. package/dist/navigationpanel/walkthrough/DynamicViewModeSwitcher.js +49 -0
  160. package/dist/navigationpanel/walkthrough/WalkthroughPanel.js +8 -8
  161. package/dist/navigationpanel/windows/ViewDetailsWindow.d.ts +1 -0
  162. package/dist/navigationpanel/windows/ViewDetailsWindow.js +379 -0
  163. package/dist/overlays/Overlays.js +29 -17
  164. package/dist/overlays/element-details/ElementDetailsCard.css.js +28 -36
  165. package/dist/overlays/element-details/ElementDetailsCard.js +1 -1
  166. package/dist/overlays/element-details/MetadataValue.js +18 -16
  167. package/dist/overlays/element-details/TabPanelDeployments.css.js +6 -14
  168. package/dist/overlays/element-details/TabPanelRelationships.css.js +8 -12
  169. package/dist/overlays/element-details/TabPanelStructure.css.js +4 -8
  170. package/dist/overlays/hooks.d.ts +3 -1
  171. package/dist/overlays/overlay/Overlay.js +8 -7
  172. package/dist/overlays/overlaysActor.js +4 -0
  173. package/dist/overlays/relationship-details/SelectEdge.css.js +14 -9
  174. package/dist/overlays/relationship-details/actor.js +1 -1
  175. package/dist/overlays/relationships-browser/RelationshipsBrowser.d.ts +6 -0
  176. package/dist/overlays/relationships-browser/RelationshipsBrowser.js +11 -6
  177. package/dist/overlays/relationships-browser/SelectElement.css.js +2 -8
  178. package/dist/overlays/relationships-browser/SelectElement.js +5 -1
  179. package/dist/overlays/relationships-browser/actor.js +1 -1
  180. package/dist/overlays/relationships-browser/custom/EmptyNode.js +7 -9
  181. package/dist/projects-overview/actor.js +1 -1
  182. package/dist/search/Search.js +9 -7
  183. package/dist/search/components/ElementsColumn.css.js +6 -5
  184. package/dist/search/components/ElementsColumn.js +4 -3
  185. package/dist/search/components/SearchByTags.js +3 -3
  186. package/dist/search/components/ViewsColum.js +36 -35
  187. package/dist/search/components/ViewsColumn.css.js +4 -4
  188. package/dist/search/components/_shared.css.d.ts +2 -2
  189. package/dist/search/components/_shared.css.js +31 -46
  190. package/dist/search/components/styles.css.js +4 -4
  191. package/dist/shadowroot/ShadowRoot.js +2 -3
  192. package/dist/styles2.js +1 -1
  193. package/dist/utils/index.js +1 -1
  194. package/package.json +10 -10
  195. package/panda.buildinfo.json +340 -298
  196. package/styles-min.css +1 -1
  197. package/styles.css +1 -1
  198. package/dist/context/DefaultMantineProvider.d.ts +0 -2
  199. package/dist/context/DefaultMantineProvider.js +0 -48
  200. package/dist/likec4diagram/ui/sequence-outline/state.js +0 -55
  201. package/dist/navigationpanel/controls/DetailsControls.d.ts +0 -2
  202. package/dist/navigationpanel/controls/DetailsControls.js +0 -224
@@ -1,21 +1,25 @@
1
1
  import "../_virtual/_rolldown/runtime.js";
2
2
  import { useOnDiagramEvent } from "../hooks/useDiagram.js";
3
+ import { useOptionalCurrentViewModel } from "../context/LikeC4ModelContext.js";
3
4
  import { useLikeC4Model } from "../hooks/useLikeC4Model.js";
4
5
  import { Tooltip as Tooltip$1 } from "./_common.js";
5
6
  import { selectNavigationContext, useNavigationActor, useNavigationActorRef, useNavigationActorSelector } from "./hooks.js";
7
+ import { EmptyBox } from "../components/EmptyBox.js";
8
+ import { viewIcon } from "../components/ViewIcon.js";
6
9
  import { breadcrumbTitle } from "./styles.css.js";
7
10
  import { NavigationLink } from "../components/NavigationLink.js";
8
11
  import { ProjectsMenu } from "./dropdown/ProjectsMenu.js";
9
12
  import { css, cx } from "@likec4/styles/css";
10
- import { IconChevronRight, IconDirectionSignFilled, IconFolderFilled, IconSearch, IconStack2, IconStarFilled, IconZoomScan } from "@tabler/icons-react";
13
+ import { IconChevronRight, IconFolderFilled, IconSearch } from "@tabler/icons-react";
11
14
  import { memo, useDeferredValue, useEffect, useRef, useState } from "react";
12
15
  import { jsx, jsxs } from "react/jsx-runtime";
13
16
  import { useMountEffect } from "@react-hookz/web";
14
- import { deepEqual, shallowEqual } from "fast-equals";
17
+ import { shallowEqual } from "fast-equals";
15
18
  import { isArray, isEmpty, pipe, sort } from "remeda";
16
19
  import { Breadcrumbs, Button, Divider, Highlight, Input, PopoverDropdown, ScrollAreaAutosize, UnstyledButton, createScopedKeydownHandler } from "@mantine/core";
17
20
  import { compareNaturalHierarchically, ifilter, ifirst, nonexhaustive, toArray } from "@likec4/core/utils";
18
- import { useSelector } from "@xstate/react";
21
+ import "motion/react";
22
+ import "@xstate/react";
19
23
  import { useThrottledCallback, useUncontrolled } from "@mantine/hooks";
20
24
  import { Box as Box$1, HStack, VStack } from "@likec4/styles/jsx";
21
25
  import { hstack, vstack } from "@likec4/styles/patterns";
@@ -28,10 +32,11 @@ var scopedKeydownHandler = createScopedKeydownHandler({
28
32
  loop: true,
29
33
  orientation: "vertical"
30
34
  });
31
- var hasSearchQuerySelector = selectNavigationContext((s) => s.searchQuery.trim().length >= 2);
35
+ var hasSearchQuerySelector = selectNavigationContext((s) => s.searchQuery);
32
36
  var NavigationPanelDropdown = memo(() => {
33
37
  const actor = useNavigationActor();
34
- const hasSearchQuery = useNavigationActorSelector(hasSearchQuerySelector);
38
+ const searchQuery = useNavigationActorSelector(hasSearchQuerySelector);
39
+ const hasSearchQuery = searchQuery.trim().length >= 2;
35
40
  useOnDiagramEvent("paneClick", () => {
36
41
  actor.closeDropdown();
37
42
  });
@@ -61,7 +66,7 @@ var NavigationPanelDropdown = memo(() => {
61
66
  /* @__PURE__ */ jsx(HStack, {
62
67
  gap: "xs",
63
68
  children: /* @__PURE__ */ jsx(SearchInput, {
64
- defaultValue: actor.actorRef.getSnapshot().context.searchQuery,
69
+ defaultValue: searchQuery,
65
70
  onChange: setSearchQuery
66
71
  })
67
72
  }),
@@ -77,14 +82,12 @@ var NavigationPanelDropdown = memo(() => {
77
82
  });
78
83
  });
79
84
  NavigationPanelDropdown.displayName = "NavigationPanelDropdown";
80
- function selectSearchQuery(s) {
81
- return normalizeViewPath(s.context.searchQuery);
82
- }
85
+ var selectSearchQuery = selectNavigationContext((s) => normalizeViewPath(s.searchQuery));
83
86
  var compare = compareNaturalHierarchically(VIEW_FOLDERS_SEPARATOR);
84
87
  var SearchResults = memo(() => {
85
88
  const likec4model = useLikeC4Model();
86
89
  const actor = useNavigationActor();
87
- const searchQuery = useSelector(actor.actorRef, selectSearchQuery);
90
+ const searchQuery = useNavigationActorSelector(selectSearchQuery);
88
91
  const deferredSearchQuery = useDeferredValue(searchQuery);
89
92
  const isSearchByPath = deferredSearchQuery.includes(VIEW_FOLDERS_SEPARATOR);
90
93
  const highlight = isSearchByPath ? deferredSearchQuery.split(VIEW_FOLDERS_SEPARATOR) : deferredSearchQuery;
@@ -102,7 +105,10 @@ var SearchResults = memo(() => {
102
105
  deferredSearchQuery,
103
106
  isSearchByPath
104
107
  ]);
105
- if (found.length === 0) return /* @__PURE__ */ jsx("div", { children: "no results" });
108
+ if (found.length === 0) return /* @__PURE__ */ jsx(EmptyBox, {
109
+ style: { minWidth: 200 },
110
+ children: "no results"
111
+ });
106
112
  return /* @__PURE__ */ jsx(ScrollAreaAutosize, {
107
113
  scrollbars: "xy",
108
114
  offsetScrollbars: false,
@@ -137,8 +143,8 @@ var foundedViewClass = hstack({
137
143
  } },
138
144
  _focus: {
139
145
  outline: "none",
140
- color: "mantine.primary.lightColor!",
141
- backgroundColor: "mantine.primary.lightHover!"
146
+ color: "primary.text.light!",
147
+ backgroundColor: "primary.body.lightHover!"
142
148
  }
143
149
  });
144
150
  var inheritColor = css({ _groupFocus: {
@@ -147,16 +153,15 @@ var inheritColor = css({ _groupFocus: {
147
153
  } });
148
154
  function FoundedView({ view, highlight, ...props }) {
149
155
  const folder = view.folder;
150
- const viewIcon = ViewTypeIcon[view.id === "index" ? "index" : view._type];
156
+ const icon = viewIcon(view.id === "index" ? "index" : view._type);
151
157
  const viewLabel = /* @__PURE__ */ jsx(Highlight, {
152
158
  component: "div",
153
159
  className: cx(inheritColor, breadcrumbTitle({ truncate: true }), css({ "& > mark": {
154
160
  backgroundColor: {
155
- base: "mantine.yellow[2]/90",
156
- _dark: "mantine.yellow[5]/80",
157
- _groupFocus: "[transparent]"
161
+ base: "highlight.body/80",
162
+ _groupFocus: "transparent"
158
163
  },
159
- color: { _groupFocus: "[inherit!]" }
164
+ color: { _groupFocus: "inherit!" }
160
165
  } })),
161
166
  maw: 350,
162
167
  highlight,
@@ -166,7 +171,7 @@ function FoundedView({ view, highlight, ...props }) {
166
171
  if (folder.isRoot) return /* @__PURE__ */ jsxs(UnstyledButton, {
167
172
  ...props,
168
173
  className,
169
- children: [viewIcon, viewLabel]
174
+ children: [icon, viewLabel]
170
175
  });
171
176
  const breadcrumbs = folder.breadcrumbs.map((b) => /* @__PURE__ */ jsx(Highlight, {
172
177
  component: "div",
@@ -180,7 +185,7 @@ function FoundedView({ view, highlight, ...props }) {
180
185
  }, b.path));
181
186
  breadcrumbs.push(/* @__PURE__ */ jsxs(HStack, {
182
187
  gap: "[4px]",
183
- children: [viewIcon, viewLabel]
188
+ children: [icon, viewLabel]
184
189
  }));
185
190
  return /* @__PURE__ */ jsxs(UnstyledButton, {
186
191
  ...props,
@@ -200,39 +205,12 @@ var btnRightSection = /* @__PURE__ */ jsx(IconChevronRight, {
200
205
  var folderIcon = /* @__PURE__ */ jsx(IconFolderFilled, {
201
206
  size: 16,
202
207
  className: css({ opacity: {
203
- base: .3,
204
- _groupHover: .5,
205
- _groupActive: .5,
206
- _groupFocus: .5
208
+ base: "0.3",
209
+ _groupHover: "0.5",
210
+ _groupActive: "0.5",
211
+ _groupFocus: "0.5"
207
212
  } })
208
213
  });
209
- var viewTypeIconCss = css({ opacity: {
210
- base: .3,
211
- _dark: .5,
212
- _groupHover: .8,
213
- _groupActive: .8,
214
- _groupFocus: .8
215
- } });
216
- var ViewTypeIcon = {
217
- index: /* @__PURE__ */ jsx(IconStarFilled, {
218
- size: 16,
219
- className: viewTypeIconCss
220
- }),
221
- element: /* @__PURE__ */ jsx(IconZoomScan, {
222
- size: 18,
223
- stroke: 2,
224
- className: viewTypeIconCss
225
- }),
226
- deployment: /* @__PURE__ */ jsx(IconStack2, {
227
- size: 16,
228
- stroke: 1.5,
229
- className: viewTypeIconCss
230
- }),
231
- dynamic: /* @__PURE__ */ jsx(IconDirectionSignFilled, {
232
- size: 18,
233
- className: viewTypeIconCss
234
- })
235
- };
236
214
  var ColumnScrollArea = ScrollAreaAutosize.withProps({
237
215
  scrollbars: "y",
238
216
  className: css({ maxHeight: ["[calc(100vh - 160px)]", "[calc(100cqh - 160px)]"] })
@@ -249,23 +227,28 @@ function folderColumn(folder, context) {
249
227
  type: "view",
250
228
  viewType: s.id === "index" ? "index" : s._type,
251
229
  viewId: s.id,
252
- title: s.title ?? s.id,
230
+ title: s.titleOrId,
253
231
  description: s.description.nonEmpty && s.description.text || null,
254
- selected: s.id === context.viewModel?.id
232
+ selected: s.id === context.viewModel.id
255
233
  }))]
256
234
  };
257
235
  }
258
- var selectColumns = selectNavigationContext((ctx) => {
259
- const viewModel = ctx.viewModel;
236
+ var selectColumns = (viewModel, selectedFolder) => {
260
237
  if (!viewModel) return [];
238
+ const ctx = {
239
+ selectedFolder,
240
+ viewModel
241
+ };
261
242
  const likec4model = viewModel.$model;
262
243
  const columns = [folderColumn(likec4model.rootViewFolder, ctx)];
263
244
  const folder = likec4model.viewFolder(ctx.selectedFolder);
264
245
  if (!folder.isRoot) for (const b of folder.breadcrumbs) columns.push(folderColumn(b, ctx));
265
246
  return columns;
266
- }, deepEqual);
247
+ };
248
+ var selectState = selectNavigationContext((c) => c.selectedFolder);
267
249
  var FolderColumns = memo(() => {
268
- const columns = useNavigationActorSelector(selectColumns);
250
+ const selectedFolder = useNavigationActorSelector(selectState);
251
+ const columns = selectColumns(useOptionalCurrentViewModel(), selectedFolder);
269
252
  return /* @__PURE__ */ jsx(HStack, {
270
253
  gap: "xs",
271
254
  alignItems: "stretch",
@@ -286,7 +269,8 @@ function FolderColumn({ data, isLast }) {
286
269
  });
287
270
  else actor.send({
288
271
  type: "select.view",
289
- viewId: item.viewId
272
+ viewId: item.viewId,
273
+ viewFolder: data.folderPath
290
274
  });
291
275
  };
292
276
  useMountEffect(() => {
@@ -303,7 +287,9 @@ function FolderColumn({ data, isLast }) {
303
287
  gap: "0.5",
304
288
  children: data.items.map((item, i) => /* @__PURE__ */ jsx(FolderColumnItem, {
305
289
  columnItem: item,
306
- onClick: onItemClicked(item)
290
+ onClick: onItemClicked(item),
291
+ miw: "250px",
292
+ maw: "clamp(300px, 30cqw, 400px)"
307
293
  }, `${data.folderPath}/${item.type}/${i}`))
308
294
  }) })
309
295
  });
@@ -316,8 +302,6 @@ function FolderColumnItem({ columnItem, ...props }) {
316
302
  label: columnItem.title,
317
303
  leftSection: folderIcon,
318
304
  rightSection: btnRightSection,
319
- maw: "300px",
320
- miw: "200px",
321
305
  ...props
322
306
  }, columnItem.folderPath);
323
307
  case "view": return /* @__PURE__ */ jsx(Tooltip$1, {
@@ -332,9 +316,7 @@ function FolderColumnItem({ columnItem, ...props }) {
332
316
  active: columnItem.selected,
333
317
  label: columnItem.title,
334
318
  description: columnItem.description,
335
- leftSection: ViewTypeIcon[columnItem.viewType],
336
- maw: "300px",
337
- miw: "200px",
319
+ leftSection: viewIcon(columnItem.viewType),
338
320
  ...props
339
321
  }, columnItem.viewId)
340
322
  });
@@ -346,6 +328,9 @@ function SearchInput(props) {
346
328
  ...props,
347
329
  finalValue: ""
348
330
  });
331
+ useEffect(() => {
332
+ handleChange(props.defaultValue);
333
+ }, [props.defaultValue]);
349
334
  return /* @__PURE__ */ jsx(Input, {
350
335
  size: "xs",
351
336
  placeholder: "Search by title or id",
@@ -358,18 +343,7 @@ function SearchInput(props) {
358
343
  classNames: {
359
344
  wrapper: css({
360
345
  flexGrow: 1,
361
- backgroundColor: {
362
- base: "mantine.gray[1]",
363
- _dark: "mantine.dark[5]/80",
364
- _hover: {
365
- base: "mantine.gray[2]",
366
- _dark: "mantine.dark[4]"
367
- },
368
- _focus: {
369
- base: "mantine.gray[2]",
370
- _dark: "mantine.dark[4]"
371
- }
372
- },
346
+ layerStyle: "surface.field",
373
347
  rounded: "sm"
374
348
  }),
375
349
  input: css({
@@ -381,7 +355,7 @@ function SearchInput(props) {
381
355
  leftSection: /* @__PURE__ */ jsx(IconSearch, { size: 14 }),
382
356
  rightSectionPointerEvents: "all",
383
357
  rightSectionWidth: "min-content",
384
- rightSection: !props.value || isEmpty(props.value) ? null : /* @__PURE__ */ jsx(Button, {
358
+ rightSection: isEmpty(_value) ? null : /* @__PURE__ */ jsx(Button, {
385
359
  variant: "subtle",
386
360
  h: "100%",
387
361
  size: "compact-xs",
@@ -1,9 +1,9 @@
1
- import { NavigationPanelActionIconVariant } from '../../styled-system/recipes';
2
- import { ActionIconProps, TooltipProps, PlaceholderPolymorphicProps, BreadcrumbsProps } from '@mantine/core';
1
+ import { NavigationPanelActionIconVariant } from '@likec4/styles/recipes';
2
+ import { ActionIconProps, TooltipProps, PlaceholderPolymorphicProps } from '@mantine/core';
3
3
  import { HTMLMotionProps } from 'motion/react';
4
- import { NamedExoticComponent, RefAttributes, ForwardRefExoticComponent } from 'react';
4
+ import { ReactNode, NamedExoticComponent, RefAttributes, ForwardRefExoticComponent } from 'react';
5
5
  export declare const Tooltip: NamedExoticComponent< TooltipProps & RefAttributes<HTMLDivElement> & PlaceholderPolymorphicProps>;
6
- export declare const BreadcrumbsSeparator: () => import("react").JSX.Element;
7
- export declare const Breadcrumbs: NamedExoticComponent< BreadcrumbsProps & RefAttributes<HTMLDivElement> & PlaceholderPolymorphicProps>;
8
- export type PanelActionIconProps = Partial<NavigationPanelActionIconVariant> & Omit<ActionIconProps, keyof NavigationPanelActionIconVariant> & Omit<HTMLMotionProps<'button'>, keyof NavigationPanelActionIconVariant>;
6
+ export type PanelActionIconProps = Partial<NavigationPanelActionIconVariant> & Omit<ActionIconProps, keyof NavigationPanelActionIconVariant> & Omit<HTMLMotionProps<'button'>, keyof NavigationPanelActionIconVariant> & {
7
+ tooltip?: ReactNode;
8
+ };
9
9
  export declare const PanelActionIcon: ForwardRefExoticComponent<Omit<PanelActionIconProps, "ref"> & RefAttributes<HTMLButtonElement>>;
@@ -1,9 +1,9 @@
1
1
  import "../_virtual/_rolldown/runtime.js";
2
- import { css, cx } from "@likec4/styles/css";
3
- import { IconChevronRight } from "@tabler/icons-react";
2
+ import { cx } from "@likec4/styles/css";
3
+ import "@tabler/icons-react";
4
4
  import { forwardRef } from "react";
5
5
  import { jsx } from "react/jsx-runtime";
6
- import { ActionIcon, Breadcrumbs, ThemeIcon, Tooltip } from "@mantine/core";
6
+ import { ActionIcon, Tooltip } from "@mantine/core";
7
7
  import * as m from "motion/react-m";
8
8
  import { navigationPanelActionIcon } from "@likec4/styles/recipes";
9
9
  //#region src/navigationpanel/_common.tsx
@@ -17,44 +17,33 @@ var Tooltip$1 = Tooltip.withProps({
17
17
  offset: 8,
18
18
  withinPortal: false
19
19
  });
20
- var BreadcrumbsSeparator = () => /* @__PURE__ */ jsx(ThemeIcon, {
21
- variant: "transparent",
22
- size: 16,
23
- className: css({
24
- display: {
25
- base: "none",
26
- "@/md": "flex"
27
- },
28
- color: {
29
- base: "mantine.gray[5]",
30
- _dark: "mantine.dark[3]"
31
- }
32
- }),
33
- children: /* @__PURE__ */ jsx(IconChevronRight, {})
20
+ var panelActionIconAnimation = {
21
+ whileHover: { scale: 1.085 },
22
+ whileTap: {
23
+ scale: 1,
24
+ translateY: 1
25
+ }
26
+ };
27
+ var PanelActionIcon = forwardRef(({ variant = "default", className, disabled = false, type, tooltip, ...others }, ref) => {
28
+ const content = /* @__PURE__ */ jsx(ActionIcon, {
29
+ size: "md",
30
+ variant: "transparent",
31
+ radius: "sm",
32
+ component: m.button,
33
+ ...!disabled ? panelActionIconAnimation : void 0,
34
+ disabled,
35
+ ...others,
36
+ className: cx(className, navigationPanelActionIcon({
37
+ variant,
38
+ type
39
+ })),
40
+ ref
41
+ });
42
+ if (tooltip) return /* @__PURE__ */ jsx(Tooltip$1, {
43
+ label: tooltip,
44
+ children: content
45
+ });
46
+ return content;
34
47
  });
35
- Breadcrumbs.withProps({
36
- separator: /* @__PURE__ */ jsx(BreadcrumbsSeparator, {}),
37
- separatorMargin: 4
38
- });
39
- var PanelActionIcon = forwardRef(({ variant = "default", className, disabled = false, type, ...others }, ref) => /* @__PURE__ */ jsx(ActionIcon, {
40
- size: "md",
41
- variant: "transparent",
42
- radius: "sm",
43
- component: m.button,
44
- ...!disabled && {
45
- whileHover: { scale: 1.085 },
46
- whileTap: {
47
- scale: 1,
48
- translateY: 1
49
- }
50
- },
51
- disabled,
52
- ...others,
53
- className: cx(className, navigationPanelActionIcon({
54
- variant,
55
- type
56
- })),
57
- ref
58
- }));
59
48
  //#endregion
60
- export { BreadcrumbsSeparator, PanelActionIcon, Tooltip$1 as Tooltip };
49
+ export { PanelActionIcon, Tooltip$1 as Tooltip };
@@ -13,18 +13,19 @@ var updateActivatedBy = () => actor.assign({ activatedBy: ({ context, event }) =
13
13
  var keepDropdownOpen = () => actor.assign({ activatedBy: "click" });
14
14
  var updateSelectedFolder = () => actor.assign(({ event }) => {
15
15
  if (event.type === "breadcrumbs.click.root") return { selectedFolder: "" };
16
+ if (event.type === "select.view") return { selectedFolder: event.viewFolder ?? "" };
16
17
  assertEvent(event, ["breadcrumbs.click.folder", "select.folder"]);
17
18
  return { selectedFolder: event.folderPath };
18
19
  });
19
- var resetSelectedFolder = () => actor.assign({ selectedFolder: ({ context }) => context.viewModel?.folder.path ?? "" });
20
+ var resetSelectedFolder = () => actor.assign({ selectedFolder: ({ context }) => context.viewFolder });
20
21
  var updateInputs = () => actor.assign(({ context, event }) => {
21
22
  assertEvent(event, "update.inputs");
22
- const viewChanged = event.inputs.viewModel?.id !== context.viewModel?.id;
23
+ const viewChanged = event.inputs.viewId !== context.viewId;
23
24
  let selectedFolder = context.selectedFolder;
24
- if (!event.inputs.viewModel?.folder.path.startsWith(selectedFolder)) selectedFolder = event.inputs.viewModel?.folder.path ?? "";
25
+ if (event.inputs.viewFolder && !event.inputs.viewFolder.startsWith(selectedFolder)) selectedFolder = event.inputs.viewFolder;
25
26
  return {
26
- view: event.inputs.view,
27
- viewModel: event.inputs.viewModel,
27
+ viewId: event.inputs.viewId,
28
+ viewFolder: event.inputs.viewFolder ?? context.viewFolder,
28
29
  selectedFolder,
29
30
  activatedBy: viewChanged ? "hover" : context.activatedBy
30
31
  };
@@ -65,7 +65,7 @@ var navigationPanelActorLogic = actor.createMachine({
65
65
  "breadcrumbs.click.viewtitle": { actions: resetSelectedFolder() },
66
66
  "breadcrumbs.click.*": { actions: updateSelectedFolder() },
67
67
  "select.folder": { actions: [keepDropdownOpen(), updateSelectedFolder()] },
68
- "select.view": { actions: emitNavigateTo() }
68
+ "select.view": { actions: [emitNavigateTo(), updateSelectedFolder()] }
69
69
  } },
70
70
  search: { on: {
71
71
  "breadcrumbs.click.viewtitle": {
@@ -76,7 +76,7 @@ var navigationPanelActorLogic = actor.createMachine({
76
76
  actions: [resetSearchQuery(), updateSelectedFolder()],
77
77
  target: "opened"
78
78
  },
79
- "select.view": { actions: emitNavigateTo() }
79
+ "select.view": { actions: [emitNavigateTo(), updateSelectedFolder()] }
80
80
  } },
81
81
  closing: {
82
82
  on: {
@@ -1,9 +1,8 @@
1
- import { LayoutedView, ViewId } from '@likec4/core/types';
2
- import { CurrentViewModel } from '../hooks/useCurrentViewModel';
1
+ import { ViewId } from '@likec4/core/types';
3
2
  import { SetupReturn, NonReducibleUnknown, EventObject, MetaObject } from 'xstate';
4
3
  export interface Input {
5
- view: LayoutedView;
6
- viewModel: CurrentViewModel | null;
4
+ viewId: ViewId;
5
+ viewFolder?: string | undefined;
7
6
  }
8
7
  export type Events = {
9
8
  type: 'update.inputs';
@@ -19,6 +18,7 @@ export type Events = {
19
18
  } | {
20
19
  type: 'select.view';
21
20
  viewId: ViewId;
21
+ viewFolder?: string | undefined;
22
22
  } | {
23
23
  type: 'breadcrumbs.mouseLeave';
24
24
  } | {
@@ -72,8 +72,8 @@ export type DropdownColumnItem = {
72
72
  selected: boolean;
73
73
  };
74
74
  export interface Context {
75
- view: LayoutedView;
76
- viewModel: CurrentViewModel | null;
75
+ viewId: ViewId;
76
+ viewFolder: string;
77
77
  /**
78
78
  * Who activated the dropdown
79
79
  * (if `click` then the dropdown is always open until dismissed)
@@ -4,7 +4,8 @@ import { setup } from "xstate";
4
4
  //#region src/navigationpanel/actor.setup.ts
5
5
  function Context({ input }) {
6
6
  return {
7
- ...input,
7
+ viewId: input.viewId,
8
+ viewFolder: input.viewFolder ?? "",
8
9
  activatedBy: "hover",
9
10
  selectedFolder: "",
10
11
  searchQuery: ""
@@ -14,9 +14,7 @@ function CompareActionsMenu({ disabled = false, onApplyLatestToManual, onResetMa
14
14
  shadow: "lg",
15
15
  position: "bottom-start",
16
16
  offset: { mainAxis: 4 },
17
- disabled,
18
17
  children: [/* @__PURE__ */ jsx(Menu.Target, { children: /* @__PURE__ */ jsxs(UnstyledButton, {
19
- disabled,
20
18
  className: cx("mantine-active", hstack({
21
19
  gap: "2",
22
20
  py: "1.5",
@@ -33,7 +31,7 @@ function CompareActionsMenu({ disabled = false, onApplyLatestToManual, onResetMa
33
31
  opacity: .7
34
32
  })]
35
33
  }) }), /* @__PURE__ */ jsxs(Menu.Dropdown, { children: [/* @__PURE__ */ jsxs(Menu.Item, {
36
- disabled: !onApplyLatestToManual,
34
+ disabled,
37
35
  onClick: onApplyLatestToManual,
38
36
  rightSection: onApplyLatestToManual && /* @__PURE__ */ jsx(Tooltip, {
39
37
  onClick: stopPropagation,
@@ -60,7 +58,7 @@ function CompareActionsMenu({ disabled = false, onApplyLatestToManual, onResetMa
60
58
  })]
61
59
  }), /* @__PURE__ */ jsx(Menu.Item, {
62
60
  onClick: onResetManualLayout,
63
- children: "Remove manual layout"
61
+ children: "Reset layout"
64
62
  })] })]
65
63
  });
66
64
  }
@@ -1,6 +1,5 @@
1
1
  import "../../_virtual/_rolldown/runtime.js";
2
2
  import { useCallbackRef } from "../../hooks/useCallbackRef.js";
3
- import { useEnabledFeatures } from "../../context/DiagramFeatures.js";
4
3
  import { useMantinePortalProps } from "../../hooks/useMantinePortalProps.js";
5
4
  import { useDiagramCompareLayout } from "../../hooks/useDiagramCompareLayout.js";
6
5
  import { Tooltip as Tooltip$1 } from "../_common.js";
@@ -33,7 +32,6 @@ var variants = {
33
32
  var ComparePanel = memo(() => {
34
33
  const portalProps = useMantinePortalProps();
35
34
  const isMounted = useIsMounted();
36
- const { enableCompareWithLatest } = useEnabledFeatures();
37
35
  const [ctx, ops] = useDiagramCompareLayout();
38
36
  const [isProcessing, setIsProcessing] = useState(false);
39
37
  const resetProcessing = () => {
@@ -61,9 +59,9 @@ var ComparePanel = memo(() => {
61
59
  resetProcessing();
62
60
  }, 200);
63
61
  });
64
- return /* @__PURE__ */ jsx(AnimatePresence, { children: enableCompareWithLatest && /* @__PURE__ */ jsxs(Fragment$1, { children: [/* @__PURE__ */ jsx(m$1.div, {
62
+ return /* @__PURE__ */ jsx(AnimatePresence, { children: ctx.state === "comparing" && /* @__PURE__ */ jsxs(Fragment$1, { children: [/* @__PURE__ */ jsx(m$1.div, {
65
63
  layout: "size",
66
- layoutDependency: ctx.drifts || ctx.layout,
64
+ layoutDependency: ctx.layout,
67
65
  className: hstack({
68
66
  gap: "2",
69
67
  layerStyle: "likec4.panel",
@@ -80,7 +78,7 @@ var ComparePanel = memo(() => {
80
78
  children: /* @__PURE__ */ jsx(ComparePanelControls, {})
81
79
  }, "ComparePanel"), /* @__PURE__ */ jsxs(m$1.div, {
82
80
  layout: "size",
83
- layoutDependency: ctx.drifts || ctx.layout,
81
+ layoutDependency: ctx.layout,
84
82
  variants,
85
83
  initial: "initial",
86
84
  animate: "animate",
@@ -93,12 +91,12 @@ var ComparePanel = memo(() => {
93
91
  pointerEvents: "all",
94
92
  height: "auto",
95
93
  overflow: "hidden",
96
- maxHeight: "calc(100cqh - 180px)",
97
- "@/md": { minWidth: "200px" }
94
+ maxHeight: "[calc(100cqh - 180px)]",
95
+ "@/md": { minWidth: "[200px]" }
98
96
  }),
99
97
  children: [/* @__PURE__ */ jsx(DriftsSummary, {}), ctx.canApplyLatest && /* @__PURE__ */ jsx(Fragment$1, { children: /* @__PURE__ */ jsxs(m$1.div, {
100
98
  layout: "position",
101
- className: css({ flex: "0" }),
99
+ className: css({ flex: "[0]" }),
102
100
  children: [/* @__PURE__ */ jsx(Divider, {
103
101
  orientation: "horizontal",
104
102
  size: "xs",
@@ -117,13 +115,13 @@ var ComparePanel = memo(() => {
117
115
  disabled: ctx.layout === "auto",
118
116
  children: "Apply changes"
119
117
  })
120
- }), !isProcessing && /* @__PURE__ */ jsx(Tooltip$1, {
118
+ }), /* @__PURE__ */ jsx(Tooltip$1, {
121
119
  openDelay: 100,
122
120
  disabled: ctx.layout !== "manual",
123
121
  label: "Reset manual layout",
124
122
  ...portalProps,
125
123
  children: /* @__PURE__ */ jsx(Button, {
126
- hidden: isProcessing,
124
+ disabled: isProcessing,
127
125
  size: "xs",
128
126
  color: "orange",
129
127
  variant: "subtle",
@@ -1 +1 @@
1
- export declare function DriftsSummary(): import("react").JSX.Element | null;
1
+ export declare function DriftsSummary(): import("react").JSX.Element;
@@ -84,8 +84,8 @@ function DriftsSummary() {
84
84
  })
85
85
  };
86
86
  const { view, nodes, edges } = selected;
87
- if (view.length === 0 && nodes.length === 0 && edges.length === 0) return null;
88
- return /* @__PURE__ */ jsx(AnimatePresence, { children: /* @__PURE__ */ jsxs(m.div, {
87
+ const hasDrifts = view.length > 0 || nodes.length > 0 || edges.length > 0;
88
+ return /* @__PURE__ */ jsx(AnimatePresence, { children: hasDrifts && /* @__PURE__ */ jsxs(m.div, {
89
89
  layout: "size",
90
90
  variants,
91
91
  initial: "initial",
@@ -146,15 +146,15 @@ function NodeDrifts({ id, name, drifts, ...handlers }) {
146
146
  ...handlers,
147
147
  children: [/* @__PURE__ */ jsx(Txt, {
148
148
  truncate: true,
149
+ medium: true,
149
150
  css: { maxWidth: {
150
- base: 160,
151
- "@/sm": 180,
152
- "@/md": 250
151
+ base: "[160px]",
152
+ "@/sm": "[180px]",
153
+ "@/md": "[250px]"
153
154
  } },
154
- color: "likec4.compare.manual.outline",
155
+ color: "likec4.compare.outline",
155
156
  fontSize: "xs",
156
157
  lineHeight: "sm",
157
- fontWeight: "medium",
158
158
  children: name
159
159
  }), map(drifts, (drift, i) => /* @__PURE__ */ jsx(DriftLabel, { children: drift }, key + drift + i))]
160
160
  }, key);
@@ -175,10 +175,12 @@ var DriftsGroup = styled(m.div, { base: vstack.raw({
175
175
  cursor: "default",
176
176
  rounded: "sm",
177
177
  backgroundColor: "likec4.compare.manual/10",
178
- border: "1px solid {colors.likec4.compare.manual.outline/20}",
178
+ borderWidth: "default",
179
+ borderStyle: "solid",
180
+ borderColor: "likec4.compare.outline/20",
179
181
  _hover: {
180
182
  backgroundColor: "likec4.compare.manual/20",
181
- borderColor: "likec4.compare.manual.outline/25"
183
+ borderColor: "likec4.compare.outline/25"
182
184
  }
183
185
  }) }, { defaultProps: {
184
186
  className: "group",