microboard-temp 0.4.27 → 0.4.29
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 +90 -87
- package/dist/cjs/index.js +90 -87
- package/dist/cjs/node.js +90 -87
- package/dist/esm/browser.js +90 -87
- package/dist/esm/index.js +90 -87
- package/dist/esm/node.js +90 -87
- package/dist/types/Events/EventsOperations.d.ts +1 -1
- package/dist/types/Items/Examples/CardGame/Dice/Dice.d.ts +3 -3
- package/package.json +1 -1
package/dist/cjs/node.js
CHANGED
|
@@ -22002,9 +22002,19 @@ class BaseCommand {
|
|
|
22002
22002
|
const items = this.items;
|
|
22003
22003
|
return mapItemsByOperation(items, (item) => {
|
|
22004
22004
|
const op = this.operation;
|
|
22005
|
+
let newData = {};
|
|
22006
|
+
if (op.prevData) {
|
|
22007
|
+
newData = op.prevData;
|
|
22008
|
+
} else {
|
|
22009
|
+
Object.keys(op.newData).forEach((key) => {
|
|
22010
|
+
if (item[key]) {
|
|
22011
|
+
op.newData[key] = item[key];
|
|
22012
|
+
}
|
|
22013
|
+
});
|
|
22014
|
+
}
|
|
22005
22015
|
return {
|
|
22006
22016
|
...op,
|
|
22007
|
-
newData
|
|
22017
|
+
newData
|
|
22008
22018
|
};
|
|
22009
22019
|
});
|
|
22010
22020
|
}
|
|
@@ -48797,7 +48807,7 @@ class Dice extends BaseItem {
|
|
|
48797
48807
|
if (values2) {
|
|
48798
48808
|
this.values = values2;
|
|
48799
48809
|
}
|
|
48800
|
-
this.
|
|
48810
|
+
this.updateRenderValues();
|
|
48801
48811
|
this.transformPath();
|
|
48802
48812
|
this.transformation.subject.subscribe(() => {
|
|
48803
48813
|
this.transformPath();
|
|
@@ -48813,7 +48823,7 @@ class Dice extends BaseItem {
|
|
|
48813
48823
|
this.path.setBorderColor(this.borderColor);
|
|
48814
48824
|
this.path.setBorderWidth(this.borderWidth);
|
|
48815
48825
|
}
|
|
48816
|
-
|
|
48826
|
+
updateRenderValues() {
|
|
48817
48827
|
this.values.forEach((value, index2) => {
|
|
48818
48828
|
if (typeof value === "number") {
|
|
48819
48829
|
this.renderValues[index2] = value;
|
|
@@ -48888,7 +48898,7 @@ class Dice extends BaseItem {
|
|
|
48888
48898
|
}
|
|
48889
48899
|
deserialize(data) {
|
|
48890
48900
|
super.deserialize(data);
|
|
48891
|
-
this.
|
|
48901
|
+
this.updateRenderValues();
|
|
48892
48902
|
this.transformPath();
|
|
48893
48903
|
this.subject.publish(this);
|
|
48894
48904
|
return this;
|
|
@@ -48995,6 +49005,7 @@ class Dice extends BaseItem {
|
|
|
48995
49005
|
this.valueIndex = 0;
|
|
48996
49006
|
}
|
|
48997
49007
|
this.values = op.newData.values;
|
|
49008
|
+
this.updateRenderValues();
|
|
48998
49009
|
break;
|
|
48999
49010
|
}
|
|
49000
49011
|
break;
|
|
@@ -53065,93 +53076,85 @@ class BoardSelection {
|
|
|
53065
53076
|
}
|
|
53066
53077
|
}
|
|
53067
53078
|
setStrokeColor(borderColor) {
|
|
53068
|
-
const
|
|
53069
|
-
|
|
53070
|
-
|
|
53071
|
-
|
|
53072
|
-
|
|
53073
|
-
|
|
53074
|
-
|
|
53075
|
-
|
|
53076
|
-
|
|
53077
|
-
|
|
53078
|
-
|
|
53079
|
-
|
|
53080
|
-
|
|
53081
|
-
|
|
53082
|
-
|
|
53083
|
-
|
|
53084
|
-
|
|
53085
|
-
|
|
53086
|
-
|
|
53087
|
-
|
|
53088
|
-
|
|
53089
|
-
|
|
53090
|
-
|
|
53091
|
-
|
|
53092
|
-
|
|
53093
|
-
|
|
53094
|
-
}
|
|
53079
|
+
const operation = {
|
|
53080
|
+
class: "Shape",
|
|
53081
|
+
method: "setBorderColor",
|
|
53082
|
+
item: [],
|
|
53083
|
+
newData: { borderColor }
|
|
53084
|
+
};
|
|
53085
|
+
const operations2 = {};
|
|
53086
|
+
this.items.list().forEach((item) => {
|
|
53087
|
+
if (!operations2[item.itemType]) {
|
|
53088
|
+
const operationCopy = { ...operation };
|
|
53089
|
+
if (item.itemType === "Connector") {
|
|
53090
|
+
operationCopy.method = "setLineColor";
|
|
53091
|
+
operationCopy.lineColor = borderColor;
|
|
53092
|
+
} else if (item.itemType === "Drawing") {
|
|
53093
|
+
operationCopy.method = "setStrokeColor";
|
|
53094
|
+
operationCopy.color = borderColor;
|
|
53095
|
+
} else {
|
|
53096
|
+
operationCopy.borderColor = borderColor;
|
|
53097
|
+
}
|
|
53098
|
+
operations2[item.itemType] = { ...operationCopy, class: item.itemType, item: [item.getId()] };
|
|
53099
|
+
} else {
|
|
53100
|
+
operations2[item.itemType].item.push(item.getId());
|
|
53101
|
+
}
|
|
53102
|
+
});
|
|
53103
|
+
Object.values(operations2).forEach((op) => {
|
|
53104
|
+
this.emit(op);
|
|
53105
|
+
});
|
|
53095
53106
|
}
|
|
53096
53107
|
setStrokeWidth(width2) {
|
|
53097
|
-
const
|
|
53098
|
-
|
|
53099
|
-
|
|
53100
|
-
|
|
53101
|
-
|
|
53102
|
-
|
|
53103
|
-
|
|
53104
|
-
|
|
53105
|
-
|
|
53106
|
-
|
|
53107
|
-
|
|
53108
|
-
|
|
53109
|
-
|
|
53110
|
-
|
|
53111
|
-
|
|
53112
|
-
|
|
53113
|
-
|
|
53114
|
-
|
|
53115
|
-
|
|
53116
|
-
|
|
53117
|
-
|
|
53118
|
-
|
|
53119
|
-
class:
|
|
53120
|
-
|
|
53121
|
-
item
|
|
53122
|
-
|
|
53123
|
-
|
|
53124
|
-
|
|
53125
|
-
|
|
53108
|
+
const operation = {
|
|
53109
|
+
class: "Shape",
|
|
53110
|
+
method: "setStrokeWidth",
|
|
53111
|
+
item: [],
|
|
53112
|
+
width: width2,
|
|
53113
|
+
newData: { width: width2 }
|
|
53114
|
+
};
|
|
53115
|
+
const operations2 = {};
|
|
53116
|
+
this.items.list().forEach((item) => {
|
|
53117
|
+
if (!operations2[item.itemType]) {
|
|
53118
|
+
const operationCopy = { ...operation };
|
|
53119
|
+
if (item.itemType === "Connector") {
|
|
53120
|
+
operationCopy.method = "setLineWidth";
|
|
53121
|
+
operationCopy.lineWidth = width2;
|
|
53122
|
+
} else if (item.itemType === "Drawing") {
|
|
53123
|
+
operationCopy.method = "setStrokeWidth";
|
|
53124
|
+
operationCopy.width = width2;
|
|
53125
|
+
operationCopy.prevWidth = this.getStrokeWidth();
|
|
53126
|
+
} else {
|
|
53127
|
+
operationCopy.borderWidth = width2;
|
|
53128
|
+
operationCopy.prevBorderWidth = this.getStrokeWidth();
|
|
53129
|
+
}
|
|
53130
|
+
operations2[item.itemType] = { ...operationCopy, class: item.itemType, item: [item.getId()] };
|
|
53131
|
+
} else {
|
|
53132
|
+
operations2[item.itemType].item.push(item.getId());
|
|
53133
|
+
}
|
|
53134
|
+
});
|
|
53135
|
+
Object.values(operations2).forEach((op) => {
|
|
53136
|
+
this.emit(op);
|
|
53137
|
+
});
|
|
53126
53138
|
}
|
|
53127
53139
|
setFillColor(backgroundColor) {
|
|
53128
|
-
const
|
|
53129
|
-
|
|
53130
|
-
|
|
53131
|
-
|
|
53132
|
-
|
|
53133
|
-
|
|
53134
|
-
|
|
53135
|
-
|
|
53136
|
-
|
|
53137
|
-
|
|
53138
|
-
|
|
53139
|
-
|
|
53140
|
-
|
|
53141
|
-
|
|
53142
|
-
|
|
53143
|
-
|
|
53144
|
-
|
|
53145
|
-
}
|
|
53146
|
-
const frames = this.items.getIdsByItemTypes(["Frame"]);
|
|
53147
|
-
if (frames.length) {
|
|
53148
|
-
this.emit({
|
|
53149
|
-
class: "Frame",
|
|
53150
|
-
method: "setBackgroundColor",
|
|
53151
|
-
item: frames,
|
|
53152
|
-
backgroundColor
|
|
53153
|
-
});
|
|
53154
|
-
}
|
|
53140
|
+
const operation = {
|
|
53141
|
+
class: "Shape",
|
|
53142
|
+
method: "setBackgroundColor",
|
|
53143
|
+
item: [],
|
|
53144
|
+
backgroundColor,
|
|
53145
|
+
newData: { backgroundColor }
|
|
53146
|
+
};
|
|
53147
|
+
const operations2 = {};
|
|
53148
|
+
this.items.list().forEach((item) => {
|
|
53149
|
+
if (!operations2[item.itemType]) {
|
|
53150
|
+
operations2[item.itemType] = { ...operation, class: item.itemType, item: [item.getId()] };
|
|
53151
|
+
} else {
|
|
53152
|
+
operations2[item.itemType].item.push(item.getId());
|
|
53153
|
+
}
|
|
53154
|
+
});
|
|
53155
|
+
Object.values(operations2).forEach((op) => {
|
|
53156
|
+
this.emit(op);
|
|
53157
|
+
});
|
|
53155
53158
|
}
|
|
53156
53159
|
setCanChangeRatio(canChangeRatio) {
|
|
53157
53160
|
const frames = this.items.getIdsByItemTypes(["Frame"]);
|
package/dist/esm/browser.js
CHANGED
|
@@ -19313,9 +19313,19 @@ class BaseCommand {
|
|
|
19313
19313
|
const items = this.items;
|
|
19314
19314
|
return mapItemsByOperation(items, (item) => {
|
|
19315
19315
|
const op = this.operation;
|
|
19316
|
+
let newData = {};
|
|
19317
|
+
if (op.prevData) {
|
|
19318
|
+
newData = op.prevData;
|
|
19319
|
+
} else {
|
|
19320
|
+
Object.keys(op.newData).forEach((key) => {
|
|
19321
|
+
if (item[key]) {
|
|
19322
|
+
op.newData[key] = item[key];
|
|
19323
|
+
}
|
|
19324
|
+
});
|
|
19325
|
+
}
|
|
19316
19326
|
return {
|
|
19317
19327
|
...op,
|
|
19318
|
-
newData
|
|
19328
|
+
newData
|
|
19319
19329
|
};
|
|
19320
19330
|
});
|
|
19321
19331
|
}
|
|
@@ -46107,7 +46117,7 @@ class Dice extends BaseItem {
|
|
|
46107
46117
|
if (values2) {
|
|
46108
46118
|
this.values = values2;
|
|
46109
46119
|
}
|
|
46110
|
-
this.
|
|
46120
|
+
this.updateRenderValues();
|
|
46111
46121
|
this.transformPath();
|
|
46112
46122
|
this.transformation.subject.subscribe(() => {
|
|
46113
46123
|
this.transformPath();
|
|
@@ -46123,7 +46133,7 @@ class Dice extends BaseItem {
|
|
|
46123
46133
|
this.path.setBorderColor(this.borderColor);
|
|
46124
46134
|
this.path.setBorderWidth(this.borderWidth);
|
|
46125
46135
|
}
|
|
46126
|
-
|
|
46136
|
+
updateRenderValues() {
|
|
46127
46137
|
this.values.forEach((value, index2) => {
|
|
46128
46138
|
if (typeof value === "number") {
|
|
46129
46139
|
this.renderValues[index2] = value;
|
|
@@ -46198,7 +46208,7 @@ class Dice extends BaseItem {
|
|
|
46198
46208
|
}
|
|
46199
46209
|
deserialize(data) {
|
|
46200
46210
|
super.deserialize(data);
|
|
46201
|
-
this.
|
|
46211
|
+
this.updateRenderValues();
|
|
46202
46212
|
this.transformPath();
|
|
46203
46213
|
this.subject.publish(this);
|
|
46204
46214
|
return this;
|
|
@@ -46305,6 +46315,7 @@ class Dice extends BaseItem {
|
|
|
46305
46315
|
this.valueIndex = 0;
|
|
46306
46316
|
}
|
|
46307
46317
|
this.values = op.newData.values;
|
|
46318
|
+
this.updateRenderValues();
|
|
46308
46319
|
break;
|
|
46309
46320
|
}
|
|
46310
46321
|
break;
|
|
@@ -50375,93 +50386,85 @@ class BoardSelection {
|
|
|
50375
50386
|
}
|
|
50376
50387
|
}
|
|
50377
50388
|
setStrokeColor(borderColor) {
|
|
50378
|
-
const
|
|
50379
|
-
|
|
50380
|
-
|
|
50381
|
-
|
|
50382
|
-
|
|
50383
|
-
|
|
50384
|
-
|
|
50385
|
-
|
|
50386
|
-
|
|
50387
|
-
|
|
50388
|
-
|
|
50389
|
-
|
|
50390
|
-
|
|
50391
|
-
|
|
50392
|
-
|
|
50393
|
-
|
|
50394
|
-
|
|
50395
|
-
|
|
50396
|
-
|
|
50397
|
-
|
|
50398
|
-
|
|
50399
|
-
|
|
50400
|
-
|
|
50401
|
-
|
|
50402
|
-
|
|
50403
|
-
|
|
50404
|
-
}
|
|
50389
|
+
const operation = {
|
|
50390
|
+
class: "Shape",
|
|
50391
|
+
method: "setBorderColor",
|
|
50392
|
+
item: [],
|
|
50393
|
+
newData: { borderColor }
|
|
50394
|
+
};
|
|
50395
|
+
const operations2 = {};
|
|
50396
|
+
this.items.list().forEach((item) => {
|
|
50397
|
+
if (!operations2[item.itemType]) {
|
|
50398
|
+
const operationCopy = { ...operation };
|
|
50399
|
+
if (item.itemType === "Connector") {
|
|
50400
|
+
operationCopy.method = "setLineColor";
|
|
50401
|
+
operationCopy.lineColor = borderColor;
|
|
50402
|
+
} else if (item.itemType === "Drawing") {
|
|
50403
|
+
operationCopy.method = "setStrokeColor";
|
|
50404
|
+
operationCopy.color = borderColor;
|
|
50405
|
+
} else {
|
|
50406
|
+
operationCopy.borderColor = borderColor;
|
|
50407
|
+
}
|
|
50408
|
+
operations2[item.itemType] = { ...operationCopy, class: item.itemType, item: [item.getId()] };
|
|
50409
|
+
} else {
|
|
50410
|
+
operations2[item.itemType].item.push(item.getId());
|
|
50411
|
+
}
|
|
50412
|
+
});
|
|
50413
|
+
Object.values(operations2).forEach((op) => {
|
|
50414
|
+
this.emit(op);
|
|
50415
|
+
});
|
|
50405
50416
|
}
|
|
50406
50417
|
setStrokeWidth(width2) {
|
|
50407
|
-
const
|
|
50408
|
-
|
|
50409
|
-
|
|
50410
|
-
|
|
50411
|
-
|
|
50412
|
-
|
|
50413
|
-
|
|
50414
|
-
|
|
50415
|
-
|
|
50416
|
-
|
|
50417
|
-
|
|
50418
|
-
|
|
50419
|
-
|
|
50420
|
-
|
|
50421
|
-
|
|
50422
|
-
|
|
50423
|
-
|
|
50424
|
-
|
|
50425
|
-
|
|
50426
|
-
|
|
50427
|
-
|
|
50428
|
-
|
|
50429
|
-
class:
|
|
50430
|
-
|
|
50431
|
-
item
|
|
50432
|
-
|
|
50433
|
-
|
|
50434
|
-
|
|
50435
|
-
|
|
50418
|
+
const operation = {
|
|
50419
|
+
class: "Shape",
|
|
50420
|
+
method: "setStrokeWidth",
|
|
50421
|
+
item: [],
|
|
50422
|
+
width: width2,
|
|
50423
|
+
newData: { width: width2 }
|
|
50424
|
+
};
|
|
50425
|
+
const operations2 = {};
|
|
50426
|
+
this.items.list().forEach((item) => {
|
|
50427
|
+
if (!operations2[item.itemType]) {
|
|
50428
|
+
const operationCopy = { ...operation };
|
|
50429
|
+
if (item.itemType === "Connector") {
|
|
50430
|
+
operationCopy.method = "setLineWidth";
|
|
50431
|
+
operationCopy.lineWidth = width2;
|
|
50432
|
+
} else if (item.itemType === "Drawing") {
|
|
50433
|
+
operationCopy.method = "setStrokeWidth";
|
|
50434
|
+
operationCopy.width = width2;
|
|
50435
|
+
operationCopy.prevWidth = this.getStrokeWidth();
|
|
50436
|
+
} else {
|
|
50437
|
+
operationCopy.borderWidth = width2;
|
|
50438
|
+
operationCopy.prevBorderWidth = this.getStrokeWidth();
|
|
50439
|
+
}
|
|
50440
|
+
operations2[item.itemType] = { ...operationCopy, class: item.itemType, item: [item.getId()] };
|
|
50441
|
+
} else {
|
|
50442
|
+
operations2[item.itemType].item.push(item.getId());
|
|
50443
|
+
}
|
|
50444
|
+
});
|
|
50445
|
+
Object.values(operations2).forEach((op) => {
|
|
50446
|
+
this.emit(op);
|
|
50447
|
+
});
|
|
50436
50448
|
}
|
|
50437
50449
|
setFillColor(backgroundColor) {
|
|
50438
|
-
const
|
|
50439
|
-
|
|
50440
|
-
|
|
50441
|
-
|
|
50442
|
-
|
|
50443
|
-
|
|
50444
|
-
|
|
50445
|
-
|
|
50446
|
-
|
|
50447
|
-
|
|
50448
|
-
|
|
50449
|
-
|
|
50450
|
-
|
|
50451
|
-
|
|
50452
|
-
|
|
50453
|
-
|
|
50454
|
-
|
|
50455
|
-
}
|
|
50456
|
-
const frames = this.items.getIdsByItemTypes(["Frame"]);
|
|
50457
|
-
if (frames.length) {
|
|
50458
|
-
this.emit({
|
|
50459
|
-
class: "Frame",
|
|
50460
|
-
method: "setBackgroundColor",
|
|
50461
|
-
item: frames,
|
|
50462
|
-
backgroundColor
|
|
50463
|
-
});
|
|
50464
|
-
}
|
|
50450
|
+
const operation = {
|
|
50451
|
+
class: "Shape",
|
|
50452
|
+
method: "setBackgroundColor",
|
|
50453
|
+
item: [],
|
|
50454
|
+
backgroundColor,
|
|
50455
|
+
newData: { backgroundColor }
|
|
50456
|
+
};
|
|
50457
|
+
const operations2 = {};
|
|
50458
|
+
this.items.list().forEach((item) => {
|
|
50459
|
+
if (!operations2[item.itemType]) {
|
|
50460
|
+
operations2[item.itemType] = { ...operation, class: item.itemType, item: [item.getId()] };
|
|
50461
|
+
} else {
|
|
50462
|
+
operations2[item.itemType].item.push(item.getId());
|
|
50463
|
+
}
|
|
50464
|
+
});
|
|
50465
|
+
Object.values(operations2).forEach((op) => {
|
|
50466
|
+
this.emit(op);
|
|
50467
|
+
});
|
|
50465
50468
|
}
|
|
50466
50469
|
setCanChangeRatio(canChangeRatio) {
|
|
50467
50470
|
const frames = this.items.getIdsByItemTypes(["Frame"]);
|