@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
@@ -106,8 +106,8 @@ function DeploymentNode(props) {
106
106
  });
107
107
  }
108
108
  var compoundHasDrifts = css({
109
- outlineColor: "likec4.compare.manual.outline",
110
- outlineWidth: "4px",
109
+ outlineColor: "likec4.compare.outline",
110
+ outlineWidth: "extra",
111
111
  outlineStyle: "dashed",
112
112
  outlineOffset: "1.5"
113
113
  });
@@ -73,7 +73,7 @@ function ColorSwatches({ theme, elementColor, onColorPreview, onChange }) {
73
73
  openDelay: 1e3,
74
74
  closeDelay: 300,
75
75
  children: [/* @__PURE__ */ jsx(Flex$1, {
76
- maxW: "120px",
76
+ maxW: "[120px]",
77
77
  gap: "1.5",
78
78
  justify: "flex-start",
79
79
  align: "flex-start",
@@ -107,7 +107,7 @@ function ColorSwatches({ theme, elementColor, onColorPreview, onChange }) {
107
107
  }, color))
108
108
  }), /* @__PURE__ */ jsx(Flex$1, {
109
109
  mt: "sm",
110
- maxW: "110px",
110
+ maxW: "[110px]",
111
111
  gap: "1.5",
112
112
  justify: "flex-start",
113
113
  align: "flex-start",
@@ -1,6 +1,6 @@
1
1
  import "../../../../_virtual/_rolldown/runtime.js";
2
2
  import { stopPropagation } from "../../../../utils/xyflow.js";
3
- import { useDiagramContext } from "../../../../hooks/useDiagram.js";
3
+ import { selectDiagramContext, useDiagramSelector } from "../../../../hooks/safeContext.js";
4
4
  import { toolbarTitle } from "./styles.css.js";
5
5
  import { cx } from "@likec4/styles/css";
6
6
  import { jsx, jsxs } from "react/jsx-runtime";
@@ -9,11 +9,11 @@ import { Paper, Text } from "@mantine/core";
9
9
  import { useDebouncedValue } from "@mantine/hooks";
10
10
  import { Box as Box$1, HStack, VStack } from "@likec4/styles/jsx";
11
11
  //#region src/likec4diagram/custom/nodes/toolbar/Toolbar.tsx
12
- var selectSelectedNodesCount = (context) => {
12
+ var selectSelectedNodesCount = selectDiagramContext((context) => {
13
13
  return context.xynodes.filter((x) => x.selected).length;
14
- };
14
+ });
15
15
  var useSelectedNodesCount = () => {
16
- return useDiagramContext(selectSelectedNodesCount);
16
+ return useDiagramSelector(selectSelectedNodesCount);
17
17
  };
18
18
  function Toolbar({ title, children, nodeProps, ...props }) {
19
19
  const selectedNodesCount = useSelectedNodesCount();
@@ -36,7 +36,7 @@ function Toolbar({ title, children, nodeProps, ...props }) {
36
36
  pb: 8,
37
37
  pt: 4,
38
38
  radius: "sm",
39
- shadow: "xl",
39
+ shadow: "lg",
40
40
  onDoubleClickCapture: stopPropagation,
41
41
  onPointerDown: stopPropagation,
42
42
  onClick: stopPropagation,
@@ -4,7 +4,7 @@ var toolbarTitle = css({
4
4
  color: "text.dimmed",
5
5
  fontSize: "xxs",
6
6
  fontWeight: "bold",
7
- maxWidth: "220px",
7
+ maxWidth: "[220px]",
8
8
  cursor: "default",
9
9
  userSelect: "all",
10
10
  textOverflow: "ellipsis",
@@ -229,6 +229,8 @@ var RelationshipPopoverInternal = ({ viewId, diagramEdge, direct, nested, source
229
229
  } },
230
230
  className: cx(css({
231
231
  layerStyle: "likec4.dropdown",
232
+ border: "subtle",
233
+ rounded: "sm",
232
234
  p: "0",
233
235
  pointerEvents: {
234
236
  base: "all",
@@ -1,6 +1,6 @@
1
1
  import { Color } from '@likec4/core/types';
2
2
  import { PropsWithChildren } from 'react';
3
- import { StyledComponent } from '../../../styled-system/types';
3
+ import { StyledComponent } from '@likec4/styles/types';
4
4
  export declare const Endpoint: ({ children, likec4color }: PropsWithChildren<{
5
5
  likec4color: Color;
6
6
  }>) => import("react").JSX.Element;
@@ -12,7 +12,7 @@ var Endpoint = ({ children, likec4color }) => {
12
12
  whiteSpace: "nowrap",
13
13
  overflow: "hidden",
14
14
  textOverflow: "ellipsis",
15
- maxWidth: "160px",
15
+ truncate: true,
16
16
  paddingX: "1",
17
17
  paddingY: "0.5",
18
18
  rounded: "xs",
@@ -25,6 +25,10 @@ var Endpoint = ({ children, likec4color }) => {
25
25
  _dark: "var(--likec4-palette-loContrast)"
26
26
  }
27
27
  }),
28
+ style: {
29
+ minWidth: 0,
30
+ maxWidth: 160
31
+ },
28
32
  children
29
33
  });
30
34
  };
@@ -35,7 +39,7 @@ var RelationshipTitle = styled("div", { base: {
35
39
  userSelect: "all",
36
40
  overflowWrap: "anywhere",
37
41
  wordBreak: "break-word",
38
- minWidth: 0
42
+ minWidth: "0"
39
43
  } });
40
44
  //#endregion
41
45
  export { Endpoint, RelationshipTitle };
@@ -1,14 +1,19 @@
1
1
  import { DiagramView, DynamicViewDisplayVariant, WhereOperator } from '@likec4/core/types';
2
2
  import { PropsWithChildren } from 'react';
3
- import { ViewPaddings } from '../../LikeC4Diagram.props';
4
- export declare function DiagramActorProvider({ id, view, zoomable, pannable, nodesDraggable, nodesSelectable, fitViewPadding, where, children, dynamicViewVariant: _defaultVariant, }: PropsWithChildren<{
3
+ import { RelationshipBrowserScope, ViewPaddings } from '../../LikeC4Diagram.props';
4
+ export declare function DiagramActorProvider({ id, view, zoomable, pannable, fitView, initialZoom, nodesDraggable, nodesSelectable, fitViewPadding, where, minZoom, maxZoom, children, dynamicViewVariant: _defaultVariant, relationshipBrowserScope, }: PropsWithChildren<{
5
5
  id: string;
6
6
  view: DiagramView;
7
7
  zoomable: boolean;
8
8
  pannable: boolean;
9
+ fitView: boolean;
10
+ initialZoom?: number | undefined;
11
+ minZoom?: number | undefined;
12
+ maxZoom?: number | undefined;
9
13
  nodesDraggable: boolean;
10
14
  nodesSelectable: boolean;
11
15
  fitViewPadding: ViewPaddings;
12
16
  where?: WhereOperator | null;
13
17
  dynamicViewVariant?: DynamicViewDisplayVariant | undefined;
18
+ relationshipBrowserScope: RelationshipBrowserScope;
14
19
  }>): import("react").JSX.Element;
@@ -1,4 +1,5 @@
1
1
  import "../../_virtual/_rolldown/runtime.js";
2
+ import { MinZoom } from "../../base/const.js";
2
3
  import { useUpdateEffect } from "../../hooks/useUpdateEffect.js";
3
4
  import { useDiagramEventHandlersRef } from "../../context/DiagramEventHandlers.js";
4
5
  import { DiagramFeatures, useEnabledFeatures } from "../../context/DiagramFeatures.js";
@@ -14,7 +15,7 @@ import { useStoreApi } from "@xyflow/react";
14
15
  import { isNullish } from "remeda";
15
16
  import { useActorRef } from "@xstate/react";
16
17
  //#region src/likec4diagram/state/DiagramActorProvider.tsx
17
- function DiagramActorProvider({ id, view, zoomable, pannable, nodesDraggable, nodesSelectable, fitViewPadding, where = null, children, dynamicViewVariant: _defaultVariant }) {
18
+ function DiagramActorProvider({ id, view, zoomable, pannable, fitView, initialZoom, nodesDraggable, nodesSelectable, fitViewPadding, where = null, minZoom = MinZoom, maxZoom = 3, children, dynamicViewVariant: _defaultVariant, relationshipBrowserScope }) {
18
19
  const xystore = useStoreApi();
19
20
  const editor = useEditorActorLogic();
20
21
  const features = useEnabledFeatures();
@@ -26,12 +27,17 @@ function DiagramActorProvider({ id, view, zoomable, pannable, nodesDraggable, no
26
27
  view,
27
28
  zoomable,
28
29
  pannable,
30
+ fitView,
31
+ initialZoom,
32
+ minZoom,
33
+ maxZoom,
29
34
  fitViewPadding,
30
35
  nodesDraggable,
31
36
  nodesSelectable,
32
37
  where,
33
38
  features,
34
- dynamicViewVariant: _defaultVariant
39
+ dynamicViewVariant: _defaultVariant,
40
+ relationshipBrowserScope
35
41
  }
36
42
  });
37
43
  const actorRef = useRef(actor);
@@ -54,18 +60,28 @@ function DiagramActorProvider({ id, view, zoomable, pannable, nodesDraggable, no
54
60
  zoomable,
55
61
  where,
56
62
  pannable,
63
+ fitView,
64
+ initialZoom,
65
+ minZoom,
66
+ maxZoom,
57
67
  fitViewPadding,
58
68
  nodesDraggable,
59
- nodesSelectable
69
+ nodesSelectable,
70
+ relationshipBrowserScope
60
71
  }
61
72
  }), [
62
73
  actor,
63
74
  zoomable,
64
75
  where,
65
76
  pannable,
77
+ fitView,
78
+ initialZoom,
79
+ minZoom,
80
+ maxZoom,
66
81
  fitViewPadding,
67
82
  nodesDraggable,
68
- nodesSelectable
83
+ nodesSelectable,
84
+ relationshipBrowserScope
69
85
  ]);
70
86
  useUpdateEffect(() => {
71
87
  if (!_defaultVariant) return;
@@ -3,7 +3,7 @@ import { RefObject } from 'react';
3
3
  import { PartialDeep } from 'type-fest';
4
4
  import { TogglableFeature } from '../../context/DiagramFeatures';
5
5
  import { EditorActorRef } from '../../editor/actor/machine';
6
- import { OpenSourceParams } from '../../LikeC4Diagram.props';
6
+ import { OpenSourceParams, RelationshipBrowserScope } from '../../LikeC4Diagram.props';
7
7
  import { OverlaysActorRef } from '../../overlays/overlaysActor';
8
8
  import { SearchActorRef } from '../../search/searchActor';
9
9
  import { Types } from '../types';
@@ -69,7 +69,7 @@ export declare class DiagramApi<A extends Any = Unknown> {
69
69
  /**
70
70
  * Open relationships browser
71
71
  */
72
- openRelationshipsBrowser(fqn: Fqn<A>): void;
72
+ openRelationshipsBrowser(fqn: Fqn<A>, scope?: RelationshipBrowserScope): void;
73
73
  /**
74
74
  * If running in editor, trigger opening source file
75
75
  */
@@ -88,10 +88,11 @@ var DiagramApi = class DiagramApi {
88
88
  /**
89
89
  * Open relationships browser
90
90
  */
91
- openRelationshipsBrowser(fqn) {
91
+ openRelationshipsBrowser(fqn, scope) {
92
92
  this.send({
93
93
  type: "open.relationshipsBrowser",
94
- fqn
94
+ fqn,
95
+ ...scope && { scope }
95
96
  });
96
97
  }
97
98
  /**
@@ -1,10 +1,10 @@
1
1
  import "../../_virtual/_rolldown/runtime.js";
2
2
  import { Base } from "../../base/Base.js";
3
+ import { convertToXYFlow } from "../convert-to-xyflow.js";
3
4
  import { findDiagramEdge, findDiagramNode, typedSystem, viewBounds } from "./utils.js";
4
5
  import { machine } from "./machine.setup.js";
5
6
  import { createLayoutConstraints } from "../useLayoutConstraints.js";
6
7
  import { focusNodesEdges, mergeXYNodesEdges, resetEdgeControlPoints } from "./assign.js";
7
- import { convertToXYFlow } from "../convert-to-xyflow.js";
8
8
  import { getAligner, toNodeRect } from "./aligners.js";
9
9
  import { assignViewportBefore, cancelFitDiagram, centerOnNodeOrEdge, fitDiagram, fitFocusedBounds, raiseFitDiagram, raiseSetViewport, raiseUpdateView, returnViewportBefore, setViewport, setViewportCenter } from "./machine.actions.layout.js";
10
10
  import { hasAtLeast, isTruthy, mapToObj } from "remeda";
@@ -13,6 +13,7 @@ import { BBox as BBox$1 } from "@likec4/core/geometry";
13
13
  import { difference as difference$1, isString as isString$1 } from "@likec4/core/utils";
14
14
  import { nodeToRect } from "@xyflow/system";
15
15
  import { assertEvent } from "xstate";
16
+ import { getViewFolderPath } from "@likec4/core/model";
16
17
  import { produce } from "immer";
17
18
  //#region src/likec4diagram/state/machine.actions.ts
18
19
  var resetSelection = () => machine.raise({ type: "xyflow.resetSelection" });
@@ -231,7 +232,7 @@ var emitOnLayoutTypeChange = () => machine.enqueueActions(({ event, system, cont
231
232
  return;
232
233
  }
233
234
  if (context.toggledFeatures.enableCompareWithLatest === true) {
234
- if (currentLayoutType === "manual" && nextLayoutType === "auto") typedSystem(system).editorActorRef?.send({ type: "cancel" });
235
+ if (currentLayoutType === "manual" && nextLayoutType === "auto") enqueue.sendTo(typedSystem.editorActor, { type: "cancel" });
235
236
  const currentViewport = context.viewport;
236
237
  if (currentLayoutType === "auto") enqueue.assign({ viewportOnAutoLayout: currentViewport });
237
238
  if (currentLayoutType === "manual") enqueue.assign({ viewportOnManualLayout: currentViewport });
@@ -308,8 +309,9 @@ var notationsHighlight = () => machine.assign(({ context, event }) => {
308
309
  });
309
310
  var tagHighlight = () => machine.assign(({ context, event }) => {
310
311
  assertEvent(event, "tag.highlight");
312
+ const tag = event.tag.startsWith("#") ? event.tag.slice(1) : event.tag;
311
313
  return { xynodes: context.xynodes.map((n) => {
312
- if (n.data.tags?.includes(event.tag)) return Base.setDimmed(n, false);
314
+ if (n.data.tags && n.data.tags.includes(tag)) return Base.setDimmed(n, false);
313
315
  return Base.setDimmed(n, true);
314
316
  }) };
315
317
  });
@@ -477,7 +479,7 @@ var openOverlay = () => machine.enqueueActions(({ context, event, enqueue, check
477
479
  type: "open.relationshipsBrowser",
478
480
  subject: event.fqn,
479
481
  viewId: context.view.id,
480
- scope: "view",
482
+ scope: event.scope ?? context.relationshipBrowserScope,
481
483
  closeable: true,
482
484
  enableChangeScope: true,
483
485
  enableSelectSubject: true
@@ -537,12 +539,13 @@ var ensureNavigationPanelActor = () => machine.enqueueActions(({ enqueue, check,
537
539
  const enabled = check("enabled: NavigationPanel");
538
540
  const running = typedSystem(system).navigationActorRef;
539
541
  if (enabled && !running) {
542
+ const viewFolder = context.view.title ? getViewFolderPath(context.view.title) : "";
540
543
  enqueue.spawnChild("navigationPanel", {
541
544
  id: "navigationPanel",
542
545
  systemId: "navigationPanel",
543
546
  input: {
544
- view: context.view,
545
- viewModel: null
547
+ viewId: context.view.id,
548
+ viewFolder: viewFolder ?? ""
546
549
  },
547
550
  syncSnapshot: true
548
551
  });
@@ -225,6 +225,7 @@ export declare const centerOnNodeOrEdge: () => ActionFunction<Context, Events, E
225
225
  export declare const fitDiagram: (params?: {
226
226
  duration?: number;
227
227
  bounds?: BBox;
228
+ zoom?: number | undefined;
228
229
  }) => ActionFunction<Context, Events, Events, unknown, {
229
230
  src: "search";
230
231
  logic: SearchActorLogic;
@@ -1,5 +1,4 @@
1
1
  import "../../_virtual/_rolldown/runtime.js";
2
- import { MinZoom } from "../../base/const.js";
3
2
  import { calcEdgeBounds } from "../../utils/view-bounds.js";
4
3
  import { activeSequenceBounds, focusedBounds, getEdgeBounds, viewBounds } from "./utils.js";
5
4
  import { isActiveSequenceWalkthrough, machine } from "./machine.setup.js";
@@ -77,15 +76,16 @@ var centerOnNodeOrEdge = () => machine.raise(({ context, event }) => {
77
76
  bounds: getNodesBounds([node], xystate)
78
77
  };
79
78
  });
80
- function fitBoundsInViewport(context, bounds, duration) {
79
+ function fitBoundsInViewport(context, bounds, duration, zoom) {
81
80
  let { width, height, panZoom, transform } = nonNullable(context.xystore).getState();
82
81
  let left = void 0;
83
82
  if (isActiveSequenceWalkthrough(context)) {
84
83
  left = context.activeWalkthrough.outlinePanelWidth;
85
84
  width -= left;
86
85
  }
87
- const maxZoom = calcMaxZoom(context, transform);
88
- const viewport = getViewportForBounds(bounds, width, height, MinZoom, maxZoom, context.fitViewPadding);
86
+ const minZoom = zoom ?? context.minZoom;
87
+ const maxZoom = zoom ?? calcMaxZoom(context, transform);
88
+ const viewport = getViewportForBounds(bounds, width, height, minZoom, maxZoom, context.fitViewPadding);
89
89
  viewport.x = Math.round(viewport.x);
90
90
  viewport.y = Math.round(viewport.y);
91
91
  if (left !== void 0) viewport.x += left;
@@ -100,16 +100,18 @@ function fitBoundsInViewport(context, bounds, duration) {
100
100
  var fitDiagram = (params) => machine.createAction(({ context, event }) => {
101
101
  let bounds;
102
102
  let duration;
103
+ let zoom;
103
104
  if (params) {
104
105
  bounds = params.bounds;
105
106
  duration = params.duration;
107
+ zoom = params.zoom;
106
108
  } else if (event.type === "xyflow.fitDiagram") {
107
109
  bounds = event.bounds;
108
110
  duration = event.duration;
109
111
  }
110
112
  bounds ??= viewBounds(context);
111
113
  duration ??= 450;
112
- fitBoundsInViewport(context, bounds, duration);
114
+ fitBoundsInViewport(context, bounds, duration, zoom);
113
115
  });
114
116
  var fitFocusedBounds = (params) => machine.createAction(({ context }) => {
115
117
  let { bounds, duration = 450 } = !!context.activeWalkthrough ? activeSequenceBounds({ context }) : focusedBounds({ context });
@@ -6,7 +6,7 @@ import { PartialDeep } from 'type-fest';
6
6
  import { ActorRefFromLogic, StateMachine, StateValue, SetupReturn, NonReducibleUnknown, MetaObject } from 'xstate';
7
7
  import { EnabledFeatures, TogglableFeature } from '../../context/DiagramFeatures';
8
8
  import { XYFlowInstance, XYStoreApi } from '../../hooks/useXYFlow';
9
- import { OpenSourceParams, ViewPaddings } from '../../LikeC4Diagram.props';
9
+ import { OpenSourceParams, RelationshipBrowserScope, ViewPaddings } from '../../LikeC4Diagram.props';
10
10
  import { Types } from '../types';
11
11
  import { AlignmentMode } from './aligners';
12
12
  import { HotKeyEvent, HotkeyActorLogic } from './hotkeyActor';
@@ -40,17 +40,23 @@ export interface Input {
40
40
  xystore: XYStoreApi;
41
41
  zoomable: boolean;
42
42
  pannable: boolean;
43
+ fitView?: boolean | undefined;
44
+ initialZoom?: number | undefined;
45
+ minZoom?: number | undefined;
46
+ maxZoom?: number | undefined;
43
47
  nodesDraggable: boolean;
44
48
  nodesSelectable: boolean;
45
49
  fitViewPadding: ViewPaddings;
46
50
  where: WhereOperator | null;
47
51
  dynamicViewVariant?: DynamicViewDisplayVariant | undefined;
52
+ relationshipBrowserScope?: RelationshipBrowserScope | undefined;
48
53
  features?: EnabledFeatures;
49
54
  }
50
55
  export type ToggledFeatures = {
51
56
  [P in `enable${TogglableFeature}`]?: boolean;
52
57
  };
53
58
  export interface Context extends Input {
59
+ relationshipBrowserScope: RelationshipBrowserScope;
54
60
  xynodes: Types.Node[];
55
61
  xyedges: Types.Edge[];
56
62
  features: EnabledFeatures;
@@ -100,6 +106,8 @@ export interface Context extends Input {
100
106
  collapsedSequenceFlows: {
101
107
  [flowId: StepPath]: boolean;
102
108
  };
109
+ minZoom: number;
110
+ maxZoom: number;
103
111
  }
104
112
  export declare function Context({ input }: {
105
113
  input: Input;
@@ -206,6 +214,7 @@ export type Events = HotKeyEvent | MediaPrintEvent | {
206
214
  } | {
207
215
  type: 'open.relationshipsBrowser';
208
216
  fqn: Fqn;
217
+ scope?: RelationshipBrowserScope | undefined;
209
218
  } | {
210
219
  type: 'open.search';
211
220
  search?: string;
@@ -1,4 +1,5 @@
1
1
  import "../../_virtual/_rolldown/runtime.js";
2
+ import "../../base/const.js";
2
3
  import { DefaultFeatures } from "../../context/DiagramFeatures.js";
3
4
  import { defineActors } from "../../utils/defineActors.js";
4
5
  import { editorActorLogic } from "../../editor/actor/machine.js";
@@ -16,6 +17,8 @@ import { assertEvent, setup } from "xstate";
16
17
  function Context({ input }) {
17
18
  return {
18
19
  ...input,
20
+ fitView: input.fitView ?? true,
21
+ relationshipBrowserScope: input.relationshipBrowserScope ?? "view",
19
22
  xynodes: [],
20
23
  xyedges: [],
21
24
  features: {
@@ -51,7 +54,9 @@ function Context({ input }) {
51
54
  xyflow: null,
52
55
  dynamicViewVariant: input.dynamicViewVariant ?? (input.view._type === "dynamic" ? input.view.variant : "diagram") ?? "diagram",
53
56
  activeWalkthrough: null,
54
- collapsedSequenceFlows: {}
57
+ collapsedSequenceFlows: {},
58
+ minZoom: input.minZoom ?? .05,
59
+ maxZoom: input.maxZoom ?? 3
55
60
  };
56
61
  }
57
62
  var deriveToggledFeatures = (context) => {
@@ -96,7 +96,7 @@ export declare const initializing: {
96
96
  export declare const isReady: {
97
97
  always: ({
98
98
  guard: "isReady";
99
- actions: ( ActionFunction<Context, Events, Events, unknown, {
99
+ actions: ActionFunction<Context, Events, Events, undefined, {
100
100
  src: "search";
101
101
  logic: SearchActorLogic;
102
102
  id: "search";
@@ -198,31 +198,7 @@ export declare const isReady: {
198
198
  } | {
199
199
  type: "click: active walkthrough step";
200
200
  params: unknown;
201
- }, never, EmittedEvents> | ActionFunction<Context, Events, Events, undefined, {
202
- src: "search";
203
- logic: SearchActorLogic;
204
- id: "search";
205
- } | {
206
- src: "hotkey";
207
- logic: HotkeyActorLogic;
208
- id: "hotkey";
209
- } | {
210
- src: "overlays";
211
- logic: OverlaysActorLogic;
212
- id: "overlays";
213
- } | {
214
- src: "mediaPrint";
215
- logic: MediaPrintActorLogic;
216
- id: "mediaPrint";
217
- } | {
218
- src: "editor";
219
- logic: EditorActorLogic;
220
- id: "editor";
221
- } | {
222
- src: "navigationPanel";
223
- logic: NavigationPanelActorLogic;
224
- id: "navigationPanel";
225
- }, never, never, never, never> | ActionFunction<Context, Events, Events, undefined, never, never, never, never, EmittedEvents>)[];
201
+ }, never, EmittedEvents>;
226
202
  target: string;
227
203
  } | {
228
204
  target: string;
@@ -37,18 +37,21 @@ var initializing = machine.createStateConfig({ on: {
37
37
  */
38
38
  var isReady = machine.createStateConfig({ always: [{
39
39
  guard: "isReady",
40
- actions: [
41
- fitDiagram({ duration: 0 }),
42
- assign(({ context }) => ({ navigationHistory: {
40
+ actions: machine.enqueueActions(({ context, enqueue }) => {
41
+ enqueue(fitDiagram({
42
+ duration: 0,
43
+ zoom: context.initialZoom ?? (context.fitView ? void 0 : 1)
44
+ }));
45
+ enqueue(assign(({ context }) => ({ navigationHistory: {
43
46
  currentIndex: 0,
44
47
  history: [{
45
48
  viewId: context.view.id,
46
49
  viewport: { ...context.xyflow.getViewport() },
47
50
  viewportChangedManually: false
48
51
  }]
49
- } })),
50
- emitInitialized()
51
- ],
52
+ } })));
53
+ enqueue(emitInitialized());
54
+ }),
52
55
  target: "ready"
53
56
  }, { target: "initializing" }] });
54
57
  //#endregion
@@ -1,10 +1,10 @@
1
1
  import "../../_virtual/_rolldown/runtime.js";
2
2
  import { roundDpr } from "../../utils/roundDpr.js";
3
3
  import { parsePaddings } from "../../utils/xyflow.js";
4
+ import { convertToXYFlow } from "../convert-to-xyflow.js";
4
5
  import { calcViewportForBounds, findCorrespondingNode, findNodeByModelFqn, nodeRef, viewBounds } from "./utils.js";
5
6
  import { machine, targetState, to } from "./machine.setup.js";
6
7
  import { mergeXYNodesEdges } from "./assign.js";
7
- import { convertToXYFlow } from "../convert-to-xyflow.js";
8
8
  import { cancelFitDiagram, raiseSetViewport } from "./machine.actions.layout.js";
9
9
  import { disableCompareWithLatest } from "./machine.actions.js";
10
10
  import { isTruthy } from "remeda";