microboard-temp 0.13.23 → 0.13.24

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.
@@ -54661,6 +54661,9 @@ class ForceGraphEngine {
54661
54661
  hasActiveComponents() {
54662
54662
  return this.activeComponents.size > 0;
54663
54663
  }
54664
+ flushSync() {
54665
+ this.syncPositions();
54666
+ }
54664
54667
  wake() {
54665
54668
  if (this.activeComponents.size === 0)
54666
54669
  return;
@@ -54872,7 +54875,8 @@ class ForceGraphEngine {
54872
54875
  }
54873
54876
  syncPositions() {
54874
54877
  const activeIds = this.getActiveNodeIds();
54875
- const nodes = this.getNodes().filter((item) => activeIds.has(item.getId()));
54878
+ const selectedIds = new Set(this.board.selection.list().map((i) => i.getId()));
54879
+ const nodes = this.getNodes().filter((item) => activeIds.has(item.getId()) && !selectedIds.has(item.getId()) && !(item.parent !== "Board" && selectedIds.has(item.parent)));
54876
54880
  if (nodes.length === 0)
54877
54881
  return;
54878
54882
  const movedItems = nodes.map((item) => {
@@ -55994,6 +55998,9 @@ class Board {
55994
55998
  setForceGraphGap(nodeId, gap) {
55995
55999
  this.forceGraph?.setComponentTargetGap(nodeId, gap);
55996
56000
  }
56001
+ syncForceGraph() {
56002
+ this.forceGraph?.flushSync();
56003
+ }
55997
56004
  wakeForceGraph() {
55998
56005
  this.forceGraph?.wake();
55999
56006
  }
package/dist/cjs/index.js CHANGED
@@ -54661,6 +54661,9 @@ class ForceGraphEngine {
54661
54661
  hasActiveComponents() {
54662
54662
  return this.activeComponents.size > 0;
54663
54663
  }
54664
+ flushSync() {
54665
+ this.syncPositions();
54666
+ }
54664
54667
  wake() {
54665
54668
  if (this.activeComponents.size === 0)
54666
54669
  return;
@@ -54872,7 +54875,8 @@ class ForceGraphEngine {
54872
54875
  }
54873
54876
  syncPositions() {
54874
54877
  const activeIds = this.getActiveNodeIds();
54875
- const nodes = this.getNodes().filter((item) => activeIds.has(item.getId()));
54878
+ const selectedIds = new Set(this.board.selection.list().map((i) => i.getId()));
54879
+ const nodes = this.getNodes().filter((item) => activeIds.has(item.getId()) && !selectedIds.has(item.getId()) && !(item.parent !== "Board" && selectedIds.has(item.parent)));
54876
54880
  if (nodes.length === 0)
54877
54881
  return;
54878
54882
  const movedItems = nodes.map((item) => {
@@ -55994,6 +55998,9 @@ class Board {
55994
55998
  setForceGraphGap(nodeId, gap) {
55995
55999
  this.forceGraph?.setComponentTargetGap(nodeId, gap);
55996
56000
  }
56001
+ syncForceGraph() {
56002
+ this.forceGraph?.flushSync();
56003
+ }
55997
56004
  wakeForceGraph() {
55998
56005
  this.forceGraph?.wake();
55999
56006
  }
package/dist/cjs/node.js CHANGED
@@ -57134,6 +57134,9 @@ class ForceGraphEngine {
57134
57134
  hasActiveComponents() {
57135
57135
  return this.activeComponents.size > 0;
57136
57136
  }
57137
+ flushSync() {
57138
+ this.syncPositions();
57139
+ }
57137
57140
  wake() {
57138
57141
  if (this.activeComponents.size === 0)
57139
57142
  return;
@@ -57345,7 +57348,8 @@ class ForceGraphEngine {
57345
57348
  }
57346
57349
  syncPositions() {
57347
57350
  const activeIds = this.getActiveNodeIds();
57348
- const nodes = this.getNodes().filter((item) => activeIds.has(item.getId()));
57351
+ const selectedIds = new Set(this.board.selection.list().map((i) => i.getId()));
57352
+ const nodes = this.getNodes().filter((item) => activeIds.has(item.getId()) && !selectedIds.has(item.getId()) && !(item.parent !== "Board" && selectedIds.has(item.parent)));
57349
57353
  if (nodes.length === 0)
57350
57354
  return;
57351
57355
  const movedItems = nodes.map((item) => {
@@ -58467,6 +58471,9 @@ class Board {
58467
58471
  setForceGraphGap(nodeId, gap) {
58468
58472
  this.forceGraph?.setComponentTargetGap(nodeId, gap);
58469
58473
  }
58474
+ syncForceGraph() {
58475
+ this.forceGraph?.flushSync();
58476
+ }
58470
58477
  wakeForceGraph() {
58471
58478
  this.forceGraph?.wake();
58472
58479
  }
@@ -54490,6 +54490,9 @@ class ForceGraphEngine {
54490
54490
  hasActiveComponents() {
54491
54491
  return this.activeComponents.size > 0;
54492
54492
  }
54493
+ flushSync() {
54494
+ this.syncPositions();
54495
+ }
54493
54496
  wake() {
54494
54497
  if (this.activeComponents.size === 0)
54495
54498
  return;
@@ -54701,7 +54704,8 @@ class ForceGraphEngine {
54701
54704
  }
54702
54705
  syncPositions() {
54703
54706
  const activeIds = this.getActiveNodeIds();
54704
- const nodes = this.getNodes().filter((item) => activeIds.has(item.getId()));
54707
+ const selectedIds = new Set(this.board.selection.list().map((i) => i.getId()));
54708
+ const nodes = this.getNodes().filter((item) => activeIds.has(item.getId()) && !selectedIds.has(item.getId()) && !(item.parent !== "Board" && selectedIds.has(item.parent)));
54705
54709
  if (nodes.length === 0)
54706
54710
  return;
54707
54711
  const movedItems = nodes.map((item) => {
@@ -55823,6 +55827,9 @@ class Board {
55823
55827
  setForceGraphGap(nodeId, gap) {
55824
55828
  this.forceGraph?.setComponentTargetGap(nodeId, gap);
55825
55829
  }
55830
+ syncForceGraph() {
55831
+ this.forceGraph?.flushSync();
55832
+ }
55826
55833
  wakeForceGraph() {
55827
55834
  this.forceGraph?.wake();
55828
55835
  }
package/dist/esm/index.js CHANGED
@@ -54483,6 +54483,9 @@ class ForceGraphEngine {
54483
54483
  hasActiveComponents() {
54484
54484
  return this.activeComponents.size > 0;
54485
54485
  }
54486
+ flushSync() {
54487
+ this.syncPositions();
54488
+ }
54486
54489
  wake() {
54487
54490
  if (this.activeComponents.size === 0)
54488
54491
  return;
@@ -54694,7 +54697,8 @@ class ForceGraphEngine {
54694
54697
  }
54695
54698
  syncPositions() {
54696
54699
  const activeIds = this.getActiveNodeIds();
54697
- const nodes = this.getNodes().filter((item) => activeIds.has(item.getId()));
54700
+ const selectedIds = new Set(this.board.selection.list().map((i) => i.getId()));
54701
+ const nodes = this.getNodes().filter((item) => activeIds.has(item.getId()) && !selectedIds.has(item.getId()) && !(item.parent !== "Board" && selectedIds.has(item.parent)));
54698
54702
  if (nodes.length === 0)
54699
54703
  return;
54700
54704
  const movedItems = nodes.map((item) => {
@@ -55816,6 +55820,9 @@ class Board {
55816
55820
  setForceGraphGap(nodeId, gap) {
55817
55821
  this.forceGraph?.setComponentTargetGap(nodeId, gap);
55818
55822
  }
55823
+ syncForceGraph() {
55824
+ this.forceGraph?.flushSync();
55825
+ }
55819
55826
  wakeForceGraph() {
55820
55827
  this.forceGraph?.wake();
55821
55828
  }
package/dist/esm/node.js CHANGED
@@ -56951,6 +56951,9 @@ class ForceGraphEngine {
56951
56951
  hasActiveComponents() {
56952
56952
  return this.activeComponents.size > 0;
56953
56953
  }
56954
+ flushSync() {
56955
+ this.syncPositions();
56956
+ }
56954
56957
  wake() {
56955
56958
  if (this.activeComponents.size === 0)
56956
56959
  return;
@@ -57162,7 +57165,8 @@ class ForceGraphEngine {
57162
57165
  }
57163
57166
  syncPositions() {
57164
57167
  const activeIds = this.getActiveNodeIds();
57165
- const nodes = this.getNodes().filter((item) => activeIds.has(item.getId()));
57168
+ const selectedIds = new Set(this.board.selection.list().map((i) => i.getId()));
57169
+ const nodes = this.getNodes().filter((item) => activeIds.has(item.getId()) && !selectedIds.has(item.getId()) && !(item.parent !== "Board" && selectedIds.has(item.parent)));
57166
57170
  if (nodes.length === 0)
57167
57171
  return;
57168
57172
  const movedItems = nodes.map((item) => {
@@ -58284,6 +58288,9 @@ class Board {
58284
58288
  setForceGraphGap(nodeId, gap) {
58285
58289
  this.forceGraph?.setComponentTargetGap(nodeId, gap);
58286
58290
  }
58291
+ syncForceGraph() {
58292
+ this.forceGraph?.flushSync();
58293
+ }
58287
58294
  wakeForceGraph() {
58288
58295
  this.forceGraph?.wake();
58289
58296
  }
@@ -150,6 +150,8 @@ export declare class Board {
150
150
  getForceGraphGap(nodeId: string): number | undefined;
151
151
  /** Set the connector target gap (px) for the component containing `nodeId`. */
152
152
  setForceGraphGap(nodeId: string, gap: number): void;
153
+ /** Flush pending physics positions to the server immediately (call before drag starts). */
154
+ syncForceGraph(): void;
153
155
  /** Call after dragging a node to re-wake the physics engine if it was sleeping. */
154
156
  wakeForceGraph(): void;
155
157
  }
@@ -30,7 +30,17 @@ export declare class ForceGraphEngine {
30
30
  /** Update the target gap (connector length) for the component containing `nodeId` and re-wake. */
31
31
  setComponentTargetGap(nodeId: string, gap: number): void;
32
32
  hasActiveComponents(): boolean;
33
- /** Re-wake physics after a node is manually dragged (or targetGap changed). */
33
+ /**
34
+ * Flush pending physics positions immediately.
35
+ * Call BEFORE a manual drag starts so the server knows the current physics position
36
+ * before the drag delta is applied on top of it.
37
+ */
38
+ flushSync(): void;
39
+ /**
40
+ * Re-wake physics after a manual drag ends.
41
+ * Resets sync baseline to the post-drag position so the drag delta
42
+ * (already sent by the normal operation system) is not double-counted.
43
+ */
34
44
  wake(): void;
35
45
  /** Full stop — called when Board destroys the engine. */
36
46
  stop(): void;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "microboard-temp",
3
- "version": "0.13.23",
3
+ "version": "0.13.24",
4
4
  "description": "A flexible interactive whiteboard library",
5
5
  "main": "dist/cjs/index.js",
6
6
  "module": "dist/esm/index.js",