pdfjs-reader-core 0.4.1 → 0.4.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.
- package/README.md +5 -0
- package/dist/index.cjs +1504 -450
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +115 -23
- package/dist/index.d.ts +115 -23
- package/dist/index.js +1493 -439
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -1105,12 +1105,15 @@ export function TutorScene({
|
|
|
1105
1105
|
pdfUrl,
|
|
1106
1106
|
bboxData,
|
|
1107
1107
|
currentPage,
|
|
1108
|
+
onPageChange,
|
|
1108
1109
|
currentChunk,
|
|
1109
1110
|
llm,
|
|
1110
1111
|
}: {
|
|
1111
1112
|
pdfUrl: string;
|
|
1112
1113
|
bboxData: PageBBoxData[];
|
|
1113
1114
|
currentPage: number;
|
|
1115
|
+
/** Called when the viewer (or agent) changes the page — keep state in sync. */
|
|
1116
|
+
onPageChange: (page: number) => void;
|
|
1114
1117
|
/** The text the voice agent is currently speaking. Update reactively. */
|
|
1115
1118
|
currentChunk: string | null;
|
|
1116
1119
|
llm: LlmConfig;
|
|
@@ -1124,6 +1127,7 @@ export function TutorScene({
|
|
|
1124
1127
|
<DocumentLoader url={pdfUrl} />
|
|
1125
1128
|
<TutorModeContainer
|
|
1126
1129
|
pageNumber={currentPage}
|
|
1130
|
+
onPageChange={onPageChange} // ← bidirectional sync for agent nav
|
|
1127
1131
|
bboxData={bboxData}
|
|
1128
1132
|
narrationStore={storeRef.current}
|
|
1129
1133
|
scale={1}
|
|
@@ -1273,6 +1277,7 @@ default. Clicking it clears every overlay and returns the camera to fit-page.
|
|
|
1273
1277
|
| `onExitTutorMode` | `() => void` | — | Optional callback fired AFTER the reset — use it to also leave tutor mode |
|
|
1274
1278
|
| `backgroundColor` | `string` | `'#ffffff'` | Surround colour visible around the PDF when the viewport is larger than the page fit. v0.4.1+ |
|
|
1275
1279
|
| `loadingComponent` | `ReactNode` | default spinner | Custom loading state shown while the PDF document/page is still fetching. v0.4.1+ |
|
|
1280
|
+
| `onPageChange` | `(page: number) => void` | — | Called when the viewer's page changes from any source (agent API, sidebar, programmatic). Pair with the `pageNumber` prop for bidirectional sync. **Required** when agents call `goToPage`/`nextPage`/`previousPage`. v0.4.2+ |
|
|
1276
1281
|
| `className` | `string` | — | Passes through to the root container for custom theming |
|
|
1277
1282
|
|
|
1278
1283
|
### LlmConfig
|