microboard-temp 0.4.55 → 0.4.57

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.
@@ -40245,26 +40245,6 @@ class Frame2 extends BaseItem {
40245
40245
  this.board = board;
40246
40246
  return this;
40247
40247
  }
40248
- applyAddChild(childId, noWarn = false) {
40249
- const children = Array.isArray(childId) ? childId : [childId];
40250
- children.forEach((child) => {
40251
- if (this.parent !== child && this.getId() !== child) {
40252
- const foundItem = this.getItemById(child);
40253
- if (!this.children.includes(child) && foundItem) {
40254
- this.children.push(child);
40255
- foundItem.parent = this.getId();
40256
- this.updateMbr();
40257
- this.subject.publish(this);
40258
- } else if (!foundItem && !noWarn) {
40259
- console.warn(`Could not find child with id ${childId}`);
40260
- }
40261
- }
40262
- });
40263
- }
40264
- applyRemoveChild(childId) {
40265
- this.children = this.children.filter((currChild) => !childId.includes(currChild));
40266
- this.subject.publish(this);
40267
- }
40268
40248
  getLinkTo() {
40269
40249
  return this.linkTo.link;
40270
40250
  }
@@ -40405,7 +40385,7 @@ class Frame2 extends BaseItem {
40405
40385
  this.transformPath();
40406
40386
  }
40407
40387
  if (data.children) {
40408
- this.applyAddChild(data.children, true);
40388
+ this.applyAddChildren(data.children);
40409
40389
  }
40410
40390
  if (data.text) {
40411
40391
  this.text.deserialize(data.text);
@@ -40451,9 +40431,9 @@ class Frame2 extends BaseItem {
40451
40431
  } else if (op.method === "setFrameType") {
40452
40432
  this.applyFrameType(op.shapeType);
40453
40433
  } else if (op.method === "addChild") {
40454
- this.applyAddChild(op.childId);
40434
+ this.applyAddChildren(op.childId);
40455
40435
  } else if (op.method === "removeChild") {
40456
- this.applyRemoveChild(op.childId);
40436
+ this.applyRemoveChildren(op.childId);
40457
40437
  }
40458
40438
  break;
40459
40439
  case "RichText":
@@ -40529,10 +40509,10 @@ class Frame2 extends BaseItem {
40529
40509
  const child = this.board?.items.getById(childId);
40530
40510
  if (child) {
40531
40511
  if (this.handleNesting(child)) {
40532
- this.applyAddChild([child.getId()]);
40512
+ this.applyAddChildren([child.getId()]);
40533
40513
  child.parent = this.getId();
40534
40514
  } else {
40535
- this.applyRemoveChild([child.getId()]);
40515
+ this.applyRemoveChildren([child.getId()]);
40536
40516
  child.parent = "Board";
40537
40517
  }
40538
40518
  }
@@ -40541,7 +40521,7 @@ class Frame2 extends BaseItem {
40541
40521
  this.board.items.getEnclosedOrCrossed(currMbr.left, currMbr.top, currMbr.right, currMbr.bottom).forEach((item) => {
40542
40522
  if (item.parent === "Board") {
40543
40523
  if (this.handleNesting(item)) {
40544
- this.applyAddChild([item.getId()]);
40524
+ this.applyAddChildren([item.getId()]);
40545
40525
  item.parent = this.getId();
40546
40526
  }
40547
40527
  }
@@ -43958,7 +43938,7 @@ class AddFrame extends BoardTool {
43958
43938
  child.parent = this.frame.getId();
43959
43939
  return child.getId();
43960
43940
  });
43961
- this.frame.applyAddChild(childrenIds);
43941
+ this.frame.applyAddChildren(childrenIds);
43962
43942
  this.frame.subject.publish(this.frame);
43963
43943
  }
43964
43944
  applyCanChangeRatio(canChangeRatio) {
@@ -53629,6 +53609,7 @@ class Board {
53629
53609
  const data = Array.from(items.children).map((el) => this.parseHTML(el));
53630
53610
  for (const parsedData of data) {
53631
53611
  if ("childrenMap" in parsedData) {
53612
+ const addedFrame = this.add(this.createItem(this.getNewItemId(), parsedData.data));
53632
53613
  const addedChildren = Object.values(parsedData.childrenMap).map((childData) => {
53633
53614
  const created = this.createItem(this.getNewItemId(), childData);
53634
53615
  const added = this.add(created);
@@ -53641,8 +53622,8 @@ class Board {
53641
53622
  }
53642
53623
  return added;
53643
53624
  });
53625
+ addedFrame.addChildItems(addedChildren);
53644
53626
  parsedData.data.children = addedChildren.map((item) => item.getId());
53645
- const addedFrame = this.add(this.createItem(this.getNewItemId(), parsedData.data));
53646
53627
  idsMap[parsedData.data.id] = addedFrame.getId();
53647
53628
  } else {
53648
53629
  const added = this.add(this.createItem(this.getNewItemId(), parsedData));
@@ -53708,7 +53689,7 @@ class Board {
53708
53689
  }
53709
53690
  for (const key in createdFrames) {
53710
53691
  const { item, itemData } = createdFrames[key];
53711
- item.applyAddChild(itemData.children);
53692
+ item.applyAddChildren(itemData.children);
53712
53693
  }
53713
53694
  }
53714
53695
  deserialize(snapshot) {
@@ -53744,7 +53725,7 @@ class Board {
53744
53725
  }
53745
53726
  for (const key in createdFrames) {
53746
53727
  const { item, itemData } = createdFrames[key];
53747
- item.applyAddChild(itemData.children);
53728
+ item.applyAddChildren(itemData.children);
53748
53729
  }
53749
53730
  this.events?.log.deserialize(events);
53750
53731
  }
package/dist/cjs/index.js CHANGED
@@ -40245,26 +40245,6 @@ class Frame2 extends BaseItem {
40245
40245
  this.board = board;
40246
40246
  return this;
40247
40247
  }
40248
- applyAddChild(childId, noWarn = false) {
40249
- const children = Array.isArray(childId) ? childId : [childId];
40250
- children.forEach((child) => {
40251
- if (this.parent !== child && this.getId() !== child) {
40252
- const foundItem = this.getItemById(child);
40253
- if (!this.children.includes(child) && foundItem) {
40254
- this.children.push(child);
40255
- foundItem.parent = this.getId();
40256
- this.updateMbr();
40257
- this.subject.publish(this);
40258
- } else if (!foundItem && !noWarn) {
40259
- console.warn(`Could not find child with id ${childId}`);
40260
- }
40261
- }
40262
- });
40263
- }
40264
- applyRemoveChild(childId) {
40265
- this.children = this.children.filter((currChild) => !childId.includes(currChild));
40266
- this.subject.publish(this);
40267
- }
40268
40248
  getLinkTo() {
40269
40249
  return this.linkTo.link;
40270
40250
  }
@@ -40405,7 +40385,7 @@ class Frame2 extends BaseItem {
40405
40385
  this.transformPath();
40406
40386
  }
40407
40387
  if (data.children) {
40408
- this.applyAddChild(data.children, true);
40388
+ this.applyAddChildren(data.children);
40409
40389
  }
40410
40390
  if (data.text) {
40411
40391
  this.text.deserialize(data.text);
@@ -40451,9 +40431,9 @@ class Frame2 extends BaseItem {
40451
40431
  } else if (op.method === "setFrameType") {
40452
40432
  this.applyFrameType(op.shapeType);
40453
40433
  } else if (op.method === "addChild") {
40454
- this.applyAddChild(op.childId);
40434
+ this.applyAddChildren(op.childId);
40455
40435
  } else if (op.method === "removeChild") {
40456
- this.applyRemoveChild(op.childId);
40436
+ this.applyRemoveChildren(op.childId);
40457
40437
  }
40458
40438
  break;
40459
40439
  case "RichText":
@@ -40529,10 +40509,10 @@ class Frame2 extends BaseItem {
40529
40509
  const child = this.board?.items.getById(childId);
40530
40510
  if (child) {
40531
40511
  if (this.handleNesting(child)) {
40532
- this.applyAddChild([child.getId()]);
40512
+ this.applyAddChildren([child.getId()]);
40533
40513
  child.parent = this.getId();
40534
40514
  } else {
40535
- this.applyRemoveChild([child.getId()]);
40515
+ this.applyRemoveChildren([child.getId()]);
40536
40516
  child.parent = "Board";
40537
40517
  }
40538
40518
  }
@@ -40541,7 +40521,7 @@ class Frame2 extends BaseItem {
40541
40521
  this.board.items.getEnclosedOrCrossed(currMbr.left, currMbr.top, currMbr.right, currMbr.bottom).forEach((item) => {
40542
40522
  if (item.parent === "Board") {
40543
40523
  if (this.handleNesting(item)) {
40544
- this.applyAddChild([item.getId()]);
40524
+ this.applyAddChildren([item.getId()]);
40545
40525
  item.parent = this.getId();
40546
40526
  }
40547
40527
  }
@@ -43958,7 +43938,7 @@ class AddFrame extends BoardTool {
43958
43938
  child.parent = this.frame.getId();
43959
43939
  return child.getId();
43960
43940
  });
43961
- this.frame.applyAddChild(childrenIds);
43941
+ this.frame.applyAddChildren(childrenIds);
43962
43942
  this.frame.subject.publish(this.frame);
43963
43943
  }
43964
43944
  applyCanChangeRatio(canChangeRatio) {
@@ -53629,6 +53609,7 @@ class Board {
53629
53609
  const data = Array.from(items.children).map((el) => this.parseHTML(el));
53630
53610
  for (const parsedData of data) {
53631
53611
  if ("childrenMap" in parsedData) {
53612
+ const addedFrame = this.add(this.createItem(this.getNewItemId(), parsedData.data));
53632
53613
  const addedChildren = Object.values(parsedData.childrenMap).map((childData) => {
53633
53614
  const created = this.createItem(this.getNewItemId(), childData);
53634
53615
  const added = this.add(created);
@@ -53641,8 +53622,8 @@ class Board {
53641
53622
  }
53642
53623
  return added;
53643
53624
  });
53625
+ addedFrame.addChildItems(addedChildren);
53644
53626
  parsedData.data.children = addedChildren.map((item) => item.getId());
53645
- const addedFrame = this.add(this.createItem(this.getNewItemId(), parsedData.data));
53646
53627
  idsMap[parsedData.data.id] = addedFrame.getId();
53647
53628
  } else {
53648
53629
  const added = this.add(this.createItem(this.getNewItemId(), parsedData));
@@ -53708,7 +53689,7 @@ class Board {
53708
53689
  }
53709
53690
  for (const key in createdFrames) {
53710
53691
  const { item, itemData } = createdFrames[key];
53711
- item.applyAddChild(itemData.children);
53692
+ item.applyAddChildren(itemData.children);
53712
53693
  }
53713
53694
  }
53714
53695
  deserialize(snapshot) {
@@ -53744,7 +53725,7 @@ class Board {
53744
53725
  }
53745
53726
  for (const key in createdFrames) {
53746
53727
  const { item, itemData } = createdFrames[key];
53747
- item.applyAddChild(itemData.children);
53728
+ item.applyAddChildren(itemData.children);
53748
53729
  }
53749
53730
  this.events?.log.deserialize(events);
53750
53731
  }
package/dist/cjs/node.js CHANGED
@@ -42718,26 +42718,6 @@ class Frame2 extends BaseItem {
42718
42718
  this.board = board;
42719
42719
  return this;
42720
42720
  }
42721
- applyAddChild(childId, noWarn = false) {
42722
- const children = Array.isArray(childId) ? childId : [childId];
42723
- children.forEach((child) => {
42724
- if (this.parent !== child && this.getId() !== child) {
42725
- const foundItem = this.getItemById(child);
42726
- if (!this.children.includes(child) && foundItem) {
42727
- this.children.push(child);
42728
- foundItem.parent = this.getId();
42729
- this.updateMbr();
42730
- this.subject.publish(this);
42731
- } else if (!foundItem && !noWarn) {
42732
- console.warn(`Could not find child with id ${childId}`);
42733
- }
42734
- }
42735
- });
42736
- }
42737
- applyRemoveChild(childId) {
42738
- this.children = this.children.filter((currChild) => !childId.includes(currChild));
42739
- this.subject.publish(this);
42740
- }
42741
42721
  getLinkTo() {
42742
42722
  return this.linkTo.link;
42743
42723
  }
@@ -42878,7 +42858,7 @@ class Frame2 extends BaseItem {
42878
42858
  this.transformPath();
42879
42859
  }
42880
42860
  if (data.children) {
42881
- this.applyAddChild(data.children, true);
42861
+ this.applyAddChildren(data.children);
42882
42862
  }
42883
42863
  if (data.text) {
42884
42864
  this.text.deserialize(data.text);
@@ -42924,9 +42904,9 @@ class Frame2 extends BaseItem {
42924
42904
  } else if (op.method === "setFrameType") {
42925
42905
  this.applyFrameType(op.shapeType);
42926
42906
  } else if (op.method === "addChild") {
42927
- this.applyAddChild(op.childId);
42907
+ this.applyAddChildren(op.childId);
42928
42908
  } else if (op.method === "removeChild") {
42929
- this.applyRemoveChild(op.childId);
42909
+ this.applyRemoveChildren(op.childId);
42930
42910
  }
42931
42911
  break;
42932
42912
  case "RichText":
@@ -43002,10 +42982,10 @@ class Frame2 extends BaseItem {
43002
42982
  const child = this.board?.items.getById(childId);
43003
42983
  if (child) {
43004
42984
  if (this.handleNesting(child)) {
43005
- this.applyAddChild([child.getId()]);
42985
+ this.applyAddChildren([child.getId()]);
43006
42986
  child.parent = this.getId();
43007
42987
  } else {
43008
- this.applyRemoveChild([child.getId()]);
42988
+ this.applyRemoveChildren([child.getId()]);
43009
42989
  child.parent = "Board";
43010
42990
  }
43011
42991
  }
@@ -43014,7 +42994,7 @@ class Frame2 extends BaseItem {
43014
42994
  this.board.items.getEnclosedOrCrossed(currMbr.left, currMbr.top, currMbr.right, currMbr.bottom).forEach((item) => {
43015
42995
  if (item.parent === "Board") {
43016
42996
  if (this.handleNesting(item)) {
43017
- this.applyAddChild([item.getId()]);
42997
+ this.applyAddChildren([item.getId()]);
43018
42998
  item.parent = this.getId();
43019
42999
  }
43020
43000
  }
@@ -46431,7 +46411,7 @@ class AddFrame extends BoardTool {
46431
46411
  child.parent = this.frame.getId();
46432
46412
  return child.getId();
46433
46413
  });
46434
- this.frame.applyAddChild(childrenIds);
46414
+ this.frame.applyAddChildren(childrenIds);
46435
46415
  this.frame.subject.publish(this.frame);
46436
46416
  }
46437
46417
  applyCanChangeRatio(canChangeRatio) {
@@ -56102,6 +56082,7 @@ class Board {
56102
56082
  const data = Array.from(items.children).map((el) => this.parseHTML(el));
56103
56083
  for (const parsedData of data) {
56104
56084
  if ("childrenMap" in parsedData) {
56085
+ const addedFrame = this.add(this.createItem(this.getNewItemId(), parsedData.data));
56105
56086
  const addedChildren = Object.values(parsedData.childrenMap).map((childData) => {
56106
56087
  const created = this.createItem(this.getNewItemId(), childData);
56107
56088
  const added = this.add(created);
@@ -56114,8 +56095,8 @@ class Board {
56114
56095
  }
56115
56096
  return added;
56116
56097
  });
56098
+ addedFrame.addChildItems(addedChildren);
56117
56099
  parsedData.data.children = addedChildren.map((item) => item.getId());
56118
- const addedFrame = this.add(this.createItem(this.getNewItemId(), parsedData.data));
56119
56100
  idsMap[parsedData.data.id] = addedFrame.getId();
56120
56101
  } else {
56121
56102
  const added = this.add(this.createItem(this.getNewItemId(), parsedData));
@@ -56181,7 +56162,7 @@ class Board {
56181
56162
  }
56182
56163
  for (const key in createdFrames) {
56183
56164
  const { item, itemData } = createdFrames[key];
56184
- item.applyAddChild(itemData.children);
56165
+ item.applyAddChildren(itemData.children);
56185
56166
  }
56186
56167
  }
56187
56168
  deserialize(snapshot) {
@@ -56217,7 +56198,7 @@ class Board {
56217
56198
  }
56218
56199
  for (const key in createdFrames) {
56219
56200
  const { item, itemData } = createdFrames[key];
56220
- item.applyAddChild(itemData.children);
56201
+ item.applyAddChildren(itemData.children);
56221
56202
  }
56222
56203
  this.events?.log.deserialize(events);
56223
56204
  }
@@ -40095,26 +40095,6 @@ class Frame2 extends BaseItem {
40095
40095
  this.board = board;
40096
40096
  return this;
40097
40097
  }
40098
- applyAddChild(childId, noWarn = false) {
40099
- const children = Array.isArray(childId) ? childId : [childId];
40100
- children.forEach((child) => {
40101
- if (this.parent !== child && this.getId() !== child) {
40102
- const foundItem = this.getItemById(child);
40103
- if (!this.children.includes(child) && foundItem) {
40104
- this.children.push(child);
40105
- foundItem.parent = this.getId();
40106
- this.updateMbr();
40107
- this.subject.publish(this);
40108
- } else if (!foundItem && !noWarn) {
40109
- console.warn(`Could not find child with id ${childId}`);
40110
- }
40111
- }
40112
- });
40113
- }
40114
- applyRemoveChild(childId) {
40115
- this.children = this.children.filter((currChild) => !childId.includes(currChild));
40116
- this.subject.publish(this);
40117
- }
40118
40098
  getLinkTo() {
40119
40099
  return this.linkTo.link;
40120
40100
  }
@@ -40255,7 +40235,7 @@ class Frame2 extends BaseItem {
40255
40235
  this.transformPath();
40256
40236
  }
40257
40237
  if (data.children) {
40258
- this.applyAddChild(data.children, true);
40238
+ this.applyAddChildren(data.children);
40259
40239
  }
40260
40240
  if (data.text) {
40261
40241
  this.text.deserialize(data.text);
@@ -40301,9 +40281,9 @@ class Frame2 extends BaseItem {
40301
40281
  } else if (op.method === "setFrameType") {
40302
40282
  this.applyFrameType(op.shapeType);
40303
40283
  } else if (op.method === "addChild") {
40304
- this.applyAddChild(op.childId);
40284
+ this.applyAddChildren(op.childId);
40305
40285
  } else if (op.method === "removeChild") {
40306
- this.applyRemoveChild(op.childId);
40286
+ this.applyRemoveChildren(op.childId);
40307
40287
  }
40308
40288
  break;
40309
40289
  case "RichText":
@@ -40379,10 +40359,10 @@ class Frame2 extends BaseItem {
40379
40359
  const child = this.board?.items.getById(childId);
40380
40360
  if (child) {
40381
40361
  if (this.handleNesting(child)) {
40382
- this.applyAddChild([child.getId()]);
40362
+ this.applyAddChildren([child.getId()]);
40383
40363
  child.parent = this.getId();
40384
40364
  } else {
40385
- this.applyRemoveChild([child.getId()]);
40365
+ this.applyRemoveChildren([child.getId()]);
40386
40366
  child.parent = "Board";
40387
40367
  }
40388
40368
  }
@@ -40391,7 +40371,7 @@ class Frame2 extends BaseItem {
40391
40371
  this.board.items.getEnclosedOrCrossed(currMbr.left, currMbr.top, currMbr.right, currMbr.bottom).forEach((item) => {
40392
40372
  if (item.parent === "Board") {
40393
40373
  if (this.handleNesting(item)) {
40394
- this.applyAddChild([item.getId()]);
40374
+ this.applyAddChildren([item.getId()]);
40395
40375
  item.parent = this.getId();
40396
40376
  }
40397
40377
  }
@@ -43808,7 +43788,7 @@ class AddFrame extends BoardTool {
43808
43788
  child.parent = this.frame.getId();
43809
43789
  return child.getId();
43810
43790
  });
43811
- this.frame.applyAddChild(childrenIds);
43791
+ this.frame.applyAddChildren(childrenIds);
43812
43792
  this.frame.subject.publish(this.frame);
43813
43793
  }
43814
43794
  applyCanChangeRatio(canChangeRatio) {
@@ -53479,6 +53459,7 @@ class Board {
53479
53459
  const data = Array.from(items.children).map((el) => this.parseHTML(el));
53480
53460
  for (const parsedData of data) {
53481
53461
  if ("childrenMap" in parsedData) {
53462
+ const addedFrame = this.add(this.createItem(this.getNewItemId(), parsedData.data));
53482
53463
  const addedChildren = Object.values(parsedData.childrenMap).map((childData) => {
53483
53464
  const created = this.createItem(this.getNewItemId(), childData);
53484
53465
  const added = this.add(created);
@@ -53491,8 +53472,8 @@ class Board {
53491
53472
  }
53492
53473
  return added;
53493
53474
  });
53475
+ addedFrame.addChildItems(addedChildren);
53494
53476
  parsedData.data.children = addedChildren.map((item) => item.getId());
53495
- const addedFrame = this.add(this.createItem(this.getNewItemId(), parsedData.data));
53496
53477
  idsMap[parsedData.data.id] = addedFrame.getId();
53497
53478
  } else {
53498
53479
  const added = this.add(this.createItem(this.getNewItemId(), parsedData));
@@ -53558,7 +53539,7 @@ class Board {
53558
53539
  }
53559
53540
  for (const key in createdFrames) {
53560
53541
  const { item, itemData } = createdFrames[key];
53561
- item.applyAddChild(itemData.children);
53542
+ item.applyAddChildren(itemData.children);
53562
53543
  }
53563
53544
  }
53564
53545
  deserialize(snapshot) {
@@ -53594,7 +53575,7 @@ class Board {
53594
53575
  }
53595
53576
  for (const key in createdFrames) {
53596
53577
  const { item, itemData } = createdFrames[key];
53597
- item.applyAddChild(itemData.children);
53578
+ item.applyAddChildren(itemData.children);
53598
53579
  }
53599
53580
  this.events?.log.deserialize(events);
53600
53581
  }
package/dist/esm/index.js CHANGED
@@ -40088,26 +40088,6 @@ class Frame2 extends BaseItem {
40088
40088
  this.board = board;
40089
40089
  return this;
40090
40090
  }
40091
- applyAddChild(childId, noWarn = false) {
40092
- const children = Array.isArray(childId) ? childId : [childId];
40093
- children.forEach((child) => {
40094
- if (this.parent !== child && this.getId() !== child) {
40095
- const foundItem = this.getItemById(child);
40096
- if (!this.children.includes(child) && foundItem) {
40097
- this.children.push(child);
40098
- foundItem.parent = this.getId();
40099
- this.updateMbr();
40100
- this.subject.publish(this);
40101
- } else if (!foundItem && !noWarn) {
40102
- console.warn(`Could not find child with id ${childId}`);
40103
- }
40104
- }
40105
- });
40106
- }
40107
- applyRemoveChild(childId) {
40108
- this.children = this.children.filter((currChild) => !childId.includes(currChild));
40109
- this.subject.publish(this);
40110
- }
40111
40091
  getLinkTo() {
40112
40092
  return this.linkTo.link;
40113
40093
  }
@@ -40248,7 +40228,7 @@ class Frame2 extends BaseItem {
40248
40228
  this.transformPath();
40249
40229
  }
40250
40230
  if (data.children) {
40251
- this.applyAddChild(data.children, true);
40231
+ this.applyAddChildren(data.children);
40252
40232
  }
40253
40233
  if (data.text) {
40254
40234
  this.text.deserialize(data.text);
@@ -40294,9 +40274,9 @@ class Frame2 extends BaseItem {
40294
40274
  } else if (op.method === "setFrameType") {
40295
40275
  this.applyFrameType(op.shapeType);
40296
40276
  } else if (op.method === "addChild") {
40297
- this.applyAddChild(op.childId);
40277
+ this.applyAddChildren(op.childId);
40298
40278
  } else if (op.method === "removeChild") {
40299
- this.applyRemoveChild(op.childId);
40279
+ this.applyRemoveChildren(op.childId);
40300
40280
  }
40301
40281
  break;
40302
40282
  case "RichText":
@@ -40372,10 +40352,10 @@ class Frame2 extends BaseItem {
40372
40352
  const child = this.board?.items.getById(childId);
40373
40353
  if (child) {
40374
40354
  if (this.handleNesting(child)) {
40375
- this.applyAddChild([child.getId()]);
40355
+ this.applyAddChildren([child.getId()]);
40376
40356
  child.parent = this.getId();
40377
40357
  } else {
40378
- this.applyRemoveChild([child.getId()]);
40358
+ this.applyRemoveChildren([child.getId()]);
40379
40359
  child.parent = "Board";
40380
40360
  }
40381
40361
  }
@@ -40384,7 +40364,7 @@ class Frame2 extends BaseItem {
40384
40364
  this.board.items.getEnclosedOrCrossed(currMbr.left, currMbr.top, currMbr.right, currMbr.bottom).forEach((item) => {
40385
40365
  if (item.parent === "Board") {
40386
40366
  if (this.handleNesting(item)) {
40387
- this.applyAddChild([item.getId()]);
40367
+ this.applyAddChildren([item.getId()]);
40388
40368
  item.parent = this.getId();
40389
40369
  }
40390
40370
  }
@@ -43801,7 +43781,7 @@ class AddFrame extends BoardTool {
43801
43781
  child.parent = this.frame.getId();
43802
43782
  return child.getId();
43803
43783
  });
43804
- this.frame.applyAddChild(childrenIds);
43784
+ this.frame.applyAddChildren(childrenIds);
43805
43785
  this.frame.subject.publish(this.frame);
43806
43786
  }
43807
43787
  applyCanChangeRatio(canChangeRatio) {
@@ -53472,6 +53452,7 @@ class Board {
53472
53452
  const data = Array.from(items.children).map((el) => this.parseHTML(el));
53473
53453
  for (const parsedData of data) {
53474
53454
  if ("childrenMap" in parsedData) {
53455
+ const addedFrame = this.add(this.createItem(this.getNewItemId(), parsedData.data));
53475
53456
  const addedChildren = Object.values(parsedData.childrenMap).map((childData) => {
53476
53457
  const created = this.createItem(this.getNewItemId(), childData);
53477
53458
  const added = this.add(created);
@@ -53484,8 +53465,8 @@ class Board {
53484
53465
  }
53485
53466
  return added;
53486
53467
  });
53468
+ addedFrame.addChildItems(addedChildren);
53487
53469
  parsedData.data.children = addedChildren.map((item) => item.getId());
53488
- const addedFrame = this.add(this.createItem(this.getNewItemId(), parsedData.data));
53489
53470
  idsMap[parsedData.data.id] = addedFrame.getId();
53490
53471
  } else {
53491
53472
  const added = this.add(this.createItem(this.getNewItemId(), parsedData));
@@ -53551,7 +53532,7 @@ class Board {
53551
53532
  }
53552
53533
  for (const key in createdFrames) {
53553
53534
  const { item, itemData } = createdFrames[key];
53554
- item.applyAddChild(itemData.children);
53535
+ item.applyAddChildren(itemData.children);
53555
53536
  }
53556
53537
  }
53557
53538
  deserialize(snapshot) {
@@ -53587,7 +53568,7 @@ class Board {
53587
53568
  }
53588
53569
  for (const key in createdFrames) {
53589
53570
  const { item, itemData } = createdFrames[key];
53590
- item.applyAddChild(itemData.children);
53571
+ item.applyAddChildren(itemData.children);
53591
53572
  }
53592
53573
  this.events?.log.deserialize(events);
53593
53574
  }
package/dist/esm/node.js CHANGED
@@ -42556,26 +42556,6 @@ class Frame2 extends BaseItem {
42556
42556
  this.board = board;
42557
42557
  return this;
42558
42558
  }
42559
- applyAddChild(childId, noWarn = false) {
42560
- const children = Array.isArray(childId) ? childId : [childId];
42561
- children.forEach((child) => {
42562
- if (this.parent !== child && this.getId() !== child) {
42563
- const foundItem = this.getItemById(child);
42564
- if (!this.children.includes(child) && foundItem) {
42565
- this.children.push(child);
42566
- foundItem.parent = this.getId();
42567
- this.updateMbr();
42568
- this.subject.publish(this);
42569
- } else if (!foundItem && !noWarn) {
42570
- console.warn(`Could not find child with id ${childId}`);
42571
- }
42572
- }
42573
- });
42574
- }
42575
- applyRemoveChild(childId) {
42576
- this.children = this.children.filter((currChild) => !childId.includes(currChild));
42577
- this.subject.publish(this);
42578
- }
42579
42559
  getLinkTo() {
42580
42560
  return this.linkTo.link;
42581
42561
  }
@@ -42716,7 +42696,7 @@ class Frame2 extends BaseItem {
42716
42696
  this.transformPath();
42717
42697
  }
42718
42698
  if (data.children) {
42719
- this.applyAddChild(data.children, true);
42699
+ this.applyAddChildren(data.children);
42720
42700
  }
42721
42701
  if (data.text) {
42722
42702
  this.text.deserialize(data.text);
@@ -42762,9 +42742,9 @@ class Frame2 extends BaseItem {
42762
42742
  } else if (op.method === "setFrameType") {
42763
42743
  this.applyFrameType(op.shapeType);
42764
42744
  } else if (op.method === "addChild") {
42765
- this.applyAddChild(op.childId);
42745
+ this.applyAddChildren(op.childId);
42766
42746
  } else if (op.method === "removeChild") {
42767
- this.applyRemoveChild(op.childId);
42747
+ this.applyRemoveChildren(op.childId);
42768
42748
  }
42769
42749
  break;
42770
42750
  case "RichText":
@@ -42840,10 +42820,10 @@ class Frame2 extends BaseItem {
42840
42820
  const child = this.board?.items.getById(childId);
42841
42821
  if (child) {
42842
42822
  if (this.handleNesting(child)) {
42843
- this.applyAddChild([child.getId()]);
42823
+ this.applyAddChildren([child.getId()]);
42844
42824
  child.parent = this.getId();
42845
42825
  } else {
42846
- this.applyRemoveChild([child.getId()]);
42826
+ this.applyRemoveChildren([child.getId()]);
42847
42827
  child.parent = "Board";
42848
42828
  }
42849
42829
  }
@@ -42852,7 +42832,7 @@ class Frame2 extends BaseItem {
42852
42832
  this.board.items.getEnclosedOrCrossed(currMbr.left, currMbr.top, currMbr.right, currMbr.bottom).forEach((item) => {
42853
42833
  if (item.parent === "Board") {
42854
42834
  if (this.handleNesting(item)) {
42855
- this.applyAddChild([item.getId()]);
42835
+ this.applyAddChildren([item.getId()]);
42856
42836
  item.parent = this.getId();
42857
42837
  }
42858
42838
  }
@@ -46269,7 +46249,7 @@ class AddFrame extends BoardTool {
46269
46249
  child.parent = this.frame.getId();
46270
46250
  return child.getId();
46271
46251
  });
46272
- this.frame.applyAddChild(childrenIds);
46252
+ this.frame.applyAddChildren(childrenIds);
46273
46253
  this.frame.subject.publish(this.frame);
46274
46254
  }
46275
46255
  applyCanChangeRatio(canChangeRatio) {
@@ -55940,6 +55920,7 @@ class Board {
55940
55920
  const data = Array.from(items.children).map((el) => this.parseHTML(el));
55941
55921
  for (const parsedData of data) {
55942
55922
  if ("childrenMap" in parsedData) {
55923
+ const addedFrame = this.add(this.createItem(this.getNewItemId(), parsedData.data));
55943
55924
  const addedChildren = Object.values(parsedData.childrenMap).map((childData) => {
55944
55925
  const created = this.createItem(this.getNewItemId(), childData);
55945
55926
  const added = this.add(created);
@@ -55952,8 +55933,8 @@ class Board {
55952
55933
  }
55953
55934
  return added;
55954
55935
  });
55936
+ addedFrame.addChildItems(addedChildren);
55955
55937
  parsedData.data.children = addedChildren.map((item) => item.getId());
55956
- const addedFrame = this.add(this.createItem(this.getNewItemId(), parsedData.data));
55957
55938
  idsMap[parsedData.data.id] = addedFrame.getId();
55958
55939
  } else {
55959
55940
  const added = this.add(this.createItem(this.getNewItemId(), parsedData));
@@ -56019,7 +56000,7 @@ class Board {
56019
56000
  }
56020
56001
  for (const key in createdFrames) {
56021
56002
  const { item, itemData } = createdFrames[key];
56022
- item.applyAddChild(itemData.children);
56003
+ item.applyAddChildren(itemData.children);
56023
56004
  }
56024
56005
  }
56025
56006
  deserialize(snapshot) {
@@ -56055,7 +56036,7 @@ class Board {
56055
56036
  }
56056
56037
  for (const key in createdFrames) {
56057
56038
  const { item, itemData } = createdFrames[key];
56058
- item.applyAddChild(itemData.children);
56039
+ item.applyAddChildren(itemData.children);
56059
56040
  }
56060
56041
  this.events?.log.deserialize(events);
56061
56042
  }
@@ -44,8 +44,6 @@ export declare class Frame extends BaseItem {
44
44
  * Child cant be itself,
45
45
  * frame cant be child
46
46
  */
47
- applyAddChild(childId: string[] | string, noWarn?: boolean): void;
48
- private applyRemoveChild;
49
47
  getLinkTo(): string | undefined;
50
48
  /**
51
49
  * Returns:
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "microboard-temp",
3
- "version": "0.4.55",
3
+ "version": "0.4.57",
4
4
  "description": "A flexible interactive whiteboard library",
5
5
  "main": "dist/cjs/index.js",
6
6
  "module": "dist/esm/index.js",