@creative-web-solution/front-library 7.0.6 → 7.1.2
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 +30 -0
- package/DOM/Class.ts +10 -12
- package/DOM/DocumentSize.ts +3 -1
- package/DOM/Filter.ts +0 -2
- package/DOM/Index.ts +1 -3
- package/DOM/Manipulation.ts +0 -3
- package/DOM/Matrix.ts +12 -12
- package/DOM/Offset.ts +4 -5
- package/DOM/OuterSize.ts +12 -12
- package/DOM/PageToDOM.ts +2 -2
- package/DOM/Position.ts +3 -3
- package/DOM/Size.ts +3 -7
- package/DOM/StrToDOM.ts +0 -1
- package/DOM/Styles.ts +3 -12
- package/DOM/Traversing.ts +0 -6
- package/DOM/WindowScroll.ts +3 -1
- package/DOM/WindowSize.ts +3 -1
- package/DOM/Wrap.ts +0 -1
- package/Events/DeviceOrientation.ts +27 -31
- package/Events/EventsManager.ts +10 -25
- package/Events/Gesture.ts +36 -37
- package/Events/HistoryController.ts +11 -17
- package/Events/ImageLoad.ts +35 -19
- package/Events/IntersectObserver.ts +15 -19
- package/Events/KeyboardHandler.ts +10 -8
- package/Events/MediaQueriesEvents.ts +53 -51
- package/Events/OnAnimationEnd.ts +5 -6
- package/Events/OnTransitionEnd.ts +3 -3
- package/Events/PubSub.ts +5 -8
- package/Events/TouchHover.ts +18 -21
- package/Events/WindowEvents.ts +26 -30
- package/Helpers/Colors.ts +7 -23
- package/Helpers/Cookie.ts +5 -12
- package/Helpers/Coordinates.ts +0 -7
- package/Helpers/Debounce.ts +3 -7
- package/Helpers/Defer.ts +1 -1
- package/Helpers/GetValue.ts +0 -2
- package/Helpers/Insert.ts +0 -1
- package/Helpers/Sequential.ts +0 -2
- package/Helpers/Slice.ts +0 -3
- package/Helpers/Throttle.ts +0 -1
- package/Helpers/TransitionHelpers.ts +95 -0
- package/Helpers/Type.ts +1 -14
- package/Helpers/Unique.ts +3 -3
- package/Helpers/UrlParser.ts +14 -23
- package/Helpers/Wait.ts +1 -1
- package/Modules/Accordion/Tab.ts +19 -17
- package/Modules/Accordion/index.ts +27 -19
- package/Modules/Autocomplete.ts +95 -101
- package/Modules/DragSlider.ts +72 -63
- package/Modules/GlobalState.ts +60 -53
- package/Modules/LoadGMap.ts +4 -7
- package/Modules/Notifications/Notification.ts +28 -32
- package/Modules/Notifications/index.ts +43 -36
- package/Modules/Popin/Popin.ts +100 -110
- package/Modules/Popin/PopinAccessibility.ts +8 -8
- package/Modules/Popin/PopinBackground.ts +12 -12
- package/Modules/Popin/PopinController.ts +24 -30
- package/Modules/Popin/Tools.ts +18 -19
- package/Modules/QuickTemplate.ts +4 -6
- package/Modules/ScrollSnap.ts +110 -104
- package/Modules/SkinCheckbox.ts +52 -38
- package/Modules/SkinFile.ts +63 -53
- package/Modules/SkinRadio.ts +63 -43
- package/Modules/SkinSelect.ts +117 -101
- package/Modules/Slider/Slide.ts +49 -52
- package/Modules/Slider/Slider.ts +100 -136
- package/Modules/Slider/SliderControls.ts +60 -59
- package/Modules/Tabs/Tab.ts +28 -24
- package/Modules/Tabs/index.ts +36 -26
- package/Modules/Validator/Date.ts +2 -1
- package/Modules/Validator/Equals.ts +1 -1
- package/Modules/Validator/Internal/Input.ts +366 -0
- package/Modules/Validator/Internal/InputValidator.ts +99 -0
- package/Modules/Validator/Internal/ValidatorFunctionsController.ts +58 -0
- package/Modules/Validator/Max.ts +1 -1
- package/Modules/Validator/Min.ts +1 -1
- package/Modules/Validator/MultiRequired.ts +5 -5
- package/Modules/Validator/Number.ts +1 -0
- package/Modules/Validator/Pattern.ts +1 -1
- package/Modules/Validator/Recaptcha.ts +1 -0
- package/Modules/Validator/Required.ts +3 -2
- package/Modules/Validator/ServerCheck.ts +23 -15
- package/Modules/Validator/Tools/GetQueryFromForm.ts +1 -6
- package/Modules/Validator/Tools/IsDate.ts +2 -3
- package/Modules/Validator/Tools/IsEmail.ts +2 -5
- package/Modules/Validator/Tools/IsEmpty.ts +0 -2
- package/Modules/Validator/Tools/IsNumber.ts +0 -2
- package/Modules/Validator/Tools/IsUrl.ts +1 -3
- package/Modules/Validator/Tools/Label.ts +5 -15
- package/Modules/Validator/Tools/RadioButton.ts +4 -10
- package/Modules/Validator/Url.ts +1 -0
- package/Modules/Validator/index.ts +36 -36
- package/Modules/YouTubePlayer.ts +18 -16
- package/README.md +1 -1
- package/Types/Accordion.d.ts +41 -0
- package/Types/Autocomplete.d.ts +94 -0
- package/Types/DOM.d.ts +69 -0
- package/Types/DragSlider.d.ts +56 -0
- package/Types/EventsHelpers.d.ts +390 -0
- package/Types/GLImageTransition.d.ts +47 -43
- package/Types/GlobalState.d.ts +9 -0
- package/Types/Helpers.d.ts +63 -0
- package/Types/Notifications.d.ts +48 -44
- package/Types/Popin.d.ts +113 -0
- package/Types/ScrollSnap.d.ts +66 -0
- package/Types/SkinCheckbox.d.ts +35 -0
- package/Types/SkinFile.d.ts +45 -0
- package/Types/SkinRadio.d.ts +37 -0
- package/Types/SkinSelect.d.ts +72 -0
- package/Types/Slider.d.ts +106 -0
- package/Types/Tabs.d.ts +33 -0
- package/Types/Validator.d.ts +99 -0
- package/Types/YouTubePlayer.d.ts +27 -0
- package/Types/index.d.ts +22 -21
- package/WebGL/GLImageTransition/GLImageTransition.ts +83 -80
- package/WebGL/GLImageTransition/Presets/Cellular.ts +11 -11
- package/WebGL/GLImageTransition/Presets/Fade.ts +2 -3
- package/WebGL/GLImageTransition/Presets/HorizontalMovingGrid.ts +9 -9
- package/WebGL/GLImageTransition/Presets/PresetSample.ts +11 -9
- package/WebGL/GLImageTransition/Presets/Solarisation.ts +7 -12
- package/package.json +1 -1
- package/Modules/Template.ts +0 -209
- package/Types/AccordionTypes.d.ts +0 -29
- package/Types/AutocompleteTypes.d.ts +0 -85
- package/Types/DOMTypes.d.ts +0 -62
- package/Types/DragSliderTypes.d.ts +0 -52
- package/Types/EventsHelpersTypes.d.ts +0 -370
- package/Types/GlobalStateTypes.d.ts +0 -5
- package/Types/HelpersTypes.d.ts +0 -23
- package/Types/MediaPreloaderTypes.d.ts +0 -12
- package/Types/PopinTypes.d.ts +0 -83
- package/Types/ScrollSnapTypes.d.ts +0 -62
- package/Types/SkinCheckboxTypes.d.ts +0 -23
- package/Types/SkinFileTypes.d.ts +0 -34
- package/Types/SkinRadioTypes.d.ts +0 -24
- package/Types/SkinSelectTypes.d.ts +0 -48
- package/Types/SliderTypes.d.ts +0 -97
- package/Types/TabsTypes.d.ts +0 -22
- package/Types/ValidatorTypes.d.ts +0 -61
- package/Types/YouTubePlayerTypes.d.ts +0 -23
|
@@ -7,27 +7,19 @@ import { wait } from '../../Helpers/Wait';
|
|
|
7
7
|
|
|
8
8
|
/**
|
|
9
9
|
* This is one notification
|
|
10
|
-
* @class
|
|
11
|
-
* @ignore
|
|
12
|
-
*
|
|
13
|
-
* @param {String|Element} html
|
|
14
|
-
* @param {String} type
|
|
15
|
-
* @param {Object} options
|
|
16
|
-
* @param {Function} close
|
|
17
|
-
* @param {Object} notificationOptions
|
|
18
10
|
*/
|
|
19
11
|
export default class Notification {
|
|
20
|
-
#$notification
|
|
21
|
-
#html
|
|
12
|
+
#$notification: HTMLElement | undefined;
|
|
13
|
+
#html: string | undefined;
|
|
22
14
|
#type: string;
|
|
23
|
-
#autoCloseTimeout
|
|
15
|
+
#autoCloseTimeout: number | undefined;
|
|
24
16
|
#closeDelay: boolean | number;
|
|
25
|
-
#options:
|
|
26
|
-
#notificationOptions:
|
|
17
|
+
#options: FLib.Notifications.Options;
|
|
18
|
+
#notificationOptions: FLib.Notifications.NotificationOptions;
|
|
27
19
|
#close: ( notification: Notification ) => void;
|
|
28
20
|
|
|
29
21
|
|
|
30
|
-
constructor( htmlOrHTMLElement: string | HTMLElement, type: string, userOptions, close: ( notification: Notification ) => void, notificationOptions?:
|
|
22
|
+
constructor( htmlOrHTMLElement: string | HTMLElement, type: string, userOptions: FLib.Notifications.Options, close: ( notification: Notification ) => void, notificationOptions?: FLib.Notifications.NotificationOptions ) {
|
|
31
23
|
|
|
32
24
|
this.#options = userOptions;
|
|
33
25
|
this.#closeDelay = false;
|
|
@@ -36,10 +28,10 @@ export default class Notification {
|
|
|
36
28
|
this.#close = close;
|
|
37
29
|
|
|
38
30
|
if ( !notificationOptions ) {
|
|
39
|
-
this.#closeDelay = this.#options.autoCloseDelay
|
|
31
|
+
this.#closeDelay = this.#options.autoCloseDelay;
|
|
40
32
|
}
|
|
41
33
|
else if ( notificationOptions && notificationOptions.closeDelay !== false ) {
|
|
42
|
-
this.#closeDelay = notificationOptions.closeDelay || this.#options.autoCloseDelay
|
|
34
|
+
this.#closeDelay = notificationOptions.closeDelay || this.#options.autoCloseDelay;
|
|
43
35
|
}
|
|
44
36
|
|
|
45
37
|
if ( typeof htmlOrHTMLElement === 'string' ) {
|
|
@@ -51,23 +43,23 @@ export default class Notification {
|
|
|
51
43
|
}
|
|
52
44
|
|
|
53
45
|
|
|
54
|
-
|
|
46
|
+
#onClick = ( e: Event ): void => {
|
|
55
47
|
clearTimeout( this.#autoCloseTimeout );
|
|
56
48
|
|
|
57
|
-
this.#options.onClick
|
|
58
|
-
this.#notificationOptions
|
|
49
|
+
this.#options.onClick?.( this );
|
|
50
|
+
this.#notificationOptions?.onClick?.call( this, e );
|
|
59
51
|
|
|
60
52
|
this.#close( this );
|
|
61
53
|
}
|
|
62
54
|
|
|
63
55
|
|
|
64
|
-
show( $list ) {
|
|
56
|
+
show( $list: HTMLElement ): Promise<any> {
|
|
65
57
|
if ( !this.#$notification ) {
|
|
66
|
-
this.#$notification = strToDOM( this.#options.templates
|
|
67
|
-
this.#$notification.innerHTML = this.#html;
|
|
58
|
+
this.#$notification = strToDOM( this.#options.templates.notification ) as HTMLElement;
|
|
59
|
+
( this.#$notification as HTMLElement ).innerHTML = this.#html || '';
|
|
68
60
|
|
|
69
|
-
if ( this.#options.cssClass
|
|
70
|
-
aClass( this.#$notification, this.#options.cssClass
|
|
61
|
+
if ( this.#options.cssClass[ this.#type ] ) {
|
|
62
|
+
aClass( this.#$notification, this.#options.cssClass[ this.#type ] );
|
|
71
63
|
}
|
|
72
64
|
|
|
73
65
|
append( this.#$notification, $list );
|
|
@@ -75,7 +67,7 @@ export default class Notification {
|
|
|
75
67
|
|
|
76
68
|
one( this.#$notification, {
|
|
77
69
|
"eventsName": "click",
|
|
78
|
-
"callback": this
|
|
70
|
+
"callback": this.#onClick
|
|
79
71
|
} );
|
|
80
72
|
|
|
81
73
|
if ( this.#closeDelay ) {
|
|
@@ -84,18 +76,22 @@ export default class Notification {
|
|
|
84
76
|
}, this.#closeDelay as number * 1000 );
|
|
85
77
|
}
|
|
86
78
|
|
|
87
|
-
return wait( 100 ).then( () => this.#options.animations
|
|
88
|
-
}
|
|
79
|
+
return wait( 100 ).then( () => this.#options.animations.show( this.#$notification, this.#options ) );
|
|
80
|
+
}
|
|
89
81
|
|
|
90
82
|
|
|
91
|
-
hide() {
|
|
83
|
+
hide(): Promise<any> {
|
|
84
|
+
if ( !this.#$notification ) {
|
|
85
|
+
return Promise.resolve()
|
|
86
|
+
}
|
|
87
|
+
|
|
92
88
|
off( this.#$notification, {
|
|
93
89
|
"eventsName": "click",
|
|
94
|
-
"callback": this
|
|
90
|
+
"callback": this.#onClick
|
|
95
91
|
} );
|
|
96
92
|
|
|
97
|
-
return this.#options.animations
|
|
98
|
-
remove( this.#$notification );
|
|
93
|
+
return this.#options.animations.hide( this.#$notification, this.#options ).then( () => {
|
|
94
|
+
remove( ( this.#$notification as HTMLElement ) );
|
|
99
95
|
} );
|
|
100
|
-
}
|
|
96
|
+
}
|
|
101
97
|
}
|
|
@@ -34,7 +34,7 @@ const DEFAULT_OPTIONS = {
|
|
|
34
34
|
return Promise.resolve();
|
|
35
35
|
},
|
|
36
36
|
"hide": ( $notification, options ) => {
|
|
37
|
-
|
|
37
|
+
const prom = onTransitionEnd( $notification );
|
|
38
38
|
|
|
39
39
|
wait().then( () => rClass( $notification, options.cssClass.open ) );
|
|
40
40
|
|
|
@@ -46,45 +46,42 @@ const DEFAULT_OPTIONS = {
|
|
|
46
46
|
|
|
47
47
|
/**
|
|
48
48
|
* Manages a list of notifications
|
|
49
|
-
* @class
|
|
50
49
|
*
|
|
51
50
|
* @example let notifSys = new Notification();
|
|
52
51
|
* notifSys.add( 'Here is a simple notification' );
|
|
53
|
-
*
|
|
54
|
-
* @param {Object} [userOptions]
|
|
55
52
|
*/
|
|
56
53
|
export default class Notifications {
|
|
57
54
|
|
|
58
|
-
#options:
|
|
59
|
-
#$list:
|
|
60
|
-
#$notifications:
|
|
55
|
+
#options: FLib.Notifications.Options;
|
|
56
|
+
#$list: HTMLElement;
|
|
57
|
+
#$notifications: HTMLElement;
|
|
61
58
|
#notificationsList: Notification[];
|
|
62
59
|
|
|
63
60
|
|
|
64
|
-
constructor( userOptions:
|
|
61
|
+
constructor( userOptions: Partial<FLib.Notifications.Options> ) {
|
|
65
62
|
|
|
66
63
|
this.#options = extend( {}, DEFAULT_OPTIONS, userOptions );
|
|
67
64
|
this.#notificationsList = [];
|
|
68
65
|
|
|
69
|
-
this.#$notifications = document.querySelector( this.#options.selectors
|
|
66
|
+
this.#$notifications = document.querySelector( this.#options.selectors.notifications ) as HTMLElement;
|
|
70
67
|
|
|
71
68
|
if ( !this.#$notifications ) {
|
|
72
|
-
this.#$notifications = strToDOM( this.#options.templates
|
|
73
|
-
append( this.#$notifications, this.#options.$wrapper
|
|
69
|
+
this.#$notifications = strToDOM( this.#options.templates.notifications ) as HTMLElement;
|
|
70
|
+
append( this.#$notifications, this.#options.$wrapper );
|
|
74
71
|
}
|
|
75
72
|
|
|
76
73
|
|
|
77
|
-
this.#$list = this.#$notifications.querySelector( this.#options.selectors
|
|
74
|
+
this.#$list = this.#$notifications.querySelector( this.#options.selectors.list ) as HTMLElement;
|
|
78
75
|
|
|
79
76
|
|
|
80
|
-
this.#$list.querySelectorAll( this.#options.selectors
|
|
81
|
-
this
|
|
77
|
+
this.#$list.querySelectorAll( this.#options.selectors.notification ).forEach( $notification => {
|
|
78
|
+
this.#insertNotification( $notification as HTMLElement );
|
|
82
79
|
} );
|
|
83
80
|
}
|
|
84
81
|
|
|
85
82
|
|
|
86
|
-
|
|
87
|
-
|
|
83
|
+
#insertNotification = ( htmlOrHTMLElement: string | HTMLElement, type: FLib.Notifications.Type = 'info', notificationOptions?: FLib.Notifications.NotificationOptions ): void => {
|
|
84
|
+
const notification = new Notification( htmlOrHTMLElement, type, this.#options, this.#close.bind( this ), notificationOptions );
|
|
88
85
|
notification.show( this.#$list );
|
|
89
86
|
|
|
90
87
|
if ( !this.#notificationsList.length ) {
|
|
@@ -95,7 +92,7 @@ export default class Notifications {
|
|
|
95
92
|
}
|
|
96
93
|
|
|
97
94
|
|
|
98
|
-
|
|
95
|
+
#close = ( notification: Notification ): void => {
|
|
99
96
|
notification.hide().then( () => {
|
|
100
97
|
this.#notificationsList = slice( this.#notificationsList, notification );
|
|
101
98
|
|
|
@@ -109,57 +106,67 @@ export default class Notifications {
|
|
|
109
106
|
/**
|
|
110
107
|
* Add a new notification.
|
|
111
108
|
*/
|
|
112
|
-
add( html: string, type?:
|
|
113
|
-
this
|
|
114
|
-
|
|
109
|
+
add( html: string, type?: FLib.Notifications.Type, notificationOptions?: FLib.Notifications.NotificationOptions ): this {
|
|
110
|
+
this.#insertNotification( html, type, notificationOptions );
|
|
111
|
+
|
|
112
|
+
return this;
|
|
113
|
+
}
|
|
115
114
|
|
|
116
115
|
|
|
117
116
|
/**
|
|
118
117
|
* Add a new information notification.
|
|
119
118
|
*/
|
|
120
|
-
addInfo( html: string, notificationOptions?:
|
|
121
|
-
this
|
|
122
|
-
|
|
119
|
+
addInfo( html: string, notificationOptions?: FLib.Notifications.NotificationOptions ): this {
|
|
120
|
+
this.#insertNotification( html, 'info', notificationOptions );
|
|
121
|
+
|
|
122
|
+
return this;
|
|
123
|
+
}
|
|
123
124
|
|
|
124
125
|
|
|
125
126
|
/**
|
|
126
127
|
* Add a new success notification.
|
|
127
128
|
*/
|
|
128
|
-
addSuccess( html: string, notificationOptions?:
|
|
129
|
-
this
|
|
130
|
-
|
|
129
|
+
addSuccess( html: string, notificationOptions?: FLib.Notifications.NotificationOptions ): this {
|
|
130
|
+
this.#insertNotification( html, 'success', notificationOptions );
|
|
131
|
+
|
|
132
|
+
return this;
|
|
133
|
+
}
|
|
131
134
|
|
|
132
135
|
|
|
133
136
|
/**
|
|
134
137
|
* Add a new warning notification.
|
|
135
138
|
*/
|
|
136
|
-
addWarning( html: string, notificationOptions?:
|
|
137
|
-
this
|
|
138
|
-
|
|
139
|
+
addWarning( html: string, notificationOptions?: FLib.Notifications.NotificationOptions ): this {
|
|
140
|
+
this.#insertNotification( html, 'warning', notificationOptions );
|
|
141
|
+
|
|
142
|
+
return this;
|
|
143
|
+
}
|
|
139
144
|
|
|
140
145
|
|
|
141
146
|
/**
|
|
142
147
|
* Add a new error/danger notification.
|
|
143
148
|
*/
|
|
144
|
-
addDanger( html: string, notificationOptions?:
|
|
145
|
-
this
|
|
146
|
-
|
|
149
|
+
addDanger( html: string, notificationOptions?: FLib.Notifications.NotificationOptions ): this {
|
|
150
|
+
this.#insertNotification( html, 'danger', notificationOptions );
|
|
151
|
+
|
|
152
|
+
return this;
|
|
153
|
+
}
|
|
147
154
|
|
|
148
155
|
|
|
149
156
|
/**
|
|
150
157
|
* Close all notifications
|
|
151
158
|
*/
|
|
152
|
-
closeAll() {
|
|
159
|
+
closeAll(): Promise<any[]> {
|
|
153
160
|
return Promise.all( this.#notificationsList.map( notification => notification.hide() ) );
|
|
154
|
-
}
|
|
161
|
+
}
|
|
155
162
|
|
|
156
163
|
|
|
157
164
|
/**
|
|
158
165
|
* Close all notifications and remove all containers
|
|
159
166
|
*/
|
|
160
|
-
clean() {
|
|
167
|
+
clean(): Promise<Element> {
|
|
161
168
|
return this.closeAll()
|
|
162
169
|
.then( () => remove( this.#$notifications ) );
|
|
163
|
-
}
|
|
170
|
+
}
|
|
164
171
|
}
|
|
165
172
|
|