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.
- package/README.md +191 -49
- package/dist/index.d.ts +148 -98
- package/dist/native.cjs +810 -288
- package/dist/native.min.cjs +1 -1
- package/dist/native.min.mjs +1 -1
- package/dist/native.mjs +810 -288
- package/dist/native.umd.js +810 -288
- package/dist/native.umd.min.js +1 -1
- package/dist/plugin/appearance/index.cjs +65 -64
- package/dist/plugin/appearance/index.d.ts +5 -5
- package/dist/plugin/appearance/index.mjs +66 -65
- package/dist/plugin/appearance/src/plugin/appearance/constants/index.d.ts +1 -1
- package/dist/plugin/appearance/src/plugin/appearance/types/appearance.d.ts +3 -3
- package/dist/plugin/appearance/src/plugin/badge/types/badge.d.ts +3 -3
- package/dist/plugin/appearance/src/plugin/battery/types/battery.d.ts +3 -3
- package/dist/plugin/appearance/src/plugin/clipboard/types/clipboard.d.ts +2 -2
- package/dist/plugin/appearance/src/plugin/dimension/constants/index.d.ts +10 -6
- package/dist/plugin/appearance/src/plugin/dimension/cores/index.d.ts +15 -0
- package/dist/plugin/appearance/src/plugin/dimension/types/dimensions.d.ts +52 -24
- package/dist/plugin/appearance/src/plugin/dimension/utils/create-env-observer.d.ts +16 -7
- package/dist/plugin/appearance/src/plugin/dimension/utils/create-environment-observer.d.ts +33 -0
- package/dist/plugin/appearance/src/plugin/fullscreen/types/fullscreen.d.ts +7 -7
- package/dist/plugin/appearance/src/plugin/geolocation/types/geolocation.d.ts +4 -4
- package/dist/plugin/appearance/src/plugin/notification/types/notification.d.ts +4 -4
- package/dist/plugin/appearance/src/plugin/open/types/open.d.ts +12 -12
- package/dist/plugin/appearance/src/plugin/permission/constants/index.d.ts +3 -1
- package/dist/plugin/appearance/src/plugin/permission/types/permission.d.ts +7 -4
- package/dist/plugin/appearance/src/plugin/pip/types/pip.d.ts +7 -7
- package/dist/plugin/appearance/src/plugin/platform/constants/index.d.ts +1 -1
- package/dist/plugin/appearance/src/plugin/platform/types/platform.d.ts +13 -13
- package/dist/plugin/appearance/src/plugin/theme/types/theme.d.ts +2 -2
- package/dist/plugin/appearance/src/plugin/vibration/types/vibration.d.ts +3 -3
- package/dist/plugin/appearance/src/types/subscription-manager.d.ts +3 -3
- package/dist/plugin/appearance/src/utils/create-subscription-manager.d.ts +1 -1
- package/dist/plugin/appearance/src/utils/insert-sort.d.ts +1 -0
- package/dist/plugin/badge/index.d.ts +3 -3
- package/dist/plugin/badge/src/plugin/appearance/constants/index.d.ts +1 -1
- package/dist/plugin/badge/src/plugin/appearance/types/appearance.d.ts +3 -3
- package/dist/plugin/badge/src/plugin/badge/types/badge.d.ts +3 -3
- package/dist/plugin/badge/src/plugin/battery/types/battery.d.ts +3 -3
- package/dist/plugin/badge/src/plugin/clipboard/types/clipboard.d.ts +2 -2
- package/dist/plugin/badge/src/plugin/dimension/constants/index.d.ts +10 -6
- package/dist/plugin/badge/src/plugin/dimension/cores/index.d.ts +15 -0
- package/dist/plugin/badge/src/plugin/dimension/types/dimensions.d.ts +52 -24
- package/dist/plugin/badge/src/plugin/dimension/utils/create-env-observer.d.ts +16 -7
- package/dist/plugin/badge/src/plugin/dimension/utils/create-environment-observer.d.ts +33 -0
- package/dist/plugin/badge/src/plugin/fullscreen/types/fullscreen.d.ts +7 -7
- package/dist/plugin/badge/src/plugin/geolocation/types/geolocation.d.ts +4 -4
- package/dist/plugin/badge/src/plugin/notification/types/notification.d.ts +4 -4
- package/dist/plugin/badge/src/plugin/open/types/open.d.ts +12 -12
- package/dist/plugin/badge/src/plugin/permission/constants/index.d.ts +3 -1
- package/dist/plugin/badge/src/plugin/permission/types/permission.d.ts +7 -4
- package/dist/plugin/badge/src/plugin/pip/types/pip.d.ts +7 -7
- package/dist/plugin/badge/src/plugin/platform/constants/index.d.ts +1 -1
- package/dist/plugin/badge/src/plugin/platform/types/platform.d.ts +13 -13
- package/dist/plugin/badge/src/plugin/theme/types/theme.d.ts +2 -2
- package/dist/plugin/badge/src/plugin/vibration/types/vibration.d.ts +3 -3
- package/dist/plugin/badge/src/types/subscription-manager.d.ts +3 -3
- package/dist/plugin/badge/src/utils/create-subscription-manager.d.ts +1 -1
- package/dist/plugin/badge/src/utils/insert-sort.d.ts +1 -0
- package/dist/plugin/battery/index.cjs +4 -6
- package/dist/plugin/battery/index.d.ts +3 -3
- package/dist/plugin/battery/index.mjs +4 -6
- package/dist/plugin/battery/src/plugin/appearance/constants/index.d.ts +1 -1
- package/dist/plugin/battery/src/plugin/appearance/types/appearance.d.ts +3 -3
- package/dist/plugin/battery/src/plugin/badge/types/badge.d.ts +3 -3
- package/dist/plugin/battery/src/plugin/battery/types/battery.d.ts +3 -3
- package/dist/plugin/battery/src/plugin/clipboard/types/clipboard.d.ts +2 -2
- package/dist/plugin/battery/src/plugin/dimension/constants/index.d.ts +10 -6
- package/dist/plugin/battery/src/plugin/dimension/cores/index.d.ts +15 -0
- package/dist/plugin/battery/src/plugin/dimension/types/dimensions.d.ts +52 -24
- package/dist/plugin/battery/src/plugin/dimension/utils/create-env-observer.d.ts +16 -7
- package/dist/plugin/battery/src/plugin/dimension/utils/create-environment-observer.d.ts +33 -0
- package/dist/plugin/battery/src/plugin/fullscreen/types/fullscreen.d.ts +7 -7
- package/dist/plugin/battery/src/plugin/geolocation/types/geolocation.d.ts +4 -4
- package/dist/plugin/battery/src/plugin/notification/types/notification.d.ts +4 -4
- package/dist/plugin/battery/src/plugin/open/types/open.d.ts +12 -12
- package/dist/plugin/battery/src/plugin/permission/constants/index.d.ts +3 -1
- package/dist/plugin/battery/src/plugin/permission/types/permission.d.ts +7 -4
- package/dist/plugin/battery/src/plugin/pip/types/pip.d.ts +7 -7
- package/dist/plugin/battery/src/plugin/platform/constants/index.d.ts +1 -1
- package/dist/plugin/battery/src/plugin/platform/types/platform.d.ts +13 -13
- package/dist/plugin/battery/src/plugin/theme/types/theme.d.ts +2 -2
- package/dist/plugin/battery/src/plugin/vibration/types/vibration.d.ts +3 -3
- package/dist/plugin/battery/src/types/subscription-manager.d.ts +3 -3
- package/dist/plugin/battery/src/utils/create-subscription-manager.d.ts +1 -1
- package/dist/plugin/battery/src/utils/insert-sort.d.ts +1 -0
- package/dist/plugin/clipboard/index.d.ts +2 -2
- package/dist/plugin/clipboard/src/plugin/appearance/constants/index.d.ts +1 -1
- package/dist/plugin/clipboard/src/plugin/appearance/types/appearance.d.ts +3 -3
- package/dist/plugin/clipboard/src/plugin/badge/types/badge.d.ts +3 -3
- package/dist/plugin/clipboard/src/plugin/battery/types/battery.d.ts +3 -3
- package/dist/plugin/clipboard/src/plugin/clipboard/types/clipboard.d.ts +2 -2
- package/dist/plugin/clipboard/src/plugin/dimension/constants/index.d.ts +10 -6
- package/dist/plugin/clipboard/src/plugin/dimension/cores/index.d.ts +15 -0
- package/dist/plugin/clipboard/src/plugin/dimension/types/dimensions.d.ts +52 -24
- package/dist/plugin/clipboard/src/plugin/dimension/utils/create-env-observer.d.ts +16 -7
- package/dist/plugin/clipboard/src/plugin/dimension/utils/create-environment-observer.d.ts +33 -0
- package/dist/plugin/clipboard/src/plugin/fullscreen/types/fullscreen.d.ts +7 -7
- package/dist/plugin/clipboard/src/plugin/geolocation/types/geolocation.d.ts +4 -4
- package/dist/plugin/clipboard/src/plugin/notification/types/notification.d.ts +4 -4
- package/dist/plugin/clipboard/src/plugin/open/types/open.d.ts +12 -12
- package/dist/plugin/clipboard/src/plugin/permission/constants/index.d.ts +3 -1
- package/dist/plugin/clipboard/src/plugin/permission/types/permission.d.ts +7 -4
- package/dist/plugin/clipboard/src/plugin/pip/types/pip.d.ts +7 -7
- package/dist/plugin/clipboard/src/plugin/platform/constants/index.d.ts +1 -1
- package/dist/plugin/clipboard/src/plugin/platform/types/platform.d.ts +13 -13
- package/dist/plugin/clipboard/src/plugin/theme/types/theme.d.ts +2 -2
- package/dist/plugin/clipboard/src/plugin/vibration/types/vibration.d.ts +3 -3
- package/dist/plugin/clipboard/src/types/subscription-manager.d.ts +3 -3
- package/dist/plugin/clipboard/src/utils/create-subscription-manager.d.ts +1 -1
- package/dist/plugin/clipboard/src/utils/insert-sort.d.ts +1 -0
- package/dist/plugin/dimension/index.cjs +711 -122
- package/dist/plugin/dimension/index.d.ts +81 -31
- package/dist/plugin/dimension/index.mjs +712 -122
- package/dist/plugin/dimension/src/plugin/appearance/constants/index.d.ts +1 -1
- package/dist/plugin/dimension/src/plugin/appearance/types/appearance.d.ts +3 -3
- package/dist/plugin/dimension/src/plugin/badge/types/badge.d.ts +3 -3
- package/dist/plugin/dimension/src/plugin/battery/types/battery.d.ts +3 -3
- package/dist/plugin/dimension/src/plugin/clipboard/types/clipboard.d.ts +2 -2
- package/dist/plugin/dimension/src/plugin/dimension/constants/index.d.ts +10 -6
- package/dist/plugin/dimension/src/plugin/dimension/cores/index.d.ts +15 -0
- package/dist/plugin/dimension/src/plugin/dimension/types/dimensions.d.ts +52 -24
- package/dist/plugin/dimension/src/plugin/dimension/utils/create-env-observer.d.ts +16 -7
- package/dist/plugin/dimension/src/plugin/dimension/utils/create-environment-observer.d.ts +33 -0
- package/dist/plugin/dimension/src/plugin/fullscreen/types/fullscreen.d.ts +7 -7
- package/dist/plugin/dimension/src/plugin/geolocation/types/geolocation.d.ts +4 -4
- package/dist/plugin/dimension/src/plugin/notification/types/notification.d.ts +4 -4
- package/dist/plugin/dimension/src/plugin/open/types/open.d.ts +12 -12
- package/dist/plugin/dimension/src/plugin/permission/constants/index.d.ts +3 -1
- package/dist/plugin/dimension/src/plugin/permission/types/permission.d.ts +7 -4
- package/dist/plugin/dimension/src/plugin/pip/types/pip.d.ts +7 -7
- package/dist/plugin/dimension/src/plugin/platform/constants/index.d.ts +1 -1
- package/dist/plugin/dimension/src/plugin/platform/types/platform.d.ts +13 -13
- package/dist/plugin/dimension/src/plugin/theme/types/theme.d.ts +2 -2
- package/dist/plugin/dimension/src/plugin/vibration/types/vibration.d.ts +3 -3
- package/dist/plugin/dimension/src/types/subscription-manager.d.ts +3 -3
- package/dist/plugin/dimension/src/utils/create-subscription-manager.d.ts +1 -1
- package/dist/plugin/dimension/src/utils/insert-sort.d.ts +1 -0
- package/dist/plugin/fullscreen/index.cjs +96 -91
- package/dist/plugin/fullscreen/index.d.ts +7 -7
- package/dist/plugin/fullscreen/index.mjs +96 -91
- package/dist/plugin/fullscreen/src/plugin/appearance/constants/index.d.ts +1 -1
- package/dist/plugin/fullscreen/src/plugin/appearance/types/appearance.d.ts +3 -3
- package/dist/plugin/fullscreen/src/plugin/badge/types/badge.d.ts +3 -3
- package/dist/plugin/fullscreen/src/plugin/battery/types/battery.d.ts +3 -3
- package/dist/plugin/fullscreen/src/plugin/clipboard/types/clipboard.d.ts +2 -2
- package/dist/plugin/fullscreen/src/plugin/dimension/constants/index.d.ts +10 -6
- package/dist/plugin/fullscreen/src/plugin/dimension/cores/index.d.ts +15 -0
- package/dist/plugin/fullscreen/src/plugin/dimension/types/dimensions.d.ts +52 -24
- package/dist/plugin/fullscreen/src/plugin/dimension/utils/create-env-observer.d.ts +16 -7
- package/dist/plugin/fullscreen/src/plugin/dimension/utils/create-environment-observer.d.ts +33 -0
- package/dist/plugin/fullscreen/src/plugin/fullscreen/types/fullscreen.d.ts +7 -7
- package/dist/plugin/fullscreen/src/plugin/geolocation/types/geolocation.d.ts +4 -4
- package/dist/plugin/fullscreen/src/plugin/notification/types/notification.d.ts +4 -4
- package/dist/plugin/fullscreen/src/plugin/open/types/open.d.ts +12 -12
- package/dist/plugin/fullscreen/src/plugin/permission/constants/index.d.ts +3 -1
- package/dist/plugin/fullscreen/src/plugin/permission/types/permission.d.ts +7 -4
- package/dist/plugin/fullscreen/src/plugin/pip/types/pip.d.ts +7 -7
- package/dist/plugin/fullscreen/src/plugin/platform/constants/index.d.ts +1 -1
- package/dist/plugin/fullscreen/src/plugin/platform/types/platform.d.ts +13 -13
- package/dist/plugin/fullscreen/src/plugin/theme/types/theme.d.ts +2 -2
- package/dist/plugin/fullscreen/src/plugin/vibration/types/vibration.d.ts +3 -3
- package/dist/plugin/fullscreen/src/types/subscription-manager.d.ts +3 -3
- package/dist/plugin/fullscreen/src/utils/create-subscription-manager.d.ts +1 -1
- package/dist/plugin/fullscreen/src/utils/insert-sort.d.ts +1 -0
- package/dist/plugin/geolocation/index.cjs +249 -182
- package/dist/plugin/geolocation/index.d.ts +4 -4
- package/dist/plugin/geolocation/index.mjs +249 -182
- package/dist/plugin/geolocation/src/plugin/appearance/constants/index.d.ts +1 -1
- package/dist/plugin/geolocation/src/plugin/appearance/types/appearance.d.ts +3 -3
- package/dist/plugin/geolocation/src/plugin/badge/types/badge.d.ts +3 -3
- package/dist/plugin/geolocation/src/plugin/battery/types/battery.d.ts +3 -3
- package/dist/plugin/geolocation/src/plugin/clipboard/types/clipboard.d.ts +2 -2
- package/dist/plugin/geolocation/src/plugin/dimension/constants/index.d.ts +10 -6
- package/dist/plugin/geolocation/src/plugin/dimension/cores/index.d.ts +15 -0
- package/dist/plugin/geolocation/src/plugin/dimension/types/dimensions.d.ts +52 -24
- package/dist/plugin/geolocation/src/plugin/dimension/utils/create-env-observer.d.ts +16 -7
- package/dist/plugin/geolocation/src/plugin/dimension/utils/create-environment-observer.d.ts +33 -0
- package/dist/plugin/geolocation/src/plugin/fullscreen/types/fullscreen.d.ts +7 -7
- package/dist/plugin/geolocation/src/plugin/geolocation/types/geolocation.d.ts +4 -4
- package/dist/plugin/geolocation/src/plugin/notification/types/notification.d.ts +4 -4
- package/dist/plugin/geolocation/src/plugin/open/types/open.d.ts +12 -12
- package/dist/plugin/geolocation/src/plugin/permission/constants/index.d.ts +3 -1
- package/dist/plugin/geolocation/src/plugin/permission/types/permission.d.ts +7 -4
- package/dist/plugin/geolocation/src/plugin/pip/types/pip.d.ts +7 -7
- package/dist/plugin/geolocation/src/plugin/platform/constants/index.d.ts +1 -1
- package/dist/plugin/geolocation/src/plugin/platform/types/platform.d.ts +13 -13
- package/dist/plugin/geolocation/src/plugin/theme/types/theme.d.ts +2 -2
- package/dist/plugin/geolocation/src/plugin/vibration/types/vibration.d.ts +3 -3
- package/dist/plugin/geolocation/src/types/subscription-manager.d.ts +3 -3
- package/dist/plugin/geolocation/src/utils/create-subscription-manager.d.ts +1 -1
- package/dist/plugin/geolocation/src/utils/insert-sort.d.ts +1 -0
- package/dist/plugin/notification/index.cjs +288 -13
- package/dist/plugin/notification/index.d.ts +4 -4
- package/dist/plugin/notification/index.mjs +288 -13
- package/dist/plugin/notification/src/plugin/appearance/constants/index.d.ts +1 -1
- package/dist/plugin/notification/src/plugin/appearance/types/appearance.d.ts +3 -3
- package/dist/plugin/notification/src/plugin/badge/types/badge.d.ts +3 -3
- package/dist/plugin/notification/src/plugin/battery/types/battery.d.ts +3 -3
- package/dist/plugin/notification/src/plugin/clipboard/types/clipboard.d.ts +2 -2
- package/dist/plugin/notification/src/plugin/dimension/constants/index.d.ts +10 -6
- package/dist/plugin/notification/src/plugin/dimension/cores/index.d.ts +15 -0
- package/dist/plugin/notification/src/plugin/dimension/types/dimensions.d.ts +52 -24
- package/dist/plugin/notification/src/plugin/dimension/utils/create-env-observer.d.ts +16 -7
- package/dist/plugin/notification/src/plugin/dimension/utils/create-environment-observer.d.ts +33 -0
- package/dist/plugin/notification/src/plugin/fullscreen/types/fullscreen.d.ts +7 -7
- package/dist/plugin/notification/src/plugin/geolocation/types/geolocation.d.ts +4 -4
- package/dist/plugin/notification/src/plugin/notification/types/notification.d.ts +4 -4
- package/dist/plugin/notification/src/plugin/open/types/open.d.ts +12 -12
- package/dist/plugin/notification/src/plugin/permission/constants/index.d.ts +3 -1
- package/dist/plugin/notification/src/plugin/permission/types/permission.d.ts +7 -4
- package/dist/plugin/notification/src/plugin/pip/types/pip.d.ts +7 -7
- package/dist/plugin/notification/src/plugin/platform/constants/index.d.ts +1 -1
- package/dist/plugin/notification/src/plugin/platform/types/platform.d.ts +13 -13
- package/dist/plugin/notification/src/plugin/theme/types/theme.d.ts +2 -2
- package/dist/plugin/notification/src/plugin/vibration/types/vibration.d.ts +3 -3
- package/dist/plugin/notification/src/types/subscription-manager.d.ts +3 -3
- package/dist/plugin/notification/src/utils/create-subscription-manager.d.ts +1 -1
- package/dist/plugin/notification/src/utils/insert-sort.d.ts +1 -0
- package/dist/plugin/open/index.cjs +64 -55
- package/dist/plugin/open/index.d.ts +28 -12
- package/dist/plugin/open/index.mjs +64 -55
- package/dist/plugin/open/src/plugin/appearance/constants/index.d.ts +1 -1
- package/dist/plugin/open/src/plugin/appearance/types/appearance.d.ts +3 -3
- package/dist/plugin/open/src/plugin/badge/types/badge.d.ts +3 -3
- package/dist/plugin/open/src/plugin/battery/types/battery.d.ts +3 -3
- package/dist/plugin/open/src/plugin/clipboard/types/clipboard.d.ts +2 -2
- package/dist/plugin/open/src/plugin/dimension/constants/index.d.ts +10 -6
- package/dist/plugin/open/src/plugin/dimension/cores/index.d.ts +15 -0
- package/dist/plugin/open/src/plugin/dimension/types/dimensions.d.ts +52 -24
- package/dist/plugin/open/src/plugin/dimension/utils/create-env-observer.d.ts +16 -7
- package/dist/plugin/open/src/plugin/dimension/utils/create-environment-observer.d.ts +33 -0
- package/dist/plugin/open/src/plugin/fullscreen/types/fullscreen.d.ts +7 -7
- package/dist/plugin/open/src/plugin/geolocation/types/geolocation.d.ts +4 -4
- package/dist/plugin/open/src/plugin/notification/types/notification.d.ts +4 -4
- package/dist/plugin/open/src/plugin/open/types/open.d.ts +12 -12
- package/dist/plugin/open/src/plugin/permission/constants/index.d.ts +3 -1
- package/dist/plugin/open/src/plugin/permission/types/permission.d.ts +7 -4
- package/dist/plugin/open/src/plugin/pip/types/pip.d.ts +7 -7
- package/dist/plugin/open/src/plugin/platform/constants/index.d.ts +1 -1
- package/dist/plugin/open/src/plugin/platform/types/platform.d.ts +13 -13
- package/dist/plugin/open/src/plugin/theme/types/theme.d.ts +2 -2
- package/dist/plugin/open/src/plugin/vibration/types/vibration.d.ts +3 -3
- package/dist/plugin/open/src/types/subscription-manager.d.ts +3 -3
- package/dist/plugin/open/src/utils/create-subscription-manager.d.ts +1 -1
- package/dist/plugin/open/src/utils/insert-sort.d.ts +1 -0
- package/dist/plugin/permission/index.cjs +372 -13
- package/dist/plugin/permission/index.d.ts +11 -5
- package/dist/plugin/permission/index.mjs +372 -13
- package/dist/plugin/permission/src/plugin/appearance/constants/index.d.ts +1 -1
- package/dist/plugin/permission/src/plugin/appearance/types/appearance.d.ts +3 -3
- package/dist/plugin/permission/src/plugin/badge/types/badge.d.ts +3 -3
- package/dist/plugin/permission/src/plugin/battery/types/battery.d.ts +3 -3
- package/dist/plugin/permission/src/plugin/clipboard/types/clipboard.d.ts +2 -2
- package/dist/plugin/permission/src/plugin/dimension/constants/index.d.ts +10 -6
- package/dist/plugin/permission/src/plugin/dimension/cores/index.d.ts +15 -0
- package/dist/plugin/permission/src/plugin/dimension/types/dimensions.d.ts +52 -24
- package/dist/plugin/permission/src/plugin/dimension/utils/create-env-observer.d.ts +16 -7
- package/dist/plugin/permission/src/plugin/dimension/utils/create-environment-observer.d.ts +33 -0
- package/dist/plugin/permission/src/plugin/fullscreen/types/fullscreen.d.ts +7 -7
- package/dist/plugin/permission/src/plugin/geolocation/types/geolocation.d.ts +4 -4
- package/dist/plugin/permission/src/plugin/notification/types/notification.d.ts +4 -4
- package/dist/plugin/permission/src/plugin/open/types/open.d.ts +12 -12
- package/dist/plugin/permission/src/plugin/permission/constants/index.d.ts +3 -1
- package/dist/plugin/permission/src/plugin/permission/types/permission.d.ts +7 -4
- package/dist/plugin/permission/src/plugin/pip/types/pip.d.ts +7 -7
- package/dist/plugin/permission/src/plugin/platform/constants/index.d.ts +1 -1
- package/dist/plugin/permission/src/plugin/platform/types/platform.d.ts +13 -13
- package/dist/plugin/permission/src/plugin/theme/types/theme.d.ts +2 -2
- package/dist/plugin/permission/src/plugin/vibration/types/vibration.d.ts +3 -3
- package/dist/plugin/permission/src/types/subscription-manager.d.ts +3 -3
- package/dist/plugin/permission/src/utils/create-subscription-manager.d.ts +1 -1
- package/dist/plugin/permission/src/utils/insert-sort.d.ts +1 -0
- package/dist/plugin/pip/index.cjs +58 -57
- package/dist/plugin/pip/index.d.ts +7 -7
- package/dist/plugin/pip/index.mjs +58 -57
- package/dist/plugin/pip/src/plugin/appearance/constants/index.d.ts +1 -1
- package/dist/plugin/pip/src/plugin/appearance/types/appearance.d.ts +3 -3
- package/dist/plugin/pip/src/plugin/badge/types/badge.d.ts +3 -3
- package/dist/plugin/pip/src/plugin/battery/types/battery.d.ts +3 -3
- package/dist/plugin/pip/src/plugin/clipboard/types/clipboard.d.ts +2 -2
- package/dist/plugin/pip/src/plugin/dimension/constants/index.d.ts +10 -6
- package/dist/plugin/pip/src/plugin/dimension/cores/index.d.ts +15 -0
- package/dist/plugin/pip/src/plugin/dimension/types/dimensions.d.ts +52 -24
- package/dist/plugin/pip/src/plugin/dimension/utils/create-env-observer.d.ts +16 -7
- package/dist/plugin/pip/src/plugin/dimension/utils/create-environment-observer.d.ts +33 -0
- package/dist/plugin/pip/src/plugin/fullscreen/types/fullscreen.d.ts +7 -7
- package/dist/plugin/pip/src/plugin/geolocation/types/geolocation.d.ts +4 -4
- package/dist/plugin/pip/src/plugin/notification/types/notification.d.ts +4 -4
- package/dist/plugin/pip/src/plugin/open/types/open.d.ts +12 -12
- package/dist/plugin/pip/src/plugin/permission/constants/index.d.ts +3 -1
- package/dist/plugin/pip/src/plugin/permission/types/permission.d.ts +7 -4
- package/dist/plugin/pip/src/plugin/pip/types/pip.d.ts +7 -7
- package/dist/plugin/pip/src/plugin/platform/constants/index.d.ts +1 -1
- package/dist/plugin/pip/src/plugin/platform/types/platform.d.ts +13 -13
- package/dist/plugin/pip/src/plugin/theme/types/theme.d.ts +2 -2
- package/dist/plugin/pip/src/plugin/vibration/types/vibration.d.ts +3 -3
- package/dist/plugin/pip/src/types/subscription-manager.d.ts +3 -3
- package/dist/plugin/pip/src/utils/create-subscription-manager.d.ts +1 -1
- package/dist/plugin/pip/src/utils/insert-sort.d.ts +1 -0
- package/dist/plugin/platform/index.cjs +98 -92
- package/dist/plugin/platform/index.d.ts +30 -14
- package/dist/plugin/platform/index.mjs +92 -85
- package/dist/plugin/platform/src/plugin/appearance/constants/index.d.ts +1 -1
- package/dist/plugin/platform/src/plugin/appearance/types/appearance.d.ts +3 -3
- package/dist/plugin/platform/src/plugin/badge/types/badge.d.ts +3 -3
- package/dist/plugin/platform/src/plugin/battery/types/battery.d.ts +3 -3
- package/dist/plugin/platform/src/plugin/clipboard/types/clipboard.d.ts +2 -2
- package/dist/plugin/platform/src/plugin/dimension/constants/index.d.ts +10 -6
- package/dist/plugin/platform/src/plugin/dimension/cores/index.d.ts +15 -0
- package/dist/plugin/platform/src/plugin/dimension/types/dimensions.d.ts +52 -24
- package/dist/plugin/platform/src/plugin/dimension/utils/create-env-observer.d.ts +16 -7
- package/dist/plugin/platform/src/plugin/dimension/utils/create-environment-observer.d.ts +33 -0
- package/dist/plugin/platform/src/plugin/fullscreen/types/fullscreen.d.ts +7 -7
- package/dist/plugin/platform/src/plugin/geolocation/types/geolocation.d.ts +4 -4
- package/dist/plugin/platform/src/plugin/notification/types/notification.d.ts +4 -4
- package/dist/plugin/platform/src/plugin/open/types/open.d.ts +12 -12
- package/dist/plugin/platform/src/plugin/permission/constants/index.d.ts +3 -1
- package/dist/plugin/platform/src/plugin/permission/types/permission.d.ts +7 -4
- package/dist/plugin/platform/src/plugin/pip/types/pip.d.ts +7 -7
- package/dist/plugin/platform/src/plugin/platform/constants/index.d.ts +1 -1
- package/dist/plugin/platform/src/plugin/platform/types/platform.d.ts +13 -13
- package/dist/plugin/platform/src/plugin/theme/types/theme.d.ts +2 -2
- package/dist/plugin/platform/src/plugin/vibration/types/vibration.d.ts +3 -3
- package/dist/plugin/platform/src/types/subscription-manager.d.ts +3 -3
- package/dist/plugin/platform/src/utils/create-subscription-manager.d.ts +1 -1
- package/dist/plugin/platform/src/utils/insert-sort.d.ts +1 -0
- package/dist/plugin/theme/index.cjs +63 -54
- package/dist/plugin/theme/index.d.ts +2 -2
- package/dist/plugin/theme/index.mjs +63 -54
- package/dist/plugin/theme/src/plugin/appearance/constants/index.d.ts +1 -1
- package/dist/plugin/theme/src/plugin/appearance/types/appearance.d.ts +3 -3
- package/dist/plugin/theme/src/plugin/badge/types/badge.d.ts +3 -3
- package/dist/plugin/theme/src/plugin/battery/types/battery.d.ts +3 -3
- package/dist/plugin/theme/src/plugin/clipboard/types/clipboard.d.ts +2 -2
- package/dist/plugin/theme/src/plugin/dimension/constants/index.d.ts +10 -6
- package/dist/plugin/theme/src/plugin/dimension/cores/index.d.ts +15 -0
- package/dist/plugin/theme/src/plugin/dimension/types/dimensions.d.ts +52 -24
- package/dist/plugin/theme/src/plugin/dimension/utils/create-env-observer.d.ts +16 -7
- package/dist/plugin/theme/src/plugin/dimension/utils/create-environment-observer.d.ts +33 -0
- package/dist/plugin/theme/src/plugin/fullscreen/types/fullscreen.d.ts +7 -7
- package/dist/plugin/theme/src/plugin/geolocation/types/geolocation.d.ts +4 -4
- package/dist/plugin/theme/src/plugin/notification/types/notification.d.ts +4 -4
- package/dist/plugin/theme/src/plugin/open/types/open.d.ts +12 -12
- package/dist/plugin/theme/src/plugin/permission/constants/index.d.ts +3 -1
- package/dist/plugin/theme/src/plugin/permission/types/permission.d.ts +7 -4
- package/dist/plugin/theme/src/plugin/pip/types/pip.d.ts +7 -7
- package/dist/plugin/theme/src/plugin/platform/constants/index.d.ts +1 -1
- package/dist/plugin/theme/src/plugin/platform/types/platform.d.ts +13 -13
- package/dist/plugin/theme/src/plugin/theme/types/theme.d.ts +2 -2
- package/dist/plugin/theme/src/plugin/vibration/types/vibration.d.ts +3 -3
- package/dist/plugin/theme/src/types/subscription-manager.d.ts +3 -3
- package/dist/plugin/theme/src/utils/create-subscription-manager.d.ts +1 -1
- package/dist/plugin/theme/src/utils/insert-sort.d.ts +1 -0
- package/dist/plugin/vibration/index.d.ts +3 -3
- package/dist/plugin/vibration/src/plugin/appearance/constants/index.d.ts +1 -1
- package/dist/plugin/vibration/src/plugin/appearance/types/appearance.d.ts +3 -3
- package/dist/plugin/vibration/src/plugin/badge/types/badge.d.ts +3 -3
- package/dist/plugin/vibration/src/plugin/battery/types/battery.d.ts +3 -3
- package/dist/plugin/vibration/src/plugin/clipboard/types/clipboard.d.ts +2 -2
- package/dist/plugin/vibration/src/plugin/dimension/constants/index.d.ts +10 -6
- package/dist/plugin/vibration/src/plugin/dimension/cores/index.d.ts +15 -0
- package/dist/plugin/vibration/src/plugin/dimension/types/dimensions.d.ts +52 -24
- package/dist/plugin/vibration/src/plugin/dimension/utils/create-env-observer.d.ts +16 -7
- package/dist/plugin/vibration/src/plugin/dimension/utils/create-environment-observer.d.ts +33 -0
- package/dist/plugin/vibration/src/plugin/fullscreen/types/fullscreen.d.ts +7 -7
- package/dist/plugin/vibration/src/plugin/geolocation/types/geolocation.d.ts +4 -4
- package/dist/plugin/vibration/src/plugin/notification/types/notification.d.ts +4 -4
- package/dist/plugin/vibration/src/plugin/open/types/open.d.ts +12 -12
- package/dist/plugin/vibration/src/plugin/permission/constants/index.d.ts +3 -1
- package/dist/plugin/vibration/src/plugin/permission/types/permission.d.ts +7 -4
- package/dist/plugin/vibration/src/plugin/pip/types/pip.d.ts +7 -7
- package/dist/plugin/vibration/src/plugin/platform/constants/index.d.ts +1 -1
- package/dist/plugin/vibration/src/plugin/platform/types/platform.d.ts +13 -13
- package/dist/plugin/vibration/src/plugin/theme/types/theme.d.ts +2 -2
- package/dist/plugin/vibration/src/plugin/vibration/types/vibration.d.ts +3 -3
- package/dist/plugin/vibration/src/types/subscription-manager.d.ts +3 -3
- package/dist/plugin/vibration/src/utils/create-subscription-manager.d.ts +1 -1
- package/dist/plugin/vibration/src/utils/insert-sort.d.ts +1 -0
- package/dist/src/plugin/appearance/constants/index.d.ts +1 -1
- package/dist/src/plugin/appearance/types/appearance.d.ts +3 -3
- package/dist/src/plugin/badge/types/badge.d.ts +3 -3
- package/dist/src/plugin/battery/types/battery.d.ts +3 -3
- package/dist/src/plugin/clipboard/types/clipboard.d.ts +2 -2
- package/dist/src/plugin/dimension/constants/index.d.ts +10 -6
- package/dist/src/plugin/dimension/cores/index.d.ts +15 -0
- package/dist/src/plugin/dimension/types/dimensions.d.ts +52 -24
- package/dist/src/plugin/dimension/utils/create-env-observer.d.ts +16 -7
- package/dist/src/plugin/dimension/utils/create-environment-observer.d.ts +33 -0
- package/dist/src/plugin/fullscreen/types/fullscreen.d.ts +7 -7
- package/dist/src/plugin/geolocation/types/geolocation.d.ts +4 -4
- package/dist/src/plugin/notification/types/notification.d.ts +4 -4
- package/dist/src/plugin/open/types/open.d.ts +12 -12
- package/dist/src/plugin/permission/constants/index.d.ts +3 -1
- package/dist/src/plugin/permission/types/permission.d.ts +7 -4
- package/dist/src/plugin/pip/types/pip.d.ts +7 -7
- package/dist/src/plugin/platform/constants/index.d.ts +1 -1
- package/dist/src/plugin/platform/types/platform.d.ts +13 -13
- package/dist/src/plugin/theme/types/theme.d.ts +2 -2
- package/dist/src/plugin/vibration/types/vibration.d.ts +3 -3
- package/dist/src/types/subscription-manager.d.ts +3 -3
- package/dist/src/utils/create-subscription-manager.d.ts +1 -1
- package/dist/src/utils/insert-sort.d.ts +1 -0
- package/package.json +1 -1
package/dist/native.umd.js
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
(global = typeof globalThis !== 'undefined' ? globalThis : global || self, global.Native = factory());
|
|
5
5
|
})(this, (function () { 'use strict';
|
|
6
6
|
|
|
7
|
-
var version = "1.
|
|
7
|
+
var version = "1.3.1";
|
|
8
8
|
var packageJSON = {
|
|
9
9
|
version: version};
|
|
10
10
|
|
|
@@ -31,11 +31,11 @@
|
|
|
31
31
|
Appearances["Light"] = "light";
|
|
32
32
|
Appearances["Dark"] = "dark";
|
|
33
33
|
})(Appearances || (Appearances = {}));
|
|
34
|
-
var
|
|
34
|
+
var PREFERS_COLOR_SCHEME_MEDIA_QUERY_LIST;
|
|
35
35
|
if (typeof globalThis.matchMedia !== 'undefined')
|
|
36
|
-
|
|
36
|
+
PREFERS_COLOR_SCHEME_MEDIA_QUERY_LIST = globalThis.matchMedia('(prefers-color-scheme: dark)');
|
|
37
37
|
else
|
|
38
|
-
|
|
38
|
+
PREFERS_COLOR_SCHEME_MEDIA_QUERY_LIST = FALLBACK_MEDIA_QUERY_LIST;
|
|
39
39
|
var CONTEXT = globalThis.document.createElement('canvas').getContext('2d', { willReadFrequently: true });
|
|
40
40
|
var SVG_PIXEL_DATA_URL = 'data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIxIiBoZWlnaHQ9IjEiPjxwYXRoIGZpbGw9IiNmZmYiIGQ9Ik0wIDBoMXYxSDB6Ii8+PC9zdmc+';
|
|
41
41
|
|
|
@@ -128,11 +128,11 @@
|
|
|
128
128
|
Browsers["IE"] = "IE";
|
|
129
129
|
Browsers["SamsungInternet"] = "SamsungInternet";
|
|
130
130
|
})(Browsers || (Browsers = {}));
|
|
131
|
-
var USER_AGENT
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
131
|
+
var USER_AGENT;
|
|
132
|
+
if (typeof globalThis.navigator.userAgent !== 'undefined')
|
|
133
|
+
USER_AGENT = globalThis.navigator.userAgent;
|
|
134
|
+
else
|
|
135
|
+
USER_AGENT = '';
|
|
136
136
|
var HIGH_ENTROPY_BRAND_NAME_MAP = {
|
|
137
137
|
'Google Chrome': 'Chrome',
|
|
138
138
|
'Microsoft Edge': 'Edge',
|
|
@@ -409,9 +409,12 @@
|
|
|
409
409
|
|
|
410
410
|
var currentUserAgent = USER_AGENT;
|
|
411
411
|
var parsedCache = null;
|
|
412
|
-
var
|
|
413
|
-
var
|
|
414
|
-
var
|
|
412
|
+
var parsedFromHighEntropyValuesOSName = undefined;
|
|
413
|
+
var parsedFromHighEntropyValuesOSVersion = undefined;
|
|
414
|
+
var parsedFromHighEntropyValuesBrowserName = undefined;
|
|
415
|
+
var parsedFromHighEntropyValuesBrowserVersion = undefined;
|
|
416
|
+
var parsedFromHighEntropyValuesEngineName = undefined;
|
|
417
|
+
var parsedFromHighEntropyValuesEngineVersion = undefined;
|
|
415
418
|
var parsedFromHighEntropyValuesDevice = null;
|
|
416
419
|
var parsedFromNavigatorGPU = {};
|
|
417
420
|
var cachedLocale = null;
|
|
@@ -458,9 +461,12 @@
|
|
|
458
461
|
function invalidateCache() {
|
|
459
462
|
parsedCache = null;
|
|
460
463
|
cachedLocale = null;
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
464
|
+
parsedFromHighEntropyValuesOSName = undefined;
|
|
465
|
+
parsedFromHighEntropyValuesOSVersion = undefined;
|
|
466
|
+
parsedFromHighEntropyValuesBrowserName = undefined;
|
|
467
|
+
parsedFromHighEntropyValuesBrowserVersion = undefined;
|
|
468
|
+
parsedFromHighEntropyValuesEngineName = undefined;
|
|
469
|
+
parsedFromHighEntropyValuesEngineVersion = undefined;
|
|
464
470
|
parsedFromHighEntropyValuesDevice = null;
|
|
465
471
|
parsedFromNavigatorGPU = {};
|
|
466
472
|
}
|
|
@@ -476,71 +482,74 @@
|
|
|
476
482
|
return parsedCache;
|
|
477
483
|
}
|
|
478
484
|
function parseOS() {
|
|
479
|
-
var
|
|
485
|
+
var name = OS.Unknown;
|
|
486
|
+
var version = '';
|
|
480
487
|
for (var i = 0; i < OS_RESOLVER_MAP.length; i++) {
|
|
481
488
|
var map = OS_RESOLVER_MAP[i];
|
|
482
489
|
var matched = currentUserAgent.match(map[0]);
|
|
483
490
|
if (matched !== null) {
|
|
484
|
-
|
|
485
|
-
|
|
491
|
+
name = map[1];
|
|
492
|
+
version = resolveVersion(matched[1], map[2]);
|
|
486
493
|
break;
|
|
487
494
|
}
|
|
488
495
|
}
|
|
489
|
-
if (
|
|
490
|
-
var
|
|
491
|
-
if (
|
|
492
|
-
var major = parseInt(
|
|
496
|
+
if (name === OS.iOS && compareVersion(version, '18.6') === 0) {
|
|
497
|
+
var execs = /\) Version\/([\d.]+)/.exec(currentUserAgent);
|
|
498
|
+
if (execs !== null) {
|
|
499
|
+
var major = parseInt(execs[1].split('.')[0], 10);
|
|
493
500
|
if (major >= 26)
|
|
494
|
-
|
|
501
|
+
version = execs[1];
|
|
495
502
|
}
|
|
496
503
|
}
|
|
497
504
|
if (currentUserAgent === USER_AGENT) {
|
|
498
|
-
if (typeof
|
|
499
|
-
|
|
500
|
-
if (typeof
|
|
501
|
-
|
|
502
|
-
if (
|
|
503
|
-
|
|
505
|
+
if (typeof parsedFromHighEntropyValuesOSName !== 'undefined')
|
|
506
|
+
name = parsedFromHighEntropyValuesOSName;
|
|
507
|
+
if (typeof parsedFromHighEntropyValuesOSVersion !== 'undefined')
|
|
508
|
+
version = parsedFromHighEntropyValuesOSVersion;
|
|
509
|
+
if (name === OS.MacOS && typeof globalThis.navigator.standalone !== 'undefined' && globalThis.navigator.maxTouchPoints > 2)
|
|
510
|
+
name = OS.iOS;
|
|
504
511
|
}
|
|
505
|
-
return
|
|
512
|
+
return { name: name, version: version };
|
|
506
513
|
}
|
|
507
514
|
function parseBrowser() {
|
|
508
|
-
var
|
|
515
|
+
var name = Browsers.Unknown;
|
|
516
|
+
var version = '';
|
|
509
517
|
for (var i = 0; i < BROWSER_RESOLVER_MAP.length; i++) {
|
|
510
518
|
var map = BROWSER_RESOLVER_MAP[i];
|
|
511
519
|
var matched = currentUserAgent.match(map[0]);
|
|
512
520
|
if (matched !== null) {
|
|
513
|
-
|
|
514
|
-
|
|
521
|
+
name = map[1];
|
|
522
|
+
version = resolveVersion(matched[1], map[2]);
|
|
515
523
|
break;
|
|
516
524
|
}
|
|
517
525
|
}
|
|
518
526
|
if (currentUserAgent === USER_AGENT) {
|
|
519
|
-
if (typeof
|
|
520
|
-
|
|
521
|
-
if (typeof
|
|
522
|
-
|
|
527
|
+
if (typeof parsedFromHighEntropyValuesBrowserName !== 'undefined')
|
|
528
|
+
name = parsedFromHighEntropyValuesBrowserName;
|
|
529
|
+
if (typeof parsedFromHighEntropyValuesBrowserVersion !== 'undefined')
|
|
530
|
+
version = parsedFromHighEntropyValuesBrowserVersion;
|
|
523
531
|
}
|
|
524
|
-
return
|
|
532
|
+
return { name: name, version: version };
|
|
525
533
|
}
|
|
526
534
|
function parseEngine() {
|
|
527
|
-
var
|
|
535
|
+
var name = Engines.Unknown;
|
|
536
|
+
var version = '';
|
|
528
537
|
for (var i = 0; i < ENGINE_RESOLVER_MAP.length; i++) {
|
|
529
538
|
var map = ENGINE_RESOLVER_MAP[i];
|
|
530
539
|
var matched = currentUserAgent.match(map[0]);
|
|
531
540
|
if (matched !== null) {
|
|
532
|
-
|
|
533
|
-
|
|
541
|
+
name = map[1];
|
|
542
|
+
version = resolveVersion(matched[1], map[2]);
|
|
534
543
|
break;
|
|
535
544
|
}
|
|
536
545
|
}
|
|
537
546
|
if (currentUserAgent === USER_AGENT) {
|
|
538
|
-
if (typeof
|
|
539
|
-
|
|
540
|
-
if (typeof
|
|
541
|
-
|
|
547
|
+
if (typeof parsedFromHighEntropyValuesEngineName !== 'undefined')
|
|
548
|
+
name = parsedFromHighEntropyValuesEngineName;
|
|
549
|
+
if (typeof parsedFromHighEntropyValuesEngineVersion !== 'undefined')
|
|
550
|
+
version = parsedFromHighEntropyValuesEngineVersion;
|
|
542
551
|
}
|
|
543
|
-
return
|
|
552
|
+
return { name: name, version: version };
|
|
544
553
|
}
|
|
545
554
|
function getGPU() {
|
|
546
555
|
return {
|
|
@@ -553,24 +562,22 @@
|
|
|
553
562
|
function getLocale() {
|
|
554
563
|
if (cachedLocale !== null)
|
|
555
564
|
return cachedLocale;
|
|
556
|
-
var
|
|
557
|
-
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
|
|
561
|
-
|
|
562
|
-
|
|
563
|
-
|
|
564
|
-
|
|
565
|
-
|
|
566
|
-
|
|
567
|
-
|
|
568
|
-
|
|
569
|
-
|
|
570
|
-
|
|
571
|
-
|
|
572
|
-
locale.language = language;
|
|
573
|
-
locale.languages.push(language);
|
|
565
|
+
var language = null;
|
|
566
|
+
var languages = [];
|
|
567
|
+
var timezone = null;
|
|
568
|
+
var offset = 0;
|
|
569
|
+
var isRTL = false;
|
|
570
|
+
var isRTLResolved = null;
|
|
571
|
+
function addLanguages(langs) {
|
|
572
|
+
for (var i = 0; i < langs.length; i++)
|
|
573
|
+
addLanguage(langs[i]);
|
|
574
|
+
}
|
|
575
|
+
function addLanguage(lang) {
|
|
576
|
+
lang = normalizeLocale(lang);
|
|
577
|
+
if (typeof lang === 'string' && languages.indexOf(lang) === -1) {
|
|
578
|
+
if (language === null)
|
|
579
|
+
language = lang;
|
|
580
|
+
languages.push(lang);
|
|
574
581
|
}
|
|
575
582
|
}
|
|
576
583
|
if (typeof Intl !== 'undefined') {
|
|
@@ -580,7 +587,7 @@
|
|
|
580
587
|
catch (_) {
|
|
581
588
|
}
|
|
582
589
|
try {
|
|
583
|
-
|
|
590
|
+
timezone = Intl.DateTimeFormat().resolvedOptions().timeZone;
|
|
584
591
|
}
|
|
585
592
|
catch (_) {
|
|
586
593
|
}
|
|
@@ -598,38 +605,38 @@
|
|
|
598
605
|
addLanguage(globalThis.navigator.systemLanguage);
|
|
599
606
|
}
|
|
600
607
|
try {
|
|
601
|
-
|
|
608
|
+
offset = new Date().getTimezoneOffset() * -1;
|
|
602
609
|
}
|
|
603
610
|
catch (_) {
|
|
604
611
|
}
|
|
605
|
-
if (typeof
|
|
612
|
+
if (typeof language === 'string') {
|
|
606
613
|
if (typeof Intl !== 'undefined' && typeof Intl.Locale !== 'undefined') {
|
|
607
614
|
try {
|
|
608
|
-
var intlLocale = new Intl.Locale(
|
|
615
|
+
var intlLocale = new Intl.Locale(language);
|
|
609
616
|
if (typeof intlLocale.getTextInfo === 'function')
|
|
610
|
-
|
|
617
|
+
isRTLResolved = intlLocale.getTextInfo().direction === 'rtl';
|
|
611
618
|
else if (typeof intlLocale.textInfo !== 'undefined')
|
|
612
|
-
|
|
619
|
+
isRTLResolved = intlLocale.textInfo.direction === 'rtl';
|
|
613
620
|
}
|
|
614
621
|
catch (_) {
|
|
615
622
|
}
|
|
616
623
|
}
|
|
617
|
-
if (typeof
|
|
618
|
-
var matched = /^([A-Za-z]{1,8})(?:[-_][A-Za-z0-9]{1,8})*$/.exec(
|
|
624
|
+
if (typeof isRTLResolved !== 'boolean') {
|
|
625
|
+
var matched = /^([A-Za-z]{1,8})(?:[-_][A-Za-z0-9]{1,8})*$/.exec(language);
|
|
619
626
|
if (matched !== null) {
|
|
620
|
-
var
|
|
627
|
+
var lang = matched[1].toLowerCase();
|
|
621
628
|
for (var i = 0; i < RTL_LANGUAGES.length; i++) {
|
|
622
|
-
if (RTL_LANGUAGES[i] ===
|
|
623
|
-
|
|
629
|
+
if (RTL_LANGUAGES[i] === lang) {
|
|
630
|
+
isRTLResolved = true;
|
|
624
631
|
break;
|
|
625
632
|
}
|
|
626
633
|
}
|
|
627
634
|
}
|
|
628
635
|
}
|
|
629
636
|
}
|
|
630
|
-
if (typeof
|
|
631
|
-
|
|
632
|
-
cachedLocale =
|
|
637
|
+
if (typeof isRTLResolved === 'boolean')
|
|
638
|
+
isRTL = isRTLResolved;
|
|
639
|
+
cachedLocale = { language: language, languages: languages, timezone: timezone, offset: offset, isRTL: isRTL };
|
|
633
640
|
return cachedLocale;
|
|
634
641
|
}
|
|
635
642
|
function getDevice() {
|
|
@@ -680,38 +687,38 @@
|
|
|
680
687
|
if (prevBrandName === null || /Chrom/.test(prevBrandName) || !/Chrom/.test(brandName)) {
|
|
681
688
|
browserName = brandName;
|
|
682
689
|
if (browserName === 'Chrome' || browserName === 'Chrome WebView' || browserName === 'Chrome Headless')
|
|
683
|
-
|
|
690
|
+
parsedFromHighEntropyValuesBrowserName = Browsers.Chrome;
|
|
684
691
|
else if (browserName === 'Edge' || browserName === 'Edge WebView2')
|
|
685
|
-
|
|
692
|
+
parsedFromHighEntropyValuesBrowserName = Browsers.Edge;
|
|
686
693
|
else if (browserName === 'Opera Mobi')
|
|
687
|
-
|
|
688
|
-
|
|
694
|
+
parsedFromHighEntropyValuesBrowserName = Browsers.Opera;
|
|
695
|
+
parsedFromHighEntropyValuesBrowserVersion = brandVersion;
|
|
689
696
|
}
|
|
690
697
|
prevBrandName = brandName;
|
|
691
698
|
}
|
|
692
699
|
if (brandName === 'Chromium')
|
|
693
|
-
|
|
700
|
+
parsedFromHighEntropyValuesEngineVersion = brandVersion;
|
|
694
701
|
}
|
|
695
702
|
if (typeof platformVersion === 'string') {
|
|
696
703
|
if (getParsedCache().os.name === OS.Windows) {
|
|
697
704
|
if (parseInt(platformVersion.split('.')[0], 10) >= 13)
|
|
698
|
-
|
|
705
|
+
parsedFromHighEntropyValuesOSVersion = '11';
|
|
699
706
|
else
|
|
700
|
-
|
|
707
|
+
parsedFromHighEntropyValuesOSVersion = '10';
|
|
701
708
|
}
|
|
702
709
|
else {
|
|
703
|
-
|
|
710
|
+
parsedFromHighEntropyValuesOSVersion = platformVersion;
|
|
704
711
|
}
|
|
705
712
|
}
|
|
706
713
|
if (typeof platform === 'string') {
|
|
707
714
|
if (/android/i.test(platform))
|
|
708
|
-
|
|
715
|
+
parsedFromHighEntropyValuesOSName = OS.Android;
|
|
709
716
|
else if (/ios|iphone|ipad/i.test(platform))
|
|
710
|
-
|
|
717
|
+
parsedFromHighEntropyValuesOSName = OS.iOS;
|
|
711
718
|
else if (/windows|win32/i.test(platform))
|
|
712
|
-
|
|
719
|
+
parsedFromHighEntropyValuesOSName = OS.Windows;
|
|
713
720
|
else if (/macos|macintel/i.test(platform))
|
|
714
|
-
|
|
721
|
+
parsedFromHighEntropyValuesOSName = OS.MacOS;
|
|
715
722
|
}
|
|
716
723
|
if (result.mobile === true)
|
|
717
724
|
parsedFromHighEntropyValuesDevice = Devices.Mobile;
|
|
@@ -833,6 +840,8 @@
|
|
|
833
840
|
},
|
|
834
841
|
subscribe: function (listener, options) {
|
|
835
842
|
if (options === void 0) { options = {}; }
|
|
843
|
+
if (typeof options.signal !== 'undefined' && options.signal.aborted)
|
|
844
|
+
return function () { };
|
|
836
845
|
var entry = { fn: listener, once: false };
|
|
837
846
|
if (typeof options.once !== 'undefined')
|
|
838
847
|
entry.once = options.once;
|
|
@@ -851,12 +860,8 @@
|
|
|
851
860
|
EventListener.remove(entry.signal, { type: 'abort', callback: cleanup });
|
|
852
861
|
removeEntry(entry);
|
|
853
862
|
};
|
|
854
|
-
if (typeof entry.signal !== 'undefined')
|
|
855
|
-
|
|
856
|
-
removeEntry(entry);
|
|
857
|
-
else
|
|
858
|
-
EventListener.add(entry.signal, { type: 'abort', callback: cleanup });
|
|
859
|
-
}
|
|
863
|
+
if (typeof entry.signal !== 'undefined')
|
|
864
|
+
EventListener.add(entry.signal, { type: 'abort', callback: cleanup });
|
|
860
865
|
return function unsubscribe() {
|
|
861
866
|
removeEntry(entry);
|
|
862
867
|
};
|
|
@@ -864,14 +869,14 @@
|
|
|
864
869
|
};
|
|
865
870
|
}
|
|
866
871
|
|
|
867
|
-
var onChangeSubscriptionManager$
|
|
872
|
+
var onChangeSubscriptionManager$4 = createSubscriptionManager(attachOnChange$4, detachOnChange$4);
|
|
868
873
|
var appearanceRef = null;
|
|
869
874
|
var pollingIntervalId = null;
|
|
870
875
|
var Appearance = {
|
|
871
876
|
get value() {
|
|
872
877
|
return getAppearance();
|
|
873
878
|
},
|
|
874
|
-
onChange: onChangeSubscriptionManager$
|
|
879
|
+
onChange: onChangeSubscriptionManager$4.subscribe,
|
|
875
880
|
Constants: {
|
|
876
881
|
Appearances: Appearances
|
|
877
882
|
},
|
|
@@ -890,9 +895,9 @@
|
|
|
890
895
|
return Appearances.Light;
|
|
891
896
|
}
|
|
892
897
|
function getAppearanceFromMediaQuery() {
|
|
893
|
-
if (
|
|
898
|
+
if (PREFERS_COLOR_SCHEME_MEDIA_QUERY_LIST.media === 'not all')
|
|
894
899
|
return Appearances.Unknown;
|
|
895
|
-
if (
|
|
900
|
+
if (PREFERS_COLOR_SCHEME_MEDIA_QUERY_LIST.matches)
|
|
896
901
|
return Appearances.Dark;
|
|
897
902
|
return Appearances.Light;
|
|
898
903
|
}
|
|
@@ -907,7 +912,7 @@
|
|
|
907
912
|
var appearance = getAppearanceFromEngine();
|
|
908
913
|
if (appearance !== appearanceRef) {
|
|
909
914
|
appearanceRef = appearance;
|
|
910
|
-
onChangeSubscriptionManager$
|
|
915
|
+
onChangeSubscriptionManager$4.emit(appearance);
|
|
911
916
|
}
|
|
912
917
|
}, 2000);
|
|
913
918
|
}
|
|
@@ -918,15 +923,15 @@
|
|
|
918
923
|
pollingIntervalId = null;
|
|
919
924
|
}
|
|
920
925
|
}
|
|
921
|
-
function attachOnChange$
|
|
926
|
+
function attachOnChange$4() {
|
|
922
927
|
appearanceRef = getAppearanceFromMediaQuery();
|
|
923
|
-
EventListener.add(
|
|
928
|
+
EventListener.add(PREFERS_COLOR_SCHEME_MEDIA_QUERY_LIST, { type: 'change', callback: onMediaChange });
|
|
924
929
|
if (Platform.browser.name === Browsers.SamsungInternet)
|
|
925
930
|
startPolling();
|
|
926
931
|
}
|
|
927
|
-
function detachOnChange$
|
|
932
|
+
function detachOnChange$4() {
|
|
928
933
|
appearanceRef = null;
|
|
929
|
-
EventListener.remove(
|
|
934
|
+
EventListener.remove(PREFERS_COLOR_SCHEME_MEDIA_QUERY_LIST, { type: 'change', callback: onMediaChange });
|
|
930
935
|
if (Platform.browser.name === Browsers.SamsungInternet)
|
|
931
936
|
stopPolling();
|
|
932
937
|
}
|
|
@@ -937,7 +942,7 @@
|
|
|
937
942
|
else
|
|
938
943
|
appearance = Appearances.Light;
|
|
939
944
|
if (appearance !== appearanceRef)
|
|
940
|
-
onChangeSubscriptionManager$
|
|
945
|
+
onChangeSubscriptionManager$4.emit(appearanceRef = appearance);
|
|
941
946
|
}
|
|
942
947
|
|
|
943
948
|
function isSecureContext() {
|
|
@@ -1354,9 +1359,20 @@
|
|
|
1354
1359
|
|
|
1355
1360
|
var Orientation;
|
|
1356
1361
|
(function (Orientation) {
|
|
1357
|
-
Orientation["
|
|
1358
|
-
Orientation["
|
|
1359
|
-
Orientation["
|
|
1362
|
+
Orientation["PortraitPrimary"] = "portrait-primary";
|
|
1363
|
+
Orientation["PortraitSecondary"] = "portrait-secondary";
|
|
1364
|
+
Orientation["LandscapePrimary"] = "landscape-primary";
|
|
1365
|
+
Orientation["LandscapeSecondary"] = "landscape-secondary";
|
|
1366
|
+
})(Orientation || (Orientation = {}));
|
|
1367
|
+
(function (Orientation) {
|
|
1368
|
+
function isLandscape(orientation) {
|
|
1369
|
+
return orientation === Orientation.LandscapePrimary || orientation === Orientation.LandscapeSecondary;
|
|
1370
|
+
}
|
|
1371
|
+
Orientation.isLandscape = isLandscape;
|
|
1372
|
+
function isPortrait(orientation) {
|
|
1373
|
+
return orientation === Orientation.PortraitPrimary || orientation === Orientation.PortraitSecondary;
|
|
1374
|
+
}
|
|
1375
|
+
Orientation.isPortrait = isPortrait;
|
|
1360
1376
|
})(Orientation || (Orientation = {}));
|
|
1361
1377
|
var ENV_PRESETS = {
|
|
1362
1378
|
'safe-area-inset': {
|
|
@@ -1394,19 +1410,16 @@
|
|
|
1394
1410
|
left: 'viewport-segment-left',
|
|
1395
1411
|
},
|
|
1396
1412
|
};
|
|
1397
|
-
var
|
|
1398
|
-
innerWidth: -1,
|
|
1399
|
-
innerHeight: -1,
|
|
1400
|
-
outerWidth: -1,
|
|
1401
|
-
outerHeight: -1,
|
|
1402
|
-
scale: 1,
|
|
1403
|
-
orientation: Orientation.Unknown,
|
|
1404
|
-
};
|
|
1405
|
-
var MEDIA_QUERY_LIST;
|
|
1413
|
+
var ORIENTATION_MEDIA_QUERY_LIST;
|
|
1406
1414
|
if (typeof globalThis.matchMedia !== 'undefined')
|
|
1407
|
-
|
|
1415
|
+
ORIENTATION_MEDIA_QUERY_LIST = globalThis.matchMedia('(orientation: portrait)');
|
|
1408
1416
|
else
|
|
1409
|
-
|
|
1417
|
+
ORIENTATION_MEDIA_QUERY_LIST = FALLBACK_MEDIA_QUERY_LIST;
|
|
1418
|
+
var DEVICE_POSTURE_MEDIA_QUERY_LIST;
|
|
1419
|
+
if (typeof globalThis.matchMedia !== 'undefined')
|
|
1420
|
+
DEVICE_POSTURE_MEDIA_QUERY_LIST = globalThis.matchMedia('(device-posture: folded)');
|
|
1421
|
+
else
|
|
1422
|
+
DEVICE_POSTURE_MEDIA_QUERY_LIST = FALLBACK_MEDIA_QUERY_LIST;
|
|
1410
1423
|
|
|
1411
1424
|
function keys(object) {
|
|
1412
1425
|
var keys = [];
|
|
@@ -1428,8 +1441,297 @@
|
|
|
1428
1441
|
globalThis.setTimeout(task, 0);
|
|
1429
1442
|
}
|
|
1430
1443
|
|
|
1444
|
+
var MAX_SEGMENTS_PER_AXIS = 4;
|
|
1431
1445
|
function noop() {
|
|
1432
1446
|
}
|
|
1447
|
+
function getSupportedEnvironment() {
|
|
1448
|
+
if (typeof globalThis.CSS !== 'undefined' && typeof globalThis.CSS.supports === 'function') {
|
|
1449
|
+
if (globalThis.CSS.supports('x: env(x)'))
|
|
1450
|
+
return 'env';
|
|
1451
|
+
if (globalThis.CSS.supports('x: constant(x)'))
|
|
1452
|
+
return 'constant';
|
|
1453
|
+
}
|
|
1454
|
+
return undefined;
|
|
1455
|
+
}
|
|
1456
|
+
function getSegmentGrid() {
|
|
1457
|
+
if (typeof globalThis.matchMedia !== 'function')
|
|
1458
|
+
return { rows: 1, cols: 1 };
|
|
1459
|
+
var cols = 1;
|
|
1460
|
+
var rows = 1;
|
|
1461
|
+
for (var i = MAX_SEGMENTS_PER_AXIS; i >= 2; i--) {
|
|
1462
|
+
if (globalThis.matchMedia('(horizontal-viewport-segments: ' + i + ')').matches) {
|
|
1463
|
+
cols = i;
|
|
1464
|
+
break;
|
|
1465
|
+
}
|
|
1466
|
+
}
|
|
1467
|
+
for (var i = MAX_SEGMENTS_PER_AXIS; i >= 2; i--) {
|
|
1468
|
+
if (globalThis.matchMedia('(vertical-viewport-segments: ' + i + ')').matches) {
|
|
1469
|
+
rows = i;
|
|
1470
|
+
break;
|
|
1471
|
+
}
|
|
1472
|
+
}
|
|
1473
|
+
return { rows: rows, cols: cols };
|
|
1474
|
+
}
|
|
1475
|
+
function buildSegmentMediaQueryLists() {
|
|
1476
|
+
if (typeof globalThis.matchMedia !== 'function')
|
|
1477
|
+
return [];
|
|
1478
|
+
var mediaQueryLists = [];
|
|
1479
|
+
for (var i = 2; i <= MAX_SEGMENTS_PER_AXIS; i++) {
|
|
1480
|
+
mediaQueryLists.push(globalThis.matchMedia('(horizontal-viewport-segments: ' + i + ')'));
|
|
1481
|
+
mediaQueryLists.push(globalThis.matchMedia('(vertical-viewport-segments: ' + i + ')'));
|
|
1482
|
+
}
|
|
1483
|
+
return mediaQueryLists;
|
|
1484
|
+
}
|
|
1485
|
+
function createViewportSegmentObserver() {
|
|
1486
|
+
var viewport = globalThis.viewport;
|
|
1487
|
+
var visualViewport = globalThis.visualViewport;
|
|
1488
|
+
var devicePosture = globalThis.navigator.devicePosture;
|
|
1489
|
+
var hasSegmentsAPI = typeof viewport !== 'undefined';
|
|
1490
|
+
var hasLegacySegmentsAPI = !hasSegmentsAPI && typeof visualViewport !== 'undefined' && visualViewport !== null && typeof visualViewport.segments !== 'undefined';
|
|
1491
|
+
var hasDevicePosture = typeof devicePosture !== 'undefined';
|
|
1492
|
+
var onChangeSubscriptionManager = createSubscriptionManager(attachOnChange, detachOnChange);
|
|
1493
|
+
var support = getSupportedEnvironment();
|
|
1494
|
+
var cachedDiv = null;
|
|
1495
|
+
var segmentMediaQueryLists = [];
|
|
1496
|
+
var previousSegments = null;
|
|
1497
|
+
function attachCSSFallbackListeners() {
|
|
1498
|
+
segmentMediaQueryLists = buildSegmentMediaQueryLists();
|
|
1499
|
+
for (var i = 0; i < segmentMediaQueryLists.length; i++)
|
|
1500
|
+
EventListener.add(segmentMediaQueryLists[i], { type: 'change', callback: onSegmentChange });
|
|
1501
|
+
if (DEVICE_POSTURE_MEDIA_QUERY_LIST.media !== 'not all')
|
|
1502
|
+
EventListener.add(DEVICE_POSTURE_MEDIA_QUERY_LIST, { type: 'change', callback: onSegmentChange });
|
|
1503
|
+
}
|
|
1504
|
+
function detachCSSFallbackListeners() {
|
|
1505
|
+
for (var i = 0; i < segmentMediaQueryLists.length; i++)
|
|
1506
|
+
EventListener.remove(segmentMediaQueryLists[i], { type: 'change', callback: onSegmentChange });
|
|
1507
|
+
segmentMediaQueryLists = [];
|
|
1508
|
+
if (DEVICE_POSTURE_MEDIA_QUERY_LIST.media !== 'not all')
|
|
1509
|
+
EventListener.remove(DEVICE_POSTURE_MEDIA_QUERY_LIST, { type: 'change', callback: onSegmentChange });
|
|
1510
|
+
}
|
|
1511
|
+
function attachDevicePostureChangeListener() {
|
|
1512
|
+
if (hasDevicePosture)
|
|
1513
|
+
EventListener.add(devicePosture, { type: 'change', callback: onSegmentChange });
|
|
1514
|
+
attachCSSFallbackListeners();
|
|
1515
|
+
}
|
|
1516
|
+
function detachDevicePostureChangeListener() {
|
|
1517
|
+
if (hasDevicePosture)
|
|
1518
|
+
EventListener.remove(devicePosture, { type: 'change', callback: onSegmentChange });
|
|
1519
|
+
detachCSSFallbackListeners();
|
|
1520
|
+
}
|
|
1521
|
+
function attachVisualViewportResizeListener() {
|
|
1522
|
+
EventListener.add(visualViewport, { type: 'resize', callback: onSegmentChange, options: { passive: true } });
|
|
1523
|
+
}
|
|
1524
|
+
function detachVisualViewportResizeListener() {
|
|
1525
|
+
EventListener.remove(visualViewport, { type: 'resize', callback: onSegmentChange, options: { passive: true } });
|
|
1526
|
+
}
|
|
1527
|
+
function attachOnChange() {
|
|
1528
|
+
EventListener.add(globalThis, { type: 'resize', callback: onSegmentChange });
|
|
1529
|
+
if (hasSegmentsAPI) {
|
|
1530
|
+
attachDevicePostureChangeListener();
|
|
1531
|
+
}
|
|
1532
|
+
else if (hasLegacySegmentsAPI) {
|
|
1533
|
+
attachVisualViewportResizeListener();
|
|
1534
|
+
attachDevicePostureChangeListener();
|
|
1535
|
+
}
|
|
1536
|
+
else {
|
|
1537
|
+
getOrCreateCachedDiv();
|
|
1538
|
+
attachVisualViewportResizeListener();
|
|
1539
|
+
}
|
|
1540
|
+
}
|
|
1541
|
+
function detachOnChange() {
|
|
1542
|
+
EventListener.remove(globalThis, { type: 'resize', callback: onSegmentChange });
|
|
1543
|
+
if (hasSegmentsAPI) {
|
|
1544
|
+
detachDevicePostureChangeListener();
|
|
1545
|
+
}
|
|
1546
|
+
else if (hasLegacySegmentsAPI) {
|
|
1547
|
+
detachVisualViewportResizeListener();
|
|
1548
|
+
detachDevicePostureChangeListener();
|
|
1549
|
+
}
|
|
1550
|
+
else {
|
|
1551
|
+
detachVisualViewportResizeListener();
|
|
1552
|
+
releaseDiv();
|
|
1553
|
+
}
|
|
1554
|
+
}
|
|
1555
|
+
function segmentsEqual(segments1, segments2) {
|
|
1556
|
+
if (segments1.length !== segments2.length)
|
|
1557
|
+
return false;
|
|
1558
|
+
for (var i = 0; i < segments1.length; i++) {
|
|
1559
|
+
var segment1 = segments1[i];
|
|
1560
|
+
var segment2 = segments2[i];
|
|
1561
|
+
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)
|
|
1562
|
+
return false;
|
|
1563
|
+
}
|
|
1564
|
+
return true;
|
|
1565
|
+
}
|
|
1566
|
+
function onSegmentChange() {
|
|
1567
|
+
var next = getValue();
|
|
1568
|
+
if (previousSegments !== null && segmentsEqual(previousSegments, next))
|
|
1569
|
+
return;
|
|
1570
|
+
previousSegments = next;
|
|
1571
|
+
onChangeSubscriptionManager.emit(next);
|
|
1572
|
+
}
|
|
1573
|
+
function buildDiv() {
|
|
1574
|
+
var div = createHiddenElement('div');
|
|
1575
|
+
div.setAttribute('data-viewport-segment-observer', '');
|
|
1576
|
+
div.style.setProperty('position', 'fixed', 'important');
|
|
1577
|
+
div.style.setProperty('top', '0', 'important');
|
|
1578
|
+
div.style.setProperty('left', '0', 'important');
|
|
1579
|
+
div.style.setProperty('visibility', 'hidden', 'important');
|
|
1580
|
+
div.style.setProperty('pointer-events', 'none', 'important');
|
|
1581
|
+
div.style.setProperty('z-index', '-1', 'important');
|
|
1582
|
+
div.style.setProperty('box-sizing', 'content-box', 'important');
|
|
1583
|
+
div.style.setProperty('padding', '0', 'important');
|
|
1584
|
+
div.style.setProperty('margin', '0', 'important');
|
|
1585
|
+
div.style.setProperty('border', '0', 'important');
|
|
1586
|
+
div.style.setProperty('width', '0', 'important');
|
|
1587
|
+
div.style.setProperty('height', '0', 'important');
|
|
1588
|
+
div.style.setProperty('min-width', '0', 'important');
|
|
1589
|
+
div.style.setProperty('min-height', '0', 'important');
|
|
1590
|
+
div.style.setProperty('max-width', 'none', 'important');
|
|
1591
|
+
div.style.setProperty('max-height', 'none', 'important');
|
|
1592
|
+
div.style.setProperty('transition', 'none', 'important');
|
|
1593
|
+
div.style.setProperty('animation', 'none', 'important');
|
|
1594
|
+
div.style.setProperty('display', 'block', 'important');
|
|
1595
|
+
div.style.setProperty('float', 'none', 'important');
|
|
1596
|
+
div.style.setProperty('transform', 'none', 'important');
|
|
1597
|
+
return div;
|
|
1598
|
+
}
|
|
1599
|
+
function getOrCreateCachedDiv() {
|
|
1600
|
+
if (cachedDiv !== null)
|
|
1601
|
+
return cachedDiv;
|
|
1602
|
+
cachedDiv = buildDiv();
|
|
1603
|
+
globalThis.document.body.appendChild(cachedDiv);
|
|
1604
|
+
return cachedDiv;
|
|
1605
|
+
}
|
|
1606
|
+
function releaseDiv() {
|
|
1607
|
+
if (cachedDiv !== null) {
|
|
1608
|
+
if (cachedDiv.parentNode !== null)
|
|
1609
|
+
cachedDiv.parentNode.removeChild(cachedDiv);
|
|
1610
|
+
cachedDiv = null;
|
|
1611
|
+
}
|
|
1612
|
+
}
|
|
1613
|
+
function readFromSegmentsAPI() {
|
|
1614
|
+
var segments;
|
|
1615
|
+
if (hasSegmentsAPI)
|
|
1616
|
+
segments = viewport.segments;
|
|
1617
|
+
else
|
|
1618
|
+
segments = visualViewport.segments;
|
|
1619
|
+
if (segments === null || typeof segments === 'undefined')
|
|
1620
|
+
return [];
|
|
1621
|
+
var results = [];
|
|
1622
|
+
for (var i = 0; i < segments.length; i++) {
|
|
1623
|
+
var segment = segments[i];
|
|
1624
|
+
results.push({
|
|
1625
|
+
width: segment.width,
|
|
1626
|
+
height: segment.height,
|
|
1627
|
+
top: segment.top,
|
|
1628
|
+
left: segment.left,
|
|
1629
|
+
bottom: segment.bottom,
|
|
1630
|
+
right: segment.right,
|
|
1631
|
+
});
|
|
1632
|
+
}
|
|
1633
|
+
return results;
|
|
1634
|
+
}
|
|
1635
|
+
function buildFullViewportSegment() {
|
|
1636
|
+
var width = globalThis.innerWidth;
|
|
1637
|
+
var height = globalThis.innerHeight;
|
|
1638
|
+
return {
|
|
1639
|
+
width: width,
|
|
1640
|
+
height: height,
|
|
1641
|
+
top: 0,
|
|
1642
|
+
left: 0,
|
|
1643
|
+
bottom: height,
|
|
1644
|
+
right: width,
|
|
1645
|
+
};
|
|
1646
|
+
}
|
|
1647
|
+
function readFromCSSEnv(div) {
|
|
1648
|
+
var grid = getSegmentGrid();
|
|
1649
|
+
if (grid.rows === 1 && grid.cols === 1)
|
|
1650
|
+
return [buildFullViewportSegment()];
|
|
1651
|
+
if (typeof support === 'undefined' || typeof div.style.setProperty === 'undefined')
|
|
1652
|
+
return [buildFullViewportSegment()];
|
|
1653
|
+
var results = [];
|
|
1654
|
+
for (var row = 0; row < grid.rows; row++) {
|
|
1655
|
+
for (var col = 0; col < grid.cols; col++) {
|
|
1656
|
+
div.style.setProperty('width', support + '(viewport-segment-width ' + row + ' ' + col + ', -1px)', 'important');
|
|
1657
|
+
div.style.setProperty('height', support + '(viewport-segment-height ' + row + ' ' + col + ', -1px)', 'important');
|
|
1658
|
+
div.style.setProperty('margin-top', support + '(viewport-segment-top ' + row + ' ' + col + ', -1px)', 'important');
|
|
1659
|
+
div.style.setProperty('margin-left', support + '(viewport-segment-left ' + row + ' ' + col + ', -1px)', 'important');
|
|
1660
|
+
div.style.setProperty('margin-bottom', support + '(viewport-segment-bottom ' + row + ' ' + col + ', -1px)', 'important');
|
|
1661
|
+
div.style.setProperty('margin-right', support + '(viewport-segment-right ' + row + ' ' + col + ', -1px)', 'important');
|
|
1662
|
+
var computed = globalThis.getComputedStyle(div);
|
|
1663
|
+
var top_1 = globalThis.parseFloat(computed.marginTop);
|
|
1664
|
+
if (top_1 < 0)
|
|
1665
|
+
continue;
|
|
1666
|
+
var left = globalThis.parseFloat(computed.marginLeft);
|
|
1667
|
+
var bottom = globalThis.parseFloat(computed.marginBottom);
|
|
1668
|
+
var right = globalThis.parseFloat(computed.marginRight);
|
|
1669
|
+
var width = globalThis.parseFloat(computed.width);
|
|
1670
|
+
var height = globalThis.parseFloat(computed.height);
|
|
1671
|
+
results.push({
|
|
1672
|
+
width: width,
|
|
1673
|
+
height: height,
|
|
1674
|
+
top: top_1,
|
|
1675
|
+
left: left,
|
|
1676
|
+
bottom: bottom,
|
|
1677
|
+
right: right,
|
|
1678
|
+
});
|
|
1679
|
+
}
|
|
1680
|
+
}
|
|
1681
|
+
return results;
|
|
1682
|
+
}
|
|
1683
|
+
function getValue() {
|
|
1684
|
+
if (hasSegmentsAPI || hasLegacySegmentsAPI)
|
|
1685
|
+
return readFromSegmentsAPI();
|
|
1686
|
+
if (cachedDiv !== null)
|
|
1687
|
+
return readFromCSSEnv(cachedDiv);
|
|
1688
|
+
var div = buildDiv();
|
|
1689
|
+
globalThis.document.body.appendChild(div);
|
|
1690
|
+
var results = readFromCSSEnv(div);
|
|
1691
|
+
globalThis.document.body.removeChild(div);
|
|
1692
|
+
return results;
|
|
1693
|
+
}
|
|
1694
|
+
function useCssVariable(prefix) {
|
|
1695
|
+
if (typeof globalThis.document === 'undefined')
|
|
1696
|
+
return noop;
|
|
1697
|
+
var attributes = keys(ENV_PRESETS['viewport-segment']);
|
|
1698
|
+
var element = globalThis.document.documentElement;
|
|
1699
|
+
var lastCount = 0;
|
|
1700
|
+
function applySegments(segments) {
|
|
1701
|
+
for (var i = segments.length; i < lastCount; i++) {
|
|
1702
|
+
for (var j = 0; j < attributes.length; j++) {
|
|
1703
|
+
element.style.removeProperty('--' + prefix + '-' + i + '-' + attributes[j]);
|
|
1704
|
+
}
|
|
1705
|
+
}
|
|
1706
|
+
lastCount = segments.length;
|
|
1707
|
+
for (var i = 0; i < segments.length; i++) {
|
|
1708
|
+
var segment = segments[i];
|
|
1709
|
+
for (var j = 0; j < attributes.length; j++) {
|
|
1710
|
+
var attribute = attributes[j];
|
|
1711
|
+
element.style.setProperty('--' + prefix + '-' + i + '-' + attribute, segment[attribute] + 'px');
|
|
1712
|
+
}
|
|
1713
|
+
}
|
|
1714
|
+
}
|
|
1715
|
+
applySegments(getValue());
|
|
1716
|
+
var unsubscribe = onChangeSubscriptionManager.subscribe(function (segments) {
|
|
1717
|
+
applySegments(segments);
|
|
1718
|
+
});
|
|
1719
|
+
return function () {
|
|
1720
|
+
unsubscribe();
|
|
1721
|
+
for (var i = 0; i < lastCount; i++)
|
|
1722
|
+
for (var j = 0; j < attributes.length; j++)
|
|
1723
|
+
element.style.removeProperty('--' + prefix + '-' + i + '-' + attributes[j]);
|
|
1724
|
+
lastCount = 0;
|
|
1725
|
+
};
|
|
1726
|
+
}
|
|
1727
|
+
return {
|
|
1728
|
+
get value() {
|
|
1729
|
+
return getValue();
|
|
1730
|
+
},
|
|
1731
|
+
onChange: onChangeSubscriptionManager.subscribe,
|
|
1732
|
+
useCssVariable: useCssVariable,
|
|
1733
|
+
};
|
|
1734
|
+
}
|
|
1433
1735
|
function createVirtualKeyboardObserver() {
|
|
1434
1736
|
var onChangeSubscriptionManager = createSubscriptionManager(attachOnChange, detachOnChange);
|
|
1435
1737
|
function attachOnChange() {
|
|
@@ -1447,16 +1749,16 @@
|
|
|
1447
1749
|
var top = rect.y;
|
|
1448
1750
|
var width = rect.width;
|
|
1449
1751
|
var height = rect.height;
|
|
1450
|
-
var right
|
|
1451
|
-
|
|
1452
|
-
|
|
1453
|
-
|
|
1454
|
-
|
|
1455
|
-
var bottom
|
|
1456
|
-
|
|
1457
|
-
|
|
1458
|
-
|
|
1459
|
-
|
|
1752
|
+
var right;
|
|
1753
|
+
if (width === 0)
|
|
1754
|
+
right = 0;
|
|
1755
|
+
else
|
|
1756
|
+
right = Math.max(0, globalThis.innerWidth - (left + width));
|
|
1757
|
+
var bottom;
|
|
1758
|
+
if (height === 0)
|
|
1759
|
+
bottom = 0;
|
|
1760
|
+
else
|
|
1761
|
+
bottom = Math.max(0, globalThis.innerHeight - (top + height));
|
|
1460
1762
|
return {
|
|
1461
1763
|
top: top,
|
|
1462
1764
|
right: right,
|
|
@@ -1466,17 +1768,43 @@
|
|
|
1466
1768
|
height: height,
|
|
1467
1769
|
};
|
|
1468
1770
|
}
|
|
1771
|
+
function useCssVariable(prefix) {
|
|
1772
|
+
if (typeof globalThis.document === 'undefined')
|
|
1773
|
+
return noop;
|
|
1774
|
+
var attributes = keys(ENV_PRESETS['keyboard-inset']);
|
|
1775
|
+
var element = globalThis.document.documentElement;
|
|
1776
|
+
function applyValues(values) {
|
|
1777
|
+
for (var i = 0; i < attributes.length; i++) {
|
|
1778
|
+
var attribute = attributes[i];
|
|
1779
|
+
element.style.setProperty('--' + prefix + '-' + attribute, values[attribute] + 'px');
|
|
1780
|
+
}
|
|
1781
|
+
}
|
|
1782
|
+
applyValues(getValue());
|
|
1783
|
+
var unsubscribe = onChangeSubscriptionManager.subscribe(function (values) {
|
|
1784
|
+
applyValues(values);
|
|
1785
|
+
});
|
|
1786
|
+
return function () {
|
|
1787
|
+
unsubscribe();
|
|
1788
|
+
for (var i = 0; i < attributes.length; i++)
|
|
1789
|
+
element.style.removeProperty('--' + prefix + '-' + attributes[i]);
|
|
1790
|
+
};
|
|
1791
|
+
}
|
|
1469
1792
|
return {
|
|
1470
|
-
get
|
|
1793
|
+
get value() {
|
|
1794
|
+
return getValue();
|
|
1795
|
+
},
|
|
1471
1796
|
onChange: onChangeSubscriptionManager.subscribe,
|
|
1797
|
+
useCssVariable: useCssVariable,
|
|
1472
1798
|
};
|
|
1473
1799
|
}
|
|
1474
|
-
function
|
|
1800
|
+
function createEnvironmentObserver(preset) {
|
|
1475
1801
|
if (preset === 'keyboard-inset' && typeof globalThis.navigator.virtualKeyboard !== 'undefined')
|
|
1476
1802
|
return createVirtualKeyboardObserver();
|
|
1477
|
-
|
|
1478
|
-
|
|
1479
|
-
var
|
|
1803
|
+
if (preset === 'viewport-segment')
|
|
1804
|
+
return createViewportSegmentObserver();
|
|
1805
|
+
var environmentMap = ENV_PRESETS[preset];
|
|
1806
|
+
var attributes = keys(environmentMap);
|
|
1807
|
+
var support = getSupportedEnvironment();
|
|
1480
1808
|
var parentReadyCallbacks = [];
|
|
1481
1809
|
var onChangeSubscriptionManager = createSubscriptionManager(attachOnChange, detachOnChange);
|
|
1482
1810
|
var elementComputedStyle = {};
|
|
@@ -1493,15 +1821,6 @@
|
|
|
1493
1821
|
function detachOnChange() {
|
|
1494
1822
|
removeDetector();
|
|
1495
1823
|
}
|
|
1496
|
-
function getSupportedEnv() {
|
|
1497
|
-
if (typeof globalThis.CSS !== 'undefined' && typeof globalThis.CSS.supports === 'function') {
|
|
1498
|
-
if (globalThis.CSS.supports('x: env(x)'))
|
|
1499
|
-
return 'env';
|
|
1500
|
-
if (globalThis.CSS.supports('x: constant(x)'))
|
|
1501
|
-
return 'constant';
|
|
1502
|
-
}
|
|
1503
|
-
return undefined;
|
|
1504
|
-
}
|
|
1505
1824
|
function isSameValues(a, b) {
|
|
1506
1825
|
for (var i = 0; i < attributes.length; i++) {
|
|
1507
1826
|
var key = attributes[i];
|
|
@@ -1541,7 +1860,7 @@
|
|
|
1541
1860
|
parentReadyCallbacks[i]();
|
|
1542
1861
|
}
|
|
1543
1862
|
function addChild(parent, attribute) {
|
|
1544
|
-
var envVar =
|
|
1863
|
+
var envVar = environmentMap[attribute];
|
|
1545
1864
|
var p1 = globalThis.document.createElement('div');
|
|
1546
1865
|
var p2 = globalThis.document.createElement('div');
|
|
1547
1866
|
var c1 = globalThis.document.createElement('div');
|
|
@@ -1604,9 +1923,8 @@
|
|
|
1604
1923
|
}
|
|
1605
1924
|
function init() {
|
|
1606
1925
|
if (typeof support === 'undefined') {
|
|
1607
|
-
for (var i = 0; i < attributes.length; i++)
|
|
1926
|
+
for (var i = 0; i < attributes.length; i++)
|
|
1608
1927
|
elementComputedStyle[attributes[i]] = 0;
|
|
1609
|
-
}
|
|
1610
1928
|
return;
|
|
1611
1929
|
}
|
|
1612
1930
|
elementComputedStyle = {};
|
|
@@ -1650,8 +1968,28 @@
|
|
|
1650
1968
|
}
|
|
1651
1969
|
return result;
|
|
1652
1970
|
}
|
|
1971
|
+
function useCssVariable(prefix) {
|
|
1972
|
+
if (typeof support === 'undefined' || typeof globalThis.document === 'undefined')
|
|
1973
|
+
return noop;
|
|
1974
|
+
var element = globalThis.document.documentElement;
|
|
1975
|
+
function applyValues(values) {
|
|
1976
|
+
for (var i = 0; i < attributes.length; i++) {
|
|
1977
|
+
var attribute = attributes[i];
|
|
1978
|
+
element.style.setProperty('--' + prefix + '-' + String(attributes[i]), values[attribute] + 'px');
|
|
1979
|
+
}
|
|
1980
|
+
}
|
|
1981
|
+
var unsubscribe = onChangeSubscriptionManager.subscribe(function (values) {
|
|
1982
|
+
applyValues(values);
|
|
1983
|
+
});
|
|
1984
|
+
applyValues(readValues());
|
|
1985
|
+
return function () {
|
|
1986
|
+
unsubscribe();
|
|
1987
|
+
for (var i = 0; i < attributes.length; i++)
|
|
1988
|
+
element.style.removeProperty('--' + prefix + '-' + String(attributes[i]));
|
|
1989
|
+
};
|
|
1990
|
+
}
|
|
1653
1991
|
return {
|
|
1654
|
-
get
|
|
1992
|
+
get value() {
|
|
1655
1993
|
if (parentDiv !== null)
|
|
1656
1994
|
return readValues();
|
|
1657
1995
|
init();
|
|
@@ -1664,133 +2002,10 @@
|
|
|
1664
2002
|
if (typeof support === 'undefined')
|
|
1665
2003
|
return noop;
|
|
1666
2004
|
return onChangeSubscriptionManager.subscribe(callback, options);
|
|
1667
|
-
}
|
|
1668
|
-
};
|
|
1669
|
-
}
|
|
1670
|
-
|
|
1671
|
-
var safeAreaInsetObserver = createEnvObserver('safe-area-inset');
|
|
1672
|
-
var safeAreaMaxInsetObserver = createEnvObserver('safe-area-max-inset');
|
|
1673
|
-
var keyboardInsetObserver = createEnvObserver('keyboard-inset');
|
|
1674
|
-
var titlebarAreaObserver = createEnvObserver('titlebar-area');
|
|
1675
|
-
var viewportSegmentObserver = createEnvObserver('viewport-segment');
|
|
1676
|
-
var onChangeSubscriptionManager$4 = createSubscriptionManager(attachOnChange$4, detachOnChange$4);
|
|
1677
|
-
var dimensionRef = null;
|
|
1678
|
-
var Dimension = {
|
|
1679
|
-
get value() {
|
|
1680
|
-
return getDimension();
|
|
1681
|
-
},
|
|
1682
|
-
environment: getEnvironment(),
|
|
1683
|
-
onChange: onChangeSubscriptionManager$4.subscribe,
|
|
1684
|
-
Constants: {
|
|
1685
|
-
Orientation: Orientation,
|
|
1686
|
-
},
|
|
1687
|
-
Errors: {},
|
|
1688
|
-
};
|
|
1689
|
-
function getOrientation() {
|
|
1690
|
-
if (typeof globalThis.screen !== 'undefined') {
|
|
1691
|
-
switch (globalThis.screen.orientation.type) {
|
|
1692
|
-
case 'portrait-primary':
|
|
1693
|
-
case 'portrait-secondary':
|
|
1694
|
-
return Orientation.Portrait;
|
|
1695
|
-
case 'landscape-primary':
|
|
1696
|
-
case 'landscape-secondary':
|
|
1697
|
-
return Orientation.Landscape;
|
|
1698
|
-
}
|
|
1699
|
-
}
|
|
1700
|
-
if (typeof globalThis.orientation !== 'undefined') {
|
|
1701
|
-
switch (globalThis.orientation) {
|
|
1702
|
-
case 0:
|
|
1703
|
-
case 180:
|
|
1704
|
-
return Orientation.Portrait;
|
|
1705
|
-
case 90:
|
|
1706
|
-
case 270:
|
|
1707
|
-
return Orientation.Landscape;
|
|
1708
|
-
}
|
|
1709
|
-
}
|
|
1710
|
-
if (MEDIA_QUERY_LIST.media === 'not all')
|
|
1711
|
-
return Orientation.Unknown;
|
|
1712
|
-
else if (MEDIA_QUERY_LIST.matches)
|
|
1713
|
-
return Orientation.Portrait;
|
|
1714
|
-
else
|
|
1715
|
-
return Orientation.Landscape;
|
|
1716
|
-
}
|
|
1717
|
-
function getScale() {
|
|
1718
|
-
if (typeof globalThis.devicePixelRatio !== 'undefined')
|
|
1719
|
-
return globalThis.devicePixelRatio;
|
|
1720
|
-
return -1;
|
|
1721
|
-
}
|
|
1722
|
-
function getEnvironment() {
|
|
1723
|
-
return {
|
|
1724
|
-
safeAreaInset: {
|
|
1725
|
-
get value() {
|
|
1726
|
-
return safeAreaInsetObserver.get();
|
|
1727
|
-
},
|
|
1728
|
-
onChange: safeAreaInsetObserver.onChange,
|
|
1729
|
-
},
|
|
1730
|
-
safeAreaMaxInset: {
|
|
1731
|
-
get value() {
|
|
1732
|
-
return safeAreaMaxInsetObserver.get();
|
|
1733
|
-
},
|
|
1734
|
-
onChange: safeAreaMaxInsetObserver.onChange,
|
|
1735
|
-
},
|
|
1736
|
-
keyboardInset: {
|
|
1737
|
-
get value() {
|
|
1738
|
-
return keyboardInsetObserver.get();
|
|
1739
|
-
},
|
|
1740
|
-
onChange: keyboardInsetObserver.onChange,
|
|
1741
|
-
},
|
|
1742
|
-
titlebarArea: {
|
|
1743
|
-
get value() {
|
|
1744
|
-
return titlebarAreaObserver.get();
|
|
1745
|
-
},
|
|
1746
|
-
onChange: titlebarAreaObserver.onChange,
|
|
1747
|
-
},
|
|
1748
|
-
viewportSegment: {
|
|
1749
|
-
get value() {
|
|
1750
|
-
return viewportSegmentObserver.get();
|
|
1751
|
-
},
|
|
1752
|
-
onChange: viewportSegmentObserver.onChange,
|
|
1753
2005
|
},
|
|
2006
|
+
useCssVariable: useCssVariable
|
|
1754
2007
|
};
|
|
1755
2008
|
}
|
|
1756
|
-
function getDimension() {
|
|
1757
|
-
if (typeof globalThis.innerWidth !== 'undefined') {
|
|
1758
|
-
return {
|
|
1759
|
-
innerWidth: globalThis.innerWidth,
|
|
1760
|
-
innerHeight: globalThis.innerHeight,
|
|
1761
|
-
outerWidth: globalThis.outerWidth,
|
|
1762
|
-
outerHeight: globalThis.outerHeight,
|
|
1763
|
-
scale: getScale(),
|
|
1764
|
-
orientation: getOrientation(),
|
|
1765
|
-
};
|
|
1766
|
-
}
|
|
1767
|
-
return FALLBACK_DIMENSION;
|
|
1768
|
-
}
|
|
1769
|
-
function attachOnChange$4() {
|
|
1770
|
-
dimensionRef = getDimension();
|
|
1771
|
-
EventListener.add(globalThis, { type: 'resize', callback: onResize });
|
|
1772
|
-
if (typeof globalThis.screen.orientation.addEventListener === 'function')
|
|
1773
|
-
EventListener.add(globalThis.screen.orientation, { type: 'change', callback: onResize });
|
|
1774
|
-
else if (typeof globalThis.orientation !== 'undefined')
|
|
1775
|
-
EventListener.add(globalThis, { type: 'orientationChange', callback: onResize });
|
|
1776
|
-
else if (MEDIA_QUERY_LIST.media !== 'not all')
|
|
1777
|
-
EventListener.add(MEDIA_QUERY_LIST, { type: 'change', callback: onResize });
|
|
1778
|
-
}
|
|
1779
|
-
function detachOnChange$4() {
|
|
1780
|
-
dimensionRef = null;
|
|
1781
|
-
EventListener.remove(globalThis, { type: 'resize', callback: onResize });
|
|
1782
|
-
if (typeof globalThis.screen.orientation.removeEventListener === 'function')
|
|
1783
|
-
EventListener.remove(globalThis.screen.orientation, { type: 'change', callback: onResize });
|
|
1784
|
-
else if (typeof globalThis.orientation !== 'undefined')
|
|
1785
|
-
EventListener.remove(globalThis, { type: 'orientationChange', callback: onResize });
|
|
1786
|
-
else if (MEDIA_QUERY_LIST.media !== 'not all')
|
|
1787
|
-
EventListener.remove(MEDIA_QUERY_LIST, { type: 'change', callback: onResize });
|
|
1788
|
-
}
|
|
1789
|
-
function onResize() {
|
|
1790
|
-
var dimension = getDimension();
|
|
1791
|
-
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)
|
|
1792
|
-
onChangeSubscriptionManager$4.emit(dimensionRef = dimension);
|
|
1793
|
-
}
|
|
1794
2009
|
|
|
1795
2010
|
function createCustomError(name, Base) {
|
|
1796
2011
|
if (Base === void 0) { Base = Error; }
|
|
@@ -1874,8 +2089,248 @@
|
|
|
1874
2089
|
return CustomError;
|
|
1875
2090
|
}
|
|
1876
2091
|
|
|
2092
|
+
var PermissionNotGrantedError = createCustomError('PermissionNotGrantedError');
|
|
2093
|
+
|
|
1877
2094
|
var NotSupportedError = createCustomError('NotSupportedError');
|
|
1878
2095
|
|
|
2096
|
+
var safeAreaInsetObserver = createEnvironmentObserver('safe-area-inset');
|
|
2097
|
+
var safeAreaMaxInsetObserver = createEnvironmentObserver('safe-area-max-inset');
|
|
2098
|
+
var keyboardInsetObserver = createEnvironmentObserver('keyboard-inset');
|
|
2099
|
+
var titlebarAreaObserver = createEnvironmentObserver('titlebar-area');
|
|
2100
|
+
var viewportSegmentObserver = createEnvironmentObserver('viewport-segment');
|
|
2101
|
+
var onDimensionChangeSubscriptionManager = createSubscriptionManager(attachOnDimensionChange, detachOnDimensionChange);
|
|
2102
|
+
var onScreenOrientationChangeSubscriptionManager = createSubscriptionManager(attachOnScreenOrientationChange, detachOnScreenOrientationChange);
|
|
2103
|
+
var onDeviceOrientationChangeSubscriptionManager = createSubscriptionManager(attachOnDeviceOrientationChange, detachOnDeviceOrientationChange);
|
|
2104
|
+
var dimensionRef = null;
|
|
2105
|
+
var screenOrientationRef = null;
|
|
2106
|
+
var deviceOrientationRef = null;
|
|
2107
|
+
var Dimension = {
|
|
2108
|
+
get value() {
|
|
2109
|
+
return getDimension();
|
|
2110
|
+
},
|
|
2111
|
+
environment: getEnvironment(),
|
|
2112
|
+
screenOrientation: getScreenOrientation(),
|
|
2113
|
+
deviceOrientation: getDeviceOrientation(),
|
|
2114
|
+
onChange: onDimensionChangeSubscriptionManager.subscribe,
|
|
2115
|
+
Constants: {
|
|
2116
|
+
Orientation: Orientation,
|
|
2117
|
+
},
|
|
2118
|
+
Errors: {
|
|
2119
|
+
NotSupportedError: NotSupportedError,
|
|
2120
|
+
PermissionNotGrantedError: PermissionNotGrantedError,
|
|
2121
|
+
},
|
|
2122
|
+
};
|
|
2123
|
+
function getOrientation() {
|
|
2124
|
+
if (typeof globalThis.screen !== 'undefined' && typeof globalThis.screen.orientation !== 'undefined' && typeof globalThis.screen.orientation.type !== 'undefined') {
|
|
2125
|
+
switch (globalThis.screen.orientation.type) {
|
|
2126
|
+
case 'portrait-primary':
|
|
2127
|
+
return Orientation.PortraitPrimary;
|
|
2128
|
+
case 'portrait-secondary':
|
|
2129
|
+
return Orientation.PortraitSecondary;
|
|
2130
|
+
case 'landscape-primary':
|
|
2131
|
+
return Orientation.LandscapePrimary;
|
|
2132
|
+
case 'landscape-secondary':
|
|
2133
|
+
return Orientation.LandscapeSecondary;
|
|
2134
|
+
}
|
|
2135
|
+
}
|
|
2136
|
+
if (typeof globalThis.orientation !== 'undefined') {
|
|
2137
|
+
switch (globalThis.orientation) {
|
|
2138
|
+
case 0:
|
|
2139
|
+
return Orientation.PortraitPrimary;
|
|
2140
|
+
case 180:
|
|
2141
|
+
return Orientation.PortraitSecondary;
|
|
2142
|
+
case 90:
|
|
2143
|
+
return Orientation.LandscapePrimary;
|
|
2144
|
+
case -90:
|
|
2145
|
+
case 270:
|
|
2146
|
+
return Orientation.LandscapeSecondary;
|
|
2147
|
+
}
|
|
2148
|
+
}
|
|
2149
|
+
if (ORIENTATION_MEDIA_QUERY_LIST.media === 'not all')
|
|
2150
|
+
throw new NotSupportedError('\'screen.orientation\', \'window.orientation\', and the orientation media query are all unsupported');
|
|
2151
|
+
if (ORIENTATION_MEDIA_QUERY_LIST.matches)
|
|
2152
|
+
return Orientation.PortraitPrimary;
|
|
2153
|
+
else
|
|
2154
|
+
return Orientation.LandscapePrimary;
|
|
2155
|
+
}
|
|
2156
|
+
function getScale() {
|
|
2157
|
+
if (typeof globalThis.devicePixelRatio !== 'undefined')
|
|
2158
|
+
return globalThis.devicePixelRatio;
|
|
2159
|
+
return -1;
|
|
2160
|
+
}
|
|
2161
|
+
function getEnvironment() {
|
|
2162
|
+
return {
|
|
2163
|
+
safeAreaInset: safeAreaInsetObserver,
|
|
2164
|
+
safeAreaMaxInset: safeAreaMaxInsetObserver,
|
|
2165
|
+
keyboardInset: keyboardInsetObserver,
|
|
2166
|
+
titlebarArea: titlebarAreaObserver,
|
|
2167
|
+
viewportSegment: viewportSegmentObserver,
|
|
2168
|
+
};
|
|
2169
|
+
}
|
|
2170
|
+
function getScreenOrientation() {
|
|
2171
|
+
return {
|
|
2172
|
+
get supported() {
|
|
2173
|
+
return screenOrientationSupported();
|
|
2174
|
+
},
|
|
2175
|
+
get value() {
|
|
2176
|
+
return getOrientation();
|
|
2177
|
+
},
|
|
2178
|
+
onChange: onScreenOrientationChangeSubscriptionManager.subscribe,
|
|
2179
|
+
};
|
|
2180
|
+
}
|
|
2181
|
+
function getDeviceOrientation() {
|
|
2182
|
+
return {
|
|
2183
|
+
get supported() {
|
|
2184
|
+
return deviceOrientationSupported();
|
|
2185
|
+
},
|
|
2186
|
+
get value() {
|
|
2187
|
+
return getDeviceOrientationValue();
|
|
2188
|
+
},
|
|
2189
|
+
onChange: onDeviceOrientationChangeSubscriptionManager.subscribe,
|
|
2190
|
+
};
|
|
2191
|
+
}
|
|
2192
|
+
function getDimension() {
|
|
2193
|
+
var innerWidth = 0;
|
|
2194
|
+
var innerHeight = 0;
|
|
2195
|
+
var outerWidth = 0;
|
|
2196
|
+
var outerHeight = 0;
|
|
2197
|
+
var scale = getScale();
|
|
2198
|
+
if (typeof globalThis.innerWidth !== 'undefined') {
|
|
2199
|
+
innerWidth = globalThis.innerWidth;
|
|
2200
|
+
innerHeight = globalThis.innerHeight;
|
|
2201
|
+
outerWidth = globalThis.outerWidth;
|
|
2202
|
+
outerHeight = globalThis.outerHeight;
|
|
2203
|
+
}
|
|
2204
|
+
return {
|
|
2205
|
+
innerWidth: innerWidth,
|
|
2206
|
+
innerHeight: innerHeight,
|
|
2207
|
+
outerWidth: outerWidth,
|
|
2208
|
+
outerHeight: outerHeight,
|
|
2209
|
+
scale: scale,
|
|
2210
|
+
};
|
|
2211
|
+
}
|
|
2212
|
+
function attachOnDimensionChange() {
|
|
2213
|
+
dimensionRef = getDimension();
|
|
2214
|
+
EventListener.add(globalThis, { type: 'resize', callback: onDimensionChange });
|
|
2215
|
+
}
|
|
2216
|
+
function detachOnDimensionChange() {
|
|
2217
|
+
dimensionRef = null;
|
|
2218
|
+
EventListener.remove(globalThis, { type: 'resize', callback: onDimensionChange });
|
|
2219
|
+
}
|
|
2220
|
+
function onDimensionChange() {
|
|
2221
|
+
var dimension = getDimension();
|
|
2222
|
+
if (dimensionRef === null || dimension.innerWidth !== dimensionRef.innerWidth || dimension.innerHeight !== dimensionRef.innerHeight || dimension.outerWidth !== dimensionRef.outerWidth || dimension.outerHeight !== dimensionRef.outerHeight || dimension.scale !== dimensionRef.scale)
|
|
2223
|
+
onDimensionChangeSubscriptionManager.emit(dimensionRef = dimension);
|
|
2224
|
+
}
|
|
2225
|
+
function screenOrientationSupported() {
|
|
2226
|
+
if (typeof globalThis.screen !== 'undefined' && typeof globalThis.screen.orientation !== 'undefined' && typeof globalThis.screen.orientation.type !== 'undefined')
|
|
2227
|
+
return true;
|
|
2228
|
+
if (typeof globalThis.orientation !== 'undefined')
|
|
2229
|
+
return true;
|
|
2230
|
+
return ORIENTATION_MEDIA_QUERY_LIST.media !== 'not all';
|
|
2231
|
+
}
|
|
2232
|
+
function attachOnScreenOrientationChange() {
|
|
2233
|
+
if (typeof globalThis.screen !== 'undefined' && typeof globalThis.screen.orientation !== 'undefined' && typeof globalThis.screen.orientation.addEventListener === 'function')
|
|
2234
|
+
EventListener.add(globalThis.screen.orientation, {
|
|
2235
|
+
type: 'change',
|
|
2236
|
+
callback: onScreenOrientationChange
|
|
2237
|
+
});
|
|
2238
|
+
else if (typeof globalThis.orientation !== 'undefined')
|
|
2239
|
+
EventListener.add(globalThis, { type: 'orientationchange', callback: onScreenOrientationChange });
|
|
2240
|
+
else if (ORIENTATION_MEDIA_QUERY_LIST.media !== 'not all')
|
|
2241
|
+
EventListener.add(ORIENTATION_MEDIA_QUERY_LIST, { type: 'change', callback: onScreenOrientationChange });
|
|
2242
|
+
throw new NotSupportedError('\'screen.orientation\', \'window.orientation\', and the orientation media query are all unsupported');
|
|
2243
|
+
}
|
|
2244
|
+
function detachOnScreenOrientationChange() {
|
|
2245
|
+
if (typeof globalThis.screen !== 'undefined' && typeof globalThis.screen.orientation !== 'undefined' && typeof globalThis.screen.orientation.removeEventListener === 'function')
|
|
2246
|
+
EventListener.remove(globalThis.screen.orientation, {
|
|
2247
|
+
type: 'change',
|
|
2248
|
+
callback: onScreenOrientationChange
|
|
2249
|
+
});
|
|
2250
|
+
else if (typeof globalThis.orientation !== 'undefined')
|
|
2251
|
+
EventListener.remove(globalThis, { type: 'orientationchange', callback: onScreenOrientationChange });
|
|
2252
|
+
else if (ORIENTATION_MEDIA_QUERY_LIST.media !== 'not all')
|
|
2253
|
+
EventListener.remove(ORIENTATION_MEDIA_QUERY_LIST, { type: 'change', callback: onScreenOrientationChange });
|
|
2254
|
+
throw new NotSupportedError('\'screen.orientation\', \'window.orientation\', and the orientation media query are all unsupported');
|
|
2255
|
+
}
|
|
2256
|
+
function onScreenOrientationChange() {
|
|
2257
|
+
var orientation = getOrientation();
|
|
2258
|
+
if (screenOrientationRef === null || orientation !== screenOrientationRef)
|
|
2259
|
+
onScreenOrientationChangeSubscriptionManager.emit(screenOrientationRef = orientation);
|
|
2260
|
+
}
|
|
2261
|
+
function deviceOrientationSupported() {
|
|
2262
|
+
return typeof globalThis.DeviceOrientationEvent !== 'undefined';
|
|
2263
|
+
}
|
|
2264
|
+
function attachOnDeviceOrientationChange() {
|
|
2265
|
+
return new Promise(function (resolve, reject) {
|
|
2266
|
+
if (!deviceOrientationSupported())
|
|
2267
|
+
return reject(new NotSupportedError('\'window.DeviceOrientationEvent\' does not supported.'));
|
|
2268
|
+
var DeviceOrientationEventWithPermission = DeviceOrientationEvent;
|
|
2269
|
+
if (typeof DeviceOrientationEventWithPermission.requestPermission === 'function') {
|
|
2270
|
+
DeviceOrientationEventWithPermission.requestPermission().then(function (permission) {
|
|
2271
|
+
if (permission === 'granted') {
|
|
2272
|
+
EventListener.add(globalThis, { type: 'deviceorientation', callback: onDeviceOrientationChange });
|
|
2273
|
+
return resolve();
|
|
2274
|
+
}
|
|
2275
|
+
return reject(new PermissionNotGrantedError('\'deviceorientation\' permission is not granted.'));
|
|
2276
|
+
}).catch(function (_) {
|
|
2277
|
+
return reject(new NotSupportedError('\'window.DeviceOrientationEvent\' does not supported.'));
|
|
2278
|
+
});
|
|
2279
|
+
}
|
|
2280
|
+
else {
|
|
2281
|
+
EventListener.add(globalThis, { type: 'deviceorientation', callback: onDeviceOrientationChange });
|
|
2282
|
+
return resolve();
|
|
2283
|
+
}
|
|
2284
|
+
});
|
|
2285
|
+
}
|
|
2286
|
+
function detachOnDeviceOrientationChange() {
|
|
2287
|
+
EventListener.remove(globalThis, { type: 'deviceorientation', callback: onDeviceOrientationChange });
|
|
2288
|
+
}
|
|
2289
|
+
function onDeviceOrientationChange(event) {
|
|
2290
|
+
deviceOrientationRef = {
|
|
2291
|
+
alpha: event.alpha,
|
|
2292
|
+
beta: event.beta,
|
|
2293
|
+
gamma: event.gamma,
|
|
2294
|
+
absolute: event.absolute,
|
|
2295
|
+
};
|
|
2296
|
+
onDeviceOrientationChangeSubscriptionManager.emit(deviceOrientationRef);
|
|
2297
|
+
}
|
|
2298
|
+
function getDeviceOrientationValue() {
|
|
2299
|
+
return new Promise(function (resolve, reject) {
|
|
2300
|
+
if (deviceOrientationRef !== null)
|
|
2301
|
+
return resolve(deviceOrientationRef);
|
|
2302
|
+
if (!deviceOrientationSupported())
|
|
2303
|
+
return reject(new NotSupportedError('\'window.DeviceOrientationEvent\' does not supported.'));
|
|
2304
|
+
var DeviceOrientationEventWithPermission = DeviceOrientationEvent;
|
|
2305
|
+
var callback = function (event) {
|
|
2306
|
+
var value = {
|
|
2307
|
+
alpha: event.alpha,
|
|
2308
|
+
beta: event.beta,
|
|
2309
|
+
gamma: event.gamma,
|
|
2310
|
+
absolute: event.absolute,
|
|
2311
|
+
};
|
|
2312
|
+
deviceOrientationRef = value;
|
|
2313
|
+
EventListener.remove(globalThis, { type: 'deviceorientation', callback: callback });
|
|
2314
|
+
return resolve(value);
|
|
2315
|
+
};
|
|
2316
|
+
if (typeof DeviceOrientationEventWithPermission.requestPermission === 'function') {
|
|
2317
|
+
DeviceOrientationEventWithPermission.requestPermission().then(function (permission) {
|
|
2318
|
+
if (permission === 'granted') {
|
|
2319
|
+
EventListener.add(globalThis, { type: 'deviceorientation', callback: callback });
|
|
2320
|
+
return;
|
|
2321
|
+
}
|
|
2322
|
+
return reject(new PermissionNotGrantedError('\'deviceorientation\' permission is not granted.'));
|
|
2323
|
+
}).catch(function (_) {
|
|
2324
|
+
return reject(new NotSupportedError('\'window.DeviceOrientationEvent\' does not supported.'));
|
|
2325
|
+
});
|
|
2326
|
+
}
|
|
2327
|
+
else {
|
|
2328
|
+
EventListener.add(globalThis, { type: 'deviceorientation', callback: callback });
|
|
2329
|
+
return;
|
|
2330
|
+
}
|
|
2331
|
+
});
|
|
2332
|
+
}
|
|
2333
|
+
|
|
1879
2334
|
var InvalidStateError = createCustomError('InvalidStateError');
|
|
1880
2335
|
|
|
1881
2336
|
var videoElement$1 = null;
|
|
@@ -2280,6 +2735,8 @@
|
|
|
2280
2735
|
PermissionType["ClipboardRead"] = "clipboard-read";
|
|
2281
2736
|
PermissionType["Microphone"] = "microphone";
|
|
2282
2737
|
PermissionType["MIDI"] = "midi";
|
|
2738
|
+
PermissionType["DeviceOrientation"] = "device-orientation";
|
|
2739
|
+
PermissionType["DeviceMotion"] = "device-motion";
|
|
2283
2740
|
})(PermissionType || (PermissionType = {}));
|
|
2284
2741
|
var PermissionState;
|
|
2285
2742
|
(function (PermissionState) {
|
|
@@ -2321,14 +2778,45 @@
|
|
|
2321
2778
|
PermissionType: PermissionType,
|
|
2322
2779
|
PermissionState: PermissionState,
|
|
2323
2780
|
},
|
|
2324
|
-
Errors: {
|
|
2781
|
+
Errors: {
|
|
2782
|
+
NotSupportedError: NotSupportedError,
|
|
2783
|
+
},
|
|
2325
2784
|
};
|
|
2785
|
+
function toPermissionState(permission) {
|
|
2786
|
+
switch (permission) {
|
|
2787
|
+
case 'granted':
|
|
2788
|
+
return PermissionState.Grant;
|
|
2789
|
+
case 'denied':
|
|
2790
|
+
return PermissionState.Denied;
|
|
2791
|
+
case 'prompt':
|
|
2792
|
+
case 'default':
|
|
2793
|
+
return PermissionState.Prompt;
|
|
2794
|
+
default:
|
|
2795
|
+
return PermissionState.Unsupported;
|
|
2796
|
+
}
|
|
2797
|
+
}
|
|
2798
|
+
function toSafariSensorEventMap(type) {
|
|
2799
|
+
switch (type) {
|
|
2800
|
+
case PermissionType.DeviceOrientation:
|
|
2801
|
+
return {
|
|
2802
|
+
event: globalThis.DeviceOrientationEvent,
|
|
2803
|
+
type: 'deviceorientation',
|
|
2804
|
+
};
|
|
2805
|
+
case PermissionType.DeviceMotion:
|
|
2806
|
+
return {
|
|
2807
|
+
event: globalThis.DeviceMotionEvent,
|
|
2808
|
+
type: 'devicemotion',
|
|
2809
|
+
};
|
|
2810
|
+
default:
|
|
2811
|
+
return undefined;
|
|
2812
|
+
}
|
|
2813
|
+
}
|
|
2326
2814
|
function supported$5() {
|
|
2327
2815
|
return typeof globalThis.navigator.permissions !== 'undefined';
|
|
2328
2816
|
}
|
|
2329
2817
|
function request$2(type) {
|
|
2330
2818
|
var instance = this;
|
|
2331
|
-
return new Promise(function (resolve) {
|
|
2819
|
+
return new Promise(function (resolve, reject) {
|
|
2332
2820
|
function resolveAfterCheck() {
|
|
2333
2821
|
instance.check(type).then(resolve);
|
|
2334
2822
|
}
|
|
@@ -2340,17 +2828,8 @@
|
|
|
2340
2828
|
case PermissionType.Notification:
|
|
2341
2829
|
if (typeof globalThis.Notification === 'undefined')
|
|
2342
2830
|
return resolve(PermissionState.Unsupported);
|
|
2343
|
-
globalThis.Notification.requestPermission().then(function (
|
|
2344
|
-
|
|
2345
|
-
case 'default':
|
|
2346
|
-
return resolve(PermissionState.Prompt);
|
|
2347
|
-
case 'granted':
|
|
2348
|
-
return resolve(PermissionState.Grant);
|
|
2349
|
-
case 'denied':
|
|
2350
|
-
return resolve(PermissionState.Denied);
|
|
2351
|
-
default:
|
|
2352
|
-
resolveAfterCheck();
|
|
2353
|
-
}
|
|
2831
|
+
globalThis.Notification.requestPermission().then(function (permission) {
|
|
2832
|
+
resolve(toPermissionState(permission));
|
|
2354
2833
|
});
|
|
2355
2834
|
break;
|
|
2356
2835
|
case PermissionType.Geolocation:
|
|
@@ -2388,6 +2867,23 @@
|
|
|
2388
2867
|
.then(resolveAfterCheck)
|
|
2389
2868
|
.catch(resolveAfterCheck);
|
|
2390
2869
|
break;
|
|
2870
|
+
case PermissionType.DeviceOrientation:
|
|
2871
|
+
case PermissionType.DeviceMotion:
|
|
2872
|
+
var sensorEventMap = toSafariSensorEventMap(type);
|
|
2873
|
+
if (typeof sensorEventMap === 'undefined' || typeof sensorEventMap.event === 'undefined')
|
|
2874
|
+
return resolve(PermissionState.Unsupported);
|
|
2875
|
+
if (typeof sensorEventMap.event.requestPermission !== 'function')
|
|
2876
|
+
return resolve(PermissionState.Grant);
|
|
2877
|
+
try {
|
|
2878
|
+
sensorEventMap.event.requestPermission()
|
|
2879
|
+
.then(function (permission) {
|
|
2880
|
+
resolve(toPermissionState(permission));
|
|
2881
|
+
});
|
|
2882
|
+
}
|
|
2883
|
+
catch (_) {
|
|
2884
|
+
return reject(new NotSupportedError('\'DeviceOrientationEvent.requestPermission()\' must be called within a user gesture context.'));
|
|
2885
|
+
}
|
|
2886
|
+
break;
|
|
2391
2887
|
default:
|
|
2392
2888
|
return resolve(PermissionState.Unsupported);
|
|
2393
2889
|
}
|
|
@@ -2395,6 +2891,34 @@
|
|
|
2395
2891
|
});
|
|
2396
2892
|
}
|
|
2397
2893
|
function check(type) {
|
|
2894
|
+
if (type === PermissionType.DeviceOrientation || type === PermissionType.DeviceMotion) {
|
|
2895
|
+
return new Promise(function (resolve) {
|
|
2896
|
+
var sensorEventMap = toSafariSensorEventMap(type);
|
|
2897
|
+
if (typeof sensorEventMap === 'undefined' || typeof sensorEventMap.event === 'undefined')
|
|
2898
|
+
return resolve(PermissionState.Unsupported);
|
|
2899
|
+
if (typeof sensorEventMap.event.requestPermission !== 'function')
|
|
2900
|
+
return resolve(PermissionState.Grant);
|
|
2901
|
+
var granted = false;
|
|
2902
|
+
EventListener.add(globalThis, {
|
|
2903
|
+
type: sensorEventMap.type,
|
|
2904
|
+
callback: function () {
|
|
2905
|
+
granted = true;
|
|
2906
|
+
},
|
|
2907
|
+
options: { once: true }
|
|
2908
|
+
});
|
|
2909
|
+
setTimeout(function () {
|
|
2910
|
+
if (granted)
|
|
2911
|
+
return resolve(PermissionState.Grant);
|
|
2912
|
+
sensorEventMap.event.requestPermission()
|
|
2913
|
+
.then(function (permission) {
|
|
2914
|
+
resolve(toPermissionState(permission));
|
|
2915
|
+
})
|
|
2916
|
+
.catch(function () {
|
|
2917
|
+
resolve(PermissionState.Prompt);
|
|
2918
|
+
});
|
|
2919
|
+
}, 50);
|
|
2920
|
+
});
|
|
2921
|
+
}
|
|
2398
2922
|
return new Promise(function (resolve) {
|
|
2399
2923
|
if (typeof globalThis.navigator.permissions === 'undefined')
|
|
2400
2924
|
return resolve(PermissionState.Unsupported);
|
|
@@ -2414,8 +2938,6 @@
|
|
|
2414
2938
|
});
|
|
2415
2939
|
}
|
|
2416
2940
|
|
|
2417
|
-
var PermissionNotGrantedError = createCustomError('PermissionNotGrantedError');
|
|
2418
|
-
|
|
2419
2941
|
function request$1(url, options) {
|
|
2420
2942
|
return new Promise(function (resolve) {
|
|
2421
2943
|
var method = 'GET';
|
|
@@ -2718,7 +3240,7 @@
|
|
|
2718
3240
|
}
|
|
2719
3241
|
|
|
2720
3242
|
function dispatchClickEvent(element, view) {
|
|
2721
|
-
if (view === void 0) { view =
|
|
3243
|
+
if (view === void 0) { view = globalThis; }
|
|
2722
3244
|
var fake;
|
|
2723
3245
|
try {
|
|
2724
3246
|
fake = new MouseEvent('click', {
|