@brandocms/jupiter 3.46.4 → 3.48.0
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/package.json +9 -9
- package/src/events/index.js +1 -0
- package/src/index.js +7 -7
- package/src/modules/Application/index.js +119 -80
- package/src/modules/Breakpoints/index.js +14 -17
- package/src/modules/Cookies/index.js +86 -43
- package/src/modules/CoverOverlay/index.js +6 -3
- package/src/modules/Dataloader/index.js +173 -7
- package/src/modules/Dom/index.js +26 -26
- package/src/modules/Dropdown/index.js +14 -14
- package/src/modules/EqualHeightElements/index.js +70 -0
- package/src/modules/EqualHeightImages/index.js +95 -0
- package/src/modules/FeatureTests/index.js +22 -15
- package/src/modules/FixedHeader/index.js +79 -75
- package/src/modules/Fontloader/index.js +5 -3
- package/src/modules/FooterReveal/index.js +1 -1
- package/src/modules/HeroSlider/index.js +33 -23
- package/src/modules/HeroVideo/index.js +15 -13
- package/src/modules/Lazyload/index.js +119 -65
- package/src/modules/Lightbox/index.js +40 -43
- package/src/modules/Links/index.js +8 -7
- package/src/modules/Marquee/index.js +47 -37
- package/src/modules/MobileMenu/index.js +112 -65
- package/src/modules/Moonwalk/index.js +256 -203
- package/src/modules/Parallax/index.js +24 -14
- package/src/modules/Popup/index.js +24 -21
- package/src/modules/ScrollSpy/index.js +5 -5
- package/src/modules/StackedBoxes/index.js +5 -5
- package/src/modules/StickyHeader/index.js +73 -70
- package/src/modules/Toggler/index.js +2 -2
- package/src/modules/Typography/index.js +13 -10
- package/src/utils/dispatchElementEvent.js +2 -2
- package/src/utils/imageIsLoaded.js +1 -1
- package/src/utils/imagesAreLoaded.js +3 -3
- package/src/utils/loadScript.js +9 -8
- package/src/utils/rafCallback.js +12 -10
- package/src/utils/zoom.js +11 -8
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
export default function dispatchEvent
|
|
2
|
-
const event = document.createEvent('CustomEvent')
|
|
1
|
+
export default function dispatchEvent(el, eventName) {
|
|
2
|
+
const event = document.createEvent('CustomEvent')
|
|
3
3
|
event.initCustomEvent(eventName, false, false, {})
|
|
4
4
|
el.dispatchEvent(event)
|
|
5
5
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import imageIsLoaded from './imageIsLoaded'
|
|
1
|
+
import imageIsLoaded from './imageIsLoaded'
|
|
2
2
|
|
|
3
|
-
export default function imagesAreLoaded
|
|
3
|
+
export default function imagesAreLoaded(imgs, lazy = false) {
|
|
4
4
|
if (imgs && imgs.nodeType) {
|
|
5
5
|
imgs = imgs.querySelectorAll('img')
|
|
6
6
|
}
|
|
@@ -8,7 +8,7 @@ export default function imagesAreLoaded (imgs, lazy = false) {
|
|
|
8
8
|
const promises = []
|
|
9
9
|
|
|
10
10
|
for (let i = 0; i < imgs.length; i += 1) {
|
|
11
|
-
const img = imgs[i]
|
|
11
|
+
const img = imgs[i]
|
|
12
12
|
promises.push(imageIsLoaded(img, lazy))
|
|
13
13
|
}
|
|
14
14
|
|
package/src/utils/loadScript.js
CHANGED
|
@@ -1,13 +1,14 @@
|
|
|
1
1
|
export default (url, completeCallback) => {
|
|
2
|
-
const script = document.createElement('script')
|
|
3
|
-
|
|
4
|
-
|
|
2
|
+
const script = document.createElement('script')
|
|
3
|
+
let done = false
|
|
4
|
+
const head = document.getElementsByTagName('head')[0]
|
|
5
|
+
script.src = url
|
|
5
6
|
|
|
6
|
-
script.onreadystatechange = function cb
|
|
7
|
-
if (
|
|
8
|
-
&&
|
|
9
|
-
|| this.readyState === 'loaded'
|
|
10
|
-
|
|
7
|
+
script.onreadystatechange = function cb() {
|
|
8
|
+
if (
|
|
9
|
+
!done &&
|
|
10
|
+
(!this.readyState || this.readyState === 'loaded' || this.readyState === 'complete')
|
|
11
|
+
) {
|
|
11
12
|
done = true
|
|
12
13
|
completeCallback()
|
|
13
14
|
|
package/src/utils/rafCallback.js
CHANGED
|
@@ -1,16 +1,18 @@
|
|
|
1
1
|
const DEFAULT_FPS = 60
|
|
2
2
|
const SCOPES = {}
|
|
3
3
|
|
|
4
|
-
export default (callback, fps = DEFAULT_FPS) =>
|
|
5
|
-
|
|
6
|
-
|
|
4
|
+
export default (callback, fps = DEFAULT_FPS) =>
|
|
5
|
+
(...passedArgs) =>
|
|
6
|
+
requestAnimationFrame(() => {
|
|
7
|
+
const msCurrent = new Date().getTime()
|
|
8
|
+
const fpsInterval = 1000 / fps
|
|
7
9
|
|
|
8
|
-
|
|
10
|
+
SCOPES[callback] = SCOPES[callback] || null
|
|
9
11
|
|
|
10
|
-
|
|
12
|
+
const msDelta = SCOPES[callback] ? msCurrent - SCOPES[callback] : null
|
|
11
13
|
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
})
|
|
14
|
+
if (msDelta === null || msDelta > fpsInterval) {
|
|
15
|
+
SCOPES[callback] = msCurrent - (msDelta % fpsInterval)
|
|
16
|
+
callback(...passedArgs)
|
|
17
|
+
}
|
|
18
|
+
})
|
package/src/utils/zoom.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
const _binarySearch = (a, b, maxIter, epsilon, property, unit) => {
|
|
2
|
-
const mid = (a + b) / 2
|
|
2
|
+
const mid = (a + b) / 2
|
|
3
3
|
if (maxIter <= 0 || b - a < epsilon) {
|
|
4
|
-
return mid
|
|
4
|
+
return mid
|
|
5
5
|
}
|
|
6
6
|
const query = `(${property}:${mid}${unit})`
|
|
7
7
|
if (window.matchMedia(query).matches) {
|
|
@@ -18,18 +18,22 @@ const _mediaQueryBinarySearch = (property, unit, a, b, maxIter, epsilon) => {
|
|
|
18
18
|
|
|
19
19
|
const ratio = _binarySearch(a, b, maxIter, epsilon, property, unit)
|
|
20
20
|
if (div) {
|
|
21
|
-
head.removeChild(style)
|
|
22
|
-
document.body.removeChild(div)
|
|
21
|
+
head.removeChild(style)
|
|
22
|
+
document.body.removeChild(div)
|
|
23
23
|
}
|
|
24
24
|
return ratio
|
|
25
25
|
}
|
|
26
26
|
|
|
27
27
|
const calculateFirefox = () => {
|
|
28
|
-
return
|
|
28
|
+
return (
|
|
29
|
+
Math.round(
|
|
30
|
+
_mediaQueryBinarySearch('min--moz-device-pixel-ratio', '', 0, 10, 20, 0.0001) * 10
|
|
31
|
+
) / 10
|
|
32
|
+
)
|
|
29
33
|
}
|
|
30
34
|
|
|
31
35
|
const calculateChrome = initial => Math.round(window.devicePixelRatio * 100) - initial
|
|
32
|
-
const calculateDefault = () => Math.round((
|
|
36
|
+
const calculateDefault = () => Math.round((window.outerWidth / window.innerWidth) * 10) / 10
|
|
33
37
|
|
|
34
38
|
const impls = {
|
|
35
39
|
firefox: calculateFirefox,
|
|
@@ -38,7 +42,6 @@ const impls = {
|
|
|
38
42
|
}
|
|
39
43
|
|
|
40
44
|
export default {
|
|
41
|
-
calculate: (browser, initial) =>
|
|
45
|
+
calculate: (browser, initial) =>
|
|
42
46
|
impls[browser] ? impls[browser](initial) : impls.default(initial)
|
|
43
|
-
)
|
|
44
47
|
}
|