@studiometa/js-toolkit 2.12.1 → 3.0.0-alpha.10
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/Base.d.ts +8 -8
- package/Base/Base.js +75 -78
- package/Base/Base.js.map +2 -2
- package/Base/features.d.ts +15 -2
- package/Base/features.js +31 -1
- package/Base/features.js.map +2 -2
- package/Base/index.d.ts +1 -0
- package/Base/index.js +4 -0
- package/Base/index.js.map +2 -2
- package/Base/managers/AbstractManager.d.ts +1 -1
- package/Base/managers/ChildrenManager.d.ts +6 -6
- package/Base/managers/ChildrenManager.js +34 -20
- package/Base/managers/ChildrenManager.js.map +2 -2
- package/Base/managers/EventsManager.d.ts +6 -28
- package/Base/managers/EventsManager.js +54 -64
- package/Base/managers/EventsManager.js.map +2 -2
- package/Base/managers/OptionsManager.d.ts +6 -6
- package/Base/managers/OptionsManager.js +29 -23
- package/Base/managers/OptionsManager.js.map +3 -3
- package/Base/managers/RefsManager.d.ts +1 -1
- package/Base/managers/RefsManager.js +23 -34
- package/Base/managers/RefsManager.js.map +3 -3
- package/Base/managers/ResponsiveOptionsManager.js +7 -4
- package/Base/managers/ResponsiveOptionsManager.js.map +2 -2
- package/Base/managers/ServicesManager.d.ts +2 -4
- package/Base/managers/ServicesManager.js +2 -3
- package/Base/managers/ServicesManager.js.map +2 -2
- package/Base/utils.d.ts +10 -5
- package/Base/utils.js +37 -23
- package/Base/utils.js.map +2 -2
- package/README.md +107 -6
- package/decorators/index.d.ts +1 -1
- package/decorators/index.js +1 -1
- package/decorators/index.js.map +1 -1
- package/decorators/withBreakpointManager.js +6 -4
- package/decorators/withBreakpointManager.js.map +2 -2
- package/decorators/withBreakpointObserver.d.ts +0 -1
- package/decorators/withBreakpointObserver.js +5 -3
- package/decorators/withBreakpointObserver.js.map +2 -2
- package/decorators/withIntersectionObserver.js +3 -5
- package/decorators/withIntersectionObserver.js.map +2 -2
- package/decorators/withMountOnMediaQuery.js +3 -3
- package/decorators/withMountOnMediaQuery.js.map +2 -2
- package/decorators/withMountWhenInView.js +3 -3
- package/decorators/withMountWhenInView.js.map +2 -2
- package/decorators/withName.d.ts +6 -0
- package/decorators/withName.js +12 -0
- package/decorators/withName.js.map +7 -0
- package/decorators/withScrolledInView/utils.d.ts +12 -1
- package/decorators/withScrolledInView/utils.js.map +2 -2
- package/decorators/withScrolledInView/withScrolledInView.js +7 -62
- package/decorators/withScrolledInView/withScrolledInView.js.map +2 -2
- package/helpers/createApp.d.ts +3 -4
- package/helpers/createApp.js +21 -11
- package/helpers/createApp.js.map +2 -2
- package/helpers/getDirectChildren.js +10 -5
- package/helpers/getDirectChildren.js.map +2 -2
- package/helpers/importWhenVisible.js +1 -2
- package/helpers/importWhenVisible.js.map +1 -1
- package/index.d.ts +2 -3
- package/index.js +2 -4
- package/index.js.map +2 -2
- package/package.json +2 -10
- package/services/index.d.ts +1 -1
- package/services/index.js.map +2 -2
- package/services/pointer.d.ts +1 -1
- package/services/pointer.js +3 -3
- package/services/pointer.js.map +2 -2
- package/services/raf.js +2 -4
- package/services/raf.js.map +2 -2
- package/services/resize.d.ts +7 -6
- package/services/resize.js +18 -26
- package/services/resize.js.map +2 -2
- package/services/scroll.d.ts +14 -0
- package/services/scroll.js +39 -21
- package/services/scroll.js.map +2 -2
- package/utils/SmartQueue.d.ts +1 -1
- package/utils/SmartQueue.js +1 -1
- package/utils/SmartQueue.js.map +2 -2
- package/utils/css/animate.d.ts +33 -15
- package/utils/css/animate.js +67 -26
- package/utils/css/animate.js.map +2 -2
- package/utils/css/getOffsetSizes.js +2 -2
- package/utils/css/getOffsetSizes.js.map +1 -1
- package/utils/css/index.d.ts +2 -1
- package/utils/css/index.js +4 -4
- package/utils/css/index.js.map +2 -2
- package/utils/css/matrix.d.ts +1 -1
- package/utils/css/matrix.js.map +2 -2
- package/utils/css/transform.d.ts +1 -1
- package/utils/css/transform.js +1 -1
- package/utils/css/transform.js.map +2 -2
- package/utils/css/utils.d.ts +1 -1
- package/utils/css/utils.js +1 -1
- package/utils/css/utils.js.map +2 -2
- package/utils/index.d.ts +6 -4
- package/utils/index.js +17 -16
- package/utils/index.js.map +2 -2
- package/utils/is.d.ts +12 -0
- package/utils/is.js +17 -0
- package/utils/is.js.map +2 -2
- package/utils/math/createRange.d.ts +4 -0
- package/utils/math/createRange.js +13 -0
- package/utils/math/createRange.js.map +7 -0
- package/utils/math/ease.d.ts +1 -0
- package/utils/math/ease.js +2 -0
- package/utils/math/ease.js.map +2 -2
- package/utils/math/index.d.ts +5 -3
- package/utils/math/index.js +7 -3
- package/utils/math/index.js.map +2 -2
- package/utils/math/mean.d.ts +1 -0
- package/utils/math/mean.js +17 -0
- package/utils/math/mean.js.map +7 -0
- package/utils/memo.d.ts +5 -0
- package/utils/memo.js +14 -0
- package/utils/memo.js.map +7 -0
- package/utils/nextFrame.d.ts +4 -22
- package/utils/nextFrame.js +3 -10
- package/utils/nextFrame.js.map +2 -2
- package/utils/nextMicrotask.d.ts +4 -1
- package/utils/nextMicrotask.js +3 -3
- package/utils/nextMicrotask.js.map +2 -2
- package/utils/nextTick.d.ts +4 -1
- package/utils/nextTick.js +3 -3
- package/utils/nextTick.js.map +2 -2
- package/utils/random.d.ts +15 -0
- package/utils/random.js +15 -0
- package/utils/random.js.map +7 -0
- package/utils/scrollTo.d.ts +30 -6
- package/utils/scrollTo.js +97 -43
- package/utils/scrollTo.js.map +2 -2
- package/utils/string/changeCase.d.ts +24 -0
- package/utils/string/changeCase.js +47 -0
- package/utils/string/changeCase.js.map +7 -0
- package/utils/string/index.d.ts +1 -0
- package/utils/string/index.js +1 -0
- package/utils/string/index.js.map +2 -2
- package/utils/{focusTrap.d.ts → trapFocus.d.ts} +2 -10
- package/utils/{focusTrap.js → trapFocus.js} +5 -9
- package/utils/trapFocus.js.map +7 -0
- package/utils/tween.d.ts +59 -10
- package/utils/tween.js +24 -18
- package/utils/tween.js.map +2 -2
- package/Base/Base.cjs +0 -420
- package/Base/Base.cjs.map +0 -7
- package/Base/features.cjs +0 -27
- package/Base/features.cjs.map +0 -7
- package/Base/index.cjs +0 -21
- package/Base/index.cjs.map +0 -7
- package/Base/managers/AbstractManager.cjs +0 -78
- package/Base/managers/AbstractManager.cjs.map +0 -7
- package/Base/managers/ChildrenManager.cjs +0 -156
- package/Base/managers/ChildrenManager.cjs.map +0 -7
- package/Base/managers/EventsManager.cjs +0 -305
- package/Base/managers/EventsManager.cjs.map +0 -7
- package/Base/managers/OptionsManager.cjs +0 -198
- package/Base/managers/OptionsManager.cjs.map +0 -7
- package/Base/managers/RefsManager.cjs +0 -118
- package/Base/managers/RefsManager.cjs.map +0 -7
- package/Base/managers/ResponsiveOptionsManager.cjs +0 -79
- package/Base/managers/ResponsiveOptionsManager.cjs.map +0 -7
- package/Base/managers/ServicesManager.cjs +0 -161
- package/Base/managers/ServicesManager.cjs.map +0 -7
- package/Base/managers/index.cjs +0 -39
- package/Base/managers/index.cjs.map +0 -7
- package/Base/types.cjs +0 -19
- package/Base/types.cjs.map +0 -7
- package/Base/utils.cjs +0 -95
- package/Base/utils.cjs.map +0 -7
- package/decorators/index.cjs +0 -33
- package/decorators/index.cjs.map +0 -7
- package/decorators/withBreakpointManager.cjs +0 -102
- package/decorators/withBreakpointManager.cjs.map +0 -7
- package/decorators/withBreakpointObserver.cjs +0 -128
- package/decorators/withBreakpointObserver.cjs.map +0 -7
- package/decorators/withDrag.cjs +0 -56
- package/decorators/withDrag.cjs.map +0 -7
- package/decorators/withExtraConfig.cjs +0 -50
- package/decorators/withExtraConfig.cjs.map +0 -7
- package/decorators/withFreezedOptions.cjs +0 -50
- package/decorators/withFreezedOptions.cjs.map +0 -7
- package/decorators/withIntersectionObserver.cjs +0 -71
- package/decorators/withIntersectionObserver.cjs.map +0 -7
- package/decorators/withMountOnMediaQuery.cjs +0 -86
- package/decorators/withMountOnMediaQuery.cjs.map +0 -7
- package/decorators/withMountWhenInView.cjs +0 -92
- package/decorators/withMountWhenInView.cjs.map +0 -7
- package/decorators/withMountWhenPrefersMotion.cjs +0 -30
- package/decorators/withMountWhenPrefersMotion.cjs.map +0 -7
- package/decorators/withRelativePointer.cjs +0 -56
- package/decorators/withRelativePointer.cjs.map +0 -7
- package/decorators/withResponsiveOptions.cjs +0 -41
- package/decorators/withResponsiveOptions.cjs.map +0 -7
- package/decorators/withScrolledInView/index.cjs +0 -22
- package/decorators/withScrolledInView/index.cjs.map +0 -7
- package/decorators/withScrolledInView/types.cjs +0 -19
- package/decorators/withScrolledInView/types.cjs.map +0 -7
- package/decorators/withScrolledInView/utils.cjs +0 -99
- package/decorators/withScrolledInView/utils.cjs.map +0 -7
- package/decorators/withScrolledInView/withScrolledInView.cjs +0 -249
- package/decorators/withScrolledInView/withScrolledInView.cjs.map +0 -7
- package/decorators/withVue2.cjs +0 -68
- package/decorators/withVue2.cjs.map +0 -7
- package/decorators/withVue2.d.ts +0 -16
- package/decorators/withVue2.js +0 -46
- package/decorators/withVue2.js.map +0 -7
- package/helpers/createApp.cjs +0 -58
- package/helpers/createApp.cjs.map +0 -7
- package/helpers/getClosestParent.cjs +0 -45
- package/helpers/getClosestParent.cjs.map +0 -7
- package/helpers/getDirectChildren.cjs +0 -47
- package/helpers/getDirectChildren.cjs.map +0 -7
- package/helpers/getInstanceFromElement.cjs +0 -32
- package/helpers/getInstanceFromElement.cjs.map +0 -7
- package/helpers/importOnInteraction.cjs +0 -48
- package/helpers/importOnInteraction.cjs.map +0 -7
- package/helpers/importOnMediaQuery.cjs +0 -44
- package/helpers/importOnMediaQuery.cjs.map +0 -7
- package/helpers/importWhenIdle.cjs +0 -46
- package/helpers/importWhenIdle.cjs.map +0 -7
- package/helpers/importWhenPrefersMotion.cjs +0 -40
- package/helpers/importWhenPrefersMotion.cjs.map +0 -7
- package/helpers/importWhenVisible.cjs +0 -44
- package/helpers/importWhenVisible.cjs.map +0 -7
- package/helpers/index.cjs +0 -53
- package/helpers/index.cjs.map +0 -7
- package/helpers/utils.cjs +0 -37
- package/helpers/utils.cjs.map +0 -7
- package/index.cjs +0 -31
- package/index.cjs.map +0 -7
- package/services/drag.cjs +0 -231
- package/services/drag.cjs.map +0 -7
- package/services/index.cjs +0 -51
- package/services/index.cjs.map +0 -7
- package/services/key.cjs +0 -97
- package/services/key.cjs.map +0 -7
- package/services/load.cjs +0 -60
- package/services/load.cjs.map +0 -7
- package/services/pointer.cjs +0 -145
- package/services/pointer.cjs.map +0 -7
- package/services/raf.cjs +0 -80
- package/services/raf.cjs.map +0 -7
- package/services/resize.cjs +0 -107
- package/services/resize.cjs.map +0 -7
- package/services/scroll.cjs +0 -119
- package/services/scroll.cjs.map +0 -7
- package/services/service.cjs +0 -69
- package/services/service.cjs.map +0 -7
- package/utils/Queue.cjs +0 -93
- package/utils/Queue.cjs.map +0 -7
- package/utils/SmartQueue.cjs +0 -73
- package/utils/SmartQueue.cjs.map +0 -7
- package/utils/collide/boundingRectToCircle.cjs +0 -36
- package/utils/collide/boundingRectToCircle.cjs.map +0 -7
- package/utils/collide/collideCircleCircle.cjs +0 -35
- package/utils/collide/collideCircleCircle.cjs.map +0 -7
- package/utils/collide/collideCircleRect.cjs +0 -47
- package/utils/collide/collideCircleRect.cjs.map +0 -7
- package/utils/collide/collidePointCircle.cjs +0 -32
- package/utils/collide/collidePointCircle.cjs.map +0 -7
- package/utils/collide/collidePointRect.cjs +0 -32
- package/utils/collide/collidePointRect.cjs.map +0 -7
- package/utils/collide/collideRectRect.cjs +0 -32
- package/utils/collide/collideRectRect.cjs.map +0 -7
- package/utils/collide/index.cjs +0 -47
- package/utils/collide/index.cjs.map +0 -7
- package/utils/css/animate.cjs +0 -202
- package/utils/css/animate.cjs.map +0 -7
- package/utils/css/classes.cjs +0 -51
- package/utils/css/classes.cjs.map +0 -7
- package/utils/css/getOffsetSizes.cjs +0 -48
- package/utils/css/getOffsetSizes.cjs.map +0 -7
- package/utils/css/index.cjs +0 -52
- package/utils/css/index.cjs.map +0 -7
- package/utils/css/matrix.cjs +0 -30
- package/utils/css/matrix.cjs.map +0 -7
- package/utils/css/styles.cjs +0 -45
- package/utils/css/styles.cjs.map +0 -7
- package/utils/css/transform.cjs +0 -91
- package/utils/css/transform.cjs.map +0 -7
- package/utils/css/transition.cjs +0 -145
- package/utils/css/transition.cjs.map +0 -7
- package/utils/css/utils.cjs +0 -32
- package/utils/css/utils.cjs.map +0 -7
- package/utils/debounce.cjs +0 -35
- package/utils/debounce.cjs.map +0 -7
- package/utils/dom/ancestors.cjs +0 -37
- package/utils/dom/ancestors.cjs.map +0 -7
- package/utils/dom/index.cjs +0 -21
- package/utils/dom/index.cjs.map +0 -7
- package/utils/focusTrap.cjs +0 -93
- package/utils/focusTrap.cjs.map +0 -7
- package/utils/focusTrap.js.map +0 -7
- package/utils/getComponentResolver.cjs +0 -38
- package/utils/getComponentResolver.cjs.map +0 -7
- package/utils/has.cjs +0 -29
- package/utils/has.cjs.map +0 -7
- package/utils/history.cjs +0 -92
- package/utils/history.cjs.map +0 -7
- package/utils/index.cjs +0 -76
- package/utils/index.cjs.map +0 -7
- package/utils/is.cjs +0 -41
- package/utils/is.cjs.map +0 -7
- package/utils/keyCodes.cjs +0 -36
- package/utils/keyCodes.cjs.map +0 -7
- package/utils/math/clamp.cjs +0 -29
- package/utils/math/clamp.cjs.map +0 -7
- package/utils/math/clamp01.cjs +0 -40
- package/utils/math/clamp01.cjs.map +0 -7
- package/utils/math/createEases.cjs +0 -33
- package/utils/math/createEases.cjs.map +0 -7
- package/utils/math/damp.cjs +0 -29
- package/utils/math/damp.cjs.map +0 -7
- package/utils/math/ease.cjs +0 -82
- package/utils/math/ease.cjs.map +0 -7
- package/utils/math/index.cjs +0 -54
- package/utils/math/index.cjs.map +0 -7
- package/utils/math/inertiaFinalValue.cjs +0 -47
- package/utils/math/inertiaFinalValue.cjs.map +0 -7
- package/utils/math/lerp.cjs +0 -29
- package/utils/math/lerp.cjs.map +0 -7
- package/utils/math/map.cjs +0 -29
- package/utils/math/map.cjs.map +0 -7
- package/utils/math/round.cjs +0 -29
- package/utils/math/round.cjs.map +0 -7
- package/utils/memoize.cjs +0 -48
- package/utils/memoize.cjs.map +0 -7
- package/utils/nextFrame.cjs +0 -41
- package/utils/nextFrame.cjs.map +0 -7
- package/utils/nextMicrotask.cjs +0 -30
- package/utils/nextMicrotask.cjs.map +0 -7
- package/utils/nextTick.cjs +0 -31
- package/utils/nextTick.cjs.map +0 -7
- package/utils/noop.cjs +0 -32
- package/utils/noop.cjs.map +0 -7
- package/utils/object/autoBind.cjs +0 -60
- package/utils/object/autoBind.cjs.map +0 -7
- package/utils/object/autoBind.d.ts +0 -14
- package/utils/object/autoBind.js +0 -28
- package/utils/object/autoBind.js.map +0 -7
- package/utils/object/getAllProperties.cjs +0 -39
- package/utils/object/getAllProperties.cjs.map +0 -7
- package/utils/object/index.cjs +0 -39
- package/utils/object/index.cjs.map +0 -7
- package/utils/object/index.d.ts +0 -2
- package/utils/object/index.js +0 -7
- package/utils/object/index.js.map +0 -7
- package/utils/scheduler.cjs +0 -75
- package/utils/scheduler.cjs.map +0 -7
- package/utils/scrollTo.cjs +0 -88
- package/utils/scrollTo.cjs.map +0 -7
- package/utils/string/endsWith.cjs +0 -35
- package/utils/string/endsWith.cjs.map +0 -7
- package/utils/string/index.cjs +0 -58
- package/utils/string/index.cjs.map +0 -7
- package/utils/string/startsWith.cjs +0 -35
- package/utils/string/startsWith.cjs.map +0 -7
- package/utils/string/withLeadingCharacters.cjs +0 -40
- package/utils/string/withLeadingCharacters.cjs.map +0 -7
- package/utils/string/withLeadingSlash.cjs +0 -40
- package/utils/string/withLeadingSlash.cjs.map +0 -7
- package/utils/string/withTrailingCharacters.cjs +0 -40
- package/utils/string/withTrailingCharacters.cjs.map +0 -7
- package/utils/string/withTrailingSlash.cjs +0 -40
- package/utils/string/withTrailingSlash.cjs.map +0 -7
- package/utils/string/withoutLeadingCharacters.cjs +0 -29
- package/utils/string/withoutLeadingCharacters.cjs.map +0 -7
- package/utils/string/withoutLeadingCharactersRecursive.cjs +0 -45
- package/utils/string/withoutLeadingCharactersRecursive.cjs.map +0 -7
- package/utils/string/withoutLeadingSlash.cjs +0 -40
- package/utils/string/withoutLeadingSlash.cjs.map +0 -7
- package/utils/string/withoutTrailingCharacters.cjs +0 -29
- package/utils/string/withoutTrailingCharacters.cjs.map +0 -7
- package/utils/string/withoutTrailingCharactersRecursive.cjs +0 -45
- package/utils/string/withoutTrailingCharactersRecursive.cjs.map +0 -7
- package/utils/string/withoutTrailingSlash.cjs +0 -40
- package/utils/string/withoutTrailingSlash.cjs.map +0 -7
- package/utils/throttle.cjs +0 -37
- package/utils/throttle.cjs.map +0 -7
- package/utils/tween.cjs +0 -122
- package/utils/tween.cjs.map +0 -7
- package/utils/wait.cjs +0 -31
- package/utils/wait.cjs.map +0 -7
|
@@ -1,48 +0,0 @@
|
|
|
1
|
-
var __defProp = Object.defineProperty;
|
|
2
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
3
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
4
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
5
|
-
var __export = (target, all) => {
|
|
6
|
-
for (var name in all)
|
|
7
|
-
__defProp(target, name, { get: all[name], enumerable: true });
|
|
8
|
-
};
|
|
9
|
-
var __copyProps = (to, from, except, desc) => {
|
|
10
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
11
|
-
for (let key of __getOwnPropNames(from))
|
|
12
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
13
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
14
|
-
}
|
|
15
|
-
return to;
|
|
16
|
-
};
|
|
17
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
18
|
-
|
|
19
|
-
// packages/js-toolkit/utils/css/getOffsetSizes.ts
|
|
20
|
-
var getOffsetSizes_exports = {};
|
|
21
|
-
__export(getOffsetSizes_exports, {
|
|
22
|
-
default: () => getOffsetSizes
|
|
23
|
-
});
|
|
24
|
-
module.exports = __toCommonJS(getOffsetSizes_exports);
|
|
25
|
-
function getOffsetSizes(element) {
|
|
26
|
-
let parent = element;
|
|
27
|
-
let x = -window.pageXOffset;
|
|
28
|
-
let y = -window.pageYOffset;
|
|
29
|
-
while (parent) {
|
|
30
|
-
x += parent.offsetLeft;
|
|
31
|
-
y += parent.offsetTop;
|
|
32
|
-
parent = parent.offsetParent;
|
|
33
|
-
}
|
|
34
|
-
const width = element.offsetWidth;
|
|
35
|
-
const height = element.offsetHeight;
|
|
36
|
-
return {
|
|
37
|
-
x,
|
|
38
|
-
y,
|
|
39
|
-
width,
|
|
40
|
-
height,
|
|
41
|
-
top: y,
|
|
42
|
-
right: width + x,
|
|
43
|
-
bottom: height + y,
|
|
44
|
-
left: x
|
|
45
|
-
};
|
|
46
|
-
}
|
|
47
|
-
if (module.exports.default) module.exports = module.exports.default;
|
|
48
|
-
//# sourceMappingURL=getOffsetSizes.cjs.map
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../../../packages/js-toolkit/utils/css/getOffsetSizes.ts"],
|
|
4
|
-
"sourcesContent": ["/**\n * Get a `DOMRect` like `Object` for an element, without its transforms.\n */\nexport default function getOffsetSizes(element: HTMLElement) {\n let parent = element;\n let x = -window.pageXOffset;\n let y = -window.pageYOffset;\n\n while (parent) {\n x += parent.offsetLeft;\n y += parent.offsetTop;\n // @ts-ignore\n parent = parent.offsetParent;\n }\n\n const width = element.offsetWidth;\n const height = element.offsetHeight;\n\n return {\n x,\n y,\n width,\n height,\n top: y,\n right: width + x,\n bottom: height + y,\n left: x,\n };\n}\n"],
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAGe,SAAR,eAAgC,SAAsB;AAC3D,MAAI,SAAS;AACb,MAAI,IAAI,CAAC,OAAO;AAChB,MAAI,IAAI,CAAC,OAAO;AAEhB,SAAO,QAAQ;AACb,SAAK,OAAO;AACZ,SAAK,OAAO;AAEZ,aAAS,OAAO;AAAA,EAClB;AAEA,QAAM,QAAQ,QAAQ;AACtB,QAAM,SAAS,QAAQ;AAEvB,SAAO;AAAA,IACL;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA,KAAK;AAAA,IACL,OAAO,QAAQ;AAAA,IACf,QAAQ,SAAS;AAAA,IACjB,MAAM;AAAA,EACR;AACF;",
|
|
6
|
-
"names": []
|
|
7
|
-
}
|
package/utils/css/index.cjs
DELETED
|
@@ -1,52 +0,0 @@
|
|
|
1
|
-
var __create = Object.create;
|
|
2
|
-
var __defProp = Object.defineProperty;
|
|
3
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
-
var __getProtoOf = Object.getPrototypeOf;
|
|
6
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
7
|
-
var __export = (target, all) => {
|
|
8
|
-
for (var name in all)
|
|
9
|
-
__defProp(target, name, { get: all[name], enumerable: true });
|
|
10
|
-
};
|
|
11
|
-
var __copyProps = (to, from, except, desc) => {
|
|
12
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
13
|
-
for (let key of __getOwnPropNames(from))
|
|
14
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
15
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
16
|
-
}
|
|
17
|
-
return to;
|
|
18
|
-
};
|
|
19
|
-
var __reExport = (target, mod, secondTarget) => (__copyProps(target, mod, "default"), secondTarget && __copyProps(secondTarget, mod, "default"));
|
|
20
|
-
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
21
|
-
// If the importer is in node compatibility mode or this is not an ESM
|
|
22
|
-
// file that has been converted to a CommonJS file using a Babel-
|
|
23
|
-
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
24
|
-
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
25
|
-
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
26
|
-
mod
|
|
27
|
-
));
|
|
28
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
29
|
-
|
|
30
|
-
// packages/js-toolkit/utils/css/index.ts
|
|
31
|
-
var css_exports = {};
|
|
32
|
-
__export(css_exports, {
|
|
33
|
-
addClass: () => import_classes.add,
|
|
34
|
-
addStyle: () => import_styles.add,
|
|
35
|
-
getOffsetSizes: () => import_getOffsetSizes.default,
|
|
36
|
-
matrix: () => import_matrix.default,
|
|
37
|
-
removeClass: () => import_classes.remove,
|
|
38
|
-
removeStyle: () => import_styles.remove,
|
|
39
|
-
toggleClass: () => import_classes.toggle,
|
|
40
|
-
transform: () => import_transform.default,
|
|
41
|
-
transition: () => import_transition.default
|
|
42
|
-
});
|
|
43
|
-
module.exports = __toCommonJS(css_exports);
|
|
44
|
-
__reExport(css_exports, require("./animate.cjs"), module.exports);
|
|
45
|
-
var import_classes = require("./classes.cjs");
|
|
46
|
-
var import_styles = require("./styles.cjs");
|
|
47
|
-
var import_getOffsetSizes = __toESM(require("./getOffsetSizes.cjs"), 1);
|
|
48
|
-
var import_matrix = __toESM(require("./matrix.cjs"), 1);
|
|
49
|
-
var import_transform = __toESM(require("./transform.cjs"), 1);
|
|
50
|
-
var import_transition = __toESM(require("./transition.cjs"), 1);
|
|
51
|
-
if (module.exports.default) module.exports = module.exports.default;
|
|
52
|
-
//# sourceMappingURL=index.cjs.map
|
package/utils/css/index.cjs.map
DELETED
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../../../packages/js-toolkit/utils/css/index.ts"],
|
|
4
|
-
"sourcesContent": ["export * from './animate.js';\nexport { add as addClass, remove as removeClass, toggle as toggleClass } from './classes.js';\nexport { add as addStyle, remove as removeStyle } from './styles.js';\nexport { default as getOffsetSizes } from './getOffsetSizes.js';\nexport { default as matrix } from './matrix.js';\nexport { default as transform } from './transform.js';\nexport { default as transition } from './transition.js';\n"],
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,wBAAc,0BAAd;AACA,qBAA8E;AAC9E,oBAAuD;AACvD,4BAA0C;AAC1C,oBAAkC;AAClC,uBAAqC;AACrC,wBAAsC;",
|
|
6
|
-
"names": []
|
|
7
|
-
}
|
package/utils/css/matrix.cjs
DELETED
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
var __defProp = Object.defineProperty;
|
|
2
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
3
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
4
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
5
|
-
var __export = (target, all) => {
|
|
6
|
-
for (var name in all)
|
|
7
|
-
__defProp(target, name, { get: all[name], enumerable: true });
|
|
8
|
-
};
|
|
9
|
-
var __copyProps = (to, from, except, desc) => {
|
|
10
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
11
|
-
for (let key of __getOwnPropNames(from))
|
|
12
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
13
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
14
|
-
}
|
|
15
|
-
return to;
|
|
16
|
-
};
|
|
17
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
18
|
-
|
|
19
|
-
// packages/js-toolkit/utils/css/matrix.ts
|
|
20
|
-
var matrix_exports = {};
|
|
21
|
-
__export(matrix_exports, {
|
|
22
|
-
default: () => matrix
|
|
23
|
-
});
|
|
24
|
-
module.exports = __toCommonJS(matrix_exports);
|
|
25
|
-
function matrix(transform) {
|
|
26
|
-
transform = transform || {};
|
|
27
|
-
return `matrix(${transform.scaleX ?? 1}, ${transform.skewY ?? 0}, ${transform.skewX ?? 0}, ${transform.scaleY ?? 1}, ${transform.translateX ?? 0}, ${transform.translateY ?? 0})`;
|
|
28
|
-
}
|
|
29
|
-
if (module.exports.default) module.exports = module.exports.default;
|
|
30
|
-
//# sourceMappingURL=matrix.cjs.map
|
package/utils/css/matrix.cjs.map
DELETED
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../../../packages/js-toolkit/utils/css/matrix.ts"],
|
|
4
|
-
"sourcesContent": ["type MatrixTransform = {\n scaleX?: number;\n scaleY?: number;\n skewX?: number;\n skewY?: number;\n translateX?: number;\n translateY?: number;\n};\n\n/**\n * Format a CSS transform matrix with the given values.\n *\n * @param {Object} transform\n * @param {number} [transform.scaleX=1] The scale on the x axis.\n * @param {number} [transform.scaleY=1] The scale on the y axis.\n * @param {number} [transform.skewX=0] The skew on the x axis.\n * @param {number} [transform.skewY=0] The skew on the y axis.\n * @param {number} [transform.translateX=0] The translate on the x axis.\n * @param {number} [transform.translateY=0] The translate on the y axis.\n * @returns {string} A formatted CSS matrix transform.\n * @example\n * ```js\n * matrix({ scaleX: 0.5, scaleY: 0.5 });\n * // matrix(0.5, 0, 0, 0.5, 0, 0)\n * ```\n */\nexport default function matrix(transform: MatrixTransform): string {\n // eslint-disable-next-line no-param-reassign\n transform = transform || {};\n return `matrix(${transform.scaleX ?? 1}, ${transform.skewY ?? 0}, ${transform.skewX ?? 0}, ${\n transform.scaleY ?? 1\n }, ${transform.translateX ?? 0}, ${transform.translateY ?? 0})`;\n}\n"],
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AA0Be,SAAR,OAAwB,WAAoC;AAEjE,cAAY,aAAa,CAAC;AAC1B,SAAO,UAAU,UAAU,UAAU,CAAC,KAAK,UAAU,SAAS,CAAC,KAAK,UAAU,SAAS,CAAC,KACtF,UAAU,UAAU,CACtB,KAAK,UAAU,cAAc,CAAC,KAAK,UAAU,cAAc,CAAC;AAC9D;",
|
|
6
|
-
"names": []
|
|
7
|
-
}
|
package/utils/css/styles.cjs
DELETED
|
@@ -1,45 +0,0 @@
|
|
|
1
|
-
var __defProp = Object.defineProperty;
|
|
2
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
3
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
4
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
5
|
-
var __export = (target, all) => {
|
|
6
|
-
for (var name in all)
|
|
7
|
-
__defProp(target, name, { get: all[name], enumerable: true });
|
|
8
|
-
};
|
|
9
|
-
var __copyProps = (to, from, except, desc) => {
|
|
10
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
11
|
-
for (let key of __getOwnPropNames(from))
|
|
12
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
13
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
14
|
-
}
|
|
15
|
-
return to;
|
|
16
|
-
};
|
|
17
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
18
|
-
|
|
19
|
-
// packages/js-toolkit/utils/css/styles.ts
|
|
20
|
-
var styles_exports = {};
|
|
21
|
-
__export(styles_exports, {
|
|
22
|
-
add: () => add,
|
|
23
|
-
remove: () => remove
|
|
24
|
-
});
|
|
25
|
-
module.exports = __toCommonJS(styles_exports);
|
|
26
|
-
var import_is = require("../is.cjs");
|
|
27
|
-
var import_utils = require("./utils.cjs");
|
|
28
|
-
function setStyles(elementOrElements, styles, method = "add") {
|
|
29
|
-
if (!elementOrElements || !styles || !(0, import_is.isObject)(styles)) {
|
|
30
|
-
return;
|
|
31
|
-
}
|
|
32
|
-
(0, import_utils.eachElements)(elementOrElements, (el) => {
|
|
33
|
-
for (const [prop, value] of Object.entries(styles)) {
|
|
34
|
-
el.style[prop] = method === "add" ? value : "";
|
|
35
|
-
}
|
|
36
|
-
});
|
|
37
|
-
}
|
|
38
|
-
function add(elementOrElements, styles) {
|
|
39
|
-
setStyles(elementOrElements, styles);
|
|
40
|
-
}
|
|
41
|
-
function remove(elementOrElements, styles) {
|
|
42
|
-
setStyles(elementOrElements, styles, "remove");
|
|
43
|
-
}
|
|
44
|
-
if (module.exports.default) module.exports = module.exports.default;
|
|
45
|
-
//# sourceMappingURL=styles.cjs.map
|
package/utils/css/styles.cjs.map
DELETED
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../../../packages/js-toolkit/utils/css/styles.ts"],
|
|
4
|
-
"sourcesContent": ["import { isObject } from '../is.js';\n// eslint-disable-next-line import/extensions\nimport { eachElements } from './utils.js';\n\n/**\n * Manage a list of style properties on an element.\n */\nfunction setStyles(\n elementOrElements: HTMLElement | HTMLElement[] | NodeListOf<HTMLElement>,\n styles: Partial<CSSStyleDeclaration>,\n method: 'add' | 'remove' = 'add',\n) {\n if (!elementOrElements || !styles || !isObject(styles)) {\n return;\n }\n\n eachElements(elementOrElements, (el) => {\n for (const [prop, value] of Object.entries(styles)) {\n el.style[prop] = method === 'add' ? value : '';\n }\n });\n}\n\n/**\n * Add styles to an element.\n */\nexport function add(\n elementOrElements: HTMLElement | HTMLElement[] | NodeListOf<HTMLElement>,\n styles: Partial<CSSStyleDeclaration>,\n) {\n setStyles(elementOrElements, styles);\n}\n\n/**\n * Remove class names from an element.\n */\nexport function remove(\n elementOrElements: HTMLElement | HTMLElement[] | NodeListOf<HTMLElement>,\n styles: Partial<CSSStyleDeclaration>,\n) {\n setStyles(elementOrElements, styles, 'remove');\n}\n"],
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,gBAAyB;AAEzB,mBAA6B;AAK7B,SAAS,UACP,mBACA,QACA,SAA2B,OAC3B;AACA,MAAI,CAAC,qBAAqB,CAAC,UAAU,KAAC,oBAAS,MAAM,GAAG;AACtD;AAAA,EACF;AAEA,iCAAa,mBAAmB,CAAC,OAAO;AACtC,eAAW,CAAC,MAAM,KAAK,KAAK,OAAO,QAAQ,MAAM,GAAG;AAClD,SAAG,MAAM,IAAI,IAAI,WAAW,QAAQ,QAAQ;AAAA,IAC9C;AAAA,EACF,CAAC;AACH;AAKO,SAAS,IACd,mBACA,QACA;AACA,YAAU,mBAAmB,MAAM;AACrC;AAKO,SAAS,OACd,mBACA,QACA;AACA,YAAU,mBAAmB,QAAQ,QAAQ;AAC/C;",
|
|
6
|
-
"names": []
|
|
7
|
-
}
|
package/utils/css/transform.cjs
DELETED
|
@@ -1,91 +0,0 @@
|
|
|
1
|
-
var __defProp = Object.defineProperty;
|
|
2
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
3
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
4
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
5
|
-
var __export = (target, all) => {
|
|
6
|
-
for (var name in all)
|
|
7
|
-
__defProp(target, name, { get: all[name], enumerable: true });
|
|
8
|
-
};
|
|
9
|
-
var __copyProps = (to, from, except, desc) => {
|
|
10
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
11
|
-
for (let key of __getOwnPropNames(from))
|
|
12
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
13
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
14
|
-
}
|
|
15
|
-
return to;
|
|
16
|
-
};
|
|
17
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
18
|
-
|
|
19
|
-
// packages/js-toolkit/utils/css/transform.ts
|
|
20
|
-
var transform_exports = {};
|
|
21
|
-
__export(transform_exports, {
|
|
22
|
-
TRANSFORM_PROPS: () => TRANSFORM_PROPS,
|
|
23
|
-
default: () => transform
|
|
24
|
-
});
|
|
25
|
-
module.exports = __toCommonJS(transform_exports);
|
|
26
|
-
var import_is = require("../is.cjs");
|
|
27
|
-
var import_utils = require("./utils.cjs");
|
|
28
|
-
var TRANSFORM_PROPS = [
|
|
29
|
-
"x",
|
|
30
|
-
"y",
|
|
31
|
-
"z",
|
|
32
|
-
"rotate",
|
|
33
|
-
"rotateX",
|
|
34
|
-
"rotateY",
|
|
35
|
-
"rotateZ",
|
|
36
|
-
"scale",
|
|
37
|
-
"scaleX",
|
|
38
|
-
"scaleY",
|
|
39
|
-
"scaleZ",
|
|
40
|
-
"skew",
|
|
41
|
-
"skewX",
|
|
42
|
-
"skewY"
|
|
43
|
-
];
|
|
44
|
-
function transform(elementOrElements, props) {
|
|
45
|
-
let value = "";
|
|
46
|
-
if ((0, import_is.isDefined)(props.x) || (0, import_is.isDefined)(props.y) || (0, import_is.isDefined)(props.z)) {
|
|
47
|
-
value += `translate3d(${props.x ?? 0}px, ${props.y ?? 0}px, ${props.z ?? 0}px) `;
|
|
48
|
-
}
|
|
49
|
-
if ((0, import_is.isDefined)(props.rotate)) {
|
|
50
|
-
value += `rotate(${props.rotate}deg) `;
|
|
51
|
-
} else {
|
|
52
|
-
if ((0, import_is.isDefined)(props.rotateX)) {
|
|
53
|
-
value += `rotateX(${props.rotateX}deg) `;
|
|
54
|
-
}
|
|
55
|
-
if ((0, import_is.isDefined)(props.rotateY)) {
|
|
56
|
-
value += `rotateY(${props.rotateY}deg) `;
|
|
57
|
-
}
|
|
58
|
-
if ((0, import_is.isDefined)(props.rotateZ)) {
|
|
59
|
-
value += `rotateZ(${props.rotateZ}deg) `;
|
|
60
|
-
}
|
|
61
|
-
}
|
|
62
|
-
if ((0, import_is.isDefined)(props.scale)) {
|
|
63
|
-
value += `scale(${props.scale}) `;
|
|
64
|
-
} else {
|
|
65
|
-
if ((0, import_is.isDefined)(props.scaleX)) {
|
|
66
|
-
value += `scaleX(${props.scaleX}) `;
|
|
67
|
-
}
|
|
68
|
-
if ((0, import_is.isDefined)(props.scaleY)) {
|
|
69
|
-
value += `scaleY(${props.scaleY}) `;
|
|
70
|
-
}
|
|
71
|
-
if ((0, import_is.isDefined)(props.scaleZ)) {
|
|
72
|
-
value += `scaleZ(${props.scaleZ}) `;
|
|
73
|
-
}
|
|
74
|
-
}
|
|
75
|
-
if ((0, import_is.isDefined)(props.skew)) {
|
|
76
|
-
value += `skew(${props.skew}deg) `;
|
|
77
|
-
} else {
|
|
78
|
-
if ((0, import_is.isDefined)(props.skewX)) {
|
|
79
|
-
value += `skewX(${props.skewX}deg) `;
|
|
80
|
-
}
|
|
81
|
-
if ((0, import_is.isDefined)(props.skewY)) {
|
|
82
|
-
value += `skewY(${props.skewY}deg) `;
|
|
83
|
-
}
|
|
84
|
-
}
|
|
85
|
-
(0, import_utils.eachElements)(elementOrElements, (element) => {
|
|
86
|
-
element.style.transform = value;
|
|
87
|
-
});
|
|
88
|
-
return value;
|
|
89
|
-
}
|
|
90
|
-
if (module.exports.default) module.exports = module.exports.default;
|
|
91
|
-
//# sourceMappingURL=transform.cjs.map
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../../../packages/js-toolkit/utils/css/transform.ts"],
|
|
4
|
-
"sourcesContent": ["import { isDefined } from '../is.js';\n// eslint-disable-next-line import/extensions\nimport { eachElements } from './utils.js';\n\nexport type TransformProps = Partial<{\n x: number;\n y: number;\n z: number;\n rotate: number;\n rotateX: number;\n rotateY: number;\n rotateZ: number;\n scale: number;\n scaleX: number;\n scaleY: number;\n scaleZ: number;\n skew: number;\n skewX: number;\n skewY: number;\n}>;\n\nexport const TRANSFORM_PROPS = [\n 'x',\n 'y',\n 'z',\n 'rotate',\n 'rotateX',\n 'rotateY',\n 'rotateZ',\n 'scale',\n 'scaleX',\n 'scaleY',\n 'scaleZ',\n 'skew',\n 'skewX',\n 'skewY',\n];\n\n/**\n * Generate a CSS transform.\n */\nexport default function transform(\n elementOrElements: HTMLElement | HTMLElement[] | NodeListOf<HTMLElement>,\n props: TransformProps,\n): string {\n let value = '';\n\n if (isDefined(props.x) || isDefined(props.y) || isDefined(props.z)) {\n value += `translate3d(${props.x ?? 0}px, ${props.y ?? 0}px, ${props.z ?? 0}px) `;\n }\n\n if (isDefined(props.rotate)) {\n value += `rotate(${props.rotate}deg) `;\n } else {\n if (isDefined(props.rotateX)) {\n value += `rotateX(${props.rotateX}deg) `;\n }\n\n if (isDefined(props.rotateY)) {\n value += `rotateY(${props.rotateY}deg) `;\n }\n\n if (isDefined(props.rotateZ)) {\n value += `rotateZ(${props.rotateZ}deg) `;\n }\n }\n\n if (isDefined(props.scale)) {\n value += `scale(${props.scale}) `;\n } else {\n if (isDefined(props.scaleX)) {\n value += `scaleX(${props.scaleX}) `;\n }\n\n if (isDefined(props.scaleY)) {\n value += `scaleY(${props.scaleY}) `;\n }\n\n if (isDefined(props.scaleZ)) {\n value += `scaleZ(${props.scaleZ}) `;\n }\n }\n\n if (isDefined(props.skew)) {\n value += `skew(${props.skew}deg) `;\n } else {\n if (isDefined(props.skewX)) {\n value += `skewX(${props.skewX}deg) `;\n }\n\n if (isDefined(props.skewY)) {\n value += `skewY(${props.skewY}deg) `;\n }\n }\n\n eachElements(elementOrElements, (element) => {\n element.style.transform = value;\n });\n return value;\n}\n"],
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,gBAA0B;AAE1B,mBAA6B;AAmBtB,IAAM,kBAAkB;AAAA,EAC7B;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF;AAKe,SAAR,UACL,mBACA,OACQ;AACR,MAAI,QAAQ;AAEZ,UAAI,qBAAU,MAAM,CAAC,SAAK,qBAAU,MAAM,CAAC,SAAK,qBAAU,MAAM,CAAC,GAAG;AAClE,aAAS,eAAe,MAAM,KAAK,CAAC,OAAO,MAAM,KAAK,CAAC,OAAO,MAAM,KAAK,CAAC;AAAA,EAC5E;AAEA,UAAI,qBAAU,MAAM,MAAM,GAAG;AAC3B,aAAS,UAAU,MAAM,MAAM;AAAA,EACjC,OAAO;AACL,YAAI,qBAAU,MAAM,OAAO,GAAG;AAC5B,eAAS,WAAW,MAAM,OAAO;AAAA,IACnC;AAEA,YAAI,qBAAU,MAAM,OAAO,GAAG;AAC5B,eAAS,WAAW,MAAM,OAAO;AAAA,IACnC;AAEA,YAAI,qBAAU,MAAM,OAAO,GAAG;AAC5B,eAAS,WAAW,MAAM,OAAO;AAAA,IACnC;AAAA,EACF;AAEA,UAAI,qBAAU,MAAM,KAAK,GAAG;AAC1B,aAAS,SAAS,MAAM,KAAK;AAAA,EAC/B,OAAO;AACL,YAAI,qBAAU,MAAM,MAAM,GAAG;AAC3B,eAAS,UAAU,MAAM,MAAM;AAAA,IACjC;AAEA,YAAI,qBAAU,MAAM,MAAM,GAAG;AAC3B,eAAS,UAAU,MAAM,MAAM;AAAA,IACjC;AAEA,YAAI,qBAAU,MAAM,MAAM,GAAG;AAC3B,eAAS,UAAU,MAAM,MAAM;AAAA,IACjC;AAAA,EACF;AAEA,UAAI,qBAAU,MAAM,IAAI,GAAG;AACzB,aAAS,QAAQ,MAAM,IAAI;AAAA,EAC7B,OAAO;AACL,YAAI,qBAAU,MAAM,KAAK,GAAG;AAC1B,eAAS,SAAS,MAAM,KAAK;AAAA,IAC/B;AAEA,YAAI,qBAAU,MAAM,KAAK,GAAG;AAC1B,eAAS,SAAS,MAAM,KAAK;AAAA,IAC/B;AAAA,EACF;AAEA,iCAAa,mBAAmB,CAAC,YAAY;AAC3C,YAAQ,MAAM,YAAY;AAAA,EAC5B,CAAC;AACD,SAAO;AACT;",
|
|
6
|
-
"names": []
|
|
7
|
-
}
|
package/utils/css/transition.cjs
DELETED
|
@@ -1,145 +0,0 @@
|
|
|
1
|
-
var __create = Object.create;
|
|
2
|
-
var __defProp = Object.defineProperty;
|
|
3
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
-
var __getProtoOf = Object.getPrototypeOf;
|
|
6
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
7
|
-
var __export = (target, all) => {
|
|
8
|
-
for (var name in all)
|
|
9
|
-
__defProp(target, name, { get: all[name], enumerable: true });
|
|
10
|
-
};
|
|
11
|
-
var __copyProps = (to, from, except, desc) => {
|
|
12
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
13
|
-
for (let key of __getOwnPropNames(from))
|
|
14
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
15
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
16
|
-
}
|
|
17
|
-
return to;
|
|
18
|
-
};
|
|
19
|
-
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
20
|
-
// If the importer is in node compatibility mode or this is not an ESM
|
|
21
|
-
// file that has been converted to a CommonJS file using a Babel-
|
|
22
|
-
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
23
|
-
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
24
|
-
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
25
|
-
mod
|
|
26
|
-
));
|
|
27
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
28
|
-
|
|
29
|
-
// packages/js-toolkit/utils/css/transition.ts
|
|
30
|
-
var transition_exports = {};
|
|
31
|
-
__export(transition_exports, {
|
|
32
|
-
default: () => transition,
|
|
33
|
-
setClassesOrStyles: () => setClassesOrStyles
|
|
34
|
-
});
|
|
35
|
-
module.exports = __toCommonJS(transition_exports);
|
|
36
|
-
var import_nextFrame = require("../nextFrame.cjs");
|
|
37
|
-
var classes = __toESM(require("./classes.cjs"), 1);
|
|
38
|
-
var styles = __toESM(require("./styles.cjs"), 1);
|
|
39
|
-
var import_is = require("../is.cjs");
|
|
40
|
-
var import_has = require("../has.cjs");
|
|
41
|
-
var import_utils = require("./utils.cjs");
|
|
42
|
-
var cache = /* @__PURE__ */ new WeakMap();
|
|
43
|
-
var Transition = class {
|
|
44
|
-
/**
|
|
45
|
-
* Is a transition currently running?
|
|
46
|
-
*/
|
|
47
|
-
isTransitioning = false;
|
|
48
|
-
/**
|
|
49
|
-
* A callback to execute when the transition ends.
|
|
50
|
-
*/
|
|
51
|
-
transitionEndHandler = null;
|
|
52
|
-
/**
|
|
53
|
-
* Instantiate and save the instance to the cache.
|
|
54
|
-
*/
|
|
55
|
-
constructor(element) {
|
|
56
|
-
cache.set(element, this);
|
|
57
|
-
}
|
|
58
|
-
/**
|
|
59
|
-
* Get the transition class attached to the given element.
|
|
60
|
-
*
|
|
61
|
-
* @param {HTMLElement} element The HTML element concerned by the transition.
|
|
62
|
-
* @returns {Transition} The transition instance tied to the given element.
|
|
63
|
-
*/
|
|
64
|
-
static getInstance(element) {
|
|
65
|
-
let instance = cache.get(element);
|
|
66
|
-
if (!instance) {
|
|
67
|
-
instance = new this(element);
|
|
68
|
-
}
|
|
69
|
-
return instance;
|
|
70
|
-
}
|
|
71
|
-
};
|
|
72
|
-
function setClassesOrStyles(element, classesOrStyles, method = "add") {
|
|
73
|
-
if ((0, import_is.isString)(classesOrStyles) || (0, import_is.isArray)(classesOrStyles)) {
|
|
74
|
-
classes[method](element, classesOrStyles);
|
|
75
|
-
} else {
|
|
76
|
-
styles[method](element, classesOrStyles);
|
|
77
|
-
}
|
|
78
|
-
}
|
|
79
|
-
function testTransition(element) {
|
|
80
|
-
if (!(0, import_has.hasWindow)()) {
|
|
81
|
-
return false;
|
|
82
|
-
}
|
|
83
|
-
const { transitionDuration } = window.getComputedStyle(element);
|
|
84
|
-
return !!transitionDuration && transitionDuration !== "0s";
|
|
85
|
-
}
|
|
86
|
-
async function start(element, classesOrStyles) {
|
|
87
|
-
const trs = Transition.getInstance(element);
|
|
88
|
-
trs.isTransitioning = true;
|
|
89
|
-
setClassesOrStyles(element, classesOrStyles.from);
|
|
90
|
-
await (0, import_nextFrame.nextFrame)();
|
|
91
|
-
setClassesOrStyles(element, classesOrStyles.active);
|
|
92
|
-
}
|
|
93
|
-
async function next(element, classesOrStyles) {
|
|
94
|
-
const hasTransition = testTransition(element);
|
|
95
|
-
return new Promise(async (resolve) => {
|
|
96
|
-
if (hasTransition) {
|
|
97
|
-
const trs = Transition.getInstance(element);
|
|
98
|
-
trs.transitionEndHandler = () => resolve();
|
|
99
|
-
element.addEventListener("transitionend", trs.transitionEndHandler, false);
|
|
100
|
-
}
|
|
101
|
-
setClassesOrStyles(element, classesOrStyles.from, "remove");
|
|
102
|
-
setClassesOrStyles(element, classesOrStyles.to);
|
|
103
|
-
await (0, import_nextFrame.nextFrame)();
|
|
104
|
-
if (!hasTransition) {
|
|
105
|
-
resolve();
|
|
106
|
-
}
|
|
107
|
-
});
|
|
108
|
-
}
|
|
109
|
-
function end(element, classesOrStyles, mode = "remove") {
|
|
110
|
-
const trs = Transition.getInstance(element);
|
|
111
|
-
element.removeEventListener("transitionend", trs.transitionEndHandler, false);
|
|
112
|
-
if (mode === "remove") {
|
|
113
|
-
setClassesOrStyles(element, classesOrStyles.to, "remove");
|
|
114
|
-
}
|
|
115
|
-
setClassesOrStyles(element, classesOrStyles.active, "remove");
|
|
116
|
-
trs.isTransitioning = false;
|
|
117
|
-
trs.transitionEndHandler = null;
|
|
118
|
-
}
|
|
119
|
-
async function singleTransition(element, name, endMode = "remove") {
|
|
120
|
-
const classesOrStyles = (0, import_is.isString)(name) ? {
|
|
121
|
-
from: `${name}-from`,
|
|
122
|
-
active: `${name}-active`,
|
|
123
|
-
to: `${name}-to`
|
|
124
|
-
} : {
|
|
125
|
-
from: "",
|
|
126
|
-
active: "",
|
|
127
|
-
to: "",
|
|
128
|
-
...name
|
|
129
|
-
};
|
|
130
|
-
const trs = Transition.getInstance(element);
|
|
131
|
-
if (trs.isTransitioning) {
|
|
132
|
-
end(element, classesOrStyles);
|
|
133
|
-
}
|
|
134
|
-
await start(element, classesOrStyles);
|
|
135
|
-
await next(element, classesOrStyles);
|
|
136
|
-
end(element, classesOrStyles, endMode);
|
|
137
|
-
return Promise.resolve();
|
|
138
|
-
}
|
|
139
|
-
async function transition(elementOrElements, name, endMode = "remove") {
|
|
140
|
-
await Promise.all(
|
|
141
|
-
(0, import_utils.eachElements)(elementOrElements, (element) => singleTransition(element, name, endMode))
|
|
142
|
-
);
|
|
143
|
-
}
|
|
144
|
-
if (module.exports.default) module.exports = module.exports.default;
|
|
145
|
-
//# sourceMappingURL=transition.cjs.map
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../../../packages/js-toolkit/utils/css/transition.ts"],
|
|
4
|
-
"sourcesContent": ["import { nextFrame } from '../nextFrame.js';\nimport * as classes from './classes.js';\nimport * as styles from './styles.js';\nimport { isArray, isString } from '../is.js';\nimport { hasWindow } from '../has.js';\n// eslint-disable-next-line import/extensions\nimport { eachElements } from './utils.js';\n\n/** WeakMap to hold the transition instances. */\nconst cache = new WeakMap();\n\nexport type ClassesOrStyles = string | string[] | Partial<CSSStyleDeclaration>;\n\nexport type TransitionStyles = {\n from?: ClassesOrStyles;\n active?: ClassesOrStyles;\n to?: ClassesOrStyles;\n};\n\n/**\n * Transition class.\n */\nclass Transition {\n /**\n * Is a transition currently running?\n */\n isTransitioning = false;\n\n /**\n * A callback to execute when the transition ends.\n */\n transitionEndHandler: EventListenerOrEventListenerObject | null = null;\n\n /**\n * Instantiate and save the instance to the cache.\n */\n constructor(element: HTMLElement) {\n cache.set(element, this);\n }\n\n /**\n * Get the transition class attached to the given element.\n *\n * @param {HTMLElement} element The HTML element concerned by the transition.\n * @returns {Transition} The transition instance tied to the given element.\n */\n static getInstance(element: HTMLElement): Transition {\n let instance = cache.get(element);\n\n if (!instance) {\n instance = new this(element);\n }\n\n return instance;\n }\n}\n\n/**\n * Update either the classes or the styles of an element with the given method.\n */\nexport function setClassesOrStyles(\n element: HTMLElement,\n classesOrStyles: ClassesOrStyles,\n method: 'add' | 'remove' = 'add',\n) {\n if (isString(classesOrStyles) || isArray(classesOrStyles)) {\n classes[method](element, classesOrStyles);\n } else {\n styles[method](element, classesOrStyles);\n }\n}\n\n/**\n * Test if the given element has a transition duration.\n */\nfunction testTransition(element: HTMLElement) {\n if (!hasWindow()) {\n return false;\n }\n\n const { transitionDuration } = window.getComputedStyle(element);\n return !!transitionDuration && transitionDuration !== '0s';\n}\n\n/**\n * Apply the from state.\n */\nasync function start(element: HTMLElement, classesOrStyles: TransitionStyles) {\n const trs = Transition.getInstance(element);\n trs.isTransitioning = true;\n setClassesOrStyles(element, classesOrStyles.from);\n await nextFrame();\n setClassesOrStyles(element, classesOrStyles.active);\n}\n\n/**\n * Apply the active state.\n */\nasync function next(element: HTMLElement, classesOrStyles: TransitionStyles): Promise<void> {\n const hasTransition = testTransition(element);\n\n /* eslint-disable-next-line */\n return new Promise(async (resolve) => {\n if (hasTransition) {\n const trs = Transition.getInstance(element);\n trs.transitionEndHandler = () => resolve();\n element.addEventListener('transitionend', trs.transitionEndHandler, false);\n }\n setClassesOrStyles(element, classesOrStyles.from, 'remove');\n setClassesOrStyles(element, classesOrStyles.to);\n await nextFrame();\n if (!hasTransition) {\n resolve();\n }\n });\n}\n\n/**\n * Apply the final state.\n */\nfunction end(\n element: HTMLElement,\n classesOrStyles: TransitionStyles,\n mode: 'keep' | 'remove' = 'remove',\n) {\n const trs = Transition.getInstance(element);\n element.removeEventListener('transitionend', trs.transitionEndHandler, false);\n if (mode === 'remove') {\n setClassesOrStyles(element, classesOrStyles.to, 'remove');\n }\n setClassesOrStyles(element, classesOrStyles.active, 'remove');\n trs.isTransitioning = false;\n trs.transitionEndHandler = null;\n}\n\n/**\n * Manage CSS transition with class.\n *\n * This is inspired by the Vue `<transition>` component\n * and the `@barba/css` package, many thanks to them!\n *\n * @param {HTMLElement} element The target element.\n * @param {string|TransitionStyles} name The name of the transition or an object with the hooks classesOrStyles.\n * @param {string} endMode Whether to remove or keep the `to` classes/styles\n * @returns {Promise<void>} A promise resolving at the end of the transition.\n */\nasync function singleTransition(\n element: HTMLElement,\n name: string | TransitionStyles,\n endMode: 'keep' | 'remove' = 'remove',\n): Promise<void> {\n /** @type {TransitionStyles} */\n const classesOrStyles = isString(name)\n ? {\n from: `${name}-from`,\n active: `${name}-active`,\n to: `${name}-to`,\n }\n : {\n from: '',\n active: '',\n to: '',\n ...name,\n };\n\n const trs = Transition.getInstance(element);\n // End any previous transition running on the element.\n if (trs.isTransitioning) {\n end(element, classesOrStyles);\n }\n\n await start(element, classesOrStyles);\n await next(element, classesOrStyles);\n end(element, classesOrStyles, endMode);\n return Promise.resolve();\n}\n\n/**\n * Manage CSS transition with class.\n *\n * @param {HTMLElement|HTMLElement[]|NodeListOf<HTMLElement>} elementOrElements The target element or elements.\n * @param {string|TransitionStyles} name The name of the transition or an object with the hooks classesOrStyles.\n * @param {string} endMode Whether to remove or keep the `to` classes/styles\n * @returns {Promise<void>} A promise resolving at the end of the transition.\n */\nexport default async function transition(\n elementOrElements: HTMLElement | HTMLElement[] | NodeListOf<HTMLElement>,\n name: string | TransitionStyles,\n endMode: 'keep' | 'remove' = 'remove',\n) {\n await Promise.all(\n eachElements(elementOrElements, (element) => singleTransition(element, name, endMode)),\n );\n}\n"],
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,uBAA0B;AAC1B,cAAyB;AACzB,aAAwB;AACxB,gBAAkC;AAClC,iBAA0B;AAE1B,mBAA6B;AAG7B,IAAM,QAAQ,oBAAI,QAAQ;AAa1B,IAAM,aAAN,MAAiB;AAAA;AAAA;AAAA;AAAA,EAIf,kBAAkB;AAAA;AAAA;AAAA;AAAA,EAKlB,uBAAkE;AAAA;AAAA;AAAA;AAAA,EAKlE,YAAY,SAAsB;AAChC,UAAM,IAAI,SAAS,IAAI;AAAA,EACzB;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAQA,OAAO,YAAY,SAAkC;AACnD,QAAI,WAAW,MAAM,IAAI,OAAO;AAEhC,QAAI,CAAC,UAAU;AACb,iBAAW,IAAI,KAAK,OAAO;AAAA,IAC7B;AAEA,WAAO;AAAA,EACT;AACF;AAKO,SAAS,mBACd,SACA,iBACA,SAA2B,OAC3B;AACA,UAAI,oBAAS,eAAe,SAAK,mBAAQ,eAAe,GAAG;AACzD,YAAQ,MAAM,EAAE,SAAS,eAAe;AAAA,EAC1C,OAAO;AACL,WAAO,MAAM,EAAE,SAAS,eAAe;AAAA,EACzC;AACF;AAKA,SAAS,eAAe,SAAsB;AAC5C,MAAI,KAAC,sBAAU,GAAG;AAChB,WAAO;AAAA,EACT;AAEA,QAAM,EAAE,mBAAmB,IAAI,OAAO,iBAAiB,OAAO;AAC9D,SAAO,CAAC,CAAC,sBAAsB,uBAAuB;AACxD;AAKA,eAAe,MAAM,SAAsB,iBAAmC;AAC5E,QAAM,MAAM,WAAW,YAAY,OAAO;AAC1C,MAAI,kBAAkB;AACtB,qBAAmB,SAAS,gBAAgB,IAAI;AAChD,YAAM,4BAAU;AAChB,qBAAmB,SAAS,gBAAgB,MAAM;AACpD;AAKA,eAAe,KAAK,SAAsB,iBAAkD;AAC1F,QAAM,gBAAgB,eAAe,OAAO;AAG5C,SAAO,IAAI,QAAQ,OAAO,YAAY;AACpC,QAAI,eAAe;AACjB,YAAM,MAAM,WAAW,YAAY,OAAO;AAC1C,UAAI,uBAAuB,MAAM,QAAQ;AACzC,cAAQ,iBAAiB,iBAAiB,IAAI,sBAAsB,KAAK;AAAA,IAC3E;AACA,uBAAmB,SAAS,gBAAgB,MAAM,QAAQ;AAC1D,uBAAmB,SAAS,gBAAgB,EAAE;AAC9C,cAAM,4BAAU;AAChB,QAAI,CAAC,eAAe;AAClB,cAAQ;AAAA,IACV;AAAA,EACF,CAAC;AACH;AAKA,SAAS,IACP,SACA,iBACA,OAA0B,UAC1B;AACA,QAAM,MAAM,WAAW,YAAY,OAAO;AAC1C,UAAQ,oBAAoB,iBAAiB,IAAI,sBAAsB,KAAK;AAC5E,MAAI,SAAS,UAAU;AACrB,uBAAmB,SAAS,gBAAgB,IAAI,QAAQ;AAAA,EAC1D;AACA,qBAAmB,SAAS,gBAAgB,QAAQ,QAAQ;AAC5D,MAAI,kBAAkB;AACtB,MAAI,uBAAuB;AAC7B;AAaA,eAAe,iBACb,SACA,MACA,UAA6B,UACd;AAEf,QAAM,sBAAkB,oBAAS,IAAI,IACjC;AAAA,IACE,MAAM,GAAG,IAAI;AAAA,IACb,QAAQ,GAAG,IAAI;AAAA,IACf,IAAI,GAAG,IAAI;AAAA,EACb,IACA;AAAA,IACE,MAAM;AAAA,IACN,QAAQ;AAAA,IACR,IAAI;AAAA,IACJ,GAAG;AAAA,EACL;AAEJ,QAAM,MAAM,WAAW,YAAY,OAAO;AAE1C,MAAI,IAAI,iBAAiB;AACvB,QAAI,SAAS,eAAe;AAAA,EAC9B;AAEA,QAAM,MAAM,SAAS,eAAe;AACpC,QAAM,KAAK,SAAS,eAAe;AACnC,MAAI,SAAS,iBAAiB,OAAO;AACrC,SAAO,QAAQ,QAAQ;AACzB;AAUA,eAAO,WACL,mBACA,MACA,UAA6B,UAC7B;AACA,QAAM,QAAQ;AAAA,QACZ,2BAAa,mBAAmB,CAAC,YAAY,iBAAiB,SAAS,MAAM,OAAO,CAAC;AAAA,EACvF;AACF;",
|
|
6
|
-
"names": []
|
|
7
|
-
}
|
package/utils/css/utils.cjs
DELETED
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
var __defProp = Object.defineProperty;
|
|
2
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
3
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
4
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
5
|
-
var __export = (target, all) => {
|
|
6
|
-
for (var name in all)
|
|
7
|
-
__defProp(target, name, { get: all[name], enumerable: true });
|
|
8
|
-
};
|
|
9
|
-
var __copyProps = (to, from, except, desc) => {
|
|
10
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
11
|
-
for (let key of __getOwnPropNames(from))
|
|
12
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
13
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
14
|
-
}
|
|
15
|
-
return to;
|
|
16
|
-
};
|
|
17
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
18
|
-
|
|
19
|
-
// packages/js-toolkit/utils/css/utils.ts
|
|
20
|
-
var utils_exports = {};
|
|
21
|
-
__export(utils_exports, {
|
|
22
|
-
eachElements: () => eachElements
|
|
23
|
-
});
|
|
24
|
-
module.exports = __toCommonJS(utils_exports);
|
|
25
|
-
function eachElements(elementOrElements, callback) {
|
|
26
|
-
if (elementOrElements instanceof Node) {
|
|
27
|
-
return [callback(elementOrElements)];
|
|
28
|
-
}
|
|
29
|
-
return Array.from(elementOrElements).map(callback);
|
|
30
|
-
}
|
|
31
|
-
if (module.exports.default) module.exports = module.exports.default;
|
|
32
|
-
//# sourceMappingURL=utils.cjs.map
|
package/utils/css/utils.cjs.map
DELETED
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../../../packages/js-toolkit/utils/css/utils.ts"],
|
|
4
|
-
"sourcesContent": ["export function eachElements<S extends Node = Node, T = void>(\n elementOrElements: S | S[] | NodeListOf<S>,\n callback: (element: S, index?: number, elements?: S[]) => T,\n): T[] {\n if (elementOrElements instanceof Node) {\n return [callback(elementOrElements)];\n }\n\n return Array.from(elementOrElements).map(callback);\n}\n"],
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAO,SAAS,aACd,mBACA,UACK;AACL,MAAI,6BAA6B,MAAM;AACrC,WAAO,CAAC,SAAS,iBAAiB,CAAC;AAAA,EACrC;AAEA,SAAO,MAAM,KAAK,iBAAiB,EAAE,IAAI,QAAQ;AACnD;",
|
|
6
|
-
"names": []
|
|
7
|
-
}
|
package/utils/debounce.cjs
DELETED
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
var __defProp = Object.defineProperty;
|
|
2
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
3
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
4
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
5
|
-
var __export = (target, all) => {
|
|
6
|
-
for (var name in all)
|
|
7
|
-
__defProp(target, name, { get: all[name], enumerable: true });
|
|
8
|
-
};
|
|
9
|
-
var __copyProps = (to, from, except, desc) => {
|
|
10
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
11
|
-
for (let key of __getOwnPropNames(from))
|
|
12
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
13
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
14
|
-
}
|
|
15
|
-
return to;
|
|
16
|
-
};
|
|
17
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
18
|
-
|
|
19
|
-
// packages/js-toolkit/utils/debounce.ts
|
|
20
|
-
var debounce_exports = {};
|
|
21
|
-
__export(debounce_exports, {
|
|
22
|
-
default: () => debounce
|
|
23
|
-
});
|
|
24
|
-
module.exports = __toCommonJS(debounce_exports);
|
|
25
|
-
function debounce(fn, delay = 300) {
|
|
26
|
-
let timeout;
|
|
27
|
-
return function debounced(...args) {
|
|
28
|
-
clearTimeout(timeout);
|
|
29
|
-
timeout = setTimeout(() => {
|
|
30
|
-
fn(...args);
|
|
31
|
-
}, delay);
|
|
32
|
-
};
|
|
33
|
-
}
|
|
34
|
-
if (module.exports.default) module.exports = module.exports.default;
|
|
35
|
-
//# sourceMappingURL=debounce.cjs.map
|
package/utils/debounce.cjs.map
DELETED
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../../packages/js-toolkit/utils/debounce.ts"],
|
|
4
|
-
"sourcesContent": ["/**\n * Returns a function, that, as long as it continues to be invoked,\n * will not be triggered. The function will be called after it stops\n * being called for N milliseconds.\n *\n * @param {(...args:unknown[]) => void} fn The function to call.\n * @param {number} [delay=300] The delay in ms to wait before calling the function.\n * @returns {(...args:unknown[]) => void} The debounced function.\n */\nexport default function debounce(\n fn: (...args: unknown[]) => void,\n delay = 300,\n): (...args: unknown[]) => void {\n let timeout;\n return function debounced(...args) {\n clearTimeout(timeout);\n timeout = setTimeout(() => {\n fn(...args);\n }, delay);\n };\n}\n"],
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AASe,SAAR,SACL,IACA,QAAQ,KACsB;AAC9B,MAAI;AACJ,SAAO,SAAS,aAAa,MAAM;AACjC,iBAAa,OAAO;AACpB,cAAU,WAAW,MAAM;AACzB,SAAG,GAAG,IAAI;AAAA,IACZ,GAAG,KAAK;AAAA,EACV;AACF;",
|
|
6
|
-
"names": []
|
|
7
|
-
}
|
package/utils/dom/ancestors.cjs
DELETED
|
@@ -1,37 +0,0 @@
|
|
|
1
|
-
var __defProp = Object.defineProperty;
|
|
2
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
3
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
4
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
5
|
-
var __export = (target, all) => {
|
|
6
|
-
for (var name in all)
|
|
7
|
-
__defProp(target, name, { get: all[name], enumerable: true });
|
|
8
|
-
};
|
|
9
|
-
var __copyProps = (to, from, except, desc) => {
|
|
10
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
11
|
-
for (let key of __getOwnPropNames(from))
|
|
12
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
13
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
14
|
-
}
|
|
15
|
-
return to;
|
|
16
|
-
};
|
|
17
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
18
|
-
|
|
19
|
-
// packages/js-toolkit/utils/dom/ancestors.ts
|
|
20
|
-
var ancestors_exports = {};
|
|
21
|
-
__export(ancestors_exports, {
|
|
22
|
-
getAncestorWhere: () => getAncestorWhere,
|
|
23
|
-
getAncestorWhereUntil: () => getAncestorWhereUntil
|
|
24
|
-
});
|
|
25
|
-
module.exports = __toCommonJS(ancestors_exports);
|
|
26
|
-
function getAncestorWhere(element, condition) {
|
|
27
|
-
if (!element) {
|
|
28
|
-
return null;
|
|
29
|
-
}
|
|
30
|
-
const ancestor = element.parentElement;
|
|
31
|
-
return condition(ancestor) ? ancestor : getAncestorWhere(ancestor, condition);
|
|
32
|
-
}
|
|
33
|
-
function getAncestorWhereUntil(element, condition, until) {
|
|
34
|
-
return getAncestorWhere(element, (el) => condition(el) || until(el));
|
|
35
|
-
}
|
|
36
|
-
if (module.exports.default) module.exports = module.exports.default;
|
|
37
|
-
//# sourceMappingURL=ancestors.cjs.map
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../../../packages/js-toolkit/utils/dom/ancestors.ts"],
|
|
4
|
-
"sourcesContent": ["/**\n * Get an ancestor matching the given condition.\n */\nexport function getAncestorWhere(element: HTMLElement, condition: (el: HTMLElement) => boolean) {\n if (!element) {\n return null;\n }\n\n const ancestor = element.parentElement;\n\n return condition(ancestor) ? ancestor : getAncestorWhere(ancestor, condition);\n}\n\n/**\n * Get an ancestor matching the given condition, stop when the until function is truthy.\n */\nexport function getAncestorWhereUntil(\n element: HTMLElement,\n condition: (el: HTMLElement) => boolean,\n until: (el: HTMLElement) => boolean,\n): HTMLElement | null {\n return getAncestorWhere(element, (el) => condition(el) || until(el));\n}\n"],
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAGO,SAAS,iBAAiB,SAAsB,WAAyC;AAC9F,MAAI,CAAC,SAAS;AACZ,WAAO;AAAA,EACT;AAEA,QAAM,WAAW,QAAQ;AAEzB,SAAO,UAAU,QAAQ,IAAI,WAAW,iBAAiB,UAAU,SAAS;AAC9E;AAKO,SAAS,sBACd,SACA,WACA,OACoB;AACpB,SAAO,iBAAiB,SAAS,CAAC,OAAO,UAAU,EAAE,KAAK,MAAM,EAAE,CAAC;AACrE;",
|
|
6
|
-
"names": []
|
|
7
|
-
}
|
package/utils/dom/index.cjs
DELETED
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
var __defProp = Object.defineProperty;
|
|
2
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
3
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
4
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
5
|
-
var __copyProps = (to, from, except, desc) => {
|
|
6
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
7
|
-
for (let key of __getOwnPropNames(from))
|
|
8
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
9
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
10
|
-
}
|
|
11
|
-
return to;
|
|
12
|
-
};
|
|
13
|
-
var __reExport = (target, mod, secondTarget) => (__copyProps(target, mod, "default"), secondTarget && __copyProps(secondTarget, mod, "default"));
|
|
14
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
15
|
-
|
|
16
|
-
// packages/js-toolkit/utils/dom/index.ts
|
|
17
|
-
var dom_exports = {};
|
|
18
|
-
module.exports = __toCommonJS(dom_exports);
|
|
19
|
-
__reExport(dom_exports, require("./ancestors.cjs"), module.exports);
|
|
20
|
-
if (module.exports.default) module.exports = module.exports.default;
|
|
21
|
-
//# sourceMappingURL=index.cjs.map
|