@papyrus-sdk/ui-react-native 0.2.35-beta.0 → 0.2.35-beta.10

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;
@@ -121,6 +138,7 @@ interface SettingsSheetProps {
121
138
  engine: DocumentEngine;
122
139
  visible: boolean;
123
140
  onClose: () => void;
141
+ documentType?: DocumentType;
124
142
  }
125
143
  declare const SettingsSheet: React.FC<SettingsSheetProps>;
126
144
 
@@ -153,6 +171,7 @@ declare function ReadingShell({ engine, title, documentType, thumbsInitialCount,
153
171
 
154
172
  type NativePdfDocumentViewerProps = {
155
173
  engine: DocumentEngine;
174
+ documentId?: string;
156
175
  maxPageWidth?: number;
157
176
  onTextSelected?: (payload: {
158
177
  text: string;
@@ -162,8 +181,9 @@ type NativePdfDocumentViewerProps = {
162
181
  text: string;
163
182
  pageIndex: number;
164
183
  }) => void;
184
+ defineSelectionMode?: "selection" | "single-word";
165
185
  };
166
- declare function NativePdfDocumentViewer({ engine, maxPageWidth, onTextSelected, onDefineSelection, }: NativePdfDocumentViewerProps): react_jsx_runtime.JSX.Element;
186
+ declare function NativePdfDocumentViewer({ engine, documentId, maxPageWidth, onTextSelected, onDefineSelection, defineSelectionMode, }: NativePdfDocumentViewerProps): react_jsx_runtime.JSX.Element;
167
187
 
168
188
  type OverflowSheetProps = {
169
189
  visible: boolean;
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;
@@ -121,6 +138,7 @@ interface SettingsSheetProps {
121
138
  engine: DocumentEngine;
122
139
  visible: boolean;
123
140
  onClose: () => void;
141
+ documentType?: DocumentType;
124
142
  }
125
143
  declare const SettingsSheet: React.FC<SettingsSheetProps>;
126
144
 
@@ -153,6 +171,7 @@ declare function ReadingShell({ engine, title, documentType, thumbsInitialCount,
153
171
 
154
172
  type NativePdfDocumentViewerProps = {
155
173
  engine: DocumentEngine;
174
+ documentId?: string;
156
175
  maxPageWidth?: number;
157
176
  onTextSelected?: (payload: {
158
177
  text: string;
@@ -162,8 +181,9 @@ type NativePdfDocumentViewerProps = {
162
181
  text: string;
163
182
  pageIndex: number;
164
183
  }) => void;
184
+ defineSelectionMode?: "selection" | "single-word";
165
185
  };
166
- declare function NativePdfDocumentViewer({ engine, maxPageWidth, onTextSelected, onDefineSelection, }: NativePdfDocumentViewerProps): react_jsx_runtime.JSX.Element;
186
+ declare function NativePdfDocumentViewer({ engine, documentId, maxPageWidth, onTextSelected, onDefineSelection, defineSelectionMode, }: NativePdfDocumentViewerProps): react_jsx_runtime.JSX.Element;
167
187
 
168
188
  type OverflowSheetProps = {
169
189
  visible: boolean;