bok-reader 0.5.3 → 0.6.0

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 CHANGED
@@ -45,10 +45,22 @@ export default MyBookViewer;
45
45
  - `onTitleChange?`: `(title: string) => void` - Callback when the book title is loaded.
46
46
  - `onLoadingChange?`: `(isLoading: boolean) => void` - Callback when the loading state changes.
47
47
  - `onError?`: `(errorMsg: string) => void` - Callback when an error occurs during loading or processing.
48
+ - `onSyncEvent?`: `(event: BokReaderSyncEvent) => void` - Emits semantic local mutations for sync queues (`progress.set`, `highlight.add`, `highlight.remove`, `highlight.updateColor`).
49
+ - `syncState?`: `BokReaderSyncState | null` - Host-provided remote/hydrated state for the current `bookId`.
50
+ - `onConflictDetected?`: `(conflict: BokReaderSyncConflict) => void` - Called when incoming `syncState` conflicts with non-empty local data and `forceApply` is not set.
48
51
  - `supportedFonts?`: `{ displayName: string; name: string }[]` - Array of custom fonts to make available in the options menu.
49
52
  - `color?`: `string` - Hexadecimal value. Color tint of the component.
50
53
  - `style?`: `React.CSSProperties` - Optional inline styles for the main wrapper component.
51
54
 
55
+ ## Imperative Sync API (ref)
56
+
57
+ `BokReader` exposes a ref handle:
58
+
59
+ - `getSyncSnapshot(): BokReaderSyncSnapshot | null`
60
+ - `applySyncState(syncState: BokReaderSyncState, options?: { forceApply?: boolean }): boolean` (`true` means accepted: applied now or queued until reader is ready)
61
+ - `getPendingSyncEvents(): BokReaderSyncEvent[]`
62
+ - `acknowledgeSyncEvents(mutationIds: string | string[]): void`
63
+
52
64
  ## Development Scripts
53
65
 
54
66
  - `npm run dev`: Start development server.