@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,5 +1,5 @@
1
- import { Iterator } from "./Iterator";
2
- import { ContentElement } from "./element";
1
+ import { Iterator } from "./Iterator.ts";
2
+ import { ContentElement } from "./element/index.ts";
3
3
  /**
4
4
  * Provides an iterable list of content [Element]s.
5
5
  */
@@ -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;
@@ -1,4 +1,4 @@
1
- import { ContentElement } from "./element";
1
+ import { ContentElement } from "./element/index.ts";
2
2
  export declare class IllegalStateError extends Error {
3
3
  constructor(message: string);
4
4
  }
@@ -1,4 +1,4 @@
1
- import { Language } from "../../../../util/Language";
1
+ import { Language } from "../../../../util/Language.ts";
2
2
  export declare class Attribute<V> {
3
3
  key: AttributeKeys | string;
4
4
  value: V;
@@ -1,7 +1,7 @@
1
- import { Link } from "../../../Link";
2
- import { Locator } from "../../../Locator";
3
- import { AttributesHolder, Attribute } from "./attributes";
4
- import { TextRole } from "./text_role";
1
+ import { Link } from "../../../Link.ts";
2
+ import { Locator } from "../../../Locator.ts";
3
+ import { AttributesHolder, Attribute } from "./attributes.ts";
4
+ import { TextRole } from "./text_role.ts";
5
5
  /**
6
6
  * Represents a single semantic content element part of a publication.
7
7
  * NOTE: This is named "Element" in other toolkits. This conflicts with the JavaScript `Element` type so it's been renamed.
@@ -1,3 +1,3 @@
1
- export * from './element';
2
- export * from './attributes';
3
- export * from './text_role';
1
+ export * from './element.ts';
2
+ export * from './attributes.ts';
3
+ export * from './text_role.ts';
@@ -1,5 +1,5 @@
1
- export * from './Content';
2
- export * from './ContentTokenizer';
3
- export * from './Iterator';
4
- export * from './element';
5
- export * from './iterators';
1
+ export * from './Content.ts';
2
+ export * from './ContentTokenizer.ts';
3
+ export * from './Iterator.ts';
4
+ export * from './element/index.ts';
5
+ export * from './iterators/index.ts';
@@ -1,7 +1,7 @@
1
- import { Resource } from "../../../../fetcher/Resource";
2
- import { Locator } from "../../../Locator";
3
- import { Iterator } from "../Iterator";
4
- import { ContentElement } from "../element";
1
+ import { Resource } from "../../../../fetcher/Resource.ts";
2
+ import { Locator } from "../../../Locator.ts";
3
+ import { Iterator } from "../Iterator.ts";
4
+ import { ContentElement } from "../element/index.ts";
5
5
  /**
6
6
  * Iterates an HTML [resource], starting from the given [locator].
7
7
  *
@@ -1,6 +1,6 @@
1
- import { Locator } from "../../../Locator";
2
- import { Attribute, ContentElement } from "../element";
3
- import { Iterator } from "../Iterator";
1
+ import { Locator } from "../../../Locator.ts";
2
+ import { Attribute, ContentElement } from "../element/index.ts";
3
+ import { Iterator } from "../Iterator.ts";
4
4
  type TextItem = {
5
5
  str: string;
6
6
  dir: string;
@@ -1,8 +1,8 @@
1
- import { Resource } from "../../../../fetcher/Resource";
2
- import { Locator } from "../../../Locator";
3
- import { Publication } from "../../../Publication";
4
- import { 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 { Iterator } from "../Iterator.ts";
5
+ import { ContentElement } from "../element/index.ts";
6
6
  export type ResourceContentIteratorFactory = (resource: Resource, locator: Locator) => Iterator | null;
7
7
  export declare class PublicationContentIterator extends Iterator {
8
8
  /**
@@ -1,4 +1,4 @@
1
- import { LocatorText } from "../../../Locator";
1
+ import { LocatorText } from "../../../Locator.ts";
2
2
  export declare function isInlineTag(n: Node): boolean;
3
3
  export declare function srcRelativeToHref(e: Element, base?: string | URL): string | null;
4
4
  export declare const isBlank: (s: string | null) => boolean;
@@ -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
  interface PublicationLike {
5
5
  toc?: Links;
6
6
  readingOrder: Links;
@@ -28,6 +28,8 @@ export declare class Timeline {
28
28
  private _depth;
29
29
  private _items;
30
30
  private _flat;
31
+ /** Populated when depth is set; maps cloned items from trimToDepth back to their Links. */
32
+ private _trimmedLinkMap;
31
33
  constructor(items: TimelineItem[], linkMap: Map<TimelineItem, Link>);
32
34
  static build(publication: PublicationLike, options?: {
33
35
  depth?: number;
@@ -74,13 +76,14 @@ export declare class Timeline {
74
76
  private static collectTocCandidates;
75
77
  /**
76
78
  * A TOC href points to the start of its resource when it has no fragment,
77
- * or when the fragment is `t=0` (audio: explicit beginning of the file).
79
+ * or when the fragment contains a parsable `t=` value of 0 (audio: explicit
80
+ * beginning of the file). Accepts decimals and extra params, e.g. `t=0.0`
81
+ * or `foo=bar&t=0`.
78
82
  */
79
83
  private static isStartOfResource;
80
84
  private static trimToDepth;
81
85
  private flattenItems;
82
- private itemMatchesTime;
83
- private static parseTimeFragment;
86
+ private itemStartTime;
84
87
  private bareHrefFromItem;
85
88
  private timeFromItem;
86
89
  private ancestorPath;
@@ -1,2 +1,2 @@
1
- export * from './Timeline';
2
- export * from './TimelineItem';
1
+ export * from './Timeline.ts';
2
+ export * from './TimelineItem.ts';
@@ -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,5 +1,5 @@
1
- import { Language } from "../Language";
2
- import { Tokenizer } from "./Tokenizer";
1
+ import { Language } from "../Language.ts";
2
+ import { Tokenizer } from "./Tokenizer.ts";
3
3
  export type Range = [number, number];
4
4
  /**
5
5
  * A tokenizer splitting a String into range tokens (e.g. words, sentences, etc.).
@@ -1,2 +1,2 @@
1
- export * from './Tokenizer';
2
- export * from './TextTokenizer';
1
+ export * from './Tokenizer.ts';
2
+ export * from './TextTokenizer.ts';
@@ -1 +0,0 @@
1
- export {};
@@ -1 +0,0 @@
1
- export {};
@@ -1 +0,0 @@
1
- export {};
@@ -1 +0,0 @@
1
- export {};
@@ -1 +0,0 @@
1
- export {};
@@ -1 +0,0 @@
1
- export {};
@@ -1 +0,0 @@
1
- export {};
@@ -1 +0,0 @@
1
- export {};
@@ -1 +0,0 @@
1
- export {};
@@ -1 +0,0 @@
1
- export {};
@@ -1 +0,0 @@
1
- export {};
@@ -1 +0,0 @@
1
- export {};
@@ -1 +0,0 @@
1
- export {};
@@ -1 +0,0 @@
1
- export {};
@@ -1 +0,0 @@
1
- export {};
@@ -1 +0,0 @@
1
- export {};
@@ -1 +0,0 @@
1
- export {};
@@ -1 +0,0 @@
1
- export {};
@@ -1 +0,0 @@
1
- export {};
@@ -1 +0,0 @@
1
- export {};
@@ -1 +0,0 @@
1
- export {};
@@ -1 +0,0 @@
1
- export {};
@@ -1 +0,0 @@
1
- export {};
@@ -1 +0,0 @@
1
- export {};
@@ -1 +0,0 @@
1
- export {};
@@ -1 +0,0 @@
1
- export {};
@@ -1 +0,0 @@
1
- export {};
@@ -1 +0,0 @@
1
- export {};
@@ -1 +0,0 @@
1
- export {};