native-fn 1.2.2 → 1.3.1

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 (405) hide show
  1. package/README.md +191 -49
  2. package/dist/index.d.ts +148 -98
  3. package/dist/native.cjs +810 -288
  4. package/dist/native.min.cjs +1 -1
  5. package/dist/native.min.mjs +1 -1
  6. package/dist/native.mjs +810 -288
  7. package/dist/native.umd.js +810 -288
  8. package/dist/native.umd.min.js +1 -1
  9. package/dist/plugin/appearance/index.cjs +65 -64
  10. package/dist/plugin/appearance/index.d.ts +5 -5
  11. package/dist/plugin/appearance/index.mjs +66 -65
  12. package/dist/plugin/appearance/src/plugin/appearance/constants/index.d.ts +1 -1
  13. package/dist/plugin/appearance/src/plugin/appearance/types/appearance.d.ts +3 -3
  14. package/dist/plugin/appearance/src/plugin/badge/types/badge.d.ts +3 -3
  15. package/dist/plugin/appearance/src/plugin/battery/types/battery.d.ts +3 -3
  16. package/dist/plugin/appearance/src/plugin/clipboard/types/clipboard.d.ts +2 -2
  17. package/dist/plugin/appearance/src/plugin/dimension/constants/index.d.ts +10 -6
  18. package/dist/plugin/appearance/src/plugin/dimension/cores/index.d.ts +15 -0
  19. package/dist/plugin/appearance/src/plugin/dimension/types/dimensions.d.ts +52 -24
  20. package/dist/plugin/appearance/src/plugin/dimension/utils/create-env-observer.d.ts +16 -7
  21. package/dist/plugin/appearance/src/plugin/dimension/utils/create-environment-observer.d.ts +33 -0
  22. package/dist/plugin/appearance/src/plugin/fullscreen/types/fullscreen.d.ts +7 -7
  23. package/dist/plugin/appearance/src/plugin/geolocation/types/geolocation.d.ts +4 -4
  24. package/dist/plugin/appearance/src/plugin/notification/types/notification.d.ts +4 -4
  25. package/dist/plugin/appearance/src/plugin/open/types/open.d.ts +12 -12
  26. package/dist/plugin/appearance/src/plugin/permission/constants/index.d.ts +3 -1
  27. package/dist/plugin/appearance/src/plugin/permission/types/permission.d.ts +7 -4
  28. package/dist/plugin/appearance/src/plugin/pip/types/pip.d.ts +7 -7
  29. package/dist/plugin/appearance/src/plugin/platform/constants/index.d.ts +1 -1
  30. package/dist/plugin/appearance/src/plugin/platform/types/platform.d.ts +13 -13
  31. package/dist/plugin/appearance/src/plugin/theme/types/theme.d.ts +2 -2
  32. package/dist/plugin/appearance/src/plugin/vibration/types/vibration.d.ts +3 -3
  33. package/dist/plugin/appearance/src/types/subscription-manager.d.ts +3 -3
  34. package/dist/plugin/appearance/src/utils/create-subscription-manager.d.ts +1 -1
  35. package/dist/plugin/appearance/src/utils/insert-sort.d.ts +1 -0
  36. package/dist/plugin/badge/index.d.ts +3 -3
  37. package/dist/plugin/badge/src/plugin/appearance/constants/index.d.ts +1 -1
  38. package/dist/plugin/badge/src/plugin/appearance/types/appearance.d.ts +3 -3
  39. package/dist/plugin/badge/src/plugin/badge/types/badge.d.ts +3 -3
  40. package/dist/plugin/badge/src/plugin/battery/types/battery.d.ts +3 -3
  41. package/dist/plugin/badge/src/plugin/clipboard/types/clipboard.d.ts +2 -2
  42. package/dist/plugin/badge/src/plugin/dimension/constants/index.d.ts +10 -6
  43. package/dist/plugin/badge/src/plugin/dimension/cores/index.d.ts +15 -0
  44. package/dist/plugin/badge/src/plugin/dimension/types/dimensions.d.ts +52 -24
  45. package/dist/plugin/badge/src/plugin/dimension/utils/create-env-observer.d.ts +16 -7
  46. package/dist/plugin/badge/src/plugin/dimension/utils/create-environment-observer.d.ts +33 -0
  47. package/dist/plugin/badge/src/plugin/fullscreen/types/fullscreen.d.ts +7 -7
  48. package/dist/plugin/badge/src/plugin/geolocation/types/geolocation.d.ts +4 -4
  49. package/dist/plugin/badge/src/plugin/notification/types/notification.d.ts +4 -4
  50. package/dist/plugin/badge/src/plugin/open/types/open.d.ts +12 -12
  51. package/dist/plugin/badge/src/plugin/permission/constants/index.d.ts +3 -1
  52. package/dist/plugin/badge/src/plugin/permission/types/permission.d.ts +7 -4
  53. package/dist/plugin/badge/src/plugin/pip/types/pip.d.ts +7 -7
  54. package/dist/plugin/badge/src/plugin/platform/constants/index.d.ts +1 -1
  55. package/dist/plugin/badge/src/plugin/platform/types/platform.d.ts +13 -13
  56. package/dist/plugin/badge/src/plugin/theme/types/theme.d.ts +2 -2
  57. package/dist/plugin/badge/src/plugin/vibration/types/vibration.d.ts +3 -3
  58. package/dist/plugin/badge/src/types/subscription-manager.d.ts +3 -3
  59. package/dist/plugin/badge/src/utils/create-subscription-manager.d.ts +1 -1
  60. package/dist/plugin/badge/src/utils/insert-sort.d.ts +1 -0
  61. package/dist/plugin/battery/index.cjs +4 -6
  62. package/dist/plugin/battery/index.d.ts +3 -3
  63. package/dist/plugin/battery/index.mjs +4 -6
  64. package/dist/plugin/battery/src/plugin/appearance/constants/index.d.ts +1 -1
  65. package/dist/plugin/battery/src/plugin/appearance/types/appearance.d.ts +3 -3
  66. package/dist/plugin/battery/src/plugin/badge/types/badge.d.ts +3 -3
  67. package/dist/plugin/battery/src/plugin/battery/types/battery.d.ts +3 -3
  68. package/dist/plugin/battery/src/plugin/clipboard/types/clipboard.d.ts +2 -2
  69. package/dist/plugin/battery/src/plugin/dimension/constants/index.d.ts +10 -6
  70. package/dist/plugin/battery/src/plugin/dimension/cores/index.d.ts +15 -0
  71. package/dist/plugin/battery/src/plugin/dimension/types/dimensions.d.ts +52 -24
  72. package/dist/plugin/battery/src/plugin/dimension/utils/create-env-observer.d.ts +16 -7
  73. package/dist/plugin/battery/src/plugin/dimension/utils/create-environment-observer.d.ts +33 -0
  74. package/dist/plugin/battery/src/plugin/fullscreen/types/fullscreen.d.ts +7 -7
  75. package/dist/plugin/battery/src/plugin/geolocation/types/geolocation.d.ts +4 -4
  76. package/dist/plugin/battery/src/plugin/notification/types/notification.d.ts +4 -4
  77. package/dist/plugin/battery/src/plugin/open/types/open.d.ts +12 -12
  78. package/dist/plugin/battery/src/plugin/permission/constants/index.d.ts +3 -1
  79. package/dist/plugin/battery/src/plugin/permission/types/permission.d.ts +7 -4
  80. package/dist/plugin/battery/src/plugin/pip/types/pip.d.ts +7 -7
  81. package/dist/plugin/battery/src/plugin/platform/constants/index.d.ts +1 -1
  82. package/dist/plugin/battery/src/plugin/platform/types/platform.d.ts +13 -13
  83. package/dist/plugin/battery/src/plugin/theme/types/theme.d.ts +2 -2
  84. package/dist/plugin/battery/src/plugin/vibration/types/vibration.d.ts +3 -3
  85. package/dist/plugin/battery/src/types/subscription-manager.d.ts +3 -3
  86. package/dist/plugin/battery/src/utils/create-subscription-manager.d.ts +1 -1
  87. package/dist/plugin/battery/src/utils/insert-sort.d.ts +1 -0
  88. package/dist/plugin/clipboard/index.d.ts +2 -2
  89. package/dist/plugin/clipboard/src/plugin/appearance/constants/index.d.ts +1 -1
  90. package/dist/plugin/clipboard/src/plugin/appearance/types/appearance.d.ts +3 -3
  91. package/dist/plugin/clipboard/src/plugin/badge/types/badge.d.ts +3 -3
  92. package/dist/plugin/clipboard/src/plugin/battery/types/battery.d.ts +3 -3
  93. package/dist/plugin/clipboard/src/plugin/clipboard/types/clipboard.d.ts +2 -2
  94. package/dist/plugin/clipboard/src/plugin/dimension/constants/index.d.ts +10 -6
  95. package/dist/plugin/clipboard/src/plugin/dimension/cores/index.d.ts +15 -0
  96. package/dist/plugin/clipboard/src/plugin/dimension/types/dimensions.d.ts +52 -24
  97. package/dist/plugin/clipboard/src/plugin/dimension/utils/create-env-observer.d.ts +16 -7
  98. package/dist/plugin/clipboard/src/plugin/dimension/utils/create-environment-observer.d.ts +33 -0
  99. package/dist/plugin/clipboard/src/plugin/fullscreen/types/fullscreen.d.ts +7 -7
  100. package/dist/plugin/clipboard/src/plugin/geolocation/types/geolocation.d.ts +4 -4
  101. package/dist/plugin/clipboard/src/plugin/notification/types/notification.d.ts +4 -4
  102. package/dist/plugin/clipboard/src/plugin/open/types/open.d.ts +12 -12
  103. package/dist/plugin/clipboard/src/plugin/permission/constants/index.d.ts +3 -1
  104. package/dist/plugin/clipboard/src/plugin/permission/types/permission.d.ts +7 -4
  105. package/dist/plugin/clipboard/src/plugin/pip/types/pip.d.ts +7 -7
  106. package/dist/plugin/clipboard/src/plugin/platform/constants/index.d.ts +1 -1
  107. package/dist/plugin/clipboard/src/plugin/platform/types/platform.d.ts +13 -13
  108. package/dist/plugin/clipboard/src/plugin/theme/types/theme.d.ts +2 -2
  109. package/dist/plugin/clipboard/src/plugin/vibration/types/vibration.d.ts +3 -3
  110. package/dist/plugin/clipboard/src/types/subscription-manager.d.ts +3 -3
  111. package/dist/plugin/clipboard/src/utils/create-subscription-manager.d.ts +1 -1
  112. package/dist/plugin/clipboard/src/utils/insert-sort.d.ts +1 -0
  113. package/dist/plugin/dimension/index.cjs +711 -122
  114. package/dist/plugin/dimension/index.d.ts +81 -31
  115. package/dist/plugin/dimension/index.mjs +712 -122
  116. package/dist/plugin/dimension/src/plugin/appearance/constants/index.d.ts +1 -1
  117. package/dist/plugin/dimension/src/plugin/appearance/types/appearance.d.ts +3 -3
  118. package/dist/plugin/dimension/src/plugin/badge/types/badge.d.ts +3 -3
  119. package/dist/plugin/dimension/src/plugin/battery/types/battery.d.ts +3 -3
  120. package/dist/plugin/dimension/src/plugin/clipboard/types/clipboard.d.ts +2 -2
  121. package/dist/plugin/dimension/src/plugin/dimension/constants/index.d.ts +10 -6
  122. package/dist/plugin/dimension/src/plugin/dimension/cores/index.d.ts +15 -0
  123. package/dist/plugin/dimension/src/plugin/dimension/types/dimensions.d.ts +52 -24
  124. package/dist/plugin/dimension/src/plugin/dimension/utils/create-env-observer.d.ts +16 -7
  125. package/dist/plugin/dimension/src/plugin/dimension/utils/create-environment-observer.d.ts +33 -0
  126. package/dist/plugin/dimension/src/plugin/fullscreen/types/fullscreen.d.ts +7 -7
  127. package/dist/plugin/dimension/src/plugin/geolocation/types/geolocation.d.ts +4 -4
  128. package/dist/plugin/dimension/src/plugin/notification/types/notification.d.ts +4 -4
  129. package/dist/plugin/dimension/src/plugin/open/types/open.d.ts +12 -12
  130. package/dist/plugin/dimension/src/plugin/permission/constants/index.d.ts +3 -1
  131. package/dist/plugin/dimension/src/plugin/permission/types/permission.d.ts +7 -4
  132. package/dist/plugin/dimension/src/plugin/pip/types/pip.d.ts +7 -7
  133. package/dist/plugin/dimension/src/plugin/platform/constants/index.d.ts +1 -1
  134. package/dist/plugin/dimension/src/plugin/platform/types/platform.d.ts +13 -13
  135. package/dist/plugin/dimension/src/plugin/theme/types/theme.d.ts +2 -2
  136. package/dist/plugin/dimension/src/plugin/vibration/types/vibration.d.ts +3 -3
  137. package/dist/plugin/dimension/src/types/subscription-manager.d.ts +3 -3
  138. package/dist/plugin/dimension/src/utils/create-subscription-manager.d.ts +1 -1
  139. package/dist/plugin/dimension/src/utils/insert-sort.d.ts +1 -0
  140. package/dist/plugin/fullscreen/index.cjs +96 -91
  141. package/dist/plugin/fullscreen/index.d.ts +7 -7
  142. package/dist/plugin/fullscreen/index.mjs +96 -91
  143. package/dist/plugin/fullscreen/src/plugin/appearance/constants/index.d.ts +1 -1
  144. package/dist/plugin/fullscreen/src/plugin/appearance/types/appearance.d.ts +3 -3
  145. package/dist/plugin/fullscreen/src/plugin/badge/types/badge.d.ts +3 -3
  146. package/dist/plugin/fullscreen/src/plugin/battery/types/battery.d.ts +3 -3
  147. package/dist/plugin/fullscreen/src/plugin/clipboard/types/clipboard.d.ts +2 -2
  148. package/dist/plugin/fullscreen/src/plugin/dimension/constants/index.d.ts +10 -6
  149. package/dist/plugin/fullscreen/src/plugin/dimension/cores/index.d.ts +15 -0
  150. package/dist/plugin/fullscreen/src/plugin/dimension/types/dimensions.d.ts +52 -24
  151. package/dist/plugin/fullscreen/src/plugin/dimension/utils/create-env-observer.d.ts +16 -7
  152. package/dist/plugin/fullscreen/src/plugin/dimension/utils/create-environment-observer.d.ts +33 -0
  153. package/dist/plugin/fullscreen/src/plugin/fullscreen/types/fullscreen.d.ts +7 -7
  154. package/dist/plugin/fullscreen/src/plugin/geolocation/types/geolocation.d.ts +4 -4
  155. package/dist/plugin/fullscreen/src/plugin/notification/types/notification.d.ts +4 -4
  156. package/dist/plugin/fullscreen/src/plugin/open/types/open.d.ts +12 -12
  157. package/dist/plugin/fullscreen/src/plugin/permission/constants/index.d.ts +3 -1
  158. package/dist/plugin/fullscreen/src/plugin/permission/types/permission.d.ts +7 -4
  159. package/dist/plugin/fullscreen/src/plugin/pip/types/pip.d.ts +7 -7
  160. package/dist/plugin/fullscreen/src/plugin/platform/constants/index.d.ts +1 -1
  161. package/dist/plugin/fullscreen/src/plugin/platform/types/platform.d.ts +13 -13
  162. package/dist/plugin/fullscreen/src/plugin/theme/types/theme.d.ts +2 -2
  163. package/dist/plugin/fullscreen/src/plugin/vibration/types/vibration.d.ts +3 -3
  164. package/dist/plugin/fullscreen/src/types/subscription-manager.d.ts +3 -3
  165. package/dist/plugin/fullscreen/src/utils/create-subscription-manager.d.ts +1 -1
  166. package/dist/plugin/fullscreen/src/utils/insert-sort.d.ts +1 -0
  167. package/dist/plugin/geolocation/index.cjs +249 -182
  168. package/dist/plugin/geolocation/index.d.ts +4 -4
  169. package/dist/plugin/geolocation/index.mjs +249 -182
  170. package/dist/plugin/geolocation/src/plugin/appearance/constants/index.d.ts +1 -1
  171. package/dist/plugin/geolocation/src/plugin/appearance/types/appearance.d.ts +3 -3
  172. package/dist/plugin/geolocation/src/plugin/badge/types/badge.d.ts +3 -3
  173. package/dist/plugin/geolocation/src/plugin/battery/types/battery.d.ts +3 -3
  174. package/dist/plugin/geolocation/src/plugin/clipboard/types/clipboard.d.ts +2 -2
  175. package/dist/plugin/geolocation/src/plugin/dimension/constants/index.d.ts +10 -6
  176. package/dist/plugin/geolocation/src/plugin/dimension/cores/index.d.ts +15 -0
  177. package/dist/plugin/geolocation/src/plugin/dimension/types/dimensions.d.ts +52 -24
  178. package/dist/plugin/geolocation/src/plugin/dimension/utils/create-env-observer.d.ts +16 -7
  179. package/dist/plugin/geolocation/src/plugin/dimension/utils/create-environment-observer.d.ts +33 -0
  180. package/dist/plugin/geolocation/src/plugin/fullscreen/types/fullscreen.d.ts +7 -7
  181. package/dist/plugin/geolocation/src/plugin/geolocation/types/geolocation.d.ts +4 -4
  182. package/dist/plugin/geolocation/src/plugin/notification/types/notification.d.ts +4 -4
  183. package/dist/plugin/geolocation/src/plugin/open/types/open.d.ts +12 -12
  184. package/dist/plugin/geolocation/src/plugin/permission/constants/index.d.ts +3 -1
  185. package/dist/plugin/geolocation/src/plugin/permission/types/permission.d.ts +7 -4
  186. package/dist/plugin/geolocation/src/plugin/pip/types/pip.d.ts +7 -7
  187. package/dist/plugin/geolocation/src/plugin/platform/constants/index.d.ts +1 -1
  188. package/dist/plugin/geolocation/src/plugin/platform/types/platform.d.ts +13 -13
  189. package/dist/plugin/geolocation/src/plugin/theme/types/theme.d.ts +2 -2
  190. package/dist/plugin/geolocation/src/plugin/vibration/types/vibration.d.ts +3 -3
  191. package/dist/plugin/geolocation/src/types/subscription-manager.d.ts +3 -3
  192. package/dist/plugin/geolocation/src/utils/create-subscription-manager.d.ts +1 -1
  193. package/dist/plugin/geolocation/src/utils/insert-sort.d.ts +1 -0
  194. package/dist/plugin/notification/index.cjs +288 -13
  195. package/dist/plugin/notification/index.d.ts +4 -4
  196. package/dist/plugin/notification/index.mjs +288 -13
  197. package/dist/plugin/notification/src/plugin/appearance/constants/index.d.ts +1 -1
  198. package/dist/plugin/notification/src/plugin/appearance/types/appearance.d.ts +3 -3
  199. package/dist/plugin/notification/src/plugin/badge/types/badge.d.ts +3 -3
  200. package/dist/plugin/notification/src/plugin/battery/types/battery.d.ts +3 -3
  201. package/dist/plugin/notification/src/plugin/clipboard/types/clipboard.d.ts +2 -2
  202. package/dist/plugin/notification/src/plugin/dimension/constants/index.d.ts +10 -6
  203. package/dist/plugin/notification/src/plugin/dimension/cores/index.d.ts +15 -0
  204. package/dist/plugin/notification/src/plugin/dimension/types/dimensions.d.ts +52 -24
  205. package/dist/plugin/notification/src/plugin/dimension/utils/create-env-observer.d.ts +16 -7
  206. package/dist/plugin/notification/src/plugin/dimension/utils/create-environment-observer.d.ts +33 -0
  207. package/dist/plugin/notification/src/plugin/fullscreen/types/fullscreen.d.ts +7 -7
  208. package/dist/plugin/notification/src/plugin/geolocation/types/geolocation.d.ts +4 -4
  209. package/dist/plugin/notification/src/plugin/notification/types/notification.d.ts +4 -4
  210. package/dist/plugin/notification/src/plugin/open/types/open.d.ts +12 -12
  211. package/dist/plugin/notification/src/plugin/permission/constants/index.d.ts +3 -1
  212. package/dist/plugin/notification/src/plugin/permission/types/permission.d.ts +7 -4
  213. package/dist/plugin/notification/src/plugin/pip/types/pip.d.ts +7 -7
  214. package/dist/plugin/notification/src/plugin/platform/constants/index.d.ts +1 -1
  215. package/dist/plugin/notification/src/plugin/platform/types/platform.d.ts +13 -13
  216. package/dist/plugin/notification/src/plugin/theme/types/theme.d.ts +2 -2
  217. package/dist/plugin/notification/src/plugin/vibration/types/vibration.d.ts +3 -3
  218. package/dist/plugin/notification/src/types/subscription-manager.d.ts +3 -3
  219. package/dist/plugin/notification/src/utils/create-subscription-manager.d.ts +1 -1
  220. package/dist/plugin/notification/src/utils/insert-sort.d.ts +1 -0
  221. package/dist/plugin/open/index.cjs +64 -55
  222. package/dist/plugin/open/index.d.ts +28 -12
  223. package/dist/plugin/open/index.mjs +64 -55
  224. package/dist/plugin/open/src/plugin/appearance/constants/index.d.ts +1 -1
  225. package/dist/plugin/open/src/plugin/appearance/types/appearance.d.ts +3 -3
  226. package/dist/plugin/open/src/plugin/badge/types/badge.d.ts +3 -3
  227. package/dist/plugin/open/src/plugin/battery/types/battery.d.ts +3 -3
  228. package/dist/plugin/open/src/plugin/clipboard/types/clipboard.d.ts +2 -2
  229. package/dist/plugin/open/src/plugin/dimension/constants/index.d.ts +10 -6
  230. package/dist/plugin/open/src/plugin/dimension/cores/index.d.ts +15 -0
  231. package/dist/plugin/open/src/plugin/dimension/types/dimensions.d.ts +52 -24
  232. package/dist/plugin/open/src/plugin/dimension/utils/create-env-observer.d.ts +16 -7
  233. package/dist/plugin/open/src/plugin/dimension/utils/create-environment-observer.d.ts +33 -0
  234. package/dist/plugin/open/src/plugin/fullscreen/types/fullscreen.d.ts +7 -7
  235. package/dist/plugin/open/src/plugin/geolocation/types/geolocation.d.ts +4 -4
  236. package/dist/plugin/open/src/plugin/notification/types/notification.d.ts +4 -4
  237. package/dist/plugin/open/src/plugin/open/types/open.d.ts +12 -12
  238. package/dist/plugin/open/src/plugin/permission/constants/index.d.ts +3 -1
  239. package/dist/plugin/open/src/plugin/permission/types/permission.d.ts +7 -4
  240. package/dist/plugin/open/src/plugin/pip/types/pip.d.ts +7 -7
  241. package/dist/plugin/open/src/plugin/platform/constants/index.d.ts +1 -1
  242. package/dist/plugin/open/src/plugin/platform/types/platform.d.ts +13 -13
  243. package/dist/plugin/open/src/plugin/theme/types/theme.d.ts +2 -2
  244. package/dist/plugin/open/src/plugin/vibration/types/vibration.d.ts +3 -3
  245. package/dist/plugin/open/src/types/subscription-manager.d.ts +3 -3
  246. package/dist/plugin/open/src/utils/create-subscription-manager.d.ts +1 -1
  247. package/dist/plugin/open/src/utils/insert-sort.d.ts +1 -0
  248. package/dist/plugin/permission/index.cjs +372 -13
  249. package/dist/plugin/permission/index.d.ts +11 -5
  250. package/dist/plugin/permission/index.mjs +372 -13
  251. package/dist/plugin/permission/src/plugin/appearance/constants/index.d.ts +1 -1
  252. package/dist/plugin/permission/src/plugin/appearance/types/appearance.d.ts +3 -3
  253. package/dist/plugin/permission/src/plugin/badge/types/badge.d.ts +3 -3
  254. package/dist/plugin/permission/src/plugin/battery/types/battery.d.ts +3 -3
  255. package/dist/plugin/permission/src/plugin/clipboard/types/clipboard.d.ts +2 -2
  256. package/dist/plugin/permission/src/plugin/dimension/constants/index.d.ts +10 -6
  257. package/dist/plugin/permission/src/plugin/dimension/cores/index.d.ts +15 -0
  258. package/dist/plugin/permission/src/plugin/dimension/types/dimensions.d.ts +52 -24
  259. package/dist/plugin/permission/src/plugin/dimension/utils/create-env-observer.d.ts +16 -7
  260. package/dist/plugin/permission/src/plugin/dimension/utils/create-environment-observer.d.ts +33 -0
  261. package/dist/plugin/permission/src/plugin/fullscreen/types/fullscreen.d.ts +7 -7
  262. package/dist/plugin/permission/src/plugin/geolocation/types/geolocation.d.ts +4 -4
  263. package/dist/plugin/permission/src/plugin/notification/types/notification.d.ts +4 -4
  264. package/dist/plugin/permission/src/plugin/open/types/open.d.ts +12 -12
  265. package/dist/plugin/permission/src/plugin/permission/constants/index.d.ts +3 -1
  266. package/dist/plugin/permission/src/plugin/permission/types/permission.d.ts +7 -4
  267. package/dist/plugin/permission/src/plugin/pip/types/pip.d.ts +7 -7
  268. package/dist/plugin/permission/src/plugin/platform/constants/index.d.ts +1 -1
  269. package/dist/plugin/permission/src/plugin/platform/types/platform.d.ts +13 -13
  270. package/dist/plugin/permission/src/plugin/theme/types/theme.d.ts +2 -2
  271. package/dist/plugin/permission/src/plugin/vibration/types/vibration.d.ts +3 -3
  272. package/dist/plugin/permission/src/types/subscription-manager.d.ts +3 -3
  273. package/dist/plugin/permission/src/utils/create-subscription-manager.d.ts +1 -1
  274. package/dist/plugin/permission/src/utils/insert-sort.d.ts +1 -0
  275. package/dist/plugin/pip/index.cjs +58 -57
  276. package/dist/plugin/pip/index.d.ts +7 -7
  277. package/dist/plugin/pip/index.mjs +58 -57
  278. package/dist/plugin/pip/src/plugin/appearance/constants/index.d.ts +1 -1
  279. package/dist/plugin/pip/src/plugin/appearance/types/appearance.d.ts +3 -3
  280. package/dist/plugin/pip/src/plugin/badge/types/badge.d.ts +3 -3
  281. package/dist/plugin/pip/src/plugin/battery/types/battery.d.ts +3 -3
  282. package/dist/plugin/pip/src/plugin/clipboard/types/clipboard.d.ts +2 -2
  283. package/dist/plugin/pip/src/plugin/dimension/constants/index.d.ts +10 -6
  284. package/dist/plugin/pip/src/plugin/dimension/cores/index.d.ts +15 -0
  285. package/dist/plugin/pip/src/plugin/dimension/types/dimensions.d.ts +52 -24
  286. package/dist/plugin/pip/src/plugin/dimension/utils/create-env-observer.d.ts +16 -7
  287. package/dist/plugin/pip/src/plugin/dimension/utils/create-environment-observer.d.ts +33 -0
  288. package/dist/plugin/pip/src/plugin/fullscreen/types/fullscreen.d.ts +7 -7
  289. package/dist/plugin/pip/src/plugin/geolocation/types/geolocation.d.ts +4 -4
  290. package/dist/plugin/pip/src/plugin/notification/types/notification.d.ts +4 -4
  291. package/dist/plugin/pip/src/plugin/open/types/open.d.ts +12 -12
  292. package/dist/plugin/pip/src/plugin/permission/constants/index.d.ts +3 -1
  293. package/dist/plugin/pip/src/plugin/permission/types/permission.d.ts +7 -4
  294. package/dist/plugin/pip/src/plugin/pip/types/pip.d.ts +7 -7
  295. package/dist/plugin/pip/src/plugin/platform/constants/index.d.ts +1 -1
  296. package/dist/plugin/pip/src/plugin/platform/types/platform.d.ts +13 -13
  297. package/dist/plugin/pip/src/plugin/theme/types/theme.d.ts +2 -2
  298. package/dist/plugin/pip/src/plugin/vibration/types/vibration.d.ts +3 -3
  299. package/dist/plugin/pip/src/types/subscription-manager.d.ts +3 -3
  300. package/dist/plugin/pip/src/utils/create-subscription-manager.d.ts +1 -1
  301. package/dist/plugin/pip/src/utils/insert-sort.d.ts +1 -0
  302. package/dist/plugin/platform/index.cjs +98 -92
  303. package/dist/plugin/platform/index.d.ts +30 -14
  304. package/dist/plugin/platform/index.mjs +92 -85
  305. package/dist/plugin/platform/src/plugin/appearance/constants/index.d.ts +1 -1
  306. package/dist/plugin/platform/src/plugin/appearance/types/appearance.d.ts +3 -3
  307. package/dist/plugin/platform/src/plugin/badge/types/badge.d.ts +3 -3
  308. package/dist/plugin/platform/src/plugin/battery/types/battery.d.ts +3 -3
  309. package/dist/plugin/platform/src/plugin/clipboard/types/clipboard.d.ts +2 -2
  310. package/dist/plugin/platform/src/plugin/dimension/constants/index.d.ts +10 -6
  311. package/dist/plugin/platform/src/plugin/dimension/cores/index.d.ts +15 -0
  312. package/dist/plugin/platform/src/plugin/dimension/types/dimensions.d.ts +52 -24
  313. package/dist/plugin/platform/src/plugin/dimension/utils/create-env-observer.d.ts +16 -7
  314. package/dist/plugin/platform/src/plugin/dimension/utils/create-environment-observer.d.ts +33 -0
  315. package/dist/plugin/platform/src/plugin/fullscreen/types/fullscreen.d.ts +7 -7
  316. package/dist/plugin/platform/src/plugin/geolocation/types/geolocation.d.ts +4 -4
  317. package/dist/plugin/platform/src/plugin/notification/types/notification.d.ts +4 -4
  318. package/dist/plugin/platform/src/plugin/open/types/open.d.ts +12 -12
  319. package/dist/plugin/platform/src/plugin/permission/constants/index.d.ts +3 -1
  320. package/dist/plugin/platform/src/plugin/permission/types/permission.d.ts +7 -4
  321. package/dist/plugin/platform/src/plugin/pip/types/pip.d.ts +7 -7
  322. package/dist/plugin/platform/src/plugin/platform/constants/index.d.ts +1 -1
  323. package/dist/plugin/platform/src/plugin/platform/types/platform.d.ts +13 -13
  324. package/dist/plugin/platform/src/plugin/theme/types/theme.d.ts +2 -2
  325. package/dist/plugin/platform/src/plugin/vibration/types/vibration.d.ts +3 -3
  326. package/dist/plugin/platform/src/types/subscription-manager.d.ts +3 -3
  327. package/dist/plugin/platform/src/utils/create-subscription-manager.d.ts +1 -1
  328. package/dist/plugin/platform/src/utils/insert-sort.d.ts +1 -0
  329. package/dist/plugin/theme/index.cjs +63 -54
  330. package/dist/plugin/theme/index.d.ts +2 -2
  331. package/dist/plugin/theme/index.mjs +63 -54
  332. package/dist/plugin/theme/src/plugin/appearance/constants/index.d.ts +1 -1
  333. package/dist/plugin/theme/src/plugin/appearance/types/appearance.d.ts +3 -3
  334. package/dist/plugin/theme/src/plugin/badge/types/badge.d.ts +3 -3
  335. package/dist/plugin/theme/src/plugin/battery/types/battery.d.ts +3 -3
  336. package/dist/plugin/theme/src/plugin/clipboard/types/clipboard.d.ts +2 -2
  337. package/dist/plugin/theme/src/plugin/dimension/constants/index.d.ts +10 -6
  338. package/dist/plugin/theme/src/plugin/dimension/cores/index.d.ts +15 -0
  339. package/dist/plugin/theme/src/plugin/dimension/types/dimensions.d.ts +52 -24
  340. package/dist/plugin/theme/src/plugin/dimension/utils/create-env-observer.d.ts +16 -7
  341. package/dist/plugin/theme/src/plugin/dimension/utils/create-environment-observer.d.ts +33 -0
  342. package/dist/plugin/theme/src/plugin/fullscreen/types/fullscreen.d.ts +7 -7
  343. package/dist/plugin/theme/src/plugin/geolocation/types/geolocation.d.ts +4 -4
  344. package/dist/plugin/theme/src/plugin/notification/types/notification.d.ts +4 -4
  345. package/dist/plugin/theme/src/plugin/open/types/open.d.ts +12 -12
  346. package/dist/plugin/theme/src/plugin/permission/constants/index.d.ts +3 -1
  347. package/dist/plugin/theme/src/plugin/permission/types/permission.d.ts +7 -4
  348. package/dist/plugin/theme/src/plugin/pip/types/pip.d.ts +7 -7
  349. package/dist/plugin/theme/src/plugin/platform/constants/index.d.ts +1 -1
  350. package/dist/plugin/theme/src/plugin/platform/types/platform.d.ts +13 -13
  351. package/dist/plugin/theme/src/plugin/theme/types/theme.d.ts +2 -2
  352. package/dist/plugin/theme/src/plugin/vibration/types/vibration.d.ts +3 -3
  353. package/dist/plugin/theme/src/types/subscription-manager.d.ts +3 -3
  354. package/dist/plugin/theme/src/utils/create-subscription-manager.d.ts +1 -1
  355. package/dist/plugin/theme/src/utils/insert-sort.d.ts +1 -0
  356. package/dist/plugin/vibration/index.d.ts +3 -3
  357. package/dist/plugin/vibration/src/plugin/appearance/constants/index.d.ts +1 -1
  358. package/dist/plugin/vibration/src/plugin/appearance/types/appearance.d.ts +3 -3
  359. package/dist/plugin/vibration/src/plugin/badge/types/badge.d.ts +3 -3
  360. package/dist/plugin/vibration/src/plugin/battery/types/battery.d.ts +3 -3
  361. package/dist/plugin/vibration/src/plugin/clipboard/types/clipboard.d.ts +2 -2
  362. package/dist/plugin/vibration/src/plugin/dimension/constants/index.d.ts +10 -6
  363. package/dist/plugin/vibration/src/plugin/dimension/cores/index.d.ts +15 -0
  364. package/dist/plugin/vibration/src/plugin/dimension/types/dimensions.d.ts +52 -24
  365. package/dist/plugin/vibration/src/plugin/dimension/utils/create-env-observer.d.ts +16 -7
  366. package/dist/plugin/vibration/src/plugin/dimension/utils/create-environment-observer.d.ts +33 -0
  367. package/dist/plugin/vibration/src/plugin/fullscreen/types/fullscreen.d.ts +7 -7
  368. package/dist/plugin/vibration/src/plugin/geolocation/types/geolocation.d.ts +4 -4
  369. package/dist/plugin/vibration/src/plugin/notification/types/notification.d.ts +4 -4
  370. package/dist/plugin/vibration/src/plugin/open/types/open.d.ts +12 -12
  371. package/dist/plugin/vibration/src/plugin/permission/constants/index.d.ts +3 -1
  372. package/dist/plugin/vibration/src/plugin/permission/types/permission.d.ts +7 -4
  373. package/dist/plugin/vibration/src/plugin/pip/types/pip.d.ts +7 -7
  374. package/dist/plugin/vibration/src/plugin/platform/constants/index.d.ts +1 -1
  375. package/dist/plugin/vibration/src/plugin/platform/types/platform.d.ts +13 -13
  376. package/dist/plugin/vibration/src/plugin/theme/types/theme.d.ts +2 -2
  377. package/dist/plugin/vibration/src/plugin/vibration/types/vibration.d.ts +3 -3
  378. package/dist/plugin/vibration/src/types/subscription-manager.d.ts +3 -3
  379. package/dist/plugin/vibration/src/utils/create-subscription-manager.d.ts +1 -1
  380. package/dist/plugin/vibration/src/utils/insert-sort.d.ts +1 -0
  381. package/dist/src/plugin/appearance/constants/index.d.ts +1 -1
  382. package/dist/src/plugin/appearance/types/appearance.d.ts +3 -3
  383. package/dist/src/plugin/badge/types/badge.d.ts +3 -3
  384. package/dist/src/plugin/battery/types/battery.d.ts +3 -3
  385. package/dist/src/plugin/clipboard/types/clipboard.d.ts +2 -2
  386. package/dist/src/plugin/dimension/constants/index.d.ts +10 -6
  387. package/dist/src/plugin/dimension/cores/index.d.ts +15 -0
  388. package/dist/src/plugin/dimension/types/dimensions.d.ts +52 -24
  389. package/dist/src/plugin/dimension/utils/create-env-observer.d.ts +16 -7
  390. package/dist/src/plugin/dimension/utils/create-environment-observer.d.ts +33 -0
  391. package/dist/src/plugin/fullscreen/types/fullscreen.d.ts +7 -7
  392. package/dist/src/plugin/geolocation/types/geolocation.d.ts +4 -4
  393. package/dist/src/plugin/notification/types/notification.d.ts +4 -4
  394. package/dist/src/plugin/open/types/open.d.ts +12 -12
  395. package/dist/src/plugin/permission/constants/index.d.ts +3 -1
  396. package/dist/src/plugin/permission/types/permission.d.ts +7 -4
  397. package/dist/src/plugin/pip/types/pip.d.ts +7 -7
  398. package/dist/src/plugin/platform/constants/index.d.ts +1 -1
  399. package/dist/src/plugin/platform/types/platform.d.ts +13 -13
  400. package/dist/src/plugin/theme/types/theme.d.ts +2 -2
  401. package/dist/src/plugin/vibration/types/vibration.d.ts +3 -3
  402. package/dist/src/types/subscription-manager.d.ts +3 -3
  403. package/dist/src/utils/create-subscription-manager.d.ts +1 -1
  404. package/dist/src/utils/insert-sort.d.ts +1 -0
  405. package/package.json +1 -1
@@ -21,9 +21,20 @@ var FALLBACK_MEDIA_QUERY_LIST = {
21
21
 
22
22
  exports.Orientation = void 0;
23
23
  (function (Orientation) {
24
- Orientation["Portrait"] = "portrait";
25
- Orientation["Landscape"] = "landscape";
26
- Orientation["Unknown"] = "unknown";
24
+ Orientation["PortraitPrimary"] = "portrait-primary";
25
+ Orientation["PortraitSecondary"] = "portrait-secondary";
26
+ Orientation["LandscapePrimary"] = "landscape-primary";
27
+ Orientation["LandscapeSecondary"] = "landscape-secondary";
28
+ })(exports.Orientation || (exports.Orientation = {}));
29
+ (function (Orientation) {
30
+ function isLandscape(orientation) {
31
+ return orientation === Orientation.LandscapePrimary || orientation === Orientation.LandscapeSecondary;
32
+ }
33
+ Orientation.isLandscape = isLandscape;
34
+ function isPortrait(orientation) {
35
+ return orientation === Orientation.PortraitPrimary || orientation === Orientation.PortraitSecondary;
36
+ }
37
+ Orientation.isPortrait = isPortrait;
27
38
  })(exports.Orientation || (exports.Orientation = {}));
28
39
  var ENV_PRESETS = {
29
40
  'safe-area-inset': {
@@ -61,19 +72,16 @@ var ENV_PRESETS = {
61
72
  left: 'viewport-segment-left',
62
73
  },
63
74
  };
64
- var FALLBACK_DIMENSION = {
65
- innerWidth: -1,
66
- innerHeight: -1,
67
- outerWidth: -1,
68
- outerHeight: -1,
69
- scale: 1,
70
- orientation: exports.Orientation.Unknown,
71
- };
72
- exports.MEDIA_QUERY_LIST = void 0;
75
+ exports.ORIENTATION_MEDIA_QUERY_LIST = void 0;
76
+ if (typeof globalThis.matchMedia !== 'undefined')
77
+ exports.ORIENTATION_MEDIA_QUERY_LIST = globalThis.matchMedia('(orientation: portrait)');
78
+ else
79
+ exports.ORIENTATION_MEDIA_QUERY_LIST = FALLBACK_MEDIA_QUERY_LIST;
80
+ exports.DEVICE_POSTURE_MEDIA_QUERY_LIST = void 0;
73
81
  if (typeof globalThis.matchMedia !== 'undefined')
74
- exports.MEDIA_QUERY_LIST = globalThis.matchMedia('(orientation: portrait)');
82
+ exports.DEVICE_POSTURE_MEDIA_QUERY_LIST = globalThis.matchMedia('(device-posture: folded)');
75
83
  else
76
- exports.MEDIA_QUERY_LIST = FALLBACK_MEDIA_QUERY_LIST;
84
+ exports.DEVICE_POSTURE_MEDIA_QUERY_LIST = FALLBACK_MEDIA_QUERY_LIST;
77
85
 
78
86
  var IE_WRAPPER_STORE = [];
79
87
  var MEDIA_QUERY_LIST_WRAPPER_STORE = [];
@@ -308,6 +316,8 @@ function createSubscriptionManager(attach, detach) {
308
316
  },
309
317
  subscribe: function (listener, options) {
310
318
  if (options === void 0) { options = {}; }
319
+ if (typeof options.signal !== 'undefined' && options.signal.aborted)
320
+ return function () { };
311
321
  var entry = { fn: listener, once: false };
312
322
  if (typeof options.once !== 'undefined')
313
323
  entry.once = options.once;
@@ -326,12 +336,8 @@ function createSubscriptionManager(attach, detach) {
326
336
  EventListener.remove(entry.signal, { type: 'abort', callback: cleanup });
327
337
  removeEntry(entry);
328
338
  };
329
- if (typeof entry.signal !== 'undefined') {
330
- if (entry.signal.aborted)
331
- removeEntry(entry);
332
- else
333
- EventListener.add(entry.signal, { type: 'abort', callback: cleanup });
334
- }
339
+ if (typeof entry.signal !== 'undefined')
340
+ EventListener.add(entry.signal, { type: 'abort', callback: cleanup });
335
341
  return function unsubscribe() {
336
342
  removeEntry(entry);
337
343
  };
@@ -368,8 +374,355 @@ function setStyle(element, styles) {
368
374
  }
369
375
  }
370
376
 
377
+ function createHiddenElement(tagName, focusable) {
378
+ if (focusable === void 0) { focusable = true; }
379
+ var element = globalThis.document.createElement(tagName);
380
+ if (typeof element.width !== 'undefined')
381
+ element.width = '0';
382
+ if (typeof element.height !== 'undefined')
383
+ element.height = '0';
384
+ if (typeof element.border !== 'undefined')
385
+ element.border = '0';
386
+ if (typeof element.frameBorder !== 'undefined')
387
+ element.frameBorder = '0';
388
+ if (typeof element.scrolling !== 'undefined')
389
+ element.scrolling = 'no';
390
+ if (typeof element.cellPadding !== 'undefined')
391
+ element.cellPadding = '0';
392
+ if (typeof element.cellSpacing !== 'undefined')
393
+ element.cellSpacing = '0';
394
+ if (typeof element.frame !== 'undefined')
395
+ element.frame = 'void';
396
+ if (typeof element.rules !== 'undefined')
397
+ element.rules = 'none';
398
+ if (typeof element.noWrap !== 'undefined')
399
+ element.noWrap = true;
400
+ element.tabIndex = -1;
401
+ element.setAttribute('role', 'presentation');
402
+ if (focusable) {
403
+ setStyle(element, {
404
+ width: '1px',
405
+ height: '1px',
406
+ });
407
+ }
408
+ else {
409
+ element.setAttribute('aria-hidden', 'true');
410
+ setStyle(element, {
411
+ width: '0',
412
+ height: '0',
413
+ zIndex: '-9999',
414
+ display: 'none',
415
+ visibility: 'hidden',
416
+ pointerEvents: 'none',
417
+ });
418
+ }
419
+ setStyle(element, {
420
+ position: 'absolute',
421
+ top: '0',
422
+ left: '0',
423
+ padding: '0',
424
+ margin: '0',
425
+ border: 'none',
426
+ outline: 'hidden',
427
+ clip: 'rect(1px, 1px, 1px, 1px)',
428
+ clipPath: 'inset(50%)',
429
+ overflow: 'hidden',
430
+ whiteSpace: 'nowrap',
431
+ });
432
+ return element;
433
+ }
434
+
435
+ var MAX_SEGMENTS_PER_AXIS = 4;
371
436
  function noop() {
372
437
  }
438
+ function getSupportedEnvironment() {
439
+ if (typeof globalThis.CSS !== 'undefined' && typeof globalThis.CSS.supports === 'function') {
440
+ if (globalThis.CSS.supports('x: env(x)'))
441
+ return 'env';
442
+ if (globalThis.CSS.supports('x: constant(x)'))
443
+ return 'constant';
444
+ }
445
+ return undefined;
446
+ }
447
+ function getSegmentGrid() {
448
+ if (typeof globalThis.matchMedia !== 'function')
449
+ return { rows: 1, cols: 1 };
450
+ var cols = 1;
451
+ var rows = 1;
452
+ for (var i = MAX_SEGMENTS_PER_AXIS; i >= 2; i--) {
453
+ if (globalThis.matchMedia('(horizontal-viewport-segments: ' + i + ')').matches) {
454
+ cols = i;
455
+ break;
456
+ }
457
+ }
458
+ for (var i = MAX_SEGMENTS_PER_AXIS; i >= 2; i--) {
459
+ if (globalThis.matchMedia('(vertical-viewport-segments: ' + i + ')').matches) {
460
+ rows = i;
461
+ break;
462
+ }
463
+ }
464
+ return { rows: rows, cols: cols };
465
+ }
466
+ function buildSegmentMediaQueryLists() {
467
+ if (typeof globalThis.matchMedia !== 'function')
468
+ return [];
469
+ var mediaQueryLists = [];
470
+ for (var i = 2; i <= MAX_SEGMENTS_PER_AXIS; i++) {
471
+ mediaQueryLists.push(globalThis.matchMedia('(horizontal-viewport-segments: ' + i + ')'));
472
+ mediaQueryLists.push(globalThis.matchMedia('(vertical-viewport-segments: ' + i + ')'));
473
+ }
474
+ return mediaQueryLists;
475
+ }
476
+ function createViewportSegmentObserver() {
477
+ var viewport = globalThis.viewport;
478
+ var visualViewport = globalThis.visualViewport;
479
+ var devicePosture = globalThis.navigator.devicePosture;
480
+ var hasSegmentsAPI = typeof viewport !== 'undefined';
481
+ var hasLegacySegmentsAPI = !hasSegmentsAPI && typeof visualViewport !== 'undefined' && visualViewport !== null && typeof visualViewport.segments !== 'undefined';
482
+ var hasDevicePosture = typeof devicePosture !== 'undefined';
483
+ var onChangeSubscriptionManager = createSubscriptionManager(attachOnChange, detachOnChange);
484
+ var support = getSupportedEnvironment();
485
+ var cachedDiv = null;
486
+ var segmentMediaQueryLists = [];
487
+ var previousSegments = null;
488
+ function attachCSSFallbackListeners() {
489
+ segmentMediaQueryLists = buildSegmentMediaQueryLists();
490
+ for (var i = 0; i < segmentMediaQueryLists.length; i++)
491
+ EventListener.add(segmentMediaQueryLists[i], { type: 'change', callback: onSegmentChange });
492
+ if (exports.DEVICE_POSTURE_MEDIA_QUERY_LIST.media !== 'not all')
493
+ EventListener.add(exports.DEVICE_POSTURE_MEDIA_QUERY_LIST, { type: 'change', callback: onSegmentChange });
494
+ }
495
+ function detachCSSFallbackListeners() {
496
+ for (var i = 0; i < segmentMediaQueryLists.length; i++)
497
+ EventListener.remove(segmentMediaQueryLists[i], { type: 'change', callback: onSegmentChange });
498
+ segmentMediaQueryLists = [];
499
+ if (exports.DEVICE_POSTURE_MEDIA_QUERY_LIST.media !== 'not all')
500
+ EventListener.remove(exports.DEVICE_POSTURE_MEDIA_QUERY_LIST, { type: 'change', callback: onSegmentChange });
501
+ }
502
+ function attachDevicePostureChangeListener() {
503
+ if (hasDevicePosture)
504
+ EventListener.add(devicePosture, { type: 'change', callback: onSegmentChange });
505
+ attachCSSFallbackListeners();
506
+ }
507
+ function detachDevicePostureChangeListener() {
508
+ if (hasDevicePosture)
509
+ EventListener.remove(devicePosture, { type: 'change', callback: onSegmentChange });
510
+ detachCSSFallbackListeners();
511
+ }
512
+ function attachVisualViewportResizeListener() {
513
+ EventListener.add(visualViewport, { type: 'resize', callback: onSegmentChange, options: { passive: true } });
514
+ }
515
+ function detachVisualViewportResizeListener() {
516
+ EventListener.remove(visualViewport, { type: 'resize', callback: onSegmentChange, options: { passive: true } });
517
+ }
518
+ function attachOnChange() {
519
+ EventListener.add(globalThis, { type: 'resize', callback: onSegmentChange });
520
+ if (hasSegmentsAPI) {
521
+ attachDevicePostureChangeListener();
522
+ }
523
+ else if (hasLegacySegmentsAPI) {
524
+ attachVisualViewportResizeListener();
525
+ attachDevicePostureChangeListener();
526
+ }
527
+ else {
528
+ getOrCreateCachedDiv();
529
+ attachVisualViewportResizeListener();
530
+ }
531
+ }
532
+ function detachOnChange() {
533
+ EventListener.remove(globalThis, { type: 'resize', callback: onSegmentChange });
534
+ if (hasSegmentsAPI) {
535
+ detachDevicePostureChangeListener();
536
+ }
537
+ else if (hasLegacySegmentsAPI) {
538
+ detachVisualViewportResizeListener();
539
+ detachDevicePostureChangeListener();
540
+ }
541
+ else {
542
+ detachVisualViewportResizeListener();
543
+ releaseDiv();
544
+ }
545
+ }
546
+ function segmentsEqual(segments1, segments2) {
547
+ if (segments1.length !== segments2.length)
548
+ return false;
549
+ for (var i = 0; i < segments1.length; i++) {
550
+ var segment1 = segments1[i];
551
+ var segment2 = segments2[i];
552
+ if (segment1.width !== segment2.width || segment1.height !== segment2.height || segment1.top !== segment2.top || segment1.left !== segment2.left || segment1.bottom !== segment2.bottom || segment1.right !== segment2.right)
553
+ return false;
554
+ }
555
+ return true;
556
+ }
557
+ function onSegmentChange() {
558
+ var next = getValue();
559
+ if (previousSegments !== null && segmentsEqual(previousSegments, next))
560
+ return;
561
+ previousSegments = next;
562
+ onChangeSubscriptionManager.emit(next);
563
+ }
564
+ function buildDiv() {
565
+ var div = createHiddenElement('div');
566
+ div.setAttribute('data-viewport-segment-observer', '');
567
+ div.style.setProperty('position', 'fixed', 'important');
568
+ div.style.setProperty('top', '0', 'important');
569
+ div.style.setProperty('left', '0', 'important');
570
+ div.style.setProperty('visibility', 'hidden', 'important');
571
+ div.style.setProperty('pointer-events', 'none', 'important');
572
+ div.style.setProperty('z-index', '-1', 'important');
573
+ div.style.setProperty('box-sizing', 'content-box', 'important');
574
+ div.style.setProperty('padding', '0', 'important');
575
+ div.style.setProperty('margin', '0', 'important');
576
+ div.style.setProperty('border', '0', 'important');
577
+ div.style.setProperty('width', '0', 'important');
578
+ div.style.setProperty('height', '0', 'important');
579
+ div.style.setProperty('min-width', '0', 'important');
580
+ div.style.setProperty('min-height', '0', 'important');
581
+ div.style.setProperty('max-width', 'none', 'important');
582
+ div.style.setProperty('max-height', 'none', 'important');
583
+ div.style.setProperty('transition', 'none', 'important');
584
+ div.style.setProperty('animation', 'none', 'important');
585
+ div.style.setProperty('display', 'block', 'important');
586
+ div.style.setProperty('float', 'none', 'important');
587
+ div.style.setProperty('transform', 'none', 'important');
588
+ return div;
589
+ }
590
+ function getOrCreateCachedDiv() {
591
+ if (cachedDiv !== null)
592
+ return cachedDiv;
593
+ cachedDiv = buildDiv();
594
+ globalThis.document.body.appendChild(cachedDiv);
595
+ return cachedDiv;
596
+ }
597
+ function releaseDiv() {
598
+ if (cachedDiv !== null) {
599
+ if (cachedDiv.parentNode !== null)
600
+ cachedDiv.parentNode.removeChild(cachedDiv);
601
+ cachedDiv = null;
602
+ }
603
+ }
604
+ function readFromSegmentsAPI() {
605
+ var segments;
606
+ if (hasSegmentsAPI)
607
+ segments = viewport.segments;
608
+ else
609
+ segments = visualViewport.segments;
610
+ if (segments === null || typeof segments === 'undefined')
611
+ return [];
612
+ var results = [];
613
+ for (var i = 0; i < segments.length; i++) {
614
+ var segment = segments[i];
615
+ results.push({
616
+ width: segment.width,
617
+ height: segment.height,
618
+ top: segment.top,
619
+ left: segment.left,
620
+ bottom: segment.bottom,
621
+ right: segment.right,
622
+ });
623
+ }
624
+ return results;
625
+ }
626
+ function buildFullViewportSegment() {
627
+ var width = globalThis.innerWidth;
628
+ var height = globalThis.innerHeight;
629
+ return {
630
+ width: width,
631
+ height: height,
632
+ top: 0,
633
+ left: 0,
634
+ bottom: height,
635
+ right: width,
636
+ };
637
+ }
638
+ function readFromCSSEnv(div) {
639
+ var grid = getSegmentGrid();
640
+ if (grid.rows === 1 && grid.cols === 1)
641
+ return [buildFullViewportSegment()];
642
+ if (typeof support === 'undefined' || typeof div.style.setProperty === 'undefined')
643
+ return [buildFullViewportSegment()];
644
+ var results = [];
645
+ for (var row = 0; row < grid.rows; row++) {
646
+ for (var col = 0; col < grid.cols; col++) {
647
+ div.style.setProperty('width', support + '(viewport-segment-width ' + row + ' ' + col + ', -1px)', 'important');
648
+ div.style.setProperty('height', support + '(viewport-segment-height ' + row + ' ' + col + ', -1px)', 'important');
649
+ div.style.setProperty('margin-top', support + '(viewport-segment-top ' + row + ' ' + col + ', -1px)', 'important');
650
+ div.style.setProperty('margin-left', support + '(viewport-segment-left ' + row + ' ' + col + ', -1px)', 'important');
651
+ div.style.setProperty('margin-bottom', support + '(viewport-segment-bottom ' + row + ' ' + col + ', -1px)', 'important');
652
+ div.style.setProperty('margin-right', support + '(viewport-segment-right ' + row + ' ' + col + ', -1px)', 'important');
653
+ var computed = globalThis.getComputedStyle(div);
654
+ var top_1 = globalThis.parseFloat(computed.marginTop);
655
+ if (top_1 < 0)
656
+ continue;
657
+ var left = globalThis.parseFloat(computed.marginLeft);
658
+ var bottom = globalThis.parseFloat(computed.marginBottom);
659
+ var right = globalThis.parseFloat(computed.marginRight);
660
+ var width = globalThis.parseFloat(computed.width);
661
+ var height = globalThis.parseFloat(computed.height);
662
+ results.push({
663
+ width: width,
664
+ height: height,
665
+ top: top_1,
666
+ left: left,
667
+ bottom: bottom,
668
+ right: right,
669
+ });
670
+ }
671
+ }
672
+ return results;
673
+ }
674
+ function getValue() {
675
+ if (hasSegmentsAPI || hasLegacySegmentsAPI)
676
+ return readFromSegmentsAPI();
677
+ if (cachedDiv !== null)
678
+ return readFromCSSEnv(cachedDiv);
679
+ var div = buildDiv();
680
+ globalThis.document.body.appendChild(div);
681
+ var results = readFromCSSEnv(div);
682
+ globalThis.document.body.removeChild(div);
683
+ return results;
684
+ }
685
+ function useCssVariable(prefix) {
686
+ if (typeof globalThis.document === 'undefined')
687
+ return noop;
688
+ var attributes = keys(ENV_PRESETS['viewport-segment']);
689
+ var element = globalThis.document.documentElement;
690
+ var lastCount = 0;
691
+ function applySegments(segments) {
692
+ for (var i = segments.length; i < lastCount; i++) {
693
+ for (var j = 0; j < attributes.length; j++) {
694
+ element.style.removeProperty('--' + prefix + '-' + i + '-' + attributes[j]);
695
+ }
696
+ }
697
+ lastCount = segments.length;
698
+ for (var i = 0; i < segments.length; i++) {
699
+ var segment = segments[i];
700
+ for (var j = 0; j < attributes.length; j++) {
701
+ var attribute = attributes[j];
702
+ element.style.setProperty('--' + prefix + '-' + i + '-' + attribute, segment[attribute] + 'px');
703
+ }
704
+ }
705
+ }
706
+ applySegments(getValue());
707
+ var unsubscribe = onChangeSubscriptionManager.subscribe(function (segments) {
708
+ applySegments(segments);
709
+ });
710
+ return function () {
711
+ unsubscribe();
712
+ for (var i = 0; i < lastCount; i++)
713
+ for (var j = 0; j < attributes.length; j++)
714
+ element.style.removeProperty('--' + prefix + '-' + i + '-' + attributes[j]);
715
+ lastCount = 0;
716
+ };
717
+ }
718
+ return {
719
+ get value() {
720
+ return getValue();
721
+ },
722
+ onChange: onChangeSubscriptionManager.subscribe,
723
+ useCssVariable: useCssVariable,
724
+ };
725
+ }
373
726
  function createVirtualKeyboardObserver() {
374
727
  var onChangeSubscriptionManager = createSubscriptionManager(attachOnChange, detachOnChange);
375
728
  function attachOnChange() {
@@ -387,16 +740,16 @@ function createVirtualKeyboardObserver() {
387
740
  var top = rect.y;
388
741
  var width = rect.width;
389
742
  var height = rect.height;
390
- var right = (function () {
391
- if (width === 0)
392
- return 0;
393
- return Math.max(0, globalThis.innerWidth - (left + width));
394
- })();
395
- var bottom = (function () {
396
- if (height === 0)
397
- return 0;
398
- return Math.max(0, globalThis.innerHeight - (top + height));
399
- })();
743
+ var right;
744
+ if (width === 0)
745
+ right = 0;
746
+ else
747
+ right = Math.max(0, globalThis.innerWidth - (left + width));
748
+ var bottom;
749
+ if (height === 0)
750
+ bottom = 0;
751
+ else
752
+ bottom = Math.max(0, globalThis.innerHeight - (top + height));
400
753
  return {
401
754
  top: top,
402
755
  right: right,
@@ -406,17 +759,43 @@ function createVirtualKeyboardObserver() {
406
759
  height: height,
407
760
  };
408
761
  }
762
+ function useCssVariable(prefix) {
763
+ if (typeof globalThis.document === 'undefined')
764
+ return noop;
765
+ var attributes = keys(ENV_PRESETS['keyboard-inset']);
766
+ var element = globalThis.document.documentElement;
767
+ function applyValues(values) {
768
+ for (var i = 0; i < attributes.length; i++) {
769
+ var attribute = attributes[i];
770
+ element.style.setProperty('--' + prefix + '-' + attribute, values[attribute] + 'px');
771
+ }
772
+ }
773
+ applyValues(getValue());
774
+ var unsubscribe = onChangeSubscriptionManager.subscribe(function (values) {
775
+ applyValues(values);
776
+ });
777
+ return function () {
778
+ unsubscribe();
779
+ for (var i = 0; i < attributes.length; i++)
780
+ element.style.removeProperty('--' + prefix + '-' + attributes[i]);
781
+ };
782
+ }
409
783
  return {
410
- get: getValue,
784
+ get value() {
785
+ return getValue();
786
+ },
411
787
  onChange: onChangeSubscriptionManager.subscribe,
788
+ useCssVariable: useCssVariable,
412
789
  };
413
790
  }
414
- function createEnvObserver(preset) {
791
+ function createEnvironmentObserver(preset) {
415
792
  if (preset === 'keyboard-inset' && typeof globalThis.navigator.virtualKeyboard !== 'undefined')
416
793
  return createVirtualKeyboardObserver();
417
- var envMap = ENV_PRESETS[preset];
418
- var attributes = keys(envMap);
419
- var support = getSupportedEnv();
794
+ if (preset === 'viewport-segment')
795
+ return createViewportSegmentObserver();
796
+ var environmentMap = ENV_PRESETS[preset];
797
+ var attributes = keys(environmentMap);
798
+ var support = getSupportedEnvironment();
420
799
  var parentReadyCallbacks = [];
421
800
  var onChangeSubscriptionManager = createSubscriptionManager(attachOnChange, detachOnChange);
422
801
  var elementComputedStyle = {};
@@ -433,15 +812,6 @@ function createEnvObserver(preset) {
433
812
  function detachOnChange() {
434
813
  removeDetector();
435
814
  }
436
- function getSupportedEnv() {
437
- if (typeof globalThis.CSS !== 'undefined' && typeof globalThis.CSS.supports === 'function') {
438
- if (globalThis.CSS.supports('x: env(x)'))
439
- return 'env';
440
- if (globalThis.CSS.supports('x: constant(x)'))
441
- return 'constant';
442
- }
443
- return undefined;
444
- }
445
815
  function isSameValues(a, b) {
446
816
  for (var i = 0; i < attributes.length; i++) {
447
817
  var key = attributes[i];
@@ -481,7 +851,7 @@ function createEnvObserver(preset) {
481
851
  parentReadyCallbacks[i]();
482
852
  }
483
853
  function addChild(parent, attribute) {
484
- var envVar = envMap[attribute];
854
+ var envVar = environmentMap[attribute];
485
855
  var p1 = globalThis.document.createElement('div');
486
856
  var p2 = globalThis.document.createElement('div');
487
857
  var c1 = globalThis.document.createElement('div');
@@ -544,9 +914,8 @@ function createEnvObserver(preset) {
544
914
  }
545
915
  function init() {
546
916
  if (typeof support === 'undefined') {
547
- for (var i = 0; i < attributes.length; i++) {
917
+ for (var i = 0; i < attributes.length; i++)
548
918
  elementComputedStyle[attributes[i]] = 0;
549
- }
550
919
  return;
551
920
  }
552
921
  elementComputedStyle = {};
@@ -590,8 +959,28 @@ function createEnvObserver(preset) {
590
959
  }
591
960
  return result;
592
961
  }
962
+ function useCssVariable(prefix) {
963
+ if (typeof support === 'undefined' || typeof globalThis.document === 'undefined')
964
+ return noop;
965
+ var element = globalThis.document.documentElement;
966
+ function applyValues(values) {
967
+ for (var i = 0; i < attributes.length; i++) {
968
+ var attribute = attributes[i];
969
+ element.style.setProperty('--' + prefix + '-' + String(attributes[i]), values[attribute] + 'px');
970
+ }
971
+ }
972
+ var unsubscribe = onChangeSubscriptionManager.subscribe(function (values) {
973
+ applyValues(values);
974
+ });
975
+ applyValues(readValues());
976
+ return function () {
977
+ unsubscribe();
978
+ for (var i = 0; i < attributes.length; i++)
979
+ element.style.removeProperty('--' + prefix + '-' + String(attributes[i]));
980
+ };
981
+ }
593
982
  return {
594
- get: function () {
983
+ get value() {
595
984
  if (parentDiv !== null)
596
985
  return readValues();
597
986
  init();
@@ -604,55 +993,156 @@ function createEnvObserver(preset) {
604
993
  if (typeof support === 'undefined')
605
994
  return noop;
606
995
  return onChangeSubscriptionManager.subscribe(callback, options);
607
- }
996
+ },
997
+ useCssVariable: useCssVariable
608
998
  };
609
999
  }
610
1000
 
611
- var safeAreaInsetObserver = createEnvObserver('safe-area-inset');
612
- var safeAreaMaxInsetObserver = createEnvObserver('safe-area-max-inset');
613
- var keyboardInsetObserver = createEnvObserver('keyboard-inset');
614
- var titlebarAreaObserver = createEnvObserver('titlebar-area');
615
- var viewportSegmentObserver = createEnvObserver('viewport-segment');
616
- var onChangeSubscriptionManager = createSubscriptionManager(attachOnChange, detachOnChange);
1001
+ function createCustomError(name, Base) {
1002
+ if (Base === void 0) { Base = Error; }
1003
+ function CustomError(message) {
1004
+ if (!(this instanceof CustomError))
1005
+ return new CustomError(message);
1006
+ var error = (function () {
1007
+ if (typeof message === 'undefined')
1008
+ return new Base('');
1009
+ return new Base(message);
1010
+ })();
1011
+ if (typeof Object.setPrototypeOf === 'function')
1012
+ Object.setPrototypeOf(error, CustomError.prototype);
1013
+ else
1014
+ error.__proto__ = CustomError.prototype;
1015
+ error.name = name;
1016
+ if (typeof message !== 'undefined')
1017
+ error.message = message;
1018
+ if (typeof Symbol !== 'undefined' && Symbol.toStringTag) {
1019
+ try {
1020
+ Object.defineProperty(error, Symbol.toStringTag, {
1021
+ value: name,
1022
+ writable: false,
1023
+ enumerable: false,
1024
+ configurable: true
1025
+ });
1026
+ }
1027
+ catch (_) {
1028
+ }
1029
+ }
1030
+ if (typeof Error.captureStackTrace === 'function') {
1031
+ Error.captureStackTrace(error, CustomError);
1032
+ }
1033
+ else if (Base.captureStackTrace && typeof Base.captureStackTrace === 'function') {
1034
+ Base.captureStackTrace(error, CustomError);
1035
+ }
1036
+ else {
1037
+ try {
1038
+ var tempError = new Base();
1039
+ if (tempError.stack)
1040
+ error.stack = tempError.stack;
1041
+ }
1042
+ catch (_) {
1043
+ }
1044
+ }
1045
+ return error;
1046
+ }
1047
+ CustomError.prototype = Object.create(Base.prototype, {
1048
+ constructor: {
1049
+ value: CustomError,
1050
+ writable: true,
1051
+ enumerable: false,
1052
+ configurable: true
1053
+ }
1054
+ });
1055
+ try {
1056
+ Object.defineProperty(CustomError.prototype, 'name', {
1057
+ value: name,
1058
+ writable: true,
1059
+ enumerable: false,
1060
+ configurable: true
1061
+ });
1062
+ }
1063
+ catch (_) {
1064
+ try {
1065
+ CustomError.prototype.name = name;
1066
+ }
1067
+ catch (_) {
1068
+ }
1069
+ }
1070
+ try {
1071
+ Object.defineProperty(CustomError, 'name', {
1072
+ value: name,
1073
+ writable: false,
1074
+ enumerable: false,
1075
+ configurable: true
1076
+ });
1077
+ }
1078
+ catch (_) {
1079
+ }
1080
+ return CustomError;
1081
+ }
1082
+
1083
+ var PermissionNotGrantedError = createCustomError('PermissionNotGrantedError');
1084
+
1085
+ var NotSupportedError = createCustomError('NotSupportedError');
1086
+
1087
+ var safeAreaInsetObserver = createEnvironmentObserver('safe-area-inset');
1088
+ var safeAreaMaxInsetObserver = createEnvironmentObserver('safe-area-max-inset');
1089
+ var keyboardInsetObserver = createEnvironmentObserver('keyboard-inset');
1090
+ var titlebarAreaObserver = createEnvironmentObserver('titlebar-area');
1091
+ var viewportSegmentObserver = createEnvironmentObserver('viewport-segment');
1092
+ var onDimensionChangeSubscriptionManager = createSubscriptionManager(attachOnDimensionChange, detachOnDimensionChange);
1093
+ var onScreenOrientationChangeSubscriptionManager = createSubscriptionManager(attachOnScreenOrientationChange, detachOnScreenOrientationChange);
1094
+ var onDeviceOrientationChangeSubscriptionManager = createSubscriptionManager(attachOnDeviceOrientationChange, detachOnDeviceOrientationChange);
617
1095
  var dimensionRef = null;
1096
+ var screenOrientationRef = null;
1097
+ var deviceOrientationRef = null;
618
1098
  var Dimension = {
619
1099
  get value() {
620
1100
  return getDimension();
621
1101
  },
622
1102
  environment: getEnvironment(),
623
- onChange: onChangeSubscriptionManager.subscribe,
1103
+ screenOrientation: getScreenOrientation(),
1104
+ deviceOrientation: getDeviceOrientation(),
1105
+ onChange: onDimensionChangeSubscriptionManager.subscribe,
624
1106
  Constants: {
625
1107
  Orientation: exports.Orientation,
626
1108
  },
627
- Errors: {},
1109
+ Errors: {
1110
+ NotSupportedError: NotSupportedError,
1111
+ PermissionNotGrantedError: PermissionNotGrantedError,
1112
+ },
628
1113
  };
629
1114
  function getOrientation() {
630
- if (typeof globalThis.screen !== 'undefined') {
1115
+ if (typeof globalThis.screen !== 'undefined' && typeof globalThis.screen.orientation !== 'undefined' && typeof globalThis.screen.orientation.type !== 'undefined') {
631
1116
  switch (globalThis.screen.orientation.type) {
632
1117
  case 'portrait-primary':
1118
+ return exports.Orientation.PortraitPrimary;
633
1119
  case 'portrait-secondary':
634
- return exports.Orientation.Portrait;
1120
+ return exports.Orientation.PortraitSecondary;
635
1121
  case 'landscape-primary':
1122
+ return exports.Orientation.LandscapePrimary;
636
1123
  case 'landscape-secondary':
637
- return exports.Orientation.Landscape;
1124
+ return exports.Orientation.LandscapeSecondary;
638
1125
  }
639
1126
  }
640
1127
  if (typeof globalThis.orientation !== 'undefined') {
641
1128
  switch (globalThis.orientation) {
642
1129
  case 0:
1130
+ return exports.Orientation.PortraitPrimary;
643
1131
  case 180:
644
- return exports.Orientation.Portrait;
1132
+ return exports.Orientation.PortraitSecondary;
645
1133
  case 90:
1134
+ return exports.Orientation.LandscapePrimary;
1135
+ case -90:
646
1136
  case 270:
647
- return exports.Orientation.Landscape;
1137
+ return exports.Orientation.LandscapeSecondary;
648
1138
  }
649
1139
  }
650
- if (exports.MEDIA_QUERY_LIST.media === 'not all')
651
- return exports.Orientation.Unknown;
652
- else if (exports.MEDIA_QUERY_LIST.matches)
653
- return exports.Orientation.Portrait;
1140
+ if (exports.ORIENTATION_MEDIA_QUERY_LIST.media === 'not all')
1141
+ throw new NotSupportedError('\'screen.orientation\', \'window.orientation\', and the orientation media query are all unsupported');
1142
+ if (exports.ORIENTATION_MEDIA_QUERY_LIST.matches)
1143
+ return exports.Orientation.PortraitPrimary;
654
1144
  else
655
- return exports.Orientation.Landscape;
1145
+ return exports.Orientation.LandscapePrimary;
656
1146
  }
657
1147
  function getScale() {
658
1148
  if (typeof globalThis.devicePixelRatio !== 'undefined')
@@ -661,77 +1151,176 @@ function getScale() {
661
1151
  }
662
1152
  function getEnvironment() {
663
1153
  return {
664
- safeAreaInset: {
665
- get value() {
666
- return safeAreaInsetObserver.get();
667
- },
668
- onChange: safeAreaInsetObserver.onChange,
1154
+ safeAreaInset: safeAreaInsetObserver,
1155
+ safeAreaMaxInset: safeAreaMaxInsetObserver,
1156
+ keyboardInset: keyboardInsetObserver,
1157
+ titlebarArea: titlebarAreaObserver,
1158
+ viewportSegment: viewportSegmentObserver,
1159
+ };
1160
+ }
1161
+ function getScreenOrientation() {
1162
+ return {
1163
+ get supported() {
1164
+ return screenOrientationSupported();
669
1165
  },
670
- safeAreaMaxInset: {
671
- get value() {
672
- return safeAreaMaxInsetObserver.get();
673
- },
674
- onChange: safeAreaMaxInsetObserver.onChange,
1166
+ get value() {
1167
+ return getOrientation();
675
1168
  },
676
- keyboardInset: {
677
- get value() {
678
- return keyboardInsetObserver.get();
679
- },
680
- onChange: keyboardInsetObserver.onChange,
1169
+ onChange: onScreenOrientationChangeSubscriptionManager.subscribe,
1170
+ };
1171
+ }
1172
+ function getDeviceOrientation() {
1173
+ return {
1174
+ get supported() {
1175
+ return deviceOrientationSupported();
681
1176
  },
682
- titlebarArea: {
683
- get value() {
684
- return titlebarAreaObserver.get();
685
- },
686
- onChange: titlebarAreaObserver.onChange,
687
- },
688
- viewportSegment: {
689
- get value() {
690
- return viewportSegmentObserver.get();
691
- },
692
- onChange: viewportSegmentObserver.onChange,
1177
+ get value() {
1178
+ return getDeviceOrientationValue();
693
1179
  },
1180
+ onChange: onDeviceOrientationChangeSubscriptionManager.subscribe,
694
1181
  };
695
1182
  }
696
1183
  function getDimension() {
1184
+ var innerWidth = 0;
1185
+ var innerHeight = 0;
1186
+ var outerWidth = 0;
1187
+ var outerHeight = 0;
1188
+ var scale = getScale();
697
1189
  if (typeof globalThis.innerWidth !== 'undefined') {
698
- return {
699
- innerWidth: globalThis.innerWidth,
700
- innerHeight: globalThis.innerHeight,
701
- outerWidth: globalThis.outerWidth,
702
- outerHeight: globalThis.outerHeight,
703
- scale: getScale(),
704
- orientation: getOrientation(),
705
- };
1190
+ innerWidth = globalThis.innerWidth;
1191
+ innerHeight = globalThis.innerHeight;
1192
+ outerWidth = globalThis.outerWidth;
1193
+ outerHeight = globalThis.outerHeight;
706
1194
  }
707
- return FALLBACK_DIMENSION;
1195
+ return {
1196
+ innerWidth: innerWidth,
1197
+ innerHeight: innerHeight,
1198
+ outerWidth: outerWidth,
1199
+ outerHeight: outerHeight,
1200
+ scale: scale,
1201
+ };
708
1202
  }
709
- function attachOnChange() {
1203
+ function attachOnDimensionChange() {
710
1204
  dimensionRef = getDimension();
711
- EventListener.add(globalThis, { type: 'resize', callback: onResize });
712
- if (typeof globalThis.screen.orientation.addEventListener === 'function')
713
- EventListener.add(globalThis.screen.orientation, { type: 'change', callback: onResize });
714
- else if (typeof globalThis.orientation !== 'undefined')
715
- EventListener.add(globalThis, { type: 'orientationChange', callback: onResize });
716
- else if (exports.MEDIA_QUERY_LIST.media !== 'not all')
717
- EventListener.add(exports.MEDIA_QUERY_LIST, { type: 'change', callback: onResize });
1205
+ EventListener.add(globalThis, { type: 'resize', callback: onDimensionChange });
718
1206
  }
719
- function detachOnChange() {
1207
+ function detachOnDimensionChange() {
720
1208
  dimensionRef = null;
721
- EventListener.remove(globalThis, { type: 'resize', callback: onResize });
722
- if (typeof globalThis.screen.orientation.removeEventListener === 'function')
723
- EventListener.remove(globalThis.screen.orientation, { type: 'change', callback: onResize });
724
- else if (typeof globalThis.orientation !== 'undefined')
725
- EventListener.remove(globalThis, { type: 'orientationChange', callback: onResize });
726
- else if (exports.MEDIA_QUERY_LIST.media !== 'not all')
727
- EventListener.remove(exports.MEDIA_QUERY_LIST, { type: 'change', callback: onResize });
1209
+ EventListener.remove(globalThis, { type: 'resize', callback: onDimensionChange });
728
1210
  }
729
- function onResize() {
1211
+ function onDimensionChange() {
730
1212
  var dimension = getDimension();
731
- if (dimensionRef === null || dimension.innerWidth !== dimensionRef.innerWidth || dimension.innerHeight !== dimensionRef.innerHeight || dimension.outerWidth !== dimensionRef.outerWidth || dimension.outerHeight !== dimensionRef.outerHeight || dimension.scale !== dimensionRef.scale || dimension.orientation !== dimensionRef.orientation)
732
- onChangeSubscriptionManager.emit(dimensionRef = dimension);
1213
+ if (dimensionRef === null || dimension.innerWidth !== dimensionRef.innerWidth || dimension.innerHeight !== dimensionRef.innerHeight || dimension.outerWidth !== dimensionRef.outerWidth || dimension.outerHeight !== dimensionRef.outerHeight || dimension.scale !== dimensionRef.scale)
1214
+ onDimensionChangeSubscriptionManager.emit(dimensionRef = dimension);
1215
+ }
1216
+ function screenOrientationSupported() {
1217
+ if (typeof globalThis.screen !== 'undefined' && typeof globalThis.screen.orientation !== 'undefined' && typeof globalThis.screen.orientation.type !== 'undefined')
1218
+ return true;
1219
+ if (typeof globalThis.orientation !== 'undefined')
1220
+ return true;
1221
+ return exports.ORIENTATION_MEDIA_QUERY_LIST.media !== 'not all';
1222
+ }
1223
+ function attachOnScreenOrientationChange() {
1224
+ if (typeof globalThis.screen !== 'undefined' && typeof globalThis.screen.orientation !== 'undefined' && typeof globalThis.screen.orientation.addEventListener === 'function')
1225
+ EventListener.add(globalThis.screen.orientation, {
1226
+ type: 'change',
1227
+ callback: onScreenOrientationChange
1228
+ });
1229
+ else if (typeof globalThis.orientation !== 'undefined')
1230
+ EventListener.add(globalThis, { type: 'orientationchange', callback: onScreenOrientationChange });
1231
+ else if (exports.ORIENTATION_MEDIA_QUERY_LIST.media !== 'not all')
1232
+ EventListener.add(exports.ORIENTATION_MEDIA_QUERY_LIST, { type: 'change', callback: onScreenOrientationChange });
1233
+ throw new NotSupportedError('\'screen.orientation\', \'window.orientation\', and the orientation media query are all unsupported');
1234
+ }
1235
+ function detachOnScreenOrientationChange() {
1236
+ if (typeof globalThis.screen !== 'undefined' && typeof globalThis.screen.orientation !== 'undefined' && typeof globalThis.screen.orientation.removeEventListener === 'function')
1237
+ EventListener.remove(globalThis.screen.orientation, {
1238
+ type: 'change',
1239
+ callback: onScreenOrientationChange
1240
+ });
1241
+ else if (typeof globalThis.orientation !== 'undefined')
1242
+ EventListener.remove(globalThis, { type: 'orientationchange', callback: onScreenOrientationChange });
1243
+ else if (exports.ORIENTATION_MEDIA_QUERY_LIST.media !== 'not all')
1244
+ EventListener.remove(exports.ORIENTATION_MEDIA_QUERY_LIST, { type: 'change', callback: onScreenOrientationChange });
1245
+ throw new NotSupportedError('\'screen.orientation\', \'window.orientation\', and the orientation media query are all unsupported');
1246
+ }
1247
+ function onScreenOrientationChange() {
1248
+ var orientation = getOrientation();
1249
+ if (screenOrientationRef === null || orientation !== screenOrientationRef)
1250
+ onScreenOrientationChangeSubscriptionManager.emit(screenOrientationRef = orientation);
1251
+ }
1252
+ function deviceOrientationSupported() {
1253
+ return typeof globalThis.DeviceOrientationEvent !== 'undefined';
1254
+ }
1255
+ function attachOnDeviceOrientationChange() {
1256
+ return new Promise(function (resolve, reject) {
1257
+ if (!deviceOrientationSupported())
1258
+ return reject(new NotSupportedError('\'window.DeviceOrientationEvent\' does not supported.'));
1259
+ var DeviceOrientationEventWithPermission = DeviceOrientationEvent;
1260
+ if (typeof DeviceOrientationEventWithPermission.requestPermission === 'function') {
1261
+ DeviceOrientationEventWithPermission.requestPermission().then(function (permission) {
1262
+ if (permission === 'granted') {
1263
+ EventListener.add(globalThis, { type: 'deviceorientation', callback: onDeviceOrientationChange });
1264
+ return resolve();
1265
+ }
1266
+ return reject(new PermissionNotGrantedError('\'deviceorientation\' permission is not granted.'));
1267
+ }).catch(function (_) {
1268
+ return reject(new NotSupportedError('\'window.DeviceOrientationEvent\' does not supported.'));
1269
+ });
1270
+ }
1271
+ else {
1272
+ EventListener.add(globalThis, { type: 'deviceorientation', callback: onDeviceOrientationChange });
1273
+ return resolve();
1274
+ }
1275
+ });
1276
+ }
1277
+ function detachOnDeviceOrientationChange() {
1278
+ EventListener.remove(globalThis, { type: 'deviceorientation', callback: onDeviceOrientationChange });
1279
+ }
1280
+ function onDeviceOrientationChange(event) {
1281
+ deviceOrientationRef = {
1282
+ alpha: event.alpha,
1283
+ beta: event.beta,
1284
+ gamma: event.gamma,
1285
+ absolute: event.absolute,
1286
+ };
1287
+ onDeviceOrientationChangeSubscriptionManager.emit(deviceOrientationRef);
1288
+ }
1289
+ function getDeviceOrientationValue() {
1290
+ return new Promise(function (resolve, reject) {
1291
+ if (deviceOrientationRef !== null)
1292
+ return resolve(deviceOrientationRef);
1293
+ if (!deviceOrientationSupported())
1294
+ return reject(new NotSupportedError('\'window.DeviceOrientationEvent\' does not supported.'));
1295
+ var DeviceOrientationEventWithPermission = DeviceOrientationEvent;
1296
+ var callback = function (event) {
1297
+ var value = {
1298
+ alpha: event.alpha,
1299
+ beta: event.beta,
1300
+ gamma: event.gamma,
1301
+ absolute: event.absolute,
1302
+ };
1303
+ deviceOrientationRef = value;
1304
+ EventListener.remove(globalThis, { type: 'deviceorientation', callback: callback });
1305
+ return resolve(value);
1306
+ };
1307
+ if (typeof DeviceOrientationEventWithPermission.requestPermission === 'function') {
1308
+ DeviceOrientationEventWithPermission.requestPermission().then(function (permission) {
1309
+ if (permission === 'granted') {
1310
+ EventListener.add(globalThis, { type: 'deviceorientation', callback: callback });
1311
+ return;
1312
+ }
1313
+ return reject(new PermissionNotGrantedError('\'deviceorientation\' permission is not granted.'));
1314
+ }).catch(function (_) {
1315
+ return reject(new NotSupportedError('\'window.DeviceOrientationEvent\' does not supported.'));
1316
+ });
1317
+ }
1318
+ else {
1319
+ EventListener.add(globalThis, { type: 'deviceorientation', callback: callback });
1320
+ return;
1321
+ }
1322
+ });
733
1323
  }
734
1324
 
735
1325
  exports.ENV_PRESETS = ENV_PRESETS;
736
- exports.FALLBACK_DIMENSION = FALLBACK_DIMENSION;
737
1326
  exports.default = Dimension;