@creative-web-solution/front-library 7.0.7 → 7.1.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.
Files changed (141) hide show
  1. package/CHANGELOG.md +15 -0
  2. package/DOM/Class.ts +10 -12
  3. package/DOM/DocumentSize.ts +3 -1
  4. package/DOM/Filter.ts +0 -2
  5. package/DOM/Index.ts +1 -3
  6. package/DOM/Manipulation.ts +0 -3
  7. package/DOM/Matrix.ts +12 -12
  8. package/DOM/Offset.ts +4 -5
  9. package/DOM/OuterSize.ts +12 -12
  10. package/DOM/PageToDOM.ts +2 -2
  11. package/DOM/Position.ts +3 -3
  12. package/DOM/Size.ts +3 -7
  13. package/DOM/StrToDOM.ts +0 -1
  14. package/DOM/Styles.ts +3 -12
  15. package/DOM/Traversing.ts +0 -6
  16. package/DOM/WindowScroll.ts +3 -1
  17. package/DOM/WindowSize.ts +3 -1
  18. package/DOM/Wrap.ts +0 -1
  19. package/Events/DeviceOrientation.ts +27 -31
  20. package/Events/EventsManager.ts +10 -25
  21. package/Events/Gesture.ts +36 -37
  22. package/Events/HistoryController.ts +11 -17
  23. package/Events/ImageLoad.ts +35 -19
  24. package/Events/IntersectObserver.ts +15 -19
  25. package/Events/KeyboardHandler.ts +10 -8
  26. package/Events/MediaQueriesEvents.ts +53 -51
  27. package/Events/OnAnimationEnd.ts +2 -3
  28. package/Events/OnTransitionEnd.ts +3 -3
  29. package/Events/PubSub.ts +5 -8
  30. package/Events/TouchHover.ts +18 -21
  31. package/Events/WindowEvents.ts +26 -30
  32. package/Helpers/Colors.ts +7 -23
  33. package/Helpers/Cookie.ts +5 -12
  34. package/Helpers/Coordinates.ts +0 -7
  35. package/Helpers/Debounce.ts +3 -7
  36. package/Helpers/Defer.ts +1 -1
  37. package/Helpers/GetValue.ts +0 -2
  38. package/Helpers/Insert.ts +0 -1
  39. package/Helpers/Sequential.ts +0 -2
  40. package/Helpers/Slice.ts +0 -3
  41. package/Helpers/Throttle.ts +0 -1
  42. package/Helpers/TransitionHelpers.ts +8 -6
  43. package/Helpers/Type.ts +1 -14
  44. package/Helpers/Unique.ts +3 -3
  45. package/Helpers/UrlParser.ts +13 -22
  46. package/Helpers/Wait.ts +1 -1
  47. package/Modules/Accordion/Tab.ts +18 -16
  48. package/Modules/Accordion/index.ts +24 -16
  49. package/Modules/Autocomplete.ts +95 -101
  50. package/Modules/DragSlider.ts +72 -63
  51. package/Modules/GlobalState.ts +60 -53
  52. package/Modules/LoadGMap.ts +4 -7
  53. package/Modules/Notifications/Notification.ts +28 -32
  54. package/Modules/Notifications/index.ts +43 -36
  55. package/Modules/Popin/Popin.ts +100 -110
  56. package/Modules/Popin/PopinAccessibility.ts +8 -8
  57. package/Modules/Popin/PopinBackground.ts +11 -11
  58. package/Modules/Popin/PopinController.ts +23 -29
  59. package/Modules/Popin/Tools.ts +18 -19
  60. package/Modules/QuickTemplate.ts +4 -6
  61. package/Modules/ScrollSnap.ts +110 -104
  62. package/Modules/SkinCheckbox.ts +51 -37
  63. package/Modules/SkinFile.ts +62 -52
  64. package/Modules/SkinRadio.ts +62 -42
  65. package/Modules/SkinSelect.ts +116 -100
  66. package/Modules/Slider/Slide.ts +49 -52
  67. package/Modules/Slider/Slider.ts +100 -136
  68. package/Modules/Slider/SliderControls.ts +60 -59
  69. package/Modules/Tabs/Tab.ts +27 -23
  70. package/Modules/Tabs/index.ts +35 -25
  71. package/Modules/Validator/Date.ts +2 -1
  72. package/Modules/Validator/Equals.ts +1 -1
  73. package/Modules/Validator/Internal/Input.ts +370 -0
  74. package/Modules/Validator/Internal/InputValidator.ts +99 -0
  75. package/Modules/Validator/Internal/ValidatorFunctionsController.ts +58 -0
  76. package/Modules/Validator/Max.ts +1 -1
  77. package/Modules/Validator/Min.ts +1 -1
  78. package/Modules/Validator/MultiRequired.ts +5 -5
  79. package/Modules/Validator/Number.ts +1 -0
  80. package/Modules/Validator/Pattern.ts +1 -1
  81. package/Modules/Validator/Recaptcha.ts +1 -0
  82. package/Modules/Validator/Required.ts +3 -2
  83. package/Modules/Validator/ServerCheck.ts +23 -15
  84. package/Modules/Validator/Tools/GetQueryFromForm.ts +1 -6
  85. package/Modules/Validator/Tools/IsDate.ts +2 -3
  86. package/Modules/Validator/Tools/IsEmail.ts +2 -5
  87. package/Modules/Validator/Tools/IsEmpty.ts +0 -2
  88. package/Modules/Validator/Tools/IsNumber.ts +0 -2
  89. package/Modules/Validator/Tools/IsUrl.ts +1 -3
  90. package/Modules/Validator/Tools/Label.ts +5 -15
  91. package/Modules/Validator/Tools/RadioButton.ts +4 -10
  92. package/Modules/Validator/Url.ts +1 -0
  93. package/Modules/Validator/index.ts +36 -36
  94. package/Modules/YouTubePlayer.ts +18 -16
  95. package/README.md +1 -1
  96. package/Types/Accordion.d.ts +36 -0
  97. package/Types/Autocomplete.d.ts +95 -0
  98. package/Types/DOM.d.ts +69 -0
  99. package/Types/DragSlider.d.ts +56 -0
  100. package/Types/EventsHelpers.d.ts +390 -0
  101. package/Types/GLImageTransition.d.ts +47 -43
  102. package/Types/GlobalState.d.ts +9 -0
  103. package/Types/Helpers.d.ts +30 -0
  104. package/Types/Notifications.d.ts +48 -44
  105. package/Types/Popin.d.ts +95 -0
  106. package/Types/ScrollSnap.d.ts +66 -0
  107. package/Types/SkinCheckbox.d.ts +26 -0
  108. package/Types/SkinFile.d.ts +38 -0
  109. package/Types/SkinRadio.d.ts +28 -0
  110. package/Types/SkinSelect.d.ts +59 -0
  111. package/Types/Slider.d.ts +106 -0
  112. package/Types/Tabs.d.ts +26 -0
  113. package/Types/Validator.d.ts +72 -0
  114. package/Types/YouTubePlayer.d.ts +27 -0
  115. package/Types/index.d.ts +22 -21
  116. package/WebGL/GLImageTransition/GLImageTransition.ts +83 -80
  117. package/WebGL/GLImageTransition/Presets/Cellular.ts +11 -11
  118. package/WebGL/GLImageTransition/Presets/Fade.ts +2 -3
  119. package/WebGL/GLImageTransition/Presets/HorizontalMovingGrid.ts +9 -9
  120. package/WebGL/GLImageTransition/Presets/PresetSample.ts +11 -9
  121. package/WebGL/GLImageTransition/Presets/Solarisation.ts +7 -12
  122. package/package.json +1 -1
  123. package/Modules/Template.ts +0 -209
  124. package/Types/AccordionTypes.d.ts +0 -29
  125. package/Types/AutocompleteTypes.d.ts +0 -85
  126. package/Types/DOMTypes.d.ts +0 -62
  127. package/Types/DragSliderTypes.d.ts +0 -52
  128. package/Types/EventsHelpersTypes.d.ts +0 -370
  129. package/Types/GlobalStateTypes.d.ts +0 -5
  130. package/Types/HelpersTypes.d.ts +0 -23
  131. package/Types/MediaPreloaderTypes.d.ts +0 -12
  132. package/Types/PopinTypes.d.ts +0 -83
  133. package/Types/ScrollSnapTypes.d.ts +0 -62
  134. package/Types/SkinCheckboxTypes.d.ts +0 -23
  135. package/Types/SkinFileTypes.d.ts +0 -34
  136. package/Types/SkinRadioTypes.d.ts +0 -24
  137. package/Types/SkinSelectTypes.d.ts +0 -48
  138. package/Types/SliderTypes.d.ts +0 -97
  139. package/Types/TabsTypes.d.ts +0 -22
  140. package/Types/ValidatorTypes.d.ts +0 -61
  141. package/Types/YouTubePlayerTypes.d.ts +0 -23
@@ -0,0 +1,95 @@
1
+ namespace FLib {
2
+ namespace Autocomplete {
3
+ type Item = {
4
+ name: string;
5
+ [ key: string ]: any;
6
+ }
7
+
8
+ type LayerPosition = 'top' | 'bottom';
9
+
10
+ interface Options {
11
+ $searchField: HTMLElement;
12
+ /** @defaultValue document.body */
13
+ $panelWrapper: HTMLElement;
14
+ /** @defaultValue 200 */
15
+ maxHeight: number;
16
+ /** @defaultValue false */
17
+ useCache: boolean;
18
+ /** @defaultValue 3 */
19
+ minchar: number;
20
+ /** @defaultValue LayerPosition.top */
21
+ layerPosition: LayerPosition;
22
+ source: ( query: string | null, callback: ( results: Item[] ) => void ) => void;
23
+ url: string;
24
+ /**
25
+ * Use CSS or Javascript for the position of the layer
26
+ * @defaultValue false
27
+ */
28
+ cssPositionning: boolean;
29
+ /**
30
+ * Update or not the text field with the selected value
31
+ * @defaultValue true
32
+ */
33
+ updateOnSelect: boolean;
34
+ onSelect: ({ item, query, resultsList }) => void;
35
+ queryParams: ( query: string ) => { "search": string };
36
+ normalize: ( data: any ) => { success: boolean, results: Item[] };
37
+ /**
38
+ * Allow to manipulate the displayed value of items
39
+ * @defaultValue (`{`item, query, resultList`}`) `=>` item.name
40
+ */
41
+ renderFieldValue: (options: { item: Item, query: string, resultList: Item[] }) => string;
42
+ /**
43
+ * @defaultValue (`{`resultItem, query, index, itemsList, cssClass`}`) `=>` `<li role="option" data-idx="${index}" class="${cssClass.item}"><a class="${cssClass.link}">${resultItem.markedName}</a></li>`
44
+ */
45
+ render: ( options: { resultItem: Item, query: string, index: number, itemsList: Item[], cssClass: Classname }) => string;
46
+ /**
47
+ * @defaultValue (`{`resultList, query, cssClass`}`) `=>` `<ul role="listbox" class="${cssClass.list}">${resultList.join('')}</ul>`
48
+ */
49
+ renderList: ( options: { resultList: Item[], query: string, cssClass: Classname }) => string;
50
+ /**
51
+ * @defaultValue (`{`errorMsg, query, cssClass`}`) `=>` `<li class="${cssClass.error}">${errorMsg}</li>`
52
+ */
53
+ renderError: (options: { errorMsg: string, query: string, cssClass: Classname }) => string;
54
+ /**
55
+ * Allow to wrap the query with a tag in the result item name
56
+ * @defaultValue (`{`resultItem, reQuery, query, index, resultList, cssClass`}`) `=>` `{`resultItem.name && (resultItem.markedName = resultItem.name.replace(reQuery,`<mark class="${cssClass.mark}">$1</mark>`));`}`
57
+ */
58
+ renderMark: ( options: { resultItem: Item, reQuery?: RegExp, query: string, index: number, resultList: Item[], cssClass: Classname }) => void;
59
+ l10n: L10N;
60
+ className: Classname;
61
+ }
62
+
63
+
64
+ interface L10N {
65
+ /** @defaultValue No result */
66
+ noResult: string;
67
+ /** @defaultValue Server error */
68
+ error: string;
69
+ }
70
+
71
+ interface Classname {
72
+ /** @defaultValue ac-layer */
73
+ layer: string;
74
+ /** @defaultValue ac-list */
75
+ list: string;
76
+ /** @defaultValue acl-itm */
77
+ item: string;
78
+ /** @defaultValue acl-lnk */
79
+ link: string;
80
+ /** @defaultValue acl-mrk */
81
+ mark: string;
82
+ /** @defaultValue acl-error */
83
+ error: string;
84
+ /** @defaultValue hover */
85
+ hover: string;
86
+ /** @defaultValue disable */
87
+ disable: string;
88
+ }
89
+
90
+ interface OptionsInit extends Partial<Options> {
91
+ l10n?: Partial<L10N>;
92
+ className?: Partial<Classname>;
93
+ }
94
+ }
95
+ }
package/Types/DOM.d.ts ADDED
@@ -0,0 +1,69 @@
1
+ namespace FLib {
2
+ namespace DOM {
3
+ type ClassInput = Element | Element[] | Node | NodeList;
4
+
5
+
6
+ interface Offset {
7
+ top: number;
8
+ y: number;
9
+ left: number;
10
+ x: number;
11
+ right: number;
12
+ bottom: number;
13
+ width: number;
14
+ height: number;
15
+ }
16
+
17
+
18
+ type Size = {
19
+ width: number;
20
+ height: number;
21
+ }
22
+
23
+
24
+ type Position = {
25
+ left: number;
26
+ top: number;
27
+ }
28
+ }
29
+
30
+
31
+ namespace Matrix {
32
+
33
+ type Translate = {
34
+ tx: number;
35
+ ty: number;
36
+ tz: number;
37
+ }
38
+
39
+
40
+ type Transform = {
41
+ tx: number;
42
+ ty: number;
43
+ tz: number;
44
+ rx: number;
45
+ ry: number;
46
+ rz: number;
47
+ }
48
+
49
+
50
+ type Matrix = {
51
+ m11: number;
52
+ m21: number;
53
+ m31: number;
54
+ m41: number;
55
+ m12: number;
56
+ m22: number;
57
+ m32: number;
58
+ m42: number;
59
+ m13: number;
60
+ m23: number;
61
+ m33: number;
62
+ m43: number;
63
+ m14: number;
64
+ m24: number;
65
+ m34: number;
66
+ m44: number;
67
+ }
68
+ }
69
+ }
@@ -0,0 +1,56 @@
1
+ namespace FLib {
2
+ namespace DragSlider {
3
+ type CallbackParam = {
4
+ item: any;
5
+ xPos: number;
6
+ moveMaxSize: number;
7
+ isAtStart: boolean;
8
+ isAtEnd: boolean;
9
+ }
10
+
11
+ type Item = {
12
+ index: number;
13
+ isFirst: boolean;
14
+ isLast: boolean;
15
+ $item: HTMLElement;
16
+ info: OffsetType;
17
+ }
18
+
19
+ type DeltaMove = {
20
+ x: number;
21
+ deltaX: number;
22
+ deltaY: number;
23
+ newX: number;
24
+ }
25
+
26
+ type Callback = ( data: CallbackParam ) => void;
27
+
28
+ type Options = {
29
+ viewportSelector: string;
30
+ listSelector: string;
31
+ itemSelector: string;
32
+ dragClass: string;
33
+ /** @defaultValue is-locked */
34
+ lockedClass: string;
35
+ onStartDrag?: Callback;
36
+ onDrag?: Callback;
37
+ onStopDrag?: Callback;
38
+ onSnap?: Callback;
39
+ onSnapUpdate?: Callback;
40
+ onMouseEnter?: Callback;
41
+ onMouseLeave?: Callback;
42
+ onInit?: Callback;
43
+ onChangeState?: ( isDragging: boolean ) => void;
44
+ /**
45
+ * In px.
46
+ * @defaultValue 40
47
+ */
48
+ swipeTresholdMin: number;
49
+ /**
50
+ * In % (0.5 = 50% of the size of one item).
51
+ * @defaultValue 0.5
52
+ */
53
+ swipeTresholdSize:number;
54
+ }
55
+ }
56
+ }
@@ -0,0 +1,390 @@
1
+ namespace FLib {
2
+ namespace Events {
3
+
4
+ /**
5
+ * ------------------------------------------------------
6
+ * Device orientation Types
7
+ *
8
+ */
9
+ namespace DeviceOrientation {
10
+
11
+ type Type = 'landscape-primary' | 'portrait-primary' | 'landscape-secondary' | 'portrait-secondary' | '';
12
+
13
+ type Options = {
14
+ onOrientationChange: ( ( type: Type ) => void );
15
+ }
16
+ }
17
+
18
+
19
+ /**
20
+ * ------------------------------------------------------
21
+ * Events manager Types
22
+ *
23
+ */
24
+ namespace EventsManager {
25
+
26
+ interface DataRegistry {
27
+ $element: Element;
28
+ eventName: string;
29
+ options: OnOptionsType;
30
+ delegate?: ( e ) => void;
31
+ }
32
+
33
+ type EventOptions = {
34
+ capure?: boolean;
35
+ once?: boolean;
36
+ passive?: boolean;
37
+ }
38
+
39
+ type OnOptions = {
40
+ /** Name of events separate by a space */
41
+ eventsName: string;
42
+ /** Css selector used for event delegation */
43
+ selector?: string;
44
+ callback: ( e, $target? ) => void;
45
+ /** Active or not event capture. */
46
+ capture?: boolean;
47
+ /** Native addEventListener options. Priority to options.capture if it's present. */
48
+ eventOptions?: EventOptions;
49
+ /** @internal */
50
+ _internalCallback?: ( e, $target? ) => void;
51
+ }
52
+
53
+ type OffOptions = {
54
+ /** Name of events separate by space */
55
+ eventsName: string;
56
+ callback?: ( e, $target? ) => void;
57
+ }
58
+
59
+ type FireOptions = {
60
+ /** Name of events separate by space */
61
+ eventsName: string;
62
+ /** Object to send with the event */
63
+ detail?: any;
64
+ /** Only used for DOM */
65
+ bubbles?: true;
66
+ /** Only used for DOM */
67
+ cancelable?: true;
68
+ }
69
+ }
70
+
71
+
72
+ /**
73
+ * ------------------------------------------------------
74
+ * Gesture Types
75
+ *
76
+ */
77
+ namespace Gesture {
78
+
79
+ type Direction = 'up' | 'down' | 'left' | 'right' | 'up-right' | 'down-right' | 'up-left' | 'down-left' | 'none';
80
+
81
+
82
+ type Mode = 'touch' | 'mouse' | 'pointer' | 'click';
83
+
84
+ type Manager = {
85
+ off();
86
+ }
87
+
88
+ type VelocityReturnType = {
89
+ velocity: number;
90
+ averageVelocity: number;
91
+ angle: number;
92
+ direction: Direction;
93
+ }
94
+
95
+ type Coords = {
96
+ pageX: number;
97
+ pageY: number;
98
+ clientX: number;
99
+ clientY: number;
100
+ mode: Mode
101
+ }
102
+
103
+ type Velocity = {
104
+ velocity: number;
105
+ velocityDistance: number;
106
+ deltaTime: number;
107
+ }
108
+
109
+ type PreventAndStopPropagation = boolean | (( e, $target: HTMLElement ) => boolean );
110
+ type Callback = ( e: Event, $target: HTMLElement, coords: Coords, type: string ) => void;
111
+ type SwipeCallback = ( e: Event, $target: HTMLElement, type: string ) => void;
112
+
113
+
114
+ interface Options {
115
+ /** Used for event delegation */
116
+ selector?: string;
117
+ /** In px, minimal distance to do to trigger events.
118
+ * @defaultValue 20
119
+ */
120
+ threshold?: number;
121
+ /**
122
+ * Use all touch, pointer or mouse events, or only click event */
123
+ useTouch?: boolean;
124
+ /**
125
+ * Cap valocity
126
+ * @defaultValue -1
127
+ */
128
+ velocityMax?: number;
129
+ /**
130
+ * In deg, sensitivity of angle detection
131
+ * @defaultValue 2
132
+ */
133
+ angleThreshold?: number;
134
+ /** @defaultValue false */
135
+ preventClick?: PreventAndStopPropagation;
136
+ /** @defaultValue false */
137
+ stopPropagationClick?: PreventAndStopPropagation;
138
+ /** @defaultValue false */
139
+ preventStart?: PreventAndStopPropagation;
140
+ /** @defaultValue false */
141
+ stopPropagationStart?: PreventAndStopPropagation;
142
+ /** @defaultValue false */
143
+ preventMove?: PreventAndStopPropagation;
144
+ /** @defaultValue false */
145
+ stopPropagationMove?: PreventAndStopPropagation;
146
+ /** @defaultValue false */
147
+ preventEnd?: PreventAndStopPropagation;
148
+ /** @defaultValue false */
149
+ stopPropagationEnd?: PreventAndStopPropagation;
150
+ /** touchstart, pointerdown, mousedown */
151
+ start?: Callback;
152
+ /** touchmove, pointermove, mousemove */
153
+ move?: Callback;
154
+ /** touchend, pointerup, mouseup */
155
+ end?: Callback;
156
+ /** click */
157
+ click?: Callback;
158
+ /** touchend on touch device, click on other */
159
+ tap?: (( e: Event, $target: HTMLElement, coords: CoordsType, type: string ) => void);
160
+ swipeLeft?: SwipeCallback;
161
+ swipeRight?: SwipeCallback;
162
+ swipeUp?: SwipeCallback;
163
+ swipeDown?: SwipeCallback;
164
+ swipe?: (( e: Event, $target: HTMLElement, velocity: VelocityReturnType, type: string ) => void);
165
+ moveLeft?: SwipeCallback;
166
+ moveRight?: SwipeCallback;
167
+ moveUp?: SwipeCallback;
168
+ moveDown?: SwipeCallback;
169
+ }
170
+
171
+ type Elements = Node | NodeList | Node[] | HTMLElement | HTMLElement[];
172
+ }
173
+
174
+
175
+ /**
176
+ * ------------------------------------------------------
177
+ * History controller Types
178
+ *
179
+ */
180
+ namespace History {
181
+ type StateObject = {
182
+ url: UrlParser;
183
+ state: any;
184
+ title: string;
185
+ }
186
+
187
+ type Callback = ( url: UrlParser, state: any ) => void;
188
+ }
189
+
190
+
191
+ /**
192
+ * ------------------------------------------------------
193
+ * Images load Types
194
+ *
195
+ */
196
+ namespace ImagesLoad {
197
+ type LoadEvent = 'load' | 'error' | 'complete';
198
+
199
+ interface CallbackParam {
200
+ $element: Element;
201
+ type: LoadEvent;
202
+ }
203
+
204
+ interface PromiseLoad extends Promise<CallbackParam> {
205
+ off();
206
+ }
207
+
208
+ interface PromisesLoad extends Promise<CallbackParam[]> {
209
+ off();
210
+ }
211
+ }
212
+
213
+
214
+ /**
215
+ * ------------------------------------------------------
216
+ * Intersect Observer Types
217
+ *
218
+ */
219
+ namespace IntersectObserver {
220
+ type Options = {
221
+ /** Callback function */
222
+ onIntersecting: ( $target: Node, entry: IntersectionObserverEntry ) => void;
223
+ /** Execute the callback only once per $elements the first time it intersect the viewport. Default: false */
224
+ onlyOnce?: boolean;
225
+ /** Native options to create to IntersectionObserver API */
226
+ ioOptions?: IntersectionObserverInit
227
+ }
228
+ }
229
+
230
+
231
+ /**
232
+ * ------------------------------------------------------
233
+ * Keyboard handler Types
234
+ *
235
+ */
236
+ namespace KeyboardHandler {
237
+ type Callback = ( event: KeyboardEvent, $context: HTMLElement ) => void;
238
+
239
+ type Options = {
240
+ /** Used for event delegation */
241
+ selector?: string;
242
+ /** Prevent default on all key pressed, except TAB */
243
+ preventDefault?: boolean;
244
+ onEnter?: Callback;
245
+ onSpace?: Callback;
246
+ /** Called when pressing ENTER or SPACE */
247
+ onSelect?: Callback;
248
+ onEscape?: Callback;
249
+ onTab?: Callback;
250
+ onTabReverse?: Callback;
251
+ /** Called when pressing RIGHT ARROW KEYS */
252
+ onRight?: Callback;
253
+ /** Called when pressing LEFT ARROW KEYS */
254
+ onLeft?: Callback;
255
+ /** Called when pressing UP ARROW KEYS */
256
+ onUp?: Callback;
257
+ /** Called when pressing DOWN ARROW KEYS */
258
+ onDown?: Callback;
259
+ onPageUp?: Callback;
260
+ onPageDown?: Callback;
261
+ /** Called when pressing LEFT or DOWN arrow keys */
262
+ onPrevious?: Callback;
263
+ /** Called when pressing RIGHT or UP arrow keys */
264
+ onNext?: Callback;
265
+ /** Called on every key */
266
+ onKey?: Callback;
267
+ }
268
+ }
269
+
270
+
271
+ /**
272
+ * ------------------------------------------------------
273
+ * Mediaqueries event Types
274
+ *
275
+ */
276
+ namespace MediaqueriesEvents {
277
+
278
+ type Breakpoint = {
279
+ name: string,
280
+
281
+ /** Object buid with the window.matchMedia() function */
282
+ query: MediaQueryList,
283
+
284
+ /** mediaquery lower bound */
285
+ min?: number,
286
+
287
+ /** mediaquery upper bound */
288
+ max?: number,
289
+
290
+ /** Return true if the breakpoint is in the list: breakpoint.in(['bp1', 'bp2']) */
291
+ in: ( breakpointNameList: string[] ) => boolean,
292
+
293
+ /** Return true if the name passed to the function is the name of the breakpoint: breakpoint.is */
294
+ is: ( breakpointName: string ) => boolean,
295
+
296
+ /** @internal */
297
+ handler: ( e: MediaQueryListEvent ) => void
298
+ }
299
+
300
+ type CallbackType = "enter" | "leave" | "both";
301
+
302
+ type Callback = ( breakpoint: Breakpoint, isMatching?: boolean ) => void;
303
+
304
+ type ListOptions = {
305
+ name: string,
306
+ query?: MediaQueryList,
307
+ min?: number,
308
+ max?: number
309
+ }
310
+
311
+ type Options = {
312
+ /** Default: px */
313
+ unit?: string;
314
+ }
315
+
316
+ type InternalCallbackType = {
317
+ callback: Callback,
318
+ type: CallbackType
319
+ }
320
+ }
321
+
322
+
323
+ /**
324
+ * ------------------------------------------------------
325
+ * PubSub Types
326
+ *
327
+ */
328
+ namespace PubSub {
329
+ type Callback = ( data?: any ) => void;
330
+ }
331
+
332
+
333
+ /**
334
+ * ------------------------------------------------------
335
+ * Touch hover Types
336
+ *
337
+ */
338
+ namespace TouchHover {
339
+ type Options = {
340
+ cssClass: string,
341
+ selector: string,
342
+ $wrapper: Element
343
+ }
344
+ }
345
+
346
+
347
+ /**
348
+ * ------------------------------------------------------
349
+ * Window events Types
350
+ *
351
+ */
352
+ namespace WindowEvents {
353
+ type Type = 'both' | 'force' | 'resize' | 'scroll';
354
+
355
+ type ScrollInfo = {
356
+ top: number;
357
+ left: number;
358
+ }
359
+
360
+ type WindowInfo = {
361
+ width: number;
362
+ height: number;
363
+ }
364
+
365
+ type DocumentInfo = {
366
+ width: number;
367
+ height: number;
368
+ }
369
+
370
+ type ViewportInfo = {
371
+ top: number;
372
+ left: number;
373
+ bottom: number;
374
+ right: number;
375
+ width: number;
376
+ height: number;
377
+ }
378
+
379
+
380
+ type CallbackParam = {
381
+ windowInfo: WindowInfoType,
382
+ scrollInfo: ScrollInfoType,
383
+ documentInfo: DocumentInfoType,
384
+ viewportInfo: ViewportInfoType
385
+ }
386
+
387
+ type Callback = ( info: CallbackParam, type: Type, e? ) => void;
388
+ }
389
+ }
390
+ }