vomebook commited on
Commit
67cbd61
·
1 Parent(s): 63e3e38

Fix Reader speech, progress undo and search keyboard actions

Browse files
static/reader/core/reader-bindings.mjs CHANGED
@@ -831,11 +831,11 @@ export function createReaderBindings(readerContext) {
831
  }
832
 
833
  function bindProgressActions() {
 
834
  const startSeeking = () => {
835
  if (readerContext.progressSeeking) return;
836
- readerContext.beginReaderNavigation();
837
  readerContext.progressSeeking = true;
838
- readerContext.previousProgressState = readerContext.captureProgressState();
839
  };
840
  const finishSeeking = () => {
841
  if (!readerContext.progressSeeking) return;
@@ -858,7 +858,9 @@ export function createReaderBindings(readerContext) {
858
  readerContext.progressRange.addEventListener("input", () => {
859
  readerContext.progressPercent.textContent = `${Number(readerContext.progressRange.value).toFixed(1)}%`;
860
  readerContext.progressRange.setAttribute("aria-valuetext", readerContext.progressPercent.textContent);
861
- readerContext.seekProgress(readerContext.progressRange.value, true);
 
 
862
  });
863
  for (const type of ["pointerup", "pointercancel"])
864
  readerContext.progressRange.addEventListener(type, finishSeeking);
 
831
  }
832
 
833
  function bindProgressActions() {
834
+ let seekChanged = false;
835
  const startSeeking = () => {
836
  if (readerContext.progressSeeking) return;
 
837
  readerContext.progressSeeking = true;
838
+ seekChanged = false;
839
  };
840
  const finishSeeking = () => {
841
  if (!readerContext.progressSeeking) return;
 
858
  readerContext.progressRange.addEventListener("input", () => {
859
  readerContext.progressPercent.textContent = `${Number(readerContext.progressRange.value).toFixed(1)}%`;
860
  readerContext.progressRange.setAttribute("aria-valuetext", readerContext.progressPercent.textContent);
861
+ // A key or pointer press may leave the value unchanged. Snapshot only on input.
862
+ readerContext.seekProgress(readerContext.progressRange.value, readerContext.progressSeeking && seekChanged);
863
+ seekChanged = true;
864
  });
865
  for (const type of ["pointerup", "pointercancel"])
866
  readerContext.progressRange.addEventListener(type, finishSeeking);
static/reader/ui/reader-speech.mjs CHANGED
@@ -86,7 +86,7 @@ export function createReaderSpeech(readerContext) {
86
  function foliateSections() {
87
  return (readerContext.epubBook?.sections || []).filter((section) => section.linear !== "no");
88
  }
89
- function chapterList() { return readerContext.chapterSearchConfiguration?.chapters || []; }
90
  function pageCount() { return Number(readerContext.documentState?.pageCount) || 0; }
91
 
92
  function hasText() {
@@ -126,13 +126,15 @@ export function createReaderSpeech(readerContext) {
126
  };
127
  }
128
  if (current === "epub-chapters") {
129
- const chapters = chapterList();
 
 
130
  /** @param {number} index */
131
- const root = (index) => readerContext.content.querySelector(`.reader-epub-chapter[data-chapter="${chapters[index]?.index}"]`);
132
  return {
133
- units: chapters.length, first: 0, root,
134
- load: async (index) => rootText(root(index) || await readerContext.chapterManifestLoader?.(chapters[index].index)),
135
- locate: (index) => readerContext.chapterManifestLoader?.(chapters[index].index)
136
  };
137
  }
138
  if (current === "pdf" || current === "pdf-pages") {
@@ -373,12 +375,16 @@ export function createReaderSpeech(readerContext) {
373
  .find((node) => node.getBoundingClientRect().bottom > box.top + 8);
374
  unit = article ? Number(/** @type {HTMLElement} */ (article).dataset.section) : 0;
375
  } else if (current === "epub-chapters") {
376
- const chapters = chapterList();
377
  const article = [...readerContext.content.querySelectorAll(".reader-epub-chapter[data-chapter]")]
378
  .find((node) => node.getBoundingClientRect().bottom > box.top + 8);
379
- unit = article ? Math.max(0, chapters.findIndex((chapter) => String(chapter.index) === /** @type {HTMLElement} */ (article).dataset.chapter)) : 0;
 
380
  } else if (info.page) {
381
- unit = Math.max(1, Number(readerContext.pageAtMarker?.()) || Number(readerContext.documentState?.page) || 1);
 
 
 
 
382
  }
383
  const root = info.root(unit);
384
  if (!root) return { unit, offset: 0 };
 
86
  function foliateSections() {
87
  return (readerContext.epubBook?.sections || []).filter((section) => section.linear !== "no");
88
  }
89
+ function chapterCount() { return readerContext.chapterManifestLoader?.count || 0; }
90
  function pageCount() { return Number(readerContext.documentState?.pageCount) || 0; }
91
 
92
  function hasText() {
 
126
  };
127
  }
128
  if (current === "epub-chapters") {
129
+ // Valid chapter manifests have consecutive 1-based indices. Reading
130
+ // their text doesn't require the optional full-text search index.
131
+ const loader = readerContext.chapterManifestLoader;
132
  /** @param {number} index */
133
+ const root = (index) => readerContext.content.querySelector(`.reader-epub-chapter[data-chapter="${index + 1}"]`);
134
  return {
135
+ units: chapterCount(), first: 0, root,
136
+ load: async (index) => rootText(root(index) || await loader?.(index + 1)),
137
+ locate: (index) => loader?.(index + 1)
138
  };
139
  }
140
  if (current === "pdf" || current === "pdf-pages") {
 
375
  .find((node) => node.getBoundingClientRect().bottom > box.top + 8);
376
  unit = article ? Number(/** @type {HTMLElement} */ (article).dataset.section) : 0;
377
  } else if (current === "epub-chapters") {
 
378
  const article = [...readerContext.content.querySelectorAll(".reader-epub-chapter[data-chapter]")]
379
  .find((node) => node.getBoundingClientRect().bottom > box.top + 8);
380
+ const chapter = Number(/** @type {HTMLElement | undefined} */ (article)?.dataset.chapter);
381
+ unit = Number.isInteger(chapter) && chapter >= 1 && chapter <= info.units ? chapter - 1 : 0;
382
  } else if (info.page) {
383
+ // The marker returns a page element; the saved page can lag behind it.
384
+ const marker = Number(readerContext.pageAtMarker?.()?.dataset.page);
385
+ const page = Number.isInteger(marker) && marker >= info.first && marker < info.units
386
+ ? marker : Number(readerContext.documentState?.page) || info.first;
387
+ unit = Math.max(info.first, Math.min(info.units - 1, page));
388
  }
389
  const root = info.root(unit);
390
  if (!root) return { unit, offset: 0 };
static/search/history/application/controller.js CHANGED
@@ -78,7 +78,7 @@
78
  const next = event.key === 'ArrowDown' ? index + 1 : index - 1;
79
  event.preventDefault(); event.stopPropagation();
80
  if (next < 0) searchInput.focus({ preventScroll: true });
81
- else buttons[Math.min(next, buttons.length - 1)]?.focus({ preventScroll: true });
82
  }
83
  });
84
  /** @param {Event} event */
 
78
  const next = event.key === 'ArrowDown' ? index + 1 : index - 1;
79
  event.preventDefault(); event.stopPropagation();
80
  if (next < 0) searchInput.focus({ preventScroll: true });
81
+ else buttons[Math.min(next, buttons.length - 1)]?.focus();
82
  }
83
  });
84
  /** @param {Event} event */
static/search/results/application/interactions.js CHANGED
@@ -4,6 +4,17 @@
4
  function create(deps) {
5
  const { elements, selection } = deps;
6
 
 
 
 
 
 
 
 
 
 
 
 
7
  function installSelection() {
8
  if (elements.multiSelectToggle) elements.multiSelectToggle.addEventListener("change", deps.updateSelectionUI);
9
  elements.resultsList.addEventListener("click", function(e) {
@@ -28,9 +39,7 @@
28
  if (elements.multiCopyLinks) elements.multiCopyLinks.addEventListener("click", function() {
29
  const links = deps.getSelectedFiles().map(item => deps.getCopyableLink(item.link));
30
  if (links.length === 0) { deps.showToast("未选中任何文件"); return; }
31
- navigator.clipboard.writeText(links.join("\n")).then(function() {
32
- deps.showToast("已复制 " + links.length + " 条链接");
33
- }).catch(function() { deps.showToast("复制失败"); });
34
  });
35
  if (elements.multiBatchDownload) elements.multiBatchDownload.addEventListener("click", function() {
36
  deps.startDownloadBatch(deps.getSelectedFiles());
@@ -68,7 +77,7 @@
68
  e.preventDefault();
69
  const action = actionBtn.dataset.action;
70
  if (action === "copy") {
71
- try { await navigator.clipboard.writeText(/** @type {string} */ (actionBtn.dataset.link)); deps.showToast("链接已复制"); } catch { deps.showToast("复制失败"); }
72
  return;
73
  }
74
  if (action === "download") {
 
4
  function create(deps) {
5
  const { elements, selection } = deps;
6
 
7
+ /** @param {string} text @param {string} success */
8
+ async function copyLinks(text, success) {
9
+ try {
10
+ await navigator.clipboard.writeText(text);
11
+ } catch {
12
+ deps.showToast("复制失败");
13
+ return;
14
+ }
15
+ deps.showToast(success);
16
+ }
17
+
18
  function installSelection() {
19
  if (elements.multiSelectToggle) elements.multiSelectToggle.addEventListener("change", deps.updateSelectionUI);
20
  elements.resultsList.addEventListener("click", function(e) {
 
39
  if (elements.multiCopyLinks) elements.multiCopyLinks.addEventListener("click", function() {
40
  const links = deps.getSelectedFiles().map(item => deps.getCopyableLink(item.link));
41
  if (links.length === 0) { deps.showToast("未选中任何文件"); return; }
42
+ return copyLinks(links.join("\n"), "已复制 " + links.length + " 条链接");
 
 
43
  });
44
  if (elements.multiBatchDownload) elements.multiBatchDownload.addEventListener("click", function() {
45
  deps.startDownloadBatch(deps.getSelectedFiles());
 
77
  e.preventDefault();
78
  const action = actionBtn.dataset.action;
79
  if (action === "copy") {
80
+ await copyLinks(/** @type {string} */ (actionBtn.dataset.link), "链接已复制");
81
  return;
82
  }
83
  if (action === "download") {
tests/reader/core/test_reader_bindings_boundary.mjs CHANGED
@@ -1,6 +1,7 @@
1
  import { test } from 'node:test';
2
  import assert from 'node:assert/strict';
3
  import { createReaderBindings } from '../../../static/reader/core/reader-bindings.mjs';
 
4
 
5
  function storage(values = {}) {
6
  const data = new Map(Object.entries(values));
@@ -69,3 +70,48 @@ test('pointer movement never passes undefined coordinates to selection correctio
69
  callback();
70
  assert.deepEqual(coordinates, [1, 2]);
71
  });
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
  import { test } from 'node:test';
2
  import assert from 'node:assert/strict';
3
  import { createReaderBindings } from '../../../static/reader/core/reader-bindings.mjs';
4
+ import { createReaderProgress } from '../../../static/reader/ui/reader-progress.mjs';
5
 
6
  function storage(values = {}) {
7
  const data = new Map(Object.entries(values));
 
70
  callback();
71
  assert.deepEqual(coordinates, [1, 2]);
72
  });
73
+
74
+ test('pressing End on the progress slider at 100% preserves the previous seek for Undo', async (t) => {
75
+ if (!globalThis.document) {
76
+ globalThis.document = {};
77
+ t.after(() => { delete globalThis.document; });
78
+ }
79
+ const range = Object.assign(new EventTarget(), { value: '0', setAttribute() {} });
80
+ let generation = 0;
81
+ const context = {
82
+ capability: { mode: 'markdown' }, viewport: { scrollTop: 0, scrollHeight: 1000, clientHeight: 100 },
83
+ progressRange: range, progressPercent: {}, progressUndo: new EventTarget(),
84
+ chapterPrev: new EventTarget(), chapterNext: new EventTarget(),
85
+ progressSeeking: false, previousProgressState: null, epubSeekPromise: Promise.resolve(),
86
+ beginReaderNavigation() { return ++generation; },
87
+ readerRuntime: { currentGeneration: () => generation },
88
+ isReaderGenerationCurrent: (_, value) => value === generation,
89
+ scheduleSave() {}, updateProgressTools() {}
90
+ };
91
+ const { seekProgress, captureProgressState, restoreProgressState, flushEpubSeek } = createReaderProgress(context);
92
+ Object.assign(context, { seekProgress, captureProgressState, restoreProgressState, flushEpubSeek });
93
+ createReaderBindings(context).bindProgressActions();
94
+ const key = type => range.dispatchEvent(Object.assign(new Event(type), { key: 'End' }));
95
+ const drag = (...values) => {
96
+ range.dispatchEvent(new Event('pointerdown'));
97
+ for (const value of values) {
98
+ range.value = value;
99
+ range.dispatchEvent(new Event('input'));
100
+ }
101
+ range.dispatchEvent(new Event('pointerup'));
102
+ };
103
+ drag('20');
104
+ assert.deepEqual(context.previousProgressState, { scrollTop: 0 });
105
+ drag('90', '100');
106
+ assert.equal(context.viewport.scrollTop, 900);
107
+ assert.deepEqual(context.previousProgressState, { scrollTop: 180 }, 'keep one undo point across drag events');
108
+
109
+ // At the upper limit the browser emits key events, but no input event.
110
+ const before = generation;
111
+ key('keydown');
112
+ key('keyup');
113
+ context.progressUndo.dispatchEvent(new Event('click'));
114
+ assert.equal(context.viewport.scrollTop, 180);
115
+ assert.equal(generation, before + 1, 'only Undo should start a navigation');
116
+ await context.epubSeekPromise;
117
+ });
tests/reader/core/test_reader_regression.js CHANGED
@@ -463,3 +463,64 @@ require('node:test')('Markdown restores saved positions without overriding expli
463
  if (expected === bookmark.scrollTop) assert.strictEqual(globalThis.location.searchParams.has('bookmark'), false)
464
  }
465
  })
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
463
  if (expected === bookmark.scrollTop) assert.strictEqual(globalThis.location.searchParams.has('bookmark'), false)
464
  }
465
  })
466
+
467
+ require('node:test')('Reader speech uses the visible PDF page and does not require a chapter search index', async (t) => {
468
+ const { createReaderSpeech } = await import('../../../static/reader/ui/reader-speech.mjs')
469
+ const keys = ['window', 'document', 'NodeFilter', 'CCRDSpeech', 'sessionStorage', 'localStorage']
470
+ const previous = keys.map(key => [key, Object.getOwnPropertyDescriptor(globalThis, key)])
471
+ t.after(() => {
472
+ for (const [key, descriptor] of previous) {
473
+ if (descriptor) Object.defineProperty(globalThis, key, descriptor)
474
+ else delete globalThis[key]
475
+ }
476
+ })
477
+ const published = []
478
+ Object.assign(globalThis, {
479
+ window: Object.assign(new EventTarget(), { name: '' }),
480
+ document: Object.assign(new EventTarget(), { querySelector: () => null }),
481
+ NodeFilter: { SHOW_TEXT: 4 },
482
+ CCRDSpeech: { previewClosed() {}, previewLoaded: value => published.push(value.adapter) }
483
+ })
484
+ for (const key of ['sessionStorage', 'localStorage'])
485
+ Object.defineProperty(globalThis, key, { configurable: true, value: { removeItem() {} } })
486
+ const rect = { top: 0, bottom: 20, height: 20 }
487
+ const textElement = (data, dataset = {}) => ({ dataset, getBoundingClientRect: () => rect, ownerDocument: {
488
+ createTreeWalker() {
489
+ let read = false
490
+ return { nextNode() { if (read) return null; read = true; return { data, length: data.length } } }
491
+ },
492
+ createRange: () => ({ setStart() {}, setEnd() {}, getClientRects: () => [rect], getBoundingClientRect: () => rect })
493
+ } })
494
+ const pdfText = textElement('Visible PDF text.')
495
+ const pdfPage = { dataset: { page: '8', textReady: '1' }, querySelector: () => pdfText }
496
+ const chapter = textElement('Second chapter text.', { chapter: '2' })
497
+ const viewport = Object.assign(new EventTarget(), { getBoundingClientRect: () => ({ top: 0, bottom: 800 }) })
498
+ let phase
499
+ const context = {
500
+ capability: { mode: 'pdf' }, sourceUrl: 'fixture', viewport,
501
+ content: { querySelector: selector => selector.includes('data-page="8"') ? pdfPage : null },
502
+ documentState: { page: 26, pageCount: 40 }, pageAtMarker: () => pdfPage,
503
+ readerRuntime: { events: { on: (_, callback) => { phase = callback } } }
504
+ }
505
+ createReaderSpeech(context).installReaderSpeech()
506
+ phase({ phase: 'ready' })
507
+ await new Promise(setImmediate)
508
+ assert.strictEqual(published.length, 1, 'a stale saved page must not hide speech on the visible page')
509
+ const pdf = published[0]
510
+ assert.strictEqual(pdf.base, 7)
511
+ assert.strictEqual(pdf.partAt(await pdf.locateTop()).unit, 8)
512
+
513
+ const loads = []
514
+ Object.assign(context, { capability: { mode: 'epub-chapters' }, chapterSearchConfiguration: null,
515
+ chapterManifestLoader: Object.assign(async index => { loads.push(index); return textElement('First chapter text.') }, { count: 2 }),
516
+ content: { querySelector: selector => selector.includes('data-chapter="2"') ? chapter : null,
517
+ querySelectorAll: () => [chapter] } })
518
+ phase({ phase: 'ready' })
519
+ assert.strictEqual(published.length, 2, 'a chapter manifest alone is sufficient for speech')
520
+ const epub = published[1]
521
+ const part = epub.partAt(await epub.locateTop())
522
+ assert.strictEqual(part.unit, 1)
523
+ assert.strictEqual(part.raw, 'Second chapter text.')
524
+ assert.deepStrictEqual(loads, [1], 'translate player units to one-based Reader chapter indices')
525
+ phase({ phase: 'disposed' })
526
+ })
tests/search/ui/history_quotation_contracts.mjs CHANGED
@@ -43,7 +43,7 @@ function historyFixture() {
43
  b.dataset = kind === 'del' ? {del: row.dataset.query} : {};
44
  b.matches = selector => selector === '.history-' + kind;
45
  b.closest = selector => selector === '.history-item' ? row : selector.includes('.history-' + kind) ? b : null;
46
- b.focus = () => { c.document.activeElement = b; }; return b;
47
  }
48
  dropdown.contains = el => !!el && rows.includes(el.row);
49
  dropdown.querySelectorAll = selector => selector === '.history-item' ? rows : rows.map(row => row.text);
@@ -135,6 +135,21 @@ test('history keyboard, delete focus, native activation, clear and submission ow
135
  assert.deepEqual(plain(c.getHistory()), []); assert.equal(f.dropdown.style.display, 'none'); assert.equal(c.document.activeElement, f.input);
136
  });
137
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
138
  test('history preserves listener order, live IME guards, hover/blur delay and long-press cancellation', async () => {
139
  const f = historyFixture(), {c} = f;
140
  assert.deepEqual(f.listeners.slice(0, 6).map(item => item.slice(0, 2)), [['input', 'focus'], ['box', 'focusout'], ['dropdown', 'mouseenter'], ['dropdown', 'mouseleave'], ['document', 'pointerdown'], ['box', 'keydown']]);
 
43
  b.dataset = kind === 'del' ? {del: row.dataset.query} : {};
44
  b.matches = selector => selector === '.history-' + kind;
45
  b.closest = selector => selector === '.history-item' ? row : selector.includes('.history-' + kind) ? b : null;
46
+ b.focus = options => { c.document.activeElement = b; b.focusOptions = options; }; return b;
47
  }
48
  dropdown.contains = el => !!el && rows.includes(el.row);
49
  dropdown.querySelectorAll = selector => selector === '.history-item' ? rows : rows.map(row => row.text);
 
135
  assert.deepEqual(plain(c.getHistory()), []); assert.equal(f.dropdown.style.display, 'none'); assert.equal(c.document.activeElement, f.input);
136
  });
137
 
138
+ test('history arrow navigation lets the browser scroll the focused entry into view', () => {
139
+ const f = historyFixture(), {c} = f;
140
+ c.saveHistory(Array.from({length: 20}, (_, i) => 'query ' + i));
141
+ f.input.focus();
142
+ for (let i = 0; i < f.rows.length; i++) {
143
+ const event = f.key('ArrowDown', c.document.activeElement);
144
+ assert.equal(event.prevented, true);
145
+ assert.equal(c.document.activeElement, f.rows[i].text);
146
+ assert.notEqual(f.rows[i].text.focusOptions?.preventScroll, true, 'focus must scroll entries in the overflow menu into view');
147
+ }
148
+ f.key('ArrowUp', c.document.activeElement);
149
+ assert.equal(c.document.activeElement, f.rows[18].text);
150
+ assert.notEqual(f.rows[18].text.focusOptions?.preventScroll, true);
151
+ });
152
+
153
  test('history preserves listener order, live IME guards, hover/blur delay and long-press cancellation', async () => {
154
  const f = historyFixture(), {c} = f;
155
  assert.deepEqual(f.listeners.slice(0, 6).map(item => item.slice(0, 2)), [['input', 'focus'], ['box', 'focusout'], ['dropdown', 'mouseenter'], ['dropdown', 'mouseleave'], ['document', 'pointerdown'], ['box', 'keydown']]);
tests/search/ui/result_interactions_contracts.mjs CHANGED
@@ -116,6 +116,21 @@ test('result actions retain current Reader asset, clipboard failures and shared
116
  assert.equal(f.toasts.at(-1), '复制失败');
117
  });
118
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
119
  test('breadcrumb keyboard respects IME and native controls; route merges query and sidebar dataset differs by site', async () => {
120
  const f = fixture(), {c, DOM, click} = f;
121
  let activated = 0;
 
116
  assert.equal(f.toasts.at(-1), '复制失败');
117
  });
118
 
119
+ test('single and bulk copy report an unavailable clipboard or synchronous failure', async () => {
120
+ const f = fixture(), {c, DOM, click} = f;
121
+ const button = node({action: 'copy', link: 'copy-me'});
122
+ button.closest = selector => selector === '[data-action]' ? button : null;
123
+ c.selectedIndices = {0: true};
124
+ for (const clipboard of [undefined, {writeText() { throw new Error('disabled'); }}]) {
125
+ c.navigator.clipboard = clipboard;
126
+ f.toasts.length = 0;
127
+ await click(DOM.resultsList, button);
128
+ await click(DOM.multiCopyLinks, DOM.multiCopyLinks);
129
+ assert.deepEqual(f.toasts, ['复制失败', '复制失败']);
130
+ assert.deepEqual(f.copied, []);
131
+ }
132
+ });
133
+
134
  test('breadcrumb keyboard respects IME and native controls; route merges query and sidebar dataset differs by site', async () => {
135
  const f = fixture(), {c, DOM, click} = f;
136
  let activated = 0;
typings/reader-speech-strict.d.ts CHANGED
@@ -8,8 +8,7 @@ export interface SpeechContext {
8
  epubBook: { sections: FoliateSection[] } | null;
9
  foliateSectionRoot(article: Element): Element | ShadowRoot;
10
  foliateSectionLoader: ((index: number) => Promise<unknown>) | null;
11
- chapterSearchConfiguration: { chapters: { index: number }[] } | null;
12
- chapterManifestLoader: ((index: number) => Promise<HTMLElement | null>) | null;
13
  documentState: { pageCount: number; page: number };
14
  ocrManifestUrl: string; pdfOcrManifest: object | null;
15
  pdfDocument: { getPage(page: number): Promise<PdfPage> } | null;
 
8
  epubBook: { sections: FoliateSection[] } | null;
9
  foliateSectionRoot(article: Element): Element | ShadowRoot;
10
  foliateSectionLoader: ((index: number) => Promise<unknown>) | null;
11
+ chapterManifestLoader: (((index: number) => Promise<HTMLElement | null>) & { count: number }) | null;
 
12
  documentState: { pageCount: number; page: number };
13
  ocrManifestUrl: string; pdfOcrManifest: object | null;
14
  pdfDocument: { getPage(page: number): Promise<PdfPage> } | null;