@likec4/diagram 1.28.0 → 1.29.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (162) hide show
  1. package/bundle/index.js +1040 -1190
  2. package/dist/LikeC4CustomColors.js +2 -2
  3. package/dist/LikeC4Diagram.js +2 -2
  4. package/dist/LikeC4ModelProvider.js +1 -1
  5. package/dist/_virtual/index.js +5 -0
  6. package/dist/_virtual/index2.js +3 -0
  7. package/dist/_virtual/react.production.js +3 -0
  8. package/dist/base/BaseXYFlow.js +5 -5
  9. package/dist/base/primitives/compound/CompoundActionButton.js +1 -1
  10. package/dist/base/primitives/compound/CompoundDetailsButton.js +1 -1
  11. package/dist/base/primitives/compound/CompoundNodeContainer.d.ts +1 -1
  12. package/dist/base/primitives/compound/CompoundNodeContainer.js +2 -2
  13. package/dist/base/primitives/customEdge.d.ts +1 -1
  14. package/dist/base/primitives/customEdge.js +3 -3
  15. package/dist/base/primitives/customNode.js +2 -2
  16. package/dist/base/primitives/edge/EdgeContainer.js +1 -1
  17. package/dist/base/primitives/edge/EdgeLabel.css.d.ts +3 -0
  18. package/dist/base/primitives/edge/EdgeLabel.css.js +3 -0
  19. package/dist/base/primitives/edge/EdgeLabel.d.ts +1 -1
  20. package/dist/base/primitives/edge/EdgeLabel.js +3 -2
  21. package/dist/base/primitives/edge/EdgeLabelContainer.js +1 -1
  22. package/dist/base/primitives/edge/EdgePath.d.ts +10 -42
  23. package/dist/base/primitives/edge/EdgePath.js +23 -16
  24. package/dist/base/primitives/edge/edge.css.js +1 -1
  25. package/dist/base/primitives/element/ElementActionButtons.js +1 -2
  26. package/dist/base/primitives/element/ElementDetailsButton.js +1 -2
  27. package/dist/base/primitives/element/ElementNodeContainer.js +3 -3
  28. package/dist/base/updateEdges.js +7 -2
  29. package/dist/base/updateNodes.js +11 -3
  30. package/dist/bundle/LikeC4View.js +3 -3
  31. package/dist/bundle/ReactLikeC4.js +1 -1
  32. package/dist/bundle/ShadowRoot.js +3 -3
  33. package/dist/bundle/styles.css.js +3 -3
  34. package/dist/context/ControlsCustomLayout.js +1 -1
  35. package/dist/context/DiagramEventHandlers.js +5 -5
  36. package/dist/context/DiagramFeatures.js +7 -7
  37. package/dist/context/EnsureMantine.js +2 -2
  38. package/dist/context/FramerMotionConfig.js +2 -2
  39. package/dist/context/IconRenderer.js +4 -4
  40. package/dist/context/ReduceGraphics.js +2 -2
  41. package/dist/context/RootContainer.js +5 -9
  42. package/dist/hooks/safeContext.d.ts +2 -5
  43. package/dist/hooks/safeContext.js +5 -4
  44. package/dist/hooks/useCurrentViewId.js +1 -1
  45. package/dist/hooks/useDiagram.d.ts +715 -150
  46. package/dist/hooks/useDiagram.js +2 -2
  47. package/dist/hooks/useMantinePortalProps.js +2 -2
  48. package/dist/hooks/useSetState.js +3 -3
  49. package/dist/hooks/useUpdateEffect.js +1 -1
  50. package/dist/hooks/useXYFlow.d.ts +2 -2
  51. package/dist/likec4diagram/DiagramUI.js +2 -2
  52. package/dist/likec4diagram/DiagramXYFlow.js +2 -2
  53. package/dist/likec4diagram/custom/edges/NotePopover.js +2 -2
  54. package/dist/likec4diagram/custom/edges/RelationshipEdge.d.ts +2 -2
  55. package/dist/likec4diagram/custom/edges/RelationshipEdge.js +7 -7
  56. package/dist/likec4diagram/custom/edges/RelationshipsDropdownMenu.js +6 -6
  57. package/dist/likec4diagram/custom/index.d.ts +1 -2
  58. package/dist/likec4diagram/custom/nodes/toolbar/ColorButton.js +2 -2
  59. package/dist/likec4diagram/custom/nodes/toolbar/CompoundToolbar.js +3 -3
  60. package/dist/likec4diagram/custom/nodes/toolbar/_shared.js +2 -2
  61. package/dist/likec4diagram/ui/controls/ChangeAutoLayoutButton.js +4 -4
  62. package/dist/likec4diagram/ui/controls/Controls.js +9 -9
  63. package/dist/likec4diagram/ui/controls/NavigationButtons.js +1 -1
  64. package/dist/likec4diagram/ui/diagram-title/DiagramTitlePanel.js +1 -1
  65. package/dist/likec4diagram/ui/notation/NotationPanel.js +4 -4
  66. package/dist/likec4diagram/ui/search/ElementsColumn.js +88 -77
  67. package/dist/likec4diagram/ui/search/LikeC4Search.d.ts +2 -1
  68. package/dist/likec4diagram/ui/search/LikeC4Search.js +27 -24
  69. package/dist/likec4diagram/ui/search/SearchInput.js +1 -1
  70. package/dist/likec4diagram/ui/search/ViewsColum.js +3 -2
  71. package/dist/likec4diagram/ui/search/state.js +11 -9
  72. package/dist/likec4diagram/ui/walkthrough/DynamicViewWalkthrough.js +1 -1
  73. package/dist/likec4diagram/useLayoutConstraints.js +3 -3
  74. package/dist/likec4model/LikeC4ModelContext.js +2 -2
  75. package/dist/likec4model/useLikeC4ElementsTree.js +2 -2
  76. package/dist/likec4model/useLikeC4Model.js +2 -2
  77. package/dist/node_modules/.pnpm/react@19.0.0/node_modules/react/cjs/react.production.js +548 -0
  78. package/dist/node_modules/.pnpm/react@19.0.0/node_modules/react/index.js +15 -0
  79. package/dist/overlays/Overlays.js +6 -6
  80. package/dist/overlays/element-details/ElementDetails.js +1 -1
  81. package/dist/overlays/element-details/ElementDetailsCard.js +5 -5
  82. package/dist/overlays/element-details/TabPanelDeployments.js +7 -4
  83. package/dist/overlays/element-details/TabPanelRelationships.js +2 -2
  84. package/dist/overlays/element-details/TabPanelStructure.js +6 -3
  85. package/dist/overlays/element-details/actor.d.ts +2 -2
  86. package/dist/overlays/element-details/actorContext.js +3 -3
  87. package/dist/overlays/overlay/Overlay.js +8 -7
  88. package/dist/overlays/relationship-details/RelationshipDetails.d.ts +1 -1
  89. package/dist/overlays/relationship-details/RelationshipDetails.js +28 -23
  90. package/dist/overlays/relationship-details/SelectEdge.js +3 -6
  91. package/dist/overlays/relationship-details/actor.d.ts +4 -1
  92. package/dist/overlays/relationship-details/custom/edgeTypes.d.ts +1 -1
  93. package/dist/overlays/relationship-details/custom/edgeTypes.js +1 -1
  94. package/dist/overlays/relationship-details/hooks.d.ts +4 -1
  95. package/dist/overlays/relationship-details/hooks.js +4 -4
  96. package/dist/overlays/relationships-browser/RelationshipsBrowser.d.ts +1 -1
  97. package/dist/overlays/relationships-browser/RelationshipsBrowser.js +9 -11
  98. package/dist/overlays/relationships-browser/SelectElement.js +8 -5
  99. package/dist/overlays/relationships-browser/actor.d.ts +2 -1
  100. package/dist/overlays/relationships-browser/actor.js +6 -12
  101. package/dist/overlays/relationships-browser/const.d.ts +2 -1
  102. package/dist/overlays/relationships-browser/const.js +6 -1
  103. package/dist/overlays/relationships-browser/custom/edgeTypes.d.ts +1 -1
  104. package/dist/overlays/relationships-browser/custom/edgeTypes.js +3 -4
  105. package/dist/overlays/relationships-browser/custom/nodeTypes.js +1 -1
  106. package/dist/overlays/relationships-browser/hooks.d.ts +2 -1
  107. package/dist/overlays/relationships-browser/hooks.js +4 -4
  108. package/dist/overlays/relationships-browser/layout.js +2 -2
  109. package/dist/overlays/relationships-browser/useViewToNodesEdges.js +1 -2
  110. package/dist/state/DiagramActorProvider.js +7 -5
  111. package/dist/state/diagram-machine.d.ts +719 -146
  112. package/dist/state/diagram-machine.js +51 -10
  113. package/dist/styles.css.js +1 -1
  114. package/package.json +20 -16
  115. package/src/LikeC4Diagram.tsx +0 -1
  116. package/src/base/BaseXYFlow.tsx +2 -2
  117. package/src/base/primitives/compound/CompoundActionButton.tsx +1 -1
  118. package/src/base/primitives/compound/CompoundDetailsButton.tsx +1 -1
  119. package/src/base/primitives/compound/CompoundNodeContainer.tsx +1 -1
  120. package/src/base/primitives/customEdge.ts +1 -0
  121. package/src/base/primitives/edge/EdgeLabel.css.ts +3 -0
  122. package/src/base/primitives/edge/EdgeLabel.tsx +2 -1
  123. package/src/base/primitives/edge/EdgePath.tsx +22 -14
  124. package/src/base/primitives/edge/edge.css.ts +1 -1
  125. package/src/base/primitives/element/ElementActionButtons.tsx +2 -2
  126. package/src/base/primitives/element/ElementDetailsButton.tsx +2 -2
  127. package/src/base/primitives/element/ElementNodeContainer.tsx +1 -1
  128. package/src/base/updateEdges.ts +6 -9
  129. package/src/base/updateNodes.ts +10 -14
  130. package/src/context/FramerMotionConfig.tsx +1 -1
  131. package/src/context/RootContainer.tsx +0 -4
  132. package/src/hooks/safeContext.tsx +3 -1
  133. package/src/likec4diagram/custom/edges/RelationshipEdge.tsx +2 -2
  134. package/src/likec4diagram/custom/edges/RelationshipsDropdownMenu.tsx +1 -1
  135. package/src/likec4diagram/ui/controls/Controls.tsx +56 -58
  136. package/src/likec4diagram/ui/controls/NavigationButtons.tsx +1 -1
  137. package/src/likec4diagram/ui/diagram-title/DiagramTitlePanel.tsx +1 -1
  138. package/src/likec4diagram/ui/notation/NotationPanel.tsx +1 -1
  139. package/src/likec4diagram/ui/search/ElementsColumn.tsx +94 -71
  140. package/src/likec4diagram/ui/search/LikeC4Search.tsx +48 -55
  141. package/src/likec4diagram/ui/search/ViewsColum.tsx +2 -2
  142. package/src/likec4diagram/ui/search/state.ts +8 -6
  143. package/src/likec4diagram/ui/walkthrough/DynamicViewWalkthrough.tsx +1 -1
  144. package/src/overlays/Overlays.tsx +2 -2
  145. package/src/overlays/element-details/ElementDetails.tsx +2 -2
  146. package/src/overlays/element-details/ElementDetailsCard.tsx +1 -1
  147. package/src/overlays/element-details/TabPanelDeployments.tsx +2 -0
  148. package/src/overlays/element-details/TabPanelStructure.tsx +2 -1
  149. package/src/overlays/overlay/Overlay.tsx +2 -1
  150. package/src/overlays/relationship-details/RelationshipDetails.tsx +25 -16
  151. package/src/overlays/relationship-details/SelectEdge.tsx +0 -14
  152. package/src/overlays/relationship-details/actor.ts +2 -1
  153. package/src/overlays/relationship-details/custom/edgeTypes.tsx +1 -1
  154. package/src/overlays/relationships-browser/RelationshipsBrowser.tsx +1 -3
  155. package/src/overlays/relationships-browser/SelectElement.tsx +2 -0
  156. package/src/overlays/relationships-browser/actor.ts +8 -13
  157. package/src/overlays/relationships-browser/const.ts +8 -1
  158. package/src/overlays/relationships-browser/custom/edgeTypes.tsx +2 -3
  159. package/src/overlays/relationships-browser/custom/nodeTypes.tsx +1 -1
  160. package/src/overlays/relationships-browser/useViewToNodesEdges.ts +1 -2
  161. package/src/state/DiagramActorProvider.tsx +7 -4
  162. package/src/state/diagram-machine.ts +50 -8
@@ -1,19 +1,22 @@
1
1
  import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
2
2
  import { useTree, Alert, Anchor, Tree, Box, Text, Pill } from '@mantine/core';
3
3
  import { IconInfoCircle } from '@tabler/icons-react';
4
- import { useMemo, useEffect } from 'react';
4
+ import { r as reactExports } from '../../_virtual/index.js';
5
5
  import { treeNodeLabel, elementLabel } from './TabPanelStructure.css.js';
6
6
 
7
7
  const ElementLabel = ({
8
8
  element
9
9
  }) => /* @__PURE__ */ jsx(Box, { className: elementLabel, children: /* @__PURE__ */ jsx(Text, { component: "div", fz: "sm", fw: "500", children: element.title }) });
10
+ const setHoveredNode = () => {
11
+ };
10
12
  function TabPanelStructure({
11
13
  element
12
14
  }) {
13
15
  const tree = useTree({
14
16
  multiple: false
15
17
  });
16
- const data = useMemo(() => {
18
+ tree.setHoveredNode = setHoveredNode;
19
+ const data = reactExports.useMemo(() => {
17
20
  let seq = 1;
18
21
  const messageNode = (label) => ({
19
22
  label,
@@ -50,7 +53,7 @@ function TabPanelStructure({
50
53
  ancestor
51
54
  ];
52
55
  }, [element]);
53
- useEffect(() => {
56
+ reactExports.useEffect(() => {
54
57
  tree.expandAllNodes();
55
58
  }, [data]);
56
59
  return /* @__PURE__ */ jsxs(Fragment, { children: [
@@ -1,7 +1,7 @@
1
1
  import { DiagramView, Fqn, NodeId, ViewId, NonEmptyArray, RelationId, Color, RelationshipLineType, BBox } from '@likec4/core';
2
- import { Rect } from '@xyflow/system';
2
+ import { Rect, EdgeMarkerType, HandleType } from '@xyflow/system';
3
3
  import { ActorLogicFrom, ActorRefFromLogic, SnapshotFrom, StateMachine, PromiseActorLogic, EventObject, Values, NonReducibleUnknown, MetaObject, ConditionalRequired, InputFrom, RequiredActorOptions, IsNotNever, GetConcreteByKey, AnyActorLogic, RequiredLogicInput, ActorRef, MachineSnapshot, AnyActorRef, StateValue, AnyEventObject, ActionFunction, CancelAction, DoneActorEvent, StopAction } from 'xstate';
4
- import { GeneralHelpers, EdgeMarkerType, HandleType, ViewportHelperFunctions, ReactFlowState } from '@xyflow/react';
4
+ import { GeneralHelpers, ViewportHelperFunctions, ReactFlowState } from '@xyflow/react';
5
5
  import { ReactNode, CSSProperties } from 'react';
6
6
  import { XYStoreApi, Events, Input } from '../relationships-browser/actor';
7
7
  import { LayoutRelationshipsViewResult } from '../relationships-browser/layout';
@@ -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
  }
@@ -3,12 +3,12 @@ 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, useEffect } from 'react';
6
+ import { useReducedMotionConfig, m } from 'motion/react';
7
+ import { r as reactExports } from '../../_virtual/index.js';
8
8
  import { overlay, backdropOpacity, backdropBlur, level } from './Overlay.css.js';
9
9
  import { stopPropagation } from '../../utils/xyflow.js';
10
10
 
11
- const Overlay = forwardRef(({
11
+ const Overlay = reactExports.forwardRef(({
12
12
  onClose,
13
13
  className,
14
14
  classes,
@@ -16,9 +16,9 @@ const Overlay = forwardRef(({
16
16
  children,
17
17
  ...rest
18
18
  }, ref) => {
19
- const [opened, setOpened] = useState(false);
20
- const dialogRef = useRef(null);
21
- const isClosingRef = useRef(false);
19
+ const [opened, setOpened] = reactExports.useState(false);
20
+ const dialogRef = reactExports.useRef(null);
21
+ const isClosingRef = reactExports.useRef(false);
22
22
  const motionNotReduced = useReducedMotionConfig() !== true;
23
23
  const onCloseRef = useSyncedRef(onClose);
24
24
  const close = useDebouncedCallback(
@@ -30,9 +30,10 @@ const Overlay = forwardRef(({
30
30
  [],
31
31
  50
32
32
  );
33
- useEffect(() => {
33
+ reactExports.useEffect(() => {
34
34
  const cancel = (e) => {
35
35
  e.preventDefault();
36
+ e.stopPropagation();
36
37
  close();
37
38
  };
38
39
  dialogRef.current?.addEventListener("cancel", cancel, { capture: true });
@@ -1,6 +1,6 @@
1
1
  import { RelationshipDetailsActorRef } from './actor';
2
2
  import { NamedExoticComponent, CSSProperties, ReactNode } from 'react';
3
- import { Position } from '@xyflow/react';
3
+ import { Position } from '@xyflow/system';
4
4
  import { RelationId, Color, ViewId, RelationshipLineType } from '@likec4/core';
5
5
  export declare const edgeTypes: {
6
6
  relationship: NamedExoticComponent<{
@@ -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) => {
@@ -1,9 +1,10 @@
1
1
  import { BBox, EdgeId, ExclusiveUnion, Fqn, ViewId, RelationId, Color, RelationshipLineType } from '@likec4/core';
2
- import { EdgeChange, NodeChange, ReactFlowInstance, useStoreApi, EdgeMarkerType, HandleType } from '@xyflow/react';
2
+ import { EdgeChange, NodeChange, ReactFlowInstance, useStoreApi } from '@xyflow/react';
3
3
  import { ActorLogicFrom, ActorRefFromLogic, SnapshotFrom, StateMachine, Values, NonReducibleUnknown, EventObject, MetaObject, AnyActorLogic, ConditionalRequired, InputFrom, RequiredLogicInput, IsNotNever, ActorRef, MachineSnapshot, AnyActorRef, StateValue, AnyEventObject, ActionFunction, CancelAction } from 'xstate';
4
4
  import { Base } from '../../base';
5
5
  import { RelationshipDetailsTypes } from './_types';
6
6
  import { LayoutResult } from './layout';
7
+ import { EdgeMarkerType, HandleType } from '@xyflow/system';
7
8
  import { ReactNode, CSSProperties } from 'react';
8
9
  type XYFLowInstance = ReactFlowInstance<RelationshipDetailsTypes.Node, RelationshipDetailsTypes.Edge>;
9
10
  type XYStoreApi = ReturnType<typeof useStoreApi<RelationshipDetailsTypes.Node, RelationshipDetailsTypes.Edge>>;
@@ -20,6 +21,8 @@ export type Input = ExclusiveUnion<{
20
21
  }>;
21
22
  type Subject = {
22
23
  edgeId: EdgeId;
24
+ source?: never;
25
+ target?: never;
23
26
  } | {
24
27
  source: Fqn;
25
28
  target: Fqn;
@@ -1,5 +1,5 @@
1
1
  import { NamedExoticComponent, CSSProperties, ReactNode } from 'react';
2
- import { Position } from '@xyflow/react';
2
+ import { Position } from '@xyflow/system';
3
3
  import { RelationId, Color, ViewId, RelationshipLineType } from '@likec4/core';
4
4
  export declare const RelationshipEdge: NamedExoticComponent<{
5
5
  id: string;
@@ -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
  {
@@ -1,7 +1,8 @@
1
1
  import { EdgeId, Fqn, ViewId, RelationId, Color, RelationshipLineType, BBox } from '@likec4/core';
2
2
  import { RelationshipDetailsActorRef, RelationshipDetailsSnapshot, Events } from './actor';
3
3
  import { Context, ReactNode, CSSProperties } from 'react';
4
- import { GeneralHelpers, EdgeMarkerType, HandleType, ViewportHelperFunctions, ReactFlowState } from '@xyflow/react';
4
+ import { GeneralHelpers, ViewportHelperFunctions, ReactFlowState } from '@xyflow/react';
5
+ import { EdgeMarkerType, HandleType } from '@xyflow/system';
5
6
  export declare const RelationshipDetailsActorContext: Context<RelationshipDetailsActorRef | null>;
6
7
  export declare function useRelationshipDetailsActor(): RelationshipDetailsActorRef;
7
8
  export declare function useRelationshipDetailsState<T = unknown>(selector: (state: RelationshipDetailsSnapshot) => T, compare?: (a: NoInfer<T>, b: NoInfer<T>) => boolean): T;
@@ -11,6 +12,8 @@ export declare function useRelationshipDetails(): {
11
12
  getState: () => Readonly<{
12
13
  subject: {
13
14
  edgeId: EdgeId;
15
+ source?: never;
16
+ target?: never;
14
17
  } | {
15
18
  source: Fqn;
16
19
  target: Fqn;
@@ -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(":", "_")}`;
@@ -1,6 +1,6 @@
1
1
  import { RelationshipsBrowserActorRef } from './actor';
2
2
  import { NamedExoticComponent, CSSProperties, ReactNode } from 'react';
3
- import { Position } from '@xyflow/react';
3
+ import { Position } from '@xyflow/system';
4
4
  import { Fqn, NonEmptyArray, RelationId, Color, ViewId, RelationshipLineType } from '@likec4/core';
5
5
  export declare const edgeTypes: {
6
6
  relationship: NamedExoticComponent<{
@@ -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;
@@ -2,7 +2,7 @@ import { jsxs, jsx, Fragment } from 'react/jsx-runtime';
2
2
  import { ancestorsFqn } from '@likec4/core';
3
3
  import { useTree, Group, Box, Popover, PopoverTarget, Button, Text, PopoverDropdown, ScrollAreaAutosize, Tree, ActionIcon, Tooltip, SegmentedControl } from '@mantine/core';
4
4
  import { IconSelector, IconChevronRight } from '@tabler/icons-react';
5
- import { memo, useRef, useEffect } from 'react';
5
+ import { r as reactExports } from '../../_virtual/index.js';
6
6
  import { useRelationshipsBrowser, useRelationshipsBrowserState } from './hooks.js';
7
7
  import * as SelectElement_css from './SelectElement.css.js';
8
8
  import { scrollArea } from './SelectElement.css.js';
@@ -20,7 +20,9 @@ const selector2 = (state) => {
20
20
  enableChangeScope: state.context.enableChangeScope
21
21
  };
22
22
  };
23
- const SelectElement = memo(() => {
23
+ const setHoveredNode = () => {
24
+ };
25
+ const SelectElement = reactExports.memo(() => {
24
26
  const browser = useRelationshipsBrowser();
25
27
  const {
26
28
  subjectId,
@@ -30,15 +32,16 @@ const SelectElement = memo(() => {
30
32
  enableSelectSubject,
31
33
  enableChangeScope
32
34
  } = useRelationshipsBrowserState(selector2);
33
- const root = useRef(null);
34
- const viewport = useRef(null);
35
+ const root = reactExports.useRef(null);
36
+ const viewport = reactExports.useRef(null);
35
37
  const model = useLikeC4Model(true);
36
38
  const subject = model.findElement(subjectId);
37
39
  const data = useLikeC4ElementsTree(scope === "view" && viewId ? viewId : void 0);
38
40
  const tree = useTree({
39
41
  multiple: false
40
42
  });
41
- useEffect(() => {
43
+ tree.setHoveredNode = setHoveredNode;
44
+ reactExports.useEffect(() => {
42
45
  ancestorsFqn(subjectId).reverse().forEach((id) => {
43
46
  tree.expand(id);
44
47
  });
@@ -1,9 +1,10 @@
1
1
  import { BBox, Fqn, ViewId, NonEmptyArray, RelationId, Color, RelationshipLineType } from '@likec4/core';
2
- import { EdgeChange, NodeChange, ReactFlowInstance, useStoreApi, EdgeMarkerType, HandleType, GeneralHelpers, ViewportHelperFunctions, ReactFlowState } from '@xyflow/react';
2
+ import { EdgeChange, NodeChange, ReactFlowInstance, useStoreApi, GeneralHelpers, ViewportHelperFunctions, ReactFlowState } from '@xyflow/react';
3
3
  import { ActorLogicFrom, ActorRefFromLogic, SnapshotFrom, PromiseActorLogic, EventObject, StateMachine, Values, NonReducibleUnknown, MetaObject, ConditionalRequired, InputFrom, RequiredActorOptions, IsNotNever, GetConcreteByKey, AnyActorLogic, RequiredLogicInput, ActorRef, MachineSnapshot, AnyActorRef, StateValue, AnyEventObject, ActionFunction, CancelAction, DoneActorEvent } from 'xstate';
4
4
  import { Base } from '../../base';
5
5
  import { RelationshipsBrowserTypes } from './_types';
6
6
  import { LayoutRelationshipsViewResult } from './layout';
7
+ import { EdgeMarkerType, HandleType } from '@xyflow/system';
7
8
  import { ReactNode, CSSProperties } from 'react';
8
9
  type XYFLowInstance = ReactFlowInstance<RelationshipsBrowserTypes.Node, RelationshipsBrowserTypes.Edge>;
9
10
  export type XYStoreApi = ReturnType<typeof useStoreApi<RelationshipsBrowserTypes.Node, RelationshipsBrowserTypes.Edge>>;
@@ -1,6 +1,6 @@
1
1
  import { invariant, nonNullable, delay } from '@likec4/core';
2
2
  import { applyEdgeChanges, applyNodeChanges } from '@xyflow/react';
3
- import { getViewportForBounds, getNodeDimensions } from '@xyflow/system';
3
+ import { getViewportForBounds } from '@xyflow/system';
4
4
  import { prop, omit, isNullish } from 'remeda';
5
5
  import { setup, assign, fromPromise, assertEvent, enqueueActions, cancel, raise } from 'xstate';
6
6
  import { MinZoom, ZIndexes } from '../../base/const.js';
@@ -55,8 +55,6 @@ const layouter = fromPromise(async ({ input, self, signal }) => {
55
55
  };
56
56
  const currentSubjectInternalNode = xyflow.getInternalNode(currentSubjectNode.id);
57
57
  const currentSubjectCenter = centerXYInternalNode(currentSubjectInternalNode);
58
- const existingInternalNode = xyflow.getInternalNode(existingNode.id);
59
- const existingDimensions = getNodeDimensions(existingInternalNode);
60
58
  const nested = /* @__PURE__ */ new Set();
61
59
  currentNodes.forEach((n) => {
62
60
  if (n.id === existingNode.id) {
@@ -88,8 +86,8 @@ const layouter = fromPromise(async ({ input, self, signal }) => {
88
86
  return {
89
87
  ...omit(n, ["parentId"]),
90
88
  position: {
91
- x: currentSubjectCenter.x - existingDimensions.width / 2,
92
- y: currentSubjectCenter.y - existingDimensions.height / 2
89
+ x: currentSubjectCenter.x - n.initialWidth / 2,
90
+ y: currentSubjectCenter.y - n.initialHeight / 2
93
91
  },
94
92
  zIndex: ZIndexes.Max,
95
93
  hidden: false,
@@ -105,16 +103,12 @@ const layouter = fromPromise(async ({ input, self, signal }) => {
105
103
  xynodes: currentNodes,
106
104
  xyedges: []
107
105
  });
108
- zoom = Math.min(
109
- zoom,
110
- nextviewport.zoom
111
- );
112
- await delay(175);
106
+ await delay(120);
113
107
  next.xynodes = next.xynodes.map(Base.setDimmed(false));
114
108
  if (signal.aborted) {
115
109
  return updateXYData();
116
110
  }
117
- await xyflow.setCenter(currentSubjectCenter.x, currentSubjectCenter.y, { zoom, duration: 350 });
111
+ await xyflow.setCenter(currentSubjectCenter.x, currentSubjectCenter.y, { zoom, duration: 300 });
118
112
  await xyflow.setCenter(nextSubjectCenter.x, nextSubjectCenter.y, { zoom });
119
113
  return updateXYData();
120
114
  });
@@ -414,7 +408,7 @@ const relationshipsBrowserLogic = setup({
414
408
  xyedges: event.output.xyedges,
415
409
  navigateFromNode: null
416
410
  });
417
- enqueue.raise({ type: "fitDiagram" }, { id: "fitDiagram", delay: 50 });
411
+ enqueue.raise({ type: "fitDiagram", duration: 200 }, { id: "fitDiagram", delay: 50 });
418
412
  for (let i = 0; i < 6; i++) {
419
413
  enqueue.raise({ type: "xyflow.updateNodeInternals" }, { delay: 100 + i * 100 });
420
414
  }
@@ -1 +1,2 @@
1
- export declare const ViewPadding = 0.1;
1
+ import { Padding } from '@xyflow/system';
2
+ export declare const ViewPadding: Padding;
@@ -1,3 +1,8 @@
1
- const ViewPadding = 0.1;
1
+ const ViewPadding = {
2
+ top: "40px",
3
+ bottom: "16px",
4
+ left: "16px",
5
+ right: "16px"
6
+ };
2
7
 
3
8
  export { ViewPadding };
@@ -1,5 +1,5 @@
1
1
  import { NamedExoticComponent, CSSProperties, ReactNode } from 'react';
2
- import { Position } from '@xyflow/react';
2
+ import { Position } from '@xyflow/system';
3
3
  import { Fqn, NonEmptyArray, RelationId, Color, ViewId, RelationshipLineType } from '@likec4/core';
4
4
  export declare const RelationshipEdge: NamedExoticComponent<{
5
5
  id: string;
@@ -72,13 +72,12 @@ const RelationshipEdge = customEdge((props) => {
72
72
  /* @__PURE__ */ jsx(
73
73
  EdgePath,
74
74
  {
75
- ...edgeProps,
75
+ edgeProps,
76
76
  svgPath,
77
77
  ...markOrange && {
78
78
  strokeWidth: 5
79
79
  }
80
- },
81
- id
80
+ }
82
81
  ),
83
82
  /* @__PURE__ */ jsx(
84
83
  EdgeLabelContainer,
@@ -95,7 +94,7 @@ const RelationshipEdge = customEdge((props) => {
95
94
  children: label
96
95
  }
97
96
  )
98
- ] }, id);
97
+ ] });
99
98
  });
100
99
 
101
100
  export { RelationshipEdge };
@@ -1,7 +1,7 @@
1
1
  import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
2
2
  import { Handle } from '@xyflow/react';
3
3
  import { Position } from '@xyflow/system';
4
- import { m } from 'framer-motion';
4
+ import * as m from 'motion/react-m';
5
5
  import { useDiagram } from '../../../hooks/useDiagram.js';
6
6
  import { ElementActions } from './ElementActions.js';
7
7
  import { EmptyNode as EmptyNode$1 } from './EmptyNode.js';
@@ -2,7 +2,8 @@ import { Fqn, ViewId, NonEmptyArray, RelationId, Color, RelationshipLineType } f
2
2
  import { RelationshipsBrowserActorRef, RelationshipsBrowserSnapshot, XYStoreApi, Events } from './actor';
3
3
  import { LayoutRelationshipsViewResult } from './layout';
4
4
  import { Context, ReactNode, CSSProperties } from 'react';
5
- import { GeneralHelpers, EdgeMarkerType, HandleType, ViewportHelperFunctions } from '@xyflow/react';
5
+ import { GeneralHelpers, ViewportHelperFunctions } from '@xyflow/react';
6
+ import { EdgeMarkerType, HandleType } from '@xyflow/system';
6
7
  export declare const RelationshipsBrowserActorContext: Context<RelationshipsBrowserActorRef | null>;
7
8
  export declare function useRelationshipsBrowserActor(): RelationshipsBrowserActorRef;
8
9
  export declare function useRelationshipsBrowserState<T>(selector: (state: RelationshipsBrowserSnapshot) => T, compare?: (a: T, b: T) => boolean): T;