@brandocms/jupiter 3.42.3 → 3.42.7
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/CHANGELOG.md +22 -0
- package/package.json +11 -11
- package/src/modules/Application/index.js +13 -2
- package/src/modules/HeroSlider/index.js +1 -1
- package/src/modules/Links/index.js +21 -0
- package/src/modules/MobileMenu/index.js +3 -0
- package/src/modules/Moonwalk/index.js +23 -17
- package/src/modules/Typography/index.js +1 -6
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,25 @@
|
|
|
1
|
+
#### 3.42.7
|
|
2
|
+
|
|
3
|
+
- Links: Check for zero opacity body element on back/forward nav
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
#### 3.42.6
|
|
7
|
+
|
|
8
|
+
- Typography: Better defaults
|
|
9
|
+
- MobileMenu: set `this.open` boolean on opening/closing
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
#### 3.42.5
|
|
13
|
+
|
|
14
|
+
- Links: Fade out header/footer (if found) in default transition
|
|
15
|
+
- Moonwalk: Don't wait for images with `data-placeholder`, render right away
|
|
16
|
+
and let Lazyload do the image reveal.
|
|
17
|
+
|
|
18
|
+
#### 3.42.4
|
|
19
|
+
|
|
20
|
+
- Moonwalk: Fix fallback selector. This could have broken devices with
|
|
21
|
+
prefer reduced motion enabled.
|
|
22
|
+
|
|
1
23
|
#### 3.42.3
|
|
2
24
|
|
|
3
25
|
- Zoom: Change logic for Chrome/Safari
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@brandocms/jupiter",
|
|
3
|
-
"version": "3.42.
|
|
3
|
+
"version": "3.42.7",
|
|
4
4
|
"description": "Frontend helpers.",
|
|
5
5
|
"author": "Univers/Twined",
|
|
6
6
|
"license": "UNLICENSED",
|
|
@@ -32,19 +32,19 @@
|
|
|
32
32
|
},
|
|
33
33
|
"dependencies": {
|
|
34
34
|
"@egjs/hammerjs": "^2.0.17",
|
|
35
|
-
"body-scroll-lock": "^
|
|
36
|
-
"gsap": "3.
|
|
35
|
+
"body-scroll-lock": "^4.0.0-beta.0",
|
|
36
|
+
"gsap": "3.8.0",
|
|
37
37
|
"lodash.defaultsdeep": "^4.6.1"
|
|
38
38
|
},
|
|
39
39
|
"devDependencies": {
|
|
40
|
-
"@babel/core": "^7.
|
|
41
|
-
"@babel/preset-env": "^7.
|
|
42
|
-
"babel-jest": "^
|
|
43
|
-
"eslint": "
|
|
44
|
-
"eslint-config-airbnb-base": "^
|
|
45
|
-
"eslint-plugin-import": "^2.
|
|
40
|
+
"@babel/core": "^7.16.0",
|
|
41
|
+
"@babel/preset-env": "^7.16.4",
|
|
42
|
+
"babel-jest": "^27.3.1",
|
|
43
|
+
"eslint": "8.3.0",
|
|
44
|
+
"eslint-config-airbnb-base": "^15.0.0",
|
|
45
|
+
"eslint-plugin-import": "^2.25.3",
|
|
46
46
|
"eslint-plugin-node": "^11.1.0",
|
|
47
|
-
"eslint-plugin-promise": "^5.1.
|
|
48
|
-
"jest": "^
|
|
47
|
+
"eslint-plugin-promise": "^5.1.1",
|
|
48
|
+
"jest": "^27.3.1"
|
|
49
49
|
}
|
|
50
50
|
}
|
|
@@ -15,8 +15,19 @@ gsap.defaults({ overwrite: 'auto', ease: 'sine.out' })
|
|
|
15
15
|
|
|
16
16
|
window.onpageshow = event => {
|
|
17
17
|
if (event.persisted) {
|
|
18
|
-
|
|
19
|
-
|
|
18
|
+
const f = document.querySelector('#fader')
|
|
19
|
+
if (f) {
|
|
20
|
+
gsap.to(f, { duration: 0.35, autoAlpha: 0 })
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
const dataFaders = document.querySelectorAll('[data-fader]')
|
|
24
|
+
if (dataFaders.length) {
|
|
25
|
+
gsap.to(dataFaders, { duration: 0.35, autoAlpha: 0 })
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
gsap.set(document.body, {
|
|
29
|
+
clearProps: 'opacity'
|
|
30
|
+
})
|
|
20
31
|
}
|
|
21
32
|
}
|
|
22
33
|
|
|
@@ -17,7 +17,10 @@ const DEFAULT_OPTIONS = {
|
|
|
17
17
|
|
|
18
18
|
onTransition: href => {
|
|
19
19
|
const main = document.querySelector('main')
|
|
20
|
+
const header = document.querySelector('header[data-nav]')
|
|
21
|
+
const footer = document.querySelector('footer')
|
|
20
22
|
const fader = document.querySelector('#fader')
|
|
23
|
+
console.log('transition')
|
|
21
24
|
|
|
22
25
|
if (fader) {
|
|
23
26
|
gsap.set(fader, { display: 'block', opacity: 0 })
|
|
@@ -26,6 +29,15 @@ const DEFAULT_OPTIONS = {
|
|
|
26
29
|
y: 25,
|
|
27
30
|
ease: 'power3.out'
|
|
28
31
|
})
|
|
32
|
+
|
|
33
|
+
if (header) {
|
|
34
|
+
gsap.to(header, { duration: 0.2, opacity: 0 })
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
if (footer) {
|
|
38
|
+
gsap.to(footer, { duration: 0.2, opacity: 0 })
|
|
39
|
+
}
|
|
40
|
+
|
|
29
41
|
gsap.to(fader, {
|
|
30
42
|
duration: 0.2,
|
|
31
43
|
opacity: 1,
|
|
@@ -39,6 +51,15 @@ const DEFAULT_OPTIONS = {
|
|
|
39
51
|
y: 25,
|
|
40
52
|
ease: 'power3.out'
|
|
41
53
|
})
|
|
54
|
+
|
|
55
|
+
if (header) {
|
|
56
|
+
gsap.to(header, { duration: 0.2, opacity: 0 })
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
if (footer) {
|
|
60
|
+
gsap.to(footer, { duration: 0.2, opacity: 0 })
|
|
61
|
+
}
|
|
62
|
+
|
|
42
63
|
gsap.to(main, {
|
|
43
64
|
duration: 0.2,
|
|
44
65
|
opacity: 0,
|
|
@@ -105,6 +105,7 @@ export default class MobileMenu {
|
|
|
105
105
|
this.app = app
|
|
106
106
|
this.opts = _defaultsDeep(opts, DEFAULT_OPTIONS)
|
|
107
107
|
|
|
108
|
+
this.open = false
|
|
108
109
|
this.header = document.querySelector('header')
|
|
109
110
|
this.bg = this.header.querySelector('.mobile-bg')
|
|
110
111
|
this.logo = this.header.querySelector('figure.brand')
|
|
@@ -140,11 +141,13 @@ export default class MobileMenu {
|
|
|
140
141
|
toggleMenuClosed () {
|
|
141
142
|
// CLOSING MENU
|
|
142
143
|
this.opts.closeTween(this)
|
|
144
|
+
this.open = false
|
|
143
145
|
}
|
|
144
146
|
|
|
145
147
|
toggleMenuOpen () {
|
|
146
148
|
// OPENING MENU
|
|
147
149
|
this.opts.openTween(this)
|
|
150
|
+
this.open = true
|
|
148
151
|
}
|
|
149
152
|
|
|
150
153
|
_emitMobileMenuOpenEvent () {
|
|
@@ -93,16 +93,16 @@ const DEFAULT_OPTIONS = {
|
|
|
93
93
|
}
|
|
94
94
|
|
|
95
95
|
export default class Moonwalk {
|
|
96
|
-
constructor (app, opts = {}, container = document) {
|
|
96
|
+
constructor (app, opts = {}, container = document.body) {
|
|
97
97
|
this.app = app
|
|
98
98
|
this.opts = _defaultsDeep(opts, DEFAULT_OPTIONS)
|
|
99
|
-
if (container !== document) {
|
|
99
|
+
if (container !== document.body) {
|
|
100
100
|
this.opts.on = () => {}
|
|
101
101
|
}
|
|
102
102
|
this.initialize(container)
|
|
103
103
|
}
|
|
104
104
|
|
|
105
|
-
initialize (container = document) {
|
|
105
|
+
initialize (container = document.body) {
|
|
106
106
|
if (this.opts.clearMoonwalkOnAnchors) {
|
|
107
107
|
if (window.location.hash) {
|
|
108
108
|
this.removeAllWalks()
|
|
@@ -122,7 +122,7 @@ export default class Moonwalk {
|
|
|
122
122
|
this.clearLazyloads(container)
|
|
123
123
|
}
|
|
124
124
|
|
|
125
|
-
if (prefersReducedMotion()) {
|
|
125
|
+
if (prefersReducedMotion() && this.app.opts.respectReducedMotion) {
|
|
126
126
|
this.removeAllWalks(container)
|
|
127
127
|
}
|
|
128
128
|
|
|
@@ -141,7 +141,7 @@ export default class Moonwalk {
|
|
|
141
141
|
/**
|
|
142
142
|
* Remove all moonwalks. Useful for clients who prefer reduced motion
|
|
143
143
|
*/
|
|
144
|
-
removeAllWalks (container = document) {
|
|
144
|
+
removeAllWalks (container = document.body) {
|
|
145
145
|
const keys = ['data-moonwalk', 'data-moonwalk-run', 'data-moonwalk-section', 'data-moonwalk-children']
|
|
146
146
|
keys.forEach(key => {
|
|
147
147
|
const elems = container.querySelectorAll(`[${key}]`)
|
|
@@ -150,7 +150,7 @@ export default class Moonwalk {
|
|
|
150
150
|
})
|
|
151
151
|
}
|
|
152
152
|
|
|
153
|
-
removeFor (container = document, selector) {
|
|
153
|
+
removeFor (container = document.body, selector) {
|
|
154
154
|
const keys = ['data-moonwalk', 'data-moonwalk-run', 'data-moonwalk-section', 'data-moonwalk-children']
|
|
155
155
|
keys.forEach(key => {
|
|
156
156
|
const elems = container.querySelectorAll(`${selector}[${key}]`)
|
|
@@ -161,7 +161,7 @@ export default class Moonwalk {
|
|
|
161
161
|
/**
|
|
162
162
|
* Remove run matching name
|
|
163
163
|
*/
|
|
164
|
-
removeRun (container = document, name) {
|
|
164
|
+
removeRun (container = document.body, name) {
|
|
165
165
|
const key = 'data-moonwalk-run'
|
|
166
166
|
const elems = container.querySelectorAll(`[${key}="${name}"]`)
|
|
167
167
|
Array.from(elems).forEach(el => el.removeAttribute(key))
|
|
@@ -170,7 +170,7 @@ export default class Moonwalk {
|
|
|
170
170
|
/**
|
|
171
171
|
* Remove all runs
|
|
172
172
|
*/
|
|
173
|
-
removeRuns (container = document) {
|
|
173
|
+
removeRuns (container = document.body) {
|
|
174
174
|
const key = 'data-moonwalk-run'
|
|
175
175
|
const elems = container.querySelectorAll(`[${key}]`)
|
|
176
176
|
Array.from(elems).forEach(el => el.removeAttribute(key))
|
|
@@ -207,7 +207,7 @@ export default class Moonwalk {
|
|
|
207
207
|
* Go through each `data-moonwalk-run`, parse children, add IDs/indexes
|
|
208
208
|
* (if wanted), initialize a new object for each.
|
|
209
209
|
*/
|
|
210
|
-
initializeRuns (container = document) {
|
|
210
|
+
initializeRuns (container = document.body) {
|
|
211
211
|
const runs = container.querySelectorAll('[data-moonwalk-run]')
|
|
212
212
|
return Array.from(runs).map(run => {
|
|
213
213
|
const foundRun = this.opts.runs[run.getAttribute('data-moonwalk-run')]
|
|
@@ -227,7 +227,7 @@ export default class Moonwalk {
|
|
|
227
227
|
* Go through each `data-moonwalk-section`, parse children, add IDs/indexes
|
|
228
228
|
* (if wanted), initialize a new object for each.
|
|
229
229
|
*/
|
|
230
|
-
initializeSections (container = document) {
|
|
230
|
+
initializeSections (container = document.body) {
|
|
231
231
|
const sections = container.querySelectorAll('[data-moonwalk-section]')
|
|
232
232
|
|
|
233
233
|
if (container !== document && !sections.length && container.hasAttribute('data-moonwalk-section')) {
|
|
@@ -272,7 +272,7 @@ export default class Moonwalk {
|
|
|
272
272
|
* Removes `data-moonwalk` from all elements who already have `data-ll-srcset´
|
|
273
273
|
* Can be used if Moonwalking interferes with custom lazyloading animations
|
|
274
274
|
*/
|
|
275
|
-
clearLazyloads (container = document) {
|
|
275
|
+
clearLazyloads (container = document.body) {
|
|
276
276
|
const srcsets = container.querySelectorAll('[data-ll-srcset][data-moonwalk]')
|
|
277
277
|
Array.from(srcsets).forEach(srcset => srcset.removeAttribute('data-moonwalk'))
|
|
278
278
|
}
|
|
@@ -617,13 +617,19 @@ export default class Moonwalk {
|
|
|
617
617
|
// ensure image is loaded before we tween
|
|
618
618
|
imageIsLoaded(entry.target).then(() => wrappedTweenFn())
|
|
619
619
|
} else {
|
|
620
|
-
|
|
621
|
-
|
|
622
|
-
//
|
|
623
|
-
imagesAreLoaded(imagesInEntry).then(() => wrappedTweenFn())
|
|
624
|
-
} else {
|
|
625
|
-
// regular entry, just tween it
|
|
620
|
+
if (entry.target.hasAttribute('data-placeholder')) {
|
|
621
|
+
// if the moonwalked element has data-placeholder, we don't want to wait
|
|
622
|
+
// for the image to load before tweening
|
|
626
623
|
wrappedTweenFn()
|
|
624
|
+
} else {
|
|
625
|
+
const imagesInEntry = entry.target.querySelectorAll('img')
|
|
626
|
+
if (imagesInEntry.length) {
|
|
627
|
+
// entry has children elements that are images
|
|
628
|
+
imagesAreLoaded(imagesInEntry).then(() => wrappedTweenFn())
|
|
629
|
+
} else {
|
|
630
|
+
// regular entry, just tween it
|
|
631
|
+
wrappedTweenFn()
|
|
632
|
+
}
|
|
627
633
|
}
|
|
628
634
|
}
|
|
629
635
|
self.unobserve(entry.target)
|
|
@@ -5,7 +5,7 @@ export default class Typography {
|
|
|
5
5
|
// Set some settings, by merging defaults and passed settings
|
|
6
6
|
self.settings = {
|
|
7
7
|
minWords: 4,
|
|
8
|
-
selector: '
|
|
8
|
+
selector: '[data-typo]',
|
|
9
9
|
ignoreClass: 'no-typo-fix',
|
|
10
10
|
ignoreExistingSpaceChars: false,
|
|
11
11
|
...settings
|
|
@@ -29,11 +29,6 @@ export default class Typography {
|
|
|
29
29
|
const self = this
|
|
30
30
|
|
|
31
31
|
self.elems.map(elem => {
|
|
32
|
-
// Bail out if the ignore class is present on this element
|
|
33
|
-
if (elem.classList.contains(self.settings.ignoreClass)) {
|
|
34
|
-
return false
|
|
35
|
-
}
|
|
36
|
-
|
|
37
32
|
// Run the ignore checker nd bail if required
|
|
38
33
|
if (self.shouldElementBeIgnored(elem)) {
|
|
39
34
|
return false
|