@vivliostyle/core 2.24.3 → 2.25.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.
Files changed (63) hide show
  1. package/lib/vivliostyle/adaptive-viewer.d.ts +167 -167
  2. package/lib/vivliostyle/asserts.d.ts +21 -21
  3. package/lib/vivliostyle/assets.d.ts +35 -35
  4. package/lib/vivliostyle/base.d.ts +189 -189
  5. package/lib/vivliostyle/break-position.d.ts +39 -39
  6. package/lib/vivliostyle/break.d.ts +112 -112
  7. package/lib/vivliostyle/cfi.d.ts +77 -77
  8. package/lib/vivliostyle/columns.d.ts +52 -52
  9. package/lib/vivliostyle/constants.d.ts +53 -53
  10. package/lib/vivliostyle/core-viewer.d.ts +240 -240
  11. package/lib/vivliostyle/counters.d.ts +130 -127
  12. package/lib/vivliostyle/css-cascade.d.ts +974 -954
  13. package/lib/vivliostyle/css-logical-util.d.ts +3 -3
  14. package/lib/vivliostyle/css-page.d.ts +451 -451
  15. package/lib/vivliostyle/css-parser.d.ts +320 -320
  16. package/lib/vivliostyle/css-prop.d.ts +74 -74
  17. package/lib/vivliostyle/css-styler.d.ts +210 -210
  18. package/lib/vivliostyle/css-tokenizer.d.ts +243 -243
  19. package/lib/vivliostyle/css-validator.d.ts +319 -319
  20. package/lib/vivliostyle/css.d.ts +205 -205
  21. package/lib/vivliostyle/diff.d.ts +26 -26
  22. package/lib/vivliostyle/display.d.ts +62 -57
  23. package/lib/vivliostyle/epub.d.ts +329 -329
  24. package/lib/vivliostyle/exprs.d.ts +395 -395
  25. package/lib/vivliostyle/font.d.ts +87 -87
  26. package/lib/vivliostyle/footnotes.d.ts +41 -41
  27. package/lib/vivliostyle/geometry-util.d.ts +110 -110
  28. package/lib/vivliostyle/layout-helper.d.ts +16 -15
  29. package/lib/vivliostyle/layout-processor.d.ts +73 -73
  30. package/lib/vivliostyle/layout-retryers.d.ts +21 -21
  31. package/lib/vivliostyle/layout-util.d.ts +55 -55
  32. package/lib/vivliostyle/layout.d.ts +456 -456
  33. package/lib/vivliostyle/logging.d.ts +56 -56
  34. package/lib/vivliostyle/matchers.d.ts +36 -36
  35. package/lib/vivliostyle/math-util.d.ts +22 -22
  36. package/lib/vivliostyle/net.d.ts +72 -72
  37. package/lib/vivliostyle/ops.d.ts +263 -263
  38. package/lib/vivliostyle/page-floats.d.ts +178 -178
  39. package/lib/vivliostyle/page-master.d.ts +247 -247
  40. package/lib/vivliostyle/plugin.d.ts +172 -172
  41. package/lib/vivliostyle/print.d.ts +7 -7
  42. package/lib/vivliostyle/profile.d.ts +59 -59
  43. package/lib/vivliostyle/pseudo-element.d.ts +32 -32
  44. package/lib/vivliostyle/repetitive-element.d.ts +162 -162
  45. package/lib/vivliostyle/scripts.d.ts +15 -15
  46. package/lib/vivliostyle/sha1.d.ts +33 -33
  47. package/lib/vivliostyle/shared.d.ts +24 -24
  48. package/lib/vivliostyle/sizing.d.ts +29 -29
  49. package/lib/vivliostyle/table.d.ts +263 -263
  50. package/lib/vivliostyle/task-util.d.ts +37 -37
  51. package/lib/vivliostyle/task.d.ts +357 -357
  52. package/lib/vivliostyle/text-polyfill.d.ts +3 -3
  53. package/lib/vivliostyle/toc.d.ts +64 -64
  54. package/lib/vivliostyle/types.d.ts +977 -977
  55. package/lib/vivliostyle/urls.d.ts +25 -25
  56. package/lib/vivliostyle/vgen.d.ts +213 -213
  57. package/lib/vivliostyle/viewer-app.d.ts +19 -19
  58. package/lib/vivliostyle/vtree.d.ts +392 -392
  59. package/lib/vivliostyle/xml-doc.d.ts +88 -88
  60. package/lib/vivliostyle.d.ts +6 -6
  61. package/lib/vivliostyle.js +1 -1
  62. package/lib/vivliostyle.js.map +1 -1
  63. package/package.json +5 -5
@@ -1,240 +1,240 @@
1
- /**
2
- * Copyright 2015 Trim-marks Inc.
3
- * Copyright 2018 Vivliostyle Foundation
4
- *
5
- * Vivliostyle.js is free software: you can redistribute it and/or modify
6
- * it under the terms of the GNU Affero General Public License as published by
7
- * the Free Software Foundation, either version 3 of the License, or
8
- * (at your option) any later version.
9
- *
10
- * Vivliostyle.js is distributed in the hope that it will be useful,
11
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
12
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13
- * GNU Affero General Public License for more details.
14
- *
15
- * You should have received a copy of the GNU Affero General Public License
16
- * along with Vivliostyle.js. If not, see <http://www.gnu.org/licenses/>.
17
- *
18
- * @fileoverview CoreViewer - Vivliostyle CoreViewer class
19
- */
20
- import * as AdaptiveViewer from "./adaptive-viewer";
21
- import * as Constants from "./constants";
22
- import * as Epub from "./epub";
23
- import * as Toc from "./toc";
24
- export interface Payload {
25
- type: string;
26
- internal: boolean;
27
- href: string;
28
- content: string;
29
- cfi: string;
30
- first: boolean;
31
- last: boolean;
32
- epage: number;
33
- epageCount: number;
34
- metadata: unknown;
35
- docTitle: string;
36
- }
37
- /**
38
- * Viewer settings that must be passed to Viewer's constructor.
39
- * - userAgentRootURL: URL of a directory from which viewer resource files
40
- * (under resources/ directory in the source repository) are served.
41
- * - viewportElement: An element used as the viewport of the displayed contents.
42
- * - window: Window object. If omitted, current `window` is used.
43
- * - debug: Debug flag.
44
- */
45
- export type CoreViewerSettings = {
46
- userAgentRootURL?: string;
47
- viewportElement: HTMLElement;
48
- window?: Window;
49
- debug?: boolean;
50
- };
51
- /**
52
- * Viewer options that can be set after the Viewer object is constructed.
53
- * - autoResize: Run layout again when the window is resized. default: true
54
- * - fontSize: Default font size (px). default: 16
55
- * - pageBorderWidth: Width of a border between two pages in a single
56
- * spread (px). Effective only in spread view mode. default: 1
57
- * - renderAllPages: Render all pages at the document load time. default: true
58
- * - pageViewMode: Page view mode (singlePage / spread / autoSpread).
59
- * default: singlePage
60
- * - zoom: Zoom factor with which pages are displayed. default: 1
61
- * - fitToScreen: Auto adjust zoom factor to fit the screen. default: false
62
- * - defaultPaperSize: Default paper size in px. Effective when `@page` size
63
- * is set to auto. default: undefined (means the windows size is used as
64
- * paper size).
65
- * - allowScripts: Allow JavaScript in documents. default: true
66
- * - pixelRatio: Set output pixel ratio. Enables very thin border width and
67
- * improves layout precision, emulating high pixel ratio.
68
- * default: 8. Set 0 to disable pixel ratio emulation.
69
- */
70
- export type CoreViewerOptions = {
71
- autoResize?: boolean;
72
- fontSize?: number;
73
- pageBorderWidth?: number;
74
- renderAllPages?: boolean;
75
- pageViewMode?: AdaptiveViewer.PageViewMode;
76
- zoom?: number;
77
- fitToScreen?: boolean;
78
- defaultPaperSize?: {
79
- width: number;
80
- height: number;
81
- };
82
- allowScripts?: boolean;
83
- pixelRatio?: number;
84
- };
85
- /**
86
- * Options for the displayed document.
87
- * - documentObject: Document object for the document. If provided, it is used
88
- * directly without parsing the source again.
89
- * - fragment: Fragmentation identifier (EPUB CFI) of the location in the
90
- * document which is to be displayed.
91
- * - authorStyleSheet: An array of author style sheets to be injected after all
92
- * author style sheets referenced from the document. A single stylesheet may
93
- * be a URL of the style sheet or a text content of the style sheet.
94
- * - userStyleSheet: An array of user style sheets to be injected.
95
- * A single stylesheet may be a URL of the style sheet or a text content of
96
- * the style sheet.
97
- */
98
- export type DocumentOptions = {
99
- documentObject?: Document;
100
- fragment?: string;
101
- authorStyleSheet?: {
102
- url?: string;
103
- text?: string;
104
- }[];
105
- userStyleSheet?: {
106
- url?: string;
107
- text?: string;
108
- }[];
109
- };
110
- /**
111
- * Options for a single source document.
112
- * - url: URL of the document.
113
- * - startPage: If specified, the `page` page-based counter is set to the
114
- * specified value on the first page of the document. It is equivalent to
115
- * specifying `counter-reset: page [specified value - 1]` on that page.
116
- * - skipPagesBefore: If specified, the `page` page-based counter is
117
- * incremented by the specified value *before* updating page-based counters
118
- * on the first page of the document.
119
- * This option is ignored if `startPageNumber` option is also specified.
120
- */
121
- export type SingleDocumentOptions = string | {
122
- url: string;
123
- startPage?: number;
124
- skipPagesBefore?: number;
125
- };
126
- /**
127
- * Vivliostyle Viewer class.
128
- */
129
- export declare class CoreViewer {
130
- private readonly settings;
131
- private initialized;
132
- private adaptViewer_;
133
- private options;
134
- private eventTarget;
135
- readyState: Constants.ReadyState;
136
- constructor(settings: CoreViewerSettings, opt_options?: CoreViewerOptions);
137
- /**
138
- * Set ViewerOptions to the viewer.
139
- */
140
- setOptions(options: CoreViewerOptions): void;
141
- private dispatcher;
142
- /**
143
- * Add a listener function, which is invoked when the specified type of event
144
- * is dispatched.
145
- * @param type Event type.
146
- * @param listener Listener function.
147
- */
148
- addListener(type: string, listener: (payload: Payload) => void): void;
149
- /**
150
- * Remove an event listener.
151
- * @param type Event type.
152
- * @param listener Listener function.
153
- */
154
- removeListener(type: string, listener: (payload: Payload) => void): void;
155
- /**
156
- * Load an HTML or XML document(s).
157
- */
158
- loadDocument(singleDocumentOptions: SingleDocumentOptions | SingleDocumentOptions[], opt_documentOptions?: DocumentOptions, opt_viewerOptions?: CoreViewerOptions): void;
159
- /**
160
- * Load an EPUB/WebPub publication.
161
- */
162
- loadPublication(pubUrl: string, opt_documentOptions?: DocumentOptions, opt_viewerOptions?: CoreViewerOptions): void;
163
- /**
164
- * Load an HTML or XML document, or an EPUB/WebPub publication.
165
- */
166
- private loadDocumentOrPublication;
167
- /**
168
- * Returns the current page progression of the viewer. If no document is
169
- * loaded, returns null.
170
- */
171
- getCurrentPageProgression(): Constants.PageProgression | null;
172
- private resolveNavigation;
173
- /**
174
- * Navigate to the specified page.
175
- */
176
- navigateToPage(nav: Navigation, opt_epage?: number): void;
177
- /**
178
- * Navigate to the specified internal URL.
179
- */
180
- navigateToInternalUrl(url: string): void;
181
- /**
182
- * Navigate to the specified position.
183
- */
184
- navigateToPosition(position: {
185
- spineIndex: number;
186
- pageIndex?: number;
187
- offsetInItem?: number;
188
- }): void;
189
- /**
190
- * @returns True if TOC is visible, false if hidden, null if TOC is unavailable
191
- */
192
- isTOCVisible(): boolean | null;
193
- /**
194
- * Show or hide TOC box
195
- * @param opt_autohide If true, automatically hide when click TOC item
196
- * @param opt_show If true show TOC, false hide TOC. If null or undefined toggle TOC.
197
- */
198
- showTOC(opt_show?: boolean | null, opt_autohide?: boolean): void;
199
- /**
200
- * Returns zoom factor corresponding to the specified zoom type.
201
- */
202
- queryZoomFactor(type: AdaptiveViewer.ZoomType): number;
203
- getPageSizes(): {
204
- width: number;
205
- height: number;
206
- }[];
207
- /**
208
- * Returns the current structure of the TOC once it has
209
- * been shown, or the empty array if there is no TOC.
210
- */
211
- getTOC(): Toc.TOCItem[];
212
- /**
213
- * Returns metadata for the publication. Metadata is
214
- * organized as an object of fully-qualified IRI properties
215
- * containing arrays of metadata entries. The first element
216
- * in the array is primary and should be used by default. Other
217
- * entries may overload or refine that metadata.
218
- */
219
- getMetadata(): Epub.Meta;
220
- /**
221
- * Returns the cover for an EPUB publication, if specified.
222
- */
223
- getCover(): Epub.OPFItem | null;
224
- }
225
- /**
226
- * @enum {string}
227
- */
228
- export declare enum Navigation {
229
- PREVIOUS = "previous",
230
- NEXT = "next",
231
- LEFT = "left",
232
- RIGHT = "right",
233
- FIRST = "first",
234
- LAST = "last",
235
- EPAGE = "epage"
236
- }
237
- export type ZoomType = AdaptiveViewer.ZoomType;
238
- export declare const ZoomType: typeof AdaptiveViewer.ZoomType;
239
- export type PageViewMode = AdaptiveViewer.PageViewMode;
240
- export declare const PageViewMode: typeof AdaptiveViewer.PageViewMode;
1
+ /**
2
+ * Copyright 2015 Trim-marks Inc.
3
+ * Copyright 2018 Vivliostyle Foundation
4
+ *
5
+ * Vivliostyle.js is free software: you can redistribute it and/or modify
6
+ * it under the terms of the GNU Affero General Public License as published by
7
+ * the Free Software Foundation, either version 3 of the License, or
8
+ * (at your option) any later version.
9
+ *
10
+ * Vivliostyle.js is distributed in the hope that it will be useful,
11
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
12
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13
+ * GNU Affero General Public License for more details.
14
+ *
15
+ * You should have received a copy of the GNU Affero General Public License
16
+ * along with Vivliostyle.js. If not, see <http://www.gnu.org/licenses/>.
17
+ *
18
+ * @fileoverview CoreViewer - Vivliostyle CoreViewer class
19
+ */
20
+ import * as AdaptiveViewer from "./adaptive-viewer";
21
+ import * as Constants from "./constants";
22
+ import * as Epub from "./epub";
23
+ import * as Toc from "./toc";
24
+ export interface Payload {
25
+ type: string;
26
+ internal: boolean;
27
+ href: string;
28
+ content: string;
29
+ cfi: string;
30
+ first: boolean;
31
+ last: boolean;
32
+ epage: number;
33
+ epageCount: number;
34
+ metadata: unknown;
35
+ docTitle: string;
36
+ }
37
+ /**
38
+ * Viewer settings that must be passed to Viewer's constructor.
39
+ * - userAgentRootURL: URL of a directory from which viewer resource files
40
+ * (under resources/ directory in the source repository) are served.
41
+ * - viewportElement: An element used as the viewport of the displayed contents.
42
+ * - window: Window object. If omitted, current `window` is used.
43
+ * - debug: Debug flag.
44
+ */
45
+ export type CoreViewerSettings = {
46
+ userAgentRootURL?: string;
47
+ viewportElement: HTMLElement;
48
+ window?: Window;
49
+ debug?: boolean;
50
+ };
51
+ /**
52
+ * Viewer options that can be set after the Viewer object is constructed.
53
+ * - autoResize: Run layout again when the window is resized. default: true
54
+ * - fontSize: Default font size (px). default: 16
55
+ * - pageBorderWidth: Width of a border between two pages in a single
56
+ * spread (px). Effective only in spread view mode. default: 1
57
+ * - renderAllPages: Render all pages at the document load time. default: true
58
+ * - pageViewMode: Page view mode (singlePage / spread / autoSpread).
59
+ * default: singlePage
60
+ * - zoom: Zoom factor with which pages are displayed. default: 1
61
+ * - fitToScreen: Auto adjust zoom factor to fit the screen. default: false
62
+ * - defaultPaperSize: Default paper size in px. Effective when `@page` size
63
+ * is set to auto. default: undefined (means the windows size is used as
64
+ * paper size).
65
+ * - allowScripts: Allow JavaScript in documents. default: true
66
+ * - pixelRatio: Set output pixel ratio. Enables very thin border width and
67
+ * improves layout precision, emulating high pixel ratio.
68
+ * default: 8. Set 0 to disable pixel ratio emulation.
69
+ */
70
+ export type CoreViewerOptions = {
71
+ autoResize?: boolean;
72
+ fontSize?: number;
73
+ pageBorderWidth?: number;
74
+ renderAllPages?: boolean;
75
+ pageViewMode?: AdaptiveViewer.PageViewMode;
76
+ zoom?: number;
77
+ fitToScreen?: boolean;
78
+ defaultPaperSize?: {
79
+ width: number;
80
+ height: number;
81
+ };
82
+ allowScripts?: boolean;
83
+ pixelRatio?: number;
84
+ };
85
+ /**
86
+ * Options for the displayed document.
87
+ * - documentObject: Document object for the document. If provided, it is used
88
+ * directly without parsing the source again.
89
+ * - fragment: Fragmentation identifier (EPUB CFI) of the location in the
90
+ * document which is to be displayed.
91
+ * - authorStyleSheet: An array of author style sheets to be injected after all
92
+ * author style sheets referenced from the document. A single stylesheet may
93
+ * be a URL of the style sheet or a text content of the style sheet.
94
+ * - userStyleSheet: An array of user style sheets to be injected.
95
+ * A single stylesheet may be a URL of the style sheet or a text content of
96
+ * the style sheet.
97
+ */
98
+ export type DocumentOptions = {
99
+ documentObject?: Document;
100
+ fragment?: string;
101
+ authorStyleSheet?: {
102
+ url?: string;
103
+ text?: string;
104
+ }[];
105
+ userStyleSheet?: {
106
+ url?: string;
107
+ text?: string;
108
+ }[];
109
+ };
110
+ /**
111
+ * Options for a single source document.
112
+ * - url: URL of the document.
113
+ * - startPage: If specified, the `page` page-based counter is set to the
114
+ * specified value on the first page of the document. It is equivalent to
115
+ * specifying `counter-reset: page [specified value - 1]` on that page.
116
+ * - skipPagesBefore: If specified, the `page` page-based counter is
117
+ * incremented by the specified value *before* updating page-based counters
118
+ * on the first page of the document.
119
+ * This option is ignored if `startPageNumber` option is also specified.
120
+ */
121
+ export type SingleDocumentOptions = string | {
122
+ url: string;
123
+ startPage?: number;
124
+ skipPagesBefore?: number;
125
+ };
126
+ /**
127
+ * Vivliostyle Viewer class.
128
+ */
129
+ export declare class CoreViewer {
130
+ private readonly settings;
131
+ private initialized;
132
+ private adaptViewer_;
133
+ private options;
134
+ private eventTarget;
135
+ readyState: Constants.ReadyState;
136
+ constructor(settings: CoreViewerSettings, opt_options?: CoreViewerOptions);
137
+ /**
138
+ * Set ViewerOptions to the viewer.
139
+ */
140
+ setOptions(options: CoreViewerOptions): void;
141
+ private dispatcher;
142
+ /**
143
+ * Add a listener function, which is invoked when the specified type of event
144
+ * is dispatched.
145
+ * @param type Event type.
146
+ * @param listener Listener function.
147
+ */
148
+ addListener(type: string, listener: (payload: Payload) => void): void;
149
+ /**
150
+ * Remove an event listener.
151
+ * @param type Event type.
152
+ * @param listener Listener function.
153
+ */
154
+ removeListener(type: string, listener: (payload: Payload) => void): void;
155
+ /**
156
+ * Load an HTML or XML document(s).
157
+ */
158
+ loadDocument(singleDocumentOptions: SingleDocumentOptions | SingleDocumentOptions[], opt_documentOptions?: DocumentOptions, opt_viewerOptions?: CoreViewerOptions): void;
159
+ /**
160
+ * Load an EPUB/WebPub publication.
161
+ */
162
+ loadPublication(pubUrl: string, opt_documentOptions?: DocumentOptions, opt_viewerOptions?: CoreViewerOptions): void;
163
+ /**
164
+ * Load an HTML or XML document, or an EPUB/WebPub publication.
165
+ */
166
+ private loadDocumentOrPublication;
167
+ /**
168
+ * Returns the current page progression of the viewer. If no document is
169
+ * loaded, returns null.
170
+ */
171
+ getCurrentPageProgression(): Constants.PageProgression | null;
172
+ private resolveNavigation;
173
+ /**
174
+ * Navigate to the specified page.
175
+ */
176
+ navigateToPage(nav: Navigation, opt_epage?: number): void;
177
+ /**
178
+ * Navigate to the specified internal URL.
179
+ */
180
+ navigateToInternalUrl(url: string): void;
181
+ /**
182
+ * Navigate to the specified position.
183
+ */
184
+ navigateToPosition(position: {
185
+ spineIndex: number;
186
+ pageIndex?: number;
187
+ offsetInItem?: number;
188
+ }): void;
189
+ /**
190
+ * @returns True if TOC is visible, false if hidden, null if TOC is unavailable
191
+ */
192
+ isTOCVisible(): boolean | null;
193
+ /**
194
+ * Show or hide TOC box
195
+ * @param opt_autohide If true, automatically hide when click TOC item
196
+ * @param opt_show If true show TOC, false hide TOC. If null or undefined toggle TOC.
197
+ */
198
+ showTOC(opt_show?: boolean | null, opt_autohide?: boolean): void;
199
+ /**
200
+ * Returns zoom factor corresponding to the specified zoom type.
201
+ */
202
+ queryZoomFactor(type: AdaptiveViewer.ZoomType): number;
203
+ getPageSizes(): {
204
+ width: number;
205
+ height: number;
206
+ }[];
207
+ /**
208
+ * Returns the current structure of the TOC once it has
209
+ * been shown, or the empty array if there is no TOC.
210
+ */
211
+ getTOC(): Toc.TOCItem[];
212
+ /**
213
+ * Returns metadata for the publication. Metadata is
214
+ * organized as an object of fully-qualified IRI properties
215
+ * containing arrays of metadata entries. The first element
216
+ * in the array is primary and should be used by default. Other
217
+ * entries may overload or refine that metadata.
218
+ */
219
+ getMetadata(): Epub.Meta;
220
+ /**
221
+ * Returns the cover for an EPUB publication, if specified.
222
+ */
223
+ getCover(): Epub.OPFItem | null;
224
+ }
225
+ /**
226
+ * @enum {string}
227
+ */
228
+ export declare enum Navigation {
229
+ PREVIOUS = "previous",
230
+ NEXT = "next",
231
+ LEFT = "left",
232
+ RIGHT = "right",
233
+ FIRST = "first",
234
+ LAST = "last",
235
+ EPAGE = "epage"
236
+ }
237
+ export type ZoomType = AdaptiveViewer.ZoomType;
238
+ export declare const ZoomType: typeof AdaptiveViewer.ZoomType;
239
+ export type PageViewMode = AdaptiveViewer.PageViewMode;
240
+ export declare const PageViewMode: typeof AdaptiveViewer.PageViewMode;