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,246 @@
1
+ /**
2
+ * How the picture fills its box (the CSS `object-fit` names).
3
+ * - `'cover'`: fills the box, keeping the aspect ratio; the overflow is cropped. The default.
4
+ * - `'contain'`: fits inside the box, keeping the aspect ratio (letterboxed).
5
+ * - `'fill'`: stretched to the box.
6
+ * - `'none'`: its own size, cropped by the box.
7
+ * - `'scale-down'`: like `'none'`, or `'contain'` when it is bigger than the box.
8
+ */
9
+ export type ImageContentFit = 'cover' | 'contain' | 'fill' | 'none' | 'scale-down';
10
+ /** Where the picture sits in its box when it does not fill it (CSS `object-position` keywords). */
11
+ export type ImageContentPosition = 'center' | 'top' | 'bottom' | 'left' | 'right' | 'top left' | 'top right' | 'bottom left' | 'bottom right';
12
+ /** A remote or local picture with options. */
13
+ export interface ImageSource {
14
+ /** `https://…`, `file://…`, `data:image/…;base64,…` (and `content://…` on Android). */
15
+ uri: string;
16
+ /** HTTP headers of the request (auth tokens…). Native only: the web cannot set headers on `<img>`. */
17
+ headers?: Record<string, string>;
18
+ /** Cache key instead of the URL: for signed URLs that change while the picture does not. Native only. */
19
+ cacheKey?: string;
20
+ }
21
+ /** What `src` and `placeholder` accept: a URL, a `require('./pic.png')` or an `ImageSource`. */
22
+ export type ImageSourceInput = string | number | ImageSource;
23
+ /**
24
+ * Which caches keep the picture. Native only (the browser owns its cache on the web).
25
+ * - `'memory-disk'` (default): both; the fastest on the next show, and offline.
26
+ * - `'memory'`: only while the app runs.
27
+ * - `'disk'`: only on disk (lighter on memory, for large lists).
28
+ * - `'none'`: always downloaded again.
29
+ */
30
+ export type ImageCachePolicy = 'memory-disk' | 'memory' | 'disk' | 'none';
31
+ /** Download order when many pictures load at once (`fetchpriority` on the web). */
32
+ export type ImagePriority = 'low' | 'normal' | 'high';
33
+ /** Where a loaded picture came from. */
34
+ export type ImageCacheType = 'memory' | 'disk' | 'none';
35
+ /** `onLoad` payload. */
36
+ export interface ImageLoadEvent {
37
+ /** Width of the picture in pixels (as decoded from the file). */
38
+ width: number;
39
+ /** Height of the picture in pixels. */
40
+ height: number;
41
+ /** `'memory'` or `'disk'` for a cache hit, `'none'` when it was downloaded (always `'none'` on the web). */
42
+ cacheType: ImageCacheType;
43
+ }
44
+ /** `onProgress` payload (native only). */
45
+ export interface ImageProgressEvent {
46
+ /** Bytes received so far. */
47
+ loaded: number;
48
+ /** Size of the file in bytes, or `0` when the server does not say. */
49
+ total: number;
50
+ }
51
+ /** `onError` payload. */
52
+ export interface ImageErrorEvent {
53
+ /** What went wrong (HTTP status, decoding…). */
54
+ message: string;
55
+ }
56
+ /** Props of `Image` added by the `image` module, besides `src`, `alt` and the common ones. */
57
+ export interface ImageOwnProps {
58
+ /** How the picture fills its box. Default `'cover'`. */
59
+ contentFit?: ImageContentFit;
60
+ /** Where the picture sits in its box. Default `'center'`. */
61
+ contentPosition?: ImageContentPosition;
62
+ /**
63
+ * Shown until the picture loads (and when it fails): usually a small local file or a
64
+ * thumbnail URL. Drawn with the same `contentFit`. `blurhash` wins when both are set.
65
+ */
66
+ placeholder?: ImageSourceInput;
67
+ /**
68
+ * A [blurhash](https://blurha.sh) of the picture: a blurred preview from a ~30 character
69
+ * string (keep it in your API next to the URL). Drawn as `cover`.
70
+ */
71
+ blurhash?: string;
72
+ /** Crossfade from the placeholder, in ms, when the picture was not in memory. `0` turns it off. Default `250`. */
73
+ transition?: number;
74
+ /** Paints every non-transparent pixel with this color (icons, monochrome logos). */
75
+ tintColor?: string;
76
+ /** Gaussian blur radius, in points. Default `0`. */
77
+ blurRadius?: number;
78
+ /** Which caches keep the picture. Default `'memory-disk'`. Native only. */
79
+ cachePolicy?: ImageCachePolicy;
80
+ /** Download order. Default `'normal'`. */
81
+ priority?: ImagePriority;
82
+ /** Plays animated GIF/WebP/APNG pictures. `false` shows the first frame. Default `true`. */
83
+ autoplay?: boolean;
84
+ /**
85
+ * Turns on the viewer gestures: pinch to zoom, drag while zoomed (it stays inside the
86
+ * box), double tap to zoom in and back out. Inside a scroll view the gestures win only
87
+ * while zoomed or with two fingers. Default `false`.
88
+ */
89
+ zoomable?: boolean;
90
+ /** Largest zoom. Default `4`. */
91
+ maxZoom?: number;
92
+ /** Zoom of a double tap. Default `2.5`. */
93
+ doubleTapZoom?: number;
94
+ /** With `zoomable`: two-finger rotation as well (it snaps to right angles). Default `false`. */
95
+ rotatable?: boolean;
96
+ /** Called when the zoom, the offset or the rotation change (by a gesture or through the `ref`). */
97
+ onZoomChange?: (event: ImageZoomEvent) => void;
98
+ /** The download started. */
99
+ onLoadStart?: () => void;
100
+ /** Bytes received while downloading. Native only. */
101
+ onProgress?: (event: ImageProgressEvent) => void;
102
+ /** The picture is on screen. */
103
+ onLoad?: (event: ImageLoadEvent) => void;
104
+ /** The picture could not be loaded or decoded (the placeholder stays). */
105
+ onError?: (event: ImageErrorEvent) => void;
106
+ }
107
+ /** `onZoomChange` payload. */
108
+ export interface ImageZoomEvent {
109
+ /** Zoom (`1` = the picture as `contentFit` draws it). */
110
+ scale: number;
111
+ /** Horizontal offset of the zoomed picture, in points. */
112
+ x: number;
113
+ /** Vertical offset of the zoomed picture, in points. */
114
+ y: number;
115
+ /** Rotation, in degrees (clockwise). */
116
+ rotation: number;
117
+ }
118
+ /** Options of `ImageHandle.zoomTo`. */
119
+ export interface ImageZoomOptions {
120
+ /** Point of the view (in points from its top-left corner) that stays still. Default: the center. */
121
+ focusX?: number;
122
+ /** Point of the view (in points from its top-left corner) that stays still. Default: the center. */
123
+ focusY?: number;
124
+ /** Animates the change. Default `true`. */
125
+ animated?: boolean;
126
+ }
127
+ /** `ref` of an `Image` (with the `image` module on). */
128
+ export interface ImageHandle {
129
+ /** Zooms to `scale` (clamped to `1…maxZoom`), keeping the focus point still. Works without `zoomable`. */
130
+ zoomTo(scale: number, options?: ImageZoomOptions): void;
131
+ /** Back to scale 1, centered, without rotation. */
132
+ resetZoom(animated?: boolean): void;
133
+ /** Rotates to `degrees` (clockwise). Works without `rotatable`. */
134
+ rotateTo(degrees: number, animated?: boolean): void;
135
+ /** Plays an animated picture. */
136
+ play(): void;
137
+ /** Pauses an animated picture on the current frame. */
138
+ pause(): void;
139
+ /** Loads the picture again, skipping the memory and disk caches. */
140
+ reload(): void;
141
+ }
142
+ /** Default largest zoom. */
143
+ export declare const DEFAULT_MAX_ZOOM = 4;
144
+ /** Default zoom of a double tap. */
145
+ export declare const DEFAULT_DOUBLE_TAP_ZOOM = 2.5;
146
+ /**
147
+ * Keeps a zoomed picture covering its box: the offset (from the centered position) is
148
+ * limited to the part of the picture that overflows. The native views use the same rule.
149
+ * @param offset Wanted offset on one axis, in points.
150
+ * @param box Size of the view on that axis.
151
+ * @param scale Current zoom.
152
+ */
153
+ export declare const clampOffset: (offset: number, box: number, scale: number) => number;
154
+ /** Zoom limited to `1…maxZoom`. */
155
+ export declare const clampZoom: (scale: number, maxZoom?: number) => number;
156
+ /**
157
+ * Offset that keeps the focus point still while the zoom goes from `from` to `to`
158
+ * (one axis; offsets are from the centered position, the focus from the view's center).
159
+ */
160
+ export declare const zoomOffset: (offset: number, focus: number, from: number, to: number) => number;
161
+ /** Options of `prefetchImages`. */
162
+ export interface PrefetchOptions {
163
+ /**
164
+ * Where the pictures are kept. Default `'disk'`: the files only, light on memory (they
165
+ * are decoded when shown). `'memory-disk'` and `'memory'` also decode them right away,
166
+ * at their full size, so they show without any wait. Native only.
167
+ */
168
+ cachePolicy?: Exclude<ImageCachePolicy, 'none'>;
169
+ /** HTTP headers of the requests. Native only. */
170
+ headers?: Record<string, string>;
171
+ }
172
+ /** Options of `clearImageCache`. */
173
+ export interface ClearImageCacheOptions {
174
+ /** Empties the memory cache. Default `true`. */
175
+ memory?: boolean;
176
+ /** Deletes the files of the disk cache. Default `true`. */
177
+ disk?: boolean;
178
+ }
179
+ /** What a platform does for `prefetchImages` and `clearImageCache` (`PlatformAdapter.images`). */
180
+ export interface ImageCacheApi {
181
+ /** Downloads the pictures into the cache. Resolves `true` when all of them loaded. */
182
+ prefetch(urls: string[], options: PrefetchOptions): Promise<boolean>;
183
+ /** Empties the caches. */
184
+ clear(options: Required<ClearImageCacheOptions>): Promise<void>;
185
+ }
186
+ /**
187
+ * Downloads pictures before they are shown (the next screen, the next page of a list),
188
+ * so they appear at once. Needs the `image` module.
189
+ * @param urls One URL or many.
190
+ * @returns `true` when every picture was cached, `false` otherwise (or with the module off).
191
+ */
192
+ export declare function prefetchImages(urls: string | string[], options?: PrefetchOptions): Promise<boolean>;
193
+ /**
194
+ * Empties the image caches (memory and disk by default). Needs the `image` module on
195
+ * native; does nothing on the web (the browser owns its cache).
196
+ */
197
+ export declare function clearImageCache(options?: ClearImageCacheOptions): Promise<void>;
198
+ /** Default crossfade, in ms. */
199
+ export declare const DEFAULT_TRANSITION = 250;
200
+ /** `contentFit` as the native views read it (`'scaleDown'`: no hyphen in a native enum). */
201
+ export type NativeContentFit = 'cover' | 'contain' | 'fill' | 'none' | 'scaleDown';
202
+ /** `contentFit` → the native views' name. */
203
+ export declare const nativeContentFit: (fit?: ImageContentFit) => NativeContentFit;
204
+ /** A position as fractions of the free space: `0` left/top, `0.5` center, `1` right/bottom. */
205
+ export interface PositionFractions {
206
+ x: number;
207
+ y: number;
208
+ }
209
+ /** `'top left'` → `{ x: 0, y: 0 }`; unknown words stay centered. */
210
+ export declare function positionFractions(position?: ImageContentPosition): PositionFractions;
211
+ /** A rectangle in points. */
212
+ export interface Rect {
213
+ x: number;
214
+ y: number;
215
+ width: number;
216
+ height: number;
217
+ }
218
+ /** A size in points. */
219
+ export interface Size {
220
+ width: number;
221
+ height: number;
222
+ }
223
+ /**
224
+ * Where the picture is drawn inside its box (it may overflow the box: the box crops it).
225
+ * The native views use the same rule.
226
+ * @param box Size of the view.
227
+ * @param image Size of the picture, in points.
228
+ */
229
+ export declare function fitRect(fit: ImageContentFit, position: ImageContentPosition, box: Size, image: Size): Rect;
230
+ /** `contentFit` → React Native's `resizeMode`, for the plain image used with the module off. */
231
+ export declare const resizeModeOf: (fit?: ImageContentFit) => "cover" | "contain" | "stretch" | "center";
232
+ /** The URL of a source, or `undefined` for a `require()` (resolved by the platform). */
233
+ export declare const sourceUri: (source: ImageSourceInput | undefined) => string | undefined;
234
+ /** Headers as a flat list (`[name, value, name, value…]`), the way the native views read them. */
235
+ export declare const flatHeaders: (headers: Record<string, string> | undefined) => string[];
236
+ /** Whether `hash` is a well-formed blurhash. */
237
+ export declare function isBlurhash(hash: string | undefined): hash is string;
238
+ /**
239
+ * Decodes a blurhash into RGBA pixels (the same algorithm runs natively on iOS and Android).
240
+ * @param width Width of the output, in pixels (32 is plenty: it is drawn blurred).
241
+ * @param height Height of the output, in pixels.
242
+ * @param punch Contrast boost. Default `1`.
243
+ * @returns `width * height * 4` bytes, or `null` for an invalid hash.
244
+ */
245
+ export declare function decodeBlurhash(hash: string, width: number, height: number, punch?: number): Uint8ClampedArray | null;
246
+ //# sourceMappingURL=image.d.ts.map
@@ -0,0 +1,171 @@
1
+ /**
2
+ * `Image` with the `image` module on: the lib's own image pipeline.
3
+ * iOS and Android: memory and disk caches, downloads shared between views, progress,
4
+ * decoding at the size on screen, animated GIF/WebP, blurhash placeholders, crossfade,
5
+ * tint and blur (the same pipeline design on both). Web: the browser's `<img>` with the
6
+ * same props (`object-fit`, lazy loading, blurhash, crossfade).
7
+ * With the module off, `Image` stays the platform's plain image.
8
+ */
9
+ import { getProvider } from '../config';
10
+ /** Default largest zoom. */
11
+ export const DEFAULT_MAX_ZOOM = 4;
12
+ /** Default zoom of a double tap. */
13
+ export const DEFAULT_DOUBLE_TAP_ZOOM = 2.5;
14
+ /**
15
+ * Keeps a zoomed picture covering its box: the offset (from the centered position) is
16
+ * limited to the part of the picture that overflows. The native views use the same rule.
17
+ * @param offset Wanted offset on one axis, in points.
18
+ * @param box Size of the view on that axis.
19
+ * @param scale Current zoom.
20
+ */
21
+ export const clampOffset = (offset, box, scale) => {
22
+ const limit = Math.max(0, (box * scale - box) / 2);
23
+ return Math.max(-limit, Math.min(limit, offset));
24
+ };
25
+ /** Zoom limited to `1…maxZoom`. */
26
+ export const clampZoom = (scale, maxZoom = DEFAULT_MAX_ZOOM) => Math.max(1, Math.min(Math.max(1, maxZoom), scale));
27
+ /**
28
+ * Offset that keeps the focus point still while the zoom goes from `from` to `to`
29
+ * (one axis; offsets are from the centered position, the focus from the view's center).
30
+ */
31
+ export const zoomOffset = (offset, focus, from, to) => focus - ((focus - offset) * to) / from;
32
+ /**
33
+ * Downloads pictures before they are shown (the next screen, the next page of a list),
34
+ * so they appear at once. Needs the `image` module.
35
+ * @param urls One URL or many.
36
+ * @returns `true` when every picture was cached, `false` otherwise (or with the module off).
37
+ */
38
+ export function prefetchImages(urls, options = {}) {
39
+ const list = (Array.isArray(urls) ? urls : [urls]).filter(Boolean);
40
+ const api = getProvider().images;
41
+ return api && list.length ? api.prefetch(list, options) : Promise.resolve(false);
42
+ }
43
+ /**
44
+ * Empties the image caches (memory and disk by default). Needs the `image` module on
45
+ * native; does nothing on the web (the browser owns its cache).
46
+ */
47
+ export function clearImageCache(options = {}) {
48
+ const api = getProvider().images;
49
+ return api ? api.clear({ memory: options.memory ?? true, disk: options.disk ?? true }) : Promise.resolve();
50
+ }
51
+ /** Default crossfade, in ms. */
52
+ export const DEFAULT_TRANSITION = 250;
53
+ /** `contentFit` → the native views' name. */
54
+ export const nativeContentFit = (fit = 'cover') => (fit === 'scale-down' ? 'scaleDown' : fit);
55
+ const AXIS = {
56
+ left: { x: 0 },
57
+ right: { x: 1 },
58
+ top: { y: 0 },
59
+ bottom: { y: 1 },
60
+ center: {},
61
+ };
62
+ /** `'top left'` → `{ x: 0, y: 0 }`; unknown words stay centered. */
63
+ export function positionFractions(position = 'center') {
64
+ return position
65
+ .split(/\s+/)
66
+ .reduce((out, word) => ({ ...out, ...AXIS[word] }), { x: 0.5, y: 0.5 });
67
+ }
68
+ /** Scale of the picture for each `contentFit` (`fill` is handled apart: it has two). */
69
+ const FIT_SCALE = {
70
+ cover: (box, image) => Math.max(box.width / image.width, box.height / image.height),
71
+ contain: (box, image) => Math.min(box.width / image.width, box.height / image.height),
72
+ none: () => 1,
73
+ 'scale-down': (box, image) => Math.min(1, box.width / image.width, box.height / image.height),
74
+ };
75
+ /**
76
+ * Where the picture is drawn inside its box (it may overflow the box: the box crops it).
77
+ * The native views use the same rule.
78
+ * @param box Size of the view.
79
+ * @param image Size of the picture, in points.
80
+ */
81
+ export function fitRect(fit, position, box, image) {
82
+ if (image.width <= 0 || image.height <= 0)
83
+ return { x: 0, y: 0, ...box };
84
+ if (fit === 'fill')
85
+ return { x: 0, y: 0, width: box.width, height: box.height };
86
+ const scale = FIT_SCALE[fit](box, image);
87
+ const width = image.width * scale;
88
+ const height = image.height * scale;
89
+ const { x, y } = positionFractions(position);
90
+ // `+ 0` turns `-0` into `0`
91
+ return { x: (box.width - width) * x + 0, y: (box.height - height) * y + 0, width, height };
92
+ }
93
+ /** `contentFit` → React Native's `resizeMode`, for the plain image used with the module off. */
94
+ export const resizeModeOf = (fit = 'cover') => ({ cover: 'cover', contain: 'contain', fill: 'stretch', none: 'center', 'scale-down': 'contain' }[fit]);
95
+ /** The URL of a source, or `undefined` for a `require()` (resolved by the platform). */
96
+ export const sourceUri = (source) => typeof source === 'string' ? source : typeof source === 'object' && source ? source.uri : undefined;
97
+ /** Headers as a flat list (`[name, value, name, value…]`), the way the native views read them. */
98
+ export const flatHeaders = (headers) => Object.entries(headers ?? {}).flatMap(([name, value]) => [name, String(value)]);
99
+ // ── blurhash ──
100
+ const BASE83 = '0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz#$%*+,-.:;=?@[]^_{|}~';
101
+ const decode83 = (text) => [...text].reduce((value, char) => value * 83 + BASE83.indexOf(char), 0);
102
+ const toLinear = (value) => {
103
+ const v = value / 255;
104
+ return v <= 0.04045 ? v / 12.92 : Math.pow((v + 0.055) / 1.055, 2.4);
105
+ };
106
+ const toSrgb = (value) => {
107
+ const v = Math.max(0, Math.min(1, value));
108
+ return v <= 0.0031308 ? Math.round(v * 12.92 * 255 + 0.5) : Math.round((1.055 * Math.pow(v, 1 / 2.4) - 0.055) * 255 + 0.5);
109
+ };
110
+ const signPow = (value, exponent) => Math.sign(value) * Math.pow(Math.abs(value), exponent);
111
+ /** Whether `hash` is a well-formed blurhash. */
112
+ export function isBlurhash(hash) {
113
+ if (!hash || hash.length < 6 || [...hash].some((char) => !BASE83.includes(char)))
114
+ return false;
115
+ const size = decode83(hash[0]);
116
+ return hash.length === 4 + 2 * ((size % 9) + 1) * (Math.floor(size / 9) + 1);
117
+ }
118
+ /**
119
+ * Decodes a blurhash into RGBA pixels (the same algorithm runs natively on iOS and Android).
120
+ * @param width Width of the output, in pixels (32 is plenty: it is drawn blurred).
121
+ * @param height Height of the output, in pixels.
122
+ * @param punch Contrast boost. Default `1`.
123
+ * @returns `width * height * 4` bytes, or `null` for an invalid hash.
124
+ */
125
+ export function decodeBlurhash(hash, width, height, punch = 1) {
126
+ if (!isBlurhash(hash))
127
+ return null;
128
+ const size = decode83(hash[0]);
129
+ const countY = Math.floor(size / 9) + 1;
130
+ const countX = (size % 9) + 1;
131
+ const maximum = ((decode83(hash[1]) + 1) / 166) * punch;
132
+ const colors = [];
133
+ for (let i = 0; i < countX * countY; i++) {
134
+ if (i === 0) {
135
+ const value = decode83(hash.substring(2, 6));
136
+ colors.push([toLinear(value >> 16), toLinear((value >> 8) & 255), toLinear(value & 255)]);
137
+ }
138
+ else {
139
+ const value = decode83(hash.substring(4 + i * 2, 6 + i * 2));
140
+ colors.push([
141
+ signPow((Math.floor(value / (19 * 19)) - 9) / 9, 2) * maximum,
142
+ signPow(((Math.floor(value / 19) % 19) - 9) / 9, 2) * maximum,
143
+ signPow(((value % 19) - 9) / 9, 2) * maximum,
144
+ ]);
145
+ }
146
+ }
147
+ const pixels = new Uint8ClampedArray(width * height * 4);
148
+ for (let y = 0; y < height; y++) {
149
+ for (let x = 0; x < width; x++) {
150
+ let r = 0;
151
+ let g = 0;
152
+ let b = 0;
153
+ for (let j = 0; j < countY; j++) {
154
+ for (let i = 0; i < countX; i++) {
155
+ const basis = Math.cos((Math.PI * x * i) / width) * Math.cos((Math.PI * y * j) / height);
156
+ const color = colors[i + j * countX];
157
+ r += color[0] * basis;
158
+ g += color[1] * basis;
159
+ b += color[2] * basis;
160
+ }
161
+ }
162
+ const at = 4 * (x + y * width);
163
+ pixels[at] = toSrgb(r);
164
+ pixels[at + 1] = toSrgb(g);
165
+ pixels[at + 2] = toSrgb(b);
166
+ pixels[at + 3] = 255;
167
+ }
168
+ }
169
+ return pixels;
170
+ }
171
+ //# sourceMappingURL=image.js.map
@@ -0,0 +1,33 @@
1
+ import type { ComponentType } from 'react';
2
+ /**
3
+ * Key of the function a styled component exposes to the isoform JSX runtime (see `jsx-runtime.ts`).
4
+ * A registered symbol, so the runtime finds it without importing the rest of the library.
5
+ */
6
+ export declare const INLINE: unique symbol;
7
+ /** What a styled component would render: the component underneath and its final props. */
8
+ export interface InlineElement {
9
+ /** The component underneath (`View`, a `div` primitive, an app component…). */
10
+ type: ComponentType<any>;
11
+ /** Its props: style already applied, `ref` included. */
12
+ props: Record<string, any>;
13
+ }
14
+ /**
15
+ * Turns the props of a styled component into the element it would render, or `null` when it must
16
+ * render as a component (its style may depend on the theme, or inlining is off).
17
+ */
18
+ export type InlineFn = (props: Record<string, any>) => InlineElement | null;
19
+ /**
20
+ * Marks a style function (or a `when()` condition / attrs function) as never reading the theme: it
21
+ * only uses `props` and `platform`. A styled component whose functions are all marked can be rendered
22
+ * without its wrapper by the isoform JSX runtime.
23
+ *
24
+ * The isoform Babel plugin adds the mark by itself when it can prove it from the code (the function
25
+ * takes `({ props })`, `({ props, platform })` or nothing). Mark by hand only where the plugin does not run.
26
+ *
27
+ * @example
28
+ * const Cell = engine<'Box', { size: number }>('Box', themeFree(({ props }) => ({ width: props.size })));
29
+ */
30
+ export declare const themeFree: <F extends (...args: any[]) => any>(fn: F) => F;
31
+ /** `true` for a function marked by `themeFree`. */
32
+ export declare const isThemeFree: (fn: unknown) => boolean;
33
+ //# sourceMappingURL=inline.d.ts.map
@@ -0,0 +1,25 @@
1
+ /**
2
+ * Key of the function a styled component exposes to the isoform JSX runtime (see `jsx-runtime.ts`).
3
+ * A registered symbol, so the runtime finds it without importing the rest of the library.
4
+ */
5
+ export const INLINE = Symbol.for('isoform.inline');
6
+ /** Mark of a style function that never reads the theme (see `themeFree`). */
7
+ const THEME_FREE = Symbol.for('isoform.themeFree');
8
+ /**
9
+ * Marks a style function (or a `when()` condition / attrs function) as never reading the theme: it
10
+ * only uses `props` and `platform`. A styled component whose functions are all marked can be rendered
11
+ * without its wrapper by the isoform JSX runtime.
12
+ *
13
+ * The isoform Babel plugin adds the mark by itself when it can prove it from the code (the function
14
+ * takes `({ props })`, `({ props, platform })` or nothing). Mark by hand only where the plugin does not run.
15
+ *
16
+ * @example
17
+ * const Cell = engine<'Box', { size: number }>('Box', themeFree(({ props }) => ({ width: props.size })));
18
+ */
19
+ export const themeFree = (fn) => {
20
+ fn[THEME_FREE] = true;
21
+ return fn;
22
+ };
23
+ /** `true` for a function marked by `themeFree`. */
24
+ export const isThemeFree = (fn) => typeof fn === 'function' && fn[THEME_FREE] === true;
25
+ //# sourceMappingURL=inline.js.map
@@ -0,0 +1,40 @@
1
+ import type { IsoStyle } from './style/types';
2
+ /**
3
+ * The frames of an animation, written with the same style vocabulary as the
4
+ * rest of the lib. Works on both platforms (`@keyframes` on the web, `Animated` on native).
5
+ */
6
+ export type Keyframes = {
7
+ /** The starting frame (same as `'0%'`). */
8
+ from?: IsoStyle;
9
+ /** The final frame (same as `'100%'`). */
10
+ to?: IsoStyle;
11
+ /** A frame at a point of the animation, e.g. `'50%'`. */
12
+ [percent: `${number}%`]: IsoStyle;
13
+ /** The same frame at several points, e.g. `'0%, 100%'`. */
14
+ [list: `${number}%, ${string}`]: IsoStyle;
15
+ };
16
+ /** Prefix of the generated names (`o-kf-<hash>`). */
17
+ export declare const KEYFRAMES_PREFIX = "o-kf-";
18
+ /**
19
+ * Declares an animation and returns its name, to use in `animation` / `animationName`.
20
+ * Works on both platforms: `@keyframes` on the web, `Animated` on native.
21
+ *
22
+ * It does not depend on the active provider: it only stores the definition, and
23
+ * each adapter materializes it when a style using the name is compiled. So it can
24
+ * be called at the top of a module, before `configure()`.
25
+ *
26
+ * The name is derived from the content (deterministic, safe for SSR).
27
+ *
28
+ * @param frames The animation frames (see {@link Keyframes}).
29
+ * @returns The generated animation name (`o-kf-<hash>`).
30
+ *
31
+ * @example
32
+ * const pulse = keyframes({ '0%': { opacity: 1 }, '50%': { opacity: 0.3 }, '100%': { opacity: 1 } });
33
+ * const Dot = engine('Box', { animation: `${pulse} 1s ease-in-out infinite alternate` });
34
+ */
35
+ export declare function keyframes(frames: Keyframes): string;
36
+ /** The definition registered by `keyframes()` under `name` (used by the adapters). */
37
+ export declare function getKeyframes(name: string): Record<string, Record<string, any>> | undefined;
38
+ /** Keyframe names referenced in a CSS value (`'o-kf-abc 1s ease'` → `['o-kf-abc']`). */
39
+ export declare function keyframeNamesIn(value: unknown): string[];
40
+ //# sourceMappingURL=keyframes.d.ts.map
@@ -0,0 +1,38 @@
1
+ /* eslint-disable @typescript-eslint/no-explicit-any */
2
+ import { stringHash } from '../hash/stringHash';
3
+ /** Prefix of the generated names (`o-kf-<hash>`). */
4
+ export const KEYFRAMES_PREFIX = 'o-kf-';
5
+ const registry = new Map();
6
+ /**
7
+ * Declares an animation and returns its name, to use in `animation` / `animationName`.
8
+ * Works on both platforms: `@keyframes` on the web, `Animated` on native.
9
+ *
10
+ * It does not depend on the active provider: it only stores the definition, and
11
+ * each adapter materializes it when a style using the name is compiled. So it can
12
+ * be called at the top of a module, before `configure()`.
13
+ *
14
+ * The name is derived from the content (deterministic, safe for SSR).
15
+ *
16
+ * @param frames The animation frames (see {@link Keyframes}).
17
+ * @returns The generated animation name (`o-kf-<hash>`).
18
+ *
19
+ * @example
20
+ * const pulse = keyframes({ '0%': { opacity: 1 }, '50%': { opacity: 0.3 }, '100%': { opacity: 1 } });
21
+ * const Dot = engine('Box', { animation: `${pulse} 1s ease-in-out infinite alternate` });
22
+ */
23
+ export function keyframes(frames) {
24
+ const name = `${KEYFRAMES_PREFIX}${stringHash(JSON.stringify(frames)).toString(36)}`;
25
+ registry.set(name, frames);
26
+ return name;
27
+ }
28
+ /** The definition registered by `keyframes()` under `name` (used by the adapters). */
29
+ export function getKeyframes(name) {
30
+ return registry.get(name);
31
+ }
32
+ /** Keyframe names referenced in a CSS value (`'o-kf-abc 1s ease'` → `['o-kf-abc']`). */
33
+ export function keyframeNamesIn(value) {
34
+ if (typeof value !== 'string')
35
+ return [];
36
+ return value.match(/o-kf-[a-z0-9]+/g) ?? [];
37
+ }
38
+ //# sourceMappingURL=keyframes.js.map