Socket
Socket
Sign inDemoInstall

@interactjs/auto-start

Package Overview
Dependencies
Maintainers
2
Versions
137
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@interactjs/auto-start - npm Package Compare versions

Comparing version 1.10.26 to 1.10.27

2

base.js
/**
* 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";import extend from"../utils/extend.prod.js";import is from"../utils/is.prod.js";import{copyAction}from"../utils/misc.prod.js";import InteractableMethods from"./InteractableMethods.prod.js";function install(t){const{interactStatic:e,defaults:n}=t;t.usePlugin(InteractableMethods),n.base.actionChecker=null,n.base.styleCursor=!0,extend(n.perAction,{manualStart:!1,max:1/0,maxPerElement:1,allowFrom:null,ignoreFrom:null,mouseButtons:1}),e.maxInteractions=e=>maxInteractions(e,t),t.autoStart={maxInteractions:1/0,withinInteractionLimit:withinInteractionLimit,cursorElement:null}}function prepareOnDown(t,e){let{interaction:n,pointer:r,event:o,eventTarget:a}=t;if(n.interacting())return;prepare(n,getActionInfo(n,r,o,a,e),e)}function prepareOnMove(t,e){let{interaction:n,pointer:r,event:o,eventTarget:a}=t;if("mouse"!==n.pointerType||n.pointerIsDown||n.interacting())return;prepare(n,getActionInfo(n,r,o,a,e),e)}function startOnMove(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||!withinInteractionLimit(r,n.element,n.prepared,e)?n.stop():(n.start(n.prepared,r,n.element),setInteractionCursor(n,e)))}function clearCursorOnStop(t,e){let{interaction:n}=t;const{interactable:r}=n;r&&r.options.styleCursor&&setCursor(n.element,"",e)}function validateAction(t,e,n,r,o){return e.testIgnoreAllow(e.options[t.name],n,r)&&e.options[t.name].enabled&&withinInteractionLimit(e,n,t,o)?t:null}function validateMatches(t,e,n,r,o,a,i){for(let s=0,c=r.length;s<c;s++){const c=r[s],l=o[s],u=c.getAction(e,n,t,l);if(!u)continue;const m=validateAction(u,c,l,a,i);if(m)return{action:m,interactable:c,element:l}}return{action:null,interactable:null,element:null}}function getActionInfo(t,e,n,r,o){let a=[],i=[],s=r;function c(t){a.push(t),i.push(s)}for(;is.element(s);){a=[],i=[],o.interactables.forEachMatch(s,c);const l=validateMatches(t,e,n,a,i,r,o);if(l.action&&!l.interactable.options[l.action.name].manualStart)return l;s=domUtils.parentNode(s)}return{action:null,interactable:null,element:null}}function prepare(t,e,n){let{action:r,interactable:o,element:a}=e;r=r||{name:null},t.interactable=o,t.element=a,copyAction(t.prepared,r),t.rect=o&&r.name?o.getRect(a):null,setInteractionCursor(t,n),n.fire("autoStart:prepared",{interaction:t})}function withinInteractionLimit(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 maxInteractions(t,e){return is.number(t)?(e.autoStart.maxInteractions=t,this):e.autoStart.maxInteractions}function setCursor(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 setInteractionCursor(t,e){const{interactable:n,element:r,prepared:o}=t;if("mouse"!==t.pointerType||!n||!n.options.styleCursor)return void(e.autoStart.cursorElement&&setCursor(e.autoStart.cursorElement,"",e));let a="";if(o.name){const i=n.options[o.name].cursorChecker;a=is.func(i)?i(o,n,r,t._interacting):e.actions.map[o.name].getCursor(o)}setCursor(t.element,a||"",e)}const autoStart={id:"auto-start/base",before:["actions"],install:install,listeners:{"interactions:down":prepareOnDown,"interactions:move"(t,e){prepareOnMove(t,e),startOnMove(t,e)},"interactions:stop":clearCursorOnStop},maxInteractions:maxInteractions,withinInteractionLimit:withinInteractionLimit,validateAction:validateAction};export{autoStart as default};
//# sourceMappingURL=base.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{parentNode}from"../utils/domUtils.prod.js";import is from"../utils/is.prod.js";import autoStart from"./base.prod.js";import"../utils/extend.prod.js";import"../utils/misc.prod.js";import"./InteractableMethods.prod.js";function beforeStart(t,r){let{interaction:e,eventTarget:a,dx:o,dy:i}=t;if("drag"!==e.prepared.name)return;const n=Math.abs(o),s=Math.abs(i),d=e.interactable.options.drag,c=d.startAxis,p=n>s?"x":n<s?"y":"xy";if(e.prepared.axis="start"===d.lockAxis?p[0]:d.lockAxis,"xy"!==p&&"xy"!==c&&c!==p){e.prepared.name=null;let t=a;const o=function(o){if(o===e.interactable)return;const i=e.interactable.options.drag;if(!i.manualStart&&o.testIgnoreAllow(i,t,a)){const i=o.getAction(e.downPointer,e.downEvent,e,t);if(i&&"drag"===i.name&&checkStartAxis(p,o)&&autoStart.validateAction(i,o,t,a,r))return o}};for(;is.element(t);){const a=r.interactables.forEachMatch(t,o);if(a){e.prepared.name="drag",e.interactable=a,e.element=t;break}t=parentNode(t)}}}function checkStartAxis(t,r){if(!r)return!1;const e=r.options.drag.startAxis;return"xy"===t||"xy"===e||e===t}var dragAxis={id:"auto-start/dragAxis",listeners:{"autoStart:before-start":beforeStart}};export{dragAxis as default};
//# sourceMappingURL=dragAxis.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 autoStart from"./base.prod.js";import"../utils/domUtils.prod.js";import"../utils/extend.prod.js";import"../utils/is.prod.js";import"../utils/misc.prod.js";import"./InteractableMethods.prod.js";function install(t){const{defaults:o}=t;t.usePlugin(autoStart),o.perAction.hold=0,o.perAction.delay=0}function getHoldDuration(t){const o=t.prepared&&t.prepared.name;if(!o)return null;const e=t.interactable.options;return e[o].hold||e[o].delay}const hold={id:"auto-start/hold",install:install,listeners:{"interactions:new"(t){let{interaction:o}=t;o.autoStartHoldTimer=null},"autoStart:prepared"(t){let{interaction:o}=t;const e=getHoldDuration(o);e>0&&(o.autoStartHoldTimer=setTimeout((()=>{o.start(o.prepared,o.interactable,o.element)}),e))},"interactions:move"(t){let{interaction:o,duplicate:e}=t;o.autoStartHoldTimer&&o.pointerWasMoved&&!e&&(clearTimeout(o.autoStartHoldTimer),o.autoStartHoldTimer=null)},"autoStart:before-start"(t){let{interaction:o}=t;getHoldDuration(o)>0&&(o.prepared.name=null)}},getHoldDuration:getHoldDuration};export{hold as default};
//# sourceMappingURL=hold.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 plugin from"./plugin.prod.js";import interact from"../interact/index.prod.js";import"./base.prod.js";import"../utils/domUtils.prod.js";import"../utils/extend.prod.js";import"../utils/is.prod.js";import"../utils/misc.prod.js";import"./InteractableMethods.prod.js";import"./dragAxis.prod.js";import"./hold.prod.js";interact.use(plugin);
//# sourceMappingURL=index.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 is from"../utils/is.prod.js";import{warnOnce}from"../utils/misc.prod.js";function install(t){const{Interactable:e}=t;e.prototype.getAction=function(e,o,n,r){const i=defaultActionChecker(this,o,n,r,t);return this.options.actionChecker?this.options.actionChecker(e,o,i,this,r,n):i},e.prototype.ignoreFrom=warnOnce((function(t){return this._backCompatOption("ignoreFrom",t)}),"Interactable.ignoreFrom() has been deprecated. Use Interactble.draggable({ignoreFrom: newValue})."),e.prototype.allowFrom=warnOnce((function(t){return this._backCompatOption("allowFrom",t)}),"Interactable.allowFrom() has been deprecated. Use Interactble.draggable({allowFrom: newValue})."),e.prototype.actionChecker=actionChecker,e.prototype.styleCursor=styleCursor}function defaultActionChecker(t,e,o,n,r){const i=t.getRect(n),s={action:null,interactable:t,interaction:o,element:n,rect:i,buttons:e.buttons||{0:1,1:4,3:8,4:16}[e.button]};return r.fire("auto-start:check",s),s.action}function styleCursor(t){return is.bool(t)?(this.options.styleCursor=t,this):null===t?(delete this.options.styleCursor,this):this.options.styleCursor}function actionChecker(t){return is.func(t)?(this.options.actionChecker=t,this):null===t?(delete this.options.actionChecker,this):this.options.actionChecker}var InteractableMethods={id:"auto-start/interactableMethods",install:install};export{InteractableMethods as default};
//# sourceMappingURL=InteractableMethods.prod.js.map
{
"name": "@interactjs/auto-start",
"version": "1.10.26",
"version": "1.10.27",
"main": "index",

@@ -13,7 +13,7 @@ "module": "index",

"peerDependencies": {
"@interactjs/core": "1.10.26",
"@interactjs/utils": "1.10.26"
"@interactjs/core": "1.10.27",
"@interactjs/utils": "1.10.27"
},
"optionalDependencies": {
"@interactjs/interact": "1.10.26"
"@interactjs/interact": "1.10.27"
},

@@ -28,3 +28,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 */
import autoStart from"./base.prod.js";import dragAxis from"./dragAxis.prod.js";import hold from"./hold.prod.js";import"../utils/domUtils.prod.js";import"../utils/extend.prod.js";import"../utils/is.prod.js";import"../utils/misc.prod.js";import"./InteractableMethods.prod.js";var plugin={id:"auto-start",install(t){t.usePlugin(autoStart),t.usePlugin(hold),t.usePlugin(dragAxis)}};export{plugin as default};
//# sourceMappingURL=plugin.prod.js.map
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc