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