microboard-temp 0.13.26 → 0.13.27

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.
@@ -54453,9 +54453,31 @@ class GravityEngine {
54453
54453
  this.velocities.clear();
54454
54454
  this.lastSyncedPositions.clear();
54455
54455
  }
54456
+ flushSync() {
54457
+ this.syncPositions();
54458
+ }
54459
+ wake() {
54460
+ for (const item of this.board.items.listAll()) {
54461
+ const pos = item.transformation.getTranslation();
54462
+ this.lastSyncedPositions.set(item.getId(), { x: pos.x, y: pos.y });
54463
+ }
54464
+ if (this.tickTimer !== null)
54465
+ return;
54466
+ this.tickTimer = setInterval(() => this.tick(), this.TICK_MS);
54467
+ this.syncTimer = setInterval(() => this.syncPositions(), this.SYNC_MS);
54468
+ }
54456
54469
  tick() {
54457
54470
  const dt = this.TICK_MS / 1000;
54458
- const items = this.board.items.listAll().filter((item) => !item.transformation.isLocked && !EXCLUDED_ITEM_TYPES.has(item.itemType));
54471
+ const draggedIds = this.board.getDraggedItemIds();
54472
+ const items = this.board.items.listAll().filter((item) => {
54473
+ if (item.transformation.isLocked || EXCLUDED_ITEM_TYPES.has(item.itemType))
54474
+ return false;
54475
+ if (draggedIds.has(item.getId()))
54476
+ return false;
54477
+ if (item.parent !== "Board" && draggedIds.has(item.parent))
54478
+ return false;
54479
+ return true;
54480
+ });
54459
54481
  if (items.length < 1)
54460
54482
  return;
54461
54483
  const snap = items.map((item, idx) => {
@@ -54548,7 +54570,16 @@ class GravityEngine {
54548
54570
  }
54549
54571
  }
54550
54572
  syncPositions() {
54551
- const items = this.board.items.listAll().filter((item) => !item.transformation.isLocked && !EXCLUDED_ITEM_TYPES.has(item.itemType));
54573
+ const draggedIds = this.board.getDraggedItemIds();
54574
+ const items = this.board.items.listAll().filter((item) => {
54575
+ if (item.transformation.isLocked || EXCLUDED_ITEM_TYPES.has(item.itemType))
54576
+ return false;
54577
+ if (draggedIds.has(item.getId()))
54578
+ return false;
54579
+ if (item.parent !== "Board" && draggedIds.has(item.parent))
54580
+ return false;
54581
+ return true;
54582
+ });
54552
54583
  if (items.length === 0)
54553
54584
  return;
54554
54585
  const movedItems = items.map((item) => {
@@ -55974,6 +56005,12 @@ class Board {
55974
56005
  isGravityEnabled() {
55975
56006
  return this.gravity !== null;
55976
56007
  }
56008
+ syncGravity() {
56009
+ this.gravity?.flushSync();
56010
+ }
56011
+ wakeGravity() {
56012
+ this.gravity?.wake();
56013
+ }
55977
56014
  forceGraph = null;
55978
56015
  enableForceGraph(nodeId) {
55979
56016
  if (!this.forceGraph) {
package/dist/cjs/index.js CHANGED
@@ -54453,9 +54453,31 @@ class GravityEngine {
54453
54453
  this.velocities.clear();
54454
54454
  this.lastSyncedPositions.clear();
54455
54455
  }
54456
+ flushSync() {
54457
+ this.syncPositions();
54458
+ }
54459
+ wake() {
54460
+ for (const item of this.board.items.listAll()) {
54461
+ const pos = item.transformation.getTranslation();
54462
+ this.lastSyncedPositions.set(item.getId(), { x: pos.x, y: pos.y });
54463
+ }
54464
+ if (this.tickTimer !== null)
54465
+ return;
54466
+ this.tickTimer = setInterval(() => this.tick(), this.TICK_MS);
54467
+ this.syncTimer = setInterval(() => this.syncPositions(), this.SYNC_MS);
54468
+ }
54456
54469
  tick() {
54457
54470
  const dt = this.TICK_MS / 1000;
54458
- const items = this.board.items.listAll().filter((item) => !item.transformation.isLocked && !EXCLUDED_ITEM_TYPES.has(item.itemType));
54471
+ const draggedIds = this.board.getDraggedItemIds();
54472
+ const items = this.board.items.listAll().filter((item) => {
54473
+ if (item.transformation.isLocked || EXCLUDED_ITEM_TYPES.has(item.itemType))
54474
+ return false;
54475
+ if (draggedIds.has(item.getId()))
54476
+ return false;
54477
+ if (item.parent !== "Board" && draggedIds.has(item.parent))
54478
+ return false;
54479
+ return true;
54480
+ });
54459
54481
  if (items.length < 1)
54460
54482
  return;
54461
54483
  const snap = items.map((item, idx) => {
@@ -54548,7 +54570,16 @@ class GravityEngine {
54548
54570
  }
54549
54571
  }
54550
54572
  syncPositions() {
54551
- const items = this.board.items.listAll().filter((item) => !item.transformation.isLocked && !EXCLUDED_ITEM_TYPES.has(item.itemType));
54573
+ const draggedIds = this.board.getDraggedItemIds();
54574
+ const items = this.board.items.listAll().filter((item) => {
54575
+ if (item.transformation.isLocked || EXCLUDED_ITEM_TYPES.has(item.itemType))
54576
+ return false;
54577
+ if (draggedIds.has(item.getId()))
54578
+ return false;
54579
+ if (item.parent !== "Board" && draggedIds.has(item.parent))
54580
+ return false;
54581
+ return true;
54582
+ });
54552
54583
  if (items.length === 0)
54553
54584
  return;
54554
54585
  const movedItems = items.map((item) => {
@@ -55974,6 +56005,12 @@ class Board {
55974
56005
  isGravityEnabled() {
55975
56006
  return this.gravity !== null;
55976
56007
  }
56008
+ syncGravity() {
56009
+ this.gravity?.flushSync();
56010
+ }
56011
+ wakeGravity() {
56012
+ this.gravity?.wake();
56013
+ }
55977
56014
  forceGraph = null;
55978
56015
  enableForceGraph(nodeId) {
55979
56016
  if (!this.forceGraph) {
package/dist/cjs/node.js CHANGED
@@ -56926,9 +56926,31 @@ class GravityEngine {
56926
56926
  this.velocities.clear();
56927
56927
  this.lastSyncedPositions.clear();
56928
56928
  }
56929
+ flushSync() {
56930
+ this.syncPositions();
56931
+ }
56932
+ wake() {
56933
+ for (const item of this.board.items.listAll()) {
56934
+ const pos = item.transformation.getTranslation();
56935
+ this.lastSyncedPositions.set(item.getId(), { x: pos.x, y: pos.y });
56936
+ }
56937
+ if (this.tickTimer !== null)
56938
+ return;
56939
+ this.tickTimer = setInterval(() => this.tick(), this.TICK_MS);
56940
+ this.syncTimer = setInterval(() => this.syncPositions(), this.SYNC_MS);
56941
+ }
56929
56942
  tick() {
56930
56943
  const dt = this.TICK_MS / 1000;
56931
- const items = this.board.items.listAll().filter((item) => !item.transformation.isLocked && !EXCLUDED_ITEM_TYPES.has(item.itemType));
56944
+ const draggedIds = this.board.getDraggedItemIds();
56945
+ const items = this.board.items.listAll().filter((item) => {
56946
+ if (item.transformation.isLocked || EXCLUDED_ITEM_TYPES.has(item.itemType))
56947
+ return false;
56948
+ if (draggedIds.has(item.getId()))
56949
+ return false;
56950
+ if (item.parent !== "Board" && draggedIds.has(item.parent))
56951
+ return false;
56952
+ return true;
56953
+ });
56932
56954
  if (items.length < 1)
56933
56955
  return;
56934
56956
  const snap = items.map((item, idx) => {
@@ -57021,7 +57043,16 @@ class GravityEngine {
57021
57043
  }
57022
57044
  }
57023
57045
  syncPositions() {
57024
- const items = this.board.items.listAll().filter((item) => !item.transformation.isLocked && !EXCLUDED_ITEM_TYPES.has(item.itemType));
57046
+ const draggedIds = this.board.getDraggedItemIds();
57047
+ const items = this.board.items.listAll().filter((item) => {
57048
+ if (item.transformation.isLocked || EXCLUDED_ITEM_TYPES.has(item.itemType))
57049
+ return false;
57050
+ if (draggedIds.has(item.getId()))
57051
+ return false;
57052
+ if (item.parent !== "Board" && draggedIds.has(item.parent))
57053
+ return false;
57054
+ return true;
57055
+ });
57025
57056
  if (items.length === 0)
57026
57057
  return;
57027
57058
  const movedItems = items.map((item) => {
@@ -58447,6 +58478,12 @@ class Board {
58447
58478
  isGravityEnabled() {
58448
58479
  return this.gravity !== null;
58449
58480
  }
58481
+ syncGravity() {
58482
+ this.gravity?.flushSync();
58483
+ }
58484
+ wakeGravity() {
58485
+ this.gravity?.wake();
58486
+ }
58450
58487
  forceGraph = null;
58451
58488
  enableForceGraph(nodeId) {
58452
58489
  if (!this.forceGraph) {
@@ -54282,9 +54282,31 @@ class GravityEngine {
54282
54282
  this.velocities.clear();
54283
54283
  this.lastSyncedPositions.clear();
54284
54284
  }
54285
+ flushSync() {
54286
+ this.syncPositions();
54287
+ }
54288
+ wake() {
54289
+ for (const item of this.board.items.listAll()) {
54290
+ const pos = item.transformation.getTranslation();
54291
+ this.lastSyncedPositions.set(item.getId(), { x: pos.x, y: pos.y });
54292
+ }
54293
+ if (this.tickTimer !== null)
54294
+ return;
54295
+ this.tickTimer = setInterval(() => this.tick(), this.TICK_MS);
54296
+ this.syncTimer = setInterval(() => this.syncPositions(), this.SYNC_MS);
54297
+ }
54285
54298
  tick() {
54286
54299
  const dt = this.TICK_MS / 1000;
54287
- const items = this.board.items.listAll().filter((item) => !item.transformation.isLocked && !EXCLUDED_ITEM_TYPES.has(item.itemType));
54300
+ const draggedIds = this.board.getDraggedItemIds();
54301
+ const items = this.board.items.listAll().filter((item) => {
54302
+ if (item.transformation.isLocked || EXCLUDED_ITEM_TYPES.has(item.itemType))
54303
+ return false;
54304
+ if (draggedIds.has(item.getId()))
54305
+ return false;
54306
+ if (item.parent !== "Board" && draggedIds.has(item.parent))
54307
+ return false;
54308
+ return true;
54309
+ });
54288
54310
  if (items.length < 1)
54289
54311
  return;
54290
54312
  const snap = items.map((item, idx) => {
@@ -54377,7 +54399,16 @@ class GravityEngine {
54377
54399
  }
54378
54400
  }
54379
54401
  syncPositions() {
54380
- const items = this.board.items.listAll().filter((item) => !item.transformation.isLocked && !EXCLUDED_ITEM_TYPES.has(item.itemType));
54402
+ const draggedIds = this.board.getDraggedItemIds();
54403
+ const items = this.board.items.listAll().filter((item) => {
54404
+ if (item.transformation.isLocked || EXCLUDED_ITEM_TYPES.has(item.itemType))
54405
+ return false;
54406
+ if (draggedIds.has(item.getId()))
54407
+ return false;
54408
+ if (item.parent !== "Board" && draggedIds.has(item.parent))
54409
+ return false;
54410
+ return true;
54411
+ });
54381
54412
  if (items.length === 0)
54382
54413
  return;
54383
54414
  const movedItems = items.map((item) => {
@@ -55803,6 +55834,12 @@ class Board {
55803
55834
  isGravityEnabled() {
55804
55835
  return this.gravity !== null;
55805
55836
  }
55837
+ syncGravity() {
55838
+ this.gravity?.flushSync();
55839
+ }
55840
+ wakeGravity() {
55841
+ this.gravity?.wake();
55842
+ }
55806
55843
  forceGraph = null;
55807
55844
  enableForceGraph(nodeId) {
55808
55845
  if (!this.forceGraph) {
package/dist/esm/index.js CHANGED
@@ -54275,9 +54275,31 @@ class GravityEngine {
54275
54275
  this.velocities.clear();
54276
54276
  this.lastSyncedPositions.clear();
54277
54277
  }
54278
+ flushSync() {
54279
+ this.syncPositions();
54280
+ }
54281
+ wake() {
54282
+ for (const item of this.board.items.listAll()) {
54283
+ const pos = item.transformation.getTranslation();
54284
+ this.lastSyncedPositions.set(item.getId(), { x: pos.x, y: pos.y });
54285
+ }
54286
+ if (this.tickTimer !== null)
54287
+ return;
54288
+ this.tickTimer = setInterval(() => this.tick(), this.TICK_MS);
54289
+ this.syncTimer = setInterval(() => this.syncPositions(), this.SYNC_MS);
54290
+ }
54278
54291
  tick() {
54279
54292
  const dt = this.TICK_MS / 1000;
54280
- const items = this.board.items.listAll().filter((item) => !item.transformation.isLocked && !EXCLUDED_ITEM_TYPES.has(item.itemType));
54293
+ const draggedIds = this.board.getDraggedItemIds();
54294
+ const items = this.board.items.listAll().filter((item) => {
54295
+ if (item.transformation.isLocked || EXCLUDED_ITEM_TYPES.has(item.itemType))
54296
+ return false;
54297
+ if (draggedIds.has(item.getId()))
54298
+ return false;
54299
+ if (item.parent !== "Board" && draggedIds.has(item.parent))
54300
+ return false;
54301
+ return true;
54302
+ });
54281
54303
  if (items.length < 1)
54282
54304
  return;
54283
54305
  const snap = items.map((item, idx) => {
@@ -54370,7 +54392,16 @@ class GravityEngine {
54370
54392
  }
54371
54393
  }
54372
54394
  syncPositions() {
54373
- const items = this.board.items.listAll().filter((item) => !item.transformation.isLocked && !EXCLUDED_ITEM_TYPES.has(item.itemType));
54395
+ const draggedIds = this.board.getDraggedItemIds();
54396
+ const items = this.board.items.listAll().filter((item) => {
54397
+ if (item.transformation.isLocked || EXCLUDED_ITEM_TYPES.has(item.itemType))
54398
+ return false;
54399
+ if (draggedIds.has(item.getId()))
54400
+ return false;
54401
+ if (item.parent !== "Board" && draggedIds.has(item.parent))
54402
+ return false;
54403
+ return true;
54404
+ });
54374
54405
  if (items.length === 0)
54375
54406
  return;
54376
54407
  const movedItems = items.map((item) => {
@@ -55796,6 +55827,12 @@ class Board {
55796
55827
  isGravityEnabled() {
55797
55828
  return this.gravity !== null;
55798
55829
  }
55830
+ syncGravity() {
55831
+ this.gravity?.flushSync();
55832
+ }
55833
+ wakeGravity() {
55834
+ this.gravity?.wake();
55835
+ }
55799
55836
  forceGraph = null;
55800
55837
  enableForceGraph(nodeId) {
55801
55838
  if (!this.forceGraph) {
package/dist/esm/node.js CHANGED
@@ -56743,9 +56743,31 @@ class GravityEngine {
56743
56743
  this.velocities.clear();
56744
56744
  this.lastSyncedPositions.clear();
56745
56745
  }
56746
+ flushSync() {
56747
+ this.syncPositions();
56748
+ }
56749
+ wake() {
56750
+ for (const item of this.board.items.listAll()) {
56751
+ const pos = item.transformation.getTranslation();
56752
+ this.lastSyncedPositions.set(item.getId(), { x: pos.x, y: pos.y });
56753
+ }
56754
+ if (this.tickTimer !== null)
56755
+ return;
56756
+ this.tickTimer = setInterval(() => this.tick(), this.TICK_MS);
56757
+ this.syncTimer = setInterval(() => this.syncPositions(), this.SYNC_MS);
56758
+ }
56746
56759
  tick() {
56747
56760
  const dt = this.TICK_MS / 1000;
56748
- const items = this.board.items.listAll().filter((item) => !item.transformation.isLocked && !EXCLUDED_ITEM_TYPES.has(item.itemType));
56761
+ const draggedIds = this.board.getDraggedItemIds();
56762
+ const items = this.board.items.listAll().filter((item) => {
56763
+ if (item.transformation.isLocked || EXCLUDED_ITEM_TYPES.has(item.itemType))
56764
+ return false;
56765
+ if (draggedIds.has(item.getId()))
56766
+ return false;
56767
+ if (item.parent !== "Board" && draggedIds.has(item.parent))
56768
+ return false;
56769
+ return true;
56770
+ });
56749
56771
  if (items.length < 1)
56750
56772
  return;
56751
56773
  const snap = items.map((item, idx) => {
@@ -56838,7 +56860,16 @@ class GravityEngine {
56838
56860
  }
56839
56861
  }
56840
56862
  syncPositions() {
56841
- const items = this.board.items.listAll().filter((item) => !item.transformation.isLocked && !EXCLUDED_ITEM_TYPES.has(item.itemType));
56863
+ const draggedIds = this.board.getDraggedItemIds();
56864
+ const items = this.board.items.listAll().filter((item) => {
56865
+ if (item.transformation.isLocked || EXCLUDED_ITEM_TYPES.has(item.itemType))
56866
+ return false;
56867
+ if (draggedIds.has(item.getId()))
56868
+ return false;
56869
+ if (item.parent !== "Board" && draggedIds.has(item.parent))
56870
+ return false;
56871
+ return true;
56872
+ });
56842
56873
  if (items.length === 0)
56843
56874
  return;
56844
56875
  const movedItems = items.map((item) => {
@@ -58264,6 +58295,12 @@ class Board {
58264
58295
  isGravityEnabled() {
58265
58296
  return this.gravity !== null;
58266
58297
  }
58298
+ syncGravity() {
58299
+ this.gravity?.flushSync();
58300
+ }
58301
+ wakeGravity() {
58302
+ this.gravity?.wake();
58303
+ }
58267
58304
  forceGraph = null;
58268
58305
  enableForceGraph(nodeId) {
58269
58306
  if (!this.forceGraph) {
@@ -139,6 +139,8 @@ export declare class Board {
139
139
  enableGravity(): void;
140
140
  disableGravity(): void;
141
141
  isGravityEnabled(): boolean;
142
+ syncGravity(): void;
143
+ wakeGravity(): void;
142
144
  private forceGraph;
143
145
  /** Enable force-directed layout for the connected component containing `nodeId`. */
144
146
  enableForceGraph(nodeId: string): void;
@@ -12,6 +12,8 @@ export declare class GravityEngine {
12
12
  constructor(board: Board);
13
13
  start(): void;
14
14
  stop(): void;
15
+ flushSync(): void;
16
+ wake(): void;
15
17
  private tick;
16
18
  private syncPositions;
17
19
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "microboard-temp",
3
- "version": "0.13.26",
3
+ "version": "0.13.27",
4
4
  "description": "A flexible interactive whiteboard library",
5
5
  "main": "dist/cjs/index.js",
6
6
  "module": "dist/esm/index.js",