revise 3.1.7 → 4.0.1
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/CHANGELOG.md +1677 -184
- package/FONT-LICENSE-HAN-EXT-B.txt +91 -0
- package/FONT-LICENSE-KATEX.txt +95 -0
- package/FONT-LICENSE-LIBERATION.txt +102 -0
- package/FONT-LICENSE-NOTO-MULTILINGUAL.txt +93 -0
- package/FONT-LICENSE-NOTO-SANS-SC.txt +93 -0
- package/FONT-LICENSE-NOTO.txt +94 -0
- package/FONT-LICENSE-SOURCE-CODE-PRO.txt +94 -0
- package/FONT-LICENSE-SOURCE-SERIF-4.txt +93 -0
- package/LICENSE +41 -21
- package/README.md +29 -121
- package/THIRD-PARTY-NOTICES.md +2751 -0
- package/assets/historyMaterializeWorker-ZFUHJDWr.js +619 -0
- package/chunks/AgentPageRenderer-CHHktDQ1.js +1 -0
- package/chunks/AgentPageRenderer-CN-N65JC.js +1 -0
- package/chunks/AttachmentDocumentImporter-DnHC9t7I.js +1 -0
- package/chunks/AttachmentDocumentImporter-Dqg7IPtK.js +1 -0
- package/chunks/ColorParserFull-BKH72fK8.js +446 -0
- package/chunks/DocumentScrubber-Ch_bOtHW.js +1 -0
- package/chunks/DocumentScrubber-DRzACkWJ.js +1 -0
- package/chunks/DocxConverter-BGPkGmyg.js +13 -0
- package/chunks/DocxConverter-DeurS5EF.js +13 -0
- package/chunks/DocxGraft-D71OgoMh.js +1 -0
- package/chunks/DocxGraft-QLkGEcwQ.js +1 -0
- package/chunks/FileImporter-BIT0ZBDY.js +1 -0
- package/chunks/FileImporter-Cgwoawuk.js +1 -0
- package/chunks/OdtConverter-2pm0SH5c.js +6 -0
- package/chunks/OdtConverter-CSUQTfVp.js +6 -0
- package/chunks/OfficeImportShared-C_mYnG5V.js +1 -0
- package/chunks/OfficeImportShared-O-d47J7O.js +1 -0
- package/chunks/PdfConverter-BYg_pr5J.js +21 -0
- package/chunks/PdfConverter-Z2HlY84F.js +21 -0
- package/chunks/PdfImportService-C2gwK1Sq.js +2 -0
- package/chunks/PdfImportService-CxtUtxM6.js +2 -0
- package/chunks/RtfConverter-BrtojpDV.js +15 -0
- package/chunks/RtfConverter-DlztsAoK.js +15 -0
- package/chunks/XmlConverter-3XWISlqr.js +2 -0
- package/chunks/XmlConverter-B1Kcohr0.js +2 -0
- package/chunks/__vite-browser-external-l0sNRNKZ.js +0 -0
- package/chunks/_revise-sdk-lazy-harfbuzz-X8gnYTZL.js +1 -0
- package/chunks/ar-vDYSGTpE.js +13 -0
- package/chunks/browser-module-BVdVmrPb.js +3 -0
- package/chunks/browser-module-CWlRHeO2.js +3 -0
- package/chunks/bundle.min-DRpfgV69.js +782 -0
- package/chunks/de-CWX4cvtt.js +13 -0
- package/chunks/es-DoAhvF6_.js +13 -0
- package/chunks/fil-DdAeD8Br.js +13 -0
- package/chunks/fr-CazsUjNQ.js +13 -0
- package/chunks/html2canvas.esm-CntiHiYW.js +997 -0
- package/chunks/index-BWdRWxoH.js +1807 -0
- package/chunks/index-D9_PwgOX.js +402 -0
- package/chunks/index-DcIXw_KB.js +402 -0
- package/chunks/ja-alh_QHTB.js +13 -0
- package/chunks/jspdf.es.min-BuJNZ-oY.js +1882 -0
- package/chunks/katex-DWj8TvwO.js +1462 -0
- package/chunks/pdf-BLWDCiFF.js +1828 -0
- package/chunks/persistInlineDocumentImages-DQj2iaqg.js +1 -0
- package/chunks/pseudoLocale-Bld5ZUFr.js +1 -0
- package/chunks/pseudoLocale-CLm3_c4X.js +1 -0
- package/chunks/tree-sitter-D6zWWUMP.js +4 -0
- package/chunks/wasmInline.generated-CBYFkdSM.js +1 -0
- package/chunks/web-tree-sitter-BXGZGnNj.js +2 -0
- package/chunks/zh-20eXwzFZ.js +13 -0
- package/cli-shim.js +34 -0
- package/full.js +1 -0
- package/index.d.ts +995 -13
- package/index.js +1 -31
- package/legacy/server.d.ts +19 -19
- package/legacy/server.js +39 -23
- package/package.json +55 -45
- package/serverToolContract.d.ts +420 -0
- package/serverToolInputs.generated.d.ts +269 -0
- package/style.css +1 -0
- package/version.d.ts +4 -0
- package/version.js +2 -0
- package/agent.d.ts +0 -139
- package/chunks/chunk-SMTOJL2X.js +0 -2436
- package/chunks/chunk-U5X47PZ6.js +0 -135
- package/chunks/chunk-U6YKQBKL.js +0 -15
- package/chunks/package-5SHL5FOJ.js +0 -14
- package/chunks/render-QD5VWKSV.js +0 -109
- package/cli-output.schema.json +0 -2159
- package/cli.js +0 -4152
- package/document.d.ts +0 -439
- package/docx.d.ts +0 -73
- package/errors.d.ts +0 -14
- package/legacy/editor.d.ts +0 -19
- package/legacy/editor.js +0 -16
- package/legacy/style.css +0 -2
- package/package.d.ts +0 -23
- package/render.d.ts +0 -27
package/document.d.ts
DELETED
|
@@ -1,439 +0,0 @@
|
|
|
1
|
-
import * as Y from "yjs";
|
|
2
|
-
import { ydocSourceFidelity, type ReviseServerExportFormat } from "@reviseio/engine";
|
|
3
|
-
import type { ImageFetchPolicy, ReviseDocumentMeasurementData, ReviseToolDefinition, ReviseJsonObject, ReviseToolArguments, ReviseToolName, ReviseToolResult, ServerDocumentSession } from "@reviseio/engine";
|
|
4
|
-
/** How faithfully the document exports back to its original Word file. */
|
|
5
|
-
export type SourceFidelity = Awaited<ReturnType<typeof ydocSourceFidelity>>;
|
|
6
|
-
import { type DocxExportOutcome } from "./docx.js";
|
|
7
|
-
import type { RenderOptions, RenderResult } from "./render.js";
|
|
8
|
-
export type DocumentMode = "suggesting" | "editing";
|
|
9
|
-
export type ExportFormat = ReviseServerExportFormat | "pdf";
|
|
10
|
-
/** Formats the library reads. */
|
|
11
|
-
export declare const READABLE: RegExp;
|
|
12
|
-
/** The export format a file name implies (`out.pdf` → "pdf"). */
|
|
13
|
-
export declare function formatForPath(file: string): ExportFormat | undefined;
|
|
14
|
-
/** A document to read: a path, or bytes with the file name they came from. */
|
|
15
|
-
export type DocumentSource = string | {
|
|
16
|
-
bytes: Uint8Array;
|
|
17
|
-
filename: string;
|
|
18
|
-
};
|
|
19
|
-
export interface OpenOptions {
|
|
20
|
-
/** Who edits and comments: shown as the author of tracked changes. */
|
|
21
|
-
author?: string;
|
|
22
|
-
/** "suggesting" records edits as tracked changes (the default for Word
|
|
23
|
-
* files); "editing" applies them directly (the default for plain text). */
|
|
24
|
-
mode?: DocumentMode;
|
|
25
|
-
/** A stable id for this document (tool sessions, collaboration). */
|
|
26
|
-
documentId?: string;
|
|
27
|
-
/** How images inserted by URL are fetched. By default only public http(s)
|
|
28
|
-
* hosts are reachable; see ImageFetchPolicy. */
|
|
29
|
-
images?: ImageFetchPolicy;
|
|
30
|
-
}
|
|
31
|
-
export interface ChangeEntry {
|
|
32
|
-
id: string;
|
|
33
|
-
type: string;
|
|
34
|
-
author: string;
|
|
35
|
-
blockId?: string;
|
|
36
|
-
blockIndex?: number;
|
|
37
|
-
/** The heading of the section the change is in. */
|
|
38
|
-
section?: string;
|
|
39
|
-
deleted: string;
|
|
40
|
-
inserted: string;
|
|
41
|
-
}
|
|
42
|
-
/** Narrows tracked changes by where they are. Filters combine: a change
|
|
43
|
-
* must pass every one given. */
|
|
44
|
-
export interface ChangeFilter {
|
|
45
|
-
/** A heading and everything under it, subsections included: its number
|
|
46
|
-
* ("8", "8.", "8.1", including Word's automatic numbering) or its title
|
|
47
|
-
* ("Allocation of risk", or part of it). */
|
|
48
|
-
section?: string;
|
|
49
|
-
/** Everything outside that section. */
|
|
50
|
-
exceptSection?: string;
|
|
51
|
-
/** Block ids, and inclusive `{ from, to }` ranges in document order. Ids
|
|
52
|
-
* of list items, table cells, and blocks inside them work. */
|
|
53
|
-
blocks?: Array<string | {
|
|
54
|
-
from: string;
|
|
55
|
-
to: string;
|
|
56
|
-
}>;
|
|
57
|
-
}
|
|
58
|
-
/** Which tracked changes to settle: exactly one of `ids`, `all`, or
|
|
59
|
-
* filters (`section`, `exceptSection`, `blocks`). */
|
|
60
|
-
export interface ChangeSelection extends ChangeFilter {
|
|
61
|
-
ids?: string[];
|
|
62
|
-
all?: boolean;
|
|
63
|
-
}
|
|
64
|
-
export interface SettleResult {
|
|
65
|
-
resolved: string[];
|
|
66
|
-
/** Requested ids that are not pending tracked changes. */
|
|
67
|
-
missing: string[];
|
|
68
|
-
/** Pending changes that could not be settled. */
|
|
69
|
-
unresolved: string[];
|
|
70
|
-
}
|
|
71
|
-
/** How pending tracked changes read: "tracked" shows them (deleted and
|
|
72
|
-
* inserted text, marked), "accepted" as if every one were accepted (what
|
|
73
|
-
* the editing tools see), "original" as if every one were rejected. */
|
|
74
|
-
export type ReadView = "tracked" | "accepted" | "original";
|
|
75
|
-
export interface GrepMatch {
|
|
76
|
-
text: string;
|
|
77
|
-
/** Inside text a pending change inserted or deleted; null for text no
|
|
78
|
-
* change touches. */
|
|
79
|
-
change: "inserted" | "deleted" | null;
|
|
80
|
-
changeId: string | null;
|
|
81
|
-
}
|
|
82
|
-
export interface GrepHit {
|
|
83
|
-
id: string;
|
|
84
|
-
blockIndex: number;
|
|
85
|
-
count: number;
|
|
86
|
-
/** The block's text in the view. Tracked marks changes inline:
|
|
87
|
-
* "Fees are [-$100-]{+$120+} per hour." */
|
|
88
|
-
text: string;
|
|
89
|
-
matches: GrepMatch[];
|
|
90
|
-
}
|
|
91
|
-
/** Where a block is: the body, a page header or footer, or a note. */
|
|
92
|
-
export type TextRegion = "body" | "header" | "footer" | "footnote" | "endnote";
|
|
93
|
-
export interface ReplaceAllOptions {
|
|
94
|
-
/** Only in these blocks (ids from `read`, `grep`, `search`). */
|
|
95
|
-
blocks?: string[];
|
|
96
|
-
/** @deprecated The older name for `blocks`. */
|
|
97
|
-
ids?: string[];
|
|
98
|
-
/** Match regardless of case: "Provider" also finds "PROVIDER". */
|
|
99
|
-
ignoreCase?: boolean;
|
|
100
|
-
/** Match characters exactly. By default curly and straight quotes,
|
|
101
|
-
* non-breaking and ordinary spaces, and non-breaking and ordinary
|
|
102
|
-
* hyphens match each other, the way Word's Find treats quotes. */
|
|
103
|
-
exact?: boolean;
|
|
104
|
-
}
|
|
105
|
-
export interface ReplaceTextResult {
|
|
106
|
-
/** Occurrences replaced. */
|
|
107
|
-
replaced: number;
|
|
108
|
-
/** Ids of the blocks that contained the text. */
|
|
109
|
-
blocks: string[];
|
|
110
|
-
/** Occurrences replaced in each part of the document. */
|
|
111
|
-
regions: Partial<Record<TextRegion, number>>;
|
|
112
|
-
/** Tracked changes the replacement created (none in editing mode). */
|
|
113
|
-
changeIds: string[];
|
|
114
|
-
/** Blocks that contained the text but could not be edited. */
|
|
115
|
-
failures: Array<{
|
|
116
|
-
blockId: string;
|
|
117
|
-
code: string;
|
|
118
|
-
message: string;
|
|
119
|
-
}>;
|
|
120
|
-
/** Text that would match with looser options but wasn't replaced: other
|
|
121
|
-
* capitalization (`ignoreCase`) or other quotes and spaces (`exact`). */
|
|
122
|
-
nearMisses: Array<{
|
|
123
|
-
text: string;
|
|
124
|
-
count: number;
|
|
125
|
-
reason: "case" | "characters";
|
|
126
|
-
}>;
|
|
127
|
-
}
|
|
128
|
-
export interface TextDiff {
|
|
129
|
-
/** Paragraph-level diff with word detail: `~ a [-old-]{+new+} b`. */
|
|
130
|
-
text: string;
|
|
131
|
-
changed: number;
|
|
132
|
-
}
|
|
133
|
-
export interface DocumentSummary {
|
|
134
|
-
text: string;
|
|
135
|
-
data: {
|
|
136
|
-
pages?: number;
|
|
137
|
-
words: number;
|
|
138
|
-
pageSize: string;
|
|
139
|
-
orientation: string;
|
|
140
|
-
pageInches: [number, number];
|
|
141
|
-
marginsInches: number[];
|
|
142
|
-
title?: string;
|
|
143
|
-
headings: Record<string, number>;
|
|
144
|
-
lists: number[];
|
|
145
|
-
tables: string[];
|
|
146
|
-
images: number;
|
|
147
|
-
headersFooters: Array<{
|
|
148
|
-
side: string;
|
|
149
|
-
slot: string;
|
|
150
|
-
text: string;
|
|
151
|
-
}>;
|
|
152
|
-
pendingTrackedChanges: number;
|
|
153
|
-
};
|
|
154
|
-
}
|
|
155
|
-
export interface ExportOptions {
|
|
156
|
-
format: ExportFormat;
|
|
157
|
-
/** "review" keeps tracked changes and comments; "final" accepts them.
|
|
158
|
-
* Only .docx can hold tracked changes: PDF, Markdown, HTML, and text
|
|
159
|
-
* always show them accepted. */
|
|
160
|
-
mode?: "review" | "final";
|
|
161
|
-
/** The same choice in read's words, and one more: "tracked" is
|
|
162
|
-
* "review", "accepted" is "final", and "original" writes the document as
|
|
163
|
-
* it was before every pending change. Give `mode` or `view`, not both. */
|
|
164
|
-
view?: ReadView;
|
|
165
|
-
title?: string;
|
|
166
|
-
}
|
|
167
|
-
export interface ExportResult {
|
|
168
|
-
bytes: Uint8Array;
|
|
169
|
-
format: ExportFormat;
|
|
170
|
-
/** The mode the output actually has: only .docx can be "review". */
|
|
171
|
-
mode: "review" | "final";
|
|
172
|
-
/** The view the output shows: "tracked" only for a .docx. */
|
|
173
|
-
view: ReadView;
|
|
174
|
-
/** Tracked changes still pending in the output. */
|
|
175
|
-
pendingTrackedChanges: number;
|
|
176
|
-
/** For .docx, what the export actually did: "graft" carried untouched
|
|
177
|
-
* content over byte for byte from the original file; "regenerated" wrote
|
|
178
|
-
* the whole file fresh (fallbackCode says why). */
|
|
179
|
-
fidelity: DocxExportOutcome | null;
|
|
180
|
-
warnings: string[];
|
|
181
|
-
}
|
|
182
|
-
/** Bytes of a document in a format, through graft export when the original
|
|
183
|
-
* Word package is available, with what the .docx export actually did. */
|
|
184
|
-
export declare function exportYDoc(ydoc: Y.Doc, pkg: Uint8Array | null, { format, mode, title }: ExportOptions): Promise<{
|
|
185
|
-
bytes: Uint8Array;
|
|
186
|
-
outcome: DocxExportOutcome | null;
|
|
187
|
-
}>;
|
|
188
|
-
/**
|
|
189
|
-
* One open document: a live Revise document model plus the agent tool
|
|
190
|
-
* session that edits it. Nothing touches disk unless you export it.
|
|
191
|
-
*/
|
|
192
|
-
export declare class ReviseDocument {
|
|
193
|
-
private currentYDoc;
|
|
194
|
-
private currentSession;
|
|
195
|
-
private readonly settings;
|
|
196
|
-
private originalPackage;
|
|
197
|
-
/** False when the Y.Doc came from the caller (fromYDoc): it may be
|
|
198
|
-
* shared with an editor or a provider, so it is never replaced. */
|
|
199
|
-
private readonly ownsYDoc;
|
|
200
|
-
private disposed;
|
|
201
|
-
private queue;
|
|
202
|
-
private constructor();
|
|
203
|
-
/** Open a file (path) or bytes. Word files keep their original package,
|
|
204
|
-
* so untouched content exports byte for byte. */
|
|
205
|
-
static open(source: DocumentSource, options?: OpenOptions): Promise<ReviseDocument>;
|
|
206
|
-
/** Start a document from the HTML the tools read and write (headings,
|
|
207
|
-
* `data-style-id="Title"`, lists, tables), or from Markdown. */
|
|
208
|
-
static create(content?: {
|
|
209
|
-
html?: string;
|
|
210
|
-
markdown?: string;
|
|
211
|
-
title?: string;
|
|
212
|
-
}, options?: OpenOptions): Promise<ReviseDocument>;
|
|
213
|
-
/** Restore a document from `snapshot()` (or a bare Y.js update). Options
|
|
214
|
-
* override what the snapshot recorded. */
|
|
215
|
-
static restore(snapshot: Uint8Array, options?: OpenOptions): Promise<ReviseDocument>;
|
|
216
|
-
/** Wrap an existing Revise Y.Doc, e.g. one shared with an editor. The
|
|
217
|
-
* Y.Doc stays yours: `dispose()` leaves it intact, and `reload()` is not
|
|
218
|
-
* available (it would have to replace it). */
|
|
219
|
-
static fromYDoc(ydoc: Y.Doc, options?: OpenOptions & {
|
|
220
|
-
package?: Uint8Array | null;
|
|
221
|
-
title?: string;
|
|
222
|
-
}): Promise<ReviseDocument>;
|
|
223
|
-
private static build;
|
|
224
|
-
private static startSession;
|
|
225
|
-
private assertOpen;
|
|
226
|
-
/** Run `work` after every operation already queued on this document. */
|
|
227
|
-
private serial;
|
|
228
|
-
/** The live document model. Shared with `@reviseio/editor`. */
|
|
229
|
-
get ydoc(): Y.Doc;
|
|
230
|
-
/** The low-level tool session behind `tools`: an escape hatch for what
|
|
231
|
-
* the methods here don't cover. */
|
|
232
|
-
get session(): ServerDocumentSession;
|
|
233
|
-
get mode(): DocumentMode;
|
|
234
|
-
/** Switch between tracked changes ("suggesting") and direct edits. */
|
|
235
|
-
setMode(mode: DocumentMode): Promise<void>;
|
|
236
|
-
get author(): string | undefined;
|
|
237
|
-
get documentId(): string;
|
|
238
|
-
/** The original Word package that export grafts onto, if any. */
|
|
239
|
-
get package(): Uint8Array | null;
|
|
240
|
-
/** The complete document (versioned; includes the original Word package)
|
|
241
|
-
* to store or hand to `@reviseio/editor`, as of every operation queued
|
|
242
|
-
* before this call. Restore with `restore()`. */
|
|
243
|
-
snapshot(): Promise<Uint8Array>;
|
|
244
|
-
/** An opaque value that changes whenever the document does (including
|
|
245
|
-
* edits that only delete, which a state vector misses). */
|
|
246
|
-
version(): Uint8Array;
|
|
247
|
-
/**
|
|
248
|
-
* Re-read the document from new bytes (it changed elsewhere). Block ids
|
|
249
|
-
* carry over only where identity is provable (Word's paragraph ids, or
|
|
250
|
-
* identical content); `changedIds` lists kept ids whose content changed,
|
|
251
|
-
* so earlier reads of them are stale. Replaces the Y.Doc, so it is not
|
|
252
|
-
* available on a document made with `fromYDoc`.
|
|
253
|
-
*/
|
|
254
|
-
reload(bytes: Uint8Array, filename: string): Promise<{
|
|
255
|
-
idsKept: number;
|
|
256
|
-
idsNew: number;
|
|
257
|
-
changedIds: string[];
|
|
258
|
-
removedIds: string[];
|
|
259
|
-
}>;
|
|
260
|
-
/** Start the tool session over: forget what the agent has read and
|
|
261
|
-
* searched (e.g. after the host compacts its transcript). */
|
|
262
|
-
resetToolContext(): Promise<void>;
|
|
263
|
-
/** Release the tool session. The document can't be used afterwards; a
|
|
264
|
-
* Y.Doc it created is destroyed, one passed to fromYDoc is left alone. */
|
|
265
|
-
dispose(): void;
|
|
266
|
-
readonly tools: {
|
|
267
|
-
/** Every editing tool's name, description, and JSON input schema. */
|
|
268
|
-
definitions: () => ReviseToolDefinition[];
|
|
269
|
-
/** Run a known tool with typed input. Expected failures come back as
|
|
270
|
-
* `{ ok: false, error }`; nothing throws for a bad edit. */
|
|
271
|
-
call: <Name extends ReviseToolName>(name: Name, ...args: ReviseToolArguments<Name>) => Promise<ReviseToolResult<Name>>;
|
|
272
|
-
/** Run a tool by name with untyped input (agent tool calls). Unknown
|
|
273
|
-
* tools and bad input come back as `{ ok: false, error }` too. */
|
|
274
|
-
run: (name: string, input?: ReviseJsonObject, options?: {
|
|
275
|
-
direct?: boolean;
|
|
276
|
-
}) => Promise<ReviseToolResult<string>>;
|
|
277
|
-
};
|
|
278
|
-
/** The document's title for exports: its saved title property (dc:title
|
|
279
|
-
* in a .docx, or set_title's), else the name it was opened under. */
|
|
280
|
-
private title;
|
|
281
|
-
/** set_title renames the document in the editor. In a file, the title is
|
|
282
|
-
* the document property (docProps/core.xml in a .docx, the PDF title), so
|
|
283
|
-
* it is saved there too; without this, the tool reported success and the
|
|
284
|
-
* saved file kept its old title. */
|
|
285
|
-
private afterTool;
|
|
286
|
-
/** Sections with their block ranges and word counts. */
|
|
287
|
-
outline(options?: {
|
|
288
|
-
limit?: number;
|
|
289
|
-
offset?: number;
|
|
290
|
-
}): Promise<ReviseDocumentMeasurementData>;
|
|
291
|
-
/** measure_document with every section from `offset` on, page by page. */
|
|
292
|
-
private allSections;
|
|
293
|
-
/**
|
|
294
|
-
* The top-level blocks a selection names, in document order: block ids
|
|
295
|
-
* and `first..last` ranges (a nested id stands for the block holding it),
|
|
296
|
-
* a section (its heading's range, subsections included; "4,7,9" for
|
|
297
|
-
* several), or `count`
|
|
298
|
-
* blocks from `index`. Naming a block or section that doesn't exist is an
|
|
299
|
-
* error.
|
|
300
|
-
*/
|
|
301
|
-
selectBlocks(selection: {
|
|
302
|
-
blocks?: string;
|
|
303
|
-
section?: string;
|
|
304
|
-
index?: number;
|
|
305
|
-
count?: number;
|
|
306
|
-
}): Promise<string[]>;
|
|
307
|
-
/**
|
|
308
|
-
* Paragraphs that look like section headings but aren't styled as
|
|
309
|
-
* headings: short, entirely bold, and numbered like the document's real
|
|
310
|
-
* headings ("12. Overtime" between headings 11 and 13) with a number no
|
|
311
|
-
* heading has. Word documents often have one typed by hand.
|
|
312
|
-
*/
|
|
313
|
-
unstyledHeadings(): Promise<Array<{
|
|
314
|
-
id: string;
|
|
315
|
-
blockIndex: number;
|
|
316
|
-
text: string;
|
|
317
|
-
level: number;
|
|
318
|
-
}>>;
|
|
319
|
-
/**
|
|
320
|
-
* read/search HTML for a reader to look at, leaving out what goes without
|
|
321
|
-
* saying: in each paragraph or heading, spacing, line height, keep
|
|
322
|
-
* settings, and text size and color equal to what its paragraph style
|
|
323
|
-
* (data-style-id, else the default "Normal") already sets; in table
|
|
324
|
-
* cells, the default 1px border and 8px padding; and grid columns in
|
|
325
|
-
* tables with no merged cells. Every value left out is one the block
|
|
326
|
-
* gets anyway when it's written back without it. Starts with a comment
|
|
327
|
-
* saying so.
|
|
328
|
-
*/
|
|
329
|
-
compactHtml(html: string): string;
|
|
330
|
-
/** Blocks, words, pending changes, and how faithfully it exports to Word. */
|
|
331
|
-
status(): Promise<{
|
|
332
|
-
blocks: number;
|
|
333
|
-
words: number;
|
|
334
|
-
pendingSuggestions: number;
|
|
335
|
-
fidelity: SourceFidelity | null;
|
|
336
|
-
}>;
|
|
337
|
-
/** Text-bearing blocks matching a pattern (paragraphs, headings, list
|
|
338
|
-
* items, table-cell paragraphs), with their ids. */
|
|
339
|
-
grep(pattern: string | RegExp, options?: {
|
|
340
|
-
ignoreCase?: boolean;
|
|
341
|
-
view?: ReadView;
|
|
342
|
-
}): GrepHit[];
|
|
343
|
-
/**
|
|
344
|
-
* HTML the read tools returned (`read_blocks_from_index`,
|
|
345
|
-
* `read_specific_blocks`), in a view. The tools read the accepted view;
|
|
346
|
-
* "tracked" marks pending changes as `<ins>`/`<del>` with
|
|
347
|
-
* `data-change-id` and `data-author`, and shows whole blocks a change
|
|
348
|
-
* deletes where they were; "original" shows the text before every change.
|
|
349
|
-
* Block ids are unchanged. The editing tools read `<ins>` as its text and
|
|
350
|
-
* ignore `<del>`, so tracked HTML pasted back edits the accepted text.
|
|
351
|
-
*/
|
|
352
|
-
viewHtml(html: string, view: ReadView): Promise<string>;
|
|
353
|
-
/** What the document holds, in one glance: page setup, header and footer
|
|
354
|
-
* text with live fields, title, headings, lists, tables, review state. */
|
|
355
|
-
summary(): Promise<DocumentSummary>;
|
|
356
|
-
/**
|
|
357
|
-
* Replace every occurrence everywhere: the body, tables, lists, page
|
|
358
|
-
* headers and footers, and footnotes and endnotes. Tracked changes in
|
|
359
|
-
* suggesting mode. Curly and straight quotes and non-breaking spaces match
|
|
360
|
-
* each other unless `exact`, and the replacement keeps the document's
|
|
361
|
-
* characters (see matchDocumentCharacters). Replacing text with itself
|
|
362
|
-
* changes nothing and is not a failure.
|
|
363
|
-
*/
|
|
364
|
-
replaceAll(find: string, replace: string, options?: ReplaceAllOptions): Promise<ReplaceTextResult>;
|
|
365
|
-
/** @deprecated The 3.0 name of `replaceAll`. */
|
|
366
|
-
replaceText(find: string, replace: string, options?: ReplaceAllOptions): Promise<ReplaceTextResult>;
|
|
367
|
-
/** The document as it was before every pending change, exported from
|
|
368
|
-
* a copy: this document keeps its changes. */
|
|
369
|
-
private exportOriginal;
|
|
370
|
-
/** Pending tracked changes with where they are and what they do. */
|
|
371
|
-
changes(filter?: ChangeFilter): Promise<ChangeEntry[]>;
|
|
372
|
-
private filteredChanges;
|
|
373
|
-
/** The tracked changes a selection would settle, without settling them. */
|
|
374
|
-
preview(selection: ChangeSelection): Promise<ChangeEntry[]>;
|
|
375
|
-
accept(selection: ChangeSelection): Promise<SettleResult>;
|
|
376
|
-
reject(selection: ChangeSelection): Promise<SettleResult>;
|
|
377
|
-
private selectedIds;
|
|
378
|
-
private settle;
|
|
379
|
-
/**
|
|
380
|
-
* What the pending tracked changes do to the text (before → after), or
|
|
381
|
-
* what changed since `baseline` (a snapshot).
|
|
382
|
-
*/
|
|
383
|
-
diff(baseline?: Uint8Array): Promise<TextDiff>;
|
|
384
|
-
/** Write the document in a format. Reports what the output actually
|
|
385
|
-
* contains: its pending changes, and for .docx how much of the original
|
|
386
|
-
* file was carried over byte for byte. */
|
|
387
|
-
export(options: ExportOptions): Promise<ExportResult>;
|
|
388
|
-
/** Pages as images, laid out exactly as the editor lays them out. */
|
|
389
|
-
renderPages(options?: RenderOptions): Promise<RenderResult>;
|
|
390
|
-
}
|
|
391
|
-
export interface CompareResult {
|
|
392
|
-
/** The revised document with every difference as a tracked change. */
|
|
393
|
-
document: ReviseDocument;
|
|
394
|
-
stats: {
|
|
395
|
-
inlineChanges: number;
|
|
396
|
-
insertedBlocks: number;
|
|
397
|
-
deletedBlocks: number;
|
|
398
|
-
unmarkedBlocks: number;
|
|
399
|
-
};
|
|
400
|
-
untrackedRegions: string[];
|
|
401
|
-
/** Accepting every change in the exported redline (read back from the
|
|
402
|
-
* .docx) gives the revised text; rejecting every change gives the
|
|
403
|
-
* original. Text only: formatting and comments are not compared. */
|
|
404
|
-
verified: {
|
|
405
|
-
acceptAllGivesRevised: boolean;
|
|
406
|
-
rejectAllGivesOriginal: boolean;
|
|
407
|
-
};
|
|
408
|
-
}
|
|
409
|
-
/** A redline: `revised` with every difference from `original` tracked. */
|
|
410
|
-
/**
|
|
411
|
-
* Seed a collaboration room (a Y.Doc your sync server owns) from a file, and
|
|
412
|
-
* say whether it wrote anything. A room that already holds a document is
|
|
413
|
-
* left alone, so call it on every connection:
|
|
414
|
-
*
|
|
415
|
-
* onLoadDocument: async ({ document }) => {
|
|
416
|
-
* await seedYDoc(document, "contract.docx");
|
|
417
|
-
* }
|
|
418
|
-
*
|
|
419
|
-
* Two peers that both seeded an empty room before syncing are repaired to a
|
|
420
|
-
* single copy. A Word file is stored in the room too, so any session over
|
|
421
|
-
* it (`ReviseDocument.fromYDoc`, or the editor) exports untouched content
|
|
422
|
-
* byte for byte.
|
|
423
|
-
*/
|
|
424
|
-
export declare function seedYDoc(ydoc: Y.Doc, source: DocumentSource): Promise<boolean>;
|
|
425
|
-
export declare function compare(originalSource: DocumentSource, revisedSource: DocumentSource, options?: OpenOptions): Promise<CompareResult>;
|
|
426
|
-
/** Convert a document to another format in one step. */
|
|
427
|
-
export declare function convert(source: DocumentSource, format: ExportFormat, options?: {
|
|
428
|
-
mode?: "review" | "final";
|
|
429
|
-
view?: ReadView;
|
|
430
|
-
}): Promise<Uint8Array>;
|
|
431
|
-
/** Whether a heading is the one a section query names: "8", "8.", "8.1",
|
|
432
|
-
* "Allocation of risk", or "8. Allocation". */
|
|
433
|
-
export declare function headingMatches(title: string, query: string): boolean;
|
|
434
|
-
/** A --blocks query: block ids and `first..last` ranges ("…" and "..."
|
|
435
|
-
* work too), e.g. "a1,b2..c3". */
|
|
436
|
-
export declare function parseBlockQuery(query: string): Array<string | {
|
|
437
|
-
from: string;
|
|
438
|
-
to: string;
|
|
439
|
-
}>;
|
package/docx.d.ts
DELETED
|
@@ -1,73 +0,0 @@
|
|
|
1
|
-
import * as Y from "yjs";
|
|
2
|
-
import type { DocRoot } from "@reviseio/engine";
|
|
3
|
-
/** What a .docx export actually did. */
|
|
4
|
-
export interface DocxExportOutcome {
|
|
5
|
-
/** "graft": untouched content copied byte for byte from the original;
|
|
6
|
-
* "regenerated": the whole file written fresh (no original, or graft
|
|
7
|
-
* refused it, see fallbackCode). */
|
|
8
|
-
method: "graft" | "regenerated";
|
|
9
|
-
exact: boolean;
|
|
10
|
-
regeneratedBlocks: number;
|
|
11
|
-
fallbackCode?: string;
|
|
12
|
-
}
|
|
13
|
-
/**
|
|
14
|
-
* The session as a .docx: the model's changes grafted onto the session's
|
|
15
|
-
* package. Without a package (a document not opened from .docx) it is the
|
|
16
|
-
* ordinary export. Paragraphs and rows the export writes fresh get a
|
|
17
|
-
* w14:paraId if they lack one (see stampParaIds); untouched ones never do.
|
|
18
|
-
* Reports what the converter actually did, not what it was asked to do.
|
|
19
|
-
*/
|
|
20
|
-
export declare function exportSessionDocx(ydoc: Y.Doc, pkg: Uint8Array | null, mode?: "review" | "final"): Promise<{
|
|
21
|
-
bytes: Uint8Array;
|
|
22
|
-
outcome: DocxExportOutcome;
|
|
23
|
-
}>;
|
|
24
|
-
/** The w14:paraId revise writes for a block it created: derived from the
|
|
25
|
-
* block id, so it is the same on every save and maps back on re-read.
|
|
26
|
-
* Word's rules: 8 hex digits, below 0x80000000. */
|
|
27
|
-
export declare function derivedParaId(blockId: string, salt?: number): string;
|
|
28
|
-
/**
|
|
29
|
-
* Give paragraphs and table rows a w14:paraId where they lack one, but only
|
|
30
|
-
* in blocks the export writes fresh (`regenerated`; null = every block):
|
|
31
|
-
* untouched content keeps its exact bytes. Returns a copy.
|
|
32
|
-
*/
|
|
33
|
-
/** What graft export copies from the original: whole parts, and changed
|
|
34
|
-
* rows whose own properties (their head) are unchanged. */
|
|
35
|
-
interface GraftKept {
|
|
36
|
-
whole: Set<string>;
|
|
37
|
-
head: Set<string>;
|
|
38
|
-
}
|
|
39
|
-
export declare function stampParaIds(doc: DocRoot, regenerated: ReadonlySet<string> | null,
|
|
40
|
-
/** Parts the graft copies from the original: never stamped. */
|
|
41
|
-
kept?: GraftKept): DocRoot;
|
|
42
|
-
export interface IdMatchReport {
|
|
43
|
-
/** Ids carried over to the re-read document. */
|
|
44
|
-
kept: number;
|
|
45
|
-
/** New blocks (or ones with no provable identity): fresh ids. */
|
|
46
|
-
fresh: number;
|
|
47
|
-
/** Kept ids whose content changed: earlier reads of them are stale. */
|
|
48
|
-
changedIds: string[];
|
|
49
|
-
/** Old ids that no longer exist. */
|
|
50
|
-
removedIds: string[];
|
|
51
|
-
}
|
|
52
|
-
/** Carry ids from `previous` onto the re-imported `next` (mutated). */
|
|
53
|
-
export declare function matchIds(previous: DocRoot, next: DocRoot): IdMatchReport;
|
|
54
|
-
export interface SyncResult {
|
|
55
|
-
ydoc: Y.Doc;
|
|
56
|
-
pkg: Uint8Array;
|
|
57
|
-
idsKept: number;
|
|
58
|
-
idsNew: number;
|
|
59
|
-
/** Kept ids whose content changed: earlier reads of them are stale. */
|
|
60
|
-
changedIds: string[];
|
|
61
|
-
/** Ids that no longer exist. */
|
|
62
|
-
removedIds: string[];
|
|
63
|
-
changedBlocks: number;
|
|
64
|
-
changedStyles: string[];
|
|
65
|
-
}
|
|
66
|
-
/**
|
|
67
|
-
* Make `bytes` (any supported format) the session's model: parse them, carry
|
|
68
|
-
* block ids over where identity is provable (see matchIds), and
|
|
69
|
-
* keep a .docx as the graft package. Used after an xml patch and when the
|
|
70
|
-
* file changed outside revise.
|
|
71
|
-
*/
|
|
72
|
-
export declare function relearn(ydoc: Y.Doc, bytes: Uint8Array, filename: string): Promise<SyncResult>;
|
|
73
|
-
export {};
|
package/errors.d.ts
DELETED
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* The one error type the library throws for expected failures (a missing
|
|
3
|
-
* file, an unsupported format, a malformed patch). `code` is stable and
|
|
4
|
-
* machine-readable; the CLI prints it as `error <code>: <message>`.
|
|
5
|
-
*/
|
|
6
|
-
export declare class ReviseError extends Error {
|
|
7
|
-
readonly code: string;
|
|
8
|
-
/** The underlying error, when this one wraps another (a filesystem or
|
|
9
|
-
* parser failure). */
|
|
10
|
-
readonly cause?: unknown;
|
|
11
|
-
constructor(message: string, code?: string, options?: {
|
|
12
|
-
cause?: unknown;
|
|
13
|
-
});
|
|
14
|
-
}
|
package/legacy/editor.d.ts
DELETED
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
/** @deprecated The Revise editor moved to @reviseio/editor. Install it (npm i @reviseio/editor) and change imports of revise/editor to @reviseio/editor. See https://revise.io/developer/docs/editor-sdk/installation#migrate-from-revise-2x */
|
|
2
|
-
declare const moved: never;
|
|
3
|
-
export default moved;
|
|
4
|
-
/** @deprecated The Revise editor moved to @reviseio/editor. Install it (npm i @reviseio/editor) and change imports of revise/editor to @reviseio/editor. See https://revise.io/developer/docs/editor-sdk/installation#migrate-from-revise-2x */
|
|
5
|
-
export declare const ReviseToolError: never;
|
|
6
|
-
/** @deprecated The Revise editor moved to @reviseio/editor. Install it (npm i @reviseio/editor) and change imports of revise/editor to @reviseio/editor. See https://revise.io/developer/docs/editor-sdk/installation#migrate-from-revise-2x */
|
|
7
|
-
export declare const REVISE_SDK_VERSION: never;
|
|
8
|
-
/** @deprecated The Revise editor moved to @reviseio/editor. Install it (npm i @reviseio/editor) and change imports of revise/editor to @reviseio/editor. See https://revise.io/developer/docs/editor-sdk/installation#migrate-from-revise-2x */
|
|
9
|
-
export declare const REVISE_SDK_BUILD: never;
|
|
10
|
-
/** @deprecated The Revise editor moved to @reviseio/editor. Install it (npm i @reviseio/editor) and change imports of revise/editor to @reviseio/editor. See https://revise.io/developer/docs/editor-sdk/installation#migrate-from-revise-2x */
|
|
11
|
-
export declare const createEmptyDocx: never;
|
|
12
|
-
/** @deprecated The Revise editor moved to @reviseio/editor. Install it (npm i @reviseio/editor) and change imports of revise/editor to @reviseio/editor. See https://revise.io/developer/docs/editor-sdk/installation#migrate-from-revise-2x */
|
|
13
|
-
export declare const setAssetBaseUrl: never;
|
|
14
|
-
/** @deprecated The Revise editor moved to @reviseio/editor. Install it (npm i @reviseio/editor) and change imports of revise/editor to @reviseio/editor. See https://revise.io/developer/docs/editor-sdk/installation#migrate-from-revise-2x */
|
|
15
|
-
export declare const rolePolicy: never;
|
|
16
|
-
/** @deprecated The Revise editor moved to @reviseio/editor. Install it (npm i @reviseio/editor) and change imports of revise/editor to @reviseio/editor. See https://revise.io/developer/docs/editor-sdk/installation#migrate-from-revise-2x */
|
|
17
|
-
export declare const ReviseRoleError: never;
|
|
18
|
-
/** @deprecated The Revise editor moved to @reviseio/editor. Install it (npm i @reviseio/editor) and change imports of revise/editor to @reviseio/editor. See https://revise.io/developer/docs/editor-sdk/installation#migrate-from-revise-2x */
|
|
19
|
-
export declare const ReviseEditor: never;
|
package/legacy/editor.js
DELETED
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
// Generated from the export list of revise@2.2.0 (frozen). revise 2.x was
|
|
2
|
-
// the Revise editor; these names exist only so that 2.x import statements
|
|
3
|
-
// link and reach the message below instead of an opaque linking error.
|
|
4
|
-
throw new Error(
|
|
5
|
-
"The Revise editor moved to @reviseio/editor. Install it (npm i @reviseio/editor) and change imports of revise/editor to @reviseio/editor. See https://revise.io/developer/docs/editor-sdk/installation#migrate-from-revise-2x",
|
|
6
|
-
);
|
|
7
|
-
|
|
8
|
-
export default undefined;
|
|
9
|
-
export const ReviseToolError = undefined;
|
|
10
|
-
export const REVISE_SDK_VERSION = undefined;
|
|
11
|
-
export const REVISE_SDK_BUILD = undefined;
|
|
12
|
-
export const createEmptyDocx = undefined;
|
|
13
|
-
export const setAssetBaseUrl = undefined;
|
|
14
|
-
export const rolePolicy = undefined;
|
|
15
|
-
export const ReviseRoleError = undefined;
|
|
16
|
-
export const ReviseEditor = undefined;
|
package/legacy/style.css
DELETED
package/package.d.ts
DELETED
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
/** Parts of a .docx file, from its bytes. */
|
|
2
|
-
export declare function listParts(bytes: Uint8Array): Promise<Array<{
|
|
3
|
-
path: string;
|
|
4
|
-
bytes: number;
|
|
5
|
-
}>>;
|
|
6
|
-
/** `catPart` returns at most this many matches. */
|
|
7
|
-
export declare const CAT_MATCH_LIMIT = 20;
|
|
8
|
-
export declare function catPart(bytes: Uint8Array, part: string, match?: string, limit?: number): Promise<string[]>;
|
|
9
|
-
export interface PatchRequest {
|
|
10
|
-
part: string;
|
|
11
|
-
find?: string;
|
|
12
|
-
replace?: string;
|
|
13
|
-
all?: boolean;
|
|
14
|
-
file?: string;
|
|
15
|
-
}
|
|
16
|
-
export interface PatchResult {
|
|
17
|
-
bytes: Uint8Array;
|
|
18
|
-
replacements: number;
|
|
19
|
-
/** The part feeds Revise's own view: the model re-learns the package on
|
|
20
|
-
* the next command that reads it. */
|
|
21
|
-
modelRead: boolean;
|
|
22
|
-
}
|
|
23
|
-
export declare function patchPackage(pkg: Uint8Array, request: PatchRequest, readFile: (path: string) => string): Promise<PatchResult>;
|
package/render.d.ts
DELETED
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
import type * as Y from "yjs";
|
|
2
|
-
export type RenderView = "tracked" | "accepted" | "original";
|
|
3
|
-
export interface RenderOptions {
|
|
4
|
-
/** First page, 1-based. Default 1. */
|
|
5
|
-
startPage?: number;
|
|
6
|
-
/** Pages in one image, 1-6. Default 1. */
|
|
7
|
-
pageCount?: number;
|
|
8
|
-
/** Tracked changes shown as marks (default), accepted, or before them. */
|
|
9
|
-
view?: RenderView;
|
|
10
|
-
/** Overlay layout boxes (margins, block bounds) for debugging. */
|
|
11
|
-
layout?: boolean;
|
|
12
|
-
/** "detailed" (default for one page) or "compact". */
|
|
13
|
-
quality?: "compact" | "detailed";
|
|
14
|
-
}
|
|
15
|
-
export interface RenderResult {
|
|
16
|
-
bytes: Uint8Array;
|
|
17
|
-
mimeType: string;
|
|
18
|
-
width: number;
|
|
19
|
-
height: number;
|
|
20
|
-
pages: number[];
|
|
21
|
-
totalPages: number;
|
|
22
|
-
placeholderImageCount: number;
|
|
23
|
-
failedImageCount: number;
|
|
24
|
-
description: string;
|
|
25
|
-
}
|
|
26
|
-
/** Lay out the document and draw the requested pages as one image. */
|
|
27
|
-
export declare function renderPages(ydoc: Y.Doc, documentId: string, options: RenderOptions): Promise<RenderResult>;
|