@papyrus-sdk/ui-react-native 0.2.35-beta.0 → 0.2.35-beta.2
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/index.js +286 -86
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +298 -98
- package/dist/index.mjs.map +1 -1
- package/package.json +12 -12
- package/LICENSE +0 -21
package/dist/index.mjs
CHANGED
|
@@ -22175,7 +22175,7 @@ import {
|
|
|
22175
22175
|
import {
|
|
22176
22176
|
Animated,
|
|
22177
22177
|
FlatList,
|
|
22178
|
-
Platform as
|
|
22178
|
+
Platform as Platform4,
|
|
22179
22179
|
ScrollView,
|
|
22180
22180
|
StyleSheet as StyleSheet5,
|
|
22181
22181
|
View as View5,
|
|
@@ -25490,7 +25490,7 @@ var styles2 = StyleSheet2.create({
|
|
|
25490
25490
|
var WebViewViewer_default = WebViewViewer;
|
|
25491
25491
|
|
|
25492
25492
|
// components/NativePdfDocumentViewer.tsx
|
|
25493
|
-
import { Platform as
|
|
25493
|
+
import { Platform as Platform3 } from "react-native";
|
|
25494
25494
|
|
|
25495
25495
|
// components/nativePdfViewerMode.ts
|
|
25496
25496
|
var resolveViewerModeTelemetry = ({
|
|
@@ -25521,13 +25521,16 @@ var shouldUseNativePdfViewer = ({
|
|
|
25521
25521
|
nativePdfDocumentViewAvailable = false,
|
|
25522
25522
|
pageTheme = "normal",
|
|
25523
25523
|
viewMode = "continuous",
|
|
25524
|
-
rotation = 0
|
|
25524
|
+
rotation = 0,
|
|
25525
|
+
activeTool = "select",
|
|
25526
|
+
nativeInkOverlayAvailable = true
|
|
25525
25527
|
}) => {
|
|
25526
25528
|
if (viewerMode !== "native" || pageCount <= 0 || isWebView || !nativeEngineId) {
|
|
25527
25529
|
return false;
|
|
25528
25530
|
}
|
|
25529
25531
|
const implementation = resolveNativePdfViewerImplementation(platform);
|
|
25530
25532
|
if (implementation === "android") return true;
|
|
25533
|
+
if (activeTool === "ink" && !nativeInkOverlayAvailable) return false;
|
|
25531
25534
|
return implementation === "ios" && nativePdfDocumentViewAvailable && pageTheme === "normal" && viewMode !== "double" && rotation === 0;
|
|
25532
25535
|
};
|
|
25533
25536
|
|
|
@@ -25876,8 +25879,7 @@ var styles3 = StyleSheet3.create({
|
|
|
25876
25879
|
|
|
25877
25880
|
// components/DedicatedIosPdfViewer.tsx
|
|
25878
25881
|
import { useCallback as useCallback3, useEffect as useEffect4, useRef as useRef4, useState as useState4 } from "react";
|
|
25879
|
-
import { Pressable as Pressable3, StyleSheet as StyleSheet4, Text, View as View4 } from "react-native";
|
|
25880
|
-
import Clipboard3 from "@react-native-clipboard/clipboard";
|
|
25882
|
+
import { Platform as Platform2, Pressable as Pressable3, StyleSheet as StyleSheet4, Text, View as View4 } from "react-native";
|
|
25881
25883
|
import { useViewerStore as useViewerStore4 } from "@papyrus-sdk/core";
|
|
25882
25884
|
import { PapyrusPdfDocumentView as PapyrusPdfDocumentView2 } from "@papyrus-sdk/engine-native";
|
|
25883
25885
|
|
|
@@ -25945,7 +25947,14 @@ var STRINGS = {
|
|
|
25945
25947
|
more: "More",
|
|
25946
25948
|
close: "Close",
|
|
25947
25949
|
copy: "Copy",
|
|
25948
|
-
define: "Define"
|
|
25950
|
+
define: "Define",
|
|
25951
|
+
annotate: "Annotate",
|
|
25952
|
+
annotationHighlight: "Highlight",
|
|
25953
|
+
annotationUnderline: "Underline",
|
|
25954
|
+
annotationStrikeout: "Strikeout",
|
|
25955
|
+
annotationSquiggly: "Squiggly",
|
|
25956
|
+
annotationNote: "Note",
|
|
25957
|
+
deleteAnnotation: "Delete"
|
|
25949
25958
|
},
|
|
25950
25959
|
"pt-BR": {
|
|
25951
25960
|
pages: "Paginas",
|
|
@@ -26009,11 +26018,37 @@ var STRINGS = {
|
|
|
26009
26018
|
more: "Mais",
|
|
26010
26019
|
close: "Fechar",
|
|
26011
26020
|
copy: "Copiar",
|
|
26012
|
-
define: "Definir"
|
|
26021
|
+
define: "Definir",
|
|
26022
|
+
annotate: "Anotar",
|
|
26023
|
+
annotationHighlight: "Destacar",
|
|
26024
|
+
annotationUnderline: "Sublinhar",
|
|
26025
|
+
annotationStrikeout: "Riscar",
|
|
26026
|
+
annotationSquiggly: "Ondulado",
|
|
26027
|
+
annotationNote: "Nota",
|
|
26028
|
+
deleteAnnotation: "Apagar"
|
|
26013
26029
|
}
|
|
26014
26030
|
};
|
|
26015
26031
|
var getStrings = (locale) => STRINGS[locale ?? "en"] ?? STRINGS.en;
|
|
26016
26032
|
|
|
26033
|
+
// components/annotationDeletion.ts
|
|
26034
|
+
var MARKUP_ANNOTATION_TYPES = /* @__PURE__ */ new Set([
|
|
26035
|
+
"highlight",
|
|
26036
|
+
"underline",
|
|
26037
|
+
"strikeout",
|
|
26038
|
+
"squiggly"
|
|
26039
|
+
]);
|
|
26040
|
+
function resolveMarkupAnnotationDeleteFallback(annotations, selectedAnnotationId, hasNativeEditMenu) {
|
|
26041
|
+
if (!selectedAnnotationId || hasNativeEditMenu) return null;
|
|
26042
|
+
const selected = annotations.find(
|
|
26043
|
+
(annotation) => annotation.id === selectedAnnotationId
|
|
26044
|
+
);
|
|
26045
|
+
return selected && MARKUP_ANNOTATION_TYPES.has(selected.type) ? selected : null;
|
|
26046
|
+
}
|
|
26047
|
+
function deleteAnnotationAndClearSelection(annotationId, removeAnnotation, setSelectedAnnotation) {
|
|
26048
|
+
removeAnnotation(annotationId);
|
|
26049
|
+
setSelectedAnnotation(null);
|
|
26050
|
+
}
|
|
26051
|
+
|
|
26017
26052
|
// components/nativePdfViewerEvents.ts
|
|
26018
26053
|
var resolveNativePdfTextSelection = (selection) => {
|
|
26019
26054
|
if (typeof selection?.text !== "string" || !selection.text.trim() || !Number.isInteger(selection.pageIndex) || (selection.pageIndex ?? -1) < 0) {
|
|
@@ -26070,6 +26105,7 @@ var MOBILE_CHROME_SHOW_DELTA2 = 22;
|
|
|
26070
26105
|
var MOBILE_CHROME_SHOW_DELAY_MS2 = 180;
|
|
26071
26106
|
var MOBILE_CHROME_TOP_RESET2 = 16;
|
|
26072
26107
|
var MIN_VISIBLE_PAGE_RATIO = 0.03;
|
|
26108
|
+
var supportsNativeEditMenu = Number.parseInt(String(Platform2.Version), 10) >= 16;
|
|
26073
26109
|
function DedicatedIosPdfViewer({
|
|
26074
26110
|
engine,
|
|
26075
26111
|
maxPageWidth,
|
|
@@ -26082,15 +26118,41 @@ function DedicatedIosPdfViewer({
|
|
|
26082
26118
|
const pageTheme = useViewerStore4((state) => state.pageTheme);
|
|
26083
26119
|
const zoom = useViewerStore4((state) => state.zoom);
|
|
26084
26120
|
const currentPage = useViewerStore4((state) => state.currentPage);
|
|
26121
|
+
const searchResults = useViewerStore4((state) => state.searchResults);
|
|
26122
|
+
const activeSearchIndex = useViewerStore4((state) => state.activeSearchIndex);
|
|
26085
26123
|
const viewMode = useViewerStore4((state) => state.viewMode);
|
|
26086
26124
|
const selectionActive = useViewerStore4((state) => state.selectionActive);
|
|
26087
26125
|
const activeTool = useViewerStore4((state) => state.activeTool);
|
|
26126
|
+
const activeDrawToolPreset = useViewerStore4(
|
|
26127
|
+
(state) => state.activeDrawToolPreset
|
|
26128
|
+
);
|
|
26129
|
+
const inkStrokeWidth = useViewerStore4((state) => state.inkStrokeWidth);
|
|
26130
|
+
const annotations = useViewerStore4((state) => state.annotations);
|
|
26131
|
+
const annotationColor = useViewerStore4((state) => state.annotationColor);
|
|
26132
|
+
const annotationSelectionColor = useViewerStore4((state) => state.accentColor);
|
|
26133
|
+
const annotationOpacity = useViewerStore4((state) => state.annotationOpacity);
|
|
26134
|
+
const selectedAnnotationId = useViewerStore4(
|
|
26135
|
+
(state) => state.selectedAnnotationId
|
|
26136
|
+
);
|
|
26137
|
+
const addAnnotation = useViewerStore4((state) => state.addAnnotation);
|
|
26138
|
+
const removeAnnotation = useViewerStore4((state) => state.removeAnnotation);
|
|
26139
|
+
const setSelectedAnnotation = useViewerStore4(
|
|
26140
|
+
(state) => state.setSelectedAnnotation
|
|
26141
|
+
);
|
|
26088
26142
|
const mobileChromeVisible = useViewerStore4(
|
|
26089
26143
|
(state) => state.mobileChromeVisible
|
|
26090
26144
|
);
|
|
26091
26145
|
const setDocumentState = useViewerStore4((state) => state.setDocumentState);
|
|
26146
|
+
const commitInkStrokesForPage = useViewerStore4(
|
|
26147
|
+
(state) => state.commitInkStrokesForPage
|
|
26148
|
+
);
|
|
26092
26149
|
const engineId = getDedicatedAndroidPdfEngineId(engine);
|
|
26093
26150
|
const nativeViewMode = viewMode === "single" ? "single" : "continuous";
|
|
26151
|
+
const fallbackDeleteAnnotation = resolveMarkupAnnotationDeleteFallback(
|
|
26152
|
+
annotations,
|
|
26153
|
+
selectedAnnotationId,
|
|
26154
|
+
supportsNativeEditMenu
|
|
26155
|
+
);
|
|
26094
26156
|
const resolvedMaxPageWidth = typeof maxPageWidth === "number" && Number.isFinite(maxPageWidth) && maxPageWidth > 0 ? maxPageWidth : void 0;
|
|
26095
26157
|
const chromeVisibleRef = useRef4(mobileChromeVisible);
|
|
26096
26158
|
const lastScrollOffsetYRef = useRef4(0);
|
|
@@ -26101,6 +26163,15 @@ function DedicatedIosPdfViewer({
|
|
|
26101
26163
|
const lastVisiblePagesKeyRef = useRef4("");
|
|
26102
26164
|
const [selection, setSelection] = useState4(null);
|
|
26103
26165
|
const selectionRef = useRef4(null);
|
|
26166
|
+
useEffect4(() => {
|
|
26167
|
+
const pickerActive = supportsNativeEditMenu && activeTool === "ink";
|
|
26168
|
+
setDocumentState({ nativeInkToolPickerActive: pickerActive });
|
|
26169
|
+
return () => {
|
|
26170
|
+
if (pickerActive) {
|
|
26171
|
+
setDocumentState({ nativeInkToolPickerActive: false });
|
|
26172
|
+
}
|
|
26173
|
+
};
|
|
26174
|
+
}, [activeTool, setDocumentState]);
|
|
26104
26175
|
useEffect4(() => {
|
|
26105
26176
|
chromeVisibleRef.current = mobileChromeVisible;
|
|
26106
26177
|
}, [mobileChromeVisible]);
|
|
@@ -26131,16 +26202,12 @@ function DedicatedIosPdfViewer({
|
|
|
26131
26202
|
if (nextSelection) {
|
|
26132
26203
|
const { text, pageIndex } = nextSelection;
|
|
26133
26204
|
onTextSelected?.({ text, pageIndex });
|
|
26205
|
+
} else {
|
|
26206
|
+
setSelectedAnnotation(null);
|
|
26134
26207
|
}
|
|
26135
26208
|
},
|
|
26136
|
-
[onTextSelected, updateSelection]
|
|
26209
|
+
[onTextSelected, setSelectedAnnotation, updateSelection]
|
|
26137
26210
|
);
|
|
26138
|
-
const copySelection = useCallback3(async () => {
|
|
26139
|
-
const selection2 = selectionRef.current;
|
|
26140
|
-
if (!selection2) return;
|
|
26141
|
-
const copied = await copySelectionText(selection2.text, Clipboard3);
|
|
26142
|
-
if (copied) updateSelection(null);
|
|
26143
|
-
}, [updateSelection]);
|
|
26144
26211
|
const defineSelection = useCallback3(() => {
|
|
26145
26212
|
const currentSelection = selectionRef.current;
|
|
26146
26213
|
if (!currentSelection) return;
|
|
@@ -26150,6 +26217,18 @@ function DedicatedIosPdfViewer({
|
|
|
26150
26217
|
});
|
|
26151
26218
|
updateSelection(null);
|
|
26152
26219
|
}, [onDefineSelection, updateSelection]);
|
|
26220
|
+
const handleNativeDefineSelection = useCallback3(
|
|
26221
|
+
(event) => {
|
|
26222
|
+
const text = event.nativeEvent?.text;
|
|
26223
|
+
const pageIndex = event.nativeEvent?.pageIndex;
|
|
26224
|
+
if (typeof text !== "string" || text.length === 0 || typeof pageIndex !== "number" || !Number.isInteger(pageIndex) || pageIndex < 0) {
|
|
26225
|
+
return;
|
|
26226
|
+
}
|
|
26227
|
+
onDefineSelection?.({ text, pageIndex });
|
|
26228
|
+
updateSelection(null);
|
|
26229
|
+
},
|
|
26230
|
+
[onDefineSelection, updateSelection]
|
|
26231
|
+
);
|
|
26153
26232
|
const trackMobileChromeByOffset = useCallback3(
|
|
26154
26233
|
(offsetY) => {
|
|
26155
26234
|
if (pageCount <= 0) return;
|
|
@@ -26212,6 +26291,7 @@ function DedicatedIosPdfViewer({
|
|
|
26212
26291
|
[trackMobileChromeByOffset]
|
|
26213
26292
|
);
|
|
26214
26293
|
const handleTap = useCallback3(() => {
|
|
26294
|
+
setSelectedAnnotation(null);
|
|
26215
26295
|
const nextVisible = resolvePageTapChromeVisibility({
|
|
26216
26296
|
chromeVisible: chromeVisibleRef.current,
|
|
26217
26297
|
selectionActive: selectionActive || selectionRef.current !== null,
|
|
@@ -26219,7 +26299,17 @@ function DedicatedIosPdfViewer({
|
|
|
26219
26299
|
toolActive: activeTool !== "select"
|
|
26220
26300
|
});
|
|
26221
26301
|
if (nextVisible !== null) setMobileChromeVisible(nextVisible);
|
|
26222
|
-
}, [activeTool, selectionActive, setMobileChromeVisible]);
|
|
26302
|
+
}, [activeTool, selectionActive, setMobileChromeVisible, setSelectedAnnotation]);
|
|
26303
|
+
const handleDeleteAnnotation = useCallback3(
|
|
26304
|
+
(annotationId) => {
|
|
26305
|
+
deleteAnnotationAndClearSelection(
|
|
26306
|
+
annotationId,
|
|
26307
|
+
removeAnnotation,
|
|
26308
|
+
setSelectedAnnotation
|
|
26309
|
+
);
|
|
26310
|
+
},
|
|
26311
|
+
[removeAnnotation, setSelectedAnnotation]
|
|
26312
|
+
);
|
|
26223
26313
|
const cappedViewerStyle = resolvedMaxPageWidth ? {
|
|
26224
26314
|
width: "100%",
|
|
26225
26315
|
maxWidth: resolvedMaxPageWidth,
|
|
@@ -26234,6 +26324,16 @@ function DedicatedIosPdfViewer({
|
|
|
26234
26324
|
pageTheme,
|
|
26235
26325
|
zoom,
|
|
26236
26326
|
currentPage,
|
|
26327
|
+
searchResults,
|
|
26328
|
+
activeSearchIndex,
|
|
26329
|
+
annotations,
|
|
26330
|
+
activeTool,
|
|
26331
|
+
activeDrawToolPreset,
|
|
26332
|
+
inkStrokeWidth,
|
|
26333
|
+
annotationColor,
|
|
26334
|
+
annotationSelectionColor,
|
|
26335
|
+
annotationOpacity,
|
|
26336
|
+
selectedAnnotationId,
|
|
26237
26337
|
viewMode: nativeViewMode,
|
|
26238
26338
|
selectionActive: selection !== null,
|
|
26239
26339
|
onPageChange: (event) => {
|
|
@@ -26256,40 +26356,64 @@ function DedicatedIosPdfViewer({
|
|
|
26256
26356
|
onVisiblePagesChange: handleVisiblePagesChange,
|
|
26257
26357
|
onScroll: handleScroll,
|
|
26258
26358
|
onTap: handleTap,
|
|
26259
|
-
onTextSelected: handleTextSelectionChange
|
|
26359
|
+
onTextSelected: handleTextSelectionChange,
|
|
26360
|
+
defineLabel: t.define,
|
|
26361
|
+
annotateLabel: t.annotate,
|
|
26362
|
+
annotationHighlightLabel: t.annotationHighlight,
|
|
26363
|
+
annotationUnderlineLabel: t.annotationUnderline,
|
|
26364
|
+
annotationStrikeoutLabel: t.annotationStrikeout,
|
|
26365
|
+
annotationSquigglyLabel: t.annotationSquiggly,
|
|
26366
|
+
annotationNoteLabel: t.annotationNote,
|
|
26367
|
+
annotationDeleteLabel: t.deleteAnnotation,
|
|
26368
|
+
onDefineSelection: onDefineSelection ? handleNativeDefineSelection : void 0,
|
|
26369
|
+
onAnnotationCreated: (event) => addAnnotation(event.nativeEvent),
|
|
26370
|
+
onAnnotationTap: (event) => setSelectedAnnotation(event.nativeEvent.id),
|
|
26371
|
+
onAnnotationDelete: (event) => handleDeleteAnnotation(event.nativeEvent.id),
|
|
26372
|
+
onAnnotationDeselected: () => setSelectedAnnotation(null),
|
|
26373
|
+
onInkDrawingCommitted: (event) => {
|
|
26374
|
+
const pageIndex = event.nativeEvent?.pageIndex;
|
|
26375
|
+
const strokes = event.nativeEvent?.strokes;
|
|
26376
|
+
if (typeof pageIndex !== "number" || !Number.isInteger(pageIndex) || pageIndex < 0 || !Array.isArray(strokes)) {
|
|
26377
|
+
return;
|
|
26378
|
+
}
|
|
26379
|
+
commitInkStrokesForPage(pageIndex, strokes);
|
|
26380
|
+
}
|
|
26260
26381
|
}
|
|
26261
26382
|
),
|
|
26262
|
-
selection && /* @__PURE__ */ jsx6(View4, { style: styles4.
|
|
26263
|
-
|
|
26264
|
-
|
|
26265
|
-
|
|
26266
|
-
|
|
26267
|
-
|
|
26268
|
-
|
|
26269
|
-
|
|
26270
|
-
|
|
26271
|
-
|
|
26272
|
-
|
|
26273
|
-
|
|
26274
|
-
|
|
26275
|
-
|
|
26276
|
-
|
|
26277
|
-
|
|
26278
|
-
|
|
26279
|
-
|
|
26280
|
-
|
|
26281
|
-
|
|
26282
|
-
|
|
26283
|
-
|
|
26284
|
-
|
|
26285
|
-
|
|
26286
|
-
|
|
26383
|
+
selection && !supportsNativeEditMenu && onDefineSelection && /* @__PURE__ */ jsx6(View4, { style: styles4.selectionFallback, pointerEvents: "box-none", children: /* @__PURE__ */ jsx6(
|
|
26384
|
+
Pressable3,
|
|
26385
|
+
{
|
|
26386
|
+
onPress: defineSelection,
|
|
26387
|
+
style: styles4.fallbackButton,
|
|
26388
|
+
accessibilityRole: "button",
|
|
26389
|
+
accessibilityLabel: t.define,
|
|
26390
|
+
children: /* @__PURE__ */ jsx6(Text, { style: styles4.fallbackButtonText, children: t.define })
|
|
26391
|
+
}
|
|
26392
|
+
) }),
|
|
26393
|
+
fallbackDeleteAnnotation && /* @__PURE__ */ jsx6(
|
|
26394
|
+
View4,
|
|
26395
|
+
{
|
|
26396
|
+
style: styles4.annotationDeleteFallback,
|
|
26397
|
+
pointerEvents: "box-none",
|
|
26398
|
+
children: /* @__PURE__ */ jsx6(
|
|
26399
|
+
Pressable3,
|
|
26400
|
+
{
|
|
26401
|
+
onPress: () => handleDeleteAnnotation(fallbackDeleteAnnotation.id),
|
|
26402
|
+
style: styles4.annotationDeleteButton,
|
|
26403
|
+
accessibilityRole: "button",
|
|
26404
|
+
accessibilityLabel: t.deleteAnnotation,
|
|
26405
|
+
hitSlop: 8,
|
|
26406
|
+
children: /* @__PURE__ */ jsx6(Text, { style: styles4.annotationDeleteButtonText, children: t.deleteAnnotation })
|
|
26407
|
+
}
|
|
26408
|
+
)
|
|
26409
|
+
}
|
|
26410
|
+
)
|
|
26287
26411
|
] });
|
|
26288
26412
|
}
|
|
26289
26413
|
var styles4 = StyleSheet4.create({
|
|
26290
26414
|
container: { flex: 1, alignItems: "stretch" },
|
|
26291
26415
|
viewer: { flex: 1, width: "100%" },
|
|
26292
|
-
|
|
26416
|
+
selectionFallback: {
|
|
26293
26417
|
position: "absolute",
|
|
26294
26418
|
left: 0,
|
|
26295
26419
|
right: 0,
|
|
@@ -26298,31 +26422,43 @@ var styles4 = StyleSheet4.create({
|
|
|
26298
26422
|
justifyContent: "center",
|
|
26299
26423
|
zIndex: 50
|
|
26300
26424
|
},
|
|
26301
|
-
|
|
26302
|
-
flexDirection: "row",
|
|
26425
|
+
fallbackButton: {
|
|
26303
26426
|
backgroundColor: "rgba(30, 30, 30, 0.92)",
|
|
26304
26427
|
borderRadius: 16,
|
|
26305
26428
|
paddingHorizontal: 8,
|
|
26306
26429
|
paddingVertical: 8,
|
|
26307
|
-
gap: 4,
|
|
26308
26430
|
shadowColor: "#000",
|
|
26309
26431
|
shadowOffset: { width: 0, height: 4 },
|
|
26310
26432
|
shadowOpacity: 0.3,
|
|
26311
26433
|
shadowRadius: 12,
|
|
26312
26434
|
elevation: 10
|
|
26313
26435
|
},
|
|
26314
|
-
|
|
26315
|
-
|
|
26316
|
-
|
|
26317
|
-
|
|
26318
|
-
|
|
26319
|
-
|
|
26320
|
-
|
|
26436
|
+
fallbackButtonText: {
|
|
26437
|
+
color: "#fff",
|
|
26438
|
+
fontSize: 12,
|
|
26439
|
+
fontWeight: "700"
|
|
26440
|
+
},
|
|
26441
|
+
annotationDeleteFallback: {
|
|
26442
|
+
position: "absolute",
|
|
26443
|
+
left: 0,
|
|
26444
|
+
right: 16,
|
|
26445
|
+
bottom: 120,
|
|
26446
|
+
alignItems: "flex-end",
|
|
26321
26447
|
justifyContent: "center",
|
|
26322
|
-
|
|
26323
|
-
paddingHorizontal: 10
|
|
26448
|
+
zIndex: 51
|
|
26324
26449
|
},
|
|
26325
|
-
|
|
26450
|
+
annotationDeleteButton: {
|
|
26451
|
+
backgroundColor: "#b91c1c",
|
|
26452
|
+
borderRadius: 16,
|
|
26453
|
+
paddingHorizontal: 12,
|
|
26454
|
+
paddingVertical: 8,
|
|
26455
|
+
shadowColor: "#000",
|
|
26456
|
+
shadowOffset: { width: 0, height: 4 },
|
|
26457
|
+
shadowOpacity: 0.3,
|
|
26458
|
+
shadowRadius: 12,
|
|
26459
|
+
elevation: 10
|
|
26460
|
+
},
|
|
26461
|
+
annotationDeleteButtonText: {
|
|
26326
26462
|
color: "#fff",
|
|
26327
26463
|
fontSize: 12,
|
|
26328
26464
|
fontWeight: "700"
|
|
@@ -26338,7 +26474,7 @@ function NativePdfDocumentViewer({
|
|
|
26338
26474
|
onDefineSelection
|
|
26339
26475
|
}) {
|
|
26340
26476
|
const implementation = resolveNativePdfViewerImplementation(
|
|
26341
|
-
|
|
26477
|
+
Platform3.OS
|
|
26342
26478
|
);
|
|
26343
26479
|
if (implementation === "android") {
|
|
26344
26480
|
return /* @__PURE__ */ jsx7(
|
|
@@ -26516,7 +26652,7 @@ var shouldEnableViewerScrollForPageScrub = ({
|
|
|
26516
26652
|
isScrubbing
|
|
26517
26653
|
}) => viewerScrollEnabled && !isScrubbing;
|
|
26518
26654
|
var resolvePageScrubberTouchPolicy = () => ({
|
|
26519
|
-
responderTarget: "
|
|
26655
|
+
responderTarget: "pill",
|
|
26520
26656
|
claimOnStart: true,
|
|
26521
26657
|
captureOnStart: true,
|
|
26522
26658
|
captureOnMove: true,
|
|
@@ -26526,11 +26662,18 @@ var resolvePageScrubberOverlayStyle = () => ({
|
|
|
26526
26662
|
zIndex: 30,
|
|
26527
26663
|
elevation: 30
|
|
26528
26664
|
});
|
|
26529
|
-
var resolvePageScrubberPointerEvents = () => "box-
|
|
26665
|
+
var resolvePageScrubberPointerEvents = () => "box-none";
|
|
26530
26666
|
var resolvePageScrubberReleaseAction = ({
|
|
26531
26667
|
hasMoved,
|
|
26532
|
-
pendingPage
|
|
26533
|
-
|
|
26668
|
+
pendingPage,
|
|
26669
|
+
longPressTriggered = false
|
|
26670
|
+
}) => {
|
|
26671
|
+
if (longPressTriggered) return { kind: "none" };
|
|
26672
|
+
if (hasMoved && pendingPage !== null) {
|
|
26673
|
+
return { kind: "navigate", page: pendingPage };
|
|
26674
|
+
}
|
|
26675
|
+
return { kind: "open" };
|
|
26676
|
+
};
|
|
26534
26677
|
var createPageScrubberNavigationController = (onRelease) => {
|
|
26535
26678
|
let active = false;
|
|
26536
26679
|
let pendingPage = null;
|
|
@@ -26727,7 +26870,7 @@ var Viewer = ({
|
|
|
26727
26870
|
const renderTargetType = engine.getRenderTargetType?.() ?? "canvas";
|
|
26728
26871
|
const isWebView = renderTargetType === "webview";
|
|
26729
26872
|
const resolvedViewerMode = resolveEffectivePdfViewerMode({
|
|
26730
|
-
platform:
|
|
26873
|
+
platform: Platform4.OS,
|
|
26731
26874
|
viewerMode,
|
|
26732
26875
|
useDedicatedAndroidPdfViewer,
|
|
26733
26876
|
storeViewerMode
|
|
@@ -26738,9 +26881,10 @@ var Viewer = ({
|
|
|
26738
26881
|
[mobilePerf]
|
|
26739
26882
|
);
|
|
26740
26883
|
const nativeEngineId = getDedicatedAndroidPdfEngineId(engine);
|
|
26741
|
-
const nativePdfDocumentViewAvailable =
|
|
26884
|
+
const nativePdfDocumentViewAvailable = Platform4.OS === "ios" && isPapyrusPdfDocumentViewAvailable();
|
|
26885
|
+
const nativeInkOverlayAvailable = Platform4.OS !== "ios" || Number.parseInt(String(Platform4.Version), 10) >= 16;
|
|
26742
26886
|
const isNativePdfViewer = shouldUseNativePdfViewer({
|
|
26743
|
-
platform:
|
|
26887
|
+
platform: Platform4.OS,
|
|
26744
26888
|
viewerMode: resolvedViewerMode,
|
|
26745
26889
|
pageCount,
|
|
26746
26890
|
isWebView,
|
|
@@ -26748,7 +26892,9 @@ var Viewer = ({
|
|
|
26748
26892
|
nativePdfDocumentViewAvailable,
|
|
26749
26893
|
pageTheme,
|
|
26750
26894
|
viewMode,
|
|
26751
|
-
rotation
|
|
26895
|
+
rotation,
|
|
26896
|
+
activeTool,
|
|
26897
|
+
nativeInkOverlayAvailable
|
|
26752
26898
|
});
|
|
26753
26899
|
useEffect5(() => {
|
|
26754
26900
|
mobilePerf.emit(
|
|
@@ -26762,12 +26908,15 @@ var Viewer = ({
|
|
|
26762
26908
|
}, [isNativePdfViewer, isWebView, mobilePerf, resolvedViewerMode]);
|
|
26763
26909
|
const warnedNativePdfFallbackRef = useRef5("");
|
|
26764
26910
|
useEffect5(() => {
|
|
26765
|
-
if (!__DEV__ ||
|
|
26911
|
+
if (!__DEV__ || Platform4.OS !== "ios" || resolvedViewerMode !== "native" || isWebView || pageCount <= 0) {
|
|
26766
26912
|
return;
|
|
26767
26913
|
}
|
|
26768
26914
|
const reason = (() => {
|
|
26769
26915
|
if (!nativePdfDocumentViewAvailable) return "manager-unavailable";
|
|
26770
26916
|
if (!nativeEngineId) return "engine-unavailable";
|
|
26917
|
+
if (activeTool === "ink" && !nativeInkOverlayAvailable) {
|
|
26918
|
+
return "unsupported-ink-overlay";
|
|
26919
|
+
}
|
|
26771
26920
|
if (pageTheme !== "normal") return "unsupported-page-theme";
|
|
26772
26921
|
if (viewMode === "double") return "unsupported-view-mode";
|
|
26773
26922
|
if (rotation !== 0) return "unsupported-rotation";
|
|
@@ -26778,6 +26927,7 @@ var Viewer = ({
|
|
|
26778
26927
|
const detailByReason = {
|
|
26779
26928
|
"manager-unavailable": "the PapyrusPdfDocumentView manager is not registered",
|
|
26780
26929
|
"engine-unavailable": "the native PDF engine id is unavailable",
|
|
26930
|
+
"unsupported-ink-overlay": "PencilKit page overlays require iOS 16 or newer",
|
|
26781
26931
|
"unsupported-page-theme": `pageTheme '${pageTheme}' is not supported by the native viewport`,
|
|
26782
26932
|
"unsupported-view-mode": "double-page mode is not supported by the native viewport",
|
|
26783
26933
|
"unsupported-rotation": "document rotation is not supported by the native viewport"
|
|
@@ -26787,8 +26937,10 @@ var Viewer = ({
|
|
|
26787
26937
|
);
|
|
26788
26938
|
}, [
|
|
26789
26939
|
isWebView,
|
|
26940
|
+
activeTool,
|
|
26790
26941
|
nativeEngineId,
|
|
26791
26942
|
nativePdfDocumentViewAvailable,
|
|
26943
|
+
nativeInkOverlayAvailable,
|
|
26792
26944
|
pageCount,
|
|
26793
26945
|
pageTheme,
|
|
26794
26946
|
rotation,
|
|
@@ -26884,7 +27036,7 @@ var Viewer = ({
|
|
|
26884
27036
|
[maxToRenderPerBatch]
|
|
26885
27037
|
);
|
|
26886
27038
|
const resolvedRemoveClippedSubviews = resolveRemoveClippedSubviews({
|
|
26887
|
-
platform:
|
|
27039
|
+
platform: Platform4.OS,
|
|
26888
27040
|
viewerMode: resolvedViewerMode,
|
|
26889
27041
|
requestedValue: removeClippedSubviews
|
|
26890
27042
|
});
|
|
@@ -28019,7 +28171,7 @@ var Viewer = ({
|
|
|
28019
28171
|
[ensurePageDimensions, isDouble, rows, scaledListLayoutMetrics]
|
|
28020
28172
|
);
|
|
28021
28173
|
useEffect5(() => {
|
|
28022
|
-
if (
|
|
28174
|
+
if (Platform4.OS === "ios" && isNativePdfViewer) {
|
|
28023
28175
|
clearPendingScrollTarget();
|
|
28024
28176
|
if (scrollToPageSignal === null) return;
|
|
28025
28177
|
if (pageCount === 0) return;
|
|
@@ -29445,6 +29597,9 @@ import { useViewerStore as useViewerStore7 } from "@papyrus-sdk/core";
|
|
|
29445
29597
|
// components/ToolDock.layout.ts
|
|
29446
29598
|
var TOOL_DOCK_SCROLL_THRESHOLD = 420;
|
|
29447
29599
|
var shouldUseScrollablePrimaryToolsRow = (windowWidth) => windowWidth < TOOL_DOCK_SCROLL_THRESHOLD;
|
|
29600
|
+
var shouldShowToolDockInkControls = ({
|
|
29601
|
+
nativeInkToolPickerActive
|
|
29602
|
+
}) => !nativeInkToolPickerActive;
|
|
29448
29603
|
var DRAWING_TOOL_IDS = /* @__PURE__ */ new Set(["ink", "highlight", "underline"]);
|
|
29449
29604
|
var resolveToolDockBaseIconColor = ({
|
|
29450
29605
|
label,
|
|
@@ -29648,6 +29803,7 @@ var ToolDock = () => {
|
|
|
29648
29803
|
toolDockOpen,
|
|
29649
29804
|
setDocumentState,
|
|
29650
29805
|
activeDrawToolPreset,
|
|
29806
|
+
nativeInkToolPickerActive,
|
|
29651
29807
|
annotationUndoStack,
|
|
29652
29808
|
annotationRedoStack,
|
|
29653
29809
|
undoAnnotations,
|
|
@@ -29675,9 +29831,17 @@ var ToolDock = () => {
|
|
|
29675
29831
|
[activeTool, activeDrawToolPreset, interactionMode]
|
|
29676
29832
|
);
|
|
29677
29833
|
const inkSettingsExpanded = activeTool === "ink" && activeDrawToolPreset === "ink";
|
|
29834
|
+
const showInkDockControls = shouldShowToolDockInkControls({
|
|
29835
|
+
nativeInkToolPickerActive
|
|
29836
|
+
});
|
|
29678
29837
|
const canUndo = annotationUndoStack.length > 0;
|
|
29679
29838
|
const canRedo = annotationRedoStack.length > 0;
|
|
29680
29839
|
const primaryToolsRowIsScrollable = shouldUseScrollablePrimaryToolsRow(windowWidth);
|
|
29840
|
+
useEffect8(() => {
|
|
29841
|
+
if (!nativeInkToolPickerActive) return;
|
|
29842
|
+
setPaletteExpanded(false);
|
|
29843
|
+
setExtrasExpanded(false);
|
|
29844
|
+
}, [nativeInkToolPickerActive]);
|
|
29681
29845
|
const applyTool = (toolId) => {
|
|
29682
29846
|
if (toolId === "ink") {
|
|
29683
29847
|
setDocumentState({
|
|
@@ -29782,7 +29946,7 @@ var ToolDock = () => {
|
|
|
29782
29946
|
pointerEvents: "box-none",
|
|
29783
29947
|
style: [styles9.root, { paddingBottom: chromeOffsets.toolDock }],
|
|
29784
29948
|
children: toolDockOpen ? /* @__PURE__ */ jsxs10(View9, { style: styles9.stack, children: [
|
|
29785
|
-
paletteExpanded ? /* @__PURE__ */ jsx13(
|
|
29949
|
+
paletteExpanded && showInkDockControls ? /* @__PURE__ */ jsx13(
|
|
29786
29950
|
View9,
|
|
29787
29951
|
{
|
|
29788
29952
|
style: [
|
|
@@ -29823,7 +29987,7 @@ var ToolDock = () => {
|
|
|
29823
29987
|
}) })
|
|
29824
29988
|
}
|
|
29825
29989
|
) : null,
|
|
29826
|
-
inkSettingsExpanded ? /* @__PURE__ */ jsxs10(
|
|
29990
|
+
inkSettingsExpanded && showInkDockControls ? /* @__PURE__ */ jsxs10(
|
|
29827
29991
|
View9,
|
|
29828
29992
|
{
|
|
29829
29993
|
style: [
|
|
@@ -30394,7 +30558,7 @@ import {
|
|
|
30394
30558
|
} from "react";
|
|
30395
30559
|
import {
|
|
30396
30560
|
Image as Image2,
|
|
30397
|
-
Platform as
|
|
30561
|
+
Platform as Platform5,
|
|
30398
30562
|
Pressable as Pressable8,
|
|
30399
30563
|
StyleSheet as StyleSheet10,
|
|
30400
30564
|
Text as Text6,
|
|
@@ -30475,7 +30639,7 @@ var PageThumbnail = ({
|
|
|
30475
30639
|
if (!layoutReady || !useNativePreview || !shouldRenderPreview) return;
|
|
30476
30640
|
const viewTag = findNodeHandle2(viewRef.current);
|
|
30477
30641
|
if (!viewTag) return;
|
|
30478
|
-
const isNative =
|
|
30642
|
+
const isNative = Platform5.OS === "android" || Platform5.OS === "ios";
|
|
30479
30643
|
const renderScale = isNative ? 2 / Math.max(zoom, 0.5) : 2;
|
|
30480
30644
|
void engine.renderPage(pageIndex, viewTag, renderScale);
|
|
30481
30645
|
}, [
|
|
@@ -31415,6 +31579,7 @@ var AnnotationEditor = () => {
|
|
|
31415
31579
|
annotations,
|
|
31416
31580
|
selectedAnnotationId,
|
|
31417
31581
|
updateAnnotation,
|
|
31582
|
+
removeAnnotation,
|
|
31418
31583
|
setSelectedAnnotation,
|
|
31419
31584
|
uiTheme,
|
|
31420
31585
|
locale,
|
|
@@ -31436,6 +31601,13 @@ var AnnotationEditor = () => {
|
|
|
31436
31601
|
updateAnnotation(annotation.id, { content: draft });
|
|
31437
31602
|
setSelectedAnnotation(null);
|
|
31438
31603
|
};
|
|
31604
|
+
const handleDelete = () => {
|
|
31605
|
+
deleteAnnotationAndClearSelection(
|
|
31606
|
+
annotation.id,
|
|
31607
|
+
removeAnnotation,
|
|
31608
|
+
setSelectedAnnotation
|
|
31609
|
+
);
|
|
31610
|
+
};
|
|
31439
31611
|
return /* @__PURE__ */ jsx15(
|
|
31440
31612
|
Modal2,
|
|
31441
31613
|
{
|
|
@@ -31457,6 +31629,22 @@ var AnnotationEditor = () => {
|
|
|
31457
31629
|
}
|
|
31458
31630
|
),
|
|
31459
31631
|
/* @__PURE__ */ jsxs12(View11, { style: styles11.actions, children: [
|
|
31632
|
+
/* @__PURE__ */ jsx15(
|
|
31633
|
+
Pressable9,
|
|
31634
|
+
{
|
|
31635
|
+
onPress: handleDelete,
|
|
31636
|
+
style: [
|
|
31637
|
+
styles11.actionButton,
|
|
31638
|
+
styles11.actionDelete,
|
|
31639
|
+
isDark && styles11.actionDeleteDark
|
|
31640
|
+
],
|
|
31641
|
+
accessibilityRole: "button",
|
|
31642
|
+
accessibilityLabel: t.deleteAnnotation,
|
|
31643
|
+
testID: "annotation-delete-button",
|
|
31644
|
+
children: /* @__PURE__ */ jsx15(Text7, { style: [styles11.actionText, styles11.actionTextLight], children: t.deleteAnnotation })
|
|
31645
|
+
}
|
|
31646
|
+
),
|
|
31647
|
+
/* @__PURE__ */ jsx15(View11, { style: styles11.actionSpacer }),
|
|
31460
31648
|
/* @__PURE__ */ jsx15(
|
|
31461
31649
|
Pressable9,
|
|
31462
31650
|
{
|
|
@@ -31526,8 +31714,9 @@ var styles11 = StyleSheet11.create({
|
|
|
31526
31714
|
actions: {
|
|
31527
31715
|
marginTop: 16,
|
|
31528
31716
|
flexDirection: "row",
|
|
31529
|
-
|
|
31717
|
+
alignItems: "center"
|
|
31530
31718
|
},
|
|
31719
|
+
actionSpacer: { flex: 1 },
|
|
31531
31720
|
actionButton: {
|
|
31532
31721
|
paddingHorizontal: 12,
|
|
31533
31722
|
paddingVertical: 8,
|
|
@@ -31537,6 +31726,12 @@ var styles11 = StyleSheet11.create({
|
|
|
31537
31726
|
actionCancel: {
|
|
31538
31727
|
backgroundColor: "#e5e7eb"
|
|
31539
31728
|
},
|
|
31729
|
+
actionDelete: {
|
|
31730
|
+
backgroundColor: "#b91c1c"
|
|
31731
|
+
},
|
|
31732
|
+
actionDeleteDark: {
|
|
31733
|
+
backgroundColor: "#991b1b"
|
|
31734
|
+
},
|
|
31540
31735
|
actionSave: {
|
|
31541
31736
|
backgroundColor: "#2563eb"
|
|
31542
31737
|
},
|
|
@@ -33182,7 +33377,8 @@ function ProgressPill({
|
|
|
33182
33377
|
const releasedPage = scrubNavigationControllerRef.current.release();
|
|
33183
33378
|
const releaseAction = resolvePageScrubberReleaseAction({
|
|
33184
33379
|
hasMoved: hasMovedRef.current,
|
|
33185
|
-
pendingPage: releasedPage
|
|
33380
|
+
pendingPage: releasedPage,
|
|
33381
|
+
longPressTriggered: longPressTriggeredRef.current
|
|
33186
33382
|
});
|
|
33187
33383
|
if (releaseAction.kind === "navigate") {
|
|
33188
33384
|
pendingReleasedScrubPageRef.current = releaseAction.page;
|
|
@@ -33220,9 +33416,6 @@ function ProgressPill({
|
|
|
33220
33416
|
});
|
|
33221
33417
|
}
|
|
33222
33418
|
const responderPanHandlers = scrubberResponderRef.current?.panHandlers ?? {};
|
|
33223
|
-
const responderTarget = touchPolicy.responderTarget;
|
|
33224
|
-
const scrubberPanHandlers = responderTarget === "track" ? responderPanHandlers : {};
|
|
33225
|
-
const pillPanHandlers = responderTarget === "pill" ? responderPanHandlers : {};
|
|
33226
33419
|
return /* @__PURE__ */ jsx22(
|
|
33227
33420
|
View18,
|
|
33228
33421
|
{
|
|
@@ -33241,7 +33434,6 @@ function ProgressPill({
|
|
|
33241
33434
|
ref: scrubberRef,
|
|
33242
33435
|
pointerEvents: resolvePageScrubberPointerEvents(),
|
|
33243
33436
|
style: [styles18.scrubber, { height: trackHeight }],
|
|
33244
|
-
...scrubberPanHandlers,
|
|
33245
33437
|
onLayout: () => {
|
|
33246
33438
|
scrubberRef.current?.measureInWindow((_x, y) => {
|
|
33247
33439
|
trackYRef.current = y;
|
|
@@ -33251,6 +33443,7 @@ function ProgressPill({
|
|
|
33251
33443
|
/* @__PURE__ */ jsx22(
|
|
33252
33444
|
Animated3.View,
|
|
33253
33445
|
{
|
|
33446
|
+
pointerEvents: "none",
|
|
33254
33447
|
style: [
|
|
33255
33448
|
styles18.track,
|
|
33256
33449
|
isDark && styles18.trackDark,
|
|
@@ -33263,29 +33456,36 @@ function ProgressPill({
|
|
|
33263
33456
|
]
|
|
33264
33457
|
}
|
|
33265
33458
|
),
|
|
33266
|
-
/* @__PURE__ */ jsx22(
|
|
33267
|
-
|
|
33459
|
+
/* @__PURE__ */ jsx22(
|
|
33460
|
+
Animated3.View,
|
|
33268
33461
|
{
|
|
33269
|
-
|
|
33270
|
-
|
|
33271
|
-
|
|
33272
|
-
|
|
33273
|
-
|
|
33274
|
-
|
|
33275
|
-
|
|
33276
|
-
|
|
33277
|
-
|
|
33278
|
-
|
|
33279
|
-
|
|
33280
|
-
|
|
33281
|
-
|
|
33282
|
-
|
|
33283
|
-
|
|
33284
|
-
|
|
33285
|
-
|
|
33286
|
-
|
|
33462
|
+
pointerEvents: "box-none",
|
|
33463
|
+
style: [styles18.thumb, { top: thumbTopRef.current }],
|
|
33464
|
+
children: /* @__PURE__ */ jsxs18(
|
|
33465
|
+
View18,
|
|
33466
|
+
{
|
|
33467
|
+
style: [
|
|
33468
|
+
styles18.pill,
|
|
33469
|
+
isDark && styles18.pillDark,
|
|
33470
|
+
{ borderColor: `${accentColor}33` }
|
|
33471
|
+
],
|
|
33472
|
+
...responderPanHandlers,
|
|
33473
|
+
testID: "papyrus-progress-pill",
|
|
33474
|
+
children: [
|
|
33475
|
+
/* @__PURE__ */ jsx22(View18, { style: styles18.labelHit, children: /* @__PURE__ */ jsx22(Text13, { style: [styles18.label, isDark && styles18.labelDark], children: label }) }),
|
|
33476
|
+
/* @__PURE__ */ jsx22(View18, { style: styles18.iconHit, children: /* @__PURE__ */ jsx22(
|
|
33477
|
+
IconPageNav,
|
|
33478
|
+
{
|
|
33479
|
+
size: 20,
|
|
33480
|
+
color: isDark ? "#f8fafc" : "#111827",
|
|
33481
|
+
strokeWidth: 1.8
|
|
33482
|
+
}
|
|
33483
|
+
) })
|
|
33484
|
+
]
|
|
33485
|
+
}
|
|
33486
|
+
)
|
|
33287
33487
|
}
|
|
33288
|
-
)
|
|
33488
|
+
)
|
|
33289
33489
|
]
|
|
33290
33490
|
}
|
|
33291
33491
|
)
|