@likecoin/epub-ts 0.3.93

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 (51) hide show
  1. package/README.md +64 -0
  2. package/dist/annotations.d.ts +159 -0
  3. package/dist/archive.d.ts +82 -0
  4. package/dist/book.d.ts +228 -0
  5. package/dist/container.d.ts +18 -0
  6. package/dist/contents.d.ts +351 -0
  7. package/dist/displayoptions.d.ts +20 -0
  8. package/dist/epub.cjs +10 -0
  9. package/dist/epub.cjs.map +1 -0
  10. package/dist/epub.d.ts +17 -0
  11. package/dist/epub.js +9500 -0
  12. package/dist/epub.js.map +1 -0
  13. package/dist/epub.umd.js +10 -0
  14. package/dist/epub.umd.js.map +1 -0
  15. package/dist/epubcfi.d.ts +116 -0
  16. package/dist/index.d.ts +8 -0
  17. package/dist/layout.d.ts +77 -0
  18. package/dist/locations.d.ts +117 -0
  19. package/dist/managers/continuous/index.d.ts +46 -0
  20. package/dist/managers/default/index.d.ts +117 -0
  21. package/dist/managers/helpers/snap.d.ts +63 -0
  22. package/dist/managers/helpers/stage.d.ts +41 -0
  23. package/dist/managers/helpers/views.d.ts +27 -0
  24. package/dist/managers/views/iframe.d.ts +114 -0
  25. package/dist/managers/views/inline.d.ts +65 -0
  26. package/dist/mapping.d.ts +97 -0
  27. package/dist/marks-pane/index.d.ts +40 -0
  28. package/dist/navigation.d.ts +108 -0
  29. package/dist/packaging.d.ts +104 -0
  30. package/dist/pagelist.d.ts +80 -0
  31. package/dist/rendition.d.ts +293 -0
  32. package/dist/resources.d.ts +97 -0
  33. package/dist/section.d.ts +88 -0
  34. package/dist/spine.d.ts +79 -0
  35. package/dist/store.d.ts +122 -0
  36. package/dist/themes.d.ts +103 -0
  37. package/dist/types.d.ts +269 -0
  38. package/dist/utils/constants.d.ts +59 -0
  39. package/dist/utils/core.d.ts +337 -0
  40. package/dist/utils/event-emitter.d.ts +6 -0
  41. package/dist/utils/hook.d.ts +30 -0
  42. package/dist/utils/mime.d.ts +5 -0
  43. package/dist/utils/path-utils.d.ts +14 -0
  44. package/dist/utils/path.d.ts +55 -0
  45. package/dist/utils/queue.d.ts +66 -0
  46. package/dist/utils/replacements.d.ts +11 -0
  47. package/dist/utils/request.d.ts +2 -0
  48. package/dist/utils/scrolltype.d.ts +2 -0
  49. package/dist/utils/url.d.ts +42 -0
  50. package/license +28 -0
  51. package/package.json +55 -0
@@ -0,0 +1,293 @@
1
+ import { defer } from './utils/core';
2
+ import { default as Hook } from './utils/hook';
3
+ import { default as EpubCFI } from './epubcfi';
4
+ import { default as Queue } from './utils/queue';
5
+ import { default as Layout } from './layout';
6
+ import { default as Themes } from './themes';
7
+ import { default as Contents } from './contents';
8
+ import { default as Annotations } from './annotations';
9
+ import { IEventEmitter, RenditionOptions, Location, GlobalLayout, ViewLocation, SizeObject, PackagingMetadataObject } from './types';
10
+ import { default as Book } from './book';
11
+ import { default as Section } from './section';
12
+ import { default as IframeView } from './managers/views/iframe';
13
+ import { default as DefaultViewManager } from './managers/default/index';
14
+ import { default as ContinuousViewManager } from './managers/continuous/index';
15
+ /**
16
+ * Displays an Epub as a series of Views for each Section.
17
+ * Requires Manager and View class to handle specifics of rendering
18
+ * the section content.
19
+ * @class
20
+ * @param {Book} book
21
+ * @param {object} [options]
22
+ * @param {number} [options.width]
23
+ * @param {number} [options.height]
24
+ * @param {string} [options.ignoreClass] class for the cfi parser to ignore
25
+ * @param {string | function | object} [options.manager='default']
26
+ * @param {string | function} [options.view='iframe']
27
+ * @param {string} [options.layout] layout to force
28
+ * @param {string} [options.spread] force spread value
29
+ * @param {number} [options.minSpreadWidth] overridden by spread: none (never) / both (always)
30
+ * @param {string} [options.stylesheet] url of stylesheet to be injected
31
+ * @param {boolean} [options.resizeOnOrientationChange] false to disable orientation events
32
+ * @param {string} [options.script] url of script to be injected
33
+ * @param {boolean | object} [options.snap=false] use snap scrolling
34
+ * @param {string} [options.defaultDirection='ltr'] default text direction
35
+ * @param {boolean} [options.allowScriptedContent=false] enable running scripts in content
36
+ * @param {boolean} [options.allowPopups=false] enable opening popup in content
37
+ */
38
+ interface RenditionHooks {
39
+ display: Hook;
40
+ serialize: Hook;
41
+ content: Hook;
42
+ unloaded: Hook;
43
+ layout: Hook;
44
+ render: Hook;
45
+ show: Hook;
46
+ }
47
+ declare class Rendition implements IEventEmitter {
48
+ settings: RenditionOptions & Record<string, any>;
49
+ book: Book | undefined;
50
+ hooks: RenditionHooks;
51
+ themes: Themes;
52
+ annotations: Annotations;
53
+ epubcfi: EpubCFI;
54
+ q: Queue;
55
+ location: Location | undefined;
56
+ starting: defer;
57
+ started: Promise<void>;
58
+ manager: DefaultViewManager | undefined;
59
+ ViewManager: typeof DefaultViewManager | typeof ContinuousViewManager | Function;
60
+ View: typeof IframeView | Function;
61
+ _layout: Layout | undefined;
62
+ displaying: defer | undefined;
63
+ on: IEventEmitter["on"];
64
+ off: IEventEmitter["off"];
65
+ emit: IEventEmitter["emit"];
66
+ constructor(book: Book, options?: RenditionOptions);
67
+ /**
68
+ * Set the manager function
69
+ * @param {function} manager
70
+ */
71
+ setManager(manager: DefaultViewManager): void;
72
+ /**
73
+ * Require the manager from passed string, or as a class function
74
+ * @param {string|object} manager [description]
75
+ * @return {method}
76
+ */
77
+ requireManager(manager: string | Function | object): typeof DefaultViewManager | typeof ContinuousViewManager | Function;
78
+ /**
79
+ * Require the view from passed string, or as a class function
80
+ * @param {string|object} view
81
+ * @return {view}
82
+ */
83
+ requireView(view: string | Function | object): typeof IframeView | Function;
84
+ /**
85
+ * Start the rendering
86
+ * @return {Promise} rendering has started
87
+ */
88
+ start(): void;
89
+ /**
90
+ * Call to attach the container to an element in the dom
91
+ * Container must be attached before rendering can begin
92
+ * @param {element} element to attach to
93
+ * @return {Promise}
94
+ */
95
+ attachTo(element: HTMLElement | string): Promise<void>;
96
+ /**
97
+ * Display a point in the book
98
+ * The request will be added to the rendering Queue,
99
+ * so it will wait until book is opened, rendering started
100
+ * and all other rendering tasks have finished to be called.
101
+ * @param {string} target Url or EpubCFI
102
+ * @return {Promise}
103
+ */
104
+ display(target?: string | number): Promise<Section>;
105
+ /**
106
+ * Tells the manager what to display immediately
107
+ * @private
108
+ * @param {string} target Url or EpubCFI
109
+ * @return {Promise}
110
+ */
111
+ _display(target?: string | number): Promise<Section> | undefined;
112
+ /**
113
+ * Report what section has been displayed
114
+ * @private
115
+ * @param {*} view
116
+ */
117
+ afterDisplayed(view: any): void;
118
+ /**
119
+ * Report what has been removed
120
+ * @private
121
+ * @param {*} view
122
+ */
123
+ afterRemoved(view: any): void;
124
+ /**
125
+ * Report resize events and display the last seen location
126
+ * @private
127
+ */
128
+ onResized(size: SizeObject, epubcfi?: string): void;
129
+ /**
130
+ * Report orientation events and display the last seen location
131
+ * @private
132
+ */
133
+ onOrientationChange(orientation: string): void;
134
+ /**
135
+ * Move the Rendition to a specific offset
136
+ * Usually you would be better off calling display()
137
+ * @param {object} offset
138
+ */
139
+ moveTo(offset: {
140
+ left: number;
141
+ top: number;
142
+ }): void;
143
+ /**
144
+ * Trigger a resize of the views
145
+ * @param {number} [width]
146
+ * @param {number} [height]
147
+ * @param {string} [epubcfi] (optional)
148
+ */
149
+ resize(width?: number, height?: number, epubcfi?: string): void;
150
+ /**
151
+ * Clear all rendered views
152
+ */
153
+ clear(): void;
154
+ /**
155
+ * Go to the next "page" in the rendition
156
+ * @return {Promise}
157
+ */
158
+ next(): Promise<any>;
159
+ /**
160
+ * Go to the previous "page" in the rendition
161
+ * @return {Promise}
162
+ */
163
+ prev(): Promise<any>;
164
+ /**
165
+ * Determine the Layout properties from metadata and settings
166
+ * @private
167
+ * @param {object} metadata
168
+ * @return {object} properties
169
+ */
170
+ determineLayoutProperties(metadata: PackagingMetadataObject & Record<string, any>): GlobalLayout;
171
+ /**
172
+ * Adjust the flow of the rendition to paginated or scrolled
173
+ * (scrolled-continuous vs scrolled-doc are handled by different view managers)
174
+ * @param {string} flow
175
+ */
176
+ flow(flow: string): void;
177
+ /**
178
+ * Adjust the layout of the rendition to reflowable or pre-paginated
179
+ * @param {object} settings
180
+ */
181
+ layout(settings?: GlobalLayout): Layout | undefined;
182
+ /**
183
+ * Adjust if the rendition uses spreads
184
+ * @param {string} spread none | auto (TODO: implement landscape, portrait, both)
185
+ * @param {int} [min] min width to use spreads at
186
+ */
187
+ spread(spread: string, min?: number): void;
188
+ /**
189
+ * Adjust the direction of the rendition
190
+ * @param {string} dir
191
+ */
192
+ direction(dir?: string): void;
193
+ /**
194
+ * Report the current location
195
+ * @fires relocated
196
+ * @fires locationChanged
197
+ */
198
+ reportLocation(): Promise<void>;
199
+ /**
200
+ * Get the Current Location object
201
+ * @return {displayedLocation | promise} location (may be a promise)
202
+ */
203
+ currentLocation(): Location | undefined;
204
+ /**
205
+ * Creates a Rendition#locationRange from location
206
+ * passed by the Manager
207
+ * @returns {displayedLocation}
208
+ * @private
209
+ */
210
+ located(location: ViewLocation[]): Location | undefined;
211
+ /**
212
+ * Remove and Clean Up the Rendition
213
+ */
214
+ destroy(): void;
215
+ /**
216
+ * Pass the events from a view's Contents
217
+ * @private
218
+ * @param {Contents} view contents
219
+ */
220
+ passEvents(contents: Contents): void;
221
+ /**
222
+ * Emit events passed by a view
223
+ * @private
224
+ * @param {event} e
225
+ */
226
+ triggerViewEvent(e: Event, contents: Contents): void;
227
+ /**
228
+ * Emit a selection event's CFI Range passed from a a view
229
+ * @private
230
+ * @param {string} cfirange
231
+ */
232
+ triggerSelectedEvent(cfirange: string, contents: Contents): void;
233
+ /**
234
+ * Emit a markClicked event with the cfiRange and data from a mark
235
+ * @private
236
+ * @param {EpubCFI} cfirange
237
+ */
238
+ triggerMarkEvent(cfiRange: string, data: object, contents: Contents): void;
239
+ /**
240
+ * Get a Range from a Visible CFI
241
+ * @param {string} cfi EpubCfi String
242
+ * @param {string} ignoreClass
243
+ * @return {range}
244
+ */
245
+ getRange(cfi: string, ignoreClass?: string): Range | undefined;
246
+ /**
247
+ * Hook to adjust images to fit in columns
248
+ * @param {Contents} contents
249
+ * @private
250
+ */
251
+ adjustImages(contents: Contents): Promise<void>;
252
+ /**
253
+ * Get the Contents object of each rendered view
254
+ * @returns {Contents[]}
255
+ */
256
+ getContents(): Contents[];
257
+ /**
258
+ * Get the views member from the manager
259
+ * @returns {Views}
260
+ */
261
+ views(): any;
262
+ /**
263
+ * Hook to handle link clicks in rendered content
264
+ * @param {Contents} contents
265
+ * @private
266
+ */
267
+ handleLinks(contents: Contents): void;
268
+ /**
269
+ * Hook to handle injecting stylesheet before
270
+ * a Section is serialized
271
+ * @param {document} doc
272
+ * @param {Section} section
273
+ * @private
274
+ */
275
+ injectStylesheet(doc: Document, _section: Section): void;
276
+ /**
277
+ * Hook to handle injecting scripts before
278
+ * a Section is serialized
279
+ * @param {document} doc
280
+ * @param {Section} section
281
+ * @private
282
+ */
283
+ injectScript(doc: Document, _section: Section): void;
284
+ /**
285
+ * Hook to handle the document identifier before
286
+ * a Section is serialized
287
+ * @param {document} doc
288
+ * @param {Section} section
289
+ * @private
290
+ */
291
+ injectIdentifier(doc: Document, _section: Section): void;
292
+ }
293
+ export default Rendition;
@@ -0,0 +1,97 @@
1
+ import { PackagingManifestObject, PackagingManifestItem, RequestFunction } from './types';
2
+ import { default as Archive } from './archive';
3
+ /**
4
+ * Handle Package Resources
5
+ * @class
6
+ * @param {Manifest} manifest
7
+ * @param {object} [options]
8
+ * @param {string} [options.replacements="base64"]
9
+ * @param {Archive} [options.archive]
10
+ * @param {method} [options.resolver]
11
+ */
12
+ declare class Resources {
13
+ settings: {
14
+ replacements: string;
15
+ archive: Archive;
16
+ resolver: (href: string, absolute?: boolean) => string;
17
+ request: RequestFunction;
18
+ };
19
+ manifest: PackagingManifestObject;
20
+ resources: PackagingManifestItem[];
21
+ replacementUrls: string[];
22
+ html: PackagingManifestItem[];
23
+ assets: PackagingManifestItem[];
24
+ css: PackagingManifestItem[];
25
+ urls: string[];
26
+ cssUrls: string[];
27
+ constructor(manifest: PackagingManifestObject, options?: {
28
+ replacements?: string;
29
+ archive?: Archive;
30
+ resolver?: (href: string, absolute?: boolean) => string;
31
+ request?: RequestFunction;
32
+ });
33
+ /**
34
+ * Process resources
35
+ * @param {Manifest} manifest
36
+ */
37
+ process(manifest: PackagingManifestObject): void;
38
+ /**
39
+ * Split resources by type
40
+ * @private
41
+ */
42
+ split(): void;
43
+ /**
44
+ * Convert split resources into Urls
45
+ * @private
46
+ */
47
+ splitUrls(): void;
48
+ /**
49
+ * Create a url to a resource
50
+ * @param {string} url
51
+ * @return {Promise<string>} Promise resolves with url string
52
+ */
53
+ createUrl(url: string): Promise<string>;
54
+ /**
55
+ * Create blob urls for all the assets
56
+ * @return {Promise} returns replacement urls
57
+ */
58
+ replacements(): Promise<string[]>;
59
+ /**
60
+ * Replace URLs in CSS resources
61
+ * @private
62
+ * @param {Archive} [archive]
63
+ * @param {method} [resolver]
64
+ * @return {Promise}
65
+ */
66
+ replaceCss(archive?: Archive, resolver?: (href: string, absolute?: boolean) => string): Promise<(string | void)[]>;
67
+ /**
68
+ * Create a new CSS file with the replaced URLs
69
+ * @private
70
+ * @param {string} href the original css file
71
+ * @return {Promise} returns a BlobUrl to the new CSS file or a data url
72
+ */
73
+ createCssFile(href: string): Promise<string | void>;
74
+ /**
75
+ * Resolve all resources URLs relative to an absolute URL
76
+ * @param {string} absolute to be resolved to
77
+ * @param {resolver} [resolver]
78
+ * @return {string[]} array with relative Urls
79
+ */
80
+ relativeTo(absolute: string, resolver?: (href: string, absolute?: boolean) => string): string[];
81
+ /**
82
+ * Get a URL for a resource
83
+ * @param {string} path
84
+ * @return {string} url
85
+ */
86
+ get(path: string): Promise<string> | undefined;
87
+ /**
88
+ * Substitute urls in content, with replacements,
89
+ * relative to a url if provided
90
+ * @param {string} content
91
+ * @param {string} [url] url to resolve to
92
+ * @return {string} content with urls substituted
93
+ */
94
+ substitute(content: string, url?: string): string;
95
+ destroy(): void;
96
+ }
97
+ export default Resources;
@@ -0,0 +1,88 @@
1
+ import { default as Hook } from './utils/hook';
2
+ import { SpineItem, GlobalLayout, SearchResult, RequestFunction } from './types';
3
+ /**
4
+ * Represents a Section of the Book
5
+ *
6
+ * In most books this is equivalent to a Chapter
7
+ * @param {object} item The spine item representing the section
8
+ * @param {object} hooks hooks for serialize and content
9
+ */
10
+ declare class Section {
11
+ idref: string;
12
+ linear: boolean;
13
+ properties: string[];
14
+ index: number;
15
+ href: string;
16
+ url: string;
17
+ canonical: string;
18
+ next: () => SpineItem | undefined;
19
+ prev: () => SpineItem | undefined;
20
+ cfiBase: string;
21
+ hooks: {
22
+ serialize: Hook;
23
+ content: Hook;
24
+ };
25
+ document: Document | undefined;
26
+ contents: Element | undefined;
27
+ output: string | undefined;
28
+ request: RequestFunction;
29
+ constructor(item: SpineItem, hooks?: {
30
+ serialize: Hook;
31
+ content: Hook;
32
+ });
33
+ /**
34
+ * Load the section from its url
35
+ * @param {method} [_request] a request method to use for loading
36
+ * @return {document} a promise with the xml document
37
+ */
38
+ load(_request?: RequestFunction): Promise<Element>;
39
+ /**
40
+ * Adds a base tag for resolving urls in the section
41
+ * @private
42
+ */
43
+ base(): void;
44
+ /**
45
+ * Render the contents of a section
46
+ * @param {method} [_request] a request method to use for loading
47
+ * @return {string} output a serialized XML Document
48
+ */
49
+ render(_request?: RequestFunction): Promise<string>;
50
+ /**
51
+ * Find a string in a section
52
+ * @param {string} _query The query string to find
53
+ * @return {object[]} A list of matches, with form {cfi, excerpt}
54
+ */
55
+ find(_query: string): SearchResult[];
56
+ /**
57
+ * Search a string in multiple sequential Element of the section. If the document.createTreeWalker api is missed(eg: IE8), use `find` as a fallback.
58
+ * @param {string} _query The query string to search
59
+ * @param {int} maxSeqEle The maximum number of Element that are combined for search, default value is 5.
60
+ * @return {object[]} A list of matches, with form {cfi, excerpt}
61
+ */
62
+ search(_query: string, maxSeqEle?: number): SearchResult[];
63
+ /**
64
+ * Reconciles the current chapters layout properties with
65
+ * the global layout properties.
66
+ * @param {object} globalLayout The global layout settings object, chapter properties string
67
+ * @return {object} layoutProperties Object with layout properties
68
+ */
69
+ reconcileLayoutSettings(globalLayout: GlobalLayout): Record<string, string>;
70
+ /**
71
+ * Get a CFI from a Range in the Section
72
+ * @param {range} _range
73
+ * @return {string} cfi an EpubCFI string
74
+ */
75
+ cfiFromRange(_range: Range): string;
76
+ /**
77
+ * Get a CFI from an Element in the Section
78
+ * @param {element} el
79
+ * @return {string} cfi an EpubCFI string
80
+ */
81
+ cfiFromElement(el: Element): string;
82
+ /**
83
+ * Unload the section document
84
+ */
85
+ unload(): void;
86
+ destroy(): void;
87
+ }
88
+ export default Section;
@@ -0,0 +1,79 @@
1
+ import { default as EpubCFI } from './epubcfi';
2
+ import { default as Hook } from './utils/hook';
3
+ import { default as Section } from './section';
4
+ import { PackagingManifestObject, PackagingObject, SpineItem } from './types';
5
+ /**
6
+ * A collection of Spine Items
7
+ */
8
+ declare class Spine {
9
+ spineItems: Section[];
10
+ spineByHref: Record<string, number>;
11
+ spineById: Record<string, number>;
12
+ hooks: {
13
+ serialize: Hook;
14
+ content: Hook;
15
+ };
16
+ epubcfi: EpubCFI;
17
+ loaded: boolean;
18
+ items: SpineItem[];
19
+ manifest: PackagingManifestObject;
20
+ spineNodeIndex: number;
21
+ baseUrl: string;
22
+ length: number;
23
+ constructor();
24
+ /**
25
+ * Unpack items from a opf into spine items
26
+ * @param {Packaging} _package
27
+ * @param {method} resolver URL resolver
28
+ * @param {method} canonical Resolve canonical url
29
+ */
30
+ unpack(_package: PackagingObject & {
31
+ baseUrl?: string;
32
+ basePath?: string;
33
+ }, resolver: (href: string, absolute?: boolean) => string, canonical: (href: string) => string): void;
34
+ /**
35
+ * Get an item from the spine
36
+ * @param {string|number} [target]
37
+ * @return {Section} section
38
+ * @example spine.get();
39
+ * @example spine.get(1);
40
+ * @example spine.get("chap1.html");
41
+ * @example spine.get("#id1234");
42
+ */
43
+ get(target?: string | number): Section | null;
44
+ /**
45
+ * Append a Section to the Spine
46
+ * @private
47
+ * @param {Section} section
48
+ */
49
+ append(section: Section): number;
50
+ /**
51
+ * Prepend a Section to the Spine
52
+ * @private
53
+ * @param {Section} section
54
+ */
55
+ prepend(section: Section): number;
56
+ /**
57
+ * Remove a Section from the Spine
58
+ * @private
59
+ * @param {Section} section
60
+ */
61
+ remove(section: Section): Section[] | undefined;
62
+ /**
63
+ * Loop over the Sections in the Spine
64
+ * @return {method} forEach
65
+ */
66
+ each(...args: any[]): void;
67
+ /**
68
+ * Find the first Section in the Spine
69
+ * @return {Section} first section
70
+ */
71
+ first(): Section | undefined;
72
+ /**
73
+ * Find the last Section in the Spine
74
+ * @return {Section} last section
75
+ */
76
+ last(): Section | undefined;
77
+ destroy(): void;
78
+ }
79
+ export default Spine;
@@ -0,0 +1,122 @@
1
+ import { IEventEmitter, RequestFunction } from './types';
2
+ /**
3
+ * Handles saving and requesting files from local storage
4
+ * @class
5
+ * @param {string} name This should be the name of the application for modals
6
+ * @param {function} [requester]
7
+ * @param {function} [resolver]
8
+ */
9
+ declare class Store implements IEventEmitter {
10
+ on: (type: string, fn: (...args: any[]) => void) => this;
11
+ off: (type: string, fn?: (...args: any[]) => void) => this;
12
+ emit: (type: string, ...args: any[]) => void;
13
+ urlCache: Record<string, string>;
14
+ storage: any;
15
+ name: string;
16
+ requester: RequestFunction;
17
+ resolver: (href: string) => string;
18
+ online: boolean;
19
+ _status: ((event: Event) => void) | undefined;
20
+ constructor(name: string, requester?: RequestFunction, resolver?: (href: string) => string);
21
+ /**
22
+ * Checks to see if localForage exists in global namspace,
23
+ * Requires localForage if it isn't there
24
+ * @private
25
+ */
26
+ checkRequirements(): void;
27
+ /**
28
+ * Add online and offline event listeners
29
+ * @private
30
+ */
31
+ addListeners(): void;
32
+ /**
33
+ * Remove online and offline event listeners
34
+ * @private
35
+ */
36
+ removeListeners(): void;
37
+ /**
38
+ * Update the online / offline status
39
+ * @private
40
+ */
41
+ status(_event: Event): void;
42
+ /**
43
+ * Add all of a book resources to the store
44
+ * @param {Resources} resources book resources
45
+ * @param {boolean} [force] force resaving resources
46
+ * @return {Promise<object>} store objects
47
+ */
48
+ add(resources: {
49
+ resources: Array<{
50
+ href: string;
51
+ }>;
52
+ }, force?: boolean): Promise<any[]>;
53
+ /**
54
+ * Put binary data from a url to storage
55
+ * @param {string} url a url to request from storage
56
+ * @param {boolean} [withCredentials]
57
+ * @param {object} [headers]
58
+ * @return {Promise<Blob>}
59
+ */
60
+ put(url: string, withCredentials?: boolean, headers?: Record<string, string>): Promise<any>;
61
+ /**
62
+ * Request a url
63
+ * @param {string} url a url to request from storage
64
+ * @param {string} [type] specify the type of the returned result
65
+ * @param {boolean} [withCredentials]
66
+ * @param {object} [headers]
67
+ * @return {Promise<Blob | string | JSON | Document | XMLDocument>}
68
+ */
69
+ request(url: string, type?: string, withCredentials?: boolean, headers?: Record<string, string>): Promise<any>;
70
+ /**
71
+ * Request a url from storage
72
+ * @param {string} url a url to request from storage
73
+ * @param {string} [type] specify the type of the returned result
74
+ * @return {Promise<Blob | string | JSON | Document | XMLDocument>}
75
+ */
76
+ retrieve(url: string, type?: string): Promise<any>;
77
+ /**
78
+ * Handle the response from request
79
+ * @private
80
+ * @param {any} response
81
+ * @param {string} [type]
82
+ * @return {any} the parsed result
83
+ */
84
+ handleResponse(response: any, type?: string): any;
85
+ /**
86
+ * Get a Blob from Storage by Url
87
+ * @param {string} url
88
+ * @param {string} [mimeType]
89
+ * @return {Blob}
90
+ */
91
+ getBlob(url: string, mimeType?: string): Promise<Blob | undefined>;
92
+ /**
93
+ * Get Text from Storage by Url
94
+ * @param {string} url
95
+ * @param {string} [mimeType]
96
+ * @return {string}
97
+ */
98
+ getText(url: string, mimeType?: string): Promise<any>;
99
+ /**
100
+ * Get a base64 encoded result from Storage by Url
101
+ * @param {string} url
102
+ * @param {string} [mimeType]
103
+ * @return {string} base64 encoded
104
+ */
105
+ getBase64(url: string, mimeType?: string): Promise<any>;
106
+ /**
107
+ * Create a Url from a stored item
108
+ * @param {string} url
109
+ * @param {object} [options.base64] use base64 encoding or blob url
110
+ * @return {Promise} url promise with Url string
111
+ */
112
+ createUrl(url: string, options?: {
113
+ base64?: boolean;
114
+ }): Promise<string>;
115
+ /**
116
+ * Revoke Temp Url for a archive item
117
+ * @param {string} url url of the item in the store
118
+ */
119
+ revokeUrl(url: string): void;
120
+ destroy(): void;
121
+ }
122
+ export default Store;