@interactjs/core
Advanced tools
Comparing version 1.10.26 to 1.10.27
@@ -23,4 +23,4 @@ import type { Interactable } from '@interactjs/core/Interactable'; | ||
} | ||
export interface BaseEvent<T extends ActionName> { | ||
export interface BaseEvent<T extends ActionName | null = never> { | ||
interaction: InteractionProxy<T>; | ||
} |
/** | ||
* interact.js 1.10.26 | ||
* interact.js 1.10.27 | ||
* | ||
@@ -4,0 +4,0 @@ * Copyright (c) 2012-present Taye Adeyemi <dev@taye.me> |
@@ -1,4 +0,4 @@ | ||
/* interact.js 1.10.26 | https://raw.github.com/taye/interact.js/main/LICENSE */ | ||
/* interact.js 1.10.27 | 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 |
/** | ||
* interact.js 1.10.26 | ||
* interact.js 1.10.27 | ||
* | ||
@@ -4,0 +4,0 @@ * Copyright (c) 2012-present Taye Adeyemi <dev@taye.me> |
@@ -1,4 +0,4 @@ | ||
/* interact.js 1.10.26 | https://raw.github.com/taye/interact.js/main/LICENSE */ | ||
/* interact.js 1.10.27 | 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 |
/** | ||
* interact.js 1.10.26 | ||
* interact.js 1.10.27 | ||
* | ||
@@ -4,0 +4,0 @@ * Copyright (c) 2012-present Taye Adeyemi <dev@taye.me> |
@@ -1,4 +0,4 @@ | ||
/* interact.js 1.10.26 | https://raw.github.com/taye/interact.js/main/LICENSE */ | ||
/* interact.js 1.10.27 | 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 |
/** | ||
* interact.js 1.10.26 | ||
* interact.js 1.10.27 | ||
* | ||
@@ -4,0 +4,0 @@ * Copyright (c) 2012-present Taye Adeyemi <dev@taye.me> |
@@ -1,4 +0,4 @@ | ||
/* interact.js 1.10.26 | https://raw.github.com/taye/interact.js/main/LICENSE */ | ||
/* interact.js 1.10.27 | 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 |
/** | ||
* interact.js 1.10.26 | ||
* interact.js 1.10.27 | ||
* | ||
@@ -4,0 +4,0 @@ * Copyright (c) 2012-present Taye Adeyemi <dev@taye.me> |
@@ -1,4 +0,4 @@ | ||
/* interact.js 1.10.26 | https://raw.github.com/taye/interact.js/main/LICENSE */ | ||
/* interact.js 1.10.27 | 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 |
/** | ||
* interact.js 1.10.26 | ||
* interact.js 1.10.27 | ||
* | ||
@@ -4,0 +4,0 @@ * Copyright (c) 2012-present Taye Adeyemi <dev@taye.me> |
@@ -1,4 +0,4 @@ | ||
/* interact.js 1.10.26 | https://raw.github.com/taye/interact.js/main/LICENSE */ | ||
/* interact.js 1.10.27 | 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 |
/** | ||
* interact.js 1.10.26 | ||
* interact.js 1.10.27 | ||
* | ||
@@ -4,0 +4,0 @@ * Copyright (c) 2012-present Taye Adeyemi <dev@taye.me> |
@@ -1,4 +0,4 @@ | ||
/* interact.js 1.10.26 | https://raw.github.com/taye/interact.js/main/LICENSE */ | ||
/* interact.js 1.10.27 | 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 |
@@ -84,3 +84,3 @@ import type { Element, PointerEventType, PointerType, FullRect, CoordsSet, ActionName, ActionProps } from '@interactjs/core/types'; | ||
} | ||
export type InteractionProxy<T extends ActionName | null = never> = Pick<Interaction<T>, keyof typeof _ProxyValues | keyof typeof _ProxyMethods>; | ||
export type InteractionProxy<T extends ActionName | null = never> = Pick<Interaction<T>, Exclude<keyof typeof _ProxyValues | keyof typeof _ProxyMethods, '_proxy'>>; | ||
export declare class Interaction<T extends ActionName | null = ActionName> { | ||
@@ -87,0 +87,0 @@ /** current interactable being interacted with */ |
/** | ||
* interact.js 1.10.26 | ||
* interact.js 1.10.27 | ||
* | ||
@@ -4,0 +4,0 @@ * Copyright (c) 2012-present Taye Adeyemi <dev@taye.me> |
@@ -1,4 +0,4 @@ | ||
/* interact.js 1.10.26 | https://raw.github.com/taye/interact.js/main/LICENSE */ | ||
/* interact.js 1.10.27 | 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 |
/** | ||
* interact.js 1.10.26 | ||
* interact.js 1.10.27 | ||
* | ||
@@ -4,0 +4,0 @@ * Copyright (c) 2012-present Taye Adeyemi <dev@taye.me> |
@@ -1,4 +0,4 @@ | ||
/* interact.js 1.10.26 | https://raw.github.com/taye/interact.js/main/LICENSE */ | ||
/* interact.js 1.10.27 | 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 |
/** | ||
* interact.js 1.10.26 | ||
* interact.js 1.10.27 | ||
* | ||
@@ -4,0 +4,0 @@ * Copyright (c) 2012-present Taye Adeyemi <dev@taye.me> |
@@ -1,4 +0,4 @@ | ||
/* interact.js 1.10.26 | https://raw.github.com/taye/interact.js/main/LICENSE */ | ||
/* interact.js 1.10.27 | 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 |
/** | ||
* interact.js 1.10.26 | ||
* interact.js 1.10.27 | ||
* | ||
@@ -62,3 +62,3 @@ * Copyright (c) 2012-present Taye Adeyemi <dev@taye.me> | ||
// eslint-disable-next-line no-undef | ||
interact.version = "1.10.26"; | ||
interact.version = "1.10.27"; | ||
interact.scope = scope; | ||
@@ -65,0 +65,0 @@ interact.use = function (plugin, options) { |
@@ -1,4 +0,4 @@ | ||
/* interact.js 1.10.26 | https://raw.github.com/taye/interact.js/main/LICENSE */ | ||
/* interact.js 1.10.27 | 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}; | ||
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.27",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 |
/** | ||
* interact.js 1.10.26 | ||
* interact.js 1.10.27 | ||
* | ||
@@ -4,0 +4,0 @@ * Copyright (c) 2012-present Taye Adeyemi <dev@taye.me> |
@@ -1,4 +0,4 @@ | ||
/* interact.js 1.10.26 | https://raw.github.com/taye/interact.js/main/LICENSE */ | ||
/* interact.js 1.10.27 | https://raw.github.com/taye/interact.js/main/LICENSE */ | ||
const NativePointerEvent=null;export{NativePointerEvent}; | ||
//# sourceMappingURL=NativeTypes.prod.js.map |
/** | ||
* interact.js 1.10.26 | ||
* interact.js 1.10.27 | ||
* | ||
@@ -4,0 +4,0 @@ * Copyright (c) 2012-present Taye Adeyemi <dev@taye.me> |
@@ -1,4 +0,4 @@ | ||
/* interact.js 1.10.26 | https://raw.github.com/taye/interact.js/main/LICENSE */ | ||
/* interact.js 1.10.27 | 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.26", | ||
"version": "1.10.27", | ||
"main": "index", | ||
@@ -13,3 +13,3 @@ "module": "index", | ||
"peerDependencies": { | ||
"@interactjs/utils": "1.10.26" | ||
"@interactjs/utils": "1.10.27" | ||
}, | ||
@@ -24,3 +24,3 @@ "publishConfig": { | ||
"license": "MIT", | ||
"gitHead": "6e7a136f" | ||
"gitHead": "3ace1cad" | ||
} |
/** | ||
* interact.js 1.10.26 | ||
* interact.js 1.10.27 | ||
* | ||
@@ -4,0 +4,0 @@ * Copyright (c) 2012-present Taye Adeyemi <dev@taye.me> |
@@ -1,4 +0,4 @@ | ||
/* interact.js 1.10.26 | https://raw.github.com/taye/interact.js/main/LICENSE */ | ||
/* interact.js 1.10.27 | 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 |
@@ -31,2 +31,12 @@ import type Interaction from '@interactjs/core/Interaction'; | ||
} | ||
export interface Plugin { | ||
[key: string]: any; | ||
id?: string; | ||
listeners?: ListenerMap; | ||
before?: string[]; | ||
install?(scope: Scope, options?: any): void; | ||
} | ||
export interface Scope { | ||
fire<T extends ListenerName>(name: T, arg: SignalArgs[T]): void | false; | ||
} | ||
export {}; |
/** | ||
* interact.js 1.10.26 | ||
* interact.js 1.10.27 | ||
* | ||
@@ -41,4 +41,2 @@ * Copyright (c) 2012-present Taye Adeyemi <dev@taye.me> | ||
/** @internal */ | ||
/** @internal */ | ||
class Scope { | ||
@@ -225,2 +223,4 @@ constructor() { | ||
// Keep Scope class internal, but expose minimal interface to avoid broken types when Scope is stripped out | ||
/** @internal */ | ||
@@ -227,0 +227,0 @@ function initScope(scope, window) { |
@@ -1,4 +0,4 @@ | ||
/* interact.js 1.10.26 | https://raw.github.com/taye/interact.js/main/LICENSE */ | ||
/* interact.js 1.10.27 | 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 |
/** | ||
* interact.js 1.10.26 | ||
* interact.js 1.10.27 | ||
* | ||
@@ -4,0 +4,0 @@ * Copyright (c) 2012-present Taye Adeyemi <dev@taye.me> |
@@ -1,3 +0,3 @@ | ||
/* interact.js 1.10.26 | https://raw.github.com/taye/interact.js/main/LICENSE */ | ||
/* interact.js 1.10.27 | 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
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
457402
3585