@blackbyte/sugar 1.0.0-beta.1 → 1.0.0-beta.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 (149) hide show
  1. package/README.md +267 -1
  2. package/dist/js/dom/css/reloadStylesheets.d.ts +1 -1
  3. package/dist/js/dom/distance/distanceFromElementTopToViewportBottom.d.ts +2 -2
  4. package/dist/js/dom/distance/distanceFromElementTopToViewportBottom.js +3 -3
  5. package/dist/js/dom/distance/distanceFromElementTopToViewportBottom.js.map +1 -1
  6. package/dist/js/dom/distance/distanceFromElementTopToViewportTop.d.ts +2 -2
  7. package/dist/js/dom/distance/distanceFromElementTopToViewportTop.js +3 -3
  8. package/dist/js/dom/distance/distanceFromElementTopToViewportTop.js.map +1 -1
  9. package/dist/js/dom/event/viewportEvents.d.ts +2 -2
  10. package/dist/js/dom/form/generateIdFromForm.d.ts +2 -2
  11. package/dist/js/dom/form/generateIdFromForm.js +2 -2
  12. package/dist/js/dom/form/getFormValues.d.ts +2 -2
  13. package/dist/js/dom/form/getFormValues.js +2 -2
  14. package/dist/js/dom/iframe/iframeAutoSize.d.ts +3 -3
  15. package/dist/js/dom/iframe/iframeAutoSize.js +3 -3
  16. package/dist/js/dom/inject/injectHtml.d.ts +2 -2
  17. package/dist/js/dom/inject/injectHtml.js +2 -2
  18. package/dist/js/dom/inject/injectIframeContent.d.ts +1 -1
  19. package/dist/js/dom/inject/injectIframeContent.js +1 -1
  20. package/dist/js/dom/inject/injectScript.d.ts +1 -1
  21. package/dist/js/dom/inject/injectScript.js +1 -1
  22. package/dist/js/dom/inject/injectStyle.d.ts +1 -1
  23. package/dist/js/dom/offset/offsetFromParent.d.ts +2 -2
  24. package/dist/js/dom/offset/offsetFromParent.js +2 -2
  25. package/dist/js/dom/offset/offsetFromViewport.d.ts +4 -4
  26. package/dist/js/dom/offset/offsetFromViewport.js +5 -5
  27. package/dist/js/dom/offset/offsetFromViewport.js.map +1 -1
  28. package/dist/js/dom/on/onDrag.d.ts +3 -3
  29. package/dist/js/dom/on/onScrollEnd.d.ts +2 -2
  30. package/dist/js/dom/on/onSwipe.d.ts +9 -9
  31. package/dist/js/dom/on/onSwipe.js +9 -9
  32. package/dist/js/dom/position/positionFromEvent.d.ts +21 -3
  33. package/dist/js/dom/position/positionFromEvent.js +29 -4
  34. package/dist/js/dom/position/positionFromEvent.js.map +1 -1
  35. package/dist/js/dom/query/closestElement.d.ts +8 -8
  36. package/dist/js/dom/query/closestElement.js +8 -8
  37. package/dist/js/dom/query/closestNotVisibleElement.d.ts +2 -2
  38. package/dist/js/dom/query/closestNotVisibleElement.js +2 -2
  39. package/dist/js/dom/query/elementsInViewport.d.ts +2 -1
  40. package/dist/js/dom/query/elementsInViewport.js.map +1 -1
  41. package/dist/js/dom/query/matches.d.ts +1 -1
  42. package/dist/js/dom/query/matches.js +1 -1
  43. package/dist/js/dom/query/nearestElement.d.ts +5 -3
  44. package/dist/js/dom/query/nearestElement.js.map +1 -1
  45. package/dist/js/dom/query/nextElement.d.ts +2 -2
  46. package/dist/js/dom/query/nextElement.js +2 -2
  47. package/dist/js/dom/query/previousElement.d.ts +2 -2
  48. package/dist/js/dom/query/previousElement.js +2 -2
  49. package/dist/js/dom/query/querySelector.d.ts +3 -3
  50. package/dist/js/dom/query/querySelector.js +8 -2
  51. package/dist/js/dom/query/querySelector.js.map +1 -1
  52. package/dist/js/dom/query/querySelectorAll.d.ts +3 -3
  53. package/dist/js/dom/query/querySelectorAll.js +8 -2
  54. package/dist/js/dom/query/querySelectorAll.js.map +1 -1
  55. package/dist/js/dom/query/querySelectorLive.d.ts +6 -6
  56. package/dist/js/dom/query/querySelectorLive.js +9 -3
  57. package/dist/js/dom/query/querySelectorLive.js.map +1 -1
  58. package/dist/js/dom/query/querySelectorUp.d.ts +3 -3
  59. package/dist/js/dom/query/querySelectorUp.js +3 -3
  60. package/dist/js/dom/style/getAnimationProperties.d.ts +2 -2
  61. package/dist/js/dom/style/getCssDeclarations.d.ts +1 -1
  62. package/dist/js/dom/style/getCssDeclarations.js +1 -1
  63. package/dist/js/dom/style/getRotateProperties.d.ts +1 -1
  64. package/dist/js/dom/style/getRotateProperties.js +1 -1
  65. package/dist/js/dom/style/getScaleProperty.d.ts +1 -1
  66. package/dist/js/dom/style/getStyleProperty.d.ts +2 -2
  67. package/dist/js/dom/style/getStyleProperty.js +2 -2
  68. package/dist/js/dom/style/getTransformProperties.d.ts +4 -4
  69. package/dist/js/dom/style/getTransitionProperties.d.ts +2 -2
  70. package/dist/js/dom/style/getTranslateProperties.d.ts +1 -1
  71. package/dist/js/dom/when/whenAnimationEnd.d.ts +2 -2
  72. package/dist/js/dom/when/whenAnimationEnd.js +2 -2
  73. package/dist/js/dom/when/whenAttribute.d.ts +9 -9
  74. package/dist/js/dom/when/whenDomReady.d.ts +2 -2
  75. package/dist/js/dom/when/whenDomReady.js +2 -2
  76. package/dist/js/dom/when/whenEntersViewport.d.ts +2 -2
  77. package/dist/js/dom/when/whenEventListener.d.ts +3 -3
  78. package/dist/js/dom/when/whenEventListener.js +3 -3
  79. package/dist/js/dom/when/whenIframeReady.d.ts +2 -2
  80. package/dist/js/dom/when/whenIframeReady.js +2 -2
  81. package/dist/js/dom/when/whenImageLoaded.d.ts +3 -3
  82. package/dist/js/dom/when/whenImageLoaded.js +3 -3
  83. package/dist/js/dom/when/whenImagesLoaded.d.ts +2 -4
  84. package/dist/js/dom/when/whenImagesLoaded.js +2 -4
  85. package/dist/js/dom/when/whenImagesLoaded.js.map +1 -1
  86. package/dist/js/dom/when/whenInViewport.d.ts +3 -3
  87. package/dist/js/dom/when/whenInteract.d.ts +1 -1
  88. package/dist/js/dom/when/whenInteract.js +1 -1
  89. package/dist/js/dom/when/whenLinkLoaded.js +3 -3
  90. package/dist/js/dom/when/whenNearViewport.d.ts +3 -3
  91. package/dist/js/dom/when/whenOutOfViewport.d.ts +3 -3
  92. package/dist/js/dom/when/whenOutOfViewport.js +3 -3
  93. package/dist/js/dom/when/whenRemoved.d.ts +3 -3
  94. package/dist/js/dom/when/whenRemoved.js +3 -3
  95. package/dist/js/dom/when/whenStylesheetsReady.d.ts +5 -5
  96. package/dist/js/dom/when/whenStylesheetsReady.js +8 -8
  97. package/dist/js/dom/when/whenStylesheetsReady.js.map +1 -1
  98. package/dist/js/dom/when/whenTransitionEnd.d.ts +1 -1
  99. package/dist/js/dom/when/whenTransitionEnd.js +1 -1
  100. package/dist/js/dom/when/whenVisible.d.ts +1 -1
  101. package/dist/js/feature/scrollProperties.d.ts +8 -4
  102. package/dist/js/feature/scrollProperties.js +7 -4
  103. package/dist/js/feature/scrollProperties.js.map +1 -1
  104. package/dist/js/feature/sectionClasses.d.ts +3 -7
  105. package/dist/js/feature/sectionClasses.js +3 -7
  106. package/dist/js/feature/sectionClasses.js.map +1 -1
  107. package/dist/js/is/isDarkMode.js +2 -2
  108. package/dist/js/is/isDarkMode.js.map +1 -1
  109. package/dist/js/is/isInViewport.d.ts +1 -1
  110. package/dist/js/is/isInViewport.js +1 -1
  111. package/dist/js/is/isUserScrolling.js +1 -1
  112. package/dist/js/is/isVisible.d.ts +1 -1
  113. package/dist/js/is/isVisible.js +1 -1
  114. package/dist/js/keyboard/hotkey.d.ts +4 -4
  115. package/dist/js/keyboard/hotkey.js +4 -4
  116. package/dist/js/scroll/scrollTo.d.ts +5 -5
  117. package/dist/js/theme/restoreTheme.d.ts +2 -2
  118. package/dist/js/theme/setTheme.d.ts +0 -2
  119. package/dist/js/theme/setTheme.js.map +1 -1
  120. package/dist/node/fs/ensureDirSync.js +1 -8
  121. package/dist/node/fs/ensureDirSync.js.map +1 -1
  122. package/dist/node/fs/writeFile.js +3 -3
  123. package/dist/node/fs/writeFile.js.map +1 -1
  124. package/dist/shared/array/unique.d.ts +11 -5
  125. package/dist/shared/array/unique.js +15 -25
  126. package/dist/shared/array/unique.js.map +1 -1
  127. package/dist/shared/color/hslaToRgba.js +2 -2
  128. package/dist/shared/console/SugarConsole.js +5 -5
  129. package/dist/shared/console/SugarConsole.js.map +1 -1
  130. package/dist/shared/css/transform/styleObjectToString.d.ts +2 -2
  131. package/dist/shared/css/transform/styleObjectToString.js +2 -2
  132. package/dist/shared/css/transform/styleStringToObject.d.ts +2 -2
  133. package/dist/shared/css/transform/styleStringToObject.js +2 -2
  134. package/dist/shared/currency/_exports.d.ts +4 -0
  135. package/dist/shared/currency/_exports.js +5 -0
  136. package/dist/shared/currency/_exports.js.map +1 -0
  137. package/dist/shared/currency/currencyCodeToSymbol.d.ts +24 -0
  138. package/dist/shared/currency/currencyCodeToSymbol.js +33 -0
  139. package/dist/shared/currency/currencyCodeToSymbol.js.map +1 -0
  140. package/dist/shared/currency/currencyStringToObject.d.ts +40 -0
  141. package/dist/shared/currency/currencyStringToObject.js +27 -0
  142. package/dist/shared/currency/currencyStringToObject.js.map +1 -0
  143. package/dist/shared/currency/currencySymbolToCode.d.ts +24 -0
  144. package/dist/shared/currency/currencySymbolToCode.js +34 -0
  145. package/dist/shared/currency/currencySymbolToCode.js.map +1 -0
  146. package/dist/shared/url/_exports.d.ts +5 -5
  147. package/dist/shared/url/_exports.js +5 -5
  148. package/dist/shared/url/_exports.js.map +1 -1
  149. package/package.json +26 -6
@@ -18,12 +18,12 @@ import matches from './matches.js';
18
18
  *
19
19
  * @example js
20
20
  * import { querySelectorUp } from '@blackbyte/sugar/dom'
21
- * const closestElm =  querySelectorUp(myCoolElement, '.my-cool-class');
21
+ * const closestElm =  querySelectorUp($elm, '.my-cool-class');
22
22
  * if (closestElm) {
23
- * // we have found en element that matches the selector
23
+ * // we have found en element that matches the selector
24
24
  * }
25
25
  * // the selector param can be a function that need to return either true or false like so:
26
- *  querySelectorUp(myCoolElement, (elm) => {
26
+ * querySelectorUp($elm, (elm) => {
27
27
  * return elm.hasAttribute('my-cool-attribute')
28
28
  * })
29
29
  *
@@ -7,7 +7,7 @@
7
7
  *
8
8
  * Get the css animation properties from an HTMLElement in an object format
9
9
  *
10
- * @param {HTMLElement} elm The element to get the properties from
10
+ * @param {HTMLElement} $elm The element to get the properties from
11
11
  * @return {Object} The animation properties
12
12
  *
13
13
  * @todo tests
@@ -16,7 +16,7 @@
16
16
  *
17
17
  * @example js
18
18
  * import { getAnimationProperties } from '@blackbyte/sugar/dom'
19
- * const props = getAnimationProperties(myCoolHTMLElement);
19
+ * const props = getAnimationProperties($myCoolHTMLElement);
20
20
  * // output format
21
21
  * // {
22
22
  * // name : ['animation1'],
@@ -7,7 +7,7 @@
7
7
  *
8
8
  * Get all the CSSRules of the passed type
9
9
  *
10
- * @param {string} [typeName='style'] CSSRule type to search for, valid types: unknown, style, charset, import, media, fontface, page, keyframes, keyframe, namespace, counter, supports, document, fontfeature, viewport, region
10
+ * @param {string} [typeName=style] CSSRule type to search for, valid types: unknown, style, charset, import, media, fontface, page, keyframes, keyframe, namespace, counter, supports, document, fontfeature, viewport, region
11
11
  * @param {array} [rules=[]] Array of CSSRules to search
12
12
  * @param {function} [predecate=Boolean] Predecate function to filter matches
13
13
  * @return {array} Array of matching CSSRules
@@ -7,7 +7,7 @@
7
7
  *
8
8
  * Get all the CSSRules of the passed type
9
9
  *
10
- * @param {string} [typeName='style'] CSSRule type to search for, valid types: unknown, style, charset, import, media, fontface, page, keyframes, keyframe, namespace, counter, supports, document, fontfeature, viewport, region
10
+ * @param {string} [typeName=style] CSSRule type to search for, valid types: unknown, style, charset, import, media, fontface, page, keyframes, keyframe, namespace, counter, supports, document, fontfeature, viewport, region
11
11
  * @param {array} [rules=[]] Array of CSSRules to search
12
12
  * @param {function} [predecate=Boolean] Predecate function to filter matches
13
13
  * @return {array} Array of matching CSSRules
@@ -16,7 +16,7 @@
16
16
  *
17
17
  * @example js
18
18
  * import { getRotateProperties } from '@blackbyte/sugar/dom'
19
- * const props = getRotateProperties(myCoolHTMLElement);
19
+ * const props = getRotateProperties($myCoolHTMLElement);
20
20
  * // output format
21
21
  * // {
22
22
  * // x : 100,
@@ -17,7 +17,7 @@ import * as rematrix from 'rematrix';
17
17
  *
18
18
  * @example js
19
19
  * import { getRotateProperties } from '@blackbyte/sugar/dom'
20
- * const props = getRotateProperties(myCoolHTMLElement);
20
+ * const props = getRotateProperties($myCoolHTMLElement);
21
21
  * // output format
22
22
  * // {
23
23
  * // x : 100,
@@ -16,7 +16,7 @@
16
16
  *
17
17
  * @example js
18
18
  * import { getScaleProperty } from '@blackbyte/sugar/dom'
19
- * const props = getScaleProperty(myCoolHTMLElement);
19
+ * const props = getScaleProperty($myCoolHTMLElement);
20
20
  * // output format
21
21
  * // 2
22
22
  *
@@ -9,7 +9,7 @@
9
9
  * This function try to store the actual style to not trigger more that 1 redraw
10
10
  * each js execution loop.
11
11
  *
12
- * @param {HTMLElement} elm The element to get style from
12
+ * @param {HTMLElement} $elm The element to get style from
13
13
  * @param {String} property The css property to get
14
14
  * @return {Mixed} The style value
15
15
  *
@@ -19,7 +19,7 @@
19
19
  *
20
20
  * @example js
21
21
  * import { getStyleProperty } from '@blackbyte/sugar/dom'
22
- * const opacity = getStyleProperty(myCoolHTMLElement, 'opacity');
22
+ * const opacity = getStyleProperty($myCoolHTMLElement, 'opacity');
23
23
  *
24
24
  * @see https://developer.mozilla.org/en-US/docs/Web/API/Window/getComputedStyle
25
25
  * @since 1.0.0
@@ -11,7 +11,7 @@ import parse from '../../../shared/string/parse.js';
11
11
  * This function try to store the actual style to not trigger more that 1 redraw
12
12
  * each js execution loop.
13
13
  *
14
- * @param {HTMLElement} elm The element to get style from
14
+ * @param {HTMLElement} $elm The element to get style from
15
15
  * @param {String} property The css property to get
16
16
  * @return {Mixed} The style value
17
17
  *
@@ -21,7 +21,7 @@ import parse from '../../../shared/string/parse.js';
21
21
  *
22
22
  * @example js
23
23
  * import { getStyleProperty } from '@blackbyte/sugar/dom'
24
- * const opacity = getStyleProperty(myCoolHTMLElement, 'opacity');
24
+ * const opacity = getStyleProperty($myCoolHTMLElement, 'opacity');
25
25
  *
26
26
  * @see https://developer.mozilla.org/en-US/docs/Web/API/Window/getComputedStyle
27
27
  * @since 1.0.0
@@ -16,12 +16,12 @@
16
16
  *
17
17
  * @example js
18
18
  * import { getTransformProperties } from '@blackbyte/sugar/dom'
19
- * const props = getTransformProperties(myCoolHTMLElement);
19
+ * const props = getTransformProperties($myCoolHTMLElement);
20
20
  * // output format
21
21
  * // {
22
- * // translateX : 100,
23
- * // translateY : 0,
24
- * // translateZ : 0,
22
+ * // translateX : 100,
23
+ * // translateY : 0,
24
+ * // translateZ : 0,
25
25
  * // rotateX: 0,
26
26
  * // rotateY: 0,
27
27
  * // rotateZ: 0
@@ -7,7 +7,7 @@
7
7
  *
8
8
  * Get the css transition properties from an HTMLElement in an object format
9
9
  *
10
- * @param {HTMLElement} elm The element to get the properties from
10
+ * @param {HTMLElement} $elm The element to get the properties from
11
11
  * @return {Object} The transition properties
12
12
  *
13
13
  * @todo tests
@@ -16,7 +16,7 @@
16
16
  *
17
17
  * @example js
18
18
  * import { getTransitionProperties } from '@blackbyte/sugar/dom'
19
- * const props = getTransitionProperties(myCoolHTMLElement);
19
+ * const props = getTransitionProperties($myCoolHTMLElement);
20
20
  * // output format
21
21
  * // {
22
22
  * // property : ['all'],
@@ -16,7 +16,7 @@
16
16
  *
17
17
  * @example js
18
18
  * import { getTranslateProperties } from '@blackbyte/sugar/dom'
19
- * const props = getTranslateProperties(myCoolHTMLElement);
19
+ * const props = getTranslateProperties($myCoolHTMLElement);
20
20
  * // output format
21
21
  * // {
22
22
  * // x : 100,
@@ -13,7 +13,7 @@
13
13
  *
14
14
  * @snippet whenAnimationEnd($1)
15
15
  * whenAnimationEnd($1).then(\$elm => {
16
- * $2
16
+ * $2
17
17
  * });
18
18
  *
19
19
  * @todo tests
@@ -21,7 +21,7 @@
21
21
  * @example js
22
22
  * import { whenAnimationEnd } from '@blackbyte/sugar/dom'
23
23
  * whenAnimationEnd(myCoolElm).then(($elm) => {
24
- * // do something...
24
+ * // do something...
25
25
  * });
26
26
  *
27
27
  * @since 1.0.0
@@ -13,7 +13,7 @@
13
13
  *
14
14
  * @snippet whenAnimationEnd($1)
15
15
  * whenAnimationEnd($1).then(\$elm => {
16
- * $2
16
+ * $2
17
17
  * });
18
18
  *
19
19
  * @todo tests
@@ -21,7 +21,7 @@
21
21
  * @example js
22
22
  * import { whenAnimationEnd } from '@blackbyte/sugar/dom'
23
23
  * whenAnimationEnd(myCoolElm).then(($elm) => {
24
- * // do something...
24
+ * // do something...
25
25
  * });
26
26
  *
27
27
  * @since 1.0.0
@@ -19,7 +19,7 @@
19
19
  *
20
20
  * @snippet whenAttribute($1, $2)
21
21
  * whenAttribute($1, $2).then(value => {
22
- * $3
22
+ * $3
23
23
  * });
24
24
  *
25
25
  * @todo tests
@@ -28,18 +28,18 @@
28
28
  * import { whenAttribute } from '@blackbyte/sugar/dom'
29
29
  *
30
30
  * // using promise
31
- * whenAttribute(myCoolHTMLElement, 'value').then(value => {
32
- * // do something...
31
+ * whenAttribute($myCoolHTMLElement, 'value').then(value => {
32
+ * // do something...
33
33
  * });
34
34
  *
35
35
  * // with a check function
36
- * whenAttribute(myCoolHTMLElement, 'value', {
37
- * check(newVal, oldVal) {
38
- * // make sure the value is a number
39
- * return typeof(newVal) === 'number';
40
- * }
36
+ * whenAttribute($myCoolHTMLElement, 'value', {
37
+ * check(newVal, oldVal) {
38
+ * // make sure the value is a number
39
+ * return typeof(newVal) === 'number';
40
+ * }
41
41
  * }).then(value => {
42
- * // do something...
42
+ * // do something...
43
43
  * });
44
44
  *
45
45
  * @since 1.0.0
@@ -13,7 +13,7 @@
13
13
  *
14
14
  * @snippet whenDomReady()
15
15
  * whenDomReady().then(() => {
16
- * $1
16
+ * $1
17
17
  * });
18
18
  *
19
19
  * @todo tests
@@ -21,7 +21,7 @@
21
21
  * @example js
22
22
  * import { whenDomReady } from '@blackbyte/sugar/dom'
23
23
  * whenDomReady().then(() => {
24
- * // do something...
24
+ * // do something...
25
25
  * });
26
26
  *
27
27
  * @see https://www.jstips.co/en/javascript/detect-document-ready-in-pure-js/
@@ -13,7 +13,7 @@
13
13
  *
14
14
  * @snippet whenDomReady()
15
15
  * whenDomReady().then(() => {
16
- * $1
16
+ * $1
17
17
  * });
18
18
  *
19
19
  * @todo tests
@@ -21,7 +21,7 @@
21
21
  * @example js
22
22
  * import { whenDomReady } from '@blackbyte/sugar/dom'
23
23
  * whenDomReady().then(() => {
24
- * // do something...
24
+ * // do something...
25
25
  * });
26
26
  *
27
27
  * @see https://www.jstips.co/en/javascript/detect-document-ready-in-pure-js/
@@ -19,7 +19,7 @@
19
19
  *
20
20
  * @snippet whenEntersViewport($1)
21
21
  * whenEntersViewport($1).then(\$elm => {
22
- * $2
22
+ * $2
23
23
  * });
24
24
  *
25
25
  * @todo tests
@@ -27,7 +27,7 @@
27
27
  * @example js
28
28
  * import { whenEntersViewport } from '@blackbyte/sugar/dom'
29
29
  * whenEntersViewport($myElement).then(($elm) => {
30
- * // do something with your element that has entered the viewport...
30
+ * // do something with your element that has entered the viewport...
31
31
  * });
32
32
  *
33
33
  * @since 1.0.0
@@ -15,15 +15,15 @@
15
15
  *
16
16
  * @snippet whenEventListener($1, $2)
17
17
  * whenEventListener($1, $2).then(e: Event => {
18
- * $3
18
+ * $3
19
19
  * });
20
20
  *
21
21
  * @todo tests
22
22
  *
23
23
  * @example js
24
24
  * import { whenEventListener } from '@blackbyte/sugar/dom'
25
- * whenEventListener('click', myCoolElm).then((e: Event) => {
26
- * // do something...
25
+ * whenEventListener('click', $elm).then((e: Event) => {
26
+ * // do something...
27
27
  * });
28
28
  *
29
29
  * @since 1.0.0
@@ -15,15 +15,15 @@
15
15
  *
16
16
  * @snippet whenEventListener($1, $2)
17
17
  * whenEventListener($1, $2).then(e: Event => {
18
- * $3
18
+ * $3
19
19
  * });
20
20
  *
21
21
  * @todo tests
22
22
  *
23
23
  * @example js
24
24
  * import { whenEventListener } from '@blackbyte/sugar/dom'
25
- * whenEventListener('click', myCoolElm).then((e: Event) => {
26
- * // do something...
25
+ * whenEventListener('click', $elm).then((e: Event) => {
26
+ * // do something...
27
27
  * });
28
28
  *
29
29
  * @since 1.0.0
@@ -13,7 +13,7 @@
13
13
  *
14
14
  * @snippet whenIframeReady($1)
15
15
  * whenIframeReady($1).then(\$elm => {
16
- * $2
16
+ * $2
17
17
  * });
18
18
  *
19
19
  * @todo tests
@@ -21,7 +21,7 @@
21
21
  * @example js
22
22
  * import { whenIframeReady } from '@blackbyte/sugar/dom'
23
23
  * whenIframeReady($myCoolIframe).then($iframe => {
24
- * // do something...
24
+ * // do something...
25
25
  * });
26
26
  *
27
27
  * @since 1.0.0
@@ -13,7 +13,7 @@
13
13
  *
14
14
  * @snippet whenIframeReady($1)
15
15
  * whenIframeReady($1).then(\$elm => {
16
- * $2
16
+ * $2
17
17
  * });
18
18
  *
19
19
  * @todo tests
@@ -21,7 +21,7 @@
21
21
  * @example js
22
22
  * import { whenIframeReady } from '@blackbyte/sugar/dom'
23
23
  * whenIframeReady($myCoolIframe).then($iframe => {
24
- * // do something...
24
+ * // do something...
25
25
  * });
26
26
  *
27
27
  * @since 1.0.0
@@ -14,15 +14,15 @@
14
14
  *
15
15
  * @snippet whenImageLoaded($1)
16
16
  * whenImageLoaded($1).then(\$img => {
17
- * $2
17
+ * $2
18
18
  * });
19
19
  *
20
20
  * @todo tests
21
21
  *
22
22
  * @example js
23
23
  * import { whenImageLoaded } from '@blackbyte/sugar/dom'
24
- *  whenImageLoaded(myCoolHTMLImageElement).then(($img) => {
25
- * // do something when the image is loaded
24
+ * whenImageLoaded($myCoolHTMLImageElement).then(($img) => {
25
+ * // do something when the image is loaded
26
26
  * });
27
27
  *
28
28
  * @since 1.0.0
@@ -14,15 +14,15 @@
14
14
  *
15
15
  * @snippet whenImageLoaded($1)
16
16
  * whenImageLoaded($1).then(\$img => {
17
- * $2
17
+ * $2
18
18
  * });
19
19
  *
20
20
  * @todo tests
21
21
  *
22
22
  * @example js
23
23
  * import { whenImageLoaded } from '@blackbyte/sugar/dom'
24
- *  whenImageLoaded(myCoolHTMLImageElement).then(($img) => {
25
- * // do something when the image is loaded
24
+ * whenImageLoaded($myCoolHTMLImageElement).then(($img) => {
25
+ * // do something when the image is loaded
26
26
  * });
27
27
  *
28
28
  * @since 1.0.0
@@ -16,7 +16,7 @@
16
16
  *
17
17
  * @snippet whenImagesLoaded($1)
18
18
  * whenImagesLoaded($1).then(imgs => {
19
- * $2
19
+ * $2
20
20
  * });
21
21
  *
22
22
  * @todo tests
@@ -25,9 +25,7 @@
25
25
  * import { whenImagesLoaded } from '@blackbyte/sugar/dom'
26
26
  * whenImagesLoaded([
27
27
  * $img1, $img2, $img3
28
- * ]).on('loaded', $img => {
29
- * // do something with the loaded image
30
- * }).then(imgs => {
28
+ * ]).then(imgs => {
31
29
  * // do something here
32
30
  * })
33
31
  *
@@ -17,7 +17,7 @@ import whenImageLoaded from './whenImageLoaded.js';
17
17
  *
18
18
  * @snippet whenImagesLoaded($1)
19
19
  * whenImagesLoaded($1).then(imgs => {
20
- * $2
20
+ * $2
21
21
  * });
22
22
  *
23
23
  * @todo tests
@@ -26,9 +26,7 @@ import whenImageLoaded from './whenImageLoaded.js';
26
26
  * import { whenImagesLoaded } from '@blackbyte/sugar/dom'
27
27
  * whenImagesLoaded([
28
28
  * $img1, $img2, $img3
29
- * ]).on('loaded', $img => {
30
- * // do something with the loaded image
31
- * }).then(imgs => {
29
+ * ]).then(imgs => {
32
30
  * // do something here
33
31
  * })
34
32
  *
@@ -1 +1 @@
1
- {"version":3,"file":"whenImagesLoaded.js","sourceRoot":"","sources":["../../../../src/js/dom/when/whenImagesLoaded.ts"],"names":[],"mappings":"AAAA,OAAO,eAAe,MAAM,sBAAsB,CAAC;AAEnD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAmCG;AACH,MAAM,CAAC,OAAO,UAAU,gBAAgB,CACtC,KAAyB;IAEzB,OAAO,IAAI,OAAO,CAAC,CAAC,OAAO,EAAE,MAAM,EAAE,EAAE;QACrC,MAAM,QAAQ,GAAgC,EAAE,EAC9C,YAAY,GAAuB,EAAE,CAAC;QAExC,KAAK,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,OAAO,CAAC,CAAC,IAAI,EAAE,EAAE;YACjC,MAAM,GAAG,GAAG,eAAe,CAAC,IAAI,CAAC,CAAC;YAClC,GAAG;iBACA,IAAI,CAAC,CAAC,KAAK,EAAE,EAAE;gBACd,YAAY,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;gBACzB,IAAI,YAAY,CAAC,MAAM,KAAK,KAAK,CAAC,MAAM,EAAE,CAAC;oBACzC,OAAO,CAAC,YAAY,CAAC,CAAC;gBACxB,CAAC;YACH,CAAC,CAAC;iBACD,KAAK,CAAC,CAAC,KAAK,EAAE,EAAE;gBACf,MAAM,CAAC,KAAK,CAAC,CAAC;YAChB,CAAC,CAAC;gBACF,QAAQ,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;QACvB,CAAC,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;AACL,CAAC"}
1
+ {"version":3,"file":"whenImagesLoaded.js","sourceRoot":"","sources":["../../../../src/js/dom/when/whenImagesLoaded.ts"],"names":[],"mappings":"AAAA,OAAO,eAAe,MAAM,sBAAsB,CAAC;AAEnD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAiCG;AACH,MAAM,CAAC,OAAO,UAAU,gBAAgB,CACtC,KAAyB;IAEzB,OAAO,IAAI,OAAO,CAAC,CAAC,OAAO,EAAE,MAAM,EAAE,EAAE;QACrC,MAAM,QAAQ,GAAgC,EAAE,EAC9C,YAAY,GAAuB,EAAE,CAAC;QAExC,KAAK,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,OAAO,CAAC,CAAC,IAAI,EAAE,EAAE;YACjC,MAAM,GAAG,GAAG,eAAe,CAAC,IAAI,CAAC,CAAC;YAClC,GAAG;iBACA,IAAI,CAAC,CAAC,KAAK,EAAE,EAAE;gBACd,YAAY,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;gBACzB,IAAI,YAAY,CAAC,MAAM,KAAK,KAAK,CAAC,MAAM,EAAE,CAAC;oBACzC,OAAO,CAAC,YAAY,CAAC,CAAC;gBACxB,CAAC;YACH,CAAC,CAAC;iBACD,KAAK,CAAC,CAAC,KAAK,EAAE,EAAE;gBACf,MAAM,CAAC,KAAK,CAAC,CAAC;YAChB,CAAC,CAAC;gBACF,QAAQ,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;QACvB,CAAC,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;AACL,CAAC"}
@@ -19,15 +19,15 @@
19
19
  *
20
20
  * @snippet whenInViewport($1)
21
21
  * whenInViewport($1).then(\$elm => {
22
- * $2
22
+ * $2
23
23
  * });
24
24
  *
25
25
  * @todo tests
26
26
  *
27
27
  * @example js
28
28
  * import { whenInViewport } from '@blackbyte/sugar/dom'
29
- * const promise = whenInViewport(myCoolHTMLElement).then((elm) => {
30
- * // do something with your element that has entered the viewport...
29
+ * const promise = whenInViewport($myCoolHTMLElement).then((elm) => {
30
+ * // do something with your element that has entered the viewport...
31
31
  * });
32
32
  * // when you want to stop listening
33
33
  * promise.cancel();
@@ -28,7 +28,7 @@
28
28
  *
29
29
  * @example js
30
30
  * import { whenInteract } from '@blackbyte/sugar/dom'
31
- * whenInteract(myCoolElement).then($elm => {
31
+ * whenInteract($elm).then($elm => {
32
32
  * // do something...
33
33
  * });
34
34
  *
@@ -28,7 +28,7 @@
28
28
  *
29
29
  * @example js
30
30
  * import { whenInteract } from '@blackbyte/sugar/dom'
31
- * whenInteract(myCoolElement).then($elm => {
31
+ * whenInteract($elm).then($elm => {
32
32
  * // do something...
33
33
  * });
34
34
  *
@@ -16,13 +16,13 @@
16
16
  *
17
17
  * @snippet whenLinkLoaded($1)
18
18
  * whenLinkLoaded($1).then(\$elm => {
19
- * $2
19
+ * $2
20
20
  * });
21
21
  *
22
22
  * @example js
23
23
  * import { whenLinkLoaded } from '@blackbyte/sugar/dom'
24
- * whenLinkLoaded(myCoolHTMLLinlElement).then($link => {
25
- * // do something when the link is loaded
24
+ * whenLinkLoaded($myCoolHTMLLinlElement).then($link => {
25
+ * // do something when the link is loaded
26
26
  * });
27
27
  *
28
28
  * @since 1.0.0
@@ -19,15 +19,15 @@
19
19
  *
20
20
  * @snippet whenNearViewport($1)
21
21
  * whenNearViewport($1).then(\$elm => {
22
- * $2
22
+ * $2
23
23
  * });
24
24
  *
25
25
  * @todo tests
26
26
  *
27
27
  * @example js
28
28
  * import { whenNearViewport } from '@blackbyte/sugar/dom'
29
- * whenNearViewport(myCoolHTMLElement).then($elm => {
30
- * // do something with your element that has entered the viewport...
29
+ * whenNearViewport($myCoolHTMLElement).then($elm => {
30
+ * // do something with your element that has entered the viewport...
31
31
  * });
32
32
  *
33
33
  * @since 1.0.0
@@ -19,15 +19,15 @@
19
19
  *
20
20
  * @snippet whenOutOfViewport($1)
21
21
  * whenOutOfViewport($1).then(\$$elm => {
22
- * $2
22
+ * $2
23
23
  * });
24
24
  *
25
25
  * @todo tests
26
26
  *
27
27
  * @example js
28
28
  * import { whenOutOfViewport } from '@blackbyte/sugar/dom'
29
- * whenOutOfViewport(myCoolHTMLElement).then(($elm) => {
30
- * // do something with your element that has exit the viewport...
29
+ * whenOutOfViewport($myCoolHTMLElement).then(($elm) => {
30
+ * // do something with your element that has exit the viewport...
31
31
  * });
32
32
  *
33
33
  * @since 1.0.0
@@ -19,15 +19,15 @@
19
19
  *
20
20
  * @snippet whenOutOfViewport($1)
21
21
  * whenOutOfViewport($1).then(\$$elm => {
22
- * $2
22
+ * $2
23
23
  * });
24
24
  *
25
25
  * @todo tests
26
26
  *
27
27
  * @example js
28
28
  * import { whenOutOfViewport } from '@blackbyte/sugar/dom'
29
- * whenOutOfViewport(myCoolHTMLElement).then(($elm) => {
30
- * // do something with your element that has exit the viewport...
29
+ * whenOutOfViewport($myCoolHTMLElement).then(($elm) => {
30
+ * // do something with your element that has exit the viewport...
31
31
  * });
32
32
  *
33
33
  * @since 1.0.0
@@ -17,15 +17,15 @@
17
17
  *
18
18
  * @snippet whenRemoved($1);
19
19
  * whenRemoved($1).then(() => {
20
- * $2
20
+ * $2
21
21
  * });
22
22
  *
23
23
  * @todo tests
24
24
  *
25
25
  * @example js
26
26
  * import { whenRemoved } from '@blackbyte/sugar/dom'
27
- * whenRemoved(myCoolHTMLElement).then(() => {
28
- * // the element has been removed
27
+ * whenRemoved($myCoolHTMLElement).then(() => {
28
+ * // the element has been removed
29
29
  * });
30
30
  *
31
31
  * @since 1.0.0
@@ -17,15 +17,15 @@
17
17
  *
18
18
  * @snippet whenRemoved($1);
19
19
  * whenRemoved($1).then(() => {
20
- * $2
20
+ * $2
21
21
  * });
22
22
  *
23
23
  * @todo tests
24
24
  *
25
25
  * @example js
26
26
  * import { whenRemoved } from '@blackbyte/sugar/dom'
27
- * whenRemoved(myCoolHTMLElement).then(() => {
28
- * // the element has been removed
27
+ * whenRemoved($myCoolHTMLElement).then(() => {
28
+ * // the element has been removed
29
29
  * });
30
30
  *
31
31
  * @since 1.0.0
@@ -11,8 +11,8 @@
11
11
  * @feature Async promise based
12
12
  * @feature Multiple stylesheets elements listening
13
13
  *
14
- * @param {Array<HTMLLinkElement>} [links=null] The HTMLLinkElement tags to process. If not passed, take the local stylesheets links
15
- * @return {Promise<void>} The promise that will be resolved when all the links are loaded
14
+ * @param {Array<HTMLLinkElement>} [$links=null] The HTMLLinkElement tags to process. If not passed, take the local stylesheets links
15
+ * @return {Promise<void>} The promise that will be resolved when all the links are loaded
16
16
  *
17
17
  * @todo tests
18
18
  *
@@ -24,8 +24,8 @@
24
24
  * @example js
25
25
  * import { whenStylesheetsReady } from '@blackbyte/sugar/dom'
26
26
  * whenStylesheetsReady([
27
- * myHTMLLinkElement1,
28
- * myHTMLLinkElement2
27
+ * $myHTMLLinkElement1,
28
+ * $myHTMLLinkElement2
29
29
  * ]).then(stylesheets => {
30
30
  * // do something...
31
31
  * });
@@ -33,4 +33,4 @@
33
33
  * @since 1.0.0
34
34
  * @author Olivier Bossel <olivier.bossel@gmail.com> (https://blackbyte.space)
35
35
  */
36
- export default function whenStylesheetsReady(links?: HTMLLinkElement[]): Promise<HTMLLinkElement[]>;
36
+ export default function whenStylesheetsReady($links?: HTMLLinkElement[]): Promise<HTMLLinkElement[]>;