@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
@@ -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
  });
@@ -1140,7 +1140,7 @@ export declare const relationshipsBrowserLogic: StateMachine<Readonly<{
1140
1140
  active?: boolean;
1141
1141
  dimmed?: Base.Dimmed;
1142
1142
  };
1143
- }> & Omit< ViewportHelperFunctions, "initialized"> & {
1143
+ }> & ViewportHelperFunctions & {
1144
1144
  viewportInitialized: boolean;
1145
1145
  };
1146
1146
  xystore: {
@@ -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 };
@@ -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';
@@ -29,7 +29,7 @@ const ElementDetailsButtonWithHandler = (props) => {
29
29
  const ElementNode = customNode((props) => {
30
30
  return /* @__PURE__ */ jsxs(ElementNodeContainer, { component: m.div, layoutId: props.id, nodeProps: props, children: [
31
31
  /* @__PURE__ */ jsx(ElementShape, { ...props }),
32
- /* @__PURE__ */ jsx(ElementTitle, { ...props, iconSize: 40 }),
32
+ /* @__PURE__ */ jsx(ElementTitle, { ...props }),
33
33
  /* @__PURE__ */ jsx(ElementDetailsButtonWithHandler, { ...props }),
34
34
  /* @__PURE__ */ jsx(ElementActions, { ...props }),
35
35
  /* @__PURE__ */ jsx(ElementPorts, { ...props })
@@ -57,7 +57,7 @@ export declare function useRelationshipsBrowser(): {
57
57
  active?: boolean;
58
58
  dimmed?: import("../../base").Base.Dimmed;
59
59
  };
60
- }> & Omit< ViewportHelperFunctions, "initialized"> & {
60
+ }> & ViewportHelperFunctions & {
61
61
  viewportInitialized: boolean;
62
62
  }) | null;
63
63
  xystore: XYStoreApi | null;
@@ -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 RelationshipsBrowserActorContext = createContext(null);
7
+ const RelationshipsBrowserActorContext = reactExports.createContext(null);
8
8
  function useRelationshipsBrowserActor() {
9
- return nonNullable(useContext(RelationshipsBrowserActorContext), "No RelationshipsBrowserActorContext");
9
+ return nonNullable(reactExports.useContext(RelationshipsBrowserActorContext), "No RelationshipsBrowserActorContext");
10
10
  }
11
11
  function useRelationshipsBrowserState(selector, compare = shallowEqual) {
12
12
  const actor = useRelationshipsBrowserActor();
@@ -14,7 +14,7 @@ function useRelationshipsBrowserState(selector, compare = shallowEqual) {
14
14
  }
15
15
  function useRelationshipsBrowser() {
16
16
  const actor = useRelationshipsBrowserActor();
17
- return useMemo(() => ({
17
+ return reactExports.useMemo(() => ({
18
18
  actor,
19
19
  get rootElementId() {
20
20
  return `relationships-browser-${actor.sessionId.replaceAll(":", "_")}`;
@@ -1,4 +1,4 @@
1
- import { useMemo } from 'react';
1
+ import { r as reactExports } from '../../_virtual/index.js';
2
2
  import dagre from '@dagrejs/dagre';
3
3
  import { toArray, invariant, ifind, DefaultMap } from '@likec4/core';
4
4
  import { pipe, concat, map, groupBy, prop, forEachObj, filter, mapToObj, find, only, unique, tap, reduce, sortBy } from 'remeda';
@@ -454,7 +454,7 @@ function layoutRelationshipsView(data, scope) {
454
454
  }
455
455
  function useRelationshipsView(subject, viewId, scope) {
456
456
  const model = useLikeC4Model(true);
457
- return useMemo(() => {
457
+ return reactExports.useMemo(() => {
458
458
  const view = viewId ? model.findView(viewId) : null;
459
459
  const data = layoutRelationshipsView(
460
460
  computeRelationshipsView(subject, model, viewId, scope),
@@ -41,7 +41,6 @@ function viewToNodesEdge(view) {
41
41
  draggable: false,
42
42
  selectable: true,
43
43
  focusable: true,
44
- deletable: false,
45
44
  position,
46
45
  zIndex: isCompound ? ZIndexes.Compound : ZIndexes.Element,
47
46
  style: {
@@ -140,7 +139,7 @@ function viewToNodesEdge(view) {
140
139
  zIndex: ZIndexes.Edge,
141
140
  // selectable: selectable,
142
141
  // hidden: !visiblePredicate(edge),
143
- deletable: false,
142
+ // deletable: false,
144
143
  data: {
145
144
  sourceFqn: edge.sourceFqn,
146
145
  targetFqn: edge.targetFqn,
@@ -3,7 +3,7 @@ import { useDeepCompareEffect } from '@react-hookz/web';
3
3
  import { useActorRef, useSelector } from '@xstate/react';
4
4
  import { useStoreApi } from '@xyflow/react';
5
5
  import { shallowEqual } from 'fast-equals';
6
- import { useEffect } from 'react';
6
+ import { r as reactExports } from '../_virtual/index.js';
7
7
  import { useDiagramEventHandlersRef } from '../context/DiagramEventHandlers.js';
8
8
  import { useEnabledFeatures, DiagramFeatures } from '../context/DiagramFeatures.js';
9
9
  import { DiagramActorSafeContext } from '../hooks/safeContext.js';
@@ -27,7 +27,9 @@ function DiagramActorProvider({
27
27
  diagramMachine.provide({
28
28
  actions: {
29
29
  "trigger:NavigateTo": (_, { viewId }) => {
30
- handlersRef.current.onNavigateTo?.(viewId);
30
+ setTimeout(() => {
31
+ handlersRef.current.onNavigateTo?.(viewId);
32
+ }, 30);
31
33
  },
32
34
  "trigger:OnChange": (_, params) => {
33
35
  handlersRef.current.onChange?.(params);
@@ -61,7 +63,7 @@ function DiagramActorProvider({
61
63
  useUpdateEffect(() => {
62
64
  actorRef.send({ type: "update.inputs", inputs });
63
65
  }, [inputs]);
64
- useEffect(() => {
66
+ reactExports.useEffect(() => {
65
67
  actorRef.send({ type: "update.features", features });
66
68
  }, [features]);
67
69
  const { xyedges, xynodes } = useViewToNodesEdges({
@@ -2210,7 +2210,7 @@ export declare const diagramMachine: StateMachine<Context, Events, {
2210
2210
  readonly params: {
2211
2211
  readonly duration: 0;
2212
2212
  };
2213
- }, "startSyncLayout", ActionFunction<Context, Events, Events, undefined, Values<{
2213
+ }, ActionFunction<Context, Events, Events, undefined, Values<{
2214
2214
  syncManualLayoutActorLogic: {
2215
2215
  src: "syncManualLayoutActorLogic";
2216
2216
  logic: StateMachine<Readonly< Input>, SyncLayoutEvents, {}, never, {
@@ -2463,7 +2463,7 @@ export declare const diagramMachine: StateMachine<Context, Events, {
2463
2463
  }>;
2464
2464
  id: "overlays";
2465
2465
  };
2466
- }>, never, never, never, never>];
2466
+ }>, never, never, never, never>, "startSyncLayout"];
2467
2467
  readonly target: "ready";
2468
2468
  }, {
2469
2469
  readonly target: "initializing";
@@ -332,7 +332,6 @@ const diagramMachine = setup({
332
332
  type: "xyflow:fitDiagram",
333
333
  params: { duration: 0 }
334
334
  },
335
- "startSyncLayout",
336
335
  assign(({ context }) => ({
337
336
  navigationHistory: {
338
337
  currentIndex: 0,
@@ -342,7 +341,8 @@ const diagramMachine = setup({
342
341
  viewport: { ...context.xyflow.getViewport() }
343
342
  }]
344
343
  }
345
- }))
344
+ })),
345
+ "startSyncLayout"
346
346
  ],
347
347
  target: "ready"
348
348
  }, {
@@ -743,13 +743,11 @@ const diagramMachine = setup({
743
743
  }
744
744
  }
745
745
  });
746
- enqueue.raise({ type: "fitDiagram" }, { id: "fitDiagram", delay: 80 });
747
746
  } else {
748
747
  enqueue({
749
748
  type: "xyflow:setViewportCenter",
750
749
  params: getBBoxCenter(event.view.bounds)
751
750
  });
752
- enqueue.raise({ type: "fitDiagram", duration: 200 }, { id: "fitDiagram", delay: 25 });
753
751
  }
754
752
  enqueue.assign(updateNavigationHistory);
755
753
  enqueue.assign({
@@ -757,6 +755,7 @@ const diagramMachine = setup({
757
755
  lastOnNavigate: null
758
756
  });
759
757
  enqueue("startSyncLayout");
758
+ enqueue.raise({ type: "fitDiagram" }, { id: "fitDiagram", delay: 25 });
760
759
  }),
761
760
  target: "#idle"
762
761
  }
@@ -3,15 +3,24 @@ import { fromCallback } from 'xstate';
3
3
 
4
4
  const hotkeyActorLogic = fromCallback(({ sendBack }) => {
5
5
  const escHandler = getHotkeyHandler([
6
- ["Escape", () => sendBack({ type: "key.esc" }), {
6
+ ["Escape", (event) => {
7
+ event.stopPropagation();
8
+ sendBack({ type: "key.esc" });
9
+ }, {
7
10
  preventDefault: true
8
11
  }]
9
12
  ]);
10
13
  const arrowshandler = getHotkeyHandler([
11
- ["ArrowLeft", () => sendBack({ type: "key.arrow.left" }), {
14
+ ["ArrowLeft", (event) => {
15
+ event.stopPropagation();
16
+ sendBack({ type: "key.arrow.left" });
17
+ }, {
12
18
  preventDefault: true
13
19
  }],
14
- ["ArrowRight", () => sendBack({ type: "key.arrow.right" }), {
20
+ ["ArrowRight", (event) => {
21
+ event.stopPropagation();
22
+ sendBack({ type: "key.arrow.right" });
23
+ }, {
15
24
  preventDefault: true
16
25
  }]
17
26
  ]);