@pantograph/sortable 2.2.1 → 2.2.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.cjs +1 -1
- package/dist/index.js +1 -1
- package/package.json +2 -3
package/dist/index.cjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
"use strict";var Gt=Object.defineProperty;var zt=(i,e,t)=>e in i?Gt(i,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):i[e]=t;var q=(i,e,t)=>zt(i,typeof e!="symbol"?e+"":e,t);const Et="2.2.
|
|
1
|
+
"use strict";var Gt=Object.defineProperty;var zt=(i,e,t)=>e in i?Gt(i,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):i[e]=t;var q=(i,e,t)=>zt(i,typeof e!="symbol"?e+"":e,t);const Et="2.2.1";function oe(i){if(typeof window<"u"&&window.navigator)return!!navigator.userAgent.match(i)}const re=oe(/(?:Trident.*rv[ :]?11\.|msie|iemobile|Windows Phone)/i),Ae=oe(/Edge/i),mt=oe(/firefox/i),Ce=oe(/safari/i)&&!oe(/chrome/i)&&!oe(/android/i),ut=oe(/iP(ad|od|hone)/i),xt=oe(/chrome/i)&&oe(/android/i),Mt={capture:!1,passive:!1};function w(i,e,t){i.addEventListener(e,t,!re&&Mt)}function v(i,e,t){i.removeEventListener(e,t,!re&&Mt)}function $e(i,e){if(e){if(e[0]===">"&&(e=e.substring(1)),i)try{if(i.matches)return i.matches(e);if(i.msMatchesSelector)return i.msMatchesSelector(e);if(i.webkitMatchesSelector)return i.webkitMatchesSelector(e)}catch{return!1}return!1}}function It(i){return i.host&&i!==document&&i.host.nodeType&&i.host!==i?i.host:i.parentNode}function R(i,e,t,n,o){if(i){t=t||document;do{if(!(o!=null&&o.some(r=>r===i))&&(e!=null&&(e[0]===">"?i.parentNode===t&&$e(i,e):$e(i,e))||n&&i===t))return i;if(i===t)break}while(i=It(i))}return null}const bt=/\s+/g;function I(i,e,t){if(i&&e)if(i.classList)i.classList[t?"add":"remove"](e);else{let n=(" "+i.className+" ").replace(bt," ").replace(" "+e+" "," ");i.className=(n+(t?" "+e:"")).replace(bt," ")}}function p(i,e,t){let n=i&&i.style;if(n){if(t===void 0)return document.defaultView&&document.defaultView.getComputedStyle?t=document.defaultView.getComputedStyle(i,""):i.currentStyle&&(t=i.currentStyle),e===void 0?t:t[e];!(e in n)&&e.indexOf("webkit")===-1&&(e="-webkit-"+e),n[e]=t+(typeof t=="string"?"":"px")}}function Se(i,e){let t="";if(typeof i=="string")t=i;else do{let o=p(i,"transform");o&&o!=="none"&&(t=o+" "+t)}while(!e&&(i=i.parentNode));const n=window.DOMMatrix||window.WebKitCSSMatrix||window.CSSMatrix||window.MSCSSMatrix;return n&&new n(t)}function lt(i,e,t){if(i){let n=i.getElementsByTagName(e),o=0,r=n.length;if(t)for(;o<r;o++)t(n[o],o);return n}return[]}function J(){let i=document.scrollingElement;return i||document.documentElement}function P(i,e,t,n,o){if(!i.getBoundingClientRect&&i!==window)return;let r,l,a,s,f,d,h;if(i!==window&&i.parentNode&&i!==J()?(r=i.getBoundingClientRect(),l=r.top,a=r.left,s=r.bottom,f=r.right,d=r.height,h=r.width):(l=0,a=0,s=window.innerHeight,f=window.innerWidth,d=window.innerHeight,h=window.innerWidth),(e||t)&&i!==window&&(o=o||i.parentNode,!re))do if(o&&o.getBoundingClientRect&&(p(o,"transform")!=="none"||t&&p(o,"position")!=="static")){let m=o.getBoundingClientRect();l-=m.top+parseInt(p(o,"border-top-width")),a-=m.left+parseInt(p(o,"border-left-width")),s=l+r.height,f=a+r.width;break}while(o=o.parentNode);if(n&&i!==window){let m=Se(o||i),y=m&&m.a,u=m&&m.d;m&&(l/=u,a/=y,h/=y,d/=u,s=l+d,f=a+h)}return{top:l,left:a,bottom:s,right:f,width:h,height:d}}function vt(i,e,t){let n=fe(i,!0),o=P(i)[e];for(;n;){let r=P(n)[t],l;if(l=o>=r,!l)return n;if(n===J())break;n=fe(n,!1)}return!1}function be(i,e,t,n,o){let r=0,l=0,a=i.children;for(;l<a.length;){if(!(o!=null&&o.some(s=>s===a[l]))&&a[l].style.display!=="none"&&a[l]!==E.ghost&&(n||a[l]!==E.dragged)&&R(a[l],t.draggable,i,!1,o)){if(r===e)return a[l];r++}l++}return null}function pt(i,e){let t=i.lastElementChild;for(;t&&(t===E.ghost||p(t,"display")==="none"||e&&!$e(t,e));)t=t.previousElementSibling;return t||null}function k(i,e,t){let n=0;if(!i||!i.parentNode)return-1;for(;i=i.previousElementSibling;)i.nodeName.toUpperCase()!=="TEMPLATE"&&i!==E.clone&&(!e||$e(i,e))&&!(t!=null&&t.some(o=>o===i))&&n++;return n}function wt(i){let e=0,t=0,n=J();if(i)do{let o=Se(i),r=o.a,l=o.d;e+=i.scrollLeft*r,t+=i.scrollTop*l}while(i!==n&&(i=i.parentNode));return[e,t]}function $t(i,e){for(let t in i)if(i.hasOwnProperty(t)){for(let n in e)if(e.hasOwnProperty(n)&&e[n]===i[t][n])return Number(t)}return-1}function fe(i,e){if(!i||!i.getBoundingClientRect)return J();let t=i,n=!1;do if(t.clientWidth<t.scrollWidth||t.clientHeight<t.scrollHeight){let o=p(t);if(t.clientWidth<t.scrollWidth&&(o.overflowX=="auto"||o.overflowX=="scroll")||t.clientHeight<t.scrollHeight&&(o.overflowY=="auto"||o.overflowY=="scroll")){if(!t.getBoundingClientRect||t===document.body)return J();if(n||e)return t;n=!0}}while(t=t.parentNode);return J()}function Ot(i,e){if(i&&e)for(let t in e)e.hasOwnProperty(t)&&(i[t]=e[t]);return i}function Ze(i,e){return Math.round(i.top)===Math.round(e.top)&&Math.round(i.left)===Math.round(e.left)&&Math.round(i.height)===Math.round(e.height)&&Math.round(i.width)===Math.round(e.width)}let Me;function gt(i,e){return function(){if(!Me){let t=arguments,n=this;t.length===1?i.call(n,t[0]):i.apply(n,t),Me=setTimeout(function(){Me=void 0},e)}}}function jt(){clearTimeout(Me),Me=void 0}function At(i,e,t){i.scrollLeft+=e,i.scrollTop+=t}function at(i){let e=window.Polymer,t=window.jQuery||window.Zepto;return e&&e.dom?e.dom(i).cloneNode(!0):t?t(i).clone(!0)[0]:i.cloneNode(!0)}function Nt(i,e,t,n){const o={};return Array.from(i.children).forEach(r=>{if(!R(r,e.draggable,i,!1,n)||r.animated||r===t)return;const l=P(r);o.left=Math.min(o.left??1/0,l.left),o.top=Math.min(o.top??1/0,l.top),o.right=Math.max(o.right??-1/0,l.right),o.bottom=Math.max(o.bottom??-1/0,l.bottom)}),o.width=o.right-o.left,o.height=o.bottom-o.top,o.x=o.left,o.y=o.top,o}const N="Sortable"+new Date().getTime();function Vt(){let i=[],e;return{captureAnimationState(){if(i=[],!this.options.animation)return;[].slice.call(this.el.children).forEach(n=>{if(p(n,"display")==="none"||n===E.ghost)return;i.push({target:n,rect:P(n)});let o={...i[i.length-1].rect};if(n.thisAnimationDuration){let r=Se(n,!0);r&&(o.top-=r.f,o.left-=r.e)}n.fromRect=o})},addAnimationState(t){i.push(t)},removeAnimationState(t){i.splice($t(i,{target:t}),1)},animateAll(t){if(!this.options.animation){clearTimeout(e),typeof t=="function"&&t();return}let n=!1,o=0;i.forEach(r=>{let l=0,a=r.target,s=a.fromRect,f=P(a),d=a.prevFromRect,h=a.prevToRect,m=r.rect,y=Se(a,!0);y&&(f.top-=y.f,f.left-=y.e),a.toRect=f,a.thisAnimationDuration&&Ze(d,f)&&!Ze(s,f)&&(m.top-f.top)/(m.left-f.left)===(s.top-f.top)/(s.left-f.left)&&(l=Ut(m,d,h,this.options)),Ze(f,s)||(a.prevFromRect=s,a.prevToRect=f,l||(l=this.options.animation),this.animate(a,m,f,l)),l&&(n=!0,o=Math.max(o,l),clearTimeout(a.animationResetTimer),a.animationResetTimer=setTimeout(function(){a.animationTime=0,a.prevFromRect=null,a.fromRect=null,a.prevToRect=null,a.thisAnimationDuration=null},l),a.thisAnimationDuration=l)}),clearTimeout(e),n?e=setTimeout(function(){typeof t=="function"&&t()},o):typeof t=="function"&&t(),i=[]},animate(t,n,o,r){if(r){p(t,"transition",""),p(t,"transform","");let l=Se(this.el),a=l&&l.a,s=l&&l.d,f=(n.left-o.left)/(a||1),d=(n.top-o.top)/(s||1);t.animatingX=!!f,t.animatingY=!!d,p(t,"transform","translate3d("+f+"px,"+d+"px,0)"),this.forRepaintDummy=qt(t),p(t,"transition","transform "+r+"ms"+(this.options.easing?" "+this.options.easing:"")),p(t,"transform","translate3d(0,0,0)"),typeof t.animated=="number"&&clearTimeout(t.animated),t.animated=setTimeout(function(){p(t,"transition",""),p(t,"transform",""),t.animated=!1,t.animatingX=!1,t.animatingY=!1},r)}}}}function qt(i){return i.offsetWidth}function Ut(i,e,t,n){return Math.sqrt(Math.pow(e.top-i.top,2)+Math.pow(e.left-i.left,2))/Math.sqrt(Math.pow(e.top-t.top,2)+Math.pow(e.left-t.left,2))*n.animation}let ve=[];const Ke={initializeByDefault:!0},me={mount(i){for(let e in Ke)Ke.hasOwnProperty(e)&&!(e in i)&&(i[e]=Ke[e]);ve.some(e=>e.pluginName===i.pluginName)||ve.push(i)},pluginEvent(i,e,t){this.eventCanceled=!1,t.cancel=()=>{this.eventCanceled=!0};const n=i+"Global";ve.forEach(o=>{e[o.pluginName]&&(e[o.pluginName][n]&&e[o.pluginName][n]({sortable:e,...t}),e.options[o.pluginName]&&e[o.pluginName][i]&&e[o.pluginName][i]({sortable:e,...t}))})},initializePlugins(i,e,t,n){ve.forEach(o=>{const r=o.pluginName;if(!i.options[r]&&!o.initializeByDefault)return;let l=new o(i,e,i.options);l.sortable=i,l.options=i.options,i[r]=l,Object.assign(t,l.defaults)});for(let o in i.options){if(!i.options.hasOwnProperty(o))continue;let r=this.modifyOption(i,o,i.options[o]);typeof r<"u"&&(i.options[o]=r)}},getEventProperties(i,e){let t={};return ve.forEach(n=>{typeof n.eventProperties=="function"&&Object.assign(t,n.eventProperties.call(e[n.pluginName],i))}),t},modifyOption(i,e,t){let n;return ve.forEach(o=>{i[o.pluginName]&&o.optionListeners&&typeof o.optionListeners[e]=="function"&&(n=o.optionListeners[e].call(i[o.pluginName],t))}),n}};function Xt({sortable:i,rootEl:e,name:t,targetEl:n,cloneEl:o,toEl:r,fromEl:l,oldIndex:a,newIndex:s,oldDraggableIndex:f,newDraggableIndex:d,originalEvent:h,putSortable:m,extraEventProperties:y}){if(i=i||e&&e[N],!i)return;let u;window.CustomEvent&&!re&&!Ae?u=new CustomEvent(t,{bubbles:!0,cancelable:!0}):(u=document.createEvent("Event"),u.initEvent(t,!0,!0)),u.to=r||e,u.from=l||e,u.item=n||e,u.clone=o,u.oldIndex=a,u.newIndex=s,u.oldDraggableIndex=f,u.newDraggableIndex=d,u.originalEvent=h,u.pullMode=m?m.lastPutMode:void 0;let X={...y,...me.getEventProperties(t,i)};for(let x in X)u[x]=X[x];return u}function Zt({sortable:i,rootEl:e,name:t,targetEl:n,cloneEl:o,toEl:r,fromEl:l,oldIndex:a,newIndex:s,oldDraggableIndex:f,newDraggableIndex:d,originalEvent:h,putSortable:m,extraEventProperties:y}){if(i=i||e&&e[N],!i)return;let u=i.options,X="on"+t.charAt(0).toUpperCase()+t.substr(1);const x=Xt({sortable:i,rootEl:e,name:t,targetEl:n,cloneEl:o,toEl:r,fromEl:l,oldIndex:a,newIndex:s,oldDraggableIndex:f,newDraggableIndex:d,originalEvent:h,putSortable:m,extraEventProperties:y});e&&e.dispatchEvent(x),u[X]&&u[X].call(i,x)}/**!
|
|
2
2
|
* Sortable
|
|
3
3
|
* @author Sedmedgh <sedmedgh@gmail.com>
|
|
4
4
|
* @license MIT
|
package/dist/index.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
var Gt = Object.defineProperty;
|
|
2
2
|
var zt = (i, e, t) => e in i ? Gt(i, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : i[e] = t;
|
|
3
3
|
var q = (i, e, t) => zt(i, typeof e != "symbol" ? e + "" : e, t);
|
|
4
|
-
const Et = "2.2.
|
|
4
|
+
const Et = "2.2.1";
|
|
5
5
|
function oe(i) {
|
|
6
6
|
if (typeof window < "u" && window.navigator)
|
|
7
7
|
return !!/* @__PURE__ */ navigator.userAgent.match(i);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@pantograph/sortable",
|
|
3
|
-
"version": "2.2.
|
|
3
|
+
"version": "2.2.2",
|
|
4
4
|
"id": "sortable",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"exportName": "Sortable",
|
|
@@ -17,8 +17,7 @@
|
|
|
17
17
|
"require": "./dist/index.cjs",
|
|
18
18
|
"import": "./dist/index.js",
|
|
19
19
|
"types": "./dist/index.d.ts"
|
|
20
|
-
}
|
|
21
|
-
"./*": "./src/*"
|
|
20
|
+
}
|
|
22
21
|
},
|
|
23
22
|
"files": [
|
|
24
23
|
"dist"
|