UNPKG

print-sizes

Version:

Prints a list of files in the directory.

11 lines (10 loc) 14 kB
/* Copyright (c) Daybrush name: croact license: MIT author: Daybrush repository: git+https://github.com/daybrush/croact.git version: 1.2.3 */ !function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports):"function"==typeof define&&define.amd?define(["exports"],e):e((t=t||self).Croact={})}(this,function(t){"use strict";var e="string",r="undefined";function p(t){return typeof t===e}function $(t,r){return void 0===r&&(r="-"),t.replace(/([a-z])([A-Z])/g,function(t,e,n){return""+e+r+n.toLowerCase()})}function h(t,e,n){void 0===n&&(n=-1);for(var r=t.length,i=0;i<r;++i)if(e(t[i],i,t))return i;return n}var i=function(t,e){return(i=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])})(t,e)};function o(t,e){function n(){this.constructor=t}i(t,e),t.prototype=null===e?Object.create(e):(n.prototype=e.prototype,new n)}var f=function(){return(f=Object.assign||function(t){for(var e,n=1,r=arguments.length;n<r;n++)for(var i in e=arguments[n])Object.prototype.hasOwnProperty.call(e,i)&&(t[i]=e[i]);return t}).apply(this,arguments)};function s(t,e){var n={};for(i in t)Object.prototype.hasOwnProperty.call(t,i)&&e.indexOf(i)<0&&(n[i]=t[i]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols)for(var r=0,i=Object.getOwnPropertySymbols(t);r<i.length;r++)e.indexOf(i[r])<0&&Object.prototype.propertyIsEnumerable.call(t,i[r])&&(n[i[r]]=t[i[r]]);return n}function n(t){var e=0;return t.map(function(t){return null==t?"$compat"+ ++e:""+t})}function d(t){var e=[];return t.forEach(function(t){e=e.concat(Array.isArray(t)?d(t):t)}),e}function l(t,e){if(e)for(var n in e)typeof t[n]===r&&(t[n]=e[n]);return t}function u(t,e){if(t!==e){for(var n in t)if(!(n in e))return!0;for(var n in e)if(t[n]!==e[n])return!0}return!1}function O(t){var e=t.className,t=s(t,["className"]);return null!=e&&(t.class=e),delete t.style,delete t.children,t}function x(t){var e,n={},r={};for(e in t)0===e.indexOf("on")?r[e.replace("on","").toLowerCase()]=t[e]:n[e]=t[e];return{attributes:n,events:r}}function v(t){var e;return t?(e=t.base)instanceof Node?e:v(t.container):null}function _(t){return t?t instanceof Node?t:(t=t.$_provider._ps).length?_(t[0].base):null:null}function c(t,e){for(var n=[],r=2;r<arguments.length;r++)n[r-2]=arguments[r];var e=e||{},i=e.key,o=e.ref,e=s(e,["key","ref"]);return{type:t,key:i,ref:o,props:f(f({},e),{children:d(n).filter(function(t){return null!=t&&!1!==t})})}}function a(t){t.forEach(function(t){t()})}function m(){return this.constructor(this.props,this.context)}var y=0,b=null,g=function(){function t(t,e,n,r,i,o,s){void 0===s&&(s={}),this.type=t,this.depth=e,this.key=n,this.index=r,this.container=i,this.ref=o,this.props=s,this._ps=[],this._cs={}}var e=t.prototype;return e._should=function(){return!0},e._update=function(e,n,t,r,i){var o,s=this.depth,u=d(function(t){if(Object.keys)return Object.keys(t);var e,n=[];for(e in n)n.push(e);return n}(n).map(function(t){return n[t]}).filter(function(t){return t.$_req}).map(function(t){return t.$_subs})),c=-1<(a=h(c=u,a=function(t){return t.depth===s}))?c[a]:o;if(this.base&&!p(t)&&!i&&!this._should(t.props,r)&&!c)return u.reduce(function(t,e){var n=e.depth;return t[0]?t[0].depth===n&&t.push(e):s<n&&t.push(e),t},[]).forEach(function(t){k(t,t._ps,[t.original],e,n,!0)}),!1;this.original=t,this._setState(r);var a=this.props;return p(t)||(this.props=t.props,this.ref=t.ref),E(this),this._render(e,n,this.base?a:{},r),!0},e._mounted=function(){var t=this.ref;t&&t(this.base)},e._setState=function(){},e._updated=function(){var t=this.ref;t&&t(this.base)},e._destroy=function(){var t=this.ref;t&&t(null)},t}();function E(t){b=t,y=0}var P=function(){function t(t,e){this.props=t=void 0===t?{}:t,this.context=e,this.state={},this.$_timer=0,this.$_state={},this.$_subs=[],this.$_cs={}}var e=t.prototype;return e.render=function(){return null},e.shouldComponentUpdate=function(t,e){return this.props!==t||this.state!==e},e.setState=function(t,e,n){var r=this;this.$_timer||(this.$_state={}),clearTimeout(this.$_timer),this.$_timer=0,this.$_state=f(f({},this.$_state),t),n?this.$_setState(e,n):this.$_timer=window.setTimeout(function(){r.$_timer=0,r.$_setState(e,n)})},e.forceUpdate=function(t){this.setState({},t,!0)},e.componentDidMount=function(){},e.componentDidUpdate=function(t,e){},e.componentWillUnmount=function(){},e.$_setState=function(t,e){var n=[],r=this.$_provider;k(r.container,[r],[r.original],n,r._cs,f(f({},this.state),this.$_state),e)&&(t&&n.push(t),a(n),E(null))},t}(),w=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return o(e,t),e.prototype.shouldComponentUpdate=function(t,e){return u(this.props,t)||u(this.state,e)},e}(P),C=function(u){function t(t,e,n,r,i,o,s){return u.call(this,t,e,n,r,i,o,l(s=void 0===s?{}:s,t.defaultProps))||this}o(t,u);var e=t.prototype;return e._should=function(t,e){return!1!==this.base.shouldComponentUpdate(l(t,this.type.defaultProps),e||this.base.state)},e._render=function(t,e,n){var r,i=this,o=this.type,s=(this.props=l(this.props,this.type.defaultProps),this.props),u=this.base,c=!this.base,a=(this._cs=e,o.contextType),p=(a&&(r=(r=a.$_id)in e?(h=e[r]).props.value:a.$_dv),c?(h&&h.$_subs.push(this),"prototype"in o&&o.prototype.render?u=new o(this.props,r):((u=new P(s,r)).constructor=o,u.render=m),(u.$_provider=this).base=u):(u.props=this.props,u.context=r),u.state),a=u.render(),h=(a&&a.props&&!a.props.children.length&&(a.props.children=this.props.children),f(f({},e),u.$_cs));k(this,this._ps,a?[a]:[],t,h),t.push(function(){c?(i._mounted(),u.componentDidMount()):(i._updated(),u.componentDidUpdate(n,p))})},e._setState=function(t){var e=this.base;e&&t&&(e.state=t)},e._unmount=function(){var e=this,t=(this._ps.forEach(function(t){t._unmount()}),this._cs),n=this.type.contextType;n&&(t=t[n])&&-1<(t=h(n=t.$_subs,function(t){return t===e}))&&n.splice(t,1),clearTimeout(this.base.$_timer),this.base.componentWillUnmount()},t}(g),j=function(){function t(){this.keys=[],this.values=[]}var e=t.prototype;return e.get=function(t){return this.values[this.keys.indexOf(t)]},e.set=function(t,e){var n=this.keys,r=this.values,i=n.indexOf(t),i=-1===i?n.length:i;n[i]=t,r[i]=e},t}(),U=function(){function t(){this.object={}}var e=t.prototype;return e.get=function(t){return this.object[t]},e.set=function(t,e){this.object[t]=e},t}(),D="function"==typeof Map,G=function(){function t(){}var e=t.prototype;return e.connect=function(t,e){this.prev=t,this.next=e,t&&(t.next=this),e&&(e.prev=this)},e.disconnect=function(){var t=this.prev,e=this.next;t&&(t.next=e),e&&(e.prev=t)},e.getIndex=function(){for(var t=this,e=-1;t;)t=t.prev,++e;return e},t}();var V=function(){function t(t,e,n,r,i,o,s,u){this.prevList=t,this.list=e,this.added=n,this.removed=r,this.changed=i,this.maintained=o,this.changedBeforeAdded=s,this.fixed=u}var e=t.prototype;return Object.defineProperty(e,"ordered",{get:function(){return this.cacheOrdered||this.caculateOrdered(),this.cacheOrdered},enumerable:!0,configurable:!0}),Object.defineProperty(e,"pureChanged",{get:function(){return this.cachePureChanged||this.caculateOrdered(),this.cachePureChanged},enumerable:!0,configurable:!0}),e.caculateOrdered=function(){t=this.changedBeforeAdded,n=this.fixed,i=[],o=[],t.forEach(function(t){var e=t[0],t=t[1],n=new G;i[e]=n,o[t]=n}),i.forEach(function(t,e){t.connect(i[e-1])});var n,i,o,t=t.filter(function(t,e){return!n[e]}).map(function(t,e){var n,r=t[0],t=t[1];return r===t?[0,0]:(r=i[r],t=o[t-1],n=r.getIndex(),r.disconnect(),t?r.connect(t,t.next):r.connect(void 0,i[0]),[n,r.getIndex()])}),s=this.changed,u=[];this.cacheOrdered=t.filter(function(t,e){var n=t[0],t=t[1],e=s[e],r=e[0],e=e[1];if(n!==t)return u.push([r,e]),!0}),this.cachePureChanged=u},t}();function S(t,e,n){var r=D?Map:n?U:j,n=n||function(t){return t},i=[],o=[],s=[],u=t.map(n),n=e.map(n),c=new r,a=new r,p=[],h=[],f={},d=[],l=0,v=0;return u.forEach(function(t,e){c.set(t,e)}),n.forEach(function(t,e){a.set(t,e)}),u.forEach(function(t,e){t=a.get(t);void 0===t?(++v,o.push(e)):f[t]=v}),n.forEach(function(t,e){t=c.get(t);void 0===t?(i.push(e),++l):(s.push([t,e]),v=f[e]||0,p.push([t-v,e-l]),h.push(e===t),t!==e&&d.push([t,e]))}),o.reverse(),new V(t,e,i,o,d,s,p,h)}function A(n,r){var i=Object.keys(n),e=Object.keys(r),t=S(i,e,function(t){return t}),o={},s={},u={};return t.added.forEach(function(t){t=e[t];o[t]=r[t]}),t.removed.forEach(function(t){t=i[t];s[t]=n[t]}),t.maintained.forEach(function(t){var t=t[0],t=i[t],e=[n[t],r[t]];n[t]!==r[t]&&(u[t]=e)}),{added:o,removed:s,changed:u}}var R=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t.events={},t._isSVG=!1,t}o(t,e);var n=t.prototype;return n.addEventListener=function(t,e){var n=this.events;n[t]=function(t){t.nativeEvent=t,e(t)},this.base.addEventListener(t,n[t])},n.removeEventListener=function(t){var e=this.events;this.base.removeEventListener(t,e[t]),delete e[t]},n._should=function(t){return u(this.props,t)},n._render=function(t,e,n){var r,i=this,o=!this.base,s=(o&&(s=this._hasSVG(),this._isSVG=s,(c=this.props.portalContainer)||(u=this.type,c=s?document.createElementNS("http://www.w3.org/2000/svg",u):document.createElement(u)),this.base=c),k(this,this._ps,this.props.children,t,e),this.base),u=x(n),c=u.attributes,e=u.events,u=x(this.props),a=u.attributes,u=u.events,c=O(c),a=O(a),p=s,h=(c=A(c,a)).added,a=c.removed,f=c.changed;for(r in h)p.setAttribute(r,h[r]);for(r in f)p.setAttribute(r,f[r][1]);for(r in a)p.removeAttribute(r);var d,a=e,l=this,v=(a=A(a,e=u)).added,e=a.removed,_=a.changed;for(d in e)l.removeEventListener(d);for(d in v)l.addEventListener(d,v[d]);for(d in _)l.removeEventListener(d),l.addEventListener(d,_[d][1]);for(d in e)l.removeEventListener(d);var m,a=n.style||{},e=this.props.style||{},n=s,y=n.style,b=(n=A(a,e)).added,a=n.removed,g=n.changed;for(m in b){var E=$(m,"-");y.setProperty?y.setProperty(E,b[m]):y[E]=b[m]}for(m in g){E=$(m,"-");y.setProperty?y.setProperty(E,g[m][1]):y[E]=g[m][1]}for(m in a){E=$(m,"-");y.removeProperty?y.removeProperty(E):y[E]=""}return t.push(function(){o?i._mounted():i._updated()}),!0},n._unmount=function(){var t,e=this.events,n=this.base;for(t in e)n.removeEventListener(t,e[t]);this._ps.forEach(function(t){t._unmount()}),this.events={},this.props.portalContainer||n.parentNode.removeChild(n)},n._hasSVG=function(){var t;return!(!this._isSVG&&"svg"!==this.type)||(t=v(this.container))&&"ownerSVGElement"in t},t}(g),L=function(n){function t(t,e){e=n.call(this,"container",e,"container",0,null)||this;return e.base=t,e}o(t,n);var e=t.prototype;return e._render=function(){return!0},e._unmount=function(){},t}(g),B=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}o(e,t);var n=e.prototype;return n._render=function(t){var e=this,n=!this.base;return n&&(this.base=document.createTextNode(this.type.replace("text_",""))),t.push(function(){n?e._mounted():e._updated()}),!0},n._unmount=function(){this.base.parentNode.removeChild(this.base)},e}(g);function I(r,i,o){var s=o.map(function(t){return p(t)?null:t.key}),t=S(n(i.map(function(t){return t.key})),n(s),function(t){return t}),e=(t.removed.forEach(function(t){i.splice(t,1)[0]._unmount()}),t.ordered.forEach(function(t){var e=t[0],t=t[1],e=i.splice(e,1)[0],e=(i.splice(t,0,e),_(e.base)),t=_(i[t+1]&&i[t+1].base);e&&e.parentNode.insertBefore(e,t)}),t.added.forEach(function(t){i.splice(t,0,T(o[t],s[t],t,r))}),t.maintained.filter(function(t){t[0];var t=t[1],e=o[t],n=i[t];return(p(e)?"text_"+e:e.type)!==n.type?(n._unmount(),i.splice(t,1,T(e,s[t],t,r)),!0):(n.index=t,!1)}));return function(){for(var t=0,e=0,n=arguments.length;e<n;e++)t+=arguments[e].length;for(var r=Array(t),i=0,e=0;e<n;e++)for(var o=arguments[e],s=0,u=o.length;s<u;s++,i++)r[i]=o[s];return r}(t.added,e.map(function(t){t[0];return t[1]}))}function T(t,e,n,r){var i,o=r.depth+1;return p(t)||"number"==typeof t?new B("text_"+t,o,e,n,r,null,{}):new("string"==typeof(i=t.type)?R:C)(i,o,e,n,r,t.ref,t.props)}function k(n,r,i,o,s,u,c){var t=I(n,r,i),e=r.filter(function(t,e){return t._update(o,s,i[e],u,c)}),a=v(n);return a&&t.reverse().forEach(function(t){var t=r[t],e=_(t.base);e&&a!==e&&!e.parentNode&&(t=function(t,e){for(var n=t._ps,r=n.length,i=e.index+1;i<r;++i){var o=_(n[i].base);if(o)return o}return null}(n,t),a.insertBefore(e,t))}),0<e.length}function M(t,e,n,r){void 0===r&&(r={});var i=!!(n=void 0===n?e.__REACT_COMPAT__:n),o=[];k(n=n||new L(e,0),n._ps,t?[t]:[],o,r),a(o),E(null),i||(e.__REACT_COMPAT__=n)}var W=0;function N(t){function e(t){e.current=t}return e.current=t,e}var q=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t._portalProvider=null,t}o(t,e);var n=t.prototype;return n.componentDidMount=function(){var t=this.props,e=t.element,t=t.container,n=this.$_provider;this._portalProvider=new L(t,n.depth+1),M(e,t,this._portalProvider,n._cs)},n.componentDidUpdate=function(){var t=this.props;M(t.element,t.container,this._portalProvider,this.$_provider._cs)},n.componentWillUnmount=function(){M(null,this.props.container,this._portalProvider,this.$_provider._cs),this._portalProvider=null},t}(w);function z(t){var e=b,e=e._hts||(e._hts=[]),n=y,r=e[n];return y=n+1,r?u(r.deps,t.deps)?e[n]=t:r:(e.push(t),t)}t.Component=P,t.PureComponent=w,t.createContext=function(t){var n="c"+ ++W;function e(t,e){return t.children(e)}return e.contextType=t={$_id:n,$_dv:t,Consumer:e,Provider:function(t){var e=this;return this.$_cs[n]||((this.$_cs[n]=this).shouldComponentUpdate=function(t){t.value!==e.props.value&&(e.$_req=!0)},this.render=function(){return e.props.children[0]},this.$_subs=[]),t.children[0]}}},t.createElement=c,t.createPortal=function(t,e){return c(q,{element:t,container:e})},t.createRef=N,t.findDOMNode=_,t.render=function(t,e,n){var r=e.__REACT_COMPAT__;t&&!r&&(e.innerHTML=""),M(t,e,r),n&&n()},t.useMemo=function(t,e){},t.useRef=function(t){return z({type:0,value:N(t),deps:[]}).value},t.version="simple-1.1.0"}); //# sourceMappingURL=croact.umd.js.map