mirror of
https://github.com/troisjs/trois.git
synced 2024-11-24 12:22:03 +08:00
2 lines
694 KiB
JavaScript
2 lines
694 KiB
JavaScript
|
function t(t,e){const n=Object.create(null),i=t.split(",");for(let t=0;t<i.length;t++)n[i[t]]=!0;return e?t=>!!n[t.toLowerCase()]:t=>!!n[t]}const e=t("Infinity,undefined,NaN,isFinite,isNaN,parseFloat,parseInt,decodeURI,decodeURIComponent,encodeURI,encodeURIComponent,Math,Number,Date,Array,Object,Boolean,String,RegExp,Map,Set,JSON,Intl"),n=t("itemscope,allowfullscreen,formnovalidate,ismap,nomodule,novalidate,readonly");function i(t){if(b(t)){const e={};for(let n=0;n<t.length;n++){const r=t[n],o=i(w(r)?s(r):r);if(o)for(const t in o)e[t]=o[t]}return e}if(S(t))return t}const r=/;(?![^(]*\))/g,o=/:(.+)/;function s(t){const e={};return t.split(r).forEach(t=>{if(t){const n=t.split(o);n.length>1&&(e[n[0].trim()]=n[1].trim())}}),e}function a(t){let e="";if(w(t))e=t;else if(b(t))for(let n=0;n<t.length;n++)e+=a(t[n])+" ";else if(S(t))for(const n in t)t[n]&&(e+=n+" ");return e.trim()}const c=(t,e)=>e instanceof Map?{[`Map(${e.size})`]:[...e.entries()].reduce((t,[e,n])=>(t[e+" =>"]=n,t),{})}:e instanceof Set?{[`Set(${e.size})`]:[...e.values()]}:!S(e)||b(e)||L(e)?e:String(e),l={},h=[],u=()=>{},p=()=>!1,d=/^on[^a-z]/,f=t=>d.test(t),m=t=>t.startsWith("onUpdate:"),g=Object.assign,v=(t,e)=>{const n=t.indexOf(e);n>-1&&t.splice(n,1)},y=Object.prototype.hasOwnProperty,x=(t,e)=>y.call(t,e),b=Array.isArray,_=t=>"function"==typeof t,w=t=>"string"==typeof t,M=t=>"symbol"==typeof t,S=t=>null!==t&&"object"==typeof t,T=t=>S(t)&&_(t.then)&&_(t.catch),E=Object.prototype.toString,A=t=>E.call(t),L=t=>"[object Object]"===A(t),R=t=>w(t)&&"-"!==t[0]&&""+parseInt(t,10)===t,P=t("key,ref,onVnodeBeforeMount,onVnodeMounted,onVnodeBeforeUpdate,onVnodeUpdated,onVnodeBeforeUnmount,onVnodeUnmounted"),C=t=>{const e=Object.create(null);return n=>e[n]||(e[n]=t(n))},O=/-(\w)/g,N=C(t=>t.replace(O,(t,e)=>e?e.toUpperCase():"")),I=/\B([A-Z])/g,D=C(t=>t.replace(I,"-$1").toLowerCase()),z=C(t=>t.charAt(0).toUpperCase()+t.slice(1)),U=(t,e)=>t!==e&&(t==t||e==e),B=(t,e)=>{for(let n=0;n<t.length;n++)t[n](e)},F=(t,e,n)=>{Object.defineProperty(t,e,{configurable:!0,enumerable:!1,value:n})},H=new WeakMap,G=[];let k;const j=Symbol(""),V=Symbol("");function W(t,e=l){(function(t){return t&&!0===t._isEffect})(t)&&(t=t.raw);const n=function(t,e){const n=function(){if(!n.active)return e.scheduler?void 0:t();if(!G.includes(n)){Y(n);try{return J.push(Z),Z=!0,G.push(n),k=n,t()}finally{G.pop(),Q(),k=G[G.length-1]}}};return n.id=X++,n._isEffect=!0,n.active=!0,n.raw=t,n.deps=[],n.options=e,n}(t,e);return e.lazy||n(),n}function q(t){t.active&&(Y(t),t.options.onStop&&t.options.onStop(),t.active=!1)}let X=0;function Y(t){const{deps:e}=t;if(e.length){for(let n=0;n<e.length;n++)e[n].delete(t);e.length=0}}let Z=!0;const J=[];function K(){J.push(Z),Z=!1}function Q(){const t=J.pop();Z=void 0===t||t}function $(t,e,n){if(!Z||void 0===k)return;let i=H.get(t);i||H.set(t,i=new Map);let r=i.get(n);r||i.set(n,r=new Set),r.has(k)||(r.add(k),k.deps.push(r))}function tt(t,e,n,i,r,o){const s=H.get(t);if(!s)return;const a=new Set,c=t=>{t&&t.forEach(t=>{t!==k&&a.add(t)})};if("clear"===e)s.forEach(c);else if("length"===n&&b(t))s.forEach((t,e)=>{("length"===e||e>=i)&&c(t)});else{void 0!==n&&c(s.get(n));const i="add"===e&&(!b(t)||R(n))||"delete"===e&&!b(t);(i||"set"===e&&t instanceof Map)&&c(s.get(b(t)?"length":j)),i&&t instanceof Map&&c(s.get(V))}a.forEach(t=>{t.options.scheduler?t.options.scheduler(t):t()})}const et=new Set(Object.getOwnPropertyNames(Symbol).map(t=>Symbol[t]).filter(M)),nt=at(),it=at(!1,!0),rt=at(!0),ot=at(!0,!0),st={};function at(t=!1,e=!1){return function(n,i,r){if("__v_isReactive"===i)return!t;if("__v_isReadonly"===i)return t;if("__v_raw"===i&&r===(t?It:Nt).get(n))return n;const o=b(n);if(o&&x(st,i))return Reflect.get(st,i,r);const s=Reflect.get(n,i,r);if(M(i)?et.has(i):"__proto__"===i||"__v_isRef"===i)return s;if(t||$(n,0,i),e)return s;if(jt(s)){return!o||!R(i)?s.value:s}return S(s)?t?Ut(s):zt(s):s}}["includes","indexOf","lastIndexOf"].forEach(t=>{st[t]=function(...e){const n=kt(this);for(let t=0,e=this.length;t<e;t++)$(n,0,t+"");const i=n[t](...e);return-1===i||!1===i?n[t](...e.map(kt)):i}});f
|