slate-vue3 0.0.41 → 0.1.0

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.
Files changed (44) hide show
  1. package/README.md +6 -4
  2. package/dist/{batch-dirty-paths-CZqHWmdq.js → batch-dirty-paths-Dg98evlh.js} +13 -9
  3. package/dist/core.js +26 -25
  4. package/dist/{create-editor-BP4gf1UN.js → create-editor-DEzIjX9i.js} +23 -34
  5. package/dist/dom.js +11 -9
  6. package/dist/history.js +1 -1
  7. package/dist/{hotkeys-DpsWjIJe.js → hotkeys-B4x3w0cT.js} +11 -8
  8. package/dist/hyperscript.js +2 -2
  9. package/dist/index.js +8 -270
  10. package/dist/location-C434eqV0.js +16 -0
  11. package/dist/omit-DucjzKZK.js +270 -0
  12. package/dist/slate-dom/custom-types.d.ts +0 -4
  13. package/dist/slate-dom/index.d.ts +1 -1
  14. package/dist/slate-dom/utils/weak-maps.d.ts +0 -4
  15. package/dist/slate-yjs/applyToSlate/index.d.ts +19 -0
  16. package/dist/slate-yjs/applyToSlate/textEvent.d.ts +3 -0
  17. package/dist/slate-yjs/applyToYjs/index.d.ts +3 -0
  18. package/dist/slate-yjs/applyToYjs/node/index.d.ts +3 -0
  19. package/dist/slate-yjs/applyToYjs/node/insertNode.d.ts +3 -0
  20. package/dist/slate-yjs/applyToYjs/node/mergeNode.d.ts +3 -0
  21. package/dist/slate-yjs/applyToYjs/node/moveNode.d.ts +3 -0
  22. package/dist/slate-yjs/applyToYjs/node/removeNode.d.ts +3 -0
  23. package/dist/slate-yjs/applyToYjs/node/setNode.d.ts +3 -0
  24. package/dist/slate-yjs/applyToYjs/node/splitNode.d.ts +3 -0
  25. package/dist/slate-yjs/applyToYjs/text/index.d.ts +3 -0
  26. package/dist/slate-yjs/applyToYjs/text/insertText.d.ts +3 -0
  27. package/dist/slate-yjs/applyToYjs/text/removeText.d.ts +3 -0
  28. package/dist/slate-yjs/applyToYjs/types.d.ts +8 -0
  29. package/dist/slate-yjs/index.d.ts +5 -0
  30. package/dist/slate-yjs/model/types.d.ts +37 -0
  31. package/dist/slate-yjs/plugins/index.d.ts +3 -0
  32. package/dist/slate-yjs/plugins/withCursors.d.ts +38 -0
  33. package/dist/slate-yjs/plugins/withYHistory.d.ts +19 -0
  34. package/dist/slate-yjs/plugins/withYjs.d.ts +42 -0
  35. package/dist/slate-yjs/utils/clone.d.ts +4 -0
  36. package/dist/slate-yjs/utils/convert.d.ts +7 -0
  37. package/dist/slate-yjs/utils/delta.d.ts +7 -0
  38. package/dist/slate-yjs/utils/location.d.ts +11 -0
  39. package/dist/slate-yjs/utils/object.d.ts +7 -0
  40. package/dist/slate-yjs/utils/position.d.ts +19 -0
  41. package/dist/slate-yjs/utils/slate.d.ts +2 -0
  42. package/dist/slate-yjs/utils/yjs.d.ts +4 -0
  43. package/dist/yjs.js +1409 -0
  44. package/package.json +11 -1
package/README.md CHANGED
@@ -139,19 +139,19 @@ interface EditableProps extends HTMLAttributes {
139
139
  ## onchange
140
140
  > any change in slate will trigger it
141
141
  ```typescript
142
- const onchange: (event: Descendant[]) => void
142
+ const onchange: (event: { operation?: Operation }) => void
143
143
  ```
144
144
 
145
145
  ## onvaluechange
146
146
  > slate children change in slate will trigger it
147
147
  ```typescript
148
- const onvaluechange: (event: Descendant[]) => void
148
+ const onvaluechange: (event: { operation?: Operation }) => void
149
149
  ```
150
150
 
151
151
  ## onselectionchange
152
152
  > slate selection change in slate will trigger it
153
153
  ```typescript
154
- const onselectionchange: (event: Selection) => void
154
+ const onselectionchange: (event: { operation?: Operation }) => void
155
155
  ```
156
156
 
157
157
  # Hooks in slate-vue3
@@ -243,7 +243,9 @@ Vue uses lazy updates, rendering with components generates additional state, whi
243
243
  - [slate-vue](https://github.com/Guan-Erjia/slate-vue3/tree/master/packages/slate-vue)
244
244
  Vue components for rendering slate editors
245
245
  - [slate-history](https://github.com/Guan-Erjia/slate-vue3/tree/master/packages/slate-history)
246
- Provide undo redo functions, replace Weakmap to UnProxyWeakmap
246
+ Same with slate-history
247
+ - [slate-hyperscript](https://github.com/Guan-Erjia/slate-vue3/tree/master/packages/slate-hyperscript)
248
+ Same with slate-history
247
249
  - [share-tools](https://github.com/Guan-Erjia/slate-vue3/tree/master/packages/share-tools)
248
250
  for special processing of Proxy data, obtain the raw pointer, isPlainObject declare
249
251
 
@@ -2359,9 +2359,13 @@ const batchDirtyPaths = (editor, fn, update) => {
2359
2359
  }
2360
2360
  };
2361
2361
  export {
2362
+ POINT_REFS as A,
2363
+ RANGE_REFS as B,
2364
+ getDefaultInsertLocation as C,
2362
2365
  DIRTY_PATHS as D,
2363
2366
  Editor as E,
2364
2367
  FLUSHING as F,
2368
+ batchDirtyPaths as G,
2365
2369
  MapCache as M,
2366
2370
  Node as N,
2367
2371
  Operation as O,
@@ -2385,14 +2389,14 @@ export {
2385
2389
  copyObject as n,
2386
2390
  getAllKeysIn as o,
2387
2391
  baseClone as p,
2388
- DIRTY_PATH_KEYS as q,
2389
- isBatchingDirtyPaths as r,
2390
- NORMALIZING as s,
2392
+ isLength as q,
2393
+ isIndex as r,
2394
+ isObject as s,
2391
2395
  toRawWeakMap as t,
2392
- PATH_REFS as u,
2393
- POINT_REFS as v,
2394
- RANGE_REFS as w,
2395
- cloneDeep as x,
2396
- getDefaultInsertLocation as y,
2397
- batchDirtyPaths as z
2396
+ assignValue as u,
2397
+ cloneDeep as v,
2398
+ DIRTY_PATH_KEYS as w,
2399
+ isBatchingDirtyPaths as x,
2400
+ NORMALIZING as y,
2401
+ PATH_REFS as z
2398
2402
  };
package/dist/core.js CHANGED
@@ -1,19 +1,20 @@
1
- import { a6, a8, a9, aa, a7, d, e, f, a, h, al, c, i, j, k, ar, am, l, m, o, p, q, g, b, r, t, u, v, w, x, as, y, ab, z, A, B, C, D, E, F, G, H, I, J, ac, K, ad, an, ae, L, M, N, O, n, P, S, Q, R, V, T, U, W, X, _, Y, Z, $, af, ao, ag, a0, ap, aq, a5, s, ah, a1, a2, a3, ai, aj, a4, ak } from "./create-editor-BP4gf1UN.js";
2
- import { E as E2, a as a10, 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 } from "./batch-dirty-paths-CZqHWmdq.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-DEzIjX9i.js";
2
+ import { E as E2, a as a10, 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 } from "./batch-dirty-paths-Dg98evlh.js";
3
+ import { L as L2, S as S3 } from "./location-C434eqV0.js";
3
4
  export {
4
5
  E2 as Editor,
5
6
  a10 as Element,
6
- a6 as Location,
7
+ L2 as Location,
7
8
  N2 as Node,
8
9
  O2 as Operation,
9
10
  P2 as Path,
10
- a8 as PathRef,
11
+ a6 as PathRef,
11
12
  b2 as Point,
12
- a9 as PointRef,
13
+ a7 as PointRef,
13
14
  R2 as Range,
14
- aa as RangeRef,
15
+ a8 as RangeRef,
15
16
  S2 as Scrubber,
16
- a7 as Span,
17
+ S3 as Span,
17
18
  T2 as Text,
18
19
  c2 as Transforms,
19
20
  d as above,
@@ -21,13 +22,13 @@ export {
21
22
  f as after,
22
23
  a as apply,
23
24
  h as before,
24
- al as collapse,
25
+ aj as collapse,
25
26
  c as createEditor,
26
27
  i as deleteBackward,
27
28
  j as deleteForward,
28
29
  k as deleteFragment,
29
- ar as deleteText,
30
- am as deselect,
30
+ ap as deleteText,
31
+ ak as deselect,
31
32
  l as edges,
32
33
  m as elementReadOnly,
33
34
  o as end,
@@ -41,9 +42,9 @@ export {
41
42
  v as hasPath,
42
43
  w as hasTexts,
43
44
  x as insertBreak,
44
- as as insertFragment,
45
+ aq as insertFragment,
45
46
  y as insertNode,
46
- ab as insertNodes,
47
+ a9 as insertNodes,
47
48
  z as insertSoftBreak,
48
49
  A as insertText,
49
50
  B as isBlock,
@@ -56,11 +57,11 @@ export {
56
57
  H as last,
57
58
  I as leaf,
58
59
  J as levels,
59
- ac as liftNodes,
60
+ aa as liftNodes,
60
61
  K as marks,
61
- ad as mergeNodes,
62
- an as move,
63
- ae as moveNodes,
62
+ ab as mergeNodes,
63
+ al as move,
64
+ ac as moveNodes,
64
65
  L as next,
65
66
  M as node,
66
67
  N as nodes,
@@ -79,20 +80,20 @@ export {
79
80
  Y as rangeRef,
80
81
  Z as rangeRefs,
81
82
  $ as removeMark,
82
- af as removeNodes,
83
- ao as select,
84
- ag as setNodes,
83
+ ad as removeNodes,
84
+ am as select,
85
+ ae as setNodes,
85
86
  a0 as setNormalizing,
86
- ap as setPoint,
87
- aq as setSelection,
87
+ an as setPoint,
88
+ ao as setSelection,
88
89
  a5 as shouldMergeNodesRemovePrevNode,
89
90
  s as shouldNormalize,
90
- ah as splitNodes,
91
+ af as splitNodes,
91
92
  a1 as start,
92
93
  a2 as string,
93
94
  a3 as unhangRange,
94
- ai as unsetNodes,
95
- aj as unwrapNodes,
95
+ ag as unsetNodes,
96
+ ah as unwrapNodes,
96
97
  a4 as withoutNormalizing,
97
- ak as wrapNodes
98
+ ai as wrapNodes
98
99
  };
@@ -1,5 +1,6 @@
1
- import { P as Path, b as Point, R as Range, E as Editor, D as DIRTY_PATHS, q as DIRTY_PATH_KEYS, r as isBatchingDirtyPaths, c as Transforms, F as FLUSHING, T as Text, N as Node, a as Element, s as NORMALIZING, u as PATH_REFS, v as POINT_REFS, w as RANGE_REFS, x as cloneDeep, y as getDefaultInsertLocation, S as Scrubber, z as batchDirtyPaths } from "./batch-dirty-paths-CZqHWmdq.js";
1
+ import { P as Path, b as Point, R as Range, E as Editor, D as DIRTY_PATHS, w as DIRTY_PATH_KEYS, x as isBatchingDirtyPaths, c as Transforms, F as FLUSHING, T as Text, N as Node, a as Element, y as NORMALIZING, z as PATH_REFS, A as POINT_REFS, B as RANGE_REFS, v as cloneDeep, C as getDefaultInsertLocation, S as Scrubber, G as batchDirtyPaths } from "./batch-dirty-paths-Dg98evlh.js";
2
2
  import { reactive } from "vue";
3
+ import { S as Span } from "./location-C434eqV0.js";
3
4
  const PathRef = {
4
5
  transform(ref, op) {
5
6
  const { current, affinity } = ref;
@@ -39,16 +40,6 @@ const RangeRef = {
39
40
  }
40
41
  }
41
42
  };
42
- const Location = {
43
- isLocation(value) {
44
- return Path.isPath(value) || Point.isPoint(value) || Range.isRange(value);
45
- }
46
- };
47
- const Span = {
48
- isSpan(value) {
49
- return Array.isArray(value) && value.length === 2 && value.every(Path.isPath);
50
- }
51
- };
52
43
  const matchPath = (editor, path2) => {
53
44
  const [node2] = Editor.node(editor, path2);
54
45
  return (n) => n === node2;
@@ -2534,29 +2525,27 @@ export {
2534
2525
  unhangRange as a3,
2535
2526
  withoutNormalizing as a4,
2536
2527
  shouldMergeNodesRemovePrevNode as a5,
2537
- Location as a6,
2538
- Span as a7,
2539
- PathRef as a8,
2540
- PointRef as a9,
2541
- RangeRef as aa,
2542
- insertNodes as ab,
2543
- liftNodes as ac,
2544
- mergeNodes as ad,
2545
- moveNodes as ae,
2546
- removeNodes as af,
2547
- setNodes as ag,
2548
- splitNodes as ah,
2549
- unsetNodes as ai,
2550
- unwrapNodes as aj,
2551
- wrapNodes as ak,
2552
- collapse as al,
2553
- deselect as am,
2554
- move as an,
2555
- select as ao,
2556
- setPoint as ap,
2557
- setSelection as aq,
2558
- deleteText as ar,
2559
- insertFragment as as,
2528
+ PathRef as a6,
2529
+ PointRef as a7,
2530
+ RangeRef as a8,
2531
+ insertNodes as a9,
2532
+ liftNodes as aa,
2533
+ mergeNodes as ab,
2534
+ moveNodes as ac,
2535
+ removeNodes as ad,
2536
+ setNodes as ae,
2537
+ splitNodes as af,
2538
+ unsetNodes as ag,
2539
+ unwrapNodes as ah,
2540
+ wrapNodes as ai,
2541
+ collapse as aj,
2542
+ deselect as ak,
2543
+ move as al,
2544
+ select as am,
2545
+ setPoint as an,
2546
+ setSelection as ao,
2547
+ deleteText as ap,
2548
+ insertFragment as aq,
2560
2549
  getFragment as b,
2561
2550
  createEditor as c,
2562
2551
  above as d,
package/dist/dom.js CHANGED
@@ -1,6 +1,6 @@
1
- import { D as DOMEditor, 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, P as PLACEHOLDER_SYMBOL } from "./hotkeys-DpsWjIJe.js";
2
- import { C, F, G, J, H, B, I, u, L, v, w, M, x, O, z, y, A, K, Q, R, S, T, e, f, h, j, k, l, m, o, p, q, r, s, t, n } from "./hotkeys-DpsWjIJe.js";
3
- import { E as Editor, R as Range, a as Element, c as Transforms, P as Path, N as Node } from "./batch-dirty-paths-CZqHWmdq.js";
1
+ import { D as DOMEditor, 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-B4x3w0cT.js";
2
+ import { C, F, G, J, H, B, I, u, L, v, w, M, x, O, z, y, A, K, P, Q, R, S, e, f, h, j, k, l, m, o, p, q, r, s, t, n } from "./hotkeys-B4x3w0cT.js";
3
+ import { E as Editor, R as Range, a as Element, c as Transforms, P as Path, N as Node } from "./batch-dirty-paths-Dg98evlh.js";
4
4
  import "vue";
5
5
  const doRectsIntersect = (rect, compareRect) => {
6
6
  const middle = (compareRect.top + compareRect.bottom) / 2;
@@ -251,7 +251,10 @@ const shallowCompare = (obj1, obj2) => Object.keys(obj1).length === Object.keys(
251
251
  const isDecorationFlagsEqual = (range, other) => {
252
252
  const { anchor: rangeAnchor, focus: rangeFocus, ...rangeOwnProps } = range;
253
253
  const { anchor: otherAnchor, focus: otherFocus, ...otherOwnProps } = other;
254
- return range[PLACEHOLDER_SYMBOL] === other[PLACEHOLDER_SYMBOL] && shallowCompare(rangeOwnProps, otherOwnProps);
254
+ return shallowCompare(
255
+ rangeOwnProps,
256
+ otherOwnProps
257
+ );
255
258
  };
256
259
  const isElementDecorationsEqual = (list, another) => {
257
260
  if (list.length !== another.length) {
@@ -303,12 +306,11 @@ export {
303
306
  y as IS_WEBKIT,
304
307
  A as IS_WECHATBROWSER,
305
308
  K as Key,
306
- Q as MARK_PLACEHOLDER_SYMBOL,
307
- R as NODE_TO_ELEMENT,
308
- S as NODE_TO_INDEX,
309
+ P as MARK_PLACEHOLDER_SYMBOL,
310
+ Q as NODE_TO_ELEMENT,
311
+ R as NODE_TO_INDEX,
309
312
  NODE_TO_KEY,
310
- T as NODE_TO_PARENT,
311
- PLACEHOLDER_SYMBOL,
313
+ S as NODE_TO_PARENT,
312
314
  e as applyStringDiff,
313
315
  f as getActiveElement,
314
316
  h as getDefaultView,
package/dist/history.js CHANGED
@@ -1,4 +1,4 @@
1
- import { d as isPlainObject, O as Operation, t as toRawWeakMap, E as Editor, c as Transforms, P as Path } from "./batch-dirty-paths-CZqHWmdq.js";
1
+ import { d as isPlainObject, O as Operation, t as toRawWeakMap, E as Editor, c as Transforms, P as Path } from "./batch-dirty-paths-Dg98evlh.js";
2
2
  import "vue";
3
3
  const History = {
4
4
  /**
@@ -2,7 +2,7 @@ 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 { t as toRawWeakMap, c as Transforms, a as Element, E as Editor, S as Scrubber, R as Range } from "./batch-dirty-paths-CZqHWmdq.js";
5
+ import { t as toRawWeakMap, c as Transforms, a as Element, E as Editor, S as Scrubber, R as Range } from "./batch-dirty-paths-Dg98evlh.js";
6
6
  import "vue";
7
7
  const getDefaultView = (value) => {
8
8
  return value && value.ownerDocument && value.ownerDocument.defaultView || null;
@@ -196,7 +196,6 @@ const IS_COMPOSING = new toRawWeakMap();
196
196
  const EDITOR_TO_USER_SELECTION = new toRawWeakMap();
197
197
  const EDITOR_TO_ON_CHANGE = new toRawWeakMap();
198
198
  const EDITOR_TO_USER_MARKS = new toRawWeakMap();
199
- const PLACEHOLDER_SYMBOL = Symbol("placeholder");
200
199
  const MARK_PLACEHOLDER_SYMBOL = Symbol(
201
200
  "mark-placeholder"
202
201
  );
@@ -210,7 +209,12 @@ function getFirefoxNodeEl(node, offset) {
210
209
  while (el == null ? void 0 : el.firstChild) {
211
210
  el = isLeft ? el.firstChild : el.lastChild;
212
211
  }
213
- return [el || node, isLeft ? 0 : ((_a2 = el == null ? void 0 : el.textContent) == null ? void 0 : _a2.length) || 0];
212
+ if (!el) {
213
+ throw new Error(
214
+ `Compact on Firefox: Failed to find adjacent nodes: ${Scrubber.stringify(node)}`
215
+ );
216
+ }
217
+ return [el, isLeft ? 0 : ((_a2 = el.textContent) == null ? void 0 : _a2.length) || 0];
214
218
  }
215
219
  }
216
220
  const DOMEditor = {
@@ -1047,11 +1051,10 @@ export {
1047
1051
  IS_FOCUSED as M,
1048
1052
  NODE_TO_KEY as N,
1049
1053
  IS_READ_ONLY as O,
1050
- PLACEHOLDER_SYMBOL as P,
1051
- MARK_PLACEHOLDER_SYMBOL as Q,
1052
- NODE_TO_ELEMENT as R,
1053
- NODE_TO_INDEX as S,
1054
- NODE_TO_PARENT as T,
1054
+ MARK_PLACEHOLDER_SYMBOL as P,
1055
+ NODE_TO_ELEMENT as Q,
1056
+ NODE_TO_INDEX as R,
1057
+ NODE_TO_PARENT as S,
1055
1058
  EDITOR_TO_USER_MARKS as a,
1056
1059
  EDITOR_TO_USER_SELECTION as b,
1057
1060
  getSlateFragmentAttribute as c,
@@ -1,8 +1,8 @@
1
1
  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
- import { t as toRawWeakMap, T as Text, R as Range, N as Node, a as Element, d as isPlainObject } from "./batch-dirty-paths-CZqHWmdq.js";
5
- import { c as createEditor$1 } from "./create-editor-BP4gf1UN.js";
4
+ import { t as toRawWeakMap, T as Text, R as Range, N as Node, a as Element, d as isPlainObject } from "./batch-dirty-paths-Dg98evlh.js";
5
+ import { c as createEditor$1 } from "./create-editor-DEzIjX9i.js";
6
6
  import "vue";
7
7
  const ANCHOR = new toRawWeakMap();
8
8
  const FOCUS = new toRawWeakMap();
package/dist/index.js CHANGED
@@ -1,6 +1,7 @@
1
1
  import { defineComponent, provide, ref, computed, onMounted, onUnmounted, renderSlot, inject, h, watch, renderList, Fragment, useAttrs, reactive } from "vue";
2
- import { e as isObjectLike, f as baseGetTag, g as Symbol$1, h as isArray, j as defineProperty, M as MapCache, k as isArguments, l as arrayPush, m as getPrototype, n as copyObject, o as getAllKeysIn, p as baseClone, N as Node, S as Scrubber, P as Path, E as Editor, R as Range, T as Text, a as Element, c as Transforms } from "./batch-dirty-paths-CZqHWmdq.js";
3
- import { D as DOMEditor, d as EDITOR_TO_ON_CHANGE, Q as MARK_PLACEHOLDER_SYMBOL, I as IS_ANDROID, x as IS_IOS, E as EDITOR_TO_KEY_TO_ELEMENT, J as ELEMENT_TO_NODE, R as NODE_TO_ELEMENT, S as NODE_TO_INDEX, T as NODE_TO_PARENT, p as isDOMNode, y as IS_WEBKIT, e as applyStringDiff, q as isDOMSelection, n as normalizeStringDiff, O as IS_READ_ONLY, h as getDefaultView, G as EDITOR_TO_WINDOW, F as EDITOR_TO_ELEMENT, H as HAS_BEFORE_INPUT_SUPPORT, C as CAN_USE_DOM, f as getActiveElement, j as getSelection, M as IS_FOCUSED, b as EDITOR_TO_USER_SELECTION, L as IS_COMPOSING, o as isDOMElement, w as IS_FIREFOX_LEGACY, A as IS_WECHATBROWSER, z as IS_UC_MOBILE, a as EDITOR_TO_USER_MARKS, v as IS_FIREFOX, B as Hotkeys, u as IS_CHROME, r as isPlainTextOnlyPaste } from "./hotkeys-DpsWjIJe.js";
2
+ import { N as Node, S as Scrubber, P as Path, E as Editor, R as Range, T as Text, a as Element, c as Transforms } from "./batch-dirty-paths-Dg98evlh.js";
3
+ import { D as DOMEditor, d as EDITOR_TO_ON_CHANGE, P as MARK_PLACEHOLDER_SYMBOL, I as IS_ANDROID, x as IS_IOS, E as EDITOR_TO_KEY_TO_ELEMENT, J as ELEMENT_TO_NODE, Q as NODE_TO_ELEMENT, R as NODE_TO_INDEX, S as NODE_TO_PARENT, p as isDOMNode, y as IS_WEBKIT, e as applyStringDiff, q as isDOMSelection, n as normalizeStringDiff, O as IS_READ_ONLY, h as getDefaultView, G as EDITOR_TO_WINDOW, F as EDITOR_TO_ELEMENT, H as HAS_BEFORE_INPUT_SUPPORT, C as CAN_USE_DOM, f as getActiveElement, j as getSelection, M as IS_FOCUSED, b as EDITOR_TO_USER_SELECTION, L as IS_COMPOSING, o as isDOMElement, w as IS_FIREFOX_LEGACY, A as IS_WECHATBROWSER, z as IS_UC_MOBILE, a as EDITOR_TO_USER_MARKS, v as IS_FIREFOX, B as Hotkeys, u as IS_CHROME, r as isPlainTextOnlyPaste } from "./hotkeys-B4x3w0cT.js";
4
+ import { o as omit } from "./omit-DucjzKZK.js";
4
5
  const SLATE_USE_EDITOR = Symbol("SLATE_USE_EDITOR");
5
6
  const SLATE_USE_DECORATE = Symbol("SLATE_USE_DECORATE");
6
7
  const SLATE_USE_SELECTED = Symbol("SLATE_USE_SELECTED");
@@ -13,268 +14,6 @@ const SLATE_INNER_RENDER_LEAF = Symbol("SLATE_INNER_RENDER_LEAF");
13
14
  const SLATE_INNER_RENDER_PLACEHOLDER = Symbol("SLATE_INNER_RENDER_PLACEHOLDER");
14
15
  const SLATE_INNER_CHANGE_EFFECT_INJECT = Symbol("SLATE_INNER_CHANGE_EFFECT_INJECT");
15
16
  const SLATE_INNER_DESCORATION = Symbol("SLATE_INNER_DESCORATION");
16
- var symbolTag = "[object Symbol]";
17
- function isSymbol(value) {
18
- return typeof value == "symbol" || isObjectLike(value) && baseGetTag(value) == symbolTag;
19
- }
20
- function arrayMap(array, iteratee) {
21
- var index = -1, length = array == null ? 0 : array.length, result = Array(length);
22
- while (++index < length) {
23
- result[index] = iteratee(array[index], index, array);
24
- }
25
- return result;
26
- }
27
- var symbolProto = Symbol$1 ? Symbol$1.prototype : void 0, symbolToString = symbolProto ? symbolProto.toString : void 0;
28
- function baseToString(value) {
29
- if (typeof value == "string") {
30
- return value;
31
- }
32
- if (isArray(value)) {
33
- return arrayMap(value, baseToString) + "";
34
- }
35
- if (isSymbol(value)) {
36
- return symbolToString ? symbolToString.call(value) : "";
37
- }
38
- var result = value + "";
39
- return result == "0" && 1 / value == -Infinity ? "-0" : result;
40
- }
41
- function identity(value) {
42
- return value;
43
- }
44
- function apply(func, thisArg, args) {
45
- switch (args.length) {
46
- case 0:
47
- return func.call(thisArg);
48
- case 1:
49
- return func.call(thisArg, args[0]);
50
- case 2:
51
- return func.call(thisArg, args[0], args[1]);
52
- case 3:
53
- return func.call(thisArg, args[0], args[1], args[2]);
54
- }
55
- return func.apply(thisArg, args);
56
- }
57
- var HOT_COUNT = 800, HOT_SPAN = 16;
58
- var nativeNow = Date.now;
59
- function shortOut(func) {
60
- var count = 0, lastCalled = 0;
61
- return function() {
62
- var stamp = nativeNow(), remaining = HOT_SPAN - (stamp - lastCalled);
63
- lastCalled = stamp;
64
- if (remaining > 0) {
65
- if (++count >= HOT_COUNT) {
66
- return arguments[0];
67
- }
68
- } else {
69
- count = 0;
70
- }
71
- return func.apply(void 0, arguments);
72
- };
73
- }
74
- function constant(value) {
75
- return function() {
76
- return value;
77
- };
78
- }
79
- var baseSetToString = !defineProperty ? identity : function(func, string) {
80
- return defineProperty(func, "toString", {
81
- "configurable": true,
82
- "enumerable": false,
83
- "value": constant(string),
84
- "writable": true
85
- });
86
- };
87
- var setToString = shortOut(baseSetToString);
88
- var nativeMax = Math.max;
89
- function overRest(func, start, transform) {
90
- start = nativeMax(start === void 0 ? func.length - 1 : start, 0);
91
- return function() {
92
- var args = arguments, index = -1, length = nativeMax(args.length - start, 0), array = Array(length);
93
- while (++index < length) {
94
- array[index] = args[start + index];
95
- }
96
- index = -1;
97
- var otherArgs = Array(start + 1);
98
- while (++index < start) {
99
- otherArgs[index] = args[index];
100
- }
101
- otherArgs[start] = transform(array);
102
- return apply(func, this, otherArgs);
103
- };
104
- }
105
- var reIsDeepProp = /\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/, reIsPlainProp = /^\w*$/;
106
- function isKey(value, object) {
107
- if (isArray(value)) {
108
- return false;
109
- }
110
- var type = typeof value;
111
- if (type == "number" || type == "symbol" || type == "boolean" || value == null || isSymbol(value)) {
112
- return true;
113
- }
114
- return reIsPlainProp.test(value) || !reIsDeepProp.test(value) || object != null && value in Object(object);
115
- }
116
- var FUNC_ERROR_TEXT = "Expected a function";
117
- function memoize(func, resolver) {
118
- if (typeof func != "function" || resolver != null && typeof resolver != "function") {
119
- throw new TypeError(FUNC_ERROR_TEXT);
120
- }
121
- var memoized = function() {
122
- var args = arguments, key = resolver ? resolver.apply(this, args) : args[0], cache = memoized.cache;
123
- if (cache.has(key)) {
124
- return cache.get(key);
125
- }
126
- var result = func.apply(this, args);
127
- memoized.cache = cache.set(key, result) || cache;
128
- return result;
129
- };
130
- memoized.cache = new (memoize.Cache || MapCache)();
131
- return memoized;
132
- }
133
- memoize.Cache = MapCache;
134
- var MAX_MEMOIZE_SIZE = 500;
135
- function memoizeCapped(func) {
136
- var result = memoize(func, function(key) {
137
- if (cache.size === MAX_MEMOIZE_SIZE) {
138
- cache.clear();
139
- }
140
- return key;
141
- });
142
- var cache = result.cache;
143
- return result;
144
- }
145
- var rePropName = /[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g;
146
- var reEscapeChar = /\\(\\)?/g;
147
- var stringToPath = memoizeCapped(function(string) {
148
- var result = [];
149
- if (string.charCodeAt(0) === 46) {
150
- result.push("");
151
- }
152
- string.replace(rePropName, function(match, number, quote, subString) {
153
- result.push(quote ? subString.replace(reEscapeChar, "$1") : number || match);
154
- });
155
- return result;
156
- });
157
- function toString(value) {
158
- return value == null ? "" : baseToString(value);
159
- }
160
- function castPath(value, object) {
161
- if (isArray(value)) {
162
- return value;
163
- }
164
- return isKey(value, object) ? [value] : stringToPath(toString(value));
165
- }
166
- function toKey(value) {
167
- if (typeof value == "string" || isSymbol(value)) {
168
- return value;
169
- }
170
- var result = value + "";
171
- return result == "0" && 1 / value == -Infinity ? "-0" : result;
172
- }
173
- function baseGet(object, path) {
174
- path = castPath(path, object);
175
- var index = 0, length = path.length;
176
- while (object != null && index < length) {
177
- object = object[toKey(path[index++])];
178
- }
179
- return index && index == length ? object : void 0;
180
- }
181
- var spreadableSymbol = Symbol$1 ? Symbol$1.isConcatSpreadable : void 0;
182
- function isFlattenable(value) {
183
- return isArray(value) || isArguments(value) || !!(spreadableSymbol && value && value[spreadableSymbol]);
184
- }
185
- function baseFlatten(array, depth, predicate, isStrict, result) {
186
- var index = -1, length = array.length;
187
- predicate || (predicate = isFlattenable);
188
- result || (result = []);
189
- while (++index < length) {
190
- var value = array[index];
191
- if (predicate(value)) {
192
- {
193
- arrayPush(result, value);
194
- }
195
- } else {
196
- result[result.length] = value;
197
- }
198
- }
199
- return result;
200
- }
201
- function flatten(array) {
202
- var length = array == null ? 0 : array.length;
203
- return length ? baseFlatten(array) : [];
204
- }
205
- function flatRest(func) {
206
- return setToString(overRest(func, void 0, flatten), func + "");
207
- }
208
- var objectTag = "[object Object]";
209
- var funcProto = Function.prototype, objectProto = Object.prototype;
210
- var funcToString = funcProto.toString;
211
- var hasOwnProperty = objectProto.hasOwnProperty;
212
- var objectCtorString = funcToString.call(Object);
213
- function isPlainObject(value) {
214
- if (!isObjectLike(value) || baseGetTag(value) != objectTag) {
215
- return false;
216
- }
217
- var proto = getPrototype(value);
218
- if (proto === null) {
219
- return true;
220
- }
221
- var Ctor = hasOwnProperty.call(proto, "constructor") && proto.constructor;
222
- return typeof Ctor == "function" && Ctor instanceof Ctor && funcToString.call(Ctor) == objectCtorString;
223
- }
224
- function baseSlice(array, start, end) {
225
- var index = -1, length = array.length;
226
- if (start < 0) {
227
- start = -start > length ? 0 : length + start;
228
- }
229
- end = end > length ? length : end;
230
- if (end < 0) {
231
- end += length;
232
- }
233
- length = start > end ? 0 : end - start >>> 0;
234
- start >>>= 0;
235
- var result = Array(length);
236
- while (++index < length) {
237
- result[index] = array[index + start];
238
- }
239
- return result;
240
- }
241
- function last(array) {
242
- var length = array == null ? 0 : array.length;
243
- return length ? array[length - 1] : void 0;
244
- }
245
- function parent(object, path) {
246
- return path.length < 2 ? object : baseGet(object, baseSlice(path, 0, -1));
247
- }
248
- function baseUnset(object, path) {
249
- path = castPath(path, object);
250
- object = parent(object, path);
251
- return object == null || delete object[toKey(last(path))];
252
- }
253
- function customOmitClone(value) {
254
- return isPlainObject(value) ? void 0 : value;
255
- }
256
- var CLONE_DEEP_FLAG = 1, CLONE_FLAT_FLAG = 2, CLONE_SYMBOLS_FLAG = 4;
257
- var omit = flatRest(function(object, paths) {
258
- var result = {};
259
- if (object == null) {
260
- return result;
261
- }
262
- var isDeep = false;
263
- paths = arrayMap(paths, function(path) {
264
- path = castPath(path, object);
265
- isDeep || (isDeep = path.length > 1);
266
- return path;
267
- });
268
- copyObject(object, getAllKeysIn(object), result);
269
- if (isDeep) {
270
- result = baseClone(result, CLONE_DEEP_FLAG | CLONE_FLAT_FLAG | CLONE_SYMBOLS_FLAG, customOmitClone);
271
- }
272
- var length = paths.length;
273
- while (length--) {
274
- baseUnset(result, paths[length]);
275
- }
276
- return result;
277
- });
278
17
  const Slate = defineComponent({
279
18
  name: "slate-editor",
280
19
  emits: ["change", "selectionchange", "valuechange"],
@@ -328,14 +67,14 @@ const Slate = defineComponent({
328
67
  document.addEventListener("focusout", focusCb);
329
68
  EDITOR_TO_ON_CHANGE.set(editor, (options) => {
330
69
  var _a;
331
- emit("change", editor.children);
70
+ emit("change", options);
332
71
  changeEffect.value++;
333
72
  switch ((_a = options == null ? void 0 : options.operation) == null ? void 0 : _a.type) {
334
73
  case "set_selection":
335
- emit("selectionchange", editor.selection);
74
+ emit("selectionchange", options);
336
75
  break;
337
76
  default:
338
- emit("valuechange", editor.children);
77
+ emit("valuechange", options);
339
78
  }
340
79
  });
341
80
  });
@@ -1144,7 +883,6 @@ const Editable = defineComponent({
1144
883
  const editor = useEditor();
1145
884
  const attributes = useAttrs();
1146
885
  const isComposing = useComposing();
1147
- const deferredOperations = ref([]);
1148
886
  const isReadOnly = useReadOnly();
1149
887
  watch(
1150
888
  () => readOnly,
@@ -1235,9 +973,8 @@ const Editable = defineComponent({
1235
973
  if (!Text.equals(leaf, editor.marks, { loose: true })) {
1236
974
  return true;
1237
975
  }
1238
- } else {
1239
- return false;
1240
976
  }
977
+ return false;
1241
978
  });
1242
979
  const setDomSelection = () => {
1243
980
  var _a;
@@ -1348,6 +1085,7 @@ const Editable = defineComponent({
1348
1085
  window2.document.removeEventListener("dragend", stoppedDragging);
1349
1086
  window2.document.removeEventListener("drop", stoppedDragging);
1350
1087
  });
1088
+ const deferredOperations = ref([]);
1351
1089
  const onBeforeinput = (event) => {
1352
1090
  var _a, _b, _c, _d, _e;
1353
1091
  const isInputEvent = event instanceof InputEvent;