microboard-temp 0.5.0 → 0.5.1
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.
- package/dist/cjs/browser.js +36 -8
- package/dist/cjs/index.js +36 -8
- package/dist/cjs/node.js +36 -8
- package/dist/esm/browser.js +36 -8
- package/dist/esm/index.js +36 -8
- package/dist/esm/node.js +36 -8
- package/dist/types/Items/BaseItem/BaseItem.d.ts +1 -0
- package/dist/types/Items/Examples/CardGame/Card/Card.d.ts +1 -1
- package/package.json +1 -1
package/dist/cjs/browser.js
CHANGED
|
@@ -21669,6 +21669,14 @@ class BaseItem extends Mbr {
|
|
|
21669
21669
|
this.apply(operation);
|
|
21670
21670
|
}
|
|
21671
21671
|
}
|
|
21672
|
+
emitForManyItems(operation) {
|
|
21673
|
+
if (!this.board.events) {
|
|
21674
|
+
return;
|
|
21675
|
+
}
|
|
21676
|
+
const command = createCommand(this.board, operation);
|
|
21677
|
+
command.apply();
|
|
21678
|
+
this.board.events.emit(operation, command);
|
|
21679
|
+
}
|
|
21672
21680
|
apply(op) {
|
|
21673
21681
|
op = op;
|
|
21674
21682
|
switch (op.class) {
|
|
@@ -47928,14 +47936,34 @@ class Card extends BaseItem {
|
|
|
47928
47936
|
this.subject.publish(this);
|
|
47929
47937
|
return this;
|
|
47930
47938
|
}
|
|
47931
|
-
toggleIsOpen() {
|
|
47932
|
-
|
|
47933
|
-
|
|
47934
|
-
|
|
47935
|
-
|
|
47936
|
-
|
|
47937
|
-
|
|
47938
|
-
|
|
47939
|
+
toggleIsOpen(cards) {
|
|
47940
|
+
const openedCardIds = [];
|
|
47941
|
+
const closedCardIds = [];
|
|
47942
|
+
for (const card of cards) {
|
|
47943
|
+
if (card.isOpen) {
|
|
47944
|
+
openedCardIds.push(card.getId());
|
|
47945
|
+
} else {
|
|
47946
|
+
closedCardIds.push(card.getId());
|
|
47947
|
+
}
|
|
47948
|
+
}
|
|
47949
|
+
if (openedCardIds.length) {
|
|
47950
|
+
this.emitForManyItems({
|
|
47951
|
+
class: "Card",
|
|
47952
|
+
method: "setIsOpen",
|
|
47953
|
+
item: [this.getId()],
|
|
47954
|
+
newData: { isOpen: false },
|
|
47955
|
+
prevData: { isOpen: true }
|
|
47956
|
+
});
|
|
47957
|
+
}
|
|
47958
|
+
if (closedCardIds.length) {
|
|
47959
|
+
this.emitForManyItems({
|
|
47960
|
+
class: "Card",
|
|
47961
|
+
method: "setIsOpen",
|
|
47962
|
+
item: [this.getId()],
|
|
47963
|
+
newData: { isOpen: true },
|
|
47964
|
+
prevData: { isOpen: false }
|
|
47965
|
+
});
|
|
47966
|
+
}
|
|
47939
47967
|
}
|
|
47940
47968
|
apply(op) {
|
|
47941
47969
|
super.apply(op);
|
package/dist/cjs/index.js
CHANGED
|
@@ -21669,6 +21669,14 @@ class BaseItem extends Mbr {
|
|
|
21669
21669
|
this.apply(operation);
|
|
21670
21670
|
}
|
|
21671
21671
|
}
|
|
21672
|
+
emitForManyItems(operation) {
|
|
21673
|
+
if (!this.board.events) {
|
|
21674
|
+
return;
|
|
21675
|
+
}
|
|
21676
|
+
const command = createCommand(this.board, operation);
|
|
21677
|
+
command.apply();
|
|
21678
|
+
this.board.events.emit(operation, command);
|
|
21679
|
+
}
|
|
21672
21680
|
apply(op) {
|
|
21673
21681
|
op = op;
|
|
21674
21682
|
switch (op.class) {
|
|
@@ -47928,14 +47936,34 @@ class Card extends BaseItem {
|
|
|
47928
47936
|
this.subject.publish(this);
|
|
47929
47937
|
return this;
|
|
47930
47938
|
}
|
|
47931
|
-
toggleIsOpen() {
|
|
47932
|
-
|
|
47933
|
-
|
|
47934
|
-
|
|
47935
|
-
|
|
47936
|
-
|
|
47937
|
-
|
|
47938
|
-
|
|
47939
|
+
toggleIsOpen(cards) {
|
|
47940
|
+
const openedCardIds = [];
|
|
47941
|
+
const closedCardIds = [];
|
|
47942
|
+
for (const card of cards) {
|
|
47943
|
+
if (card.isOpen) {
|
|
47944
|
+
openedCardIds.push(card.getId());
|
|
47945
|
+
} else {
|
|
47946
|
+
closedCardIds.push(card.getId());
|
|
47947
|
+
}
|
|
47948
|
+
}
|
|
47949
|
+
if (openedCardIds.length) {
|
|
47950
|
+
this.emitForManyItems({
|
|
47951
|
+
class: "Card",
|
|
47952
|
+
method: "setIsOpen",
|
|
47953
|
+
item: [this.getId()],
|
|
47954
|
+
newData: { isOpen: false },
|
|
47955
|
+
prevData: { isOpen: true }
|
|
47956
|
+
});
|
|
47957
|
+
}
|
|
47958
|
+
if (closedCardIds.length) {
|
|
47959
|
+
this.emitForManyItems({
|
|
47960
|
+
class: "Card",
|
|
47961
|
+
method: "setIsOpen",
|
|
47962
|
+
item: [this.getId()],
|
|
47963
|
+
newData: { isOpen: true },
|
|
47964
|
+
prevData: { isOpen: false }
|
|
47965
|
+
});
|
|
47966
|
+
}
|
|
47939
47967
|
}
|
|
47940
47968
|
apply(op) {
|
|
47941
47969
|
super.apply(op);
|
package/dist/cjs/node.js
CHANGED
|
@@ -24141,6 +24141,14 @@ class BaseItem extends Mbr {
|
|
|
24141
24141
|
this.apply(operation);
|
|
24142
24142
|
}
|
|
24143
24143
|
}
|
|
24144
|
+
emitForManyItems(operation) {
|
|
24145
|
+
if (!this.board.events) {
|
|
24146
|
+
return;
|
|
24147
|
+
}
|
|
24148
|
+
const command = createCommand(this.board, operation);
|
|
24149
|
+
command.apply();
|
|
24150
|
+
this.board.events.emit(operation, command);
|
|
24151
|
+
}
|
|
24144
24152
|
apply(op) {
|
|
24145
24153
|
op = op;
|
|
24146
24154
|
switch (op.class) {
|
|
@@ -50401,14 +50409,34 @@ class Card extends BaseItem {
|
|
|
50401
50409
|
this.subject.publish(this);
|
|
50402
50410
|
return this;
|
|
50403
50411
|
}
|
|
50404
|
-
toggleIsOpen() {
|
|
50405
|
-
|
|
50406
|
-
|
|
50407
|
-
|
|
50408
|
-
|
|
50409
|
-
|
|
50410
|
-
|
|
50411
|
-
|
|
50412
|
+
toggleIsOpen(cards) {
|
|
50413
|
+
const openedCardIds = [];
|
|
50414
|
+
const closedCardIds = [];
|
|
50415
|
+
for (const card of cards) {
|
|
50416
|
+
if (card.isOpen) {
|
|
50417
|
+
openedCardIds.push(card.getId());
|
|
50418
|
+
} else {
|
|
50419
|
+
closedCardIds.push(card.getId());
|
|
50420
|
+
}
|
|
50421
|
+
}
|
|
50422
|
+
if (openedCardIds.length) {
|
|
50423
|
+
this.emitForManyItems({
|
|
50424
|
+
class: "Card",
|
|
50425
|
+
method: "setIsOpen",
|
|
50426
|
+
item: [this.getId()],
|
|
50427
|
+
newData: { isOpen: false },
|
|
50428
|
+
prevData: { isOpen: true }
|
|
50429
|
+
});
|
|
50430
|
+
}
|
|
50431
|
+
if (closedCardIds.length) {
|
|
50432
|
+
this.emitForManyItems({
|
|
50433
|
+
class: "Card",
|
|
50434
|
+
method: "setIsOpen",
|
|
50435
|
+
item: [this.getId()],
|
|
50436
|
+
newData: { isOpen: true },
|
|
50437
|
+
prevData: { isOpen: false }
|
|
50438
|
+
});
|
|
50439
|
+
}
|
|
50412
50440
|
}
|
|
50413
50441
|
apply(op) {
|
|
50414
50442
|
super.apply(op);
|
package/dist/esm/browser.js
CHANGED
|
@@ -21515,6 +21515,14 @@ class BaseItem extends Mbr {
|
|
|
21515
21515
|
this.apply(operation);
|
|
21516
21516
|
}
|
|
21517
21517
|
}
|
|
21518
|
+
emitForManyItems(operation) {
|
|
21519
|
+
if (!this.board.events) {
|
|
21520
|
+
return;
|
|
21521
|
+
}
|
|
21522
|
+
const command = createCommand(this.board, operation);
|
|
21523
|
+
command.apply();
|
|
21524
|
+
this.board.events.emit(operation, command);
|
|
21525
|
+
}
|
|
21518
21526
|
apply(op) {
|
|
21519
21527
|
op = op;
|
|
21520
21528
|
switch (op.class) {
|
|
@@ -47774,14 +47782,34 @@ class Card extends BaseItem {
|
|
|
47774
47782
|
this.subject.publish(this);
|
|
47775
47783
|
return this;
|
|
47776
47784
|
}
|
|
47777
|
-
toggleIsOpen() {
|
|
47778
|
-
|
|
47779
|
-
|
|
47780
|
-
|
|
47781
|
-
|
|
47782
|
-
|
|
47783
|
-
|
|
47784
|
-
|
|
47785
|
+
toggleIsOpen(cards) {
|
|
47786
|
+
const openedCardIds = [];
|
|
47787
|
+
const closedCardIds = [];
|
|
47788
|
+
for (const card of cards) {
|
|
47789
|
+
if (card.isOpen) {
|
|
47790
|
+
openedCardIds.push(card.getId());
|
|
47791
|
+
} else {
|
|
47792
|
+
closedCardIds.push(card.getId());
|
|
47793
|
+
}
|
|
47794
|
+
}
|
|
47795
|
+
if (openedCardIds.length) {
|
|
47796
|
+
this.emitForManyItems({
|
|
47797
|
+
class: "Card",
|
|
47798
|
+
method: "setIsOpen",
|
|
47799
|
+
item: [this.getId()],
|
|
47800
|
+
newData: { isOpen: false },
|
|
47801
|
+
prevData: { isOpen: true }
|
|
47802
|
+
});
|
|
47803
|
+
}
|
|
47804
|
+
if (closedCardIds.length) {
|
|
47805
|
+
this.emitForManyItems({
|
|
47806
|
+
class: "Card",
|
|
47807
|
+
method: "setIsOpen",
|
|
47808
|
+
item: [this.getId()],
|
|
47809
|
+
newData: { isOpen: true },
|
|
47810
|
+
prevData: { isOpen: false }
|
|
47811
|
+
});
|
|
47812
|
+
}
|
|
47785
47813
|
}
|
|
47786
47814
|
apply(op) {
|
|
47787
47815
|
super.apply(op);
|
package/dist/esm/index.js
CHANGED
|
@@ -21508,6 +21508,14 @@ class BaseItem extends Mbr {
|
|
|
21508
21508
|
this.apply(operation);
|
|
21509
21509
|
}
|
|
21510
21510
|
}
|
|
21511
|
+
emitForManyItems(operation) {
|
|
21512
|
+
if (!this.board.events) {
|
|
21513
|
+
return;
|
|
21514
|
+
}
|
|
21515
|
+
const command = createCommand(this.board, operation);
|
|
21516
|
+
command.apply();
|
|
21517
|
+
this.board.events.emit(operation, command);
|
|
21518
|
+
}
|
|
21511
21519
|
apply(op) {
|
|
21512
21520
|
op = op;
|
|
21513
21521
|
switch (op.class) {
|
|
@@ -47767,14 +47775,34 @@ class Card extends BaseItem {
|
|
|
47767
47775
|
this.subject.publish(this);
|
|
47768
47776
|
return this;
|
|
47769
47777
|
}
|
|
47770
|
-
toggleIsOpen() {
|
|
47771
|
-
|
|
47772
|
-
|
|
47773
|
-
|
|
47774
|
-
|
|
47775
|
-
|
|
47776
|
-
|
|
47777
|
-
|
|
47778
|
+
toggleIsOpen(cards) {
|
|
47779
|
+
const openedCardIds = [];
|
|
47780
|
+
const closedCardIds = [];
|
|
47781
|
+
for (const card of cards) {
|
|
47782
|
+
if (card.isOpen) {
|
|
47783
|
+
openedCardIds.push(card.getId());
|
|
47784
|
+
} else {
|
|
47785
|
+
closedCardIds.push(card.getId());
|
|
47786
|
+
}
|
|
47787
|
+
}
|
|
47788
|
+
if (openedCardIds.length) {
|
|
47789
|
+
this.emitForManyItems({
|
|
47790
|
+
class: "Card",
|
|
47791
|
+
method: "setIsOpen",
|
|
47792
|
+
item: [this.getId()],
|
|
47793
|
+
newData: { isOpen: false },
|
|
47794
|
+
prevData: { isOpen: true }
|
|
47795
|
+
});
|
|
47796
|
+
}
|
|
47797
|
+
if (closedCardIds.length) {
|
|
47798
|
+
this.emitForManyItems({
|
|
47799
|
+
class: "Card",
|
|
47800
|
+
method: "setIsOpen",
|
|
47801
|
+
item: [this.getId()],
|
|
47802
|
+
newData: { isOpen: true },
|
|
47803
|
+
prevData: { isOpen: false }
|
|
47804
|
+
});
|
|
47805
|
+
}
|
|
47778
47806
|
}
|
|
47779
47807
|
apply(op) {
|
|
47780
47808
|
super.apply(op);
|
package/dist/esm/node.js
CHANGED
|
@@ -23975,6 +23975,14 @@ class BaseItem extends Mbr {
|
|
|
23975
23975
|
this.apply(operation);
|
|
23976
23976
|
}
|
|
23977
23977
|
}
|
|
23978
|
+
emitForManyItems(operation) {
|
|
23979
|
+
if (!this.board.events) {
|
|
23980
|
+
return;
|
|
23981
|
+
}
|
|
23982
|
+
const command = createCommand(this.board, operation);
|
|
23983
|
+
command.apply();
|
|
23984
|
+
this.board.events.emit(operation, command);
|
|
23985
|
+
}
|
|
23978
23986
|
apply(op) {
|
|
23979
23987
|
op = op;
|
|
23980
23988
|
switch (op.class) {
|
|
@@ -50235,14 +50243,34 @@ class Card extends BaseItem {
|
|
|
50235
50243
|
this.subject.publish(this);
|
|
50236
50244
|
return this;
|
|
50237
50245
|
}
|
|
50238
|
-
toggleIsOpen() {
|
|
50239
|
-
|
|
50240
|
-
|
|
50241
|
-
|
|
50242
|
-
|
|
50243
|
-
|
|
50244
|
-
|
|
50245
|
-
|
|
50246
|
+
toggleIsOpen(cards) {
|
|
50247
|
+
const openedCardIds = [];
|
|
50248
|
+
const closedCardIds = [];
|
|
50249
|
+
for (const card of cards) {
|
|
50250
|
+
if (card.isOpen) {
|
|
50251
|
+
openedCardIds.push(card.getId());
|
|
50252
|
+
} else {
|
|
50253
|
+
closedCardIds.push(card.getId());
|
|
50254
|
+
}
|
|
50255
|
+
}
|
|
50256
|
+
if (openedCardIds.length) {
|
|
50257
|
+
this.emitForManyItems({
|
|
50258
|
+
class: "Card",
|
|
50259
|
+
method: "setIsOpen",
|
|
50260
|
+
item: [this.getId()],
|
|
50261
|
+
newData: { isOpen: false },
|
|
50262
|
+
prevData: { isOpen: true }
|
|
50263
|
+
});
|
|
50264
|
+
}
|
|
50265
|
+
if (closedCardIds.length) {
|
|
50266
|
+
this.emitForManyItems({
|
|
50267
|
+
class: "Card",
|
|
50268
|
+
method: "setIsOpen",
|
|
50269
|
+
item: [this.getId()],
|
|
50270
|
+
newData: { isOpen: true },
|
|
50271
|
+
prevData: { isOpen: false }
|
|
50272
|
+
});
|
|
50273
|
+
}
|
|
50246
50274
|
}
|
|
50247
50275
|
apply(op) {
|
|
50248
50276
|
super.apply(op);
|
|
@@ -61,6 +61,7 @@ export declare class BaseItem extends Mbr implements Geometry {
|
|
|
61
61
|
serialize(): SerializedItemData;
|
|
62
62
|
isClosed(): boolean;
|
|
63
63
|
emit(operation: Operation | BaseOperation): void;
|
|
64
|
+
emitForManyItems(operation: Operation | BaseOperation): void;
|
|
64
65
|
apply(op: Operation | BaseItemOperation | BaseOperation): void;
|
|
65
66
|
addOnRemoveCallback(cb: () => void): void;
|
|
66
67
|
onRemove(): void;
|