@studiometa/js-toolkit 2.0.0-beta.8 → 2.0.0-beta.9
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/index.js +1 -1
- package/Base/managers/RefsManager.js +5 -0
- package/README.md +13 -70
- package/decorators/index.d.ts +8 -9
- package/decorators/index.js +8 -9
- package/decorators/withScrolledInView.d.ts +2 -1
- package/decorators/withScrolledInView.js +2 -2
- package/helpers/index.d.ts +4 -5
- package/helpers/index.js +4 -5
- package/index.d.ts +4 -21
- package/index.js +4 -5
- package/index.modern.js +1 -1
- package/index.umd.js +1 -1
- package/package.json +1 -1
- package/services/index.d.ts +7 -8
- package/services/index.js +7 -8
- package/utils/collide/index.d.ts +6 -7
- package/utils/collide/index.js +6 -7
- package/utils/css/index.d.ts +4 -5
- package/utils/css/index.js +6 -5
- package/utils/index.d.ts +11 -35
- package/utils/index.js +11 -17
- package/utils/math/ease.d.ts +78 -0
- package/utils/math/ease.js +41 -0
- package/utils/math/index.d.ts +8 -8
- package/utils/math/index.js +8 -8
- package/utils/object/index.d.ts +3 -4
- package/utils/object/index.js +3 -4
- package/utils/string/index.d.ts +10 -11
- package/utils/string/index.js +10 -11
package/Base/index.js
CHANGED
|
@@ -340,5 +340,5 @@ _defineProperty(Base, "$isBase", true);
|
|
|
340
340
|
|
|
341
341
|
_defineProperty(Base, "config", {
|
|
342
342
|
name: 'Base',
|
|
343
|
-
emits: ['mounted', 'updated', 'destroyed', 'terminated', 'ticked', 'scrolled', 'resized', 'moved', 'loaded']
|
|
343
|
+
emits: ['mounted', 'updated', 'destroyed', 'terminated', 'ticked', 'scrolled', 'resized', 'moved', 'loaded', 'keyed']
|
|
344
344
|
});
|
|
@@ -50,6 +50,11 @@ export default class RefsManager {
|
|
|
50
50
|
console.warn("[".concat(this.__base.$options.name, "]"), "The \"".concat(refName, "\" ref has been found multiple times."), 'Did you forgot to add the `[]` suffix to its name?');
|
|
51
51
|
}
|
|
52
52
|
|
|
53
|
+
if (!isMultiple && refs.length <= 1 && refs[0] === undefined) {
|
|
54
|
+
console.warn("[".concat(this.__base.$options.name, "]"), "The \"".concat(refName, "\" ref is missing."), "Is there an `[data-ref=\"".concat(refName, "\"]` element in the component's scope?"));
|
|
55
|
+
return;
|
|
56
|
+
}
|
|
57
|
+
|
|
53
58
|
this.__eventsManager.bindRef(refName, refs);
|
|
54
59
|
|
|
55
60
|
Object.defineProperty(this, propName, {
|
package/README.md
CHANGED
|
@@ -15,80 +15,23 @@ Install the latest version via NPM:
|
|
|
15
15
|
npm install @studiometa/js-toolkit
|
|
16
16
|
```
|
|
17
17
|
|
|
18
|
-
##
|
|
18
|
+
## Documentation
|
|
19
19
|
|
|
20
|
-
|
|
20
|
+
This project contains a JavaScript micro-framework and its utility functions whose main objectives are:
|
|
21
21
|
|
|
22
|
-
|
|
22
|
+
- Enforcing best-practice and consistency between projects
|
|
23
|
+
- Using elements from the DOM easily
|
|
24
|
+
- Enabling custom behaviours on component initialization or other user events
|
|
25
|
+
- Disabling custom behaviours on component destruction or other user events
|
|
26
|
+
- Initializing components in the right place at the right time
|
|
27
|
+
- Defining dependencies between components
|
|
23
28
|
|
|
24
|
-
|
|
29
|
+
Visit [js-toolkit.studiometa.dev](https://js-toolkit.studiometa.dev) to learn more.
|
|
25
30
|
|
|
26
|
-
|
|
27
|
-
import { Base, createApp } from '@studiometa/js-toolkit';
|
|
31
|
+
## Contributing
|
|
28
32
|
|
|
29
|
-
|
|
30
|
-
static config = {
|
|
31
|
-
name: 'Component',
|
|
32
|
-
}
|
|
33
|
+
This projects follows the [Git Flow](https://github.com/petervanderdoes/gitflow-avh) methodology to manage its branches and features. The packages and their dependencies are managed with NPM workspaces. The files are linted with ESLint, type checked with TypeScript and formatted with Prettier.
|
|
33
34
|
|
|
34
|
-
|
|
35
|
-
console.log('Hello!');
|
|
36
|
-
}
|
|
37
|
-
}
|
|
35
|
+
## License
|
|
38
36
|
|
|
39
|
-
|
|
40
|
-
static config = {
|
|
41
|
-
name: 'App',
|
|
42
|
-
components: {
|
|
43
|
-
Component,
|
|
44
|
-
},
|
|
45
|
-
refs: ['btn', 'items[]'],
|
|
46
|
-
options: {
|
|
47
|
-
foo: String,
|
|
48
|
-
bar: { type: String, default: 'bar' },
|
|
49
|
-
}
|
|
50
|
-
};
|
|
51
|
-
|
|
52
|
-
mounted() {
|
|
53
|
-
this.$log('mounted');
|
|
54
|
-
|
|
55
|
-
// Options
|
|
56
|
-
this.$options.name; // 'App'
|
|
57
|
-
this.$options.log; // true
|
|
58
|
-
this.$options.debug; // false
|
|
59
|
-
this.$options.foo // ''
|
|
60
|
-
this.$options.bar // 'bar'
|
|
61
|
-
|
|
62
|
-
// Children
|
|
63
|
-
this.$children.Component; // Array<Component>
|
|
64
|
-
|
|
65
|
-
// DOM references
|
|
66
|
-
this.$refs.btn; // <button data-ref="btn"></button>
|
|
67
|
-
this.$refs.items[0]; // <li data-ref="items[]"></li>
|
|
68
|
-
}
|
|
69
|
-
|
|
70
|
-
destroyed() {
|
|
71
|
-
this.$log('destroyed');
|
|
72
|
-
}
|
|
73
|
-
|
|
74
|
-
scrolled(props) {
|
|
75
|
-
this.$log('scrolled', props);
|
|
76
|
-
}
|
|
77
|
-
|
|
78
|
-
resized(props) {
|
|
79
|
-
this.$log('resized', props);
|
|
80
|
-
}
|
|
81
|
-
}
|
|
82
|
-
|
|
83
|
-
export default createApp(App, document.body);
|
|
84
|
-
```
|
|
85
|
-
|
|
86
|
-
Read the [documentation](https://js-toolkit.studiometa.dev/) to learn more.
|
|
87
|
-
|
|
88
|
-
## Contribution
|
|
89
|
-
|
|
90
|
-
This projects follows the [Git Flow](https://github.com/petervanderdoes/gitflow-avh) methodology to manage its branches and features.
|
|
91
|
-
|
|
92
|
-
The packages from this project are managed with NPM workspaces.
|
|
93
|
-
|
|
94
|
-
The files are linted with ESLint, type checked with TypeScript and formatted with Prettier.
|
|
37
|
+
See [LICENSE](./LICENSE).
|
package/decorators/index.d.ts
CHANGED
|
@@ -1,9 +1,8 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
export { withBreakpointManager, withBreakpointObserver, withDrag, withExtraConfig, withIntersectionObserver, withMountWhenInView, withScrolledInView, withVue2 };
|
|
1
|
+
export { default as withBreakpointManager } from "./withBreakpointManager.js";
|
|
2
|
+
export { default as withBreakpointObserver } from "./withBreakpointObserver.js";
|
|
3
|
+
export { default as withDrag } from "./withDrag.js";
|
|
4
|
+
export { default as withExtraConfig } from "./withExtraConfig.js";
|
|
5
|
+
export { default as withIntersectionObserver } from "./withIntersectionObserver.js";
|
|
6
|
+
export { default as withMountWhenInView } from "./withMountWhenInView.js";
|
|
7
|
+
export { default as withScrolledInView } from "./withScrolledInView.js";
|
|
8
|
+
export { default as withVue2 } from "./withVue2.js";
|
package/decorators/index.js
CHANGED
|
@@ -1,9 +1,8 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
export { withBreakpointManager, withBreakpointObserver, withDrag, withExtraConfig, withIntersectionObserver, withMountWhenInView, withScrolledInView, withVue2 };
|
|
1
|
+
export { default as withBreakpointManager } from './withBreakpointManager.js';
|
|
2
|
+
export { default as withBreakpointObserver } from './withBreakpointObserver.js';
|
|
3
|
+
export { default as withDrag } from './withDrag.js';
|
|
4
|
+
export { default as withExtraConfig } from './withExtraConfig.js';
|
|
5
|
+
export { default as withIntersectionObserver } from './withIntersectionObserver.js';
|
|
6
|
+
export { default as withMountWhenInView } from './withMountWhenInView.js';
|
|
7
|
+
export { default as withScrolledInView } from './withScrolledInView.js';
|
|
8
|
+
export { default as withVue2 } from './withVue2.js';
|
|
@@ -8,9 +8,10 @@
|
|
|
8
8
|
*
|
|
9
9
|
* @template {BaseConstructor} T
|
|
10
10
|
* @param {T} BaseClass
|
|
11
|
+
* @param {IntersectionObserverInit} options
|
|
11
12
|
* @return {T}
|
|
12
13
|
*/
|
|
13
|
-
export default function withScrolledInView<T extends typeof import("../Base").default>(BaseClass: T): T;
|
|
14
|
+
export default function withScrolledInView<T extends typeof import("../Base").default>(BaseClass: T, options: IntersectionObserverInit): T;
|
|
14
15
|
export type Base = import('../Base').default;
|
|
15
16
|
export type BaseConstructor = import('../Base').BaseConstructor;
|
|
16
17
|
export type BaseConfig = import('../Base').BaseConfig;
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
2
2
|
import withMountWhenInView from './withMountWhenInView.js';
|
|
3
3
|
import { damp, clamp, clamp01 } from '../utils/index.js';
|
|
4
|
-
export default function withScrolledInView(BaseClass) {
|
|
4
|
+
export default function withScrolledInView(BaseClass, options) {
|
|
5
5
|
var _class, _temp;
|
|
6
6
|
|
|
7
|
-
return _temp = _class = class extends withMountWhenInView(BaseClass) {
|
|
7
|
+
return _temp = _class = class extends withMountWhenInView(BaseClass, options) {
|
|
8
8
|
constructor() {
|
|
9
9
|
super(...arguments);
|
|
10
10
|
|
package/helpers/index.d.ts
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
export { createApp, importOnInteraction, importWhenIdle, importWhenVisible };
|
|
1
|
+
export { default as createApp } from "./createApp.js";
|
|
2
|
+
export { default as importOnInteraction } from "./importOnInteraction.js";
|
|
3
|
+
export { default as importWhenIdle } from "./importWhenIdle.js";
|
|
4
|
+
export { default as importWhenVisible } from "./importWhenVisible.js";
|
package/helpers/index.js
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
export { createApp, importOnInteraction, importWhenIdle, importWhenVisible };
|
|
1
|
+
export { default as createApp } from './createApp.js';
|
|
2
|
+
export { default as importOnInteraction } from './importOnInteraction.js';
|
|
3
|
+
export { default as importWhenIdle } from './importWhenIdle.js';
|
|
4
|
+
export { default as importWhenVisible } from './importWhenVisible.js';
|
package/index.d.ts
CHANGED
|
@@ -1,21 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
import { importWhenVisible } from "./helpers/index.js";
|
|
6
|
-
import { useDrag } from "./services/index.js";
|
|
7
|
-
import { useKey } from "./services/index.js";
|
|
8
|
-
import { useLoad } from "./services/index.js";
|
|
9
|
-
import { usePointer } from "./services/index.js";
|
|
10
|
-
import { useRaf } from "./services/index.js";
|
|
11
|
-
import { useResize } from "./services/index.js";
|
|
12
|
-
import { useScroll } from "./services/index.js";
|
|
13
|
-
import { withBreakpointManager } from "./decorators/index.js";
|
|
14
|
-
import { withBreakpointObserver } from "./decorators/index.js";
|
|
15
|
-
import { withDrag } from "./decorators/index.js";
|
|
16
|
-
import { withExtraConfig } from "./decorators/index.js";
|
|
17
|
-
import { withIntersectionObserver } from "./decorators/index.js";
|
|
18
|
-
import { withMountWhenInView } from "./decorators/index.js";
|
|
19
|
-
import { withScrolledInView } from "./decorators/index.js";
|
|
20
|
-
import { withVue2 } from "./decorators/index.js";
|
|
21
|
-
export { Base, createApp, importOnInteraction, importWhenIdle, importWhenVisible, useDrag, useKey, useLoad, usePointer, useRaf, useResize, useScroll, withBreakpointManager, withBreakpointObserver, withDrag, withExtraConfig, withIntersectionObserver, withMountWhenInView, withScrolledInView, withVue2 };
|
|
1
|
+
export { default as Base } from "./Base/index.js";
|
|
2
|
+
export * from "./decorators/index.js";
|
|
3
|
+
export * from "./helpers/index.js";
|
|
4
|
+
export * from "./services/index.js";
|
package/index.js
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
export { Base, createApp, importOnInteraction, importWhenIdle, importWhenVisible, useDrag, useKey, useLoad, usePointer, useRaf, useResize, useScroll, withBreakpointManager, withBreakpointObserver, withDrag, withExtraConfig, withIntersectionObserver, withMountWhenInView, withScrolledInView, withVue2 };
|
|
1
|
+
export { default as Base } from './Base/index.js';
|
|
2
|
+
export * from './decorators/index.js';
|
|
3
|
+
export * from './helpers/index.js';
|
|
4
|
+
export * from './services/index.js';
|
package/index.modern.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
function e(){return e=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var s=arguments[t];for(var r in s)Object.prototype.hasOwnProperty.call(s,r)&&(e[r]=s[r])}return e},e.apply(this,arguments)}var t=0;function s(e){return"__private_"+t+++"_"+e}function r(e,t){if(!Object.prototype.hasOwnProperty.call(e,t))throw new TypeError("attempted to use private field on non-instance");return e}function i(e,t){return"function"==typeof e[t]}function n(e,t=document){const s=`[data-component="${e}"]`;let r=[];try{r=Array.from(t.querySelectorAll(s))}catch(e){}return 0===r.length&&(r=Array.from(t.querySelectorAll(e))),r}class o{get registeredNames(){return Object.keys(this).filter(e=>!e.startsWith("__"))}constructor(e,t,s,r){Object.defineProperties(this,{__base:{enumerable:!1,writable:!1,value:e},__element:{enumerable:!1,writable:!1,value:t},__components:{enumerable:!1,writable:!1,value:s},__eventsManager:{enumerable:!1,writable:!1,value:r}})}registerAll(){Object.entries(this.__components).forEach(([e,t])=>this.__register(e,t))}__register(e,t){Object.defineProperty(this,e,{enumerable:!0,configurable:!0,get:()=>{const s=n(e,this.__element);return 0===s.length?[]:s.map(s=>this.__getChild(s,t,e)).filter(e=>"terminated"!==e)}})}__getChild(e,t,s){if(e.__base__)return e.__base__;if("$isBase"in t){const s=new t(e);return Object.defineProperty(s,"$parent",{get:()=>this.__base}),s}return t(this.__base).then(t=>{var r;return this.__getChild(e,null!=(r=t.default)?r:t,s)})}mountAll(){this.__triggerHookForAll("$mount")}updateAll(){this.__triggerHookForAll("$update")}destroyAll(){this.__triggerHookForAll("$destroy")}__triggerHookForAll(e){this.registeredNames.forEach(t=>{this[t].forEach(s=>{s instanceof Promise?s.then(s=>this.__triggerHook(e,s,t)):this.__triggerHook(e,s,t)})})}__triggerHook(e,t,s){"$update"!==e||t.$isMounted||(e="$mount"),"$update"!==e&&"$destroy"!==e||this.__eventsManager.unbindChild(s,t),"$update"!==e&&"$mount"!==e||this.__eventsManager.bindChild(s,t),t[e]()}}class a{constructor(e,t,s,r){Object.defineProperties(this,{__element:{enumerable:!1,writable:!1,value:t},__refs:{enumerable:!1,writable:!1,value:s},__base:{enumerable:!1,writable:!1,value:e},__eventsManager:{enumerable:!1,writable:!1,value:r}})}registerAll(){this.__refs.forEach(e=>this.__register(e))}unregisterAll(){this.__refs.forEach(e=>this.__unregister(e))}__register(e){const t=e.endsWith("[]"),s=a.normalizeRefName(e),r=Array.from(this.__element.querySelectorAll(`[data-ref="${e}"]`)).filter(e=>this.__filterRefsBelongingToInstance(e));!t&&r.length>1&&console.warn(`[${this.__base.$options.name}]`,`The "${e}" ref has been found multiple times.`,"Did you forgot to add the `[]` suffix to its name?"),this.__eventsManager.bindRef(e,r),Object.defineProperty(this,s,{value:t||r.length>1?r:r[0],enumerable:!0,configurable:!0})}__unregister(e){const t=a.normalizeRefName(e),s=Array.isArray(this[t])?this[t]:[this[t]];this.__eventsManager.unbindRef(e,s)}static normalizeRefName(e){return e.endsWith("[]")?e.replace(/\[\]$/,""):e}__filterRefsBelongingToInstance(e){let t=e.parentElement;for(;t&&void 0===t.dataset.component;)t=t.parentElement;return null===t||t===this.__element}}class h{constructor(){this.callbacks=new Map,this.isInit=!1}updateProps(...e){throw this.props=e,new Error("The `updateProps` method must be implemented.")}init(){throw new Error("The `init` method must be implemented.")}kill(){throw new Error("The `kill` method must be implemented.")}add(e,t){if(this.has(e))throw new Error(`A callback with the key \`${e}\` has already been registered.`);0!==this.callbacks.size||this.isInit||(this.init(),this.isInit=!0),this.callbacks.set(e,t)}has(e){return this.callbacks.has(e)}get(e){return this.callbacks.get(e)}remove(e){this.callbacks.delete(e),0===this.callbacks.size&&this.isInit&&(this.kill(),this.isInit=!1)}trigger(...e){return this.callbacks.forEach(function(t){t(...e)}),this}}function p(e){return"undefined"!=typeof TouchEvent&&e instanceof TouchEvent}class d extends h{constructor(...e){super(...e),this.props={event:null,isDown:!1,x:window.innerWidth/2,y:window.innerHeight/2,changed:{x:!1,y:!1},last:{x:window.innerWidth/2,y:window.innerHeight/2},delta:{x:0,y:0},progress:{x:.5,y:.5},max:{x:window.innerWidth,y:window.innerHeight}},this.hasRaf=!1}init(){document.documentElement.addEventListener("mouseenter",this,{once:!0,capture:!0});const e={passive:!0,capture:!0};return document.addEventListener("mousemove",this,e),document.addEventListener("touchmove",this,e),document.addEventListener("mousedown",this,e),document.addEventListener("touchstart",this,e),document.addEventListener("mouseup",this,e),document.addEventListener("touchend",this,e),this}handleEvent(e){switch(e.type){case"mouseenter":case"mousemove":case"touchmove":this.handler(e);break;case"mousedown":case"touchstart":this.downHandler();break;case"mouseup":case"touchend":this.upHandler()}}kill(){return document.removeEventListener("mousemove",this),document.removeEventListener("touchmove",this),document.removeEventListener("mousedown",this),document.removeEventListener("touchstart",this),document.removeEventListener("mouseup",this),document.removeEventListener("touchend",this),this}handler(e){this.updateProps(e),this.trigger(this.props)}downHandler(){this.props.isDown=!0,this.trigger(this.props)}upHandler(){this.props.isDown=!1,this.trigger(this.props)}updateProps(e){var t,s;this.props.event=e;const r=this.props.y,i=this.props.x,n=p(e)?null==(t=e.touches[0])?void 0:t.clientY:e.clientY;n!==this.props.y&&(this.props.y=n);const o=p(e)?null==(s=e.touches[0])?void 0:s.clientX:e.clientX;return o!==this.props.x&&(this.props.x=o),this.props.changed.x=this.props.x!==i,this.props.changed.y=this.props.y!==r,this.props.last.x=i,this.props.last.y=r,this.props.delta.x=this.props.x-i,this.props.delta.y=this.props.y-r,this.props.max.x=window.innerWidth,this.props.max.y=window.innerHeight,this.props.progress.x=this.props.x/this.props.max.x,this.props.progress.y=this.props.y/this.props.max.y,this.props}}let c,l,u,_,m,f,g,b;function v(){return l||(c||(c=new d),l={add:c.add.bind(c),remove:c.remove.bind(c),has:c.has.bind(c),props:c.updateProps.bind(c)}),l}class y extends h{constructor(...e){super(...e),this.isTicking=!1,this.id=0,this.raf="undefined"!=typeof window&&window.requestAnimationFrame?window.requestAnimationFrame.bind(window):setTimeout,this.cancelRaf="undefined"!=typeof window&&window.cancelAnimationFrame?window.cancelAnimationFrame.bind(window):clearTimeout,this.props={time:performance.now()}}init(){this.isTicking=!0,this.loop()}loop(){this.updateProps(),this.trigger(this.props),this.isTicking&&(this.id=this.raf(()=>this.loop()))}kill(){this.cancelRaf(this.id),this.isTicking=!1}updateProps(){return this.props.time=window.performance.now(),this.props}}function w(){return _||(u||(u=new y),_={add:u.add.bind(u),remove:u.remove.bind(u),has:u.has.bind(u),props:u.updateProps.bind(u)}),_}function $(e,t=300){let s;return function(...r){clearTimeout(s),s=setTimeout(()=>{e(...r)},t)}}class E extends h{constructor(...e){super(...e),this.props={width:window.innerWidth,height:window.innerHeight,ratio:window.innerWidth/window.innerHeight,orientation:"square"}}init(){return this.handler=$(()=>{this.updateProps(),this.trigger(this.props)}).bind(this),window.addEventListener("resize",this.handler),this}kill(){window.removeEventListener("resize",this.handler)}updateProps(){return this.props.width=window.innerWidth,this.props.height=window.innerHeight,this.props.ratio=window.innerWidth/window.innerHeight,this.props.orientation="square",this.props.ratio>1&&(this.props.orientation="landscape"),this.props.ratio<1&&(this.props.orientation="portrait"),this.breakpointElement?(this.props.breakpoint=this.breakpoint,this.props.breakpoints=this.breakpoints):(this.props.breakpoint=void 0,this.props.breakpoints=void 0),this.props}get breakpointElement(){return document.querySelector("[data-breakpoint]")}get breakpoint(){return window.getComputedStyle(this.breakpointElement,"::before").getPropertyValue("content").replace(/"/g,"")}get breakpoints(){return window.getComputedStyle(this.breakpointElement,"::after").getPropertyValue("content").replace(/"/g,"").split(",")}}function x(){if(!f){m||(m=new E);const e=m.add.bind(m),t=m.remove.bind(m),s=m.has.bind(m),r=m.updateProps.bind(m);f={add:e,remove:t,has:s,props:r}}return f}class k extends h{constructor(...e){super(...e),this.props={x:window.pageXOffset,y:window.pageYOffset,changed:{x:!1,y:!1},last:{x:window.pageXOffset,y:window.pageYOffset},delta:{x:0,y:0},max:{x:(document.scrollingElement||document.body).scrollWidth-window.innerWidth,y:(document.scrollingElement||document.body).scrollHeight-window.innerHeight},progress:{x:0,y:0},direction:{x:"NONE",y:"NONE"}}}init(){return this.updateProps(),document.addEventListener("scroll",this,{passive:!0,capture:!0}),this}get debouncedHandler(){const e=$(()=>{this.updateProps(),this.trigger(this.props)},100);return Object.defineProperty(this,"debouncedHandler",{value:e}),e}handleEvent(){this.updateProps(),this.trigger(this.props),this.debouncedHandler()}kill(){return document.removeEventListener("scroll",this),this}updateProps(){const e=this.props.y,t=this.props.x;return window.pageYOffset!==this.props.y&&(this.props.y=window.pageYOffset),window.pageXOffset!==this.props.x&&(this.props.x=window.pageXOffset),this.props.changed.x=this.props.x!==t,this.props.changed.y=this.props.y!==e,this.props.last.x=t,this.props.last.y=e,this.props.delta.x=this.props.x-t,this.props.delta.y=this.props.y-e,this.props.max.x=(document.scrollingElement||document.body).scrollWidth-window.innerWidth,this.props.max.y=(document.scrollingElement||document.body).scrollHeight-window.innerHeight,this.props.progress.x=0===this.props.max.x?1:this.props.x/this.props.max.x,this.props.progress.y=0===this.props.max.y?1:this.props.y/this.props.max.y,this.props.direction.x=this.props.x>t?"RIGHT":this.props.x<t?"LEFT":"NONE",this.props.direction.y=this.props.y>e?"DOWN":this.props.y<e?"UP":"NONE",this.props}}function O(){return b||(g||(g=new k),b={add:g.add.bind(g),remove:g.remove.bind(g),has:g.has.bind(g),props:g.updateProps.bind(g)}),b}var P={ENTER:13,SPACE:32,TAB:9,ESC:27,LEFT:37,UP:38,RIGHT:39,DOWN:40};class A extends h{constructor(...e){super(...e),this.props={event:null,triggered:0,isUp:!1,isDown:!1,ENTER:!1,SPACE:!1,TAB:!1,ESC:!1,LEFT:!1,UP:!1,RIGHT:!1,DOWN:!1,direction:"none"}}init(){document.addEventListener("keydown",this),document.addEventListener("keyup",this)}handleEvent(e){this.updateProps(e),this.trigger(this.props)}kill(){document.removeEventListener("keydown",this),document.removeEventListener("keyup",this)}updateProps(e){var t;return this.props.event=e,Object.entries(P).forEach(([t,s])=>{this.props[t]=s===e.keyCode}),this.previousEvent||(this.props.triggered=0),"keydown"===this.props.event.type&&"keydown"===(null==(t=this.previousEvent)?void 0:t.type)?this.props.triggered+=1:this.props.triggered=1,this.previousEvent=this.props.event,this.props.direction="keydown"===this.props.event.type?"down":"up",this.props.isUp="keyup"===this.props.event.type,this.props.isDown="keydown"===this.props.event.type,this.props}}let M,N,j,H;function T(){return N||(M||(M=new A),N={add:M.add.bind(M),remove:M.remove.bind(M),has:M.has.bind(M),props:M.updateProps.bind(M)}),N}class B extends h{constructor(...e){super(...e),this.props={time:window.performance.now()}}init(){window.addEventListener("load",this)}handleEvent(){this.updateProps(),this.trigger(this.props)}kill(){window.removeEventListener("load",this)}updateProps(){return this.props.time=window.performance.now(),this.props}}function L(){return H||(j||(j=new B),H={add:j.add.bind(j),remove:j.remove.bind(j),has:j.has.bind(j),props:j.updateProps.bind(j)}),H}const C={scrolled:O,resized:x,ticked:w,moved:v,keyed:T,loaded:L},S=Object.keys(C);class I{get __services(){return e({},this.__customServices,C)}constructor(e){this.__customServices={},Object.defineProperties(this,{__base:{enumerable:!1,writable:!1,value:e}})}has(e){if(!i(this.__base,e)&&!this.__base.__hasEvent(e)||!this.__services[e])return!1;const{has:t}=this.__services[e]();return t(this.__base.$id)}enable(e){if(this.has(e))return this.disable.bind(this,e);if(!i(this.__base,e)&&!this.__base.__hasEvent(e)||!this.__services[e])return function(){};const{add:t}=this.__services[e](),s=this;return t(this.__base.$id,function(...t){s.__base.__callMethod(e,...t)}),this.disable.bind(this,e)}enableAll(){return Object.keys(this.__services).map(e=>this.enable(e))}disableAll(){Object.keys(this.__services).forEach(e=>{this.disable(e)})}disable(e){if(!this.__services[e])return;const{remove:t}=this.__services[e]();t(this.__base.$id)}toggle(e,t){void 0!==t?(t&&!this.has(e)&&this.enable(e),!t&&this.has(e)&&this.disable(e)):this.has(e)?this.disable(e):this.enable(e)}register(e,t){this.__customServices[e]=t,this.__base.__addEmits(e)}unregister(e){if(S.includes(e))throw new Error(`[ServicesManager] The \`${e}\` core service can not be unregistered.`);this.__base.__removeEmits(e),delete this.__customServices[e]}}function R(e,t=[],s=null){const r=Object.getPrototypeOf(e);if(r===Object.prototype||null===r)return t;let i=Object.getOwnPropertyNames(r);return"function"==typeof s&&(i=i.filter(e=>s(e,r))),i=i.map(e=>[e,r]).reduce((e,t)=>[...e,t],t),R(r,i,s)}class W{constructor(e,t){this.__methodsCache=new Map,this.__rootElementHandler={handleEvent:e=>{const t=W.normalizeName(e.type);this.__base[`on${t}`](e)}},this.__refsHandler={handleEvent:e=>{const t=e.currentTarget,s=a.normalizeRefName(t.dataset.ref),r=`on${W.normalizeName(s)}${W.normalizeName(e.type)}`;let i=0;Array.isArray(this.__base.$refs[s])&&(i=this.__base.$refs[s].indexOf(t)),this.__base[r](e,i)}},this.__childrenHandler={handleEvent:e=>{const t=e.currentTarget;let s,r=0;const i=this.__base.$children;i.registeredNames.find(e=>!!i[e].includes(t)&&(s=e,r=i[e].indexOf(t),!0));const n=`on${W.normalizeName(s)}${W.normalizeName(e.type)}`,o=Array.isArray(e.detail)?e.detail:[];this.__base[n](...o,r,e)}},Object.defineProperties(this,{__rootElement:{enumerable:!1,writable:!1,value:e},__base:{enumerable:!1,writable:!1,value:t},__methodsCache:{enumerable:!1,writable:!1,value:this.__methodsCache},__rootElementHandler:{enumerable:!1,writable:!1,value:this.__rootElementHandler},__refsHandler:{enumerable:!1,writable:!1,value:this.__refsHandler},__childrenHandler:{enumerable:!1,writable:!1,value:this.__childrenHandler}})}__manageRef(e,t,s="add"){const r=`${s}EventListener`;this.__getEventMethodsByName(e).forEach(s=>{const i=this.__getEventNameByMethod(s,e);t.forEach(e=>e[r](i,this.__refsHandler))})}bindRef(e,t){this.__manageRef(e,t)}unbindRef(e,t){this.__manageRef(e,t,"remove")}__manageChild(e,t,s="add"){const r="add"===s?"$on":"$off";this.__getEventMethodsByName(e).forEach(s=>{const i=this.__getEventNameByMethod(s,e);t[r](i,this.__childrenHandler)})}bindChild(e,t){this.__manageChild(e,t)}unbindChild(e,t){this.__manageChild(e,t,"remove")}__manageRootElement(e="add"){const t=`${e}EventListener`,s=this.__getEventMethodsByName(),{emits:r=[]}=this.__base.__config;s.forEach(e=>{const s=this.__getEventNameByMethod(e);(r.includes(s)?this.__base:this.__rootElement)[t](s,this.__rootElementHandler)})}bindRootElement(){this.__manageRootElement()}unbindRootElement(){this.__manageRootElement("remove")}__getEventNameByMethod(e,t=""){const s=W.normalizeName(t),r=new RegExp(`^on${s}([A-Z].*)$`),[,i]=e.match(r);return W.normalizeEventName(i)}__getEventMethodsByName(e=""){const t=W.normalizeName(e),s=new RegExp(`^on${t}[A-Z].*$`),r=s.toString();let i=this.__methodsCache.get(r);return i||(i=Array.from(R(this.__base,[],e=>s.test(e)).reduce((e,[t])=>e.add(t),new Set)),this.__methodsCache.set(r,i)),i}static normalizeName(e){return e.replace(/[A-Z]([A-Z].*)/g,e=>e.toLowerCase()).replace(/[^a-zA-Z\d\s:]/g," ").replace(/(^\w|\s+\w)/g,e=>e.trim().toUpperCase()).trim()}static normalizeEventName(e){return e.replace(/[A-Z]/g,e=>`-${e.toLowerCase()}`).replace(/^-/,"")}}var z=function(e){return function(e){return!!e&&"object"==typeof e}(e)&&!function(e){var t=Object.prototype.toString.call(e);return"[object RegExp]"===t||"[object Date]"===t||function(e){return e.$$typeof===F}(e)}(e)},F="function"==typeof Symbol&&Symbol.for?Symbol.for("react.element"):60103;function D(e,t){return!1!==t.clone&&t.isMergeableObject(e)?X(Array.isArray(e)?[]:{},e,t):e}function V(e,t,s){return e.concat(t).map(function(e){return D(e,s)})}function q(e){return Object.keys(e).concat(function(e){return Object.getOwnPropertySymbols?Object.getOwnPropertySymbols(e).filter(function(t){return e.propertyIsEnumerable(t)}):[]}(e))}function Y(e,t){try{return t in e}catch(e){return!1}}function X(e,t,s){(s=s||{}).arrayMerge=s.arrayMerge||V,s.isMergeableObject=s.isMergeableObject||z,s.cloneUnlessOtherwiseSpecified=D;var r=Array.isArray(t);return r===Array.isArray(e)?r?s.arrayMerge(e,t,s):function(e,t,s){var r={};return s.isMergeableObject(e)&&q(e).forEach(function(t){r[t]=D(e[t],s)}),q(t).forEach(function(i){(function(e,t){return Y(e,t)&&!(Object.hasOwnProperty.call(e,t)&&Object.propertyIsEnumerable.call(e,t))})(e,i)||(r[i]=Y(e,i)&&s.isMergeableObject(t[i])?function(e,t){if(!t.customMerge)return X;var s=t.customMerge(e);return"function"==typeof s?s:X}(i,s)(e[i],t[i],s):D(t[i],s))}),r}(e,t,s):D(t,s)}X.all=function(e,t){if(!Array.isArray(e))throw new Error("first argument should be an array");return e.reduce(function(e,s){return X(e,s,t)},{})};var G=X;class U{constructor(e,t,s){var r,i;return this.__values={},this.__defaultValues={String:"",Number:0,Boolean:!1,Array:()=>[],Object:()=>({})},this.name="Base",this.debug=!1,this.log=!1,Object.defineProperties(this,{__element:{enumerable:!1,writable:!1,value:e},__values:{enumerable:!1,writable:!1,value:this.__values},__defaultValues:{enumerable:!1,writable:!1,value:this.__defaultValues}}),this.name=s.name,t.debug={type:Boolean,default:null!=(r=s.debug)&&r},t.log={type:Boolean,default:null!=(i=s.log)&&i},Object.entries(t).forEach(([e,t])=>{this.__register(e,t)}),this}__register(e,t){const s=!U.types.includes(t),r=s?t.type:t;if(!U.types.includes(r))throw new Error(`The "${e}" option has an invalid type. The allowed types are: String, Number, Boolean, Array and Object.`);const i=s?t.default:this.__defaultValues[r.name];if((r===Array||r===Object)&&"function"!=typeof i)throw new Error(`The default value for options of type "${r.name}" must be returned by a function.`);Object.defineProperty(this,e,{get:()=>this.get(e,r,i),set:t=>{this.set(e,r,t,i)},enumerable:!0})}get(e,t,s){const r=U.__getPropertyName(e),i=this.__hasProperty(r);if(t===Boolean){if(s){const t=U.__getPropertyName(e,"No");return!this.__hasProperty(t)}return i||s}const n=this.__element.dataset[r];if(t===Number)return i?Number(n):s;if(t===Array||t===Object){const r=G(s(),i?JSON.parse(n):this.__defaultValues[t.name]());return this.__values[e]||(this.__values[e]=r),this.__values[e]}return i?n:s}set(e,t,s,r){const i=U.__getPropertyName(e);if(s.constructor.name!==t.name){const r=Array.isArray(s)||function(e){return"object"==typeof e&&!!e&&"[object Object]"===e.toString()}(s)?JSON.stringify(s):s;throw new TypeError(`The "${r}" value for the "${e}" option must be of type "${t.name}"`)}switch(t){case Boolean:if(r){const t=U.__getPropertyName(e,"No");s?delete this.__element.dataset[t]:this.__element.dataset[t]=""}else s?this.__element.dataset[i]="":delete this.__element.dataset[i];break;case Array:case Object:this.__values[e]=s;break;default:this.__element.dataset[i]=s}}__hasProperty(e){return void 0!==this.__element.dataset[e]}static __getPropertyName(e,t=""){const s=e+t;if(U.__propertyNameCache.has(s))return U.__propertyNameCache.get(s);const r=`option${t}${e.replace(/^\w/,e=>e.toUpperCase())}`;return U.__propertyNameCache.set(s,r),r}}U.types=[String,Number,Boolean,Array,Object],U.__propertyNameCache=new Map;let Z=0;const J="undefined"!=typeof __DEV__&&__DEV__;function K(){}class Q extends EventTarget{get $root(){if(!this.$parent)return this;let e=this.$parent,t=this.$parent;for(;e;)e.$parent||(t=e),e=e.$parent;return t}get __config(){let t=Object.getPrototypeOf(this),{config:s}=t.constructor;for(;t.constructor.config&&t.constructor.$isBase;)s=e({},t.constructor.config,s),t.constructor.config.options&&(s.options=e({},t.constructor.config.options,s.options)),t.constructor.config.emits&&s.emits&&(s.emits=[...t.constructor.config.emits,...s.emits]),t=Object.getPrototypeOf(t);return s}get $services(){return this.__services}get $refs(){return this.__refs}get $options(){return this.__options}get $children(){return this.__children}get $log(){return this.__options.log?window.console.log.bind(window,`[${this.__config.name}]`):K}get __debug(){return J&&this.__options.debug?window.console.log.bind(window,`[debug] [${this.$id}]`):K}__callMethod(e,...t){J&&this.__debug("callMethod",e,...t),this.$emit(e,...t),"function"==typeof this[e]&&(this[e].call(this,...t),J&&this.__debug(e,this,...t))}__hasEvent(e){const t=this.__eventHandlers.get(e);return t&&t.size>0}constructor(e){if(super(),this.$parent=null,this.$isMounted=!1,this.__eventHandlers=new Map,!e)throw new Error("The root element must be defined.");const{__config:t}=this;if("Base"===t.name)throw new Error("The `config.name` property is required.");return this.$id=`${t.name}-${Z}`,Z+=1,this.$el=e,"__base__"in this.$el||Object.defineProperty(this.$el,"__base__",{get:()=>this,configurable:!0}),this.__options=new U(e,t.options||{},t),this.__services=new I(this),this.__events=new W(e,this),this.__children=new o(this,e,t.components||{},this.__events),this.__refs=new a(this,e,t.refs||[],this.__events),J&&this.__debug("constructor",this),this}$mount(){return this.$isMounted||(this.$isMounted=!0,J&&this.__debug("$mount"),this.$children.registerAll(),this.$refs.registerAll(),this.__events.bindRootElement(),this.$services.enableAll(),this.$children.mountAll(),this.__callMethod("mounted")),this}$update(){return J&&this.__debug("$update"),this.$refs.unregisterAll(),this.$services.disableAll(),this.$children.registerAll(),this.$refs.registerAll(),this.$services.enableAll(),this.$children.updateAll(),this.__callMethod("updated"),this}$destroy(){return this.$isMounted?(this.$isMounted=!1,J&&this.__debug("$destroy"),this.__events.unbindRootElement(),this.$refs.unregisterAll(),this.$services.disableAll(),this.$children.destroyAll(),this.__callMethod("destroyed"),this):this}$terminate(){J&&this.__debug("$terminate"),this.$destroy(),this.__callMethod("terminated"),Object.defineProperty(this.$el,"__base__",{value:"terminated",configurable:!1,writable:!1})}__testEventIsDefined(e){Array.isArray(this.__config.emits)&&this.__config.emits.includes(e)||console.warn(`[${this.__config.name}]`,`The "${e}" event is missing from the configuration.`)}__addEmits(e){const t=this.constructor;Array.isArray(t.config.emits)?t.config.emits.push(e):t.config.emits=[e]}__removeEmits(e){const t=this.constructor,s=t.config.emits.findIndex(t=>t===e);t.config.emits.splice(s,1)}$on(e,t,s){J&&this.__debug("$on",e,t,s),J&&this.__testEventIsDefined(e);let r=this.__eventHandlers.get(e);return r||(r=new Set,this.__eventHandlers.set(e,r)),r.add(t),this.addEventListener(e,t,s),()=>{this.$off(e,t,s)}}$off(e,t,s){J&&this.__debug("$off",e,t),J&&this.__testEventIsDefined(e),this.__eventHandlers.get(e).delete(t),this.removeEventListener(e,t,s)}$emit(e,...t){J&&this.__debug("$emit",e,t),J&&this.__testEventIsDefined(e),this.dispatchEvent(new CustomEvent(e,{detail:t}))}static $factory(e){if(!e)throw new Error("The $factory method requires a component’s name or selector to be specified.");return n(e).map(e=>new this(e).$mount())}}function ee(e){const{breakpoint:t}=x().props();e.forEach(([e,s])=>{e.includes(t)&&!s.$isMounted?setTimeout(()=>s.$mount(),0):!e.includes(t)&&s.$isMounted&&s.$destroy()})}Q.$isBase=!0,Q.config={name:"Base",emits:["mounted","updated","destroyed","terminated","ticked","scrolled","resized","moved","loaded"]};const te=new WeakMap;function se(e,t){if(!Array.isArray(t))throw new Error("[withBreakpointManager] The `breakpoints` parameter must be an array.");if(t.length<2)throw new Error("[withBreakpointManager] You must define at least 2 breakpoints.");const{add:s,props:r}=x();if(!r().breakpoint)throw new Error("The `BreakpointManager` class requires breakpoints to be defined.");return class extends e{constructor(e){return super(e),te.has(this)||te.set(this,function(e,t){return t.map(([t,s])=>{const r=new s(e.$el);return Object.defineProperty(r,"$parent",{get:()=>e.$parent}),[t,r]})}(this,t)),s(`BreakpointManager-${this.$id}`,()=>{ee(te.get(this))}),this.instances=te.get(this),this}$mount(){return super.$mount(),ee(te.get(this)),this}$destroy(){return Array.isArray(te.get(this))&&te.get(this).forEach(([,e])=>{e.$destroy()}),super.$destroy()}}}function re(e,t=x().props().breakpoint){const{activeBreakpoints:s,inactiveBreakpoints:r}=e.$options,i=s&&s.split(" ").includes(t),n=r&&r.split(" ").includes(t);return s&&i||r&&!n?"$mount":"$destroy"}function ie(e){const{activeBreakpoints:t,inactiveBreakpoints:s}=e.$options;return Boolean(t||s)}function ne(e,t){!function(e){const{activeBreakpoints:t,inactiveBreakpoints:s,name:r}=e.$options;if(t&&s)throw new Error(`[${r}] Incorrect configuration: the \`activeBreakpoints\` and \`inactiveBreakpoints\` are not compatible.`)}(t);const{add:s,has:r}=x();r(e)||s(e,function({breakpoint:e}){const s=re(t,e);"$destroy"===s&&t.$isMounted?t[s]():"$mount"!==s||t.$isMounted||setTimeout(()=>t[s](),0)})}function oe(t){var s,r,i,n,o;return r=s=class extends t{constructor(e){super(e);const{remove:t,props:s}=x(),{name:r}=this.$options;if(!s().breakpoint)throw new Error(`[${r}] The \`BreakpointObserver\` class requires breakpoints to be defined.`);const i=`BreakpointObserver-${this.$id}`;return new MutationObserver(([e])=>{if("attributes"===e.type&&("data-options"===e.attributeName||e.attributeName.startsWith("data-option-"))){if(!ie(this))return this.$mount(),void t(i);ne(i,this)}}).observe(this.$el,{attributes:!0}),ie(this)?(ne(i,this),this):this}$mount(){return ie(this)?"$mount"===re(this)?super.$mount():this:super.$mount()}},s.config=e({},t.config||{},{name:`${null!=(i=null==t||null==(n=t.config)?void 0:n.name)?i:""}WithBreakpointObserver`,options:e({},(null==t||null==(o=t.config)?void 0:o.options)||{},{activeBreakpoints:String,inactiveBreakpoints:String})}),r}function ae(e,t,s=.85){if(s>=1||s<=0)throw new Error(`The \`factor\` parameter must be a number greater than 0 and smaller than 1, \`${s}\` given.`);let r=t,i=e;for(;Math.abs(r)>.1;)i+=r,r*=s;return i}let he=0;class pe extends h{constructor(t,s={}){return super(),this.props={target:null,mode:void 0,isGrabbing:!1,hasInertia:!1,x:0,y:0,delta:{x:0,y:0},origin:{x:0,y:0},distance:{x:0,y:0},final:{x:0,y:0}},this.options={dampFactor:.85},he+=1,this.id=`drag-${he}`,this.props.target=t,this.options=e({},this.options,s),this.pointerHandler=this.pointerHandler.bind(this),this.rafHandler=this.rafHandler.bind(this),this}init(){const e={passive:!0};return this.props.target.addEventListener("mousedown",this,e),this.props.target.addEventListener("touchstart",this,e),v().add(this.id,this.pointerHandler),this}kill(){return this.props.target.removeEventListener("mousemove",this),this.props.target.removeEventListener("touchmove",this),v().remove(this.id),this}handleEvent(e){const t=e instanceof MouseEvent?e.clientX:e.touches[0].clientX,s=e instanceof MouseEvent?e.clientY:e.touches[0].clientY;this.start(t,s)}start(e,t){this.props.x=e,this.props.y=t,this.props.origin.x=e,this.props.origin.y=t,this.props.delta.x=0,this.props.delta.y=0,this.props.distance.x=0,this.props.distance.y=0,this.props.final.x=e,this.props.final.y=t,this.props.mode="start",this.props.isGrabbing=!0,this.trigger(this.props)}drop(){this.props.isGrabbing=!1,this.props.mode="drop",this.props.hasInertia=!0,this.props.final.x=ae(this.props.x,this.props.delta.x,this.options.dampFactor),this.props.final.y=ae(this.props.y,this.props.delta.y,this.options.dampFactor),this.trigger(this.props),setTimeout(()=>{const e=w();e.remove(this.id),e.add(this.id,this.rafHandler)},0)}stop(){w().remove(this.id),this.props.hasInertia=!1,this.props.mode="stop",this.trigger(this.props)}rafHandler(){this.props.isGrabbing||(this.props.x+=this.props.delta.x,this.props.y+=this.props.delta.y,this.props.distance.x=this.props.x-this.props.origin.x,this.props.distance.y=this.props.y-this.props.origin.y,this.props.delta.x*=this.options.dampFactor,this.props.delta.y*=this.options.dampFactor,"inertia"!==this.props.mode&&(this.props.mode="inertia"),this.trigger(this.props),Math.abs(this.props.delta.x)<.1&&Math.abs(this.props.delta.y)<.1&&this.stop())}pointerHandler(e){this.props.isGrabbing&&(this.props.x=e.x,this.props.y=e.y,this.props.delta.x=e.delta.x,this.props.delta.y=e.delta.y,this.props.final.x=e.x,this.props.final.y=e.y,this.props.distance.x=this.props.x-this.props.origin.x,this.props.distance.y=this.props.y-this.props.origin.y,"drag"!==this.props.mode&&(this.props.mode="drag"),this.trigger(this.props),e.isDown||this.drop())}updateProps(){return this.props}}const de=new WeakMap;function ce(e,t){let s=de.get(e);if(!s){const r=new pe(e,t);s={add:r.add.bind(r),remove:r.remove.bind(r),has:r.has.bind(r),props:r.updateProps.bind(r)},de.set(e,s)}return s}const le=["target"];function ue(e,t={}){var s,r;let{target:i=(e=>e.$el)}=t,n=function(e,t){if(null==e)return{};var s,r,i={},n=Object.keys(e);for(r=0;r<n.length;r++)t.indexOf(s=n[r])>=0||(i[s]=e[s]);return i}(t,le);return r=s=class extends e{constructor(e){super(e),this.$on("mounted",()=>{this.$services.register("dragged",ce.bind(void 0,i.call(this,this),n)),this.$services.enable("dragged")}),this.$on("destroyed",()=>{this.$services.disable("dragged"),this.$services.unregister("dragged")})}},s.config={name:`${e.config.name}WithDrag`,emits:["dragged"]},r}function _e(e,t,s={}){var r,i;const n=G(e.config,t,s);return n.name===e.config.name&&(n.name=`${e.config.name}WithExtraConfig`),i=r=class extends e{},r.config=n,i}function me(e){return[...new Array(e+1)].map((t,s)=>s/e)}function fe(t,s={threshold:me(100)}){var r,i,n,o,a;return i=r=class extends t{constructor(t){if(super(t),!this.intersected||"function"!=typeof this.intersected)throw new Error("[withIntersectionObserver] The `intersected` method must be defined.");return this.$observer=new IntersectionObserver(e=>{this.__callMethod("intersected",e)},e({},s,this.$options.intersectionObserver||{})),this.$on("mounted",()=>{this.$observer.observe(this.$el)}),this.$on("destroyed",()=>{this.$observer.unobserve(this.$el)}),this}},r.config=e({},t.config||{},{name:`${null!=(n=null==t||null==(o=t.config)?void 0:o.name)?n:""}WithIntersectionObserver`,options:e({},(null==t||null==(a=t.config)?void 0:a.options)||{},{intersectionObserver:Object}),emits:["intersected"]}),i}function ge(t,i={threshold:[0,1]}){var n,o,a,h,p,d,c;return o=s("isVisible"),a=s("observer"),h=n=class extends t{constructor(t){return super(t),Object.defineProperty(this,o,{writable:!0,value:!1}),Object.defineProperty(this,a,{writable:!0,value:void 0}),r(this,a)[a]=new IntersectionObserver(e=>{const t=e.reduce((e,t)=>e||t.isIntersecting,!1);r(this,o)[o]!==t&&(r(this,o)[o]=t,t?this.$mount():setTimeout(()=>this.$destroy()))},e({},i,this.$options.intersectionObserver)),r(this,a)[a].observe(this.$el),this.$on("terminated",()=>{r(this,a)[a].disconnect()}),this}$mount(){return r(this,o)[o]&&super.$mount(),this}},n.config=e({},t.config||{},{name:`${null!=(p=null==t||null==(d=t.config)?void 0:d.name)?p:""}WithMountWhenInView`,options:e({},(null==t||null==(c=t.config)?void 0:c.options)||{},{intersectionObserver:Object})}),h}function be(e,t,s){return t<s?e<t?t:e>s?s:e:e<s?s:e>t?t:e}function ve(e){return be(e,0,1)}function ye(e,t,s=.5,r=.01){return Math.abs(e-t)<r?e:t+(e-t)*s}function we(e){var t,s;return s=t=class extends(ge(e)){constructor(...e){super(...e),this.__props={start:{x:0,y:0},end:{x:0,y:0},current:{x:0,y:0},progress:{x:0,y:0},dampedProgress:{x:0,y:0}},this.dampFactor=.1,this.dampPrecision=.001}mounted(){this.__setProps()}resized(){this.__setProps()}scrolled(e){(!this.$services.has("ticked")&&e.changed.y||e.changed.x)&&this.$services.enable("ticked")}ticked(){this.__props.current.x=be(window.pageXOffset,this.__props.start.x,this.__props.end.x),this.__props.progress.x=ve((this.__props.current.x-this.__props.start.x)/(this.__props.end.x-this.__props.start.x)),this.__props.dampedProgress.x=ye(this.__props.progress.x,this.__props.dampedProgress.x,this.dampFactor,this.dampPrecision),this.__props.current.y=be(window.pageYOffset,this.__props.start.y,this.__props.end.y),this.__props.progress.y=ve((this.__props.current.y-this.__props.start.y)/(this.__props.end.y-this.__props.start.y)),this.__props.dampedProgress.y=ye(this.__props.progress.y,this.__props.dampedProgress.y,this.dampFactor,this.dampPrecision),this.__props.dampedProgress.x===this.__props.progress.x&&this.__props.dampedProgress.y===this.__props.progress.y&&this.$services.disable("ticked"),this.__callMethod("scrolledInView",this.__props)}__setProps(){const e=this.$el.getBoundingClientRect(),t=e.top+window.pageYOffset+e.height,s=t-window.innerHeight-e.height,r=be(window.pageYOffset,s,t),i=ve((r-s)/(t-s)),n=e.left+window.pageXOffset+e.width,o=n-window.innerWidth-e.width,a=be(window.pageXOffset,o,n),h=ve((a-o)/(n-o));this.__props.start.x=o,this.__props.start.y=s,this.__props.end.x=n,this.__props.end.y=t,this.__props.current.x=a,this.__props.current.y=r,this.__props.progress.x=h,this.__props.progress.y=i,this.__props.dampedProgress.x=ye(h,this.__props.dampedProgress.x),this.__props.dampedProgress.y=ye(i,this.__props.dampedProgress.y)}},t.config={name:`${e.config.name}WithMountWhenInView`,emits:["scrolledInView"]},s}var $e=(t,s)=>{var r,i,n,o,a,h;return i=r=class extends t{constructor(e){super(e);const{vueConfig:t}=this.constructor;if(!t)throw new Error("[withVue] You must define a `vueConfig` object.");if("function"!=typeof t.render)throw new Error("[withVue] You must define a `render` function in vueConfig.");this.$vue=new s(t),this.$on("mounted",()=>{if(!(this.$refs.vue instanceof HTMLElement))throw new Error("[withVue] The `vue` refs must be a single HTMLElement.");this.$vue.$mount(this.$refs.vue)}),this.$on("destroyed",()=>{this.$vue.$destroy()})}},r.config=e({},t.config||{},{name:`${null!=(n=null==t||null==(o=t.config)?void 0:o.name)?n:""}WithVue`,refs:[...null!=(a=null==t||null==(h=t.config)?void 0:h.refs)?a:[],"vue"]}),i};function Ee(e,t){let s,r="complete"===document.readyState;r?s=new e(t).$mount():document.addEventListener("readystatechange",()=>{"complete"===document.readyState&&(s=new e(t).$mount(),r=!0)});const i=new Promise(e=>{document.addEventListener("readystatechange",()=>{"complete"===document.readyState&&setTimeout(()=>e(s),0)})});return function(){return r?Promise.resolve(s):i}}function xe(e,t){return"string"==typeof e?n(e,t):Array.isArray(e)?e:[e]}function ke(e,t,s,r){const i="string"==typeof s?[s]:s;let n;return new Promise(s=>{const o=xe(t,null==r?void 0:r.$el),a={capture:!0,passive:!0,once:!0},h=()=>{(t=>{e().then(e=>{n="default"in e?e.default:e,t(n)})})(s)};o.forEach(e=>{i.forEach(t=>{e.addEventListener(t,h,a)})})})}function Oe(e,t){let s;const r=t=>{e().then(e=>{s="default"in e?e.default:e,t(s)})};return new Promise(e=>{var s;const i=null!=(s=null==t?void 0:t.timeout)?s:1;"requestIdleCallback"in window?window.requestIdleCallback(()=>{setTimeout(()=>{r(e)},0)},{timeout:null==t?void 0:t.timeout}):setTimeout(()=>{r(e)},i)})}function Pe(e,t,s,r={}){let i;return new Promise(n=>{const o=new IntersectionObserver(t=>{t.some(e=>e.isIntersecting)&&setTimeout(()=>{((t,s)=>{e().then(e=>{i="default"in e?e.default:e,t(i),o.disconnect()})})(n)},0)},r);xe(t,null==s?void 0:s.$el).forEach(e=>o.observe(e))})}export{Q as Base,Ee as createApp,ke as importOnInteraction,Oe as importWhenIdle,Pe as importWhenVisible,ce as useDrag,T as useKey,L as useLoad,v as usePointer,w as useRaf,x as useResize,O as useScroll,se as withBreakpointManager,oe as withBreakpointObserver,ue as withDrag,_e as withExtraConfig,fe as withIntersectionObserver,ge as withMountWhenInView,we as withScrolledInView,$e as withVue2};
|
|
1
|
+
function e(){return e=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var s=arguments[t];for(var r in s)Object.prototype.hasOwnProperty.call(s,r)&&(e[r]=s[r])}return e},e.apply(this,arguments)}var t=0;function s(e){return"__private_"+t+++"_"+e}function r(e,t){if(!Object.prototype.hasOwnProperty.call(e,t))throw new TypeError("attempted to use private field on non-instance");return e}function i(e,t){return"function"==typeof e[t]}function n(e,t=document){const s=`[data-component="${e}"]`;let r=[];try{r=Array.from(t.querySelectorAll(s))}catch(e){}return 0===r.length&&(r=Array.from(t.querySelectorAll(e))),r}class o{get registeredNames(){return Object.keys(this).filter(e=>!e.startsWith("__"))}constructor(e,t,s,r){Object.defineProperties(this,{__base:{enumerable:!1,writable:!1,value:e},__element:{enumerable:!1,writable:!1,value:t},__components:{enumerable:!1,writable:!1,value:s},__eventsManager:{enumerable:!1,writable:!1,value:r}})}registerAll(){Object.entries(this.__components).forEach(([e,t])=>this.__register(e,t))}__register(e,t){Object.defineProperty(this,e,{enumerable:!0,configurable:!0,get:()=>{const s=n(e,this.__element);return 0===s.length?[]:s.map(s=>this.__getChild(s,t,e)).filter(e=>"terminated"!==e)}})}__getChild(e,t,s){if(e.__base__)return e.__base__;if("$isBase"in t){const s=new t(e);return Object.defineProperty(s,"$parent",{get:()=>this.__base}),s}return t(this.__base).then(t=>{var r;return this.__getChild(e,null!=(r=t.default)?r:t,s)})}mountAll(){this.__triggerHookForAll("$mount")}updateAll(){this.__triggerHookForAll("$update")}destroyAll(){this.__triggerHookForAll("$destroy")}__triggerHookForAll(e){this.registeredNames.forEach(t=>{this[t].forEach(s=>{s instanceof Promise?s.then(s=>this.__triggerHook(e,s,t)):this.__triggerHook(e,s,t)})})}__triggerHook(e,t,s){"$update"!==e||t.$isMounted||(e="$mount"),"$update"!==e&&"$destroy"!==e||this.__eventsManager.unbindChild(s,t),"$update"!==e&&"$mount"!==e||this.__eventsManager.bindChild(s,t),t[e]()}}class a{constructor(e,t,s,r){Object.defineProperties(this,{__element:{enumerable:!1,writable:!1,value:t},__refs:{enumerable:!1,writable:!1,value:s},__base:{enumerable:!1,writable:!1,value:e},__eventsManager:{enumerable:!1,writable:!1,value:r}})}registerAll(){this.__refs.forEach(e=>this.__register(e))}unregisterAll(){this.__refs.forEach(e=>this.__unregister(e))}__register(e){const t=e.endsWith("[]"),s=a.normalizeRefName(e),r=Array.from(this.__element.querySelectorAll(`[data-ref="${e}"]`)).filter(e=>this.__filterRefsBelongingToInstance(e));!t&&r.length>1&&console.warn(`[${this.__base.$options.name}]`,`The "${e}" ref has been found multiple times.`,"Did you forgot to add the `[]` suffix to its name?"),!t&&r.length<=1&&void 0===r[0]?console.warn(`[${this.__base.$options.name}]`,`The "${e}" ref is missing.`,`Is there an \`[data-ref="${e}"]\` element in the component's scope?`):(this.__eventsManager.bindRef(e,r),Object.defineProperty(this,s,{value:t||r.length>1?r:r[0],enumerable:!0,configurable:!0}))}__unregister(e){const t=a.normalizeRefName(e),s=Array.isArray(this[t])?this[t]:[this[t]];this.__eventsManager.unbindRef(e,s)}static normalizeRefName(e){return e.endsWith("[]")?e.replace(/\[\]$/,""):e}__filterRefsBelongingToInstance(e){let t=e.parentElement;for(;t&&void 0===t.dataset.component;)t=t.parentElement;return null===t||t===this.__element}}class h{constructor(){this.callbacks=new Map,this.isInit=!1}updateProps(...e){throw this.props=e,new Error("The `updateProps` method must be implemented.")}init(){throw new Error("The `init` method must be implemented.")}kill(){throw new Error("The `kill` method must be implemented.")}add(e,t){if(this.has(e))throw new Error(`A callback with the key \`${e}\` has already been registered.`);0!==this.callbacks.size||this.isInit||(this.init(),this.isInit=!0),this.callbacks.set(e,t)}has(e){return this.callbacks.has(e)}get(e){return this.callbacks.get(e)}remove(e){this.callbacks.delete(e),0===this.callbacks.size&&this.isInit&&(this.kill(),this.isInit=!1)}trigger(...e){return this.callbacks.forEach(function(t){t(...e)}),this}}function p(e){return"undefined"!=typeof TouchEvent&&e instanceof TouchEvent}class d extends h{constructor(...e){super(...e),this.props={event:null,isDown:!1,x:window.innerWidth/2,y:window.innerHeight/2,changed:{x:!1,y:!1},last:{x:window.innerWidth/2,y:window.innerHeight/2},delta:{x:0,y:0},progress:{x:.5,y:.5},max:{x:window.innerWidth,y:window.innerHeight}},this.hasRaf=!1}init(){document.documentElement.addEventListener("mouseenter",this,{once:!0,capture:!0});const e={passive:!0,capture:!0};return document.addEventListener("mousemove",this,e),document.addEventListener("touchmove",this,e),document.addEventListener("mousedown",this,e),document.addEventListener("touchstart",this,e),document.addEventListener("mouseup",this,e),document.addEventListener("touchend",this,e),this}handleEvent(e){switch(e.type){case"mouseenter":case"mousemove":case"touchmove":this.handler(e);break;case"mousedown":case"touchstart":this.downHandler();break;case"mouseup":case"touchend":this.upHandler()}}kill(){return document.removeEventListener("mousemove",this),document.removeEventListener("touchmove",this),document.removeEventListener("mousedown",this),document.removeEventListener("touchstart",this),document.removeEventListener("mouseup",this),document.removeEventListener("touchend",this),this}handler(e){this.updateProps(e),this.trigger(this.props)}downHandler(){this.props.isDown=!0,this.trigger(this.props)}upHandler(){this.props.isDown=!1,this.trigger(this.props)}updateProps(e){var t,s;this.props.event=e;const r=this.props.y,i=this.props.x,n=p(e)?null==(t=e.touches[0])?void 0:t.clientY:e.clientY;n!==this.props.y&&(this.props.y=n);const o=p(e)?null==(s=e.touches[0])?void 0:s.clientX:e.clientX;return o!==this.props.x&&(this.props.x=o),this.props.changed.x=this.props.x!==i,this.props.changed.y=this.props.y!==r,this.props.last.x=i,this.props.last.y=r,this.props.delta.x=this.props.x-i,this.props.delta.y=this.props.y-r,this.props.max.x=window.innerWidth,this.props.max.y=window.innerHeight,this.props.progress.x=this.props.x/this.props.max.x,this.props.progress.y=this.props.y/this.props.max.y,this.props}}let c,l,u,_,m,f,g,b;function v(){return l||(c||(c=new d),l={add:c.add.bind(c),remove:c.remove.bind(c),has:c.has.bind(c),props:c.updateProps.bind(c)}),l}class y extends h{constructor(...e){super(...e),this.isTicking=!1,this.id=0,this.raf="undefined"!=typeof window&&window.requestAnimationFrame?window.requestAnimationFrame.bind(window):setTimeout,this.cancelRaf="undefined"!=typeof window&&window.cancelAnimationFrame?window.cancelAnimationFrame.bind(window):clearTimeout,this.props={time:performance.now()}}init(){this.isTicking=!0,this.loop()}loop(){this.updateProps(),this.trigger(this.props),this.isTicking&&(this.id=this.raf(()=>this.loop()))}kill(){this.cancelRaf(this.id),this.isTicking=!1}updateProps(){return this.props.time=window.performance.now(),this.props}}function w(){return _||(u||(u=new y),_={add:u.add.bind(u),remove:u.remove.bind(u),has:u.has.bind(u),props:u.updateProps.bind(u)}),_}function $(e,t=300){let s;return function(...r){clearTimeout(s),s=setTimeout(()=>{e(...r)},t)}}class E extends h{constructor(...e){super(...e),this.props={width:window.innerWidth,height:window.innerHeight,ratio:window.innerWidth/window.innerHeight,orientation:"square"}}init(){return this.handler=$(()=>{this.updateProps(),this.trigger(this.props)}).bind(this),window.addEventListener("resize",this.handler),this}kill(){window.removeEventListener("resize",this.handler)}updateProps(){return this.props.width=window.innerWidth,this.props.height=window.innerHeight,this.props.ratio=window.innerWidth/window.innerHeight,this.props.orientation="square",this.props.ratio>1&&(this.props.orientation="landscape"),this.props.ratio<1&&(this.props.orientation="portrait"),this.breakpointElement?(this.props.breakpoint=this.breakpoint,this.props.breakpoints=this.breakpoints):(this.props.breakpoint=void 0,this.props.breakpoints=void 0),this.props}get breakpointElement(){return document.querySelector("[data-breakpoint]")}get breakpoint(){return window.getComputedStyle(this.breakpointElement,"::before").getPropertyValue("content").replace(/"/g,"")}get breakpoints(){return window.getComputedStyle(this.breakpointElement,"::after").getPropertyValue("content").replace(/"/g,"").split(",")}}function x(){if(!f){m||(m=new E);const e=m.add.bind(m),t=m.remove.bind(m),s=m.has.bind(m),r=m.updateProps.bind(m);f={add:e,remove:t,has:s,props:r}}return f}class k extends h{constructor(...e){super(...e),this.props={x:window.pageXOffset,y:window.pageYOffset,changed:{x:!1,y:!1},last:{x:window.pageXOffset,y:window.pageYOffset},delta:{x:0,y:0},max:{x:(document.scrollingElement||document.body).scrollWidth-window.innerWidth,y:(document.scrollingElement||document.body).scrollHeight-window.innerHeight},progress:{x:0,y:0},direction:{x:"NONE",y:"NONE"}}}init(){return this.updateProps(),document.addEventListener("scroll",this,{passive:!0,capture:!0}),this}get debouncedHandler(){const e=$(()=>{this.updateProps(),this.trigger(this.props)},100);return Object.defineProperty(this,"debouncedHandler",{value:e}),e}handleEvent(){this.updateProps(),this.trigger(this.props),this.debouncedHandler()}kill(){return document.removeEventListener("scroll",this),this}updateProps(){const e=this.props.y,t=this.props.x;return window.pageYOffset!==this.props.y&&(this.props.y=window.pageYOffset),window.pageXOffset!==this.props.x&&(this.props.x=window.pageXOffset),this.props.changed.x=this.props.x!==t,this.props.changed.y=this.props.y!==e,this.props.last.x=t,this.props.last.y=e,this.props.delta.x=this.props.x-t,this.props.delta.y=this.props.y-e,this.props.max.x=(document.scrollingElement||document.body).scrollWidth-window.innerWidth,this.props.max.y=(document.scrollingElement||document.body).scrollHeight-window.innerHeight,this.props.progress.x=0===this.props.max.x?1:this.props.x/this.props.max.x,this.props.progress.y=0===this.props.max.y?1:this.props.y/this.props.max.y,this.props.direction.x=this.props.x>t?"RIGHT":this.props.x<t?"LEFT":"NONE",this.props.direction.y=this.props.y>e?"DOWN":this.props.y<e?"UP":"NONE",this.props}}function O(){return b||(g||(g=new k),b={add:g.add.bind(g),remove:g.remove.bind(g),has:g.has.bind(g),props:g.updateProps.bind(g)}),b}var P={ENTER:13,SPACE:32,TAB:9,ESC:27,LEFT:37,UP:38,RIGHT:39,DOWN:40};class A extends h{constructor(...e){super(...e),this.props={event:null,triggered:0,isUp:!1,isDown:!1,ENTER:!1,SPACE:!1,TAB:!1,ESC:!1,LEFT:!1,UP:!1,RIGHT:!1,DOWN:!1,direction:"none"}}init(){document.addEventListener("keydown",this),document.addEventListener("keyup",this)}handleEvent(e){this.updateProps(e),this.trigger(this.props)}kill(){document.removeEventListener("keydown",this),document.removeEventListener("keyup",this)}updateProps(e){var t;return this.props.event=e,Object.entries(P).forEach(([t,s])=>{this.props[t]=s===e.keyCode}),this.previousEvent||(this.props.triggered=0),"keydown"===this.props.event.type&&"keydown"===(null==(t=this.previousEvent)?void 0:t.type)?this.props.triggered+=1:this.props.triggered=1,this.previousEvent=this.props.event,this.props.direction="keydown"===this.props.event.type?"down":"up",this.props.isUp="keyup"===this.props.event.type,this.props.isDown="keydown"===this.props.event.type,this.props}}let M,N,j,H;function T(){return N||(M||(M=new A),N={add:M.add.bind(M),remove:M.remove.bind(M),has:M.has.bind(M),props:M.updateProps.bind(M)}),N}class B extends h{constructor(...e){super(...e),this.props={time:window.performance.now()}}init(){window.addEventListener("load",this)}handleEvent(){this.updateProps(),this.trigger(this.props)}kill(){window.removeEventListener("load",this)}updateProps(){return this.props.time=window.performance.now(),this.props}}function L(){return H||(j||(j=new B),H={add:j.add.bind(j),remove:j.remove.bind(j),has:j.has.bind(j),props:j.updateProps.bind(j)}),H}const C={scrolled:O,resized:x,ticked:w,moved:v,keyed:T,loaded:L},S=Object.keys(C);class I{get __services(){return e({},this.__customServices,C)}constructor(e){this.__customServices={},Object.defineProperties(this,{__base:{enumerable:!1,writable:!1,value:e}})}has(e){if(!i(this.__base,e)&&!this.__base.__hasEvent(e)||!this.__services[e])return!1;const{has:t}=this.__services[e]();return t(this.__base.$id)}enable(e){if(this.has(e))return this.disable.bind(this,e);if(!i(this.__base,e)&&!this.__base.__hasEvent(e)||!this.__services[e])return function(){};const{add:t}=this.__services[e](),s=this;return t(this.__base.$id,function(...t){s.__base.__callMethod(e,...t)}),this.disable.bind(this,e)}enableAll(){return Object.keys(this.__services).map(e=>this.enable(e))}disableAll(){Object.keys(this.__services).forEach(e=>{this.disable(e)})}disable(e){if(!this.__services[e])return;const{remove:t}=this.__services[e]();t(this.__base.$id)}toggle(e,t){void 0!==t?(t&&!this.has(e)&&this.enable(e),!t&&this.has(e)&&this.disable(e)):this.has(e)?this.disable(e):this.enable(e)}register(e,t){this.__customServices[e]=t,this.__base.__addEmits(e)}unregister(e){if(S.includes(e))throw new Error(`[ServicesManager] The \`${e}\` core service can not be unregistered.`);this.__base.__removeEmits(e),delete this.__customServices[e]}}function R(e,t=[],s=null){const r=Object.getPrototypeOf(e);if(r===Object.prototype||null===r)return t;let i=Object.getOwnPropertyNames(r);return"function"==typeof s&&(i=i.filter(e=>s(e,r))),i=i.map(e=>[e,r]).reduce((e,t)=>[...e,t],t),R(r,i,s)}class W{constructor(e,t){this.__methodsCache=new Map,this.__rootElementHandler={handleEvent:e=>{const t=W.normalizeName(e.type);this.__base[`on${t}`](e)}},this.__refsHandler={handleEvent:e=>{const t=e.currentTarget,s=a.normalizeRefName(t.dataset.ref),r=`on${W.normalizeName(s)}${W.normalizeName(e.type)}`;let i=0;Array.isArray(this.__base.$refs[s])&&(i=this.__base.$refs[s].indexOf(t)),this.__base[r](e,i)}},this.__childrenHandler={handleEvent:e=>{const t=e.currentTarget;let s,r=0;const i=this.__base.$children;i.registeredNames.find(e=>!!i[e].includes(t)&&(s=e,r=i[e].indexOf(t),!0));const n=`on${W.normalizeName(s)}${W.normalizeName(e.type)}`,o=Array.isArray(e.detail)?e.detail:[];this.__base[n](...o,r,e)}},Object.defineProperties(this,{__rootElement:{enumerable:!1,writable:!1,value:e},__base:{enumerable:!1,writable:!1,value:t},__methodsCache:{enumerable:!1,writable:!1,value:this.__methodsCache},__rootElementHandler:{enumerable:!1,writable:!1,value:this.__rootElementHandler},__refsHandler:{enumerable:!1,writable:!1,value:this.__refsHandler},__childrenHandler:{enumerable:!1,writable:!1,value:this.__childrenHandler}})}__manageRef(e,t,s="add"){const r=`${s}EventListener`;this.__getEventMethodsByName(e).forEach(s=>{const i=this.__getEventNameByMethod(s,e);t.forEach(e=>e[r](i,this.__refsHandler))})}bindRef(e,t){this.__manageRef(e,t)}unbindRef(e,t){this.__manageRef(e,t,"remove")}__manageChild(e,t,s="add"){const r="add"===s?"$on":"$off";this.__getEventMethodsByName(e).forEach(s=>{const i=this.__getEventNameByMethod(s,e);t[r](i,this.__childrenHandler)})}bindChild(e,t){this.__manageChild(e,t)}unbindChild(e,t){this.__manageChild(e,t,"remove")}__manageRootElement(e="add"){const t=`${e}EventListener`,s=this.__getEventMethodsByName(),{emits:r=[]}=this.__base.__config;s.forEach(e=>{const s=this.__getEventNameByMethod(e);(r.includes(s)?this.__base:this.__rootElement)[t](s,this.__rootElementHandler)})}bindRootElement(){this.__manageRootElement()}unbindRootElement(){this.__manageRootElement("remove")}__getEventNameByMethod(e,t=""){const s=W.normalizeName(t),r=new RegExp(`^on${s}([A-Z].*)$`),[,i]=e.match(r);return W.normalizeEventName(i)}__getEventMethodsByName(e=""){const t=W.normalizeName(e),s=new RegExp(`^on${t}[A-Z].*$`),r=s.toString();let i=this.__methodsCache.get(r);return i||(i=Array.from(R(this.__base,[],e=>s.test(e)).reduce((e,[t])=>e.add(t),new Set)),this.__methodsCache.set(r,i)),i}static normalizeName(e){return e.replace(/[A-Z]([A-Z].*)/g,e=>e.toLowerCase()).replace(/[^a-zA-Z\d\s:]/g," ").replace(/(^\w|\s+\w)/g,e=>e.trim().toUpperCase()).trim()}static normalizeEventName(e){return e.replace(/[A-Z]/g,e=>`-${e.toLowerCase()}`).replace(/^-/,"")}}var z=function(e){return function(e){return!!e&&"object"==typeof e}(e)&&!function(e){var t=Object.prototype.toString.call(e);return"[object RegExp]"===t||"[object Date]"===t||function(e){return e.$$typeof===F}(e)}(e)},F="function"==typeof Symbol&&Symbol.for?Symbol.for("react.element"):60103;function D(e,t){return!1!==t.clone&&t.isMergeableObject(e)?X(Array.isArray(e)?[]:{},e,t):e}function V(e,t,s){return e.concat(t).map(function(e){return D(e,s)})}function q(e){return Object.keys(e).concat(function(e){return Object.getOwnPropertySymbols?Object.getOwnPropertySymbols(e).filter(function(t){return e.propertyIsEnumerable(t)}):[]}(e))}function Y(e,t){try{return t in e}catch(e){return!1}}function X(e,t,s){(s=s||{}).arrayMerge=s.arrayMerge||V,s.isMergeableObject=s.isMergeableObject||z,s.cloneUnlessOtherwiseSpecified=D;var r=Array.isArray(t);return r===Array.isArray(e)?r?s.arrayMerge(e,t,s):function(e,t,s){var r={};return s.isMergeableObject(e)&&q(e).forEach(function(t){r[t]=D(e[t],s)}),q(t).forEach(function(i){(function(e,t){return Y(e,t)&&!(Object.hasOwnProperty.call(e,t)&&Object.propertyIsEnumerable.call(e,t))})(e,i)||(r[i]=Y(e,i)&&s.isMergeableObject(t[i])?function(e,t){if(!t.customMerge)return X;var s=t.customMerge(e);return"function"==typeof s?s:X}(i,s)(e[i],t[i],s):D(t[i],s))}),r}(e,t,s):D(t,s)}X.all=function(e,t){if(!Array.isArray(e))throw new Error("first argument should be an array");return e.reduce(function(e,s){return X(e,s,t)},{})};var G=X;class U{constructor(e,t,s){var r,i;return this.__values={},this.__defaultValues={String:"",Number:0,Boolean:!1,Array:()=>[],Object:()=>({})},this.name="Base",this.debug=!1,this.log=!1,Object.defineProperties(this,{__element:{enumerable:!1,writable:!1,value:e},__values:{enumerable:!1,writable:!1,value:this.__values},__defaultValues:{enumerable:!1,writable:!1,value:this.__defaultValues}}),this.name=s.name,t.debug={type:Boolean,default:null!=(r=s.debug)&&r},t.log={type:Boolean,default:null!=(i=s.log)&&i},Object.entries(t).forEach(([e,t])=>{this.__register(e,t)}),this}__register(e,t){const s=!U.types.includes(t),r=s?t.type:t;if(!U.types.includes(r))throw new Error(`The "${e}" option has an invalid type. The allowed types are: String, Number, Boolean, Array and Object.`);const i=s?t.default:this.__defaultValues[r.name];if((r===Array||r===Object)&&"function"!=typeof i)throw new Error(`The default value for options of type "${r.name}" must be returned by a function.`);Object.defineProperty(this,e,{get:()=>this.get(e,r,i),set:t=>{this.set(e,r,t,i)},enumerable:!0})}get(e,t,s){const r=U.__getPropertyName(e),i=this.__hasProperty(r);if(t===Boolean){if(s){const t=U.__getPropertyName(e,"No");return!this.__hasProperty(t)}return i||s}const n=this.__element.dataset[r];if(t===Number)return i?Number(n):s;if(t===Array||t===Object){const r=G(s(),i?JSON.parse(n):this.__defaultValues[t.name]());return this.__values[e]||(this.__values[e]=r),this.__values[e]}return i?n:s}set(e,t,s,r){const i=U.__getPropertyName(e);if(s.constructor.name!==t.name){const r=Array.isArray(s)||function(e){return"object"==typeof e&&!!e&&"[object Object]"===e.toString()}(s)?JSON.stringify(s):s;throw new TypeError(`The "${r}" value for the "${e}" option must be of type "${t.name}"`)}switch(t){case Boolean:if(r){const t=U.__getPropertyName(e,"No");s?delete this.__element.dataset[t]:this.__element.dataset[t]=""}else s?this.__element.dataset[i]="":delete this.__element.dataset[i];break;case Array:case Object:this.__values[e]=s;break;default:this.__element.dataset[i]=s}}__hasProperty(e){return void 0!==this.__element.dataset[e]}static __getPropertyName(e,t=""){const s=e+t;if(U.__propertyNameCache.has(s))return U.__propertyNameCache.get(s);const r=`option${t}${e.replace(/^\w/,e=>e.toUpperCase())}`;return U.__propertyNameCache.set(s,r),r}}U.types=[String,Number,Boolean,Array,Object],U.__propertyNameCache=new Map;let Z=0;const J="undefined"!=typeof __DEV__&&__DEV__;function K(){}class Q extends EventTarget{get $root(){if(!this.$parent)return this;let e=this.$parent,t=this.$parent;for(;e;)e.$parent||(t=e),e=e.$parent;return t}get __config(){let t=Object.getPrototypeOf(this),{config:s}=t.constructor;for(;t.constructor.config&&t.constructor.$isBase;)s=e({},t.constructor.config,s),t.constructor.config.options&&(s.options=e({},t.constructor.config.options,s.options)),t.constructor.config.emits&&s.emits&&(s.emits=[...t.constructor.config.emits,...s.emits]),t=Object.getPrototypeOf(t);return s}get $services(){return this.__services}get $refs(){return this.__refs}get $options(){return this.__options}get $children(){return this.__children}get $log(){return this.__options.log?window.console.log.bind(window,`[${this.__config.name}]`):K}get __debug(){return J&&this.__options.debug?window.console.log.bind(window,`[debug] [${this.$id}]`):K}__callMethod(e,...t){J&&this.__debug("callMethod",e,...t),this.$emit(e,...t),"function"==typeof this[e]&&(this[e].call(this,...t),J&&this.__debug(e,this,...t))}__hasEvent(e){const t=this.__eventHandlers.get(e);return t&&t.size>0}constructor(e){if(super(),this.$parent=null,this.$isMounted=!1,this.__eventHandlers=new Map,!e)throw new Error("The root element must be defined.");const{__config:t}=this;if("Base"===t.name)throw new Error("The `config.name` property is required.");return this.$id=`${t.name}-${Z}`,Z+=1,this.$el=e,"__base__"in this.$el||Object.defineProperty(this.$el,"__base__",{get:()=>this,configurable:!0}),this.__options=new U(e,t.options||{},t),this.__services=new I(this),this.__events=new W(e,this),this.__children=new o(this,e,t.components||{},this.__events),this.__refs=new a(this,e,t.refs||[],this.__events),J&&this.__debug("constructor",this),this}$mount(){return this.$isMounted||(this.$isMounted=!0,J&&this.__debug("$mount"),this.$children.registerAll(),this.$refs.registerAll(),this.__events.bindRootElement(),this.$services.enableAll(),this.$children.mountAll(),this.__callMethod("mounted")),this}$update(){return J&&this.__debug("$update"),this.$refs.unregisterAll(),this.$services.disableAll(),this.$children.registerAll(),this.$refs.registerAll(),this.$services.enableAll(),this.$children.updateAll(),this.__callMethod("updated"),this}$destroy(){return this.$isMounted?(this.$isMounted=!1,J&&this.__debug("$destroy"),this.__events.unbindRootElement(),this.$refs.unregisterAll(),this.$services.disableAll(),this.$children.destroyAll(),this.__callMethod("destroyed"),this):this}$terminate(){J&&this.__debug("$terminate"),this.$destroy(),this.__callMethod("terminated"),Object.defineProperty(this.$el,"__base__",{value:"terminated",configurable:!1,writable:!1})}__testEventIsDefined(e){Array.isArray(this.__config.emits)&&this.__config.emits.includes(e)||console.warn(`[${this.__config.name}]`,`The "${e}" event is missing from the configuration.`)}__addEmits(e){const t=this.constructor;Array.isArray(t.config.emits)?t.config.emits.push(e):t.config.emits=[e]}__removeEmits(e){const t=this.constructor,s=t.config.emits.findIndex(t=>t===e);t.config.emits.splice(s,1)}$on(e,t,s){J&&this.__debug("$on",e,t,s),J&&this.__testEventIsDefined(e);let r=this.__eventHandlers.get(e);return r||(r=new Set,this.__eventHandlers.set(e,r)),r.add(t),this.addEventListener(e,t,s),()=>{this.$off(e,t,s)}}$off(e,t,s){J&&this.__debug("$off",e,t),J&&this.__testEventIsDefined(e),this.__eventHandlers.get(e).delete(t),this.removeEventListener(e,t,s)}$emit(e,...t){J&&this.__debug("$emit",e,t),J&&this.__testEventIsDefined(e),this.dispatchEvent(new CustomEvent(e,{detail:t}))}static $factory(e){if(!e)throw new Error("The $factory method requires a component’s name or selector to be specified.");return n(e).map(e=>new this(e).$mount())}}function ee(e){const{breakpoint:t}=x().props();e.forEach(([e,s])=>{e.includes(t)&&!s.$isMounted?setTimeout(()=>s.$mount(),0):!e.includes(t)&&s.$isMounted&&s.$destroy()})}Q.$isBase=!0,Q.config={name:"Base",emits:["mounted","updated","destroyed","terminated","ticked","scrolled","resized","moved","loaded","keyed"]};const te=new WeakMap;function se(e,t){if(!Array.isArray(t))throw new Error("[withBreakpointManager] The `breakpoints` parameter must be an array.");if(t.length<2)throw new Error("[withBreakpointManager] You must define at least 2 breakpoints.");const{add:s,props:r}=x();if(!r().breakpoint)throw new Error("The `BreakpointManager` class requires breakpoints to be defined.");return class extends e{constructor(e){return super(e),te.has(this)||te.set(this,function(e,t){return t.map(([t,s])=>{const r=new s(e.$el);return Object.defineProperty(r,"$parent",{get:()=>e.$parent}),[t,r]})}(this,t)),s(`BreakpointManager-${this.$id}`,()=>{ee(te.get(this))}),this.instances=te.get(this),this}$mount(){return super.$mount(),ee(te.get(this)),this}$destroy(){return Array.isArray(te.get(this))&&te.get(this).forEach(([,e])=>{e.$destroy()}),super.$destroy()}}}function re(e,t=x().props().breakpoint){const{activeBreakpoints:s,inactiveBreakpoints:r}=e.$options,i=s&&s.split(" ").includes(t),n=r&&r.split(" ").includes(t);return s&&i||r&&!n?"$mount":"$destroy"}function ie(e){const{activeBreakpoints:t,inactiveBreakpoints:s}=e.$options;return Boolean(t||s)}function ne(e,t){!function(e){const{activeBreakpoints:t,inactiveBreakpoints:s,name:r}=e.$options;if(t&&s)throw new Error(`[${r}] Incorrect configuration: the \`activeBreakpoints\` and \`inactiveBreakpoints\` are not compatible.`)}(t);const{add:s,has:r}=x();r(e)||s(e,function({breakpoint:e}){const s=re(t,e);"$destroy"===s&&t.$isMounted?t[s]():"$mount"!==s||t.$isMounted||setTimeout(()=>t[s](),0)})}function oe(t){var s,r,i,n,o;return r=s=class extends t{constructor(e){super(e);const{remove:t,props:s}=x(),{name:r}=this.$options;if(!s().breakpoint)throw new Error(`[${r}] The \`BreakpointObserver\` class requires breakpoints to be defined.`);const i=`BreakpointObserver-${this.$id}`;return new MutationObserver(([e])=>{if("attributes"===e.type&&("data-options"===e.attributeName||e.attributeName.startsWith("data-option-"))){if(!ie(this))return this.$mount(),void t(i);ne(i,this)}}).observe(this.$el,{attributes:!0}),ie(this)?(ne(i,this),this):this}$mount(){return ie(this)?"$mount"===re(this)?super.$mount():this:super.$mount()}},s.config=e({},t.config||{},{name:`${null!=(i=null==t||null==(n=t.config)?void 0:n.name)?i:""}WithBreakpointObserver`,options:e({},(null==t||null==(o=t.config)?void 0:o.options)||{},{activeBreakpoints:String,inactiveBreakpoints:String})}),r}function ae(e,t,s=.85){if(s>=1||s<=0)throw new Error(`The \`factor\` parameter must be a number greater than 0 and smaller than 1, \`${s}\` given.`);let r=t,i=e;for(;Math.abs(r)>.1;)i+=r,r*=s;return i}let he=0;class pe extends h{constructor(t,s={}){return super(),this.props={target:null,mode:void 0,isGrabbing:!1,hasInertia:!1,x:0,y:0,delta:{x:0,y:0},origin:{x:0,y:0},distance:{x:0,y:0},final:{x:0,y:0}},this.options={dampFactor:.85},he+=1,this.id=`drag-${he}`,this.props.target=t,this.options=e({},this.options,s),this.pointerHandler=this.pointerHandler.bind(this),this.rafHandler=this.rafHandler.bind(this),this}init(){const e={passive:!0};return this.props.target.addEventListener("mousedown",this,e),this.props.target.addEventListener("touchstart",this,e),v().add(this.id,this.pointerHandler),this}kill(){return this.props.target.removeEventListener("mousemove",this),this.props.target.removeEventListener("touchmove",this),v().remove(this.id),this}handleEvent(e){const t=e instanceof MouseEvent?e.clientX:e.touches[0].clientX,s=e instanceof MouseEvent?e.clientY:e.touches[0].clientY;this.start(t,s)}start(e,t){this.props.x=e,this.props.y=t,this.props.origin.x=e,this.props.origin.y=t,this.props.delta.x=0,this.props.delta.y=0,this.props.distance.x=0,this.props.distance.y=0,this.props.final.x=e,this.props.final.y=t,this.props.mode="start",this.props.isGrabbing=!0,this.trigger(this.props)}drop(){this.props.isGrabbing=!1,this.props.mode="drop",this.props.hasInertia=!0,this.props.final.x=ae(this.props.x,this.props.delta.x,this.options.dampFactor),this.props.final.y=ae(this.props.y,this.props.delta.y,this.options.dampFactor),this.trigger(this.props),setTimeout(()=>{const e=w();e.remove(this.id),e.add(this.id,this.rafHandler)},0)}stop(){w().remove(this.id),this.props.hasInertia=!1,this.props.mode="stop",this.trigger(this.props)}rafHandler(){this.props.isGrabbing||(this.props.x+=this.props.delta.x,this.props.y+=this.props.delta.y,this.props.distance.x=this.props.x-this.props.origin.x,this.props.distance.y=this.props.y-this.props.origin.y,this.props.delta.x*=this.options.dampFactor,this.props.delta.y*=this.options.dampFactor,"inertia"!==this.props.mode&&(this.props.mode="inertia"),this.trigger(this.props),Math.abs(this.props.delta.x)<.1&&Math.abs(this.props.delta.y)<.1&&this.stop())}pointerHandler(e){this.props.isGrabbing&&(this.props.x=e.x,this.props.y=e.y,this.props.delta.x=e.delta.x,this.props.delta.y=e.delta.y,this.props.final.x=e.x,this.props.final.y=e.y,this.props.distance.x=this.props.x-this.props.origin.x,this.props.distance.y=this.props.y-this.props.origin.y,"drag"!==this.props.mode&&(this.props.mode="drag"),this.trigger(this.props),e.isDown||this.drop())}updateProps(){return this.props}}const de=new WeakMap;function ce(e,t){let s=de.get(e);if(!s){const r=new pe(e,t);s={add:r.add.bind(r),remove:r.remove.bind(r),has:r.has.bind(r),props:r.updateProps.bind(r)},de.set(e,s)}return s}const le=["target"];function ue(e,t={}){var s,r;let{target:i=(e=>e.$el)}=t,n=function(e,t){if(null==e)return{};var s,r,i={},n=Object.keys(e);for(r=0;r<n.length;r++)t.indexOf(s=n[r])>=0||(i[s]=e[s]);return i}(t,le);return r=s=class extends e{constructor(e){super(e),this.$on("mounted",()=>{this.$services.register("dragged",ce.bind(void 0,i.call(this,this),n)),this.$services.enable("dragged")}),this.$on("destroyed",()=>{this.$services.disable("dragged"),this.$services.unregister("dragged")})}},s.config={name:`${e.config.name}WithDrag`,emits:["dragged"]},r}function _e(e,t,s={}){var r,i;const n=G(e.config,t,s);return n.name===e.config.name&&(n.name=`${e.config.name}WithExtraConfig`),i=r=class extends e{},r.config=n,i}function me(e){return[...new Array(e+1)].map((t,s)=>s/e)}function fe(t,s={threshold:me(100)}){var r,i,n,o,a;return i=r=class extends t{constructor(t){if(super(t),!this.intersected||"function"!=typeof this.intersected)throw new Error("[withIntersectionObserver] The `intersected` method must be defined.");return this.$observer=new IntersectionObserver(e=>{this.__callMethod("intersected",e)},e({},s,this.$options.intersectionObserver||{})),this.$on("mounted",()=>{this.$observer.observe(this.$el)}),this.$on("destroyed",()=>{this.$observer.unobserve(this.$el)}),this}},r.config=e({},t.config||{},{name:`${null!=(n=null==t||null==(o=t.config)?void 0:o.name)?n:""}WithIntersectionObserver`,options:e({},(null==t||null==(a=t.config)?void 0:a.options)||{},{intersectionObserver:Object}),emits:["intersected"]}),i}function ge(t,i={threshold:[0,1]}){var n,o,a,h,p,d,c;return o=s("isVisible"),a=s("observer"),h=n=class extends t{constructor(t){return super(t),Object.defineProperty(this,o,{writable:!0,value:!1}),Object.defineProperty(this,a,{writable:!0,value:void 0}),r(this,a)[a]=new IntersectionObserver(e=>{const t=e.reduce((e,t)=>e||t.isIntersecting,!1);r(this,o)[o]!==t&&(r(this,o)[o]=t,t?this.$mount():setTimeout(()=>this.$destroy()))},e({},i,this.$options.intersectionObserver)),r(this,a)[a].observe(this.$el),this.$on("terminated",()=>{r(this,a)[a].disconnect()}),this}$mount(){return r(this,o)[o]&&super.$mount(),this}},n.config=e({},t.config||{},{name:`${null!=(p=null==t||null==(d=t.config)?void 0:d.name)?p:""}WithMountWhenInView`,options:e({},(null==t||null==(c=t.config)?void 0:c.options)||{},{intersectionObserver:Object})}),h}function be(e,t,s){return t<s?e<t?t:e>s?s:e:e<s?s:e>t?t:e}function ve(e){return be(e,0,1)}function ye(e,t,s=.5,r=.01){return Math.abs(e-t)<r?e:t+(e-t)*s}function we(e,t){var s,r;return r=s=class extends(ge(e,t)){constructor(...e){super(...e),this.__props={start:{x:0,y:0},end:{x:0,y:0},current:{x:0,y:0},progress:{x:0,y:0},dampedProgress:{x:0,y:0}},this.dampFactor=.1,this.dampPrecision=.001}mounted(){this.__setProps()}resized(){this.__setProps()}scrolled(e){(!this.$services.has("ticked")&&e.changed.y||e.changed.x)&&this.$services.enable("ticked")}ticked(){this.__props.current.x=be(window.pageXOffset,this.__props.start.x,this.__props.end.x),this.__props.progress.x=ve((this.__props.current.x-this.__props.start.x)/(this.__props.end.x-this.__props.start.x)),this.__props.dampedProgress.x=ye(this.__props.progress.x,this.__props.dampedProgress.x,this.dampFactor,this.dampPrecision),this.__props.current.y=be(window.pageYOffset,this.__props.start.y,this.__props.end.y),this.__props.progress.y=ve((this.__props.current.y-this.__props.start.y)/(this.__props.end.y-this.__props.start.y)),this.__props.dampedProgress.y=ye(this.__props.progress.y,this.__props.dampedProgress.y,this.dampFactor,this.dampPrecision),this.__props.dampedProgress.x===this.__props.progress.x&&this.__props.dampedProgress.y===this.__props.progress.y&&this.$services.disable("ticked"),this.__callMethod("scrolledInView",this.__props)}__setProps(){const e=this.$el.getBoundingClientRect(),t=e.top+window.pageYOffset+e.height,s=t-window.innerHeight-e.height,r=be(window.pageYOffset,s,t),i=ve((r-s)/(t-s)),n=e.left+window.pageXOffset+e.width,o=n-window.innerWidth-e.width,a=be(window.pageXOffset,o,n),h=ve((a-o)/(n-o));this.__props.start.x=o,this.__props.start.y=s,this.__props.end.x=n,this.__props.end.y=t,this.__props.current.x=a,this.__props.current.y=r,this.__props.progress.x=h,this.__props.progress.y=i,this.__props.dampedProgress.x=ye(h,this.__props.dampedProgress.x),this.__props.dampedProgress.y=ye(i,this.__props.dampedProgress.y)}},s.config={name:`${e.config.name}WithMountWhenInView`,emits:["scrolledInView"]},r}var $e=(t,s)=>{var r,i,n,o,a,h;return i=r=class extends t{constructor(e){super(e);const{vueConfig:t}=this.constructor;if(!t)throw new Error("[withVue] You must define a `vueConfig` object.");if("function"!=typeof t.render)throw new Error("[withVue] You must define a `render` function in vueConfig.");this.$vue=new s(t),this.$on("mounted",()=>{if(!(this.$refs.vue instanceof HTMLElement))throw new Error("[withVue] The `vue` refs must be a single HTMLElement.");this.$vue.$mount(this.$refs.vue)}),this.$on("destroyed",()=>{this.$vue.$destroy()})}},r.config=e({},t.config||{},{name:`${null!=(n=null==t||null==(o=t.config)?void 0:o.name)?n:""}WithVue`,refs:[...null!=(a=null==t||null==(h=t.config)?void 0:h.refs)?a:[],"vue"]}),i};function Ee(e,t){let s,r="complete"===document.readyState;r?s=new e(t).$mount():document.addEventListener("readystatechange",()=>{"complete"===document.readyState&&(s=new e(t).$mount(),r=!0)});const i=new Promise(e=>{document.addEventListener("readystatechange",()=>{"complete"===document.readyState&&setTimeout(()=>e(s),0)})});return function(){return r?Promise.resolve(s):i}}function xe(e,t){return"string"==typeof e?n(e,t):Array.isArray(e)?e:[e]}function ke(e,t,s,r){const i="string"==typeof s?[s]:s;let n;return new Promise(s=>{const o=xe(t,null==r?void 0:r.$el),a={capture:!0,passive:!0,once:!0},h=()=>{(t=>{e().then(e=>{n="default"in e?e.default:e,t(n)})})(s)};o.forEach(e=>{i.forEach(t=>{e.addEventListener(t,h,a)})})})}function Oe(e,t){let s;const r=t=>{e().then(e=>{s="default"in e?e.default:e,t(s)})};return new Promise(e=>{var s;const i=null!=(s=null==t?void 0:t.timeout)?s:1;"requestIdleCallback"in window?window.requestIdleCallback(()=>{setTimeout(()=>{r(e)},0)},{timeout:null==t?void 0:t.timeout}):setTimeout(()=>{r(e)},i)})}function Pe(e,t,s,r={}){let i;return new Promise(n=>{const o=new IntersectionObserver(t=>{t.some(e=>e.isIntersecting)&&setTimeout(()=>{((t,s)=>{e().then(e=>{i="default"in e?e.default:e,t(i),o.disconnect()})})(n)},0)},r);xe(t,null==s?void 0:s.$el).forEach(e=>o.observe(e))})}export{Q as Base,Ee as createApp,ke as importOnInteraction,Oe as importWhenIdle,Pe as importWhenVisible,ce as useDrag,T as useKey,L as useLoad,v as usePointer,w as useRaf,x as useResize,O as useScroll,se as withBreakpointManager,oe as withBreakpointObserver,ue as withDrag,_e as withExtraConfig,fe as withIntersectionObserver,ge as withMountWhenInView,we as withScrolledInView,$e as withVue2};
|
package/index.umd.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports):"function"==typeof define&&define.amd?define(["exports"],t):t((e||self).Base={})}(this,function(e){function t(){return t=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var s in r)Object.prototype.hasOwnProperty.call(r,s)&&(e[s]=r[s])}return e},t.apply(this,arguments)}var r,s,i,n,o,a,h,p,d=0;function l(e){return"__private_"+d+++"_"+e}function u(e,t){if(!Object.prototype.hasOwnProperty.call(e,t))throw new TypeError("attempted to use private field on non-instance");return e}function c(e,t){return"function"==typeof e[t]}function _(e,t){void 0===t&&(t=document);var r='[data-component="'+e+'"]',s=[];try{s=Array.from(t.querySelectorAll(r))}catch(e){}return 0===s.length&&(s=Array.from(t.querySelectorAll(e))),s}class m{get registeredNames(){return Object.keys(this).filter(e=>!e.startsWith("__"))}constructor(e,t,r,s){Object.defineProperties(this,{__base:{enumerable:!1,writable:!1,value:e},__element:{enumerable:!1,writable:!1,value:t},__components:{enumerable:!1,writable:!1,value:r},__eventsManager:{enumerable:!1,writable:!1,value:s}})}registerAll(){Object.entries(this.__components).forEach(e=>{var[t,r]=e;return this.__register(t,r)})}__register(e,t){Object.defineProperty(this,e,{enumerable:!0,configurable:!0,get:()=>{var r=_(e,this.__element);return 0===r.length?[]:r.map(r=>this.__getChild(r,t,e)).filter(e=>"terminated"!==e)}})}__getChild(e,t,r){if(e.__base__)return e.__base__;if("$isBase"in t){var s=new t(e);return Object.defineProperty(s,"$parent",{get:()=>this.__base}),s}return t(this.__base).then(t=>{var s;return this.__getChild(e,null!=(s=t.default)?s:t,r)})}mountAll(){this.__triggerHookForAll("$mount")}updateAll(){this.__triggerHookForAll("$update")}destroyAll(){this.__triggerHookForAll("$destroy")}__triggerHookForAll(e){this.registeredNames.forEach(t=>{this[t].forEach(r=>{r instanceof Promise?r.then(r=>this.__triggerHook(e,r,t)):this.__triggerHook(e,r,t)})})}__triggerHook(e,t,r){"$update"!==e||t.$isMounted||(e="$mount"),"$update"!==e&&"$destroy"!==e||this.__eventsManager.unbindChild(r,t),"$update"!==e&&"$mount"!==e||this.__eventsManager.bindChild(r,t),t[e]()}}class v{constructor(e,t,r,s){Object.defineProperties(this,{__element:{enumerable:!1,writable:!1,value:t},__refs:{enumerable:!1,writable:!1,value:r},__base:{enumerable:!1,writable:!1,value:e},__eventsManager:{enumerable:!1,writable:!1,value:s}})}registerAll(){this.__refs.forEach(e=>this.__register(e))}unregisterAll(){this.__refs.forEach(e=>this.__unregister(e))}__register(e){var t=e.endsWith("[]"),r=v.normalizeRefName(e),s=Array.from(this.__element.querySelectorAll('[data-ref="'+e+'"]')).filter(e=>this.__filterRefsBelongingToInstance(e));!t&&s.length>1&&console.warn("["+this.__base.$options.name+"]",'The "'+e+'" ref has been found multiple times.',"Did you forgot to add the `[]` suffix to its name?"),this.__eventsManager.bindRef(e,s),Object.defineProperty(this,r,{value:t||s.length>1?s:s[0],enumerable:!0,configurable:!0})}__unregister(e){var t=v.normalizeRefName(e),r=Array.isArray(this[t])?this[t]:[this[t]];this.__eventsManager.unbindRef(e,r)}static normalizeRefName(e){return e.endsWith("[]")?e.replace(/\[\]$/,""):e}__filterRefsBelongingToInstance(e){for(var t=e.parentElement;t&&void 0===t.dataset.component;)t=t.parentElement;return null===t||t===this.__element}}class f{constructor(){this.callbacks=new Map,this.isInit=!1}updateProps(){throw this.props=[].slice.call(arguments),new Error("The `updateProps` method must be implemented.")}init(){throw new Error("The `init` method must be implemented.")}kill(){throw new Error("The `kill` method must be implemented.")}add(e,t){if(this.has(e))throw new Error("A callback with the key `"+e+"` has already been registered.");0!==this.callbacks.size||this.isInit||(this.init(),this.isInit=!0),this.callbacks.set(e,t)}has(e){return this.callbacks.has(e)}get(e){return this.callbacks.get(e)}remove(e){this.callbacks.delete(e),0===this.callbacks.size&&this.isInit&&(this.kill(),this.isInit=!1)}trigger(){var e=[].slice.call(arguments);return this.callbacks.forEach(function(t){t(...e)}),this}}function g(e){return"undefined"!=typeof TouchEvent&&e instanceof TouchEvent}class b extends f{constructor(){super(...arguments),this.props={event:null,isDown:!1,x:window.innerWidth/2,y:window.innerHeight/2,changed:{x:!1,y:!1},last:{x:window.innerWidth/2,y:window.innerHeight/2},delta:{x:0,y:0},progress:{x:.5,y:.5},max:{x:window.innerWidth,y:window.innerHeight}},this.hasRaf=!1}init(){document.documentElement.addEventListener("mouseenter",this,{once:!0,capture:!0});var e={passive:!0,capture:!0};return document.addEventListener("mousemove",this,e),document.addEventListener("touchmove",this,e),document.addEventListener("mousedown",this,e),document.addEventListener("touchstart",this,e),document.addEventListener("mouseup",this,e),document.addEventListener("touchend",this,e),this}handleEvent(e){switch(e.type){case"mouseenter":case"mousemove":case"touchmove":this.handler(e);break;case"mousedown":case"touchstart":this.downHandler();break;case"mouseup":case"touchend":this.upHandler()}}kill(){return document.removeEventListener("mousemove",this),document.removeEventListener("touchmove",this),document.removeEventListener("mousedown",this),document.removeEventListener("touchstart",this),document.removeEventListener("mouseup",this),document.removeEventListener("touchend",this),this}handler(e){this.updateProps(e),this.trigger(this.props)}downHandler(){this.props.isDown=!0,this.trigger(this.props)}upHandler(){this.props.isDown=!1,this.trigger(this.props)}updateProps(e){var t,r;this.props.event=e;var s=this.props.y,i=this.props.x,n=g(e)?null==(t=e.touches[0])?void 0:t.clientY:e.clientY;n!==this.props.y&&(this.props.y=n);var o=g(e)?null==(r=e.touches[0])?void 0:r.clientX:e.clientX;return o!==this.props.x&&(this.props.x=o),this.props.changed.x=this.props.x!==i,this.props.changed.y=this.props.y!==s,this.props.last.x=i,this.props.last.y=s,this.props.delta.x=this.props.x-i,this.props.delta.y=this.props.y-s,this.props.max.x=window.innerWidth,this.props.max.y=window.innerHeight,this.props.progress.x=this.props.x/this.props.max.x,this.props.progress.y=this.props.y/this.props.max.y,this.props}}function y(){return s||(r||(r=new b),s={add:r.add.bind(r),remove:r.remove.bind(r),has:r.has.bind(r),props:r.updateProps.bind(r)}),s}class w extends f{constructor(){super(...arguments),this.isTicking=!1,this.id=0,this.raf="undefined"!=typeof window&&window.requestAnimationFrame?window.requestAnimationFrame.bind(window):setTimeout,this.cancelRaf="undefined"!=typeof window&&window.cancelAnimationFrame?window.cancelAnimationFrame.bind(window):clearTimeout,this.props={time:performance.now()}}init(){this.isTicking=!0,this.loop()}loop(){this.updateProps(),this.trigger(this.props),this.isTicking&&(this.id=this.raf(()=>this.loop()))}kill(){this.cancelRaf(this.id),this.isTicking=!1}updateProps(){return this.props.time=window.performance.now(),this.props}}function E(){return n||(i||(i=new w),n={add:i.add.bind(i),remove:i.remove.bind(i),has:i.has.bind(i),props:i.updateProps.bind(i)}),n}function $(e,t){var r;return void 0===t&&(t=300),function(){clearTimeout(r),r=setTimeout(()=>{e(...[].slice.call(arguments))},t)}}class x extends f{constructor(){super(...arguments),this.props={width:window.innerWidth,height:window.innerHeight,ratio:window.innerWidth/window.innerHeight,orientation:"square"}}init(){return this.handler=$(()=>{this.updateProps(),this.trigger(this.props)}).bind(this),window.addEventListener("resize",this.handler),this}kill(){window.removeEventListener("resize",this.handler)}updateProps(){return this.props.width=window.innerWidth,this.props.height=window.innerHeight,this.props.ratio=window.innerWidth/window.innerHeight,this.props.orientation="square",this.props.ratio>1&&(this.props.orientation="landscape"),this.props.ratio<1&&(this.props.orientation="portrait"),this.breakpointElement?(this.props.breakpoint=this.breakpoint,this.props.breakpoints=this.breakpoints):(this.props.breakpoint=void 0,this.props.breakpoints=void 0),this.props}get breakpointElement(){return document.querySelector("[data-breakpoint]")}get breakpoint(){return window.getComputedStyle(this.breakpointElement,"::before").getPropertyValue("content").replace(/"/g,"")}get breakpoints(){return window.getComputedStyle(this.breakpointElement,"::after").getPropertyValue("content").replace(/"/g,"").split(",")}}function k(){if(!a){o||(o=new x);var e=o.add.bind(o),t=o.remove.bind(o),r=o.has.bind(o),s=o.updateProps.bind(o);a={add:e,remove:t,has:r,props:s}}return a}class O extends f{constructor(){super(...arguments),this.props={x:window.pageXOffset,y:window.pageYOffset,changed:{x:!1,y:!1},last:{x:window.pageXOffset,y:window.pageYOffset},delta:{x:0,y:0},max:{x:(document.scrollingElement||document.body).scrollWidth-window.innerWidth,y:(document.scrollingElement||document.body).scrollHeight-window.innerHeight},progress:{x:0,y:0},direction:{x:"NONE",y:"NONE"}}}init(){return this.updateProps(),document.addEventListener("scroll",this,{passive:!0,capture:!0}),this}get debouncedHandler(){var e=$(()=>{this.updateProps(),this.trigger(this.props)},100);return Object.defineProperty(this,"debouncedHandler",{value:e}),e}handleEvent(){this.updateProps(),this.trigger(this.props),this.debouncedHandler()}kill(){return document.removeEventListener("scroll",this),this}updateProps(){var e=this.props.y,t=this.props.x;return window.pageYOffset!==this.props.y&&(this.props.y=window.pageYOffset),window.pageXOffset!==this.props.x&&(this.props.x=window.pageXOffset),this.props.changed.x=this.props.x!==t,this.props.changed.y=this.props.y!==e,this.props.last.x=t,this.props.last.y=e,this.props.delta.x=this.props.x-t,this.props.delta.y=this.props.y-e,this.props.max.x=(document.scrollingElement||document.body).scrollWidth-window.innerWidth,this.props.max.y=(document.scrollingElement||document.body).scrollHeight-window.innerHeight,this.props.progress.x=0===this.props.max.x?1:this.props.x/this.props.max.x,this.props.progress.y=0===this.props.max.y?1:this.props.y/this.props.max.y,this.props.direction.x=this.props.x>t?"RIGHT":this.props.x<t?"LEFT":"NONE",this.props.direction.y=this.props.y>e?"DOWN":this.props.y<e?"UP":"NONE",this.props}}function P(){return p||(h||(h=new O),p={add:h.add.bind(h),remove:h.remove.bind(h),has:h.has.bind(h),props:h.updateProps.bind(h)}),p}var A,M,N,j,T={ENTER:13,SPACE:32,TAB:9,ESC:27,LEFT:37,UP:38,RIGHT:39,DOWN:40};class H extends f{constructor(){super(...arguments),this.props={event:null,triggered:0,isUp:!1,isDown:!1,ENTER:!1,SPACE:!1,TAB:!1,ESC:!1,LEFT:!1,UP:!1,RIGHT:!1,DOWN:!1,direction:"none"}}init(){document.addEventListener("keydown",this),document.addEventListener("keyup",this)}handleEvent(e){this.updateProps(e),this.trigger(this.props)}kill(){document.removeEventListener("keydown",this),document.removeEventListener("keyup",this)}updateProps(e){var t;return this.props.event=e,Object.entries(T).forEach(t=>{var[r,s]=t;this.props[r]=s===e.keyCode}),this.previousEvent||(this.props.triggered=0),"keydown"===this.props.event.type&&"keydown"===(null==(t=this.previousEvent)?void 0:t.type)?this.props.triggered+=1:this.props.triggered=1,this.previousEvent=this.props.event,this.props.direction="keydown"===this.props.event.type?"down":"up",this.props.isUp="keyup"===this.props.event.type,this.props.isDown="keydown"===this.props.event.type,this.props}}function B(){return M||(A||(A=new H),M={add:A.add.bind(A),remove:A.remove.bind(A),has:A.has.bind(A),props:A.updateProps.bind(A)}),M}class L extends f{constructor(){super(...arguments),this.props={time:window.performance.now()}}init(){window.addEventListener("load",this)}handleEvent(){this.updateProps(),this.trigger(this.props)}kill(){window.removeEventListener("load",this)}updateProps(){return this.props.time=window.performance.now(),this.props}}function C(){return j||(N||(N=new L),j={add:N.add.bind(N),remove:N.remove.bind(N),has:N.has.bind(N),props:N.updateProps.bind(N)}),j}var I={scrolled:P,resized:k,ticked:E,moved:y,keyed:B,loaded:C},S=Object.keys(I);class R{get __services(){return t({},this.__customServices,I)}constructor(e){this.__customServices={},Object.defineProperties(this,{__base:{enumerable:!1,writable:!1,value:e}})}has(e){if(!c(this.__base,e)&&!this.__base.__hasEvent(e)||!this.__services[e])return!1;var{has:t}=this.__services[e]();return t(this.__base.$id)}enable(e){if(this.has(e))return this.disable.bind(this,e);if(!c(this.__base,e)&&!this.__base.__hasEvent(e)||!this.__services[e])return function(){};var{add:t}=this.__services[e](),r=this;return t(this.__base.$id,function(){r.__base.__callMethod(e,...[].slice.call(arguments))}),this.disable.bind(this,e)}enableAll(){return Object.keys(this.__services).map(e=>this.enable(e))}disableAll(){Object.keys(this.__services).forEach(e=>{this.disable(e)})}disable(e){if(this.__services[e]){var{remove:t}=this.__services[e]();t(this.__base.$id)}}toggle(e,t){void 0!==t?(t&&!this.has(e)&&this.enable(e),!t&&this.has(e)&&this.disable(e)):this.has(e)?this.disable(e):this.enable(e)}register(e,t){this.__customServices[e]=t,this.__base.__addEmits(e)}unregister(e){if(S.includes(e))throw new Error("[ServicesManager] The `"+e+"` core service can not be unregistered.");this.__base.__removeEmits(e),delete this.__customServices[e]}}function W(e,t,r){void 0===t&&(t=[]),void 0===r&&(r=null);var s=Object.getPrototypeOf(e);if(s===Object.prototype||null===s)return t;var i=Object.getOwnPropertyNames(s);return"function"==typeof r&&(i=i.filter(e=>r(e,s))),i=i.map(e=>[e,s]).reduce((e,t)=>[...e,t],t),W(s,i,r)}class z{constructor(e,t){this.__methodsCache=new Map,this.__rootElementHandler={handleEvent:e=>{var t=z.normalizeName(e.type);this.__base["on"+t](e)}},this.__refsHandler={handleEvent:e=>{var t=e.currentTarget,r=v.normalizeRefName(t.dataset.ref),s="on"+z.normalizeName(r)+z.normalizeName(e.type),i=0;Array.isArray(this.__base.$refs[r])&&(i=this.__base.$refs[r].indexOf(t)),this.__base[s](e,i)}},this.__childrenHandler={handleEvent:e=>{var t,r=e.currentTarget,s=0,i=this.__base.$children;i.registeredNames.find(e=>!!i[e].includes(r)&&(t=e,s=i[e].indexOf(r),!0));var n="on"+z.normalizeName(t)+z.normalizeName(e.type),o=Array.isArray(e.detail)?e.detail:[];this.__base[n](...o,s,e)}},Object.defineProperties(this,{__rootElement:{enumerable:!1,writable:!1,value:e},__base:{enumerable:!1,writable:!1,value:t},__methodsCache:{enumerable:!1,writable:!1,value:this.__methodsCache},__rootElementHandler:{enumerable:!1,writable:!1,value:this.__rootElementHandler},__refsHandler:{enumerable:!1,writable:!1,value:this.__refsHandler},__childrenHandler:{enumerable:!1,writable:!1,value:this.__childrenHandler}})}__manageRef(e,t,r){void 0===r&&(r="add");var s=r+"EventListener";this.__getEventMethodsByName(e).forEach(r=>{var i=this.__getEventNameByMethod(r,e);t.forEach(e=>e[s](i,this.__refsHandler))})}bindRef(e,t){this.__manageRef(e,t)}unbindRef(e,t){this.__manageRef(e,t,"remove")}__manageChild(e,t,r){void 0===r&&(r="add");var s="add"===r?"$on":"$off";this.__getEventMethodsByName(e).forEach(r=>{var i=this.__getEventNameByMethod(r,e);t[s](i,this.__childrenHandler)})}bindChild(e,t){this.__manageChild(e,t)}unbindChild(e,t){this.__manageChild(e,t,"remove")}__manageRootElement(e){void 0===e&&(e="add");var t=e+"EventListener",r=this.__getEventMethodsByName(),{emits:s=[]}=this.__base.__config;r.forEach(e=>{var r=this.__getEventNameByMethod(e);(s.includes(r)?this.__base:this.__rootElement)[t](r,this.__rootElementHandler)})}bindRootElement(){this.__manageRootElement()}unbindRootElement(){this.__manageRootElement("remove")}__getEventNameByMethod(e,t){void 0===t&&(t="");var r=z.normalizeName(t),s=new RegExp("^on"+r+"([A-Z].*)$"),[,i]=e.match(s);return z.normalizeEventName(i)}__getEventMethodsByName(e){void 0===e&&(e="");var t=z.normalizeName(e),r=new RegExp("^on"+t+"[A-Z].*$"),s=r.toString(),i=this.__methodsCache.get(s);return i||(i=Array.from(W(this.__base,[],e=>r.test(e)).reduce((e,t)=>{var[r]=t;return e.add(r)},new Set)),this.__methodsCache.set(s,i)),i}static normalizeName(e){return e.replace(/[A-Z]([A-Z].*)/g,e=>e.toLowerCase()).replace(/[^a-zA-Z\d\s:]/g," ").replace(/(^\w|\s+\w)/g,e=>e.trim().toUpperCase()).trim()}static normalizeEventName(e){return e.replace(/[A-Z]/g,e=>"-"+e.toLowerCase()).replace(/^-/,"")}}var V=function(e){return function(e){return!!e&&"object"==typeof e}(e)&&!function(e){var t=Object.prototype.toString.call(e);return"[object RegExp]"===t||"[object Date]"===t||function(e){return e.$$typeof===D}(e)}(e)},D="function"==typeof Symbol&&Symbol.for?Symbol.for("react.element"):60103;function F(e,t){return!1!==t.clone&&t.isMergeableObject(e)?G(Array.isArray(e)?[]:{},e,t):e}function q(e,t,r){return e.concat(t).map(function(e){return F(e,r)})}function Y(e){return Object.keys(e).concat(function(e){return Object.getOwnPropertySymbols?Object.getOwnPropertySymbols(e).filter(function(t){return e.propertyIsEnumerable(t)}):[]}(e))}function X(e,t){try{return t in e}catch(e){return!1}}function G(e,t,r){(r=r||{}).arrayMerge=r.arrayMerge||q,r.isMergeableObject=r.isMergeableObject||V,r.cloneUnlessOtherwiseSpecified=F;var s=Array.isArray(t);return s===Array.isArray(e)?s?r.arrayMerge(e,t,r):function(e,t,r){var s={};return r.isMergeableObject(e)&&Y(e).forEach(function(t){s[t]=F(e[t],r)}),Y(t).forEach(function(i){(function(e,t){return X(e,t)&&!(Object.hasOwnProperty.call(e,t)&&Object.propertyIsEnumerable.call(e,t))})(e,i)||(s[i]=X(e,i)&&r.isMergeableObject(t[i])?function(e,t){if(!t.customMerge)return G;var r=t.customMerge(e);return"function"==typeof r?r:G}(i,r)(e[i],t[i],r):F(t[i],r))}),s}(e,t,r):F(t,r)}G.all=function(e,t){if(!Array.isArray(e))throw new Error("first argument should be an array");return e.reduce(function(e,r){return G(e,r,t)},{})};var U=G;class Z{constructor(e,t,r){var s,i;return this.__values={},this.__defaultValues={String:"",Number:0,Boolean:!1,Array:()=>[],Object:()=>({})},this.name="Base",this.debug=!1,this.log=!1,Object.defineProperties(this,{__element:{enumerable:!1,writable:!1,value:e},__values:{enumerable:!1,writable:!1,value:this.__values},__defaultValues:{enumerable:!1,writable:!1,value:this.__defaultValues}}),this.name=r.name,t.debug={type:Boolean,default:null!=(s=r.debug)&&s},t.log={type:Boolean,default:null!=(i=r.log)&&i},Object.entries(t).forEach(e=>{var[t,r]=e;this.__register(t,r)}),this}__register(e,t){var r=!Z.types.includes(t),s=r?t.type:t;if(!Z.types.includes(s))throw new Error('The "'+e+'" option has an invalid type. The allowed types are: String, Number, Boolean, Array and Object.');var i=r?t.default:this.__defaultValues[s.name];if((s===Array||s===Object)&&"function"!=typeof i)throw new Error('The default value for options of type "'+s.name+'" must be returned by a function.');Object.defineProperty(this,e,{get:()=>this.get(e,s,i),set:t=>{this.set(e,s,t,i)},enumerable:!0})}get(e,t,r){var s=Z.__getPropertyName(e),i=this.__hasProperty(s);if(t===Boolean){if(r){var n=Z.__getPropertyName(e,"No");return!this.__hasProperty(n)}return i||r}var o=this.__element.dataset[s];if(t===Number)return i?Number(o):r;if(t===Array||t===Object){var a=U(r(),i?JSON.parse(o):this.__defaultValues[t.name]());return this.__values[e]||(this.__values[e]=a),this.__values[e]}return i?o:r}set(e,t,r,s){var i=Z.__getPropertyName(e);if(r.constructor.name!==t.name){var n=Array.isArray(r)||function(e){return"object"==typeof e&&!!e&&"[object Object]"===e.toString()}(r)?JSON.stringify(r):r;throw new TypeError('The "'+n+'" value for the "'+e+'" option must be of type "'+t.name+'"')}switch(t){case Boolean:if(s){var o=Z.__getPropertyName(e,"No");r?delete this.__element.dataset[o]:this.__element.dataset[o]=""}else r?this.__element.dataset[i]="":delete this.__element.dataset[i];break;case Array:case Object:this.__values[e]=r;break;default:this.__element.dataset[i]=r}}__hasProperty(e){return void 0!==this.__element.dataset[e]}static __getPropertyName(e,t){void 0===t&&(t="");var r=e+t;if(Z.__propertyNameCache.has(r))return Z.__propertyNameCache.get(r);var s="option"+t+e.replace(/^\w/,e=>e.toUpperCase());return Z.__propertyNameCache.set(r,s),s}}Z.types=[String,Number,Boolean,Array,Object],Z.__propertyNameCache=new Map;var J=0,K="undefined"!=typeof __DEV__&&__DEV__;function Q(){}class ee extends EventTarget{get $root(){if(!this.$parent)return this;for(var e=this.$parent,t=this.$parent;e;)e.$parent||(t=e),e=e.$parent;return t}get __config(){for(var e=Object.getPrototypeOf(this),{config:r}=e.constructor;e.constructor.config&&e.constructor.$isBase;)r=t({},e.constructor.config,r),e.constructor.config.options&&(r.options=t({},e.constructor.config.options,r.options)),e.constructor.config.emits&&r.emits&&(r.emits=[...e.constructor.config.emits,...r.emits]),e=Object.getPrototypeOf(e);return r}get $services(){return this.__services}get $refs(){return this.__refs}get $options(){return this.__options}get $children(){return this.__children}get $log(){return this.__options.log?window.console.log.bind(window,"["+this.__config.name+"]"):Q}get __debug(){return K&&this.__options.debug?window.console.log.bind(window,"[debug] ["+this.$id+"]"):Q}__callMethod(e){var t=[].slice.call(arguments,1);K&&this.__debug("callMethod",e,...t),this.$emit(e,...t),"function"==typeof this[e]&&(this[e].call(this,...t),K&&this.__debug(e,this,...t))}__hasEvent(e){var t=this.__eventHandlers.get(e);return t&&t.size>0}constructor(e){if(super(),this.$parent=null,this.$isMounted=!1,this.__eventHandlers=new Map,!e)throw new Error("The root element must be defined.");var{__config:t}=this;if("Base"===t.name)throw new Error("The `config.name` property is required.");return this.$id=t.name+"-"+J,J+=1,this.$el=e,"__base__"in this.$el||Object.defineProperty(this.$el,"__base__",{get:()=>this,configurable:!0}),this.__options=new Z(e,t.options||{},t),this.__services=new R(this),this.__events=new z(e,this),this.__children=new m(this,e,t.components||{},this.__events),this.__refs=new v(this,e,t.refs||[],this.__events),K&&this.__debug("constructor",this),this}$mount(){return this.$isMounted||(this.$isMounted=!0,K&&this.__debug("$mount"),this.$children.registerAll(),this.$refs.registerAll(),this.__events.bindRootElement(),this.$services.enableAll(),this.$children.mountAll(),this.__callMethod("mounted")),this}$update(){return K&&this.__debug("$update"),this.$refs.unregisterAll(),this.$services.disableAll(),this.$children.registerAll(),this.$refs.registerAll(),this.$services.enableAll(),this.$children.updateAll(),this.__callMethod("updated"),this}$destroy(){return this.$isMounted?(this.$isMounted=!1,K&&this.__debug("$destroy"),this.__events.unbindRootElement(),this.$refs.unregisterAll(),this.$services.disableAll(),this.$children.destroyAll(),this.__callMethod("destroyed"),this):this}$terminate(){K&&this.__debug("$terminate"),this.$destroy(),this.__callMethod("terminated"),Object.defineProperty(this.$el,"__base__",{value:"terminated",configurable:!1,writable:!1})}__testEventIsDefined(e){Array.isArray(this.__config.emits)&&this.__config.emits.includes(e)||console.warn("["+this.__config.name+"]",'The "'+e+'" event is missing from the configuration.')}__addEmits(e){var t=this.constructor;Array.isArray(t.config.emits)?t.config.emits.push(e):t.config.emits=[e]}__removeEmits(e){var t=this.constructor,r=t.config.emits.findIndex(t=>t===e);t.config.emits.splice(r,1)}$on(e,t,r){K&&this.__debug("$on",e,t,r),K&&this.__testEventIsDefined(e);var s=this.__eventHandlers.get(e);return s||(s=new Set,this.__eventHandlers.set(e,s)),s.add(t),this.addEventListener(e,t,r),()=>{this.$off(e,t,r)}}$off(e,t,r){K&&this.__debug("$off",e,t),K&&this.__testEventIsDefined(e),this.__eventHandlers.get(e).delete(t),this.removeEventListener(e,t,r)}$emit(e){var t=[].slice.call(arguments,1);K&&this.__debug("$emit",e,t),K&&this.__testEventIsDefined(e),this.dispatchEvent(new CustomEvent(e,{detail:t}))}static $factory(e){if(!e)throw new Error("The $factory method requires a component’s name or selector to be specified.");return _(e).map(e=>new this(e).$mount())}}function te(e){var{breakpoint:t}=k().props();e.forEach(e=>{var[r,s]=e;r.includes(t)&&!s.$isMounted?setTimeout(()=>s.$mount(),0):!r.includes(t)&&s.$isMounted&&s.$destroy()})}ee.$isBase=!0,ee.config={name:"Base",emits:["mounted","updated","destroyed","terminated","ticked","scrolled","resized","moved","loaded"]};var re=new WeakMap;function se(e,t){void 0===t&&(t=k().props().breakpoint);var{activeBreakpoints:r,inactiveBreakpoints:s}=e.$options,i=r&&r.split(" ").includes(t),n=s&&s.split(" ").includes(t);return r&&i||s&&!n?"$mount":"$destroy"}function ie(e){var{activeBreakpoints:t,inactiveBreakpoints:r}=e.$options;return Boolean(t||r)}function ne(e,t){!function(e){var{activeBreakpoints:t,inactiveBreakpoints:r,name:s}=e.$options;if(t&&r)throw new Error("["+s+"] Incorrect configuration: the `activeBreakpoints` and `inactiveBreakpoints` are not compatible.")}(t);var{add:r,has:s}=k();s(e)||r(e,function(e){var{breakpoint:r}=e,s=se(t,r);"$destroy"===s&&t.$isMounted?t[s]():"$mount"!==s||t.$isMounted||setTimeout(()=>t[s](),0)})}function oe(e,t,r){if(void 0===r&&(r=.85),r>=1||r<=0)throw new Error("The `factor` parameter must be a number greater than 0 and smaller than 1, `"+r+"` given.");for(var s=t,i=e;Math.abs(s)>.1;)i+=s,s*=r;return i}var ae="drag",he="inertia",pe=0;class de extends f{constructor(e,r){return void 0===r&&(r={}),super(),this.props={target:null,mode:void 0,isGrabbing:!1,hasInertia:!1,x:0,y:0,delta:{x:0,y:0},origin:{x:0,y:0},distance:{x:0,y:0},final:{x:0,y:0}},this.options={dampFactor:.85},this.id="drag-"+(pe+=1),this.props.target=e,this.options=t({},this.options,r),this.pointerHandler=this.pointerHandler.bind(this),this.rafHandler=this.rafHandler.bind(this),this}init(){var e={passive:!0};return this.props.target.addEventListener("mousedown",this,e),this.props.target.addEventListener("touchstart",this,e),y().add(this.id,this.pointerHandler),this}kill(){return this.props.target.removeEventListener("mousemove",this),this.props.target.removeEventListener("touchmove",this),y().remove(this.id),this}handleEvent(e){var t=e instanceof MouseEvent?e.clientX:e.touches[0].clientX,r=e instanceof MouseEvent?e.clientY:e.touches[0].clientY;this.start(t,r)}start(e,t){this.props.x=e,this.props.y=t,this.props.origin.x=e,this.props.origin.y=t,this.props.delta.x=0,this.props.delta.y=0,this.props.distance.x=0,this.props.distance.y=0,this.props.final.x=e,this.props.final.y=t,this.props.mode="start",this.props.isGrabbing=!0,this.trigger(this.props)}drop(){this.props.isGrabbing=!1,this.props.mode="drop",this.props.hasInertia=!0,this.props.final.x=oe(this.props.x,this.props.delta.x,this.options.dampFactor),this.props.final.y=oe(this.props.y,this.props.delta.y,this.options.dampFactor),this.trigger(this.props),setTimeout(()=>{var e=E();e.remove(this.id),e.add(this.id,this.rafHandler)},0)}stop(){E().remove(this.id),this.props.hasInertia=!1,this.props.mode="stop",this.trigger(this.props)}rafHandler(){this.props.isGrabbing||(this.props.x+=this.props.delta.x,this.props.y+=this.props.delta.y,this.props.distance.x=this.props.x-this.props.origin.x,this.props.distance.y=this.props.y-this.props.origin.y,this.props.delta.x*=this.options.dampFactor,this.props.delta.y*=this.options.dampFactor,this.props.mode!==he&&(this.props.mode=he),this.trigger(this.props),Math.abs(this.props.delta.x)<.1&&Math.abs(this.props.delta.y)<.1&&this.stop())}pointerHandler(e){this.props.isGrabbing&&(this.props.x=e.x,this.props.y=e.y,this.props.delta.x=e.delta.x,this.props.delta.y=e.delta.y,this.props.final.x=e.x,this.props.final.y=e.y,this.props.distance.x=this.props.x-this.props.origin.x,this.props.distance.y=this.props.y-this.props.origin.y,this.props.mode!==ae&&(this.props.mode=ae),this.trigger(this.props),e.isDown||this.drop())}updateProps(){return this.props}}var le=new WeakMap;function ue(e,t){var r=le.get(e);if(!r){var s=new de(e,t);r={add:s.add.bind(s),remove:s.remove.bind(s),has:s.has.bind(s),props:s.updateProps.bind(s)},le.set(e,r)}return r}var ce=["target"];function _e(e,r){var s,i,n,o,a,h,p;return void 0===r&&(r={threshold:[0,1]}),i=l("isVisible"),n=l("observer"),o=s=class extends e{constructor(e){return super(e),Object.defineProperty(this,i,{writable:!0,value:!1}),Object.defineProperty(this,n,{writable:!0,value:void 0}),u(this,n)[n]=new IntersectionObserver(e=>{var t=e.reduce((e,t)=>e||t.isIntersecting,!1);u(this,i)[i]!==t&&(u(this,i)[i]=t,t?this.$mount():setTimeout(()=>this.$destroy()))},t({},r,this.$options.intersectionObserver)),u(this,n)[n].observe(this.$el),this.$on("terminated",()=>{u(this,n)[n].disconnect()}),this}$mount(){return u(this,i)[i]&&super.$mount(),this}},s.config=t({},e.config||{},{name:(null!=(a=null==e||null==(h=e.config)?void 0:h.name)?a:"")+"WithMountWhenInView",options:t({},(null==e||null==(p=e.config)?void 0:p.options)||{},{intersectionObserver:Object})}),o}function me(e,t,r){return t<r?e<t?t:e>r?r:e:e<r?r:e>t?t:e}function ve(e){return me(e,0,1)}function fe(e,t,r,s){return void 0===r&&(r=.5),void 0===s&&(s=.01),Math.abs(e-t)<s?e:t+(e-t)*r}function ge(e,t){return"string"==typeof e?_(e,t):Array.isArray(e)?e:[e]}e.Base=ee,e.createApp=function(e,t){var r,s="complete"===document.readyState;s?r=new e(t).$mount():document.addEventListener("readystatechange",()=>{"complete"===document.readyState&&(r=new e(t).$mount(),s=!0)});var i=new Promise(e=>{document.addEventListener("readystatechange",()=>{"complete"===document.readyState&&setTimeout(()=>e(r),0)})});return function(){return s?Promise.resolve(r):i}},e.importOnInteraction=function(e,t,r,s){var i="string"==typeof r?[r]:r;return new Promise(r=>{var n=ge(t,null==s?void 0:s.$el),o={capture:!0,passive:!0,once:!0},a=()=>{(t=>{e().then(e=>{t("default"in e?e.default:e)})})(r)};n.forEach(e=>{i.forEach(t=>{e.addEventListener(t,a,o)})})})},e.importWhenIdle=function(e,t){var r=t=>{e().then(e=>{t("default"in e?e.default:e)})};return new Promise(e=>{var s,i=null!=(s=null==t?void 0:t.timeout)?s:1;"requestIdleCallback"in window?window.requestIdleCallback(()=>{setTimeout(()=>{r(e)},0)},{timeout:null==t?void 0:t.timeout}):setTimeout(()=>{r(e)},i)})},e.importWhenVisible=function(e,t,r,s){return void 0===s&&(s={}),new Promise(i=>{var n=new IntersectionObserver(t=>{t.some(e=>e.isIntersecting)&&setTimeout(()=>{((t,r)=>{e().then(e=>{t("default"in e?e.default:e),n.disconnect()})})(i)},0)},s);ge(t,null==r?void 0:r.$el).forEach(e=>n.observe(e))})},e.useDrag=ue,e.useKey=B,e.useLoad=C,e.usePointer=y,e.useRaf=E,e.useResize=k,e.useScroll=P,e.withBreakpointManager=function(e,t){if(!Array.isArray(t))throw new Error("[withBreakpointManager] The `breakpoints` parameter must be an array.");if(t.length<2)throw new Error("[withBreakpointManager] You must define at least 2 breakpoints.");var{add:r,props:s}=k();if(!s().breakpoint)throw new Error("The `BreakpointManager` class requires breakpoints to be defined.");return class extends e{constructor(e){return super(e),re.has(this)||re.set(this,function(e,t){return t.map(t=>{var[r,s]=t,i=new s(e.$el);return Object.defineProperty(i,"$parent",{get:()=>e.$parent}),[r,i]})}(this,t)),r("BreakpointManager-"+this.$id,()=>{te(re.get(this))}),this.instances=re.get(this),this}$mount(){return super.$mount(),te(re.get(this)),this}$destroy(){return Array.isArray(re.get(this))&&re.get(this).forEach(e=>{var[,t]=e;t.$destroy()}),super.$destroy()}}},e.withBreakpointObserver=function(e){var r,s,i,n,o;return s=r=class extends e{constructor(e){super(e);var{remove:t,props:r}=k(),{name:s}=this.$options;if(!r().breakpoint)throw new Error("["+s+"] The `BreakpointObserver` class requires breakpoints to be defined.");var i="BreakpointObserver-"+this.$id;return new MutationObserver(e=>{var[r]=e;if("attributes"===r.type&&("data-options"===r.attributeName||r.attributeName.startsWith("data-option-"))){if(!ie(this))return this.$mount(),void t(i);ne(i,this)}}).observe(this.$el,{attributes:!0}),ie(this)?(ne(i,this),this):this}$mount(){return ie(this)?"$mount"===se(this)?super.$mount():this:super.$mount()}},r.config=t({},e.config||{},{name:(null!=(i=null==e||null==(n=e.config)?void 0:n.name)?i:"")+"WithBreakpointObserver",options:t({},(null==e||null==(o=e.config)?void 0:o.options)||{},{activeBreakpoints:String,inactiveBreakpoints:String})}),s},e.withDrag=function(e,t){var r,s,i=void 0===t?{}:t,{target:n=(e=>e.$el)}=i,o=function(e,t){if(null==e)return{};var r,s,i={},n=Object.keys(e);for(s=0;s<n.length;s++)t.indexOf(r=n[s])>=0||(i[r]=e[r]);return i}(i,ce);return s=r=class extends e{constructor(e){super(e),this.$on("mounted",()=>{this.$services.register("dragged",ue.bind(void 0,n.call(this,this),o)),this.$services.enable("dragged")}),this.$on("destroyed",()=>{this.$services.disable("dragged"),this.$services.unregister("dragged")})}},r.config={name:e.config.name+"WithDrag",emits:["dragged"]},s},e.withExtraConfig=function(e,t,r){var s,i;void 0===r&&(r={});var n=U(e.config,t,r);return n.name===e.config.name&&(n.name=e.config.name+"WithExtraConfig"),i=s=class extends e{},s.config=n,i},e.withIntersectionObserver=function(e,r){var s,i,n,o,a;return void 0===r&&(r={threshold:[...new Array(101)].map((e,t)=>t/100)}),i=s=class extends e{constructor(e){if(super(e),!this.intersected||"function"!=typeof this.intersected)throw new Error("[withIntersectionObserver] The `intersected` method must be defined.");return this.$observer=new IntersectionObserver(e=>{this.__callMethod("intersected",e)},t({},r,this.$options.intersectionObserver||{})),this.$on("mounted",()=>{this.$observer.observe(this.$el)}),this.$on("destroyed",()=>{this.$observer.unobserve(this.$el)}),this}},s.config=t({},e.config||{},{name:(null!=(n=null==e||null==(o=e.config)?void 0:o.name)?n:"")+"WithIntersectionObserver",options:t({},(null==e||null==(a=e.config)?void 0:a.options)||{},{intersectionObserver:Object}),emits:["intersected"]}),i},e.withMountWhenInView=_e,e.withScrolledInView=function(e){var t,r;return r=t=class extends(_e(e)){constructor(){super(...arguments),this.__props={start:{x:0,y:0},end:{x:0,y:0},current:{x:0,y:0},progress:{x:0,y:0},dampedProgress:{x:0,y:0}},this.dampFactor=.1,this.dampPrecision=.001}mounted(){this.__setProps()}resized(){this.__setProps()}scrolled(e){(!this.$services.has("ticked")&&e.changed.y||e.changed.x)&&this.$services.enable("ticked")}ticked(){this.__props.current.x=me(window.pageXOffset,this.__props.start.x,this.__props.end.x),this.__props.progress.x=ve((this.__props.current.x-this.__props.start.x)/(this.__props.end.x-this.__props.start.x)),this.__props.dampedProgress.x=fe(this.__props.progress.x,this.__props.dampedProgress.x,this.dampFactor,this.dampPrecision),this.__props.current.y=me(window.pageYOffset,this.__props.start.y,this.__props.end.y),this.__props.progress.y=ve((this.__props.current.y-this.__props.start.y)/(this.__props.end.y-this.__props.start.y)),this.__props.dampedProgress.y=fe(this.__props.progress.y,this.__props.dampedProgress.y,this.dampFactor,this.dampPrecision),this.__props.dampedProgress.x===this.__props.progress.x&&this.__props.dampedProgress.y===this.__props.progress.y&&this.$services.disable("ticked"),this.__callMethod("scrolledInView",this.__props)}__setProps(){var e=this.$el.getBoundingClientRect(),t=e.top+window.pageYOffset+e.height,r=t-window.innerHeight-e.height,s=me(window.pageYOffset,r,t),i=ve((s-r)/(t-r)),n=e.left+window.pageXOffset+e.width,o=n-window.innerWidth-e.width,a=me(window.pageXOffset,o,n),h=ve((a-o)/(n-o));this.__props.start.x=o,this.__props.start.y=r,this.__props.end.x=n,this.__props.end.y=t,this.__props.current.x=a,this.__props.current.y=s,this.__props.progress.x=h,this.__props.progress.y=i,this.__props.dampedProgress.x=fe(h,this.__props.dampedProgress.x),this.__props.dampedProgress.y=fe(i,this.__props.dampedProgress.y)}},t.config={name:e.config.name+"WithMountWhenInView",emits:["scrolledInView"]},r},e.withVue2=(e,r)=>{var s,i,n,o,a,h;return i=s=class extends e{constructor(e){super(e);var{vueConfig:t}=this.constructor;if(!t)throw new Error("[withVue] You must define a `vueConfig` object.");if("function"!=typeof t.render)throw new Error("[withVue] You must define a `render` function in vueConfig.");this.$vue=new r(t),this.$on("mounted",()=>{if(!(this.$refs.vue instanceof HTMLElement))throw new Error("[withVue] The `vue` refs must be a single HTMLElement.");this.$vue.$mount(this.$refs.vue)}),this.$on("destroyed",()=>{this.$vue.$destroy()})}},s.config=t({},e.config||{},{name:(null!=(n=null==e||null==(o=e.config)?void 0:o.name)?n:"")+"WithVue",refs:[...null!=(a=null==e||null==(h=e.config)?void 0:h.refs)?a:[],"vue"]}),i}});
|
|
1
|
+
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports):"function"==typeof define&&define.amd?define(["exports"],t):t((e||self).Base={})}(this,function(e){function t(){return t=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var s in r)Object.prototype.hasOwnProperty.call(r,s)&&(e[s]=r[s])}return e},t.apply(this,arguments)}var r,s,i,n,o,a,h,p,d=0;function l(e){return"__private_"+d+++"_"+e}function u(e,t){if(!Object.prototype.hasOwnProperty.call(e,t))throw new TypeError("attempted to use private field on non-instance");return e}function c(e,t){return"function"==typeof e[t]}function _(e,t){void 0===t&&(t=document);var r='[data-component="'+e+'"]',s=[];try{s=Array.from(t.querySelectorAll(r))}catch(e){}return 0===s.length&&(s=Array.from(t.querySelectorAll(e))),s}class m{get registeredNames(){return Object.keys(this).filter(e=>!e.startsWith("__"))}constructor(e,t,r,s){Object.defineProperties(this,{__base:{enumerable:!1,writable:!1,value:e},__element:{enumerable:!1,writable:!1,value:t},__components:{enumerable:!1,writable:!1,value:r},__eventsManager:{enumerable:!1,writable:!1,value:s}})}registerAll(){Object.entries(this.__components).forEach(e=>{var[t,r]=e;return this.__register(t,r)})}__register(e,t){Object.defineProperty(this,e,{enumerable:!0,configurable:!0,get:()=>{var r=_(e,this.__element);return 0===r.length?[]:r.map(r=>this.__getChild(r,t,e)).filter(e=>"terminated"!==e)}})}__getChild(e,t,r){if(e.__base__)return e.__base__;if("$isBase"in t){var s=new t(e);return Object.defineProperty(s,"$parent",{get:()=>this.__base}),s}return t(this.__base).then(t=>{var s;return this.__getChild(e,null!=(s=t.default)?s:t,r)})}mountAll(){this.__triggerHookForAll("$mount")}updateAll(){this.__triggerHookForAll("$update")}destroyAll(){this.__triggerHookForAll("$destroy")}__triggerHookForAll(e){this.registeredNames.forEach(t=>{this[t].forEach(r=>{r instanceof Promise?r.then(r=>this.__triggerHook(e,r,t)):this.__triggerHook(e,r,t)})})}__triggerHook(e,t,r){"$update"!==e||t.$isMounted||(e="$mount"),"$update"!==e&&"$destroy"!==e||this.__eventsManager.unbindChild(r,t),"$update"!==e&&"$mount"!==e||this.__eventsManager.bindChild(r,t),t[e]()}}class v{constructor(e,t,r,s){Object.defineProperties(this,{__element:{enumerable:!1,writable:!1,value:t},__refs:{enumerable:!1,writable:!1,value:r},__base:{enumerable:!1,writable:!1,value:e},__eventsManager:{enumerable:!1,writable:!1,value:s}})}registerAll(){this.__refs.forEach(e=>this.__register(e))}unregisterAll(){this.__refs.forEach(e=>this.__unregister(e))}__register(e){var t=e.endsWith("[]"),r=v.normalizeRefName(e),s=Array.from(this.__element.querySelectorAll('[data-ref="'+e+'"]')).filter(e=>this.__filterRefsBelongingToInstance(e));!t&&s.length>1&&console.warn("["+this.__base.$options.name+"]",'The "'+e+'" ref has been found multiple times.',"Did you forgot to add the `[]` suffix to its name?"),!t&&s.length<=1&&void 0===s[0]?console.warn("["+this.__base.$options.name+"]",'The "'+e+'" ref is missing.','Is there an `[data-ref="'+e+"\"]` element in the component's scope?"):(this.__eventsManager.bindRef(e,s),Object.defineProperty(this,r,{value:t||s.length>1?s:s[0],enumerable:!0,configurable:!0}))}__unregister(e){var t=v.normalizeRefName(e),r=Array.isArray(this[t])?this[t]:[this[t]];this.__eventsManager.unbindRef(e,r)}static normalizeRefName(e){return e.endsWith("[]")?e.replace(/\[\]$/,""):e}__filterRefsBelongingToInstance(e){for(var t=e.parentElement;t&&void 0===t.dataset.component;)t=t.parentElement;return null===t||t===this.__element}}class f{constructor(){this.callbacks=new Map,this.isInit=!1}updateProps(){throw this.props=[].slice.call(arguments),new Error("The `updateProps` method must be implemented.")}init(){throw new Error("The `init` method must be implemented.")}kill(){throw new Error("The `kill` method must be implemented.")}add(e,t){if(this.has(e))throw new Error("A callback with the key `"+e+"` has already been registered.");0!==this.callbacks.size||this.isInit||(this.init(),this.isInit=!0),this.callbacks.set(e,t)}has(e){return this.callbacks.has(e)}get(e){return this.callbacks.get(e)}remove(e){this.callbacks.delete(e),0===this.callbacks.size&&this.isInit&&(this.kill(),this.isInit=!1)}trigger(){var e=[].slice.call(arguments);return this.callbacks.forEach(function(t){t(...e)}),this}}function g(e){return"undefined"!=typeof TouchEvent&&e instanceof TouchEvent}class b extends f{constructor(){super(...arguments),this.props={event:null,isDown:!1,x:window.innerWidth/2,y:window.innerHeight/2,changed:{x:!1,y:!1},last:{x:window.innerWidth/2,y:window.innerHeight/2},delta:{x:0,y:0},progress:{x:.5,y:.5},max:{x:window.innerWidth,y:window.innerHeight}},this.hasRaf=!1}init(){document.documentElement.addEventListener("mouseenter",this,{once:!0,capture:!0});var e={passive:!0,capture:!0};return document.addEventListener("mousemove",this,e),document.addEventListener("touchmove",this,e),document.addEventListener("mousedown",this,e),document.addEventListener("touchstart",this,e),document.addEventListener("mouseup",this,e),document.addEventListener("touchend",this,e),this}handleEvent(e){switch(e.type){case"mouseenter":case"mousemove":case"touchmove":this.handler(e);break;case"mousedown":case"touchstart":this.downHandler();break;case"mouseup":case"touchend":this.upHandler()}}kill(){return document.removeEventListener("mousemove",this),document.removeEventListener("touchmove",this),document.removeEventListener("mousedown",this),document.removeEventListener("touchstart",this),document.removeEventListener("mouseup",this),document.removeEventListener("touchend",this),this}handler(e){this.updateProps(e),this.trigger(this.props)}downHandler(){this.props.isDown=!0,this.trigger(this.props)}upHandler(){this.props.isDown=!1,this.trigger(this.props)}updateProps(e){var t,r;this.props.event=e;var s=this.props.y,i=this.props.x,n=g(e)?null==(t=e.touches[0])?void 0:t.clientY:e.clientY;n!==this.props.y&&(this.props.y=n);var o=g(e)?null==(r=e.touches[0])?void 0:r.clientX:e.clientX;return o!==this.props.x&&(this.props.x=o),this.props.changed.x=this.props.x!==i,this.props.changed.y=this.props.y!==s,this.props.last.x=i,this.props.last.y=s,this.props.delta.x=this.props.x-i,this.props.delta.y=this.props.y-s,this.props.max.x=window.innerWidth,this.props.max.y=window.innerHeight,this.props.progress.x=this.props.x/this.props.max.x,this.props.progress.y=this.props.y/this.props.max.y,this.props}}function y(){return s||(r||(r=new b),s={add:r.add.bind(r),remove:r.remove.bind(r),has:r.has.bind(r),props:r.updateProps.bind(r)}),s}class w extends f{constructor(){super(...arguments),this.isTicking=!1,this.id=0,this.raf="undefined"!=typeof window&&window.requestAnimationFrame?window.requestAnimationFrame.bind(window):setTimeout,this.cancelRaf="undefined"!=typeof window&&window.cancelAnimationFrame?window.cancelAnimationFrame.bind(window):clearTimeout,this.props={time:performance.now()}}init(){this.isTicking=!0,this.loop()}loop(){this.updateProps(),this.trigger(this.props),this.isTicking&&(this.id=this.raf(()=>this.loop()))}kill(){this.cancelRaf(this.id),this.isTicking=!1}updateProps(){return this.props.time=window.performance.now(),this.props}}function E(){return n||(i||(i=new w),n={add:i.add.bind(i),remove:i.remove.bind(i),has:i.has.bind(i),props:i.updateProps.bind(i)}),n}function $(e,t){var r;return void 0===t&&(t=300),function(){clearTimeout(r),r=setTimeout(()=>{e(...[].slice.call(arguments))},t)}}class x extends f{constructor(){super(...arguments),this.props={width:window.innerWidth,height:window.innerHeight,ratio:window.innerWidth/window.innerHeight,orientation:"square"}}init(){return this.handler=$(()=>{this.updateProps(),this.trigger(this.props)}).bind(this),window.addEventListener("resize",this.handler),this}kill(){window.removeEventListener("resize",this.handler)}updateProps(){return this.props.width=window.innerWidth,this.props.height=window.innerHeight,this.props.ratio=window.innerWidth/window.innerHeight,this.props.orientation="square",this.props.ratio>1&&(this.props.orientation="landscape"),this.props.ratio<1&&(this.props.orientation="portrait"),this.breakpointElement?(this.props.breakpoint=this.breakpoint,this.props.breakpoints=this.breakpoints):(this.props.breakpoint=void 0,this.props.breakpoints=void 0),this.props}get breakpointElement(){return document.querySelector("[data-breakpoint]")}get breakpoint(){return window.getComputedStyle(this.breakpointElement,"::before").getPropertyValue("content").replace(/"/g,"")}get breakpoints(){return window.getComputedStyle(this.breakpointElement,"::after").getPropertyValue("content").replace(/"/g,"").split(",")}}function k(){if(!a){o||(o=new x);var e=o.add.bind(o),t=o.remove.bind(o),r=o.has.bind(o),s=o.updateProps.bind(o);a={add:e,remove:t,has:r,props:s}}return a}class O extends f{constructor(){super(...arguments),this.props={x:window.pageXOffset,y:window.pageYOffset,changed:{x:!1,y:!1},last:{x:window.pageXOffset,y:window.pageYOffset},delta:{x:0,y:0},max:{x:(document.scrollingElement||document.body).scrollWidth-window.innerWidth,y:(document.scrollingElement||document.body).scrollHeight-window.innerHeight},progress:{x:0,y:0},direction:{x:"NONE",y:"NONE"}}}init(){return this.updateProps(),document.addEventListener("scroll",this,{passive:!0,capture:!0}),this}get debouncedHandler(){var e=$(()=>{this.updateProps(),this.trigger(this.props)},100);return Object.defineProperty(this,"debouncedHandler",{value:e}),e}handleEvent(){this.updateProps(),this.trigger(this.props),this.debouncedHandler()}kill(){return document.removeEventListener("scroll",this),this}updateProps(){var e=this.props.y,t=this.props.x;return window.pageYOffset!==this.props.y&&(this.props.y=window.pageYOffset),window.pageXOffset!==this.props.x&&(this.props.x=window.pageXOffset),this.props.changed.x=this.props.x!==t,this.props.changed.y=this.props.y!==e,this.props.last.x=t,this.props.last.y=e,this.props.delta.x=this.props.x-t,this.props.delta.y=this.props.y-e,this.props.max.x=(document.scrollingElement||document.body).scrollWidth-window.innerWidth,this.props.max.y=(document.scrollingElement||document.body).scrollHeight-window.innerHeight,this.props.progress.x=0===this.props.max.x?1:this.props.x/this.props.max.x,this.props.progress.y=0===this.props.max.y?1:this.props.y/this.props.max.y,this.props.direction.x=this.props.x>t?"RIGHT":this.props.x<t?"LEFT":"NONE",this.props.direction.y=this.props.y>e?"DOWN":this.props.y<e?"UP":"NONE",this.props}}function P(){return p||(h||(h=new O),p={add:h.add.bind(h),remove:h.remove.bind(h),has:h.has.bind(h),props:h.updateProps.bind(h)}),p}var A,M,N,T,j={ENTER:13,SPACE:32,TAB:9,ESC:27,LEFT:37,UP:38,RIGHT:39,DOWN:40};class H extends f{constructor(){super(...arguments),this.props={event:null,triggered:0,isUp:!1,isDown:!1,ENTER:!1,SPACE:!1,TAB:!1,ESC:!1,LEFT:!1,UP:!1,RIGHT:!1,DOWN:!1,direction:"none"}}init(){document.addEventListener("keydown",this),document.addEventListener("keyup",this)}handleEvent(e){this.updateProps(e),this.trigger(this.props)}kill(){document.removeEventListener("keydown",this),document.removeEventListener("keyup",this)}updateProps(e){var t;return this.props.event=e,Object.entries(j).forEach(t=>{var[r,s]=t;this.props[r]=s===e.keyCode}),this.previousEvent||(this.props.triggered=0),"keydown"===this.props.event.type&&"keydown"===(null==(t=this.previousEvent)?void 0:t.type)?this.props.triggered+=1:this.props.triggered=1,this.previousEvent=this.props.event,this.props.direction="keydown"===this.props.event.type?"down":"up",this.props.isUp="keyup"===this.props.event.type,this.props.isDown="keydown"===this.props.event.type,this.props}}function B(){return M||(A||(A=new H),M={add:A.add.bind(A),remove:A.remove.bind(A),has:A.has.bind(A),props:A.updateProps.bind(A)}),M}class L extends f{constructor(){super(...arguments),this.props={time:window.performance.now()}}init(){window.addEventListener("load",this)}handleEvent(){this.updateProps(),this.trigger(this.props)}kill(){window.removeEventListener("load",this)}updateProps(){return this.props.time=window.performance.now(),this.props}}function I(){return T||(N||(N=new L),T={add:N.add.bind(N),remove:N.remove.bind(N),has:N.has.bind(N),props:N.updateProps.bind(N)}),T}var C={scrolled:P,resized:k,ticked:E,moved:y,keyed:B,loaded:I},S=Object.keys(C);class R{get __services(){return t({},this.__customServices,C)}constructor(e){this.__customServices={},Object.defineProperties(this,{__base:{enumerable:!1,writable:!1,value:e}})}has(e){if(!c(this.__base,e)&&!this.__base.__hasEvent(e)||!this.__services[e])return!1;var{has:t}=this.__services[e]();return t(this.__base.$id)}enable(e){if(this.has(e))return this.disable.bind(this,e);if(!c(this.__base,e)&&!this.__base.__hasEvent(e)||!this.__services[e])return function(){};var{add:t}=this.__services[e](),r=this;return t(this.__base.$id,function(){r.__base.__callMethod(e,...[].slice.call(arguments))}),this.disable.bind(this,e)}enableAll(){return Object.keys(this.__services).map(e=>this.enable(e))}disableAll(){Object.keys(this.__services).forEach(e=>{this.disable(e)})}disable(e){if(this.__services[e]){var{remove:t}=this.__services[e]();t(this.__base.$id)}}toggle(e,t){void 0!==t?(t&&!this.has(e)&&this.enable(e),!t&&this.has(e)&&this.disable(e)):this.has(e)?this.disable(e):this.enable(e)}register(e,t){this.__customServices[e]=t,this.__base.__addEmits(e)}unregister(e){if(S.includes(e))throw new Error("[ServicesManager] The `"+e+"` core service can not be unregistered.");this.__base.__removeEmits(e),delete this.__customServices[e]}}function W(e,t,r){void 0===t&&(t=[]),void 0===r&&(r=null);var s=Object.getPrototypeOf(e);if(s===Object.prototype||null===s)return t;var i=Object.getOwnPropertyNames(s);return"function"==typeof r&&(i=i.filter(e=>r(e,s))),i=i.map(e=>[e,s]).reduce((e,t)=>[...e,t],t),W(s,i,r)}class z{constructor(e,t){this.__methodsCache=new Map,this.__rootElementHandler={handleEvent:e=>{var t=z.normalizeName(e.type);this.__base["on"+t](e)}},this.__refsHandler={handleEvent:e=>{var t=e.currentTarget,r=v.normalizeRefName(t.dataset.ref),s="on"+z.normalizeName(r)+z.normalizeName(e.type),i=0;Array.isArray(this.__base.$refs[r])&&(i=this.__base.$refs[r].indexOf(t)),this.__base[s](e,i)}},this.__childrenHandler={handleEvent:e=>{var t,r=e.currentTarget,s=0,i=this.__base.$children;i.registeredNames.find(e=>!!i[e].includes(r)&&(t=e,s=i[e].indexOf(r),!0));var n="on"+z.normalizeName(t)+z.normalizeName(e.type),o=Array.isArray(e.detail)?e.detail:[];this.__base[n](...o,s,e)}},Object.defineProperties(this,{__rootElement:{enumerable:!1,writable:!1,value:e},__base:{enumerable:!1,writable:!1,value:t},__methodsCache:{enumerable:!1,writable:!1,value:this.__methodsCache},__rootElementHandler:{enumerable:!1,writable:!1,value:this.__rootElementHandler},__refsHandler:{enumerable:!1,writable:!1,value:this.__refsHandler},__childrenHandler:{enumerable:!1,writable:!1,value:this.__childrenHandler}})}__manageRef(e,t,r){void 0===r&&(r="add");var s=r+"EventListener";this.__getEventMethodsByName(e).forEach(r=>{var i=this.__getEventNameByMethod(r,e);t.forEach(e=>e[s](i,this.__refsHandler))})}bindRef(e,t){this.__manageRef(e,t)}unbindRef(e,t){this.__manageRef(e,t,"remove")}__manageChild(e,t,r){void 0===r&&(r="add");var s="add"===r?"$on":"$off";this.__getEventMethodsByName(e).forEach(r=>{var i=this.__getEventNameByMethod(r,e);t[s](i,this.__childrenHandler)})}bindChild(e,t){this.__manageChild(e,t)}unbindChild(e,t){this.__manageChild(e,t,"remove")}__manageRootElement(e){void 0===e&&(e="add");var t=e+"EventListener",r=this.__getEventMethodsByName(),{emits:s=[]}=this.__base.__config;r.forEach(e=>{var r=this.__getEventNameByMethod(e);(s.includes(r)?this.__base:this.__rootElement)[t](r,this.__rootElementHandler)})}bindRootElement(){this.__manageRootElement()}unbindRootElement(){this.__manageRootElement("remove")}__getEventNameByMethod(e,t){void 0===t&&(t="");var r=z.normalizeName(t),s=new RegExp("^on"+r+"([A-Z].*)$"),[,i]=e.match(s);return z.normalizeEventName(i)}__getEventMethodsByName(e){void 0===e&&(e="");var t=z.normalizeName(e),r=new RegExp("^on"+t+"[A-Z].*$"),s=r.toString(),i=this.__methodsCache.get(s);return i||(i=Array.from(W(this.__base,[],e=>r.test(e)).reduce((e,t)=>{var[r]=t;return e.add(r)},new Set)),this.__methodsCache.set(s,i)),i}static normalizeName(e){return e.replace(/[A-Z]([A-Z].*)/g,e=>e.toLowerCase()).replace(/[^a-zA-Z\d\s:]/g," ").replace(/(^\w|\s+\w)/g,e=>e.trim().toUpperCase()).trim()}static normalizeEventName(e){return e.replace(/[A-Z]/g,e=>"-"+e.toLowerCase()).replace(/^-/,"")}}var V=function(e){return function(e){return!!e&&"object"==typeof e}(e)&&!function(e){var t=Object.prototype.toString.call(e);return"[object RegExp]"===t||"[object Date]"===t||function(e){return e.$$typeof===D}(e)}(e)},D="function"==typeof Symbol&&Symbol.for?Symbol.for("react.element"):60103;function F(e,t){return!1!==t.clone&&t.isMergeableObject(e)?G(Array.isArray(e)?[]:{},e,t):e}function q(e,t,r){return e.concat(t).map(function(e){return F(e,r)})}function Y(e){return Object.keys(e).concat(function(e){return Object.getOwnPropertySymbols?Object.getOwnPropertySymbols(e).filter(function(t){return e.propertyIsEnumerable(t)}):[]}(e))}function X(e,t){try{return t in e}catch(e){return!1}}function G(e,t,r){(r=r||{}).arrayMerge=r.arrayMerge||q,r.isMergeableObject=r.isMergeableObject||V,r.cloneUnlessOtherwiseSpecified=F;var s=Array.isArray(t);return s===Array.isArray(e)?s?r.arrayMerge(e,t,r):function(e,t,r){var s={};return r.isMergeableObject(e)&&Y(e).forEach(function(t){s[t]=F(e[t],r)}),Y(t).forEach(function(i){(function(e,t){return X(e,t)&&!(Object.hasOwnProperty.call(e,t)&&Object.propertyIsEnumerable.call(e,t))})(e,i)||(s[i]=X(e,i)&&r.isMergeableObject(t[i])?function(e,t){if(!t.customMerge)return G;var r=t.customMerge(e);return"function"==typeof r?r:G}(i,r)(e[i],t[i],r):F(t[i],r))}),s}(e,t,r):F(t,r)}G.all=function(e,t){if(!Array.isArray(e))throw new Error("first argument should be an array");return e.reduce(function(e,r){return G(e,r,t)},{})};var U=G;class Z{constructor(e,t,r){var s,i;return this.__values={},this.__defaultValues={String:"",Number:0,Boolean:!1,Array:()=>[],Object:()=>({})},this.name="Base",this.debug=!1,this.log=!1,Object.defineProperties(this,{__element:{enumerable:!1,writable:!1,value:e},__values:{enumerable:!1,writable:!1,value:this.__values},__defaultValues:{enumerable:!1,writable:!1,value:this.__defaultValues}}),this.name=r.name,t.debug={type:Boolean,default:null!=(s=r.debug)&&s},t.log={type:Boolean,default:null!=(i=r.log)&&i},Object.entries(t).forEach(e=>{var[t,r]=e;this.__register(t,r)}),this}__register(e,t){var r=!Z.types.includes(t),s=r?t.type:t;if(!Z.types.includes(s))throw new Error('The "'+e+'" option has an invalid type. The allowed types are: String, Number, Boolean, Array and Object.');var i=r?t.default:this.__defaultValues[s.name];if((s===Array||s===Object)&&"function"!=typeof i)throw new Error('The default value for options of type "'+s.name+'" must be returned by a function.');Object.defineProperty(this,e,{get:()=>this.get(e,s,i),set:t=>{this.set(e,s,t,i)},enumerable:!0})}get(e,t,r){var s=Z.__getPropertyName(e),i=this.__hasProperty(s);if(t===Boolean){if(r){var n=Z.__getPropertyName(e,"No");return!this.__hasProperty(n)}return i||r}var o=this.__element.dataset[s];if(t===Number)return i?Number(o):r;if(t===Array||t===Object){var a=U(r(),i?JSON.parse(o):this.__defaultValues[t.name]());return this.__values[e]||(this.__values[e]=a),this.__values[e]}return i?o:r}set(e,t,r,s){var i=Z.__getPropertyName(e);if(r.constructor.name!==t.name){var n=Array.isArray(r)||function(e){return"object"==typeof e&&!!e&&"[object Object]"===e.toString()}(r)?JSON.stringify(r):r;throw new TypeError('The "'+n+'" value for the "'+e+'" option must be of type "'+t.name+'"')}switch(t){case Boolean:if(s){var o=Z.__getPropertyName(e,"No");r?delete this.__element.dataset[o]:this.__element.dataset[o]=""}else r?this.__element.dataset[i]="":delete this.__element.dataset[i];break;case Array:case Object:this.__values[e]=r;break;default:this.__element.dataset[i]=r}}__hasProperty(e){return void 0!==this.__element.dataset[e]}static __getPropertyName(e,t){void 0===t&&(t="");var r=e+t;if(Z.__propertyNameCache.has(r))return Z.__propertyNameCache.get(r);var s="option"+t+e.replace(/^\w/,e=>e.toUpperCase());return Z.__propertyNameCache.set(r,s),s}}Z.types=[String,Number,Boolean,Array,Object],Z.__propertyNameCache=new Map;var J=0,K="undefined"!=typeof __DEV__&&__DEV__;function Q(){}class ee extends EventTarget{get $root(){if(!this.$parent)return this;for(var e=this.$parent,t=this.$parent;e;)e.$parent||(t=e),e=e.$parent;return t}get __config(){for(var e=Object.getPrototypeOf(this),{config:r}=e.constructor;e.constructor.config&&e.constructor.$isBase;)r=t({},e.constructor.config,r),e.constructor.config.options&&(r.options=t({},e.constructor.config.options,r.options)),e.constructor.config.emits&&r.emits&&(r.emits=[...e.constructor.config.emits,...r.emits]),e=Object.getPrototypeOf(e);return r}get $services(){return this.__services}get $refs(){return this.__refs}get $options(){return this.__options}get $children(){return this.__children}get $log(){return this.__options.log?window.console.log.bind(window,"["+this.__config.name+"]"):Q}get __debug(){return K&&this.__options.debug?window.console.log.bind(window,"[debug] ["+this.$id+"]"):Q}__callMethod(e){var t=[].slice.call(arguments,1);K&&this.__debug("callMethod",e,...t),this.$emit(e,...t),"function"==typeof this[e]&&(this[e].call(this,...t),K&&this.__debug(e,this,...t))}__hasEvent(e){var t=this.__eventHandlers.get(e);return t&&t.size>0}constructor(e){if(super(),this.$parent=null,this.$isMounted=!1,this.__eventHandlers=new Map,!e)throw new Error("The root element must be defined.");var{__config:t}=this;if("Base"===t.name)throw new Error("The `config.name` property is required.");return this.$id=t.name+"-"+J,J+=1,this.$el=e,"__base__"in this.$el||Object.defineProperty(this.$el,"__base__",{get:()=>this,configurable:!0}),this.__options=new Z(e,t.options||{},t),this.__services=new R(this),this.__events=new z(e,this),this.__children=new m(this,e,t.components||{},this.__events),this.__refs=new v(this,e,t.refs||[],this.__events),K&&this.__debug("constructor",this),this}$mount(){return this.$isMounted||(this.$isMounted=!0,K&&this.__debug("$mount"),this.$children.registerAll(),this.$refs.registerAll(),this.__events.bindRootElement(),this.$services.enableAll(),this.$children.mountAll(),this.__callMethod("mounted")),this}$update(){return K&&this.__debug("$update"),this.$refs.unregisterAll(),this.$services.disableAll(),this.$children.registerAll(),this.$refs.registerAll(),this.$services.enableAll(),this.$children.updateAll(),this.__callMethod("updated"),this}$destroy(){return this.$isMounted?(this.$isMounted=!1,K&&this.__debug("$destroy"),this.__events.unbindRootElement(),this.$refs.unregisterAll(),this.$services.disableAll(),this.$children.destroyAll(),this.__callMethod("destroyed"),this):this}$terminate(){K&&this.__debug("$terminate"),this.$destroy(),this.__callMethod("terminated"),Object.defineProperty(this.$el,"__base__",{value:"terminated",configurable:!1,writable:!1})}__testEventIsDefined(e){Array.isArray(this.__config.emits)&&this.__config.emits.includes(e)||console.warn("["+this.__config.name+"]",'The "'+e+'" event is missing from the configuration.')}__addEmits(e){var t=this.constructor;Array.isArray(t.config.emits)?t.config.emits.push(e):t.config.emits=[e]}__removeEmits(e){var t=this.constructor,r=t.config.emits.findIndex(t=>t===e);t.config.emits.splice(r,1)}$on(e,t,r){K&&this.__debug("$on",e,t,r),K&&this.__testEventIsDefined(e);var s=this.__eventHandlers.get(e);return s||(s=new Set,this.__eventHandlers.set(e,s)),s.add(t),this.addEventListener(e,t,r),()=>{this.$off(e,t,r)}}$off(e,t,r){K&&this.__debug("$off",e,t),K&&this.__testEventIsDefined(e),this.__eventHandlers.get(e).delete(t),this.removeEventListener(e,t,r)}$emit(e){var t=[].slice.call(arguments,1);K&&this.__debug("$emit",e,t),K&&this.__testEventIsDefined(e),this.dispatchEvent(new CustomEvent(e,{detail:t}))}static $factory(e){if(!e)throw new Error("The $factory method requires a component’s name or selector to be specified.");return _(e).map(e=>new this(e).$mount())}}function te(e){var{breakpoint:t}=k().props();e.forEach(e=>{var[r,s]=e;r.includes(t)&&!s.$isMounted?setTimeout(()=>s.$mount(),0):!r.includes(t)&&s.$isMounted&&s.$destroy()})}ee.$isBase=!0,ee.config={name:"Base",emits:["mounted","updated","destroyed","terminated","ticked","scrolled","resized","moved","loaded","keyed"]};var re=new WeakMap;function se(e,t){void 0===t&&(t=k().props().breakpoint);var{activeBreakpoints:r,inactiveBreakpoints:s}=e.$options,i=r&&r.split(" ").includes(t),n=s&&s.split(" ").includes(t);return r&&i||s&&!n?"$mount":"$destroy"}function ie(e){var{activeBreakpoints:t,inactiveBreakpoints:r}=e.$options;return Boolean(t||r)}function ne(e,t){!function(e){var{activeBreakpoints:t,inactiveBreakpoints:r,name:s}=e.$options;if(t&&r)throw new Error("["+s+"] Incorrect configuration: the `activeBreakpoints` and `inactiveBreakpoints` are not compatible.")}(t);var{add:r,has:s}=k();s(e)||r(e,function(e){var{breakpoint:r}=e,s=se(t,r);"$destroy"===s&&t.$isMounted?t[s]():"$mount"!==s||t.$isMounted||setTimeout(()=>t[s](),0)})}function oe(e,t,r){if(void 0===r&&(r=.85),r>=1||r<=0)throw new Error("The `factor` parameter must be a number greater than 0 and smaller than 1, `"+r+"` given.");for(var s=t,i=e;Math.abs(s)>.1;)i+=s,s*=r;return i}var ae="drag",he="inertia",pe=0;class de extends f{constructor(e,r){return void 0===r&&(r={}),super(),this.props={target:null,mode:void 0,isGrabbing:!1,hasInertia:!1,x:0,y:0,delta:{x:0,y:0},origin:{x:0,y:0},distance:{x:0,y:0},final:{x:0,y:0}},this.options={dampFactor:.85},this.id="drag-"+(pe+=1),this.props.target=e,this.options=t({},this.options,r),this.pointerHandler=this.pointerHandler.bind(this),this.rafHandler=this.rafHandler.bind(this),this}init(){var e={passive:!0};return this.props.target.addEventListener("mousedown",this,e),this.props.target.addEventListener("touchstart",this,e),y().add(this.id,this.pointerHandler),this}kill(){return this.props.target.removeEventListener("mousemove",this),this.props.target.removeEventListener("touchmove",this),y().remove(this.id),this}handleEvent(e){var t=e instanceof MouseEvent?e.clientX:e.touches[0].clientX,r=e instanceof MouseEvent?e.clientY:e.touches[0].clientY;this.start(t,r)}start(e,t){this.props.x=e,this.props.y=t,this.props.origin.x=e,this.props.origin.y=t,this.props.delta.x=0,this.props.delta.y=0,this.props.distance.x=0,this.props.distance.y=0,this.props.final.x=e,this.props.final.y=t,this.props.mode="start",this.props.isGrabbing=!0,this.trigger(this.props)}drop(){this.props.isGrabbing=!1,this.props.mode="drop",this.props.hasInertia=!0,this.props.final.x=oe(this.props.x,this.props.delta.x,this.options.dampFactor),this.props.final.y=oe(this.props.y,this.props.delta.y,this.options.dampFactor),this.trigger(this.props),setTimeout(()=>{var e=E();e.remove(this.id),e.add(this.id,this.rafHandler)},0)}stop(){E().remove(this.id),this.props.hasInertia=!1,this.props.mode="stop",this.trigger(this.props)}rafHandler(){this.props.isGrabbing||(this.props.x+=this.props.delta.x,this.props.y+=this.props.delta.y,this.props.distance.x=this.props.x-this.props.origin.x,this.props.distance.y=this.props.y-this.props.origin.y,this.props.delta.x*=this.options.dampFactor,this.props.delta.y*=this.options.dampFactor,this.props.mode!==he&&(this.props.mode=he),this.trigger(this.props),Math.abs(this.props.delta.x)<.1&&Math.abs(this.props.delta.y)<.1&&this.stop())}pointerHandler(e){this.props.isGrabbing&&(this.props.x=e.x,this.props.y=e.y,this.props.delta.x=e.delta.x,this.props.delta.y=e.delta.y,this.props.final.x=e.x,this.props.final.y=e.y,this.props.distance.x=this.props.x-this.props.origin.x,this.props.distance.y=this.props.y-this.props.origin.y,this.props.mode!==ae&&(this.props.mode=ae),this.trigger(this.props),e.isDown||this.drop())}updateProps(){return this.props}}var le=new WeakMap;function ue(e,t){var r=le.get(e);if(!r){var s=new de(e,t);r={add:s.add.bind(s),remove:s.remove.bind(s),has:s.has.bind(s),props:s.updateProps.bind(s)},le.set(e,r)}return r}var ce=["target"];function _e(e,r){var s,i,n,o,a,h,p;return void 0===r&&(r={threshold:[0,1]}),i=l("isVisible"),n=l("observer"),o=s=class extends e{constructor(e){return super(e),Object.defineProperty(this,i,{writable:!0,value:!1}),Object.defineProperty(this,n,{writable:!0,value:void 0}),u(this,n)[n]=new IntersectionObserver(e=>{var t=e.reduce((e,t)=>e||t.isIntersecting,!1);u(this,i)[i]!==t&&(u(this,i)[i]=t,t?this.$mount():setTimeout(()=>this.$destroy()))},t({},r,this.$options.intersectionObserver)),u(this,n)[n].observe(this.$el),this.$on("terminated",()=>{u(this,n)[n].disconnect()}),this}$mount(){return u(this,i)[i]&&super.$mount(),this}},s.config=t({},e.config||{},{name:(null!=(a=null==e||null==(h=e.config)?void 0:h.name)?a:"")+"WithMountWhenInView",options:t({},(null==e||null==(p=e.config)?void 0:p.options)||{},{intersectionObserver:Object})}),o}function me(e,t,r){return t<r?e<t?t:e>r?r:e:e<r?r:e>t?t:e}function ve(e){return me(e,0,1)}function fe(e,t,r,s){return void 0===r&&(r=.5),void 0===s&&(s=.01),Math.abs(e-t)<s?e:t+(e-t)*r}function ge(e,t){return"string"==typeof e?_(e,t):Array.isArray(e)?e:[e]}e.Base=ee,e.createApp=function(e,t){var r,s="complete"===document.readyState;s?r=new e(t).$mount():document.addEventListener("readystatechange",()=>{"complete"===document.readyState&&(r=new e(t).$mount(),s=!0)});var i=new Promise(e=>{document.addEventListener("readystatechange",()=>{"complete"===document.readyState&&setTimeout(()=>e(r),0)})});return function(){return s?Promise.resolve(r):i}},e.importOnInteraction=function(e,t,r,s){var i="string"==typeof r?[r]:r;return new Promise(r=>{var n=ge(t,null==s?void 0:s.$el),o={capture:!0,passive:!0,once:!0},a=()=>{(t=>{e().then(e=>{t("default"in e?e.default:e)})})(r)};n.forEach(e=>{i.forEach(t=>{e.addEventListener(t,a,o)})})})},e.importWhenIdle=function(e,t){var r=t=>{e().then(e=>{t("default"in e?e.default:e)})};return new Promise(e=>{var s,i=null!=(s=null==t?void 0:t.timeout)?s:1;"requestIdleCallback"in window?window.requestIdleCallback(()=>{setTimeout(()=>{r(e)},0)},{timeout:null==t?void 0:t.timeout}):setTimeout(()=>{r(e)},i)})},e.importWhenVisible=function(e,t,r,s){return void 0===s&&(s={}),new Promise(i=>{var n=new IntersectionObserver(t=>{t.some(e=>e.isIntersecting)&&setTimeout(()=>{((t,r)=>{e().then(e=>{t("default"in e?e.default:e),n.disconnect()})})(i)},0)},s);ge(t,null==r?void 0:r.$el).forEach(e=>n.observe(e))})},e.useDrag=ue,e.useKey=B,e.useLoad=I,e.usePointer=y,e.useRaf=E,e.useResize=k,e.useScroll=P,e.withBreakpointManager=function(e,t){if(!Array.isArray(t))throw new Error("[withBreakpointManager] The `breakpoints` parameter must be an array.");if(t.length<2)throw new Error("[withBreakpointManager] You must define at least 2 breakpoints.");var{add:r,props:s}=k();if(!s().breakpoint)throw new Error("The `BreakpointManager` class requires breakpoints to be defined.");return class extends e{constructor(e){return super(e),re.has(this)||re.set(this,function(e,t){return t.map(t=>{var[r,s]=t,i=new s(e.$el);return Object.defineProperty(i,"$parent",{get:()=>e.$parent}),[r,i]})}(this,t)),r("BreakpointManager-"+this.$id,()=>{te(re.get(this))}),this.instances=re.get(this),this}$mount(){return super.$mount(),te(re.get(this)),this}$destroy(){return Array.isArray(re.get(this))&&re.get(this).forEach(e=>{var[,t]=e;t.$destroy()}),super.$destroy()}}},e.withBreakpointObserver=function(e){var r,s,i,n,o;return s=r=class extends e{constructor(e){super(e);var{remove:t,props:r}=k(),{name:s}=this.$options;if(!r().breakpoint)throw new Error("["+s+"] The `BreakpointObserver` class requires breakpoints to be defined.");var i="BreakpointObserver-"+this.$id;return new MutationObserver(e=>{var[r]=e;if("attributes"===r.type&&("data-options"===r.attributeName||r.attributeName.startsWith("data-option-"))){if(!ie(this))return this.$mount(),void t(i);ne(i,this)}}).observe(this.$el,{attributes:!0}),ie(this)?(ne(i,this),this):this}$mount(){return ie(this)?"$mount"===se(this)?super.$mount():this:super.$mount()}},r.config=t({},e.config||{},{name:(null!=(i=null==e||null==(n=e.config)?void 0:n.name)?i:"")+"WithBreakpointObserver",options:t({},(null==e||null==(o=e.config)?void 0:o.options)||{},{activeBreakpoints:String,inactiveBreakpoints:String})}),s},e.withDrag=function(e,t){var r,s,i=void 0===t?{}:t,{target:n=(e=>e.$el)}=i,o=function(e,t){if(null==e)return{};var r,s,i={},n=Object.keys(e);for(s=0;s<n.length;s++)t.indexOf(r=n[s])>=0||(i[r]=e[r]);return i}(i,ce);return s=r=class extends e{constructor(e){super(e),this.$on("mounted",()=>{this.$services.register("dragged",ue.bind(void 0,n.call(this,this),o)),this.$services.enable("dragged")}),this.$on("destroyed",()=>{this.$services.disable("dragged"),this.$services.unregister("dragged")})}},r.config={name:e.config.name+"WithDrag",emits:["dragged"]},s},e.withExtraConfig=function(e,t,r){var s,i;void 0===r&&(r={});var n=U(e.config,t,r);return n.name===e.config.name&&(n.name=e.config.name+"WithExtraConfig"),i=s=class extends e{},s.config=n,i},e.withIntersectionObserver=function(e,r){var s,i,n,o,a;return void 0===r&&(r={threshold:[...new Array(101)].map((e,t)=>t/100)}),i=s=class extends e{constructor(e){if(super(e),!this.intersected||"function"!=typeof this.intersected)throw new Error("[withIntersectionObserver] The `intersected` method must be defined.");return this.$observer=new IntersectionObserver(e=>{this.__callMethod("intersected",e)},t({},r,this.$options.intersectionObserver||{})),this.$on("mounted",()=>{this.$observer.observe(this.$el)}),this.$on("destroyed",()=>{this.$observer.unobserve(this.$el)}),this}},s.config=t({},e.config||{},{name:(null!=(n=null==e||null==(o=e.config)?void 0:o.name)?n:"")+"WithIntersectionObserver",options:t({},(null==e||null==(a=e.config)?void 0:a.options)||{},{intersectionObserver:Object}),emits:["intersected"]}),i},e.withMountWhenInView=_e,e.withScrolledInView=function(e,t){var r,s;return s=r=class extends(_e(e,t)){constructor(){super(...arguments),this.__props={start:{x:0,y:0},end:{x:0,y:0},current:{x:0,y:0},progress:{x:0,y:0},dampedProgress:{x:0,y:0}},this.dampFactor=.1,this.dampPrecision=.001}mounted(){this.__setProps()}resized(){this.__setProps()}scrolled(e){(!this.$services.has("ticked")&&e.changed.y||e.changed.x)&&this.$services.enable("ticked")}ticked(){this.__props.current.x=me(window.pageXOffset,this.__props.start.x,this.__props.end.x),this.__props.progress.x=ve((this.__props.current.x-this.__props.start.x)/(this.__props.end.x-this.__props.start.x)),this.__props.dampedProgress.x=fe(this.__props.progress.x,this.__props.dampedProgress.x,this.dampFactor,this.dampPrecision),this.__props.current.y=me(window.pageYOffset,this.__props.start.y,this.__props.end.y),this.__props.progress.y=ve((this.__props.current.y-this.__props.start.y)/(this.__props.end.y-this.__props.start.y)),this.__props.dampedProgress.y=fe(this.__props.progress.y,this.__props.dampedProgress.y,this.dampFactor,this.dampPrecision),this.__props.dampedProgress.x===this.__props.progress.x&&this.__props.dampedProgress.y===this.__props.progress.y&&this.$services.disable("ticked"),this.__callMethod("scrolledInView",this.__props)}__setProps(){var e=this.$el.getBoundingClientRect(),t=e.top+window.pageYOffset+e.height,r=t-window.innerHeight-e.height,s=me(window.pageYOffset,r,t),i=ve((s-r)/(t-r)),n=e.left+window.pageXOffset+e.width,o=n-window.innerWidth-e.width,a=me(window.pageXOffset,o,n),h=ve((a-o)/(n-o));this.__props.start.x=o,this.__props.start.y=r,this.__props.end.x=n,this.__props.end.y=t,this.__props.current.x=a,this.__props.current.y=s,this.__props.progress.x=h,this.__props.progress.y=i,this.__props.dampedProgress.x=fe(h,this.__props.dampedProgress.x),this.__props.dampedProgress.y=fe(i,this.__props.dampedProgress.y)}},r.config={name:e.config.name+"WithMountWhenInView",emits:["scrolledInView"]},s},e.withVue2=(e,r)=>{var s,i,n,o,a,h;return i=s=class extends e{constructor(e){super(e);var{vueConfig:t}=this.constructor;if(!t)throw new Error("[withVue] You must define a `vueConfig` object.");if("function"!=typeof t.render)throw new Error("[withVue] You must define a `render` function in vueConfig.");this.$vue=new r(t),this.$on("mounted",()=>{if(!(this.$refs.vue instanceof HTMLElement))throw new Error("[withVue] The `vue` refs must be a single HTMLElement.");this.$vue.$mount(this.$refs.vue)}),this.$on("destroyed",()=>{this.$vue.$destroy()})}},s.config=t({},e.config||{},{name:(null!=(n=null==e||null==(o=e.config)?void 0:o.name)?n:"")+"WithVue",refs:[...null!=(a=null==e||null==(h=e.config)?void 0:h.refs)?a:[],"vue"]}),i}});
|
package/package.json
CHANGED
package/services/index.d.ts
CHANGED
|
@@ -1,3 +1,10 @@
|
|
|
1
|
+
export { default as useDrag } from "./drag.js";
|
|
2
|
+
export { default as useKey } from "./key.js";
|
|
3
|
+
export { default as useLoad } from "./load.js";
|
|
4
|
+
export { default as usePointer } from "./pointer.js";
|
|
5
|
+
export { default as useRaf } from "./raf.js";
|
|
6
|
+
export { default as useResize } from "./resize.js";
|
|
7
|
+
export { default as useScroll } from "./scroll.js";
|
|
1
8
|
export type ServiceInterface<T> = {
|
|
2
9
|
/**
|
|
3
10
|
* Remove a function from the resize service by its key.
|
|
@@ -16,11 +23,3 @@ export type ServiceInterface<T> = {
|
|
|
16
23
|
*/
|
|
17
24
|
props: () => T;
|
|
18
25
|
};
|
|
19
|
-
import useKey from "./key.js";
|
|
20
|
-
import usePointer from "./pointer.js";
|
|
21
|
-
import useDrag from "./drag.js";
|
|
22
|
-
import useLoad from "./load.js";
|
|
23
|
-
import useRaf from "./raf.js";
|
|
24
|
-
import useResize from "./resize.js";
|
|
25
|
-
import useScroll from "./scroll.js";
|
|
26
|
-
export { useKey, usePointer, useDrag, useLoad, useRaf, useResize, useScroll };
|
package/services/index.js
CHANGED
|
@@ -1,8 +1,7 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
export { useKey, usePointer, useDrag, useLoad, useRaf, useResize, useScroll };
|
|
1
|
+
export { default as useDrag } from './drag.js';
|
|
2
|
+
export { default as useKey } from './key.js';
|
|
3
|
+
export { default as useLoad } from './load.js';
|
|
4
|
+
export { default as usePointer } from './pointer.js';
|
|
5
|
+
export { default as useRaf } from './raf.js';
|
|
6
|
+
export { default as useResize } from './resize.js';
|
|
7
|
+
export { default as useScroll } from './scroll.js';
|
package/utils/collide/index.d.ts
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
export { boundingRectToCircle, collideCircleCircle, collideCircleRect, collidePointCircle, collidePointRect, collideRectRect };
|
|
1
|
+
export { default as boundingRectToCircle } from "./boundingRectToCircle.js";
|
|
2
|
+
export { default as collideCircleCircle } from "./collideCircleCircle.js";
|
|
3
|
+
export { default as collideCircleRect } from "./collideCircleRect.js";
|
|
4
|
+
export { default as collidePointCircle } from "./collidePointCircle.js";
|
|
5
|
+
export { default as collidePointRect } from "./collidePointRect.js";
|
|
6
|
+
export { default as collideRectRect } from "./collideRectRect.js";
|
package/utils/collide/index.js
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
export { boundingRectToCircle, collideCircleCircle, collideCircleRect, collidePointCircle, collidePointRect, collideRectRect };
|
|
1
|
+
export { default as boundingRectToCircle } from './boundingRectToCircle.js';
|
|
2
|
+
export { default as collideCircleCircle } from './collideCircleCircle.js';
|
|
3
|
+
export { default as collideCircleRect } from './collideCircleRect.js';
|
|
4
|
+
export { default as collidePointCircle } from './collidePointCircle.js';
|
|
5
|
+
export { default as collidePointRect } from './collidePointRect.js';
|
|
6
|
+
export { default as collideRectRect } from './collideRectRect.js';
|
package/utils/css/index.d.ts
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
export { classes, styles, matrix, transition };
|
|
1
|
+
export * as classes from "./classes.js";
|
|
2
|
+
export * as styles from "./styles.js";
|
|
3
|
+
export { default as matrix } from "./matrix.js";
|
|
4
|
+
export { default as transition } from "./transition.js";
|
package/utils/css/index.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
import * as
|
|
2
|
-
|
|
3
|
-
import
|
|
4
|
-
|
|
5
|
-
export {
|
|
1
|
+
import * as _classes from './classes.js';
|
|
2
|
+
export { _classes as classes };
|
|
3
|
+
import * as _styles from './styles.js';
|
|
4
|
+
export { _styles as styles };
|
|
5
|
+
export { default as matrix } from './matrix.js';
|
|
6
|
+
export { default as transition } from './transition.js';
|
package/utils/index.d.ts
CHANGED
|
@@ -1,35 +1,11 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
import { clamp } from "./math/index.js";
|
|
13
|
-
import { clamp01 } from "./math/index.js";
|
|
14
|
-
import { damp } from "./math/index.js";
|
|
15
|
-
import { inertiaFinalValue } from "./math/index.js";
|
|
16
|
-
import { lerp } from "./math/index.js";
|
|
17
|
-
import { map } from "./math/index.js";
|
|
18
|
-
import { round } from "./math/index.js";
|
|
19
|
-
import { withLeadingCharacters } from "./string/index.js";
|
|
20
|
-
import { withLeadingSlash } from "./string/index.js";
|
|
21
|
-
import { withoutLeadingCharacters } from "./string/index.js";
|
|
22
|
-
import { withoutLeadingCharactersRecursive } from "./string/index.js";
|
|
23
|
-
import { withoutLeadingSlash } from "./string/index.js";
|
|
24
|
-
import { withoutTrailingCharacters } from "./string/index.js";
|
|
25
|
-
import { withoutTrailingCharactersRecursive } from "./string/index.js";
|
|
26
|
-
import { withoutTrailingSlash } from "./string/index.js";
|
|
27
|
-
import { withTrailingCharacters } from "./string/index.js";
|
|
28
|
-
import { withTrailingSlash } from "./string/index.js";
|
|
29
|
-
import debounce from "./debounce.js";
|
|
30
|
-
import focusTrap from "./focusTrap.js";
|
|
31
|
-
import keyCodes from "./keyCodes.js";
|
|
32
|
-
import memoize from "./memoize.js";
|
|
33
|
-
import nextFrame from "./nextFrame.js";
|
|
34
|
-
import throttle from "./throttle.js";
|
|
35
|
-
export { matrix, transition, collidePointRect, collideRectRect, boundingRectToCircle, collideCircleRect, collideCircleCircle, collidePointCircle, objectToURLSearchParams, historyPush, historyReplace, clamp, clamp01, damp, inertiaFinalValue, lerp, map, round, withLeadingCharacters, withLeadingSlash, withoutLeadingCharacters, withoutLeadingCharactersRecursive, withoutLeadingSlash, withoutTrailingCharacters, withoutTrailingCharactersRecursive, withoutTrailingSlash, withTrailingCharacters, withTrailingSlash, debounce, focusTrap, keyCodes, memoize, nextFrame, throttle };
|
|
1
|
+
export { default as debounce } from "./debounce.js";
|
|
2
|
+
export { default as focusTrap } from "./focusTrap.js";
|
|
3
|
+
export { default as keyCodes } from "./keyCodes.js";
|
|
4
|
+
export { default as memoize } from "./memoize.js";
|
|
5
|
+
export { default as nextFrame } from "./nextFrame.js";
|
|
6
|
+
export { default as throttle } from "./throttle.js";
|
|
7
|
+
export * from "./collide/index.js";
|
|
8
|
+
export * from "./math/index.js";
|
|
9
|
+
export * from "./string/index.js";
|
|
10
|
+
export { matrix, transition } from "./css/index.js";
|
|
11
|
+
export { objectToURLSearchParams, push as historyPush, replace as historyReplace } from "./history.js";
|
package/utils/index.js
CHANGED
|
@@ -1,17 +1,11 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
export { matrix, transition };
|
|
13
|
-
export { collidePointRect, collideRectRect, boundingRectToCircle, collideCircleRect, collideCircleCircle, collidePointCircle };
|
|
14
|
-
export { objectToURLSearchParams, historyPush, historyReplace };
|
|
15
|
-
export { clamp, clamp01, damp, inertiaFinalValue, lerp, map, round };
|
|
16
|
-
export { withLeadingCharacters, withLeadingSlash, withoutLeadingCharacters, withoutLeadingCharactersRecursive, withoutLeadingSlash, withoutTrailingCharacters, withoutTrailingCharactersRecursive, withoutTrailingSlash, withTrailingCharacters, withTrailingSlash };
|
|
17
|
-
export { debounce, focusTrap, keyCodes, memoize, nextFrame, throttle };
|
|
1
|
+
export { default as debounce } from './debounce.js';
|
|
2
|
+
export { default as focusTrap } from './focusTrap.js';
|
|
3
|
+
export { default as keyCodes } from './keyCodes.js';
|
|
4
|
+
export { default as memoize } from './memoize.js';
|
|
5
|
+
export { default as nextFrame } from './nextFrame.js';
|
|
6
|
+
export { default as throttle } from './throttle.js';
|
|
7
|
+
export { matrix, transition } from './css/index.js';
|
|
8
|
+
export { objectToURLSearchParams, push as historyPush, replace as historyReplace } from './history.js';
|
|
9
|
+
export * from './collide/index.js';
|
|
10
|
+
export * from './math/index.js';
|
|
11
|
+
export * from './string/index.js';
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @typedef {(progress: number) => number} EasingFunction
|
|
3
|
+
*/
|
|
4
|
+
/**
|
|
5
|
+
* Create an out easing function.
|
|
6
|
+
*
|
|
7
|
+
* @param {EasingFunction} easeIn The ease in function.
|
|
8
|
+
* @returns {EasingFunction} The out function.
|
|
9
|
+
*/
|
|
10
|
+
export function createEaseOut(easeIn: EasingFunction): EasingFunction;
|
|
11
|
+
/**
|
|
12
|
+
* Create an in-out easing function.
|
|
13
|
+
*
|
|
14
|
+
* @param {EasingFunction} easeIn The ease in function.
|
|
15
|
+
* @return {EasingFunction} The in-out function.
|
|
16
|
+
*/
|
|
17
|
+
export function createEaseInOut(easeIn: EasingFunction): EasingFunction;
|
|
18
|
+
/**
|
|
19
|
+
* @type {EasingFunction}
|
|
20
|
+
*/
|
|
21
|
+
export function easeInQuad(progress: number): number;
|
|
22
|
+
/**
|
|
23
|
+
* Ease in cubic.
|
|
24
|
+
*
|
|
25
|
+
* @param {number} progress Progress value betwen 0 and 1.
|
|
26
|
+
* @return {number} Eased value between 0 and 1.
|
|
27
|
+
*/
|
|
28
|
+
export function easeInCubic(progress: number): number;
|
|
29
|
+
/**
|
|
30
|
+
* Ease in quart.
|
|
31
|
+
*
|
|
32
|
+
* @param {number} progress Progress value betwen 0 and 1.
|
|
33
|
+
* @return {number} Eased value between 0 and 1.
|
|
34
|
+
*/
|
|
35
|
+
export function easeInQuart(progress: number): number;
|
|
36
|
+
/**
|
|
37
|
+
* Ease in quint.
|
|
38
|
+
*
|
|
39
|
+
* @param {number} progress Progress value betwen 0 and 1.
|
|
40
|
+
* @return {number} Eased value between 0 and 1.
|
|
41
|
+
*/
|
|
42
|
+
export function easeInQuint(progress: number): number;
|
|
43
|
+
/**
|
|
44
|
+
* Ease in sine.
|
|
45
|
+
*
|
|
46
|
+
* @param {number} progress Progress value betwen 0 and 1.
|
|
47
|
+
* @return {number} Eased value between 0 and 1.
|
|
48
|
+
*/
|
|
49
|
+
export function easeInSine(progress: number): number;
|
|
50
|
+
/**
|
|
51
|
+
* Ease in circ.
|
|
52
|
+
*
|
|
53
|
+
* @param {number} progress Progress value betwen 0 and 1.
|
|
54
|
+
* @return {number} Eased value between 0 and 1.
|
|
55
|
+
*/
|
|
56
|
+
export function easeInCirc(progress: number): number;
|
|
57
|
+
/**
|
|
58
|
+
* Ease in exponential.
|
|
59
|
+
*
|
|
60
|
+
* @param {number} progress Progress value betwen 0 and 1.
|
|
61
|
+
* @return {number} Eased value between 0 and 1.
|
|
62
|
+
*/
|
|
63
|
+
export function easeInExpo(progress: number): number;
|
|
64
|
+
export function easeOutQuad(progress: number): number;
|
|
65
|
+
export function easeInOutQuad(progress: number): number;
|
|
66
|
+
export function easeOutCubic(progress: number): number;
|
|
67
|
+
export function easeInOutCubic(progress: number): number;
|
|
68
|
+
export function easeOutQuart(progress: number): number;
|
|
69
|
+
export function easeInOutQuart(progress: number): number;
|
|
70
|
+
export function easeOutQuint(progress: number): number;
|
|
71
|
+
export function easeInOutQuint(progress: number): number;
|
|
72
|
+
export function easeOutSine(progress: number): number;
|
|
73
|
+
export function easeInOutSine(progress: number): number;
|
|
74
|
+
export function easeOutCirc(progress: number): number;
|
|
75
|
+
export function easeInOutCirc(progress: number): number;
|
|
76
|
+
export function easeOutExpo(progress: number): number;
|
|
77
|
+
export function easeInOutExpo(progress: number): number;
|
|
78
|
+
export type EasingFunction = (progress: number) => number;
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
export function createEaseOut(easeIn) {
|
|
2
|
+
return progress => 1 - easeIn(1 - progress);
|
|
3
|
+
}
|
|
4
|
+
export function createEaseInOut(easeIn) {
|
|
5
|
+
return progress => progress === 0 ? 0 : progress === 1 ? 1 : progress < 0.5 ? easeIn(progress * 2) / 2 : 1 - easeIn((1 - progress) * 2) / 2;
|
|
6
|
+
}
|
|
7
|
+
export function easeInQuad(progress) {
|
|
8
|
+
return progress ** 2;
|
|
9
|
+
}
|
|
10
|
+
export var easeOutQuad = createEaseOut(easeInQuad);
|
|
11
|
+
export var easeInOutQuad = createEaseInOut(easeInQuad);
|
|
12
|
+
export function easeInCubic(progress) {
|
|
13
|
+
return progress ** 3;
|
|
14
|
+
}
|
|
15
|
+
export var easeOutCubic = createEaseOut(easeInCubic);
|
|
16
|
+
export var easeInOutCubic = createEaseInOut(easeInCubic);
|
|
17
|
+
export function easeInQuart(progress) {
|
|
18
|
+
return progress ** 4;
|
|
19
|
+
}
|
|
20
|
+
export var easeOutQuart = createEaseOut(easeInQuart);
|
|
21
|
+
export var easeInOutQuart = createEaseInOut(easeInQuart);
|
|
22
|
+
export function easeInQuint(progress) {
|
|
23
|
+
return progress ** 5;
|
|
24
|
+
}
|
|
25
|
+
export var easeOutQuint = createEaseOut(easeInQuint);
|
|
26
|
+
export var easeInOutQuint = createEaseInOut(easeInQuint);
|
|
27
|
+
export function easeInSine(progress) {
|
|
28
|
+
return progress === 1 ? 1 : -Math.cos(progress * Math.PI / 2) + 1;
|
|
29
|
+
}
|
|
30
|
+
export var easeOutSine = createEaseOut(easeInSine);
|
|
31
|
+
export var easeInOutSine = createEaseInOut(easeInSine);
|
|
32
|
+
export function easeInCirc(progress) {
|
|
33
|
+
return -(Math.sqrt(1 - progress * progress) - 1);
|
|
34
|
+
}
|
|
35
|
+
export var easeOutCirc = createEaseOut(easeInCirc);
|
|
36
|
+
export var easeInOutCirc = createEaseInOut(easeInCirc);
|
|
37
|
+
export function easeInExpo(progress) {
|
|
38
|
+
return 2 ** (10 * (progress - 1));
|
|
39
|
+
}
|
|
40
|
+
export var easeOutExpo = createEaseOut(easeInExpo);
|
|
41
|
+
export var easeInOutExpo = createEaseInOut(easeInExpo);
|
package/utils/math/index.d.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
export
|
|
1
|
+
export { default as clamp } from "./clamp.js";
|
|
2
|
+
export { default as clamp01 } from "./clamp01.js";
|
|
3
|
+
export { default as damp } from "./damp.js";
|
|
4
|
+
export { default as inertiaFinalValue } from "./inertiaFinalValue.js";
|
|
5
|
+
export { default as lerp } from "./lerp.js";
|
|
6
|
+
export { default as map } from "./map.js";
|
|
7
|
+
export { default as round } from "./round.js";
|
|
8
|
+
export * from "./ease.js";
|
package/utils/math/index.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
export
|
|
1
|
+
export { default as clamp } from './clamp.js';
|
|
2
|
+
export { default as clamp01 } from './clamp01.js';
|
|
3
|
+
export { default as damp } from './damp.js';
|
|
4
|
+
export { default as inertiaFinalValue } from './inertiaFinalValue.js';
|
|
5
|
+
export { default as lerp } from './lerp.js';
|
|
6
|
+
export { default as map } from './map.js';
|
|
7
|
+
export { default as round } from './round.js';
|
|
8
|
+
export * from './ease.js';
|
package/utils/object/index.d.ts
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
export { autoBind, getAllProperties, isObject };
|
|
1
|
+
export { default as autoBind } from "./autoBind.js";
|
|
2
|
+
export { default as getAllProperties } from "./getAllProperties.js";
|
|
3
|
+
export { default as isObject } from "./isObject.js";
|
package/utils/object/index.js
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
export { autoBind, getAllProperties, isObject };
|
|
1
|
+
export { default as autoBind } from './autoBind.js';
|
|
2
|
+
export { default as getAllProperties } from './getAllProperties.js';
|
|
3
|
+
export { default as isObject } from './isObject.js';
|
package/utils/string/index.d.ts
CHANGED
|
@@ -1,11 +1,10 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
export { withLeadingCharacters, withLeadingSlash, withoutLeadingCharacters, withoutLeadingCharactersRecursive, withoutLeadingSlash, withoutTrailingCharacters, withoutTrailingCharactersRecursive, withoutTrailingSlash, withTrailingCharacters, withTrailingSlash };
|
|
1
|
+
export { default as withLeadingCharacters } from "./withLeadingCharacters.js";
|
|
2
|
+
export { default as withLeadingSlash } from "./withLeadingSlash.js";
|
|
3
|
+
export { default as withoutLeadingCharacters } from "./withoutLeadingCharacters.js";
|
|
4
|
+
export { default as withoutLeadingCharactersRecursive } from "./withoutLeadingCharactersRecursive.js";
|
|
5
|
+
export { default as withoutLeadingSlash } from "./withoutLeadingSlash.js";
|
|
6
|
+
export { default as withoutTrailingCharacters } from "./withoutTrailingCharacters.js";
|
|
7
|
+
export { default as withoutTrailingCharactersRecursive } from "./withoutTrailingCharactersRecursive.js";
|
|
8
|
+
export { default as withoutTrailingSlash } from "./withoutTrailingSlash.js";
|
|
9
|
+
export { default as withTrailingCharacters } from "./withTrailingCharacters.js";
|
|
10
|
+
export { default as withTrailingSlash } from "./withTrailingSlash.js";
|
package/utils/string/index.js
CHANGED
|
@@ -1,11 +1,10 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
export { withLeadingCharacters, withLeadingSlash, withoutLeadingCharacters, withoutLeadingCharactersRecursive, withoutLeadingSlash, withoutTrailingCharacters, withoutTrailingCharactersRecursive, withoutTrailingSlash, withTrailingCharacters, withTrailingSlash };
|
|
1
|
+
export { default as withLeadingCharacters } from './withLeadingCharacters.js';
|
|
2
|
+
export { default as withLeadingSlash } from './withLeadingSlash.js';
|
|
3
|
+
export { default as withoutLeadingCharacters } from './withoutLeadingCharacters.js';
|
|
4
|
+
export { default as withoutLeadingCharactersRecursive } from './withoutLeadingCharactersRecursive.js';
|
|
5
|
+
export { default as withoutLeadingSlash } from './withoutLeadingSlash.js';
|
|
6
|
+
export { default as withoutTrailingCharacters } from './withoutTrailingCharacters.js';
|
|
7
|
+
export { default as withoutTrailingCharactersRecursive } from './withoutTrailingCharactersRecursive.js';
|
|
8
|
+
export { default as withoutTrailingSlash } from './withoutTrailingSlash.js';
|
|
9
|
+
export { default as withTrailingCharacters } from './withTrailingCharacters.js';
|
|
10
|
+
export { default as withTrailingSlash } from './withTrailingSlash.js';
|