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,239 @@
1
+ import type { PlatformAdapter } from '../core/adapter';
2
+ /**
3
+ * Built-in platform providers.
4
+ * - `'react-native'`: iOS and Android, through React Native (picked by Metro).
5
+ * - `'react'`: the web, through React DOM (picked by Vite, Next, webpack…).
6
+ */
7
+ export type ProviderName = 'react-native' | 'react';
8
+ /** Options of `configure()`. Call it once, when the app starts, before the first render. */
9
+ export interface ConfigureOptions {
10
+ /**
11
+ * Which platform to render with.
12
+ * - `'auto'` (default): the provider the bundler included (React Native on Metro, React DOM on Vite/Next/webpack).
13
+ * - `'react-native'` | `'react'`: explicit; throws a clear error if it does not match the bundle.
14
+ * - a `PlatformAdapter`: a custom platform.
15
+ */
16
+ provider?: 'auto' | ProviderName | PlatformAdapter;
17
+ /** The theme (colors, spacing, typography…). Shortcut for `updateTheme(theme)`. */
18
+ theme?: Partial<EngineTheme>;
19
+ /**
20
+ * Minimum widths (px) of the breakpoints used by `when('breakpoints:md')` and friends.
21
+ * Mobile-first: a rule applies when the screen is at least that wide.
22
+ * Replaces the whole set. Default `{ sm: 480, md: 768, lg: 1024, xl: 1280 }`.
23
+ * To type new names, augment `IsoBreakpointNames`.
24
+ */
25
+ breakpoints?: Record<string, number>;
26
+ /**
27
+ * Performance switches. Defaults are right for almost every app.
28
+ */
29
+ performance?: {
30
+ /**
31
+ * With the isoform JSX runtime (`jsxImportSource: 'react-isoform'`), render a styled component
32
+ * whose style never reads the theme as the component underneath directly (`<View style={…}>`), with
33
+ * no wrapper component in between (default `true`). Set it once, at startup: switching it later
34
+ * remounts those components. Without the JSX runtime it has no effect.
35
+ */
36
+ inline?: boolean;
37
+ /**
38
+ * Web only. Top-level theme keys whose values are CSS-ready strings (`['color']` for `theme.color.bg`).
39
+ * Their tokens reach the style rules as `var(--iso-color-bg)`, and the real values live in one
40
+ * `:root` rule: a theme switch rewrites that rule instead of recompiling and re-rendering every
41
+ * component whose styles only read those tokens.
42
+ *
43
+ * The style must only pass those values through (`backgroundColor: theme.color.bg`, or inside a template
44
+ * string). Computing with them (`theme.color.bg + '80'`) would see a `var(...)` text. Numbers and other keys
45
+ * stay real values, and a style that reads one keeps depending on the theme. Define the tokens up front
46
+ * (in `configure({ theme })`): a token added later is not seen by styles already compiled.
47
+ * Ignored (with a development warning) on platforms without CSS variables. Default: off.
48
+ */
49
+ themeVariables?: readonly string[];
50
+ };
51
+ /** Settings of the CSS → React Native conversion. */
52
+ native?: {
53
+ /** Pixel size of `1rem` (and the fallback for `em`) on native. Default `16`. */
54
+ remBase?: number;
55
+ };
56
+ /**
57
+ * Optional modules. **All off by default.** The recommended way is an
58
+ * `isoform.config.json` at the app root, passed here:
59
+ * ```ts
60
+ * // isoform.config.json → { "modules": { "video": true, "audio": { "enabled": true, "mediaSession": true }, "pdf": true } }
61
+ * import isoform from './isoform.config.json';
62
+ * configure({ modules: isoform.modules });
63
+ * ```
64
+ * The same file drives the build: Gradle and CocoaPods only compile the
65
+ * enabled modules, and `react-isoform/metro` removes the disabled ones from the
66
+ * JS bundle. On the web, a disabled module's code is never downloaded.
67
+ */
68
+ modules?: IsoModules;
69
+ }
70
+ /** Options every optional module accepts when it is turned on with an object. */
71
+ export interface ModuleOptions {
72
+ /** Turns the module on. Default `false`: an object without `enabled: true` leaves it off. */
73
+ enabled?: boolean;
74
+ }
75
+ /** Options of the `audio` module. */
76
+ export interface AudioModuleOptions extends ModuleOptions {
77
+ /**
78
+ * Background audio with system controls: Android foreground service and media
79
+ * notification (Media3 `MediaSession`), iOS lock screen / Control Center
80
+ * (`MPNowPlayingInfoCenter`). **Build-time only**: Gradle and CocoaPods read it
81
+ * from `isoform.config.json`; it is ignored in JS. Only applies when `enabled` is `true`.
82
+ * Extra app setup: Android 13+ runtime `POST_NOTIFICATIONS` permission to show the
83
+ * notification. (On iOS the build adds `UIBackgroundModes` → `audio` to Info.plist.)
84
+ * Default `false`.
85
+ */
86
+ mediaSession?: boolean;
87
+ }
88
+ /** Options of the `camera` module. Each feature only enters the app when it is on. */
89
+ export interface CameraModuleOptions extends ModuleOptions {
90
+ /**
91
+ * Video recording (`startRecording`): CameraX `VideoCapture` on Android, the movie
92
+ * output on iOS, `MediaRecorder` on the web. Adds the microphone permission
93
+ * (Android manifest, iOS `NSMicrophoneUsageDescription`). Default `false`.
94
+ */
95
+ video?: boolean;
96
+ /**
97
+ * Code scanner (`onCodeScanned`): ML Kit barcode scanning on Android (bundled model,
98
+ * about 2.4 MB), `AVCaptureMetadataOutput` on iOS, `BarcodeDetector` on the web
99
+ * (Chromium browsers). Default `false`.
100
+ */
101
+ codeScanner?: boolean;
102
+ }
103
+ /** Options of the `pdf` module. */
104
+ export interface PdfModuleOptions extends ModuleOptions {
105
+ /**
106
+ * Web only: URL of the pdf.js worker (`pdfjs-dist/build/pdf.worker.min.mjs`,
107
+ * copied to your public folder, same `pdfjs-dist` version). With it, PDFs are
108
+ * parsed in a background thread; without it (default) they are parsed on the
109
+ * main thread, which needs no setup but can stutter on very large files.
110
+ */
111
+ workerSrc?: string;
112
+ }
113
+ /**
114
+ * The lib's optional modules. Every one is off unless turned on, either with
115
+ * `true` or with an object (`{ enabled: true, ...options }`).
116
+ */
117
+ export interface IsoModules {
118
+ /**
119
+ * `engine('Video')`: a video player. Web: `<video>` with the lib's controls
120
+ * (loaded on demand). iOS: AVPlayer. Android: Media3 ExoPlayer with Jetpack Compose controls.
121
+ * Default `false`.
122
+ */
123
+ video?: boolean | ModuleOptions;
124
+ /**
125
+ * `engine('Audio')`: an audio player with title, artist and cover. Web: `<audio>`
126
+ * with the lib's controls (loaded on demand). iOS: AVPlayer with a UIKit card.
127
+ * Android: Media3 ExoPlayer with Jetpack Compose controls.
128
+ * Use an object for options: `{ enabled: true, mediaSession: true }`.
129
+ * Default `false`.
130
+ */
131
+ audio?: boolean | AudioModuleOptions;
132
+ /**
133
+ * `engine('Pdf')`: a PDF viewer with search and highlighted matches, thumbnails,
134
+ * zoom, links, password prompt and night mode. Web: pdf.js (`pdfjs-dist`, loaded on
135
+ * demand). iOS: PDFKit. Android: the system `PdfRenderer` with Jetpack Compose
136
+ * (a basic viewer, without search and links, on Android older than 12).
137
+ * Use an object for options: `{ enabled: true, workerSrc: '/pdf.worker.min.mjs' }`.
138
+ * Default `false`.
139
+ */
140
+ pdf?: boolean | PdfModuleOptions;
141
+ /**
142
+ * `engine('BottomSheet')`: a panel that slides up from the bottom, with detents,
143
+ * drag, backdrop and the platform's own feel. Web: a native `<dialog>` (top layer,
144
+ * focus trap, Escape). iOS: a SwiftUI sheet (`presentationDetents`). Android: a
145
+ * Jetpack Compose sheet. The content is regular isoform/React Native children.
146
+ * Default `false`.
147
+ */
148
+ sheet?: boolean | ModuleOptions;
149
+ /**
150
+ * SVG primitives (`engine('Svg')`, `'Path'`, `'Circle'`, `'SvgLinearGradient'`…), styled
151
+ * like any other primitive (`fill`, `stroke`, `strokeWidth` in the style, from the theme).
152
+ * Web: the browser's own `<svg>` elements (no dependency). iOS and Android:
153
+ * [`react-native-svg`](https://github.com/software-mansion/react-native-svg), which the
154
+ * app installs only when this module is on (`npx expo install react-native-svg`).
155
+ * Default `false`.
156
+ */
157
+ svg?: boolean | ModuleOptions;
158
+ /**
159
+ * `engine('Camera')`: the camera preview, photos, video and a code scanner. The app
160
+ * draws its own interface. Android: CameraX with the Jetpack Compose viewfinder.
161
+ * iOS: AVFoundation. Web: `getUserMedia`.
162
+ * Use an object for the extra features: `{ enabled: true, video: true, codeScanner: true }`.
163
+ * Default `false`.
164
+ */
165
+ camera?: boolean | CameraModuleOptions;
166
+ /**
167
+ * `engine('DatePicker')`: pick a date, a time or both. iOS (SwiftUI) and Android
168
+ * (Jetpack Compose): the lib's own picker, the same design on both (calendar, wheels,
169
+ * compact pills with a sheet). Web: the browser's own `<input type="date">`.
170
+ * Default `false`.
171
+ */
172
+ datePicker?: boolean | ModuleOptions;
173
+ /**
174
+ * `engine('Image')` becomes the lib's own image: memory and disk caches, downloads
175
+ * shared between views, progress, decoding at the size on screen, animated GIF/WebP,
176
+ * blurhash placeholders, crossfade, tint and blur, plus `prefetchImages` and
177
+ * `clearImageCache`. iOS (URLSession, ImageIO) and Android (OkHttp, ImageDecoder) run
178
+ * the same pipeline design; no extra dependency. Web: `<img>` with the same props.
179
+ * Off: `Image` stays the platform's plain image.
180
+ * Default `false`.
181
+ */
182
+ image?: boolean | ModuleOptions;
183
+ /**
184
+ * `engine('Modal')` becomes the lib's own modal: a centered dialog or a full-screen
185
+ * cover with spring animations, backdrop, keyboard avoidance and a focus trap. iOS:
186
+ * UIKit. Android: Jetpack Compose. Web: a native `<dialog>`. The content is regular
187
+ * isoform/React Native children.
188
+ * Off: `Modal` stays React Native's `Modal` (native only).
189
+ * Default `false`.
190
+ */
191
+ modal?: boolean | ModuleOptions;
192
+ }
193
+ /** Name of an optional module (`'video'` | `'audio'` | `'pdf'` | `'sheet'` | `'svg'` | `'camera'` | `'datePicker'` | `'image'` | `'modal'`). */
194
+ export type ModuleName = keyof IsoModules;
195
+ /** Default state of every optional module (all off). */
196
+ export declare const DEFAULT_MODULES: Readonly<IsoModules>;
197
+ /** Default breakpoint widths, in px (mobile-first minimums). */
198
+ export declare const DEFAULT_BREAKPOINTS: Readonly<Record<string, number>>;
199
+ /** Called by the `providers/*` modules on import. Not public API. */
200
+ export declare function registerBundledProvider(adapter: PlatformAdapter): void;
201
+ /** Resets the provider and the configuration. Tests only. */
202
+ export declare function resetProvider(): void;
203
+ /** Whether the module was turned on with `configure({ modules })`. */
204
+ export declare const isModuleEnabled: (name: ModuleName) => boolean;
205
+ /** Web: the pdf.js worker URL from `modules.pdf.workerSrc` (`undefined` when not set). */
206
+ export declare const pdfWorkerSrc: () => string | undefined;
207
+ /** A feature of the `camera` module (`video`, `codeScanner`): on only with the module on and the option `true`. */
208
+ export declare const isCameraFeatureEnabled: (feature: "video" | "codeScanner") => boolean;
209
+ /**
210
+ * The active platform adapter (the one chosen by `configure`, or the bundled one).
211
+ * Marks the provider as in use, so a later `configure()` that switches it warns.
212
+ */
213
+ export declare function getProvider(): PlatformAdapter;
214
+ /** Like `getProvider`, but without marking the provider as in use (for import-time definitions). */
215
+ export declare function peekProvider(): PlatformAdapter;
216
+ /** Runtime settings read by the adapters. */
217
+ export declare function getConfig(): {
218
+ native: {
219
+ remBase: number;
220
+ };
221
+ };
222
+ /**
223
+ * The theme keys exposed as CSS variables, or `null` when the feature is off. Only meaningful together with an
224
+ * adapter that has `applyThemeVariables` (the builder checks both).
225
+ */
226
+ export declare const getThemeVariableKeys: () => readonly string[] | null;
227
+ /** Whether the JSX runtime may render theme-free styled components without their wrapper (see `configure({ performance })`). */
228
+ export declare const isInlineEnabled: () => boolean;
229
+ /** The active breakpoints (name → minimum width in px). */
230
+ export declare function getBreakpoints(): Readonly<Record<string, number>>;
231
+ /**
232
+ * Configures isoform: provider, theme, breakpoints, native conversion and
233
+ * optional modules. Call it once, when the app starts, before the first render.
234
+ *
235
+ * @example
236
+ * configure({ theme: tokens, modules: { video: true } });
237
+ */
238
+ export declare function configure(options?: ConfigureOptions): void;
239
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1,161 @@
1
+ import { warnOnce } from '../core/dev';
2
+ import { getTheme, themeStore, updateTheme } from '../theme/store';
3
+ import { themeCss, variablesOf } from '../theme/variables';
4
+ /** Whether a module setting (`true`, or `{ enabled: true }`) turns the module on. */
5
+ const isOn = (setting) => setting === true || (typeof setting === 'object' && setting !== null && setting.enabled === true);
6
+ /** Default state of every optional module (all off). */
7
+ export const DEFAULT_MODULES = { video: false, audio: false, pdf: false, sheet: false, svg: false, camera: false, datePicker: false, image: false, modal: false };
8
+ let modules = { ...DEFAULT_MODULES };
9
+ /** The adapter the bundler picked (through `providers/index(.native).ts`). */
10
+ let bundled = null;
11
+ /** The adapter explicitly chosen by `configure`. */
12
+ let active = null;
13
+ let used = false;
14
+ let remBase = 16;
15
+ let inline = true;
16
+ /** Top-level theme keys exposed as CSS variables, or `null` when the feature is off. */
17
+ let themeVariableKeys = null;
18
+ let stopThemeVariables = null;
19
+ /** Default breakpoint widths, in px (mobile-first minimums). */
20
+ export const DEFAULT_BREAKPOINTS = { sm: 480, md: 768, lg: 1024, xl: 1280 };
21
+ let breakpoints = { ...DEFAULT_BREAKPOINTS };
22
+ /** Names that already mean something else in `when()` and cannot be breakpoints. */
23
+ const RESERVED = new Set(['ios', 'android', 'web', 'native', 'hover', 'focus', 'focus-visible', 'pressed']);
24
+ /** Called by the `providers/*` modules on import. Not public API. */
25
+ export function registerBundledProvider(adapter) {
26
+ bundled = adapter;
27
+ }
28
+ /** Resets the provider and the configuration. Tests only. */
29
+ export function resetProvider() {
30
+ bundled = null;
31
+ active = null;
32
+ used = false;
33
+ remBase = 16;
34
+ inline = true;
35
+ stopThemeVariables?.();
36
+ stopThemeVariables = null;
37
+ themeVariableKeys = null;
38
+ breakpoints = { ...DEFAULT_BREAKPOINTS };
39
+ modules = { ...DEFAULT_MODULES };
40
+ }
41
+ /** Whether the module was turned on with `configure({ modules })`. */
42
+ export const isModuleEnabled = (name) => isOn(modules[name]);
43
+ /** Web: the pdf.js worker URL from `modules.pdf.workerSrc` (`undefined` when not set). */
44
+ export const pdfWorkerSrc = () => {
45
+ const setting = modules.pdf;
46
+ return typeof setting === 'object' && setting !== null ? setting.workerSrc : undefined;
47
+ };
48
+ /** A feature of the `camera` module (`video`, `codeScanner`): on only with the module on and the option `true`. */
49
+ export const isCameraFeatureEnabled = (feature) => {
50
+ const setting = modules.camera;
51
+ return isOn(setting) && typeof setting === 'object' && setting !== null && setting[feature] === true;
52
+ };
53
+ /**
54
+ * The active platform adapter (the one chosen by `configure`, or the bundled one).
55
+ * Marks the provider as in use, so a later `configure()` that switches it warns.
56
+ */
57
+ export function getProvider() {
58
+ const provider = peekProvider();
59
+ used = true;
60
+ return provider;
61
+ }
62
+ /** Like `getProvider`, but without marking the provider as in use (for import-time definitions). */
63
+ export function peekProvider() {
64
+ const provider = active ?? bundled;
65
+ if (!provider) {
66
+ throw new Error('[isoform] ISO001: no provider is available. Import `react-isoform` (the bundler picks the provider) ' +
67
+ 'or call configure({ provider: <adapter> }).');
68
+ }
69
+ return provider;
70
+ }
71
+ /** Runtime settings read by the adapters. */
72
+ export function getConfig() {
73
+ return { native: { remBase } };
74
+ }
75
+ /**
76
+ * The theme keys exposed as CSS variables, or `null` when the feature is off. Only meaningful together with an
77
+ * adapter that has `applyThemeVariables` (the builder checks both).
78
+ */
79
+ export const getThemeVariableKeys = () => themeVariableKeys;
80
+ /** Keeps the `:root` variables in step with the theme: once now, then on every change. */
81
+ function syncThemeVariables(adapter, keys) {
82
+ stopThemeVariables?.();
83
+ const write = () => adapter.applyThemeVariables?.(themeCss(variablesOf(getTheme(), keys)));
84
+ write();
85
+ stopThemeVariables = themeStore.subscribe(write);
86
+ }
87
+ /** Whether the JSX runtime may render theme-free styled components without their wrapper (see `configure({ performance })`). */
88
+ export const isInlineEnabled = () => inline;
89
+ /** The active breakpoints (name → minimum width in px). */
90
+ export function getBreakpoints() {
91
+ return breakpoints;
92
+ }
93
+ /**
94
+ * Configures isoform: provider, theme, breakpoints, native conversion and
95
+ * optional modules. Call it once, when the app starts, before the first render.
96
+ *
97
+ * @example
98
+ * configure({ theme: tokens, modules: { video: true } });
99
+ */
100
+ export function configure(options = {}) {
101
+ const { provider = 'auto', theme, native, breakpoints: bps, modules: enabled } = options;
102
+ let next;
103
+ if (typeof provider === 'object') {
104
+ next = provider;
105
+ }
106
+ else if (provider === 'auto') {
107
+ if (!bundled) {
108
+ throw new Error('[isoform] ISO002: provider "auto" but no provider is in the bundle. Pass an adapter.');
109
+ }
110
+ next = bundled;
111
+ }
112
+ else {
113
+ if (!bundled || bundled.name !== provider) {
114
+ const available = bundled ? `"${bundled.name}"` : 'nenhum';
115
+ throw new Error(`[isoform] ISO003: provider "${provider}" is not available in this bundle (available: ${available}). ` +
116
+ `Use "auto" or the provider the current platform loads.`);
117
+ }
118
+ next = bundled;
119
+ }
120
+ if (used && next !== (active ?? bundled)) {
121
+ warnOnce('configure-after-render', 'ISO012: configure() changed the provider after the first render. Call configure() once, when the app starts.');
122
+ }
123
+ active = next;
124
+ if (bps) {
125
+ for (const [name, min] of Object.entries(bps)) {
126
+ if (!/^[A-Za-z_][\w-]*$/.test(name)) {
127
+ throw new Error(`[isoform] ISO004: invalid breakpoint name: "${name}" (use letters, numbers, _ or -).`);
128
+ }
129
+ if (RESERVED.has(name)) {
130
+ throw new Error(`[isoform] ISO005: "${name}" cannot be a breakpoint name (it is already a when() condition).`);
131
+ }
132
+ if (typeof min !== 'number' || !Number.isFinite(min) || min < 0) {
133
+ throw new Error(`[isoform] ISO006: breakpoint "${name}" needs a minimum width in px (a number >= 0).`);
134
+ }
135
+ }
136
+ breakpoints = { ...bps };
137
+ }
138
+ if (options.performance?.inline !== undefined)
139
+ inline = options.performance.inline;
140
+ const variableKeys = options.performance?.themeVariables;
141
+ if (variableKeys !== undefined) {
142
+ stopThemeVariables?.();
143
+ stopThemeVariables = null;
144
+ themeVariableKeys = variableKeys.length > 0 ? [...variableKeys] : null;
145
+ if (!themeVariableKeys)
146
+ next.applyThemeVariables?.(''); // turned off: the `:root` rule goes away with it
147
+ if (themeVariableKeys && !next.applyThemeVariables) {
148
+ warnOnce('theme-variables-unsupported', `performance.themeVariables only applies on platforms with CSS (the web). In the "${next.name}" provider the tokens stay plain values.`);
149
+ }
150
+ }
151
+ if (native?.remBase !== undefined)
152
+ remBase = native.remBase;
153
+ if (enabled)
154
+ modules = { ...DEFAULT_MODULES, ...enabled };
155
+ if (theme)
156
+ updateTheme(theme);
157
+ // depois do tema inicial: as variáveis já nascem com os valores certos, antes do primeiro render
158
+ if (themeVariableKeys && next.applyThemeVariables)
159
+ syncThemeVariables(next, themeVariableKeys);
160
+ }
161
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1,72 @@
1
+ import type { ComponentType } from 'react';
2
+ import type { ImageCacheApi } from './image';
3
+ import type { PseudoName, StateName } from './types';
4
+ /** Styles per pseudo-element (`'::before'`…), already merged into flat objects. */
5
+ export type PseudoStyles = Partial<Record<PseudoName, Record<string, any>>>;
6
+ /** A style variant for a width range, already merged into a flat object. Sorted by ascending `min`. */
7
+ export interface BreakpointStyle {
8
+ /** The condition as written in `when()` (`'breakpoints:md'`, `'breakpoints:<md'`, `'breakpoints:sm..lg'`). */
9
+ name: string;
10
+ /** Minimum width in px (mobile-first); `0` for `'<md'`. */
11
+ min: number;
12
+ /** Maximum width in px, EXCLUSIVE (only for `'<md'` and `'sm..lg'`). */
13
+ max?: number;
14
+ /** Global position of the range (keeps CSS rule order stable across components; ranges with `max` come later). */
15
+ order: number;
16
+ /** The style applied inside the range. */
17
+ style: Record<string, any>;
18
+ }
19
+ /** Styles per interaction state (`'hover'`, `'pressed'`…), already merged into flat objects. */
20
+ export type StateStyles = Partial<Record<StateName, Record<string, any>>>;
21
+ /** Input of {@link PlatformAdapter.applyProps}, built by the core on every render. */
22
+ export interface ApplyPropsInput {
23
+ /** Primitive name (`'Box'`, `'Pressable'`…), or `undefined` for arbitrary components (`engine(MyComponent)`). */
24
+ primitive?: string;
25
+ /** The result of {@link PlatformAdapter.compileStyle} (already cached by the core). */
26
+ compiled: unknown;
27
+ /** Props from `attrs`/`when` merged with the user's props, WITHOUT `style`. */
28
+ props: Record<string, any>;
29
+ /** The `style` prop the user passed when rendering the component. */
30
+ userStyle: unknown;
31
+ }
32
+ /**
33
+ * The contract each platform implements. The core knows nothing about
34
+ * `react-native` or `react-dom`: everything platform-specific goes through here.
35
+ * Pass a custom one to `configure({ provider })` to support another platform.
36
+ */
37
+ export interface PlatformAdapter {
38
+ /** Name matched by `configure({ provider })` (`'react-native'`, `'react'` or a custom one). */
39
+ readonly name: 'react-native' | 'react' | (string & {});
40
+ /** The current OS (`'ios'`, `'android'`, `'web'`…); drives `when('platform:ios' | 'platform:android' | 'platform:web' | 'platform:native')`. */
41
+ os(): string;
42
+ /** Neutral primitive name (`'Box'`) → the platform's real component (`View`, a `<div>`…). */
43
+ readonly primitives: Record<string, ComponentType<any>>;
44
+ /**
45
+ * Turns the merged style (a flat object) into the platform's final form
46
+ * (React Native style objects, atomic CSS classes…). Runs once per
47
+ * (theme, props) combination; the core caches the result.
48
+ */
49
+ compileStyle(style: Record<string, any>, states?: StateStyles, breakpoints?: BreakpointStyle[], pseudos?: PseudoStyles): unknown;
50
+ /**
51
+ * Builds the final props of the underlying component. Runs on every render,
52
+ * so it must be cheap (the heavy work belongs in `compileStyle`).
53
+ */
54
+ applyProps(input: ApplyPropsInput): Record<string, any>;
55
+ /**
56
+ * Optional: swaps the underlying component based on the compiled style (e.g.
57
+ * an animated host on native when there is an `animation`). Must return the
58
+ * SAME reference for the same input, or React remounts the tree.
59
+ */
60
+ resolveComponent?(component: ComponentType<any>, compiled: unknown): ComponentType<any>;
61
+ /**
62
+ * Optional, CSS platforms only: receives the `:root{--iso-…}` rule that carries the theme values, on every
63
+ * theme change. Its presence is what lets `configure({ performance: { themeVariables } })` turn tokens into
64
+ * `var(--iso-…)`; a platform without it keeps resolving tokens to values.
65
+ */
66
+ applyThemeVariables?(css: string): void;
67
+ /** Server-side rendering: the CSS generated so far (only platforms that generate CSS). */
68
+ getStyleText?(): string;
69
+ /** Optional: the image cache behind `prefetchImages` and `clearImageCache` (the `image` module). */
70
+ readonly images?: ImageCacheApi;
71
+ }
72
+ //# sourceMappingURL=adapter.d.ts.map
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=adapter.js.map
@@ -0,0 +1,95 @@
1
+ import React from 'react';
2
+ import type { Condition, EngineComponent, StyleContext, StyleOrFn } from './types';
3
+ /**
4
+ * Regra interna do builder:
5
+ * - style: define estilos
6
+ * - when: atributos/estilos condicionais
7
+ * - attrs: props fixas
8
+ */
9
+ type Rule<C extends React.ComponentType<any>, P> = {
10
+ kind: 'style';
11
+ style: StyleOrFn<C, P>;
12
+ } | {
13
+ kind: 'when';
14
+ condition: Condition<P, StyleContext<P>>;
15
+ attrs?: Partial<React.ComponentPropsWithRef<C> & P> | ((ctx: StyleContext<P>) => Partial<React.ComponentPropsWithRef<C> & P>);
16
+ } | {
17
+ kind: 'attrs';
18
+ attrs: Partial<React.ComponentPropsWithRef<C> & P>;
19
+ };
20
+ /**
21
+ * Base do componente: um nome de primitiva (`'Box'`, resolvido no render pelo
22
+ * provedor ativo) ou qualquer componente React.
23
+ */
24
+ export type BaseComponent<C> = C | string;
25
+ export declare class StylizedBuilder<C extends React.ComponentType<any>, P extends object> {
26
+ private readonly Base;
27
+ private rules;
28
+ /** Cache por tema → (hash das props → resultado compilado). */
29
+ private cacheByTheme;
30
+ /**
31
+ * Props que as regras já leram. Só elas entram no hash: o resto (`testID`, `onPress`…) não muda o estilo.
32
+ * Cresce no primeiro cache miss que lê uma prop nova; nesse momento o cache é zerado (ver `learn`).
33
+ */
34
+ private readKeys;
35
+ /** Alguma regra enumerou as props (`{ ...props }`): não dá para saber quais contam, então todas contam. */
36
+ private readAll;
37
+ private readonly id;
38
+ /**
39
+ * `true` once a style rule read a real value from the theme (with `themeVariables` on, a value that is
40
+ * not a CSS variable). Until then the styles do not depend on the theme: the cache is shared by every
41
+ * theme and a theme switch does not re-render the component.
42
+ * Sticky: when it flips, the caches built under "any theme" are dropped (see `resolveDynamic`).
43
+ */
44
+ private themeDependent;
45
+ /** The variable keys `themeDependent` was learned under; a different `configure` starts over. */
46
+ private variablesSignature;
47
+ constructor(Base: BaseComponent<C>, baseRules?: Rule<C, P>[]);
48
+ /** Adiciona uma regra de estilo (objeto ou função de `{ theme, props, platform }`). */
49
+ style(styleOrFn: StyleOrFn<C, P>): this;
50
+ /**
51
+ * Adiciona uma regra condicional.
52
+ *
53
+ * @example when('platform:ios', { style: { shadowOpacity: 0.2 } })
54
+ * @example when('props:variant=primary', { style: { backgroundColor: 'blue' } })
55
+ * @example when(({ props }) => props.size > 40, { style: { opacity: 0.5 } })
56
+ */
57
+ when(condition: Condition<P, StyleContext<P>>, attrs?: Partial<React.ComponentPropsWithRef<C> & P> | ((ctx: StyleContext<P>) => Partial<React.ComponentPropsWithRef<C> & P>)): this;
58
+ /** Adiciona props fixas (acessibilidade, testID, roles…). */
59
+ attrs(attrs: Partial<React.ComponentPropsWithRef<C> & P>): this;
60
+ /** "Clona + adiciona": copia as regras atuais sem alterar o original. */
61
+ extend(): StylizedBuilder<C, P>;
62
+ /** Roda as regras para um contexto, produzindo estilo mesclado + attrs. */
63
+ private computeFromRules;
64
+ /**
65
+ * `true` quando nenhuma regra depende de props — o resultado só varia por
66
+ * tema e dispensa hash/lookup por render.
67
+ */
68
+ private isStatic;
69
+ /** `ref` estático vindo de `when(...).attrs({ ref })` (independe de props/tema). */
70
+ private findStaticRef;
71
+ /**
72
+ * `build()` roda uma vez, antes do encadeamento `.style().when().attrs()`
73
+ * (as regras são mutadas depois e lidas ao vivo pelo render — ver proxy.ts).
74
+ * Por isso `isStatic`/`findStaticRef` são memoizados aqui, invalidados só
75
+ * quando a lista de regras cresce.
76
+ */
77
+ private staticInfoCache;
78
+ private getStaticInfo;
79
+ /** Registra o que uma compilação leu. `true` quando passou a depender de props que o hash ainda não via. */
80
+ private learn;
81
+ private hashOf;
82
+ /** Theme cache key: the theme itself, or `ANY_THEME` while the style never read a real theme value. */
83
+ private cacheKey;
84
+ /** Estilo dinâmico: cache por tema, chaveado pelas props que as regras leem. */
85
+ private resolveDynamic;
86
+ /** A function marked theme-free read the theme: rendered inline, the component cannot follow theme switches. */
87
+ private warnThemeFreeRead;
88
+ /** O aviso de thrash já foi decidido para este builder (a mensagem não é montada a cada miss). */
89
+ private thrashWarned;
90
+ private warnThrashing;
91
+ build(): EngineComponent<C, P>;
92
+ }
93
+ export declare function stylized<C extends React.ComponentType<any>>(component: BaseComponent<C>): StylizedBuilder<C, {}>;
94
+ export {};
95
+ //# sourceMappingURL=builder.d.ts.map