@papyrus-sdk/ui-react-native 0.2.35-beta.1 → 0.2.35-beta.11

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
@@ -5,10 +5,12 @@ React Native UI components for Papyrus viewers.
5
5
  ## Install
6
6
 
7
7
  ```bash
8
- npm install @papyrus-sdk/ui-react-native @papyrus-sdk/engine-native @papyrus-sdk/core @papyrus-sdk/types react-native-gesture-handler
8
+ npm install @papyrus-sdk/ui-react-native @papyrus-sdk/engine-native @papyrus-sdk/core @papyrus-sdk/types react-native-gesture-handler react-native-reanimated@^3.19.5
9
9
  ```
10
10
 
11
- `@papyrus-sdk/core`, `@papyrus-sdk/types`, and `react-native-gesture-handler` are required peer dependencies.
11
+ `@papyrus-sdk/core`, `@papyrus-sdk/types`, `react-native-gesture-handler`, and `react-native-reanimated` (3.19.5+) are required peer dependencies.
12
+
13
+ Configure Reanimated 3 in the host app, with `react-native-reanimated/plugin` last in the Babel plugin list. The native iOS PDF annotation mode animates the Topbar and dock; it respects the system Reduce Motion setting. While drawing, Concluir/Done closes the ink session through the existing store/native flush flow. The first Back press finishes drawing without leaving the reader; the next press navigates back.
12
14
 
13
15
  Wrap the app root with `GestureHandlerRootView` before rendering Papyrus components:
14
16
 
@@ -160,3 +162,7 @@ If large files fail to load or crash on mobile:
160
162
  - Runtime EPUB open/ready timeout: `180000ms`
161
163
  - Runtime EPUB display timeout: `30000ms`
162
164
  - For very large EPUBs, first-open can take longer on mid-tier Android. This is expected due to zip parsing and spine bootstrapping.
165
+
166
+ ## Native ink motion packaging check
167
+
168
+ Run `pnpm --filter @papyrus-sdk/ui-react-native check:ink-worklets` before publishing. This builds and verifies all three ink chrome callbacks through the Reanimated Babel plugin in both CJS and ESM artifacts. Keep explicit `"worklet"` directives: bundler aliases such as `useAnimatedStyle2` are not automatically recognized by the plugin.
package/dist/index.d.mts CHANGED
@@ -6,6 +6,8 @@ import { StyleProp, ViewStyle } from 'react-native';
6
6
 
7
7
  interface ViewerProps {
8
8
  engine: DocumentEngine;
9
+ /** Stable file identity, never the native engine/session ID. */
10
+ documentId?: string;
9
11
  /** Maximum page width at fit zoom, in React Native points; pinch zoom may enlarge it. */
10
12
  maxPageWidth?: number;
11
13
  /**
@@ -30,6 +32,20 @@ interface ViewerProps {
30
32
  text: string;
31
33
  pageIndex: number;
32
34
  }) => void;
35
+ /** Controls which native PDF selections can be sent to the dictionary. */
36
+ defineSelectionMode?: "selection" | "single-word";
37
+ /** Called when the native TXT view selects a UTF-16 range. */
38
+ onTextRangeSelected?: (payload: {
39
+ text: string;
40
+ start: number;
41
+ end: number;
42
+ }) => void;
43
+ /** Called when Define is chosen for a native TXT range. */
44
+ onDefineTextSelection?: (payload: {
45
+ text: string;
46
+ start: number;
47
+ end: number;
48
+ }) => void;
33
49
  }
34
50
  declare const Viewer: React.FC<ViewerProps>;
35
51
 
@@ -63,6 +79,7 @@ declare function useMobilePerf(): PerfSession;
63
79
  type PageViewComponentType = React.ComponentType<PapyrusPageViewProps & React.RefAttributes<any>>;
64
80
  interface PageRendererProps {
65
81
  engine: DocumentEngine;
82
+ documentId?: string;
66
83
  pageIndex: number;
67
84
  scale?: number;
68
85
  pageAspectRatio?: number;
@@ -107,12 +124,17 @@ interface RightSheetProps {
107
124
  }
108
125
  declare const RightSheet: React.FC<RightSheetProps>;
109
126
 
110
- declare const AnnotationEditor: React.FC;
127
+ declare const AnnotationEditor: React.FC<{
128
+ documentId?: string;
129
+ }>;
111
130
 
112
131
  type BottomBarProps = {
113
132
  documentType: DocumentType;
114
133
  onOpenInfo: () => void;
115
134
  onOpenSettings: () => void;
135
+ onTurnPage?: (direction: -1 | 1) => void;
136
+ onNavigateToPage?: (page: number) => void;
137
+ onOpenPages?: () => void;
116
138
  onOpenDestination?: (destination: MobilePrimaryDestination) => void;
117
139
  };
118
140
  declare const BottomBar: React.FC<BottomBarProps>;
@@ -121,6 +143,8 @@ interface SettingsSheetProps {
121
143
  engine: DocumentEngine;
122
144
  visible: boolean;
123
145
  onClose: () => void;
146
+ documentType?: DocumentType;
147
+ onOpenInfo?: () => void;
124
148
  }
125
149
  declare const SettingsSheet: React.FC<SettingsSheetProps>;
126
150
 
@@ -153,6 +177,7 @@ declare function ReadingShell({ engine, title, documentType, thumbsInitialCount,
153
177
 
154
178
  type NativePdfDocumentViewerProps = {
155
179
  engine: DocumentEngine;
180
+ documentId?: string;
156
181
  maxPageWidth?: number;
157
182
  onTextSelected?: (payload: {
158
183
  text: string;
@@ -162,8 +187,9 @@ type NativePdfDocumentViewerProps = {
162
187
  text: string;
163
188
  pageIndex: number;
164
189
  }) => void;
190
+ defineSelectionMode?: "selection" | "single-word";
165
191
  };
166
- declare function NativePdfDocumentViewer({ engine, maxPageWidth, onTextSelected, onDefineSelection, }: NativePdfDocumentViewerProps): react_jsx_runtime.JSX.Element;
192
+ declare function NativePdfDocumentViewer({ engine, documentId, maxPageWidth, onTextSelected, onDefineSelection, defineSelectionMode, }: NativePdfDocumentViewerProps): react_jsx_runtime.JSX.Element;
167
193
 
168
194
  type OverflowSheetProps = {
169
195
  visible: boolean;
@@ -188,12 +214,14 @@ declare function DocumentActionsSheet({ visible, onClose, }: DocumentActionsShee
188
214
 
189
215
  type ProgressPillProps = {
190
216
  documentType: DocumentType;
217
+ navigationInDock?: boolean;
191
218
  onPress: () => void;
192
219
  onOpenPageJump?: () => void;
193
220
  onNavigateToPage?: (page: number) => void;
221
+ onTurnPage?: (direction: -1 | 1) => void;
194
222
  onScrubbingChange?: (active: boolean) => void;
195
223
  };
196
- declare function ProgressPill({ documentType, onPress, onOpenPageJump, onNavigateToPage, onScrubbingChange, }: ProgressPillProps): react_jsx_runtime.JSX.Element;
224
+ declare function ProgressPill({ documentType, navigationInDock, onPress, onOpenPageJump, onNavigateToPage, onTurnPage, onScrubbingChange, }: ProgressPillProps): react_jsx_runtime.JSX.Element;
197
225
 
198
226
  type SearchOverlayProps = {
199
227
  engine: DocumentEngine;
package/dist/index.d.ts CHANGED
@@ -6,6 +6,8 @@ import { StyleProp, ViewStyle } from 'react-native';
6
6
 
7
7
  interface ViewerProps {
8
8
  engine: DocumentEngine;
9
+ /** Stable file identity, never the native engine/session ID. */
10
+ documentId?: string;
9
11
  /** Maximum page width at fit zoom, in React Native points; pinch zoom may enlarge it. */
10
12
  maxPageWidth?: number;
11
13
  /**
@@ -30,6 +32,20 @@ interface ViewerProps {
30
32
  text: string;
31
33
  pageIndex: number;
32
34
  }) => void;
35
+ /** Controls which native PDF selections can be sent to the dictionary. */
36
+ defineSelectionMode?: "selection" | "single-word";
37
+ /** Called when the native TXT view selects a UTF-16 range. */
38
+ onTextRangeSelected?: (payload: {
39
+ text: string;
40
+ start: number;
41
+ end: number;
42
+ }) => void;
43
+ /** Called when Define is chosen for a native TXT range. */
44
+ onDefineTextSelection?: (payload: {
45
+ text: string;
46
+ start: number;
47
+ end: number;
48
+ }) => void;
33
49
  }
34
50
  declare const Viewer: React.FC<ViewerProps>;
35
51
 
@@ -63,6 +79,7 @@ declare function useMobilePerf(): PerfSession;
63
79
  type PageViewComponentType = React.ComponentType<PapyrusPageViewProps & React.RefAttributes<any>>;
64
80
  interface PageRendererProps {
65
81
  engine: DocumentEngine;
82
+ documentId?: string;
66
83
  pageIndex: number;
67
84
  scale?: number;
68
85
  pageAspectRatio?: number;
@@ -107,12 +124,17 @@ interface RightSheetProps {
107
124
  }
108
125
  declare const RightSheet: React.FC<RightSheetProps>;
109
126
 
110
- declare const AnnotationEditor: React.FC;
127
+ declare const AnnotationEditor: React.FC<{
128
+ documentId?: string;
129
+ }>;
111
130
 
112
131
  type BottomBarProps = {
113
132
  documentType: DocumentType;
114
133
  onOpenInfo: () => void;
115
134
  onOpenSettings: () => void;
135
+ onTurnPage?: (direction: -1 | 1) => void;
136
+ onNavigateToPage?: (page: number) => void;
137
+ onOpenPages?: () => void;
116
138
  onOpenDestination?: (destination: MobilePrimaryDestination) => void;
117
139
  };
118
140
  declare const BottomBar: React.FC<BottomBarProps>;
@@ -121,6 +143,8 @@ interface SettingsSheetProps {
121
143
  engine: DocumentEngine;
122
144
  visible: boolean;
123
145
  onClose: () => void;
146
+ documentType?: DocumentType;
147
+ onOpenInfo?: () => void;
124
148
  }
125
149
  declare const SettingsSheet: React.FC<SettingsSheetProps>;
126
150
 
@@ -153,6 +177,7 @@ declare function ReadingShell({ engine, title, documentType, thumbsInitialCount,
153
177
 
154
178
  type NativePdfDocumentViewerProps = {
155
179
  engine: DocumentEngine;
180
+ documentId?: string;
156
181
  maxPageWidth?: number;
157
182
  onTextSelected?: (payload: {
158
183
  text: string;
@@ -162,8 +187,9 @@ type NativePdfDocumentViewerProps = {
162
187
  text: string;
163
188
  pageIndex: number;
164
189
  }) => void;
190
+ defineSelectionMode?: "selection" | "single-word";
165
191
  };
166
- declare function NativePdfDocumentViewer({ engine, maxPageWidth, onTextSelected, onDefineSelection, }: NativePdfDocumentViewerProps): react_jsx_runtime.JSX.Element;
192
+ declare function NativePdfDocumentViewer({ engine, documentId, maxPageWidth, onTextSelected, onDefineSelection, defineSelectionMode, }: NativePdfDocumentViewerProps): react_jsx_runtime.JSX.Element;
167
193
 
168
194
  type OverflowSheetProps = {
169
195
  visible: boolean;
@@ -188,12 +214,14 @@ declare function DocumentActionsSheet({ visible, onClose, }: DocumentActionsShee
188
214
 
189
215
  type ProgressPillProps = {
190
216
  documentType: DocumentType;
217
+ navigationInDock?: boolean;
191
218
  onPress: () => void;
192
219
  onOpenPageJump?: () => void;
193
220
  onNavigateToPage?: (page: number) => void;
221
+ onTurnPage?: (direction: -1 | 1) => void;
194
222
  onScrubbingChange?: (active: boolean) => void;
195
223
  };
196
- declare function ProgressPill({ documentType, onPress, onOpenPageJump, onNavigateToPage, onScrubbingChange, }: ProgressPillProps): react_jsx_runtime.JSX.Element;
224
+ declare function ProgressPill({ documentType, navigationInDock, onPress, onOpenPageJump, onNavigateToPage, onTurnPage, onScrubbingChange, }: ProgressPillProps): react_jsx_runtime.JSX.Element;
197
225
 
198
226
  type SearchOverlayProps = {
199
227
  engine: DocumentEngine;