vault66-crt-effect
Version:
A customizable CRT visual effect component for React
23 lines (22 loc) • 7.55 kB
JavaScript
;const re=require("react");var A={exports:{}},v={};/**
* @license React
* react-jsx-runtime.production.js
*
* Copyright (c) Meta Platforms, Inc. and affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/var B;function te(){if(B)return v;B=1;var l=Symbol.for("react.transitional.element"),E=Symbol.for("react.fragment");function i(f,a,s){var d=null;if(s!==void 0&&(d=""+s),a.key!==void 0&&(d=""+a.key),"key"in a){s={};for(var m in a)m!=="key"&&(s[m]=a[m])}else s=a;return a=s.ref,{$$typeof:l,type:f,key:d,ref:a!==void 0?a:null,props:s}}return v.Fragment=E,v.jsx=i,v.jsxs=i,v}var _={};/**
* @license React
* react-jsx-runtime.development.js
*
* Copyright (c) Meta Platforms, Inc. and affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/var X;function ne(){return X||(X=1,process.env.NODE_ENV!=="production"&&function(){function l(e){if(e==null)return null;if(typeof e=="function")return e.$$typeof===Q?null:e.displayName||e.name||null;if(typeof e=="string")return e;switch(e){case p:return"Fragment";case N:return"Profiler";case x:return"StrictMode";case $:return"Suspense";case S:return"SuspenseList";case Z:return"Activity"}if(typeof e=="object")switch(typeof e.tag=="number"&&console.error("Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."),e.$$typeof){case y:return"Portal";case C:return(e.displayName||"Context")+".Provider";case O:return(e._context.displayName||"Context")+".Consumer";case Y:var r=e.render;return e=e.displayName,e||(e=r.displayName||r.name||"",e=e!==""?"ForwardRef("+e+")":"ForwardRef"),e;case W:return r=e.displayName||null,r!==null?r:l(e.type)||"Memo";case j:r=e._payload,e=e._init;try{return l(e(r))}catch{}}return null}function E(e){return""+e}function i(e){try{E(e);var r=!1}catch{r=!0}if(r){r=console;var t=r.error,n=typeof Symbol=="function"&&Symbol.toStringTag&&e[Symbol.toStringTag]||e.constructor.name||"Object";return t.call(r,"The provided key is an unsupported type %s. This value must be coerced to a string before using it here.",n),E(e)}}function f(e){if(e===p)return"<>";if(typeof e=="object"&&e!==null&&e.$$typeof===j)return"<...>";try{var r=l(e);return r?"<"+r+">":"<...>"}catch{return"<...>"}}function a(){var e=F.A;return e===null?null:e.getOwner()}function s(){return Error("react-stack-top-frame")}function d(e){if(z.call(e,"key")){var r=Object.getOwnPropertyDescriptor(e,"key").get;if(r&&r.isReactWarning)return!1}return e.key!==void 0}function m(e,r){function t(){U||(U=!0,console.error("%s: `key` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://react.dev/link/special-props)",r))}t.isReactWarning=!0,Object.defineProperty(e,"key",{get:t,configurable:!0})}function T(){var e=l(this.type);return q[e]||(q[e]=!0,console.error("Accessing element.ref was removed in React 19. ref is now a regular prop. It will be removed from the JSX Element type in a future release.")),e=this.props.ref,e!==void 0?e:null}function P(e,r,t,n,u,c,D,M){return t=c.ref,e={$$typeof:k,type:e,key:r,props:c,_owner:u},(t!==void 0?t:null)!==null?Object.defineProperty(e,"ref",{enumerable:!1,get:T}):Object.defineProperty(e,"ref",{enumerable:!1,value:null}),e._store={},Object.defineProperty(e._store,"validated",{configurable:!1,enumerable:!1,writable:!0,value:0}),Object.defineProperty(e,"_debugInfo",{configurable:!1,enumerable:!1,writable:!0,value:null}),Object.defineProperty(e,"_debugStack",{configurable:!1,enumerable:!1,writable:!0,value:D}),Object.defineProperty(e,"_debugTask",{configurable:!1,enumerable:!1,writable:!0,value:M}),Object.freeze&&(Object.freeze(e.props),Object.freeze(e)),e}function g(e,r,t,n,u,c,D,M){var o=r.children;if(o!==void 0)if(n)if(K(o)){for(n=0;n<o.length;n++)w(o[n]);Object.freeze&&Object.freeze(o)}else console.error("React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead.");else w(o);if(z.call(r,"key")){o=l(e);var R=Object.keys(r).filter(function(ee){return ee!=="key"});n=0<R.length?"{key: someKey, "+R.join(": ..., ")+": ...}":"{key: someKey}",V[o+n]||(R=0<R.length?"{"+R.join(": ..., ")+": ...}":"{}",console.error(`A props object containing a "key" prop is being spread into JSX:
let props = %s;
<%s {...props} />
React keys must be passed directly to JSX without using spread:
let props = %s;
<%s key={someKey} {...props} />`,n,o,R,o),V[o+n]=!0)}if(o=null,t!==void 0&&(i(t),o=""+t),d(r)&&(i(r.key),o=""+r.key),"key"in r){t={};for(var L in r)L!=="key"&&(t[L]=r[L])}else t=r;return o&&m(t,typeof e=="function"?e.displayName||e.name||"Unknown":e),P(e,o,c,u,a(),t,D,M)}function w(e){typeof e=="object"&&e!==null&&e.$$typeof===k&&e._store&&(e._store.validated=1)}var b=re,k=Symbol.for("react.transitional.element"),y=Symbol.for("react.portal"),p=Symbol.for("react.fragment"),x=Symbol.for("react.strict_mode"),N=Symbol.for("react.profiler"),O=Symbol.for("react.consumer"),C=Symbol.for("react.context"),Y=Symbol.for("react.forward_ref"),$=Symbol.for("react.suspense"),S=Symbol.for("react.suspense_list"),W=Symbol.for("react.memo"),j=Symbol.for("react.lazy"),Z=Symbol.for("react.activity"),Q=Symbol.for("react.client.reference"),F=b.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,z=Object.prototype.hasOwnProperty,K=Array.isArray,I=console.createTask?console.createTask:function(){return null};b={"react-stack-bottom-frame":function(e){return e()}};var U,q={},G=b["react-stack-bottom-frame"].bind(b,s)(),J=I(f(s)),V={};_.Fragment=p,_.jsx=function(e,r,t,n,u){var c=1e4>F.recentlyCreatedOwnerStacks++;return g(e,r,t,!1,n,u,c?Error("react-stack-top-frame"):G,c?I(f(e)):J)},_.jsxs=function(e,r,t,n,u){var c=1e4>F.recentlyCreatedOwnerStacks++;return g(e,r,t,!0,n,u,c?Error("react-stack-top-frame"):G,c?I(f(e)):J)}}()),_}var H;function oe(){return H||(H=1,process.env.NODE_ENV==="production"?A.exports=te():A.exports=ne()),A.exports}var h=oe();const ae=({enabled:l=!0,sweepDuration:E=10,sweepThickness:i=10,sweepStyle:f="classic",scanlineOpacity:a=.2,scanlineColor:s="rgba(91, 179, 135, 0.2)",enableScanlines:d=!0,enableSweep:m=!0,theme:T="green",enableGlow:P=!1,glowColor:g="rgba(0, 255, 128, 0.3)",enableEdgeGlow:w=!1,edgeGlowColor:b="rgba(0, 255, 128, 0.2)",edgeGlowSize:k=30,enableFlicker:y=!1,scanlineOrientation:p="horizontal",children:x})=>{if(!l)return h.jsx(h.Fragment,{children:x});const N=$=>{const S=$.match(/rgba?\(\s*([\d\s.,]+)\)/);return S?S[1].split(",").map(j=>j.trim()).slice(0,3).join(", "):"91, 179, 135"},O={green:"91, 179, 135",amber:"255, 200, 100",blue:"100, 200, 255"},C=T!=="custom"?O[T]??O.green:N(s),Y=["crt-effect-wrapper",d&&"scanlines-on",m&&(f==="classic"?"sweep-on":"sweep-soft"),w&&"edge-glow-on",y&&"flicker-on"].filter(Boolean).join(" ");return h.jsx("div",{className:Y,style:{position:"relative","--sweep-duration":`${E}s`,"--sweep-thickness":`${i}px`,"--scanline-opacity":a,"--scanline-color-rgb":C,"--glow-color":g,"--edge-glow-color":b,"--edge-glow-size":`${k}px`,"--scanline-gradient-direction":p==="horizontal"?"to bottom":"to right"},children:h.jsx("div",{className:"crt-inner",style:{boxShadow:P?"0 0 6px var(--glow-color), 0 0 12px var(--glow-color), 0 0 20px var(--glow-color)":void 0},children:x})})};module.exports=ae;