UNPKG

doz

Version:

A JavaScript framework for building UI, almost like writing in VanillaJS.

1 lines 3.53 kB
!function(t){if(t.Proxy)return;let e=null;function n(t){return!!t&&("object"==typeof t||"function"==typeof t)}t.Proxy=function(t,r){if(!n(t)||!n(r))throw new TypeError("Cannot create proxy with a non-object as target or handler");let o=function(){};e=function(){o=function(t){throw new TypeError("Cannot perform '"+t+" on a proxy that has been revoked")}};const l=r;r={get:null,set:null,deleteProperty:null,apply:null,construct:null};for(let t in l){if(!(t in r))throw new TypeError("Proxy polyfill does not support trap '"+t+"'");r[t]=l[t]}"function"==typeof l&&(r.apply=l.apply.bind(l));let i=this,p=!1,c=!1;"function"==typeof t?(i=function(){const e=this&&this.constructor===i,n=Array.prototype.slice.call(arguments);if(o(e?"construct":"apply"),e&&r.construct)return r.construct.call(this,t,n);if(!e&&r.apply)return r.apply(t,this,n);if(e){return n.unshift(t),new(t.bind.apply(t,n))}return t.apply(this,n)},p=!0):t instanceof Array&&(i=[],c=!0);const h=r.get?function(t){return o("get"),r.get(this,t,i)}:function(t){return o("get"),this[t]},g=r.set?function(t,e){o("set");r.set(this,t,e,i)}:function(t,e){o("set"),this[t]=e},f=r.deleteProperty?function(t){return o("deleteProperty"),r.deleteProperty(this,t)}:function(t){o("get"),delete this[t]},u=Object.getOwnPropertyNames(t),a={};u.forEach(function(e){if((p||c)&&e in i)return;const n=Object.getOwnPropertyDescriptor(t,e),r={enumerable:!!n.enumerable,configurable:!!n.configurable,get:h.bind(t,e),set:g.bind(t,e)};Object.defineProperty(i,e,r),a[e]=!0});let s=!0;if(Object.setPrototypeOf?Object.setPrototypeOf(i,Object.getPrototypeOf(t)):i.__proto__?i.__proto__=t.__proto__:s=!1,r.get||!s)for(let e in t)a[e]||Object.defineProperty(i,e,{get:h.bind(t,e)});i.__isProxy=!0,i.__getTarget=t;let y=function(t,e){return{enumerable:!0,configurable:!0,get:h.bind(t,e),set:g.bind(t,e)}};return i instanceof Array?(i.unshift=function(){let e=i.length;t.length=i.length=t.length+arguments.length;for(let n=0;n<arguments.length;n++){let r=(n+e).toString();Object.defineProperty(i,r,y(t,r))}var n=Array.prototype.unshift.apply(this,arguments);return i.length=n=t.length,n},i.push=function(){t.length=i.length=t.length+1;let e=(t.length-1).toString();Object.defineProperty(i,e,y(t,e));var n=Array.prototype.push.apply(this,arguments);return i[i.length-2]=i[i.length-1],i.length=t.length,n},i.pop=function(){let e=(t.length-1).toString();var n=Array.prototype.pop.apply(this,arguments);return f.call(t,e),i.length=t.length,g.call(t,"length",t.length-1),i.length=t.length,n},i.splice=function(e,n,r){if(n<0&&(n=0),n>0){if(void 0!==r)var o=e+1,l=n-1;else o=e,l=n;for(var p=[],c=e+n-1;c>=o;c--){let e=c.toString();p.unshift(t[e]),f.call(t,e)}var h=Array.prototype.splice.apply(this,arguments);if(void 0!==r)for(c=1;c<h.length;c++)h[c]=p[c-1];else for(c=0;c<h.length;c++)h[c]=p[c];return i.length=t.length,g.call(t,"length",t.length-l),i.length=t.length,h}if(void 0!==r){t.length=i.length=t.length+1;let e=(t.length-1).toString();Object.defineProperty(i,e,y(t,e));h=Array.prototype.splice.apply(this,arguments);return i.length=t.length,h}return[]},i.shift=function(){for(var e=t[0],n=0;n<t.length-1;n++)g.call(t,n.toString(),t[n+1]);return f.call(t,(t.length-1).toString()),i.length=t.length,g.call(t,"length",t.length-1),i.length=t.length,e}):(Object.seal(t),Object.seal(i)),i},t.Proxy.revocable=function(n,r){return{proxy:new t.Proxy(n,r),revoke:e}},t.Proxy.revocable=t.Proxy.revocable,t.Proxy=t.Proxy}("undefined"!=typeof process&&"[object process]"==={}.toString.call(process)?global:self);