slate-react 0.115.0 → 0.116.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 (50) hide show
  1. package/dist/chunking/children-helper.d.ts +61 -0
  2. package/dist/chunking/children-helper.d.ts.map +1 -0
  3. package/dist/chunking/chunk-tree-helper.d.ts +160 -0
  4. package/dist/chunking/chunk-tree-helper.d.ts.map +1 -0
  5. package/dist/chunking/get-chunk-tree-for-node.d.ts +16 -0
  6. package/dist/chunking/get-chunk-tree-for-node.d.ts.map +1 -0
  7. package/dist/chunking/index.d.ts +3 -0
  8. package/dist/chunking/index.d.ts.map +1 -0
  9. package/dist/chunking/reconcile-children.d.ts +19 -0
  10. package/dist/chunking/reconcile-children.d.ts.map +1 -0
  11. package/dist/chunking/types.d.ts +44 -0
  12. package/dist/chunking/types.d.ts.map +1 -0
  13. package/dist/components/chunk-tree.d.ts +13 -0
  14. package/dist/components/chunk-tree.d.ts.map +1 -0
  15. package/dist/components/editable.d.ts +13 -0
  16. package/dist/components/editable.d.ts.map +1 -1
  17. package/dist/components/element.d.ts +4 -4
  18. package/dist/components/element.d.ts.map +1 -1
  19. package/dist/components/leaf.d.ts.map +1 -1
  20. package/dist/components/slate.d.ts.map +1 -1
  21. package/dist/components/text.d.ts +1 -1
  22. package/dist/components/text.d.ts.map +1 -1
  23. package/dist/hooks/use-children.d.ts +4 -4
  24. package/dist/hooks/use-children.d.ts.map +1 -1
  25. package/dist/hooks/use-decorations.d.ts +18 -0
  26. package/dist/hooks/use-decorations.d.ts.map +1 -0
  27. package/dist/hooks/use-element.d.ts +12 -0
  28. package/dist/hooks/use-element.d.ts.map +1 -0
  29. package/dist/hooks/use-generic-selector.d.ts +20 -0
  30. package/dist/hooks/use-generic-selector.d.ts.map +1 -0
  31. package/dist/hooks/use-selected.d.ts +0 -5
  32. package/dist/hooks/use-selected.d.ts.map +1 -1
  33. package/dist/hooks/use-slate-selector.d.ts +30 -15
  34. package/dist/hooks/use-slate-selector.d.ts.map +1 -1
  35. package/dist/hooks/use-slate.d.ts +7 -14
  36. package/dist/hooks/use-slate.d.ts.map +1 -1
  37. package/dist/index.d.ts +2 -1
  38. package/dist/index.d.ts.map +1 -1
  39. package/dist/index.es.js +1154 -232
  40. package/dist/index.es.js.map +1 -1
  41. package/dist/index.js +1328 -343
  42. package/dist/index.js.map +1 -1
  43. package/dist/plugin/react-editor.d.ts +7 -0
  44. package/dist/plugin/react-editor.d.ts.map +1 -1
  45. package/dist/plugin/with-react.d.ts.map +1 -1
  46. package/dist/slate-react.js +1385 -346
  47. package/dist/slate-react.min.js +1 -1
  48. package/package.json +5 -4
  49. package/dist/hooks/use-decorate.d.ts +0 -11
  50. package/dist/hooks/use-decorate.d.ts.map +0 -1
@@ -0,0 +1,61 @@
1
+ import { Editor, Descendant } from 'slate';
2
+ import { Key } from 'slate-dom';
3
+ import { ChunkLeaf } from './types';
4
+ /**
5
+ * Traverse an array of children, providing helpers useful for reconciling the
6
+ * children array with a chunk tree
7
+ */
8
+ export declare class ChildrenHelper {
9
+ private editor;
10
+ private children;
11
+ /**
12
+ * Sparse array of Slate node keys, each index corresponding to an index in
13
+ * the children array
14
+ *
15
+ * Fetching the key for a Slate node is expensive, so we cache them here.
16
+ */
17
+ private cachedKeys;
18
+ /**
19
+ * The index of the next node to be read in the children array
20
+ */
21
+ pointerIndex: number;
22
+ constructor(editor: Editor, children: Descendant[]);
23
+ /**
24
+ * Read a given number of nodes, advancing the pointer by that amount
25
+ */
26
+ read(n: number): Descendant[];
27
+ /**
28
+ * Get the remaining children without advancing the pointer
29
+ *
30
+ * @param [maxChildren] Limit the number of children returned.
31
+ */
32
+ remaining(maxChildren?: number): Descendant[];
33
+ /**
34
+ * Whether all children have been read
35
+ */
36
+ get reachedEnd(): boolean;
37
+ /**
38
+ * Determine whether a node with a given key appears in the unread part of the
39
+ * children array, and return its index relative to the current pointer if so
40
+ *
41
+ * Searching for the node object itself using indexOf is most efficient, but
42
+ * will fail to locate nodes that have been modified. In this case, nodes
43
+ * should be identified by their keys instead.
44
+ *
45
+ * Searching an array of keys using indexOf is very inefficient since fetching
46
+ * the keys for all children in advance is very slow. Insead, if the node
47
+ * search fails to return a value, fetch the keys of each remaining child one
48
+ * by one and compare it to the known key.
49
+ */
50
+ lookAhead(node: Descendant, key: Key): number;
51
+ /**
52
+ * Convert an array of Slate nodes to an array of chunk leaves, each
53
+ * containing the node and its key
54
+ */
55
+ toChunkLeaves(nodes: Descendant[], startIndex: number): ChunkLeaf[];
56
+ /**
57
+ * Get the key for a Slate node, cached using the node's index
58
+ */
59
+ private findKey;
60
+ }
61
+ //# sourceMappingURL=children-helper.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"children-helper.d.ts","sourceRoot":"","sources":["../../../../packages/slate-react/src/chunking/children-helper.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,OAAO,CAAA;AAC1C,OAAO,EAAE,GAAG,EAAE,MAAM,WAAW,CAAA;AAC/B,OAAO,EAAE,SAAS,EAAE,MAAM,SAAS,CAAA;AAGnC;;;GAGG;AACH,qBAAa,cAAc;IACzB,OAAO,CAAC,MAAM,CAAQ;IACtB,OAAO,CAAC,QAAQ,CAAc;IAE9B;;;;;OAKG;IACH,OAAO,CAAC,UAAU,CAAwB;IAE1C;;OAEG;IACI,YAAY,EAAE,MAAM,CAAA;gBAEf,MAAM,EAAE,MAAM,EAAE,QAAQ,EAAE,UAAU,EAAE;IAOlD;;OAEG;IACI,IAAI,CAAC,CAAC,EAAE,MAAM,GAAG,UAAU,EAAE;IAapC;;;;OAIG;IACI,SAAS,CAAC,WAAW,CAAC,EAAE,MAAM,GAAG,UAAU,EAAE;IAWpD;;OAEG;IACH,IAAW,UAAU,YAEpB;IAED;;;;;;;;;;;;OAYG;IACI,SAAS,CAAC,IAAI,EAAE,UAAU,EAAE,GAAG,EAAE,GAAG;IAa3C;;;OAGG;IACI,aAAa,CAAC,KAAK,EAAE,UAAU,EAAE,EAAE,UAAU,EAAE,MAAM,GAAG,SAAS,EAAE;IAS1E;;OAEG;IACH,OAAO,CAAC,OAAO;CAOhB"}
@@ -0,0 +1,160 @@
1
+ import { ChunkTree, ChunkLeaf } from './types';
2
+ export interface ChunkTreeHelperOptions {
3
+ chunkSize: number;
4
+ debug?: boolean;
5
+ }
6
+ /**
7
+ * Traverse and modify a chunk tree
8
+ */
9
+ export declare class ChunkTreeHelper {
10
+ /**
11
+ * The root of the chunk tree
12
+ */
13
+ private root;
14
+ /**
15
+ * The ideal size of a chunk
16
+ */
17
+ private chunkSize;
18
+ /**
19
+ * Whether debug mode is enabled
20
+ *
21
+ * If enabled, the pointer state will be checked for internal consistency
22
+ * after each mutating operation.
23
+ */
24
+ private debug;
25
+ /**
26
+ * Whether the traversal has reached the end of the chunk tree
27
+ *
28
+ * When this is true, the pointerChunk and pointerIndex point to the last
29
+ * top-level node in the chunk tree, although pointerNode returns null.
30
+ */
31
+ private reachedEnd;
32
+ /**
33
+ * The chunk containing the current node
34
+ */
35
+ private pointerChunk;
36
+ /**
37
+ * The index of the current node within pointerChunk
38
+ *
39
+ * Can be -1 to indicate that the pointer is before the start of the tree.
40
+ */
41
+ private pointerIndex;
42
+ /**
43
+ * Similar to a Slate path; tracks the path of pointerChunk relative to the
44
+ * root.
45
+ *
46
+ * Used to move the pointer from the current chunk to the parent chunk more
47
+ * efficiently.
48
+ */
49
+ private pointerIndexStack;
50
+ /**
51
+ * Indexing the current chunk's children has a slight time cost, which adds up
52
+ * when traversing very large trees, so the current node is cached.
53
+ *
54
+ * A value of undefined means that the current node is not cached. This
55
+ * property must be set to undefined whenever the pointer is moved, unless
56
+ * the pointer is guaranteed to point to the same node that it did previously.
57
+ */
58
+ private cachedPointerNode;
59
+ constructor(chunkTree: ChunkTree, { chunkSize, debug }: ChunkTreeHelperOptions);
60
+ /**
61
+ * Move the pointer to the next leaf in the chunk tree
62
+ */
63
+ readLeaf(): ChunkLeaf | null;
64
+ /**
65
+ * Move the pointer to the previous leaf in the chunk tree
66
+ */
67
+ returnToPreviousLeaf(): void;
68
+ /**
69
+ * Insert leaves before the current leaf, leaving the pointer unchanged
70
+ */
71
+ insertBefore(leaves: ChunkLeaf[]): void;
72
+ /**
73
+ * Insert leaves after the current leaf, leaving the pointer on the last
74
+ * inserted leaf
75
+ *
76
+ * The insertion algorithm first checks for any chunk we're currently at the
77
+ * end of that can receive additional leaves. Next, it tries to insert leaves
78
+ * at the starts of any subsequent chunks.
79
+ *
80
+ * Any remaining leaves are passed to rawInsertAfter to be chunked and
81
+ * inserted at the highest possible level.
82
+ */
83
+ insertAfter(leaves: ChunkLeaf[]): void;
84
+ /**
85
+ * Remove the current node and decrement the pointer, deleting any ancestor
86
+ * chunk that becomes empty as a result
87
+ */
88
+ remove(): void;
89
+ /**
90
+ * Add the current chunk and all ancestor chunks to the list of modified
91
+ * chunks
92
+ */
93
+ invalidateChunk(): void;
94
+ /**
95
+ * Whether the pointer is at the start of the tree
96
+ */
97
+ private get atStart();
98
+ /**
99
+ * The siblings of the current node
100
+ */
101
+ private get pointerSiblings();
102
+ /**
103
+ * Get the current node (uncached)
104
+ *
105
+ * If the pointer is at the start or end of the document, returns null.
106
+ *
107
+ * Usually, the current node is a chunk leaf, although it can be a chunk
108
+ * while insertions are in progress.
109
+ */
110
+ private getPointerNode;
111
+ /**
112
+ * Cached getter for the current node
113
+ */
114
+ private get pointerNode();
115
+ /**
116
+ * Get the path of a chunk relative to the root, returning null if the chunk
117
+ * is not connected to the root
118
+ */
119
+ private getChunkPath;
120
+ /**
121
+ * Save the current pointer to be restored later
122
+ */
123
+ private savePointer;
124
+ /**
125
+ * Restore the pointer to a previous state
126
+ */
127
+ private restorePointer;
128
+ /**
129
+ * Assuming the current node is a chunk, move the pointer into that chunk
130
+ *
131
+ * @param end If true, place the pointer on the last node of the chunk.
132
+ * Otherwise, place the pointer on the first node.
133
+ */
134
+ private enterChunk;
135
+ /**
136
+ * Assuming the current node is a chunk, move the pointer into that chunk
137
+ * repeatedly until the current node is a leaf
138
+ *
139
+ * @param end If true, place the pointer on the last node of the chunk.
140
+ * Otherwise, place the pointer on the first node.
141
+ */
142
+ private enterChunkUntilLeaf;
143
+ /**
144
+ * Move the pointer to the parent chunk
145
+ */
146
+ private exitChunk;
147
+ /**
148
+ * Insert leaves immediately after the current node, leaving the pointer on
149
+ * the last inserted leaf
150
+ *
151
+ * Leaves are chunked according to the number of nodes already in the parent
152
+ * plus the number of nodes being inserted, or the minimum depth if larger
153
+ */
154
+ private rawInsertAfter;
155
+ /**
156
+ * If debug mode is enabled, ensure that the state is internally consistent
157
+ */
158
+ private validateState;
159
+ }
160
+ //# sourceMappingURL=chunk-tree-helper.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"chunk-tree-helper.d.ts","sourceRoot":"","sources":["../../../../packages/slate-react/src/chunking/chunk-tree-helper.ts"],"names":[],"mappings":"AAEA,OAAO,EAEL,SAAS,EACT,SAAS,EAGV,MAAM,SAAS,CAAA;AAShB,MAAM,WAAW,sBAAsB;IACrC,SAAS,EAAE,MAAM,CAAA;IACjB,KAAK,CAAC,EAAE,OAAO,CAAA;CAChB;AAED;;GAEG;AACH,qBAAa,eAAe;IAC1B;;OAEG;IACH,OAAO,CAAC,IAAI,CAAW;IAEvB;;OAEG;IACH,OAAO,CAAC,SAAS,CAAQ;IAEzB;;;;;OAKG;IACH,OAAO,CAAC,KAAK,CAAS;IAEtB;;;;;OAKG;IACH,OAAO,CAAC,UAAU,CAAS;IAE3B;;OAEG;IACH,OAAO,CAAC,YAAY,CAAe;IAEnC;;;;OAIG;IACH,OAAO,CAAC,YAAY,CAAQ;IAE5B;;;;;;OAMG;IACH,OAAO,CAAC,iBAAiB,CAAU;IAEnC;;;;;;;OAOG;IACH,OAAO,CAAC,iBAAiB,CAAoC;gBAG3D,SAAS,EAAE,SAAS,EACpB,EAAE,SAAS,EAAE,KAAK,EAAE,EAAE,sBAAsB;IAa9C;;OAEG;IACI,QAAQ,IAAI,SAAS,GAAG,IAAI;IA0BnC;;OAEG;IACI,oBAAoB;IA6B3B;;OAEG;IACI,YAAY,CAAC,MAAM,EAAE,SAAS,EAAE;IAMvC;;;;;;;;;;OAUG;IACI,WAAW,CAAC,MAAM,EAAE,SAAS,EAAE;IA8EtC;;;OAGG;IACI,MAAM;IAiBb;;;OAGG;IACI,eAAe;IAMtB;;OAEG;IACH,OAAO,KAAK,OAAO,GAElB;IAED;;OAEG;IACH,OAAO,KAAK,eAAe,GAE1B;IAED;;;;;;;OAOG;IACH,OAAO,CAAC,cAAc;IAQtB;;OAEG;IACH,OAAO,KAAK,WAAW,GAKtB;IAED;;;OAGG;IACH,OAAO,CAAC,YAAY;IAiBpB;;OAEG;IACH,OAAO,CAAC,WAAW;IAcnB;;OAEG;IACH,OAAO,CAAC,cAAc;IA0CtB;;;;;OAKG;IACH,OAAO,CAAC,UAAU;IAkBlB;;;;;;OAMG;IACH,OAAO,CAAC,mBAAmB;IAM3B;;OAEG;IACH,OAAO,CAAC,SAAS;IAajB;;;;;;OAMG;IACH,OAAO,CAAC,cAAc;IAsDtB;;OAEG;IAEH,OAAO,CAAC,aAAa;CA4CtB"}
@@ -0,0 +1,16 @@
1
+ import { Ancestor, Editor } from 'slate';
2
+ import { Key } from 'slate-dom';
3
+ import { ChunkTree } from './types';
4
+ import { ReconcileOptions } from './reconcile-children';
5
+ export declare const KEY_TO_CHUNK_TREE: WeakMap<Key, ChunkTree>;
6
+ /**
7
+ * Get or create the chunk tree for a Slate node
8
+ *
9
+ * If the reconcile option is provided, the chunk tree will be updated to
10
+ * match the current children of the node. The children are chunked
11
+ * automatically using the given chunk size.
12
+ */
13
+ export declare const getChunkTreeForNode: (editor: Editor, node: Ancestor, options?: {
14
+ reconcile?: Omit<ReconcileOptions, 'chunkTree' | 'children'> | false;
15
+ }) => ChunkTree;
16
+ //# sourceMappingURL=get-chunk-tree-for-node.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"get-chunk-tree-for-node.d.ts","sourceRoot":"","sources":["../../../../packages/slate-react/src/chunking/get-chunk-tree-for-node.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,EAAE,MAAM,OAAO,CAAA;AACxC,OAAO,EAAE,GAAG,EAAE,MAAM,WAAW,CAAA;AAC/B,OAAO,EAAE,SAAS,EAAE,MAAM,SAAS,CAAA;AACnC,OAAO,EAAE,gBAAgB,EAAqB,MAAM,sBAAsB,CAAA;AAG1E,eAAO,MAAM,iBAAiB,yBAAgC,CAAA;AAE9D;;;;;;GAMG;AACH,eAAO,MAAM,mBAAmB,WACtB,MAAM,QACR,QAAQ,YAEL;IACP,SAAS,CAAC,EAAE,KAAK,gBAAgB,EAAE,WAAW,GAAG,UAAU,CAAC,GAAG,KAAK,CAAA;CACrE,cAyBF,CAAA"}
@@ -0,0 +1,3 @@
1
+ export * from './get-chunk-tree-for-node';
2
+ export * from './types';
3
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../packages/slate-react/src/chunking/index.ts"],"names":[],"mappings":"AAAA,cAAc,2BAA2B,CAAA;AACzC,cAAc,SAAS,CAAA"}
@@ -0,0 +1,19 @@
1
+ import { Editor, Descendant } from 'slate';
2
+ import { ChunkTree } from './types';
3
+ import { ChunkTreeHelperOptions } from './chunk-tree-helper';
4
+ export interface ReconcileOptions extends ChunkTreeHelperOptions {
5
+ chunkTree: ChunkTree;
6
+ children: Descendant[];
7
+ chunkSize: number;
8
+ rerenderChildren?: number[];
9
+ onInsert?: (node: Descendant, index: number) => void;
10
+ onUpdate?: (node: Descendant, index: number) => void;
11
+ onIndexChange?: (node: Descendant, index: number) => void;
12
+ debug?: boolean;
13
+ }
14
+ /**
15
+ * Update the chunk tree to match the children array, inserting, removing and
16
+ * updating differing nodes
17
+ */
18
+ export declare const reconcileChildren: (editor: Editor, { chunkTree, children, chunkSize, rerenderChildren, onInsert, onUpdate, onIndexChange, debug, }: ReconcileOptions) => void;
19
+ //# sourceMappingURL=reconcile-children.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"reconcile-children.d.ts","sourceRoot":"","sources":["../../../../packages/slate-react/src/chunking/reconcile-children.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,OAAO,CAAA;AAC1C,OAAO,EAAE,SAAS,EAAa,MAAM,SAAS,CAAA;AAC9C,OAAO,EAAmB,sBAAsB,EAAE,MAAM,qBAAqB,CAAA;AAG7E,MAAM,WAAW,gBAAiB,SAAQ,sBAAsB;IAC9D,SAAS,EAAE,SAAS,CAAA;IACpB,QAAQ,EAAE,UAAU,EAAE,CAAA;IACtB,SAAS,EAAE,MAAM,CAAA;IACjB,gBAAgB,CAAC,EAAE,MAAM,EAAE,CAAA;IAC3B,QAAQ,CAAC,EAAE,CAAC,IAAI,EAAE,UAAU,EAAE,KAAK,EAAE,MAAM,KAAK,IAAI,CAAA;IACpD,QAAQ,CAAC,EAAE,CAAC,IAAI,EAAE,UAAU,EAAE,KAAK,EAAE,MAAM,KAAK,IAAI,CAAA;IACpD,aAAa,CAAC,EAAE,CAAC,IAAI,EAAE,UAAU,EAAE,KAAK,EAAE,MAAM,KAAK,IAAI,CAAA;IACzD,KAAK,CAAC,EAAE,OAAO,CAAA;CAChB;AAED;;;GAGG;AACH,eAAO,MAAM,iBAAiB,WACpB,MAAM,mGAUX,gBAAgB,SA+FpB,CAAA"}
@@ -0,0 +1,44 @@
1
+ import { Descendant } from 'slate';
2
+ import { Key } from 'slate-dom';
3
+ export interface ChunkTree {
4
+ type: 'root';
5
+ children: ChunkDescendant[];
6
+ /**
7
+ * The keys of any Slate nodes that have been moved using move_node since the
8
+ * last render
9
+ *
10
+ * Detecting when a node has been moved to a different position in the
11
+ * children array is impossible to do efficiently while reconciling the chunk
12
+ * tree. This interferes with the reconciliation logic since it is treated as
13
+ * if the intermediate nodes were inserted and removed, causing them to be
14
+ * re-chunked unnecessarily.
15
+ *
16
+ * This set is used to detect when a node has been moved so that this case
17
+ * can be handled correctly and efficiently.
18
+ */
19
+ movedNodeKeys: Set<Key>;
20
+ /**
21
+ * The chunks whose descendants have been modified during the most recent
22
+ * reconciliation
23
+ *
24
+ * Used to determine when the otherwise memoized React components for each
25
+ * chunk should be re-rendered.
26
+ */
27
+ modifiedChunks: Set<Chunk>;
28
+ }
29
+ export interface Chunk {
30
+ type: 'chunk';
31
+ key: Key;
32
+ parent: ChunkAncestor;
33
+ children: ChunkDescendant[];
34
+ }
35
+ export interface ChunkLeaf {
36
+ type: 'leaf';
37
+ key: Key;
38
+ node: Descendant;
39
+ index: number;
40
+ }
41
+ export type ChunkAncestor = ChunkTree | Chunk;
42
+ export type ChunkDescendant = Chunk | ChunkLeaf;
43
+ export type ChunkNode = ChunkTree | Chunk | ChunkLeaf;
44
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../packages/slate-react/src/chunking/types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,OAAO,CAAA;AAClC,OAAO,EAAE,GAAG,EAAE,MAAM,WAAW,CAAA;AAE/B,MAAM,WAAW,SAAS;IACxB,IAAI,EAAE,MAAM,CAAA;IACZ,QAAQ,EAAE,eAAe,EAAE,CAAA;IAE3B;;;;;;;;;;;;OAYG;IACH,aAAa,EAAE,GAAG,CAAC,GAAG,CAAC,CAAA;IAEvB;;;;;;OAMG;IACH,cAAc,EAAE,GAAG,CAAC,KAAK,CAAC,CAAA;CAC3B;AAED,MAAM,WAAW,KAAK;IACpB,IAAI,EAAE,OAAO,CAAA;IACb,GAAG,EAAE,GAAG,CAAA;IACR,MAAM,EAAE,aAAa,CAAA;IACrB,QAAQ,EAAE,eAAe,EAAE,CAAA;CAC5B;AAKD,MAAM,WAAW,SAAS;IACxB,IAAI,EAAE,MAAM,CAAA;IACZ,GAAG,EAAE,GAAG,CAAA;IACR,IAAI,EAAE,UAAU,CAAA;IAChB,KAAK,EAAE,MAAM,CAAA;CACd;AAED,MAAM,MAAM,aAAa,GAAG,SAAS,GAAG,KAAK,CAAA;AAC7C,MAAM,MAAM,eAAe,GAAG,KAAK,GAAG,SAAS,CAAA;AAC/C,MAAM,MAAM,SAAS,GAAG,SAAS,GAAG,KAAK,GAAG,SAAS,CAAA"}
@@ -0,0 +1,13 @@
1
+ /// <reference types="react" />
2
+ import { Element } from 'slate';
3
+ import { Key } from 'slate-dom';
4
+ import { RenderChunkProps } from './editable';
5
+ import { ChunkTree as TChunkTree } from '../chunking';
6
+ declare const ChunkTree: (props: {
7
+ root: TChunkTree;
8
+ ancestor: TChunkTree;
9
+ renderElement: (node: Element, index: number, key: Key) => JSX.Element;
10
+ renderChunk?: ((props: RenderChunkProps) => JSX.Element) | undefined;
11
+ }) => JSX.Element[];
12
+ export default ChunkTree;
13
+ //# sourceMappingURL=chunk-tree.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"chunk-tree.d.ts","sourceRoot":"","sources":["../../../../packages/slate-react/src/components/chunk-tree.tsx"],"names":[],"mappings":";AACA,OAAO,EAAE,OAAO,EAAE,MAAM,OAAO,CAAA;AAC/B,OAAO,EAAE,GAAG,EAAE,MAAM,WAAW,CAAA;AAC/B,OAAO,EAAE,gBAAgB,EAAE,MAAM,YAAY,CAAA;AAC7C,OAAO,EAGL,SAAS,IAAI,UAAU,EACxB,MAAM,aAAa,CAAA;AA6CpB,QAAA,MAAM,SAAS;UAxCP,UAAU;;0BAEM,OAAO,SAAS,MAAM,OAAO,GAAG,KAAK,WAAW;2BAChD,gBAAgB,KAAK,WAAW;mBAqCb,CAAA;AAW3C,eAAe,SAAS,CAAA"}
@@ -17,6 +17,17 @@ export interface RenderElementProps {
17
17
  ref: any;
18
18
  };
19
19
  }
20
+ /**
21
+ * `RenderChunkProps` are passed to the `renderChunk` handler
22
+ */
23
+ export interface RenderChunkProps {
24
+ highest: boolean;
25
+ lowest: boolean;
26
+ children: any;
27
+ attributes: {
28
+ 'data-slate-chunk': true;
29
+ };
30
+ }
20
31
  /**
21
32
  * `RenderLeafProps` are passed to the `renderLeaf` handler.
22
33
  */
@@ -58,6 +69,7 @@ export type EditableProps = {
58
69
  role?: string;
59
70
  style?: React.CSSProperties;
60
71
  renderElement?: (props: RenderElementProps) => JSX.Element;
72
+ renderChunk?: (props: RenderChunkProps) => JSX.Element;
61
73
  renderLeaf?: (props: RenderLeafProps) => JSX.Element;
62
74
  renderText?: (props: RenderTextProps) => JSX.Element;
63
75
  renderPlaceholder?: (props: RenderPlaceholderProps) => JSX.Element;
@@ -76,6 +88,7 @@ export declare const Editable: React.ForwardRefExoticComponent<{
76
88
  role?: string | undefined;
77
89
  style?: React.CSSProperties | undefined;
78
90
  renderElement?: ((props: RenderElementProps) => JSX.Element) | undefined;
91
+ renderChunk?: ((props: RenderChunkProps) => JSX.Element) | undefined;
79
92
  renderLeaf?: ((props: RenderLeafProps) => JSX.Element) | undefined;
80
93
  renderText?: ((props: RenderTextProps) => JSX.Element) | undefined;
81
94
  renderPlaceholder?: ((props: RenderPlaceholderProps) => JSX.Element) | undefined;
@@ -1 +1 @@
1
- {"version":3,"file":"editable.d.ts","sourceRoot":"","sources":["../../../../packages/slate-react/src/components/editable.tsx"],"names":[],"mappings":"AAGA,OAAO,KASN,MAAM,OAAO,CAAA;AACd,OAAO,EAAE,GAAG,EAAE,MAAM,OAAO,CAAA;AAE3B,OAAO,EAEL,OAAO,EAEP,SAAS,EAGT,IAAI,EAEJ,cAAc,EACd,YAAY,EACb,MAAM,OAAO,CAAA;AAQd,OAAO,EAAE,WAAW,EAAE,MAAM,wBAAwB,CAAA;AAEpD,OAAO,EAEL,QAAQ,EAQT,MAAM,WAAW,CAAA;AAwClB;;GAEG;AAEH,MAAM,WAAW,kBAAkB;IACjC,QAAQ,EAAE,GAAG,CAAA;IACb,OAAO,EAAE,OAAO,CAAA;IAChB,UAA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,GAAG,OAAO,yBAevC,CAAA"}
1
+ {"version":3,"file":"editable.d.ts","sourceRoot":"","sources":["../../../../packages/slate-react/src/components/editable.tsx"],"names":[],"mappings":"AAGA,OAAO,KASN,MAAM,OAAO,CAAA;AACd,OAAO,EAAE,GAAG,EAAE,MAAM,OAAO,CAAA;AAE3B,OAAO,EAEL,OAAO,EAEP,SAAS,EAGT,IAAI,EAEJ,cAAc,EACd,YAAY,EACb,MAAM,OAAO,CAAA;AAQd,OAAO,EAAE,WAAW,EAAE,MAAM,wBAAwB,CAAA;AAEpD,OAAO,EAEL,QAAQ,EAQT,MAAM,WAAW,CAAA;AAyClB;;GAEG;AAEH,MAAM,WAAW,kBAAkB;IACjC,QAAQ,EAAE,GAAG,CAAA;IACb,OAAO,EAAE,OAAO,CAAA;IAChB,UAAU,EAAE;QACV,iBAAiB,EAAE,SAAS,CAAA;QAC5B,mBAAmB,CAAC,EAAE,IAAI,CAAA;QAC1B,iBAAiB,CAAC,EAAE,IAAI,CAAA;QACxB,GAAG,CAAC,EAAE,KAAK,CAAA;QACX,GAAG,EAAE,GAAG,CAAA;KACT,CAAA;CACF;AAED;;GAEG;AACH,MAAM,WAAW,gBAAgB;IAC/B,OAAO,EAAE,OAAO,CAAA;IAChB,MAAM,EAAE,OAAO,CAAA;IACf,QAAQ,EAAE,GAAG,CAAA;IACb,UAAU,EAAE;QACV,kBAAkB,EAAE,IAAI,CAAA;KACzB,CAAA;CACF;AAED;;GAEG;AAEH,MAAM,WAAW,eAAe;IAC9B,QAAQ,EAAE,GAAG,CAAA;IACb;;;OAGG;IACH,IAAI,EAAE,IAAI,CAAA;IACV,IAAI,EAAE,IAAI,CAAA;IACV,UAAU,EAAE;QACV,iBAAiB,EAAE,IAAI,CAAA;KACxB,CAAA;IACD;;OAEG;IACH,YAAY,CAAC,EAAE,YAAY,CAAA;CAC5B;AAED;;GAEG;AACH,MAAM,WAAW,eAAe;IAC9B,IAAI,EAAE,IAAI,CAAA;IACV,QAAQ,EAA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K,WAAW;0BACjC,eAAe,KAAK,WAAW;0BAC/B,eAAe,KAAK,WAAW;iCACxB,sBAAsB,KAAK,WAAW;wCAC/B,WAAW,YAAY,QAAQ,KAAK,IAAI;;;uFA6rD5E,CAAA;AAED;;GAEG;AACH,MAAM,MAAM,sBAAsB,GAAG;IACnC,QAAQ,EAAE,GAAG,CAAA;IACb,UAAU,EAAE;QACV,wBAAwB,EAAE,OAAO,CAAA;QACjC,GAAG,CAAC,EAAE,KAAK,CAAA;QACX,eAAe,EAAE,OAAO,CAAA;QACxB,GAAG,EAAE,KAAK,CAAC,WAAW,CAAC,GAAG,CAAC,CAAA;QAC3B,KAAK,EAAE,KAAK,CAAC,aAAa,CAAA;KAC3B,CAAA;CACF,CAAA;AAED;;GAEG;AAEH,eAAO,MAAM,kBAAkB,8BAG5B,sBAAsB,gBAOxB,CAAA;AAED;;GAEG;AAEH,eAAO,MAAM,eAAe,EAAE,CAAC,KAAK,EAAE,SAAS,KAAK,cAAc,EAAa,CAAA;AA4B/E;;GAEG;AAEH,eAAO,MAAM,cAAc,gHAIO,IAAI,GAAG,OAAO,yBAc/C,CAAA;AAED;;GAEG;AACH,eAAO,MAAM,qBAAqB,yFAUjC,CAAA;AAED;;GAEG;AAEH,eAAO,MAAM,iBAAiB,uDAEJ,IAAI,GAAG,OAAO,yBAevC,CAAA"}
@@ -1,7 +1,7 @@
1
1
  import React from 'react';
2
2
  import { JSX } from 'react';
3
- import { Element as SlateElement, Range, DecoratedRange } from 'slate';
4
- import { RenderElementProps, RenderLeafProps, RenderPlaceholderProps, RenderTextProps } from './editable';
3
+ import { Element as SlateElement, DecoratedRange } from 'slate';
4
+ import { RenderChunkProps, RenderElementProps, RenderLeafProps, RenderPlaceholderProps, RenderTextProps } from './editable';
5
5
  /**
6
6
  * Element.
7
7
  */
@@ -9,19 +9,19 @@ declare const Element: (props: {
9
9
  decorations: DecoratedRange[];
10
10
  element: SlateElement;
11
11
  renderElement?: ((props: RenderElementProps) => JSX.Element) | undefined;
12
+ renderChunk?: ((props: RenderChunkProps) => JSX.Element) | undefined;
12
13
  renderPlaceholder: (props: RenderPlaceholderProps) => JSX.Element;
13
14
  renderText?: ((props: RenderTextProps) => JSX.Element) | undefined;
14
15
  renderLeaf?: ((props: RenderLeafProps) => JSX.Element) | undefined;
15
- selection: Range | null;
16
16
  }) => JSX.Element;
17
17
  declare const MemoizedElement: React.MemoExoticComponent<(props: {
18
18
  decorations: DecoratedRange[];
19
19
  element: SlateElement;
20
20
  renderElement?: ((props: RenderElementProps) => JSX.Element) | undefined;
21
+ renderChunk?: ((props: RenderChunkProps) => JSX.Element) | undefined;
21
22
  renderPlaceholder: (props: RenderPlaceholderProps) => JSX.Element;
22
23
  renderText?: ((props: RenderTextProps) => JSX.Element) | undefined;
23
24
  renderLeaf?: ((props: RenderLeafProps) => JSX.Element) | undefined;
24
- selection: Range | null;
25
25
  }) => JSX.Element>;
26
26
  /**
27
27
  * The default element renderer.
@@ -1 +1 @@
1
- {"version":3,"file":"element.d.ts","sourceRoot":"","sources":["../../../../packages/slate-react/src/components/element.tsx"],"names":[],"mappings":"AACA,OAAO,KAAsB,MAAM,OAAO,CAAA;AAC1C,OAAO,EAAE,GAAG,EAAE,MAAM,OAAO,CAAA;AAC3B,OAAO,EAEL,OAAO,IAAI,YAAY,EAEvB,KAAK,EACL,cAAc,EACf,MAAM,OAAO,CAAA;AAWd,OAAO,EACL,kBAAkB,EAClB,eAAe,EACf,sBAAsB,EACtB,eAAe,EAChB,MAAM,YAAY,CAAA;AAInB;;GAEG;AAEH,QAAA,MAAM,OAAO;iBACE,cAAc,EAAE;aACpB,YAAY;6BACG,kBAAkB,KAAK,WAAW;+BAC/B,sBAAsB,KAAK,WAAW;0BAC5C,eAAe,KAAK,WAAW;0BAC/B,eAAe,KAAK,WAAW;eACzC,KAAK,GAAG,IAAI;iBAyGxB,CAAA;AAED,QAAA,MAAM,eAAe;iBAjHN,cAAc,EAAE;aACpB,YAAY;6BACG,kBAAkB,KAAK,WAAW;+BAC/B,sBAAsB,KAAK,WAAW;0BAC5C,eAAe,KAAK,WAAW;0BAC/B,eAAe,KAAK,WAAW;eACzC,KAAK,GAAG,IAAI;kBAwHvB,CAAA;AAEF;;GAEG;AAEH,eAAO,MAAM,cAAc,UAAW,kBAAkB,gBASvD,CAAA;AAED,eAAe,eAAe,CAAA"}
1
+ {"version":3,"file":"element.d.ts","sourceRoot":"","sources":["../../../../packages/slate-react/src/components/element.tsx"],"names":[],"mappings":"AACA,OAAO,KAAsB,MAAM,OAAO,CAAA;AAC1C,OAAO,EAAE,GAAG,EAAE,MAAM,OAAO,CAAA;AAC3B,OAAO,EAAU,OAAO,IAAI,YAAY,EAAQ,cAAc,EAAE,MAAM,OAAO,CAAA;AAW7E,OAAO,EACL,gBAAgB,EAChB,kBAAkB,EAClB,eAAe,EACf,sBAAsB,EACtB,eAAe,EAChB,MAAM,YAAY,CAAA;AASnB;;GAEG;AAEH,QAAA,MAAM,OAAO;iBACE,cAAc,EAAE;aACpB,YAAY;6BACG,kBAAkB,KAAK,WAAW;2BACpC,gBAAgB,KAAK,WAAW;+BAC3B,sBAAsB,KAAK,WAAW;0BAC5C,eAAe,KAAK,WAAW;0BAC/B,eAAe,KAAK,WAAW;iBA0GrD,CAAA;AAED,QAAA,MAAM,eAAe;iBAlHN,cAAc,EAAE;aACpB,YAAY;6BACG,kBAAkB,KAAK,WAAW;2BACpC,gBAAgB,KAAK,WAAW;+BAC3B,sBAAsB,KAAK,WAAW;0BAC5C,eAAe,KAAK,WAAW;0BAC/B,eAAe,KAAK,WAAW;kBAsHpD,CAAA;AAEF;;GAEG;AAEH,eAAO,MAAM,cAAc,UAAW,kBAAkB,gBASvD,CAAA;AAED,eAAe,eAAe,CAAA"}
@@ -1 +1 @@
1
- {"version":3,"file":"leaf.d.ts","sourceRoot":"","sources":["../../../../packages/slate-react/src/components/leaf.tsx"],"names":[],"mappings":"AAAA,OAAO,KAMN,MAAM,OAAO,CAAA;AACd,OAAO,EAAE,GAAG,EAAE,MAAM,OAAO,CAAA;AAC3B,OAAO,EAAE,OAAO,EAAE,YAAY,EAAE,IAAI,EAAE,MAAM,OAAO,CAAA;AAQnD,OAAO,EAAE,eAAe,EAAE,sBAAsB,EAAE,MAAM,YAAY,CAAA;AA0JpE,QAAA,MAAM,YAAY;YAzHR,OAAO;UACT,IAAI;YACF,OAAO;+BACY,sBAAsB,KAAK,WAAW;0BAC5C,eAAe,KAAK,WAAW;UAC9C,IAAI;;kBA8HV,CAAA;AAEF,eAAO,MAAM,WAAW,UAAW,eAAe,gBAGjD,CAAA;AAED,eAAe,YAAY,CAAA"}
1
+ {"version":3,"file":"leaf.d.ts","sourceRoot":"","sources":["../../../../packages/slate-react/src/components/leaf.tsx"],"names":[],"mappings":"AAAA,OAAO,KAMN,MAAM,OAAO,CAAA;AACd,OAAO,EAAE,GAAG,EAAE,MAAM,OAAO,CAAA;AAC3B,OAAO,EAAE,OAAO,EAAE,YAAY,EAAE,IAAI,EAAE,MAAM,OAAO,CAAA;AAInD,OAAO,EAAE,eAAe,EAAE,sBAAsB,EAAE,MAAM,YAAY,CAAA;AA4JpE,QAAA,MAAM,YAAY;YAzHR,OAAO;UACT,IAAI;YACF,OAAO;+BACY,sBAAsB,KAAK,WAAW;0BAC5C,eAAe,KAAK,WAAW;UAC9C,IAAI;;kBA8HV,CAAA;AAEF,eAAO,MAAM,WAAW,UAAW,eAAe,gBAGjD,CAAA;AAED,eAAe,YAAY,CAAA"}
@@ -1 +1 @@
1
- {"version":3,"file":"slate.d.ts","sourceRoot":"","sources":["../../../../packages/slate-react/src/components/slate.tsx"],"names":[],"mappings":"AAAA,OAAO,KAA2C,MAAM,OAAO,CAAA;AAC/D,OAAO,EAAE,UAAU,EAAqC,SAAS,EAAE,MAAM,OAAO,CAAA;AAUhF,OAAO,EAAE,WAAW,EAAE,MAAM,wBAAwB,CAAA;AAGpD;;;GAGG;AAEH,eAAO,MAAM,KAAK;YACR,WAAW;kBACL,UAAU,EAAE;cAChB,MAAM,SAAS;wBACN,UAAU,EAAE,KAAK,IAAI;qCACR,SAAS,KAAK,IAAI;6BAC1B,UAAU,EAAE,KAAK,IAAI;uBAuG9C,CAAA"}
1
+ {"version":3,"file":"slate.d.ts","sourceRoot":"","sources":["../../../../packages/slate-react/src/components/slate.tsx"],"names":[],"mappings":"AAAA,OAAO,KAA2C,MAAM,OAAO,CAAA;AAC/D,OAAO,EAAE,UAAU,EAAqC,SAAS,EAAE,MAAM,OAAO,CAAA;AAShF,OAAO,EAAE,WAAW,EAAE,MAAM,wBAAwB,CAAA;AAGpD;;;GAGG;AAEH,eAAO,MAAM,KAAK;YACR,WAAW;kBACL,UAAU,EAAE;cAChB,MAAM,SAAS;wBACN,UAAU,EAAE,KAAK,IAAI;qCACR,SAAS,KAAK,IAAI;6BAC1B,UAAU,EAAE,KAAK,IAAI;uBAmG9C,CAAA"}
@@ -9,7 +9,7 @@ declare const MemoizedText: React.MemoExoticComponent<(props: {
9
9
  renderLeaf?: ((props: RenderLeafProps) => JSX.Element) | undefined;
10
10
  renderText?: ((props: RenderTextProps) => JSX.Element) | undefined;
11
11
  text: SlateText;
12
- }) => JSX.Element>;
12
+ }) => React.JSX.Element>;
13
13
  export declare const DefaultText: (props: RenderTextProps) => React.JSX.Element;
14
14
  export default MemoizedText;
15
15
  //# sourceMappingURL=text.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"text.d.ts","sourceRoot":"","sources":["../../../../packages/slate-react/src/components/text.tsx"],"names":[],"mappings":"AAAA,OAAO,KAA8B,MAAM,OAAO,CAAA;AAClD,OAAO,EAAE,OAAO,EAAE,IAAI,IAAI,SAAS,EAAE,cAAc,EAAE,MAAM,OAAO,CAAA;AAQlE,OAAO,EACL,eAAe,EACf,sBAAsB,EACtB,eAAe,EAChB,MAAM,YAAY,CAAA;AAmFnB,QAAA,MAAM,YAAY;iBA3EH,cAAc,EAAE;YACrB,OAAO;YACP,OAAO;+BACY,sBAAsB,KAAK,WAAW;0BAC5C,eAAe,KAAK,WAAW;0BAC/B,eAAe,KAAK,WAAW;UAC9C,SAAS;kBA+Ef,CAAA;AAEF,eAAO,MAAM,WAAW,UAAW,eAAe,sBAGjD,CAAA;AAED,eAAe,YAAY,CAAA"}
1
+ {"version":3,"file":"text.d.ts","sourceRoot":"","sources":["../../../../packages/slate-react/src/components/text.tsx"],"names":[],"mappings":"AAAA,OAAO,KAA8B,MAAM,OAAO,CAAA;AAClD,OAAO,EAAE,OAAO,EAAE,IAAI,IAAI,SAAS,EAAE,cAAc,EAAE,MAAM,OAAO,CAAA;AAQlE,OAAO,EACL,eAAe,EACf,sBAAsB,EACtB,eAAe,EAChB,MAAM,YAAY,CAAA;AAwFnB,QAAA,MAAM,YAAY;iBA7EH,cAAc,EAAE;YACrB,OAAO;YACP,OAAO;+BACY,sBAAsB,KAAK,WAAW;0BAC5C,eAAe,KAAK,WAAW;0BAC/B,eAAe,KAAK,WAAW;UAC9C,SAAS;wBAiFf,CAAA;AAEF,eAAO,MAAM,WAAW,UAAW,eAAe,sBAGjD,CAAA;AAED,eAAe,YAAY,CAAA"}
@@ -1,6 +1,6 @@
1
1
  import React from 'react';
2
- import { Ancestor, Element, Range, DecoratedRange } from 'slate';
3
- import { RenderElementProps, RenderLeafProps, RenderPlaceholderProps, RenderTextProps } from '../components/editable';
2
+ import { Ancestor, Element, DecoratedRange } from 'slate';
3
+ import { RenderChunkProps, RenderElementProps, RenderLeafProps, RenderPlaceholderProps, RenderTextProps } from '../components/editable';
4
4
  /**
5
5
  * Children.
6
6
  */
@@ -8,10 +8,10 @@ declare const useChildren: (props: {
8
8
  decorations: DecoratedRange[];
9
9
  node: Ancestor;
10
10
  renderElement?: ((props: RenderElementProps) => JSX.Element) | undefined;
11
+ renderChunk?: ((props: RenderChunkProps) => JSX.Element) | undefined;
11
12
  renderPlaceholder: (props: RenderPlaceholderProps) => JSX.Element;
12
13
  renderText?: ((props: RenderTextProps) => JSX.Element) | undefined;
13
14
  renderLeaf?: ((props: RenderLeafProps) => JSX.Element) | undefined;
14
- selection: Range | null;
15
- }) => React.JSX.Element[];
15
+ }) => React.JSX.Element | React.JSX.Element[];
16
16
  export default useChildren;
17
17
  //# 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":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAA;AACzB,OAAO,EACL,QAAQ,EAGR,OAAO,EACP,KAAK,EACL,cAAc,EACf,MAAM,OAAO,CAAA;AACd,OAAO,EACL,kBAAkB,EAClB,eAAe,EACf,sBAAsB,EACtB,eAAe,EAChB,MAAM,wBAAwB,CAAA;AAU/B;;GAEG;AAEH,QAAA,MAAM,WAAW;iBACF,cAAc,EAAE;UACvB,QAAQ;6BACU,kBAAkB,KAAK,WAAW;+BAC/B,sBAAsB,KAAK,WAAW;0BAC5C,eAAe,KAAK,WAAW;0BAC/B,eAAe,KAAK,WAAW;eACzC,KAAK,GAAG,IAAI;yBAwExB,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,KAA8B,MAAM,OAAO,CAAA;AAClD,OAAO,EAAE,QAAQ,EAAU,OAAO,EAAE,cAAc,EAAQ,MAAM,OAAO,CAAA;AAEvE,OAAO,EACL,gBAAgB,EAChB,kBAAkB,EAClB,eAAe,EACf,sBAAsB,EACtB,eAAe,EAChB,MAAM,wBAAwB,CAAA;AAgB/B;;GAEG;AAEH,QAAA,MAAM,WAAW;iBACF,cAAc,EAAE;UACvB,QAAQ;6BACU,kBAAkB,KAAK,WAAW;2BACpC,gBAAgB,KAAK,WAAW;+BAC3B,sBAAsB,KAAK,WAAW;0BAC5C,eAAe,KAAK,WAAW;0BAC/B,eAAe,KAAK,WAAW;6CAmHrD,CAAA;AAsCD,eAAe,WAAW,CAAA"}
@@ -0,0 +1,18 @@
1
+ /// <reference types="react" />
2
+ import { DecoratedRange, Descendant, NodeEntry } from 'slate';
3
+ type Callback = () => void;
4
+ /**
5
+ * A React context for sharing the `decorate` prop of the editable and
6
+ * subscribing to changes on this prop.
7
+ */
8
+ export declare const DecorateContext: import("react").Context<{
9
+ decorate: (entry: NodeEntry) => DecoratedRange[];
10
+ addEventListener: (callback: Callback) => () => void;
11
+ }>;
12
+ export declare const useDecorations: (node: Descendant, parentDecorations: DecoratedRange[]) => DecoratedRange[];
13
+ export declare const useDecorateContext: (decorateProp: (entry: NodeEntry) => DecoratedRange[]) => {
14
+ decorate: (entry: NodeEntry) => DecoratedRange[];
15
+ addEventListener: (callback: Callback) => () => void;
16
+ };
17
+ export {};
18
+ //# sourceMappingURL=use-decorations.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"use-decorations.d.ts","sourceRoot":"","sources":["../../../../packages/slate-react/src/hooks/use-decorations.ts"],"names":[],"mappings":";AACA,OAAO,EAAE,cAAc,EAAE,UAAU,EAAE,SAAS,EAAQ,MAAM,OAAO,CAAA;AAOnE,KAAK,QAAQ,GAAG,MAAM,IAAI,CAAA;AAE1B;;;GAGG;AAEH,eAAO,MAAM,eAAe;oCACM,cAAc,EAAE;iCACnB,QAAQ,KAAK,MAAM,IAAI;EACzC,CAAA;AAEb,eAAO,MAAM,cAAc,SACnB,UAAU,qBACG,cAAc,EAAE,KAClC,cAAc,EA0BhB,CAAA;AAED,eAAO,MAAM,kBAAkB,uCACO,cAAc,EAAE;;iCAgBJ,QAAQ;CAYzD,CAAA"}
@@ -0,0 +1,12 @@
1
+ /// <reference types="react" />
2
+ import { Element } from 'slate';
3
+ export declare const ElementContext: import("react").Context<import("slate").BaseElement | null>;
4
+ /**
5
+ * Get the current element.
6
+ */
7
+ export declare const useElement: () => Element;
8
+ /**
9
+ * Get the current element, or return null if not inside `renderElement`.
10
+ */
11
+ export declare const useElementIf: () => import("slate").BaseElement | null;
12
+ //# sourceMappingURL=use-element.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"use-element.d.ts","sourceRoot":"","sources":["../../../../packages/slate-react/src/hooks/use-element.ts"],"names":[],"mappings":";AACA,OAAO,EAAE,OAAO,EAAE,MAAM,OAAO,CAAA;AAE/B,eAAO,MAAM,cAAc,6DAAsC,CAAA;AAEjE;;GAEG;AAEH,eAAO,MAAM,UAAU,QAAO,OAU7B,CAAA;AAED;;GAEG;AACH,eAAO,MAAM,YAAY,0CAAmC,CAAA"}
@@ -0,0 +1,20 @@
1
+ /**
2
+ * Create a selector that updates when an `update` function is called, and
3
+ * which only causes the component to render when the result of `selector`
4
+ * differs from the previous result according to `equalityFn`.
5
+ *
6
+ * If `selector` is memoized using `useCallback`, then it will only be called
7
+ * when it changes or when `update` is called. Otherwise, `selector` will be
8
+ * called every time the component renders.
9
+ *
10
+ * @example
11
+ * const [state, update] = useGenericSelector(selector, equalityFn)
12
+ *
13
+ * useIsomorphicLayoutEffect(() => {
14
+ * return addEventListener(update)
15
+ * }, [addEventListener, update])
16
+ *
17
+ * return state
18
+ */
19
+ export declare function useGenericSelector<T>(selector: () => T, equalityFn: (a: T | null, b: T) => boolean): [state: T, update: () => void];
20
+ //# sourceMappingURL=use-generic-selector.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"use-generic-selector.d.ts","sourceRoot":"","sources":["../../../../packages/slate-react/src/hooks/use-generic-selector.tsx"],"names":[],"mappings":"AAEA;;;;;;;;;;;;;;;;;GAiBG;AAEH,wBAAgB,kBAAkB,CAAC,CAAC,EAClC,QAAQ,EAAE,MAAM,CAAC,EACjB,UAAU,EAAE,CAAC,CAAC,EAAE,CAAC,GAAG,IAAI,EAAE,CAAC,EAAE,CAAC,KAAK,OAAO,GACzC,CAAC,KAAK,EAAE,CAAC,EAAE,MAAM,EAAE,MAAM,IAAI,CAAC,CA+DhC"}
@@ -1,8 +1,3 @@
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
1
  /**
7
2
  * Get the current `selected` state of an element.
8
3
  */
@@ -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":"AAMA;;GAEG;AAEH,eAAO,MAAM,WAAW,QAAO,OA0B9B,CAAA"}