@creative-web-solution/front-library 7.0.7 → 7.1.3

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 +29 -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 +12 -18
  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 +14 -23
  46. package/Helpers/Wait.ts +1 -1
  47. package/Modules/Accordion/Tab.ts +19 -17
  48. package/Modules/Accordion/index.ts +27 -19
  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 +12 -12
  58. package/Modules/Popin/PopinController.ts +24 -30
  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 +52 -38
  63. package/Modules/SkinFile.ts +63 -53
  64. package/Modules/SkinRadio.ts +63 -43
  65. package/Modules/SkinSelect.ts +117 -101
  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 +28 -24
  70. package/Modules/Tabs/index.ts +36 -26
  71. package/Modules/Validator/Date.ts +2 -1
  72. package/Modules/Validator/Equals.ts +1 -1
  73. package/Modules/Validator/Internal/Input.ts +366 -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 +41 -0
  97. package/Types/Autocomplete.d.ts +94 -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 +63 -0
  104. package/Types/Notifications.d.ts +48 -44
  105. package/Types/Popin.d.ts +113 -0
  106. package/Types/ScrollSnap.d.ts +66 -0
  107. package/Types/SkinCheckbox.d.ts +35 -0
  108. package/Types/SkinFile.d.ts +45 -0
  109. package/Types/SkinRadio.d.ts +37 -0
  110. package/Types/SkinSelect.d.ts +72 -0
  111. package/Types/Slider.d.ts +106 -0
  112. package/Types/Tabs.d.ts +33 -0
  113. package/Types/Validator.d.ts +99 -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
@@ -1,14 +1,14 @@
1
1
  /**
2
2
  * All colors go to white on the current image et go to the color of the next one
3
3
  */
4
- export default class Solarisation implements GLImageTransitionPreset {
4
+ export default class Solarisation implements FLib.GLImageTransition.Preset {
5
5
 
6
6
  #fadeToBlack: boolean;
7
7
  #fadeToBlackValue: number;
8
8
  #U_FADE_TO_BLACK!: WebGLUniformLocation | null;
9
9
 
10
10
 
11
- get fsSource() {
11
+ get fsSource(): string {
12
12
  return `
13
13
  #ifdef GL_ES
14
14
  precision mediump float;
@@ -39,11 +39,11 @@ export default class Solarisation implements GLImageTransitionPreset {
39
39
  `;
40
40
  }
41
41
 
42
- get fadeToBlack() {
42
+ get fadeToBlack(): boolean {
43
43
  return this.#fadeToBlack;
44
44
  }
45
45
 
46
- get U_FADE_TO_BLACK() {
46
+ get U_FADE_TO_BLACK(): WebGLUniformLocation | null {
47
47
  return this.#U_FADE_TO_BLACK;
48
48
  }
49
49
 
@@ -52,7 +52,7 @@ export default class Solarisation implements GLImageTransitionPreset {
52
52
  /**
53
53
  * Solarisation constructor
54
54
  *
55
- * @param {Boolean} fadeToBlack - Fade to black instead of white
55
+ * @param fadeToBlack - Fade to black instead of white
56
56
  */
57
57
  constructor( fadeToBlack = false ) {
58
58
  this.#fadeToBlack = fadeToBlack;
@@ -62,21 +62,16 @@ export default class Solarisation implements GLImageTransitionPreset {
62
62
 
63
63
  /**
64
64
  * Create specific uniforms for this preset
65
- *
66
- * @param {WebGLRenderingContext} GL
67
- * @param {WebGLProgram} SHADER_PROGRAM
68
65
  */
69
- addUniform( GL, SHADER_PROGRAM ) {
66
+ addUniform( GL: WebGLRenderingContext, SHADER_PROGRAM: WebGLProgram ): void {
70
67
  this.#U_FADE_TO_BLACK = GL.getUniformLocation( SHADER_PROGRAM, 'uFadeToBlack' );
71
68
  }
72
69
 
73
70
 
74
71
  /**
75
72
  * Update the uniforms of this preset during render
76
- *
77
- * @param {WebGLRenderingContext} GL
78
73
  */
79
- updateUniform( GL ) {
74
+ updateUniform( GL: WebGLRenderingContext ): void {
80
75
  GL.uniform1f( this.#U_FADE_TO_BLACK, this.#fadeToBlackValue );
81
76
  }
82
77
  }
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "@creative-web-solution/front-library",
3
3
  "title": "Frontend library",
4
4
  "description": "Frontend functions and modules",
5
- "version": "7.0.7",
5
+ "version": "7.1.3",
6
6
  "homepage": "https://github.com/creative-web-solution/front-library",
7
7
  "author": "Creative Web Solution <contact@cws-studio.com> (https://www.cws-studio.com)",
8
8
  "keywords": [],
@@ -1,209 +0,0 @@
1
- // From underscore
2
-
3
- const _ = {};
4
-
5
- // By default, Underscore uses ERB-style template delimiters, change the
6
- // following template settings to use alternative delimiters.
7
- const templateSettings = {
8
- "evaluate": /<%([\s\S]+?)%>/g,
9
- "interpolate": /<%=([\s\S]+?)%>/g,
10
- "escape": /<%-([\s\S]+?)%>/g
11
- };
12
-
13
- // When customizing `templateSettings`, if you don't want to define an
14
- // interpolation, evaluation or escaping regex, we need one that is
15
- // guaranteed not to match.
16
- const noMatch = /(.)^/;
17
-
18
- // Certain characters need to be escaped so that they can be put into a
19
- // string literal.
20
- const escapes = {
21
- "'": "'",
22
- '\\': '\\',
23
- '\r': 'r',
24
- '\n': 'n',
25
- '\t': 't',
26
- '\u2028': 'u2028',
27
- '\u2029': 'u2029'
28
- };
29
-
30
- const escaper = /\\|'|\r|\n|\t|\u2028|\u2029/g;
31
-
32
- // List of HTML entities for escaping.
33
- const entityMap = {
34
- "escape": {
35
- '&': '&amp;',
36
- '<': '&lt;',
37
- '>': '&gt;',
38
- '"': '&quot;',
39
- "'": '&#x27;'
40
- },
41
- "unescape": {}
42
- };
43
-
44
- function objectKeys(obj) {
45
- if (obj !== Object(obj)) {
46
- return [];
47
- }
48
- return Object.keys(obj);
49
- }
50
-
51
- // Invert the keys and values of an object. The values must be serializable.
52
- function invert(obj) {
53
- let result = {},
54
- keys = objectKeys(obj);
55
-
56
- for (let i = 0, length = keys.length; i < length; i++) {
57
- result[obj[keys[i]]] = keys[i];
58
- }
59
-
60
- return result;
61
- }
62
-
63
- entityMap.unescape = invert( entityMap.escape );
64
-
65
- // "Regexes" containing the keys and values listed immediately above.
66
- let entityRegexes = {
67
- escape: new RegExp(
68
- '[' + objectKeys(entityMap.escape).join('') + ']',
69
- 'g'
70
- ),
71
- unescape: new RegExp(
72
- '(' + objectKeys(entityMap.unescape).join('|') + ')',
73
- 'g'
74
- )
75
- }
76
-
77
- // Functions for escaping and unescaping strings to/from HTML interpolation.
78
- ;['escape', 'unescape'].forEach(method => {
79
- _[method] = function(string) {
80
- if (string == null) {
81
- return '';
82
- }
83
-
84
- return ('' + string).replace(entityRegexes[method], match => {
85
- return entityMap[method][match];
86
- });
87
- }
88
- })
89
-
90
- // Fill in a given object with default properties.
91
- function defaults(...obj) {
92
- obj.forEach(source => {
93
- if (source) {
94
- for (let prop in source) {
95
- if (obj[prop] === void 0) {
96
- obj[prop] = source[prop];
97
- }
98
- }
99
- }
100
- });
101
-
102
- return obj;
103
- }
104
-
105
- // JavaScript micro-templating, similar to John Resig's implementation.
106
- // Underscore templating handles arbitrary delimiters, preserves whitespace,
107
- // and correctly escapes quotes within interpolated code.
108
- /**
109
- * Micro templating from Underscore
110
- *
111
- * @param text
112
- * @param data
113
- * @param [settings]
114
- * @param [settings.evaluate=/<%([\s\S]+?)%>/g]
115
- * @param [settings.interpolate=/<%=([\s\S]+?)%>/g]
116
- * @param [settings.escape=/<%-([\s\S]+?)%>/g]
117
- *
118
- * @see extra/modules/template.md
119
- *
120
- * @example
121
- * let tplFunction = template( html );
122
- * let html = tplFunction( { "text": "hey!!" } );
123
- *
124
- * @example
125
- *
126
- * let html = template( html, { "text": "hey!!" } );
127
- */
128
- export default function template( text: string, data?, settings? ) {
129
- let render, index, source, tpl
130
-
131
- settings = defaults({}, templateSettings, settings)
132
-
133
- // Combine delimiters into one regular expression via alternation.
134
- let matcher = new RegExp(
135
- [
136
- (settings.escape || noMatch).source,
137
- (settings.interpolate || noMatch).source,
138
- (settings.evaluate || noMatch).source
139
- ].join('|') + '|$',
140
- 'g'
141
- )
142
-
143
- // Compile the template source, escaping string literals appropriately.
144
- index = 0;
145
- source = "__p+='";
146
-
147
- text.replace(
148
- matcher,
149
- (match, escape, interpolate, evaluate, offset) => {
150
- source += text.slice(index, offset).replace(escaper, match => {
151
- return '\\' + escapes[match];
152
- });
153
-
154
- if (escape) {
155
- source +=
156
- "'+\n((__t=(" +
157
- escape +
158
- "))==null?'':_.escape(__t))+\n'";
159
- }
160
-
161
- if (interpolate) {
162
- source += "'+\n((__t=(" + interpolate + "))==null?'':__t)+\n'";
163
- }
164
-
165
- if (evaluate) {
166
- source += "';\n" + evaluate + "\n__p+='";
167
- }
168
-
169
- index = offset + match.length;
170
-
171
- return match;
172
- }
173
- );
174
-
175
- source += "';\n";
176
-
177
- // If a variable is not specified, place data values in local scope.
178
- if (!settings.variable) {
179
- source = 'with(obj||{}){\n' + source + '}\n';
180
- }
181
-
182
- source =
183
- "var __t,__p='',__j=Array.prototype.join," +
184
- "print=function(){__p+=__j.call(arguments,'');};\n" +
185
- source +
186
- 'return __p;\n';
187
-
188
- try {
189
- render = new Function(settings.variable || 'obj', '_', source);
190
- } catch (e) {
191
- e.source = source;
192
- throw e;
193
- }
194
-
195
- if (data) {
196
- return render(data, _);
197
- }
198
-
199
- tpl = function(data) {
200
- /** @ts-expect-error */
201
- return render.call(this, data, _);
202
- }
203
-
204
- // Provide the compiled function source as a convenience for precompilation.
205
- tpl.source = 'function(' + (settings.variable || 'obj') + '){\n' + source + '}';
206
-
207
- return tpl;
208
- }
209
-
@@ -1,29 +0,0 @@
1
- type AutocompleteLayerPositionType = 'top' | 'bottom';
2
-
3
- type AccordionAnimationFunctionType = ( $tab: HTMLElement, $panel: HTMLElement ) => Promise<void>;
4
- type AccordionCallbackType = ( $tab: HTMLElement, $panel: HTMLElement ) => void;
5
- type AccordionCloseCallbackType = ( $tab: HTMLElement, $panel: HTMLElement, autoclose: boolean ) => void;
6
-
7
-
8
- type AccordionOptionsType = {
9
- /** Default: 'button[aria-expanded]' */
10
- tabSelector: string;
11
- /** Default: false */
12
- allowMultipleTab?: boolean;
13
- /** Default: false */
14
- atLeastOneOpen?: boolean;
15
- onOpenAtStart?: AccordionCallbackType;
16
- onOpen?: AccordionCallbackType;
17
- onClose?: AccordionCloseCallbackType;
18
- animations?: {
19
- open?: AccordionAnimationFunctionType;
20
- close?: AccordionAnimationFunctionType;
21
- destroy?: AccordionAnimationFunctionType;
22
- }
23
- }
24
-
25
-
26
- type AccordionTabOptionsType = AccordionOptionsType & {
27
- onOpenTab: (( tab: Tab ) => void) | null;
28
- index: number;
29
- }
@@ -1,85 +0,0 @@
1
- type AutocompleteItemType = {
2
- name: string;
3
- [ key: string ]: any;
4
- }
5
-
6
- type AutocompleteOptionsType = {
7
- $searchField: HTMLElement;
8
- /** @default document.body */
9
- $panelWrapper?: HTMLElement;
10
- /** @default 200 */
11
- maxHeight?: number;
12
- /** @default false */
13
- useCache?: boolean;
14
- /** @default 3 */
15
- minchar?: number;
16
- /** @default AutocompleteLayerPosition.top */
17
- layerPosition?: AutocompleteLayerPosition;
18
- source?: ( query: string | null, callback: ( results: AutocompleteItemType[] ) => void ) => void;
19
- url?: string;
20
- /**
21
- * Use CSS or Javascript for the position of the layer
22
- * @default false
23
- */
24
- cssPositionning?: boolean;
25
- /**
26
- * Update or not the text field with the selected value
27
- * @default true
28
- */
29
- updateOnSelect?: boolean;
30
- onSelect?: ({ item, query, resultsList }) => void;
31
- queryParams?: ( query: string ) => { "search": string };
32
- normalize?: ( data: any ) => { success: boolean, results: AutocompleteItemType[] };
33
- /**
34
- * Allow to manipulate the displayed value of items
35
- * @default ({item, query, resultList}) => item.name
36
- */
37
- renderFieldValue?: (options: { item: AutocompleteItemType, query: string, resultList: AutocompleteItemType[] }) => string;
38
- /**
39
- * @default ({resultItem, query, index, itemsList, cssClass}) => `<li role="option" data-idx="${index}" class="${cssClass.item}"><a class="${cssClass.link}">${resultItem.markedName}</a></li>`
40
- */
41
- render?: ( options: { resultItem: AutocompleteItemType, query: string, index: number, itemsList: AutocompleteItemType[], cssClass: AutocompleteClassnameType }) => string;
42
- /**
43
- * @default ({resultList, query, cssClass}) => `<ul role="listbox" class="${cssClass.list}">${resultList.join('')}</ul>`
44
- */
45
- renderList?: ( options: { resultList: AutocompleteItemType[], query: string, cssClass: AutocompleteClassnameType }) => string;
46
- /**
47
- * @default ({errorMsg, query, cssClass}) => `<li class="${cssClass.error}">${errorMsg}</li>`
48
- */
49
- renderError?: (options: { errorMsg: string, query: string, cssClass: AutocompleteClassnameType }) => string;
50
- /**
51
- * Allow to wrap the query with a tag in the result item name
52
- * @default ({resultItem, reQuery, query, index, resultList, cssClass}) => {resultItem.name && (resultItem.markedName = resultItem.name.replace(reQuery,`<mark class="${cssClass.mark}">$1</mark>`));}
53
- */
54
- renderMark?: ( options: { resultItem: AutocompleteItemType, reQuery?: RegExp, query: string, index: number, resultList: AutocompleteItemType[], cssClass: AutocompleteClassnameType }) => void;
55
- l10n?: AutocompleteL10NType;
56
- className?: AutocompleteClassnameType;
57
- }
58
-
59
-
60
- type AutocompleteL10NType = {
61
- /** @default No result */
62
- noResult?: string;
63
- /** @default Server error */
64
- error?: string;
65
- }
66
-
67
- type AutocompleteClassnameType = {
68
- /** @default ac-layer */
69
- layer?: string;
70
- /** @default ac-list */
71
- list?: string;
72
- /** @default acl-itm */
73
- item?: string;
74
- /** @default acl-lnk */
75
- link?: string;
76
- /** @default acl-mrk */
77
- mark?: string;
78
- /** @default acl-error */
79
- error?: string;
80
- /** @default hover */
81
- hover?: string;
82
- /** @default disable */
83
- disable?: string;
84
- }
85
-
@@ -1,62 +0,0 @@
1
- type ClassInputType = Element | Element[] | Node | NodeList;
2
-
3
-
4
- interface OffsetType {
5
- top: number;
6
- y: number;
7
- left: number;
8
- x: number;
9
- right: number;
10
- bottom: number;
11
- width: number;
12
- height: number;
13
- }
14
-
15
-
16
- type DOMSizeType = {
17
- width: number;
18
- height: number;
19
- }
20
-
21
-
22
- type DOMPositionType = {
23
- left: number;
24
- top: number;
25
- }
26
-
27
-
28
- type MatrixTranslateType = {
29
- tx: number;
30
- ty: number;
31
- tz: number;
32
- }
33
-
34
-
35
- type MatrixTransformType = {
36
- tx: number;
37
- ty: number;
38
- tz: number;
39
- rx: number;
40
- ry: number;
41
- rz: number;
42
- }
43
-
44
-
45
- type MatrixMatrixType = {
46
- m11: number;
47
- m21: number;
48
- m31: number;
49
- m41: number;
50
- m12: number;
51
- m22: number;
52
- m32: number;
53
- m42: number;
54
- m13: number;
55
- m23: number;
56
- m33: number;
57
- m43: number;
58
- m14: number;
59
- m24: number;
60
- m34: number;
61
- m44: number;
62
- }
@@ -1,52 +0,0 @@
1
- type DragSliderCallbackParam = {
2
- item: any;
3
- xPos: number;
4
- moveMaxSize: number;
5
- isAtStart: boolean;
6
- isAtEnd: boolean;
7
- }
8
-
9
- type DragSliderItemType = {
10
- index: number;
11
- isFirst: boolean;
12
- isLast: boolean;
13
- $item: HTMLElement;
14
- info: OffsetType;
15
- }
16
-
17
- type DeltaMoveType = {
18
- x: number;
19
- deltaX: number;
20
- deltaY: number;
21
- newX: number;
22
- }
23
-
24
- type DragSliderCallback = ( data: DragSliderCallbackParam ) => void;
25
-
26
- type DragSliderOptions = {
27
- viewportSelector: string;
28
- listSelector: string;
29
- itemSelector: string;
30
- dragClass: string;
31
- /** @default is-locked */
32
- lockedClass?: string;
33
- onStartDrag?: DragSliderCallback;
34
- onDrag?: DragSliderCallback;
35
- onStopDrag?: DragSliderCallback;
36
- onSnap?: DragSliderCallback;
37
- onSnapUpdate?: DragSliderCallback;
38
- onMouseEnter?: DragSliderCallback;
39
- onMouseLeave?: DragSliderCallback;
40
- onInit?: DragSliderCallback;
41
- onChangeState?: ( isDragging: boolean ) => void;
42
- /**
43
- * In px.
44
- * @default 40
45
- */
46
- swipeTresholdMin?: number;
47
- /**
48
- * In % (0.5 = 50% of the size of one item).
49
- * @default 0.5
50
- */
51
- swipeTresholdSize?:number;
52
- }