postext-folio 0.52.5 → 0.52.7

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.
Files changed (73) hide show
  1. package/dist/postext/book.d.ts +35 -0
  2. package/dist/postext/book.d.ts.map +1 -0
  3. package/dist/postext/book.js +96 -0
  4. package/dist/postext/book.js.map +1 -0
  5. package/dist/postext/constants.d.ts +36 -0
  6. package/dist/postext/constants.d.ts.map +1 -0
  7. package/dist/postext/constants.js +13 -0
  8. package/dist/postext/constants.js.map +1 -0
  9. package/dist/postext/pageVideos.d.ts +26 -0
  10. package/dist/postext/pageVideos.d.ts.map +1 -0
  11. package/dist/postext/pageVideos.js +276 -0
  12. package/dist/postext/pageVideos.js.map +1 -0
  13. package/dist/postext/painting.d.ts +30 -0
  14. package/dist/postext/painting.d.ts.map +1 -0
  15. package/dist/postext/painting.js +167 -0
  16. package/dist/postext/painting.js.map +1 -0
  17. package/dist/postext/sharp.d.ts +19 -0
  18. package/dist/postext/sharp.d.ts.map +1 -0
  19. package/dist/postext/sharp.js +121 -0
  20. package/dist/postext/sharp.js.map +1 -0
  21. package/dist/postext/state.d.ts +29 -0
  22. package/dist/postext/state.d.ts.map +1 -0
  23. package/dist/postext/state.js +2 -0
  24. package/dist/postext/state.js.map +1 -0
  25. package/dist/postext/sweep.d.ts +24 -0
  26. package/dist/postext/sweep.d.ts.map +1 -0
  27. package/dist/postext/sweep.js +37 -0
  28. package/dist/postext/sweep.js.map +1 -0
  29. package/dist/postext/types.d.ts +77 -0
  30. package/dist/postext/types.d.ts.map +1 -0
  31. package/dist/postext/types.js +2 -0
  32. package/dist/postext/types.js.map +1 -0
  33. package/dist/postext.d.ts +6 -124
  34. package/dist/postext.d.ts.map +1 -1
  35. package/dist/postext.js +87 -732
  36. package/dist/postext.js.map +1 -1
  37. package/dist/viewer/constants.d.ts +30 -0
  38. package/dist/viewer/constants.d.ts.map +1 -0
  39. package/dist/viewer/constants.js +49 -0
  40. package/dist/viewer/constants.js.map +1 -0
  41. package/dist/viewer/input.d.ts +15 -0
  42. package/dist/viewer/input.d.ts.map +1 -0
  43. package/dist/viewer/input.js +142 -0
  44. package/dist/viewer/input.js.map +1 -0
  45. package/dist/viewer/layout.d.ts +24 -0
  46. package/dist/viewer/layout.d.ts.map +1 -0
  47. package/dist/viewer/layout.js +183 -0
  48. package/dist/viewer/layout.js.map +1 -0
  49. package/dist/viewer/lens.d.ts +42 -0
  50. package/dist/viewer/lens.d.ts.map +1 -0
  51. package/dist/viewer/lens.js +166 -0
  52. package/dist/viewer/lens.js.map +1 -0
  53. package/dist/viewer/pointer.d.ts +37 -0
  54. package/dist/viewer/pointer.d.ts.map +1 -0
  55. package/dist/viewer/pointer.js +250 -0
  56. package/dist/viewer/pointer.js.map +1 -0
  57. package/dist/viewer/state.d.ts +70 -0
  58. package/dist/viewer/state.d.ts.map +1 -0
  59. package/dist/viewer/state.js +2 -0
  60. package/dist/viewer/state.js.map +1 -0
  61. package/dist/viewer/turning.d.ts +34 -0
  62. package/dist/viewer/turning.d.ts.map +1 -0
  63. package/dist/viewer/turning.js +156 -0
  64. package/dist/viewer/turning.js.map +1 -0
  65. package/dist/viewer/types.d.ts +241 -0
  66. package/dist/viewer/types.d.ts.map +1 -0
  67. package/dist/viewer/types.js +2 -0
  68. package/dist/viewer/types.js.map +1 -0
  69. package/dist/viewer.d.ts +3 -242
  70. package/dist/viewer.d.ts.map +1 -1
  71. package/dist/viewer.js +104 -976
  72. package/dist/viewer.js.map +1 -1
  73. package/package.json +3 -3
package/dist/postext.d.ts CHANGED
@@ -1,127 +1,9 @@
1
- import { type PrintPreview, type VDTDocument, type VDTPage } from "postext";
2
- import { type FolioAppearance, type FolioOptions, type FolioPagePoint, type FolioViewer } from "./viewer.js";
3
- export interface FolioDocumentOptions extends Omit<FolioOptions, "pages" | "firstPageRecto" | "binding" | "at" | "aspect"> {
4
- /** The page to open on (0-based). Default 0. */
5
- at?: number;
6
- /** Spreads painted on either side of the open one; pages farther away
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
@@ -1 +1 @@
1
- {"version":3,"file":"postext.d.ts","sourceRoot":"","sources":["../src/postext.ts"],"names":[],"mappings":"AAAA,OAAO,EAAsB,KAAK,YAAY,EAAE,KAAK,WAAW,EAAE,KAAK,OAAO,EAAE,MAAM,SAAS,CAAC;AAGhG,OAAO,EAAe,KAAK,eAAe,EAAE,KAAK,YAAY,EAAE,KAAK,cAAc,EAAuC,KAAK,WAAW,EAAE,MAAM,aAAa,C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