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/cjs/browser.js
CHANGED
|
@@ -19463,9 +19463,19 @@ class BaseCommand {
|
|
|
19463
19463
|
const items = this.items;
|
|
19464
19464
|
return mapItemsByOperation(items, (item) => {
|
|
19465
19465
|
const op = this.operation;
|
|
19466
|
+
let newData = {};
|
|
19467
|
+
if (op.prevData) {
|
|
19468
|
+
newData = op.prevData;
|
|
19469
|
+
} else {
|
|
19470
|
+
Object.keys(op.newData).forEach((key) => {
|
|
19471
|
+
if (item[key]) {
|
|
19472
|
+
op.newData[key] = item[key];
|
|
19473
|
+
}
|
|
19474
|
+
});
|
|
19475
|
+
}
|
|
19466
19476
|
return {
|
|
19467
19477
|
...op,
|
|
19468
|
-
newData
|
|
19478
|
+
newData
|
|
19469
19479
|
};
|
|
19470
19480
|
});
|
|
19471
19481
|
}
|
|
@@ -46365,6 +46375,18 @@ class Dice extends BaseItem {
|
|
|
46365
46375
|
}
|
|
46366
46376
|
return { min: this.values[0], max: this.values[this.values.length - 1] };
|
|
46367
46377
|
}
|
|
46378
|
+
getBackgroundColor() {
|
|
46379
|
+
return this.backgroundColor;
|
|
46380
|
+
}
|
|
46381
|
+
getBorderStyle() {
|
|
46382
|
+
return this.borderStyle;
|
|
46383
|
+
}
|
|
46384
|
+
getStrokeColor() {
|
|
46385
|
+
return this.borderColor;
|
|
46386
|
+
}
|
|
46387
|
+
getStrokeWidth() {
|
|
46388
|
+
return this.borderWidth;
|
|
46389
|
+
}
|
|
46368
46390
|
applyBackgroundColor(backgroundColor) {
|
|
46369
46391
|
this.backgroundColor = backgroundColor;
|
|
46370
46392
|
this.path.setBackgroundColor(backgroundColor);
|
|
@@ -50305,28 +50327,20 @@ class BoardSelection {
|
|
|
50305
50327
|
return color2;
|
|
50306
50328
|
}
|
|
50307
50329
|
getFillColor() {
|
|
50308
|
-
const tmp = this.items.
|
|
50309
|
-
|
|
50310
|
-
"Sticker",
|
|
50311
|
-
"Frame"
|
|
50312
|
-
])[0];
|
|
50313
|
-
return tmp?.getBackgroundColor() || defaultShapeData2.backgroundColor;
|
|
50330
|
+
const tmp = this.items.list()[0];
|
|
50331
|
+
return "getBackgroundColor" in tmp ? tmp.getBackgroundColor() : defaultShapeData2.backgroundColor;
|
|
50314
50332
|
}
|
|
50315
50333
|
getBorderStyle() {
|
|
50316
|
-
const shape = this.items.
|
|
50317
|
-
|
|
50318
|
-
"Drawing",
|
|
50319
|
-
"Connector"
|
|
50320
|
-
])[0];
|
|
50321
|
-
return shape?.getBorderStyle() || defaultShapeData2.borderStyle;
|
|
50334
|
+
const shape = this.items.list()[0];
|
|
50335
|
+
return "getBorderStyle" in shape ? shape.getBorderStyle() : defaultShapeData2.borderStyle;
|
|
50322
50336
|
}
|
|
50323
50337
|
getStrokeColor() {
|
|
50324
|
-
const shape = this.items.
|
|
50325
|
-
return shape
|
|
50338
|
+
const shape = this.items.list()[0];
|
|
50339
|
+
return "getStrokeColor" in shape ? shape.getStrokeColor() : defaultShapeData2.borderColor;
|
|
50326
50340
|
}
|
|
50327
50341
|
getStrokeWidth() {
|
|
50328
|
-
const shape = this.items.
|
|
50329
|
-
return shape
|
|
50342
|
+
const shape = this.items.list()[0];
|
|
50343
|
+
return "getStrokeWidth" in shape ? shape.getStrokeWidth() : defaultShapeData2.borderWidth;
|
|
50330
50344
|
}
|
|
50331
50345
|
getConnectorLineWidth() {
|
|
50332
50346
|
const connector = this.items.getItemsByItemTypes(["Connector"])[0];
|
|
@@ -50526,93 +50540,85 @@ class BoardSelection {
|
|
|
50526
50540
|
}
|
|
50527
50541
|
}
|
|
50528
50542
|
setStrokeColor(borderColor) {
|
|
50529
|
-
const
|
|
50530
|
-
|
|
50531
|
-
|
|
50532
|
-
|
|
50533
|
-
|
|
50534
|
-
|
|
50535
|
-
|
|
50536
|
-
|
|
50537
|
-
|
|
50538
|
-
|
|
50539
|
-
|
|
50540
|
-
|
|
50541
|
-
|
|
50542
|
-
|
|
50543
|
-
|
|
50544
|
-
|
|
50545
|
-
|
|
50546
|
-
|
|
50547
|
-
|
|
50548
|
-
|
|
50549
|
-
|
|
50550
|
-
|
|
50551
|
-
|
|
50552
|
-
|
|
50553
|
-
|
|
50554
|
-
|
|
50555
|
-
}
|
|
50543
|
+
const operation = {
|
|
50544
|
+
class: "Shape",
|
|
50545
|
+
method: "setBorderColor",
|
|
50546
|
+
item: [],
|
|
50547
|
+
newData: { borderColor }
|
|
50548
|
+
};
|
|
50549
|
+
const operations2 = {};
|
|
50550
|
+
this.items.list().forEach((item) => {
|
|
50551
|
+
if (!operations2[item.itemType]) {
|
|
50552
|
+
const operationCopy = { ...operation };
|
|
50553
|
+
if (item.itemType === "Connector") {
|
|
50554
|
+
operationCopy.method = "setLineColor";
|
|
50555
|
+
operationCopy.lineColor = borderColor;
|
|
50556
|
+
} else if (item.itemType === "Drawing") {
|
|
50557
|
+
operationCopy.method = "setStrokeColor";
|
|
50558
|
+
operationCopy.color = borderColor;
|
|
50559
|
+
} else {
|
|
50560
|
+
operationCopy.borderColor = borderColor;
|
|
50561
|
+
}
|
|
50562
|
+
operations2[item.itemType] = { ...operationCopy, class: item.itemType, item: [item.getId()] };
|
|
50563
|
+
} else {
|
|
50564
|
+
operations2[item.itemType].item.push(item.getId());
|
|
50565
|
+
}
|
|
50566
|
+
});
|
|
50567
|
+
Object.values(operations2).forEach((op) => {
|
|
50568
|
+
this.emit(op);
|
|
50569
|
+
});
|
|
50556
50570
|
}
|
|
50557
50571
|
setStrokeWidth(width2) {
|
|
50558
|
-
const
|
|
50559
|
-
|
|
50560
|
-
|
|
50561
|
-
|
|
50562
|
-
|
|
50563
|
-
|
|
50564
|
-
|
|
50565
|
-
|
|
50566
|
-
|
|
50567
|
-
|
|
50568
|
-
|
|
50569
|
-
|
|
50570
|
-
|
|
50571
|
-
|
|
50572
|
-
|
|
50573
|
-
|
|
50574
|
-
|
|
50575
|
-
|
|
50576
|
-
|
|
50577
|
-
|
|
50578
|
-
|
|
50579
|
-
|
|
50580
|
-
class:
|
|
50581
|
-
|
|
50582
|
-
item
|
|
50583
|
-
|
|
50584
|
-
|
|
50585
|
-
|
|
50586
|
-
|
|
50572
|
+
const operation = {
|
|
50573
|
+
class: "Shape",
|
|
50574
|
+
method: "setStrokeWidth",
|
|
50575
|
+
item: [],
|
|
50576
|
+
width: width2,
|
|
50577
|
+
newData: { width: width2 }
|
|
50578
|
+
};
|
|
50579
|
+
const operations2 = {};
|
|
50580
|
+
this.items.list().forEach((item) => {
|
|
50581
|
+
if (!operations2[item.itemType]) {
|
|
50582
|
+
const operationCopy = { ...operation };
|
|
50583
|
+
if (item.itemType === "Connector") {
|
|
50584
|
+
operationCopy.method = "setLineWidth";
|
|
50585
|
+
operationCopy.lineWidth = width2;
|
|
50586
|
+
} else if (item.itemType === "Drawing") {
|
|
50587
|
+
operationCopy.method = "setStrokeWidth";
|
|
50588
|
+
operationCopy.width = width2;
|
|
50589
|
+
operationCopy.prevWidth = this.getStrokeWidth();
|
|
50590
|
+
} else {
|
|
50591
|
+
operationCopy.borderWidth = width2;
|
|
50592
|
+
operationCopy.prevBorderWidth = this.getStrokeWidth();
|
|
50593
|
+
}
|
|
50594
|
+
operations2[item.itemType] = { ...operationCopy, class: item.itemType, item: [item.getId()] };
|
|
50595
|
+
} else {
|
|
50596
|
+
operations2[item.itemType].item.push(item.getId());
|
|
50597
|
+
}
|
|
50598
|
+
});
|
|
50599
|
+
Object.values(operations2).forEach((op) => {
|
|
50600
|
+
this.emit(op);
|
|
50601
|
+
});
|
|
50587
50602
|
}
|
|
50588
50603
|
setFillColor(backgroundColor) {
|
|
50589
|
-
const
|
|
50590
|
-
|
|
50591
|
-
|
|
50592
|
-
|
|
50593
|
-
|
|
50594
|
-
|
|
50595
|
-
|
|
50596
|
-
|
|
50597
|
-
|
|
50598
|
-
|
|
50599
|
-
|
|
50600
|
-
|
|
50601
|
-
|
|
50602
|
-
|
|
50603
|
-
|
|
50604
|
-
|
|
50605
|
-
|
|
50606
|
-
}
|
|
50607
|
-
const frames = this.items.getIdsByItemTypes(["Frame"]);
|
|
50608
|
-
if (frames.length) {
|
|
50609
|
-
this.emit({
|
|
50610
|
-
class: "Frame",
|
|
50611
|
-
method: "setBackgroundColor",
|
|
50612
|
-
item: frames,
|
|
50613
|
-
backgroundColor
|
|
50614
|
-
});
|
|
50615
|
-
}
|
|
50604
|
+
const operation = {
|
|
50605
|
+
class: "Shape",
|
|
50606
|
+
method: "setBackgroundColor",
|
|
50607
|
+
item: [],
|
|
50608
|
+
backgroundColor,
|
|
50609
|
+
newData: { backgroundColor }
|
|
50610
|
+
};
|
|
50611
|
+
const operations2 = {};
|
|
50612
|
+
this.items.list().forEach((item) => {
|
|
50613
|
+
if (!operations2[item.itemType]) {
|
|
50614
|
+
operations2[item.itemType] = { ...operation, class: item.itemType, item: [item.getId()] };
|
|
50615
|
+
} else {
|
|
50616
|
+
operations2[item.itemType].item.push(item.getId());
|
|
50617
|
+
}
|
|
50618
|
+
});
|
|
50619
|
+
Object.values(operations2).forEach((op) => {
|
|
50620
|
+
this.emit(op);
|
|
50621
|
+
});
|
|
50616
50622
|
}
|
|
50617
50623
|
setCanChangeRatio(canChangeRatio) {
|
|
50618
50624
|
const frames = this.items.getIdsByItemTypes(["Frame"]);
|
package/dist/cjs/index.js
CHANGED
|
@@ -19463,9 +19463,19 @@ class BaseCommand {
|
|
|
19463
19463
|
const items = this.items;
|
|
19464
19464
|
return mapItemsByOperation(items, (item) => {
|
|
19465
19465
|
const op = this.operation;
|
|
19466
|
+
let newData = {};
|
|
19467
|
+
if (op.prevData) {
|
|
19468
|
+
newData = op.prevData;
|
|
19469
|
+
} else {
|
|
19470
|
+
Object.keys(op.newData).forEach((key) => {
|
|
19471
|
+
if (item[key]) {
|
|
19472
|
+
op.newData[key] = item[key];
|
|
19473
|
+
}
|
|
19474
|
+
});
|
|
19475
|
+
}
|
|
19466
19476
|
return {
|
|
19467
19477
|
...op,
|
|
19468
|
-
newData
|
|
19478
|
+
newData
|
|
19469
19479
|
};
|
|
19470
19480
|
});
|
|
19471
19481
|
}
|
|
@@ -46365,6 +46375,18 @@ class Dice extends BaseItem {
|
|
|
46365
46375
|
}
|
|
46366
46376
|
return { min: this.values[0], max: this.values[this.values.length - 1] };
|
|
46367
46377
|
}
|
|
46378
|
+
getBackgroundColor() {
|
|
46379
|
+
return this.backgroundColor;
|
|
46380
|
+
}
|
|
46381
|
+
getBorderStyle() {
|
|
46382
|
+
return this.borderStyle;
|
|
46383
|
+
}
|
|
46384
|
+
getStrokeColor() {
|
|
46385
|
+
return this.borderColor;
|
|
46386
|
+
}
|
|
46387
|
+
getStrokeWidth() {
|
|
46388
|
+
return this.borderWidth;
|
|
46389
|
+
}
|
|
46368
46390
|
applyBackgroundColor(backgroundColor) {
|
|
46369
46391
|
this.backgroundColor = backgroundColor;
|
|
46370
46392
|
this.path.setBackgroundColor(backgroundColor);
|
|
@@ -50305,28 +50327,20 @@ class BoardSelection {
|
|
|
50305
50327
|
return color2;
|
|
50306
50328
|
}
|
|
50307
50329
|
getFillColor() {
|
|
50308
|
-
const tmp = this.items.
|
|
50309
|
-
|
|
50310
|
-
"Sticker",
|
|
50311
|
-
"Frame"
|
|
50312
|
-
])[0];
|
|
50313
|
-
return tmp?.getBackgroundColor() || defaultShapeData2.backgroundColor;
|
|
50330
|
+
const tmp = this.items.list()[0];
|
|
50331
|
+
return "getBackgroundColor" in tmp ? tmp.getBackgroundColor() : defaultShapeData2.backgroundColor;
|
|
50314
50332
|
}
|
|
50315
50333
|
getBorderStyle() {
|
|
50316
|
-
const shape = this.items.
|
|
50317
|
-
|
|
50318
|
-
"Drawing",
|
|
50319
|
-
"Connector"
|
|
50320
|
-
])[0];
|
|
50321
|
-
return shape?.getBorderStyle() || defaultShapeData2.borderStyle;
|
|
50334
|
+
const shape = this.items.list()[0];
|
|
50335
|
+
return "getBorderStyle" in shape ? shape.getBorderStyle() : defaultShapeData2.borderStyle;
|
|
50322
50336
|
}
|
|
50323
50337
|
getStrokeColor() {
|
|
50324
|
-
const shape = this.items.
|
|
50325
|
-
return shape
|
|
50338
|
+
const shape = this.items.list()[0];
|
|
50339
|
+
return "getStrokeColor" in shape ? shape.getStrokeColor() : defaultShapeData2.borderColor;
|
|
50326
50340
|
}
|
|
50327
50341
|
getStrokeWidth() {
|
|
50328
|
-
const shape = this.items.
|
|
50329
|
-
return shape
|
|
50342
|
+
const shape = this.items.list()[0];
|
|
50343
|
+
return "getStrokeWidth" in shape ? shape.getStrokeWidth() : defaultShapeData2.borderWidth;
|
|
50330
50344
|
}
|
|
50331
50345
|
getConnectorLineWidth() {
|
|
50332
50346
|
const connector = this.items.getItemsByItemTypes(["Connector"])[0];
|
|
@@ -50526,93 +50540,85 @@ class BoardSelection {
|
|
|
50526
50540
|
}
|
|
50527
50541
|
}
|
|
50528
50542
|
setStrokeColor(borderColor) {
|
|
50529
|
-
const
|
|
50530
|
-
|
|
50531
|
-
|
|
50532
|
-
|
|
50533
|
-
|
|
50534
|
-
|
|
50535
|
-
|
|
50536
|
-
|
|
50537
|
-
|
|
50538
|
-
|
|
50539
|
-
|
|
50540
|
-
|
|
50541
|
-
|
|
50542
|
-
|
|
50543
|
-
|
|
50544
|
-
|
|
50545
|
-
|
|
50546
|
-
|
|
50547
|
-
|
|
50548
|
-
|
|
50549
|
-
|
|
50550
|
-
|
|
50551
|
-
|
|
50552
|
-
|
|
50553
|
-
|
|
50554
|
-
|
|
50555
|
-
}
|
|
50543
|
+
const operation = {
|
|
50544
|
+
class: "Shape",
|
|
50545
|
+
method: "setBorderColor",
|
|
50546
|
+
item: [],
|
|
50547
|
+
newData: { borderColor }
|
|
50548
|
+
};
|
|
50549
|
+
const operations2 = {};
|
|
50550
|
+
this.items.list().forEach((item) => {
|
|
50551
|
+
if (!operations2[item.itemType]) {
|
|
50552
|
+
const operationCopy = { ...operation };
|
|
50553
|
+
if (item.itemType === "Connector") {
|
|
50554
|
+
operationCopy.method = "setLineColor";
|
|
50555
|
+
operationCopy.lineColor = borderColor;
|
|
50556
|
+
} else if (item.itemType === "Drawing") {
|
|
50557
|
+
operationCopy.method = "setStrokeColor";
|
|
50558
|
+
operationCopy.color = borderColor;
|
|
50559
|
+
} else {
|
|
50560
|
+
operationCopy.borderColor = borderColor;
|
|
50561
|
+
}
|
|
50562
|
+
operations2[item.itemType] = { ...operationCopy, class: item.itemType, item: [item.getId()] };
|
|
50563
|
+
} else {
|
|
50564
|
+
operations2[item.itemType].item.push(item.getId());
|
|
50565
|
+
}
|
|
50566
|
+
});
|
|
50567
|
+
Object.values(operations2).forEach((op) => {
|
|
50568
|
+
this.emit(op);
|
|
50569
|
+
});
|
|
50556
50570
|
}
|
|
50557
50571
|
setStrokeWidth(width2) {
|
|
50558
|
-
const
|
|
50559
|
-
|
|
50560
|
-
|
|
50561
|
-
|
|
50562
|
-
|
|
50563
|
-
|
|
50564
|
-
|
|
50565
|
-
|
|
50566
|
-
|
|
50567
|
-
|
|
50568
|
-
|
|
50569
|
-
|
|
50570
|
-
|
|
50571
|
-
|
|
50572
|
-
|
|
50573
|
-
|
|
50574
|
-
|
|
50575
|
-
|
|
50576
|
-
|
|
50577
|
-
|
|
50578
|
-
|
|
50579
|
-
|
|
50580
|
-
class:
|
|
50581
|
-
|
|
50582
|
-
item
|
|
50583
|
-
|
|
50584
|
-
|
|
50585
|
-
|
|
50586
|
-
|
|
50572
|
+
const operation = {
|
|
50573
|
+
class: "Shape",
|
|
50574
|
+
method: "setStrokeWidth",
|
|
50575
|
+
item: [],
|
|
50576
|
+
width: width2,
|
|
50577
|
+
newData: { width: width2 }
|
|
50578
|
+
};
|
|
50579
|
+
const operations2 = {};
|
|
50580
|
+
this.items.list().forEach((item) => {
|
|
50581
|
+
if (!operations2[item.itemType]) {
|
|
50582
|
+
const operationCopy = { ...operation };
|
|
50583
|
+
if (item.itemType === "Connector") {
|
|
50584
|
+
operationCopy.method = "setLineWidth";
|
|
50585
|
+
operationCopy.lineWidth = width2;
|
|
50586
|
+
} else if (item.itemType === "Drawing") {
|
|
50587
|
+
operationCopy.method = "setStrokeWidth";
|
|
50588
|
+
operationCopy.width = width2;
|
|
50589
|
+
operationCopy.prevWidth = this.getStrokeWidth();
|
|
50590
|
+
} else {
|
|
50591
|
+
operationCopy.borderWidth = width2;
|
|
50592
|
+
operationCopy.prevBorderWidth = this.getStrokeWidth();
|
|
50593
|
+
}
|
|
50594
|
+
operations2[item.itemType] = { ...operationCopy, class: item.itemType, item: [item.getId()] };
|
|
50595
|
+
} else {
|
|
50596
|
+
operations2[item.itemType].item.push(item.getId());
|
|
50597
|
+
}
|
|
50598
|
+
});
|
|
50599
|
+
Object.values(operations2).forEach((op) => {
|
|
50600
|
+
this.emit(op);
|
|
50601
|
+
});
|
|
50587
50602
|
}
|
|
50588
50603
|
setFillColor(backgroundColor) {
|
|
50589
|
-
const
|
|
50590
|
-
|
|
50591
|
-
|
|
50592
|
-
|
|
50593
|
-
|
|
50594
|
-
|
|
50595
|
-
|
|
50596
|
-
|
|
50597
|
-
|
|
50598
|
-
|
|
50599
|
-
|
|
50600
|
-
|
|
50601
|
-
|
|
50602
|
-
|
|
50603
|
-
|
|
50604
|
-
|
|
50605
|
-
|
|
50606
|
-
}
|
|
50607
|
-
const frames = this.items.getIdsByItemTypes(["Frame"]);
|
|
50608
|
-
if (frames.length) {
|
|
50609
|
-
this.emit({
|
|
50610
|
-
class: "Frame",
|
|
50611
|
-
method: "setBackgroundColor",
|
|
50612
|
-
item: frames,
|
|
50613
|
-
backgroundColor
|
|
50614
|
-
});
|
|
50615
|
-
}
|
|
50604
|
+
const operation = {
|
|
50605
|
+
class: "Shape",
|
|
50606
|
+
method: "setBackgroundColor",
|
|
50607
|
+
item: [],
|
|
50608
|
+
backgroundColor,
|
|
50609
|
+
newData: { backgroundColor }
|
|
50610
|
+
};
|
|
50611
|
+
const operations2 = {};
|
|
50612
|
+
this.items.list().forEach((item) => {
|
|
50613
|
+
if (!operations2[item.itemType]) {
|
|
50614
|
+
operations2[item.itemType] = { ...operation, class: item.itemType, item: [item.getId()] };
|
|
50615
|
+
} else {
|
|
50616
|
+
operations2[item.itemType].item.push(item.getId());
|
|
50617
|
+
}
|
|
50618
|
+
});
|
|
50619
|
+
Object.values(operations2).forEach((op) => {
|
|
50620
|
+
this.emit(op);
|
|
50621
|
+
});
|
|
50616
50622
|
}
|
|
50617
50623
|
setCanChangeRatio(canChangeRatio) {
|
|
50618
50624
|
const frames = this.items.getIdsByItemTypes(["Frame"]);
|