@interactjs/auto-start
Advanced tools
Comparing version 1.9.19 to 1.9.20
@@ -303,3 +303,3 @@ import * as domUtils from "../utils/domUtils.js"; | ||
id: 'auto-start/base', | ||
before: ['actions', 'actions/drag', 'actions/resize', 'actions/gesture'], | ||
before: ['actions'], | ||
install, | ||
@@ -306,0 +306,0 @@ listeners: { |
@@ -1,2 +0,2 @@ | ||
import*as t from"../utils/domUtils.min.js";import e from"../utils/extend.min.js";import n from"../utils/is.min.js";import{copyAction as r}from"../utils/misc.min.js";import o from"./InteractableMethods.min.js";function a(t,e,n,r,o){return e.testIgnoreAllow(e.options[t.name],n,r)&&e.options[t.name].enabled&&l(e,n,t,o)?t:null}function i(t,e,n,r,o,i,s){for(let c=0,l=r.length;c<l;c++){const l=r[c],u=o[c],m=l.getAction(e,n,t,u);if(!m)continue;const p=a(m,l,u,i,s);if(p)return{action:p,interactable:l,element:u}}return{action:null,interactable:null,element:null}}function s(e,r,o,a,s){let c=[],l=[],u=a;function m(t){c.push(t),l.push(u)}for(;n.element(u);){c=[],l=[],s.interactables.forEachMatch(u,m);const n=i(e,r,o,c,l,a,s);if(n.action&&!n.interactable.options[n.action.name].manualStart)return n;u=t.parentNode(u)}return{action:null,interactable:null,element:null}}function c(t,{action:e,interactable:n,element:o},a){e=e||{name:null},t.interactable=n,t.element=o,r(t.prepared,e),t.rect=n&&e.name?n.getRect(o):null,p(t,a),a.fire("autoStart:prepared",{interaction:t})}function l(t,e,n,r){const o=t.options,a=o[n.name].max,i=o[n.name].maxPerElement,s=r.autoStart.maxInteractions;let c=0,l=0,u=0;if(!(a&&i&&s))return!1;for(const o of r.interactions.list){const r=o.prepared.name;if(o.interacting()){if(c++,c>=s)return!1;if(o.interactable===t){if(l+=r===n.name?1:0,l>=a)return!1;if(o.element===e&&(u++,r===n.name&&u>=i))return!1}}}return s>0}function u(t,e){return n.number(t)?(e.autoStart.maxInteractions=t,this):e.autoStart.maxInteractions}function m(t,e,n){const{cursorElement:r}=n.autoStart;r&&r!==t&&(r.style.cursor=""),t.ownerDocument.documentElement.style.cursor=e,t.style.cursor=e,n.autoStart.cursorElement=e?t:null}function p(t,e){const{interactable:r,element:o,prepared:a}=t;if("mouse"!==t.pointerType||!r||!r.options.styleCursor)return void(e.autoStart.cursorElement&&m(e.autoStart.cursorElement,"",e));let i="";if(a.name){const s=r.options[a.name].cursorChecker;i=n.func(s)?s(a,r,o,t._interacting):e.actions.map[a.name].getCursor(a)}m(t.element,i||"",e)}const f={id:"auto-start/base",before:["actions","actions/drag","actions/resize","actions/gesture"],install(t){const{interactStatic:n,defaults:r}=t;t.usePlugin(o),r.base.actionChecker=null,r.base.styleCursor=!0,e(r.perAction,{manualStart:!1,max:1/0,maxPerElement:1,allowFrom:null,ignoreFrom:null,mouseButtons:1}),n.maxInteractions=e=>u(e,t),t.autoStart={maxInteractions:1/0,withinInteractionLimit:l,cursorElement:null}},listeners:{"interactions:down"({interaction:t,pointer:e,event:n,eventTarget:r},o){t.interacting()||c(t,s(t,e,n,r,o),o)},"interactions:move"(t,e){!function({interaction:t,pointer:e,event:n,eventTarget:r},o){if("mouse"!==t.pointerType||t.pointerIsDown||t.interacting())return;c(t,s(t,e,n,r,o),o)}(t,e),function(t,e){const{interaction:n}=t;if(!n.pointerIsDown||n.interacting()||!n.pointerWasMoved||!n.prepared.name)return;e.fire("autoStart:before-start",t);const{interactable:r}=n,o=n.prepared.name;o&&r&&(r.options[o].manualStart||!l(r,n.element,n.prepared,e)?n.stop():(n.start(n.prepared,r,n.element),p(n,e)))}(t,e)},"interactions:stop"({interaction:t},e){const{interactable:n}=t;n&&n.options.styleCursor&&m(t.element,"",e)}},maxInteractions:u,withinInteractionLimit:l,validateAction:a};export default f; | ||
import*as t from"../utils/domUtils.min.js";import e from"../utils/extend.min.js";import n from"../utils/is.min.js";import{copyAction as r}from"../utils/misc.min.js";import o from"./InteractableMethods.min.js";function a(t,e,n,r,o){return e.testIgnoreAllow(e.options[t.name],n,r)&&e.options[t.name].enabled&&l(e,n,t,o)?t:null}function i(t,e,n,r,o,i,c){for(let s=0,l=r.length;s<l;s++){const l=r[s],u=o[s],m=l.getAction(e,n,t,u);if(!m)continue;const p=a(m,l,u,i,c);if(p)return{action:p,interactable:l,element:u}}return{action:null,interactable:null,element:null}}function c(e,r,o,a,c){let s=[],l=[],u=a;function m(t){s.push(t),l.push(u)}for(;n.element(u);){s=[],l=[],c.interactables.forEachMatch(u,m);const n=i(e,r,o,s,l,a,c);if(n.action&&!n.interactable.options[n.action.name].manualStart)return n;u=t.parentNode(u)}return{action:null,interactable:null,element:null}}function s(t,{action:e,interactable:n,element:o},a){e=e||{name:null},t.interactable=n,t.element=o,r(t.prepared,e),t.rect=n&&e.name?n.getRect(o):null,p(t,a),a.fire("autoStart:prepared",{interaction:t})}function l(t,e,n,r){const o=t.options,a=o[n.name].max,i=o[n.name].maxPerElement,c=r.autoStart.maxInteractions;let s=0,l=0,u=0;if(!(a&&i&&c))return!1;for(const o of r.interactions.list){const r=o.prepared.name;if(o.interacting()){if(s++,s>=c)return!1;if(o.interactable===t){if(l+=r===n.name?1:0,l>=a)return!1;if(o.element===e&&(u++,r===n.name&&u>=i))return!1}}}return c>0}function u(t,e){return n.number(t)?(e.autoStart.maxInteractions=t,this):e.autoStart.maxInteractions}function m(t,e,n){const{cursorElement:r}=n.autoStart;r&&r!==t&&(r.style.cursor=""),t.ownerDocument.documentElement.style.cursor=e,t.style.cursor=e,n.autoStart.cursorElement=e?t:null}function p(t,e){const{interactable:r,element:o,prepared:a}=t;if("mouse"!==t.pointerType||!r||!r.options.styleCursor)return void(e.autoStart.cursorElement&&m(e.autoStart.cursorElement,"",e));let i="";if(a.name){const c=r.options[a.name].cursorChecker;i=n.func(c)?c(a,r,o,t._interacting):e.actions.map[a.name].getCursor(a)}m(t.element,i||"",e)}const f={id:"auto-start/base",before:["actions"],install(t){const{interactStatic:n,defaults:r}=t;t.usePlugin(o),r.base.actionChecker=null,r.base.styleCursor=!0,e(r.perAction,{manualStart:!1,max:1/0,maxPerElement:1,allowFrom:null,ignoreFrom:null,mouseButtons:1}),n.maxInteractions=e=>u(e,t),t.autoStart={maxInteractions:1/0,withinInteractionLimit:l,cursorElement:null}},listeners:{"interactions:down"({interaction:t,pointer:e,event:n,eventTarget:r},o){t.interacting()||s(t,c(t,e,n,r,o),o)},"interactions:move"(t,e){!function({interaction:t,pointer:e,event:n,eventTarget:r},o){if("mouse"!==t.pointerType||t.pointerIsDown||t.interacting())return;s(t,c(t,e,n,r,o),o)}(t,e),function(t,e){const{interaction:n}=t;if(!n.pointerIsDown||n.interacting()||!n.pointerWasMoved||!n.prepared.name)return;e.fire("autoStart:before-start",t);const{interactable:r}=n,o=n.prepared.name;o&&r&&(r.options[o].manualStart||!l(r,n.element,n.prepared,e)?n.stop():(n.start(n.prepared,r,n.element),p(n,e)))}(t,e)},"interactions:stop"({interaction:t},e){const{interactable:n}=t;n&&n.options.styleCursor&&m(t.element,"",e)}},maxInteractions:u,withinInteractionLimit:l,validateAction:a};export default f; | ||
//# sourceMappingURL=base.min.js.map |
{ | ||
"name": "@interactjs/auto-start", | ||
"version": "1.9.19", | ||
"version": "1.9.20", | ||
"license": "MIT", | ||
"peerDependencies": { | ||
"@interactjs/core": "1.9.19", | ||
"@interactjs/utils": "1.9.19" | ||
"@interactjs/core": "1.9.20", | ||
"@interactjs/utils": "1.9.20" | ||
}, | ||
"optionalDependencies": { | ||
"@interactjs/interact": "1.9.19" | ||
"@interactjs/interact": "1.9.20" | ||
}, | ||
@@ -12,0 +12,0 @@ "publishConfig": { |
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
102532