one 2.6.18 → 2.6.20

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 (294) hide show
  1. package/One.podspec +2 -0
  2. package/android/src/main/java/com/margelo/nitro/one/HybridOneDevice.kt +124 -0
  3. package/android/src/main/java/com/margelo/nitro/one/HybridOneHaptics.kt +31 -0
  4. package/android/src/main/java/com/margelo/nitro/one/HybridOneImageManipulator.kt +25 -5
  5. package/android/src/main/java/com/margelo/nitro/one/HybridOneKeepAwake.kt +34 -9
  6. package/android/src/main/java/com/margelo/nitro/one/HybridOneSecureStore.kt +269 -78
  7. package/dist/cjs/index.cjs +3 -0
  8. package/dist/cjs/index.native.cjs +3 -0
  9. package/dist/cjs/index.native.js +3 -0
  10. package/dist/cjs/index.native.js.map +1 -1
  11. package/dist/cjs/one.cjs +1 -0
  12. package/dist/cjs/one.native.cjs +1 -0
  13. package/dist/cjs/one.native.js +1 -0
  14. package/dist/cjs/one.native.js.map +1 -1
  15. package/dist/cjs/platform/extras.cjs +4 -0
  16. package/dist/cjs/platform/extras.native.cjs +4 -0
  17. package/dist/cjs/platform/extras.native.js +4 -0
  18. package/dist/cjs/platform/extras.native.js.map +1 -1
  19. package/dist/cjs/platform/haptics/index.cjs +3 -0
  20. package/dist/cjs/platform/haptics/index.native.cjs +4 -0
  21. package/dist/cjs/platform/haptics/index.native.js +4 -0
  22. package/dist/cjs/platform/haptics/index.native.js.map +1 -1
  23. package/dist/cjs/platform/haptics/validation.cjs +28 -0
  24. package/dist/cjs/platform/haptics/validation.native.cjs +28 -0
  25. package/dist/cjs/platform/haptics/validation.native.js +28 -0
  26. package/dist/cjs/platform/haptics/validation.native.js.map +1 -1
  27. package/dist/cjs/platform/image-manipulator/index.cjs +10 -3
  28. package/dist/cjs/platform/image-manipulator/index.native.cjs +1 -0
  29. package/dist/cjs/platform/image-manipulator/index.native.js +1 -0
  30. package/dist/cjs/platform/image-manipulator/index.native.js.map +1 -1
  31. package/dist/cjs/platform/index.cjs +1 -0
  32. package/dist/cjs/platform/index.native.cjs +1 -0
  33. package/dist/cjs/platform/index.native.js +1 -0
  34. package/dist/cjs/platform/index.native.js.map +1 -1
  35. package/dist/cjs/platform/keep-awake/index.cjs +53 -14
  36. package/dist/cjs/platform/keep-awake/index.native.cjs +29 -2
  37. package/dist/cjs/platform/keep-awake/index.native.js +29 -2
  38. package/dist/cjs/platform/keep-awake/index.native.js.map +1 -1
  39. package/dist/cjs/platform/keep-awake/unavailable.cjs +11 -1
  40. package/dist/cjs/platform/keep-awake/unavailable.native.cjs +11 -1
  41. package/dist/cjs/platform/keep-awake/unavailable.native.js +11 -1
  42. package/dist/cjs/platform/keep-awake/unavailable.native.js.map +1 -1
  43. package/dist/cjs/platform/keep-awake/validate.cjs +15 -1
  44. package/dist/cjs/platform/keep-awake/validate.native.cjs +15 -1
  45. package/dist/cjs/platform/keep-awake/validate.native.js +15 -1
  46. package/dist/cjs/platform/keep-awake/validate.native.js.map +1 -1
  47. package/dist/cjs/platform/localization/index.cjs +100 -0
  48. package/dist/cjs/platform/localization/index.native.cjs +71 -0
  49. package/dist/cjs/platform/localization/index.native.js +73 -0
  50. package/dist/cjs/platform/localization/index.native.js.map +1 -0
  51. package/dist/cjs/platform/localization/map.cjs +86 -0
  52. package/dist/cjs/platform/localization/map.native.cjs +90 -0
  53. package/dist/cjs/platform/localization/map.native.js +92 -0
  54. package/dist/cjs/platform/localization/map.native.js.map +1 -0
  55. package/dist/cjs/platform/localization/types.cjs +16 -0
  56. package/dist/cjs/platform/localization/types.native.cjs +18 -0
  57. package/dist/cjs/platform/localization/types.native.js +20 -0
  58. package/dist/cjs/platform/localization/types.native.js.map +1 -0
  59. package/dist/cjs/platform/secure-store/index.cjs +12 -6
  60. package/dist/cjs/platform/secure-store/index.native.cjs +18 -12
  61. package/dist/cjs/platform/secure-store/index.native.js +18 -12
  62. package/dist/cjs/platform/secure-store/index.native.js.map +1 -1
  63. package/dist/cjs/platform/secure-store/types.cjs +16 -0
  64. package/dist/cjs/platform/secure-store/types.native.cjs +18 -0
  65. package/dist/cjs/platform/secure-store/types.native.js +20 -0
  66. package/dist/cjs/platform/secure-store/types.native.js.map +1 -0
  67. package/dist/cjs/platform/secure-store/validate.cjs +34 -0
  68. package/dist/cjs/platform/secure-store/validate.native.cjs +34 -0
  69. package/dist/cjs/platform/secure-store/validate.native.js +34 -0
  70. package/dist/cjs/platform/secure-store/validate.native.js.map +1 -1
  71. package/dist/esm/index.js +2 -2
  72. package/dist/esm/index.mjs +2 -2
  73. package/dist/esm/index.native.js +2 -2
  74. package/dist/esm/one.mjs +2 -1
  75. package/dist/esm/one.mjs.map +1 -1
  76. package/dist/esm/one.native.js +2 -1
  77. package/dist/esm/one.native.js.map +1 -1
  78. package/dist/esm/platform/extras.mjs +2 -1
  79. package/dist/esm/platform/extras.native.js +2 -1
  80. package/dist/esm/platform/haptics/index.mjs +4 -1
  81. package/dist/esm/platform/haptics/index.mjs.map +1 -1
  82. package/dist/esm/platform/haptics/index.native.js +5 -1
  83. package/dist/esm/platform/haptics/index.native.js.map +1 -1
  84. package/dist/esm/platform/haptics/validation.mjs +27 -1
  85. package/dist/esm/platform/haptics/validation.mjs.map +1 -1
  86. package/dist/esm/platform/haptics/validation.native.js +27 -1
  87. package/dist/esm/platform/haptics/validation.native.js.map +1 -1
  88. package/dist/esm/platform/image-manipulator/index.mjs +10 -3
  89. package/dist/esm/platform/image-manipulator/index.mjs.map +1 -1
  90. package/dist/esm/platform/image-manipulator/index.native.js +1 -0
  91. package/dist/esm/platform/image-manipulator/index.native.js.map +1 -1
  92. package/dist/esm/platform/index.mjs +2 -2
  93. package/dist/esm/platform/index.mjs.map +1 -1
  94. package/dist/esm/platform/index.native.js +2 -2
  95. package/dist/esm/platform/index.native.js.map +1 -1
  96. package/dist/esm/platform/keep-awake/index.mjs +51 -15
  97. package/dist/esm/platform/keep-awake/index.mjs.map +1 -1
  98. package/dist/esm/platform/keep-awake/index.native.js +27 -3
  99. package/dist/esm/platform/keep-awake/index.native.js.map +1 -1
  100. package/dist/esm/platform/keep-awake/unavailable.mjs +12 -2
  101. package/dist/esm/platform/keep-awake/unavailable.mjs.map +1 -1
  102. package/dist/esm/platform/keep-awake/unavailable.native.js +12 -2
  103. package/dist/esm/platform/keep-awake/unavailable.native.js.map +1 -1
  104. package/dist/esm/platform/keep-awake/validate.mjs +10 -1
  105. package/dist/esm/platform/keep-awake/validate.mjs.map +1 -1
  106. package/dist/esm/platform/keep-awake/validate.native.js +10 -1
  107. package/dist/esm/platform/keep-awake/validate.native.js.map +1 -1
  108. package/dist/esm/platform/localization/index.mjs +77 -0
  109. package/dist/esm/platform/localization/index.mjs.map +1 -0
  110. package/dist/esm/platform/localization/index.native.js +46 -0
  111. package/dist/esm/platform/localization/index.native.js.map +1 -0
  112. package/dist/esm/platform/localization/map.mjs +59 -0
  113. package/dist/esm/platform/localization/map.mjs.map +1 -0
  114. package/dist/esm/platform/localization/map.native.js +61 -0
  115. package/dist/esm/platform/localization/map.native.js.map +1 -0
  116. package/dist/esm/platform/localization/types.mjs +0 -0
  117. package/dist/esm/platform/localization/types.native.js +0 -0
  118. package/dist/esm/platform/secure-store/index.mjs +13 -7
  119. package/dist/esm/platform/secure-store/index.mjs.map +1 -1
  120. package/dist/esm/platform/secure-store/index.native.js +19 -13
  121. package/dist/esm/platform/secure-store/index.native.js.map +1 -1
  122. package/dist/esm/platform/secure-store/types.mjs +0 -0
  123. package/dist/esm/platform/secure-store/types.native.js +0 -0
  124. package/dist/esm/platform/secure-store/validate.mjs +33 -1
  125. package/dist/esm/platform/secure-store/validate.mjs.map +1 -1
  126. package/dist/esm/platform/secure-store/validate.native.js +33 -1
  127. package/dist/esm/platform/secure-store/validate.native.js.map +1 -1
  128. package/ios/Nitro/HybridOneDevice.swift +117 -0
  129. package/ios/Nitro/HybridOneHaptics.swift +4 -0
  130. package/ios/Nitro/HybridOneImageManipulator.swift +25 -8
  131. package/ios/Nitro/HybridOneKeepAwake.swift +34 -2
  132. package/ios/Nitro/HybridOneSecureStore.swift +112 -46
  133. package/ios/Tests/ImageManipulator/Package.swift +12 -0
  134. package/ios/Tests/ImageManipulator/README.md +21 -0
  135. package/ios/Tests/ImageManipulator/Sources/NitroModules/Promise.swift +33 -0
  136. package/ios/Tests/ImageManipulator/Sources/OneImageManipulatorCore/Types.swift +41 -0
  137. package/ios/Tests/ImageManipulator/Sources/SDWebImageWebPCoder/SDImageWebPCoder.swift +23 -0
  138. package/nitrogen/generated/android/c++/JAndroidHaptic.hpp +109 -0
  139. package/nitrogen/generated/android/c++/JCalendarInfo.hpp +70 -0
  140. package/nitrogen/generated/android/c++/JHapticImpact.hpp +3 -3
  141. package/nitrogen/generated/android/c++/JHybridOneDeviceSpec.cpp +52 -0
  142. package/nitrogen/generated/android/c++/JHybridOneDeviceSpec.hpp +3 -0
  143. package/nitrogen/generated/android/c++/JHybridOneHapticsSpec.cpp +8 -0
  144. package/nitrogen/generated/android/c++/JHybridOneHapticsSpec.hpp +1 -0
  145. package/nitrogen/generated/android/c++/JHybridOneImageManipulatorSpec.cpp +5 -1
  146. package/nitrogen/generated/android/c++/JHybridOneKeepAwakeSpec.cpp +31 -0
  147. package/nitrogen/generated/android/c++/JHybridOneKeepAwakeSpec.hpp +2 -0
  148. package/nitrogen/generated/android/c++/JHybridOneSecureStoreSpec.cpp +26 -19
  149. package/nitrogen/generated/android/c++/JHybridOneSecureStoreSpec.hpp +6 -6
  150. package/nitrogen/generated/android/c++/JImageTransformOptions.hpp +7 -1
  151. package/nitrogen/generated/android/c++/JLocaleInfo.hpp +110 -0
  152. package/nitrogen/generated/android/c++/JOneImageFlip.hpp +58 -0
  153. package/nitrogen/generated/android/c++/JOneImageFormat.hpp +3 -0
  154. package/nitrogen/generated/android/c++/JSecureStoreAccessibility.hpp +73 -0
  155. package/nitrogen/generated/android/c++/JSecureStoreOptions.hpp +76 -0
  156. package/nitrogen/generated/android/kotlin/com/margelo/nitro/one/AndroidHaptic.kt +40 -0
  157. package/nitrogen/generated/android/kotlin/com/margelo/nitro/one/CalendarInfo.kt +66 -0
  158. package/nitrogen/generated/android/kotlin/com/margelo/nitro/one/HapticImpact.kt +2 -2
  159. package/nitrogen/generated/android/kotlin/com/margelo/nitro/one/HybridOneDeviceSpec.kt +17 -0
  160. package/nitrogen/generated/android/kotlin/com/margelo/nitro/one/HybridOneHapticsSpec.kt +4 -0
  161. package/nitrogen/generated/android/kotlin/com/margelo/nitro/one/HybridOneKeepAwakeSpec.kt +8 -0
  162. package/nitrogen/generated/android/kotlin/com/margelo/nitro/one/HybridOneSecureStoreSpec.kt +6 -6
  163. package/nitrogen/generated/android/kotlin/com/margelo/nitro/one/ImageTransformOptions.kt +7 -2
  164. package/nitrogen/generated/android/kotlin/com/margelo/nitro/one/LocaleInfo.kt +116 -0
  165. package/nitrogen/generated/android/kotlin/com/margelo/nitro/one/OneImageFlip.kt +23 -0
  166. package/nitrogen/generated/android/kotlin/com/margelo/nitro/one/OneImageFormat.kt +2 -1
  167. package/nitrogen/generated/android/kotlin/com/margelo/nitro/one/SecureStoreAccessibility.kt +28 -0
  168. package/nitrogen/generated/android/kotlin/com/margelo/nitro/one/SecureStoreOptions.kt +71 -0
  169. package/nitrogen/generated/ios/One-Swift-Cxx-Bridge.hpp +133 -51
  170. package/nitrogen/generated/ios/One-Swift-Cxx-Umbrella.hpp +19 -1
  171. package/nitrogen/generated/ios/c++/HybridOneDeviceSpecSwift.hpp +31 -0
  172. package/nitrogen/generated/ios/c++/HybridOneHapticsSpecSwift.hpp +9 -0
  173. package/nitrogen/generated/ios/c++/HybridOneImageManipulatorSpecSwift.hpp +4 -1
  174. package/nitrogen/generated/ios/c++/HybridOneKeepAwakeSpecSwift.hpp +18 -1
  175. package/nitrogen/generated/ios/c++/HybridOneSecureStoreSpecSwift.hpp +18 -13
  176. package/nitrogen/generated/ios/swift/AndroidHaptic.swift +108 -0
  177. package/nitrogen/generated/ios/swift/CalendarInfo.swift +96 -0
  178. package/nitrogen/generated/ios/swift/HapticImpact.swift +4 -4
  179. package/nitrogen/generated/ios/swift/HybridOneDeviceSpec.swift +3 -0
  180. package/nitrogen/generated/ios/swift/HybridOneDeviceSpec_cxx.swift +56 -0
  181. package/nitrogen/generated/ios/swift/HybridOneHapticsSpec.swift +1 -0
  182. package/nitrogen/generated/ios/swift/HybridOneHapticsSpec_cxx.swift +11 -0
  183. package/nitrogen/generated/ios/swift/HybridOneKeepAwakeSpec.swift +3 -1
  184. package/nitrogen/generated/ios/swift/HybridOneKeepAwakeSpec_cxx.swift +41 -3
  185. package/nitrogen/generated/ios/swift/HybridOneSecureStoreSpec.swift +6 -6
  186. package/nitrogen/generated/ios/swift/HybridOneSecureStoreSpec_cxx.swift +12 -12
  187. package/nitrogen/generated/ios/swift/ImageTransformOptions.swift +16 -5
  188. package/nitrogen/generated/ios/swift/LocaleInfo.swift +250 -0
  189. package/nitrogen/generated/ios/swift/OneImageFlip.swift +40 -0
  190. package/nitrogen/generated/ios/swift/OneImageFormat.swift +4 -0
  191. package/nitrogen/generated/ios/swift/SecureStoreAccessibility.swift +60 -0
  192. package/nitrogen/generated/ios/swift/SecureStoreOptions.swift +107 -0
  193. package/nitrogen/generated/shared/c++/AndroidHaptic.hpp +144 -0
  194. package/nitrogen/generated/shared/c++/CalendarInfo.hpp +96 -0
  195. package/nitrogen/generated/shared/c++/HapticImpact.hpp +5 -5
  196. package/nitrogen/generated/shared/c++/HybridOneDeviceSpec.cpp +3 -0
  197. package/nitrogen/generated/shared/c++/HybridOneDeviceSpec.hpp +11 -0
  198. package/nitrogen/generated/shared/c++/HybridOneHapticsSpec.cpp +1 -0
  199. package/nitrogen/generated/shared/c++/HybridOneHapticsSpec.hpp +4 -0
  200. package/nitrogen/generated/shared/c++/HybridOneKeepAwakeSpec.cpp +2 -0
  201. package/nitrogen/generated/shared/c++/HybridOneKeepAwakeSpec.hpp +4 -1
  202. package/nitrogen/generated/shared/c++/HybridOneSecureStoreSpec.hpp +9 -7
  203. package/nitrogen/generated/shared/c++/ImageTransformOptions.hpp +8 -1
  204. package/nitrogen/generated/shared/c++/LocaleInfo.hpp +136 -0
  205. package/nitrogen/generated/shared/c++/OneImageFlip.hpp +76 -0
  206. package/nitrogen/generated/shared/c++/OneImageFormat.hpp +4 -0
  207. package/nitrogen/generated/shared/c++/SecureStoreAccessibility.hpp +96 -0
  208. package/nitrogen/generated/shared/c++/SecureStoreOptions.hpp +102 -0
  209. package/package.json +15 -15
  210. package/src/index.ts +3 -0
  211. package/src/one.test.ts +2 -0
  212. package/src/one.ts +3 -0
  213. package/src/platform/extras.ts +3 -0
  214. package/src/platform/haptics/index.native.ts +13 -3
  215. package/src/platform/haptics/index.ts +12 -3
  216. package/src/platform/haptics/types.ts +25 -0
  217. package/src/platform/haptics/validation.ts +31 -1
  218. package/src/platform/image-manipulator/index.native.ts +3 -0
  219. package/src/platform/image-manipulator/index.ts +10 -3
  220. package/src/platform/index.native.ts +3 -2
  221. package/src/platform/index.ts +3 -2
  222. package/src/platform/keep-awake/index.native.ts +31 -2
  223. package/src/platform/keep-awake/index.ts +66 -17
  224. package/src/platform/keep-awake/unavailable.ts +12 -2
  225. package/src/platform/keep-awake/validate.ts +16 -0
  226. package/src/platform/localization/index.native.ts +47 -0
  227. package/src/platform/localization/index.ts +90 -0
  228. package/src/platform/localization/map.ts +77 -0
  229. package/src/platform/localization/types.ts +36 -0
  230. package/src/platform/secure-store/index.native.ts +26 -13
  231. package/src/platform/secure-store/index.ts +20 -7
  232. package/src/platform/secure-store/types.ts +33 -0
  233. package/src/platform/secure-store/validate.ts +48 -0
  234. package/src/platform/specs/OneDevice.nitro.ts +34 -0
  235. package/src/platform/specs/OneHaptics.nitro.ts +4 -1
  236. package/src/platform/specs/OneImageManipulator.nitro.ts +4 -1
  237. package/src/platform/specs/OneKeepAwake.nitro.ts +2 -0
  238. package/src/platform/specs/OneSecureStore.nitro.ts +12 -8
  239. package/types/index.d.ts +1 -1
  240. package/types/index.d.ts.map +1 -1
  241. package/types/one.d.ts +2 -1
  242. package/types/one.d.ts.map +1 -1
  243. package/types/platform/extras.d.ts +3 -0
  244. package/types/platform/extras.d.ts.map +1 -1
  245. package/types/platform/haptics/index.d.ts +2 -2
  246. package/types/platform/haptics/index.d.ts.map +1 -1
  247. package/types/platform/haptics/index.native.d.ts +2 -2
  248. package/types/platform/haptics/index.native.d.ts.map +1 -1
  249. package/types/platform/haptics/types.d.ts +3 -0
  250. package/types/platform/haptics/types.d.ts.map +1 -1
  251. package/types/platform/haptics/validation.d.ts +3 -1
  252. package/types/platform/haptics/validation.d.ts.map +1 -1
  253. package/types/platform/image-manipulator/index.d.ts +1 -1
  254. package/types/platform/image-manipulator/index.d.ts.map +1 -1
  255. package/types/platform/image-manipulator/index.native.d.ts +1 -1
  256. package/types/platform/image-manipulator/index.native.d.ts.map +1 -1
  257. package/types/platform/index.d.ts +3 -3
  258. package/types/platform/index.d.ts.map +1 -1
  259. package/types/platform/index.native.d.ts +3 -3
  260. package/types/platform/index.native.d.ts.map +1 -1
  261. package/types/platform/keep-awake/index.d.ts +3 -0
  262. package/types/platform/keep-awake/index.d.ts.map +1 -1
  263. package/types/platform/keep-awake/index.native.d.ts +5 -0
  264. package/types/platform/keep-awake/index.native.d.ts.map +1 -1
  265. package/types/platform/keep-awake/unavailable.d.ts +4 -0
  266. package/types/platform/keep-awake/unavailable.d.ts.map +1 -1
  267. package/types/platform/keep-awake/validate.d.ts +3 -0
  268. package/types/platform/keep-awake/validate.d.ts.map +1 -1
  269. package/types/platform/localization/index.d.ts +7 -0
  270. package/types/platform/localization/index.d.ts.map +1 -0
  271. package/types/platform/localization/index.native.d.ts +7 -0
  272. package/types/platform/localization/index.native.d.ts.map +1 -0
  273. package/types/platform/localization/map.d.ts +9 -0
  274. package/types/platform/localization/map.d.ts.map +1 -0
  275. package/types/platform/localization/types.d.ts +31 -0
  276. package/types/platform/localization/types.d.ts.map +1 -0
  277. package/types/platform/secure-store/index.d.ts +8 -7
  278. package/types/platform/secure-store/index.d.ts.map +1 -1
  279. package/types/platform/secure-store/index.native.d.ts +8 -7
  280. package/types/platform/secure-store/index.native.d.ts.map +1 -1
  281. package/types/platform/secure-store/types.d.ts +24 -0
  282. package/types/platform/secure-store/types.d.ts.map +1 -0
  283. package/types/platform/secure-store/validate.d.ts +3 -0
  284. package/types/platform/secure-store/validate.d.ts.map +1 -1
  285. package/types/platform/specs/OneDevice.nitro.d.ts +25 -0
  286. package/types/platform/specs/OneDevice.nitro.d.ts.map +1 -1
  287. package/types/platform/specs/OneHaptics.nitro.d.ts +2 -1
  288. package/types/platform/specs/OneHaptics.nitro.d.ts.map +1 -1
  289. package/types/platform/specs/OneImageManipulator.nitro.d.ts +3 -1
  290. package/types/platform/specs/OneImageManipulator.nitro.d.ts.map +1 -1
  291. package/types/platform/specs/OneKeepAwake.nitro.d.ts +2 -0
  292. package/types/platform/specs/OneKeepAwake.nitro.d.ts.map +1 -1
  293. package/types/platform/specs/OneSecureStore.nitro.d.ts +8 -6
  294. package/types/platform/specs/OneSecureStore.nitro.d.ts.map +1 -1
@@ -19,28 +19,67 @@ var __copyProps = (to, from, except, desc) => {
19
19
  };
20
20
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
21
21
  var keep_awake_exports = {};
22
- __export(keep_awake_exports, { KeepAwake: () => KeepAwake });
22
+ __export(keep_awake_exports, {
23
+ KeepAwake: () => KeepAwake,
24
+ useKeepAwake: () => useKeepAwake
25
+ });
23
26
  module.exports = __toCommonJS(keep_awake_exports);
27
+ var import_react = require("react");
24
28
  var import_unavailable = require("./unavailable.cjs");
25
29
  var import_validate = require("./validate.cjs");
30
+ const active = /* @__PURE__ */ new Set();
26
31
  let lock;
27
32
  let operation = Promise.resolve();
33
+ function live() {
34
+ return !!lock && !lock.released;
35
+ }
36
+ function apply(owner) {
37
+ const next = operation.catch(() => {}).then(async () => {
38
+ if (active.size === 0) {
39
+ await lock?.release();
40
+ lock = void 0;
41
+ return;
42
+ }
43
+ if (live()) return;
44
+ if (!navigator.wakeLock) throw new Error(`KeepAwake.${owner}: Screen Wake Lock is unavailable`);
45
+ lock = await navigator.wakeLock.request("screen");
46
+ });
47
+ operation = next;
48
+ return next;
49
+ }
28
50
  const KeepAwake = Object.freeze({
29
- isEnabled: async () => typeof window !== "undefined" && !!lock && !lock.released,
51
+ isEnabled: async () => typeof window !== "undefined" && active.size > 0 && live(),
30
52
  setEnabled: (enabled) => {
31
53
  (0, import_validate.assertKeepAwakeEnabled)(enabled);
32
54
  if (typeof window === "undefined") return import_unavailable.KeepAwake.setEnabled(enabled);
33
- const next = operation.catch(() => {}).then(async () => {
34
- if (!enabled) {
35
- await lock?.release();
36
- lock = void 0;
37
- return;
38
- }
39
- if (lock && !lock.released) return;
40
- if (!navigator.wakeLock) throw new Error("KeepAwake.setEnabled: Screen Wake Lock is unavailable");
41
- lock = await navigator.wakeLock.request("screen");
42
- });
43
- operation = next;
44
- return next;
55
+ if (enabled) active.add((0, import_validate.normalizeKeepAwakeTag)(void 0));
56
+ else active.delete((0, import_validate.normalizeKeepAwakeTag)(void 0));
57
+ return apply("setEnabled");
58
+ },
59
+ activate: (tag) => {
60
+ (0, import_validate.assertKeepAwakeTag)(tag, "activate");
61
+ if (typeof window === "undefined") return import_unavailable.KeepAwake.activate(tag);
62
+ active.add((0, import_validate.normalizeKeepAwakeTag)(tag));
63
+ return apply("activate");
64
+ },
65
+ deactivate: (tag) => {
66
+ (0, import_validate.assertKeepAwakeTag)(tag, "deactivate");
67
+ if (typeof window === "undefined") return import_unavailable.KeepAwake.deactivate(tag);
68
+ active.delete((0, import_validate.normalizeKeepAwakeTag)(tag));
69
+ return apply("deactivate");
45
70
  }
46
71
  });
72
+ function useKeepAwake(tag) {
73
+ const fallback = (0, import_react.useId)();
74
+ (0, import_validate.assertKeepAwakeTag)(tag, "useKeepAwake");
75
+ const effective = tag ?? fallback;
76
+ (0, import_react.useEffect)(() => {
77
+ if (typeof window === "undefined") return;
78
+ KeepAwake.activate(effective).catch((error) => {
79
+ console.error(`Failed to keep the screen awake: ${String(error)}`);
80
+ });
81
+ return () => {
82
+ KeepAwake.deactivate(effective).catch(() => {});
83
+ };
84
+ }, [effective]);
85
+ }
@@ -21,8 +21,12 @@ var __copyProps = (to, from, except, desc) => {
21
21
  };
22
22
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
23
23
  var index_native_exports = {};
24
- __export(index_native_exports, { KeepAwake: () => KeepAwake });
24
+ __export(index_native_exports, {
25
+ KeepAwake: () => KeepAwake,
26
+ useKeepAwake: () => useKeepAwake
27
+ });
25
28
  module.exports = __toCommonJS(index_native_exports);
29
+ var import_react = require("react");
26
30
  var import_react_native_nitro_modules = require("react-native-nitro-modules");
27
31
  var import_nativeError = require("../nativeError.native.js");
28
32
  var import_validate = require("./validate.native.js");
@@ -38,7 +42,30 @@ function setEnabled(enabled) {
38
42
  (0, import_validate.assertKeepAwakeEnabled)(enabled);
39
43
  return native().setEnabled(enabled).catch(import_nativeError.rethrowNativeError);
40
44
  }
45
+ function activate(tag) {
46
+ (0, import_validate.assertKeepAwakeTag)(tag, "activate");
47
+ return native().activate((0, import_validate.normalizeKeepAwakeTag)(tag)).catch(import_nativeError.rethrowNativeError);
48
+ }
49
+ function deactivate(tag) {
50
+ (0, import_validate.assertKeepAwakeTag)(tag, "deactivate");
51
+ return native().deactivate((0, import_validate.normalizeKeepAwakeTag)(tag)).catch(import_nativeError.rethrowNativeError);
52
+ }
53
+ function useKeepAwake(tag) {
54
+ var fallback = (0, import_react.useId)();
55
+ (0, import_validate.assertKeepAwakeTag)(tag, "useKeepAwake");
56
+ var effective = tag !== null && tag !== void 0 ? tag : fallback;
57
+ (0, import_react.useEffect)(function() {
58
+ activate(effective).catch(function(error) {
59
+ console.error(`Failed to keep the screen awake: ${String(error)}`);
60
+ });
61
+ return function() {
62
+ deactivate(effective).catch(function() {});
63
+ };
64
+ }, [effective]);
65
+ }
41
66
  var KeepAwake = Object.freeze({
42
67
  isEnabled,
43
- setEnabled
68
+ setEnabled,
69
+ activate,
70
+ deactivate
44
71
  });
@@ -21,8 +21,12 @@ var __copyProps = (to, from, except, desc) => {
21
21
  };
22
22
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
23
23
  var index_native_exports = {};
24
- __export(index_native_exports, { KeepAwake: () => KeepAwake });
24
+ __export(index_native_exports, {
25
+ KeepAwake: () => KeepAwake,
26
+ useKeepAwake: () => useKeepAwake
27
+ });
25
28
  module.exports = __toCommonJS(index_native_exports);
29
+ var import_react = require("react");
26
30
  var import_react_native_nitro_modules = require("react-native-nitro-modules");
27
31
  var import_nativeError = require("../nativeError.native.js");
28
32
  var import_validate = require("./validate.native.js");
@@ -38,9 +42,32 @@ function setEnabled(enabled) {
38
42
  (0, import_validate.assertKeepAwakeEnabled)(enabled);
39
43
  return native().setEnabled(enabled).catch(import_nativeError.rethrowNativeError);
40
44
  }
45
+ function activate(tag) {
46
+ (0, import_validate.assertKeepAwakeTag)(tag, "activate");
47
+ return native().activate((0, import_validate.normalizeKeepAwakeTag)(tag)).catch(import_nativeError.rethrowNativeError);
48
+ }
49
+ function deactivate(tag) {
50
+ (0, import_validate.assertKeepAwakeTag)(tag, "deactivate");
51
+ return native().deactivate((0, import_validate.normalizeKeepAwakeTag)(tag)).catch(import_nativeError.rethrowNativeError);
52
+ }
53
+ function useKeepAwake(tag) {
54
+ var fallback = (0, import_react.useId)();
55
+ (0, import_validate.assertKeepAwakeTag)(tag, "useKeepAwake");
56
+ var effective = tag !== null && tag !== void 0 ? tag : fallback;
57
+ (0, import_react.useEffect)(function() {
58
+ activate(effective).catch(function(error) {
59
+ console.error(`Failed to keep the screen awake: ${String(error)}`);
60
+ });
61
+ return function() {
62
+ deactivate(effective).catch(function() {});
63
+ };
64
+ }, [effective]);
65
+ }
41
66
  var KeepAwake = Object.freeze({
42
67
  isEnabled,
43
- setEnabled
68
+ setEnabled,
69
+ activate,
70
+ deactivate
44
71
  });
45
72
 
46
73
  //# sourceMappingURL=index.native.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.native.js","names":[],"sources":["cjs/platform/keep-awake/index.native.js"],"sourcesContent":["\"use strict\";\nvar __defProp = Object.defineProperty;\nvar __getOwnPropDesc = Object.getOwnPropertyDescriptor;\nvar __getOwnPropNames = Object.getOwnPropertyNames;\nvar __hasOwnProp = Object.prototype.hasOwnProperty;\nvar __export = (target, all) => {\n for (var name in all)\n __defProp(target, name, { get: all[name], enumerable: true });\n};\nvar __copyProps = (to, from, except, desc) => {\n if (from && typeof from === \"object\" || typeof from === \"function\") {\n for (let key of __getOwnPropNames(from))\n if (!__hasOwnProp.call(to, key) && key !== except)\n __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });\n }\n return to;\n};\nvar __toCommonJS = (mod) => __copyProps(__defProp({}, \"__esModule\", { value: true }), mod);\nvar index_native_exports = {};\n__export(index_native_exports, {\n KeepAwake: () => KeepAwake\n});\nmodule.exports = __toCommonJS(index_native_exports);\nvar import_react_native_nitro_modules = require(\"react-native-nitro-modules\");\nvar import_nativeError = require(\"../nativeError\");\nvar import_validate = require(\"./validate\");\nvar hybrid;\nfunction native() {\n hybrid !== null && hybrid !== void 0 ? hybrid : hybrid = import_react_native_nitro_modules.NitroModules.createHybridObject(\"OneKeepAwake\");\n return hybrid;\n}\nfunction isEnabled() {\n return native().isEnabled().catch(import_nativeError.rethrowNativeError);\n}\nfunction setEnabled(enabled) {\n (0, import_validate.assertKeepAwakeEnabled)(enabled);\n return native().setEnabled(enabled).catch(import_nativeError.rethrowNativeError);\n}\nvar KeepAwake = Object.freeze({\n isEnabled,\n setEnabled\n});\n//# sourceMappingURL=index.native.js.map\n"],"mappings":";;;AACA,IAAI,YAAY,OAAO;AACvB,IAAI,mBAAmB,OAAO;AAC9B,IAAI,oBAAoB,OAAO;AAC/B,IAAI,eAAe,OAAO,UAAU;AACpC,IAAI,YAAY,QAAQ,QAAQ;CAC9B,KAAK,IAAI,QAAQ,KACf,UAAU,QAAQ,MAAM;EAAE,KAAK,IAAI;EAAO,YAAY;CAAK,CAAC;AAChE;AACA,IAAI,eAAe,IAAI,MAAM,QAAQ,SAAS;CAC5C,IAAI,QAAQ,OAAO,SAAS,YAAY,OAAO,SAAS,YAAY;EAClE,KAAK,IAAI,OAAO,kBAAkB,IAAI,GACpC,IAAI,CAAC,aAAa,KAAK,IAAI,GAAG,KAAK,QAAQ,QACzC,UAAU,IAAI,KAAK;GAAE,WAAW,KAAK;GAAM,YAAY,EAAE,OAAO,iBAAiB,MAAM,GAAG,MAAM,KAAK;EAAW,CAAC;CACvH;CACA,OAAO;AACT;AACA,IAAI,gBAAgB,QAAQ,YAAY,UAAU,CAAC,GAAG,cAAc,EAAE,OAAO,KAAK,CAAC,GAAG,GAAG;AACzF,IAAI,uBAAuB,CAAC;AAC5B,SAAS,sBAAsB,EAC7B,iBAAiB,UACnB,CAAC;AACD,OAAO,UAAU,aAAa,oBAAoB;AAClD,IAAI,oCAAoC,QAAQ,4BAA4B;AAC5E,IAAI,qBAAqB,QAAQ,0BAAgB;AACjD,IAAI,kBAAkB,QAAQ,sBAAY;AAC1C,IAAI;AACJ,SAAS,SAAS;CAChB,WAAW,QAAQ,WAAW,KAAK,IAAI,SAAS,SAAS,kCAAkC,aAAa,mBAAmB,cAAc;CACzI,OAAO;AACT;AACA,SAAS,YAAY;CACnB,OAAO,OAAO,CAAC,CAAC,UAAU,CAAC,CAAC,MAAM,mBAAmB,kBAAkB;AACzE;AACA,SAAS,WAAW,SAAS;CAC3B,CAAC,GAAG,gBAAgB,uBAAsB,CAAE,OAAO;CACnD,OAAO,OAAO,CAAC,CAAC,WAAW,OAAO,CAAC,CAAC,MAAM,mBAAmB,kBAAkB;AACjF;AACA,IAAI,YAAY,OAAO,OAAO;CAC5B;CACA;AACF,CAAC"}
1
+ {"version":3,"file":"index.native.js","names":[],"sources":["cjs/platform/keep-awake/index.native.js"],"sourcesContent":["\"use strict\";\nvar __defProp = Object.defineProperty;\nvar __getOwnPropDesc = Object.getOwnPropertyDescriptor;\nvar __getOwnPropNames = Object.getOwnPropertyNames;\nvar __hasOwnProp = Object.prototype.hasOwnProperty;\nvar __export = (target, all) => {\n for (var name in all)\n __defProp(target, name, { get: all[name], enumerable: true });\n};\nvar __copyProps = (to, from, except, desc) => {\n if (from && typeof from === \"object\" || typeof from === \"function\") {\n for (let key of __getOwnPropNames(from))\n if (!__hasOwnProp.call(to, key) && key !== except)\n __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });\n }\n return to;\n};\nvar __toCommonJS = (mod) => __copyProps(__defProp({}, \"__esModule\", { value: true }), mod);\nvar index_native_exports = {};\n__export(index_native_exports, {\n KeepAwake: () => KeepAwake,\n useKeepAwake: () => useKeepAwake\n});\nmodule.exports = __toCommonJS(index_native_exports);\nvar import_react = require(\"react\");\nvar import_react_native_nitro_modules = require(\"react-native-nitro-modules\");\nvar import_nativeError = require(\"../nativeError\");\nvar import_validate = require(\"./validate\");\nvar hybrid;\nfunction native() {\n hybrid !== null && hybrid !== void 0 ? hybrid : hybrid = import_react_native_nitro_modules.NitroModules.createHybridObject(\"OneKeepAwake\");\n return hybrid;\n}\nfunction isEnabled() {\n return native().isEnabled().catch(import_nativeError.rethrowNativeError);\n}\nfunction setEnabled(enabled) {\n (0, import_validate.assertKeepAwakeEnabled)(enabled);\n return native().setEnabled(enabled).catch(import_nativeError.rethrowNativeError);\n}\nfunction activate(tag) {\n (0, import_validate.assertKeepAwakeTag)(tag, \"activate\");\n return native().activate((0, import_validate.normalizeKeepAwakeTag)(tag)).catch(import_nativeError.rethrowNativeError);\n}\nfunction deactivate(tag) {\n (0, import_validate.assertKeepAwakeTag)(tag, \"deactivate\");\n return native().deactivate((0, import_validate.normalizeKeepAwakeTag)(tag)).catch(import_nativeError.rethrowNativeError);\n}\nfunction useKeepAwake(tag) {\n var fallback = (0, import_react.useId)();\n (0, import_validate.assertKeepAwakeTag)(tag, \"useKeepAwake\");\n var effective = tag !== null && tag !== void 0 ? tag : fallback;\n (0, import_react.useEffect)(function() {\n activate(effective).catch(function(error) {\n console.error(`Failed to keep the screen awake: ${String(error)}`);\n });\n return function() {\n deactivate(effective).catch(function() {\n });\n };\n }, [\n effective\n ]);\n}\nvar KeepAwake = Object.freeze({\n isEnabled,\n setEnabled,\n activate,\n deactivate\n});\n//# sourceMappingURL=index.native.js.map\n"],"mappings":";;;AACA,IAAI,YAAY,OAAO;AACvB,IAAI,mBAAmB,OAAO;AAC9B,IAAI,oBAAoB,OAAO;AAC/B,IAAI,eAAe,OAAO,UAAU;AACpC,IAAI,YAAY,QAAQ,QAAQ;CAC9B,KAAK,IAAI,QAAQ,KACf,UAAU,QAAQ,MAAM;EAAE,KAAK,IAAI;EAAO,YAAY;CAAK,CAAC;AAChE;AACA,IAAI,eAAe,IAAI,MAAM,QAAQ,SAAS;CAC5C,IAAI,QAAQ,OAAO,SAAS,YAAY,OAAO,SAAS,YAAY;EAClE,KAAK,IAAI,OAAO,kBAAkB,IAAI,GACpC,IAAI,CAAC,aAAa,KAAK,IAAI,GAAG,KAAK,QAAQ,QACzC,UAAU,IAAI,KAAK;GAAE,WAAW,KAAK;GAAM,YAAY,EAAE,OAAO,iBAAiB,MAAM,GAAG,MAAM,KAAK;EAAW,CAAC;CACvH;CACA,OAAO;AACT;AACA,IAAI,gBAAgB,QAAQ,YAAY,UAAU,CAAC,GAAG,cAAc,EAAE,OAAO,KAAK,CAAC,GAAG,GAAG;AACzF,IAAI,uBAAuB,CAAC;AAC5B,SAAS,sBAAsB;CAC7B,iBAAiB;CACjB,oBAAoB;AACtB,CAAC;AACD,OAAO,UAAU,aAAa,oBAAoB;AAClD,IAAI,eAAe,QAAQ,OAAO;AAClC,IAAI,oCAAoC,QAAQ,4BAA4B;AAC5E,IAAI,qBAAqB,QAAQ,0BAAgB;AACjD,IAAI,kBAAkB,QAAQ,sBAAY;AAC1C,IAAI;AACJ,SAAS,SAAS;CAChB,WAAW,QAAQ,WAAW,KAAK,IAAI,SAAS,SAAS,kCAAkC,aAAa,mBAAmB,cAAc;CACzI,OAAO;AACT;AACA,SAAS,YAAY;CACnB,OAAO,OAAO,CAAC,CAAC,UAAU,CAAC,CAAC,MAAM,mBAAmB,kBAAkB;AACzE;AACA,SAAS,WAAW,SAAS;CAC3B,CAAC,GAAG,gBAAgB,uBAAsB,CAAE,OAAO;CACnD,OAAO,OAAO,CAAC,CAAC,WAAW,OAAO,CAAC,CAAC,MAAM,mBAAmB,kBAAkB;AACjF;AACA,SAAS,SAAS,KAAK;CACrB,CAAC,GAAG,gBAAgB,mBAAkB,CAAE,KAAK,UAAU;CACvD,OAAO,OAAO,CAAC,CAAC,UAAU,GAAG,gBAAgB,sBAAqB,CAAE,GAAG,CAAC,CAAC,CAAC,MAAM,mBAAmB,kBAAkB;AACvH;AACA,SAAS,WAAW,KAAK;CACvB,CAAC,GAAG,gBAAgB,mBAAkB,CAAE,KAAK,YAAY;CACzD,OAAO,OAAO,CAAC,CAAC,YAAY,GAAG,gBAAgB,sBAAqB,CAAE,GAAG,CAAC,CAAC,CAAC,MAAM,mBAAmB,kBAAkB;AACzH;AACA,SAAS,aAAa,KAAK;CACzB,IAAI,YAAY,GAAG,aAAa,MAAK,CAAE;CACvC,CAAC,GAAG,gBAAgB,mBAAkB,CAAE,KAAK,cAAc;CAC3D,IAAI,YAAY,QAAQ,QAAQ,QAAQ,KAAK,IAAI,MAAM;CACvD,CAAC,GAAG,aAAa,UAAS,CAAE,WAAW;EACrC,SAAS,SAAS,CAAC,CAAC,MAAM,SAAS,OAAO;GACxC,QAAQ,MAAM,oCAAoC,OAAO,KAAK,GAAG;EACnE,CAAC;EACD,OAAO,WAAW;GAChB,WAAW,SAAS,CAAC,CAAC,MAAM,WAAW,CACvC,CAAC;EACH;CACF,GAAG,CACD,SACF,CAAC;AACH;AACA,IAAI,YAAY,OAAO,OAAO;CAC5B;CACA;CACA;CACA;AACF,CAAC"}
@@ -29,7 +29,17 @@ function setEnabled(enabled) {
29
29
  (0, import_validate.assertKeepAwakeEnabled)(enabled);
30
30
  return Promise.resolve();
31
31
  }
32
+ function activate(tag) {
33
+ (0, import_validate.assertKeepAwakeTag)(tag, "activate");
34
+ return Promise.resolve();
35
+ }
36
+ function deactivate(tag) {
37
+ (0, import_validate.assertKeepAwakeTag)(tag, "deactivate");
38
+ return Promise.resolve();
39
+ }
32
40
  const KeepAwake = Object.freeze({
33
41
  isEnabled,
34
- setEnabled
42
+ setEnabled,
43
+ activate,
44
+ deactivate
35
45
  });
@@ -31,7 +31,17 @@ function setEnabled(enabled) {
31
31
  (0, import_validate.assertKeepAwakeEnabled)(enabled);
32
32
  return Promise.resolve();
33
33
  }
34
+ function activate(tag) {
35
+ (0, import_validate.assertKeepAwakeTag)(tag, "activate");
36
+ return Promise.resolve();
37
+ }
38
+ function deactivate(tag) {
39
+ (0, import_validate.assertKeepAwakeTag)(tag, "deactivate");
40
+ return Promise.resolve();
41
+ }
34
42
  var KeepAwake = Object.freeze({
35
43
  isEnabled,
36
- setEnabled
44
+ setEnabled,
45
+ activate,
46
+ deactivate
37
47
  });
@@ -31,9 +31,19 @@ function setEnabled(enabled) {
31
31
  (0, import_validate.assertKeepAwakeEnabled)(enabled);
32
32
  return Promise.resolve();
33
33
  }
34
+ function activate(tag) {
35
+ (0, import_validate.assertKeepAwakeTag)(tag, "activate");
36
+ return Promise.resolve();
37
+ }
38
+ function deactivate(tag) {
39
+ (0, import_validate.assertKeepAwakeTag)(tag, "deactivate");
40
+ return Promise.resolve();
41
+ }
34
42
  var KeepAwake = Object.freeze({
35
43
  isEnabled,
36
- setEnabled
44
+ setEnabled,
45
+ activate,
46
+ deactivate
37
47
  });
38
48
 
39
49
  //# sourceMappingURL=unavailable.native.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"unavailable.native.js","names":[],"sources":["cjs/platform/keep-awake/unavailable.native.js"],"sourcesContent":["\"use strict\";\nvar __defProp = Object.defineProperty;\nvar __getOwnPropDesc = Object.getOwnPropertyDescriptor;\nvar __getOwnPropNames = Object.getOwnPropertyNames;\nvar __hasOwnProp = Object.prototype.hasOwnProperty;\nvar __export = (target, all) => {\n for (var name in all)\n __defProp(target, name, { get: all[name], enumerable: true });\n};\nvar __copyProps = (to, from, except, desc) => {\n if (from && typeof from === \"object\" || typeof from === \"function\") {\n for (let key of __getOwnPropNames(from))\n if (!__hasOwnProp.call(to, key) && key !== except)\n __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });\n }\n return to;\n};\nvar __toCommonJS = (mod) => __copyProps(__defProp({}, \"__esModule\", { value: true }), mod);\nvar unavailable_exports = {};\n__export(unavailable_exports, {\n KeepAwake: () => KeepAwake\n});\nmodule.exports = __toCommonJS(unavailable_exports);\nvar import_validate = require(\"./validate\");\nfunction isEnabled() {\n return Promise.resolve(false);\n}\nfunction setEnabled(enabled) {\n (0, import_validate.assertKeepAwakeEnabled)(enabled);\n return Promise.resolve();\n}\nvar KeepAwake = Object.freeze({\n isEnabled,\n setEnabled\n});\n//# sourceMappingURL=unavailable.js.map\n"],"mappings":";;;AACA,IAAI,YAAY,OAAO;AACvB,IAAI,mBAAmB,OAAO;AAC9B,IAAI,oBAAoB,OAAO;AAC/B,IAAI,eAAe,OAAO,UAAU;AACpC,IAAI,YAAY,QAAQ,QAAQ;CAC9B,KAAK,IAAI,QAAQ,KACf,UAAU,QAAQ,MAAM;EAAE,KAAK,IAAI;EAAO,YAAY;CAAK,CAAC;AAChE;AACA,IAAI,eAAe,IAAI,MAAM,QAAQ,SAAS;CAC5C,IAAI,QAAQ,OAAO,SAAS,YAAY,OAAO,SAAS,YAAY;EAClE,KAAK,IAAI,OAAO,kBAAkB,IAAI,GACpC,IAAI,CAAC,aAAa,KAAK,IAAI,GAAG,KAAK,QAAQ,QACzC,UAAU,IAAI,KAAK;GAAE,WAAW,KAAK;GAAM,YAAY,EAAE,OAAO,iBAAiB,MAAM,GAAG,MAAM,KAAK;EAAW,CAAC;CACvH;CACA,OAAO;AACT;AACA,IAAI,gBAAgB,QAAQ,YAAY,UAAU,CAAC,GAAG,cAAc,EAAE,OAAO,KAAK,CAAC,GAAG,GAAG;AACzF,IAAI,sBAAsB,CAAC;AAC3B,SAAS,qBAAqB,EAC5B,iBAAiB,UACnB,CAAC;AACD,OAAO,UAAU,aAAa,mBAAmB;AACjD,IAAI,kBAAkB,QAAQ,sBAAY;AAC1C,SAAS,YAAY;CACnB,OAAO,QAAQ,QAAQ,KAAK;AAC9B;AACA,SAAS,WAAW,SAAS;CAC3B,CAAC,GAAG,gBAAgB,uBAAsB,CAAE,OAAO;CACnD,OAAO,QAAQ,QAAQ;AACzB;AACA,IAAI,YAAY,OAAO,OAAO;CAC5B;CACA;AACF,CAAC"}
1
+ {"version":3,"file":"unavailable.native.js","names":[],"sources":["cjs/platform/keep-awake/unavailable.native.js"],"sourcesContent":["\"use strict\";\nvar __defProp = Object.defineProperty;\nvar __getOwnPropDesc = Object.getOwnPropertyDescriptor;\nvar __getOwnPropNames = Object.getOwnPropertyNames;\nvar __hasOwnProp = Object.prototype.hasOwnProperty;\nvar __export = (target, all) => {\n for (var name in all)\n __defProp(target, name, { get: all[name], enumerable: true });\n};\nvar __copyProps = (to, from, except, desc) => {\n if (from && typeof from === \"object\" || typeof from === \"function\") {\n for (let key of __getOwnPropNames(from))\n if (!__hasOwnProp.call(to, key) && key !== except)\n __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });\n }\n return to;\n};\nvar __toCommonJS = (mod) => __copyProps(__defProp({}, \"__esModule\", { value: true }), mod);\nvar unavailable_exports = {};\n__export(unavailable_exports, {\n KeepAwake: () => KeepAwake\n});\nmodule.exports = __toCommonJS(unavailable_exports);\nvar import_validate = require(\"./validate\");\nfunction isEnabled() {\n return Promise.resolve(false);\n}\nfunction setEnabled(enabled) {\n (0, import_validate.assertKeepAwakeEnabled)(enabled);\n return Promise.resolve();\n}\nfunction activate(tag) {\n (0, import_validate.assertKeepAwakeTag)(tag, \"activate\");\n return Promise.resolve();\n}\nfunction deactivate(tag) {\n (0, import_validate.assertKeepAwakeTag)(tag, \"deactivate\");\n return Promise.resolve();\n}\nvar KeepAwake = Object.freeze({\n isEnabled,\n setEnabled,\n activate,\n deactivate\n});\n//# sourceMappingURL=unavailable.js.map\n"],"mappings":";;;AACA,IAAI,YAAY,OAAO;AACvB,IAAI,mBAAmB,OAAO;AAC9B,IAAI,oBAAoB,OAAO;AAC/B,IAAI,eAAe,OAAO,UAAU;AACpC,IAAI,YAAY,QAAQ,QAAQ;CAC9B,KAAK,IAAI,QAAQ,KACf,UAAU,QAAQ,MAAM;EAAE,KAAK,IAAI;EAAO,YAAY;CAAK,CAAC;AAChE;AACA,IAAI,eAAe,IAAI,MAAM,QAAQ,SAAS;CAC5C,IAAI,QAAQ,OAAO,SAAS,YAAY,OAAO,SAAS,YAAY;EAClE,KAAK,IAAI,OAAO,kBAAkB,IAAI,GACpC,IAAI,CAAC,aAAa,KAAK,IAAI,GAAG,KAAK,QAAQ,QACzC,UAAU,IAAI,KAAK;GAAE,WAAW,KAAK;GAAM,YAAY,EAAE,OAAO,iBAAiB,MAAM,GAAG,MAAM,KAAK;EAAW,CAAC;CACvH;CACA,OAAO;AACT;AACA,IAAI,gBAAgB,QAAQ,YAAY,UAAU,CAAC,GAAG,cAAc,EAAE,OAAO,KAAK,CAAC,GAAG,GAAG;AACzF,IAAI,sBAAsB,CAAC;AAC3B,SAAS,qBAAqB,EAC5B,iBAAiB,UACnB,CAAC;AACD,OAAO,UAAU,aAAa,mBAAmB;AACjD,IAAI,kBAAkB,QAAQ,sBAAY;AAC1C,SAAS,YAAY;CACnB,OAAO,QAAQ,QAAQ,KAAK;AAC9B;AACA,SAAS,WAAW,SAAS;CAC3B,CAAC,GAAG,gBAAgB,uBAAsB,CAAE,OAAO;CACnD,OAAO,QAAQ,QAAQ;AACzB;AACA,SAAS,SAAS,KAAK;CACrB,CAAC,GAAG,gBAAgB,mBAAkB,CAAE,KAAK,UAAU;CACvD,OAAO,QAAQ,QAAQ;AACzB;AACA,SAAS,WAAW,KAAK;CACvB,CAAC,GAAG,gBAAgB,mBAAkB,CAAE,KAAK,YAAY;CACzD,OAAO,QAAQ,QAAQ;AACzB;AACA,IAAI,YAAY,OAAO,OAAO;CAC5B;CACA;CACA;CACA;AACF,CAAC"}
@@ -19,10 +19,24 @@ var __copyProps = (to, from, except, desc) => {
19
19
  };
20
20
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
21
21
  var validate_exports = {};
22
- __export(validate_exports, { assertKeepAwakeEnabled: () => assertKeepAwakeEnabled });
22
+ __export(validate_exports, {
23
+ assertKeepAwakeEnabled: () => assertKeepAwakeEnabled,
24
+ assertKeepAwakeTag: () => assertKeepAwakeTag,
25
+ keepAwakeDefaultTag: () => keepAwakeDefaultTag,
26
+ normalizeKeepAwakeTag: () => normalizeKeepAwakeTag
27
+ });
23
28
  module.exports = __toCommonJS(validate_exports);
24
29
  function assertKeepAwakeEnabled(value) {
25
30
  if (typeof value !== "boolean") {
26
31
  throw new Error("KeepAwake.setEnabled: enabled must be a boolean");
27
32
  }
28
33
  }
34
+ const keepAwakeDefaultTag = "ExpoKeepAwakeDefaultTag";
35
+ function assertKeepAwakeTag(value, owner) {
36
+ if (value !== void 0 && typeof value !== "string") {
37
+ throw new Error(`KeepAwake.${owner}: tag must be a string`);
38
+ }
39
+ }
40
+ function normalizeKeepAwakeTag(value) {
41
+ return value ?? keepAwakeDefaultTag;
42
+ }
@@ -21,10 +21,24 @@ var __copyProps = (to, from, except, desc) => {
21
21
  };
22
22
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
23
23
  var validate_exports = {};
24
- __export(validate_exports, { assertKeepAwakeEnabled: () => assertKeepAwakeEnabled });
24
+ __export(validate_exports, {
25
+ assertKeepAwakeEnabled: () => assertKeepAwakeEnabled,
26
+ assertKeepAwakeTag: () => assertKeepAwakeTag,
27
+ keepAwakeDefaultTag: () => keepAwakeDefaultTag,
28
+ normalizeKeepAwakeTag: () => normalizeKeepAwakeTag
29
+ });
25
30
  module.exports = __toCommonJS(validate_exports);
26
31
  function assertKeepAwakeEnabled(value) {
27
32
  if (typeof value !== "boolean") {
28
33
  throw new Error("KeepAwake.setEnabled: enabled must be a boolean");
29
34
  }
30
35
  }
36
+ var keepAwakeDefaultTag = "ExpoKeepAwakeDefaultTag";
37
+ function assertKeepAwakeTag(value, owner) {
38
+ if (value !== void 0 && typeof value !== "string") {
39
+ throw new Error(`KeepAwake.${owner}: tag must be a string`);
40
+ }
41
+ }
42
+ function normalizeKeepAwakeTag(value) {
43
+ return value !== null && value !== void 0 ? value : keepAwakeDefaultTag;
44
+ }
@@ -21,12 +21,26 @@ var __copyProps = (to, from, except, desc) => {
21
21
  };
22
22
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
23
23
  var validate_exports = {};
24
- __export(validate_exports, { assertKeepAwakeEnabled: () => assertKeepAwakeEnabled });
24
+ __export(validate_exports, {
25
+ assertKeepAwakeEnabled: () => assertKeepAwakeEnabled,
26
+ assertKeepAwakeTag: () => assertKeepAwakeTag,
27
+ keepAwakeDefaultTag: () => keepAwakeDefaultTag,
28
+ normalizeKeepAwakeTag: () => normalizeKeepAwakeTag
29
+ });
25
30
  module.exports = __toCommonJS(validate_exports);
26
31
  function assertKeepAwakeEnabled(value) {
27
32
  if (typeof value !== "boolean") {
28
33
  throw new Error("KeepAwake.setEnabled: enabled must be a boolean");
29
34
  }
30
35
  }
36
+ var keepAwakeDefaultTag = "ExpoKeepAwakeDefaultTag";
37
+ function assertKeepAwakeTag(value, owner) {
38
+ if (value !== void 0 && typeof value !== "string") {
39
+ throw new Error(`KeepAwake.${owner}: tag must be a string`);
40
+ }
41
+ }
42
+ function normalizeKeepAwakeTag(value) {
43
+ return value !== null && value !== void 0 ? value : keepAwakeDefaultTag;
44
+ }
31
45
 
32
46
  //# sourceMappingURL=validate.native.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"validate.native.js","names":[],"sources":["cjs/platform/keep-awake/validate.native.js"],"sourcesContent":["\"use strict\";\nvar __defProp = Object.defineProperty;\nvar __getOwnPropDesc = Object.getOwnPropertyDescriptor;\nvar __getOwnPropNames = Object.getOwnPropertyNames;\nvar __hasOwnProp = Object.prototype.hasOwnProperty;\nvar __export = (target, all) => {\n for (var name in all)\n __defProp(target, name, { get: all[name], enumerable: true });\n};\nvar __copyProps = (to, from, except, desc) => {\n if (from && typeof from === \"object\" || typeof from === \"function\") {\n for (let key of __getOwnPropNames(from))\n if (!__hasOwnProp.call(to, key) && key !== except)\n __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });\n }\n return to;\n};\nvar __toCommonJS = (mod) => __copyProps(__defProp({}, \"__esModule\", { value: true }), mod);\nvar validate_exports = {};\n__export(validate_exports, {\n assertKeepAwakeEnabled: () => assertKeepAwakeEnabled\n});\nmodule.exports = __toCommonJS(validate_exports);\nfunction assertKeepAwakeEnabled(value) {\n if (typeof value !== \"boolean\") {\n throw new Error(\"KeepAwake.setEnabled: enabled must be a boolean\");\n }\n}\n//# sourceMappingURL=validate.js.map\n"],"mappings":";;;AACA,IAAI,YAAY,OAAO;AACvB,IAAI,mBAAmB,OAAO;AAC9B,IAAI,oBAAoB,OAAO;AAC/B,IAAI,eAAe,OAAO,UAAU;AACpC,IAAI,YAAY,QAAQ,QAAQ;CAC9B,KAAK,IAAI,QAAQ,KACf,UAAU,QAAQ,MAAM;EAAE,KAAK,IAAI;EAAO,YAAY;CAAK,CAAC;AAChE;AACA,IAAI,eAAe,IAAI,MAAM,QAAQ,SAAS;CAC5C,IAAI,QAAQ,OAAO,SAAS,YAAY,OAAO,SAAS,YAAY;EAClE,KAAK,IAAI,OAAO,kBAAkB,IAAI,GACpC,IAAI,CAAC,aAAa,KAAK,IAAI,GAAG,KAAK,QAAQ,QACzC,UAAU,IAAI,KAAK;GAAE,WAAW,KAAK;GAAM,YAAY,EAAE,OAAO,iBAAiB,MAAM,GAAG,MAAM,KAAK;EAAW,CAAC;CACvH;CACA,OAAO;AACT;AACA,IAAI,gBAAgB,QAAQ,YAAY,UAAU,CAAC,GAAG,cAAc,EAAE,OAAO,KAAK,CAAC,GAAG,GAAG;AACzF,IAAI,mBAAmB,CAAC;AACxB,SAAS,kBAAkB,EACzB,8BAA8B,uBAChC,CAAC;AACD,OAAO,UAAU,aAAa,gBAAgB;AAC9C,SAAS,uBAAuB,OAAO;CACrC,IAAI,OAAO,UAAU,WAAW;EAC9B,MAAM,IAAI,MAAM,iDAAiD;CACnE;AACF"}
1
+ {"version":3,"file":"validate.native.js","names":[],"sources":["cjs/platform/keep-awake/validate.native.js"],"sourcesContent":["\"use strict\";\nvar __defProp = Object.defineProperty;\nvar __getOwnPropDesc = Object.getOwnPropertyDescriptor;\nvar __getOwnPropNames = Object.getOwnPropertyNames;\nvar __hasOwnProp = Object.prototype.hasOwnProperty;\nvar __export = (target, all) => {\n for (var name in all)\n __defProp(target, name, { get: all[name], enumerable: true });\n};\nvar __copyProps = (to, from, except, desc) => {\n if (from && typeof from === \"object\" || typeof from === \"function\") {\n for (let key of __getOwnPropNames(from))\n if (!__hasOwnProp.call(to, key) && key !== except)\n __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });\n }\n return to;\n};\nvar __toCommonJS = (mod) => __copyProps(__defProp({}, \"__esModule\", { value: true }), mod);\nvar validate_exports = {};\n__export(validate_exports, {\n assertKeepAwakeEnabled: () => assertKeepAwakeEnabled,\n assertKeepAwakeTag: () => assertKeepAwakeTag,\n keepAwakeDefaultTag: () => keepAwakeDefaultTag,\n normalizeKeepAwakeTag: () => normalizeKeepAwakeTag\n});\nmodule.exports = __toCommonJS(validate_exports);\nfunction assertKeepAwakeEnabled(value) {\n if (typeof value !== \"boolean\") {\n throw new Error(\"KeepAwake.setEnabled: enabled must be a boolean\");\n }\n}\nvar keepAwakeDefaultTag = \"ExpoKeepAwakeDefaultTag\";\nfunction assertKeepAwakeTag(value, owner) {\n if (value !== void 0 && typeof value !== \"string\") {\n throw new Error(`KeepAwake.${owner}: tag must be a string`);\n }\n}\nfunction normalizeKeepAwakeTag(value) {\n return value !== null && value !== void 0 ? value : keepAwakeDefaultTag;\n}\n//# sourceMappingURL=validate.js.map\n"],"mappings":";;;AACA,IAAI,YAAY,OAAO;AACvB,IAAI,mBAAmB,OAAO;AAC9B,IAAI,oBAAoB,OAAO;AAC/B,IAAI,eAAe,OAAO,UAAU;AACpC,IAAI,YAAY,QAAQ,QAAQ;CAC9B,KAAK,IAAI,QAAQ,KACf,UAAU,QAAQ,MAAM;EAAE,KAAK,IAAI;EAAO,YAAY;CAAK,CAAC;AAChE;AACA,IAAI,eAAe,IAAI,MAAM,QAAQ,SAAS;CAC5C,IAAI,QAAQ,OAAO,SAAS,YAAY,OAAO,SAAS,YAAY;EAClE,KAAK,IAAI,OAAO,kBAAkB,IAAI,GACpC,IAAI,CAAC,aAAa,KAAK,IAAI,GAAG,KAAK,QAAQ,QACzC,UAAU,IAAI,KAAK;GAAE,WAAW,KAAK;GAAM,YAAY,EAAE,OAAO,iBAAiB,MAAM,GAAG,MAAM,KAAK;EAAW,CAAC;CACvH;CACA,OAAO;AACT;AACA,IAAI,gBAAgB,QAAQ,YAAY,UAAU,CAAC,GAAG,cAAc,EAAE,OAAO,KAAK,CAAC,GAAG,GAAG;AACzF,IAAI,mBAAmB,CAAC;AACxB,SAAS,kBAAkB;CACzB,8BAA8B;CAC9B,0BAA0B;CAC1B,2BAA2B;CAC3B,6BAA6B;AAC/B,CAAC;AACD,OAAO,UAAU,aAAa,gBAAgB;AAC9C,SAAS,uBAAuB,OAAO;CACrC,IAAI,OAAO,UAAU,WAAW;EAC9B,MAAM,IAAI,MAAM,iDAAiD;CACnE;AACF;AACA,IAAI,sBAAsB;AAC1B,SAAS,mBAAmB,OAAO,OAAO;CACxC,IAAI,UAAU,KAAK,KAAK,OAAO,UAAU,UAAU;EACjD,MAAM,IAAI,MAAM,aAAa,MAAM,uBAAuB;CAC5D;AACF;AACA,SAAS,sBAAsB,OAAO;CACpC,OAAO,UAAU,QAAQ,UAAU,KAAK,IAAI,QAAQ;AACtD"}
@@ -0,0 +1,100 @@
1
+ var __defProp = Object.defineProperty;
2
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
3
+ var __getOwnPropNames = Object.getOwnPropertyNames;
4
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
5
+ var __export = (target, all) => {
6
+ for (var name in all) __defProp(target, name, {
7
+ get: all[name],
8
+ enumerable: true
9
+ });
10
+ };
11
+ var __copyProps = (to, from, except, desc) => {
12
+ if (from && typeof from === "object" || typeof from === "function") {
13
+ for (let key of __getOwnPropNames(from)) if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
14
+ get: () => from[key],
15
+ enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
16
+ });
17
+ }
18
+ return to;
19
+ };
20
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
21
+ var localization_exports = {};
22
+ __export(localization_exports, {
23
+ Localization: () => Localization,
24
+ useCalendars: () => useCalendars,
25
+ useLocales: () => useLocales
26
+ });
27
+ module.exports = __toCommonJS(localization_exports);
28
+ var import_react = require("react");
29
+ var import_map = require("./map.cjs");
30
+ function localeFor(tag) {
31
+ try {
32
+ const parsed = new Intl.Locale(tag);
33
+ const numbers = new Intl.NumberFormat(tag).formatToParts(1234567.89);
34
+ const part = (type) => numbers.find((entry) => entry.type === type)?.value ?? null;
35
+ const direction = parsed.textInfo?.direction;
36
+ return {
37
+ languageTag: parsed.baseName,
38
+ languageCode: parsed.language ?? null,
39
+ languageScriptCode: parsed.script ?? null,
40
+ regionCode: parsed.region ?? null,
41
+ languageRegionCode: parsed.region ?? null,
42
+ currencyCode: null,
43
+ currencySymbol: null,
44
+ languageCurrencyCode: null,
45
+ languageCurrencySymbol: null,
46
+ decimalSeparator: part("decimal"),
47
+ digitGroupingSeparator: part("group"),
48
+ textDirection: direction === "rtl" ? "rtl" : "ltr",
49
+ measurementSystem: null,
50
+ temperatureUnit: null
51
+ };
52
+ } catch {
53
+ return {
54
+ ...import_map.FALLBACK_LOCALE,
55
+ languageTag: tag
56
+ };
57
+ }
58
+ }
59
+ function getLocales() {
60
+ if (typeof navigator === "undefined" || !navigator.languages?.length) {
61
+ return [import_map.FALLBACK_LOCALE];
62
+ }
63
+ const locales = [...navigator.languages].map(localeFor);
64
+ return locales.length > 0 ? locales : [import_map.FALLBACK_LOCALE];
65
+ }
66
+ function getCalendars() {
67
+ if (typeof Intl === "undefined") return [import_map.FALLBACK_CALENDAR];
68
+ try {
69
+ const options = new Intl.DateTimeFormat().resolvedOptions();
70
+ const parsed = new Intl.Locale(options.locale);
71
+ const firstDay = parsed.weekInfo?.firstDay;
72
+ return [{
73
+ calendar: options.calendar ?? null,
74
+ timeZone: options.timeZone ?? null,
75
+ uses24hourClock: parsed.hourCycle === void 0 ? null : parsed.hourCycle === "h23" || parsed.hourCycle === "h24",
76
+ firstWeekday: firstDay === void 0 ? null : firstDay % 7 + 1
77
+ }];
78
+ } catch {
79
+ return [import_map.FALLBACK_CALENDAR];
80
+ }
81
+ }
82
+ function subscribe(refresh) {
83
+ if (typeof window === "undefined") return void 0;
84
+ window.addEventListener("languagechange", refresh);
85
+ return () => window.removeEventListener("languagechange", refresh);
86
+ }
87
+ function useLocales() {
88
+ const [locales, setLocales] = (0, import_react.useState)(() => getLocales());
89
+ (0, import_react.useEffect)(() => subscribe(() => setLocales(getLocales())), []);
90
+ return locales;
91
+ }
92
+ function useCalendars() {
93
+ const [calendars, setCalendars] = (0, import_react.useState)(() => getCalendars());
94
+ (0, import_react.useEffect)(() => subscribe(() => setCalendars(getCalendars())), []);
95
+ return calendars;
96
+ }
97
+ const Localization = Object.freeze({
98
+ getLocales,
99
+ getCalendars
100
+ });
@@ -0,0 +1,71 @@
1
+ "use strict";
2
+
3
+ var __defProp = Object.defineProperty;
4
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
+ var __getOwnPropNames = Object.getOwnPropertyNames;
6
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
7
+ var __export = (target, all) => {
8
+ for (var name in all) __defProp(target, name, {
9
+ get: all[name],
10
+ enumerable: true
11
+ });
12
+ };
13
+ var __copyProps = (to, from, except, desc) => {
14
+ if (from && typeof from === "object" || typeof from === "function") {
15
+ for (let key of __getOwnPropNames(from)) if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
16
+ get: () => from[key],
17
+ enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
18
+ });
19
+ }
20
+ return to;
21
+ };
22
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
23
+ var index_native_exports = {};
24
+ __export(index_native_exports, {
25
+ Localization: () => Localization,
26
+ useCalendars: () => useCalendars,
27
+ useLocales: () => useLocales
28
+ });
29
+ module.exports = __toCommonJS(index_native_exports);
30
+ var import_react = require("react");
31
+ var import_react_native_nitro_modules = require("react-native-nitro-modules");
32
+ var import_map = require("./map.native.js");
33
+ var hybrid;
34
+ function native() {
35
+ hybrid !== null && hybrid !== void 0 ? hybrid : hybrid = import_react_native_nitro_modules.NitroModules.createHybridObject("OneDevice");
36
+ return hybrid;
37
+ }
38
+ function getLocales() {
39
+ return (0, import_map.toLocales)(native().getLocales());
40
+ }
41
+ function getCalendars() {
42
+ return (0, import_map.toCalendars)(native().getCalendars());
43
+ }
44
+ function useLocales() {
45
+ var [locales, setLocales] = (0, import_react.useState)(function() {
46
+ return getLocales();
47
+ });
48
+ (0, import_react.useEffect)(function() {
49
+ setLocales(getLocales());
50
+ return native().addLocalizationListener(function() {
51
+ return setLocales(getLocales());
52
+ });
53
+ }, []);
54
+ return locales;
55
+ }
56
+ function useCalendars() {
57
+ var [calendars, setCalendars] = (0, import_react.useState)(function() {
58
+ return getCalendars();
59
+ });
60
+ (0, import_react.useEffect)(function() {
61
+ setCalendars(getCalendars());
62
+ return native().addLocalizationListener(function() {
63
+ return setCalendars(getCalendars());
64
+ });
65
+ }, []);
66
+ return calendars;
67
+ }
68
+ var Localization = Object.freeze({
69
+ getLocales,
70
+ getCalendars
71
+ });
@@ -0,0 +1,73 @@
1
+ "use strict";
2
+
3
+ var __defProp = Object.defineProperty;
4
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
+ var __getOwnPropNames = Object.getOwnPropertyNames;
6
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
7
+ var __export = (target, all) => {
8
+ for (var name in all) __defProp(target, name, {
9
+ get: all[name],
10
+ enumerable: true
11
+ });
12
+ };
13
+ var __copyProps = (to, from, except, desc) => {
14
+ if (from && typeof from === "object" || typeof from === "function") {
15
+ for (let key of __getOwnPropNames(from)) if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
16
+ get: () => from[key],
17
+ enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
18
+ });
19
+ }
20
+ return to;
21
+ };
22
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
23
+ var index_native_exports = {};
24
+ __export(index_native_exports, {
25
+ Localization: () => Localization,
26
+ useCalendars: () => useCalendars,
27
+ useLocales: () => useLocales
28
+ });
29
+ module.exports = __toCommonJS(index_native_exports);
30
+ var import_react = require("react");
31
+ var import_react_native_nitro_modules = require("react-native-nitro-modules");
32
+ var import_map = require("./map.native.js");
33
+ var hybrid;
34
+ function native() {
35
+ hybrid !== null && hybrid !== void 0 ? hybrid : hybrid = import_react_native_nitro_modules.NitroModules.createHybridObject("OneDevice");
36
+ return hybrid;
37
+ }
38
+ function getLocales() {
39
+ return (0, import_map.toLocales)(native().getLocales());
40
+ }
41
+ function getCalendars() {
42
+ return (0, import_map.toCalendars)(native().getCalendars());
43
+ }
44
+ function useLocales() {
45
+ var [locales, setLocales] = (0, import_react.useState)(function() {
46
+ return getLocales();
47
+ });
48
+ (0, import_react.useEffect)(function() {
49
+ setLocales(getLocales());
50
+ return native().addLocalizationListener(function() {
51
+ return setLocales(getLocales());
52
+ });
53
+ }, []);
54
+ return locales;
55
+ }
56
+ function useCalendars() {
57
+ var [calendars, setCalendars] = (0, import_react.useState)(function() {
58
+ return getCalendars();
59
+ });
60
+ (0, import_react.useEffect)(function() {
61
+ setCalendars(getCalendars());
62
+ return native().addLocalizationListener(function() {
63
+ return setCalendars(getCalendars());
64
+ });
65
+ }, []);
66
+ return calendars;
67
+ }
68
+ var Localization = Object.freeze({
69
+ getLocales,
70
+ getCalendars
71
+ });
72
+
73
+ //# sourceMappingURL=index.native.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.native.js","names":[],"sources":["cjs/platform/localization/index.native.js"],"sourcesContent":["\"use strict\";\nvar __defProp = Object.defineProperty;\nvar __getOwnPropDesc = Object.getOwnPropertyDescriptor;\nvar __getOwnPropNames = Object.getOwnPropertyNames;\nvar __hasOwnProp = Object.prototype.hasOwnProperty;\nvar __export = (target, all) => {\n for (var name in all)\n __defProp(target, name, { get: all[name], enumerable: true });\n};\nvar __copyProps = (to, from, except, desc) => {\n if (from && typeof from === \"object\" || typeof from === \"function\") {\n for (let key of __getOwnPropNames(from))\n if (!__hasOwnProp.call(to, key) && key !== except)\n __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });\n }\n return to;\n};\nvar __toCommonJS = (mod) => __copyProps(__defProp({}, \"__esModule\", { value: true }), mod);\nvar index_native_exports = {};\n__export(index_native_exports, {\n Localization: () => Localization,\n useCalendars: () => useCalendars,\n useLocales: () => useLocales\n});\nmodule.exports = __toCommonJS(index_native_exports);\nvar import_react = require(\"react\");\nvar import_react_native_nitro_modules = require(\"react-native-nitro-modules\");\nvar import_map = require(\"./map\");\nvar hybrid;\nfunction native() {\n hybrid !== null && hybrid !== void 0 ? hybrid : hybrid = import_react_native_nitro_modules.NitroModules.createHybridObject(\"OneDevice\");\n return hybrid;\n}\nfunction getLocales() {\n return (0, import_map.toLocales)(native().getLocales());\n}\nfunction getCalendars() {\n return (0, import_map.toCalendars)(native().getCalendars());\n}\nfunction useLocales() {\n var [locales, setLocales] = (0, import_react.useState)(function() {\n return getLocales();\n });\n (0, import_react.useEffect)(function() {\n setLocales(getLocales());\n return native().addLocalizationListener(function() {\n return setLocales(getLocales());\n });\n }, []);\n return locales;\n}\nfunction useCalendars() {\n var [calendars, setCalendars] = (0, import_react.useState)(function() {\n return getCalendars();\n });\n (0, import_react.useEffect)(function() {\n setCalendars(getCalendars());\n return native().addLocalizationListener(function() {\n return setCalendars(getCalendars());\n });\n }, []);\n return calendars;\n}\nvar Localization = Object.freeze({\n getLocales,\n getCalendars\n});\n//# sourceMappingURL=index.native.js.map\n"],"mappings":";;;AACA,IAAI,YAAY,OAAO;AACvB,IAAI,mBAAmB,OAAO;AAC9B,IAAI,oBAAoB,OAAO;AAC/B,IAAI,eAAe,OAAO,UAAU;AACpC,IAAI,YAAY,QAAQ,QAAQ;CAC9B,KAAK,IAAI,QAAQ,KACf,UAAU,QAAQ,MAAM;EAAE,KAAK,IAAI;EAAO,YAAY;CAAK,CAAC;AAChE;AACA,IAAI,eAAe,IAAI,MAAM,QAAQ,SAAS;CAC5C,IAAI,QAAQ,OAAO,SAAS,YAAY,OAAO,SAAS,YAAY;EAClE,KAAK,IAAI,OAAO,kBAAkB,IAAI,GACpC,IAAI,CAAC,aAAa,KAAK,IAAI,GAAG,KAAK,QAAQ,QACzC,UAAU,IAAI,KAAK;GAAE,WAAW,KAAK;GAAM,YAAY,EAAE,OAAO,iBAAiB,MAAM,GAAG,MAAM,KAAK;EAAW,CAAC;CACvH;CACA,OAAO;AACT;AACA,IAAI,gBAAgB,QAAQ,YAAY,UAAU,CAAC,GAAG,cAAc,EAAE,OAAO,KAAK,CAAC,GAAG,GAAG;AACzF,IAAI,uBAAuB,CAAC;AAC5B,SAAS,sBAAsB;CAC7B,oBAAoB;CACpB,oBAAoB;CACpB,kBAAkB;AACpB,CAAC;AACD,OAAO,UAAU,aAAa,oBAAoB;AAClD,IAAI,eAAe,QAAQ,OAAO;AAClC,IAAI,oCAAoC,QAAQ,4BAA4B;AAC5E,IAAI,aAAa,QAAQ,iBAAO;AAChC,IAAI;AACJ,SAAS,SAAS;CAChB,WAAW,QAAQ,WAAW,KAAK,IAAI,SAAS,SAAS,kCAAkC,aAAa,mBAAmB,WAAW;CACtI,OAAO;AACT;AACA,SAAS,aAAa;CACpB,QAAQ,GAAG,WAAW,UAAS,CAAE,OAAO,CAAC,CAAC,WAAW,CAAC;AACxD;AACA,SAAS,eAAe;CACtB,QAAQ,GAAG,WAAW,YAAW,CAAE,OAAO,CAAC,CAAC,aAAa,CAAC;AAC5D;AACA,SAAS,aAAa;CACpB,IAAI,CAAC,SAAS,eAAe,GAAG,aAAa,SAAQ,CAAE,WAAW;EAChE,OAAO,WAAW;CACpB,CAAC;CACD,CAAC,GAAG,aAAa,UAAS,CAAE,WAAW;EACrC,WAAW,WAAW,CAAC;EACvB,OAAO,OAAO,CAAC,CAAC,wBAAwB,WAAW;GACjD,OAAO,WAAW,WAAW,CAAC;EAChC,CAAC;CACH,GAAG,CAAC,CAAC;CACL,OAAO;AACT;AACA,SAAS,eAAe;CACtB,IAAI,CAAC,WAAW,iBAAiB,GAAG,aAAa,SAAQ,CAAE,WAAW;EACpE,OAAO,aAAa;CACtB,CAAC;CACD,CAAC,GAAG,aAAa,UAAS,CAAE,WAAW;EACrC,aAAa,aAAa,CAAC;EAC3B,OAAO,OAAO,CAAC,CAAC,wBAAwB,WAAW;GACjD,OAAO,aAAa,aAAa,CAAC;EACpC,CAAC;CACH,GAAG,CAAC,CAAC;CACL,OAAO;AACT;AACA,IAAI,eAAe,OAAO,OAAO;CAC/B;CACA;AACF,CAAC"}