Socket
Socket
Sign inDemoInstall

polythene-core

Package Overview
Dependencies
Maintainers
1
Versions
38
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

polythene-core - npm Package Compare versions

Comparing version 1.4.0 to 1.4.1

2

dist/polythene-core.js

@@ -1,2 +0,2 @@

!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports):"function"==typeof define&&define.amd?define(["exports"],t):t((e=e||self).polythene={})}(this,function(e){"use strict";const t="undefined"!=typeof document,n=!t,i={animation:"animationend",OAnimation:"oAnimationEnd",MozAnimation:"animationend",WebkitAnimation:"webkitAnimationEnd"},o="hidden",s="visible",d="exposing",r="hiding",a={getInitialState:(e,t)=>{const n=e.attrs;if(!n.didHide)return{};const i=n.permanent||n.show,d=t(n.permanent?s:i?s:o);return{mode:d,redrawOnUpdate:t.merge([d])}},onUpdate:({state:e,attrs:t})=>{if(!t.didHide)return;const n=e.mode();t.permanent?n===s&&t.show?e.mode(d):n!==d||t.show||e.mode(r):n===o&&t.show?e.mode(s):n!==s||t.show||e.mode(r)},view:({state:e,attrs:t},{renderer:n})=>{const i=n("span",{className:t.placeholderClassName});if(!t.didHide)return t.permanent||t.inactive||t.show?n(t.instance,t):i;const d=e.mode();return d!==o?n(t.instance,Object.assign({},t,{didHide:n=>(t.didHide(n),e.mode(t.permanent?s:o))},d===r&&{show:!0,hide:!0})):i},displayName:"Conditional"},l=(e,t)=>(e[t]=1,e),u=["key","style","href","id","tabIndex","tabindex","oninit","oncreate","onupdate","onbeforeremove","onremove","onbeforeupdate"],m=e=>"function"==typeof e?e():e,c=!n&&"ontouchstart"in document.documentElement,p=c?["touchstart","click"]:["click"],h=c?["click","mouseup"]:["mouseup"],w=c?["touchstart","mousedown"]:["mousedown"],f=c?["touchmove","mousemove"]:["mousemove"],g=c?["touchend","mouseup"]:["mouseup"];t&&document.querySelector("html").classList.add(c?"pe-touch":"pe-no-touch");const v={},y=(e,n=.05,i=(t?window:{}))=>{let o=!1;return(...t)=>{o||((()=>e.apply(i,t))(),o=!0,setTimeout(()=>o=!1,n))}},S=(e,t)=>{v[e]&&v[e].forEach(e=>e(t))};t&&(window.addEventListener("resize",e=>S("resize",e)),window.addEventListener("scroll",e=>S("scroll",e)),window.addEventListener("keydown",e=>S("keydown",e)),window.addEventListener(h,e=>S(h,e)));const b=({options:e,renderer:n})=>{const i=[];let o;const s=t=>{o||console.error("Cannot set state. Did you set a root element like Dialog to show instances?"),o(t.id),S(e.name,t)},d=e=>{const t=r(e);return i.indexOf(t)},r=e=>{for(let t=0;t<i.length;t++)if(i[t].instanceId===e)return i[t]},a=()=>{i.length&&(i[0].show=!0),s({id:i.length?i[0].instanceId:null,name:"next"})},l=(t=e.defaultId)=>{e.queue?(i.shift(),a()):(e=>{const t=d(e);-1!==t&&(i.splice(t,1),s({id:e,name:"removeItem"}))})(t)},u=(e,t)=>{const n=r(t);n&&(n.pause=e,n.unpause=!e,s({id:t,name:e?"pause":"unpause"}))},c=()=>{i.length=0,s({id:null,name:"removeAll"})};return{clear:c,count:()=>i.length,getInitialState:(e,t)=>({current:o=t(null),redrawOnUpdate:t.merge([o])}),hide:(t={})=>{const n=t.id||e.defaultId,o=e.queue&&i.length?i[0]:r(n);return o&&(o.hide=!0),s({id:n,name:"hide"}),o?o.hidePromise:Promise.resolve(n)},pause:(t=e.defaultId)=>u(!0,t),remove:l,show:(t={},n={})=>{const o=n.id||e.defaultId,u=((t,n,i)=>{let o,d;const r=m(t),a=new Promise(e=>o=e),u=new Promise(e=>d=e);return Object.assign({},e,{instanceId:n,spawn:i,attrs:t,show:!e.queue,showPromise:a,hidePromise:u,didShow:()=>(r.didShow&&r.didShow(n),s({id:n,name:"didShow"}),o(n)),didHide:()=>(r.didHide&&r.didHide(n),s({id:n,name:"didHide"}),l(n),d(n))})})(t,o,n.spawn||e.defaultId);s({id:o,name:"show"}),e.queue?(i.push(u),1===i.length&&a()):r(o)?((e,t)=>{const n=d(e);-1!==n&&(i[n]=t)})(o,u):i.push(u);return u.showPromise},unpause:(t=e.defaultId)=>u(!1,t),view:({attrs:o})=>{const s=o.spawn||e.defaultId,d=i.filter(e=>e.show&&e.spawn===s);return e.htmlShowClass&&t&&document.documentElement&&document.documentElement.classList[d.length?"add":"remove"](e.htmlShowClass),d.length?n(e.holderSelector,{className:"container"===o.position?"pe-multiple--container":"pe-multiple--screen"},d.map(t=>n(e.instance,Object.assign({},{fromMultipleClassName:e.className,fromMultipleClear:c,fromMultipleDidHide:t.didHide,fromMultipleDidShow:t.didShow,hide:t.hide,holderSelector:e.holderSelector,instanceId:t.instanceId,key:t.key,pause:t.pause,show:t.show,spawnId:s,transitions:e.transitions,unpause:t.unpause},m(t.attrs))))):n(e.placeholder)}}};b.displayName="Multi";const C=({element:e,selector:t,pseudoSelector:n,prop:i,equals:o,contains:s})=>{const d=t?e.querySelector(t):e;return!!d&&(void 0!==o?o===document.defaultView.getComputedStyle(d,n).getPropertyValue(i):void 0!==s?-1!==document.defaultView.getComputedStyle(d,n).getPropertyValue(i).indexOf(s):void 0)},D=e=>{const t=parseFloat(e)*(-1===e.indexOf("ms")?1e3:1);return isNaN(t)?0:t},E=e=>M(e,"show"),I=e=>M(e,"hide"),M=(e,n)=>{const i=e.el;return i?new Promise(o=>{const s=i.style,d=t?window.getComputedStyle(i):{},r=e.hasDuration?1e3*e.duration:D(d.transitionDuration),a=e.hasDelay?1e3*e.delay:D(d.transitionDelay),l=e.timingFunction||d.transitionTimingFunction;if(e.transitionClass){(e.transitionClassElement||i).classList.add(e.transitionClass)}const u=()=>{s.transitionDuration="0ms",s.transitionDelay="0ms",e.before()},m=e.before&&"show"===n?u:e.before&&"hide"===n?u:null,c=e.after?()=>e.after():null,p=()=>{(()=>{s.transitionDuration=r+"ms",s.transitionDelay=a+"ms",l&&(s.transitionTimingFunction=l),e.showClass&&(e.showClassElement||i).classList["show"===n?"add":"remove"](e.showClass);e.transition&&e.transition()})(),setTimeout(()=>{if(c&&c(),e.transitionClass){(e.transitionClassElement||i).classList.remove(e.transitionClass),i.offsetHeight}o()},r+a)},h=()=>{0===r?p():setTimeout(p,0)};m?(m(),i.offsetHeight,setTimeout(()=>{h()},0)):h()}):Promise.resolve()};e.getAnimationEndEvent=(()=>{if(t){const e=document.createElement("fakeelement");for(let t in i)if(void 0!==e.style[t])return i[t]}}),e.Conditional=a,e.filterSupportedAttributes=((e,{add:t=[],remove:n=[]}={})=>{const i=n.reduce(l,{}),o=u.concat(t).filter(e=>!i[e]).reduce(l,{});return Object.keys(e).reduce((t,n)=>(o[n]&&(t[n]=e[n]),t),{})}),e.unpackAttrs=m,e.classForSize=((e,t="regular")=>(e=>({small:e.small,regular:e.regular,medium:e.medium,large:e.large,fab:e.fab}))(e)[t]),e.isClient=t,e.isServer=n,e.isTouch=c,e.pointerStartEvent=p,e.pointerEndEvent=h,e.pointerStartMoveEvent=w,e.pointerMoveEvent=f,e.pointerEndMoveEvent=g,e.Multi=b,e.show=E,e.hide=I,e.transitionComponent=(({isShow:e,state:t,attrs:n,domElements:i,beforeTransition:o,afterTransition:s,showClass:d,transitionClass:r})=>{if(t.transitioning())return Promise.resolve();t.transitioning(!0),t.visible(!!e),o&&o();const a=n[e?"showDuration":"hideDuration"],l=n[e?"showDelay":"hideDelay"],u=n[e?"showTimingFunction":"hideTimingFunction"],m=n.transitions,c=e?E:I,p=Object.assign({},n,i,{showClass:d,transitionClass:r,duration:a,delay:l,timingFunction:u}),h=Object.assign({},p,m&&m[e?"show":"hide"](p));return c(Object.assign({},h,{duration:void 0!==h.duration?h.duration:.24,hasDuration:void 0!==h.duration,delay:void 0!==h.delay?h.delay:0,hasDelay:void 0!==h.delay})).then(()=>{const i=t.instanceId;n[e?"fromMultipleDidShow":"fromMultipleDidHide"]?n[e?"fromMultipleDidShow":"fromMultipleDidHide"](i):n[e?"didShow":"didHide"]&&n[e?"didShow":"didHide"](i),s&&s(),t.transitioning(!1)})}),e.throttle=y,e.subscribe=((e,t,n)=>{v[e]=v[e]||[],v[e].push(n?y(t,n):t)}),e.unsubscribe=((e,t)=>{if(!v[e])return;const n=v[e].indexOf(t);n>-1&&v[e].splice(n,1)}),e.emit=S,e.getStyle=(({element:e,selector:t,pseudoSelector:n,prop:i})=>{const o=t?e.querySelector(t):e;if(o)return o.currentStyle?o.currentStyle[i]:window.getComputedStyle?document.defaultView.getComputedStyle(o,n).getPropertyValue(i):null}),e.stylePropCompare=C,e.isRTL=(({element:e=document,selector:t})=>C({element:e,selector:t,prop:"direction",equals:"rtl"})),e.styleDurationToMs=D,e.deprecation=((e,{option:t,newOption:n,newComponent:i})=>(t&&console.warn(`${e}: option '${t}' is deprecated and will be removed in later versions. Use '${n}' instead.`),i&&!n&&console.warn(`${e}: this component is deprecated and will be removed in later versions. Use '${i}' instead.`),i&&n&&console.warn(`${e}: this component is deprecated and will be removed in later versions. Use '${i}' with option '${n}' instead.`))),e.iconDropdownUp='<svg xmlns="http://www.w3.org/2000/svg" id="dd-up-svg" width="24" height="24" viewBox="0 0 24 24"><path d="M7 14l5-5 5 5z"/></svg>',e.iconDropdownDown='<svg xmlns="http://www.w3.org/2000/svg" id="dd-down-svg" width="24" height="24" viewBox="0 0 24 24"><path d="M7 10l5 5 5-5z"/></svg>',Object.defineProperty(e,"__esModule",{value:!0})});
!function(e,n){"object"==typeof exports&&"undefined"!=typeof module?n(exports):"function"==typeof define&&define.amd?define(["exports"],n):n((e=e||self).polythene={})}(this,function(e){"use strict";var n="undefined"!=typeof document,t=!n,i={animation:"animationend",OAnimation:"oAnimationEnd",MozAnimation:"animationend",WebkitAnimation:"webkitAnimationEnd"};function o(){return(o=Object.assign||function(e){for(var n=1;n<arguments.length;n++){var t=arguments[n];for(var i in t)Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i])}return e}).apply(this,arguments)}var r="hidden",a="visible",s="exposing",d="hiding",u={getInitialState:function(e,n){var t=e.attrs;if(!t.didHide)return{};var i=t.permanent||t.show,o=n(t.permanent?a:i?a:r);return{mode:o,redrawOnUpdate:n.merge([o])}},onUpdate:function(e){var n=e.state,t=e.attrs;if(t.didHide){var i=n.mode();t.permanent?i===a&&t.show?n.mode(s):i!==s||t.show||n.mode(d):i===r&&t.show?n.mode(a):i!==a||t.show||n.mode(d)}},view:function(e,n){var t=e.state,i=e.attrs,s=n.renderer,u=s("span",{className:i.placeholderClassName});if(!i.didHide)return i.permanent||i.inactive||i.show?s(i.instance,i):u;var l=t.mode();return l!==r?s(i.instance,o({},i,{didHide:function(e){return i.didHide(e),t.mode(i.permanent?a:r)}},l===d&&{show:!0,hide:!0})):u},displayName:"Conditional"},l=function(e,n){return e[n]=1,e},c=["key","style","href","id","tabIndex","tabindex","oninit","oncreate","onupdate","onbeforeremove","onremove","onbeforeupdate"],m=function(e){return"function"==typeof e?e():e},f=!t&&"ontouchstart"in document.documentElement,h=f?["touchstart","click"]:["click"],p=f?["click","mouseup"]:["mouseup"],v=f?["touchstart","mousedown"]:["mousedown"],w=f?["touchmove","mousemove"]:["mousemove"],g=f?["touchend","mouseup"]:["mouseup"];n&&document.querySelector("html").classList.add(f?"pe-touch":"pe-no-touch");var y={},S=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:.05,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:n?window:{},o=!1;return function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];o||(e.apply(i,r),o=!0,setTimeout(function(){return o=!1},t))}},C=function(e,n){y[e]&&y[e].forEach(function(e){return e(n)})};n&&(window.addEventListener("resize",function(e){return C("resize",e)}),window.addEventListener("scroll",function(e){return C("scroll",e)}),window.addEventListener("keydown",function(e){return C("keydown",e)}),window.addEventListener(p,function(e){return C(p,e)}));var b=function(e){var t,i=e.options,r=e.renderer,a=[],s=function(e){t||console.error("Cannot set state. Did you set a root element like Dialog to show instances?"),t(e.id),C(i.name,e)},d=function(e){var n=u(e);return a.indexOf(n)},u=function(e){for(var n=0;n<a.length;n++)if(a[n].instanceId===e)return a[n]},l=function(){a.length&&(a[0].show=!0),s({id:a.length?a[0].instanceId:null,name:"next"})},c=function(){var e,n,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:i.defaultId;i.queue?(a.shift(),l()):-1!==(n=d(e=t))&&(a.splice(n,1),s({id:e,name:"removeItem"}))},f=function(e,n){var t=u(n);t&&(t.pause=e,t.unpause=!e,s({id:n,name:e?"pause":"unpause"}))},h=function(){a.length=0,s({id:null,name:"removeAll"})};return{clear:h,count:function(){return a.length},getInitialState:function(e,n){return{current:t=n(null),redrawOnUpdate:n.merge([t])}},hide:function(){var e=(arguments.length>0&&void 0!==arguments[0]?arguments[0]:{}).id||i.defaultId,n=i.queue&&a.length?a[0]:u(e);return n&&(n.hide=!0),s({id:e,name:"hide"}),n?n.hidePromise:Promise.resolve(e)},pause:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:i.defaultId;return f(!0,e)},remove:c,show:function(){var e,n,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},f=r.id||i.defaultId,h=function(e,n,t){var r,a,d=m(e),u=new Promise(function(e){return r=e}),l=new Promise(function(e){return a=e});return o({},i,{instanceId:n,spawn:t,attrs:e,show:!i.queue,showPromise:u,hidePromise:l,didShow:function(){return d.didShow&&d.didShow(n),s({id:n,name:"didShow"}),r(n)},didHide:function(){return d.didHide&&d.didHide(n),s({id:n,name:"didHide"}),c(n),a(n)}})}(t,f,r.spawn||i.defaultId);s({id:f,name:"show"}),i.queue?(a.push(h),1===a.length&&l()):u(f)?(e=h,-1!==(n=d(f))&&(a[n]=e)):a.push(h);return h.showPromise},unpause:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:i.defaultId;return f(!1,e)},view:function(e){var t=e.attrs,s=t.spawn||i.defaultId,d=a.filter(function(e){return e.show&&e.spawn===s});return i.htmlShowClass&&n&&document.documentElement&&document.documentElement.classList[d.length?"add":"remove"](i.htmlShowClass),d.length?r(i.holderSelector,{className:"container"===t.position?"pe-multiple--container":"pe-multiple--screen"},d.map(function(e){return r(i.instance,o({},{fromMultipleClassName:i.className,fromMultipleClear:h,fromMultipleDidHide:e.didHide,fromMultipleDidShow:e.didShow,hide:e.hide,holderSelector:i.holderSelector,instanceId:e.instanceId,key:e.key,pause:e.pause,show:e.show,spawnId:s,transitions:i.transitions,unpause:e.unpause},m(e.attrs)))})):r(i.placeholder)}}};b.displayName="Multi";var D=function(e){var n=e.element,t=e.selector,i=e.pseudoSelector,o=e.prop,r=e.equals,a=e.contains,s=t?n.querySelector(t):n;return!!s&&(void 0!==r?r===document.defaultView.getComputedStyle(s,i).getPropertyValue(o):void 0!==a?-1!==document.defaultView.getComputedStyle(s,i).getPropertyValue(o).indexOf(a):void 0)},E=function(e){var n=parseFloat(e)*(-1===e.indexOf("ms")?1e3:1);return isNaN(n)?0:n},I=function(e){return H(e,"show")},M=function(e){return H(e,"hide")},H=function(e,t){var i=e.el;return i?new Promise(function(o){var r=i.style,a=n?window.getComputedStyle(i):{},s=e.hasDuration?1e3*e.duration:E(a.transitionDuration),d=e.hasDelay?1e3*e.delay:E(a.transitionDelay),u=e.timingFunction||a.transitionTimingFunction;e.transitionClass&&(e.transitionClassElement||i).classList.add(e.transitionClass);var l=function(){r.transitionDuration="0ms",r.transitionDelay="0ms",e.before()},c=e.before&&"show"===t?l:e.before&&"hide"===t?l:null,m=e.after?function(){return e.after()}:null,f=function(){!function(){r.transitionDuration=s+"ms",r.transitionDelay=d+"ms",u&&(r.transitionTimingFunction=u),e.showClass&&(e.showClassElement||i).classList["show"===t?"add":"remove"](e.showClass);e.transition&&e.transition()}(),setTimeout(function(){(m&&m(),e.transitionClass)&&((e.transitionClassElement||i).classList.remove(e.transitionClass),i.offsetHeight);o()},s+d)},h=function(){0===s?f():setTimeout(f,0)};c?(c(),i.offsetHeight,setTimeout(function(){h()},0)):h()}):Promise.resolve()};e.getAnimationEndEvent=function(){if(n){var e=document.createElement("fakeelement");for(var t in i)if(void 0!==e.style[t])return i[t]}},e.Conditional=u,e.filterSupportedAttributes=function(e){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},t=n.add,i=void 0===t?[]:t,o=n.remove,r=(void 0===o?[]:o).reduce(l,{}),a=c.concat(i).filter(function(e){return!r[e]}).reduce(l,{});return Object.keys(e).reduce(function(n,t){return a[t]&&(n[t]=e[t]),n},{})},e.unpackAttrs=m,e.classForSize=function(e){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"regular";return function(e){return{small:e.small,regular:e.regular,medium:e.medium,large:e.large,fab:e.fab}}(e)[n]},e.isClient=n,e.isServer=t,e.isTouch=f,e.pointerStartEvent=h,e.pointerEndEvent=p,e.pointerStartMoveEvent=v,e.pointerMoveEvent=w,e.pointerEndMoveEvent=g,e.Multi=b,e.show=I,e.hide=M,e.transitionComponent=function(e){var n=e.isShow,t=e.state,i=e.attrs,r=e.domElements,a=e.beforeTransition,s=e.afterTransition,d=e.showClass,u=e.transitionClass;if(t.transitioning())return Promise.resolve();t.transitioning(!0),t.visible(!!n),a&&a();var l=i[n?"showDuration":"hideDuration"],c=i[n?"showDelay":"hideDelay"],m=i[n?"showTimingFunction":"hideTimingFunction"],f=i.transitions,h=n?I:M,p=o({},i,r,{showClass:d,transitionClass:u,duration:l,delay:c,timingFunction:m}),v=o({},p,f&&f[n?"show":"hide"](p));return h(o({},v,{duration:void 0!==v.duration?v.duration:.24,hasDuration:void 0!==v.duration,delay:void 0!==v.delay?v.delay:0,hasDelay:void 0!==v.delay})).then(function(){var e=t.instanceId;i[n?"fromMultipleDidShow":"fromMultipleDidHide"]?i[n?"fromMultipleDidShow":"fromMultipleDidHide"](e):i[n?"didShow":"didHide"]&&i[n?"didShow":"didHide"](e),s&&s(),t.transitioning(!1)})},e.throttle=S,e.subscribe=function(e,n,t){y[e]=y[e]||[],y[e].push(t?S(n,t):n)},e.unsubscribe=function(e,n){if(y[e]){var t=y[e].indexOf(n);t>-1&&y[e].splice(t,1)}},e.emit=C,e.getStyle=function(e){var n=e.element,t=e.selector,i=e.pseudoSelector,o=e.prop,r=t?n.querySelector(t):n;if(r)return r.currentStyle?r.currentStyle[o]:window.getComputedStyle?document.defaultView.getComputedStyle(r,i).getPropertyValue(o):null},e.stylePropCompare=D,e.isRTL=function(e){var n=e.element,t=void 0===n?document:n,i=e.selector;return D({element:t,selector:i,prop:"direction",equals:"rtl"})},e.styleDurationToMs=E,e.deprecation=function(e,n){var t=n.option,i=n.newOption,o=n.newComponent;return t&&console.warn("".concat(e,": option '").concat(t,"' is deprecated and will be removed in later versions. Use '").concat(i,"' instead.")),o&&!i&&console.warn("".concat(e,": this component is deprecated and will be removed in later versions. Use '").concat(o,"' instead.")),o&&i&&console.warn("".concat(e,": this component is deprecated and will be removed in later versions. Use '").concat(o,"' with option '").concat(i,"' instead."))},e.iconDropdownUp='<svg xmlns="http://www.w3.org/2000/svg" id="dd-up-svg" width="24" height="24" viewBox="0 0 24 24"><path d="M7 14l5-5 5 5z"/></svg>',e.iconDropdownDown='<svg xmlns="http://www.w3.org/2000/svg" id="dd-down-svg" width="24" height="24" viewBox="0 0 24 24"><path d="M7 10l5 5 5-5z"/></svg>',Object.defineProperty(e,"__esModule",{value:!0})});
//# sourceMappingURL=polythene-core.js.map
{
"name": "polythene-core",
"version": "1.4.0",
"version": "1.4.1",
"description": "",

@@ -5,0 +5,0 @@ "main": "dist/polythene-core",

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

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