@bemedev/mind-flow 0.3.1 → 0.3.2

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.
package/lib/server.cjs.js CHANGED
@@ -460,6 +460,11 @@ var machine = (0, _bemedev_app.createMachine)({
460
460
  dimensions[id] = calculateDimensions(position);
461
461
  });
462
462
  } })),
463
+ setBoard: assign("board", { SET_BOARD: ({ payload }) => payload }),
464
+ generateID: action(({ pContext }) => pContext.generatedId = (0, nanoid.nanoid)()),
465
+ select: assign("selected", { SELECT: ({ payload }) => payload }),
466
+ clearNewEdge: erase("newEdge"),
467
+ deselect: erase("selected"),
463
468
  startNewEdge: assign("newEdge", { START_NEW_EDGE: ({ payload: from, pContext: { dimensions } }) => {
464
469
  const { x, y } = dimensions[from].output;
465
470
  return {
@@ -470,7 +475,6 @@ var machine = (0, _bemedev_app.createMachine)({
470
475
  y1: y
471
476
  };
472
477
  } }),
473
- setBoard: assign("board", { SET_BOARD: ({ payload }) => payload }),
474
478
  buildUI: batch(assign("edgesPositions", {
475
479
  MOVE: ({ context: { data, edgesPositions }, payload, pContext: { dimensions } }) => {
476
480
  const edges = data?.edges;
@@ -503,26 +507,27 @@ var machine = (0, _bemedev_app.createMachine)({
503
507
  },
504
508
  MOVE_IMMEDIATE: ({ context: { data, edgesPositions }, payload, pContext: { dimensions } }) => {
505
509
  (data?.edges)?.forEach(({ from, to, id }) => {
510
+ const dimension = dimensions[payload.id];
511
+ const edgePosition = edgesPositions[id];
512
+ if (!edgePosition || !dimension) return;
506
513
  if (from === payload.id) {
507
- const dimension = dimensions[payload.id];
508
- const offset = dimension?.outputOffset ?? getDefaultOutputOffset(dimension?.width);
514
+ const offset = dimension.outputOffset ?? getDefaultOutputOffset(dimension.width);
509
515
  const x0 = payload.x + offset.x;
510
516
  const y0 = payload.y + offset.y;
511
- edgesPositions[id].x0 = x0;
512
- edgesPositions[id].y0 = y0;
513
- if (dimension) {
514
- dimension.output.x = x0;
515
- dimension.output.y = y0;
516
- }
517
+ edgePosition.x0 = x0;
518
+ edgePosition.y0 = y0;
519
+ dimension.output = {
520
+ x: x0,
521
+ y: y0
522
+ };
517
523
  }
518
524
  if (to === payload.id) {
519
- const dimension = dimensions[payload.id];
520
525
  const offset = dimension?.inputOffset ?? DEFAULT_INPUT_OFFSET;
521
526
  const x1 = payload.x + offset.x;
522
527
  const y1 = payload.y + offset.y;
523
- edgesPositions[id].x1 = x1;
524
- edgesPositions[id].y1 = y1;
525
- if (dimension) dimension.input = {
528
+ edgePosition.x1 = x1;
529
+ edgePosition.y1 = y1;
530
+ dimension.input = {
526
531
  x: x1,
527
532
  y: y1
528
533
  };
@@ -531,7 +536,7 @@ var machine = (0, _bemedev_app.createMachine)({
531
536
  return edgesPositions;
532
537
  },
533
538
  else: ({ context: { data, edgesPositions }, pContext: { dimensions } }) => {
534
- const edges = data?.edges ?? [];
539
+ const edges = _bemedev_app_bemedev.toArray.typed(data?.edges);
535
540
  edgesPositions = {};
536
541
  edges.forEach(({ from, id, to }) => {
537
542
  const output = dimensions[from]?.output;
@@ -550,9 +555,6 @@ var machine = (0, _bemedev_app.createMachine)({
550
555
  addDimension: action({ ADD_DIMENSION: ({ payload: { id, dimension }, pContext: { dimensions } }) => {
551
556
  dimensions[id] = dimension;
552
557
  } }),
553
- generateID: action(({ pContext }) => {
554
- pContext.generatedId = (0, nanoid.nanoid)();
555
- }),
556
558
  linkChild: batch(assign("data.edges", { ADD_CHILD: ({ context: { data }, pContext, payload }) => {
557
559
  const edges = _bemedev_app_bemedev.toArray.typed(data?.edges);
558
560
  const from = payload;
@@ -581,20 +583,18 @@ var machine = (0, _bemedev_app.createMachine)({
581
583
  return edges;
582
584
  } }), assign("selected", ({ pContext: { generatedId } }) => buildNodeID(generatedId))),
583
585
  selectParent: assign("selected", ({ pContext: { generatedId } }) => buildNodeID(generatedId)),
584
- moveNode: assign("data.nodes", { MOVE: ({ context: { data }, payload }) => {
585
- const { id, x, y } = payload;
586
- return data?.nodes?.map((d) => {
587
- if (d.id === id) return {
588
- ...d,
586
+ moveNode: assign("data.nodes", { MOVE: ({ context: { data }, payload: { id, x, y } }) => {
587
+ return data?.nodes?.map((node) => {
588
+ if (node.id === id) return {
589
+ ...node,
589
590
  position: {
590
591
  x,
591
592
  y
592
593
  }
593
594
  };
594
- return d;
595
- }) ?? [];
595
+ return node;
596
+ });
596
597
  } }),
597
- select: assign("selected", { SELECT: ({ payload }) => payload }),
598
598
  delete: batch(filter("data.edges", { DELETE: ({ id, from, to }, _, { payload }) => {
599
599
  return id !== payload && from !== payload && to !== payload;
600
600
  } }), filter("data.nodes", { DELETE: ({ id }, _, { payload }) => id !== payload })),
@@ -608,8 +608,6 @@ var machine = (0, _bemedev_app.createMachine)({
608
608
  to
609
609
  }];
610
610
  } }), erase("newEdge")),
611
- clearNewEdge: erase("newEdge"),
612
- deselect: erase("selected"),
613
611
  zoom: assign("zoom", { ZOOM: ({ context: { zoom }, payload, pContext }) => {
614
612
  const next = zoom + payload;
615
613
  const clamped = Math.min(Math.max(Number(next.toFixed(2)), .2), 3);
@@ -624,6 +622,87 @@ var machine = (0, _bemedev_app.createMachine)({
624
622
  }
625
623
  pContext.previousZoom = zoom;
626
624
  return 1;
625
+ } }),
626
+ placeChild: assign("data.nodes", { ADD_CHILD: ({ payload, context: { data, board }, pContext }) => {
627
+ if (!board) return data?.nodes;
628
+ const nodes = data?.nodes;
629
+ if (!payload) return nodes;
630
+ const parentNode = nodes?.find((node) => node.id === payload);
631
+ if (!parentNode) return nodes;
632
+ const parentDimension = pContext.dimensions[payload];
633
+ const id = `node-${pContext.generatedId}`;
634
+ const width = parentDimension?.width ?? 192;
635
+ const height = parentDimension?.height ?? 50;
636
+ const initialX = parentNode.position.x + width + 100;
637
+ const initialY = parentNode.position.y;
638
+ const position = pContext.clampPosition(board, initialX, initialY, width, height);
639
+ const dimension = pContext.calculateDimensions(position, parentDimension);
640
+ nodes?.push({
641
+ id,
642
+ data: { content: "<Nouveau nœud>" },
643
+ input: true,
644
+ position
645
+ });
646
+ pContext.dimensions[id] = dimension;
647
+ return nodes;
648
+ } }),
649
+ placeParent: assign("data.nodes", { ADD_PARENT: ({ context: { data, zoom = 1, board }, pContext }) => {
650
+ if (!board) return data?.nodes;
651
+ const nodes = data?.nodes;
652
+ const id = `node-${pContext.generatedId}`;
653
+ const container = board.parent;
654
+ const scrollLeft = container?.scrollLeft ?? 0;
655
+ const scrollTop = container?.scrollTop ?? 0;
656
+ const width = container?.width ?? 0;
657
+ const height = container?.height ?? 0;
658
+ const currentZoom = zoom;
659
+ const x = (scrollLeft + width / 2) / currentZoom;
660
+ const y = (scrollTop + height / 2) / currentZoom;
661
+ const position = pContext.clampPosition(board, x, y);
662
+ const dimension = pContext.calculateDimensions(position);
663
+ nodes?.push({
664
+ id,
665
+ data: { content: "<Nouveau nœud>" },
666
+ input: false,
667
+ position
668
+ });
669
+ pContext.dimensions[id] = dimension;
670
+ return nodes;
671
+ } }),
672
+ placeSibling: assign("data.nodes", { ADD_SIBLING: ({ payload, context: { data, board }, pContext }) => {
673
+ if (!board) return data?.nodes;
674
+ const edges = data?.edges;
675
+ const nodes = data?.nodes;
676
+ const parentID = edges?.find((edge) => edge.to === payload)?.from;
677
+ if (!parentID) return nodes;
678
+ const parentNode = nodes?.find((node) => node.id === parentID);
679
+ if (!parentNode) return nodes;
680
+ const parentDimension = pContext.dimensions[parentID];
681
+ const id = `node-${pContext.generatedId}`;
682
+ const width = parentDimension?.width ?? 192;
683
+ const height = parentDimension?.height ?? 50;
684
+ const initialX = parentNode.position.x + width + 100;
685
+ const initialY = parentNode.position.y + 100;
686
+ const position = pContext.clampPosition(board, initialX, initialY, width, height);
687
+ const dimension = pContext.calculateDimensions(position, parentDimension);
688
+ nodes?.push({
689
+ id,
690
+ data: { content: "<Nouveau nœud>" },
691
+ input: true,
692
+ position
693
+ });
694
+ pContext.dimensions[id] = dimension;
695
+ return nodes;
696
+ } }),
697
+ moveNewEdge: assign("newEdge", { MOVE_NEW_EDGE: ({ context: { newEdge, board }, payload, pContext }) => {
698
+ if (!board) return void 0;
699
+ if (!newEdge) return void 0;
700
+ const { x: x1, y: y1 } = pContext.getBoardPosition(payload.x, payload.y, board);
701
+ return {
702
+ ...newEdge,
703
+ x1,
704
+ y1
705
+ };
627
706
  } })
628
707
  } }));
629
708
  //#endregion
@@ -657,7 +736,7 @@ var [Provider, useFlow] = createContext(() => {
657
736
  *
658
737
  * @returns Calculated 2D coordinate of type {@linkcode Point}.
659
738
  */
660
- getBoardPosition(clientX, clientY, el) {
739
+ getBoardPosition: (clientX, clientY, el) => {
661
740
  if (!el) return {
662
741
  x: clientX,
663
742
  y: clientY
@@ -682,7 +761,7 @@ var [Provider, useFlow] = createContext(() => {
682
761
  *
683
762
  * @see {@linkcode BOUNDS_CONSTRAINTS}
684
763
  */
685
- clampPosition(board, x, y, nodeWidth = 192, nodeHeight = 50) {
764
+ clampPosition: (board, x, y, nodeWidth = 192, nodeHeight = 50) => {
686
765
  const container = board?.parent;
687
766
  if (!container) return {
688
767
  x,
@@ -734,89 +813,6 @@ var [Provider, useFlow] = createContext(() => {
734
813
  }
735
814
  }
736
815
  });
737
- service.addOptions(({ assign }) => ({ actions: {
738
- placeChild: assign("data.nodes", { ADD_CHILD: ({ payload, context: { data, board }, pContext }) => {
739
- if (!board) return data?.nodes;
740
- const nodes = data?.nodes;
741
- if (!payload) return nodes;
742
- const parentNode = nodes?.find((node) => node.id === payload);
743
- if (!parentNode) return nodes;
744
- const parentDimension = pContext.dimensions[payload];
745
- const id = `node-${pContext.generatedId}`;
746
- const width = parentDimension?.width ?? 192;
747
- const height = parentDimension?.height ?? 50;
748
- const initialX = parentNode.position.x + width + 100;
749
- const initialY = parentNode.position.y;
750
- const position = pContext.clampPosition(board, initialX, initialY, width, height);
751
- const dimension = pContext.calculateDimensions(position, parentDimension);
752
- nodes?.push({
753
- id,
754
- data: { content: "<Nouveau nœud>" },
755
- input: true,
756
- position
757
- });
758
- pContext.dimensions[id] = dimension;
759
- return nodes;
760
- } }),
761
- placeParent: assign("data.nodes", { ADD_PARENT: ({ context: { data, zoom = 1, board }, pContext }) => {
762
- if (!board) return data?.nodes;
763
- const nodes = data?.nodes;
764
- const id = `node-${pContext.generatedId}`;
765
- const container = board.parent;
766
- const scrollLeft = container?.scrollLeft ?? 0;
767
- const scrollTop = container?.scrollTop ?? 0;
768
- const width = container?.width ?? 0;
769
- const height = container?.height ?? 0;
770
- const currentZoom = zoom;
771
- const x = (scrollLeft + width / 2) / currentZoom;
772
- const y = (scrollTop + height / 2) / currentZoom;
773
- const position = pContext.clampPosition(board, x, y);
774
- const dimension = pContext.calculateDimensions(position);
775
- nodes?.push({
776
- id,
777
- data: { content: "<Nouveau nœud>" },
778
- input: false,
779
- position
780
- });
781
- pContext.dimensions[id] = dimension;
782
- return nodes;
783
- } }),
784
- placeSibling: assign("data.nodes", { ADD_SIBLING: ({ payload, context: { data, board }, pContext }) => {
785
- if (!board) return data?.nodes;
786
- const edges = data?.edges;
787
- const nodes = data?.nodes;
788
- const parentID = edges?.find((edge) => edge.to === payload)?.from;
789
- if (!parentID) return nodes;
790
- const parentNode = nodes?.find((node) => node.id === parentID);
791
- if (!parentNode) return nodes;
792
- const parentDimension = pContext.dimensions[parentID];
793
- const id = `node-${pContext.generatedId}`;
794
- const width = parentDimension?.width ?? 192;
795
- const height = parentDimension?.height ?? 50;
796
- const initialX = parentNode.position.x + width + 100;
797
- const initialY = parentNode.position.y + 100;
798
- const position = pContext.clampPosition(board, initialX, initialY, width, height);
799
- const dimension = pContext.calculateDimensions(position, parentDimension);
800
- nodes?.push({
801
- id,
802
- data: { content: "<Nouveau nœud>" },
803
- input: true,
804
- position
805
- });
806
- pContext.dimensions[id] = dimension;
807
- return nodes;
808
- } }),
809
- moveNewEdge: assign("newEdge", { MOVE_NEW_EDGE: ({ context: { newEdge, board }, payload, pContext }) => {
810
- if (!board) return void 0;
811
- if (!newEdge) return void 0;
812
- const { x: x1, y: y1 } = pContext.getBoardPosition(payload.x, payload.y, board);
813
- return {
814
- ...newEdge,
815
- x1,
816
- y1
817
- };
818
- } })
819
- } }));
820
816
  service.start();
821
817
  return service;
822
818
  }, { name: "FlowContext" });
@@ -990,7 +986,7 @@ var _tmpl$$2 = [
990
986
  ];
991
987
  var _tmpl$2$1 = [
992
988
  "<div",
993
- " id=\"outputs\" class=\"pointer-events-none absolute top-0 z-10 flex cursor-default flex-col\" style=\"",
989
+ " id=\"inputs\" class=\"pointer-events-none absolute top-0 z-10 flex cursor-default flex-col\" style=\"",
994
990
  "\"><div class=\"cursor-default rounded-full bg-[#e38b29] shadow-md\" style=\"",
995
991
  "\"></div></div>"
996
992
  ];
@@ -1006,7 +1002,7 @@ var _tmpl$3$1 = [
1006
1002
  "\"><path d=\"M19 13h-6v6h-2v-6H5v-2h6V5h2v6h6v2z\"></path></svg></div><!--$-->",
1007
1003
  "<!--/--><!--$-->",
1008
1004
  "<!--/--><!--$-->",
1009
- "<!--/--><div id=\"inputs\" class=\"pointer-events-none absolute top-0 z-10 flex flex-col\" style=\"",
1005
+ "<!--/--><div id=\"outputs\" class=\"pointer-events-none absolute top-0 z-10 flex flex-col\" style=\"",
1010
1006
  "\"><div class=\"cursor-crosshair rounded-full bg-[#e38b29] shadow-md\" style=\"",
1011
1007
  "\"></div></div></div>"
1012
1008
  ];
@@ -1032,6 +1028,8 @@ var _tmpl$5 = [
1032
1028
  */
1033
1029
  var NodeComponent = (props) => {
1034
1030
  const service = useFlow();
1031
+ (0, _bemedev_app_solidjs.createState)(service, { selector: (s) => s.context.newEdge });
1032
+ (0, _thisbeyond_solid_dnd.createDraggable)(props.id);
1035
1033
  const node = (0, _bemedev_app_solidjs.createState)(service, {
1036
1034
  selector: ({ context }) => {
1037
1035
  const item = _bemedev_app.toArray.typed(context.data?.nodes).find((n) => n.id === props.id);
@@ -1045,14 +1043,12 @@ var NodeComponent = (props) => {
1045
1043
  },
1046
1044
  equals: dequal.dequal
1047
1045
  });
1048
- (0, _bemedev_app_solidjs.createState)(service, { selector: (s) => s.context.newEdge });
1049
- const selected = (0, _bemedev_app_solidjs.createState)(service, { selector: (s) => s.context.selected === props.id });
1046
+ const selected = (0, _bemedev_app_solidjs.createState)(service, { selector: ({ context }) => context.selected === props.id });
1050
1047
  const hasParent = (0, _bemedev_app_solidjs.createState)(service, { selector: ({ context: { data } }) => {
1051
1048
  const edges = data?.edges;
1052
1049
  if (!edges) return false;
1053
1050
  return edges.some(({ to }) => to === props.id);
1054
1051
  } });
1055
- (0, _thisbeyond_solid_dnd.createDraggable)(props.id);
1056
1052
  return (0, solid_js_web.ssr)(_tmpl$3$1, (0, solid_js_web.ssrHydrationKey)(), `flex flex-col absolute cursor-grab bg-white rounded-md shadow-md select-none transition-[border,box-shadow] duration-200 ease-in-out hover:shadow-lg draggable ${selected() ? "border border-[#e38c29] z-[100]" : ""} ${!selected() ? "border border-[#e6d4be] z-[1]" : ""} min-w-48`, (0, solid_js_web.ssrStyleProperty)("top:", `${(0, solid_js_web.escape)(node().y, true)}px`) + (0, solid_js_web.ssrStyleProperty)(";left:", `${(0, solid_js_web.escape)(node().x, true)}px`), (0, solid_js_web.ssrAttribute)("id", (0, solid_js_web.escape)(props.id, true), false), `pointer-events-none absolute flex items-center justify-end -top-7.5 right-0 transition-all duration-200 ease-in-out space-x-2 ${selected() ? "w-full opacity-100" : ""} ${!selected() ? "w-0 -right-3 opacity-0 overflow-hidden" : ""}`, (0, solid_js_web.ssrStyleProperty)("overflow:", "visible") + (0, solid_js_web.ssrStyleProperty)(";pointer-events:", "all") + (0, solid_js_web.ssrStyleProperty)(";width:", `${(0, solid_js_web.escape)(12, true) * 2}px`) + (0, solid_js_web.ssrStyleProperty)(";height:", `${(0, solid_js_web.escape)(12, true) * 2}px`), (0, solid_js_web.escape)((0, solid_js_web.createComponent)(solid_js.Show, {
1057
1053
  get when() {
1058
1054
  return hasParent();
@@ -1119,7 +1115,6 @@ var NodesBoard = () => {
1119
1115
  x: 0,
1120
1116
  y: 0
1121
1117
  });
1122
- const [id, setId] = (0, solid_js.createSignal)("");
1123
1118
  const [ref, setRef] = (0, solid_js.createSignal)();
1124
1119
  let percentX = 0;
1125
1120
  let percentY = 0;
@@ -1165,14 +1160,6 @@ var NodesBoard = () => {
1165
1160
  }, { defer: true }));
1166
1161
  (0, solid_js.onMount)(sendBoard);
1167
1162
  const selectedId = (0, _bemedev_app_solidjs.createState)(service, { selector: (s) => s.context?.selected });
1168
- /**
1169
- * Determines whether the given element ID matches the currently selected entity.
1170
- *
1171
- * @param id - The node or edge identifier to check.
1172
- *
1173
- * @returns `true` if the item is currently selected, otherwise `false`.
1174
- */
1175
- const selected = (id) => selectedId() === id;
1176
1163
  const nodeIds = (0, _bemedev_app_solidjs.createState)(service, {
1177
1164
  selector: ({ context }) => {
1178
1165
  return _bemedev_app.toArray.typed(context.data?.nodes).map((item) => item.id);
@@ -1188,37 +1175,33 @@ var NodesBoard = () => {
1188
1175
  const cHeight = () => `calc((${CANVAS_SIZE}vh - ${MARGIN_Y}px) * ${zoom()})`;
1189
1176
  return (0, solid_js_web.ssr)(_tmpl$3, (0, solid_js_web.ssrHydrationKey)(), (0, solid_js_web.escape)((0, solid_js_web.createComponent)(_thisbeyond_solid_dnd.DragDropProvider, {
1190
1177
  onDragMove: ({ draggable: { transform: _transform, node, id } }) => {
1191
- setId(id);
1192
- if (selected(id)) {
1193
- const grandParent = node.parentElement?.parentElement;
1194
- const currentZoom = zoom();
1195
- const minX = 0;
1196
- const maxX = grandParent ? Math.max(0, grandParent.clientWidth / currentZoom - node.offsetWidth) : Infinity;
1197
- const minY = 0;
1198
- const maxY = grandParent ? Math.max(0, grandParent.clientHeight / currentZoom - node.offsetHeight) : Infinity;
1199
- const targetX = node.offsetLeft + _transform.x / currentZoom;
1200
- const targetY = node.offsetTop + _transform.y / currentZoom;
1201
- const x = Math.min(Math.max(targetX, minX), maxX);
1202
- const y = Math.min(Math.max(targetY, minY), maxY);
1203
- const deltaX = x - node.offsetLeft;
1204
- const deltaY = y - node.offsetTop;
1205
- node.style.setProperty("transform", `translate3d(${deltaX}px, ${deltaY}px, 0)`);
1206
- service.send({
1207
- type: "MOVE_IMMEDIATE",
1208
- payload: {
1209
- id: `${id}`,
1210
- x,
1211
- y
1212
- }
1213
- });
1214
- setTransform({
1215
- x: deltaX * currentZoom,
1216
- y: deltaY * currentZoom
1217
- });
1218
- }
1178
+ const grandParent = node.parentElement?.parentElement;
1179
+ const currentZoom = zoom();
1180
+ const minX = 0;
1181
+ const maxX = grandParent ? Math.max(0, grandParent.clientWidth / currentZoom - node.offsetWidth) : Infinity;
1182
+ const minY = 0;
1183
+ const maxY = grandParent ? Math.max(0, grandParent.clientHeight / currentZoom - node.offsetHeight) : Infinity;
1184
+ const targetX = node.offsetLeft + _transform.x / currentZoom;
1185
+ const targetY = node.offsetTop + _transform.y / currentZoom;
1186
+ const x = Math.min(Math.max(targetX, minX), maxX);
1187
+ const y = Math.min(Math.max(targetY, minY), maxY);
1188
+ const deltaX = x - node.offsetLeft;
1189
+ const deltaY = y - node.offsetTop;
1190
+ node.style.setProperty("transform", `translate3d(${deltaX}px, ${deltaY}px, 0)`);
1191
+ service.send({
1192
+ type: "MOVE_IMMEDIATE",
1193
+ payload: {
1194
+ id: `${id}`,
1195
+ x,
1196
+ y
1197
+ }
1198
+ });
1199
+ setTransform({
1200
+ x: deltaX * currentZoom,
1201
+ y: deltaY * currentZoom
1202
+ });
1219
1203
  },
1220
1204
  onDragEnd: ({ draggable: { node, id } }) => {
1221
- if (!selected(id)) return;
1222
1205
  const grandParent = node.parentElement?.parentElement;
1223
1206
  const currentZoom = zoom();
1224
1207
  const minX = 0;
@@ -1258,7 +1241,7 @@ var NodesBoard = () => {
1258
1241
  (0, solid_js_web.ssr)(_tmpl$2, (0, solid_js_web.ssrHydrationKey)(), (0, solid_js_web.escape)(Math.round(zoom() * 100))),
1259
1242
  (0, solid_js_web.createComponent)(solid_js.Show, {
1260
1243
  get when() {
1261
- return !id() || !selected(id());
1244
+ return !selectedId();
1262
1245
  },
1263
1246
  get children() {
1264
1247
  return (0, solid_js_web.createComponent)(_thisbeyond_solid_dnd.DragOverlay, { children: "" });
@@ -1292,6 +1275,7 @@ var FlowChart = (props) => {
1292
1275
  const primaryEdges = props.config?.edges;
1293
1276
  const service = useFlow();
1294
1277
  const hasNewEdge = (0, _bemedev_app_solidjs.createState)(service, { selector: (s) => !!s.context.newEdge });
1278
+ (0, solid_js.onCleanup)(service.pause);
1295
1279
  (0, solid_js.onMount)(() => {
1296
1280
  service.resume();
1297
1281
  service.send({
@@ -1302,7 +1286,6 @@ var FlowChart = (props) => {
1302
1286
  }
1303
1287
  });
1304
1288
  });
1305
- (0, solid_js.onCleanup)(service.pause);
1306
1289
  return (0, solid_js_web.ssr)(_tmpl$, (0, solid_js_web.ssrHydrationKey)(), (0, solid_js_web.ssrStyleProperty)("cursor:", hasNewEdge() ? "inherit" : "crosshair") + (0, solid_js_web.ssrStyleProperty)(";background-image:", "radial-gradient(circle, #b8b8b8bf 1px, rgba(0, 0, 0, 0) 1px)"), (0, solid_js_web.escape)((0, solid_js_web.createComponent)(NodesBoard, {})));
1307
1290
  };
1308
1291
  //#endregion