microboard-temp 0.5.18 → 0.5.20
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 +50 -0
- package/dist/cjs/index.js +50 -0
- package/dist/cjs/node.js +50 -0
- package/dist/esm/browser.js +108 -58
- package/dist/esm/index.js +108 -58
- package/dist/esm/node.js +108 -58
- package/dist/types/Items/Examples/CardGame/Dice/Dice.d.ts +4 -2
- package/package.json +1 -1
package/dist/cjs/browser.js
CHANGED
|
@@ -48606,6 +48606,56 @@ class Dice extends BaseItem {
|
|
|
48606
48606
|
this.drawingContext = null;
|
|
48607
48607
|
}
|
|
48608
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
|
+
div.style.display = "flex";
|
|
48643
|
+
div.style.alignItems = "center";
|
|
48644
|
+
div.style.textAlign = "center";
|
|
48645
|
+
div.style.justifyContent = "center";
|
|
48646
|
+
const innerDiv = document.createElement("div");
|
|
48647
|
+
innerDiv.style.font = `bold ${this.getHeight() / 3}px sans-serif`;
|
|
48648
|
+
innerDiv.style.width = `${this.getHeight() / 3}px`;
|
|
48649
|
+
innerDiv.style.height = `${this.getHeight() / 3}px`;
|
|
48650
|
+
const valueToRender = this.renderValues[this.valueIndex];
|
|
48651
|
+
if (typeof valueToRender === "number") {
|
|
48652
|
+
innerDiv.innerHTML = valueToRender.toString();
|
|
48653
|
+
} else {
|
|
48654
|
+
div.style.backgroundImage = `url(${valueToRender.src})`;
|
|
48655
|
+
}
|
|
48656
|
+
div.appendChild(innerDiv);
|
|
48657
|
+
return div;
|
|
48658
|
+
}
|
|
48609
48659
|
}
|
|
48610
48660
|
registerItem({
|
|
48611
48661
|
item: Dice,
|
package/dist/cjs/index.js
CHANGED
|
@@ -48606,6 +48606,56 @@ class Dice extends BaseItem {
|
|
|
48606
48606
|
this.drawingContext = null;
|
|
48607
48607
|
}
|
|
48608
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
|
+
div.style.display = "flex";
|
|
48643
|
+
div.style.alignItems = "center";
|
|
48644
|
+
div.style.textAlign = "center";
|
|
48645
|
+
div.style.justifyContent = "center";
|
|
48646
|
+
const innerDiv = document.createElement("div");
|
|
48647
|
+
innerDiv.style.font = `bold ${this.getHeight() / 3}px sans-serif`;
|
|
48648
|
+
innerDiv.style.width = `${this.getHeight() / 3}px`;
|
|
48649
|
+
innerDiv.style.height = `${this.getHeight() / 3}px`;
|
|
48650
|
+
const valueToRender = this.renderValues[this.valueIndex];
|
|
48651
|
+
if (typeof valueToRender === "number") {
|
|
48652
|
+
innerDiv.innerHTML = valueToRender.toString();
|
|
48653
|
+
} else {
|
|
48654
|
+
div.style.backgroundImage = `url(${valueToRender.src})`;
|
|
48655
|
+
}
|
|
48656
|
+
div.appendChild(innerDiv);
|
|
48657
|
+
return div;
|
|
48658
|
+
}
|
|
48609
48659
|
}
|
|
48610
48660
|
registerItem({
|
|
48611
48661
|
item: Dice,
|
package/dist/cjs/node.js
CHANGED
|
@@ -51079,6 +51079,56 @@ class Dice extends BaseItem {
|
|
|
51079
51079
|
this.drawingContext = null;
|
|
51080
51080
|
}
|
|
51081
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
|
+
div.style.display = "flex";
|
|
51116
|
+
div.style.alignItems = "center";
|
|
51117
|
+
div.style.textAlign = "center";
|
|
51118
|
+
div.style.justifyContent = "center";
|
|
51119
|
+
const innerDiv = document.createElement("div");
|
|
51120
|
+
innerDiv.style.font = `bold ${this.getHeight() / 3}px sans-serif`;
|
|
51121
|
+
innerDiv.style.width = `${this.getHeight() / 3}px`;
|
|
51122
|
+
innerDiv.style.height = `${this.getHeight() / 3}px`;
|
|
51123
|
+
const valueToRender = this.renderValues[this.valueIndex];
|
|
51124
|
+
if (typeof valueToRender === "number") {
|
|
51125
|
+
innerDiv.innerHTML = valueToRender.toString();
|
|
51126
|
+
} else {
|
|
51127
|
+
div.style.backgroundImage = `url(${valueToRender.src})`;
|
|
51128
|
+
}
|
|
51129
|
+
div.appendChild(innerDiv);
|
|
51130
|
+
return div;
|
|
51131
|
+
}
|
|
51082
51132
|
}
|
|
51083
51133
|
registerItem({
|
|
51084
51134
|
item: Dice,
|
package/dist/esm/browser.js
CHANGED
|
@@ -48452,6 +48452,56 @@ class Dice extends BaseItem {
|
|
|
48452
48452
|
this.drawingContext = null;
|
|
48453
48453
|
}
|
|
48454
48454
|
}
|
|
48455
|
+
renderHTML(documentFactory) {
|
|
48456
|
+
const div = super.renderHTML(documentFactory);
|
|
48457
|
+
const { translateX, translateY, scaleX, scaleY } = this.transformation.matrix;
|
|
48458
|
+
const mbr = this.getMbr();
|
|
48459
|
+
const width2 = mbr.getWidth();
|
|
48460
|
+
const height3 = mbr.getHeight();
|
|
48461
|
+
const unscaledWidth = width2 / scaleX;
|
|
48462
|
+
const unscaledHeight = height3 / scaleY;
|
|
48463
|
+
const svg3 = documentFactory.createElementNS("http://www.w3.org/2000/svg", "svg");
|
|
48464
|
+
svg3.setAttribute("width", `${unscaledWidth}px`);
|
|
48465
|
+
svg3.setAttribute("height", `${unscaledHeight}px`);
|
|
48466
|
+
svg3.setAttribute("viewBox", `0 0 ${unscaledWidth} ${unscaledHeight}`);
|
|
48467
|
+
svg3.setAttribute("transform-origin", "0 0");
|
|
48468
|
+
svg3.setAttribute("transform", `scale(${1 / scaleX}, ${1 / scaleY})`);
|
|
48469
|
+
svg3.setAttribute("style", "position: absolute; overflow: visible;");
|
|
48470
|
+
const pathElement = Shapes["RoundedRectangle"].path.copy().renderHTML(documentFactory);
|
|
48471
|
+
const paths = Array.isArray(pathElement) ? pathElement : [pathElement];
|
|
48472
|
+
paths.forEach((element4) => {
|
|
48473
|
+
element4.setAttribute("fill", this.backgroundColor);
|
|
48474
|
+
element4.setAttribute("stroke", this.borderColor);
|
|
48475
|
+
element4.setAttribute("stroke-dasharray", LinePatterns[this.borderStyle].join(", "));
|
|
48476
|
+
element4.setAttribute("stroke-width", this.borderWidth.toString());
|
|
48477
|
+
element4.setAttribute("transform-origin", "0 0");
|
|
48478
|
+
element4.setAttribute("transform", `scale(${scaleX}, ${scaleY})`);
|
|
48479
|
+
});
|
|
48480
|
+
svg3.append(...paths);
|
|
48481
|
+
div.appendChild(svg3);
|
|
48482
|
+
div.id = this.getId();
|
|
48483
|
+
div.style.width = unscaledWidth + "px";
|
|
48484
|
+
div.style.height = unscaledHeight + "px";
|
|
48485
|
+
div.style.transformOrigin = "left top";
|
|
48486
|
+
div.style.transform = `translate(${translateX}px, ${translateY}px) scale(${scaleX}, ${scaleY})`;
|
|
48487
|
+
div.style.position = "absolute";
|
|
48488
|
+
div.style.display = "flex";
|
|
48489
|
+
div.style.alignItems = "center";
|
|
48490
|
+
div.style.textAlign = "center";
|
|
48491
|
+
div.style.justifyContent = "center";
|
|
48492
|
+
const innerDiv = document.createElement("div");
|
|
48493
|
+
innerDiv.style.font = `bold ${this.getHeight() / 3}px sans-serif`;
|
|
48494
|
+
innerDiv.style.width = `${this.getHeight() / 3}px`;
|
|
48495
|
+
innerDiv.style.height = `${this.getHeight() / 3}px`;
|
|
48496
|
+
const valueToRender = this.renderValues[this.valueIndex];
|
|
48497
|
+
if (typeof valueToRender === "number") {
|
|
48498
|
+
innerDiv.innerHTML = valueToRender.toString();
|
|
48499
|
+
} else {
|
|
48500
|
+
div.style.backgroundImage = `url(${valueToRender.src})`;
|
|
48501
|
+
}
|
|
48502
|
+
div.appendChild(innerDiv);
|
|
48503
|
+
return div;
|
|
48504
|
+
}
|
|
48455
48505
|
}
|
|
48456
48506
|
registerItem({
|
|
48457
48507
|
item: Dice,
|
|
@@ -54094,7 +54144,7 @@ class Board {
|
|
|
54094
54144
|
}
|
|
54095
54145
|
}
|
|
54096
54146
|
// src/Events/Merge.ts
|
|
54097
|
-
import { Path as
|
|
54147
|
+
import { Path as Path15 } from "slate";
|
|
54098
54148
|
function areItemsTheSame(opA, opB) {
|
|
54099
54149
|
if (opA.method === "transformMany" && opB.method === "transformMany") {
|
|
54100
54150
|
const itemsA = Object.keys(opA.items);
|
|
@@ -54327,7 +54377,7 @@ function mergeRichTextOperations(opA, opB) {
|
|
|
54327
54377
|
ops: [...opA.ops, ...opB.ops]
|
|
54328
54378
|
};
|
|
54329
54379
|
}
|
|
54330
|
-
if (B.type === "insert_text" && A.type === "insert_text" && B.offset === A.offset + A.text.length &&
|
|
54380
|
+
if (B.type === "insert_text" && A.type === "insert_text" && B.offset === A.offset + A.text.length && Path15.equals(B.path, A.path)) {
|
|
54331
54381
|
return {
|
|
54332
54382
|
...opB,
|
|
54333
54383
|
ops: [
|
|
@@ -54339,7 +54389,7 @@ function mergeRichTextOperations(opA, opB) {
|
|
|
54339
54389
|
]
|
|
54340
54390
|
};
|
|
54341
54391
|
}
|
|
54342
|
-
if (B.type === "remove_text" && A.type === "remove_text" && B.offset + B.text.length === A.offset &&
|
|
54392
|
+
if (B.type === "remove_text" && A.type === "remove_text" && B.offset + B.text.length === A.offset && Path15.equals(B.path, A.path)) {
|
|
54343
54393
|
return {
|
|
54344
54394
|
...opB,
|
|
54345
54395
|
ops: [
|
|
@@ -54351,7 +54401,7 @@ function mergeRichTextOperations(opA, opB) {
|
|
|
54351
54401
|
]
|
|
54352
54402
|
};
|
|
54353
54403
|
}
|
|
54354
|
-
if (B.type === "split_node" && A.type === "split_node" &&
|
|
54404
|
+
if (B.type === "split_node" && A.type === "split_node" && Path15.isChild(A.path, B.path)) {
|
|
54355
54405
|
return {
|
|
54356
54406
|
...opB,
|
|
54357
54407
|
ops: [...opA.ops, ...opB.ops]
|
|
@@ -54503,10 +54553,10 @@ function createSyncLog() {
|
|
|
54503
54553
|
}
|
|
54504
54554
|
|
|
54505
54555
|
// src/Events/Transform/removeText_removeText.ts
|
|
54506
|
-
import { Path as
|
|
54556
|
+
import { Path as Path16 } from "slate";
|
|
54507
54557
|
function removeText_removeText(confirmed, toTransform) {
|
|
54508
54558
|
const transformed = { ...toTransform };
|
|
54509
|
-
if (
|
|
54559
|
+
if (Path16.equals(confirmed.path, toTransform.path)) {
|
|
54510
54560
|
const confirmedStart = confirmed.offset;
|
|
54511
54561
|
const confirmedEnd = confirmed.offset + confirmed.text.length;
|
|
54512
54562
|
const toTransformStart = toTransform.offset;
|
|
@@ -54535,10 +54585,10 @@ function removeText_removeText(confirmed, toTransform) {
|
|
|
54535
54585
|
}
|
|
54536
54586
|
|
|
54537
54587
|
// src/Events/Transform/insertText_insertText.ts
|
|
54538
|
-
import { Path as
|
|
54588
|
+
import { Path as Path17 } from "slate";
|
|
54539
54589
|
function insertText_insertText(confirmed, toTransform) {
|
|
54540
54590
|
const transformed = { ...toTransform };
|
|
54541
|
-
if (
|
|
54591
|
+
if (Path17.equals(confirmed.path, toTransform.path)) {
|
|
54542
54592
|
if (confirmed.offset <= toTransform.offset) {
|
|
54543
54593
|
transformed.offset += confirmed.text.length;
|
|
54544
54594
|
}
|
|
@@ -54547,10 +54597,10 @@ function insertText_insertText(confirmed, toTransform) {
|
|
|
54547
54597
|
}
|
|
54548
54598
|
|
|
54549
54599
|
// src/Events/Transform/removeText_insertText.ts
|
|
54550
|
-
import { Path as
|
|
54600
|
+
import { Path as Path18 } from "slate";
|
|
54551
54601
|
function removeText_insertText(confirmed, toTransform) {
|
|
54552
54602
|
const transformed = { ...toTransform };
|
|
54553
|
-
if (
|
|
54603
|
+
if (Path18.equals(confirmed.path, toTransform.path)) {
|
|
54554
54604
|
if (confirmed.offset <= toTransform.offset) {
|
|
54555
54605
|
transformed.offset -= confirmed.text.length;
|
|
54556
54606
|
}
|
|
@@ -54559,17 +54609,17 @@ function removeText_insertText(confirmed, toTransform) {
|
|
|
54559
54609
|
}
|
|
54560
54610
|
|
|
54561
54611
|
// src/Events/Transform/splitNode_insertText.ts
|
|
54562
|
-
import { Path as
|
|
54612
|
+
import { Path as Path20 } from "slate";
|
|
54563
54613
|
|
|
54564
54614
|
// src/Events/Transform/transformPath.ts
|
|
54565
|
-
import { Path as
|
|
54615
|
+
import { Path as Path19 } from "slate";
|
|
54566
54616
|
function transformPath(confirmed, toTransform) {
|
|
54567
|
-
const newPath =
|
|
54617
|
+
const newPath = Path19.transform(toTransform.path, confirmed);
|
|
54568
54618
|
if (newPath) {
|
|
54569
54619
|
toTransform.path = newPath;
|
|
54570
54620
|
}
|
|
54571
54621
|
if ("newPath" in toTransform) {
|
|
54572
|
-
const newPathUpdated =
|
|
54622
|
+
const newPathUpdated = Path19.transform(toTransform.newPath, confirmed);
|
|
54573
54623
|
if (newPathUpdated) {
|
|
54574
54624
|
toTransform.newPath = newPathUpdated;
|
|
54575
54625
|
}
|
|
@@ -54581,7 +54631,7 @@ function splitNode_insertText(confirmed, toTransform) {
|
|
|
54581
54631
|
const transformed = { ...toTransform };
|
|
54582
54632
|
const confPath = confirmed.path;
|
|
54583
54633
|
const tPath = transformed.path;
|
|
54584
|
-
if (
|
|
54634
|
+
if (Path20.equals(confPath, tPath)) {
|
|
54585
54635
|
if (transformed.offset >= confirmed.position) {
|
|
54586
54636
|
transformed.offset -= confirmed.position;
|
|
54587
54637
|
transformed.path = [...confPath];
|
|
@@ -54608,10 +54658,10 @@ function insertNode_insertText(confirmed, toTransform) {
|
|
|
54608
54658
|
}
|
|
54609
54659
|
|
|
54610
54660
|
// src/Events/Transform/mergeNode_insertText.ts
|
|
54611
|
-
import { Path as
|
|
54661
|
+
import { Path as Path21 } from "slate";
|
|
54612
54662
|
function mergeNode_insertText(confirmed, toTransform) {
|
|
54613
54663
|
const transformed = { ...toTransform };
|
|
54614
|
-
if (
|
|
54664
|
+
if (Path21.equals(confirmed.path, transformed.path)) {
|
|
54615
54665
|
transformed.offset += confirmed.position;
|
|
54616
54666
|
return transformed;
|
|
54617
54667
|
}
|
|
@@ -54620,10 +54670,10 @@ function mergeNode_insertText(confirmed, toTransform) {
|
|
|
54620
54670
|
}
|
|
54621
54671
|
|
|
54622
54672
|
// src/Events/Transform/insertText_removeText.ts
|
|
54623
|
-
import { Path as
|
|
54673
|
+
import { Path as Path22 } from "slate";
|
|
54624
54674
|
function insertText_removeText(confirmed, toTransform) {
|
|
54625
54675
|
const transformed = { ...toTransform };
|
|
54626
|
-
if (
|
|
54676
|
+
if (Path22.equals(confirmed.path, toTransform.path)) {
|
|
54627
54677
|
if (confirmed.offset <= toTransform.offset) {
|
|
54628
54678
|
transformed.offset += confirmed.text.length;
|
|
54629
54679
|
}
|
|
@@ -54639,10 +54689,10 @@ function insertNode_removeText(confirmed, toTransform) {
|
|
|
54639
54689
|
}
|
|
54640
54690
|
|
|
54641
54691
|
// src/Events/Transform/splitNode_removeText.ts
|
|
54642
|
-
import { Path as
|
|
54692
|
+
import { Path as Path23 } from "slate";
|
|
54643
54693
|
function splitNode_removeText(confirmed, toTransform) {
|
|
54644
54694
|
const transformed = { ...toTransform };
|
|
54645
|
-
if (
|
|
54695
|
+
if (Path23.equals(confirmed.path, transformed.path)) {
|
|
54646
54696
|
if (confirmed.position <= transformed.offset) {
|
|
54647
54697
|
transformed.offset -= confirmed.position;
|
|
54648
54698
|
}
|
|
@@ -54661,10 +54711,10 @@ function splitNode_removeText(confirmed, toTransform) {
|
|
|
54661
54711
|
}
|
|
54662
54712
|
|
|
54663
54713
|
// src/Events/Transform/mergeNode_removeText.ts
|
|
54664
|
-
import { Path as
|
|
54714
|
+
import { Path as Path24 } from "slate";
|
|
54665
54715
|
function mergeNode_removeText(confirmed, toTransform) {
|
|
54666
54716
|
const transformed = { ...toTransform };
|
|
54667
|
-
if (
|
|
54717
|
+
if (Path24.equals(confirmed.path, toTransform.path)) {
|
|
54668
54718
|
transformed.offset += confirmed.position;
|
|
54669
54719
|
}
|
|
54670
54720
|
transformPath(confirmed, transformed);
|
|
@@ -54735,12 +54785,12 @@ function removeNode_removeNode(confirmed, toTransform) {
|
|
|
54735
54785
|
}
|
|
54736
54786
|
|
|
54737
54787
|
// src/Events/Transform/splitNode_insertNode.ts
|
|
54738
|
-
import { Path as
|
|
54788
|
+
import { Path as Path25 } from "slate";
|
|
54739
54789
|
function splitNode_insertNode(confirmed, toTransform) {
|
|
54740
54790
|
const transformed = { ...toTransform };
|
|
54741
54791
|
const conf2 = confirmed.path;
|
|
54742
54792
|
const path2 = transformed.path;
|
|
54743
|
-
if (
|
|
54793
|
+
if (Path25.equals(conf2, path2)) {
|
|
54744
54794
|
return transformed;
|
|
54745
54795
|
}
|
|
54746
54796
|
const isDescendant = path2.length > conf2.length && path2.slice(0, conf2.length).every((seg, i) => seg === conf2[i]);
|
|
@@ -54750,19 +54800,19 @@ function splitNode_insertNode(confirmed, toTransform) {
|
|
|
54750
54800
|
transformed.path = newPath;
|
|
54751
54801
|
return transformed;
|
|
54752
54802
|
}
|
|
54753
|
-
if (
|
|
54803
|
+
if (Path25.isBefore(conf2, path2)) {
|
|
54754
54804
|
transformPath(confirmed, transformed);
|
|
54755
54805
|
}
|
|
54756
54806
|
return transformed;
|
|
54757
54807
|
}
|
|
54758
54808
|
|
|
54759
54809
|
// src/Events/Transform/splitNode_removeNode.ts
|
|
54760
|
-
import { Path as
|
|
54810
|
+
import { Path as Path26 } from "slate";
|
|
54761
54811
|
function splitNode_removeNode(confirmed, toTransform) {
|
|
54762
54812
|
const transformed = { ...toTransform };
|
|
54763
54813
|
const conf2 = confirmed.path;
|
|
54764
54814
|
const path2 = transformed.path;
|
|
54765
|
-
if (
|
|
54815
|
+
if (Path26.equals(conf2, path2)) {
|
|
54766
54816
|
return transformed;
|
|
54767
54817
|
}
|
|
54768
54818
|
if (path2.length === conf2.length + 1 && path2.slice(0, conf2.length).every((seg, i) => seg === conf2[i])) {
|
|
@@ -54776,18 +54826,18 @@ function splitNode_removeNode(confirmed, toTransform) {
|
|
|
54776
54826
|
return transformed;
|
|
54777
54827
|
}
|
|
54778
54828
|
const isDescendant = path2.length > conf2.length && path2.slice(0, conf2.length).every((seg, i) => seg === conf2[i]);
|
|
54779
|
-
if (
|
|
54829
|
+
if (Path26.isBefore(conf2, path2) && !isDescendant) {
|
|
54780
54830
|
transformPath(confirmed, transformed);
|
|
54781
54831
|
}
|
|
54782
54832
|
return transformed;
|
|
54783
54833
|
}
|
|
54784
54834
|
|
|
54785
54835
|
// src/Events/Transform/mergeNode_insertNode.ts
|
|
54786
|
-
import { Path as
|
|
54836
|
+
import { Path as Path27 } from "slate";
|
|
54787
54837
|
function mergeNode_insertNode(confirmed, toTransform) {
|
|
54788
54838
|
const transformed = { ...toTransform };
|
|
54789
|
-
const isDescendant =
|
|
54790
|
-
const isAfter =
|
|
54839
|
+
const isDescendant = Path27.isAncestor(confirmed.path, transformed.path);
|
|
54840
|
+
const isAfter = Path27.isBefore(confirmed.path, transformed.path);
|
|
54791
54841
|
if (confirmed.path.length === 1 && isAfter && !isDescendant || confirmed.path.length > 1 && (isAfter || isDescendant)) {
|
|
54792
54842
|
transformPath(confirmed, transformed);
|
|
54793
54843
|
}
|
|
@@ -54795,40 +54845,40 @@ function mergeNode_insertNode(confirmed, toTransform) {
|
|
|
54795
54845
|
}
|
|
54796
54846
|
|
|
54797
54847
|
// src/Events/Transform/mergeNode_removeNode.ts
|
|
54798
|
-
import { Path as
|
|
54848
|
+
import { Path as Path28 } from "slate";
|
|
54799
54849
|
function mergeNode_removeNode(confirmed, toTransform) {
|
|
54800
54850
|
const transformed = { ...toTransform };
|
|
54801
|
-
if (
|
|
54851
|
+
if (Path28.isBefore(confirmed.path, transformed.path)) {
|
|
54802
54852
|
transformPath(confirmed, transformed);
|
|
54803
54853
|
}
|
|
54804
54854
|
return transformed;
|
|
54805
54855
|
}
|
|
54806
54856
|
|
|
54807
54857
|
// src/Events/Transform/setNode_insertNode.ts
|
|
54808
|
-
import { Path as
|
|
54858
|
+
import { Path as Path29 } from "slate";
|
|
54809
54859
|
function setNode_insertNode(confirmed, toTransform) {
|
|
54810
54860
|
const transformed = { ...toTransform };
|
|
54811
|
-
if (
|
|
54861
|
+
if (Path29.isBefore(confirmed.path, transformed.path)) {
|
|
54812
54862
|
transformPath(confirmed, transformed);
|
|
54813
54863
|
}
|
|
54814
54864
|
return transformed;
|
|
54815
54865
|
}
|
|
54816
54866
|
|
|
54817
54867
|
// src/Events/Transform/setNode_removeNode.ts
|
|
54818
|
-
import { Path as
|
|
54868
|
+
import { Path as Path30 } from "slate";
|
|
54819
54869
|
function setNode_removeNode(confirmed, toTransform) {
|
|
54820
54870
|
const transformed = { ...toTransform };
|
|
54821
|
-
if (
|
|
54871
|
+
if (Path30.isBefore(confirmed.path, transformed.path)) {
|
|
54822
54872
|
transformPath(confirmed, transformed);
|
|
54823
54873
|
}
|
|
54824
54874
|
return transformed;
|
|
54825
54875
|
}
|
|
54826
54876
|
|
|
54827
54877
|
// src/Events/Transform/insertText_mergeNode.ts
|
|
54828
|
-
import { Path as
|
|
54878
|
+
import { Path as Path31 } from "slate";
|
|
54829
54879
|
function insertText_mergeNode(confirmed, toTransform) {
|
|
54830
54880
|
const transformed = { ...toTransform };
|
|
54831
|
-
if (
|
|
54881
|
+
if (Path31.isBefore(confirmed.path, toTransform.path) && Path31.isSibling(confirmed.path, toTransform.path)) {
|
|
54832
54882
|
if (confirmed.offset <= toTransform.position) {
|
|
54833
54883
|
transformed.position += confirmed.text.length;
|
|
54834
54884
|
}
|
|
@@ -54869,12 +54919,12 @@ function removeNode_mergeNode(confirmed, toTransform) {
|
|
|
54869
54919
|
}
|
|
54870
54920
|
|
|
54871
54921
|
// src/Events/Transform/splitNode_mergeNode.ts
|
|
54872
|
-
import { Path as
|
|
54922
|
+
import { Path as Path32 } from "slate";
|
|
54873
54923
|
function splitNode_mergeNode(confirmed, toTransform) {
|
|
54874
54924
|
const transformed = { ...toTransform };
|
|
54875
54925
|
const confPath = confirmed.path;
|
|
54876
54926
|
const tPath = transformed.path;
|
|
54877
|
-
if (
|
|
54927
|
+
if (Path32.equals(confPath, tPath)) {
|
|
54878
54928
|
if (confirmed.position <= transformed.position) {
|
|
54879
54929
|
transformed.position -= confirmed.position;
|
|
54880
54930
|
}
|
|
@@ -54885,10 +54935,10 @@ function splitNode_mergeNode(confirmed, toTransform) {
|
|
|
54885
54935
|
}
|
|
54886
54936
|
|
|
54887
54937
|
// src/Events/Transform/mergeNode_mergeNode.ts
|
|
54888
|
-
import { Path as
|
|
54938
|
+
import { Path as Path33 } from "slate";
|
|
54889
54939
|
function mergeNode_mergeNode(confirmed, toTransform) {
|
|
54890
54940
|
const transformed = { ...toTransform };
|
|
54891
|
-
if (
|
|
54941
|
+
if (Path33.equals(confirmed.path, transformed.path)) {
|
|
54892
54942
|
transformed.position += confirmed.position;
|
|
54893
54943
|
return transformed;
|
|
54894
54944
|
}
|
|
@@ -54903,10 +54953,10 @@ function mergeNode_mergeNode(confirmed, toTransform) {
|
|
|
54903
54953
|
}
|
|
54904
54954
|
|
|
54905
54955
|
// src/Events/Transform/insertText_splitNode.ts
|
|
54906
|
-
import { Path as
|
|
54956
|
+
import { Path as Path34 } from "slate";
|
|
54907
54957
|
function insertText_splitNode(confirmed, toTransform) {
|
|
54908
54958
|
const transformed = { ...toTransform };
|
|
54909
|
-
const newPath =
|
|
54959
|
+
const newPath = Path34.transform(transformed.path, confirmed);
|
|
54910
54960
|
if (newPath) {
|
|
54911
54961
|
transformed.path = newPath;
|
|
54912
54962
|
}
|
|
@@ -54949,12 +54999,12 @@ function removeNode_splitNode(confirmed, toTransform) {
|
|
|
54949
54999
|
}
|
|
54950
55000
|
|
|
54951
55001
|
// src/Events/Transform/mergeNode_splitNode.ts
|
|
54952
|
-
import { Path as
|
|
55002
|
+
import { Path as Path35 } from "slate";
|
|
54953
55003
|
function mergeNode_splitNode(confirmed, toTransform) {
|
|
54954
55004
|
const transformed = { ...toTransform };
|
|
54955
55005
|
const rem = confirmed.path;
|
|
54956
55006
|
const orig = transformed.path;
|
|
54957
|
-
if (
|
|
55007
|
+
if (Path35.equals(rem, orig)) {
|
|
54958
55008
|
transformed.position += confirmed.position;
|
|
54959
55009
|
return transformed;
|
|
54960
55010
|
}
|
|
@@ -54965,7 +55015,7 @@ function mergeNode_splitNode(confirmed, toTransform) {
|
|
|
54965
55015
|
if (rem.length > 1) {
|
|
54966
55016
|
const depth = rem.length - 1;
|
|
54967
55017
|
const prefix2 = rem.slice(0, depth);
|
|
54968
|
-
if (newPath.length > depth &&
|
|
55018
|
+
if (newPath.length > depth && Path35.equals(prefix2, newPath.slice(0, depth)) && newPath[depth] > rem[depth]) {
|
|
54969
55019
|
newPath[depth] = newPath[depth] - 1;
|
|
54970
55020
|
}
|
|
54971
55021
|
}
|
|
@@ -54974,10 +55024,10 @@ function mergeNode_splitNode(confirmed, toTransform) {
|
|
|
54974
55024
|
}
|
|
54975
55025
|
|
|
54976
55026
|
// src/Events/Transform/splitNode_splitNode.ts
|
|
54977
|
-
import { Path as
|
|
55027
|
+
import { Path as Path36 } from "slate";
|
|
54978
55028
|
function splitNode_splitNode(confirmed, toTransform) {
|
|
54979
55029
|
const transformed = { ...toTransform };
|
|
54980
|
-
const samePath =
|
|
55030
|
+
const samePath = Path36.equals(confirmed.path, transformed.path);
|
|
54981
55031
|
if (samePath && confirmed.position <= transformed.position) {
|
|
54982
55032
|
transformed.position -= confirmed.position;
|
|
54983
55033
|
}
|
|
@@ -55001,12 +55051,12 @@ function setNode_splitNode(confirmed, toTransform) {
|
|
|
55001
55051
|
}
|
|
55002
55052
|
|
|
55003
55053
|
// src/Events/Transform/splitNode_setNode.ts
|
|
55004
|
-
import { Path as
|
|
55054
|
+
import { Path as Path37 } from "slate";
|
|
55005
55055
|
function splitNode_setNode(confirmed, toTransform) {
|
|
55006
55056
|
const transformed = { ...toTransform };
|
|
55007
55057
|
const confirmedPath = confirmed.path;
|
|
55008
55058
|
const currentPath = transformed.path;
|
|
55009
|
-
const isSame =
|
|
55059
|
+
const isSame = Path37.equals(currentPath, confirmedPath);
|
|
55010
55060
|
const isDeepNestedDescendant = confirmedPath.length > 1 && currentPath.length > confirmedPath.length && currentPath.slice(0, confirmedPath.length).every((seg, i) => seg === confirmedPath[i]);
|
|
55011
55061
|
if (!isSame && !isDeepNestedDescendant) {
|
|
55012
55062
|
transformPath(confirmed, transformed);
|
|
@@ -55029,11 +55079,11 @@ function insertNode_setNode(confirmed, toTransform) {
|
|
|
55029
55079
|
}
|
|
55030
55080
|
|
|
55031
55081
|
// src/Events/Transform/removeNode_setNode.ts
|
|
55032
|
-
import { Path as
|
|
55082
|
+
import { Path as Path38 } from "slate";
|
|
55033
55083
|
function removeNode_setNode(confirmed, toTransform) {
|
|
55034
55084
|
const removalPath = confirmed.path;
|
|
55035
55085
|
const originalPath = toTransform.path;
|
|
55036
|
-
if (
|
|
55086
|
+
if (Path38.equals(removalPath, originalPath)) {
|
|
55037
55087
|
return;
|
|
55038
55088
|
}
|
|
55039
55089
|
const transformedOp = { ...toTransform };
|
|
@@ -55044,7 +55094,7 @@ function removeNode_setNode(confirmed, toTransform) {
|
|
|
55044
55094
|
if (removalPath.length > 1) {
|
|
55045
55095
|
const depthIndex = removalPath.length - 1;
|
|
55046
55096
|
const parentPrefix = removalPath.slice(0, depthIndex);
|
|
55047
|
-
if (newPath.length > depthIndex &&
|
|
55097
|
+
if (newPath.length > depthIndex && Path38.equals(parentPrefix, newPath.slice(0, depthIndex)) && newPath[depthIndex] > removalPath[depthIndex]) {
|
|
55048
55098
|
newPath[depthIndex] = newPath[depthIndex] - 1;
|
|
55049
55099
|
}
|
|
55050
55100
|
}
|
|
@@ -55053,10 +55103,10 @@ function removeNode_setNode(confirmed, toTransform) {
|
|
|
55053
55103
|
}
|
|
55054
55104
|
|
|
55055
55105
|
// src/Events/Transform/setNode_setNode.ts
|
|
55056
|
-
import { Path as
|
|
55106
|
+
import { Path as Path39 } from "slate";
|
|
55057
55107
|
function setNode_setNode(confirmed, toTransform) {
|
|
55058
55108
|
const transformed = { ...toTransform };
|
|
55059
|
-
if (
|
|
55109
|
+
if (Path39.equals(confirmed.path, toTransform.path)) {
|
|
55060
55110
|
transformed.newProperties = {
|
|
55061
55111
|
...toTransform.newProperties,
|
|
55062
55112
|
...confirmed.newProperties
|