microboard-temp 0.4.34 → 0.4.35

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.
@@ -19499,6 +19499,8 @@ class BaseItem extends Mbr {
19499
19499
  transformation;
19500
19500
  linkTo;
19501
19501
  parent = "Board";
19502
+ children = null;
19503
+ canBeNested = true;
19502
19504
  transformationRenderBlock = undefined;
19503
19505
  board;
19504
19506
  id;
@@ -19530,6 +19532,87 @@ class BaseItem extends Mbr {
19530
19532
  this.getRichText()?.setId(id);
19531
19533
  return this;
19532
19534
  }
19535
+ addChildItems(children) {
19536
+ if (!this.children) {
19537
+ return;
19538
+ }
19539
+ const childrenIds = children.map((child) => {
19540
+ child.parent = this.getId();
19541
+ return child.getId();
19542
+ });
19543
+ this.updateChildren([...this.children, ...childrenIds]);
19544
+ }
19545
+ removeChildItems(children) {
19546
+ if (!this.children) {
19547
+ return;
19548
+ }
19549
+ const newChildren = Array.isArray(children) ? children : [children];
19550
+ const childrenIds = newChildren.map((child) => {
19551
+ child.parent = "Board";
19552
+ return child.getId();
19553
+ });
19554
+ this.updateChildren(this.children.filter((child) => !childrenIds.includes(child)));
19555
+ }
19556
+ emitNesting(children) {
19557
+ const itemsToAdd = [];
19558
+ const itemsToRemove = [];
19559
+ children.forEach((child) => {
19560
+ if (this.handleNesting(child)) {
19561
+ itemsToAdd.push(child);
19562
+ } else {
19563
+ itemsToRemove.push(child);
19564
+ }
19565
+ });
19566
+ this.addChildItems(itemsToAdd);
19567
+ this.removeChildItems(itemsToRemove);
19568
+ }
19569
+ updateChildren(children) {
19570
+ this.emit({
19571
+ class: this.itemType,
19572
+ method: "updateChildren",
19573
+ item: [this.getId()],
19574
+ newData: { children },
19575
+ prevData: { children: this.children }
19576
+ });
19577
+ }
19578
+ handleNesting(item, options) {
19579
+ const isItem = "itemType" in item;
19580
+ const itemMbr = isItem ? item.getMbr() : item;
19581
+ if (item instanceof BaseItem && !item.canBeNested) {
19582
+ return false;
19583
+ }
19584
+ if (options?.cancelIfChild && isItem && item.parent !== "Board") {
19585
+ return false;
19586
+ }
19587
+ const mbr = this.getMbr().copy();
19588
+ if (item.isEnclosedOrCrossedBy(mbr)) {
19589
+ if (mbr.isInside(itemMbr.getCenter())) {
19590
+ if (!options || !options.onlyForOut) {
19591
+ return true;
19592
+ }
19593
+ }
19594
+ }
19595
+ return false;
19596
+ }
19597
+ applyUpdateChildren(children) {
19598
+ if (!this.children) {
19599
+ return;
19600
+ }
19601
+ children.forEach((child) => {
19602
+ if (this.parent !== child && this.getId() !== child) {
19603
+ const foundItem = this.board.items.getById(child);
19604
+ if (!this.children.includes(child) && foundItem) {
19605
+ foundItem.parent = this.getId();
19606
+ }
19607
+ }
19608
+ });
19609
+ this.children = children;
19610
+ this.updateMbr();
19611
+ this.subject.publish(this);
19612
+ }
19613
+ updateMbr() {
19614
+ return;
19615
+ }
19533
19616
  getLinkTo() {
19534
19617
  return this.linkTo.link;
19535
19618
  }
@@ -19579,6 +19662,12 @@ class BaseItem extends Mbr {
19579
19662
  case "LinkTo":
19580
19663
  this.linkTo.apply(op);
19581
19664
  break;
19665
+ case this.itemType:
19666
+ op = op;
19667
+ switch (op.method) {
19668
+ case "updateChildren":
19669
+ this.applyUpdateChildren(op.newData.children);
19670
+ }
19582
19671
  }
19583
19672
  }
19584
19673
  addOnRemoveCallback(cb) {
@@ -38202,6 +38291,7 @@ class Frame extends BaseItem {
38202
38291
  linkTo;
38203
38292
  text;
38204
38293
  canChangeRatio = true;
38294
+ canBeNested = false;
38205
38295
  newShape = null;
38206
38296
  transformationRenderBlock = undefined;
38207
38297
  constructor(board, getItemById, id = "", name = "", shapeType = defaultFrameData.shapeType, backgroundColor = defaultFrameData.backgroundColor, backgroundOpacity = defaultFrameData.backgroundOpacity, borderColor = defaultFrameData.borderColor, borderOpacity = defaultFrameData.borderOpacity, borderStyle = defaultFrameData.borderStyle, borderWidth = defaultFrameData.borderWidth) {
@@ -38240,42 +38330,6 @@ class Frame extends BaseItem {
38240
38330
  this.board = board;
38241
38331
  return this;
38242
38332
  }
38243
- emitAddChild(children) {
38244
- const childrenIds = children.map((child) => {
38245
- child.parent = this.getId();
38246
- return child.getId();
38247
- });
38248
- this.addChild(childrenIds);
38249
- }
38250
- emitRemoveChild(children) {
38251
- const newChildren = Array.isArray(children) ? children : [children];
38252
- const childrenIds = newChildren.map((child) => {
38253
- child.parent = "Board";
38254
- return child.getId();
38255
- });
38256
- this.removeChild(childrenIds);
38257
- }
38258
- emitNesting(children) {
38259
- const itemsToAdd = [];
38260
- const itemsToRemove = [];
38261
- children.forEach((child) => {
38262
- if (this.handleNesting(child)) {
38263
- itemsToAdd.push(child);
38264
- } else {
38265
- itemsToRemove.push(child);
38266
- }
38267
- });
38268
- this.emitAddChild(itemsToAdd);
38269
- this.emitRemoveChild(itemsToRemove);
38270
- }
38271
- addChild(childId) {
38272
- this.emit({
38273
- class: "Frame",
38274
- method: "addChild",
38275
- item: [this.getId()],
38276
- childId
38277
- });
38278
- }
38279
38333
  applyAddChild(childId, noWarn = false) {
38280
38334
  const children = Array.isArray(childId) ? childId : [childId];
38281
38335
  children.forEach((child) => {
@@ -38296,36 +38350,9 @@ class Frame extends BaseItem {
38296
38350
  this.children = this.children.filter((currChild) => !childId.includes(currChild));
38297
38351
  this.subject.publish(this);
38298
38352
  }
38299
- removeChild(childId) {
38300
- this.emit({
38301
- class: "Frame",
38302
- method: "removeChild",
38303
- item: [this.getId()],
38304
- childId
38305
- });
38306
- }
38307
38353
  getLinkTo() {
38308
38354
  return this.linkTo.link;
38309
38355
  }
38310
- handleNesting(item, options) {
38311
- const isItem = "itemType" in item;
38312
- const itemMbr = isItem ? item.getMbr() : item;
38313
- if (item instanceof Frame) {
38314
- return false;
38315
- }
38316
- if (options?.cancelIfChild && isItem && item.parent !== "Board") {
38317
- return false;
38318
- }
38319
- const frameMbr = this.getMbr().copy();
38320
- if (item.isEnclosedOrCrossedBy(frameMbr)) {
38321
- if (frameMbr.isInside(itemMbr.getCenter())) {
38322
- if (!options || !options.onlyForOut) {
38323
- return true;
38324
- }
38325
- }
38326
- }
38327
- return false;
38328
- }
38329
38356
  initPath() {
38330
38357
  this.path = Frames[this.shapeType].path.copy();
38331
38358
  this.textContainer = Frames[this.shapeType].textBounds.copy();
@@ -50279,7 +50306,7 @@ class BoardSelection {
50279
50306
  if (isParentFrame && isRemoveChildFromFrame) {
50280
50307
  parentFrame.emitRemoveChild([val.item]);
50281
50308
  }
50282
- val.nested.emitAddChild([val.item]);
50309
+ val.nested.addChildItems([val.item]);
50283
50310
  } else if (val.item.parent !== "Board") {
50284
50311
  if (isParentFrame) {
50285
50312
  parentFrame.emitRemoveChild([val.item]);
@@ -51969,7 +51996,7 @@ class SpatialIndex {
51969
51996
  remove(item) {
51970
51997
  if (item instanceof Frame) {
51971
51998
  const newItems = item.getChildrenIds().map((childId) => this.getById(childId)).filter((child) => child !== undefined);
51972
- item.emitRemoveChild(newItems);
51999
+ item.removeChildItems(newItems);
51973
52000
  }
51974
52001
  if (item.parent !== "Board") {
51975
52002
  const parentFrame = this.items.getById(item.parent);
@@ -53048,7 +53075,7 @@ class Board {
53048
53075
  }
53049
53076
  });
53050
53077
  framesMap.forEach((items2, frame) => {
53051
- frame.emitAddChild(items2);
53078
+ frame.addChildItems(items2);
53052
53079
  });
53053
53080
  }
53054
53081
  createItem(id, data) {
package/dist/esm/index.js CHANGED
@@ -19492,6 +19492,8 @@ class BaseItem extends Mbr {
19492
19492
  transformation;
19493
19493
  linkTo;
19494
19494
  parent = "Board";
19495
+ children = null;
19496
+ canBeNested = true;
19495
19497
  transformationRenderBlock = undefined;
19496
19498
  board;
19497
19499
  id;
@@ -19523,6 +19525,87 @@ class BaseItem extends Mbr {
19523
19525
  this.getRichText()?.setId(id);
19524
19526
  return this;
19525
19527
  }
19528
+ addChildItems(children) {
19529
+ if (!this.children) {
19530
+ return;
19531
+ }
19532
+ const childrenIds = children.map((child) => {
19533
+ child.parent = this.getId();
19534
+ return child.getId();
19535
+ });
19536
+ this.updateChildren([...this.children, ...childrenIds]);
19537
+ }
19538
+ removeChildItems(children) {
19539
+ if (!this.children) {
19540
+ return;
19541
+ }
19542
+ const newChildren = Array.isArray(children) ? children : [children];
19543
+ const childrenIds = newChildren.map((child) => {
19544
+ child.parent = "Board";
19545
+ return child.getId();
19546
+ });
19547
+ this.updateChildren(this.children.filter((child) => !childrenIds.includes(child)));
19548
+ }
19549
+ emitNesting(children) {
19550
+ const itemsToAdd = [];
19551
+ const itemsToRemove = [];
19552
+ children.forEach((child) => {
19553
+ if (this.handleNesting(child)) {
19554
+ itemsToAdd.push(child);
19555
+ } else {
19556
+ itemsToRemove.push(child);
19557
+ }
19558
+ });
19559
+ this.addChildItems(itemsToAdd);
19560
+ this.removeChildItems(itemsToRemove);
19561
+ }
19562
+ updateChildren(children) {
19563
+ this.emit({
19564
+ class: this.itemType,
19565
+ method: "updateChildren",
19566
+ item: [this.getId()],
19567
+ newData: { children },
19568
+ prevData: { children: this.children }
19569
+ });
19570
+ }
19571
+ handleNesting(item, options) {
19572
+ const isItem = "itemType" in item;
19573
+ const itemMbr = isItem ? item.getMbr() : item;
19574
+ if (item instanceof BaseItem && !item.canBeNested) {
19575
+ return false;
19576
+ }
19577
+ if (options?.cancelIfChild && isItem && item.parent !== "Board") {
19578
+ return false;
19579
+ }
19580
+ const mbr = this.getMbr().copy();
19581
+ if (item.isEnclosedOrCrossedBy(mbr)) {
19582
+ if (mbr.isInside(itemMbr.getCenter())) {
19583
+ if (!options || !options.onlyForOut) {
19584
+ return true;
19585
+ }
19586
+ }
19587
+ }
19588
+ return false;
19589
+ }
19590
+ applyUpdateChildren(children) {
19591
+ if (!this.children) {
19592
+ return;
19593
+ }
19594
+ children.forEach((child) => {
19595
+ if (this.parent !== child && this.getId() !== child) {
19596
+ const foundItem = this.board.items.getById(child);
19597
+ if (!this.children.includes(child) && foundItem) {
19598
+ foundItem.parent = this.getId();
19599
+ }
19600
+ }
19601
+ });
19602
+ this.children = children;
19603
+ this.updateMbr();
19604
+ this.subject.publish(this);
19605
+ }
19606
+ updateMbr() {
19607
+ return;
19608
+ }
19526
19609
  getLinkTo() {
19527
19610
  return this.linkTo.link;
19528
19611
  }
@@ -19572,6 +19655,12 @@ class BaseItem extends Mbr {
19572
19655
  case "LinkTo":
19573
19656
  this.linkTo.apply(op);
19574
19657
  break;
19658
+ case this.itemType:
19659
+ op = op;
19660
+ switch (op.method) {
19661
+ case "updateChildren":
19662
+ this.applyUpdateChildren(op.newData.children);
19663
+ }
19575
19664
  }
19576
19665
  }
19577
19666
  addOnRemoveCallback(cb) {
@@ -38195,6 +38284,7 @@ class Frame extends BaseItem {
38195
38284
  linkTo;
38196
38285
  text;
38197
38286
  canChangeRatio = true;
38287
+ canBeNested = false;
38198
38288
  newShape = null;
38199
38289
  transformationRenderBlock = undefined;
38200
38290
  constructor(board, getItemById, id = "", name = "", shapeType = defaultFrameData.shapeType, backgroundColor = defaultFrameData.backgroundColor, backgroundOpacity = defaultFrameData.backgroundOpacity, borderColor = defaultFrameData.borderColor, borderOpacity = defaultFrameData.borderOpacity, borderStyle = defaultFrameData.borderStyle, borderWidth = defaultFrameData.borderWidth) {
@@ -38233,42 +38323,6 @@ class Frame extends BaseItem {
38233
38323
  this.board = board;
38234
38324
  return this;
38235
38325
  }
38236
- emitAddChild(children) {
38237
- const childrenIds = children.map((child) => {
38238
- child.parent = this.getId();
38239
- return child.getId();
38240
- });
38241
- this.addChild(childrenIds);
38242
- }
38243
- emitRemoveChild(children) {
38244
- const newChildren = Array.isArray(children) ? children : [children];
38245
- const childrenIds = newChildren.map((child) => {
38246
- child.parent = "Board";
38247
- return child.getId();
38248
- });
38249
- this.removeChild(childrenIds);
38250
- }
38251
- emitNesting(children) {
38252
- const itemsToAdd = [];
38253
- const itemsToRemove = [];
38254
- children.forEach((child) => {
38255
- if (this.handleNesting(child)) {
38256
- itemsToAdd.push(child);
38257
- } else {
38258
- itemsToRemove.push(child);
38259
- }
38260
- });
38261
- this.emitAddChild(itemsToAdd);
38262
- this.emitRemoveChild(itemsToRemove);
38263
- }
38264
- addChild(childId) {
38265
- this.emit({
38266
- class: "Frame",
38267
- method: "addChild",
38268
- item: [this.getId()],
38269
- childId
38270
- });
38271
- }
38272
38326
  applyAddChild(childId, noWarn = false) {
38273
38327
  const children = Array.isArray(childId) ? childId : [childId];
38274
38328
  children.forEach((child) => {
@@ -38289,36 +38343,9 @@ class Frame extends BaseItem {
38289
38343
  this.children = this.children.filter((currChild) => !childId.includes(currChild));
38290
38344
  this.subject.publish(this);
38291
38345
  }
38292
- removeChild(childId) {
38293
- this.emit({
38294
- class: "Frame",
38295
- method: "removeChild",
38296
- item: [this.getId()],
38297
- childId
38298
- });
38299
- }
38300
38346
  getLinkTo() {
38301
38347
  return this.linkTo.link;
38302
38348
  }
38303
- handleNesting(item, options) {
38304
- const isItem = "itemType" in item;
38305
- const itemMbr = isItem ? item.getMbr() : item;
38306
- if (item instanceof Frame) {
38307
- return false;
38308
- }
38309
- if (options?.cancelIfChild && isItem && item.parent !== "Board") {
38310
- return false;
38311
- }
38312
- const frameMbr = this.getMbr().copy();
38313
- if (item.isEnclosedOrCrossedBy(frameMbr)) {
38314
- if (frameMbr.isInside(itemMbr.getCenter())) {
38315
- if (!options || !options.onlyForOut) {
38316
- return true;
38317
- }
38318
- }
38319
- }
38320
- return false;
38321
- }
38322
38349
  initPath() {
38323
38350
  this.path = Frames[this.shapeType].path.copy();
38324
38351
  this.textContainer = Frames[this.shapeType].textBounds.copy();
@@ -50272,7 +50299,7 @@ class BoardSelection {
50272
50299
  if (isParentFrame && isRemoveChildFromFrame) {
50273
50300
  parentFrame.emitRemoveChild([val.item]);
50274
50301
  }
50275
- val.nested.emitAddChild([val.item]);
50302
+ val.nested.addChildItems([val.item]);
50276
50303
  } else if (val.item.parent !== "Board") {
50277
50304
  if (isParentFrame) {
50278
50305
  parentFrame.emitRemoveChild([val.item]);
@@ -51962,7 +51989,7 @@ class SpatialIndex {
51962
51989
  remove(item) {
51963
51990
  if (item instanceof Frame) {
51964
51991
  const newItems = item.getChildrenIds().map((childId) => this.getById(childId)).filter((child) => child !== undefined);
51965
- item.emitRemoveChild(newItems);
51992
+ item.removeChildItems(newItems);
51966
51993
  }
51967
51994
  if (item.parent !== "Board") {
51968
51995
  const parentFrame = this.items.getById(item.parent);
@@ -53041,7 +53068,7 @@ class Board {
53041
53068
  }
53042
53069
  });
53043
53070
  framesMap.forEach((items2, frame) => {
53044
- frame.emitAddChild(items2);
53071
+ frame.addChildItems(items2);
53045
53072
  });
53046
53073
  }
53047
53074
  createItem(id, data) {
package/dist/esm/node.js CHANGED
@@ -22026,6 +22026,8 @@ class BaseItem extends Mbr {
22026
22026
  transformation;
22027
22027
  linkTo;
22028
22028
  parent = "Board";
22029
+ children = null;
22030
+ canBeNested = true;
22029
22031
  transformationRenderBlock = undefined;
22030
22032
  board;
22031
22033
  id;
@@ -22057,6 +22059,87 @@ class BaseItem extends Mbr {
22057
22059
  this.getRichText()?.setId(id);
22058
22060
  return this;
22059
22061
  }
22062
+ addChildItems(children) {
22063
+ if (!this.children) {
22064
+ return;
22065
+ }
22066
+ const childrenIds = children.map((child) => {
22067
+ child.parent = this.getId();
22068
+ return child.getId();
22069
+ });
22070
+ this.updateChildren([...this.children, ...childrenIds]);
22071
+ }
22072
+ removeChildItems(children) {
22073
+ if (!this.children) {
22074
+ return;
22075
+ }
22076
+ const newChildren = Array.isArray(children) ? children : [children];
22077
+ const childrenIds = newChildren.map((child) => {
22078
+ child.parent = "Board";
22079
+ return child.getId();
22080
+ });
22081
+ this.updateChildren(this.children.filter((child) => !childrenIds.includes(child)));
22082
+ }
22083
+ emitNesting(children) {
22084
+ const itemsToAdd = [];
22085
+ const itemsToRemove = [];
22086
+ children.forEach((child) => {
22087
+ if (this.handleNesting(child)) {
22088
+ itemsToAdd.push(child);
22089
+ } else {
22090
+ itemsToRemove.push(child);
22091
+ }
22092
+ });
22093
+ this.addChildItems(itemsToAdd);
22094
+ this.removeChildItems(itemsToRemove);
22095
+ }
22096
+ updateChildren(children) {
22097
+ this.emit({
22098
+ class: this.itemType,
22099
+ method: "updateChildren",
22100
+ item: [this.getId()],
22101
+ newData: { children },
22102
+ prevData: { children: this.children }
22103
+ });
22104
+ }
22105
+ handleNesting(item, options) {
22106
+ const isItem = "itemType" in item;
22107
+ const itemMbr = isItem ? item.getMbr() : item;
22108
+ if (item instanceof BaseItem && !item.canBeNested) {
22109
+ return false;
22110
+ }
22111
+ if (options?.cancelIfChild && isItem && item.parent !== "Board") {
22112
+ return false;
22113
+ }
22114
+ const mbr = this.getMbr().copy();
22115
+ if (item.isEnclosedOrCrossedBy(mbr)) {
22116
+ if (mbr.isInside(itemMbr.getCenter())) {
22117
+ if (!options || !options.onlyForOut) {
22118
+ return true;
22119
+ }
22120
+ }
22121
+ }
22122
+ return false;
22123
+ }
22124
+ applyUpdateChildren(children) {
22125
+ if (!this.children) {
22126
+ return;
22127
+ }
22128
+ children.forEach((child) => {
22129
+ if (this.parent !== child && this.getId() !== child) {
22130
+ const foundItem = this.board.items.getById(child);
22131
+ if (!this.children.includes(child) && foundItem) {
22132
+ foundItem.parent = this.getId();
22133
+ }
22134
+ }
22135
+ });
22136
+ this.children = children;
22137
+ this.updateMbr();
22138
+ this.subject.publish(this);
22139
+ }
22140
+ updateMbr() {
22141
+ return;
22142
+ }
22060
22143
  getLinkTo() {
22061
22144
  return this.linkTo.link;
22062
22145
  }
@@ -22106,6 +22189,12 @@ class BaseItem extends Mbr {
22106
22189
  case "LinkTo":
22107
22190
  this.linkTo.apply(op);
22108
22191
  break;
22192
+ case this.itemType:
22193
+ op = op;
22194
+ switch (op.method) {
22195
+ case "updateChildren":
22196
+ this.applyUpdateChildren(op.newData.children);
22197
+ }
22109
22198
  }
22110
22199
  }
22111
22200
  addOnRemoveCallback(cb) {
@@ -40730,6 +40819,7 @@ class Frame extends BaseItem {
40730
40819
  linkTo;
40731
40820
  text;
40732
40821
  canChangeRatio = true;
40822
+ canBeNested = false;
40733
40823
  newShape = null;
40734
40824
  transformationRenderBlock = undefined;
40735
40825
  constructor(board, getItemById, id = "", name = "", shapeType = defaultFrameData.shapeType, backgroundColor = defaultFrameData.backgroundColor, backgroundOpacity = defaultFrameData.backgroundOpacity, borderColor = defaultFrameData.borderColor, borderOpacity = defaultFrameData.borderOpacity, borderStyle = defaultFrameData.borderStyle, borderWidth = defaultFrameData.borderWidth) {
@@ -40768,42 +40858,6 @@ class Frame extends BaseItem {
40768
40858
  this.board = board;
40769
40859
  return this;
40770
40860
  }
40771
- emitAddChild(children) {
40772
- const childrenIds = children.map((child) => {
40773
- child.parent = this.getId();
40774
- return child.getId();
40775
- });
40776
- this.addChild(childrenIds);
40777
- }
40778
- emitRemoveChild(children) {
40779
- const newChildren = Array.isArray(children) ? children : [children];
40780
- const childrenIds = newChildren.map((child) => {
40781
- child.parent = "Board";
40782
- return child.getId();
40783
- });
40784
- this.removeChild(childrenIds);
40785
- }
40786
- emitNesting(children) {
40787
- const itemsToAdd = [];
40788
- const itemsToRemove = [];
40789
- children.forEach((child) => {
40790
- if (this.handleNesting(child)) {
40791
- itemsToAdd.push(child);
40792
- } else {
40793
- itemsToRemove.push(child);
40794
- }
40795
- });
40796
- this.emitAddChild(itemsToAdd);
40797
- this.emitRemoveChild(itemsToRemove);
40798
- }
40799
- addChild(childId) {
40800
- this.emit({
40801
- class: "Frame",
40802
- method: "addChild",
40803
- item: [this.getId()],
40804
- childId
40805
- });
40806
- }
40807
40861
  applyAddChild(childId, noWarn = false) {
40808
40862
  const children = Array.isArray(childId) ? childId : [childId];
40809
40863
  children.forEach((child) => {
@@ -40824,36 +40878,9 @@ class Frame extends BaseItem {
40824
40878
  this.children = this.children.filter((currChild) => !childId.includes(currChild));
40825
40879
  this.subject.publish(this);
40826
40880
  }
40827
- removeChild(childId) {
40828
- this.emit({
40829
- class: "Frame",
40830
- method: "removeChild",
40831
- item: [this.getId()],
40832
- childId
40833
- });
40834
- }
40835
40881
  getLinkTo() {
40836
40882
  return this.linkTo.link;
40837
40883
  }
40838
- handleNesting(item, options) {
40839
- const isItem = "itemType" in item;
40840
- const itemMbr = isItem ? item.getMbr() : item;
40841
- if (item instanceof Frame) {
40842
- return false;
40843
- }
40844
- if (options?.cancelIfChild && isItem && item.parent !== "Board") {
40845
- return false;
40846
- }
40847
- const frameMbr = this.getMbr().copy();
40848
- if (item.isEnclosedOrCrossedBy(frameMbr)) {
40849
- if (frameMbr.isInside(itemMbr.getCenter())) {
40850
- if (!options || !options.onlyForOut) {
40851
- return true;
40852
- }
40853
- }
40854
- }
40855
- return false;
40856
- }
40857
40884
  initPath() {
40858
40885
  this.path = Frames[this.shapeType].path.copy();
40859
40886
  this.textContainer = Frames[this.shapeType].textBounds.copy();
@@ -52807,7 +52834,7 @@ class BoardSelection {
52807
52834
  if (isParentFrame && isRemoveChildFromFrame) {
52808
52835
  parentFrame.emitRemoveChild([val.item]);
52809
52836
  }
52810
- val.nested.emitAddChild([val.item]);
52837
+ val.nested.addChildItems([val.item]);
52811
52838
  } else if (val.item.parent !== "Board") {
52812
52839
  if (isParentFrame) {
52813
52840
  parentFrame.emitRemoveChild([val.item]);
@@ -54430,7 +54457,7 @@ class SpatialIndex {
54430
54457
  remove(item) {
54431
54458
  if (item instanceof Frame) {
54432
54459
  const newItems = item.getChildrenIds().map((childId) => this.getById(childId)).filter((child) => child !== undefined);
54433
- item.emitRemoveChild(newItems);
54460
+ item.removeChildItems(newItems);
54434
54461
  }
54435
54462
  if (item.parent !== "Board") {
54436
54463
  const parentFrame = this.items.getById(item.parent);
@@ -55509,7 +55536,7 @@ class Board {
55509
55536
  }
55510
55537
  });
55511
55538
  framesMap.forEach((items2, frame) => {
55512
- frame.emitAddChild(items2);
55539
+ frame.addChildItems(items2);
55513
55540
  });
55514
55541
  }
55515
55542
  createItem(id, data) {
@@ -23,6 +23,8 @@ export declare class BaseItem extends Mbr implements Geometry {
23
23
  readonly transformation: Transformation;
24
24
  readonly linkTo: LinkTo;
25
25
  parent: string;
26
+ private children;
27
+ canBeNested: boolean;
26
28
  transformationRenderBlock?: boolean;
27
29
  board: Board;
28
30
  id: string;
@@ -34,6 +36,16 @@ export declare class BaseItem extends Mbr implements Geometry {
34
36
  constructor(board: Board, id?: string, defaultItemData?: BaseItemData | undefined);
35
37
  getId(): string;
36
38
  setId(id: string): this;
39
+ addChildItems(children: BaseItem[]): void;
40
+ removeChildItems(children: BaseItem[] | BaseItem): void;
41
+ emitNesting(children: BaseItem[]): void;
42
+ private updateChildren;
43
+ handleNesting(item: BaseItem | Mbr, options?: {
44
+ onlyForOut?: boolean;
45
+ cancelIfChild?: boolean;
46
+ }): boolean;
47
+ applyUpdateChildren(children: string[]): void;
48
+ updateMbr(): void;
37
49
  getLinkTo(): string | undefined;
38
50
  getRichText(): RichText | null;
39
51
  deserialize(data: SerializedItemData): this;
@@ -0,0 +1,7 @@
1
+ import { BaseOperation } from "../../Events/EventsOperations";
2
+ export type BaseItemOperation = UpdateChildren;
3
+ export interface UpdateChildren extends BaseOperation<{
4
+ children: string[];
5
+ }> {
6
+ method: "updateChildren";
7
+ }