@portabletext/editor 6.3.2 → 6.4.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.
@@ -2,7 +2,7 @@ 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 react8 from "react";
5
+ import * as react4 from "react";
6
6
  import React$1, { BaseSyntheticEvent, ClipboardEvent as ClipboardEvent$1, FocusEvent, JSX, PropsWithChildren, ReactElement, RefObject, TextareaHTMLAttributes } from "react";
7
7
  import { Patch, Patch as Patch$1 } from "@portabletext/patches";
8
8
  type MIMEType = `${string}/${string}`;
@@ -106,161 +106,80 @@ type ChildPath = [{
106
106
  }, 'children', {
107
107
  _key: string;
108
108
  }];
109
- /**
110
- * @public
111
- */
112
- type EditorSchema = Schema;
113
- /**
114
- * The `Editor` interface stores all the state of a Slate editor. It is extended
115
- * by plugins that wish to add their own helpers and implement new behaviors.
116
- */
117
- interface BaseEditor {
109
+ interface ObjectElement {
110
+ _type: string;
111
+ _key: string;
118
112
  children: Descendant[];
119
- selection: Selection$1;
120
- operations: Operation[];
121
- marks: EditorMarks | null;
122
- dirtyPaths: Path$1[];
123
- dirtyPathKeys: Set<string>;
124
- flushing: boolean;
125
- normalizing: boolean;
126
- batchingDirtyPaths: boolean;
127
- pathRefs: Set<PathRef>;
128
- pointRefs: Set<PointRef>;
129
- rangeRefs: Set<RangeRef>;
130
- apply: (operation: Operation) => void;
131
- createSpan: () => Text$1;
132
- getDirtyPaths: (operation: Operation) => Path$1[];
133
- isElementReadOnly: (element: Element$1) => boolean;
134
- isInline: (element: Element$1) => boolean;
135
- isSelectable: (element: Element$1) => boolean;
136
- normalizeNode: (entry: NodeEntry, options?: {
137
- operation?: Operation;
138
- }) => void;
139
- onChange: (options?: {
140
- operation?: Operation;
141
- }) => void;
142
- shouldNormalize: ({
143
- iteration,
144
- dirtyPaths,
145
- operation
146
- }: {
147
- iteration: number;
148
- initialDirtyPathsLength: number;
149
- dirtyPaths: Path$1[];
150
- operation?: Operation;
151
- }) => boolean;
152
- select: (target: Location) => void;
153
- setSelection: (props: Partial<Range>) => void;
154
- }
155
- type Editor$1 = ExtendedType<'Editor', BaseEditor>;
156
- type BaseSelection = Range | null;
157
- type Selection$1 = ExtendedType<'Selection', BaseSelection>;
158
- type EditorMarks = Omit<Text$1, 'text'>;
159
- interface EditorInterface {
160
- isElementReadOnly: (editor: Editor$1, element: Element$1) => boolean;
161
- isInline: (editor: Editor$1, value: Element$1) => boolean;
162
- isSelectable: (editor: Editor$1, element: Element$1) => boolean;
113
+ [key: string]: unknown;
163
114
  }
164
- declare const Editor$1: EditorInterface;
165
- /**
166
- * `Element` objects are a type of node in a Slate document that contain other
167
- * element nodes or text nodes. They can be either "blocks" or "inlines"
168
- * depending on the Slate editor's configuration.
169
- */
170
- interface BaseElement {
115
+ interface SlateTextBlock extends Omit<PortableTextTextBlock, 'children'> {
171
116
  children: Descendant[];
172
117
  }
173
- type Element$1 = ExtendedType<'Element', BaseElement>;
174
- interface ElementInterface {
175
- /**
176
- * Check if a value implements the 'Ancestor' interface.
177
- */
178
- isAncestor: (value: any, schema: EditorSchema) => value is Ancestor;
179
- /**
180
- * Check if a value implements the `Element` interface.
181
- */
182
- isElement: (value: any, schema: EditorSchema) => value is Element$1;
183
- }
184
- declare const Element$1: ElementInterface;
185
118
  /**
186
- * The `Location` interface is a union of the ways to refer to a specific
187
- * location in a Slate document: paths, points or ranges.
188
- *
189
- * Methods will often accept a `Location` instead of requiring only a `Path`,
190
- * `Point` or `Range`. This eliminates the need for developers to manage
191
- * converting between the different interfaces in their own code base.
119
+ * @public
192
120
  */
193
- type Location = Path$1 | Point | Range;
121
+ type EditorSchema = Schema;
194
122
  /**
195
- * Extendable Custom Types Interface
123
+ * `Path` arrays are a list of indexes that describe a node's exact position in
124
+ * a Slate node tree. Although they are usually relative to the root `Editor`
125
+ * object, they can be relative to any `Node` object.
196
126
  */
197
- type ExtendableTypes = 'Editor' | 'Element' | 'ObjectNode' | 'Text' | 'Selection' | 'Range' | 'Point' | 'Operation' | 'InsertNodeOperation' | 'InsertTextOperation' | 'RemoveNodeOperation' | 'RemoveTextOperation' | 'SetNodeOperation' | 'SetSelectionOperation';
198
- interface CustomTypes {
199
- [key: string]: unknown;
200
- }
201
- type ExtendedType<K$1 extends ExtendableTypes, B> = unknown extends CustomTypes[K$1] ? B : CustomTypes[K$1];
127
+ type Path$1 = number[];
128
+ type TextDirection = 'forward' | 'backward';
202
129
  /**
203
- * `ObjectNode` represents a node with semantic content but no children or text.
204
- * Block objects and inline objects are ObjectNodes in the tree.
130
+ * `Point` objects refer to a specific location in a text node in a Slate
131
+ * document. Its path refers to the location of the node in the tree, and its
132
+ * offset refers to the distance into the node's string of text. Points can
133
+ * only refer to `Text` nodes.
205
134
  */
206
- interface BaseObjectNode {
207
- _type: string;
208
- _key: string;
209
- [key: string]: unknown;
135
+ interface BasePoint {
136
+ path: number[];
137
+ offset: number;
210
138
  }
211
- type ObjectNode = ExtendedType<'ObjectNode', BaseObjectNode>;
212
- type Node$1 = Editor$1 | Element$1 | ObjectNode | Text$1;
139
+ type Point = BasePoint;
213
140
  /**
214
- * The `Descendant` union type represents nodes that are descendants in the
215
- * tree. It is returned as a convenience in certain cases to narrow a value
216
- * further than the more generic `Node` union.
217
- */
218
- type Descendant = Element$1 | ObjectNode | Text$1;
219
- /**
220
- * The `Ancestor` union type represents nodes that are ancestors in the tree.
221
- * It is returned as a convenience in certain cases to narrow a value further
222
- * than the more generic `Node` union.
223
- */
224
- type Ancestor = Editor$1 | Element$1;
225
- /**
226
- * `NodeEntry` objects are returned when iterating over the nodes in a Slate
227
- * document tree. They consist of the node and its `Path` relative to the root
228
- * node in the document.
141
+ * `Range` objects are a set of points that refer to a specific span of a Slate
142
+ * document. They can define a span inside a single node or a can span across
143
+ * multiple nodes.
229
144
  */
230
- type NodeEntry<T extends Node$1 = Node$1> = [T, Path$1];
145
+ interface BaseRange {
146
+ anchor: Point;
147
+ focus: Point;
148
+ }
149
+ type Range = BaseRange;
231
150
  type BaseInsertNodeOperation = {
232
151
  type: 'insert_node';
233
152
  path: Path$1;
234
153
  node: Node$1;
235
154
  };
236
- type InsertNodeOperation = ExtendedType<'InsertNodeOperation', BaseInsertNodeOperation>;
155
+ type InsertNodeOperation = BaseInsertNodeOperation;
237
156
  type BaseInsertTextOperation = {
238
157
  type: 'insert_text';
239
158
  path: Path$1;
240
159
  offset: number;
241
160
  text: string;
242
161
  };
243
- type InsertTextOperation = ExtendedType<'InsertTextOperation', BaseInsertTextOperation>;
162
+ type InsertTextOperation = BaseInsertTextOperation;
244
163
  type BaseRemoveNodeOperation = {
245
164
  type: 'remove_node';
246
165
  path: Path$1;
247
166
  node: Node$1;
248
167
  };
249
- type RemoveNodeOperation = ExtendedType<'RemoveNodeOperation', BaseRemoveNodeOperation>;
168
+ type RemoveNodeOperation = BaseRemoveNodeOperation;
250
169
  type BaseRemoveTextOperation = {
251
170
  type: 'remove_text';
252
171
  path: Path$1;
253
172
  offset: number;
254
173
  text: string;
255
174
  };
256
- type RemoveTextOperation = ExtendedType<'RemoveTextOperation', BaseRemoveTextOperation>;
175
+ type RemoveTextOperation = BaseRemoveTextOperation;
257
176
  type BaseSetNodeOperation = {
258
177
  type: 'set_node';
259
178
  path: Path$1;
260
179
  properties: Partial<Node$1>;
261
180
  newProperties: Partial<Node$1>;
262
181
  };
263
- type SetNodeOperation = ExtendedType<'SetNodeOperation', BaseSetNodeOperation>;
182
+ type SetNodeOperation = BaseSetNodeOperation;
264
183
  type BaseSetSelectionOperation = {
265
184
  type: 'set_selection';
266
185
  properties: null;
@@ -274,221 +193,12 @@ type BaseSetSelectionOperation = {
274
193
  properties: Range;
275
194
  newProperties: null;
276
195
  };
277
- type SetSelectionOperation = ExtendedType<'SetSelectionOperation', BaseSetSelectionOperation>;
278
- type NodeOperation = InsertNodeOperation | RemoveNodeOperation | SetNodeOperation;
279
- type SelectionOperation = SetSelectionOperation;
280
- type TextOperation = InsertTextOperation | RemoveTextOperation;
281
- /**
282
- * `Operation` objects define the low-level instructions that Slate editors use
283
- * to apply changes to their internal state. Representing all changes as
284
- * operations is what allows Slate editors to easily implement history,
285
- * collaboration, and other features.
286
- */
287
- type BaseOperation = NodeOperation | SelectionOperation | TextOperation;
288
- type Operation = ExtendedType<'Operation', BaseOperation>;
289
- interface OperationInterface {
290
- /**
291
- * Check if a value is an `Operation` object.
292
- */
293
- isOperation: (value: any) => value is Operation;
294
- /**
295
- * Check if a value is a list of `Operation` objects.
296
- */
297
- isOperationList: (value: any) => value is Operation[];
298
- /**
299
- * Invert an operation, returning a new operation that will exactly undo the
300
- * original when applied.
301
- */
302
- inverse: (op: Operation) => Operation;
303
- }
304
- declare const Operation: OperationInterface;
305
- /**
306
- * `PathRef` objects keep a specific path in a document synced over time as new
307
- * operations are applied to the editor. You can access their `current` property
308
- * at any time for the up-to-date path value.
309
- */
310
- interface PathRef {
311
- current: Path$1 | null;
312
- affinity: 'forward' | 'backward' | null;
313
- unref(): Path$1 | null;
314
- }
315
- interface PathRefInterface {
316
- /**
317
- * Transform the path ref's current value by an operation.
318
- */
319
- transform: (ref: PathRef, op: Operation) => void;
320
- }
321
- declare const PathRef: PathRefInterface;
322
- /**
323
- * `Path` arrays are a list of indexes that describe a node's exact position in
324
- * a Slate node tree. Although they are usually relative to the root `Editor`
325
- * object, they can be relative to any `Node` object.
326
- */
327
- type Path$1 = number[];
328
- interface PathAncestorsOptions {
329
- reverse?: boolean;
330
- }
331
- interface PathLevelsOptions {
332
- reverse?: boolean;
333
- }
334
- interface PathInterface {
335
- /**
336
- * Get a list of ancestor paths for a given path.
337
- *
338
- * The paths are sorted from shallowest to deepest ancestor. However, if the
339
- * `reverse: true` option is passed, they are reversed.
340
- */
341
- ancestors: (path: Path$1, options?: PathAncestorsOptions) => Path$1[];
342
- /**
343
- * Get the common ancestor path of two paths.
344
- */
345
- common: (path: Path$1, another: Path$1) => Path$1;
346
- /**
347
- * Compare a path to another, returning an integer indicating whether the path
348
- * was before, at, or after the other.
349
- *
350
- * Note: Two paths of unequal length can still receive a `0` result if one is
351
- * directly above or below the other. If you want exact matching, use
352
- * [[Path.equals]] instead.
353
- */
354
- compare: (path: Path$1, another: Path$1) => -1 | 0 | 1;
355
- /**
356
- * Check if a path ends before one of the indexes in another.
357
- */
358
- endsBefore: (path: Path$1, another: Path$1) => boolean;
359
- /**
360
- * Check if a path is exactly equal to another.
361
- */
362
- equals: (path: Path$1, another: Path$1) => boolean;
363
- /**
364
- * Check if the path of previous sibling node exists
365
- */
366
- hasPrevious: (path: Path$1) => boolean;
367
- /**
368
- * Check if a path is after another.
369
- */
370
- isAfter: (path: Path$1, another: Path$1) => boolean;
371
- /**
372
- * Check if a path is an ancestor of another.
373
- */
374
- isAncestor: (path: Path$1, another: Path$1) => boolean;
375
- /**
376
- * Check if a path is before another.
377
- */
378
- isBefore: (path: Path$1, another: Path$1) => boolean;
379
- /**
380
- * Check if a path is equal to or an ancestor of another.
381
- */
382
- isCommon: (path: Path$1, another: Path$1) => boolean;
383
- /**
384
- * Check if a path is a descendant of another.
385
- */
386
- isDescendant: (path: Path$1, another: Path$1) => boolean;
387
- /**
388
- * Check is a value implements the `Path` interface.
389
- */
390
- isPath: (value: any) => value is Path$1;
391
- /**
392
- * Check if a path is a sibling of another.
393
- */
394
- isSibling: (path: Path$1, another: Path$1) => boolean;
395
- /**
396
- * Get a list of paths at every level down to a path. Note: this is the same
397
- * as `Path.ancestors`, but including the path itself.
398
- *
399
- * The paths are sorted from shallowest to deepest. However, if the `reverse:
400
- * true` option is passed, they are reversed.
401
- */
402
- levels: (path: Path$1, options?: PathLevelsOptions) => Path$1[];
403
- /**
404
- * Given a path, get the path to the next sibling node.
405
- */
406
- next: (path: Path$1) => Path$1;
407
- /**
408
- * Returns whether this operation can affect paths or not. Used as an
409
- * optimization when updating dirty paths during normalization.
410
- */
411
- operationCanTransformPath: (operation: Operation) => operation is InsertNodeOperation | RemoveNodeOperation;
412
- /**
413
- * Given a path, return a new path referring to the parent node above it.
414
- */
415
- parent: (path: Path$1) => Path$1;
416
- /**
417
- * Given a path, get the path to the previous sibling node.
418
- */
419
- previous: (path: Path$1) => Path$1;
420
- /**
421
- * Transform a path by an operation.
422
- */
423
- transform: (path: Path$1, operation: Operation) => Path$1 | null;
424
- }
425
- declare const Path$1: PathInterface;
426
- type RangeDirection = TextDirection | 'outward' | 'inward';
427
- type TextDirection = 'forward' | 'backward';
428
- /**
429
- * `PointRef` objects keep a specific point in a document synced over time as new
430
- * operations are applied to the editor. You can access their `current` property
431
- * at any time for the up-to-date point value.
432
- */
433
- interface PointRef {
434
- current: Point | null;
435
- affinity: TextDirection | null;
436
- unref(): Point | null;
437
- }
438
- interface PointRefInterface {
439
- /**
440
- * Transform the point ref's current value by an operation.
441
- */
442
- transform: (ref: PointRef, op: Operation) => void;
443
- }
444
- declare const PointRef: PointRefInterface;
445
- /**
446
- * `Point` objects refer to a specific location in a text node in a Slate
447
- * document. Its path refers to the location of the node in the tree, and its
448
- * offset refers to the distance into the node's string of text. Points can
449
- * only refer to `Text` nodes.
450
- */
451
- interface BasePoint {
452
- path: Path$1;
453
- offset: number;
454
- }
455
- type Point = ExtendedType<'Point', BasePoint>;
456
- interface PointTransformOptions {
457
- affinity?: TextDirection | null;
458
- }
459
- interface PointInterface {
460
- /**
461
- * Compare a point to another, returning an integer indicating whether the
462
- * point was before, at, or after the other.
463
- */
464
- compare: (point: Point, another: Point) => -1 | 0 | 1;
465
- /**
466
- * Check if a point is after another.
467
- */
468
- isAfter: (point: Point, another: Point) => boolean;
469
- /**
470
- * Check if a point is before another.
471
- */
472
- isBefore: (point: Point, another: Point) => boolean;
473
- /**
474
- * Check if a point is exactly equal to another.
475
- */
476
- equals: (point: Point, another: Point) => boolean;
477
- /**
478
- * Check if a value implements the `Point` interface.
479
- */
480
- isPoint: (value: any) => value is Point;
481
- /**
482
- * Transform a point by an operation.
483
- */
484
- transform: (point: Point, op: Operation, options?: PointTransformOptions) => Point | null;
485
- }
486
- declare const Point: PointInterface;
487
- /**
488
- * `PointEntry` objects are returned when iterating over `Point` objects that
489
- * belong to a range.
490
- */
491
- type PointEntry = [Point, 'anchor' | 'focus'];
196
+ type SetSelectionOperation = BaseSetSelectionOperation;
197
+ type BaseOperation = InsertNodeOperation | RemoveNodeOperation | SetNodeOperation | SetSelectionOperation | InsertTextOperation | RemoveTextOperation;
198
+ type Operation = BaseOperation;
199
+ type DecoratedRange = BaseRange & {
200
+ rangeDecoration: RangeDecoration;
201
+ };
492
202
  /**
493
203
  * `RangeRef` objects keep a specific range in a document synced over time as new
494
204
  * operations are applied to the editor. You can access their `current` property
@@ -499,140 +209,7 @@ interface RangeRef {
499
209
  affinity: 'forward' | 'backward' | 'outward' | 'inward' | null;
500
210
  unref(): Range | null;
501
211
  }
502
- interface RangeRefInterface {
503
- /**
504
- * Transform the range ref's current value by an operation.
505
- */
506
- transform: (ref: RangeRef, op: Operation) => void;
507
- }
508
- declare const RangeRef: RangeRefInterface;
509
- /**
510
- * `Range` objects are a set of points that refer to a specific span of a Slate
511
- * document. They can define a span inside a single node or a can span across
512
- * multiple nodes.
513
- */
514
- interface BaseRange {
515
- anchor: Point;
516
- focus: Point;
517
- }
518
- type Range = ExtendedType<'Range', BaseRange>;
519
- interface RangeEdgesOptions {
520
- reverse?: boolean;
521
- }
522
- interface RangeTransformOptions {
523
- affinity?: RangeDirection | null;
524
- }
525
- interface RangeInterface {
526
- /**
527
- * Get the start and end points of a range, in the order in which they appear
528
- * in the document.
529
- */
530
- edges: (range: Range, options?: RangeEdgesOptions) => [Point, Point];
531
- /**
532
- * Get the end point of a range.
533
- */
534
- end: (range: Range) => Point;
535
- /**
536
- * Check if a range is exactly equal to another.
537
- */
538
- equals: (range: Range, another: Range) => boolean;
539
- /**
540
- * Check if a range includes a path, a point or part of another range.
541
- */
542
- includes: (range: Range, target: Path$1 | Point | Range) => boolean;
543
- /**
544
- * Get the intersection of a range with another.
545
- */
546
- intersection: (range: Range, another: Range) => Range | null;
547
- /**
548
- * Check if a range is backward, meaning that its anchor point appears in the
549
- * document _after_ its focus point.
550
- */
551
- isBackward: (range: Range) => boolean;
552
- /**
553
- * Check if a range is collapsed, meaning that both its anchor and focus
554
- * points refer to the exact same position in the document.
555
- */
556
- isCollapsed: (range: Range) => boolean;
557
- /**
558
- * Check if a range is expanded.
559
- *
560
- * This is the opposite of [[Range.isCollapsed]] and is provided for legibility.
561
- */
562
- isExpanded: (range: Range) => boolean;
563
- /**
564
- * Check if a range is forward.
565
- *
566
- * This is the opposite of [[Range.isBackward]] and is provided for legibility.
567
- */
568
- isForward: (range: Range) => boolean;
569
- /**
570
- * Check if a value implements the [[Range]] interface.
571
- */
572
- isRange: (value: any) => value is Range;
573
- /**
574
- * Iterate through all of the point entries in a range.
575
- */
576
- points: (range: Range) => Generator<PointEntry, void, undefined>;
577
- /**
578
- * Get the start point of a range.
579
- */
580
- start: (range: Range) => Point;
581
- /**
582
- * Transform a range by an operation.
583
- */
584
- transform: (range: Range, op: Operation, options?: RangeTransformOptions) => Range | null;
585
- }
586
- declare const Range: RangeInterface;
587
- /**
588
- * `Text` objects represent the nodes that contain the actual text content of a
589
- * Slate document along with any formatting properties. They are always leaf
590
- * nodes in the document tree as they cannot contain any children.
591
- */
592
- interface BaseText {
593
- text: string;
594
- }
595
- type Text$1 = ExtendedType<'Text', BaseText>;
596
- interface LeafPosition {
597
- start: number;
598
- end: number;
599
- isFirst?: true;
600
- isLast?: true;
601
- }
602
- interface TextEqualsOptions {
603
- loose?: boolean;
604
- }
605
- type DecoratedRange$1 = Range & {
606
- /**
607
- * Customize how another decoration is merged into a text node. If not specified, `Object.assign` would be used.
608
- * It is useful for overlapping decorations with the same key but different values.
609
- */
610
- merge?: (leaf: Text$1, decoration: object) => void;
611
- };
612
- interface TextInterface {
613
- /**
614
- * Check if two text nodes are equal.
615
- *
616
- * When loose is set, the text is not compared. This is
617
- * used to check whether sibling text nodes can be merged.
618
- */
619
- equals: (text: Text$1, another: Text$1, options?: TextEqualsOptions) => boolean;
620
- /**
621
- * Check if a value implements the `Text` interface.
622
- */
623
- isText: (value: any, schema: EditorSchema) => value is Text$1;
624
- /**
625
- * Get the leaves for a text node given decorations.
626
- */
627
- decorations: (node: Text$1, decorations: DecoratedRange$1[]) => {
628
- leaf: Text$1;
629
- position?: LeafPosition;
630
- }[];
631
- }
632
- declare const Text$1: TextInterface;
633
- type DecoratedRange = BaseRange & {
634
- rangeDecoration: RangeDecoration;
635
- };
212
+ type Text$1 = PortableTextSpan;
636
213
  type StringDiff = {
637
214
  start: number;
638
215
  end: number;
@@ -821,24 +398,6 @@ declare const DOMEditor: DOMEditorInterface;
821
398
  interface ReactEditor extends DOMEditor {}
822
399
  interface ReactEditorInterface extends DOMEditorInterface {}
823
400
  declare const ReactEditor: ReactEditorInterface;
824
- interface ObjectElement {
825
- _type: string;
826
- _key: string;
827
- children: Descendant[];
828
- [key: string]: unknown;
829
- }
830
- interface SlateTextBlock extends Omit<PortableTextTextBlock, 'children'> {
831
- children: Descendant[];
832
- }
833
- declare module '../slate/index' {
834
- interface CustomTypes {
835
- Editor: BaseEditor & ReactEditor & PortableTextSlateEditor;
836
- Element: SlateTextBlock | ObjectElement;
837
- ObjectNode: ObjectElement;
838
- Text: PortableTextSpan;
839
- }
840
- }
841
- //# sourceMappingURL=slate.d.ts.map
842
401
  type HistoryItem = {
843
402
  operations: Operation[];
844
403
  timestamp: Date;
@@ -879,6 +438,114 @@ interface PortableTextSlateEditor extends ReactEditor {
879
438
  isUndoing: boolean;
880
439
  withHistory: boolean;
881
440
  }
441
+ type Element$1 = SlateTextBlock | ObjectElement;
442
+ /**
443
+ * The `Location` interface is a union of the ways to refer to a specific
444
+ * location in a Slate document: paths, points or ranges.
445
+ *
446
+ * Methods will often accept a `Location` instead of requiring only a `Path`,
447
+ * `Point` or `Range`. This eliminates the need for developers to manage
448
+ * converting between the different interfaces in their own code base.
449
+ */
450
+ type Location = Path$1 | Point | Range;
451
+ /**
452
+ * `PathRef` objects keep a specific path in a document synced over time as new
453
+ * operations are applied to the editor. You can access their `current` property
454
+ * at any time for the up-to-date path value.
455
+ */
456
+ interface PathRef {
457
+ current: Path$1 | null;
458
+ affinity: 'forward' | 'backward' | null;
459
+ unref(): Path$1 | null;
460
+ }
461
+ interface PathRefInterface {
462
+ transform: (ref: PathRef, op: Operation) => void;
463
+ }
464
+ declare const PathRef: PathRefInterface;
465
+ /**
466
+ * `PointRef` objects keep a specific point in a document synced over time as new
467
+ * operations are applied to the editor. You can access their `current` property
468
+ * at any time for the up-to-date point value.
469
+ */
470
+ interface PointRef {
471
+ current: Point | null;
472
+ affinity: TextDirection | null;
473
+ unref(): Point | null;
474
+ }
475
+ interface PointRefInterface {
476
+ transform: (ref: PointRef, op: Operation) => void;
477
+ }
478
+ declare const PointRef: PointRefInterface;
479
+ /**
480
+ * The `Editor` interface stores all the state of a Slate editor. It is extended
481
+ * by plugins that wish to add their own helpers and implement new behaviors.
482
+ */
483
+ interface BaseEditor {
484
+ children: Descendant[];
485
+ selection: Selection$1;
486
+ operations: Operation[];
487
+ marks: EditorMarks | null;
488
+ dirtyPaths: Path$1[];
489
+ dirtyPathKeys: Set<string>;
490
+ flushing: boolean;
491
+ normalizing: boolean;
492
+ batchingDirtyPaths: boolean;
493
+ pathRefs: Set<PathRef>;
494
+ pointRefs: Set<PointRef>;
495
+ rangeRefs: Set<RangeRef>;
496
+ apply: (operation: Operation) => void;
497
+ createSpan: () => Text$1;
498
+ getDirtyPaths: (operation: Operation) => Path$1[];
499
+ isElementReadOnly: (element: Element$1) => boolean;
500
+ isInline: (element: Element$1) => boolean;
501
+ isSelectable: (element: Element$1) => boolean;
502
+ normalizeNode: (entry: NodeEntry, options?: {
503
+ operation?: Operation;
504
+ }) => void;
505
+ onChange: (options?: {
506
+ operation?: Operation;
507
+ }) => void;
508
+ shouldNormalize: ({
509
+ iteration,
510
+ dirtyPaths,
511
+ operation
512
+ }: {
513
+ iteration: number;
514
+ initialDirtyPathsLength: number;
515
+ dirtyPaths: Path$1[];
516
+ operation?: Operation;
517
+ }) => boolean;
518
+ select: (target: Location) => void;
519
+ setSelection: (props: Partial<Range>) => void;
520
+ }
521
+ type Editor$1 = BaseEditor & ReactEditor & PortableTextSlateEditor;
522
+ type BaseSelection = Range | null;
523
+ type Selection$1 = BaseSelection;
524
+ type EditorMarks = Omit<Text$1, 'text'>;
525
+ type ObjectNode = ObjectElement;
526
+ /**
527
+ * The `Node` union type represents all of the different types of nodes that
528
+ * occur in a Slate document tree.
529
+ */
530
+ type Node$1 = Editor$1 | Element$1 | ObjectNode | Text$1;
531
+ /**
532
+ * The `Descendant` union type represents nodes that are descendants in the
533
+ * tree. It is returned as a convenience in certain cases to narrow a value
534
+ * further than the more generic `Node` union.
535
+ */
536
+ type Descendant = Element$1 | ObjectNode | Text$1;
537
+ /**
538
+ * The `Ancestor` union type represents nodes that are ancestors in the tree.
539
+ * It is returned as a convenience in certain cases to narrow a value further
540
+ * than the more generic `Node` union.
541
+ */
542
+ type Ancestor = Editor$1 | Element$1;
543
+ /**
544
+ * `NodeEntry` objects are returned when iterating over the nodes in a Slate
545
+ * document tree. They consist of the node and its `Path` relative to the root
546
+ * node in the document.
547
+ */
548
+ type NodeEntry<T extends Node$1 = Node$1> = [T, Path$1];
882
549
  /**
883
550
  * @public
884
551
  */
@@ -1386,7 +1053,7 @@ type PortableTextEditableProps = Omit<TextareaHTMLAttributes<HTMLDivElement>, 'o
1386
1053
  * ```
1387
1054
  * @group Components
1388
1055
  */
1389
- declare const PortableTextEditable: react8.ForwardRefExoticComponent<Omit<PortableTextEditableProps, "ref"> & react8.RefAttributes<Omit<HTMLDivElement, "as" | "onPaste" | "onBeforeInput">>>;
1056
+ declare const PortableTextEditable: react4.ForwardRefExoticComponent<Omit<PortableTextEditableProps, "ref"> & react4.RefAttributes<Omit<HTMLDivElement, "as" | "onPaste" | "onBeforeInput">>>;
1390
1057
  /** @beta */
1391
1058
  interface EditableAPIDeleteOptions {
1392
1059
  mode?: 'blocks' | 'children' | 'selected';
@@ -2022,7 +1689,7 @@ declare const editorMachine: xstate73.StateMachine<{
2022
1689
  initialValue?: Array<PortableTextBlock>;
2023
1690
  }, xstate73.NonReducibleUnknown, InternalPatchEvent | MutationEvent | PatchesEvent | {
2024
1691
  type: "blurred";
2025
- event: react8.FocusEvent<HTMLDivElement, Element>;
1692
+ event: react4.FocusEvent<HTMLDivElement, Element>;
2026
1693
  } | {
2027
1694
  type: "done loading";
2028
1695
  } | {
@@ -2034,7 +1701,7 @@ declare const editorMachine: xstate73.StateMachine<{
2034
1701
  data: unknown;
2035
1702
  } | {
2036
1703
  type: "focused";
2037
- event: react8.FocusEvent<HTMLDivElement, Element>;
1704
+ event: react4.FocusEvent<HTMLDivElement, Element>;
2038
1705
  } | {
2039
1706
  type: "invalid value";
2040
1707
  resolution: InvalidValueResolution | null;