microboard-temp 0.4.79 → 0.4.81

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.
@@ -47923,21 +47923,11 @@ var defaultDeckData = {
47923
47923
  class Deck extends BaseItem {
47924
47924
  subject = new Subject;
47925
47925
  shouldUseCustomRender = false;
47926
- constructor(board, id = "", defaultData2, cards) {
47926
+ constructor(board, id = "") {
47927
47927
  super(board, id, defaultDeckData, true);
47928
47928
  this.index.getUnderPoint = () => [];
47929
47929
  this.index.getEnclosed = () => [];
47930
47930
  this.index.getEnclosedOrCrossed = () => [];
47931
- if (cards) {
47932
- this.transformation.apply({
47933
- class: "Transformation",
47934
- method: "translateTo",
47935
- item: [this.id],
47936
- x: cards[0].left,
47937
- y: cards[0].top
47938
- });
47939
- this.updateMbr();
47940
- }
47941
47931
  this.transformation.subject.subscribe(() => {
47942
47932
  this.updateMbr();
47943
47933
  this.subject.publish(this);
@@ -48025,8 +48015,8 @@ class Deck extends BaseItem {
48025
48015
  const j = Math.floor(Math.random() * (i + 1));
48026
48016
  [shuffled[i], shuffled[j]] = [shuffled[j], shuffled[i]];
48027
48017
  }
48028
- this.index.clear();
48029
- shuffled.forEach((card) => this.index.insert(card));
48018
+ this.removeChildItems(this.index.list());
48019
+ this.addChildItems(shuffled);
48030
48020
  }
48031
48021
  apply(op) {
48032
48022
  super.apply(op);
@@ -48034,11 +48024,12 @@ class Deck extends BaseItem {
48034
48024
  }
48035
48025
  updateMbr() {
48036
48026
  const { translateX, translateY } = this.transformation.matrix;
48037
- const indexMbr = this.index.getMbr();
48027
+ const items = this.index.list();
48028
+ const itemsMbr = items[0]?.getMbr().combine(items.slice(1).map((item) => item.getMbr()));
48038
48029
  this.left = translateX;
48039
48030
  this.top = translateY;
48040
- this.right = translateX + indexMbr.getWidth();
48041
- this.bottom = translateY + indexMbr.getHeight();
48031
+ this.right = translateX + (itemsMbr?.getWidth() || 0);
48032
+ this.bottom = translateY + (itemsMbr?.getHeight() || 0);
48042
48033
  }
48043
48034
  deserialize(data) {
48044
48035
  super.deserialize(data);
package/dist/cjs/index.js CHANGED
@@ -47923,21 +47923,11 @@ var defaultDeckData = {
47923
47923
  class Deck extends BaseItem {
47924
47924
  subject = new Subject;
47925
47925
  shouldUseCustomRender = false;
47926
- constructor(board, id = "", defaultData2, cards) {
47926
+ constructor(board, id = "") {
47927
47927
  super(board, id, defaultDeckData, true);
47928
47928
  this.index.getUnderPoint = () => [];
47929
47929
  this.index.getEnclosed = () => [];
47930
47930
  this.index.getEnclosedOrCrossed = () => [];
47931
- if (cards) {
47932
- this.transformation.apply({
47933
- class: "Transformation",
47934
- method: "translateTo",
47935
- item: [this.id],
47936
- x: cards[0].left,
47937
- y: cards[0].top
47938
- });
47939
- this.updateMbr();
47940
- }
47941
47931
  this.transformation.subject.subscribe(() => {
47942
47932
  this.updateMbr();
47943
47933
  this.subject.publish(this);
@@ -48025,8 +48015,8 @@ class Deck extends BaseItem {
48025
48015
  const j = Math.floor(Math.random() * (i + 1));
48026
48016
  [shuffled[i], shuffled[j]] = [shuffled[j], shuffled[i]];
48027
48017
  }
48028
- this.index.clear();
48029
- shuffled.forEach((card) => this.index.insert(card));
48018
+ this.removeChildItems(this.index.list());
48019
+ this.addChildItems(shuffled);
48030
48020
  }
48031
48021
  apply(op) {
48032
48022
  super.apply(op);
@@ -48034,11 +48024,12 @@ class Deck extends BaseItem {
48034
48024
  }
48035
48025
  updateMbr() {
48036
48026
  const { translateX, translateY } = this.transformation.matrix;
48037
- const indexMbr = this.index.getMbr();
48027
+ const items = this.index.list();
48028
+ const itemsMbr = items[0]?.getMbr().combine(items.slice(1).map((item) => item.getMbr()));
48038
48029
  this.left = translateX;
48039
48030
  this.top = translateY;
48040
- this.right = translateX + indexMbr.getWidth();
48041
- this.bottom = translateY + indexMbr.getHeight();
48031
+ this.right = translateX + (itemsMbr?.getWidth() || 0);
48032
+ this.bottom = translateY + (itemsMbr?.getHeight() || 0);
48042
48033
  }
48043
48034
  deserialize(data) {
48044
48035
  super.deserialize(data);
package/dist/cjs/node.js CHANGED
@@ -50396,21 +50396,11 @@ var defaultDeckData = {
50396
50396
  class Deck extends BaseItem {
50397
50397
  subject = new Subject;
50398
50398
  shouldUseCustomRender = false;
50399
- constructor(board, id = "", defaultData2, cards) {
50399
+ constructor(board, id = "") {
50400
50400
  super(board, id, defaultDeckData, true);
50401
50401
  this.index.getUnderPoint = () => [];
50402
50402
  this.index.getEnclosed = () => [];
50403
50403
  this.index.getEnclosedOrCrossed = () => [];
50404
- if (cards) {
50405
- this.transformation.apply({
50406
- class: "Transformation",
50407
- method: "translateTo",
50408
- item: [this.id],
50409
- x: cards[0].left,
50410
- y: cards[0].top
50411
- });
50412
- this.updateMbr();
50413
- }
50414
50404
  this.transformation.subject.subscribe(() => {
50415
50405
  this.updateMbr();
50416
50406
  this.subject.publish(this);
@@ -50498,8 +50488,8 @@ class Deck extends BaseItem {
50498
50488
  const j = Math.floor(Math.random() * (i + 1));
50499
50489
  [shuffled[i], shuffled[j]] = [shuffled[j], shuffled[i]];
50500
50490
  }
50501
- this.index.clear();
50502
- shuffled.forEach((card) => this.index.insert(card));
50491
+ this.removeChildItems(this.index.list());
50492
+ this.addChildItems(shuffled);
50503
50493
  }
50504
50494
  apply(op) {
50505
50495
  super.apply(op);
@@ -50507,11 +50497,12 @@ class Deck extends BaseItem {
50507
50497
  }
50508
50498
  updateMbr() {
50509
50499
  const { translateX, translateY } = this.transformation.matrix;
50510
- const indexMbr = this.index.getMbr();
50500
+ const items = this.index.list();
50501
+ const itemsMbr = items[0]?.getMbr().combine(items.slice(1).map((item) => item.getMbr()));
50511
50502
  this.left = translateX;
50512
50503
  this.top = translateY;
50513
- this.right = translateX + indexMbr.getWidth();
50514
- this.bottom = translateY + indexMbr.getHeight();
50504
+ this.right = translateX + (itemsMbr?.getWidth() || 0);
50505
+ this.bottom = translateY + (itemsMbr?.getHeight() || 0);
50515
50506
  }
50516
50507
  deserialize(data) {
50517
50508
  super.deserialize(data);
@@ -47772,21 +47772,11 @@ var defaultDeckData = {
47772
47772
  class Deck extends BaseItem {
47773
47773
  subject = new Subject;
47774
47774
  shouldUseCustomRender = false;
47775
- constructor(board, id = "", defaultData2, cards) {
47775
+ constructor(board, id = "") {
47776
47776
  super(board, id, defaultDeckData, true);
47777
47777
  this.index.getUnderPoint = () => [];
47778
47778
  this.index.getEnclosed = () => [];
47779
47779
  this.index.getEnclosedOrCrossed = () => [];
47780
- if (cards) {
47781
- this.transformation.apply({
47782
- class: "Transformation",
47783
- method: "translateTo",
47784
- item: [this.id],
47785
- x: cards[0].left,
47786
- y: cards[0].top
47787
- });
47788
- this.updateMbr();
47789
- }
47790
47780
  this.transformation.subject.subscribe(() => {
47791
47781
  this.updateMbr();
47792
47782
  this.subject.publish(this);
@@ -47874,8 +47864,8 @@ class Deck extends BaseItem {
47874
47864
  const j = Math.floor(Math.random() * (i + 1));
47875
47865
  [shuffled[i], shuffled[j]] = [shuffled[j], shuffled[i]];
47876
47866
  }
47877
- this.index.clear();
47878
- shuffled.forEach((card) => this.index.insert(card));
47867
+ this.removeChildItems(this.index.list());
47868
+ this.addChildItems(shuffled);
47879
47869
  }
47880
47870
  apply(op) {
47881
47871
  super.apply(op);
@@ -47883,11 +47873,12 @@ class Deck extends BaseItem {
47883
47873
  }
47884
47874
  updateMbr() {
47885
47875
  const { translateX, translateY } = this.transformation.matrix;
47886
- const indexMbr = this.index.getMbr();
47876
+ const items = this.index.list();
47877
+ const itemsMbr = items[0]?.getMbr().combine(items.slice(1).map((item) => item.getMbr()));
47887
47878
  this.left = translateX;
47888
47879
  this.top = translateY;
47889
- this.right = translateX + indexMbr.getWidth();
47890
- this.bottom = translateY + indexMbr.getHeight();
47880
+ this.right = translateX + (itemsMbr?.getWidth() || 0);
47881
+ this.bottom = translateY + (itemsMbr?.getHeight() || 0);
47891
47882
  }
47892
47883
  deserialize(data) {
47893
47884
  super.deserialize(data);
package/dist/esm/index.js CHANGED
@@ -47765,21 +47765,11 @@ var defaultDeckData = {
47765
47765
  class Deck extends BaseItem {
47766
47766
  subject = new Subject;
47767
47767
  shouldUseCustomRender = false;
47768
- constructor(board, id = "", defaultData2, cards) {
47768
+ constructor(board, id = "") {
47769
47769
  super(board, id, defaultDeckData, true);
47770
47770
  this.index.getUnderPoint = () => [];
47771
47771
  this.index.getEnclosed = () => [];
47772
47772
  this.index.getEnclosedOrCrossed = () => [];
47773
- if (cards) {
47774
- this.transformation.apply({
47775
- class: "Transformation",
47776
- method: "translateTo",
47777
- item: [this.id],
47778
- x: cards[0].left,
47779
- y: cards[0].top
47780
- });
47781
- this.updateMbr();
47782
- }
47783
47773
  this.transformation.subject.subscribe(() => {
47784
47774
  this.updateMbr();
47785
47775
  this.subject.publish(this);
@@ -47867,8 +47857,8 @@ class Deck extends BaseItem {
47867
47857
  const j = Math.floor(Math.random() * (i + 1));
47868
47858
  [shuffled[i], shuffled[j]] = [shuffled[j], shuffled[i]];
47869
47859
  }
47870
- this.index.clear();
47871
- shuffled.forEach((card) => this.index.insert(card));
47860
+ this.removeChildItems(this.index.list());
47861
+ this.addChildItems(shuffled);
47872
47862
  }
47873
47863
  apply(op) {
47874
47864
  super.apply(op);
@@ -47876,11 +47866,12 @@ class Deck extends BaseItem {
47876
47866
  }
47877
47867
  updateMbr() {
47878
47868
  const { translateX, translateY } = this.transformation.matrix;
47879
- const indexMbr = this.index.getMbr();
47869
+ const items = this.index.list();
47870
+ const itemsMbr = items[0]?.getMbr().combine(items.slice(1).map((item) => item.getMbr()));
47880
47871
  this.left = translateX;
47881
47872
  this.top = translateY;
47882
- this.right = translateX + indexMbr.getWidth();
47883
- this.bottom = translateY + indexMbr.getHeight();
47873
+ this.right = translateX + (itemsMbr?.getWidth() || 0);
47874
+ this.bottom = translateY + (itemsMbr?.getHeight() || 0);
47884
47875
  }
47885
47876
  deserialize(data) {
47886
47877
  super.deserialize(data);
package/dist/esm/node.js CHANGED
@@ -50233,21 +50233,11 @@ var defaultDeckData = {
50233
50233
  class Deck extends BaseItem {
50234
50234
  subject = new Subject;
50235
50235
  shouldUseCustomRender = false;
50236
- constructor(board, id = "", defaultData2, cards) {
50236
+ constructor(board, id = "") {
50237
50237
  super(board, id, defaultDeckData, true);
50238
50238
  this.index.getUnderPoint = () => [];
50239
50239
  this.index.getEnclosed = () => [];
50240
50240
  this.index.getEnclosedOrCrossed = () => [];
50241
- if (cards) {
50242
- this.transformation.apply({
50243
- class: "Transformation",
50244
- method: "translateTo",
50245
- item: [this.id],
50246
- x: cards[0].left,
50247
- y: cards[0].top
50248
- });
50249
- this.updateMbr();
50250
- }
50251
50241
  this.transformation.subject.subscribe(() => {
50252
50242
  this.updateMbr();
50253
50243
  this.subject.publish(this);
@@ -50335,8 +50325,8 @@ class Deck extends BaseItem {
50335
50325
  const j = Math.floor(Math.random() * (i + 1));
50336
50326
  [shuffled[i], shuffled[j]] = [shuffled[j], shuffled[i]];
50337
50327
  }
50338
- this.index.clear();
50339
- shuffled.forEach((card) => this.index.insert(card));
50328
+ this.removeChildItems(this.index.list());
50329
+ this.addChildItems(shuffled);
50340
50330
  }
50341
50331
  apply(op) {
50342
50332
  super.apply(op);
@@ -50344,11 +50334,12 @@ class Deck extends BaseItem {
50344
50334
  }
50345
50335
  updateMbr() {
50346
50336
  const { translateX, translateY } = this.transformation.matrix;
50347
- const indexMbr = this.index.getMbr();
50337
+ const items = this.index.list();
50338
+ const itemsMbr = items[0]?.getMbr().combine(items.slice(1).map((item) => item.getMbr()));
50348
50339
  this.left = translateX;
50349
50340
  this.top = translateY;
50350
- this.right = translateX + indexMbr.getWidth();
50351
- this.bottom = translateY + indexMbr.getHeight();
50341
+ this.right = translateX + (itemsMbr?.getWidth() || 0);
50342
+ this.bottom = translateY + (itemsMbr?.getHeight() || 0);
50352
50343
  }
50353
50344
  deserialize(data) {
50354
50345
  super.deserialize(data);
@@ -8,7 +8,7 @@ export declare const defaultDeckData: BaseItemData;
8
8
  export declare class Deck extends BaseItem {
9
9
  readonly subject: Subject<Deck>;
10
10
  shouldUseCustomRender: boolean;
11
- constructor(board: Board, id?: string, defaultData?: BaseItemData, cards?: Card[]);
11
+ constructor(board: Board, id?: string);
12
12
  applyAddChildren(childIds: string[]): void;
13
13
  applyRemoveChildren(childIds: string[]): void;
14
14
  getDeck(): Card[];
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "microboard-temp",
3
- "version": "0.4.79",
3
+ "version": "0.4.81",
4
4
  "description": "A flexible interactive whiteboard library",
5
5
  "main": "dist/cjs/index.js",
6
6
  "module": "dist/esm/index.js",