@tobyt/expo-pdf-markup 1.1.4 → 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 (39) hide show
  1. package/CHANGELOG.md +6 -0
  2. package/android/src/main/java/dev/terhoeven/expopdfmarkup/BookPager.kt +66 -0
  3. package/android/src/main/java/dev/terhoeven/expopdfmarkup/BookTurnPolicy.kt +117 -0
  4. package/android/src/main/java/dev/terhoeven/expopdfmarkup/ContinuousPdfView.kt +370 -57
  5. package/android/src/main/java/dev/terhoeven/expopdfmarkup/ExpoPdfMarkupModule.kt +4 -0
  6. package/android/src/main/java/dev/terhoeven/expopdfmarkup/ExpoPdfMarkupView.kt +96 -5
  7. package/build/ExpoPdfMarkup.types.d.ts +12 -0
  8. package/build/ExpoPdfMarkup.types.d.ts.map +1 -1
  9. package/build/ExpoPdfMarkup.types.js.map +1 -1
  10. package/build/ExpoPdfMarkupView.web.d.ts.map +1 -1
  11. package/build/ExpoPdfMarkupView.web.js +369 -44
  12. package/build/ExpoPdfMarkupView.web.js.map +1 -1
  13. package/build/web/bookMode.d.ts +77 -0
  14. package/build/web/bookMode.d.ts.map +1 -0
  15. package/build/web/bookMode.js +169 -0
  16. package/build/web/bookMode.js.map +1 -0
  17. package/build/web/layout.d.ts +8 -0
  18. package/build/web/layout.d.ts.map +1 -0
  19. package/build/web/layout.js +22 -0
  20. package/build/web/layout.js.map +1 -0
  21. package/build/web/types.d.ts +2 -0
  22. package/build/web/types.d.ts.map +1 -1
  23. package/build/web/types.js.map +1 -1
  24. package/docs/agents/domain.md +51 -0
  25. package/docs/agents/issue-tracker.md +46 -0
  26. package/docs/agents/triage-labels.md +15 -0
  27. package/ios/ExpoPdfMarkupModule.swift +4 -0
  28. package/ios/ExpoPdfMarkupView+Book.swift +455 -0
  29. package/ios/ExpoPdfMarkupView.swift +46 -2
  30. package/ios/Tests/BookModeTests.swift +534 -0
  31. package/ios/Tests/book-sample.pdf +207 -0
  32. package/ios/Tests/single-page.pdf +52 -0
  33. package/package.json +3 -2
  34. package/src/ExpoPdfMarkup.types.ts +13 -0
  35. package/src/ExpoPdfMarkupView.web.tsx +443 -52
  36. package/src/web/bookMode.ts +186 -0
  37. package/src/web/layout.ts +30 -0
  38. package/src/web/types.ts +3 -0
  39. package/tsconfig.test.json +10 -0
@@ -0,0 +1,207 @@
1
+ %PDF-1.4
2
+ 1 0 obj
3
+ << /Type /Catalog /Pages 2 0 R >>
4
+ endobj
5
+ 2 0 obj
6
+ << /Type /Pages /Kids [5 0 R 7 0 R 9 0 R 11 0 R 13 0 R 15 0 R] /Count 6 >>
7
+ endobj
8
+ 3 0 obj
9
+ << /Type /Font /Subtype /Type1 /BaseFont /Helvetica >>
10
+ endobj
11
+ 4 0 obj
12
+ << /Length 370 >>
13
+ stream
14
+ 0.85 0.2 0.2 rg
15
+ 0 0 24 842 re f
16
+ 571 0 24 842 re f
17
+ 0 0 0 rg
18
+ BT /F1 160 Tf
19
+ 252.5 461.0 Td
20
+ (1) Tj ET
21
+ BT /F1 28 Tf
22
+ 227.5 411.0 Td
23
+ (Page 1 of 6) Tj ET
24
+ 0.6 w 0 0 0 RG
25
+ 60 260 m 535 260 l S
26
+ 60 250 m 535 250 l S
27
+ 60 240 m 535 240 l S
28
+ 60 230 m 535 230 l S
29
+ 60 220 m 535 220 l S
30
+ 60 160 m 535 160 l S
31
+ 60 150 m 535 150 l S
32
+ 60 140 m 535 140 l S
33
+ 60 130 m 535 130 l S
34
+ 60 120 m 535 120 l S
35
+ endstream
36
+ endobj
37
+ 5 0 obj
38
+ << /Type /Page /Parent 2 0 R /MediaBox [0 0 595 842] /Resources << /Font << /F1 3 0 R >> >> /Contents 4 0 R >>
39
+ endobj
40
+ 6 0 obj
41
+ << /Length 371 >>
42
+ stream
43
+ 0.95 0.55 0.1 rg
44
+ 0 0 24 842 re f
45
+ 571 0 24 842 re f
46
+ 0 0 0 rg
47
+ BT /F1 160 Tf
48
+ 252.5 461.0 Td
49
+ (2) Tj ET
50
+ BT /F1 28 Tf
51
+ 227.5 411.0 Td
52
+ (Page 2 of 6) Tj ET
53
+ 0.6 w 0 0 0 RG
54
+ 60 260 m 535 260 l S
55
+ 60 250 m 535 250 l S
56
+ 60 240 m 535 240 l S
57
+ 60 230 m 535 230 l S
58
+ 60 220 m 535 220 l S
59
+ 60 160 m 535 160 l S
60
+ 60 150 m 535 150 l S
61
+ 60 140 m 535 140 l S
62
+ 60 130 m 535 130 l S
63
+ 60 120 m 535 120 l S
64
+ endstream
65
+ endobj
66
+ 7 0 obj
67
+ << /Type /Page /Parent 2 0 R /MediaBox [0 0 595 842] /Resources << /Font << /F1 3 0 R >> >> /Contents 6 0 R >>
68
+ endobj
69
+ 8 0 obj
70
+ << /Length 370 >>
71
+ stream
72
+ 0.2 0.65 0.3 rg
73
+ 0 0 24 842 re f
74
+ 571 0 24 842 re f
75
+ 0 0 0 rg
76
+ BT /F1 160 Tf
77
+ 252.5 461.0 Td
78
+ (3) Tj ET
79
+ BT /F1 28 Tf
80
+ 227.5 411.0 Td
81
+ (Page 3 of 6) Tj ET
82
+ 0.6 w 0 0 0 RG
83
+ 60 260 m 535 260 l S
84
+ 60 250 m 535 250 l S
85
+ 60 240 m 535 240 l S
86
+ 60 230 m 535 230 l S
87
+ 60 220 m 535 220 l S
88
+ 60 160 m 535 160 l S
89
+ 60 150 m 535 150 l S
90
+ 60 140 m 535 140 l S
91
+ 60 130 m 535 130 l S
92
+ 60 120 m 535 120 l S
93
+ endstream
94
+ endobj
95
+ 9 0 obj
96
+ << /Type /Page /Parent 2 0 R /MediaBox [0 0 595 842] /Resources << /Font << /F1 3 0 R >> >> /Contents 8 0 R >>
97
+ endobj
98
+ 10 0 obj
99
+ << /Length 372 >>
100
+ stream
101
+ 0.15 0.45 0.85 rg
102
+ 0 0 24 842 re f
103
+ 571 0 24 842 re f
104
+ 0 0 0 rg
105
+ BT /F1 160 Tf
106
+ 252.5 461.0 Td
107
+ (4) Tj ET
108
+ BT /F1 28 Tf
109
+ 227.5 411.0 Td
110
+ (Page 4 of 6) Tj ET
111
+ 0.6 w 0 0 0 RG
112
+ 60 260 m 535 260 l S
113
+ 60 250 m 535 250 l S
114
+ 60 240 m 535 240 l S
115
+ 60 230 m 535 230 l S
116
+ 60 220 m 535 220 l S
117
+ 60 160 m 535 160 l S
118
+ 60 150 m 535 150 l S
119
+ 60 140 m 535 140 l S
120
+ 60 130 m 535 130 l S
121
+ 60 120 m 535 120 l S
122
+ endstream
123
+ endobj
124
+ 11 0 obj
125
+ << /Type /Page /Parent 2 0 R /MediaBox [0 0 595 842] /Resources << /Font << /F1 3 0 R >> >> /Contents 10 0 R >>
126
+ endobj
127
+ 12 0 obj
128
+ << /Length 369 >>
129
+ stream
130
+ 0.5 0.3 0.8 rg
131
+ 0 0 24 842 re f
132
+ 571 0 24 842 re f
133
+ 0 0 0 rg
134
+ BT /F1 160 Tf
135
+ 252.5 461.0 Td
136
+ (5) Tj ET
137
+ BT /F1 28 Tf
138
+ 227.5 411.0 Td
139
+ (Page 5 of 6) Tj ET
140
+ 0.6 w 0 0 0 RG
141
+ 60 260 m 535 260 l S
142
+ 60 250 m 535 250 l S
143
+ 60 240 m 535 240 l S
144
+ 60 230 m 535 230 l S
145
+ 60 220 m 535 220 l S
146
+ 60 160 m 535 160 l S
147
+ 60 150 m 535 150 l S
148
+ 60 140 m 535 140 l S
149
+ 60 130 m 535 130 l S
150
+ 60 120 m 535 120 l S
151
+ endstream
152
+ endobj
153
+ 13 0 obj
154
+ << /Type /Page /Parent 2 0 R /MediaBox [0 0 595 842] /Resources << /Font << /F1 3 0 R >> >> /Contents 12 0 R >>
155
+ endobj
156
+ 14 0 obj
157
+ << /Length 369 >>
158
+ stream
159
+ 0.4 0.4 0.4 rg
160
+ 0 0 24 842 re f
161
+ 571 0 24 842 re f
162
+ 0 0 0 rg
163
+ BT /F1 160 Tf
164
+ 252.5 461.0 Td
165
+ (6) Tj ET
166
+ BT /F1 28 Tf
167
+ 227.5 411.0 Td
168
+ (Page 6 of 6) Tj ET
169
+ 0.6 w 0 0 0 RG
170
+ 60 260 m 535 260 l S
171
+ 60 250 m 535 250 l S
172
+ 60 240 m 535 240 l S
173
+ 60 230 m 535 230 l S
174
+ 60 220 m 535 220 l S
175
+ 60 160 m 535 160 l S
176
+ 60 150 m 535 150 l S
177
+ 60 140 m 535 140 l S
178
+ 60 130 m 535 130 l S
179
+ 60 120 m 535 120 l S
180
+ endstream
181
+ endobj
182
+ 15 0 obj
183
+ << /Type /Page /Parent 2 0 R /MediaBox [0 0 595 842] /Resources << /Font << /F1 3 0 R >> >> /Contents 14 0 R >>
184
+ endobj
185
+ xref
186
+ 0 16
187
+ 0000000000 65535 f
188
+ 0000000009 00000 n
189
+ 0000000058 00000 n
190
+ 0000000148 00000 n
191
+ 0000000218 00000 n
192
+ 0000000639 00000 n
193
+ 0000000765 00000 n
194
+ 0000001187 00000 n
195
+ 0000001313 00000 n
196
+ 0000001734 00000 n
197
+ 0000001860 00000 n
198
+ 0000002284 00000 n
199
+ 0000002412 00000 n
200
+ 0000002833 00000 n
201
+ 0000002961 00000 n
202
+ 0000003382 00000 n
203
+ trailer
204
+ << /Size 16 /Root 1 0 R >>
205
+ startxref
206
+ 3510
207
+ %%EOF
@@ -0,0 +1,52 @@
1
+ %PDF-1.4
2
+ 1 0 obj
3
+ << /Type /Catalog /Pages 2 0 R >>
4
+ endobj
5
+ 2 0 obj
6
+ << /Type /Pages /Kids [5 0 R] /Count 1 >>
7
+ endobj
8
+ 3 0 obj
9
+ << /Type /Font /Subtype /Type1 /BaseFont /Helvetica >>
10
+ endobj
11
+ 4 0 obj
12
+ << /Length 370 >>
13
+ stream
14
+ 0.85 0.2 0.2 rg
15
+ 0 0 24 842 re f
16
+ 571 0 24 842 re f
17
+ 0 0 0 rg
18
+ BT /F1 160 Tf
19
+ 252.5 461.0 Td
20
+ (1) Tj ET
21
+ BT /F1 28 Tf
22
+ 227.5 411.0 Td
23
+ (Page 1 of 1) Tj ET
24
+ 0.6 w 0 0 0 RG
25
+ 60 260 m 535 260 l S
26
+ 60 250 m 535 250 l S
27
+ 60 240 m 535 240 l S
28
+ 60 230 m 535 230 l S
29
+ 60 220 m 535 220 l S
30
+ 60 160 m 535 160 l S
31
+ 60 150 m 535 150 l S
32
+ 60 140 m 535 140 l S
33
+ 60 130 m 535 130 l S
34
+ 60 120 m 535 120 l S
35
+ endstream
36
+ endobj
37
+ 5 0 obj
38
+ << /Type /Page /Parent 2 0 R /MediaBox [0 0 595 842] /Resources << /Font << /F1 3 0 R >> >> /Contents 4 0 R >>
39
+ endobj
40
+ xref
41
+ 0 6
42
+ 0000000000 65535 f
43
+ 0000000009 00000 n
44
+ 0000000058 00000 n
45
+ 0000000115 00000 n
46
+ 0000000185 00000 n
47
+ 0000000606 00000 n
48
+ trailer
49
+ << /Size 6 /Root 1 0 R >>
50
+ startxref
51
+ 732
52
+ %%EOF
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tobyt/expo-pdf-markup",
3
- "version": "1.1.4",
3
+ "version": "1.2.0",
4
4
  "description": "An Expo module for displaying and annotating PDFs",
5
5
  "main": "build/index.js",
6
6
  "types": "build/index.d.ts",
@@ -20,7 +20,8 @@
20
20
  "test:swift": "bash scripts/test-swift.sh",
21
21
  "test:kotlin": "cd example/android && ./gradlew :tobyt-expo-pdf-markup:testDebugUnitTest",
22
22
  "typecheck": "expo-module typecheck",
23
- "qa:ts": "export EXPO_NONINTERACTIVE=1 && npm run typecheck && npm run format && npm run lint && npm run test",
23
+ "typecheck:tests": "tsc -p tsconfig.test.json",
24
+ "qa:ts": "export EXPO_NONINTERACTIVE=1 && npm run typecheck && npm run typecheck:tests && npm run format && npm run lint && npm run test",
24
25
  "qa:ios": "npm run format:swift && npm run lint:swift && npm run test:swift",
25
26
  "qa:android": "npm run format:kotlin && npm run lint:kotlin && npm run test:kotlin",
26
27
  "qa": "npm run qa:ts && npm run qa:ios && npm run qa:android",
@@ -92,9 +92,22 @@ export type TextInputRequest = {
92
92
  currentText?: string;
93
93
  };
94
94
 
95
+ /**
96
+ * How the document's pages are presented.
97
+ * - `'continuous'`: every page stacked in one continuous vertical scroll.
98
+ * - `'book'`: one page at a time, fitted to the view, turned sideways by swiping, tapping near
99
+ * the left or right edge, or pressing the arrow or Page Up / Page Down keys.
100
+ */
101
+ export type DisplayMode = 'continuous' | 'book';
102
+
95
103
  export type ExpoPdfMarkupViewProps = {
96
104
  /** Absolute local file path of the PDF to display. */
97
105
  source: string;
106
+ /**
107
+ * How pages are presented: `'continuous'` vertical scroll, or `'book'` mode with one page at a
108
+ * time. `page` and `onPageChanged` mean the same in both modes. Defaults to `'continuous'`.
109
+ */
110
+ displayMode?: DisplayMode;
98
111
  /** 0-based page number to display. Can be used to restore scroll position on orientation change. */
99
112
  page?: number;
100
113
  /** Background colour shown behind the PDF pages. */