cos-design 2.4.0 → 2.4.1
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/CHANGELOG.md +21 -0
- package/dist/components/_shared/visibility.d.ts +3 -0
- package/dist/components/matrixRain/index.d.ts +6 -0
- package/dist/components/particleNetwork/index.d.ts +2 -0
- package/dist/components/returnCity/index.d.ts +2 -2
- package/dist/components/waveButton/index.d.ts +1 -3
- package/dist/index.cjs +1 -1
- package/dist/index.css +1 -1
- package/dist/index.js +289 -207
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -5,6 +5,26 @@ All notable changes to this project will be documented in this file.
|
|
|
5
5
|
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
|
|
6
6
|
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
|
7
7
|
|
|
8
|
+
## [2.4.1] - 2026-06-18
|
|
9
|
+
|
|
10
|
+
### Fixed
|
|
11
|
+
|
|
12
|
+
- `Charge` 恢复原版 gooey 充电动效,修正气泡 nth-child 错位与容器高度动画,Demo 全屏展示
|
|
13
|
+
- `Fireworks` 移除重复自动燃放逻辑,页面隐藏时暂停动画
|
|
14
|
+
- `Countdown` 校验无效日期,倒计时结束后停止定时器
|
|
15
|
+
- `Typewriter` 空文案保护,`texts` 变更时重置状态
|
|
16
|
+
- `Confetti` 分离自动喷射与画布循环,避免重复触发
|
|
17
|
+
- `ReturnCity` 基于容器尺寸定位星星,默认 `glassCount` 改为 8
|
|
18
|
+
- `FlipCounter` 修复翻牌数字裁切与动画层逻辑
|
|
19
|
+
|
|
20
|
+
### Changed
|
|
21
|
+
|
|
22
|
+
- Canvas 组件(Fireworks、Confetti、MeteorRain、MatrixRain、ParticleNetwork)页面隐藏时暂停 RAF
|
|
23
|
+
- `MeteorRain` 优化流星绘制,避免每帧创建渐变对象
|
|
24
|
+
- `MatrixRain` 叠层标题支持 `showOverlay` / `title` / `subtitle` 配置
|
|
25
|
+
- `ParticleNetwork` 新增 `repelRadius`,支持触摸互动
|
|
26
|
+
- `WaveButton` 支持原生 `button` 属性(如 `disabled`)
|
|
27
|
+
|
|
8
28
|
## [2.4.0] - 2026-06-18
|
|
9
29
|
|
|
10
30
|
### Added
|
|
@@ -86,6 +106,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
|
86
106
|
- Webpack 及相关 loader 依赖
|
|
87
107
|
- UMD 格式产物
|
|
88
108
|
|
|
109
|
+
[2.4.1]: https://github.com/jiaxiantao/cos-design/compare/v2.4.0...v2.4.1
|
|
89
110
|
[2.4.0]: https://github.com/jiaxiantao/cos-design/compare/v2.3.0...v2.4.0
|
|
90
111
|
[2.3.0]: https://github.com/jiaxiantao/cos-design/compare/v2.2.0...v2.3.0
|
|
91
112
|
[2.2.0]: https://github.com/jiaxiantao/cos-design/compare/v2.1.0...v2.2.0
|
|
@@ -6,6 +6,12 @@ export interface MatrixRainProps {
|
|
|
6
6
|
density?: number;
|
|
7
7
|
/** 主色调 */
|
|
8
8
|
color?: string;
|
|
9
|
+
/** 是否显示标题叠层,默认 true */
|
|
10
|
+
showOverlay?: boolean;
|
|
11
|
+
/** 叠层标题 */
|
|
12
|
+
title?: string;
|
|
13
|
+
/** 叠层副标题 */
|
|
14
|
+
subtitle?: string;
|
|
9
15
|
}
|
|
10
16
|
declare const MatrixRain: React.FC<MatrixRainProps>;
|
|
11
17
|
export default MatrixRain;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { default as React } from 'react';
|
|
2
2
|
export interface ReturnCityProps {
|
|
3
|
-
/**
|
|
3
|
+
/** 星星数量,默认按容器宽度自动计算 */
|
|
4
4
|
starCount?: number;
|
|
5
|
-
/** 光壁数量,默认
|
|
5
|
+
/** 光壁数量,默认 8 */
|
|
6
6
|
glassCount?: number;
|
|
7
7
|
/** 光壁半径(px),默认 150 */
|
|
8
8
|
glassRadius?: number;
|
|
@@ -1,9 +1,7 @@
|
|
|
1
1
|
import { default as React } from 'react';
|
|
2
|
-
export interface WaveButtonProps {
|
|
2
|
+
export interface WaveButtonProps extends Omit<React.ButtonHTMLAttributes<HTMLButtonElement>, 'children'> {
|
|
3
3
|
/** 按钮文字 */
|
|
4
4
|
text?: string;
|
|
5
|
-
/** 点击回调 */
|
|
6
|
-
onClick?: () => void;
|
|
7
5
|
/** 主色 */
|
|
8
6
|
color?: string;
|
|
9
7
|
}
|
package/dist/index.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});require('./index.css');var e=Object.create,t=Object.defineProperty,n=Object.getOwnPropertyDescriptor,r=Object.getOwnPropertyNames,i=Object.getPrototypeOf,a=Object.prototype.hasOwnProperty,o=(e,i,o,s)=>{if(i&&typeof i==`object`||typeof i==`function`)for(var c=r(i),l=0,u=c.length,d;l<u;l++)d=c[l],!a.call(e,d)&&d!==o&&t(e,d,{get:(e=>i[e]).bind(null,d),enumerable:!(s=n(i,d))||s.enumerable});return e},s=(n,r,a)=>(a=n==null?{}:e(i(n)),o(r||!n||!n.__esModule?t(a,`default`,{value:n,enumerable:!0}):a,n));let c=require("react");c=s(c,1);let l=require("react/jsx-runtime");var u={canvasClock:`cos-canvasClock-QvdV3`,canvasTarget:`cos-canvasTarget-x-odC`},d=({width:e=400,height:t=400})=>{let n=(0,c.useRef)(null),r=Math.min(e,t),i=r/2-16,a=r/2,o=(0,c.useCallback)(e=>{e.clearRect(0,0,r,r),e.save(),e.translate(a,a),e.beginPath(),e.arc(0,0,i,0,Math.PI*2),e.fillStyle=`#fff`,e.fill(),e.strokeStyle=`#d1d5db`,e.lineWidth=2,e.stroke();for(let t=0;t<60;t++){let n=t/60*Math.PI*2,r=i-(t%5==0?14:8);e.beginPath(),e.moveTo(Math.cos(n)*r,Math.sin(n)*r),e.lineTo(Math.cos(n)*i,Math.sin(n)*i),e.strokeStyle=t%5==0?`#374151`:`#9ca3af`,e.lineWidth=t%5==0?2:1,e.stroke()}e.fillStyle=`#111827`,e.font=`bold ${Math.floor(r/22)}px system-ui, sans-serif`,e.textAlign=`center`,e.textBaseline=`middle`;for(let t=1;t<=12;t++){let n=t/12*Math.PI*2-Math.PI/2,r=i-32;e.fillText(String(t),Math.cos(n)*r,Math.sin(n)*r)}let t=new Date,n=t.getHours()%12,o=t.getMinutes(),s=t.getSeconds(),c=t.getMilliseconds(),l=(t,n,r,i,a)=>{e.save(),e.rotate(t),e.beginPath(),e.moveTo(0,r),e.lineTo(n,0),e.lineTo(0,-r),e.closePath(),e.fillStyle=i,e.shadowColor=a,e.shadowBlur=4,e.fill(),e.restore()},u=(n+o/60)/12*Math.PI*2-Math.PI/2,d=(o+s/60)/60*Math.PI*2-Math.PI/2,f=(s+c/1e3)/60*Math.PI*2-Math.PI/2;l(u,i*.5,4,`#111827`,`rgb(0 0 0 / 40%)`),l(d,i*.72,3,`#1e80ff`,`rgb(30 128 255 / 40%)`),l(f,i*.85,2,`#e9686b`,`rgb(233 104 107 / 40%)`),e.beginPath(),e.arc(0,0,5,0,Math.PI*2),e.fillStyle=`#111827`,e.fill(),e.restore()},[a,i,r]);return(0,c.useEffect)(()=>{let e=n.current;if(!e)return;let t=window.devicePixelRatio||1;e.width=r*t,e.height=r*t;let i=e.getContext(`2d`);if(!i)return;i.setTransform(t,0,0,t,0,0);let a=0,s=()=>{o(i),a=requestAnimationFrame(s)};return s(),()=>cancelAnimationFrame(a)},[o,r]),(0,l.jsx)(`div`,{className:u.canvasClock,style:{width:r,height:r},children:(0,l.jsx)(`canvas`,{ref:n,className:u.canvasTarget,style:{width:r,height:r}})})},f={chargeContainer:`cos-chargeContainer-4t9qo`,contrast:`cos-contrast-PNep9`,hueRotate:`cos-hueRotate-bMJ-k`,text:`cos-text-2k7eH`,moveUp:`cos-moveUp-1Vz9j`,circle:`cos-circle-m4vwX`,circleRotate:`cos-circleRotate-bgFw5`,button:`cos-button-myCst`},p=e=>{let{initQuantity:t=0,value:n,onChange:r,autoCharge:i=!0,interval:a=500,step:o=.01}=e,s=n!==void 0,[u,d]=(0,c.useState)(t),p=s?n:u,m=(0,c.useRef)(p);(0,c.useEffect)(()=>{m.current=p},[p]),(0,c.useEffect)(()=>{if(!i)return;let e=window.setInterval(()=>{let e=Number((m.current+o).toFixed(2));s?r?.(e):d(e)},a);return()=>clearInterval(e)},[i,a,s,r,o]);let h=p?p.toString().padEnd(4,`0`):`0`;return(0,l.jsx)(`div`,{className:f.chargeContainer,children:(0,l.jsxs)(`div`,{className:f.contrast,children:[(0,l.jsxs)(`div`,{className:f.text,children:[h,`%`]}),(0,l.jsx)(`span`,{}),(0,l.jsx)(`span`,{}),(0,l.jsx)(`span`,{}),(0,l.jsx)(`span`,{}),(0,l.jsx)(`span`,{}),(0,l.jsx)(`span`,{}),(0,l.jsx)(`span`,{}),(0,l.jsx)(`span`,{}),(0,l.jsx)(`span`,{}),(0,l.jsx)(`span`,{}),(0,l.jsx)(`span`,{}),(0,l.jsx)(`span`,{}),(0,l.jsx)(`span`,{}),(0,l.jsx)(`span`,{}),(0,l.jsx)(`div`,{className:f.circle}),(0,l.jsx)(`div`,{className:f.button})]})})},m={confetti:`cos-confetti-MeNtU`,canvas:`cos-canvas-0T3Vs`,hint:`cos-hint-sGHEi`},h=[`#ff6b6b`,`#ffd93d`,`#6bcb77`,`#4d96ff`,`#a66cff`,`#ff85c0`,`#38bdf8`],g=()=>h[Math.floor(Math.random()*h.length)],_=(e,t,n)=>{let r=e/2,i=t*.6;return Array.from({length:n},()=>{let e=(Math.random()-.5)*Math.PI,t=Math.random()*12+6;return{x:r+(Math.random()-.5)*40,y:i,vx:Math.cos(e)*t,vy:Math.sin(e)*t-Math.random()*8,rotation:Math.random()*360,rotationSpeed:(Math.random()-.5)*12,color:g(),width:Math.random()*8+4,height:Math.random()*6+3,alpha:1,gravity:Math.random()*.15+.12}})},v=(0,c.forwardRef)(({width:e=800,height:t=400,auto:n=!0,particleCount:r=120},i)=>{let a=(0,c.useRef)(null),o=(0,c.useRef)([]),s=(0,c.useRef)(0),u=(0,c.useCallback)(()=>{o.current.push(..._(e,t,r))},[t,r,e]);return(0,c.useImperativeHandle)(i,()=>({burst:u}),[u]),(0,c.useEffect)(()=>{let r=a.current;if(!r)return;let i=window.devicePixelRatio||1;r.width=e*i,r.height=t*i;let c=r.getContext(`2d`);if(!c)return;c.setTransform(i,0,0,i,0,0),n&&u();let l=()=>{s.current=requestAnimationFrame(l),c.clearRect(0,0,e,t),o.current=o.current.filter(e=>(e.x+=e.vx,e.y+=e.vy,e.vy+=e.gravity,e.vx*=.99,e.rotation+=e.rotationSpeed,e.alpha-=.008,e.alpha<=0||e.y>t+20?!1:(c.save(),c.translate(e.x,e.y),c.rotate(e.rotation*Math.PI/180),c.globalAlpha=e.alpha,c.fillStyle=e.color,c.fillRect(-e.width/2,-e.height/2,e.width,e.height),c.restore(),!0)))};return l(),()=>cancelAnimationFrame(s.current)},[n,u,t,e]),(0,l.jsxs)(`div`,{className:m.confetti,style:{width:e,height:t},children:[(0,l.jsx)(`canvas`,{ref:a,className:m.canvas,style:{width:e,height:t},onClick:u}),(0,l.jsx)(`p`,{className:m.hint,children:`点击画布再次喷射`})]})});v.displayName=`Confetti`;var y={countdown:`cos-countdown-5ZKKP`,unit:`cos-unit-dth8N`,value:`cos-value-yVzcP`,label:`cos-label-pAMEs`,ended:`cos-ended-c0dsD`,pulse:`cos-pulse-krQd-`},b=e=>e instanceof Date?e.getTime():typeof e==`number`?e:new Date(e).getTime(),x=e=>{let t=Math.max(0,e-Date.now()),n=Math.floor(t/1e3);return{total:t,days:Math.floor(n/86400),hours:Math.floor(n%86400/3600),minutes:Math.floor(n%3600/60),seconds:n%60}},S=[{key:`days`,label:`天`},{key:`hours`,label:`时`},{key:`minutes`,label:`分`},{key:`seconds`,label:`秒`}],C=({targetDate:e,onEnd:t,showLabels:n=!0,color:r=`#f472b6`})=>{let i=(0,c.useMemo)(()=>b(e),[e]),[,a]=(0,c.useState)(0),o=(0,c.useRef)(!1),s=x(i);return(0,c.useEffect)(()=>{o.current=!1;let e=window.setInterval(()=>a(e=>e+1),1e3);return()=>clearInterval(e)},[i]),(0,c.useEffect)(()=>{s.total<=0&&!o.current&&(o.current=!0,t?.())},[s.total,t]),(0,l.jsxs)(`div`,{className:y.countdown,style:{"--countdown-color":r},children:[S.map(({key:e,label:t})=>(0,l.jsxs)(`div`,{className:y.unit,children:[(0,l.jsx)(`div`,{className:y.value,children:String(s[e]).padStart(2,`0`)}),n&&(0,l.jsx)(`span`,{className:y.label,children:t})]},e)),s.total<=0&&(0,l.jsx)(`p`,{className:y.ended,children:`时间到!`})]})},w={fireworks:`cos-fireworks-fsSqL`,canvas:`cos-canvas-spL8G`,hint:`cos-hint-5XDRH`},T=[`#ff6b6b`,`#ffd93d`,`#6bcb77`,`#4d96ff`,`#a66cff`,`#ff85c0`],E=.12,ee=240,D=()=>T[Math.floor(Math.random()*T.length)],O=(e,t,n)=>{let r=60+Math.floor(Math.random()*30);return Array.from({length:r},()=>{let r=Math.random()*Math.PI*2,i=Math.random()*4+2;return{x:e,y:t,vx:Math.cos(r)*i,vy:Math.sin(r)*i,alpha:1,color:Math.random()>.3?n:D(),decay:Math.random()*.015+.01}})},k=(0,c.forwardRef)(({width:e=800,height:t=500,auto:n=!0},r)=>{let i=(0,c.useRef)(null),a=(0,c.useRef)([]),o=(0,c.useRef)(0),s=(0,c.useCallback)(n=>{let r=n??Math.random()*e*.6+e*.2;a.current.push({x:r,y:t,vy:-(Math.random()*4+6),targetY:Math.random()*t*.35+t*.15,color:D(),exploded:!1,particles:[],age:0})},[t,e]);return(0,c.useImperativeHandle)(r,()=>({launch:s}),[s]),(0,c.useEffect)(()=>{let r=i.current;if(!r)return;let c=window.devicePixelRatio||1;r.width=e*c,r.height=t*c;let l=r.getContext(`2d`);if(!l)return;l.setTransform(c,0,0,c,0,0);let u=0,d=()=>{o.current=requestAnimationFrame(d),l.fillStyle=`rgb(15 23 42 / 25%)`,l.fillRect(0,0,e,t),n&&Math.random()<.03&&s(),a.current=a.current.filter(e=>{if(!e.exploded){e.age+=1,e.y+=e.vy,e.vy+=E,l.beginPath(),l.arc(e.x,e.y,2.5,0,Math.PI*2),l.fillStyle=e.color,l.fill();let t=e.vy>=0,n=e.y<=e.targetY,r=e.y<0,i=e.age>=ee;return(t||n||r||i)&&(e.exploded=!0,e.particles=O(e.x,e.y,e.color)),!0}return e.particles=e.particles.filter(e=>(e.x+=e.vx,e.y+=e.vy,e.vy+=.06,e.alpha-=e.decay,e.alpha<=0?!1:(l.beginPath(),l.arc(e.x,e.y,2,0,Math.PI*2),l.fillStyle=e.color,l.globalAlpha=e.alpha,l.fill(),l.globalAlpha=1,!0))),e.particles.length>0})};return d(),n&&(u=window.setInterval(()=>s(),1200)),()=>{cancelAnimationFrame(o.current),clearInterval(u)}},[n,t,s,e]),(0,l.jsxs)(`div`,{className:w.fireworks,style:{width:e,height:t},children:[(0,l.jsx)(`canvas`,{ref:i,className:w.canvas,style:{width:e,height:t},onClick:e=>{let t=e.currentTarget.getBoundingClientRect();s(e.clientX-t.left)}}),(0,l.jsx)(`p`,{className:w.hint,children:`点击画布燃放烟花`})]})});k.displayName=`Fireworks`;var A={flipCounter:`cos-flipCounter-3LuI0`,digit:`cos-digit-yJRPy`,digitCard:`cos-digitCard-zZUzt`,staticTop:`cos-staticTop-aLQcm`,staticBottom:`cos-staticBottom-9y0gu`,flap:`cos-flap-i3YKR`,flapTop:`cos-flapTop-70z-k`,flapBottom:`cos-flapBottom-zhMZe`,isFlipping:`cos-isFlipping-EVEdI`,"fold-top":`cos-fold-top-v-6XJ`,"unfold-bottom":`cos-unfold-bottom-e2gzU`},j=(e,t)=>Math.max(0,Math.floor(e)).toString().padStart(t,`0`).slice(-t),M=({digit:e,color:t,duration:n})=>{let r=(0,c.useRef)(e),[i,a]=(0,c.useState)(!1),[o,s]=(0,c.useState)(e);(0,c.useEffect)(()=>{if(e===r.current)return;s(r.current),a(!0),r.current=e;let t=window.setTimeout(()=>a(!1),n);return()=>clearTimeout(t)},[e,n]);let u=i?o:e;return(0,l.jsx)(`div`,{className:A.digit,style:{"--flip-color":t,"--flip-duration":`${n}ms`},children:(0,l.jsxs)(`div`,{className:`${A.digitCard} ${i?A.isFlipping:``}`,children:[(0,l.jsx)(`div`,{className:A.staticTop,children:(0,l.jsx)(`span`,{children:u})}),(0,l.jsx)(`div`,{className:A.staticBottom,children:(0,l.jsx)(`span`,{children:u})}),i&&(0,l.jsxs)(l.Fragment,{children:[(0,l.jsx)(`div`,{className:`${A.flap} ${A.flapTop}`,children:(0,l.jsx)(`span`,{children:o})}),(0,l.jsx)(`div`,{className:`${A.flap} ${A.flapBottom}`,children:(0,l.jsx)(`span`,{children:e})})]})]})})},N=({value:e,digits:t=4,color:n=`#38bdf8`,duration:r=600})=>{let i=j(e,t).split(``);return(0,l.jsx)(`div`,{className:A.flipCounter,children:i.map((e,t)=>(0,l.jsx)(M,{digit:e,color:n,duration:r},t))})},P={glitchText:`cos-glitchText-dZ-sR`,text:`cos-text-JsPHN`,"glitch-1":`cos-glitch-1-s9pqH`,"glitch-2":`cos-glitch-2-GhFB-`},F=({text:e=`GLITCH`,color:t=`#f8fafc`,glitchColor1:n=`#ff00de`,glitchColor2:r=`#00f0ff`,fontSize:i=64})=>(0,l.jsx)(`div`,{className:P.glitchText,children:(0,l.jsx)(`h1`,{className:P.text,"data-text":e,style:{fontSize:i,"--glitch-color":t,"--glitch-c1":n,"--glitch-c2":r},children:e})}),I={matrixRain:`cos-matrixRain-qg9HC`,canvas:`cos-canvas--AvpG`,overlay:`cos-overlay-knj3b`,title:`cos-title-sDfhs`,flicker:`cos-flicker-smHxl`,subtitle:`cos-subtitle-CWheW`},L=`ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789@#$%^&*アイウエオカキクケコ`,R=({width:e=800,height:t=500,density:n=.6,color:r=`#00ff41`})=>{let i=(0,c.useRef)(null);return(0,c.useEffect)(()=>{let a=i.current;if(!a)return;let o=window.devicePixelRatio||1;a.width=e*o,a.height=t*o;let s=a.getContext(`2d`);if(!s)return;s.setTransform(o,0,0,o,0,0);let c=Math.floor(e/16*n),l=Array.from({length:c},()=>Math.random()*-50),u=0,d=()=>{s.fillStyle=`rgb(0 0 0 / 8%)`,s.fillRect(0,0,e,t),s.fillStyle=r,s.font=`16px monospace`,l.forEach((e,i)=>{let a=L[Math.floor(Math.random()*53)],o=i/n*16;s.fillStyle=r,s.fillText(a,o,e*16),e*16>t&&Math.random()>.975&&(l[i]=0),l[i]+=1}),u=requestAnimationFrame(d)};return d(),()=>cancelAnimationFrame(u)},[r,n,t,e]),(0,l.jsxs)(`div`,{className:I.matrixRain,style:{width:e,height:t},children:[(0,l.jsx)(`canvas`,{ref:i,className:I.canvas,style:{width:e,height:t}}),(0,l.jsxs)(`div`,{className:I.overlay,children:[(0,l.jsx)(`h2`,{className:I.title,children:`MATRIX`}),(0,l.jsx)(`p`,{className:I.subtitle,children:`数字雨效果`})]})]})},z={meteorRain:`cos-meteorRain-v8RNI`,canvas:`cos-canvas-hyFMr`},B=({width:e=800,height:t=500,meteorCount:n=8})=>{let r=(0,c.useRef)(null),i=(0,c.useRef)([]),a=(0,c.useRef)(0);return(0,c.useEffect)(()=>{i.current=Array.from({length:n},()=>({x:Math.random()*e,y:Math.random()*t*.5,length:Math.random()*60+40,speed:Math.random()*6+4,opacity:Math.random()*.5+.3}))},[t,n,e]),(0,c.useEffect)(()=>{let n=r.current;if(!n)return;let o=window.devicePixelRatio||1;n.width=e*o,n.height=t*o;let s=n.getContext(`2d`);if(!s)return;s.setTransform(o,0,0,o,0,0);let c=()=>{a.current=requestAnimationFrame(c),s.fillStyle=`rgb(15 23 42 / 15%)`,s.fillRect(0,0,e,t),i.current.forEach(n=>{n.x+=n.speed,n.y+=n.speed*.6,(n.x>e+n.length||n.y>t+n.length)&&(n.x=-n.length,n.y=Math.random()*t*.4,n.length=Math.random()*60+40,n.speed=Math.random()*6+4,n.opacity=Math.random()*.5+.3);let r=s.createLinearGradient(n.x,n.y,n.x-n.length,n.y-n.length*.6);r.addColorStop(0,`rgb(255 255 255 / ${n.opacity})`),r.addColorStop(1,`rgb(255 255 255 / 0)`),s.beginPath(),s.strokeStyle=r,s.lineWidth=2,s.moveTo(n.x,n.y),s.lineTo(n.x-n.length,n.y-n.length*.6),s.stroke()})};return c(),()=>cancelAnimationFrame(a.current)},[t,e]),(0,l.jsx)(`div`,{className:z.meteorRain,style:{width:e,height:t},children:(0,l.jsx)(`canvas`,{ref:r,className:z.canvas,style:{width:e,height:t}})})},V={neonText:`cos-neonText-JMP7i`,text:`cos-text-GTO-0`,flicker:`cos-flicker-nXceV`,"neon-flicker":`cos-neon-flicker-uDkmM`,reflection:`cos-reflection-aEYj6`},H=({text:e=`NEON`,color:t=`#ff00de`,fontSize:n=72,flicker:r=!0})=>(0,l.jsxs)(`div`,{className:V.neonText,children:[(0,l.jsx)(`h1`,{className:`${V.text} ${r?V.flicker:``}`,style:{fontSize:n,"--neon-color":t},children:e}),(0,l.jsx)(`p`,{className:V.reflection,style:{fontSize:n*.35,color:t},children:e})]}),U={particleNetwork:`cos-particleNetwork-GSZq-`,canvas:`cos-canvas-E-BGP`,hint:`cos-hint-LEO5o`},W=({width:e=800,height:t=500,particleCount:n=60,linkDistance:r=120,color:i=`#38bdf8`})=>{let a=(0,c.useRef)(null),o=(0,c.useRef)([]),s=(0,c.useRef)({x:-1e3,y:-1e3}),u=(0,c.useCallback)(()=>{o.current=Array.from({length:n},()=>({x:Math.random()*e,y:Math.random()*t,vx:(Math.random()-.5)*1.2,vy:(Math.random()-.5)*1.2,radius:Math.random()*2+1}))},[t,n,e]);return(0,c.useEffect)(()=>{u()},[u]),(0,c.useEffect)(()=>{let n=a.current;if(!n)return;let c=window.devicePixelRatio||1;n.width=e*c,n.height=t*c;let l=n.getContext(`2d`);if(!l)return;l.setTransform(c,0,0,c,0,0);let u=0,d=()=>{l.fillStyle=`#0f172a`,l.fillRect(0,0,e,t);let n=o.current,a=s.current;n.forEach(n=>{n.x+=n.vx,n.y+=n.vy,(n.x<0||n.x>e)&&(n.vx*=-1),(n.y<0||n.y>t)&&(n.vy*=-1);let r=a.x-n.x,i=a.y-n.y;Math.sqrt(r*r+i*i)<150&&(n.vx-=r*3e-4,n.vy-=i*3e-4)});for(let e=0;e<n.length;e++)for(let t=e+1;t<n.length;t++){let a=n[e].x-n[t].x,o=n[e].y-n[t].y,s=Math.sqrt(a*a+o*o);s<r&&(l.beginPath(),l.moveTo(n[e].x,n[e].y),l.lineTo(n[t].x,n[t].y),l.strokeStyle=i,l.globalAlpha=1-s/r,l.lineWidth=.8,l.stroke(),l.globalAlpha=1)}n.forEach(e=>{l.beginPath(),l.arc(e.x,e.y,e.radius,0,Math.PI*2),l.fillStyle=i,l.fill()}),u=requestAnimationFrame(d)};return d(),()=>cancelAnimationFrame(u)},[i,t,u,r,e]),(0,l.jsxs)(`div`,{className:U.particleNetwork,style:{width:e,height:t},children:[(0,l.jsx)(`canvas`,{ref:a,className:U.canvas,style:{width:e,height:t},onMouseMove:e=>{let t=e.currentTarget.getBoundingClientRect();s.current={x:e.clientX-t.left,y:e.clientY-t.top}},onMouseLeave:()=>{s.current={x:-1e3,y:-1e3}}}),(0,l.jsx)(`p`,{className:U.hint,children:`移动鼠标与粒子互动`})]})},G={returnCityContainer:`cos-returnCityContainer-6XTxj`,star:`cos-star-a59Dx`,glassWrap:`cos-glassWrap-golMO`,rotate:`cos-rotate-7X9Jj`,glassItem:`cos-glassItem-OwlFI`},K=({starCount:e,glassCount:t=6,glassRadius:n=150})=>{let r=(0,c.useRef)(null),i=(0,c.useRef)(null);return(0,c.useEffect)(()=>{let a=r.current,o=i.current;if(!a||!o)return;let s=[],c=[],l=[],u=e??Math.floor(document.documentElement.clientWidth/20);for(let e=0;e<u;e++){let e=window.setTimeout(()=>{let e=document.createElement(`div`);e.className=G.star;let t=document.body.clientWidth,n=document.body.clientHeight;e.style.top=`${Math.random()*n}px`,e.style.left=`${Math.random()*t}px`,a.append(e),c.push(e)},Math.random()*2e3);s.push(e)}for(let e=0;e<t;e++){let r=document.createElement(`div`);r.className=G.glassItem,r.style.transform=`rotateY(${360/t*e}deg) translateZ(${n}px)`,o.appendChild(r),l.push(r);let i=window.setTimeout(()=>{r.style.top=`0px`,r.style.opacity=`1`},e*300);s.push(i)}return()=>{s.forEach(clearTimeout),c.forEach(e=>e.remove()),l.forEach(e=>e.remove())}},[e,t,n]),(0,l.jsx)(`div`,{ref:r,className:G.returnCityContainer,children:(0,l.jsx)(`div`,{ref:i,className:G.glassWrap})})},q={turntable:`cos-turntable-dkc32`,wheelWrap:`cos-wheelWrap-n7lhc`,canvas:`cos-canvas-A1-4x`,pointer:`cos-pointer-Rk1S9`,spinBtn:`cos-spinBtn-l9JIC`,result:`cos-result-H8q2c`,"fade-in":`cos-fade-in-U9bUC`},J=[`#FF6B6B`,`#4ECDC4`,`#FFE66D`,`#A78BFA`,`#60A5FA`,`#F472B6`,`#34D399`,`#FB923C`],Y=[{label:`一等奖`},{label:`二等奖`},{label:`三等奖`},{label:`谢谢参与`},{label:`优惠券`},{label:`再来一次`}],X=e=>1-(1-e)**3,Z=({prizes:e=Y,size:t=360,spinDuration:n=4e3,spinRounds:r=5,buttonText:i=`开始抽奖`,onSpinEnd:a})=>{let o=(0,c.useRef)(null),s=(0,c.useRef)(0),u=(0,c.useRef)(0),d=(0,c.useRef)(1),[f,p]=(0,c.useState)(!1),[m,h]=(0,c.useState)(null),g=t+48,_=(e,t)=>t.color??J[e%J.length],v=(0,c.useCallback)(n=>{let r=o.current;if(!r)return;let i=r.getContext(`2d`);if(!i)return;let a=g/2,s=t/2,c=Math.PI*2/e.length;i.clearRect(0,0,g,g),i.save(),i.translate(a,a),i.rotate(n),e.forEach((e,n)=>{let r=n*c-Math.PI/2,a=r+c,o=_(n,e);i.beginPath(),i.moveTo(0,0),i.arc(0,0,s,r,a),i.closePath(),i.fillStyle=o,i.fill(),i.strokeStyle=`rgb(255 255 255 / 35%)`,i.lineWidth=2,i.stroke(),i.save(),i.rotate(r+c/2),i.textAlign=`right`,i.fillStyle=`#fff`,i.font=`bold ${Math.max(12,Math.floor(t/22))}px system-ui, sans-serif`,i.shadowColor=`rgb(0 0 0 / 30%)`,i.shadowBlur=4,i.fillText(e.label,s-18,6),i.restore()}),i.beginPath(),i.arc(0,0,s,0,Math.PI*2),i.strokeStyle=`#fbbf24`,i.lineWidth=6,i.stroke(),i.beginPath(),i.arc(0,0,s-4,0,Math.PI*2),i.strokeStyle=`#f59e0b`,i.lineWidth=2,i.stroke(),i.restore(),i.save(),i.translate(a,a);for(let e=0;e<12;e++){let t=e/12*Math.PI*2,n=Math.cos(t)*(s+14),r=Math.sin(t)*(s+14);i.beginPath(),i.arc(n,r,3,0,Math.PI*2),i.fillStyle=e%2==0?`#fde68a`:`#f59e0b`,i.fill()}i.restore()},[g,e,t]);(0,c.useEffect)(()=>{let e=o.current;if(!e)return;let t=window.devicePixelRatio||1;d.current=t,e.width=g*t,e.height=g*t;let n=e.getContext(`2d`);n&&n.setTransform(t,0,0,t,0,0),v(s.current)},[g,v]),(0,c.useEffect)(()=>()=>{u.current&&cancelAnimationFrame(u.current)},[]);let y=t=>{let n=360/e.length,r=(180/Math.PI*t%360+360)%360;return Math.floor((360-r+n/2)%360/n)%e.length};return(0,l.jsxs)(`div`,{className:q.turntable,style:{width:g,height:g+80},children:[(0,l.jsxs)(`div`,{className:q.wheelWrap,style:{width:g,height:g},children:[(0,l.jsx)(`div`,{className:q.pointer}),(0,l.jsx)(`canvas`,{ref:o,className:q.canvas,style:{width:g,height:g}}),(0,l.jsx)(`button`,{type:`button`,className:q.spinBtn,onClick:()=>{if(f||e.length===0)return;p(!0),h(null);let t=Math.PI*2/e.length,i=Math.floor(Math.random()*e.length)*t+t/2,o=s.current,c=o+r*Math.PI*2+(Math.PI*2-i)-o%(Math.PI*2),l=o,d=performance.now(),m=t=>{let r=t-d,i=Math.min(r/n,1),o=X(i),f=l+(c-l)*o;if(s.current=f,v(f),i<1)u.current=requestAnimationFrame(m);else{let t=y(f),n=e[t];s.current=f,p(!1),h(n),a?.(n,t)}};u.current=requestAnimationFrame(m)},disabled:f,children:f?`抽奖中...`:i})]}),m&&!f&&(0,l.jsxs)(`p`,{className:q.result,children:[`恭喜获得:`,(0,l.jsx)(`strong`,{children:m.label})]})]})},Q={typewriter:`cos-typewriter-7UhOL`,terminal:`cos-terminal-NWNVN`,dots:`cos-dots-oulNg`,text:`cos-text-ICV5T`,prompt:`cos-prompt-Y4hVD`,cursor:`cos-cursor-m8hGi`,blink:`cos-blink-XykM7`},te=[`Hello, cos-design!`,`欢迎来到组件库 ✨`,`Build something fun 🚀`],ne=({texts:e=te,speed:t=100,deleteSpeed:n=50,pause:r=2e3})=>{let[i,a]=(0,c.useState)(``),[o,s]=(0,c.useState)(0),[u,d]=(0,c.useState)(!1);return(0,c.useEffect)(()=>{let c=e[o%e.length],l;if(!u&&i===c)l=setTimeout(()=>d(!0),r);else if(u&&i===``)l=setTimeout(()=>{d(!1),s(t=>(t+1)%e.length)},0);else{let e=u?c.slice(0,i.length-1):c.slice(0,i.length+1);l=setTimeout(()=>a(e),u?n:t)}return()=>clearTimeout(l)},[i,u,o,e,t,n,r]),(0,l.jsx)(`div`,{className:Q.typewriter,children:(0,l.jsxs)(`div`,{className:Q.terminal,children:[(0,l.jsxs)(`div`,{className:Q.dots,children:[(0,l.jsx)(`span`,{}),(0,l.jsx)(`span`,{}),(0,l.jsx)(`span`,{})]}),(0,l.jsxs)(`p`,{className:Q.text,children:[(0,l.jsx)(`span`,{className:Q.prompt,children:`>`}),i,(0,l.jsx)(`span`,{className:Q.cursor,children:`|`})]})]})})},$={waveButton:`cos-waveButton-Aa7G-`,btn:`cos-btn-WJrEN`,label:`cos-label-9BHOU`,wave:`cos-wave-GycLU`,ripple:`cos-ripple-5ZFpr`},re=({text:e=`点我试试`,onClick:t,color:n=`#38bdf8`})=>(0,l.jsx)(`div`,{className:$.waveButton,children:(0,l.jsxs)(`button`,{type:`button`,className:$.btn,style:{"--wave-color":n},onClick:t,children:[(0,l.jsx)(`span`,{className:$.wave}),(0,l.jsx)(`span`,{className:$.wave}),(0,l.jsx)(`span`,{className:$.label,children:e})]})});exports.CanvasClock=d,exports.Charge=p,exports.Confetti=v,exports.Countdown=C,exports.Fireworks=k,exports.FlipCounter=N,exports.GlitchText=F,exports.MatrixRain=R,exports.MeteorRain=B,exports.NeonText=H,exports.ParticleNetwork=W,exports.ReturnCity=K,exports.Turntable=Z,exports.Typewriter=ne,exports.WaveButton=re;
|
|
1
|
+
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});require('./index.css');var e=Object.create,t=Object.defineProperty,n=Object.getOwnPropertyDescriptor,r=Object.getOwnPropertyNames,i=Object.getPrototypeOf,a=Object.prototype.hasOwnProperty,o=(e,i,o,s)=>{if(i&&typeof i==`object`||typeof i==`function`)for(var c=r(i),l=0,u=c.length,d;l<u;l++)d=c[l],!a.call(e,d)&&d!==o&&t(e,d,{get:(e=>i[e]).bind(null,d),enumerable:!(s=n(i,d))||s.enumerable});return e},s=(n,r,a)=>(a=n==null?{}:e(i(n)),o(r||!n||!n.__esModule?t(a,`default`,{value:n,enumerable:!0}):a,n));let c=require("react");c=s(c,1);let l=require("react/jsx-runtime");var u={canvasClock:`cos-canvasClock-QvdV3`,canvasTarget:`cos-canvasTarget-x-odC`},d=({width:e=400,height:t=400})=>{let n=(0,c.useRef)(null),r=Math.min(e,t),i=r/2-16,a=r/2,o=(0,c.useCallback)(e=>{e.clearRect(0,0,r,r),e.save(),e.translate(a,a),e.beginPath(),e.arc(0,0,i,0,Math.PI*2),e.fillStyle=`#fff`,e.fill(),e.strokeStyle=`#d1d5db`,e.lineWidth=2,e.stroke();for(let t=0;t<60;t++){let n=t/60*Math.PI*2,r=i-(t%5==0?14:8);e.beginPath(),e.moveTo(Math.cos(n)*r,Math.sin(n)*r),e.lineTo(Math.cos(n)*i,Math.sin(n)*i),e.strokeStyle=t%5==0?`#374151`:`#9ca3af`,e.lineWidth=t%5==0?2:1,e.stroke()}e.fillStyle=`#111827`,e.font=`bold ${Math.floor(r/22)}px system-ui, sans-serif`,e.textAlign=`center`,e.textBaseline=`middle`;for(let t=1;t<=12;t++){let n=t/12*Math.PI*2-Math.PI/2,r=i-32;e.fillText(String(t),Math.cos(n)*r,Math.sin(n)*r)}let t=new Date,n=t.getHours()%12,o=t.getMinutes(),s=t.getSeconds(),c=t.getMilliseconds(),l=(t,n,r,i,a)=>{e.save(),e.rotate(t),e.beginPath(),e.moveTo(0,r),e.lineTo(n,0),e.lineTo(0,-r),e.closePath(),e.fillStyle=i,e.shadowColor=a,e.shadowBlur=4,e.fill(),e.restore()},u=(n+o/60)/12*Math.PI*2-Math.PI/2,d=(o+s/60)/60*Math.PI*2-Math.PI/2,f=(s+c/1e3)/60*Math.PI*2-Math.PI/2;l(u,i*.5,4,`#111827`,`rgb(0 0 0 / 40%)`),l(d,i*.72,3,`#1e80ff`,`rgb(30 128 255 / 40%)`),l(f,i*.85,2,`#e9686b`,`rgb(233 104 107 / 40%)`),e.beginPath(),e.arc(0,0,5,0,Math.PI*2),e.fillStyle=`#111827`,e.fill(),e.restore()},[a,i,r]);return(0,c.useEffect)(()=>{let e=n.current;if(!e)return;let t=window.devicePixelRatio||1;e.width=r*t,e.height=r*t;let i=e.getContext(`2d`);if(!i)return;i.setTransform(t,0,0,t,0,0);let a=0,s=()=>{o(i),a=requestAnimationFrame(s)};return s(),()=>cancelAnimationFrame(a)},[o,r]),(0,l.jsx)(`div`,{className:u.canvasClock,style:{width:r,height:r},children:(0,l.jsx)(`canvas`,{ref:n,className:u.canvasTarget,style:{width:r,height:r}})})},f=e=>{let t=()=>e(document.hidden);return document.addEventListener(`visibilitychange`,t),()=>document.removeEventListener(`visibilitychange`,t)},p=(e,t,n)=>Math.min(n,Math.max(t,e)),m={chargeContainer:`cos-chargeContainer-4t9qo`,contrast:`cos-contrast-PNep9`,hueRotate:`cos-hueRotate-bMJ-k`,text:`cos-text-2k7eH`,moveUp:`cos-moveUp-1Vz9j`,circle:`cos-circle-m4vwX`,circleRotate:`cos-circleRotate-bgFw5`,button:`cos-button-myCst`},h=e=>{let{initQuantity:t=0,value:n,onChange:r,autoCharge:i=!0,interval:a=500,step:o=.01}=e,s=(0,c.useRef)(null),u=n!==void 0,[d,f]=(0,c.useState)(()=>p(t,0,100)),h=p(u?n:d,0,100),g=(0,c.useRef)(h),_=(0,c.useRef)(r);(0,c.useEffect)(()=>{_.current=r},[r]),(0,c.useEffect)(()=>{g.current=h},[h]),(0,c.useEffect)(()=>{let e=s.current;if(!e)return;let t=()=>{e.style.setProperty(`--charge-h`,`${e.clientHeight}px`)};t();let n=new ResizeObserver(t);return n.observe(e),()=>n.disconnect()},[]),(0,c.useEffect)(()=>{if(!i)return;let e=window.setInterval(()=>{if(g.current>=100)return;let e=Math.min(100,Number((g.current+o).toFixed(2)));u?_.current?.(e):f(e)},a);return()=>clearInterval(e)},[i,a,u,o]);let v=h.toFixed(2);return(0,l.jsx)(`div`,{ref:s,className:m.chargeContainer,children:(0,l.jsxs)(`div`,{className:m.contrast,children:[(0,l.jsxs)(`div`,{className:m.text,children:[v,`%`]}),(0,l.jsx)(`span`,{}),(0,l.jsx)(`span`,{}),(0,l.jsx)(`span`,{}),(0,l.jsx)(`span`,{}),(0,l.jsx)(`span`,{}),(0,l.jsx)(`span`,{}),(0,l.jsx)(`span`,{}),(0,l.jsx)(`span`,{}),(0,l.jsx)(`span`,{}),(0,l.jsx)(`span`,{}),(0,l.jsx)(`span`,{}),(0,l.jsx)(`span`,{}),(0,l.jsx)(`span`,{}),(0,l.jsx)(`span`,{}),(0,l.jsx)(`span`,{}),(0,l.jsx)(`div`,{className:m.circle}),(0,l.jsx)(`div`,{className:m.button})]})})},g={confetti:`cos-confetti-MeNtU`,canvas:`cos-canvas-0T3Vs`,hint:`cos-hint-sGHEi`},_=[`#ff6b6b`,`#ffd93d`,`#6bcb77`,`#4d96ff`,`#a66cff`,`#ff85c0`,`#38bdf8`],v=()=>_[Math.floor(Math.random()*_.length)],y=(e,t,n)=>{let r=e/2,i=t*.6;return Array.from({length:n},()=>{let e=(Math.random()-.5)*Math.PI,t=Math.random()*12+6;return{x:r+(Math.random()-.5)*40,y:i,vx:Math.cos(e)*t,vy:Math.sin(e)*t-Math.random()*8,rotation:Math.random()*360,rotationSpeed:(Math.random()-.5)*12,color:v(),width:Math.random()*8+4,height:Math.random()*6+3,alpha:1,gravity:Math.random()*.15+.12}})},b=(0,c.forwardRef)(({width:e=800,height:t=400,auto:n=!0,particleCount:r=120},i)=>{let a=(0,c.useRef)(null),o=(0,c.useRef)([]),s=(0,c.useRef)(0),u=(0,c.useRef)({width:e,height:t,particleCount:r});u.current={width:e,height:t,particleCount:r};let d=(0,c.useCallback)(()=>{let{width:e,height:t,particleCount:n}=u.current;o.current.push(...y(e,t,n))},[]);return(0,c.useImperativeHandle)(i,()=>({burst:d}),[d]),(0,c.useEffect)(()=>{n&&d()},[n,d]),(0,c.useEffect)(()=>{let n=a.current;if(!n)return;let r=window.devicePixelRatio||1;n.width=e*r,n.height=t*r;let i=n.getContext(`2d`);if(!i)return;i.setTransform(r,0,0,r,0,0);let c=document.hidden,l=f(e=>{c=e}),u=()=>{s.current=requestAnimationFrame(u),!c&&(i.clearRect(0,0,e,t),o.current=o.current.filter(e=>(e.x+=e.vx,e.y+=e.vy,e.vy+=e.gravity,e.vx*=.99,e.rotation+=e.rotationSpeed,e.alpha-=.008,e.alpha<=0||e.y>t+20?!1:(i.save(),i.translate(e.x,e.y),i.rotate(e.rotation*Math.PI/180),i.globalAlpha=e.alpha,i.fillStyle=e.color,i.fillRect(-e.width/2,-e.height/2,e.width,e.height),i.restore(),!0))))};return u(),()=>{cancelAnimationFrame(s.current),l()}},[t,e]),(0,l.jsxs)(`div`,{className:g.confetti,style:{width:e,height:t},children:[(0,l.jsx)(`canvas`,{ref:a,className:g.canvas,style:{width:e,height:t},onClick:d}),(0,l.jsx)(`p`,{className:g.hint,children:`点击画布再次喷射`})]})});b.displayName=`Confetti`;var x={countdown:`cos-countdown-5ZKKP`,unit:`cos-unit-dth8N`,value:`cos-value-yVzcP`,label:`cos-label-pAMEs`,ended:`cos-ended-c0dsD`,pulse:`cos-pulse-krQd-`,invalid:`cos-invalid-d6t-L`},S=e=>e instanceof Date?e.getTime():typeof e==`number`?e:new Date(e).getTime(),ee=e=>{let t=Math.max(0,e-Date.now()),n=Math.floor(t/1e3);return{total:t,days:Math.floor(n/86400),hours:Math.floor(n%86400/3600),minutes:Math.floor(n%3600/60),seconds:n%60}},C=[{key:`days`,label:`天`},{key:`hours`,label:`时`},{key:`minutes`,label:`分`},{key:`seconds`,label:`秒`}],w=({targetDate:e,onEnd:t,showLabels:n=!0,color:r=`#f472b6`})=>{let i=(0,c.useMemo)(()=>S(e),[e]),a=!Number.isNaN(i),[,o]=(0,c.useState)(0),s=(0,c.useRef)(!1),u=(0,c.useRef)(t),d=a?ee(i):{days:0,hours:0,minutes:0,seconds:0,total:0};return(0,c.useEffect)(()=>{u.current=t},[t]),(0,c.useEffect)(()=>{if(!a)return;s.current=!1;let e=window.setInterval(()=>{o(e=>e+1),Date.now()>=i&&!s.current&&(s.current=!0,u.current?.(),clearInterval(e))},1e3);return()=>clearInterval(e)},[a,i]),a?(0,l.jsxs)(`div`,{className:x.countdown,style:{"--countdown-color":r},children:[C.map(({key:e,label:t})=>(0,l.jsxs)(`div`,{className:x.unit,children:[(0,l.jsx)(`div`,{className:x.value,children:String(d[e]).padStart(2,`0`)}),n&&(0,l.jsx)(`span`,{className:x.label,children:t})]},e)),d.total<=0&&(0,l.jsx)(`p`,{className:x.ended,children:`时间到!`})]}):(0,l.jsx)(`div`,{className:x.countdown,children:(0,l.jsx)(`p`,{className:x.invalid,children:`无效的目标时间`})})},T={fireworks:`cos-fireworks-fsSqL`,canvas:`cos-canvas-spL8G`,hint:`cos-hint-5XDRH`},E=[`#ff6b6b`,`#ffd93d`,`#6bcb77`,`#4d96ff`,`#a66cff`,`#ff85c0`],D=.12,O=240,k=()=>E[Math.floor(Math.random()*E.length)],A=(e,t,n)=>{let r=60+Math.floor(Math.random()*30);return Array.from({length:r},()=>{let r=Math.random()*Math.PI*2,i=Math.random()*4+2;return{x:e,y:t,vx:Math.cos(r)*i,vy:Math.sin(r)*i,alpha:1,color:Math.random()>.3?n:k(),decay:Math.random()*.015+.01}})},j=(0,c.forwardRef)(({width:e=800,height:t=500,auto:n=!0},r)=>{let i=(0,c.useRef)(null),a=(0,c.useRef)([]),o=(0,c.useRef)(0),s=(0,c.useCallback)(n=>{let r=n??Math.random()*e*.6+e*.2;a.current.push({x:r,y:t,vy:-(Math.random()*4+6),targetY:Math.random()*t*.35+t*.15,color:k(),exploded:!1,particles:[],age:0})},[t,e]);return(0,c.useImperativeHandle)(r,()=>({launch:s}),[s]),(0,c.useEffect)(()=>{let r=i.current;if(!r)return;let c=window.devicePixelRatio||1;r.width=e*c,r.height=t*c;let l=r.getContext(`2d`);if(!l)return;l.setTransform(c,0,0,c,0,0);let u=0,d=document.hidden,p=f(e=>{d=e}),m=()=>{o.current=requestAnimationFrame(m),!d&&(l.fillStyle=`rgb(15 23 42 / 25%)`,l.fillRect(0,0,e,t),a.current=a.current.filter(e=>{if(!e.exploded){e.age+=1,e.y+=e.vy,e.vy+=D,l.beginPath(),l.arc(e.x,e.y,2.5,0,Math.PI*2),l.fillStyle=e.color,l.fill();let t=e.vy>=0,n=e.y<=e.targetY,r=e.y<0,i=e.age>=O;return(t||n||r||i)&&(e.exploded=!0,e.particles=A(e.x,e.y,e.color)),!0}return e.particles=e.particles.filter(e=>(e.x+=e.vx,e.y+=e.vy,e.vy+=.06,e.alpha-=e.decay,e.alpha<=0?!1:(l.beginPath(),l.arc(e.x,e.y,2,0,Math.PI*2),l.fillStyle=e.color,l.globalAlpha=e.alpha,l.fill(),l.globalAlpha=1,!0))),e.particles.length>0}))};return m(),n&&(u=window.setInterval(()=>s(),1200)),()=>{cancelAnimationFrame(o.current),clearInterval(u),p()}},[n,t,s,e]),(0,l.jsxs)(`div`,{className:T.fireworks,style:{width:e,height:t},children:[(0,l.jsx)(`canvas`,{ref:i,className:T.canvas,style:{width:e,height:t},onClick:e=>{let t=e.currentTarget.getBoundingClientRect();s(e.clientX-t.left)}}),(0,l.jsx)(`p`,{className:T.hint,children:`点击画布燃放烟花`})]})});j.displayName=`Fireworks`;var M={flipCounter:`cos-flipCounter-3LuI0`,digit:`cos-digit-yJRPy`,digitCard:`cos-digitCard-zZUzt`,staticTop:`cos-staticTop-aLQcm`,staticBottom:`cos-staticBottom-9y0gu`,flap:`cos-flap-i3YKR`,flapTop:`cos-flapTop-70z-k`,flapBottom:`cos-flapBottom-zhMZe`,isFlipping:`cos-isFlipping-EVEdI`,"fold-top":`cos-fold-top-v-6XJ`,"unfold-bottom":`cos-unfold-bottom-e2gzU`},N=(e,t)=>Math.max(0,Math.floor(e)).toString().padStart(t,`0`).slice(-t),P=({digit:e,color:t,duration:n})=>{let r=(0,c.useRef)(e),[i,a]=(0,c.useState)(!1),[o,s]=(0,c.useState)(e);(0,c.useEffect)(()=>{if(e===r.current)return;s(r.current),a(!0),r.current=e;let t=window.setTimeout(()=>a(!1),n);return()=>clearTimeout(t)},[e,n]);let u=i?o:e;return(0,l.jsx)(`div`,{className:M.digit,style:{"--flip-color":t,"--flip-duration":`${n}ms`},children:(0,l.jsxs)(`div`,{className:`${M.digitCard} ${i?M.isFlipping:``}`,children:[(0,l.jsx)(`div`,{className:M.staticTop,children:(0,l.jsx)(`span`,{children:u})}),(0,l.jsx)(`div`,{className:M.staticBottom,children:(0,l.jsx)(`span`,{children:u})}),i&&(0,l.jsxs)(l.Fragment,{children:[(0,l.jsx)(`div`,{className:`${M.flap} ${M.flapTop}`,children:(0,l.jsx)(`span`,{children:o})}),(0,l.jsx)(`div`,{className:`${M.flap} ${M.flapBottom}`,children:(0,l.jsx)(`span`,{children:e})})]})]})})},te=({value:e,digits:t=4,color:n=`#38bdf8`,duration:r=600})=>{let i=N(e,t).split(``);return(0,l.jsx)(`div`,{className:M.flipCounter,children:i.map((e,t)=>(0,l.jsx)(P,{digit:e,color:n,duration:r},t))})},F={glitchText:`cos-glitchText-dZ-sR`,text:`cos-text-JsPHN`,"glitch-1":`cos-glitch-1-s9pqH`,"glitch-2":`cos-glitch-2-GhFB-`},ne=({text:e=`GLITCH`,color:t=`#f8fafc`,glitchColor1:n=`#ff00de`,glitchColor2:r=`#00f0ff`,fontSize:i=64})=>(0,l.jsx)(`div`,{className:F.glitchText,children:(0,l.jsx)(`h1`,{className:F.text,"data-text":e,style:{fontSize:i,"--glitch-color":t,"--glitch-c1":n,"--glitch-c2":r},children:e})}),I={matrixRain:`cos-matrixRain-qg9HC`,canvas:`cos-canvas--AvpG`,overlay:`cos-overlay-knj3b`,title:`cos-title-sDfhs`,flicker:`cos-flicker-smHxl`,subtitle:`cos-subtitle-CWheW`},L=`ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789@#$%^&*アイウエオカキクケコ`,R=({width:e=800,height:t=500,density:n=.6,color:r=`#00ff41`,showOverlay:i=!0,title:a=`MATRIX`,subtitle:o=`数字雨效果`})=>{let s=(0,c.useRef)(null);return(0,c.useEffect)(()=>{let i=s.current;if(!i)return;let a=window.devicePixelRatio||1;i.width=e*a,i.height=t*a;let o=i.getContext(`2d`);if(!o)return;o.setTransform(a,0,0,a,0,0);let c=Math.floor(e/16*n),l=Array.from({length:c},()=>Math.random()*-50),u=0,d=document.hidden,p=f(e=>{d=e}),m=()=>{u=requestAnimationFrame(m),!d&&(o.fillStyle=`rgb(0 0 0 / 8%)`,o.fillRect(0,0,e,t),o.font=`16px monospace`,l.forEach((e,i)=>{let a=L[Math.floor(Math.random()*53)],s=i/n*16;o.fillStyle=r,o.fillText(a,s,e*16),e*16>t&&Math.random()>.975&&(l[i]=0),l[i]+=1}))};return m(),()=>{cancelAnimationFrame(u),p()}},[r,n,t,e]),(0,l.jsxs)(`div`,{className:I.matrixRain,style:{width:e,height:t},children:[(0,l.jsx)(`canvas`,{ref:s,className:I.canvas,style:{width:e,height:t}}),i&&(0,l.jsxs)(`div`,{className:I.overlay,children:[(0,l.jsx)(`h2`,{className:I.title,children:a}),(0,l.jsx)(`p`,{className:I.subtitle,children:o})]})]})},z={meteorRain:`cos-meteorRain-v8RNI`,canvas:`cos-canvas-hyFMr`},B=({width:e=800,height:t=500,meteorCount:n=8})=>{let r=(0,c.useRef)(null),i=(0,c.useRef)([]),a=(0,c.useRef)(0);return(0,c.useEffect)(()=>{i.current=Array.from({length:n},()=>({x:Math.random()*e,y:Math.random()*t*.5,length:Math.random()*60+40,speed:Math.random()*6+4,opacity:Math.random()*.5+.3}))},[t,n,e]),(0,c.useEffect)(()=>{let n=r.current;if(!n)return;let o=window.devicePixelRatio||1;n.width=e*o,n.height=t*o;let s=n.getContext(`2d`);if(!s)return;s.setTransform(o,0,0,o,0,0);let c=document.hidden,l=f(e=>{c=e}),u=()=>{a.current=requestAnimationFrame(u),!c&&(s.fillStyle=`rgb(15 23 42 / 15%)`,s.fillRect(0,0,e,t),i.current.forEach(n=>{n.x+=n.speed,n.y+=n.speed*.6,(n.x>e+n.length||n.y>t+n.length)&&(n.x=-n.length,n.y=Math.random()*t*.4,n.length=Math.random()*60+40,n.speed=Math.random()*6+4,n.opacity=Math.random()*.5+.3);let r=n.x-n.length,i=n.y-n.length*.6;s.beginPath(),s.strokeStyle=`rgb(255 255 255 / ${n.opacity})`,s.lineWidth=2,s.moveTo(n.x,n.y),s.lineTo(r,i),s.stroke(),s.beginPath(),s.fillStyle=`rgb(255 255 255 / ${Math.min(1,n.opacity+.2)})`,s.arc(n.x,n.y,1.5,0,Math.PI*2),s.fill()}))};return u(),()=>{cancelAnimationFrame(a.current),l()}},[t,e]),(0,l.jsx)(`div`,{className:z.meteorRain,style:{width:e,height:t},children:(0,l.jsx)(`canvas`,{ref:r,className:z.canvas,style:{width:e,height:t}})})},V={neonText:`cos-neonText-JMP7i`,text:`cos-text-GTO-0`,flicker:`cos-flicker-nXceV`,"neon-flicker":`cos-neon-flicker-uDkmM`,reflection:`cos-reflection-aEYj6`},H=({text:e=`NEON`,color:t=`#ff00de`,fontSize:n=72,flicker:r=!0})=>(0,l.jsxs)(`div`,{className:V.neonText,children:[(0,l.jsx)(`h1`,{className:`${V.text} ${r?V.flicker:``}`,style:{fontSize:n,"--neon-color":t},children:e}),(0,l.jsx)(`p`,{className:V.reflection,style:{fontSize:n*.35,color:t},children:e})]}),U={particleNetwork:`cos-particleNetwork-GSZq-`,canvas:`cos-canvas-E-BGP`,hint:`cos-hint-LEO5o`},W=({width:e=800,height:t=500,particleCount:n=60,linkDistance:r=120,repelRadius:i=150,color:a=`#38bdf8`})=>{let o=(0,c.useRef)(null),s=(0,c.useRef)([]),u=(0,c.useRef)({x:-1e3,y:-1e3}),d=(0,c.useCallback)(()=>{s.current=Array.from({length:n},()=>({x:Math.random()*e,y:Math.random()*t,vx:(Math.random()-.5)*1.2,vy:(Math.random()-.5)*1.2,radius:Math.random()*2+1}))},[t,n,e]);(0,c.useEffect)(()=>{d()},[d]),(0,c.useEffect)(()=>{let n=o.current;if(!n)return;let c=window.devicePixelRatio||1;n.width=e*c,n.height=t*c;let l=n.getContext(`2d`);if(!l)return;l.setTransform(c,0,0,c,0,0);let d=0,p=document.hidden,m=f(e=>{p=e}),h=()=>{if(p){d=requestAnimationFrame(h);return}l.fillStyle=`#0f172a`,l.fillRect(0,0,e,t);let n=s.current,o=u.current,c=i*i;n.forEach(n=>{n.x+=n.vx,n.y+=n.vy,(n.x<0||n.x>e)&&(n.vx*=-1),(n.y<0||n.y>t)&&(n.vy*=-1);let r=o.x-n.x,i=o.y-n.y,a=r*r+i*i;if(a<c&&a>0){let e=Math.sqrt(a);n.vx-=r/e*.15,n.vy-=i/e*.15}});for(let e=0;e<n.length;e++)for(let t=e+1;t<n.length;t++){let i=n[e].x-n[t].x,o=n[e].y-n[t].y,s=i*i+o*o;if(s<r*r){let i=Math.sqrt(s);l.beginPath(),l.moveTo(n[e].x,n[e].y),l.lineTo(n[t].x,n[t].y),l.strokeStyle=a,l.globalAlpha=1-i/r,l.lineWidth=.8,l.stroke(),l.globalAlpha=1}}n.forEach(e=>{l.beginPath(),l.arc(e.x,e.y,e.radius,0,Math.PI*2),l.fillStyle=a,l.fill()}),d=requestAnimationFrame(h)};return h(),()=>{cancelAnimationFrame(d),m()}},[a,t,d,r,i,e]);let p=(e,t,n)=>{u.current={x:e-n.left,y:t-n.top}},m=e=>{p(e.clientX,e.clientY,e.currentTarget.getBoundingClientRect())},h=e=>{let t=e.touches[0];t&&p(t.clientX,t.clientY,e.currentTarget.getBoundingClientRect())},g=()=>{u.current={x:-1e3,y:-1e3}};return(0,l.jsxs)(`div`,{className:U.particleNetwork,style:{width:e,height:t},children:[(0,l.jsx)(`canvas`,{ref:o,className:U.canvas,style:{width:e,height:t},onMouseMove:m,onMouseLeave:g,onTouchMove:h,onTouchEnd:g}),(0,l.jsx)(`p`,{className:U.hint,children:`移动鼠标或手指与粒子互动`})]})},G={returnCityContainer:`cos-returnCityContainer-6XTxj`,star:`cos-star-a59Dx`,glassWrap:`cos-glassWrap-golMO`,rotate:`cos-rotate-7X9Jj`,glassItem:`cos-glassItem-OwlFI`},K=({starCount:e,glassCount:t=8,glassRadius:n=150})=>{let r=(0,c.useRef)(null),i=(0,c.useRef)(null);return(0,c.useEffect)(()=>{let a=r.current,o=i.current;if(!a||!o)return;let s=[],c=[],l=[],{width:u,height:d}=a.getBoundingClientRect(),f=e??Math.max(20,Math.floor(u/20));for(let e=0;e<f;e++){let e=window.setTimeout(()=>{let e=document.createElement(`div`);e.className=G.star,e.style.top=`${Math.random()*d}px`,e.style.left=`${Math.random()*u}px`,a.append(e),c.push(e)},Math.random()*2e3);s.push(e)}for(let e=0;e<t;e++){let r=document.createElement(`div`);r.className=G.glassItem,r.style.transform=`rotateY(${360/t*e}deg) translateZ(${n}px)`,o.appendChild(r),l.push(r);let i=window.setTimeout(()=>{r.style.top=`0px`,r.style.opacity=`1`},e*300);s.push(i)}return()=>{s.forEach(clearTimeout),c.forEach(e=>e.remove()),l.forEach(e=>e.remove())}},[e,t,n]),(0,l.jsx)(`div`,{ref:r,className:G.returnCityContainer,children:(0,l.jsx)(`div`,{ref:i,className:G.glassWrap})})},q={turntable:`cos-turntable-dkc32`,wheelWrap:`cos-wheelWrap-n7lhc`,canvas:`cos-canvas-A1-4x`,pointer:`cos-pointer-Rk1S9`,spinBtn:`cos-spinBtn-l9JIC`,result:`cos-result-H8q2c`,"fade-in":`cos-fade-in-U9bUC`},J=[`#FF6B6B`,`#4ECDC4`,`#FFE66D`,`#A78BFA`,`#60A5FA`,`#F472B6`,`#34D399`,`#FB923C`],Y=[{label:`一等奖`},{label:`二等奖`},{label:`三等奖`},{label:`谢谢参与`},{label:`优惠券`},{label:`再来一次`}],X=e=>1-(1-e)**3,re=({prizes:e=Y,size:t=360,spinDuration:n=4e3,spinRounds:r=5,buttonText:i=`开始抽奖`,onSpinEnd:a})=>{let o=(0,c.useRef)(null),s=(0,c.useRef)(0),u=(0,c.useRef)(0),d=(0,c.useRef)(1),[f,p]=(0,c.useState)(!1),[m,h]=(0,c.useState)(null),g=t+48,_=(e,t)=>t.color??J[e%J.length],v=(0,c.useCallback)(n=>{let r=o.current;if(!r)return;let i=r.getContext(`2d`);if(!i)return;let a=g/2,s=t/2,c=Math.PI*2/e.length;i.clearRect(0,0,g,g),i.save(),i.translate(a,a),i.rotate(n),e.forEach((e,n)=>{let r=n*c-Math.PI/2,a=r+c,o=_(n,e);i.beginPath(),i.moveTo(0,0),i.arc(0,0,s,r,a),i.closePath(),i.fillStyle=o,i.fill(),i.strokeStyle=`rgb(255 255 255 / 35%)`,i.lineWidth=2,i.stroke(),i.save(),i.rotate(r+c/2),i.textAlign=`right`,i.fillStyle=`#fff`,i.font=`bold ${Math.max(12,Math.floor(t/22))}px system-ui, sans-serif`,i.shadowColor=`rgb(0 0 0 / 30%)`,i.shadowBlur=4,i.fillText(e.label,s-18,6),i.restore()}),i.beginPath(),i.arc(0,0,s,0,Math.PI*2),i.strokeStyle=`#fbbf24`,i.lineWidth=6,i.stroke(),i.beginPath(),i.arc(0,0,s-4,0,Math.PI*2),i.strokeStyle=`#f59e0b`,i.lineWidth=2,i.stroke(),i.restore(),i.save(),i.translate(a,a);for(let e=0;e<12;e++){let t=e/12*Math.PI*2,n=Math.cos(t)*(s+14),r=Math.sin(t)*(s+14);i.beginPath(),i.arc(n,r,3,0,Math.PI*2),i.fillStyle=e%2==0?`#fde68a`:`#f59e0b`,i.fill()}i.restore()},[g,e,t]);(0,c.useEffect)(()=>{let e=o.current;if(!e)return;let t=window.devicePixelRatio||1;d.current=t,e.width=g*t,e.height=g*t;let n=e.getContext(`2d`);n&&n.setTransform(t,0,0,t,0,0),v(s.current)},[g,v]),(0,c.useEffect)(()=>()=>{u.current&&cancelAnimationFrame(u.current)},[]);let y=t=>{let n=360/e.length,r=(180/Math.PI*t%360+360)%360;return Math.floor((360-r+n/2)%360/n)%e.length};return(0,l.jsxs)(`div`,{className:q.turntable,style:{width:g,height:g+80},children:[(0,l.jsxs)(`div`,{className:q.wheelWrap,style:{width:g,height:g},children:[(0,l.jsx)(`div`,{className:q.pointer}),(0,l.jsx)(`canvas`,{ref:o,className:q.canvas,style:{width:g,height:g}}),(0,l.jsx)(`button`,{type:`button`,className:q.spinBtn,onClick:()=>{if(f||e.length===0)return;p(!0),h(null);let t=Math.PI*2/e.length,i=Math.floor(Math.random()*e.length)*t+t/2,o=s.current,c=o+r*Math.PI*2+(Math.PI*2-i)-o%(Math.PI*2),l=o,d=performance.now(),m=t=>{let r=t-d,i=Math.min(r/n,1),o=X(i),f=l+(c-l)*o;if(s.current=f,v(f),i<1)u.current=requestAnimationFrame(m);else{let t=y(f),n=e[t];s.current=f,p(!1),h(n),a?.(n,t)}};u.current=requestAnimationFrame(m)},disabled:f,children:f?`抽奖中...`:i})]}),m&&!f&&(0,l.jsxs)(`p`,{className:q.result,children:[`恭喜获得:`,(0,l.jsx)(`strong`,{children:m.label})]})]})},Z={typewriter:`cos-typewriter-7UhOL`,terminal:`cos-terminal-NWNVN`,dots:`cos-dots-oulNg`,text:`cos-text-ICV5T`,prompt:`cos-prompt-Y4hVD`,cursor:`cos-cursor-m8hGi`,blink:`cos-blink-XykM7`},Q=[`Hello, cos-design!`,`欢迎来到组件库 ✨`,`Build something fun 🚀`],ie=({texts:e,speed:t,deleteSpeed:n,pause:r})=>{let[i,a]=(0,c.useState)(``),[o,s]=(0,c.useState)(0),[u,d]=(0,c.useState)(!1);return(0,c.useEffect)(()=>{let c=e[o%e.length],l;if(!u&&i===c)l=setTimeout(()=>d(!0),r);else if(u&&i===``)l=setTimeout(()=>{d(!1),s(t=>(t+1)%e.length)},0);else{let e=u?c.slice(0,i.length-1):c.slice(0,i.length+1);l=setTimeout(()=>a(e),u?n:t)}return()=>clearTimeout(l)},[i,u,o,e,t,n,r]),(0,l.jsx)(`div`,{className:Z.typewriter,children:(0,l.jsxs)(`div`,{className:Z.terminal,children:[(0,l.jsxs)(`div`,{className:Z.dots,children:[(0,l.jsx)(`span`,{}),(0,l.jsx)(`span`,{}),(0,l.jsx)(`span`,{})]}),(0,l.jsxs)(`p`,{className:Z.text,children:[(0,l.jsx)(`span`,{className:Z.prompt,children:`>`}),i,(0,l.jsx)(`span`,{className:Z.cursor,children:`|`})]})]})})},ae=({texts:e=Q,speed:t=100,deleteSpeed:n=50,pause:r=2e3})=>{let i=e.length>0?e:Q;return(0,l.jsx)(ie,{texts:i,speed:t,deleteSpeed:n,pause:r},i.join(`\0`))},$={waveButton:`cos-waveButton-Aa7G-`,btn:`cos-btn-WJrEN`,label:`cos-label-9BHOU`,wave:`cos-wave-GycLU`,ripple:`cos-ripple-5ZFpr`},oe=({text:e=`点我试试`,color:t=`#38bdf8`,className:n,style:r,...i})=>(0,l.jsx)(`div`,{className:$.waveButton,children:(0,l.jsxs)(`button`,{type:`button`,className:`${$.btn} ${n??``}`,style:{"--wave-color":t,...r},...i,children:[(0,l.jsx)(`span`,{className:$.wave}),(0,l.jsx)(`span`,{className:$.wave}),(0,l.jsx)(`span`,{className:$.label,children:e})]})});exports.CanvasClock=d,exports.Charge=h,exports.Confetti=b,exports.Countdown=w,exports.Fireworks=j,exports.FlipCounter=te,exports.GlitchText=ne,exports.MatrixRain=R,exports.MeteorRain=B,exports.NeonText=H,exports.ParticleNetwork=W,exports.ReturnCity=K,exports.Turntable=re,exports.Typewriter=ae,exports.WaveButton=oe;
|
package/dist/index.css
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
.cos-canvasClock-QvdV3{background-color:#fff;border-radius:50%;justify-content:center;align-items:center;display:inline-flex;box-shadow:0 8px 32px #00000040}.cos-canvasTarget-x-odC{border-radius:50%;display:block}.cos-chargeContainer-4t9qo{background-color:#000;width:100vw;height:100vh;position:relative}.cos-chargeContainer-4t9qo .cos-contrast-PNep9{filter:contrast(15)hue-rotate();background-color:#000;width:100%;height:100%;animation:6s linear infinite cos-hueRotate-bMJ-k;position:relative;overflow:hidden}.cos-chargeContainer-4t9qo .cos-contrast-PNep9 .cos-text-2k7eH{text-align:center;z-index:9;color:#fff;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale;width:300px;height:300px;margin-left:-150px;font-size:30px;line-height:300px;position:absolute;top:10px;left:50%}.cos-chargeContainer-4t9qo .cos-contrast-PNep9 span{filter:blur(5px);will-change:transform;background:#00ff6f;border-radius:10px;transition:transform .3s linear;animation:ease-in-out infinite cos-moveUp-1Vz9j;position:absolute;bottom:0}.cos-chargeContainer-4t9qo .cos-contrast-PNep9 span:first-child{width:20px;height:20px;animation-duration:4s;animation-delay:2s;left:50%}.cos-chargeContainer-4t9qo .cos-contrast-PNep9 span:nth-child(2){width:22px;height:22px;animation-duration:4.2s;animation-delay:4s;left:54%}.cos-chargeContainer-4t9qo .cos-contrast-PNep9 span:nth-child(3){width:24px;height:24px;animation-duration:3s;animation-delay:1s;left:45%}.cos-chargeContainer-4t9qo .cos-contrast-PNep9 span:nth-child(4){width:20px;height:22px;animation-duration:5s;animation-delay:0s;left:54%}.cos-chargeContainer-4t9qo .cos-contrast-PNep9 span:nth-child(5){width:22px;height:22px;animation-duration:3.5s;animation-delay:5s;left:52%}.cos-chargeContainer-4t9qo .cos-contrast-PNep9 span:nth-child(6){width:20px;height:20px;animation-duration:4.7s;animation-delay:1.2s;left:50%}.cos-chargeContainer-4t9qo .cos-contrast-PNep9 span:nth-child(7){width:22px;height:22px;animation-duration:2.5s;animation-delay:3.5s;left:54%}.cos-chargeContainer-4t9qo .cos-contrast-PNep9 span:nth-child(8){width:24px;height:24px;animation-duration:5.6s;animation-delay:4.2s;left:51%}.cos-chargeContainer-4t9qo .cos-contrast-PNep9 span:nth-child(9){width:26px;height:26px;animation-duration:5.2s;animation-delay:4s;left:42%}.cos-chargeContainer-4t9qo .cos-contrast-PNep9 span:nth-child(10){width:26px;height:22px;animation-duration:3.8s;animation-delay:4.3s;left:54%}.cos-chargeContainer-4t9qo .cos-contrast-PNep9 span:nth-child(11){width:22px;height:22px;animation-duration:4.2s;animation-delay:.3s;left:42%}.cos-chargeContainer-4t9qo .cos-contrast-PNep9 span:nth-child(12){width:24px;height:24px;animation-duration:4.6s;animation-delay:2s;left:46%}.cos-chargeContainer-4t9qo .cos-contrast-PNep9 span:nth-child(13){width:22px;height:22px;animation-duration:3.8s;animation-delay:3.2s;left:48%}.cos-chargeContainer-4t9qo .cos-contrast-PNep9 span:nth-child(14){width:26px;height:22px;animation-duration:5.2s;animation-delay:2.9s;left:55%}.cos-chargeContainer-4t9qo .cos-contrast-PNep9 span:nth-child(15){width:26px;height:22px;animation-duration:4.9s;animation-delay:4.2s;left:52%}.cos-chargeContainer-4t9qo .cos-contrast-PNep9 .cos-circle-m4vwX{box-sizing:border-box;filter:blur(8px);width:300px;height:300px;margin-left:-150px;animation:6s linear infinite cos-circleRotate-bgFw5;position:absolute;top:10px;left:50%}.cos-chargeContainer-4t9qo .cos-contrast-PNep9 .cos-circle-m4vwX:before{content:"";background:#00ff6f;border-radius:42% 38% 62% 49%/45%;width:200px;height:200px;position:absolute;top:50%;left:50%;transform:translate(-50%,-50%)rotate(0)}.cos-chargeContainer-4t9qo .cos-contrast-PNep9 .cos-circle-m4vwX:after{content:"";background:#000;border-radius:50%;width:176px;height:178px;position:absolute;top:50%;left:50%;transform:translate(-50%,-50%)}.cos-chargeContainer-4t9qo .cos-contrast-PNep9 .cos-button-myCst{filter:blur(5px);background:#00ff6f;border-radius:100px 100px 0 0;width:150px;height:50px;position:absolute;bottom:0;left:50%;transform:translate(-50%)}@keyframes cos-circleRotate-bgFw5{0%{transform:rotate(0)}to{transform:rotate(360deg)}}@keyframes cos-hueRotate-bMJ-k{0%{filter:contrast(15)hue-rotate()}to{filter:contrast(15)hue-rotate(360deg)}}@keyframes cos-moveUp-1Vz9j{0%{transform:translateY(0)}to{transform:translateY(calc(245px - 100vh))}}.cos-confetti-MeNtU{background:#0f172a;border-radius:12px;position:relative;overflow:hidden}.cos-canvas-0T3Vs{cursor:pointer;display:block}.cos-hint-sGHEi{text-align:center;color:#94a3b8b3;pointer-events:none;margin:0;font-size:13px;position:absolute;bottom:12px;left:0;right:0}.cos-countdown-5ZKKP{flex-wrap:wrap;justify-content:center;align-items:center;gap:16px;padding:32px;display:flex;position:relative}.cos-unit-dth8N{flex-direction:column;align-items:center;gap:8px;display:flex}.cos-value-yVzcP{min-width:72px;color:var(--countdown-color,#f472b6);text-align:center;text-shadow:0 0 16px color-mix(in srgb, var(--countdown-color,#f472b6) 40%, transparent);background:linear-gradient(145deg,#1e293b,#0f172a);border:1px solid #94a3b833;border-radius:12px;padding:16px 12px;font-family:ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,monospace;font-size:36px;font-weight:700;box-shadow:0 8px 24px #0000004d,inset 0 1px #ffffff0d}.cos-label-pAMEs{color:#94a3b8;letter-spacing:.1em;font-size:13px}.cos-ended-c0dsD{color:var(--countdown-color,#f472b6);margin:0;font-size:14px;animation:1.5s ease-in-out infinite cos-pulse-krQd-;position:absolute;bottom:4px}@keyframes cos-pulse-krQd-{0%,to{opacity:1}50%{opacity:.5}}.cos-fireworks-fsSqL{background:#0f172a;border-radius:12px;position:relative;overflow:hidden}.cos-canvas-spL8G{cursor:crosshair;display:block}.cos-hint-5XDRH{color:#94a3b8cc;pointer-events:none;margin:0;font-size:13px;position:absolute;bottom:12px;left:50%;transform:translate(-50%)}.cos-flipCounter-3LuI0{justify-content:center;align-items:center;gap:6px;padding:24px;display:flex}.cos-digit-yJRPy{perspective:300px}.cos-digitCard-zZUzt{border-radius:8px;width:48px;height:64px;font-family:ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,monospace;font-size:36px;font-weight:700;position:relative;overflow:hidden;box-shadow:0 4px 12px #0006}.cos-staticTop-aLQcm,.cos-staticBottom-9y0gu,.cos-flap-i3YKR{background:linear-gradient(#1e293b 0%,#0f172a 100%);border:1px solid #94a3b833;width:100%;height:50%;position:absolute;left:0;overflow:hidden}.cos-staticTop-aLQcm span,.cos-staticBottom-9y0gu span,.cos-flap-i3YKR span{width:100%;height:200%;color:var(--flip-color,#38bdf8);text-shadow:0 0 10px #38bdf880;justify-content:center;align-items:center;display:flex;position:absolute;left:0}.cos-staticTop-aLQcm,.cos-flapTop-70z-k{border-bottom:1px solid #00000073;border-radius:8px 8px 0 0;top:0}.cos-staticTop-aLQcm span,.cos-flapTop-70z-k span{top:0}.cos-staticBottom-9y0gu,.cos-flapBottom-zhMZe{border-radius:0 0 8px 8px;bottom:0}.cos-staticBottom-9y0gu span,.cos-flapBottom-zhMZe span{bottom:0}.cos-flap-i3YKR{z-index:2;backface-visibility:hidden}.cos-flapTop-70z-k{transform-origin:bottom}.cos-flapBottom-zhMZe{transform-origin:top;transform:rotateX(90deg)}.cos-isFlipping-EVEdI .cos-flapTop-70z-k{animation:cos-fold-top-v-6XJ var(--flip-duration,.6s) ease-in forwards}.cos-isFlipping-EVEdI .cos-flapBottom-zhMZe{animation:cos-unfold-bottom-e2gzU var(--flip-duration,.6s) ease-out forwards}@keyframes cos-fold-top-v-6XJ{0%{transform:rotateX(0)}to{transform:rotateX(-90deg)}}@keyframes cos-unfold-bottom-e2gzU{0%{transform:rotateX(90deg)}to{transform:rotateX(0)}}.cos-glitchText-dZ-sR{background:#0a0a0a;border-radius:12px;justify-content:center;align-items:center;min-height:240px;padding:40px;display:flex}.cos-text-JsPHN{color:var(--glitch-color,#f8fafc);letter-spacing:.12em;text-transform:uppercase;margin:0;font-weight:900;position:relative}.cos-text-JsPHN:before,.cos-text-JsPHN:after{content:attr(data-text);width:100%;height:100%;position:absolute;top:0;left:0;overflow:hidden}.cos-text-JsPHN:before{color:var(--glitch-c1,#ff00de);clip-path:polygon(0 0,100% 0,100% 35%,0 35%);animation:2.5s linear infinite alternate-reverse cos-glitch-1-s9pqH;left:2px}.cos-text-JsPHN:after{color:var(--glitch-c2,#00f0ff);clip-path:polygon(0 65%,100% 65%,100% 100%,0 100%);animation:3s linear infinite alternate-reverse cos-glitch-2-GhFB-;left:-2px}@keyframes cos-glitch-1-s9pqH{0%{transform:translate(0)}20%{transform:translate(-3px,2px)}40%{transform:translate(3px,-1px)}60%{transform:translate(-2px,-2px)}80%{transform:translate(2px,1px)}to{transform:translate(0)}}@keyframes cos-glitch-2-GhFB-{0%{transform:translate(0)}20%{transform:translate(3px,-2px)}40%{transform:translate(-3px,1px)}60%{transform:translate(2px,2px)}80%{transform:translate(-2px,-1px)}to{transform:translate(0)}}.cos-matrixRain-qg9HC{background:#000;border-radius:12px;position:relative;overflow:hidden}.cos-canvas--AvpG{display:block}.cos-overlay-knj3b{pointer-events:none;flex-direction:column;justify-content:center;align-items:center;display:flex;position:absolute;inset:0}.cos-title-sDfhs{color:#00ff41;letter-spacing:.3em;text-shadow:0 0 20px #00ff41;margin:0;font-size:48px;font-weight:800;animation:3s infinite cos-flicker-smHxl}.cos-subtitle-CWheW{color:#00ff4199;letter-spacing:.2em;margin:8px 0 0;font-size:14px}@keyframes cos-flicker-smHxl{0%,to{opacity:1}50%{opacity:.85}52%{opacity:.6}54%{opacity:1}}.cos-meteorRain-v8RNI{background:#0f172a;border-radius:12px;overflow:hidden}.cos-canvas-hyFMr{display:block}.cos-neonText-JMP7i{background:#0a0a0a;border-radius:12px;flex-direction:column;justify-content:center;align-items:center;min-height:240px;padding:40px;display:flex}.cos-text-GTO-0{color:var(--neon-color,#ff00de);letter-spacing:.15em;text-shadow:0 0 5px var(--neon-color), 0 0 10px var(--neon-color), 0 0 20px var(--neon-color), 0 0 40px var(--neon-color), 0 0 80px var(--neon-color);margin:0;font-weight:900}.cos-flicker-nXceV{animation:2.5s infinite alternate cos-neon-flicker-uDkmM}.cos-reflection-aEYj6{opacity:.3;letter-spacing:.15em;filter:blur(2px);margin:12px 0 0;font-weight:700;transform:scaleY(-1)}@keyframes cos-neon-flicker-uDkmM{0%,19%,21%,23%,25%,54%,56%,to{opacity:1}20%,24%,55%{opacity:.6}}.cos-particleNetwork-GSZq-{border-radius:12px;position:relative;overflow:hidden}.cos-canvas-E-BGP{cursor:crosshair;display:block}.cos-hint-LEO5o{color:#94a3b8b3;pointer-events:none;margin:0;font-size:13px;position:absolute;bottom:12px;left:50%;transform:translate(-50%)}.cos-returnCityContainer-6XTxj{background:#000;width:100%;height:100%;position:relative;overflow:hidden}.cos-returnCityContainer-6XTxj .cos-star-a59Dx{background:#fd400a;border-radius:50%;width:5px;height:5px;animation:2s infinite cos-star-a59Dx;position:absolute}.cos-returnCityContainer-6XTxj .cos-glassWrap-golMO{width:100px;height:175px;transform-style:preserve-3d;animation:10s linear infinite cos-rotate-7X9Jj;position:absolute;bottom:50%;left:50%;transform:translate(-50%,50%)}.cos-returnCityContainer-6XTxj .cos-glassWrap-golMO .cos-glassItem-OwlFI{opacity:0;background:#ad470257;border-radius:5px;width:100%;height:100%;transition:all .3s ease-in;position:absolute;top:-250px;left:0;box-shadow:0 0 10px 3px #ff0000b3}@keyframes cos-rotate-7X9Jj{0%{transform:translate(-50%,50%)rotateY(360deg)}to{transform:translate(-50%,50%)rotateY(0)}}@keyframes cos-star-a59Dx{0%{filter:blur(1px)contrast(15)hue-rotate();opacity:0}50%{opacity:1;filter:blur(1px)contrast(15)hue-rotate(360deg)}to{opacity:0;filter:blur(1px)contrast(15)hue-rotate()}}.cos-turntable-dkc32{box-sizing:border-box;flex-direction:column;justify-content:center;align-items:center;gap:20px;margin:0 auto;padding:24px;display:flex}.cos-wheelWrap-n7lhc{justify-content:center;align-items:center;display:flex;position:relative}.cos-canvas-A1-4x{filter:drop-shadow(0 12px 32px #00000059);border-radius:50%;display:block}.cos-pointer-Rk1S9{z-index:2;filter:drop-shadow(0 2px 4px #0000004d);border-top:28px solid #ef4444;border-left:14px solid #0000;border-right:14px solid #0000;width:0;height:0;position:absolute;top:4px;left:50%;transform:translate(-50%)}.cos-pointer-Rk1S9:after{content:"";background:#ef4444;border-radius:50%;width:16px;height:16px;position:absolute;top:-30px;left:-8px;box-shadow:inset 0 -2px 4px #0003}.cos-spinBtn-l9JIC{z-index:3;color:#b45309;cursor:pointer;background:linear-gradient(145deg,#fff 0%,#f1f5f9 100%);border:4px solid #fbbf24;border-radius:50%;width:88px;height:88px;font-size:14px;font-weight:700;line-height:1.3;transition:transform .15s,box-shadow .15s;position:absolute;box-shadow:0 4px 12px #00000026,inset 0 2px 4px #fffc}.cos-spinBtn-l9JIC:hover:not(:disabled){transform:scale(1.05);box-shadow:0 6px 16px #0003,inset 0 2px 4px #fffc}.cos-spinBtn-l9JIC:active:not(:disabled){transform:scale(.97)}.cos-spinBtn-l9JIC:disabled{opacity:.75;cursor:not-allowed}.cos-result-H8q2c{color:#92400e;background:linear-gradient(90deg,#fef3c7,#fde68a);border-radius:999px;margin:0;padding:10px 20px;font-size:15px;animation:.4s cos-fade-in-U9bUC}.cos-result-H8q2c strong{color:#b45309;font-size:17px}@keyframes cos-fade-in-U9bUC{0%{opacity:0;transform:translateY(8px)}to{opacity:1;transform:translateY(0)}}.cos-typewriter-7UhOL{box-sizing:border-box;justify-content:center;align-items:center;width:100%;min-height:200px;padding:24px;display:flex}.cos-terminal-NWNVN{background:#1e293b;border-radius:12px;width:min(560px,100%);padding:20px 24px;box-shadow:0 16px 48px #00000059}.cos-dots-oulNg{gap:8px;margin-bottom:16px;display:flex}.cos-dots-oulNg span{border-radius:50%;width:12px;height:12px}.cos-dots-oulNg span:first-child{background:#ef4444}.cos-dots-oulNg span:nth-child(2){background:#eab308}.cos-dots-oulNg span:nth-child(3){background:#22c55e}.cos-text-ICV5T{color:#e2e8f0;min-height:1.6em;margin:0;font-family:ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,monospace;font-size:20px;line-height:1.6}.cos-prompt-Y4hVD{color:#38bdf8;margin-right:8px}.cos-cursor-m8hGi{color:#38bdf8;margin-left:2px;animation:1s step-end infinite cos-blink-XykM7;display:inline-block}@keyframes cos-blink-XykM7{50%{opacity:0}}.cos-waveButton-Aa7G-{justify-content:center;align-items:center;min-height:200px;padding:40px;display:flex}.cos-btn-WJrEN{background:var(--wave-color,#38bdf8);color:#fff;cursor:pointer;border:none;border-radius:50px;padding:16px 48px;font-size:18px;font-weight:600;transition:transform .2s;position:relative;overflow:hidden;box-shadow:0 8px 24px #38bdf859}.cos-btn-WJrEN:hover{transform:scale(1.05)}.cos-btn-WJrEN:active{transform:scale(.97)}.cos-label-9BHOU{z-index:1;position:relative}.cos-wave-GycLU{background:#ffffff4d;border-radius:50%;width:0;height:0;animation:3s ease-out infinite cos-ripple-5ZFpr;position:absolute;top:50%;left:50%;transform:translate(-50%,-50%)}.cos-wave-GycLU:nth-child(2){animation-delay:1s}@keyframes cos-ripple-5ZFpr{0%{opacity:.6;width:0;height:0}to{opacity:0;width:300px;height:300px}}
|
|
1
|
+
.cos-canvasClock-QvdV3{background-color:#fff;border-radius:50%;justify-content:center;align-items:center;display:inline-flex;box-shadow:0 8px 32px #00000040}.cos-canvasTarget-x-odC{border-radius:50%;display:block}.cos-chargeContainer-4t9qo{background-color:#000;width:100%;height:100%;min-height:480px;position:relative}.cos-chargeContainer-4t9qo .cos-contrast-PNep9{filter:contrast(15)hue-rotate();background-color:#000;width:100%;height:100%;animation:6s linear infinite cos-hueRotate-bMJ-k;position:absolute;inset:0;overflow:hidden}.cos-chargeContainer-4t9qo .cos-contrast-PNep9 .cos-text-2k7eH{text-align:center;z-index:9;color:#fff;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale;width:300px;height:300px;margin-left:-150px;font-size:30px;line-height:300px;position:absolute;top:10px;left:50%}.cos-chargeContainer-4t9qo .cos-contrast-PNep9 span{filter:blur(5px);will-change:transform;background:#00ff6f;border-radius:10px;transition:transform .3s linear;animation:ease-in-out infinite cos-moveUp-1Vz9j;position:absolute;bottom:0}.cos-chargeContainer-4t9qo .cos-contrast-PNep9 span:nth-child(2){width:20px;height:20px;animation-duration:4s;animation-delay:2s;left:50%}.cos-chargeContainer-4t9qo .cos-contrast-PNep9 span:nth-child(3){width:22px;height:22px;animation-duration:4.2s;animation-delay:4s;left:54%}.cos-chargeContainer-4t9qo .cos-contrast-PNep9 span:nth-child(4){width:24px;height:24px;animation-duration:3s;animation-delay:1s;left:45%}.cos-chargeContainer-4t9qo .cos-contrast-PNep9 span:nth-child(5){width:20px;height:22px;animation-duration:5s;animation-delay:0s;left:54%}.cos-chargeContainer-4t9qo .cos-contrast-PNep9 span:nth-child(6){width:22px;height:22px;animation-duration:3.5s;animation-delay:5s;left:52%}.cos-chargeContainer-4t9qo .cos-contrast-PNep9 span:nth-child(7){width:20px;height:20px;animation-duration:4.7s;animation-delay:1.2s;left:50%}.cos-chargeContainer-4t9qo .cos-contrast-PNep9 span:nth-child(8){width:22px;height:22px;animation-duration:2.5s;animation-delay:3.5s;left:54%}.cos-chargeContainer-4t9qo .cos-contrast-PNep9 span:nth-child(9){width:24px;height:24px;animation-duration:5.6s;animation-delay:4.2s;left:51%}.cos-chargeContainer-4t9qo .cos-contrast-PNep9 span:nth-child(10){width:26px;height:26px;animation-duration:5.2s;animation-delay:4s;left:42%}.cos-chargeContainer-4t9qo .cos-contrast-PNep9 span:nth-child(11){width:26px;height:22px;animation-duration:3.8s;animation-delay:4.3s;left:54%}.cos-chargeContainer-4t9qo .cos-contrast-PNep9 span:nth-child(12){width:22px;height:22px;animation-duration:4.2s;animation-delay:.3s;left:42%}.cos-chargeContainer-4t9qo .cos-contrast-PNep9 span:nth-child(13){width:24px;height:24px;animation-duration:4.6s;animation-delay:2s;left:46%}.cos-chargeContainer-4t9qo .cos-contrast-PNep9 span:nth-child(14){width:22px;height:22px;animation-duration:3.8s;animation-delay:3.2s;left:48%}.cos-chargeContainer-4t9qo .cos-contrast-PNep9 span:nth-child(15){width:26px;height:22px;animation-duration:5.2s;animation-delay:2.9s;left:55%}.cos-chargeContainer-4t9qo .cos-contrast-PNep9 span:nth-child(16){width:26px;height:22px;animation-duration:4.9s;animation-delay:4.2s;left:52%}.cos-chargeContainer-4t9qo .cos-contrast-PNep9 .cos-circle-m4vwX{box-sizing:border-box;filter:blur(8px);width:300px;height:300px;margin-left:-150px;animation:6s linear infinite cos-circleRotate-bgFw5;position:absolute;top:10px;left:50%}.cos-chargeContainer-4t9qo .cos-contrast-PNep9 .cos-circle-m4vwX:before{content:"";background:#00ff6f;border-radius:42% 38% 62% 49%/45%;width:200px;height:200px;position:absolute;top:50%;left:50%;transform:translate(-50%,-50%)rotate(0)}.cos-chargeContainer-4t9qo .cos-contrast-PNep9 .cos-circle-m4vwX:after{content:"";background:#000;border-radius:50%;width:176px;height:178px;position:absolute;top:50%;left:50%;transform:translate(-50%,-50%)}.cos-chargeContainer-4t9qo .cos-contrast-PNep9 .cos-button-myCst{filter:blur(5px);background:#00ff6f;border-radius:100px 100px 0 0;width:150px;height:50px;position:absolute;bottom:0;left:50%;transform:translate(-50%)}@keyframes cos-circleRotate-bgFw5{0%{transform:rotate(0)}to{transform:rotate(360deg)}}@keyframes cos-hueRotate-bMJ-k{0%{filter:contrast(15)hue-rotate()}to{filter:contrast(15)hue-rotate(360deg)}}@keyframes cos-moveUp-1Vz9j{0%{transform:translateY(0)}to{transform:translateY(calc(-1 * var(--charge-h,100vh) + 245px))}}.cos-confetti-MeNtU{background:#0f172a;border-radius:12px;position:relative;overflow:hidden}.cos-canvas-0T3Vs{cursor:pointer;display:block}.cos-hint-sGHEi{text-align:center;color:#94a3b8b3;pointer-events:none;margin:0;font-size:13px;position:absolute;bottom:12px;left:0;right:0}.cos-countdown-5ZKKP{flex-wrap:wrap;justify-content:center;align-items:center;gap:16px;padding:32px;display:flex;position:relative}.cos-unit-dth8N{flex-direction:column;align-items:center;gap:8px;display:flex}.cos-value-yVzcP{min-width:72px;color:var(--countdown-color,#f472b6);text-align:center;text-shadow:0 0 16px color-mix(in srgb, var(--countdown-color,#f472b6) 40%, transparent);background:linear-gradient(145deg,#1e293b,#0f172a);border:1px solid #94a3b833;border-radius:12px;padding:16px 12px;font-family:ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,monospace;font-size:36px;font-weight:700;box-shadow:0 8px 24px #0000004d,inset 0 1px #ffffff0d}.cos-label-pAMEs{color:#94a3b8;letter-spacing:.1em;font-size:13px}.cos-ended-c0dsD{color:var(--countdown-color,#f472b6);margin:0;font-size:14px;animation:1.5s ease-in-out infinite cos-pulse-krQd-;position:absolute;bottom:4px}.cos-invalid-d6t-L{color:#f87171;text-align:center;margin:0;padding:32px;font-size:14px}@keyframes cos-pulse-krQd-{0%,to{opacity:1}50%{opacity:.5}}.cos-fireworks-fsSqL{background:#0f172a;border-radius:12px;position:relative;overflow:hidden}.cos-canvas-spL8G{cursor:crosshair;display:block}.cos-hint-5XDRH{color:#94a3b8cc;pointer-events:none;margin:0;font-size:13px;position:absolute;bottom:12px;left:50%;transform:translate(-50%)}.cos-flipCounter-3LuI0{justify-content:center;align-items:center;gap:6px;padding:24px;display:flex}.cos-digit-yJRPy{perspective:300px}.cos-digitCard-zZUzt{border-radius:8px;width:48px;height:64px;font-family:ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,monospace;font-size:36px;font-weight:700;position:relative;overflow:hidden;box-shadow:0 4px 12px #0006}.cos-staticTop-aLQcm,.cos-staticBottom-9y0gu,.cos-flap-i3YKR{background:linear-gradient(#1e293b 0%,#0f172a 100%);border:1px solid #94a3b833;width:100%;height:50%;position:absolute;left:0;overflow:hidden}.cos-staticTop-aLQcm span,.cos-staticBottom-9y0gu span,.cos-flap-i3YKR span{width:100%;height:200%;color:var(--flip-color,#38bdf8);text-shadow:0 0 10px #38bdf880;justify-content:center;align-items:center;display:flex;position:absolute;left:0}.cos-staticTop-aLQcm,.cos-flapTop-70z-k{border-bottom:1px solid #00000073;border-radius:8px 8px 0 0;top:0}.cos-staticTop-aLQcm span,.cos-flapTop-70z-k span{top:0}.cos-staticBottom-9y0gu,.cos-flapBottom-zhMZe{border-radius:0 0 8px 8px;bottom:0}.cos-staticBottom-9y0gu span,.cos-flapBottom-zhMZe span{bottom:0}.cos-flap-i3YKR{z-index:2;backface-visibility:hidden}.cos-flapTop-70z-k{transform-origin:bottom}.cos-flapBottom-zhMZe{transform-origin:top;transform:rotateX(90deg)}.cos-isFlipping-EVEdI .cos-flapTop-70z-k{animation:cos-fold-top-v-6XJ var(--flip-duration,.6s) ease-in forwards}.cos-isFlipping-EVEdI .cos-flapBottom-zhMZe{animation:cos-unfold-bottom-e2gzU var(--flip-duration,.6s) ease-out forwards}@keyframes cos-fold-top-v-6XJ{0%{transform:rotateX(0)}to{transform:rotateX(-90deg)}}@keyframes cos-unfold-bottom-e2gzU{0%{transform:rotateX(90deg)}to{transform:rotateX(0)}}.cos-glitchText-dZ-sR{background:#0a0a0a;border-radius:12px;justify-content:center;align-items:center;min-height:240px;padding:40px;display:flex}.cos-text-JsPHN{color:var(--glitch-color,#f8fafc);letter-spacing:.12em;text-transform:uppercase;margin:0;font-weight:900;position:relative}.cos-text-JsPHN:before,.cos-text-JsPHN:after{content:attr(data-text);width:100%;height:100%;position:absolute;top:0;left:0;overflow:hidden}.cos-text-JsPHN:before{color:var(--glitch-c1,#ff00de);clip-path:polygon(0 0,100% 0,100% 35%,0 35%);animation:2.5s linear infinite alternate-reverse cos-glitch-1-s9pqH;left:2px}.cos-text-JsPHN:after{color:var(--glitch-c2,#00f0ff);clip-path:polygon(0 65%,100% 65%,100% 100%,0 100%);animation:3s linear infinite alternate-reverse cos-glitch-2-GhFB-;left:-2px}@keyframes cos-glitch-1-s9pqH{0%{transform:translate(0)}20%{transform:translate(-3px,2px)}40%{transform:translate(3px,-1px)}60%{transform:translate(-2px,-2px)}80%{transform:translate(2px,1px)}to{transform:translate(0)}}@keyframes cos-glitch-2-GhFB-{0%{transform:translate(0)}20%{transform:translate(3px,-2px)}40%{transform:translate(-3px,1px)}60%{transform:translate(2px,2px)}80%{transform:translate(-2px,-1px)}to{transform:translate(0)}}.cos-matrixRain-qg9HC{background:#000;border-radius:12px;position:relative;overflow:hidden}.cos-canvas--AvpG{display:block}.cos-overlay-knj3b{pointer-events:none;flex-direction:column;justify-content:center;align-items:center;display:flex;position:absolute;inset:0}.cos-title-sDfhs{color:#00ff41;letter-spacing:.3em;text-shadow:0 0 20px #00ff41;margin:0;font-size:48px;font-weight:800;animation:3s infinite cos-flicker-smHxl}.cos-subtitle-CWheW{color:#00ff4199;letter-spacing:.2em;margin:8px 0 0;font-size:14px}@keyframes cos-flicker-smHxl{0%,to{opacity:1}50%{opacity:.85}52%{opacity:.6}54%{opacity:1}}.cos-meteorRain-v8RNI{background:#0f172a;border-radius:12px;overflow:hidden}.cos-canvas-hyFMr{display:block}.cos-neonText-JMP7i{background:#0a0a0a;border-radius:12px;flex-direction:column;justify-content:center;align-items:center;min-height:240px;padding:40px;display:flex}.cos-text-GTO-0{color:var(--neon-color,#ff00de);letter-spacing:.15em;text-shadow:0 0 5px var(--neon-color), 0 0 10px var(--neon-color), 0 0 20px var(--neon-color), 0 0 40px var(--neon-color), 0 0 80px var(--neon-color);margin:0;font-weight:900}.cos-flicker-nXceV{animation:2.5s infinite alternate cos-neon-flicker-uDkmM}.cos-reflection-aEYj6{opacity:.3;letter-spacing:.15em;filter:blur(2px);margin:12px 0 0;font-weight:700;transform:scaleY(-1)}@keyframes cos-neon-flicker-uDkmM{0%,19%,21%,23%,25%,54%,56%,to{opacity:1}20%,24%,55%{opacity:.6}}.cos-particleNetwork-GSZq-{border-radius:12px;position:relative;overflow:hidden}.cos-canvas-E-BGP{cursor:crosshair;display:block}.cos-hint-LEO5o{color:#94a3b8b3;pointer-events:none;margin:0;font-size:13px;position:absolute;bottom:12px;left:50%;transform:translate(-50%)}.cos-returnCityContainer-6XTxj{background:#000;width:100%;height:100%;position:relative;overflow:hidden}.cos-returnCityContainer-6XTxj .cos-star-a59Dx{background:#fd400a;border-radius:50%;width:5px;height:5px;animation:2s infinite cos-star-a59Dx;position:absolute}.cos-returnCityContainer-6XTxj .cos-glassWrap-golMO{width:100px;height:175px;transform-style:preserve-3d;animation:10s linear infinite cos-rotate-7X9Jj;position:absolute;bottom:50%;left:50%;transform:translate(-50%,50%)}.cos-returnCityContainer-6XTxj .cos-glassWrap-golMO .cos-glassItem-OwlFI{opacity:0;background:#ad470257;border-radius:5px;width:100%;height:100%;transition:all .3s ease-in;position:absolute;top:-250px;left:0;box-shadow:0 0 10px 3px #ff0000b3}@keyframes cos-rotate-7X9Jj{0%{transform:translate(-50%,50%)rotateY(360deg)}to{transform:translate(-50%,50%)rotateY(0)}}@keyframes cos-star-a59Dx{0%{filter:blur(1px)contrast(15)hue-rotate();opacity:0}50%{opacity:1;filter:blur(1px)contrast(15)hue-rotate(360deg)}to{opacity:0;filter:blur(1px)contrast(15)hue-rotate()}}.cos-turntable-dkc32{box-sizing:border-box;flex-direction:column;justify-content:center;align-items:center;gap:20px;margin:0 auto;padding:24px;display:flex}.cos-wheelWrap-n7lhc{justify-content:center;align-items:center;display:flex;position:relative}.cos-canvas-A1-4x{filter:drop-shadow(0 12px 32px #00000059);border-radius:50%;display:block}.cos-pointer-Rk1S9{z-index:2;filter:drop-shadow(0 2px 4px #0000004d);border-top:28px solid #ef4444;border-left:14px solid #0000;border-right:14px solid #0000;width:0;height:0;position:absolute;top:4px;left:50%;transform:translate(-50%)}.cos-pointer-Rk1S9:after{content:"";background:#ef4444;border-radius:50%;width:16px;height:16px;position:absolute;top:-30px;left:-8px;box-shadow:inset 0 -2px 4px #0003}.cos-spinBtn-l9JIC{z-index:3;color:#b45309;cursor:pointer;background:linear-gradient(145deg,#fff 0%,#f1f5f9 100%);border:4px solid #fbbf24;border-radius:50%;width:88px;height:88px;font-size:14px;font-weight:700;line-height:1.3;transition:transform .15s,box-shadow .15s;position:absolute;box-shadow:0 4px 12px #00000026,inset 0 2px 4px #fffc}.cos-spinBtn-l9JIC:hover:not(:disabled){transform:scale(1.05);box-shadow:0 6px 16px #0003,inset 0 2px 4px #fffc}.cos-spinBtn-l9JIC:active:not(:disabled){transform:scale(.97)}.cos-spinBtn-l9JIC:disabled{opacity:.75;cursor:not-allowed}.cos-result-H8q2c{color:#92400e;background:linear-gradient(90deg,#fef3c7,#fde68a);border-radius:999px;margin:0;padding:10px 20px;font-size:15px;animation:.4s cos-fade-in-U9bUC}.cos-result-H8q2c strong{color:#b45309;font-size:17px}@keyframes cos-fade-in-U9bUC{0%{opacity:0;transform:translateY(8px)}to{opacity:1;transform:translateY(0)}}.cos-typewriter-7UhOL{box-sizing:border-box;justify-content:center;align-items:center;width:100%;min-height:200px;padding:24px;display:flex}.cos-terminal-NWNVN{background:#1e293b;border-radius:12px;width:min(560px,100%);padding:20px 24px;box-shadow:0 16px 48px #00000059}.cos-dots-oulNg{gap:8px;margin-bottom:16px;display:flex}.cos-dots-oulNg span{border-radius:50%;width:12px;height:12px}.cos-dots-oulNg span:first-child{background:#ef4444}.cos-dots-oulNg span:nth-child(2){background:#eab308}.cos-dots-oulNg span:nth-child(3){background:#22c55e}.cos-text-ICV5T{color:#e2e8f0;min-height:1.6em;margin:0;font-family:ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,monospace;font-size:20px;line-height:1.6}.cos-prompt-Y4hVD{color:#38bdf8;margin-right:8px}.cos-cursor-m8hGi{color:#38bdf8;margin-left:2px;animation:1s step-end infinite cos-blink-XykM7;display:inline-block}@keyframes cos-blink-XykM7{50%{opacity:0}}.cos-waveButton-Aa7G-{justify-content:center;align-items:center;min-height:200px;padding:40px;display:flex}.cos-btn-WJrEN{background:var(--wave-color,#38bdf8);color:#fff;cursor:pointer;border:none;border-radius:50px;padding:16px 48px;font-size:18px;font-weight:600;transition:transform .2s;position:relative;overflow:hidden;box-shadow:0 8px 24px #38bdf859}.cos-btn-WJrEN:hover{transform:scale(1.05)}.cos-btn-WJrEN:active{transform:scale(.97)}.cos-label-9BHOU{z-index:1;position:relative}.cos-wave-GycLU{background:#ffffff4d;border-radius:50%;width:0;height:0;animation:3s ease-out infinite cos-ripple-5ZFpr;position:absolute;top:50%;left:50%;transform:translate(-50%,-50%)}.cos-wave-GycLU:nth-child(2){animation-delay:1s}@keyframes cos-ripple-5ZFpr{0%{opacity:.6;width:0;height:0}to{opacity:0;width:300px;height:300px}}
|
package/dist/index.js
CHANGED
|
@@ -51,7 +51,10 @@ import './index.css';var u = {
|
|
|
51
51
|
}
|
|
52
52
|
})
|
|
53
53
|
});
|
|
54
|
-
}, f = {
|
|
54
|
+
}, f = (e) => {
|
|
55
|
+
let t = () => e(document.hidden);
|
|
56
|
+
return document.addEventListener("visibilitychange", t), () => document.removeEventListener("visibilitychange", t);
|
|
57
|
+
}, p = (e, t, n) => Math.min(n, Math.max(t, e)), m = {
|
|
55
58
|
chargeContainer: "cos-chargeContainer-4t9qo",
|
|
56
59
|
contrast: "cos-contrast-PNep9",
|
|
57
60
|
hueRotate: "cos-hueRotate-bMJ-k",
|
|
@@ -60,33 +63,45 @@ import './index.css';var u = {
|
|
|
60
63
|
circle: "cos-circle-m4vwX",
|
|
61
64
|
circleRotate: "cos-circleRotate-bgFw5",
|
|
62
65
|
button: "cos-button-myCst"
|
|
63
|
-
},
|
|
64
|
-
let { initQuantity: t = 0, value: r, onChange: i, autoCharge: s = !0, interval: u = 500, step: d = .01 } = e,
|
|
66
|
+
}, h = (e) => {
|
|
67
|
+
let { initQuantity: t = 0, value: r, onChange: i, autoCharge: s = !0, interval: u = 500, step: d = .01 } = e, f = a(null), h = r !== void 0, [g, _] = o(() => p(t, 0, 100)), v = p(h ? r : g, 0, 100), y = a(v), b = a(i);
|
|
65
68
|
n(() => {
|
|
66
|
-
|
|
67
|
-
}, [
|
|
69
|
+
b.current = i;
|
|
70
|
+
}, [i]), n(() => {
|
|
71
|
+
y.current = v;
|
|
72
|
+
}, [v]), n(() => {
|
|
73
|
+
let e = f.current;
|
|
74
|
+
if (!e) return;
|
|
75
|
+
let t = () => {
|
|
76
|
+
e.style.setProperty("--charge-h", `${e.clientHeight}px`);
|
|
77
|
+
};
|
|
78
|
+
t();
|
|
79
|
+
let n = new ResizeObserver(t);
|
|
80
|
+
return n.observe(e), () => n.disconnect();
|
|
81
|
+
}, []), n(() => {
|
|
68
82
|
if (!s) return;
|
|
69
83
|
let e = window.setInterval(() => {
|
|
70
|
-
|
|
71
|
-
|
|
84
|
+
if (y.current >= 100) return;
|
|
85
|
+
let e = Math.min(100, Number((y.current + d).toFixed(2)));
|
|
86
|
+
h ? b.current?.(e) : _(e);
|
|
72
87
|
}, u);
|
|
73
88
|
return () => clearInterval(e);
|
|
74
89
|
}, [
|
|
75
90
|
s,
|
|
76
91
|
u,
|
|
77
|
-
|
|
78
|
-
i,
|
|
92
|
+
h,
|
|
79
93
|
d
|
|
80
94
|
]);
|
|
81
|
-
let
|
|
95
|
+
let x = v.toFixed(2);
|
|
82
96
|
return /* @__PURE__ */ c("div", {
|
|
83
|
-
|
|
97
|
+
ref: f,
|
|
98
|
+
className: m.chargeContainer,
|
|
84
99
|
children: /* @__PURE__ */ l("div", {
|
|
85
|
-
className:
|
|
100
|
+
className: m.contrast,
|
|
86
101
|
children: [
|
|
87
102
|
/* @__PURE__ */ l("div", {
|
|
88
|
-
className:
|
|
89
|
-
children: [
|
|
103
|
+
className: m.text,
|
|
104
|
+
children: [x, "%"]
|
|
90
105
|
}),
|
|
91
106
|
/* @__PURE__ */ c("span", {}),
|
|
92
107
|
/* @__PURE__ */ c("span", {}),
|
|
@@ -102,16 +117,17 @@ import './index.css';var u = {
|
|
|
102
117
|
/* @__PURE__ */ c("span", {}),
|
|
103
118
|
/* @__PURE__ */ c("span", {}),
|
|
104
119
|
/* @__PURE__ */ c("span", {}),
|
|
105
|
-
/* @__PURE__ */ c("
|
|
106
|
-
/* @__PURE__ */ c("div", { className:
|
|
120
|
+
/* @__PURE__ */ c("span", {}),
|
|
121
|
+
/* @__PURE__ */ c("div", { className: m.circle }),
|
|
122
|
+
/* @__PURE__ */ c("div", { className: m.button })
|
|
107
123
|
]
|
|
108
124
|
})
|
|
109
125
|
});
|
|
110
|
-
},
|
|
126
|
+
}, g = {
|
|
111
127
|
confetti: "cos-confetti-MeNtU",
|
|
112
128
|
canvas: "cos-canvas-0T3Vs",
|
|
113
129
|
hint: "cos-hint-sGHEi"
|
|
114
|
-
},
|
|
130
|
+
}, _ = [
|
|
115
131
|
"#ff6b6b",
|
|
116
132
|
"#ffd93d",
|
|
117
133
|
"#6bcb77",
|
|
@@ -119,7 +135,7 @@ import './index.css';var u = {
|
|
|
119
135
|
"#a66cff",
|
|
120
136
|
"#ff85c0",
|
|
121
137
|
"#38bdf8"
|
|
122
|
-
],
|
|
138
|
+
], v = () => _[Math.floor(Math.random() * _.length)], y = (e, t, n) => {
|
|
123
139
|
let r = e / 2, i = t * .6;
|
|
124
140
|
return Array.from({ length: n }, () => {
|
|
125
141
|
let e = (Math.random() - .5) * Math.PI, t = Math.random() * 12 + 6;
|
|
@@ -130,67 +146,76 @@ import './index.css';var u = {
|
|
|
130
146
|
vy: Math.sin(e) * t - Math.random() * 8,
|
|
131
147
|
rotation: Math.random() * 360,
|
|
132
148
|
rotationSpeed: (Math.random() - .5) * 12,
|
|
133
|
-
color:
|
|
149
|
+
color: v(),
|
|
134
150
|
width: Math.random() * 8 + 4,
|
|
135
151
|
height: Math.random() * 6 + 3,
|
|
136
152
|
alpha: 1,
|
|
137
153
|
gravity: Math.random() * .15 + .12
|
|
138
154
|
};
|
|
139
155
|
});
|
|
140
|
-
},
|
|
141
|
-
let d = a(null),
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
156
|
+
}, b = e(({ width: e = 800, height: i = 400, auto: o = !0, particleCount: s = 120 }, u) => {
|
|
157
|
+
let d = a(null), p = a([]), m = a(0), h = a({
|
|
158
|
+
width: e,
|
|
159
|
+
height: i,
|
|
160
|
+
particleCount: s
|
|
161
|
+
});
|
|
162
|
+
h.current = {
|
|
163
|
+
width: e,
|
|
164
|
+
height: i,
|
|
165
|
+
particleCount: s
|
|
166
|
+
};
|
|
167
|
+
let _ = t(() => {
|
|
168
|
+
let { width: e, height: t, particleCount: n } = h.current;
|
|
169
|
+
p.current.push(...y(e, t, n));
|
|
170
|
+
}, []);
|
|
171
|
+
return r(u, () => ({ burst: _ }), [_]), n(() => {
|
|
172
|
+
o && _();
|
|
173
|
+
}, [o, _]), n(() => {
|
|
149
174
|
let t = d.current;
|
|
150
175
|
if (!t) return;
|
|
151
176
|
let n = window.devicePixelRatio || 1;
|
|
152
177
|
t.width = e * n, t.height = i * n;
|
|
153
178
|
let r = t.getContext("2d");
|
|
154
179
|
if (!r) return;
|
|
155
|
-
r.setTransform(n, 0, 0, n, 0, 0)
|
|
156
|
-
let a = () => {
|
|
157
|
-
|
|
180
|
+
r.setTransform(n, 0, 0, n, 0, 0);
|
|
181
|
+
let a = document.hidden, o = f((e) => {
|
|
182
|
+
a = e;
|
|
183
|
+
}), s = () => {
|
|
184
|
+
m.current = requestAnimationFrame(s), !a && (r.clearRect(0, 0, e, i), p.current = p.current.filter((e) => (e.x += e.vx, e.y += e.vy, e.vy += e.gravity, e.vx *= .99, e.rotation += e.rotationSpeed, e.alpha -= .008, e.alpha <= 0 || e.y > i + 20 ? !1 : (r.save(), r.translate(e.x, e.y), r.rotate(e.rotation * Math.PI / 180), r.globalAlpha = e.alpha, r.fillStyle = e.color, r.fillRect(-e.width / 2, -e.height / 2, e.width, e.height), r.restore(), !0))));
|
|
158
185
|
};
|
|
159
|
-
return
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
e
|
|
165
|
-
]), /* @__PURE__ */ l("div", {
|
|
166
|
-
className: m.confetti,
|
|
186
|
+
return s(), () => {
|
|
187
|
+
cancelAnimationFrame(m.current), o();
|
|
188
|
+
};
|
|
189
|
+
}, [i, e]), /* @__PURE__ */ l("div", {
|
|
190
|
+
className: g.confetti,
|
|
167
191
|
style: {
|
|
168
192
|
width: e,
|
|
169
193
|
height: i
|
|
170
194
|
},
|
|
171
195
|
children: [/* @__PURE__ */ c("canvas", {
|
|
172
196
|
ref: d,
|
|
173
|
-
className:
|
|
197
|
+
className: g.canvas,
|
|
174
198
|
style: {
|
|
175
199
|
width: e,
|
|
176
200
|
height: i
|
|
177
201
|
},
|
|
178
|
-
onClick:
|
|
202
|
+
onClick: _
|
|
179
203
|
}), /* @__PURE__ */ c("p", {
|
|
180
|
-
className:
|
|
204
|
+
className: g.hint,
|
|
181
205
|
children: "点击画布再次喷射"
|
|
182
206
|
})]
|
|
183
207
|
});
|
|
184
208
|
});
|
|
185
|
-
|
|
186
|
-
var
|
|
209
|
+
b.displayName = "Confetti";
|
|
210
|
+
var x = {
|
|
187
211
|
countdown: "cos-countdown-5ZKKP",
|
|
188
212
|
unit: "cos-unit-dth8N",
|
|
189
213
|
value: "cos-value-yVzcP",
|
|
190
214
|
label: "cos-label-pAMEs",
|
|
191
215
|
ended: "cos-ended-c0dsD",
|
|
192
|
-
pulse: "cos-pulse-krQd-"
|
|
193
|
-
|
|
216
|
+
pulse: "cos-pulse-krQd-",
|
|
217
|
+
invalid: "cos-invalid-d6t-L"
|
|
218
|
+
}, S = (e) => e instanceof Date ? e.getTime() : typeof e == "number" ? e : new Date(e).getTime(), C = (e) => {
|
|
194
219
|
let t = Math.max(0, e - Date.now()), n = Math.floor(t / 1e3);
|
|
195
220
|
return {
|
|
196
221
|
total: t,
|
|
@@ -199,7 +224,7 @@ var y = {
|
|
|
199
224
|
minutes: Math.floor(n % 3600 / 60),
|
|
200
225
|
seconds: n % 60
|
|
201
226
|
};
|
|
202
|
-
},
|
|
227
|
+
}, ee = [
|
|
203
228
|
{
|
|
204
229
|
key: "days",
|
|
205
230
|
label: "天"
|
|
@@ -216,43 +241,58 @@ var y = {
|
|
|
216
241
|
key: "seconds",
|
|
217
242
|
label: "秒"
|
|
218
243
|
}
|
|
219
|
-
],
|
|
220
|
-
let u = i(() =>
|
|
244
|
+
], w = ({ targetDate: e, onEnd: t, showLabels: r = !0, color: s = "#f472b6" }) => {
|
|
245
|
+
let u = i(() => S(e), [e]), d = !Number.isNaN(u), [, f] = o(0), p = a(!1), m = a(t), h = d ? C(u) : {
|
|
246
|
+
days: 0,
|
|
247
|
+
hours: 0,
|
|
248
|
+
minutes: 0,
|
|
249
|
+
seconds: 0,
|
|
250
|
+
total: 0
|
|
251
|
+
};
|
|
221
252
|
return n(() => {
|
|
222
|
-
|
|
223
|
-
|
|
253
|
+
m.current = t;
|
|
254
|
+
}, [t]), n(() => {
|
|
255
|
+
if (!d) return;
|
|
256
|
+
p.current = !1;
|
|
257
|
+
let e = window.setInterval(() => {
|
|
258
|
+
f((e) => e + 1), Date.now() >= u && !p.current && (p.current = !0, m.current?.(), clearInterval(e));
|
|
259
|
+
}, 1e3);
|
|
224
260
|
return () => clearInterval(e);
|
|
225
|
-
}, [u]),
|
|
226
|
-
|
|
227
|
-
}, [p.total, t]), /* @__PURE__ */ l("div", {
|
|
228
|
-
className: y.countdown,
|
|
261
|
+
}, [d, u]), d ? /* @__PURE__ */ l("div", {
|
|
262
|
+
className: x.countdown,
|
|
229
263
|
style: { "--countdown-color": s },
|
|
230
|
-
children: [
|
|
231
|
-
className:
|
|
264
|
+
children: [ee.map(({ key: e, label: t }) => /* @__PURE__ */ l("div", {
|
|
265
|
+
className: x.unit,
|
|
232
266
|
children: [/* @__PURE__ */ c("div", {
|
|
233
|
-
className:
|
|
234
|
-
children: String(
|
|
267
|
+
className: x.value,
|
|
268
|
+
children: String(h[e]).padStart(2, "0")
|
|
235
269
|
}), r && /* @__PURE__ */ c("span", {
|
|
236
|
-
className:
|
|
270
|
+
className: x.label,
|
|
237
271
|
children: t
|
|
238
272
|
})]
|
|
239
|
-
}, e)),
|
|
240
|
-
className:
|
|
273
|
+
}, e)), h.total <= 0 && /* @__PURE__ */ c("p", {
|
|
274
|
+
className: x.ended,
|
|
241
275
|
children: "时间到!"
|
|
242
276
|
})]
|
|
277
|
+
}) : /* @__PURE__ */ c("div", {
|
|
278
|
+
className: x.countdown,
|
|
279
|
+
children: /* @__PURE__ */ c("p", {
|
|
280
|
+
className: x.invalid,
|
|
281
|
+
children: "无效的目标时间"
|
|
282
|
+
})
|
|
243
283
|
});
|
|
244
|
-
},
|
|
284
|
+
}, T = {
|
|
245
285
|
fireworks: "cos-fireworks-fsSqL",
|
|
246
286
|
canvas: "cos-canvas-spL8G",
|
|
247
287
|
hint: "cos-hint-5XDRH"
|
|
248
|
-
},
|
|
288
|
+
}, E = [
|
|
249
289
|
"#ff6b6b",
|
|
250
290
|
"#ffd93d",
|
|
251
291
|
"#6bcb77",
|
|
252
292
|
"#4d96ff",
|
|
253
293
|
"#a66cff",
|
|
254
294
|
"#ff85c0"
|
|
255
|
-
],
|
|
295
|
+
], D = .12, O = 240, k = () => E[Math.floor(Math.random() * E.length)], A = (e, t, n) => {
|
|
256
296
|
let r = 60 + Math.floor(Math.random() * 30);
|
|
257
297
|
return Array.from({ length: r }, () => {
|
|
258
298
|
let r = Math.random() * Math.PI * 2, i = Math.random() * 4 + 2;
|
|
@@ -262,25 +302,25 @@ var y = {
|
|
|
262
302
|
vx: Math.cos(r) * i,
|
|
263
303
|
vy: Math.sin(r) * i,
|
|
264
304
|
alpha: 1,
|
|
265
|
-
color: Math.random() > .3 ? n :
|
|
305
|
+
color: Math.random() > .3 ? n : k(),
|
|
266
306
|
decay: Math.random() * .015 + .01
|
|
267
307
|
};
|
|
268
308
|
});
|
|
269
|
-
},
|
|
270
|
-
let u = a(null), d = a([]),
|
|
309
|
+
}, j = e(({ width: e = 800, height: i = 500, auto: o = !0 }, s) => {
|
|
310
|
+
let u = a(null), d = a([]), p = a(0), m = t((t) => {
|
|
271
311
|
let n = t ?? Math.random() * e * .6 + e * .2;
|
|
272
312
|
d.current.push({
|
|
273
313
|
x: n,
|
|
274
314
|
y: i,
|
|
275
315
|
vy: -(Math.random() * 4 + 6),
|
|
276
316
|
targetY: Math.random() * i * .35 + i * .15,
|
|
277
|
-
color:
|
|
317
|
+
color: k(),
|
|
278
318
|
exploded: !1,
|
|
279
319
|
particles: [],
|
|
280
320
|
age: 0
|
|
281
321
|
});
|
|
282
322
|
}, [i, e]);
|
|
283
|
-
return r(s, () => ({ launch:
|
|
323
|
+
return r(s, () => ({ launch: m }), [m]), n(() => {
|
|
284
324
|
let t = u.current;
|
|
285
325
|
if (!t) return;
|
|
286
326
|
let n = window.devicePixelRatio || 1;
|
|
@@ -288,49 +328,51 @@ var y = {
|
|
|
288
328
|
let r = t.getContext("2d");
|
|
289
329
|
if (!r) return;
|
|
290
330
|
r.setTransform(n, 0, 0, n, 0, 0);
|
|
291
|
-
let a = 0, s = () => {
|
|
292
|
-
|
|
331
|
+
let a = 0, s = document.hidden, c = f((e) => {
|
|
332
|
+
s = e;
|
|
333
|
+
}), l = () => {
|
|
334
|
+
p.current = requestAnimationFrame(l), !s && (r.fillStyle = "rgb(15 23 42 / 25%)", r.fillRect(0, 0, e, i), d.current = d.current.filter((e) => {
|
|
293
335
|
if (!e.exploded) {
|
|
294
|
-
e.age += 1, e.y += e.vy, e.vy +=
|
|
295
|
-
let t = e.vy >= 0, n = e.y <= e.targetY, i = e.y < 0, a = e.age >=
|
|
296
|
-
return (t || n || i || a) && (e.exploded = !0, e.particles =
|
|
336
|
+
e.age += 1, e.y += e.vy, e.vy += D, r.beginPath(), r.arc(e.x, e.y, 2.5, 0, Math.PI * 2), r.fillStyle = e.color, r.fill();
|
|
337
|
+
let t = e.vy >= 0, n = e.y <= e.targetY, i = e.y < 0, a = e.age >= O;
|
|
338
|
+
return (t || n || i || a) && (e.exploded = !0, e.particles = A(e.x, e.y, e.color)), !0;
|
|
297
339
|
}
|
|
298
340
|
return e.particles = e.particles.filter((e) => (e.x += e.vx, e.y += e.vy, e.vy += .06, e.alpha -= e.decay, e.alpha <= 0 ? !1 : (r.beginPath(), r.arc(e.x, e.y, 2, 0, Math.PI * 2), r.fillStyle = e.color, r.globalAlpha = e.alpha, r.fill(), r.globalAlpha = 1, !0))), e.particles.length > 0;
|
|
299
|
-
});
|
|
341
|
+
}));
|
|
300
342
|
};
|
|
301
|
-
return
|
|
302
|
-
cancelAnimationFrame(
|
|
343
|
+
return l(), o && (a = window.setInterval(() => m(), 1200)), () => {
|
|
344
|
+
cancelAnimationFrame(p.current), clearInterval(a), c();
|
|
303
345
|
};
|
|
304
346
|
}, [
|
|
305
347
|
o,
|
|
306
348
|
i,
|
|
307
|
-
|
|
349
|
+
m,
|
|
308
350
|
e
|
|
309
351
|
]), /* @__PURE__ */ l("div", {
|
|
310
|
-
className:
|
|
352
|
+
className: T.fireworks,
|
|
311
353
|
style: {
|
|
312
354
|
width: e,
|
|
313
355
|
height: i
|
|
314
356
|
},
|
|
315
357
|
children: [/* @__PURE__ */ c("canvas", {
|
|
316
358
|
ref: u,
|
|
317
|
-
className:
|
|
359
|
+
className: T.canvas,
|
|
318
360
|
style: {
|
|
319
361
|
width: e,
|
|
320
362
|
height: i
|
|
321
363
|
},
|
|
322
364
|
onClick: (e) => {
|
|
323
365
|
let t = e.currentTarget.getBoundingClientRect();
|
|
324
|
-
|
|
366
|
+
m(e.clientX - t.left);
|
|
325
367
|
}
|
|
326
368
|
}), /* @__PURE__ */ c("p", {
|
|
327
|
-
className:
|
|
369
|
+
className: T.hint,
|
|
328
370
|
children: "点击画布燃放烟花"
|
|
329
371
|
})]
|
|
330
372
|
});
|
|
331
373
|
});
|
|
332
|
-
|
|
333
|
-
var
|
|
374
|
+
j.displayName = "Fireworks";
|
|
375
|
+
var M = {
|
|
334
376
|
flipCounter: "cos-flipCounter-3LuI0",
|
|
335
377
|
digit: "cos-digit-yJRPy",
|
|
336
378
|
digitCard: "cos-digitCard-zZUzt",
|
|
@@ -342,7 +384,7 @@ var j = {
|
|
|
342
384
|
isFlipping: "cos-isFlipping-EVEdI",
|
|
343
385
|
"fold-top": "cos-fold-top-v-6XJ",
|
|
344
386
|
"unfold-bottom": "cos-unfold-bottom-e2gzU"
|
|
345
|
-
},
|
|
387
|
+
}, N = (e, t) => Math.max(0, Math.floor(e)).toString().padStart(t, "0").slice(-t), P = ({ digit: e, color: t, duration: r }) => {
|
|
346
388
|
let i = a(e), [u, d] = o(!1), [f, p] = o(e);
|
|
347
389
|
n(() => {
|
|
348
390
|
if (e === i.current) return;
|
|
@@ -352,51 +394,51 @@ var j = {
|
|
|
352
394
|
}, [e, r]);
|
|
353
395
|
let m = u ? f : e;
|
|
354
396
|
return /* @__PURE__ */ c("div", {
|
|
355
|
-
className:
|
|
397
|
+
className: M.digit,
|
|
356
398
|
style: {
|
|
357
399
|
"--flip-color": t,
|
|
358
400
|
"--flip-duration": `${r}ms`
|
|
359
401
|
},
|
|
360
402
|
children: /* @__PURE__ */ l("div", {
|
|
361
|
-
className: `${
|
|
403
|
+
className: `${M.digitCard} ${u ? M.isFlipping : ""}`,
|
|
362
404
|
children: [
|
|
363
405
|
/* @__PURE__ */ c("div", {
|
|
364
|
-
className:
|
|
406
|
+
className: M.staticTop,
|
|
365
407
|
children: /* @__PURE__ */ c("span", { children: m })
|
|
366
408
|
}),
|
|
367
409
|
/* @__PURE__ */ c("div", {
|
|
368
|
-
className:
|
|
410
|
+
className: M.staticBottom,
|
|
369
411
|
children: /* @__PURE__ */ c("span", { children: m })
|
|
370
412
|
}),
|
|
371
413
|
u && /* @__PURE__ */ l(s, { children: [/* @__PURE__ */ c("div", {
|
|
372
|
-
className: `${
|
|
414
|
+
className: `${M.flap} ${M.flapTop}`,
|
|
373
415
|
children: /* @__PURE__ */ c("span", { children: f })
|
|
374
416
|
}), /* @__PURE__ */ c("div", {
|
|
375
|
-
className: `${
|
|
417
|
+
className: `${M.flap} ${M.flapBottom}`,
|
|
376
418
|
children: /* @__PURE__ */ c("span", { children: e })
|
|
377
419
|
})] })
|
|
378
420
|
]
|
|
379
421
|
})
|
|
380
422
|
});
|
|
381
|
-
},
|
|
382
|
-
let i =
|
|
423
|
+
}, F = ({ value: e, digits: t = 4, color: n = "#38bdf8", duration: r = 600 }) => {
|
|
424
|
+
let i = N(e, t).split("");
|
|
383
425
|
return /* @__PURE__ */ c("div", {
|
|
384
|
-
className:
|
|
385
|
-
children: i.map((e, t) => /* @__PURE__ */ c(
|
|
426
|
+
className: M.flipCounter,
|
|
427
|
+
children: i.map((e, t) => /* @__PURE__ */ c(P, {
|
|
386
428
|
digit: e,
|
|
387
429
|
color: n,
|
|
388
430
|
duration: r
|
|
389
431
|
}, t))
|
|
390
432
|
});
|
|
391
|
-
},
|
|
433
|
+
}, I = {
|
|
392
434
|
glitchText: "cos-glitchText-dZ-sR",
|
|
393
435
|
text: "cos-text-JsPHN",
|
|
394
436
|
"glitch-1": "cos-glitch-1-s9pqH",
|
|
395
437
|
"glitch-2": "cos-glitch-2-GhFB-"
|
|
396
|
-
},
|
|
397
|
-
className:
|
|
438
|
+
}, te = ({ text: e = "GLITCH", color: t = "#f8fafc", glitchColor1: n = "#ff00de", glitchColor2: r = "#00f0ff", fontSize: i = 64 }) => /* @__PURE__ */ c("div", {
|
|
439
|
+
className: I.glitchText,
|
|
398
440
|
children: /* @__PURE__ */ c("h1", {
|
|
399
|
-
className:
|
|
441
|
+
className: I.text,
|
|
400
442
|
"data-text": e,
|
|
401
443
|
style: {
|
|
402
444
|
fontSize: i,
|
|
@@ -413,23 +455,27 @@ var j = {
|
|
|
413
455
|
title: "cos-title-sDfhs",
|
|
414
456
|
flicker: "cos-flicker-smHxl",
|
|
415
457
|
subtitle: "cos-subtitle-CWheW"
|
|
416
|
-
},
|
|
417
|
-
let
|
|
458
|
+
}, ne = "ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789@#$%^&*アイウエオカキクケコ", R = ({ width: e = 800, height: t = 500, density: r = .6, color: i = "#00ff41", showOverlay: o = !0, title: s = "MATRIX", subtitle: u = "数字雨效果" }) => {
|
|
459
|
+
let d = a(null);
|
|
418
460
|
return n(() => {
|
|
419
|
-
let n =
|
|
461
|
+
let n = d.current;
|
|
420
462
|
if (!n) return;
|
|
421
463
|
let a = window.devicePixelRatio || 1;
|
|
422
464
|
n.width = e * a, n.height = t * a;
|
|
423
|
-
let
|
|
424
|
-
if (!
|
|
425
|
-
|
|
426
|
-
let
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
465
|
+
let o = n.getContext("2d");
|
|
466
|
+
if (!o) return;
|
|
467
|
+
o.setTransform(a, 0, 0, a, 0, 0);
|
|
468
|
+
let s = Math.floor(e / 16 * r), c = Array.from({ length: s }, () => Math.random() * -50), l = 0, u = document.hidden, p = f((e) => {
|
|
469
|
+
u = e;
|
|
470
|
+
}), m = () => {
|
|
471
|
+
l = requestAnimationFrame(m), !u && (o.fillStyle = "rgb(0 0 0 / 8%)", o.fillRect(0, 0, e, t), o.font = "16px monospace", c.forEach((e, n) => {
|
|
472
|
+
let a = ne[Math.floor(Math.random() * 53)], s = n / r * 16;
|
|
473
|
+
o.fillStyle = i, o.fillText(a, s, e * 16), e * 16 > t && Math.random() > .975 && (c[n] = 0), c[n] += 1;
|
|
474
|
+
}));
|
|
475
|
+
};
|
|
476
|
+
return m(), () => {
|
|
477
|
+
cancelAnimationFrame(l), p();
|
|
431
478
|
};
|
|
432
|
-
return d(), () => cancelAnimationFrame(u);
|
|
433
479
|
}, [
|
|
434
480
|
i,
|
|
435
481
|
r,
|
|
@@ -442,27 +488,27 @@ var j = {
|
|
|
442
488
|
height: t
|
|
443
489
|
},
|
|
444
490
|
children: [/* @__PURE__ */ c("canvas", {
|
|
445
|
-
ref:
|
|
491
|
+
ref: d,
|
|
446
492
|
className: L.canvas,
|
|
447
493
|
style: {
|
|
448
494
|
width: e,
|
|
449
495
|
height: t
|
|
450
496
|
}
|
|
451
|
-
}), /* @__PURE__ */ l("div", {
|
|
497
|
+
}), o && /* @__PURE__ */ l("div", {
|
|
452
498
|
className: L.overlay,
|
|
453
499
|
children: [/* @__PURE__ */ c("h2", {
|
|
454
500
|
className: L.title,
|
|
455
|
-
children:
|
|
501
|
+
children: s
|
|
456
502
|
}), /* @__PURE__ */ c("p", {
|
|
457
503
|
className: L.subtitle,
|
|
458
|
-
children:
|
|
504
|
+
children: u
|
|
459
505
|
})]
|
|
460
506
|
})]
|
|
461
507
|
});
|
|
462
|
-
},
|
|
508
|
+
}, z = {
|
|
463
509
|
meteorRain: "cos-meteorRain-v8RNI",
|
|
464
510
|
canvas: "cos-canvas-hyFMr"
|
|
465
|
-
},
|
|
511
|
+
}, B = ({ width: e = 800, height: t = 500, meteorCount: r = 8 }) => {
|
|
466
512
|
let i = a(null), o = a([]), s = a(0);
|
|
467
513
|
return n(() => {
|
|
468
514
|
o.current = Array.from({ length: r }, () => ({
|
|
@@ -484,62 +530,66 @@ var j = {
|
|
|
484
530
|
let a = n.getContext("2d");
|
|
485
531
|
if (!a) return;
|
|
486
532
|
a.setTransform(r, 0, 0, r, 0, 0);
|
|
487
|
-
let c = () => {
|
|
488
|
-
|
|
533
|
+
let c = document.hidden, l = f((e) => {
|
|
534
|
+
c = e;
|
|
535
|
+
}), u = () => {
|
|
536
|
+
s.current = requestAnimationFrame(u), !c && (a.fillStyle = "rgb(15 23 42 / 15%)", a.fillRect(0, 0, e, t), o.current.forEach((n) => {
|
|
489
537
|
n.x += n.speed, n.y += n.speed * .6, (n.x > e + n.length || n.y > t + n.length) && (n.x = -n.length, n.y = Math.random() * t * .4, n.length = Math.random() * 60 + 40, n.speed = Math.random() * 6 + 4, n.opacity = Math.random() * .5 + .3);
|
|
490
|
-
let r =
|
|
491
|
-
|
|
492
|
-
});
|
|
538
|
+
let r = n.x - n.length, i = n.y - n.length * .6;
|
|
539
|
+
a.beginPath(), a.strokeStyle = `rgb(255 255 255 / ${n.opacity})`, a.lineWidth = 2, a.moveTo(n.x, n.y), a.lineTo(r, i), a.stroke(), a.beginPath(), a.fillStyle = `rgb(255 255 255 / ${Math.min(1, n.opacity + .2)})`, a.arc(n.x, n.y, 1.5, 0, Math.PI * 2), a.fill();
|
|
540
|
+
}));
|
|
541
|
+
};
|
|
542
|
+
return u(), () => {
|
|
543
|
+
cancelAnimationFrame(s.current), l();
|
|
493
544
|
};
|
|
494
|
-
return c(), () => cancelAnimationFrame(s.current);
|
|
495
545
|
}, [t, e]), /* @__PURE__ */ c("div", {
|
|
496
|
-
className:
|
|
546
|
+
className: z.meteorRain,
|
|
497
547
|
style: {
|
|
498
548
|
width: e,
|
|
499
549
|
height: t
|
|
500
550
|
},
|
|
501
551
|
children: /* @__PURE__ */ c("canvas", {
|
|
502
552
|
ref: i,
|
|
503
|
-
className:
|
|
553
|
+
className: z.canvas,
|
|
504
554
|
style: {
|
|
505
555
|
width: e,
|
|
506
556
|
height: t
|
|
507
557
|
}
|
|
508
558
|
})
|
|
509
559
|
});
|
|
510
|
-
},
|
|
560
|
+
}, V = {
|
|
511
561
|
neonText: "cos-neonText-JMP7i",
|
|
512
562
|
text: "cos-text-GTO-0",
|
|
513
563
|
flicker: "cos-flicker-nXceV",
|
|
514
564
|
"neon-flicker": "cos-neon-flicker-uDkmM",
|
|
515
565
|
reflection: "cos-reflection-aEYj6"
|
|
516
|
-
},
|
|
517
|
-
className:
|
|
566
|
+
}, H = ({ text: e = "NEON", color: t = "#ff00de", fontSize: n = 72, flicker: r = !0 }) => /* @__PURE__ */ l("div", {
|
|
567
|
+
className: V.neonText,
|
|
518
568
|
children: [/* @__PURE__ */ c("h1", {
|
|
519
|
-
className: `${
|
|
569
|
+
className: `${V.text} ${r ? V.flicker : ""}`,
|
|
520
570
|
style: {
|
|
521
571
|
fontSize: n,
|
|
522
572
|
"--neon-color": t
|
|
523
573
|
},
|
|
524
574
|
children: e
|
|
525
575
|
}), /* @__PURE__ */ c("p", {
|
|
526
|
-
className:
|
|
576
|
+
className: V.reflection,
|
|
527
577
|
style: {
|
|
528
578
|
fontSize: n * .35,
|
|
529
579
|
color: t
|
|
530
580
|
},
|
|
531
581
|
children: e
|
|
532
582
|
})]
|
|
533
|
-
}),
|
|
583
|
+
}), U = {
|
|
534
584
|
particleNetwork: "cos-particleNetwork-GSZq-",
|
|
535
585
|
canvas: "cos-canvas-E-BGP",
|
|
536
586
|
hint: "cos-hint-LEO5o"
|
|
537
|
-
},
|
|
538
|
-
let
|
|
587
|
+
}, W = ({ width: e = 800, height: r = 500, particleCount: i = 60, linkDistance: o = 120, repelRadius: s = 150, color: u = "#38bdf8" }) => {
|
|
588
|
+
let d = a(null), p = a([]), m = a({
|
|
539
589
|
x: -1e3,
|
|
540
590
|
y: -1e3
|
|
541
|
-
}),
|
|
542
|
-
|
|
591
|
+
}), h = t(() => {
|
|
592
|
+
p.current = Array.from({ length: i }, () => ({
|
|
543
593
|
x: Math.random() * e,
|
|
544
594
|
y: Math.random() * r,
|
|
545
595
|
vx: (Math.random() - .5) * 1.2,
|
|
@@ -551,94 +601,115 @@ var j = {
|
|
|
551
601
|
i,
|
|
552
602
|
e
|
|
553
603
|
]);
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
}, [
|
|
557
|
-
let t =
|
|
604
|
+
n(() => {
|
|
605
|
+
h();
|
|
606
|
+
}, [h]), n(() => {
|
|
607
|
+
let t = d.current;
|
|
558
608
|
if (!t) return;
|
|
559
609
|
let n = window.devicePixelRatio || 1;
|
|
560
610
|
t.width = e * n, t.height = r * n;
|
|
561
611
|
let i = t.getContext("2d");
|
|
562
612
|
if (!i) return;
|
|
563
613
|
i.setTransform(n, 0, 0, n, 0, 0);
|
|
564
|
-
let a = 0, c = () => {
|
|
614
|
+
let a = 0, c = document.hidden, l = f((e) => {
|
|
615
|
+
c = e;
|
|
616
|
+
}), h = () => {
|
|
617
|
+
if (c) {
|
|
618
|
+
a = requestAnimationFrame(h);
|
|
619
|
+
return;
|
|
620
|
+
}
|
|
565
621
|
i.fillStyle = "#0f172a", i.fillRect(0, 0, e, r);
|
|
566
|
-
let t =
|
|
622
|
+
let t = p.current, n = m.current, l = s * s;
|
|
567
623
|
t.forEach((t) => {
|
|
568
624
|
t.x += t.vx, t.y += t.vy, (t.x < 0 || t.x > e) && (t.vx *= -1), (t.y < 0 || t.y > r) && (t.vy *= -1);
|
|
569
|
-
let i = n.x - t.x, a = n.y - t.y;
|
|
570
|
-
|
|
625
|
+
let i = n.x - t.x, a = n.y - t.y, o = i * i + a * a;
|
|
626
|
+
if (o < l && o > 0) {
|
|
627
|
+
let e = Math.sqrt(o);
|
|
628
|
+
t.vx -= i / e * .15, t.vy -= a / e * .15;
|
|
629
|
+
}
|
|
571
630
|
});
|
|
572
631
|
for (let e = 0; e < t.length; e++) for (let n = e + 1; n < t.length; n++) {
|
|
573
|
-
let r = t[e].x - t[n].x, a = t[e].y - t[n].y,
|
|
574
|
-
|
|
632
|
+
let r = t[e].x - t[n].x, a = t[e].y - t[n].y, s = r * r + a * a;
|
|
633
|
+
if (s < o * o) {
|
|
634
|
+
let r = Math.sqrt(s);
|
|
635
|
+
i.beginPath(), i.moveTo(t[e].x, t[e].y), i.lineTo(t[n].x, t[n].y), i.strokeStyle = u, i.globalAlpha = 1 - r / o, i.lineWidth = .8, i.stroke(), i.globalAlpha = 1;
|
|
636
|
+
}
|
|
575
637
|
}
|
|
576
638
|
t.forEach((e) => {
|
|
577
|
-
i.beginPath(), i.arc(e.x, e.y, e.radius, 0, Math.PI * 2), i.fillStyle =
|
|
578
|
-
}), a = requestAnimationFrame(
|
|
639
|
+
i.beginPath(), i.arc(e.x, e.y, e.radius, 0, Math.PI * 2), i.fillStyle = u, i.fill();
|
|
640
|
+
}), a = requestAnimationFrame(h);
|
|
641
|
+
};
|
|
642
|
+
return h(), () => {
|
|
643
|
+
cancelAnimationFrame(a), l();
|
|
579
644
|
};
|
|
580
|
-
return c(), () => cancelAnimationFrame(a);
|
|
581
645
|
}, [
|
|
582
|
-
|
|
646
|
+
u,
|
|
583
647
|
r,
|
|
584
|
-
|
|
648
|
+
h,
|
|
585
649
|
o,
|
|
650
|
+
s,
|
|
586
651
|
e
|
|
587
|
-
])
|
|
588
|
-
|
|
652
|
+
]);
|
|
653
|
+
let g = (e, t, n) => {
|
|
654
|
+
m.current = {
|
|
655
|
+
x: e - n.left,
|
|
656
|
+
y: t - n.top
|
|
657
|
+
};
|
|
658
|
+
}, _ = (e) => {
|
|
659
|
+
g(e.clientX, e.clientY, e.currentTarget.getBoundingClientRect());
|
|
660
|
+
}, v = (e) => {
|
|
661
|
+
let t = e.touches[0];
|
|
662
|
+
t && g(t.clientX, t.clientY, e.currentTarget.getBoundingClientRect());
|
|
663
|
+
}, y = () => {
|
|
664
|
+
m.current = {
|
|
665
|
+
x: -1e3,
|
|
666
|
+
y: -1e3
|
|
667
|
+
};
|
|
668
|
+
};
|
|
669
|
+
return /* @__PURE__ */ l("div", {
|
|
670
|
+
className: U.particleNetwork,
|
|
589
671
|
style: {
|
|
590
672
|
width: e,
|
|
591
673
|
height: r
|
|
592
674
|
},
|
|
593
675
|
children: [/* @__PURE__ */ c("canvas", {
|
|
594
|
-
ref:
|
|
595
|
-
className:
|
|
676
|
+
ref: d,
|
|
677
|
+
className: U.canvas,
|
|
596
678
|
style: {
|
|
597
679
|
width: e,
|
|
598
680
|
height: r
|
|
599
681
|
},
|
|
600
|
-
onMouseMove:
|
|
601
|
-
|
|
602
|
-
|
|
603
|
-
|
|
604
|
-
y: e.clientY - t.top
|
|
605
|
-
};
|
|
606
|
-
},
|
|
607
|
-
onMouseLeave: () => {
|
|
608
|
-
f.current = {
|
|
609
|
-
x: -1e3,
|
|
610
|
-
y: -1e3
|
|
611
|
-
};
|
|
612
|
-
}
|
|
682
|
+
onMouseMove: _,
|
|
683
|
+
onMouseLeave: y,
|
|
684
|
+
onTouchMove: v,
|
|
685
|
+
onTouchEnd: y
|
|
613
686
|
}), /* @__PURE__ */ c("p", {
|
|
614
|
-
className:
|
|
615
|
-
children: "
|
|
687
|
+
className: U.hint,
|
|
688
|
+
children: "移动鼠标或手指与粒子互动"
|
|
616
689
|
})]
|
|
617
690
|
});
|
|
618
|
-
},
|
|
691
|
+
}, G = {
|
|
619
692
|
returnCityContainer: "cos-returnCityContainer-6XTxj",
|
|
620
693
|
star: "cos-star-a59Dx",
|
|
621
694
|
glassWrap: "cos-glassWrap-golMO",
|
|
622
695
|
rotate: "cos-rotate-7X9Jj",
|
|
623
696
|
glassItem: "cos-glassItem-OwlFI"
|
|
624
|
-
},
|
|
697
|
+
}, K = ({ starCount: e, glassCount: t = 8, glassRadius: r = 150 }) => {
|
|
625
698
|
let i = a(null), o = a(null);
|
|
626
699
|
return n(() => {
|
|
627
700
|
let n = i.current, a = o.current;
|
|
628
701
|
if (!n || !a) return;
|
|
629
|
-
let s = [], c = [], l = [], u = e ?? Math.floor(
|
|
630
|
-
for (let e = 0; e <
|
|
702
|
+
let s = [], c = [], l = [], { width: u, height: d } = n.getBoundingClientRect(), f = e ?? Math.max(20, Math.floor(u / 20));
|
|
703
|
+
for (let e = 0; e < f; e++) {
|
|
631
704
|
let e = window.setTimeout(() => {
|
|
632
705
|
let e = document.createElement("div");
|
|
633
|
-
e.className =
|
|
634
|
-
let t = document.body.clientWidth, r = document.body.clientHeight;
|
|
635
|
-
e.style.top = `${Math.random() * r}px`, e.style.left = `${Math.random() * t}px`, n.append(e), c.push(e);
|
|
706
|
+
e.className = G.star, e.style.top = `${Math.random() * d}px`, e.style.left = `${Math.random() * u}px`, n.append(e), c.push(e);
|
|
636
707
|
}, Math.random() * 2e3);
|
|
637
708
|
s.push(e);
|
|
638
709
|
}
|
|
639
710
|
for (let e = 0; e < t; e++) {
|
|
640
711
|
let n = document.createElement("div");
|
|
641
|
-
n.className =
|
|
712
|
+
n.className = G.glassItem, n.style.transform = `rotateY(${360 / t * e}deg) translateZ(${r}px)`, a.appendChild(n), l.push(n);
|
|
642
713
|
let i = window.setTimeout(() => {
|
|
643
714
|
n.style.top = "0px", n.style.opacity = "1";
|
|
644
715
|
}, e * 300);
|
|
@@ -653,13 +724,13 @@ var j = {
|
|
|
653
724
|
r
|
|
654
725
|
]), /* @__PURE__ */ c("div", {
|
|
655
726
|
ref: i,
|
|
656
|
-
className:
|
|
727
|
+
className: G.returnCityContainer,
|
|
657
728
|
children: /* @__PURE__ */ c("div", {
|
|
658
729
|
ref: o,
|
|
659
|
-
className:
|
|
730
|
+
className: G.glassWrap
|
|
660
731
|
})
|
|
661
732
|
});
|
|
662
|
-
},
|
|
733
|
+
}, q = {
|
|
663
734
|
turntable: "cos-turntable-dkc32",
|
|
664
735
|
wheelWrap: "cos-wheelWrap-n7lhc",
|
|
665
736
|
canvas: "cos-canvas-A1-4x",
|
|
@@ -667,7 +738,7 @@ var j = {
|
|
|
667
738
|
spinBtn: "cos-spinBtn-l9JIC",
|
|
668
739
|
result: "cos-result-H8q2c",
|
|
669
740
|
"fade-in": "cos-fade-in-U9bUC"
|
|
670
|
-
},
|
|
741
|
+
}, J = [
|
|
671
742
|
"#FF6B6B",
|
|
672
743
|
"#4ECDC4",
|
|
673
744
|
"#FFE66D",
|
|
@@ -676,15 +747,15 @@ var j = {
|
|
|
676
747
|
"#F472B6",
|
|
677
748
|
"#34D399",
|
|
678
749
|
"#FB923C"
|
|
679
|
-
],
|
|
750
|
+
], Y = [
|
|
680
751
|
{ label: "一等奖" },
|
|
681
752
|
{ label: "二等奖" },
|
|
682
753
|
{ label: "三等奖" },
|
|
683
754
|
{ label: "谢谢参与" },
|
|
684
755
|
{ label: "优惠券" },
|
|
685
756
|
{ label: "再来一次" }
|
|
686
|
-
],
|
|
687
|
-
let f = a(null), p = a(0), m = a(0), h = a(1), [g, _] = o(!1), [v, y] = o(null), b = r + 48, x = (e, t) => t.color ??
|
|
757
|
+
], X = (e) => 1 - (1 - e) ** 3, re = ({ prizes: e = Y, size: r = 360, spinDuration: i = 4e3, spinRounds: s = 5, buttonText: u = "开始抽奖", onSpinEnd: d }) => {
|
|
758
|
+
let f = a(null), p = a(0), m = a(0), h = a(1), [g, _] = o(!1), [v, y] = o(null), b = r + 48, x = (e, t) => t.color ?? J[e % J.length], S = t((t) => {
|
|
688
759
|
let n = f.current;
|
|
689
760
|
if (!n) return;
|
|
690
761
|
let i = n.getContext("2d");
|
|
@@ -719,22 +790,22 @@ var j = {
|
|
|
719
790
|
return Math.floor((360 - r + n / 2) % 360 / n) % e.length;
|
|
720
791
|
};
|
|
721
792
|
return /* @__PURE__ */ l("div", {
|
|
722
|
-
className:
|
|
793
|
+
className: q.turntable,
|
|
723
794
|
style: {
|
|
724
795
|
width: b,
|
|
725
796
|
height: b + 80
|
|
726
797
|
},
|
|
727
798
|
children: [/* @__PURE__ */ l("div", {
|
|
728
|
-
className:
|
|
799
|
+
className: q.wheelWrap,
|
|
729
800
|
style: {
|
|
730
801
|
width: b,
|
|
731
802
|
height: b
|
|
732
803
|
},
|
|
733
804
|
children: [
|
|
734
|
-
/* @__PURE__ */ c("div", { className:
|
|
805
|
+
/* @__PURE__ */ c("div", { className: q.pointer }),
|
|
735
806
|
/* @__PURE__ */ c("canvas", {
|
|
736
807
|
ref: f,
|
|
737
|
-
className:
|
|
808
|
+
className: q.canvas,
|
|
738
809
|
style: {
|
|
739
810
|
width: b,
|
|
740
811
|
height: b
|
|
@@ -742,12 +813,12 @@ var j = {
|
|
|
742
813
|
}),
|
|
743
814
|
/* @__PURE__ */ c("button", {
|
|
744
815
|
type: "button",
|
|
745
|
-
className:
|
|
816
|
+
className: q.spinBtn,
|
|
746
817
|
onClick: () => {
|
|
747
818
|
if (g || e.length === 0) return;
|
|
748
819
|
_(!0), y(null);
|
|
749
820
|
let t = Math.PI * 2 / e.length, n = Math.floor(Math.random() * e.length) * t + t / 2, r = p.current, a = r + s * Math.PI * 2 + (Math.PI * 2 - n) - r % (Math.PI * 2), o = r, c = performance.now(), l = (t) => {
|
|
750
|
-
let n = t - c, r = Math.min(n / i, 1), s =
|
|
821
|
+
let n = t - c, r = Math.min(n / i, 1), s = X(r), u = o + (a - o) * s;
|
|
751
822
|
if (p.current = u, S(u), r < 1) m.current = requestAnimationFrame(l);
|
|
752
823
|
else {
|
|
753
824
|
let t = C(u), n = e[t];
|
|
@@ -761,11 +832,11 @@ var j = {
|
|
|
761
832
|
})
|
|
762
833
|
]
|
|
763
834
|
}), v && !g && /* @__PURE__ */ l("p", {
|
|
764
|
-
className:
|
|
835
|
+
className: q.result,
|
|
765
836
|
children: ["恭喜获得:", /* @__PURE__ */ c("strong", { children: v.label })]
|
|
766
837
|
})]
|
|
767
838
|
});
|
|
768
|
-
},
|
|
839
|
+
}, Z = {
|
|
769
840
|
typewriter: "cos-typewriter-7UhOL",
|
|
770
841
|
terminal: "cos-terminal-NWNVN",
|
|
771
842
|
dots: "cos-dots-oulNg",
|
|
@@ -773,11 +844,11 @@ var j = {
|
|
|
773
844
|
prompt: "cos-prompt-Y4hVD",
|
|
774
845
|
cursor: "cos-cursor-m8hGi",
|
|
775
846
|
blink: "cos-blink-XykM7"
|
|
776
|
-
},
|
|
847
|
+
}, Q = [
|
|
777
848
|
"Hello, cos-design!",
|
|
778
849
|
"欢迎来到组件库 ✨",
|
|
779
850
|
"Build something fun 🚀"
|
|
780
|
-
],
|
|
851
|
+
], ie = ({ texts: e, speed: t, deleteSpeed: r, pause: i }) => {
|
|
781
852
|
let [a, s] = o(""), [u, d] = o(0), [f, p] = o(!1);
|
|
782
853
|
return n(() => {
|
|
783
854
|
let n = e[u % e.length], o;
|
|
@@ -799,45 +870,56 @@ var j = {
|
|
|
799
870
|
r,
|
|
800
871
|
i
|
|
801
872
|
]), /* @__PURE__ */ c("div", {
|
|
802
|
-
className:
|
|
873
|
+
className: Z.typewriter,
|
|
803
874
|
children: /* @__PURE__ */ l("div", {
|
|
804
|
-
className:
|
|
875
|
+
className: Z.terminal,
|
|
805
876
|
children: [/* @__PURE__ */ l("div", {
|
|
806
|
-
className:
|
|
877
|
+
className: Z.dots,
|
|
807
878
|
children: [
|
|
808
879
|
/* @__PURE__ */ c("span", {}),
|
|
809
880
|
/* @__PURE__ */ c("span", {}),
|
|
810
881
|
/* @__PURE__ */ c("span", {})
|
|
811
882
|
]
|
|
812
883
|
}), /* @__PURE__ */ l("p", {
|
|
813
|
-
className:
|
|
884
|
+
className: Z.text,
|
|
814
885
|
children: [
|
|
815
886
|
/* @__PURE__ */ c("span", {
|
|
816
|
-
className:
|
|
887
|
+
className: Z.prompt,
|
|
817
888
|
children: ">"
|
|
818
889
|
}),
|
|
819
890
|
a,
|
|
820
891
|
/* @__PURE__ */ c("span", {
|
|
821
|
-
className:
|
|
892
|
+
className: Z.cursor,
|
|
822
893
|
children: "|"
|
|
823
894
|
})
|
|
824
895
|
]
|
|
825
896
|
})]
|
|
826
897
|
})
|
|
827
898
|
});
|
|
899
|
+
}, ae = ({ texts: e = Q, speed: t = 100, deleteSpeed: n = 50, pause: r = 2e3 }) => {
|
|
900
|
+
let i = e.length > 0 ? e : Q;
|
|
901
|
+
return /* @__PURE__ */ c(ie, {
|
|
902
|
+
texts: i,
|
|
903
|
+
speed: t,
|
|
904
|
+
deleteSpeed: n,
|
|
905
|
+
pause: r
|
|
906
|
+
}, i.join("\0"));
|
|
828
907
|
}, $ = {
|
|
829
908
|
waveButton: "cos-waveButton-Aa7G-",
|
|
830
909
|
btn: "cos-btn-WJrEN",
|
|
831
910
|
label: "cos-label-9BHOU",
|
|
832
911
|
wave: "cos-wave-GycLU",
|
|
833
912
|
ripple: "cos-ripple-5ZFpr"
|
|
834
|
-
},
|
|
913
|
+
}, oe = ({ text: e = "点我试试", color: t = "#38bdf8", className: n, style: r, ...i }) => /* @__PURE__ */ c("div", {
|
|
835
914
|
className: $.waveButton,
|
|
836
915
|
children: /* @__PURE__ */ l("button", {
|
|
837
916
|
type: "button",
|
|
838
|
-
className: $.btn
|
|
839
|
-
style: {
|
|
840
|
-
|
|
917
|
+
className: `${$.btn} ${n ?? ""}`,
|
|
918
|
+
style: {
|
|
919
|
+
"--wave-color": t,
|
|
920
|
+
...r
|
|
921
|
+
},
|
|
922
|
+
...i,
|
|
841
923
|
children: [
|
|
842
924
|
/* @__PURE__ */ c("span", { className: $.wave }),
|
|
843
925
|
/* @__PURE__ */ c("span", { className: $.wave }),
|
|
@@ -849,4 +931,4 @@ var j = {
|
|
|
849
931
|
})
|
|
850
932
|
});
|
|
851
933
|
//#endregion
|
|
852
|
-
export { d as CanvasClock,
|
|
934
|
+
export { d as CanvasClock, h as Charge, b as Confetti, w as Countdown, j as Fireworks, F as FlipCounter, te as GlitchText, R as MatrixRain, B as MeteorRain, H as NeonText, W as ParticleNetwork, K as ReturnCity, re as Turntable, ae as Typewriter, oe as WaveButton };
|