@portabletext/editor 6.1.0-canary.0 → 6.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.
@@ -1,9 +1,9 @@
1
- import * as _portabletext_schema5 from "@portabletext/schema";
1
+ import * as _portabletext_schema6 from "@portabletext/schema";
2
2
  import { AnnotationDefinition, AnnotationSchemaType, AnnotationSchemaType as AnnotationSchemaType$1, BaseDefinition, BlockObjectDefinition, BlockObjectSchemaType, BlockObjectSchemaType as BlockObjectSchemaType$1, DecoratorDefinition, DecoratorSchemaType, DecoratorSchemaType as DecoratorSchemaType$1, FieldDefinition, InlineObjectDefinition, InlineObjectSchemaType, InlineObjectSchemaType as InlineObjectSchemaType$1, ListDefinition, ListSchemaType, ListSchemaType as ListSchemaType$1, PortableTextBlock, PortableTextBlock as PortableTextBlock$1, PortableTextChild, PortableTextChild as PortableTextChild$1, PortableTextListBlock, PortableTextObject, PortableTextObject as PortableTextObject$1, PortableTextSpan, PortableTextSpan as PortableTextSpan$1, PortableTextTextBlock, PortableTextTextBlock as PortableTextTextBlock$1, Schema, SchemaDefinition, SchemaDefinition as SchemaDefinition$1, StyleDefinition, StyleSchemaType, StyleSchemaType as StyleSchemaType$1, TypedObject, defineSchema } from "@portabletext/schema";
3
3
  import * as xstate73 from "xstate";
4
4
  import { ActorRef, ActorRefFrom, EventObject, Snapshot } from "xstate";
5
- import * as react10 from "react";
6
- import React$1, { BaseSyntheticEvent, ClipboardEvent as ClipboardEvent$1, FocusEvent, JSX, PropsWithChildren, ReactElement, RefObject, TextareaHTMLAttributes } from "react";
5
+ import * as react8 from "react";
6
+ import React$1, { BaseSyntheticEvent, ClipboardEvent as ClipboardEvent$1, FocusEvent, JSX, MutableRefObject, PropsWithChildren, ReactElement, RefObject, TextareaHTMLAttributes } from "react";
7
7
  import { Patch, Patch as Patch$1 } from "@portabletext/patches";
8
8
  type MIMEType = `${string}/${string}`;
9
9
  /**
@@ -117,121 +117,6 @@ type TextDirection = 'forward' | 'backward';
117
117
  type TextUnit = 'character' | 'word' | 'line' | 'block';
118
118
  type TextUnitAdjustment = TextUnit | 'offset';
119
119
  type OmitFirstArg<F> = F extends ((x: any, ...args: infer P) => infer R) ? (...args: P) => R : never;
120
- interface NodeInsertNodesOptions<T extends Node$1> {
121
- at?: Location;
122
- match?: NodeMatch<T>;
123
- mode?: RangeMode;
124
- hanging?: boolean;
125
- select?: boolean;
126
- voids?: boolean;
127
- batchDirty?: boolean;
128
- }
129
- interface NodeTransforms {
130
- /**
131
- * Insert nodes in the editor
132
- * at the specified location or (if not defined) the current selection or (if not defined) the end of the document.
133
- */
134
- insertNodes: <T extends Node$1>(editor: Editor$1, nodes: Node$1 | Node$1[], options?: NodeInsertNodesOptions<T>) => void;
135
- /**
136
- * Lift nodes at a specific location upwards in the document tree, splitting
137
- * their parent in two if necessary.
138
- */
139
- liftNodes: <T extends Node$1>(editor: Editor$1, options?: {
140
- at?: Location;
141
- match?: NodeMatch<T>;
142
- mode?: MaximizeMode;
143
- voids?: boolean;
144
- }) => void;
145
- /**
146
- * Merge a node at a location with the previous node of the same depth,
147
- * removing any empty containing nodes after the merge if necessary.
148
- */
149
- mergeNodes: <T extends Node$1>(editor: Editor$1, options?: {
150
- at?: Location;
151
- match?: NodeMatch<T>;
152
- mode?: RangeMode;
153
- hanging?: boolean;
154
- voids?: boolean;
155
- }) => void;
156
- /**
157
- * Move the nodes at a location to a new location.
158
- */
159
- moveNodes: <T extends Node$1>(editor: Editor$1, options: {
160
- at?: Location;
161
- match?: NodeMatch<T>;
162
- mode?: MaximizeMode;
163
- to: Path$1;
164
- voids?: boolean;
165
- }) => void;
166
- /**
167
- * Remove the nodes at a specific location in the document.
168
- */
169
- removeNodes: <T extends Node$1>(editor: Editor$1, options?: {
170
- at?: Location;
171
- match?: NodeMatch<T>;
172
- mode?: RangeMode;
173
- hanging?: boolean;
174
- voids?: boolean;
175
- }) => void;
176
- /**
177
- * Set new properties on the nodes at a location.
178
- */
179
- setNodes: <T extends Node$1>(editor: Editor$1, props: Partial<T>, options?: {
180
- at?: Location;
181
- match?: NodeMatch<T>;
182
- mode?: MaximizeMode;
183
- hanging?: boolean;
184
- split?: boolean;
185
- voids?: boolean;
186
- compare?: PropsCompare;
187
- merge?: PropsMerge;
188
- }) => void;
189
- /**
190
- * Split the nodes at a specific location.
191
- */
192
- splitNodes: <T extends Node$1>(editor: Editor$1, options?: {
193
- at?: Location;
194
- match?: NodeMatch<T>;
195
- mode?: RangeMode;
196
- always?: boolean;
197
- height?: number;
198
- voids?: boolean;
199
- }) => void;
200
- /**
201
- * Unset properties on the nodes at a location.
202
- */
203
- unsetNodes: <T extends Node$1>(editor: Editor$1, props: string | string[], options?: {
204
- at?: Location;
205
- match?: NodeMatch<T>;
206
- mode?: MaximizeMode;
207
- hanging?: boolean;
208
- split?: boolean;
209
- voids?: boolean;
210
- }) => void;
211
- /**
212
- * Unwrap the nodes at a location from a parent node, splitting the parent if
213
- * necessary to ensure that only the content in the range is unwrapped.
214
- */
215
- unwrapNodes: <T extends Node$1>(editor: Editor$1, options?: {
216
- at?: Location;
217
- match?: NodeMatch<T>;
218
- mode?: MaximizeMode;
219
- split?: boolean;
220
- voids?: boolean;
221
- }) => void;
222
- /**
223
- * Wrap the nodes at a location in a new container node, splitting the edges
224
- * of the range first to ensure that only the content in the range is wrapped.
225
- */
226
- wrapNodes: <T extends Node$1>(editor: Editor$1, element: Element$1, options?: {
227
- at?: Location;
228
- match?: NodeMatch<T>;
229
- mode?: MaximizeMode;
230
- split?: boolean;
231
- voids?: boolean;
232
- }) => void;
233
- }
234
- declare const NodeTransforms: NodeTransforms;
235
120
  interface TextDeleteOptions {
236
121
  at?: Location;
237
122
  distance?: number;
@@ -240,12 +125,6 @@ interface TextDeleteOptions {
240
125
  hanging?: boolean;
241
126
  voids?: boolean;
242
127
  }
243
- interface TextInsertFragmentOptions {
244
- at?: Location;
245
- hanging?: boolean;
246
- voids?: boolean;
247
- batchDirty?: boolean;
248
- }
249
128
  interface TextInsertTextOptions {
250
129
  at?: Location;
251
130
  voids?: boolean;
@@ -255,11 +134,6 @@ interface TextTransforms {
255
134
  * Delete content in the editor.
256
135
  */
257
136
  delete: (editor: Editor$1, options?: TextDeleteOptions) => void;
258
- /**
259
- * Insert a fragment in the editor
260
- * at the specified location or (if not defined) the current selection or (if not defined) the end of the document.
261
- */
262
- insertFragment: (editor: Editor$1, fragment: Node$1[], options?: TextInsertFragmentOptions) => void;
263
137
  /**
264
138
  * Insert a string of text in the editor
265
139
  * at the specified location or (if not defined) the current selection or (if not defined) the end of the document.
@@ -276,16 +150,19 @@ interface BaseEditor {
276
150
  selection: Selection$1;
277
151
  operations: Operation[];
278
152
  marks: EditorMarks | null;
153
+ dirtyPaths: Path$1[];
154
+ dirtyPathKeys: Set<string>;
155
+ flushing: boolean;
156
+ normalizing: boolean;
157
+ batchingDirtyPaths: boolean;
279
158
  apply: (operation: Operation) => void;
280
159
  createSpan: () => Text$1;
281
160
  getDirtyPaths: (operation: Operation) => Path$1[];
282
161
  getFragment: () => Descendant[];
283
162
  isElementReadOnly: (element: Element$1) => boolean;
284
163
  isSelectable: (element: Element$1) => boolean;
285
- markableVoid: (element: Element$1) => boolean;
286
164
  normalizeNode: (entry: NodeEntry, options?: {
287
165
  operation?: Operation;
288
- fallbackElement?: () => Element$1;
289
166
  }) => void;
290
167
  onChange: (options?: {
291
168
  operation?: Operation;
@@ -300,67 +177,36 @@ interface BaseEditor {
300
177
  dirtyPaths: Path$1[];
301
178
  operation?: Operation;
302
179
  }) => boolean;
303
- addMark: OmitFirstArg<typeof Editor$1.addMark>;
304
180
  collapse: OmitFirstArg<typeof Transforms.collapse>;
305
181
  delete: OmitFirstArg<typeof Transforms.delete>;
306
- deleteBackward: (unit: TextUnit) => void;
307
- deleteForward: (unit: TextUnit) => void;
308
- deleteFragment: OmitFirstArg<typeof Editor$1.deleteFragment>;
309
182
  deselect: OmitFirstArg<typeof Transforms.deselect>;
310
183
  insertBreak: OmitFirstArg<typeof Editor$1.insertBreak>;
311
- insertFragment: OmitFirstArg<typeof Transforms.insertFragment>;
312
- insertNode: OmitFirstArg<typeof Editor$1.insertNode>;
313
184
  insertNodes: OmitFirstArg<typeof Transforms.insertNodes>;
314
- insertSoftBreak: OmitFirstArg<typeof Editor$1.insertSoftBreak>;
315
185
  insertText: OmitFirstArg<typeof Transforms.insertText>;
316
- liftNodes: OmitFirstArg<typeof Transforms.liftNodes>;
317
186
  mergeNodes: OmitFirstArg<typeof Transforms.mergeNodes>;
318
187
  move: OmitFirstArg<typeof Transforms.move>;
319
188
  moveNodes: OmitFirstArg<typeof Transforms.moveNodes>;
320
189
  normalize: OmitFirstArg<typeof Editor$1.normalize>;
321
- removeMark: OmitFirstArg<typeof Editor$1.removeMark>;
322
190
  removeNodes: OmitFirstArg<typeof Transforms.removeNodes>;
323
191
  select: OmitFirstArg<typeof Transforms.select>;
324
- setNodes: <T extends Node$1>(props: Partial<T>, options?: {
325
- at?: Location;
326
- match?: NodeMatch<T>;
327
- mode?: MaximizeMode;
328
- hanging?: boolean;
329
- split?: boolean;
330
- voids?: boolean;
331
- compare?: PropsCompare;
332
- merge?: PropsMerge;
333
- }) => void;
334
192
  setNormalizing: OmitFirstArg<typeof Editor$1.setNormalizing>;
335
- setPoint: OmitFirstArg<typeof Transforms.setPoint>;
336
193
  setSelection: OmitFirstArg<typeof Transforms.setSelection>;
337
194
  splitNodes: OmitFirstArg<typeof Transforms.splitNodes>;
338
- unsetNodes: OmitFirstArg<typeof Transforms.unsetNodes>;
339
- unwrapNodes: OmitFirstArg<typeof Transforms.unwrapNodes>;
340
195
  withoutNormalizing: OmitFirstArg<typeof Editor$1.withoutNormalizing>;
341
- wrapNodes: OmitFirstArg<typeof Transforms.wrapNodes>;
342
196
  above: <T extends Ancestor>(options?: EditorAboveOptions<T>) => NodeEntry<T> | undefined;
343
197
  after: OmitFirstArg<typeof Editor$1.after>;
344
198
  before: OmitFirstArg<typeof Editor$1.before>;
345
- edges: OmitFirstArg<typeof Editor$1.edges>;
346
199
  elementReadOnly: OmitFirstArg<typeof Editor$1.elementReadOnly>;
347
200
  end: OmitFirstArg<typeof Editor$1.end>;
348
- first: OmitFirstArg<typeof Editor$1.first>;
349
- fragment: OmitFirstArg<typeof Editor$1.fragment>;
350
201
  getMarks: OmitFirstArg<typeof Editor$1.marks>;
351
- hasBlocks: OmitFirstArg<typeof Editor$1.hasBlocks>;
352
202
  hasInlines: OmitFirstArg<typeof Editor$1.hasInlines>;
353
203
  hasPath: OmitFirstArg<typeof Editor$1.hasPath>;
354
- hasTexts: OmitFirstArg<typeof Editor$1.hasTexts>;
355
204
  isBlock: OmitFirstArg<typeof Editor$1.isBlock>;
356
205
  isEdge: OmitFirstArg<typeof Editor$1.isEdge>;
357
- isEmpty: OmitFirstArg<typeof Editor$1.isEmpty>;
358
206
  isEnd: OmitFirstArg<typeof Editor$1.isEnd>;
359
207
  isInline: OmitFirstArg<typeof Editor$1.isInline>;
360
208
  isNormalizing: OmitFirstArg<typeof Editor$1.isNormalizing>;
361
209
  isStart: OmitFirstArg<typeof Editor$1.isStart>;
362
- isVoid: OmitFirstArg<typeof Editor$1.isVoid>;
363
- last: OmitFirstArg<typeof Editor$1.last>;
364
210
  leaf: OmitFirstArg<typeof Editor$1.leaf>;
365
211
  levels: <T extends Node$1>(options?: EditorLevelsOptions<T>) => Generator<NodeEntry<T>, void, undefined>;
366
212
  next: <T extends Descendant>(options?: EditorNextOptions<T>) => NodeEntry<T> | undefined;
@@ -369,15 +215,15 @@ interface BaseEditor {
369
215
  parent: OmitFirstArg<typeof Editor$1.parent>;
370
216
  path: OmitFirstArg<typeof Editor$1.path>;
371
217
  pathRef: OmitFirstArg<typeof Editor$1.pathRef>;
372
- pathRefs: OmitFirstArg<typeof Editor$1.pathRefs>;
218
+ pathRefs: Set<PathRef>;
373
219
  point: OmitFirstArg<typeof Editor$1.point>;
374
220
  pointRef: OmitFirstArg<typeof Editor$1.pointRef>;
375
- pointRefs: OmitFirstArg<typeof Editor$1.pointRefs>;
221
+ pointRefs: Set<PointRef>;
376
222
  positions: OmitFirstArg<typeof Editor$1.positions>;
377
223
  previous: <T extends Node$1>(options?: EditorPreviousOptions<T>) => NodeEntry<T> | undefined;
378
224
  range: OmitFirstArg<typeof Editor$1.range>;
379
225
  rangeRef: OmitFirstArg<typeof Editor$1.rangeRef>;
380
- rangeRefs: OmitFirstArg<typeof Editor$1.rangeRefs>;
226
+ rangeRefs: Set<RangeRef>;
381
227
  start: OmitFirstArg<typeof Editor$1.start>;
382
228
  string: OmitFirstArg<typeof Editor$1.string>;
383
229
  unhangRange: OmitFirstArg<typeof Editor$1.unhangRange>;
@@ -404,20 +250,11 @@ interface EditorBeforeOptions {
404
250
  unit?: TextUnitAdjustment;
405
251
  voids?: boolean;
406
252
  }
407
- interface EditorDirectedDeletionOptions {
408
- unit?: TextUnit;
409
- }
410
253
  interface EditorElementReadOnlyOptions {
411
254
  at?: Location;
412
255
  mode?: MaximizeMode;
413
256
  voids?: boolean;
414
257
  }
415
- interface EditorFragmentDeletionOptions {
416
- direction?: TextDirection;
417
- }
418
- interface EditorIsEditorOptions {
419
- deep?: boolean;
420
- }
421
258
  interface EditorLeafOptions {
422
259
  depth?: number;
423
260
  edge?: LeafEdge;
@@ -499,13 +336,6 @@ interface EditorInterface {
499
336
  * Get the ancestor above a location in the document.
500
337
  */
501
338
  above: <T extends Ancestor>(editor: Editor$1, options?: EditorAboveOptions<T>) => NodeEntry<T> | undefined;
502
- /**
503
- * Add a custom property to the leaf text nodes in the current selection.
504
- *
505
- * If the selection is currently collapsed, the marks will be added to the
506
- * `editor.marks` property instead, and applied when text is inserted next.
507
- */
508
- addMark: (editor: Editor$1, key: string, value: any) => void;
509
339
  /**
510
340
  * Get the point after a location.
511
341
  */
@@ -514,22 +344,6 @@ interface EditorInterface {
514
344
  * Get the point before a location.
515
345
  */
516
346
  before: (editor: Editor$1, at: Location, options?: EditorBeforeOptions) => Point | undefined;
517
- /**
518
- * Delete content in the editor backward from the current selection.
519
- */
520
- deleteBackward: (editor: Editor$1, options?: EditorDirectedDeletionOptions) => void;
521
- /**
522
- * Delete content in the editor forward from the current selection.
523
- */
524
- deleteForward: (editor: Editor$1, options?: EditorDirectedDeletionOptions) => void;
525
- /**
526
- * Delete the content in the current selection.
527
- */
528
- deleteFragment: (editor: Editor$1, options?: EditorFragmentDeletionOptions) => void;
529
- /**
530
- * Get the start and end points of a location.
531
- */
532
- edges: (editor: Editor$1, at: Location) => [Point, Point];
533
347
  /**
534
348
  * Match a read-only element in the current branch of the editor.
535
349
  */
@@ -538,49 +352,17 @@ interface EditorInterface {
538
352
  * Get the end point of a location.
539
353
  */
540
354
  end: (editor: Editor$1, at: Location) => Point;
541
- /**
542
- * Get the first node at a location.
543
- */
544
- first: (editor: Editor$1, at: Location) => NodeEntry;
545
- /**
546
- * Get the fragment at a location.
547
- */
548
- fragment: (editor: Editor$1, at: Location) => Descendant[];
549
- /**
550
- * Check if a node has block children.
551
- */
552
- hasBlocks: (editor: Editor$1, element: Element$1) => boolean;
553
355
  /**
554
356
  * Check if a node has inline and text children.
555
357
  */
556
358
  hasInlines: (editor: Editor$1, element: Element$1) => boolean;
557
359
  hasPath: (editor: Editor$1, path: Path$1) => boolean;
558
- /**
559
- * Check if a node has text children.
560
- */
561
- hasTexts: (editor: Editor$1, element: Element$1) => boolean;
562
360
  /**
563
361
  * Insert a block break at the current selection.
564
362
  *
565
363
  * If the selection is currently expanded, it will be deleted first.
566
364
  */
567
365
  insertBreak: (editor: Editor$1) => void;
568
- /**
569
- * Inserts a fragment
570
- * at the specified location or (if not defined) the current selection or (if not defined) the end of the document.
571
- */
572
- insertFragment: (editor: Editor$1, fragment: Node$1[], options?: TextInsertFragmentOptions) => void;
573
- /**
574
- * Atomically inserts `nodes`
575
- * at the specified location or (if not defined) the current selection or (if not defined) the end of the document.
576
- */
577
- insertNode: <T extends Node$1>(editor: Editor$1, node: Node$1, options?: NodeInsertNodesOptions<T>) => void;
578
- /**
579
- * Insert a soft break at the current selection.
580
- *
581
- * If the selection is currently expanded, it will be deleted first.
582
- */
583
- insertSoftBreak: (editor: Editor$1) => void;
584
366
  /**
585
367
  * Insert a string of text
586
368
  * at the specified location or (if not defined) the current selection or (if not defined) the end of the document.
@@ -597,15 +379,11 @@ interface EditorInterface {
597
379
  /**
598
380
  * Check if a value is an `Editor` object.
599
381
  */
600
- isEditor: (value: any, options?: EditorIsEditorOptions) => value is Editor$1;
382
+ isEditor: (value: any) => value is Editor$1;
601
383
  /**
602
384
  * Check if a value is a read-only `Element` object.
603
385
  */
604
386
  isElementReadOnly: (editor: Editor$1, element: Element$1) => boolean;
605
- /**
606
- * Check if an element is empty, accounting for void nodes.
607
- */
608
- isEmpty: (editor: Editor$1, element: Element$1) => boolean;
609
387
  /**
610
388
  * Check if a point is the end point of a location.
611
389
  */
@@ -626,18 +404,10 @@ interface EditorInterface {
626
404
  * Check if a point is the start point of a location.
627
405
  */
628
406
  isStart: (editor: Editor$1, point: Point, at: Location) => boolean;
629
- /**
630
- * Check if a value is a void `Element` object.
631
- */
632
- isVoid: (editor: Editor$1, value: Element$1) => boolean;
633
- /**
634
- * Get the last node at a location.
635
- */
636
- last: (editor: Editor$1, at: Location) => NodeEntry;
637
407
  /**
638
408
  * Get the leaf text node at a location.
639
409
  */
640
- leaf: (editor: Editor$1, at: Location, options?: EditorLeafOptions) => NodeEntry<Text$1>;
410
+ leaf: (editor: Editor$1, at: Location, options?: EditorLeafOptions) => NodeEntry<Text$1 | ObjectNode>;
641
411
  /**
642
412
  * Iterate through all of the levels at a location.
643
413
  */
@@ -722,14 +492,6 @@ interface EditorInterface {
722
492
  * Get the set of currently tracked range refs of the editor.
723
493
  */
724
494
  rangeRefs: (editor: Editor$1) => Set<RangeRef>;
725
- /**
726
- * Remove a custom property from all of the leaf text nodes in the current
727
- * selection.
728
- *
729
- * If the selection is currently collapsed, the removal will be stored on
730
- * `editor.marks` and applied to the text inserted next.
731
- */
732
- removeMark: (editor: Editor$1, key: string) => void;
733
495
  /**
734
496
  * Manually set if the editor should currently be normalizing.
735
497
  *
@@ -770,8 +532,10 @@ declare const Editor$1: EditorInterface;
770
532
  * A helper type for narrowing matched nodes with a predicate.
771
533
  */
772
534
  type NodeMatch<T extends Node$1> = ((node: Node$1, path: Path$1) => node is T) | ((node: Node$1, path: Path$1) => boolean);
773
- type PropsCompare = (prop: Partial<Node$1>, node: Partial<Node$1>) => boolean;
774
- type PropsMerge = (prop: Partial<Node$1>, node: Partial<Node$1>) => object;
535
+ /**
536
+ * @public
537
+ */
538
+ type EditorSchema = Schema;
775
539
  /**
776
540
  * `Element` objects are a type of node in a Slate document that contain other
777
541
  * element nodes or text nodes. They can be either "blocks" or "inlines"
@@ -781,31 +545,23 @@ interface BaseElement {
781
545
  children: Descendant[];
782
546
  }
783
547
  type Element$1 = ExtendedType<'Element', BaseElement>;
784
- interface ElementIsElementOptions {
785
- deep?: boolean;
786
- }
787
548
  interface ElementInterface {
788
549
  /**
789
550
  * Check if a value implements the 'Ancestor' interface.
790
551
  */
791
- isAncestor: (value: any, options?: ElementIsElementOptions) => value is Ancestor;
552
+ isAncestor: (value: any, schema: EditorSchema) => value is Ancestor;
792
553
  /**
793
554
  * Check if a value implements the `Element` interface.
794
555
  */
795
- isElement: (value: any, options?: ElementIsElementOptions) => value is Element$1;
556
+ isElement: (value: any, schema: EditorSchema) => value is Element$1;
796
557
  /**
797
558
  * Check if a value is an array of `Element` objects.
798
559
  */
799
- isElementList: (value: any, options?: ElementIsElementOptions) => value is Element$1[];
560
+ isElementList: (value: any, schema: EditorSchema) => value is Element$1[];
800
561
  /**
801
562
  * Check if a set of props is a partial of Element.
802
563
  */
803
564
  isElementProps: (props: any) => props is Partial<Element$1>;
804
- /**
805
- * Check if a value implements the `Element` interface and has elementKey with selected value.
806
- * Default it check to `type` key value
807
- */
808
- isElementType: <T extends Element$1>(value: any, elementVal: string, elementKey?: string) => value is T;
809
565
  /**
810
566
  * Check if an element matches set of properties.
811
567
  *
@@ -848,7 +604,25 @@ interface SpanInterface {
848
604
  isSpan: (value: any) => value is Span;
849
605
  }
850
606
  declare const Span: SpanInterface;
851
- type Node$1 = Editor$1 | Element$1 | Text$1;
607
+ /**
608
+ * Extendable Custom Types Interface
609
+ */
610
+ type ExtendableTypes = 'Editor' | 'Element' | 'ObjectNode' | 'Text' | 'Selection' | 'Range' | 'Point' | 'Operation' | 'InsertNodeOperation' | 'InsertTextOperation' | 'MergeNodeOperation' | 'MoveNodeOperation' | 'RemoveNodeOperation' | 'RemoveTextOperation' | 'SetNodeOperation' | 'SetSelectionOperation' | 'SplitNodeOperation';
611
+ interface CustomTypes {
612
+ [key: string]: unknown;
613
+ }
614
+ type ExtendedType<K$1 extends ExtendableTypes, B> = unknown extends CustomTypes[K$1] ? B : CustomTypes[K$1];
615
+ /**
616
+ * `ObjectNode` represents a node with semantic content but no children or text.
617
+ * Block objects and inline objects are ObjectNodes in the tree.
618
+ */
619
+ interface BaseObjectNode {
620
+ _type: string;
621
+ _key: string;
622
+ [key: string]: unknown;
623
+ }
624
+ type ObjectNode = ExtendedType<'ObjectNode', BaseObjectNode>;
625
+ type Node$1 = Editor$1 | Element$1 | ObjectNode | Text$1;
852
626
  interface NodeAncestorsOptions {
853
627
  reverse?: boolean;
854
628
  }
@@ -867,9 +641,6 @@ interface NodeElementsOptions {
867
641
  reverse?: boolean;
868
642
  pass?: (node: NodeEntry) => boolean;
869
643
  }
870
- interface NodeIsNodeOptions {
871
- deep?: boolean;
872
- }
873
644
  interface NodeLevelsOptions {
874
645
  reverse?: boolean;
875
646
  }
@@ -889,102 +660,113 @@ interface NodeInterface {
889
660
  /**
890
661
  * Get the node at a specific path, asserting that it's an ancestor node.
891
662
  */
892
- ancestor: (root: Node$1, path: Path$1) => Ancestor;
663
+ ancestor: (root: Node$1, path: Path$1, schema: EditorSchema) => Ancestor;
893
664
  /**
894
665
  * Return a generator of all the ancestor nodes above a specific path.
895
666
  *
896
667
  * By default the order is top-down, from highest to lowest ancestor in
897
668
  * the tree, but you can pass the `reverse: true` option to go bottom-up.
898
669
  */
899
- ancestors: (root: Node$1, path: Path$1, options?: NodeAncestorsOptions) => Generator<NodeEntry<Ancestor>, void, undefined>;
670
+ ancestors: (root: Node$1, path: Path$1, schema: EditorSchema, options?: NodeAncestorsOptions) => Generator<NodeEntry<Ancestor>, void, undefined>;
900
671
  /**
901
672
  * Get the child of a node at a specific index.
902
673
  */
903
- child: (root: Node$1, index: number) => Descendant;
674
+ child: (root: Node$1, index: number, schema: EditorSchema) => Descendant;
904
675
  /**
905
676
  * Iterate over the children of a node at a specific path.
906
677
  */
907
- children: (root: Node$1, path: Path$1, options?: NodeChildrenOptions) => Generator<NodeEntry<Descendant>, void, undefined>;
678
+ children: (root: Node$1, path: Path$1, schema: EditorSchema, options?: NodeChildrenOptions) => Generator<NodeEntry<Descendant>, void, undefined>;
908
679
  /**
909
680
  * Get an entry for the common ancesetor node of two paths.
910
681
  */
911
- common: (root: Node$1, path: Path$1, another: Path$1) => NodeEntry;
682
+ common: (root: Node$1, path: Path$1, another: Path$1, schema: EditorSchema) => NodeEntry;
912
683
  /**
913
684
  * Get the node at a specific path, asserting that it's a descendant node.
914
685
  */
915
- descendant: (root: Node$1, path: Path$1) => Descendant;
686
+ descendant: (root: Node$1, path: Path$1, schema: EditorSchema) => Descendant;
916
687
  /**
917
688
  * Return a generator of all the descendant node entries inside a root node.
918
689
  */
919
- descendants: (root: Node$1, options?: NodeDescendantsOptions) => Generator<NodeEntry<Descendant>, void, undefined>;
690
+ descendants: (root: Node$1, schema: EditorSchema, options?: NodeDescendantsOptions) => Generator<NodeEntry<Descendant>, void, undefined>;
920
691
  /**
921
692
  * Return a generator of all the element nodes inside a root node. Each iteration
922
693
  * will return an `ElementEntry` tuple consisting of `[Element, Path]`. If the
923
694
  * root node is an element it will be included in the iteration as well.
924
695
  */
925
- elements: (root: Node$1, options?: NodeElementsOptions) => Generator<ElementEntry, void, undefined>;
696
+ elements: (root: Node$1, schema: EditorSchema, options?: NodeElementsOptions) => Generator<ElementEntry, void, undefined>;
926
697
  /**
927
698
  * Extract props from a Node.
928
699
  */
929
- extractProps: (node: Node$1) => NodeProps;
700
+ extractProps: (node: Node$1, schema: EditorSchema) => NodeProps;
930
701
  /**
931
702
  * Get the first leaf node entry in a root node from a path.
932
703
  */
933
- first: (root: Node$1, path: Path$1) => NodeEntry;
704
+ first: (root: Node$1, path: Path$1, schema: EditorSchema) => NodeEntry;
934
705
  /**
935
706
  * Get the sliced fragment represented by a range inside a root node.
936
707
  */
937
- fragment: <T extends Ancestor = Editor$1>(root: T, range: Range) => T['children'];
708
+ fragment: <T extends Ancestor = Editor$1>(root: T, range: Range, schema: EditorSchema) => T['children'];
938
709
  /**
939
710
  * Get the descendant node referred to by a specific path. If the path is an
940
711
  * empty array, it refers to the root node itself.
941
712
  */
942
- get: (root: Node$1, path: Path$1) => Node$1;
713
+ get: (root: Node$1, path: Path$1, schema: EditorSchema) => Node$1;
943
714
  /**
944
715
  * Similar to get, but returns undefined if the node does not exist.
945
716
  */
946
- getIf: (root: Node$1, path: Path$1) => Node$1 | undefined;
717
+ getIf: (root: Node$1, path: Path$1, schema: EditorSchema) => Node$1 | undefined;
947
718
  /**
948
719
  * Check if a descendant node exists at a specific path.
949
720
  */
950
- has: (root: Node$1, path: Path$1) => boolean;
721
+ has: (root: Node$1, path: Path$1, schema: EditorSchema) => boolean;
951
722
  /**
952
723
  * Check if a value implements the `Node` interface.
953
724
  */
954
- isNode: (value: any, options?: NodeIsNodeOptions) => value is Node$1;
725
+ isNode: (value: any, schema: EditorSchema) => value is Node$1;
955
726
  /**
956
727
  * Check if a value is a list of `Node` objects.
957
728
  */
958
- isNodeList: (value: any, options?: NodeIsNodeOptions) => value is Node$1[];
729
+ isNodeList: (value: any, schema: EditorSchema) => value is Node$1[];
730
+ /**
731
+ * Check if a value is a leaf node (Text or ObjectNode).
732
+ * Leaf nodes have no children to descend into.
733
+ */
734
+ isLeaf: (value: any, schema: EditorSchema) => boolean;
735
+ /**
736
+ * Check if a value is an ObjectNode. Uses schema to determine whether
737
+ * a node's _type is neither the block type name nor the span type name.
738
+ */
739
+ isObjectNode: (value: any, schema: EditorSchema) => value is ObjectNode;
959
740
  /**
960
741
  * Get the last leaf node entry in a root node from a path.
961
742
  */
962
- last: (root: Node$1, path: Path$1) => NodeEntry;
743
+ last: (root: Node$1, path: Path$1, schema: EditorSchema) => NodeEntry;
963
744
  /**
964
- * Get the node at a specific path, ensuring it's a leaf text node.
745
+ * Get the node at a specific path, ensuring it's a leaf node (Text or
746
+ * ObjectNode).
965
747
  */
966
- leaf: (root: Node$1, path: Path$1) => Text$1;
748
+ leaf: (root: Node$1, path: Path$1, schema: EditorSchema) => Text$1 | ObjectNode;
967
749
  /**
968
750
  * Return a generator of the in a branch of the tree, from a specific path.
969
751
  *
970
752
  * By default the order is top-down, from highest to lowest node in the tree,
971
753
  * but you can pass the `reverse: true` option to go bottom-up.
972
754
  */
973
- levels: (root: Node$1, path: Path$1, options?: NodeLevelsOptions) => Generator<NodeEntry, void, undefined>;
755
+ levels: (root: Node$1, path: Path$1, schema: EditorSchema, options?: NodeLevelsOptions) => Generator<NodeEntry, void, undefined>;
974
756
  /**
975
757
  * Check if a node matches a set of props.
976
758
  */
977
- matches: (node: Node$1, props: Partial<Node$1>) => boolean;
759
+ matches: (node: Node$1, props: Partial<Node$1>, schema: EditorSchema) => boolean;
978
760
  /**
979
761
  * Return a generator of all the node entries of a root node. Each entry is
980
762
  * returned as a `[Node, Path]` tuple, with the path referring to the node's
981
763
  * position inside the root node.
982
764
  */
983
- nodes: (root: Node$1, options?: NodeNodesOptions) => Generator<NodeEntry, void, undefined>;
765
+ nodes: (root: Node$1, schema: EditorSchema, options?: NodeNodesOptions) => Generator<NodeEntry, void, undefined>;
984
766
  /**
985
767
  * Get the parent of a node at a specific path.
986
768
  */
987
- parent: (root: Node$1, path: Path$1) => Ancestor;
769
+ parent: (root: Node$1, path: Path$1, schema: EditorSchema) => Ancestor;
988
770
  /**
989
771
  * Get the concatenated text string of a node's content.
990
772
  *
@@ -992,11 +774,11 @@ interface NodeInterface {
992
774
  * It is not a user-facing string, but a string for performing offset-related
993
775
  * computations for a node.
994
776
  */
995
- string: (node: Node$1) => string;
777
+ string: (node: Node$1, schema: EditorSchema) => string;
996
778
  /**
997
779
  * Return a generator of all leaf text nodes in a root node.
998
780
  */
999
- texts: (root: Node$1, options?: NodeTextsOptions) => Generator<NodeEntry<Text$1>, void, undefined>;
781
+ texts: (root: Node$1, schema: EditorSchema, options?: NodeTextsOptions) => Generator<NodeEntry<Text$1>, void, undefined>;
1000
782
  }
1001
783
  declare const Node$1: NodeInterface;
1002
784
  /**
@@ -1004,7 +786,7 @@ declare const Node$1: NodeInterface;
1004
786
  * tree. It is returned as a convenience in certain cases to narrow a value
1005
787
  * further than the more generic `Node` union.
1006
788
  */
1007
- type Descendant = Element$1 | Text$1;
789
+ type Descendant = Element$1 | ObjectNode | Text$1;
1008
790
  /**
1009
791
  * The `Ancestor` union type represents nodes that are ancestors in the tree.
1010
792
  * It is returned as a convenience in certain cases to narrow a value further
@@ -1020,7 +802,7 @@ type NodeEntry<T extends Node$1 = Node$1> = [T, Path$1];
1020
802
  /**
1021
803
  * Convenience type for returning the props of a node.
1022
804
  */
1023
- type NodeProps = Omit<Editor$1, 'children'> | Omit<Element$1, 'children'> | Omit<Text$1, 'text'>;
805
+ type NodeProps = Omit<Editor$1, 'children'> | Omit<Element$1, 'children'> | ObjectNode | Omit<Text$1, 'text'>;
1024
806
  type BaseInsertNodeOperation = {
1025
807
  type: 'insert_node';
1026
808
  path: Path$1;
@@ -1437,14 +1219,6 @@ interface RangeInterface {
1437
1219
  transform: (range: Range, op: Operation, options?: RangeTransformOptions) => Range | null;
1438
1220
  }
1439
1221
  declare const Range: RangeInterface;
1440
- /**
1441
- * Extendable Custom Types Interface
1442
- */
1443
- type ExtendableTypes = 'Editor' | 'Element' | 'Text' | 'Selection' | 'Range' | 'Point' | 'Operation' | 'InsertNodeOperation' | 'InsertTextOperation' | 'MergeNodeOperation' | 'MoveNodeOperation' | 'RemoveNodeOperation' | 'RemoveTextOperation' | 'SetNodeOperation' | 'SetSelectionOperation' | 'SplitNodeOperation';
1444
- interface CustomTypes {
1445
- [key: string]: unknown;
1446
- }
1447
- type ExtendedType<K$1 extends ExtendableTypes, B> = unknown extends CustomTypes[K$1] ? B : CustomTypes[K$1];
1448
1222
  /**
1449
1223
  * `Text` objects represent the nodes that contain the actual text content of a
1450
1224
  * Slate document along with any formatting properties. They are always leaf
@@ -1481,11 +1255,11 @@ interface TextInterface {
1481
1255
  /**
1482
1256
  * Check if a value implements the `Text` interface.
1483
1257
  */
1484
- isText: (value: any) => value is Text$1;
1258
+ isText: (value: any, schema: EditorSchema) => value is Text$1;
1485
1259
  /**
1486
1260
  * Check if a value is a list of `Text` objects.
1487
1261
  */
1488
- isTextList: (value: any) => value is Text$1[];
1262
+ isTextList: (value: any, schema: EditorSchema) => value is Text$1[];
1489
1263
  /**
1490
1264
  * Check if some props are a partial of Text.
1491
1265
  */
@@ -1513,6 +1287,65 @@ interface GeneralTransforms {
1513
1287
  transform: (editor: Editor$1, op: Operation) => void;
1514
1288
  }
1515
1289
  declare const GeneralTransforms: GeneralTransforms;
1290
+ interface NodeInsertNodesOptions<T extends Node$1> {
1291
+ at?: Location;
1292
+ match?: NodeMatch<T>;
1293
+ mode?: RangeMode;
1294
+ hanging?: boolean;
1295
+ select?: boolean;
1296
+ voids?: boolean;
1297
+ batchDirty?: boolean;
1298
+ }
1299
+ interface NodeTransforms {
1300
+ /**
1301
+ * Insert nodes in the editor
1302
+ * at the specified location or (if not defined) the current selection or (if not defined) the end of the document.
1303
+ */
1304
+ insertNodes: <T extends Node$1>(editor: Editor$1, nodes: Node$1 | Node$1[], options?: NodeInsertNodesOptions<T>) => void;
1305
+ /**
1306
+ * Merge a node at a location with the previous node of the same depth,
1307
+ * removing any empty containing nodes after the merge if necessary.
1308
+ */
1309
+ mergeNodes: <T extends Node$1>(editor: Editor$1, options?: {
1310
+ at?: Location;
1311
+ match?: NodeMatch<T>;
1312
+ mode?: RangeMode;
1313
+ hanging?: boolean;
1314
+ voids?: boolean;
1315
+ }) => void;
1316
+ /**
1317
+ * Move the nodes at a location to a new location.
1318
+ */
1319
+ moveNodes: <T extends Node$1>(editor: Editor$1, options: {
1320
+ at?: Location;
1321
+ match?: NodeMatch<T>;
1322
+ mode?: MaximizeMode;
1323
+ to: Path$1;
1324
+ voids?: boolean;
1325
+ }) => void;
1326
+ /**
1327
+ * Remove the nodes at a specific location in the document.
1328
+ */
1329
+ removeNodes: <T extends Node$1>(editor: Editor$1, options?: {
1330
+ at?: Location;
1331
+ match?: NodeMatch<T>;
1332
+ mode?: RangeMode;
1333
+ hanging?: boolean;
1334
+ voids?: boolean;
1335
+ }) => void;
1336
+ /**
1337
+ * Split the nodes at a specific location.
1338
+ */
1339
+ splitNodes: <T extends Node$1>(editor: Editor$1, options?: {
1340
+ at?: Location;
1341
+ match?: NodeMatch<T>;
1342
+ mode?: RangeMode;
1343
+ always?: boolean;
1344
+ height?: number;
1345
+ voids?: boolean;
1346
+ }) => void;
1347
+ }
1348
+ declare const NodeTransforms: NodeTransforms;
1516
1349
  interface SelectionCollapseOptions {
1517
1350
  edge?: SelectionEdge;
1518
1351
  }
@@ -1522,9 +1355,6 @@ interface SelectionMoveOptions {
1522
1355
  reverse?: boolean;
1523
1356
  edge?: SelectionEdge;
1524
1357
  }
1525
- interface SelectionSetPointOptions {
1526
- edge?: SelectionEdge;
1527
- }
1528
1358
  interface SelectionTransforms {
1529
1359
  /**
1530
1360
  * Collapse the selection.
@@ -1542,10 +1372,6 @@ interface SelectionTransforms {
1542
1372
  * Set the selection to a new value.
1543
1373
  */
1544
1374
  select: (editor: Editor$1, target: Location) => void;
1545
- /**
1546
- * Set new properties on one of the selection's points.
1547
- */
1548
- setPoint: (editor: Editor$1, props: Partial<Point>, options?: SelectionSetPointOptions) => void;
1549
1375
  /**
1550
1376
  * Set new properties on the selection.
1551
1377
  */
@@ -1553,10 +1379,6 @@ interface SelectionTransforms {
1553
1379
  }
1554
1380
  declare const SelectionTransforms: SelectionTransforms;
1555
1381
  declare const Transforms: GeneralTransforms & NodeTransforms & SelectionTransforms & TextTransforms;
1556
- /**
1557
- * @public
1558
- */
1559
- type EditorSchema = Schema;
1560
1382
  type DecoratedRange = BaseRange & {
1561
1383
  rangeDecoration: RangeDecoration;
1562
1384
  };
@@ -1596,6 +1418,10 @@ declare class Key {
1596
1418
  id: string;
1597
1419
  constructor();
1598
1420
  }
1421
+ type Action = {
1422
+ at?: Point | Range;
1423
+ run: () => void;
1424
+ };
1599
1425
  /**
1600
1426
  * A DOM-specific version of the `Editor` interface.
1601
1427
  */
@@ -1605,10 +1431,35 @@ interface DOMEditor extends BaseEditor {
1605
1431
  hasSelectableTarget: (editor: Editor$1, target: EventTarget | null) => boolean;
1606
1432
  hasTarget: (editor: Editor$1, target: EventTarget | null) => target is DOMNode;
1607
1433
  insertData: (data: DataTransfer) => void;
1608
- insertFragmentData: (data: DataTransfer) => boolean;
1609
1434
  insertTextData: (data: DataTransfer) => boolean;
1610
1435
  isTargetInsideNonReadonlyVoid: (editor: Editor$1, target: EventTarget | null) => boolean;
1611
1436
  setFragmentData: (data: DataTransfer, originEvent?: 'drag' | 'copy' | 'cut') => void;
1437
+ isNodeMapDirty: boolean;
1438
+ domWindow: Window | null;
1439
+ domElement: HTMLElement | null;
1440
+ domPlaceholder: string;
1441
+ domPlaceholderElement: HTMLElement | null;
1442
+ keyToElement: WeakMap<Key, HTMLElement>;
1443
+ nodeToIndex: WeakMap<Node$1, number>;
1444
+ nodeToParent: WeakMap<Node$1, Ancestor>;
1445
+ elementToNode: WeakMap<HTMLElement, Node$1>;
1446
+ nodeToElement: WeakMap<Node$1, HTMLElement>;
1447
+ nodeToKey: WeakMap<Node$1, Key>;
1448
+ changeVersion: MutableRefObject<number>;
1449
+ readOnly: boolean;
1450
+ focused: boolean;
1451
+ composing: boolean;
1452
+ userSelection: RangeRef | null;
1453
+ onContextChange: ((options?: {
1454
+ operation?: Operation;
1455
+ }) => void) | null;
1456
+ scheduleFlush: (() => void) | null;
1457
+ pendingInsertionMarks: Partial<Text$1> | null;
1458
+ userMarks: Partial<Text$1> | null;
1459
+ pendingDiffs: TextDiff[];
1460
+ pendingAction: Action | null;
1461
+ pendingSelection: Range | null;
1462
+ forceRender: (() => void) | null;
1612
1463
  }
1613
1464
  interface DOMEditorInterface {
1614
1465
  /**
@@ -1675,18 +1526,6 @@ interface DOMEditorInterface {
1675
1526
  * Check if the target is in the editor.
1676
1527
  */
1677
1528
  hasTarget: (editor: Editor$1, target: EventTarget | null) => target is DOMNode;
1678
- /**
1679
- * Insert data from a `DataTransfer` into the editor.
1680
- */
1681
- insertData: (editor: Editor$1, data: DataTransfer) => void;
1682
- /**
1683
- * Insert fragment data from a `DataTransfer` into the editor.
1684
- */
1685
- insertFragmentData: (editor: Editor$1, data: DataTransfer) => boolean;
1686
- /**
1687
- * Insert text data from a `DataTransfer` into the editor.
1688
- */
1689
- insertTextData: (editor: Editor$1, data: DataTransfer) => boolean;
1690
1529
  /**
1691
1530
  * Check if the user is currently composing inside the editor.
1692
1531
  */
@@ -1749,6 +1588,46 @@ interface DOMEditorInterface {
1749
1588
  }) => T extends true ? Range | null : Range;
1750
1589
  }
1751
1590
  declare const DOMEditor: DOMEditorInterface;
1591
+ interface ChunkTree {
1592
+ type: 'root';
1593
+ children: ChunkDescendant[];
1594
+ /**
1595
+ * The keys of any Slate nodes that have been moved using move_node since the
1596
+ * last render
1597
+ *
1598
+ * Detecting when a node has been moved to a different position in the
1599
+ * children array is impossible to do efficiently while reconciling the chunk
1600
+ * tree. This interferes with the reconciliation logic since it is treated as
1601
+ * if the intermediate nodes were inserted and removed, causing them to be
1602
+ * re-chunked unnecessarily.
1603
+ *
1604
+ * This set is used to detect when a node has been moved so that this case
1605
+ * can be handled correctly and efficiently.
1606
+ */
1607
+ movedNodeKeys: Set<Key>;
1608
+ /**
1609
+ * The chunks whose descendants have been modified during the most recent
1610
+ * reconciliation
1611
+ *
1612
+ * Used to determine when the otherwise memoized React components for each
1613
+ * chunk should be re-rendered.
1614
+ */
1615
+ modifiedChunks: Set<Chunk>;
1616
+ }
1617
+ interface Chunk {
1618
+ type: 'chunk';
1619
+ key: Key;
1620
+ parent: ChunkAncestor;
1621
+ children: ChunkDescendant[];
1622
+ }
1623
+ interface ChunkLeaf {
1624
+ type: 'leaf';
1625
+ key: Key;
1626
+ node: Descendant;
1627
+ index: number;
1628
+ }
1629
+ type ChunkAncestor = ChunkTree | Chunk;
1630
+ type ChunkDescendant = Chunk | ChunkLeaf;
1752
1631
  /**
1753
1632
  * A React and DOM-specific version of the `Editor` interface.
1754
1633
  */
@@ -1759,15 +1638,15 @@ interface ReactEditor extends DOMEditor {
1759
1638
  * disabled.
1760
1639
  */
1761
1640
  getChunkSize: (node: Ancestor) => number | null;
1641
+ keyToChunkTree: WeakMap<Key, ChunkTree>;
1762
1642
  }
1763
1643
  interface ReactEditorInterface extends DOMEditorInterface {}
1764
1644
  declare const ReactEditor: ReactEditorInterface;
1765
- interface VoidElement {
1645
+ interface ObjectElement {
1766
1646
  _type: string;
1767
1647
  _key: string;
1768
1648
  children: Descendant[];
1769
- __inline: boolean;
1770
- value: Record<string, unknown>;
1649
+ [key: string]: unknown;
1771
1650
  }
1772
1651
  interface SlateTextBlock extends Omit<PortableTextTextBlock, 'children'> {
1773
1652
  children: Descendant[];
@@ -1775,7 +1654,8 @@ interface SlateTextBlock extends Omit<PortableTextTextBlock, 'children'> {
1775
1654
  declare module '../slate/index' {
1776
1655
  interface CustomTypes {
1777
1656
  Editor: BaseEditor & ReactEditor & PortableTextSlateEditor;
1778
- Element: SlateTextBlock | VoidElement;
1657
+ Element: SlateTextBlock | ObjectElement;
1658
+ ObjectNode: ObjectElement;
1779
1659
  Text: PortableTextSpan;
1780
1660
  }
1781
1661
  }
@@ -1800,6 +1680,8 @@ interface PortableTextSlateEditor extends ReactEditor {
1800
1680
  isTextBlock: (value: unknown) => value is PortableTextTextBlock;
1801
1681
  isTextSpan: (value: unknown) => value is PortableTextSpan;
1802
1682
  isListBlock: (value: unknown) => value is PortableTextListBlock;
1683
+ isObjectNode: (value: unknown) => boolean;
1684
+ schema: EditorSchema;
1803
1685
  decoratedRanges: Array<DecoratedRange>;
1804
1686
  decoratorState: Record<string, boolean | undefined>;
1805
1687
  blockIndexMap: Map<string, number>;
@@ -1809,7 +1691,6 @@ interface PortableTextSlateEditor extends ReactEditor {
1809
1691
  listIndexMap: Map<string, number>;
1810
1692
  remotePatches: Array<RemotePatch>;
1811
1693
  undoStepId: string | undefined;
1812
- value: Array<PortableTextBlock>;
1813
1694
  isDeferringMutations: boolean;
1814
1695
  isNormalizingNode: boolean;
1815
1696
  isPatching: boolean;
@@ -1996,7 +1877,7 @@ declare class PortableTextEditor {
1996
1877
  */
1997
1878
  static delete: (editor: PortableTextEditor, selection: EditorSelection, options?: EditableAPIDeleteOptions) => void;
1998
1879
  static findDOMNode: (editor: PortableTextEditor, element: PortableTextBlock | PortableTextChild) => Node | undefined;
1999
- static findByPath: (editor: PortableTextEditor, path: Path) => [_portabletext_schema5.PortableTextTextBlock<PortableTextObject | _portabletext_schema5.PortableTextSpan> | PortableTextObject | _portabletext_schema5.PortableTextSpan | undefined, Path | undefined];
1880
+ static findByPath: (editor: PortableTextEditor, path: Path) => [_portabletext_schema6.PortableTextTextBlock<PortableTextObject | _portabletext_schema6.PortableTextSpan> | PortableTextObject | _portabletext_schema6.PortableTextSpan | undefined, Path | undefined];
2000
1881
  /**
2001
1882
  * @deprecated
2002
1883
  * Use `editor.send(...)` instead
@@ -2334,7 +2215,7 @@ type PortableTextEditableProps = Omit<TextareaHTMLAttributes<HTMLDivElement>, 'o
2334
2215
  * ```
2335
2216
  * @group Components
2336
2217
  */
2337
- declare const PortableTextEditable: react10.ForwardRefExoticComponent<Omit<PortableTextEditableProps, "ref"> & react10.RefAttributes<Omit<HTMLDivElement, "as" | "onPaste" | "onBeforeInput">>>;
2218
+ declare const PortableTextEditable: react8.ForwardRefExoticComponent<Omit<PortableTextEditableProps, "ref"> & react8.RefAttributes<Omit<HTMLDivElement, "as" | "onPaste" | "onBeforeInput">>>;
2338
2219
  /** @beta */
2339
2220
  interface EditableAPIDeleteOptions {
2340
2221
  mode?: 'blocks' | 'children' | 'selected';
@@ -2391,8 +2272,8 @@ interface EditableAPI {
2391
2272
  isCollapsedSelection: () => boolean;
2392
2273
  isExpandedSelection: () => boolean;
2393
2274
  isMarkActive: (mark: string) => boolean;
2394
- isSelectionsOverlapping: (selectionA: EditorSelection, selectionB: EditorSelection) => boolean;
2395
2275
  isVoid: (element: PortableTextBlock | PortableTextChild) => boolean;
2276
+ isSelectionsOverlapping: (selectionA: EditorSelection, selectionB: EditorSelection) => boolean;
2396
2277
  marks: () => string[];
2397
2278
  redo: () => void;
2398
2279
  removeAnnotation: <TSchemaType extends {
@@ -2970,7 +2851,7 @@ declare const editorMachine: xstate73.StateMachine<{
2970
2851
  initialValue?: Array<PortableTextBlock>;
2971
2852
  }, xstate73.NonReducibleUnknown, InternalPatchEvent | MutationEvent | PatchesEvent | {
2972
2853
  type: "blurred";
2973
- event: react10.FocusEvent<HTMLDivElement, Element>;
2854
+ event: react8.FocusEvent<HTMLDivElement, Element>;
2974
2855
  } | {
2975
2856
  type: "done loading";
2976
2857
  } | {
@@ -2982,7 +2863,7 @@ declare const editorMachine: xstate73.StateMachine<{
2982
2863
  data: unknown;
2983
2864
  } | {
2984
2865
  type: "focused";
2985
- event: react10.FocusEvent<HTMLDivElement, Element>;
2866
+ event: react8.FocusEvent<HTMLDivElement, Element>;
2986
2867
  } | {
2987
2868
  type: "invalid value";
2988
2869
  resolution: InvalidValueResolution | null;
@@ -3467,18 +3348,6 @@ type EditorDom = {
3467
3348
  };
3468
3349
  }) => void;
3469
3350
  };
3470
- /**
3471
- * Callback for the `reconcile` action.
3472
- *
3473
- * Receives a fresh snapshot reflecting the editor state after all preceding
3474
- * actions in the same action set have been processed. Returns an array of
3475
- * actions that will be executed in the same undo step.
3476
- *
3477
- * @beta
3478
- */
3479
- type ReconcileCallback = (payload: {
3480
- snapshot: EditorSnapshot;
3481
- }) => Array<PickFromUnion<BehaviorAction, 'type', 'raise'> | PickFromUnion<BehaviorAction, 'type', 'execute'>>;
3482
3351
  /**
3483
3352
  * @beta
3484
3353
  */
@@ -3518,9 +3387,6 @@ type BehaviorAction = {
3518
3387
  */
3519
3388
  send: (event: ExternalBehaviorEvent) => void;
3520
3389
  }) => void;
3521
- } | {
3522
- type: 'reconcile';
3523
- reconcile: ReconcileCallback;
3524
3390
  };
3525
3391
  /**
3526
3392
  * Directly executes an event, bypassing all Behavior matching.
@@ -3655,39 +3521,6 @@ declare function raise(event: SyntheticBehaviorEvent | CustomBehaviorEvent): Pic
3655
3521
  * @beta
3656
3522
  */
3657
3523
  declare function effect(effect: PickFromUnion<BehaviorAction, 'type', 'effect'>['effect']): PickFromUnion<BehaviorAction, 'type', 'effect'>;
3658
- /**
3659
- * Reads a fresh snapshot after preceding actions and returns correction actions.
3660
- *
3661
- * Use `reconcile` when you need to inspect the editor state after a `forward`
3662
- * or other action has been processed, and then apply corrections based on the
3663
- * actual result. The corrections are applied in the same undo step as the
3664
- * preceding actions.
3665
- *
3666
- * The callback receives a fresh snapshot reflecting the current editor state
3667
- * and must return an array of `raise` or `execute` actions.
3668
- *
3669
- * @example
3670
- * ```ts
3671
- * // Forward text insertion, then fix marks based on actual state
3672
- * defineBehavior({
3673
- * on: 'insert.text',
3674
- * actions: [
3675
- * ({event}) => [
3676
- * forward(event),
3677
- * reconcile(({snapshot}) => {
3678
- * const block = selectors.getFocusTextBlock(snapshot)
3679
- * if (!block) return []
3680
- * // Compute corrections based on actual post-forward state
3681
- * return [raise({type: 'decorator.add', decorator: 'strong', at: range})]
3682
- * }),
3683
- * ],
3684
- * ],
3685
- * })
3686
- * ```
3687
- *
3688
- * @beta
3689
- */
3690
- declare function reconcile(reconcile: ReconcileCallback): PickFromUnion<BehaviorAction, 'type', 'reconcile'>;
3691
3524
  /**
3692
3525
  * @beta
3693
3526
  */
@@ -3696,5 +3529,5 @@ type BehaviorActionSet<TBehaviorEvent, TGuardResponse> = (payload: {
3696
3529
  event: TBehaviorEvent;
3697
3530
  dom: EditorDom;
3698
3531
  }, guardResponse: TGuardResponse) => Array<BehaviorAction>;
3699
- export { EditorSnapshot as $, PortableTextObject$1 as A, PortableTextEditor as At, usePortableTextEditorSelection as B, InlineObjectDefinition as C, RenderListItemFunction as Ct, Patch$1 as D, PortableTextEditable as Dt, ListSchemaType$1 as E, ScrollSelectionIntoViewFunction as Et, StyleSchemaType$1 as F, BlockPath as Ft, EditorProviderProps as G, EditorSelector as H, defineSchema as I, ChildPath as It, EditorEvent as J, Editor as K, BlockOffset as L, KeyedSegment as Lt, PortableTextTextBlock$1 as M, MutationEvent as Mt, SchemaDefinition$1 as N, EditorSchema as Nt, PortableTextBlock$1 as O, PortableTextEditableProps as Ot, StyleDefinition as P, AnnotationPath as Pt, EditorContext as Q, useEditor as R, Path as Rt, FieldDefinition as S, RenderEditableFunction as St, ListDefinition as T, RenderStyleFunction as Tt, useEditorSelector as U, usePortableTextEditor as V, EditorProvider as W, defineBehavior as X, Behavior as Y, BehaviorGuard as Z, BaseDefinition as _, RangeDecorationOnMovedDetails as _t, execute as a, BlockRenderProps as at, DecoratorDefinition as b, RenderChildFunction as bt, reconcile as c, EditorSelection as ct, InsertPlacement as d, OnCopyFn as dt, AddedAnnotationPaths as et, NativeBehaviorEvent as f, OnPasteFn as ft, AnnotationSchemaType$1 as g, RangeDecoration as gt, AnnotationDefinition as h, PasteData as ht, effect as i, BlockListItemRenderProps as it, PortableTextSpan$1 as j, EditorEmittedEvent as jt, PortableTextChild$1 as k, HotkeyOptions as kt, BehaviorEvent as l, EditorSelectionPoint as lt, PatchesEvent as m, OnPasteResultOrPromise as mt, BehaviorActionSet as n, BlockChildRenderProps as nt, forward as o, BlockStyleRenderProps as ot, SyntheticBehaviorEvent as p, OnPasteResult as pt, EditorConfig as q, ReconcileCallback as r, BlockDecoratorRenderProps as rt, raise as s, EditableAPIDeleteOptions as st, BehaviorAction as t, BlockAnnotationRenderProps as tt, CustomBehaviorEvent as u, InvalidValueResolution as ut, BlockObjectDefinition as v, RenderAnnotationFunction as vt, InlineObjectSchemaType$1 as w, RenderPlaceholderFunction as wt, DecoratorSchemaType$1 as x, RenderDecoratorFunction as xt, BlockObjectSchemaType$1 as y, RenderBlockFunction as yt, defaultKeyGenerator as z };
3532
+ export { BlockAnnotationRenderProps as $, PortableTextTextBlock$1 as A, MutationEvent as At, EditorSelector as B, ListDefinition as C, RenderStyleFunction as Ct, PortableTextChild$1 as D, HotkeyOptions as Dt, PortableTextBlock$1 as E, PortableTextEditableProps as Et, BlockOffset as F, KeyedSegment as Ft, EditorConfig as G, EditorProvider as H, useEditor as I, Path as It, defineBehavior as J, EditorEvent as K, defaultKeyGenerator as L, StyleDefinition as M, AnnotationPath as Mt, StyleSchemaType$1 as N, BlockPath as Nt, PortableTextObject$1 as O, PortableTextEditor as Ot, defineSchema as P, ChildPath as Pt, AddedAnnotationPaths as Q, usePortableTextEditorSelection as R, InlineObjectSchemaType$1 as S, RenderPlaceholderFunction as St, Patch$1 as T, PortableTextEditable as Tt, EditorProviderProps as U, useEditorSelector as V, Editor as W, EditorContext as X, BehaviorGuard as Y, EditorSnapshot as Z, BlockObjectSchemaType$1 as _, RenderBlockFunction as _t, forward as a, EditableAPIDeleteOptions as at, FieldDefinition as b, RenderEditableFunction as bt, CustomBehaviorEvent as c, InvalidValueResolution as ct, SyntheticBehaviorEvent as d, OnPasteResult as dt, BlockChildRenderProps as et, PatchesEvent as f, OnPasteResultOrPromise as ft, BlockObjectDefinition as g, RenderAnnotationFunction as gt, BaseDefinition as h, RangeDecorationOnMovedDetails as ht, execute as i, BlockStyleRenderProps as it, SchemaDefinition$1 as j, EditorSchema as jt, PortableTextSpan$1 as k, EditorEmittedEvent as kt, InsertPlacement as l, OnCopyFn as lt, AnnotationSchemaType$1 as m, RangeDecoration as mt, BehaviorActionSet as n, BlockListItemRenderProps as nt, raise as o, EditorSelection as ot, AnnotationDefinition as p, PasteData as pt, Behavior as q, effect as r, BlockRenderProps as rt, BehaviorEvent as s, EditorSelectionPoint as st, BehaviorAction as t, BlockDecoratorRenderProps as tt, NativeBehaviorEvent as u, OnPasteFn as ut, DecoratorDefinition as v, RenderChildFunction as vt, ListSchemaType$1 as w, ScrollSelectionIntoViewFunction as wt, InlineObjectDefinition as x, RenderListItemFunction as xt, DecoratorSchemaType$1 as y, RenderDecoratorFunction as yt, usePortableTextEditor as z };
3700
3533
  //# sourceMappingURL=behavior.types.action.d.ts.map