@interactjs/core
Advanced tools
Comparing version 1.9.19 to 1.9.20
@@ -55,3 +55,3 @@ /** @module interact */ | ||
interact.version = "1.9.19"; | ||
interact.version = "1.9.20"; | ||
interact.scope = scope; | ||
@@ -58,0 +58,0 @@ /** |
@@ -1,2 +0,2 @@ | ||
import t from"../utils/browser.min.js";import*as e from"../utils/domUtils.min.js";import o from"../utils/is.min.js";import*as s from"../utils/pointerUtils.min.js";import n from"./isNonNativeEvent.min.js";export function createInteractStatic(i){const r=(t,e)=>{let o=i.interactables.get(t,e);return o||(o=i.interactables.new(t,e),o.events.global=r.globalEvents),o};return r.getPointerAverage=s.pointerAverage,r.getTouchBBox=s.touchBBox,r.getTouchDistance=s.touchDistance,r.getTouchAngle=s.touchAngle,r.getElementRect=e.getElementRect,r.getElementClientRect=e.getElementClientRect,r.matchesSelector=e.matchesSelector,r.closest=e.closest,r.globalEvents={},r.version="1.9.19",r.scope=i,r.use=function(t,e){return this.scope.usePlugin(t,e),this},r.isSet=function(t,e){return!!this.scope.interactables.get(t,e&&e.context)},r.on=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 n(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},r.off=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(n(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},r.debug=function(){return this.scope},r.supportsTouch=()=>t.supportsTouch,r.supportsPointerEvent=()=>t.supportsPointerEvent,r.stop=function(){for(const t of this.scope.interactions.list)t.stop();return this},r.pointerMoveTolerance=function(t){return o.number(t)?(this.scope.interactions.pointerMoveTolerance=t,this):this.scope.interactions.pointerMoveTolerance},r.addDocument=function(t,e){this.scope.addDocument(t,e)},r.removeDocument=function(t){this.scope.removeDocument(t)},r} | ||
import t from"../utils/browser.min.js";import*as e from"../utils/domUtils.min.js";import o from"../utils/is.min.js";import*as s from"../utils/pointerUtils.min.js";import n from"./isNonNativeEvent.min.js";export function createInteractStatic(i){const r=(t,e)=>{let o=i.interactables.get(t,e);return o||(o=i.interactables.new(t,e),o.events.global=r.globalEvents),o};return r.getPointerAverage=s.pointerAverage,r.getTouchBBox=s.touchBBox,r.getTouchDistance=s.touchDistance,r.getTouchAngle=s.touchAngle,r.getElementRect=e.getElementRect,r.getElementClientRect=e.getElementClientRect,r.matchesSelector=e.matchesSelector,r.closest=e.closest,r.globalEvents={},r.version="1.9.20",r.scope=i,r.use=function(t,e){return this.scope.usePlugin(t,e),this},r.isSet=function(t,e){return!!this.scope.interactables.get(t,e&&e.context)},r.on=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 n(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},r.off=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(n(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},r.debug=function(){return this.scope},r.supportsTouch=()=>t.supportsTouch,r.supportsPointerEvent=()=>t.supportsPointerEvent,r.stop=function(){for(const t of this.scope.interactions.list)t.stop();return this},r.pointerMoveTolerance=function(t){return o.number(t)?(this.scope.interactions.pointerMoveTolerance=t,this):this.scope.interactions.pointerMoveTolerance},r.addDocument=function(t,e){this.scope.addDocument(t,e)},r.removeDocument=function(t){this.scope.removeDocument(t)},r} | ||
//# sourceMappingURL=interactStatic.min.js.map |
{ | ||
"name": "@interactjs/core", | ||
"version": "1.9.19", | ||
"version": "1.9.20", | ||
"license": "MIT", | ||
"peerDependencies": { | ||
"@interactjs/utils": "1.9.19" | ||
"@interactjs/utils": "1.9.20" | ||
}, | ||
@@ -8,0 +8,0 @@ "publishConfig": { |
@@ -129,2 +129,3 @@ import browser from "../utils/browser.js"; | ||
acc[id] = true; | ||
acc[pluginIdRoot(id)] = true; | ||
return acc; | ||
@@ -136,3 +137,3 @@ }, {}); | ||
if (before[otherId]) { | ||
if (before[otherId] || before[pluginIdRoot(otherId)]) { | ||
break; | ||
@@ -230,2 +231,6 @@ } | ||
} | ||
function pluginIdRoot(id) { | ||
return id && id.replace(/\/.*$/, ''); | ||
} | ||
//# sourceMappingURL=scope.js.map |
@@ -1,2 +0,2 @@ | ||
import t from"../utils/browser.min.js";import i from"../utils/clone.min.js";import s from"../utils/domObjects.min.js";import e from"../utils/extend.min.js";import n from"../utils/raf.min.js";import o from"../utils/window.min.js";import{Eventable as r}from"./Eventable.min.js";import{InteractEvent as a}from"./InteractEvent.min.js";import{Interactable as l}from"./Interactable.min.js";import{InteractableSet as d}from"./InteractableSet.min.js";import{defaults as h}from"./defaultOptions.min.js";import m from"./events.min.js";import{createInteractStatic as c}from"./interactStatic.min.js";import u from"./interactions.min.js";export class Scope{constructor(){this.id="__interact_scope_"+Math.floor(100*Math.random()),this.isInitialized=!1,this.listenerMaps=[],this.browser=t,this.defaults=i(h),this.Eventable=r,this.actions={map:{},phases:{start:!0,move:!0,end:!0},methodDict:{},phaselessTypes:{}},this.interactStatic=c(this),this.InteractEvent=a,this.Interactable=void 0,this.interactables=new d(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 s=this;this.Interactable=class extends l{get _defaults(){return s.defaults}set(t){return super.set(t),s.fire("interactable:set",{options:t,interactable:this}),this}unset(){super.unset(),s.interactables.list.splice(s.interactables.list.indexOf(this),1),s.fire("interactable:unset",{interactable:this})}}}addListeners(t,i){this.listenerMaps.push({id:i,map:t})}fire(t,i){for(const{map:{[t]:s}}of this.listenerMaps)if(s&&!1===s(i,this,t))return!1}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,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 s=this.listenerMaps.length,e=t.before.reduce((t,i)=>(t[i]=!0,t),{});for(;i<s;i++){if(e[this.listenerMaps[i].id])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 s=o.getWindow(t);i=i?e({},i):{},this.documents.push({doc:t,options:i}),this.events.documents.push(t),t!==this.document&&this.events.add(s,"unload",this.onWindowUnload),this.fire("scope:add-document",{doc:t,window:s,scope:this,options:i})}removeDocument(t){const i=this.getDocIndex(t),s=o.getWindow(t),e=this.documents[i].options;this.events.remove(s,"unload",this.onWindowUnload),this.documents.splice(i,1),this.events.documents.splice(i,1),this.fire("scope:remove-document",{doc:t,window:s,scope:this,options:e})}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()}}export function initScope(i,e){return i.isInitialized=!0,o.init(e),s.init(e),t.init(e),n.init(e),i.window=e,i.document=e.document,i.usePlugin(u),i.usePlugin(m),i} | ||
import t from"../utils/browser.min.js";import i from"../utils/clone.min.js";import s from"../utils/domObjects.min.js";import e from"../utils/extend.min.js";import n from"../utils/raf.min.js";import o from"../utils/window.min.js";import{Eventable as r}from"./Eventable.min.js";import{InteractEvent as a}from"./InteractEvent.min.js";import{Interactable as l}from"./Interactable.min.js";import{InteractableSet as d}from"./InteractableSet.min.js";import{defaults as h}from"./defaultOptions.min.js";import c from"./events.min.js";import{createInteractStatic as m}from"./interactStatic.min.js";import u from"./interactions.min.js";export class Scope{constructor(){this.id="__interact_scope_"+Math.floor(100*Math.random()),this.isInitialized=!1,this.listenerMaps=[],this.browser=t,this.defaults=i(h),this.Eventable=r,this.actions={map:{},phases:{start:!0,move:!0,end:!0},methodDict:{},phaselessTypes:{}},this.interactStatic=m(this),this.InteractEvent=a,this.Interactable=void 0,this.interactables=new d(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 s=this;this.Interactable=class extends l{get _defaults(){return s.defaults}set(t){return super.set(t),s.fire("interactable:set",{options:t,interactable:this}),this}unset(){super.unset(),s.interactables.list.splice(s.interactables.list.indexOf(this),1),s.fire("interactable:unset",{interactable:this})}}}addListeners(t,i){this.listenerMaps.push({id:i,map:t})}fire(t,i){for(const{map:{[t]:s}}of this.listenerMaps)if(s&&!1===s(i,this,t))return!1}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,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 s=this.listenerMaps.length,e=t.before.reduce((t,i)=>(t[i]=!0,t[p(i)]=!0,t),{});for(;i<s;i++){const t=this.listenerMaps[i].id;if(e[t]||e[p(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 s=o.getWindow(t);i=i?e({},i):{},this.documents.push({doc:t,options:i}),this.events.documents.push(t),t!==this.document&&this.events.add(s,"unload",this.onWindowUnload),this.fire("scope:add-document",{doc:t,window:s,scope:this,options:i})}removeDocument(t){const i=this.getDocIndex(t),s=o.getWindow(t),e=this.documents[i].options;this.events.remove(s,"unload",this.onWindowUnload),this.documents.splice(i,1),this.events.documents.splice(i,1),this.fire("scope:remove-document",{doc:t,window:s,scope:this,options:e})}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()}}export function initScope(i,e){return i.isInitialized=!0,o.init(e),s.init(e),t.init(e),n.init(e),i.window=e,i.document=e.document,i.usePlugin(u),i.usePlugin(c),i}function p(t){return t&&t.replace(/\/.*$/,"")} | ||
//# sourceMappingURL=scope.min.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
410473
2396