@readium/shared 2.2.0-beta.3 → 2.2.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 (141) hide show
  1. package/dist/index.js +391 -377
  2. package/dist/index.umd.cjs +3 -3
  3. package/package.json +1 -1
  4. package/src/fetcher/Fetcher.ts +2 -2
  5. package/src/fetcher/HttpFetcher.ts +3 -3
  6. package/src/fetcher/Resource.ts +1 -1
  7. package/src/fetcher/index.ts +3 -3
  8. package/src/index.ts +4 -4
  9. package/src/opds/Availability.ts +1 -1
  10. package/src/opds/Copies.ts +1 -1
  11. package/src/opds/Holds.ts +1 -1
  12. package/src/opds/Price.ts +1 -1
  13. package/src/opds/index.ts +5 -5
  14. package/src/publication/BelongsTo.ts +1 -1
  15. package/src/publication/Contributor.ts +4 -4
  16. package/src/publication/GuidedNavigation.ts +19 -19
  17. package/src/publication/Link.ts +6 -6
  18. package/src/publication/Locator.ts +1 -1
  19. package/src/publication/LocatorCollection.ts +4 -4
  20. package/src/publication/Manifest.ts +29 -20
  21. package/src/publication/Metadata.ts +13 -13
  22. package/src/publication/Publication.ts +15 -17
  23. package/src/publication/PublicationCollection.ts +1 -1
  24. package/src/publication/ReadingProgression.ts +1 -1
  25. package/src/publication/Subject.ts +2 -2
  26. package/src/publication/accessibility/AccessibilityMetadataDisplayGuide.ts +20 -20
  27. package/src/publication/accessibility/Localization.ts +15 -15
  28. package/src/publication/accessibility/index.ts +3 -3
  29. package/src/publication/encryption/Properties.ts +2 -2
  30. package/src/publication/encryption/index.ts +2 -2
  31. package/src/publication/epub/Metadata.ts +3 -3
  32. package/src/publication/epub/Properties.ts +1 -1
  33. package/src/publication/epub/Publication.ts +2 -2
  34. package/src/publication/epub/index.ts +4 -4
  35. package/src/publication/html/DomRange.ts +1 -1
  36. package/src/publication/html/DomRangePoint.ts +1 -1
  37. package/src/publication/html/Locations.ts +3 -3
  38. package/src/publication/html/index.ts +3 -3
  39. package/src/publication/index.ts +24 -24
  40. package/src/publication/opds/Properties.ts +4 -4
  41. package/src/publication/opds/Publication.ts +2 -2
  42. package/src/publication/opds/index.ts +2 -2
  43. package/src/publication/services/content/Content.ts +3 -3
  44. package/src/publication/services/content/ContentTokenizer.ts +6 -6
  45. package/src/publication/services/content/Iterator.ts +2 -2
  46. package/src/publication/services/content/element/attributes.ts +2 -2
  47. package/src/publication/services/content/element/element.ts +5 -5
  48. package/src/publication/services/content/element/index.ts +3 -3
  49. package/src/publication/services/content/index.ts +5 -5
  50. package/src/publication/services/content/iterators/HTMLResourceContentIterator.ts +8 -8
  51. package/src/publication/services/content/iterators/PDFTextContentIterator.ts +21 -21
  52. package/src/publication/services/content/iterators/PublicationContentIterator.ts +7 -7
  53. package/src/publication/services/content/iterators/helpers.ts +1 -1
  54. package/src/publication/services/content/iterators/index.ts +3 -3
  55. package/src/publication/services/index.ts +2 -2
  56. package/src/publication/services/timeline/Timeline.ts +52 -29
  57. package/src/publication/services/timeline/index.ts +2 -2
  58. package/src/util/index.ts +5 -5
  59. package/src/util/mediatype/index.ts +1 -1
  60. package/src/util/tokenizer/TextTokenizer.ts +5 -5
  61. package/src/util/tokenizer/index.ts +2 -2
  62. package/types/src/fetcher/Fetcher.d.ts +2 -2
  63. package/types/src/fetcher/HttpFetcher.d.ts +3 -3
  64. package/types/src/fetcher/Resource.d.ts +1 -1
  65. package/types/src/fetcher/index.d.ts +3 -3
  66. package/types/src/index.d.ts +4 -4
  67. package/types/src/opds/index.d.ts +5 -5
  68. package/types/src/publication/BelongsTo.d.ts +1 -1
  69. package/types/src/publication/Contributor.d.ts +3 -3
  70. package/types/src/publication/GuidedNavigation.d.ts +1 -1
  71. package/types/src/publication/Link.d.ts +3 -3
  72. package/types/src/publication/LocatorCollection.d.ts +3 -3
  73. package/types/src/publication/Manifest.d.ts +6 -6
  74. package/types/src/publication/Metadata.d.ts +10 -10
  75. package/types/src/publication/Publication.d.ts +12 -13
  76. package/types/src/publication/PublicationCollection.d.ts +1 -1
  77. package/types/src/publication/ReadingProgression.d.ts +1 -1
  78. package/types/src/publication/Subject.d.ts +2 -2
  79. package/types/src/publication/accessibility/AccessibilityMetadataDisplayGuide.d.ts +2 -2
  80. package/types/src/publication/accessibility/index.d.ts +3 -3
  81. package/types/src/publication/encryption/Properties.d.ts +1 -1
  82. package/types/src/publication/encryption/index.d.ts +2 -2
  83. package/types/src/publication/epub/Metadata.d.ts +1 -1
  84. package/types/src/publication/epub/Publication.d.ts +1 -1
  85. package/types/src/publication/epub/index.d.ts +4 -4
  86. package/types/src/publication/html/DomRange.d.ts +1 -1
  87. package/types/src/publication/html/Locations.d.ts +1 -1
  88. package/types/src/publication/html/index.d.ts +3 -3
  89. package/types/src/publication/index.d.ts +24 -24
  90. package/types/src/publication/opds/Properties.d.ts +2 -2
  91. package/types/src/publication/opds/Publication.d.ts +1 -1
  92. package/types/src/publication/opds/index.d.ts +2 -2
  93. package/types/src/publication/services/content/Content.d.ts +2 -2
  94. package/types/src/publication/services/content/ContentTokenizer.d.ts +2 -2
  95. package/types/src/publication/services/content/Iterator.d.ts +1 -1
  96. package/types/src/publication/services/content/element/attributes.d.ts +1 -1
  97. package/types/src/publication/services/content/element/element.d.ts +4 -4
  98. package/types/src/publication/services/content/element/index.d.ts +3 -3
  99. package/types/src/publication/services/content/index.d.ts +5 -5
  100. package/types/src/publication/services/content/iterators/HTMLResourceContentIterator.d.ts +4 -4
  101. package/types/src/publication/services/content/iterators/PDFTextContentIterator.d.ts +3 -3
  102. package/types/src/publication/services/content/iterators/PublicationContentIterator.d.ts +5 -5
  103. package/types/src/publication/services/content/iterators/helpers.d.ts +1 -1
  104. package/types/src/publication/services/content/iterators/index.d.ts +3 -3
  105. package/types/src/publication/services/index.d.ts +2 -2
  106. package/types/src/publication/services/timeline/Timeline.d.ts +9 -6
  107. package/types/src/publication/services/timeline/index.d.ts +2 -2
  108. package/types/src/util/index.d.ts +5 -5
  109. package/types/src/util/mediatype/index.d.ts +1 -1
  110. package/types/src/util/tokenizer/TextTokenizer.d.ts +2 -2
  111. package/types/src/util/tokenizer/index.d.ts +2 -2
  112. package/types/test/AltIdentifier.test.d.ts +0 -1
  113. package/types/test/Contributor.test.d.ts +0 -1
  114. package/types/test/GuidedNavigation.test.d.ts +0 -1
  115. package/types/test/Link.test.d.ts +0 -1
  116. package/types/test/LocalizedString.test.d.ts +0 -1
  117. package/types/test/Locator.test.d.ts +0 -1
  118. package/types/test/LocatorCollection.test.d.ts +0 -1
  119. package/types/test/Manifest.test.d.ts +0 -1
  120. package/types/test/Metadata.test.d.ts +0 -1
  121. package/types/test/Properties.test.d.ts +0 -1
  122. package/types/test/Publication.test.d.ts +0 -1
  123. package/types/test/PublicationCollection.test.d.ts +0 -1
  124. package/types/test/Subject.test.d.ts +0 -1
  125. package/types/test/TDM.test.d.ts +0 -1
  126. package/types/test/Timeline.test.d.ts +0 -1
  127. package/types/test/accessibility/Accessibility.test.d.ts +0 -1
  128. package/types/test/accessibility/AccessibilityMetadataDisplayGuide.test.d.ts +0 -1
  129. package/types/test/accessibility/Localization.test.d.ts +0 -1
  130. package/types/test/encryption/Encryption.test.d.ts +0 -1
  131. package/types/test/encryption/Properties.test.d.ts +0 -1
  132. package/types/test/epub/MediaOverlay.test.d.ts +0 -1
  133. package/types/test/epub/Metadata.test.d.ts +0 -1
  134. package/types/test/epub/PropertiesTest.test.d.ts +0 -1
  135. package/types/test/epub/PublicationTest.test.d.ts +0 -1
  136. package/types/test/html/DomRange.test.d.ts +0 -1
  137. package/types/test/html/Locator.test.d.ts +0 -1
  138. package/types/test/opds/PropertiesTest.test.d.ts +0 -1
  139. package/types/test/opds/PublicationTest.test.d.ts +0 -1
  140. package/types/test/util/URITemplate.test.d.ts +0 -1
  141. package/types/test/util/mediatype/MediaType.test.d.ts +0 -1
@@ -1,8 +1,8 @@
1
- import { Resource } from "../../../../fetcher/Resource";
2
- import { Locator } from "../../../Locator";
3
- import { Publication } from "../../../Publication";
4
- import { IllegalStateError, Iterator } from "../Iterator";
5
- import { ContentElement } from "../element";
1
+ import { Resource } from "../../../../fetcher/Resource.ts";
2
+ import { Locator } from "../../../Locator.ts";
3
+ import { Publication } from "../../../Publication.ts";
4
+ import { IllegalStateError, Iterator } from "../Iterator.ts";
5
+ import { ContentElement } from "../element/index.ts";
6
6
 
7
7
  // Creates a [Content.Iterator] instance for the [Resource], starting from the given [Locator].
8
8
  // Returns null if the resource media type is not supported.
@@ -136,9 +136,9 @@ export class PublicationContentIterator extends Iterator {
136
136
 
137
137
  for (const factory of this.resourceContentIteratorFactories) {
138
138
  const res = factory(resource, locator);
139
- if(res) new IndexedIterator(index, res);
139
+ if(res) return new IndexedIterator(index, res);
140
140
  }
141
141
 
142
142
  return null;
143
143
  }
144
- }
144
+ }
@@ -1,4 +1,4 @@
1
- import { LocatorText } from "../../../Locator";
1
+ import { LocatorText } from "../../../Locator.ts";
2
2
 
3
3
 
4
4
  // https://github.com/jhy/jsoup/blob/0b10d516ed8f907f8fb4acb9a0806137a8988d45/src/main/java/org/jsoup/parser/Tag.java#L243
@@ -1,3 +1,3 @@
1
- export * from './PublicationContentIterator';
2
- export * from './PDFTextContentIterator';
3
- export * from './HTMLResourceContentIterator';
1
+ export * from './PublicationContentIterator.ts';
2
+ export * from './PDFTextContentIterator.ts';
3
+ export * from './HTMLResourceContentIterator.ts';
@@ -1,2 +1,2 @@
1
- export * from './content';
2
- export * from './timeline';
1
+ export * from './timeline/index.ts';
2
+ export * from './content/index.ts';
@@ -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;
@@ -86,9 +88,12 @@ export class Timeline {
86
88
  /** Top-level timeline items. Cached; invalidated when `depth` changes. */
87
89
  get items(): TimelineItem[] {
88
90
  if (!this._items) {
89
- this._items = this._depth !== undefined
90
- ? Timeline.trimToDepth(this._allItems, this._depth)
91
- : this._allItems;
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
+ }
92
97
  }
93
98
  return this._items;
94
99
  }
@@ -100,8 +105,13 @@ export class Timeline {
100
105
  let match: TimelineItem | undefined;
101
106
 
102
107
  if (time !== undefined) {
108
+ let bestTime = -Infinity;
103
109
  for (const item of this.flat) {
104
- if (this.itemMatchesTime(item, href, time)) match = item;
110
+ const t = this.itemStartTime(item, href);
111
+ if (t !== undefined && t <= time && t > bestTime) {
112
+ bestTime = t;
113
+ match = item;
114
+ }
105
115
  }
106
116
  }
107
117
 
@@ -136,10 +146,13 @@ export class Timeline {
136
146
  if (duration !== undefined) {
137
147
  const time = progression * duration;
138
148
  let match: TimelineItem = item;
149
+ let bestTime = -Infinity;
139
150
  for (const child of item.children) {
140
151
  const t = this.timeFromItem(child);
141
- if (t === undefined || t > time) break;
142
- match = child;
152
+ if (t !== undefined && t <= time && t > bestTime) {
153
+ bestTime = t;
154
+ match = child;
155
+ }
143
156
  }
144
157
  return match;
145
158
  }
@@ -153,7 +166,7 @@ export class Timeline {
153
166
  }
154
167
 
155
168
  linkFor(item: TimelineItem): Link | undefined {
156
- return this.linkMap.get(item);
169
+ return this.linkMap.get(item) ?? this._trimmedLinkMap.get(item);
157
170
  }
158
171
 
159
172
  private get flat(): TimelineItem[] {
@@ -258,25 +271,38 @@ export class Timeline {
258
271
 
259
272
  /**
260
273
  * A TOC href points to the start of its resource when it has no fragment,
261
- * or when the fragment is `t=0` (audio: explicit beginning of the file).
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`.
262
277
  */
263
278
  private static isStartOfResource(href: string): boolean {
264
279
  const fragment = href.split("#")[1];
265
280
  if (!fragment) return true;
266
- return fragment === "t=0";
281
+ const match = fragment.match(/(?:^|&)t=(\d+(?:\.\d+)?)/);
282
+ return match !== null && parseFloat(match[1]) === 0;
267
283
  }
268
284
 
269
285
  // -------------------------------------------------------------------------
270
286
  // Shared utilities
271
287
  // -------------------------------------------------------------------------
272
288
 
273
- private static trimToDepth(items: TimelineItem[], remaining: number): TimelineItem[] {
274
- return items.map(item => ({
275
- ...item,
276
- children: remaining > 1 && item.children?.length
277
- ? Timeline.trimToDepth(item.children, remaining - 1)
278
- : undefined,
279
- }));
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
+ });
280
306
  }
281
307
 
282
308
  private flattenItems(items: TimelineItem[]): TimelineItem[] {
@@ -288,21 +314,18 @@ export class Timeline {
288
314
  return result;
289
315
  }
290
316
 
291
- private itemMatchesTime(item: TimelineItem, href: string, time: number): boolean {
317
+ private itemStartTime(item: TimelineItem, href: string): number | undefined {
292
318
  for (const ref of item.references) {
293
319
  const hashIndex = ref.indexOf("#");
294
320
  const refHref = hashIndex >= 0 ? ref.slice(0, hashIndex) : ref;
295
321
  const refFragment = hashIndex >= 0 ? ref.slice(hashIndex + 1) : undefined;
296
- if ((refHref || href) !== href) continue;
297
- if (time >= Timeline.parseTimeFragment(refFragment)) return true;
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;
298
327
  }
299
- return false;
300
- }
301
-
302
- private static parseTimeFragment(fragment: string | undefined): number {
303
- if (!fragment) return 0;
304
- const match = fragment.match(/(?:^|&)t=(\d+(?:\.\d+)?)/);
305
- return match ? parseFloat(match[1]) : 0;
328
+ return undefined;
306
329
  }
307
330
 
308
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,4 +1,4 @@
1
- import { Link } from '../publication/Link';
1
+ import { Link } from '../publication/Link.ts';
2
2
  export declare class NumberRange {
3
3
  readonly start: number;
4
4
  readonly endInclusive: number;
@@ -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';
@@ -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,4 +1,4 @@
1
- import { Contributors as Collection } from './Contributor';
1
+ import { Contributors as Collection } from './Contributor.ts';
2
2
  /**
3
3
  * BelongsTo Object for the Readium Web Publication Manifest.
4
4
  * https://readium.org/webpub-manifest/schema/contributor-object.schema.json
@@ -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,4 +1,4 @@
1
- import { Links } from "./Link";
1
+ import { Links } from "./Link.ts";
2
2
  export interface Clip {
3
3
  audioResource: string;
4
4
  fragmentId?: string;
@@ -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/
@@ -9,7 +9,7 @@ import { Locator } from "./Locator";
9
9
  export declare class Manifest {
10
10
  readonly context?: Array<string>;
11
11
  readonly metadata: Metadata;
12
- readonly links: Links;
12
+ readonly links?: Links;
13
13
  /** Identifies a list of resources in reading order for the publication. */
14
14
  readonly readingOrder: Links;
15
15
  /** Identifies resources that are necessary for rendering the publication. */
@@ -20,7 +20,7 @@ export declare class Manifest {
20
20
  constructor(values: {
21
21
  context?: Array<string>;
22
22
  metadata: Metadata;
23
- links: Links;
23
+ links?: Links;
24
24
  readingOrder: Links;
25
25
  resources?: Links;
26
26
  toc?: Links;
@@ -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 {
@@ -16,7 +16,7 @@ export declare class Publication {
16
16
  private _timeline;
17
17
  readonly context?: Array<string>;
18
18
  readonly metadata: Metadata;
19
- readonly links: Links;
19
+ readonly links?: Links;
20
20
  /** Identifies a list of resources in reading order for the publication. */
21
21
  readonly readingOrder: Links;
22
22
  /** Identifies resources that are necessary for rendering the 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
- * Called with no arguments, the result is cached. Pass options to build a fresh timeline
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) as bitmap fallback.
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,4 +1,4 @@
1
- import { Links } from './Link';
1
+ import { Links } from './Link.ts';
2
2
  /**
3
3
  * Core Collection Model
4
4
  *
@@ -1,4 +1,4 @@
1
- import { Page } from "./Properties";
1
+ import { Page } from "./Properties.ts";
2
2
  export declare enum ReadingProgression {
3
3
  ltr = "ltr",
4
4
  rtl = "rtl"
@@ -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,4 +1,4 @@
1
- import { Encryption } from './Encryption';
1
+ import { Encryption } from './Encryption.ts';
2
2
  declare module '../Properties' {
3
3
  interface Properties {
4
4
  /**
@@ -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
- import { MediaOverlay } from "./MediaOverlay";
1
+ import { MediaOverlay } from "./MediaOverlay.ts";
2
2
  declare module '../Metadata' {
3
3
  interface Metadata {
4
4
  getMediaOverlay(): MediaOverlay | undefined;
@@ -1,4 +1,4 @@
1
- import { Links } from '../Link';
1
+ import { Links } from '../Link.ts';
2
2
  declare module '../Publication' {
3
3
  interface Publication {
4
4
  /**
@@ -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,4 +1,4 @@
1
- import { DomRangePoint } from './DomRangePoint';
1
+ import { DomRangePoint } from './DomRangePoint.ts';
2
2
  /**
3
3
  * This construct enables a serializable representation of a DOM Range.
4
4
  *
@@ -1,4 +1,4 @@
1
- import { DomRange } from './DomRange';
1
+ import { DomRange } from './DomRange.ts';
2
2
  declare module '../Locator' {
3
3
  interface LocatorLocations {
4
4
  /**
@@ -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,4 +1,4 @@
1
- import { Links } from '../Link';
1
+ import { Links } from '../Link.ts';
2
2
  declare module '../Publication' {
3
3
  interface Publication {
4
4
  getImages(): Links | undefined;
@@ -1,2 +1,2 @@
1
- export * from './Properties';
2
- export * from './Publication';
1
+ export * from './Properties.ts';
2
+ export * from './Publication.ts';