@interactjs/core
Advanced tools
Comparing version 1.10.25 to 1.10.26
@@ -1,13 +0,14 @@ | ||
"use strict"; | ||
/** | ||
* interact.js 1.10.26 | ||
* | ||
* Copyright (c) 2012-present Taye Adeyemi <dev@taye.me> | ||
* Released under the MIT License. | ||
* https://raw.github.com/taye/interact.js/main/LICENSE | ||
*/ | ||
Object.defineProperty(exports, "__esModule", { | ||
value: true | ||
}); | ||
exports.BaseEvent = void 0; | ||
class BaseEvent { | ||
/** @internal */ | ||
immediatePropagationStopped = false; | ||
propagationStopped = false; | ||
constructor(interaction) { | ||
/** @internal */ | ||
this.immediatePropagationStopped = false; | ||
this.propagationStopped = false; | ||
this._interaction = interaction; | ||
@@ -34,3 +35,3 @@ } | ||
// construction | ||
exports.BaseEvent = BaseEvent; | ||
// getters and setters defined here to support typescript 3.6 and below which | ||
@@ -44,2 +45,3 @@ // don't support getter and setters in .d.ts files | ||
}); | ||
//# sourceMappingURL=BaseEvent.js.map | ||
export { BaseEvent }; | ||
//# sourceMappingURL=BaseEvent.js.map |
@@ -1,2 +0,4 @@ | ||
Object.defineProperty(exports,"__esModule",{value:!0}),exports.BaseEvent=void 0;class t{immediatePropagationStopped=!1;propagationStopped=!1;constructor(t){this._interaction=t}preventDefault(){}stopPropagation(){this.propagationStopped=!0}stopImmediatePropagation(){this.immediatePropagationStopped=this.propagationStopped=!0}}exports.BaseEvent=t,Object.defineProperty(t.prototype,"interaction",{get(){return this._interaction._proxy},set(){}}); | ||
//# sourceMappingURL=BaseEvent.prod.js.map | ||
/* interact.js 1.10.26 | https://raw.github.com/taye/interact.js/main/LICENSE */ | ||
class BaseEvent{constructor(t){this.immediatePropagationStopped=!1,this.propagationStopped=!1,this._interaction=t}preventDefault(){}stopPropagation(){this.propagationStopped=!0}stopImmediatePropagation(){this.immediatePropagationStopped=this.propagationStopped=!0}}Object.defineProperty(BaseEvent.prototype,"interaction",{get(){return this._interaction._proxy},set(){}});export{BaseEvent}; | ||
//# sourceMappingURL=BaseEvent.prod.js.map |
@@ -1,13 +0,12 @@ | ||
"use strict"; | ||
/** | ||
* interact.js 1.10.26 | ||
* | ||
* Copyright (c) 2012-present Taye Adeyemi <dev@taye.me> | ||
* Released under the MIT License. | ||
* https://raw.github.com/taye/interact.js/main/LICENSE | ||
*/ | ||
Object.defineProperty(exports, "__esModule", { | ||
value: true | ||
}); | ||
exports.Eventable = void 0; | ||
var arr = _interopRequireWildcard(require("../utils/arr.js")); | ||
var _extend = _interopRequireDefault(require("../utils/extend.js")); | ||
var _normalizeListeners = _interopRequireDefault(require("../utils/normalizeListeners.js")); | ||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } | ||
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); } | ||
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && Object.prototype.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; } | ||
import * as arr from "../utils/arr.js"; | ||
import extend from "../utils/extend.js"; | ||
import normalize from "../utils/normalizeListeners.js"; | ||
function fireUntilImmediateStopped(event, listeners) { | ||
@@ -22,9 +21,9 @@ for (const listener of listeners) { | ||
class Eventable { | ||
options; | ||
types = {}; | ||
propagationStopped = false; | ||
immediatePropagationStopped = false; | ||
global; | ||
constructor(options) { | ||
this.options = (0, _extend.default)({}, options || {}); | ||
this.options = void 0; | ||
this.types = {}; | ||
this.propagationStopped = false; | ||
this.immediatePropagationStopped = false; | ||
this.global = void 0; | ||
this.options = extend({}, options || {}); | ||
} | ||
@@ -47,3 +46,3 @@ fire(event) { | ||
on(type, listener) { | ||
const listeners = (0, _normalizeListeners.default)(type, listener); | ||
const listeners = normalize(type, listener); | ||
for (type in listeners) { | ||
@@ -54,3 +53,3 @@ this.types[type] = arr.merge(this.types[type] || [], listeners[type]); | ||
off(type, listener) { | ||
const listeners = (0, _normalizeListeners.default)(type, listener); | ||
const listeners = normalize(type, listener); | ||
for (type in listeners) { | ||
@@ -73,3 +72,3 @@ const eventList = this.types[type]; | ||
} | ||
exports.Eventable = Eventable; | ||
//# sourceMappingURL=Eventable.js.map | ||
export { Eventable }; | ||
//# sourceMappingURL=Eventable.js.map |
@@ -1,2 +0,4 @@ | ||
Object.defineProperty(exports,"__esModule",{value:!0}),exports.Eventable=void 0;var e=((e,t)=>{if(e&&e.__esModule)return e;if(null===e||"object"!=typeof e&&"function"!=typeof e)return{default:e};var r=n(t);if(r&&r.has(e))return r.get(e);var o={__proto__:null},i=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var p in e)if("default"!==p&&Object.prototype.hasOwnProperty.call(e,p)){var s=i?Object.getOwnPropertyDescriptor(e,p):null;s&&(s.get||s.set)?Object.defineProperty(o,p,s):o[p]=e[p]}return o.default=e,r&&r.set(e,o),o})(require("../utils/arr.prod.js")),t=o(require("../utils/extend.prod.js")),r=o(require("../utils/normalizeListeners.prod.js"));function o(e){return e&&e.__esModule?e:{default:e}}function n(e){if("function"!=typeof WeakMap)return null;var t=new WeakMap,r=new WeakMap;return(n=e=>e?r:t)(e)}function i(e,t){for(const r of t){if(e.immediatePropagationStopped)break;r(e)}}exports.Eventable=class{options;types={};propagationStopped=!1;immediatePropagationStopped=!1;global;constructor(e){this.options=(0,t.default)({},e||{})}fire(e){let t;const r=this.global;(t=this.types[e.type])&&i(e,t),!e.propagationStopped&&r&&(t=r[e.type])&&i(e,t)}on(t,o){const n=(0,r.default)(t,o);for(t in n)this.types[t]=e.merge(this.types[t]||[],n[t])}off(e,t){const o=(0,r.default)(e,t);for(e in o){const t=this.types[e];if(t&&t.length)for(const r of o[e]){const e=t.indexOf(r);-1!==e&&t.splice(e,1)}}}getRect(e){return null}}; | ||
//# sourceMappingURL=Eventable.prod.js.map | ||
/* interact.js 1.10.26 | https://raw.github.com/taye/interact.js/main/LICENSE */ | ||
import*as arr from"../utils/arr.prod.js";import extend from"../utils/extend.prod.js";import normalize from"../utils/normalizeListeners.prod.js";function fireUntilImmediateStopped(t,e){for(const o of e){if(t.immediatePropagationStopped)break;o(t)}}class Eventable{constructor(t){this.options=void 0,this.types={},this.propagationStopped=!1,this.immediatePropagationStopped=!1,this.global=void 0,this.options=extend({},t||{})}fire(t){let e;const o=this.global;(e=this.types[t.type])&&fireUntilImmediateStopped(t,e),!t.propagationStopped&&o&&(e=o[t.type])&&fireUntilImmediateStopped(t,e)}on(t,e){const o=normalize(t,e);for(t in o)this.types[t]=arr.merge(this.types[t]||[],o[t])}off(t,e){const o=normalize(t,e);for(t in o){const e=this.types[t];if(e&&e.length)for(const i of o[t]){const t=e.indexOf(i);-1!==t&&e.splice(t,1)}}}getRect(t){return null}}export{Eventable}; | ||
//# sourceMappingURL=Eventable.prod.js.map |
@@ -1,15 +0,14 @@ | ||
"use strict"; | ||
/** | ||
* interact.js 1.10.26 | ||
* | ||
* Copyright (c) 2012-present Taye Adeyemi <dev@taye.me> | ||
* Released under the MIT License. | ||
* https://raw.github.com/taye/interact.js/main/LICENSE | ||
*/ | ||
Object.defineProperty(exports, "__esModule", { | ||
value: true | ||
}); | ||
exports.default = void 0; | ||
var arr = _interopRequireWildcard(require("../utils/arr.js")); | ||
var domUtils = _interopRequireWildcard(require("../utils/domUtils.js")); | ||
var _is = _interopRequireDefault(require("../utils/is.js")); | ||
var _pointerExtend = _interopRequireDefault(require("../utils/pointerExtend.js")); | ||
var pointerUtils = _interopRequireWildcard(require("../utils/pointerUtils.js")); | ||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } | ||
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); } | ||
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && Object.prototype.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; } | ||
import * as arr from "../utils/arr.js"; | ||
import * as domUtils from "../utils/domUtils.js"; | ||
import is from "../utils/is.js"; | ||
import pExtend from "../utils/pointerExtend.js"; | ||
import * as pointerUtils from "../utils/pointerUtils.js"; | ||
function install(scope) { | ||
@@ -193,3 +192,3 @@ var _scope$document; | ||
// climb up document tree looking for selector matches | ||
while (_is.default.element(element)) { | ||
while (is.element(element)) { | ||
for (let i = 0; i < delegates.length; i++) { | ||
@@ -224,9 +223,9 @@ const cur = delegates[i]; | ||
class FakeEvent { | ||
currentTarget; | ||
originalEvent; | ||
type; | ||
constructor(originalEvent) { | ||
this.currentTarget = void 0; | ||
this.originalEvent = void 0; | ||
this.type = void 0; | ||
this.originalEvent = originalEvent; | ||
// duplicate the event so that currentTarget can be changed | ||
(0, _pointerExtend.default)(this, originalEvent); | ||
pExtend(this, originalEvent); | ||
} | ||
@@ -244,3 +243,3 @@ preventOriginalDefault() { | ||
function getOptions(param) { | ||
if (!_is.default.object(param)) { | ||
if (!is.object(param)) { | ||
return { | ||
@@ -261,6 +260,7 @@ capture: !!param, | ||
} | ||
var _default = exports.default = { | ||
var events = { | ||
id: 'events', | ||
install | ||
}; | ||
//# sourceMappingURL=events.js.map | ||
export { events as default }; | ||
//# sourceMappingURL=events.js.map |
@@ -1,2 +0,4 @@ | ||
Object.defineProperty(exports,"__esModule",{value:!0}),exports.default=void 0;var e=a(require("../utils/arr.prod.js")),t=a(require("../utils/domUtils.prod.js")),n=o(require("../utils/is.prod.js")),r=o(require("../utils/pointerExtend.prod.js")),s=a(require("../utils/pointerUtils.prod.js"));function o(e){return e&&e.__esModule?e:{default:e}}function i(e){if("function"!=typeof WeakMap)return null;var t=new WeakMap,n=new WeakMap;return(i=e=>e?n:t)(e)}function a(e,t){if(!t&&e&&e.__esModule)return e;if(null===e||"object"!=typeof e&&"function"!=typeof e)return{default:e};var n=i(t);if(n&&n.has(e))return n.get(e);var r={__proto__:null},s=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var o in e)if("default"!==o&&Object.prototype.hasOwnProperty.call(e,o)){var a=s?Object.getOwnPropertyDescriptor(e,o):null;a&&(a.get||a.set)?Object.defineProperty(r,o,a):r[o]=e[o]}return r.default=e,n&&n.set(e,r),r}class u{currentTarget;originalEvent;type;constructor(e){this.originalEvent=e,(0,r.default)(this,e)}preventOriginalDefault(){this.originalEvent.preventDefault()}stopPropagation(){this.originalEvent.stopPropagation()}stopImmediatePropagation(){this.originalEvent.stopImmediatePropagation()}}function l(e){return n.default.object(e)?{capture:!!e.capture,passive:!!e.passive}:{capture:!!e,passive:!1}}function p(e,t){return e===t||("boolean"==typeof e?!!t.capture===e&&0==!!t.passive:!!e.capture==!!t.capture&&!!e.passive==!!t.passive)}exports.default={id:"events",install(r){var o;const i=[],a={},c=[],f={add:d,remove:v,addDelegate(t,n,r,s,o){const i=l(o);if(!a[r]){a[r]=[];for(const e of c)d(e,r,g),d(e,r,h,!0)}const u=a[r];let p=e.find(u,(e=>e.selector===t&&e.context===n));p||(p={selector:t,context:n,listeners:[]},u.push(p)),p.listeners.push({func:s,options:i})},removeDelegate(e,t,n,r,s){const o=l(s),i=a[n];let u,c=!1;if(i)for(u=i.length-1;u>=0;u--){const s=i[u];if(s.selector===e&&s.context===t){const{listeners:e}=s;for(let s=e.length-1;s>=0;s--){const a=e[s];if(a.func===r&&p(a.options,o)){e.splice(s,1),e.length||(i.splice(u,1),v(t,n,g),v(t,n,h,!0)),c=!0;break}}if(c)break}}},delegateListener:g,delegateUseCapture:h,delegatedEvents:a,documents:c,targets:i,supportsOptions:!1,supportsPassive:!1};function d(t,n,r,s){if(!t.addEventListener)return;const o=l(s);let a=e.find(i,(e=>e.eventTarget===t));a||(a={eventTarget:t,events:{}},i.push(a)),a.events[n]||(a.events[n]=[]),e.find(a.events[n],(e=>e.func===r&&p(e.options,o)))||(t.addEventListener(n,r,f.supportsOptions?o:o.capture),a.events[n].push({func:r,options:o}))}function v(t,n,r,s){if(!t.addEventListener||!t.removeEventListener)return;const o=e.findIndex(i,(e=>e.eventTarget===t)),a=i[o];if(!a||!a.events)return;if("all"===n){for(n in a.events)a.events.hasOwnProperty(n)&&v(t,n,"all");return}let u=!1;const c=a.events[n];if(c){if("all"===r){for(let e=c.length-1;e>=0;e--){const r=c[e];v(t,n,r.func,r.options)}return}{const e=l(s);for(let s=0;s<c.length;s++){const o=c[s];if(o.func===r&&p(o.options,e)){t.removeEventListener(n,r,f.supportsOptions?e:e.capture),c.splice(s,1),0===c.length&&(delete a.events[n],u=!0);break}}}}u&&!Object.keys(a.events).length&&i.splice(o,1)}function g(e,r){const o=l(r),i=new u(e),c=a[e.type],[f]=s.getEventTargets(e);let d=f;for(;n.default.element(d);){for(let e=0;e<c.length;e++){const n=c[e],{selector:r,context:s}=n;if(t.matchesSelector(d,r)&&t.nodeContains(s,f)&&t.nodeContains(s,d)){const{listeners:e}=n;i.currentTarget=d;for(const t of e)p(t.options,o)&&t.func(i)}}d=t.parentNode(d)}}function h(e){return g(e,!0)}return null==(o=r.document)||o.createElement("div").addEventListener("test",null,{get capture(){return f.supportsOptions=!0},get passive(){return f.supportsPassive=!0}}),r.events=f,f}}; | ||
//# sourceMappingURL=events.prod.js.map | ||
/* interact.js 1.10.26 | https://raw.github.com/taye/interact.js/main/LICENSE */ | ||
import*as arr from"../utils/arr.prod.js";import*as domUtils from"../utils/domUtils.prod.js";import is from"../utils/is.prod.js";import pExtend from"../utils/pointerExtend.prod.js";import*as pointerUtils from"../utils/pointerUtils.prod.js";function install(t){var e;const n=[],s={},o=[],i={add:r,remove:a,addDelegate(t,e,n,i,a){const c=getOptions(a);if(!s[n]){s[n]=[];for(const t of o)r(t,n,p),r(t,n,l,!0)}const u=s[n];let v=arr.find(u,(n=>n.selector===t&&n.context===e));v||(v={selector:t,context:e,listeners:[]},u.push(v)),v.listeners.push({func:i,options:c})},removeDelegate(t,e,n,o,i){const r=getOptions(i),c=s[n];let u,v=!1;if(c)for(u=c.length-1;u>=0;u--){const s=c[u];if(s.selector===t&&s.context===e){const{listeners:t}=s;for(let s=t.length-1;s>=0;s--){const i=t[s];if(i.func===o&&optionsMatch(i.options,r)){t.splice(s,1),t.length||(c.splice(u,1),a(e,n,p),a(e,n,l,!0)),v=!0;break}}if(v)break}}},delegateListener:p,delegateUseCapture:l,delegatedEvents:s,documents:o,targets:n,supportsOptions:!1,supportsPassive:!1};function r(t,e,s,o){if(!t.addEventListener)return;const r=getOptions(o);let a=arr.find(n,(e=>e.eventTarget===t));a||(a={eventTarget:t,events:{}},n.push(a)),a.events[e]||(a.events[e]=[]),arr.find(a.events[e],(t=>t.func===s&&optionsMatch(t.options,r)))||(t.addEventListener(e,s,i.supportsOptions?r:r.capture),a.events[e].push({func:s,options:r}))}function a(t,e,s,o){if(!t.addEventListener||!t.removeEventListener)return;const r=arr.findIndex(n,(e=>e.eventTarget===t)),p=n[r];if(!p||!p.events)return;if("all"===e){for(e in p.events)p.events.hasOwnProperty(e)&&a(t,e,"all");return}let l=!1;const c=p.events[e];if(c){if("all"===s){for(let n=c.length-1;n>=0;n--){const s=c[n];a(t,e,s.func,s.options)}return}{const n=getOptions(o);for(let o=0;o<c.length;o++){const r=c[o];if(r.func===s&&optionsMatch(r.options,n)){t.removeEventListener(e,s,i.supportsOptions?n:n.capture),c.splice(o,1),0===c.length&&(delete p.events[e],l=!0);break}}}}l&&!Object.keys(p.events).length&&n.splice(r,1)}function p(t,e){const n=getOptions(e),o=new FakeEvent(t),i=s[t.type],[r]=pointerUtils.getEventTargets(t);let a=r;for(;is.element(a);){for(let t=0;t<i.length;t++){const e=i[t],{selector:s,context:p}=e;if(domUtils.matchesSelector(a,s)&&domUtils.nodeContains(p,r)&&domUtils.nodeContains(p,a)){const{listeners:t}=e;o.currentTarget=a;for(const e of t)optionsMatch(e.options,n)&&e.func(o)}}a=domUtils.parentNode(a)}}function l(t){return p(t,!0)}return null==(e=t.document)||e.createElement("div").addEventListener("test",null,{get capture(){return i.supportsOptions=!0},get passive(){return i.supportsPassive=!0}}),t.events=i,i}class FakeEvent{constructor(t){this.currentTarget=void 0,this.originalEvent=void 0,this.type=void 0,this.originalEvent=t,pExtend(this,t)}preventOriginalDefault(){this.originalEvent.preventDefault()}stopPropagation(){this.originalEvent.stopPropagation()}stopImmediatePropagation(){this.originalEvent.stopImmediatePropagation()}}function getOptions(t){return is.object(t)?{capture:!!t.capture,passive:!!t.passive}:{capture:!!t,passive:!1}}function optionsMatch(t,e){return t===e||("boolean"==typeof t?!!e.capture===t&&!1==!!e.passive:!!t.capture==!!e.capture&&!!t.passive==!!e.passive)}var events={id:"events",install:install};export{events as default}; | ||
//# sourceMappingURL=events.prod.js.map |
@@ -1,20 +0,20 @@ | ||
"use strict"; | ||
/** | ||
* interact.js 1.10.26 | ||
* | ||
* Copyright (c) 2012-present Taye Adeyemi <dev@taye.me> | ||
* Released under the MIT License. | ||
* https://raw.github.com/taye/interact.js/main/LICENSE | ||
*/ | ||
Object.defineProperty(exports, "__esModule", { | ||
value: true | ||
}); | ||
exports.Interactable = void 0; | ||
var arr = _interopRequireWildcard(require("../utils/arr.js")); | ||
var _browser = _interopRequireDefault(require("../utils/browser.js")); | ||
var _clone = _interopRequireDefault(require("../utils/clone.js")); | ||
var _domUtils = require("../utils/domUtils.js"); | ||
var _extend = _interopRequireDefault(require("../utils/extend.js")); | ||
var _is = _interopRequireDefault(require("../utils/is.js")); | ||
var _isNonNativeEvent = _interopRequireDefault(require("../utils/isNonNativeEvent.js")); | ||
var _normalizeListeners = _interopRequireDefault(require("../utils/normalizeListeners.js")); | ||
var _window = require("../utils/window.js"); | ||
var _Eventable = require("./Eventable"); | ||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } | ||
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); } | ||
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && Object.prototype.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; } | ||
import * as arr from "../utils/arr.js"; | ||
import browser from "../utils/browser.js"; | ||
import clone from "../utils/clone.js"; | ||
import { trySelector, getElementRect, nodeContains, matchesUpTo } from "../utils/domUtils.js"; | ||
import extend from "../utils/extend.js"; | ||
import is from "../utils/is.js"; | ||
import isNonNativeEvent from "../utils/isNonNativeEvent.js"; | ||
import normalize from "../utils/normalizeListeners.js"; | ||
import { getWindow } from "../utils/window.js"; | ||
import { Eventable } from './Eventable.js'; | ||
/* eslint-disable no-dupe-class-members */ | ||
@@ -46,22 +46,22 @@ var OnOffMethod = /*#__PURE__*/function (OnOffMethod) { | ||
} | ||
target; | ||
/** @internal */ | ||
options; | ||
/** @internal */ | ||
_actions; | ||
/** @internal */ | ||
events = new _Eventable.Eventable(); | ||
/** @internal */ | ||
_context; | ||
/** @internal */ | ||
_win; | ||
/** @internal */ | ||
_doc; | ||
/** @internal */ | ||
_scopeEvents; | ||
constructor(target, options, defaultContext, scopeEvents) { | ||
this.target = void 0; | ||
/** @internal */ | ||
this.options = void 0; | ||
/** @internal */ | ||
this._actions = void 0; | ||
/** @internal */ | ||
this.events = new Eventable(); | ||
/** @internal */ | ||
this._context = void 0; | ||
/** @internal */ | ||
this._win = void 0; | ||
/** @internal */ | ||
this._doc = void 0; | ||
/** @internal */ | ||
this._scopeEvents = void 0; | ||
this._actions = options.actions; | ||
this.target = target; | ||
this._context = options.context || defaultContext; | ||
this._win = (0, _window.getWindow)((0, _domUtils.trySelector)(target) ? this._context : target); | ||
this._win = getWindow(trySelector(target) ? this._context : target); | ||
this._doc = this._win.document; | ||
@@ -72,12 +72,12 @@ this._scopeEvents = scopeEvents; | ||
setOnEvents(actionName, phases) { | ||
if (_is.default.func(phases.onstart)) { | ||
if (is.func(phases.onstart)) { | ||
this.on(`${actionName}start`, phases.onstart); | ||
} | ||
if (_is.default.func(phases.onmove)) { | ||
if (is.func(phases.onmove)) { | ||
this.on(`${actionName}move`, phases.onmove); | ||
} | ||
if (_is.default.func(phases.onend)) { | ||
if (is.func(phases.onend)) { | ||
this.on(`${actionName}end`, phases.onend); | ||
} | ||
if (_is.default.func(phases.oninertiastart)) { | ||
if (is.func(phases.oninertiastart)) { | ||
this.on(`${actionName}inertiastart`, phases.oninertiastart); | ||
@@ -90,7 +90,7 @@ } | ||
const actionFilter = (_this$_actions$map$ac = this._actions.map[actionName]) == null ? void 0 : _this$_actions$map$ac.filterEventType; | ||
const filter = type => (actionFilter == null || actionFilter(type)) && (0, _isNonNativeEvent.default)(type, this._actions); | ||
if (_is.default.array(prev) || _is.default.object(prev)) { | ||
const filter = type => (actionFilter == null || actionFilter(type)) && isNonNativeEvent(type, this._actions); | ||
if (is.array(prev) || is.object(prev)) { | ||
this._onOff(OnOffMethod.Off, actionName, prev, undefined, filter); | ||
} | ||
if (_is.default.array(cur) || _is.default.object(cur)) { | ||
if (is.array(cur) || is.object(cur)) { | ||
this._onOff(OnOffMethod.On, actionName, cur, undefined, filter); | ||
@@ -114,15 +114,11 @@ } | ||
// if the option value is an array | ||
if (_is.default.array(optionValue)) { | ||
; | ||
if (is.array(optionValue)) { | ||
actionOptions[optionName] = arr.from(optionValue); | ||
} | ||
// if the option value is an object | ||
else if (_is.default.plainObject(optionValue)) { | ||
// copy the object | ||
; | ||
actionOptions[optionName] = (0, _extend.default)(actionOptions[optionName] || {}, (0, _clone.default)(optionValue)); | ||
else if (is.plainObject(optionValue)) { | ||
actionOptions[optionName] = extend(actionOptions[optionName] || {}, clone(optionValue)); | ||
// set anabled field to true if it exists in the defaults | ||
if (_is.default.object(defaults.perAction[optionName]) && 'enabled' in defaults.perAction[optionName]) { | ||
; | ||
if (is.object(defaults.perAction[optionName]) && 'enabled' in defaults.perAction[optionName]) { | ||
actionOptions[optionName].enabled = optionValue.enabled !== false; | ||
@@ -132,4 +128,3 @@ } | ||
// if the option value is a boolean and the default is an object | ||
else if (_is.default.bool(optionValue) && _is.default.object(defaults.perAction[optionName])) { | ||
; | ||
else if (is.bool(optionValue) && is.object(defaults.perAction[optionName])) { | ||
actionOptions[optionName].enabled = optionValue; | ||
@@ -139,3 +134,2 @@ } | ||
else { | ||
; | ||
actionOptions[optionName] = optionValue; | ||
@@ -154,7 +148,7 @@ } | ||
getRect(element) { | ||
element = element || (_is.default.element(this.target) ? this.target : null); | ||
if (_is.default.string(this.target)) { | ||
element = element || (is.element(this.target) ? this.target : null); | ||
if (is.string(this.target)) { | ||
element = element || this._context.querySelector(this.target); | ||
} | ||
return (0, _domUtils.getElementRect)(element); | ||
return getElementRect(element); | ||
} | ||
@@ -172,5 +166,5 @@ | ||
rectChecker(checker) { | ||
if (_is.default.func(checker)) { | ||
if (is.func(checker)) { | ||
this.getRect = element => { | ||
const rect = (0, _extend.default)({}, checker.apply(this, element)); | ||
const rect = extend({}, checker.apply(this, element)); | ||
if (!('width' in rect)) { | ||
@@ -193,7 +187,5 @@ rect.width = rect.right - rect.left; | ||
_backCompatOption(optionName, newValue) { | ||
if ((0, _domUtils.trySelector)(newValue) || _is.default.object(newValue)) { | ||
; | ||
if (trySelector(newValue) || is.object(newValue)) { | ||
this.options[optionName] = newValue; | ||
for (const action in this._actions.map) { | ||
; | ||
this.options[action][optionName] = newValue; | ||
@@ -242,9 +234,9 @@ } | ||
} = this; | ||
if (_is.default.string(target)) { | ||
if (is.string(target)) { | ||
return Array.from(this._context.querySelectorAll(target)); | ||
} | ||
if (_is.default.func(target) && target.getAllElements) { | ||
if (is.func(target) && target.getAllElements) { | ||
return target.getAllElements(); | ||
} | ||
return _is.default.element(target) ? [target] : []; | ||
return is.element(target) ? [target] : []; | ||
} | ||
@@ -262,3 +254,3 @@ | ||
inContext(element) { | ||
return this._context === element.ownerDocument || (0, _domUtils.nodeContains)(this._context, element); | ||
return this._context === element.ownerDocument || nodeContains(this._context, element); | ||
} | ||
@@ -276,9 +268,9 @@ | ||
} | ||
if (!_is.default.element(element)) { | ||
if (!is.element(element)) { | ||
return false; | ||
} | ||
if (_is.default.string(allowFrom)) { | ||
return (0, _domUtils.matchesUpTo)(element, allowFrom, targetNode); | ||
} else if (_is.default.element(allowFrom)) { | ||
return (0, _domUtils.nodeContains)(allowFrom, element); | ||
if (is.string(allowFrom)) { | ||
return matchesUpTo(element, allowFrom, targetNode); | ||
} else if (is.element(allowFrom)) { | ||
return nodeContains(allowFrom, element); | ||
} | ||
@@ -290,9 +282,9 @@ return false; | ||
testIgnore(ignoreFrom, targetNode, element) { | ||
if (!ignoreFrom || !_is.default.element(element)) { | ||
if (!ignoreFrom || !is.element(element)) { | ||
return false; | ||
} | ||
if (_is.default.string(ignoreFrom)) { | ||
return (0, _domUtils.matchesUpTo)(element, ignoreFrom, targetNode); | ||
} else if (_is.default.element(ignoreFrom)) { | ||
return (0, _domUtils.nodeContains)(ignoreFrom, element); | ||
if (is.string(ignoreFrom)) { | ||
return matchesUpTo(element, ignoreFrom, targetNode); | ||
} else if (is.element(ignoreFrom)) { | ||
return nodeContains(ignoreFrom, element); | ||
} | ||
@@ -317,18 +309,18 @@ return false; | ||
_onOff(method, typeArg, listenerArg, options, filter) { | ||
if (_is.default.object(typeArg) && !_is.default.array(typeArg)) { | ||
if (is.object(typeArg) && !is.array(typeArg)) { | ||
options = listenerArg; | ||
listenerArg = null; | ||
} | ||
const listeners = (0, _normalizeListeners.default)(typeArg, listenerArg, filter); | ||
const listeners = normalize(typeArg, listenerArg, filter); | ||
for (let type in listeners) { | ||
if (type === 'wheel') { | ||
type = _browser.default.wheelEvent; | ||
type = browser.wheelEvent; | ||
} | ||
for (const listener of listeners[type]) { | ||
// if it is an action event type | ||
if ((0, _isNonNativeEvent.default)(type, this._actions)) { | ||
if (isNonNativeEvent(type, this._actions)) { | ||
this.events[method === OnOffMethod.On ? 'on' : 'off'](type, listener); | ||
} | ||
// delegated event | ||
else if (_is.default.string(this.target)) { | ||
else if (is.string(this.target)) { | ||
this._scopeEvents[method === OnOffMethod.On ? 'addDelegate' : 'removeDelegate'](this.target, this._context, type, listener, options); | ||
@@ -381,7 +373,6 @@ } | ||
const defaults = this._defaults; | ||
if (!_is.default.object(options)) { | ||
if (!is.object(options)) { | ||
options = {}; | ||
} | ||
; | ||
this.options = (0, _clone.default)(defaults.base); | ||
this.options = clone(defaults.base); | ||
for (const actionName_ in this._actions.methodDict) { | ||
@@ -391,3 +382,3 @@ const actionName = actionName_; | ||
this.options[actionName] = {}; | ||
this.setPerAction(actionName, (0, _extend.default)((0, _extend.default)({}, defaults.perAction), defaults.actions[actionName])); | ||
this.setPerAction(actionName, extend(extend({}, defaults.perAction), defaults.actions[actionName])); | ||
this[methodName](options[actionName]); | ||
@@ -400,4 +391,3 @@ } | ||
} | ||
if (_is.default.func(this[setting])) { | ||
; | ||
if (is.func(this[setting])) { | ||
this[setting](options[setting]); | ||
@@ -414,3 +404,3 @@ } | ||
unset() { | ||
if (_is.default.string(this.target)) { | ||
if (is.string(this.target)) { | ||
// remove delegated events | ||
@@ -438,3 +428,3 @@ for (const type in this._scopeEvents.delegatedEvents) { | ||
} | ||
exports.Interactable = Interactable; | ||
//# sourceMappingURL=Interactable.js.map | ||
export { Interactable }; | ||
//# sourceMappingURL=Interactable.js.map |
@@ -1,2 +0,4 @@ | ||
Object.defineProperty(exports,"__esModule",{value:!0}),exports.Interactable=void 0;var t=((t,e)=>{if(t&&t.__esModule)return t;if(null===t||"object"!=typeof t&&"function"!=typeof t)return{default:t};var n=f(e);if(n&&n.has(t))return n.get(t);var s={__proto__:null},r=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var o in t)if("default"!==o&&Object.prototype.hasOwnProperty.call(t,o)){var i=r?Object.getOwnPropertyDescriptor(t,o):null;i&&(i.get||i.set)?Object.defineProperty(s,o,i):s[o]=t[o]}return s.default=t,n&&n.set(t,s),s})(require("../utils/arr.prod.js")),e=c(require("../utils/browser.prod.js")),n=c(require("../utils/clone.prod.js")),s=require("../utils/domUtils.prod.js"),r=c(require("../utils/extend.prod.js")),o=c(require("../utils/is.prod.js")),i=c(require("../utils/isNonNativeEvent.prod.js")),a=c(require("../utils/normalizeListeners.prod.js")),l=require("../utils/window.prod.js"),u=require("./Eventable");function c(t){return t&&t.__esModule?t:{default:t}}function f(t){if("function"!=typeof WeakMap)return null;var e=new WeakMap,n=new WeakMap;return(f=t=>t?n:e)(t)}var d=(t=>(t[t.On=0]="On",t[t.Off=1]="Off",t))(d||{});exports.Interactable=class{get _defaults(){return{base:{},perAction:{},actions:{}}}target;options;_actions;events=new u.Eventable;_context;_win;_doc;_scopeEvents;constructor(t,e,n,r){this._actions=e.actions,this.target=t,this._context=e.context||n,this._win=(0,l.getWindow)((0,s.trySelector)(t)?this._context:t),this._doc=this._win.document,this._scopeEvents=r,this.set(e)}setOnEvents(t,e){return o.default.func(e.onstart)&&this.on(t+"start",e.onstart),o.default.func(e.onmove)&&this.on(t+"move",e.onmove),o.default.func(e.onend)&&this.on(t+"end",e.onend),o.default.func(e.oninertiastart)&&this.on(t+"inertiastart",e.oninertiastart),this}updatePerActionListeners(t,e,n){var s;const r=null==(s=this._actions.map[t])?void 0:s.filterEventType,a=t=>(null==r||r(t))&&(0,i.default)(t,this._actions);(o.default.array(e)||o.default.object(e))&&this._onOff(d.Off,t,e,void 0,a),(o.default.array(n)||o.default.object(n))&&this._onOff(d.On,t,n,void 0,a)}setPerAction(e,s){const i=this._defaults;for(const a in s){const l=a,u=this.options[e],c=s[l];"listeners"===l&&this.updatePerActionListeners(e,u.listeners,c),o.default.array(c)?u[l]=t.from(c):o.default.plainObject(c)?(u[l]=(0,r.default)(u[l]||{},(0,n.default)(c)),o.default.object(i.perAction[l])&&"enabled"in i.perAction[l]&&(u[l].enabled=!1!==c.enabled)):o.default.bool(c)&&o.default.object(i.perAction[l])?u[l].enabled=c:u[l]=c}}getRect(t){return t=t||(o.default.element(this.target)?this.target:null),o.default.string(this.target)&&(t=t||this._context.querySelector(this.target)),(0,s.getElementRect)(t)}rectChecker(t){return o.default.func(t)?(this.getRect=e=>{const n=(0,r.default)({},t.apply(this,e));return"width"in n||(n.width=n.right-n.left,n.height=n.bottom-n.top),n},this):null===t?(delete this.getRect,this):this.getRect}_backCompatOption(t,e){if((0,s.trySelector)(e)||o.default.object(e)){this.options[t]=e;for(const n in this._actions.map)this.options[n][t]=e;return this}return this.options[t]}origin(t){return this._backCompatOption("origin",t)}deltaSource(t){return"page"===t||"client"===t?(this.options.deltaSource=t,this):this.options.deltaSource}getAllElements(){const{target:t}=this;return o.default.string(t)?Array.from(this._context.querySelectorAll(t)):o.default.func(t)&&t.getAllElements?t.getAllElements():o.default.element(t)?[t]:[]}context(){return this._context}inContext(t){return this._context===t.ownerDocument||(0,s.nodeContains)(this._context,t)}testIgnoreAllow(t,e,n){return!this.testIgnore(t.ignoreFrom,e,n)&&this.testAllow(t.allowFrom,e,n)}testAllow(t,e,n){return!t||!!o.default.element(n)&&(o.default.string(t)?(0,s.matchesUpTo)(n,t,e):!!o.default.element(t)&&(0,s.nodeContains)(t,n))}testIgnore(t,e,n){return!(!t||!o.default.element(n))&&(o.default.string(t)?(0,s.matchesUpTo)(n,t,e):!!o.default.element(t)&&(0,s.nodeContains)(t,n))}fire(t){return this.events.fire(t),this}_onOff(t,n,s,r,l){o.default.object(n)&&!o.default.array(n)&&(r=s,s=null);const u=(0,a.default)(n,s,l);for(let n in u){"wheel"===n&&(n=e.default.wheelEvent);for(const e of u[n])(0,i.default)(n,this._actions)?this.events[t===d.On?"on":"off"](n,e):o.default.string(this.target)?this._scopeEvents[t===d.On?"addDelegate":"removeDelegate"](this.target,this._context,n,e,r):this._scopeEvents[t===d.On?"add":"remove"](this.target,n,e,r)}return this}on(t,e,n){return this._onOff(d.On,t,e,n)}off(t,e,n){return this._onOff(d.Off,t,e,n)}set(t){const e=this._defaults;o.default.object(t)||(t={}),this.options=(0,n.default)(e.base);for(const n in this._actions.methodDict){const s=n,o=this._actions.methodDict[s];this.options[s]={},this.setPerAction(s,(0,r.default)((0,r.default)({},e.perAction),e.actions[s])),this[o](t[s])}for(const e in t)"getRect"!==e?o.default.func(this[e])&&this[e](t[e]):this.rectChecker(t.getRect);return this}unset(){if(o.default.string(this.target))for(const t in this._scopeEvents.delegatedEvents){const e=this._scopeEvents.delegatedEvents[t];for(let n=e.length-1;n>=0;n--){const{selector:s,context:r,listeners:o}=e[n];s===this.target&&r===this._context&&e.splice(n,1);for(let e=o.length-1;e>=0;e--)this._scopeEvents.removeDelegate(this.target,this._context,t,o[e][0],o[e][1])}}else this._scopeEvents.remove(this.target,"all")}}; | ||
//# sourceMappingURL=Interactable.prod.js.map | ||
/* interact.js 1.10.26 | https://raw.github.com/taye/interact.js/main/LICENSE */ | ||
import*as arr from"../utils/arr.prod.js";import browser from"../utils/browser.prod.js";import clone from"../utils/clone.prod.js";import{trySelector,getElementRect,nodeContains,matchesUpTo}from"../utils/domUtils.prod.js";import extend from"../utils/extend.prod.js";import is from"../utils/is.prod.js";import isNonNativeEvent from"../utils/isNonNativeEvent.prod.js";import normalize from"../utils/normalizeListeners.prod.js";import{getWindow}from"../utils/window.prod.js";import{Eventable}from"./Eventable.prod.js";var OnOffMethod=function(t){return t[t.On=0]="On",t[t.Off=1]="Off",t}(OnOffMethod||{});class Interactable{get _defaults(){return{base:{},perAction:{},actions:{}}}constructor(t,e,s,i){this.target=void 0,this.options=void 0,this._actions=void 0,this.events=new Eventable,this._context=void 0,this._win=void 0,this._doc=void 0,this._scopeEvents=void 0,this._actions=e.actions,this.target=t,this._context=e.context||s,this._win=getWindow(trySelector(t)?this._context:t),this._doc=this._win.document,this._scopeEvents=i,this.set(e)}setOnEvents(t,e){return is.func(e.onstart)&&this.on(t+"start",e.onstart),is.func(e.onmove)&&this.on(t+"move",e.onmove),is.func(e.onend)&&this.on(t+"end",e.onend),is.func(e.oninertiastart)&&this.on(t+"inertiastart",e.oninertiastart),this}updatePerActionListeners(t,e,s){var i;const n=null==(i=this._actions.map[t])?void 0:i.filterEventType,o=t=>(null==n||n(t))&&isNonNativeEvent(t,this._actions);(is.array(e)||is.object(e))&&this._onOff(OnOffMethod.Off,t,e,void 0,o),(is.array(s)||is.object(s))&&this._onOff(OnOffMethod.On,t,s,void 0,o)}setPerAction(t,e){const s=this._defaults;for(const i in e){const n=i,o=this.options[t],r=e[n];"listeners"===n&&this.updatePerActionListeners(t,o.listeners,r),is.array(r)?o[n]=arr.from(r):is.plainObject(r)?(o[n]=extend(o[n]||{},clone(r)),is.object(s.perAction[n])&&"enabled"in s.perAction[n]&&(o[n].enabled=!1!==r.enabled)):is.bool(r)&&is.object(s.perAction[n])?o[n].enabled=r:o[n]=r}}getRect(t){return t=t||(is.element(this.target)?this.target:null),is.string(this.target)&&(t=t||this._context.querySelector(this.target)),getElementRect(t)}rectChecker(t){return is.func(t)?(this.getRect=e=>{const s=extend({},t.apply(this,e));return"width"in s||(s.width=s.right-s.left,s.height=s.bottom-s.top),s},this):null===t?(delete this.getRect,this):this.getRect}_backCompatOption(t,e){if(trySelector(e)||is.object(e)){this.options[t]=e;for(const s in this._actions.map)this.options[s][t]=e;return this}return this.options[t]}origin(t){return this._backCompatOption("origin",t)}deltaSource(t){return"page"===t||"client"===t?(this.options.deltaSource=t,this):this.options.deltaSource}getAllElements(){const{target:t}=this;return is.string(t)?Array.from(this._context.querySelectorAll(t)):is.func(t)&&t.getAllElements?t.getAllElements():is.element(t)?[t]:[]}context(){return this._context}inContext(t){return this._context===t.ownerDocument||nodeContains(this._context,t)}testIgnoreAllow(t,e,s){return!this.testIgnore(t.ignoreFrom,e,s)&&this.testAllow(t.allowFrom,e,s)}testAllow(t,e,s){return!t||!!is.element(s)&&(is.string(t)?matchesUpTo(s,t,e):!!is.element(t)&&nodeContains(t,s))}testIgnore(t,e,s){return!(!t||!is.element(s))&&(is.string(t)?matchesUpTo(s,t,e):!!is.element(t)&&nodeContains(t,s))}fire(t){return this.events.fire(t),this}_onOff(t,e,s,i,n){is.object(e)&&!is.array(e)&&(i=s,s=null);const o=normalize(e,s,n);for(let e in o){"wheel"===e&&(e=browser.wheelEvent);for(const s of o[e])isNonNativeEvent(e,this._actions)?this.events[t===OnOffMethod.On?"on":"off"](e,s):is.string(this.target)?this._scopeEvents[t===OnOffMethod.On?"addDelegate":"removeDelegate"](this.target,this._context,e,s,i):this._scopeEvents[t===OnOffMethod.On?"add":"remove"](this.target,e,s,i)}return this}on(t,e,s){return this._onOff(OnOffMethod.On,t,e,s)}off(t,e,s){return this._onOff(OnOffMethod.Off,t,e,s)}set(t){const e=this._defaults;is.object(t)||(t={}),this.options=clone(e.base);for(const s in this._actions.methodDict){const i=s,n=this._actions.methodDict[i];this.options[i]={},this.setPerAction(i,extend(extend({},e.perAction),e.actions[i])),this[n](t[i])}for(const e in t)"getRect"!==e?is.func(this[e])&&this[e](t[e]):this.rectChecker(t.getRect);return this}unset(){if(is.string(this.target))for(const t in this._scopeEvents.delegatedEvents){const e=this._scopeEvents.delegatedEvents[t];for(let s=e.length-1;s>=0;s--){const{selector:i,context:n,listeners:o}=e[s];i===this.target&&n===this._context&&e.splice(s,1);for(let e=o.length-1;e>=0;e--)this._scopeEvents.removeDelegate(this.target,this._context,t,o[e][0],o[e][1])}}else this._scopeEvents.remove(this.target,"all")}}export{Interactable}; | ||
//# sourceMappingURL=Interactable.prod.js.map |
@@ -1,12 +0,12 @@ | ||
"use strict"; | ||
/** | ||
* interact.js 1.10.26 | ||
* | ||
* Copyright (c) 2012-present Taye Adeyemi <dev@taye.me> | ||
* Released under the MIT License. | ||
* https://raw.github.com/taye/interact.js/main/LICENSE | ||
*/ | ||
Object.defineProperty(exports, "__esModule", { | ||
value: true | ||
}); | ||
exports.default = void 0; | ||
exports.install = install; | ||
var _domUtils = require("../utils/domUtils.js"); | ||
var _is = _interopRequireDefault(require("../utils/is.js")); | ||
var _window = require("../utils/window.js"); | ||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } | ||
import { nodeContains, matchesSelector } from "../utils/domUtils.js"; | ||
import is from "../utils/is.js"; | ||
import { getWindow } from "../utils/window.js"; | ||
const preventDefault = function preventDefault(newValue) { | ||
@@ -17,3 +17,3 @@ if (/^(always|never|auto)$/.test(newValue)) { | ||
} | ||
if (_is.default.bool(newValue)) { | ||
if (is.bool(newValue)) { | ||
this.options.preventDefault = newValue ? 'always' : 'never'; | ||
@@ -38,3 +38,3 @@ return this; | ||
if (scope.events.supportsPassive && /^touch(start|move)$/.test(event.type)) { | ||
const doc = (0, _window.getWindow)(event.target).document; | ||
const doc = getWindow(event.target).document; | ||
const docOptions = scope.getDocOptions(doc); | ||
@@ -52,3 +52,3 @@ if (!(docOptions && docOptions.events) || docOptions.events.passive !== false) { | ||
// don't preventDefault on editable elements | ||
if (_is.default.element(event.target) && (0, _domUtils.matchesSelector)(event.target, 'input,select,textarea,[contenteditable=true],[contenteditable=true] *')) { | ||
if (is.element(event.target) && matchesSelector(event.target, 'input,select,textarea,[contenteditable=true],[contenteditable=true] *')) { | ||
return; | ||
@@ -58,6 +58,7 @@ } | ||
} | ||
function onInteractionEvent({ | ||
interaction, | ||
event | ||
}) { | ||
function onInteractionEvent(_ref) { | ||
let { | ||
interaction, | ||
event | ||
} = _ref; | ||
if (interaction.interactable) { | ||
@@ -81,3 +82,3 @@ interaction.interactable.checkAndPreventDefault(event); | ||
for (const interaction of scope.interactions.list) { | ||
if (interaction.element && (interaction.element === event.target || (0, _domUtils.nodeContains)(interaction.element, event.target))) { | ||
if (interaction.element && (interaction.element === event.target || nodeContains(interaction.element, event.target))) { | ||
interaction.interactable.checkAndPreventDefault(event); | ||
@@ -90,3 +91,3 @@ return; | ||
} | ||
var _default = exports.default = { | ||
var interactablePreventDefault = { | ||
id: 'core/interactablePreventDefault', | ||
@@ -99,2 +100,3 @@ install, | ||
}; | ||
//# sourceMappingURL=interactablePreventDefault.js.map | ||
export { interactablePreventDefault as default, install }; | ||
//# sourceMappingURL=interactablePreventDefault.js.map |
@@ -1,2 +0,4 @@ | ||
Object.defineProperty(exports,"__esModule",{value:!0}),exports.default=void 0,exports.install=a;var e,t=require("../utils/domUtils.prod.js"),n=(e=require("../utils/is.prod.js"))&&e.__esModule?e:{default:e},r=require("../utils/window.prod.js");const o=function(e){return/^(always|never|auto)$/.test(e)?(this.options.preventDefault=e,this):n.default.bool(e)?(this.options.preventDefault=e?"always":"never",this):this.options.preventDefault};function s({interaction:e,event:t}){e.interactable&&e.interactable.checkAndPreventDefault(t)}function a(e){const{Interactable:s}=e;s.prototype.preventDefault=o,s.prototype.checkAndPreventDefault=function(o){return((e,o,s)=>{const a=e.options.preventDefault;if("never"!==a)if("always"!==a){if(o.events.supportsPassive&&/^touch(start|move)$/.test(s.type)){const e=(0,r.getWindow)(s.target).document,t=o.getDocOptions(e);if(!t||!t.events||!1!==t.events.passive)return}/^(mouse|pointer|touch)*(down|start)/i.test(s.type)||n.default.element(s.target)&&(0,t.matchesSelector)(s.target,"input,select,textarea,[contenteditable=true],[contenteditable=true] *")||s.preventDefault()}else s.preventDefault()})(this,e,o)},e.interactions.docEvents.push({type:"dragstart",listener(n){for(const r of e.interactions.list)if(r.element&&(r.element===n.target||(0,t.nodeContains)(r.element,n.target)))return void r.interactable.checkAndPreventDefault(n)}})}exports.default={id:"core/interactablePreventDefault",install:a,listeners:["down","move","up","cancel"].reduce(((e,t)=>(e["interactions:"+t]=s,e)),{})}; | ||
//# sourceMappingURL=interactablePreventDefault.prod.js.map | ||
/* interact.js 1.10.26 | https://raw.github.com/taye/interact.js/main/LICENSE */ | ||
import{nodeContains,matchesSelector}from"../utils/domUtils.prod.js";import is from"../utils/is.prod.js";import{getWindow}from"../utils/window.prod.js";const preventDefault=function(t){return/^(always|never|auto)$/.test(t)?(this.options.preventDefault=t,this):is.bool(t)?(this.options.preventDefault=t?"always":"never",this):this.options.preventDefault};function checkAndPreventDefault(t,e,n){const r=t.options.preventDefault;if("never"!==r)if("always"!==r){if(e.events.supportsPassive&&/^touch(start|move)$/.test(n.type)){const t=getWindow(n.target).document,r=e.getDocOptions(t);if(!r||!r.events||!1!==r.events.passive)return}/^(mouse|pointer|touch)*(down|start)/i.test(n.type)||is.element(n.target)&&matchesSelector(n.target,"input,select,textarea,[contenteditable=true],[contenteditable=true] *")||n.preventDefault()}else n.preventDefault()}function onInteractionEvent(t){let{interaction:e,event:n}=t;e.interactable&&e.interactable.checkAndPreventDefault(n)}function install(t){const{Interactable:e}=t;e.prototype.preventDefault=preventDefault,e.prototype.checkAndPreventDefault=function(e){return checkAndPreventDefault(this,t,e)},t.interactions.docEvents.push({type:"dragstart",listener(e){for(const n of t.interactions.list)if(n.element&&(n.element===e.target||nodeContains(n.element,e.target)))return void n.interactable.checkAndPreventDefault(e)}})}var interactablePreventDefault={id:"core/interactablePreventDefault",install:install,listeners:["down","move","up","cancel"].reduce(((t,e)=>(t["interactions:"+e]=onInteractionEvent,t)),{})};export{interactablePreventDefault as default,install}; | ||
//# sourceMappingURL=interactablePreventDefault.prod.js.map |
@@ -1,29 +0,29 @@ | ||
"use strict"; | ||
/** | ||
* interact.js 1.10.26 | ||
* | ||
* Copyright (c) 2012-present Taye Adeyemi <dev@taye.me> | ||
* Released under the MIT License. | ||
* https://raw.github.com/taye/interact.js/main/LICENSE | ||
*/ | ||
Object.defineProperty(exports, "__esModule", { | ||
value: true | ||
}); | ||
exports.InteractableSet = void 0; | ||
var arr = _interopRequireWildcard(require("../utils/arr.js")); | ||
var domUtils = _interopRequireWildcard(require("../utils/domUtils.js")); | ||
var _extend = _interopRequireDefault(require("../utils/extend.js")); | ||
var _is = _interopRequireDefault(require("../utils/is.js")); | ||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } | ||
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); } | ||
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && Object.prototype.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; } | ||
import * as arr from "../utils/arr.js"; | ||
import * as domUtils from "../utils/domUtils.js"; | ||
import extend from "../utils/extend.js"; | ||
import is from "../utils/is.js"; | ||
class InteractableSet { | ||
// all set interactables | ||
list = []; | ||
selectorMap = {}; | ||
scope; | ||
constructor(scope) { | ||
// all set interactables | ||
this.list = []; | ||
this.selectorMap = {}; | ||
this.scope = void 0; | ||
this.scope = scope; | ||
scope.addListeners({ | ||
'interactable:unset': ({ | ||
interactable | ||
}) => { | ||
'interactable:unset': _ref => { | ||
let { | ||
interactable | ||
} = _ref; | ||
const { | ||
target | ||
} = interactable; | ||
const interactablesOnTarget = _is.default.string(target) ? this.selectorMap[target] : target[this.scope.id]; | ||
const interactablesOnTarget = is.string(target) ? this.selectorMap[target] : target[this.scope.id]; | ||
const targetIndex = arr.findIndex(interactablesOnTarget, i => i === interactable); | ||
@@ -35,3 +35,3 @@ interactablesOnTarget.splice(targetIndex, 1); | ||
new(target, options) { | ||
options = (0, _extend.default)(options || {}, { | ||
options = extend(options || {}, { | ||
actions: this.scope.actions | ||
@@ -42,3 +42,3 @@ }); | ||
this.list.push(interactable); | ||
if (_is.default.string(target)) { | ||
if (is.string(target)) { | ||
if (!this.selectorMap[target]) { | ||
@@ -55,3 +55,2 @@ this.selectorMap[target] = []; | ||
} | ||
; | ||
target[this.scope.id].push(interactable); | ||
@@ -69,3 +68,3 @@ } | ||
const context = options && options.context || this.scope.document; | ||
const isSelector = _is.default.string(target); | ||
const isSelector = is.string(target); | ||
const interactablesOnTarget = isSelector ? this.selectorMap[target] : target[this.scope.id]; | ||
@@ -78,5 +77,5 @@ if (!interactablesOnTarget) return undefined; | ||
let ret; | ||
if ((_is.default.string(interactable.target) ? | ||
if ((is.string(interactable.target) ? | ||
// target is a selector and the element matches | ||
_is.default.element(node) && domUtils.matchesSelector(node, interactable.target) : | ||
is.element(node) && domUtils.matchesSelector(node, interactable.target) : | ||
// target is the element | ||
@@ -94,3 +93,3 @@ node === interactable.target) && | ||
} | ||
exports.InteractableSet = InteractableSet; | ||
//# sourceMappingURL=InteractableSet.js.map | ||
export { InteractableSet }; | ||
//# sourceMappingURL=InteractableSet.js.map |
@@ -1,2 +0,4 @@ | ||
Object.defineProperty(exports,"__esModule",{value:!0}),exports.InteractableSet=void 0;var e=n(require("../utils/arr.prod.js")),t=n(require("../utils/domUtils.prod.js")),r=i(require("../utils/extend.prod.js")),s=i(require("../utils/is.prod.js"));function i(e){return e&&e.__esModule?e:{default:e}}function o(e){if("function"!=typeof WeakMap)return null;var t=new WeakMap,r=new WeakMap;return(o=e=>e?r:t)(e)}function n(e,t){if(!t&&e&&e.__esModule)return e;if(null===e||"object"!=typeof e&&"function"!=typeof e)return{default:e};var r=o(t);if(r&&r.has(e))return r.get(e);var s={__proto__:null},i=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var n in e)if("default"!==n&&Object.prototype.hasOwnProperty.call(e,n)){var c=i?Object.getOwnPropertyDescriptor(e,n):null;c&&(c.get||c.set)?Object.defineProperty(s,n,c):s[n]=e[n]}return s.default=e,r&&r.set(e,s),s}exports.InteractableSet=class{list=[];selectorMap={};scope;constructor(t){this.scope=t,t.addListeners({"interactable:unset":({interactable:t})=>{const{target:r}=t,i=s.default.string(r)?this.selectorMap[r]:r[this.scope.id],o=e.findIndex(i,(e=>e===t));i.splice(o,1)}})}new(e,t){t=(0,r.default)(t||{},{actions:this.scope.actions});const i=new this.scope.Interactable(e,t,this.scope.document,this.scope.events);return this.scope.addDocument(i._doc),this.list.push(i),s.default.string(e)?(this.selectorMap[e]||(this.selectorMap[e]=[]),this.selectorMap[e].push(i)):(i.target[this.scope.id]||Object.defineProperty(e,this.scope.id,{value:[],configurable:!0}),e[this.scope.id].push(i)),this.scope.fire("interactable:new",{target:e,options:t,interactable:i,win:this.scope._win}),i}getExisting(t,r){const i=r&&r.context||this.scope.document,o=s.default.string(t),n=o?this.selectorMap[t]:t[this.scope.id];if(n)return e.find(n,(e=>e._context===i&&(o||e.inContext(t))))}forEachMatch(e,r){for(const i of this.list){let o;if((s.default.string(i.target)?s.default.element(e)&&t.matchesSelector(e,i.target):e===i.target)&&i.inContext(e)&&(o=r(i)),void 0!==o)return o}}}; | ||
//# sourceMappingURL=InteractableSet.prod.js.map | ||
/* interact.js 1.10.26 | https://raw.github.com/taye/interact.js/main/LICENSE */ | ||
import*as arr from"../utils/arr.prod.js";import*as domUtils from"../utils/domUtils.prod.js";import extend from"../utils/extend.prod.js";import is from"../utils/is.prod.js";class InteractableSet{constructor(t){this.list=[],this.selectorMap={},this.scope=void 0,this.scope=t,t.addListeners({"interactable:unset":t=>{let{interactable:e}=t;const{target:s}=e,i=is.string(s)?this.selectorMap[s]:s[this.scope.id],o=arr.findIndex(i,(t=>t===e));i.splice(o,1)}})}new(t,e){e=extend(e||{},{actions:this.scope.actions});const s=new this.scope.Interactable(t,e,this.scope.document,this.scope.events);return this.scope.addDocument(s._doc),this.list.push(s),is.string(t)?(this.selectorMap[t]||(this.selectorMap[t]=[]),this.selectorMap[t].push(s)):(s.target[this.scope.id]||Object.defineProperty(t,this.scope.id,{value:[],configurable:!0}),t[this.scope.id].push(s)),this.scope.fire("interactable:new",{target:t,options:e,interactable:s,win:this.scope._win}),s}getExisting(t,e){const s=e&&e.context||this.scope.document,i=is.string(t),o=i?this.selectorMap[t]:t[this.scope.id];if(o)return arr.find(o,(e=>e._context===s&&(i||e.inContext(t))))}forEachMatch(t,e){for(const s of this.list){let i;if((is.string(s.target)?is.element(t)&&domUtils.matchesSelector(t,s.target):t===s.target)&&s.inContext(t)&&(i=e(s)),void 0!==i)return i}}}export{InteractableSet}; | ||
//# sourceMappingURL=InteractableSet.prod.js.map |
@@ -1,50 +0,52 @@ | ||
"use strict"; | ||
/** | ||
* interact.js 1.10.26 | ||
* | ||
* Copyright (c) 2012-present Taye Adeyemi <dev@taye.me> | ||
* Released under the MIT License. | ||
* https://raw.github.com/taye/interact.js/main/LICENSE | ||
*/ | ||
Object.defineProperty(exports, "__esModule", { | ||
value: true | ||
}); | ||
exports.InteractEvent = void 0; | ||
var _extend = _interopRequireDefault(require("../utils/extend.js")); | ||
var _getOriginXY = _interopRequireDefault(require("../utils/getOriginXY.js")); | ||
var _hypot = _interopRequireDefault(require("../utils/hypot.js")); | ||
var _BaseEvent = require("./BaseEvent"); | ||
var _options = require("./options"); | ||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } | ||
import extend from "../utils/extend.js"; | ||
import getOriginXY from "../utils/getOriginXY.js"; | ||
import hypot from "../utils/hypot.js"; | ||
import { BaseEvent } from './BaseEvent.js'; | ||
import { defaults } from './options.js'; | ||
// defined outside of class definition to avoid assignment of undefined during | ||
// construction | ||
class InteractEvent extends _BaseEvent.BaseEvent { | ||
relatedTarget = null; | ||
screenX; | ||
screenY; | ||
button; | ||
buttons; | ||
ctrlKey; | ||
shiftKey; | ||
altKey; | ||
metaKey; | ||
page; | ||
client; | ||
delta; | ||
rect; | ||
x0; | ||
y0; | ||
t0; | ||
dt; | ||
duration; | ||
clientX0; | ||
clientY0; | ||
velocity; | ||
speed; | ||
swipe; | ||
// resize | ||
axes; | ||
/** @internal */ | ||
preEnd; | ||
class InteractEvent extends BaseEvent { | ||
constructor(interaction, event, actionName, phase, element, preEnd, type) { | ||
super(interaction); | ||
this.relatedTarget = null; | ||
this.screenX = void 0; | ||
this.screenY = void 0; | ||
this.button = void 0; | ||
this.buttons = void 0; | ||
this.ctrlKey = void 0; | ||
this.shiftKey = void 0; | ||
this.altKey = void 0; | ||
this.metaKey = void 0; | ||
this.page = void 0; | ||
this.client = void 0; | ||
this.delta = void 0; | ||
this.rect = void 0; | ||
this.x0 = void 0; | ||
this.y0 = void 0; | ||
this.t0 = void 0; | ||
this.dt = void 0; | ||
this.duration = void 0; | ||
this.clientX0 = void 0; | ||
this.clientY0 = void 0; | ||
this.velocity = void 0; | ||
this.speed = void 0; | ||
this.swipe = void 0; | ||
// resize | ||
this.axes = void 0; | ||
/** @internal */ | ||
this.preEnd = void 0; | ||
element = element || interaction.element; | ||
const target = interaction.interactable; | ||
const deltaSource = (target && target.options || _options.defaults).deltaSource; | ||
const origin = (0, _getOriginXY.default)(target, element, actionName); | ||
const deltaSource = (target && target.options || defaults).deltaSource; | ||
const origin = getOriginXY(target, element, actionName); | ||
const starting = phase === 'start'; | ||
@@ -58,5 +60,5 @@ const ending = phase === 'end'; | ||
} : interaction.coords.cur; | ||
this.page = (0, _extend.default)({}, coords.page); | ||
this.client = (0, _extend.default)({}, coords.client); | ||
this.rect = (0, _extend.default)({}, interaction.rect); | ||
this.page = extend({}, coords.page); | ||
this.client = extend({}, coords.client); | ||
this.rect = extend({}, interaction.rect); | ||
this.timeStamp = coords.timeStamp; | ||
@@ -100,4 +102,4 @@ if (!ending) { | ||
// velocity and speed in pixels per second | ||
this.velocity = (0, _extend.default)({}, interaction.coords.velocity[deltaSource]); | ||
this.speed = (0, _hypot.default)(this.velocity.x, this.velocity.y); | ||
this.velocity = extend({}, interaction.coords.velocity[deltaSource]); | ||
this.speed = hypot(this.velocity.x, this.velocity.y); | ||
this.swipe = ending || phase === 'inertiastart' ? this.getSwipe() : null; | ||
@@ -151,3 +153,2 @@ } | ||
// don't support getter and setters in .d.ts files | ||
exports.InteractEvent = InteractEvent; | ||
Object.defineProperties(InteractEvent.prototype, { | ||
@@ -219,2 +220,3 @@ pageX: { | ||
}); | ||
//# sourceMappingURL=InteractEvent.js.map | ||
export { InteractEvent }; | ||
//# sourceMappingURL=InteractEvent.js.map |
@@ -1,2 +0,4 @@ | ||
Object.defineProperty(exports,"__esModule",{value:!0}),exports.InteractEvent=void 0;var t=n(require("../utils/extend.prod.js")),e=n(require("../utils/getOriginXY.prod.js")),i=n(require("../utils/hypot.prod.js")),s=require("./BaseEvent"),r=require("./options");function n(t){return t&&t.__esModule?t:{default:t}}class a extends s.BaseEvent{relatedTarget=null;screenX;screenY;button;buttons;ctrlKey;shiftKey;altKey;metaKey;page;client;delta;rect;x0;y0;t0;dt;duration;clientX0;clientY0;velocity;speed;swipe;axes;preEnd;constructor(s,n,a,o,l,p,c){super(s),l=l||s.element;const h=s.interactable,d=(h&&h.options||r.defaults).deltaSource,y=(0,e.default)(h,l,a),u="start"===o,v="end"===o,g=u?this:s.prevEvent,x=u?s.coords.start:v?{page:g.page,client:g.client,timeStamp:s.coords.cur.timeStamp}:s.coords.cur;this.page=(0,t.default)({},x.page),this.client=(0,t.default)({},x.client),this.rect=(0,t.default)({},s.rect),this.timeStamp=x.timeStamp,v||(this.page.x-=y.x,this.page.y-=y.y,this.client.x-=y.x,this.client.y-=y.y),this.ctrlKey=n.ctrlKey,this.altKey=n.altKey,this.shiftKey=n.shiftKey,this.metaKey=n.metaKey,this.button=n.button,this.buttons=n.buttons,this.target=l,this.currentTarget=l,this.preEnd=p,this.type=c||a+(o||""),this.interactable=h,this.t0=u?s.pointers[s.pointers.length-1].downTime:g.t0,this.x0=s.coords.start.page.x-y.x,this.y0=s.coords.start.page.y-y.y,this.clientX0=s.coords.start.client.x-y.x,this.clientY0=s.coords.start.client.y-y.y,this.delta=u||v?{x:0,y:0}:{x:this[d].x-g[d].x,y:this[d].y-g[d].y},this.dt=s.coords.delta.timeStamp,this.duration=this.timeStamp-this.t0,this.velocity=(0,t.default)({},s.coords.velocity[d]),this.speed=(0,i.default)(this.velocity.x,this.velocity.y),this.swipe=v||"inertiastart"===o?this.getSwipe():null}getSwipe(){const t=this._interaction;if(t.prevEvent.speed<600||this.timeStamp-t.prevEvent.timeStamp>150)return null;let e=180*Math.atan2(t.prevEvent.velocityY,t.prevEvent.velocityX)/Math.PI;e<0&&(e+=360);const i=112.5<=e&&e<247.5,s=202.5<=e&&e<337.5;return{up:s,down:!s&&22.5<=e&&e<157.5,left:i,right:!i&&(292.5<=e||e<67.5),angle:e,speed:t.prevEvent.speed,velocity:{x:t.prevEvent.velocityX,y:t.prevEvent.velocityY}}}preventDefault(){}stopImmediatePropagation(){this.immediatePropagationStopped=this.propagationStopped=!0}stopPropagation(){this.propagationStopped=!0}}exports.InteractEvent=a,Object.defineProperties(a.prototype,{pageX:{get(){return this.page.x},set(t){this.page.x=t}},pageY:{get(){return this.page.y},set(t){this.page.y=t}},clientX:{get(){return this.client.x},set(t){this.client.x=t}},clientY:{get(){return this.client.y},set(t){this.client.y=t}},dx:{get(){return this.delta.x},set(t){this.delta.x=t}},dy:{get(){return this.delta.y},set(t){this.delta.y=t}},velocityX:{get(){return this.velocity.x},set(t){this.velocity.x=t}},velocityY:{get(){return this.velocity.y},set(t){this.velocity.y=t}}}); | ||
//# sourceMappingURL=InteractEvent.prod.js.map | ||
/* interact.js 1.10.26 | https://raw.github.com/taye/interact.js/main/LICENSE */ | ||
import extend from"../utils/extend.prod.js";import getOriginXY from"../utils/getOriginXY.prod.js";import hypot from"../utils/hypot.prod.js";import{BaseEvent}from"./BaseEvent.prod.js";import{defaults}from"./options.prod.js";class InteractEvent extends BaseEvent{constructor(t,e,i,s,o,r,n){super(t),this.relatedTarget=null,this.screenX=void 0,this.screenY=void 0,this.button=void 0,this.buttons=void 0,this.ctrlKey=void 0,this.shiftKey=void 0,this.altKey=void 0,this.metaKey=void 0,this.page=void 0,this.client=void 0,this.delta=void 0,this.rect=void 0,this.x0=void 0,this.y0=void 0,this.t0=void 0,this.dt=void 0,this.duration=void 0,this.clientX0=void 0,this.clientY0=void 0,this.velocity=void 0,this.speed=void 0,this.swipe=void 0,this.axes=void 0,this.preEnd=void 0,o=o||t.element;const h=t.interactable,a=(h&&h.options||defaults).deltaSource,p=getOriginXY(h,o,i),d="start"===s,l="end"===s,c=d?this:t.prevEvent,v=d?t.coords.start:l?{page:c.page,client:c.client,timeStamp:t.coords.cur.timeStamp}:t.coords.cur;this.page=extend({},v.page),this.client=extend({},v.client),this.rect=extend({},t.rect),this.timeStamp=v.timeStamp,l||(this.page.x-=p.x,this.page.y-=p.y,this.client.x-=p.x,this.client.y-=p.y),this.ctrlKey=e.ctrlKey,this.altKey=e.altKey,this.shiftKey=e.shiftKey,this.metaKey=e.metaKey,this.button=e.button,this.buttons=e.buttons,this.target=o,this.currentTarget=o,this.preEnd=r,this.type=n||i+(s||""),this.interactable=h,this.t0=d?t.pointers[t.pointers.length-1].downTime:c.t0,this.x0=t.coords.start.page.x-p.x,this.y0=t.coords.start.page.y-p.y,this.clientX0=t.coords.start.client.x-p.x,this.clientY0=t.coords.start.client.y-p.y,this.delta=d||l?{x:0,y:0}:{x:this[a].x-c[a].x,y:this[a].y-c[a].y},this.dt=t.coords.delta.timeStamp,this.duration=this.timeStamp-this.t0,this.velocity=extend({},t.coords.velocity[a]),this.speed=hypot(this.velocity.x,this.velocity.y),this.swipe=l||"inertiastart"===s?this.getSwipe():null}getSwipe(){const t=this._interaction;if(t.prevEvent.speed<600||this.timeStamp-t.prevEvent.timeStamp>150)return null;let e=180*Math.atan2(t.prevEvent.velocityY,t.prevEvent.velocityX)/Math.PI;e<0&&(e+=360);const i=112.5<=e&&e<247.5,s=202.5<=e&&e<337.5;return{up:s,down:!s&&22.5<=e&&e<157.5,left:i,right:!i&&(292.5<=e||e<67.5),angle:e,speed:t.prevEvent.speed,velocity:{x:t.prevEvent.velocityX,y:t.prevEvent.velocityY}}}preventDefault(){}stopImmediatePropagation(){this.immediatePropagationStopped=this.propagationStopped=!0}stopPropagation(){this.propagationStopped=!0}}Object.defineProperties(InteractEvent.prototype,{pageX:{get(){return this.page.x},set(t){this.page.x=t}},pageY:{get(){return this.page.y},set(t){this.page.y=t}},clientX:{get(){return this.client.x},set(t){this.client.x=t}},clientY:{get(){return this.client.y},set(t){this.client.y=t}},dx:{get(){return this.delta.x},set(t){this.delta.x=t}},dy:{get(){return this.delta.y},set(t){this.delta.y=t}},velocityX:{get(){return this.velocity.x},set(t){this.velocity.x=t}},velocityY:{get(){return this.velocity.y},set(t){this.velocity.y=t}}});export{InteractEvent}; | ||
//# sourceMappingURL=InteractEvent.prod.js.map |
@@ -1,26 +0,21 @@ | ||
"use strict"; | ||
/** | ||
* interact.js 1.10.26 | ||
* | ||
* Copyright (c) 2012-present Taye Adeyemi <dev@taye.me> | ||
* Released under the MIT License. | ||
* https://raw.github.com/taye/interact.js/main/LICENSE | ||
*/ | ||
Object.defineProperty(exports, "__esModule", { | ||
value: true | ||
}); | ||
exports.Interaction = void 0; | ||
Object.defineProperty(exports, "PointerInfo", { | ||
enumerable: true, | ||
get: function () { | ||
return _PointerInfo.PointerInfo; | ||
} | ||
}); | ||
exports.default = exports._ProxyValues = exports._ProxyMethods = void 0; | ||
var arr = _interopRequireWildcard(require("../utils/arr.js")); | ||
var _extend = _interopRequireDefault(require("../utils/extend.js")); | ||
var _hypot = _interopRequireDefault(require("../utils/hypot.js")); | ||
var _misc = require("../utils/misc.js"); | ||
var pointerUtils = _interopRequireWildcard(require("../utils/pointerUtils.js")); | ||
var rectUtils = _interopRequireWildcard(require("../utils/rect.js")); | ||
var _InteractEvent = require("./InteractEvent"); | ||
var _PointerInfo = require("./PointerInfo"); | ||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } | ||
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); } | ||
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && Object.prototype.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; } | ||
let _ProxyValues = exports._ProxyValues = /*#__PURE__*/function (_ProxyValues) { | ||
import * as arr from "../utils/arr.js"; | ||
import extend from "../utils/extend.js"; | ||
import hypot from "../utils/hypot.js"; | ||
import { warnOnce, copyAction } from "../utils/misc.js"; | ||
import * as pointerUtils from "../utils/pointerUtils.js"; | ||
import * as rectUtils from "../utils/rect.js"; | ||
import { InteractEvent } from './InteractEvent.js'; | ||
import { PointerInfo } from './PointerInfo.js'; | ||
import "../utils/getOriginXY.js"; | ||
import './BaseEvent.js'; | ||
import './options.js'; | ||
let _ProxyValues = /*#__PURE__*/function (_ProxyValues) { | ||
_ProxyValues["interactable"] = ""; | ||
@@ -34,3 +29,3 @@ _ProxyValues["element"] = ""; | ||
}({}); | ||
let _ProxyMethods = exports._ProxyMethods = /*#__PURE__*/function (_ProxyMethods) { | ||
let _ProxyMethods = /*#__PURE__*/function (_ProxyMethods) { | ||
_ProxyMethods["start"] = ""; | ||
@@ -45,82 +40,72 @@ _ProxyMethods["move"] = ""; | ||
class Interaction { | ||
/** current interactable being interacted with */ | ||
interactable = null; | ||
/** the target element of the interactable */ | ||
element = null; | ||
rect = null; | ||
/** @internal */ | ||
_rects; | ||
/** @internal */ | ||
edges = null; | ||
/** @internal */ | ||
_scopeFire; | ||
// action that's ready to be fired on next move event | ||
prepared = { | ||
name: null, | ||
axis: null, | ||
edges: null | ||
}; | ||
pointerType; | ||
/** @internal keep track of added pointers */ | ||
pointers = []; | ||
/** @internal pointerdown/mousedown/touchstart event */ | ||
downEvent = null; | ||
/** @internal */ | ||
downPointer = {}; | ||
/** @internal */ | ||
_latestPointer = { | ||
pointer: null, | ||
event: null, | ||
eventTarget: null | ||
}; | ||
/** @internal */ | ||
prevEvent = null; | ||
pointerIsDown = false; | ||
pointerWasMoved = false; | ||
/** @internal */ | ||
_interacting = false; | ||
/** @internal */ | ||
_ending = false; | ||
/** @internal */ | ||
_stopped = true; | ||
/** @internal */ | ||
_proxy; | ||
/** @internal */ | ||
simulation = null; | ||
/** @internal */ | ||
get pointerMoveTolerance() { | ||
return 1; | ||
} | ||
doMove = (0, _misc.warnOnce)(function (signalArg) { | ||
this.move(signalArg); | ||
}, 'The interaction.doMove() method has been renamed to interaction.move()'); | ||
coords = { | ||
// Starting InteractEvent pointer coordinates | ||
start: pointerUtils.newCoords(), | ||
// Previous native pointer move event coordinates | ||
prev: pointerUtils.newCoords(), | ||
// current native pointer move event coordinates | ||
cur: pointerUtils.newCoords(), | ||
// Change in coordinates and time of the pointer | ||
delta: pointerUtils.newCoords(), | ||
// pointer velocity | ||
velocity: pointerUtils.newCoords() | ||
}; | ||
/** @internal */ | ||
_id = idCounter++; | ||
constructor({ | ||
pointerType, | ||
scopeFire | ||
}) { | ||
constructor(_ref) { | ||
/** current interactable being interacted with */ | ||
this.interactable = null; | ||
/** the target element of the interactable */ | ||
this.element = null; | ||
this.rect = null; | ||
/** @internal */ | ||
this._rects = void 0; | ||
/** @internal */ | ||
this.edges = null; | ||
/** @internal */ | ||
this._scopeFire = void 0; | ||
// action that's ready to be fired on next move event | ||
this.prepared = { | ||
name: null, | ||
axis: null, | ||
edges: null | ||
}; | ||
this.pointerType = void 0; | ||
/** @internal keep track of added pointers */ | ||
this.pointers = []; | ||
/** @internal pointerdown/mousedown/touchstart event */ | ||
this.downEvent = null; | ||
/** @internal */ | ||
this.downPointer = {}; | ||
/** @internal */ | ||
this._latestPointer = { | ||
pointer: null, | ||
event: null, | ||
eventTarget: null | ||
}; | ||
/** @internal */ | ||
this.prevEvent = null; | ||
this.pointerIsDown = false; | ||
this.pointerWasMoved = false; | ||
/** @internal */ | ||
this._interacting = false; | ||
/** @internal */ | ||
this._ending = false; | ||
/** @internal */ | ||
this._stopped = true; | ||
/** @internal */ | ||
this._proxy = void 0; | ||
/** @internal */ | ||
this.simulation = null; | ||
this.doMove = warnOnce(function (signalArg) { | ||
this.move(signalArg); | ||
}, 'The interaction.doMove() method has been renamed to interaction.move()'); | ||
this.coords = { | ||
// Starting InteractEvent pointer coordinates | ||
start: pointerUtils.newCoords(), | ||
// Previous native pointer move event coordinates | ||
prev: pointerUtils.newCoords(), | ||
// current native pointer move event coordinates | ||
cur: pointerUtils.newCoords(), | ||
// Change in coordinates and time of the pointer | ||
delta: pointerUtils.newCoords(), | ||
// pointer velocity | ||
velocity: pointerUtils.newCoords() | ||
}; | ||
/** @internal */ | ||
this._id = idCounter++; | ||
let { | ||
pointerType, | ||
scopeFire | ||
} = _ref; | ||
this._scopeFire = scopeFire; | ||
@@ -139,3 +124,5 @@ this.pointerType = pointerType; | ||
Object.defineProperty(this._proxy, key, { | ||
value: (...args) => that[key](...args) | ||
value: function () { | ||
return that[key](...arguments); | ||
} | ||
}); | ||
@@ -196,7 +183,7 @@ } | ||
} | ||
(0, _misc.copyAction)(this.prepared, action); | ||
copyAction(this.prepared, action); | ||
this.interactable = interactable; | ||
this.element = element; | ||
this.rect = interactable.getRect(element); | ||
this.edges = this.prepared.edges ? (0, _extend.default)({}, this.prepared.edges) : { | ||
this.edges = this.prepared.edges ? extend({}, this.prepared.edges) : { | ||
left: true, | ||
@@ -227,3 +214,3 @@ right: true, | ||
dy = this.coords.cur.client.y - this.coords.start.client.y; | ||
this.pointerWasMoved = (0, _hypot.default)(dx, dy) > this.pointerMoveTolerance; | ||
this.pointerWasMoved = hypot(dx, dy) > this.pointerMoveTolerance; | ||
} | ||
@@ -282,3 +269,3 @@ const pointerIndex = this.getPointerIndex(pointer); | ||
} | ||
signalArg = (0, _extend.default)({ | ||
signalArg = extend({ | ||
pointer: this._latestPointer.pointer, | ||
@@ -395,3 +382,3 @@ event: this._latestPointer.event, | ||
if (!pointerInfo) { | ||
pointerInfo = new _PointerInfo.PointerInfo(id, pointer, event, null, null); | ||
pointerInfo = new PointerInfo(id, pointer, event, null, null); | ||
pointerIndex = this.pointers.length; | ||
@@ -460,3 +447,3 @@ this.pointers.push(pointerInfo); | ||
_createPreparedEvent(event, phase, preEnd, type) { | ||
return new _InteractEvent.InteractEvent(this, event, this.prepared.name, phase, this.element, preEnd, type); | ||
return new InteractEvent(this, event, this.prepared.name, phase, this.element, preEnd, type); | ||
} | ||
@@ -509,4 +496,3 @@ | ||
} | ||
exports.Interaction = Interaction; | ||
var _default = exports.default = Interaction; | ||
//# sourceMappingURL=Interaction.js.map | ||
export { Interaction, PointerInfo, _ProxyMethods, _ProxyValues, Interaction as default }; | ||
//# sourceMappingURL=Interaction.js.map |
@@ -1,2 +0,4 @@ | ||
Object.defineProperty(exports,"__esModule",{value:!0}),exports.Interaction=void 0,Object.defineProperty(exports,"PointerInfo",{enumerable:!0,get:()=>p.PointerInfo}),exports.default=exports._ProxyValues=exports._ProxyMethods=void 0;var t=h(require("../utils/arr.prod.js")),e=a(require("../utils/extend.prod.js")),i=a(require("../utils/hypot.prod.js")),n=require("../utils/misc.prod.js"),r=h(require("../utils/pointerUtils.prod.js")),o=h(require("../utils/rect.prod.js")),s=require("./InteractEvent"),p=require("./PointerInfo");function a(t){return t&&t.__esModule?t:{default:t}}function c(t){if("function"!=typeof WeakMap)return null;var e=new WeakMap,i=new WeakMap;return(c=t=>t?i:e)(t)}function h(t,e){if(!e&&t&&t.__esModule)return t;if(null===t||"object"!=typeof t&&"function"!=typeof t)return{default:t};var i=c(e);if(i&&i.has(t))return i.get(t);var n={__proto__:null},r=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var o in t)if("default"!==o&&Object.prototype.hasOwnProperty.call(t,o)){var s=r?Object.getOwnPropertyDescriptor(t,o):null;s&&(s.get||s.set)?Object.defineProperty(n,o,s):n[o]=t[o]}return n.default=t,i&&i.set(t,n),n}let d=exports._ProxyValues=(t=>(t.interactable="",t.element="",t.prepared="",t.pointerIsDown="",t.pointerWasMoved="",t._proxy="",t))({}),l=exports._ProxyMethods=(t=>(t.start="",t.move="",t.end="",t.stop="",t.interacting="",t))({}),u=0;class v{interactable=null;element=null;rect=null;_rects;edges=null;_scopeFire;prepared={name:null,axis:null,edges:null};pointerType;pointers=[];downEvent=null;downPointer={};_latestPointer={pointer:null,event:null,eventTarget:null};prevEvent=null;pointerIsDown=!1;pointerWasMoved=!1;_interacting=!1;_ending=!1;_stopped=!0;_proxy;simulation=null;get pointerMoveTolerance(){return 1}doMove=(0,n.warnOnce)((function(t){this.move(t)}),"The interaction.doMove() method has been renamed to interaction.move()");coords={start:r.newCoords(),prev:r.newCoords(),cur:r.newCoords(),delta:r.newCoords(),velocity:r.newCoords()};_id=u++;constructor({pointerType:t,scopeFire:e}){this._scopeFire=e,this.pointerType=t;const i=this;this._proxy={};for(const t in d)Object.defineProperty(this._proxy,t,{get(){return i[t]}});for(const t in l)Object.defineProperty(this._proxy,t,{value:(...e)=>i[t](...e)});this._scopeFire("interactions:new",{interaction:this})}pointerDown(t,e,i){const n=this.updatePointer(t,e,i,!0),r=this.pointers[n];this._scopeFire("interactions:down",{pointer:t,event:e,eventTarget:i,pointerIndex:n,pointerInfo:r,type:"down",interaction:this})}start(t,i,r){return!(this.interacting()||!this.pointerIsDown||this.pointers.length<("gesture"===t.name?2:1)||!i.options[t.name].enabled)&&((0,n.copyAction)(this.prepared,t),this.interactable=i,this.element=r,this.rect=i.getRect(r),this.edges=this.prepared.edges?(0,e.default)({},this.prepared.edges):{left:!0,right:!0,top:!0,bottom:!0},this._stopped=!1,this._interacting=this._doPhase({interaction:this,event:this.downEvent,phase:"start"})&&!this._stopped,this._interacting)}pointerMove(t,e,n){this.simulation||this.modification&&this.modification.endResult||this.updatePointer(t,e,n,!1);const o=this.coords.cur.page.x===this.coords.prev.page.x&&this.coords.cur.page.y===this.coords.prev.page.y&&this.coords.cur.client.x===this.coords.prev.client.x&&this.coords.cur.client.y===this.coords.prev.client.y;let s,p;this.pointerIsDown&&!this.pointerWasMoved&&(s=this.coords.cur.client.x-this.coords.start.client.x,p=this.coords.cur.client.y-this.coords.start.client.y,this.pointerWasMoved=(0,i.default)(s,p)>this.pointerMoveTolerance);const a=this.getPointerIndex(t),c={pointer:t,pointerIndex:a,pointerInfo:this.pointers[a],event:e,type:"move",eventTarget:n,dx:s,dy:p,duplicate:o,interaction:this};o||r.setCoordVelocity(this.coords.velocity,this.coords.delta),this._scopeFire("interactions:move",c),o||this.simulation||(this.interacting()&&(c.type=null,this.move(c)),this.pointerWasMoved&&r.copyCoords(this.coords.prev,this.coords.cur))}move(t){t&&t.event||r.setZeroCoords(this.coords.delta),(t=(0,e.default)({pointer:this._latestPointer.pointer,event:this._latestPointer.event,eventTarget:this._latestPointer.eventTarget,interaction:this},t||{})).phase="move",this._doPhase(t)}pointerUp(t,e,i,n){let r=this.getPointerIndex(t);-1===r&&(r=this.updatePointer(t,e,i,!1));const o=/cancel$/i.test(e.type)?"cancel":"up";this._scopeFire("interactions:"+o,{pointer:t,pointerIndex:r,pointerInfo:this.pointers[r],event:e,eventTarget:i,type:o,curEventTarget:n,interaction:this}),this.simulation||this.end(e),this.removePointer(t,e)}documentBlur(t){this.end(t),this._scopeFire("interactions:blur",{event:t,type:"blur",interaction:this})}end(t){let e;this._ending=!0,t=t||this._latestPointer.event,this.interacting()&&(e=this._doPhase({event:t,interaction:this,phase:"end"})),this._ending=!1,!0===e&&this.stop()}currentAction(){return this._interacting?this.prepared.name:null}interacting(){return this._interacting}stop(){this._scopeFire("interactions:stop",{interaction:this}),this.interactable=this.element=null,this._interacting=!1,this._stopped=!0,this.prepared.name=this.prevEvent=null}getPointerIndex(e){const i=r.getPointerId(e);return"mouse"===this.pointerType||"pen"===this.pointerType?this.pointers.length-1:t.findIndex(this.pointers,(t=>t.id===i))}getPointerInfo(t){return this.pointers[this.getPointerIndex(t)]}updatePointer(t,e,i,n){const o=r.getPointerId(t);let s=this.getPointerIndex(t),a=this.pointers[s];return n=!1!==n&&(n||/(down|start)$/i.test(e.type)),a?a.pointer=t:(a=new p.PointerInfo(o,t,e,null,null),s=this.pointers.length,this.pointers.push(a)),r.setCoords(this.coords.cur,this.pointers.map((t=>t.pointer)),this._now()),r.setCoordDeltas(this.coords.delta,this.coords.prev,this.coords.cur),n&&(this.pointerIsDown=!0,a.downTime=this.coords.cur.timeStamp,a.downTarget=i,r.pointerExtend(this.downPointer,t),this.interacting()||(r.copyCoords(this.coords.start,this.coords.cur),r.copyCoords(this.coords.prev,this.coords.cur),this.downEvent=e,this.pointerWasMoved=!1)),this._updateLatestPointer(t,e,i),this._scopeFire("interactions:update-pointer",{pointer:t,event:e,eventTarget:i,down:n,pointerInfo:a,pointerIndex:s,interaction:this}),s}removePointer(t,e){const i=this.getPointerIndex(t);if(-1===i)return;const n=this.pointers[i];this._scopeFire("interactions:remove-pointer",{pointer:t,event:e,eventTarget:null,pointerIndex:i,pointerInfo:n,interaction:this}),this.pointers.splice(i,1),this.pointerIsDown=!1}_updateLatestPointer(t,e,i){this._latestPointer.pointer=t,this._latestPointer.event=e,this._latestPointer.eventTarget=i}destroy(){this._latestPointer.pointer=null,this._latestPointer.event=null,this._latestPointer.eventTarget=null}_createPreparedEvent(t,e,i,n){return new s.InteractEvent(this,t,this.prepared.name,e,this.element,i,n)}_fireEvent(t){var e;null==(e=this.interactable)||e.fire(t),(!this.prevEvent||t.timeStamp>=this.prevEvent.timeStamp)&&(this.prevEvent=t)}_doPhase(t){const{event:e,phase:i,preEnd:n,type:r}=t,{rect:s}=this;if(s&&"move"===i&&(o.addEdges(this.edges,s,this.coords.delta[this.interactable.options.deltaSource]),s.width=s.right-s.left,s.height=s.bottom-s.top),!1===this._scopeFire("interactions:before-action-"+i,t))return!1;const p=t.iEvent=this._createPreparedEvent(e,i,n,r);return this._scopeFire("interactions:action-"+i,t),"start"===i&&(this.prevEvent=p),this._fireEvent(p),this._scopeFire("interactions:after-action-"+i,t),!0}_now(){return Date.now()}}exports.Interaction=v,exports.default=v; | ||
//# sourceMappingURL=Interaction.prod.js.map | ||
/* interact.js 1.10.26 | https://raw.github.com/taye/interact.js/main/LICENSE */ | ||
import*as arr from"../utils/arr.prod.js";import extend from"../utils/extend.prod.js";import hypot from"../utils/hypot.prod.js";import{warnOnce,copyAction}from"../utils/misc.prod.js";import*as pointerUtils from"../utils/pointerUtils.prod.js";import*as rectUtils from"../utils/rect.prod.js";import{InteractEvent}from"./InteractEvent.prod.js";import{PointerInfo}from"./PointerInfo.prod.js";import"../utils/getOriginXY.prod.js";import"./BaseEvent.prod.js";import"./options.prod.js";let _ProxyValues=function(t){return t.interactable="",t.element="",t.prepared="",t.pointerIsDown="",t.pointerWasMoved="",t._proxy="",t}({}),_ProxyMethods=function(t){return t.start="",t.move="",t.end="",t.stop="",t.interacting="",t}({}),idCounter=0;class Interaction{get pointerMoveTolerance(){return 1}constructor(t){this.interactable=null,this.element=null,this.rect=null,this._rects=void 0,this.edges=null,this._scopeFire=void 0,this.prepared={name:null,axis:null,edges:null},this.pointerType=void 0,this.pointers=[],this.downEvent=null,this.downPointer={},this._latestPointer={pointer:null,event:null,eventTarget:null},this.prevEvent=null,this.pointerIsDown=!1,this.pointerWasMoved=!1,this._interacting=!1,this._ending=!1,this._stopped=!0,this._proxy=void 0,this.simulation=null,this.doMove=warnOnce((function(t){this.move(t)}),"The interaction.doMove() method has been renamed to interaction.move()"),this.coords={start:pointerUtils.newCoords(),prev:pointerUtils.newCoords(),cur:pointerUtils.newCoords(),delta:pointerUtils.newCoords(),velocity:pointerUtils.newCoords()},this._id=idCounter++;let{pointerType:e,scopeFire:i}=t;this._scopeFire=i,this.pointerType=e;const n=this;this._proxy={};for(const t in _ProxyValues)Object.defineProperty(this._proxy,t,{get:()=>n[t]});for(const t in _ProxyMethods)Object.defineProperty(this._proxy,t,{value(){return n[t](...arguments)}});this._scopeFire("interactions:new",{interaction:this})}pointerDown(t,e,i){const n=this.updatePointer(t,e,i,!0),o=this.pointers[n];this._scopeFire("interactions:down",{pointer:t,event:e,eventTarget:i,pointerIndex:n,pointerInfo:o,type:"down",interaction:this})}start(t,e,i){return!(this.interacting()||!this.pointerIsDown||this.pointers.length<("gesture"===t.name?2:1)||!e.options[t.name].enabled)&&(copyAction(this.prepared,t),this.interactable=e,this.element=i,this.rect=e.getRect(i),this.edges=this.prepared.edges?extend({},this.prepared.edges):{left:!0,right:!0,top:!0,bottom:!0},this._stopped=!1,this._interacting=this._doPhase({interaction:this,event:this.downEvent,phase:"start"})&&!this._stopped,this._interacting)}pointerMove(t,e,i){this.simulation||this.modification&&this.modification.endResult||this.updatePointer(t,e,i,!1);const n=this.coords.cur.page.x===this.coords.prev.page.x&&this.coords.cur.page.y===this.coords.prev.page.y&&this.coords.cur.client.x===this.coords.prev.client.x&&this.coords.cur.client.y===this.coords.prev.client.y;let o,r;this.pointerIsDown&&!this.pointerWasMoved&&(o=this.coords.cur.client.x-this.coords.start.client.x,r=this.coords.cur.client.y-this.coords.start.client.y,this.pointerWasMoved=hypot(o,r)>this.pointerMoveTolerance);const s=this.getPointerIndex(t),p={pointer:t,pointerIndex:s,pointerInfo:this.pointers[s],event:e,type:"move",eventTarget:i,dx:o,dy:r,duplicate:n,interaction:this};n||pointerUtils.setCoordVelocity(this.coords.velocity,this.coords.delta),this._scopeFire("interactions:move",p),n||this.simulation||(this.interacting()&&(p.type=null,this.move(p)),this.pointerWasMoved&&pointerUtils.copyCoords(this.coords.prev,this.coords.cur))}move(t){t&&t.event||pointerUtils.setZeroCoords(this.coords.delta),(t=extend({pointer:this._latestPointer.pointer,event:this._latestPointer.event,eventTarget:this._latestPointer.eventTarget,interaction:this},t||{})).phase="move",this._doPhase(t)}pointerUp(t,e,i,n){let o=this.getPointerIndex(t);-1===o&&(o=this.updatePointer(t,e,i,!1));const r=/cancel$/i.test(e.type)?"cancel":"up";this._scopeFire("interactions:"+r,{pointer:t,pointerIndex:o,pointerInfo:this.pointers[o],event:e,eventTarget:i,type:r,curEventTarget:n,interaction:this}),this.simulation||this.end(e),this.removePointer(t,e)}documentBlur(t){this.end(t),this._scopeFire("interactions:blur",{event:t,type:"blur",interaction:this})}end(t){let e;this._ending=!0,t=t||this._latestPointer.event,this.interacting()&&(e=this._doPhase({event:t,interaction:this,phase:"end"})),this._ending=!1,!0===e&&this.stop()}currentAction(){return this._interacting?this.prepared.name:null}interacting(){return this._interacting}stop(){this._scopeFire("interactions:stop",{interaction:this}),this.interactable=this.element=null,this._interacting=!1,this._stopped=!0,this.prepared.name=this.prevEvent=null}getPointerIndex(t){const e=pointerUtils.getPointerId(t);return"mouse"===this.pointerType||"pen"===this.pointerType?this.pointers.length-1:arr.findIndex(this.pointers,(t=>t.id===e))}getPointerInfo(t){return this.pointers[this.getPointerIndex(t)]}updatePointer(t,e,i,n){const o=pointerUtils.getPointerId(t);let r=this.getPointerIndex(t),s=this.pointers[r];return n=!1!==n&&(n||/(down|start)$/i.test(e.type)),s?s.pointer=t:(s=new PointerInfo(o,t,e,null,null),r=this.pointers.length,this.pointers.push(s)),pointerUtils.setCoords(this.coords.cur,this.pointers.map((t=>t.pointer)),this._now()),pointerUtils.setCoordDeltas(this.coords.delta,this.coords.prev,this.coords.cur),n&&(this.pointerIsDown=!0,s.downTime=this.coords.cur.timeStamp,s.downTarget=i,pointerUtils.pointerExtend(this.downPointer,t),this.interacting()||(pointerUtils.copyCoords(this.coords.start,this.coords.cur),pointerUtils.copyCoords(this.coords.prev,this.coords.cur),this.downEvent=e,this.pointerWasMoved=!1)),this._updateLatestPointer(t,e,i),this._scopeFire("interactions:update-pointer",{pointer:t,event:e,eventTarget:i,down:n,pointerInfo:s,pointerIndex:r,interaction:this}),r}removePointer(t,e){const i=this.getPointerIndex(t);if(-1===i)return;const n=this.pointers[i];this._scopeFire("interactions:remove-pointer",{pointer:t,event:e,eventTarget:null,pointerIndex:i,pointerInfo:n,interaction:this}),this.pointers.splice(i,1),this.pointerIsDown=!1}_updateLatestPointer(t,e,i){this._latestPointer.pointer=t,this._latestPointer.event=e,this._latestPointer.eventTarget=i}destroy(){this._latestPointer.pointer=null,this._latestPointer.event=null,this._latestPointer.eventTarget=null}_createPreparedEvent(t,e,i,n){return new InteractEvent(this,t,this.prepared.name,e,this.element,i,n)}_fireEvent(t){var e;null==(e=this.interactable)||e.fire(t),(!this.prevEvent||t.timeStamp>=this.prevEvent.timeStamp)&&(this.prevEvent=t)}_doPhase(t){const{event:e,phase:i,preEnd:n,type:o}=t,{rect:r}=this;r&&"move"===i&&(rectUtils.addEdges(this.edges,r,this.coords.delta[this.interactable.options.deltaSource]),r.width=r.right-r.left,r.height=r.bottom-r.top);if(!1===this._scopeFire("interactions:before-action-"+i,t))return!1;const s=t.iEvent=this._createPreparedEvent(e,i,n,o);return this._scopeFire("interactions:action-"+i,t),"start"===i&&(this.prevEvent=s),this._fireEvent(s),this._scopeFire("interactions:after-action-"+i,t),!0}_now(){return Date.now()}}export{Interaction,PointerInfo,_ProxyMethods,_ProxyValues,Interaction as default}; | ||
//# sourceMappingURL=Interaction.prod.js.map |
@@ -1,10 +0,10 @@ | ||
"use strict"; | ||
/** | ||
* interact.js 1.10.26 | ||
* | ||
* Copyright (c) 2012-present Taye Adeyemi <dev@taye.me> | ||
* Released under the MIT License. | ||
* https://raw.github.com/taye/interact.js/main/LICENSE | ||
*/ | ||
Object.defineProperty(exports, "__esModule", { | ||
value: true | ||
}); | ||
exports.default = void 0; | ||
var dom = _interopRequireWildcard(require("../utils/domUtils.js")); | ||
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); } | ||
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && Object.prototype.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; } | ||
import * as domUtils from "../utils/domUtils.js"; | ||
const finder = { | ||
@@ -22,8 +22,9 @@ methodOrder: ['simulationResume', 'mouseOrPen', 'hasPointer', 'idle'], | ||
// try to resume simulation with a new pointer | ||
simulationResume({ | ||
pointerType, | ||
eventType, | ||
eventTarget, | ||
scope | ||
}) { | ||
simulationResume(_ref) { | ||
let { | ||
pointerType, | ||
eventType, | ||
eventTarget, | ||
scope | ||
} = _ref; | ||
if (!/down|start/i.test(eventType)) { | ||
@@ -40,3 +41,3 @@ return null; | ||
} | ||
element = dom.parentNode(element); | ||
element = domUtils.parentNode(element); | ||
} | ||
@@ -48,8 +49,9 @@ } | ||
// if it's a mouse or pen interaction | ||
mouseOrPen({ | ||
pointerId, | ||
pointerType, | ||
eventType, | ||
scope | ||
}) { | ||
mouseOrPen(_ref2) { | ||
let { | ||
pointerId, | ||
pointerType, | ||
eventType, | ||
scope | ||
} = _ref2; | ||
if (pointerType !== 'mouse' && pointerType !== 'pen') { | ||
@@ -94,6 +96,7 @@ return null; | ||
// get interaction that has this pointer | ||
hasPointer({ | ||
pointerId, | ||
scope | ||
}) { | ||
hasPointer(_ref3) { | ||
let { | ||
pointerId, | ||
scope | ||
} = _ref3; | ||
for (const interaction of scope.interactions.list) { | ||
@@ -107,6 +110,7 @@ if (hasPointerId(interaction, pointerId)) { | ||
// get first idle interaction with a matching pointerType | ||
idle({ | ||
pointerType, | ||
scope | ||
}) { | ||
idle(_ref4) { | ||
let { | ||
pointerType, | ||
scope | ||
} = _ref4; | ||
for (const interaction of scope.interactions.list) { | ||
@@ -134,7 +138,10 @@ // if there's already a pointer held down | ||
function hasPointerId(interaction, pointerId) { | ||
return interaction.pointers.some(({ | ||
id | ||
}) => id === pointerId); | ||
return interaction.pointers.some(_ref5 => { | ||
let { | ||
id | ||
} = _ref5; | ||
return id === pointerId; | ||
}); | ||
} | ||
var _default = exports.default = finder; | ||
//# sourceMappingURL=interactionFinder.js.map | ||
export { finder as default }; | ||
//# sourceMappingURL=interactionFinder.js.map |
@@ -1,2 +0,4 @@ | ||
Object.defineProperty(exports,"__esModule",{value:!0}),exports.default=void 0;var e=((e,n)=>{if(e&&e.__esModule)return e;if(null===e||"object"!=typeof e&&"function"!=typeof e)return{default:e};var r=t(n);if(r&&r.has(e))return r.get(e);var o={__proto__:null},i=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var s in e)if("default"!==s&&Object.prototype.hasOwnProperty.call(e,s)){var u=i?Object.getOwnPropertyDescriptor(e,s):null;u&&(u.get||u.set)?Object.defineProperty(o,s,u):o[s]=e[s]}return o.default=e,r&&r.set(e,o),o})(require("../utils/domUtils.prod.js"));function t(e){if("function"!=typeof WeakMap)return null;var n=new WeakMap,r=new WeakMap;return(t=e=>e?r:n)(e)}const n={methodOrder:["simulationResume","mouseOrPen","hasPointer","idle"],search(e){for(const t of n.methodOrder){const r=n[t](e);if(r)return r}return null},simulationResume({pointerType:t,eventType:n,eventTarget:r,scope:o}){if(!/down|start/i.test(n))return null;for(const n of o.interactions.list){let o=r;if(n.simulation&&n.simulation.allowResume&&n.pointerType===t)for(;o;){if(o===n.element)return n;o=e.parentNode(o)}}return null},mouseOrPen({pointerId:e,pointerType:t,eventType:n,scope:o}){if("mouse"!==t&&"pen"!==t)return null;let i;for(const n of o.interactions.list)if(n.pointerType===t){if(n.simulation&&!r(n,e))continue;if(n.interacting())return n;i||(i=n)}if(i)return i;for(const e of o.interactions.list)if(!(e.pointerType!==t||/down/i.test(n)&&e.simulation))return e;return null},hasPointer({pointerId:e,scope:t}){for(const n of t.interactions.list)if(r(n,e))return n;return null},idle({pointerType:e,scope:t}){for(const n of t.interactions.list){if(1===n.pointers.length){const e=n.interactable;if(e&&(!e.options.gesture||!e.options.gesture.enabled))continue}else if(n.pointers.length>=2)continue;if(!n.interacting()&&e===n.pointerType)return n}return null}};function r(e,t){return e.pointers.some((({id:e})=>e===t))}exports.default=n; | ||
//# sourceMappingURL=interactionFinder.prod.js.map | ||
/* interact.js 1.10.26 | https://raw.github.com/taye/interact.js/main/LICENSE */ | ||
import*as domUtils from"../utils/domUtils.prod.js";const finder={methodOrder:["simulationResume","mouseOrPen","hasPointer","idle"],search(e){for(const t of finder.methodOrder){const n=finder[t](e);if(n)return n}return null},simulationResume(e){let{pointerType:t,eventType:n,eventTarget:i,scope:r}=e;if(!/down|start/i.test(n))return null;for(const e of r.interactions.list){let n=i;if(e.simulation&&e.simulation.allowResume&&e.pointerType===t)for(;n;){if(n===e.element)return e;n=domUtils.parentNode(n)}}return null},mouseOrPen(e){let t,{pointerId:n,pointerType:i,eventType:r,scope:o}=e;if("mouse"!==i&&"pen"!==i)return null;for(const e of o.interactions.list)if(e.pointerType===i){if(e.simulation&&!hasPointerId(e,n))continue;if(e.interacting())return e;t||(t=e)}if(t)return t;for(const e of o.interactions.list)if(!(e.pointerType!==i||/down/i.test(r)&&e.simulation))return e;return null},hasPointer(e){let{pointerId:t,scope:n}=e;for(const e of n.interactions.list)if(hasPointerId(e,t))return e;return null},idle(e){let{pointerType:t,scope:n}=e;for(const e of n.interactions.list){if(1===e.pointers.length){const t=e.interactable;if(t&&(!t.options.gesture||!t.options.gesture.enabled))continue}else if(e.pointers.length>=2)continue;if(!e.interacting()&&t===e.pointerType)return e}return null}};function hasPointerId(e,t){return e.pointers.some((e=>{let{id:n}=e;return n===t}))}export{finder as default}; | ||
//# sourceMappingURL=interactionFinder.prod.js.map |
@@ -1,21 +0,28 @@ | ||
"use strict"; | ||
/** | ||
* interact.js 1.10.26 | ||
* | ||
* Copyright (c) 2012-present Taye Adeyemi <dev@taye.me> | ||
* Released under the MIT License. | ||
* https://raw.github.com/taye/interact.js/main/LICENSE | ||
*/ | ||
Object.defineProperty(exports, "__esModule", { | ||
value: true | ||
}); | ||
exports.default = void 0; | ||
var _browser = _interopRequireDefault(require("../utils/browser.js")); | ||
var _domObjects = _interopRequireDefault(require("../utils/domObjects.js")); | ||
var _domUtils = require("../utils/domUtils.js"); | ||
var pointerUtils = _interopRequireWildcard(require("../utils/pointerUtils.js")); | ||
var _interactablePreventDefault = _interopRequireDefault(require("./interactablePreventDefault")); | ||
var _Interaction = _interopRequireDefault(require("./Interaction")); | ||
var _interactionFinder = _interopRequireDefault(require("./interactionFinder")); | ||
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); } | ||
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && Object.prototype.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; } | ||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } | ||
/* eslint-disable import/no-duplicates -- for typescript module augmentations */ | ||
/* eslint-enable import/no-duplicates */ | ||
import browser from "../utils/browser.js"; | ||
import domObjects from "../utils/domObjects.js"; | ||
import { nodeContains } from "../utils/domUtils.js"; | ||
import * as pointerUtils from "../utils/pointerUtils.js"; | ||
import interactablePreventDefault from './interactablePreventDefault.js'; | ||
import { Interaction } from './Interaction.js'; | ||
import finder from './interactionFinder.js'; | ||
import "../utils/is.js"; | ||
import "../utils/window.js"; | ||
import "../utils/arr.js"; | ||
import "../utils/extend.js"; | ||
import "../utils/hypot.js"; | ||
import "../utils/misc.js"; | ||
import "../utils/rect.js"; | ||
import './InteractEvent.js'; | ||
import "../utils/getOriginXY.js"; | ||
import './BaseEvent.js'; | ||
import './options.js'; | ||
import './PointerInfo.js'; | ||
const methodNames = ['pointerDown', 'pointerMove', 'pointerUp', 'updatePointer', 'removePointer', 'windowBlur']; | ||
@@ -27,5 +34,5 @@ function install(scope) { | ||
} | ||
const pEventTypes = _browser.default.pEventTypes; | ||
const pEventTypes = browser.pEventTypes; | ||
let docEvents; | ||
if (_domObjects.default.PointerEvent) { | ||
if (domObjects.PointerEvent) { | ||
docEvents = [{ | ||
@@ -85,3 +92,3 @@ type: pEventTypes.down, | ||
scope.prevTouchTime = 0; | ||
scope.Interaction = class extends _Interaction.default { | ||
scope.Interaction = class extends Interaction { | ||
get pointerMoveTolerance() { | ||
@@ -119,5 +126,8 @@ return scope.interactions.pointerMoveTolerance; | ||
for (const pointer of interaction.pointers) { | ||
if (!scope.documents.some(({ | ||
doc | ||
}) => (0, _domUtils.nodeContains)(doc, pointer.downTarget))) { | ||
if (!scope.documents.some(_ref => { | ||
let { | ||
doc | ||
} = _ref; | ||
return nodeContains(doc, pointer.downTarget); | ||
})) { | ||
// remove the pointer from the interaction | ||
@@ -129,3 +139,3 @@ interaction.removePointer(pointer.pointer, pointer.event); | ||
} | ||
scope.usePlugin(_interactablePreventDefault.default); | ||
scope.usePlugin(interactablePreventDefault); | ||
} | ||
@@ -160,3 +170,3 @@ function doOnInteractions(method, scope) { | ||
let invalidPointer = false; | ||
if (!_browser.default.supportsPointerEvent && /mouse/.test(event.type)) { | ||
if (!browser.supportsPointerEvent && /mouse/.test(event.type)) { | ||
// ignore mouse events while touch interactions are active | ||
@@ -199,3 +209,3 @@ for (let i = 0; i < interactions.length && !invalidPointer; i++) { | ||
} = searchDetails; | ||
const foundInteraction = _interactionFinder.default.search(searchDetails); | ||
const foundInteraction = finder.search(searchDetails); | ||
const signalArg = { | ||
@@ -210,7 +220,8 @@ interaction: foundInteraction, | ||
} | ||
function onDocSignal({ | ||
doc, | ||
scope, | ||
options | ||
}, eventMethodName) { | ||
function onDocSignal(_ref2, eventMethodName) { | ||
let { | ||
doc, | ||
scope, | ||
options | ||
} = _ref2; | ||
const { | ||
@@ -248,5 +259,6 @@ interactions: { | ||
'scope:remove-document': arg => onDocSignal(arg, 'remove'), | ||
'interactable:unset': ({ | ||
interactable | ||
}, scope) => { | ||
'interactable:unset': (_ref3, scope) => { | ||
let { | ||
interactable | ||
} = _ref3; | ||
// Stop and destroy related interactions when an Interactable is unset | ||
@@ -273,3 +285,3 @@ for (let i = scope.interactions.list.length - 1; i >= 0; i--) { | ||
}; | ||
var _default = exports.default = interactions; | ||
//# sourceMappingURL=interactions.js.map | ||
export { interactions as default }; | ||
//# sourceMappingURL=interactions.js.map |
@@ -1,2 +0,4 @@ | ||
Object.defineProperty(exports,"__esModule",{value:!0}),exports.default=void 0;var e=c(require("../utils/browser.prod.js")),t=c(require("../utils/domObjects.prod.js")),n=require("../utils/domUtils.prod.js"),o=((e,t)=>{if(e&&e.__esModule)return e;if(null===e||"object"!=typeof e&&"function"!=typeof e)return{default:e};var n=p(t);if(n&&n.has(e))return n.get(e);var o={__proto__:null},r=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var i in e)if("default"!==i&&Object.prototype.hasOwnProperty.call(e,i)){var s=r?Object.getOwnPropertyDescriptor(e,i):null;s&&(s.get||s.set)?Object.defineProperty(o,i,s):o[i]=e[i]}return o.default=e,n&&n.set(e,o),o})(require("../utils/pointerUtils.prod.js")),r=c(require("./interactablePreventDefault")),i=c(require("./Interaction")),s=c(require("./interactionFinder"));function p(e){if("function"!=typeof WeakMap)return null;var t=new WeakMap,n=new WeakMap;return(p=e=>e?n:t)(e)}function c(e){return e&&e.__esModule?e:{default:e}}const a=["pointerDown","pointerMove","pointerUp","updatePointer","removePointer","windowBlur"];function l(t,n){return r=>{const i=n.interactions.list,s=o.getPointerType(r),[p,c]=o.getEventTargets(r),a=[];if(/^touch/.test(r.type)){n.prevTouchTime=n.now();for(const e of r.changedTouches){const t=e,i={pointer:t,pointerId:o.getPointerId(t),pointerType:s,eventType:r.type,eventTarget:p,curEventTarget:c,scope:n},l=u(i);a.push([i.pointer,i.eventTarget,i.curEventTarget,l])}}else{let t=!1;if(!e.default.supportsPointerEvent&&/mouse/.test(r.type)){for(let e=0;e<i.length&&!t;e++)t="mouse"!==i[e].pointerType&&i[e].pointerIsDown;t=t||n.now()-n.prevTouchTime<500||0===r.timeStamp}if(!t){const e={pointer:r,pointerId:o.getPointerId(r),pointerType:s,eventType:r.type,curEventTarget:c,eventTarget:p,scope:n},t=u(e);a.push([e.pointer,e.eventTarget,e.curEventTarget,t])}}for(const[e,n,o,i]of a)i[t](e,r,n,o)}}function u(e){const{pointerType:t,scope:n}=e,o={interaction:s.default.search(e),searchDetails:e};return n.fire("interactions:find",o),o.interaction||n.interactions.new({pointerType:t})}function d({doc:e,scope:t,options:n},o){const{interactions:{docEvents:r},events:i}=t,s=i[o];t.browser.isIOS&&!n.events&&(n.events={passive:!1});for(const t in i.delegatedEvents)s(e,t,i.delegateListener),s(e,t,i.delegateUseCapture,!0);const p=n&&n.events;for(const{type:t,listener:n}of r)s(e,t,n,p)}const f={id:"core/interactions",install(o){const s={};for(const e of a)s[e]=l(e,o);const p=e.default.pEventTypes;let c;function u(){for(const e of o.interactions.list)if(e.pointerIsDown&&"touch"===e.pointerType&&!e._interacting)for(const t of e.pointers)o.documents.some((({doc:e})=>(0,n.nodeContains)(e,t.downTarget)))||e.removePointer(t.pointer,t.event)}c=t.default.PointerEvent?[{type:p.down,listener:u},{type:p.down,listener:s.pointerDown},{type:p.move,listener:s.pointerMove},{type:p.up,listener:s.pointerUp},{type:p.cancel,listener:s.pointerUp}]:[{type:"mousedown",listener:s.pointerDown},{type:"mousemove",listener:s.pointerMove},{type:"mouseup",listener:s.pointerUp},{type:"touchstart",listener:u},{type:"touchstart",listener:s.pointerDown},{type:"touchmove",listener:s.pointerMove},{type:"touchend",listener:s.pointerUp},{type:"touchcancel",listener:s.pointerUp}],c.push({type:"blur",listener(e){for(const t of o.interactions.list)t.documentBlur(e)}}),o.prevTouchTime=0,o.Interaction=class extends i.default{get pointerMoveTolerance(){return o.interactions.pointerMoveTolerance}set pointerMoveTolerance(e){o.interactions.pointerMoveTolerance=e}_now(){return o.now()}},o.interactions={list:[],new(e){e.scopeFire=(e,t)=>o.fire(e,t);const t=new o.Interaction(e);return o.interactions.list.push(t),t},listeners:s,docEvents:c,pointerMoveTolerance:1},o.usePlugin(r.default)},listeners:{"scope:add-document":e=>d(e,"add"),"scope:remove-document":e=>d(e,"remove"),"interactable:unset"({interactable:e},t){for(let n=t.interactions.list.length-1;n>=0;n--){const o=t.interactions.list[n];o.interactable===e&&(o.stop(),t.fire("interactions:destroy",{interaction:o}),o.destroy(),t.interactions.list.length>2&&t.interactions.list.splice(n,1))}}},onDocSignal:d,doOnInteractions:l,methodNames:a};exports.default=f; | ||
//# sourceMappingURL=interactions.prod.js.map | ||
/* interact.js 1.10.26 | https://raw.github.com/taye/interact.js/main/LICENSE */ | ||
import browser from"../utils/browser.prod.js";import domObjects from"../utils/domObjects.prod.js";import{nodeContains}from"../utils/domUtils.prod.js";import*as pointerUtils from"../utils/pointerUtils.prod.js";import interactablePreventDefault from"./interactablePreventDefault.prod.js";import{Interaction}from"./Interaction.prod.js";import finder from"./interactionFinder.prod.js";import"../utils/is.prod.js";import"../utils/window.prod.js";import"../utils/arr.prod.js";import"../utils/extend.prod.js";import"../utils/hypot.prod.js";import"../utils/misc.prod.js";import"../utils/rect.prod.js";import"./InteractEvent.prod.js";import"../utils/getOriginXY.prod.js";import"./BaseEvent.prod.js";import"./options.prod.js";import"./PointerInfo.prod.js";const methodNames=["pointerDown","pointerMove","pointerUp","updatePointer","removePointer","windowBlur"];function install(e){const t={};for(const o of methodNames)t[o]=doOnInteractions(o,e);const o=browser.pEventTypes;let n;function r(){for(const t of e.interactions.list)if(t.pointerIsDown&&"touch"===t.pointerType&&!t._interacting)for(const o of t.pointers)e.documents.some((e=>{let{doc:t}=e;return nodeContains(t,o.downTarget)}))||t.removePointer(o.pointer,o.event)}n=domObjects.PointerEvent?[{type:o.down,listener:r},{type:o.down,listener:t.pointerDown},{type:o.move,listener:t.pointerMove},{type:o.up,listener:t.pointerUp},{type:o.cancel,listener:t.pointerUp}]:[{type:"mousedown",listener:t.pointerDown},{type:"mousemove",listener:t.pointerMove},{type:"mouseup",listener:t.pointerUp},{type:"touchstart",listener:r},{type:"touchstart",listener:t.pointerDown},{type:"touchmove",listener:t.pointerMove},{type:"touchend",listener:t.pointerUp},{type:"touchcancel",listener:t.pointerUp}],n.push({type:"blur",listener(t){for(const o of e.interactions.list)o.documentBlur(t)}}),e.prevTouchTime=0,e.Interaction=class extends Interaction{get pointerMoveTolerance(){return e.interactions.pointerMoveTolerance}set pointerMoveTolerance(t){e.interactions.pointerMoveTolerance=t}_now(){return e.now()}},e.interactions={list:[],new(t){t.scopeFire=(t,o)=>e.fire(t,o);const o=new e.Interaction(t);return e.interactions.list.push(o),o},listeners:t,docEvents:n,pointerMoveTolerance:1},e.usePlugin(interactablePreventDefault)}function doOnInteractions(e,t){return function(o){const n=t.interactions.list,r=pointerUtils.getPointerType(o),[i,s]=pointerUtils.getEventTargets(o),p=[];if(/^touch/.test(o.type)){t.prevTouchTime=t.now();for(const e of o.changedTouches){const n=e,c={pointer:n,pointerId:pointerUtils.getPointerId(n),pointerType:r,eventType:o.type,eventTarget:i,curEventTarget:s,scope:t},a=getInteraction(c);p.push([c.pointer,c.eventTarget,c.curEventTarget,a])}}else{let e=!1;if(!browser.supportsPointerEvent&&/mouse/.test(o.type)){for(let t=0;t<n.length&&!e;t++)e="mouse"!==n[t].pointerType&&n[t].pointerIsDown;e=e||t.now()-t.prevTouchTime<500||0===o.timeStamp}if(!e){const e={pointer:o,pointerId:pointerUtils.getPointerId(o),pointerType:r,eventType:o.type,curEventTarget:s,eventTarget:i,scope:t},n=getInteraction(e);p.push([e.pointer,e.eventTarget,e.curEventTarget,n])}}for(const[t,n,r,i]of p)i[e](t,o,n,r)}}function getInteraction(e){const{pointerType:t,scope:o}=e,n={interaction:finder.search(e),searchDetails:e};return o.fire("interactions:find",n),n.interaction||o.interactions.new({pointerType:t})}function onDocSignal(e,t){let{doc:o,scope:n,options:r}=e;const{interactions:{docEvents:i},events:s}=n,p=s[t];n.browser.isIOS&&!r.events&&(r.events={passive:!1});for(const e in s.delegatedEvents)p(o,e,s.delegateListener),p(o,e,s.delegateUseCapture,!0);const c=r&&r.events;for(const{type:e,listener:t}of i)p(o,e,t,c)}const interactions={id:"core/interactions",install:install,listeners:{"scope:add-document"(e){return onDocSignal(e,"add")},"scope:remove-document"(e){return onDocSignal(e,"remove")},"interactable:unset"(e,t){let{interactable:o}=e;for(let e=t.interactions.list.length-1;e>=0;e--){const n=t.interactions.list[e];n.interactable===o&&(n.stop(),t.fire("interactions:destroy",{interaction:n}),n.destroy(),t.interactions.list.length>2&&t.interactions.list.splice(e,1))}}},onDocSignal:onDocSignal,doOnInteractions:doOnInteractions,methodNames:methodNames};export{interactions as default}; | ||
//# sourceMappingURL=interactions.prod.js.map |
@@ -1,16 +0,16 @@ | ||
"use strict"; | ||
/** | ||
* interact.js 1.10.26 | ||
* | ||
* Copyright (c) 2012-present Taye Adeyemi <dev@taye.me> | ||
* Released under the MIT License. | ||
* https://raw.github.com/taye/interact.js/main/LICENSE | ||
*/ | ||
Object.defineProperty(exports, "__esModule", { | ||
value: true | ||
}); | ||
exports.createInteractStatic = createInteractStatic; | ||
var _browser = _interopRequireDefault(require("../utils/browser.js")); | ||
var domUtils = _interopRequireWildcard(require("../utils/domUtils.js")); | ||
var _is = _interopRequireDefault(require("../utils/is.js")); | ||
var _isNonNativeEvent = _interopRequireDefault(require("../utils/isNonNativeEvent.js")); | ||
var _misc = require("../utils/misc.js"); | ||
var pointerUtils = _interopRequireWildcard(require("../utils/pointerUtils.js")); | ||
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); } | ||
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && Object.prototype.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; } | ||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } | ||
import browser from "../utils/browser.js"; | ||
import * as domUtils from "../utils/domUtils.js"; | ||
import is from "../utils/is.js"; | ||
import isNonNativeEvent from "../utils/isNonNativeEvent.js"; | ||
import { warnOnce } from "../utils/misc.js"; | ||
import * as pointerUtils from "../utils/pointerUtils.js"; | ||
/** | ||
@@ -62,3 +62,3 @@ * ```js | ||
// eslint-disable-next-line no-undef | ||
interact.version = "1.10.25"; | ||
interact.version = "1.10.26"; | ||
interact.scope = scope; | ||
@@ -72,7 +72,7 @@ interact.use = function (plugin, options) { | ||
}; | ||
interact.on = (0, _misc.warnOnce)(function on(type, listener, options) { | ||
if (_is.default.string(type) && type.search(' ') !== -1) { | ||
interact.on = warnOnce(function on(type, listener, options) { | ||
if (is.string(type) && type.search(' ') !== -1) { | ||
type = type.trim().split(/ +/); | ||
} | ||
if (_is.default.array(type)) { | ||
if (is.array(type)) { | ||
for (const eventType of type) { | ||
@@ -83,3 +83,3 @@ this.on(eventType, listener, options); | ||
} | ||
if (_is.default.object(type)) { | ||
if (is.object(type)) { | ||
for (const prop in type) { | ||
@@ -92,3 +92,3 @@ this.on(prop, type[prop], listener); | ||
// if it is an InteractEvent type, add listener to globalEvents | ||
if ((0, _isNonNativeEvent.default)(type, this.scope.actions)) { | ||
if (isNonNativeEvent(type, this.scope.actions)) { | ||
// if this type of event was never bound | ||
@@ -109,7 +109,7 @@ if (!this.globalEvents[type]) { | ||
}, 'The interact.on() method is being deprecated'); | ||
interact.off = (0, _misc.warnOnce)(function off(type, listener, options) { | ||
if (_is.default.string(type) && type.search(' ') !== -1) { | ||
interact.off = warnOnce(function off(type, listener, options) { | ||
if (is.string(type) && type.search(' ') !== -1) { | ||
type = type.trim().split(/ +/); | ||
} | ||
if (_is.default.array(type)) { | ||
if (is.array(type)) { | ||
for (const eventType of type) { | ||
@@ -120,3 +120,3 @@ this.off(eventType, listener, options); | ||
} | ||
if (_is.default.object(type)) { | ||
if (is.object(type)) { | ||
for (const prop in type) { | ||
@@ -127,3 +127,3 @@ this.off(prop, type[prop], listener); | ||
} | ||
if ((0, _isNonNativeEvent.default)(type, this.scope.actions)) { | ||
if (isNonNativeEvent(type, this.scope.actions)) { | ||
let index; | ||
@@ -142,6 +142,6 @@ if (type in this.globalEvents && (index = this.globalEvents[type].indexOf(listener)) !== -1) { | ||
interact.supportsTouch = function () { | ||
return _browser.default.supportsTouch; | ||
return browser.supportsTouch; | ||
}; | ||
interact.supportsPointerEvent = function () { | ||
return _browser.default.supportsPointerEvent; | ||
return browser.supportsPointerEvent; | ||
}; | ||
@@ -155,3 +155,3 @@ interact.stop = function () { | ||
interact.pointerMoveTolerance = function (newValue) { | ||
if (_is.default.number(newValue)) { | ||
if (is.number(newValue)) { | ||
this.scope.interactions.pointerMoveTolerance = newValue; | ||
@@ -170,2 +170,3 @@ return this; | ||
} | ||
//# sourceMappingURL=InteractStatic.js.map | ||
export { createInteractStatic }; | ||
//# sourceMappingURL=InteractStatic.js.map |
@@ -1,2 +0,4 @@ | ||
Object.defineProperty(exports,"__esModule",{value:!0}),exports.createInteractStatic=function(i){const c=(e,t)=>{let n=i.interactables.getExisting(e,t);return n||(n=i.interactables.new(e,t),n.events.global=c.globalEvents),n};return c.getPointerAverage=s.pointerAverage,c.getTouchBBox=s.touchBBox,c.getTouchDistance=s.touchDistance,c.getTouchAngle=s.touchAngle,c.getElementRect=t.getElementRect,c.getElementClientRect=t.getElementClientRect,c.matchesSelector=t.matchesSelector,c.closest=t.closest,c.globalEvents={},c.version="1.10.25",c.scope=i,c.use=function(e,t){return this.scope.usePlugin(e,t),this},c.isSet=function(e,t){return!!this.scope.interactables.get(e,t&&t.context)},c.on=(0,r.warnOnce)((function(e,t,r){if(n.default.string(e)&&-1!==e.search(" ")&&(e=e.trim().split(/ +/)),n.default.array(e)){for(const n of e)this.on(n,t,r);return this}if(n.default.object(e)){for(const n in e)this.on(n,e[n],t);return this}return(0,o.default)(e,this.scope.actions)?this.globalEvents[e]?this.globalEvents[e].push(t):this.globalEvents[e]=[t]:this.scope.events.add(this.scope.document,e,t,{options:r}),this}),"The interact.on() method is being deprecated"),c.off=(0,r.warnOnce)((function(e,t,r){if(n.default.string(e)&&-1!==e.search(" ")&&(e=e.trim().split(/ +/)),n.default.array(e)){for(const n of e)this.off(n,t,r);return this}if(n.default.object(e)){for(const n in e)this.off(n,e[n],t);return this}if((0,o.default)(e,this.scope.actions)){let n;e in this.globalEvents&&-1!==(n=this.globalEvents[e].indexOf(t))&&this.globalEvents[e].splice(n,1)}else this.scope.events.remove(this.scope.document,e,t,r);return this}),"The interact.off() method is being deprecated"),c.debug=function(){return this.scope},c.supportsTouch=()=>e.default.supportsTouch,c.supportsPointerEvent=()=>e.default.supportsPointerEvent,c.stop=function(){for(const e of this.scope.interactions.list)e.stop();return this},c.pointerMoveTolerance=function(e){return n.default.number(e)?(this.scope.interactions.pointerMoveTolerance=e,this):this.scope.interactions.pointerMoveTolerance},c.addDocument=function(e,t){this.scope.addDocument(e,t)},c.removeDocument=function(e){this.scope.removeDocument(e)},c};var e=u(require("../utils/browser.prod.js")),t=c(require("../utils/domUtils.prod.js")),n=u(require("../utils/is.prod.js")),o=u(require("../utils/isNonNativeEvent.prod.js")),r=require("../utils/misc.prod.js"),s=c(require("../utils/pointerUtils.prod.js"));function i(e){if("function"!=typeof WeakMap)return null;var t=new WeakMap,n=new WeakMap;return(i=e=>e?n:t)(e)}function c(e,t){if(!t&&e&&e.__esModule)return e;if(null===e||"object"!=typeof e&&"function"!=typeof e)return{default:e};var n=i(t);if(n&&n.has(e))return n.get(e);var o={__proto__:null},r=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var s in e)if("default"!==s&&Object.prototype.hasOwnProperty.call(e,s)){var c=r?Object.getOwnPropertyDescriptor(e,s):null;c&&(c.get||c.set)?Object.defineProperty(o,s,c):o[s]=e[s]}return o.default=e,n&&n.set(e,o),o}function u(e){return e&&e.__esModule?e:{default:e}} | ||
//# sourceMappingURL=InteractStatic.prod.js.map | ||
/* interact.js 1.10.26 | https://raw.github.com/taye/interact.js/main/LICENSE */ | ||
import browser from"../utils/browser.prod.js";import*as domUtils from"../utils/domUtils.prod.js";import is from"../utils/is.prod.js";import isNonNativeEvent from"../utils/isNonNativeEvent.prod.js";import{warnOnce}from"../utils/misc.prod.js";import*as pointerUtils from"../utils/pointerUtils.prod.js";function createInteractStatic(t){const e=(s,o)=>{let i=t.interactables.getExisting(s,o);return i||(i=t.interactables.new(s,o),i.events.global=e.globalEvents),i};return e.getPointerAverage=pointerUtils.pointerAverage,e.getTouchBBox=pointerUtils.touchBBox,e.getTouchDistance=pointerUtils.touchDistance,e.getTouchAngle=pointerUtils.touchAngle,e.getElementRect=domUtils.getElementRect,e.getElementClientRect=domUtils.getElementClientRect,e.matchesSelector=domUtils.matchesSelector,e.closest=domUtils.closest,e.globalEvents={},e.version="1.10.26",e.scope=t,e.use=function(t,e){return this.scope.usePlugin(t,e),this},e.isSet=function(t,e){return!!this.scope.interactables.get(t,e&&e.context)},e.on=warnOnce((function(t,e,s){if(is.string(t)&&-1!==t.search(" ")&&(t=t.trim().split(/ +/)),is.array(t)){for(const o of t)this.on(o,e,s);return this}if(is.object(t)){for(const s in t)this.on(s,t[s],e);return this}return isNonNativeEvent(t,this.scope.actions)?this.globalEvents[t]?this.globalEvents[t].push(e):this.globalEvents[t]=[e]:this.scope.events.add(this.scope.document,t,e,{options:s}),this}),"The interact.on() method is being deprecated"),e.off=warnOnce((function(t,e,s){if(is.string(t)&&-1!==t.search(" ")&&(t=t.trim().split(/ +/)),is.array(t)){for(const o of t)this.off(o,e,s);return this}if(is.object(t)){for(const s in t)this.off(s,t[s],e);return this}if(isNonNativeEvent(t,this.scope.actions)){let s;t in this.globalEvents&&-1!==(s=this.globalEvents[t].indexOf(e))&&this.globalEvents[t].splice(s,1)}else this.scope.events.remove(this.scope.document,t,e,s);return this}),"The interact.off() method is being deprecated"),e.debug=function(){return this.scope},e.supportsTouch=function(){return browser.supportsTouch},e.supportsPointerEvent=function(){return browser.supportsPointerEvent},e.stop=function(){for(const t of this.scope.interactions.list)t.stop();return this},e.pointerMoveTolerance=function(t){return is.number(t)?(this.scope.interactions.pointerMoveTolerance=t,this):this.scope.interactions.pointerMoveTolerance},e.addDocument=function(t,e){this.scope.addDocument(t,e)},e.removeDocument=function(t){this.scope.removeDocument(t)},e}export{createInteractStatic}; | ||
//# sourceMappingURL=InteractStatic.prod.js.map |
@@ -1,8 +0,11 @@ | ||
"use strict"; | ||
/** | ||
* interact.js 1.10.26 | ||
* | ||
* Copyright (c) 2012-present Taye Adeyemi <dev@taye.me> | ||
* Released under the MIT License. | ||
* https://raw.github.com/taye/interact.js/main/LICENSE | ||
*/ | ||
Object.defineProperty(exports, "__esModule", { | ||
value: true | ||
}); | ||
exports.NativePointerEvent = void 0; | ||
const NativePointerEvent = exports.NativePointerEvent = null; | ||
//# sourceMappingURL=NativeTypes.js.map | ||
const NativePointerEvent = null; | ||
export { NativePointerEvent }; | ||
//# sourceMappingURL=NativeTypes.js.map |
@@ -1,2 +0,4 @@ | ||
Object.defineProperty(exports,"__esModule",{value:!0}),exports.NativePointerEvent=void 0,exports.NativePointerEvent=null; | ||
//# sourceMappingURL=NativeTypes.prod.js.map | ||
/* interact.js 1.10.26 | https://raw.github.com/taye/interact.js/main/LICENSE */ | ||
const NativePointerEvent=null;export{NativePointerEvent}; | ||
//# sourceMappingURL=NativeTypes.prod.js.map |
@@ -1,10 +0,12 @@ | ||
"use strict"; | ||
/** | ||
* interact.js 1.10.26 | ||
* | ||
* Copyright (c) 2012-present Taye Adeyemi <dev@taye.me> | ||
* Released under the MIT License. | ||
* https://raw.github.com/taye/interact.js/main/LICENSE | ||
*/ | ||
Object.defineProperty(exports, "__esModule", { | ||
value: true | ||
}); | ||
exports.defaults = void 0; | ||
// eslint-disable-next-line @typescript-eslint/no-empty-interface | ||
const defaults = exports.defaults = { | ||
const defaults = { | ||
base: { | ||
@@ -23,2 +25,3 @@ preventDefault: 'auto', | ||
}; | ||
//# sourceMappingURL=options.js.map | ||
export { defaults }; | ||
//# sourceMappingURL=options.js.map |
@@ -1,2 +0,4 @@ | ||
Object.defineProperty(exports,"__esModule",{value:!0}),exports.defaults=void 0,exports.defaults={base:{preventDefault:"auto",deltaSource:"page"},perAction:{enabled:!1,origin:{x:0,y:0}},actions:{}}; | ||
//# sourceMappingURL=options.prod.js.map | ||
/* interact.js 1.10.26 | https://raw.github.com/taye/interact.js/main/LICENSE */ | ||
const defaults={base:{preventDefault:"auto",deltaSource:"page"},perAction:{enabled:!1,origin:{x:0,y:0}},actions:{}};export{defaults}; | ||
//# sourceMappingURL=options.prod.js.map |
{ | ||
"name": "@interactjs/core", | ||
"version": "1.10.25", | ||
"version": "1.10.26", | ||
"main": "index", | ||
@@ -13,3 +13,3 @@ "module": "index", | ||
"peerDependencies": { | ||
"@interactjs/utils": "1.10.25" | ||
"@interactjs/utils": "1.10.26" | ||
}, | ||
@@ -24,3 +24,3 @@ "publishConfig": { | ||
"license": "MIT", | ||
"gitHead": "ee3c52c4" | ||
"gitHead": "6e7a136f" | ||
} |
@@ -1,14 +0,16 @@ | ||
"use strict"; | ||
/** | ||
* interact.js 1.10.26 | ||
* | ||
* Copyright (c) 2012-present Taye Adeyemi <dev@taye.me> | ||
* Released under the MIT License. | ||
* https://raw.github.com/taye/interact.js/main/LICENSE | ||
*/ | ||
Object.defineProperty(exports, "__esModule", { | ||
value: true | ||
}); | ||
exports.PointerInfo = void 0; | ||
class PointerInfo { | ||
id; | ||
pointer; | ||
event; | ||
downTime; | ||
downTarget; | ||
constructor(id, pointer, event, downTime, downTarget) { | ||
this.id = void 0; | ||
this.pointer = void 0; | ||
this.event = void 0; | ||
this.downTime = void 0; | ||
this.downTarget = void 0; | ||
this.id = id; | ||
@@ -21,3 +23,3 @@ this.pointer = pointer; | ||
} | ||
exports.PointerInfo = PointerInfo; | ||
//# sourceMappingURL=PointerInfo.js.map | ||
export { PointerInfo }; | ||
//# sourceMappingURL=PointerInfo.js.map |
@@ -1,2 +0,4 @@ | ||
Object.defineProperty(exports,"__esModule",{value:!0}),exports.PointerInfo=void 0,exports.PointerInfo=class{id;pointer;event;downTime;downTarget;constructor(e,t,o,i,n){this.id=e,this.pointer=t,this.event=o,this.downTime=i,this.downTarget=n}}; | ||
//# sourceMappingURL=PointerInfo.prod.js.map | ||
/* interact.js 1.10.26 | https://raw.github.com/taye/interact.js/main/LICENSE */ | ||
class PointerInfo{constructor(i,t,o,e,n){this.id=void 0,this.pointer=void 0,this.event=void 0,this.downTime=void 0,this.downTarget=void 0,this.id=i,this.pointer=t,this.event=o,this.downTime=e,this.downTarget=n}}export{PointerInfo}; | ||
//# sourceMappingURL=PointerInfo.prod.js.map |
154
scope.js
@@ -1,30 +0,40 @@ | ||
"use strict"; | ||
/** | ||
* interact.js 1.10.26 | ||
* | ||
* Copyright (c) 2012-present Taye Adeyemi <dev@taye.me> | ||
* Released under the MIT License. | ||
* https://raw.github.com/taye/interact.js/main/LICENSE | ||
*/ | ||
Object.defineProperty(exports, "__esModule", { | ||
value: true | ||
}); | ||
exports.Scope = void 0; | ||
exports.initScope = initScope; | ||
var _browser = _interopRequireDefault(require("../utils/browser.js")); | ||
var _clone = _interopRequireDefault(require("../utils/clone.js")); | ||
var _domObjects = _interopRequireDefault(require("../utils/domObjects.js")); | ||
var _extend = _interopRequireDefault(require("../utils/extend.js")); | ||
var _is = _interopRequireDefault(require("../utils/is.js")); | ||
var _raf = _interopRequireDefault(require("../utils/raf.js")); | ||
var win = _interopRequireWildcard(require("../utils/window.js")); | ||
var _Eventable = require("./Eventable"); | ||
var _events = _interopRequireDefault(require("./events")); | ||
var _interactions = _interopRequireDefault(require("./interactions")); | ||
var _Interactable = require("./Interactable"); | ||
var _InteractableSet = require("./InteractableSet"); | ||
var _InteractEvent = require("./InteractEvent"); | ||
var _InteractStatic = require("./InteractStatic"); | ||
var _options = require("./options"); | ||
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); } | ||
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && Object.prototype.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; } | ||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } | ||
/* eslint-disable import/no-duplicates -- for typescript module augmentations */ | ||
import browser from "../utils/browser.js"; | ||
import clone from "../utils/clone.js"; | ||
import domObjects from "../utils/domObjects.js"; | ||
import extend from "../utils/extend.js"; | ||
import is from "../utils/is.js"; | ||
import raf from "../utils/raf.js"; | ||
import * as win from "../utils/window.js"; | ||
import { Eventable } from './Eventable.js'; | ||
import events from './events.js'; | ||
import interactions from './interactions.js'; | ||
import { Interactable } from './Interactable.js'; | ||
import { InteractableSet } from './InteractableSet.js'; | ||
import { InteractEvent } from './InteractEvent.js'; | ||
import { createInteractStatic } from './InteractStatic.js'; | ||
import { defaults } from './options.js'; | ||
import "../utils/arr.js"; | ||
import "../utils/normalizeListeners.js"; | ||
import "../utils/domUtils.js"; | ||
import "../utils/pointerExtend.js"; | ||
import "../utils/pointerUtils.js"; | ||
import './interactablePreventDefault.js'; | ||
import './Interaction.js'; | ||
import "../utils/hypot.js"; | ||
import "../utils/misc.js"; | ||
import "../utils/rect.js"; | ||
import './PointerInfo.js'; | ||
import './interactionFinder.js'; | ||
import "../utils/isNonNativeEvent.js"; | ||
import "../utils/getOriginXY.js"; | ||
import './BaseEvent.js'; | ||
/* eslint-enable import/no-duplicates */ | ||
/** @internal */ | ||
@@ -34,41 +44,38 @@ | ||
class Scope { | ||
id = `__interact_scope_${Math.floor(Math.random() * 100)}`; | ||
isInitialized = false; | ||
listenerMaps = []; | ||
browser = _browser.default; | ||
defaults = (0, _clone.default)(_options.defaults); | ||
Eventable = _Eventable.Eventable; | ||
actions = { | ||
map: {}, | ||
phases: { | ||
start: true, | ||
move: true, | ||
end: true | ||
}, | ||
methodDict: {}, | ||
phaselessTypes: {} | ||
}; | ||
interactStatic = (0, _InteractStatic.createInteractStatic)(this); | ||
InteractEvent = _InteractEvent.InteractEvent; | ||
Interactable; | ||
interactables = new _InteractableSet.InteractableSet(this); | ||
// main window | ||
_win; | ||
// main document | ||
document; | ||
// main window | ||
window; | ||
// all documents being listened to | ||
documents = []; | ||
_plugins = { | ||
list: [], | ||
map: {} | ||
}; | ||
constructor() { | ||
this.id = `__interact_scope_${Math.floor(Math.random() * 100)}`; | ||
this.isInitialized = false; | ||
this.listenerMaps = []; | ||
this.browser = browser; | ||
this.defaults = clone(defaults); | ||
this.Eventable = Eventable; | ||
this.actions = { | ||
map: {}, | ||
phases: { | ||
start: true, | ||
move: true, | ||
end: true | ||
}, | ||
methodDict: {}, | ||
phaselessTypes: {} | ||
}; | ||
this.interactStatic = createInteractStatic(this); | ||
this.InteractEvent = InteractEvent; | ||
this.Interactable = void 0; | ||
this.interactables = new InteractableSet(this); | ||
// main window | ||
this._win = void 0; | ||
// main document | ||
this.document = void 0; | ||
// main window | ||
this.window = void 0; | ||
// all documents being listened to | ||
this.documents = []; | ||
this._plugins = { | ||
list: [], | ||
map: {} | ||
}; | ||
this.onWindowUnload = event => this.removeDocument(event.target); | ||
const scope = this; | ||
this.Interactable = class extends _Interactable.Interactable { | ||
this.Interactable = class extends Interactable { | ||
get _defaults() { | ||
@@ -113,3 +120,2 @@ return scope.defaults; | ||
} | ||
onWindowUnload = event => this.removeDocument(event.target); | ||
init(window) { | ||
@@ -170,3 +176,3 @@ return this.isInitialized ? this : initScope(this, window); | ||
const window = win.getWindow(doc); | ||
options = options ? (0, _extend.default)({}, options) : {}; | ||
options = options ? extend({}, options) : {}; | ||
this.documents.push({ | ||
@@ -222,11 +228,10 @@ doc, | ||
/** @internal */ | ||
exports.Scope = Scope; | ||
function initScope(scope, window) { | ||
scope.isInitialized = true; | ||
if (_is.default.window(window)) { | ||
if (is.window(window)) { | ||
win.init(window); | ||
} | ||
_domObjects.default.init(window); | ||
_browser.default.init(window); | ||
_raf.default.init(window); | ||
domObjects.init(window); | ||
browser.init(window); | ||
raf.init(window); | ||
@@ -236,4 +241,4 @@ // @ts-expect-error | ||
scope.document = window.document; | ||
scope.usePlugin(_interactions.default); | ||
scope.usePlugin(_events.default); | ||
scope.usePlugin(interactions); | ||
scope.usePlugin(events); | ||
return scope; | ||
@@ -244,2 +249,3 @@ } | ||
} | ||
//# sourceMappingURL=scope.js.map | ||
export { Scope, initScope }; | ||
//# sourceMappingURL=scope.js.map |
@@ -1,2 +0,4 @@ | ||
Object.defineProperty(exports,"__esModule",{value:!0}),exports.Scope=void 0,exports.initScope=b;var e=w(require("../utils/browser.prod.js")),t=w(require("../utils/clone.prod.js")),i=w(require("../utils/domObjects.prod.js")),s=w(require("../utils/extend.prod.js")),n=w(require("../utils/is.prod.js")),r=w(require("../utils/raf.prod.js")),o=((e,t)=>{if(e&&e.__esModule)return e;if(null===e||"object"!=typeof e&&"function"!=typeof e)return{default:e};var i=m(t);if(i&&i.has(e))return i.get(e);var s={__proto__:null},n=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var r in e)if("default"!==r&&Object.prototype.hasOwnProperty.call(e,r)){var o=n?Object.getOwnPropertyDescriptor(e,r):null;o&&(o.get||o.set)?Object.defineProperty(s,r,o):s[r]=e[r]}return s.default=e,i&&i.set(e,s),s})(require("../utils/window.prod.js")),a=require("./Eventable"),u=w(require("./events")),l=w(require("./interactions")),d=require("./Interactable"),c=require("./InteractableSet"),p=require("./InteractEvent"),h=require("./InteractStatic"),f=require("./options");function m(e){if("function"!=typeof WeakMap)return null;var t=new WeakMap,i=new WeakMap;return(m=e=>e?i:t)(e)}function w(e){return e&&e.__esModule?e:{default:e}}function b(t,s){return t.isInitialized=!0,n.default.window(s)&&o.init(s),i.default.init(s),e.default.init(s),r.default.init(s),t.window=s,t.document=s.document,t.usePlugin(l.default),t.usePlugin(u.default),t}function g(e){return e&&e.replace(/\/.*$/,"")}exports.Scope=class{id="__interact_scope_"+Math.floor(100*Math.random());isInitialized=!1;listenerMaps=[];browser=e.default;defaults=(0,t.default)(f.defaults);Eventable=a.Eventable;actions={map:{},phases:{start:!0,move:!0,end:!0},methodDict:{},phaselessTypes:{}};interactStatic=(0,h.createInteractStatic)(this);InteractEvent=p.InteractEvent;Interactable;interactables=new c.InteractableSet(this);_win;document;window;documents=[];_plugins={list:[],map:{}};constructor(){const e=this;this.Interactable=class extends d.Interactable{get _defaults(){return e.defaults}set(t){return super.set(t),e.fire("interactable:set",{options:t,interactable:this}),this}unset(){super.unset();const t=e.interactables.list.indexOf(this);t<0||(e.interactables.list.splice(t,1),e.fire("interactable:unset",{interactable:this}))}}}addListeners(e,t){this.listenerMaps.push({id:t,map:e})}fire(e,t){for(const{map:{[e]:i}}of this.listenerMaps)if(i&&!1===i(t,this,e))return!1}onWindowUnload=e=>this.removeDocument(e.target);init(e){return this.isInitialized?this:b(this,e)}pluginIsInstalled(e){const{id:t}=e;return t?!!this._plugins.map[t]:-1!==this._plugins.list.indexOf(e)}usePlugin(e,t){if(!this.isInitialized)return this;if(this.pluginIsInstalled(e))return this;if(e.id&&(this._plugins.map[e.id]=e),this._plugins.list.push(e),e.install&&e.install(this,t),e.listeners&&e.before){let t=0;const i=this.listenerMaps.length,s=e.before.reduce(((e,t)=>(e[t]=!0,e[g(t)]=!0,e)),{});for(;t<i;t++){const e=this.listenerMaps[t].id;if(e&&(s[e]||s[g(e)]))break}this.listenerMaps.splice(t,0,{id:e.id,map:e.listeners})}else e.listeners&&this.listenerMaps.push({id:e.id,map:e.listeners});return this}addDocument(e,t){if(-1!==this.getDocIndex(e))return!1;const i=o.getWindow(e);t=t?(0,s.default)({},t):{},this.documents.push({doc:e,options:t}),this.events.documents.push(e),e!==this.document&&this.events.add(i,"unload",this.onWindowUnload),this.fire("scope:add-document",{doc:e,window:i,scope:this,options:t})}removeDocument(e){const t=this.getDocIndex(e),i=o.getWindow(e),s=this.documents[t].options;this.events.remove(i,"unload",this.onWindowUnload),this.documents.splice(t,1),this.events.documents.splice(t,1),this.fire("scope:remove-document",{doc:e,window:i,scope:this,options:s})}getDocIndex(e){for(let t=0;t<this.documents.length;t++)if(this.documents[t].doc===e)return t;return-1}getDocOptions(e){const t=this.getDocIndex(e);return-1===t?null:this.documents[t].options}now(){return(this.window.Date||Date).now()}}; | ||
//# sourceMappingURL=scope.prod.js.map | ||
/* interact.js 1.10.26 | https://raw.github.com/taye/interact.js/main/LICENSE */ | ||
import browser from"../utils/browser.prod.js";import clone from"../utils/clone.prod.js";import domObjects from"../utils/domObjects.prod.js";import extend from"../utils/extend.prod.js";import is from"../utils/is.prod.js";import raf from"../utils/raf.prod.js";import*as win from"../utils/window.prod.js";import{Eventable}from"./Eventable.prod.js";import events from"./events.prod.js";import interactions from"./interactions.prod.js";import{Interactable}from"./Interactable.prod.js";import{InteractableSet}from"./InteractableSet.prod.js";import{InteractEvent}from"./InteractEvent.prod.js";import{createInteractStatic}from"./InteractStatic.prod.js";import{defaults}from"./options.prod.js";import"../utils/arr.prod.js";import"../utils/normalizeListeners.prod.js";import"../utils/domUtils.prod.js";import"../utils/pointerExtend.prod.js";import"../utils/pointerUtils.prod.js";import"./interactablePreventDefault.prod.js";import"./Interaction.prod.js";import"../utils/hypot.prod.js";import"../utils/misc.prod.js";import"../utils/rect.prod.js";import"./PointerInfo.prod.js";import"./interactionFinder.prod.js";import"../utils/isNonNativeEvent.prod.js";import"../utils/getOriginXY.prod.js";import"./BaseEvent.prod.js";class Scope{constructor(){this.id="__interact_scope_"+Math.floor(100*Math.random()),this.isInitialized=!1,this.listenerMaps=[],this.browser=browser,this.defaults=clone(defaults),this.Eventable=Eventable,this.actions={map:{},phases:{start:!0,move:!0,end:!0},methodDict:{},phaselessTypes:{}},this.interactStatic=createInteractStatic(this),this.InteractEvent=InteractEvent,this.Interactable=void 0,this.interactables=new InteractableSet(this),this._win=void 0,this.document=void 0,this.window=void 0,this.documents=[],this._plugins={list:[],map:{}},this.onWindowUnload=t=>this.removeDocument(t.target);const t=this;this.Interactable=class extends Interactable{get _defaults(){return t.defaults}set(i){return super.set(i),t.fire("interactable:set",{options:i,interactable:this}),this}unset(){super.unset();const i=t.interactables.list.indexOf(this);i<0||(t.interactables.list.splice(i,1),t.fire("interactable:unset",{interactable:this}))}}}addListeners(t,i){this.listenerMaps.push({id:i,map:t})}fire(t,i){for(const{map:{[t]:e}}of this.listenerMaps)if(e&&!1===e(i,this,t))return!1}init(t){return this.isInitialized?this:initScope(this,t)}pluginIsInstalled(t){const{id:i}=t;return i?!!this._plugins.map[i]:-1!==this._plugins.list.indexOf(t)}usePlugin(t,i){if(!this.isInitialized)return this;if(this.pluginIsInstalled(t))return this;if(t.id&&(this._plugins.map[t.id]=t),this._plugins.list.push(t),t.install&&t.install(this,i),t.listeners&&t.before){let i=0;const e=this.listenerMaps.length,s=t.before.reduce(((t,i)=>(t[i]=!0,t[pluginIdRoot(i)]=!0,t)),{});for(;i<e;i++){const t=this.listenerMaps[i].id;if(t&&(s[t]||s[pluginIdRoot(t)]))break}this.listenerMaps.splice(i,0,{id:t.id,map:t.listeners})}else t.listeners&&this.listenerMaps.push({id:t.id,map:t.listeners});return this}addDocument(t,i){if(-1!==this.getDocIndex(t))return!1;const e=win.getWindow(t);i=i?extend({},i):{},this.documents.push({doc:t,options:i}),this.events.documents.push(t),t!==this.document&&this.events.add(e,"unload",this.onWindowUnload),this.fire("scope:add-document",{doc:t,window:e,scope:this,options:i})}removeDocument(t){const i=this.getDocIndex(t),e=win.getWindow(t),s=this.documents[i].options;this.events.remove(e,"unload",this.onWindowUnload),this.documents.splice(i,1),this.events.documents.splice(i,1),this.fire("scope:remove-document",{doc:t,window:e,scope:this,options:s})}getDocIndex(t){for(let i=0;i<this.documents.length;i++)if(this.documents[i].doc===t)return i;return-1}getDocOptions(t){const i=this.getDocIndex(t);return-1===i?null:this.documents[i].options}now(){return(this.window.Date||Date).now()}}function initScope(t,i){return t.isInitialized=!0,is.window(i)&&win.init(i),domObjects.init(i),browser.init(i),raf.init(i),t.window=i,t.document=i.document,t.usePlugin(interactions),t.usePlugin(events),t}function pluginIdRoot(t){return t&&t.replace(/\/.*$/,"")}export{Scope,initScope}; | ||
//# sourceMappingURL=scope.prod.js.map |
14
types.js
@@ -1,6 +0,8 @@ | ||
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { | ||
value: true | ||
}); | ||
//# sourceMappingURL=types.js.map | ||
/** | ||
* interact.js 1.10.26 | ||
* | ||
* Copyright (c) 2012-present Taye Adeyemi <dev@taye.me> | ||
* Released under the MIT License. | ||
* https://raw.github.com/taye/interact.js/main/LICENSE | ||
*/ | ||
//# sourceMappingURL=types.js.map |
@@ -1,2 +0,3 @@ | ||
Object.defineProperty(exports,"__esModule",{value:!0}); | ||
//# sourceMappingURL=types.prod.js.map | ||
/* interact.js 1.10.26 | https://raw.github.com/taye/interact.js/main/LICENSE */ | ||
//# sourceMappingURL=types.prod.js.map |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Minified code
QualityThis package contains minified code. This may be harmless in some cases where minified code is included in packaged libraries, however packages on npm should not minify code.
Found 1 instance in 1 package
3575
1
456565