@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.
Files changed (168) hide show
  1. package/CHANGELOG.md +52 -1
  2. package/DOM/Class.js +1 -1
  3. package/DOM/OuterSize.js +1 -1
  4. package/DOM/matrix.js +1 -1
  5. package/DOM/size.js +1 -1
  6. package/DOM/wrap.js +2 -2
  7. package/Events/EventsManager.js +39 -81
  8. package/Events/HistoryController.js +3 -3
  9. package/Events/ImageLoad.js +1 -1
  10. package/Events/IntersectObserver.js +3 -2
  11. package/Events/KeyboardHandler.js +2 -2
  12. package/Events/MediaQueriesEvents.js +2 -2
  13. package/Events/TouchHover.js +3 -3
  14. package/Events/WindowEvents.js +3 -3
  15. package/Events/gesture.js +2 -2
  16. package/Events/onAnimationEnd.js +37 -33
  17. package/Events/onTransitionEnd.js +38 -29
  18. package/Events/pubSub.js +2 -2
  19. package/Helpers/Cookie.js +1 -1
  20. package/Helpers/TransitionHelpers.js +95 -0
  21. package/Helpers/extend.js +1 -1
  22. package/Helpers/getValue.js +1 -1
  23. package/Helpers/sequential.js +1 -1
  24. package/Helpers/wait.js +1 -1
  25. package/ModernizrAddons/css-var-support.js +3 -0
  26. package/ModernizrAddons/touchdevice.js +1 -1
  27. package/Modules/Accordion.js +12 -6
  28. package/Modules/Autocomplete.js +7 -7
  29. package/Modules/DragSlider.js +583 -0
  30. package/Modules/Notifications.js +8 -8
  31. package/Modules/Popin.js +8 -8
  32. package/Modules/ScrollSnap.js +8 -8
  33. package/Modules/SkinCheckbox.js +2 -2
  34. package/Modules/SkinFile.js +4 -4
  35. package/Modules/SkinRadio.js +3 -3
  36. package/Modules/SkinSelect.js +12 -12
  37. package/Modules/Slider.js +100 -32
  38. package/Modules/Tabs.js +5 -5
  39. package/Modules/Validator/Tools/RadioButton.js +1 -1
  40. package/Modules/Validator/Tools/ValidationState.js +1 -1
  41. package/Modules/Validator/Tools/getQueryFromForm.js +1 -1
  42. package/Modules/Validator/date.js +3 -3
  43. package/Modules/Validator/email.js +3 -3
  44. package/Modules/Validator/equals.js +3 -3
  45. package/Modules/Validator/index.js +6 -6
  46. package/Modules/Validator/max.js +2 -2
  47. package/Modules/Validator/maxlength.js +2 -2
  48. package/Modules/Validator/min.js +2 -2
  49. package/Modules/Validator/minlength.js +2 -2
  50. package/Modules/Validator/multiRequired.js +5 -5
  51. package/Modules/Validator/number.js +3 -3
  52. package/Modules/Validator/pattern.js +2 -2
  53. package/Modules/Validator/recaptcha.js +2 -2
  54. package/Modules/Validator/required.js +4 -4
  55. package/Modules/Validator/serverCheck.js +3 -3
  56. package/Modules/Validator/url.js +3 -3
  57. package/Modules/YouTubePlayer.js +2 -2
  58. package/Modules/globalState.js +1 -1
  59. package/README.md +3 -3
  60. package/Tools/PrefixedProperties.js +54 -0
  61. package/Tools/TouchDeviceSupport.js +1 -0
  62. package/WebGL/GLImageTransition/GLImageTransition.js +4 -4
  63. package/documentation/extra/events.md +2 -2
  64. package/documentation/extra/modernizr.md +1 -0
  65. package/documentation/extra/modules/DragSlider.md +111 -0
  66. package/documentation/extra/modules/YouTubePlayer.md +1 -1
  67. package/documentation/extra/modules/autocomplete.md +1 -1
  68. package/documentation/extra/modules/popin.md +3 -3
  69. package/documentation/extra/modules/slider.md +7 -3
  70. package/documentation/extra/modules/template.md +1 -1
  71. package/documentation/extra/modules/validator.md +13 -13
  72. package/documentation/extra/webgl/GLImageTransition.md +1 -1
  73. package/documentation/jsdocs/dom/global.html +389 -2
  74. package/documentation/jsdocs/dom/index.html +2 -2
  75. package/documentation/jsdocs/dom/quicksearch.html +1 -1
  76. package/documentation/jsdocs/events/common/DeviceOrientation.html +1 -1
  77. package/documentation/jsdocs/events/common/HistoryController.html +1 -1
  78. package/documentation/jsdocs/events/common/IntersectObserver.html +1 -1
  79. package/documentation/jsdocs/events/common/KeyboardHandler.html +1 -1
  80. package/documentation/jsdocs/events/common/MediaQueriesEvents.html +1 -1
  81. package/documentation/jsdocs/events/common/TouchHover.html +1 -1
  82. package/documentation/jsdocs/events/common/WindowEvents.html +1 -1
  83. package/documentation/jsdocs/events/common/classes.list.html +1 -1
  84. package/documentation/jsdocs/events/common/global.html +1 -1
  85. package/documentation/jsdocs/events/common/index.html +1 -1
  86. package/documentation/jsdocs/events/common/namespaces.list.html +1 -1
  87. package/documentation/jsdocs/events/common/pubSub.html +1 -1
  88. package/documentation/jsdocs/events/common/quicksearch.html +1 -1
  89. package/documentation/jsdocs/events/events-manager/global.html +1 -1
  90. package/documentation/jsdocs/events/events-manager/index.html +1 -1
  91. package/documentation/jsdocs/events/events-manager/quicksearch.html +1 -1
  92. package/documentation/jsdocs/events/gesture/global.html +1 -1
  93. package/documentation/jsdocs/events/gesture/index.html +1 -1
  94. package/documentation/jsdocs/events/gesture/quicksearch.html +1 -1
  95. package/documentation/jsdocs/helpers/array/global.html +1 -1
  96. package/documentation/jsdocs/helpers/array/index.html +1 -1
  97. package/documentation/jsdocs/helpers/array/quicksearch.html +1 -1
  98. package/documentation/jsdocs/helpers/colors/global.html +1 -1
  99. package/documentation/jsdocs/helpers/colors/index.html +1 -1
  100. package/documentation/jsdocs/helpers/colors/quicksearch.html +1 -1
  101. package/documentation/jsdocs/helpers/common/Cookie.html +2 -2
  102. package/documentation/jsdocs/helpers/common/UrlParser.html +1 -1
  103. package/documentation/jsdocs/helpers/common/classes.list.html +1 -1
  104. package/documentation/jsdocs/helpers/common/global.html +8 -2
  105. package/documentation/jsdocs/helpers/common/index.html +1 -1
  106. package/documentation/jsdocs/helpers/common/quicksearch.html +1 -1
  107. package/documentation/jsdocs/helpers/types/global.html +1 -1
  108. package/documentation/jsdocs/helpers/types/index.html +1 -1
  109. package/documentation/jsdocs/helpers/types/quicksearch.html +1 -1
  110. package/documentation/jsdocs/modules/accordion/Accordion.html +1 -1
  111. package/documentation/jsdocs/modules/accordion/classes.list.html +1 -1
  112. package/documentation/jsdocs/modules/accordion/index.html +1 -1
  113. package/documentation/jsdocs/modules/accordion/quicksearch.html +1 -1
  114. package/documentation/jsdocs/modules/autocomplete/Autocomplete.html +1 -1
  115. package/documentation/jsdocs/modules/autocomplete/classes.list.html +1 -1
  116. package/documentation/jsdocs/modules/autocomplete/index.html +1 -1
  117. package/documentation/jsdocs/modules/autocomplete/quicksearch.html +1 -1
  118. package/documentation/jsdocs/modules/common/DragSlider.html +946 -0
  119. package/documentation/jsdocs/modules/common/classes.list.html +310 -0
  120. package/documentation/jsdocs/modules/common/global.html +8 -1
  121. package/documentation/jsdocs/modules/common/globalState.html +8 -1
  122. package/documentation/jsdocs/modules/common/index.html +8 -1
  123. package/documentation/jsdocs/modules/common/namespaces.list.html +15 -1
  124. package/documentation/jsdocs/modules/common/quicksearch.html +1 -1
  125. package/documentation/jsdocs/modules/form-skin/SkinCheckbox.html +1 -1
  126. package/documentation/jsdocs/modules/form-skin/SkinFile.html +1 -1
  127. package/documentation/jsdocs/modules/form-skin/SkinRadio.html +1 -1
  128. package/documentation/jsdocs/modules/form-skin/SkinSelect.html +1 -1
  129. package/documentation/jsdocs/modules/form-skin/classes.list.html +1 -1
  130. package/documentation/jsdocs/modules/form-skin/global.html +1 -1
  131. package/documentation/jsdocs/modules/form-skin/index.html +1 -1
  132. package/documentation/jsdocs/modules/form-skin/quicksearch.html +1 -1
  133. package/documentation/jsdocs/modules/media-preloader/MediaPreloader.html +1 -1
  134. package/documentation/jsdocs/modules/media-preloader/classes.list.html +1 -1
  135. package/documentation/jsdocs/modules/media-preloader/index.html +1 -1
  136. package/documentation/jsdocs/modules/media-preloader/quicksearch.html +1 -1
  137. package/documentation/jsdocs/modules/notifications/Notifications.html +1 -1
  138. package/documentation/jsdocs/modules/notifications/classes.list.html +1 -1
  139. package/documentation/jsdocs/modules/notifications/index.html +1 -1
  140. package/documentation/jsdocs/modules/notifications/quicksearch.html +1 -1
  141. package/documentation/jsdocs/modules/popin/Popin.html +1 -1
  142. package/documentation/jsdocs/modules/popin/PopinController.html +1 -1
  143. package/documentation/jsdocs/modules/popin/classes.list.html +1 -1
  144. package/documentation/jsdocs/modules/popin/index.html +1 -1
  145. package/documentation/jsdocs/modules/popin/quicksearch.html +1 -1
  146. package/documentation/jsdocs/modules/scroll-snap/ScrollSnap.html +1 -1
  147. package/documentation/jsdocs/modules/scroll-snap/classes.list.html +1 -1
  148. package/documentation/jsdocs/modules/scroll-snap/index.html +1 -1
  149. package/documentation/jsdocs/modules/scroll-snap/quicksearch.html +1 -1
  150. package/documentation/jsdocs/modules/slider/Slider.html +1 -1
  151. package/documentation/jsdocs/modules/slider/SliderControls.html +159 -2
  152. package/documentation/jsdocs/modules/slider/classes.list.html +1 -1
  153. package/documentation/jsdocs/modules/slider/index.html +1 -1
  154. package/documentation/jsdocs/modules/slider/quicksearch.html +1 -1
  155. package/documentation/jsdocs/modules/tabs/Tabs.html +1 -1
  156. package/documentation/jsdocs/modules/tabs/classes.list.html +1 -1
  157. package/documentation/jsdocs/modules/tabs/index.html +1 -1
  158. package/documentation/jsdocs/modules/tabs/quicksearch.html +1 -1
  159. package/documentation/jsdocs/modules/validator/Validator.html +1 -1
  160. package/documentation/jsdocs/modules/validator/classes.list.html +1 -1
  161. package/documentation/jsdocs/modules/validator/global.html +1 -1
  162. package/documentation/jsdocs/modules/validator/index.html +1 -1
  163. package/documentation/jsdocs/modules/validator/quicksearch.html +1 -1
  164. package/documentation/jsdocs/modules/youtube-player/YouTubePlayer.html +1 -1
  165. package/documentation/jsdocs/modules/youtube-player/classes.list.html +1 -1
  166. package/documentation/jsdocs/modules/youtube-player/index.html +1 -1
  167. package/documentation/jsdocs/modules/youtube-player/quicksearch.html +1 -1
  168. package/package.json +1 -1
@@ -0,0 +1,95 @@
1
+ import onTransitionEnd from '../Events/OnTransitionEnd';
2
+ import onAnimationEnd from '../Events/OnAnimationEnd';
3
+ import { wait } from './Wait';
4
+
5
+
6
+ const KEY = Symbol( 'TransitionHelper' );
7
+
8
+
9
+ function addWatcher( $element, styleChange, isAnimation, options = {} ) {
10
+ if ( $element[ KEY ] ) {
11
+ $element[ KEY ].off();
12
+ }
13
+
14
+ if ( typeof options.delay !== undefined ) {
15
+ options.delay = 'idle'
16
+ }
17
+
18
+ $element[ KEY ] = isAnimation ?
19
+ onAnimationEnd( $element, {
20
+ "animationName": options.animationName,
21
+ "pseudoElement": options.pseudoElement
22
+ } ) :
23
+ onTransitionEnd( $element, {
24
+ "property": options.property,
25
+ "pseudoElement": options.pseudoElement
26
+ } );
27
+
28
+ wait( options.delay ).then( () => styleChange( $element ) );
29
+
30
+ $element[ KEY ].then( () => {
31
+ $element[ KEY ] = null;
32
+ return $element;
33
+ } );
34
+
35
+ return $element[ KEY ];
36
+ }
37
+
38
+
39
+ /**
40
+ * @param styleChange - Change the style of $element inside this function by adding a class or set a style property
41
+ * @param delay - Delay betwwen the add of the listener and call of styleChange.
42
+ *
43
+ * delay = 'idle' : window.requestIdleCallback
44
+ * delay < 0 : window.requestAnimationFrame
45
+ * delay >= 0 : setTimeout
46
+ *
47
+ * @example
48
+ * ```js
49
+ * // Watch for the end of the transition of the property "opacity" on the pseudo element ::after on $element
50
+ *
51
+ * const myWatcher = transitionWatcher( $elment, () => $element.classList.add('some-class'), {
52
+ * "pseudoElement": "after",
53
+ * "property": "opacity"
54
+ * } );
55
+ * ```
56
+ */
57
+ export function transitionWatcher( $element, styleChange, options ) {
58
+ return addWatcher( $element, styleChange, false, options );
59
+ }
60
+
61
+
62
+ /**
63
+ * @param animationStart - Start the animation of $element inside this function by adding a class or set a style property
64
+ * @param delay - Delay betwwen the add of the listener and call of animationStart.
65
+ *
66
+ * delay = 'idle' : window.requestIdleCallback
67
+ * delay < 0 : window.requestAnimationFrame
68
+ * delay >= 0 : setTimeout
69
+ *
70
+ * @example
71
+ * ```js
72
+ * //Watch for the end of the animation "my-animation" on the pseudo element ::after on $element
73
+ *
74
+ * const myWatcher = animationWatcher( $elment, () => $element.classList.add('some-class'), {
75
+ * "pseudoElement": "after",
76
+ * "animationName": ["my-animation"]
77
+ * } );
78
+ * ```
79
+ */
80
+ export function animationWatcher( $element, animationStart, options ) {
81
+ return addWatcher( $element, animationStart, true, options );
82
+ }
83
+
84
+
85
+ /**
86
+ * @example Kill a transition or animation watcher on $element
87
+ *
88
+ * killWatcher( $elment )
89
+ */
90
+ export function killWatcher( $element ) {
91
+ if ( $element[ KEY ] ) {
92
+ $element[ KEY ].off();
93
+ $element[ KEY ] = null;
94
+ }
95
+ }
package/Helpers/extend.js CHANGED
@@ -1,4 +1,4 @@
1
- import { isFunction, isArray, isPlainObject } from 'front-library/Helpers/Type';
1
+ import { isFunction, isArray, isPlainObject } from '@creative-web-solution/front-library/Helpers/Type';
2
2
 
3
3
 
4
4
  /**
@@ -1,4 +1,4 @@
1
- import { isString, isNumber } from 'front-library/Helpers/Type';
1
+ import { isString, isNumber } from '@creative-web-solution/front-library/Helpers/Type';
2
2
 
3
3
 
4
4
  function cleanFieldsValue( value ) {
@@ -1,4 +1,4 @@
1
- import { isArray } from 'front-library/Helpers/Type';
1
+ import { isArray } from '@creative-web-solution/front-library/Helpers/Type';
2
2
 
3
3
  /**
4
4
  * Create a sequential list of promises (which resolves one after another)
package/Helpers/wait.js CHANGED
@@ -1,4 +1,4 @@
1
- import { defer } from 'front-library/Helpers/defer';
1
+ import { defer } from '@creative-web-solution/front-library/Helpers/defer';
2
2
 
3
3
  /**
4
4
  * Return a promise and wait for 'waitFor' millisecond to resolve it.
@@ -0,0 +1,3 @@
1
+ Modernizr.addTest( 'cssvars', function() {
2
+ return window.CSS && CSS.supports('color', 'var(--fake-var)');;
3
+ } );
@@ -1,4 +1,4 @@
1
1
  /*dependencies: addons::mobile,addons::touchpad */
2
2
  Modernizr.addTest( 'touchdevice', function() {
3
- return Modernizr.mobile || Modernizr.touchpad;
3
+ return window.matchMedia('(hover: none)').matches;
4
4
  } );
@@ -1,7 +1,7 @@
1
- import { aClass, rClass } from 'front-library/DOM/Class';
2
- import { on, off } from 'front-library/Events/EventsManager';
3
- import { extend } from 'front-library/Helpers/Extend';
4
- import { next } from 'front-library/DOM/Traversing';
1
+ import { aClass, rClass } from '@creative-web-solution/front-library/DOM/Class';
2
+ import { on, off } from '@creative-web-solution/front-library/Events/EventsManager';
3
+ import { extend } from '@creative-web-solution/front-library/Helpers/Extend';
4
+ import { next } from '@creative-web-solution/front-library/DOM/Traversing';
5
5
 
6
6
  const STATUS_ON = 'STATUS_ON';
7
7
  const STATUS_OFF = 'STATUS_OFF';
@@ -66,10 +66,10 @@ function Tab( $TAB, options ) {
66
66
  function toggleTab( e ) {
67
67
  e.preventDefault();
68
68
 
69
- if( isOpen ) {
69
+ if( isOpen && ( !options.atLeastOneOpen || options.allowMultipleTab ) ) {
70
70
  closeTab();
71
71
  }
72
- else {
72
+ else if( !isOpen ) {
73
73
  openTab();
74
74
  }
75
75
  }
@@ -108,6 +108,7 @@ function Tab( $TAB, options ) {
108
108
  const DEFAULT_OPTIONS = {
109
109
  "tabSelector": "button[aria-expanded]",
110
110
  "allowMultipleTab": false,
111
+ "atLeastOneOpen": false,
111
112
  "animations": {
112
113
  "open": function( $TAB, $TAB_PANNEL ) {
113
114
  aClass( [ $TAB, $TAB_PANNEL ], 'on' );
@@ -155,6 +156,7 @@ const DEFAULT_OPTIONS = {
155
156
  * @param {Object} [userOptions]
156
157
  * @param {String} [userOptions.tabSelector='button[aria-expanded]']
157
158
  * @param {Boolean} [userOptions.allowMultipleTab=false]
159
+ * @param {Boolean} [userOptions.atLeastOneOpen=false]
158
160
  * @param {Accordion_callback} [userOptions.onOpenAtStart]
159
161
  * @param {Accordion_callback} [userOptions.onOpen]
160
162
  * @param {Accordion_callback} [userOptions.onClose]
@@ -166,6 +168,7 @@ const DEFAULT_OPTIONS = {
166
168
  * @example new Accordion( document.querySelector( '.accordion' ), {
167
169
  * "tabSelector": ".tab",
168
170
  * "allowMultipleTab": false,
171
+ * "atLeastOneOpen": false,
169
172
  * "animations": {
170
173
  * "open": function( $tab, $panel ) {
171
174
  * aClass( [ $tab, $panel ], 'on' );
@@ -233,6 +236,7 @@ export function Accordion( $accordionWrapper, userOptions = {} ) {
233
236
  if( status === STATUS_ON ){
234
237
  return;
235
238
  }
239
+
236
240
  status = STATUS_ON;
237
241
 
238
242
  $tabs.forEach( ( $tab, index ) => {
@@ -254,6 +258,8 @@ export function Accordion( $accordionWrapper, userOptions = {} ) {
254
258
  tablist.forEach( tab => {
255
259
  tab.destroy();
256
260
  } );
261
+
262
+ tablist.length = 0;
257
263
  }
258
264
 
259
265
 
@@ -1,10 +1,10 @@
1
- import { gesture, gestureOff } from 'front-library/Events/Gesture';
2
- import { extend } from 'front-library/Helpers/Extend';
3
- import { append, remove } from 'front-library/DOM/Manipulation';
4
- import { height } from 'front-library/DOM/Size';
5
- import { offset } from 'front-library/DOM/offset';
6
- import { outerHeight, outerWidth } from 'front-library/DOM/OuterSize';
7
- import { position } from 'front-library/DOM/position';
1
+ import { gesture, gestureOff } from '@creative-web-solution/front-library/Events/Gesture';
2
+ import { extend } from '@creative-web-solution/front-library/Helpers/Extend';
3
+ import { append, remove } from '@creative-web-solution/front-library/DOM/Manipulation';
4
+ import { height } from '@creative-web-solution/front-library/DOM/Size';
5
+ import { offset } from '@creative-web-solution/front-library/DOM/offset';
6
+ import { outerHeight, outerWidth } from '@creative-web-solution/front-library/DOM/OuterSize';
7
+ import { position } from '@creative-web-solution/front-library/DOM/position';
8
8
 
9
9
  /**
10
10
  * Autocomplete