@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.
- package/README.md +167 -2
- package/THIRD_PARTY_NOTICES.md +80 -0
- package/dist/agent/index.cjs +10 -8
- package/dist/agent/index.cjs.map +1 -1
- package/dist/agent/index.d.cts +4 -3
- package/dist/agent/index.d.ts +4 -3
- package/dist/agent/index.js +4 -2
- package/dist/agent/index.js.map +1 -1
- package/dist/canvas/index.cjs +4437 -411
- package/dist/canvas/index.cjs.map +1 -1
- package/dist/canvas/index.d.cts +934 -4
- package/dist/canvas/index.d.ts +934 -4
- package/dist/canvas/index.js +4309 -283
- package/dist/canvas/index.js.map +1 -1
- package/dist/chunk-4BVP64JJ.cjs +1406 -0
- package/dist/chunk-4BVP64JJ.cjs.map +1 -0
- package/dist/chunk-664LQYFJ.js +115 -0
- package/dist/chunk-664LQYFJ.js.map +1 -0
- package/dist/chunk-7WISYZFO.cjs +740 -0
- package/dist/chunk-7WISYZFO.cjs.map +1 -0
- package/dist/chunk-AL6JMGWW.cjs +783 -0
- package/dist/chunk-AL6JMGWW.cjs.map +1 -0
- package/dist/chunk-BVP3TSLH.cjs +69 -0
- package/dist/chunk-BVP3TSLH.cjs.map +1 -0
- package/dist/{chunk-RIKBJLS2.cjs → chunk-C7P22VIP.cjs} +2001 -279
- package/dist/chunk-C7P22VIP.cjs.map +1 -0
- package/dist/chunk-D6FH2YAX.cjs +131 -0
- package/dist/chunk-D6FH2YAX.cjs.map +1 -0
- package/dist/chunk-ECCCYKGL.js +740 -0
- package/dist/chunk-ECCCYKGL.js.map +1 -0
- package/dist/{chunk-4SUNJZWB.cjs → chunk-FD4LPFAE.cjs} +48 -200
- package/dist/chunk-FD4LPFAE.cjs.map +1 -0
- package/dist/{chunk-QBJ22YZR.js → chunk-FH6F67DN.js} +1999 -277
- package/dist/chunk-FH6F67DN.js.map +1 -0
- package/dist/{chunk-OYXSKQFR.js → chunk-FPENXAEJ.js} +35 -187
- package/dist/chunk-FPENXAEJ.js.map +1 -0
- package/dist/chunk-HLIMTC6N.js +1 -0
- package/dist/chunk-HLIMTC6N.js.map +1 -0
- package/dist/chunk-HRMEDT2L.js +1406 -0
- package/dist/chunk-HRMEDT2L.js.map +1 -0
- package/dist/{chunk-QGHGJ56O.js → chunk-IXHSYOVY.js} +2518 -122
- package/dist/chunk-IXHSYOVY.js.map +1 -0
- package/dist/chunk-MKA3AHLV.cjs +256 -0
- package/dist/chunk-MKA3AHLV.cjs.map +1 -0
- package/dist/chunk-NAXVVS5I.js +783 -0
- package/dist/chunk-NAXVVS5I.js.map +1 -0
- package/dist/chunk-O5RYH2PG.js +69 -0
- package/dist/chunk-O5RYH2PG.js.map +1 -0
- package/dist/chunk-OXSV64JX.js +689 -0
- package/dist/chunk-OXSV64JX.js.map +1 -0
- package/dist/chunk-P3RQ5UJE.cjs +689 -0
- package/dist/chunk-P3RQ5UJE.cjs.map +1 -0
- package/dist/chunk-P6ODPZ4W.js +256 -0
- package/dist/chunk-P6ODPZ4W.js.map +1 -0
- package/dist/chunk-PL4JB3BF.cjs +1 -0
- package/dist/chunk-PL4JB3BF.cjs.map +1 -0
- package/dist/{chunk-GVSMRPHB.cjs → chunk-PO6A6QQH.cjs} +2607 -211
- package/dist/chunk-PO6A6QQH.cjs.map +1 -0
- package/dist/{chunk-JJDLPEWL.js → chunk-QGYDWPRM.js} +2 -2
- package/dist/chunk-RR7F5GUM.js +5726 -0
- package/dist/chunk-RR7F5GUM.js.map +1 -0
- package/dist/chunk-TNNJXF46.cjs +115 -0
- package/dist/chunk-TNNJXF46.cjs.map +1 -0
- package/dist/chunk-U5HZSFCS.js +131 -0
- package/dist/chunk-U5HZSFCS.js.map +1 -0
- package/dist/{chunk-MJZBNWG7.js → chunk-UAKDG62Z.js} +309 -581
- package/dist/chunk-UAKDG62Z.js.map +1 -0
- package/dist/{chunk-CL37JGFW.cjs → chunk-V3CHHWOE.cjs} +4 -4
- package/dist/{chunk-CL37JGFW.cjs.map → chunk-V3CHHWOE.cjs.map} +1 -1
- package/dist/chunk-WSQKHXW7.cjs +5726 -0
- package/dist/chunk-WSQKHXW7.cjs.map +1 -0
- package/dist/{chunk-AA4ZEVCC.cjs → chunk-X4N4WUKB.cjs} +336 -608
- package/dist/chunk-X4N4WUKB.cjs.map +1 -0
- package/dist/commands/index.cjs +74 -1
- package/dist/commands/index.cjs.map +1 -1
- package/dist/commands/index.d.cts +38 -353
- package/dist/commands/index.d.ts +38 -353
- package/dist/commands/index.js +73 -0
- package/dist/commands/index.js.map +1 -1
- package/dist/comment-store-BEMgVlAA.d.cts +135 -0
- package/dist/comment-store-BEMgVlAA.d.ts +135 -0
- package/dist/compare/index.cjs +15 -0
- package/dist/compare/index.cjs.map +1 -0
- package/dist/compare/index.d.cts +58 -0
- package/dist/compare/index.d.ts +58 -0
- package/dist/compare/index.js +15 -0
- package/dist/compare/index.js.map +1 -0
- package/dist/controller-BIJiNoVs.d.cts +1842 -0
- package/dist/controller-BIJiNoVs.d.ts +1842 -0
- package/dist/documents-CHT1U5Vs.d.ts +86 -0
- package/dist/documents-Gp7wb0Me.d.cts +86 -0
- package/dist/extensions/index.cjs +100 -5
- package/dist/extensions/index.cjs.map +1 -1
- package/dist/extensions/index.d.cts +16 -4
- package/dist/extensions/index.d.ts +16 -4
- package/dist/extensions/index.js +100 -5
- package/dist/generation/index.cjs +2317 -0
- package/dist/generation/index.cjs.map +1 -0
- package/dist/generation/index.d.cts +1015 -0
- package/dist/generation/index.d.ts +1015 -0
- package/dist/generation/index.js +2317 -0
- package/dist/generation/index.js.map +1 -0
- package/dist/grammar/index.cjs +48 -3
- package/dist/grammar/index.cjs.map +1 -1
- package/dist/grammar/index.d.cts +322 -100
- package/dist/grammar/index.d.ts +322 -100
- package/dist/grammar/index.js +54 -9
- package/dist/image-editor/index.cjs +4392 -481
- package/dist/image-editor/index.cjs.map +1 -1
- package/dist/image-editor/index.d.cts +1249 -97
- package/dist/image-editor/index.d.ts +1249 -97
- package/dist/image-editor/index.js +4281 -370
- package/dist/image-editor/index.js.map +1 -1
- package/dist/index-7a6bHTLy.d.ts +1754 -0
- package/dist/index-Csd5qI8u.d.cts +1754 -0
- package/dist/index.cjs +1682 -99
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +118 -21
- package/dist/index.d.ts +118 -21
- package/dist/index.js +1630 -47
- package/dist/index.js.map +1 -1
- package/dist/mention-text-CDnCFd3c.d.cts +53 -0
- package/dist/mention-text-CDnCFd3c.d.ts +53 -0
- package/dist/migrate-iTlm3a8h.d.cts +112 -0
- package/dist/migrate-iTlm3a8h.d.ts +112 -0
- package/dist/model-C1zApQM8.d.cts +219 -0
- package/dist/model-C1zApQM8.d.ts +219 -0
- package/dist/persistence/index.cjs +676 -0
- package/dist/persistence/index.cjs.map +1 -0
- package/dist/persistence/index.d.cts +230 -0
- package/dist/persistence/index.d.ts +230 -0
- package/dist/persistence/index.js +676 -0
- package/dist/persistence/index.js.map +1 -0
- package/dist/{registry-D5-R90p0.d.cts → registry-BDe-vlv3.d.ts} +2 -40
- package/dist/{registry-GJI4gToU.d.ts → registry-CEgwXED1.d.cts} +12 -1
- package/dist/{registry-GJI4gToU.d.cts → registry-CEgwXED1.d.ts} +12 -1
- package/dist/registry-D32LpIc4.d.cts +354 -0
- package/dist/{registry-D5-R90p0.d.ts → registry-DnzpgY27.d.cts} +2 -40
- package/dist/registry-evKTP4ls.d.ts +354 -0
- package/dist/schema-DYDGdYL9.d.cts +41 -0
- package/dist/schema-DYDGdYL9.d.ts +41 -0
- package/dist/serializers/index.cjs +12 -3
- package/dist/serializers/index.cjs.map +1 -1
- package/dist/serializers/index.d.cts +40 -12
- package/dist/serializers/index.d.ts +40 -12
- package/dist/serializers/index.js +12 -3
- package/dist/sourcemap-C8AH3MBQ.d.cts +91 -0
- package/dist/sourcemap-DA1Evhrv.d.ts +91 -0
- package/dist/spreadsheet/index.cjs +161 -3
- package/dist/spreadsheet/index.cjs.map +1 -1
- package/dist/spreadsheet/index.d.cts +611 -20
- package/dist/spreadsheet/index.d.ts +611 -20
- package/dist/spreadsheet/index.js +168 -10
- package/dist/storage-BpFfspHm.d.cts +120 -0
- package/dist/storage-BpFfspHm.d.ts +120 -0
- package/dist/tokens/index.cjs +115 -0
- package/dist/tokens/index.cjs.map +1 -0
- package/dist/tokens/index.d.cts +212 -0
- package/dist/tokens/index.d.ts +212 -0
- package/dist/tokens/index.js +115 -0
- package/dist/tokens/index.js.map +1 -0
- package/dist/{tokens-CyLZmIei.d.cts → tokens-D7yXvUU6.d.cts} +15 -2
- package/dist/{tokens-CyLZmIei.d.ts → tokens-D7yXvUU6.d.ts} +15 -2
- package/dist/{track-changes-BSF58RK0.d.cts → track-changes-D_VAPELi.d.cts} +110 -144
- package/dist/{track-changes-BSF58RK0.d.ts → track-changes-Db_fGEvx.d.ts} +110 -144
- package/package.json +21 -1
- package/dist/chunk-4SUNJZWB.cjs.map +0 -1
- package/dist/chunk-AA4ZEVCC.cjs.map +0 -1
- package/dist/chunk-AXV2ZW34.cjs +0 -118
- package/dist/chunk-AXV2ZW34.cjs.map +0 -1
- package/dist/chunk-B2ZRLN4S.js +0 -118
- package/dist/chunk-B2ZRLN4S.js.map +0 -1
- package/dist/chunk-GVSMRPHB.cjs.map +0 -1
- package/dist/chunk-K3R5NG2D.js +0 -3100
- package/dist/chunk-K3R5NG2D.js.map +0 -1
- package/dist/chunk-MJZBNWG7.js.map +0 -1
- package/dist/chunk-OYXSKQFR.js.map +0 -1
- package/dist/chunk-QBJ22YZR.js.map +0 -1
- package/dist/chunk-QGHGJ56O.js.map +0 -1
- package/dist/chunk-RIKBJLS2.cjs.map +0 -1
- package/dist/chunk-XDMXXC4Z.cjs +0 -3100
- package/dist/chunk-XDMXXC4Z.cjs.map +0 -1
- package/dist/controller-pePCJLT1.d.cts +0 -959
- package/dist/controller-pePCJLT1.d.ts +0 -959
- package/dist/index-CCr_z9kF.d.cts +0 -899
- package/dist/index-Ck6ajwXh.d.ts +0 -899
- /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":[]}
|