@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.
- package/CHANGELOG.md +22 -0
- package/README.md +18 -0
- package/android/build.gradle +3 -0
- package/android/src/main/java/dev/terhoeven/expopdfmarkup/BookPager.kt +66 -0
- package/android/src/main/java/dev/terhoeven/expopdfmarkup/BookTurnPolicy.kt +117 -0
- package/android/src/main/java/dev/terhoeven/expopdfmarkup/ContinuousPdfView.kt +370 -57
- package/android/src/main/java/dev/terhoeven/expopdfmarkup/ExpoPdfMarkupModule.kt +4 -0
- package/android/src/main/java/dev/terhoeven/expopdfmarkup/ExpoPdfMarkupView.kt +96 -5
- package/build/ExpoPdfMarkup.types.d.ts +19 -1
- package/build/ExpoPdfMarkup.types.d.ts.map +1 -1
- package/build/ExpoPdfMarkup.types.js.map +1 -1
- package/build/ExpoPdfMarkupView.web.d.ts.map +1 -1
- package/build/ExpoPdfMarkupView.web.js +396 -65
- package/build/ExpoPdfMarkupView.web.js.map +1 -1
- package/build/web/bookMode.d.ts +77 -0
- package/build/web/bookMode.d.ts.map +1 -0
- package/build/web/bookMode.js +169 -0
- package/build/web/bookMode.js.map +1 -0
- package/build/web/layout.d.ts +8 -0
- package/build/web/layout.d.ts.map +1 -0
- package/build/web/layout.js +22 -0
- package/build/web/layout.js.map +1 -0
- package/build/web/types.d.ts +2 -0
- package/build/web/types.d.ts.map +1 -1
- package/build/web/types.js.map +1 -1
- package/docs/agents/domain.md +51 -0
- package/docs/agents/issue-tracker.md +46 -0
- package/docs/agents/triage-labels.md +15 -0
- package/docs/annotation-coordinates.md +45 -0
- package/docs/annotation-validation.md +117 -0
- package/fixtures/annotations-v1.json +130 -0
- package/ios/AnnotationModels.swift +29 -30
- package/ios/AnnotationSerializer.swift +99 -12
- package/ios/ExpoPdfMarkupModule.swift +4 -0
- package/ios/ExpoPdfMarkupView+Book.swift +455 -0
- package/ios/ExpoPdfMarkupView+Ink.swift +13 -28
- package/ios/ExpoPdfMarkupView+Markup.swift +151 -0
- package/ios/ExpoPdfMarkupView+Move.swift +17 -6
- package/ios/ExpoPdfMarkupView.swift +76 -84
- package/ios/StampPDFAnnotation.swift +21 -3
- package/ios/Tests/AnnotationCoordinateTests.swift +337 -0
- package/ios/Tests/AnnotationSerializerTests.swift +43 -1
- package/ios/Tests/AreaMarkupTests.swift +279 -0
- package/ios/Tests/BookModeTests.swift +534 -0
- package/ios/Tests/ExpoPdfMarkupViewTests.swift +29 -0
- package/ios/Tests/RotatedAnnotationRenderingTests.swift +411 -0
- package/ios/Tests/book-sample.pdf +207 -0
- package/ios/Tests/single-page.pdf +52 -0
- package/package.json +3 -2
- package/src/ExpoPdfMarkup.types.ts +20 -1
- package/src/ExpoPdfMarkupView.web.tsx +471 -70
- package/src/web/bookMode.ts +186 -0
- package/src/web/layout.ts +30 -0
- package/src/web/types.ts +3 -0
- 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
|
-
/**
|
|
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;
|