native-fn 1.3.0 → 1.3.2
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 +159 -41
- package/dist/index.d.ts +117 -88
- package/dist/native.cjs +464 -244
- package/dist/native.min.cjs +1 -1
- package/dist/native.min.mjs +1 -1
- package/dist/native.mjs +464 -244
- package/dist/native.umd.js +464 -244
- package/dist/native.umd.min.js +1 -1
- package/dist/plugin/appearance/index.cjs +49 -46
- package/dist/plugin/appearance/index.d.ts +3 -3
- package/dist/plugin/appearance/index.mjs +49 -46
- 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 +8 -3
- package/dist/plugin/appearance/src/plugin/dimension/types/dimensions.d.ts +37 -15
- 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/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/badge/index.d.ts +3 -3
- 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 +8 -3
- package/dist/plugin/badge/src/plugin/dimension/types/dimensions.d.ts +37 -15
- 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/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/battery/index.d.ts +3 -3
- 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 +8 -3
- package/dist/plugin/battery/src/plugin/dimension/types/dimensions.d.ts +37 -15
- 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/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/clipboard/index.d.ts +2 -2
- 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 +8 -3
- package/dist/plugin/clipboard/src/plugin/dimension/types/dimensions.d.ts +37 -15
- 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/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/dimension/index.cjs +310 -80
- package/dist/plugin/dimension/index.d.ts +48 -19
- package/dist/plugin/dimension/index.mjs +310 -80
- 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 +8 -3
- package/dist/plugin/dimension/src/plugin/dimension/types/dimensions.d.ts +37 -15
- 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/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/fullscreen/index.cjs +87 -80
- package/dist/plugin/fullscreen/index.d.ts +7 -7
- package/dist/plugin/fullscreen/index.mjs +87 -80
- 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 +8 -3
- package/dist/plugin/fullscreen/src/plugin/dimension/types/dimensions.d.ts +37 -15
- 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/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/geolocation/index.cjs +245 -176
- package/dist/plugin/geolocation/index.d.ts +4 -4
- package/dist/plugin/geolocation/index.mjs +245 -176
- 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 +8 -3
- package/dist/plugin/geolocation/src/plugin/dimension/types/dimensions.d.ts +37 -15
- 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/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/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/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 +8 -3
- package/dist/plugin/notification/src/plugin/dimension/types/dimensions.d.ts +37 -15
- 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/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/open/index.cjs +58 -49
- package/dist/plugin/open/index.d.ts +12 -12
- package/dist/plugin/open/index.mjs +58 -49
- 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 +8 -3
- package/dist/plugin/open/src/plugin/dimension/types/dimensions.d.ts +37 -15
- 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/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/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/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 +8 -3
- package/dist/plugin/permission/src/plugin/dimension/types/dimensions.d.ts +37 -15
- 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/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/pip/index.cjs +49 -46
- package/dist/plugin/pip/index.d.ts +7 -7
- package/dist/plugin/pip/index.mjs +49 -46
- 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 +8 -3
- package/dist/plugin/pip/src/plugin/dimension/types/dimensions.d.ts +37 -15
- 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/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/platform/index.cjs +87 -80
- package/dist/plugin/platform/index.d.ts +13 -13
- package/dist/plugin/platform/index.mjs +87 -80
- 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 +8 -3
- package/dist/plugin/platform/src/plugin/dimension/types/dimensions.d.ts +37 -15
- 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/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/theme/index.cjs +58 -49
- package/dist/plugin/theme/index.d.ts +2 -2
- package/dist/plugin/theme/index.mjs +58 -49
- 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 +8 -3
- package/dist/plugin/theme/src/plugin/dimension/types/dimensions.d.ts +37 -15
- 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/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/vibration/index.d.ts +3 -3
- 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 +8 -3
- package/dist/plugin/vibration/src/plugin/dimension/types/dimensions.d.ts +37 -15
- 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/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/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 +8 -3
- package/dist/src/plugin/dimension/types/dimensions.d.ts +37 -15
- 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/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/package.json +1 -1
|
@@ -21,9 +21,20 @@ var FALLBACK_MEDIA_QUERY_LIST = {
|
|
|
21
21
|
|
|
22
22
|
exports.Orientation = void 0;
|
|
23
23
|
(function (Orientation) {
|
|
24
|
-
Orientation["
|
|
25
|
-
Orientation["
|
|
26
|
-
Orientation["
|
|
24
|
+
Orientation["PortraitPrimary"] = "portrait-primary";
|
|
25
|
+
Orientation["PortraitSecondary"] = "portrait-secondary";
|
|
26
|
+
Orientation["LandscapePrimary"] = "landscape-primary";
|
|
27
|
+
Orientation["LandscapeSecondary"] = "landscape-secondary";
|
|
28
|
+
})(exports.Orientation || (exports.Orientation = {}));
|
|
29
|
+
(function (Orientation) {
|
|
30
|
+
function isLandscape(orientation) {
|
|
31
|
+
return orientation === Orientation.LandscapePrimary || orientation === Orientation.LandscapeSecondary;
|
|
32
|
+
}
|
|
33
|
+
Orientation.isLandscape = isLandscape;
|
|
34
|
+
function isPortrait(orientation) {
|
|
35
|
+
return orientation === Orientation.PortraitPrimary || orientation === Orientation.PortraitSecondary;
|
|
36
|
+
}
|
|
37
|
+
Orientation.isPortrait = isPortrait;
|
|
27
38
|
})(exports.Orientation || (exports.Orientation = {}));
|
|
28
39
|
var ENV_PRESETS = {
|
|
29
40
|
'safe-area-inset': {
|
|
@@ -475,7 +486,6 @@ function createViewportSegmentObserver() {
|
|
|
475
486
|
var segmentMediaQueryLists = [];
|
|
476
487
|
var previousSegments = null;
|
|
477
488
|
function attachCSSFallbackListeners() {
|
|
478
|
-
EventListener.add(globalThis, { type: 'resize', callback: onSegmentChange });
|
|
479
489
|
segmentMediaQueryLists = buildSegmentMediaQueryLists();
|
|
480
490
|
for (var i = 0; i < segmentMediaQueryLists.length; i++)
|
|
481
491
|
EventListener.add(segmentMediaQueryLists[i], { type: 'change', callback: onSegmentChange });
|
|
@@ -483,50 +493,53 @@ function createViewportSegmentObserver() {
|
|
|
483
493
|
EventListener.add(exports.DEVICE_POSTURE_MEDIA_QUERY_LIST, { type: 'change', callback: onSegmentChange });
|
|
484
494
|
}
|
|
485
495
|
function detachCSSFallbackListeners() {
|
|
486
|
-
EventListener.remove(globalThis, { type: 'resize', callback: onSegmentChange });
|
|
487
496
|
for (var i = 0; i < segmentMediaQueryLists.length; i++)
|
|
488
497
|
EventListener.remove(segmentMediaQueryLists[i], { type: 'change', callback: onSegmentChange });
|
|
489
498
|
segmentMediaQueryLists = [];
|
|
490
499
|
if (exports.DEVICE_POSTURE_MEDIA_QUERY_LIST.media !== 'not all')
|
|
491
500
|
EventListener.remove(exports.DEVICE_POSTURE_MEDIA_QUERY_LIST, { type: 'change', callback: onSegmentChange });
|
|
492
501
|
}
|
|
502
|
+
function attachDevicePostureChangeListener() {
|
|
503
|
+
if (hasDevicePosture)
|
|
504
|
+
EventListener.add(devicePosture, { type: 'change', callback: onSegmentChange });
|
|
505
|
+
attachCSSFallbackListeners();
|
|
506
|
+
}
|
|
507
|
+
function detachDevicePostureChangeListener() {
|
|
508
|
+
if (hasDevicePosture)
|
|
509
|
+
EventListener.remove(devicePosture, { type: 'change', callback: onSegmentChange });
|
|
510
|
+
detachCSSFallbackListeners();
|
|
511
|
+
}
|
|
512
|
+
function attachVisualViewportResizeListener() {
|
|
513
|
+
EventListener.add(visualViewport, { type: 'resize', callback: onSegmentChange, options: { passive: true } });
|
|
514
|
+
}
|
|
515
|
+
function detachVisualViewportResizeListener() {
|
|
516
|
+
EventListener.remove(visualViewport, { type: 'resize', callback: onSegmentChange, options: { passive: true } });
|
|
517
|
+
}
|
|
493
518
|
function attachOnChange() {
|
|
519
|
+
EventListener.add(globalThis, { type: 'resize', callback: onSegmentChange });
|
|
494
520
|
if (hasSegmentsAPI) {
|
|
495
|
-
|
|
496
|
-
EventListener.add(devicePosture, { type: 'change', callback: onSegmentChange });
|
|
497
|
-
EventListener.add(globalThis, { type: 'resize', callback: onSegmentChange });
|
|
498
|
-
}
|
|
499
|
-
else {
|
|
500
|
-
attachCSSFallbackListeners();
|
|
501
|
-
}
|
|
521
|
+
attachDevicePostureChangeListener();
|
|
502
522
|
}
|
|
503
523
|
else if (hasLegacySegmentsAPI) {
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
EventListener.add(devicePosture, { type: 'change', callback: onSegmentChange });
|
|
524
|
+
attachVisualViewportResizeListener();
|
|
525
|
+
attachDevicePostureChangeListener();
|
|
507
526
|
}
|
|
508
527
|
else {
|
|
509
528
|
getOrCreateCachedDiv();
|
|
510
|
-
|
|
529
|
+
attachVisualViewportResizeListener();
|
|
511
530
|
}
|
|
512
531
|
}
|
|
513
532
|
function detachOnChange() {
|
|
533
|
+
EventListener.remove(globalThis, { type: 'resize', callback: onSegmentChange });
|
|
514
534
|
if (hasSegmentsAPI) {
|
|
515
|
-
|
|
516
|
-
EventListener.remove(devicePosture, { type: 'change', callback: onSegmentChange });
|
|
517
|
-
EventListener.remove(globalThis, { type: 'resize', callback: onSegmentChange });
|
|
518
|
-
}
|
|
519
|
-
else {
|
|
520
|
-
detachCSSFallbackListeners();
|
|
521
|
-
}
|
|
535
|
+
detachDevicePostureChangeListener();
|
|
522
536
|
}
|
|
523
537
|
else if (hasLegacySegmentsAPI) {
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
EventListener.remove(devicePosture, { type: 'change', callback: onSegmentChange });
|
|
538
|
+
detachVisualViewportResizeListener();
|
|
539
|
+
detachDevicePostureChangeListener();
|
|
527
540
|
}
|
|
528
541
|
else {
|
|
529
|
-
|
|
542
|
+
detachVisualViewportResizeListener();
|
|
530
543
|
releaseDiv();
|
|
531
544
|
}
|
|
532
545
|
}
|
|
@@ -678,7 +691,7 @@ function createViewportSegmentObserver() {
|
|
|
678
691
|
function applySegments(segments) {
|
|
679
692
|
for (var i = segments.length; i < lastCount; i++) {
|
|
680
693
|
for (var j = 0; j < attributes.length; j++) {
|
|
681
|
-
element.style.removeProperty(
|
|
694
|
+
element.style.removeProperty('--' + prefix + '-' + i + '-' + attributes[j]);
|
|
682
695
|
}
|
|
683
696
|
}
|
|
684
697
|
lastCount = segments.length;
|
|
@@ -686,7 +699,7 @@ function createViewportSegmentObserver() {
|
|
|
686
699
|
var segment = segments[i];
|
|
687
700
|
for (var j = 0; j < attributes.length; j++) {
|
|
688
701
|
var attribute = attributes[j];
|
|
689
|
-
element.style.setProperty(
|
|
702
|
+
element.style.setProperty('--' + prefix + '-' + i + '-' + attribute, segment[attribute] + 'px');
|
|
690
703
|
}
|
|
691
704
|
}
|
|
692
705
|
}
|
|
@@ -698,7 +711,7 @@ function createViewportSegmentObserver() {
|
|
|
698
711
|
unsubscribe();
|
|
699
712
|
for (var i = 0; i < lastCount; i++)
|
|
700
713
|
for (var j = 0; j < attributes.length; j++)
|
|
701
|
-
element.style.removeProperty(
|
|
714
|
+
element.style.removeProperty('--' + prefix + '-' + i + '-' + attributes[j]);
|
|
702
715
|
lastCount = 0;
|
|
703
716
|
};
|
|
704
717
|
}
|
|
@@ -712,15 +725,11 @@ function createViewportSegmentObserver() {
|
|
|
712
725
|
}
|
|
713
726
|
function createVirtualKeyboardObserver() {
|
|
714
727
|
var onChangeSubscriptionManager = createSubscriptionManager(attachOnChange, detachOnChange);
|
|
715
|
-
var previousOverlaysContent = false;
|
|
716
728
|
function attachOnChange() {
|
|
717
|
-
previousOverlaysContent = globalThis.navigator.virtualKeyboard.overlaysContent;
|
|
718
|
-
globalThis.navigator.virtualKeyboard.overlaysContent = true;
|
|
719
729
|
EventListener.add(globalThis.navigator.virtualKeyboard, { type: 'geometrychange', callback: onGeometryChange, options: { passive: true } });
|
|
720
730
|
}
|
|
721
731
|
function detachOnChange() {
|
|
722
732
|
EventListener.remove(globalThis.navigator.virtualKeyboard, { type: 'geometrychange', callback: onGeometryChange, options: { passive: true } });
|
|
723
|
-
globalThis.navigator.virtualKeyboard.overlaysContent = previousOverlaysContent;
|
|
724
733
|
}
|
|
725
734
|
function onGeometryChange() {
|
|
726
735
|
onChangeSubscriptionManager.emit(getValue());
|
|
@@ -758,7 +767,7 @@ function createVirtualKeyboardObserver() {
|
|
|
758
767
|
function applyValues(values) {
|
|
759
768
|
for (var i = 0; i < attributes.length; i++) {
|
|
760
769
|
var attribute = attributes[i];
|
|
761
|
-
element.style.setProperty(
|
|
770
|
+
element.style.setProperty('--' + prefix + '-' + attribute, values[attribute] + 'px');
|
|
762
771
|
}
|
|
763
772
|
}
|
|
764
773
|
applyValues(getValue());
|
|
@@ -768,7 +777,7 @@ function createVirtualKeyboardObserver() {
|
|
|
768
777
|
return function () {
|
|
769
778
|
unsubscribe();
|
|
770
779
|
for (var i = 0; i < attributes.length; i++)
|
|
771
|
-
element.style.removeProperty(
|
|
780
|
+
element.style.removeProperty('--' + prefix + '-' + attributes[i]);
|
|
772
781
|
};
|
|
773
782
|
}
|
|
774
783
|
return {
|
|
@@ -957,7 +966,7 @@ function createEnvironmentObserver(preset) {
|
|
|
957
966
|
function applyValues(values) {
|
|
958
967
|
for (var i = 0; i < attributes.length; i++) {
|
|
959
968
|
var attribute = attributes[i];
|
|
960
|
-
element.style.setProperty(
|
|
969
|
+
element.style.setProperty('--' + prefix + '-' + String(attributes[i]), values[attribute] + 'px');
|
|
961
970
|
}
|
|
962
971
|
}
|
|
963
972
|
var unsubscribe = onChangeSubscriptionManager.subscribe(function (values) {
|
|
@@ -967,7 +976,7 @@ function createEnvironmentObserver(preset) {
|
|
|
967
976
|
return function () {
|
|
968
977
|
unsubscribe();
|
|
969
978
|
for (var i = 0; i < attributes.length; i++)
|
|
970
|
-
element.style.removeProperty(
|
|
979
|
+
element.style.removeProperty('--' + prefix + '-' + String(attributes[i]));
|
|
971
980
|
};
|
|
972
981
|
}
|
|
973
982
|
return {
|
|
@@ -989,51 +998,151 @@ function createEnvironmentObserver(preset) {
|
|
|
989
998
|
};
|
|
990
999
|
}
|
|
991
1000
|
|
|
1001
|
+
function createCustomError(name, Base) {
|
|
1002
|
+
if (Base === void 0) { Base = Error; }
|
|
1003
|
+
function CustomError(message) {
|
|
1004
|
+
if (!(this instanceof CustomError))
|
|
1005
|
+
return new CustomError(message);
|
|
1006
|
+
var error = (function () {
|
|
1007
|
+
if (typeof message === 'undefined')
|
|
1008
|
+
return new Base('');
|
|
1009
|
+
return new Base(message);
|
|
1010
|
+
})();
|
|
1011
|
+
if (typeof Object.setPrototypeOf === 'function')
|
|
1012
|
+
Object.setPrototypeOf(error, CustomError.prototype);
|
|
1013
|
+
else
|
|
1014
|
+
error.__proto__ = CustomError.prototype;
|
|
1015
|
+
error.name = name;
|
|
1016
|
+
if (typeof message !== 'undefined')
|
|
1017
|
+
error.message = message;
|
|
1018
|
+
if (typeof Symbol !== 'undefined' && Symbol.toStringTag) {
|
|
1019
|
+
try {
|
|
1020
|
+
Object.defineProperty(error, Symbol.toStringTag, {
|
|
1021
|
+
value: name,
|
|
1022
|
+
writable: false,
|
|
1023
|
+
enumerable: false,
|
|
1024
|
+
configurable: true
|
|
1025
|
+
});
|
|
1026
|
+
}
|
|
1027
|
+
catch (_) {
|
|
1028
|
+
}
|
|
1029
|
+
}
|
|
1030
|
+
if (typeof Error.captureStackTrace === 'function') {
|
|
1031
|
+
Error.captureStackTrace(error, CustomError);
|
|
1032
|
+
}
|
|
1033
|
+
else if (Base.captureStackTrace && typeof Base.captureStackTrace === 'function') {
|
|
1034
|
+
Base.captureStackTrace(error, CustomError);
|
|
1035
|
+
}
|
|
1036
|
+
else {
|
|
1037
|
+
try {
|
|
1038
|
+
var tempError = new Base();
|
|
1039
|
+
if (tempError.stack)
|
|
1040
|
+
error.stack = tempError.stack;
|
|
1041
|
+
}
|
|
1042
|
+
catch (_) {
|
|
1043
|
+
}
|
|
1044
|
+
}
|
|
1045
|
+
return error;
|
|
1046
|
+
}
|
|
1047
|
+
CustomError.prototype = Object.create(Base.prototype, {
|
|
1048
|
+
constructor: {
|
|
1049
|
+
value: CustomError,
|
|
1050
|
+
writable: true,
|
|
1051
|
+
enumerable: false,
|
|
1052
|
+
configurable: true
|
|
1053
|
+
}
|
|
1054
|
+
});
|
|
1055
|
+
try {
|
|
1056
|
+
Object.defineProperty(CustomError.prototype, 'name', {
|
|
1057
|
+
value: name,
|
|
1058
|
+
writable: true,
|
|
1059
|
+
enumerable: false,
|
|
1060
|
+
configurable: true
|
|
1061
|
+
});
|
|
1062
|
+
}
|
|
1063
|
+
catch (_) {
|
|
1064
|
+
try {
|
|
1065
|
+
CustomError.prototype.name = name;
|
|
1066
|
+
}
|
|
1067
|
+
catch (_) {
|
|
1068
|
+
}
|
|
1069
|
+
}
|
|
1070
|
+
try {
|
|
1071
|
+
Object.defineProperty(CustomError, 'name', {
|
|
1072
|
+
value: name,
|
|
1073
|
+
writable: false,
|
|
1074
|
+
enumerable: false,
|
|
1075
|
+
configurable: true
|
|
1076
|
+
});
|
|
1077
|
+
}
|
|
1078
|
+
catch (_) {
|
|
1079
|
+
}
|
|
1080
|
+
return CustomError;
|
|
1081
|
+
}
|
|
1082
|
+
|
|
1083
|
+
var PermissionNotGrantedError = createCustomError('PermissionNotGrantedError');
|
|
1084
|
+
|
|
1085
|
+
var NotSupportedError = createCustomError('NotSupportedError');
|
|
1086
|
+
|
|
992
1087
|
var safeAreaInsetObserver = createEnvironmentObserver('safe-area-inset');
|
|
993
1088
|
var safeAreaMaxInsetObserver = createEnvironmentObserver('safe-area-max-inset');
|
|
994
1089
|
var keyboardInsetObserver = createEnvironmentObserver('keyboard-inset');
|
|
995
1090
|
var titlebarAreaObserver = createEnvironmentObserver('titlebar-area');
|
|
996
1091
|
var viewportSegmentObserver = createEnvironmentObserver('viewport-segment');
|
|
997
|
-
var
|
|
1092
|
+
var onDimensionChangeSubscriptionManager = createSubscriptionManager(attachOnDimensionChange, detachOnDimensionChange);
|
|
1093
|
+
var onScreenOrientationChangeSubscriptionManager = createSubscriptionManager(attachOnScreenOrientationChange, detachOnScreenOrientationChange);
|
|
1094
|
+
var onDeviceOrientationChangeSubscriptionManager = createSubscriptionManager(attachOnDeviceOrientationChange, detachOnDeviceOrientationChange);
|
|
998
1095
|
var dimensionRef = null;
|
|
1096
|
+
var screenOrientationRef = null;
|
|
1097
|
+
var deviceOrientationRef = null;
|
|
999
1098
|
var Dimension = {
|
|
1000
1099
|
get value() {
|
|
1001
1100
|
return getDimension();
|
|
1002
1101
|
},
|
|
1003
1102
|
environment: getEnvironment(),
|
|
1004
|
-
|
|
1103
|
+
screenOrientation: getScreenOrientation(),
|
|
1104
|
+
deviceOrientation: getDeviceOrientation(),
|
|
1105
|
+
onChange: onDimensionChangeSubscriptionManager.subscribe,
|
|
1005
1106
|
Constants: {
|
|
1006
1107
|
Orientation: exports.Orientation,
|
|
1007
1108
|
},
|
|
1008
|
-
Errors: {
|
|
1109
|
+
Errors: {
|
|
1110
|
+
NotSupportedError: NotSupportedError,
|
|
1111
|
+
PermissionNotGrantedError: PermissionNotGrantedError,
|
|
1112
|
+
},
|
|
1009
1113
|
};
|
|
1010
1114
|
function getOrientation() {
|
|
1011
|
-
if (typeof globalThis.screen !== 'undefined') {
|
|
1115
|
+
if (typeof globalThis.screen !== 'undefined' && typeof globalThis.screen.orientation !== 'undefined' && typeof globalThis.screen.orientation.type !== 'undefined') {
|
|
1012
1116
|
switch (globalThis.screen.orientation.type) {
|
|
1013
1117
|
case 'portrait-primary':
|
|
1118
|
+
return exports.Orientation.PortraitPrimary;
|
|
1014
1119
|
case 'portrait-secondary':
|
|
1015
|
-
return exports.Orientation.
|
|
1120
|
+
return exports.Orientation.PortraitSecondary;
|
|
1016
1121
|
case 'landscape-primary':
|
|
1122
|
+
return exports.Orientation.LandscapePrimary;
|
|
1017
1123
|
case 'landscape-secondary':
|
|
1018
|
-
return exports.Orientation.
|
|
1124
|
+
return exports.Orientation.LandscapeSecondary;
|
|
1019
1125
|
}
|
|
1020
1126
|
}
|
|
1021
1127
|
if (typeof globalThis.orientation !== 'undefined') {
|
|
1022
1128
|
switch (globalThis.orientation) {
|
|
1023
1129
|
case 0:
|
|
1130
|
+
return exports.Orientation.PortraitPrimary;
|
|
1024
1131
|
case 180:
|
|
1025
|
-
return exports.Orientation.
|
|
1132
|
+
return exports.Orientation.PortraitSecondary;
|
|
1026
1133
|
case 90:
|
|
1134
|
+
return exports.Orientation.LandscapePrimary;
|
|
1135
|
+
case -90:
|
|
1027
1136
|
case 270:
|
|
1028
|
-
return exports.Orientation.
|
|
1137
|
+
return exports.Orientation.LandscapeSecondary;
|
|
1029
1138
|
}
|
|
1030
1139
|
}
|
|
1031
1140
|
if (exports.ORIENTATION_MEDIA_QUERY_LIST.media === 'not all')
|
|
1032
|
-
|
|
1033
|
-
|
|
1034
|
-
return exports.Orientation.
|
|
1141
|
+
throw new NotSupportedError('\'screen.orientation\', \'window.orientation\', and the orientation media query are all unsupported');
|
|
1142
|
+
if (exports.ORIENTATION_MEDIA_QUERY_LIST.matches)
|
|
1143
|
+
return exports.Orientation.PortraitPrimary;
|
|
1035
1144
|
else
|
|
1036
|
-
return exports.Orientation.
|
|
1145
|
+
return exports.Orientation.LandscapePrimary;
|
|
1037
1146
|
}
|
|
1038
1147
|
function getScale() {
|
|
1039
1148
|
if (typeof globalThis.devicePixelRatio !== 'undefined')
|
|
@@ -1049,47 +1158,168 @@ function getEnvironment() {
|
|
|
1049
1158
|
viewportSegment: viewportSegmentObserver,
|
|
1050
1159
|
};
|
|
1051
1160
|
}
|
|
1052
|
-
function
|
|
1053
|
-
|
|
1054
|
-
|
|
1055
|
-
|
|
1056
|
-
|
|
1057
|
-
|
|
1058
|
-
|
|
1059
|
-
|
|
1161
|
+
function getScreenOrientation() {
|
|
1162
|
+
return {
|
|
1163
|
+
get supported() {
|
|
1164
|
+
return screenOrientationSupported();
|
|
1165
|
+
},
|
|
1166
|
+
get value() {
|
|
1167
|
+
return getOrientation();
|
|
1168
|
+
},
|
|
1169
|
+
onChange: onScreenOrientationChangeSubscriptionManager.subscribe,
|
|
1060
1170
|
};
|
|
1171
|
+
}
|
|
1172
|
+
function getDeviceOrientation() {
|
|
1173
|
+
return {
|
|
1174
|
+
get supported() {
|
|
1175
|
+
return deviceOrientationSupported();
|
|
1176
|
+
},
|
|
1177
|
+
get value() {
|
|
1178
|
+
return getDeviceOrientationValue();
|
|
1179
|
+
},
|
|
1180
|
+
onChange: onDeviceOrientationChangeSubscriptionManager.subscribe,
|
|
1181
|
+
};
|
|
1182
|
+
}
|
|
1183
|
+
function getDimension() {
|
|
1184
|
+
var innerWidth = 0;
|
|
1185
|
+
var innerHeight = 0;
|
|
1186
|
+
var outerWidth = 0;
|
|
1187
|
+
var outerHeight = 0;
|
|
1188
|
+
var scale = getScale();
|
|
1061
1189
|
if (typeof globalThis.innerWidth !== 'undefined') {
|
|
1062
|
-
|
|
1063
|
-
|
|
1064
|
-
|
|
1065
|
-
|
|
1190
|
+
innerWidth = globalThis.innerWidth;
|
|
1191
|
+
innerHeight = globalThis.innerHeight;
|
|
1192
|
+
outerWidth = globalThis.outerWidth;
|
|
1193
|
+
outerHeight = globalThis.outerHeight;
|
|
1066
1194
|
}
|
|
1067
|
-
return
|
|
1195
|
+
return {
|
|
1196
|
+
innerWidth: innerWidth,
|
|
1197
|
+
innerHeight: innerHeight,
|
|
1198
|
+
outerWidth: outerWidth,
|
|
1199
|
+
outerHeight: outerHeight,
|
|
1200
|
+
scale: scale,
|
|
1201
|
+
};
|
|
1068
1202
|
}
|
|
1069
|
-
function
|
|
1203
|
+
function attachOnDimensionChange() {
|
|
1070
1204
|
dimensionRef = getDimension();
|
|
1071
|
-
EventListener.add(globalThis, { type: 'resize', callback:
|
|
1072
|
-
|
|
1073
|
-
|
|
1205
|
+
EventListener.add(globalThis, { type: 'resize', callback: onDimensionChange });
|
|
1206
|
+
}
|
|
1207
|
+
function detachOnDimensionChange() {
|
|
1208
|
+
dimensionRef = null;
|
|
1209
|
+
EventListener.remove(globalThis, { type: 'resize', callback: onDimensionChange });
|
|
1210
|
+
}
|
|
1211
|
+
function onDimensionChange() {
|
|
1212
|
+
var dimension = getDimension();
|
|
1213
|
+
if (dimensionRef === null || dimension.innerWidth !== dimensionRef.innerWidth || dimension.innerHeight !== dimensionRef.innerHeight || dimension.outerWidth !== dimensionRef.outerWidth || dimension.outerHeight !== dimensionRef.outerHeight || dimension.scale !== dimensionRef.scale)
|
|
1214
|
+
onDimensionChangeSubscriptionManager.emit(dimensionRef = dimension);
|
|
1215
|
+
}
|
|
1216
|
+
function screenOrientationSupported() {
|
|
1217
|
+
if (typeof globalThis.screen !== 'undefined' && typeof globalThis.screen.orientation !== 'undefined' && typeof globalThis.screen.orientation.type !== 'undefined')
|
|
1218
|
+
return true;
|
|
1219
|
+
if (typeof globalThis.orientation !== 'undefined')
|
|
1220
|
+
return true;
|
|
1221
|
+
return exports.ORIENTATION_MEDIA_QUERY_LIST.media !== 'not all';
|
|
1222
|
+
}
|
|
1223
|
+
function attachOnScreenOrientationChange() {
|
|
1224
|
+
if (typeof globalThis.screen !== 'undefined' && typeof globalThis.screen.orientation !== 'undefined' && typeof globalThis.screen.orientation.addEventListener === 'function')
|
|
1225
|
+
return EventListener.add(globalThis.screen.orientation, {
|
|
1226
|
+
type: 'change',
|
|
1227
|
+
callback: onScreenOrientationChange
|
|
1228
|
+
});
|
|
1074
1229
|
else if (typeof globalThis.orientation !== 'undefined')
|
|
1075
|
-
EventListener.add(globalThis, { type: '
|
|
1230
|
+
return EventListener.add(globalThis, { type: 'orientationchange', callback: onScreenOrientationChange });
|
|
1076
1231
|
else if (exports.ORIENTATION_MEDIA_QUERY_LIST.media !== 'not all')
|
|
1077
|
-
EventListener.add(exports.ORIENTATION_MEDIA_QUERY_LIST, { type: 'change', callback:
|
|
1232
|
+
return EventListener.add(exports.ORIENTATION_MEDIA_QUERY_LIST, { type: 'change', callback: onScreenOrientationChange });
|
|
1233
|
+
throw new NotSupportedError('\'screen.orientation\', \'window.orientation\', and the orientation media query are all unsupported');
|
|
1078
1234
|
}
|
|
1079
|
-
function
|
|
1080
|
-
|
|
1081
|
-
|
|
1082
|
-
|
|
1083
|
-
|
|
1235
|
+
function detachOnScreenOrientationChange() {
|
|
1236
|
+
if (typeof globalThis.screen !== 'undefined' && typeof globalThis.screen.orientation !== 'undefined' && typeof globalThis.screen.orientation.removeEventListener === 'function')
|
|
1237
|
+
return EventListener.remove(globalThis.screen.orientation, {
|
|
1238
|
+
type: 'change',
|
|
1239
|
+
callback: onScreenOrientationChange
|
|
1240
|
+
});
|
|
1084
1241
|
else if (typeof globalThis.orientation !== 'undefined')
|
|
1085
|
-
EventListener.remove(globalThis, { type: '
|
|
1242
|
+
return EventListener.remove(globalThis, { type: 'orientationchange', callback: onScreenOrientationChange });
|
|
1086
1243
|
else if (exports.ORIENTATION_MEDIA_QUERY_LIST.media !== 'not all')
|
|
1087
|
-
EventListener.remove(exports.ORIENTATION_MEDIA_QUERY_LIST, { type: 'change', callback:
|
|
1244
|
+
return EventListener.remove(exports.ORIENTATION_MEDIA_QUERY_LIST, { type: 'change', callback: onScreenOrientationChange });
|
|
1245
|
+
throw new NotSupportedError('\'screen.orientation\', \'window.orientation\', and the orientation media query are all unsupported');
|
|
1088
1246
|
}
|
|
1089
|
-
function
|
|
1090
|
-
var
|
|
1091
|
-
if (
|
|
1092
|
-
|
|
1247
|
+
function onScreenOrientationChange() {
|
|
1248
|
+
var orientation = getOrientation();
|
|
1249
|
+
if (screenOrientationRef === null || orientation !== screenOrientationRef)
|
|
1250
|
+
onScreenOrientationChangeSubscriptionManager.emit(screenOrientationRef = orientation);
|
|
1251
|
+
}
|
|
1252
|
+
function deviceOrientationSupported() {
|
|
1253
|
+
return typeof globalThis.DeviceOrientationEvent !== 'undefined';
|
|
1254
|
+
}
|
|
1255
|
+
function attachOnDeviceOrientationChange() {
|
|
1256
|
+
return new Promise(function (resolve, reject) {
|
|
1257
|
+
if (!deviceOrientationSupported())
|
|
1258
|
+
return reject(new NotSupportedError('\'window.DeviceOrientationEvent\' does not supported.'));
|
|
1259
|
+
var DeviceOrientationEventWithPermission = DeviceOrientationEvent;
|
|
1260
|
+
if (typeof DeviceOrientationEventWithPermission.requestPermission === 'function') {
|
|
1261
|
+
DeviceOrientationEventWithPermission.requestPermission().then(function (permission) {
|
|
1262
|
+
if (permission === 'granted') {
|
|
1263
|
+
EventListener.add(globalThis, { type: 'deviceorientation', callback: onDeviceOrientationChange });
|
|
1264
|
+
return resolve();
|
|
1265
|
+
}
|
|
1266
|
+
return reject(new PermissionNotGrantedError('\'deviceorientation\' permission is not granted.'));
|
|
1267
|
+
}).catch(function (_) {
|
|
1268
|
+
return reject(new NotSupportedError('\'window.DeviceOrientationEvent\' does not supported.'));
|
|
1269
|
+
});
|
|
1270
|
+
}
|
|
1271
|
+
else {
|
|
1272
|
+
EventListener.add(globalThis, { type: 'deviceorientation', callback: onDeviceOrientationChange });
|
|
1273
|
+
return resolve();
|
|
1274
|
+
}
|
|
1275
|
+
});
|
|
1276
|
+
}
|
|
1277
|
+
function detachOnDeviceOrientationChange() {
|
|
1278
|
+
EventListener.remove(globalThis, { type: 'deviceorientation', callback: onDeviceOrientationChange });
|
|
1279
|
+
}
|
|
1280
|
+
function onDeviceOrientationChange(event) {
|
|
1281
|
+
deviceOrientationRef = {
|
|
1282
|
+
alpha: event.alpha,
|
|
1283
|
+
beta: event.beta,
|
|
1284
|
+
gamma: event.gamma,
|
|
1285
|
+
absolute: event.absolute,
|
|
1286
|
+
};
|
|
1287
|
+
onDeviceOrientationChangeSubscriptionManager.emit(deviceOrientationRef);
|
|
1288
|
+
}
|
|
1289
|
+
function getDeviceOrientationValue() {
|
|
1290
|
+
return new Promise(function (resolve, reject) {
|
|
1291
|
+
if (deviceOrientationRef !== null)
|
|
1292
|
+
return resolve(deviceOrientationRef);
|
|
1293
|
+
if (!deviceOrientationSupported())
|
|
1294
|
+
return reject(new NotSupportedError('\'window.DeviceOrientationEvent\' does not supported.'));
|
|
1295
|
+
var DeviceOrientationEventWithPermission = DeviceOrientationEvent;
|
|
1296
|
+
var callback = function (event) {
|
|
1297
|
+
var value = {
|
|
1298
|
+
alpha: event.alpha,
|
|
1299
|
+
beta: event.beta,
|
|
1300
|
+
gamma: event.gamma,
|
|
1301
|
+
absolute: event.absolute,
|
|
1302
|
+
};
|
|
1303
|
+
deviceOrientationRef = value;
|
|
1304
|
+
EventListener.remove(globalThis, { type: 'deviceorientation', callback: callback });
|
|
1305
|
+
return resolve(value);
|
|
1306
|
+
};
|
|
1307
|
+
if (typeof DeviceOrientationEventWithPermission.requestPermission === 'function') {
|
|
1308
|
+
DeviceOrientationEventWithPermission.requestPermission().then(function (permission) {
|
|
1309
|
+
if (permission === 'granted') {
|
|
1310
|
+
EventListener.add(globalThis, { type: 'deviceorientation', callback: callback });
|
|
1311
|
+
return;
|
|
1312
|
+
}
|
|
1313
|
+
return reject(new PermissionNotGrantedError('\'deviceorientation\' permission is not granted.'));
|
|
1314
|
+
}).catch(function (_) {
|
|
1315
|
+
return reject(new NotSupportedError('\'window.DeviceOrientationEvent\' does not supported.'));
|
|
1316
|
+
});
|
|
1317
|
+
}
|
|
1318
|
+
else {
|
|
1319
|
+
EventListener.add(globalThis, { type: 'deviceorientation', callback: callback });
|
|
1320
|
+
return;
|
|
1321
|
+
}
|
|
1322
|
+
});
|
|
1093
1323
|
}
|
|
1094
1324
|
|
|
1095
1325
|
exports.ENV_PRESETS = ENV_PRESETS;
|
|
@@ -1,7 +1,12 @@
|
|
|
1
1
|
declare enum Orientation {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
2
|
+
PortraitPrimary = "portrait-primary",
|
|
3
|
+
PortraitSecondary = "portrait-secondary",
|
|
4
|
+
LandscapePrimary = "landscape-primary",
|
|
5
|
+
LandscapeSecondary = "landscape-secondary"
|
|
6
|
+
}
|
|
7
|
+
declare namespace Orientation {
|
|
8
|
+
function isLandscape(orientation: Orientation): boolean;
|
|
9
|
+
function isPortrait(orientation: Orientation): boolean;
|
|
5
10
|
}
|
|
6
11
|
declare const ENV_PRESETS: {
|
|
7
12
|
readonly 'safe-area-inset': {
|
|
@@ -42,17 +47,21 @@ declare const ENV_PRESETS: {
|
|
|
42
47
|
declare let ORIENTATION_MEDIA_QUERY_LIST: MediaQueryList;
|
|
43
48
|
declare let DEVICE_POSTURE_MEDIA_QUERY_LIST: MediaQueryList;
|
|
44
49
|
|
|
50
|
+
declare const NotSupportedError: ErrorConstructor;
|
|
51
|
+
|
|
52
|
+
declare const PermissionNotGrantedError: ErrorConstructor;
|
|
53
|
+
|
|
45
54
|
type EnvironmentPresetKey = keyof typeof ENV_PRESETS;
|
|
46
55
|
type EnvironmentPresetAttribute<K extends EnvironmentPresetKey> = keyof typeof ENV_PRESETS[K];
|
|
47
56
|
type EnvironmentPresetValues<K extends EnvironmentPresetKey> = {
|
|
48
57
|
[P in EnvironmentPresetAttribute<K>]: number;
|
|
49
58
|
};
|
|
50
59
|
declare interface Environment {
|
|
51
|
-
safeAreaInset: EnvironmentObserver<'safe-area-inset'>;
|
|
52
|
-
safeAreaMaxInset: EnvironmentObserver<'safe-area-max-inset'>;
|
|
53
|
-
keyboardInset: EnvironmentObserver<'keyboard-inset'>;
|
|
54
|
-
titlebarArea: EnvironmentObserver<'titlebar-area'>;
|
|
55
|
-
viewportSegment: EnvironmentObserver<'viewport-segment'>;
|
|
60
|
+
readonly safeAreaInset: EnvironmentObserver<'safe-area-inset'>;
|
|
61
|
+
readonly safeAreaMaxInset: EnvironmentObserver<'safe-area-max-inset'>;
|
|
62
|
+
readonly keyboardInset: EnvironmentObserver<'keyboard-inset'>;
|
|
63
|
+
readonly titlebarArea: EnvironmentObserver<'titlebar-area'>;
|
|
64
|
+
readonly viewportSegment: EnvironmentObserver<'viewport-segment'>;
|
|
56
65
|
}
|
|
57
66
|
declare interface SegmentsObserver {
|
|
58
67
|
get value(): EnvironmentPresetValues<'viewport-segment'>[];
|
|
@@ -65,21 +74,41 @@ declare type EnvironmentObserver<K extends EnvironmentPresetKey> = K extends 'vi
|
|
|
65
74
|
useCssVariable(prefix: string): () => void;
|
|
66
75
|
};
|
|
67
76
|
declare interface Dimensions {
|
|
68
|
-
outerWidth: number;
|
|
69
|
-
outerHeight: number;
|
|
70
|
-
innerWidth: number;
|
|
71
|
-
innerHeight: number;
|
|
72
|
-
scale: number;
|
|
73
|
-
|
|
77
|
+
readonly outerWidth: number;
|
|
78
|
+
readonly outerHeight: number;
|
|
79
|
+
readonly innerWidth: number;
|
|
80
|
+
readonly innerHeight: number;
|
|
81
|
+
readonly scale: number;
|
|
82
|
+
}
|
|
83
|
+
declare interface DeviceOrientationValue {
|
|
84
|
+
readonly alpha: number | null;
|
|
85
|
+
readonly beta: number | null;
|
|
86
|
+
readonly gamma: number | null;
|
|
87
|
+
readonly absolute: boolean;
|
|
88
|
+
}
|
|
89
|
+
declare interface DeviceOrientationInstance {
|
|
90
|
+
get supported(): boolean;
|
|
91
|
+
readonly value: Promise<DeviceOrientationValue>;
|
|
92
|
+
onChange(listener: (value: DeviceOrientationValue) => void, options?: AddEventListenerOptions): () => void;
|
|
93
|
+
}
|
|
94
|
+
declare interface ScreenOrientationInstance {
|
|
95
|
+
get supported(): boolean;
|
|
96
|
+
readonly value: Orientation;
|
|
97
|
+
onChange(listener: (value: Orientation) => void, options?: AddEventListenerOptions): () => void;
|
|
74
98
|
}
|
|
75
99
|
declare interface DimensionInstance {
|
|
76
100
|
get value(): Dimensions;
|
|
77
|
-
environment: Environment;
|
|
101
|
+
readonly environment: Environment;
|
|
102
|
+
readonly screenOrientation: ScreenOrientationInstance;
|
|
103
|
+
readonly deviceOrientation: DeviceOrientationInstance;
|
|
78
104
|
onChange(listener: (dimension: Dimensions) => void, options?: AddEventListenerOptions): () => void;
|
|
79
|
-
Constants: {
|
|
80
|
-
Orientation: typeof Orientation;
|
|
105
|
+
readonly Constants: {
|
|
106
|
+
readonly Orientation: typeof Orientation;
|
|
107
|
+
};
|
|
108
|
+
readonly Errors: {
|
|
109
|
+
readonly NotSupportedError: typeof NotSupportedError;
|
|
110
|
+
readonly PermissionNotGrantedError: typeof PermissionNotGrantedError;
|
|
81
111
|
};
|
|
82
|
-
Errors: {};
|
|
83
112
|
}
|
|
84
113
|
|
|
85
114
|
declare global {
|
|
@@ -100,4 +129,4 @@ declare global {
|
|
|
100
129
|
declare const Dimension: DimensionInstance;
|
|
101
130
|
|
|
102
131
|
export { DEVICE_POSTURE_MEDIA_QUERY_LIST, ENV_PRESETS, ORIENTATION_MEDIA_QUERY_LIST, Orientation, Dimension as default };
|
|
103
|
-
export type { DimensionInstance, Dimensions, Environment, EnvironmentObserver, EnvironmentPresetAttribute, EnvironmentPresetKey, EnvironmentPresetValues, SegmentsObserver };
|
|
132
|
+
export type { DeviceOrientationInstance, DeviceOrientationValue, DimensionInstance, Dimensions, Environment, EnvironmentObserver, EnvironmentPresetAttribute, EnvironmentPresetKey, EnvironmentPresetValues, ScreenOrientationInstance, SegmentsObserver };
|