microboard-temp 0.4.28 → 0.4.30
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 +106 -100
- package/dist/cjs/index.js +106 -100
- package/dist/cjs/node.js +106 -100
- package/dist/esm/browser.js +106 -100
- package/dist/esm/index.js +106 -100
- package/dist/esm/node.js +106 -100
- package/dist/types/Events/EventsOperations.d.ts +1 -1
- package/dist/types/Items/Examples/CardGame/Dice/Dice.d.ts +4 -0
- package/package.json +1 -1
package/dist/esm/index.js
CHANGED
|
@@ -19306,9 +19306,19 @@ class BaseCommand {
|
|
|
19306
19306
|
const items = this.items;
|
|
19307
19307
|
return mapItemsByOperation(items, (item) => {
|
|
19308
19308
|
const op = this.operation;
|
|
19309
|
+
let newData = {};
|
|
19310
|
+
if (op.prevData) {
|
|
19311
|
+
newData = op.prevData;
|
|
19312
|
+
} else {
|
|
19313
|
+
Object.keys(op.newData).forEach((key) => {
|
|
19314
|
+
if (item[key]) {
|
|
19315
|
+
op.newData[key] = item[key];
|
|
19316
|
+
}
|
|
19317
|
+
});
|
|
19318
|
+
}
|
|
19309
19319
|
return {
|
|
19310
19320
|
...op,
|
|
19311
|
-
newData
|
|
19321
|
+
newData
|
|
19312
19322
|
};
|
|
19313
19323
|
});
|
|
19314
19324
|
}
|
|
@@ -46208,6 +46218,18 @@ class Dice extends BaseItem {
|
|
|
46208
46218
|
}
|
|
46209
46219
|
return { min: this.values[0], max: this.values[this.values.length - 1] };
|
|
46210
46220
|
}
|
|
46221
|
+
getBackgroundColor() {
|
|
46222
|
+
return this.backgroundColor;
|
|
46223
|
+
}
|
|
46224
|
+
getBorderStyle() {
|
|
46225
|
+
return this.borderStyle;
|
|
46226
|
+
}
|
|
46227
|
+
getStrokeColor() {
|
|
46228
|
+
return this.borderColor;
|
|
46229
|
+
}
|
|
46230
|
+
getStrokeWidth() {
|
|
46231
|
+
return this.borderWidth;
|
|
46232
|
+
}
|
|
46211
46233
|
applyBackgroundColor(backgroundColor) {
|
|
46212
46234
|
this.backgroundColor = backgroundColor;
|
|
46213
46235
|
this.path.setBackgroundColor(backgroundColor);
|
|
@@ -50148,28 +50170,20 @@ class BoardSelection {
|
|
|
50148
50170
|
return color2;
|
|
50149
50171
|
}
|
|
50150
50172
|
getFillColor() {
|
|
50151
|
-
const tmp = this.items.
|
|
50152
|
-
|
|
50153
|
-
"Sticker",
|
|
50154
|
-
"Frame"
|
|
50155
|
-
])[0];
|
|
50156
|
-
return tmp?.getBackgroundColor() || defaultShapeData2.backgroundColor;
|
|
50173
|
+
const tmp = this.items.list()[0];
|
|
50174
|
+
return "getBackgroundColor" in tmp ? tmp.getBackgroundColor() : defaultShapeData2.backgroundColor;
|
|
50157
50175
|
}
|
|
50158
50176
|
getBorderStyle() {
|
|
50159
|
-
const shape = this.items.
|
|
50160
|
-
|
|
50161
|
-
"Drawing",
|
|
50162
|
-
"Connector"
|
|
50163
|
-
])[0];
|
|
50164
|
-
return shape?.getBorderStyle() || defaultShapeData2.borderStyle;
|
|
50177
|
+
const shape = this.items.list()[0];
|
|
50178
|
+
return "getBorderStyle" in shape ? shape.getBorderStyle() : defaultShapeData2.borderStyle;
|
|
50165
50179
|
}
|
|
50166
50180
|
getStrokeColor() {
|
|
50167
|
-
const shape = this.items.
|
|
50168
|
-
return shape
|
|
50181
|
+
const shape = this.items.list()[0];
|
|
50182
|
+
return "getStrokeColor" in shape ? shape.getStrokeColor() : defaultShapeData2.borderColor;
|
|
50169
50183
|
}
|
|
50170
50184
|
getStrokeWidth() {
|
|
50171
|
-
const shape = this.items.
|
|
50172
|
-
return shape
|
|
50185
|
+
const shape = this.items.list()[0];
|
|
50186
|
+
return "getStrokeWidth" in shape ? shape.getStrokeWidth() : defaultShapeData2.borderWidth;
|
|
50173
50187
|
}
|
|
50174
50188
|
getConnectorLineWidth() {
|
|
50175
50189
|
const connector = this.items.getItemsByItemTypes(["Connector"])[0];
|
|
@@ -50369,93 +50383,85 @@ class BoardSelection {
|
|
|
50369
50383
|
}
|
|
50370
50384
|
}
|
|
50371
50385
|
setStrokeColor(borderColor) {
|
|
50372
|
-
const
|
|
50373
|
-
|
|
50374
|
-
|
|
50375
|
-
|
|
50376
|
-
|
|
50377
|
-
|
|
50378
|
-
|
|
50379
|
-
|
|
50380
|
-
|
|
50381
|
-
|
|
50382
|
-
|
|
50383
|
-
|
|
50384
|
-
|
|
50385
|
-
|
|
50386
|
-
|
|
50387
|
-
|
|
50388
|
-
|
|
50389
|
-
|
|
50390
|
-
|
|
50391
|
-
|
|
50392
|
-
|
|
50393
|
-
|
|
50394
|
-
|
|
50395
|
-
|
|
50396
|
-
|
|
50397
|
-
|
|
50398
|
-
}
|
|
50386
|
+
const operation = {
|
|
50387
|
+
class: "Shape",
|
|
50388
|
+
method: "setBorderColor",
|
|
50389
|
+
item: [],
|
|
50390
|
+
newData: { borderColor }
|
|
50391
|
+
};
|
|
50392
|
+
const operations2 = {};
|
|
50393
|
+
this.items.list().forEach((item) => {
|
|
50394
|
+
if (!operations2[item.itemType]) {
|
|
50395
|
+
const operationCopy = { ...operation };
|
|
50396
|
+
if (item.itemType === "Connector") {
|
|
50397
|
+
operationCopy.method = "setLineColor";
|
|
50398
|
+
operationCopy.lineColor = borderColor;
|
|
50399
|
+
} else if (item.itemType === "Drawing") {
|
|
50400
|
+
operationCopy.method = "setStrokeColor";
|
|
50401
|
+
operationCopy.color = borderColor;
|
|
50402
|
+
} else {
|
|
50403
|
+
operationCopy.borderColor = borderColor;
|
|
50404
|
+
}
|
|
50405
|
+
operations2[item.itemType] = { ...operationCopy, class: item.itemType, item: [item.getId()] };
|
|
50406
|
+
} else {
|
|
50407
|
+
operations2[item.itemType].item.push(item.getId());
|
|
50408
|
+
}
|
|
50409
|
+
});
|
|
50410
|
+
Object.values(operations2).forEach((op) => {
|
|
50411
|
+
this.emit(op);
|
|
50412
|
+
});
|
|
50399
50413
|
}
|
|
50400
50414
|
setStrokeWidth(width2) {
|
|
50401
|
-
const
|
|
50402
|
-
|
|
50403
|
-
|
|
50404
|
-
|
|
50405
|
-
|
|
50406
|
-
|
|
50407
|
-
|
|
50408
|
-
|
|
50409
|
-
|
|
50410
|
-
|
|
50411
|
-
|
|
50412
|
-
|
|
50413
|
-
|
|
50414
|
-
|
|
50415
|
-
|
|
50416
|
-
|
|
50417
|
-
|
|
50418
|
-
|
|
50419
|
-
|
|
50420
|
-
|
|
50421
|
-
|
|
50422
|
-
|
|
50423
|
-
class:
|
|
50424
|
-
|
|
50425
|
-
item
|
|
50426
|
-
|
|
50427
|
-
|
|
50428
|
-
|
|
50429
|
-
|
|
50415
|
+
const operation = {
|
|
50416
|
+
class: "Shape",
|
|
50417
|
+
method: "setStrokeWidth",
|
|
50418
|
+
item: [],
|
|
50419
|
+
width: width2,
|
|
50420
|
+
newData: { width: width2 }
|
|
50421
|
+
};
|
|
50422
|
+
const operations2 = {};
|
|
50423
|
+
this.items.list().forEach((item) => {
|
|
50424
|
+
if (!operations2[item.itemType]) {
|
|
50425
|
+
const operationCopy = { ...operation };
|
|
50426
|
+
if (item.itemType === "Connector") {
|
|
50427
|
+
operationCopy.method = "setLineWidth";
|
|
50428
|
+
operationCopy.lineWidth = width2;
|
|
50429
|
+
} else if (item.itemType === "Drawing") {
|
|
50430
|
+
operationCopy.method = "setStrokeWidth";
|
|
50431
|
+
operationCopy.width = width2;
|
|
50432
|
+
operationCopy.prevWidth = this.getStrokeWidth();
|
|
50433
|
+
} else {
|
|
50434
|
+
operationCopy.borderWidth = width2;
|
|
50435
|
+
operationCopy.prevBorderWidth = this.getStrokeWidth();
|
|
50436
|
+
}
|
|
50437
|
+
operations2[item.itemType] = { ...operationCopy, class: item.itemType, item: [item.getId()] };
|
|
50438
|
+
} else {
|
|
50439
|
+
operations2[item.itemType].item.push(item.getId());
|
|
50440
|
+
}
|
|
50441
|
+
});
|
|
50442
|
+
Object.values(operations2).forEach((op) => {
|
|
50443
|
+
this.emit(op);
|
|
50444
|
+
});
|
|
50430
50445
|
}
|
|
50431
50446
|
setFillColor(backgroundColor) {
|
|
50432
|
-
const
|
|
50433
|
-
|
|
50434
|
-
|
|
50435
|
-
|
|
50436
|
-
|
|
50437
|
-
|
|
50438
|
-
|
|
50439
|
-
|
|
50440
|
-
|
|
50441
|
-
|
|
50442
|
-
|
|
50443
|
-
|
|
50444
|
-
|
|
50445
|
-
|
|
50446
|
-
|
|
50447
|
-
|
|
50448
|
-
|
|
50449
|
-
}
|
|
50450
|
-
const frames = this.items.getIdsByItemTypes(["Frame"]);
|
|
50451
|
-
if (frames.length) {
|
|
50452
|
-
this.emit({
|
|
50453
|
-
class: "Frame",
|
|
50454
|
-
method: "setBackgroundColor",
|
|
50455
|
-
item: frames,
|
|
50456
|
-
backgroundColor
|
|
50457
|
-
});
|
|
50458
|
-
}
|
|
50447
|
+
const operation = {
|
|
50448
|
+
class: "Shape",
|
|
50449
|
+
method: "setBackgroundColor",
|
|
50450
|
+
item: [],
|
|
50451
|
+
backgroundColor,
|
|
50452
|
+
newData: { backgroundColor }
|
|
50453
|
+
};
|
|
50454
|
+
const operations2 = {};
|
|
50455
|
+
this.items.list().forEach((item) => {
|
|
50456
|
+
if (!operations2[item.itemType]) {
|
|
50457
|
+
operations2[item.itemType] = { ...operation, class: item.itemType, item: [item.getId()] };
|
|
50458
|
+
} else {
|
|
50459
|
+
operations2[item.itemType].item.push(item.getId());
|
|
50460
|
+
}
|
|
50461
|
+
});
|
|
50462
|
+
Object.values(operations2).forEach((op) => {
|
|
50463
|
+
this.emit(op);
|
|
50464
|
+
});
|
|
50459
50465
|
}
|
|
50460
50466
|
setCanChangeRatio(canChangeRatio) {
|
|
50461
50467
|
const frames = this.items.getIdsByItemTypes(["Frame"]);
|
package/dist/esm/node.js
CHANGED
|
@@ -21840,9 +21840,19 @@ class BaseCommand {
|
|
|
21840
21840
|
const items = this.items;
|
|
21841
21841
|
return mapItemsByOperation(items, (item) => {
|
|
21842
21842
|
const op = this.operation;
|
|
21843
|
+
let newData = {};
|
|
21844
|
+
if (op.prevData) {
|
|
21845
|
+
newData = op.prevData;
|
|
21846
|
+
} else {
|
|
21847
|
+
Object.keys(op.newData).forEach((key) => {
|
|
21848
|
+
if (item[key]) {
|
|
21849
|
+
op.newData[key] = item[key];
|
|
21850
|
+
}
|
|
21851
|
+
});
|
|
21852
|
+
}
|
|
21843
21853
|
return {
|
|
21844
21854
|
...op,
|
|
21845
|
-
newData
|
|
21855
|
+
newData
|
|
21846
21856
|
};
|
|
21847
21857
|
});
|
|
21848
21858
|
}
|
|
@@ -48743,6 +48753,18 @@ class Dice extends BaseItem {
|
|
|
48743
48753
|
}
|
|
48744
48754
|
return { min: this.values[0], max: this.values[this.values.length - 1] };
|
|
48745
48755
|
}
|
|
48756
|
+
getBackgroundColor() {
|
|
48757
|
+
return this.backgroundColor;
|
|
48758
|
+
}
|
|
48759
|
+
getBorderStyle() {
|
|
48760
|
+
return this.borderStyle;
|
|
48761
|
+
}
|
|
48762
|
+
getStrokeColor() {
|
|
48763
|
+
return this.borderColor;
|
|
48764
|
+
}
|
|
48765
|
+
getStrokeWidth() {
|
|
48766
|
+
return this.borderWidth;
|
|
48767
|
+
}
|
|
48746
48768
|
applyBackgroundColor(backgroundColor) {
|
|
48747
48769
|
this.backgroundColor = backgroundColor;
|
|
48748
48770
|
this.path.setBackgroundColor(backgroundColor);
|
|
@@ -52683,28 +52705,20 @@ class BoardSelection {
|
|
|
52683
52705
|
return color2;
|
|
52684
52706
|
}
|
|
52685
52707
|
getFillColor() {
|
|
52686
|
-
const tmp = this.items.
|
|
52687
|
-
|
|
52688
|
-
"Sticker",
|
|
52689
|
-
"Frame"
|
|
52690
|
-
])[0];
|
|
52691
|
-
return tmp?.getBackgroundColor() || defaultShapeData2.backgroundColor;
|
|
52708
|
+
const tmp = this.items.list()[0];
|
|
52709
|
+
return "getBackgroundColor" in tmp ? tmp.getBackgroundColor() : defaultShapeData2.backgroundColor;
|
|
52692
52710
|
}
|
|
52693
52711
|
getBorderStyle() {
|
|
52694
|
-
const shape = this.items.
|
|
52695
|
-
|
|
52696
|
-
"Drawing",
|
|
52697
|
-
"Connector"
|
|
52698
|
-
])[0];
|
|
52699
|
-
return shape?.getBorderStyle() || defaultShapeData2.borderStyle;
|
|
52712
|
+
const shape = this.items.list()[0];
|
|
52713
|
+
return "getBorderStyle" in shape ? shape.getBorderStyle() : defaultShapeData2.borderStyle;
|
|
52700
52714
|
}
|
|
52701
52715
|
getStrokeColor() {
|
|
52702
|
-
const shape = this.items.
|
|
52703
|
-
return shape
|
|
52716
|
+
const shape = this.items.list()[0];
|
|
52717
|
+
return "getStrokeColor" in shape ? shape.getStrokeColor() : defaultShapeData2.borderColor;
|
|
52704
52718
|
}
|
|
52705
52719
|
getStrokeWidth() {
|
|
52706
|
-
const shape = this.items.
|
|
52707
|
-
return shape
|
|
52720
|
+
const shape = this.items.list()[0];
|
|
52721
|
+
return "getStrokeWidth" in shape ? shape.getStrokeWidth() : defaultShapeData2.borderWidth;
|
|
52708
52722
|
}
|
|
52709
52723
|
getConnectorLineWidth() {
|
|
52710
52724
|
const connector = this.items.getItemsByItemTypes(["Connector"])[0];
|
|
@@ -52904,93 +52918,85 @@ class BoardSelection {
|
|
|
52904
52918
|
}
|
|
52905
52919
|
}
|
|
52906
52920
|
setStrokeColor(borderColor) {
|
|
52907
|
-
const
|
|
52908
|
-
|
|
52909
|
-
|
|
52910
|
-
|
|
52911
|
-
|
|
52912
|
-
|
|
52913
|
-
|
|
52914
|
-
|
|
52915
|
-
|
|
52916
|
-
|
|
52917
|
-
|
|
52918
|
-
|
|
52919
|
-
|
|
52920
|
-
|
|
52921
|
-
|
|
52922
|
-
|
|
52923
|
-
|
|
52924
|
-
|
|
52925
|
-
|
|
52926
|
-
|
|
52927
|
-
|
|
52928
|
-
|
|
52929
|
-
|
|
52930
|
-
|
|
52931
|
-
|
|
52932
|
-
|
|
52933
|
-
}
|
|
52921
|
+
const operation = {
|
|
52922
|
+
class: "Shape",
|
|
52923
|
+
method: "setBorderColor",
|
|
52924
|
+
item: [],
|
|
52925
|
+
newData: { borderColor }
|
|
52926
|
+
};
|
|
52927
|
+
const operations2 = {};
|
|
52928
|
+
this.items.list().forEach((item) => {
|
|
52929
|
+
if (!operations2[item.itemType]) {
|
|
52930
|
+
const operationCopy = { ...operation };
|
|
52931
|
+
if (item.itemType === "Connector") {
|
|
52932
|
+
operationCopy.method = "setLineColor";
|
|
52933
|
+
operationCopy.lineColor = borderColor;
|
|
52934
|
+
} else if (item.itemType === "Drawing") {
|
|
52935
|
+
operationCopy.method = "setStrokeColor";
|
|
52936
|
+
operationCopy.color = borderColor;
|
|
52937
|
+
} else {
|
|
52938
|
+
operationCopy.borderColor = borderColor;
|
|
52939
|
+
}
|
|
52940
|
+
operations2[item.itemType] = { ...operationCopy, class: item.itemType, item: [item.getId()] };
|
|
52941
|
+
} else {
|
|
52942
|
+
operations2[item.itemType].item.push(item.getId());
|
|
52943
|
+
}
|
|
52944
|
+
});
|
|
52945
|
+
Object.values(operations2).forEach((op) => {
|
|
52946
|
+
this.emit(op);
|
|
52947
|
+
});
|
|
52934
52948
|
}
|
|
52935
52949
|
setStrokeWidth(width2) {
|
|
52936
|
-
const
|
|
52937
|
-
|
|
52938
|
-
|
|
52939
|
-
|
|
52940
|
-
|
|
52941
|
-
|
|
52942
|
-
|
|
52943
|
-
|
|
52944
|
-
|
|
52945
|
-
|
|
52946
|
-
|
|
52947
|
-
|
|
52948
|
-
|
|
52949
|
-
|
|
52950
|
-
|
|
52951
|
-
|
|
52952
|
-
|
|
52953
|
-
|
|
52954
|
-
|
|
52955
|
-
|
|
52956
|
-
|
|
52957
|
-
|
|
52958
|
-
class:
|
|
52959
|
-
|
|
52960
|
-
item
|
|
52961
|
-
|
|
52962
|
-
|
|
52963
|
-
|
|
52964
|
-
|
|
52950
|
+
const operation = {
|
|
52951
|
+
class: "Shape",
|
|
52952
|
+
method: "setStrokeWidth",
|
|
52953
|
+
item: [],
|
|
52954
|
+
width: width2,
|
|
52955
|
+
newData: { width: width2 }
|
|
52956
|
+
};
|
|
52957
|
+
const operations2 = {};
|
|
52958
|
+
this.items.list().forEach((item) => {
|
|
52959
|
+
if (!operations2[item.itemType]) {
|
|
52960
|
+
const operationCopy = { ...operation };
|
|
52961
|
+
if (item.itemType === "Connector") {
|
|
52962
|
+
operationCopy.method = "setLineWidth";
|
|
52963
|
+
operationCopy.lineWidth = width2;
|
|
52964
|
+
} else if (item.itemType === "Drawing") {
|
|
52965
|
+
operationCopy.method = "setStrokeWidth";
|
|
52966
|
+
operationCopy.width = width2;
|
|
52967
|
+
operationCopy.prevWidth = this.getStrokeWidth();
|
|
52968
|
+
} else {
|
|
52969
|
+
operationCopy.borderWidth = width2;
|
|
52970
|
+
operationCopy.prevBorderWidth = this.getStrokeWidth();
|
|
52971
|
+
}
|
|
52972
|
+
operations2[item.itemType] = { ...operationCopy, class: item.itemType, item: [item.getId()] };
|
|
52973
|
+
} else {
|
|
52974
|
+
operations2[item.itemType].item.push(item.getId());
|
|
52975
|
+
}
|
|
52976
|
+
});
|
|
52977
|
+
Object.values(operations2).forEach((op) => {
|
|
52978
|
+
this.emit(op);
|
|
52979
|
+
});
|
|
52965
52980
|
}
|
|
52966
52981
|
setFillColor(backgroundColor) {
|
|
52967
|
-
const
|
|
52968
|
-
|
|
52969
|
-
|
|
52970
|
-
|
|
52971
|
-
|
|
52972
|
-
|
|
52973
|
-
|
|
52974
|
-
|
|
52975
|
-
|
|
52976
|
-
|
|
52977
|
-
|
|
52978
|
-
|
|
52979
|
-
|
|
52980
|
-
|
|
52981
|
-
|
|
52982
|
-
|
|
52983
|
-
|
|
52984
|
-
}
|
|
52985
|
-
const frames = this.items.getIdsByItemTypes(["Frame"]);
|
|
52986
|
-
if (frames.length) {
|
|
52987
|
-
this.emit({
|
|
52988
|
-
class: "Frame",
|
|
52989
|
-
method: "setBackgroundColor",
|
|
52990
|
-
item: frames,
|
|
52991
|
-
backgroundColor
|
|
52992
|
-
});
|
|
52993
|
-
}
|
|
52982
|
+
const operation = {
|
|
52983
|
+
class: "Shape",
|
|
52984
|
+
method: "setBackgroundColor",
|
|
52985
|
+
item: [],
|
|
52986
|
+
backgroundColor,
|
|
52987
|
+
newData: { backgroundColor }
|
|
52988
|
+
};
|
|
52989
|
+
const operations2 = {};
|
|
52990
|
+
this.items.list().forEach((item) => {
|
|
52991
|
+
if (!operations2[item.itemType]) {
|
|
52992
|
+
operations2[item.itemType] = { ...operation, class: item.itemType, item: [item.getId()] };
|
|
52993
|
+
} else {
|
|
52994
|
+
operations2[item.itemType].item.push(item.getId());
|
|
52995
|
+
}
|
|
52996
|
+
});
|
|
52997
|
+
Object.values(operations2).forEach((op) => {
|
|
52998
|
+
this.emit(op);
|
|
52999
|
+
});
|
|
52994
53000
|
}
|
|
52995
53001
|
setCanChangeRatio(canChangeRatio) {
|
|
52996
53002
|
const frames = this.items.getIdsByItemTypes(["Frame"]);
|
|
@@ -29,7 +29,7 @@ export interface BaseOperation<T extends Record<string, unknown> = {}> {
|
|
|
29
29
|
item: string[];
|
|
30
30
|
method: string;
|
|
31
31
|
newData: T;
|
|
32
|
-
prevData
|
|
32
|
+
prevData?: T;
|
|
33
33
|
}
|
|
34
34
|
export type ItemOperation = LinkToOperation | TransformationOperation | ShapeOperation | StickerOperation | RichTextOperation | ConnectorOperation | DrawingOperation | FrameOperation | PlaceholderOperation | GroupOperation | CommentOperation | ImageOperation | VideoOperation | AudioOperation;
|
|
35
35
|
export type UndoableOperation = BoardOps | ItemOperation;
|
|
@@ -32,6 +32,10 @@ export declare class Dice extends BaseItem {
|
|
|
32
32
|
min: number;
|
|
33
33
|
max: number;
|
|
34
34
|
};
|
|
35
|
+
getBackgroundColor(): string;
|
|
36
|
+
getBorderStyle(): string;
|
|
37
|
+
getStrokeColor(): string;
|
|
38
|
+
getStrokeWidth(): number;
|
|
35
39
|
private applyBackgroundColor;
|
|
36
40
|
setBackgroundColor(backgroundColor: string): void;
|
|
37
41
|
private applyBorderWidth;
|