@likec4/diagram 1.21.1 → 1.22.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 (109) hide show
  1. package/dist/LikeC4Diagram.js +9 -13
  2. package/dist/base/index.d.ts +0 -1
  3. package/dist/base/primitives/element/styles.css.js +1 -1
  4. package/dist/{base → components}/Link.css.js +3 -3
  5. package/dist/components/SearchControl.css.d.ts +2 -0
  6. package/dist/components/SearchControl.css.js +7 -0
  7. package/dist/components/SearchControl.d.ts +5 -0
  8. package/dist/components/SearchControl.js +17 -0
  9. package/dist/context/IconRenderer.d.ts +10 -0
  10. package/dist/context/IconRenderer.js +34 -0
  11. package/dist/hooks/useCurrentViewId.js +8 -0
  12. package/dist/hooks/useDiagram.d.ts +4 -4
  13. package/dist/likec4diagram/DiagramUI.js +0 -2
  14. package/dist/likec4diagram/XYFlow.d.ts +6 -1
  15. package/dist/likec4diagram/XYFlow.js +28 -29
  16. package/dist/likec4diagram/custom/edges/RelationshipsDropdownMenu.js +2 -1
  17. package/dist/likec4diagram/state/actorContext.d.ts +16 -16
  18. package/dist/likec4diagram/state/assign.js +1 -1
  19. package/dist/likec4diagram/state/machine.d.ts +7 -7
  20. package/dist/likec4diagram/state/machine.js +10 -7
  21. package/dist/likec4diagram/ui/controls/Controls.js +63 -48
  22. package/dist/likec4diagram/ui/controls/NavigationButtons.js +44 -69
  23. package/dist/likec4diagram/ui/controls/_shared.js +1 -1
  24. package/dist/likec4diagram/ui/diagram-title/DiagramTitlePanel.js +1 -1
  25. package/dist/likec4diagram/ui/search/ElementsColumn.css.d.ts +15 -0
  26. package/dist/likec4diagram/ui/search/ElementsColumn.css.js +30 -0
  27. package/dist/likec4diagram/ui/search/ElementsColumn.d.ts +1 -0
  28. package/dist/likec4diagram/ui/search/ElementsColumn.js +243 -0
  29. package/dist/likec4diagram/ui/search/LikeC4Search.css.d.ts +8 -0
  30. package/dist/likec4diagram/ui/search/LikeC4Search.css.js +20 -0
  31. package/dist/likec4diagram/ui/search/LikeC4Search.d.ts +1 -0
  32. package/dist/likec4diagram/ui/search/LikeC4Search.js +265 -0
  33. package/dist/likec4diagram/ui/search/SearchInput.d.ts +1 -0
  34. package/dist/likec4diagram/ui/search/SearchInput.js +196 -0
  35. package/dist/likec4diagram/ui/search/ViewsColum.d.ts +9 -0
  36. package/dist/likec4diagram/ui/search/ViewsColum.js +130 -0
  37. package/dist/likec4diagram/ui/search/ViewsColumn.css.d.ts +5 -0
  38. package/dist/likec4diagram/ui/search/ViewsColumn.css.js +12 -0
  39. package/dist/likec4diagram/ui/search/_shared.css.d.ts +16 -0
  40. package/dist/likec4diagram/ui/search/_shared.css.js +5 -0
  41. package/dist/likec4diagram/ui/search/state.d.ts +19 -0
  42. package/dist/likec4diagram/ui/search/state.js +72 -0
  43. package/dist/likec4diagram/ui/search/utils.d.ts +3 -0
  44. package/dist/likec4diagram/ui/search/utils.js +23 -0
  45. package/dist/likec4diagram/useLayoutConstraints.js +4 -5
  46. package/dist/likec4model/useLikeC4ElementsTree.d.ts +1 -0
  47. package/dist/likec4model/useLikeC4ElementsTree.js +1 -0
  48. package/dist/overlays/Overlays.js +9 -9
  49. package/dist/overlays/element-details/ElementDetailsCard.js +20 -13
  50. package/dist/overlays/overlay/Overlay.d.ts +6 -2
  51. package/dist/overlays/overlay/Overlay.js +18 -29
  52. package/dist/overlays/relationship-details/SelectEdge.js +1 -3
  53. package/dist/overlays/relationships-browser/RelationshipsBrowser.js +6 -5
  54. package/dist/overlays/relationships-browser/SelectElement.js +10 -6
  55. package/dist/overlays/relationships-browser/actor.d.ts +2 -2
  56. package/dist/overlays/relationships-browser/actor.js +8 -8
  57. package/dist/overlays/relationships-browser/custom/nodeTypes.js +2 -2
  58. package/dist/style.css +1 -1
  59. package/package.json +13 -12
  60. package/src/LikeC4Diagram.tsx +0 -1
  61. package/src/base/index.ts +0 -2
  62. package/src/base/primitives/element/styles.css.ts +2 -2
  63. package/src/{base → components}/Link.css.ts +3 -3
  64. package/src/components/SearchControl.css.ts +69 -0
  65. package/src/components/SearchControl.tsx +33 -0
  66. package/src/context/IconRenderer.tsx +54 -1
  67. package/src/globals.css.ts +0 -2
  68. package/src/likec4diagram/DiagramUI.tsx +0 -4
  69. package/src/likec4diagram/XYFlow.tsx +30 -30
  70. package/src/likec4diagram/custom/edges/RelationshipsDropdownMenu.tsx +2 -1
  71. package/src/likec4diagram/state/assign.ts +1 -1
  72. package/src/likec4diagram/state/machine.ts +12 -10
  73. package/src/likec4diagram/ui/controls/Controls.tsx +35 -25
  74. package/src/likec4diagram/ui/controls/NavigationButtons.tsx +36 -58
  75. package/src/likec4diagram/ui/controls/styles.css.ts +3 -1
  76. package/src/likec4diagram/ui/diagram-title/DiagramTitlePanel.tsx +1 -1
  77. package/src/likec4diagram/ui/search/ElementsColumn.css.ts +119 -0
  78. package/src/likec4diagram/ui/search/ElementsColumn.tsx +291 -0
  79. package/src/likec4diagram/ui/search/LikeC4Search.css.ts +117 -0
  80. package/src/likec4diagram/ui/search/LikeC4Search.tsx +312 -0
  81. package/src/likec4diagram/ui/search/SearchInput.tsx +235 -0
  82. package/src/likec4diagram/ui/search/ViewsColum.tsx +158 -0
  83. package/src/likec4diagram/ui/search/ViewsColumn.css.ts +37 -0
  84. package/src/likec4diagram/ui/search/_shared.css.ts +104 -0
  85. package/src/likec4diagram/ui/search/state.ts +76 -0
  86. package/src/likec4diagram/ui/search/utils.ts +20 -0
  87. package/src/likec4diagram/useLayoutConstraints.ts +4 -5
  88. package/src/likec4model/useLikeC4ElementsTree.ts +4 -4
  89. package/src/overlays/Overlays.tsx +31 -25
  90. package/src/overlays/element-details/ElementDetailsCard.css.ts +4 -4
  91. package/src/overlays/element-details/ElementDetailsCard.tsx +245 -240
  92. package/src/overlays/overlay/Overlay.css.ts +10 -9
  93. package/src/overlays/overlay/Overlay.tsx +38 -26
  94. package/src/overlays/relationship-details/SelectEdge.css.ts +1 -0
  95. package/src/overlays/relationship-details/SelectEdge.tsx +2 -4
  96. package/src/overlays/relationships-browser/RelationshipsBrowser.tsx +10 -5
  97. package/src/overlays/relationships-browser/SelectElement.tsx +88 -82
  98. package/src/overlays/relationships-browser/actor.ts +10 -10
  99. package/src/overlays/relationships-browser/custom/nodeTypes.tsx +2 -2
  100. package/dist/LikeC4Search.css.d.ts +0 -1
  101. package/dist/LikeC4Search.css.js +0 -5
  102. package/dist/LikeC4Search.d.ts +0 -2
  103. package/dist/LikeC4Search.js +0 -88
  104. package/src/LikeC4Search.css.ts +0 -12
  105. package/src/LikeC4Search.tsx +0 -91
  106. /package/dist/{base → components}/Link.css.d.ts +0 -0
  107. /package/dist/{base → components}/Link.d.ts +0 -0
  108. /package/dist/{base → components}/Link.js +0 -0
  109. /package/src/{base → components}/Link.tsx +0 -0
@@ -4,7 +4,6 @@ import { useRef } from "react";
4
4
  import { isEmpty } from "remeda";
5
5
  import { LikeC4CustomColors } from "./LikeC4CustomColors.js";
6
6
  import { DiagramActor } from "./likec4diagram/DiagramActor.js";
7
- import { DiagramUI } from "./likec4diagram/DiagramUI.js";
8
7
  import { useViewToNodesEdges } from "./likec4diagram/useViewToNodesEdges.js";
9
8
  import { LikeC4DiagramXYFlow } from "./likec4diagram/XYFlow.js";
10
9
  import { useLikeC4Model } from "./likec4model/useLikeC4Model.js";
@@ -113,7 +112,7 @@ function LikeC4Diagram({
113
112
  {
114
113
  fitView,
115
114
  ...initialRef.current,
116
- children: /* @__PURE__ */ jsxs(
115
+ children: /* @__PURE__ */ jsx(
117
116
  DiagramActor,
118
117
  {
119
118
  input: {
@@ -123,17 +122,14 @@ function LikeC4Diagram({
123
122
  fitViewPadding,
124
123
  ...xyNodesEdges
125
124
  },
126
- children: [
127
- /* @__PURE__ */ jsx(
128
- LikeC4DiagramXYFlow,
129
- {
130
- nodesDraggable,
131
- nodesSelectable,
132
- background
133
- }
134
- ),
135
- /* @__PURE__ */ jsx(DiagramUI, {})
136
- ]
125
+ children: /* @__PURE__ */ jsx(
126
+ LikeC4DiagramXYFlow,
127
+ {
128
+ nodesDraggable,
129
+ nodesSelectable,
130
+ background
131
+ }
132
+ )
137
133
  }
138
134
  )
139
135
  }
@@ -1,3 +1,2 @@
1
1
  export { BaseXYFlow, type BaseXYFlowProps } from './BaseXYFlow';
2
2
  export { Base, type EdgeProps, type NodeProps, type NonOptional, type ReactFlowEdge, type ReactFlowNode, } from './types';
3
- export { Link } from './Link';
@@ -1,6 +1,6 @@
1
1
  /* empty css */
2
2
  /* empty css */
3
- var iconSize = "var(--v7x5jk2)";
3
+ var iconSize = "var(--likec4-icon-size)";
4
4
  export {
5
5
  iconSize
6
6
  };
@@ -1,7 +1,7 @@
1
1
  /* empty css */
2
- var elementLink = "_180738q0";
3
- var linkIcon = "_180738q1";
4
- var linkTitleBox = "_180738q2";
2
+ var elementLink = "_1acgss10";
3
+ var linkIcon = "_1acgss11";
4
+ var linkTitleBox = "_1acgss12";
5
5
  export {
6
6
  elementLink,
7
7
  linkIcon,
@@ -0,0 +1,2 @@
1
+ export declare const root: string;
2
+ export declare const shortcut: string;
@@ -0,0 +1,7 @@
1
+ /* empty css */
2
+ var root = "xmhqho2";
3
+ var shortcut = "xmhqho3";
4
+ export {
5
+ root,
6
+ shortcut
7
+ };
@@ -0,0 +1,5 @@
1
+ import { ElementProps, UnstyledButtonProps } from '@mantine/core';
2
+ interface SearchControlProps extends UnstyledButtonProps, ElementProps<'button'> {
3
+ }
4
+ export declare function SearchControl({ className, ...others }: SearchControlProps): import("react/jsx-runtime").JSX.Element;
5
+ export {};
@@ -0,0 +1,17 @@
1
+ import { jsx, jsxs } from "react/jsx-runtime";
2
+ import { UnstyledButton, Group, rem, Text } from "@mantine/core";
3
+ import { IconSearch } from "@tabler/icons-react";
4
+ import { isMacOs } from "@xyflow/system";
5
+ import clsx from "clsx";
6
+ import { shortcut, root } from "./SearchControl.css.js";
7
+ function SearchControl({ className, ...others }) {
8
+ const isMac = isMacOs();
9
+ return /* @__PURE__ */ jsx(UnstyledButton, { ...others, className: clsx(root, className), children: /* @__PURE__ */ jsxs(Group, { gap: "xs", children: [
10
+ /* @__PURE__ */ jsx(IconSearch, { style: { width: rem(15), height: rem(15) }, stroke: 2 }),
11
+ /* @__PURE__ */ jsx(Text, { fz: "sm", fw: "500", pr: 50, children: "Search" }),
12
+ /* @__PURE__ */ jsx(Text, { fw: 700, className: shortcut, children: isMac ? "⌘ + K" : "Ctrl + K" })
13
+ ] }) });
14
+ }
15
+ export {
16
+ SearchControl
17
+ };
@@ -1,3 +1,4 @@
1
+ import { ElementShape } from '@likec4/core';
1
2
  import { ElementIconRenderer } from '../LikeC4Diagram.props';
2
3
  import { Provider } from 'react';
3
4
  export declare const IconRendererProvider: Provider<ElementIconRenderer | null>;
@@ -9,3 +10,12 @@ export declare function IconRenderer({ element, className, }: {
9
10
  };
10
11
  className: string;
11
12
  }): import("react/jsx-runtime").JSX.Element | null;
13
+ export declare function IconOrShapeRenderer({ element, className, }: {
14
+ element: {
15
+ id: string;
16
+ title: string;
17
+ shape: ElementShape;
18
+ icon?: string | null | undefined;
19
+ };
20
+ className: string;
21
+ }): import("react/jsx-runtime").JSX.Element;
@@ -1,4 +1,5 @@
1
1
  import { jsx } from "react/jsx-runtime";
2
+ import { IconCylinder, IconRectangularPrism, IconReorder, IconUser, IconDeviceMobile, IconBrowser } from "@tabler/icons-react";
2
3
  import clsx from "clsx";
3
4
  import { createContext, useContext } from "react";
4
5
  const IconRendererContext = createContext(null);
@@ -32,7 +33,40 @@ function IconRenderer({
32
33
  }
33
34
  );
34
35
  }
36
+ const ShapeIcons = {
37
+ browser: IconBrowser,
38
+ cylinder: IconCylinder,
39
+ mobile: IconDeviceMobile,
40
+ person: IconUser,
41
+ queue: IconReorder,
42
+ rectangle: IconRectangularPrism,
43
+ storage: IconCylinder
44
+ };
45
+ function IconOrShapeRenderer({
46
+ element,
47
+ className
48
+ }) {
49
+ const icon = IconRenderer({
50
+ element,
51
+ className
52
+ });
53
+ if (icon) {
54
+ return icon;
55
+ }
56
+ const ShapeIcon = ShapeIcons[element.shape];
57
+ return /* @__PURE__ */ jsx(
58
+ "div",
59
+ {
60
+ className: clsx(
61
+ className,
62
+ "likec4-shape-icon"
63
+ ),
64
+ children: /* @__PURE__ */ jsx(ShapeIcon, {})
65
+ }
66
+ );
67
+ }
35
68
  export {
69
+ IconOrShapeRenderer,
36
70
  IconRenderer,
37
71
  IconRendererProvider
38
72
  };
@@ -0,0 +1,8 @@
1
+ import { useDiagramContext } from "./useDiagramContext.js";
2
+ const selectViewId = (state) => state.view.id;
3
+ function useCurrentViewId() {
4
+ return useDiagramContext(selectViewId);
5
+ }
6
+ export {
7
+ useCurrentViewId
8
+ };
@@ -7556,9 +7556,9 @@ export declare function useDiagram(): {
7556
7556
  };
7557
7557
  };
7558
7558
  readonly on: {
7559
- readonly 'xyflow.applyNodeChages': {
7559
+ readonly 'xyflow.applyNodeChanges': {
7560
7560
  readonly actions: ActionFunction<DiagramContext, {
7561
- type: "xyflow.applyNodeChages";
7561
+ type: "xyflow.applyNodeChanges";
7562
7562
  changes: NodeChange<Types.Node>[];
7563
7563
  }, Events, undefined, Values<{
7564
7564
  hotkeyActor: {
@@ -7771,9 +7771,9 @@ export declare function useDiagram(): {
7771
7771
  };
7772
7772
  }>, never, never, never, never>;
7773
7773
  };
7774
- readonly 'xyflow.applyEdgeChages': {
7774
+ readonly 'xyflow.applyEdgeChanges': {
7775
7775
  readonly actions: ActionFunction<DiagramContext, {
7776
- type: "xyflow.applyEdgeChages";
7776
+ type: "xyflow.applyEdgeChanges";
7777
7777
  changes: EdgeChange<Types.Edge>[];
7778
7778
  }, Events, undefined, Values<{
7779
7779
  hotkeyActor: {
@@ -1,5 +1,4 @@
1
1
  import { jsxs, Fragment, jsx } from "react/jsx-runtime";
2
- import { LikeC4Search } from "../LikeC4Search.js";
3
2
  import { Overlays } from "../overlays/Overlays.js";
4
3
  import { Controls } from "./ui/controls/Controls.js";
5
4
  import { IfEnabled } from "../context/DiagramFeatures.js";
@@ -10,7 +9,6 @@ function DiagramUI() {
10
9
  return /* @__PURE__ */ jsxs(Fragment, { children: [
11
10
  /* @__PURE__ */ jsx(Controls, {}),
12
11
  /* @__PURE__ */ jsx(Overlays, {}),
13
- /* @__PURE__ */ jsx(IfEnabled, { feature: "Search", children: /* @__PURE__ */ jsx(LikeC4Search, {}) }),
14
12
  /* @__PURE__ */ jsx(IfEnabled, { feature: "ViewTitle", children: /* @__PURE__ */ jsx(DiagramTitlePanel, {}) }),
15
13
  /* @__PURE__ */ jsx(IfEnabled, { feature: "Notations", children: /* @__PURE__ */ jsx(NotationPanel, {}) }),
16
14
  /* @__PURE__ */ jsx(IfEnabled, { feature: "DynamicViewWalkthrough", children: /* @__PURE__ */ jsx(DynamicViewWalkthrough, {}) })
@@ -1,6 +1,11 @@
1
1
  import { EnforceOptional } from 'type-fest/source/enforce-optional';
2
2
  import { LikeC4DiagramProperties } from '../LikeC4Diagram.props';
3
+ import { NamedExoticComponent } from 'react';
3
4
  type Picked = EnforceOptional<Pick<LikeC4DiagramProperties, 'background' | 'nodesDraggable' | 'nodesSelectable'>>;
4
5
  export type LikeC4DiagramXYFlowProps = Required<Picked>;
5
- export declare const LikeC4DiagramXYFlow: ({ background, ...rest }: LikeC4DiagramXYFlowProps) => import("react/jsx-runtime").JSX.Element;
6
+ export declare const LikeC4DiagramXYFlow: NamedExoticComponent<Required<{
7
+ background?: "solid" | "transparent" | "dots" | "lines" | "cross";
8
+ nodesDraggable?: boolean;
9
+ nodesSelectable?: boolean;
10
+ }>>;
6
11
  export {};
@@ -3,10 +3,12 @@ import { nonNullable } from "@likec4/core";
3
3
  import { useCallbackRef } from "@mantine/hooks";
4
4
  import clsx from "clsx";
5
5
  import { shallowEqual } from "fast-equals";
6
+ import { memo } from "react";
6
7
  import { BaseXYFlow } from "../base/BaseXYFlow.js";
7
8
  import { useDiagram } from "../hooks/useDiagram.js";
8
9
  import { useDiagramContext } from "../hooks/useDiagramContext.js";
9
10
  import { edgeTypes } from "./custom/index.js";
11
+ import { DiagramUI } from "./DiagramUI.js";
10
12
  import { useLayoutConstraints } from "./useLayoutConstraints.js";
11
13
  import { useDiagramEventHandlers } from "../context/DiagramEventHandlers.js";
12
14
  import { nodeTypes } from "./custom/nodes/nodeTypes.js";
@@ -21,7 +23,7 @@ const selectXYProps = (ctx) => ({
21
23
  enableReadOnly: ctx.features.enableReadOnly
22
24
  });
23
25
  const equalsXYProps = (a, b) => a.initialized === b.initialized && a.pannable === b.pannable && a.zoomable === b.zoomable && a.fitViewPadding === b.fitViewPadding && a.enableFitView === b.enableFitView && a.enableReadOnly === b.enableReadOnly && shallowEqual(a.nodes, b.nodes) && shallowEqual(a.edges, b.edges);
24
- const LikeC4DiagramXYFlow = ({ background, ...rest }) => {
26
+ const LikeC4DiagramXYFlow = memo(({ background, nodesDraggable, nodesSelectable }) => {
25
27
  const diagram = useDiagram();
26
28
  const {
27
29
  initialized,
@@ -54,10 +56,10 @@ const LikeC4DiagramXYFlow = ({ background, ...rest }) => {
54
56
  nodeTypes,
55
57
  edgeTypes,
56
58
  onNodesChange: useCallbackRef((changes) => {
57
- diagram.send({ type: "xyflow.applyNodeChages", changes });
59
+ diagram.send({ type: "xyflow.applyNodeChanges", changes });
58
60
  }),
59
61
  onEdgesChange: useCallbackRef((changes) => {
60
- diagram.send({ type: "xyflow.applyEdgeChages", changes });
62
+ diagram.send({ type: "xyflow.applyEdgeChanges", changes });
61
63
  }),
62
64
  background: initialized ? background : "transparent",
63
65
  fitView: false,
@@ -78,6 +80,7 @@ const LikeC4DiagramXYFlow = ({ background, ...rest }) => {
78
80
  }),
79
81
  onDoubleClick: useCallbackRef((e) => {
80
82
  e.stopPropagation();
83
+ e.preventDefault();
81
84
  diagram.send({ type: "xyflow.paneDblClick" });
82
85
  onCanvasDblClick == null ? void 0 : onCanvasDblClick(e);
83
86
  }),
@@ -87,38 +90,34 @@ const LikeC4DiagramXYFlow = ({ background, ...rest }) => {
87
90
  onInit: useCallbackRef((instance) => {
88
91
  diagram.send({ type: "xyflow.init", instance });
89
92
  }),
90
- ...onNodeContextMenu && {
91
- onNodeContextMenu: useCallbackRef((event, node) => {
92
- const diagramNode = nonNullable(
93
- diagram.findDiagramNode(node.id),
94
- `diagramNode ${node.id} not found`
95
- );
96
- onNodeContextMenu(diagramNode, event);
97
- })
98
- },
99
- ...onEdgeContextMenu && {
100
- onEdgeContextMenu: useCallbackRef((event, edge) => {
101
- const diagramEdge = nonNullable(
102
- diagram.findDiagramEdge(edge.id),
103
- `diagramEdge ${edge.id} not found`
104
- );
105
- onEdgeContextMenu(diagramEdge, event);
106
- })
107
- },
108
- ...onCanvasContextMenu && {
109
- onPaneContextMenu: useCallbackRef((event) => {
110
- onCanvasContextMenu(event);
111
- })
112
- },
93
+ onNodeContextMenu: useCallbackRef((event, node) => {
94
+ const diagramNode = nonNullable(
95
+ diagram.findDiagramNode(node.id),
96
+ `diagramNode ${node.id} not found`
97
+ );
98
+ onNodeContextMenu == null ? void 0 : onNodeContextMenu(diagramNode, event);
99
+ }),
100
+ onEdgeContextMenu: useCallbackRef((event, edge) => {
101
+ const diagramEdge = nonNullable(
102
+ diagram.findDiagramEdge(edge.id),
103
+ `diagramEdge ${edge.id} not found`
104
+ );
105
+ onEdgeContextMenu == null ? void 0 : onEdgeContextMenu(diagramEdge, event);
106
+ }),
107
+ onPaneContextMenu: useCallbackRef((event) => {
108
+ onCanvasContextMenu == null ? void 0 : onCanvasContextMenu(event);
109
+ }),
113
110
  ...enableFitView && {
114
111
  onViewportResize
115
112
  },
116
- ...notReadOnly && rest.nodesDraggable && layoutConstraints,
113
+ nodesDraggable,
114
+ nodesSelectable,
115
+ ...notReadOnly && nodesDraggable && layoutConstraints,
117
116
  ...props,
118
- ...rest
117
+ children: /* @__PURE__ */ jsx(DiagramUI, {})
119
118
  }
120
119
  );
121
- };
120
+ }, shallowEqual);
122
121
  export {
123
122
  LikeC4DiagramXYFlow
124
123
  };
@@ -5,7 +5,7 @@ import { IconInfoCircle, IconArrowRight, IconZoomScan, IconFileSymlink } from "@
5
5
  import clsx from "clsx";
6
6
  import { useCallback, Fragment as Fragment$1, forwardRef } from "react";
7
7
  import { pipe, map, filter, isTruthy, partition } from "remeda";
8
- import { Link } from "../../../base/Link.js";
8
+ import { Link } from "../../../components/Link.js";
9
9
  import { useDiagram } from "../../../hooks/useDiagram.js";
10
10
  import { useDiagramContext } from "../../../hooks/useDiagramContext.js";
11
11
  import { DiagramContext } from "../../state/machine.js";
@@ -89,6 +89,7 @@ function RelationshipsDropdownMenu({
89
89
  closeOnClickOutside: true,
90
90
  clickOutsideEvents: ["pointerdown", "mousedown", "click"],
91
91
  closeOnEscape: true,
92
+ keepMounted: false,
92
93
  closeOnItemClick: false,
93
94
  disabled,
94
95
  position: "bottom-start",
@@ -9055,9 +9055,9 @@ export declare const LikeC4ViewMachineContextProvider: (props: {
9055
9055
  };
9056
9056
  };
9057
9057
  readonly on: {
9058
- readonly 'xyflow.applyNodeChages': {
9058
+ readonly 'xyflow.applyNodeChanges': {
9059
9059
  readonly actions: ActionFunction<DiagramContext, {
9060
- type: "xyflow.applyNodeChages";
9060
+ type: "xyflow.applyNodeChanges";
9061
9061
  changes: NodeChange<import("../types").Types.Node>[];
9062
9062
  }, Events, undefined, Values<{
9063
9063
  hotkeyActor: {
@@ -9307,9 +9307,9 @@ export declare const LikeC4ViewMachineContextProvider: (props: {
9307
9307
  };
9308
9308
  }>, never, never, never, never>;
9309
9309
  };
9310
- readonly 'xyflow.applyEdgeChages': {
9310
+ readonly 'xyflow.applyEdgeChanges': {
9311
9311
  readonly actions: ActionFunction<DiagramContext, {
9312
- type: "xyflow.applyEdgeChages";
9312
+ type: "xyflow.applyEdgeChanges";
9313
9313
  changes: EdgeChange<{
9314
9314
  id: string;
9315
9315
  source: string;
@@ -22116,9 +22116,9 @@ export declare const LikeC4ViewMachineContextProvider: (props: {
22116
22116
  };
22117
22117
  };
22118
22118
  readonly on: {
22119
- readonly 'xyflow.applyNodeChages': {
22119
+ readonly 'xyflow.applyNodeChanges': {
22120
22120
  readonly actions: ActionFunction<DiagramContext, {
22121
- type: "xyflow.applyNodeChages";
22121
+ type: "xyflow.applyNodeChanges";
22122
22122
  changes: NodeChange<import("../types").Types.Node>[];
22123
22123
  }, Events, undefined, Values<{
22124
22124
  hotkeyActor: {
@@ -22368,9 +22368,9 @@ export declare const LikeC4ViewMachineContextProvider: (props: {
22368
22368
  };
22369
22369
  }>, never, never, never, never>;
22370
22370
  };
22371
- readonly 'xyflow.applyEdgeChages': {
22371
+ readonly 'xyflow.applyEdgeChanges': {
22372
22372
  readonly actions: ActionFunction<DiagramContext, {
22373
- type: "xyflow.applyEdgeChages";
22373
+ type: "xyflow.applyEdgeChanges";
22374
22374
  changes: EdgeChange<{
22375
22375
  id: string;
22376
22376
  source: string;
@@ -34842,9 +34842,9 @@ export declare const LikeC4ViewMachineContextProvider: (props: {
34842
34842
  };
34843
34843
  };
34844
34844
  readonly on: {
34845
- readonly 'xyflow.applyNodeChages': {
34845
+ readonly 'xyflow.applyNodeChanges': {
34846
34846
  readonly actions: ActionFunction<DiagramContext, {
34847
- type: "xyflow.applyNodeChages";
34847
+ type: "xyflow.applyNodeChanges";
34848
34848
  changes: NodeChange<import("../types").Types.Node>[];
34849
34849
  }, Events, undefined, Values<{
34850
34850
  hotkeyActor: {
@@ -35094,9 +35094,9 @@ export declare const LikeC4ViewMachineContextProvider: (props: {
35094
35094
  };
35095
35095
  }>, never, never, never, never>;
35096
35096
  };
35097
- readonly 'xyflow.applyEdgeChages': {
35097
+ readonly 'xyflow.applyEdgeChanges': {
35098
35098
  readonly actions: ActionFunction<DiagramContext, {
35099
- type: "xyflow.applyEdgeChages";
35099
+ type: "xyflow.applyEdgeChanges";
35100
35100
  changes: EdgeChange<{
35101
35101
  id: string;
35102
35102
  source: string;
@@ -47901,9 +47901,9 @@ export declare const LikeC4ViewMachineContextProvider: (props: {
47901
47901
  };
47902
47902
  };
47903
47903
  readonly on: {
47904
- readonly 'xyflow.applyNodeChages': {
47904
+ readonly 'xyflow.applyNodeChanges': {
47905
47905
  readonly actions: ActionFunction<DiagramContext, {
47906
- type: "xyflow.applyNodeChages";
47906
+ type: "xyflow.applyNodeChanges";
47907
47907
  changes: NodeChange<import("../types").Types.Node>[];
47908
47908
  }, Events, undefined, Values<{
47909
47909
  hotkeyActor: {
@@ -48153,9 +48153,9 @@ export declare const LikeC4ViewMachineContextProvider: (props: {
48153
48153
  };
48154
48154
  }>, never, never, never, never>;
48155
48155
  };
48156
- readonly 'xyflow.applyEdgeChages': {
48156
+ readonly 'xyflow.applyEdgeChanges': {
48157
48157
  readonly actions: ActionFunction<DiagramContext, {
48158
- type: "xyflow.applyEdgeChages";
48158
+ type: "xyflow.applyEdgeChanges";
48159
48159
  changes: EdgeChange<{
48160
48160
  id: string;
48161
48161
  source: string;
@@ -277,7 +277,7 @@ function resetEdgeControlPoints({ context }) {
277
277
  if (!sourceCenter || !targetCenter) {
278
278
  return [];
279
279
  }
280
- if (source == target) {
280
+ if (source === target) {
281
281
  const loopSize = 80;
282
282
  const centerOfTopBoundary = new VectorImpl(0, source.height || 0).mul(-0.5).add(sourceCenter);
283
283
  return [
@@ -1,4 +1,4 @@
1
- import { BBox, DiagramView, EdgeId, Fqn, NodeId, RelationId, StepEdgeId, ViewChange, ViewId, XYPoint, DiagramNode, Color, RelationshipLineType, NonEmptyArray } from '@likec4/core';
1
+ import { BBox, DiagramView, EdgeId, Fqn, NodeId, StepEdgeId, ViewChange, ViewId, XYPoint, DiagramNode, RelationId, Color, RelationshipLineType, NonEmptyArray } from '@likec4/core';
2
2
  import { ReactFlowInstance, useStoreApi, GeneralHelpers, ViewportHelperFunctions } from '@xyflow/react';
3
3
  import { EdgeChange, NodeChange, Rect, Viewport, EdgeMarkerType, HandleType } from '@xyflow/system';
4
4
  import { ActorRefFromLogic, SnapshotFrom, StateMachine, CallbackActorLogic, AnyEventObject, NonReducibleUnknown, EventObject, MetaObject, AnyActorLogic, ConditionalRequired, InputFrom, RequiredLogicInput, IsNotNever, ActorRef, MachineSnapshot, AnyActorRef, StateValue, ActionFunction, ActorLogic, Values, RequiredActorOptions, GetConcreteByKey, StopAction, CancelAction } from 'xstate';
@@ -70,10 +70,10 @@ export type Events = HotKeyEvent | {
70
70
  type: 'xyflow.init';
71
71
  instance: ReactFlowInstance<Types.Node, Types.Edge>;
72
72
  } | {
73
- type: 'xyflow.applyNodeChages';
73
+ type: 'xyflow.applyNodeChanges';
74
74
  changes: NodeChange<Types.Node>[];
75
75
  } | {
76
- type: 'xyflow.applyEdgeChages';
76
+ type: 'xyflow.applyEdgeChanges';
77
77
  changes: EdgeChange<Types.Edge>[];
78
78
  } | {
79
79
  type: 'xyflow.viewportMoved';
@@ -7600,9 +7600,9 @@ export declare const diagramMachine: StateMachine<DiagramContext, Events, {
7600
7600
  };
7601
7601
  };
7602
7602
  readonly on: {
7603
- readonly 'xyflow.applyNodeChages': {
7603
+ readonly 'xyflow.applyNodeChanges': {
7604
7604
  readonly actions: ActionFunction<DiagramContext, {
7605
- type: "xyflow.applyNodeChages";
7605
+ type: "xyflow.applyNodeChanges";
7606
7606
  changes: NodeChange<Types.Node>[];
7607
7607
  }, Events, undefined, Values<{
7608
7608
  hotkeyActor: {
@@ -7815,9 +7815,9 @@ export declare const diagramMachine: StateMachine<DiagramContext, Events, {
7815
7815
  };
7816
7816
  }>, never, never, never, never>;
7817
7817
  };
7818
- readonly 'xyflow.applyEdgeChages': {
7818
+ readonly 'xyflow.applyEdgeChanges': {
7819
7819
  readonly actions: ActionFunction<DiagramContext, {
7820
- type: "xyflow.applyEdgeChages";
7820
+ type: "xyflow.applyEdgeChanges";
7821
7821
  changes: EdgeChange<Types.Edge>[];
7822
7822
  }, Events, undefined, Values<{
7823
7823
  hotkeyActor: {
@@ -472,7 +472,7 @@ const diagramMachine = setup({
472
472
  pending: {
473
473
  entry: enqueueActions(({ enqueue }) => {
474
474
  enqueue.sendTo((c) => c.context.syncLayoutActorRef, { type: "stop" });
475
- enqueue.stopChild("layout");
475
+ enqueue.stopChild("syncLayout");
476
476
  enqueue({
477
477
  type: "trigger:NavigateTo",
478
478
  params: ({ context }) => ({
@@ -495,15 +495,16 @@ const diagramMachine = setup({
495
495
  }
496
496
  }
497
497
  });
498
+ enqueue.raise({ type: "fitDiagram" }, { id: "fitDiagram", delay: 80 });
498
499
  } else {
499
500
  enqueue({
500
501
  type: "xyflow:setViewportCenter",
501
502
  params: getBBoxCenter(event.view.bounds)
502
503
  });
504
+ enqueue.raise({ type: "fitDiagram", duration: 200 }, { id: "fitDiagram", delay: 25 });
503
505
  }
504
506
  enqueue.assign(updateNavigationHistory);
505
507
  enqueue.assign(mergeXYNodesEdges);
506
- enqueue.raise({ type: "fitDiagram" }, { id: "fitDiagram", delay: 75 });
507
508
  }),
508
509
  target: "done"
509
510
  }
@@ -602,12 +603,12 @@ const diagramMachine = setup({
602
603
  }
603
604
  },
604
605
  on: {
605
- "xyflow.applyNodeChages": {
606
+ "xyflow.applyNodeChanges": {
606
607
  actions: assign({
607
608
  xynodes: ({ context, event }) => applyNodeChanges(event.changes, context.xynodes)
608
609
  })
609
610
  },
610
- "xyflow.applyEdgeChages": {
611
+ "xyflow.applyEdgeChanges": {
611
612
  actions: assign({
612
613
  xyedges: ({ context, event }) => applyEdgeChanges(event.changes, context.xyedges)
613
614
  })
@@ -673,17 +674,19 @@ const diagramMachine = setup({
673
674
  }
674
675
  }
675
676
  });
677
+ enqueue.raise({ type: "fitDiagram" }, { id: "fitDiagram", delay: 80 });
676
678
  } else {
677
679
  enqueue({
678
680
  type: "xyflow:setViewportCenter",
679
681
  params: getBBoxCenter(event.view.bounds)
680
682
  });
683
+ enqueue.raise({ type: "fitDiagram", duration: 200 }, { id: "fitDiagram", delay: 25 });
681
684
  }
682
685
  } else {
683
686
  enqueue.sendTo((c) => c.context.syncLayoutActorRef, { type: "synced" });
684
- }
685
- if (isAnotherView || !context.viewportChangedManually) {
686
- enqueue.raise({ type: "fitDiagram" }, { id: "fitDiagram", delay: 90 });
687
+ if (!context.viewportChangedManually) {
688
+ enqueue.raise({ type: "fitDiagram" }, { id: "fitDiagram", delay: 50 });
689
+ }
687
690
  }
688
691
  enqueue.assign(mergeXYNodesEdges);
689
692
  enqueue.assign({