@tobyt/expo-pdf-markup 1.1.3 → 1.2.0

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.
Files changed (73) hide show
  1. package/CHANGELOG.md +14 -0
  2. package/android/src/main/java/dev/terhoeven/expopdfmarkup/AnnotationSerializer.kt +7 -1
  3. package/android/src/main/java/dev/terhoeven/expopdfmarkup/BookPager.kt +66 -0
  4. package/android/src/main/java/dev/terhoeven/expopdfmarkup/BookTurnPolicy.kt +117 -0
  5. package/android/src/main/java/dev/terhoeven/expopdfmarkup/ContinuousPdfView.kt +370 -57
  6. package/android/src/main/java/dev/terhoeven/expopdfmarkup/ExpoPdfMarkupModule.kt +4 -0
  7. package/android/src/main/java/dev/terhoeven/expopdfmarkup/ExpoPdfMarkupView.kt +96 -5
  8. package/build/ExpoPdfMarkup.types.d.ts +12 -0
  9. package/build/ExpoPdfMarkup.types.d.ts.map +1 -1
  10. package/build/ExpoPdfMarkup.types.js.map +1 -1
  11. package/build/ExpoPdfMarkupView.web.d.ts.map +1 -1
  12. package/build/ExpoPdfMarkupView.web.js +369 -44
  13. package/build/ExpoPdfMarkupView.web.js.map +1 -1
  14. package/build/web/bookMode.d.ts +77 -0
  15. package/build/web/bookMode.d.ts.map +1 -0
  16. package/build/web/bookMode.js +169 -0
  17. package/build/web/bookMode.js.map +1 -0
  18. package/build/web/layout.d.ts +8 -0
  19. package/build/web/layout.d.ts.map +1 -0
  20. package/build/web/layout.js +22 -0
  21. package/build/web/layout.js.map +1 -0
  22. package/build/web/types.d.ts +2 -0
  23. package/build/web/types.d.ts.map +1 -1
  24. package/build/web/types.js.map +1 -1
  25. package/docs/agents/domain.md +51 -0
  26. package/docs/agents/issue-tracker.md +46 -0
  27. package/docs/agents/triage-labels.md +15 -0
  28. package/ios/AnnotationSerializer.swift +36 -7
  29. package/ios/ExpoPdfMarkupModule.swift +4 -0
  30. package/ios/ExpoPdfMarkupView+Book.swift +455 -0
  31. package/ios/ExpoPdfMarkupView+Ink.swift +10 -2
  32. package/ios/ExpoPdfMarkupView+Move.swift +3 -4
  33. package/ios/ExpoPdfMarkupView.swift +49 -6
  34. package/ios/Tests/AnnotationSerializerTests.swift +0 -22
  35. package/ios/Tests/BookModeTests.swift +534 -0
  36. package/ios/Tests/book-sample.pdf +207 -0
  37. package/ios/Tests/single-page.pdf +52 -0
  38. package/metro.js +32 -14
  39. package/package.json +4 -3
  40. package/src/ExpoPdfMarkup.types.ts +13 -0
  41. package/src/ExpoPdfMarkupView.web.tsx +443 -52
  42. package/src/web/bookMode.ts +186 -0
  43. package/src/web/layout.ts +30 -0
  44. package/src/web/types.ts +3 -0
  45. package/tsconfig.test.json +10 -0
  46. package/docs/.nojekyll +0 -1
  47. package/docs/assets/hierarchy.js +0 -1
  48. package/docs/assets/highlight.css +0 -113
  49. package/docs/assets/icons.js +0 -18
  50. package/docs/assets/icons.svg +0 -1
  51. package/docs/assets/main.js +0 -60
  52. package/docs/assets/navigation.js +0 -1
  53. package/docs/assets/search.js +0 -1
  54. package/docs/assets/style.css +0 -1648
  55. package/docs/functions/ExpoPdfMarkupView.html +0 -42
  56. package/docs/functions/setPdfJsWorkerSrc.html +0 -42
  57. package/docs/hierarchy.html +0 -29
  58. package/docs/index.html +0 -148
  59. package/docs/modules.html +0 -40
  60. package/docs/types/Annotation.html +0 -33
  61. package/docs/types/AnnotationBounds.html +0 -73
  62. package/docs/types/AnnotationMode.html +0 -33
  63. package/docs/types/AnnotationPoint.html +0 -61
  64. package/docs/types/AnnotationsData.html +0 -61
  65. package/docs/types/ExpoPdfMarkupViewProps.html +0 -184
  66. package/docs/types/HighlightAnnotation.html +0 -91
  67. package/docs/types/InkAnnotation.html +0 -91
  68. package/docs/types/StampAnnotation.html +0 -95
  69. package/docs/types/StampDefinition.html +0 -72
  70. package/docs/types/TextAnnotation.html +0 -110
  71. package/docs/types/TextInputRequest.html +0 -73
  72. package/docs/types/UnderlineAnnotation.html +0 -85
  73. package/ios/InkPDFAnnotation.swift +0 -45
@@ -3,7 +3,11 @@ package dev.terhoeven.expopdfmarkup
3
3
  import android.app.AlertDialog
4
4
  import android.content.Context
5
5
  import android.graphics.pdf.PdfRenderer
6
+ import android.os.Build
6
7
  import android.os.ParcelFileDescriptor
8
+ import android.view.KeyEvent
9
+ import android.view.MotionEvent
10
+ import android.view.ViewTreeObserver
7
11
  import android.widget.EditText
8
12
  import expo.modules.kotlin.AppContext
9
13
  import expo.modules.kotlin.viewevent.EventDispatcher
@@ -34,8 +38,18 @@ class ExpoPdfMarkupView(context: Context, appContext: AppContext) : ExpoView(con
34
38
  private var pendingTextPoint: AnnotationPoint? = null
35
39
  private var pendingTextAnnotationId: String? = null
36
40
 
41
+ /** When a text input elsewhere lets go of focus, book mode takes the keys back. */
42
+ private val focusChangeListener = ViewTreeObserver.OnGlobalFocusChangeListener {
43
+ oldFocus,
44
+ newFocus
45
+ ->
46
+ if (newFocus == null && oldFocus?.onCheckIsTextEditor() == true) post { claimKeyFocus() }
47
+ }
48
+
37
49
  init {
38
50
  addView(pdfView)
51
+ // Book mode takes key focus for pedals and keyboards; it has nothing to highlight.
52
+ if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) defaultFocusHighlightEnabled = false
39
53
  pdfView.onPageChangeListener = { page, pageCount, pageWidth, pageHeight ->
40
54
  onPageChanged(
41
55
  mapOf(
@@ -85,13 +99,14 @@ class ExpoPdfMarkupView(context: Context, appContext: AppContext) : ExpoView(con
85
99
  renderer = r
86
100
  lastLoadedSource = source
87
101
  onLoadComplete(mapOf("pageCount" to r.pageCount))
88
- if (width > 0) {
89
- pdfView.loadPages(r, width)
102
+ if (width > 0 && (height > 0 || !pdfView.isBookMode)) {
103
+ pdfView.loadPages(r, width, height)
90
104
  } else {
91
- post { renderer?.let { pdfView.loadPages(it, width) } }
105
+ post { renderer?.let { pdfView.loadPages(it, width, height) } }
92
106
  }
93
107
  // Re-apply pending annotations after load
94
108
  pendingAnnotationsJson?.let { loadAnnotations(it) }
109
+ claimKeyFocus()
95
110
  } catch (e: Exception) {
96
111
  onError(mapOf("message" to "Failed to load PDF: ${e.message}"))
97
112
  }
@@ -119,6 +134,73 @@ class ExpoPdfMarkupView(context: Context, appContext: AppContext) : ExpoView(con
119
134
  pdfView.annotations = deduped
120
135
  }
121
136
 
137
+ /** `"continuous"` (default) or `"book"`: one page at a time, turned sideways. */
138
+ var displayMode: String = "continuous"
139
+ private set
140
+
141
+ /** Switches display mode, keeping the reader on the page they were on. */
142
+ fun setDisplayMode(mode: String?) {
143
+ val newMode = if (mode == "book") "book" else "continuous"
144
+ if (newMode == displayMode) return
145
+ displayMode = newMode
146
+ val page = pdfView.currentPage
147
+ pdfView.isBookMode = newMode == "book"
148
+ renderer?.let { pdfView.loadPages(it, width, height, startPage = page) }
149
+ // Only book mode handles keys, so only book mode takes focus.
150
+ isFocusable = pdfView.isBookMode
151
+ isFocusableInTouchMode = pdfView.isBookMode
152
+ if (pdfView.isBookMode) {
153
+ claimKeyFocus()
154
+ } else if (hasFocus()) {
155
+ clearFocus()
156
+ }
157
+ }
158
+
159
+ /** Whether a text input in this window has focus, so keys belong to it. */
160
+ private fun textInputHasFocus(): Boolean = rootView.findFocus()?.onCheckIsTextEditor() == true
161
+
162
+ /**
163
+ * Takes key focus in book mode, so a keyboard or page-turner pedal turns
164
+ * the page without the host app doing anything. Never takes it from a
165
+ * text input.
166
+ */
167
+ private fun claimKeyFocus() {
168
+ if (!pdfView.isBookMode || !isAttachedToWindow || hasFocus() || textInputHasFocus()) return
169
+ requestFocus()
170
+ }
171
+
172
+ override fun dispatchTouchEvent(ev: MotionEvent): Boolean {
173
+ if (ev.actionMasked == MotionEvent.ACTION_DOWN) claimKeyFocus()
174
+ return super.dispatchTouchEvent(ev)
175
+ }
176
+
177
+ /** The turn a hardware key asks for in book mode, or null to leave it alone. */
178
+ private fun bookKeyTurn(keyCode: Int, event: KeyEvent): BookTurnPolicy.Direction? {
179
+ if (!pdfView.isBookMode) return null
180
+ return BookTurnPolicy.keyTurnFor(
181
+ keyCode,
182
+ textInputHasFocus = textInputHasFocus(),
183
+ hasModifiers = !event.hasNoModifiers()
184
+ )
185
+ }
186
+
187
+ override fun onKeyDown(keyCode: Int, event: KeyEvent): Boolean {
188
+ val direction = bookKeyTurn(keyCode, event) ?: return super.onKeyDown(keyCode, event)
189
+ // A key turns even mid-stroke: drop the unfinished ink rather than carry it to the new page.
190
+ pdfView.cancelActiveGestures()
191
+ turnPage(direction)
192
+ return true
193
+ }
194
+
195
+ override fun onKeyUp(keyCode: Int, event: KeyEvent): Boolean =
196
+ bookKeyTurn(keyCode, event) != null || super.onKeyUp(keyCode, event)
197
+
198
+ /**
199
+ * Turns one page in book mode, with the same slide, bounce and single
200
+ * onPageChanged as a swipe or edge tap. No-op in continuous mode.
201
+ */
202
+ fun turnPage(direction: BookTurnPolicy.Direction): Boolean = pdfView.turnPage(direction)
203
+
122
204
  fun setAnnotationMode(mode: String?) {
123
205
  pdfView.annotationMode = mode ?: "none"
124
206
  }
@@ -200,6 +282,7 @@ class ExpoPdfMarkupView(context: Context, appContext: AppContext) : ExpoView(con
200
282
  }
201
283
 
202
284
  override fun onDetachedFromWindow() {
285
+ viewTreeObserver.removeOnGlobalFocusChangeListener(focusChangeListener)
203
286
  super.onDetachedFromWindow()
204
287
  pdfView.cancelActiveGestures()
205
288
  // Save the successfully-loaded source before close() so we can reload on re-attach.
@@ -212,6 +295,8 @@ class ExpoPdfMarkupView(context: Context, appContext: AppContext) : ExpoView(con
212
295
 
213
296
  override fun onAttachedToWindow() {
214
297
  super.onAttachedToWindow()
298
+ viewTreeObserver.addOnGlobalFocusChangeListener(focusChangeListener)
299
+ post { claimKeyFocus() }
215
300
  sourceToReloadOnAttach?.let { source ->
216
301
  sourceToReloadOnAttach = null
217
302
  pdfView.pendingScrollRestore = savedScrollState
@@ -222,8 +307,14 @@ class ExpoPdfMarkupView(context: Context, appContext: AppContext) : ExpoView(con
222
307
 
223
308
  override fun onSizeChanged(w: Int, h: Int, oldw: Int, oldh: Int) {
224
309
  super.onSizeChanged(w, h, oldw, oldh)
225
- if (w > 0 && w != oldw) {
226
- renderer?.let { pdfView.loadPages(it, w) }
310
+ val r = renderer ?: return
311
+ if (pdfView.isBookMode) {
312
+ // Rotation or resize: re-fit the page in view and stay on it.
313
+ if (w > 0 && h > 0 && (w != oldw || h != oldh)) {
314
+ pdfView.loadPages(r, w, h, startPage = pdfView.currentPage)
315
+ }
316
+ } else if (w > 0 && w != oldw) {
317
+ pdfView.loadPages(r, w, h)
227
318
  }
228
319
  }
229
320
  }
@@ -85,9 +85,21 @@ export type TextInputRequest = {
85
85
  point: AnnotationPoint;
86
86
  currentText?: string;
87
87
  };
88
+ /**
89
+ * How the document's pages are presented.
90
+ * - `'continuous'`: every page stacked in one continuous vertical scroll.
91
+ * - `'book'`: one page at a time, fitted to the view, turned sideways by swiping, tapping near
92
+ * the left or right edge, or pressing the arrow or Page Up / Page Down keys.
93
+ */
94
+ export type DisplayMode = 'continuous' | 'book';
88
95
  export type ExpoPdfMarkupViewProps = {
89
96
  /** Absolute local file path of the PDF to display. */
90
97
  source: string;
98
+ /**
99
+ * How pages are presented: `'continuous'` vertical scroll, or `'book'` mode with one page at a
100
+ * time. `page` and `onPageChanged` mean the same in both modes. Defaults to `'continuous'`.
101
+ */
102
+ displayMode?: DisplayMode;
91
103
  /** 0-based page number to display. Can be used to restore scroll position on orientation change. */
92
104
  page?: number;
93
105
  /** Background colour shown behind the PDF pages. */
@@ -1 +1 @@
1
- {"version":3,"file":"ExpoPdfMarkup.types.d.ts","sourceRoot":"","sources":["../src/ExpoPdfMarkup.types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAEzD,MAAM,MAAM,eAAe,GAAG;IAAE,CAAC,EAAE,MAAM,CAAC;IAAC,CAAC,EAAE,MAAM,CAAA;CAAE,CAAC;AAEvD,MAAM,MAAM,gBAAgB,GAAG;IAAE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AAE,CAAA;KAAE,KAAK,IAAI,CAAC;IACjF;;;;;;OAMG;IACH,oBAAoB,CAAC,EAAE,CAAC,OAAO,EAAE,gBAAgB,KAAK,OAAO,CAAC,MAAM,GAAG,IAAI,CAAC,CAAC;IAC7E,KAAK,CAAC,EAAE,SAAS,CAAC,SAAS,CAAC,CAAC;CAC9B,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"ExpoPdfMarkup.types.js","sourceRoot":"","sources":["../src/ExpoPdfMarkup.types.ts"],"names":[],"mappings":"","sourcesContent":["import type { StyleProp, ViewStyle } from 'react-native';\n\nexport type AnnotationPoint = { x: number; y: number };\n\nexport type AnnotationBounds = { x: number; y: number; width: number; height: number };\n\nexport type InkAnnotation = {\n id: string;\n type: 'ink';\n page: number;\n color: string;\n lineWidth: number;\n paths: AnnotationPoint[][];\n createdAt?: number;\n};\n\nexport type HighlightAnnotation = {\n id: string;\n type: 'highlight';\n page: number;\n color: string;\n alpha?: number;\n bounds: AnnotationBounds;\n createdAt?: number;\n};\n\nexport type UnderlineAnnotation = {\n id: string;\n type: 'underline';\n page: number;\n color: string;\n bounds: AnnotationBounds;\n createdAt?: number;\n};\n\nexport type TextAnnotation = {\n id: string;\n type: 'text' | 'freeText';\n page: number;\n color: string;\n bounds: AnnotationBounds;\n contents?: string;\n fontSize?: number;\n /**\n * Font family for the text annotation. Platform-specific:\n * - iOS: PostScript name (`\"Georgia\"`, `\"Courier\"`) or `undefined` for system font (San Francisco)\n * - Android: family name (`\"serif\"`, `\"monospace\"`) or `undefined` for default sans-serif\n * - Web: CSS font family (`\"Georgia, serif\"`) or `undefined` for `sans-serif`\n */\n fontFamily?: string;\n createdAt?: number;\n};\n\nexport type StampAnnotation = {\n id: string;\n type: 'stamp';\n page: number;\n /** Colour applied to the text glyph, as a CSS colour string (e.g. `'#FF0000'`). Has no visible effect on full-colour emoji. */\n color: string;\n bounds: AnnotationBounds;\n /** A glyph or short string to render (e.g. an emoji, or a plain character like `'f'`). */\n text: string;\n createdAt?: number;\n};\n\nexport type Annotation =\n InkAnnotation | HighlightAnnotation | UnderlineAnnotation | TextAnnotation | StampAnnotation;\n\nexport type AnnotationsData = {\n version: 1;\n annotations: Annotation[];\n};\n\nexport type AnnotationMode =\n 'none' | 'ink' | 'highlight' | 'underline' | 'text' | 'stamp' | 'eraser' | 'move';\n\n/**\n * Recommended shape for describing a consumer-defined stamp set (e.g. domain-specific glyphs).\n * Purely a convenience type for organizing your own stamp picker UI — never sent to native;\n * extract `text` to set as the `stampText` prop before placement.\n */\nexport type StampDefinition = {\n id: string;\n label: string;\n text: string;\n};\n\nexport type TextInputRequest = {\n mode: 'create' | 'edit';\n page: number;\n point: AnnotationPoint;\n currentText?: string;\n};\n\nexport type ExpoPdfMarkupViewProps = {\n /** Absolute local file path of the PDF to display. */\n source: string;\n /** 0-based page number to display. Can be used to restore scroll position on orientation change. */\n page?: number;\n /** Background colour shown behind the PDF pages. */\n backgroundColor?: string;\n /** Serialised {@link AnnotationsData} JSON string to load when the document opens. */\n annotations?: string;\n /** Active annotation tool. Defaults to `'none'` (view-only). */\n annotationMode?: AnnotationMode;\n /** Colour applied to new annotations, as a CSS colour string (e.g. `'#FF0000'`). */\n annotationColor?: string;\n /** Stroke width in points applied to new ink annotations. */\n annotationLineWidth?: number;\n /**\n * Default font family for new text annotations. Platform-specific:\n * - iOS: PostScript name (`\"Georgia\"`, `\"Courier\"`) or `undefined` for system font (San Francisco)\n * - Android: React Native / Expo font family name (`\"Montserrat-Regular\"`, `\"serif\"`) or `undefined` for default sans-serif\n * - Web: CSS font family (`\"Georgia, serif\"`) or `undefined` for `sans-serif`\n */\n annotationFontFamily?: string;\n /** Glyph or short string for the next stamp to place. Required for the `'stamp'` tool to place anything on tap. */\n stampText?: string;\n /** Side length, in PDF points, of the square bounding box for newly placed stamps. Defaults to 48. */\n stampSize?: number;\n /** Fired when the visible page changes. */\n onPageChanged?: (event: {\n nativeEvent: { page: number; pageCount: number; pageWidth: number; pageHeight: number };\n }) => void;\n /** Fired once the document has finished loading. */\n onLoadComplete?: (event: { nativeEvent: { pageCount: number } }) => void;\n /** Fired when the document fails to load. */\n onError?: (event: { nativeEvent: { message: string } }) => void;\n /** Fired after annotations are created or edited. `annotations` is a serialised {@link AnnotationsData} JSON string. */\n onAnnotationsChanged?: (event: { nativeEvent: { annotations: string } }) => void;\n /**\n * Optional async callback for the text annotation tool. When provided, this is called instead of\n * the native platform dialog (UIAlertController / AlertDialog) when the user taps to place a text\n * annotation. When editing an existing text annotation, `request.currentText` is populated and\n * `request.mode` is `'edit'`. Return the text string to create/update the annotation, or `null`\n * to cancel.\n */\n onTextInputRequested?: (request: TextInputRequest) => Promise<string | null>;\n style?: StyleProp<ViewStyle>;\n};\n"]}
1
+ {"version":3,"file":"ExpoPdfMarkup.types.js","sourceRoot":"","sources":["../src/ExpoPdfMarkup.types.ts"],"names":[],"mappings":"","sourcesContent":["import type { StyleProp, ViewStyle } from 'react-native';\n\nexport type AnnotationPoint = { x: number; y: number };\n\nexport type AnnotationBounds = { x: number; y: number; width: number; height: number };\n\nexport type InkAnnotation = {\n id: string;\n type: 'ink';\n page: number;\n color: string;\n lineWidth: number;\n paths: AnnotationPoint[][];\n createdAt?: number;\n};\n\nexport type HighlightAnnotation = {\n id: string;\n type: 'highlight';\n page: number;\n color: string;\n alpha?: number;\n bounds: AnnotationBounds;\n createdAt?: number;\n};\n\nexport type UnderlineAnnotation = {\n id: string;\n type: 'underline';\n page: number;\n color: string;\n bounds: AnnotationBounds;\n createdAt?: number;\n};\n\nexport type TextAnnotation = {\n id: string;\n type: 'text' | 'freeText';\n page: number;\n color: string;\n bounds: AnnotationBounds;\n contents?: string;\n fontSize?: number;\n /**\n * Font family for the text annotation. Platform-specific:\n * - iOS: PostScript name (`\"Georgia\"`, `\"Courier\"`) or `undefined` for system font (San Francisco)\n * - Android: family name (`\"serif\"`, `\"monospace\"`) or `undefined` for default sans-serif\n * - Web: CSS font family (`\"Georgia, serif\"`) or `undefined` for `sans-serif`\n */\n fontFamily?: string;\n createdAt?: number;\n};\n\nexport type StampAnnotation = {\n id: string;\n type: 'stamp';\n page: number;\n /** Colour applied to the text glyph, as a CSS colour string (e.g. `'#FF0000'`). Has no visible effect on full-colour emoji. */\n color: string;\n bounds: AnnotationBounds;\n /** A glyph or short string to render (e.g. an emoji, or a plain character like `'f'`). */\n text: string;\n createdAt?: number;\n};\n\nexport type Annotation =\n InkAnnotation | HighlightAnnotation | UnderlineAnnotation | TextAnnotation | StampAnnotation;\n\nexport type AnnotationsData = {\n version: 1;\n annotations: Annotation[];\n};\n\nexport type AnnotationMode =\n 'none' | 'ink' | 'highlight' | 'underline' | 'text' | 'stamp' | 'eraser' | 'move';\n\n/**\n * Recommended shape for describing a consumer-defined stamp set (e.g. domain-specific glyphs).\n * Purely a convenience type for organizing your own stamp picker UI — never sent to native;\n * extract `text` to set as the `stampText` prop before placement.\n */\nexport type StampDefinition = {\n id: string;\n label: string;\n text: string;\n};\n\nexport type TextInputRequest = {\n mode: 'create' | 'edit';\n page: number;\n point: AnnotationPoint;\n currentText?: string;\n};\n\n/**\n * How the document's pages are presented.\n * - `'continuous'`: every page stacked in one continuous vertical scroll.\n * - `'book'`: one page at a time, fitted to the view, turned sideways by swiping, tapping near\n * the left or right edge, or pressing the arrow or Page Up / Page Down keys.\n */\nexport type DisplayMode = 'continuous' | 'book';\n\nexport type ExpoPdfMarkupViewProps = {\n /** Absolute local file path of the PDF to display. */\n source: string;\n /**\n * How pages are presented: `'continuous'` vertical scroll, or `'book'` mode with one page at a\n * time. `page` and `onPageChanged` mean the same in both modes. Defaults to `'continuous'`.\n */\n displayMode?: DisplayMode;\n /** 0-based page number to display. Can be used to restore scroll position on orientation change. */\n page?: number;\n /** Background colour shown behind the PDF pages. */\n backgroundColor?: string;\n /** Serialised {@link AnnotationsData} JSON string to load when the document opens. */\n annotations?: string;\n /** Active annotation tool. Defaults to `'none'` (view-only). */\n annotationMode?: AnnotationMode;\n /** Colour applied to new annotations, as a CSS colour string (e.g. `'#FF0000'`). */\n annotationColor?: string;\n /** Stroke width in points applied to new ink annotations. */\n annotationLineWidth?: number;\n /**\n * Default font family for new text annotations. Platform-specific:\n * - iOS: PostScript name (`\"Georgia\"`, `\"Courier\"`) or `undefined` for system font (San Francisco)\n * - Android: React Native / Expo font family name (`\"Montserrat-Regular\"`, `\"serif\"`) or `undefined` for default sans-serif\n * - Web: CSS font family (`\"Georgia, serif\"`) or `undefined` for `sans-serif`\n */\n annotationFontFamily?: string;\n /** Glyph or short string for the next stamp to place. Required for the `'stamp'` tool to place anything on tap. */\n stampText?: string;\n /** Side length, in PDF points, of the square bounding box for newly placed stamps. Defaults to 48. */\n stampSize?: number;\n /** Fired when the visible page changes. */\n onPageChanged?: (event: {\n nativeEvent: { page: number; pageCount: number; pageWidth: number; pageHeight: number };\n }) => void;\n /** Fired once the document has finished loading. */\n onLoadComplete?: (event: { nativeEvent: { pageCount: number } }) => void;\n /** Fired when the document fails to load. */\n onError?: (event: { nativeEvent: { message: string } }) => void;\n /** Fired after annotations are created or edited. `annotations` is a serialised {@link AnnotationsData} JSON string. */\n onAnnotationsChanged?: (event: { nativeEvent: { annotations: string } }) => void;\n /**\n * Optional async callback for the text annotation tool. When provided, this is called instead of\n * the native platform dialog (UIAlertController / AlertDialog) when the user taps to place a text\n * annotation. When editing an existing text annotation, `request.currentText` is populated and\n * `request.mode` is `'edit'`. Return the text string to create/update the annotation, or `null`\n * to cancel.\n */\n onTextInputRequested?: (request: TextInputRequest) => Promise<string | null>;\n style?: StyleProp<ViewStyle>;\n};\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"ExpoPdfMarkupView.web.d.ts","sourceRoot":"","sources":["../src/ExpoPdfMarkupView.web.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAE/B,OAAO,KAAK,EAGV,sBAAsB,EAGvB,MAAM,uBAAuB,CAAC;AAuB/B,iFAAiF;AACjF,wBAAgB,iBAAiB,CAAC,GAAG,EAAE,MAAM,GAAG,IAAI,CAEnD;AASD,gGAAgG;AAChG,wBAAgB,eAAe,CAAC,GAAG,EAAE,MAAM,GAAG,IAAI,CAEjD;AAqYD,MAAM,CAAC,OAAO,UAAU,iBAAiB,CAAC,KAAK,EAAE,sBAAsB,qBAqWtE"}
1
+ {"version":3,"file":"ExpoPdfMarkupView.web.d.ts","sourceRoot":"","sources":["../src/ExpoPdfMarkupView.web.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAE/B,OAAO,KAAK,EAGV,sBAAsB,EAGvB,MAAM,uBAAuB,CAAC;AAwC/B,iFAAiF;AACjF,wBAAgB,iBAAiB,CAAC,GAAG,EAAE,MAAM,GAAG,IAAI,CAEnD;AASD,gGAAgG;AAChG,wBAAgB,eAAe,CAAC,GAAG,EAAE,MAAM,GAAG,IAAI,CAEjD;AAqZD,MAAM,CAAC,OAAO,UAAU,iBAAiB,CAAC,KAAK,EAAE,sBAAsB,qBA2sBtE"}