@readium/shared 2.2.0-beta.1 → 2.2.0-beta.3

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 (43) hide show
  1. package/dist/index.js +974 -768
  2. package/dist/index.umd.cjs +3 -3
  3. package/package.json +1 -1
  4. package/src/publication/Publication.ts +12 -0
  5. package/src/publication/services/index.ts +2 -1
  6. package/src/publication/services/timeline/Timeline.ts +335 -0
  7. package/src/publication/services/timeline/TimelineItem.ts +24 -0
  8. package/src/publication/services/timeline/index.ts +2 -0
  9. package/types/src/publication/Publication.d.ts +8 -0
  10. package/types/src/publication/services/index.d.ts +1 -0
  11. package/types/src/publication/services/timeline/Timeline.d.ts +89 -0
  12. package/types/src/publication/services/timeline/TimelineItem.d.ts +24 -0
  13. package/types/src/publication/services/timeline/index.d.ts +2 -0
  14. package/types/test/AltIdentifier.test.d.ts +1 -0
  15. package/types/test/Contributor.test.d.ts +1 -0
  16. package/types/test/GuidedNavigation.test.d.ts +1 -0
  17. package/types/test/Link.test.d.ts +1 -0
  18. package/types/test/LocalizedString.test.d.ts +1 -0
  19. package/types/test/Locator.test.d.ts +1 -0
  20. package/types/test/LocatorCollection.test.d.ts +1 -0
  21. package/types/test/Manifest.test.d.ts +1 -0
  22. package/types/test/Metadata.test.d.ts +1 -0
  23. package/types/test/Properties.test.d.ts +1 -0
  24. package/types/test/Publication.test.d.ts +1 -0
  25. package/types/test/PublicationCollection.test.d.ts +1 -0
  26. package/types/test/Subject.test.d.ts +1 -0
  27. package/types/test/TDM.test.d.ts +1 -0
  28. package/types/test/Timeline.test.d.ts +1 -0
  29. package/types/test/accessibility/Accessibility.test.d.ts +1 -0
  30. package/types/test/accessibility/AccessibilityMetadataDisplayGuide.test.d.ts +1 -0
  31. package/types/test/accessibility/Localization.test.d.ts +1 -0
  32. package/types/test/encryption/Encryption.test.d.ts +1 -0
  33. package/types/test/encryption/Properties.test.d.ts +1 -0
  34. package/types/test/epub/MediaOverlay.test.d.ts +1 -0
  35. package/types/test/epub/Metadata.test.d.ts +1 -0
  36. package/types/test/epub/PropertiesTest.test.d.ts +1 -0
  37. package/types/test/epub/PublicationTest.test.d.ts +1 -0
  38. package/types/test/html/DomRange.test.d.ts +1 -0
  39. package/types/test/html/Locator.test.d.ts +1 -0
  40. package/types/test/opds/PropertiesTest.test.d.ts +1 -0
  41. package/types/test/opds/PublicationTest.test.d.ts +1 -0
  42. package/types/test/util/URITemplate.test.d.ts +1 -0
  43. package/types/test/util/mediatype/MediaType.test.d.ts +1 -0
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@readium/shared",
3
- "version": "2.2.0-beta.1",
3
+ "version": "2.2.0-beta.3",
4
4
  "type": "module",
5
5
  "description": "Shared models to be used across other Readium projects and implementations in Typescript",
6
6
  "author": "readium",
@@ -13,6 +13,7 @@ import { Resource } from '../fetcher/Resource';
13
13
  import { GuidedNavigationDocument } from "./GuidedNavigation";
14
14
  import { URITemplate } from "../util";
15
15
  import { MediaType } from "../util/mediatype/MediaType";
16
+ import { Timeline } from './services/timeline/Timeline';
16
17
 
17
18
  export type ServiceFactory = () => null;
18
19
 
@@ -21,6 +22,7 @@ export class Publication {
21
22
  /** The manifest holding the publication metadata extracted from the publication file */
22
23
  public manifest: Manifest;
23
24
  private readonly fetcher: Fetcher = new EmptyFetcher();
25
+ private _timeline: Timeline | undefined;
24
26
 
25
27
  // Shortcuts to manifest properties
26
28
  public readonly context?: Array<string>;
@@ -47,6 +49,16 @@ export class Publication {
47
49
  this.subcollections = values.manifest.subcollections;
48
50
  }
49
51
 
52
+ /**
53
+ * Returns the publication's timeline, built from its reading order and table of contents.
54
+ * Called with no arguments, the result is cached. Pass options to build a fresh timeline
55
+ * with a specific configuration (e.g. a depth limit).
56
+ */
57
+ public get timeline(): Timeline {
58
+ if (!this._timeline) this._timeline = Timeline.build(this);
59
+ return this._timeline;
60
+ }
61
+
50
62
  /** The URL where this publication is served, computed from the `Link` with `self` relation.
51
63
  * e.g. https://provider.com/pub1293/manifest.json gives https://provider.com/pub1293/
52
64
  */
@@ -1 +1,2 @@
1
- export * from './content';
1
+ export * from './content';
2
+ export * from './timeline';
@@ -0,0 +1,335 @@
1
+ import { Link, Links } from "../../Link";
2
+ import { Locator } from "../../Locator";
3
+ import { TimelineItem } from "./TimelineItem";
4
+
5
+ interface PublicationLike {
6
+ toc?: Links;
7
+ readingOrder: Links;
8
+ }
9
+
10
+ /**
11
+ * A publication's timeline, built once from its reading order and table of contents.
12
+ *
13
+ * **Source of truth**: the reading order. Every reading order item becomes
14
+ * exactly one top-level `TimelineItem`. The TOC is consulted to:
15
+ * 1. Derive a display title when the reading order item has none.
16
+ * 2. Populate flat children — all TOC fragment entries that reference the
17
+ * resource, collected depth-first in TOC declaration order.
18
+ *
19
+ * No TOC hierarchy is reconstructed; that requires role context and is not yet
20
+ * implemented. TOC entries whose href does not match any reading order item
21
+ * are ignored.
22
+ *
23
+ * The `depth` build option limits how many levels deep into the TOC tree both
24
+ * title resolution and child collection may look. Level 1 = top-level TOC
25
+ * entries; level 2 = their children; etc. `undefined` means no limit.
26
+ */
27
+ export class Timeline {
28
+ private readonly _allItems: TimelineItem[];
29
+ private readonly linkMap: Map<TimelineItem, Link>;
30
+ private _depth: number | undefined;
31
+ private _items: TimelineItem[] | undefined;
32
+ private _flat: TimelineItem[] | undefined;
33
+
34
+ constructor(items: TimelineItem[], linkMap: Map<TimelineItem, Link>) {
35
+ this._allItems = items;
36
+ this.linkMap = linkMap;
37
+ }
38
+
39
+ static build(publication: PublicationLike, options: { depth?: number } = {}): Timeline {
40
+ const tocLinks = publication.toc?.items ?? [];
41
+ const roLinks = publication.readingOrder.items;
42
+ const { depth } = options;
43
+ const linkMap = new Map<TimelineItem, Link>();
44
+ const items: TimelineItem[] = [];
45
+
46
+ for (let i = 0; i < roLinks.length; i++) {
47
+ const ro = roLinks[i];
48
+ const bare = Timeline.bareHref(ro.href);
49
+
50
+ const title =
51
+ ro.title ??
52
+ Timeline.findTitleInToc(tocLinks, bare, depth) ??
53
+ `Resource ${i + 1}`;
54
+
55
+ const tocChildren = Timeline.collectChildrenFromToc(tocLinks, bare, depth, 1, linkMap);
56
+
57
+ const item: TimelineItem = {
58
+ title,
59
+ references: [ro.href],
60
+ children: tocChildren.length > 0 ? tocChildren : undefined,
61
+ };
62
+
63
+ linkMap.set(item, ro);
64
+ items.push(item);
65
+ }
66
+
67
+ return new Timeline(items, linkMap);
68
+ }
69
+
70
+ /**
71
+ * The active depth limit for TOC traversal (title resolution and child
72
+ * collection). `undefined` means unlimited. Setting the same value again
73
+ * is a no-op; a new value invalidates the cached items and flat list.
74
+ */
75
+ get depth(): number | undefined {
76
+ return this._depth;
77
+ }
78
+
79
+ set depth(value: number | undefined) {
80
+ if (this._depth === value) return;
81
+ this._depth = value;
82
+ this._items = undefined;
83
+ this._flat = undefined;
84
+ }
85
+
86
+ /** Top-level timeline items. Cached; invalidated when `depth` changes. */
87
+ get items(): TimelineItem[] {
88
+ if (!this._items) {
89
+ this._items = this._depth !== undefined
90
+ ? Timeline.trimToDepth(this._allItems, this._depth)
91
+ : this._allItems;
92
+ }
93
+ return this._items;
94
+ }
95
+
96
+ locate(locator: Locator): TimelineItem | undefined {
97
+ const href = locator.href.split("#")[0];
98
+ const time = locator.locations?.time();
99
+
100
+ let match: TimelineItem | undefined;
101
+
102
+ if (time !== undefined) {
103
+ for (const item of this.flat) {
104
+ if (this.itemMatchesTime(item, href, time)) match = item;
105
+ }
106
+ }
107
+
108
+ if (!match) {
109
+ match = this.flat.find(item => this.bareHrefFromItem(item) === href);
110
+ }
111
+
112
+ return match;
113
+ }
114
+
115
+ adjacentTo(item: TimelineItem): { previous: TimelineItem | undefined; next: TimelineItem | undefined } {
116
+ const index = this.flat.indexOf(item);
117
+ return {
118
+ previous: index > 0 ? this.flat[index - 1] : undefined,
119
+ next: index >= 0 && index < this.flat.length - 1 ? this.flat[index + 1] : undefined,
120
+ };
121
+ }
122
+
123
+ segmentsForHref(href: string): TimelineItem[] {
124
+ const bare = href.split("#")[0];
125
+ const item = this.items.find(i => this.bareHrefFromItem(i) === bare);
126
+ if (!item) return [];
127
+ return item.children?.length ? item.children : [item];
128
+ }
129
+
130
+ itemAtProgression(href: string, progression: number, duration?: number): TimelineItem | undefined {
131
+ const bare = href.split("#")[0];
132
+ const item = this.items.find(i => this.bareHrefFromItem(i) === bare);
133
+ if (!item) return undefined;
134
+ if (!item.children?.length) return item;
135
+
136
+ if (duration !== undefined) {
137
+ const time = progression * duration;
138
+ let match: TimelineItem = item;
139
+ for (const child of item.children) {
140
+ const t = this.timeFromItem(child);
141
+ if (t === undefined || t > time) break;
142
+ match = child;
143
+ }
144
+ return match;
145
+ }
146
+
147
+ const index = Math.min(Math.floor(progression * item.children.length), item.children.length - 1);
148
+ return item.children[index];
149
+ }
150
+
151
+ ancestors(item: TimelineItem): TimelineItem[] {
152
+ return this.ancestorPath(this.items, item) ?? [];
153
+ }
154
+
155
+ linkFor(item: TimelineItem): Link | undefined {
156
+ return this.linkMap.get(item);
157
+ }
158
+
159
+ private get flat(): TimelineItem[] {
160
+ if (!this._flat) this._flat = this.flattenItems(this.items);
161
+ return this._flat;
162
+ }
163
+
164
+ // -------------------------------------------------------------------------
165
+ // TOC title resolution
166
+ // -------------------------------------------------------------------------
167
+
168
+ /**
169
+ * Resolve a display title for `bare` from the TOC, looking no deeper than
170
+ * `maxDepth` levels (1 = top-level entries only). Priority:
171
+ * 1. A start-of-resource entry: bare href or `#t=0` (audio).
172
+ * 2. Exactly one fragment entry referencing this resource — unambiguous.
173
+ * 3. Multiple fragment entries — ambiguous, returns `undefined`.
174
+ */
175
+ private static findTitleInToc(
176
+ tocLinks: Link[],
177
+ bare: string,
178
+ maxDepth: number | undefined,
179
+ ): string | undefined {
180
+ const { atStart, fragments } = Timeline.collectTocCandidates(tocLinks, bare, maxDepth, 1);
181
+ if (atStart.length > 0) return atStart[0].title!;
182
+ if (fragments.length === 1) return fragments[0].title!;
183
+ return undefined;
184
+ }
185
+
186
+ /**
187
+ * Collect all TOC entries that reference `bare` as flat children, walking
188
+ * up to `maxDepth` levels deep. Start-of-resource entries (#t=0 or no
189
+ * fragment) are excluded — they contribute to title resolution, not children.
190
+ * Order follows TOC declaration (depth-first).
191
+ */
192
+ private static collectChildrenFromToc(
193
+ tocLinks: Link[],
194
+ bare: string,
195
+ maxDepth: number | undefined,
196
+ currentDepth: number,
197
+ linkMap: Map<TimelineItem, Link>,
198
+ ): TimelineItem[] {
199
+ if (maxDepth !== undefined && currentDepth > maxDepth) return [];
200
+
201
+ const result: TimelineItem[] = [];
202
+
203
+ for (const link of tocLinks) {
204
+ if (Timeline.bareHref(link.href) === bare && link.title && !Timeline.isStartOfResource(link.href)) {
205
+ const child: TimelineItem = { title: link.title, references: [link.href] };
206
+ linkMap.set(child, link);
207
+ result.push(child);
208
+ }
209
+
210
+ if (link.children?.items?.length) {
211
+ result.push(...Timeline.collectChildrenFromToc(
212
+ link.children.items, bare, maxDepth, currentDepth + 1, linkMap,
213
+ ));
214
+ }
215
+ }
216
+
217
+ return result;
218
+ }
219
+
220
+ /**
221
+ * Walk the TOC tree up to `maxDepth` levels and collect all entries whose
222
+ * bare href matches `bare`, split into start-of-resource entries and
223
+ * fragment entries.
224
+ */
225
+ private static collectTocCandidates(
226
+ tocLinks: Link[],
227
+ bare: string,
228
+ maxDepth: number | undefined,
229
+ currentDepth: number,
230
+ ): { atStart: Link[]; fragments: Link[] } {
231
+ if (maxDepth !== undefined && currentDepth > maxDepth) {
232
+ return { atStart: [], fragments: [] };
233
+ }
234
+
235
+ const atStart: Link[] = [];
236
+ const fragments: Link[] = [];
237
+
238
+ for (const link of tocLinks) {
239
+ if (Timeline.bareHref(link.href) === bare && link.title) {
240
+ if (Timeline.isStartOfResource(link.href)) {
241
+ atStart.push(link);
242
+ } else {
243
+ fragments.push(link);
244
+ }
245
+ }
246
+
247
+ if (link.children?.items?.length) {
248
+ const child = Timeline.collectTocCandidates(
249
+ link.children.items, bare, maxDepth, currentDepth + 1,
250
+ );
251
+ atStart.push(...child.atStart);
252
+ fragments.push(...child.fragments);
253
+ }
254
+ }
255
+
256
+ return { atStart, fragments };
257
+ }
258
+
259
+ /**
260
+ * 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).
262
+ */
263
+ private static isStartOfResource(href: string): boolean {
264
+ const fragment = href.split("#")[1];
265
+ if (!fragment) return true;
266
+ return fragment === "t=0";
267
+ }
268
+
269
+ // -------------------------------------------------------------------------
270
+ // Shared utilities
271
+ // -------------------------------------------------------------------------
272
+
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
+ }));
280
+ }
281
+
282
+ private flattenItems(items: TimelineItem[]): TimelineItem[] {
283
+ const result: TimelineItem[] = [];
284
+ for (const item of items) {
285
+ result.push(item);
286
+ if (item.children) result.push(...this.flattenItems(item.children));
287
+ }
288
+ return result;
289
+ }
290
+
291
+ private itemMatchesTime(item: TimelineItem, href: string, time: number): boolean {
292
+ for (const ref of item.references) {
293
+ const hashIndex = ref.indexOf("#");
294
+ const refHref = hashIndex >= 0 ? ref.slice(0, hashIndex) : ref;
295
+ const refFragment = hashIndex >= 0 ? ref.slice(hashIndex + 1) : undefined;
296
+ if ((refHref || href) !== href) continue;
297
+ if (time >= Timeline.parseTimeFragment(refFragment)) return true;
298
+ }
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;
306
+ }
307
+
308
+ private bareHrefFromItem(item: TimelineItem): string {
309
+ return (item.references[0] ?? "").split("#")[0];
310
+ }
311
+
312
+ private timeFromItem(item: TimelineItem): number | undefined {
313
+ const ref = item.references[0];
314
+ if (!ref) return undefined;
315
+ const fragment = ref.split("#")[1];
316
+ if (!fragment) return undefined;
317
+ const match = fragment.match(/(?:^|&)t=(\d+(?:\.\d+)?)/);
318
+ return match ? parseFloat(match[1]) : undefined;
319
+ }
320
+
321
+ private ancestorPath(items: TimelineItem[], target: TimelineItem): TimelineItem[] | null {
322
+ for (const item of items) {
323
+ if (item === target) return [];
324
+ if (item.children) {
325
+ const path = this.ancestorPath(item.children, target);
326
+ if (path !== null) return [item, ...path];
327
+ }
328
+ }
329
+ return null;
330
+ }
331
+
332
+ private static bareHref(href: string): string {
333
+ return href.split("#")[0];
334
+ }
335
+ }
@@ -0,0 +1,24 @@
1
+ /**
2
+ * Represents a single entry in a publication's timeline.
3
+ *
4
+ * The timeline contextualizes the reading order and table of contents so that
5
+ * consuming apps can display the current chapter title, build a progress bar,
6
+ * show previous/next as chapter titles, group search results by chapter, etc.
7
+ */
8
+ export interface TimelineItem {
9
+ /** Display title of this entry. */
10
+ title: string;
11
+ /**
12
+ * References as hrefs with optional fragments.
13
+ * e.g. ["track1.mp3#t=60"] for audio, ["chapter1.html"] for EPUB, ["#page=6"] for PDF.
14
+ */
15
+ references: string[];
16
+ /** Structural roles of this entry, e.g. ["chapter"], ["part"]. */
17
+ role?: string[];
18
+ /** Position number in the reading order context. */
19
+ position?: number;
20
+ /** Scroll progression within the resource (0 to 1), for entries that start mid-way in a resource. */
21
+ scroll?: number;
22
+ /** Nested entries. */
23
+ children?: TimelineItem[];
24
+ }
@@ -0,0 +1,2 @@
1
+ export * from './Timeline';
2
+ export * from './TimelineItem';
@@ -6,12 +6,14 @@ import { Fetcher } from '../fetcher/Fetcher';
6
6
  import { PublicationCollection } from './PublicationCollection';
7
7
  import { Resource } from '../fetcher/Resource';
8
8
  import { GuidedNavigationDocument } from "./GuidedNavigation";
9
+ import { Timeline } from './services/timeline/Timeline';
9
10
  export type ServiceFactory = () => null;
10
11
  /** Shared model for a Readium Publication. */
11
12
  export declare class Publication {
12
13
  /** The manifest holding the publication metadata extracted from the publication file */
13
14
  manifest: Manifest;
14
15
  private readonly fetcher;
16
+ private _timeline;
15
17
  readonly context?: Array<string>;
16
18
  readonly metadata: Metadata;
17
19
  readonly links: Links;
@@ -27,6 +29,12 @@ export declare class Publication {
27
29
  manifest: Manifest;
28
30
  fetcher?: Fetcher;
29
31
  });
32
+ /**
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).
36
+ */
37
+ get timeline(): Timeline;
30
38
  /** The URL where this publication is served, computed from the `Link` with `self` relation.
31
39
  * e.g. https://provider.com/pub1293/manifest.json gives https://provider.com/pub1293/
32
40
  */
@@ -1 +1,2 @@
1
1
  export * from './content';
2
+ export * from './timeline';
@@ -0,0 +1,89 @@
1
+ import { Link, Links } from "../../Link";
2
+ import { Locator } from "../../Locator";
3
+ import { TimelineItem } from "./TimelineItem";
4
+ interface PublicationLike {
5
+ toc?: Links;
6
+ readingOrder: Links;
7
+ }
8
+ /**
9
+ * A publication's timeline, built once from its reading order and table of contents.
10
+ *
11
+ * **Source of truth**: the reading order. Every reading order item becomes
12
+ * exactly one top-level `TimelineItem`. The TOC is consulted to:
13
+ * 1. Derive a display title when the reading order item has none.
14
+ * 2. Populate flat children — all TOC fragment entries that reference the
15
+ * resource, collected depth-first in TOC declaration order.
16
+ *
17
+ * No TOC hierarchy is reconstructed; that requires role context and is not yet
18
+ * implemented. TOC entries whose href does not match any reading order item
19
+ * are ignored.
20
+ *
21
+ * The `depth` build option limits how many levels deep into the TOC tree both
22
+ * title resolution and child collection may look. Level 1 = top-level TOC
23
+ * entries; level 2 = their children; etc. `undefined` means no limit.
24
+ */
25
+ export declare class Timeline {
26
+ private readonly _allItems;
27
+ private readonly linkMap;
28
+ private _depth;
29
+ private _items;
30
+ private _flat;
31
+ constructor(items: TimelineItem[], linkMap: Map<TimelineItem, Link>);
32
+ static build(publication: PublicationLike, options?: {
33
+ depth?: number;
34
+ }): Timeline;
35
+ /**
36
+ * The active depth limit for TOC traversal (title resolution and child
37
+ * collection). `undefined` means unlimited. Setting the same value again
38
+ * is a no-op; a new value invalidates the cached items and flat list.
39
+ */
40
+ get depth(): number | undefined;
41
+ set depth(value: number | undefined);
42
+ /** Top-level timeline items. Cached; invalidated when `depth` changes. */
43
+ get items(): TimelineItem[];
44
+ locate(locator: Locator): TimelineItem | undefined;
45
+ adjacentTo(item: TimelineItem): {
46
+ previous: TimelineItem | undefined;
47
+ next: TimelineItem | undefined;
48
+ };
49
+ segmentsForHref(href: string): TimelineItem[];
50
+ itemAtProgression(href: string, progression: number, duration?: number): TimelineItem | undefined;
51
+ ancestors(item: TimelineItem): TimelineItem[];
52
+ linkFor(item: TimelineItem): Link | undefined;
53
+ private get flat();
54
+ /**
55
+ * Resolve a display title for `bare` from the TOC, looking no deeper than
56
+ * `maxDepth` levels (1 = top-level entries only). Priority:
57
+ * 1. A start-of-resource entry: bare href or `#t=0` (audio).
58
+ * 2. Exactly one fragment entry referencing this resource — unambiguous.
59
+ * 3. Multiple fragment entries — ambiguous, returns `undefined`.
60
+ */
61
+ private static findTitleInToc;
62
+ /**
63
+ * Collect all TOC entries that reference `bare` as flat children, walking
64
+ * up to `maxDepth` levels deep. Start-of-resource entries (#t=0 or no
65
+ * fragment) are excluded — they contribute to title resolution, not children.
66
+ * Order follows TOC declaration (depth-first).
67
+ */
68
+ private static collectChildrenFromToc;
69
+ /**
70
+ * Walk the TOC tree up to `maxDepth` levels and collect all entries whose
71
+ * bare href matches `bare`, split into start-of-resource entries and
72
+ * fragment entries.
73
+ */
74
+ private static collectTocCandidates;
75
+ /**
76
+ * 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).
78
+ */
79
+ private static isStartOfResource;
80
+ private static trimToDepth;
81
+ private flattenItems;
82
+ private itemMatchesTime;
83
+ private static parseTimeFragment;
84
+ private bareHrefFromItem;
85
+ private timeFromItem;
86
+ private ancestorPath;
87
+ private static bareHref;
88
+ }
89
+ export {};
@@ -0,0 +1,24 @@
1
+ /**
2
+ * Represents a single entry in a publication's timeline.
3
+ *
4
+ * The timeline contextualizes the reading order and table of contents so that
5
+ * consuming apps can display the current chapter title, build a progress bar,
6
+ * show previous/next as chapter titles, group search results by chapter, etc.
7
+ */
8
+ export interface TimelineItem {
9
+ /** Display title of this entry. */
10
+ title: string;
11
+ /**
12
+ * References as hrefs with optional fragments.
13
+ * e.g. ["track1.mp3#t=60"] for audio, ["chapter1.html"] for EPUB, ["#page=6"] for PDF.
14
+ */
15
+ references: string[];
16
+ /** Structural roles of this entry, e.g. ["chapter"], ["part"]. */
17
+ role?: string[];
18
+ /** Position number in the reading order context. */
19
+ position?: number;
20
+ /** Scroll progression within the resource (0 to 1), for entries that start mid-way in a resource. */
21
+ scroll?: number;
22
+ /** Nested entries. */
23
+ children?: TimelineItem[];
24
+ }
@@ -0,0 +1,2 @@
1
+ export * from './Timeline';
2
+ export * from './TimelineItem';
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1 @@
1
+ export {};