@papyrus-sdk/ui-react-native 0.2.24 → 0.2.27

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.
@@ -2,16 +2,14 @@ import {
2
2
  getSelectionEdgeAutoscroll,
3
3
  getToolDockDismissState,
4
4
  isToolDockToolSelected,
5
- shouldAcceptSelectionRect,
6
5
  shouldEnableSelectionDrag,
7
6
  shouldEnableViewerScroll
8
- } from "../chunk-B25KK4VL.mjs";
7
+ } from "../chunk-KXNP73MZ.mjs";
9
8
  import "../chunk-ZD7AOCMD.mjs";
10
9
  export {
11
10
  getSelectionEdgeAutoscroll,
12
11
  getToolDockDismissState,
13
12
  isToolDockToolSelected,
14
- shouldAcceptSelectionRect,
15
13
  shouldEnableSelectionDrag,
16
14
  shouldEnableViewerScroll
17
15
  };
package/dist/index.d.mts CHANGED
@@ -1,8 +1,8 @@
1
- import React from 'react';
1
+ import React, { PropsWithChildren } from 'react';
2
2
  import { DocumentEngine, PdfViewerMode, DocumentType, MobilePrimaryDestination, DocumentSource } from '@papyrus-sdk/types';
3
+ import * as react_jsx_runtime from 'react/jsx-runtime';
3
4
  import { PapyrusPageViewProps } from '@papyrus-sdk/engine-native';
4
5
  import { StyleProp, ViewStyle } from 'react-native';
5
- import * as react_jsx_runtime from 'react/jsx-runtime';
6
6
 
7
7
  interface ViewerProps {
8
8
  engine: DocumentEngine;
@@ -11,18 +11,37 @@ interface ViewerProps {
11
11
  removeClippedSubviews?: boolean;
12
12
  useDedicatedAndroidPdfViewer?: boolean;
13
13
  viewerMode?: PdfViewerMode;
14
- onTextSelected?: (payload: {
15
- text: string;
16
- pageIndex: number;
17
- }) => void;
18
- onDefineSelection?: (payload: {
19
- text: string;
20
- pageIndex: number;
21
- }) => void;
22
- selectionActionLabel?: string;
14
+ pageScrubActive?: boolean;
23
15
  }
24
16
  declare const Viewer: React.FC<ViewerProps>;
25
17
 
18
+ type PerfSessionContext = {
19
+ runId?: string;
20
+ sampleId?: string;
21
+ documentLoadId?: string;
22
+ fixture: string;
23
+ };
24
+ type PerfSession = {
25
+ enabled: boolean;
26
+ context: Readonly<PerfSessionContext>;
27
+ createId: (kind: string) => string;
28
+ emit: (name: string, payload?: Record<string, unknown>) => void;
29
+ };
30
+ type PerfSessionOptions = {
31
+ enabled: boolean;
32
+ context: PerfSessionContext;
33
+ now?: () => number;
34
+ sink?: (line: string) => void;
35
+ };
36
+ declare function createPerfSession({ enabled, context, now, sink }: PerfSessionOptions): PerfSession;
37
+ declare function createRunId(): string;
38
+
39
+ declare function MobilePerfProvider({ session, context, children }: PropsWithChildren<{
40
+ session?: PerfSession;
41
+ context?: PerfSessionContext;
42
+ }>): react_jsx_runtime.JSX.Element;
43
+ declare function useMobilePerf(): PerfSession;
44
+
26
45
  type PageViewComponentType = React.ComponentType<PapyrusPageViewProps & React.RefAttributes<any>>;
27
46
  interface PageRendererProps {
28
47
  engine: DocumentEngine;
@@ -35,18 +54,13 @@ interface PageRendererProps {
35
54
  horizontalPadding?: number;
36
55
  spacing?: number;
37
56
  onSelectionDragActiveChange?: (active: boolean) => void;
38
- onTextSelected?: (payload: {
39
- text: string;
40
- pageIndex: number;
41
- }) => void;
42
- onDefineSelection?: (payload: {
43
- text: string;
44
- pageIndex: number;
45
- }) => void;
46
- selectionActionLabel?: string;
57
+ onPageTap?: () => void;
47
58
  gestureScrollLockActive?: boolean;
48
59
  lastPinchEndedAt?: number | null;
49
60
  requestSelectionVerticalAutoscroll?: (absoluteY: number) => number;
61
+ onRenderReady?: (pageIndex: number, renderedZoom: number) => void;
62
+ surfaceId?: string;
63
+ gestureId?: string;
50
64
  }
51
65
  declare const _default: React.NamedExoticComponent<PageRendererProps>;
52
66
 
@@ -119,13 +133,8 @@ declare function ReadingShell({ engine, title, documentType, thumbsInitialCount,
119
133
 
120
134
  type DedicatedAndroidPdfViewerProps = {
121
135
  engine: DocumentEngine;
122
- onDefineSelection?: (payload: {
123
- text: string;
124
- pageIndex: number;
125
- }) => void;
126
- selectionActionLabel?: string;
127
136
  };
128
- declare function DedicatedAndroidPdfViewer({ engine, onDefineSelection, selectionActionLabel, }: DedicatedAndroidPdfViewerProps): react_jsx_runtime.JSX.Element;
137
+ declare function DedicatedAndroidPdfViewer({ engine, }: DedicatedAndroidPdfViewerProps): react_jsx_runtime.JSX.Element;
129
138
 
130
139
  type OverflowSheetProps = {
131
140
  visible: boolean;
@@ -152,8 +161,10 @@ type ProgressPillProps = {
152
161
  documentType: DocumentType;
153
162
  onPress: () => void;
154
163
  onOpenPageJump?: () => void;
164
+ onNavigateToPage?: (page: number) => void;
165
+ onScrubbingChange?: (active: boolean) => void;
155
166
  };
156
- declare function ProgressPill({ documentType, onPress, onOpenPageJump, }: ProgressPillProps): react_jsx_runtime.JSX.Element;
167
+ declare function ProgressPill({ documentType, onPress, onOpenPageJump, onNavigateToPage, onScrubbingChange, }: ProgressPillProps): react_jsx_runtime.JSX.Element;
157
168
 
158
169
  type SearchOverlayProps = {
159
170
  engine: DocumentEngine;
@@ -186,6 +197,9 @@ declare const MOBILE_CHROME_METRICS: {
186
197
  readonly topbarPageButtonSize: 30;
187
198
  readonly bottomBarItemPaddingHorizontal: 5;
188
199
  readonly bottomBarItemPaddingVertical: 3;
200
+ readonly topbarHeight: 56;
201
+ readonly progressGap: 18;
202
+ readonly progressHorizontalOffset: 10;
189
203
  };
190
204
 
191
- export { AnnotationEditor, BottomBar, CoverPreview, DocumentActionsSheet, InfoSheet, MOBILE_CHROME_METRICS, DedicatedAndroidPdfViewer as NativePdfDocumentViewer, OverflowSheet, _default as PageRenderer, ProgressPill, ReadingShell, RightSheet, SearchOverlay, SearchResultsSheet, SettingsSheet, ToolDock, Topbar, Viewer };
205
+ export { AnnotationEditor, BottomBar, CoverPreview, DocumentActionsSheet, InfoSheet, MOBILE_CHROME_METRICS, MobilePerfProvider, DedicatedAndroidPdfViewer as NativePdfDocumentViewer, OverflowSheet, _default as PageRenderer, ProgressPill, ReadingShell, RightSheet, SearchOverlay, SearchResultsSheet, SettingsSheet, ToolDock, Topbar, Viewer, createPerfSession, createRunId, useMobilePerf };
package/dist/index.d.ts CHANGED
@@ -1,8 +1,8 @@
1
- import React from 'react';
1
+ import React, { PropsWithChildren } from 'react';
2
2
  import { DocumentEngine, PdfViewerMode, DocumentType, MobilePrimaryDestination, DocumentSource } from '@papyrus-sdk/types';
3
+ import * as react_jsx_runtime from 'react/jsx-runtime';
3
4
  import { PapyrusPageViewProps } from '@papyrus-sdk/engine-native';
4
5
  import { StyleProp, ViewStyle } from 'react-native';
5
- import * as react_jsx_runtime from 'react/jsx-runtime';
6
6
 
7
7
  interface ViewerProps {
8
8
  engine: DocumentEngine;
@@ -11,18 +11,37 @@ interface ViewerProps {
11
11
  removeClippedSubviews?: boolean;
12
12
  useDedicatedAndroidPdfViewer?: boolean;
13
13
  viewerMode?: PdfViewerMode;
14
- onTextSelected?: (payload: {
15
- text: string;
16
- pageIndex: number;
17
- }) => void;
18
- onDefineSelection?: (payload: {
19
- text: string;
20
- pageIndex: number;
21
- }) => void;
22
- selectionActionLabel?: string;
14
+ pageScrubActive?: boolean;
23
15
  }
24
16
  declare const Viewer: React.FC<ViewerProps>;
25
17
 
18
+ type PerfSessionContext = {
19
+ runId?: string;
20
+ sampleId?: string;
21
+ documentLoadId?: string;
22
+ fixture: string;
23
+ };
24
+ type PerfSession = {
25
+ enabled: boolean;
26
+ context: Readonly<PerfSessionContext>;
27
+ createId: (kind: string) => string;
28
+ emit: (name: string, payload?: Record<string, unknown>) => void;
29
+ };
30
+ type PerfSessionOptions = {
31
+ enabled: boolean;
32
+ context: PerfSessionContext;
33
+ now?: () => number;
34
+ sink?: (line: string) => void;
35
+ };
36
+ declare function createPerfSession({ enabled, context, now, sink }: PerfSessionOptions): PerfSession;
37
+ declare function createRunId(): string;
38
+
39
+ declare function MobilePerfProvider({ session, context, children }: PropsWithChildren<{
40
+ session?: PerfSession;
41
+ context?: PerfSessionContext;
42
+ }>): react_jsx_runtime.JSX.Element;
43
+ declare function useMobilePerf(): PerfSession;
44
+
26
45
  type PageViewComponentType = React.ComponentType<PapyrusPageViewProps & React.RefAttributes<any>>;
27
46
  interface PageRendererProps {
28
47
  engine: DocumentEngine;
@@ -35,18 +54,13 @@ interface PageRendererProps {
35
54
  horizontalPadding?: number;
36
55
  spacing?: number;
37
56
  onSelectionDragActiveChange?: (active: boolean) => void;
38
- onTextSelected?: (payload: {
39
- text: string;
40
- pageIndex: number;
41
- }) => void;
42
- onDefineSelection?: (payload: {
43
- text: string;
44
- pageIndex: number;
45
- }) => void;
46
- selectionActionLabel?: string;
57
+ onPageTap?: () => void;
47
58
  gestureScrollLockActive?: boolean;
48
59
  lastPinchEndedAt?: number | null;
49
60
  requestSelectionVerticalAutoscroll?: (absoluteY: number) => number;
61
+ onRenderReady?: (pageIndex: number, renderedZoom: number) => void;
62
+ surfaceId?: string;
63
+ gestureId?: string;
50
64
  }
51
65
  declare const _default: React.NamedExoticComponent<PageRendererProps>;
52
66
 
@@ -119,13 +133,8 @@ declare function ReadingShell({ engine, title, documentType, thumbsInitialCount,
119
133
 
120
134
  type DedicatedAndroidPdfViewerProps = {
121
135
  engine: DocumentEngine;
122
- onDefineSelection?: (payload: {
123
- text: string;
124
- pageIndex: number;
125
- }) => void;
126
- selectionActionLabel?: string;
127
136
  };
128
- declare function DedicatedAndroidPdfViewer({ engine, onDefineSelection, selectionActionLabel, }: DedicatedAndroidPdfViewerProps): react_jsx_runtime.JSX.Element;
137
+ declare function DedicatedAndroidPdfViewer({ engine, }: DedicatedAndroidPdfViewerProps): react_jsx_runtime.JSX.Element;
129
138
 
130
139
  type OverflowSheetProps = {
131
140
  visible: boolean;
@@ -152,8 +161,10 @@ type ProgressPillProps = {
152
161
  documentType: DocumentType;
153
162
  onPress: () => void;
154
163
  onOpenPageJump?: () => void;
164
+ onNavigateToPage?: (page: number) => void;
165
+ onScrubbingChange?: (active: boolean) => void;
155
166
  };
156
- declare function ProgressPill({ documentType, onPress, onOpenPageJump, }: ProgressPillProps): react_jsx_runtime.JSX.Element;
167
+ declare function ProgressPill({ documentType, onPress, onOpenPageJump, onNavigateToPage, onScrubbingChange, }: ProgressPillProps): react_jsx_runtime.JSX.Element;
157
168
 
158
169
  type SearchOverlayProps = {
159
170
  engine: DocumentEngine;
@@ -186,6 +197,9 @@ declare const MOBILE_CHROME_METRICS: {
186
197
  readonly topbarPageButtonSize: 30;
187
198
  readonly bottomBarItemPaddingHorizontal: 5;
188
199
  readonly bottomBarItemPaddingVertical: 3;
200
+ readonly topbarHeight: 56;
201
+ readonly progressGap: 18;
202
+ readonly progressHorizontalOffset: 10;
189
203
  };
190
204
 
191
- export { AnnotationEditor, BottomBar, CoverPreview, DocumentActionsSheet, InfoSheet, MOBILE_CHROME_METRICS, DedicatedAndroidPdfViewer as NativePdfDocumentViewer, OverflowSheet, _default as PageRenderer, ProgressPill, ReadingShell, RightSheet, SearchOverlay, SearchResultsSheet, SettingsSheet, ToolDock, Topbar, Viewer };
205
+ export { AnnotationEditor, BottomBar, CoverPreview, DocumentActionsSheet, InfoSheet, MOBILE_CHROME_METRICS, MobilePerfProvider, DedicatedAndroidPdfViewer as NativePdfDocumentViewer, OverflowSheet, _default as PageRenderer, ProgressPill, ReadingShell, RightSheet, SearchOverlay, SearchResultsSheet, SettingsSheet, ToolDock, Topbar, Viewer, createPerfSession, createRunId, useMobilePerf };