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