@pixerate/editor 0.23.0 → 0.24.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (155) hide show
  1. package/README.md +96 -1
  2. package/THIRD_PARTY_NOTICES.md +51 -0
  3. package/dist/agent/index.cjs +9 -8
  4. package/dist/agent/index.cjs.map +1 -1
  5. package/dist/agent/index.d.cts +4 -3
  6. package/dist/agent/index.d.ts +4 -3
  7. package/dist/agent/index.js +3 -2
  8. package/dist/agent/index.js.map +1 -1
  9. package/dist/canvas/index.cjs +1210 -17
  10. package/dist/canvas/index.cjs.map +1 -1
  11. package/dist/canvas/index.d.cts +318 -1
  12. package/dist/canvas/index.d.ts +318 -1
  13. package/dist/canvas/index.js +1199 -6
  14. package/dist/canvas/index.js.map +1 -1
  15. package/dist/{chunk-QBJ22YZR.js → chunk-3CN2WD3X.js} +1354 -206
  16. package/dist/chunk-3CN2WD3X.js.map +1 -0
  17. package/dist/{chunk-JJDLPEWL.js → chunk-3LV6RRPH.js} +2 -2
  18. package/dist/{chunk-MJZBNWG7.js → chunk-5S3Z4PPF.js} +78 -557
  19. package/dist/chunk-5S3Z4PPF.js.map +1 -0
  20. package/dist/chunk-664LQYFJ.js +115 -0
  21. package/dist/chunk-664LQYFJ.js.map +1 -0
  22. package/dist/{chunk-AA4ZEVCC.cjs → chunk-D27YFC46.cjs} +101 -580
  23. package/dist/chunk-D27YFC46.cjs.map +1 -0
  24. package/dist/chunk-D6FH2YAX.cjs +131 -0
  25. package/dist/chunk-D6FH2YAX.cjs.map +1 -0
  26. package/dist/{chunk-4SUNJZWB.cjs → chunk-FD4LPFAE.cjs} +48 -200
  27. package/dist/chunk-FD4LPFAE.cjs.map +1 -0
  28. package/dist/chunk-FODNLX5N.js +749 -0
  29. package/dist/chunk-FODNLX5N.js.map +1 -0
  30. package/dist/{chunk-OYXSKQFR.js → chunk-FPENXAEJ.js} +35 -187
  31. package/dist/chunk-FPENXAEJ.js.map +1 -0
  32. package/dist/chunk-HLIMTC6N.js +1 -0
  33. package/dist/chunk-HLIMTC6N.js.map +1 -0
  34. package/dist/{chunk-QGHGJ56O.js → chunk-ITBSKI26.js} +1483 -19
  35. package/dist/chunk-ITBSKI26.js.map +1 -0
  36. package/dist/{chunk-XDMXXC4Z.cjs → chunk-MA2F5KHF.cjs} +350 -227
  37. package/dist/chunk-MA2F5KHF.cjs.map +1 -0
  38. package/dist/{chunk-RIKBJLS2.cjs → chunk-MCSJFWAO.cjs} +1356 -208
  39. package/dist/chunk-MCSJFWAO.cjs.map +1 -0
  40. package/dist/chunk-MKA3AHLV.cjs +256 -0
  41. package/dist/chunk-MKA3AHLV.cjs.map +1 -0
  42. package/dist/chunk-OLZJXL4R.cjs +749 -0
  43. package/dist/chunk-OLZJXL4R.cjs.map +1 -0
  44. package/dist/chunk-OXSV64JX.js +689 -0
  45. package/dist/chunk-OXSV64JX.js.map +1 -0
  46. package/dist/chunk-P3RQ5UJE.cjs +689 -0
  47. package/dist/chunk-P3RQ5UJE.cjs.map +1 -0
  48. package/dist/chunk-P6ODPZ4W.js +256 -0
  49. package/dist/chunk-P6ODPZ4W.js.map +1 -0
  50. package/dist/chunk-PGNZKFQS.js +685 -0
  51. package/dist/chunk-PGNZKFQS.js.map +1 -0
  52. package/dist/chunk-PL4JB3BF.cjs +1 -0
  53. package/dist/chunk-PL4JB3BF.cjs.map +1 -0
  54. package/dist/{chunk-GVSMRPHB.cjs → chunk-SBCZ6RN5.cjs} +1568 -104
  55. package/dist/chunk-SBCZ6RN5.cjs.map +1 -0
  56. package/dist/{chunk-CL37JGFW.cjs → chunk-SML64VJG.cjs} +4 -4
  57. package/dist/{chunk-CL37JGFW.cjs.map → chunk-SML64VJG.cjs.map} +1 -1
  58. package/dist/chunk-TNNJXF46.cjs +115 -0
  59. package/dist/chunk-TNNJXF46.cjs.map +1 -0
  60. package/dist/chunk-U5HZSFCS.js +131 -0
  61. package/dist/chunk-U5HZSFCS.js.map +1 -0
  62. package/dist/{chunk-K3R5NG2D.js → chunk-U5KWZU4X.js} +251 -128
  63. package/dist/chunk-U5KWZU4X.js.map +1 -0
  64. package/dist/chunk-XNORY7M6.cjs +685 -0
  65. package/dist/chunk-XNORY7M6.cjs.map +1 -0
  66. package/dist/commands/index.d.cts +5 -353
  67. package/dist/commands/index.d.ts +5 -353
  68. package/dist/comment-store-BEMgVlAA.d.cts +135 -0
  69. package/dist/comment-store-BEMgVlAA.d.ts +135 -0
  70. package/dist/compare/index.cjs +15 -0
  71. package/dist/compare/index.cjs.map +1 -0
  72. package/dist/compare/index.d.cts +58 -0
  73. package/dist/compare/index.d.ts +58 -0
  74. package/dist/compare/index.js +15 -0
  75. package/dist/compare/index.js.map +1 -0
  76. package/dist/{controller-pePCJLT1.d.cts → controller-BhLLAoi8.d.cts} +45 -4
  77. package/dist/{controller-pePCJLT1.d.ts → controller-BhLLAoi8.d.ts} +45 -4
  78. package/dist/documents-BQjzJNe2.d.ts +76 -0
  79. package/dist/documents-KRTPhvst.d.cts +76 -0
  80. package/dist/extensions/index.cjs +53 -5
  81. package/dist/extensions/index.cjs.map +1 -1
  82. package/dist/extensions/index.d.cts +7 -3
  83. package/dist/extensions/index.d.ts +7 -3
  84. package/dist/extensions/index.js +52 -4
  85. package/dist/generation/index.cjs +1373 -0
  86. package/dist/generation/index.cjs.map +1 -0
  87. package/dist/generation/index.d.cts +554 -0
  88. package/dist/generation/index.d.ts +554 -0
  89. package/dist/generation/index.js +1373 -0
  90. package/dist/generation/index.js.map +1 -0
  91. package/dist/grammar/index.cjs +48 -3
  92. package/dist/grammar/index.cjs.map +1 -1
  93. package/dist/grammar/index.d.cts +322 -100
  94. package/dist/grammar/index.d.ts +322 -100
  95. package/dist/grammar/index.js +54 -9
  96. package/dist/image-editor/index.cjs +1831 -30
  97. package/dist/image-editor/index.cjs.map +1 -1
  98. package/dist/image-editor/index.d.cts +590 -3
  99. package/dist/image-editor/index.d.ts +590 -3
  100. package/dist/image-editor/index.js +1807 -6
  101. package/dist/image-editor/index.js.map +1 -1
  102. package/dist/{index-CCr_z9kF.d.cts → index-BhJBSm2d.d.cts} +370 -4
  103. package/dist/{index-Ck6ajwXh.d.ts → index-fJrlkJCd.d.ts} +370 -4
  104. package/dist/index.cjs +162 -25
  105. package/dist/index.cjs.map +1 -1
  106. package/dist/index.d.cts +14 -8
  107. package/dist/index.d.ts +14 -8
  108. package/dist/index.js +174 -37
  109. package/dist/index.js.map +1 -1
  110. package/dist/migrate-iTlm3a8h.d.cts +112 -0
  111. package/dist/migrate-iTlm3a8h.d.ts +112 -0
  112. package/dist/persistence/index.cjs +676 -0
  113. package/dist/persistence/index.cjs.map +1 -0
  114. package/dist/persistence/index.d.cts +347 -0
  115. package/dist/persistence/index.d.ts +347 -0
  116. package/dist/persistence/index.js +676 -0
  117. package/dist/persistence/index.js.map +1 -0
  118. package/dist/{registry-D5-R90p0.d.cts → registry-BDe-vlv3.d.ts} +2 -40
  119. package/dist/registry-D32LpIc4.d.cts +354 -0
  120. package/dist/{registry-D5-R90p0.d.ts → registry-DnzpgY27.d.cts} +2 -40
  121. package/dist/registry-evKTP4ls.d.ts +354 -0
  122. package/dist/schema-DYDGdYL9.d.cts +41 -0
  123. package/dist/schema-DYDGdYL9.d.ts +41 -0
  124. package/dist/serializers/index.cjs +4 -3
  125. package/dist/serializers/index.cjs.map +1 -1
  126. package/dist/serializers/index.d.cts +2 -1
  127. package/dist/serializers/index.d.ts +2 -1
  128. package/dist/serializers/index.js +3 -2
  129. package/dist/sourcemap-C8AH3MBQ.d.cts +91 -0
  130. package/dist/sourcemap-DA1Evhrv.d.ts +91 -0
  131. package/dist/spreadsheet/index.cjs +37 -3
  132. package/dist/spreadsheet/index.cjs.map +1 -1
  133. package/dist/spreadsheet/index.d.cts +188 -17
  134. package/dist/spreadsheet/index.d.ts +188 -17
  135. package/dist/spreadsheet/index.js +43 -9
  136. package/dist/{tokens-CyLZmIei.d.cts → tokens-D7yXvUU6.d.cts} +15 -2
  137. package/dist/{tokens-CyLZmIei.d.ts → tokens-D7yXvUU6.d.ts} +15 -2
  138. package/dist/{track-changes-BSF58RK0.d.ts → track-changes-BK5sVf4_.d.cts} +18 -136
  139. package/dist/{track-changes-BSF58RK0.d.cts → track-changes-CDjCrwKe.d.ts} +18 -136
  140. package/package.json +16 -1
  141. package/dist/chunk-4SUNJZWB.cjs.map +0 -1
  142. package/dist/chunk-AA4ZEVCC.cjs.map +0 -1
  143. package/dist/chunk-AXV2ZW34.cjs +0 -118
  144. package/dist/chunk-AXV2ZW34.cjs.map +0 -1
  145. package/dist/chunk-B2ZRLN4S.js +0 -118
  146. package/dist/chunk-B2ZRLN4S.js.map +0 -1
  147. package/dist/chunk-GVSMRPHB.cjs.map +0 -1
  148. package/dist/chunk-K3R5NG2D.js.map +0 -1
  149. package/dist/chunk-MJZBNWG7.js.map +0 -1
  150. package/dist/chunk-OYXSKQFR.js.map +0 -1
  151. package/dist/chunk-QBJ22YZR.js.map +0 -1
  152. package/dist/chunk-QGHGJ56O.js.map +0 -1
  153. package/dist/chunk-RIKBJLS2.cjs.map +0 -1
  154. package/dist/chunk-XDMXXC4Z.cjs.map +0 -1
  155. /package/dist/{chunk-JJDLPEWL.js.map → chunk-3LV6RRPH.js.map} +0 -0
@@ -1,12 +1,15 @@
1
1
  import { Mark, Extension, Node, Editor, Extensions } from '@tiptap/core';
2
- import { C as ColorGradient, f as Template } from './tokens-CyLZmIei.cjs';
2
+ import { C as ColorGradient, T as Template } from './tokens-D7yXvUU6.cjs';
3
3
  import { EditorState, PluginKey, Transaction } from '@tiptap/pm/state';
4
4
  import { DecorationSet, EditorView } from '@tiptap/pm/view';
5
5
  import { Node as Node$1 } from '@tiptap/pm/model';
6
- import { R as ReviewAuthor, b as CommentStore, C as CommentAnchor, i as MentionOptions, k as TrackChangesOptions } from './track-changes-BSF58RK0.cjs';
6
+ import { b as MentionOptions, d as TrackChangesOptions } from './track-changes-BK5sVf4_.cjs';
7
7
  import { MarkdownOptions } from 'tiptap-markdown';
8
8
  import { ImageOptions as ImageOptions$1 } from '@tiptap/extension-image';
9
+ import { R as ReviewAuthor, b as CommentStore, C as CommentAnchor } from './comment-store-BEMgVlAA.cjs';
9
10
  import { c as ImportAdapter, I as ImportAdapterRegistry, b as FindImportAdapterQuery, i as ImportTarget, h as ImportInput, g as ImportFileOptions, a as ImportOutcome, R as RegisterImportAdapterOptions, F as FileLike } from './registry-GJI4gToU.cjs';
11
+ import { b as CompareSource, C as CompareDocumentsOptions, a as CompareDocumentsResult } from './documents-KRTPhvst.cjs';
12
+ import { c as CommandSpec } from './registry-D32LpIc4.cjs';
10
13
 
11
14
  interface GradientTextOptions {
12
15
  templateColorMap: Map<string, ColorGradient>;
@@ -854,6 +857,310 @@ declare function tableOfContentsMarkdownIt(md: any): void;
854
857
  */
855
858
  declare function footnotesMarkdownIt(md: any): void;
856
859
 
860
+ /**
861
+ * Word's Find and Replace patterns: special characters (`^p`, `^t`, `^#` …),
862
+ * the "Use wildcards" language (`?`, `*`, `[a-z]`, `[!x]`, `{n,m}`, `@`, `<`,
863
+ * `>`, `( )`) and a raw regular-expression mode.
864
+ *
865
+ * Special and wildcard patterns are compiled to a small program run by a
866
+ * Pike VM, which takes time linear in the text for a given pattern, so no
867
+ * Find text can backtrack catastrophically (JavaScript's `RegExp` would). The
868
+ * raw regex mode uses the native `RegExp` engine; it rejects nested
869
+ * repetition and is bounded by the search budget between matches only.
870
+ *
871
+ * Pure TypeScript: no ProseMirror or DOM.
872
+ */
873
+ /** A paragraph mark in the searched text (`^p`). */
874
+ declare const FIND_PARAGRAPH_MARK = "\r";
875
+ /** Longest Find what text, in characters. */
876
+ declare const MAX_FIND_PATTERN_LENGTH = 1024;
877
+ interface FindOptions {
878
+ matchCase?: boolean;
879
+ /** Find whole words only (ignored with wildcards, like Word). */
880
+ wholeWord?: boolean;
881
+ /** The match must start a word. */
882
+ matchPrefix?: boolean;
883
+ /** The match must end a word. */
884
+ matchSuffix?: boolean;
885
+ /** Skip punctuation between the characters of the Find text. */
886
+ ignorePunctuation?: boolean;
887
+ /** Skip spaces and tabs between the characters of the Find text. */
888
+ ignoreWhitespace?: boolean;
889
+ /** Word's "Use wildcards". Always matches case. */
890
+ wildcards?: boolean;
891
+ /** A JavaScript regular expression (wins over `wildcards`). Replace text is literal. */
892
+ regex?: boolean;
893
+ /** Read the Find and Replace text literally: no `^` codes. */
894
+ literal?: boolean;
895
+ }
896
+ type FindPatternErrorCode = "too_long" | "invalid_pattern" | "too_complex";
897
+ /** Why a Find text cannot be used. Commands report it; they never throw it. */
898
+ interface FindPatternError {
899
+ code: FindPatternErrorCode;
900
+ message: string;
901
+ }
902
+ /** One match in a searched string (UTF-16 offsets). */
903
+ interface PatternMatch {
904
+ start: number;
905
+ end: number;
906
+ /** Text of each group; index 0 is the whole match, unmatched groups are `undefined`. */
907
+ groups: (string | undefined)[];
908
+ }
909
+ /** Shared limit on the work one search may do. */
910
+ interface SearchBudget {
911
+ /** `performance.now()`/`Date.now()` value after which the search stops. */
912
+ deadline: number;
913
+ /** VM steps left. */
914
+ steps: number;
915
+ /** Set once the budget ran out. */
916
+ exhausted: boolean;
917
+ }
918
+ interface SearchBudgetOptions {
919
+ /** Wall-clock limit in milliseconds (default 250). */
920
+ timeLimitMs?: number;
921
+ /** Pike VM thread steps (default 50 million). */
922
+ maxSteps?: number;
923
+ }
924
+ declare function createSearchBudget(options?: SearchBudgetOptions): SearchBudget;
925
+ interface CompiledFindPattern {
926
+ mode: "special" | "wildcards" | "regex";
927
+ /** The pattern can match a paragraph mark, so paragraphs must be read together. */
928
+ spansParagraphs: boolean;
929
+ caseInsensitive: boolean;
930
+ /** Number of capture groups (not counting the whole match). */
931
+ groupCount: number;
932
+ /**
933
+ * The leftmost match in `hay[start, end)`; text outside the range is
934
+ * context for word assertions. `"budget"` when the budget ran out.
935
+ */
936
+ exec(hay: string, start: number, end: number, budget: SearchBudget): PatternMatch | null | "budget";
937
+ }
938
+ type CompileFindPatternResult = {
939
+ ok: true;
940
+ pattern: CompiledFindPattern;
941
+ } | {
942
+ ok: false;
943
+ error: FindPatternError;
944
+ };
945
+ /** Simple (one code point to one code point) lower-case fold. */
946
+ declare function foldCodePoint(cp: number): number;
947
+ /** Translates Word's Find what text. Never throws: invalid text returns `{ ok: false, error }`. */
948
+ declare function compileFindPattern(query: string, options?: FindOptions): CompileFindPatternResult;
949
+ interface FindAllOptions {
950
+ /**
951
+ * Offsets where the live text breaks (e.g. where tracked-deleted text was
952
+ * skipped): no match spans a cut.
953
+ */
954
+ cuts?: readonly number[];
955
+ budget?: SearchBudget;
956
+ /** Stop after this many matches (default 10 000). */
957
+ maxMatches?: number;
958
+ }
959
+ interface FindAllResult {
960
+ matches: PatternMatch[];
961
+ /** The search stopped early (match cap or time budget). */
962
+ truncated: boolean;
963
+ }
964
+ /**
965
+ * Every non-empty match in `hay`, left to right, without overlaps. Empty
966
+ * matches are stepped past so the search always moves on.
967
+ */
968
+ declare function findAllMatches(pattern: CompiledFindPattern, hay: string, options?: FindAllOptions): FindAllResult;
969
+ /** A piece of Replace with text. */
970
+ type ReplacePiece = {
971
+ type: "text";
972
+ text: string;
973
+ }
974
+ /** `^&`: the text found. */
975
+ | {
976
+ type: "found";
977
+ }
978
+ /** `\n` with wildcards: group `n`. */
979
+ | {
980
+ type: "group";
981
+ index: number;
982
+ }
983
+ /** `^c`: the clipboard. */
984
+ | {
985
+ type: "clipboard";
986
+ };
987
+ /** Reads Replace with text: `^` codes (unless `literal`), and `\1`–`\9` with wildcards. Regex mode is literal. */
988
+ declare function parseReplacement(replacement: string, options?: FindOptions): ReplacePiece[];
989
+ /** Fills in Replace with text for one match. Paragraph marks in the result are `\r`. */
990
+ declare function expandReplacement(pieces: readonly ReplacePiece[], match: PatternMatch, clipboardText?: string): string;
991
+
992
+ interface FindMatch {
993
+ /** Document position of the first matched character. */
994
+ from: number;
995
+ /** Document position after the last matched character. */
996
+ to: number;
997
+ /** The matched text (`\r` for paragraph marks, `\n` for hard breaks). */
998
+ text: string;
999
+ /** The Replace with text for this match (`\r` splits paragraphs). */
1000
+ replacement: string;
1001
+ }
1002
+ interface DocumentSearchOptions {
1003
+ /** Replace with text (`^&`, `^c`, `\1`…). */
1004
+ replacement?: string;
1005
+ /** Text of `^c` in the replacement. */
1006
+ clipboardText?: string;
1007
+ /** Wall-clock budget for the whole search (default 250 ms). */
1008
+ timeLimitMs?: number;
1009
+ /** Match cap (default 10 000). */
1010
+ maxMatches?: number;
1011
+ }
1012
+ interface DocumentSearchResult {
1013
+ matches: FindMatch[];
1014
+ /** The search stopped early at the match cap or time budget. */
1015
+ truncated: boolean;
1016
+ error: FindPatternError | null;
1017
+ }
1018
+ /**
1019
+ * Finds `query` in a document. Each textblock is read as text without
1020
+ * tracked-deleted runs (a deletion "cuts" the text, so no match spans it, but
1021
+ * word boundaries see the live text on both sides); a pattern that can match
1022
+ * `^p` reads runs of sibling textblocks as one text with `\r` between them.
1023
+ */
1024
+ declare function searchDocument(doc: Node$1, query: string, options?: FindOptions, searchOptions?: DocumentSearchOptions): DocumentSearchResult;
1025
+ /**
1026
+ * Replaces matches in one transaction, last first so earlier positions stay
1027
+ * valid. A paragraph mark (`\r` or U+2029) in a replacement splits the
1028
+ * paragraph. Returns the mapped end of each replacement (in match order).
1029
+ */
1030
+ declare function applyReplacements(tr: Transaction, matches: readonly FindMatch[]): number[];
1031
+
1032
+ type FindReplaceMode = "find" | "replace";
1033
+ /** Everything a find bar needs. Snapshots are cached, so they suit `useSyncExternalStore`. */
1034
+ interface FindReplaceSnapshot {
1035
+ /** Whether the find bar should be shown (`openFindReplace` / Mod+F). */
1036
+ open: boolean;
1037
+ mode: FindReplaceMode;
1038
+ query: string;
1039
+ replacement: string;
1040
+ options: Readonly<FindOptions>;
1041
+ matches: readonly FindMatch[];
1042
+ /** Index of the current match, or -1. */
1043
+ currentIndex: number;
1044
+ error: FindPatternError | null;
1045
+ /** The search stopped at the match cap or time budget. */
1046
+ truncated: boolean;
1047
+ /** Replacements made by the last `replaceAll` / `replaceCurrent` (`null` before any). */
1048
+ lastReplaceCount: number | null;
1049
+ /** Bumped whenever the bar is asked to focus its find field (Mod+F while open). */
1050
+ focusRequest: number;
1051
+ }
1052
+ declare const EMPTY_FIND_REPLACE_SNAPSHOT: FindReplaceSnapshot;
1053
+ /**
1054
+ * External store over the find state. `subscribe` calls the listener
1055
+ * immediately (Svelte store contract).
1056
+ */
1057
+ declare class FindReplaceStore {
1058
+ private snapshot;
1059
+ private listeners;
1060
+ subscribe: (listener: (snapshot: FindReplaceSnapshot) => void) => (() => void);
1061
+ getSnapshot: () => FindReplaceSnapshot;
1062
+ /** @internal Called by the extension's plugin view. */
1063
+ set(snapshot: FindReplaceSnapshot): void;
1064
+ }
1065
+ interface FindReplaceOptions {
1066
+ /** Bind Mod+F / Mod+H (and Mod+Shift+H) to open the bar, F3 / Mod+G to step. Default `true`. */
1067
+ shortcuts: boolean;
1068
+ /** Class of every match. */
1069
+ matchClass: string;
1070
+ /** Class of the current match. */
1071
+ currentMatchClass: string;
1072
+ /** Wall-clock budget per search in milliseconds (default 250). */
1073
+ timeLimitMs: number;
1074
+ /** Match cap per search (default 10 000). */
1075
+ maxMatches: number;
1076
+ /** Text of `^c` in Replace with (clipboard reads are async in browsers, so supply it). */
1077
+ getClipboardText: () => string;
1078
+ /** Longest selection copied into the find field by Mod+F. Default 256. */
1079
+ maxPrefillLength: number;
1080
+ }
1081
+ interface FindReplaceStorage {
1082
+ store: FindReplaceStore;
1083
+ }
1084
+ interface SetSearchParams {
1085
+ query?: string;
1086
+ replacement?: string;
1087
+ /** Merged into the current options. */
1088
+ options?: Partial<FindOptions>;
1089
+ }
1090
+ interface OpenFindReplaceParams {
1091
+ mode?: FindReplaceMode;
1092
+ /** Find text; defaults to the selected text (single paragraph, short). */
1093
+ query?: string;
1094
+ }
1095
+ interface PluginState {
1096
+ active: boolean;
1097
+ open: boolean;
1098
+ mode: FindReplaceMode;
1099
+ query: string;
1100
+ replacement: string;
1101
+ options: Readonly<FindOptions>;
1102
+ matches: readonly FindMatch[];
1103
+ currentIndex: number;
1104
+ /** Position the current match is chosen from (first match at or after it) after a re-search. */
1105
+ anchor: number;
1106
+ error: FindPatternError | null;
1107
+ truncated: boolean;
1108
+ lastReplaceCount: number | null;
1109
+ focusRequest: number;
1110
+ decorations: DecorationSet;
1111
+ }
1112
+ declare const findReplacePluginKey: PluginKey<PluginState>;
1113
+ declare module "@tiptap/core" {
1114
+ interface Commands<ReturnType> {
1115
+ findReplace: {
1116
+ /** Sets the find text, replace text and/or options and searches. */
1117
+ setSearch: (params: SetSearchParams) => ReturnType;
1118
+ /** Shows the find bar (and searches its text). */
1119
+ openFindReplace: (params?: OpenFindReplaceParams) => ReturnType;
1120
+ /** Hides the find bar and its highlights; the find text is kept. */
1121
+ closeFindReplace: () => ReturnType;
1122
+ /** Clears the find text and highlights. */
1123
+ clearSearch: () => ReturnType;
1124
+ /** Selects the next match after the selection, wrapping around. */
1125
+ findNext: () => ReturnType;
1126
+ /** Selects the previous match before the selection, wrapping around. */
1127
+ findPrevious: () => ReturnType;
1128
+ /** Replaces the current match and moves on to the next one. */
1129
+ replaceCurrent: () => ReturnType;
1130
+ /** Replaces every match in one transaction (one undo step). */
1131
+ replaceAll: () => ReturnType;
1132
+ };
1133
+ }
1134
+ }
1135
+ /** The extension's plugin state, or `null` without `FindReplace`. */
1136
+ declare function getFindReplaceState(source: Editor | EditorState | null | undefined): FindReplaceSnapshot | null;
1137
+ /** Returns the find store of an editor using `FindReplace`. */
1138
+ declare function getFindReplaceStore(editor: Editor | null | undefined): FindReplaceStore | null;
1139
+ interface FindOptionToggle {
1140
+ key: keyof FindOptions;
1141
+ label: string;
1142
+ /** Compact button text. */
1143
+ short: string;
1144
+ /** Shown under "More options" rather than as a toolbar toggle. */
1145
+ advanced: boolean;
1146
+ }
1147
+ /** The option toggles of the React and Svelte find bars, in display order. */
1148
+ declare const FIND_OPTION_TOGGLES: readonly FindOptionToggle[];
1149
+ /**
1150
+ * Text of a find bar's match counter: `"3 of 12"`, `"12 results"` (no
1151
+ * current match), `"No results"`, `"10000+ results"` when truncated, or the
1152
+ * pattern error. Empty without a query.
1153
+ */
1154
+ declare function formatFindStatus(s: Pick<FindReplaceSnapshot, "query" | "matches" | "currentIndex" | "error" | "truncated">): string;
1155
+ /**
1156
+ * Word-style Find and Replace: Match case, Whole words, prefix/suffix,
1157
+ * Ignore punctuation/white space, `^` special characters, wildcards (with
1158
+ * `\1` groups in the replacement) and a raw regex mode. Matches are
1159
+ * decorated; tracked-deleted text is skipped, and replacements made while
1160
+ * Track Changes is on become tracked changes.
1161
+ */
1162
+ declare const FindReplace: Extension<FindReplaceOptions, FindReplaceStorage>;
1163
+
857
1164
  interface RichTextPresetOptions {
858
1165
  placeholder?: string | ((props: {
859
1166
  node: any;
@@ -868,7 +1175,7 @@ interface RichTextPresetOptions {
868
1175
  image?: ImageOptions | boolean;
869
1176
  /** Adds the `Comments` extension (off by default). */
870
1177
  comments?: Partial<CommentsOptions> | boolean;
871
- /** Adds the `TrackChanges` extension (off by default). */
1178
+ /** Adds the `TrackChanges` and `DocumentCompare` extensions (off by default). */
872
1179
  trackChanges?: Partial<TrackChangesOptions> | boolean;
873
1180
  /** Import dropped/pasted .md, .html, .txt and .rtf files (opt-in). */
874
1181
  fileImport?: FileImportOptions | boolean;
@@ -890,10 +1197,69 @@ interface RichTextPresetOptions {
890
1197
  bookmarks?: Partial<BookmarkOptions> | boolean;
891
1198
  /** Cross-references to headings and bookmarks (also enables `outline`). Off by default. */
892
1199
  crossReferences?: Partial<CrossReferenceOptions> | boolean;
1200
+ /** Word-style Find and Replace (Mod+F / Mod+H, match highlights). Off by default. */
1201
+ findReplace?: Partial<FindReplaceOptions> | boolean;
893
1202
  }
894
1203
  /**
895
1204
  * Creates a standard rich-text extensions bundle with full formatting support.
896
1205
  */
897
1206
  declare function createRichTextPreset(options?: RichTextPresetOptions): Extensions;
898
1207
 
899
- export { type RichClipboardStorage as $, type AddCommentOptions as A, BUILT_IN_IMPORT_ADAPTERS as B, COMMENT_MARK_NAME as C, type DocumentImport as D, Footnote as E, FileImport as F, type FootnoteInfo as G, FootnoteReference as H, Footnotes as I, type FootnotesOptions as J, GradientText as K, type GradientTextOptions as L, Image as M, type ImageOptions as N, type InsertFootnoteOptions as O, type InsertTableOfContentsOptions as P, LoadingNode as Q, Markdown as R, Outline as S, type OutlineHeading as T, type OutlineOptions as U, type OutlineSnapshot as V, type OutlineStorage as W, type OutlineStore as X, type OutlineTreeItem as Y, RichClipboard as Z, type RichClipboardOptions as _, type DocumentImportAdapter as a, tableOfContentsPluginKey as a$, type RichTextPresetOptions as a0, SMILIE_REPLACEMENTS as a1, type SetBookmarkOptions as a2, type SlashCommandMatchData as a3, SlashCommands as a4, type SlashCommandsOptions as a5, SmilieReplacer as a6, TableOfContents as a7, type TableOfContentsEntry as a8, type TableOfContentsOptions as a9, getCommentIdsAt as aA, getCommentStore as aB, getCrossReferenceTargets as aC, getDocumentStructureCommandItems as aD, getFootnotes as aE, getImportAccept as aF, getOutline as aG, getTableOfContentsEntries as aH, handleImageInsertion as aI, htmlImportAdapter as aJ, imagePastePluginKey as aK, importFile as aL, insertImageNode as aM, isInsidePromptToken as aN, markdownImportAdapter as aO, navigateToHeading as aP, outlinePluginKey as aQ, plainTextImportAdapter as aR, registerImportAdapter as aS, removeImageNode as aT, richClipboardPluginKey as aU, rtfImportAdapter as aV, smartQuoteRules as aW, smilieAutocorrectRules as aX, symbolRules as aY, syncFootnotes as aZ, tableOfContentsMarkdownIt as a_, TemplateSuggestions as aa, type TemplateSuggestionsOptions as ab, autocorrectPluginKey as ac, buildOutlineTree as ad, capitalizeSentenceRules as ae, commentsPluginKey as af, computeOutline as ag, createImportAdapterRegistry as ah, createOutlineStore as ai, createRichTextPreset as aj, crossReferencePluginKey as ak, defaultAutocorrectRules as al, defaultImportRegistry as am, documentStructureCommandItems as an, fileImportPluginKey as ao, findAutocorrection as ap, findCommentRanges as aq, findHexColors as ar, findImportAdapter as as, footnotesMarkdownIt as at, footnotesPluginKey as au, fractionRules as av, getActiveHeading as aw, getBookmarks as ax, getCommentAnchors as ay, getCommentAuthor as az, Autocorrect as b, twoInitialCapitalsRules as b0, unregisterImportAdapter as b1, updateImageSrc as b2, writeRichClipboard as b3, type AutocorrectContext as c, type AutocorrectCorrection as d, type AutocorrectOptions as e, type AutocorrectRule as f, type AutocorrectStorage as g, Bookmark as h, type BookmarkInfo as i, type BookmarkOptions as j, ColorHighlighter as k, type CommentRange as l, Comments as m, type CommentsOptions as n, type CommentsStorage as o, type CreateImportAdapterRegistryOptions as p, CrossReference as q, type CrossReferenceOptions as r, type CrossReferenceTarget as s, type CrossReferenceTargetType as t, DEFAULT_AUTOCORRECT_EXCEPTIONS as u, type DocumentStructureCommandArgs as v, type DocumentStructureCommandItem as w, type FileImportOptions as x, type FocusHeadingOptions as y, FontSize as z };
1208
+ /** Options of a comparison run in an editor (the schema is the editor's). */
1209
+ type EditorCompareOptions = Omit<CompareDocumentsOptions, "schema">;
1210
+ declare module "@tiptap/core" {
1211
+ interface Commands<ReturnType> {
1212
+ documentCompare: {
1213
+ /**
1214
+ * Replaces the content with the comparison of `original` and
1215
+ * `revised` (nodes, JSON or HTML) as tracked changes. The content is
1216
+ * set without being tracked; the summary is stored in
1217
+ * `editor.storage.documentCompare.lastResult`.
1218
+ */
1219
+ setContentFromComparison: (original: CompareSource, revised: CompareSource, options?: EditorCompareOptions) => ReturnType;
1220
+ };
1221
+ }
1222
+ }
1223
+ interface DocumentCompareOptions {
1224
+ /** Defaults for every comparison (author defaults to the track-changes author). */
1225
+ compare: EditorCompareOptions;
1226
+ }
1227
+ interface DocumentCompareStorage {
1228
+ lastResult: CompareDocumentsResult | null;
1229
+ }
1230
+ /**
1231
+ * Compares two versions in the editor's schema and returns the result
1232
+ * without changing the editor. The author defaults to the `TrackChanges`
1233
+ * author.
1234
+ */
1235
+ declare function compareInEditor(editor: Editor, original: CompareSource, revised: CompareSource, options?: EditorCompareOptions): CompareDocumentsResult;
1236
+ /**
1237
+ * Compares two versions and replaces the editor content with the result
1238
+ * (one undoable step, not tracked). Works without the `DocumentCompare`
1239
+ * extension; the schema needs `TrackChanges`.
1240
+ */
1241
+ declare function applyDocumentComparison(editor: Editor, original: CompareSource, revised: CompareSource, options?: EditorCompareOptions): CompareDocumentsResult;
1242
+ /** Adds the `setContentFromComparison` command. Requires `TrackChanges`. */
1243
+ declare const DocumentCompare: Extension<DocumentCompareOptions, DocumentCompareStorage>;
1244
+
1245
+ interface FindReplaceCommandOptions {
1246
+ /** Id prefix (default `findReplace.`). */
1247
+ prefix?: string;
1248
+ group?: string;
1249
+ scope?: string;
1250
+ /**
1251
+ * Give the open commands default shortcuts (Mod+F, Mod+H). Off by default
1252
+ * because the `FindReplace` extension already binds them inside the editor.
1253
+ */
1254
+ shortcuts?: boolean;
1255
+ }
1256
+ /**
1257
+ * Find and Replace commands for the command registry (`@pixerate/editor/commands`):
1258
+ * open the bar, step through matches, and find / replace with explicit
1259
+ * params (useful for agents). Requires the `FindReplace` extension.
1260
+ */
1261
+ declare function createFindReplaceCommands(editor: Editor, options?: FindReplaceCommandOptions): CommandSpec[];
1262
+ /** Validates Find text without an editor (e.g. to show an error while typing). */
1263
+ declare function validateFindPattern(query: string, options?: FindOptions): FindPatternError | null;
1264
+
1265
+ export { FindReplaceStore as $, type AddCommentOptions as A, BUILT_IN_IMPORT_ADAPTERS as B, COMMENT_MARK_NAME as C, type DocumentImport as D, type DocumentSearchOptions as E, type DocumentSearchResult as F, type DocumentStructureCommandArgs as G, type DocumentStructureCommandItem as H, EMPTY_FIND_REPLACE_SNAPSHOT as I, type EditorCompareOptions as J, FIND_OPTION_TOGGLES as K, FIND_PARAGRAPH_MARK as L, FileImport as M, type FileImportOptions as N, type FindAllOptions as O, type FindAllResult as P, type FindMatch as Q, type FindOptionToggle as R, type FindOptions as S, type FindPatternError as T, type FindPatternErrorCode as U, FindReplace as V, type FindReplaceCommandOptions as W, type FindReplaceMode as X, type FindReplaceOptions as Y, type FindReplaceSnapshot as Z, type FindReplaceStorage as _, type DocumentImportAdapter as a, fileImportPluginKey as a$, type FocusHeadingOptions as a0, FontSize as a1, Footnote as a2, type FootnoteInfo as a3, FootnoteReference as a4, Footnotes as a5, type FootnotesOptions as a6, GradientText as a7, type GradientTextOptions as a8, Image as a9, SlashCommands as aA, type SlashCommandsOptions as aB, SmilieReplacer as aC, TableOfContents as aD, type TableOfContentsEntry as aE, type TableOfContentsOptions as aF, TemplateSuggestions as aG, type TemplateSuggestionsOptions as aH, applyDocumentComparison as aI, applyReplacements as aJ, autocorrectPluginKey as aK, buildOutlineTree as aL, capitalizeSentenceRules as aM, commentsPluginKey as aN, compareInEditor as aO, compileFindPattern as aP, computeOutline as aQ, createFindReplaceCommands as aR, createImportAdapterRegistry as aS, createOutlineStore as aT, createRichTextPreset as aU, createSearchBudget as aV, crossReferencePluginKey as aW, defaultAutocorrectRules as aX, defaultImportRegistry as aY, documentStructureCommandItems as aZ, expandReplacement as a_, type ImageOptions as aa, type InsertFootnoteOptions as ab, type InsertTableOfContentsOptions as ac, LoadingNode as ad, MAX_FIND_PATTERN_LENGTH as ae, Markdown as af, type OpenFindReplaceParams as ag, Outline as ah, type OutlineHeading as ai, type OutlineOptions as aj, type OutlineSnapshot as ak, type OutlineStorage as al, type OutlineStore as am, type OutlineTreeItem as an, type PatternMatch as ao, type ReplacePiece as ap, RichClipboard as aq, type RichClipboardOptions as ar, type RichClipboardStorage as as, type RichTextPresetOptions as at, SMILIE_REPLACEMENTS as au, type SearchBudget as av, type SearchBudgetOptions as aw, type SetBookmarkOptions as ax, type SetSearchParams as ay, type SlashCommandMatchData as az, Autocorrect as b, findAllMatches as b0, findAutocorrection as b1, findCommentRanges as b2, findHexColors as b3, findImportAdapter as b4, findReplacePluginKey as b5, foldCodePoint as b6, footnotesMarkdownIt as b7, footnotesPluginKey as b8, formatFindStatus as b9, registerImportAdapter as bA, removeImageNode as bB, richClipboardPluginKey as bC, rtfImportAdapter as bD, searchDocument as bE, smartQuoteRules as bF, smilieAutocorrectRules as bG, symbolRules as bH, syncFootnotes as bI, tableOfContentsMarkdownIt as bJ, tableOfContentsPluginKey as bK, twoInitialCapitalsRules as bL, unregisterImportAdapter as bM, updateImageSrc as bN, validateFindPattern as bO, writeRichClipboard as bP, fractionRules as ba, getActiveHeading as bb, getBookmarks as bc, getCommentAnchors as bd, getCommentAuthor as be, getCommentIdsAt as bf, getCommentStore as bg, getCrossReferenceTargets as bh, getDocumentStructureCommandItems as bi, getFindReplaceState as bj, getFindReplaceStore as bk, getFootnotes as bl, getImportAccept as bm, getOutline as bn, getTableOfContentsEntries as bo, handleImageInsertion as bp, htmlImportAdapter as bq, imagePastePluginKey as br, importFile as bs, insertImageNode as bt, isInsidePromptToken as bu, markdownImportAdapter as bv, navigateToHeading as bw, outlinePluginKey as bx, parseReplacement as by, plainTextImportAdapter as bz, type AutocorrectContext as c, type AutocorrectCorrection as d, type AutocorrectOptions as e, type AutocorrectRule as f, type AutocorrectStorage as g, Bookmark as h, type BookmarkInfo as i, type BookmarkOptions as j, ColorHighlighter as k, type CommentRange as l, Comments as m, type CommentsOptions as n, type CommentsStorage as o, type CompileFindPatternResult as p, type CompiledFindPattern as q, type CreateImportAdapterRegistryOptions as r, CrossReference as s, type CrossReferenceOptions as t, type CrossReferenceTarget as u, type CrossReferenceTargetType as v, DEFAULT_AUTOCORRECT_EXCEPTIONS as w, DocumentCompare as x, type DocumentCompareOptions as y, type DocumentCompareStorage as z };