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/esm/node.js
CHANGED
|
@@ -50164,8 +50164,6 @@ class Card extends BaseItem {
|
|
|
50164
50164
|
createImages() {
|
|
50165
50165
|
this.face = conf.documentFactory.createElement("img");
|
|
50166
50166
|
this.backside = conf.documentFactory.createElement("img");
|
|
50167
|
-
this.face.crossOrigin = "anonymous";
|
|
50168
|
-
this.backside.crossOrigin = "anonymous";
|
|
50169
50167
|
this.face.src = this.faceUrl;
|
|
50170
50168
|
this.backside.src = this.backsideUrl;
|
|
50171
50169
|
this.face.onload = () => {
|
|
@@ -50445,15 +50443,21 @@ class Deck extends BaseItem {
|
|
|
50445
50443
|
}
|
|
50446
50444
|
renderHTML(documentFactory) {
|
|
50447
50445
|
const div = super.renderHTML(documentFactory);
|
|
50448
|
-
|
|
50446
|
+
const cards = this.index?.list();
|
|
50447
|
+
const topCard = cards[cards.length - 1];
|
|
50448
|
+
if (!topCard) {
|
|
50449
50449
|
return div;
|
|
50450
50450
|
}
|
|
50451
50451
|
const { translateX, translateY, scaleX, scaleY } = this.transformation.matrix;
|
|
50452
|
-
const transform = `translate(${translateX}px, ${translateY}px) scale(
|
|
50453
|
-
|
|
50452
|
+
const transform = `translate(${translateX}px, ${translateY}px) scale(1, 1)`;
|
|
50453
|
+
const topCardElement = topCard.renderHTML(documentFactory);
|
|
50454
|
+
div.appendChild(topCardElement);
|
|
50455
|
+
const offset = ((this.index?.list().length || 0) - 1) * 2;
|
|
50456
|
+
topCardElement.style.transform = `translate(${offset}px, ${0}px) scale(1, 1)`;
|
|
50454
50457
|
div.id = this.getId();
|
|
50455
50458
|
div.style.width = `${this.getWidth()}px`;
|
|
50456
50459
|
div.style.height = `${this.getHeight()}px`;
|
|
50460
|
+
div.style.boxShadow = `${offset}px 0px 0px 0px rgba(34, 60, 80, 0.74) inset`;
|
|
50457
50461
|
div.style.transformOrigin = "top left";
|
|
50458
50462
|
div.style.transform = transform;
|
|
50459
50463
|
div.style.position = "absolute";
|
|
@@ -50909,6 +50913,41 @@ class Dice extends BaseItem {
|
|
|
50909
50913
|
this.drawingContext = null;
|
|
50910
50914
|
}
|
|
50911
50915
|
}
|
|
50916
|
+
renderHTML(documentFactory) {
|
|
50917
|
+
const div = super.renderHTML(documentFactory);
|
|
50918
|
+
const { translateX, translateY, scaleX, scaleY } = this.transformation.matrix;
|
|
50919
|
+
const mbr = this.getMbr();
|
|
50920
|
+
const width2 = mbr.getWidth();
|
|
50921
|
+
const height3 = mbr.getHeight();
|
|
50922
|
+
const unscaledWidth = width2 / scaleX;
|
|
50923
|
+
const unscaledHeight = height3 / scaleY;
|
|
50924
|
+
const svg3 = documentFactory.createElementNS("http://www.w3.org/2000/svg", "svg");
|
|
50925
|
+
svg3.setAttribute("width", `${unscaledWidth}px`);
|
|
50926
|
+
svg3.setAttribute("height", `${unscaledHeight}px`);
|
|
50927
|
+
svg3.setAttribute("viewBox", `0 0 ${unscaledWidth} ${unscaledHeight}`);
|
|
50928
|
+
svg3.setAttribute("transform-origin", "0 0");
|
|
50929
|
+
svg3.setAttribute("transform", `scale(${1 / scaleX}, ${1 / scaleY})`);
|
|
50930
|
+
svg3.setAttribute("style", "position: absolute; overflow: visible;");
|
|
50931
|
+
const pathElement = Shapes["RoundedRectangle"].path.copy().renderHTML(documentFactory);
|
|
50932
|
+
const paths = Array.isArray(pathElement) ? pathElement : [pathElement];
|
|
50933
|
+
paths.forEach((element3) => {
|
|
50934
|
+
element3.setAttribute("fill", this.backgroundColor);
|
|
50935
|
+
element3.setAttribute("stroke", this.borderColor);
|
|
50936
|
+
element3.setAttribute("stroke-dasharray", LinePatterns[this.borderStyle].join(", "));
|
|
50937
|
+
element3.setAttribute("stroke-width", this.borderWidth.toString());
|
|
50938
|
+
element3.setAttribute("transform-origin", "0 0");
|
|
50939
|
+
element3.setAttribute("transform", `scale(${scaleX}, ${scaleY})`);
|
|
50940
|
+
});
|
|
50941
|
+
svg3.append(...paths);
|
|
50942
|
+
div.appendChild(svg3);
|
|
50943
|
+
div.id = this.getId();
|
|
50944
|
+
div.style.width = unscaledWidth + "px";
|
|
50945
|
+
div.style.height = unscaledHeight + "px";
|
|
50946
|
+
div.style.transformOrigin = "left top";
|
|
50947
|
+
div.style.transform = `translate(${translateX}px, ${translateY}px) scale(${scaleX}, ${scaleY})`;
|
|
50948
|
+
div.style.position = "absolute";
|
|
50949
|
+
return div;
|
|
50950
|
+
}
|
|
50912
50951
|
}
|
|
50913
50952
|
registerItem({
|
|
50914
50953
|
item: Dice,
|
|
@@ -56551,7 +56590,7 @@ class Board {
|
|
|
56551
56590
|
}
|
|
56552
56591
|
}
|
|
56553
56592
|
// src/Events/Merge.ts
|
|
56554
|
-
import { Path as
|
|
56593
|
+
import { Path as Path14 } from "slate";
|
|
56555
56594
|
function areItemsTheSame(opA, opB) {
|
|
56556
56595
|
if (opA.method === "transformMany" && opB.method === "transformMany") {
|
|
56557
56596
|
const itemsA = Object.keys(opA.items);
|
|
@@ -56784,7 +56823,7 @@ function mergeRichTextOperations(opA, opB) {
|
|
|
56784
56823
|
ops: [...opA.ops, ...opB.ops]
|
|
56785
56824
|
};
|
|
56786
56825
|
}
|
|
56787
|
-
if (B.type === "insert_text" && A.type === "insert_text" && B.offset === A.offset + A.text.length &&
|
|
56826
|
+
if (B.type === "insert_text" && A.type === "insert_text" && B.offset === A.offset + A.text.length && Path14.equals(B.path, A.path)) {
|
|
56788
56827
|
return {
|
|
56789
56828
|
...opB,
|
|
56790
56829
|
ops: [
|
|
@@ -56796,7 +56835,7 @@ function mergeRichTextOperations(opA, opB) {
|
|
|
56796
56835
|
]
|
|
56797
56836
|
};
|
|
56798
56837
|
}
|
|
56799
|
-
if (B.type === "remove_text" && A.type === "remove_text" && B.offset + B.text.length === A.offset &&
|
|
56838
|
+
if (B.type === "remove_text" && A.type === "remove_text" && B.offset + B.text.length === A.offset && Path14.equals(B.path, A.path)) {
|
|
56800
56839
|
return {
|
|
56801
56840
|
...opB,
|
|
56802
56841
|
ops: [
|
|
@@ -56808,7 +56847,7 @@ function mergeRichTextOperations(opA, opB) {
|
|
|
56808
56847
|
]
|
|
56809
56848
|
};
|
|
56810
56849
|
}
|
|
56811
|
-
if (B.type === "split_node" && A.type === "split_node" &&
|
|
56850
|
+
if (B.type === "split_node" && A.type === "split_node" && Path14.isChild(A.path, B.path)) {
|
|
56812
56851
|
return {
|
|
56813
56852
|
...opB,
|
|
56814
56853
|
ops: [...opA.ops, ...opB.ops]
|
|
@@ -56960,10 +56999,10 @@ function createSyncLog() {
|
|
|
56960
56999
|
}
|
|
56961
57000
|
|
|
56962
57001
|
// src/Events/Transform/removeText_removeText.ts
|
|
56963
|
-
import { Path as
|
|
57002
|
+
import { Path as Path15 } from "slate";
|
|
56964
57003
|
function removeText_removeText(confirmed, toTransform) {
|
|
56965
57004
|
const transformed = { ...toTransform };
|
|
56966
|
-
if (
|
|
57005
|
+
if (Path15.equals(confirmed.path, toTransform.path)) {
|
|
56967
57006
|
const confirmedStart = confirmed.offset;
|
|
56968
57007
|
const confirmedEnd = confirmed.offset + confirmed.text.length;
|
|
56969
57008
|
const toTransformStart = toTransform.offset;
|
|
@@ -56992,10 +57031,10 @@ function removeText_removeText(confirmed, toTransform) {
|
|
|
56992
57031
|
}
|
|
56993
57032
|
|
|
56994
57033
|
// src/Events/Transform/insertText_insertText.ts
|
|
56995
|
-
import { Path as
|
|
57034
|
+
import { Path as Path16 } from "slate";
|
|
56996
57035
|
function insertText_insertText(confirmed, toTransform) {
|
|
56997
57036
|
const transformed = { ...toTransform };
|
|
56998
|
-
if (
|
|
57037
|
+
if (Path16.equals(confirmed.path, toTransform.path)) {
|
|
56999
57038
|
if (confirmed.offset <= toTransform.offset) {
|
|
57000
57039
|
transformed.offset += confirmed.text.length;
|
|
57001
57040
|
}
|
|
@@ -57004,10 +57043,10 @@ function insertText_insertText(confirmed, toTransform) {
|
|
|
57004
57043
|
}
|
|
57005
57044
|
|
|
57006
57045
|
// src/Events/Transform/removeText_insertText.ts
|
|
57007
|
-
import { Path as
|
|
57046
|
+
import { Path as Path17 } from "slate";
|
|
57008
57047
|
function removeText_insertText(confirmed, toTransform) {
|
|
57009
57048
|
const transformed = { ...toTransform };
|
|
57010
|
-
if (
|
|
57049
|
+
if (Path17.equals(confirmed.path, toTransform.path)) {
|
|
57011
57050
|
if (confirmed.offset <= toTransform.offset) {
|
|
57012
57051
|
transformed.offset -= confirmed.text.length;
|
|
57013
57052
|
}
|
|
@@ -57016,17 +57055,17 @@ function removeText_insertText(confirmed, toTransform) {
|
|
|
57016
57055
|
}
|
|
57017
57056
|
|
|
57018
57057
|
// src/Events/Transform/splitNode_insertText.ts
|
|
57019
|
-
import { Path as
|
|
57058
|
+
import { Path as Path19 } from "slate";
|
|
57020
57059
|
|
|
57021
57060
|
// src/Events/Transform/transformPath.ts
|
|
57022
|
-
import { Path as
|
|
57061
|
+
import { Path as Path18 } from "slate";
|
|
57023
57062
|
function transformPath(confirmed, toTransform) {
|
|
57024
|
-
const newPath =
|
|
57063
|
+
const newPath = Path18.transform(toTransform.path, confirmed);
|
|
57025
57064
|
if (newPath) {
|
|
57026
57065
|
toTransform.path = newPath;
|
|
57027
57066
|
}
|
|
57028
57067
|
if ("newPath" in toTransform) {
|
|
57029
|
-
const newPathUpdated =
|
|
57068
|
+
const newPathUpdated = Path18.transform(toTransform.newPath, confirmed);
|
|
57030
57069
|
if (newPathUpdated) {
|
|
57031
57070
|
toTransform.newPath = newPathUpdated;
|
|
57032
57071
|
}
|
|
@@ -57038,7 +57077,7 @@ function splitNode_insertText(confirmed, toTransform) {
|
|
|
57038
57077
|
const transformed = { ...toTransform };
|
|
57039
57078
|
const confPath = confirmed.path;
|
|
57040
57079
|
const tPath = transformed.path;
|
|
57041
|
-
if (
|
|
57080
|
+
if (Path19.equals(confPath, tPath)) {
|
|
57042
57081
|
if (transformed.offset >= confirmed.position) {
|
|
57043
57082
|
transformed.offset -= confirmed.position;
|
|
57044
57083
|
transformed.path = [...confPath];
|
|
@@ -57065,10 +57104,10 @@ function insertNode_insertText(confirmed, toTransform) {
|
|
|
57065
57104
|
}
|
|
57066
57105
|
|
|
57067
57106
|
// src/Events/Transform/mergeNode_insertText.ts
|
|
57068
|
-
import { Path as
|
|
57107
|
+
import { Path as Path20 } from "slate";
|
|
57069
57108
|
function mergeNode_insertText(confirmed, toTransform) {
|
|
57070
57109
|
const transformed = { ...toTransform };
|
|
57071
|
-
if (
|
|
57110
|
+
if (Path20.equals(confirmed.path, transformed.path)) {
|
|
57072
57111
|
transformed.offset += confirmed.position;
|
|
57073
57112
|
return transformed;
|
|
57074
57113
|
}
|
|
@@ -57077,10 +57116,10 @@ function mergeNode_insertText(confirmed, toTransform) {
|
|
|
57077
57116
|
}
|
|
57078
57117
|
|
|
57079
57118
|
// src/Events/Transform/insertText_removeText.ts
|
|
57080
|
-
import { Path as
|
|
57119
|
+
import { Path as Path21 } from "slate";
|
|
57081
57120
|
function insertText_removeText(confirmed, toTransform) {
|
|
57082
57121
|
const transformed = { ...toTransform };
|
|
57083
|
-
if (
|
|
57122
|
+
if (Path21.equals(confirmed.path, toTransform.path)) {
|
|
57084
57123
|
if (confirmed.offset <= toTransform.offset) {
|
|
57085
57124
|
transformed.offset += confirmed.text.length;
|
|
57086
57125
|
}
|
|
@@ -57096,10 +57135,10 @@ function insertNode_removeText(confirmed, toTransform) {
|
|
|
57096
57135
|
}
|
|
57097
57136
|
|
|
57098
57137
|
// src/Events/Transform/splitNode_removeText.ts
|
|
57099
|
-
import { Path as
|
|
57138
|
+
import { Path as Path22 } from "slate";
|
|
57100
57139
|
function splitNode_removeText(confirmed, toTransform) {
|
|
57101
57140
|
const transformed = { ...toTransform };
|
|
57102
|
-
if (
|
|
57141
|
+
if (Path22.equals(confirmed.path, transformed.path)) {
|
|
57103
57142
|
if (confirmed.position <= transformed.offset) {
|
|
57104
57143
|
transformed.offset -= confirmed.position;
|
|
57105
57144
|
}
|
|
@@ -57118,10 +57157,10 @@ function splitNode_removeText(confirmed, toTransform) {
|
|
|
57118
57157
|
}
|
|
57119
57158
|
|
|
57120
57159
|
// src/Events/Transform/mergeNode_removeText.ts
|
|
57121
|
-
import { Path as
|
|
57160
|
+
import { Path as Path23 } from "slate";
|
|
57122
57161
|
function mergeNode_removeText(confirmed, toTransform) {
|
|
57123
57162
|
const transformed = { ...toTransform };
|
|
57124
|
-
if (
|
|
57163
|
+
if (Path23.equals(confirmed.path, toTransform.path)) {
|
|
57125
57164
|
transformed.offset += confirmed.position;
|
|
57126
57165
|
}
|
|
57127
57166
|
transformPath(confirmed, transformed);
|
|
@@ -57192,12 +57231,12 @@ function removeNode_removeNode(confirmed, toTransform) {
|
|
|
57192
57231
|
}
|
|
57193
57232
|
|
|
57194
57233
|
// src/Events/Transform/splitNode_insertNode.ts
|
|
57195
|
-
import { Path as
|
|
57234
|
+
import { Path as Path24 } from "slate";
|
|
57196
57235
|
function splitNode_insertNode(confirmed, toTransform) {
|
|
57197
57236
|
const transformed = { ...toTransform };
|
|
57198
57237
|
const conf2 = confirmed.path;
|
|
57199
57238
|
const path2 = transformed.path;
|
|
57200
|
-
if (
|
|
57239
|
+
if (Path24.equals(conf2, path2)) {
|
|
57201
57240
|
return transformed;
|
|
57202
57241
|
}
|
|
57203
57242
|
const isDescendant = path2.length > conf2.length && path2.slice(0, conf2.length).every((seg, i) => seg === conf2[i]);
|
|
@@ -57207,19 +57246,19 @@ function splitNode_insertNode(confirmed, toTransform) {
|
|
|
57207
57246
|
transformed.path = newPath;
|
|
57208
57247
|
return transformed;
|
|
57209
57248
|
}
|
|
57210
|
-
if (
|
|
57249
|
+
if (Path24.isBefore(conf2, path2)) {
|
|
57211
57250
|
transformPath(confirmed, transformed);
|
|
57212
57251
|
}
|
|
57213
57252
|
return transformed;
|
|
57214
57253
|
}
|
|
57215
57254
|
|
|
57216
57255
|
// src/Events/Transform/splitNode_removeNode.ts
|
|
57217
|
-
import { Path as
|
|
57256
|
+
import { Path as Path25 } from "slate";
|
|
57218
57257
|
function splitNode_removeNode(confirmed, toTransform) {
|
|
57219
57258
|
const transformed = { ...toTransform };
|
|
57220
57259
|
const conf2 = confirmed.path;
|
|
57221
57260
|
const path2 = transformed.path;
|
|
57222
|
-
if (
|
|
57261
|
+
if (Path25.equals(conf2, path2)) {
|
|
57223
57262
|
return transformed;
|
|
57224
57263
|
}
|
|
57225
57264
|
if (path2.length === conf2.length + 1 && path2.slice(0, conf2.length).every((seg, i) => seg === conf2[i])) {
|
|
@@ -57233,18 +57272,18 @@ function splitNode_removeNode(confirmed, toTransform) {
|
|
|
57233
57272
|
return transformed;
|
|
57234
57273
|
}
|
|
57235
57274
|
const isDescendant = path2.length > conf2.length && path2.slice(0, conf2.length).every((seg, i) => seg === conf2[i]);
|
|
57236
|
-
if (
|
|
57275
|
+
if (Path25.isBefore(conf2, path2) && !isDescendant) {
|
|
57237
57276
|
transformPath(confirmed, transformed);
|
|
57238
57277
|
}
|
|
57239
57278
|
return transformed;
|
|
57240
57279
|
}
|
|
57241
57280
|
|
|
57242
57281
|
// src/Events/Transform/mergeNode_insertNode.ts
|
|
57243
|
-
import { Path as
|
|
57282
|
+
import { Path as Path26 } from "slate";
|
|
57244
57283
|
function mergeNode_insertNode(confirmed, toTransform) {
|
|
57245
57284
|
const transformed = { ...toTransform };
|
|
57246
|
-
const isDescendant =
|
|
57247
|
-
const isAfter =
|
|
57285
|
+
const isDescendant = Path26.isAncestor(confirmed.path, transformed.path);
|
|
57286
|
+
const isAfter = Path26.isBefore(confirmed.path, transformed.path);
|
|
57248
57287
|
if (confirmed.path.length === 1 && isAfter && !isDescendant || confirmed.path.length > 1 && (isAfter || isDescendant)) {
|
|
57249
57288
|
transformPath(confirmed, transformed);
|
|
57250
57289
|
}
|
|
@@ -57252,40 +57291,40 @@ function mergeNode_insertNode(confirmed, toTransform) {
|
|
|
57252
57291
|
}
|
|
57253
57292
|
|
|
57254
57293
|
// src/Events/Transform/mergeNode_removeNode.ts
|
|
57255
|
-
import { Path as
|
|
57294
|
+
import { Path as Path27 } from "slate";
|
|
57256
57295
|
function mergeNode_removeNode(confirmed, toTransform) {
|
|
57257
57296
|
const transformed = { ...toTransform };
|
|
57258
|
-
if (
|
|
57297
|
+
if (Path27.isBefore(confirmed.path, transformed.path)) {
|
|
57259
57298
|
transformPath(confirmed, transformed);
|
|
57260
57299
|
}
|
|
57261
57300
|
return transformed;
|
|
57262
57301
|
}
|
|
57263
57302
|
|
|
57264
57303
|
// src/Events/Transform/setNode_insertNode.ts
|
|
57265
|
-
import { Path as
|
|
57304
|
+
import { Path as Path28 } from "slate";
|
|
57266
57305
|
function setNode_insertNode(confirmed, toTransform) {
|
|
57267
57306
|
const transformed = { ...toTransform };
|
|
57268
|
-
if (
|
|
57307
|
+
if (Path28.isBefore(confirmed.path, transformed.path)) {
|
|
57269
57308
|
transformPath(confirmed, transformed);
|
|
57270
57309
|
}
|
|
57271
57310
|
return transformed;
|
|
57272
57311
|
}
|
|
57273
57312
|
|
|
57274
57313
|
// src/Events/Transform/setNode_removeNode.ts
|
|
57275
|
-
import { Path as
|
|
57314
|
+
import { Path as Path29 } from "slate";
|
|
57276
57315
|
function setNode_removeNode(confirmed, toTransform) {
|
|
57277
57316
|
const transformed = { ...toTransform };
|
|
57278
|
-
if (
|
|
57317
|
+
if (Path29.isBefore(confirmed.path, transformed.path)) {
|
|
57279
57318
|
transformPath(confirmed, transformed);
|
|
57280
57319
|
}
|
|
57281
57320
|
return transformed;
|
|
57282
57321
|
}
|
|
57283
57322
|
|
|
57284
57323
|
// src/Events/Transform/insertText_mergeNode.ts
|
|
57285
|
-
import { Path as
|
|
57324
|
+
import { Path as Path30 } from "slate";
|
|
57286
57325
|
function insertText_mergeNode(confirmed, toTransform) {
|
|
57287
57326
|
const transformed = { ...toTransform };
|
|
57288
|
-
if (
|
|
57327
|
+
if (Path30.isBefore(confirmed.path, toTransform.path) && Path30.isSibling(confirmed.path, toTransform.path)) {
|
|
57289
57328
|
if (confirmed.offset <= toTransform.position) {
|
|
57290
57329
|
transformed.position += confirmed.text.length;
|
|
57291
57330
|
}
|
|
@@ -57326,12 +57365,12 @@ function removeNode_mergeNode(confirmed, toTransform) {
|
|
|
57326
57365
|
}
|
|
57327
57366
|
|
|
57328
57367
|
// src/Events/Transform/splitNode_mergeNode.ts
|
|
57329
|
-
import { Path as
|
|
57368
|
+
import { Path as Path31 } from "slate";
|
|
57330
57369
|
function splitNode_mergeNode(confirmed, toTransform) {
|
|
57331
57370
|
const transformed = { ...toTransform };
|
|
57332
57371
|
const confPath = confirmed.path;
|
|
57333
57372
|
const tPath = transformed.path;
|
|
57334
|
-
if (
|
|
57373
|
+
if (Path31.equals(confPath, tPath)) {
|
|
57335
57374
|
if (confirmed.position <= transformed.position) {
|
|
57336
57375
|
transformed.position -= confirmed.position;
|
|
57337
57376
|
}
|
|
@@ -57342,10 +57381,10 @@ function splitNode_mergeNode(confirmed, toTransform) {
|
|
|
57342
57381
|
}
|
|
57343
57382
|
|
|
57344
57383
|
// src/Events/Transform/mergeNode_mergeNode.ts
|
|
57345
|
-
import { Path as
|
|
57384
|
+
import { Path as Path32 } from "slate";
|
|
57346
57385
|
function mergeNode_mergeNode(confirmed, toTransform) {
|
|
57347
57386
|
const transformed = { ...toTransform };
|
|
57348
|
-
if (
|
|
57387
|
+
if (Path32.equals(confirmed.path, transformed.path)) {
|
|
57349
57388
|
transformed.position += confirmed.position;
|
|
57350
57389
|
return transformed;
|
|
57351
57390
|
}
|
|
@@ -57360,10 +57399,10 @@ function mergeNode_mergeNode(confirmed, toTransform) {
|
|
|
57360
57399
|
}
|
|
57361
57400
|
|
|
57362
57401
|
// src/Events/Transform/insertText_splitNode.ts
|
|
57363
|
-
import { Path as
|
|
57402
|
+
import { Path as Path33 } from "slate";
|
|
57364
57403
|
function insertText_splitNode(confirmed, toTransform) {
|
|
57365
57404
|
const transformed = { ...toTransform };
|
|
57366
|
-
const newPath =
|
|
57405
|
+
const newPath = Path33.transform(transformed.path, confirmed);
|
|
57367
57406
|
if (newPath) {
|
|
57368
57407
|
transformed.path = newPath;
|
|
57369
57408
|
}
|
|
@@ -57406,12 +57445,12 @@ function removeNode_splitNode(confirmed, toTransform) {
|
|
|
57406
57445
|
}
|
|
57407
57446
|
|
|
57408
57447
|
// src/Events/Transform/mergeNode_splitNode.ts
|
|
57409
|
-
import { Path as
|
|
57448
|
+
import { Path as Path34 } from "slate";
|
|
57410
57449
|
function mergeNode_splitNode(confirmed, toTransform) {
|
|
57411
57450
|
const transformed = { ...toTransform };
|
|
57412
57451
|
const rem = confirmed.path;
|
|
57413
57452
|
const orig = transformed.path;
|
|
57414
|
-
if (
|
|
57453
|
+
if (Path34.equals(rem, orig)) {
|
|
57415
57454
|
transformed.position += confirmed.position;
|
|
57416
57455
|
return transformed;
|
|
57417
57456
|
}
|
|
@@ -57422,7 +57461,7 @@ function mergeNode_splitNode(confirmed, toTransform) {
|
|
|
57422
57461
|
if (rem.length > 1) {
|
|
57423
57462
|
const depth = rem.length - 1;
|
|
57424
57463
|
const prefix2 = rem.slice(0, depth);
|
|
57425
|
-
if (newPath.length > depth &&
|
|
57464
|
+
if (newPath.length > depth && Path34.equals(prefix2, newPath.slice(0, depth)) && newPath[depth] > rem[depth]) {
|
|
57426
57465
|
newPath[depth] = newPath[depth] - 1;
|
|
57427
57466
|
}
|
|
57428
57467
|
}
|
|
@@ -57431,10 +57470,10 @@ function mergeNode_splitNode(confirmed, toTransform) {
|
|
|
57431
57470
|
}
|
|
57432
57471
|
|
|
57433
57472
|
// src/Events/Transform/splitNode_splitNode.ts
|
|
57434
|
-
import { Path as
|
|
57473
|
+
import { Path as Path35 } from "slate";
|
|
57435
57474
|
function splitNode_splitNode(confirmed, toTransform) {
|
|
57436
57475
|
const transformed = { ...toTransform };
|
|
57437
|
-
const samePath =
|
|
57476
|
+
const samePath = Path35.equals(confirmed.path, transformed.path);
|
|
57438
57477
|
if (samePath && confirmed.position <= transformed.position) {
|
|
57439
57478
|
transformed.position -= confirmed.position;
|
|
57440
57479
|
}
|
|
@@ -57458,12 +57497,12 @@ function setNode_splitNode(confirmed, toTransform) {
|
|
|
57458
57497
|
}
|
|
57459
57498
|
|
|
57460
57499
|
// src/Events/Transform/splitNode_setNode.ts
|
|
57461
|
-
import { Path as
|
|
57500
|
+
import { Path as Path36 } from "slate";
|
|
57462
57501
|
function splitNode_setNode(confirmed, toTransform) {
|
|
57463
57502
|
const transformed = { ...toTransform };
|
|
57464
57503
|
const confirmedPath = confirmed.path;
|
|
57465
57504
|
const currentPath = transformed.path;
|
|
57466
|
-
const isSame =
|
|
57505
|
+
const isSame = Path36.equals(currentPath, confirmedPath);
|
|
57467
57506
|
const isDeepNestedDescendant = confirmedPath.length > 1 && currentPath.length > confirmedPath.length && currentPath.slice(0, confirmedPath.length).every((seg, i) => seg === confirmedPath[i]);
|
|
57468
57507
|
if (!isSame && !isDeepNestedDescendant) {
|
|
57469
57508
|
transformPath(confirmed, transformed);
|
|
@@ -57486,11 +57525,11 @@ function insertNode_setNode(confirmed, toTransform) {
|
|
|
57486
57525
|
}
|
|
57487
57526
|
|
|
57488
57527
|
// src/Events/Transform/removeNode_setNode.ts
|
|
57489
|
-
import { Path as
|
|
57528
|
+
import { Path as Path37 } from "slate";
|
|
57490
57529
|
function removeNode_setNode(confirmed, toTransform) {
|
|
57491
57530
|
const removalPath = confirmed.path;
|
|
57492
57531
|
const originalPath = toTransform.path;
|
|
57493
|
-
if (
|
|
57532
|
+
if (Path37.equals(removalPath, originalPath)) {
|
|
57494
57533
|
return;
|
|
57495
57534
|
}
|
|
57496
57535
|
const transformedOp = { ...toTransform };
|
|
@@ -57501,7 +57540,7 @@ function removeNode_setNode(confirmed, toTransform) {
|
|
|
57501
57540
|
if (removalPath.length > 1) {
|
|
57502
57541
|
const depthIndex = removalPath.length - 1;
|
|
57503
57542
|
const parentPrefix = removalPath.slice(0, depthIndex);
|
|
57504
|
-
if (newPath.length > depthIndex &&
|
|
57543
|
+
if (newPath.length > depthIndex && Path37.equals(parentPrefix, newPath.slice(0, depthIndex)) && newPath[depthIndex] > removalPath[depthIndex]) {
|
|
57505
57544
|
newPath[depthIndex] = newPath[depthIndex] - 1;
|
|
57506
57545
|
}
|
|
57507
57546
|
}
|
|
@@ -57510,10 +57549,10 @@ function removeNode_setNode(confirmed, toTransform) {
|
|
|
57510
57549
|
}
|
|
57511
57550
|
|
|
57512
57551
|
// src/Events/Transform/setNode_setNode.ts
|
|
57513
|
-
import { Path as
|
|
57552
|
+
import { Path as Path38 } from "slate";
|
|
57514
57553
|
function setNode_setNode(confirmed, toTransform) {
|
|
57515
57554
|
const transformed = { ...toTransform };
|
|
57516
|
-
if (
|
|
57555
|
+
if (Path38.equals(confirmed.path, toTransform.path)) {
|
|
57517
57556
|
transformed.newProperties = {
|
|
57518
57557
|
...toTransform.newProperties,
|
|
57519
57558
|
...confirmed.newProperties
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import { BaseItem, BaseItemData, SerializedItemData } from "../../../BaseItem/BaseItem";
|
|
2
|
-
import { BorderWidth, Path } from "
|
|
2
|
+
import { BorderWidth, Path } from "../../../../Items";
|
|
3
3
|
import { Subject } from "../../../../Subject";
|
|
4
4
|
import { Board } from "../../../../Board";
|
|
5
|
-
import { DrawingContext } from "
|
|
5
|
+
import { DrawingContext } from "../../../../Items";
|
|
6
|
+
import { DocumentFactory } from "../../../../api/DocumentFactory";
|
|
6
7
|
import { DiceOperation } from "./DiceOperation";
|
|
7
8
|
export type DiceType = "common" | "custom";
|
|
8
9
|
export declare const defaultDiceData: BaseItemData;
|
|
@@ -46,4 +47,5 @@ export declare class Dice extends BaseItem {
|
|
|
46
47
|
apply(op: DiceOperation): void;
|
|
47
48
|
startRotation(): void;
|
|
48
49
|
stopRotation(): void;
|
|
50
|
+
renderHTML(documentFactory: DocumentFactory): HTMLElement;
|
|
49
51
|
}
|