@readium/shared 2.2.0-beta.2 → 2.2.0
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/index.js +249 -252
- package/dist/index.umd.cjs +3 -3
- package/package.json +1 -1
- package/src/fetcher/Fetcher.ts +2 -2
- package/src/fetcher/HttpFetcher.ts +3 -3
- package/src/fetcher/Resource.ts +1 -1
- package/src/fetcher/index.ts +3 -3
- package/src/index.ts +4 -4
- package/src/opds/Availability.ts +1 -1
- package/src/opds/Copies.ts +1 -1
- package/src/opds/Holds.ts +1 -1
- package/src/opds/Price.ts +1 -1
- package/src/opds/index.ts +5 -5
- package/src/publication/BelongsTo.ts +1 -1
- package/src/publication/Contributor.ts +4 -4
- package/src/publication/GuidedNavigation.ts +19 -19
- package/src/publication/Link.ts +6 -6
- package/src/publication/Locator.ts +1 -1
- package/src/publication/LocatorCollection.ts +4 -4
- package/src/publication/Manifest.ts +6 -6
- package/src/publication/Metadata.ts +13 -13
- package/src/publication/Publication.ts +12 -14
- package/src/publication/PublicationCollection.ts +1 -1
- package/src/publication/ReadingProgression.ts +1 -1
- package/src/publication/Subject.ts +2 -2
- package/src/publication/accessibility/AccessibilityMetadataDisplayGuide.ts +20 -20
- package/src/publication/accessibility/Localization.ts +15 -15
- package/src/publication/accessibility/index.ts +3 -3
- package/src/publication/encryption/Properties.ts +2 -2
- package/src/publication/encryption/index.ts +2 -2
- package/src/publication/epub/Metadata.ts +3 -3
- package/src/publication/epub/Properties.ts +1 -1
- package/src/publication/epub/Publication.ts +2 -2
- package/src/publication/epub/index.ts +4 -4
- package/src/publication/html/DomRange.ts +1 -1
- package/src/publication/html/DomRangePoint.ts +1 -1
- package/src/publication/html/Locations.ts +3 -3
- package/src/publication/html/index.ts +3 -3
- package/src/publication/index.ts +24 -24
- package/src/publication/opds/Properties.ts +4 -4
- package/src/publication/opds/Publication.ts +2 -2
- package/src/publication/opds/index.ts +2 -2
- package/src/publication/services/content/Content.ts +3 -3
- package/src/publication/services/content/ContentTokenizer.ts +6 -6
- package/src/publication/services/content/Iterator.ts +2 -2
- package/src/publication/services/content/element/attributes.ts +2 -2
- package/src/publication/services/content/element/element.ts +5 -5
- package/src/publication/services/content/element/index.ts +3 -3
- package/src/publication/services/content/index.ts +5 -5
- package/src/publication/services/content/iterators/HTMLResourceContentIterator.ts +8 -8
- package/src/publication/services/content/iterators/PDFTextContentIterator.ts +21 -21
- package/src/publication/services/content/iterators/PublicationContentIterator.ts +6 -6
- package/src/publication/services/content/iterators/helpers.ts +1 -1
- package/src/publication/services/content/iterators/index.ts +3 -3
- package/src/publication/services/index.ts +2 -2
- package/src/publication/services/timeline/Timeline.ts +53 -44
- package/src/publication/services/timeline/index.ts +2 -2
- package/src/util/index.ts +5 -5
- package/src/util/mediatype/index.ts +1 -1
- package/src/util/tokenizer/TextTokenizer.ts +5 -5
- package/src/util/tokenizer/index.ts +2 -2
- package/types/src/fetcher/Fetcher.d.ts +2 -2
- package/types/src/fetcher/HttpFetcher.d.ts +3 -3
- package/types/src/fetcher/Resource.d.ts +1 -1
- package/types/src/fetcher/index.d.ts +3 -3
- package/types/src/index.d.ts +4 -4
- package/types/src/opds/index.d.ts +5 -5
- package/types/src/publication/BelongsTo.d.ts +1 -1
- package/types/src/publication/Contributor.d.ts +3 -3
- package/types/src/publication/GuidedNavigation.d.ts +1 -1
- package/types/src/publication/Link.d.ts +3 -3
- package/types/src/publication/LocatorCollection.d.ts +3 -3
- package/types/src/publication/Manifest.d.ts +4 -4
- package/types/src/publication/Metadata.d.ts +10 -10
- package/types/src/publication/Publication.d.ts +11 -12
- package/types/src/publication/PublicationCollection.d.ts +1 -1
- package/types/src/publication/ReadingProgression.d.ts +1 -1
- package/types/src/publication/Subject.d.ts +2 -2
- package/types/src/publication/accessibility/AccessibilityMetadataDisplayGuide.d.ts +2 -2
- package/types/src/publication/accessibility/index.d.ts +3 -3
- package/types/src/publication/encryption/Properties.d.ts +1 -1
- package/types/src/publication/encryption/index.d.ts +2 -2
- package/types/src/publication/epub/Metadata.d.ts +1 -1
- package/types/src/publication/epub/Publication.d.ts +1 -1
- package/types/src/publication/epub/index.d.ts +4 -4
- package/types/src/publication/html/DomRange.d.ts +1 -1
- package/types/src/publication/html/Locations.d.ts +1 -1
- package/types/src/publication/html/index.d.ts +3 -3
- package/types/src/publication/index.d.ts +24 -24
- package/types/src/publication/opds/Properties.d.ts +2 -2
- package/types/src/publication/opds/Publication.d.ts +1 -1
- package/types/src/publication/opds/index.d.ts +2 -2
- package/types/src/publication/services/content/Content.d.ts +2 -2
- package/types/src/publication/services/content/ContentTokenizer.d.ts +2 -2
- package/types/src/publication/services/content/Iterator.d.ts +1 -1
- package/types/src/publication/services/content/element/attributes.d.ts +1 -1
- package/types/src/publication/services/content/element/element.d.ts +4 -4
- package/types/src/publication/services/content/element/index.d.ts +3 -3
- package/types/src/publication/services/content/index.d.ts +5 -5
- package/types/src/publication/services/content/iterators/HTMLResourceContentIterator.d.ts +4 -4
- package/types/src/publication/services/content/iterators/PDFTextContentIterator.d.ts +3 -3
- package/types/src/publication/services/content/iterators/PublicationContentIterator.d.ts +5 -5
- package/types/src/publication/services/content/iterators/helpers.d.ts +1 -1
- package/types/src/publication/services/content/iterators/index.d.ts +3 -3
- package/types/src/publication/services/index.d.ts +2 -2
- package/types/src/publication/services/timeline/Timeline.d.ts +9 -11
- package/types/src/publication/services/timeline/index.d.ts +2 -2
- package/types/src/util/index.d.ts +5 -5
- package/types/src/util/mediatype/index.d.ts +1 -1
- package/types/src/util/tokenizer/TextTokenizer.d.ts +2 -2
- package/types/src/util/tokenizer/index.d.ts +2 -2
- package/types/test/AltIdentifier.test.d.ts +0 -1
- package/types/test/Contributor.test.d.ts +0 -1
- package/types/test/GuidedNavigation.test.d.ts +0 -1
- package/types/test/Link.test.d.ts +0 -1
- package/types/test/LocalizedString.test.d.ts +0 -1
- package/types/test/Locator.test.d.ts +0 -1
- package/types/test/LocatorCollection.test.d.ts +0 -1
- package/types/test/Manifest.test.d.ts +0 -1
- package/types/test/Metadata.test.d.ts +0 -1
- package/types/test/Properties.test.d.ts +0 -1
- package/types/test/Publication.test.d.ts +0 -1
- package/types/test/PublicationCollection.test.d.ts +0 -1
- package/types/test/Subject.test.d.ts +0 -1
- package/types/test/TDM.test.d.ts +0 -1
- package/types/test/Timeline.test.d.ts +0 -1
- package/types/test/accessibility/Accessibility.test.d.ts +0 -1
- package/types/test/accessibility/AccessibilityMetadataDisplayGuide.test.d.ts +0 -1
- package/types/test/accessibility/Localization.test.d.ts +0 -1
- package/types/test/encryption/Encryption.test.d.ts +0 -1
- package/types/test/encryption/Properties.test.d.ts +0 -1
- package/types/test/epub/MediaOverlay.test.d.ts +0 -1
- package/types/test/epub/Metadata.test.d.ts +0 -1
- package/types/test/epub/PropertiesTest.test.d.ts +0 -1
- package/types/test/epub/PublicationTest.test.d.ts +0 -1
- package/types/test/html/DomRange.test.d.ts +0 -1
- package/types/test/html/Locator.test.d.ts +0 -1
- package/types/test/opds/PropertiesTest.test.d.ts +0 -1
- package/types/test/opds/PublicationTest.test.d.ts +0 -1
- package/types/test/util/URITemplate.test.d.ts +0 -1
- package/types/test/util/mediatype/MediaType.test.d.ts +0 -1
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { Link, Links } from "../../Link";
|
|
2
|
-
import { Locator } from "../../Locator";
|
|
3
|
-
import { TimelineItem } from "./TimelineItem";
|
|
1
|
+
import { Link, Links } from "../../Link.ts";
|
|
2
|
+
import { Locator } from "../../Locator.ts";
|
|
3
|
+
import { TimelineItem } from "./TimelineItem.ts";
|
|
4
4
|
|
|
5
5
|
interface PublicationLike {
|
|
6
6
|
toc?: Links;
|
|
@@ -30,6 +30,8 @@ export class Timeline {
|
|
|
30
30
|
private _depth: number | undefined;
|
|
31
31
|
private _items: TimelineItem[] | undefined;
|
|
32
32
|
private _flat: TimelineItem[] | undefined;
|
|
33
|
+
/** Populated when depth is set; maps cloned items from trimToDepth back to their Links. */
|
|
34
|
+
private _trimmedLinkMap: Map<TimelineItem, Link> = new Map();
|
|
33
35
|
|
|
34
36
|
constructor(items: TimelineItem[], linkMap: Map<TimelineItem, Link>) {
|
|
35
37
|
this._allItems = items;
|
|
@@ -60,8 +62,7 @@ export class Timeline {
|
|
|
60
62
|
children: tocChildren.length > 0 ? tocChildren : undefined,
|
|
61
63
|
};
|
|
62
64
|
|
|
63
|
-
|
|
64
|
-
linkMap.set(item, tocLink ?? ro);
|
|
65
|
+
linkMap.set(item, ro);
|
|
65
66
|
items.push(item);
|
|
66
67
|
}
|
|
67
68
|
|
|
@@ -87,9 +88,12 @@ export class Timeline {
|
|
|
87
88
|
/** Top-level timeline items. Cached; invalidated when `depth` changes. */
|
|
88
89
|
get items(): TimelineItem[] {
|
|
89
90
|
if (!this._items) {
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
91
|
+
if (this._depth !== undefined) {
|
|
92
|
+
this._trimmedLinkMap = new Map();
|
|
93
|
+
this._items = Timeline.trimToDepth(this._allItems, this._depth, this.linkMap, this._trimmedLinkMap);
|
|
94
|
+
} else {
|
|
95
|
+
this._items = this._allItems;
|
|
96
|
+
}
|
|
93
97
|
}
|
|
94
98
|
return this._items;
|
|
95
99
|
}
|
|
@@ -101,8 +105,13 @@ export class Timeline {
|
|
|
101
105
|
let match: TimelineItem | undefined;
|
|
102
106
|
|
|
103
107
|
if (time !== undefined) {
|
|
108
|
+
let bestTime = -Infinity;
|
|
104
109
|
for (const item of this.flat) {
|
|
105
|
-
|
|
110
|
+
const t = this.itemStartTime(item, href);
|
|
111
|
+
if (t !== undefined && t <= time && t > bestTime) {
|
|
112
|
+
bestTime = t;
|
|
113
|
+
match = item;
|
|
114
|
+
}
|
|
106
115
|
}
|
|
107
116
|
}
|
|
108
117
|
|
|
@@ -137,10 +146,13 @@ export class Timeline {
|
|
|
137
146
|
if (duration !== undefined) {
|
|
138
147
|
const time = progression * duration;
|
|
139
148
|
let match: TimelineItem = item;
|
|
149
|
+
let bestTime = -Infinity;
|
|
140
150
|
for (const child of item.children) {
|
|
141
151
|
const t = this.timeFromItem(child);
|
|
142
|
-
if (t
|
|
143
|
-
|
|
152
|
+
if (t !== undefined && t <= time && t > bestTime) {
|
|
153
|
+
bestTime = t;
|
|
154
|
+
match = child;
|
|
155
|
+
}
|
|
144
156
|
}
|
|
145
157
|
return match;
|
|
146
158
|
}
|
|
@@ -154,7 +166,7 @@ export class Timeline {
|
|
|
154
166
|
}
|
|
155
167
|
|
|
156
168
|
linkFor(item: TimelineItem): Link | undefined {
|
|
157
|
-
return this.linkMap.get(item);
|
|
169
|
+
return this.linkMap.get(item) ?? this._trimmedLinkMap.get(item);
|
|
158
170
|
}
|
|
159
171
|
|
|
160
172
|
private get flat(): TimelineItem[] {
|
|
@@ -184,19 +196,6 @@ export class Timeline {
|
|
|
184
196
|
return undefined;
|
|
185
197
|
}
|
|
186
198
|
|
|
187
|
-
/**
|
|
188
|
-
* Return the most relevant TOC Link for `bare` (used for `linkFor`).
|
|
189
|
-
* Prefers a start-of-resource entry; falls back to the first fragment entry.
|
|
190
|
-
*/
|
|
191
|
-
private static findTocLink(
|
|
192
|
-
tocLinks: Link[],
|
|
193
|
-
bare: string,
|
|
194
|
-
maxDepth: number | undefined,
|
|
195
|
-
): Link | undefined {
|
|
196
|
-
const { atStart, fragments } = Timeline.collectTocCandidates(tocLinks, bare, maxDepth, 1);
|
|
197
|
-
return atStart[0] ?? fragments[0];
|
|
198
|
-
}
|
|
199
|
-
|
|
200
199
|
/**
|
|
201
200
|
* Collect all TOC entries that reference `bare` as flat children, walking
|
|
202
201
|
* up to `maxDepth` levels deep. Start-of-resource entries (#t=0 or no
|
|
@@ -272,25 +271,38 @@ export class Timeline {
|
|
|
272
271
|
|
|
273
272
|
/**
|
|
274
273
|
* A TOC href points to the start of its resource when it has no fragment,
|
|
275
|
-
* or when the fragment
|
|
274
|
+
* or when the fragment contains a parsable `t=` value of 0 (audio: explicit
|
|
275
|
+
* beginning of the file). Accepts decimals and extra params, e.g. `t=0.0`
|
|
276
|
+
* or `foo=bar&t=0`.
|
|
276
277
|
*/
|
|
277
278
|
private static isStartOfResource(href: string): boolean {
|
|
278
279
|
const fragment = href.split("#")[1];
|
|
279
280
|
if (!fragment) return true;
|
|
280
|
-
|
|
281
|
+
const match = fragment.match(/(?:^|&)t=(\d+(?:\.\d+)?)/);
|
|
282
|
+
return match !== null && parseFloat(match[1]) === 0;
|
|
281
283
|
}
|
|
282
284
|
|
|
283
285
|
// -------------------------------------------------------------------------
|
|
284
286
|
// Shared utilities
|
|
285
287
|
// -------------------------------------------------------------------------
|
|
286
288
|
|
|
287
|
-
private static trimToDepth(
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
289
|
+
private static trimToDepth(
|
|
290
|
+
items: TimelineItem[],
|
|
291
|
+
remaining: number,
|
|
292
|
+
sourceMap: Map<TimelineItem, Link>,
|
|
293
|
+
targetMap: Map<TimelineItem, Link>,
|
|
294
|
+
): TimelineItem[] {
|
|
295
|
+
return items.map(item => {
|
|
296
|
+
const clone: TimelineItem = {
|
|
297
|
+
...item,
|
|
298
|
+
children: remaining > 1 && item.children?.length
|
|
299
|
+
? Timeline.trimToDepth(item.children, remaining - 1, sourceMap, targetMap)
|
|
300
|
+
: undefined,
|
|
301
|
+
};
|
|
302
|
+
const link = sourceMap.get(item);
|
|
303
|
+
if (link) targetMap.set(clone, link);
|
|
304
|
+
return clone;
|
|
305
|
+
});
|
|
294
306
|
}
|
|
295
307
|
|
|
296
308
|
private flattenItems(items: TimelineItem[]): TimelineItem[] {
|
|
@@ -302,21 +314,18 @@ export class Timeline {
|
|
|
302
314
|
return result;
|
|
303
315
|
}
|
|
304
316
|
|
|
305
|
-
private
|
|
317
|
+
private itemStartTime(item: TimelineItem, href: string): number | undefined {
|
|
306
318
|
for (const ref of item.references) {
|
|
307
319
|
const hashIndex = ref.indexOf("#");
|
|
308
320
|
const refHref = hashIndex >= 0 ? ref.slice(0, hashIndex) : ref;
|
|
309
321
|
const refFragment = hashIndex >= 0 ? ref.slice(hashIndex + 1) : undefined;
|
|
310
|
-
|
|
311
|
-
if (
|
|
322
|
+
const effectiveHref = refHref || this.bareHrefFromItem(item);
|
|
323
|
+
if (effectiveHref !== href) continue;
|
|
324
|
+
if (!refFragment) return undefined;
|
|
325
|
+
const match = refFragment.match(/(?:^|&)t=(\d+(?:\.\d+)?)/);
|
|
326
|
+
return match ? parseFloat(match[1]) : undefined;
|
|
312
327
|
}
|
|
313
|
-
return
|
|
314
|
-
}
|
|
315
|
-
|
|
316
|
-
private static parseTimeFragment(fragment: string | undefined): number {
|
|
317
|
-
if (!fragment) return 0;
|
|
318
|
-
const match = fragment.match(/(?:^|&)t=(\d+(?:\.\d+)?)/);
|
|
319
|
-
return match ? parseFloat(match[1]) : 0;
|
|
328
|
+
return undefined;
|
|
320
329
|
}
|
|
321
330
|
|
|
322
331
|
private bareHrefFromItem(item: TimelineItem): string {
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export * from './Timeline';
|
|
2
|
-
export * from './TimelineItem';
|
|
1
|
+
export * from './Timeline.ts';
|
|
2
|
+
export * from './TimelineItem.ts';
|
package/src/util/index.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
export * from './mediatype';
|
|
2
|
-
export * from './JSONParse';
|
|
3
|
-
export * from './URITemplate';
|
|
4
|
-
export * from './Language';
|
|
5
|
-
export * from './tokenizer';
|
|
1
|
+
export * from './mediatype/index.ts';
|
|
2
|
+
export * from './JSONParse.ts';
|
|
3
|
+
export * from './URITemplate.ts';
|
|
4
|
+
export * from './Language.ts';
|
|
5
|
+
export * from './tokenizer/index.ts';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export * from './MediaType';
|
|
1
|
+
export * from './MediaType.ts';
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { Language } from "../Language";
|
|
2
|
-
import { Tokenizer } from "./Tokenizer";
|
|
3
|
-
import BasicEnglishTokenizer from "./tokenize-english";
|
|
4
|
-
import BasicTokenizer, { TextlintSegment } from "./tokenize-text";
|
|
1
|
+
import { Language } from "../Language.ts";
|
|
2
|
+
import { Tokenizer } from "./Tokenizer.ts";
|
|
3
|
+
import BasicEnglishTokenizer from "./tokenize-english/index.js";
|
|
4
|
+
import BasicTokenizer, { TextlintSegment } from "./tokenize-text/index.js";
|
|
5
5
|
|
|
6
6
|
// Start / End
|
|
7
7
|
export type Range = [number, number];
|
|
@@ -123,4 +123,4 @@ export const speakableToken = (token: string): string | null => {
|
|
|
123
123
|
if(trimmedToken.length === 0) return null;
|
|
124
124
|
if(trimmedToken.match(trimmedMatcher) === null) return null;
|
|
125
125
|
return trimmedToken;
|
|
126
|
-
}
|
|
126
|
+
}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export * from './Tokenizer';
|
|
2
|
-
export * from './TextTokenizer';
|
|
1
|
+
export * from './Tokenizer.ts';
|
|
2
|
+
export * from './TextTokenizer.ts';
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { Link } from '../publication/Link';
|
|
2
|
-
import { Resource } from './Resource';
|
|
1
|
+
import { Link } from '../publication/Link.ts';
|
|
2
|
+
import { Resource } from './Resource.ts';
|
|
3
3
|
/** Provides access to a [Resource] from a [Link]. */
|
|
4
4
|
export interface Fetcher {
|
|
5
5
|
/**
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { Link } from '../publication/Link';
|
|
2
|
-
import { Fetcher } from './Fetcher';
|
|
3
|
-
import { NumberRange, Resource } from './Resource';
|
|
1
|
+
import { Link } from '../publication/Link.ts';
|
|
2
|
+
import { Fetcher } from './Fetcher.ts';
|
|
3
|
+
import { NumberRange, Resource } from './Resource.ts';
|
|
4
4
|
export type FetchImplementation = (input: RequestInfo | URL, init?: RequestInit | undefined) => Promise<Response>;
|
|
5
5
|
export declare class HttpFetcher implements Fetcher {
|
|
6
6
|
private readonly baseUrl?;
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
export * from './Fetcher';
|
|
2
|
-
export * from './HttpFetcher';
|
|
3
|
-
export * from './Resource';
|
|
1
|
+
export * from './Fetcher.ts';
|
|
2
|
+
export * from './HttpFetcher.ts';
|
|
3
|
+
export * from './Resource.ts';
|
package/types/src/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export * from './fetcher';
|
|
2
|
-
export * from './publication';
|
|
3
|
-
export * from './opds';
|
|
4
|
-
export * from './util';
|
|
1
|
+
export * from './fetcher/index.ts';
|
|
2
|
+
export * from './publication/index.ts';
|
|
3
|
+
export * from './opds/index.ts';
|
|
4
|
+
export * from './util/index.ts';
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
export * from './Price';
|
|
2
|
-
export * from './Acquisition';
|
|
3
|
-
export * from './Holds';
|
|
4
|
-
export * from './Copies';
|
|
5
|
-
export * from './Availability';
|
|
1
|
+
export * from './Price.ts';
|
|
2
|
+
export * from './Acquisition.ts';
|
|
3
|
+
export * from './Holds.ts';
|
|
4
|
+
export * from './Copies.ts';
|
|
5
|
+
export * from './Availability.ts';
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { Links } from './Link';
|
|
2
|
-
import { LocalizedString } from './LocalizedString';
|
|
3
|
-
import { AltIdentifier } from './AltIdentifier';
|
|
1
|
+
import { Links } from './Link.ts';
|
|
2
|
+
import { LocalizedString } from './LocalizedString.ts';
|
|
3
|
+
import { AltIdentifier } from './AltIdentifier.ts';
|
|
4
4
|
/**
|
|
5
5
|
* Contributor Object for the Readium Web Publication Manifest.
|
|
6
6
|
* https://readium.org/webpub-manifest/schema/contributor-object.schema.json
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { MediaType } from '../util/mediatype/MediaType';
|
|
2
|
-
import { Properties } from './Properties';
|
|
3
|
-
import { Locator } from './Locator';
|
|
1
|
+
import { MediaType } from '../util/mediatype/MediaType.ts';
|
|
2
|
+
import { Properties } from './Properties.ts';
|
|
3
|
+
import { Locator } from './Locator.ts';
|
|
4
4
|
/**
|
|
5
5
|
* Link Object for the Readium Web Publication Manifest.
|
|
6
6
|
* https://readium.org/webpub-manifest/schema/link.schema.json
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { Links } from './Link';
|
|
2
|
-
import { LocalizedString } from './LocalizedString';
|
|
3
|
-
import { Locator } from './Locator';
|
|
1
|
+
import { Links } from './Link.ts';
|
|
2
|
+
import { LocalizedString } from './LocalizedString.ts';
|
|
3
|
+
import { Locator } from './Locator.ts';
|
|
4
4
|
/**
|
|
5
5
|
* Holds the metadata of a `LocatorCollection`.
|
|
6
6
|
*/
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { Metadata } from './Metadata';
|
|
2
|
-
import { Link, Links } from './Link';
|
|
3
|
-
import { PublicationCollection } from './PublicationCollection';
|
|
4
|
-
import { Locator } from "./Locator";
|
|
1
|
+
import { Metadata } from './Metadata.ts';
|
|
2
|
+
import { Link, Links } from './Link.ts';
|
|
3
|
+
import { PublicationCollection } from './PublicationCollection.ts';
|
|
4
|
+
import { Locator } from "./Locator.ts";
|
|
5
5
|
/** Holds the metadata of a Readium publication, as described in
|
|
6
6
|
* the Readium Web Publication Manifest.
|
|
7
7
|
* See. https://readium.org/webpub-manifest/
|
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
import { AltIdentifier } from './AltIdentifier';
|
|
2
|
-
import { BelongsTo } from './BelongsTo';
|
|
3
|
-
import { Contributors } from './Contributor';
|
|
4
|
-
import { Layout } from './Layout';
|
|
5
|
-
import { LocalizedString } from './LocalizedString';
|
|
6
|
-
import { Profile } from './Profiles';
|
|
7
|
-
import { ReadingProgression } from './ReadingProgression';
|
|
8
|
-
import { Subjects } from './Subject';
|
|
9
|
-
import { Accessibility } from './accessibility/Accessibility';
|
|
10
|
-
import { TDM } from './TDM';
|
|
1
|
+
import { AltIdentifier } from './AltIdentifier.ts';
|
|
2
|
+
import { BelongsTo } from './BelongsTo.ts';
|
|
3
|
+
import { Contributors } from './Contributor.ts';
|
|
4
|
+
import { Layout } from './Layout.ts';
|
|
5
|
+
import { LocalizedString } from './LocalizedString.ts';
|
|
6
|
+
import { Profile } from './Profiles.ts';
|
|
7
|
+
import { ReadingProgression } from './ReadingProgression.ts';
|
|
8
|
+
import { Subjects } from './Subject.ts';
|
|
9
|
+
import { Accessibility } from './accessibility/Accessibility.ts';
|
|
10
|
+
import { TDM } from './TDM.ts';
|
|
11
11
|
/**
|
|
12
12
|
* https://readium.org/webpub-manifest/schema/metadata.schema.json
|
|
13
13
|
*
|
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
import { Link, Links } from './Link';
|
|
2
|
-
import { Locator } from './Locator';
|
|
3
|
-
import { Manifest } from './Manifest';
|
|
4
|
-
import { Metadata } from './Metadata';
|
|
5
|
-
import { Fetcher } from '../fetcher/Fetcher';
|
|
6
|
-
import { PublicationCollection } from './PublicationCollection';
|
|
7
|
-
import { Resource } from '../fetcher/Resource';
|
|
8
|
-
import { GuidedNavigationDocument } from "./GuidedNavigation";
|
|
9
|
-
import { Timeline } from './services/timeline/Timeline';
|
|
1
|
+
import { Link, Links } from './Link.ts';
|
|
2
|
+
import { Locator } from './Locator.ts';
|
|
3
|
+
import { Manifest } from './Manifest.ts';
|
|
4
|
+
import { Metadata } from './Metadata.ts';
|
|
5
|
+
import { Fetcher } from '../fetcher/Fetcher.ts';
|
|
6
|
+
import { PublicationCollection } from './PublicationCollection.ts';
|
|
7
|
+
import { Resource } from '../fetcher/Resource.ts';
|
|
8
|
+
import { GuidedNavigationDocument } from "./GuidedNavigation.ts";
|
|
9
|
+
import { Timeline } from './services/timeline/Timeline.ts';
|
|
10
10
|
export type ServiceFactory = () => null;
|
|
11
11
|
/** Shared model for a Readium Publication. */
|
|
12
12
|
export declare class Publication {
|
|
@@ -31,8 +31,7 @@ export declare class Publication {
|
|
|
31
31
|
});
|
|
32
32
|
/**
|
|
33
33
|
* Returns the publication's timeline, built from its reading order and table of contents.
|
|
34
|
-
*
|
|
35
|
-
* with a specific configuration (e.g. a depth limit).
|
|
34
|
+
* The result is cached after the first call.
|
|
36
35
|
*/
|
|
37
36
|
get timeline(): Timeline;
|
|
38
37
|
/** The URL where this publication is served, computed from the `Link` with `self` relation.
|
|
@@ -55,7 +54,7 @@ export declare class Publication {
|
|
|
55
54
|
/**
|
|
56
55
|
* Gets the cover image for the publication.
|
|
57
56
|
* First looks for rel='cover' in links/resources/readingOrder,
|
|
58
|
-
* then falls back to any image (JPEG, PNG, GIF, AVIF, SVG)
|
|
57
|
+
* then falls back to any image (JPEG, PNG, GIF, AVIF, SVG).
|
|
59
58
|
*/
|
|
60
59
|
getCover(): Link | undefined;
|
|
61
60
|
positionsFromManifest(): Promise<Locator[]>;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { Links } from './Link';
|
|
2
|
-
import { LocalizedString } from './LocalizedString';
|
|
1
|
+
import { Links } from './Link.ts';
|
|
2
|
+
import { LocalizedString } from './LocalizedString.ts';
|
|
3
3
|
/**
|
|
4
4
|
* https://github.com/readium/webpub-manifest/tree/master/contexts/default#subjects
|
|
5
5
|
*/
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { Publication } from '../Publication';
|
|
2
|
-
import { AccessibilityProfile } from './Accessibility';
|
|
1
|
+
import { Publication } from '../Publication.ts';
|
|
2
|
+
import { AccessibilityProfile } from './Accessibility.ts';
|
|
3
3
|
/**
|
|
4
4
|
* Represents a single accessibility claim
|
|
5
5
|
*/
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
export * from './Accessibility';
|
|
2
|
-
export * from './AccessibilityMetadataDisplayGuide';
|
|
3
|
-
export * from './Localization';
|
|
1
|
+
export * from './Accessibility.ts';
|
|
2
|
+
export * from './AccessibilityMetadataDisplayGuide.ts';
|
|
3
|
+
export * from './Localization.ts';
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export * from './Encryption';
|
|
2
|
-
export * from './Properties';
|
|
1
|
+
export * from './Encryption.ts';
|
|
2
|
+
export * from './Properties.ts';
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export * from './MediaOverlay';
|
|
2
|
-
export * from './Metadata';
|
|
3
|
-
export * from './Properties';
|
|
4
|
-
export * from './Publication';
|
|
1
|
+
export * from './MediaOverlay.ts';
|
|
2
|
+
export * from './Metadata.ts';
|
|
3
|
+
export * from './Properties.ts';
|
|
4
|
+
export * from './Publication.ts';
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
export * from './DomRange';
|
|
2
|
-
export * from './DomRangePoint';
|
|
3
|
-
export * from './Locations';
|
|
1
|
+
export * from './DomRange.ts';
|
|
2
|
+
export * from './DomRangePoint.ts';
|
|
3
|
+
export * from './Locations.ts';
|
|
@@ -1,24 +1,24 @@
|
|
|
1
|
-
export * from './accessibility';
|
|
2
|
-
export * from './encryption';
|
|
3
|
-
export * from './epub';
|
|
4
|
-
export * from './html';
|
|
5
|
-
export * from './opds';
|
|
6
|
-
export * from './services';
|
|
7
|
-
export * from './AltIdentifier';
|
|
8
|
-
export * from './BelongsTo';
|
|
9
|
-
export * from './Contributor';
|
|
10
|
-
export * from './Link';
|
|
11
|
-
export * from './LocalizedString';
|
|
12
|
-
export * from './Locator';
|
|
13
|
-
export * from './LocatorCollection';
|
|
14
|
-
export * from './Manifest';
|
|
15
|
-
export * from './Metadata';
|
|
16
|
-
export * from './Profiles';
|
|
17
|
-
export * from './Properties';
|
|
18
|
-
export * from './Publication';
|
|
19
|
-
export * from './PublicationCollection';
|
|
20
|
-
export * from './Layout';
|
|
21
|
-
export * from './ReadingProgression';
|
|
22
|
-
export * from './Subject';
|
|
23
|
-
export * from './TDM';
|
|
24
|
-
export * from './GuidedNavigation';
|
|
1
|
+
export * from './accessibility/index.ts';
|
|
2
|
+
export * from './encryption/index.ts';
|
|
3
|
+
export * from './epub/index.ts';
|
|
4
|
+
export * from './html/index.ts';
|
|
5
|
+
export * from './opds/index.ts';
|
|
6
|
+
export * from './services/index.ts';
|
|
7
|
+
export * from './AltIdentifier.ts';
|
|
8
|
+
export * from './BelongsTo.ts';
|
|
9
|
+
export * from './Contributor.ts';
|
|
10
|
+
export * from './Link.ts';
|
|
11
|
+
export * from './LocalizedString.ts';
|
|
12
|
+
export * from './Locator.ts';
|
|
13
|
+
export * from './LocatorCollection.ts';
|
|
14
|
+
export * from './Manifest.ts';
|
|
15
|
+
export * from './Metadata.ts';
|
|
16
|
+
export * from './Profiles.ts';
|
|
17
|
+
export * from './Properties.ts';
|
|
18
|
+
export * from './Publication.ts';
|
|
19
|
+
export * from './PublicationCollection.ts';
|
|
20
|
+
export * from './Layout.ts';
|
|
21
|
+
export * from './ReadingProgression.ts';
|
|
22
|
+
export * from './Subject.ts';
|
|
23
|
+
export * from './TDM.ts';
|
|
24
|
+
export * from './GuidedNavigation.ts';
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { Copies, Acquisition, Holds, Price, Availability } from '../../opds';
|
|
2
|
-
import { Link } from '../Link';
|
|
1
|
+
import { Copies, Acquisition, Holds, Price, Availability } from '../../opds/index.ts';
|
|
2
|
+
import { Link } from '../Link.ts';
|
|
3
3
|
declare module '../Properties' {
|
|
4
4
|
interface Properties {
|
|
5
5
|
/**
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export * from './Properties';
|
|
2
|
-
export * from './Publication';
|
|
1
|
+
export * from './Properties.ts';
|
|
2
|
+
export * from './Publication.ts';
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { TextTokenizer, TextUnit, Tokenizer } from "../../../util";
|
|
2
|
-
import { ContentElement } from "./element";
|
|
1
|
+
import { TextTokenizer, TextUnit, Tokenizer } from "../../../util/index.ts";
|
|
2
|
+
import { ContentElement } from "./element/index.ts";
|
|
3
3
|
export type ContentTokenizer = Tokenizer<ContentElement, ContentElement>;
|
|
4
4
|
export declare class TextContentTokenizer implements ContentTokenizer {
|
|
5
5
|
private readonly defaultLanguage;
|