@likec4/diagram 1.27.3 → 1.28.1

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 (164) hide show
  1. package/bundle/index.js +974 -1036
  2. package/dist/LikeC4CustomColors.js +2 -2
  3. package/dist/LikeC4Diagram.js +2 -2
  4. package/dist/LikeC4ModelProvider.js +1 -1
  5. package/dist/_virtual/index.js +5 -0
  6. package/dist/_virtual/index2.js +3 -0
  7. package/dist/_virtual/react.production.js +3 -0
  8. package/dist/base/BaseXYFlow.js +5 -5
  9. package/dist/base/primitives/compound/CompoundActionButton.js +1 -1
  10. package/dist/base/primitives/compound/CompoundDetailsButton.js +1 -1
  11. package/dist/base/primitives/compound/CompoundNodeContainer.d.ts +1 -1
  12. package/dist/base/primitives/compound/CompoundNodeContainer.js +2 -2
  13. package/dist/base/primitives/customEdge.js +2 -2
  14. package/dist/base/primitives/customNode.js +2 -2
  15. package/dist/base/primitives/edge/EdgeActionButton.d.ts +1 -2
  16. package/dist/base/primitives/edge/EdgeContainer.js +1 -1
  17. package/dist/base/primitives/edge/EdgeLabel.js +1 -1
  18. package/dist/base/primitives/edge/EdgeLabelContainer.js +1 -1
  19. package/dist/base/primitives/edge/EdgePath.d.ts +10 -42
  20. package/dist/base/primitives/edge/EdgePath.js +23 -16
  21. package/dist/base/primitives/edge/edge.css.js +1 -1
  22. package/dist/base/primitives/element/ElementActionButtons.d.ts +1 -1
  23. package/dist/base/primitives/element/ElementActionButtons.js +6 -5
  24. package/dist/base/primitives/element/ElementDetailsButton.js +5 -2
  25. package/dist/base/primitives/element/ElementNodeContainer.js +3 -3
  26. package/dist/base/updateEdges.js +7 -2
  27. package/dist/base/updateNodes.js +11 -3
  28. package/dist/bundle/LikeC4View.js +3 -3
  29. package/dist/bundle/ReactLikeC4.js +1 -1
  30. package/dist/bundle/ShadowRoot.js +3 -3
  31. package/dist/bundle/styles.css.js +4 -4
  32. package/dist/context/ControlsCustomLayout.js +1 -1
  33. package/dist/context/DiagramEventHandlers.js +5 -5
  34. package/dist/context/DiagramFeatures.js +7 -7
  35. package/dist/context/EnsureMantine.js +2 -2
  36. package/dist/context/FramerMotionConfig.js +2 -2
  37. package/dist/context/IconRenderer.js +4 -4
  38. package/dist/context/ReduceGraphics.js +2 -2
  39. package/dist/context/RootContainer.js +5 -9
  40. package/dist/hooks/safeContext.js +3 -3
  41. package/dist/hooks/useCurrentViewId.js +1 -1
  42. package/dist/hooks/useDiagram.d.ts +3 -7
  43. package/dist/hooks/useDiagram.js +2 -2
  44. package/dist/hooks/useMantinePortalProps.js +2 -2
  45. package/dist/hooks/useSetState.js +3 -3
  46. package/dist/hooks/useUpdateEffect.js +1 -1
  47. package/dist/likec4diagram/DiagramUI.js +2 -2
  48. package/dist/likec4diagram/DiagramXYFlow.js +2 -2
  49. package/dist/likec4diagram/custom/edges/NotePopover.js +2 -2
  50. package/dist/likec4diagram/custom/edges/RelationshipEdge.js +17 -7
  51. package/dist/likec4diagram/custom/edges/RelationshipsDropdownMenu.js +6 -6
  52. package/dist/likec4diagram/custom/nodes/toolbar/ColorButton.js +2 -2
  53. package/dist/likec4diagram/custom/nodes/toolbar/CompoundToolbar.js +3 -3
  54. package/dist/likec4diagram/custom/nodes/toolbar/_shared.js +2 -2
  55. package/dist/likec4diagram/ui/controls/ChangeAutoLayoutButton.js +4 -4
  56. package/dist/likec4diagram/ui/controls/Controls.js +6 -6
  57. package/dist/likec4diagram/ui/controls/NavigationButtons.js +1 -1
  58. package/dist/likec4diagram/ui/diagram-title/DiagramTitlePanel.js +1 -1
  59. package/dist/likec4diagram/ui/notation/NotationPanel.js +4 -5
  60. package/dist/likec4diagram/ui/search/ElementsColumn.js +88 -77
  61. package/dist/likec4diagram/ui/search/LikeC4Search.d.ts +2 -1
  62. package/dist/likec4diagram/ui/search/LikeC4Search.js +27 -24
  63. package/dist/likec4diagram/ui/search/SearchInput.js +1 -1
  64. package/dist/likec4diagram/ui/search/ViewsColum.js +3 -2
  65. package/dist/likec4diagram/ui/search/state.js +11 -9
  66. package/dist/likec4diagram/ui/walkthrough/DynamicViewWalkthrough.js +1 -1
  67. package/dist/likec4diagram/useLayoutConstraints.js +3 -3
  68. package/dist/likec4model/LikeC4ModelContext.js +2 -2
  69. package/dist/likec4model/useLikeC4ElementsTree.js +2 -2
  70. package/dist/likec4model/useLikeC4Model.js +2 -2
  71. package/dist/node_modules/.pnpm/react@19.0.0/node_modules/react/cjs/react.production.js +548 -0
  72. package/dist/node_modules/.pnpm/react@19.0.0/node_modules/react/index.js +15 -0
  73. package/dist/overlays/Overlays.js +8 -8
  74. package/dist/overlays/element-details/ElementDetailsCard.js +5 -5
  75. package/dist/overlays/element-details/TabPanelDeployments.js +7 -4
  76. package/dist/overlays/element-details/TabPanelRelationships.js +2 -2
  77. package/dist/overlays/element-details/TabPanelStructure.js +6 -3
  78. package/dist/overlays/element-details/actor.d.ts +301 -301
  79. package/dist/overlays/element-details/actorContext.js +3 -3
  80. package/dist/overlays/overlay/Overlay.css.d.ts +2 -25
  81. package/dist/overlays/overlay/Overlay.css.js +0 -40
  82. package/dist/overlays/overlay/Overlay.d.ts +1 -1
  83. package/dist/overlays/overlay/Overlay.js +99 -89
  84. package/dist/overlays/overlaysActor.js +4 -1
  85. package/dist/overlays/relationship-details/RelationshipDetails.js +28 -23
  86. package/dist/overlays/relationship-details/SelectEdge.js +3 -6
  87. package/dist/overlays/relationship-details/actor.d.ts +2 -0
  88. package/dist/overlays/relationship-details/custom/edgeTypes.js +1 -1
  89. package/dist/overlays/relationship-details/custom/nodeTypes.js +1 -1
  90. package/dist/overlays/relationship-details/hooks.d.ts +3 -1
  91. package/dist/overlays/relationship-details/hooks.js +4 -4
  92. package/dist/overlays/relationships-browser/RelationshipsBrowser.js +9 -11
  93. package/dist/overlays/relationships-browser/SelectElement.js +8 -5
  94. package/dist/overlays/relationships-browser/actor.d.ts +1 -1
  95. package/dist/overlays/relationships-browser/actor.js +6 -12
  96. package/dist/overlays/relationships-browser/const.d.ts +2 -1
  97. package/dist/overlays/relationships-browser/const.js +6 -1
  98. package/dist/overlays/relationships-browser/custom/edgeTypes.js +3 -4
  99. package/dist/overlays/relationships-browser/custom/nodeTypes.js +2 -2
  100. package/dist/overlays/relationships-browser/hooks.d.ts +1 -1
  101. package/dist/overlays/relationships-browser/hooks.js +4 -4
  102. package/dist/overlays/relationships-browser/layout.js +2 -2
  103. package/dist/overlays/relationships-browser/useViewToNodesEdges.js +1 -2
  104. package/dist/state/DiagramActorProvider.js +5 -3
  105. package/dist/state/diagram-machine.d.ts +2 -2
  106. package/dist/state/diagram-machine.js +3 -4
  107. package/dist/state/hotkeyActor.js +12 -3
  108. package/dist/styles.css.js +1 -1
  109. package/package.json +21 -17
  110. package/src/base/BaseXYFlow.tsx +2 -2
  111. package/src/base/primitives/compound/CompoundActionButton.tsx +1 -1
  112. package/src/base/primitives/compound/CompoundDetailsButton.tsx +1 -1
  113. package/src/base/primitives/compound/CompoundNodeContainer.css.ts +0 -3
  114. package/src/base/primitives/compound/CompoundNodeContainer.tsx +1 -1
  115. package/src/base/primitives/edge/EdgeActionButton.tsx +1 -2
  116. package/src/base/primitives/edge/EdgePath.tsx +22 -14
  117. package/src/base/primitives/edge/edge.css.ts +1 -1
  118. package/src/base/primitives/element/ElementActionButtons.tsx +7 -5
  119. package/src/base/primitives/element/ElementDetailsButton.tsx +5 -1
  120. package/src/base/primitives/element/ElementNodeContainer.css.ts +0 -18
  121. package/src/base/primitives/element/ElementNodeContainer.tsx +1 -1
  122. package/src/base/updateEdges.ts +6 -9
  123. package/src/base/updateNodes.ts +10 -14
  124. package/src/bundle/styles.css.ts +7 -2
  125. package/src/components/SearchControl.css.ts +4 -8
  126. package/src/context/FramerMotionConfig.tsx +1 -1
  127. package/src/context/RootContainer.tsx +0 -4
  128. package/src/hooks/useDiagram.ts +1 -1
  129. package/src/likec4diagram/custom/edges/RelationshipEdge.tsx +8 -2
  130. package/src/likec4diagram/custom/edges/RelationshipsDropdownMenu.tsx +1 -1
  131. package/src/likec4diagram/custom/edges/edges.css.ts +0 -2
  132. package/src/likec4diagram/ui/controls/Controls.tsx +53 -55
  133. package/src/likec4diagram/ui/controls/NavigationButtons.tsx +1 -1
  134. package/src/likec4diagram/ui/diagram-title/DiagramTitlePanel.tsx +1 -1
  135. package/src/likec4diagram/ui/notation/NotationPanel.css.ts +0 -4
  136. package/src/likec4diagram/ui/notation/NotationPanel.tsx +1 -2
  137. package/src/likec4diagram/ui/search/ElementsColumn.tsx +94 -71
  138. package/src/likec4diagram/ui/search/LikeC4Search.tsx +48 -55
  139. package/src/likec4diagram/ui/search/ViewsColum.tsx +2 -2
  140. package/src/likec4diagram/ui/search/ViewsColumn.css.ts +0 -4
  141. package/src/likec4diagram/ui/search/state.ts +8 -6
  142. package/src/likec4diagram/ui/walkthrough/DynamicViewWalkthrough.tsx +1 -1
  143. package/src/overlays/Overlays.tsx +4 -4
  144. package/src/overlays/element-details/ElementDetailsCard.tsx +1 -1
  145. package/src/overlays/element-details/TabPanelDeployments.tsx +2 -0
  146. package/src/overlays/element-details/TabPanelStructure.tsx +2 -1
  147. package/src/overlays/overlay/Overlay.css.ts +0 -40
  148. package/src/overlays/overlay/Overlay.tsx +109 -99
  149. package/src/overlays/overlaysActor.ts +5 -1
  150. package/src/overlays/relationship-details/RelationshipDetails.tsx +25 -16
  151. package/src/overlays/relationship-details/SelectEdge.tsx +0 -14
  152. package/src/overlays/relationship-details/actor.ts +2 -1
  153. package/src/overlays/relationship-details/custom/edgeTypes.tsx +1 -1
  154. package/src/overlays/relationship-details/custom/nodeTypes.tsx +1 -1
  155. package/src/overlays/relationships-browser/RelationshipsBrowser.tsx +1 -3
  156. package/src/overlays/relationships-browser/SelectElement.tsx +2 -0
  157. package/src/overlays/relationships-browser/actor.ts +8 -13
  158. package/src/overlays/relationships-browser/const.ts +8 -1
  159. package/src/overlays/relationships-browser/custom/edgeTypes.tsx +2 -3
  160. package/src/overlays/relationships-browser/custom/nodeTypes.tsx +2 -2
  161. package/src/overlays/relationships-browser/useViewToNodesEdges.ts +1 -2
  162. package/src/state/DiagramActorProvider.tsx +4 -1
  163. package/src/state/diagram-machine.ts +2 -3
  164. package/src/state/hotkeyActor.ts +13 -3
@@ -1,9 +1,9 @@
1
- import { createContext, useContext } from 'react';
1
+ import { r as reactExports } from '../../_virtual/index.js';
2
2
 
3
- const ElementDetailsActorContext = createContext(null);
3
+ const ElementDetailsActorContext = reactExports.createContext(null);
4
4
  ElementDetailsActorContext.displayName = "ElementDetailsActorContext";
5
5
  const useElementDetailsActorRef = () => {
6
- const ctx = useContext(ElementDetailsActorContext);
6
+ const ctx = reactExports.useContext(ElementDetailsActorContext);
7
7
  if (ctx === null) {
8
8
  throw new Error("ElementDetailsActorRef is not provided");
9
9
  }
@@ -1,28 +1,5 @@
1
- import { SlotRecipeRuntimeFn } from '@likec4/styles/types';
1
+ import { SlotRecipeRuntimeFn, SlotRecipeVariantRecord } from '@likec4/styles/types';
2
2
  export declare const backdropBlur = "--_blur";
3
3
  export declare const backdropOpacity = "--_opacity";
4
4
  export declare const level = "--_level";
5
- export declare const overlay: SlotRecipeRuntimeFn<"body" | "dialog", {
6
- level: {
7
- 0: {
8
- dialog: {
9
- "--_level": "0";
10
- };
11
- };
12
- 1: {
13
- dialog: {
14
- "--_level": "1";
15
- };
16
- };
17
- 2: {
18
- dialog: {
19
- "--_level": "2";
20
- };
21
- };
22
- 3: {
23
- dialog: {
24
- "--_level": "3";
25
- };
26
- };
27
- };
28
- }>;
5
+ export declare const overlay: SlotRecipeRuntimeFn<"body" | "dialog", SlotRecipeVariantRecord<"body" | "dialog">>;
@@ -59,22 +59,6 @@ const dialog = css.raw({
59
59
  xl: {
60
60
  [offset]: "4rem"
61
61
  }
62
- // inset: '[calc(2rem + var(--_level, 0) * 1rem), 2rem, 2rem, 2rem]',
63
- // width: 'calc(100vw - 4rem)',
64
- // height: 'calc(100vh - 4rem - var(--_level, 0) * 1rem)',
65
- // },
66
- // lg: {
67
- // inset: '[calc(4rem + var(--_level, 0) * 1rem), 4rem, 4rem, 4rem]',
68
- // width: 'calc(100vw - 8rem)',
69
- // height: 'calc(100vh - 8rem)',
70
- // },
71
- // xl: {
72
- // [borderRadius]: '8px',
73
- // padding: '8px',
74
- // inset: '[calc(5rem + var(--_level, 0) * 1rem), 5rem, 5rem, 5rem]',
75
- // width: 'calc(100vw - 10rem)',
76
- // height: 'calc(100vh - 10rem - var(--_level, 0) * 1rem)',
77
- // },
78
62
  });
79
63
  const body = css.raw({
80
64
  position: "relative",
@@ -94,30 +78,6 @@ const overlay = sva({
94
78
  base: {
95
79
  dialog,
96
80
  body
97
- },
98
- variants: {
99
- level: {
100
- 0: {
101
- dialog: {
102
- [level]: "0"
103
- }
104
- },
105
- 1: {
106
- dialog: {
107
- [level]: "1"
108
- }
109
- },
110
- 2: {
111
- dialog: {
112
- [level]: "2"
113
- }
114
- },
115
- 3: {
116
- dialog: {
117
- [level]: "3"
118
- }
119
- }
120
- }
121
81
  }
122
82
  });
123
83
 
@@ -1,6 +1,6 @@
1
1
  import { ForwardRefExoticComponent, ReactNode, RefAttributes } from 'react';
2
2
  export declare const Overlay: ForwardRefExoticComponent<{
3
- overlayLevel?: 0 | 1 | 2 | 3;
3
+ overlayLevel?: number;
4
4
  className?: string;
5
5
  classes?: {
6
6
  dialog?: string;
@@ -3,101 +3,111 @@ import { cx } from '@likec4/styles/css';
3
3
  import { RemoveScroll, Box } from '@mantine/core';
4
4
  import { useMergedRef } from '@mantine/hooks';
5
5
  import { useSyncedRef, useDebouncedCallback, useTimeoutEffect } from '@react-hookz/web';
6
- import { useReducedMotionConfig, m } from 'framer-motion';
7
- import { forwardRef, useState, useRef, useLayoutEffect } from 'react';
8
- import { overlay, backdropOpacity, backdropBlur } from './Overlay.css.js';
6
+ import { useReducedMotionConfig, m } from 'motion/react';
7
+ import { r as reactExports } from '../../_virtual/index.js';
8
+ import { overlay, backdropOpacity, backdropBlur, level } from './Overlay.css.js';
9
9
  import { stopPropagation } from '../../utils/xyflow.js';
10
10
 
11
- const Overlay = forwardRef(
12
- ({ children, onClose, className, classes, overlayLevel = 0, ...rest }, ref) => {
13
- const [opened, setOpened] = useState(false);
14
- const dialogRef = useRef(null);
15
- const isClosingRef = useRef(false);
16
- const motionNotReduced = useReducedMotionConfig() !== true;
17
- const onCloseRef = useSyncedRef(onClose);
18
- const close = useDebouncedCallback(
19
- () => {
20
- if (isClosingRef.current) return;
21
- isClosingRef.current = true;
22
- onCloseRef.current();
11
+ const Overlay = reactExports.forwardRef(({
12
+ onClose,
13
+ className,
14
+ classes,
15
+ overlayLevel = 0,
16
+ children,
17
+ ...rest
18
+ }, ref) => {
19
+ const [opened, setOpened] = reactExports.useState(false);
20
+ const dialogRef = reactExports.useRef(null);
21
+ const isClosingRef = reactExports.useRef(false);
22
+ const motionNotReduced = useReducedMotionConfig() !== true;
23
+ const onCloseRef = useSyncedRef(onClose);
24
+ const close = useDebouncedCallback(
25
+ () => {
26
+ if (isClosingRef.current) return;
27
+ isClosingRef.current = true;
28
+ onCloseRef.current();
29
+ },
30
+ [],
31
+ 50
32
+ );
33
+ reactExports.useEffect(() => {
34
+ const cancel = (e) => {
35
+ e.preventDefault();
36
+ e.stopPropagation();
37
+ close();
38
+ };
39
+ dialogRef.current?.addEventListener("cancel", cancel, { capture: true });
40
+ return () => {
41
+ dialogRef.current?.removeEventListener("cancel", cancel, { capture: true });
42
+ };
43
+ }, []);
44
+ useTimeoutEffect(() => {
45
+ if (!dialogRef.current?.open) {
46
+ dialogRef.current?.showModal();
47
+ }
48
+ }, 30);
49
+ useTimeoutEffect(() => {
50
+ setOpened(true);
51
+ }, 120);
52
+ const styles = overlay({
53
+ level: overlayLevel
54
+ });
55
+ return /* @__PURE__ */ jsx(
56
+ m.dialog,
57
+ {
58
+ ref: useMergedRef(dialogRef, ref),
59
+ className: cx(RemoveScroll.classNames.fullWidth, styles.dialog, classes?.dialog, className),
60
+ layout: true,
61
+ style: {
62
+ // @ts-ignore
63
+ [level]: overlayLevel
23
64
  },
24
- [],
25
- 50
26
- );
27
- useLayoutEffect(() => {
28
- const cancel = (e) => {
29
- e.preventDefault();
30
- close();
31
- };
32
- dialogRef.current?.addEventListener("cancel", cancel, { capture: true });
33
- return () => {
34
- dialogRef.current?.removeEventListener("cancel", cancel, { capture: true });
35
- };
36
- }, []);
37
- useTimeoutEffect(() => {
38
- if (!dialogRef.current?.open) {
39
- dialogRef.current?.showModal();
40
- }
41
- }, 20);
42
- useTimeoutEffect(() => {
43
- setOpened(true);
44
- }, 120);
45
- const styles = overlay({
46
- level: overlayLevel
47
- });
48
- return /* @__PURE__ */ jsx(
49
- m.dialog,
50
- {
51
- ref: useMergedRef(dialogRef, ref),
52
- className: cx(RemoveScroll.classNames.fullWidth, styles.dialog, classes?.dialog, className),
53
- layout: true,
54
- ...motionNotReduced ? {
55
- initial: {
56
- [backdropBlur]: "0px",
57
- [backdropOpacity]: "0%",
58
- scale: overlayLevel > 0 ? 0.9 : 1.075,
59
- opacity: 0
60
- },
61
- animate: {
62
- [backdropBlur]: overlayLevel > 0 ? "4px" : "8px",
63
- [backdropOpacity]: overlayLevel > 0 ? "50%" : "60%",
64
- scale: 1,
65
- opacity: 1,
66
- transition: {
67
- delay: 0.075
68
- }
69
- },
70
- exit: {
71
- scale: 1.2,
72
- opacity: 0,
73
- [backdropBlur]: "0px",
74
- [backdropOpacity]: "0%"
75
- }
76
- } : {
77
- initial: {
78
- [backdropBlur]: "8px",
79
- [backdropOpacity]: "60%"
80
- }
65
+ ...motionNotReduced ? {
66
+ initial: {
67
+ [backdropBlur]: "0px",
68
+ [backdropOpacity]: "0%",
69
+ scale: overlayLevel > 0 ? 0.9 : 1.075,
70
+ opacity: 0
81
71
  },
82
- onClick: (e) => {
83
- e.stopPropagation();
84
- if (e.target?.nodeName?.toUpperCase() === "DIALOG") {
85
- dialogRef.current?.close();
86
- return;
72
+ animate: {
73
+ [backdropBlur]: overlayLevel > 0 ? "4px" : "8px",
74
+ [backdropOpacity]: overlayLevel > 0 ? "50%" : "60%",
75
+ scale: 1,
76
+ opacity: 1,
77
+ transition: {
78
+ delay: 0.075
87
79
  }
88
80
  },
89
- onDoubleClick: stopPropagation,
90
- onPointerDown: stopPropagation,
91
- onClose: (e) => {
92
- e.stopPropagation();
93
- close();
94
- },
95
- ...rest,
96
- children: /* @__PURE__ */ jsx(RemoveScroll, { forwardProps: true, removeScrollBar: false, children: /* @__PURE__ */ jsx(Box, { className: cx(styles.body, "overlay-body", classes?.body), children: opened && /* @__PURE__ */ jsx(Fragment, { children }) }) })
97
- }
98
- );
99
- }
100
- );
81
+ exit: {
82
+ scale: 1.2,
83
+ opacity: 0,
84
+ [backdropBlur]: "0px",
85
+ [backdropOpacity]: "0%"
86
+ }
87
+ } : {
88
+ initial: {
89
+ [backdropBlur]: "8px",
90
+ [backdropOpacity]: "60%"
91
+ }
92
+ },
93
+ onClick: (e) => {
94
+ e.stopPropagation();
95
+ if (e.target?.nodeName?.toUpperCase() === "DIALOG") {
96
+ dialogRef.current?.close();
97
+ return;
98
+ }
99
+ },
100
+ onDoubleClick: stopPropagation,
101
+ onPointerDown: stopPropagation,
102
+ onClose: (e) => {
103
+ e.stopPropagation();
104
+ close();
105
+ },
106
+ ...rest,
107
+ children: /* @__PURE__ */ jsx(RemoveScroll, { forwardProps: true, removeScrollBar: false, children: /* @__PURE__ */ jsx(Box, { className: cx(styles.body, "overlay-body", classes?.body), children: opened && /* @__PURE__ */ jsx(Fragment, { children }) }) })
108
+ }
109
+ );
110
+ });
101
111
  Overlay.displayName = "Overlay";
102
112
 
103
113
  export { Overlay };
@@ -7,7 +7,10 @@ import { relationshipsBrowserLogic } from './relationships-browser/actor.js';
7
7
 
8
8
  const hotkeyLogic = fromCallback(({ sendBack }) => {
9
9
  const handler = getHotkeyHandler([
10
- ["Escape", () => sendBack({ type: "close" }), {
10
+ ["Escape", (event) => {
11
+ event.stopPropagation();
12
+ sendBack({ type: "close" });
13
+ }, {
11
14
  preventDefault: true
12
15
  }]
13
16
  ]);
@@ -1,5 +1,5 @@
1
1
  import { jsx, jsxs } from 'react/jsx-runtime';
2
- import { invariant, nonNullable, ifind, isAncestor } from '@likec4/core';
2
+ import { invariant, nonNullable, isAncestor } from '@likec4/core';
3
3
  import { ActionIcon, Group } from '@mantine/core';
4
4
  import { useCallbackRef, useStateHistory } from '@mantine/hooks';
5
5
  import { IconX, IconChevronLeft, IconChevronRight } from '@tabler/icons-react';
@@ -7,9 +7,9 @@ import { useSelector } from '@xstate/react';
7
7
  import { ReactFlowProvider, Panel, useStoreApi, useReactFlow } from '@xyflow/react';
8
8
  import clsx from 'clsx';
9
9
  import { deepEqual } from 'fast-equals';
10
- import { LayoutGroup, AnimatePresence, m } from 'framer-motion';
11
- import { useRef, memo, useMemo, useEffect } from 'react';
12
- import 'remeda';
10
+ import { LayoutGroup, AnimatePresence, m } from 'motion/react';
11
+ import { r as reactExports } from '../../_virtual/index.js';
12
+ import { isTruthy, find } from 'remeda';
13
13
  import { BaseXYFlow } from '../../base/BaseXYFlow.js';
14
14
  import { useLikeC4Model } from '../../likec4model/useLikeC4Model.js';
15
15
  import { computeEdgeDetailsViewData, computeRelationshipDetailsViewData } from './compute.js';
@@ -27,38 +27,40 @@ const edgeTypes = {
27
27
  relationship: RelationshipEdge
28
28
  };
29
29
  function RelationshipDetails({ actorRef }) {
30
- const initialRef = useRef(null);
30
+ const initialRef = reactExports.useRef(null);
31
31
  if (initialRef.current == null) {
32
32
  initialRef.current = {
33
33
  defaultNodes: [],
34
34
  defaultEdges: []
35
35
  };
36
36
  }
37
- return /* @__PURE__ */ jsx(RelationshipDetailsActorContext.Provider, { value: actorRef, children: /* @__PURE__ */ jsxs(ReactFlowProvider, { ...initialRef.current, children: [
38
- /* @__PURE__ */ jsx(LayoutGroup, { id: actorRef.sessionId, inherit: false, children: /* @__PURE__ */ jsx(AnimatePresence, { children: /* @__PURE__ */ jsx(RelationshipDetailsInner, {}) }) }),
39
- /* @__PURE__ */ jsx(SyncRelationshipDetailsXYFlow, {})
40
- ] }) });
37
+ return /* @__PURE__ */ jsx(RelationshipDetailsActorContext.Provider, { value: actorRef, children: /* @__PURE__ */ jsx(ReactFlowProvider, { ...initialRef.current, children: /* @__PURE__ */ jsx(LayoutGroup, { id: actorRef.sessionId, inherit: false, children: /* @__PURE__ */ jsxs(AnimatePresence, { children: [
38
+ /* @__PURE__ */ jsx(RelationshipDetailsInner, {}, "xyflow"),
39
+ /* @__PURE__ */ jsx(SyncRelationshipDetailsXYFlow, {}, "sync")
40
+ ] }) }) }) });
41
41
  }
42
42
  const selectSubject = (state) => ({
43
43
  ...state.context.subject,
44
44
  viewId: state.context.viewId
45
45
  });
46
- function SyncRelationshipDetailsXYFlow() {
46
+ const SyncRelationshipDetailsXYFlow = reactExports.memo(() => {
47
47
  const actor = useRelationshipDetailsActor();
48
48
  const subject = useSelector(actor, selectSubject, deepEqual);
49
49
  const likec4model = useLikeC4Model(true);
50
50
  const view = likec4model.findView(subject.viewId) ?? null;
51
- const data = useMemo(() => {
51
+ const data = reactExports.useMemo(() => {
52
52
  let data2;
53
- if ("edgeId" in subject) {
53
+ if ("edgeId" in subject && isTruthy(subject.edgeId)) {
54
54
  invariant(view, `view ${subject.viewId} not found`);
55
55
  const edge = nonNullable(view.findEdge(subject.edgeId), `edge ${subject.edgeId} not found in ${subject.viewId}`);
56
56
  data2 = computeEdgeDetailsViewData([edge.id], view);
57
- } else {
57
+ } else if (!!subject.source && !!subject.target) {
58
58
  data2 = computeRelationshipDetailsViewData({
59
59
  source: likec4model.element(subject.source),
60
60
  target: likec4model.element(subject.target)
61
61
  });
62
+ } else {
63
+ return null;
62
64
  }
63
65
  return layoutRelationshipDetails(data2, view);
64
66
  }, [
@@ -68,16 +70,18 @@ function SyncRelationshipDetailsXYFlow() {
68
70
  ]);
69
71
  const store = useStoreApi();
70
72
  const instance = useReactFlow();
71
- useEffect(() => {
73
+ reactExports.useEffect(() => {
72
74
  if (instance.viewportInitialized) {
73
75
  actor.send({ type: "xyflow.init", instance, store });
74
76
  }
75
77
  }, [store, instance.viewportInitialized, actor]);
76
- useEffect(() => {
77
- actor.send({ type: "update.layoutData", data });
78
+ reactExports.useEffect(() => {
79
+ if (data !== null) {
80
+ actor.send({ type: "update.layoutData", data });
81
+ }
78
82
  }, [data, actor]);
79
83
  return null;
80
- }
84
+ });
81
85
  const selector = ({ context }) => ({
82
86
  // subject: context.subject,
83
87
  // view: state.context.view,
@@ -85,7 +89,7 @@ const selector = ({ context }) => ({
85
89
  nodes: context.xynodes,
86
90
  edges: context.xyedges
87
91
  });
88
- const RelationshipDetailsInner = memo(() => {
92
+ const RelationshipDetailsInner = reactExports.memo(() => {
89
93
  const browser = useRelationshipDetails();
90
94
  const {
91
95
  initialized,
@@ -164,15 +168,16 @@ const topLeftPanelselector = ({ context }) => ({
164
168
  subject: context.subject,
165
169
  viewId: context.viewId
166
170
  });
167
- const TopLeftPanel = memo(() => {
171
+ const TopLeftPanel = reactExports.memo(() => {
168
172
  const { subject, viewId } = useRelationshipDetailsState(topLeftPanelselector, deepEqual);
169
173
  const likec4model = useLikeC4Model(true);
170
174
  const view = likec4model.findView(viewId);
171
175
  if (!view || !view.isDiagram()) {
172
176
  return null;
173
177
  }
174
- let edge = "edgeId" in subject ? view.findEdge(subject.edgeId) : ifind(view.edges(), (e) => e.source.element?.id === subject.source && e.target.element?.id === subject.target) ?? ifind(view.edges(), (e) => {
175
- return (e.source.element?.id === subject.source || isAncestor(e.source.element?.id ?? "--", subject.source)) && (e.target.element?.id === subject.target || isAncestor(e.target.element?.id ?? "", subject.target));
178
+ const edges = [...view.edges()];
179
+ let edge = "edgeId" in subject && isTruthy(subject.edgeId) ? edges.find((e) => e.id === subject.edgeId) : find(edges, (e) => e.source.element?.id === subject.source && e.target.element?.id === subject.target) || find(edges, (e) => {
180
+ return (e.source.element?.id === subject.source || isAncestor(e.source.element?.id ?? "--", subject.source ?? "__")) && (e.target.element?.id === subject.target || isAncestor(e.target.element?.id ?? "", subject.target ?? "__"));
176
181
  });
177
182
  if (!edge) {
178
183
  return null;
@@ -183,12 +188,12 @@ const TopLeftPanelInner = ({ edge, view }) => {
183
188
  const browser = useRelationshipDetails();
184
189
  const edgeId = edge.id;
185
190
  const [historyEdgeId, historyOps, { history, current }] = useStateHistory(edge.id);
186
- useEffect(() => {
191
+ reactExports.useEffect(() => {
187
192
  if (historyEdgeId !== edgeId) {
188
193
  historyOps.set(edgeId);
189
194
  }
190
195
  }, [edgeId]);
191
- useEffect(() => {
196
+ reactExports.useEffect(() => {
192
197
  if (historyEdgeId !== edgeId) {
193
198
  browser.navigateTo(historyEdgeId);
194
199
  }
@@ -1,20 +1,17 @@
1
1
  import { jsxs, jsx } from 'react/jsx-runtime';
2
2
  import '@likec4/core';
3
- import { useComputedColorScheme, Popover, PopoverTarget, Button, Box, Text, ThemeIcon, PopoverDropdown, ScrollAreaAutosize } from '@mantine/core';
3
+ import { Popover, PopoverTarget, Button, Box, Text, ThemeIcon, PopoverDropdown, ScrollAreaAutosize } from '@mantine/core';
4
4
  import { IconArrowRight, IconSelector } from '@tabler/icons-react';
5
- import { useRef } from 'react';
5
+ import { r as reactExports } from '../../_virtual/index.js';
6
6
  import { useRelationshipDetails } from './hooks.js';
7
7
  import { edgeSource, edgeTarget, scrollArea, edgeGrid, edgeRow, edgeArrow, edgeLabel } from './SelectEdge.css.js';
8
- import { useMantinePortalProps } from '../../hooks/useMantinePortalProps.js';
9
8
 
10
9
  const SelectEdge = ({
11
10
  edge,
12
11
  view
13
12
  }) => {
14
13
  const browser = useRelationshipDetails();
15
- const viewport = useRef(null);
16
- useMantinePortalProps();
17
- useComputedColorScheme();
14
+ const viewport = reactExports.useRef(null);
18
15
  const edgeSource$1 = view.nodes.find((n) => n.id === edge.source);
19
16
  const edgeTarget$1 = view.nodes.find((n) => n.id === edge.target);
20
17
  const edges = view.edges.flatMap((edge2) => {
@@ -21,6 +21,8 @@ export type Input = ExclusiveUnion<{
21
21
  }>;
22
22
  type Subject = {
23
23
  edgeId: EdgeId;
24
+ source?: never;
25
+ target?: never;
24
26
  } | {
25
27
  source: Fqn;
26
28
  target: Fqn;
@@ -19,7 +19,7 @@ const RelationshipEdge = customEdge((props) => {
19
19
  const [svgPath, labelX, labelY] = getBezierPath(props);
20
20
  const diagram = useDiagram();
21
21
  return /* @__PURE__ */ jsxs(EdgeContainer, { ...props, children: [
22
- /* @__PURE__ */ jsx(EdgePath, { ...props, svgPath }),
22
+ /* @__PURE__ */ jsx(EdgePath, { edgeProps: props, svgPath }),
23
23
  /* @__PURE__ */ jsx(
24
24
  EdgeLabelContainer,
25
25
  {
@@ -27,7 +27,7 @@ const ElementDetailsButtonWithHandler = (props) => {
27
27
  const ElementNode = customNode((props) => {
28
28
  return /* @__PURE__ */ jsxs(ElementNodeContainer, { nodeProps: props, children: [
29
29
  /* @__PURE__ */ jsx(ElementShape, { ...props }),
30
- /* @__PURE__ */ jsx(ElementTitle, { ...props, iconSize: 40 }),
30
+ /* @__PURE__ */ jsx(ElementTitle, { ...props }),
31
31
  /* @__PURE__ */ jsx(ElementDetailsButtonWithHandler, { ...props }),
32
32
  /* @__PURE__ */ jsx(ElementActions, { ...props }),
33
33
  /* @__PURE__ */ jsx(ElementPorts, { ...props })
@@ -12,6 +12,8 @@ export declare function useRelationshipDetails(): {
12
12
  getState: () => Readonly<{
13
13
  subject: {
14
14
  edgeId: EdgeId;
15
+ source?: never;
16
+ target?: never;
15
17
  } | {
16
18
  source: Fqn;
17
19
  target: Fqn;
@@ -57,7 +59,7 @@ export declare function useRelationshipDetails(): {
57
59
  active?: boolean;
58
60
  dimmed?: import("../../base").Base.Dimmed;
59
61
  };
60
- }> & Omit< ViewportHelperFunctions, "initialized"> & {
62
+ }> & ViewportHelperFunctions & {
61
63
  viewportInitialized: boolean;
62
64
  }) | null;
63
65
  xystore: {
@@ -2,11 +2,11 @@ import { nonNullable } from '@likec4/core';
2
2
  import { useCallbackRef } from '@mantine/hooks';
3
3
  import { useSelector } from '@xstate/react';
4
4
  import { shallowEqual } from 'fast-equals';
5
- import { createContext, useMemo, useContext } from 'react';
5
+ import { r as reactExports } from '../../_virtual/index.js';
6
6
 
7
- const RelationshipDetailsActorContext = createContext(null);
7
+ const RelationshipDetailsActorContext = reactExports.createContext(null);
8
8
  function useRelationshipDetailsActor() {
9
- return nonNullable(useContext(RelationshipDetailsActorContext), "No RelationshipDetailsActorContext");
9
+ return nonNullable(reactExports.useContext(RelationshipDetailsActorContext), "No RelationshipDetailsActorContext");
10
10
  }
11
11
  function useRelationshipDetailsState(selector, compare = shallowEqual) {
12
12
  const select = useCallbackRef(selector);
@@ -15,7 +15,7 @@ function useRelationshipDetailsState(selector, compare = shallowEqual) {
15
15
  }
16
16
  function useRelationshipDetails() {
17
17
  const actor = useRelationshipDetailsActor();
18
- return useMemo(() => ({
18
+ return reactExports.useMemo(() => ({
19
19
  actor,
20
20
  get rootElementId() {
21
21
  return `relationship-details-${actor.sessionId.replaceAll(":", "_")}`;
@@ -5,10 +5,9 @@ import { useCallbackRef, useStateHistory } from '@mantine/hooks';
5
5
  import { IconX, IconChevronLeft, IconChevronRight } from '@tabler/icons-react';
6
6
  import { ReactFlowProvider, useStoreApi, useReactFlow, Panel } from '@xyflow/react';
7
7
  import { shallowEqual } from 'fast-equals';
8
- import { LayoutGroup, AnimatePresence, m } from 'framer-motion';
9
- import { useRef, memo, useEffect } from 'react';
8
+ import { LayoutGroup, AnimatePresence, m } from 'motion/react';
9
+ import { r as reactExports } from '../../_virtual/index.js';
10
10
  import { BaseXYFlow } from '../../base/BaseXYFlow.js';
11
- import { ViewPadding } from './const.js';
12
11
  import { RelationshipsBrowserActorContext, useRelationshipsBrowser, useRelationshipsBrowserState } from './hooks.js';
13
12
  import { useRelationshipsView } from './layout.js';
14
13
  import { SelectElement } from './SelectElement.js';
@@ -24,7 +23,7 @@ const edgeTypes = {
24
23
  relationship: RelationshipEdge
25
24
  };
26
25
  function RelationshipsBrowser({ actorRef }) {
27
- const initialRef = useRef(null);
26
+ const initialRef = reactExports.useRef(null);
28
27
  if (initialRef.current == null) {
29
28
  initialRef.current = {
30
29
  initialNodes: [],
@@ -39,7 +38,7 @@ const selector = (state) => ({
39
38
  edges: state.context.xyedges
40
39
  });
41
40
  const selectorEq = (a, b) => a.isActive === b.isActive && shallowEqual(a.nodes, b.nodes) && shallowEqual(a.edges, b.edges);
42
- const RelationshipsBrowserXYFlow = memo(() => {
41
+ const RelationshipsBrowserXYFlow = reactExports.memo(() => {
43
42
  const browser = useRelationshipsBrowser();
44
43
  const {
45
44
  isActive,
@@ -62,7 +61,6 @@ const RelationshipsBrowserXYFlow = memo(() => {
62
61
  nodeTypes,
63
62
  edgeTypes,
64
63
  fitView: false,
65
- fitViewPadding: ViewPadding,
66
64
  onNodeClick: useCallbackRef((e, node) => {
67
65
  browser.send({ type: "xyflow.nodeClick", node });
68
66
  }),
@@ -110,7 +108,7 @@ const selector2 = (state) => ({
110
108
  scope: state.context.scope,
111
109
  closeable: state.context.closeable
112
110
  });
113
- const RelationshipsBrowserInner = memo(() => {
111
+ const RelationshipsBrowserInner = reactExports.memo(() => {
114
112
  const browser = useRelationshipsBrowser();
115
113
  const {
116
114
  subjectId,
@@ -120,24 +118,24 @@ const RelationshipsBrowserInner = memo(() => {
120
118
  } = useRelationshipsBrowserState(selector2);
121
119
  const store = useStoreApi();
122
120
  const instance = useReactFlow();
123
- useEffect(() => {
121
+ reactExports.useEffect(() => {
124
122
  if (instance.viewportInitialized) {
125
123
  browser.send({ type: "xyflow.init", instance, store });
126
124
  }
127
125
  }, [store, instance.viewportInitialized, browser]);
128
126
  const layouted = useRelationshipsView(subjectId, viewId, scope);
129
127
  const [historySubjectId, historyOps, { history, current }] = useStateHistory(subjectId);
130
- useEffect(() => {
128
+ reactExports.useEffect(() => {
131
129
  if (historySubjectId !== subjectId) {
132
130
  historyOps.set(subjectId);
133
131
  }
134
132
  }, [subjectId]);
135
- useEffect(() => {
133
+ reactExports.useEffect(() => {
136
134
  if (historySubjectId !== subjectId) {
137
135
  browser.navigateTo(historySubjectId);
138
136
  }
139
137
  }, [historySubjectId, browser]);
140
- useEffect(() => {
138
+ reactExports.useEffect(() => {
141
139
  browser.updateView(layouted);
142
140
  }, [layouted, browser]);
143
141
  const hasStepBack = current > 0;