postext-folio 0.52.6 → 0.52.8
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/postext/book.d.ts +35 -0
- package/dist/postext/book.d.ts.map +1 -0
- package/dist/postext/book.js +96 -0
- package/dist/postext/book.js.map +1 -0
- package/dist/postext/constants.d.ts +36 -0
- package/dist/postext/constants.d.ts.map +1 -0
- package/dist/postext/constants.js +13 -0
- package/dist/postext/constants.js.map +1 -0
- package/dist/postext/pageVideos.d.ts +26 -0
- package/dist/postext/pageVideos.d.ts.map +1 -0
- package/dist/postext/pageVideos.js +276 -0
- package/dist/postext/pageVideos.js.map +1 -0
- package/dist/postext/painting.d.ts +30 -0
- package/dist/postext/painting.d.ts.map +1 -0
- package/dist/postext/painting.js +167 -0
- package/dist/postext/painting.js.map +1 -0
- package/dist/postext/sharp.d.ts +19 -0
- package/dist/postext/sharp.d.ts.map +1 -0
- package/dist/postext/sharp.js +121 -0
- package/dist/postext/sharp.js.map +1 -0
- package/dist/postext/state.d.ts +29 -0
- package/dist/postext/state.d.ts.map +1 -0
- package/dist/postext/state.js +2 -0
- package/dist/postext/state.js.map +1 -0
- package/dist/postext/sweep.d.ts +24 -0
- package/dist/postext/sweep.d.ts.map +1 -0
- package/dist/postext/sweep.js +37 -0
- package/dist/postext/sweep.js.map +1 -0
- package/dist/postext/types.d.ts +77 -0
- package/dist/postext/types.d.ts.map +1 -0
- package/dist/postext/types.js +2 -0
- package/dist/postext/types.js.map +1 -0
- package/dist/postext.d.ts +6 -124
- package/dist/postext.d.ts.map +1 -1
- package/dist/postext.js +87 -732
- package/dist/postext.js.map +1 -1
- package/dist/viewer/constants.d.ts +30 -0
- package/dist/viewer/constants.d.ts.map +1 -0
- package/dist/viewer/constants.js +49 -0
- package/dist/viewer/constants.js.map +1 -0
- package/dist/viewer/input.d.ts +15 -0
- package/dist/viewer/input.d.ts.map +1 -0
- package/dist/viewer/input.js +142 -0
- package/dist/viewer/input.js.map +1 -0
- package/dist/viewer/layout.d.ts +24 -0
- package/dist/viewer/layout.d.ts.map +1 -0
- package/dist/viewer/layout.js +183 -0
- package/dist/viewer/layout.js.map +1 -0
- package/dist/viewer/lens.d.ts +42 -0
- package/dist/viewer/lens.d.ts.map +1 -0
- package/dist/viewer/lens.js +166 -0
- package/dist/viewer/lens.js.map +1 -0
- package/dist/viewer/pointer.d.ts +37 -0
- package/dist/viewer/pointer.d.ts.map +1 -0
- package/dist/viewer/pointer.js +250 -0
- package/dist/viewer/pointer.js.map +1 -0
- package/dist/viewer/state.d.ts +70 -0
- package/dist/viewer/state.d.ts.map +1 -0
- package/dist/viewer/state.js +2 -0
- package/dist/viewer/state.js.map +1 -0
- package/dist/viewer/turning.d.ts +34 -0
- package/dist/viewer/turning.d.ts.map +1 -0
- package/dist/viewer/turning.js +156 -0
- package/dist/viewer/turning.js.map +1 -0
- package/dist/viewer/types.d.ts +241 -0
- package/dist/viewer/types.d.ts.map +1 -0
- package/dist/viewer/types.js +2 -0
- package/dist/viewer/types.js.map +1 -0
- package/dist/viewer.d.ts +3 -242
- package/dist/viewer.d.ts.map +1 -1
- package/dist/viewer.js +104 -976
- package/dist/viewer.js.map +1 -1
- package/package.json +3 -3
package/dist/postext.d.ts
CHANGED
|
@@ -1,127 +1,9 @@
|
|
|
1
|
-
import { type
|
|
2
|
-
import
|
|
3
|
-
export
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
* are let go (drawn as blank paper should a long turn sweep past them).
|
|
8
|
-
* Default 3. */
|
|
9
|
-
window?: number;
|
|
10
|
-
/** Passed to `renderPageToCanvas` (see its `RenderPageOptions`). */
|
|
11
|
-
singleInk?: boolean;
|
|
12
|
-
pageNegative?: boolean;
|
|
13
|
-
/** The print preview (soft proof) of the pages (`createPrintPreview`).
|
|
14
|
-
* With `paper: true` the proof brings the paper's white: give the book
|
|
15
|
-
* a neutral paper shade meanwhile, or it tints that paper again. */
|
|
16
|
-
printPreview?: PrintPreview;
|
|
17
|
-
/** A page's text alternative. Default `Page n`. */
|
|
18
|
-
alt?: (index: number) => string;
|
|
19
|
-
/**
|
|
20
|
-
* Draws over a painted page (a selection, a caret): `ctx` is set to the
|
|
21
|
-
* page's own pixels (the untrimmed sheet, as the document's coordinates
|
|
22
|
-
* are), over the page as painted. Returns whether it drew anything. Run
|
|
23
|
-
* when a page is painted and on `redecorate`.
|
|
24
|
-
*/
|
|
25
|
-
decorate?: (index: number, ctx: CanvasRenderingContext2D) => boolean;
|
|
26
|
-
/**
|
|
27
|
-
* Videos printed on the pages play there (#477): a click on a video's
|
|
28
|
-
* poster plays it on the page (in every pointer mode), a click on it
|
|
29
|
-
* again pauses it, and it goes on playing while its leaf turns. Several
|
|
30
|
-
* may play at once (#507, up to eight drawn): starting a video stops the
|
|
31
|
-
* other exclusive ones (`player.exclusive`, the default) and holds those
|
|
32
|
-
* playing alongside (`exclusive: false`) until it pauses or ends; one
|
|
33
|
-
* playing alongside pauses only the exclusive ones. A video with
|
|
34
|
-
* `player.autoplay` starts by itself, muted: an exclusive one the first
|
|
35
|
-
* time its spread is shown (with its sound once the reader has
|
|
36
|
-
* interacted with the page), one playing alongside each time its page
|
|
37
|
-
* comes into view, unless the reader asks for less motion
|
|
38
|
-
* (`prefers-reduced-motion`). A video stops when the book comes to rest
|
|
39
|
-
* on a spread that does not show it. Self-hosted videos only (a file, or its
|
|
40
|
-
* address: MP4, WebM or an HLS stream); a YouTube or Vimeo poster turns
|
|
41
|
-
* the page as any other. The video's server must allow cross-origin
|
|
42
|
-
* reads (CORS) for WebGL to draw it. Default true.
|
|
43
|
-
*/
|
|
44
|
-
videos?: boolean;
|
|
45
|
-
/** The address a self-hosted video's file plays from (an object URL for
|
|
46
|
-
* its `fileId`); without one, its production address (`video.url`). */
|
|
47
|
-
videoUrl?: (fileId: string) => string | undefined;
|
|
48
|
-
/** Told when a video on a page starts playing, pauses, stops or cannot
|
|
49
|
-
* play (`error`: no address, a refused cross-origin read, no HLS). */
|
|
50
|
-
onVideo?: (event: {
|
|
51
|
-
resourceId: string;
|
|
52
|
-
page: number;
|
|
53
|
-
state: "playing" | "paused" | "stopped" | "error";
|
|
54
|
-
}) => void;
|
|
55
|
-
}
|
|
56
|
-
export interface FolioDocumentViewer extends FolioViewer {
|
|
57
|
-
/** Shows another layout of the book (after an edit), on the same page
|
|
58
|
-
* unless `at` says otherwise. A page that reads the same as before
|
|
59
|
-
* keeps its painting; `repaint` paints every page again (an image that
|
|
60
|
-
* came in after the pages were painted). `appearance` is laid over the
|
|
61
|
-
* host's own, as `setAppearance` does, for the new document (a chapter
|
|
62
|
-
* saying how many pages of the book lie round it). */
|
|
63
|
-
setDocument(doc: VDTDocument, options?: {
|
|
64
|
-
at?: number;
|
|
65
|
-
repaint?: boolean;
|
|
66
|
-
appearance?: FolioAppearance;
|
|
67
|
-
}): void;
|
|
68
|
-
/** Draws the decorations (`decorate`) again on these pages, or on every
|
|
69
|
-
* painted page; the book shows them at once, on a turning leaf too. */
|
|
70
|
-
redecorate(pages?: Iterable<number>): void;
|
|
71
|
-
/** Plays or pauses the video printed at a point of a page, as a click
|
|
72
|
-
* there does; false when no playable video lies there. */
|
|
73
|
-
toggleVideoAt(point: FolioPagePoint): boolean;
|
|
74
|
-
/** Stops the videos playing on the pages (their posters show again). */
|
|
75
|
-
stopVideo(): void;
|
|
76
|
-
}
|
|
77
|
-
/** Whether the document's first page is a recto: page 1, or a chapter
|
|
78
|
-
* continued after an even number of pages. */
|
|
79
|
-
export declare function firstPageIsRecto(doc: VDTDocument): boolean;
|
|
80
|
-
/** A page's width and height as bound: the trim box, since a book is cut
|
|
81
|
-
* (a sheet laid out with cut lines also carries the bleed, the slug and
|
|
82
|
-
* the crop marks, none of which a bound page shows). */
|
|
83
|
-
export declare function trimmedSize(page: VDTPage, doc: VDTDocument): {
|
|
84
|
-
width: number;
|
|
85
|
-
height: number;
|
|
86
|
-
};
|
|
87
|
-
/** How the document's book is presented: its `folio` settings, its page
|
|
88
|
-
* width, the book's pages before and after it (a chapter of a longer
|
|
89
|
-
* book), with the host's own appearance laid over them. The pages round
|
|
90
|
-
* it are the host's word when it gives them (`extraPages`: a host laying
|
|
91
|
-
* a book out a chapter at a time knows the chapters after this one, which
|
|
92
|
-
* the document only knows when it was given the book's page count). A
|
|
93
|
-
* newspaper trim (`page.sizePreset` broadsheet, berliner, tabloid or
|
|
94
|
-
* compact) shows folded newsprint unless the settings name a stock or a
|
|
95
|
-
* binding (#506). */
|
|
96
|
-
export declare function appearanceOf(doc: VDTDocument, own: FolioAppearance | undefined): FolioAppearance;
|
|
97
|
-
/**
|
|
98
|
-
* Which paintings a new layout can keep: new page index → old page index,
|
|
99
|
-
* for every page of `wanted` that is the same page as a painted one (the
|
|
100
|
-
* same object, or one that reads the same). Each old painting goes to one
|
|
101
|
-
* page at most.
|
|
102
|
-
*/
|
|
103
|
-
export declare function carriedPaintings(before: readonly VDTPage[], painted: Iterable<number>, next: readonly VDTPage[], wanted: Iterable<number>): Map<number, number>;
|
|
104
|
-
/** A run of turns, from the spread at rest to the book's next rest: where
|
|
105
|
-
* its leaves started and, when it opened with a block jump, the spread
|
|
106
|
-
* that block lands on. */
|
|
107
|
-
export interface SweepRun {
|
|
108
|
-
from: number[];
|
|
109
|
-
block: number[] | null;
|
|
110
|
-
}
|
|
111
|
-
/**
|
|
112
|
-
* The pages a turn to `target` sweeps past, in the order its leaves lift,
|
|
113
|
-
* and the run it belongs to. A turn set at rest (`run` null) more than
|
|
114
|
-
* `BLOCK_PAGES` away goes over as one block, as the renderer turns it: it
|
|
115
|
-
* keeps only the pages on show (the block's top face), the target's being
|
|
116
|
-
* painted with it. A target set while leaves are in the air carries the
|
|
117
|
-
* run on leaf by leaf (the renderer lifts a block only with no leaf in
|
|
118
|
-
* the air), so every page from where the run started (or its block
|
|
119
|
-
* lands) to the target is swept, a run of fast clicks included.
|
|
120
|
-
*/
|
|
121
|
-
export declare function sweepFor(run: SweepRun | null, settled: number[], target: number[], count: number): {
|
|
122
|
-
run: SweepRun;
|
|
123
|
-
pages: number[];
|
|
124
|
-
};
|
|
1
|
+
import { type VDTDocument } from 'postext';
|
|
2
|
+
import type { FolioDocumentOptions, FolioDocumentViewer } from './postext/types.js';
|
|
3
|
+
export type { FolioDocumentOptions, FolioDocumentViewer } from './postext/types.js';
|
|
4
|
+
export { firstPageIsRecto, trimmedSize, appearanceOf, carriedPaintings } from './postext/book.js';
|
|
5
|
+
export { sweepFor } from './postext/sweep.js';
|
|
6
|
+
export type { SweepRun } from './postext/sweep.js';
|
|
125
7
|
/**
|
|
126
8
|
* A postext document as a book: `createFolio` over its pages, painted with
|
|
127
9
|
* `renderPageToCanvas` at exactly the device pixels of a page slot, so the
|
package/dist/postext.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"postext.d.ts","sourceRoot":"","sources":["../src/postext.ts"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"postext.d.ts","sourceRoot":"","sources":["../src/postext.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,WAAW,EAAE,MAAM,SAAS,CAAC;AAK3C,OAAO,KAAK,EAAE,oBAAoB,EAAE,mBAAmB,EAAE,MAAM,oBAAoB,CAAC;AAMpF,YAAY,EAAE,oBAAoB,EAAE,mBAAmB,EAAE,MAAM,oBAAoB,CAAC;AACpF,OAAO,EAAE,gBAAgB,EAAE,WAAW,EAAE,YAAY,EAAE,gBAAgB,EAAE,MAAM,mBAAmB,CAAC;AAClG,OAAO,EAAE,QAAQ,EAAE,MAAM,oBAAoB,CAAC;AAC9C,YAAY,EAAE,QAAQ,EAAE,MAAM,oBAAoB,CAAC;AAEnD;;;;;;;;;;;;GAYG;AACH,wBAAgB,uBAAuB,CAAC,SAAS,EAAE,WAAW,EAAE,GAAG,EAAE,WAAW,EAAE,OAAO,GAAE,oBAAyB,GAAG,mBAAmB,CA2PzI"}
|