oops-ui 0.0.2 → 0.0.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/BackgroundRipple/index.cjs +1 -0
- package/dist/BackgroundRipple/index.mjs +1 -0
- package/dist/index.cjs +1 -0
- package/dist/index.mjs +1 -0
- package/dist/styles/common.css +351 -0
- package/dist/styles/common.scss +501 -0
- package/dist/types/components/index.d.ts +1 -0
- package/dist/types/components/ripples/RipplesEle.d.ts +27 -0
- package/dist/types/components/ripples/index.d.ts +1 -0
- package/dist/types/customHooks/index.d.ts +3 -0
- package/dist/types/customHooks/useAnimationFrame.d.ts +37 -0
- package/dist/types/customHooks/useRipples/index.d.ts +41 -0
- package/dist/types/{ripples → customHooks/useRipples}/interface.d.ts +16 -2
- package/dist/types/customHooks/useTimeId.d.ts +42 -0
- package/dist/types/index.d.ts +2 -2
- package/dist/useAnimationFrame/index.cjs +1 -0
- package/dist/useAnimationFrame/index.mjs +1 -0
- package/dist/useRipples/index.cjs +1 -0
- package/dist/useRipples/index.mjs +1 -0
- package/dist/useTimeId/index.cjs +1 -0
- package/dist/useTimeId/index.mjs +1 -0
- package/package.json +39 -5
- package/dist/index.cms.js +0 -1
- package/dist/index.ems.js +0 -1
- package/dist/types/ripples/RipplesEle.d.ts +0 -12
- package/dist/types/ripples/index.d.ts +0 -1
- /package/dist/types/{button → components/button}/button.d.ts +0 -0
- /package/dist/types/{button → components/button}/index.d.ts +0 -0
- /package/dist/types/{button → components/button}/style/index.d.ts +0 -0
- /package/dist/types/{layout → components/layout}/header.d.ts +0 -0
- /package/dist/types/{layout → components/layout}/index.d.ts +0 -0
- /package/dist/types/{layout → components/layout}/interface.d.ts +0 -0
- /package/dist/types/{layout → components/layout}/layout.d.ts +0 -0
- /package/dist/types/{menu → components/menu}/index.d.ts +0 -0
- /package/dist/types/{menu → components/menu}/menu.d.ts +0 -0
- /package/dist/types/{menu → components/menu}/style/index.d.ts +0 -0
- /package/dist/types/{ripples → components/ripples}/style/index.d.ts +0 -0
- /package/dist/types/{ripples → customHooks/useRipples}/defaultData.d.ts +0 -0
- /package/dist/types/{ripples → customHooks/useRipples}/rippersData/createImageData.d.ts +0 -0
- /package/dist/types/{ripples → customHooks/useRipples}/rippersData/index.d.ts +0 -0
- /package/dist/types/{ripples → customHooks/useRipples}/rippersData/loadConfig.d.ts +0 -0
- /package/dist/types/{ripples → customHooks/useRipples}/ripplesClass.d.ts +0 -0
- /package/dist/types/{ripples → customHooks/useRipples}/tools.d.ts +0 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
(()=>{"use strict";var e={982:(e,t,r)=>{r.d(t,{useRipples:()=>ye});var n=r(953);const i=require("a-element-inline-style");function o(e){var t=/url\(["']?([^"']*)["']?\)/.exec(e);return null==t?null:t[1]}function a(e,t,r,n){function i(e,t){var n=r.createShader(e);if(r.shaderSource(n,t),r.compileShader(n),!r.getShaderParameter(n,r.COMPILE_STATUS))throw new Error("compile error: "+r.getShaderInfoLog(n));return n}var o,a={id:r.createProgram(),uniforms:{},locations:{}};if(r.attachShader(a.id,i(r.VERTEX_SHADER,e)),r.attachShader(a.id,i(r.FRAGMENT_SHADER,t)),r.linkProgram(a.id),!r.getProgramParameter(a.id,r.LINK_STATUS))throw new Error("link error: "+r.getProgramInfoLog(a.id));r.useProgram(a.id),r.enableVertexAttribArray(0);for(var s=e+t,l=/uniform (\w+) (\w+)/g;null!==(o=l.exec(s));){var u=o[2];a.locations[u]=r.getUniformLocation(a.id,u)}return a}function s(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,r=this.gl;r.activeTexture(r.TEXTURE0+(t||0)),r.bindTexture(r.TEXTURE_2D,e)}function l(e){return e.endsWith("%")}function u(){var e=this,t=function(){return e.initState=!1,null};if(!this.gl)return t();var r=this.gl,n=Object.fromEntries(["OES_texture_float","OES_texture_half_float","OES_texture_float_linear","OES_texture_half_float_linear"].reduce((function(e,t){var n=r.getExtension(t);return n&&e.push([t,n]),e}),[]));if(!n.OES_texture_float)return t();var i=[];function o(e,t,r){var i="OES_texture_"+e,o=i+"_linear",a=o in n;return{type:t,linearSupport:a,arrayType:r,extensions:a?[i,o]:[i]}}i.push(o("float",r.FLOAT,Float32Array)),n.OES_texture_half_float&&i.push(o("half_float",n.OES_texture_half_float.HALF_FLOAT_OES,null));var a=r.createTexture(),s=r.createFramebuffer();r.bindFramebuffer(r.FRAMEBUFFER,s),r.bindTexture(r.TEXTURE_2D,a),r.texParameteri(r.TEXTURE_2D,r.TEXTURE_MIN_FILTER,r.NEAREST),r.texParameteri(r.TEXTURE_2D,r.TEXTURE_MAG_FILTER,r.NEAREST),r.texParameteri(r.TEXTURE_2D,r.TEXTURE_WRAP_S,r.CLAMP_TO_EDGE),r.texParameteri(r.TEXTURE_2D,r.TEXTURE_WRAP_T,r.CLAMP_TO_EDGE);for(var l=null,u=0;u<i.length;u++)if(r.texImage2D(r.TEXTURE_2D,0,r.RGBA,32,32,0,r.RGBA,i[u].type,null),r.framebufferTexture2D(r.FRAMEBUFFER,r.COLOR_ATTACHMENT0,r.TEXTURE_2D,a,0),r.checkFramebufferStatus(r.FRAMEBUFFER)===r.FRAMEBUFFER_COMPLETE){l=i[u];break}return l}function c(e){return c="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},c(e)}function f(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,p(n.key),n)}}function h(e,t,r){return t&&f(e.prototype,t),r&&f(e,r),Object.defineProperty(e,"prototype",{writable:!1}),e}function d(e,t,r){return(t=p(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function p(e){var t=function(e){if("object"!=c(e)||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var r=t.call(e,"string");if("object"!=c(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==c(t)?t:t+""}var m="lmssee_ripper_element_style",v=h((function e(t){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),d(this,"styleElement",document.createElement("style")),d(this,"canvas",void 0),d(this,"gl",void 0),d(this,"config",void 0),d(this,"transparentPixels",function(){try{return new ImageData(32,32)}catch(e){return console.log(e&&""),document.createElement("canvas").getContext("2d").createImageData(32,32)}}()),d(this,"initState",!0),this.canvas=t;var r=t.getContext("webgl");if(null===r)return this.initState=!1,void(this.config=null);if(this.gl=r,null===document.querySelector("style#".concat(m))){var n=this.styleElement;n.id=m,n.innerHTML="\n .lmssee-ripples { \n position: relative; \n z-index: 0; \n top: 0;\n left: 0;\n width: 100%;\n height: 100%;\n transform: translate(0,0);\n }\n ";var i=document.head;i.prepend?i.prepend(n):i.insertBefore(n,i.firstChild)}this.config=Reflect.apply(u,this,[])})),g={imageUrl:"",resolution:360,dropRadius:10,perturbance:.03,interactive:!0,crossOrigin:"",playingState:!0,accelerating:3,raindropsTimeInterval:660,idleFluctuations:!0};function E(e){return E="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},E(e)}function y(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function b(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?y(Object(r),!0).forEach((function(t){F(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):y(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}function T(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,A(n.key),n)}}function R(e,t){if(t&&("object"==E(t)||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e)}function w(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(e){}return(w=function(){return!!e})()}function _(e){return _=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},_(e)}function x(e,t){return x=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},x(e,t)}function P(e,t,r){S(e,t),t.set(e,r)}function S(e,t){if(t.has(e))throw new TypeError("Cannot initialize the same private elements twice on an object")}function F(e,t,r){return(t=A(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function A(e){var t=function(e){if("object"!=E(e)||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var r=t.call(e,"string");if("object"!=E(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==E(t)?t:t+""}function O(e,t){return e.get(D(e,t))}function k(e,t,r){return e.set(D(e,t),r),r}function D(e,t,r){if("function"==typeof e?e===t:e.has(t))return arguments.length<3?t:r;throw new TypeError("Private element is not present on this object")}Object.freeze(g);var U=new WeakMap,M=new WeakMap,L=new WeakMap,C=new WeakMap,I=new WeakMap,j=new WeakMap,W=new WeakMap,X=new WeakMap,B=new WeakMap,N=new WeakMap,G=new WeakMap,z=new WeakMap,H=new WeakMap,Y=new WeakMap,q=new WeakMap,K=new WeakMap,V=new WeakMap,J=new WeakMap,Q=new WeakMap,Z=new WeakMap,$=new WeakMap,ee=new WeakMap,te=new WeakMap,re=new WeakMap,ne=new WeakSet,ie=function(e){function t(e,r,n){var o,a,s;!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),o=function(e,t,r){return t=_(t),R(e,w()?Reflect.construct(t,r||[],_(e).constructor):t.apply(e,r))}(this,t,[e]),S(a=o,s=ne),s.add(a),F(o,"defaults",g),F(o,"interactive",o.defaults.interactive),P(o,U,o.defaults.accelerating),P(o,M,o.defaults.resolution),P(o,L,o.defaults.perturbance),F(o,"dropRadius",void 0),F(o,"crossOrigin",""),F(o,"imageUrl",void 0),F(o,"idleFluctuations",!0),P(o,C,void 0),P(o,I,void 0),P(o,j,[]),P(o,W,[]),P(o,X,0),P(o,B,1),P(o,N,void 0),P(o,G,!1),P(o,z,!1),P(o,H,!1),P(o,Y,0),P(o,q,""),F(o,"imageSource",""),F(o,"renderProgram",void 0),P(o,K,void 0),P(o,V,void 0),P(o,J,void 0),P(o,Q,void 0),P(o,Z,void 0),P(o,$,void 0),P(o,ee,Date.now()),P(o,te,o.defaults.raindropsTimeInterval),P(o,re,{mousemove:function(e){return console.log(e)},mousedown:function(e){return console.log(e)},touchmove:function(e){return console.log(e)},touchstart:function(e){return console.log(e)}}),Object.defineProperties(o,{defaults:{value:o.defaults,writable:!1,enumerable:!1,configurable:!1}}),n&&"boolean"!=typeof n.interactive&&delete n.interactive;var l=b(b({},o.defaults),n);if(o.interactive=l.interactive,o.resolution=l.resolution,o.perturbance=l.perturbance,o.dropRadius=l.dropRadius,o.crossOrigin=l.crossOrigin,o.imageUrl=l.imageUrl,o.idleFluctuations=l.idleFluctuations,!1===o.initState||null===e.parentElement||null===o.config||null===o.gl)return o.initState=!1,R(o);var u=o.gl,c=1/O(M,o);k(I,o,new Float32Array([c,c])),k(C,o,e.parentElement),function(e){var t=e.parentElement;e.width=t.clientWidth,e.height=t.clientHeight,(0,i.setStyle)(e,{position:"absolute",left:0,top:0,right:0,bottom:0,zIndex:-1})}(e),o.config.extensions.forEach((function(e){return u.getExtension(e)})),o.updateSize=o.updateSize.bind(o),window.addEventListener("resize",o.updateSize);for(var f=o.config.arrayType,h=f?new f(O(M,o)*O(M,o)*4):null,d=o.config,p=0;p<2;p++){var m=u.createTexture(),v=u.createFramebuffer();u.bindFramebuffer(u.FRAMEBUFFER,v),u.bindTexture(u.TEXTURE_2D,m),u.texParameteri(u.TEXTURE_2D,u.TEXTURE_MIN_FILTER,d.linearSupport?u.LINEAR:u.NEAREST),u.texParameteri(u.TEXTURE_2D,u.TEXTURE_MAG_FILTER,d.linearSupport?u.LINEAR:u.NEAREST),u.texParameteri(u.TEXTURE_2D,u.TEXTURE_WRAP_S,u.CLAMP_TO_EDGE),u.texParameteri(u.TEXTURE_2D,u.TEXTURE_WRAP_T,u.CLAMP_TO_EDGE),u.texImage2D(u.TEXTURE_2D,0,u.RGBA,O(M,o),O(M,o),0,u.RGBA,d.type,h),u.framebufferTexture2D(u.FRAMEBUFFER,u.COLOR_ATTACHMENT0,u.TEXTURE_2D,m,0),O(j,o).push(m),O(W,o).push(v)}return k(N,o,u.createBuffer()),u.bindBuffer(u.ARRAY_BUFFER,O(N,o)),u.bufferData(u.ARRAY_BUFFER,new Float32Array([-1,-1,1,-1,1,1,-1,1]),u.STATIC_DRAW),D(ne,o,de).call(o),D(ne,o,pe).call(o),D(ne,o,me).call(o),D(ne,o,ae).call(o),u.clearColor(0,0,0,0),u.blendFunc(u.SRC_ALPHA,u.ONE_MINUS_SRC_ALPHA),k(G,o,!0),k(z,o,!0),k(H,o,!0),D(ne,o,oe).call(o),k(Y,o,requestAnimationFrame((function(){return D(ne,o,se).call(o)}))),o}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&x(e,t)}(t,e),r=t,n=[{key:"accelerating",set:function(e){e>100||e<2||k(U,this,e)}},{key:"resolution",set:function(e){e<100||e>550||k(M,this,e)}},{key:"perturbance",set:function(e){e<1e-4||e>1||k(L,this,e)}},{key:"playingState",set:function(e){k(z,this,!1!==e)}},{key:"initialized",get:function(){return O(H,this)}},{key:"raindropsTimeInterval",set:function(e){e<10||e>12e3||k(te,this,e)}},{key:"raindropsFall",value:function(){var e=window.getComputedStyle(O(C,this)),t=function(e){return function(e=1,t=0){let r=Math.ceil(Number(t)),n=Math.floor(Number(e));return r>n&&([n,r]=[r,n]),Math.floor(Math.random()*(n-r+1)+r)}(parseInt(e))},r=e.width,n=e.height;this.drop(t(r),t(n),1.5*this.dropRadius,.14)}},{key:"drop",value:function(e,t,r,n){var i=this.gl,o=O(C,this).offsetWidth,a=O(C,this).offsetHeight,l=Math.max(o,a);r/=l;var u=new Float32Array([(2*e-o)/l,(a-2*t)/l]);i.viewport(0,0,O(M,this),O(M,this)),i.bindFramebuffer(i.FRAMEBUFFER,O(W,this)[O(X,this)]),Reflect.apply(s,this,[O(j,this)[O(B,this)]]),i.useProgram(O(J,this).id),i.uniform2fv(O(J,this).locations.center,u),i.uniform1f(O(J,this).locations.radius,r),i.uniform1f(O(J,this).locations.strength,n),D(ne,this,le).call(this),D(ne,this,fe).call(this)}},{key:"updateSize",value:function(){var e=O(C,this).offsetWidth,t=O(C,this).offsetHeight;e==this.canvas.width&&t==this.canvas.height||(this.canvas.width=e,this.canvas.height=t)}},{key:"destroy",value:function(){var e=this,t=O(C,this);t&&(Object.keys(O(re,this)).forEach((function(r){return t.removeEventListener&&t.removeEventListener(r,O(re,e)[r])})),t.removeAttribute&&t.removeAttribute("data-ripples")),this.styleElement&&this.styleElement.remove(),this.gl=null,this.gl&&(this.gl=null),window.removeEventListener("resize",this.updateSize),D(ne,this,ge).call(this),O(Y,this)&&window.cancelAnimationFrame(O(Y,this))}},{key:"show",value:function(){k(G,this,!0),this.canvas.style.visibility="visible",D(ne,this,ve).call(this)}},{key:"hide",value:function(){k(G,this,!1),this.canvas.style.visibility="hidden",D(ne,this,ge).call(this)}},{key:"pause",value:function(){k(z,this,!1)}},{key:"play",value:function(){k(z,this,!0)}},{key:"changePlayingState",value:function(){k(z,this,!O(z,this))}},{key:"set",value:function(e,t){"imageUrl"===e?(this.imageUrl=t,D(ne,this,ae).call(this)):this[e]=t}}],n&&T(r.prototype,n),Object.defineProperty(r,"prototype",{writable:!1}),r;var r,n}(v);function oe(){var e=this,t=function(t){var r=arguments.length>1&&void 0!==arguments[1]&&arguments[1];O(G,e)&&O(z,e)&&e.interactive&&(k(ee,e,Date.now()),D(ne,e,Ee).call(e,t,e.dropRadius*(r?1.5:1),r?.14:.01))};O(re,this).mousemove=function(r){for(var n=O(U,e);n--;)t(r)},O(re,this).touchmove=O(re,this).touchstart=function(e){for(var r=e.touches,n=0;n<r.length;n++)t(r[n])},O(re,this).mousedown=function(e){return t(e,!0)},Object.keys(O(re,this)).forEach((function(t){return O(C,e)&&O(C,e).addEventListener(t,O(re,e)[t],{passive:!0})}))}function ae(){var e=this,t=this.gl,r=this.imageUrl||o(O(q,this))||o(window.getComputedStyle(O(C,this)).backgroundImage);if(r!==this.imageSource)if(this.imageSource=r,this.imageSource){var n=new Image;n.onload=function(){var r=function(e){return!(e&e-1)},i=r(n.width)&&r(n.height)?t.REPEAT:t.CLAMP_TO_EDGE;t.bindTexture(t.TEXTURE_2D,O(K,e)),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_WRAP_S,i),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_WRAP_T,i),t.texImage2D(t.TEXTURE_2D,0,t.RGBA,t.RGBA,t.UNSIGNED_BYTE,n),k(Q,e,n.width),k(Z,e,n.height),D(ne,e,ve).call(e)},n.onerror=function(){return D(ne,e,me).call(e)},n.crossOrigin=this.imageSource.match(/^data:/)?null:this.crossOrigin,n.src=this.imageSource}else D(ne,this,me).call(this)}function se(){var e=this;O(G,this)&&(D(ne,this,he).call(this),O(z,this)&&D(ne,this,ce).call(this),D(ne,this,ue).call(this),k(Y,this,requestAnimationFrame((function(){return D(ne,e,se).call(e)}))))}function le(){var e=this.gl;e.bindBuffer(e.ARRAY_BUFFER,O(N,this)),e.vertexAttribPointer(0,2,e.FLOAT,!1,0,0),e.drawArrays(e.TRIANGLE_FAN,0,4)}function ue(){var e=this.gl;e.bindFramebuffer(e.FRAMEBUFFER,null),e.viewport(0,0,this.canvas.width,this.canvas.height),e.enable(e.BLEND),e.clear(e.COLOR_BUFFER_BIT|e.DEPTH_BUFFER_BIT),e.useProgram(this.renderProgram.id),Reflect.apply(s,this,[O(K,this),0]),Reflect.apply(s,this,[O(j,this)[0],1]),e.uniform1f(this.renderProgram.locations.perturbance,O(L,this)),e.uniform2fv(this.renderProgram.locations.topLeft,this.renderProgram.uniforms.topLeft),e.uniform2fv(this.renderProgram.locations.bottomRight,this.renderProgram.uniforms.bottomRight),e.uniform2fv(this.renderProgram.locations.containerRatio,this.renderProgram.uniforms.containerRatio),e.uniform1i(this.renderProgram.locations.samplerBackground,0),e.uniform1i(this.renderProgram.locations.samplerRipples,1),D(ne,this,le).call(this),e.disable(e.BLEND)}function ce(){if(this.idleFluctuations){var e=Date.now();e-O(ee,this)>O(te,this)&&(k(ee,this,e),this.raindropsFall())}var t=this.gl;t.viewport(0,0,O(M,this),O(M,this)),t.bindFramebuffer(t.FRAMEBUFFER,O(W,this)[O(X,this)]),Reflect.apply(s,this,[O(j,this)[O(B,this)]]),t.useProgram(O(V,this).id),D(ne,this,le).call(this),D(ne,this,fe).call(this)}function fe(){k(X,this,1-O(X,this)),k(B,this,1-O(B,this))}function he(){var e,t,r,n=window.getComputedStyle(O(C,this)).backgroundSize,i=window.getComputedStyle(O(C,this)).backgroundAttachment,o=(e=window.getComputedStyle(O(C,this)).backgroundPosition,/\s+/.test(e)?e.replace(/center/,"50%").replace(/top|left/,"0%").replace(/bottom/,"100%").replace(/\s+/," ").split(" "):l(e)?[e,"50%"]:{center:["50%","50%"],top:["50%","0%"],bottom:["50%","100%"],left:["0%","50%"],right:["100%","50%"]}[e]),a="fixed"==i?{left:window.scrollX,top:window.scrollY,width:window.innerWidth,height:window.innerHeight}:{left:O(C,this).getBoundingClientRect().left,top:O(C,this).getBoundingClientRect().top,width:O(C,this).scrollWidth,height:O(C,this).scrollHeight};if("cover"==n){var s=Math.max(a.width/O(Q,this),a.height/O(Z,this));t=O(Q,this)*s,r=O(Z,this)*s}else if("contain"==n){var u=Math.min(a.width/O(Q,this),a.height/O(Z,this));t=O(Q,this)*u,r=O(Z,this)*u}else{var c=n.split(" ");t=c[0]||"",r=c[1]||t,l(t)?t=a.width*parseFloat(t)/100:"auto"!==t&&(t=parseFloat(t)),l(r)?r=a.height*parseFloat(r)/100:"auto"!==r&&(r=parseFloat(r)),"auto"==t&&"auto"==r?(t=O(Q,this),r=O(Z,this)):("auto"==t&&(t=O(Q,this)*(Number(r)/O(Z,this))),"auto"==r&&(r=O(Z,this)*(Number(t)/O(Q,this))))}var f=o&&o[0]||"0%",h=o&&o[1]||"0%";f=l(f)?(a.left+(a.width-Number(t))*parseFloat(f)/100).toString():(a.left+parseFloat(f)).toString(),h=l(h)?(a.top+(a.height-Number(r))*parseFloat(h)/100).toString():(a.top+parseFloat(h)).toString(),this.renderProgram.uniforms.topLeft=new Float32Array([(O(C,this).offsetLeft-Number(f))/Number(t),(O(C,this).offsetTop-Number(h))/Number(r)]),this.renderProgram.uniforms.bottomRight=new Float32Array([this.renderProgram.uniforms.topLeft[0]+O(C,this).clientWidth/Number(t),this.renderProgram.uniforms.topLeft[1]+O(C,this).clientHeight/Number(r)]);var d=Math.max(this.canvas.width,this.canvas.height);this.renderProgram.uniforms.containerRatio=new Float32Array([this.canvas.width/d,this.canvas.height/d])}function de(){var e=this.gl,t="\n attribute vec2 vertex;\n varying vec2 coord;\n void main() {\n coord = vertex * 0.5 + 0.5;\n gl_Position = vec4(vertex, 0.0, 1.0);\n }";k(J,this,a(t,"precision highp float;\n\n const float PI = 3.141592653589793;\n uniform sampler2D texture;\n uniform vec2 center;\n uniform float radius;\n uniform float strength;\n\n varying vec2 coord;\n\n void main() {\n vec4 info = texture2D(texture, coord);\n\n float drop = max(0.0, 1.0 - length(center * 0.5 + 0.5 - coord) / radius);\n drop = 0.5 - cos(drop * PI) * 0.5;\n info.r += drop * strength;\n gl_FragColor = info;\n }",e)),k(V,this,a(t,"precision highp float;\n\n uniform sampler2D texture;\n uniform vec2 delta;\n\n varying vec2 coord;\n\n void main() {\n vec4 info = texture2D(texture, coord);\n \n vec2 dx = vec2(delta.x, 0.0);\n vec2 dy = vec2(0.0, delta.y);\n \n float average = (\n texture2D(texture, coord - dx).r +\n texture2D(texture, coord - dy).r +\n texture2D(texture, coord + dx).r +\n texture2D(texture, coord + dy).r\n ) * 0.25;\n \n info.g += (average - info.r) * 2.0;\n info.g *= 0.995;\n info.r += info.g;\n \n gl_FragColor = info;\n }\n ",this.gl)),e.uniform2fv(O(V,this).locations.delta,O(I,this)),this.renderProgram=a("\n precision highp float;\n\n attribute vec2 vertex;\n uniform vec2 topLeft;\n uniform vec2 bottomRight;\n uniform vec2 containerRatio;\n varying vec2 ripplesCoord;\n varying vec2 backgroundCoord;\n void main() {\n backgroundCoord = mix(topLeft, bottomRight, vertex * 0.5 + 0.5);\n backgroundCoord.y = 1.0 - backgroundCoord.y;\n ripplesCoord = vec2(vertex.x, -vertex.y) * containerRatio * 0.5 + 0.5;\n gl_Position = vec4(vertex.x, -vertex.y, 0.0, 1.0);\n }\n ","\n precision highp float;\n\n uniform sampler2D samplerBackground;\n uniform sampler2D samplerRipples;\n uniform vec2 delta;\n\n uniform float perturbance;\n varying vec2 ripplesCoord;\n varying vec2 backgroundCoord;\n\n void main() {\n float height = texture2D(samplerRipples, ripplesCoord).r;\n float heightX = texture2D(samplerRipples, vec2(ripplesCoord.x + delta.x, ripplesCoord.y)).r;\n float heightY = texture2D(samplerRipples, vec2(ripplesCoord.x, ripplesCoord.y + delta.y)).r;\n vec3 dx = vec3(delta.x, heightX - height, 0.0);\n vec3 dy = vec3(0.0, heightY - height, delta.y);\n vec2 offset = -normalize(cross(dy, dx)).xz;\n float specular = pow(max(0.0, dot(offset, normalize(vec2(-0.6, 1.0)))), 4.0);\n gl_FragColor = texture2D(samplerBackground, backgroundCoord + offset * perturbance) + specular;\n }",e),e.uniform2fv(this.renderProgram.locations.delta,O(I,this))}function pe(){var e=this.gl;k(K,this,e.createTexture()),e.bindTexture(e.TEXTURE_2D,O(K,this)),e.pixelStorei(e.UNPACK_FLIP_Y_WEBGL,1),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_MAG_FILTER,e.LINEAR),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_MIN_FILTER,e.LINEAR)}function me(){var e=this.gl;e.bindTexture(e.TEXTURE_2D,O(K,this)),e.texImage2D(e.TEXTURE_2D,0,e.RGBA,e.RGBA,e.UNSIGNED_BYTE,this.transparentPixels)}function ve(){var e=O(C,this).style.backgroundImage;"none"!=e&&(k($,this,e),k(q,this,window.getComputedStyle(O(C,this)).backgroundImage),O(C,this).style.backgroundImage="none")}function ge(){O(C,this).style.backgroundImage=O($,this)||""}function Ee(e,t,r){var n=window.getComputedStyle(O(C,this)),i=parseInt(n.borderLeftWidth)||0,o=parseInt(n.borderTopWidth)||0;this.drop(e.pageX-O(C,this).offsetLeft-i,e.pageY-O(C,this).offsetTop-o,t,r)}function ye(e,t){var r=(0,n.useRef)(null);return(0,n.useEffect)((function(){return r.current=new ie(e.current,void 0===t.children,t.option),function(){return r.current.destroy()}}),[]),r}},953:e=>{e.exports=require("react")}},t={};function r(n){var i=t[n];if(void 0!==i)return i.exports;var o=t[n]={exports:{}};return e[n](o,o.exports,r),o.exports}r.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return r.d(t,{a:t}),t},r.d=(e,t)=>{for(var n in t)r.o(t,n)&&!r.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:t[n]})},r.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),r.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})};var n={};r.r(n),r.d(n,{BackgroundRipple:()=>s});var i=r(953),o=r.n(i),a=r(982);function s(e){var t=(0,i.useRef)(null);return function(e,t){(0,i.useEffect)((function(){if(t.option&&e.current){var r=t.option;Object.keys(e.current.defaults).forEach((function(t){void 0!==r[t]&&e.current.set(t,r[t])}))}}),[t.option])}((0,a.useRipples)(t,e),e),e.children?o().createElement("div",{style:e.style,className:"lmssee-ripples"},e.children,o().createElement("canvas",{ref:t})):o().createElement("canvas",{ref:t})}module.exports["oops-ui"]=n})();
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import*as e from"a-element-inline-style";import*as t from"react";var r={566:(t,r,n)=>{n.d(r,{n:()=>Re});var i=n(649);const o=(a={setStyle:()=>e.setStyle},s={},n.d(s,a),s);var a,s;function l(e){var t=/url\(["']?([^"']*)["']?\)/.exec(e);return null==t?null:t[1]}function u(e,t,r,n){function i(e,t){var n=r.createShader(e);if(r.shaderSource(n,t),r.compileShader(n),!r.getShaderParameter(n,r.COMPILE_STATUS))throw new Error("compile error: "+r.getShaderInfoLog(n));return n}var o,a={id:r.createProgram(),uniforms:{},locations:{}};if(r.attachShader(a.id,i(r.VERTEX_SHADER,e)),r.attachShader(a.id,i(r.FRAGMENT_SHADER,t)),r.linkProgram(a.id),!r.getProgramParameter(a.id,r.LINK_STATUS))throw new Error("link error: "+r.getProgramInfoLog(a.id));r.useProgram(a.id),r.enableVertexAttribArray(0);for(var s=e+t,l=/uniform (\w+) (\w+)/g;null!==(o=l.exec(s));){var u=o[2];a.locations[u]=r.getUniformLocation(a.id,u)}return a}function c(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,r=this.gl;r.activeTexture(r.TEXTURE0+(t||0)),r.bindTexture(r.TEXTURE_2D,e)}function f(e){return e.endsWith("%")}function h(){var e=this,t=function(){return e.initState=!1,null};if(!this.gl)return t();var r=this.gl,n=Object.fromEntries(["OES_texture_float","OES_texture_half_float","OES_texture_float_linear","OES_texture_half_float_linear"].reduce((function(e,t){var n=r.getExtension(t);return n&&e.push([t,n]),e}),[]));if(!n.OES_texture_float)return t();var i=[];function o(e,t,r){var i="OES_texture_"+e,o=i+"_linear",a=o in n;return{type:t,linearSupport:a,arrayType:r,extensions:a?[i,o]:[i]}}i.push(o("float",r.FLOAT,Float32Array)),n.OES_texture_half_float&&i.push(o("half_float",n.OES_texture_half_float.HALF_FLOAT_OES,null));var a=r.createTexture(),s=r.createFramebuffer();r.bindFramebuffer(r.FRAMEBUFFER,s),r.bindTexture(r.TEXTURE_2D,a),r.texParameteri(r.TEXTURE_2D,r.TEXTURE_MIN_FILTER,r.NEAREST),r.texParameteri(r.TEXTURE_2D,r.TEXTURE_MAG_FILTER,r.NEAREST),r.texParameteri(r.TEXTURE_2D,r.TEXTURE_WRAP_S,r.CLAMP_TO_EDGE),r.texParameteri(r.TEXTURE_2D,r.TEXTURE_WRAP_T,r.CLAMP_TO_EDGE);for(var l=null,u=0;u<i.length;u++)if(r.texImage2D(r.TEXTURE_2D,0,r.RGBA,32,32,0,r.RGBA,i[u].type,null),r.framebufferTexture2D(r.FRAMEBUFFER,r.COLOR_ATTACHMENT0,r.TEXTURE_2D,a,0),r.checkFramebufferStatus(r.FRAMEBUFFER)===r.FRAMEBUFFER_COMPLETE){l=i[u];break}return l}function d(e){return d="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},d(e)}function p(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,g(n.key),n)}}function m(e,t,r){return t&&p(e.prototype,t),r&&p(e,r),Object.defineProperty(e,"prototype",{writable:!1}),e}function v(e,t,r){return(t=g(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function g(e){var t=function(e){if("object"!=d(e)||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var r=t.call(e,"string");if("object"!=d(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==d(t)?t:t+""}var E="lmssee_ripper_element_style",y=m((function e(t){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),v(this,"styleElement",document.createElement("style")),v(this,"canvas",void 0),v(this,"gl",void 0),v(this,"config",void 0),v(this,"transparentPixels",function(){try{return new ImageData(32,32)}catch(e){return console.log(e&&""),document.createElement("canvas").getContext("2d").createImageData(32,32)}}()),v(this,"initState",!0),this.canvas=t;var r=t.getContext("webgl");if(null===r)return this.initState=!1,void(this.config=null);if(this.gl=r,null===document.querySelector("style#".concat(E))){var n=this.styleElement;n.id=E,n.innerHTML="\n .lmssee-ripples { \n position: relative; \n z-index: 0; \n top: 0;\n left: 0;\n width: 100%;\n height: 100%;\n transform: translate(0,0);\n }\n ";var i=document.head;i.prepend?i.prepend(n):i.insertBefore(n,i.firstChild)}this.config=Reflect.apply(h,this,[])})),b={imageUrl:"",resolution:360,dropRadius:10,perturbance:.03,interactive:!0,crossOrigin:"",playingState:!0,accelerating:3,raindropsTimeInterval:660,idleFluctuations:!0};function T(e){return T="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},T(e)}function R(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function w(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?R(Object(r),!0).forEach((function(t){k(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):R(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}function _(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,D(n.key),n)}}function x(e,t){if(t&&("object"==T(t)||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e)}function P(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(e){}return(P=function(){return!!e})()}function S(e){return S=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},S(e)}function F(e,t){return F=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},F(e,t)}function A(e,t,r){O(e,t),t.set(e,r)}function O(e,t){if(t.has(e))throw new TypeError("Cannot initialize the same private elements twice on an object")}function k(e,t,r){return(t=D(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function D(e){var t=function(e){if("object"!=T(e)||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var r=t.call(e,"string");if("object"!=T(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==T(t)?t:t+""}function U(e,t){return e.get(L(e,t))}function M(e,t,r){return e.set(L(e,t),r),r}function L(e,t,r){if("function"==typeof e?e===t:e.has(t))return arguments.length<3?t:r;throw new TypeError("Private element is not present on this object")}Object.freeze(b);var C=new WeakMap,I=new WeakMap,W=new WeakMap,X=new WeakMap,B=new WeakMap,j=new WeakMap,N=new WeakMap,G=new WeakMap,z=new WeakMap,H=new WeakMap,Y=new WeakMap,q=new WeakMap,K=new WeakMap,V=new WeakMap,J=new WeakMap,Q=new WeakMap,Z=new WeakMap,$=new WeakMap,ee=new WeakMap,te=new WeakMap,re=new WeakMap,ne=new WeakMap,ie=new WeakMap,oe=new WeakMap,ae=new WeakSet,se=function(e){function t(e,r,n){var i,a,s;!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),i=function(e,t,r){return t=S(t),x(e,P()?Reflect.construct(t,r||[],S(e).constructor):t.apply(e,r))}(this,t,[e]),O(a=i,s=ae),s.add(a),k(i,"defaults",b),k(i,"interactive",i.defaults.interactive),A(i,C,i.defaults.accelerating),A(i,I,i.defaults.resolution),A(i,W,i.defaults.perturbance),k(i,"dropRadius",void 0),k(i,"crossOrigin",""),k(i,"imageUrl",void 0),k(i,"idleFluctuations",!0),A(i,X,void 0),A(i,B,void 0),A(i,j,[]),A(i,N,[]),A(i,G,0),A(i,z,1),A(i,H,void 0),A(i,Y,!1),A(i,q,!1),A(i,K,!1),A(i,V,0),A(i,J,""),k(i,"imageSource",""),k(i,"renderProgram",void 0),A(i,Q,void 0),A(i,Z,void 0),A(i,$,void 0),A(i,ee,void 0),A(i,te,void 0),A(i,re,void 0),A(i,ne,Date.now()),A(i,ie,i.defaults.raindropsTimeInterval),A(i,oe,{mousemove:function(e){return console.log(e)},mousedown:function(e){return console.log(e)},touchmove:function(e){return console.log(e)},touchstart:function(e){return console.log(e)}}),Object.defineProperties(i,{defaults:{value:i.defaults,writable:!1,enumerable:!1,configurable:!1}}),n&&"boolean"!=typeof n.interactive&&delete n.interactive;var l=w(w({},i.defaults),n);if(i.interactive=l.interactive,i.resolution=l.resolution,i.perturbance=l.perturbance,i.dropRadius=l.dropRadius,i.crossOrigin=l.crossOrigin,i.imageUrl=l.imageUrl,i.idleFluctuations=l.idleFluctuations,!1===i.initState||null===e.parentElement||null===i.config||null===i.gl)return i.initState=!1,x(i);var u=i.gl,c=1/U(I,i);M(B,i,new Float32Array([c,c])),M(X,i,e.parentElement),function(e){var t=e.parentElement;e.width=t.clientWidth,e.height=t.clientHeight,(0,o.setStyle)(e,{position:"absolute",left:0,top:0,right:0,bottom:0,zIndex:-1})}(e),i.config.extensions.forEach((function(e){return u.getExtension(e)})),i.updateSize=i.updateSize.bind(i),window.addEventListener("resize",i.updateSize);for(var f=i.config.arrayType,h=f?new f(U(I,i)*U(I,i)*4):null,d=i.config,p=0;p<2;p++){var m=u.createTexture(),v=u.createFramebuffer();u.bindFramebuffer(u.FRAMEBUFFER,v),u.bindTexture(u.TEXTURE_2D,m),u.texParameteri(u.TEXTURE_2D,u.TEXTURE_MIN_FILTER,d.linearSupport?u.LINEAR:u.NEAREST),u.texParameteri(u.TEXTURE_2D,u.TEXTURE_MAG_FILTER,d.linearSupport?u.LINEAR:u.NEAREST),u.texParameteri(u.TEXTURE_2D,u.TEXTURE_WRAP_S,u.CLAMP_TO_EDGE),u.texParameteri(u.TEXTURE_2D,u.TEXTURE_WRAP_T,u.CLAMP_TO_EDGE),u.texImage2D(u.TEXTURE_2D,0,u.RGBA,U(I,i),U(I,i),0,u.RGBA,d.type,h),u.framebufferTexture2D(u.FRAMEBUFFER,u.COLOR_ATTACHMENT0,u.TEXTURE_2D,m,0),U(j,i).push(m),U(N,i).push(v)}return M(H,i,u.createBuffer()),u.bindBuffer(u.ARRAY_BUFFER,U(H,i)),u.bufferData(u.ARRAY_BUFFER,new Float32Array([-1,-1,1,-1,1,1,-1,1]),u.STATIC_DRAW),L(ae,i,ve).call(i),L(ae,i,ge).call(i),L(ae,i,Ee).call(i),L(ae,i,ue).call(i),u.clearColor(0,0,0,0),u.blendFunc(u.SRC_ALPHA,u.ONE_MINUS_SRC_ALPHA),M(Y,i,!0),M(q,i,!0),M(K,i,!0),L(ae,i,le).call(i),M(V,i,requestAnimationFrame((function(){return L(ae,i,ce).call(i)}))),i}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&F(e,t)}(t,e),r=t,n=[{key:"accelerating",set:function(e){e>100||e<2||M(C,this,e)}},{key:"resolution",set:function(e){e<100||e>550||M(I,this,e)}},{key:"perturbance",set:function(e){e<1e-4||e>1||M(W,this,e)}},{key:"playingState",set:function(e){M(q,this,!1!==e)}},{key:"initialized",get:function(){return U(K,this)}},{key:"raindropsTimeInterval",set:function(e){e<10||e>12e3||M(ie,this,e)}},{key:"raindropsFall",value:function(){var e=window.getComputedStyle(U(X,this)),t=function(e){return function(e=1,t=0){let r=Math.ceil(Number(t)),n=Math.floor(Number(e));return r>n&&([n,r]=[r,n]),Math.floor(Math.random()*(n-r+1)+r)}(parseInt(e))},r=e.width,n=e.height;this.drop(t(r),t(n),1.5*this.dropRadius,.14)}},{key:"drop",value:function(e,t,r,n){var i=this.gl,o=U(X,this).offsetWidth,a=U(X,this).offsetHeight,s=Math.max(o,a);r/=s;var l=new Float32Array([(2*e-o)/s,(a-2*t)/s]);i.viewport(0,0,U(I,this),U(I,this)),i.bindFramebuffer(i.FRAMEBUFFER,U(N,this)[U(G,this)]),Reflect.apply(c,this,[U(j,this)[U(z,this)]]),i.useProgram(U($,this).id),i.uniform2fv(U($,this).locations.center,l),i.uniform1f(U($,this).locations.radius,r),i.uniform1f(U($,this).locations.strength,n),L(ae,this,fe).call(this),L(ae,this,pe).call(this)}},{key:"updateSize",value:function(){var e=U(X,this).offsetWidth,t=U(X,this).offsetHeight;e==this.canvas.width&&t==this.canvas.height||(this.canvas.width=e,this.canvas.height=t)}},{key:"destroy",value:function(){var e=this,t=U(X,this);t&&(Object.keys(U(oe,this)).forEach((function(r){return t.removeEventListener&&t.removeEventListener(r,U(oe,e)[r])})),t.removeAttribute&&t.removeAttribute("data-ripples")),this.styleElement&&this.styleElement.remove(),this.gl=null,this.gl&&(this.gl=null),window.removeEventListener("resize",this.updateSize),L(ae,this,be).call(this),U(V,this)&&window.cancelAnimationFrame(U(V,this))}},{key:"show",value:function(){M(Y,this,!0),this.canvas.style.visibility="visible",L(ae,this,ye).call(this)}},{key:"hide",value:function(){M(Y,this,!1),this.canvas.style.visibility="hidden",L(ae,this,be).call(this)}},{key:"pause",value:function(){M(q,this,!1)}},{key:"play",value:function(){M(q,this,!0)}},{key:"changePlayingState",value:function(){M(q,this,!U(q,this))}},{key:"set",value:function(e,t){"imageUrl"===e?(this.imageUrl=t,L(ae,this,ue).call(this)):this[e]=t}}],n&&_(r.prototype,n),Object.defineProperty(r,"prototype",{writable:!1}),r;var r,n}(y);function le(){var e=this,t=function(t){var r=arguments.length>1&&void 0!==arguments[1]&&arguments[1];U(Y,e)&&U(q,e)&&e.interactive&&(M(ne,e,Date.now()),L(ae,e,Te).call(e,t,e.dropRadius*(r?1.5:1),r?.14:.01))};U(oe,this).mousemove=function(r){for(var n=U(C,e);n--;)t(r)},U(oe,this).touchmove=U(oe,this).touchstart=function(e){for(var r=e.touches,n=0;n<r.length;n++)t(r[n])},U(oe,this).mousedown=function(e){return t(e,!0)},Object.keys(U(oe,this)).forEach((function(t){return U(X,e)&&U(X,e).addEventListener(t,U(oe,e)[t],{passive:!0})}))}function ue(){var e=this,t=this.gl,r=this.imageUrl||l(U(J,this))||l(window.getComputedStyle(U(X,this)).backgroundImage);if(r!==this.imageSource)if(this.imageSource=r,this.imageSource){var n=new Image;n.onload=function(){var r=function(e){return!(e&e-1)},i=r(n.width)&&r(n.height)?t.REPEAT:t.CLAMP_TO_EDGE;t.bindTexture(t.TEXTURE_2D,U(Q,e)),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_WRAP_S,i),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_WRAP_T,i),t.texImage2D(t.TEXTURE_2D,0,t.RGBA,t.RGBA,t.UNSIGNED_BYTE,n),M(ee,e,n.width),M(te,e,n.height),L(ae,e,ye).call(e)},n.onerror=function(){return L(ae,e,Ee).call(e)},n.crossOrigin=this.imageSource.match(/^data:/)?null:this.crossOrigin,n.src=this.imageSource}else L(ae,this,Ee).call(this)}function ce(){var e=this;U(Y,this)&&(L(ae,this,me).call(this),U(q,this)&&L(ae,this,de).call(this),L(ae,this,he).call(this),M(V,this,requestAnimationFrame((function(){return L(ae,e,ce).call(e)}))))}function fe(){var e=this.gl;e.bindBuffer(e.ARRAY_BUFFER,U(H,this)),e.vertexAttribPointer(0,2,e.FLOAT,!1,0,0),e.drawArrays(e.TRIANGLE_FAN,0,4)}function he(){var e=this.gl;e.bindFramebuffer(e.FRAMEBUFFER,null),e.viewport(0,0,this.canvas.width,this.canvas.height),e.enable(e.BLEND),e.clear(e.COLOR_BUFFER_BIT|e.DEPTH_BUFFER_BIT),e.useProgram(this.renderProgram.id),Reflect.apply(c,this,[U(Q,this),0]),Reflect.apply(c,this,[U(j,this)[0],1]),e.uniform1f(this.renderProgram.locations.perturbance,U(W,this)),e.uniform2fv(this.renderProgram.locations.topLeft,this.renderProgram.uniforms.topLeft),e.uniform2fv(this.renderProgram.locations.bottomRight,this.renderProgram.uniforms.bottomRight),e.uniform2fv(this.renderProgram.locations.containerRatio,this.renderProgram.uniforms.containerRatio),e.uniform1i(this.renderProgram.locations.samplerBackground,0),e.uniform1i(this.renderProgram.locations.samplerRipples,1),L(ae,this,fe).call(this),e.disable(e.BLEND)}function de(){if(this.idleFluctuations){var e=Date.now();e-U(ne,this)>U(ie,this)&&(M(ne,this,e),this.raindropsFall())}var t=this.gl;t.viewport(0,0,U(I,this),U(I,this)),t.bindFramebuffer(t.FRAMEBUFFER,U(N,this)[U(G,this)]),Reflect.apply(c,this,[U(j,this)[U(z,this)]]),t.useProgram(U(Z,this).id),L(ae,this,fe).call(this),L(ae,this,pe).call(this)}function pe(){M(G,this,1-U(G,this)),M(z,this,1-U(z,this))}function me(){var e,t,r,n=window.getComputedStyle(U(X,this)).backgroundSize,i=window.getComputedStyle(U(X,this)).backgroundAttachment,o=(e=window.getComputedStyle(U(X,this)).backgroundPosition,/\s+/.test(e)?e.replace(/center/,"50%").replace(/top|left/,"0%").replace(/bottom/,"100%").replace(/\s+/," ").split(" "):f(e)?[e,"50%"]:{center:["50%","50%"],top:["50%","0%"],bottom:["50%","100%"],left:["0%","50%"],right:["100%","50%"]}[e]),a="fixed"==i?{left:window.scrollX,top:window.scrollY,width:window.innerWidth,height:window.innerHeight}:{left:U(X,this).getBoundingClientRect().left,top:U(X,this).getBoundingClientRect().top,width:U(X,this).scrollWidth,height:U(X,this).scrollHeight};if("cover"==n){var s=Math.max(a.width/U(ee,this),a.height/U(te,this));t=U(ee,this)*s,r=U(te,this)*s}else if("contain"==n){var l=Math.min(a.width/U(ee,this),a.height/U(te,this));t=U(ee,this)*l,r=U(te,this)*l}else{var u=n.split(" ");t=u[0]||"",r=u[1]||t,f(t)?t=a.width*parseFloat(t)/100:"auto"!==t&&(t=parseFloat(t)),f(r)?r=a.height*parseFloat(r)/100:"auto"!==r&&(r=parseFloat(r)),"auto"==t&&"auto"==r?(t=U(ee,this),r=U(te,this)):("auto"==t&&(t=U(ee,this)*(Number(r)/U(te,this))),"auto"==r&&(r=U(te,this)*(Number(t)/U(ee,this))))}var c=o&&o[0]||"0%",h=o&&o[1]||"0%";c=f(c)?(a.left+(a.width-Number(t))*parseFloat(c)/100).toString():(a.left+parseFloat(c)).toString(),h=f(h)?(a.top+(a.height-Number(r))*parseFloat(h)/100).toString():(a.top+parseFloat(h)).toString(),this.renderProgram.uniforms.topLeft=new Float32Array([(U(X,this).offsetLeft-Number(c))/Number(t),(U(X,this).offsetTop-Number(h))/Number(r)]),this.renderProgram.uniforms.bottomRight=new Float32Array([this.renderProgram.uniforms.topLeft[0]+U(X,this).clientWidth/Number(t),this.renderProgram.uniforms.topLeft[1]+U(X,this).clientHeight/Number(r)]);var d=Math.max(this.canvas.width,this.canvas.height);this.renderProgram.uniforms.containerRatio=new Float32Array([this.canvas.width/d,this.canvas.height/d])}function ve(){var e=this.gl,t="\n attribute vec2 vertex;\n varying vec2 coord;\n void main() {\n coord = vertex * 0.5 + 0.5;\n gl_Position = vec4(vertex, 0.0, 1.0);\n }";M($,this,u(t,"precision highp float;\n\n const float PI = 3.141592653589793;\n uniform sampler2D texture;\n uniform vec2 center;\n uniform float radius;\n uniform float strength;\n\n varying vec2 coord;\n\n void main() {\n vec4 info = texture2D(texture, coord);\n\n float drop = max(0.0, 1.0 - length(center * 0.5 + 0.5 - coord) / radius);\n drop = 0.5 - cos(drop * PI) * 0.5;\n info.r += drop * strength;\n gl_FragColor = info;\n }",e)),M(Z,this,u(t,"precision highp float;\n\n uniform sampler2D texture;\n uniform vec2 delta;\n\n varying vec2 coord;\n\n void main() {\n vec4 info = texture2D(texture, coord);\n \n vec2 dx = vec2(delta.x, 0.0);\n vec2 dy = vec2(0.0, delta.y);\n \n float average = (\n texture2D(texture, coord - dx).r +\n texture2D(texture, coord - dy).r +\n texture2D(texture, coord + dx).r +\n texture2D(texture, coord + dy).r\n ) * 0.25;\n \n info.g += (average - info.r) * 2.0;\n info.g *= 0.995;\n info.r += info.g;\n \n gl_FragColor = info;\n }\n ",this.gl)),e.uniform2fv(U(Z,this).locations.delta,U(B,this)),this.renderProgram=u("\n precision highp float;\n\n attribute vec2 vertex;\n uniform vec2 topLeft;\n uniform vec2 bottomRight;\n uniform vec2 containerRatio;\n varying vec2 ripplesCoord;\n varying vec2 backgroundCoord;\n void main() {\n backgroundCoord = mix(topLeft, bottomRight, vertex * 0.5 + 0.5);\n backgroundCoord.y = 1.0 - backgroundCoord.y;\n ripplesCoord = vec2(vertex.x, -vertex.y) * containerRatio * 0.5 + 0.5;\n gl_Position = vec4(vertex.x, -vertex.y, 0.0, 1.0);\n }\n ","\n precision highp float;\n\n uniform sampler2D samplerBackground;\n uniform sampler2D samplerRipples;\n uniform vec2 delta;\n\n uniform float perturbance;\n varying vec2 ripplesCoord;\n varying vec2 backgroundCoord;\n\n void main() {\n float height = texture2D(samplerRipples, ripplesCoord).r;\n float heightX = texture2D(samplerRipples, vec2(ripplesCoord.x + delta.x, ripplesCoord.y)).r;\n float heightY = texture2D(samplerRipples, vec2(ripplesCoord.x, ripplesCoord.y + delta.y)).r;\n vec3 dx = vec3(delta.x, heightX - height, 0.0);\n vec3 dy = vec3(0.0, heightY - height, delta.y);\n vec2 offset = -normalize(cross(dy, dx)).xz;\n float specular = pow(max(0.0, dot(offset, normalize(vec2(-0.6, 1.0)))), 4.0);\n gl_FragColor = texture2D(samplerBackground, backgroundCoord + offset * perturbance) + specular;\n }",e),e.uniform2fv(this.renderProgram.locations.delta,U(B,this))}function ge(){var e=this.gl;M(Q,this,e.createTexture()),e.bindTexture(e.TEXTURE_2D,U(Q,this)),e.pixelStorei(e.UNPACK_FLIP_Y_WEBGL,1),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_MAG_FILTER,e.LINEAR),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_MIN_FILTER,e.LINEAR)}function Ee(){var e=this.gl;e.bindTexture(e.TEXTURE_2D,U(Q,this)),e.texImage2D(e.TEXTURE_2D,0,e.RGBA,e.RGBA,e.UNSIGNED_BYTE,this.transparentPixels)}function ye(){var e=U(X,this).style.backgroundImage;"none"!=e&&(M(re,this,e),M(J,this,window.getComputedStyle(U(X,this)).backgroundImage),U(X,this).style.backgroundImage="none")}function be(){U(X,this).style.backgroundImage=U(re,this)||""}function Te(e,t,r){var n=window.getComputedStyle(U(X,this)),i=parseInt(n.borderLeftWidth)||0,o=parseInt(n.borderTopWidth)||0;this.drop(e.pageX-U(X,this).offsetLeft-i,e.pageY-U(X,this).offsetTop-o,t,r)}function Re(e,t){var r=(0,i.useRef)(null);return(0,i.useEffect)((function(){return r.current=new se(e.current,void 0===t.children,t.option),function(){return r.current.destroy()}}),[]),r}},649:(e,r,n)=>{var i,o;e.exports=(i={default:()=>t.default,useEffect:()=>t.useEffect,useRef:()=>t.useRef},o={},n.d(o,i),o)}},n={};function i(e){var t=n[e];if(void 0!==t)return t.exports;var o=n[e]={exports:{}};return r[e](o,o.exports,i),o.exports}i.d=(e,t)=>{for(var r in t)i.o(t,r)&&!i.o(e,r)&&Object.defineProperty(e,r,{enumerable:!0,get:t[r]})},i.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t);var o={};i.d(o,{z:()=>l});var a=i(649),s=i(566);function l(e){var t=(0,a.useRef)(null);return function(e,t){(0,a.useEffect)((function(){if(t.option&&e.current){var r=t.option;Object.keys(e.current.defaults).forEach((function(t){void 0!==r[t]&&e.current.set(t,r[t])}))}}),[t.option])}((0,s.n)(t,e),e),e.children?a.default.createElement("div",{style:e.style,className:"lmssee-ripples"},e.children,a.default.createElement("canvas",{ref:t})):a.default.createElement("canvas",{ref:t})}var u=o.z;export{u as BackgroundRipple};
|
package/dist/index.cjs
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
(()=>{"use strict";var e={805:(e,t,r)=>{r.d(t,{BackgroundRipple:()=>a});var n=r(953),i=r.n(n),o=r(982);function a(e){var t=(0,n.useRef)(null);return function(e,t){(0,n.useEffect)((function(){if(t.option&&e.current){var r=t.option;Object.keys(e.current.defaults).forEach((function(t){void 0!==r[t]&&e.current.set(t,r[t])}))}}),[t.option])}((0,o.useRipples)(t,e),e),e.children?i().createElement("div",{style:e.style,className:"lmssee-ripples"},e.children,i().createElement("canvas",{ref:t})):i().createElement("canvas",{ref:t})}},615:(e,t,r)=>{r.d(t,{useAnimationFrameId:()=>i});var n=r(953);function i(){var e=(0,n.useRef)(0);return(0,n.useEffect)((function(){return function(){e.current&&window.cancelAnimationFrame(e.current)}}),[]),e}},982:(e,t,r)=>{r.d(t,{useRipples:()=>ye});var n=r(953);const i=require("a-element-inline-style");function o(e){var t=/url\(["']?([^"']*)["']?\)/.exec(e);return null==t?null:t[1]}function a(e,t,r,n){function i(e,t){var n=r.createShader(e);if(r.shaderSource(n,t),r.compileShader(n),!r.getShaderParameter(n,r.COMPILE_STATUS))throw new Error("compile error: "+r.getShaderInfoLog(n));return n}var o,a={id:r.createProgram(),uniforms:{},locations:{}};if(r.attachShader(a.id,i(r.VERTEX_SHADER,e)),r.attachShader(a.id,i(r.FRAGMENT_SHADER,t)),r.linkProgram(a.id),!r.getProgramParameter(a.id,r.LINK_STATUS))throw new Error("link error: "+r.getProgramInfoLog(a.id));r.useProgram(a.id),r.enableVertexAttribArray(0);for(var s=e+t,u=/uniform (\w+) (\w+)/g;null!==(o=u.exec(s));){var l=o[2];a.locations[l]=r.getUniformLocation(a.id,l)}return a}function s(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,r=this.gl;r.activeTexture(r.TEXTURE0+(t||0)),r.bindTexture(r.TEXTURE_2D,e)}function u(e){return e.endsWith("%")}function l(){var e=this,t=function(){return e.initState=!1,null};if(!this.gl)return t();var r=this.gl,n=Object.fromEntries(["OES_texture_float","OES_texture_half_float","OES_texture_float_linear","OES_texture_half_float_linear"].reduce((function(e,t){var n=r.getExtension(t);return n&&e.push([t,n]),e}),[]));if(!n.OES_texture_float)return t();var i=[];function o(e,t,r){var i="OES_texture_"+e,o=i+"_linear",a=o in n;return{type:t,linearSupport:a,arrayType:r,extensions:a?[i,o]:[i]}}i.push(o("float",r.FLOAT,Float32Array)),n.OES_texture_half_float&&i.push(o("half_float",n.OES_texture_half_float.HALF_FLOAT_OES,null));var a=r.createTexture(),s=r.createFramebuffer();r.bindFramebuffer(r.FRAMEBUFFER,s),r.bindTexture(r.TEXTURE_2D,a),r.texParameteri(r.TEXTURE_2D,r.TEXTURE_MIN_FILTER,r.NEAREST),r.texParameteri(r.TEXTURE_2D,r.TEXTURE_MAG_FILTER,r.NEAREST),r.texParameteri(r.TEXTURE_2D,r.TEXTURE_WRAP_S,r.CLAMP_TO_EDGE),r.texParameteri(r.TEXTURE_2D,r.TEXTURE_WRAP_T,r.CLAMP_TO_EDGE);for(var u=null,l=0;l<i.length;l++)if(r.texImage2D(r.TEXTURE_2D,0,r.RGBA,32,32,0,r.RGBA,i[l].type,null),r.framebufferTexture2D(r.FRAMEBUFFER,r.COLOR_ATTACHMENT0,r.TEXTURE_2D,a,0),r.checkFramebufferStatus(r.FRAMEBUFFER)===r.FRAMEBUFFER_COMPLETE){u=i[l];break}return u}function c(e){return c="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},c(e)}function f(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,p(n.key),n)}}function h(e,t,r){return t&&f(e.prototype,t),r&&f(e,r),Object.defineProperty(e,"prototype",{writable:!1}),e}function d(e,t,r){return(t=p(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function p(e){var t=function(e){if("object"!=c(e)||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var r=t.call(e,"string");if("object"!=c(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==c(t)?t:t+""}var m="lmssee_ripper_element_style",v=h((function e(t){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),d(this,"styleElement",document.createElement("style")),d(this,"canvas",void 0),d(this,"gl",void 0),d(this,"config",void 0),d(this,"transparentPixels",function(){try{return new ImageData(32,32)}catch(e){return console.log(e&&""),document.createElement("canvas").getContext("2d").createImageData(32,32)}}()),d(this,"initState",!0),this.canvas=t;var r=t.getContext("webgl");if(null===r)return this.initState=!1,void(this.config=null);if(this.gl=r,null===document.querySelector("style#".concat(m))){var n=this.styleElement;n.id=m,n.innerHTML="\n .lmssee-ripples { \n position: relative; \n z-index: 0; \n top: 0;\n left: 0;\n width: 100%;\n height: 100%;\n transform: translate(0,0);\n }\n ";var i=document.head;i.prepend?i.prepend(n):i.insertBefore(n,i.firstChild)}this.config=Reflect.apply(l,this,[])})),g={imageUrl:"",resolution:360,dropRadius:10,perturbance:.03,interactive:!0,crossOrigin:"",playingState:!0,accelerating:3,raindropsTimeInterval:660,idleFluctuations:!0};function E(e){return E="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},E(e)}function y(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function b(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?y(Object(r),!0).forEach((function(t){F(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):y(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}function T(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,A(n.key),n)}}function R(e,t){if(t&&("object"==E(t)||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e)}function w(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(e){}return(w=function(){return!!e})()}function _(e){return _=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},_(e)}function x(e,t){return x=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},x(e,t)}function P(e,t,r){S(e,t),t.set(e,r)}function S(e,t){if(t.has(e))throw new TypeError("Cannot initialize the same private elements twice on an object")}function F(e,t,r){return(t=A(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function A(e){var t=function(e){if("object"!=E(e)||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var r=t.call(e,"string");if("object"!=E(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==E(t)?t:t+""}function O(e,t){return e.get(D(e,t))}function k(e,t,r){return e.set(D(e,t),r),r}function D(e,t,r){if("function"==typeof e?e===t:e.has(t))return arguments.length<3?t:r;throw new TypeError("Private element is not present on this object")}Object.freeze(g);var U=new WeakMap,M=new WeakMap,I=new WeakMap,L=new WeakMap,C=new WeakMap,B=new WeakMap,j=new WeakMap,W=new WeakMap,X=new WeakMap,N=new WeakMap,G=new WeakMap,z=new WeakMap,H=new WeakMap,Y=new WeakMap,q=new WeakMap,K=new WeakMap,V=new WeakMap,J=new WeakMap,Q=new WeakMap,Z=new WeakMap,$=new WeakMap,ee=new WeakMap,te=new WeakMap,re=new WeakMap,ne=new WeakSet,ie=function(e){function t(e,r,n){var o,a,s;!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),o=function(e,t,r){return t=_(t),R(e,w()?Reflect.construct(t,r||[],_(e).constructor):t.apply(e,r))}(this,t,[e]),S(a=o,s=ne),s.add(a),F(o,"defaults",g),F(o,"interactive",o.defaults.interactive),P(o,U,o.defaults.accelerating),P(o,M,o.defaults.resolution),P(o,I,o.defaults.perturbance),F(o,"dropRadius",void 0),F(o,"crossOrigin",""),F(o,"imageUrl",void 0),F(o,"idleFluctuations",!0),P(o,L,void 0),P(o,C,void 0),P(o,B,[]),P(o,j,[]),P(o,W,0),P(o,X,1),P(o,N,void 0),P(o,G,!1),P(o,z,!1),P(o,H,!1),P(o,Y,0),P(o,q,""),F(o,"imageSource",""),F(o,"renderProgram",void 0),P(o,K,void 0),P(o,V,void 0),P(o,J,void 0),P(o,Q,void 0),P(o,Z,void 0),P(o,$,void 0),P(o,ee,Date.now()),P(o,te,o.defaults.raindropsTimeInterval),P(o,re,{mousemove:function(e){return console.log(e)},mousedown:function(e){return console.log(e)},touchmove:function(e){return console.log(e)},touchstart:function(e){return console.log(e)}}),Object.defineProperties(o,{defaults:{value:o.defaults,writable:!1,enumerable:!1,configurable:!1}}),n&&"boolean"!=typeof n.interactive&&delete n.interactive;var u=b(b({},o.defaults),n);if(o.interactive=u.interactive,o.resolution=u.resolution,o.perturbance=u.perturbance,o.dropRadius=u.dropRadius,o.crossOrigin=u.crossOrigin,o.imageUrl=u.imageUrl,o.idleFluctuations=u.idleFluctuations,!1===o.initState||null===e.parentElement||null===o.config||null===o.gl)return o.initState=!1,R(o);var l=o.gl,c=1/O(M,o);k(C,o,new Float32Array([c,c])),k(L,o,e.parentElement),function(e){var t=e.parentElement;e.width=t.clientWidth,e.height=t.clientHeight,(0,i.setStyle)(e,{position:"absolute",left:0,top:0,right:0,bottom:0,zIndex:-1})}(e),o.config.extensions.forEach((function(e){return l.getExtension(e)})),o.updateSize=o.updateSize.bind(o),window.addEventListener("resize",o.updateSize);for(var f=o.config.arrayType,h=f?new f(O(M,o)*O(M,o)*4):null,d=o.config,p=0;p<2;p++){var m=l.createTexture(),v=l.createFramebuffer();l.bindFramebuffer(l.FRAMEBUFFER,v),l.bindTexture(l.TEXTURE_2D,m),l.texParameteri(l.TEXTURE_2D,l.TEXTURE_MIN_FILTER,d.linearSupport?l.LINEAR:l.NEAREST),l.texParameteri(l.TEXTURE_2D,l.TEXTURE_MAG_FILTER,d.linearSupport?l.LINEAR:l.NEAREST),l.texParameteri(l.TEXTURE_2D,l.TEXTURE_WRAP_S,l.CLAMP_TO_EDGE),l.texParameteri(l.TEXTURE_2D,l.TEXTURE_WRAP_T,l.CLAMP_TO_EDGE),l.texImage2D(l.TEXTURE_2D,0,l.RGBA,O(M,o),O(M,o),0,l.RGBA,d.type,h),l.framebufferTexture2D(l.FRAMEBUFFER,l.COLOR_ATTACHMENT0,l.TEXTURE_2D,m,0),O(B,o).push(m),O(j,o).push(v)}return k(N,o,l.createBuffer()),l.bindBuffer(l.ARRAY_BUFFER,O(N,o)),l.bufferData(l.ARRAY_BUFFER,new Float32Array([-1,-1,1,-1,1,1,-1,1]),l.STATIC_DRAW),D(ne,o,de).call(o),D(ne,o,pe).call(o),D(ne,o,me).call(o),D(ne,o,ae).call(o),l.clearColor(0,0,0,0),l.blendFunc(l.SRC_ALPHA,l.ONE_MINUS_SRC_ALPHA),k(G,o,!0),k(z,o,!0),k(H,o,!0),D(ne,o,oe).call(o),k(Y,o,requestAnimationFrame((function(){return D(ne,o,se).call(o)}))),o}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&x(e,t)}(t,e),r=t,n=[{key:"accelerating",set:function(e){e>100||e<2||k(U,this,e)}},{key:"resolution",set:function(e){e<100||e>550||k(M,this,e)}},{key:"perturbance",set:function(e){e<1e-4||e>1||k(I,this,e)}},{key:"playingState",set:function(e){k(z,this,!1!==e)}},{key:"initialized",get:function(){return O(H,this)}},{key:"raindropsTimeInterval",set:function(e){e<10||e>12e3||k(te,this,e)}},{key:"raindropsFall",value:function(){var e=window.getComputedStyle(O(L,this)),t=function(e){return function(e=1,t=0){let r=Math.ceil(Number(t)),n=Math.floor(Number(e));return r>n&&([n,r]=[r,n]),Math.floor(Math.random()*(n-r+1)+r)}(parseInt(e))},r=e.width,n=e.height;this.drop(t(r),t(n),1.5*this.dropRadius,.14)}},{key:"drop",value:function(e,t,r,n){var i=this.gl,o=O(L,this).offsetWidth,a=O(L,this).offsetHeight,u=Math.max(o,a);r/=u;var l=new Float32Array([(2*e-o)/u,(a-2*t)/u]);i.viewport(0,0,O(M,this),O(M,this)),i.bindFramebuffer(i.FRAMEBUFFER,O(j,this)[O(W,this)]),Reflect.apply(s,this,[O(B,this)[O(X,this)]]),i.useProgram(O(J,this).id),i.uniform2fv(O(J,this).locations.center,l),i.uniform1f(O(J,this).locations.radius,r),i.uniform1f(O(J,this).locations.strength,n),D(ne,this,ue).call(this),D(ne,this,fe).call(this)}},{key:"updateSize",value:function(){var e=O(L,this).offsetWidth,t=O(L,this).offsetHeight;e==this.canvas.width&&t==this.canvas.height||(this.canvas.width=e,this.canvas.height=t)}},{key:"destroy",value:function(){var e=this,t=O(L,this);t&&(Object.keys(O(re,this)).forEach((function(r){return t.removeEventListener&&t.removeEventListener(r,O(re,e)[r])})),t.removeAttribute&&t.removeAttribute("data-ripples")),this.styleElement&&this.styleElement.remove(),this.gl=null,this.gl&&(this.gl=null),window.removeEventListener("resize",this.updateSize),D(ne,this,ge).call(this),O(Y,this)&&window.cancelAnimationFrame(O(Y,this))}},{key:"show",value:function(){k(G,this,!0),this.canvas.style.visibility="visible",D(ne,this,ve).call(this)}},{key:"hide",value:function(){k(G,this,!1),this.canvas.style.visibility="hidden",D(ne,this,ge).call(this)}},{key:"pause",value:function(){k(z,this,!1)}},{key:"play",value:function(){k(z,this,!0)}},{key:"changePlayingState",value:function(){k(z,this,!O(z,this))}},{key:"set",value:function(e,t){"imageUrl"===e?(this.imageUrl=t,D(ne,this,ae).call(this)):this[e]=t}}],n&&T(r.prototype,n),Object.defineProperty(r,"prototype",{writable:!1}),r;var r,n}(v);function oe(){var e=this,t=function(t){var r=arguments.length>1&&void 0!==arguments[1]&&arguments[1];O(G,e)&&O(z,e)&&e.interactive&&(k(ee,e,Date.now()),D(ne,e,Ee).call(e,t,e.dropRadius*(r?1.5:1),r?.14:.01))};O(re,this).mousemove=function(r){for(var n=O(U,e);n--;)t(r)},O(re,this).touchmove=O(re,this).touchstart=function(e){for(var r=e.touches,n=0;n<r.length;n++)t(r[n])},O(re,this).mousedown=function(e){return t(e,!0)},Object.keys(O(re,this)).forEach((function(t){return O(L,e)&&O(L,e).addEventListener(t,O(re,e)[t],{passive:!0})}))}function ae(){var e=this,t=this.gl,r=this.imageUrl||o(O(q,this))||o(window.getComputedStyle(O(L,this)).backgroundImage);if(r!==this.imageSource)if(this.imageSource=r,this.imageSource){var n=new Image;n.onload=function(){var r=function(e){return!(e&e-1)},i=r(n.width)&&r(n.height)?t.REPEAT:t.CLAMP_TO_EDGE;t.bindTexture(t.TEXTURE_2D,O(K,e)),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_WRAP_S,i),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_WRAP_T,i),t.texImage2D(t.TEXTURE_2D,0,t.RGBA,t.RGBA,t.UNSIGNED_BYTE,n),k(Q,e,n.width),k(Z,e,n.height),D(ne,e,ve).call(e)},n.onerror=function(){return D(ne,e,me).call(e)},n.crossOrigin=this.imageSource.match(/^data:/)?null:this.crossOrigin,n.src=this.imageSource}else D(ne,this,me).call(this)}function se(){var e=this;O(G,this)&&(D(ne,this,he).call(this),O(z,this)&&D(ne,this,ce).call(this),D(ne,this,le).call(this),k(Y,this,requestAnimationFrame((function(){return D(ne,e,se).call(e)}))))}function ue(){var e=this.gl;e.bindBuffer(e.ARRAY_BUFFER,O(N,this)),e.vertexAttribPointer(0,2,e.FLOAT,!1,0,0),e.drawArrays(e.TRIANGLE_FAN,0,4)}function le(){var e=this.gl;e.bindFramebuffer(e.FRAMEBUFFER,null),e.viewport(0,0,this.canvas.width,this.canvas.height),e.enable(e.BLEND),e.clear(e.COLOR_BUFFER_BIT|e.DEPTH_BUFFER_BIT),e.useProgram(this.renderProgram.id),Reflect.apply(s,this,[O(K,this),0]),Reflect.apply(s,this,[O(B,this)[0],1]),e.uniform1f(this.renderProgram.locations.perturbance,O(I,this)),e.uniform2fv(this.renderProgram.locations.topLeft,this.renderProgram.uniforms.topLeft),e.uniform2fv(this.renderProgram.locations.bottomRight,this.renderProgram.uniforms.bottomRight),e.uniform2fv(this.renderProgram.locations.containerRatio,this.renderProgram.uniforms.containerRatio),e.uniform1i(this.renderProgram.locations.samplerBackground,0),e.uniform1i(this.renderProgram.locations.samplerRipples,1),D(ne,this,ue).call(this),e.disable(e.BLEND)}function ce(){if(this.idleFluctuations){var e=Date.now();e-O(ee,this)>O(te,this)&&(k(ee,this,e),this.raindropsFall())}var t=this.gl;t.viewport(0,0,O(M,this),O(M,this)),t.bindFramebuffer(t.FRAMEBUFFER,O(j,this)[O(W,this)]),Reflect.apply(s,this,[O(B,this)[O(X,this)]]),t.useProgram(O(V,this).id),D(ne,this,ue).call(this),D(ne,this,fe).call(this)}function fe(){k(W,this,1-O(W,this)),k(X,this,1-O(X,this))}function he(){var e,t,r,n=window.getComputedStyle(O(L,this)).backgroundSize,i=window.getComputedStyle(O(L,this)).backgroundAttachment,o=(e=window.getComputedStyle(O(L,this)).backgroundPosition,/\s+/.test(e)?e.replace(/center/,"50%").replace(/top|left/,"0%").replace(/bottom/,"100%").replace(/\s+/," ").split(" "):u(e)?[e,"50%"]:{center:["50%","50%"],top:["50%","0%"],bottom:["50%","100%"],left:["0%","50%"],right:["100%","50%"]}[e]),a="fixed"==i?{left:window.scrollX,top:window.scrollY,width:window.innerWidth,height:window.innerHeight}:{left:O(L,this).getBoundingClientRect().left,top:O(L,this).getBoundingClientRect().top,width:O(L,this).scrollWidth,height:O(L,this).scrollHeight};if("cover"==n){var s=Math.max(a.width/O(Q,this),a.height/O(Z,this));t=O(Q,this)*s,r=O(Z,this)*s}else if("contain"==n){var l=Math.min(a.width/O(Q,this),a.height/O(Z,this));t=O(Q,this)*l,r=O(Z,this)*l}else{var c=n.split(" ");t=c[0]||"",r=c[1]||t,u(t)?t=a.width*parseFloat(t)/100:"auto"!==t&&(t=parseFloat(t)),u(r)?r=a.height*parseFloat(r)/100:"auto"!==r&&(r=parseFloat(r)),"auto"==t&&"auto"==r?(t=O(Q,this),r=O(Z,this)):("auto"==t&&(t=O(Q,this)*(Number(r)/O(Z,this))),"auto"==r&&(r=O(Z,this)*(Number(t)/O(Q,this))))}var f=o&&o[0]||"0%",h=o&&o[1]||"0%";f=u(f)?(a.left+(a.width-Number(t))*parseFloat(f)/100).toString():(a.left+parseFloat(f)).toString(),h=u(h)?(a.top+(a.height-Number(r))*parseFloat(h)/100).toString():(a.top+parseFloat(h)).toString(),this.renderProgram.uniforms.topLeft=new Float32Array([(O(L,this).offsetLeft-Number(f))/Number(t),(O(L,this).offsetTop-Number(h))/Number(r)]),this.renderProgram.uniforms.bottomRight=new Float32Array([this.renderProgram.uniforms.topLeft[0]+O(L,this).clientWidth/Number(t),this.renderProgram.uniforms.topLeft[1]+O(L,this).clientHeight/Number(r)]);var d=Math.max(this.canvas.width,this.canvas.height);this.renderProgram.uniforms.containerRatio=new Float32Array([this.canvas.width/d,this.canvas.height/d])}function de(){var e=this.gl,t="\n attribute vec2 vertex;\n varying vec2 coord;\n void main() {\n coord = vertex * 0.5 + 0.5;\n gl_Position = vec4(vertex, 0.0, 1.0);\n }";k(J,this,a(t,"precision highp float;\n\n const float PI = 3.141592653589793;\n uniform sampler2D texture;\n uniform vec2 center;\n uniform float radius;\n uniform float strength;\n\n varying vec2 coord;\n\n void main() {\n vec4 info = texture2D(texture, coord);\n\n float drop = max(0.0, 1.0 - length(center * 0.5 + 0.5 - coord) / radius);\n drop = 0.5 - cos(drop * PI) * 0.5;\n info.r += drop * strength;\n gl_FragColor = info;\n }",e)),k(V,this,a(t,"precision highp float;\n\n uniform sampler2D texture;\n uniform vec2 delta;\n\n varying vec2 coord;\n\n void main() {\n vec4 info = texture2D(texture, coord);\n \n vec2 dx = vec2(delta.x, 0.0);\n vec2 dy = vec2(0.0, delta.y);\n \n float average = (\n texture2D(texture, coord - dx).r +\n texture2D(texture, coord - dy).r +\n texture2D(texture, coord + dx).r +\n texture2D(texture, coord + dy).r\n ) * 0.25;\n \n info.g += (average - info.r) * 2.0;\n info.g *= 0.995;\n info.r += info.g;\n \n gl_FragColor = info;\n }\n ",this.gl)),e.uniform2fv(O(V,this).locations.delta,O(C,this)),this.renderProgram=a("\n precision highp float;\n\n attribute vec2 vertex;\n uniform vec2 topLeft;\n uniform vec2 bottomRight;\n uniform vec2 containerRatio;\n varying vec2 ripplesCoord;\n varying vec2 backgroundCoord;\n void main() {\n backgroundCoord = mix(topLeft, bottomRight, vertex * 0.5 + 0.5);\n backgroundCoord.y = 1.0 - backgroundCoord.y;\n ripplesCoord = vec2(vertex.x, -vertex.y) * containerRatio * 0.5 + 0.5;\n gl_Position = vec4(vertex.x, -vertex.y, 0.0, 1.0);\n }\n ","\n precision highp float;\n\n uniform sampler2D samplerBackground;\n uniform sampler2D samplerRipples;\n uniform vec2 delta;\n\n uniform float perturbance;\n varying vec2 ripplesCoord;\n varying vec2 backgroundCoord;\n\n void main() {\n float height = texture2D(samplerRipples, ripplesCoord).r;\n float heightX = texture2D(samplerRipples, vec2(ripplesCoord.x + delta.x, ripplesCoord.y)).r;\n float heightY = texture2D(samplerRipples, vec2(ripplesCoord.x, ripplesCoord.y + delta.y)).r;\n vec3 dx = vec3(delta.x, heightX - height, 0.0);\n vec3 dy = vec3(0.0, heightY - height, delta.y);\n vec2 offset = -normalize(cross(dy, dx)).xz;\n float specular = pow(max(0.0, dot(offset, normalize(vec2(-0.6, 1.0)))), 4.0);\n gl_FragColor = texture2D(samplerBackground, backgroundCoord + offset * perturbance) + specular;\n }",e),e.uniform2fv(this.renderProgram.locations.delta,O(C,this))}function pe(){var e=this.gl;k(K,this,e.createTexture()),e.bindTexture(e.TEXTURE_2D,O(K,this)),e.pixelStorei(e.UNPACK_FLIP_Y_WEBGL,1),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_MAG_FILTER,e.LINEAR),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_MIN_FILTER,e.LINEAR)}function me(){var e=this.gl;e.bindTexture(e.TEXTURE_2D,O(K,this)),e.texImage2D(e.TEXTURE_2D,0,e.RGBA,e.RGBA,e.UNSIGNED_BYTE,this.transparentPixels)}function ve(){var e=O(L,this).style.backgroundImage;"none"!=e&&(k($,this,e),k(q,this,window.getComputedStyle(O(L,this)).backgroundImage),O(L,this).style.backgroundImage="none")}function ge(){O(L,this).style.backgroundImage=O($,this)||""}function Ee(e,t,r){var n=window.getComputedStyle(O(L,this)),i=parseInt(n.borderLeftWidth)||0,o=parseInt(n.borderTopWidth)||0;this.drop(e.pageX-O(L,this).offsetLeft-i,e.pageY-O(L,this).offsetTop-o,t,r)}function ye(e,t){var r=(0,n.useRef)(null);return(0,n.useEffect)((function(){return r.current=new ie(e.current,void 0===t.children,t.option),function(){return r.current.destroy()}}),[]),r}},552:(e,t,r)=>{r.d(t,{useTimeId:()=>i});var n=r(953);function i(){var e=(0,n.useRef)(void 0);return(0,n.useEffect)((function(){return function(){e.current&&clearTimeout(e.current)}}),[]),e}},953:e=>{e.exports=require("react")}},t={};function r(n){var i=t[n];if(void 0!==i)return i.exports;var o=t[n]={exports:{}};return e[n](o,o.exports,r),o.exports}r.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return r.d(t,{a:t}),t},r.d=(e,t)=>{for(var n in t)r.o(t,n)&&!r.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:t[n]})},r.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),r.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})};var n={};r.r(n),r.d(n,{BackgroundRipple:()=>i.BackgroundRipple,useAnimationFrameId:()=>a.useAnimationFrameId,useRipples:()=>s.useRipples,useTimeId:()=>o.useTimeId});var i=r(805),o=r(552),a=r(615),s=r(982);module.exports["oops-ui"]=n})();
|
package/dist/index.mjs
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import*as e from"a-element-inline-style";import*as t from"react";var r={805:(e,t,r)=>{r.d(t,{z:()=>o});var n=r(649),i=r(566);function o(e){var t=(0,n.useRef)(null);return function(e,t){(0,n.useEffect)((function(){if(t.option&&e.current){var r=t.option;Object.keys(e.current.defaults).forEach((function(t){void 0!==r[t]&&e.current.set(t,r[t])}))}}),[t.option])}((0,i.n)(t,e),e),e.children?n.default.createElement("div",{style:e.style,className:"lmssee-ripples"},e.children,n.default.createElement("canvas",{ref:t})):n.default.createElement("canvas",{ref:t})}},615:(e,t,r)=>{r.d(t,{M:()=>i});var n=r(649);function i(){var e=(0,n.useRef)(0);return(0,n.useEffect)((function(){return function(){e.current&&window.cancelAnimationFrame(e.current)}}),[]),e}},566:(t,r,n)=>{n.d(r,{n:()=>Re});var i=n(649);const o=(a={setStyle:()=>e.setStyle},s={},n.d(s,a),s);var a,s;function u(e){var t=/url\(["']?([^"']*)["']?\)/.exec(e);return null==t?null:t[1]}function l(e,t,r,n){function i(e,t){var n=r.createShader(e);if(r.shaderSource(n,t),r.compileShader(n),!r.getShaderParameter(n,r.COMPILE_STATUS))throw new Error("compile error: "+r.getShaderInfoLog(n));return n}var o,a={id:r.createProgram(),uniforms:{},locations:{}};if(r.attachShader(a.id,i(r.VERTEX_SHADER,e)),r.attachShader(a.id,i(r.FRAGMENT_SHADER,t)),r.linkProgram(a.id),!r.getProgramParameter(a.id,r.LINK_STATUS))throw new Error("link error: "+r.getProgramInfoLog(a.id));r.useProgram(a.id),r.enableVertexAttribArray(0);for(var s=e+t,u=/uniform (\w+) (\w+)/g;null!==(o=u.exec(s));){var l=o[2];a.locations[l]=r.getUniformLocation(a.id,l)}return a}function c(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,r=this.gl;r.activeTexture(r.TEXTURE0+(t||0)),r.bindTexture(r.TEXTURE_2D,e)}function f(e){return e.endsWith("%")}function h(){var e=this,t=function(){return e.initState=!1,null};if(!this.gl)return t();var r=this.gl,n=Object.fromEntries(["OES_texture_float","OES_texture_half_float","OES_texture_float_linear","OES_texture_half_float_linear"].reduce((function(e,t){var n=r.getExtension(t);return n&&e.push([t,n]),e}),[]));if(!n.OES_texture_float)return t();var i=[];function o(e,t,r){var i="OES_texture_"+e,o=i+"_linear",a=o in n;return{type:t,linearSupport:a,arrayType:r,extensions:a?[i,o]:[i]}}i.push(o("float",r.FLOAT,Float32Array)),n.OES_texture_half_float&&i.push(o("half_float",n.OES_texture_half_float.HALF_FLOAT_OES,null));var a=r.createTexture(),s=r.createFramebuffer();r.bindFramebuffer(r.FRAMEBUFFER,s),r.bindTexture(r.TEXTURE_2D,a),r.texParameteri(r.TEXTURE_2D,r.TEXTURE_MIN_FILTER,r.NEAREST),r.texParameteri(r.TEXTURE_2D,r.TEXTURE_MAG_FILTER,r.NEAREST),r.texParameteri(r.TEXTURE_2D,r.TEXTURE_WRAP_S,r.CLAMP_TO_EDGE),r.texParameteri(r.TEXTURE_2D,r.TEXTURE_WRAP_T,r.CLAMP_TO_EDGE);for(var u=null,l=0;l<i.length;l++)if(r.texImage2D(r.TEXTURE_2D,0,r.RGBA,32,32,0,r.RGBA,i[l].type,null),r.framebufferTexture2D(r.FRAMEBUFFER,r.COLOR_ATTACHMENT0,r.TEXTURE_2D,a,0),r.checkFramebufferStatus(r.FRAMEBUFFER)===r.FRAMEBUFFER_COMPLETE){u=i[l];break}return u}function d(e){return d="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},d(e)}function p(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,g(n.key),n)}}function m(e,t,r){return t&&p(e.prototype,t),r&&p(e,r),Object.defineProperty(e,"prototype",{writable:!1}),e}function v(e,t,r){return(t=g(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function g(e){var t=function(e){if("object"!=d(e)||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var r=t.call(e,"string");if("object"!=d(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==d(t)?t:t+""}var E="lmssee_ripper_element_style",y=m((function e(t){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),v(this,"styleElement",document.createElement("style")),v(this,"canvas",void 0),v(this,"gl",void 0),v(this,"config",void 0),v(this,"transparentPixels",function(){try{return new ImageData(32,32)}catch(e){return console.log(e&&""),document.createElement("canvas").getContext("2d").createImageData(32,32)}}()),v(this,"initState",!0),this.canvas=t;var r=t.getContext("webgl");if(null===r)return this.initState=!1,void(this.config=null);if(this.gl=r,null===document.querySelector("style#".concat(E))){var n=this.styleElement;n.id=E,n.innerHTML="\n .lmssee-ripples { \n position: relative; \n z-index: 0; \n top: 0;\n left: 0;\n width: 100%;\n height: 100%;\n transform: translate(0,0);\n }\n ";var i=document.head;i.prepend?i.prepend(n):i.insertBefore(n,i.firstChild)}this.config=Reflect.apply(h,this,[])})),b={imageUrl:"",resolution:360,dropRadius:10,perturbance:.03,interactive:!0,crossOrigin:"",playingState:!0,accelerating:3,raindropsTimeInterval:660,idleFluctuations:!0};function T(e){return T="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},T(e)}function R(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function w(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?R(Object(r),!0).forEach((function(t){k(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):R(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}function _(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,D(n.key),n)}}function x(e,t){if(t&&("object"==T(t)||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e)}function P(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(e){}return(P=function(){return!!e})()}function S(e){return S=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},S(e)}function F(e,t){return F=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},F(e,t)}function A(e,t,r){O(e,t),t.set(e,r)}function O(e,t){if(t.has(e))throw new TypeError("Cannot initialize the same private elements twice on an object")}function k(e,t,r){return(t=D(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function D(e){var t=function(e){if("object"!=T(e)||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var r=t.call(e,"string");if("object"!=T(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==T(t)?t:t+""}function M(e,t){return e.get(C(e,t))}function U(e,t,r){return e.set(C(e,t),r),r}function C(e,t,r){if("function"==typeof e?e===t:e.has(t))return arguments.length<3?t:r;throw new TypeError("Private element is not present on this object")}Object.freeze(b);var L=new WeakMap,I=new WeakMap,W=new WeakMap,X=new WeakMap,B=new WeakMap,j=new WeakMap,N=new WeakMap,G=new WeakMap,z=new WeakMap,H=new WeakMap,Y=new WeakMap,q=new WeakMap,K=new WeakMap,V=new WeakMap,J=new WeakMap,Q=new WeakMap,Z=new WeakMap,$=new WeakMap,ee=new WeakMap,te=new WeakMap,re=new WeakMap,ne=new WeakMap,ie=new WeakMap,oe=new WeakMap,ae=new WeakSet,se=function(e){function t(e,r,n){var i,a,s;!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),i=function(e,t,r){return t=S(t),x(e,P()?Reflect.construct(t,r||[],S(e).constructor):t.apply(e,r))}(this,t,[e]),O(a=i,s=ae),s.add(a),k(i,"defaults",b),k(i,"interactive",i.defaults.interactive),A(i,L,i.defaults.accelerating),A(i,I,i.defaults.resolution),A(i,W,i.defaults.perturbance),k(i,"dropRadius",void 0),k(i,"crossOrigin",""),k(i,"imageUrl",void 0),k(i,"idleFluctuations",!0),A(i,X,void 0),A(i,B,void 0),A(i,j,[]),A(i,N,[]),A(i,G,0),A(i,z,1),A(i,H,void 0),A(i,Y,!1),A(i,q,!1),A(i,K,!1),A(i,V,0),A(i,J,""),k(i,"imageSource",""),k(i,"renderProgram",void 0),A(i,Q,void 0),A(i,Z,void 0),A(i,$,void 0),A(i,ee,void 0),A(i,te,void 0),A(i,re,void 0),A(i,ne,Date.now()),A(i,ie,i.defaults.raindropsTimeInterval),A(i,oe,{mousemove:function(e){return console.log(e)},mousedown:function(e){return console.log(e)},touchmove:function(e){return console.log(e)},touchstart:function(e){return console.log(e)}}),Object.defineProperties(i,{defaults:{value:i.defaults,writable:!1,enumerable:!1,configurable:!1}}),n&&"boolean"!=typeof n.interactive&&delete n.interactive;var u=w(w({},i.defaults),n);if(i.interactive=u.interactive,i.resolution=u.resolution,i.perturbance=u.perturbance,i.dropRadius=u.dropRadius,i.crossOrigin=u.crossOrigin,i.imageUrl=u.imageUrl,i.idleFluctuations=u.idleFluctuations,!1===i.initState||null===e.parentElement||null===i.config||null===i.gl)return i.initState=!1,x(i);var l=i.gl,c=1/M(I,i);U(B,i,new Float32Array([c,c])),U(X,i,e.parentElement),function(e){var t=e.parentElement;e.width=t.clientWidth,e.height=t.clientHeight,(0,o.setStyle)(e,{position:"absolute",left:0,top:0,right:0,bottom:0,zIndex:-1})}(e),i.config.extensions.forEach((function(e){return l.getExtension(e)})),i.updateSize=i.updateSize.bind(i),window.addEventListener("resize",i.updateSize);for(var f=i.config.arrayType,h=f?new f(M(I,i)*M(I,i)*4):null,d=i.config,p=0;p<2;p++){var m=l.createTexture(),v=l.createFramebuffer();l.bindFramebuffer(l.FRAMEBUFFER,v),l.bindTexture(l.TEXTURE_2D,m),l.texParameteri(l.TEXTURE_2D,l.TEXTURE_MIN_FILTER,d.linearSupport?l.LINEAR:l.NEAREST),l.texParameteri(l.TEXTURE_2D,l.TEXTURE_MAG_FILTER,d.linearSupport?l.LINEAR:l.NEAREST),l.texParameteri(l.TEXTURE_2D,l.TEXTURE_WRAP_S,l.CLAMP_TO_EDGE),l.texParameteri(l.TEXTURE_2D,l.TEXTURE_WRAP_T,l.CLAMP_TO_EDGE),l.texImage2D(l.TEXTURE_2D,0,l.RGBA,M(I,i),M(I,i),0,l.RGBA,d.type,h),l.framebufferTexture2D(l.FRAMEBUFFER,l.COLOR_ATTACHMENT0,l.TEXTURE_2D,m,0),M(j,i).push(m),M(N,i).push(v)}return U(H,i,l.createBuffer()),l.bindBuffer(l.ARRAY_BUFFER,M(H,i)),l.bufferData(l.ARRAY_BUFFER,new Float32Array([-1,-1,1,-1,1,1,-1,1]),l.STATIC_DRAW),C(ae,i,ve).call(i),C(ae,i,ge).call(i),C(ae,i,Ee).call(i),C(ae,i,le).call(i),l.clearColor(0,0,0,0),l.blendFunc(l.SRC_ALPHA,l.ONE_MINUS_SRC_ALPHA),U(Y,i,!0),U(q,i,!0),U(K,i,!0),C(ae,i,ue).call(i),U(V,i,requestAnimationFrame((function(){return C(ae,i,ce).call(i)}))),i}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&F(e,t)}(t,e),r=t,n=[{key:"accelerating",set:function(e){e>100||e<2||U(L,this,e)}},{key:"resolution",set:function(e){e<100||e>550||U(I,this,e)}},{key:"perturbance",set:function(e){e<1e-4||e>1||U(W,this,e)}},{key:"playingState",set:function(e){U(q,this,!1!==e)}},{key:"initialized",get:function(){return M(K,this)}},{key:"raindropsTimeInterval",set:function(e){e<10||e>12e3||U(ie,this,e)}},{key:"raindropsFall",value:function(){var e=window.getComputedStyle(M(X,this)),t=function(e){return function(e=1,t=0){let r=Math.ceil(Number(t)),n=Math.floor(Number(e));return r>n&&([n,r]=[r,n]),Math.floor(Math.random()*(n-r+1)+r)}(parseInt(e))},r=e.width,n=e.height;this.drop(t(r),t(n),1.5*this.dropRadius,.14)}},{key:"drop",value:function(e,t,r,n){var i=this.gl,o=M(X,this).offsetWidth,a=M(X,this).offsetHeight,s=Math.max(o,a);r/=s;var u=new Float32Array([(2*e-o)/s,(a-2*t)/s]);i.viewport(0,0,M(I,this),M(I,this)),i.bindFramebuffer(i.FRAMEBUFFER,M(N,this)[M(G,this)]),Reflect.apply(c,this,[M(j,this)[M(z,this)]]),i.useProgram(M($,this).id),i.uniform2fv(M($,this).locations.center,u),i.uniform1f(M($,this).locations.radius,r),i.uniform1f(M($,this).locations.strength,n),C(ae,this,fe).call(this),C(ae,this,pe).call(this)}},{key:"updateSize",value:function(){var e=M(X,this).offsetWidth,t=M(X,this).offsetHeight;e==this.canvas.width&&t==this.canvas.height||(this.canvas.width=e,this.canvas.height=t)}},{key:"destroy",value:function(){var e=this,t=M(X,this);t&&(Object.keys(M(oe,this)).forEach((function(r){return t.removeEventListener&&t.removeEventListener(r,M(oe,e)[r])})),t.removeAttribute&&t.removeAttribute("data-ripples")),this.styleElement&&this.styleElement.remove(),this.gl=null,this.gl&&(this.gl=null),window.removeEventListener("resize",this.updateSize),C(ae,this,be).call(this),M(V,this)&&window.cancelAnimationFrame(M(V,this))}},{key:"show",value:function(){U(Y,this,!0),this.canvas.style.visibility="visible",C(ae,this,ye).call(this)}},{key:"hide",value:function(){U(Y,this,!1),this.canvas.style.visibility="hidden",C(ae,this,be).call(this)}},{key:"pause",value:function(){U(q,this,!1)}},{key:"play",value:function(){U(q,this,!0)}},{key:"changePlayingState",value:function(){U(q,this,!M(q,this))}},{key:"set",value:function(e,t){"imageUrl"===e?(this.imageUrl=t,C(ae,this,le).call(this)):this[e]=t}}],n&&_(r.prototype,n),Object.defineProperty(r,"prototype",{writable:!1}),r;var r,n}(y);function ue(){var e=this,t=function(t){var r=arguments.length>1&&void 0!==arguments[1]&&arguments[1];M(Y,e)&&M(q,e)&&e.interactive&&(U(ne,e,Date.now()),C(ae,e,Te).call(e,t,e.dropRadius*(r?1.5:1),r?.14:.01))};M(oe,this).mousemove=function(r){for(var n=M(L,e);n--;)t(r)},M(oe,this).touchmove=M(oe,this).touchstart=function(e){for(var r=e.touches,n=0;n<r.length;n++)t(r[n])},M(oe,this).mousedown=function(e){return t(e,!0)},Object.keys(M(oe,this)).forEach((function(t){return M(X,e)&&M(X,e).addEventListener(t,M(oe,e)[t],{passive:!0})}))}function le(){var e=this,t=this.gl,r=this.imageUrl||u(M(J,this))||u(window.getComputedStyle(M(X,this)).backgroundImage);if(r!==this.imageSource)if(this.imageSource=r,this.imageSource){var n=new Image;n.onload=function(){var r=function(e){return!(e&e-1)},i=r(n.width)&&r(n.height)?t.REPEAT:t.CLAMP_TO_EDGE;t.bindTexture(t.TEXTURE_2D,M(Q,e)),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_WRAP_S,i),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_WRAP_T,i),t.texImage2D(t.TEXTURE_2D,0,t.RGBA,t.RGBA,t.UNSIGNED_BYTE,n),U(ee,e,n.width),U(te,e,n.height),C(ae,e,ye).call(e)},n.onerror=function(){return C(ae,e,Ee).call(e)},n.crossOrigin=this.imageSource.match(/^data:/)?null:this.crossOrigin,n.src=this.imageSource}else C(ae,this,Ee).call(this)}function ce(){var e=this;M(Y,this)&&(C(ae,this,me).call(this),M(q,this)&&C(ae,this,de).call(this),C(ae,this,he).call(this),U(V,this,requestAnimationFrame((function(){return C(ae,e,ce).call(e)}))))}function fe(){var e=this.gl;e.bindBuffer(e.ARRAY_BUFFER,M(H,this)),e.vertexAttribPointer(0,2,e.FLOAT,!1,0,0),e.drawArrays(e.TRIANGLE_FAN,0,4)}function he(){var e=this.gl;e.bindFramebuffer(e.FRAMEBUFFER,null),e.viewport(0,0,this.canvas.width,this.canvas.height),e.enable(e.BLEND),e.clear(e.COLOR_BUFFER_BIT|e.DEPTH_BUFFER_BIT),e.useProgram(this.renderProgram.id),Reflect.apply(c,this,[M(Q,this),0]),Reflect.apply(c,this,[M(j,this)[0],1]),e.uniform1f(this.renderProgram.locations.perturbance,M(W,this)),e.uniform2fv(this.renderProgram.locations.topLeft,this.renderProgram.uniforms.topLeft),e.uniform2fv(this.renderProgram.locations.bottomRight,this.renderProgram.uniforms.bottomRight),e.uniform2fv(this.renderProgram.locations.containerRatio,this.renderProgram.uniforms.containerRatio),e.uniform1i(this.renderProgram.locations.samplerBackground,0),e.uniform1i(this.renderProgram.locations.samplerRipples,1),C(ae,this,fe).call(this),e.disable(e.BLEND)}function de(){if(this.idleFluctuations){var e=Date.now();e-M(ne,this)>M(ie,this)&&(U(ne,this,e),this.raindropsFall())}var t=this.gl;t.viewport(0,0,M(I,this),M(I,this)),t.bindFramebuffer(t.FRAMEBUFFER,M(N,this)[M(G,this)]),Reflect.apply(c,this,[M(j,this)[M(z,this)]]),t.useProgram(M(Z,this).id),C(ae,this,fe).call(this),C(ae,this,pe).call(this)}function pe(){U(G,this,1-M(G,this)),U(z,this,1-M(z,this))}function me(){var e,t,r,n=window.getComputedStyle(M(X,this)).backgroundSize,i=window.getComputedStyle(M(X,this)).backgroundAttachment,o=(e=window.getComputedStyle(M(X,this)).backgroundPosition,/\s+/.test(e)?e.replace(/center/,"50%").replace(/top|left/,"0%").replace(/bottom/,"100%").replace(/\s+/," ").split(" "):f(e)?[e,"50%"]:{center:["50%","50%"],top:["50%","0%"],bottom:["50%","100%"],left:["0%","50%"],right:["100%","50%"]}[e]),a="fixed"==i?{left:window.scrollX,top:window.scrollY,width:window.innerWidth,height:window.innerHeight}:{left:M(X,this).getBoundingClientRect().left,top:M(X,this).getBoundingClientRect().top,width:M(X,this).scrollWidth,height:M(X,this).scrollHeight};if("cover"==n){var s=Math.max(a.width/M(ee,this),a.height/M(te,this));t=M(ee,this)*s,r=M(te,this)*s}else if("contain"==n){var u=Math.min(a.width/M(ee,this),a.height/M(te,this));t=M(ee,this)*u,r=M(te,this)*u}else{var l=n.split(" ");t=l[0]||"",r=l[1]||t,f(t)?t=a.width*parseFloat(t)/100:"auto"!==t&&(t=parseFloat(t)),f(r)?r=a.height*parseFloat(r)/100:"auto"!==r&&(r=parseFloat(r)),"auto"==t&&"auto"==r?(t=M(ee,this),r=M(te,this)):("auto"==t&&(t=M(ee,this)*(Number(r)/M(te,this))),"auto"==r&&(r=M(te,this)*(Number(t)/M(ee,this))))}var c=o&&o[0]||"0%",h=o&&o[1]||"0%";c=f(c)?(a.left+(a.width-Number(t))*parseFloat(c)/100).toString():(a.left+parseFloat(c)).toString(),h=f(h)?(a.top+(a.height-Number(r))*parseFloat(h)/100).toString():(a.top+parseFloat(h)).toString(),this.renderProgram.uniforms.topLeft=new Float32Array([(M(X,this).offsetLeft-Number(c))/Number(t),(M(X,this).offsetTop-Number(h))/Number(r)]),this.renderProgram.uniforms.bottomRight=new Float32Array([this.renderProgram.uniforms.topLeft[0]+M(X,this).clientWidth/Number(t),this.renderProgram.uniforms.topLeft[1]+M(X,this).clientHeight/Number(r)]);var d=Math.max(this.canvas.width,this.canvas.height);this.renderProgram.uniforms.containerRatio=new Float32Array([this.canvas.width/d,this.canvas.height/d])}function ve(){var e=this.gl,t="\n attribute vec2 vertex;\n varying vec2 coord;\n void main() {\n coord = vertex * 0.5 + 0.5;\n gl_Position = vec4(vertex, 0.0, 1.0);\n }";U($,this,l(t,"precision highp float;\n\n const float PI = 3.141592653589793;\n uniform sampler2D texture;\n uniform vec2 center;\n uniform float radius;\n uniform float strength;\n\n varying vec2 coord;\n\n void main() {\n vec4 info = texture2D(texture, coord);\n\n float drop = max(0.0, 1.0 - length(center * 0.5 + 0.5 - coord) / radius);\n drop = 0.5 - cos(drop * PI) * 0.5;\n info.r += drop * strength;\n gl_FragColor = info;\n }",e)),U(Z,this,l(t,"precision highp float;\n\n uniform sampler2D texture;\n uniform vec2 delta;\n\n varying vec2 coord;\n\n void main() {\n vec4 info = texture2D(texture, coord);\n \n vec2 dx = vec2(delta.x, 0.0);\n vec2 dy = vec2(0.0, delta.y);\n \n float average = (\n texture2D(texture, coord - dx).r +\n texture2D(texture, coord - dy).r +\n texture2D(texture, coord + dx).r +\n texture2D(texture, coord + dy).r\n ) * 0.25;\n \n info.g += (average - info.r) * 2.0;\n info.g *= 0.995;\n info.r += info.g;\n \n gl_FragColor = info;\n }\n ",this.gl)),e.uniform2fv(M(Z,this).locations.delta,M(B,this)),this.renderProgram=l("\n precision highp float;\n\n attribute vec2 vertex;\n uniform vec2 topLeft;\n uniform vec2 bottomRight;\n uniform vec2 containerRatio;\n varying vec2 ripplesCoord;\n varying vec2 backgroundCoord;\n void main() {\n backgroundCoord = mix(topLeft, bottomRight, vertex * 0.5 + 0.5);\n backgroundCoord.y = 1.0 - backgroundCoord.y;\n ripplesCoord = vec2(vertex.x, -vertex.y) * containerRatio * 0.5 + 0.5;\n gl_Position = vec4(vertex.x, -vertex.y, 0.0, 1.0);\n }\n ","\n precision highp float;\n\n uniform sampler2D samplerBackground;\n uniform sampler2D samplerRipples;\n uniform vec2 delta;\n\n uniform float perturbance;\n varying vec2 ripplesCoord;\n varying vec2 backgroundCoord;\n\n void main() {\n float height = texture2D(samplerRipples, ripplesCoord).r;\n float heightX = texture2D(samplerRipples, vec2(ripplesCoord.x + delta.x, ripplesCoord.y)).r;\n float heightY = texture2D(samplerRipples, vec2(ripplesCoord.x, ripplesCoord.y + delta.y)).r;\n vec3 dx = vec3(delta.x, heightX - height, 0.0);\n vec3 dy = vec3(0.0, heightY - height, delta.y);\n vec2 offset = -normalize(cross(dy, dx)).xz;\n float specular = pow(max(0.0, dot(offset, normalize(vec2(-0.6, 1.0)))), 4.0);\n gl_FragColor = texture2D(samplerBackground, backgroundCoord + offset * perturbance) + specular;\n }",e),e.uniform2fv(this.renderProgram.locations.delta,M(B,this))}function ge(){var e=this.gl;U(Q,this,e.createTexture()),e.bindTexture(e.TEXTURE_2D,M(Q,this)),e.pixelStorei(e.UNPACK_FLIP_Y_WEBGL,1),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_MAG_FILTER,e.LINEAR),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_MIN_FILTER,e.LINEAR)}function Ee(){var e=this.gl;e.bindTexture(e.TEXTURE_2D,M(Q,this)),e.texImage2D(e.TEXTURE_2D,0,e.RGBA,e.RGBA,e.UNSIGNED_BYTE,this.transparentPixels)}function ye(){var e=M(X,this).style.backgroundImage;"none"!=e&&(U(re,this,e),U(J,this,window.getComputedStyle(M(X,this)).backgroundImage),M(X,this).style.backgroundImage="none")}function be(){M(X,this).style.backgroundImage=M(re,this)||""}function Te(e,t,r){var n=window.getComputedStyle(M(X,this)),i=parseInt(n.borderLeftWidth)||0,o=parseInt(n.borderTopWidth)||0;this.drop(e.pageX-M(X,this).offsetLeft-i,e.pageY-M(X,this).offsetTop-o,t,r)}function Re(e,t){var r=(0,i.useRef)(null);return(0,i.useEffect)((function(){return r.current=new se(e.current,void 0===t.children,t.option),function(){return r.current.destroy()}}),[]),r}},552:(e,t,r)=>{r.d(t,{O:()=>i});var n=r(649);function i(){var e=(0,n.useRef)(void 0);return(0,n.useEffect)((function(){return function(){e.current&&clearTimeout(e.current)}}),[]),e}},649:(e,r,n)=>{var i,o;e.exports=(i={default:()=>t.default,useEffect:()=>t.useEffect,useRef:()=>t.useRef},o={},n.d(o,i),o)}},n={};function i(e){var t=n[e];if(void 0!==t)return t.exports;var o=n[e]={exports:{}};return r[e](o,o.exports,i),o.exports}i.d=(e,t)=>{for(var r in t)i.o(t,r)&&!i.o(e,r)&&Object.defineProperty(e,r,{enumerable:!0,get:t[r]})},i.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t);var o={};i.d(o,{z_:()=>a.z,MM:()=>u.M,nC:()=>l.n,Oe:()=>s.O});var a=i(805),s=i(552),u=i(615),l=i(566),c=o.z_,f=o.MM,h=o.nC,d=o.Oe;export{c as BackgroundRipple,f as useAnimationFrameId,h as useRipples,d as useTimeId};
|
|
@@ -0,0 +1,351 @@
|
|
|
1
|
+
@charset "UTF-8";
|
|
2
|
+
:root {
|
|
3
|
+
--box-shadow: 0 5px 13px 0 rgba(10, 15, 71, 0.2);
|
|
4
|
+
--font-mono: ui-monospace, Menlo, Monaco, "Cascadia Mono", "Segoe UI Mono", "Roboto Mono", "Oxygen Mono",
|
|
5
|
+
"Ubuntu Monospace", "Source Code Pro", "Fira Mono", "Droid Sans Mono", "Courier New", monospace;
|
|
6
|
+
--mi-white: #ffffff;
|
|
7
|
+
--mi-mi-white: #f0f2e6;
|
|
8
|
+
--mi-dark-blue: #465e65;
|
|
9
|
+
--mi-mi-yellow: #c2c6ae;
|
|
10
|
+
--mi-orange: #fa0;
|
|
11
|
+
--mi-green: #0b8;
|
|
12
|
+
--mi-red: #f16;
|
|
13
|
+
/** */
|
|
14
|
+
--mi-orange-yellow: #c99e8c;
|
|
15
|
+
/*(橘红)*/
|
|
16
|
+
--mi-orange-red: #900022;
|
|
17
|
+
--mi-light-red: #d80010;
|
|
18
|
+
--mi-dark-ash: #6c8650;
|
|
19
|
+
--mi-mi-pretty: #b2b6b6;
|
|
20
|
+
--mi-light-black: #777;
|
|
21
|
+
--mi-black: #000;
|
|
22
|
+
--mi-dust: #999;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
*,
|
|
26
|
+
a,
|
|
27
|
+
body,
|
|
28
|
+
abbr,
|
|
29
|
+
address,
|
|
30
|
+
area,
|
|
31
|
+
div,
|
|
32
|
+
img,
|
|
33
|
+
input,
|
|
34
|
+
p,
|
|
35
|
+
mark,
|
|
36
|
+
html,
|
|
37
|
+
span {
|
|
38
|
+
position: relative;
|
|
39
|
+
left: auto;
|
|
40
|
+
top: auto;
|
|
41
|
+
box-sizing: border-box;
|
|
42
|
+
margin: 0;
|
|
43
|
+
padding: 0;
|
|
44
|
+
border: 0;
|
|
45
|
+
font: inherit;
|
|
46
|
+
vertical-align: baseline;
|
|
47
|
+
-webkit-user-drag: none;
|
|
48
|
+
-webkit-user-select: none;
|
|
49
|
+
user-select: none;
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
body {
|
|
53
|
+
line-height: 1.4;
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
a {
|
|
57
|
+
text-decoration: none;
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
ol,
|
|
61
|
+
ul {
|
|
62
|
+
list-style: none;
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
blockquote::before,
|
|
66
|
+
blockquote::after,
|
|
67
|
+
q::before,
|
|
68
|
+
q::after {
|
|
69
|
+
content: "";
|
|
70
|
+
content: none;
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
table {
|
|
74
|
+
border-collapse: collapse;
|
|
75
|
+
border-spacing: 0;
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
input:focus-visible {
|
|
79
|
+
outline: none;
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
input[type=button],
|
|
83
|
+
.cursor-pointer {
|
|
84
|
+
cursor: pointer;
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
/** 输入框 */
|
|
88
|
+
input[type=text] {
|
|
89
|
+
width: 200px;
|
|
90
|
+
border-radius: 10px;
|
|
91
|
+
background-color: #000;
|
|
92
|
+
color: #0f9;
|
|
93
|
+
}
|
|
94
|
+
input[type=text]::placeholder {
|
|
95
|
+
color: rgba(170, 255, 255, 0.6);
|
|
96
|
+
}
|
|
97
|
+
input[type=text]:focus::placeholder {
|
|
98
|
+
color: transparent;
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
input[type=radio] {
|
|
102
|
+
width: 0;
|
|
103
|
+
height: 0;
|
|
104
|
+
overflow: hidden;
|
|
105
|
+
}
|
|
106
|
+
input[type=radio] + label {
|
|
107
|
+
padding-left: 15px;
|
|
108
|
+
}
|
|
109
|
+
input[type=radio] + label::before, input[type=radio] + label::after {
|
|
110
|
+
content: "";
|
|
111
|
+
position: absolute;
|
|
112
|
+
border-radius: 50%;
|
|
113
|
+
top: 50%;
|
|
114
|
+
transform: translate(0, -50%);
|
|
115
|
+
overflow: hidden;
|
|
116
|
+
}
|
|
117
|
+
input[type=radio] + label::before {
|
|
118
|
+
left: 0px;
|
|
119
|
+
height: 8px;
|
|
120
|
+
width: 8px;
|
|
121
|
+
box-shadow: 1px 1px 3px #000;
|
|
122
|
+
z-index: 1;
|
|
123
|
+
}
|
|
124
|
+
input[type=radio] + label::after {
|
|
125
|
+
font-size: 8px;
|
|
126
|
+
line-height: 8px;
|
|
127
|
+
z-index: 2;
|
|
128
|
+
left: 0px;
|
|
129
|
+
height: 8px;
|
|
130
|
+
width: 8px;
|
|
131
|
+
color: #fff;
|
|
132
|
+
background-color: #000;
|
|
133
|
+
clip-path: circle(0%);
|
|
134
|
+
transition: all 0.3s;
|
|
135
|
+
}
|
|
136
|
+
input[type=radio]:checked {
|
|
137
|
+
color: #f00;
|
|
138
|
+
}
|
|
139
|
+
input[type=radio]:checked + label {
|
|
140
|
+
color: #0a3;
|
|
141
|
+
}
|
|
142
|
+
input[type=radio]:checked + label::before {
|
|
143
|
+
box-shadow: 1px 1px 3px #0f3, -1px -1px 3px #0f3;
|
|
144
|
+
}
|
|
145
|
+
input[type=radio]:checked + label::after {
|
|
146
|
+
background-color: #0a3;
|
|
147
|
+
clip-path: circle(100%);
|
|
148
|
+
transition: all 0.8s;
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
input[type=image] {
|
|
152
|
+
-webkit-user-select: none;
|
|
153
|
+
user-select: none;
|
|
154
|
+
}
|
|
155
|
+
|
|
156
|
+
.center {
|
|
157
|
+
position: absolute;
|
|
158
|
+
left: 50%;
|
|
159
|
+
top: 50%;
|
|
160
|
+
transform: translate(-50%, -50%);
|
|
161
|
+
}
|
|
162
|
+
|
|
163
|
+
img {
|
|
164
|
+
-webkit-touch-callout: none;
|
|
165
|
+
-webkit-user-select: none;
|
|
166
|
+
-khtml-user-select: none;
|
|
167
|
+
-moz-user-select: none;
|
|
168
|
+
-ms-user-select: none;
|
|
169
|
+
user-select: none;
|
|
170
|
+
}
|
|
171
|
+
|
|
172
|
+
/** 文本显示一行,超出点点点 */
|
|
173
|
+
.textInOneLine {
|
|
174
|
+
white-space: nowrap;
|
|
175
|
+
text-overflow: ellipsis;
|
|
176
|
+
overflow: hidden;
|
|
177
|
+
word-break: break-all;
|
|
178
|
+
}
|
|
179
|
+
|
|
180
|
+
.textInOneLineHide {
|
|
181
|
+
white-space: nowrap;
|
|
182
|
+
text-overflow: clip;
|
|
183
|
+
overflow: hidden;
|
|
184
|
+
word-break: break-all;
|
|
185
|
+
}
|
|
186
|
+
|
|
187
|
+
/** 文本显示两行,超出点点点 */
|
|
188
|
+
.textInTwoLine {
|
|
189
|
+
overflow: hidden;
|
|
190
|
+
text-overflow: ellipsis;
|
|
191
|
+
display: -webkit-box;
|
|
192
|
+
-webkit-line-clamp: 2;
|
|
193
|
+
line-clamp: 2;
|
|
194
|
+
-webkit-box-orient: vertical;
|
|
195
|
+
}
|
|
196
|
+
|
|
197
|
+
/* 彩色字 */
|
|
198
|
+
.colorText {
|
|
199
|
+
color: transparent;
|
|
200
|
+
background-image: linear-gradient(45deg, #ff0, #0f0, #f00, #0ff, #00f, #f0f, #ff0);
|
|
201
|
+
background-position: 0% 0%;
|
|
202
|
+
background-size: 400% 200%;
|
|
203
|
+
background-clip: text;
|
|
204
|
+
animation: 6s ease-in 0s infinite colorText alternate;
|
|
205
|
+
}
|
|
206
|
+
|
|
207
|
+
.redB {
|
|
208
|
+
background-color: #f12;
|
|
209
|
+
}
|
|
210
|
+
|
|
211
|
+
.floatLeft {
|
|
212
|
+
float: left;
|
|
213
|
+
}
|
|
214
|
+
|
|
215
|
+
.floatRight,
|
|
216
|
+
.float {
|
|
217
|
+
float: right;
|
|
218
|
+
}
|
|
219
|
+
|
|
220
|
+
.clear {
|
|
221
|
+
clear: both;
|
|
222
|
+
}
|
|
223
|
+
|
|
224
|
+
.loading {
|
|
225
|
+
position: relative;
|
|
226
|
+
width: 100%;
|
|
227
|
+
height: 100%;
|
|
228
|
+
background-color: transparent;
|
|
229
|
+
background-image: radial-gradient(#f00, #f00 50%, transparent 50%, transparent), radial-gradient(#af1, #af1 50%, transparent 50%, transparent), radial-gradient(#0ff, #0ff 50%, transparent 50%, transparent), radial-gradient(#f0f, #f0f 50%, transparent 50%, transparent);
|
|
230
|
+
background-repeat: no-repeat;
|
|
231
|
+
animation: 2.4s ease-in-out 0s infinite loading;
|
|
232
|
+
}
|
|
233
|
+
|
|
234
|
+
@keyframes loading {
|
|
235
|
+
100%, 0% {
|
|
236
|
+
background-size: 10% 10%, 10% 10%, 10% 10%, 10% 10%;
|
|
237
|
+
background-position: 25% 45%, 41.7% 45%, 58.3% 45%, 75% 45%;
|
|
238
|
+
}
|
|
239
|
+
20%, 80% {
|
|
240
|
+
background-size: 2.5% 2.5%;
|
|
241
|
+
background-position: 25% 45%;
|
|
242
|
+
}
|
|
243
|
+
22% {
|
|
244
|
+
background-size: 3.75% 3.75%, 2.5% 2.5%, 2.5% 2.5%, 2.5% 2.5%;
|
|
245
|
+
background-position: 25.85% 38.53%, 25% 45%, 25% 45%, 25% 45%;
|
|
246
|
+
}
|
|
247
|
+
24% {
|
|
248
|
+
background-size: 5% 5%, 2.5% 2.5%, 2.5% 2.5%, 2.5% 2.5%;
|
|
249
|
+
background-position: 28.35% 32.5%, 25% 45%, 25% 45%, 25% 45%;
|
|
250
|
+
}
|
|
251
|
+
26% {
|
|
252
|
+
background-size: 6.25% 6.25%, 2.5% 2.5%, 2.5% 2.5%, 2.5% 2.5%;
|
|
253
|
+
background-position: 32.32% 27.32%, 25% 45%, 25% 45%, 25% 45%;
|
|
254
|
+
}
|
|
255
|
+
28% {
|
|
256
|
+
background-size: 7.5% 7.5%, 3.75% 3.75%, 2.5% 2.5%, 2.5% 2.5%;
|
|
257
|
+
background-position: 37.5% 23.35%, 25.85% 38.53%, 25% 45%, 25% 45%;
|
|
258
|
+
}
|
|
259
|
+
30% {
|
|
260
|
+
background-size: 8.75% 8.75%, 5% 5%, 2.5% 2.5%, 2.5% 2.5%;
|
|
261
|
+
background-position: 43.53% 20.85%, 28.35% 32.5%, 25% 45%, 25% 45%;
|
|
262
|
+
}
|
|
263
|
+
32% {
|
|
264
|
+
background-size: 10% 10%, 6.25% 6.25%, 3.75% 3.75%, 2.5% 2.5%;
|
|
265
|
+
background-position: 50% 20%, 32.32% 27.32%, 25.85% 38.53%, 25% 45%;
|
|
266
|
+
}
|
|
267
|
+
34% {
|
|
268
|
+
background-size: 10% 10%, 7.5% 7.5%, 5% 5%, 2.5% 2.5%;
|
|
269
|
+
background-position: 56.47% 20.85%, 37.32% 23.35%, 28.35% 32.5%, 25.85% 38.53%;
|
|
270
|
+
}
|
|
271
|
+
36% {
|
|
272
|
+
background-position: 62.4999992265% 23.3493644588%, 43.5295233332% 20.8518544873%, 32.3223302335% 27.3223307072%, 25.8518543139% 38.5295239803%;
|
|
273
|
+
}
|
|
274
|
+
38% {
|
|
275
|
+
background-position: 67.6776688192% 27.3223297598%, 49.9999993301% 20%, 37.4999996132% 23.3493651287%, 28.3493647937% 32.5000001934%;
|
|
276
|
+
}
|
|
277
|
+
40% {
|
|
278
|
+
background-position: 71.6506345364% 32.4999990331%, 56.4704753727% 20.8518541405%, 43.5295233332% 20.8518544873%, 32.3223302335% 27.3223307072%;
|
|
279
|
+
}
|
|
280
|
+
42% {
|
|
281
|
+
background-position: 74.1481453394% 38.5295226862%, 62.4999992265% 23.3493644588%, 49.9999993301% 20%, 37.4999996132% 23.3493651287%;
|
|
282
|
+
}
|
|
283
|
+
44% {
|
|
284
|
+
background-position: 75% 44.9999986603%, 67.6776688192% 27.3223297598%, 56.4704753727% 20.8518541405%, 43.5295233332% 20.8518544873%;
|
|
285
|
+
}
|
|
286
|
+
46% {
|
|
287
|
+
background-position: 74.1481460329% 51.4704747256%, 71.6506345364% 32.4999990331%, 62.4999992265% 23.3493644588%, 49.9999993301% 20%;
|
|
288
|
+
}
|
|
289
|
+
48% {
|
|
290
|
+
background-position: 71.6506358761% 57.4999986464%, 74.1481453394% 38.5295226862%, 67.6776688192% 27.3223297598%, 56.4704753727% 20.8518541405%;
|
|
291
|
+
}
|
|
292
|
+
50% {
|
|
293
|
+
background-position: 67.6776707138% 62.6776683455%, 75% 44.9999986603%, 71.6506345364% 32.4999990331%, 62.4999992265% 23.3493644588%;
|
|
294
|
+
}
|
|
295
|
+
52% {
|
|
296
|
+
background-position: 62.500001547% 66.6506342014%, 74.1481460329% 51.4704747256%, 74.1481453394% 38.5295226862%, 67.6776688192% 27.3223297598%;
|
|
297
|
+
}
|
|
298
|
+
54% {
|
|
299
|
+
background-position: 56.4704779609% 69.148145166%, 71.6506358761% 57.4999986464%, 75% 44.9999986603%, 71.6506345364% 32.4999990331%;
|
|
300
|
+
}
|
|
301
|
+
56% {
|
|
302
|
+
background-position: 50.0000020096% 70%, 67.6776707138% 62.6776683455%, 74.1481460329% 51.4704747256%, 74.1481453394% 38.5295226862%;
|
|
303
|
+
}
|
|
304
|
+
58% {
|
|
305
|
+
background-position: 43.5295259214% 69.1481462062%, 62.500001547% 66.6506342014%, 71.6506358761% 57.4999986464%, 75% 44.9999986603%;
|
|
306
|
+
}
|
|
307
|
+
60% {
|
|
308
|
+
background-position: 37.5000019338% 66.6506362111%, 56.4704779609% 69.148145166%, 67.6776707138% 62.6776683455%, 74.1481460329% 51.4704747256%;
|
|
309
|
+
}
|
|
310
|
+
62% {
|
|
311
|
+
background-position: 32.3223321282% 62.6776711875%, 50.0000020096% 70%, 62.500001547% 66.6506342014%, 71.6506358761% 57.4999986464%;
|
|
312
|
+
}
|
|
313
|
+
64% {
|
|
314
|
+
background-position: 28.3493661335% 57.5000021271%, 43.5295259214% 69.1481462062%, 56.4704779609% 69.148145166%, 67.6776707138% 62.6776683455%;
|
|
315
|
+
}
|
|
316
|
+
66% {
|
|
317
|
+
background-position: 25.8518550074% 51.4704786079%, 37.5000019338% 66.6506362111%, 50.0000020096% 70%, 62.500001547% 66.6506342014%;
|
|
318
|
+
}
|
|
319
|
+
68% {
|
|
320
|
+
background-size: 10% 10%, 7.5% 7.5%, 5% 5%, 2.5% 2.5%;
|
|
321
|
+
background-position: 25% 45%, 28.35% 57.45%, 37.45% 66.65%, 48% 70%;
|
|
322
|
+
}
|
|
323
|
+
70% {
|
|
324
|
+
background-size: 8.75% 8.75%, 7.5% 7.5%, 5% 5%, 2.5% 2.5%;
|
|
325
|
+
background-position: 25% 45%, 25.85% 51.47%, 32.32% 62.68%, 43.53% 69.15%;
|
|
326
|
+
}
|
|
327
|
+
72% {
|
|
328
|
+
background-size: 7.5% 7.5%, 7.5% 7.5%, 5% 5%, 2.5% 2.5%;
|
|
329
|
+
background-position: 25% 45%, 25% 45%, 28.35% 57.45%, 37.45% 66.65%;
|
|
330
|
+
}
|
|
331
|
+
74% {
|
|
332
|
+
background-size: 6.25% 6.25%, 6.25% 6.25%, 5% 5%, 2.5% 2.5%;
|
|
333
|
+
background-position: 25% 45%, 25% 45%, 25.85% 51.47%, 32.32% 62.68%;
|
|
334
|
+
}
|
|
335
|
+
76% {
|
|
336
|
+
background-size: 5% 5%, 5% 5%, 5% 5%, 2.5% 2.5%;
|
|
337
|
+
background-position: 25% 45%, 25% 45%, 25% 45%, 28.35% 57.45%;
|
|
338
|
+
}
|
|
339
|
+
78% {
|
|
340
|
+
background-size: 3.75% 3.75%, 3.75% 3.75%, 3.75% 3.75%, 2.5% 2.5%;
|
|
341
|
+
background-position: 25% 45%, 25% 45%, 25% 45%, 25.85% 51.47%;
|
|
342
|
+
}
|
|
343
|
+
}
|
|
344
|
+
@keyframes colorText {
|
|
345
|
+
0% {
|
|
346
|
+
background-position: 400% 0%;
|
|
347
|
+
}
|
|
348
|
+
100% {
|
|
349
|
+
background-position: 0% 0%;
|
|
350
|
+
}
|
|
351
|
+
}
|