react-isoform 0.0.0-stage → 0.1.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 (353) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +104 -2
  3. package/android/build.gradle +212 -0
  4. package/android/consumer-rules.pro +10 -0
  5. package/android/src/audio/java/com/isoform/IsoAudioControls.kt +531 -0
  6. package/android/src/audio/java/com/isoform/IsoAudioView.kt +328 -0
  7. package/android/src/audio/java/com/isoform/IsoAudioViewManager.kt +88 -0
  8. package/android/src/camera/AndroidManifest.xml +6 -0
  9. package/android/src/camera/java/com/isoform/IsoCamera.kt +99 -0
  10. package/android/src/camera/java/com/isoform/IsoCameraController.kt +232 -0
  11. package/android/src/camera/java/com/isoform/IsoCameraLifecycle.kt +26 -0
  12. package/android/src/camera/java/com/isoform/IsoCameraView.kt +392 -0
  13. package/android/src/camera/java/com/isoform/IsoCameraViewManager.kt +76 -0
  14. package/android/src/cameraCodes/java/com/isoform/IsoCodeScanner.kt +90 -0
  15. package/android/src/cameraCodesOff/java/com/isoform/IsoCodeScanner.kt +17 -0
  16. package/android/src/cameraVideo/AndroidManifest.xml +4 -0
  17. package/android/src/cameraVideo/java/com/isoform/IsoCameraRecorder.kt +83 -0
  18. package/android/src/cameraVideoOff/java/com/isoform/IsoCameraRecorder.kt +22 -0
  19. package/android/src/datePicker/java/com/isoform/IsoDatePicker.kt +724 -0
  20. package/android/src/datePicker/java/com/isoform/IsoDatePickerView.kt +137 -0
  21. package/android/src/datePicker/java/com/isoform/IsoDatePickerViewManager.kt +56 -0
  22. package/android/src/image/java/com/isoform/IsoImageModule.kt +33 -0
  23. package/android/src/image/java/com/isoform/IsoImagePipeline.kt +516 -0
  24. package/android/src/image/java/com/isoform/IsoImageView.kt +573 -0
  25. package/android/src/image/java/com/isoform/IsoImageViewManager.kt +119 -0
  26. package/android/src/main/AndroidManifest.xml +4 -0
  27. package/android/src/main/java/com/isoform/IsoformPackage.kt +52 -0
  28. package/android/src/mediaSession/AndroidManifest.xml +18 -0
  29. package/android/src/mediaSession/java/com/isoform/IsoMediaService.kt +21 -0
  30. package/android/src/mediaSession/java/com/isoform/IsoMediaSession.kt +92 -0
  31. package/android/src/mediaSessionOff/java/com/isoform/IsoMediaSession.kt +18 -0
  32. package/android/src/modal/java/com/isoform/IsoModal.kt +182 -0
  33. package/android/src/modal/java/com/isoform/IsoModalView.kt +137 -0
  34. package/android/src/modal/java/com/isoform/IsoModalViewManager.kt +70 -0
  35. package/android/src/pdf/java/com/isoform/IsoPdfDocument.kt +157 -0
  36. package/android/src/pdf/java/com/isoform/IsoPdfEngine.kt +161 -0
  37. package/android/src/pdf/java/com/isoform/IsoPdfIcons.kt +76 -0
  38. package/android/src/pdf/java/com/isoform/IsoPdfReader.kt +176 -0
  39. package/android/src/pdf/java/com/isoform/IsoPdfView.kt +372 -0
  40. package/android/src/pdf/java/com/isoform/IsoPdfViewManager.kt +100 -0
  41. package/android/src/pdf/java/com/isoform/IsoPdfViewer.kt +849 -0
  42. package/android/src/sheet/java/com/isoform/IsoSheet.kt +247 -0
  43. package/android/src/sheet/java/com/isoform/IsoSheetView.kt +188 -0
  44. package/android/src/sheet/java/com/isoform/IsoSheetViewManager.kt +76 -0
  45. package/android/src/video/java/com/isoform/IsoVideoControls.kt +921 -0
  46. package/android/src/video/java/com/isoform/IsoVideoPlaylistPanel.kt +247 -0
  47. package/android/src/video/java/com/isoform/IsoVideoView.kt +324 -0
  48. package/android/src/video/java/com/isoform/IsoVideoViewManager.kt +84 -0
  49. package/babel.js +133 -0
  50. package/dist/adapters/react-dom/adapter.d.ts +3 -0
  51. package/dist/adapters/react-dom/adapter.js +108 -0
  52. package/dist/adapters/react-dom/camera/CameraElement.d.ts +15 -0
  53. package/dist/adapters/react-dom/camera/CameraElement.js +293 -0
  54. package/dist/adapters/react-dom/camera/LazyCamera.d.ts +4 -0
  55. package/dist/adapters/react-dom/camera/LazyCamera.js +21 -0
  56. package/dist/adapters/react-dom/camera/webCamera.d.ts +27 -0
  57. package/dist/adapters/react-dom/camera/webCamera.js +51 -0
  58. package/dist/adapters/react-dom/css/sheet.d.ts +43 -0
  59. package/dist/adapters/react-dom/css/sheet.js +183 -0
  60. package/dist/adapters/react-dom/datePicker/DatePicker.d.ts +19 -0
  61. package/dist/adapters/react-dom/datePicker/DatePicker.js +31 -0
  62. package/dist/adapters/react-dom/image/Image.d.ts +23 -0
  63. package/dist/adapters/react-dom/image/Image.js +256 -0
  64. package/dist/adapters/react-dom/media/audio/AudioControls.d.ts +44 -0
  65. package/dist/adapters/react-dom/media/audio/AudioControls.js +53 -0
  66. package/dist/adapters/react-dom/media/audio/AudioElement.d.ts +18 -0
  67. package/dist/adapters/react-dom/media/audio/AudioElement.js +139 -0
  68. package/dist/adapters/react-dom/media/audio/LazyAudio.d.ts +3 -0
  69. package/dist/adapters/react-dom/media/audio/LazyAudio.js +22 -0
  70. package/dist/adapters/react-dom/media/audio/audioStyles.d.ts +3 -0
  71. package/dist/adapters/react-dom/media/audio/audioStyles.js +52 -0
  72. package/dist/adapters/react-dom/media/index.d.ts +4 -0
  73. package/dist/adapters/react-dom/media/index.js +10 -0
  74. package/dist/adapters/react-dom/media/pdf/LazyPdf.d.ts +4 -0
  75. package/dist/adapters/react-dom/media/pdf/LazyPdf.js +22 -0
  76. package/dist/adapters/react-dom/media/pdf/PdfElement.d.ts +20 -0
  77. package/dist/adapters/react-dom/media/pdf/PdfElement.js +622 -0
  78. package/dist/adapters/react-dom/media/pdf/PdfPage.d.ts +31 -0
  79. package/dist/adapters/react-dom/media/pdf/PdfPage.js +154 -0
  80. package/dist/adapters/react-dom/media/pdf/PdfThumbnails.d.ts +12 -0
  81. package/dist/adapters/react-dom/media/pdf/PdfThumbnails.js +56 -0
  82. package/dist/adapters/react-dom/media/pdf/PdfToolbar.d.ts +82 -0
  83. package/dist/adapters/react-dom/media/pdf/PdfToolbar.js +92 -0
  84. package/dist/adapters/react-dom/media/pdf/pdfDocument.d.ts +90 -0
  85. package/dist/adapters/react-dom/media/pdf/pdfDocument.js +118 -0
  86. package/dist/adapters/react-dom/media/pdf/pdfStyles.d.ts +3 -0
  87. package/dist/adapters/react-dom/media/pdf/pdfStyles.js +107 -0
  88. package/dist/adapters/react-dom/media/pdf/pdfjs.d.ts +12 -0
  89. package/dist/adapters/react-dom/media/pdf/pdfjs.js +31 -0
  90. package/dist/adapters/react-dom/media/pdf/readAloud.d.ts +27 -0
  91. package/dist/adapters/react-dom/media/pdf/readAloud.js +136 -0
  92. package/dist/adapters/react-dom/media/pdf/search.d.ts +48 -0
  93. package/dist/adapters/react-dom/media/pdf/search.js +57 -0
  94. package/dist/adapters/react-dom/media/shared/Playlist.d.ts +21 -0
  95. package/dist/adapters/react-dom/media/shared/Playlist.js +240 -0
  96. package/dist/adapters/react-dom/media/shared/Track.d.ts +21 -0
  97. package/dist/adapters/react-dom/media/shared/Track.js +47 -0
  98. package/dist/adapters/react-dom/media/shared/controlStyles.d.ts +3 -0
  99. package/dist/adapters/react-dom/media/shared/controlStyles.js +46 -0
  100. package/dist/adapters/react-dom/media/shared/helpers.d.ts +22 -0
  101. package/dist/adapters/react-dom/media/shared/helpers.js +46 -0
  102. package/dist/adapters/react-dom/media/shared/icons.d.ts +49 -0
  103. package/dist/adapters/react-dom/media/shared/icons.js +52 -0
  104. package/dist/adapters/react-dom/media/shared/playlistHandle.d.ts +13 -0
  105. package/dist/adapters/react-dom/media/shared/playlistHandle.js +17 -0
  106. package/dist/adapters/react-dom/media/shared/withPlaylist.d.ts +4 -0
  107. package/dist/adapters/react-dom/media/shared/withPlaylist.js +24 -0
  108. package/dist/adapters/react-dom/media/video/LazyVideo.d.ts +4 -0
  109. package/dist/adapters/react-dom/media/video/LazyVideo.js +22 -0
  110. package/dist/adapters/react-dom/media/video/VideoControls.d.ts +43 -0
  111. package/dist/adapters/react-dom/media/video/VideoControls.js +89 -0
  112. package/dist/adapters/react-dom/media/video/VideoElement.d.ts +19 -0
  113. package/dist/adapters/react-dom/media/video/VideoElement.js +161 -0
  114. package/dist/adapters/react-dom/media/video/fullscreen.d.ts +17 -0
  115. package/dist/adapters/react-dom/media/video/fullscreen.js +43 -0
  116. package/dist/adapters/react-dom/media/video/pictureInPicture.d.ts +11 -0
  117. package/dist/adapters/react-dom/media/video/pictureInPicture.js +34 -0
  118. package/dist/adapters/react-dom/media/video/videoStyles.d.ts +3 -0
  119. package/dist/adapters/react-dom/media/video/videoStyles.js +49 -0
  120. package/dist/adapters/react-dom/modal/LazyModal.d.ts +8 -0
  121. package/dist/adapters/react-dom/modal/LazyModal.js +22 -0
  122. package/dist/adapters/react-dom/modal/Modal.d.ts +16 -0
  123. package/dist/adapters/react-dom/modal/Modal.js +101 -0
  124. package/dist/adapters/react-dom/normalize/domProps.d.ts +9 -0
  125. package/dist/adapters/react-dom/normalize/domProps.js +279 -0
  126. package/dist/adapters/react-dom/normalize/props.d.ts +5 -0
  127. package/dist/adapters/react-dom/normalize/props.js +258 -0
  128. package/dist/adapters/react-dom/normalize/style.d.ts +14 -0
  129. package/dist/adapters/react-dom/normalize/style.js +165 -0
  130. package/dist/adapters/react-dom/primitives.d.ts +6 -0
  131. package/dist/adapters/react-dom/primitives.js +37 -0
  132. package/dist/adapters/react-dom/sheet/LazySheet.d.ts +7 -0
  133. package/dist/adapters/react-dom/sheet/LazySheet.js +26 -0
  134. package/dist/adapters/react-dom/sheet/SheetElement.d.ts +17 -0
  135. package/dist/adapters/react-dom/sheet/SheetElement.js +223 -0
  136. package/dist/adapters/react-dom/sheet/sheetStyles.d.ts +3 -0
  137. package/dist/adapters/react-dom/sheet/sheetStyles.js +36 -0
  138. package/dist/adapters/react-dom/svg/elements.d.ts +5 -0
  139. package/dist/adapters/react-dom/svg/elements.js +32 -0
  140. package/dist/adapters/react-dom/themeToggle.bench.d.ts +2 -0
  141. package/dist/adapters/react-dom/themeToggle.bench.js +111 -0
  142. package/dist/adapters/react-native/adapter.d.ts +24 -0
  143. package/dist/adapters/react-native/adapter.js +356 -0
  144. package/dist/adapters/react-native/animatedHost.d.ts +21 -0
  145. package/dist/adapters/react-native/animatedHost.js +84 -0
  146. package/dist/adapters/react-native/animation.d.ts +63 -0
  147. package/dist/adapters/react-native/animation.js +340 -0
  148. package/dist/adapters/react-native/breakpoint.bench.d.ts +2 -0
  149. package/dist/adapters/react-native/breakpoint.bench.js +112 -0
  150. package/dist/adapters/react-native/camera/Camera.d.ts +12 -0
  151. package/dist/adapters/react-native/camera/Camera.disabled.d.ts +8 -0
  152. package/dist/adapters/react-native/camera/Camera.disabled.js +14 -0
  153. package/dist/adapters/react-native/camera/Camera.js +103 -0
  154. package/dist/adapters/react-native/camera/native/IsoCameraViewNativeComponent.d.ts +83 -0
  155. package/dist/adapters/react-native/camera/native/IsoCameraViewNativeComponent.js +6 -0
  156. package/dist/adapters/react-native/datePicker/DatePicker.d.ts +16 -0
  157. package/dist/adapters/react-native/datePicker/DatePicker.disabled.d.ts +10 -0
  158. package/dist/adapters/react-native/datePicker/DatePicker.disabled.js +13 -0
  159. package/dist/adapters/react-native/datePicker/DatePicker.js +43 -0
  160. package/dist/adapters/react-native/datePicker/native/IsoDatePickerViewNativeComponent.d.ts +35 -0
  161. package/dist/adapters/react-native/datePicker/native/IsoDatePickerViewNativeComponent.js +13 -0
  162. package/dist/adapters/react-native/image/Image.d.ts +26 -0
  163. package/dist/adapters/react-native/image/Image.disabled.d.ts +7 -0
  164. package/dist/adapters/react-native/image/Image.disabled.js +7 -0
  165. package/dist/adapters/react-native/image/Image.js +56 -0
  166. package/dist/adapters/react-native/image/PlainImage.d.ts +18 -0
  167. package/dist/adapters/react-native/image/PlainImage.js +18 -0
  168. package/dist/adapters/react-native/image/imageCache.d.ts +4 -0
  169. package/dist/adapters/react-native/image/imageCache.js +17 -0
  170. package/dist/adapters/react-native/image/native/IsoImageViewNativeComponent.d.ts +86 -0
  171. package/dist/adapters/react-native/image/native/IsoImageViewNativeComponent.js +14 -0
  172. package/dist/adapters/react-native/image/native/NativeIsoImageModule.d.ts +17 -0
  173. package/dist/adapters/react-native/image/native/NativeIsoImageModule.js +9 -0
  174. package/dist/adapters/react-native/media/audio/Audio.d.ts +19 -0
  175. package/dist/adapters/react-native/media/audio/Audio.disabled.d.ts +8 -0
  176. package/dist/adapters/react-native/media/audio/Audio.disabled.js +16 -0
  177. package/dist/adapters/react-native/media/audio/Audio.js +40 -0
  178. package/dist/adapters/react-native/media/audio/native/IsoAudioViewNativeComponent.d.ts +77 -0
  179. package/dist/adapters/react-native/media/audio/native/IsoAudioViewNativeComponent.js +6 -0
  180. package/dist/adapters/react-native/media/index.d.ts +4 -0
  181. package/dist/adapters/react-native/media/index.js +9 -0
  182. package/dist/adapters/react-native/media/pdf/Pdf.d.ts +19 -0
  183. package/dist/adapters/react-native/media/pdf/Pdf.disabled.d.ts +9 -0
  184. package/dist/adapters/react-native/media/pdf/Pdf.disabled.js +16 -0
  185. package/dist/adapters/react-native/media/pdf/Pdf.js +46 -0
  186. package/dist/adapters/react-native/media/pdf/native/IsoPdfViewNativeComponent.d.ts +77 -0
  187. package/dist/adapters/react-native/media/pdf/native/IsoPdfViewNativeComponent.js +6 -0
  188. package/dist/adapters/react-native/media/shared/Playlist.d.ts +18 -0
  189. package/dist/adapters/react-native/media/shared/Playlist.js +242 -0
  190. package/dist/adapters/react-native/media/video/Video.d.ts +25 -0
  191. package/dist/adapters/react-native/media/video/Video.disabled.d.ts +9 -0
  192. package/dist/adapters/react-native/media/video/Video.disabled.js +16 -0
  193. package/dist/adapters/react-native/media/video/Video.js +46 -0
  194. package/dist/adapters/react-native/media/video/native/IsoVideoViewNativeComponent.d.ts +87 -0
  195. package/dist/adapters/react-native/media/video/native/IsoVideoViewNativeComponent.js +6 -0
  196. package/dist/adapters/react-native/miss.bench.d.ts +2 -0
  197. package/dist/adapters/react-native/miss.bench.js +78 -0
  198. package/dist/adapters/react-native/modal/Modal.d.ts +18 -0
  199. package/dist/adapters/react-native/modal/Modal.disabled.d.ts +7 -0
  200. package/dist/adapters/react-native/modal/Modal.disabled.js +7 -0
  201. package/dist/adapters/react-native/modal/Modal.js +71 -0
  202. package/dist/adapters/react-native/modal/PlainModal.d.ts +16 -0
  203. package/dist/adapters/react-native/modal/PlainModal.js +26 -0
  204. package/dist/adapters/react-native/modal/native/IsoModalViewNativeComponent.d.ts +35 -0
  205. package/dist/adapters/react-native/modal/native/IsoModalViewNativeComponent.js +14 -0
  206. package/dist/adapters/react-native/normalize.d.ts +13 -0
  207. package/dist/adapters/react-native/normalize.js +221 -0
  208. package/dist/adapters/react-native/pseudo.d.ts +27 -0
  209. package/dist/adapters/react-native/pseudo.js +39 -0
  210. package/dist/adapters/react-native/sheet/BottomSheet.d.ts +12 -0
  211. package/dist/adapters/react-native/sheet/BottomSheet.disabled.d.ts +8 -0
  212. package/dist/adapters/react-native/sheet/BottomSheet.disabled.js +14 -0
  213. package/dist/adapters/react-native/sheet/BottomSheet.js +89 -0
  214. package/dist/adapters/react-native/sheet/native/IsoSheetViewNativeComponent.d.ts +40 -0
  215. package/dist/adapters/react-native/sheet/native/IsoSheetViewNativeComponent.js +14 -0
  216. package/dist/adapters/react-native/styleHost.d.ts +21 -0
  217. package/dist/adapters/react-native/styleHost.js +72 -0
  218. package/dist/adapters/react-native/svg/Svg.d.ts +5 -0
  219. package/dist/adapters/react-native/svg/Svg.disabled.d.ts +5 -0
  220. package/dist/adapters/react-native/svg/Svg.disabled.js +18 -0
  221. package/dist/adapters/react-native/svg/Svg.js +60 -0
  222. package/dist/adapters/react-native/transition.d.ts +41 -0
  223. package/dist/adapters/react-native/transition.js +145 -0
  224. package/dist/adapters/react-native/transitionHost.d.ts +11 -0
  225. package/dist/adapters/react-native/transitionHost.js +147 -0
  226. package/dist/adapters/react-native/windowWidth.d.ts +15 -0
  227. package/dist/adapters/react-native/windowWidth.js +49 -0
  228. package/dist/cache/lru.d.ts +11 -0
  229. package/dist/cache/lru.js +32 -0
  230. package/dist/config/index.d.ts +239 -0
  231. package/dist/config/index.js +161 -0
  232. package/dist/core/adapter.d.ts +72 -0
  233. package/dist/core/adapter.js +2 -0
  234. package/dist/core/builder.d.ts +95 -0
  235. package/dist/core/builder.js +431 -0
  236. package/dist/core/camera.d.ts +142 -0
  237. package/dist/core/camera.js +43 -0
  238. package/dist/core/cameraRequests.d.ts +18 -0
  239. package/dist/core/cameraRequests.js +44 -0
  240. package/dist/core/conditions.d.ts +54 -0
  241. package/dist/core/conditions.js +123 -0
  242. package/dist/core/datePicker.d.ts +92 -0
  243. package/dist/core/datePicker.js +92 -0
  244. package/dist/core/dev.d.ts +5 -0
  245. package/dist/core/dev.js +18 -0
  246. package/dist/core/engine.d.ts +62 -0
  247. package/dist/core/engine.js +26 -0
  248. package/dist/core/flatten.d.ts +6 -0
  249. package/dist/core/flatten.js +22 -0
  250. package/dist/core/image.d.ts +246 -0
  251. package/dist/core/image.js +171 -0
  252. package/dist/core/inline.d.ts +33 -0
  253. package/dist/core/inline.js +25 -0
  254. package/dist/core/keyframes.d.ts +40 -0
  255. package/dist/core/keyframes.js +38 -0
  256. package/dist/core/media.d.ts +118 -0
  257. package/dist/core/media.js +2 -0
  258. package/dist/core/modal.d.ts +76 -0
  259. package/dist/core/modal.js +35 -0
  260. package/dist/core/modules.d.ts +7 -0
  261. package/dist/core/modules.js +9 -0
  262. package/dist/core/pdf.d.ts +133 -0
  263. package/dist/core/pdf.js +2 -0
  264. package/dist/core/playlist.d.ts +97 -0
  265. package/dist/core/playlist.js +58 -0
  266. package/dist/core/primitives.d.ts +410 -0
  267. package/dist/core/primitives.js +2 -0
  268. package/dist/core/proxy.d.ts +2 -0
  269. package/dist/core/proxy.js +25 -0
  270. package/dist/core/sheet.d.ts +95 -0
  271. package/dist/core/sheet.js +71 -0
  272. package/dist/core/style/types.d.ts +88 -0
  273. package/dist/core/style/types.js +2 -0
  274. package/dist/core/svg.d.ts +121 -0
  275. package/dist/core/svg.js +76 -0
  276. package/dist/core/testing/benchHarness.d.ts +42 -0
  277. package/dist/core/testing/benchHarness.js +75 -0
  278. package/dist/core/types.d.ts +222 -0
  279. package/dist/core/types.js +2 -0
  280. package/dist/hash/optimizedHash.d.ts +10 -0
  281. package/dist/hash/optimizedHash.js +63 -0
  282. package/dist/hash/stringHash.d.ts +6 -0
  283. package/dist/hash/stringHash.js +17 -0
  284. package/dist/hash/trackReads.d.ts +20 -0
  285. package/dist/hash/trackReads.js +49 -0
  286. package/dist/index.d.ts +31 -0
  287. package/dist/index.js +21 -0
  288. package/dist/jsx-dev-runtime.d.ts +7 -0
  289. package/dist/jsx-dev-runtime.js +13 -0
  290. package/dist/jsx-runtime.d.ts +19 -0
  291. package/dist/jsx-runtime.js +25 -0
  292. package/dist/providers/index.d.ts +2 -0
  293. package/dist/providers/index.js +5 -0
  294. package/dist/providers/index.native.d.ts +2 -0
  295. package/dist/providers/index.native.js +5 -0
  296. package/dist/theme/index.d.ts +46 -0
  297. package/dist/theme/index.js +51 -0
  298. package/dist/theme/store/helpers.d.ts +50 -0
  299. package/dist/theme/store/helpers.js +116 -0
  300. package/dist/theme/store/index.d.ts +196 -0
  301. package/dist/theme/store/index.js +259 -0
  302. package/dist/theme/variables.d.ts +23 -0
  303. package/dist/theme/variables.js +127 -0
  304. package/ios/audio/IsoAudioCard.swift +471 -0
  305. package/ios/audio/IsoAudioPlayer.swift +326 -0
  306. package/ios/audio/IsoAudioView.mm +173 -0
  307. package/ios/camera/IsoCamera.swift +682 -0
  308. package/ios/camera/IsoCameraView.mm +206 -0
  309. package/ios/datePicker/IsoDatePicker.swift +826 -0
  310. package/ios/datePicker/IsoDatePickerView.mm +118 -0
  311. package/ios/datePicker/IsoWheelView.swift +190 -0
  312. package/ios/image/IsoImage.swift +568 -0
  313. package/ios/image/IsoImageModule.mm +45 -0
  314. package/ios/image/IsoImagePipeline.swift +612 -0
  315. package/ios/image/IsoImageView.mm +173 -0
  316. package/ios/mediaSession/IsoNowPlaying.swift +150 -0
  317. package/ios/mediaSessionOff/IsoNowPlaying.swift +18 -0
  318. package/ios/modal/IsoModal.swift +301 -0
  319. package/ios/modal/IsoModalView.mm +132 -0
  320. package/ios/pdf/IsoPdfSupport.swift +247 -0
  321. package/ios/pdf/IsoPdfToolbar.swift +403 -0
  322. package/ios/pdf/IsoPdfView.mm +194 -0
  323. package/ios/pdf/IsoPdfViewer.swift +547 -0
  324. package/ios/shared/IsoAudioSession.swift +42 -0
  325. package/ios/sheet/IsoSheet.swift +259 -0
  326. package/ios/sheet/IsoSheetView.mm +143 -0
  327. package/ios/stubs/audio/IsoAudioViewStub.mm +32 -0
  328. package/ios/stubs/camera/IsoCameraViewStub.mm +32 -0
  329. package/ios/stubs/datePicker/IsoDatePickerViewStub.mm +32 -0
  330. package/ios/stubs/image/IsoImageViewStub.mm +62 -0
  331. package/ios/stubs/modal/IsoModalViewStub.mm +32 -0
  332. package/ios/stubs/pdf/IsoPdfViewStub.mm +32 -0
  333. package/ios/stubs/sheet/IsoSheetViewStub.mm +32 -0
  334. package/ios/stubs/video/IsoVideoViewStub.mm +32 -0
  335. package/ios/video/IsoVideoControls.swift +569 -0
  336. package/ios/video/IsoVideoFullscreen.swift +280 -0
  337. package/ios/video/IsoVideoPlayer.swift +421 -0
  338. package/ios/video/IsoVideoPlaylistPanel.swift +360 -0
  339. package/ios/video/IsoVideoView.mm +187 -0
  340. package/isoform.podspec +132 -0
  341. package/metro.js +81 -0
  342. package/package.json +180 -4
  343. package/react-native.config.js +12 -0
  344. package/scripts/setup-ios.js +85 -0
  345. package/src/adapters/react-native/camera/native/IsoCameraViewNativeComponent.ts +79 -0
  346. package/src/adapters/react-native/datePicker/native/IsoDatePickerViewNativeComponent.ts +44 -0
  347. package/src/adapters/react-native/image/native/IsoImageViewNativeComponent.ts +90 -0
  348. package/src/adapters/react-native/image/native/NativeIsoImageModule.ts +24 -0
  349. package/src/adapters/react-native/media/audio/native/IsoAudioViewNativeComponent.ts +69 -0
  350. package/src/adapters/react-native/media/pdf/native/IsoPdfViewNativeComponent.ts +71 -0
  351. package/src/adapters/react-native/media/video/native/IsoVideoViewNativeComponent.ts +74 -0
  352. package/src/adapters/react-native/modal/native/IsoModalViewNativeComponent.ts +47 -0
  353. package/src/adapters/react-native/sheet/native/IsoSheetViewNativeComponent.ts +50 -0
@@ -0,0 +1,118 @@
1
+ import type { AudioItem, MediaPlaylistProps, PlaylistHandle, VideoItem } from './playlist';
2
+ /**
3
+ * Contract of the `Video` and `Audio` primitives: the same on every platform.
4
+ * Web: the browser's `<video>` / `<audio>` with the lib's controls. Native: the lib's own
5
+ * native player (AVPlayer on iOS, Media3 ExoPlayer on Android), with no external dependencies.
6
+ */
7
+ /** Playback position, sent by `onTimeUpdate`. */
8
+ export interface MediaTime {
9
+ /** Current position, in seconds. */
10
+ currentTime: number;
11
+ /** Total duration, in seconds (`0` while unknown, and for live streams). */
12
+ duration: number;
13
+ }
14
+ /** Media metadata, sent by `onLoad` once it is known. */
15
+ export interface MediaInfo {
16
+ /** Total duration, in seconds (`0` while unknown, and for live streams). */
17
+ duration: number;
18
+ /** Natural width of the video, in pixels (`0` if not decoded yet). */
19
+ width: number;
20
+ /** Natural height of the video, in pixels (`0` if not decoded yet). */
21
+ height: number;
22
+ }
23
+ /** Imperative control shared by every media primitive (`Video` and `Audio`), plus list navigation. */
24
+ export interface MediaHandle extends PlaylistHandle {
25
+ /** Starts or resumes playback. */
26
+ play(): void;
27
+ /** Pauses playback, keeping the current position. */
28
+ pause(): void;
29
+ /** Jumps to `seconds` (clamped to the media's duration). Triggers `onSeek`. */
30
+ seekTo(seconds: number): void;
31
+ }
32
+ /** Imperative control of a `Video`, obtained through its `ref`. */
33
+ export interface VideoHandle extends MediaHandle {
34
+ /**
35
+ * Enters (`true`) or leaves (`false`) fullscreen. Triggers `onFullscreenChange`.
36
+ * iOS: presents a fullscreen player sharing the same playback; it cannot close
37
+ * a fullscreen that was opened by the native button.
38
+ */
39
+ setFullscreen(fullscreen: boolean): void;
40
+ }
41
+ /** Playback props shared by every media primitive (`Video` and `Audio`). */
42
+ export interface PlaybackProps {
43
+ /**
44
+ * Media URL: a file (`.mp4`, `.mp3`, `.webm`…) or an HLS stream (`.m3u8`). HLS on the web needs Safari.
45
+ * Give either `src` or an `items` list.
46
+ */
47
+ src?: string;
48
+ /** Starts playing as soon as the media is ready. Default `false`. Browsers only allow it when `muted`. */
49
+ autoPlay?: boolean;
50
+ /** Restarts from the beginning when the media ends. Default `false`. */
51
+ loop?: boolean;
52
+ /** Starts muted. Default `false`. The user can still unmute through the controls. */
53
+ muted?: boolean;
54
+ /** Playback speed: `1` = normal, `0.5` = half, `2` = double. Default `1`. */
55
+ rate?: number;
56
+ /** Volume, from `0` (silent) to `1` (full). Default `1`. */
57
+ volume?: number;
58
+ /** Called when playback starts or resumes. */
59
+ onPlay?: () => void;
60
+ /** Called when playback pauses (by the user, by `pause()` or by the system). */
61
+ onPause?: () => void;
62
+ /** Called when the media reaches the end (not called while `loop` is on). */
63
+ onEnded?: () => void;
64
+ /** Called with the position about 4 times per second while playing. */
65
+ onTimeUpdate?: (time: MediaTime) => void;
66
+ /** Called once the metadata is ready: duration and natural size. */
67
+ onLoad?: (info: MediaInfo) => void;
68
+ /** Called when the media fails to load or play, with a readable message. */
69
+ onError?: (message: string) => void;
70
+ /** Called when the position jumps (seek bar, ±10 s buttons or `seekTo`), with both positions in seconds. */
71
+ onSeek?: (seek: {
72
+ /** Position before the jump, in seconds. */
73
+ from: number;
74
+ /** Position after the jump, in seconds. */
75
+ to: number;
76
+ }) => void;
77
+ /** Called with `true` when playback stalls waiting for data, and `false` when it can continue. */
78
+ onBuffering?: (buffering: boolean) => void;
79
+ /** Called with how far the media has been downloaded, in seconds (at most every 0.5 s of new data). */
80
+ onBufferedChange?: (buffered: number) => void;
81
+ /** Called when the volume or the mute state changes (by the controls or by the props). */
82
+ onVolumeChange?: (volume: {
83
+ /** New volume, from `0` to `1`. */
84
+ volume: number;
85
+ /** Whether the media is now muted. */
86
+ muted: boolean;
87
+ }) => void;
88
+ /** Called with the new speed when it changes (by the speed menu or by the `rate` prop). */
89
+ onRateChange?: (rate: number) => void;
90
+ }
91
+ /** Props of the `Video` primitive (on top of {@link PlaybackProps}). */
92
+ export interface VideoOwnProps extends PlaybackProps, MediaPlaylistProps<VideoItem> {
93
+ /** Image URL shown before playback starts. */
94
+ poster?: string;
95
+ /** Shows the player controls (play/pause, seek bar, speed, fullscreen…). Default `true`. */
96
+ controls?: boolean;
97
+ /** Called with `true` when entering fullscreen and `false` when leaving it. */
98
+ onFullscreenChange?: (fullscreen: boolean) => void;
99
+ /**
100
+ * Called with `true` when entering picture-in-picture and `false` when leaving it.
101
+ * @platform web — picture-in-picture is not implemented on native yet.
102
+ */
103
+ onPictureInPictureChange?: (active: boolean) => void;
104
+ }
105
+ /** Imperative control of an `Audio`, obtained through its `ref`. Same as {@link MediaHandle}. */
106
+ export type AudioHandle = MediaHandle;
107
+ /** Props of the `Audio` primitive (on top of {@link PlaybackProps}). */
108
+ export interface AudioOwnProps extends PlaybackProps, MediaPlaylistProps<AudioItem> {
109
+ /** Shows the player controls (play/pause, ±10 s, seek bar, speed, mute). Default `true`. */
110
+ controls?: boolean;
111
+ /** Track title shown above the seek bar (e.g. the episode or song name). */
112
+ title?: string;
113
+ /** Artist, show or author shown under the title. */
114
+ artist?: string;
115
+ /** Cover image URL shown at the left of the player. */
116
+ artwork?: string;
117
+ }
118
+ //# sourceMappingURL=media.d.ts.map
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=media.js.map
@@ -0,0 +1,76 @@
1
+ /**
2
+ * `Modal` with the `modal` module on: the lib's own modal, the same design everywhere.
3
+ * iOS: UIKit (spring animations, VoiceOver focus trap, keyboard avoidance), over a
4
+ * transparent React Native `Modal` that owns the window (as on Android). Android: Jetpack Compose (scrim, spring, back button,
5
+ * keyboard insets). Web: a native `<dialog>` (top layer, focus trap, Escape).
6
+ * With the module off, `Modal` stays React Native's `Modal` (and is not drawn on the web).
7
+ */
8
+ /**
9
+ * How the modal is laid out.
10
+ * - `'dialog'`: a card centered over a dimmed backdrop, as tall as its content. The default.
11
+ * - `'fullScreen'`: covers the whole screen; the content stays inside the safe area.
12
+ */
13
+ export type ModalPresentation = 'dialog' | 'fullScreen';
14
+ /**
15
+ * How it comes in and goes out.
16
+ * - `'scale'`: grows from 92% while fading in (default of `'dialog'`).
17
+ * - `'slide'`: comes up from the bottom edge (default of `'fullScreen'`).
18
+ * - `'fade'`: fades in place.
19
+ * - `'none'`: no animation.
20
+ */
21
+ export type ModalAnimation = 'scale' | 'slide' | 'fade' | 'none';
22
+ /** Props of `Modal` besides the common ones (`style`, `testID`…). */
23
+ export interface ModalOwnProps {
24
+ /** Shown (`true`) or hidden (`false`). It animates in both directions. */
25
+ open?: boolean;
26
+ /**
27
+ * Called when the user closes it (tap on the backdrop, back button on Android, Escape on
28
+ * the web, the VoiceOver escape gesture on iOS). Set your `open` state to the value.
29
+ */
30
+ onOpenChange?: (open: boolean) => void;
31
+ /** Layout: `'dialog'` (centered card) or `'fullScreen'`. Default `'dialog'`. */
32
+ presentation?: ModalPresentation;
33
+ /** Enter and exit animation. Default `'scale'` for a dialog, `'slide'` for full screen. */
34
+ animation?: ModalAnimation;
35
+ /** Whether the user can close it (backdrop, back button, Escape). Default `true`. */
36
+ dismissible?: boolean;
37
+ /** Color of the backdrop behind a dialog. Default `'rgba(0,0,0,0.4)'`. */
38
+ backdropColor?: string;
39
+ /** Called after the closing animation ends (the content is then unmounted). */
40
+ onClosed?: () => void;
41
+ /** Accessible name (`aria-label` on the web). */
42
+ label?: string;
43
+ /** The content. Its box takes the card's padding and layout from `style`. */
44
+ children?: unknown;
45
+ /** @deprecated Use `open`. React Native `Modal`'s name for it. */
46
+ visible?: boolean;
47
+ /** @deprecated Use `onOpenChange`. Called with no argument when the user closes it. */
48
+ onRequestClose?: () => void;
49
+ /** @deprecated Use `animation` (`'slide'` and `'fade'` keep their meaning). */
50
+ animationType?: 'none' | 'slide' | 'fade';
51
+ }
52
+ /** Space kept around a dialog, in points. */
53
+ export declare const DIALOG_MARGIN = 24;
54
+ /** Default widest dialog, in points (a `width` or `maxWidth` in the style changes it). */
55
+ export declare const DIALOG_MAX_WIDTH = 420;
56
+ /** Default dialog corner radius, in points. */
57
+ export declare const DIALOG_RADIUS = 20;
58
+ /** Default backdrop color. */
59
+ export declare const DEFAULT_BACKDROP = "rgba(0,0,0,0.4)";
60
+ /** Enter/exit duration on the web, in ms (native uses springs of about the same length). */
61
+ export declare const MODAL_DURATION = 280;
62
+ /** The animation used when none is given. */
63
+ export declare const defaultModalAnimation: (presentation?: ModalPresentation) => ModalAnimation;
64
+ /** The props in their current names (`open`, `onOpenChange`, `animation`), with the old React Native names as fallbacks. */
65
+ export declare function modalProps(props: ModalOwnProps): {
66
+ open: boolean;
67
+ onOpenChange?: (open: boolean) => void;
68
+ animation: ModalAnimation;
69
+ };
70
+ /**
71
+ * Width of a dialog card, in points.
72
+ * @param screen Width of the screen.
73
+ * @param wanted `width` or `maxWidth` from the style, if any.
74
+ */
75
+ export declare const dialogWidth: (screen: number, wanted?: number) => number;
76
+ //# sourceMappingURL=modal.d.ts.map
@@ -0,0 +1,35 @@
1
+ /**
2
+ * `Modal` with the `modal` module on: the lib's own modal, the same design everywhere.
3
+ * iOS: UIKit (spring animations, VoiceOver focus trap, keyboard avoidance), over a
4
+ * transparent React Native `Modal` that owns the window (as on Android). Android: Jetpack Compose (scrim, spring, back button,
5
+ * keyboard insets). Web: a native `<dialog>` (top layer, focus trap, Escape).
6
+ * With the module off, `Modal` stays React Native's `Modal` (and is not drawn on the web).
7
+ */
8
+ /** Space kept around a dialog, in points. */
9
+ export const DIALOG_MARGIN = 24;
10
+ /** Default widest dialog, in points (a `width` or `maxWidth` in the style changes it). */
11
+ export const DIALOG_MAX_WIDTH = 420;
12
+ /** Default dialog corner radius, in points. */
13
+ export const DIALOG_RADIUS = 20;
14
+ /** Default backdrop color. */
15
+ export const DEFAULT_BACKDROP = 'rgba(0,0,0,0.4)';
16
+ /** Enter/exit duration on the web, in ms (native uses springs of about the same length). */
17
+ export const MODAL_DURATION = 280;
18
+ /** The animation used when none is given. */
19
+ export const defaultModalAnimation = (presentation = 'dialog') => presentation === 'fullScreen' ? 'slide' : 'scale';
20
+ /** The props in their current names (`open`, `onOpenChange`, `animation`), with the old React Native names as fallbacks. */
21
+ export function modalProps(props) {
22
+ const { open, visible, onOpenChange, onRequestClose, animation, animationType, presentation } = props;
23
+ return {
24
+ open: Boolean(open ?? visible),
25
+ onOpenChange: onOpenChange ?? (onRequestClose ? () => onRequestClose() : undefined),
26
+ animation: animation ?? animationType ?? defaultModalAnimation(presentation),
27
+ };
28
+ }
29
+ /**
30
+ * Width of a dialog card, in points.
31
+ * @param screen Width of the screen.
32
+ * @param wanted `width` or `maxWidth` from the style, if any.
33
+ */
34
+ export const dialogWidth = (screen, wanted) => Math.max(0, Math.min(screen - 2 * DIALOG_MARGIN, wanted ?? DIALOG_MAX_WIDTH));
35
+ //# sourceMappingURL=modal.js.map
@@ -0,0 +1,7 @@
1
+ import type { ModuleName } from '../config';
2
+ /**
3
+ * Aviso de dev quando um módulo desligado é usado. O componente não quebra:
4
+ * renderiza um espaço vazio com o mesmo estilo (o layout não pula).
5
+ */
6
+ export declare function warnModuleDisabled(name: ModuleName): void;
7
+ //# sourceMappingURL=modules.d.ts.map
@@ -0,0 +1,9 @@
1
+ import { warnOnce } from './dev';
2
+ /**
3
+ * Aviso de dev quando um módulo desligado é usado. O componente não quebra:
4
+ * renderiza um espaço vazio com o mesmo estilo (o layout não pula).
5
+ */
6
+ export function warnModuleDisabled(name) {
7
+ warnOnce(`module-off:${name}`, `ISO009: module "${name}" is off. Turn it on with configure({ modules: { ${name}: true } }).`);
8
+ }
9
+ //# sourceMappingURL=modules.js.map
@@ -0,0 +1,133 @@
1
+ import type { PdfItem, PlaylistHandle, PlaylistProps } from './playlist';
2
+ /**
3
+ * Contract of the `Pdf` primitive: the same on every platform.
4
+ * · Web: Mozilla pdf.js (`pdfjs-dist`), loaded on demand, with the lib's toolbar.
5
+ * · iOS: Apple PDFKit (`PDFView`) with a UIKit toolbar.
6
+ * · Android: the system `PdfRenderer` with a Jetpack Compose viewer.
7
+ *
8
+ * Features by platform:
9
+ *
10
+ * | Feature | Web | iOS | Android 15+ / 12+ updated | Older Android |
11
+ * |------------------------------------------|-----|-----|---------------------------|---------------|
12
+ * | Pages, scroll, pinch/double-tap zoom | ✓ | ✓ | ✓ | ✓ |
13
+ * | Page counter and "go to page" | ✓ | ✓ | ✓ | ✓ |
14
+ * | Thumbnails | ✓ | ✓ | ✓ | ✓ |
15
+ * | Night mode | ✓ | ✓ | ✓ | ✓ |
16
+ * | Fullscreen | ✓ | ✓ | ✓ | ✓ |
17
+ * | Search with highlighted matches | ✓ | ✓ | ✓ | – |
18
+ * | Read aloud (text to speech) | ✓ | ✓ | ✓ | – |
19
+ * | Links (pages and URLs) | ✓ | ✓ | ✓ | – |
20
+ * | Password-protected files | ✓ | ✓ | ✓ | – |
21
+ * | Text selection and copy | ✓ | ✓ | – | – |
22
+ * | Table of contents (outline) | ✓ | ✓ | – | – |
23
+ * | Share / download / print | ✓ | ✓ | – | – |
24
+ *
25
+ * Read aloud follows the text with a highlight on the web and iOS; on Android it
26
+ * reads and turns the pages.
27
+ *
28
+ * "Android 12+ updated" = Android 12–14 with the SDK extension 13 from Google
29
+ * Play system updates. Older devices get the basic viewer (the search button is hidden).
30
+ */
31
+ /** How a page is sized when the document opens (and when zoom is `1`). */
32
+ export type PdfFit = 'width' | 'page';
33
+ /** How pages follow each other: one under the other (`'vertical'`) or side by side, one per screen (`'horizontal'`). */
34
+ export type PdfDirection = 'vertical' | 'horizontal';
35
+ /** Document information, sent by `onLoad`. */
36
+ export interface PdfLoadInfo {
37
+ /** Number of pages of the document. */
38
+ pageCount: number;
39
+ }
40
+ /** Current page, sent by `onPageChange`. */
41
+ export interface PdfPageInfo {
42
+ /** Page most visible on screen, starting at `1`. */
43
+ page: number;
44
+ /** Number of pages of the document. */
45
+ pageCount: number;
46
+ }
47
+ /** Search state, sent by `onSearch` after each search and each move between matches. */
48
+ export interface PdfSearchInfo {
49
+ /** The text searched for (`''` after `clearSearch`). */
50
+ query: string;
51
+ /** How many matches the document has (`0` when none). */
52
+ total: number;
53
+ /** Which match is selected, starting at `1` (`0` when there are no matches). */
54
+ current: number;
55
+ }
56
+ /** Imperative control of a `Pdf`, obtained through its `ref`. */
57
+ export interface PdfHandle extends PlaylistHandle {
58
+ /** Scrolls to `page` (starting at `1`; clamped to the document). Triggers `onPageChange`. */
59
+ goToPage(page: number): void;
60
+ /**
61
+ * Finds every occurrence of `query` (case- and accent-insensitive), highlights
62
+ * them and scrolls to the first. Triggers `onSearch`. No-op on Android older than 12.
63
+ */
64
+ search(query: string): void;
65
+ /** Selects the next match (wraps to the first). Triggers `onSearch`. */
66
+ searchNext(): void;
67
+ /** Selects the previous match (wraps to the last). Triggers `onSearch`. */
68
+ searchPrevious(): void;
69
+ /** Removes the highlights and the search. Triggers `onSearch` with `query: ''`. */
70
+ clearSearch(): void;
71
+ /** Zooms to `scale`, where `1` is the `fit` size (clamped up to `maxZoom`; the web also allows down to `0.25`). */
72
+ setZoom(scale: number): void;
73
+ /** Shows the viewer over the whole screen (`true`) or back in its place (`false`). Triggers `onFullscreenChange`. */
74
+ setFullscreen(fullscreen: boolean): void;
75
+ /**
76
+ * Reads the document aloud with the system voice, from the page on screen to the end,
77
+ * turning the pages as it goes. Triggers `onReadAloudChange`. No-op on Android older than 12.
78
+ */
79
+ startReadAloud(): void;
80
+ /** Stops reading aloud. Triggers `onReadAloudChange`. */
81
+ stopReadAloud(): void;
82
+ }
83
+ /** Props of the `Pdf` primitive. */
84
+ export interface PdfOwnProps extends PlaylistProps<PdfItem> {
85
+ /** Document URL: `https://…`, `file://…` (native) or a same-origin/CORS-enabled URL (web). Give either `src` or an `items` list. */
86
+ src?: string;
87
+ /** Password of a protected document. Without it, the viewer asks the user (and calls `onPasswordRequired`). */
88
+ password?: string;
89
+ /** Page shown when the document opens, starting at `1`. Default `1`. */
90
+ initialPage?: number;
91
+ /** Shows the toolbar (page counter, thumbnails, search, menu). Default `true`. */
92
+ controls?: boolean;
93
+ /** Starts in night mode (inverted page colors). The user can switch it in the menu. Default `false`. */
94
+ nightMode?: boolean;
95
+ /** Page size at zoom `1`: the full width (`'width'`) or the whole page (`'page'`). Default `'width'`. */
96
+ fit?: PdfFit;
97
+ /** Largest zoom, as a multiple of the `fit` size. Default `5`. */
98
+ maxZoom?: number;
99
+ /**
100
+ * Pages one under the other (`'vertical'`) or side by side, turning like a book
101
+ * (`'horizontal'`; each page fits the screen). The user can switch it in the menu. Default `'vertical'`.
102
+ */
103
+ direction?: PdfDirection;
104
+ /**
105
+ * Language of the read-aloud voice, as a BCP 47 tag (`'pt-BR'`, `'en-US'`…).
106
+ * Default: the device language.
107
+ */
108
+ speechLanguage?: string;
109
+ /**
110
+ * Read-aloud voice, by the platform's own id: the voice `name` on the web
111
+ * (`speechSynthesis.getVoices()`), the `AVSpeechSynthesisVoice.identifier` on iOS
112
+ * and the `Voice.getName()` on Android. Default: the most natural voice installed
113
+ * for the language. The user can also pick one in the viewer's menu ("Voice").
114
+ */
115
+ speechVoice?: string;
116
+ /** Called once the document is open. */
117
+ onLoad?: (info: PdfLoadInfo) => void;
118
+ /** Called when the page most visible on screen changes. */
119
+ onPageChange?: (info: PdfPageInfo) => void;
120
+ /** Called after a search and after each move between matches. */
121
+ onSearch?: (info: PdfSearchInfo) => void;
122
+ /** Called when the document fails to download or open, with a readable message. */
123
+ onError?: (message: string) => void;
124
+ /** Called when the document needs a password (none given, or a wrong one). The viewer shows a password field. */
125
+ onPasswordRequired?: () => void;
126
+ /** Called when the user taps a link to a website, before it opens, with its URL. */
127
+ onLinkPress?: (url: string) => void;
128
+ /** Called with `true` when entering fullscreen and `false` when leaving it. */
129
+ onFullscreenChange?: (fullscreen: boolean) => void;
130
+ /** Called with `true` when reading aloud starts and `false` when it stops or reaches the end. */
131
+ onReadAloudChange?: (reading: boolean) => void;
132
+ }
133
+ //# sourceMappingURL=pdf.d.ts.map
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=pdf.js.map
@@ -0,0 +1,97 @@
1
+ /**
2
+ * Lists for `Video`, `Audio` and `Pdf`: instead of one `src`, an `items` list.
3
+ * A "playlist" button inside the player opens a carousel panel over it. The list logic lives
4
+ * here, once for every platform; each adapter only draws the strip. The component's
5
+ * style keeps going to the player; the carousel is added below it.
6
+ */
7
+ /** One entry of an `items` list. */
8
+ export interface PlaylistItem {
9
+ /** Address of the entry (same formats as the primitive's `src`). */
10
+ src: string;
11
+ /** Name shown in the carousel card (and, for `Audio`, in the player). */
12
+ title?: string;
13
+ }
14
+ /** An entry of a `Video` list. */
15
+ export interface VideoItem extends PlaylistItem {
16
+ /** Image shown before playback and in the carousel card. */
17
+ poster?: string;
18
+ }
19
+ /** An entry of an `Audio` list. */
20
+ export interface AudioItem extends PlaylistItem {
21
+ /** Artist, show or author (player and card). */
22
+ artist?: string;
23
+ /** Cover image (player and card). */
24
+ artwork?: string;
25
+ }
26
+ /** An entry of a `Pdf` list. */
27
+ export interface PdfItem extends PlaylistItem {
28
+ /** Image shown in the carousel card (for example, the first page). Without it, a document icon. */
29
+ thumbnail?: string;
30
+ }
31
+ /** What `onItemChange` receives. */
32
+ export interface PlaylistChange<Item extends PlaylistItem = PlaylistItem> {
33
+ /** Position of the new entry in `items`, from `0`. */
34
+ index: number;
35
+ /** The new entry. */
36
+ item: Item;
37
+ }
38
+ /** Props shared by every primitive that accepts a list. */
39
+ export interface PlaylistProps<Item extends PlaylistItem> {
40
+ /**
41
+ * A list to play or read one after the other. A button inside the player opens the carousel.
42
+ * When given (non-empty), `src` and the per-entry props (`poster`, `title`…) come from the current entry.
43
+ */
44
+ items?: Item[];
45
+ /** Entry shown first, from `0`. Default `0`. */
46
+ initialIndex?: number;
47
+ /** Shows the playlist button (which opens the carousel) inside the player when there is a list. Default `true`. */
48
+ carousel?: boolean;
49
+ /** Called when the current entry changes (carousel, `next()`/`previous()`/`goTo()` or the end of a video/audio). */
50
+ onItemChange?: (change: PlaylistChange<Item>) => void;
51
+ }
52
+ /** Props of lists that play (`Video`, `Audio`). */
53
+ export interface MediaPlaylistProps<Item extends PlaylistItem> extends PlaylistProps<Item> {
54
+ /** Goes to the next entry, and keeps playing, when one ends. Default `true`. */
55
+ autoAdvance?: boolean;
56
+ }
57
+ /** List control added to the `ref` of `Video`, `Audio` and `Pdf`. No-op without `items`. */
58
+ export interface PlaylistHandle {
59
+ /** Goes to the next entry (stops at the last one). */
60
+ next(): void;
61
+ /** Goes to the previous entry (stops at the first one). */
62
+ previous(): void;
63
+ /** Goes to the entry at `index` (from `0`; clamped to the list). */
64
+ goTo(index: number): void;
65
+ }
66
+ /** A player's own `ref` methods (the list ones are added by the playlist wrapper). */
67
+ export type WithoutPlaylist<Handle> = Omit<Handle, keyof PlaylistHandle>;
68
+ /** The current state of a list, for the adapters. */
69
+ export interface PlaylistState<Item extends PlaylistItem> {
70
+ /** Position of the current entry. */
71
+ index: number;
72
+ /** The current entry. */
73
+ item: Item;
74
+ /** Whether the entry was opened while playing (so the next one starts on its own). */
75
+ autoPlay: boolean;
76
+ goTo(index: number, autoPlay?: boolean): void;
77
+ next(autoPlay?: boolean): void;
78
+ previous(autoPlay?: boolean): void;
79
+ }
80
+ /**
81
+ * Index and navigation of an `items` list. `autoPlay` turns on when the user moves
82
+ * while something is playing (or a video/audio ends), so the next entry starts by itself.
83
+ */
84
+ export declare function usePlaylist<Item extends PlaylistItem>(items: Item[], initialIndex: number | undefined, onItemChange: ((change: PlaylistChange<Item>) => void) | undefined): PlaylistState<Item>;
85
+ /**
86
+ * Restarts the player when the new entry has the same address as the previous one
87
+ * (a list may repeat a file): the player would otherwise ignore the "change".
88
+ */
89
+ export declare function useRestartOnSameSource(items: PlaylistItem[], index: number, autoPlay: boolean, player: {
90
+ current: {
91
+ seekTo?(seconds: number): void;
92
+ play?(): void;
93
+ } | null;
94
+ }): void;
95
+ /** Which item fields become props of each primitive. */
96
+ export declare const ITEM_PROPS: Record<'Video' | 'Audio' | 'Pdf', (item: any) => Record<string, unknown>>;
97
+ //# sourceMappingURL=playlist.d.ts.map
@@ -0,0 +1,58 @@
1
+ import { useCallback, useEffect, useRef, useState } from 'react';
2
+ const clamp = (n, length) => Math.min(Math.max(0, Math.round(n)), Math.max(0, length - 1));
3
+ /**
4
+ * Index and navigation of an `items` list. `autoPlay` turns on when the user moves
5
+ * while something is playing (or a video/audio ends), so the next entry starts by itself.
6
+ */
7
+ export function usePlaylist(items, initialIndex, onItemChange) {
8
+ const [index, setIndex] = useState(() => clamp(initialIndex ?? 0, items.length));
9
+ const [autoPlay, setAutoPlay] = useState(false);
10
+ const latest = useRef({ items, onItemChange, index });
11
+ latest.current = { items, onItemChange, index };
12
+ // a shorter list keeps the index inside it
13
+ useEffect(() => setIndex((i) => clamp(i, items.length)), [items.length]);
14
+ const goTo = useCallback((target, play = false) => {
15
+ const { items: list, onItemChange: notify, index: current } = latest.current;
16
+ const next = clamp(target, list.length);
17
+ // choosing the entry that is already on (e.g. the carousel settling on it) changes nothing
18
+ if (next === current)
19
+ return;
20
+ setAutoPlay(play);
21
+ latest.current.index = next;
22
+ setIndex(next);
23
+ notify?.({ index: next, item: list[next] });
24
+ }, []);
25
+ return {
26
+ index,
27
+ item: items[clamp(index, items.length)],
28
+ autoPlay,
29
+ goTo,
30
+ next: useCallback((play = false) => goTo(latest.current.index + 1, play), [goTo]),
31
+ previous: useCallback((play = false) => goTo(latest.current.index - 1, play), [goTo]),
32
+ };
33
+ }
34
+ /**
35
+ * Restarts the player when the new entry has the same address as the previous one
36
+ * (a list may repeat a file): the player would otherwise ignore the "change".
37
+ */
38
+ export function useRestartOnSameSource(items, index, autoPlay, player) {
39
+ const previous = useRef({ index, src: items[index]?.src });
40
+ useEffect(() => {
41
+ const before = previous.current;
42
+ const src = items[index]?.src;
43
+ previous.current = { index, src };
44
+ if (before.index === index || before.src !== src)
45
+ return;
46
+ player.current?.seekTo?.(0);
47
+ if (autoPlay)
48
+ player.current?.play?.();
49
+ }, [items, index, autoPlay, player]);
50
+ }
51
+ /** Which item fields become props of each primitive. */
52
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
53
+ export const ITEM_PROPS = {
54
+ Video: (item) => ({ src: item.src, poster: item.poster }),
55
+ Audio: (item) => ({ src: item.src, title: item.title, artist: item.artist, artwork: item.artwork }),
56
+ Pdf: (item) => ({ src: item.src }),
57
+ };
58
+ //# sourceMappingURL=playlist.js.map