@tobyt/expo-pdf-markup 1.1.4 → 2.0.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 (55) hide show
  1. package/CHANGELOG.md +22 -0
  2. package/README.md +18 -0
  3. package/android/build.gradle +3 -0
  4. package/android/src/main/java/dev/terhoeven/expopdfmarkup/BookPager.kt +66 -0
  5. package/android/src/main/java/dev/terhoeven/expopdfmarkup/BookTurnPolicy.kt +117 -0
  6. package/android/src/main/java/dev/terhoeven/expopdfmarkup/ContinuousPdfView.kt +370 -57
  7. package/android/src/main/java/dev/terhoeven/expopdfmarkup/ExpoPdfMarkupModule.kt +4 -0
  8. package/android/src/main/java/dev/terhoeven/expopdfmarkup/ExpoPdfMarkupView.kt +96 -5
  9. package/build/ExpoPdfMarkup.types.d.ts +19 -1
  10. package/build/ExpoPdfMarkup.types.d.ts.map +1 -1
  11. package/build/ExpoPdfMarkup.types.js.map +1 -1
  12. package/build/ExpoPdfMarkupView.web.d.ts.map +1 -1
  13. package/build/ExpoPdfMarkupView.web.js +396 -65
  14. package/build/ExpoPdfMarkupView.web.js.map +1 -1
  15. package/build/web/bookMode.d.ts +77 -0
  16. package/build/web/bookMode.d.ts.map +1 -0
  17. package/build/web/bookMode.js +169 -0
  18. package/build/web/bookMode.js.map +1 -0
  19. package/build/web/layout.d.ts +8 -0
  20. package/build/web/layout.d.ts.map +1 -0
  21. package/build/web/layout.js +22 -0
  22. package/build/web/layout.js.map +1 -0
  23. package/build/web/types.d.ts +2 -0
  24. package/build/web/types.d.ts.map +1 -1
  25. package/build/web/types.js.map +1 -1
  26. package/docs/agents/domain.md +51 -0
  27. package/docs/agents/issue-tracker.md +46 -0
  28. package/docs/agents/triage-labels.md +15 -0
  29. package/docs/annotation-coordinates.md +45 -0
  30. package/docs/annotation-validation.md +117 -0
  31. package/fixtures/annotations-v1.json +130 -0
  32. package/ios/AnnotationModels.swift +29 -30
  33. package/ios/AnnotationSerializer.swift +99 -12
  34. package/ios/ExpoPdfMarkupModule.swift +4 -0
  35. package/ios/ExpoPdfMarkupView+Book.swift +455 -0
  36. package/ios/ExpoPdfMarkupView+Ink.swift +13 -28
  37. package/ios/ExpoPdfMarkupView+Markup.swift +151 -0
  38. package/ios/ExpoPdfMarkupView+Move.swift +17 -6
  39. package/ios/ExpoPdfMarkupView.swift +76 -84
  40. package/ios/StampPDFAnnotation.swift +21 -3
  41. package/ios/Tests/AnnotationCoordinateTests.swift +337 -0
  42. package/ios/Tests/AnnotationSerializerTests.swift +43 -1
  43. package/ios/Tests/AreaMarkupTests.swift +279 -0
  44. package/ios/Tests/BookModeTests.swift +534 -0
  45. package/ios/Tests/ExpoPdfMarkupViewTests.swift +29 -0
  46. package/ios/Tests/RotatedAnnotationRenderingTests.swift +411 -0
  47. package/ios/Tests/book-sample.pdf +207 -0
  48. package/ios/Tests/single-page.pdf +52 -0
  49. package/package.json +3 -2
  50. package/src/ExpoPdfMarkup.types.ts +20 -1
  51. package/src/ExpoPdfMarkupView.web.tsx +471 -70
  52. package/src/web/bookMode.ts +186 -0
  53. package/src/web/layout.ts +30 -0
  54. package/src/web/types.ts +3 -0
  55. package/tsconfig.test.json +10 -0
@@ -1,7 +1,9 @@
1
1
  import type { StyleProp, ViewStyle } from 'react-native';
2
2
 
3
+ /** Zero-origin visible-page points after page rotation, in PDF points with y increasing upward. */
3
4
  export type AnnotationPoint = { x: number; y: number };
4
5
 
6
+ /** Visible-page rectangle; x/y locate its bottom-left corner. See docs/annotation-coordinates.md. */
5
7
  export type AnnotationBounds = { x: number; y: number; width: number; height: number };
6
8
 
7
9
  export type InkAnnotation = {
@@ -92,16 +94,33 @@ export type TextInputRequest = {
92
94
  currentText?: string;
93
95
  };
94
96
 
97
+ /**
98
+ * How the document's pages are presented.
99
+ * - `'continuous'`: every page stacked in one continuous vertical scroll.
100
+ * - `'book'`: one page at a time, fitted to the view, turned sideways by swiping, tapping near
101
+ * the left or right edge, or pressing the arrow or Page Up / Page Down keys.
102
+ */
103
+ export type DisplayMode = 'continuous' | 'book';
104
+
95
105
  export type ExpoPdfMarkupViewProps = {
96
106
  /** Absolute local file path of the PDF to display. */
97
107
  source: string;
108
+ /**
109
+ * How pages are presented: `'continuous'` vertical scroll, or `'book'` mode with one page at a
110
+ * time. `page` and `onPageChanged` mean the same in both modes. Defaults to `'continuous'`.
111
+ */
112
+ displayMode?: DisplayMode;
98
113
  /** 0-based page number to display. Can be used to restore scroll position on orientation change. */
99
114
  page?: number;
100
115
  /** Background colour shown behind the PDF pages. */
101
116
  backgroundColor?: string;
102
117
  /** Serialised {@link AnnotationsData} JSON string to load when the document opens. */
103
118
  annotations?: string;
104
- /** Active annotation tool. Defaults to `'none'` (view-only). */
119
+ /**
120
+ * Active annotation tool. Defaults to `'none'` (view-only).
121
+ * On iOS, highlight/underline use a one-finger area drag on scanned and text-bearing pages.
122
+ * Set `'none'` for touch navigation/zoom; `page` and book-mode hardware keys remain available.
123
+ */
105
124
  annotationMode?: AnnotationMode;
106
125
  /** Colour applied to new annotations, as a CSS colour string (e.g. `'#FF0000'`). */
107
126
  annotationColor?: string;