@studiometa/js-toolkit 2.6.5 → 2.8.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/Base/features.cjs +27 -0
- package/Base/features.cjs.map +7 -0
- package/Base/features.d.ts +2 -0
- package/Base/features.js +5 -0
- package/Base/features.js.map +7 -0
- package/Base/index.cjs +12 -15
- package/Base/index.cjs.map +2 -2
- package/Base/index.d.ts +11 -15
- package/Base/index.js +10 -6
- package/Base/index.js.map +2 -2
- package/Base/managers/AsyncChildrenManager.cjs +61 -0
- package/Base/managers/AsyncChildrenManager.cjs.map +7 -0
- package/Base/managers/AsyncChildrenManager.d.ts +18 -0
- package/Base/managers/AsyncChildrenManager.js +39 -0
- package/Base/managers/AsyncChildrenManager.js.map +7 -0
- package/Base/managers/ChildrenManager.cjs +32 -29
- package/Base/managers/ChildrenManager.cjs.map +2 -2
- package/Base/managers/ChildrenManager.d.ts +21 -1
- package/Base/managers/ChildrenManager.js +32 -29
- package/Base/managers/ChildrenManager.js.map +2 -2
- package/Base/managers/EventsManager.cjs.map +2 -2
- package/Base/managers/EventsManager.js.map +2 -2
- package/Base/managers/OptionsManager.d.ts +9 -9
- package/Base/managers/RefsManager.cjs +13 -8
- package/Base/managers/RefsManager.cjs.map +2 -2
- package/Base/managers/RefsManager.js +14 -9
- package/Base/managers/RefsManager.js.map +2 -2
- package/Base/managers/ResponsiveOptionsManager.d.ts +1 -1
- package/Base/managers/ServicesManager.d.ts +2 -2
- package/Base/managers/index.cjs +41 -0
- package/Base/managers/index.cjs.map +7 -0
- package/Base/managers/index.d.ts +8 -0
- package/Base/managers/index.js +19 -0
- package/Base/managers/index.js.map +7 -0
- package/Base/types.cjs.map +1 -1
- package/Base/types.d.ts +1 -1
- package/Base/utils.cjs +15 -1
- package/Base/utils.cjs.map +2 -2
- package/Base/utils.d.ts +1 -0
- package/Base/utils.js +15 -1
- package/Base/utils.js.map +2 -2
- package/decorators/index.cjs +1 -1
- package/decorators/index.cjs.map +2 -2
- package/decorators/index.d.ts +1 -1
- package/decorators/index.js +1 -1
- package/decorators/index.js.map +1 -1
- package/decorators/withBreakpointManager.cjs.map +2 -2
- package/decorators/withBreakpointManager.js.map +2 -2
- package/decorators/withBreakpointObserver.cjs.map +2 -2
- package/decorators/withBreakpointObserver.js.map +2 -2
- package/decorators/withDrag.cjs.map +2 -2
- package/decorators/withDrag.d.ts +1 -1
- package/decorators/withDrag.js.map +2 -2
- package/decorators/withMountWhenInView.cjs.map +2 -2
- package/decorators/withMountWhenInView.js.map +2 -2
- package/decorators/withResponsiveOptions.cjs.map +2 -2
- package/decorators/withResponsiveOptions.js.map +2 -2
- package/decorators/withScrolledInView/index.cjs +22 -0
- package/decorators/withScrolledInView/index.cjs.map +7 -0
- package/decorators/withScrolledInView/index.d.ts +2 -0
- package/decorators/withScrolledInView/index.js +3 -0
- package/decorators/withScrolledInView/index.js.map +7 -0
- package/decorators/withScrolledInView/types.cjs +19 -0
- package/decorators/withScrolledInView/types.cjs.map +7 -0
- package/decorators/withScrolledInView/types.d.ts +2 -0
- package/decorators/withScrolledInView/types.js +1 -0
- package/decorators/withScrolledInView/types.js.map +7 -0
- package/decorators/withScrolledInView/utils.cjs +99 -0
- package/decorators/withScrolledInView/utils.cjs.map +7 -0
- package/decorators/withScrolledInView/utils.d.ts +17 -0
- package/decorators/withScrolledInView/utils.js +77 -0
- package/decorators/withScrolledInView/utils.js.map +7 -0
- package/decorators/{withScrolledInView.cjs → withScrolledInView/withScrolledInView.cjs} +25 -10
- package/decorators/withScrolledInView/withScrolledInView.cjs.map +7 -0
- package/decorators/{withScrolledInView.d.ts → withScrolledInView/withScrolledInView.d.ts} +6 -5
- package/decorators/{withScrolledInView.js → withScrolledInView/withScrolledInView.js} +31 -9
- package/decorators/withScrolledInView/withScrolledInView.js.map +7 -0
- package/decorators/withVue2.cjs.map +2 -2
- package/decorators/withVue2.js.map +2 -2
- package/helpers/createApp.cjs +23 -19
- package/helpers/createApp.cjs.map +2 -2
- package/helpers/createApp.d.ts +6 -1
- package/helpers/createApp.js +23 -19
- package/helpers/createApp.js.map +2 -2
- package/helpers/getClosestParent.cjs +3 -11
- package/helpers/getClosestParent.cjs.map +2 -2
- package/helpers/getClosestParent.js +3 -11
- package/helpers/getClosestParent.js.map +2 -2
- package/helpers/getInstanceFromElement.cjs.map +2 -2
- package/helpers/getInstanceFromElement.js.map +2 -2
- package/helpers/importOnInteraction.cjs.map +2 -2
- package/helpers/importOnInteraction.js.map +2 -2
- package/helpers/importWhenIdle.cjs.map +2 -2
- package/helpers/importWhenIdle.d.ts +1 -1
- package/helpers/importWhenIdle.js.map +2 -2
- package/index.cjs.map +1 -1
- package/index.d.ts +1 -1
- package/index.js.map +1 -1
- package/package.json +2 -2
- package/services/drag.cjs +1 -1
- package/services/drag.cjs.map +3 -3
- package/services/drag.d.ts +21 -24
- package/services/drag.js.map +3 -3
- package/services/index.d.ts +7 -7
- package/services/key.cjs +1 -1
- package/services/key.cjs.map +3 -3
- package/services/key.d.ts +8 -9
- package/services/key.js.map +3 -3
- package/services/load.cjs +1 -1
- package/services/load.cjs.map +3 -3
- package/services/load.d.ts +6 -5
- package/services/load.js.map +3 -3
- package/services/pointer.cjs +1 -1
- package/services/pointer.cjs.map +3 -3
- package/services/pointer.d.ts +10 -10
- package/services/pointer.js.map +3 -3
- package/services/raf.cjs +4 -4
- package/services/raf.cjs.map +3 -3
- package/services/raf.d.ts +6 -7
- package/services/raf.js +3 -3
- package/services/raf.js.map +3 -3
- package/services/resize.cjs +1 -1
- package/services/resize.cjs.map +3 -3
- package/services/resize.d.ts +8 -9
- package/services/resize.js.map +3 -3
- package/services/scroll.cjs +1 -1
- package/services/scroll.cjs.map +3 -3
- package/services/scroll.d.ts +16 -17
- package/services/scroll.js.map +3 -3
- package/services/service.cjs +2 -2
- package/services/service.cjs.map +3 -3
- package/services/service.d.ts +12 -14
- package/services/service.js +1 -1
- package/services/service.js.map +3 -3
- package/utils/Queue.cjs +60 -0
- package/utils/Queue.cjs.map +7 -0
- package/utils/Queue.d.ts +44 -0
- package/utils/Queue.js +38 -0
- package/utils/Queue.js.map +7 -0
- package/utils/collide/boundingRectToCircle.cjs +3 -2
- package/utils/collide/boundingRectToCircle.cjs.map +3 -3
- package/utils/collide/boundingRectToCircle.d.ts +8 -13
- package/utils/collide/boundingRectToCircle.js +2 -1
- package/utils/collide/boundingRectToCircle.js.map +3 -3
- package/utils/collide/collideCircleCircle.cjs +1 -1
- package/utils/collide/collideCircleCircle.cjs.map +1 -1
- package/utils/collide/collideCircleCircle.d.ts +1 -15
- package/utils/collide/collideCircleCircle.js.map +1 -1
- package/utils/collide/collideCircleRect.cjs +1 -1
- package/utils/collide/collideCircleRect.cjs.map +1 -1
- package/utils/collide/collideCircleRect.d.ts +1 -33
- package/utils/collide/collideCircleRect.js.map +1 -1
- package/utils/collide/collidePointCircle.cjs +1 -1
- package/utils/collide/collidePointCircle.cjs.map +1 -1
- package/utils/collide/collidePointCircle.d.ts +1 -25
- package/utils/collide/collidePointCircle.js.map +1 -1
- package/utils/collide/collidePointRect.cjs +1 -1
- package/utils/collide/collidePointRect.cjs.map +1 -1
- package/utils/collide/collidePointRect.d.ts +1 -29
- package/utils/collide/collidePointRect.js.map +1 -1
- package/utils/collide/collideRectRect.cjs +1 -1
- package/utils/collide/collideRectRect.cjs.map +1 -1
- package/utils/collide/collideRectRect.d.ts +1 -19
- package/utils/collide/collideRectRect.js.map +1 -1
- package/utils/collide/index.cjs +1 -1
- package/utils/collide/index.cjs.map +1 -1
- package/utils/collide/index.d.ts +9 -6
- package/utils/collide/index.js.map +1 -1
- package/utils/css/animate.cjs +32 -16
- package/utils/css/animate.cjs.map +4 -4
- package/utils/css/animate.d.ts +12 -11
- package/utils/css/animate.js +31 -15
- package/utils/css/animate.js.map +4 -4
- package/utils/css/classes.cjs +1 -1
- package/utils/css/classes.cjs.map +3 -3
- package/utils/css/classes.d.ts +3 -16
- package/utils/css/classes.js.map +3 -3
- package/utils/css/getOffsetSizes.cjs +2 -2
- package/utils/css/getOffsetSizes.cjs.map +3 -3
- package/utils/css/getOffsetSizes.d.ts +0 -2
- package/utils/css/getOffsetSizes.js +1 -1
- package/utils/css/getOffsetSizes.js.map +3 -3
- package/utils/css/matrix.cjs +1 -1
- package/utils/css/matrix.cjs.map +3 -3
- package/utils/css/matrix.d.ts +10 -8
- package/utils/css/matrix.js.map +3 -3
- package/utils/css/styles.cjs +1 -1
- package/utils/css/styles.cjs.map +3 -3
- package/utils/css/styles.d.ts +2 -10
- package/utils/css/styles.js.map +3 -3
- package/utils/css/transform.cjs +1 -1
- package/utils/css/transform.cjs.map +3 -3
- package/utils/css/transform.d.ts +5 -27
- package/utils/css/transform.js.map +3 -3
- package/utils/css/transition.cjs +2 -2
- package/utils/css/transition.cjs.map +3 -3
- package/utils/css/transition.d.ts +11 -15
- package/utils/css/transition.js +1 -1
- package/utils/css/transition.js.map +3 -3
- package/utils/debounce.cjs +1 -1
- package/utils/debounce.cjs.map +3 -3
- package/utils/debounce.d.ts +3 -3
- package/utils/debounce.js.map +3 -3
- package/utils/dom/ancestors.cjs +37 -0
- package/utils/dom/ancestors.cjs.map +7 -0
- package/utils/dom/ancestors.d.ts +8 -0
- package/utils/dom/ancestors.js +15 -0
- package/utils/dom/ancestors.js.map +7 -0
- package/utils/dom/index.cjs +21 -0
- package/utils/dom/index.cjs.map +7 -0
- package/utils/dom/index.d.ts +1 -0
- package/utils/dom/index.js +2 -0
- package/utils/dom/index.js.map +7 -0
- package/utils/focusTrap.cjs +4 -2
- package/utils/focusTrap.cjs.map +3 -3
- package/utils/focusTrap.d.ts +3 -4
- package/utils/focusTrap.js +3 -1
- package/utils/focusTrap.js.map +3 -3
- package/utils/has.cjs +1 -1
- package/utils/has.cjs.map +3 -3
- package/utils/has.d.ts +1 -3
- package/utils/has.js.map +3 -3
- package/utils/history.cjs +1 -1
- package/utils/history.cjs.map +3 -3
- package/utils/history.d.ts +10 -10
- package/utils/history.js.map +3 -3
- package/utils/index.cjs +3 -0
- package/utils/index.cjs.map +2 -2
- package/utils/index.d.ts +2 -0
- package/utils/index.js +3 -0
- package/utils/index.js.map +2 -2
- package/utils/is.cjs +2 -2
- package/utils/is.cjs.map +3 -3
- package/utils/is.d.ts +26 -8
- package/utils/is.js +1 -1
- package/utils/is.js.map +3 -3
- package/utils/keyCodes.cjs +1 -1
- package/utils/keyCodes.cjs.map +2 -2
- package/utils/keyCodes.d.ts +10 -10
- package/utils/keyCodes.js.map +2 -2
- package/utils/math/clamp.cjs +1 -1
- package/utils/math/clamp.cjs.map +3 -3
- package/utils/math/clamp.js.map +3 -3
- package/utils/math/clamp01.cjs +1 -1
- package/utils/math/clamp01.cjs.map +3 -3
- package/utils/math/clamp01.js.map +3 -3
- package/utils/math/createEases.cjs +1 -1
- package/utils/math/createEases.cjs.map +3 -3
- package/utils/math/createEases.d.ts +3 -6
- package/utils/math/createEases.js.map +3 -3
- package/utils/math/damp.cjs +1 -1
- package/utils/math/damp.cjs.map +3 -3
- package/utils/math/damp.js.map +3 -3
- package/utils/math/ease.cjs +1 -1
- package/utils/math/ease.cjs.map +3 -3
- package/utils/math/ease.d.ts +21 -21
- package/utils/math/ease.js.map +3 -3
- package/utils/math/index.cjs +1 -1
- package/utils/math/index.cjs.map +1 -1
- package/utils/math/index.d.ts +10 -10
- package/utils/math/index.js.map +1 -1
- package/utils/math/inertiaFinalValue.cjs +1 -1
- package/utils/math/inertiaFinalValue.cjs.map +3 -3
- package/utils/math/inertiaFinalValue.js.map +3 -3
- package/utils/math/lerp.cjs +1 -1
- package/utils/math/lerp.cjs.map +3 -3
- package/utils/math/lerp.js.map +3 -3
- package/utils/math/map.cjs +1 -1
- package/utils/math/map.cjs.map +3 -3
- package/utils/math/map.js.map +3 -3
- package/utils/math/round.cjs +1 -1
- package/utils/math/round.cjs.map +3 -3
- package/utils/math/round.js.map +3 -3
- package/utils/memoize.cjs +6 -2
- package/utils/memoize.cjs.map +3 -3
- package/utils/memoize.d.ts +18 -28
- package/utils/memoize.js +5 -1
- package/utils/memoize.js.map +3 -3
- package/utils/nextFrame.cjs +1 -1
- package/utils/nextFrame.cjs.map +3 -3
- package/utils/nextFrame.d.ts +3 -6
- package/utils/nextFrame.js.map +3 -3
- package/utils/nextMicrotask.cjs +1 -1
- package/utils/nextMicrotask.cjs.map +3 -3
- package/utils/nextMicrotask.d.ts +1 -5
- package/utils/nextMicrotask.js.map +3 -3
- package/utils/nextTick.cjs +5 -5
- package/utils/nextTick.cjs.map +3 -3
- package/utils/nextTick.d.ts +1 -5
- package/utils/nextTick.js +4 -4
- package/utils/nextTick.js.map +3 -3
- package/utils/noop.cjs +1 -1
- package/utils/noop.cjs.map +3 -3
- package/utils/noop.d.ts +2 -5
- package/utils/noop.js.map +3 -3
- package/utils/object/autoBind.cjs +1 -1
- package/utils/object/autoBind.cjs.map +3 -3
- package/utils/object/autoBind.d.ts +5 -4
- package/utils/object/autoBind.js.map +3 -3
- package/utils/object/getAllProperties.cjs +3 -3
- package/utils/object/getAllProperties.cjs.map +3 -3
- package/utils/object/getAllProperties.d.ts +1 -1
- package/utils/object/getAllProperties.js +2 -2
- package/utils/object/getAllProperties.js.map +3 -3
- package/utils/object/index.cjs +1 -1
- package/utils/object/index.cjs.map +1 -1
- package/utils/object/index.d.ts +2 -2
- package/utils/object/index.js.map +1 -1
- package/utils/scheduler.cjs +2 -2
- package/utils/scheduler.cjs.map +3 -3
- package/utils/scheduler.d.ts +4 -13
- package/utils/scheduler.js +1 -1
- package/utils/scheduler.js.map +3 -3
- package/utils/scrollTo.cjs +1 -1
- package/utils/scrollTo.cjs.map +3 -3
- package/utils/scrollTo.d.ts +0 -3
- package/utils/scrollTo.js.map +3 -3
- package/utils/string/index.cjs +1 -1
- package/utils/string/index.cjs.map +1 -1
- package/utils/string/index.d.ts +10 -10
- package/utils/string/index.js.map +1 -1
- package/utils/string/withLeadingCharacters.cjs +1 -1
- package/utils/string/withLeadingCharacters.cjs.map +3 -3
- package/utils/string/withLeadingCharacters.js.map +3 -3
- package/utils/string/withLeadingSlash.cjs +1 -1
- package/utils/string/withLeadingSlash.cjs.map +3 -3
- package/utils/string/withLeadingSlash.js.map +3 -3
- package/utils/string/withTrailingCharacters.cjs +1 -1
- package/utils/string/withTrailingCharacters.cjs.map +3 -3
- package/utils/string/withTrailingCharacters.js.map +3 -3
- package/utils/string/withTrailingSlash.cjs +1 -1
- package/utils/string/withTrailingSlash.cjs.map +3 -3
- package/utils/string/withTrailingSlash.js.map +3 -3
- package/utils/string/withoutLeadingCharacters.cjs +1 -1
- package/utils/string/withoutLeadingCharacters.cjs.map +3 -3
- package/utils/string/withoutLeadingCharacters.js.map +3 -3
- package/utils/string/withoutLeadingCharactersRecursive.cjs +1 -1
- package/utils/string/withoutLeadingCharactersRecursive.cjs.map +3 -3
- package/utils/string/withoutLeadingCharactersRecursive.js.map +3 -3
- package/utils/string/withoutLeadingSlash.cjs +1 -1
- package/utils/string/withoutLeadingSlash.cjs.map +3 -3
- package/utils/string/withoutLeadingSlash.js.map +3 -3
- package/utils/string/withoutTrailingCharacters.cjs +1 -1
- package/utils/string/withoutTrailingCharacters.cjs.map +3 -3
- package/utils/string/withoutTrailingCharacters.js.map +3 -3
- package/utils/string/withoutTrailingCharactersRecursive.cjs +1 -1
- package/utils/string/withoutTrailingCharactersRecursive.cjs.map +3 -3
- package/utils/string/withoutTrailingCharactersRecursive.js.map +3 -3
- package/utils/string/withoutTrailingSlash.cjs +1 -1
- package/utils/string/withoutTrailingSlash.cjs.map +3 -3
- package/utils/string/withoutTrailingSlash.js.map +3 -3
- package/utils/throttle.cjs +2 -2
- package/utils/throttle.cjs.map +3 -3
- package/utils/throttle.d.ts +1 -1
- package/utils/throttle.js +1 -1
- package/utils/throttle.js.map +3 -3
- package/utils/tween.cjs +4 -3
- package/utils/tween.cjs.map +3 -3
- package/utils/tween.d.ts +17 -24
- package/utils/tween.js +3 -2
- package/utils/tween.js.map +3 -3
- package/decorators/withScrolledInView.cjs.map +0 -7
- package/decorators/withScrolledInView.js.map +0 -7
package/utils/math/lerp.cjs.map
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
|
-
"sources": ["../../../packages/js-toolkit/utils/math/lerp.
|
|
4
|
-
"sourcesContent": ["/**\n * Interpolate the ratio between a given interval.\n *\n * @param {number} min The interval minimum value.\n * @param {number} max The inverval maximum value.\n * @param {number} ratio The ratio to get.\n * @returns {number} The value between min and max corresponding to ratio.\n */\nexport default function lerp(min, max, ratio) {\n return (1 - ratio) * min + ratio * max;\n}\n"],
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAQe,SAAR,KAAsB,
|
|
3
|
+
"sources": ["../../../packages/js-toolkit/utils/math/lerp.ts"],
|
|
4
|
+
"sourcesContent": ["/**\n * Interpolate the ratio between a given interval.\n *\n * @param {number} min The interval minimum value.\n * @param {number} max The inverval maximum value.\n * @param {number} ratio The ratio to get.\n * @returns {number} The value between min and max corresponding to ratio.\n */\nexport default function lerp(min: number, max: number, ratio: number) {\n return (1 - ratio) * min + ratio * max;\n}\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAQe,SAAR,KAAsB,KAAa,KAAa,OAAe;AACpE,UAAQ,IAAI,SAAS,MAAM,QAAQ;AACrC;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
package/utils/math/lerp.js.map
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
|
-
"sources": ["../../../packages/js-toolkit/utils/math/lerp.
|
|
4
|
-
"sourcesContent": ["/**\n * Interpolate the ratio between a given interval.\n *\n * @param {number} min The interval minimum value.\n * @param {number} max The inverval maximum value.\n * @param {number} ratio The ratio to get.\n * @returns {number} The value between min and max corresponding to ratio.\n */\nexport default function lerp(min, max, ratio) {\n return (1 - ratio) * min + ratio * max;\n}\n"],
|
|
5
|
-
"mappings": "AAQe,SAAR,KAAsB,
|
|
3
|
+
"sources": ["../../../packages/js-toolkit/utils/math/lerp.ts"],
|
|
4
|
+
"sourcesContent": ["/**\n * Interpolate the ratio between a given interval.\n *\n * @param {number} min The interval minimum value.\n * @param {number} max The inverval maximum value.\n * @param {number} ratio The ratio to get.\n * @returns {number} The value between min and max corresponding to ratio.\n */\nexport default function lerp(min: number, max: number, ratio: number) {\n return (1 - ratio) * min + ratio * max;\n}\n"],
|
|
5
|
+
"mappings": "AAQe,SAAR,KAAsB,KAAa,KAAa,OAAe;AACpE,UAAQ,IAAI,SAAS,MAAM,QAAQ;AACrC;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
package/utils/math/map.cjs
CHANGED
|
@@ -16,7 +16,7 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
16
16
|
};
|
|
17
17
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
18
18
|
|
|
19
|
-
// packages/js-toolkit/utils/math/map.
|
|
19
|
+
// packages/js-toolkit/utils/math/map.ts
|
|
20
20
|
var map_exports = {};
|
|
21
21
|
__export(map_exports, {
|
|
22
22
|
default: () => map
|
package/utils/math/map.cjs.map
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
|
-
"sources": ["../../../packages/js-toolkit/utils/math/map.
|
|
4
|
-
"sourcesContent": ["/**\n * Maps the value from one range of [inputMin..inputMax] to another range of [outputMin..outputMax].\n *\n * @param {number} value The value to map.\n * @param {number} inputMin The input's minimum value.\n * @param {number} inputMax The input's maximum value.\n * @param {number} outputMin The output's minimum value.\n * @param {number} outputMax The output's maximum value.\n * @returns {number} The input value mapped to the output range.\n */\nexport default function map(value
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAUe,SAAR,
|
|
3
|
+
"sources": ["../../../packages/js-toolkit/utils/math/map.ts"],
|
|
4
|
+
"sourcesContent": ["/**\n * Maps the value from one range of [inputMin..inputMax] to another range of [outputMin..outputMax].\n *\n * @param {number} value The value to map.\n * @param {number} inputMin The input's minimum value.\n * @param {number} inputMax The input's maximum value.\n * @param {number} outputMin The output's minimum value.\n * @param {number} outputMax The output's maximum value.\n * @returns {number} The input value mapped to the output range.\n */\nexport default function map(\n value: number,\n inputMin: number,\n inputMax: number,\n outputMin: number,\n outputMax: number,\n) {\n return ((value - inputMin) * (outputMax - outputMin)) / (inputMax - inputMin) + outputMin;\n}\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAUe,SAAR,IACL,OACA,UACA,UACA,WACA,WACA;AACA,UAAS,QAAQ,aAAa,YAAY,cAAe,WAAW,YAAY;AAClF;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
package/utils/math/map.js.map
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
|
-
"sources": ["../../../packages/js-toolkit/utils/math/map.
|
|
4
|
-
"sourcesContent": ["/**\n * Maps the value from one range of [inputMin..inputMax] to another range of [outputMin..outputMax].\n *\n * @param {number} value The value to map.\n * @param {number} inputMin The input's minimum value.\n * @param {number} inputMax The input's maximum value.\n * @param {number} outputMin The output's minimum value.\n * @param {number} outputMax The output's maximum value.\n * @returns {number} The input value mapped to the output range.\n */\nexport default function map(value
|
|
5
|
-
"mappings": "AAUe,SAAR,
|
|
3
|
+
"sources": ["../../../packages/js-toolkit/utils/math/map.ts"],
|
|
4
|
+
"sourcesContent": ["/**\n * Maps the value from one range of [inputMin..inputMax] to another range of [outputMin..outputMax].\n *\n * @param {number} value The value to map.\n * @param {number} inputMin The input's minimum value.\n * @param {number} inputMax The input's maximum value.\n * @param {number} outputMin The output's minimum value.\n * @param {number} outputMax The output's maximum value.\n * @returns {number} The input value mapped to the output range.\n */\nexport default function map(\n value: number,\n inputMin: number,\n inputMax: number,\n outputMin: number,\n outputMax: number,\n) {\n return ((value - inputMin) * (outputMax - outputMin)) / (inputMax - inputMin) + outputMin;\n}\n"],
|
|
5
|
+
"mappings": "AAUe,SAAR,IACL,OACA,UACA,UACA,WACA,WACA;AACA,UAAS,QAAQ,aAAa,YAAY,cAAe,WAAW,YAAY;AAClF;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
package/utils/math/round.cjs
CHANGED
|
@@ -16,7 +16,7 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
16
16
|
};
|
|
17
17
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
18
18
|
|
|
19
|
-
// packages/js-toolkit/utils/math/round.
|
|
19
|
+
// packages/js-toolkit/utils/math/round.ts
|
|
20
20
|
var round_exports = {};
|
|
21
21
|
__export(round_exports, {
|
|
22
22
|
default: () => round
|
package/utils/math/round.cjs.map
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
|
-
"sources": ["../../../packages/js-toolkit/utils/math/round.
|
|
4
|
-
"sourcesContent": ["/**\n * Round a value with a given number of decimals.\n *\n * @param {number} value The number to round.\n * @param {number} [decimals=0] The number of decimals to keep.\n * @returns {number} A rounded number to the given decimals length.\n */\nexport default function round(value, decimals = 0) {\n return Number(value.toFixed(decimals));\n}\n"],
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAOe,SAAR,MAAuB,
|
|
3
|
+
"sources": ["../../../packages/js-toolkit/utils/math/round.ts"],
|
|
4
|
+
"sourcesContent": ["/**\n * Round a value with a given number of decimals.\n *\n * @param {number} value The number to round.\n * @param {number} [decimals=0] The number of decimals to keep.\n * @returns {number} A rounded number to the given decimals length.\n */\nexport default function round(value: number, decimals = 0) {\n return Number(value.toFixed(decimals));\n}\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAOe,SAAR,MAAuB,OAAe,WAAW,GAAG;AACzD,SAAO,OAAO,MAAM,QAAQ,QAAQ,CAAC;AACvC;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
package/utils/math/round.js.map
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
|
-
"sources": ["../../../packages/js-toolkit/utils/math/round.
|
|
4
|
-
"sourcesContent": ["/**\n * Round a value with a given number of decimals.\n *\n * @param {number} value The number to round.\n * @param {number} [decimals=0] The number of decimals to keep.\n * @returns {number} A rounded number to the given decimals length.\n */\nexport default function round(value, decimals = 0) {\n return Number(value.toFixed(decimals));\n}\n"],
|
|
5
|
-
"mappings": "AAOe,SAAR,MAAuB,
|
|
3
|
+
"sources": ["../../../packages/js-toolkit/utils/math/round.ts"],
|
|
4
|
+
"sourcesContent": ["/**\n * Round a value with a given number of decimals.\n *\n * @param {number} value The number to round.\n * @param {number} [decimals=0] The number of decimals to keep.\n * @returns {number} A rounded number to the given decimals length.\n */\nexport default function round(value: number, decimals = 0) {\n return Number(value.toFixed(decimals));\n}\n"],
|
|
5
|
+
"mappings": "AAOe,SAAR,MAAuB,OAAe,WAAW,GAAG;AACzD,SAAO,OAAO,MAAM,QAAQ,QAAQ,CAAC;AACvC;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
package/utils/memoize.cjs
CHANGED
|
@@ -16,13 +16,17 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
16
16
|
};
|
|
17
17
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
18
18
|
|
|
19
|
-
// packages/js-toolkit/utils/memoize.
|
|
19
|
+
// packages/js-toolkit/utils/memoize.ts
|
|
20
20
|
var memoize_exports = {};
|
|
21
21
|
__export(memoize_exports, {
|
|
22
22
|
default: () => memoize
|
|
23
23
|
});
|
|
24
24
|
module.exports = __toCommonJS(memoize_exports);
|
|
25
|
-
function memoize(fn, {
|
|
25
|
+
function memoize(fn, {
|
|
26
|
+
maxAge = Number.POSITIVE_INFINITY,
|
|
27
|
+
cacheKey = JSON.stringify,
|
|
28
|
+
cache = /* @__PURE__ */ new Map()
|
|
29
|
+
} = {}) {
|
|
26
30
|
return function memoized(...args) {
|
|
27
31
|
const key = cacheKey(args);
|
|
28
32
|
const date = Date.now();
|
package/utils/memoize.cjs.map
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
|
-
"sources": ["../../packages/js-toolkit/utils/memoize.
|
|
4
|
-
"sourcesContent": ["
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;
|
|
3
|
+
"sources": ["../../packages/js-toolkit/utils/memoize.ts"],
|
|
4
|
+
"sourcesContent": ["export interface MemoizeCache<T> {\n has: (key: unknown) => boolean;\n set: (key: unknown, value: { data: T; date: number }) => this;\n get: (key: unknown) => { data: T; date: number };\n}\n\nexport interface MemoizeOptions<T> {\n maxAge?: number;\n cacheKey?: (args: unknown[]) => string;\n cache?: MemoizeCache<T>;\n}\n\n/**\n * Memoize the output of a function.\n */\nexport default function memoize<T extends (...args: unknown[]) => unknown>(\n fn: T,\n {\n maxAge = Number.POSITIVE_INFINITY,\n cacheKey = JSON.stringify,\n cache = new Map(),\n }: MemoizeOptions<ReturnType<T>> = {},\n): (...args: Parameters<T>) => ReturnType<T> {\n return function memoized(...args): ReturnType<T> {\n const key = cacheKey(args);\n const date = Date.now();\n\n if (cache.has(key)) {\n const cached = cache.get(key);\n\n if (date - cached.date < maxAge) {\n return cached.data;\n }\n }\n\n // @ts-ignore\n const data: ReturnType<T> = fn(...args);\n\n cache.set(key, {\n data,\n date: Date.now(),\n });\n\n return data;\n };\n}\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAee,SAAR,QACL,IACA;AAAA,EACE,SAAS,OAAO;AAAA,EAChB,WAAW,KAAK;AAAA,EAChB,QAAQ,oBAAI,IAAI;AAClB,IAAmC,CAAC,GACO;AAC3C,SAAO,SAAS,YAAY,MAAqB;AAC/C,UAAM,MAAM,SAAS,IAAI;AACzB,UAAM,OAAO,KAAK,IAAI;AAEtB,QAAI,MAAM,IAAI,GAAG,GAAG;AAClB,YAAM,SAAS,MAAM,IAAI,GAAG;AAE5B,UAAI,OAAO,OAAO,OAAO,QAAQ;AAC/B,eAAO,OAAO;AAAA,MAChB;AAAA,IACF;AAGA,UAAM,OAAsB,GAAG,GAAG,IAAI;AAEtC,UAAM,IAAI,KAAK;AAAA,MACb;AAAA,MACA,MAAM,KAAK,IAAI;AAAA,IACjB,CAAC;AAED,WAAO;AAAA,EACT;AACF;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
package/utils/memoize.d.ts
CHANGED
|
@@ -1,30 +1,20 @@
|
|
|
1
|
+
export interface MemoizeCache<T> {
|
|
2
|
+
has: (key: unknown) => boolean;
|
|
3
|
+
set: (key: unknown, value: {
|
|
4
|
+
data: T;
|
|
5
|
+
date: number;
|
|
6
|
+
}) => this;
|
|
7
|
+
get: (key: unknown) => {
|
|
8
|
+
data: T;
|
|
9
|
+
date: number;
|
|
10
|
+
};
|
|
11
|
+
}
|
|
12
|
+
export interface MemoizeOptions<T> {
|
|
13
|
+
maxAge?: number;
|
|
14
|
+
cacheKey?: (args: unknown[]) => string;
|
|
15
|
+
cache?: MemoizeCache<T>;
|
|
16
|
+
}
|
|
1
17
|
/**
|
|
2
|
-
*
|
|
3
|
-
* @property {(key:any) => boolean} has
|
|
4
|
-
* @property {(key:any, value:any) => MemorizeCache} set
|
|
5
|
-
* @property {(key:any) => any} get
|
|
6
|
-
*/
|
|
7
|
-
/**
|
|
8
|
-
* @typedef {Object} MemorizeOptions
|
|
9
|
-
* @property {number} [maxAge]
|
|
10
|
-
* @property {(...args:any) => any} [cacheKey]
|
|
11
|
-
* @property {MemorizeCache} [cache]
|
|
12
|
-
*/
|
|
13
|
-
/**
|
|
14
|
-
* Memorize the output of a function.
|
|
15
|
-
* @template {(...args:any) => any} T
|
|
16
|
-
* @param {T} fn
|
|
17
|
-
* @param {MemorizeOptions} options
|
|
18
|
-
* @returns {(...args:Parameters<T>) => ReturnType<T>}
|
|
18
|
+
* Memoize the output of a function.
|
|
19
19
|
*/
|
|
20
|
-
export default function memoize<T extends (...args:
|
|
21
|
-
export type MemorizeCache = {
|
|
22
|
-
has: (key: any) => boolean;
|
|
23
|
-
set: (key: any, value: any) => MemorizeCache;
|
|
24
|
-
get: (key: any) => any;
|
|
25
|
-
};
|
|
26
|
-
export type MemorizeOptions = {
|
|
27
|
-
maxAge?: number;
|
|
28
|
-
cacheKey?: (...args: any) => any;
|
|
29
|
-
cache?: MemorizeCache;
|
|
30
|
-
};
|
|
20
|
+
export default function memoize<T extends (...args: unknown[]) => unknown>(fn: T, { maxAge, cacheKey, cache, }?: MemoizeOptions<ReturnType<T>>): (...args: Parameters<T>) => ReturnType<T>;
|
package/utils/memoize.js
CHANGED
|
@@ -1,4 +1,8 @@
|
|
|
1
|
-
function memoize(fn, {
|
|
1
|
+
function memoize(fn, {
|
|
2
|
+
maxAge = Number.POSITIVE_INFINITY,
|
|
3
|
+
cacheKey = JSON.stringify,
|
|
4
|
+
cache = /* @__PURE__ */ new Map()
|
|
5
|
+
} = {}) {
|
|
2
6
|
return function memoized(...args) {
|
|
3
7
|
const key = cacheKey(args);
|
|
4
8
|
const date = Date.now();
|
package/utils/memoize.js.map
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
|
-
"sources": ["../../packages/js-toolkit/utils/memoize.
|
|
4
|
-
"sourcesContent": ["
|
|
5
|
-
"mappings": "
|
|
3
|
+
"sources": ["../../packages/js-toolkit/utils/memoize.ts"],
|
|
4
|
+
"sourcesContent": ["export interface MemoizeCache<T> {\n has: (key: unknown) => boolean;\n set: (key: unknown, value: { data: T; date: number }) => this;\n get: (key: unknown) => { data: T; date: number };\n}\n\nexport interface MemoizeOptions<T> {\n maxAge?: number;\n cacheKey?: (args: unknown[]) => string;\n cache?: MemoizeCache<T>;\n}\n\n/**\n * Memoize the output of a function.\n */\nexport default function memoize<T extends (...args: unknown[]) => unknown>(\n fn: T,\n {\n maxAge = Number.POSITIVE_INFINITY,\n cacheKey = JSON.stringify,\n cache = new Map(),\n }: MemoizeOptions<ReturnType<T>> = {},\n): (...args: Parameters<T>) => ReturnType<T> {\n return function memoized(...args): ReturnType<T> {\n const key = cacheKey(args);\n const date = Date.now();\n\n if (cache.has(key)) {\n const cached = cache.get(key);\n\n if (date - cached.date < maxAge) {\n return cached.data;\n }\n }\n\n // @ts-ignore\n const data: ReturnType<T> = fn(...args);\n\n cache.set(key, {\n data,\n date: Date.now(),\n });\n\n return data;\n };\n}\n"],
|
|
5
|
+
"mappings": "AAee,SAAR,QACL,IACA;AAAA,EACE,SAAS,OAAO;AAAA,EAChB,WAAW,KAAK;AAAA,EAChB,QAAQ,oBAAI,IAAI;AAClB,IAAmC,CAAC,GACO;AAC3C,SAAO,SAAS,YAAY,MAAqB;AAC/C,UAAM,MAAM,SAAS,IAAI;AACzB,UAAM,OAAO,KAAK,IAAI;AAEtB,QAAI,MAAM,IAAI,GAAG,GAAG;AAClB,YAAM,SAAS,MAAM,IAAI,GAAG;AAE5B,UAAI,OAAO,OAAO,OAAO,QAAQ;AAC/B,eAAO,OAAO;AAAA,MAChB;AAAA,IACF;AAGA,UAAM,OAAsB,GAAG,GAAG,IAAI;AAEtC,UAAM,IAAI,KAAK;AAAA,MACb;AAAA,MACA,MAAM,KAAK,IAAI;AAAA,IACjB,CAAC;AAED,WAAO;AAAA,EACT;AACF;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
package/utils/nextFrame.cjs
CHANGED
|
@@ -16,7 +16,7 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
16
16
|
};
|
|
17
17
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
18
18
|
|
|
19
|
-
// packages/js-toolkit/utils/nextFrame.
|
|
19
|
+
// packages/js-toolkit/utils/nextFrame.ts
|
|
20
20
|
var nextFrame_exports = {};
|
|
21
21
|
__export(nextFrame_exports, {
|
|
22
22
|
getCancelRaf: () => getCancelRaf,
|
package/utils/nextFrame.cjs.map
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
|
-
"sources": ["../../packages/js-toolkit/utils/nextFrame.
|
|
4
|
-
"sourcesContent": ["import { isFunction } from './is.js';\nimport { hasWindow } from './has.js';\n\n/**\n * RequestAnimation frame polyfill.\n * @see https://github.com/vuejs/vue/blob/ec78fc8b6d03e59da669be1adf4b4b5abf670a34/dist/vue.runtime.esm.js#L7355\n
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,gBAA2B;AAC3B,iBAA0B;AAOnB,SAAS,
|
|
3
|
+
"sources": ["../../packages/js-toolkit/utils/nextFrame.ts"],
|
|
4
|
+
"sourcesContent": ["import { isFunction } from './is.js';\nimport { hasWindow } from './has.js';\n\n/**\n * RequestAnimation frame polyfill.\n * @see https://github.com/vuejs/vue/blob/ec78fc8b6d03e59da669be1adf4b4b5abf670a34/dist/vue.runtime.esm.js#L7355\n */\n// eslint-disable-next-line @typescript-eslint/ban-types\nexport function getRaf(): (handler: Function) => number {\n return hasWindow() && window.requestAnimationFrame\n ? window.requestAnimationFrame.bind(window)\n : setTimeout;\n}\n\n/**\n * Get a function to cancel the method returned by `getRaf()`.\n */\nexport function getCancelRaf(): (id: number) => void {\n return hasWindow() && window.cancelAnimationFrame\n ? window.cancelAnimationFrame.bind(window)\n : clearTimeout;\n}\n\n/**\n * Wait for the next frame to execute a function.\n *\n * @template {() => any} T\n * @param {T} [fn] The callback function to execute.\n * @returns {Promise<T extends Function ? ReturnType<T> : undefined>} A Promise resolving when the next frame is reached.\n * @example\n * ```js\n * nextFrame(() => console.log('hello world'));\n *\n * await nextFrame();\n * console.log('hello world');\n * ```\n */\nexport function nextFrame<T extends () => unknown>(\n fn?: T,\n): Promise<T extends () => unknown ? ReturnType<T> : void> {\n return new Promise((resolve) => {\n // @ts-ignore\n getRaf()(() => resolve(isFunction(fn) && fn()));\n });\n}\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,gBAA2B;AAC3B,iBAA0B;AAOnB,SAAS,SAAwC;AACtD,aAAO,sBAAU,KAAK,OAAO,wBACzB,OAAO,sBAAsB,KAAK,MAAM,IACxC;AACN;AAKO,SAAS,eAAqC;AACnD,aAAO,sBAAU,KAAK,OAAO,uBACzB,OAAO,qBAAqB,KAAK,MAAM,IACvC;AACN;AAgBO,SAAS,UACd,IACyD;AACzD,SAAO,IAAI,QAAQ,CAAC,YAAY;AAE9B,WAAO,EAAE,MAAM,YAAQ,sBAAW,EAAE,KAAK,GAAG,CAAC,CAAC;AAAA,EAChD,CAAC;AACH;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
package/utils/nextFrame.d.ts
CHANGED
|
@@ -1,15 +1,12 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* RequestAnimation frame polyfill.
|
|
3
3
|
* @see https://github.com/vuejs/vue/blob/ec78fc8b6d03e59da669be1adf4b4b5abf670a34/dist/vue.runtime.esm.js#L7355
|
|
4
|
-
* @returns {(handler: Function) => number}
|
|
5
4
|
*/
|
|
6
|
-
export function getRaf(): (handler: Function) => number;
|
|
5
|
+
export declare function getRaf(): (handler: Function) => number;
|
|
7
6
|
/**
|
|
8
7
|
* Get a function to cancel the method returned by `getRaf()`.
|
|
9
|
-
*
|
|
10
|
-
* @returns {(id:number) => void}
|
|
11
8
|
*/
|
|
12
|
-
export function getCancelRaf(): (id: number) => void;
|
|
9
|
+
export declare function getCancelRaf(): (id: number) => void;
|
|
13
10
|
/**
|
|
14
11
|
* Wait for the next frame to execute a function.
|
|
15
12
|
*
|
|
@@ -24,4 +21,4 @@ export function getCancelRaf(): (id: number) => void;
|
|
|
24
21
|
* console.log('hello world');
|
|
25
22
|
* ```
|
|
26
23
|
*/
|
|
27
|
-
export function nextFrame<T extends () =>
|
|
24
|
+
export declare function nextFrame<T extends () => unknown>(fn?: T): Promise<T extends () => unknown ? ReturnType<T> : void>;
|
package/utils/nextFrame.js.map
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
|
-
"sources": ["../../packages/js-toolkit/utils/nextFrame.
|
|
4
|
-
"sourcesContent": ["import { isFunction } from './is.js';\nimport { hasWindow } from './has.js';\n\n/**\n * RequestAnimation frame polyfill.\n * @see https://github.com/vuejs/vue/blob/ec78fc8b6d03e59da669be1adf4b4b5abf670a34/dist/vue.runtime.esm.js#L7355\n
|
|
5
|
-
"mappings": "AAAA,SAAS,kBAAkB;AAC3B,SAAS,iBAAiB;AAOnB,SAAS,
|
|
3
|
+
"sources": ["../../packages/js-toolkit/utils/nextFrame.ts"],
|
|
4
|
+
"sourcesContent": ["import { isFunction } from './is.js';\nimport { hasWindow } from './has.js';\n\n/**\n * RequestAnimation frame polyfill.\n * @see https://github.com/vuejs/vue/blob/ec78fc8b6d03e59da669be1adf4b4b5abf670a34/dist/vue.runtime.esm.js#L7355\n */\n// eslint-disable-next-line @typescript-eslint/ban-types\nexport function getRaf(): (handler: Function) => number {\n return hasWindow() && window.requestAnimationFrame\n ? window.requestAnimationFrame.bind(window)\n : setTimeout;\n}\n\n/**\n * Get a function to cancel the method returned by `getRaf()`.\n */\nexport function getCancelRaf(): (id: number) => void {\n return hasWindow() && window.cancelAnimationFrame\n ? window.cancelAnimationFrame.bind(window)\n : clearTimeout;\n}\n\n/**\n * Wait for the next frame to execute a function.\n *\n * @template {() => any} T\n * @param {T} [fn] The callback function to execute.\n * @returns {Promise<T extends Function ? ReturnType<T> : undefined>} A Promise resolving when the next frame is reached.\n * @example\n * ```js\n * nextFrame(() => console.log('hello world'));\n *\n * await nextFrame();\n * console.log('hello world');\n * ```\n */\nexport function nextFrame<T extends () => unknown>(\n fn?: T,\n): Promise<T extends () => unknown ? ReturnType<T> : void> {\n return new Promise((resolve) => {\n // @ts-ignore\n getRaf()(() => resolve(isFunction(fn) && fn()));\n });\n}\n"],
|
|
5
|
+
"mappings": "AAAA,SAAS,kBAAkB;AAC3B,SAAS,iBAAiB;AAOnB,SAAS,SAAwC;AACtD,SAAO,UAAU,KAAK,OAAO,wBACzB,OAAO,sBAAsB,KAAK,MAAM,IACxC;AACN;AAKO,SAAS,eAAqC;AACnD,SAAO,UAAU,KAAK,OAAO,uBACzB,OAAO,qBAAqB,KAAK,MAAM,IACvC;AACN;AAgBO,SAAS,UACd,IACyD;AACzD,SAAO,IAAI,QAAQ,CAAC,YAAY;AAE9B,WAAO,EAAE,MAAM,QAAQ,WAAW,EAAE,KAAK,GAAG,CAAC,CAAC;AAAA,EAChD,CAAC;AACH;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
package/utils/nextMicrotask.cjs
CHANGED
|
@@ -16,7 +16,7 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
16
16
|
};
|
|
17
17
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
18
18
|
|
|
19
|
-
// packages/js-toolkit/utils/nextMicrotask.
|
|
19
|
+
// packages/js-toolkit/utils/nextMicrotask.ts
|
|
20
20
|
var nextMicrotask_exports = {};
|
|
21
21
|
__export(nextMicrotask_exports, {
|
|
22
22
|
default: () => nextMicrotask
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
|
-
"sources": ["../../packages/js-toolkit/utils/nextMicrotask.
|
|
4
|
-
"sourcesContent": ["import { isFunction } from './is.js';\n\n/**\n * Wait for the next microtask.\n
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,gBAA2B;
|
|
3
|
+
"sources": ["../../packages/js-toolkit/utils/nextMicrotask.ts"],
|
|
4
|
+
"sourcesContent": ["import { isFunction } from './is.js';\n\n/**\n * Wait for the next microtask.\n */\nexport default async function nextMicrotask<T extends () => unknown>(\n fn?: T,\n): Promise<T extends () => unknown ? ReturnType<T> : void> {\n // @ts-ignore\n return Promise.resolve().then(() => isFunction(fn) && fn());\n}\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,gBAA2B;AAK3B,eAAO,cACL,IACyD;AAEzD,SAAO,QAAQ,QAAQ,EAAE,KAAK,UAAM,sBAAW,EAAE,KAAK,GAAG,CAAC;AAC5D;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
package/utils/nextMicrotask.d.ts
CHANGED
|
@@ -1,8 +1,4 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Wait for the next microtask.
|
|
3
|
-
*
|
|
4
|
-
* @template {() => any} T
|
|
5
|
-
* @param {T} [fn]
|
|
6
|
-
* @returns {Promise<T extends Function ? ReturnType<T> : undefined>}
|
|
7
3
|
*/
|
|
8
|
-
export default function nextMicrotask<T extends () =>
|
|
4
|
+
export default function nextMicrotask<T extends () => unknown>(fn?: T): Promise<T extends () => unknown ? ReturnType<T> : void>;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
|
-
"sources": ["../../packages/js-toolkit/utils/nextMicrotask.
|
|
4
|
-
"sourcesContent": ["import { isFunction } from './is.js';\n\n/**\n * Wait for the next microtask.\n
|
|
5
|
-
"mappings": "AAAA,SAAS,kBAAkB;
|
|
3
|
+
"sources": ["../../packages/js-toolkit/utils/nextMicrotask.ts"],
|
|
4
|
+
"sourcesContent": ["import { isFunction } from './is.js';\n\n/**\n * Wait for the next microtask.\n */\nexport default async function nextMicrotask<T extends () => unknown>(\n fn?: T,\n): Promise<T extends () => unknown ? ReturnType<T> : void> {\n // @ts-ignore\n return Promise.resolve().then(() => isFunction(fn) && fn());\n}\n"],
|
|
5
|
+
"mappings": "AAAA,SAAS,kBAAkB;AAK3B,eAAO,cACL,IACyD;AAEzD,SAAO,QAAQ,QAAQ,EAAE,KAAK,MAAM,WAAW,EAAE,KAAK,GAAG,CAAC;AAC5D;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
package/utils/nextTick.cjs
CHANGED
|
@@ -16,7 +16,7 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
16
16
|
};
|
|
17
17
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
18
18
|
|
|
19
|
-
// packages/js-toolkit/utils/nextTick.
|
|
19
|
+
// packages/js-toolkit/utils/nextTick.ts
|
|
20
20
|
var nextTick_exports = {};
|
|
21
21
|
__export(nextTick_exports, {
|
|
22
22
|
default: () => nextTick
|
|
@@ -24,11 +24,11 @@ __export(nextTick_exports, {
|
|
|
24
24
|
module.exports = __toCommonJS(nextTick_exports);
|
|
25
25
|
var import_is = require("./is.cjs");
|
|
26
26
|
async function nextTick(fn) {
|
|
27
|
-
return new Promise(
|
|
28
|
-
|
|
27
|
+
return new Promise((resolve) => {
|
|
28
|
+
setTimeout(() => {
|
|
29
29
|
resolve((0, import_is.isFunction)(fn) && fn());
|
|
30
|
-
}, 0)
|
|
31
|
-
);
|
|
30
|
+
}, 0);
|
|
31
|
+
});
|
|
32
32
|
}
|
|
33
33
|
if (module.exports.default) module.exports = module.exports.default;
|
|
34
34
|
//# sourceMappingURL=nextTick.cjs.map
|
package/utils/nextTick.cjs.map
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
|
-
"sources": ["../../packages/js-toolkit/utils/nextTick.
|
|
4
|
-
"sourcesContent": ["import { isFunction } from './is.js';\n\n/**\n * Wait for the next tick.\n
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,gBAA2B;
|
|
3
|
+
"sources": ["../../packages/js-toolkit/utils/nextTick.ts"],
|
|
4
|
+
"sourcesContent": ["import { isFunction } from './is.js';\n\n/**\n * Wait for the next tick.\n */\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nexport default async function nextTick<T extends () => any>(\n fn?: T,\n): Promise<T extends void ? void : ReturnType<T>> {\n return new Promise((resolve) => {\n setTimeout(() => {\n resolve(isFunction(fn) && (fn() as ReturnType<T>));\n }, 0);\n });\n}\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,gBAA2B;AAM3B,eAAO,SACL,IACgD;AAChD,SAAO,IAAI,QAAQ,CAAC,YAAY;AAC9B,eAAW,MAAM;AACf,kBAAQ,sBAAW,EAAE,KAAM,GAAG,CAAmB;AAAA,IACnD,GAAG,CAAC;AAAA,EACN,CAAC;AACH;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
package/utils/nextTick.d.ts
CHANGED
|
@@ -1,8 +1,4 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Wait for the next tick.
|
|
3
|
-
*
|
|
4
|
-
* @template {() => any} T
|
|
5
|
-
* @param {T} [fn]
|
|
6
|
-
* @returns {Promise<T extends Function ? ReturnType<T> : undefined>}
|
|
7
3
|
*/
|
|
8
|
-
export default function nextTick<T extends () => any>(fn?: T): Promise<T extends
|
|
4
|
+
export default function nextTick<T extends () => any>(fn?: T): Promise<T extends void ? void : ReturnType<T>>;
|
package/utils/nextTick.js
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { isFunction } from "./is.js";
|
|
2
2
|
async function nextTick(fn) {
|
|
3
|
-
return new Promise(
|
|
4
|
-
|
|
3
|
+
return new Promise((resolve) => {
|
|
4
|
+
setTimeout(() => {
|
|
5
5
|
resolve(isFunction(fn) && fn());
|
|
6
|
-
}, 0)
|
|
7
|
-
);
|
|
6
|
+
}, 0);
|
|
7
|
+
});
|
|
8
8
|
}
|
|
9
9
|
export {
|
|
10
10
|
nextTick as default
|
package/utils/nextTick.js.map
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
|
-
"sources": ["../../packages/js-toolkit/utils/nextTick.
|
|
4
|
-
"sourcesContent": ["import { isFunction } from './is.js';\n\n/**\n * Wait for the next tick.\n
|
|
5
|
-
"mappings": "AAAA,SAAS,kBAAkB;
|
|
3
|
+
"sources": ["../../packages/js-toolkit/utils/nextTick.ts"],
|
|
4
|
+
"sourcesContent": ["import { isFunction } from './is.js';\n\n/**\n * Wait for the next tick.\n */\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nexport default async function nextTick<T extends () => any>(\n fn?: T,\n): Promise<T extends void ? void : ReturnType<T>> {\n return new Promise((resolve) => {\n setTimeout(() => {\n resolve(isFunction(fn) && (fn() as ReturnType<T>));\n }, 0);\n });\n}\n"],
|
|
5
|
+
"mappings": "AAAA,SAAS,kBAAkB;AAM3B,eAAO,SACL,IACgD;AAChD,SAAO,IAAI,QAAQ,CAAC,YAAY;AAC9B,eAAW,MAAM;AACf,cAAQ,WAAW,EAAE,KAAM,GAAG,CAAmB;AAAA,IACnD,GAAG,CAAC;AAAA,EACN,CAAC;AACH;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
package/utils/noop.cjs
CHANGED
|
@@ -16,7 +16,7 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
16
16
|
};
|
|
17
17
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
18
18
|
|
|
19
|
-
// packages/js-toolkit/utils/noop.
|
|
19
|
+
// packages/js-toolkit/utils/noop.ts
|
|
20
20
|
var noop_exports = {};
|
|
21
21
|
__export(noop_exports, {
|
|
22
22
|
noop: () => noop,
|
package/utils/noop.cjs.map
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
|
-
"sources": ["../../packages/js-toolkit/utils/noop.
|
|
4
|
-
"sourcesContent": ["/**\n * No operation function.\n * @returns {void}\n */\nexport function noop() {}\n\n/**\n * No operation function which return the given value unaltered.\n
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAIO,SAAS,OAAO;AAAC;
|
|
3
|
+
"sources": ["../../packages/js-toolkit/utils/noop.ts"],
|
|
4
|
+
"sourcesContent": ["/**\n * No operation function.\n * @returns {void}\n */\nexport function noop() {}\n\n/**\n * No operation function which return the given value unaltered.\n */\nexport function noopValue<T>(value: T): T {\n return value;\n}\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAIO,SAAS,OAAO;AAAC;AAKjB,SAAS,UAAa,OAAa;AACxC,SAAO;AACT;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
package/utils/noop.d.ts
CHANGED
|
@@ -2,11 +2,8 @@
|
|
|
2
2
|
* No operation function.
|
|
3
3
|
* @returns {void}
|
|
4
4
|
*/
|
|
5
|
-
export function noop(): void;
|
|
5
|
+
export declare function noop(): void;
|
|
6
6
|
/**
|
|
7
7
|
* No operation function which return the given value unaltered.
|
|
8
|
-
* @template {any} T
|
|
9
|
-
* @param {T} value
|
|
10
|
-
* @returns {T}
|
|
11
8
|
*/
|
|
12
|
-
export function noopValue<T
|
|
9
|
+
export declare function noopValue<T>(value: T): T;
|
package/utils/noop.js.map
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
|
-
"sources": ["../../packages/js-toolkit/utils/noop.
|
|
4
|
-
"sourcesContent": ["/**\n * No operation function.\n * @returns {void}\n */\nexport function noop() {}\n\n/**\n * No operation function which return the given value unaltered.\n
|
|
5
|
-
"mappings": "AAIO,SAAS,OAAO;AAAC;
|
|
3
|
+
"sources": ["../../packages/js-toolkit/utils/noop.ts"],
|
|
4
|
+
"sourcesContent": ["/**\n * No operation function.\n * @returns {void}\n */\nexport function noop() {}\n\n/**\n * No operation function which return the given value unaltered.\n */\nexport function noopValue<T>(value: T): T {\n return value;\n}\n"],
|
|
5
|
+
"mappings": "AAIO,SAAS,OAAO;AAAC;AAKjB,SAAS,UAAa,OAAa;AACxC,SAAO;AACT;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -22,7 +22,7 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
|
|
|
22
22
|
));
|
|
23
23
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
24
24
|
|
|
25
|
-
// packages/js-toolkit/utils/object/autoBind.
|
|
25
|
+
// packages/js-toolkit/utils/object/autoBind.ts
|
|
26
26
|
var autoBind_exports = {};
|
|
27
27
|
__export(autoBind_exports, {
|
|
28
28
|
default: () => autoBind
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
|
-
"sources": ["../../../packages/js-toolkit/utils/object/autoBind.
|
|
4
|
-
"sourcesContent": ["import getAllProperties from './getAllProperties.js';\nimport { isString, isFunction } from '../is.js';\n\n/**\n * Auto-bind methods to an instance.\n *\n * @param {Object} instance The instance.\n * @param {Object} options Define specific methods to include or exlude.\n * @param {Array<string | RegExp>} [options.include] Methods to include.\n * @param {Array<string | RegExp>} [options.exclude] Methods to exclude.\n * @returns {Object} The instance.\n */\nexport default function autoBind(instance, options) {\n const { exclude, include } = options || {};\n const filter = (key) => {\n const match = (pattern) => (isString(pattern) ? key === pattern : pattern.test(key));\n\n if (include) {\n return include.some(match);\n }\n\n if (exclude) {\n return !exclude.some(match);\n }\n\n return true;\n };\n\n getAllProperties(instance)\n .filter(([key]) => key !== 'constructor' && filter(key))\n .forEach(([key, object]) => {\n const descriptor = Object.getOwnPropertyDescriptor(object, key);\n if (descriptor && isFunction(descriptor.value)) {\n instance[key] = instance[key].bind(instance);\n }\n });\n\n return instance;\n}\n"],
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,8BAA6B;AAC7B,gBAAqC;
|
|
3
|
+
"sources": ["../../../packages/js-toolkit/utils/object/autoBind.ts"],
|
|
4
|
+
"sourcesContent": ["import getAllProperties from './getAllProperties.js';\nimport { isString, isFunction } from '../is.js';\n\nexport interface AutoBindOptions {\n include?: Array<string | RegExp>;\n exclude?: Array<string | RegExp>;\n}\n\n/**\n * Auto-bind methods to an instance.\n *\n * @param {Object} instance The instance.\n * @param {Object} options Define specific methods to include or exlude.\n * @param {Array<string | RegExp>} [options.include] Methods to include.\n * @param {Array<string | RegExp>} [options.exclude] Methods to exclude.\n * @returns {Object} The instance.\n */\nexport default function autoBind<T>(instance: T, options: AutoBindOptions): T {\n const { exclude, include } = options || {};\n const filter = (key) => {\n const match = (pattern) => (isString(pattern) ? key === pattern : pattern.test(key));\n\n if (include) {\n return include.some(match);\n }\n\n if (exclude) {\n return !exclude.some(match);\n }\n\n return true;\n };\n\n getAllProperties(instance)\n .filter(([key]) => key !== 'constructor' && filter(key))\n .forEach(([key, object]) => {\n const descriptor = Object.getOwnPropertyDescriptor(object, key);\n if (descriptor && isFunction(descriptor.value)) {\n instance[key] = instance[key].bind(instance);\n }\n });\n\n return instance;\n}\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,8BAA6B;AAC7B,gBAAqC;AAgBtB,SAAR,SAA6B,UAAa,SAA6B;AAC5E,QAAM,EAAE,SAAS,QAAQ,IAAI,WAAW,CAAC;AACzC,QAAM,SAAS,CAAC,QAAQ;AACtB,UAAM,QAAQ,CAAC,gBAAa,oBAAS,OAAO,IAAI,QAAQ,UAAU,QAAQ,KAAK,GAAG;AAElF,QAAI,SAAS;AACX,aAAO,QAAQ,KAAK,KAAK;AAAA,IAC3B;AAEA,QAAI,SAAS;AACX,aAAO,CAAC,QAAQ,KAAK,KAAK;AAAA,IAC5B;AAEA,WAAO;AAAA,EACT;AAEA,8BAAAA,SAAiB,QAAQ,EACtB,OAAO,CAAC,CAAC,GAAG,MAAM,QAAQ,iBAAiB,OAAO,GAAG,CAAC,EACtD,QAAQ,CAAC,CAAC,KAAK,MAAM,MAAM;AAC1B,UAAM,aAAa,OAAO,yBAAyB,QAAQ,GAAG;AAC9D,QAAI,kBAAc,sBAAW,WAAW,KAAK,GAAG;AAC9C,eAAS,OAAO,SAAS,KAAK,KAAK,QAAQ;AAAA,IAC7C;AAAA,EACF,CAAC;AAEH,SAAO;AACT;",
|
|
6
6
|
"names": ["getAllProperties"]
|
|
7
7
|
}
|
|
@@ -1,3 +1,7 @@
|
|
|
1
|
+
export interface AutoBindOptions {
|
|
2
|
+
include?: Array<string | RegExp>;
|
|
3
|
+
exclude?: Array<string | RegExp>;
|
|
4
|
+
}
|
|
1
5
|
/**
|
|
2
6
|
* Auto-bind methods to an instance.
|
|
3
7
|
*
|
|
@@ -7,7 +11,4 @@
|
|
|
7
11
|
* @param {Array<string | RegExp>} [options.exclude] Methods to exclude.
|
|
8
12
|
* @returns {Object} The instance.
|
|
9
13
|
*/
|
|
10
|
-
export default function autoBind(instance:
|
|
11
|
-
include?: Array<string | RegExp>;
|
|
12
|
-
exclude?: Array<string | RegExp>;
|
|
13
|
-
}): any;
|
|
14
|
+
export default function autoBind<T>(instance: T, options: AutoBindOptions): T;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
|
-
"sources": ["../../../packages/js-toolkit/utils/object/autoBind.
|
|
4
|
-
"sourcesContent": ["import getAllProperties from './getAllProperties.js';\nimport { isString, isFunction } from '../is.js';\n\n/**\n * Auto-bind methods to an instance.\n *\n * @param {Object} instance The instance.\n * @param {Object} options Define specific methods to include or exlude.\n * @param {Array<string | RegExp>} [options.include] Methods to include.\n * @param {Array<string | RegExp>} [options.exclude] Methods to exclude.\n * @returns {Object} The instance.\n */\nexport default function autoBind(instance, options) {\n const { exclude, include } = options || {};\n const filter = (key) => {\n const match = (pattern) => (isString(pattern) ? key === pattern : pattern.test(key));\n\n if (include) {\n return include.some(match);\n }\n\n if (exclude) {\n return !exclude.some(match);\n }\n\n return true;\n };\n\n getAllProperties(instance)\n .filter(([key]) => key !== 'constructor' && filter(key))\n .forEach(([key, object]) => {\n const descriptor = Object.getOwnPropertyDescriptor(object, key);\n if (descriptor && isFunction(descriptor.value)) {\n instance[key] = instance[key].bind(instance);\n }\n });\n\n return instance;\n}\n"],
|
|
5
|
-
"mappings": "AAAA,OAAO,sBAAsB;AAC7B,SAAS,UAAU,kBAAkB;
|
|
3
|
+
"sources": ["../../../packages/js-toolkit/utils/object/autoBind.ts"],
|
|
4
|
+
"sourcesContent": ["import getAllProperties from './getAllProperties.js';\nimport { isString, isFunction } from '../is.js';\n\nexport interface AutoBindOptions {\n include?: Array<string | RegExp>;\n exclude?: Array<string | RegExp>;\n}\n\n/**\n * Auto-bind methods to an instance.\n *\n * @param {Object} instance The instance.\n * @param {Object} options Define specific methods to include or exlude.\n * @param {Array<string | RegExp>} [options.include] Methods to include.\n * @param {Array<string | RegExp>} [options.exclude] Methods to exclude.\n * @returns {Object} The instance.\n */\nexport default function autoBind<T>(instance: T, options: AutoBindOptions): T {\n const { exclude, include } = options || {};\n const filter = (key) => {\n const match = (pattern) => (isString(pattern) ? key === pattern : pattern.test(key));\n\n if (include) {\n return include.some(match);\n }\n\n if (exclude) {\n return !exclude.some(match);\n }\n\n return true;\n };\n\n getAllProperties(instance)\n .filter(([key]) => key !== 'constructor' && filter(key))\n .forEach(([key, object]) => {\n const descriptor = Object.getOwnPropertyDescriptor(object, key);\n if (descriptor && isFunction(descriptor.value)) {\n instance[key] = instance[key].bind(instance);\n }\n });\n\n return instance;\n}\n"],
|
|
5
|
+
"mappings": "AAAA,OAAO,sBAAsB;AAC7B,SAAS,UAAU,kBAAkB;AAgBtB,SAAR,SAA6B,UAAa,SAA6B;AAC5E,QAAM,EAAE,SAAS,QAAQ,IAAI,WAAW,CAAC;AACzC,QAAM,SAAS,CAAC,QAAQ;AACtB,UAAM,QAAQ,CAAC,YAAa,SAAS,OAAO,IAAI,QAAQ,UAAU,QAAQ,KAAK,GAAG;AAElF,QAAI,SAAS;AACX,aAAO,QAAQ,KAAK,KAAK;AAAA,IAC3B;AAEA,QAAI,SAAS;AACX,aAAO,CAAC,QAAQ,KAAK,KAAK;AAAA,IAC5B;AAEA,WAAO;AAAA,EACT;AAEA,mBAAiB,QAAQ,EACtB,OAAO,CAAC,CAAC,GAAG,MAAM,QAAQ,iBAAiB,OAAO,GAAG,CAAC,EACtD,QAAQ,CAAC,CAAC,KAAK,MAAM,MAAM;AAC1B,UAAM,aAAa,OAAO,yBAAyB,QAAQ,GAAG;AAC9D,QAAI,cAAc,WAAW,WAAW,KAAK,GAAG;AAC9C,eAAS,OAAO,SAAS,KAAK,KAAK,QAAQ;AAAA,IAC7C;AAAA,EACF,CAAC;AAEH,SAAO;AACT;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -16,7 +16,7 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
16
16
|
};
|
|
17
17
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
18
18
|
|
|
19
|
-
// packages/js-toolkit/utils/object/getAllProperties.
|
|
19
|
+
// packages/js-toolkit/utils/object/getAllProperties.ts
|
|
20
20
|
var getAllProperties_exports = {};
|
|
21
21
|
__export(getAllProperties_exports, {
|
|
22
22
|
default: () => getAllProperties
|
|
@@ -32,8 +32,8 @@ function getAllProperties(object, props = [], testFn = null) {
|
|
|
32
32
|
if ((0, import_is.isFunction)(testFn)) {
|
|
33
33
|
foundProps = foundProps.filter((name) => testFn(name, proto));
|
|
34
34
|
}
|
|
35
|
-
|
|
36
|
-
return getAllProperties(proto,
|
|
35
|
+
const formatedProps = foundProps.map((name) => [name, proto]).reduce((acc, val) => [...acc, val], props);
|
|
36
|
+
return getAllProperties(proto, formatedProps, testFn);
|
|
37
37
|
}
|
|
38
38
|
if (module.exports.default) module.exports = module.exports.default;
|
|
39
39
|
//# sourceMappingURL=getAllProperties.cjs.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
|
-
"sources": ["../../../packages/js-toolkit/utils/object/getAllProperties.
|
|
4
|
-
"sourcesContent": ["import { isFunction } from '../is.js';\n\n/**\n * Gets all non-builtin properties up the prototype chain.\n *\n * @param {Object} object\n * The object to get the propeties from.\n * @param {Array} [props=[]]\n * The already existing properties.\n * @param {(name:string, proto:any) => boolean} testFn\n * @returns {Array<[string, Object]>} An array of properties and the prototype they belong to.\n */\nexport default function getAllProperties(object
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,gBAA2B;AAYZ,SAAR,
|
|
3
|
+
"sources": ["../../../packages/js-toolkit/utils/object/getAllProperties.ts"],
|
|
4
|
+
"sourcesContent": ["import { isFunction } from '../is.js';\n\n/**\n * Gets all non-builtin properties up the prototype chain.\n *\n * @param {Object} object\n * The object to get the propeties from.\n * @param {Array} [props=[]]\n * The already existing properties.\n * @param {(name:string, proto:any) => boolean} testFn\n * @returns {Array<[string, Object]>} An array of properties and the prototype they belong to.\n */\nexport default function getAllProperties(\n object: unknown,\n props: Array<[string, unknown]> = [],\n testFn: (name: string, proto: unknown) => boolean = null,\n): Array<[string, unknown]> {\n const proto = Object.getPrototypeOf(object);\n\n if (proto === Object.prototype || proto === null) {\n return props;\n }\n\n let foundProps = Object.getOwnPropertyNames(proto);\n\n if (isFunction(testFn)) {\n foundProps = foundProps.filter((name) => testFn(name, proto));\n }\n\n const formatedProps = foundProps\n .map<[string, unknown]>((name) => [name, proto])\n .reduce<Array<[string, unknown]>>((acc, val) => [...acc, val], props);\n\n return getAllProperties(proto, formatedProps, testFn);\n}\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,gBAA2B;AAYZ,SAAR,iBACL,QACA,QAAkC,CAAC,GACnC,SAAoD,MAC1B;AAC1B,QAAM,QAAQ,OAAO,eAAe,MAAM;AAE1C,MAAI,UAAU,OAAO,aAAa,UAAU,MAAM;AAChD,WAAO;AAAA,EACT;AAEA,MAAI,aAAa,OAAO,oBAAoB,KAAK;AAEjD,UAAI,sBAAW,MAAM,GAAG;AACtB,iBAAa,WAAW,OAAO,CAAC,SAAS,OAAO,MAAM,KAAK,CAAC;AAAA,EAC9D;AAEA,QAAM,gBAAgB,WACnB,IAAuB,CAAC,SAAS,CAAC,MAAM,KAAK,CAAC,EAC9C,OAAiC,CAAC,KAAK,QAAQ,CAAC,GAAG,KAAK,GAAG,GAAG,KAAK;AAEtE,SAAO,iBAAiB,OAAO,eAAe,MAAM;AACtD;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -8,4 +8,4 @@
|
|
|
8
8
|
* @param {(name:string, proto:any) => boolean} testFn
|
|
9
9
|
* @returns {Array<[string, Object]>} An array of properties and the prototype they belong to.
|
|
10
10
|
*/
|
|
11
|
-
export default function getAllProperties(object:
|
|
11
|
+
export default function getAllProperties(object: unknown, props?: Array<[string, unknown]>, testFn?: (name: string, proto: unknown) => boolean): Array<[string, unknown]>;
|