platejs 54.0.0-beta.3 → 54.0.0-beta.4

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 (150) hide show
  1. package/dist/{AIChatRequestContext-DY104TqL.d.ts → AIChatRequestContext-DrUahdTc.d.ts} +2 -2
  2. package/dist/{BaseSuggestionPlugin-Deo6n6Fs.d.ts → BaseSuggestionPlugin-_7Ka6nY3.d.ts} +4 -4
  3. package/dist/{PlateStatic-CJX5bKuv.d.ts → PlateStatic-D3Cb-QwH.d.ts} +3 -3
  4. package/dist/ai/index.d.ts +1 -1
  5. package/dist/ai/react/index.d.ts +9 -9
  6. package/dist/authored/index.d.ts +3 -3
  7. package/dist/code-block/codemirror/index.d.ts +1 -1
  8. package/dist/{combobox-DAOYWuvC.d.ts → combobox-Dr0OYZIE.d.ts} +2 -2
  9. package/dist/{comparison-types-Dt-unJZY-DCddmbSD.d.ts → comparison-types-DdwE6mYq-BogsHoUO.d.ts} +1 -1
  10. package/dist/compiler/index.d.ts +2 -2
  11. package/dist/{core-ClHasORr.d.ts → core-BqR-fEDp.d.ts} +65 -26
  12. package/dist/diff/index.d.ts +2 -2
  13. package/dist/docs/api/core/plate-controller.md +1 -1
  14. package/dist/docs/api/core.md +45 -5
  15. package/dist/docs/api/dom.md +4 -7
  16. package/dist/docs/api/react-hooks.md +40 -22
  17. package/dist/docs/authored-changes.md +4 -2
  18. package/dist/docs/block-placeholder.md +4 -2
  19. package/dist/docs/board.md +57 -4
  20. package/dist/docs/comment.md +2 -2
  21. package/dist/docs/document-model.md +15 -3
  22. package/dist/docs/editor.md +50 -4
  23. package/dist/docs/llms.txt +1 -1
  24. package/dist/docs/markdown.md +97 -9
  25. package/dist/docs/plugin-input-rules.md +62 -3
  26. package/dist/docx/export/index.d.ts +3 -3
  27. package/dist/docx/export/lib/exportDocx.js +18 -13
  28. package/dist/docx/export/lib/internal/xml-builder.js +11 -16
  29. package/dist/docx/export/lib/reviewProjection.js +43 -3
  30. package/dist/docx/import/index.d.ts +4 -4
  31. package/dist/docx/paste/index.d.ts +4 -4
  32. package/dist/dom/index.d.ts +1 -1
  33. package/dist/excalidraw/index.d.ts +3 -3
  34. package/dist/excalidraw/react/index.d.ts +3 -3
  35. package/dist/facade.js +2 -2
  36. package/dist/features/board/index.d.ts +1 -1
  37. package/dist/features/callout/index.d.ts +3 -3
  38. package/dist/features/combobox/index.d.ts +2 -2
  39. package/dist/features/comments/BaseCommentsPlugin.js +33 -17
  40. package/dist/features/comments/index.d.ts +1 -1
  41. package/dist/features/date/index.d.ts +3 -3
  42. package/dist/features/details/index.d.ts +3 -3
  43. package/dist/features/details/lib/BaseDetailsPlugin.js +15 -2
  44. package/dist/features/field/index.d.ts +2 -2
  45. package/dist/features/field/index.js +4 -2
  46. package/dist/features/field/lib/BaseFieldPlugin.js +51 -105
  47. package/dist/features/field/lib/applyFieldValues.js +188 -0
  48. package/dist/features/field/lib/fieldRules.internal.js +169 -7
  49. package/dist/features/find/index.d.ts +3 -3
  50. package/dist/features/footnote/index.d.ts +1 -1
  51. package/dist/features/ink/index.d.ts +1 -1
  52. package/dist/features/ink/lib/inkGone.internal.js +6 -6
  53. package/dist/features/ink/lib/inkPlaces.internal.js +8 -9
  54. package/dist/features/layout/index.d.ts +1 -1
  55. package/dist/features/lint/index.d.ts +3 -3
  56. package/dist/features/media/index.d.ts +2 -2
  57. package/dist/features/media/index.js +2 -2
  58. package/dist/features/media/lib/media-embed/BaseMediaEmbedPlugin.js +200 -2
  59. package/dist/features/mention/index.d.ts +5 -5
  60. package/dist/features/suggestion/index.d.ts +1 -1
  61. package/dist/features/table/index.d.ts +1 -1
  62. package/dist/features/table/lib/BaseTablePlugin.js +50 -7
  63. package/dist/features/toc/index.d.ts +1 -1
  64. package/dist/features/upload/index.d.ts +1 -1
  65. package/dist/history/index.d.ts +2 -2
  66. package/dist/html/index.d.ts +3 -3
  67. package/dist/html/server/index.d.ts +1 -1
  68. package/dist/{htmlTypes-cg_cWsaN.d.ts → htmlTypes-eT2ZGDAj.d.ts} +1 -1
  69. package/dist/hyperscript/index.d.ts +1 -1
  70. package/dist/{index-D3-2iM1b.d.ts → index-B33E1CRJ.d.ts} +291 -4
  71. package/dist/{index-DKOFvteF.d.ts → index-B7moSod7.d.ts} +1 -1
  72. package/dist/{index-C9DiGDVj.d.ts → index-B8-5Sr7I.d.ts} +2 -2
  73. package/dist/{index-CzLwBZpY.d.ts → index-B8QJDAmG.d.ts} +2 -2
  74. package/dist/{index-Cmuluh6f.d.ts → index-BTx5oK7k.d.ts} +1 -1
  75. package/dist/{index-DPWyk3lG-DOYwohXO.d.ts → index-BWPcE4ac-Cto_IsNs.d.ts} +7 -1
  76. package/dist/{index-DpltOCot-A2b3p3Eb.d.ts → index-BXjLmx1n-CXk17buG.d.ts} +75 -27
  77. package/dist/{index-C6ql9pKw.d.ts → index-BXwU9QH6.d.ts} +2 -2
  78. package/dist/{index-CLsEe3LY.d.ts → index-BkwR-5hH.d.ts} +3 -3
  79. package/dist/{index-BZWFoUXt.d.ts → index-BsV2McRr.d.ts} +5 -5
  80. package/dist/{index-DQnjqtQa.d.ts → index-C9Fu-P4E.d.ts} +116 -21
  81. package/dist/{index-oIJAZxc2.d.ts → index-Ca48r1ng.d.ts} +3 -3
  82. package/dist/{index-Do9pj1GK.d.ts → index-Cob_iBdu.d.ts} +47 -6
  83. package/dist/{index-C1_JIhL4.d.ts → index-CpY7Xnxw.d.ts} +4 -4
  84. package/dist/{index-baQOK89E.d.ts → index-DNQXzU-X.d.ts} +1 -1
  85. package/dist/{index-8WO2vI0U.d.ts → index-DPowErHa.d.ts} +18 -20
  86. package/dist/{index-B5mYEawV.d.ts → index-DShbzec2.d.ts} +5 -6
  87. package/dist/{index-C35V_hj0.d.ts → index-DYdObeFQ.d.ts} +3 -3
  88. package/dist/{index-HPYawTae-BCUQLEWF.d.ts → index-Dq3Jlj8O-BJ6NxZm0.d.ts} +1 -1
  89. package/dist/{index-CdOLsPaW.d.ts → index-DwWQVwQt.d.ts} +3 -5
  90. package/dist/{index-r7yb77Wy.d.ts → index-JWgwL5l3.d.ts} +5 -3
  91. package/dist/{index-CktYvOgk.d.ts → index-M781pyx9.d.ts} +4 -4
  92. package/dist/{index-C0POz7rg.d.ts → index-d7io3MzC.d.ts} +3 -3
  93. package/dist/index.d.ts +4 -4
  94. package/dist/lib/plugins/element-id/ElementIdPlugin.js +6 -16
  95. package/dist/lib/plugins/input-rules/InputRulesPlugin.js +73 -14
  96. package/dist/markdown/index.d.ts +2 -2
  97. package/dist/markdown/index.js +2 -1
  98. package/dist/markdown/lib/MarkdownPlugin.js +8 -12
  99. package/dist/markdown/lib/RawHtmlPlugin.js +4 -2
  100. package/dist/markdown/lib/internal/markdownConversion.js +7 -4
  101. package/dist/markdown/lib/internal/markdownFootnoteWriter.js +35 -0
  102. package/dist/markdown/lib/internal/markdownRawHtml.js +40 -1
  103. package/dist/markdown/lib/internal/markdownTags.js +7 -1
  104. package/dist/math/index.d.ts +3 -3
  105. package/dist/math/react/index.d.ts +4 -4
  106. package/dist/migrations/index.d.ts +3 -3
  107. package/dist/migrations/migratePlateV54.js +4 -6
  108. package/dist/migrations/migratePlateV54RetiredMarks.internal.js +23 -8
  109. package/dist/migrations/migratePlateV54Suggestions.internal.js +2 -2
  110. package/dist/migrations/v53-manifest.internal.js +4 -0
  111. package/dist/pagination/index.d.ts +1 -1
  112. package/dist/pagination/react/index.d.ts +2 -2
  113. package/dist/react/components/EditorContentView.internal.js +26 -16
  114. package/dist/react/components/Plate.js +13 -20
  115. package/dist/react/features/board/boardExport.internal.js +470 -0
  116. package/dist/react/features/board/boardPictureStyles.internal.js +415 -0
  117. package/dist/react/features/board/boardView.internal.js +11 -6
  118. package/dist/react/features/board/index.d.ts +50 -6
  119. package/dist/react/features/callout/index.d.ts +3 -3
  120. package/dist/react/features/combobox/index.d.ts +5 -5
  121. package/dist/react/features/comments/index.d.ts +6 -6
  122. package/dist/react/features/date/index.d.ts +4 -4
  123. package/dist/react/features/details/index.d.ts +4 -4
  124. package/dist/react/features/field/FieldPlugin.js +5 -4
  125. package/dist/react/features/field/index.d.ts +19 -16
  126. package/dist/react/features/footnote/index.d.ts +7 -7
  127. package/dist/react/features/format-painter/index.d.ts +4 -4
  128. package/dist/react/features/ink/index.d.ts +5 -9
  129. package/dist/react/features/ink/inkPlacement.internal.js +2 -1
  130. package/dist/react/features/layout/index.d.ts +5 -5
  131. package/dist/react/features/media/index.d.ts +5 -5
  132. package/dist/react/features/mention/index.d.ts +6 -6
  133. package/dist/react/features/suggestion/index.d.ts +6 -6
  134. package/dist/react/features/table/index.d.ts +7 -6
  135. package/dist/react/features/table/useTableResize.js +10 -1
  136. package/dist/react/features/toc/index.d.ts +2 -2
  137. package/dist/react/features/upload/index.d.ts +5 -5
  138. package/dist/react/index.d.ts +6 -6
  139. package/dist/react/internal/plate-context.js +20 -11
  140. package/dist/react/stores/plate/useEditorSelector.js +22 -9
  141. package/dist/react/utils/BlockPlaceholderPlugin.js +5 -2
  142. package/dist/react/virtualized.d.ts +2 -2
  143. package/dist/{source-aUwpNnAw.d.ts → source-BGohy8vH.d.ts} +3 -3
  144. package/dist/static/index.d.ts +5 -5
  145. package/dist/tabbable/index.d.ts +1 -1
  146. package/dist/tabbable/react/index.d.ts +3 -3
  147. package/dist/testing/index.d.ts +2 -2
  148. package/dist/yjs/index.d.ts +1 -1
  149. package/dist/yjs/react/index.d.ts +5 -5
  150. package/package.json +2 -2
@@ -1358,18 +1358,19 @@ type BivariantLocate<TArgs extends readonly unknown[]> = {
1358
1358
  * registered, `locate` also maps them into the document editing commands
1359
1359
  * decide on, or returns null when they have no place there, so the method
1360
1360
  * does nothing. `false` says the arguments hold no location. A call that
1361
- * passes a function runs in the caller's root, and `locate` runs only to map
1362
- * its arguments into the command document. A method called with arguments
1363
- * that has no declaration throws.
1361
+ * passes a function runs in the caller's root, and `locate` only places its
1362
+ * arguments, so an id that names no element still does nothing. A method
1363
+ * called with arguments that has no declaration throws.
1364
1364
  */
1365
1365
  declare const txLocate: <TMethod extends (...args: never[]) => unknown>(locate: NoInfer<BivariantLocate<Parameters<TMethod>>> | false, method: TMethod) => TxDeclaredMethod<TMethod>;
1366
1366
  type Target = NodeSelection | NodeTarget | Span | null;
1367
+ type TakesPlacedIds<TOptions, TKey extends string> = { readonly [K in TKey & keyof TOptions]?: ElementIdTarget extends TOptions[K] ? NodeKey extends TOptions[K] ? TOptions[K] : NodeKey : TOptions[K]; };
1367
1368
  /**
1368
1369
  * A `txLocate` locate for a method whose argument at `index` is options
1369
1370
  * holding targets under `keys`, `at` by default: it places each target
1370
1371
  * given, and the method does nothing when one has no place.
1371
1372
  */
1372
- declare const locateAt: <TIndex extends number, TKey extends string = 'at'>(index: TIndex, ...keys: TKey[]) => <TArgs extends readonly unknown[] & { readonly [K in TIndex]?: Readonly<Partial<Record<TKey, Target>>>; }>(args: TArgs, place: EditorCommandPlace) => TArgs | null;
1373
+ declare const locateAt: <TIndex extends number, TKey extends string = 'at'>(index: TIndex, ...keys: TKey[]) => <TArgs extends readonly unknown[] & { readonly [K in TIndex]?: Readonly<Partial<Record<TKey, Target>>> & TakesPlacedIds<TArgs[K], TKey>; }>(args: TArgs, place: EditorCommandPlace) => TArgs | null;
1373
1374
  /**
1374
1375
  * Declare a plugin update method that only moves the selection, as caret
1375
1376
  * movement does: it runs in the caller's root on the stored document, and
@@ -1698,7 +1699,7 @@ type NodePropertyKeyIn<V extends Value> = NodePropertyEntryIn<V>['key'];
1698
1699
  type WithNodeKeyTarget<TOptions extends {
1699
1700
  at?: Location | NodeSelection;
1700
1701
  }> = Omit<TOptions, 'at'> & {
1701
- at?: Location | NodeKey | NodeSelection;
1702
+ at?: ElementIdTarget | Location | NodeKey | NodeSelection;
1702
1703
  };
1703
1704
  type NodePropertyPatch<TProps> = TProps extends unknown ? { [TKey in keyof TProps]?: TProps[TKey] | undefined; } : never;
1704
1705
  type EditorNodeSetObject<V extends Value> = {
@@ -1872,8 +1873,25 @@ type InitialValue<V extends Value = Value> = V | Readonly<{
1872
1873
  records?: EditorDocumentRecords;
1873
1874
  roots?: Readonly<Record<RootKey, V>>;
1874
1875
  }>;
1875
- /** A document location, node key, or live node to resolve. */
1876
- type NodeTarget<N extends Descendant = Descendant> = Location | N | NodeKey;
1876
+ /**
1877
+ * An element's stored `id` as a target. An object is one only when `id` is
1878
+ * its one key, so a live element that carries an `id` stays a node.
1879
+ */
1880
+ type ElementIdTarget = Readonly<{
1881
+ id: string;
1882
+ }>;
1883
+ /** An element found by its stored `id`, read from the state that found it. */
1884
+ type EditorElementEntry<TElement extends Element = Element> = Readonly<{
1885
+ key: NodeKey;
1886
+ node: TElement;
1887
+ path: Path;
1888
+ /** The element's named root, absent in the primary document. */
1889
+ root?: NamedRootKey;
1890
+ }>;
1891
+ /** A document location, node key or live node a text command lands at. */
1892
+ type TextTarget<N extends Descendant = Descendant> = Location | N | NodeKey;
1893
+ /** A document location, node key, live node or element id to resolve. */
1894
+ type NodeTarget<N extends Descendant = Descendant> = TextTarget<N> | ([Extract<N, Element>] extends [never] ? never : ElementIdTarget);
1877
1895
  type EditorReplaceChildrenOptions = Omit<NodeReplaceChildrenOptions, 'at'> & ({
1878
1896
  at: Path;
1879
1897
  /** Named root the path addresses. Omit for this editor's or view's root. */
@@ -1884,14 +1902,21 @@ type EditorReplaceChildrenOptions = Omit<NodeReplaceChildrenOptions, 'at'> & ({
1884
1902
  });
1885
1903
  /** Options for replacing exactly one node with zero or more nodes. */
1886
1904
  type EditorReplaceNodeOptions = {
1887
- at: Descendant | NodeKey | Path;
1905
+ at: Descendant | ElementIdTarget | NodeKey | Path;
1888
1906
  select?: boolean;
1889
1907
  };
1890
1908
  type NodeSelectionTarget<TNode extends Descendant = Descendant> = NodeSelection | NodeTarget<TNode>;
1891
- type WithNodeTarget<TOptions extends {
1909
+ /**
1910
+ * Options whose `at` takes every node target: a location, a node key, a live
1911
+ * node or an element id, beside any other target the options already take.
1912
+ */
1913
+ type WithNodeTarget<TOptions, TNode extends Descendant = Descendant> = Omit<TOptions, 'at'> & {
1914
+ at?: NodeTarget<TNode> | TOptions['at' & keyof TOptions];
1915
+ };
1916
+ type WithTextTarget<TOptions extends {
1892
1917
  at?: Location;
1893
1918
  }, TNode extends Descendant = Descendant> = Omit<TOptions, 'at'> & {
1894
- at?: NodeTarget<TNode>;
1919
+ at?: TextTarget<TNode>;
1895
1920
  };
1896
1921
  type WithNodeTargetOrSpan<TOptions extends {
1897
1922
  at?: Location | NodeSelection | Span;
@@ -2147,7 +2172,8 @@ type EditorUpdateValueApi<V extends Value = Value> = EditorStateValueApi<V> & {
2147
2172
  replace: (input: SnapshotInput<V>) => void;
2148
2173
  };
2149
2174
  type EditorSelectionTargetOptions = {
2150
- at?: NodeTarget | null;
2175
+ /** The range the query tests in place of the selection. */
2176
+ at?: TextTarget | null;
2151
2177
  };
2152
2178
  type EditorSelectionSetNodesOptions = Readonly<{
2153
2179
  /** `object` picks one object itself; defaults to `block`. */
@@ -2211,7 +2237,8 @@ type EditorStateUniqueApi = Readonly<{
2211
2237
  * a child transaction each answer from their own document. When such a state
2212
2238
  * gave the value to a second node, it reads the node that held the value in
2213
2239
  * the state around it, the stored document for an update, while that node
2214
- * still holds it.
2240
+ * still holds it. In an editor whose elements store ids, `holder('id', …)`
2241
+ * throws: `nodes.byId` finds an element by its id.
2215
2242
  */
2216
2243
  holder: (property: string, value: unknown) => EditorUniqueHolder | null;
2217
2244
  }>;
@@ -2227,7 +2254,7 @@ type EditorStateSliceApi<V extends Value = Value> = {
2227
2254
  /** Read the selection slice and apply every external export projection. */
2228
2255
  export: (options?: EditorSliceReadOptions) => ContentSlice$1<V>;
2229
2256
  /** Build an atomic replacement transaction without publishing it. */
2230
- fit: (slice: ContentSlice$1, options?: WithNodeTarget<TextInsertFragmentOptions, DescendantIn<V>>) => false | TransactionSpec;
2257
+ fit: (slice: ContentSlice$1, options?: WithTextTarget<TextInsertFragmentOptions, DescendantIn<V>>) => false | TransactionSpec;
2231
2258
  /** Fit immutable slice content against one detached parent without publishing. */
2232
2259
  fitContent: <TRoot extends RootKey>(slice: ContentSlice$1, options: Readonly<{
2233
2260
  parent: Element;
@@ -2338,6 +2365,17 @@ type EditorStateNodesApi<V extends Value = Value> = {
2338
2365
  }): ReadonlyArray<NodeEntry<NodeForTypeSelector<TType>>>;
2339
2366
  (options?: EditorBlocksReadOptions<ValueElement<V>>): ReadonlyArray<NodeEntry<ValueElement<V>>>;
2340
2367
  };
2368
+ /**
2369
+ * Find the element whose stored `id` is `id` in the current state, with its
2370
+ * key, node, path and named root. An update's draft, a command frame, a child
2371
+ * transaction, a document view and a preview each answer from their own
2372
+ * document, except that a view read while a command runs answers from the
2373
+ * command's state. A view bound to a named root finds no element of the
2374
+ * main root, whose entry names no root. Throws unless the schema declares
2375
+ * `id` as a generated, unique string property on every element type and no
2376
+ * content admits undeclared element types.
2377
+ */
2378
+ byId: (id: string) => EditorElementEntry<ValueElement<V>> | null;
2341
2379
  children: (at?: NodeTarget) => ReadonlyArray<ValueDescendant<V>>;
2342
2380
  elementReadOnly: (options?: WithNodeTarget<EditorElementReadOnlyOptions>) => NodeEntry<Element> | undefined;
2343
2381
  first: (at: NodeTarget) => NodeEntry | undefined;
@@ -2349,7 +2387,7 @@ type EditorStateNodesApi<V extends Value = Value> = {
2349
2387
  type: TType;
2350
2388
  }): NodeEntry<NodeForTypeSelector<TType>> | undefined;
2351
2389
  <TNode extends Descendant>(at: TNode): NodeEntry<TNode> | undefined;
2352
- (at: Location | NodeKey, options?: EditorNodeGetOptions<ValueTreeNode<V>>): NodeEntry | undefined;
2390
+ (at: ElementIdTarget | Location | NodeKey, options?: EditorNodeGetOptions<ValueTreeNode<V>>): NodeEntry | undefined;
2353
2391
  };
2354
2392
  /**
2355
2393
  * Whether a node is content. A capability that keeps non-content nodes in
@@ -2610,6 +2648,12 @@ type EditorStateRangesApi = {
2610
2648
  edges: (at: NodeTarget) => readonly [Point, Point] | undefined;
2611
2649
  fromEntries: (entries: readonly NodeEntry[]) => Range | undefined;
2612
2650
  get: (at: NodeTarget, to?: Location) => Range | undefined;
2651
+ /**
2652
+ * Whether a range covers nothing a reader sees: no letter, and no void
2653
+ * element such as a mention wholly inside it. A collapsed range is empty,
2654
+ * and so is one that crosses only the edges of text leaves or containers.
2655
+ */
2656
+ isEmpty: (range: Range) => boolean;
2613
2657
  project: (range: Range) => readonly ProjectedRangeSegment[];
2614
2658
  unhang: (range: Range, options?: EditorUnhangRangeOptions) => Range;
2615
2659
  };
@@ -2618,9 +2662,9 @@ type EditorStateTextApi = {
2618
2662
  string: (at?: NodeSelectionTarget, options?: EditorStringOptions) => string;
2619
2663
  };
2620
2664
  type EditorTransactionFragmentApi<V extends Value = Value> = EditorStateFragmentApi<V> & {
2621
- delete: (options?: WithNodeTarget<EditorFragmentDeletionOptions, DescendantIn<V>>) => void;
2665
+ delete: (options?: WithTextTarget<EditorFragmentDeletionOptions, DescendantIn<V>>) => void;
2622
2666
  /** Fit and replace known-closed content as one canonical closed slice. */
2623
- replace: (content: ReadonlyArray<DescendantIn<V>>, options?: WithNodeTarget<TextInsertFragmentOptions, DescendantIn<V>>) => boolean;
2667
+ replace: (content: ReadonlyArray<DescendantIn<V>>, options?: WithTextTarget<TextInsertFragmentOptions, DescendantIn<V>>) => boolean;
2624
2668
  };
2625
2669
  type EditorTransactionSliceApi<V extends Value = Value> = Pick<EditorStateSliceApi<V>, 'get'> & {
2626
2670
  /**
@@ -2630,7 +2674,7 @@ type EditorTransactionSliceApi<V extends Value = Value> = Pick<EditorStateSliceA
2630
2674
  * protected void, or the compiled schema cannot fit a well-formed slice.
2631
2675
  * Malformed slice shapes are programmer errors and throw.
2632
2676
  */
2633
- replace: (slice: ContentSlice$1, options?: WithNodeTarget<TextInsertFragmentOptions, DescendantIn<V>>) => boolean;
2677
+ replace: (slice: ContentSlice$1, options?: WithTextTarget<TextInsertFragmentOptions, DescendantIn<V>>) => boolean;
2634
2678
  };
2635
2679
  type EditorBreakExitOptions = {
2636
2680
  /** Land before the exited structure instead of after it. */
@@ -2661,10 +2705,10 @@ type EditorTransactionBreakApi = {
2661
2705
  insertSoft: () => void;
2662
2706
  };
2663
2707
  type EditorTransactionTextApi = EditorStateTextApi & {
2664
- delete: (options?: WithNodeTarget<TextDeleteOptions>) => void;
2708
+ delete: (options?: WithTextTarget<TextDeleteOptions>) => void;
2665
2709
  deleteBackward: (options?: EditorDirectedDeletionOptions) => void;
2666
2710
  deleteForward: (options?: EditorDirectedDeletionOptions) => void;
2667
- insert: (text: string, options?: WithNodeTarget<TextInsertTextOptions>) => void;
2711
+ insert: (text: string, options?: WithTextTarget<TextInsertTextOptions>) => void;
2668
2712
  };
2669
2713
  /** Concrete registered schema targets available to DataTransfer formats. */
2670
2714
  type EditorSchemaVocabulary = Readonly<{
@@ -3176,13 +3220,16 @@ type EditorCommandContext<Input, TEditor = Editor> = {
3176
3220
  * Where a command's stored targets land in the document it decides on. A
3177
3221
  * point lands where typing there would land, a range keeps content at its
3178
3222
  * edges out, and a path or a span's paths land on their nodes' paths. A node
3179
- * or node key names its node in both documents, so it stays as given. Each
3223
+ * or node key names its node in both documents, so it stays as given. An
3224
+ * element id lands as the key of the element that holds it there. Every other
3180
3225
  * target keeps its kind, and `location` returns null when it has no place
3181
3226
  * there.
3182
3227
  */
3183
3228
  type EditorCommandPlace = Readonly<{
3184
- location: <T extends NodeTarget | NodeSelection | Span>(at: T) => T | null;
3229
+ location: <T extends NodeTarget | NodeSelection | Span>(at: T) => PlacedTarget<T> | null;
3185
3230
  }>;
3231
+ /** A target as a command place gives it back: an element id as a node key. */
3232
+ type PlacedTarget<T> = T extends ElementIdTarget ? Exclude<keyof T, 'id'> extends never ? NodeKey : T : T;
3186
3233
  type EditorCommandContinuation<Input> = ((...input: [] | [input: Input]) => EditorCommandResult) & {
3187
3234
  /** Run downstream against the immutable state produced by the prefix. */
3188
3235
  after: (prefix: TransactionSpec, ...input: [] | [input: Input]) => EditorCommandResult;
@@ -6357,6 +6404,7 @@ type InternalEditorSchemaApi<V extends Value = Value> = EditorStateSchemaApi<V>
6357
6404
  document: DocumentIndex;
6358
6405
  path: readonly number[];
6359
6406
  from: number;
6407
+ afterLength: number;
6360
6408
  }>, carried?: CarriedPropertyHook) => readonly Descendant[];
6361
6409
  copyChildren: (children: readonly Descendant[], root: RootKey, ancestors?: readonly Element[]) => readonly Descendant[];
6362
6410
  carryChildren: InternalEditorSchemaApi['copyChildren'];
@@ -6891,8 +6939,8 @@ declare const defineEditorSchema: <const N extends string, const TInput extends
6891
6939
  }>, N>>;
6892
6940
  type CommandTargetOptions<TOptions extends {
6893
6941
  at?: Location | NodeSelection;
6894
- }, TNode extends Descendant = Descendant> = Omit<TOptions, 'at'> & {
6895
- at?: Extract<TOptions['at'], NodeSelection> | NodeTarget<TNode>;
6942
+ }, TTarget = NodeTarget> = Omit<TOptions, 'at'> & {
6943
+ at?: Extract<TOptions['at'], NodeSelection> | TTarget;
6896
6944
  };
6897
6945
  type AddMarkCommand = {
6898
6946
  key: string;
@@ -6906,7 +6954,7 @@ type DeleteCommand = {
6906
6954
  unit: TextUnit;
6907
6955
  };
6908
6956
  type DeleteFragmentCommand = {
6909
- at?: NodeTarget;
6957
+ at?: TextTarget;
6910
6958
  direction: 'backward' | 'forward';
6911
6959
  };
6912
6960
  type InsertBreakCommand = void;
@@ -6916,7 +6964,7 @@ type InsertNodesCommand = {
6916
6964
  };
6917
6965
  type InsertSoftBreakCommand = void;
6918
6966
  type InsertTextCommand = {
6919
- options?: CommandTargetOptions<TextInsertTextOptions>;
6967
+ options?: CommandTargetOptions<TextInsertTextOptions, TextTarget>;
6920
6968
  text: string;
6921
6969
  };
6922
6970
  type MoveSelectionCommand = {
@@ -6939,7 +6987,7 @@ type SetSelectionCommand = {
6939
6987
  props: Partial<Range>;
6940
6988
  };
6941
6989
  type ReplaceSliceCommand = {
6942
- options?: CommandTargetOptions<TextInsertFragmentOptions>;
6990
+ options?: CommandTargetOptions<TextInsertFragmentOptions, TextTarget>;
6943
6991
  slice: ContentSlice$1;
6944
6992
  };
6945
6993
  type ToggleMarkCommand = {
@@ -7641,4 +7689,4 @@ declare const compileEditorSchemaContract: (editor: AnyEditor, input: PluginInpu
7641
7689
  unknown: EditorSchemaUnknownPolicy;
7642
7690
  vocabulary: CompiledSchemaVocabulary;
7643
7691
  }>;
7644
- export { EditorBreakExitOptions as $, PathApi as $a, SpanApi as $c, MoveSelectionCommand as $i, TransferWrap as $l, EditorSchemaStructureProperty as $n, PropertyJsonOptions as $o, EditorTransactionTagsApi as $r, SchemaGroup as $s, EditorNodeUnsetOptions as $t, transfer as $u, CompatibleEditorCommand as A, NodeOf as Aa, SchemaValueFromPlugins as Ac, ElementOrTextIn as Ai, TransferAdoptInput as Al, EditorSchemaDefinition as An, PluginReadMiddlewareFactory as Ao, EditorToggleBlockOptions as Ar, SchemaContentRootInput as As, EditorEffectCollabTransport as At, getSnapshot as Au, DeleteFragmentCommand as B, NodeTextRangeMatch as Ba, SelectionSetPointOptions as Bc, InsertTextCommand as Bi, TransferPatch as Bl, EditorSchemaOverride as Bn, PluginUpdateFactoryContext as Bo, EditorTransactionChangesApi as Br, SchemaElementInput as Bs, EditorIsEditorOptions as Bt, positions as Bu, BlockDuplicateOptions as C, NodeLiftNodesOptions as Ca, SchemaTextProperties as Cc, ElementApi as Ci, TextSelection as Cl, EditorSchemaContractContentProgram as Cn, PluginMigrationContext as Co, EditorStateValueApi as Cr, SchemaContent as Cs, EditorDocumentRange as Ct, editorReads as Cu, CarriedRun as D, NodeMoveNodesOptions as Da, SchemaTextPropertyOptions as Dc, ElementInterface as Di, ToggleMarkCommand as Dl, EditorSchemaContractRoot as Dn, PluginReadContext as Do, EditorTargetRuntime as Dr, SchemaContentPrefixSlot as Ds, EditorEffectCollabDecodeContext as Dt, getEditorRuntimeOwner as Du, BooleanMarksOf as E, NodeMergeNodesOptions as Ea, SchemaTextPropertyKeys as Ec, ElementIn as Ei, ToggleBlockCommand as El, EditorSchemaContractElement as En, PluginPublicationError as Eo, EditorStateViewProvider as Er, SchemaContentOptions as Es, EditorEffect as Et, getChildren as Eu, DecorationAttributes as F, NodeSelectionMode as Fa, SelectionCollapseOptions as Fc, HistorySettlement as Fi, TransferInput as Fl, EditorSchemaElementOverrideInput as Fn, PluginSlotValue as Fo, EditorTransactionBlocksApi as Fr, SchemaDescendant as Fs, EditorFragmentReadOptions as Ft, isEditor as Fu, DescendantEntryOf as G, NodeTypeSelector as Ga, SetNodesCommand as Gc, LeafPosition as Gi, TransferRefusalReason as Gl, EditorSchemaPropertyOverride as Gn, PointApi as Go, EditorTransactionNodesApi as Gr, SchemaElementPropertyKeys as Gs, EditorMarks as Gt, schema$1 as Gu, Descendant as H, NodeTextRangeRoot as Ha, SerializedEditorEffect as Hc, JsonEditorValue as Hi, TransferPayload as Hl, EditorSchemaPlugin as Hn, PluginsFromOptions as Ho, EditorTransactionEffectsApi as Hr, SchemaElementPropertiesFor as Hs, EditorLevelsOptions as Ht, readEditorSchemaContract as Hu, DecorationRefresh as I, NodeSetNodesOptions as Ia, SelectionEdge as Ic, InitialValue as Ii, TransferIntent as Il, EditorSchemaElementStructure as In, PluginTypeProvider as Io, EditorTransactionBreakApi as Ir, SchemaElement as Is, EditorGenericMethod as It, locateAt as Iu, DocumentChange as J, NodeWrapNodesOptions as Ja, SliceLandingInput as Jc, LocationInterface as Ji, TransferSideInput as Jl, EditorSchemaPropertyReadOptions as Jn, ProjectedRangeSegment as Jo, EditorTransactionRemoved as Jr, SchemaElementShapeFor as Js, EditorNodeChangeContext as Jt, setEditorFocused as Ju, DescendantIn as K, NodeUnsetNodesOptions as Ka, SetSelectionCommand as Kc, Location as Ki, TransferRelation as Kl, EditorSchemaPropertyOverrideInput as Kn, PointEntry as Ko, EditorTransactionPluginsApi as Kr, SchemaElementPropertyOptions as Ks, EditorMarksOf as Kt, screenReaderAnnouncementEffect as Ku, DecorationSource as L, NodeSplitNodesOptions as La, SelectionMode as Lc, InsertBreakCommand as Li, TransferLandingInput as Ll, EditorSchemaGetProperty as Ln, PluginTypeProviderOf as Lo, EditorTransactionChangeContext as Lr, SchemaElementConstructionPropertiesFor as Ls, EditorInstalledApiGroups as Lt, mapEffect as Lu, ContentSlice$1 as M, NodeRemoveNodesOptions as Ma, Selection as Mc, HistoryApi as Mi, TransferCheck as Ml, EditorSchemaDerivedDefinition as Mn, PluginReference as Mo, EditorTransactionAnchor as Mr, SchemaContentRootSlotsFor as Ms, EditorEffectType as Mt, insertText as Mu, DebugValueScrubber as N, NodeReplaceChildrenOptions as Na, SelectionApi as Nc, HistoryOutcome as Ni, TransferDiagnostic as Nl, EditorSchemaElement as Nn, PluginSlot as No, EditorTransactionAnchorApi as Nr, SchemaContentRootStructure as Ns, EditorElementBehavior as Nt, invertEffect as Nu, ChildOf as O, NodeMutationMethods as Oa, SchemaTypesTarget as Oc, ElementIsElementOptions as Oi, TopLevelRuntimeRange as Ol, EditorSchemaContribution as On, PluginReadFactory as Oo, EditorTextChangeContext as Or, SchemaContentRoot as Os, EditorEffectCollabEncodeContext as Ot, getLiveSelection as Ou, Decoration as P, NodeSelection as Pa, SelectionAssociation as Pc, HistoryResult as Pi, TransferEdge as Pl, EditorSchemaElementOverride as Pn, PluginSlotLike as Po, EditorTransactionAnnotationsApi as Pr, SchemaContentRule as Ps, EditorFragmentDeletionOptions as Pt, isBlock as Pu, EditorBlockToggleOptions as Q, PathAncestorsOptions as Qa, Span as Qc, MaximizeMode as Qi, TransferVetoInput as Ql, EditorSchemaSourceProvider as Qn, PropertyJsonDescriptor as Qo, EditorTransactionSpecBuilder as Qr, SchemaElementTypes as Qs, EditorNodeTypeProvider as Qt, target as Qu, DefinitionOf as R, NodeTarget as Ra, SelectionMoveOptions as Rc, InsertNodesCommand as Ri, TransferLandingTarget as Rl, EditorSchemaIdentity as Rn, PluginTypes as Ro, EditorTransactionChangeHandler as Rr, SchemaElementFor as Rs, EditorInstalledReadGroups as Rt, move as Ru, BaseText as S, NodeLevelsOptions as Sa, SchemaTextBlockOptions as Sc, Element as Si, TextRemoveTextOptions as Sl, EditorSchemaContractChangeKind as Sn, PluginInstalledCapabilitiesOf as So, EditorStateUniqueApi as Sr, SchemaBuiltInGroupName as Ss, EditorDirectUpdate as St, editorCommands as Su, BooleanMarkKeysOf as T, NodeMatchPredicate as Ta, SchemaTextPropertyDefinition as Tc, ElementEntryOf as Ti, TextUnitAdjustment as Tl, EditorSchemaContractDiff as Tn, PluginPortal as To, EditorStateViewApi as Tr, SchemaContentInput as Ts, EditorDocumentValue as Tt, encodeEditorSelection as Tu, DescendantEntry as U, NodeTextRangeView as Ua, SerializedEditorSelection as Uc, JsonNode as Ui, TransferPlugin as Ul, EditorSchemaPluginProvider as Un, PluginsOf as Uo, EditorTransactionFragmentApi as Ur, SchemaElementProperty as Us, EditorLifecycleError as Ut, replace as Uu, DerivedEditorSchemaIdentity as V, NodeTextRangeQuery as Va, SelectionValue as Vc, InternalEditorSchemaApi as Vi, TransferPatchProperties as Vl, EditorSchemaOverrideInput as Vn, PluginWitnessFor as Vo, EditorTransactionDocumentChangeKind as Vr, SchemaElementProperties as Vs, EditorJsonValue as Vt, property as Vu, DescendantEntryIn as W, NodeTextsOptions as Wa, SerializedEditorValue as Wc, LeafEdge as Wi, TransferRead as Wl, EditorSchemaProperty as Wn, Point as Wo, EditorTransactionMarksApi as Wr, SchemaElementPropertyDefinition as Ws, EditorLifecycleErrorSink as Wt, restoreEditorSchemaContract as Wu, EditorAboveOptions as X, NodeWriteVetoInput as Xa, SnapshotIndex as Xc, MarksIn as Xi, TransferTarget as Xl, EditorSchemaRepairCode as Xn, PropertyBuilderApi as Xo, EditorTransactionSelectionApi as Xr, SchemaElementStructure as Xs, EditorNodeChangeKind as Xt, setEditorViewing as Xu, Editor as Y, NodeWriteVeto as Ya, SliceLandingTarget as Yc, MarkKeysOf as Yi, TransferSourceInput as Yl, EditorSchemaReadProperty as Yn, PropertyBooleanDescriptor as Yo, EditorTransactionRootsApi as Yr, SchemaElementSlicePolicy as Ys, EditorNodeChangeHandler as Yt, setEditorReadOnly as Yu, EditorBlockOptions as Z, Path as Za, SnapshotInput as Zc, MarksOf as Zi, TransferVeto as Zl, EditorSchemaSource as Zn, PropertyEnumDescriptor as Zo, EditorTransactionSliceApi as Zr, SchemaElementTarget as Zs, EditorNodeGetOptions as Zt, string as Zu, AuthoredVeto as _, NodeInsertNodesOptions as _a, SchemaPropertyTypeChangePolicy as _c, EditorValueFromPlugins as _i, TextInsertFragmentOptions as _l, EditorRootOwner as _n, PluginDependencyReferenceFor as _o, EditorStateRuntimeApi as _r, RemoveMarkCommand as _s, EditorCommitRuntimeChangeKind as _t, defineUpdateAnnotation as _u, AncestorIn as a, NodeApi as aa, SchemaProperty as ac, valueCodecs as ad, EditorUpdateAnnotation as ai, StateFieldValueInput as al, EditorReadAroundHandler as an, PluginApiFactory as ao, EditorSchemaVocabulary as ar, PropertyValidation as as, EditorCommandDispatch as at, after$1 as au, BasePoint as b, NodeIsNodeOptions as ba, SchemaTarget as bc, EditorView as bi, TextMutationMethods as bl, EditorSchemaContract as bn, PluginFactoryTypeProviderOf as bo, EditorStateSliceApi as br, RootFactsJson as bs, EditorCoreUpdateTransaction as bt, diffEditorSchemaContracts as bu, AnchorAssociation as c, NodeDescendantsOptions as ca, SchemaPropertyExclusiveGroup as cc, EditorUpdatePolicy as ci, Text as cl, EditorReadInput as cn, PluginCandidateEditor as co, EditorSelectionTargetOptions as cr, PropertyValueOf as cs, EditorCommandPlace as ct, compileEditorSchemaContract as cu, AnchorValue as d, NodeEntry as da, SchemaPropertyIds as dc, EditorUpdateTagInput as di, TextDirection as dl, EditorReadMethods as dn, PluginContribution as do, EditorStateField as dr, RangeAnchorAssociation as ds, EditorCommit as dt, defineCommand$1 as du, MoveUnit as ea, SchemaGroupNames as ec, transferVeto as ed, EditorTransactionTextApi as ei, SpanInterface as el, EditorNodesOptions as en, PathInterface as eo, EditorSchemaUnknownPolicy as er, PropertyNumberDescriptor as es, EditorCanonicalUpdateTag as et, TxDeclaredMethod as eu, AnyEditor as f, NodeEntryIn as fa, SchemaPropertyKey as fc, EditorUpdateTransaction as fi, TextEntry as fl, EditorReadRegistration as fn, PluginContributionInput as fo, EditorStateFragmentApi as fr, RangeApi as fs, EditorCommitChangeKind as ft, defineEditorSchema as fu, AuthoredTouch as g, NodeIn as ga, SchemaPropertySplitPolicy as gc, EditorValueFromOptions as gi, TextIn as gl, EditorRootEntry as gn, PluginDependencyReference as go, EditorStateRangesApi as gr, RangeMode as gs, EditorCommitListener as gt, defineStateField as gu, AuthoredProjectionRefusal as h, NodeHasPropsOptions as ha, SchemaPropertyRole as hc, EditorUpdateValueFromPlugin as hi, TextEqualsOptions as hl, EditorReplaceNodeOptions as hn, PluginDependencyContractReference as ho, EditorStatePointsApi as hr, RangeInterface as hs, EditorCommitHandler as ht, definePluginSlot as hu, AncestorEntryOf as i, NodeAncestorsOptions as ia, SchemaPluginsOf as ic, unhangRange as id, EditorUpdate as ii, StateFieldInitial as il, EditorRead as in, PluginActivationContext as io, EditorSchemaValidationPropertyContext as ir, PropertyStringDescriptor as is, EditorCommandDescriptor as it, ValueOf as iu, ContentSlice as j, NodeProps as ja, SelectCommand as jc, ElementOrTextOf as ji, TransferApi as jl, EditorSchemaDelta as jn, PluginReconfigureOptions as jo, EditorToggleMarkOptions as jr, SchemaContentRootOwnership as js, EditorEffectHistoryReplayResult as jt, insertBreak as ju, CollapseSelectionCommand as k, NodeNodesOptions as ka, SchemaValue as kc, ElementOf as ki, TransactionSpec as kl, EditorSchemaDeclaration as kn, PluginReadFactoryContext as ko, EditorTextChangeHandler as kr, SchemaContentRootContribution as ks, EditorEffectCollabReplay as kt, getSelection as ku, AnchorDeletionPolicy as l, NodeDuplicateOptions as la, SchemaPropertyHandle as lc, EditorUpdatePolicyFor as li, TextApi as ll, EditorReadMethodRecord as ln, PluginCapabilities as lo, EditorSliceReadOptions as lr, PropertyValueOptions as ls, EditorCommandResult as lt, createEditorView as lu, AuthoredProjectionDiagnostic as m, NodeFindTextRangesOptions as ma, SchemaPropertyReferences as mc, EditorUpdateTransactionProvider as mi, TextEntryOf as ml, EditorReplaceChildrenOptions as mn, PluginDefinitionInput as mo, EditorStateNodesApi as mr, RangeEdgesOptions as ms, EditorCommitContext as mt, definePluginPoint as mu, Ancestor as n, NamedRootKey as na, SchemaKeyPrefix as nc, txOnly as nd, EditorTransactionValueApi as ni, StateFieldDescriptor as nl, EditorParentOptions as nn, PersistedDocumentInput as no, EditorSchemaValidationDiagnostic as nr, PropertySetDescriptor as ns, EditorCommandAroundHandler as nt, TxOnlyMethod as nu, AncestorOf as o, NodeChildEntry as oa, SchemaPropertyCopyPolicy as oc, EditorUpdateContext as oi, StructuralPlainTextDiagnostic as ol, EditorReadContext as on, PluginApiFactoryContext as oo, EditorSelection as or, PropertyValueDescriptor as os, EditorCommandHandler as ot, authoredVeto as ou, AuthoredDocumentProjection as p, NodeEntryOf as pa, SchemaPropertyLandingPolicy as pc, EditorUpdateTransactionOf as pi, TextEntryIn as pl, EditorReadResult as pn, PluginDefinition as po, EditorStateMarksApi as pr, RangeDirection as ps, EditorCommitChanged as pt, defineEffect as pu, DescendantOf as q, NodeUnwrapNodesOptions as qa, SliceLanding as qc, LocationApi as qi, TransferSide as ql, EditorSchemaPropertyQuery as qn, PointInterface as qo, EditorTransactionRecordsApi as qr, SchemaElementPropertyValue as qs, EditorNextOptions as qt, setDebugValueScrubber as qu, AncestorEntry as r, Node as ra, SchemaNodeTypeProvider as rc, txSelection as rd, EditorUniqueHolder as ri, StateFieldHistoryPolicy as rl, EditorPreviousOptions as rn, Plugin as ro, EditorSchemaValidationError as rr, PropertySetOptions as rs, EditorCommandContinuation as rt, Value as ru, Anchor as s, NodeChildrenOptions as sa, SchemaPropertyDefinition as sc, EditorUpdateMethods as si, TargetFreshnessRequest as sl, EditorReadDescriptor as sn, PluginCandidateContext as so, EditorSelectionBlockOptions as sr, PropertyValueKind as ss, EditorCommandInput as st, before$1 as su, AddMarkCommand as t, NamedEditorSchemaIdentity as ta, SchemaGroupOptions as tc, txLocate as td, EditorTransactionTopLevelRange as ti, StateFieldCollabPolicy as tl, EditorNodesReadOptions as tn, PathLevelsOptions as to, EditorSchemaValidationCode as tr, PropertyOptionsOf as ts, EditorCommand as tt, TxMethodDeclarations as tu, AnchorOptions as u, NodeElementsOptions as ua, SchemaPropertyHandleValue as uc, EditorUpdateTag as ui, TextDeleteOptions as ul, EditorReadMethodTree as un, PluginCleanupContext as uo, EditorSnapshot as ur, Range as us, EditorCommands as ut, decodeEditorEffect as uu, BaseElement as v, NodeInsertSplitOptions as va, SchemaRecordSet as vc, EditorValuePersistence as vi, TextInsertTextOptions as vl, EditorSchemaContent as vn, PluginFactoryTypeLambda as vo, EditorStateSchemaApi as vr, RemoveNodesCommand as vs, EditorCoreStateView as vt, deleteBackward as vu, BlockInsertOptions as w, NodeMatch as wa, SchemaTextProperty as wc, ElementEntry as wi, TextUnit as wl, EditorSchemaContractContentRoot as wn, PluginPoint as wo, EditorStateView as wr, SchemaContentDefault as ws, EditorDocumentRecords as wt, encodeEditorEffect as wu, BaseRange as x, NodeKey as xa, SchemaText as xc, EditorViewOptions as xi, TextOf as xl, EditorSchemaContractChange as xn, PluginInput as xo, EditorStateTextApi as xr, RootKey as xs, EditorDirectCommandDispatch as xt, documentReplacement as xu, BaseNode as y, NodeInterface as ya, SchemaRootNames as yc, EditorValueTypeProvider as yi, TextInterface as yl, EditorSchemaContentRoot as yn, PluginFactoryTypeProvider as yo, EditorStateSelectionApi as yr, ReplaceSliceCommand as ys, EditorCoreUpdateMethods as yt, deleteForward as yu, DeleteCommand as z, NodeTextRangeEntry as za, SelectionMutationMethods as zc, InsertSoftBreakCommand as zi, TransferOutcome as zl, EditorSchemaNamedDefinition as zn, PluginUpdateFactory as zo, EditorTransactionChanged as zr, SchemaElementHandle as zs, EditorInstalledUpdateGroups as zt, nodeWriteVeto as zu };
7692
+ export { EditorBreakExitOptions as $, Path as $a, SnapshotIndex as $c, MarksOf as $i, TransferSourceInput as $l, EditorSchemaSourceProvider as $n, PropertyBuilderApi as $o, EditorTransactionSpecBuilder as $r, SchemaElementStructure as $s, EditorNodeTypeProvider as $t, setEditorFocused as $u, CompatibleEditorCommand as A, NodeMutationMethods as Aa, SchemaTextPropertyOptions as Ac, ElementIsElementOptions as Ai, ToggleBlockCommand as Al, EditorSchemaDeclaration as An, PluginReadContext as Ao, EditorTextChangeHandler as Ar, SchemaContentPrefixSlot as As, EditorEffectCollabTransport as At, encodeEditorSelection as Au, DeleteFragmentCommand as B, NodeTarget as Ba, SelectionMode as Bc, InsertNodesCommand as Bi, TransferIntent as Bl, EditorSchemaNamedDefinition as Bn, PluginTypeProviderOf as Bo, EditorTransactionChanged as Br, SchemaElementConstructionPropertiesFor as Bs, EditorInstalledUpdateGroups as Bt, isEditor as Bu, BlockDuplicateOptions as C, NodeKey as Ca, SchemaTarget as Cc, Element as Ci, TextMutationMethods as Cl, EditorSchemaContractChangeKind as Cn, PluginFactoryTypeProviderOf as Co, EditorStateUniqueApi as Cr, RootFactsJson as Cs, EditorDocumentRange as Ct, deleteBackward as Cu, CarriedRun as D, NodeMatchPredicate as Da, SchemaTextProperty as Dc, ElementIdTarget as Di, TextTarget as Dl, EditorSchemaContractElement as Dn, PluginPoint as Do, EditorStateViewProvider as Dr, SchemaContentDefault as Ds, EditorEffectCollabDecodeContext as Dt, editorCommands as Du, BooleanMarksOf as E, NodeMatch as Ea, SchemaTextProperties as Ec, ElementEntryOf as Ei, TextSelection as El, EditorSchemaContractDiff as En, PluginMigrationContext as Eo, EditorStateViewApi as Er, SchemaContent as Es, EditorEffect as Et, documentReplacement as Eu, DecorationAttributes as F, NodeReplaceChildrenOptions as Fa, Selection as Fc, HistoryOutcome as Fi, TransferApi as Fl, EditorSchemaElementOverride as Fn, PluginReference as Fo, EditorTransactionAnnotationsApi as Fr, SchemaContentRootSlotsFor as Fs, EditorFragmentDeletionOptions as Ft, getSnapshot as Fu, DescendantEntryOf as G, NodeTextRangeView as Ga, SerializedEditorEffect as Gc, JsonNode as Gi, TransferPatchProperties as Gl, EditorSchemaProperty as Gn, PluginsFromOptions as Go, EditorTransactionMarksApi as Gr, SchemaElementPropertiesFor as Gs, EditorLifecycleErrorSink as Gt, positions as Gu, Descendant as H, NodeTextRangeMatch as Ha, SelectionMutationMethods as Hc, InsertTextCommand as Hi, TransferLandingTarget as Hl, EditorSchemaOverrideInput as Hn, PluginUpdateFactory as Ho, EditorTransactionDocumentChangeKind as Hr, SchemaElementHandle as Hs, EditorJsonValue as Ht, mapEffect as Hu, DecorationRefresh as I, NodeSelection as Ia, SelectionApi as Ic, HistoryResult as Ii, TransferCheck as Il, EditorSchemaElementOverrideInput as In, PluginSlot as Io, EditorTransactionBlocksApi as Ir, SchemaContentRootStructure as Is, EditorFragmentReadOptions as It, insertBreak as Iu, DocumentChange as J, NodeUnsetNodesOptions as Ja, SetNodesCommand as Jc, Location as Ji, TransferRead as Jl, EditorSchemaPropertyQuery as Jn, PointApi as Jo, EditorTransactionRecordsApi as Jr, SchemaElementPropertyKeys as Js, EditorNextOptions as Jt, replace as Ju, DescendantIn as K, NodeTextsOptions as Ka, SerializedEditorSelection as Kc, LeafEdge as Ki, TransferPayload as Kl, EditorSchemaPropertyOverride as Kn, PluginsOf as Ko, EditorTransactionNodesApi as Kr, SchemaElementProperty as Ks, EditorMarks as Kt, property as Ku, DecorationSource as L, NodeSelectionMode as La, SelectionAssociation as Lc, HistorySettlement as Li, TransferDiagnostic as Ll, EditorSchemaElementStructure as Ln, PluginSlotLike as Lo, EditorTransactionBreakApi as Lr, SchemaContentRule as Ls, EditorGenericMethod as Lt, insertText as Lu, ContentSlice$1 as M, NodeOf as Ma, SchemaValue as Mc, ElementOrTextIn as Mi, TopLevelRuntimeRange as Ml, EditorSchemaDelta as Mn, PluginReadFactoryContext as Mo, EditorToggleMarkOptions as Mr, SchemaContentRootContribution as Ms, EditorEffectType as Mt, getEditorRuntimeOwner as Mu, DebugValueScrubber as N, NodeProps as Na, SchemaValueFromPlugins as Nc, ElementOrTextOf as Ni, TransactionSpec as Nl, EditorSchemaDerivedDefinition as Nn, PluginReadMiddlewareFactory as No, EditorTransactionAnchor as Nr, SchemaContentRootInput as Ns, EditorElementBehavior as Nt, getLiveSelection as Nu, ChildOf as O, NodeMergeNodesOptions as Oa, SchemaTextPropertyDefinition as Oc, ElementIn as Oi, TextUnit as Ol, EditorSchemaContractRoot as On, PluginPortal as Oo, EditorTargetRuntime as Or, SchemaContentInput as Os, EditorEffectCollabEncodeContext as Ot, editorReads as Ou, Decoration as P, NodeRemoveNodesOptions as Pa, SelectCommand as Pc, HistoryApi as Pi, TransferAdoptInput as Pl, EditorSchemaElement as Pn, PluginReconfigureOptions as Po, EditorTransactionAnchorApi as Pr, SchemaContentRootOwnership as Ps, EditorElementEntry as Pt, getSelection as Pu, EditorBlockToggleOptions as Q, NodeWriteVetoInput as Qa, SliceLandingTarget as Qc, MarksIn as Qi, TransferSideInput as Ql, EditorSchemaSource as Qn, PropertyBooleanDescriptor as Qo, EditorTransactionSliceApi as Qr, SchemaElementSlicePolicy as Qs, EditorNodeGetOptions as Qt, setDebugValueScrubber as Qu, DefinitionOf as R, NodeSetNodesOptions as Ra, SelectionCollapseOptions as Rc, InitialValue as Ri, TransferEdge as Rl, EditorSchemaGetProperty as Rn, PluginSlotValue as Ro, EditorTransactionChangeContext as Rr, SchemaDescendant as Rs, EditorInstalledApiGroups as Rt, invertEffect as Ru, BaseText as S, NodeIsNodeOptions as Sa, SchemaRootNames as Sc, EditorViewOptions as Si, TextInterface as Sl, EditorSchemaContractChange as Sn, PluginFactoryTypeProvider as So, EditorStateTextApi as Sr, ReplaceSliceCommand as Ss, EditorDirectUpdate as St, defineUpdateAnnotation as Su, BooleanMarkKeysOf as T, NodeLiftNodesOptions as Ta, SchemaTextBlockOptions as Tc, ElementEntry as Ti, TextRemoveTextOptions as Tl, EditorSchemaContractContentRoot as Tn, PluginInstalledCapabilitiesOf as To, EditorStateView as Tr, SchemaBuiltInGroupName as Ts, EditorDocumentValue as Tt, diffEditorSchemaContracts as Tu, DescendantEntry as U, NodeTextRangeQuery as Ua, SelectionSetPointOptions as Uc, InternalEditorSchemaApi as Ui, TransferOutcome as Ul, EditorSchemaPlugin as Un, PluginUpdateFactoryContext as Uo, EditorTransactionEffectsApi as Ur, SchemaElementInput as Us, EditorLevelsOptions as Ut, move as Uu, DerivedEditorSchemaIdentity as V, NodeTextRangeEntry as Va, SelectionMoveOptions as Vc, InsertSoftBreakCommand as Vi, TransferLandingInput as Vl, EditorSchemaOverride as Vn, PluginTypes as Vo, EditorTransactionChangesApi as Vr, SchemaElementFor as Vs, EditorIsEditorOptions as Vt, locateAt as Vu, DescendantEntryIn as W, NodeTextRangeRoot as Wa, SelectionValue as Wc, JsonEditorValue as Wi, TransferPatch as Wl, EditorSchemaPluginProvider as Wn, PluginWitnessFor as Wo, EditorTransactionFragmentApi as Wr, SchemaElementProperties as Ws, EditorLifecycleError as Wt, nodeWriteVeto as Wu, EditorAboveOptions as X, NodeWrapNodesOptions as Xa, SliceLanding as Xc, LocationInterface as Xi, TransferRelation as Xl, EditorSchemaReadProperty as Xn, PointInterface as Xo, EditorTransactionRootsApi as Xr, SchemaElementPropertyValue as Xs, EditorNodeChangeHandler as Xt, schema$1 as Xu, Editor as Y, NodeUnwrapNodesOptions as Ya, SetSelectionCommand as Yc, LocationApi as Yi, TransferRefusalReason as Yl, EditorSchemaPropertyReadOptions as Yn, PointEntry as Yo, EditorTransactionRemoved as Yr, SchemaElementPropertyOptions as Ys, EditorNodeChangeContext as Yt, restoreEditorSchemaContract as Yu, EditorBlockOptions as Z, NodeWriteVeto as Za, SliceLandingInput as Zc, MarkKeysOf as Zi, TransferSide as Zl, EditorSchemaRepairCode as Zn, ProjectedRangeSegment as Zo, EditorTransactionSelectionApi as Zr, SchemaElementShapeFor as Zs, EditorNodeChangeKind as Zt, screenReaderAnnouncementEffect as Zu, AuthoredVeto as _, NodeHasPropsOptions as _a, SchemaPropertyReferences as _c, EditorValueFromOptions as _i, TextEntryOf as _l, EditorRootEntry as _n, PluginDefinitionInput as _o, EditorStateRangesApi as _r, RangeEdgesOptions as _s, EditorCommitRuntimeChangeKind as _t, defineEditorSchema as _u, AncestorIn as a, Node as aa, SchemaKeyPrefix as ac, transferVeto as ad, EditorUpdate as ai, StateFieldDescriptor as al, EditorRead as an, PlacedTarget as ao, EditorSchemaValidationPropertyContext as ar, PropertySetDescriptor as as, EditorCommandDispatch as at, TxMethodDeclarations as au, BasePoint as b, NodeInsertSplitOptions as ba, SchemaPropertyTypeChangePolicy as bc, EditorValueTypeProvider as bi, TextInsertFragmentOptions as bl, EditorSchemaContentRoot as bn, PluginDependencyReferenceFor as bo, EditorStateSelectionApi as br, RemoveMarkCommand as bs, EditorCoreUpdateTransaction as bt, definePluginSlot as bu, AnchorAssociation as c, NodeChildEntry as ca, SchemaProperty as cc, txSelection as cd, EditorUpdateMethods as ci, StateFieldValueInput as cl, EditorReadDescriptor as cn, PluginApiFactory as co, EditorSelectionBlockOptions as cr, PropertyValidation as cs, EditorCommandPlace as ct, ValueOf as cu, AnchorValue as d, NodeDuplicateOptions as da, SchemaPropertyExclusiveGroup as dc, EditorUpdateTag as di, Text as dl, EditorReadMethodTree as dn, PluginCandidateEditor as do, EditorSnapshot as dr, PropertyValueOf as ds, EditorCommit as dt, authoredVeto as du, MaximizeMode as ea, SchemaElementTarget as ec, setEditorReadOnly as ed, EditorTransactionTagsApi as ei, SnapshotInput as el, EditorNodeUnsetOptions as en, PathAncestorsOptions as eo, EditorSchemaStructureProperty as er, PropertyEnumDescriptor as es, EditorCanonicalUpdateTag as et, TransferTarget as eu, AnyEditor as f, NodeElementsOptions as fa, SchemaPropertyHandle as fc, EditorUpdateTagInput as fi, TextApi as fl, EditorReadMethods as fn, PluginCapabilities as fo, EditorStateField as fr, PropertyValueOptions as fs, EditorCommitChangeKind as ft, before$1 as fu, AuthoredTouch as g, NodeFindTextRangesOptions as ga, SchemaPropertyLandingPolicy as gc, EditorUpdateValueFromPlugin as gi, TextEntryIn as gl, EditorReplaceNodeOptions as gn, PluginDefinition as go, EditorStatePointsApi as gr, RangeDirection as gs, EditorCommitListener as gt, defineCommand$1 as gu, AuthoredProjectionRefusal as h, NodeEntryOf as ha, SchemaPropertyKey as hc, EditorUpdateTransactionProvider as hi, TextEntry as hl, EditorReplaceChildrenOptions as hn, PluginContributionInput as ho, EditorStateNodesApi as hr, RangeApi as hs, EditorCommitHandler as ht, decodeEditorEffect as hu, AncestorEntryOf as i, NamedRootKey as ia, SchemaGroupOptions as ic, transfer as id, EditorUniqueHolder as ii, StateFieldCollabPolicy as il, EditorPreviousOptions as in, PersistedDocumentInput as io, EditorSchemaValidationError as ir, PropertyOptionsOf as is, EditorCommandDescriptor as it, TxDeclaredMethod as iu, ContentSlice as j, NodeNodesOptions as ja, SchemaTypesTarget as jc, ElementOf as ji, ToggleMarkCommand as jl, EditorSchemaDefinition as jn, PluginReadFactory as jo, EditorToggleBlockOptions as jr, SchemaContentRoot as js, EditorEffectHistoryReplayResult as jt, getChildren as ju, CollapseSelectionCommand as k, NodeMoveNodesOptions as ka, SchemaTextPropertyKeys as kc, ElementInterface as ki, TextUnitAdjustment as kl, EditorSchemaContribution as kn, PluginPublicationError as ko, EditorTextChangeContext as kr, SchemaContentOptions as ks, EditorEffectCollabReplay as kt, encodeEditorEffect as ku, AnchorDeletionPolicy as l, NodeChildrenOptions as la, SchemaPropertyCopyPolicy as lc, unhangRange as ld, EditorUpdatePolicy as li, StructuralPlainTextDiagnostic as ll, EditorReadInput as ln, PluginApiFactoryContext as lo, EditorSelectionTargetOptions as lr, PropertyValueDescriptor as ls, EditorCommandResult as lt, WithNodeTarget as lu, AuthoredProjectionDiagnostic as m, NodeEntryIn as ma, SchemaPropertyIds as mc, EditorUpdateTransactionOf as mi, TextDirection as ml, EditorReadResult as mn, PluginContribution as mo, EditorStateMarksApi as mr, RangeAnchorAssociation as ms, EditorCommitContext as mt, createEditorView as mu, Ancestor as n, MoveUnit as na, SchemaGroup as nc, string as nd, EditorTransactionTopLevelRange as ni, SpanApi as nl, EditorNodesReadOptions as nn, PathInterface as no, EditorSchemaValidationCode as nr, PropertyJsonOptions as ns, EditorCommandAroundHandler as nt, TransferVetoInput as nu, AncestorOf as o, NodeAncestorsOptions as oa, SchemaNodeTypeProvider as oc, txLocate as od, EditorUpdateAnnotation as oi, StateFieldHistoryPolicy as ol, EditorReadAroundHandler as on, Plugin as oo, EditorSchemaVocabulary as or, PropertySetOptions as os, EditorCommandHandler as ot, TxOnlyMethod as ou, AuthoredDocumentProjection as p, NodeEntry as pa, SchemaPropertyHandleValue as pc, EditorUpdateTransaction as pi, TextDeleteOptions as pl, EditorReadRegistration as pn, PluginCleanupContext as po, EditorStateFragmentApi as pr, Range as ps, EditorCommitChanged as pt, compileEditorSchemaContract as pu, DescendantOf as q, NodeTypeSelector as qa, SerializedEditorValue as qc, LeafPosition as qi, TransferPlugin as ql, EditorSchemaPropertyOverrideInput as qn, Point as qo, EditorTransactionPluginsApi as qr, SchemaElementPropertyDefinition as qs, EditorMarksOf as qt, readEditorSchemaContract as qu, AncestorEntry as r, NamedEditorSchemaIdentity as ra, SchemaGroupNames as rc, target as rd, EditorTransactionValueApi as ri, SpanInterface as rl, EditorParentOptions as rn, PathLevelsOptions as ro, EditorSchemaValidationDiagnostic as rr, PropertyNumberDescriptor as rs, EditorCommandContinuation as rt, TransferWrap as ru, Anchor as s, NodeApi as sa, SchemaPluginsOf as sc, txOnly as sd, EditorUpdateContext as si, StateFieldInitial as sl, EditorReadContext as sn, PluginActivationContext as so, EditorSelection as sr, PropertyStringDescriptor as ss, EditorCommandInput as st, Value as su, AddMarkCommand as t, MoveSelectionCommand as ta, SchemaElementTypes as tc, setEditorViewing as td, EditorTransactionTextApi as ti, Span as tl, EditorNodesOptions as tn, PathApi as to, EditorSchemaUnknownPolicy as tr, PropertyJsonDescriptor as ts, EditorCommand as tt, TransferVeto as tu, AnchorOptions as u, NodeDescendantsOptions as ua, SchemaPropertyDefinition as uc, valueCodecs as ud, EditorUpdatePolicyFor as ui, TargetFreshnessRequest as ul, EditorReadMethodRecord as un, PluginCandidateContext as uo, EditorSliceReadOptions as ur, PropertyValueKind as us, EditorCommands as ut, after$1 as uu, BaseElement as v, NodeIn as va, SchemaPropertyRole as vc, EditorValueFromPlugins as vi, TextEqualsOptions as vl, EditorRootOwner as vn, PluginDependencyContractReference as vo, EditorStateRuntimeApi as vr, RangeInterface as vs, EditorCoreStateView as vt, defineEffect as vu, BlockInsertOptions as w, NodeLevelsOptions as wa, SchemaText as wc, ElementApi as wi, TextOf as wl, EditorSchemaContractContentProgram as wn, PluginInput as wo, EditorStateValueApi as wr, RootKey as ws, EditorDocumentRecords as wt, deleteForward as wu, BaseRange as x, NodeInterface as xa, SchemaRecordSet as xc, EditorView as xi, TextInsertTextOptions as xl, EditorSchemaContract as xn, PluginFactoryTypeLambda as xo, EditorStateSliceApi as xr, RemoveNodesCommand as xs, EditorDirectCommandDispatch as xt, defineStateField as xu, BaseNode as y, NodeInsertNodesOptions as ya, SchemaPropertySplitPolicy as yc, EditorValuePersistence as yi, TextIn as yl, EditorSchemaContent as yn, PluginDependencyReference as yo, EditorStateSchemaApi as yr, RangeMode as ys, EditorCoreUpdateMethods as yt, definePluginPoint as yu, DeleteCommand as z, NodeSplitNodesOptions as za, SelectionEdge as zc, InsertBreakCommand as zi, TransferInput as zl, EditorSchemaIdentity as zn, PluginTypeProvider as zo, EditorTransactionChangeHandler as zr, SchemaElement as zs, EditorInstalledReadGroups as zt, isBlock as zu };
@@ -1,5 +1,5 @@
1
- import { wr as EditorStateView, xa as NodeKey } from "./index-DpltOCot-A2b3p3Eb.js";
2
- import { Ga as DefinitionOf, Qn as HeadingLevel, _ as BasePlugin, u as Editor } from "./core-ClHasORr.js";
1
+ import { Ca as NodeKey, Tr as EditorStateView } from "./index-BXjLmx1n-CXk17buG.js";
2
+ import { Qn as HeadingLevel, _ as BasePlugin, qa as DefinitionOf, u as Editor } from "./core-BqR-fEDp.js";
3
3
  type Heading = {
4
4
  key: NodeKey;
5
5
  level: HeadingLevel;
@@ -1,6 +1,6 @@
1
- import { Si as Element, Zo as PropertyEnumDescriptor, eu as TxDeclaredMethod, ki as ElementOf, xa as NodeKey } from "./index-DpltOCot-A2b3p3Eb.js";
2
- import "./htmlTypes-cg_cWsaN.js";
3
- import { Ao as PluginSelectorMethods, _ as BasePlugin, ct as BlockInsertOptions, mo as NormalizePluginSelectors } from "./core-ClHasORr.js";
1
+ import { Ca as NodeKey, Ci as Element, es as PropertyEnumDescriptor, iu as TxDeclaredMethod, ji as ElementOf } from "./index-BXjLmx1n-CXk17buG.js";
2
+ import "./htmlTypes-eT2ZGDAj.js";
3
+ import { Mo as PluginSelectorMethods, _ as BasePlugin, ct as BlockInsertOptions, go as NormalizePluginSelectors } from "./core-BqR-fEDp.js";
4
4
  import { AggregateProgress, UploadCallOptions, UploadOutcome } from "files-sdk/client";
5
5
  declare const UPLOAD_FILE_TYPES: readonly ['image', 'video', 'audio', 'pdf', 'text', 'blob'];
6
6
  declare const UPLOAD_KINDS: readonly ['audio', 'file', 'image', 'video'];
@@ -1,8 +1,8 @@
1
- import { H as Descendant, Ps as SchemaContentRule, Si as Element, Vt as EditorJsonValue, Wo as Point, Za as Path, da as NodeEntry, eu as TxDeclaredMethod, is as PropertyStringDescriptor, ki as ElementOf, ws as SchemaContentDefault } from "./index-DpltOCot-A2b3p3Eb.js";
2
- import "./htmlTypes-cg_cWsaN.js";
3
- import { Ga as DefinitionOf, _ as BasePlugin, _t as NodeInsertOptions } from "./core-ClHasORr.js";
4
- import { n as ComboboxState, t as ComboboxEditor } from "./combobox-DAOYWuvC.js";
5
- import "./index-Cmuluh6f.js";
1
+ import { $a as Path, Ci as Element, Ds as SchemaContentDefault, H as Descendant, Ht as EditorJsonValue, Ls as SchemaContentRule, iu as TxDeclaredMethod, ji as ElementOf, pa as NodeEntry, qo as Point, ss as PropertyStringDescriptor } from "./index-BXjLmx1n-CXk17buG.js";
2
+ import "./htmlTypes-eT2ZGDAj.js";
3
+ import { _ as BasePlugin, _t as NodeInsertOptions, qa as DefinitionOf } from "./core-BqR-fEDp.js";
4
+ import { n as ComboboxState, t as ComboboxEditor } from "./combobox-Dr0OYZIE.js";
5
+ import "./index-BTx5oK7k.js";
6
6
  declare const isNonBlankRef: (value: unknown) => value is string;
7
7
  /** The fragment id of a footnote and, when present, its linked fragment id. */
8
8
  type FootnoteAnchor = {
@@ -1,8 +1,24 @@
1
- import { Qo as PropertyJsonDescriptor, Ws as SchemaElementPropertyDefinition, Yo as PropertyBooleanDescriptor, Zo as PropertyEnumDescriptor, eu as TxDeclaredMethod, is as PropertyStringDescriptor, ki as ElementOf, ls as PropertyValueOptions } from "./index-DpltOCot-A2b3p3Eb.js";
2
- import "./htmlTypes-cg_cWsaN.js";
3
- import { _ as BasePlugin, _t as NodeInsertOptions } from "./core-ClHasORr.js";
1
+ import { $a as Path, Qo as PropertyBooleanDescriptor, Tt as EditorDocumentValue, es as PropertyEnumDescriptor, fs as PropertyValueOptions, iu as TxDeclaredMethod, ji as ElementOf, qs as SchemaElementPropertyDefinition, ss as PropertyStringDescriptor, su as Value, ts as PropertyJsonDescriptor } from "./index-BXjLmx1n-CXk17buG.js";
2
+ import "./htmlTypes-eT2ZGDAj.js";
3
+ import { _ as BasePlugin, _t as NodeInsertOptions } from "./core-BqR-fEDp.js";
4
4
  import { nanoid } from "nanoid";
5
+ type FieldShape = Pick<FieldSettings, 'defaultValue' | 'kind' | 'options' | 'value'>;
5
6
  declare const FIELD_KINDS: readonly ['checkbox', 'choice', 'date', 'number', 'signature', 'text'];
7
+ /**
8
+ * The tests a condition may use on a field of each kind. `insert` and `update`
9
+ * refuse any other test, and a read reports it as `unsupported-test`.
10
+ */
11
+ declare const FIELD_TESTS: Readonly<Record<FieldKind, readonly FieldTest[]>>;
12
+ declare const isFieldValue: (value: unknown) => value is FieldValue;
13
+ declare const isFieldOptions: (value: unknown) => value is readonly FieldOption[];
14
+ declare const isFieldCondition: (value: unknown) => value is FieldCondition;
15
+ /**
16
+ * Whether a value fits a field's kind: a boolean for a checkbox, one of its
17
+ * options' values for a choice, an ISO date string for a date, a finite number
18
+ * other than -0 for a number, a string with no line break for a text field,
19
+ * and a string for a signature field.
20
+ */
21
+ declare const fitsField: ({ kind, options }: FieldShape, value: unknown) => value is FieldValue;
6
22
  /** What a field collects, which fixes the shape of its value. */
7
23
  type FieldKind = (typeof FIELD_KINDS)[number];
8
24
  /** A value a field stores: a string, a finite number or a boolean. */
@@ -32,14 +48,6 @@ type FieldCondition = Readonly<{
32
48
  * conditions leads back to it.
33
49
  */
34
50
  type FieldProblem = 'condition-loop' | 'invalid-value' | 'missing-target' | 'unsupported-test';
35
- /**
36
- * The tests a condition may use on a field of each kind. `insert` and `update`
37
- * refuse any other test, and a read reports it as `unsupported-test`.
38
- */
39
- declare const FIELD_TESTS: Readonly<Record<FieldKind, readonly FieldTest[]>>;
40
- declare const isFieldValue: (value: unknown) => value is FieldValue;
41
- declare const isFieldOptions: (value: unknown) => value is readonly FieldOption[];
42
- declare const isFieldCondition: (value: unknown) => value is FieldCondition;
43
51
  declare const fieldSchemaPlugin: BasePlugin<Readonly<{
44
52
  formats: true;
45
53
  }> & Readonly<{
@@ -336,20 +344,27 @@ type FieldSettings = Omit<FieldElement, 'children' | 'fieldId' | 'type'>;
336
344
  * What `update` changes. An optional setting given as `undefined` is removed.
337
345
  */
338
346
  type FieldPatch = Partial<FieldSettings>;
339
- /** A field as the plugin reads it, with what the read finds wrong with it. */
347
+ /**
348
+ * A field as the plugin reads it, with what the read finds wrong with it.
349
+ * `applies` says whether the field applies under its condition, as the field's
350
+ * own role sees the answers the document holds. It is `null` while that
351
+ * depends on an answer another role has not given yet, and `true` for a field
352
+ * with no condition or with a condition that has a problem or is in a loop. A
353
+ * condition whose target does not apply tests it as having no answer, an
354
+ * answer that does not fit its field's kind counts as none, and an unanswered
355
+ * checkbox of the field's own role reads as `false` while it applies.
356
+ */
340
357
  type FieldRead = Readonly<{
358
+ applies: boolean | null;
341
359
  fieldId: string;
342
360
  node: FieldElement;
343
361
  problems: readonly FieldProblem[];
344
362
  }>;
345
- type FieldShape = Pick<FieldSettings, 'defaultValue' | 'kind' | 'options' | 'value'>;
346
- /**
347
- * Whether a value fits a field's kind: a boolean for a checkbox, one of its
348
- * options' values for a choice, an ISO date string for a date, a finite number
349
- * other than -0 for a number, a string with no line break for a text field,
350
- * and a string for a signature field.
351
- */
352
- declare const fitsField: ({ kind, options }: FieldShape, value: unknown) => value is FieldValue;
363
+ /** One role's field values, keyed by `fieldId`. */
364
+ type FieldSubmission = Readonly<{
365
+ role: string;
366
+ values: Readonly<Record<string, FieldValue>>;
367
+ }>;
353
368
  /**
354
369
  * Fields: inline voids that each collect one value of a kind and hold a
355
370
  * document-wide unique `fieldId`. A field's `condition` names another field
@@ -650,6 +665,12 @@ declare const BaseFieldPlugin: BasePlugin<Readonly<{
650
665
  readonly field: (fieldId: string) => FieldRead | null;
651
666
  /** Every field of the document, in reading order. */
652
667
  readonly fields: () => FieldRead[];
668
+ /**
669
+ * The `value` of each field of `role` that holds one, keyed by
670
+ * `fieldId` and read from the field that id names, to pass to
671
+ * `applyFieldValues`.
672
+ */
673
+ readonly submission: (role: string) => FieldSubmission;
653
674
  };
654
675
  readonly update: {
655
676
  /**
@@ -675,4 +696,78 @@ declare const BaseFieldPlugin: BasePlugin<Readonly<{
675
696
  readonly update: TxDeclaredMethod<(fieldId: string, patch: FieldPatch) => void>;
676
697
  };
677
698
  }>> & Readonly<Record<never, never>>;
678
- export { FieldKind as a, FieldProblem as c, FieldTest as d, FieldValue as f, FieldElement as i, FieldRead as l, FIELD_TESTS as n, FieldOption as o, fitsField as p, FieldCondition as r, FieldPatch as s, BaseFieldPlugin as t, FieldSettings as u };
699
+ /** Why `applyFieldValues` refused a template or a submission. */
700
+ type FieldRefusal = Readonly<{
701
+ code: 'duplicate-role';
702
+ role: string;
703
+ }> | Readonly<{
704
+ code: 'invalid-template';
705
+ fieldId?: string;
706
+ path: Path;
707
+ problem: FieldProblem | 'answered' | 'duplicate-id' | 'malformed';
708
+ root?: string;
709
+ }> | Readonly<{
710
+ code: 'invalid-submission';
711
+ index: number;
712
+ }> | Readonly<{
713
+ code: 'invalid-value';
714
+ fieldId: string;
715
+ role: string;
716
+ }> | Readonly<{
717
+ code: 'missing-required';
718
+ fieldId: string;
719
+ role: string;
720
+ }> | Readonly<{
721
+ code: 'skipped';
722
+ fieldId: string;
723
+ role: string;
724
+ }> | Readonly<{
725
+ code: 'unknown-field';
726
+ fieldId: string;
727
+ role: string;
728
+ }> | Readonly<{
729
+ code: 'unknown-role';
730
+ role: string;
731
+ }> | Readonly<{
732
+ code: 'waiting';
733
+ fieldId: string;
734
+ role: string;
735
+ waitsOn: string;
736
+ }> | Readonly<{
737
+ code: 'wrong-role';
738
+ fieldId: string;
739
+ role: string;
740
+ }>;
741
+ /**
742
+ * The filled document, or the refusals. `pending` lists each role that has not
743
+ * submitted and holds a required field that applies or waits, and the role
744
+ * whose answer each such waiting field needs next.
745
+ */
746
+ type FieldApplyResult<D extends EditorDocumentValue | Value> = Readonly<{
747
+ document: D;
748
+ ok: true;
749
+ pending: readonly string[];
750
+ }> | Readonly<{
751
+ ok: false;
752
+ refusals: readonly [FieldRefusal, ...FieldRefusal[]];
753
+ }>;
754
+ /**
755
+ * Check each role's answers against a frozen template and build the filled
756
+ * document from the answers alone. `type` names the field element's type when
757
+ * the app renamed it with `schema.override`. `submissions` are in the order
758
+ * the roles submitted, and each is checked against the roles before it plus
759
+ * its own answers. A submitted role's checkbox with no answer reads as `false`
760
+ * while it applies.
761
+ *
762
+ * Refuses a template whose fields hold an answer, lack or repeat a `fieldId`,
763
+ * break the schema or have a problem a read reports, a condition loop
764
+ * included. Then refuses, at the first submission that has any: a malformed
765
+ * submission, a role that submitted before or owns no field, an answer for a
766
+ * field that is missing, of another role or does not fit it, a field of the
767
+ * role that waits on another role, a filled answer on a skipped field, and a
768
+ * required field that applies without a filled answer.
769
+ */
770
+ declare function applyFieldValues<D extends EditorDocumentValue | Value>(template: D, submissions: readonly FieldSubmission[], options?: Readonly<{
771
+ type?: string;
772
+ }>): FieldApplyResult<D extends Value ? Value : EditorDocumentValue>;
773
+ export { fitsField as _, FieldCondition as a, isFieldValue as b, FieldOption as c, FieldRead as d, FieldSettings as f, FIELD_TESTS as g, FieldValue as h, BaseFieldPlugin as i, FieldPatch as l, FieldTest as m, FieldRefusal as n, FieldElement as o, FieldSubmission as p, applyFieldValues as r, FieldKind as s, FieldApplyResult as t, FieldProblem as u, isFieldCondition as v, isFieldOptions as y };
@@ -1,6 +1,6 @@
1
- import { H as Descendant, Qo as PropertyJsonDescriptor, Si as Element, Vs as SchemaElementProperties, Vt as EditorJsonValue, Ws as SchemaElementPropertyDefinition, Zo as PropertyEnumDescriptor, _c as SchemaPropertyTypeChangePolicy, cs as PropertyValueOf, es as PropertyNumberDescriptor, eu as TxDeclaredMethod, gc as SchemaPropertySplitPolicy, hc as SchemaPropertyRole, is as PropertyStringDescriptor, j as ContentSlice, ki as ElementOf, ls as PropertyValueOptions, oc as SchemaPropertyCopyPolicy, os as PropertyValueDescriptor, pc as SchemaPropertyLandingPolicy, ri as EditorUniqueHolder, ss as PropertyValueKind, xa as NodeKey } from "./index-DpltOCot-A2b3p3Eb.js";
2
- import "./htmlTypes-cg_cWsaN.js";
3
- import { Ga as DefinitionOf, _ as BasePlugin, ct as BlockInsertOptions } from "./core-ClHasORr.js";
1
+ import { Ca as NodeKey, Ci as Element, H as Descendant, Ht as EditorJsonValue, Ws as SchemaElementProperties, bc as SchemaPropertyTypeChangePolicy, ds as PropertyValueOf, es as PropertyEnumDescriptor, fs as PropertyValueOptions, gc as SchemaPropertyLandingPolicy, ii as EditorUniqueHolder, iu as TxDeclaredMethod, j as ContentSlice, ji as ElementOf, lc as SchemaPropertyCopyPolicy, ls as PropertyValueDescriptor, qs as SchemaElementPropertyDefinition, rs as PropertyNumberDescriptor, ss as PropertyStringDescriptor, ts as PropertyJsonDescriptor, us as PropertyValueKind, vc as SchemaPropertyRole, yc as SchemaPropertySplitPolicy } from "./index-BXjLmx1n-CXk17buG.js";
2
+ import "./htmlTypes-eT2ZGDAj.js";
3
+ import { _ as BasePlugin, ct as BlockInsertOptions, qa as DefinitionOf } from "./core-BqR-fEDp.js";
4
4
  import { nanoid } from "nanoid";
5
5
  declare const BOARD_DASHES: readonly ['dashed', 'dotted', 'solid'];
6
6
  declare const BOARD_STYLE_SIZES: readonly ['l', 'm', 's', 'xl'];
@@ -1,6 +1,6 @@
1
- import { Mo as PluginReference, Tt as EditorDocumentValue, Xn as EditorSchemaRepairCode, j as ContentSlice, m as AuthoredProjectionDiagnostic, nr as EditorSchemaValidationDiagnostic, ru as Value, xs as RootKey } from "./index-DpltOCot-A2b3p3Eb.js";
2
- import { h as EditorApplicationSchema } from "./htmlTypes-cg_cWsaN.js";
3
- import { Ga as DefinitionOf, _ as BasePlugin, u as Editor } from "./core-ClHasORr.js";
1
+ import { Fo as PluginReference, Qo as PropertyBooleanDescriptor, Tt as EditorDocumentValue, Zn as EditorSchemaRepairCode, j as ContentSlice, m as AuthoredProjectionDiagnostic, rr as EditorSchemaValidationDiagnostic, su as Value, ws as RootKey } from "./index-BXjLmx1n-CXk17buG.js";
2
+ import { h as EditorApplicationSchema } from "./htmlTypes-eT2ZGDAj.js";
3
+ import { _ as BasePlugin, qa as DefinitionOf, u as Editor } from "./core-BqR-fEDp.js";
4
4
  import { Association, Blockquote, Break, Code, Emphasis, Heading, Html, Image, InlineCode, Link, List, ListItem, Nodes, Paragraph, Parents, PhrasingContent, Root, Strong, TableCell, TableRow, Text, ThematicBreak } from "mdast";
5
5
  import "mdast-util-math";
6
6
  import { MdxJsxFlowElement, MdxJsxTextElement } from "mdast-util-mdx";
@@ -190,7 +190,10 @@ type MarkdownParsePolicy = Readonly<{
190
190
  }>;
191
191
  type MarkdownSerializePolicy = Readonly<{
192
192
  lossPolicy?: 'allow' | 'reject';
193
- /** Mark keys written as plain text without Markdown formatting. */
193
+ /**
194
+ * Mark keys written as plain text without Markdown formatting. Naming
195
+ * `rawHtml` writes text that `RawHtmlPlugin` marked as escaped text.
196
+ */
194
197
  plainMarks?: readonly string[] | null;
195
198
  preserveEmptyParagraphs?: boolean;
196
199
  /**
@@ -1115,7 +1118,11 @@ interface Unsafe {
1115
1118
  unicode?: boolean | null | undefined;
1116
1119
  }
1117
1120
  type MarkdownPluginState = {
1118
- /** Mark keys serialized as plain text. */
1121
+ /**
1122
+ * Mark keys serialized as plain text. Naming `rawHtml` also stops import
1123
+ * from marking raw HTML, so tags stay plain text and comment blocks drop
1124
+ * with `RawHtmlPlugin` installed.
1125
+ */
1119
1126
  plainMarks: readonly string[] | null;
1120
1127
  /** Remark plugins used for parsing and serialization. */
1121
1128
  remarkPlugins: readonly MarkdownSyncPluggable[];
@@ -1215,4 +1222,38 @@ type MarkdownEditor<E = Editor, V extends Value = Value> = E & {
1215
1222
  markdown: MarkdownApi<V>;
1216
1223
  };
1217
1224
  };
1218
- export { MarkdownSerializeResult as C, MarkdownSyncPlugin as D, MarkdownSyncPluggable as E, MarkdownSyncTransformer as O, MarkdownSerializePolicy as S, MarkdownSourceLocation as T, MarkdownModelLocation as _, MarkdownPluginState as a, MarkdownParsePolicy as b, Handle as c, getMarkdownFrontmatter as d, MarkdownDiagnostic as f, MarkdownFrontmatter as g, MarkdownErrorDiagnostic as h, MarkdownPlugin as i, MarkdownWarningDiagnostic as k, Join as l, MarkdownEditorSerializeOptions as m, MarkdownDefinition as n, parseMarkdown as o, MarkdownDocumentParseResult as p, MarkdownEditor as r, serializeMarkdown as s, MarkdownApi as t, Unsafe as u, MarkdownParseLimits as v, MarkdownSliceParseResult as w, MarkdownSerializeOptions as x, MarkdownParseOptions as y };
1225
+ /**
1226
+ * Marks text that Markdown import kept from raw HTML, such as a README's
1227
+ * centered header or an HTML comment, so Markdown export writes it back as
1228
+ * HTML when its block passes Plate's safety check and as escaped text
1229
+ * otherwise. Install it beside `MarkdownPlugin`. Every other format writes the
1230
+ * text as plain visible text.
1231
+ */
1232
+ declare const RawHtmlPlugin: BasePlugin<Readonly<{
1233
+ formats: true;
1234
+ }> & Readonly<{
1235
+ name: "rawHtml";
1236
+ }> & Readonly<Record<never, never>> & Readonly<{
1237
+ __pluginWritableProperties: Readonly<{
1238
+ descriptor: PropertyBooleanDescriptor<{
1239
+ readonly default: false;
1240
+ readonly omitDefault: true;
1241
+ }>;
1242
+ key: "rawHtml";
1243
+ localId: "rawHtml";
1244
+ ownerName: "rawHtml";
1245
+ placement: "text";
1246
+ unaliased: true;
1247
+ value: boolean;
1248
+ }>;
1249
+ schema: {
1250
+ readonly mark: {
1251
+ readonly inclusive: false;
1252
+ readonly property: PropertyBooleanDescriptor<{
1253
+ readonly default: false;
1254
+ readonly omitDefault: true;
1255
+ }>;
1256
+ };
1257
+ };
1258
+ }>>;
1259
+ export { MarkdownWarningDiagnostic as A, MarkdownSerializePolicy as C, MarkdownSyncPluggable as D, MarkdownSourceLocation as E, MarkdownSyncPlugin as O, MarkdownSerializeOptions as S, MarkdownSliceParseResult as T, MarkdownFrontmatter as _, MarkdownPlugin as a, MarkdownParseOptions as b, serializeMarkdown as c, Unsafe as d, getMarkdownFrontmatter as f, MarkdownErrorDiagnostic as g, MarkdownEditorSerializeOptions as h, MarkdownEditor as i, MarkdownSyncTransformer as k, Handle as l, MarkdownDocumentParseResult as m, MarkdownApi as n, MarkdownPluginState as o, MarkdownDiagnostic as p, MarkdownDefinition as r, parseMarkdown as s, RawHtmlPlugin as t, Join as u, MarkdownModelLocation as v, MarkdownSerializeResult as w, MarkdownParsePolicy as x, MarkdownParseLimits as y };