microboard-temp 0.5.17 → 0.5.19
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 +44 -5
- package/dist/cjs/index.js +44 -5
- package/dist/cjs/node.js +44 -5
- package/dist/esm/browser.js +102 -63
- package/dist/esm/index.js +102 -63
- package/dist/esm/node.js +102 -63
- package/dist/types/Items/Examples/CardGame/Dice/Dice.d.ts +4 -2
- package/package.json +1 -1
package/dist/cjs/browser.js
CHANGED
|
@@ -47857,8 +47857,6 @@ class Card extends BaseItem {
|
|
|
47857
47857
|
createImages() {
|
|
47858
47858
|
this.face = conf.documentFactory.createElement("img");
|
|
47859
47859
|
this.backside = conf.documentFactory.createElement("img");
|
|
47860
|
-
this.face.crossOrigin = "anonymous";
|
|
47861
|
-
this.backside.crossOrigin = "anonymous";
|
|
47862
47860
|
this.face.src = this.faceUrl;
|
|
47863
47861
|
this.backside.src = this.backsideUrl;
|
|
47864
47862
|
this.face.onload = () => {
|
|
@@ -48138,15 +48136,21 @@ class Deck extends BaseItem {
|
|
|
48138
48136
|
}
|
|
48139
48137
|
renderHTML(documentFactory) {
|
|
48140
48138
|
const div = super.renderHTML(documentFactory);
|
|
48141
|
-
|
|
48139
|
+
const cards = this.index?.list();
|
|
48140
|
+
const topCard = cards[cards.length - 1];
|
|
48141
|
+
if (!topCard) {
|
|
48142
48142
|
return div;
|
|
48143
48143
|
}
|
|
48144
48144
|
const { translateX, translateY, scaleX, scaleY } = this.transformation.matrix;
|
|
48145
|
-
const transform = `translate(${translateX}px, ${translateY}px) scale(
|
|
48146
|
-
|
|
48145
|
+
const transform = `translate(${translateX}px, ${translateY}px) scale(1, 1)`;
|
|
48146
|
+
const topCardElement = topCard.renderHTML(documentFactory);
|
|
48147
|
+
div.appendChild(topCardElement);
|
|
48148
|
+
const offset = ((this.index?.list().length || 0) - 1) * 2;
|
|
48149
|
+
topCardElement.style.transform = `translate(${offset}px, ${0}px) scale(1, 1)`;
|
|
48147
48150
|
div.id = this.getId();
|
|
48148
48151
|
div.style.width = `${this.getWidth()}px`;
|
|
48149
48152
|
div.style.height = `${this.getHeight()}px`;
|
|
48153
|
+
div.style.boxShadow = `${offset}px 0px 0px 0px rgba(34, 60, 80, 0.74) inset`;
|
|
48150
48154
|
div.style.transformOrigin = "top left";
|
|
48151
48155
|
div.style.transform = transform;
|
|
48152
48156
|
div.style.position = "absolute";
|
|
@@ -48602,6 +48606,41 @@ class Dice extends BaseItem {
|
|
|
48602
48606
|
this.drawingContext = null;
|
|
48603
48607
|
}
|
|
48604
48608
|
}
|
|
48609
|
+
renderHTML(documentFactory) {
|
|
48610
|
+
const div = super.renderHTML(documentFactory);
|
|
48611
|
+
const { translateX, translateY, scaleX, scaleY } = this.transformation.matrix;
|
|
48612
|
+
const mbr = this.getMbr();
|
|
48613
|
+
const width2 = mbr.getWidth();
|
|
48614
|
+
const height3 = mbr.getHeight();
|
|
48615
|
+
const unscaledWidth = width2 / scaleX;
|
|
48616
|
+
const unscaledHeight = height3 / scaleY;
|
|
48617
|
+
const svg3 = documentFactory.createElementNS("http://www.w3.org/2000/svg", "svg");
|
|
48618
|
+
svg3.setAttribute("width", `${unscaledWidth}px`);
|
|
48619
|
+
svg3.setAttribute("height", `${unscaledHeight}px`);
|
|
48620
|
+
svg3.setAttribute("viewBox", `0 0 ${unscaledWidth} ${unscaledHeight}`);
|
|
48621
|
+
svg3.setAttribute("transform-origin", "0 0");
|
|
48622
|
+
svg3.setAttribute("transform", `scale(${1 / scaleX}, ${1 / scaleY})`);
|
|
48623
|
+
svg3.setAttribute("style", "position: absolute; overflow: visible;");
|
|
48624
|
+
const pathElement = Shapes["RoundedRectangle"].path.copy().renderHTML(documentFactory);
|
|
48625
|
+
const paths = Array.isArray(pathElement) ? pathElement : [pathElement];
|
|
48626
|
+
paths.forEach((element4) => {
|
|
48627
|
+
element4.setAttribute("fill", this.backgroundColor);
|
|
48628
|
+
element4.setAttribute("stroke", this.borderColor);
|
|
48629
|
+
element4.setAttribute("stroke-dasharray", LinePatterns[this.borderStyle].join(", "));
|
|
48630
|
+
element4.setAttribute("stroke-width", this.borderWidth.toString());
|
|
48631
|
+
element4.setAttribute("transform-origin", "0 0");
|
|
48632
|
+
element4.setAttribute("transform", `scale(${scaleX}, ${scaleY})`);
|
|
48633
|
+
});
|
|
48634
|
+
svg3.append(...paths);
|
|
48635
|
+
div.appendChild(svg3);
|
|
48636
|
+
div.id = this.getId();
|
|
48637
|
+
div.style.width = unscaledWidth + "px";
|
|
48638
|
+
div.style.height = unscaledHeight + "px";
|
|
48639
|
+
div.style.transformOrigin = "left top";
|
|
48640
|
+
div.style.transform = `translate(${translateX}px, ${translateY}px) scale(${scaleX}, ${scaleY})`;
|
|
48641
|
+
div.style.position = "absolute";
|
|
48642
|
+
return div;
|
|
48643
|
+
}
|
|
48605
48644
|
}
|
|
48606
48645
|
registerItem({
|
|
48607
48646
|
item: Dice,
|
package/dist/cjs/index.js
CHANGED
|
@@ -47857,8 +47857,6 @@ class Card extends BaseItem {
|
|
|
47857
47857
|
createImages() {
|
|
47858
47858
|
this.face = conf.documentFactory.createElement("img");
|
|
47859
47859
|
this.backside = conf.documentFactory.createElement("img");
|
|
47860
|
-
this.face.crossOrigin = "anonymous";
|
|
47861
|
-
this.backside.crossOrigin = "anonymous";
|
|
47862
47860
|
this.face.src = this.faceUrl;
|
|
47863
47861
|
this.backside.src = this.backsideUrl;
|
|
47864
47862
|
this.face.onload = () => {
|
|
@@ -48138,15 +48136,21 @@ class Deck extends BaseItem {
|
|
|
48138
48136
|
}
|
|
48139
48137
|
renderHTML(documentFactory) {
|
|
48140
48138
|
const div = super.renderHTML(documentFactory);
|
|
48141
|
-
|
|
48139
|
+
const cards = this.index?.list();
|
|
48140
|
+
const topCard = cards[cards.length - 1];
|
|
48141
|
+
if (!topCard) {
|
|
48142
48142
|
return div;
|
|
48143
48143
|
}
|
|
48144
48144
|
const { translateX, translateY, scaleX, scaleY } = this.transformation.matrix;
|
|
48145
|
-
const transform = `translate(${translateX}px, ${translateY}px) scale(
|
|
48146
|
-
|
|
48145
|
+
const transform = `translate(${translateX}px, ${translateY}px) scale(1, 1)`;
|
|
48146
|
+
const topCardElement = topCard.renderHTML(documentFactory);
|
|
48147
|
+
div.appendChild(topCardElement);
|
|
48148
|
+
const offset = ((this.index?.list().length || 0) - 1) * 2;
|
|
48149
|
+
topCardElement.style.transform = `translate(${offset}px, ${0}px) scale(1, 1)`;
|
|
48147
48150
|
div.id = this.getId();
|
|
48148
48151
|
div.style.width = `${this.getWidth()}px`;
|
|
48149
48152
|
div.style.height = `${this.getHeight()}px`;
|
|
48153
|
+
div.style.boxShadow = `${offset}px 0px 0px 0px rgba(34, 60, 80, 0.74) inset`;
|
|
48150
48154
|
div.style.transformOrigin = "top left";
|
|
48151
48155
|
div.style.transform = transform;
|
|
48152
48156
|
div.style.position = "absolute";
|
|
@@ -48602,6 +48606,41 @@ class Dice extends BaseItem {
|
|
|
48602
48606
|
this.drawingContext = null;
|
|
48603
48607
|
}
|
|
48604
48608
|
}
|
|
48609
|
+
renderHTML(documentFactory) {
|
|
48610
|
+
const div = super.renderHTML(documentFactory);
|
|
48611
|
+
const { translateX, translateY, scaleX, scaleY } = this.transformation.matrix;
|
|
48612
|
+
const mbr = this.getMbr();
|
|
48613
|
+
const width2 = mbr.getWidth();
|
|
48614
|
+
const height3 = mbr.getHeight();
|
|
48615
|
+
const unscaledWidth = width2 / scaleX;
|
|
48616
|
+
const unscaledHeight = height3 / scaleY;
|
|
48617
|
+
const svg3 = documentFactory.createElementNS("http://www.w3.org/2000/svg", "svg");
|
|
48618
|
+
svg3.setAttribute("width", `${unscaledWidth}px`);
|
|
48619
|
+
svg3.setAttribute("height", `${unscaledHeight}px`);
|
|
48620
|
+
svg3.setAttribute("viewBox", `0 0 ${unscaledWidth} ${unscaledHeight}`);
|
|
48621
|
+
svg3.setAttribute("transform-origin", "0 0");
|
|
48622
|
+
svg3.setAttribute("transform", `scale(${1 / scaleX}, ${1 / scaleY})`);
|
|
48623
|
+
svg3.setAttribute("style", "position: absolute; overflow: visible;");
|
|
48624
|
+
const pathElement = Shapes["RoundedRectangle"].path.copy().renderHTML(documentFactory);
|
|
48625
|
+
const paths = Array.isArray(pathElement) ? pathElement : [pathElement];
|
|
48626
|
+
paths.forEach((element4) => {
|
|
48627
|
+
element4.setAttribute("fill", this.backgroundColor);
|
|
48628
|
+
element4.setAttribute("stroke", this.borderColor);
|
|
48629
|
+
element4.setAttribute("stroke-dasharray", LinePatterns[this.borderStyle].join(", "));
|
|
48630
|
+
element4.setAttribute("stroke-width", this.borderWidth.toString());
|
|
48631
|
+
element4.setAttribute("transform-origin", "0 0");
|
|
48632
|
+
element4.setAttribute("transform", `scale(${scaleX}, ${scaleY})`);
|
|
48633
|
+
});
|
|
48634
|
+
svg3.append(...paths);
|
|
48635
|
+
div.appendChild(svg3);
|
|
48636
|
+
div.id = this.getId();
|
|
48637
|
+
div.style.width = unscaledWidth + "px";
|
|
48638
|
+
div.style.height = unscaledHeight + "px";
|
|
48639
|
+
div.style.transformOrigin = "left top";
|
|
48640
|
+
div.style.transform = `translate(${translateX}px, ${translateY}px) scale(${scaleX}, ${scaleY})`;
|
|
48641
|
+
div.style.position = "absolute";
|
|
48642
|
+
return div;
|
|
48643
|
+
}
|
|
48605
48644
|
}
|
|
48606
48645
|
registerItem({
|
|
48607
48646
|
item: Dice,
|
package/dist/cjs/node.js
CHANGED
|
@@ -50330,8 +50330,6 @@ class Card extends BaseItem {
|
|
|
50330
50330
|
createImages() {
|
|
50331
50331
|
this.face = conf.documentFactory.createElement("img");
|
|
50332
50332
|
this.backside = conf.documentFactory.createElement("img");
|
|
50333
|
-
this.face.crossOrigin = "anonymous";
|
|
50334
|
-
this.backside.crossOrigin = "anonymous";
|
|
50335
50333
|
this.face.src = this.faceUrl;
|
|
50336
50334
|
this.backside.src = this.backsideUrl;
|
|
50337
50335
|
this.face.onload = () => {
|
|
@@ -50611,15 +50609,21 @@ class Deck extends BaseItem {
|
|
|
50611
50609
|
}
|
|
50612
50610
|
renderHTML(documentFactory) {
|
|
50613
50611
|
const div = super.renderHTML(documentFactory);
|
|
50614
|
-
|
|
50612
|
+
const cards = this.index?.list();
|
|
50613
|
+
const topCard = cards[cards.length - 1];
|
|
50614
|
+
if (!topCard) {
|
|
50615
50615
|
return div;
|
|
50616
50616
|
}
|
|
50617
50617
|
const { translateX, translateY, scaleX, scaleY } = this.transformation.matrix;
|
|
50618
|
-
const transform = `translate(${translateX}px, ${translateY}px) scale(
|
|
50619
|
-
|
|
50618
|
+
const transform = `translate(${translateX}px, ${translateY}px) scale(1, 1)`;
|
|
50619
|
+
const topCardElement = topCard.renderHTML(documentFactory);
|
|
50620
|
+
div.appendChild(topCardElement);
|
|
50621
|
+
const offset = ((this.index?.list().length || 0) - 1) * 2;
|
|
50622
|
+
topCardElement.style.transform = `translate(${offset}px, ${0}px) scale(1, 1)`;
|
|
50620
50623
|
div.id = this.getId();
|
|
50621
50624
|
div.style.width = `${this.getWidth()}px`;
|
|
50622
50625
|
div.style.height = `${this.getHeight()}px`;
|
|
50626
|
+
div.style.boxShadow = `${offset}px 0px 0px 0px rgba(34, 60, 80, 0.74) inset`;
|
|
50623
50627
|
div.style.transformOrigin = "top left";
|
|
50624
50628
|
div.style.transform = transform;
|
|
50625
50629
|
div.style.position = "absolute";
|
|
@@ -51075,6 +51079,41 @@ class Dice extends BaseItem {
|
|
|
51075
51079
|
this.drawingContext = null;
|
|
51076
51080
|
}
|
|
51077
51081
|
}
|
|
51082
|
+
renderHTML(documentFactory) {
|
|
51083
|
+
const div = super.renderHTML(documentFactory);
|
|
51084
|
+
const { translateX, translateY, scaleX, scaleY } = this.transformation.matrix;
|
|
51085
|
+
const mbr = this.getMbr();
|
|
51086
|
+
const width2 = mbr.getWidth();
|
|
51087
|
+
const height3 = mbr.getHeight();
|
|
51088
|
+
const unscaledWidth = width2 / scaleX;
|
|
51089
|
+
const unscaledHeight = height3 / scaleY;
|
|
51090
|
+
const svg3 = documentFactory.createElementNS("http://www.w3.org/2000/svg", "svg");
|
|
51091
|
+
svg3.setAttribute("width", `${unscaledWidth}px`);
|
|
51092
|
+
svg3.setAttribute("height", `${unscaledHeight}px`);
|
|
51093
|
+
svg3.setAttribute("viewBox", `0 0 ${unscaledWidth} ${unscaledHeight}`);
|
|
51094
|
+
svg3.setAttribute("transform-origin", "0 0");
|
|
51095
|
+
svg3.setAttribute("transform", `scale(${1 / scaleX}, ${1 / scaleY})`);
|
|
51096
|
+
svg3.setAttribute("style", "position: absolute; overflow: visible;");
|
|
51097
|
+
const pathElement = Shapes["RoundedRectangle"].path.copy().renderHTML(documentFactory);
|
|
51098
|
+
const paths = Array.isArray(pathElement) ? pathElement : [pathElement];
|
|
51099
|
+
paths.forEach((element3) => {
|
|
51100
|
+
element3.setAttribute("fill", this.backgroundColor);
|
|
51101
|
+
element3.setAttribute("stroke", this.borderColor);
|
|
51102
|
+
element3.setAttribute("stroke-dasharray", LinePatterns[this.borderStyle].join(", "));
|
|
51103
|
+
element3.setAttribute("stroke-width", this.borderWidth.toString());
|
|
51104
|
+
element3.setAttribute("transform-origin", "0 0");
|
|
51105
|
+
element3.setAttribute("transform", `scale(${scaleX}, ${scaleY})`);
|
|
51106
|
+
});
|
|
51107
|
+
svg3.append(...paths);
|
|
51108
|
+
div.appendChild(svg3);
|
|
51109
|
+
div.id = this.getId();
|
|
51110
|
+
div.style.width = unscaledWidth + "px";
|
|
51111
|
+
div.style.height = unscaledHeight + "px";
|
|
51112
|
+
div.style.transformOrigin = "left top";
|
|
51113
|
+
div.style.transform = `translate(${translateX}px, ${translateY}px) scale(${scaleX}, ${scaleY})`;
|
|
51114
|
+
div.style.position = "absolute";
|
|
51115
|
+
return div;
|
|
51116
|
+
}
|
|
51078
51117
|
}
|
|
51079
51118
|
registerItem({
|
|
51080
51119
|
item: Dice,
|