@studiometa/js-toolkit 2.12.0 → 3.0.0-alpha.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/Base/Base.d.ts +2 -2
- package/Base/Base.js +8 -45
- package/Base/Base.js.map +2 -2
- package/Base/features.d.ts +10 -2
- package/Base/features.js +23 -1
- package/Base/features.js.map +2 -2
- package/Base/managers/AbstractManager.d.ts +3 -3
- package/Base/managers/ActionManager.d.ts +4 -0
- package/Base/managers/ActionManager.js +10 -0
- package/Base/managers/ActionManager.js.map +7 -0
- package/Base/managers/ChildrenManager.d.ts +1 -1
- package/Base/managers/ChildrenManager.js +3 -3
- package/Base/managers/ChildrenManager.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.js +1 -1
- package/Base/utils.js.map +2 -2
- package/decorators/index.d.ts +0 -1
- package/decorators/index.js +0 -1
- package/decorators/index.js.map +2 -2
- package/decorators/withBreakpointObserver.js +1 -1
- package/decorators/withBreakpointObserver.js.map +2 -2
- package/decorators/withIntersectionObserver.js +3 -5
- package/decorators/withIntersectionObserver.js.map +2 -2
- package/decorators/withMountOnMediaQuery.js +1 -1
- package/decorators/withMountOnMediaQuery.js.map +2 -2
- package/decorators/withMountWhenInView.js +1 -1
- package/decorators/withMountWhenInView.js.map +2 -2
- 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 +2 -1
- package/helpers/createApp.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 +19 -26
- package/services/resize.js.map +2 -2
- package/services/scroll.js +8 -8
- 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 +5 -4
- package/utils/index.js +16 -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/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/{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
package/utils/dom/index.cjs.map
DELETED
package/utils/focusTrap.cjs
DELETED
|
@@ -1,93 +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/focusTrap.ts
|
|
30
|
-
var focusTrap_exports = {};
|
|
31
|
-
__export(focusTrap_exports, {
|
|
32
|
-
default: () => useFocusTrap,
|
|
33
|
-
saveActiveElement: () => saveActiveElement,
|
|
34
|
-
trap: () => trap,
|
|
35
|
-
untrap: () => untrap
|
|
36
|
-
});
|
|
37
|
-
module.exports = __toCommonJS(focusTrap_exports);
|
|
38
|
-
var import_keyCodes = __toESM(require("./keyCodes.cjs"), 1);
|
|
39
|
-
var import_is = require("./is.cjs");
|
|
40
|
-
var FOCUSABLE_ELEMENTS = [
|
|
41
|
-
'a[href]:not([tabindex^="-"]):not([inert])',
|
|
42
|
-
'area[href]:not([tabindex^="-"]):not([inert])',
|
|
43
|
-
"input:not([disabled]):not([inert])",
|
|
44
|
-
"select:not([disabled]):not([inert])",
|
|
45
|
-
"textarea:not([disabled]):not([inert])",
|
|
46
|
-
"button:not([disabled]):not([inert])",
|
|
47
|
-
'iframe:not([tabindex^="-"]):not([inert])',
|
|
48
|
-
'audio:not([tabindex^="-"]):not([inert])',
|
|
49
|
-
'video:not([tabindex^="-"]):not([inert])',
|
|
50
|
-
'[contenteditable]:not([tabindex^="-"]):not([inert])',
|
|
51
|
-
'[tabindex]:not([tabindex^="-"]):not([inert])'
|
|
52
|
-
];
|
|
53
|
-
var focusedBefore;
|
|
54
|
-
function saveActiveElement() {
|
|
55
|
-
focusedBefore = document.activeElement;
|
|
56
|
-
}
|
|
57
|
-
function trap(element, event) {
|
|
58
|
-
if (event.keyCode !== import_keyCodes.default.TAB) {
|
|
59
|
-
return;
|
|
60
|
-
}
|
|
61
|
-
if (!focusedBefore) {
|
|
62
|
-
focusedBefore = document.activeElement;
|
|
63
|
-
}
|
|
64
|
-
const focusableChildren = Array.from(
|
|
65
|
-
element.querySelectorAll(FOCUSABLE_ELEMENTS.join(", "))
|
|
66
|
-
);
|
|
67
|
-
const focusedItemIndex = document.activeElement instanceof HTMLElement ? focusableChildren.indexOf(document.activeElement) : -1;
|
|
68
|
-
if (!focusableChildren.length) {
|
|
69
|
-
return;
|
|
70
|
-
}
|
|
71
|
-
if (focusedItemIndex < 0) {
|
|
72
|
-
focusableChildren[0].focus();
|
|
73
|
-
event.preventDefault();
|
|
74
|
-
}
|
|
75
|
-
if (event.shiftKey && focusedItemIndex === 0) {
|
|
76
|
-
focusableChildren.at(-1).focus();
|
|
77
|
-
event.preventDefault();
|
|
78
|
-
} else if (!event.shiftKey && focusedItemIndex === focusableChildren.length - 1) {
|
|
79
|
-
focusableChildren[0].focus();
|
|
80
|
-
event.preventDefault();
|
|
81
|
-
}
|
|
82
|
-
}
|
|
83
|
-
function untrap() {
|
|
84
|
-
if (focusedBefore && (0, import_is.isFunction)(focusedBefore.focus)) {
|
|
85
|
-
focusedBefore.focus();
|
|
86
|
-
focusedBefore = null;
|
|
87
|
-
}
|
|
88
|
-
}
|
|
89
|
-
function useFocusTrap() {
|
|
90
|
-
return { trap, untrap, saveActiveElement };
|
|
91
|
-
}
|
|
92
|
-
if (module.exports.default) module.exports = module.exports.default;
|
|
93
|
-
//# sourceMappingURL=focusTrap.cjs.map
|
package/utils/focusTrap.cjs.map
DELETED
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../../packages/js-toolkit/utils/focusTrap.ts"],
|
|
4
|
-
"sourcesContent": ["import keyCodes from './keyCodes.js';\nimport { isFunction } from './is.js';\n\nconst FOCUSABLE_ELEMENTS = [\n 'a[href]:not([tabindex^=\"-\"]):not([inert])',\n 'area[href]:not([tabindex^=\"-\"]):not([inert])',\n 'input:not([disabled]):not([inert])',\n 'select:not([disabled]):not([inert])',\n 'textarea:not([disabled]):not([inert])',\n 'button:not([disabled]):not([inert])',\n 'iframe:not([tabindex^=\"-\"]):not([inert])',\n 'audio:not([tabindex^=\"-\"]):not([inert])',\n 'video:not([tabindex^=\"-\"]):not([inert])',\n '[contenteditable]:not([tabindex^=\"-\"]):not([inert])',\n '[tabindex]:not([tabindex^=\"-\"]):not([inert])',\n];\n\nlet focusedBefore;\n\n/**\n * Save the current active element.\n */\nexport function saveActiveElement() {\n focusedBefore = document.activeElement;\n}\n\n/**\n * Trap tab navigation inside the given element.\n *\n * @param {HTMLElement} element The element in which to trap the tabulations.\n * @param {KeyboardEvent} event The keydown or keyup event.\n */\nexport function trap(element: HTMLElement, event: KeyboardEvent) {\n if (event.keyCode !== keyCodes.TAB) {\n return;\n }\n\n // Save the previous focused element\n if (!focusedBefore) {\n focusedBefore = document.activeElement;\n }\n\n const focusableChildren: HTMLElement[] = Array.from(\n element.querySelectorAll(FOCUSABLE_ELEMENTS.join(', ')),\n );\n const focusedItemIndex =\n document.activeElement instanceof HTMLElement\n ? focusableChildren.indexOf(document.activeElement)\n : -1;\n\n if (!focusableChildren.length) {\n return;\n }\n\n if (focusedItemIndex < 0) {\n focusableChildren[0].focus();\n event.preventDefault();\n }\n\n // If the SHIFT key is being pressed while tabbing (moving backwards) and\n // the currently focused item is the first one, move the focus to the last\n // focusable item from the dialog element\n if (event.shiftKey && focusedItemIndex === 0) {\n focusableChildren.at(-1).focus();\n event.preventDefault();\n }\n\n // If the SHIFT key is not being pressed (moving forwards) and the currently\n // focused item is the last one, move the focus to the first focusable item\n // from the dialog element\n else if (!event.shiftKey && focusedItemIndex === focusableChildren.length - 1) {\n focusableChildren[0].focus();\n event.preventDefault();\n }\n}\n\n/**\n * Untrap the tab navigation.\n */\nexport function untrap() {\n if (focusedBefore && isFunction(focusedBefore.focus)) {\n focusedBefore.focus();\n focusedBefore = null;\n }\n}\n\n/**\n * Use a trap/untrap tabs logic.\n */\nexport default function useFocusTrap() {\n return { trap, untrap, saveActiveElement };\n}\n"],
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,sBAAqB;AACrB,gBAA2B;AAE3B,IAAM,qBAAqB;AAAA,EACzB;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF;AAEA,IAAI;AAKG,SAAS,oBAAoB;AAClC,kBAAgB,SAAS;AAC3B;AAQO,SAAS,KAAK,SAAsB,OAAsB;AAC/D,MAAI,MAAM,YAAY,gBAAAA,QAAS,KAAK;AAClC;AAAA,EACF;AAGA,MAAI,CAAC,eAAe;AAClB,oBAAgB,SAAS;AAAA,EAC3B;AAEA,QAAM,oBAAmC,MAAM;AAAA,IAC7C,QAAQ,iBAAiB,mBAAmB,KAAK,IAAI,CAAC;AAAA,EACxD;AACA,QAAM,mBACJ,SAAS,yBAAyB,cAC9B,kBAAkB,QAAQ,SAAS,aAAa,IAChD;AAEN,MAAI,CAAC,kBAAkB,QAAQ;AAC7B;AAAA,EACF;AAEA,MAAI,mBAAmB,GAAG;AACxB,sBAAkB,CAAC,EAAE,MAAM;AAC3B,UAAM,eAAe;AAAA,EACvB;AAKA,MAAI,MAAM,YAAY,qBAAqB,GAAG;AAC5C,sBAAkB,GAAG,EAAE,EAAE,MAAM;AAC/B,UAAM,eAAe;AAAA,EACvB,WAKS,CAAC,MAAM,YAAY,qBAAqB,kBAAkB,SAAS,GAAG;AAC7E,sBAAkB,CAAC,EAAE,MAAM;AAC3B,UAAM,eAAe;AAAA,EACvB;AACF;AAKO,SAAS,SAAS;AACvB,MAAI,qBAAiB,sBAAW,cAAc,KAAK,GAAG;AACpD,kBAAc,MAAM;AACpB,oBAAgB;AAAA,EAClB;AACF;AAKe,SAAR,eAAgC;AACrC,SAAO,EAAE,MAAM,QAAQ,kBAAkB;AAC3C;",
|
|
6
|
-
"names": ["keyCodes"]
|
|
7
|
-
}
|
package/utils/focusTrap.js.map
DELETED
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../../packages/js-toolkit/utils/focusTrap.ts"],
|
|
4
|
-
"sourcesContent": ["import keyCodes from './keyCodes.js';\nimport { isFunction } from './is.js';\n\nconst FOCUSABLE_ELEMENTS = [\n 'a[href]:not([tabindex^=\"-\"]):not([inert])',\n 'area[href]:not([tabindex^=\"-\"]):not([inert])',\n 'input:not([disabled]):not([inert])',\n 'select:not([disabled]):not([inert])',\n 'textarea:not([disabled]):not([inert])',\n 'button:not([disabled]):not([inert])',\n 'iframe:not([tabindex^=\"-\"]):not([inert])',\n 'audio:not([tabindex^=\"-\"]):not([inert])',\n 'video:not([tabindex^=\"-\"]):not([inert])',\n '[contenteditable]:not([tabindex^=\"-\"]):not([inert])',\n '[tabindex]:not([tabindex^=\"-\"]):not([inert])',\n];\n\nlet focusedBefore;\n\n/**\n * Save the current active element.\n */\nexport function saveActiveElement() {\n focusedBefore = document.activeElement;\n}\n\n/**\n * Trap tab navigation inside the given element.\n *\n * @param {HTMLElement} element The element in which to trap the tabulations.\n * @param {KeyboardEvent} event The keydown or keyup event.\n */\nexport function trap(element: HTMLElement, event: KeyboardEvent) {\n if (event.keyCode !== keyCodes.TAB) {\n return;\n }\n\n // Save the previous focused element\n if (!focusedBefore) {\n focusedBefore = document.activeElement;\n }\n\n const focusableChildren: HTMLElement[] = Array.from(\n element.querySelectorAll(FOCUSABLE_ELEMENTS.join(', ')),\n );\n const focusedItemIndex =\n document.activeElement instanceof HTMLElement\n ? focusableChildren.indexOf(document.activeElement)\n : -1;\n\n if (!focusableChildren.length) {\n return;\n }\n\n if (focusedItemIndex < 0) {\n focusableChildren[0].focus();\n event.preventDefault();\n }\n\n // If the SHIFT key is being pressed while tabbing (moving backwards) and\n // the currently focused item is the first one, move the focus to the last\n // focusable item from the dialog element\n if (event.shiftKey && focusedItemIndex === 0) {\n focusableChildren.at(-1).focus();\n event.preventDefault();\n }\n\n // If the SHIFT key is not being pressed (moving forwards) and the currently\n // focused item is the last one, move the focus to the first focusable item\n // from the dialog element\n else if (!event.shiftKey && focusedItemIndex === focusableChildren.length - 1) {\n focusableChildren[0].focus();\n event.preventDefault();\n }\n}\n\n/**\n * Untrap the tab navigation.\n */\nexport function untrap() {\n if (focusedBefore && isFunction(focusedBefore.focus)) {\n focusedBefore.focus();\n focusedBefore = null;\n }\n}\n\n/**\n * Use a trap/untrap tabs logic.\n */\nexport default function useFocusTrap() {\n return { trap, untrap, saveActiveElement };\n}\n"],
|
|
5
|
-
"mappings": "AAAA,OAAO,cAAc;AACrB,SAAS,kBAAkB;AAE3B,MAAM,qBAAqB;AAAA,EACzB;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF;AAEA,IAAI;AAKG,SAAS,oBAAoB;AAClC,kBAAgB,SAAS;AAC3B;AAQO,SAAS,KAAK,SAAsB,OAAsB;AAC/D,MAAI,MAAM,YAAY,SAAS,KAAK;AAClC;AAAA,EACF;AAGA,MAAI,CAAC,eAAe;AAClB,oBAAgB,SAAS;AAAA,EAC3B;AAEA,QAAM,oBAAmC,MAAM;AAAA,IAC7C,QAAQ,iBAAiB,mBAAmB,KAAK,IAAI,CAAC;AAAA,EACxD;AACA,QAAM,mBACJ,SAAS,yBAAyB,cAC9B,kBAAkB,QAAQ,SAAS,aAAa,IAChD;AAEN,MAAI,CAAC,kBAAkB,QAAQ;AAC7B;AAAA,EACF;AAEA,MAAI,mBAAmB,GAAG;AACxB,sBAAkB,CAAC,EAAE,MAAM;AAC3B,UAAM,eAAe;AAAA,EACvB;AAKA,MAAI,MAAM,YAAY,qBAAqB,GAAG;AAC5C,sBAAkB,GAAG,EAAE,EAAE,MAAM;AAC/B,UAAM,eAAe;AAAA,EACvB,WAKS,CAAC,MAAM,YAAY,qBAAqB,kBAAkB,SAAS,GAAG;AAC7E,sBAAkB,CAAC,EAAE,MAAM;AAC3B,UAAM,eAAe;AAAA,EACvB;AACF;AAKO,SAAS,SAAS;AACvB,MAAI,iBAAiB,WAAW,cAAc,KAAK,GAAG;AACpD,kBAAc,MAAM;AACpB,oBAAgB;AAAA,EAClB;AACF;AAKe,SAAR,eAAgC;AACrC,SAAO,EAAE,MAAM,QAAQ,kBAAkB;AAC3C;",
|
|
6
|
-
"names": []
|
|
7
|
-
}
|
|
@@ -1,38 +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/getComponentResolver.ts
|
|
20
|
-
var getComponentResolver_exports = {};
|
|
21
|
-
__export(getComponentResolver_exports, {
|
|
22
|
-
default: () => getComponentResolver
|
|
23
|
-
});
|
|
24
|
-
module.exports = __toCommonJS(getComponentResolver_exports);
|
|
25
|
-
var import_is = require("./is.cjs");
|
|
26
|
-
function getComponentResolver(fn) {
|
|
27
|
-
return (resolve, cb) => {
|
|
28
|
-
fn().then((module2) => {
|
|
29
|
-
const ResolvedClass = module2.default ?? module2;
|
|
30
|
-
resolve(ResolvedClass);
|
|
31
|
-
if ((0, import_is.isFunction)(cb)) {
|
|
32
|
-
cb();
|
|
33
|
-
}
|
|
34
|
-
});
|
|
35
|
-
};
|
|
36
|
-
}
|
|
37
|
-
if (module.exports.default) module.exports = module.exports.default;
|
|
38
|
-
//# sourceMappingURL=getComponentResolver.cjs.map
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../../packages/js-toolkit/utils/getComponentResolver.ts"],
|
|
4
|
-
"sourcesContent": ["import { isFunction } from './is.js';\n\n/**\n * Default component resolver\n *\n * @param {Function} fn\n * @returns {Function}\n */\nexport default function getComponentResolver(fn) {\n return (resolve, cb?: () => unknown) => {\n fn().then((module) => {\n const ResolvedClass = module.default ?? module;\n resolve(ResolvedClass);\n\n if (isFunction(cb)) {\n cb();\n }\n });\n };\n}\n"],
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,gBAA2B;AAQZ,SAAR,qBAAsC,IAAI;AAC/C,SAAO,CAAC,SAAS,OAAuB;AACtC,OAAG,EAAE,KAAK,CAACA,YAAW;AACpB,YAAM,gBAAgBA,QAAO,WAAWA;AACxC,cAAQ,aAAa;AAErB,cAAI,sBAAW,EAAE,GAAG;AAClB,WAAG;AAAA,MACL;AAAA,IACF,CAAC;AAAA,EACH;AACF;",
|
|
6
|
-
"names": ["module"]
|
|
7
|
-
}
|
package/utils/has.cjs
DELETED
|
@@ -1,29 +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/has.ts
|
|
20
|
-
var has_exports = {};
|
|
21
|
-
__export(has_exports, {
|
|
22
|
-
hasWindow: () => hasWindow
|
|
23
|
-
});
|
|
24
|
-
module.exports = __toCommonJS(has_exports);
|
|
25
|
-
function hasWindow() {
|
|
26
|
-
return typeof window !== "undefined";
|
|
27
|
-
}
|
|
28
|
-
if (module.exports.default) module.exports = module.exports.default;
|
|
29
|
-
//# sourceMappingURL=has.cjs.map
|
package/utils/has.cjs.map
DELETED
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../../packages/js-toolkit/utils/has.ts"],
|
|
4
|
-
"sourcesContent": ["/**\n * Test if the current context as a global `window` object available.\n */\nexport function hasWindow() {\n return typeof window !== 'undefined';\n}\n"],
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAGO,SAAS,YAAY;AAC1B,SAAO,OAAO,WAAW;AAC3B;",
|
|
6
|
-
"names": []
|
|
7
|
-
}
|
package/utils/history.cjs
DELETED
|
@@ -1,92 +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/history.ts
|
|
20
|
-
var history_exports = {};
|
|
21
|
-
__export(history_exports, {
|
|
22
|
-
objectToURLSearchParams: () => objectToURLSearchParams,
|
|
23
|
-
push: () => push,
|
|
24
|
-
replace: () => replace
|
|
25
|
-
});
|
|
26
|
-
module.exports = __toCommonJS(history_exports);
|
|
27
|
-
var import_is = require("./is.cjs");
|
|
28
|
-
var import_has = require("./has.cjs");
|
|
29
|
-
var import_string = require("./string/index.cjs");
|
|
30
|
-
function updateUrlSearchParam(params, name, value) {
|
|
31
|
-
if (value === "" || value === null || value === void 0) {
|
|
32
|
-
if (params.has(name)) {
|
|
33
|
-
params.delete(name);
|
|
34
|
-
}
|
|
35
|
-
return params;
|
|
36
|
-
}
|
|
37
|
-
if ((0, import_is.isArray)(value)) {
|
|
38
|
-
for (const [index, val] of value.entries()) {
|
|
39
|
-
const arrayName = `${name}[${index}]`;
|
|
40
|
-
updateUrlSearchParam(params, arrayName, val);
|
|
41
|
-
}
|
|
42
|
-
return params;
|
|
43
|
-
}
|
|
44
|
-
if ((0, import_is.isObject)(value)) {
|
|
45
|
-
for (const [key, val] of Object.entries(value)) {
|
|
46
|
-
const objectName = `${name}[${key}]`;
|
|
47
|
-
updateUrlSearchParam(params, objectName, val);
|
|
48
|
-
}
|
|
49
|
-
return params;
|
|
50
|
-
}
|
|
51
|
-
params.set(name, value);
|
|
52
|
-
return params;
|
|
53
|
-
}
|
|
54
|
-
function objectToURLSearchParams(obj, defaultSearch = (0, import_has.hasWindow)() ? window.location.search : "") {
|
|
55
|
-
return Object.entries(obj).reduce(
|
|
56
|
-
(urlSearchParams, [name, value]) => updateUrlSearchParam(urlSearchParams, name, value),
|
|
57
|
-
new URLSearchParams(defaultSearch)
|
|
58
|
-
);
|
|
59
|
-
}
|
|
60
|
-
function updateHistory(mode, options, data = {}, title = "") {
|
|
61
|
-
if (!window.history) {
|
|
62
|
-
return;
|
|
63
|
-
}
|
|
64
|
-
const { path, search, hash } = {
|
|
65
|
-
path: window.location.pathname,
|
|
66
|
-
search: new URLSearchParams(window.location.search),
|
|
67
|
-
hash: window.location.hash,
|
|
68
|
-
...options
|
|
69
|
-
};
|
|
70
|
-
let url = path;
|
|
71
|
-
const mergedSearch = search instanceof URLSearchParams ? search : objectToURLSearchParams(search);
|
|
72
|
-
if (mergedSearch.toString()) {
|
|
73
|
-
url += `?${mergedSearch.toString()}`;
|
|
74
|
-
}
|
|
75
|
-
if (hash) {
|
|
76
|
-
if ((0, import_string.startsWith)(hash, "#")) {
|
|
77
|
-
url += hash;
|
|
78
|
-
} else {
|
|
79
|
-
url += `#${hash}`;
|
|
80
|
-
}
|
|
81
|
-
}
|
|
82
|
-
const method = `${mode}State`;
|
|
83
|
-
window.history[method](data, title, url);
|
|
84
|
-
}
|
|
85
|
-
function push(options, data = {}, title = "") {
|
|
86
|
-
updateHistory("push", options, data, title);
|
|
87
|
-
}
|
|
88
|
-
function replace(options, data = {}, title = "") {
|
|
89
|
-
updateHistory("replace", options, data, title);
|
|
90
|
-
}
|
|
91
|
-
if (module.exports.default) module.exports = module.exports.default;
|
|
92
|
-
//# sourceMappingURL=history.cjs.map
|
package/utils/history.cjs.map
DELETED
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../../packages/js-toolkit/utils/history.ts"],
|
|
4
|
-
"sourcesContent": ["import { isArray, isObject } from './is.js';\nimport { hasWindow } from './has.js';\nimport { startsWith } from './string/index.js';\n\nexport interface HistoryOptions {\n path?: string;\n search?: URLSearchParams | { [key: string]: unknown };\n hash?: string;\n}\n\ntype SearchParamValue = string | number | boolean;\n\n/**\n * Set a param in a URLSearchParam instance.\n *\n * @param {URLSearchParams} params The params to update.\n * @param {string} name The name of the param to update.\n * @param {string|number|boolean|Array|Object} value The value for this param.\n * @returns {URLSearchParams} The updated URLSearchParams instance.\n */\nfunction updateUrlSearchParam(\n params: URLSearchParams,\n name: string,\n value: SearchParamValue | Array<SearchParamValue> | Record<string, SearchParamValue>,\n): URLSearchParams {\n if (value === '' || value === null || value === undefined) {\n if (params.has(name)) {\n params.delete(name);\n }\n return params;\n }\n\n if (isArray(value)) {\n for (const [index, val] of value.entries()) {\n const arrayName = `${name}[${index}]`;\n updateUrlSearchParam(params, arrayName, val);\n }\n return params;\n }\n\n if (isObject(value)) {\n for (const [key, val] of Object.entries(value)) {\n const objectName = `${name}[${key}]`;\n updateUrlSearchParam(params, objectName, val);\n }\n return params;\n }\n\n params.set(name, value as string);\n return params;\n}\n\n/**\n * Transform an object to an URLSearchParams instance.\n *\n * @param {Object} obj The object to convert.\n * @param {string} defaultSearch A string of defaults search params.\n * @returns {URLSearchParams}\n */\nexport function objectToURLSearchParams(\n obj: unknown,\n defaultSearch = hasWindow() ? window.location.search : '',\n): URLSearchParams {\n return Object.entries(obj).reduce(\n (urlSearchParams: URLSearchParams, [name, value]) =>\n updateUrlSearchParam(urlSearchParams, name, value),\n new URLSearchParams(defaultSearch),\n ) as URLSearchParams;\n}\n\n/**\n * Update the history with a new state.\n *\n * @param {string} mode\n * @param {HistoryOptions} options\n * @param {Object} [data]\n * @param {string} [title]\n * @returns {void}\n */\nfunction updateHistory(\n mode: 'push' | 'replace',\n options: HistoryOptions,\n data: unknown = {},\n title = '',\n) {\n if (!window.history) {\n return;\n }\n\n const { path, search, hash }: HistoryOptions = {\n path: window.location.pathname,\n search: new URLSearchParams(window.location.search),\n hash: window.location.hash,\n ...options,\n };\n\n let url = path;\n\n const mergedSearch = search instanceof URLSearchParams ? search : objectToURLSearchParams(search);\n\n if (mergedSearch.toString()) {\n url += `?${mergedSearch.toString()}`;\n }\n\n if (hash) {\n if (startsWith(hash, '#')) {\n url += hash;\n } else {\n url += `#${hash}`;\n }\n }\n\n const method = `${mode}State`;\n window.history[method](data, title, url);\n}\n\n/**\n * Push a new state.\n *\n * @param {HistoryOptions} options The new state.\n * @param {Object} [data] The data for the new state.\n * @param {string} [title] The title for the new state.\n * @returns {void}\n */\nexport function push(options: HistoryOptions, data: unknown = {}, title = '') {\n updateHistory('push', options, data, title);\n}\n\n/**\n * Replace a new state.\n *\n * @param {HistoryOptions} options The new state.\n * @param {Object} [data] The data for the new state.\n * @param {string} [title] The title for the new state.\n * @returns {void}\n */\nexport function replace(options: HistoryOptions, data: unknown = {}, title = '') {\n updateHistory('replace', options, data, title);\n}\n"],
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,gBAAkC;AAClC,iBAA0B;AAC1B,oBAA2B;AAkB3B,SAAS,qBACP,QACA,MACA,OACiB;AACjB,MAAI,UAAU,MAAM,UAAU,QAAQ,UAAU,QAAW;AACzD,QAAI,OAAO,IAAI,IAAI,GAAG;AACpB,aAAO,OAAO,IAAI;AAAA,IACpB;AACA,WAAO;AAAA,EACT;AAEA,UAAI,mBAAQ,KAAK,GAAG;AAClB,eAAW,CAAC,OAAO,GAAG,KAAK,MAAM,QAAQ,GAAG;AAC1C,YAAM,YAAY,GAAG,IAAI,IAAI,KAAK;AAClC,2BAAqB,QAAQ,WAAW,GAAG;AAAA,IAC7C;AACA,WAAO;AAAA,EACT;AAEA,UAAI,oBAAS,KAAK,GAAG;AACnB,eAAW,CAAC,KAAK,GAAG,KAAK,OAAO,QAAQ,KAAK,GAAG;AAC9C,YAAM,aAAa,GAAG,IAAI,IAAI,GAAG;AACjC,2BAAqB,QAAQ,YAAY,GAAG;AAAA,IAC9C;AACA,WAAO;AAAA,EACT;AAEA,SAAO,IAAI,MAAM,KAAe;AAChC,SAAO;AACT;AASO,SAAS,wBACd,KACA,oBAAgB,sBAAU,IAAI,OAAO,SAAS,SAAS,IACtC;AACjB,SAAO,OAAO,QAAQ,GAAG,EAAE;AAAA,IACzB,CAAC,iBAAkC,CAAC,MAAM,KAAK,MAC7C,qBAAqB,iBAAiB,MAAM,KAAK;AAAA,IACnD,IAAI,gBAAgB,aAAa;AAAA,EACnC;AACF;AAWA,SAAS,cACP,MACA,SACA,OAAgB,CAAC,GACjB,QAAQ,IACR;AACA,MAAI,CAAC,OAAO,SAAS;AACnB;AAAA,EACF;AAEA,QAAM,EAAE,MAAM,QAAQ,KAAK,IAAoB;AAAA,IAC7C,MAAM,OAAO,SAAS;AAAA,IACtB,QAAQ,IAAI,gBAAgB,OAAO,SAAS,MAAM;AAAA,IAClD,MAAM,OAAO,SAAS;AAAA,IACtB,GAAG;AAAA,EACL;AAEA,MAAI,MAAM;AAEV,QAAM,eAAe,kBAAkB,kBAAkB,SAAS,wBAAwB,MAAM;AAEhG,MAAI,aAAa,SAAS,GAAG;AAC3B,WAAO,IAAI,aAAa,SAAS,CAAC;AAAA,EACpC;AAEA,MAAI,MAAM;AACR,YAAI,0BAAW,MAAM,GAAG,GAAG;AACzB,aAAO;AAAA,IACT,OAAO;AACL,aAAO,IAAI,IAAI;AAAA,IACjB;AAAA,EACF;AAEA,QAAM,SAAS,GAAG,IAAI;AACtB,SAAO,QAAQ,MAAM,EAAE,MAAM,OAAO,GAAG;AACzC;AAUO,SAAS,KAAK,SAAyB,OAAgB,CAAC,GAAG,QAAQ,IAAI;AAC5E,gBAAc,QAAQ,SAAS,MAAM,KAAK;AAC5C;AAUO,SAAS,QAAQ,SAAyB,OAAgB,CAAC,GAAG,QAAQ,IAAI;AAC/E,gBAAc,WAAW,SAAS,MAAM,KAAK;AAC/C;",
|
|
6
|
-
"names": []
|
|
7
|
-
}
|
package/utils/index.cjs
DELETED
|
@@ -1,76 +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/index.ts
|
|
31
|
-
var utils_exports = {};
|
|
32
|
-
__export(utils_exports, {
|
|
33
|
-
Queue: () => import_Queue.Queue,
|
|
34
|
-
SmartQueue: () => import_SmartQueue.SmartQueue,
|
|
35
|
-
debounce: () => import_debounce.default,
|
|
36
|
-
focusTrap: () => import_focusTrap.default,
|
|
37
|
-
getComponentResolver: () => import_getComponentResolver.default,
|
|
38
|
-
historyPush: () => import_history.push,
|
|
39
|
-
historyReplace: () => import_history.replace,
|
|
40
|
-
keyCodes: () => import_keyCodes.default,
|
|
41
|
-
memoize: () => import_memoize.default,
|
|
42
|
-
nextFrame: () => import_nextFrame.nextFrame,
|
|
43
|
-
nextMicrotask: () => import_nextMicrotask.default,
|
|
44
|
-
nextTick: () => import_nextTick.default,
|
|
45
|
-
objectToURLSearchParams: () => import_history.objectToURLSearchParams,
|
|
46
|
-
scrollTo: () => import_scrollTo.default,
|
|
47
|
-
throttle: () => import_throttle.default,
|
|
48
|
-
tween: () => import_tween.tween
|
|
49
|
-
});
|
|
50
|
-
module.exports = __toCommonJS(utils_exports);
|
|
51
|
-
var import_debounce = __toESM(require("./debounce.cjs"), 1);
|
|
52
|
-
var import_focusTrap = __toESM(require("./focusTrap.cjs"), 1);
|
|
53
|
-
var import_keyCodes = __toESM(require("./keyCodes.cjs"), 1);
|
|
54
|
-
var import_memoize = __toESM(require("./memoize.cjs"), 1);
|
|
55
|
-
var import_nextFrame = require("./nextFrame.cjs");
|
|
56
|
-
var import_nextTick = __toESM(require("./nextTick.cjs"), 1);
|
|
57
|
-
var import_nextMicrotask = __toESM(require("./nextMicrotask.cjs"), 1);
|
|
58
|
-
var import_throttle = __toESM(require("./throttle.cjs"), 1);
|
|
59
|
-
var import_scrollTo = __toESM(require("./scrollTo.cjs"), 1);
|
|
60
|
-
var import_getComponentResolver = __toESM(require("./getComponentResolver.cjs"), 1);
|
|
61
|
-
__reExport(utils_exports, require("./is.cjs"), module.exports);
|
|
62
|
-
__reExport(utils_exports, require("./has.cjs"), module.exports);
|
|
63
|
-
__reExport(utils_exports, require("./css/index.cjs"), module.exports);
|
|
64
|
-
var import_history = require("./history.cjs");
|
|
65
|
-
__reExport(utils_exports, require("./collide/index.cjs"), module.exports);
|
|
66
|
-
__reExport(utils_exports, require("./math/index.cjs"), module.exports);
|
|
67
|
-
__reExport(utils_exports, require("./string/index.cjs"), module.exports);
|
|
68
|
-
__reExport(utils_exports, require("./scheduler.cjs"), module.exports);
|
|
69
|
-
__reExport(utils_exports, require("./noop.cjs"), module.exports);
|
|
70
|
-
var import_tween = require("./tween.cjs");
|
|
71
|
-
var import_Queue = require("./Queue.cjs");
|
|
72
|
-
var import_SmartQueue = require("./SmartQueue.cjs");
|
|
73
|
-
__reExport(utils_exports, require("./dom/index.cjs"), module.exports);
|
|
74
|
-
__reExport(utils_exports, require("./wait.cjs"), module.exports);
|
|
75
|
-
if (module.exports.default) module.exports = module.exports.default;
|
|
76
|
-
//# sourceMappingURL=index.cjs.map
|
package/utils/index.cjs.map
DELETED
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../../packages/js-toolkit/utils/index.ts"],
|
|
4
|
-
"sourcesContent": ["export { default as debounce } from './debounce.js';\nexport { default as focusTrap } from './focusTrap.js';\nexport { default as keyCodes } from './keyCodes.js';\nexport { default as memoize } from './memoize.js';\nexport { nextFrame } from './nextFrame.js';\nexport { default as nextTick } from './nextTick.js';\nexport { default as nextMicrotask } from './nextMicrotask.js';\nexport { default as throttle } from './throttle.js';\nexport { default as scrollTo } from './scrollTo.js';\nexport { default as getComponentResolver } from './getComponentResolver.js';\nexport * from './is.js';\nexport * from './has.js';\n// eslint-disable-next-line import/extensions\nexport * from './css/index.js';\nexport {\n objectToURLSearchParams,\n push as historyPush,\n replace as historyReplace,\n} from './history.js';\nexport * from './collide/index.js';\nexport * from './math/index.js';\nexport * from './string/index.js';\nexport * from './scheduler.js';\nexport * from './noop.js';\nexport { tween } from './tween.js';\nexport { Queue } from './Queue.js';\nexport { SmartQueue } from './SmartQueue.js';\nexport * from './dom/index.js';\nexport * from './wait.js';\n"],
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,sBAAoC;AACpC,uBAAqC;AACrC,sBAAoC;AACpC,qBAAmC;AACnC,uBAA0B;AAC1B,sBAAoC;AACpC,2BAAyC;AACzC,sBAAoC;AACpC,sBAAoC;AACpC,kCAAgD;AAChD,0BAAc,qBAVd;AAWA,0BAAc,sBAXd;AAaA,0BAAc,4BAbd;AAcA,qBAIO;AACP,0BAAc,gCAnBd;AAoBA,0BAAc,6BApBd;AAqBA,0BAAc,+BArBd;AAsBA,0BAAc,4BAtBd;AAuBA,0BAAc,uBAvBd;AAwBA,mBAAsB;AACtB,mBAAsB;AACtB,wBAA2B;AAC3B,0BAAc,4BA3Bd;AA4BA,0BAAc,uBA5Bd;",
|
|
6
|
-
"names": []
|
|
7
|
-
}
|
package/utils/is.cjs
DELETED
|
@@ -1,41 +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/is.ts
|
|
20
|
-
var is_exports = {};
|
|
21
|
-
__export(is_exports, {
|
|
22
|
-
isArray: () => isArray,
|
|
23
|
-
isBoolean: () => isBoolean,
|
|
24
|
-
isDefined: () => isDefined,
|
|
25
|
-
isDev: () => isDev,
|
|
26
|
-
isFunction: () => isFunction,
|
|
27
|
-
isNumber: () => isNumber,
|
|
28
|
-
isObject: () => isObject,
|
|
29
|
-
isString: () => isString
|
|
30
|
-
});
|
|
31
|
-
module.exports = __toCommonJS(is_exports);
|
|
32
|
-
var isDev = typeof __DEV__ !== "undefined" && __DEV__;
|
|
33
|
-
var isFunction = (value) => typeof value === "function";
|
|
34
|
-
var isDefined = (value) => typeof value !== "undefined";
|
|
35
|
-
var isString = (value) => typeof value === "string";
|
|
36
|
-
var isObject = (value) => typeof value === "object" && !!value && value.toString() === "[object Object]";
|
|
37
|
-
var isNumber = (value) => typeof value === "number" && !Number.isNaN(value);
|
|
38
|
-
var isBoolean = (value) => typeof value === "boolean";
|
|
39
|
-
var isArray = Array.isArray;
|
|
40
|
-
if (module.exports.default) module.exports = module.exports.default;
|
|
41
|
-
//# sourceMappingURL=is.cjs.map
|
package/utils/is.cjs.map
DELETED
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../../packages/js-toolkit/utils/is.ts"],
|
|
4
|
-
"sourcesContent": ["// eslint-disable-next-line no-undef\nexport const isDev = typeof __DEV__ !== 'undefined' && __DEV__;\n\n/**\n * Test if the given value is a function.\n */\n// eslint-disable-next-line @typescript-eslint/ban-types\nexport const isFunction = (value: unknown): value is Function => typeof value === 'function';\n\n/**\n * Test if a value is defined or not.\n */\nexport const isDefined = (value: unknown): boolean => typeof value !== 'undefined';\n\n/**\n * Test if value is a string.\n */\nexport const isString = (value: unknown): value is string => typeof value === 'string';\n\n/**\n * Test if the given value is an object.\n */\nexport const isObject = (value: unknown): boolean =>\n typeof value === 'object' && !!value && value.toString() === '[object Object]';\n\n/**\n * Test if a given value is a number.\n */\nexport const isNumber = (value: unknown): value is number =>\n typeof value === 'number' && !Number.isNaN(value);\n\n/**\n * Test if a given value is a boolean.\n */\nexport const isBoolean = (value: unknown): value is boolean => typeof value === 'boolean';\n\n// eslint-disable-next-line prefer-destructuring\nexport const isArray = Array.isArray;\n"],
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AACO,IAAM,QAAQ,OAAO,YAAY,eAAe;AAMhD,IAAM,aAAa,CAAC,UAAsC,OAAO,UAAU;AAK3E,IAAM,YAAY,CAAC,UAA4B,OAAO,UAAU;AAKhE,IAAM,WAAW,CAAC,UAAoC,OAAO,UAAU;AAKvE,IAAM,WAAW,CAAC,UACvB,OAAO,UAAU,YAAY,CAAC,CAAC,SAAS,MAAM,SAAS,MAAM;AAKxD,IAAM,WAAW,CAAC,UACvB,OAAO,UAAU,YAAY,CAAC,OAAO,MAAM,KAAK;AAK3C,IAAM,YAAY,CAAC,UAAqC,OAAO,UAAU;AAGzE,IAAM,UAAU,MAAM;",
|
|
6
|
-
"names": []
|
|
7
|
-
}
|
package/utils/keyCodes.cjs
DELETED
|
@@ -1,36 +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/keyCodes.ts
|
|
20
|
-
var keyCodes_exports = {};
|
|
21
|
-
__export(keyCodes_exports, {
|
|
22
|
-
default: () => keyCodes_default
|
|
23
|
-
});
|
|
24
|
-
module.exports = __toCommonJS(keyCodes_exports);
|
|
25
|
-
var keyCodes_default = {
|
|
26
|
-
ENTER: 13,
|
|
27
|
-
SPACE: 32,
|
|
28
|
-
TAB: 9,
|
|
29
|
-
ESC: 27,
|
|
30
|
-
LEFT: 37,
|
|
31
|
-
UP: 38,
|
|
32
|
-
RIGHT: 39,
|
|
33
|
-
DOWN: 40
|
|
34
|
-
};
|
|
35
|
-
if (module.exports.default) module.exports = module.exports.default;
|
|
36
|
-
//# sourceMappingURL=keyCodes.cjs.map
|
package/utils/keyCodes.cjs.map
DELETED
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../../packages/js-toolkit/utils/keyCodes.ts"],
|
|
4
|
-
"sourcesContent": ["export default {\n ENTER: 13,\n SPACE: 32,\n TAB: 9,\n ESC: 27,\n LEFT: 37,\n UP: 38,\n RIGHT: 39,\n DOWN: 40,\n} as const;\n"],
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,IAAO,mBAAQ;AAAA,EACb,OAAO;AAAA,EACP,OAAO;AAAA,EACP,KAAK;AAAA,EACL,KAAK;AAAA,EACL,MAAM;AAAA,EACN,IAAI;AAAA,EACJ,OAAO;AAAA,EACP,MAAM;AACR;",
|
|
6
|
-
"names": []
|
|
7
|
-
}
|
package/utils/math/clamp.cjs
DELETED
|
@@ -1,29 +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/math/clamp.ts
|
|
20
|
-
var clamp_exports = {};
|
|
21
|
-
__export(clamp_exports, {
|
|
22
|
-
default: () => clamp
|
|
23
|
-
});
|
|
24
|
-
module.exports = __toCommonJS(clamp_exports);
|
|
25
|
-
function clamp(value, min, max) {
|
|
26
|
-
return min < max ? value < min ? min : value > max ? max : value : value < max ? max : value > min ? min : value;
|
|
27
|
-
}
|
|
28
|
-
if (module.exports.default) module.exports = module.exports.default;
|
|
29
|
-
//# sourceMappingURL=clamp.cjs.map
|
package/utils/math/clamp.cjs.map
DELETED
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../../../packages/js-toolkit/utils/math/clamp.ts"],
|
|
4
|
-
"sourcesContent": ["/**\n * Clamp a value in a given range.\n *\n * @param {number} value\n * @param {number} min\n * @param {number} max\n * @returns {number}\n */\nexport default function clamp(value: number, min: number, max: number) {\n /* eslint-disable no-nested-ternary */\n return min < max\n ? value < min\n ? min\n : value > max\n ? max\n : value\n : value < max\n ? max\n : value > min\n ? min\n : value;\n /* eslint-enable no-nested-ternary */\n}\n"],
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAQe,SAAR,MAAuB,OAAe,KAAa,KAAa;AAErE,SAAO,MAAM,MACT,QAAQ,MACN,MACA,QAAQ,MACR,MACA,QACF,QAAQ,MACR,MACA,QAAQ,MACR,MACA;AAEN;",
|
|
6
|
-
"names": []
|
|
7
|
-
}
|
package/utils/math/clamp01.cjs
DELETED
|
@@ -1,40 +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/math/clamp01.ts
|
|
30
|
-
var clamp01_exports = {};
|
|
31
|
-
__export(clamp01_exports, {
|
|
32
|
-
default: () => clamp01
|
|
33
|
-
});
|
|
34
|
-
module.exports = __toCommonJS(clamp01_exports);
|
|
35
|
-
var import_clamp = __toESM(require("./clamp.cjs"), 1);
|
|
36
|
-
function clamp01(value) {
|
|
37
|
-
return (0, import_clamp.default)(value, 0, 1);
|
|
38
|
-
}
|
|
39
|
-
if (module.exports.default) module.exports = module.exports.default;
|
|
40
|
-
//# sourceMappingURL=clamp01.cjs.map
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../../../packages/js-toolkit/utils/math/clamp01.ts"],
|
|
4
|
-
"sourcesContent": ["import clamp from './clamp.js';\n\n/**\n * Clamp a value in the 0\u20131 range.\n *\n * @param {number} value\n * @returns {number}\n */\nexport default function clamp01(value: number) {\n return clamp(value, 0, 1);\n}\n"],
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,mBAAkB;AAQH,SAAR,QAAyB,OAAe;AAC7C,aAAO,aAAAA,SAAM,OAAO,GAAG,CAAC;AAC1B;",
|
|
6
|
-
"names": ["clamp"]
|
|
7
|
-
}
|
|
@@ -1,33 +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/math/createEases.ts
|
|
20
|
-
var createEases_exports = {};
|
|
21
|
-
__export(createEases_exports, {
|
|
22
|
-
createEaseInOut: () => createEaseInOut,
|
|
23
|
-
createEaseOut: () => createEaseOut
|
|
24
|
-
});
|
|
25
|
-
module.exports = __toCommonJS(createEases_exports);
|
|
26
|
-
function createEaseOut(easeIn) {
|
|
27
|
-
return (progress) => 1 - easeIn(1 - progress);
|
|
28
|
-
}
|
|
29
|
-
function createEaseInOut(easeIn) {
|
|
30
|
-
return (progress) => progress === 0 ? 0 : progress === 1 ? 1 : progress < 0.5 ? easeIn(progress * 2) / 2 : 1 - easeIn((1 - progress) * 2) / 2;
|
|
31
|
-
}
|
|
32
|
-
if (module.exports.default) module.exports = module.exports.default;
|
|
33
|
-
//# sourceMappingURL=createEases.cjs.map
|