slate-vue3 0.5.2 → 0.6.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.
package/dist/core.js CHANGED
@@ -1,4 +1,4 @@
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-BECAnoU4.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-FUfSF1v5.js";
2
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, d as d2 } from "./batch-dirty-paths-DGoKWQz8.js";
3
3
  import { L as L2, S as S3 } from "./location-H02Ot2Mm.js";
4
4
  export {
@@ -414,7 +414,7 @@ const getFragment = (editor) => {
414
414
  }
415
415
  return [];
416
416
  };
417
- const normalizeNode = (editor, entry) => {
417
+ const normalizeNode = (editor, entry, options) => {
418
418
  const [node2, path2] = entry;
419
419
  if (Text.isText(node2)) {
420
420
  return;
@@ -439,7 +439,14 @@ const normalizeNode = (editor, entry) => {
439
439
  const isInlineOrText = Text.isText(child) || Element.isElement(child) && editor.isInline(child);
440
440
  if (isInlineOrText !== shouldHaveInlines) {
441
441
  if (isInlineOrText) {
442
- Transforms.removeNodes(editor, { at: path2.concat(n), voids: true });
442
+ if (options == null ? void 0 : options.fallbackElement) {
443
+ Transforms.wrapNodes(editor, options.fallbackElement(), {
444
+ at: path2.concat(n),
445
+ voids: true
446
+ });
447
+ } else {
448
+ Transforms.removeNodes(editor, { at: path2.concat(n), voids: true });
449
+ }
443
450
  } else {
444
451
  Transforms.unwrapNodes(editor, { at: path2.concat(n), voids: true });
445
452
  }
@@ -507,25 +514,19 @@ const above = (editor, options = {}) => {
507
514
  if (!at) {
508
515
  return;
509
516
  }
510
- const path2 = Editor.path(editor, at);
517
+ let path2 = Editor.path(editor, at);
518
+ if (!Range.isRange(at) || Path.equals(at.focus.path, at.anchor.path)) {
519
+ if (path2.length === 0) return;
520
+ path2 = Path.parent(path2);
521
+ }
511
522
  const reverse = mode === "lowest";
512
- for (const [n, p] of Editor.levels(editor, {
523
+ const [firstMatch] = Editor.levels(editor, {
513
524
  at: path2,
514
525
  voids,
515
526
  match,
516
527
  reverse
517
- })) {
518
- if (Text.isText(n)) continue;
519
- if (Range.isRange(at)) {
520
- if (Path.isAncestor(p, at.anchor.path) && Path.isAncestor(p, at.focus.path)) {
521
- return [n, p];
522
- }
523
- } else {
524
- if (!Path.equals(path2, p)) {
525
- return [n, p];
526
- }
527
- }
528
- }
528
+ });
529
+ return firstMatch;
529
530
  };
530
531
  const addMark = (editor, key, value) => {
531
532
  const { selection } = editor;
@@ -1527,12 +1528,9 @@ const insertFragment = (editor, fragment2, options = {}) => {
1527
1528
  const isBlockStart = Editor.isStart(editor, at, blockPath);
1528
1529
  const isBlockEnd = Editor.isEnd(editor, at, blockPath);
1529
1530
  const isBlockEmpty = isBlockStart && isBlockEnd;
1530
- const mergeStart = !isBlockStart || isBlockStart && isBlockEnd;
1531
- const mergeEnd = !isBlockEnd;
1532
- const [, firstPath] = Node.first({ children: fragment2 }, []);
1533
- const [, lastPath] = Node.last({ children: fragment2 }, []);
1534
- const matches = [];
1535
- const matcher = ([n, p]) => {
1531
+ const [, firstLeafPath] = Node.first({ children: fragment2 }, []);
1532
+ const [, lastLeafPath] = Node.last({ children: fragment2 }, []);
1533
+ const shouldInsert = ([n, p]) => {
1536
1534
  const isRoot = p.length === 0;
1537
1535
  if (isRoot) {
1538
1536
  return false;
@@ -1540,33 +1538,35 @@ const insertFragment = (editor, fragment2, options = {}) => {
1540
1538
  if (isBlockEmpty) {
1541
1539
  return true;
1542
1540
  }
1543
- if (mergeStart && Path.isAncestor(p, firstPath) && Element.isElement(n) && !editor.isVoid(n) && !editor.isInline(n)) {
1541
+ if (!isBlockStart && Path.isAncestor(p, firstLeafPath) && Element.isElement(n) && !editor.isVoid(n) && !editor.isInline(n)) {
1544
1542
  return false;
1545
1543
  }
1546
- if (mergeEnd && Path.isAncestor(p, lastPath) && Element.isElement(n) && !editor.isVoid(n) && !editor.isInline(n)) {
1544
+ if (!isBlockEnd && Path.isAncestor(p, lastLeafPath) && Element.isElement(n) && !editor.isVoid(n) && !editor.isInline(n)) {
1547
1545
  return false;
1548
1546
  }
1549
1547
  return true;
1550
1548
  };
1551
- for (const entry of Node.nodes({ children: fragment2 }, { pass: matcher })) {
1552
- if (matcher(entry)) {
1553
- matches.push(entry);
1554
- }
1555
- }
1549
+ let starting = true;
1556
1550
  const starts = [];
1557
1551
  const middles = [];
1558
1552
  const ends = [];
1559
- let starting = true;
1560
- let hasBlocks2 = false;
1561
- for (const [node2] of matches) {
1562
- if (Element.isElement(node2) && !editor.isInline(node2)) {
1553
+ for (const entry of Node.nodes(
1554
+ { children: fragment2 },
1555
+ { pass: shouldInsert }
1556
+ )) {
1557
+ const [node2, path2] = entry;
1558
+ if (starting && Element.isElement(node2) && !editor.isInline(node2) && !Path.isAncestor(path2, firstLeafPath)) {
1563
1559
  starting = false;
1564
- hasBlocks2 = true;
1565
- middles.push(node2);
1566
- } else if (starting) {
1567
- starts.push(node2);
1568
- } else {
1569
- ends.push(node2);
1560
+ }
1561
+ if (shouldInsert(entry)) {
1562
+ if (Element.isElement(node2) && !editor.isInline(node2)) {
1563
+ starting = false;
1564
+ middles.push(node2);
1565
+ } else if (starting) {
1566
+ starts.push(node2);
1567
+ } else {
1568
+ ends.push(node2);
1569
+ }
1570
1570
  }
1571
1571
  }
1572
1572
  const [inlineMatch] = Editor.nodes(editor, {
@@ -1586,11 +1586,12 @@ const insertFragment = (editor, fragment2, options = {}) => {
1586
1586
  editor,
1587
1587
  isInlineEnd ? Path.next(inlinePath) : inlinePath
1588
1588
  );
1589
+ const splitBlock = ends.length > 0;
1589
1590
  Transforms.splitNodes(editor, {
1590
1591
  at,
1591
- match: (n) => hasBlocks2 ? Element.isElement(n) && Editor.isBlock(editor, n) : Text.isText(n) || Editor.isInline(editor, n),
1592
- mode: hasBlocks2 ? "lowest" : "highest",
1593
- always: hasBlocks2 && (!isBlockStart || starts.length > 0) && (!isBlockEnd || ends.length > 0),
1592
+ match: (n) => splitBlock ? Element.isElement(n) && Editor.isBlock(editor, n) : Text.isText(n) || Editor.isInline(editor, n),
1593
+ mode: splitBlock ? "lowest" : "highest",
1594
+ always: splitBlock && (!isBlockStart || starts.length > 0) && (!isBlockEnd || ends.length > 0),
1594
1595
  voids
1595
1596
  });
1596
1597
  const startRef = Editor.pathRef(
@@ -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
  import { t as toRawWeakMap, R as Range, N as Node, T as Text, a as Element, d as isObject } from "./batch-dirty-paths-DGoKWQz8.js";
5
- import { c as createEditor$1 } from "./create-editor-BECAnoU4.js";
5
+ import { c as createEditor$1 } from "./create-editor-FUfSF1v5.js";
6
6
  import "vue";
7
7
  const ANCHOR = new toRawWeakMap();
8
8
  const FOCUS = new toRawWeakMap();
package/dist/index.js CHANGED
@@ -1,5 +1,5 @@
1
- import { S as SLATE_USE_SELECTED, a as SLATE_STATE_SELECTION } from "./use-focused-BWpvB-A8.js";
2
- import { g, D, c, e, f, d, E, b, u, j, h, i } from "./use-focused-BWpvB-A8.js";
1
+ import { S as SLATE_USE_SELECTED, a as SLATE_USE_SELECTION } from "./use-focused-C00bi8rh.js";
2
+ import { g, D, c, e, f, d, E, b, u, j, h, i } from "./use-focused-C00bi8rh.js";
3
3
  import { inject } from "vue";
4
4
  import { t } from "./batch-dirty-paths-DGoKWQz8.js";
5
5
  const useSelected = () => {
@@ -12,7 +12,7 @@ const useSelected = () => {
12
12
  return selected;
13
13
  };
14
14
  const useSelection = () => {
15
- const selection = inject(SLATE_STATE_SELECTION);
15
+ const selection = inject(SLATE_USE_SELECTION);
16
16
  if (selection === void 0) {
17
17
  throw new Error(
18
18
  `The \`useSelection\` hook must be used inside the <Slate> component's context.`
@@ -20,6 +20,7 @@ export interface BaseEditor {
20
20
  markableVoid: (element: Element) => boolean;
21
21
  normalizeNode: (entry: NodeEntry, options?: {
22
22
  operation?: Operation;
23
+ fallbackElement?: () => Element;
23
24
  }) => void;
24
25
  onChange: (options?: {
25
26
  operation?: Operation;
@@ -85,7 +85,7 @@ export interface NodeInterface {
85
85
  */
86
86
  extractProps: (node: Node) => NodeProps;
87
87
  /**
88
- * Get the first node entry in a root node from a path.
88
+ * Get the first leaf node entry in a root node from a path.
89
89
  */
90
90
  first: (root: Node, path: Path) => NodeEntry;
91
91
  /**
@@ -114,7 +114,7 @@ export interface NodeInterface {
114
114
  */
115
115
  isNodeList: (value: any, options?: NodeIsNodeOptions) => value is Node[];
116
116
  /**
117
- * Get the last node entry in a root node from a path.
117
+ * Get the last leaf node entry in a root node from a path.
118
118
  */
119
119
  last: (root: Node, path: Path) => NodeEntry;
120
120
  /**
@@ -1,15 +1,14 @@
1
1
  export declare const SLATE_USE_EDITOR: unique symbol;
2
- export declare const SLATE_USE_DECORATE: unique symbol;
3
2
  export declare const SLATE_USE_SELECTED: unique symbol;
3
+ export declare const SLATE_USE_FOCUSED: unique symbol;
4
+ export declare const SLATE_USE_COMPOSING: unique symbol;
5
+ export declare const SLATE_USE_READ_ONLY: unique symbol;
4
6
  export declare const SLATE_USE_SELECTION: unique symbol;
5
- export declare const SLATE_STATE_FOCUS: unique symbol;
6
- export declare const SLATE_STATE_COMPOSING: unique symbol;
7
- export declare const SLATE_STATE_READ_ONLY: unique symbol;
8
- export declare const SLATE_STATE_SELECTION: unique symbol;
9
7
  export declare const SLATE_INNER_RENDER_ELEMENT: unique symbol;
10
8
  export declare const SLATE_INNER_RENDER_LEAF: unique symbol;
11
9
  export declare const SLATE_INNER_RENDER_PLACEHOLDER: unique symbol;
12
10
  export declare const SLATE_INNER_RENDER_TEXT: unique symbol;
11
+ export declare const SLATE_INNER_RENDER_DECORATE: unique symbol;
13
12
  export declare const SLATE_INNER_CHANGE_EFFECT_INJECT: unique symbol;
14
13
  export declare const SLATE_INNER_MARK_PLACEHOLDER: unique symbol;
15
14
  export declare const SLATE_INNER_PLACEHOLDER: unique symbol;
@@ -1,17 +1,17 @@
1
- import { h, defineComponent, provide, ref, computed, onMounted, onUnmounted, renderSlot, inject, watch, nextTick, renderList, Fragment, onUpdated, useAttrs, reactive, toRaw } from "vue";
1
+ import { h, defineComponent, provide, ref, computed, onMounted, onUnmounted, renderSlot, inject, watch, renderList, Fragment, onUpdated, useAttrs, reactive, toRaw } from "vue";
2
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-DGoKWQz8.js";
3
- import { I as IS_ANDROID, p as isDOMNode, D as DOMEditor, P as MARK_PLACEHOLDER_SYMBOL, d as EDITOR_TO_ON_CHANGE, x as IS_IOS, F as EDITOR_TO_ELEMENT, y as IS_WEBKIT, 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, v as IS_FIREFOX, e as applyStringDiff, q as isDOMSelection, n as normalizeStringDiff, O as IS_READ_ONLY, h as getDefaultView, G as EDITOR_TO_WINDOW, H as HAS_BEFORE_INPUT_SUPPORT, C as CAN_USE_DOM, f as getActiveElement, j as getSelection, M as IS_FOCUSED, r as isPlainTextOnlyPaste, L as IS_COMPOSING, B as Hotkeys, u as IS_CHROME, w as IS_FIREFOX_LEGACY, A as IS_WECHATBROWSER, z as IS_UC_MOBILE, a as EDITOR_TO_USER_MARKS, o as isDOMElement, b as EDITOR_TO_USER_SELECTION } from "./hotkeys-DdYAaAmE.js";
3
+ import { I as IS_ANDROID, p as isDOMNode, D as DOMEditor, P as MARK_PLACEHOLDER_SYMBOL, d as EDITOR_TO_ON_CHANGE, v as IS_FIREFOX, y as IS_WEBKIT, 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, 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, r as isPlainTextOnlyPaste, L as IS_COMPOSING, B as Hotkeys, u as IS_CHROME, w as IS_FIREFOX_LEGACY, x as IS_IOS, A as IS_WECHATBROWSER, z as IS_UC_MOBILE, a as EDITOR_TO_USER_MARKS, o as isDOMElement, b as EDITOR_TO_USER_SELECTION } from "./hotkeys-DdYAaAmE.js";
4
4
  const SLATE_USE_EDITOR = Symbol("SLATE_USE_EDITOR");
5
- const SLATE_USE_DECORATE = Symbol("SLATE_USE_DECORATE");
6
5
  const SLATE_USE_SELECTED = Symbol("SLATE_USE_SELECTED");
7
- const SLATE_STATE_FOCUS = Symbol("SLATE_STATE_FOCUS");
8
- const SLATE_STATE_COMPOSING = Symbol("SLATE_STATE_COMPOSING");
9
- const SLATE_STATE_READ_ONLY = Symbol("SLATE_STATE_READ_ONLY");
10
- const SLATE_STATE_SELECTION = Symbol("SLATE_STATE_SELECTION");
6
+ const SLATE_USE_FOCUSED = Symbol("SLATE_USE_FOCUSED");
7
+ const SLATE_USE_COMPOSING = Symbol("SLATE_USE_COMPOSING");
8
+ const SLATE_USE_READ_ONLY = Symbol("SLATE_USE_READ_ONLY");
9
+ const SLATE_USE_SELECTION = Symbol("SLATE_USE_SELECTION");
11
10
  const SLATE_INNER_RENDER_ELEMENT = Symbol("SLATE_INNER_RENDER_ELEMENT");
12
11
  const SLATE_INNER_RENDER_LEAF = Symbol("SLATE_INNER_RENDER_LEAF");
13
12
  const SLATE_INNER_RENDER_PLACEHOLDER = Symbol("SLATE_INNER_RENDER_PLACEHOLDER");
14
13
  const SLATE_INNER_RENDER_TEXT = Symbol("SLATE_INNER_RENDER_TEXT");
14
+ const SLATE_INNER_RENDER_DECORATE = Symbol("SLATE_INNER_RENDER_DECORATE");
15
15
  const SLATE_INNER_CHANGE_EFFECT_INJECT = Symbol("SLATE_INNER_CHANGE_EFFECT_INJECT");
16
16
  const SLATE_INNER_MARK_PLACEHOLDER = Symbol("SLATE_INNER_MARK_PLACEHOLDER");
17
17
  const SLATE_INNER_PLACEHOLDER = Symbol("SLATE_INNER_PLACEHOLDER");
@@ -204,17 +204,17 @@ const Slate = defineComponent({
204
204
  );
205
205
  }
206
206
  provide(SLATE_USE_EDITOR, editor);
207
- provide(SLATE_USE_DECORATE, decorate);
207
+ provide(SLATE_INNER_RENDER_DECORATE, decorate);
208
208
  provide(SLATE_INNER_RENDER_ELEMENT, renderElement);
209
209
  provide(SLATE_INNER_RENDER_LEAF, renderLeaf);
210
210
  provide(SLATE_INNER_RENDER_TEXT, renderText);
211
211
  provide(SLATE_INNER_RENDER_PLACEHOLDER, renderPlaceholder);
212
212
  const isFocus = ref(DOMEditor.isFocused(editor));
213
213
  const selection = computed(() => editor.selection);
214
- provide(SLATE_STATE_FOCUS, isFocus);
215
- provide(SLATE_STATE_COMPOSING, ref(false));
216
- provide(SLATE_STATE_READ_ONLY, ref(false));
217
- provide(SLATE_STATE_SELECTION, selection);
214
+ provide(SLATE_USE_FOCUSED, isFocus);
215
+ provide(SLATE_USE_COMPOSING, ref(false));
216
+ provide(SLATE_USE_READ_ONLY, ref(false));
217
+ provide(SLATE_USE_SELECTION, selection);
218
218
  const focusCb = () => isFocus.value = DOMEditor.isFocused(editor);
219
219
  const changeEffect = ref(0);
220
220
  provide(SLATE_INNER_CHANGE_EFFECT_INJECT, changeEffect);
@@ -272,7 +272,7 @@ function direction(value) {
272
272
  return rtl.test(source) ? "rtl" : ltr.test(source) ? "ltr" : "neutral";
273
273
  }
274
274
  const useDecorate = () => {
275
- const decorate = inject(SLATE_USE_DECORATE);
275
+ const decorate = inject(SLATE_INNER_RENDER_DECORATE);
276
276
  if (decorate === void 0) {
277
277
  throw new Error(
278
278
  `The \`useDecorate\` hook must be used inside the <Slate> component's context.`
@@ -316,11 +316,10 @@ const StringComp = defineComponent({
316
316
  }
317
317
  return null;
318
318
  });
319
- return () => zeroStringAttrs.value ? h(
320
- "span",
321
- zeroStringAttrs.value,
322
- (IS_ANDROID || IS_IOS) && isLineBreak.value ? h("br") : "\uFEFF"
323
- ) : h("span", { "data-slate-string": true }, getTextContent.value);
319
+ return () => zeroStringAttrs.value ? h("span", zeroStringAttrs.value, [
320
+ !IS_ANDROID || !isLineBreak ? "\uFEFF" : null,
321
+ isLineBreak && !IS_FIREFOX ? h("br") : null
322
+ ]) : h("span", { "data-slate-string": true }, getTextContent.value);
324
323
  }
325
324
  });
326
325
  const useRenderElement = () => {
@@ -383,7 +382,7 @@ const useMarkPlaceholder = () => {
383
382
  const MARK_PLACEHOLDER_INJECT = inject(SLATE_INNER_MARK_PLACEHOLDER);
384
383
  if (MARK_PLACEHOLDER_INJECT === void 0) {
385
384
  throw new Error(
386
- `The \`useChangeEffect\` hook must be used inside the <Slate> component's context.`
385
+ `The \`useMarkPlaceholder\` hook must be used inside the <Slate> component's context.`
387
386
  );
388
387
  }
389
388
  return MARK_PLACEHOLDER_INJECT;
@@ -461,19 +460,6 @@ const PlaceholderComp = defineComponent({
461
460
  }
462
461
  }));
463
462
  const renderPlaceholder = useRenderPlaceholder();
464
- const editor = useEditor();
465
- onMounted(() => {
466
- nextTick(() => {
467
- const element = EDITOR_TO_ELEMENT.get(editor).querySelector(
468
- "[data-slate-placeholder]"
469
- );
470
- for (const node of element.childNodes) {
471
- if (node.nodeType === 3 && node.textContent === "") {
472
- element.removeChild(node);
473
- }
474
- }
475
- });
476
- });
477
463
  return () => renderPlaceholder({
478
464
  children: placeholder.value,
479
465
  attributes: attributes.value
@@ -541,14 +527,14 @@ const TextComp = defineComponent({
541
527
  leafPosition: leaf.position,
542
528
  attributes: { "data-slate-leaf": true },
543
529
  children: [
544
- showPlaceholder.value && h(PlaceholderComp),
545
530
  h(StringComp, {
546
531
  text,
547
532
  element,
548
533
  leaf: leaf.leaf,
549
534
  isLast: isLastText.value && i === leaves.value.length - 1,
550
535
  key: `${text.text}-${leaf.leaf.text}-${i}`
551
- })
536
+ }),
537
+ showPlaceholder.value && h(PlaceholderComp)
552
538
  ]
553
539
  })
554
540
  )
@@ -556,7 +542,7 @@ const TextComp = defineComponent({
556
542
  }
557
543
  });
558
544
  const useReadOnly = () => {
559
- const isReadOnly = inject(SLATE_STATE_READ_ONLY);
545
+ const isReadOnly = inject(SLATE_USE_READ_ONLY);
560
546
  if (isReadOnly === void 0) {
561
547
  throw new Error(
562
548
  `The \`useFocused\` hook must be used inside the <Slate> component's context.`
@@ -637,11 +623,8 @@ const ElementComp = defineComponent({
637
623
  const tag = isInline.value ? "span" : "div";
638
624
  return h(tag, VOID_CHILDREN_ATTRS, h(TextComp, { element, text }));
639
625
  });
640
- onUpdated(() => {
626
+ IS_FIREFOX && onUpdated(() => {
641
627
  var _a;
642
- if (!IS_FIREFOX) {
643
- return;
644
- }
645
628
  const nodes = (_a = elementRef.value) == null ? void 0 : _a.childNodes;
646
629
  if (!(nodes == null ? void 0 : nodes.length)) {
647
630
  return;
@@ -667,7 +650,7 @@ const ChildrenFC = (element, editor) => renderList(element.children, (child, i)
667
650
  return Element.isElement(child) ? h(ElementComp, { element: child, key: key.id }) : h(TextComp, { text: child, element, key: key.id });
668
651
  });
669
652
  const useComposing = () => {
670
- const isComposing = inject(SLATE_STATE_COMPOSING);
653
+ const isComposing = inject(SLATE_USE_COMPOSING);
671
654
  if (isComposing === void 0) {
672
655
  throw new Error(
673
656
  `The \`useFocused\` hook must be used inside the <Slate> component's context.`
@@ -1849,7 +1832,7 @@ const Editable = defineComponent({
1849
1832
  }
1850
1833
  });
1851
1834
  const useFocused = () => {
1852
- const isFocus = inject(SLATE_STATE_FOCUS);
1835
+ const isFocus = inject(SLATE_USE_FOCUSED);
1853
1836
  if (isFocus === void 0) {
1854
1837
  throw new Error(
1855
1838
  `The \`useFocused\` hook must be used inside the <Slate> component's context.`
@@ -1861,7 +1844,7 @@ export {
1861
1844
  DEFAULT_ELEMENT_RENDER as D,
1862
1845
  Editable as E,
1863
1846
  SLATE_USE_SELECTED as S,
1864
- SLATE_STATE_SELECTION as a,
1847
+ SLATE_USE_SELECTION as a,
1865
1848
  Slate as b,
1866
1849
  DEFAULT_LEAF_RENDER as c,
1867
1850
  DEFAULT_TEXT_RENDER as d,
package/dist/yjs.js CHANGED
@@ -2,7 +2,7 @@ import { d as isObject, T as Text, N as Node, P as Path, E as Editor, t as toRaw
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
4
  import { L as Location } from "./location-H02Ot2Mm.js";
5
- import { j as useEditor, h as useFocused } from "./use-focused-BWpvB-A8.js";
5
+ import { j as useEditor, h as useFocused } from "./use-focused-C00bi8rh.js";
6
6
  import { D as DOMEditor } from "./hotkeys-DdYAaAmE.js";
7
7
  function deepEquals(node, another) {
8
8
  for (const key in node) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "slate-vue3",
3
- "version": "0.5.2",
3
+ "version": "0.6.0",
4
4
  "type": "module",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.js",