@f-office/core 0.2.1 → 0.2.2
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/dist/browser.d.ts +1 -1
- package/dist/browser.js +1 -1
- package/dist/core.d.ts +2 -1
- package/dist/core.js +2 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +1 -1
- package/dist/node.d.ts +1 -1
- package/dist/node.js +1 -1
- package/dist/wasm/f_office_wasm.d.ts +421 -0
- package/dist/wasm/f_office_wasm.js +959 -0
- package/dist/wasm/f_office_wasm_bg.wasm +0 -0
- package/dist/wasm/f_office_wasm_bg.wasm.d.ts +47 -0
- package/package.json +5 -1
package/dist/browser.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { WasmInitSource } from "./types.js";
|
|
2
|
-
export { createBlobSource, createMemorySource, createOpfsSource, Document, loadFontsFor, PageImage, Renderer, wasmMemoryBytes, type ByteSource, type FontFetcher, type FontNeed, type LimitProfile, type OpenOptions, type OpfsSyncAccessHandle, type OutlineEntry, type PageRect, type PageSizePoints, type PdfChunkCallback, type PixelRegion, type RenderedPageData, type SearchMatch, type SearchOptions, type SearchRange, type TargetId, type TextRun, type WasmInitSource, } from "./core.js";
|
|
2
|
+
export { createBlobSource, createMemorySource, createOpfsSource, Document, Drawing, loadFontsFor, PageImage, Renderer, Session, wasmMemoryBytes, type ByteSource, type FontFetcher, type FontNeed, type LimitProfile, type OpenOptions, type OpfsSyncAccessHandle, type OutlineEntry, type PageRect, type PageSizePoints, type PdfChunkCallback, type PixelRegion, type RenderedPageData, type SearchMatch, type SearchOptions, type SearchRange, type TargetId, type TextRun, type WasmInitSource, } from "./core.js";
|
|
3
3
|
/**
|
|
4
4
|
* Initializes the F-Office WebAssembly module in browsers and Web Workers. Safe to call multiple
|
|
5
5
|
* times; subsequent calls resolve immediately once initialized.
|
package/dist/browser.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import wasmInit from "./wasm/f_office_wasm.js";
|
|
2
2
|
import { initWithDefaultLoader } from "./core.js";
|
|
3
|
-
export { createBlobSource, createMemorySource, createOpfsSource, Document, loadFontsFor, PageImage, Renderer, wasmMemoryBytes, } from "./core.js";
|
|
3
|
+
export { createBlobSource, createMemorySource, createOpfsSource, Document, Drawing, loadFontsFor, PageImage, Renderer, Session, wasmMemoryBytes, } from "./core.js";
|
|
4
4
|
/**
|
|
5
5
|
* Initializes the F-Office WebAssembly module in browsers and Web Workers. Safe to call multiple
|
|
6
6
|
* times; subsequent calls resolve immediately once initialized.
|
package/dist/core.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import { Document as RawDocument, PageImage as RawPageImage } from "./wasm/f_office_wasm.js";
|
|
1
|
+
import { Document as RawDocument, Drawing, PageImage as RawPageImage, Session } from "./wasm/f_office_wasm.js";
|
|
2
|
+
export { Drawing, Session };
|
|
2
3
|
import type { ByteSource, FontFetcher, FontNeed, OpenOptions, OutlineEntry, PageSizePoints, PdfChunkCallback, PixelRegion, SearchMatch, SearchOptions, TargetId, TextRun, WasmInitSource } from "./types.js";
|
|
3
4
|
export type { ByteSource, FontFetcher, FontNeed, LimitProfile, OpenOptions, OutlineEntry, PageRect, PageSizePoints, PdfChunkCallback, PixelRegion, RenderedPageData, SearchMatch, SearchOptions, SearchRange, TargetId, TextRun, WasmInitSource, } from "./types.js";
|
|
4
5
|
export { createBlobSource, createMemorySource, createOpfsSource, type OpfsSyncAccessHandle, } from "./source.js";
|
package/dist/core.js
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import wasmInit, { Renderer as RawRenderer, } from "./wasm/f_office_wasm.js";
|
|
1
|
+
import wasmInit, { Drawing, Renderer as RawRenderer, Session, } from "./wasm/f_office_wasm.js";
|
|
2
|
+
export { Drawing, Session };
|
|
2
3
|
export { createBlobSource, createMemorySource, createOpfsSource, } from "./source.js";
|
|
3
4
|
const DEFAULT_TARGET = "word-win";
|
|
4
5
|
let initPromise = null;
|
package/dist/index.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export { createBlobSource, createMemorySource, createOpfsSource, Document, init, loadFontsFor, PageImage, Renderer, wasmMemoryBytes, type ByteSource, type FontFetcher, type FontNeed, type LimitProfile, type OpenOptions, type OpfsSyncAccessHandle, type OutlineEntry, type PageRect, type PageSizePoints, type PdfChunkCallback, type PixelRegion, type RenderedPageData, type SearchMatch, type SearchOptions, type SearchRange, type TargetId, type TextRun, type WasmInitSource, } from "./browser.js";
|
|
1
|
+
export { createBlobSource, createMemorySource, createOpfsSource, Document, Drawing, init, loadFontsFor, PageImage, Renderer, Session, wasmMemoryBytes, type ByteSource, type FontFetcher, type FontNeed, type LimitProfile, type OpenOptions, type OpfsSyncAccessHandle, type OutlineEntry, type PageRect, type PageSizePoints, type PdfChunkCallback, type PixelRegion, type RenderedPageData, type SearchMatch, type SearchOptions, type SearchRange, type TargetId, type TextRun, type WasmInitSource, } from "./browser.js";
|
package/dist/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export { createBlobSource, createMemorySource, createOpfsSource, Document, init, loadFontsFor, PageImage, Renderer, wasmMemoryBytes, } from "./browser.js";
|
|
1
|
+
export { createBlobSource, createMemorySource, createOpfsSource, Document, Drawing, init, loadFontsFor, PageImage, Renderer, Session, wasmMemoryBytes, } from "./browser.js";
|
package/dist/node.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { WasmInitSource } from "./types.js";
|
|
2
|
-
export { createBlobSource, createMemorySource, createOpfsSource, Document, loadFontsFor, PageImage, Renderer, wasmMemoryBytes, type ByteSource, type FontFetcher, type FontNeed, type LimitProfile, type OpenOptions, type OpfsSyncAccessHandle, type OutlineEntry, type PageRect, type PageSizePoints, type PdfChunkCallback, type PixelRegion, type RenderedPageData, type SearchMatch, type SearchOptions, type SearchRange, type TargetId, type TextRun, type WasmInitSource, } from "./core.js";
|
|
2
|
+
export { createBlobSource, createMemorySource, createOpfsSource, Document, Drawing, loadFontsFor, PageImage, Renderer, Session, wasmMemoryBytes, type ByteSource, type FontFetcher, type FontNeed, type LimitProfile, type OpenOptions, type OpfsSyncAccessHandle, type OutlineEntry, type PageRect, type PageSizePoints, type PdfChunkCallback, type PixelRegion, type RenderedPageData, type SearchMatch, type SearchOptions, type SearchRange, type TargetId, type TextRun, type WasmInitSource, } from "./core.js";
|
|
3
3
|
/**
|
|
4
4
|
* Initializes the F-Office WebAssembly module in Node.js by reading the bundled `.wasm` binary
|
|
5
5
|
* directly from disk when `source` is omitted.
|
package/dist/node.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { readFile } from "node:fs/promises";
|
|
2
2
|
import { initSync } from "./wasm/f_office_wasm.js";
|
|
3
3
|
import { initWithDefaultLoader } from "./core.js";
|
|
4
|
-
export { createBlobSource, createMemorySource, createOpfsSource, Document, loadFontsFor, PageImage, Renderer, wasmMemoryBytes, } from "./core.js";
|
|
4
|
+
export { createBlobSource, createMemorySource, createOpfsSource, Document, Drawing, loadFontsFor, PageImage, Renderer, Session, wasmMemoryBytes, } from "./core.js";
|
|
5
5
|
/**
|
|
6
6
|
* Initializes the F-Office WebAssembly module in Node.js by reading the bundled `.wasm` binary
|
|
7
7
|
* directly from disk when `source` is omitted.
|
|
@@ -98,6 +98,31 @@ export class Document {
|
|
|
98
98
|
writePdf(): Uint8Array;
|
|
99
99
|
}
|
|
100
100
|
|
|
101
|
+
/**
|
|
102
|
+
* A drawn page for JavaScript: its width, height and RGBA pixels.
|
|
103
|
+
*/
|
|
104
|
+
export class Drawing {
|
|
105
|
+
private constructor();
|
|
106
|
+
free(): void;
|
|
107
|
+
[Symbol.dispose](): void;
|
|
108
|
+
/**
|
|
109
|
+
* Consumes and returns the RGBA pixels without cloning inside WebAssembly.
|
|
110
|
+
*/
|
|
111
|
+
takePixels(): Uint8Array;
|
|
112
|
+
/**
|
|
113
|
+
* The height in pixels.
|
|
114
|
+
*/
|
|
115
|
+
readonly height: number;
|
|
116
|
+
/**
|
|
117
|
+
* The pixels, four bytes each, row by row from the top, as a new array.
|
|
118
|
+
*/
|
|
119
|
+
readonly pixels: Uint8Array;
|
|
120
|
+
/**
|
|
121
|
+
* The width in pixels.
|
|
122
|
+
*/
|
|
123
|
+
readonly width: number;
|
|
124
|
+
}
|
|
125
|
+
|
|
101
126
|
/**
|
|
102
127
|
* A font that a document's text asks for and the families that the target tries for it.
|
|
103
128
|
*/
|
|
@@ -305,6 +330,355 @@ export class SearchMatch {
|
|
|
305
330
|
readonly start: number;
|
|
306
331
|
}
|
|
307
332
|
|
|
333
|
+
/**
|
|
334
|
+
* The viewer's session for JavaScript, as [`Session`] says.
|
|
335
|
+
*/
|
|
336
|
+
export class Session {
|
|
337
|
+
free(): void;
|
|
338
|
+
[Symbol.dispose](): void;
|
|
339
|
+
/**
|
|
340
|
+
* Takes the ICU4X word dictionaries from an external postcard data blob, for the open
|
|
341
|
+
* document and the ones that it opens later.
|
|
342
|
+
*
|
|
343
|
+
* # Errors
|
|
344
|
+
*
|
|
345
|
+
* Throws when the data holds no word dictionaries.
|
|
346
|
+
*/
|
|
347
|
+
addDictionaries(blob: Uint8Array | number[]): void;
|
|
348
|
+
/**
|
|
349
|
+
* Adds the faces of a font file and returns how many it holds.
|
|
350
|
+
*
|
|
351
|
+
* # Errors
|
|
352
|
+
*
|
|
353
|
+
* Throws when the data is no font.
|
|
354
|
+
*/
|
|
355
|
+
addFont(data: Uint8Array | number[]): number;
|
|
356
|
+
/**
|
|
357
|
+
* Ends a press because the window lost the focus, and returns what it did, as JSON
|
|
358
|
+
* ([`handled_json`]).
|
|
359
|
+
*
|
|
360
|
+
* # Errors
|
|
361
|
+
*
|
|
362
|
+
* Throws when no document is open.
|
|
363
|
+
*/
|
|
364
|
+
blur(): string;
|
|
365
|
+
/**
|
|
366
|
+
* Clears all caller-supplied highlights, or only those matching `kind`.
|
|
367
|
+
*
|
|
368
|
+
* # Errors
|
|
369
|
+
*
|
|
370
|
+
* Throws when no document is open.
|
|
371
|
+
*/
|
|
372
|
+
clearHighlights(kind?: string | null): void;
|
|
373
|
+
/**
|
|
374
|
+
* Clears the selection.
|
|
375
|
+
*
|
|
376
|
+
* # Errors
|
|
377
|
+
*
|
|
378
|
+
* Throws when no document is open.
|
|
379
|
+
*/
|
|
380
|
+
clearSelection(): void;
|
|
381
|
+
/**
|
|
382
|
+
* Draws a page at a resolution, and counts the drawing as the shell's.
|
|
383
|
+
*
|
|
384
|
+
* # Errors
|
|
385
|
+
*
|
|
386
|
+
* Throws when no document is open, or the page does not exist or cannot be drawn.
|
|
387
|
+
*/
|
|
388
|
+
draw(page: number, dpi: number): Drawing;
|
|
389
|
+
/**
|
|
390
|
+
* Ends a zoom gesture, so that the next frame asks for the drawings at its zoom.
|
|
391
|
+
*
|
|
392
|
+
* # Errors
|
|
393
|
+
*
|
|
394
|
+
* Throws when no document is open.
|
|
395
|
+
*/
|
|
396
|
+
endGesture(): void;
|
|
397
|
+
/**
|
|
398
|
+
* Makes the next match current when `forward` is set, and the match before it when not.
|
|
399
|
+
*
|
|
400
|
+
* # Errors
|
|
401
|
+
*
|
|
402
|
+
* Throws when no document is open.
|
|
403
|
+
*/
|
|
404
|
+
findStep(forward: boolean): void;
|
|
405
|
+
/**
|
|
406
|
+
* Searches the document for `query`, and returns the number of matches.
|
|
407
|
+
*
|
|
408
|
+
* # Errors
|
|
409
|
+
*
|
|
410
|
+
* Throws when no document is open.
|
|
411
|
+
*/
|
|
412
|
+
find(query: string): number;
|
|
413
|
+
/**
|
|
414
|
+
* The fonts that a random-access DOCX source asks for on `target`, as JSON, without copying
|
|
415
|
+
* the whole archive into WASM linear memory ([`Session::fonts_needed_source`]).
|
|
416
|
+
*
|
|
417
|
+
* # Errors
|
|
418
|
+
*
|
|
419
|
+
* Throws when `byteLength` is invalid, no target has the ID, or the source cannot be opened.
|
|
420
|
+
*/
|
|
421
|
+
static fontsNeededSource(byte_length: number, read_at: Function, target?: string | null): string;
|
|
422
|
+
/**
|
|
423
|
+
* The fonts that `docx` asks for on `target`, as JSON ([`Session::fonts_needed`]).
|
|
424
|
+
*
|
|
425
|
+
* # Errors
|
|
426
|
+
*
|
|
427
|
+
* Throws when no target has the ID or the file cannot be opened.
|
|
428
|
+
*/
|
|
429
|
+
static fontsNeeded(docx: Uint8Array | number[], target?: string | null): string;
|
|
430
|
+
/**
|
|
431
|
+
* Forgets the drawings that the worker was asked for and has not drawn.
|
|
432
|
+
*
|
|
433
|
+
* # Errors
|
|
434
|
+
*
|
|
435
|
+
* Throws when no document is open.
|
|
436
|
+
*/
|
|
437
|
+
forgetRequests(): void;
|
|
438
|
+
/**
|
|
439
|
+
* What the shell shows now, as JSON ([`frame_json`]).
|
|
440
|
+
*
|
|
441
|
+
* # Errors
|
|
442
|
+
*
|
|
443
|
+
* Throws when no document is open.
|
|
444
|
+
*/
|
|
445
|
+
frame(): string;
|
|
446
|
+
/**
|
|
447
|
+
* Zooms to `factor` during a zoom gesture, around the viewport's point at `anchor_x` and
|
|
448
|
+
* `anchor_y`: the frames ask for no drawing until [`Session::end_gesture`].
|
|
449
|
+
*
|
|
450
|
+
* # Errors
|
|
451
|
+
*
|
|
452
|
+
* Throws when no document is open.
|
|
453
|
+
*/
|
|
454
|
+
gestureZoom(factor: number, anchor_x?: number | null, anchor_y?: number | null): void;
|
|
455
|
+
/**
|
|
456
|
+
* Scrolls to the line where the bookmark `name` starts, and returns whether it went.
|
|
457
|
+
*
|
|
458
|
+
* # Errors
|
|
459
|
+
*
|
|
460
|
+
* Throws when no document is open.
|
|
461
|
+
*/
|
|
462
|
+
goToBookmark(name: string): boolean;
|
|
463
|
+
/**
|
|
464
|
+
* Scrolls to the first line of a heading of the outline, by its index in the outline, and
|
|
465
|
+
* makes it the frame's `currentHeading` until the next scroll.
|
|
466
|
+
*
|
|
467
|
+
* # Errors
|
|
468
|
+
*
|
|
469
|
+
* Throws when no document is open.
|
|
470
|
+
*/
|
|
471
|
+
goToHeading(index: number): void;
|
|
472
|
+
/**
|
|
473
|
+
* Scrolls the top of a page, counted from 0, to the top of the viewport.
|
|
474
|
+
*
|
|
475
|
+
* # Errors
|
|
476
|
+
*
|
|
477
|
+
* Throws when no document is open.
|
|
478
|
+
*/
|
|
479
|
+
goToPage(page: number): void;
|
|
480
|
+
/**
|
|
481
|
+
* The innermost hyperlink under the viewport's point `x`, `y`, as JSON: its `target`, an
|
|
482
|
+
* `external` `address` or a `bookmark` `name`, and its `tooltip`; null away from a link.
|
|
483
|
+
*
|
|
484
|
+
* # Errors
|
|
485
|
+
*
|
|
486
|
+
* Throws when no document is open.
|
|
487
|
+
*/
|
|
488
|
+
linkAt(x: number, y: number): string;
|
|
489
|
+
/**
|
|
490
|
+
* A session with no fonts and no document.
|
|
491
|
+
*/
|
|
492
|
+
constructor();
|
|
493
|
+
/**
|
|
494
|
+
* Opens a random-access DOCX source for `target` without copying the full archive into WASM
|
|
495
|
+
* linear memory ([`Session::open_source`]).
|
|
496
|
+
*
|
|
497
|
+
* # Errors
|
|
498
|
+
*
|
|
499
|
+
* Throws when `byteLength` is invalid, no target has the ID, or the source cannot be opened.
|
|
500
|
+
*/
|
|
501
|
+
openSource(byte_length: number, read_at: Function, target?: string | null): string;
|
|
502
|
+
/**
|
|
503
|
+
* Opens `docx` for `target`, and returns its page count and outline as JSON
|
|
504
|
+
* ([`Session::open`]).
|
|
505
|
+
*
|
|
506
|
+
* # Errors
|
|
507
|
+
*
|
|
508
|
+
* Throws when no target has the ID or the file cannot be opened.
|
|
509
|
+
*/
|
|
510
|
+
open(docx: Uint8Array | number[], target?: string | null): string;
|
|
511
|
+
/**
|
|
512
|
+
* Whether the viewport's point `x`, `y` lies on a line of text.
|
|
513
|
+
*
|
|
514
|
+
* # Errors
|
|
515
|
+
*
|
|
516
|
+
* Throws when no document is open.
|
|
517
|
+
*/
|
|
518
|
+
overText(x: number, y: number): boolean;
|
|
519
|
+
/**
|
|
520
|
+
* The hyperlinks of a page, counted from 0, as JSON: in reading order, each with its
|
|
521
|
+
* `target`, `tooltip`, `text` and `boxes`, the boxes as shares of the page's width and
|
|
522
|
+
* height.
|
|
523
|
+
*
|
|
524
|
+
* # Errors
|
|
525
|
+
*
|
|
526
|
+
* Throws when no document is open.
|
|
527
|
+
*/
|
|
528
|
+
pageLinks(page: number): string;
|
|
529
|
+
/**
|
|
530
|
+
* Writes the open document's pages as a PDF file, for printing.
|
|
531
|
+
*
|
|
532
|
+
* # Errors
|
|
533
|
+
*
|
|
534
|
+
* Throws when no document is open, or the pages cannot be written as PDF.
|
|
535
|
+
*/
|
|
536
|
+
pdf(): Uint8Array;
|
|
537
|
+
/**
|
|
538
|
+
* Ends a press that the platform cancelled or whose capture it lost, and returns what it
|
|
539
|
+
* did, as JSON ([`handled_json`]).
|
|
540
|
+
*
|
|
541
|
+
* # Errors
|
|
542
|
+
*
|
|
543
|
+
* Throws when no document is open.
|
|
544
|
+
*/
|
|
545
|
+
pointerCancel(): string;
|
|
546
|
+
/**
|
|
547
|
+
* Takes a press at the viewport's point `x`, `y` at `time` milliseconds: whether of the
|
|
548
|
+
* `primary` button, by a `pointer` of kind `mouse`, `pen` or `touch`, with `shift`, on a
|
|
549
|
+
* `hit` of kind `page`, `gap`, `scroll-bar`, `start-handle` or `end-handle`. Returns what it did, as JSON
|
|
550
|
+
* ([`handled_json`]).
|
|
551
|
+
*
|
|
552
|
+
* # Errors
|
|
553
|
+
*
|
|
554
|
+
* Throws when no document is open or a kind has another name.
|
|
555
|
+
*/
|
|
556
|
+
pointerDown(x: number, y: number, primary: boolean, pointer: string, shift: boolean, time: number, hit: string): string;
|
|
557
|
+
/**
|
|
558
|
+
* Moves a press's pointer to the viewport's point `x`, `y` at `time` milliseconds, and
|
|
559
|
+
* returns what it did, as JSON ([`handled_json`]).
|
|
560
|
+
*
|
|
561
|
+
* # Errors
|
|
562
|
+
*
|
|
563
|
+
* Throws when no document is open.
|
|
564
|
+
*/
|
|
565
|
+
pointerMove(x: number, y: number, time: number): string;
|
|
566
|
+
/**
|
|
567
|
+
* Ends a press at the viewport's point `x`, `y` at `time` milliseconds, and returns what
|
|
568
|
+
* it did, as JSON ([`handled_json`]).
|
|
569
|
+
*
|
|
570
|
+
* # Errors
|
|
571
|
+
*
|
|
572
|
+
* Throws when no document is open.
|
|
573
|
+
*/
|
|
574
|
+
pointerUp(x: number, y: number, time: number): string;
|
|
575
|
+
/**
|
|
576
|
+
* Draws a page at a resolution for the browser's own Print, without counting the
|
|
577
|
+
* drawing as the shell's.
|
|
578
|
+
*
|
|
579
|
+
* # Errors
|
|
580
|
+
*
|
|
581
|
+
* Throws when no document is open, or the page does not exist or cannot be drawn.
|
|
582
|
+
*/
|
|
583
|
+
printPage(page: number, dpi: number): Drawing;
|
|
584
|
+
/**
|
|
585
|
+
* The reading text of a page, counted from 0, as JSON: its paragraphs in reading order,
|
|
586
|
+
* each with its `text` and its outline `level` or null.
|
|
587
|
+
*
|
|
588
|
+
* # Errors
|
|
589
|
+
*
|
|
590
|
+
* Throws when no document is open.
|
|
591
|
+
*/
|
|
592
|
+
readingText(page: number): string;
|
|
593
|
+
/**
|
|
594
|
+
* Gives the viewer the viewport's size in CSS pixels and the device pixel ratio.
|
|
595
|
+
*
|
|
596
|
+
* # Errors
|
|
597
|
+
*
|
|
598
|
+
* Throws when no document is open.
|
|
599
|
+
*/
|
|
600
|
+
resize(width: number, height: number, ratio: number): void;
|
|
601
|
+
/**
|
|
602
|
+
* Scrolls to `page`, optionally focusing a point-space rectangle with `block` placement.
|
|
603
|
+
*
|
|
604
|
+
* # Errors
|
|
605
|
+
*
|
|
606
|
+
* Throws when no document is open.
|
|
607
|
+
*/
|
|
608
|
+
scrollToRect(page: number, left?: number | null, top?: number | null, width?: number | null, height?: number | null, block?: string | null): void;
|
|
609
|
+
/**
|
|
610
|
+
* Scrolls the viewport's top left corner to `(left, top)`.
|
|
611
|
+
*
|
|
612
|
+
* # Errors
|
|
613
|
+
*
|
|
614
|
+
* Throws when no document is open.
|
|
615
|
+
*/
|
|
616
|
+
scrollTo(left: number, top: number): void;
|
|
617
|
+
/**
|
|
618
|
+
* Selects the whole story of the last press.
|
|
619
|
+
*
|
|
620
|
+
* # Errors
|
|
621
|
+
*
|
|
622
|
+
* Throws when no document is open.
|
|
623
|
+
*/
|
|
624
|
+
selectAll(): void;
|
|
625
|
+
/**
|
|
626
|
+
* The selected text, as a copy gives it.
|
|
627
|
+
*
|
|
628
|
+
* # Errors
|
|
629
|
+
*
|
|
630
|
+
* Throws when no document is open.
|
|
631
|
+
*/
|
|
632
|
+
selectedText(): string;
|
|
633
|
+
/**
|
|
634
|
+
* Replaces caller-supplied highlights from a JSON array string.
|
|
635
|
+
*
|
|
636
|
+
* # Errors
|
|
637
|
+
*
|
|
638
|
+
* Throws when no document is open or JSON is malformed.
|
|
639
|
+
*/
|
|
640
|
+
setHighlights(items_json: string): void;
|
|
641
|
+
/**
|
|
642
|
+
* Enables or disables two-pass progressive drawing (fast 96 DPI draft before `HiDPI`).
|
|
643
|
+
*/
|
|
644
|
+
setProgressiveDraft(enabled: boolean): void;
|
|
645
|
+
/**
|
|
646
|
+
* Sets the zoom, `fixed` at `factor`, `fit-width` or `fit-page`, around the anchor or the
|
|
647
|
+
* viewport's middle ([`Session::set_zoom`]).
|
|
648
|
+
*
|
|
649
|
+
* # Errors
|
|
650
|
+
*
|
|
651
|
+
* Throws when no document is open or the kind is no zoom.
|
|
652
|
+
*/
|
|
653
|
+
setZoom(kind: string, factor: number, anchor_x?: number | null, anchor_y?: number | null): void;
|
|
654
|
+
/**
|
|
655
|
+
* Scrolls a point in points of a page, counted from 0, to the viewport's top left corner,
|
|
656
|
+
* as the frame's `place` gave it.
|
|
657
|
+
*
|
|
658
|
+
* # Errors
|
|
659
|
+
*
|
|
660
|
+
* Throws when no document is open.
|
|
661
|
+
*/
|
|
662
|
+
showPlace(page: number, x: number, y: number): void;
|
|
663
|
+
/**
|
|
664
|
+
* Streams the open document's pages as a PDF to `onChunk(chunk: Uint8Array)` in bounded
|
|
665
|
+
* 64 KiB chunks without allocating the full PDF in WASM linear memory.
|
|
666
|
+
*
|
|
667
|
+
* # Errors
|
|
668
|
+
*
|
|
669
|
+
* Throws when no document is open, or the pages cannot be written as PDF.
|
|
670
|
+
*/
|
|
671
|
+
writePdfTo(on_chunk: Function): void;
|
|
672
|
+
/**
|
|
673
|
+
* Zooms one step in or out around the anchor or the viewport's middle.
|
|
674
|
+
*
|
|
675
|
+
* # Errors
|
|
676
|
+
*
|
|
677
|
+
* Throws when no document is open.
|
|
678
|
+
*/
|
|
679
|
+
zoomStep(inward: boolean, anchor_x?: number | null, anchor_y?: number | null): void;
|
|
680
|
+
}
|
|
681
|
+
|
|
308
682
|
/**
|
|
309
683
|
* A run of upright text on a page, in points from the page's top left corner: the box of its
|
|
310
684
|
* glyphs from its font's ascender to its descender, and its glyphs.
|
|
@@ -361,11 +735,13 @@ export type InitInput = RequestInfo | URL | Response | BufferSource | WebAssembl
|
|
|
361
735
|
export interface InitOutput {
|
|
362
736
|
readonly memory: WebAssembly.Memory;
|
|
363
737
|
readonly __wbg_document_free: (a: number, b: number) => void;
|
|
738
|
+
readonly __wbg_drawing_free: (a: number, b: number) => void;
|
|
364
739
|
readonly __wbg_fontneed_free: (a: number, b: number) => void;
|
|
365
740
|
readonly __wbg_outlineentry_free: (a: number, b: number) => void;
|
|
366
741
|
readonly __wbg_pageimage_free: (a: number, b: number) => void;
|
|
367
742
|
readonly __wbg_renderer_free: (a: number, b: number) => void;
|
|
368
743
|
readonly __wbg_searchmatch_free: (a: number, b: number) => void;
|
|
744
|
+
readonly __wbg_session_free: (a: number, b: number) => void;
|
|
369
745
|
readonly __wbg_textrun_free: (a: number, b: number) => void;
|
|
370
746
|
readonly document_fontNeeds: (a: number) => [number, number];
|
|
371
747
|
readonly document_outline: (a: number) => [number, number];
|
|
@@ -380,6 +756,10 @@ export interface InitOutput {
|
|
|
380
756
|
readonly document_warnings: (a: number) => [number, number];
|
|
381
757
|
readonly document_writePdf: (a: number) => [number, number, number, number];
|
|
382
758
|
readonly document_writePdfTo: (a: number, b: any) => [number, number, number, number];
|
|
759
|
+
readonly drawing_height: (a: number) => number;
|
|
760
|
+
readonly drawing_pixels: (a: number) => [number, number];
|
|
761
|
+
readonly drawing_takePixels: (a: number) => [number, number];
|
|
762
|
+
readonly drawing_width: (a: number) => number;
|
|
383
763
|
readonly fontneed_family: (a: number) => [number, number];
|
|
384
764
|
readonly fontneed_tried: (a: number) => [number, number];
|
|
385
765
|
readonly outlineentry_address: (a: number) => [number, number];
|
|
@@ -407,6 +787,47 @@ export interface InitOutput {
|
|
|
407
787
|
readonly searchmatch_rects: (a: number) => [number, number];
|
|
408
788
|
readonly searchmatch_snippet: (a: number) => [number, number];
|
|
409
789
|
readonly searchmatch_start: (a: number) => number;
|
|
790
|
+
readonly session_addDictionaries: (a: number, b: number, c: number) => [number, number];
|
|
791
|
+
readonly session_addFont: (a: number, b: number, c: number) => [number, number, number];
|
|
792
|
+
readonly session_blur: (a: number) => [number, number, number, number];
|
|
793
|
+
readonly session_clearHighlights: (a: number, b: number, c: number) => [number, number];
|
|
794
|
+
readonly session_clearSelection: (a: number) => [number, number];
|
|
795
|
+
readonly session_draw: (a: number, b: number, c: number) => [number, number, number];
|
|
796
|
+
readonly session_endGesture: (a: number) => [number, number];
|
|
797
|
+
readonly session_find: (a: number, b: number, c: number) => [number, number, number];
|
|
798
|
+
readonly session_findStep: (a: number, b: number) => [number, number];
|
|
799
|
+
readonly session_fontsNeeded: (a: number, b: number, c: number, d: number) => [number, number, number, number];
|
|
800
|
+
readonly session_fontsNeededSource: (a: number, b: any, c: number, d: number) => [number, number, number, number];
|
|
801
|
+
readonly session_forgetRequests: (a: number) => [number, number];
|
|
802
|
+
readonly session_frame: (a: number) => [number, number, number, number];
|
|
803
|
+
readonly session_gestureZoom: (a: number, b: number, c: number, d: number, e: number, f: number) => [number, number];
|
|
804
|
+
readonly session_goToBookmark: (a: number, b: number, c: number) => [number, number, number];
|
|
805
|
+
readonly session_goToHeading: (a: number, b: number) => [number, number];
|
|
806
|
+
readonly session_goToPage: (a: number, b: number) => [number, number];
|
|
807
|
+
readonly session_linkAt: (a: number, b: number, c: number) => [number, number, number, number];
|
|
808
|
+
readonly session_new: () => number;
|
|
809
|
+
readonly session_open: (a: number, b: number, c: number, d: number, e: number) => [number, number, number, number];
|
|
810
|
+
readonly session_openSource: (a: number, b: number, c: any, d: number, e: number) => [number, number, number, number];
|
|
811
|
+
readonly session_overText: (a: number, b: number, c: number) => [number, number, number];
|
|
812
|
+
readonly session_pageLinks: (a: number, b: number) => [number, number, number, number];
|
|
813
|
+
readonly session_pdf: (a: number) => [number, number, number, number];
|
|
814
|
+
readonly session_pointerCancel: (a: number) => [number, number, number, number];
|
|
815
|
+
readonly session_pointerDown: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number, i: number, j: number) => [number, number, number, number];
|
|
816
|
+
readonly session_pointerMove: (a: number, b: number, c: number, d: number) => [number, number, number, number];
|
|
817
|
+
readonly session_pointerUp: (a: number, b: number, c: number, d: number) => [number, number, number, number];
|
|
818
|
+
readonly session_printPage: (a: number, b: number, c: number) => [number, number, number];
|
|
819
|
+
readonly session_readingText: (a: number, b: number) => [number, number, number, number];
|
|
820
|
+
readonly session_resize: (a: number, b: number, c: number, d: number) => [number, number];
|
|
821
|
+
readonly session_scrollTo: (a: number, b: number, c: number) => [number, number];
|
|
822
|
+
readonly session_scrollToRect: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number, i: number, j: number, k: number, l: number) => [number, number];
|
|
823
|
+
readonly session_selectAll: (a: number) => [number, number];
|
|
824
|
+
readonly session_selectedText: (a: number) => [number, number, number, number];
|
|
825
|
+
readonly session_setHighlights: (a: number, b: number, c: number) => [number, number];
|
|
826
|
+
readonly session_setProgressiveDraft: (a: number, b: number) => void;
|
|
827
|
+
readonly session_setZoom: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number) => [number, number];
|
|
828
|
+
readonly session_showPlace: (a: number, b: number, c: number, d: number) => [number, number];
|
|
829
|
+
readonly session_writePdfTo: (a: number, b: any) => [number, number];
|
|
830
|
+
readonly session_zoomStep: (a: number, b: number, c: number, d: number, e: number, f: number) => [number, number];
|
|
410
831
|
readonly textrun_baseline: (a: number) => number;
|
|
411
832
|
readonly textrun_glyphEnds: (a: number) => [number, number];
|
|
412
833
|
readonly textrun_glyphLefts: (a: number) => [number, number];
|