@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.
Files changed (141) hide show
  1. package/CHANGELOG.md +30 -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 +5 -6
  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 +95 -0
  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
package/CHANGELOG.md CHANGED
@@ -1,6 +1,36 @@
1
1
  # CHANGELOG
2
2
 
3
3
 
4
+ ## 7.1.2
5
+
6
+ * Typescript: Fix some type
7
+
8
+
9
+ ## 7.1.1
10
+
11
+ * Validator: Fix error message generation
12
+
13
+
14
+ ## 7.1.0
15
+
16
+ * Typescript cleanup
17
+ * Remove micro templating modules
18
+ * Fix Validator missing files
19
+
20
+ **Compatibility warning:**
21
+
22
+ * SkinSelect: Change templating system
23
+ * Popin: Change templating system
24
+ * onImageLoad and onAllImagesLoad:
25
+ * Update function signature
26
+ * Update callback param from array to hash
27
+
28
+
29
+ ## 7.0.7
30
+
31
+ * Add transition helpers function : `transitionWatcher`, `animationWatcher` and `killWatcher`
32
+
33
+
4
34
  ## 7.0.6
5
35
 
6
36
  * onTransitionEnd: handle pseudo element and specific css property
package/DOM/Class.ts CHANGED
@@ -11,7 +11,7 @@ function normalizeCssClass( cssClass: string[] | string ): string[] {
11
11
  }
12
12
 
13
13
 
14
- function isIterable( obj: ClassInputType ): boolean {
14
+ function isIterable( obj: FLib.DOM.ClassInput ): boolean {
15
15
  return ( obj instanceof NodeList || obj instanceof Array ) && typeof obj.forEach !== 'undefined'
16
16
  }
17
17
 
@@ -30,7 +30,7 @@ function applyToggle( $element: Element, cleanedCssClass: string[], forceAdd?: b
30
30
 
31
31
 
32
32
  // Use to toggle class only
33
- function classToggle( $elements: ClassInputType, cssClass: string | string[], forceAdd?: boolean ): ClassInputType {
33
+ function classToggle( $elements: FLib.DOM.ClassInput, cssClass: string | string[], forceAdd?: boolean ): FLib.DOM.ClassInput {
34
34
  const cleanedCssClass: string[] = normalizeCssClass( cssClass );
35
35
 
36
36
  if ( isIterable( $elements ) ) {
@@ -47,7 +47,7 @@ function classToggle( $elements: ClassInputType, cssClass: string | string[], fo
47
47
 
48
48
 
49
49
  // Used to add/remove class only
50
- function classChange( $elements: ClassInputType, cssClass: string | string[], add: boolean ): ClassInputType {
50
+ function classChange( $elements: FLib.DOM.ClassInput, cssClass: string | string[], add: boolean ): FLib.DOM.ClassInput {
51
51
  const functionName: 'add' | 'remove' = add ? 'add' : 'remove';
52
52
  const cleanedCssClass: string[] = normalizeCssClass( cssClass );
53
53
 
@@ -86,8 +86,6 @@ function classReplace( $element: Element, oldCssClass: string, newCssClass:strin
86
86
  *
87
87
  * @example
88
88
  * boolean = hClass( $element, "css-class" )
89
- *
90
- * @return - true if a class is present on a DOM element
91
89
  */
92
90
  export function hClass( $element: Element, cssClass: string ): boolean {
93
91
  return $element.classList.contains( cssClass );
@@ -105,7 +103,7 @@ export function hClass( $element: Element, cssClass: string ): boolean {
105
103
  *
106
104
  * @returns $elements
107
105
  */
108
- export function aClass( $elements: ClassInputType, cssClass: string | string[] ): ClassInputType {
106
+ export function aClass( $elements: FLib.DOM.ClassInput, cssClass: string | string[] ): FLib.DOM.ClassInput {
109
107
  return classChange( $elements, cssClass, true );
110
108
  }
111
109
 
@@ -120,7 +118,7 @@ export function aClass( $elements: ClassInputType, cssClass: string | string[] )
120
118
  *
121
119
  * @returns $elements
122
120
  */
123
- export function rClass( $elements: ClassInputType, cssClass: string | string[] ): ClassInputType {
121
+ export function rClass( $elements: FLib.DOM.ClassInput, cssClass: string | string[] ): FLib.DOM.ClassInput {
124
122
  return classChange( $elements, cssClass, false );
125
123
  }
126
124
 
@@ -140,7 +138,7 @@ export function rClass( $elements: ClassInputType, cssClass: string | string[] )
140
138
  *
141
139
  * @returns $elements
142
140
  */
143
- export function tClass( $elements: ClassInputType, cssClass: string | string[], forceAdd?: boolean ): ClassInputType {
141
+ export function tClass( $elements: FLib.DOM.ClassInput, cssClass: string | string[], forceAdd?: boolean ): FLib.DOM.ClassInput {
144
142
  return classToggle(
145
143
  $elements,
146
144
  cssClass,
@@ -153,16 +151,16 @@ export function tClass( $elements: ClassInputType, cssClass: string | string[],
153
151
  * Replace a css class by another.
154
152
  * Remove oldCssClass and add newCssClass only if oldCssClass exists
155
153
  *
156
- * @param $elements
157
- * @param oldCssClass
158
- * @param newCssClass
154
+ * @param $elements - DOM element or array of DOM element
155
+ * @param oldCssClass - Class name to replace
156
+ * @param newCssClass - Class name used to replace the old one
159
157
  *
160
158
  * @example
161
159
  * sClass( $elements, "old-css-class", "new-css-class" )
162
160
  *
163
161
  * @returns $elements
164
162
  */
165
- export function sClass( $elements: ClassInputType, oldCssClass: string, newCssClass: string ): ClassInputType {
163
+ export function sClass( $elements: FLib.DOM.ClassInput, oldCssClass: string, newCssClass: string ): FLib.DOM.ClassInput {
166
164
 
167
165
  if ( isIterable( $elements ) ) {
168
166
  ($elements as Element[]).forEach( $element => {
@@ -2,9 +2,11 @@
2
2
  * Get the current document size
3
3
  *
4
4
  * @example
5
+ * ```ts
5
6
  * { width, height } = documentSize()
7
+ * ```
6
8
  */
7
- export function documentSize(): DOMSizeType {
9
+ export function documentSize(): FLib.DOM.Size {
8
10
  return {
9
11
  "height": document.documentElement.scrollHeight,
10
12
  "width": document.documentElement.scrollWidth
package/DOM/Filter.ts CHANGED
@@ -6,8 +6,6 @@
6
6
  *
7
7
  * @example
8
8
  * filteredArray = filter( $elements, 'div.some-class' );
9
- *
10
- * @return Filtered list
11
9
  */
12
10
  export function filter( $elements: NodeList | Element[], selector: string ): Element[] {
13
11
  const $filteredElements: Element[] = [];
package/DOM/Index.ts CHANGED
@@ -1,15 +1,13 @@
1
1
  /**
2
2
  * Return the index of a DOM element
3
3
  *
4
- * @param $element
5
- *
6
4
  * @example
7
5
  * elementIndex = index( $element );
8
6
  *
9
7
  * @returns - Position (starting at 0) of the element in the DOM list is belong to. -1 if there is no parentNode.
10
8
  */
11
9
  export function index( $element: Element ): number {
12
- let $child: ChildNode | null, idx: number;
10
+ let $child: ChildNode | null, idx: number;
13
11
 
14
12
  if ( !$element.parentNode ) {
15
13
  return -1;
@@ -70,8 +70,6 @@ export function insertAfter( $what: Element, $after: Element ): Element {
70
70
  /**
71
71
  * Clone a DOM element
72
72
  *
73
- * @param $element
74
- *
75
73
  * @example
76
74
  * $clonedElement = clone( $element )
77
75
  *
@@ -85,7 +83,6 @@ export function clone( $element: Node ): Node {
85
83
  /**
86
84
  * Remove an element from the DOM
87
85
  *
88
- * @param $element
89
86
  * @param $parentNode - If undefined the parentNode will be used
90
87
  *
91
88
  * @example
package/DOM/Matrix.ts CHANGED
@@ -4,15 +4,15 @@ import { transformPropertyName } from '../Tools/PrefixedProperties';
4
4
  /**
5
5
  * Get the matrix of a DOM element
6
6
  *
7
- * @param $elem
8
- *
9
7
  * @example
8
+ * ```ts
10
9
  * { m11, m21, m31, m41, m12, m22, m32, m42, m13, m23, m33, m43, m14, m24, m34, m44 } = getMatrix ( $elem )
10
+ * ```
11
11
  *
12
12
  * @returns the translate properties
13
13
  */
14
- export function getMatrix( $elem: Element ): MatrixMatrixType {
15
- let matrix: MatrixMatrixType;
14
+ export function getMatrix( $elem: Element ): FLib.Matrix.Matrix {
15
+ let matrix: FLib.Matrix.Matrix;
16
16
 
17
17
  const matrixString = prop( $elem, transformPropertyName );
18
18
  const c = matrixString.split( /\s*[(),]\s*/ ).slice( 1, -1 );
@@ -88,15 +88,15 @@ export function getMatrix( $elem: Element ): MatrixMatrixType {
88
88
  /**
89
89
  * Get the translation values of a DOM element
90
90
  *
91
- * @param $elem
92
- *
93
91
  * @example
92
+ * ```ts
94
93
  * { tx, ty, tz } = getTranslate ( $elem )
94
+ * ```
95
95
  *
96
96
  * @returns the translate properties
97
97
  */
98
- export function getTranslate( $elem: Element ): MatrixTranslateType {
99
- const matrix: MatrixMatrixType = getMatrix( $elem );
98
+ export function getTranslate( $elem: Element ): FLib.Matrix.Translate {
99
+ const matrix: FLib.Matrix.Matrix = getMatrix( $elem );
100
100
 
101
101
  return {
102
102
  "tx": matrix.m41,
@@ -109,17 +109,17 @@ export function getTranslate( $elem: Element ): MatrixTranslateType {
109
109
  /**
110
110
  * Get the transform values of a DOM element
111
111
  *
112
- * @param $elem
113
- *
114
112
  * @example
113
+ * ```ts
115
114
  * { tx, ty, tz, rx, ry, rz } = getTransform ( $elem )
115
+ * ```
116
116
  *
117
117
  * @returns the transform properties
118
118
  */
119
- export function getTransform( $elem: Element ): MatrixTransformType {
119
+ export function getTransform( $elem: Element ): FLib.Matrix.Transform {
120
120
  let rotateX: number, rotateZ: number;
121
121
 
122
- const matrix: MatrixMatrixType = getMatrix( $elem );
122
+ const matrix: FLib.Matrix.Matrix = getMatrix( $elem );
123
123
  const rotateY: number = Math.asin( -matrix.m13 );
124
124
 
125
125
  if ( Math.cos(rotateY) !== 0 ) {
package/DOM/Offset.ts CHANGED
@@ -10,26 +10,25 @@ function getWindow( $element: Window | Document ): Window | null {
10
10
  /**
11
11
  * Get the transform values of a DOM element
12
12
  *
13
- * @param $element
14
13
  * @param isRelativeToViewport - If true, the position is computed relatively to the viewport (top/left of the browser) and not the top/left of the document. This mean, it doesn't take the scroll in count.
15
14
  * @param $relativeTo - Optional, compute top and left relatively to another Element
16
15
  *
17
16
  * @example
17
+ * ```ts
18
18
  * // Get offset from the top/left of the document
19
19
  * { width, height, top, left, bottom, right } = offset( $element )
20
20
  *
21
- * @example
22
21
  * // Same without taking the scroll position in count (top/left of the browser).
23
22
  * result = offset( $element, true )
24
23
  *
25
- * @example
26
24
  * // Get offset relatively from another element
27
25
  * result = offset( $element, false, $target )
26
+ * ```
28
27
  *
29
28
  * @returns the offset properties
30
29
  */
31
- export function offset( $element: Element, isRelativeToViewport?: boolean, $relativeTo?: Element ): OffsetType {
32
- let $window, rootValue, box: OffsetType;
30
+ export function offset( $element: Element, isRelativeToViewport?: boolean, $relativeTo?: Element ): FLib.DOM.Offset {
31
+ let $window, rootValue, box: FLib.DOM.Offset;
33
32
 
34
33
  box = { "top": 0, "y": 0, "left": 0, "x": 0, "right": 0, "bottom": 0, "width": 0, "height": 0 };
35
34
  const $document = $element && $element.ownerDocument;
package/DOM/OuterSize.ts CHANGED
@@ -3,10 +3,10 @@ import { getStyle } from './Styles';
3
3
 
4
4
  function getOuterDim(
5
5
  $element: HTMLElement,
6
- border: boolean = false,
7
- margin: boolean = false,
6
+ border = false,
7
+ margin = false,
8
8
  dimensionName?: string
9
- ): DOMSizeType {
9
+ ): FLib.DOM.Size {
10
10
  let size, elementStyle;
11
11
 
12
12
 
@@ -43,21 +43,21 @@ function getOuterDim(
43
43
  /**
44
44
  * Get the outside width of a DOM element
45
45
  *
46
- * @param $element
47
46
  * @param border - Include border width?
48
47
  * @param margin - Include margin width?
49
48
  *
50
49
  * @example
50
+ * ```ts
51
51
  * // width including padding
52
52
  * elementWidth = outerWidth($element)
53
53
  *
54
- * @example
55
54
  * // width including padding, border and margin
56
55
  * elementWidth = outerWidth($element, true, true)
56
+ * ```
57
57
  *
58
58
  * @returns The width of the object
59
59
  */
60
- export function outerWidth( $element: HTMLElement, border: boolean = false, margin: boolean = false ): number {
60
+ export function outerWidth( $element: HTMLElement, border = false, margin = false ): number {
61
61
  return getOuterDim(
62
62
  $element,
63
63
  border,
@@ -70,21 +70,21 @@ export function outerWidth( $element: HTMLElement, border: boolean = false, marg
70
70
  /**
71
71
  * Get the outside height of a DOM element
72
72
  *
73
- * @param $element
74
73
  * @param border - Include border width?
75
74
  * @param margin - Include margin width?
76
75
  *
77
76
  * @example
77
+ * ```ts
78
78
  * // height including padding
79
79
  * elementHeight = outerHeight($element)
80
80
  *
81
- * @example
82
81
  * // height including padding, border and margin
83
82
  * elementHeight = outerHeight($element, true, true)
83
+ * ```
84
84
  *
85
85
  * @returns the height of the object
86
86
  */
87
- export function outerHeight( $element: HTMLElement, border: boolean = false, margin: boolean = false ): number {
87
+ export function outerHeight( $element: HTMLElement, border = false, margin = false ): number {
88
88
  return getOuterDim(
89
89
  $element,
90
90
  border,
@@ -97,21 +97,21 @@ export function outerHeight( $element: HTMLElement, border: boolean = false, mar
97
97
  /**
98
98
  * Get the outside size of a DOM element
99
99
  *
100
- * @param $element
101
100
  * @param border - Include border width?
102
101
  * @param margin - Include margin width?
103
102
  *
104
103
  * @example
104
+ * ```ts
105
105
  * // size including padding
106
106
  * {width, height} = outerSize($element)
107
107
  *
108
- * @example
109
108
  * // height including padding, border and margin
110
109
  * size = outerSize($element, true, true)
110
+ * ```
111
111
  *
112
112
  * @returns The width and height of the object
113
113
  */
114
- export function outerSize( $element: HTMLElement, border: boolean = false, margin: boolean = false ): DOMSizeType {
114
+ export function outerSize( $element: HTMLElement, border = false, margin = false ): FLib.DOM.Size {
115
115
  return getOuterDim(
116
116
  $element,
117
117
  border,
package/DOM/PageToDOM.ts CHANGED
@@ -232,10 +232,10 @@ function string2dom( html: string, callback: ( document: Document, destroy: () =
232
232
  /**
233
233
  * Convert a whole HTML page string in a document
234
234
  *
235
- * @param html
236
- *
237
235
  * @example
236
+ * ```ts
238
237
  * pageToDOM( html ).then( $document => {} )
238
+ * ```
239
239
  *
240
240
  * @returns a Promise with the converted document in parameter
241
241
  */
package/DOM/Position.ts CHANGED
@@ -2,18 +2,18 @@
2
2
  * Return the position of an element or
3
3
  * The position relative to another element
4
4
  *
5
- * @param $element
6
5
  * @param $target - If set, the position of $element will be computed relatively to this element
7
6
  *
8
7
  * @example
8
+ * ```ts
9
9
  * { top, left } = position( $element )
10
10
  *
11
- * @example
12
11
  * { top, left } = position( $element, $target )
12
+ * ```
13
13
  *
14
14
  * @returns The coordinate of the object
15
15
  */
16
- export function position( $element: HTMLElement, $target?: HTMLElement ): DOMPositionType {
16
+ export function position( $element: HTMLElement, $target?: HTMLElement ): FLib.DOM.Position {
17
17
 
18
18
  if ( !$target ) {
19
19
  return {
package/DOM/Size.ts CHANGED
@@ -4,8 +4,6 @@ import { prop, getStyle } from './Styles';
4
4
  /**
5
5
  * Compute the width of an element
6
6
  *
7
- * @param $element
8
- *
9
7
  * @example
10
8
  * elementWidth = width( $element )
11
9
  *
@@ -19,8 +17,6 @@ export function width( $element: Element ): number {
19
17
  /**
20
18
  * Compute the height of an element
21
19
  *
22
- * @param $element
23
- *
24
20
  * @example
25
21
  * elementHeight = height( $element )
26
22
  *
@@ -34,14 +30,14 @@ export function height( $element: Element ): number {
34
30
  /**
35
31
  * Compute the size of an element
36
32
  *
37
- * @param $element
38
- *
39
33
  * @example
34
+ * ```ts
40
35
  * {width, height} = size( $element )
36
+ * ```
41
37
  *
42
38
  * @returns The width and height of an element
43
39
  */
44
- export function size( $element: Element ): DOMSizeType {
40
+ export function size( $element: Element ): FLib.DOM.Size {
45
41
  const style = getStyle( $element );
46
42
  const width = style[ 'width' ];
47
43
  const height = style[ 'height' ];
package/DOM/StrToDOM.ts CHANGED
@@ -1,7 +1,6 @@
1
1
  /**
2
2
  * Convert an html string into a DOM object
3
3
  *
4
- * @param html
5
4
  * @param tag - Used to create an element to convert html inside. 'DIV' by default
6
5
  *
7
6
  * @example
package/DOM/Styles.ts CHANGED
@@ -1,8 +1,6 @@
1
1
  /**
2
2
  * Return the style of a DOM element
3
3
  *
4
- * @param $element
5
- *
6
4
  * @example
7
5
  * styles = getStyle($element)
8
6
  */
@@ -14,32 +12,28 @@ export function getStyle( $element: Element ): CSSStyleDeclaration {
14
12
  /**
15
13
  * Return the value of a style property of a DOM element
16
14
  *
17
- * @param $element
18
15
  * @param property - Camel case property name
19
16
  *
20
17
  * @example
21
18
  * styles = prop($element, 'marginTop')
22
19
  */
23
20
  export function prop( $element: Element, property: string ): string {
24
- return getStyle( $element )[ <any>property ];
21
+ return getStyle( $element )[ property ];
25
22
  }
26
23
 
27
24
 
28
25
  /**
29
26
  * Set a CSS property on an element
30
27
  *
31
- * @param $element
32
- * @param property
33
- * @param value
34
- *
35
28
  * @example
29
+ * ```ts
36
30
  * $element = setCssVar($element, '--my-var', '12px')
37
31
  *
38
- * @example
39
32
  * $element = setCssVar($element, {
40
33
  * "--my-var": "12px",
41
34
  * "--my-var-2": "100%"
42
35
  * })
36
+ * ```
43
37
  *
44
38
  * @returns $element
45
39
  */
@@ -62,9 +56,6 @@ export function setCssProperty(
62
56
  /**
63
57
  * Get a CSS property of an element
64
58
  *
65
- * @param $element
66
- * @param property
67
- *
68
59
  * @example
69
60
  * value = getCssProperty($element, '--my-var')
70
61
  */
package/DOM/Traversing.ts CHANGED
@@ -1,8 +1,6 @@
1
1
  /**
2
2
  * Return the next element in the DOM
3
3
  *
4
- * @param $element
5
- *
6
4
  * @example
7
5
  * $nextElement = next($element)
8
6
  *
@@ -16,8 +14,6 @@ export function next( $element: Element ): Element | null {
16
14
  /**
17
15
  * Return the previous element in the DOM
18
16
  *
19
- * @param $element
20
- *
21
17
  * @example
22
18
  * $previousElement = previous($element)
23
19
  *
@@ -31,8 +27,6 @@ export function previous( $element: Element ): Element | null {
31
27
  /**
32
28
  * Return all the children of a DOM element
33
29
  *
34
- * @param $element
35
- *
36
30
  * @example
37
31
  * $elements = children($element)
38
32
  */
@@ -2,11 +2,13 @@
2
2
  * Get the scroll position of the window
3
3
  *
4
4
  * @example
5
+ * ```ts
5
6
  * {top, left} = scroll()
7
+ * ```
6
8
  *
7
9
  * @returns The position of the scroll
8
10
  */
9
- export function windowScroll(): DOMPositionType {
11
+ export function windowScroll(): FLib.DOM.Position {
10
12
  let sx, sy, d, r, b;
11
13
 
12
14
  if ( window.pageYOffset !== undefined ) {
package/DOM/WindowSize.ts CHANGED
@@ -2,11 +2,13 @@
2
2
  * Get the size of the window
3
3
  *
4
4
  * @example
5
+ * ```ts
5
6
  * {width, height} = windowSize()
7
+ * ```
6
8
  *
7
9
  * @returns The width and height of the window
8
10
  */
9
- export function windowSize(): DOMSizeType {
11
+ export function windowSize(): FLib.DOM.Size {
10
12
  return {
11
13
  "width": window.innerWidth,
12
14
  "height": window.innerHeight
package/DOM/Wrap.ts CHANGED
@@ -4,7 +4,6 @@ import { isString } from '../Helpers/Type';
4
4
  /**
5
5
  * Wrap a DOM element in another
6
6
  *
7
- * @param $element
8
7
  * @param tag - String example: <span></span>
9
8
  *
10
9
  * @example