aw-front-helpers 2.4.2 → 2.5.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/Readme.md +5 -5
- package/bootstraper/Readme.md +5 -5
- package/bootstraper/index.js +4 -2
- package/bootstraper/maps.js +1 -1
- package/bootstraper/youtube.js +1 -1
- package/classes/formControl.js +23 -27
- package/classes/globalParallax.js +1 -3
- package/classes/nearby.js +2 -4
- package/index.js +6 -7
- package/package.json +2 -4
- package/stylesheets/_medias.scss +4 -1
- package/stylesheets/_mixins.scss +4 -13
- package/stylesheets/_variables.scss +1 -0
- package/utils/Readme.md +1 -4
- package/utils/dom/getClosest.js +1 -0
package/Readme.md
CHANGED
|
@@ -6,12 +6,12 @@ A library of functionalities for common tasks in Javascript / Sass.
|
|
|
6
6
|
## Table of contents
|
|
7
7
|
### Javascripts
|
|
8
8
|
- **bootstraper** [See the documentation](https://gitlab.com/awstudio/front-helpers/tree/master/bootstraper/Readme.md)
|
|
9
|
-
-
|
|
10
|
-
-
|
|
9
|
+
- Maps | Allow the initialization of the Bootstraper Google Map
|
|
10
|
+
- Youtube | Allow the initialization of the Bootstraper Youtube Iframe
|
|
11
11
|
- **classes** [See the documentation](https://gitlab.com/awstudio/front-helpers/tree/master/classes/Readme.md)
|
|
12
|
-
-
|
|
13
|
-
-
|
|
14
|
-
-
|
|
12
|
+
- FormControl | A Javascript form validation class
|
|
13
|
+
- GParallax | A Parallax animation library
|
|
14
|
+
- Nearby | A librairy to animate element depending on the position of the mouse
|
|
15
15
|
- **utils** [See the documentation](https://gitlab.com/awstudio/front-helpers/tree/master/utils/Readme.md)
|
|
16
16
|
- array
|
|
17
17
|
- dom
|
package/bootstraper/Readme.md
CHANGED
|
@@ -2,14 +2,14 @@
|
|
|
2
2
|
|
|
3
3
|
# Bootstraper
|
|
4
4
|
## maps
|
|
5
|
-
- `import
|
|
6
|
-
- `bootstraperMaps(googleKeyApi).then( initMap )` to initialize
|
|
7
|
-
- you can specified libraries to load in second parameters
|
|
5
|
+
- `import { BootstraperMaps } from 'aw-front-helpers'
|
|
6
|
+
- `bootstraperMaps.load('googleKeyApi', library[]).then( initMap )` to initialize
|
|
7
|
+
- you can specified libraries to load in second parameters [Libraries](https://developers.google.com/maps/documentation/javascript/libraries)
|
|
8
8
|
- drawing
|
|
9
9
|
- geometry
|
|
10
10
|
- places
|
|
11
11
|
- visualization
|
|
12
12
|
|
|
13
13
|
## youtube
|
|
14
|
-
- `import
|
|
15
|
-
- `
|
|
14
|
+
- `import { BootstraperYoutube } from 'aw-front-helpers'
|
|
15
|
+
- `BootstraperYoutube.load().then( initPlayer )` to initialize
|
package/bootstraper/index.js
CHANGED
package/bootstraper/maps.js
CHANGED
|
@@ -25,7 +25,7 @@ class bootstraperMaps {
|
|
|
25
25
|
}
|
|
26
26
|
|
|
27
27
|
_init() {
|
|
28
|
-
|
|
28
|
+
const tag = document.createElement('script'),
|
|
29
29
|
firstScriptTag = document.getElementsByTagName('script')[0],
|
|
30
30
|
libs = this._libraries ? `&libraries=${this._libraries.join(',')}` : ``;
|
|
31
31
|
tag.src = `https://maps.googleapis.com/maps/api/js?key=${this._googleAPIKey}${libs}&callback=onMapsReady`;
|
package/bootstraper/youtube.js
CHANGED
|
@@ -25,7 +25,7 @@ class bootstraperYoutube {
|
|
|
25
25
|
}
|
|
26
26
|
|
|
27
27
|
_init() {
|
|
28
|
-
|
|
28
|
+
const tag = document.createElement('script'),
|
|
29
29
|
firstScriptTag = document.getElementsByTagName('script')[0];
|
|
30
30
|
tag.src = 'https://www.youtube.com/iframe_api';
|
|
31
31
|
firstScriptTag.parentNode.insertBefore(tag, firstScriptTag);
|
package/classes/formControl.js
CHANGED
|
@@ -1,10 +1,6 @@
|
|
|
1
|
-
import {
|
|
2
|
-
gsap
|
|
3
|
-
} from 'gsap/all';
|
|
1
|
+
import { gsap } from 'gsap/all';
|
|
4
2
|
import ScrollToPlugin from 'gsap/ScrollToPlugin';
|
|
5
3
|
gsap.registerPlugin(ScrollToPlugin);
|
|
6
|
-
import create from 'dom-create-element';
|
|
7
|
-
import getClosest from '../utils/dom/getClosest';
|
|
8
4
|
import regex_email from '../utils/regex/email';
|
|
9
5
|
|
|
10
6
|
const defaultOptions = {
|
|
@@ -103,27 +99,26 @@ export default class FormControl {
|
|
|
103
99
|
}
|
|
104
100
|
|
|
105
101
|
setError(element, message = null) {
|
|
106
|
-
const parent =
|
|
107
|
-
if
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
102
|
+
const parent = element.closest(this._options.selectorGroup);
|
|
103
|
+
if( parent === null ) return;
|
|
104
|
+
let error = parent.querySelector(`.${this._options.classErrorElement}`);
|
|
105
|
+
if (!error) {
|
|
106
|
+
error = Object.assign(
|
|
107
|
+
document.createElement('ul'), {
|
|
108
|
+
className: this._options.classErrorElement
|
|
109
|
+
});
|
|
110
|
+
parent.appendChild(error);
|
|
111
|
+
}
|
|
112
|
+
parent.classList.add(this._options.classIsError);
|
|
117
113
|
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
}
|
|
114
|
+
const previousErrors = [...error.querySelectorAll('li')];
|
|
115
|
+
for (let i = 0; i < previousErrors.length; i++) {
|
|
116
|
+
if (previousErrors[i].innerHTML === message) return;
|
|
117
|
+
}
|
|
118
|
+
if (message) {
|
|
119
|
+
const errorElement = document.createElement('li');
|
|
120
|
+
errorElement.innerHTML = message;
|
|
121
|
+
error.appendChild(errorElement);
|
|
127
122
|
}
|
|
128
123
|
}
|
|
129
124
|
|
|
@@ -160,7 +155,8 @@ export default class FormControl {
|
|
|
160
155
|
/** @private */
|
|
161
156
|
_removeError(el = null) {
|
|
162
157
|
if (el) {
|
|
163
|
-
const group =
|
|
158
|
+
const group = el.closest( this._options.selectorGroup );
|
|
159
|
+
if( group === null ) return;
|
|
164
160
|
group.classList.remove(this._options.classIsError);
|
|
165
161
|
const currentErrors = [...group.querySelectorAll(`.${this._options.classErrorElement}`)];
|
|
166
162
|
currentErrors.forEach(error => {
|
|
@@ -181,7 +177,7 @@ export default class FormControl {
|
|
|
181
177
|
|
|
182
178
|
/** @private */
|
|
183
179
|
_checkError(el) {
|
|
184
|
-
const group =
|
|
180
|
+
const group = el.closest(this._options.selectorGroup);
|
|
185
181
|
if (group === null) return false;
|
|
186
182
|
if (el.getAttribute('disabled') !== null) return false;
|
|
187
183
|
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import Symbol from 'es6-symbol';
|
|
2
2
|
import EventEmitter from 'events';
|
|
3
|
-
import raf from 'raf';
|
|
4
3
|
|
|
5
4
|
// singleton
|
|
6
5
|
let singleton = Symbol();
|
|
@@ -16,7 +15,6 @@ class GParallax extends EventEmitter {
|
|
|
16
15
|
throw 'Global Parallax: Cannot construct singleton';
|
|
17
16
|
}
|
|
18
17
|
super();
|
|
19
|
-
this._raf = null;
|
|
20
18
|
}
|
|
21
19
|
|
|
22
20
|
static getInstance() {
|
|
@@ -69,7 +67,7 @@ class GParallax extends EventEmitter {
|
|
|
69
67
|
|
|
70
68
|
_onScroll() {
|
|
71
69
|
this._vars.scrollY = window.pageYOffset;
|
|
72
|
-
|
|
70
|
+
window.requestAnimationFrame(this._update);
|
|
73
71
|
}
|
|
74
72
|
|
|
75
73
|
_update() {
|
package/classes/nearby.js
CHANGED
|
@@ -29,7 +29,7 @@ const getMousePos = (e) => {
|
|
|
29
29
|
return { x: posx, y: posy }
|
|
30
30
|
};
|
|
31
31
|
|
|
32
|
-
class Nearby {
|
|
32
|
+
export default class Nearby {
|
|
33
33
|
constructor(el, options) {
|
|
34
34
|
this.DOM = { el: el };
|
|
35
35
|
this.options = options;
|
|
@@ -65,6 +65,4 @@ class Nearby {
|
|
|
65
65
|
|
|
66
66
|
window.addEventListener('mousemove', this.mousemoveFn);
|
|
67
67
|
}
|
|
68
|
-
}
|
|
69
|
-
|
|
70
|
-
export default Nearby;
|
|
68
|
+
}
|
package/index.js
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
module.exports.bootstraperYoutube = require('./bootstraper/youtube').default;
|
|
1
|
+
export const GParallax = require('./classes/globalParallax').default;
|
|
2
|
+
export const Nearby = require('./classes/nearby').default;
|
|
3
|
+
export const FormControl = require('./classes/formControl').default;
|
|
4
|
+
export const BootstraperMaps = require('./bootstraper/maps').default;
|
|
5
|
+
export const BootstraperYoutube = require('./bootstraper/youtube').default;
|
|
6
|
+
export const utils = require('./utils');
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "aw-front-helpers",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.5.0",
|
|
4
4
|
"description": "Assets helpers for projects",
|
|
5
5
|
"author": "Yoann Le Poupon",
|
|
6
6
|
"license": "ISC",
|
|
@@ -10,10 +10,8 @@
|
|
|
10
10
|
"url": "git@gitlab.com:awstudio/front-helpers.git"
|
|
11
11
|
},
|
|
12
12
|
"dependencies": {
|
|
13
|
-
"dom-create-element": "^1.0.2",
|
|
14
13
|
"es6-symbol": "^3.1.3",
|
|
15
14
|
"exif-js": "^2.3.0",
|
|
16
|
-
"gsap": "^3.
|
|
17
|
-
"raf": "^3.4.1"
|
|
15
|
+
"gsap": "^3.10.4"
|
|
18
16
|
}
|
|
19
17
|
}
|
package/stylesheets/_medias.scss
CHANGED
|
@@ -2,7 +2,8 @@
|
|
|
2
2
|
$breakpoint-phablet: 480px !default;
|
|
3
3
|
$breakpoint-tablet: 768px !default;
|
|
4
4
|
$breakpoint-desktop: 1024px !default;
|
|
5
|
-
$breakpoint-desktop-xl:
|
|
5
|
+
$breakpoint-desktop-xl: 1280px !default;
|
|
6
|
+
$breakpoint-desktop-xxl: 1440px !default;
|
|
6
7
|
$breakpoint-burger: 1100px !default;
|
|
7
8
|
|
|
8
9
|
// ------------------------------------------------------------
|
|
@@ -19,6 +20,7 @@ $tablet-max : '#{$media-query} (max-width: #{$breakpoint-desktop - 1})';
|
|
|
19
20
|
$tablet-only: '#{$media-query} (min-width: #{$breakpoint-tablet}) and (max-width: #{$breakpoint-desktop - 1})';
|
|
20
21
|
$desktop: '#{$media-query} (min-width: #{$breakpoint-desktop})';
|
|
21
22
|
$desktop-xl: '#{$media-query} (min-width: #{$breakpoint-desktop-xl})';
|
|
23
|
+
$desktop-xxl: '#{$media-query} (min-width: #{$breakpoint-desktop-xxl})';
|
|
22
24
|
$burger-enable: '#{$media-query} (max-width: #{$breakpoint-burger - 1})';
|
|
23
25
|
$burger-disable: '#{$media-query} (min-width: #{$breakpoint-burger})';
|
|
24
26
|
|
|
@@ -30,5 +32,6 @@ $burger-disable: '#{$media-query} (min-width: #{$breakpoint-burger})';
|
|
|
30
32
|
@mixin tablet-only { @media #{$tablet-only} { @content; } }
|
|
31
33
|
@mixin desktop { @media #{$desktop} { @content; } }
|
|
32
34
|
@mixin desktop-xl { @media #{$desktop-xl} { @content; } }
|
|
35
|
+
@mixin desktop-xxl { @media #{$desktop-xxl} { @content; } }
|
|
33
36
|
@mixin burger-enable { @media #{$burger-enable} { @content; } }
|
|
34
37
|
@mixin burger-disable { @media #{$burger-disable} { @content; } }
|
package/stylesheets/_mixins.scss
CHANGED
|
@@ -4,7 +4,7 @@ $color-main: #000 !default;
|
|
|
4
4
|
|
|
5
5
|
$wrapper-max: 1500px !default;
|
|
6
6
|
$wrapper-width-sm: 95% !default;
|
|
7
|
-
$wrapper-width-md:
|
|
7
|
+
$wrapper-width-md: 95% !default;
|
|
8
8
|
$wrapper-width-lg: 90% !default;
|
|
9
9
|
|
|
10
10
|
$vertical-spacing-mobile: 50px !default;
|
|
@@ -22,11 +22,9 @@ $vertical-spacing-desktop: 80px !default;
|
|
|
22
22
|
margin-right: auto;
|
|
23
23
|
width: $wrapper-width-sm;
|
|
24
24
|
max-width: $wrapper-max;
|
|
25
|
-
|
|
26
25
|
@include desktop {
|
|
27
26
|
width: $wrapper-width-md;
|
|
28
27
|
}
|
|
29
|
-
|
|
30
28
|
@include desktop-xl {
|
|
31
29
|
width: $wrapper-width-lg;
|
|
32
30
|
}
|
|
@@ -128,19 +126,12 @@ $vertical-spacing-desktop: 80px !default;
|
|
|
128
126
|
-webkit-font-smoothing: inherit;
|
|
129
127
|
-moz-osx-font-smoothing: inherit;
|
|
130
128
|
-webkit-appearance: none;
|
|
131
|
-
|
|
132
129
|
&:not(input) {
|
|
133
130
|
user-select: none;
|
|
134
131
|
}
|
|
135
|
-
|
|
136
132
|
&:hover {
|
|
137
133
|
text-decoration: none;
|
|
138
134
|
}
|
|
139
|
-
|
|
140
|
-
&::-moz-focus-inner {
|
|
141
|
-
border: 0;
|
|
142
|
-
padding: 0;
|
|
143
|
-
}
|
|
144
135
|
}
|
|
145
136
|
|
|
146
137
|
// -------------------------
|
|
@@ -207,13 +198,14 @@ $vertical-spacing-desktop: 80px !default;
|
|
|
207
198
|
}
|
|
208
199
|
|
|
209
200
|
@mixin imageCover {
|
|
201
|
+
@include absolute;
|
|
210
202
|
width: 100%;
|
|
211
203
|
height: 100%;
|
|
212
204
|
object-fit: cover;
|
|
213
205
|
}
|
|
214
206
|
|
|
215
|
-
@mixin loader($color: $color-main, $scale: 1) {
|
|
216
|
-
|
|
207
|
+
@mixin loader($color: $color-main, $scale: 1, $position: after) {
|
|
208
|
+
&::#{$position} {
|
|
217
209
|
content: '';
|
|
218
210
|
position: absolute;
|
|
219
211
|
left: 50%;
|
|
@@ -233,7 +225,6 @@ $vertical-spacing-desktop: 80px !default;
|
|
|
233
225
|
0% {
|
|
234
226
|
transform: translateX(-50%) translateY(-50%) rotate(0deg);
|
|
235
227
|
}
|
|
236
|
-
|
|
237
228
|
100% {
|
|
238
229
|
transform: translateX(-50%) translateY(-50%) rotate(360deg);
|
|
239
230
|
}
|
package/utils/Readme.md
CHANGED
|
@@ -1,7 +1,4 @@
|
|
|
1
1
|

|
|
2
2
|
|
|
3
3
|
# Utils
|
|
4
|
-
`import utils from 'aw-front-helpers/utils';` to import
|
|
5
|
-
|
|
6
|
-
## dom
|
|
7
|
-
- `utils.dom.getClosest(element, selector)` to get a parent element
|
|
4
|
+
`import utils from 'aw-front-helpers/utils';` to import
|