@papyrus-sdk/ui-react-native 0.2.18-beta.6 → 0.2.18-beta.8
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/dist/chunk-B36LWZCX.mjs +178 -0
- package/dist/chunk-B36LWZCX.mjs.map +1 -0
- package/dist/chunk-KXNP73MZ.mjs +63 -0
- package/dist/chunk-KXNP73MZ.mjs.map +1 -0
- package/dist/chunk-ZD7AOCMD.mjs +9 -0
- package/dist/chunk-ZD7AOCMD.mjs.map +1 -0
- package/dist/gesture/pinchZoom.d.mts +69 -0
- package/dist/gesture/pinchZoom.d.ts +69 -0
- package/dist/gesture/pinchZoom.js +217 -0
- package/dist/gesture/pinchZoom.js.map +1 -0
- package/dist/gesture/pinchZoom.mjs +40 -0
- package/dist/gesture/pinchZoom.mjs.map +1 -0
- package/dist/gesture/selectionInteraction.d.mts +35 -0
- package/dist/gesture/selectionInteraction.d.ts +35 -0
- package/dist/gesture/selectionInteraction.js +90 -0
- package/dist/gesture/selectionInteraction.js.map +1 -0
- package/dist/gesture/selectionInteraction.mjs +16 -0
- package/dist/gesture/selectionInteraction.mjs.map +1 -0
- package/dist/index.d.mts +8 -2
- package/dist/index.d.ts +8 -2
- package/dist/index.js +45 -7
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +83 -217
- package/dist/index.mjs.map +1 -1
- package/package.json +2 -2
package/dist/index.mjs
CHANGED
|
@@ -1,7 +1,25 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
1
|
+
import {
|
|
2
|
+
DEFAULT_PINCH_ZOOM_BOUNDS,
|
|
3
|
+
resolveAnchoredDocumentOffset,
|
|
4
|
+
resolveAnchoredHorizontalSurfaceOffset,
|
|
5
|
+
resolveAnchoredViewportOffset,
|
|
6
|
+
resolveCenteredContentInset,
|
|
7
|
+
resolveDocumentSurfaceWidth,
|
|
8
|
+
resolveGlobalHorizontalOffset,
|
|
9
|
+
resolvePinchGestureZoom,
|
|
10
|
+
sanitizePinchPreviewScale,
|
|
11
|
+
shouldSuppressPressAfterPinch
|
|
12
|
+
} from "./chunk-B36LWZCX.mjs";
|
|
13
|
+
import {
|
|
14
|
+
getSelectionEdgeAutoscroll,
|
|
15
|
+
getToolDockDismissState,
|
|
16
|
+
isToolDockToolSelected,
|
|
17
|
+
shouldEnableSelectionDrag,
|
|
18
|
+
shouldEnableViewerScroll
|
|
19
|
+
} from "./chunk-KXNP73MZ.mjs";
|
|
20
|
+
import {
|
|
21
|
+
__commonJS
|
|
22
|
+
} from "./chunk-ZD7AOCMD.mjs";
|
|
5
23
|
|
|
6
24
|
// runtime/index.html
|
|
7
25
|
var require_runtime = __commonJS({
|
|
@@ -20999,7 +21017,6 @@ import {
|
|
|
20999
21017
|
} from "react";
|
|
21000
21018
|
import {
|
|
21001
21019
|
FlatList,
|
|
21002
|
-
Platform as Platform2,
|
|
21003
21020
|
ScrollView,
|
|
21004
21021
|
StyleSheet as StyleSheet4,
|
|
21005
21022
|
View as View4,
|
|
@@ -21215,194 +21232,6 @@ var createScrollPerfMonitor = (scope, label = "scroll") => {
|
|
|
21215
21232
|
};
|
|
21216
21233
|
var logPerfEvent = logPerf;
|
|
21217
21234
|
|
|
21218
|
-
// gesture/pinchZoom.ts
|
|
21219
|
-
var DEFAULT_PINCH_ZOOM_BOUNDS = {
|
|
21220
|
-
minZoom: 0.5,
|
|
21221
|
-
maxZoom: 4
|
|
21222
|
-
};
|
|
21223
|
-
var PINCH_PRESS_SUPPRESSION_MS = 120;
|
|
21224
|
-
var clamp = (value, min, max) => Math.min(max, Math.max(min, value));
|
|
21225
|
-
var sanitizePinchPreviewScale = (value) => {
|
|
21226
|
-
if (!Number.isFinite(value) || value <= 0) {
|
|
21227
|
-
return 1;
|
|
21228
|
-
}
|
|
21229
|
-
return value;
|
|
21230
|
-
};
|
|
21231
|
-
var resolvePinchGestureZoom = (startZoom, scaleFactor, bounds = DEFAULT_PINCH_ZOOM_BOUNDS) => clamp(
|
|
21232
|
-
(Number.isFinite(startZoom) && startZoom > 0 ? startZoom : 1) * (Number.isFinite(scaleFactor) && scaleFactor > 0 ? scaleFactor : 1),
|
|
21233
|
-
bounds.minZoom,
|
|
21234
|
-
bounds.maxZoom
|
|
21235
|
-
);
|
|
21236
|
-
var resolveAnchoredViewportOffset = ({
|
|
21237
|
-
viewportOffset,
|
|
21238
|
-
startScrollOffset,
|
|
21239
|
-
startItemOffset,
|
|
21240
|
-
startItemLength,
|
|
21241
|
-
endItemOffset,
|
|
21242
|
-
endItemLength,
|
|
21243
|
-
viewportLength,
|
|
21244
|
-
endContentLength
|
|
21245
|
-
}) => {
|
|
21246
|
-
const safeViewportOffset = Number.isFinite(viewportOffset) ? viewportOffset : 0;
|
|
21247
|
-
const safeStartScrollOffset = Number.isFinite(startScrollOffset) ? startScrollOffset : 0;
|
|
21248
|
-
const safeStartItemOffset = Number.isFinite(startItemOffset) ? startItemOffset : 0;
|
|
21249
|
-
const safeStartItemLength = Number.isFinite(startItemLength) && startItemLength > 0 ? startItemLength : 1;
|
|
21250
|
-
const safeEndItemOffset = Number.isFinite(endItemOffset) ? endItemOffset : 0;
|
|
21251
|
-
const safeEndItemLength = Number.isFinite(endItemLength) && endItemLength > 0 ? endItemLength : 1;
|
|
21252
|
-
const safeViewportLength = Number.isFinite(viewportLength) && viewportLength > 0 ? viewportLength : 0;
|
|
21253
|
-
const safeEndContentLength = Number.isFinite(endContentLength) && endContentLength > 0 ? endContentLength : safeEndItemOffset + safeEndItemLength;
|
|
21254
|
-
const contentPoint = safeStartScrollOffset + safeViewportOffset - safeStartItemOffset;
|
|
21255
|
-
const normalizedPoint = clamp(contentPoint / safeStartItemLength, 0, 1);
|
|
21256
|
-
const anchoredContentPoint = safeEndItemOffset + normalizedPoint * safeEndItemLength;
|
|
21257
|
-
return clamp(
|
|
21258
|
-
anchoredContentPoint - safeViewportOffset,
|
|
21259
|
-
0,
|
|
21260
|
-
Math.max(0, safeEndContentLength - safeViewportLength)
|
|
21261
|
-
);
|
|
21262
|
-
};
|
|
21263
|
-
var resolveAnchoredDocumentOffset = ({
|
|
21264
|
-
viewportOffset,
|
|
21265
|
-
startScrollOffset,
|
|
21266
|
-
startContentLength,
|
|
21267
|
-
endContentLength,
|
|
21268
|
-
viewportLength
|
|
21269
|
-
}) => {
|
|
21270
|
-
const safeViewportOffset = Number.isFinite(viewportOffset) ? viewportOffset : 0;
|
|
21271
|
-
const safeStartScrollOffset = Number.isFinite(startScrollOffset) ? startScrollOffset : 0;
|
|
21272
|
-
const safeStartContentLength = Number.isFinite(startContentLength) && startContentLength > 0 ? startContentLength : 1;
|
|
21273
|
-
const safeEndContentLength = Number.isFinite(endContentLength) && endContentLength > 0 ? endContentLength : 0;
|
|
21274
|
-
const safeViewportLength = Number.isFinite(viewportLength) && viewportLength > 0 ? viewportLength : 0;
|
|
21275
|
-
const anchoredRatio = clamp(
|
|
21276
|
-
(safeStartScrollOffset + safeViewportOffset) / safeStartContentLength,
|
|
21277
|
-
0,
|
|
21278
|
-
1
|
|
21279
|
-
);
|
|
21280
|
-
return resolveClampedScrollOffset(
|
|
21281
|
-
anchoredRatio * safeEndContentLength - safeViewportOffset,
|
|
21282
|
-
safeEndContentLength,
|
|
21283
|
-
safeViewportLength
|
|
21284
|
-
);
|
|
21285
|
-
};
|
|
21286
|
-
var resolveClampedScrollOffset = (offset, contentLength, viewportLength) => {
|
|
21287
|
-
const safeOffset = Number.isFinite(offset) ? offset : 0;
|
|
21288
|
-
const safeContentLength = Number.isFinite(contentLength) && contentLength > 0 ? contentLength : 0;
|
|
21289
|
-
const safeViewportLength = Number.isFinite(viewportLength) && viewportLength > 0 ? viewportLength : 0;
|
|
21290
|
-
return clamp(
|
|
21291
|
-
safeOffset,
|
|
21292
|
-
0,
|
|
21293
|
-
Math.max(0, safeContentLength - safeViewportLength)
|
|
21294
|
-
);
|
|
21295
|
-
};
|
|
21296
|
-
var resolveDocumentSurfaceWidth = ({
|
|
21297
|
-
viewportWidth,
|
|
21298
|
-
contentWidth,
|
|
21299
|
-
horizontalPadding
|
|
21300
|
-
}) => {
|
|
21301
|
-
const safeViewportWidth = Number.isFinite(viewportWidth) && viewportWidth > 0 ? viewportWidth : 0;
|
|
21302
|
-
const safeContentWidth = Number.isFinite(contentWidth) && contentWidth > 0 ? contentWidth : 0;
|
|
21303
|
-
const safeHorizontalPadding = Number.isFinite(horizontalPadding) && horizontalPadding > 0 ? horizontalPadding : 0;
|
|
21304
|
-
return Math.max(
|
|
21305
|
-
safeViewportWidth,
|
|
21306
|
-
safeContentWidth + safeHorizontalPadding * 2
|
|
21307
|
-
);
|
|
21308
|
-
};
|
|
21309
|
-
var resolveGlobalHorizontalOffset = ({
|
|
21310
|
-
offsetX,
|
|
21311
|
-
surfaceWidth,
|
|
21312
|
-
viewportWidth
|
|
21313
|
-
}) => resolveClampedScrollOffset(offsetX, surfaceWidth, viewportWidth);
|
|
21314
|
-
var resolveAnchoredHorizontalSurfaceOffset = ({
|
|
21315
|
-
focalViewportX,
|
|
21316
|
-
startSurfaceScrollX,
|
|
21317
|
-
startSurfaceWidth,
|
|
21318
|
-
endSurfaceWidth,
|
|
21319
|
-
viewportWidth
|
|
21320
|
-
}) => {
|
|
21321
|
-
const safeFocalViewportX = Number.isFinite(focalViewportX) ? focalViewportX : 0;
|
|
21322
|
-
const safeStartSurfaceScrollX = Number.isFinite(startSurfaceScrollX) ? startSurfaceScrollX : 0;
|
|
21323
|
-
const safeStartSurfaceWidth = Number.isFinite(startSurfaceWidth) && startSurfaceWidth > 0 ? startSurfaceWidth : 1;
|
|
21324
|
-
const safeEndSurfaceWidth = Number.isFinite(endSurfaceWidth) && endSurfaceWidth > 0 ? endSurfaceWidth : 0;
|
|
21325
|
-
const safeViewportWidth = Number.isFinite(viewportWidth) && viewportWidth > 0 ? viewportWidth : 0;
|
|
21326
|
-
const anchoredRatio = clamp(
|
|
21327
|
-
(safeStartSurfaceScrollX + safeFocalViewportX) / safeStartSurfaceWidth,
|
|
21328
|
-
0,
|
|
21329
|
-
1
|
|
21330
|
-
);
|
|
21331
|
-
return resolveGlobalHorizontalOffset({
|
|
21332
|
-
offsetX: anchoredRatio * safeEndSurfaceWidth - safeFocalViewportX,
|
|
21333
|
-
surfaceWidth: safeEndSurfaceWidth,
|
|
21334
|
-
viewportWidth: safeViewportWidth
|
|
21335
|
-
});
|
|
21336
|
-
};
|
|
21337
|
-
var resolveCenteredContentInset = ({
|
|
21338
|
-
viewportLength,
|
|
21339
|
-
contentLength
|
|
21340
|
-
}) => {
|
|
21341
|
-
const safeViewportLength = Number.isFinite(viewportLength) && viewportLength > 0 ? viewportLength : 0;
|
|
21342
|
-
const safeContentLength = Number.isFinite(contentLength) && contentLength > 0 ? contentLength : 0;
|
|
21343
|
-
return Math.max(0, (safeViewportLength - safeContentLength) / 2);
|
|
21344
|
-
};
|
|
21345
|
-
var shouldSuppressPressAfterPinch = (lastPinchEndedAt, now = Date.now(), windowMs = PINCH_PRESS_SUPPRESSION_MS) => {
|
|
21346
|
-
if (typeof lastPinchEndedAt !== "number") return false;
|
|
21347
|
-
const elapsedMs = now - lastPinchEndedAt;
|
|
21348
|
-
return elapsedMs >= 0 && elapsedMs < windowMs;
|
|
21349
|
-
};
|
|
21350
|
-
|
|
21351
|
-
// gesture/selectionInteraction.ts
|
|
21352
|
-
var clamp2 = (value, min, max) => Math.min(max, Math.max(min, value));
|
|
21353
|
-
var DRAG_SELECTION_TOOLS = /* @__PURE__ */ new Set([
|
|
21354
|
-
"highlight",
|
|
21355
|
-
"underline",
|
|
21356
|
-
"squiggly",
|
|
21357
|
-
"strikeout"
|
|
21358
|
-
]);
|
|
21359
|
-
var resolveAxisAutoscroll = (coordinate, size, threshold, maxStep) => {
|
|
21360
|
-
if (size <= 0 || threshold <= 0 || maxStep <= 0) return 0;
|
|
21361
|
-
const startDistance = clamp2(coordinate, 0, size);
|
|
21362
|
-
if (startDistance < threshold) {
|
|
21363
|
-
const intensity = 1 - startDistance / threshold;
|
|
21364
|
-
return -Math.round(maxStep * intensity);
|
|
21365
|
-
}
|
|
21366
|
-
const endDistance = clamp2(size - coordinate, 0, size);
|
|
21367
|
-
if (endDistance < threshold) {
|
|
21368
|
-
const intensity = 1 - endDistance / threshold;
|
|
21369
|
-
return Math.round(maxStep * intensity);
|
|
21370
|
-
}
|
|
21371
|
-
return 0;
|
|
21372
|
-
};
|
|
21373
|
-
var shouldEnableViewerScroll = ({
|
|
21374
|
-
selectionDragActive,
|
|
21375
|
-
gestureScrollLockActive = false
|
|
21376
|
-
}) => !selectionDragActive && !gestureScrollLockActive;
|
|
21377
|
-
var shouldEnableSelectionDrag = ({
|
|
21378
|
-
activeTool,
|
|
21379
|
-
interactionMode
|
|
21380
|
-
}) => DRAG_SELECTION_TOOLS.has(activeTool) || activeTool === "select" && interactionMode === "select";
|
|
21381
|
-
var isToolDockToolSelected = ({
|
|
21382
|
-
activeTool,
|
|
21383
|
-
interactionMode,
|
|
21384
|
-
toolId
|
|
21385
|
-
}) => toolId === "select" ? activeTool === "select" && interactionMode === "select" : activeTool === toolId;
|
|
21386
|
-
var getToolDockDismissState = ({
|
|
21387
|
-
activeTool: _activeTool,
|
|
21388
|
-
interactionMode: _interactionMode
|
|
21389
|
-
}) => ({
|
|
21390
|
-
toolDockOpen: false,
|
|
21391
|
-
activeTool: "select",
|
|
21392
|
-
interactionMode: "pan"
|
|
21393
|
-
});
|
|
21394
|
-
var getSelectionEdgeAutoscroll = ({
|
|
21395
|
-
x,
|
|
21396
|
-
y,
|
|
21397
|
-
width,
|
|
21398
|
-
height,
|
|
21399
|
-
threshold,
|
|
21400
|
-
maxStep
|
|
21401
|
-
}) => ({
|
|
21402
|
-
dx: resolveAxisAutoscroll(x, width, threshold, maxStep),
|
|
21403
|
-
dy: resolveAxisAutoscroll(y, height, threshold, maxStep)
|
|
21404
|
-
});
|
|
21405
|
-
|
|
21406
21235
|
// viewport/pdfViewportController.ts
|
|
21407
21236
|
var resolvePdfVerticalAnchorMode = ({
|
|
21408
21237
|
focalY,
|
|
@@ -21802,7 +21631,7 @@ var PageRenderer = ({
|
|
|
21802
21631
|
},
|
|
21803
21632
|
[addAnnotation, annotationColor, logSelectionPerf, pageIndex]
|
|
21804
21633
|
);
|
|
21805
|
-
const
|
|
21634
|
+
const clamp = (value, min, max) => Math.min(max, Math.max(min, value));
|
|
21806
21635
|
const getBoundsFromRects = (rects) => {
|
|
21807
21636
|
let minX = 1;
|
|
21808
21637
|
let minY = 1;
|
|
@@ -21816,10 +21645,10 @@ var PageRenderer = ({
|
|
|
21816
21645
|
});
|
|
21817
21646
|
if (maxX <= minX || maxY <= minY) return null;
|
|
21818
21647
|
return {
|
|
21819
|
-
x:
|
|
21820
|
-
y:
|
|
21821
|
-
width:
|
|
21822
|
-
height:
|
|
21648
|
+
x: clamp(minX, 0, 1),
|
|
21649
|
+
y: clamp(minY, 0, 1),
|
|
21650
|
+
width: clamp(maxX - minX, 0, 1),
|
|
21651
|
+
height: clamp(maxY - minY, 0, 1)
|
|
21823
21652
|
};
|
|
21824
21653
|
};
|
|
21825
21654
|
useEffect(() => {
|
|
@@ -21936,8 +21765,8 @@ var PageRenderer = ({
|
|
|
21936
21765
|
if (!layout.width || !layout.height) return;
|
|
21937
21766
|
const size = 26;
|
|
21938
21767
|
const half = size / 2;
|
|
21939
|
-
const left =
|
|
21940
|
-
const top =
|
|
21768
|
+
const left = clamp(x - half, 0, Math.max(0, layout.width - size));
|
|
21769
|
+
const top = clamp(y - half, 0, Math.max(0, layout.height - size));
|
|
21941
21770
|
const bounds = {
|
|
21942
21771
|
x: left / layout.width,
|
|
21943
21772
|
y: top / layout.height,
|
|
@@ -21986,7 +21815,7 @@ var PageRenderer = ({
|
|
|
21986
21815
|
return;
|
|
21987
21816
|
}
|
|
21988
21817
|
const nextX = point.x;
|
|
21989
|
-
const nextY =
|
|
21818
|
+
const nextY = clamp(point.y + appliedDy, 0, layout.height);
|
|
21990
21819
|
selectionDragPointRef.current = {
|
|
21991
21820
|
absoluteY: point.absoluteY,
|
|
21992
21821
|
x: nextX,
|
|
@@ -22013,8 +21842,8 @@ var PageRenderer = ({
|
|
|
22013
21842
|
return;
|
|
22014
21843
|
}
|
|
22015
21844
|
const start = {
|
|
22016
|
-
x:
|
|
22017
|
-
y:
|
|
21845
|
+
x: clamp(x, 0, layout.width),
|
|
21846
|
+
y: clamp(y, 0, layout.height)
|
|
22018
21847
|
};
|
|
22019
21848
|
selectionStart.current = start;
|
|
22020
21849
|
selectionDragPointRef.current = { absoluteY, ...start };
|
|
@@ -22036,8 +21865,8 @@ var PageRenderer = ({
|
|
|
22036
21865
|
const updateSelectionDrag = useCallback(
|
|
22037
21866
|
(x, y, absoluteY) => {
|
|
22038
21867
|
if (!selectionEnabled || !selectionStart.current) return;
|
|
22039
|
-
const nextX =
|
|
22040
|
-
const nextY =
|
|
21868
|
+
const nextX = clamp(x, 0, layout.width);
|
|
21869
|
+
const nextY = clamp(y, 0, layout.height);
|
|
22041
21870
|
selectionDragPointRef.current = {
|
|
22042
21871
|
absoluteY,
|
|
22043
21872
|
x: nextX,
|
|
@@ -22362,8 +22191,8 @@ var PageRenderer = ({
|
|
|
22362
22191
|
const minSize = 0.01;
|
|
22363
22192
|
let next = { ...start };
|
|
22364
22193
|
if (handle === "start") {
|
|
22365
|
-
const newX =
|
|
22366
|
-
const newY =
|
|
22194
|
+
const newX = clamp(start.x + dx, 0, start.x + start.width - minSize);
|
|
22195
|
+
const newY = clamp(start.y + dy, 0, start.y + start.height - minSize);
|
|
22367
22196
|
next = {
|
|
22368
22197
|
x: newX,
|
|
22369
22198
|
y: newY,
|
|
@@ -22371,8 +22200,8 @@ var PageRenderer = ({
|
|
|
22371
22200
|
height: start.y + start.height - newY
|
|
22372
22201
|
};
|
|
22373
22202
|
} else {
|
|
22374
|
-
const maxX =
|
|
22375
|
-
const maxY =
|
|
22203
|
+
const maxX = clamp(start.x + start.width + dx, start.x + minSize, 1);
|
|
22204
|
+
const maxY = clamp(start.y + start.height + dy, start.y + minSize, 1);
|
|
22376
22205
|
next = {
|
|
22377
22206
|
x: start.x,
|
|
22378
22207
|
y: start.y,
|
|
@@ -23301,7 +23130,7 @@ var WebViewViewer_default = WebViewViewer;
|
|
|
23301
23130
|
import { useCallback as useCallback2, useEffect as useEffect3, useRef as useRef3, useState as useState2 } from "react";
|
|
23302
23131
|
import { Pressable as Pressable2, StyleSheet as StyleSheet3, View as View3 } from "react-native";
|
|
23303
23132
|
import { useViewerStore as useViewerStore3 } from "@papyrus-sdk/core";
|
|
23304
|
-
import {
|
|
23133
|
+
import { PapyrusPdfDocumentView } from "@papyrus-sdk/engine-native";
|
|
23305
23134
|
|
|
23306
23135
|
// icons.tsx
|
|
23307
23136
|
import Svg2, {
|
|
@@ -23939,12 +23768,14 @@ function DedicatedAndroidPdfViewer({
|
|
|
23939
23768
|
const searchResults = useViewerStore3((state) => state.searchResults);
|
|
23940
23769
|
const annotations = useViewerStore3((state) => state.annotations);
|
|
23941
23770
|
const viewMode = useViewerStore3((state) => state.viewMode);
|
|
23771
|
+
const nativeViewMode = viewMode === "single" ? "single" : "continuous";
|
|
23942
23772
|
const setDocumentState = useViewerStore3((state) => state.setDocumentState);
|
|
23943
23773
|
const addAnnotation = useViewerStore3((state) => state.addAnnotation);
|
|
23944
23774
|
const setSelectedAnnotation = useViewerStore3((state) => state.setSelectedAnnotation);
|
|
23945
23775
|
const engineId = getDedicatedAndroidPdfEngineId(engine);
|
|
23946
23776
|
const [selection, setSelection] = useState2(null);
|
|
23947
23777
|
const selectionRef = useRef3(null);
|
|
23778
|
+
const lastVisiblePagesKeyRef = useRef3("");
|
|
23948
23779
|
const lastScrollOffsetYRef = useRef3(0);
|
|
23949
23780
|
const scrollDownAccumRef = useRef3(0);
|
|
23950
23781
|
const scrollUpAccumRef = useRef3(0);
|
|
@@ -24033,7 +23864,7 @@ function DedicatedAndroidPdfViewer({
|
|
|
24033
23864
|
}, []);
|
|
24034
23865
|
return /* @__PURE__ */ jsxs4(View3, { style: styles3.container, children: [
|
|
24035
23866
|
/* @__PURE__ */ jsx4(
|
|
24036
|
-
|
|
23867
|
+
PapyrusPdfDocumentView,
|
|
24037
23868
|
{
|
|
24038
23869
|
style: styles3.viewer,
|
|
24039
23870
|
engineId,
|
|
@@ -24047,13 +23878,30 @@ function DedicatedAndroidPdfViewer({
|
|
|
24047
23878
|
searchResults,
|
|
24048
23879
|
annotations,
|
|
24049
23880
|
selectionActive: !!selection,
|
|
24050
|
-
viewMode,
|
|
24051
|
-
|
|
23881
|
+
viewMode: nativeViewMode,
|
|
23882
|
+
onPageChange: (event) => {
|
|
24052
23883
|
setDocumentState({ currentPage: event.nativeEvent.page });
|
|
24053
23884
|
},
|
|
24054
|
-
|
|
23885
|
+
onZoomChange: (event) => {
|
|
24055
23886
|
setDocumentState({ zoom: event.nativeEvent.zoom });
|
|
24056
23887
|
},
|
|
23888
|
+
onVisiblePagesChange: (event) => {
|
|
23889
|
+
const pages = event.nativeEvent.pages ?? [];
|
|
23890
|
+
const stablePages = pages.filter(
|
|
23891
|
+
(page) => page.visibleRatio >= 0.03
|
|
23892
|
+
);
|
|
23893
|
+
if (stablePages.length === 0) {
|
|
23894
|
+
return;
|
|
23895
|
+
}
|
|
23896
|
+
const key = stablePages.map(
|
|
23897
|
+
(page) => `${page.pageIndex}:${Math.round(page.visibleRatio * 100)}`
|
|
23898
|
+
).join("|");
|
|
23899
|
+
if (key === lastVisiblePagesKeyRef.current) {
|
|
23900
|
+
return;
|
|
23901
|
+
}
|
|
23902
|
+
lastVisiblePagesKeyRef.current = key;
|
|
23903
|
+
setDocumentState({ visiblePages: stablePages });
|
|
23904
|
+
},
|
|
24057
23905
|
onAnnotationCreated: (event) => {
|
|
24058
23906
|
addAnnotation(event.nativeEvent);
|
|
24059
23907
|
},
|
|
@@ -24183,6 +24031,14 @@ var styles3 = StyleSheet3.create({
|
|
|
24183
24031
|
}
|
|
24184
24032
|
});
|
|
24185
24033
|
|
|
24034
|
+
// components/nativePdfViewerMode.ts
|
|
24035
|
+
var shouldUseNativePdfViewer = ({
|
|
24036
|
+
viewerMode,
|
|
24037
|
+
pageCount,
|
|
24038
|
+
isWebView,
|
|
24039
|
+
nativeEngineId
|
|
24040
|
+
}) => viewerMode === "native" && pageCount > 0 && !isWebView && !!nativeEngineId;
|
|
24041
|
+
|
|
24186
24042
|
// components/Viewer.tsx
|
|
24187
24043
|
import { jsx as jsx5, jsxs as jsxs5 } from "react/jsx-runtime";
|
|
24188
24044
|
var LIST_TOP_PADDING = 18;
|
|
@@ -24212,7 +24068,8 @@ var Viewer = ({
|
|
|
24212
24068
|
virtualWindowSize,
|
|
24213
24069
|
maxToRenderPerBatch,
|
|
24214
24070
|
removeClippedSubviews,
|
|
24215
|
-
useDedicatedAndroidPdfViewer
|
|
24071
|
+
useDedicatedAndroidPdfViewer,
|
|
24072
|
+
viewerMode
|
|
24216
24073
|
}) => {
|
|
24217
24074
|
const pageCount = useViewerStore4((state) => state.pageCount);
|
|
24218
24075
|
const currentPage = useViewerStore4((state) => state.currentPage);
|
|
@@ -24226,6 +24083,7 @@ var Viewer = ({
|
|
|
24226
24083
|
const uiTheme = useViewerStore4((state) => state.uiTheme);
|
|
24227
24084
|
const viewMode = useViewerStore4((state) => state.viewMode);
|
|
24228
24085
|
const zoom = useViewerStore4((state) => state.zoom);
|
|
24086
|
+
const storeViewerMode = useViewerStore4((state) => state.viewerMode);
|
|
24229
24087
|
const listRef = useRef4(null);
|
|
24230
24088
|
const horizontalScrollRef = useRef4(null);
|
|
24231
24089
|
const isDark = uiTheme === "dark";
|
|
@@ -24234,7 +24092,14 @@ var Viewer = ({
|
|
|
24234
24092
|
const isSingle = viewMode === "single";
|
|
24235
24093
|
const renderTargetType = engine.getRenderTargetType?.() ?? "canvas";
|
|
24236
24094
|
const isWebView = renderTargetType === "webview";
|
|
24237
|
-
const
|
|
24095
|
+
const resolvedViewerMode = viewerMode ?? (useDedicatedAndroidPdfViewer ? "native" : storeViewerMode);
|
|
24096
|
+
const nativeEngineId = getDedicatedAndroidPdfEngineId(engine);
|
|
24097
|
+
const isNativePdfViewer = shouldUseNativePdfViewer({
|
|
24098
|
+
viewerMode: resolvedViewerMode,
|
|
24099
|
+
pageCount,
|
|
24100
|
+
isWebView,
|
|
24101
|
+
nativeEngineId
|
|
24102
|
+
});
|
|
24238
24103
|
const perfEnabled = isMobilePerfEnabled();
|
|
24239
24104
|
const mountedAtRef = useRef4(perfNow());
|
|
24240
24105
|
const readyLoggedRef = useRef4(false);
|
|
@@ -25388,7 +25253,7 @@ var Viewer = ({
|
|
|
25388
25253
|
if (isWebView) {
|
|
25389
25254
|
return /* @__PURE__ */ jsx5(View4, { style: [styles4.container, isDark && styles4.containerDark], children: /* @__PURE__ */ jsx5(WebViewViewer_default, { engine }) });
|
|
25390
25255
|
}
|
|
25391
|
-
if (
|
|
25256
|
+
if (isNativePdfViewer) {
|
|
25392
25257
|
return /* @__PURE__ */ jsx5(View4, { style: [styles4.container, isDark && styles4.containerDark], children: /* @__PURE__ */ jsx5(DedicatedAndroidPdfViewer, { engine }) });
|
|
25393
25258
|
}
|
|
25394
25259
|
if (isSingle) {
|
|
@@ -30663,6 +30528,7 @@ export {
|
|
|
30663
30528
|
DocumentActionsSheet,
|
|
30664
30529
|
InfoSheet,
|
|
30665
30530
|
MOBILE_CHROME_METRICS,
|
|
30531
|
+
DedicatedAndroidPdfViewer as NativePdfDocumentViewer,
|
|
30666
30532
|
OverflowSheet,
|
|
30667
30533
|
PageRenderer_default as PageRenderer,
|
|
30668
30534
|
ProgressPill,
|