@studiometa/js-toolkit 2.11.2 → 3.0.0-alpha.1
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 +142 -79
- 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/AbstractManager.js +21 -0
- package/Base/managers/AbstractManager.js.map +1 -1
- 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 +41 -8
- package/Base/managers/ChildrenManager.js.map +2 -2
- package/Base/managers/EventsManager.js +88 -7
- package/Base/managers/EventsManager.js.map +2 -2
- package/Base/managers/OptionsManager.js +25 -2
- package/Base/managers/OptionsManager.js.map +2 -2
- package/Base/managers/RefsManager.js +27 -6
- package/Base/managers/RefsManager.js.map +2 -2
- package/Base/managers/ResponsiveOptionsManager.js +22 -6
- package/Base/managers/ResponsiveOptionsManager.js.map +2 -2
- package/Base/managers/ServicesManager.d.ts +2 -4
- package/Base/managers/ServicesManager.js +56 -7
- package/Base/managers/ServicesManager.js.map +2 -2
- package/Base/utils.js +5 -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/withBreakpointManager.js +14 -4
- package/decorators/withBreakpointManager.js.map +2 -2
- package/decorators/withBreakpointObserver.js +13 -3
- package/decorators/withBreakpointObserver.js.map +2 -2
- package/decorators/withDrag.js +6 -0
- package/decorators/withDrag.js.map +1 -1
- package/decorators/withExtraConfig.js +3 -0
- package/decorators/withExtraConfig.js.map +1 -1
- package/decorators/withFreezedOptions.js +8 -0
- package/decorators/withFreezedOptions.js.map +1 -1
- package/decorators/withIntersectionObserver.js +10 -1
- package/decorators/withIntersectionObserver.js.map +2 -2
- package/decorators/withMountOnMediaQuery.js +17 -1
- package/decorators/withMountOnMediaQuery.js.map +2 -2
- package/decorators/withMountWhenInView.js +22 -1
- package/decorators/withMountWhenInView.js.map +2 -2
- package/decorators/withRelativePointer.js +6 -0
- package/decorators/withRelativePointer.js.map +1 -1
- package/decorators/withResponsiveOptions.js +3 -0
- package/decorators/withResponsiveOptions.js.map +1 -1
- package/decorators/withScrolledInView/utils.d.ts +12 -1
- package/decorators/withScrolledInView/utils.js +7 -7
- package/decorators/withScrolledInView/utils.js.map +2 -2
- package/decorators/withScrolledInView/withScrolledInView.js +13 -35
- package/decorators/withScrolledInView/withScrolledInView.js.map +2 -2
- package/helpers/createApp.d.ts +2 -1
- package/helpers/createApp.js +2 -2
- package/helpers/createApp.js.map +2 -2
- package/helpers/getDirectChildren.js.map +1 -1
- package/helpers/importOnInteraction.js +4 -4
- package/helpers/importOnInteraction.js.map +2 -2
- package/helpers/importWhenVisible.js +2 -1
- package/helpers/importWhenVisible.js.map +2 -2
- package/package.json +2 -10
- package/services/drag.js +8 -8
- package/services/drag.js.map +2 -2
- package/services/index.d.ts +1 -1
- package/services/index.js.map +2 -2
- package/services/key.js +2 -2
- package/services/key.js.map +2 -2
- package/services/load.js +3 -0
- package/services/load.js.map +1 -1
- package/services/pointer.d.ts +1 -1
- package/services/pointer.js +7 -7
- package/services/pointer.js.map +2 -2
- package/services/raf.js +4 -6
- 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/services/service.js +2 -2
- package/services/service.js.map +2 -2
- package/utils/Queue.js +30 -0
- package/utils/Queue.js.map +1 -1
- package/utils/SmartQueue.d.ts +1 -1
- package/utils/SmartQueue.js +13 -1
- package/utils/SmartQueue.js.map +2 -2
- package/utils/collide/collidePointRect.js +4 -1
- package/utils/collide/collidePointRect.js.map +1 -1
- package/utils/collide/collideRectRect.js +4 -1
- package/utils/collide/collideRectRect.js.map +1 -1
- package/utils/css/animate.d.ts +33 -15
- package/utils/css/animate.js +80 -34
- package/utils/css/animate.js.map +2 -2
- package/utils/css/classes.js +2 -3
- package/utils/css/classes.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/styles.js +2 -2
- package/utils/css/styles.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/transition.js +15 -0
- package/utils/css/transition.js.map +1 -1
- 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/history.js +6 -5
- package/utils/history.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/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 +4 -3
- package/utils/math/index.js +5 -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/scheduler.js +4 -4
- package/utils/scheduler.js.map +2 -2
- package/utils/scrollTo.d.ts +30 -6
- package/utils/scrollTo.js +97 -43
- package/utils/scrollTo.js.map +2 -2
- package/utils/string/endsWith.d.ts +8 -0
- package/utils/string/endsWith.js +13 -0
- package/utils/string/endsWith.js.map +7 -0
- package/utils/string/index.d.ts +2 -0
- package/utils/string/index.js +2 -0
- package/utils/string/index.js.map +2 -2
- package/utils/string/startsWith.d.ts +8 -0
- package/utils/string/startsWith.js +13 -0
- package/utils/string/startsWith.js.map +7 -0
- package/utils/string/withLeadingCharacters.js.map +1 -1
- package/utils/string/withTrailingCharacters.js.map +1 -1
- package/utils/string/withoutLeadingCharacters.js.map +1 -1
- package/utils/string/withoutLeadingCharactersRecursive.js.map +1 -1
- package/utils/string/withoutTrailingCharacters.js.map +1 -1
- package/utils/string/withoutTrailingCharactersRecursive.js.map +1 -1
- 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 -325
- 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 -57
- package/Base/managers/AbstractManager.cjs.map +0 -7
- package/Base/managers/ChildrenManager.cjs +0 -123
- package/Base/managers/ChildrenManager.cjs.map +0 -7
- package/Base/managers/EventsManager.cjs +0 -220
- package/Base/managers/EventsManager.cjs.map +0 -7
- package/Base/managers/OptionsManager.cjs +0 -171
- package/Base/managers/OptionsManager.cjs.map +0 -7
- package/Base/managers/RefsManager.cjs +0 -104
- package/Base/managers/RefsManager.cjs.map +0 -7
- package/Base/managers/ResponsiveOptionsManager.cjs +0 -63
- package/Base/managers/ResponsiveOptionsManager.cjs.map +0 -7
- package/Base/managers/ServicesManager.cjs +0 -111
- 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 -91
- 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 -92
- package/decorators/withBreakpointManager.cjs.map +0 -7
- package/decorators/withBreakpointObserver.cjs +0 -118
- package/decorators/withBreakpointObserver.cjs.map +0 -7
- package/decorators/withDrag.cjs +0 -50
- package/decorators/withDrag.cjs.map +0 -7
- package/decorators/withExtraConfig.cjs +0 -43
- package/decorators/withExtraConfig.cjs.map +0 -7
- package/decorators/withFreezedOptions.cjs +0 -42
- package/decorators/withFreezedOptions.cjs.map +0 -7
- package/decorators/withIntersectionObserver.cjs +0 -62
- package/decorators/withIntersectionObserver.cjs.map +0 -7
- package/decorators/withMountOnMediaQuery.cjs +0 -70
- package/decorators/withMountOnMediaQuery.cjs.map +0 -7
- package/decorators/withMountWhenInView.cjs +0 -71
- 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 -50
- package/decorators/withRelativePointer.cjs.map +0 -7
- package/decorators/withResponsiveOptions.cjs +0 -38
- 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 -216
- package/decorators/withScrolledInView/withScrolledInView.cjs.map +0 -7
- package/decorators/withVue2.cjs +0 -65
- package/decorators/withVue2.cjs.map +0 -7
- package/decorators/withVue2.d.ts +0 -16
- package/decorators/withVue2.js +0 -43
- 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 -41
- 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 -36
- package/helpers/importWhenPrefersMotion.cjs.map +0 -7
- package/helpers/importWhenVisible.cjs +0 -43
- package/helpers/importWhenVisible.cjs.map +0 -7
- package/helpers/index.cjs +0 -49
- 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 -227
- package/services/drag.cjs.map +0 -7
- package/services/index.cjs +0 -47
- package/services/index.cjs.map +0 -7
- package/services/key.cjs +0 -93
- package/services/key.cjs.map +0 -7
- package/services/load.cjs +0 -57
- 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 -103
- package/services/resize.cjs.map +0 -7
- package/services/scroll.cjs +0 -115
- 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 -63
- package/utils/Queue.cjs.map +0 -7
- package/utils/SmartQueue.cjs +0 -57
- 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 -29
- package/utils/collide/collidePointRect.cjs.map +0 -7
- package/utils/collide/collideRectRect.cjs +0 -29
- package/utils/collide/collideRectRect.cjs.map +0 -7
- package/utils/collide/index.cjs +0 -43
- package/utils/collide/index.cjs.map +0 -7
- package/utils/css/animate.cjs +0 -193
- package/utils/css/animate.cjs.map +0 -7
- package/utils/css/classes.cjs +0 -52
- 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 -48
- 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 -126
- 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 -89
- 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 -91
- package/utils/history.cjs.map +0 -7
- package/utils/index.cjs +0 -72
- 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 -36
- 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 -50
- package/utils/math/index.cjs.map +0 -7
- package/utils/math/inertiaFinalValue.cjs +0 -43
- 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 -54
- package/utils/object/autoBind.cjs.map +0 -7
- package/utils/object/autoBind.d.ts +0 -14
- package/utils/object/autoBind.js +0 -26
- 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 -35
- 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 -84
- package/utils/scrollTo.cjs.map +0 -7
- package/utils/string/index.cjs +0 -51
- package/utils/string/index.cjs.map +0 -7
- package/utils/string/withLeadingCharacters.cjs +0 -36
- package/utils/string/withLeadingCharacters.cjs.map +0 -7
- package/utils/string/withLeadingSlash.cjs +0 -36
- package/utils/string/withLeadingSlash.cjs.map +0 -7
- package/utils/string/withTrailingCharacters.cjs +0 -36
- package/utils/string/withTrailingCharacters.cjs.map +0 -7
- package/utils/string/withTrailingSlash.cjs +0 -36
- 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 -41
- package/utils/string/withoutLeadingCharactersRecursive.cjs.map +0 -7
- package/utils/string/withoutLeadingSlash.cjs +0 -36
- 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 -41
- package/utils/string/withoutTrailingCharactersRecursive.cjs.map +0 -7
- package/utils/string/withoutTrailingSlash.cjs +0 -36
- 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 -118
- package/utils/tween.cjs.map +0 -7
- package/utils/wait.cjs +0 -31
- package/utils/wait.cjs.map +0 -7
package/Base/utils.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/Base/utils.ts
|
|
20
|
-
var utils_exports = {};
|
|
21
|
-
__export(utils_exports, {
|
|
22
|
-
addToQueue: () => addToQueue,
|
|
23
|
-
eventIsDefinedInConfig: () => eventIsDefinedInConfig,
|
|
24
|
-
eventIsNative: () => eventIsNative,
|
|
25
|
-
getComponentElements: () => getComponentElements,
|
|
26
|
-
getEventTarget: () => getEventTarget
|
|
27
|
-
});
|
|
28
|
-
module.exports = __toCommonJS(utils_exports);
|
|
29
|
-
var import_utils = require("../utils/index.cjs");
|
|
30
|
-
var import_features = require("./features.cjs");
|
|
31
|
-
var queue;
|
|
32
|
-
function addToQueue(fn) {
|
|
33
|
-
if (!import_features.features.get("asyncChildren")) {
|
|
34
|
-
fn();
|
|
35
|
-
return;
|
|
36
|
-
}
|
|
37
|
-
if (!queue) {
|
|
38
|
-
queue = new import_utils.SmartQueue();
|
|
39
|
-
}
|
|
40
|
-
queue.add(fn);
|
|
41
|
-
}
|
|
42
|
-
var selectors = /* @__PURE__ */ new Map();
|
|
43
|
-
var separator = " ";
|
|
44
|
-
function getSelector(nameOrSelector) {
|
|
45
|
-
if (!selectors.has(nameOrSelector)) {
|
|
46
|
-
const parts = [
|
|
47
|
-
`[data-component="${nameOrSelector}"]`,
|
|
48
|
-
`[data-component*="${separator}${nameOrSelector}${separator}"]`,
|
|
49
|
-
`[data-component$="${separator}${nameOrSelector}"]`,
|
|
50
|
-
`[data-component^="${nameOrSelector}${separator}"]`
|
|
51
|
-
];
|
|
52
|
-
selectors.set(nameOrSelector, parts.join(","));
|
|
53
|
-
}
|
|
54
|
-
return selectors.get(nameOrSelector);
|
|
55
|
-
}
|
|
56
|
-
function getComponentElements(nameOrSelector, element = document) {
|
|
57
|
-
const selector = getSelector(nameOrSelector);
|
|
58
|
-
let elements = [];
|
|
59
|
-
try {
|
|
60
|
-
elements = Array.from(element.querySelectorAll(selector));
|
|
61
|
-
} catch {
|
|
62
|
-
}
|
|
63
|
-
if (elements.length === 0) {
|
|
64
|
-
elements = Array.from(element.querySelectorAll(nameOrSelector));
|
|
65
|
-
}
|
|
66
|
-
return elements;
|
|
67
|
-
}
|
|
68
|
-
function eventIsDefinedInConfig(event, config) {
|
|
69
|
-
return (0, import_utils.isArray)(config.emits) && config.emits.includes(event);
|
|
70
|
-
}
|
|
71
|
-
function eventIsNative(event, element) {
|
|
72
|
-
return (0, import_utils.isDefined)(element[`on${event}`]);
|
|
73
|
-
}
|
|
74
|
-
function getEventTarget(instance, event, config) {
|
|
75
|
-
if (eventIsDefinedInConfig(event, config)) {
|
|
76
|
-
return instance;
|
|
77
|
-
}
|
|
78
|
-
if (eventIsNative(event, instance.$el)) {
|
|
79
|
-
return instance.$el;
|
|
80
|
-
}
|
|
81
|
-
if (import_utils.isDev) {
|
|
82
|
-
console.warn(
|
|
83
|
-
`[${config.name}]`,
|
|
84
|
-
`The "${event}" event is missing from the configuration and is not a native`,
|
|
85
|
-
`event for the root element of type \`${instance.$el.constructor.name}\`.`
|
|
86
|
-
);
|
|
87
|
-
}
|
|
88
|
-
return instance;
|
|
89
|
-
}
|
|
90
|
-
if (module.exports.default) module.exports = module.exports.default;
|
|
91
|
-
//# sourceMappingURL=utils.cjs.map
|
package/Base/utils.cjs.map
DELETED
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../../packages/js-toolkit/Base/utils.ts"],
|
|
4
|
-
"sourcesContent": ["import { isArray, isDefined, isDev, SmartQueue } from '../utils/index.js';\nimport type { Base, BaseConfig } from './index.js';\nimport { features } from './features.js';\n\nlet queue: SmartQueue;\n\n/**\n * Add a task to the main queue.\n */\nexport function addToQueue(fn: () => unknown): void {\n if (!features.get('asyncChildren')) {\n fn();\n return;\n }\n\n if (!queue) {\n queue = new SmartQueue();\n }\n\n queue.add(fn);\n}\n\nconst selectors = new Map();\n\n// Separator used for multi-component declaration in `data-component` attributeS.\nconst separator = ' ';\n\n/**\n * Get the selector for a given component.\n */\nfunction getSelector(nameOrSelector: string): string {\n if (!selectors.has(nameOrSelector)) {\n const parts = [\n // Single selector\n `[data-component=\"${nameOrSelector}\"]`,\n // Selector in the middle of a list of selectors\n `[data-component*=\"${separator}${nameOrSelector}${separator}\"]`,\n // Selector at the end of a list of selectors\n `[data-component$=\"${separator}${nameOrSelector}\"]`,\n // Selector at the beginning of a list of selectors\n `[data-component^=\"${nameOrSelector}${separator}\"]`,\n ];\n selectors.set(nameOrSelector, parts.join(','));\n }\n\n return selectors.get(nameOrSelector);\n}\n\n/**\n * Get a list of elements based on the name of a component.\n *\n * @param {string} nameOrSelector\n * The name or selector to used for this component.\n * @param {HTMLElement|Document} element\n * The root element on which to query the selector, defaults to `document`.\n * @returns {Array<HTMLElement>}\n * A list of elements on which the component should be mounted.\n */\nexport function getComponentElements(\n nameOrSelector: string,\n element: HTMLElement | Document = document,\n): HTMLElement[] {\n const selector = getSelector(nameOrSelector);\n let elements = [];\n\n try {\n elements = Array.from(element.querySelectorAll(selector));\n // eslint-disable-next-line no-empty\n } catch {}\n\n // If no child component found with the default selector, try a classic DOM selector\n if (elements.length === 0) {\n elements = Array.from(element.querySelectorAll(nameOrSelector));\n }\n\n return elements;\n}\n\n/**\n * Test if an event is defined in the given config.\n */\nexport function eventIsDefinedInConfig(event: string, config: BaseConfig): boolean {\n return isArray(config.emits) && config.emits.includes(event);\n}\n\n/**\n * Test if an event can be used on the given element.\n */\nexport function eventIsNative(event: string, element: HTMLElement): boolean {\n return isDefined(element[`on${event}`]);\n}\n\n/**\n * Get the target of a given event.\n *\n * @todo Return false in v3 if event is not defined or not native to prevent adding a listener.\n */\nexport function getEventTarget(\n instance: Base,\n event: string,\n config: BaseConfig,\n): Base | Base['$el'] {\n if (eventIsDefinedInConfig(event, config)) {\n return instance;\n }\n\n if (eventIsNative(event, instance.$el)) {\n return instance.$el;\n }\n\n if (isDev) {\n console.warn(\n `[${config.name}]`,\n `The \"${event}\" event is missing from the configuration and is not a native`,\n `event for the root element of type \\`${instance.$el.constructor.name}\\`.`,\n );\n }\n\n // @todo v3 return false or null\n return instance;\n}\n"],
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,mBAAsD;AAEtD,sBAAyB;AAEzB,IAAI;AAKG,SAAS,WAAW,IAAyB;AAClD,MAAI,CAAC,yBAAS,IAAI,eAAe,GAAG;AAClC,OAAG;AACH;AAAA,EACF;AAEA,MAAI,CAAC,OAAO;AACV,YAAQ,IAAI,wBAAW;AAAA,EACzB;AAEA,QAAM,IAAI,EAAE;AACd;AAEA,IAAM,YAAY,oBAAI,IAAI;AAG1B,IAAM,YAAY;AAKlB,SAAS,YAAY,gBAAgC;AACnD,MAAI,CAAC,UAAU,IAAI,cAAc,GAAG;AAClC,UAAM,QAAQ;AAAA,MAEZ,oBAAoB;AAAA,MAEpB,qBAAqB,YAAY,iBAAiB;AAAA,MAElD,qBAAqB,YAAY;AAAA,MAEjC,qBAAqB,iBAAiB;AAAA,IACxC;AACA,cAAU,IAAI,gBAAgB,MAAM,KAAK,GAAG,CAAC;AAAA,EAC/C;AAEA,SAAO,UAAU,IAAI,cAAc;AACrC;AAYO,SAAS,qBACd,gBACA,UAAkC,UACnB;AACf,QAAM,WAAW,YAAY,cAAc;AAC3C,MAAI,WAAW,CAAC;AAEhB,MAAI;AACF,eAAW,MAAM,KAAK,QAAQ,iBAAiB,QAAQ,CAAC;AAAA,EAE1D,QAAE;AAAA,EAAO;AAGT,MAAI,SAAS,WAAW,GAAG;AACzB,eAAW,MAAM,KAAK,QAAQ,iBAAiB,cAAc,CAAC;AAAA,EAChE;AAEA,SAAO;AACT;AAKO,SAAS,uBAAuB,OAAe,QAA6B;AACjF,aAAO,sBAAQ,OAAO,KAAK,KAAK,OAAO,MAAM,SAAS,KAAK;AAC7D;AAKO,SAAS,cAAc,OAAe,SAA+B;AAC1E,aAAO,wBAAU,QAAQ,KAAK,QAAQ;AACxC;AAOO,SAAS,eACd,UACA,OACA,QACoB;AACpB,MAAI,uBAAuB,OAAO,MAAM,GAAG;AACzC,WAAO;AAAA,EACT;AAEA,MAAI,cAAc,OAAO,SAAS,GAAG,GAAG;AACtC,WAAO,SAAS;AAAA,EAClB;AAEA,MAAI,oBAAO;AACT,YAAQ;AAAA,MACN,IAAI,OAAO;AAAA,MACX,QAAQ;AAAA,MACR,wCAAwC,SAAS,IAAI,YAAY;AAAA,IACnE;AAAA,EACF;AAGA,SAAO;AACT;",
|
|
6
|
-
"names": []
|
|
7
|
-
}
|
package/decorators/index.cjs
DELETED
|
@@ -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 __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/decorators/index.ts
|
|
17
|
-
var decorators_exports = {};
|
|
18
|
-
module.exports = __toCommonJS(decorators_exports);
|
|
19
|
-
__reExport(decorators_exports, require("./withBreakpointManager.cjs"), module.exports);
|
|
20
|
-
__reExport(decorators_exports, require("./withBreakpointObserver.cjs"), module.exports);
|
|
21
|
-
__reExport(decorators_exports, require("./withDrag.cjs"), module.exports);
|
|
22
|
-
__reExport(decorators_exports, require("./withExtraConfig.cjs"), module.exports);
|
|
23
|
-
__reExport(decorators_exports, require("./withFreezedOptions.cjs"), module.exports);
|
|
24
|
-
__reExport(decorators_exports, require("./withIntersectionObserver.cjs"), module.exports);
|
|
25
|
-
__reExport(decorators_exports, require("./withMountOnMediaQuery.cjs"), module.exports);
|
|
26
|
-
__reExport(decorators_exports, require("./withMountWhenInView.cjs"), module.exports);
|
|
27
|
-
__reExport(decorators_exports, require("./withMountWhenPrefersMotion.cjs"), module.exports);
|
|
28
|
-
__reExport(decorators_exports, require("./withRelativePointer.cjs"), module.exports);
|
|
29
|
-
__reExport(decorators_exports, require("./withResponsiveOptions.cjs"), module.exports);
|
|
30
|
-
__reExport(decorators_exports, require("./withScrolledInView/index.cjs"), module.exports);
|
|
31
|
-
__reExport(decorators_exports, require("./withVue2.cjs"), module.exports);
|
|
32
|
-
if (module.exports.default) module.exports = module.exports.default;
|
|
33
|
-
//# sourceMappingURL=index.cjs.map
|
package/decorators/index.cjs.map
DELETED
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../../packages/js-toolkit/decorators/index.ts"],
|
|
4
|
-
"sourcesContent": ["export * from './withBreakpointManager.js';\nexport * from './withBreakpointObserver.js';\nexport * from './withDrag.js';\nexport * from './withExtraConfig.js';\nexport * from './withFreezedOptions.js';\nexport * from './withIntersectionObserver.js';\nexport * from './withMountOnMediaQuery.js';\nexport * from './withMountWhenInView.js';\nexport * from './withMountWhenPrefersMotion.js';\nexport * from './withRelativePointer.js';\nexport * from './withResponsiveOptions.js';\nexport * from './withScrolledInView/index.js';\nexport * from './withVue2.js';\n"],
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;AAAA;AAAA;AAAA,+BAAc,wCAAd;AACA,+BAAc,yCADd;AAEA,+BAAc,2BAFd;AAGA,+BAAc,kCAHd;AAIA,+BAAc,qCAJd;AAKA,+BAAc,2CALd;AAMA,+BAAc,wCANd;AAOA,+BAAc,sCAPd;AAQA,+BAAc,6CARd;AASA,+BAAc,sCATd;AAUA,+BAAc,wCAVd;AAWA,+BAAc,2CAXd;AAYA,+BAAc,2BAZd;",
|
|
6
|
-
"names": []
|
|
7
|
-
}
|
|
@@ -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/decorators/withBreakpointManager.ts
|
|
20
|
-
var withBreakpointManager_exports = {};
|
|
21
|
-
__export(withBreakpointManager_exports, {
|
|
22
|
-
withBreakpointManager: () => withBreakpointManager
|
|
23
|
-
});
|
|
24
|
-
module.exports = __toCommonJS(withBreakpointManager_exports);
|
|
25
|
-
var import_services = require("../services/index.cjs");
|
|
26
|
-
var import_utils = require("../utils/index.cjs");
|
|
27
|
-
function testBreakpoints(breakpoints) {
|
|
28
|
-
const { breakpoint } = (0, import_services.useResize)().props();
|
|
29
|
-
breakpoints.forEach(([breakpointKeys, instance]) => {
|
|
30
|
-
if (breakpointKeys.includes(breakpoint) && !instance.$isMounted) {
|
|
31
|
-
setTimeout(() => instance.$mount(), 0);
|
|
32
|
-
} else if (!breakpointKeys.includes(breakpoint) && instance.$isMounted) {
|
|
33
|
-
instance.$destroy();
|
|
34
|
-
}
|
|
35
|
-
});
|
|
36
|
-
}
|
|
37
|
-
function mountComponents(instance, breakpoints) {
|
|
38
|
-
return breakpoints.map(([bk, ComponentClass]) => {
|
|
39
|
-
const child = new ComponentClass(instance.$el);
|
|
40
|
-
Object.defineProperty(child, "$parent", { get: () => instance.$parent });
|
|
41
|
-
return [bk.split(" "), child];
|
|
42
|
-
});
|
|
43
|
-
}
|
|
44
|
-
var instances = /* @__PURE__ */ new WeakMap();
|
|
45
|
-
function withBreakpointManager(BaseClass, breakpoints) {
|
|
46
|
-
if (!(0, import_utils.isArray)(breakpoints)) {
|
|
47
|
-
if (import_utils.isDev) {
|
|
48
|
-
throw new Error("[withBreakpointManager] The `breakpoints` parameter must be an array.");
|
|
49
|
-
}
|
|
50
|
-
return BaseClass;
|
|
51
|
-
}
|
|
52
|
-
if (breakpoints.length < 2) {
|
|
53
|
-
if (import_utils.isDev) {
|
|
54
|
-
throw new Error("[withBreakpointManager] You must define at least 2 breakpoints.");
|
|
55
|
-
}
|
|
56
|
-
return BaseClass;
|
|
57
|
-
}
|
|
58
|
-
const { add, props } = (0, import_services.useResize)();
|
|
59
|
-
if (!props().breakpoint) {
|
|
60
|
-
if (import_utils.isDev) {
|
|
61
|
-
throw new Error("The `BreakpointManager` class requires breakpoints to be defined.");
|
|
62
|
-
}
|
|
63
|
-
return BaseClass;
|
|
64
|
-
}
|
|
65
|
-
class WithBreakpointManager extends BaseClass {
|
|
66
|
-
constructor(element) {
|
|
67
|
-
super(element);
|
|
68
|
-
if (!instances.has(this)) {
|
|
69
|
-
instances.set(this, mountComponents(this, breakpoints));
|
|
70
|
-
}
|
|
71
|
-
add(`BreakpointManager-${this.$id}`, () => {
|
|
72
|
-
testBreakpoints(instances.get(this));
|
|
73
|
-
});
|
|
74
|
-
}
|
|
75
|
-
$mount() {
|
|
76
|
-
super.$mount();
|
|
77
|
-
testBreakpoints(instances.get(this));
|
|
78
|
-
return this;
|
|
79
|
-
}
|
|
80
|
-
$destroy() {
|
|
81
|
-
if ((0, import_utils.isArray)(instances.get(this))) {
|
|
82
|
-
instances.get(this).forEach(([, instance]) => {
|
|
83
|
-
instance.$destroy();
|
|
84
|
-
});
|
|
85
|
-
}
|
|
86
|
-
return super.$destroy();
|
|
87
|
-
}
|
|
88
|
-
}
|
|
89
|
-
return WithBreakpointManager;
|
|
90
|
-
}
|
|
91
|
-
if (module.exports.default) module.exports = module.exports.default;
|
|
92
|
-
//# sourceMappingURL=withBreakpointManager.cjs.map
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../../packages/js-toolkit/decorators/withBreakpointManager.ts"],
|
|
4
|
-
"sourcesContent": ["import type { BaseDecorator, BaseInterface } from '../Base/types.js';\nimport type { Base, BaseConstructor, BaseProps } from '../Base/index.js';\nimport { useResize } from '../services/index.js';\nimport { isDev, isArray } from '../utils/index.js';\n\n/**\n * Test the breakpoins of the given Base instance and return the hook to call.\n */\nfunction testBreakpoints(breakpoints: Array<[string[], Base]>) {\n const { breakpoint } = useResize().props();\n breakpoints.forEach(([breakpointKeys, instance]) => {\n if (breakpointKeys.includes(breakpoint) && !instance.$isMounted) {\n setTimeout(() => instance.$mount(), 0);\n } else if (!breakpointKeys.includes(breakpoint) && instance.$isMounted) {\n instance.$destroy();\n }\n });\n}\n\n/**\n * Prepare the components.\n */\nfunction mountComponents(\n instance: Base,\n breakpoints: Array<[string, BaseConstructor]>,\n): Array<[string[], Base]> {\n return breakpoints.map(([bk, ComponentClass]) => {\n const child = new ComponentClass(instance.$el);\n Object.defineProperty(child, '$parent', { get: () => instance.$parent });\n return [bk.split(' '), child];\n });\n}\n\n/**\n * A cache object to hold each Base sub-instances.\n */\nconst instances: WeakMap<Base, Array<[string[], Base]>> = new WeakMap();\n\n/**\n * BreakpointManager class.\n */\nexport function withBreakpointManager<S extends Base>(\n BaseClass: typeof Base,\n breakpoints: Array<[string, BaseConstructor<Base>]>,\n): BaseDecorator<BaseInterface, S> {\n if (!isArray(breakpoints)) {\n if (isDev) {\n throw new Error('[withBreakpointManager] The `breakpoints` parameter must be an array.');\n }\n\n // @ts-ignore\n return BaseClass;\n }\n\n if (breakpoints.length < 2) {\n if (isDev) {\n throw new Error('[withBreakpointManager] You must define at least 2 breakpoints.');\n }\n\n // @ts-ignore\n return BaseClass;\n }\n\n const { add, props } = useResize();\n\n // Do nothing if no breakpoint has been defined.\n // @see https://js-toolkit.meta.fr/services/resize.html#breakpoint\n if (!props().breakpoint) {\n if (isDev) {\n throw new Error('The `BreakpointManager` class requires breakpoints to be defined.');\n }\n\n // @ts-ignore\n return BaseClass;\n }\n\n /**\n * Class.\n */\n class WithBreakpointManager<T extends BaseProps = BaseProps> extends BaseClass<T> {\n /**\n * Watch for the document resize to test the breakpoints.\n */\n constructor(element: HTMLElement) {\n super(element);\n\n if (!instances.has(this)) {\n instances.set(this, mountComponents(this, breakpoints));\n }\n\n add(`BreakpointManager-${this.$id}`, () => {\n testBreakpoints(instances.get(this));\n });\n }\n\n /**\n * Override the default $mount method to prevent component's from being\n * mounted when they should not.\n */\n $mount(): this {\n super.$mount();\n\n testBreakpoints(instances.get(this));\n\n return this;\n }\n\n /**\n * Destroy all instances when the main one is destroyed.\n */\n $destroy(): this {\n if (isArray(instances.get(this))) {\n instances.get(this).forEach(([, instance]) => {\n instance.$destroy();\n });\n }\n\n return super.$destroy();\n }\n }\n\n // @ts-ignore\n return WithBreakpointManager;\n}\n"],
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAEA,sBAA0B;AAC1B,mBAA+B;AAK/B,SAAS,gBAAgB,aAAsC;AAC7D,QAAM,EAAE,WAAW,QAAI,2BAAU,EAAE,MAAM;AACzC,cAAY,QAAQ,CAAC,CAAC,gBAAgB,QAAQ,MAAM;AAClD,QAAI,eAAe,SAAS,UAAU,KAAK,CAAC,SAAS,YAAY;AAC/D,iBAAW,MAAM,SAAS,OAAO,GAAG,CAAC;AAAA,IACvC,WAAW,CAAC,eAAe,SAAS,UAAU,KAAK,SAAS,YAAY;AACtE,eAAS,SAAS;AAAA,IACpB;AAAA,EACF,CAAC;AACH;AAKA,SAAS,gBACP,UACA,aACyB;AACzB,SAAO,YAAY,IAAI,CAAC,CAAC,IAAI,cAAc,MAAM;AAC/C,UAAM,QAAQ,IAAI,eAAe,SAAS,GAAG;AAC7C,WAAO,eAAe,OAAO,WAAW,EAAE,KAAK,MAAM,SAAS,QAAQ,CAAC;AACvE,WAAO,CAAC,GAAG,MAAM,GAAG,GAAG,KAAK;AAAA,EAC9B,CAAC;AACH;AAKA,IAAM,YAAoD,oBAAI,QAAQ;AAK/D,SAAS,sBACd,WACA,aACiC;AACjC,MAAI,KAAC,sBAAQ,WAAW,GAAG;AACzB,QAAI,oBAAO;AACT,YAAM,IAAI,MAAM,uEAAuE;AAAA,IACzF;AAGA,WAAO;AAAA,EACT;AAEA,MAAI,YAAY,SAAS,GAAG;AAC1B,QAAI,oBAAO;AACT,YAAM,IAAI,MAAM,iEAAiE;AAAA,IACnF;AAGA,WAAO;AAAA,EACT;AAEA,QAAM,EAAE,KAAK,MAAM,QAAI,2BAAU;AAIjC,MAAI,CAAC,MAAM,EAAE,YAAY;AACvB,QAAI,oBAAO;AACT,YAAM,IAAI,MAAM,mEAAmE;AAAA,IACrF;AAGA,WAAO;AAAA,EACT;AAKA,QAAM,8BAA+D,UAAa;AAAA,IAIhF,YAAY,SAAsB;AAChC,YAAM,OAAO;AAEb,UAAI,CAAC,UAAU,IAAI,IAAI,GAAG;AACxB,kBAAU,IAAI,MAAM,gBAAgB,MAAM,WAAW,CAAC;AAAA,MACxD;AAEA,UAAI,qBAAqB,KAAK,OAAO,MAAM;AACzC,wBAAgB,UAAU,IAAI,IAAI,CAAC;AAAA,MACrC,CAAC;AAAA,IACH;AAAA,IAMA,SAAe;AACb,YAAM,OAAO;AAEb,sBAAgB,UAAU,IAAI,IAAI,CAAC;AAEnC,aAAO;AAAA,IACT;AAAA,IAKA,WAAiB;AACf,cAAI,sBAAQ,UAAU,IAAI,IAAI,CAAC,GAAG;AAChC,kBAAU,IAAI,IAAI,EAAE,QAAQ,CAAC,CAAC,EAAE,QAAQ,MAAM;AAC5C,mBAAS,SAAS;AAAA,QACpB,CAAC;AAAA,MACH;AAEA,aAAO,MAAM,SAAS;AAAA,IACxB;AAAA,EACF;AAGA,SAAO;AACT;",
|
|
6
|
-
"names": []
|
|
7
|
-
}
|
|
@@ -1,118 +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/decorators/withBreakpointObserver.ts
|
|
20
|
-
var withBreakpointObserver_exports = {};
|
|
21
|
-
__export(withBreakpointObserver_exports, {
|
|
22
|
-
withBreakpointObserver: () => withBreakpointObserver
|
|
23
|
-
});
|
|
24
|
-
module.exports = __toCommonJS(withBreakpointObserver_exports);
|
|
25
|
-
var import_services = require("../services/index.cjs");
|
|
26
|
-
var import_utils = require("../utils/index.cjs");
|
|
27
|
-
function testBreakpoints(instance, breakpoint = (0, import_services.useResize)().props().breakpoint) {
|
|
28
|
-
const { activeBreakpoints, inactiveBreakpoints } = instance.$options;
|
|
29
|
-
const isInActiveBreakpoint = activeBreakpoints && activeBreakpoints.split(" ").includes(breakpoint);
|
|
30
|
-
const isInInactiveBreakpoint = inactiveBreakpoints && inactiveBreakpoints.split(" ").includes(breakpoint);
|
|
31
|
-
if (activeBreakpoints && isInActiveBreakpoint || inactiveBreakpoints && !isInInactiveBreakpoint) {
|
|
32
|
-
return "$mount";
|
|
33
|
-
}
|
|
34
|
-
return "$destroy";
|
|
35
|
-
}
|
|
36
|
-
function hasBreakpointConfiguration(instance) {
|
|
37
|
-
const { activeBreakpoints, inactiveBreakpoints } = instance.$options;
|
|
38
|
-
return Boolean(activeBreakpoints || inactiveBreakpoints);
|
|
39
|
-
}
|
|
40
|
-
function testConflictingBreakpointConfiguration(instance) {
|
|
41
|
-
const { activeBreakpoints, inactiveBreakpoints, name } = instance.$options;
|
|
42
|
-
if (activeBreakpoints && inactiveBreakpoints) {
|
|
43
|
-
throw new Error(
|
|
44
|
-
`[${name}] Incorrect configuration: the \`activeBreakpoints\` and \`inactiveBreakpoints\` are not compatible.`
|
|
45
|
-
);
|
|
46
|
-
}
|
|
47
|
-
}
|
|
48
|
-
function addToResize(key, instance) {
|
|
49
|
-
if (import_utils.isDev) {
|
|
50
|
-
testConflictingBreakpointConfiguration(instance);
|
|
51
|
-
}
|
|
52
|
-
const { add, has } = (0, import_services.useResize)();
|
|
53
|
-
if (!has(key)) {
|
|
54
|
-
add(key, ({ breakpoint }) => {
|
|
55
|
-
const action = testBreakpoints(instance, breakpoint);
|
|
56
|
-
if (action === "$destroy" && instance.$isMounted) {
|
|
57
|
-
instance[action]();
|
|
58
|
-
} else if (action === "$mount" && !instance.$isMounted) {
|
|
59
|
-
setTimeout(() => instance[action](), 0);
|
|
60
|
-
}
|
|
61
|
-
});
|
|
62
|
-
}
|
|
63
|
-
}
|
|
64
|
-
function withBreakpointObserver(BaseClass) {
|
|
65
|
-
class WithBreakpointObserver extends BaseClass {
|
|
66
|
-
static config = {
|
|
67
|
-
...BaseClass.config,
|
|
68
|
-
name: `${BaseClass.config.name}WithBreakpointObserver`,
|
|
69
|
-
options: {
|
|
70
|
-
...BaseClass.config?.options || {},
|
|
71
|
-
activeBreakpoints: String,
|
|
72
|
-
inactiveBreakpoints: String
|
|
73
|
-
}
|
|
74
|
-
};
|
|
75
|
-
constructor(element) {
|
|
76
|
-
super(element);
|
|
77
|
-
const { remove, props } = (0, import_services.useResize)();
|
|
78
|
-
const { name } = this.$options;
|
|
79
|
-
if (!props().breakpoint) {
|
|
80
|
-
if (import_utils.isDev) {
|
|
81
|
-
throw new Error(
|
|
82
|
-
`[${name}] The \`BreakpointObserver\` class requires breakpoints to be defined.`
|
|
83
|
-
);
|
|
84
|
-
}
|
|
85
|
-
return;
|
|
86
|
-
}
|
|
87
|
-
const key = `BreakpointObserver-${this.$id}`;
|
|
88
|
-
const mutationObserver = new MutationObserver(([mutation]) => {
|
|
89
|
-
if (mutation.type === "attributes" && (mutation.attributeName === "data-options" || mutation.attributeName.startsWith("data-option-"))) {
|
|
90
|
-
if (!hasBreakpointConfiguration(this)) {
|
|
91
|
-
this.$mount();
|
|
92
|
-
remove(key);
|
|
93
|
-
return;
|
|
94
|
-
}
|
|
95
|
-
addToResize(key, this);
|
|
96
|
-
}
|
|
97
|
-
});
|
|
98
|
-
mutationObserver.observe(this.$el, { attributes: true });
|
|
99
|
-
if (!hasBreakpointConfiguration(this)) {
|
|
100
|
-
return;
|
|
101
|
-
}
|
|
102
|
-
addToResize(key, this);
|
|
103
|
-
}
|
|
104
|
-
$mount() {
|
|
105
|
-
if (!hasBreakpointConfiguration(this)) {
|
|
106
|
-
return super.$mount();
|
|
107
|
-
}
|
|
108
|
-
const action = testBreakpoints(this);
|
|
109
|
-
if (action === "$mount") {
|
|
110
|
-
return super.$mount();
|
|
111
|
-
}
|
|
112
|
-
return this;
|
|
113
|
-
}
|
|
114
|
-
}
|
|
115
|
-
return WithBreakpointObserver;
|
|
116
|
-
}
|
|
117
|
-
if (module.exports.default) module.exports = module.exports.default;
|
|
118
|
-
//# sourceMappingURL=withBreakpointObserver.cjs.map
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../../packages/js-toolkit/decorators/withBreakpointObserver.ts"],
|
|
4
|
-
"sourcesContent": ["import type { BaseDecorator, BaseInterface } from '../Base/types.js';\nimport type { Base, BaseProps, BaseConfig } from '../Base/index.js';\nimport { useResize } from '../services/index.js';\nimport { isDev } from '../utils/index.js';\n\nexport interface WithBreakpointObserverProps extends BaseProps {\n $options: {\n activeBreakpoints?: string;\n inactiveBreakpoints?: string;\n };\n}\n\nexport interface WithBreakpointObserverInterface extends BaseInterface {\n $mount(): this;\n}\n\n/**\n * Test the breakpoins of the given Base instance and return the hook to call.\n *\n * @param {Base<WithBreakpointObserverProps>} instance The component's instance.\n * @param {string} [breakpoint] The breakpoint to test.\n * @returns {string} The action to trigger.\n */\nfunction testBreakpoints(\n instance: Base<WithBreakpointObserverProps>,\n breakpoint: string = useResize().props().breakpoint,\n): string {\n const { activeBreakpoints, inactiveBreakpoints } = instance.$options;\n const isInActiveBreakpoint =\n activeBreakpoints && activeBreakpoints.split(' ').includes(breakpoint);\n const isInInactiveBreakpoint =\n inactiveBreakpoints && inactiveBreakpoints.split(' ').includes(breakpoint);\n\n if (\n (activeBreakpoints && isInActiveBreakpoint) ||\n (inactiveBreakpoints && !isInInactiveBreakpoint)\n ) {\n return '$mount';\n }\n\n return '$destroy';\n}\n\n/**\n * Test if the given instance is configured for breakpoints.\n *\n * @param {Base<WithBreakpointObserverProps>} instance A Base class instance.\n * @returns {boolean} True if configured correctly, false otherwise.\n */\nfunction hasBreakpointConfiguration(instance: Base<WithBreakpointObserverProps>): boolean {\n const { activeBreakpoints, inactiveBreakpoints } = instance.$options;\n return Boolean(activeBreakpoints || inactiveBreakpoints);\n}\n\n/**\n * Test if the given instance has a conflicting configuration for breakpoints.\n *\n * @param {Base<WithBreakpointObserverProps>} instance A Base class instance.\n * @returns {void}\n */\nfunction testConflictingBreakpointConfiguration(instance: Base<WithBreakpointObserverProps>): void {\n const { activeBreakpoints, inactiveBreakpoints, name } = instance.$options;\n if (activeBreakpoints && inactiveBreakpoints) {\n throw new Error(\n `[${name}] Incorrect configuration: the \\`activeBreakpoints\\` and \\`inactiveBreakpoints\\` are not compatible.`,\n );\n }\n}\n\n/**\n * Add the current instance to the resize service.\n *\n * @param {string} key The key for the resize service callback.\n * @param {Base} instance The instance to observe.\n */\nfunction addToResize(key, instance) {\n if (isDev) {\n testConflictingBreakpointConfiguration(instance);\n }\n\n const { add, has } = useResize();\n\n if (!has(key)) {\n add(key, ({ breakpoint }) => {\n const action = testBreakpoints(instance, breakpoint);\n\n // Always destroy before mounting\n if (action === '$destroy' && instance.$isMounted) {\n instance[action]();\n } else if (action === '$mount' && !instance.$isMounted) {\n setTimeout(() => instance[action](), 0);\n }\n });\n }\n}\n\n/**\n * BreakpointObserver class.\n */\nexport function withBreakpointObserver<S extends Base>(\n BaseClass: typeof Base,\n): BaseDecorator<WithBreakpointObserverInterface, S, WithBreakpointObserverProps> {\n /**\n * Class.\n */\n class WithBreakpointObserver<T extends BaseProps = BaseProps> extends BaseClass<\n T & WithBreakpointObserverProps\n > {\n /**\n * Config.\n */\n static config: BaseConfig = {\n ...BaseClass.config,\n name: `${BaseClass.config.name}WithBreakpointObserver`,\n options: {\n ...(BaseClass.config?.options || {}),\n activeBreakpoints: String,\n inactiveBreakpoints: String,\n },\n };\n\n /**\n * Watch for the document resize to test the breakpoints.\n */\n constructor(element: HTMLElement) {\n super(element);\n\n const { remove, props } = useResize();\n const { name } = this.$options;\n\n // Do nothing if no breakpoint has been defined.\n // @see https://js-toolkit.meta.fr/services/resize.html#breakpoint\n if (!props().breakpoint) {\n if (isDev) {\n throw new Error(\n `[${name}] The \\`BreakpointObserver\\` class requires breakpoints to be defined.`,\n );\n }\n return;\n }\n\n const key = `BreakpointObserver-${this.$id}`;\n\n // Watch change on the `data-options` attribute to emit the `set:options` event.\n const mutationObserver = new MutationObserver(([mutation]) => {\n if (\n mutation.type === 'attributes' &&\n (mutation.attributeName === 'data-options' ||\n mutation.attributeName.startsWith('data-option-'))\n ) {\n // Stop here silently when no breakpoint configuration given.\n if (!hasBreakpointConfiguration(this)) {\n this.$mount();\n remove(key);\n return;\n }\n\n addToResize(key, this);\n }\n });\n mutationObserver.observe(this.$el, { attributes: true });\n\n // Stop here silently when no breakpoint configuration given.\n if (!hasBreakpointConfiguration(this)) {\n return;\n }\n\n addToResize(key, this);\n }\n\n /**\n * Override the default $mount method to prevent component's from being\n * mounted when they should not.\n */\n $mount(): this {\n // Execute normal behavior when no breakpoint configuration given.\n if (!hasBreakpointConfiguration(this)) {\n return super.$mount();\n }\n\n const action = testBreakpoints(this);\n if (action === '$mount') {\n return super.$mount();\n }\n\n return this;\n }\n }\n\n // @ts-ignore\n return WithBreakpointObserver;\n}\n"],
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAEA,sBAA0B;AAC1B,mBAAsB;AAoBtB,SAAS,gBACP,UACA,iBAAqB,2BAAU,EAAE,MAAM,EAAE,YACjC;AACR,QAAM,EAAE,mBAAmB,oBAAoB,IAAI,SAAS;AAC5D,QAAM,uBACJ,qBAAqB,kBAAkB,MAAM,GAAG,EAAE,SAAS,UAAU;AACvE,QAAM,yBACJ,uBAAuB,oBAAoB,MAAM,GAAG,EAAE,SAAS,UAAU;AAE3E,MACG,qBAAqB,wBACrB,uBAAuB,CAAC,wBACzB;AACA,WAAO;AAAA,EACT;AAEA,SAAO;AACT;AAQA,SAAS,2BAA2B,UAAsD;AACxF,QAAM,EAAE,mBAAmB,oBAAoB,IAAI,SAAS;AAC5D,SAAO,QAAQ,qBAAqB,mBAAmB;AACzD;AAQA,SAAS,uCAAuC,UAAmD;AACjG,QAAM,EAAE,mBAAmB,qBAAqB,KAAK,IAAI,SAAS;AAClE,MAAI,qBAAqB,qBAAqB;AAC5C,UAAM,IAAI;AAAA,MACR,IAAI;AAAA,IACN;AAAA,EACF;AACF;AAQA,SAAS,YAAY,KAAK,UAAU;AAClC,MAAI,oBAAO;AACT,2CAAuC,QAAQ;AAAA,EACjD;AAEA,QAAM,EAAE,KAAK,IAAI,QAAI,2BAAU;AAE/B,MAAI,CAAC,IAAI,GAAG,GAAG;AACb,QAAI,KAAK,CAAC,EAAE,WAAW,MAAM;AAC3B,YAAM,SAAS,gBAAgB,UAAU,UAAU;AAGnD,UAAI,WAAW,cAAc,SAAS,YAAY;AAChD,iBAAS,QAAQ;AAAA,MACnB,WAAW,WAAW,YAAY,CAAC,SAAS,YAAY;AACtD,mBAAW,MAAM,SAAS,QAAQ,GAAG,CAAC;AAAA,MACxC;AAAA,IACF,CAAC;AAAA,EACH;AACF;AAKO,SAAS,uBACd,WACgF;AAIhF,QAAM,+BAAgE,UAEpE;AAAA,IAIA,OAAO,SAAqB;AAAA,MAC1B,GAAG,UAAU;AAAA,MACb,MAAM,GAAG,UAAU,OAAO;AAAA,MAC1B,SAAS;AAAA,QACP,GAAI,UAAU,QAAQ,WAAW,CAAC;AAAA,QAClC,mBAAmB;AAAA,QACnB,qBAAqB;AAAA,MACvB;AAAA,IACF;AAAA,IAKA,YAAY,SAAsB;AAChC,YAAM,OAAO;AAEb,YAAM,EAAE,QAAQ,MAAM,QAAI,2BAAU;AACpC,YAAM,EAAE,KAAK,IAAI,KAAK;AAItB,UAAI,CAAC,MAAM,EAAE,YAAY;AACvB,YAAI,oBAAO;AACT,gBAAM,IAAI;AAAA,YACR,IAAI;AAAA,UACN;AAAA,QACF;AACA;AAAA,MACF;AAEA,YAAM,MAAM,sBAAsB,KAAK;AAGvC,YAAM,mBAAmB,IAAI,iBAAiB,CAAC,CAAC,QAAQ,MAAM;AAC5D,YACE,SAAS,SAAS,iBACjB,SAAS,kBAAkB,kBAC1B,SAAS,cAAc,WAAW,cAAc,IAClD;AAEA,cAAI,CAAC,2BAA2B,IAAI,GAAG;AACrC,iBAAK,OAAO;AACZ,mBAAO,GAAG;AACV;AAAA,UACF;AAEA,sBAAY,KAAK,IAAI;AAAA,QACvB;AAAA,MACF,CAAC;AACD,uBAAiB,QAAQ,KAAK,KAAK,EAAE,YAAY,KAAK,CAAC;AAGvD,UAAI,CAAC,2BAA2B,IAAI,GAAG;AACrC;AAAA,MACF;AAEA,kBAAY,KAAK,IAAI;AAAA,IACvB;AAAA,IAMA,SAAe;AAEb,UAAI,CAAC,2BAA2B,IAAI,GAAG;AACrC,eAAO,MAAM,OAAO;AAAA,MACtB;AAEA,YAAM,SAAS,gBAAgB,IAAI;AACnC,UAAI,WAAW,UAAU;AACvB,eAAO,MAAM,OAAO;AAAA,MACtB;AAEA,aAAO;AAAA,IACT;AAAA,EACF;AAGA,SAAO;AACT;",
|
|
6
|
-
"names": []
|
|
7
|
-
}
|
package/decorators/withDrag.cjs
DELETED
|
@@ -1,50 +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/decorators/withDrag.ts
|
|
20
|
-
var withDrag_exports = {};
|
|
21
|
-
__export(withDrag_exports, {
|
|
22
|
-
withDrag: () => withDrag
|
|
23
|
-
});
|
|
24
|
-
module.exports = __toCommonJS(withDrag_exports);
|
|
25
|
-
var import_services = require("../services/index.cjs");
|
|
26
|
-
function withDrag(BaseClass, { target = (instance) => instance.$el, ...options } = {}) {
|
|
27
|
-
class WithDrag extends BaseClass {
|
|
28
|
-
static config = {
|
|
29
|
-
name: `${BaseClass.config.name}WithDrag`,
|
|
30
|
-
emits: ["dragged"]
|
|
31
|
-
};
|
|
32
|
-
constructor(element) {
|
|
33
|
-
super(element);
|
|
34
|
-
this.$on("mounted", () => {
|
|
35
|
-
this.$services.register(
|
|
36
|
-
"dragged",
|
|
37
|
-
import_services.useDrag.bind(void 0, target.call(this, this), options)
|
|
38
|
-
);
|
|
39
|
-
this.$services.enable("dragged");
|
|
40
|
-
});
|
|
41
|
-
this.$on("destroyed", () => {
|
|
42
|
-
this.$services.disable("dragged");
|
|
43
|
-
this.$services.unregister("dragged");
|
|
44
|
-
});
|
|
45
|
-
}
|
|
46
|
-
}
|
|
47
|
-
return WithDrag;
|
|
48
|
-
}
|
|
49
|
-
if (module.exports.default) module.exports = module.exports.default;
|
|
50
|
-
//# sourceMappingURL=withDrag.cjs.map
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../../packages/js-toolkit/decorators/withDrag.ts"],
|
|
4
|
-
"sourcesContent": ["import type { BaseDecorator, BaseInterface } from '../Base/types.js';\nimport type { Base, BaseProps, BaseConfig } from '../Base/index.js';\nimport type { DragServiceOptions, DragServiceProps } from '../services/drag.js';\nimport { useDrag } from '../services/index.js';\n\nexport type DragDecoratorOptions = DragServiceOptions & {\n target?: (this: Base, instance: Base) => HTMLElement;\n};\n\nexport interface WithDragInterface extends BaseInterface {\n dragged?(props: DragServiceProps): void;\n}\n\n/**\n * Add dragging capabilities to a component.\n */\nexport function withDrag<S extends Base>(\n BaseClass: typeof Base,\n { target = (instance) => instance.$el, ...options }: DragDecoratorOptions = {},\n): BaseDecorator<BaseInterface, S> {\n /**\n * Class.\n */\n class WithDrag<T extends BaseProps = BaseProps> extends BaseClass<T & WithDragInterface> {\n /**\n * Config.\n */\n static config: BaseConfig = {\n name: `${BaseClass.config.name}WithDrag`,\n emits: ['dragged'],\n };\n\n /**\n * Class constructor.\n */\n constructor(element: HTMLElement) {\n super(element);\n\n this.$on('mounted', () => {\n this.$services.register(\n 'dragged',\n useDrag.bind(undefined, target.call(this, this), options),\n );\n this.$services.enable('dragged');\n });\n\n this.$on('destroyed', () => {\n this.$services.disable('dragged');\n this.$services.unregister('dragged');\n });\n }\n }\n\n // @ts-ignore\n return WithDrag;\n}\n"],
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAGA,sBAAwB;AAajB,SAAS,SACd,WACA,EAAE,SAAS,CAAC,aAAa,SAAS,QAAQ,QAAQ,IAA0B,CAAC,GAC5C;AAIjC,QAAM,iBAAkD,UAAiC;AAAA,IAIvF,OAAO,SAAqB;AAAA,MAC1B,MAAM,GAAG,UAAU,OAAO;AAAA,MAC1B,OAAO,CAAC,SAAS;AAAA,IACnB;AAAA,IAKA,YAAY,SAAsB;AAChC,YAAM,OAAO;AAEb,WAAK,IAAI,WAAW,MAAM;AACxB,aAAK,UAAU;AAAA,UACb;AAAA,UACA,wBAAQ,KAAK,QAAW,OAAO,KAAK,MAAM,IAAI,GAAG,OAAO;AAAA,QAC1D;AACA,aAAK,UAAU,OAAO,SAAS;AAAA,MACjC,CAAC;AAED,WAAK,IAAI,aAAa,MAAM;AAC1B,aAAK,UAAU,QAAQ,SAAS;AAChC,aAAK,UAAU,WAAW,SAAS;AAAA,MACrC,CAAC;AAAA,IACH;AAAA,EACF;AAGA,SAAO;AACT;",
|
|
6
|
-
"names": []
|
|
7
|
-
}
|
|
@@ -1,43 +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
|
-
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
21
|
-
mod
|
|
22
|
-
));
|
|
23
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
24
|
-
|
|
25
|
-
// packages/js-toolkit/decorators/withExtraConfig.ts
|
|
26
|
-
var withExtraConfig_exports = {};
|
|
27
|
-
__export(withExtraConfig_exports, {
|
|
28
|
-
withExtraConfig: () => withExtraConfig
|
|
29
|
-
});
|
|
30
|
-
module.exports = __toCommonJS(withExtraConfig_exports);
|
|
31
|
-
var import_deepmerge = __toESM(require("deepmerge"), 1);
|
|
32
|
-
function withExtraConfig(BaseClass, config, options = {}) {
|
|
33
|
-
const newConfig = (0, import_deepmerge.default)(BaseClass.config, config, options);
|
|
34
|
-
if (newConfig.name === BaseClass.config.name) {
|
|
35
|
-
newConfig.name = `${BaseClass.config.name}WithExtraConfig`;
|
|
36
|
-
}
|
|
37
|
-
class WithExtraConfig extends BaseClass {
|
|
38
|
-
static config = newConfig;
|
|
39
|
-
}
|
|
40
|
-
return WithExtraConfig;
|
|
41
|
-
}
|
|
42
|
-
if (module.exports.default) module.exports = module.exports.default;
|
|
43
|
-
//# sourceMappingURL=withExtraConfig.cjs.map
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../../packages/js-toolkit/decorators/withExtraConfig.ts"],
|
|
4
|
-
"sourcesContent": ["import merge from 'deepmerge';\nimport type { Options as DeepmergeOptions } from 'deepmerge';\nimport type { BaseDecorator, BaseInterface } from '../Base/types.js';\nimport type { Base, BaseProps, BaseConfig } from '../Base/index.js';\n\n/**\n * Extends the configuration of an existing class.\n */\nexport function withExtraConfig<S extends Base>(\n BaseClass: typeof Base,\n config: Partial<BaseConfig>,\n options: DeepmergeOptions = {},\n): BaseDecorator<BaseInterface, S> {\n const newConfig = merge(BaseClass.config, config, options);\n\n if (newConfig.name === BaseClass.config.name) {\n newConfig.name = `${BaseClass.config.name}WithExtraConfig`;\n }\n\n /**\n * Class.\n */\n class WithExtraConfig<T extends BaseProps = BaseProps> extends BaseClass<T> {\n /**\n * Config.\n */\n static config: BaseConfig = newConfig;\n }\n\n // @ts-ignore\n return WithExtraConfig;\n}\n"],
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,uBAAkB;AAQX,SAAS,gBACd,WACA,QACA,UAA4B,CAAC,GACI;AACjC,QAAM,gBAAY,iBAAAA,SAAM,UAAU,QAAQ,QAAQ,OAAO;AAEzD,MAAI,UAAU,SAAS,UAAU,OAAO,MAAM;AAC5C,cAAU,OAAO,GAAG,UAAU,OAAO;AAAA,EACvC;AAKA,QAAM,wBAAyD,UAAa;AAAA,IAI1E,OAAO,SAAqB;AAAA,EAC9B;AAGA,SAAO;AACT;",
|
|
6
|
-
"names": ["merge"]
|
|
7
|
-
}
|
|
@@ -1,42 +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/decorators/withFreezedOptions.ts
|
|
20
|
-
var withFreezedOptions_exports = {};
|
|
21
|
-
__export(withFreezedOptions_exports, {
|
|
22
|
-
withFreezedOptions: () => withFreezedOptions
|
|
23
|
-
});
|
|
24
|
-
module.exports = __toCommonJS(withFreezedOptions_exports);
|
|
25
|
-
function withFreezedOptions(BaseClass) {
|
|
26
|
-
class WithFreezedOptions extends BaseClass {
|
|
27
|
-
__freezedOptions;
|
|
28
|
-
get $options() {
|
|
29
|
-
if (!this.__freezedOptions) {
|
|
30
|
-
Object.defineProperty(this, "__freezedOptions", {
|
|
31
|
-
value: Object.freeze({ ...super.$options }),
|
|
32
|
-
enumerable: false,
|
|
33
|
-
configurable: true
|
|
34
|
-
});
|
|
35
|
-
}
|
|
36
|
-
return this.__freezedOptions;
|
|
37
|
-
}
|
|
38
|
-
}
|
|
39
|
-
return WithFreezedOptions;
|
|
40
|
-
}
|
|
41
|
-
if (module.exports.default) module.exports = module.exports.default;
|
|
42
|
-
//# sourceMappingURL=withFreezedOptions.cjs.map
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../../packages/js-toolkit/decorators/withFreezedOptions.ts"],
|
|
4
|
-
"sourcesContent": ["import type { BaseDecorator, BaseInterface } from '../Base/types.js';\nimport type { Base, BaseProps, BaseOptions } from '../Base/index.js';\n\nexport interface WithFreezedOptionsInterface extends BaseInterface {\n readonly $options: Readonly<BaseOptions>;\n}\n\n/**\n * Freeze the `$options` property to improve performance.\n */\nexport function withFreezedOptions<S extends Base>(\n BaseClass: typeof Base,\n): BaseDecorator<WithFreezedOptionsInterface, S> {\n /**\n * Class.\n */\n class WithFreezedOptions<T extends BaseProps = BaseProps> extends BaseClass<T> {\n /**\n * Hold freezed options\n *\n * @private\n */\n __freezedOptions;\n\n /**\n * Lazyly freeze the `$options` property.\n */\n get $options() {\n if (!this.__freezedOptions) {\n Object.defineProperty(this, '__freezedOptions', {\n value: Object.freeze({ ...super.$options }),\n enumerable: false,\n configurable: true,\n });\n }\n\n return this.__freezedOptions;\n }\n }\n\n // @ts-ignore\n return WithFreezedOptions;\n}\n"],
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAUO,SAAS,mBACd,WAC+C;AAI/C,QAAM,2BAA4D,UAAa;AAAA,IAM7E;AAAA,IAKA,IAAI,WAAW;AACb,UAAI,CAAC,KAAK,kBAAkB;AAC1B,eAAO,eAAe,MAAM,oBAAoB;AAAA,UAC9C,OAAO,OAAO,OAAO,EAAE,GAAG,MAAM,SAAS,CAAC;AAAA,UAC1C,YAAY;AAAA,UACZ,cAAc;AAAA,QAChB,CAAC;AAAA,MACH;AAEA,aAAO,KAAK;AAAA,IACd;AAAA,EACF;AAGA,SAAO;AACT;",
|
|
6
|
-
"names": []
|
|
7
|
-
}
|
|
@@ -1,62 +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/decorators/withIntersectionObserver.ts
|
|
20
|
-
var withIntersectionObserver_exports = {};
|
|
21
|
-
__export(withIntersectionObserver_exports, {
|
|
22
|
-
withIntersectionObserver: () => withIntersectionObserver
|
|
23
|
-
});
|
|
24
|
-
module.exports = __toCommonJS(withIntersectionObserver_exports);
|
|
25
|
-
function createArrayOfNumber(length) {
|
|
26
|
-
return new Array(length + 1).fill(length).map((val, index) => index / length);
|
|
27
|
-
}
|
|
28
|
-
function withIntersectionObserver(BaseClass, defaultOptions = { threshold: createArrayOfNumber(100) }) {
|
|
29
|
-
class WithIntersectionObserver extends BaseClass {
|
|
30
|
-
static config = {
|
|
31
|
-
...BaseClass.config,
|
|
32
|
-
name: `${BaseClass.config.name}WithIntersectionObserver`,
|
|
33
|
-
options: {
|
|
34
|
-
...BaseClass.config?.options || {},
|
|
35
|
-
intersectionObserver: Object
|
|
36
|
-
},
|
|
37
|
-
emits: ["intersected"]
|
|
38
|
-
};
|
|
39
|
-
$observer;
|
|
40
|
-
constructor(element) {
|
|
41
|
-
super(element);
|
|
42
|
-
this.$observer = new IntersectionObserver(
|
|
43
|
-
(entries) => {
|
|
44
|
-
this.__callMethod("intersected", entries);
|
|
45
|
-
},
|
|
46
|
-
{
|
|
47
|
-
...defaultOptions,
|
|
48
|
-
...this.$options.intersectionObserver
|
|
49
|
-
}
|
|
50
|
-
);
|
|
51
|
-
this.$on("mounted", () => {
|
|
52
|
-
this.$observer.observe(this.$el);
|
|
53
|
-
});
|
|
54
|
-
this.$on("destroyed", () => {
|
|
55
|
-
this.$observer.unobserve(this.$el);
|
|
56
|
-
});
|
|
57
|
-
}
|
|
58
|
-
}
|
|
59
|
-
return WithIntersectionObserver;
|
|
60
|
-
}
|
|
61
|
-
if (module.exports.default) module.exports = module.exports.default;
|
|
62
|
-
//# sourceMappingURL=withIntersectionObserver.cjs.map
|