fix: vendor the polyfill

This commit is contained in:
Nolan Lawson 2022-11-24 14:38:28 -08:00
parent 80c3f78ef1
commit c11d606933
5 changed files with 32 additions and 7 deletions

View File

@ -82,7 +82,6 @@
"format-message-parse": "^6.2.4",
"glob": "^7.2.0",
"is-emoji-supported": "^0.0.5",
"large-small-dynamic-viewport-units-polyfill": "^0.0.4",
"li": "^1.3.0",
"localstorage-memory": "^1.0.3",
"mkdirp": "^1.0.4",

View File

@ -0,0 +1,7 @@
Copyright <YEAR> <COPYRIGHT HOLDER>
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

View File

@ -0,0 +1,24 @@
// via https://github.com/joppuyo/large-small-dynamic-viewport-units-polyfill/blob/93782ffff5d76f46b71591b859aac44f3cd591b2/src/index.js
// with some stuff removed that we don't need
import { throttleTimer } from '../../_utils/throttleTimer.js'
// Don't execute this resize listener more than the browser can paint
const rafAlignedResize = process.browser && throttleTimer(requestAnimationFrame)
function setVh () {
const dvh = window.innerHeight * 0.01
document.documentElement.style.setProperty('--1dvh', (dvh + 'px'))
}
if (process.browser) {
// We run the calculation as soon as possible (eg. the script is in document head)
setVh()
// We run the calculation again when DOM has loaded
document.addEventListener('DOMContentLoaded', setVh)
// We run the calculation when window is resized
window.addEventListener('resize', () => {
rafAlignedResize(setVh)
})
}

View File

@ -39,5 +39,5 @@ export const importIntlListFormat = async () => { // has to be imported serially
}
export const importDynamicViewportUnitsPolyfill = () => import(
/* webpackChunkName: '$polyfill$-dynamic-viewport-units' */ 'large-small-dynamic-viewport-units-polyfill'
/* webpackChunkName: '$polyfill$-dynamic-viewport-units' */ '../../_thirdparty/large-small-dynamic-viewport-units-polyfill/dynamic-viewport-utils-polyfill.js'
)

View File

@ -4352,11 +4352,6 @@ kleur@^3.0.3:
resolved "https://registry.yarnpkg.com/kleur/-/kleur-3.0.3.tgz#a79c9ecc86ee1ce3fa6206d1216c501f147fc07e"
integrity sha512-eTIzlVOSUR+JxdDFepEYcBMtZ9Qqdef+rnzWdRZuMbOywu5tO2w2N7rqjoANZ5k9vywhL6Br1VRjUIgTQx4E8w==
large-small-dynamic-viewport-units-polyfill@^0.0.4:
version "0.0.4"
resolved "https://registry.yarnpkg.com/large-small-dynamic-viewport-units-polyfill/-/large-small-dynamic-viewport-units-polyfill-0.0.4.tgz#5d32499e6dda39aa15ff9b613ad073519d93a7f1"
integrity sha512-UmvkvGfb5p2KoXLrW3+y8lP8yNrRpHQUwZ2JkwAX8nYu1u29WMu0yfxg5GZQT3t2BHIC6Im5ARfx0KCPC7Avsg==
levn@^0.4.1:
version "0.4.1"
resolved "https://registry.yarnpkg.com/levn/-/levn-0.4.1.tgz#ae4562c007473b932a6200d403268dd2fffc6ade"