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

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 CHANGED
@@ -25732,13 +25732,16 @@ var shouldUseNativePdfViewer = ({
25732
25732
  nativePdfDocumentViewAvailable = false,
25733
25733
  pageTheme = "normal",
25734
25734
  viewMode = "continuous",
25735
- rotation = 0
25735
+ rotation = 0,
25736
+ activeTool = "select",
25737
+ nativeInkOverlayAvailable = true
25736
25738
  }) => {
25737
25739
  if (viewerMode !== "native" || pageCount <= 0 || isWebView || !nativeEngineId) {
25738
25740
  return false;
25739
25741
  }
25740
25742
  const implementation = resolveNativePdfViewerImplementation(platform);
25741
25743
  if (implementation === "android") return true;
25744
+ if (activeTool === "ink" && !nativeInkOverlayAvailable) return false;
25742
25745
  return implementation === "ios" && nativePdfDocumentViewAvailable && pageTheme === "normal" && viewMode !== "double" && rotation === 0;
25743
25746
  };
25744
25747
 
@@ -26088,7 +26091,6 @@ var styles3 = import_react_native3.StyleSheet.create({
26088
26091
  // components/DedicatedIosPdfViewer.tsx
26089
26092
  var import_react5 = require("react");
26090
26093
  var import_react_native4 = require("react-native");
26091
- var import_clipboard5 = __toESM(require("@react-native-clipboard/clipboard"));
26092
26094
  var import_core4 = require("@papyrus-sdk/core");
26093
26095
  var import_engine_native3 = require("@papyrus-sdk/engine-native");
26094
26096
 
@@ -26156,7 +26158,14 @@ var STRINGS = {
26156
26158
  more: "More",
26157
26159
  close: "Close",
26158
26160
  copy: "Copy",
26159
- define: "Define"
26161
+ define: "Define",
26162
+ annotate: "Annotate",
26163
+ annotationHighlight: "Highlight",
26164
+ annotationUnderline: "Underline",
26165
+ annotationStrikeout: "Strikeout",
26166
+ annotationSquiggly: "Squiggly",
26167
+ annotationNote: "Note",
26168
+ deleteAnnotation: "Delete"
26160
26169
  },
26161
26170
  "pt-BR": {
26162
26171
  pages: "Paginas",
@@ -26220,11 +26229,37 @@ var STRINGS = {
26220
26229
  more: "Mais",
26221
26230
  close: "Fechar",
26222
26231
  copy: "Copiar",
26223
- define: "Definir"
26232
+ define: "Definir",
26233
+ annotate: "Anotar",
26234
+ annotationHighlight: "Destacar",
26235
+ annotationUnderline: "Sublinhar",
26236
+ annotationStrikeout: "Riscar",
26237
+ annotationSquiggly: "Ondulado",
26238
+ annotationNote: "Nota",
26239
+ deleteAnnotation: "Apagar"
26224
26240
  }
26225
26241
  };
26226
26242
  var getStrings = (locale) => STRINGS[locale ?? "en"] ?? STRINGS.en;
26227
26243
 
26244
+ // components/annotationDeletion.ts
26245
+ var MARKUP_ANNOTATION_TYPES = /* @__PURE__ */ new Set([
26246
+ "highlight",
26247
+ "underline",
26248
+ "strikeout",
26249
+ "squiggly"
26250
+ ]);
26251
+ function resolveMarkupAnnotationDeleteFallback(annotations, selectedAnnotationId, hasNativeEditMenu) {
26252
+ if (!selectedAnnotationId || hasNativeEditMenu) return null;
26253
+ const selected = annotations.find(
26254
+ (annotation) => annotation.id === selectedAnnotationId
26255
+ );
26256
+ return selected && MARKUP_ANNOTATION_TYPES.has(selected.type) ? selected : null;
26257
+ }
26258
+ function deleteAnnotationAndClearSelection(annotationId, removeAnnotation, setSelectedAnnotation) {
26259
+ removeAnnotation(annotationId);
26260
+ setSelectedAnnotation(null);
26261
+ }
26262
+
26228
26263
  // components/nativePdfViewerEvents.ts
26229
26264
  var resolveNativePdfTextSelection = (selection) => {
26230
26265
  if (typeof selection?.text !== "string" || !selection.text.trim() || !Number.isInteger(selection.pageIndex) || (selection.pageIndex ?? -1) < 0) {
@@ -26281,6 +26316,7 @@ var MOBILE_CHROME_SHOW_DELTA2 = 22;
26281
26316
  var MOBILE_CHROME_SHOW_DELAY_MS2 = 180;
26282
26317
  var MOBILE_CHROME_TOP_RESET2 = 16;
26283
26318
  var MIN_VISIBLE_PAGE_RATIO = 0.03;
26319
+ var supportsNativeEditMenu = Number.parseInt(String(import_react_native4.Platform.Version), 10) >= 16;
26284
26320
  function DedicatedIosPdfViewer({
26285
26321
  engine,
26286
26322
  maxPageWidth,
@@ -26293,15 +26329,41 @@ function DedicatedIosPdfViewer({
26293
26329
  const pageTheme = (0, import_core4.useViewerStore)((state) => state.pageTheme);
26294
26330
  const zoom = (0, import_core4.useViewerStore)((state) => state.zoom);
26295
26331
  const currentPage = (0, import_core4.useViewerStore)((state) => state.currentPage);
26332
+ const searchResults = (0, import_core4.useViewerStore)((state) => state.searchResults);
26333
+ const activeSearchIndex = (0, import_core4.useViewerStore)((state) => state.activeSearchIndex);
26296
26334
  const viewMode = (0, import_core4.useViewerStore)((state) => state.viewMode);
26297
26335
  const selectionActive = (0, import_core4.useViewerStore)((state) => state.selectionActive);
26298
26336
  const activeTool = (0, import_core4.useViewerStore)((state) => state.activeTool);
26337
+ const activeDrawToolPreset = (0, import_core4.useViewerStore)(
26338
+ (state) => state.activeDrawToolPreset
26339
+ );
26340
+ const inkStrokeWidth = (0, import_core4.useViewerStore)((state) => state.inkStrokeWidth);
26341
+ const annotations = (0, import_core4.useViewerStore)((state) => state.annotations);
26342
+ const annotationColor = (0, import_core4.useViewerStore)((state) => state.annotationColor);
26343
+ const annotationSelectionColor = (0, import_core4.useViewerStore)((state) => state.accentColor);
26344
+ const annotationOpacity = (0, import_core4.useViewerStore)((state) => state.annotationOpacity);
26345
+ const selectedAnnotationId = (0, import_core4.useViewerStore)(
26346
+ (state) => state.selectedAnnotationId
26347
+ );
26348
+ const addAnnotation = (0, import_core4.useViewerStore)((state) => state.addAnnotation);
26349
+ const removeAnnotation = (0, import_core4.useViewerStore)((state) => state.removeAnnotation);
26350
+ const setSelectedAnnotation = (0, import_core4.useViewerStore)(
26351
+ (state) => state.setSelectedAnnotation
26352
+ );
26299
26353
  const mobileChromeVisible = (0, import_core4.useViewerStore)(
26300
26354
  (state) => state.mobileChromeVisible
26301
26355
  );
26302
26356
  const setDocumentState = (0, import_core4.useViewerStore)((state) => state.setDocumentState);
26357
+ const commitInkStrokesForPage = (0, import_core4.useViewerStore)(
26358
+ (state) => state.commitInkStrokesForPage
26359
+ );
26303
26360
  const engineId = getDedicatedAndroidPdfEngineId(engine);
26304
26361
  const nativeViewMode = viewMode === "single" ? "single" : "continuous";
26362
+ const fallbackDeleteAnnotation = resolveMarkupAnnotationDeleteFallback(
26363
+ annotations,
26364
+ selectedAnnotationId,
26365
+ supportsNativeEditMenu
26366
+ );
26305
26367
  const resolvedMaxPageWidth = typeof maxPageWidth === "number" && Number.isFinite(maxPageWidth) && maxPageWidth > 0 ? maxPageWidth : void 0;
26306
26368
  const chromeVisibleRef = (0, import_react5.useRef)(mobileChromeVisible);
26307
26369
  const lastScrollOffsetYRef = (0, import_react5.useRef)(0);
@@ -26312,6 +26374,15 @@ function DedicatedIosPdfViewer({
26312
26374
  const lastVisiblePagesKeyRef = (0, import_react5.useRef)("");
26313
26375
  const [selection, setSelection] = (0, import_react5.useState)(null);
26314
26376
  const selectionRef = (0, import_react5.useRef)(null);
26377
+ (0, import_react5.useEffect)(() => {
26378
+ const pickerActive = supportsNativeEditMenu && activeTool === "ink";
26379
+ setDocumentState({ nativeInkToolPickerActive: pickerActive });
26380
+ return () => {
26381
+ if (pickerActive) {
26382
+ setDocumentState({ nativeInkToolPickerActive: false });
26383
+ }
26384
+ };
26385
+ }, [activeTool, setDocumentState]);
26315
26386
  (0, import_react5.useEffect)(() => {
26316
26387
  chromeVisibleRef.current = mobileChromeVisible;
26317
26388
  }, [mobileChromeVisible]);
@@ -26342,16 +26413,12 @@ function DedicatedIosPdfViewer({
26342
26413
  if (nextSelection) {
26343
26414
  const { text, pageIndex } = nextSelection;
26344
26415
  onTextSelected?.({ text, pageIndex });
26416
+ } else {
26417
+ setSelectedAnnotation(null);
26345
26418
  }
26346
26419
  },
26347
- [onTextSelected, updateSelection]
26420
+ [onTextSelected, setSelectedAnnotation, updateSelection]
26348
26421
  );
26349
- const copySelection = (0, import_react5.useCallback)(async () => {
26350
- const selection2 = selectionRef.current;
26351
- if (!selection2) return;
26352
- const copied = await copySelectionText(selection2.text, import_clipboard5.default);
26353
- if (copied) updateSelection(null);
26354
- }, [updateSelection]);
26355
26422
  const defineSelection = (0, import_react5.useCallback)(() => {
26356
26423
  const currentSelection = selectionRef.current;
26357
26424
  if (!currentSelection) return;
@@ -26361,6 +26428,18 @@ function DedicatedIosPdfViewer({
26361
26428
  });
26362
26429
  updateSelection(null);
26363
26430
  }, [onDefineSelection, updateSelection]);
26431
+ const handleNativeDefineSelection = (0, import_react5.useCallback)(
26432
+ (event) => {
26433
+ const text = event.nativeEvent?.text;
26434
+ const pageIndex = event.nativeEvent?.pageIndex;
26435
+ if (typeof text !== "string" || text.length === 0 || typeof pageIndex !== "number" || !Number.isInteger(pageIndex) || pageIndex < 0) {
26436
+ return;
26437
+ }
26438
+ onDefineSelection?.({ text, pageIndex });
26439
+ updateSelection(null);
26440
+ },
26441
+ [onDefineSelection, updateSelection]
26442
+ );
26364
26443
  const trackMobileChromeByOffset = (0, import_react5.useCallback)(
26365
26444
  (offsetY) => {
26366
26445
  if (pageCount <= 0) return;
@@ -26423,6 +26502,7 @@ function DedicatedIosPdfViewer({
26423
26502
  [trackMobileChromeByOffset]
26424
26503
  );
26425
26504
  const handleTap = (0, import_react5.useCallback)(() => {
26505
+ setSelectedAnnotation(null);
26426
26506
  const nextVisible = resolvePageTapChromeVisibility({
26427
26507
  chromeVisible: chromeVisibleRef.current,
26428
26508
  selectionActive: selectionActive || selectionRef.current !== null,
@@ -26430,7 +26510,17 @@ function DedicatedIosPdfViewer({
26430
26510
  toolActive: activeTool !== "select"
26431
26511
  });
26432
26512
  if (nextVisible !== null) setMobileChromeVisible(nextVisible);
26433
- }, [activeTool, selectionActive, setMobileChromeVisible]);
26513
+ }, [activeTool, selectionActive, setMobileChromeVisible, setSelectedAnnotation]);
26514
+ const handleDeleteAnnotation = (0, import_react5.useCallback)(
26515
+ (annotationId) => {
26516
+ deleteAnnotationAndClearSelection(
26517
+ annotationId,
26518
+ removeAnnotation,
26519
+ setSelectedAnnotation
26520
+ );
26521
+ },
26522
+ [removeAnnotation, setSelectedAnnotation]
26523
+ );
26434
26524
  const cappedViewerStyle = resolvedMaxPageWidth ? {
26435
26525
  width: "100%",
26436
26526
  maxWidth: resolvedMaxPageWidth,
@@ -26445,6 +26535,16 @@ function DedicatedIosPdfViewer({
26445
26535
  pageTheme,
26446
26536
  zoom,
26447
26537
  currentPage,
26538
+ searchResults,
26539
+ activeSearchIndex,
26540
+ annotations,
26541
+ activeTool,
26542
+ activeDrawToolPreset,
26543
+ inkStrokeWidth,
26544
+ annotationColor,
26545
+ annotationSelectionColor,
26546
+ annotationOpacity,
26547
+ selectedAnnotationId,
26448
26548
  viewMode: nativeViewMode,
26449
26549
  selectionActive: selection !== null,
26450
26550
  onPageChange: (event) => {
@@ -26467,40 +26567,64 @@ function DedicatedIosPdfViewer({
26467
26567
  onVisiblePagesChange: handleVisiblePagesChange,
26468
26568
  onScroll: handleScroll,
26469
26569
  onTap: handleTap,
26470
- onTextSelected: handleTextSelectionChange
26570
+ onTextSelected: handleTextSelectionChange,
26571
+ defineLabel: t.define,
26572
+ annotateLabel: t.annotate,
26573
+ annotationHighlightLabel: t.annotationHighlight,
26574
+ annotationUnderlineLabel: t.annotationUnderline,
26575
+ annotationStrikeoutLabel: t.annotationStrikeout,
26576
+ annotationSquigglyLabel: t.annotationSquiggly,
26577
+ annotationNoteLabel: t.annotationNote,
26578
+ annotationDeleteLabel: t.deleteAnnotation,
26579
+ onDefineSelection: onDefineSelection ? handleNativeDefineSelection : void 0,
26580
+ onAnnotationCreated: (event) => addAnnotation(event.nativeEvent),
26581
+ onAnnotationTap: (event) => setSelectedAnnotation(event.nativeEvent.id),
26582
+ onAnnotationDelete: (event) => handleDeleteAnnotation(event.nativeEvent.id),
26583
+ onAnnotationDeselected: () => setSelectedAnnotation(null),
26584
+ onInkDrawingCommitted: (event) => {
26585
+ const pageIndex = event.nativeEvent?.pageIndex;
26586
+ const strokes = event.nativeEvent?.strokes;
26587
+ if (typeof pageIndex !== "number" || !Number.isInteger(pageIndex) || pageIndex < 0 || !Array.isArray(strokes)) {
26588
+ return;
26589
+ }
26590
+ commitInkStrokesForPage(pageIndex, strokes);
26591
+ }
26471
26592
  }
26472
26593
  ),
26473
- selection && /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(import_react_native4.View, { style: styles4.selectionToolbar, pointerEvents: "box-none", children: /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(import_react_native4.View, { style: styles4.toolbarContent, children: [
26474
- /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(
26475
- import_react_native4.Pressable,
26476
- {
26477
- onPress: () => void copySelection(),
26478
- style: styles4.toolbarButton,
26479
- accessibilityRole: "button",
26480
- accessibilityLabel: t.copy,
26481
- children: [
26482
- /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(IconCopy, { size: 18, color: "#fff", strokeWidth: 2 }),
26483
- /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(import_react_native4.Text, { style: styles4.toolbarButtonText, children: t.copy })
26484
- ]
26485
- }
26486
- ),
26487
- onDefineSelection && /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
26488
- import_react_native4.Pressable,
26489
- {
26490
- onPress: defineSelection,
26491
- style: styles4.toolbarButton,
26492
- accessibilityRole: "button",
26493
- accessibilityLabel: t.define,
26494
- children: /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(import_react_native4.Text, { style: styles4.toolbarButtonText, children: t.define })
26495
- }
26496
- )
26497
- ] }) })
26594
+ selection && !supportsNativeEditMenu && onDefineSelection && /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(import_react_native4.View, { style: styles4.selectionFallback, pointerEvents: "box-none", children: /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
26595
+ import_react_native4.Pressable,
26596
+ {
26597
+ onPress: defineSelection,
26598
+ style: styles4.fallbackButton,
26599
+ accessibilityRole: "button",
26600
+ accessibilityLabel: t.define,
26601
+ children: /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(import_react_native4.Text, { style: styles4.fallbackButtonText, children: t.define })
26602
+ }
26603
+ ) }),
26604
+ fallbackDeleteAnnotation && /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
26605
+ import_react_native4.View,
26606
+ {
26607
+ style: styles4.annotationDeleteFallback,
26608
+ pointerEvents: "box-none",
26609
+ children: /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
26610
+ import_react_native4.Pressable,
26611
+ {
26612
+ onPress: () => handleDeleteAnnotation(fallbackDeleteAnnotation.id),
26613
+ style: styles4.annotationDeleteButton,
26614
+ accessibilityRole: "button",
26615
+ accessibilityLabel: t.deleteAnnotation,
26616
+ hitSlop: 8,
26617
+ children: /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(import_react_native4.Text, { style: styles4.annotationDeleteButtonText, children: t.deleteAnnotation })
26618
+ }
26619
+ )
26620
+ }
26621
+ )
26498
26622
  ] });
26499
26623
  }
26500
26624
  var styles4 = import_react_native4.StyleSheet.create({
26501
26625
  container: { flex: 1, alignItems: "stretch" },
26502
26626
  viewer: { flex: 1, width: "100%" },
26503
- selectionToolbar: {
26627
+ selectionFallback: {
26504
26628
  position: "absolute",
26505
26629
  left: 0,
26506
26630
  right: 0,
@@ -26509,31 +26633,43 @@ var styles4 = import_react_native4.StyleSheet.create({
26509
26633
  justifyContent: "center",
26510
26634
  zIndex: 50
26511
26635
  },
26512
- toolbarContent: {
26513
- flexDirection: "row",
26636
+ fallbackButton: {
26514
26637
  backgroundColor: "rgba(30, 30, 30, 0.92)",
26515
26638
  borderRadius: 16,
26516
26639
  paddingHorizontal: 8,
26517
26640
  paddingVertical: 8,
26518
- gap: 4,
26519
26641
  shadowColor: "#000",
26520
26642
  shadowOffset: { width: 0, height: 4 },
26521
26643
  shadowOpacity: 0.3,
26522
26644
  shadowRadius: 12,
26523
26645
  elevation: 10
26524
26646
  },
26525
- toolbarButton: {
26526
- minWidth: 76,
26527
- height: 40,
26528
- borderRadius: 10,
26529
- backgroundColor: "rgba(255,255,255,0.1)",
26530
- flexDirection: "row",
26531
- alignItems: "center",
26647
+ fallbackButtonText: {
26648
+ color: "#fff",
26649
+ fontSize: 12,
26650
+ fontWeight: "700"
26651
+ },
26652
+ annotationDeleteFallback: {
26653
+ position: "absolute",
26654
+ left: 0,
26655
+ right: 16,
26656
+ bottom: 120,
26657
+ alignItems: "flex-end",
26532
26658
  justifyContent: "center",
26533
- gap: 6,
26534
- paddingHorizontal: 10
26659
+ zIndex: 51
26535
26660
  },
26536
- toolbarButtonText: {
26661
+ annotationDeleteButton: {
26662
+ backgroundColor: "#b91c1c",
26663
+ borderRadius: 16,
26664
+ paddingHorizontal: 12,
26665
+ paddingVertical: 8,
26666
+ shadowColor: "#000",
26667
+ shadowOffset: { width: 0, height: 4 },
26668
+ shadowOpacity: 0.3,
26669
+ shadowRadius: 12,
26670
+ elevation: 10
26671
+ },
26672
+ annotationDeleteButtonText: {
26537
26673
  color: "#fff",
26538
26674
  fontSize: 12,
26539
26675
  fontWeight: "700"
@@ -26727,7 +26863,7 @@ var shouldEnableViewerScrollForPageScrub = ({
26727
26863
  isScrubbing
26728
26864
  }) => viewerScrollEnabled && !isScrubbing;
26729
26865
  var resolvePageScrubberTouchPolicy = () => ({
26730
- responderTarget: "track",
26866
+ responderTarget: "pill",
26731
26867
  claimOnStart: true,
26732
26868
  captureOnStart: true,
26733
26869
  captureOnMove: true,
@@ -26737,11 +26873,18 @@ var resolvePageScrubberOverlayStyle = () => ({
26737
26873
  zIndex: 30,
26738
26874
  elevation: 30
26739
26875
  });
26740
- var resolvePageScrubberPointerEvents = () => "box-only";
26876
+ var resolvePageScrubberPointerEvents = () => "box-none";
26741
26877
  var resolvePageScrubberReleaseAction = ({
26742
26878
  hasMoved,
26743
- pendingPage
26744
- }) => hasMoved && pendingPage !== null ? { kind: "navigate", page: pendingPage } : { kind: "open" };
26879
+ pendingPage,
26880
+ longPressTriggered = false
26881
+ }) => {
26882
+ if (longPressTriggered) return { kind: "none" };
26883
+ if (hasMoved && pendingPage !== null) {
26884
+ return { kind: "navigate", page: pendingPage };
26885
+ }
26886
+ return { kind: "open" };
26887
+ };
26745
26888
  var createPageScrubberNavigationController = (onRelease) => {
26746
26889
  let active = false;
26747
26890
  let pendingPage = null;
@@ -26950,6 +27093,7 @@ var Viewer = ({
26950
27093
  );
26951
27094
  const nativeEngineId = getDedicatedAndroidPdfEngineId(engine);
26952
27095
  const nativePdfDocumentViewAvailable = import_react_native6.Platform.OS === "ios" && (0, import_engine_native4.isPapyrusPdfDocumentViewAvailable)();
27096
+ const nativeInkOverlayAvailable = import_react_native6.Platform.OS !== "ios" || Number.parseInt(String(import_react_native6.Platform.Version), 10) >= 16;
26953
27097
  const isNativePdfViewer = shouldUseNativePdfViewer({
26954
27098
  platform: import_react_native6.Platform.OS,
26955
27099
  viewerMode: resolvedViewerMode,
@@ -26959,7 +27103,9 @@ var Viewer = ({
26959
27103
  nativePdfDocumentViewAvailable,
26960
27104
  pageTheme,
26961
27105
  viewMode,
26962
- rotation
27106
+ rotation,
27107
+ activeTool,
27108
+ nativeInkOverlayAvailable
26963
27109
  });
26964
27110
  (0, import_react6.useEffect)(() => {
26965
27111
  mobilePerf.emit(
@@ -26979,6 +27125,9 @@ var Viewer = ({
26979
27125
  const reason = (() => {
26980
27126
  if (!nativePdfDocumentViewAvailable) return "manager-unavailable";
26981
27127
  if (!nativeEngineId) return "engine-unavailable";
27128
+ if (activeTool === "ink" && !nativeInkOverlayAvailable) {
27129
+ return "unsupported-ink-overlay";
27130
+ }
26982
27131
  if (pageTheme !== "normal") return "unsupported-page-theme";
26983
27132
  if (viewMode === "double") return "unsupported-view-mode";
26984
27133
  if (rotation !== 0) return "unsupported-rotation";
@@ -26989,6 +27138,7 @@ var Viewer = ({
26989
27138
  const detailByReason = {
26990
27139
  "manager-unavailable": "the PapyrusPdfDocumentView manager is not registered",
26991
27140
  "engine-unavailable": "the native PDF engine id is unavailable",
27141
+ "unsupported-ink-overlay": "PencilKit page overlays require iOS 16 or newer",
26992
27142
  "unsupported-page-theme": `pageTheme '${pageTheme}' is not supported by the native viewport`,
26993
27143
  "unsupported-view-mode": "double-page mode is not supported by the native viewport",
26994
27144
  "unsupported-rotation": "document rotation is not supported by the native viewport"
@@ -26998,8 +27148,10 @@ var Viewer = ({
26998
27148
  );
26999
27149
  }, [
27000
27150
  isWebView,
27151
+ activeTool,
27001
27152
  nativeEngineId,
27002
27153
  nativePdfDocumentViewAvailable,
27154
+ nativeInkOverlayAvailable,
27003
27155
  pageCount,
27004
27156
  pageTheme,
27005
27157
  rotation,
@@ -29630,6 +29782,9 @@ var import_core7 = require("@papyrus-sdk/core");
29630
29782
  // components/ToolDock.layout.ts
29631
29783
  var TOOL_DOCK_SCROLL_THRESHOLD = 420;
29632
29784
  var shouldUseScrollablePrimaryToolsRow = (windowWidth) => windowWidth < TOOL_DOCK_SCROLL_THRESHOLD;
29785
+ var shouldShowToolDockInkControls = ({
29786
+ nativeInkToolPickerActive
29787
+ }) => !nativeInkToolPickerActive;
29633
29788
  var DRAWING_TOOL_IDS = /* @__PURE__ */ new Set(["ink", "highlight", "underline"]);
29634
29789
  var resolveToolDockBaseIconColor = ({
29635
29790
  label,
@@ -29833,6 +29988,7 @@ var ToolDock = () => {
29833
29988
  toolDockOpen,
29834
29989
  setDocumentState,
29835
29990
  activeDrawToolPreset,
29991
+ nativeInkToolPickerActive,
29836
29992
  annotationUndoStack,
29837
29993
  annotationRedoStack,
29838
29994
  undoAnnotations,
@@ -29860,9 +30016,17 @@ var ToolDock = () => {
29860
30016
  [activeTool, activeDrawToolPreset, interactionMode]
29861
30017
  );
29862
30018
  const inkSettingsExpanded = activeTool === "ink" && activeDrawToolPreset === "ink";
30019
+ const showInkDockControls = shouldShowToolDockInkControls({
30020
+ nativeInkToolPickerActive
30021
+ });
29863
30022
  const canUndo = annotationUndoStack.length > 0;
29864
30023
  const canRedo = annotationRedoStack.length > 0;
29865
30024
  const primaryToolsRowIsScrollable = shouldUseScrollablePrimaryToolsRow(windowWidth);
30025
+ (0, import_react11.useEffect)(() => {
30026
+ if (!nativeInkToolPickerActive) return;
30027
+ setPaletteExpanded(false);
30028
+ setExtrasExpanded(false);
30029
+ }, [nativeInkToolPickerActive]);
29866
30030
  const applyTool = (toolId) => {
29867
30031
  if (toolId === "ink") {
29868
30032
  setDocumentState({
@@ -29967,7 +30131,7 @@ var ToolDock = () => {
29967
30131
  pointerEvents: "box-none",
29968
30132
  style: [styles9.root, { paddingBottom: chromeOffsets.toolDock }],
29969
30133
  children: toolDockOpen ? /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)(import_react_native10.View, { style: styles9.stack, children: [
29970
- paletteExpanded ? /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
30134
+ paletteExpanded && showInkDockControls ? /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
29971
30135
  import_react_native10.View,
29972
30136
  {
29973
30137
  style: [
@@ -30008,7 +30172,7 @@ var ToolDock = () => {
30008
30172
  }) })
30009
30173
  }
30010
30174
  ) : null,
30011
- inkSettingsExpanded ? /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)(
30175
+ inkSettingsExpanded && showInkDockControls ? /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)(
30012
30176
  import_react_native10.View,
30013
30177
  {
30014
30178
  style: [
@@ -31577,6 +31741,7 @@ var AnnotationEditor = () => {
31577
31741
  annotations,
31578
31742
  selectedAnnotationId,
31579
31743
  updateAnnotation,
31744
+ removeAnnotation,
31580
31745
  setSelectedAnnotation,
31581
31746
  uiTheme,
31582
31747
  locale,
@@ -31598,6 +31763,13 @@ var AnnotationEditor = () => {
31598
31763
  updateAnnotation(annotation.id, { content: draft });
31599
31764
  setSelectedAnnotation(null);
31600
31765
  };
31766
+ const handleDelete = () => {
31767
+ deleteAnnotationAndClearSelection(
31768
+ annotation.id,
31769
+ removeAnnotation,
31770
+ setSelectedAnnotation
31771
+ );
31772
+ };
31601
31773
  return /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
31602
31774
  import_react_native12.Modal,
31603
31775
  {
@@ -31619,6 +31791,22 @@ var AnnotationEditor = () => {
31619
31791
  }
31620
31792
  ),
31621
31793
  /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)(import_react_native12.View, { style: styles11.actions, children: [
31794
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
31795
+ import_react_native12.Pressable,
31796
+ {
31797
+ onPress: handleDelete,
31798
+ style: [
31799
+ styles11.actionButton,
31800
+ styles11.actionDelete,
31801
+ isDark && styles11.actionDeleteDark
31802
+ ],
31803
+ accessibilityRole: "button",
31804
+ accessibilityLabel: t.deleteAnnotation,
31805
+ testID: "annotation-delete-button",
31806
+ children: /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(import_react_native12.Text, { style: [styles11.actionText, styles11.actionTextLight], children: t.deleteAnnotation })
31807
+ }
31808
+ ),
31809
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(import_react_native12.View, { style: styles11.actionSpacer }),
31622
31810
  /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
31623
31811
  import_react_native12.Pressable,
31624
31812
  {
@@ -31688,8 +31876,9 @@ var styles11 = import_react_native12.StyleSheet.create({
31688
31876
  actions: {
31689
31877
  marginTop: 16,
31690
31878
  flexDirection: "row",
31691
- justifyContent: "flex-end"
31879
+ alignItems: "center"
31692
31880
  },
31881
+ actionSpacer: { flex: 1 },
31693
31882
  actionButton: {
31694
31883
  paddingHorizontal: 12,
31695
31884
  paddingVertical: 8,
@@ -31699,6 +31888,12 @@ var styles11 = import_react_native12.StyleSheet.create({
31699
31888
  actionCancel: {
31700
31889
  backgroundColor: "#e5e7eb"
31701
31890
  },
31891
+ actionDelete: {
31892
+ backgroundColor: "#b91c1c"
31893
+ },
31894
+ actionDeleteDark: {
31895
+ backgroundColor: "#991b1b"
31896
+ },
31702
31897
  actionSave: {
31703
31898
  backgroundColor: "#2563eb"
31704
31899
  },
@@ -33324,7 +33519,8 @@ function ProgressPill({
33324
33519
  const releasedPage = scrubNavigationControllerRef.current.release();
33325
33520
  const releaseAction = resolvePageScrubberReleaseAction({
33326
33521
  hasMoved: hasMovedRef.current,
33327
- pendingPage: releasedPage
33522
+ pendingPage: releasedPage,
33523
+ longPressTriggered: longPressTriggeredRef.current
33328
33524
  });
33329
33525
  if (releaseAction.kind === "navigate") {
33330
33526
  pendingReleasedScrubPageRef.current = releaseAction.page;
@@ -33362,9 +33558,6 @@ function ProgressPill({
33362
33558
  });
33363
33559
  }
33364
33560
  const responderPanHandlers = scrubberResponderRef.current?.panHandlers ?? {};
33365
- const responderTarget = touchPolicy.responderTarget;
33366
- const scrubberPanHandlers = responderTarget === "track" ? responderPanHandlers : {};
33367
- const pillPanHandlers = responderTarget === "pill" ? responderPanHandlers : {};
33368
33561
  return /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
33369
33562
  import_react_native19.View,
33370
33563
  {
@@ -33383,7 +33576,6 @@ function ProgressPill({
33383
33576
  ref: scrubberRef,
33384
33577
  pointerEvents: resolvePageScrubberPointerEvents(),
33385
33578
  style: [styles18.scrubber, { height: trackHeight }],
33386
- ...scrubberPanHandlers,
33387
33579
  onLayout: () => {
33388
33580
  scrubberRef.current?.measureInWindow((_x, y) => {
33389
33581
  trackYRef.current = y;
@@ -33393,6 +33585,7 @@ function ProgressPill({
33393
33585
  /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
33394
33586
  import_react_native19.Animated.View,
33395
33587
  {
33588
+ pointerEvents: "none",
33396
33589
  style: [
33397
33590
  styles18.track,
33398
33591
  isDark && styles18.trackDark,
@@ -33405,29 +33598,36 @@ function ProgressPill({
33405
33598
  ]
33406
33599
  }
33407
33600
  ),
33408
- /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(import_react_native19.Animated.View, { style: [styles18.thumb, { top: thumbTopRef.current }], children: /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)(
33409
- import_react_native19.View,
33601
+ /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
33602
+ import_react_native19.Animated.View,
33410
33603
  {
33411
- style: [
33412
- styles18.pill,
33413
- isDark && styles18.pillDark,
33414
- { borderColor: `${accentColor}33` }
33415
- ],
33416
- ...pillPanHandlers,
33417
- testID: "papyrus-progress-pill",
33418
- children: [
33419
- /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(import_react_native19.View, { style: styles18.labelHit, children: /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(import_react_native19.Text, { style: [styles18.label, isDark && styles18.labelDark], children: label }) }),
33420
- /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(import_react_native19.View, { style: styles18.iconHit, children: /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
33421
- IconPageNav,
33422
- {
33423
- size: 20,
33424
- color: isDark ? "#f8fafc" : "#111827",
33425
- strokeWidth: 1.8
33426
- }
33427
- ) })
33428
- ]
33604
+ pointerEvents: "box-none",
33605
+ style: [styles18.thumb, { top: thumbTopRef.current }],
33606
+ children: /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)(
33607
+ import_react_native19.View,
33608
+ {
33609
+ style: [
33610
+ styles18.pill,
33611
+ isDark && styles18.pillDark,
33612
+ { borderColor: `${accentColor}33` }
33613
+ ],
33614
+ ...responderPanHandlers,
33615
+ testID: "papyrus-progress-pill",
33616
+ children: [
33617
+ /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(import_react_native19.View, { style: styles18.labelHit, children: /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(import_react_native19.Text, { style: [styles18.label, isDark && styles18.labelDark], children: label }) }),
33618
+ /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(import_react_native19.View, { style: styles18.iconHit, children: /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
33619
+ IconPageNav,
33620
+ {
33621
+ size: 20,
33622
+ color: isDark ? "#f8fafc" : "#111827",
33623
+ strokeWidth: 1.8
33624
+ }
33625
+ ) })
33626
+ ]
33627
+ }
33628
+ )
33429
33629
  }
33430
- ) })
33630
+ )
33431
33631
  ]
33432
33632
  }
33433
33633
  )