@build-qube/papyra 0.4.0 → 0.5.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 +12 -1
- package/dist/attachments.d.ts +6 -1
- package/dist/attachments.d.ts.map +1 -1
- package/dist/attachments.js +6 -1
- package/dist/attachments.js.map +1 -1
- package/dist/cache.d.ts +5 -0
- package/dist/cache.d.ts.map +1 -1
- package/dist/cache.js +8 -0
- package/dist/cache.js.map +1 -1
- package/dist/canvas.d.ts +2 -2
- package/dist/canvas.d.ts.map +1 -1
- package/dist/canvas.js +20 -7
- package/dist/canvas.js.map +1 -1
- package/dist/core.d.ts +53 -0
- package/dist/core.d.ts.map +1 -0
- package/dist/core.js +38 -0
- package/dist/core.js.map +1 -0
- package/dist/document.d.ts +28 -20
- package/dist/document.d.ts.map +1 -1
- package/dist/document.js +79 -360
- package/dist/document.js.map +1 -1
- package/dist/engine.d.ts +327 -0
- package/dist/engine.d.ts.map +1 -0
- package/dist/engine.js +485 -0
- package/dist/engine.js.map +1 -0
- package/dist/errors.d.ts +2 -1
- package/dist/errors.d.ts.map +1 -1
- package/dist/errors.js +2 -1
- package/dist/errors.js.map +1 -1
- package/dist/fingerprint.d.ts +2 -1
- package/dist/fingerprint.d.ts.map +1 -1
- package/dist/fingerprint.js +2 -1
- package/dist/fingerprint.js.map +1 -1
- package/dist/index.d.ts +4 -27
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +3 -12
- package/dist/index.js.map +1 -1
- package/dist/links.d.ts +6 -1
- package/dist/links.d.ts.map +1 -1
- package/dist/links.js +6 -1
- package/dist/links.js.map +1 -1
- package/dist/office.d.ts +85 -0
- package/dist/office.d.ts.map +1 -0
- package/dist/office.js +135 -0
- package/dist/office.js.map +1 -0
- package/dist/papyra-engine.d.ts +68 -0
- package/dist/papyra-engine.d.ts.map +1 -0
- package/dist/papyra-engine.js +173 -0
- package/dist/papyra-engine.js.map +1 -0
- package/dist/runtime.d.ts +7 -0
- package/dist/runtime.d.ts.map +1 -1
- package/dist/runtime.js +11 -0
- package/dist/runtime.js.map +1 -1
- package/dist/scheduler.d.ts +10 -2
- package/dist/scheduler.d.ts.map +1 -1
- package/dist/scheduler.js +26 -7
- package/dist/scheduler.js.map +1 -1
- package/dist/source.d.ts +1 -1
- package/dist/source.js +1 -1
- package/dist/text.d.ts +6 -1
- package/dist/text.d.ts.map +1 -1
- package/dist/text.js +6 -1
- package/dist/text.js.map +1 -1
- package/dist/types.d.ts +22 -2
- package/dist/types.d.ts.map +1 -1
- package/package.json +24 -3
package/dist/document.js
CHANGED
|
@@ -1,87 +1,10 @@
|
|
|
1
|
-
import { PdfDocument as NativeDocument, } from '@build-qube/papyra-native';
|
|
2
|
-
import { toAttachment } from './attachments.js';
|
|
3
|
-
import { RenderCache } from './cache.js';
|
|
4
1
|
import { PageImage, svgPage } from './encode.js';
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
10
|
-
import { DEFAULT_PRIORITY, Scheduler } from './scheduler.js';
|
|
11
|
-
import { searchPageText } from './search.js';
|
|
12
|
-
import { toBytes } from './source.js';
|
|
13
|
-
import { buildStructTree } from './structure.js';
|
|
14
|
-
import { pageTextBytes, toPageText } from './text.js';
|
|
2
|
+
import { adopt, annotationKey, attachSignal, range, resolveDpi, stateOf, textKey, } from './engine.js';
|
|
3
|
+
import { defaultPdfEngine, } from './papyra-engine.js';
|
|
4
|
+
import { currentRuntime } from './runtime.js';
|
|
5
|
+
import { DEFAULT_PRIORITY } from './scheduler.js';
|
|
6
|
+
import { toPageText } from './text.js';
|
|
15
7
|
const DEFAULT_DPI = 72;
|
|
16
|
-
/**
|
|
17
|
-
* Refuse renders large enough to take down the tab.
|
|
18
|
-
*
|
|
19
|
-
* 100 MP is ~400 MB of RGBA — beyond this you almost certainly meant `fitWidth`.
|
|
20
|
-
*/
|
|
21
|
-
const MAX_PIXELS = 100_000_000;
|
|
22
|
-
/** Default bytes of rendered pages to keep. Roughly eleven 2000px ARCH-E sheets. */
|
|
23
|
-
const DEFAULT_CACHE_BYTES = 128 * 1024 * 1024;
|
|
24
|
-
/**
|
|
25
|
-
* Default bytes of extracted text to keep.
|
|
26
|
-
*
|
|
27
|
-
* Text is three orders of magnitude smaller than the pixels of the same page — a
|
|
28
|
-
* dense page of a paper is ~80 KB against ~11 MB — so this holds hundreds of pages
|
|
29
|
-
* and a repeated search never re-extracts.
|
|
30
|
-
*/
|
|
31
|
-
const DEFAULT_TEXT_CACHE_BYTES = 32 * 1024 * 1024;
|
|
32
|
-
/**
|
|
33
|
-
* Bytes of page links to keep.
|
|
34
|
-
*
|
|
35
|
-
* Not an option, unlike the render and text budgets: links are two orders of
|
|
36
|
-
* magnitude smaller again — a page of a linked table of contents is a few hundred
|
|
37
|
-
* bytes — so 4 MB holds tens of thousands of them and there is nothing to tune.
|
|
38
|
-
*/
|
|
39
|
-
const LINK_CACHE_BYTES = 4 * 1024 * 1024;
|
|
40
|
-
/** Rough bytes per cached link: two objects, a rect, and a short string. */
|
|
41
|
-
const LINK_BYTES = 96;
|
|
42
|
-
/**
|
|
43
|
-
* Where text extraction sits in the queue by default.
|
|
44
|
-
*
|
|
45
|
-
* Behind rendering: a search that stalls the page the user is looking at is worse
|
|
46
|
-
* than one that takes another beat to fill in.
|
|
47
|
-
*/
|
|
48
|
-
const DEFAULT_TEXT_PRIORITY = 3;
|
|
49
|
-
/**
|
|
50
|
-
* Cache- and coalescing-key suffix for the annotation switch.
|
|
51
|
-
*
|
|
52
|
-
* Empty in the default case, so the ordinary key keeps the shape it has always had.
|
|
53
|
-
* The suffix has to exist at all because the scheduler coalesces on this string and
|
|
54
|
-
* the cache is looked up by it: without it, asking for a page with annotations off
|
|
55
|
-
* would be served the bitmap that still has them drawn on.
|
|
56
|
-
*/
|
|
57
|
-
function annotationKey(options) {
|
|
58
|
-
return options.annotations === false ? ':noannots' : '';
|
|
59
|
-
}
|
|
60
|
-
/** napi omits absent strings rather than nulling them; normalise to one shape. */
|
|
61
|
-
function toMetadata(info) {
|
|
62
|
-
return {
|
|
63
|
-
title: info.title ?? null,
|
|
64
|
-
author: info.author ?? null,
|
|
65
|
-
subject: info.subject ?? null,
|
|
66
|
-
keywords: info.keywords ?? null,
|
|
67
|
-
creator: info.creator ?? null,
|
|
68
|
-
producer: info.producer ?? null,
|
|
69
|
-
created: info.created ?? null,
|
|
70
|
-
modified: info.modified ?? null,
|
|
71
|
-
};
|
|
72
|
-
}
|
|
73
|
-
/** Wire an `AbortSignal` to a queued job. Cancelling only drops work not yet started. */
|
|
74
|
-
function attachSignal(handle, signal) {
|
|
75
|
-
if (!signal)
|
|
76
|
-
return;
|
|
77
|
-
if (signal.aborted) {
|
|
78
|
-
handle.cancel('signal aborted');
|
|
79
|
-
return;
|
|
80
|
-
}
|
|
81
|
-
signal.addEventListener('abort', () => handle.cancel('signal aborted'), {
|
|
82
|
-
once: true,
|
|
83
|
-
});
|
|
84
|
-
}
|
|
85
8
|
/**
|
|
86
9
|
* Open a PDF from bytes, an `ArrayBuffer`, a `Blob`, or a `File`.
|
|
87
10
|
*
|
|
@@ -91,17 +14,7 @@ function attachSignal(handle, signal) {
|
|
|
91
14
|
* one dialog for both can catch the base.
|
|
92
15
|
*/
|
|
93
16
|
export async function open(source, options = {}) {
|
|
94
|
-
|
|
95
|
-
const bytes = await toBytes(source);
|
|
96
|
-
try {
|
|
97
|
-
const inner = options.password === undefined
|
|
98
|
-
? NativeDocument.load(bytes)
|
|
99
|
-
: NativeDocument.loadWithPassword(bytes, options.password);
|
|
100
|
-
return new Document(inner, fingerprint(bytes), options);
|
|
101
|
-
}
|
|
102
|
-
catch (e) {
|
|
103
|
-
rethrowLoadError(e);
|
|
104
|
-
}
|
|
17
|
+
return defaultPdfEngine.open(source, options);
|
|
105
18
|
}
|
|
106
19
|
/**
|
|
107
20
|
* An open PDF, and the queue and caches that serve it.
|
|
@@ -109,28 +22,13 @@ export async function open(source, options = {}) {
|
|
|
109
22
|
* Every page-level call goes through one shared scheduler, so a thumbnail sweep can
|
|
110
23
|
* never starve the page on screen — attach a {@link RenderOptions.priority} and the
|
|
111
24
|
* queue reorders around it. Construct via {@link open}, not `new`.
|
|
25
|
+
*
|
|
26
|
+
* A {@link PdfDoc} in its own right: a viewer written against engines can be handed
|
|
27
|
+
* one of these and will reach it through papyra's engine.
|
|
112
28
|
*/
|
|
113
29
|
export class Document {
|
|
114
|
-
#
|
|
115
|
-
|
|
116
|
-
// are the point of this library, and a bulk export must not starve the visible page.
|
|
117
|
-
#scheduler;
|
|
118
|
-
#limit;
|
|
119
|
-
#cache;
|
|
120
|
-
#text;
|
|
121
|
-
#links;
|
|
122
|
-
/** In-flight link reads, so two callers on one page share a single task. */
|
|
123
|
-
#linksPending = new Map();
|
|
124
|
-
/** Memoised by {@link outline}; the outline cannot change under us. */
|
|
125
|
-
#outline;
|
|
126
|
-
/** Memoised by {@link attachments}. */
|
|
127
|
-
#attachments;
|
|
128
|
-
/** Memoised by {@link structTree}. */
|
|
129
|
-
#structure;
|
|
130
|
-
/** Memoised by {@link pageLabels}. */
|
|
131
|
-
#labels;
|
|
132
|
-
/** Memoised by {@link metadata}. */
|
|
133
|
-
#metadata;
|
|
30
|
+
#doc;
|
|
31
|
+
#engine;
|
|
134
32
|
/** Memoised by {@link indexText}. */
|
|
135
33
|
#indexed;
|
|
136
34
|
/**
|
|
@@ -146,36 +44,58 @@ export class Document {
|
|
|
146
44
|
*/
|
|
147
45
|
fingerprint;
|
|
148
46
|
/** @internal — construct via {@link open}. */
|
|
149
|
-
constructor(
|
|
150
|
-
this.#
|
|
151
|
-
this
|
|
152
|
-
this
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
47
|
+
constructor(doc, engine) {
|
|
48
|
+
this.#doc = doc;
|
|
49
|
+
this.#engine = engine;
|
|
50
|
+
this.fingerprint = doc.fingerprint;
|
|
51
|
+
adopt(this, doc);
|
|
52
|
+
}
|
|
53
|
+
/**
|
|
54
|
+
* Looked up on every use, never held: `stateOf` is what throws once the document
|
|
55
|
+
* is closed, including between the awaits of a call that was already running.
|
|
56
|
+
*/
|
|
57
|
+
get #state() {
|
|
58
|
+
return stateOf(this.#engine, this.#doc);
|
|
59
|
+
}
|
|
60
|
+
/** The engine that opened this document: always papyra's own. */
|
|
61
|
+
get engine() {
|
|
62
|
+
return this.#doc.engine;
|
|
63
|
+
}
|
|
64
|
+
/** Everything: papyra's engine implements every optional capability. */
|
|
65
|
+
get capabilities() {
|
|
66
|
+
return this.#doc.capabilities;
|
|
159
67
|
}
|
|
160
68
|
/** Rendered pages held for reuse, and how often that has paid off. */
|
|
161
69
|
get cache() {
|
|
162
|
-
return this.#cache.stats;
|
|
70
|
+
return this.#state.cache.stats;
|
|
163
71
|
}
|
|
164
72
|
/** Drop every cached page. */
|
|
165
73
|
clearCache() {
|
|
166
|
-
this.#cache.clear();
|
|
74
|
+
this.#state.cache.clear();
|
|
75
|
+
}
|
|
76
|
+
/**
|
|
77
|
+
* Release this document: its caches, and its queue's claim on the engine. Every
|
|
78
|
+
* method and getter that reaches the queue or a cache throws afterwards, the stats
|
|
79
|
+
* and a second `close` included; what the handle was opened with — `pageCount`,
|
|
80
|
+
* `fingerprint`, `engine`, `capabilities` — stays readable. Work already running
|
|
81
|
+
* finishes, but nothing it produces is cached. Optional — an unreachable document
|
|
82
|
+
* is collected — but it frees the caches at once rather than whenever the
|
|
83
|
+
* collector gets to them.
|
|
84
|
+
*/
|
|
85
|
+
close() {
|
|
86
|
+
return this.#engine.close(this.#doc);
|
|
167
87
|
}
|
|
168
88
|
/** Pages queued but not yet started, pages rendering, and the longest wait so far. */
|
|
169
89
|
get queued() {
|
|
170
90
|
return {
|
|
171
|
-
pending: this.#scheduler.pendingCount,
|
|
172
|
-
running: this.#scheduler.runningCount,
|
|
173
|
-
oldestWaitMs: this.#scheduler.oldestWaitMs,
|
|
91
|
+
pending: this.#state.scheduler.pendingCount,
|
|
92
|
+
running: this.#state.scheduler.runningCount,
|
|
93
|
+
oldestWaitMs: this.#state.scheduler.oldestWaitMs,
|
|
174
94
|
};
|
|
175
95
|
}
|
|
176
96
|
/** How many pages the document has. Page indices are 0-based throughout. */
|
|
177
97
|
get pageCount() {
|
|
178
|
-
return this.#
|
|
98
|
+
return this.#doc.pageCount;
|
|
179
99
|
}
|
|
180
100
|
/**
|
|
181
101
|
* The PDF specification version the file declares, e.g. `'1.7'`.
|
|
@@ -189,7 +109,7 @@ export class Document {
|
|
|
189
109
|
* extinct, and it is also what a file with an unreadable header reports.
|
|
190
110
|
*/
|
|
191
111
|
get pdfVersion() {
|
|
192
|
-
return this.#
|
|
112
|
+
return this.#doc.pdfVersion;
|
|
193
113
|
}
|
|
194
114
|
/**
|
|
195
115
|
* The document outline — bookmarks, the table of contents — as a tree.
|
|
@@ -210,15 +130,7 @@ export class Document {
|
|
|
210
130
|
* ```
|
|
211
131
|
*/
|
|
212
132
|
async outline() {
|
|
213
|
-
this.#outline
|
|
214
|
-
.outline()
|
|
215
|
-
.then(buildOutlineTree)
|
|
216
|
-
// A failed walk must not be cached as a permanent empty outline.
|
|
217
|
-
.catch((e) => {
|
|
218
|
-
this.#outline = undefined;
|
|
219
|
-
throw e;
|
|
220
|
-
});
|
|
221
|
-
return this.#outline;
|
|
133
|
+
return this.#engine.outline(this.#doc);
|
|
222
134
|
}
|
|
223
135
|
/**
|
|
224
136
|
* What the document says about itself: title, author, dates, the tool that wrote it.
|
|
@@ -228,8 +140,7 @@ export class Document {
|
|
|
228
140
|
* verified; `title` in particular is often a filename or missing entirely.
|
|
229
141
|
*/
|
|
230
142
|
get metadata() {
|
|
231
|
-
|
|
232
|
-
return this.#metadata;
|
|
143
|
+
return this.#doc.metadata;
|
|
233
144
|
}
|
|
234
145
|
/**
|
|
235
146
|
* The label printed on each page, one entry per page.
|
|
@@ -252,12 +163,7 @@ export class Document {
|
|
|
252
163
|
* ```
|
|
253
164
|
*/
|
|
254
165
|
async pageLabels() {
|
|
255
|
-
|
|
256
|
-
// A failed walk must not be cached as a permanent absence of labels.
|
|
257
|
-
this.#labels = undefined;
|
|
258
|
-
throw e;
|
|
259
|
-
});
|
|
260
|
-
return this.#labels;
|
|
166
|
+
return this.#engine.pageLabels(this.#doc);
|
|
261
167
|
}
|
|
262
168
|
/**
|
|
263
169
|
* The document structure tree, if the document is tagged.
|
|
@@ -286,15 +192,7 @@ export class Document {
|
|
|
286
192
|
* ```
|
|
287
193
|
*/
|
|
288
194
|
async structTree() {
|
|
289
|
-
this.#
|
|
290
|
-
.structTree()
|
|
291
|
-
.then(buildStructTree)
|
|
292
|
-
// A failed walk must not be cached as a permanent absence of structure.
|
|
293
|
-
.catch((e) => {
|
|
294
|
-
this.#structure = undefined;
|
|
295
|
-
throw e;
|
|
296
|
-
});
|
|
297
|
-
return this.#structure;
|
|
195
|
+
return this.#engine.structTree(this.#doc);
|
|
298
196
|
}
|
|
299
197
|
/**
|
|
300
198
|
* The files embedded in the document, in the order it files them.
|
|
@@ -319,15 +217,7 @@ export class Document {
|
|
|
319
217
|
* ```
|
|
320
218
|
*/
|
|
321
219
|
async attachments() {
|
|
322
|
-
this.#attachments
|
|
323
|
-
.attachments()
|
|
324
|
-
.then((files) => files.map(toAttachment))
|
|
325
|
-
// A failed walk must not be cached as a permanent absence of attachments.
|
|
326
|
-
.catch((e) => {
|
|
327
|
-
this.#attachments = undefined;
|
|
328
|
-
throw e;
|
|
329
|
-
});
|
|
330
|
-
return this.#attachments;
|
|
220
|
+
return this.#engine.attachments(this.#doc);
|
|
331
221
|
}
|
|
332
222
|
/**
|
|
333
223
|
* Decompress one embedded file, by its {@link Attachment.index}.
|
|
@@ -338,7 +228,7 @@ export class Document {
|
|
|
338
228
|
* cannot be decoded.
|
|
339
229
|
*/
|
|
340
230
|
async attachmentData(index) {
|
|
341
|
-
return this.#
|
|
231
|
+
return this.#engine.attachmentData(this.#doc, index);
|
|
342
232
|
}
|
|
343
233
|
/**
|
|
344
234
|
* The links on one page — where they are, and where they go.
|
|
@@ -363,34 +253,11 @@ export class Document {
|
|
|
363
253
|
* ```
|
|
364
254
|
*/
|
|
365
255
|
async links(index) {
|
|
366
|
-
|
|
367
|
-
const hit = this.#links.get(key);
|
|
368
|
-
if (hit)
|
|
369
|
-
return hit;
|
|
370
|
-
const pending = this.#linksPending.get(index);
|
|
371
|
-
if (pending)
|
|
372
|
-
return pending;
|
|
373
|
-
const read = this.#inner
|
|
374
|
-
.pageLinks(index)
|
|
375
|
-
.then((native) => {
|
|
376
|
-
// `toPageLink` only returns null for a link with no resolvable target, which
|
|
377
|
-
// the bindings do not emit — the filter is here so a future one cannot leak
|
|
378
|
-
// a null into the array.
|
|
379
|
-
const links = native
|
|
380
|
-
.map(toPageLink)
|
|
381
|
-
.filter((link) => link !== null);
|
|
382
|
-
this.#links.set(key, links);
|
|
383
|
-
return links;
|
|
384
|
-
})
|
|
385
|
-
.finally(() => {
|
|
386
|
-
this.#linksPending.delete(index);
|
|
387
|
-
});
|
|
388
|
-
this.#linksPending.set(index, read);
|
|
389
|
-
return read;
|
|
256
|
+
return this.#engine.links(this.#doc, index);
|
|
390
257
|
}
|
|
391
258
|
/** Page dimensions in PDF points (1/72 inch). */
|
|
392
259
|
pageSize(index) {
|
|
393
|
-
return this.#
|
|
260
|
+
return this.#state.backend.pageSize(index);
|
|
394
261
|
}
|
|
395
262
|
/** Render a single page. Never blocks the event loop. */
|
|
396
263
|
async renderPage(index, options = {}) {
|
|
@@ -428,13 +295,13 @@ export class Document {
|
|
|
428
295
|
* render time, which end-to-end timing around the promise cannot.
|
|
429
296
|
*/
|
|
430
297
|
imageHandle(index, options = {}) {
|
|
431
|
-
const dpi = this.#
|
|
298
|
+
const dpi = resolveDpi(this.#state.backend, index, options);
|
|
432
299
|
// A distinct key space from `render`, so an image request never coalesces onto a
|
|
433
300
|
// pending raw render (different return type) or vice versa.
|
|
434
|
-
const handle = this.#scheduler.submit({
|
|
301
|
+
const handle = this.#state.scheduler.submit({
|
|
435
302
|
key: `image:${index}@${dpi.toFixed(4)}${annotationKey(options)}`,
|
|
436
303
|
priority: options.priority ?? DEFAULT_PRIORITY,
|
|
437
|
-
run: () => this.#
|
|
304
|
+
run: () => this.#state.backend.native.renderPageImageAsync(index, dpi, options.annotations, options.signal).then((img) => new PageImage(img)),
|
|
438
305
|
});
|
|
439
306
|
attachSignal(handle, options.signal);
|
|
440
307
|
return handle;
|
|
@@ -470,12 +337,12 @@ export class Document {
|
|
|
470
337
|
throw new RangeError(`papyra: page ${index} is out of range (0..${this.pageCount - 1})`);
|
|
471
338
|
}
|
|
472
339
|
const opaque = options.background !== 'transparent';
|
|
473
|
-
const handle = this.#scheduler.submit({
|
|
340
|
+
const handle = this.#state.scheduler.submit({
|
|
474
341
|
// The background is part of the key: the scheduler coalesces same-key requests,
|
|
475
342
|
// and an opaque and a transparent conversion of one page are different output.
|
|
476
343
|
key: `svg:${index}${opaque ? '' : ':transparent'}${annotationKey(options)}`,
|
|
477
344
|
priority: options.priority ?? DEFAULT_PRIORITY,
|
|
478
|
-
run: () => this.#
|
|
345
|
+
run: () => this.#state.backend.native.renderPageSvgAsync(index, opaque, options.annotations, options.signal).then(svgPage),
|
|
479
346
|
});
|
|
480
347
|
attachSignal(handle, options.signal);
|
|
481
348
|
return handle;
|
|
@@ -497,42 +364,8 @@ export class Document {
|
|
|
497
364
|
* ```
|
|
498
365
|
*/
|
|
499
366
|
render(index, options = {}) {
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
const hit = this.#cache.get(key);
|
|
503
|
-
if (hit)
|
|
504
|
-
return cachedHandle(key, hit);
|
|
505
|
-
const handle = this.#scheduler.submit({
|
|
506
|
-
key,
|
|
507
|
-
priority: options.priority ?? DEFAULT_PRIORITY,
|
|
508
|
-
run: () => this.#inner.renderPageAsync(index, dpi, options.annotations).then((page) => {
|
|
509
|
-
this.#cache.set(key, page);
|
|
510
|
-
return page;
|
|
511
|
-
}),
|
|
512
|
-
});
|
|
513
|
-
attachSignal(handle, options.signal);
|
|
514
|
-
return liveHandle(handle);
|
|
515
|
-
}
|
|
516
|
-
/**
|
|
517
|
-
* Turn `fitWidth`/`dpi` into a concrete DPI, and refuse absurd outputs.
|
|
518
|
-
*
|
|
519
|
-
* `fitWidth` exists because page sizes vary by two orders of magnitude in area: a
|
|
520
|
-
* DPI that is sensible for US Letter produces a 113 MB bitmap for an ARCH-E drawing.
|
|
521
|
-
*/
|
|
522
|
-
#resolveDpi(index, options) {
|
|
523
|
-
const { width, height } = this.pageSize(index);
|
|
524
|
-
const dpi = options.fitWidth !== undefined && width > 0
|
|
525
|
-
? (options.fitWidth / width) * 72
|
|
526
|
-
: (options.dpi ?? DEFAULT_DPI);
|
|
527
|
-
const pixels = ((width * dpi) / 72) * ((height * dpi) / 72);
|
|
528
|
-
if (pixels > MAX_PIXELS) {
|
|
529
|
-
const mb = Math.round((pixels * 4) / 1e6);
|
|
530
|
-
throw new RangeError(`papyra: page ${index} at ${dpi.toFixed(1)} DPI would be ` +
|
|
531
|
-
`${Math.round((width * dpi) / 72)}x${Math.round((height * dpi) / 72)} ` +
|
|
532
|
-
`(${mb} MB). The page is ${(width / 72).toFixed(1)}x${(height / 72).toFixed(1)}in — ` +
|
|
533
|
-
'use { fitWidth } to size by output pixels instead of DPI.');
|
|
534
|
-
}
|
|
535
|
-
return dpi;
|
|
367
|
+
// papyra's backend only ever produces RGBA, so the wider engine type narrows.
|
|
368
|
+
return this.#engine.render(this.#doc, index, options);
|
|
536
369
|
}
|
|
537
370
|
/**
|
|
538
371
|
* Render `[start, end)`.
|
|
@@ -552,8 +385,8 @@ export class Document {
|
|
|
552
385
|
// a document can mix a letter-size cover sheet with ARCH-E drawings.
|
|
553
386
|
let dpi = DEFAULT_DPI;
|
|
554
387
|
for (let i = start; i < end; i++)
|
|
555
|
-
dpi = this.#
|
|
556
|
-
return (await this.#
|
|
388
|
+
dpi = resolveDpi(this.#state.backend, i, options);
|
|
389
|
+
return (await this.#state.backend.native.renderPagesAsync(start, end, dpi, options.annotations));
|
|
557
390
|
}
|
|
558
391
|
const out = [];
|
|
559
392
|
for await (const { page, bitmap } of this.stream({
|
|
@@ -579,43 +412,9 @@ export class Document {
|
|
|
579
412
|
* }
|
|
580
413
|
* ```
|
|
581
414
|
*/
|
|
582
|
-
|
|
583
|
-
|
|
584
|
-
|
|
585
|
-
const inflight = new Map();
|
|
586
|
-
const handles = new Map();
|
|
587
|
-
let next = 0;
|
|
588
|
-
const schedule = (slot) => {
|
|
589
|
-
const page = pages[slot];
|
|
590
|
-
if (page === undefined)
|
|
591
|
-
return;
|
|
592
|
-
const handle = this.render(page, options);
|
|
593
|
-
handles.set(slot, handle);
|
|
594
|
-
inflight.set(slot, handle.promise.then((bitmap) => ({ slot, page, bitmap })));
|
|
595
|
-
};
|
|
596
|
-
try {
|
|
597
|
-
while (next < pages.length && inflight.size < window)
|
|
598
|
-
schedule(next++);
|
|
599
|
-
while (inflight.size > 0) {
|
|
600
|
-
const { slot, page, bitmap } = await Promise.race(inflight.values());
|
|
601
|
-
inflight.delete(slot);
|
|
602
|
-
handles.delete(slot);
|
|
603
|
-
if (next < pages.length)
|
|
604
|
-
schedule(next++);
|
|
605
|
-
yield { page, bitmap };
|
|
606
|
-
}
|
|
607
|
-
}
|
|
608
|
-
finally {
|
|
609
|
-
// Breaking out of the loop drops everything still queued, so "thumbnails for
|
|
610
|
-
// the rows I can see" does not keep rendering the rows I cannot.
|
|
611
|
-
for (const [slot, handle] of handles) {
|
|
612
|
-
handle.cancel('stream ended');
|
|
613
|
-
// The derived promise rejects once cancelled; nobody is listening any more.
|
|
614
|
-
inflight.get(slot)?.catch(() => { });
|
|
615
|
-
}
|
|
616
|
-
inflight.clear();
|
|
617
|
-
handles.clear();
|
|
618
|
-
}
|
|
415
|
+
stream(options = {}) {
|
|
416
|
+
// As for `render`: the bitmaps are RGBA.
|
|
417
|
+
return this.#engine.stream(this.#doc, options);
|
|
619
418
|
}
|
|
620
419
|
/**
|
|
621
420
|
* Extract the text of one page.
|
|
@@ -629,32 +428,7 @@ export class Document {
|
|
|
629
428
|
* paper. It is cheap enough to do speculatively.
|
|
630
429
|
*/
|
|
631
430
|
async pageText(index, options = {}) {
|
|
632
|
-
|
|
633
|
-
const hit = this.#text.get(key);
|
|
634
|
-
if (hit)
|
|
635
|
-
return hit;
|
|
636
|
-
// One queue for renders and text both, so priority means something across them.
|
|
637
|
-
// Coalescing by key is what stops a search and a text selection extracting the
|
|
638
|
-
// same page twice.
|
|
639
|
-
const handle = this.#scheduler.submit({
|
|
640
|
-
key,
|
|
641
|
-
priority: options.priority ?? DEFAULT_TEXT_PRIORITY,
|
|
642
|
-
run: async () => {
|
|
643
|
-
const text = toPageText(index, await this.#inner.pageTextAsync(index));
|
|
644
|
-
this.#text.set(key, text);
|
|
645
|
-
return text;
|
|
646
|
-
},
|
|
647
|
-
});
|
|
648
|
-
const { signal } = options;
|
|
649
|
-
if (signal) {
|
|
650
|
-
if (signal.aborted)
|
|
651
|
-
handle.cancel('signal aborted');
|
|
652
|
-
else
|
|
653
|
-
signal.addEventListener('abort', () => handle.cancel('signal aborted'), {
|
|
654
|
-
once: true,
|
|
655
|
-
});
|
|
656
|
-
}
|
|
657
|
-
return handle.promise;
|
|
431
|
+
return this.#engine.pageText(this.#doc, index, options);
|
|
658
432
|
}
|
|
659
433
|
/**
|
|
660
434
|
* Extract every page's text up front, so a later search is immediate.
|
|
@@ -672,6 +446,8 @@ export class Document {
|
|
|
672
446
|
* goes. This only trades a pause now for instant results later.
|
|
673
447
|
*/
|
|
674
448
|
async indexText(options = {}) {
|
|
449
|
+
// The memo would otherwise answer a closed document without reaching the guard.
|
|
450
|
+
void this.#state;
|
|
675
451
|
this.#indexed ??= this.#index(options).catch((e) => {
|
|
676
452
|
// A failed pass must not be remembered as a completed one.
|
|
677
453
|
this.#indexed = undefined;
|
|
@@ -681,9 +457,9 @@ export class Document {
|
|
|
681
457
|
}
|
|
682
458
|
async #index(options) {
|
|
683
459
|
if (currentRuntime() === 'native') {
|
|
684
|
-
const all = await this.#
|
|
460
|
+
const all = await this.#state.backend.native.pageTextsAsync(0, this.pageCount);
|
|
685
461
|
for (const [i, native] of all.entries()) {
|
|
686
|
-
this.#text.set(
|
|
462
|
+
this.#state.text.set(textKey(i), toPageText(i, native));
|
|
687
463
|
}
|
|
688
464
|
return;
|
|
689
465
|
}
|
|
@@ -709,73 +485,16 @@ export class Document {
|
|
|
709
485
|
* }
|
|
710
486
|
* ```
|
|
711
487
|
*/
|
|
712
|
-
|
|
713
|
-
|
|
714
|
-
return;
|
|
715
|
-
const pages = options.order ?? range(0, this.pageCount);
|
|
716
|
-
const limit = options.limit ?? Number.POSITIVE_INFINITY;
|
|
717
|
-
let found = 0;
|
|
718
|
-
for (const page of pages) {
|
|
719
|
-
if (options.signal?.aborted)
|
|
720
|
-
return;
|
|
721
|
-
const text = await this.pageText(page, {
|
|
722
|
-
priority: options.priority ?? DEFAULT_TEXT_PRIORITY,
|
|
723
|
-
signal: options.signal,
|
|
724
|
-
});
|
|
725
|
-
for (const match of searchPageText(text, query, options)) {
|
|
726
|
-
yield match;
|
|
727
|
-
if (++found >= limit)
|
|
728
|
-
return;
|
|
729
|
-
}
|
|
730
|
-
}
|
|
488
|
+
search(query, options = {}) {
|
|
489
|
+
return this.#engine.search(this.#doc, query, options);
|
|
731
490
|
}
|
|
732
491
|
/** Extracted page text held for reuse, and how often that has paid off. */
|
|
733
492
|
get textCache() {
|
|
734
|
-
return this.#text.stats;
|
|
493
|
+
return this.#state.text.stats;
|
|
735
494
|
}
|
|
736
495
|
/** How many pages this document will render at once. */
|
|
737
496
|
get concurrency() {
|
|
738
|
-
return this.#limit;
|
|
497
|
+
return this.#state.limit;
|
|
739
498
|
}
|
|
740
499
|
}
|
|
741
|
-
function defaultConcurrency() {
|
|
742
|
-
return currentRuntime() === 'wasm'
|
|
743
|
-
? MAX_WASM_CONCURRENCY
|
|
744
|
-
: hardwareConcurrency();
|
|
745
|
-
}
|
|
746
|
-
/**
|
|
747
|
-
* Wrap a scheduler handle as a {@link RenderHandle}.
|
|
748
|
-
*
|
|
749
|
-
* Delegates rather than spreading: `timing` is a getter that is null until the job
|
|
750
|
-
* settles, and a spread would freeze it at null forever.
|
|
751
|
-
*/
|
|
752
|
-
function liveHandle(handle) {
|
|
753
|
-
return {
|
|
754
|
-
key: handle.key,
|
|
755
|
-
cached: false,
|
|
756
|
-
promise: handle.promise,
|
|
757
|
-
get timing() {
|
|
758
|
-
return handle.timing;
|
|
759
|
-
},
|
|
760
|
-
setPriority: (priority) => handle.setPriority(priority),
|
|
761
|
-
cancel: (reason) => handle.cancel(reason),
|
|
762
|
-
};
|
|
763
|
-
}
|
|
764
|
-
/** A handle for work that never had to happen. */
|
|
765
|
-
function cachedHandle(key, page) {
|
|
766
|
-
return {
|
|
767
|
-
key,
|
|
768
|
-
cached: true,
|
|
769
|
-
promise: Promise.resolve(page),
|
|
770
|
-
timing: { waitMs: 0, runMs: 0 },
|
|
771
|
-
setPriority: () => { },
|
|
772
|
-
cancel: () => { },
|
|
773
|
-
};
|
|
774
|
-
}
|
|
775
|
-
function range(start, end) {
|
|
776
|
-
const out = [];
|
|
777
|
-
for (let i = start; i < end; i++)
|
|
778
|
-
out.push(i);
|
|
779
|
-
return out;
|
|
780
|
-
}
|
|
781
500
|
//# sourceMappingURL=document.js.map
|
package/dist/document.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"document.js","sourceRoot":"","sources":["../src/document.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,WAAW,IAAI,cAAc,GAG9B,MAAM,2BAA2B,CAAC;AACnC,OAAO,EAAmB,YAAY,EAAE,MAAM,kBAAkB,CAAC;AACjE,OAAO,EAAmB,WAAW,EAAE,MAAM,YAAY,CAAC;AAC1D,OAAO,EAAE,SAAS,EAAgB,OAAO,EAAE,MAAM,aAAa,CAAC;AAC/D,OAAO,EAAE,gBAAgB,EAAE,MAAM,aAAa,CA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