@creative-web-solution/front-library 6.1.3 → 6.2.9
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 +52 -1
- package/DOM/Class.js +1 -1
- package/DOM/OuterSize.js +1 -1
- package/DOM/matrix.js +1 -1
- package/DOM/size.js +1 -1
- package/DOM/wrap.js +2 -2
- package/Events/EventsManager.js +39 -81
- package/Events/HistoryController.js +3 -3
- package/Events/ImageLoad.js +1 -1
- package/Events/IntersectObserver.js +3 -2
- package/Events/KeyboardHandler.js +2 -2
- package/Events/MediaQueriesEvents.js +2 -2
- package/Events/TouchHover.js +3 -3
- package/Events/WindowEvents.js +3 -3
- package/Events/gesture.js +2 -2
- package/Events/onAnimationEnd.js +37 -33
- package/Events/onTransitionEnd.js +38 -29
- package/Events/pubSub.js +2 -2
- package/Helpers/Cookie.js +1 -1
- package/Helpers/TransitionHelpers.js +95 -0
- package/Helpers/extend.js +1 -1
- package/Helpers/getValue.js +1 -1
- package/Helpers/sequential.js +1 -1
- package/Helpers/wait.js +1 -1
- package/ModernizrAddons/css-var-support.js +3 -0
- package/ModernizrAddons/touchdevice.js +1 -1
- package/Modules/Accordion.js +12 -6
- package/Modules/Autocomplete.js +7 -7
- package/Modules/DragSlider.js +583 -0
- package/Modules/Notifications.js +8 -8
- package/Modules/Popin.js +8 -8
- package/Modules/ScrollSnap.js +8 -8
- package/Modules/SkinCheckbox.js +2 -2
- package/Modules/SkinFile.js +4 -4
- package/Modules/SkinRadio.js +3 -3
- package/Modules/SkinSelect.js +12 -12
- package/Modules/Slider.js +100 -32
- package/Modules/Tabs.js +5 -5
- package/Modules/Validator/Tools/RadioButton.js +1 -1
- package/Modules/Validator/Tools/ValidationState.js +1 -1
- package/Modules/Validator/Tools/getQueryFromForm.js +1 -1
- package/Modules/Validator/date.js +3 -3
- package/Modules/Validator/email.js +3 -3
- package/Modules/Validator/equals.js +3 -3
- package/Modules/Validator/index.js +6 -6
- package/Modules/Validator/max.js +2 -2
- package/Modules/Validator/maxlength.js +2 -2
- package/Modules/Validator/min.js +2 -2
- package/Modules/Validator/minlength.js +2 -2
- package/Modules/Validator/multiRequired.js +5 -5
- package/Modules/Validator/number.js +3 -3
- package/Modules/Validator/pattern.js +2 -2
- package/Modules/Validator/recaptcha.js +2 -2
- package/Modules/Validator/required.js +4 -4
- package/Modules/Validator/serverCheck.js +3 -3
- package/Modules/Validator/url.js +3 -3
- package/Modules/YouTubePlayer.js +2 -2
- package/Modules/globalState.js +1 -1
- package/README.md +3 -3
- package/Tools/PrefixedProperties.js +54 -0
- package/Tools/TouchDeviceSupport.js +1 -0
- package/WebGL/GLImageTransition/GLImageTransition.js +4 -4
- package/documentation/extra/events.md +2 -2
- package/documentation/extra/modernizr.md +1 -0
- package/documentation/extra/modules/DragSlider.md +111 -0
- package/documentation/extra/modules/YouTubePlayer.md +1 -1
- package/documentation/extra/modules/autocomplete.md +1 -1
- package/documentation/extra/modules/popin.md +3 -3
- package/documentation/extra/modules/slider.md +7 -3
- package/documentation/extra/modules/template.md +1 -1
- package/documentation/extra/modules/validator.md +13 -13
- package/documentation/extra/webgl/GLImageTransition.md +1 -1
- package/documentation/jsdocs/dom/global.html +389 -2
- package/documentation/jsdocs/dom/index.html +2 -2
- package/documentation/jsdocs/dom/quicksearch.html +1 -1
- package/documentation/jsdocs/events/common/DeviceOrientation.html +1 -1
- package/documentation/jsdocs/events/common/HistoryController.html +1 -1
- package/documentation/jsdocs/events/common/IntersectObserver.html +1 -1
- package/documentation/jsdocs/events/common/KeyboardHandler.html +1 -1
- package/documentation/jsdocs/events/common/MediaQueriesEvents.html +1 -1
- package/documentation/jsdocs/events/common/TouchHover.html +1 -1
- package/documentation/jsdocs/events/common/WindowEvents.html +1 -1
- package/documentation/jsdocs/events/common/classes.list.html +1 -1
- package/documentation/jsdocs/events/common/global.html +1 -1
- package/documentation/jsdocs/events/common/index.html +1 -1
- package/documentation/jsdocs/events/common/namespaces.list.html +1 -1
- package/documentation/jsdocs/events/common/pubSub.html +1 -1
- package/documentation/jsdocs/events/common/quicksearch.html +1 -1
- package/documentation/jsdocs/events/events-manager/global.html +1 -1
- package/documentation/jsdocs/events/events-manager/index.html +1 -1
- package/documentation/jsdocs/events/events-manager/quicksearch.html +1 -1
- package/documentation/jsdocs/events/gesture/global.html +1 -1
- package/documentation/jsdocs/events/gesture/index.html +1 -1
- package/documentation/jsdocs/events/gesture/quicksearch.html +1 -1
- package/documentation/jsdocs/helpers/array/global.html +1 -1
- package/documentation/jsdocs/helpers/array/index.html +1 -1
- package/documentation/jsdocs/helpers/array/quicksearch.html +1 -1
- package/documentation/jsdocs/helpers/colors/global.html +1 -1
- package/documentation/jsdocs/helpers/colors/index.html +1 -1
- package/documentation/jsdocs/helpers/colors/quicksearch.html +1 -1
- package/documentation/jsdocs/helpers/common/Cookie.html +2 -2
- package/documentation/jsdocs/helpers/common/UrlParser.html +1 -1
- package/documentation/jsdocs/helpers/common/classes.list.html +1 -1
- package/documentation/jsdocs/helpers/common/global.html +8 -2
- package/documentation/jsdocs/helpers/common/index.html +1 -1
- package/documentation/jsdocs/helpers/common/quicksearch.html +1 -1
- package/documentation/jsdocs/helpers/types/global.html +1 -1
- package/documentation/jsdocs/helpers/types/index.html +1 -1
- package/documentation/jsdocs/helpers/types/quicksearch.html +1 -1
- package/documentation/jsdocs/modules/accordion/Accordion.html +1 -1
- package/documentation/jsdocs/modules/accordion/classes.list.html +1 -1
- package/documentation/jsdocs/modules/accordion/index.html +1 -1
- package/documentation/jsdocs/modules/accordion/quicksearch.html +1 -1
- package/documentation/jsdocs/modules/autocomplete/Autocomplete.html +1 -1
- package/documentation/jsdocs/modules/autocomplete/classes.list.html +1 -1
- package/documentation/jsdocs/modules/autocomplete/index.html +1 -1
- package/documentation/jsdocs/modules/autocomplete/quicksearch.html +1 -1
- package/documentation/jsdocs/modules/common/DragSlider.html +946 -0
- package/documentation/jsdocs/modules/common/classes.list.html +310 -0
- package/documentation/jsdocs/modules/common/global.html +8 -1
- package/documentation/jsdocs/modules/common/globalState.html +8 -1
- package/documentation/jsdocs/modules/common/index.html +8 -1
- package/documentation/jsdocs/modules/common/namespaces.list.html +15 -1
- package/documentation/jsdocs/modules/common/quicksearch.html +1 -1
- package/documentation/jsdocs/modules/form-skin/SkinCheckbox.html +1 -1
- package/documentation/jsdocs/modules/form-skin/SkinFile.html +1 -1
- package/documentation/jsdocs/modules/form-skin/SkinRadio.html +1 -1
- package/documentation/jsdocs/modules/form-skin/SkinSelect.html +1 -1
- package/documentation/jsdocs/modules/form-skin/classes.list.html +1 -1
- package/documentation/jsdocs/modules/form-skin/global.html +1 -1
- package/documentation/jsdocs/modules/form-skin/index.html +1 -1
- package/documentation/jsdocs/modules/form-skin/quicksearch.html +1 -1
- package/documentation/jsdocs/modules/media-preloader/MediaPreloader.html +1 -1
- package/documentation/jsdocs/modules/media-preloader/classes.list.html +1 -1
- package/documentation/jsdocs/modules/media-preloader/index.html +1 -1
- package/documentation/jsdocs/modules/media-preloader/quicksearch.html +1 -1
- package/documentation/jsdocs/modules/notifications/Notifications.html +1 -1
- package/documentation/jsdocs/modules/notifications/classes.list.html +1 -1
- package/documentation/jsdocs/modules/notifications/index.html +1 -1
- package/documentation/jsdocs/modules/notifications/quicksearch.html +1 -1
- package/documentation/jsdocs/modules/popin/Popin.html +1 -1
- package/documentation/jsdocs/modules/popin/PopinController.html +1 -1
- package/documentation/jsdocs/modules/popin/classes.list.html +1 -1
- package/documentation/jsdocs/modules/popin/index.html +1 -1
- package/documentation/jsdocs/modules/popin/quicksearch.html +1 -1
- package/documentation/jsdocs/modules/scroll-snap/ScrollSnap.html +1 -1
- package/documentation/jsdocs/modules/scroll-snap/classes.list.html +1 -1
- package/documentation/jsdocs/modules/scroll-snap/index.html +1 -1
- package/documentation/jsdocs/modules/scroll-snap/quicksearch.html +1 -1
- package/documentation/jsdocs/modules/slider/Slider.html +1 -1
- package/documentation/jsdocs/modules/slider/SliderControls.html +159 -2
- package/documentation/jsdocs/modules/slider/classes.list.html +1 -1
- package/documentation/jsdocs/modules/slider/index.html +1 -1
- package/documentation/jsdocs/modules/slider/quicksearch.html +1 -1
- package/documentation/jsdocs/modules/tabs/Tabs.html +1 -1
- package/documentation/jsdocs/modules/tabs/classes.list.html +1 -1
- package/documentation/jsdocs/modules/tabs/index.html +1 -1
- package/documentation/jsdocs/modules/tabs/quicksearch.html +1 -1
- package/documentation/jsdocs/modules/validator/Validator.html +1 -1
- package/documentation/jsdocs/modules/validator/classes.list.html +1 -1
- package/documentation/jsdocs/modules/validator/global.html +1 -1
- package/documentation/jsdocs/modules/validator/index.html +1 -1
- package/documentation/jsdocs/modules/validator/quicksearch.html +1 -1
- package/documentation/jsdocs/modules/youtube-player/YouTubePlayer.html +1 -1
- package/documentation/jsdocs/modules/youtube-player/classes.list.html +1 -1
- package/documentation/jsdocs/modules/youtube-player/index.html +1 -1
- package/documentation/jsdocs/modules/youtube-player/quicksearch.html +1 -1
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,6 +1,57 @@
|
|
|
1
1
|
# CHANGELOG
|
|
2
2
|
|
|
3
3
|
|
|
4
|
+
## 6.2.9
|
|
5
|
+
|
|
6
|
+
* Add transition helper
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
## 6.2.8
|
|
10
|
+
|
|
11
|
+
* Transition and animation end: Handle properties filter and pseudo elements
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
## 6.2.7
|
|
15
|
+
|
|
16
|
+
* Custom Events: Add target element as param of the callback function on delegated event
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
## 6.2.6
|
|
20
|
+
|
|
21
|
+
* Slider: add a function to get all slides of a page + Add the pageIndex in slide's properties
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
## 6.2.5
|
|
25
|
+
|
|
26
|
+
* Slider: expose list of slide objects + expose page number for each slide
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
## 6.2.4
|
|
30
|
+
|
|
31
|
+
* Accordion: add an option to avoid closing all tabs
|
|
32
|
+
|
|
33
|
+
|
|
34
|
+
## 6.2.3
|
|
35
|
+
|
|
36
|
+
* Update DragSlider module
|
|
37
|
+
|
|
38
|
+
|
|
39
|
+
## 6.2.2
|
|
40
|
+
|
|
41
|
+
* Add DragSlider module
|
|
42
|
+
* Update touchdevice detection method
|
|
43
|
+
* Slider:
|
|
44
|
+
* Add function to start and stop auto slide
|
|
45
|
+
* Fix display when no loop and several slides per page
|
|
46
|
+
|
|
47
|
+
|
|
48
|
+
## 6.2.1
|
|
49
|
+
|
|
50
|
+
* Add a scope to the package name for NPM publish
|
|
51
|
+
* Update doc
|
|
52
|
+
* Add CSS custom variable Modernizr test
|
|
53
|
+
|
|
54
|
+
|
|
4
55
|
## 6.1.3
|
|
5
56
|
|
|
6
57
|
* Add CSS property setter/getter function
|
|
@@ -145,7 +196,7 @@
|
|
|
145
196
|
* Validator
|
|
146
197
|
* Add live validation system
|
|
147
198
|
* Add getQueryFromForm function
|
|
148
|
-
* Update validator scaffolding. Split everything that was in `import { validatorTools } from 'front-library/Modules/Validator';` in the
|
|
199
|
+
* Update validator scaffolding. Split everything that was in `import { validatorTools } from '@creative-web-solution/front-library/Modules/Validator';` in the `@creative-web-solution/front-library/Modules/Validator/Tools` folder.
|
|
149
200
|
|
|
150
201
|
|
|
151
202
|
## 6.0.1
|
package/DOM/Class.js
CHANGED
package/DOM/OuterSize.js
CHANGED
package/DOM/matrix.js
CHANGED
package/DOM/size.js
CHANGED
package/DOM/wrap.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { strToDOM } from 'front-library/DOM/strToDOM';
|
|
2
|
-
import { isString } from 'front-library/Helpers/Type';
|
|
1
|
+
import { strToDOM } from '@creative-web-solution/front-library/DOM/strToDOM';
|
|
2
|
+
import { isString } from '@creative-web-solution/front-library/Helpers/Type';
|
|
3
3
|
|
|
4
4
|
/**
|
|
5
5
|
* Wrap a DOM element in another
|
package/Events/EventsManager.js
CHANGED
|
@@ -1,17 +1,22 @@
|
|
|
1
|
-
import { slice } from '
|
|
1
|
+
import { slice } from '../Helpers/Slice';
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
let passiveSupported = false,
|
|
5
|
+
createEvt,
|
|
6
|
+
DOMRegistry = [],
|
|
7
|
+
ObjectRegistry = [];
|
|
2
8
|
|
|
3
|
-
let passiveSupported = false, DOMRegistry = [], ObjectRegistry = [], createEvt;
|
|
4
9
|
|
|
5
10
|
(function () {
|
|
6
|
-
if ( typeof window.CustomEvent ===
|
|
7
|
-
return
|
|
11
|
+
if ( typeof window.CustomEvent === 'function' ) {
|
|
12
|
+
return;
|
|
8
13
|
}
|
|
9
14
|
|
|
10
15
|
function CustomEvent ( event, params ) {
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
16
|
+
params = params || { bubbles: false, cancelable: false, detail: undefined };
|
|
17
|
+
const evt = document.createEvent( 'CustomEvent' );
|
|
18
|
+
evt.initCustomEvent( event, params.bubbles, params.cancelable, params.detail );
|
|
19
|
+
return evt;
|
|
15
20
|
}
|
|
16
21
|
|
|
17
22
|
CustomEvent.prototype = window.Event.prototype;
|
|
@@ -43,18 +48,20 @@ let passiveSupported = false, DOMRegistry = [], ObjectRegistry = [], createEvt;
|
|
|
43
48
|
}
|
|
44
49
|
}() );
|
|
45
50
|
|
|
51
|
+
function passiveTestFnc() {return;}
|
|
46
52
|
|
|
47
53
|
(function () {
|
|
48
54
|
try {
|
|
49
|
-
|
|
55
|
+
const options = Object.defineProperty( {}, 'passive', {
|
|
50
56
|
"get": () => {
|
|
51
57
|
passiveSupported = true;
|
|
52
58
|
return true;
|
|
53
59
|
}
|
|
54
60
|
} );
|
|
55
61
|
|
|
56
|
-
|
|
57
|
-
window.
|
|
62
|
+
|
|
63
|
+
window.addEventListener( 'test', passiveTestFnc, options );
|
|
64
|
+
window.removeEventListener( 'test', passiveTestFnc, options );
|
|
58
65
|
}
|
|
59
66
|
catch( err ) {
|
|
60
67
|
passiveSupported = false;
|
|
@@ -64,13 +71,13 @@ let passiveSupported = false, DOMRegistry = [], ObjectRegistry = [], createEvt;
|
|
|
64
71
|
|
|
65
72
|
function getDelegation( $element, selector, callback ) {
|
|
66
73
|
return e => {
|
|
67
|
-
|
|
74
|
+
const $target = e.target.closest( selector );
|
|
68
75
|
|
|
69
76
|
if ( !$target || !$element.contains( $target ) ) {
|
|
70
77
|
return;
|
|
71
78
|
}
|
|
72
79
|
|
|
73
|
-
callback.call( $target, e );
|
|
80
|
+
callback.call( $target, e, $target );
|
|
74
81
|
};
|
|
75
82
|
}
|
|
76
83
|
|
|
@@ -101,36 +108,20 @@ function _useNativeDOMEvents( $element ) {
|
|
|
101
108
|
|
|
102
109
|
/**
|
|
103
110
|
* Indicate if the browser natively support passive event
|
|
104
|
-
*
|
|
105
|
-
* @name handlePassiveEvents
|
|
106
|
-
* @type {Boolean}
|
|
107
111
|
*/
|
|
108
112
|
export const handlePassiveEvents = passiveSupported;
|
|
109
113
|
|
|
110
114
|
|
|
111
115
|
/**
|
|
112
116
|
* Add an event listener
|
|
113
|
-
*
|
|
114
|
-
* @function on
|
|
115
|
-
*
|
|
116
|
-
* @param { HTMLElement|Object|HTMLElement[]|Object[] } $elements
|
|
117
|
-
* @param { Object } options
|
|
118
|
-
* @param { String } options.eventsName - Name of events separate by a space
|
|
119
|
-
* @param { Function } options.callback - Callback function
|
|
120
|
-
* @param { String } [options.selector] - Css selector used for event delegation
|
|
121
|
-
* @param { Boolean } [options.capture] - Active or not capture event.
|
|
122
|
-
* @param { Object } [options.eventOptions] - Native addEventListener options. Priority to options.capture if it's present.
|
|
123
|
-
* @param { Boolean } [options.eventOptions.capure]
|
|
124
|
-
* @param { Boolean } [options.eventOptions.once]
|
|
125
|
-
* @param { Boolean } [options.eventOptions.passive]
|
|
126
117
|
*/
|
|
127
118
|
export const on = function( $elements, options ) {
|
|
128
119
|
let eventOptions;
|
|
129
120
|
|
|
130
|
-
$
|
|
121
|
+
const $ELEM_ARRAY = normalizeElements( $elements );
|
|
131
122
|
|
|
132
123
|
if ( !options.eventsName ) {
|
|
133
|
-
throw '[EVENT MANAGER]: Missing event
|
|
124
|
+
throw '[EVENT MANAGER]: Missing event name';
|
|
134
125
|
}
|
|
135
126
|
|
|
136
127
|
if ( !options.callback ) {
|
|
@@ -145,15 +136,15 @@ export const on = function( $elements, options ) {
|
|
|
145
136
|
}
|
|
146
137
|
|
|
147
138
|
options.eventsName.split( ' ' ).forEach( eventName => {
|
|
148
|
-
$
|
|
139
|
+
$ELEM_ARRAY.forEach( $element => {
|
|
149
140
|
if ( exists( $element, eventName, options ) ) {
|
|
150
141
|
return;
|
|
151
142
|
}
|
|
152
143
|
|
|
153
|
-
|
|
154
|
-
|
|
144
|
+
const useNativeDOMEvents = _useNativeDOMEvents( $element );
|
|
145
|
+
const cbFunction = options._internalCallback || options.callback;
|
|
155
146
|
|
|
156
|
-
|
|
147
|
+
const data = {
|
|
157
148
|
$element,
|
|
158
149
|
eventName,
|
|
159
150
|
options
|
|
@@ -180,20 +171,6 @@ export const on = function( $elements, options ) {
|
|
|
180
171
|
|
|
181
172
|
/**
|
|
182
173
|
* Add an event listener fired only one time
|
|
183
|
-
*
|
|
184
|
-
* @function one
|
|
185
|
-
*
|
|
186
|
-
* @param { HTMLElement|Object|HTMLElement[]|Object[] } $elements
|
|
187
|
-
* @param { Object } options
|
|
188
|
-
* @param { String } options.eventsName - Name of events separate by a space
|
|
189
|
-
* @param { String } [options.selector] - Css selector used for event delegation
|
|
190
|
-
* @param { Functio } options.callback - Callback function
|
|
191
|
-
* @param { Boolean } [options.capture] - Active or not capture event.
|
|
192
|
-
* @param { Object } [options.eventOptions] - Native addEventListener options. Priority to options.capture if it's present.
|
|
193
|
-
* @param { Boolean } [options.eventOptions.capure]
|
|
194
|
-
* @param { Boolean } [options.eventOptions.once]
|
|
195
|
-
* @param { Boolean } [options.eventOptions.passive]
|
|
196
|
-
*
|
|
197
174
|
*/
|
|
198
175
|
export const one = function( $elements, options ) {
|
|
199
176
|
|
|
@@ -211,26 +188,19 @@ export const one = function( $elements, options ) {
|
|
|
211
188
|
|
|
212
189
|
/**
|
|
213
190
|
* Remove an event
|
|
214
|
-
*
|
|
215
|
-
* @function off
|
|
216
|
-
*
|
|
217
|
-
* @param { HTMLElement|Object|HTMLElement[]|Object[] } $elements
|
|
218
|
-
* @param { Object } options
|
|
219
|
-
* @param { String } options.eventsName - Name of events separate by space
|
|
220
|
-
* @param { Function } [options.callback] - Callback function
|
|
221
|
-
*
|
|
222
191
|
*/
|
|
223
|
-
export const off = function( $elements, options
|
|
224
|
-
|
|
192
|
+
export const off = function( $elements, options) {
|
|
193
|
+
|
|
194
|
+
const $ELEM_ARRAY = normalizeElements( $elements );
|
|
225
195
|
|
|
226
196
|
options.eventsName.split( ' ' ).forEach( eventName => {
|
|
227
|
-
$
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
let
|
|
197
|
+
$ELEM_ARRAY.forEach( $element => {
|
|
198
|
+
const useNativeDOMEvents = _useNativeDOMEvents( $element );
|
|
199
|
+
const removedItem = [];
|
|
200
|
+
let registry = useNativeDOMEvents ? DOMRegistry : ObjectRegistry;
|
|
231
201
|
|
|
232
202
|
registry.forEach( item => {
|
|
233
|
-
|
|
203
|
+
const callback = item.delegate || item.options._internalCallback || item.options.callback;
|
|
234
204
|
|
|
235
205
|
if ( !options.callback || options.callback === item.options.callback ) {
|
|
236
206
|
if ( useNativeDOMEvents ) {
|
|
@@ -257,33 +227,21 @@ export const off = function( $elements, options ) {
|
|
|
257
227
|
|
|
258
228
|
/**
|
|
259
229
|
* Fire an event
|
|
260
|
-
*
|
|
261
|
-
* @function fire
|
|
262
|
-
*
|
|
263
|
-
* @param { HTMLElement|Object|HTMLElement[]|Object[] } $elements
|
|
264
|
-
* @param { Object } options
|
|
265
|
-
* @param { String } options.eventsName - Name of events separate by space
|
|
266
|
-
* @param { Object } [options.detail] - Object to send with the event
|
|
267
|
-
* @param { Boolean } [options.bubbles=true] - Only used for DOMM
|
|
268
|
-
* @param { Boolean } [options.cancelable=true] - Only used for DOMM
|
|
269
|
-
*
|
|
270
230
|
*/
|
|
271
231
|
export const fire = function( $elements, options ) {
|
|
272
|
-
$
|
|
232
|
+
const $ELEM_ARRAY = normalizeElements( $elements );
|
|
273
233
|
|
|
274
234
|
options.eventsName.split(' ').forEach( eventName => {
|
|
275
|
-
$
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
if ( useNativeDOMEvents ) {
|
|
235
|
+
$ELEM_ARRAY.forEach( $element => {
|
|
236
|
+
if ( _useNativeDOMEvents( $element ) ) {
|
|
279
237
|
$element.dispatchEvent( createEvt( eventName, options ) );
|
|
280
238
|
return;
|
|
281
239
|
}
|
|
282
240
|
|
|
283
|
-
|
|
241
|
+
const eventData = ObjectRegistry.filter( reg => reg.$element === $element && reg.eventName === eventName );
|
|
284
242
|
|
|
285
243
|
eventData.forEach( reg => {
|
|
286
|
-
reg.options[ reg.options._internalCallback ? '_internalCallback' : 'callback' ]
|
|
244
|
+
reg.options[ reg.options._internalCallback ? '_internalCallback' : 'callback' ]?.call( reg.$element, options.detail );
|
|
287
245
|
} );
|
|
288
246
|
} );
|
|
289
247
|
} );
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { on } from 'front-library/Events/EventsManager';
|
|
2
|
-
import { UrlParser } from 'front-library/Helpers/UrlParser';
|
|
3
|
-
import { slice } from 'front-library/Helpers/slice';
|
|
1
|
+
import { on } from '@creative-web-solution/front-library/Events/EventsManager';
|
|
2
|
+
import { UrlParser } from '@creative-web-solution/front-library/Helpers/UrlParser';
|
|
3
|
+
import { slice } from '@creative-web-solution/front-library/Helpers/slice';
|
|
4
4
|
|
|
5
5
|
/**
|
|
6
6
|
* @typedef {object} state_Object
|
package/Events/ImageLoad.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { extend } from 'front-library/Helpers/Extend';
|
|
2
|
-
import { slice } from 'front-library/Helpers/slice';
|
|
1
|
+
import { extend } from '@creative-web-solution/front-library/Helpers/Extend';
|
|
2
|
+
import { slice } from '@creative-web-solution/front-library/Helpers/slice';
|
|
3
3
|
|
|
4
4
|
/**
|
|
5
5
|
* @callback IntersectObserver_Handler
|
|
@@ -91,6 +91,7 @@ export function IntersectObserver( options ) {
|
|
|
91
91
|
}
|
|
92
92
|
|
|
93
93
|
ELEMENT_OBSERVER.observe( $element );
|
|
94
|
+
OBSERVED_ELEMENTS.push( $element );
|
|
94
95
|
}
|
|
95
96
|
|
|
96
97
|
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { on, off } from 'front-library/Events/EventsManager';
|
|
2
|
-
import { extend } from 'front-library/Helpers/Extend';
|
|
1
|
+
import { on, off } from '@creative-web-solution/front-library/Events/EventsManager';
|
|
2
|
+
import { extend } from '@creative-web-solution/front-library/Helpers/Extend';
|
|
3
3
|
|
|
4
4
|
/**
|
|
5
5
|
* @callback KeyboardHandler_Callback
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { extend } from 'front-library/Helpers/Extend';
|
|
2
|
-
import { slice } from 'front-library/Helpers/slice';
|
|
1
|
+
import { extend } from '@creative-web-solution/front-library/Helpers/Extend';
|
|
2
|
+
import { slice } from '@creative-web-solution/front-library/Helpers/slice';
|
|
3
3
|
|
|
4
4
|
/**
|
|
5
5
|
* @callback MediaQueriesEvents_Handler
|
package/Events/TouchHover.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { gesture, gestureOff } from 'front-library/Events/Gesture';
|
|
2
|
-
import { rClass, aClass } from 'front-library/DOM/Class';
|
|
3
|
-
import { wait } from 'front-library/Helpers/wait';
|
|
1
|
+
import { gesture, gestureOff } from '@creative-web-solution/front-library/Events/Gesture';
|
|
2
|
+
import { rClass, aClass } from '@creative-web-solution/front-library/DOM/Class';
|
|
3
|
+
import { wait } from '@creative-web-solution/front-library/Helpers/wait';
|
|
4
4
|
|
|
5
5
|
|
|
6
6
|
/**
|
package/Events/WindowEvents.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { windowScroll } from 'front-library/DOM/windowScroll';
|
|
2
|
-
import { documentSize } from 'front-library/DOM/documentSize';
|
|
3
|
-
import { windowSize } from 'front-library/DOM/windowSize';
|
|
1
|
+
import { windowScroll } from '@creative-web-solution/front-library/DOM/windowScroll';
|
|
2
|
+
import { documentSize } from '@creative-web-solution/front-library/DOM/documentSize';
|
|
3
|
+
import { windowSize } from '@creative-web-solution/front-library/DOM/windowSize';
|
|
4
4
|
|
|
5
5
|
|
|
6
6
|
/**
|
package/Events/gesture.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { on, off } from 'front-library/Events/EventsManager';
|
|
2
|
-
import { extend } from 'front-library/Helpers/Extend';
|
|
1
|
+
import { on, off } from '@creative-web-solution/front-library/Events/EventsManager';
|
|
2
|
+
import { extend } from '@creative-web-solution/front-library/Helpers/Extend';
|
|
3
3
|
|
|
4
4
|
/**
|
|
5
5
|
* @callback gestureEvents_Callback
|
package/Events/onAnimationEnd.js
CHANGED
|
@@ -1,32 +1,12 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
const animationendEventName = ( function() {
|
|
4
|
-
let el, animation;
|
|
5
|
-
|
|
6
|
-
el = document.createElement( 'fakeelement' );
|
|
7
|
-
|
|
8
|
-
animation = {
|
|
9
|
-
"animation": "animationend",
|
|
10
|
-
"OAnimation": "oAnimationEnd",
|
|
11
|
-
"MozAnimation": "animationend",
|
|
12
|
-
"WebkitAnimation": "webkitAnimationEnd"
|
|
13
|
-
};
|
|
14
|
-
|
|
15
|
-
for ( let t in animation ) {
|
|
16
|
-
if ( el.style[ t ] !== undefined ) {
|
|
17
|
-
return animation[ t ];
|
|
18
|
-
}
|
|
19
|
-
}
|
|
20
|
-
} )();
|
|
1
|
+
import { animationendEventName } from '../Tools/PrefixedProperties';
|
|
21
2
|
|
|
22
3
|
|
|
23
4
|
/**
|
|
24
5
|
* Bind a one time animationend event on a DOM object
|
|
25
|
-
* @function onAnimationEnd
|
|
26
6
|
*
|
|
27
|
-
* @
|
|
28
|
-
*
|
|
29
|
-
*
|
|
7
|
+
* @example
|
|
8
|
+
* ```js
|
|
9
|
+
* onAnimationEnd( $elem ).then( () => {} );
|
|
30
10
|
*
|
|
31
11
|
* // To remove the event binding, don't chain .then() directly after onAnimationEnd:
|
|
32
12
|
* let animationEnd = onAnimationEnd( $element );
|
|
@@ -34,28 +14,52 @@ const animationendEventName = ( function() {
|
|
|
34
14
|
*
|
|
35
15
|
* animationEnd.off()
|
|
36
16
|
*
|
|
37
|
-
*
|
|
17
|
+
* // To watch for a animation end:
|
|
18
|
+
* onAnimationEnd( $elem, {
|
|
19
|
+
* "animationName": [ "name-of-my-css-animation" ]
|
|
20
|
+
* } )
|
|
21
|
+
*
|
|
22
|
+
* // To watch a animation end on a pseudo element like "::after":
|
|
23
|
+
* onAnimationEnd( $elem, {
|
|
24
|
+
* "pseudoElement": "after"
|
|
25
|
+
* } )
|
|
26
|
+
* ```
|
|
27
|
+
*
|
|
28
|
+
* @returns Return a standard Promise + an .off() function to cancel event
|
|
38
29
|
*/
|
|
39
|
-
export function onAnimationEnd( $
|
|
40
|
-
let
|
|
30
|
+
export default function onAnimationEnd( $element, options = {} ) {
|
|
31
|
+
let _resolve;
|
|
32
|
+
|
|
33
|
+
const promise = new Promise( function( resolve ) {
|
|
34
|
+
_resolve = resolve;
|
|
35
|
+
} );
|
|
36
|
+
|
|
41
37
|
|
|
42
38
|
function remove() {
|
|
43
|
-
$
|
|
39
|
+
$element.removeEventListener( animationendEventName, onAnimationEnd );
|
|
44
40
|
}
|
|
45
41
|
|
|
46
42
|
function onAnimationEnd( e ) {
|
|
47
|
-
if (
|
|
43
|
+
if (
|
|
44
|
+
e.target !== $element ||
|
|
45
|
+
( options.animationName && !options.animationName.includes( e.animationName ) ) ||
|
|
46
|
+
( options.pseudoElement === 'after' && e.pseudoElement !== '::after' ) ||
|
|
47
|
+
( options.pseudoElement === 'before' && e.pseudoElement !== '::before' ) ||
|
|
48
|
+
( options.pseudoElement === 'both' && !e.pseudoElement ) ||
|
|
49
|
+
( !options.pseudoElement && e.pseudoElement !== '' )
|
|
50
|
+
) {
|
|
48
51
|
return;
|
|
49
52
|
}
|
|
50
53
|
|
|
51
54
|
remove();
|
|
52
55
|
|
|
53
|
-
|
|
56
|
+
_resolve( [ e, $element ] );
|
|
54
57
|
}
|
|
55
58
|
|
|
56
|
-
$elem.addEventListener( animationendEventName, onAnimationEnd, false );
|
|
57
59
|
|
|
58
|
-
|
|
60
|
+
$element.addEventListener( animationendEventName, onAnimationEnd, false );
|
|
61
|
+
|
|
62
|
+
promise.off = remove;
|
|
59
63
|
|
|
60
|
-
return
|
|
64
|
+
return promise;
|
|
61
65
|
}
|
|
@@ -1,41 +1,40 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
const transitionendEventName = ( function() {
|
|
5
|
-
let el = document.createElement( 'fakeelement' );
|
|
6
|
-
let transitions = {
|
|
7
|
-
"transition": "transitionend",
|
|
8
|
-
"OTransition": "oTransitionEnd",
|
|
9
|
-
"MozTransition": "transitionend",
|
|
10
|
-
"WebkitTransition": "webkitTransitionEnd"
|
|
11
|
-
};
|
|
12
|
-
|
|
13
|
-
for ( let t in transitions ) {
|
|
14
|
-
if ( typeof el.style[ t ] !== 'undefined' ) {
|
|
15
|
-
return transitions[ t ];
|
|
16
|
-
}
|
|
17
|
-
}
|
|
18
|
-
} )();
|
|
1
|
+
import { transitionendEventName } from '../Tools/PrefixedProperties';
|
|
19
2
|
|
|
20
3
|
|
|
21
4
|
/**
|
|
22
5
|
* Bind a one time transitionend event on a DOM object
|
|
23
|
-
* @function onTransitionEnd
|
|
24
|
-
*
|
|
25
|
-
* @param {HTMLElement} $element
|
|
26
6
|
*
|
|
27
|
-
* @example
|
|
7
|
+
* @example
|
|
8
|
+
* onTransitionEnd( $elem ).then( () => `{}` );
|
|
28
9
|
*
|
|
10
|
+
* @example
|
|
11
|
+
* ```js
|
|
29
12
|
* // To remove the event binding, don't chain .then() directly after onTransitionEnd:
|
|
30
13
|
* let transitionEnd = onTransitionEnd( $element );
|
|
31
14
|
* transitionEnd.then( () => {} );
|
|
32
15
|
*
|
|
33
16
|
* transitionEnd.off()
|
|
34
17
|
*
|
|
35
|
-
*
|
|
18
|
+
* // To watch for a specific CSS property transition end:
|
|
19
|
+
* onTransitionEnd( $elem, {
|
|
20
|
+
* "property": "opacity"
|
|
21
|
+
* } )
|
|
22
|
+
*
|
|
23
|
+
* // To watch a transition end on a pseudo element like "::after":
|
|
24
|
+
* onTransitionEnd( $elem, {
|
|
25
|
+
* "pseudoElement": "after"
|
|
26
|
+
* } )
|
|
27
|
+
* ```
|
|
28
|
+
*
|
|
29
|
+
* @returns Return a standard Promise + an .off() function to cancel event
|
|
36
30
|
*/
|
|
37
|
-
export function onTransitionEnd( $element ) {
|
|
38
|
-
let
|
|
31
|
+
export default function onTransitionEnd( $element, options = {} ) {
|
|
32
|
+
let _resolve;
|
|
33
|
+
|
|
34
|
+
const promise = new Promise( function( resolve ) {
|
|
35
|
+
_resolve = resolve;
|
|
36
|
+
} );
|
|
37
|
+
|
|
39
38
|
|
|
40
39
|
function remove() {
|
|
41
40
|
$element.removeEventListener(
|
|
@@ -44,23 +43,33 @@ export function onTransitionEnd( $element ) {
|
|
|
44
43
|
);
|
|
45
44
|
}
|
|
46
45
|
|
|
46
|
+
|
|
47
47
|
function onTransitionEnd( e ) {
|
|
48
|
-
if (
|
|
48
|
+
if (
|
|
49
|
+
e.target !== $element ||
|
|
50
|
+
( options.property && !options.property.includes( e.propertyName ) ) ||
|
|
51
|
+
( options.pseudoElement === 'after' && e.pseudoElement !== '::after' ) ||
|
|
52
|
+
( options.pseudoElement === 'before' && e.pseudoElement !== '::before' ) ||
|
|
53
|
+
( options.pseudoElement === 'both' && !e.pseudoElement ) ||
|
|
54
|
+
( !options.pseudoElement && e.pseudoElement !== '' )
|
|
55
|
+
) {
|
|
49
56
|
return;
|
|
50
57
|
}
|
|
51
58
|
|
|
52
59
|
remove();
|
|
53
60
|
|
|
54
|
-
|
|
61
|
+
_resolve( [ e, $element ] );
|
|
55
62
|
}
|
|
56
63
|
|
|
64
|
+
|
|
57
65
|
$element.addEventListener(
|
|
58
66
|
transitionendEventName,
|
|
59
67
|
onTransitionEnd,
|
|
60
68
|
false
|
|
61
69
|
);
|
|
62
70
|
|
|
63
|
-
deferred.off = remove;
|
|
64
71
|
|
|
65
|
-
|
|
72
|
+
promise.off = remove;
|
|
73
|
+
|
|
74
|
+
return promise;
|
|
66
75
|
}
|
package/Events/pubSub.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { on, off, fire } from 'front-library/Events/EventsManager';
|
|
2
|
-
import { isString } from 'front-library/Helpers/Type';
|
|
1
|
+
import { on, off, fire } from '@creative-web-solution/front-library/Events/EventsManager';
|
|
2
|
+
import { isString } from '@creative-web-solution/front-library/Helpers/Type';
|
|
3
3
|
|
|
4
4
|
|
|
5
5
|
function PubSub() {
|
package/Helpers/Cookie.js
CHANGED
|
@@ -13,7 +13,7 @@ let defaultOptions = {
|
|
|
13
13
|
*
|
|
14
14
|
* @example cookie.create( 'cookieName', 'cookieValue' )
|
|
15
15
|
* cookie.read( 'cookieName' )
|
|
16
|
-
* cookie.
|
|
16
|
+
* cookie.delete( 'cookieName' )
|
|
17
17
|
*
|
|
18
18
|
* // All parameters
|
|
19
19
|
* cookie.create( 'cookieName', 'cookieValue', {
|