slate-vue3 0.0.37 → 0.0.38

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.
@@ -1,6 +1,3 @@
1
- var __defProp = Object.defineProperty;
2
- var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
3
- var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
4
1
  import { isProxy, toRaw } from "vue";
5
2
  /*!
6
3
  * is-plain-object <https://github.com/jonschlinkert/is-plain-object>
@@ -23,41 +20,47 @@ function isPlainObject(o) {
23
20
  }
24
21
  return true;
25
22
  }
26
- class toRawWeakMap {
23
+ class toRawWeakMap extends WeakMap {
27
24
  constructor() {
28
- __publicField(this, "weak");
29
- this.weak = /* @__PURE__ */ new WeakMap();
25
+ super();
30
26
  }
31
27
  /**
32
28
  * Removes the specified element from the toRawWeakMap.
33
29
  * @returns true if the element was successfully removed, or false if it was not present.
34
30
  */
35
31
  delete(key) {
36
- return this.weak.delete(isProxy(key) ? toRaw(key) : key);
32
+ return super.delete(isProxy(key) ? toRaw(key) : key);
37
33
  }
38
34
  /**
39
35
  * @returns a specified element.
40
36
  */
41
37
  get(key) {
42
- return this.weak.get(isProxy(key) ? toRaw(key) : key);
38
+ return super.get(isProxy(key) ? toRaw(key) : key);
43
39
  }
44
40
  /**
45
41
  * @returns a boolean indicating whether an element with the specified key exists or not.
46
42
  */
47
43
  has(key) {
48
- return this.weak.has(isProxy(key) ? toRaw(key) : key);
44
+ return super.has(isProxy(key) ? toRaw(key) : key);
49
45
  }
50
46
  /**
51
47
  * Adds a new element with a specified key and value.
52
48
  * @param key Must be an object or symbol.
53
49
  */
54
50
  set(key, value) {
55
- return this.weak.set(
51
+ return super.set(
56
52
  isProxy(key) ? toRaw(key) : key,
57
53
  isProxy(value) ? toRaw(value) : value
58
54
  );
59
55
  }
60
56
  }
57
+ const DIRTY_PATHS = new toRawWeakMap();
58
+ const DIRTY_PATH_KEYS = new toRawWeakMap();
59
+ const FLUSHING = new toRawWeakMap();
60
+ const NORMALIZING = new toRawWeakMap();
61
+ const PATH_REFS = new toRawWeakMap();
62
+ const POINT_REFS = new toRawWeakMap();
63
+ const RANGE_REFS = new toRawWeakMap();
61
64
  const Path = {
62
65
  ancestors(path, options = {}) {
63
66
  const { reverse = false } = options;
@@ -1264,7 +1267,7 @@ function baseAssignIn(object, source) {
1264
1267
  var freeExports = typeof exports == "object" && exports && !exports.nodeType && exports;
1265
1268
  var freeModule = freeExports && typeof module == "object" && module && !module.nodeType && module;
1266
1269
  var moduleExports = freeModule && freeModule.exports === freeExports;
1267
- var Buffer2 = moduleExports ? root.Buffer : void 0, allocUnsafe = Buffer2 ? Buffer2.allocUnsafe : void 0;
1270
+ var Buffer = moduleExports ? root.Buffer : void 0, allocUnsafe = Buffer ? Buffer.allocUnsafe : void 0;
1268
1271
  function cloneBuffer(buffer, isDeep) {
1269
1272
  if (isDeep) {
1270
1273
  return buffer.slice();
@@ -1360,10 +1363,10 @@ function initCloneArray(array) {
1360
1363
  }
1361
1364
  return result;
1362
1365
  }
1363
- var Uint8Array2 = root.Uint8Array;
1366
+ var Uint8Array = root.Uint8Array;
1364
1367
  function cloneArrayBuffer(arrayBuffer) {
1365
1368
  var result = new arrayBuffer.constructor(arrayBuffer.byteLength);
1366
- new Uint8Array2(result).set(new Uint8Array2(arrayBuffer));
1369
+ new Uint8Array(result).set(new Uint8Array(arrayBuffer));
1367
1370
  return result;
1368
1371
  }
1369
1372
  function cloneDataView(dataView, isDeep) {
@@ -2341,8 +2344,24 @@ const Transforms = {
2341
2344
  ...SelectionTransforms,
2342
2345
  ...TextTransforms
2343
2346
  };
2347
+ const BATCHING_DIRTY_PATHS = new toRawWeakMap();
2348
+ const isBatchingDirtyPaths = (editor) => {
2349
+ return BATCHING_DIRTY_PATHS.get(editor) || false;
2350
+ };
2351
+ const batchDirtyPaths = (editor, fn, update) => {
2352
+ const value = BATCHING_DIRTY_PATHS.get(editor) || false;
2353
+ BATCHING_DIRTY_PATHS.set(editor, true);
2354
+ try {
2355
+ fn();
2356
+ update();
2357
+ } finally {
2358
+ BATCHING_DIRTY_PATHS.set(editor, value);
2359
+ }
2360
+ };
2344
2361
  export {
2362
+ DIRTY_PATHS as D,
2345
2363
  Editor as E,
2364
+ FLUSHING as F,
2346
2365
  MapCache as M,
2347
2366
  Node as N,
2348
2367
  Operation as O,
@@ -2364,9 +2383,16 @@ export {
2364
2383
  Element as l,
2365
2384
  Transforms as m,
2366
2385
  Point as n,
2367
- cloneDeep as o,
2368
- getDefaultInsertLocation as p,
2369
- isEditor as q,
2370
- isPlainObject as r,
2371
- toRawWeakMap as t
2386
+ DIRTY_PATH_KEYS as o,
2387
+ isBatchingDirtyPaths as p,
2388
+ NORMALIZING as q,
2389
+ PATH_REFS as r,
2390
+ POINT_REFS as s,
2391
+ RANGE_REFS as t,
2392
+ cloneDeep as u,
2393
+ getDefaultInsertLocation as v,
2394
+ batchDirtyPaths as w,
2395
+ isEditor as x,
2396
+ toRawWeakMap as y,
2397
+ isPlainObject as z
2372
2398
  };
package/dist/core.js CHANGED
@@ -1,6 +1,6 @@
1
+ import { P as Path, n as Point, R as Range, E as Editor, D as DIRTY_PATHS, o as DIRTY_PATH_KEYS, p as isBatchingDirtyPaths, m as Transforms, F as FLUSHING, T as Text, N as Node, l as Element, q as NORMALIZING, r as PATH_REFS, s as POINT_REFS, t as RANGE_REFS, u as cloneDeep, v as getDefaultInsertLocation, k as Scrubber, w as batchDirtyPaths } from "./batch-dirty-paths-B1wfvdKs.js";
2
+ import { O, x } from "./batch-dirty-paths-B1wfvdKs.js";
1
3
  import { reactive } from "vue";
2
- import { P as Path, n as Point, R as Range, t as toRawWeakMap, E as Editor, m as Transforms, T as Text, N as Node, l as Element, o as cloneDeep, p as getDefaultInsertLocation, k as Scrubber } from "./index-CjnPdoJN.js";
3
- import { O, q } from "./index-CjnPdoJN.js";
4
4
  const PathRef = {
5
5
  transform(ref, op) {
6
6
  const { current, affinity } = ref;
@@ -40,13 +40,6 @@ const RangeRef = {
40
40
  }
41
41
  }
42
42
  };
43
- const DIRTY_PATHS = new toRawWeakMap();
44
- const DIRTY_PATH_KEYS = new toRawWeakMap();
45
- const FLUSHING = new toRawWeakMap();
46
- const NORMALIZING = new toRawWeakMap();
47
- const PATH_REFS = new toRawWeakMap();
48
- const POINT_REFS = new toRawWeakMap();
49
- const RANGE_REFS = new toRawWeakMap();
50
43
  const Location = {
51
44
  isLocation(value) {
52
45
  return Path.isPath(value) || Point.isPoint(value) || Range.isRange(value);
@@ -234,8 +227,8 @@ const getCodepointType = (char, code) => {
234
227
  }
235
228
  return type;
236
229
  };
237
- function intersects(x, y) {
238
- return (x & y) !== 0;
230
+ function intersects(x2, y) {
231
+ return (x2 & y) !== 0;
239
232
  }
240
233
  const NonBoundaryPairs = [
241
234
  // GB6
@@ -306,20 +299,6 @@ const endsWithOddNumberOfRIs = (str) => {
306
299
  return numRIs % 2 === 1;
307
300
  }
308
301
  };
309
- const BATCHING_DIRTY_PATHS = new toRawWeakMap();
310
- const isBatchingDirtyPaths = (editor) => {
311
- return BATCHING_DIRTY_PATHS.get(editor) || false;
312
- };
313
- const batchDirtyPaths = (editor, fn, update) => {
314
- const value = BATCHING_DIRTY_PATHS.get(editor) || false;
315
- BATCHING_DIRTY_PATHS.set(editor, true);
316
- try {
317
- fn();
318
- update();
319
- } finally {
320
- BATCHING_DIRTY_PATHS.set(editor, value);
321
- }
322
- };
323
302
  function updateDirtyPaths(editor, newDirtyPaths, transform) {
324
303
  const oldDirtyPaths = DIRTY_PATHS.get(editor) || [];
325
304
  const oldDirtyPathKeys = DIRTY_PATH_KEYS.get(editor) || /* @__PURE__ */ new Set();
@@ -2568,7 +2547,7 @@ export {
2568
2547
  insertText,
2569
2548
  isBlock,
2570
2549
  isEdge,
2571
- q as isEditor,
2550
+ x as isEditor,
2572
2551
  isEmpty,
2573
2552
  isEnd,
2574
2553
  isNormalizing,
package/dist/dom.d.ts CHANGED
@@ -1940,8 +1940,7 @@ declare type TextUnit = 'character' | 'word' | 'line' | 'block';
1940
1940
 
1941
1941
  declare type TextUnitAdjustment = TextUnit | 'offset';
1942
1942
 
1943
- declare class toRawWeakMap<K extends WeakKey, V> {
1944
- private weak;
1943
+ declare class toRawWeakMap<K extends WeakKey, V> extends WeakMap {
1945
1944
  constructor();
1946
1945
  /**
1947
1946
  * Removes the specified element from the toRawWeakMap.
@@ -1951,7 +1950,7 @@ declare class toRawWeakMap<K extends WeakKey, V> {
1951
1950
  /**
1952
1951
  * @returns a specified element.
1953
1952
  */
1954
- get(key: K): V | undefined;
1953
+ get(key: K): any;
1955
1954
  /**
1956
1955
  * @returns a boolean indicating whether an element with the specified key exists or not.
1957
1956
  */
@@ -1960,7 +1959,7 @@ declare class toRawWeakMap<K extends WeakKey, V> {
1960
1959
  * Adds a new element with a specified key and value.
1961
1960
  * @param key Must be an object or symbol.
1962
1961
  */
1963
- set(key: K, value: V): WeakMap<K, V>;
1962
+ set(key: K, value: V): this;
1964
1963
  }
1965
1964
 
1966
1965
  declare const Transforms: GeneralTransforms & NodeTransforms & SelectionTransforms & TextTransforms;
package/dist/dom.js CHANGED
@@ -1,6 +1,6 @@
1
- import { D as DOMEditor, b as EDITOR_TO_KEY_TO_ELEMENT, x as EDITOR_TO_USER_MARKS, r as EDITOR_TO_USER_SELECTION, F as NODE_TO_KEY, G as isDOMText, J as getPlainText, K as getSlateFragmentAttribute, E as EDITOR_TO_ON_CHANGE, P as PLACEHOLDER_SYMBOL } from "./hotkeys-CFtX6lwM.js";
2
- import { C, m, l, c, H, z, I, A, s, y, u, q, a, j, w, f, v, T, M, N, d, e, g, o, k, p, L, O, Q, t, i, h, B, R, S, n } from "./hotkeys-CFtX6lwM.js";
3
- import { E as Editor, R as Range, t as toRawWeakMap, l as Element, m as Transforms, P as Path, N as Node } from "./index-CjnPdoJN.js";
1
+ import { D as DOMEditor, b as EDITOR_TO_KEY_TO_ELEMENT, x as EDITOR_TO_USER_MARKS, r as EDITOR_TO_USER_SELECTION, F as NODE_TO_KEY, G as isDOMText, J as getPlainText, K as getSlateFragmentAttribute, E as EDITOR_TO_ON_CHANGE, P as PLACEHOLDER_SYMBOL } from "./hotkeys-BcYtYztM.js";
2
+ import { C, m, l, c, H, z, I, A, s, y, u, q, a, j, w, f, v, T, M, N, d, e, g, o, k, p, L, O, Q, t, i, h, B, R, S, n } from "./hotkeys-BcYtYztM.js";
3
+ import { E as Editor, R as Range, y as toRawWeakMap, l as Element, m as Transforms, P as Path, N as Node } from "./batch-dirty-paths-B1wfvdKs.js";
4
4
  import "vue";
5
5
  const doRectsIntersect = (rect, compareRect) => {
6
6
  const middle = (compareRect.top + compareRect.bottom) / 2;
package/dist/history.d.ts CHANGED
@@ -1658,8 +1658,7 @@ declare type TextUnit = 'character' | 'word' | 'line' | 'block';
1658
1658
 
1659
1659
  declare type TextUnitAdjustment = TextUnit | 'offset';
1660
1660
 
1661
- declare class toRawWeakMap<K extends WeakKey, V> {
1662
- private weak;
1661
+ declare class toRawWeakMap<K extends WeakKey, V> extends WeakMap {
1663
1662
  constructor();
1664
1663
  /**
1665
1664
  * Removes the specified element from the toRawWeakMap.
@@ -1669,7 +1668,7 @@ declare class toRawWeakMap<K extends WeakKey, V> {
1669
1668
  /**
1670
1669
  * @returns a specified element.
1671
1670
  */
1672
- get(key: K): V | undefined;
1671
+ get(key: K): any;
1673
1672
  /**
1674
1673
  * @returns a boolean indicating whether an element with the specified key exists or not.
1675
1674
  */
@@ -1678,7 +1677,7 @@ declare class toRawWeakMap<K extends WeakKey, V> {
1678
1677
  * Adds a new element with a specified key and value.
1679
1678
  * @param key Must be an object or symbol.
1680
1679
  */
1681
- set(key: K, value: V): WeakMap<K, V>;
1680
+ set(key: K, value: V): this;
1682
1681
  }
1683
1682
 
1684
1683
  declare const Transforms: GeneralTransforms & NodeTransforms & SelectionTransforms & TextTransforms;
package/dist/history.js CHANGED
@@ -1,4 +1,4 @@
1
- import { r as isPlainObject, O as Operation, t as toRawWeakMap, E as Editor, m as Transforms, P as Path } from "./index-CjnPdoJN.js";
1
+ import { z as isPlainObject, O as Operation, y as toRawWeakMap, E as Editor, m as Transforms, P as Path } from "./batch-dirty-paths-B1wfvdKs.js";
2
2
  import "vue";
3
3
  const History = {
4
4
  /**
@@ -2,8 +2,8 @@ var __defProp = Object.defineProperty;
2
2
  var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
3
3
  var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
4
4
  var _a, _b;
5
+ import { y as toRawWeakMap, m as Transforms, l as Element, E as Editor, k as Scrubber, R as Range } from "./batch-dirty-paths-B1wfvdKs.js";
5
6
  import "vue";
6
- import { t as toRawWeakMap, m as Transforms, l as Element, E as Editor, k as Scrubber, R as Range } from "./index-CjnPdoJN.js";
7
7
  const getDefaultView = (value) => {
8
8
  return value && value.ownerDocument && value.ownerDocument.defaultView || null;
9
9
  };
package/dist/index.js CHANGED
@@ -1,6 +1,6 @@
1
1
  import { defineComponent, provide, ref, computed, onMounted, onUnmounted, renderSlot, inject, h, watch, renderList, Fragment, useAttrs, reactive } from "vue";
2
- import { i as isObjectLike, b as baseGetTag, S as Symbol$1, a as isArray, d as defineProperty, M as MapCache, c as isArguments, e as arrayPush, g as getPrototype, f as copyObject, h as getAllKeysIn, j as baseClone, N as Node, k as Scrubber, P as Path, E as Editor, R as Range, T as Text, l as Element, m as Transforms } from "./index-CjnPdoJN.js";
3
- import { D as DOMEditor, E as EDITOR_TO_ON_CHANGE, M as MARK_PLACEHOLDER_SYMBOL, I as IS_ANDROID, a as IS_IOS, b as EDITOR_TO_KEY_TO_ELEMENT, c as ELEMENT_TO_NODE, N as NODE_TO_ELEMENT, d as NODE_TO_INDEX, e as NODE_TO_PARENT, i as isDOMNode, f as IS_WEBKIT, g as applyStringDiff, h as isDOMSelection, n as normalizeStringDiff, j as IS_READ_ONLY, k as getDefaultView, l as EDITOR_TO_WINDOW, m as EDITOR_TO_ELEMENT, H as HAS_BEFORE_INPUT_SUPPORT, C as CAN_USE_DOM, o as getActiveElement, p as getSelection, q as IS_FOCUSED, r as EDITOR_TO_USER_SELECTION, s as IS_COMPOSING, t as isDOMElement, u as IS_FIREFOX_LEGACY, v as IS_WECHATBROWSER, w as IS_UC_MOBILE, x as EDITOR_TO_USER_MARKS, y as IS_FIREFOX, z as Hotkeys, A as IS_CHROME, B as isPlainTextOnlyPaste } from "./hotkeys-CFtX6lwM.js";
2
+ import { i as isObjectLike, b as baseGetTag, S as Symbol$1, a as isArray, d as defineProperty, M as MapCache, c as isArguments, e as arrayPush, g as getPrototype, f as copyObject, h as getAllKeysIn, j as baseClone, N as Node, k as Scrubber, P as Path, E as Editor, R as Range, T as Text, l as Element, m as Transforms } from "./batch-dirty-paths-B1wfvdKs.js";
3
+ import { D as DOMEditor, E as EDITOR_TO_ON_CHANGE, M as MARK_PLACEHOLDER_SYMBOL, I as IS_ANDROID, a as IS_IOS, b as EDITOR_TO_KEY_TO_ELEMENT, c as ELEMENT_TO_NODE, N as NODE_TO_ELEMENT, d as NODE_TO_INDEX, e as NODE_TO_PARENT, i as isDOMNode, f as IS_WEBKIT, g as applyStringDiff, h as isDOMSelection, n as normalizeStringDiff, j as IS_READ_ONLY, k as getDefaultView, l as EDITOR_TO_WINDOW, m as EDITOR_TO_ELEMENT, H as HAS_BEFORE_INPUT_SUPPORT, C as CAN_USE_DOM, o as getActiveElement, p as getSelection, q as IS_FOCUSED, r as EDITOR_TO_USER_SELECTION, s as IS_COMPOSING, t as isDOMElement, u as IS_FIREFOX_LEGACY, v as IS_WECHATBROWSER, w as IS_UC_MOBILE, x as EDITOR_TO_USER_MARKS, y as IS_FIREFOX, z as Hotkeys, A as IS_CHROME, B as isPlainTextOnlyPaste } from "./hotkeys-BcYtYztM.js";
4
4
  const SLATE_USE_EDITOR = Symbol("SLATE_USE_EDITOR");
5
5
  const SLATE_USE_DECORATE = Symbol("SLATE_USE_DECORATE");
6
6
  const SLATE_USE_SELECTED = Symbol("SLATE_USE_SELECTED");
@@ -512,9 +512,6 @@ const TextComp = defineComponent({
512
512
  }
513
513
  });
514
514
  onUnmounted(() => {
515
- const key = DOMEditor.findKey(editor, text);
516
- const KEY_TO_ELEMENT = EDITOR_TO_KEY_TO_ELEMENT.get(editor);
517
- KEY_TO_ELEMENT == null ? void 0 : KEY_TO_ELEMENT.delete(key);
518
515
  NODE_TO_ELEMENT.delete(text);
519
516
  if (spanRef.value) {
520
517
  ELEMENT_TO_NODE.delete(spanRef.value);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "slate-vue3",
3
- "version": "0.0.37",
3
+ "version": "0.0.38",
4
4
  "type": "module",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.js",