slate-vue3 0.7.13 → 0.7.15

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.
@@ -1537,13 +1537,6 @@ const Node = {
1537
1537
  return [n, p];
1538
1538
  },
1539
1539
  fragment(root2, range) {
1540
- if (Text.isText(root2)) {
1541
- throw new Error(
1542
- `Cannot get a fragment starting from a root text node: ${Scrubber.stringify(
1543
- root2
1544
- )}`
1545
- );
1546
- }
1547
1540
  let newRoot = { children: cloneDeep(root2.children) };
1548
1541
  const [start, end] = Range.edges(range);
1549
1542
  const nodeEntries = Node.nodes(newRoot, {
package/dist/core.js CHANGED
@@ -1,6 +1,6 @@
1
- import { a6, a7, a8, d, e, f, a, h, aj, c, i, j, k, ap, ak, l, m, o, p, q, g, b, r, t, u, v, w, x, aq, y, a9, z, A, B, C, D, E, F, G, H, I, J, aa, K, ab, al, ac, L, M, N, O, n, P, S, Q, R, V, T, U, W, X, _, Y, Z, $, ad, am, ae, a0, an, ao, a5, s, af, a1, a2, a3, ag, ah, a4, ai } from "./create-editor-C9G9zbOD.js";
2
- import { E as E2, a as a10, I as I2, N as N2, O as O2, P as P2, b as b2, R as R2, S as S2, T as T2, c as c2, i as i2, d as d2 } from "./batch-dirty-paths-c2XLn-yG.js";
3
- import { L as L2, S as S3 } from "./location-CY2z7Wai.js";
1
+ import { a6, a7, a8, d, e, f, a, h, aj, c, i, j, k, ap, ak, l, m, o, p, q, g, b, r, t, u, v, w, x, aq, y, a9, z, A, B, C, D, E, F, G, H, I, J, aa, K, ab, al, ac, L, M, N, O, n, P, S, Q, R, V, T, U, W, X, _, Y, Z, $, ad, am, ae, a0, an, ao, a5, s, af, a1, a2, a3, ag, ah, a4, ai } from "./create-editor-C45fDAYm.js";
2
+ import { E as E2, a as a10, I as I2, N as N2, O as O2, P as P2, b as b2, R as R2, S as S2, T as T2, c as c2, i as i2, d as d2 } from "./batch-dirty-paths-BikbYJJS.js";
3
+ import { L as L2, S as S3 } from "./location-srcQyGzN.js";
4
4
  export {
5
5
  E2 as Editor,
6
6
  a10 as Element,
@@ -1,6 +1,6 @@
1
- import { P as Path, b as Point, R as Range, E as Editor, D as DIRTY_PATHS, e as DIRTY_PATH_KEYS, f as isBatchingDirtyPaths, c as Transforms, F as FLUSHING, T as Text, N as Node, a as Element, g as NORMALIZING, h as PATH_REFS, j as POINT_REFS, k as RANGE_REFS, l as cloneDeep, m as getDefaultInsertLocation, S as Scrubber, n as batchDirtyPaths, I as IS_EDITOR_SET } from "./batch-dirty-paths-c2XLn-yG.js";
1
+ import { P as Path, b as Point, R as Range, E as Editor, D as DIRTY_PATHS, e as DIRTY_PATH_KEYS, f as isBatchingDirtyPaths, c as Transforms, F as FLUSHING, T as Text, N as Node, a as Element, g as NORMALIZING, h as PATH_REFS, j as POINT_REFS, k as RANGE_REFS, l as cloneDeep, m as getDefaultInsertLocation, S as Scrubber, n as batchDirtyPaths, I as IS_EDITOR_SET } from "./batch-dirty-paths-BikbYJJS.js";
2
2
  import { reactive } from "vue";
3
- import { S as Span } from "./location-CY2z7Wai.js";
3
+ import { S as Span } from "./location-srcQyGzN.js";
4
4
  const PathRef = {
5
5
  transform(ref, op) {
6
6
  const { current, affinity } = ref;
@@ -1107,23 +1107,36 @@ function* positions(editor, options = {}) {
1107
1107
  let distance = 0;
1108
1108
  let leafTextRemaining = 0;
1109
1109
  let leafTextOffset = 0;
1110
+ const skippedPaths = [];
1110
1111
  for (const [node2, path2] of Editor.nodes(editor, {
1111
1112
  at,
1112
1113
  reverse,
1113
1114
  voids
1114
1115
  })) {
1116
+ const hasSkippedAncestor = skippedPaths.some((p) => Path.isAncestor(p, path2));
1117
+ function* maybeYield(point2) {
1118
+ if (!hasSkippedAncestor) {
1119
+ yield point2;
1120
+ }
1121
+ }
1115
1122
  if (Element.isElement(node2)) {
1116
1123
  if (!editor.isSelectable(node2)) {
1124
+ skippedPaths.push(path2);
1117
1125
  if (reverse) {
1118
- yield Editor.end(editor, Path.previous(path2));
1126
+ if (Path.hasPrevious(path2)) {
1127
+ yield* maybeYield(Editor.end(editor, Path.previous(path2)));
1128
+ }
1119
1129
  continue;
1120
1130
  } else {
1121
- yield Editor.start(editor, Path.next(path2));
1131
+ const nextPath = Path.next(path2);
1132
+ if (Editor.hasPath(editor, nextPath)) {
1133
+ yield* maybeYield(Editor.start(editor, nextPath));
1134
+ }
1122
1135
  continue;
1123
1136
  }
1124
1137
  }
1125
1138
  if (!voids && (editor.isVoid(node2) || editor.isElementReadOnly(node2))) {
1126
- yield Editor.start(editor, path2);
1139
+ yield* maybeYield(Editor.start(editor, path2));
1127
1140
  continue;
1128
1141
  }
1129
1142
  if (editor.isInline(node2)) continue;
@@ -1144,7 +1157,7 @@ function* positions(editor, options = {}) {
1144
1157
  leafTextOffset = reverse ? leafTextRemaining : 0;
1145
1158
  }
1146
1159
  if (isFirst || isNewBlock || unit === "offset") {
1147
- yield { path: path2, offset: leafTextOffset };
1160
+ yield* maybeYield({ path: path2, offset: leafTextOffset });
1148
1161
  isNewBlock = false;
1149
1162
  }
1150
1163
  while (true) {
@@ -1160,7 +1173,7 @@ function* positions(editor, options = {}) {
1160
1173
  break;
1161
1174
  }
1162
1175
  distance = 0;
1163
- yield { path: path2, offset: leafTextOffset };
1176
+ yield* maybeYield({ path: path2, offset: leafTextOffset });
1164
1177
  }
1165
1178
  }
1166
1179
  }
package/dist/dom.js CHANGED
@@ -1,6 +1,6 @@
1
- import { D as DOMEditor, r as reconcileChildren, E as EDITOR_TO_KEY_TO_ELEMENT, a as EDITOR_TO_USER_MARKS, b as EDITOR_TO_USER_SELECTION, N as NODE_TO_KEY, i as isDOMText, g as getPlainText, c as getSlateFragmentAttribute, d as EDITOR_TO_ON_CHANGE } from "./hotkeys-BR6GOVlt.js";
2
- import { C, G, J, L, H, F, I, v, M, w, x, O, y, P, A, z, B, K, Q, R, S, T, e, f, h, j, k, l, m, o, p, q, s, t, u, n } from "./hotkeys-BR6GOVlt.js";
3
- import { E as Editor, R as Range, a as Element, c as Transforms, N as Node, P as Path } from "./batch-dirty-paths-c2XLn-yG.js";
1
+ import { D as DOMEditor, r as reconcileChildren, E as EDITOR_TO_KEY_TO_ELEMENT, a as EDITOR_TO_USER_MARKS, b as EDITOR_TO_USER_SELECTION, N as NODE_TO_KEY, i as isDOMText, g as getPlainText, c as getSlateFragmentAttribute, d as EDITOR_TO_ON_CHANGE } from "./hotkeys-CguAQWxj.js";
2
+ import { C, G, J, L, H, F, I, v, M, w, x, O, y, P, A, z, B, K, Q, R, S, T, e, f, h, j, k, l, m, o, p, q, s, t, u, n } from "./hotkeys-CguAQWxj.js";
3
+ import { E as Editor, R as Range, a as Element, c as Transforms, N as Node, P as Path } from "./batch-dirty-paths-BikbYJJS.js";
4
4
  import { reactive } from "vue";
5
5
  const doRectsIntersect = (rect, compareRect) => {
6
6
  const middle = (compareRect.top + compareRect.bottom) / 2;
package/dist/history.js CHANGED
@@ -1,4 +1,4 @@
1
- import { d as isObject, O as Operation, t as toRawWeakMap, E as Editor, c as Transforms, P as Path } from "./batch-dirty-paths-c2XLn-yG.js";
1
+ import { d as isObject, O as Operation, t as toRawWeakMap, E as Editor, c as Transforms, P as Path } from "./batch-dirty-paths-BikbYJJS.js";
2
2
  import "vue";
3
3
  const History = {
4
4
  /**
@@ -1,4 +1,4 @@
1
- import { t as toRawWeakMap, R as Range, E as Editor, S as Scrubber, a as Element, c as Transforms, P as Path } from "./batch-dirty-paths-c2XLn-yG.js";
1
+ import { S as Scrubber, t as toRawWeakMap, R as Range, E as Editor, a as Element, c as Transforms, P as Path } from "./batch-dirty-paths-BikbYJJS.js";
2
2
  import { markRaw } from "vue";
3
3
  const getDefaultView = (value) => {
4
4
  return value && value.ownerDocument && value.ownerDocument.defaultView || null;
@@ -78,6 +78,17 @@ const getEditableChildAndIndex = (parent, index, direction) => {
78
78
  index = i;
79
79
  i += direction === "forward" ? 1 : -1;
80
80
  }
81
+ while (child.nodeType === 3 && child.textContent === "") {
82
+ index++;
83
+ child = childNodes[index];
84
+ }
85
+ if (!child) {
86
+ throw new Error(
87
+ `Compact on vue3 empty childNode: Failed to find adjacent nodes: ${Scrubber.stringify(
88
+ child
89
+ )}`
90
+ );
91
+ }
81
92
  return [child, index];
82
93
  };
83
94
  const getEditableChild = (parent, index, direction) => {
@@ -1,5 +1,5 @@
1
- import { t as toRawWeakMap, R as Range, N as Node, T as Text, a as Element, d as isObject } from "./batch-dirty-paths-c2XLn-yG.js";
2
- import { c as createEditor$1 } from "./create-editor-C9G9zbOD.js";
1
+ import { t as toRawWeakMap, R as Range, N as Node, T as Text, a as Element, d as isObject } from "./batch-dirty-paths-BikbYJJS.js";
2
+ import { c as createEditor$1 } from "./create-editor-C45fDAYm.js";
3
3
  import "vue";
4
4
  const ANCHOR = new toRawWeakMap();
5
5
  const FOCUS = new toRawWeakMap();
package/dist/index.js CHANGED
@@ -1,9 +1,9 @@
1
- import { S as SLATE_USE_ELEMENT, u as useEditor, a as SLATE_USE_SELECTION } from "./use-focused-CcY69FbK.js";
2
- import { g, D, c, e, f, d, E, b, h, i, j } from "./use-focused-CcY69FbK.js";
3
- import { E as Editor, R as Range } from "./batch-dirty-paths-c2XLn-yG.js";
4
- import { t } from "./batch-dirty-paths-c2XLn-yG.js";
1
+ import { S as SLATE_USE_ELEMENT, u as useEditor, a as SLATE_USE_SELECTION } from "./use-focused-CwWljAMN.js";
2
+ import { g, D, c, e, f, d, E, b, h, i, j } from "./use-focused-CwWljAMN.js";
3
+ import { E as Editor, R as Range } from "./batch-dirty-paths-BikbYJJS.js";
4
+ import { t } from "./batch-dirty-paths-BikbYJJS.js";
5
5
  import { inject, computed } from "vue";
6
- import { D as DOMEditor } from "./hotkeys-BR6GOVlt.js";
6
+ import { D as DOMEditor } from "./hotkeys-CguAQWxj.js";
7
7
  const useElement = () => {
8
8
  const element = inject(SLATE_USE_ELEMENT);
9
9
  if (element === void 0) {
@@ -1,4 +1,4 @@
1
- import { P as Path, b as Point, R as Range } from "./batch-dirty-paths-c2XLn-yG.js";
1
+ import { P as Path, b as Point, R as Range } from "./batch-dirty-paths-BikbYJJS.js";
2
2
  import "vue";
3
3
  const Location = {
4
4
  isLocation(value) {
@@ -91,7 +91,7 @@ export interface NodeInterface {
91
91
  /**
92
92
  * Get the sliced fragment represented by a range inside a root node.
93
93
  */
94
- fragment: (root: Node, range: Range) => Descendant[];
94
+ fragment: <T extends Ancestor = Editor>(root: T, range: Range) => T['children'];
95
95
  /**
96
96
  * Get the descendant node referred to by a specific path. If the path is an
97
97
  * empty array, it refers to the root node itself.
@@ -1,6 +1,6 @@
1
1
  import { h, defineComponent, provide, ref, computed, onMounted, onUnmounted, renderSlot, inject, watch, renderList, onUpdated, reactive, useAttrs, toRaw } from "vue";
2
- import { R as Range, N as Node, S as Scrubber, T as Text, P as Path, E as Editor, a as Element, c as Transforms } from "./batch-dirty-paths-c2XLn-yG.js";
3
- import { I as IS_ANDROID, p as isDOMNode, D as DOMEditor, Q as MARK_PLACEHOLDER_SYMBOL, d as EDITOR_TO_ON_CHANGE, w as IS_FIREFOX, z as IS_WEBKIT, E as EDITOR_TO_KEY_TO_ELEMENT, L as ELEMENT_TO_NODE, R as NODE_TO_ELEMENT, S as NODE_TO_INDEX, T as NODE_TO_PARENT, r as reconcileChildren, e as applyStringDiff, q as isDOMSelection, n as normalizeStringDiff, P as IS_READ_ONLY, h as getDefaultView, J as EDITOR_TO_WINDOW, G as EDITOR_TO_ELEMENT, H as HAS_BEFORE_INPUT_SUPPORT, C as CAN_USE_DOM, f as getActiveElement, j as getSelection, O as IS_FOCUSED, s as isPlainTextOnlyPaste, M as IS_COMPOSING, F as Hotkeys, v as IS_CHROME, x as IS_FIREFOX_LEGACY, y as IS_IOS, B as IS_WECHATBROWSER, A as IS_UC_MOBILE, a as EDITOR_TO_USER_MARKS, o as isDOMElement, b as EDITOR_TO_USER_SELECTION } from "./hotkeys-BR6GOVlt.js";
2
+ import { R as Range, N as Node, S as Scrubber, T as Text, P as Path, E as Editor, a as Element, c as Transforms } from "./batch-dirty-paths-BikbYJJS.js";
3
+ import { I as IS_ANDROID, p as isDOMNode, D as DOMEditor, Q as MARK_PLACEHOLDER_SYMBOL, d as EDITOR_TO_ON_CHANGE, w as IS_FIREFOX, z as IS_WEBKIT, E as EDITOR_TO_KEY_TO_ELEMENT, L as ELEMENT_TO_NODE, R as NODE_TO_ELEMENT, S as NODE_TO_INDEX, T as NODE_TO_PARENT, r as reconcileChildren, e as applyStringDiff, q as isDOMSelection, n as normalizeStringDiff, P as IS_READ_ONLY, h as getDefaultView, J as EDITOR_TO_WINDOW, G as EDITOR_TO_ELEMENT, H as HAS_BEFORE_INPUT_SUPPORT, C as CAN_USE_DOM, f as getActiveElement, j as getSelection, O as IS_FOCUSED, s as isPlainTextOnlyPaste, M as IS_COMPOSING, F as Hotkeys, v as IS_CHROME, x as IS_FIREFOX_LEGACY, y as IS_IOS, B as IS_WECHATBROWSER, A as IS_UC_MOBILE, a as EDITOR_TO_USER_MARKS, o as isDOMElement, b as EDITOR_TO_USER_SELECTION } from "./hotkeys-CguAQWxj.js";
4
4
  const SLATE_USE_EDITOR = Symbol("SLATE_USE_EDITOR");
5
5
  const SLATE_USE_ELEMENT = Symbol("SLATE_USE_ELEMENT");
6
6
  const SLATE_USE_FOCUSED = Symbol("SLATE_USE_FOCUSED");
package/dist/yjs.js CHANGED
@@ -1,9 +1,9 @@
1
- import { d as isObject, T as Text, N as Node, P as Path, E as Editor, t as toRawWeakMap, c as Transforms, R as Range } from "./batch-dirty-paths-c2XLn-yG.js";
1
+ import { d as isObject, T as Text, N as Node, P as Path, E as Editor, t as toRawWeakMap, c as Transforms, R as Range } from "./batch-dirty-paths-BikbYJJS.js";
2
2
  import { toRaw, ref, onMounted, onUnmounted, watch, onUpdated, computed } from "vue";
3
3
  import { XmlText, YTextEvent, createRelativePositionFromTypeIndex, createAbsolutePositionFromRelativePosition, createRelativePositionFromJSON, decodeRelativePosition, encodeRelativePosition, UndoManager, compareRelativePositions } from "yjs";
4
- import { L as Location } from "./location-CY2z7Wai.js";
5
- import { u as useEditor, i as useFocused } from "./use-focused-CcY69FbK.js";
6
- import { D as DOMEditor } from "./hotkeys-BR6GOVlt.js";
4
+ import { L as Location } from "./location-srcQyGzN.js";
5
+ import { u as useEditor, i as useFocused } from "./use-focused-CwWljAMN.js";
6
+ import { D as DOMEditor } from "./hotkeys-CguAQWxj.js";
7
7
  function deepEquals(node, another) {
8
8
  for (const key in node) {
9
9
  const a = node[key];
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "slate-vue3",
3
- "version": "0.7.13",
3
+ "version": "0.7.15",
4
4
  "type": "module",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.js",
@@ -53,8 +53,8 @@
53
53
  "build": "vite build",
54
54
  "preview": "vite preview",
55
55
  "build-all": "vite build --mode=lib",
56
- "e2e": "node --no-experimental-strip-types node_modules/@playwright/test/cli.js test",
57
- "e2e-ui": "node --no-experimental-strip-types node_modules/@playwright/test/cli.js test --ui",
56
+ "e2e": "playwright test",
57
+ "e2e-ui": "playwright test --ui",
58
58
  "test": "vitest"
59
59
  },
60
60
  "dependencies": {
@@ -68,16 +68,16 @@
68
68
  },
69
69
  "devDependencies": {
70
70
  "@faker-js/faker": "^9.9.0",
71
- "@liveblocks/client": "^3.2.0",
72
- "@liveblocks/yjs": "^3.2.0",
73
- "@playwright/test": "^1.54.1",
71
+ "@liveblocks/client": "^3.3.3",
72
+ "@liveblocks/yjs": "^3.3.3",
73
+ "@playwright/test": "^1.54.2",
74
74
  "@testing-library/vue": "^8.1.0",
75
75
  "@types/is-hotkey": "^0.1.10",
76
76
  "@types/is-url": "^1.2.32",
77
77
  "@types/lodash-es": "^4.17.12",
78
- "@types/node": "^24.1.0",
78
+ "@types/node": "^24.2.1",
79
79
  "@types/prismjs": "^1.26.5",
80
- "@vitejs/plugin-vue": "^6.0.0",
80
+ "@vitejs/plugin-vue": "^6.0.1",
81
81
  "babel-plugin-transform-regex": "^6.0.1",
82
82
  "image-extensions": "^1.1.0",
83
83
  "is-url": "^1.2.4",
@@ -86,9 +86,9 @@
86
86
  "remark-gfm": "^4.0.1",
87
87
  "remark-parse": "^11.0.0",
88
88
  "remark-slate-transformer": "^0.9.0",
89
- "typescript": "~5.8.3",
89
+ "typescript": "~5.9.2",
90
90
  "unified": "^11.0.5",
91
- "vite": "^7.0.6",
91
+ "vite": "^7.1.2",
92
92
  "vite-plugin-babel": "^1.3.2",
93
93
  "vite-plugin-dts": "^4.5.4",
94
94
  "vitest": "^3.2.4",