@interactjs/core
Advanced tools
Comparing version 1.10.18 to 1.10.19
@@ -56,3 +56,3 @@ /** @module interact */ | ||
interact.version = "1.10.18"; | ||
interact.version = "1.10.19"; | ||
interact.scope = scope; | ||
@@ -59,0 +59,0 @@ /** |
@@ -1,2 +0,2 @@ | ||
import t from"../utils/browser.prod.js";import*as e from"../utils/domUtils.prod.js";import o from"../utils/is.prod.js";import{warnOnce as s}from"../utils/misc.prod.js";import*as n from"../utils/pointerUtils.prod.js";import i from"./isNonNativeEvent";export function createInteractStatic(r){const c=(t,e)=>{let o=r.interactables.get(t,e);return o||(o=r.interactables.new(t,e),o.events.global=c.globalEvents),o};return c.getPointerAverage=n.pointerAverage,c.getTouchBBox=n.touchBBox,c.getTouchDistance=n.touchDistance,c.getTouchAngle=n.touchAngle,c.getElementRect=e.getElementRect,c.getElementClientRect=e.getElementClientRect,c.matchesSelector=e.matchesSelector,c.closest=e.closest,c.globalEvents={},c.version="1.10.18",c.scope=r,c.use=function(t,e){return this.scope.usePlugin(t,e),this},c.isSet=function(t,e){return!!this.scope.interactables.get(t,e&&e.context)},c.on=s((function(t,e,s){if(o.string(t)&&-1!==t.search(" ")&&(t=t.trim().split(/ +/)),o.array(t)){for(const o of t)this.on(o,e,s);return this}if(o.object(t)){for(const o in t)this.on(o,t[o],e);return this}return i(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"),c.off=s((function(t,e,s){if(o.string(t)&&-1!==t.search(" ")&&(t=t.trim().split(/ +/)),o.array(t)){for(const o of t)this.off(o,e,s);return this}if(o.object(t)){for(const o in t)this.off(o,t[o],e);return this}if(i(t,this.scope.actions)){let o;t in this.globalEvents&&-1!==(o=this.globalEvents[t].indexOf(e))&&this.globalEvents[t].splice(o,1)}else this.scope.events.remove(this.scope.document,t,e,s);return this}),"The interact.off() method is being deprecated"),c.debug=function(){return this.scope},c.supportsTouch=()=>t.supportsTouch,c.supportsPointerEvent=()=>t.supportsPointerEvent,c.stop=function(){for(const t of this.scope.interactions.list)t.stop();return this},c.pointerMoveTolerance=function(t){return o.number(t)?(this.scope.interactions.pointerMoveTolerance=t,this):this.scope.interactions.pointerMoveTolerance},c.addDocument=function(t,e){this.scope.addDocument(t,e)},c.removeDocument=function(t){this.scope.removeDocument(t)},c} | ||
import t from"../utils/browser.prod.js";import*as e from"../utils/domUtils.prod.js";import o from"../utils/is.prod.js";import{warnOnce as s}from"../utils/misc.prod.js";import*as n from"../utils/pointerUtils.prod.js";import i from"./isNonNativeEvent";export function createInteractStatic(r){const c=(t,e)=>{let o=r.interactables.get(t,e);return o||(o=r.interactables.new(t,e),o.events.global=c.globalEvents),o};return c.getPointerAverage=n.pointerAverage,c.getTouchBBox=n.touchBBox,c.getTouchDistance=n.touchDistance,c.getTouchAngle=n.touchAngle,c.getElementRect=e.getElementRect,c.getElementClientRect=e.getElementClientRect,c.matchesSelector=e.matchesSelector,c.closest=e.closest,c.globalEvents={},c.version="1.10.19",c.scope=r,c.use=function(t,e){return this.scope.usePlugin(t,e),this},c.isSet=function(t,e){return!!this.scope.interactables.get(t,e&&e.context)},c.on=s((function(t,e,s){if(o.string(t)&&-1!==t.search(" ")&&(t=t.trim().split(/ +/)),o.array(t)){for(const o of t)this.on(o,e,s);return this}if(o.object(t)){for(const o in t)this.on(o,t[o],e);return this}return i(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"),c.off=s((function(t,e,s){if(o.string(t)&&-1!==t.search(" ")&&(t=t.trim().split(/ +/)),o.array(t)){for(const o of t)this.off(o,e,s);return this}if(o.object(t)){for(const o in t)this.off(o,t[o],e);return this}if(i(t,this.scope.actions)){let o;t in this.globalEvents&&-1!==(o=this.globalEvents[t].indexOf(e))&&this.globalEvents[t].splice(o,1)}else this.scope.events.remove(this.scope.document,t,e,s);return this}),"The interact.off() method is being deprecated"),c.debug=function(){return this.scope},c.supportsTouch=()=>t.supportsTouch,c.supportsPointerEvent=()=>t.supportsPointerEvent,c.stop=function(){for(const t of this.scope.interactions.list)t.stop();return this},c.pointerMoveTolerance=function(t){return o.number(t)?(this.scope.interactions.pointerMoveTolerance=t,this):this.scope.interactions.pointerMoveTolerance},c.addDocument=function(t,e){this.scope.addDocument(t,e)},c.removeDocument=function(t){this.scope.removeDocument(t)},c} | ||
//# sourceMappingURL=InteractStatic.prod.js.map |
{ | ||
"name": "@interactjs/core", | ||
"version": "1.10.18", | ||
"version": "1.10.19", | ||
"main": "index", | ||
@@ -13,3 +13,3 @@ "module": "index", | ||
"peerDependencies": { | ||
"@interactjs/utils": "1.10.18" | ||
"@interactjs/utils": "1.10.19" | ||
}, | ||
@@ -24,3 +24,3 @@ "publishConfig": { | ||
"license": "MIT", | ||
"gitHead": "90ef3f56" | ||
"gitHead": "f3a3a694" | ||
} |
@@ -70,3 +70,2 @@ import browser from "../utils/browser.js"; | ||
if (index < 0) return; | ||
super.unset(); | ||
scope.interactables.list.splice(index, 1); | ||
@@ -73,0 +72,0 @@ scope.fire('interactable:unset', { |
@@ -1,2 +0,2 @@ | ||
import t from"../utils/browser.prod.js";import e from"../utils/clone.prod.js";import i from"../utils/domObjects.prod.js";import s from"../utils/extend.prod.js";import n from"../utils/is.prod.js";import o from"../utils/raf.prod.js";import*as r from"../utils/window.prod.js";import{Eventable as a}from"./Eventable";import{InteractEvent as l}from"./InteractEvent";import{createInteractStatic as d}from"./InteractStatic";import{Interactable as c}from"./Interactable";import{InteractableSet as p}from"./InteractableSet";import u from"./events";import m from"./interactions";import{defaults as h}from"./options";export class Scope{id="__interact_scope_"+Math.floor(100*Math.random());isInitialized=!1;listenerMaps=[];browser=t;defaults=e(h);Eventable=a;actions={map:{},phases:{start:!0,move:!0,end:!0},methodDict:{},phaselessTypes:{}};interactStatic=d(this);InteractEvent=l;Interactable;interactables=new p(this);_win;document;window;documents=[];_plugins={list:[],map:{}};constructor(){const t=this;this.Interactable=class extends c{get _defaults(){return t.defaults}set(e){return super.set(e),t.fire("interactable:set",{options:e,interactable:this}),this}unset(){super.unset();const e=t.interactables.list.indexOf(this);e<0||(super.unset(),t.interactables.list.splice(e,1),t.fire("interactable:unset",{interactable:this}))}}}addListeners(t,e){this.listenerMaps.push({id:e,map:t})}fire(t,e){for(const{map:{[t]:i}}of this.listenerMaps)if(i&&!1===i(e,this,t))return!1}onWindowUnload=t=>this.removeDocument(t.target);init(t){return this.isInitialized?this:initScope(this,t)}pluginIsInstalled(t){return this._plugins.map[t.id]||-1!==this._plugins.list.indexOf(t)}usePlugin(t,e){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,e),t.listeners&&t.before){let e=0;const i=this.listenerMaps.length,s=t.before.reduce(((t,e)=>(t[e]=!0,t[f(e)]=!0,t)),{});for(;e<i;e++){const t=this.listenerMaps[e].id;if(s[t]||s[f(t)])break}this.listenerMaps.splice(e,0,{id:t.id,map:t.listeners})}else t.listeners&&this.listenerMaps.push({id:t.id,map:t.listeners});return this}addDocument(t,e){if(-1!==this.getDocIndex(t))return!1;const i=r.getWindow(t);e=e?s({},e):{},this.documents.push({doc:t,options:e}),this.events.documents.push(t),t!==this.document&&this.events.add(i,"unload",this.onWindowUnload),this.fire("scope:add-document",{doc:t,window:i,scope:this,options:e})}removeDocument(t){const e=this.getDocIndex(t),i=r.getWindow(t),s=this.documents[e].options;this.events.remove(i,"unload",this.onWindowUnload),this.documents.splice(e,1),this.events.documents.splice(e,1),this.fire("scope:remove-document",{doc:t,window:i,scope:this,options:s})}getDocIndex(t){for(let e=0;e<this.documents.length;e++)if(this.documents[e].doc===t)return e;return-1}getDocOptions(t){const e=this.getDocIndex(t);return-1===e?null:this.documents[e].options}now(){return(this.window.Date||Date).now()}}export function initScope(e,s){return e.isInitialized=!0,n.window(s)&&r.init(s),i.init(s),t.init(s),o.init(s),e.window=s,e.document=s.document,e.usePlugin(m),e.usePlugin(u),e}function f(t){return t&&t.replace(/\/.*$/,"")} | ||
import t from"../utils/browser.prod.js";import e from"../utils/clone.prod.js";import i from"../utils/domObjects.prod.js";import s from"../utils/extend.prod.js";import n from"../utils/is.prod.js";import o from"../utils/raf.prod.js";import*as r from"../utils/window.prod.js";import{Eventable as a}from"./Eventable";import{InteractEvent as l}from"./InteractEvent";import{createInteractStatic as d}from"./InteractStatic";import{Interactable as c}from"./Interactable";import{InteractableSet as p}from"./InteractableSet";import u from"./events";import m from"./interactions";import{defaults as h}from"./options";export class Scope{id="__interact_scope_"+Math.floor(100*Math.random());isInitialized=!1;listenerMaps=[];browser=t;defaults=e(h);Eventable=a;actions={map:{},phases:{start:!0,move:!0,end:!0},methodDict:{},phaselessTypes:{}};interactStatic=d(this);InteractEvent=l;Interactable;interactables=new p(this);_win;document;window;documents=[];_plugins={list:[],map:{}};constructor(){const t=this;this.Interactable=class extends c{get _defaults(){return t.defaults}set(e){return super.set(e),t.fire("interactable:set",{options:e,interactable:this}),this}unset(){super.unset();const e=t.interactables.list.indexOf(this);e<0||(t.interactables.list.splice(e,1),t.fire("interactable:unset",{interactable:this}))}}}addListeners(t,e){this.listenerMaps.push({id:e,map:t})}fire(t,e){for(const{map:{[t]:i}}of this.listenerMaps)if(i&&!1===i(e,this,t))return!1}onWindowUnload=t=>this.removeDocument(t.target);init(t){return this.isInitialized?this:initScope(this,t)}pluginIsInstalled(t){return this._plugins.map[t.id]||-1!==this._plugins.list.indexOf(t)}usePlugin(t,e){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,e),t.listeners&&t.before){let e=0;const i=this.listenerMaps.length,s=t.before.reduce(((t,e)=>(t[e]=!0,t[f(e)]=!0,t)),{});for(;e<i;e++){const t=this.listenerMaps[e].id;if(s[t]||s[f(t)])break}this.listenerMaps.splice(e,0,{id:t.id,map:t.listeners})}else t.listeners&&this.listenerMaps.push({id:t.id,map:t.listeners});return this}addDocument(t,e){if(-1!==this.getDocIndex(t))return!1;const i=r.getWindow(t);e=e?s({},e):{},this.documents.push({doc:t,options:e}),this.events.documents.push(t),t!==this.document&&this.events.add(i,"unload",this.onWindowUnload),this.fire("scope:add-document",{doc:t,window:i,scope:this,options:e})}removeDocument(t){const e=this.getDocIndex(t),i=r.getWindow(t),s=this.documents[e].options;this.events.remove(i,"unload",this.onWindowUnload),this.documents.splice(e,1),this.events.documents.splice(e,1),this.fire("scope:remove-document",{doc:t,window:i,scope:this,options:s})}getDocIndex(t){for(let e=0;e<this.documents.length;e++)if(this.documents[e].doc===t)return e;return-1}getDocOptions(t){const e=this.getDocIndex(t);return-1===e?null:this.documents[e].options}now(){return(this.window.Date||Date).now()}}export function initScope(e,s){return e.isInitialized=!0,n.window(s)&&r.init(s),i.init(s),t.init(s),o.init(s),e.window=s,e.document=s.document,e.usePlugin(m),e.usePlugin(u),e}function f(t){return t&&t.replace(/\/.*$/,"")} | ||
//# sourceMappingURL=scope.prod.js.map |
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
447456
3388