@pixerate/editor 0.23.0 → 0.25.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 (187) hide show
  1. package/README.md +167 -2
  2. package/THIRD_PARTY_NOTICES.md +80 -0
  3. package/dist/agent/index.cjs +10 -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 +4 -2
  8. package/dist/agent/index.js.map +1 -1
  9. package/dist/canvas/index.cjs +4437 -411
  10. package/dist/canvas/index.cjs.map +1 -1
  11. package/dist/canvas/index.d.cts +934 -4
  12. package/dist/canvas/index.d.ts +934 -4
  13. package/dist/canvas/index.js +4309 -283
  14. package/dist/canvas/index.js.map +1 -1
  15. package/dist/chunk-4BVP64JJ.cjs +1406 -0
  16. package/dist/chunk-4BVP64JJ.cjs.map +1 -0
  17. package/dist/chunk-664LQYFJ.js +115 -0
  18. package/dist/chunk-664LQYFJ.js.map +1 -0
  19. package/dist/chunk-7WISYZFO.cjs +740 -0
  20. package/dist/chunk-7WISYZFO.cjs.map +1 -0
  21. package/dist/chunk-AL6JMGWW.cjs +783 -0
  22. package/dist/chunk-AL6JMGWW.cjs.map +1 -0
  23. package/dist/chunk-BVP3TSLH.cjs +69 -0
  24. package/dist/chunk-BVP3TSLH.cjs.map +1 -0
  25. package/dist/{chunk-RIKBJLS2.cjs → chunk-C7P22VIP.cjs} +2001 -279
  26. package/dist/chunk-C7P22VIP.cjs.map +1 -0
  27. package/dist/chunk-D6FH2YAX.cjs +131 -0
  28. package/dist/chunk-D6FH2YAX.cjs.map +1 -0
  29. package/dist/chunk-ECCCYKGL.js +740 -0
  30. package/dist/chunk-ECCCYKGL.js.map +1 -0
  31. package/dist/{chunk-4SUNJZWB.cjs → chunk-FD4LPFAE.cjs} +48 -200
  32. package/dist/chunk-FD4LPFAE.cjs.map +1 -0
  33. package/dist/{chunk-QBJ22YZR.js → chunk-FH6F67DN.js} +1999 -277
  34. package/dist/chunk-FH6F67DN.js.map +1 -0
  35. package/dist/{chunk-OYXSKQFR.js → chunk-FPENXAEJ.js} +35 -187
  36. package/dist/chunk-FPENXAEJ.js.map +1 -0
  37. package/dist/chunk-HLIMTC6N.js +1 -0
  38. package/dist/chunk-HLIMTC6N.js.map +1 -0
  39. package/dist/chunk-HRMEDT2L.js +1406 -0
  40. package/dist/chunk-HRMEDT2L.js.map +1 -0
  41. package/dist/{chunk-QGHGJ56O.js → chunk-IXHSYOVY.js} +2518 -122
  42. package/dist/chunk-IXHSYOVY.js.map +1 -0
  43. package/dist/chunk-MKA3AHLV.cjs +256 -0
  44. package/dist/chunk-MKA3AHLV.cjs.map +1 -0
  45. package/dist/chunk-NAXVVS5I.js +783 -0
  46. package/dist/chunk-NAXVVS5I.js.map +1 -0
  47. package/dist/chunk-O5RYH2PG.js +69 -0
  48. package/dist/chunk-O5RYH2PG.js.map +1 -0
  49. package/dist/chunk-OXSV64JX.js +689 -0
  50. package/dist/chunk-OXSV64JX.js.map +1 -0
  51. package/dist/chunk-P3RQ5UJE.cjs +689 -0
  52. package/dist/chunk-P3RQ5UJE.cjs.map +1 -0
  53. package/dist/chunk-P6ODPZ4W.js +256 -0
  54. package/dist/chunk-P6ODPZ4W.js.map +1 -0
  55. package/dist/chunk-PL4JB3BF.cjs +1 -0
  56. package/dist/chunk-PL4JB3BF.cjs.map +1 -0
  57. package/dist/{chunk-GVSMRPHB.cjs → chunk-PO6A6QQH.cjs} +2607 -211
  58. package/dist/chunk-PO6A6QQH.cjs.map +1 -0
  59. package/dist/{chunk-JJDLPEWL.js → chunk-QGYDWPRM.js} +2 -2
  60. package/dist/chunk-RR7F5GUM.js +5726 -0
  61. package/dist/chunk-RR7F5GUM.js.map +1 -0
  62. package/dist/chunk-TNNJXF46.cjs +115 -0
  63. package/dist/chunk-TNNJXF46.cjs.map +1 -0
  64. package/dist/chunk-U5HZSFCS.js +131 -0
  65. package/dist/chunk-U5HZSFCS.js.map +1 -0
  66. package/dist/{chunk-MJZBNWG7.js → chunk-UAKDG62Z.js} +309 -581
  67. package/dist/chunk-UAKDG62Z.js.map +1 -0
  68. package/dist/{chunk-CL37JGFW.cjs → chunk-V3CHHWOE.cjs} +4 -4
  69. package/dist/{chunk-CL37JGFW.cjs.map → chunk-V3CHHWOE.cjs.map} +1 -1
  70. package/dist/chunk-WSQKHXW7.cjs +5726 -0
  71. package/dist/chunk-WSQKHXW7.cjs.map +1 -0
  72. package/dist/{chunk-AA4ZEVCC.cjs → chunk-X4N4WUKB.cjs} +336 -608
  73. package/dist/chunk-X4N4WUKB.cjs.map +1 -0
  74. package/dist/commands/index.cjs +74 -1
  75. package/dist/commands/index.cjs.map +1 -1
  76. package/dist/commands/index.d.cts +38 -353
  77. package/dist/commands/index.d.ts +38 -353
  78. package/dist/commands/index.js +73 -0
  79. package/dist/commands/index.js.map +1 -1
  80. package/dist/comment-store-BEMgVlAA.d.cts +135 -0
  81. package/dist/comment-store-BEMgVlAA.d.ts +135 -0
  82. package/dist/compare/index.cjs +15 -0
  83. package/dist/compare/index.cjs.map +1 -0
  84. package/dist/compare/index.d.cts +58 -0
  85. package/dist/compare/index.d.ts +58 -0
  86. package/dist/compare/index.js +15 -0
  87. package/dist/compare/index.js.map +1 -0
  88. package/dist/controller-BIJiNoVs.d.cts +1842 -0
  89. package/dist/controller-BIJiNoVs.d.ts +1842 -0
  90. package/dist/documents-CHT1U5Vs.d.ts +86 -0
  91. package/dist/documents-Gp7wb0Me.d.cts +86 -0
  92. package/dist/extensions/index.cjs +100 -5
  93. package/dist/extensions/index.cjs.map +1 -1
  94. package/dist/extensions/index.d.cts +16 -4
  95. package/dist/extensions/index.d.ts +16 -4
  96. package/dist/extensions/index.js +100 -5
  97. package/dist/generation/index.cjs +2317 -0
  98. package/dist/generation/index.cjs.map +1 -0
  99. package/dist/generation/index.d.cts +1015 -0
  100. package/dist/generation/index.d.ts +1015 -0
  101. package/dist/generation/index.js +2317 -0
  102. package/dist/generation/index.js.map +1 -0
  103. package/dist/grammar/index.cjs +48 -3
  104. package/dist/grammar/index.cjs.map +1 -1
  105. package/dist/grammar/index.d.cts +322 -100
  106. package/dist/grammar/index.d.ts +322 -100
  107. package/dist/grammar/index.js +54 -9
  108. package/dist/image-editor/index.cjs +4392 -481
  109. package/dist/image-editor/index.cjs.map +1 -1
  110. package/dist/image-editor/index.d.cts +1249 -97
  111. package/dist/image-editor/index.d.ts +1249 -97
  112. package/dist/image-editor/index.js +4281 -370
  113. package/dist/image-editor/index.js.map +1 -1
  114. package/dist/index-7a6bHTLy.d.ts +1754 -0
  115. package/dist/index-Csd5qI8u.d.cts +1754 -0
  116. package/dist/index.cjs +1682 -99
  117. package/dist/index.cjs.map +1 -1
  118. package/dist/index.d.cts +118 -21
  119. package/dist/index.d.ts +118 -21
  120. package/dist/index.js +1630 -47
  121. package/dist/index.js.map +1 -1
  122. package/dist/mention-text-CDnCFd3c.d.cts +53 -0
  123. package/dist/mention-text-CDnCFd3c.d.ts +53 -0
  124. package/dist/migrate-iTlm3a8h.d.cts +112 -0
  125. package/dist/migrate-iTlm3a8h.d.ts +112 -0
  126. package/dist/model-C1zApQM8.d.cts +219 -0
  127. package/dist/model-C1zApQM8.d.ts +219 -0
  128. package/dist/persistence/index.cjs +676 -0
  129. package/dist/persistence/index.cjs.map +1 -0
  130. package/dist/persistence/index.d.cts +230 -0
  131. package/dist/persistence/index.d.ts +230 -0
  132. package/dist/persistence/index.js +676 -0
  133. package/dist/persistence/index.js.map +1 -0
  134. package/dist/{registry-D5-R90p0.d.cts → registry-BDe-vlv3.d.ts} +2 -40
  135. package/dist/{registry-GJI4gToU.d.ts → registry-CEgwXED1.d.cts} +12 -1
  136. package/dist/{registry-GJI4gToU.d.cts → registry-CEgwXED1.d.ts} +12 -1
  137. package/dist/registry-D32LpIc4.d.cts +354 -0
  138. package/dist/{registry-D5-R90p0.d.ts → registry-DnzpgY27.d.cts} +2 -40
  139. package/dist/registry-evKTP4ls.d.ts +354 -0
  140. package/dist/schema-DYDGdYL9.d.cts +41 -0
  141. package/dist/schema-DYDGdYL9.d.ts +41 -0
  142. package/dist/serializers/index.cjs +12 -3
  143. package/dist/serializers/index.cjs.map +1 -1
  144. package/dist/serializers/index.d.cts +40 -12
  145. package/dist/serializers/index.d.ts +40 -12
  146. package/dist/serializers/index.js +12 -3
  147. package/dist/sourcemap-C8AH3MBQ.d.cts +91 -0
  148. package/dist/sourcemap-DA1Evhrv.d.ts +91 -0
  149. package/dist/spreadsheet/index.cjs +161 -3
  150. package/dist/spreadsheet/index.cjs.map +1 -1
  151. package/dist/spreadsheet/index.d.cts +611 -20
  152. package/dist/spreadsheet/index.d.ts +611 -20
  153. package/dist/spreadsheet/index.js +168 -10
  154. package/dist/storage-BpFfspHm.d.cts +120 -0
  155. package/dist/storage-BpFfspHm.d.ts +120 -0
  156. package/dist/tokens/index.cjs +115 -0
  157. package/dist/tokens/index.cjs.map +1 -0
  158. package/dist/tokens/index.d.cts +212 -0
  159. package/dist/tokens/index.d.ts +212 -0
  160. package/dist/tokens/index.js +115 -0
  161. package/dist/tokens/index.js.map +1 -0
  162. package/dist/{tokens-CyLZmIei.d.cts → tokens-D7yXvUU6.d.cts} +15 -2
  163. package/dist/{tokens-CyLZmIei.d.ts → tokens-D7yXvUU6.d.ts} +15 -2
  164. package/dist/{track-changes-BSF58RK0.d.cts → track-changes-D_VAPELi.d.cts} +110 -144
  165. package/dist/{track-changes-BSF58RK0.d.ts → track-changes-Db_fGEvx.d.ts} +110 -144
  166. package/package.json +21 -1
  167. package/dist/chunk-4SUNJZWB.cjs.map +0 -1
  168. package/dist/chunk-AA4ZEVCC.cjs.map +0 -1
  169. package/dist/chunk-AXV2ZW34.cjs +0 -118
  170. package/dist/chunk-AXV2ZW34.cjs.map +0 -1
  171. package/dist/chunk-B2ZRLN4S.js +0 -118
  172. package/dist/chunk-B2ZRLN4S.js.map +0 -1
  173. package/dist/chunk-GVSMRPHB.cjs.map +0 -1
  174. package/dist/chunk-K3R5NG2D.js +0 -3100
  175. package/dist/chunk-K3R5NG2D.js.map +0 -1
  176. package/dist/chunk-MJZBNWG7.js.map +0 -1
  177. package/dist/chunk-OYXSKQFR.js.map +0 -1
  178. package/dist/chunk-QBJ22YZR.js.map +0 -1
  179. package/dist/chunk-QGHGJ56O.js.map +0 -1
  180. package/dist/chunk-RIKBJLS2.cjs.map +0 -1
  181. package/dist/chunk-XDMXXC4Z.cjs +0 -3100
  182. package/dist/chunk-XDMXXC4Z.cjs.map +0 -1
  183. package/dist/controller-pePCJLT1.d.cts +0 -959
  184. package/dist/controller-pePCJLT1.d.ts +0 -959
  185. package/dist/index-CCr_z9kF.d.cts +0 -899
  186. package/dist/index-Ck6ajwXh.d.ts +0 -899
  187. /package/dist/{chunk-JJDLPEWL.js.map → chunk-QGYDWPRM.js.map} +0 -0
@@ -0,0 +1,135 @@
1
+ /**
2
+ * Who made a comment, reply or tracked change.
3
+ */
4
+ interface ReviewAuthor {
5
+ id: string;
6
+ name: string;
7
+ color?: string;
8
+ avatarUrl?: string;
9
+ }
10
+ /**
11
+ * Where a comment thread is attached in the document. `from`/`to` are
12
+ * ProseMirror positions and `quote` is the commented text at the time the
13
+ * anchor was last synced. Positions are only meaningful for the current
14
+ * document; the `comment` mark in the document is the source of truth.
15
+ */
16
+ interface CommentAnchor {
17
+ from: number;
18
+ to: number;
19
+ quote: string;
20
+ }
21
+ interface CommentReply {
22
+ id: string;
23
+ author: ReviewAuthor;
24
+ body: string;
25
+ createdAt: number;
26
+ editedAt?: number;
27
+ }
28
+ interface CommentThread {
29
+ id: string;
30
+ /** `null` while the thread has no text in the document (see `orphaned`). */
31
+ anchor: CommentAnchor | null;
32
+ author: ReviewAuthor;
33
+ createdAt: number;
34
+ /** An empty body marks a draft that has not been posted yet. */
35
+ body: string;
36
+ editedAt?: number;
37
+ replies: CommentReply[];
38
+ resolved: boolean;
39
+ resolvedAt?: number;
40
+ resolvedBy?: ReviewAuthor;
41
+ /**
42
+ * True when the commented text was deleted from the document. Undoing the
43
+ * deletion re-attaches the thread.
44
+ */
45
+ orphaned: boolean;
46
+ /** The quote the thread had before it was orphaned. */
47
+ lastQuote?: string;
48
+ }
49
+ interface CommentStoreSnapshot {
50
+ /** Threads in document order (anchored first), then orphaned threads. */
51
+ threads: readonly CommentThread[];
52
+ activeThreadId: string | null;
53
+ }
54
+ /** JSON shape produced by `CommentStore.toJSON()`. */
55
+ interface SerializedComments {
56
+ version: 1;
57
+ threads: CommentThread[];
58
+ }
59
+ interface CommentStoreOptions {
60
+ threads?: CommentThread[] | SerializedComments;
61
+ generateId?: () => string;
62
+ now?: () => number;
63
+ }
64
+ interface CreateThreadInput {
65
+ id?: string;
66
+ body: string;
67
+ author: ReviewAuthor;
68
+ anchor?: CommentAnchor | null;
69
+ createdAt?: number;
70
+ }
71
+ type CommentStoreListener = (snapshot: CommentStoreSnapshot) => void;
72
+ /**
73
+ * Generates a reasonably unique id without depending on `crypto`.
74
+ */
75
+ declare function createReviewId(prefix?: string): string;
76
+ /**
77
+ * Headless, framework-agnostic store of comment threads.
78
+ *
79
+ * The store never talks to a server: persist `toJSON()` yourself and pass it
80
+ * back via `new CommentStore({ threads })` or `load()`. Snapshots are
81
+ * immutable and only replaced when something changes, so `getSnapshot` is safe
82
+ * to use with React's `useSyncExternalStore`. `subscribe` calls the listener
83
+ * immediately (Svelte store contract).
84
+ */
85
+ declare class CommentStore {
86
+ private threads;
87
+ private activeThreadId;
88
+ private snapshot;
89
+ private listeners;
90
+ /** Deleted threads, kept so undoing a "Delete Comment" can restore them. */
91
+ private deleted;
92
+ private generateId;
93
+ private now;
94
+ constructor(options?: CommentStoreOptions);
95
+ /** Parses `toJSON()` output (or a plain thread array). */
96
+ static parse(json: string | CommentThread[] | SerializedComments): CommentThread[];
97
+ subscribe: (listener: CommentStoreListener) => (() => void);
98
+ getSnapshot: () => CommentStoreSnapshot;
99
+ getThread(id: string): CommentThread | undefined;
100
+ createThread(input: CreateThreadInput): CommentThread;
101
+ /** Edits the thread's body, or one of its replies when `replyId` is given. */
102
+ editComment(threadId: string, body: string, replyId?: string): boolean;
103
+ addReply(threadId: string, input: {
104
+ body: string;
105
+ author: ReviewAuthor;
106
+ id?: string;
107
+ }): CommentReply | null;
108
+ deleteReply(threadId: string, replyId: string): boolean;
109
+ resolveThread(id: string, resolved?: boolean, by?: ReviewAuthor): boolean;
110
+ deleteThread(id: string): boolean;
111
+ /** Deletes every thread whose text is no longer in the document. */
112
+ removeOrphanedThreads(): string[];
113
+ setActiveThread(id: string | null): void;
114
+ /**
115
+ * Updates anchors from the document. Threads missing from `anchors` become
116
+ * orphaned. Threads that were deleted but whose mark re-appeared (e.g. after
117
+ * undoing "Delete Comment") are restored. Returns true if anything changed.
118
+ */
119
+ syncAnchors(anchors: Map<string, CommentAnchor>): boolean;
120
+ /** Replaces all threads, e.g. with data loaded from a server. */
121
+ load(json: string | CommentThread[] | SerializedComments): void;
122
+ clear(): void;
123
+ toJSON(): SerializedComments;
124
+ private updateThread;
125
+ private computeSnapshot;
126
+ private emit;
127
+ }
128
+ declare function createCommentStore(options?: CommentStoreOptions): CommentStore;
129
+ /**
130
+ * Short, human-readable timestamp for review UIs ("just now", "5m ago",
131
+ * "3h ago", then a locale date). Shared by the React and Svelte components.
132
+ */
133
+ declare function formatReviewTime(timestamp: number, now?: number): string;
134
+
135
+ export { type CommentAnchor as C, type ReviewAuthor as R, type SerializedComments as S, type CommentReply as a, CommentStore as b, type CommentStoreListener as c, type CommentStoreOptions as d, type CommentStoreSnapshot as e, type CommentThread as f, type CreateThreadInput as g, createCommentStore as h, createReviewId as i, formatReviewTime as j };
@@ -0,0 +1,15 @@
1
+ "use strict";Object.defineProperty(exports, "__esModule", {value: true});require('../chunk-PL4JB3BF.cjs');
2
+
3
+
4
+
5
+
6
+
7
+ var _chunkAL6JMGWWcjs = require('../chunk-AL6JMGWW.cjs');
8
+ require('../chunk-X4N4WUKB.cjs');
9
+
10
+
11
+
12
+
13
+
14
+ exports.compareDocuments = _chunkAL6JMGWWcjs.compareDocuments; exports.compareHtml = _chunkAL6JMGWWcjs.compareHtml; exports.diffChanges = _chunkAL6JMGWWcjs.diffChanges; exports.diffSequences = _chunkAL6JMGWWcjs.diffSequences;
15
+ //# sourceMappingURL=index.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["/home/runner/work/editor/editor/packages/core/dist/compare/index.cjs"],"names":[],"mappings":"AAAA,0GAA8B;AAC9B;AACE;AACA;AACA;AACA;AACF,yDAA8B;AAC9B,iCAA8B;AAC9B;AACE;AACA;AACA;AACA;AACF,iOAAC","file":"/home/runner/work/editor/editor/packages/core/dist/compare/index.cjs"}
@@ -0,0 +1,58 @@
1
+ export { C as CompareDocumentsOptions, a as CompareDocumentsResult, b as CompareSource, c as CompareSummary, d as compareDocuments, e as compareHtml } from '../documents-Gp7wb0Me.cjs';
2
+ import '@tiptap/pm/model';
3
+ import '../comment-store-BEMgVlAA.cjs';
4
+
5
+ /**
6
+ * Generic sequence diff: common prefix/suffix stripping, Myers' O((N+M)·D)
7
+ * algorithm for small segments and patience anchors (items unique on both
8
+ * sides, longest increasing subsequence) to split long ones. Dependency-free.
9
+ */
10
+ type DiffOpType = "equal" | "delete" | "insert";
11
+ /** A run of consecutive operations of one type. */
12
+ interface DiffRun {
13
+ type: DiffOpType;
14
+ /** Start index in `a` (for `insert`, where the items go in `a`). */
15
+ aIndex: number;
16
+ /** Start index in `b` (for `delete`, where the items were in `b`). */
17
+ bIndex: number;
18
+ length: number;
19
+ }
20
+ /** A change: a deleted range of `a`, an inserted range of `b`, or both (replaced). */
21
+ interface DiffChange {
22
+ kind: "inserted" | "deleted" | "replaced";
23
+ aStart: number;
24
+ aEnd: number;
25
+ bStart: number;
26
+ bEnd: number;
27
+ }
28
+ interface DiffSequencesOptions<T> {
29
+ /**
30
+ * Key of an item: items with the same key are equal. Defaults to the item
31
+ * itself for strings, numbers and booleans, and `JSON.stringify` otherwise.
32
+ * Keys enable patience anchors for long inputs.
33
+ */
34
+ hash?: (item: T) => string | number | boolean;
35
+ /**
36
+ * Custom equality. Without `hash`, segments longer than `direct` are only
37
+ * diffed while the edit distance stays below `direct`, otherwise replaced.
38
+ */
39
+ equals?: (a: T, b: T) => boolean;
40
+ /**
41
+ * Segments with more items (both sides together) are split at anchors
42
+ * first so Myers' saved frontiers (O(D²) memory) stay small. Default 3000.
43
+ */
44
+ direct?: number;
45
+ /** Maximum anchor recursion depth before a long segment is replaced whole. Default 8. */
46
+ maxDepth?: number;
47
+ }
48
+ /**
49
+ * Diffs two sequences and returns the edit script as runs of equal, deleted
50
+ * and inserted items, in order. Within a changed stretch deletions come
51
+ * before insertions. The script is minimal for segments up to `direct`
52
+ * items; longer inputs are split at patience anchors (bounded work).
53
+ */
54
+ declare function diffSequences<T>(a: readonly T[], b: readonly T[], options?: DiffSequencesOptions<T>): DiffRun[];
55
+ /** Groups an edit script into inserted, deleted and replaced ranges. */
56
+ declare function diffChanges<T>(a: readonly T[], b: readonly T[], options?: DiffSequencesOptions<T>): DiffChange[];
57
+
58
+ export { type DiffChange, type DiffOpType, type DiffRun, type DiffSequencesOptions, diffChanges, diffSequences };
@@ -0,0 +1,58 @@
1
+ export { C as CompareDocumentsOptions, a as CompareDocumentsResult, b as CompareSource, c as CompareSummary, d as compareDocuments, e as compareHtml } from '../documents-CHT1U5Vs.js';
2
+ import '@tiptap/pm/model';
3
+ import '../comment-store-BEMgVlAA.js';
4
+
5
+ /**
6
+ * Generic sequence diff: common prefix/suffix stripping, Myers' O((N+M)·D)
7
+ * algorithm for small segments and patience anchors (items unique on both
8
+ * sides, longest increasing subsequence) to split long ones. Dependency-free.
9
+ */
10
+ type DiffOpType = "equal" | "delete" | "insert";
11
+ /** A run of consecutive operations of one type. */
12
+ interface DiffRun {
13
+ type: DiffOpType;
14
+ /** Start index in `a` (for `insert`, where the items go in `a`). */
15
+ aIndex: number;
16
+ /** Start index in `b` (for `delete`, where the items were in `b`). */
17
+ bIndex: number;
18
+ length: number;
19
+ }
20
+ /** A change: a deleted range of `a`, an inserted range of `b`, or both (replaced). */
21
+ interface DiffChange {
22
+ kind: "inserted" | "deleted" | "replaced";
23
+ aStart: number;
24
+ aEnd: number;
25
+ bStart: number;
26
+ bEnd: number;
27
+ }
28
+ interface DiffSequencesOptions<T> {
29
+ /**
30
+ * Key of an item: items with the same key are equal. Defaults to the item
31
+ * itself for strings, numbers and booleans, and `JSON.stringify` otherwise.
32
+ * Keys enable patience anchors for long inputs.
33
+ */
34
+ hash?: (item: T) => string | number | boolean;
35
+ /**
36
+ * Custom equality. Without `hash`, segments longer than `direct` are only
37
+ * diffed while the edit distance stays below `direct`, otherwise replaced.
38
+ */
39
+ equals?: (a: T, b: T) => boolean;
40
+ /**
41
+ * Segments with more items (both sides together) are split at anchors
42
+ * first so Myers' saved frontiers (O(D²) memory) stay small. Default 3000.
43
+ */
44
+ direct?: number;
45
+ /** Maximum anchor recursion depth before a long segment is replaced whole. Default 8. */
46
+ maxDepth?: number;
47
+ }
48
+ /**
49
+ * Diffs two sequences and returns the edit script as runs of equal, deleted
50
+ * and inserted items, in order. Within a changed stretch deletions come
51
+ * before insertions. The script is minimal for segments up to `direct`
52
+ * items; longer inputs are split at patience anchors (bounded work).
53
+ */
54
+ declare function diffSequences<T>(a: readonly T[], b: readonly T[], options?: DiffSequencesOptions<T>): DiffRun[];
55
+ /** Groups an edit script into inserted, deleted and replaced ranges. */
56
+ declare function diffChanges<T>(a: readonly T[], b: readonly T[], options?: DiffSequencesOptions<T>): DiffChange[];
57
+
58
+ export { type DiffChange, type DiffOpType, type DiffRun, type DiffSequencesOptions, diffChanges, diffSequences };
@@ -0,0 +1,15 @@
1
+ import "../chunk-HLIMTC6N.js";
2
+ import {
3
+ compareDocuments,
4
+ compareHtml,
5
+ diffChanges,
6
+ diffSequences
7
+ } from "../chunk-NAXVVS5I.js";
8
+ import "../chunk-UAKDG62Z.js";
9
+ export {
10
+ compareDocuments,
11
+ compareHtml,
12
+ diffChanges,
13
+ diffSequences
14
+ };
15
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}