microboard-temp 0.11.2 → 0.11.3

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.
@@ -17752,9 +17752,15 @@ class TransformationCommand {
17752
17752
  transformation;
17753
17753
  operation;
17754
17754
  reverse;
17755
- constructor(transformation, operation) {
17755
+ itemsMap = new Map;
17756
+ constructor(transformation, operation, items) {
17756
17757
  this.transformation = transformation;
17757
17758
  this.operation = operation;
17759
+ if (items) {
17760
+ for (const item of items) {
17761
+ this.itemsMap.set(item.transformation, item);
17762
+ }
17763
+ }
17758
17764
  this.reverse = this.getReverse();
17759
17765
  }
17760
17766
  merge(op) {
@@ -17764,12 +17770,22 @@ class TransformationCommand {
17764
17770
  }
17765
17771
  apply() {
17766
17772
  for (const transformation of this.transformation) {
17767
- transformation.apply(this.operation);
17773
+ const item = this.itemsMap.get(transformation);
17774
+ if (item) {
17775
+ item.apply(this.operation);
17776
+ } else {
17777
+ transformation.apply(this.operation);
17778
+ }
17768
17779
  }
17769
17780
  }
17770
17781
  revert() {
17771
- this.reverse.forEach(({ item, operation }) => {
17772
- item.apply(operation);
17782
+ this.reverse.forEach(({ item: transformation, operation }) => {
17783
+ const item = this.itemsMap.get(transformation);
17784
+ if (item) {
17785
+ item.apply(operation);
17786
+ } else {
17787
+ transformation.apply(operation);
17788
+ }
17773
17789
  });
17774
17790
  }
17775
17791
  getReverse() {
@@ -19754,7 +19770,7 @@ function createRichTextCommand(items, operation, board) {
19754
19770
  }
19755
19771
  }
19756
19772
  function createTransformationCommand(items, operation) {
19757
- return new TransformationCommand(items.map((item) => item.transformation), operation);
19773
+ return new TransformationCommand(items.map((item) => item.transformation), operation, items);
19758
19774
  }
19759
19775
  function createLinkToCommand(items, operation) {
19760
19776
  return new LinkToCommand(items.map((item) => item.linkTo), operation);
package/dist/cjs/index.js CHANGED
@@ -17752,9 +17752,15 @@ class TransformationCommand {
17752
17752
  transformation;
17753
17753
  operation;
17754
17754
  reverse;
17755
- constructor(transformation, operation) {
17755
+ itemsMap = new Map;
17756
+ constructor(transformation, operation, items) {
17756
17757
  this.transformation = transformation;
17757
17758
  this.operation = operation;
17759
+ if (items) {
17760
+ for (const item of items) {
17761
+ this.itemsMap.set(item.transformation, item);
17762
+ }
17763
+ }
17758
17764
  this.reverse = this.getReverse();
17759
17765
  }
17760
17766
  merge(op) {
@@ -17764,12 +17770,22 @@ class TransformationCommand {
17764
17770
  }
17765
17771
  apply() {
17766
17772
  for (const transformation of this.transformation) {
17767
- transformation.apply(this.operation);
17773
+ const item = this.itemsMap.get(transformation);
17774
+ if (item) {
17775
+ item.apply(this.operation);
17776
+ } else {
17777
+ transformation.apply(this.operation);
17778
+ }
17768
17779
  }
17769
17780
  }
17770
17781
  revert() {
17771
- this.reverse.forEach(({ item, operation }) => {
17772
- item.apply(operation);
17782
+ this.reverse.forEach(({ item: transformation, operation }) => {
17783
+ const item = this.itemsMap.get(transformation);
17784
+ if (item) {
17785
+ item.apply(operation);
17786
+ } else {
17787
+ transformation.apply(operation);
17788
+ }
17773
17789
  });
17774
17790
  }
17775
17791
  getReverse() {
@@ -19754,7 +19770,7 @@ function createRichTextCommand(items, operation, board) {
19754
19770
  }
19755
19771
  }
19756
19772
  function createTransformationCommand(items, operation) {
19757
- return new TransformationCommand(items.map((item) => item.transformation), operation);
19773
+ return new TransformationCommand(items.map((item) => item.transformation), operation, items);
19758
19774
  }
19759
19775
  function createLinkToCommand(items, operation) {
19760
19776
  return new LinkToCommand(items.map((item) => item.linkTo), operation);
package/dist/cjs/node.js CHANGED
@@ -20292,9 +20292,15 @@ class TransformationCommand {
20292
20292
  transformation;
20293
20293
  operation;
20294
20294
  reverse;
20295
- constructor(transformation, operation) {
20295
+ itemsMap = new Map;
20296
+ constructor(transformation, operation, items) {
20296
20297
  this.transformation = transformation;
20297
20298
  this.operation = operation;
20299
+ if (items) {
20300
+ for (const item of items) {
20301
+ this.itemsMap.set(item.transformation, item);
20302
+ }
20303
+ }
20298
20304
  this.reverse = this.getReverse();
20299
20305
  }
20300
20306
  merge(op) {
@@ -20304,12 +20310,22 @@ class TransformationCommand {
20304
20310
  }
20305
20311
  apply() {
20306
20312
  for (const transformation of this.transformation) {
20307
- transformation.apply(this.operation);
20313
+ const item = this.itemsMap.get(transformation);
20314
+ if (item) {
20315
+ item.apply(this.operation);
20316
+ } else {
20317
+ transformation.apply(this.operation);
20318
+ }
20308
20319
  }
20309
20320
  }
20310
20321
  revert() {
20311
- this.reverse.forEach(({ item, operation }) => {
20312
- item.apply(operation);
20322
+ this.reverse.forEach(({ item: transformation, operation }) => {
20323
+ const item = this.itemsMap.get(transformation);
20324
+ if (item) {
20325
+ item.apply(operation);
20326
+ } else {
20327
+ transformation.apply(operation);
20328
+ }
20313
20329
  });
20314
20330
  }
20315
20331
  getReverse() {
@@ -22293,7 +22309,7 @@ function createRichTextCommand(items, operation, board) {
22293
22309
  }
22294
22310
  }
22295
22311
  function createTransformationCommand(items, operation) {
22296
- return new TransformationCommand(items.map((item) => item.transformation), operation);
22312
+ return new TransformationCommand(items.map((item) => item.transformation), operation, items);
22297
22313
  }
22298
22314
  function createLinkToCommand(items, operation) {
22299
22315
  return new LinkToCommand(items.map((item) => item.linkTo), operation);
@@ -17581,9 +17581,15 @@ class TransformationCommand {
17581
17581
  transformation;
17582
17582
  operation;
17583
17583
  reverse;
17584
- constructor(transformation, operation) {
17584
+ itemsMap = new Map;
17585
+ constructor(transformation, operation, items) {
17585
17586
  this.transformation = transformation;
17586
17587
  this.operation = operation;
17588
+ if (items) {
17589
+ for (const item of items) {
17590
+ this.itemsMap.set(item.transformation, item);
17591
+ }
17592
+ }
17587
17593
  this.reverse = this.getReverse();
17588
17594
  }
17589
17595
  merge(op) {
@@ -17593,12 +17599,22 @@ class TransformationCommand {
17593
17599
  }
17594
17600
  apply() {
17595
17601
  for (const transformation of this.transformation) {
17596
- transformation.apply(this.operation);
17602
+ const item = this.itemsMap.get(transformation);
17603
+ if (item) {
17604
+ item.apply(this.operation);
17605
+ } else {
17606
+ transformation.apply(this.operation);
17607
+ }
17597
17608
  }
17598
17609
  }
17599
17610
  revert() {
17600
- this.reverse.forEach(({ item, operation }) => {
17601
- item.apply(operation);
17611
+ this.reverse.forEach(({ item: transformation, operation }) => {
17612
+ const item = this.itemsMap.get(transformation);
17613
+ if (item) {
17614
+ item.apply(operation);
17615
+ } else {
17616
+ transformation.apply(operation);
17617
+ }
17602
17618
  });
17603
17619
  }
17604
17620
  getReverse() {
@@ -19583,7 +19599,7 @@ function createRichTextCommand(items, operation, board) {
19583
19599
  }
19584
19600
  }
19585
19601
  function createTransformationCommand(items, operation) {
19586
- return new TransformationCommand(items.map((item) => item.transformation), operation);
19602
+ return new TransformationCommand(items.map((item) => item.transformation), operation, items);
19587
19603
  }
19588
19604
  function createLinkToCommand(items, operation) {
19589
19605
  return new LinkToCommand(items.map((item) => item.linkTo), operation);
package/dist/esm/index.js CHANGED
@@ -17574,9 +17574,15 @@ class TransformationCommand {
17574
17574
  transformation;
17575
17575
  operation;
17576
17576
  reverse;
17577
- constructor(transformation, operation) {
17577
+ itemsMap = new Map;
17578
+ constructor(transformation, operation, items) {
17578
17579
  this.transformation = transformation;
17579
17580
  this.operation = operation;
17581
+ if (items) {
17582
+ for (const item of items) {
17583
+ this.itemsMap.set(item.transformation, item);
17584
+ }
17585
+ }
17580
17586
  this.reverse = this.getReverse();
17581
17587
  }
17582
17588
  merge(op) {
@@ -17586,12 +17592,22 @@ class TransformationCommand {
17586
17592
  }
17587
17593
  apply() {
17588
17594
  for (const transformation of this.transformation) {
17589
- transformation.apply(this.operation);
17595
+ const item = this.itemsMap.get(transformation);
17596
+ if (item) {
17597
+ item.apply(this.operation);
17598
+ } else {
17599
+ transformation.apply(this.operation);
17600
+ }
17590
17601
  }
17591
17602
  }
17592
17603
  revert() {
17593
- this.reverse.forEach(({ item, operation }) => {
17594
- item.apply(operation);
17604
+ this.reverse.forEach(({ item: transformation, operation }) => {
17605
+ const item = this.itemsMap.get(transformation);
17606
+ if (item) {
17607
+ item.apply(operation);
17608
+ } else {
17609
+ transformation.apply(operation);
17610
+ }
17595
17611
  });
17596
17612
  }
17597
17613
  getReverse() {
@@ -19576,7 +19592,7 @@ function createRichTextCommand(items, operation, board) {
19576
19592
  }
19577
19593
  }
19578
19594
  function createTransformationCommand(items, operation) {
19579
- return new TransformationCommand(items.map((item) => item.transformation), operation);
19595
+ return new TransformationCommand(items.map((item) => item.transformation), operation, items);
19580
19596
  }
19581
19597
  function createLinkToCommand(items, operation) {
19582
19598
  return new LinkToCommand(items.map((item) => item.linkTo), operation);
package/dist/esm/node.js CHANGED
@@ -20109,9 +20109,15 @@ class TransformationCommand {
20109
20109
  transformation;
20110
20110
  operation;
20111
20111
  reverse;
20112
- constructor(transformation, operation) {
20112
+ itemsMap = new Map;
20113
+ constructor(transformation, operation, items) {
20113
20114
  this.transformation = transformation;
20114
20115
  this.operation = operation;
20116
+ if (items) {
20117
+ for (const item of items) {
20118
+ this.itemsMap.set(item.transformation, item);
20119
+ }
20120
+ }
20115
20121
  this.reverse = this.getReverse();
20116
20122
  }
20117
20123
  merge(op) {
@@ -20121,12 +20127,22 @@ class TransformationCommand {
20121
20127
  }
20122
20128
  apply() {
20123
20129
  for (const transformation of this.transformation) {
20124
- transformation.apply(this.operation);
20130
+ const item = this.itemsMap.get(transformation);
20131
+ if (item) {
20132
+ item.apply(this.operation);
20133
+ } else {
20134
+ transformation.apply(this.operation);
20135
+ }
20125
20136
  }
20126
20137
  }
20127
20138
  revert() {
20128
- this.reverse.forEach(({ item, operation }) => {
20129
- item.apply(operation);
20139
+ this.reverse.forEach(({ item: transformation, operation }) => {
20140
+ const item = this.itemsMap.get(transformation);
20141
+ if (item) {
20142
+ item.apply(operation);
20143
+ } else {
20144
+ transformation.apply(operation);
20145
+ }
20130
20146
  });
20131
20147
  }
20132
20148
  getReverse() {
@@ -22110,7 +22126,7 @@ function createRichTextCommand(items, operation, board) {
22110
22126
  }
22111
22127
  }
22112
22128
  function createTransformationCommand(items, operation) {
22113
- return new TransformationCommand(items.map((item) => item.transformation), operation);
22129
+ return new TransformationCommand(items.map((item) => item.transformation), operation, items);
22114
22130
  }
22115
22131
  function createLinkToCommand(items, operation) {
22116
22132
  return new LinkToCommand(items.map((item) => item.linkTo), operation);
@@ -1,6 +1,11 @@
1
1
  import { Transformation } from "./Transformation";
2
2
  import { TransformationOperation } from "./TransformationOperations";
3
- import { Command } from "../../Events";
3
+ import { Command, Operation } from "../../Events";
4
+ /** Minimal interface to avoid circular import with BaseItem/Item */
5
+ interface TransformableItem {
6
+ apply(op: Operation): void;
7
+ transformation: Transformation;
8
+ }
4
9
  export declare class TransformationCommand implements Command {
5
10
  private transformation;
6
11
  private operation;
@@ -8,7 +13,9 @@ export declare class TransformationCommand implements Command {
8
13
  item: Transformation;
9
14
  operation: TransformationOperation;
10
15
  }[];
11
- constructor(transformation: Transformation[], operation: TransformationOperation);
16
+ /** Map from Transformation → Item, populated when items are passed to the constructor. */
17
+ private itemsMap;
18
+ constructor(transformation: Transformation[], operation: TransformationOperation, items?: TransformableItem[]);
12
19
  merge(op: TransformationOperation): this;
13
20
  apply(): void;
14
21
  revert(): void;
@@ -17,3 +24,4 @@ export declare class TransformationCommand implements Command {
17
24
  operation: TransformationOperation;
18
25
  }[];
19
26
  }
27
+ export {};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "microboard-temp",
3
- "version": "0.11.2",
3
+ "version": "0.11.3",
4
4
  "description": "A flexible interactive whiteboard library",
5
5
  "main": "dist/cjs/index.js",
6
6
  "module": "dist/esm/index.js",