slate-react 0.100.0-2023920121024 → 0.100.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 (83) hide show
  1. package/dist/components/editable.d.ts +84 -83
  2. package/dist/components/editable.d.ts.map +1 -1
  3. package/dist/components/element.d.ts +28 -27
  4. package/dist/components/element.d.ts.map +1 -1
  5. package/dist/components/leaf.d.ts +14 -13
  6. package/dist/components/leaf.d.ts.map +1 -1
  7. package/dist/components/restore-dom/restore-dom-manager.d.ts +8 -8
  8. package/dist/components/restore-dom/restore-dom-manager.d.ts.map +1 -1
  9. package/dist/components/restore-dom/restore-dom.d.ts +8 -7
  10. package/dist/components/restore-dom/restore-dom.d.ts.map +1 -1
  11. package/dist/components/slate.d.ts +15 -15
  12. package/dist/components/slate.d.ts.map +1 -1
  13. package/dist/components/string.d.ts +20 -20
  14. package/dist/components/string.d.ts.map +1 -1
  15. package/dist/components/text.d.ts +12 -12
  16. package/dist/components/text.d.ts.map +1 -1
  17. package/dist/custom-types.d.ts +37 -15
  18. package/dist/custom-types.d.ts.map +1 -1
  19. package/dist/hooks/android-input-manager/android-input-manager.d.ts +29 -29
  20. package/dist/hooks/android-input-manager/android-input-manager.d.ts.map +1 -1
  21. package/dist/hooks/android-input-manager/use-android-input-manager.d.ts +7 -7
  22. package/dist/hooks/android-input-manager/use-android-input-manager.d.ts.map +1 -1
  23. package/dist/hooks/use-children.d.ts +15 -15
  24. package/dist/hooks/use-children.d.ts.map +1 -1
  25. package/dist/hooks/use-decorate.d.ts +10 -10
  26. package/dist/hooks/use-decorate.d.ts.map +1 -1
  27. package/dist/hooks/use-editor.d.ts +5 -5
  28. package/dist/hooks/use-editor.d.ts.map +1 -1
  29. package/dist/hooks/use-focused.d.ts +9 -9
  30. package/dist/hooks/use-focused.d.ts.map +1 -1
  31. package/dist/hooks/use-is-mounted.d.ts +1 -1
  32. package/dist/hooks/use-is-mounted.d.ts.map +1 -1
  33. package/dist/hooks/use-isomorphic-layout-effect.d.ts +5 -5
  34. package/dist/hooks/use-isomorphic-layout-effect.d.ts.map +1 -1
  35. package/dist/hooks/use-mutation-observer.d.ts +2 -2
  36. package/dist/hooks/use-mutation-observer.d.ts.map +1 -1
  37. package/dist/hooks/use-read-only.d.ts +9 -9
  38. package/dist/hooks/use-read-only.d.ts.map +1 -1
  39. package/dist/hooks/use-selected.d.ts +9 -9
  40. package/dist/hooks/use-selected.d.ts.map +1 -1
  41. package/dist/hooks/use-slate-selection.d.ts +6 -6
  42. package/dist/hooks/use-slate-selection.d.ts.map +1 -1
  43. package/dist/hooks/use-slate-selector.d.ts +31 -31
  44. package/dist/hooks/use-slate-selector.d.ts.map +1 -1
  45. package/dist/hooks/use-slate-static.d.ts +11 -11
  46. package/dist/hooks/use-slate-static.d.ts.map +1 -1
  47. package/dist/hooks/use-slate.d.ts +23 -23
  48. package/dist/hooks/use-slate.d.ts.map +1 -1
  49. package/dist/hooks/use-track-user-input.d.ts +5 -5
  50. package/dist/hooks/use-track-user-input.d.ts.map +1 -1
  51. package/dist/index.d.ts +14 -14
  52. package/dist/index.d.ts.map +1 -1
  53. package/dist/index.es.js +624 -1275
  54. package/dist/index.es.js.map +1 -1
  55. package/dist/index.js +943 -1734
  56. package/dist/index.js.map +1 -1
  57. package/dist/plugin/react-editor.d.ts +150 -150
  58. package/dist/plugin/react-editor.d.ts.map +1 -1
  59. package/dist/plugin/with-react.d.ts +11 -11
  60. package/dist/plugin/with-react.d.ts.map +1 -1
  61. package/dist/slate-react.js +20187 -17894
  62. package/dist/slate-react.min.js +1 -1
  63. package/dist/utils/constants.d.ts +1 -1
  64. package/dist/utils/constants.d.ts.map +1 -1
  65. package/dist/utils/diff-text.d.ts +44 -44
  66. package/dist/utils/diff-text.d.ts.map +1 -1
  67. package/dist/utils/dom.d.ts +83 -83
  68. package/dist/utils/dom.d.ts.map +1 -1
  69. package/dist/utils/environment.d.ts +15 -15
  70. package/dist/utils/environment.d.ts.map +1 -1
  71. package/dist/utils/hotkeys.d.ts +30 -30
  72. package/dist/utils/hotkeys.d.ts.map +1 -1
  73. package/dist/utils/key.d.ts +11 -11
  74. package/dist/utils/key.d.ts.map +1 -1
  75. package/dist/utils/lines.d.ts +14 -14
  76. package/dist/utils/lines.d.ts.map +1 -1
  77. package/dist/utils/range-list.d.ts +22 -18
  78. package/dist/utils/range-list.d.ts.map +1 -1
  79. package/dist/utils/types.d.ts +1 -1
  80. package/dist/utils/types.d.ts.map +1 -1
  81. package/dist/utils/weak-maps.d.ts +53 -77
  82. package/dist/utils/weak-maps.d.ts.map +1 -1
  83. package/package.json +24 -24
@@ -1,16 +1,16 @@
1
- /// <reference types="react" />
2
- import { Ancestor, Element, Range } from 'slate';
3
- import { RenderElementProps, RenderLeafProps, RenderPlaceholderProps } from '../components/editable';
4
- /**
5
- * Children.
6
- */
7
- declare const useChildren: (props: {
8
- decorations: Range[];
9
- node: Ancestor;
10
- renderElement?: ((props: RenderElementProps) => JSX.Element) | undefined;
11
- renderPlaceholder: (props: RenderPlaceholderProps) => JSX.Element;
12
- renderLeaf?: ((props: RenderLeafProps) => JSX.Element) | undefined;
13
- selection: Range | null;
14
- }) => JSX.Element[];
15
- export default useChildren;
1
+ import React from 'react';
2
+ import { Ancestor, Element, Range } from 'slate';
3
+ import { RenderElementProps, RenderLeafProps, RenderPlaceholderProps } from '../components/editable';
4
+ /**
5
+ * Children.
6
+ */
7
+ declare const useChildren: (props: {
8
+ decorations: Range[];
9
+ node: Ancestor;
10
+ renderElement?: ((props: RenderElementProps) => JSX.Element) | undefined;
11
+ renderPlaceholder: (props: RenderPlaceholderProps) => JSX.Element;
12
+ renderLeaf?: ((props: RenderLeafProps) => JSX.Element) | undefined;
13
+ selection: Range | null;
14
+ }) => React.JSX.Element[];
15
+ export default useChildren;
16
16
  //# sourceMappingURL=use-children.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"use-children.d.ts","sourceRoot":"","sources":["../packages/slate-react/src/hooks/use-children.tsx"],"names":[],"mappings":";AACA,OAAO,EAAE,QAAQ,EAAsB,OAAO,EAAE,KAAK,EAAE,MAAM,OAAO,CAAA;AACpE,OAAO,EACL,kBAAkB,EAClB,eAAe,EACf,sBAAsB,EACvB,MAAM,wBAAwB,CAAA;AAU/B;;GAEG;AAEH,QAAA,MAAM,WAAW;iBACF,KAAK,EAAE;UACd,QAAQ;6BACU,kBAAkB,KAAK,WAAW;+BAC/B,sBAAsB,KAAK,WAAW;0BAC5C,eAAe,KAAK,WAAW;eACzC,KAAK,GAAG,IAAI;mBAoExB,CAAA;AAED,eAAe,WAAW,CAAA"}
1
+ {"version":3,"file":"use-children.d.ts","sourceRoot":"","sources":["../../../../packages/slate-react/src/hooks/use-children.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAA;AACzB,OAAO,EAAE,QAAQ,EAAsB,OAAO,EAAE,KAAK,EAAE,MAAM,OAAO,CAAA;AACpE,OAAO,EACL,kBAAkB,EAClB,eAAe,EACf,sBAAsB,EACvB,MAAM,wBAAwB,CAAA;AAU/B;;GAEG;AAEH,QAAA,MAAM,WAAW;iBACF,KAAK,EAAE;UACd,QAAQ;6BACU,kBAAkB,KAAK,WAAW;+BAC/B,sBAAsB,KAAK,WAAW;0BAC5C,eAAe,KAAK,WAAW;eACzC,KAAK,GAAG,IAAI;yBAoExB,CAAA;AAED,eAAe,WAAW,CAAA"}
@@ -1,11 +1,11 @@
1
- /// <reference types="react" />
2
- import { Range, NodeEntry } from 'slate';
3
- /**
4
- * A React context for sharing the `decorate` prop of the editable.
5
- */
6
- export declare const DecorateContext: import("react").Context<(entry: NodeEntry<import("slate").Node>) => Range[]>;
7
- /**
8
- * Get the current `decorate` prop of the editable.
9
- */
10
- export declare const useDecorate: () => (entry: NodeEntry<import("slate").Node>) => Range[];
1
+ /// <reference types="react" />
2
+ import { Range, NodeEntry } from 'slate';
3
+ /**
4
+ * A React context for sharing the `decorate` prop of the editable.
5
+ */
6
+ export declare const DecorateContext: import("react").Context<(entry: NodeEntry) => Range[]>;
7
+ /**
8
+ * Get the current `decorate` prop of the editable.
9
+ */
10
+ export declare const useDecorate: () => (entry: NodeEntry) => Range[];
11
11
  //# sourceMappingURL=use-decorate.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"use-decorate.d.ts","sourceRoot":"","sources":["../packages/slate-react/src/hooks/use-decorate.ts"],"names":[],"mappings":";AACA,OAAO,EAAE,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAA;AAExC;;GAEG;AAEH,eAAO,MAAM,eAAe,sEAAuC,KAAK,EAAE,CAEzE,CAAA;AAED;;GAEG;AAEH,eAAO,MAAM,WAAW,oDAA8B,KAAK,EAE1D,CAAA"}
1
+ {"version":3,"file":"use-decorate.d.ts","sourceRoot":"","sources":["../../../../packages/slate-react/src/hooks/use-decorate.ts"],"names":[],"mappings":";AACA,OAAO,EAAE,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAA;AAExC;;GAEG;AAEH,eAAO,MAAM,eAAe,gDAAuC,KAAK,EAAE,CAEzE,CAAA;AAED;;GAEG;AAEH,eAAO,MAAM,WAAW,8BAA8B,KAAK,EAE1D,CAAA"}
@@ -1,6 +1,6 @@
1
- /**
2
- * Get the current editor object from the React context.
3
- * @deprecated Use useSlateStatic instead.
4
- */
5
- export declare const useEditor: () => import("..").ReactEditor;
1
+ /**
2
+ * Get the current editor object from the React context.
3
+ * @deprecated Use useSlateStatic instead.
4
+ */
5
+ export declare const useEditor: () => import("..").ReactEditor;
6
6
  //# sourceMappingURL=use-editor.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"use-editor.d.ts","sourceRoot":"","sources":["../packages/slate-react/src/hooks/use-editor.tsx"],"names":[],"mappings":"AAIA;;;GAGG;AAEH,eAAO,MAAM,SAAS,gCAUrB,CAAA"}
1
+ {"version":3,"file":"use-editor.d.ts","sourceRoot":"","sources":["../../../../packages/slate-react/src/hooks/use-editor.tsx"],"names":[],"mappings":"AAIA;;;GAGG;AAEH,eAAO,MAAM,SAAS,gCAUrB,CAAA"}
@@ -1,10 +1,10 @@
1
- /// <reference types="react" />
2
- /**
3
- * A React context for sharing the `focused` state of the editor.
4
- */
5
- export declare const FocusedContext: import("react").Context<boolean>;
6
- /**
7
- * Get the current `focused` state of the editor.
8
- */
9
- export declare const useFocused: () => boolean;
1
+ /// <reference types="react" />
2
+ /**
3
+ * A React context for sharing the `focused` state of the editor.
4
+ */
5
+ export declare const FocusedContext: import("react").Context<boolean>;
6
+ /**
7
+ * Get the current `focused` state of the editor.
8
+ */
9
+ export declare const useFocused: () => boolean;
10
10
  //# sourceMappingURL=use-focused.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"use-focused.d.ts","sourceRoot":"","sources":["../packages/slate-react/src/hooks/use-focused.ts"],"names":[],"mappings":";AAEA;;GAEG;AAEH,eAAO,MAAM,cAAc,kCAAuB,CAAA;AAElD;;GAEG;AAEH,eAAO,MAAM,UAAU,QAAO,OAE7B,CAAA"}
1
+ {"version":3,"file":"use-focused.d.ts","sourceRoot":"","sources":["../../../../packages/slate-react/src/hooks/use-focused.ts"],"names":[],"mappings":";AAEA;;GAEG;AAEH,eAAO,MAAM,cAAc,kCAAuB,CAAA;AAElD;;GAEG;AAEH,eAAO,MAAM,UAAU,QAAO,OAE7B,CAAA"}
@@ -1,2 +1,2 @@
1
- export declare function useIsMounted(): boolean;
1
+ export declare function useIsMounted(): boolean;
2
2
  //# sourceMappingURL=use-is-mounted.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"use-is-mounted.d.ts","sourceRoot":"","sources":["../packages/slate-react/src/hooks/use-is-mounted.tsx"],"names":[],"mappings":"AAEA,wBAAgB,YAAY,YAW3B"}
1
+ {"version":3,"file":"use-is-mounted.d.ts","sourceRoot":"","sources":["../../../../packages/slate-react/src/hooks/use-is-mounted.tsx"],"names":[],"mappings":"AAEA,wBAAgB,YAAY,YAW3B"}
@@ -1,6 +1,6 @@
1
- import { useLayoutEffect } from 'react';
2
- /**
3
- * Prevent warning on SSR by falling back to useEffect when DOM isn't available
4
- */
5
- export declare const useIsomorphicLayoutEffect: typeof useLayoutEffect;
1
+ import { useLayoutEffect } from 'react';
2
+ /**
3
+ * Prevent warning on SSR by falling back to useEffect when DOM isn't available
4
+ */
5
+ export declare const useIsomorphicLayoutEffect: typeof useLayoutEffect;
6
6
  //# sourceMappingURL=use-isomorphic-layout-effect.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"use-isomorphic-layout-effect.d.ts","sourceRoot":"","sources":["../packages/slate-react/src/hooks/use-isomorphic-layout-effect.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAa,MAAM,OAAO,CAAA;AAGlD;;GAEG;AAEH,eAAO,MAAM,yBAAyB,wBAEzB,CAAA"}
1
+ {"version":3,"file":"use-isomorphic-layout-effect.d.ts","sourceRoot":"","sources":["../../../../packages/slate-react/src/hooks/use-isomorphic-layout-effect.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAa,MAAM,OAAO,CAAA;AAGlD;;GAEG;AAEH,eAAO,MAAM,yBAAyB,wBAEzB,CAAA"}
@@ -1,3 +1,3 @@
1
- import { RefObject } from 'react';
2
- export declare function useMutationObserver(node: RefObject<HTMLElement>, callback: MutationCallback, options: MutationObserverInit): void;
1
+ import { RefObject } from 'react';
2
+ export declare function useMutationObserver(node: RefObject<HTMLElement>, callback: MutationCallback, options: MutationObserverInit): void;
3
3
  //# sourceMappingURL=use-mutation-observer.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"use-mutation-observer.d.ts","sourceRoot":"","sources":["../packages/slate-react/src/hooks/use-mutation-observer.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAuB,MAAM,OAAO,CAAA;AAGtD,wBAAgB,mBAAmB,CACjC,IAAI,EAAE,SAAS,CAAC,WAAW,CAAC,EAC5B,QAAQ,EAAE,gBAAgB,EAC1B,OAAO,EAAE,oBAAoB,QAkB9B"}
1
+ {"version":3,"file":"use-mutation-observer.d.ts","sourceRoot":"","sources":["../../../../packages/slate-react/src/hooks/use-mutation-observer.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAuB,MAAM,OAAO,CAAA;AAGtD,wBAAgB,mBAAmB,CACjC,IAAI,EAAE,SAAS,CAAC,WAAW,CAAC,EAC5B,QAAQ,EAAE,gBAAgB,EAC1B,OAAO,EAAE,oBAAoB,QAkB9B"}
@@ -1,10 +1,10 @@
1
- /// <reference types="react" />
2
- /**
3
- * A React context for sharing the `readOnly` state of the editor.
4
- */
5
- export declare const ReadOnlyContext: import("react").Context<boolean>;
6
- /**
7
- * Get the current `readOnly` state of the editor.
8
- */
9
- export declare const useReadOnly: () => boolean;
1
+ /// <reference types="react" />
2
+ /**
3
+ * A React context for sharing the `readOnly` state of the editor.
4
+ */
5
+ export declare const ReadOnlyContext: import("react").Context<boolean>;
6
+ /**
7
+ * Get the current `readOnly` state of the editor.
8
+ */
9
+ export declare const useReadOnly: () => boolean;
10
10
  //# sourceMappingURL=use-read-only.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"use-read-only.d.ts","sourceRoot":"","sources":["../packages/slate-react/src/hooks/use-read-only.ts"],"names":[],"mappings":";AAEA;;GAEG;AAEH,eAAO,MAAM,eAAe,kCAAuB,CAAA;AAEnD;;GAEG;AAEH,eAAO,MAAM,WAAW,QAAO,OAE9B,CAAA"}
1
+ {"version":3,"file":"use-read-only.d.ts","sourceRoot":"","sources":["../../../../packages/slate-react/src/hooks/use-read-only.ts"],"names":[],"mappings":";AAEA;;GAEG;AAEH,eAAO,MAAM,eAAe,kCAAuB,CAAA;AAEnD;;GAEG;AAEH,eAAO,MAAM,WAAW,QAAO,OAE9B,CAAA"}
@@ -1,10 +1,10 @@
1
- /// <reference types="react" />
2
- /**
3
- * A React context for sharing the `selected` state of an element.
4
- */
5
- export declare const SelectedContext: import("react").Context<boolean>;
6
- /**
7
- * Get the current `selected` state of an element.
8
- */
9
- export declare const useSelected: () => boolean;
1
+ /// <reference types="react" />
2
+ /**
3
+ * A React context for sharing the `selected` state of an element.
4
+ */
5
+ export declare const SelectedContext: import("react").Context<boolean>;
6
+ /**
7
+ * Get the current `selected` state of an element.
8
+ */
9
+ export declare const useSelected: () => boolean;
10
10
  //# sourceMappingURL=use-selected.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"use-selected.d.ts","sourceRoot":"","sources":["../packages/slate-react/src/hooks/use-selected.ts"],"names":[],"mappings":";AAEA;;GAEG;AAEH,eAAO,MAAM,eAAe,kCAAuB,CAAA;AAEnD;;GAEG;AAEH,eAAO,MAAM,WAAW,QAAO,OAE9B,CAAA"}
1
+ {"version":3,"file":"use-selected.d.ts","sourceRoot":"","sources":["../../../../packages/slate-react/src/hooks/use-selected.ts"],"names":[],"mappings":";AAEA;;GAEG;AAEH,eAAO,MAAM,eAAe,kCAAuB,CAAA;AAEnD;;GAEG;AAEH,eAAO,MAAM,WAAW,QAAO,OAE9B,CAAA"}
@@ -1,7 +1,7 @@
1
- import { BaseSelection } from 'slate';
2
- /**
3
- * Get the current slate selection.
4
- * Only triggers a rerender when the selection actually changes
5
- */
6
- export declare const useSlateSelection: () => BaseSelection;
1
+ import { BaseSelection } from 'slate';
2
+ /**
3
+ * Get the current slate selection.
4
+ * Only triggers a rerender when the selection actually changes
5
+ */
6
+ export declare const useSlateSelection: () => BaseSelection;
7
7
  //# sourceMappingURL=use-slate-selection.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"use-slate-selection.d.ts","sourceRoot":"","sources":["../packages/slate-react/src/hooks/use-slate-selection.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAS,MAAM,OAAO,CAAA;AAI5C;;;GAGG;AACH,eAAO,MAAM,iBAAiB,qBAE7B,CAAA"}
1
+ {"version":3,"file":"use-slate-selection.d.ts","sourceRoot":"","sources":["../../../../packages/slate-react/src/hooks/use-slate-selection.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAS,MAAM,OAAO,CAAA;AAI5C;;;GAGG;AACH,eAAO,MAAM,iBAAiB,qBAE7B,CAAA"}
@@ -1,32 +1,32 @@
1
- /// <reference types="react" />
2
- import { Editor } from 'slate';
3
- declare type EditorChangeHandler = (editor: Editor) => void;
4
- /**
5
- * A React context for sharing the editor selector context in a way to control rerenders
6
- */
7
- export declare const SlateSelectorContext: import("react").Context<{
8
- getSlate: () => Editor;
9
- addEventListener: (callback: EditorChangeHandler) => () => void;
10
- }>;
11
- /**
12
- * use redux style selectors to prevent rerendering on every keystroke.
13
- * Bear in mind rerendering can only prevented if the returned value is a value type or for reference types (e.g. objects and arrays) add a custom equality function.
14
- *
15
- * Example:
16
- * ```
17
- * const isSelectionActive = useSlateSelector(editor => Boolean(editor.selection));
18
- * ```
19
- */
20
- export declare function useSlateSelector<T>(selector: (editor: Editor) => T, equalityFn?: (a: T, b: T) => boolean): T;
21
- /**
22
- * Create selector context with editor updating on every editor change
23
- */
24
- export declare function useSelectorContext(editor: Editor): {
25
- selectorContext: {
26
- getSlate: () => import("..").ReactEditor;
27
- addEventListener: (callback: EditorChangeHandler) => () => void;
28
- };
29
- onChange: (editor: Editor) => void;
30
- };
31
- export {};
1
+ /// <reference types="react" />
2
+ import { Editor } from 'slate';
3
+ type EditorChangeHandler = (editor: Editor) => void;
4
+ /**
5
+ * A React context for sharing the editor selector context in a way to control rerenders
6
+ */
7
+ export declare const SlateSelectorContext: import("react").Context<{
8
+ getSlate: () => Editor;
9
+ addEventListener: (callback: EditorChangeHandler) => () => void;
10
+ }>;
11
+ /**
12
+ * use redux style selectors to prevent rerendering on every keystroke.
13
+ * Bear in mind rerendering can only prevented if the returned value is a value type or for reference types (e.g. objects and arrays) add a custom equality function.
14
+ *
15
+ * Example:
16
+ * ```
17
+ * const isSelectionActive = useSlateSelector(editor => Boolean(editor.selection));
18
+ * ```
19
+ */
20
+ export declare function useSlateSelector<T>(selector: (editor: Editor) => T, equalityFn?: (a: T, b: T) => boolean): T;
21
+ /**
22
+ * Create selector context with editor updating on every editor change
23
+ */
24
+ export declare function useSelectorContext(editor: Editor): {
25
+ selectorContext: {
26
+ getSlate: () => import("..").ReactEditor;
27
+ addEventListener: (callback: EditorChangeHandler) => () => void;
28
+ };
29
+ onChange: (editor: Editor) => void;
30
+ };
31
+ export {};
32
32
  //# sourceMappingURL=use-slate-selector.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"use-slate-selector.d.ts","sourceRoot":"","sources":["../packages/slate-react/src/hooks/use-slate-selector.tsx"],"names":[],"mappings":";AAQA,OAAO,EAAE,MAAM,EAAE,MAAM,OAAO,CAAA;AAO9B,aAAK,mBAAmB,GAAG,CAAC,MAAM,EAAE,MAAM,KAAK,IAAI,CAAA;AACnD;;GAEG;AAEH,eAAO,MAAM,oBAAoB;cACrB,MAAM,MAAM;iCACO,mBAAmB,KAAK,MAAM,IAAI;EACpD,CAAA;AAIb;;;;;;;;GAQG;AACH,wBAAgB,gBAAgB,CAAC,CAAC,EAChC,QAAQ,EAAE,CAAC,MAAM,EAAE,MAAM,KAAK,CAAC,EAC/B,UAAU,GAAE,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,KAAK,OAAqB,KAuElD;AAED;;GAEG;AACH,wBAAgB,kBAAkB,CAAC,MAAM,EAAE,MAAM;;;qCAoBd,mBAAmB;;uBAZzC,MAAM;EAqBlB"}
1
+ {"version":3,"file":"use-slate-selector.d.ts","sourceRoot":"","sources":["../../../../packages/slate-react/src/hooks/use-slate-selector.tsx"],"names":[],"mappings":";AAQA,OAAO,EAAE,MAAM,EAAE,MAAM,OAAO,CAAA;AAO9B,KAAK,mBAAmB,GAAG,CAAC,MAAM,EAAE,MAAM,KAAK,IAAI,CAAA;AACnD;;GAEG;AAEH,eAAO,MAAM,oBAAoB;cACrB,MAAM,MAAM;iCACO,mBAAmB,KAAK,MAAM,IAAI;EACpD,CAAA;AAIb;;;;;;;;GAQG;AACH,wBAAgB,gBAAgB,CAAC,CAAC,EAChC,QAAQ,EAAE,CAAC,MAAM,EAAE,MAAM,KAAK,CAAC,EAC/B,UAAU,GAAE,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,KAAK,OAAqB,KA2ElD;AAED;;GAEG;AACH,wBAAgB,kBAAkB,CAAC,MAAM,EAAE,MAAM;;;qCAoBd,mBAAmB;;uBAZzC,MAAM;EAqBlB"}
@@ -1,12 +1,12 @@
1
- /// <reference types="react" />
2
- import { Editor } from 'slate';
3
- import { ReactEditor } from '../plugin/react-editor';
4
- /**
5
- * A React context for sharing the editor object.
6
- */
7
- export declare const EditorContext: import("react").Context<ReactEditor | null>;
8
- /**
9
- * Get the current editor object from the React context.
10
- */
11
- export declare const useSlateStatic: () => Editor;
1
+ /// <reference types="react" />
2
+ import { Editor } from 'slate';
3
+ import { ReactEditor } from '../plugin/react-editor';
4
+ /**
5
+ * A React context for sharing the editor object.
6
+ */
7
+ export declare const EditorContext: import("react").Context<ReactEditor | null>;
8
+ /**
9
+ * Get the current editor object from the React context.
10
+ */
11
+ export declare const useSlateStatic: () => Editor;
12
12
  //# sourceMappingURL=use-slate-static.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"use-slate-static.d.ts","sourceRoot":"","sources":["../packages/slate-react/src/hooks/use-slate-static.tsx"],"names":[],"mappings":";AACA,OAAO,EAAE,MAAM,EAAE,MAAM,OAAO,CAAA;AAC9B,OAAO,EAAE,WAAW,EAAE,MAAM,wBAAwB,CAAA;AAEpD;;GAEG;AAEH,eAAO,MAAM,aAAa,6CAA0C,CAAA;AAEpE;;GAEG;AAEH,eAAO,MAAM,cAAc,QAAO,MAUjC,CAAA"}
1
+ {"version":3,"file":"use-slate-static.d.ts","sourceRoot":"","sources":["../../../../packages/slate-react/src/hooks/use-slate-static.tsx"],"names":[],"mappings":";AACA,OAAO,EAAE,MAAM,EAAE,MAAM,OAAO,CAAA;AAC9B,OAAO,EAAE,WAAW,EAAE,MAAM,wBAAwB,CAAA;AAEpD;;GAEG;AAEH,eAAO,MAAM,aAAa,6CAA0C,CAAA;AAEpE;;GAEG;AAEH,eAAO,MAAM,cAAc,QAAO,MAUjC,CAAA"}
@@ -1,24 +1,24 @@
1
- /// <reference types="react" />
2
- import { Editor } from 'slate';
3
- import { ReactEditor } from '../plugin/react-editor';
4
- /**
5
- * A React context for sharing the editor object, in a way that re-renders the
6
- * context whenever changes occur.
7
- */
8
- export interface SlateContextValue {
9
- v: number;
10
- editor: ReactEditor;
11
- }
12
- export declare const SlateContext: import("react").Context<{
13
- v: number;
14
- editor: ReactEditor;
15
- } | null>;
16
- /**
17
- * Get the current editor object from the React context.
18
- */
19
- export declare const useSlate: () => Editor;
20
- export declare const useSlateWithV: () => {
21
- v: number;
22
- editor: ReactEditor;
23
- };
1
+ /// <reference types="react" />
2
+ import { Editor } from 'slate';
3
+ import { ReactEditor } from '../plugin/react-editor';
4
+ /**
5
+ * A React context for sharing the editor object, in a way that re-renders the
6
+ * context whenever changes occur.
7
+ */
8
+ export interface SlateContextValue {
9
+ v: number;
10
+ editor: ReactEditor;
11
+ }
12
+ export declare const SlateContext: import("react").Context<{
13
+ v: number;
14
+ editor: ReactEditor;
15
+ } | null>;
16
+ /**
17
+ * Get the current editor object from the React context.
18
+ */
19
+ export declare const useSlate: () => Editor;
20
+ export declare const useSlateWithV: () => {
21
+ v: number;
22
+ editor: ReactEditor;
23
+ };
24
24
  //# sourceMappingURL=use-slate.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"use-slate.d.ts","sourceRoot":"","sources":["../packages/slate-react/src/hooks/use-slate.tsx"],"names":[],"mappings":";AACA,OAAO,EAAE,MAAM,EAAE,MAAM,OAAO,CAAA;AAC9B,OAAO,EAAE,WAAW,EAAE,MAAM,wBAAwB,CAAA;AAEpD;;;GAGG;AAEH,MAAM,WAAW,iBAAiB;IAChC,CAAC,EAAE,MAAM,CAAA;IACT,MAAM,EAAE,WAAW,CAAA;CACpB;AAED,eAAO,MAAM,YAAY;OACpB,MAAM;YACD,WAAW;SACN,CAAA;AAEf;;GAEG;AAEH,eAAO,MAAM,QAAQ,QAAO,MAW3B,CAAA;AAED,eAAO,MAAM,aAAa;OArBrB,MAAM;YACD,WAAW;CA8BpB,CAAA"}
1
+ {"version":3,"file":"use-slate.d.ts","sourceRoot":"","sources":["../../../../packages/slate-react/src/hooks/use-slate.tsx"],"names":[],"mappings":";AACA,OAAO,EAAE,MAAM,EAAE,MAAM,OAAO,CAAA;AAC9B,OAAO,EAAE,WAAW,EAAE,MAAM,wBAAwB,CAAA;AAEpD;;;GAGG;AAEH,MAAM,WAAW,iBAAiB;IAChC,CAAC,EAAE,MAAM,CAAA;IACT,MAAM,EAAE,WAAW,CAAA;CACpB;AAED,eAAO,MAAM,YAAY;OACpB,MAAM;YACD,WAAW;SACN,CAAA;AAEf;;GAEG;AAEH,eAAO,MAAM,QAAQ,QAAO,MAW3B,CAAA;AAED,eAAO,MAAM,aAAa;OArBrB,MAAM;YACD,WAAW;CA8BpB,CAAA"}
@@ -1,6 +1,6 @@
1
- /// <reference types="react" />
2
- export declare function useTrackUserInput(): {
3
- receivedUserInput: import("react").MutableRefObject<boolean>;
4
- onUserInput: () => void;
5
- };
1
+ /// <reference types="react" />
2
+ export declare function useTrackUserInput(): {
3
+ receivedUserInput: import("react").MutableRefObject<boolean>;
4
+ onUserInput: () => void;
5
+ };
6
6
  //# sourceMappingURL=use-track-user-input.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"use-track-user-input.d.ts","sourceRoot":"","sources":["../packages/slate-react/src/hooks/use-track-user-input.ts"],"names":[],"mappings":";AAIA,wBAAgB,iBAAiB;;;EA2BhC"}
1
+ {"version":3,"file":"use-track-user-input.d.ts","sourceRoot":"","sources":["../../../../packages/slate-react/src/hooks/use-track-user-input.ts"],"names":[],"mappings":";AAIA,wBAAgB,iBAAiB;;;EA2BhC"}
package/dist/index.d.ts CHANGED
@@ -1,15 +1,15 @@
1
- export { Editable, RenderElementProps, RenderLeafProps, RenderPlaceholderProps, DefaultPlaceholder, } from './components/editable';
2
- export { DefaultElement } from './components/element';
3
- export { DefaultLeaf } from './components/leaf';
4
- export { Slate } from './components/slate';
5
- export { useEditor } from './hooks/use-editor';
6
- export { useSlateStatic } from './hooks/use-slate-static';
7
- export { useFocused } from './hooks/use-focused';
8
- export { useReadOnly } from './hooks/use-read-only';
9
- export { useSelected } from './hooks/use-selected';
10
- export { useSlate, useSlateWithV } from './hooks/use-slate';
11
- export { useSlateSelector } from './hooks/use-slate-selector';
12
- export { useSlateSelection } from './hooks/use-slate-selection';
13
- export { ReactEditor } from './plugin/react-editor';
14
- export { withReact } from './plugin/with-react';
1
+ export { Editable, RenderElementProps, RenderLeafProps, RenderPlaceholderProps, DefaultPlaceholder, } from './components/editable';
2
+ export { DefaultElement } from './components/element';
3
+ export { DefaultLeaf } from './components/leaf';
4
+ export { Slate } from './components/slate';
5
+ export { useEditor } from './hooks/use-editor';
6
+ export { useSlateStatic } from './hooks/use-slate-static';
7
+ export { useFocused } from './hooks/use-focused';
8
+ export { useReadOnly } from './hooks/use-read-only';
9
+ export { useSelected } from './hooks/use-selected';
10
+ export { useSlate, useSlateWithV } from './hooks/use-slate';
11
+ export { useSlateSelector } from './hooks/use-slate-selector';
12
+ export { useSlateSelection } from './hooks/use-slate-selection';
13
+ export { ReactEditor } from './plugin/react-editor';
14
+ export { withReact } from './plugin/with-react';
15
15
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["packages/slate-react/src/index.ts"],"names":[],"mappings":"AACA,OAAO,EACL,QAAQ,EACR,kBAAkB,EAClB,eAAe,EACf,sBAAsB,EACtB,kBAAkB,GACnB,MAAM,uBAAuB,CAAA;AAE9B,OAAO,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAA;AACrD,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAA;AAC/C,OAAO,EAAE,KAAK,EAAE,MAAM,oBAAoB,CAAA;AAG1C,OAAO,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAA;AAC9C,OAAO,EAAE,cAAc,EAAE,MAAM,0BAA0B,CAAA;AACzD,OAAO,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAA;AAChD,OAAO,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAA;AACnD,OAAO,EAAE,WAAW,EAAE,MAAM,sBAAsB,CAAA;AAClD,OAAO,EAAE,QAAQ,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAA;AAC3D,OAAO,EAAE,gBAAgB,EAAE,MAAM,4BAA4B,CAAA;AAC7D,OAAO,EAAE,iBAAiB,EAAE,MAAM,6BAA6B,CAAA;AAG/D,OAAO,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAA;AACnD,OAAO,EAAE,SAAS,EAAE,MAAM,qBAAqB,CAAA"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA,OAAO,EACL,QAAQ,EACR,kBAAkB,EAClB,eAAe,EACf,sBAAsB,EACtB,kBAAkB,GACnB,MAAM,uBAAuB,CAAA;AAE9B,OAAO,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAA;AACrD,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAA;AAC/C,OAAO,EAAE,KAAK,EAAE,MAAM,oBAAoB,CAAA;AAG1C,OAAO,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAA;AAC9C,OAAO,EAAE,cAAc,EAAE,MAAM,0BAA0B,CAAA;AACzD,OAAO,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAA;AAChD,OAAO,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAA;AACnD,OAAO,EAAE,WAAW,EAAE,MAAM,sBAAsB,CAAA;AAClD,OAAO,EAAE,QAAQ,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAA;AAC3D,OAAO,EAAE,gBAAgB,EAAE,MAAM,4BAA4B,CAAA;AAC7D,OAAO,EAAE,iBAAiB,EAAE,MAAM,6BAA6B,CAAA;AAG/D,OAAO,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAA;AACnD,OAAO,EAAE,SAAS,EAAE,MAAM,qBAAqB,CAAA"}