@jacshuo/onyx 1.4.0 → 2.0.0

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.
Files changed (81) hide show
  1. package/dist/Chart/BarChart.cjs +1 -0
  2. package/dist/Chart/BarChart.css +1 -0
  3. package/dist/Chart/BarChart.d.cts +2 -0
  4. package/dist/Chart/BarChart.d.ts +2 -0
  5. package/dist/Chart/BarChart.js +1 -0
  6. package/dist/Chart/LineChart.cjs +1 -0
  7. package/dist/Chart/LineChart.css +1 -0
  8. package/dist/Chart/LineChart.d.cts +2 -0
  9. package/dist/Chart/LineChart.d.ts +2 -0
  10. package/dist/Chart/LineChart.js +1 -0
  11. package/dist/Chart/PieChart.cjs +1 -0
  12. package/dist/Chart/PieChart.css +1 -0
  13. package/dist/Chart/PieChart.d.cts +2 -0
  14. package/dist/Chart/PieChart.d.ts +2 -0
  15. package/dist/Chart/PieChart.js +1 -0
  16. package/dist/Chart/ScatterChart.cjs +1 -0
  17. package/dist/Chart/ScatterChart.css +1 -0
  18. package/dist/Chart/ScatterChart.d.cts +2 -0
  19. package/dist/Chart/ScatterChart.d.ts +2 -0
  20. package/dist/Chart/ScatterChart.js +1 -0
  21. package/dist/Chart/index.cjs +1 -0
  22. package/dist/Chart/index.css +1 -0
  23. package/dist/Chart/index.d.cts +12 -0
  24. package/dist/Chart/index.d.ts +12 -0
  25. package/dist/Chart/index.js +1 -0
  26. package/dist/DataDisplay/index.d.cts +1 -1
  27. package/dist/DataDisplay/index.d.ts +1 -1
  28. package/dist/Disclosure/index.d.cts +1 -1
  29. package/dist/Disclosure/index.d.ts +1 -1
  30. package/dist/Extras/CinePlayer.cjs +1 -1
  31. package/dist/Extras/CinePlayer.js +1 -1
  32. package/dist/Extras/FileExplorer.cjs +9 -2
  33. package/dist/Extras/FileExplorer.js +9 -2
  34. package/dist/Extras/MiniPlayer.cjs +2 -2
  35. package/dist/Extras/MiniPlayer.js +2 -2
  36. package/dist/Extras/TypewriterText.cjs +1 -0
  37. package/dist/Extras/TypewriterText.css +1 -0
  38. package/dist/Extras/TypewriterText.d.cts +2 -0
  39. package/dist/Extras/TypewriterText.d.ts +2 -0
  40. package/dist/Extras/TypewriterText.js +1 -0
  41. package/dist/Extras/index.cjs +11 -4
  42. package/dist/Extras/index.css +1 -0
  43. package/dist/Extras/index.d.cts +3 -1
  44. package/dist/Extras/index.d.ts +3 -1
  45. package/dist/Extras/index.js +11 -4
  46. package/dist/Feedback/index.d.cts +1 -1
  47. package/dist/Feedback/index.d.ts +1 -1
  48. package/dist/Forms/Form.cjs +1 -1
  49. package/dist/Forms/Form.js +1 -1
  50. package/dist/Forms/index.cjs +1 -1
  51. package/dist/Forms/index.d.cts +1 -1
  52. package/dist/Forms/index.d.ts +1 -1
  53. package/dist/Forms/index.js +1 -1
  54. package/dist/Layout/index.d.cts +1 -1
  55. package/dist/Layout/index.d.ts +1 -1
  56. package/dist/Navigation/index.d.cts +1 -1
  57. package/dist/Navigation/index.d.ts +1 -1
  58. package/dist/Overlay/index.d.cts +1 -1
  59. package/dist/Overlay/index.d.ts +1 -1
  60. package/dist/Primitives/index.d.cts +1 -1
  61. package/dist/Primitives/index.d.ts +1 -1
  62. package/dist/_tsup-dts-rollup.d.cts +481 -11
  63. package/dist/_tsup-dts-rollup.d.ts +481 -11
  64. package/dist/index.cjs +12 -5
  65. package/dist/index.css +1 -0
  66. package/dist/index.d.cts +20 -0
  67. package/dist/index.d.ts +20 -0
  68. package/dist/index.js +12 -5
  69. package/dist/styles/Chart/BarChart.css +44 -0
  70. package/dist/styles/Chart/LineChart.css +72 -0
  71. package/dist/styles/Chart/PieChart.css +56 -0
  72. package/dist/styles/Chart/ScatterChart.css +45 -0
  73. package/dist/styles/Extras/TypewriterText.css +55 -0
  74. package/dist/styles/base.css +149 -18
  75. package/dist/styles/tokens/core.css +10 -0
  76. package/dist/styles.css +353 -18
  77. package/dist/theme.cjs +1 -1
  78. package/dist/theme.d.cts +3 -0
  79. package/dist/theme.d.ts +3 -0
  80. package/dist/theme.js +1 -1
  81. package/package.json +1 -1
@@ -1,6 +1,6 @@
1
- 'use strict';var react=require('react'),clsx=require('clsx'),tailwindMerge=require('tailwind-merge'),lucideReact=require('lucide-react'),jsxRuntime=require('react/jsx-runtime');function n(...o){return tailwindMerge.twMerge(clsx.clsx(o))}var V="data:image/svg+xml,"+encodeURIComponent(`<svg xmlns="http://www.w3.org/2000/svg" width="200" height="200" viewBox="0 0 200 200">
1
+ 'use strict';var react=require('react'),clsx=require('clsx'),tailwindMerge=require('tailwind-merge'),lucideReact=require('lucide-react'),jsxRuntime=require('react/jsx-runtime');function o(...r){return tailwindMerge.twMerge(clsx.clsx(r))}var B="data:image/svg+xml,"+encodeURIComponent(`<svg xmlns="http://www.w3.org/2000/svg" width="200" height="200" viewBox="0 0 200 200">
2
2
  <rect width="200" height="200" fill="#1e1b2e"/>
3
3
  <circle cx="100" cy="100" r="60" fill="none" stroke="#6366f1" stroke-width="1.5" opacity="0.3"/>
4
4
  <circle cx="100" cy="100" r="20" fill="none" stroke="#6366f1" stroke-width="1" opacity="0.4"/>
5
5
  <text x="100" y="108" text-anchor="middle" font-family="monospace" font-size="18" fill="#6366f1" opacity="0.6">\u266A</text>
6
- </svg>`);function ne(o){if(!isFinite(o)||o<0)return "0:00";let R=Math.floor(o/60),p=Math.floor(o%60);return `${R}:${p.toString().padStart(2,"0")}`}function Ae(o){return o.startsWith("bottom")?"bottom":o.startsWith("top")?"top":"right"}var ze={"bottom-right":"bottom-4 right-4","bottom-left":"bottom-4 left-4","top-right":"top-4 right-4","top-left":"top-4 left-4"},Ve={"bottom-right":"bottom-4 right-0","bottom-left":"bottom-4 left-0","top-right":"top-4 right-0","top-left":"top-4 left-0"},We={"bottom-right":"bottom-8 right-0 w-1.5 h-16 rounded-l-full","bottom-left":"bottom-8 left-0 w-1.5 h-16 rounded-r-full","top-right":"top-8 right-0 w-1.5 h-16 rounded-l-full","top-left":"top-8 left-0 w-1.5 h-16 rounded-r-full"};function et({playlist:o,initialTrack:R=0,position:p="bottom-right",entrance:re,theme:W,docked:O=false,visible:_,onVisibleChange:y,onTrackChange:B,onLike:U,autoPlay:X=true,shuffle:ae=false,loop:ie=false,accent:F="#8b5cf6",className:se}){let [a,le]=react.useState(R),[d,D]=react.useState(false),[K,$]=react.useState(0),[k,ce]=react.useState(0),[M,ue]=react.useState(.8),[b,q]=react.useState(false),[P,de]=react.useState(new Set),[me,fe]=react.useState(false),[he,j]=react.useState(_??!O),[C,H]=react.useState(false),[I,A]=react.useState(false),[g,pe]=react.useState(ae),[z,ve]=react.useState(ie),G=react.useRef(false),m=react.useRef(null),be=react.useRef(null),x=react.useRef(void 0),S=_??he,J=re??Ae(p),s=o[a],f=O,ge=W==="dark"?"dark":W==="light"?"light":"",xe="bg-(--mp-bg)",E="text-(--mp-text)",l="text-(--mp-text-muted)",T="text-(--accent)",Q="border-(--mp-border)";react.useEffect(()=>{let e=m.current;e&&(e.src=s.src,e.load(),d&&e.play().catch(()=>{}));},[a,s.src]),react.useEffect(()=>{if(!X||G.current)return;let e=m.current;if(!e)return;let r=()=>{G.current=true,D(true),e.play().catch(()=>{});};return e.addEventListener("canplaythrough",r,{once:true}),()=>e.removeEventListener("canplaythrough",r)},[X]),react.useEffect(()=>{let e=m.current;e&&(d?e.play().catch(()=>{}):e.pause());},[d]),react.useEffect(()=>{let e=m.current;e&&(e.volume=b?0:M);},[M,b]),react.useEffect(()=>{let e=m.current;if(!e)return;let r=()=>$(e.currentTime),u=()=>ce(e.duration),h=()=>{z?(e.currentTime=0,e.play().catch(()=>{})):Y();};return e.addEventListener("timeupdate",r),e.addEventListener("loadedmetadata",u),e.addEventListener("ended",h),()=>{e.removeEventListener("timeupdate",r),e.removeEventListener("loadedmetadata",u),e.removeEventListener("ended",h);}},[a,o.length]);let v=react.useCallback(e=>{let r=(e%o.length+o.length)%o.length;le(r),$(0),B?.(r,o[r]),S||(j(true),y?.(true));},[o,S,B,y]),Y=react.useCallback(()=>{if(g){let e;do e=Math.floor(Math.random()*o.length);while(e===a&&o.length>1);v(e);}else v(a+1);},[v,a,g,o.length]),we=react.useCallback(()=>{if(g){let e;do e=Math.floor(Math.random()*o.length);while(e===a&&o.length>1);v(e);}else v(a-1);},[v,a,g,o.length]),Ne=react.useCallback(()=>{let e=P.has(a);de(r=>{let u=new Set(r);return e?u.delete(a):u.add(a),u}),U?.(a,s,!e);},[a,P,U,s]),ye=react.useCallback(e=>{let r=e.currentTarget.getBoundingClientRect(),h=Math.max(0,Math.min(1,(e.clientX-r.left)/r.width))*k;m.current&&(m.current.currentTime=h),$(h);},[k]),Z=react.useCallback(()=>{H(true);let e=f?200:400;x.current=setTimeout(()=>{H(false),j(false),y?.(false);},e);},[f,y]);react.useEffect(()=>()=>{x.current&&clearTimeout(x.current);},[]);let ke=I?"fade-in 0.2s ease-out both":`mp-enter-${J} 0.45s cubic-bezier(0.16, 1, 0.3, 1) both`,Pe=I?"fade-in 0.2s ease-in reverse both":`mp-exit-${J} 0.4s cubic-bezier(0.7, 0, 0.84, 0) both`,ee=k>0?K/k*100:0;return f&&!S&&!C?jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("audio",{ref:m,preload:"metadata"}),jsxRuntime.jsxs("div",{className:n("fixed z-100 cursor-pointer transition-all duration-300",We[p]),style:{"--accent":F},onMouseEnter:()=>{A(true),j(true),y?.(true);},children:[jsxRuntime.jsx("div",{className:n("h-full w-full rounded-full",d?"bg-(--accent)":"bg-(--mp-dock-strip)"),style:d?{animation:"mp-progress-glow 2s ease-in-out infinite",boxShadow:"0 0 12px color-mix(in srgb, var(--accent) 50%, transparent)"}:void 0}),d&&jsxRuntime.jsx("div",{className:"absolute inset-0 rounded-full bg-(--accent)/30",style:{animation:"mp-pulse-ring 2s ease-out infinite"}})]})]}):!S&&!C?jsxRuntime.jsx("audio",{ref:m,preload:"metadata"}):jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("audio",{ref:m,preload:"metadata"}),jsxRuntime.jsx("div",{className:n("fixed z-100",f?Ve[p]:ze[p],ge),style:{"--accent":F,...C?{animation:Pe}:{animation:ke}},onMouseEnter:()=>{f&&(x.current&&(clearTimeout(x.current),x.current=void 0),C&&H(false),A(true));},onMouseLeave:()=>{f&&(A(false),Z());},children:jsxRuntime.jsxs("div",{className:n("w-[320px] overflow-hidden rounded-2xl border shadow-2xl backdrop-blur-xl",xe,Q,f&&"rounded-none",p.endsWith("right")&&f&&"rounded-l-2xl",p.endsWith("left")&&f&&"rounded-r-2xl",se),children:[jsxRuntime.jsxs("div",{className:"relative",children:[jsxRuntime.jsx("div",{className:"absolute inset-0 overflow-hidden",children:jsxRuntime.jsx("img",{src:s.cover||V,alt:"",className:"h-full w-full scale-110 object-cover opacity-30 blur-2xl",draggable:false})}),jsxRuntime.jsxs("div",{className:"relative flex items-center gap-3.5 p-4 pb-3",children:[jsxRuntime.jsxs("div",{className:"relative h-14 w-14 shrink-0",children:[jsxRuntime.jsxs("div",{className:"h-14 w-14 overflow-hidden rounded-full border-2 border-white/10 shadow-lg",style:d?{animation:"mp-vinyl-spin 4s linear infinite"}:void 0,children:[jsxRuntime.jsx("img",{src:s.cover||V,alt:s.album??s.title,className:"h-full w-full object-cover",draggable:false}),jsxRuntime.jsx("div",{className:"absolute inset-0 flex items-center justify-center",children:jsxRuntime.jsx("div",{className:"h-3 w-3 rounded-full bg-black/60 ring-1 ring-white/10"})})]}),d&&jsxRuntime.jsx("div",{className:"absolute inset-0 rounded-full bg-(--accent)/20",style:{animation:"mp-pulse-ring 2.5s ease-out infinite"}})]}),jsxRuntime.jsxs("div",{className:"min-w-0 flex-1",children:[jsxRuntime.jsx("div",{className:n("truncate text-sm font-semibold",E),children:s.title}),s.artist&&jsxRuntime.jsx("div",{className:n("truncate text-xs",l),children:s.artist}),s.album&&jsxRuntime.jsx("div",{className:n("mt-0.5 truncate text-[10px] tracking-wide",l,"opacity-60"),children:s.album})]}),jsxRuntime.jsxs("div",{className:"flex shrink-0 items-center gap-0.5",children:[jsxRuntime.jsx("button",{className:n("rounded-full p-1.5 transition-all duration-200",P.has(a)?"text-rose-500 hover:text-rose-400":n(l,"hover:text-rose-500")),onClick:Ne,title:"Like",children:jsxRuntime.jsx(lucideReact.Heart,{className:"h-4 w-4",fill:P.has(a)?"currentColor":"none"})}),jsxRuntime.jsx("button",{className:n("rounded-full p-1.5 transition-colors",l,"hover:"+E.split(" ")[0]),onClick:()=>fe(e=>!e),title:"Playlist",children:jsxRuntime.jsx(lucideReact.ListMusic,{className:"h-4 w-4"})}),!f&&jsxRuntime.jsx("button",{className:n("rounded-full p-1.5 transition-colors",l,"hover:"+E.split(" ")[0]),onClick:Z,title:"Dismiss",children:jsxRuntime.jsx(lucideReact.X,{className:"h-3.5 w-3.5"})})]})]})]}),jsxRuntime.jsxs("div",{className:"px-4",children:[jsxRuntime.jsxs("div",{ref:be,className:"group relative h-1.5 cursor-pointer rounded-full bg-(--mp-surface)",onClick:ye,children:[jsxRuntime.jsx("div",{className:"h-full rounded-full bg-(--accent) transition-[width] duration-150",style:{width:`${ee}%`}}),jsxRuntime.jsx("div",{className:"absolute top-1/2 h-3 w-3 -translate-y-1/2 rounded-full bg-(--accent) opacity-0 shadow-md transition-opacity group-hover:opacity-100",style:{left:`calc(${ee}% - 6px)`}})]}),jsxRuntime.jsxs("div",{className:n("mt-1 flex justify-between text-[10px] font-mono",l),children:[jsxRuntime.jsx("span",{children:ne(K)}),jsxRuntime.jsx("span",{children:ne(k)})]})]}),jsxRuntime.jsxs("div",{className:"flex items-center justify-center gap-2 px-4 pb-3 pt-1",children:[jsxRuntime.jsx("button",{className:n("rounded-full p-1.5 transition-colors",g?T:l,"hover:text-(--mp-text)"),onClick:()=>pe(e=>!e),title:g?"Shuffle On":"Shuffle Off",children:jsxRuntime.jsx(lucideReact.Shuffle,{className:"h-3.5 w-3.5"})}),jsxRuntime.jsx("button",{className:n("rounded-full p-1.5 transition-colors",z?T:l,"hover:text-(--mp-text)"),onClick:()=>ve(e=>!e),title:z?"Loop On":"Loop Off",children:jsxRuntime.jsx(lucideReact.Repeat1,{className:"h-3.5 w-3.5"})}),jsxRuntime.jsx("button",{className:n("rounded-full p-2 transition-colors",l,"hover:text-(--mp-text)"),onClick:we,title:"Previous",children:jsxRuntime.jsx(lucideReact.SkipBack,{className:"h-4 w-4",fill:"currentColor"})}),jsxRuntime.jsx("button",{className:n("flex h-10 w-10 items-center justify-center rounded-full transition-all duration-200","bg-(--accent) text-white shadow-lg active:scale-95"),style:{boxShadow:"0 6px 20px color-mix(in srgb, var(--accent) 35%, transparent)"},onClick:()=>D(e=>!e),title:d?"Pause":"Play",children:d?jsxRuntime.jsx(lucideReact.Pause,{className:"h-4.5 w-4.5",fill:"currentColor"}):jsxRuntime.jsx(lucideReact.Play,{className:"h-4.5 w-4.5 translate-x-px",fill:"currentColor"})}),jsxRuntime.jsx("button",{className:n("rounded-full p-2 transition-colors",l,"hover:text-(--mp-text)"),onClick:Y,title:"Next",children:jsxRuntime.jsx(lucideReact.SkipForward,{className:"h-4 w-4",fill:"currentColor"})}),jsxRuntime.jsxs("div",{className:"ml-2 flex items-center gap-1.5",children:[jsxRuntime.jsx("button",{className:n("rounded-full p-1 transition-colors",l,"hover:text-(--mp-text)"),onClick:()=>q(e=>!e),title:b?"Unmute":"Mute",children:b||M===0?jsxRuntime.jsx(lucideReact.VolumeX,{className:"h-3.5 w-3.5"}):jsxRuntime.jsx(lucideReact.Volume2,{className:"h-3.5 w-3.5"})}),jsxRuntime.jsx("input",{type:"range",min:0,max:1,step:.01,value:b?0:M,onChange:e=>{ue(Number(e.target.value)),b&&q(false);},className:"mp-volume-slider h-1 w-14 cursor-pointer appearance-none rounded-full bg-(--mp-surface) accent-(--accent)"})]})]}),jsxRuntime.jsx("div",{className:n("overflow-hidden transition-all duration-300 ease-in-out",me?"max-h-60":"max-h-0"),children:jsxRuntime.jsx("div",{className:n("border-t px-2 py-2",Q),children:jsxRuntime.jsx("div",{className:"max-h-52 space-y-0.5 overflow-y-auto",children:o.map((e,r)=>{let u=r===a;return jsxRuntime.jsxs("button",{className:n("flex w-full items-center gap-2.5 rounded-lg px-2.5 py-2 text-left transition-all duration-200",u?"bg-(--accent)/10 dark:bg-(--accent)/15":"hover:bg-(--mp-surface-hover)"),onClick:()=>{v(r),D(true);},children:[jsxRuntime.jsx("div",{className:"flex h-8 w-8 shrink-0 items-center justify-center",children:u&&d?jsxRuntime.jsx("div",{className:"flex items-end gap-0.5",children:[1,2,3].map(h=>jsxRuntime.jsx("div",{className:"w-0.75 rounded-full bg-(--accent)",style:{height:`${8+h*4}px`,animation:`mp-eq-bar ${.4+h*.15}s ease-in-out infinite alternate`}},h))}):u?jsxRuntime.jsx(lucideReact.Disc3,{className:n("h-4 w-4",T)}):jsxRuntime.jsx("span",{className:n("text-xs font-mono",l),children:r+1})}),jsxRuntime.jsx("div",{className:"h-8 w-8 shrink-0 overflow-hidden rounded",children:jsxRuntime.jsx("img",{src:e.cover||V,alt:"",className:"h-full w-full object-cover",draggable:false})}),jsxRuntime.jsxs("div",{className:"min-w-0 flex-1",children:[jsxRuntime.jsx("div",{className:n("truncate text-xs font-medium",u?T:E),children:e.title}),e.artist&&jsxRuntime.jsx("div",{className:n("truncate text-[10px]",l),children:e.artist})]}),P.has(r)&&jsxRuntime.jsx(lucideReact.Heart,{className:"h-3 w-3 shrink-0 text-rose-500",fill:"currentColor"})]},r)})})})})]})})]})}exports.MiniPlayer=et;
6
+ </svg>`);function ie(r){if(!isFinite(r)||r<0)return "0:00";let D=Math.floor(r/60),v=Math.floor(r%60);return `${D}:${v.toString().padStart(2,"0")}`}function We(r){return r.startsWith("bottom")?"bottom":r.startsWith("top")?"top":"right"}var _e={"bottom-right":"bottom-4 right-4","bottom-left":"bottom-4 left-4","top-right":"top-4 right-4","top-left":"top-4 left-4"},Be={"bottom-right":"bottom-4 right-0","bottom-left":"bottom-4 left-0","top-right":"top-4 right-0","top-left":"top-4 left-0"},Ge={"bottom-right":"bottom-8 right-0 w-1.5 h-16 rounded-l-full","bottom-left":"bottom-8 left-0 w-1.5 h-16 rounded-r-full","top-right":"top-8 right-0 w-1.5 h-16 rounded-l-full","top-left":"top-8 left-0 w-1.5 h-16 rounded-r-full"};function ot({playlist:r,initialTrack:D=0,position:v="bottom-right",entrance:se,theme:G,docked:A=false,visible:U,onVisibleChange:M,onTrackChange:X,onLike:F,autoPlay:K=true,shuffle:le=false,loop:ce=false,accent:q="#8b5cf6",className:ue}){let [i,de]=react.useState(D),[m,$]=react.useState(false),[J,j]=react.useState(0),[P,me]=react.useState(0),[g,fe]=react.useState(.8),[h,Q]=react.useState(false),[S,he]=react.useState(new Set),[pe,ve]=react.useState(false),[ge,H]=react.useState(U??!A),[E,I]=react.useState(false),[z,V]=react.useState(false),[N,be]=react.useState(le),[W,xe]=react.useState(ce),Y=react.useRef(false),d=react.useRef(null),we=react.useRef(null),y=react.useRef(void 0),T=react.useRef(null),b=react.useRef(null),L=U??ge,Z=se??We(v),l=r[i],f=A,Ne=G==="dark"?"dark":G==="light"?"light":"",ye="bg-(--mp-bg)",R="text-(--mp-text)",c="text-(--mp-text-muted)",O="text-(--accent)",ee="border-(--mp-border)";react.useEffect(()=>{let e=d.current;e&&(e.src=l.src,e.load(),m&&e.play().catch(()=>{}));},[i,l.src]),react.useEffect(()=>{if(!K||Y.current)return;let e=d.current;if(!e)return;let n=()=>{Y.current=true,$(true),e.play().catch(()=>{});};return e.addEventListener("canplaythrough",n,{once:true}),()=>e.removeEventListener("canplaythrough",n)},[K]),react.useEffect(()=>{let e=d.current;e&&(m?e.play().catch(()=>{}):e.pause());},[m]),react.useEffect(()=>{let e=d.current;e&&(e.muted=h,b.current?b.current.gain.value=h?0:g:e.volume=g);},[g,h]),react.useEffect(()=>{let e=d.current;if(!e)return;let n=()=>j(e.currentTime),s=()=>me(e.duration),p=()=>{W?(e.currentTime=0,e.play().catch(()=>{})):te();};return e.addEventListener("timeupdate",n),e.addEventListener("loadedmetadata",s),e.addEventListener("ended",p),()=>{e.removeEventListener("timeupdate",n),e.removeEventListener("loadedmetadata",s),e.removeEventListener("ended",p);}},[i,r.length]);let x=react.useCallback(e=>{let n=(e%r.length+r.length)%r.length;de(n),j(0),X?.(n,r[n]),L||(H(true),M?.(true));},[r,L,X,M]),te=react.useCallback(()=>{if(N){let e;do e=Math.floor(Math.random()*r.length);while(e===i&&r.length>1);x(e);}else x(i+1);},[x,i,N,r.length]),ke=react.useCallback(()=>{if(N){let e;do e=Math.floor(Math.random()*r.length);while(e===i&&r.length>1);x(e);}else x(i-1);},[x,i,N,r.length]),Ce=react.useCallback(()=>{let e=S.has(i);he(n=>{let s=new Set(n);return e?s.delete(i):s.add(i),s}),F?.(i,l,!e);},[i,S,F,l]),Me=react.useCallback(e=>{let n=e.currentTarget.getBoundingClientRect(),p=Math.max(0,Math.min(1,(e.clientX-n.left)/n.width))*P;d.current&&(d.current.currentTime=p),j(p);},[P]),ne=react.useCallback(()=>{I(true);let e=f?200:400;y.current=setTimeout(()=>{I(false),H(false),M?.(false);},e);},[f,M]);react.useEffect(()=>()=>{y.current&&clearTimeout(y.current);},[]),react.useEffect(()=>()=>{T.current?.close();},[]);function _(){if(T.current||!d.current){T.current?.resume();return}try{let e=window.AudioContext??window.webkitAudioContext;if(!e)return;let n=new e,s=n.createGain();s.gain.value=h?0:g,n.createMediaElementSource(d.current).connect(s).connect(n.destination),T.current=n,b.current=s,n.resume();}catch{}}let Pe=z?"fade-in 0.2s ease-out both":`mp-enter-${Z} 0.45s cubic-bezier(0.16, 1, 0.3, 1) both`,Se=z?"fade-in 0.2s ease-in reverse both":`mp-exit-${Z} 0.4s cubic-bezier(0.7, 0, 0.84, 0) both`,oe=P>0?J/P*100:0;return f&&!L&&!E?jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("audio",{ref:d,preload:"metadata",crossOrigin:"anonymous"}),jsxRuntime.jsxs("div",{className:o("fixed z-100 cursor-pointer transition-all duration-300",Ge[v]),style:{"--accent":q},onMouseEnter:()=>{V(true),H(true),M?.(true);},children:[jsxRuntime.jsx("div",{className:o("h-full w-full rounded-full",m?"bg-(--accent)":"bg-(--mp-dock-strip)"),style:m?{animation:"mp-progress-glow 2s ease-in-out infinite",boxShadow:"0 0 12px color-mix(in srgb, var(--accent) 50%, transparent)"}:void 0}),m&&jsxRuntime.jsx("div",{className:"absolute inset-0 rounded-full bg-(--accent)/30",style:{animation:"mp-pulse-ring 2s ease-out infinite"}})]})]}):!L&&!E?jsxRuntime.jsx("audio",{ref:d,preload:"metadata",crossOrigin:"anonymous"}):jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("audio",{ref:d,preload:"metadata",crossOrigin:"anonymous"}),jsxRuntime.jsx("div",{className:o("fixed z-100",f?Be[v]:_e[v],Ne),style:{"--accent":q,...E?{animation:Se}:{animation:Pe}},onMouseEnter:()=>{f&&(y.current&&(clearTimeout(y.current),y.current=void 0),E&&I(false),V(true));},onMouseLeave:()=>{f&&(V(false),ne());},children:jsxRuntime.jsxs("div",{className:o("w-[320px] overflow-hidden rounded-2xl border shadow-2xl backdrop-blur-xl",ye,ee,f&&"rounded-none",v.endsWith("right")&&f&&"rounded-l-2xl",v.endsWith("left")&&f&&"rounded-r-2xl",ue),children:[jsxRuntime.jsxs("div",{className:"relative",children:[jsxRuntime.jsx("div",{className:"absolute inset-0 overflow-hidden",children:jsxRuntime.jsx("img",{src:l.cover||B,alt:"",className:"h-full w-full scale-110 object-cover opacity-30 blur-2xl",draggable:false})}),jsxRuntime.jsxs("div",{className:"relative flex items-center gap-3.5 p-4 pb-3",children:[jsxRuntime.jsxs("div",{className:"relative h-14 w-14 shrink-0",children:[jsxRuntime.jsxs("div",{className:"h-14 w-14 overflow-hidden rounded-full border-2 border-white/10 shadow-lg",style:m?{animation:"mp-vinyl-spin 4s linear infinite"}:void 0,children:[jsxRuntime.jsx("img",{src:l.cover||B,alt:l.album??l.title,className:"h-full w-full object-cover",draggable:false}),jsxRuntime.jsx("div",{className:"absolute inset-0 flex items-center justify-center",children:jsxRuntime.jsx("div",{className:"h-3 w-3 rounded-full bg-black/60 ring-1 ring-white/10"})})]}),m&&jsxRuntime.jsx("div",{className:"absolute inset-0 rounded-full bg-(--accent)/20",style:{animation:"mp-pulse-ring 2.5s ease-out infinite"}})]}),jsxRuntime.jsxs("div",{className:"min-w-0 flex-1",children:[jsxRuntime.jsx("div",{className:o("truncate text-sm font-semibold",R),children:l.title}),l.artist&&jsxRuntime.jsx("div",{className:o("truncate text-xs",c),children:l.artist}),l.album&&jsxRuntime.jsx("div",{className:o("mt-0.5 truncate text-[10px] tracking-wide",c,"opacity-60"),children:l.album})]}),jsxRuntime.jsxs("div",{className:"flex shrink-0 items-center gap-0.5",children:[jsxRuntime.jsx("button",{className:o("rounded-full p-1.5 transition-all duration-200",S.has(i)?"text-rose-500 hover:text-rose-400":o(c,"hover:text-rose-500")),onClick:Ce,title:"Like",children:jsxRuntime.jsx(lucideReact.Heart,{className:"h-4 w-4",fill:S.has(i)?"currentColor":"none"})}),jsxRuntime.jsx("button",{className:o("rounded-full p-1.5 transition-colors",c,"hover:"+R.split(" ")[0]),onClick:()=>ve(e=>!e),title:"Playlist",children:jsxRuntime.jsx(lucideReact.ListMusic,{className:"h-4 w-4"})}),!f&&jsxRuntime.jsx("button",{className:o("rounded-full p-1.5 transition-colors",c,"hover:"+R.split(" ")[0]),onClick:ne,title:"Dismiss",children:jsxRuntime.jsx(lucideReact.X,{className:"h-3.5 w-3.5"})})]})]})]}),jsxRuntime.jsxs("div",{className:"px-4",children:[jsxRuntime.jsxs("div",{ref:we,className:"group relative h-1.5 cursor-pointer rounded-full bg-(--mp-surface)",onClick:Me,children:[jsxRuntime.jsx("div",{className:"h-full rounded-full bg-(--accent) transition-[width] duration-150",style:{width:`${oe}%`}}),jsxRuntime.jsx("div",{className:"absolute top-1/2 h-3 w-3 -translate-y-1/2 rounded-full bg-(--accent) opacity-0 shadow-md transition-opacity group-hover:opacity-100",style:{left:`calc(${oe}% - 6px)`}})]}),jsxRuntime.jsxs("div",{className:o("mt-1 flex justify-between text-[10px] font-mono",c),children:[jsxRuntime.jsx("span",{children:ie(J)}),jsxRuntime.jsx("span",{children:ie(P)})]})]}),jsxRuntime.jsxs("div",{className:"flex items-center justify-center gap-2 px-4 pb-3 pt-1",children:[jsxRuntime.jsx("button",{className:o("rounded-full p-1.5 transition-colors",N?O:c,"hover:text-(--mp-text)"),onClick:()=>be(e=>!e),title:N?"Shuffle On":"Shuffle Off",children:jsxRuntime.jsx(lucideReact.Shuffle,{className:"h-3.5 w-3.5"})}),jsxRuntime.jsx("button",{className:o("rounded-full p-1.5 transition-colors",W?O:c,"hover:text-(--mp-text)"),onClick:()=>xe(e=>!e),title:W?"Loop On":"Loop Off",children:jsxRuntime.jsx(lucideReact.Repeat1,{className:"h-3.5 w-3.5"})}),jsxRuntime.jsx("button",{className:o("rounded-full p-2 transition-colors",c,"hover:text-(--mp-text)"),onClick:ke,title:"Previous",children:jsxRuntime.jsx(lucideReact.SkipBack,{className:"h-4 w-4",fill:"currentColor"})}),jsxRuntime.jsx("button",{className:o("flex h-10 w-10 items-center justify-center rounded-full transition-all duration-200","bg-(--accent) text-white shadow-lg active:scale-95"),style:{boxShadow:"0 6px 20px color-mix(in srgb, var(--accent) 35%, transparent)"},onClick:()=>{_(),$(e=>!e);},title:m?"Pause":"Play",children:m?jsxRuntime.jsx(lucideReact.Pause,{className:"h-4.5 w-4.5",fill:"currentColor"}):jsxRuntime.jsx(lucideReact.Play,{className:"h-4.5 w-4.5 translate-x-px",fill:"currentColor"})}),jsxRuntime.jsx("button",{className:o("rounded-full p-2 transition-colors",c,"hover:text-(--mp-text)"),onClick:te,title:"Next",children:jsxRuntime.jsx(lucideReact.SkipForward,{className:"h-4 w-4",fill:"currentColor"})}),jsxRuntime.jsxs("div",{className:"ml-2 flex items-center gap-1.5",children:[jsxRuntime.jsx("button",{className:o("rounded-full p-1 transition-colors",c,"hover:text-(--mp-text)"),onClick:()=>{_();let e=!h;Q(e),b.current&&(b.current.gain.value=e?0:g);},title:h?"Unmute":"Mute",children:h||g===0?jsxRuntime.jsx(lucideReact.VolumeX,{className:"h-3.5 w-3.5"}):jsxRuntime.jsx(lucideReact.Volume2,{className:"h-3.5 w-3.5"})}),jsxRuntime.jsx("input",{type:"range",min:0,max:1,step:.01,value:h?0:g,onChange:e=>{_();let n=Number(e.target.value);fe(n),h&&Q(false),b.current&&(b.current.gain.value=n);},className:"mp-volume-slider h-1 w-14 cursor-pointer appearance-none rounded-full bg-(--mp-surface) accent-(--accent)"})]})]}),jsxRuntime.jsx("div",{className:o("overflow-hidden transition-all duration-300 ease-in-out",pe?"max-h-60":"max-h-0"),children:jsxRuntime.jsx("div",{className:o("border-t px-2 py-2",ee),children:jsxRuntime.jsx("div",{className:"max-h-52 space-y-0.5 overflow-y-auto",children:r.map((e,n)=>{let s=n===i;return jsxRuntime.jsxs("button",{className:o("flex w-full items-center gap-2.5 rounded-lg px-2.5 py-2 text-left transition-all duration-200",s?"bg-(--accent)/10 dark:bg-(--accent)/15":"hover:bg-(--mp-surface-hover)"),onClick:()=>{x(n),$(true);},children:[jsxRuntime.jsx("div",{className:"flex h-8 w-8 shrink-0 items-center justify-center",children:s&&m?jsxRuntime.jsx("div",{className:"flex items-end gap-0.5",children:[1,2,3].map(p=>jsxRuntime.jsx("div",{className:"w-0.75 rounded-full bg-(--accent)",style:{height:`${8+p*4}px`,animation:`mp-eq-bar ${.4+p*.15}s ease-in-out infinite alternate`}},p))}):s?jsxRuntime.jsx(lucideReact.Disc3,{className:o("h-4 w-4",O)}):jsxRuntime.jsx("span",{className:o("text-xs font-mono",c),children:n+1})}),jsxRuntime.jsx("div",{className:"h-8 w-8 shrink-0 overflow-hidden rounded",children:jsxRuntime.jsx("img",{src:e.cover||B,alt:"",className:"h-full w-full object-cover",draggable:false})}),jsxRuntime.jsxs("div",{className:"min-w-0 flex-1",children:[jsxRuntime.jsx("div",{className:o("truncate text-xs font-medium",s?O:R),children:e.title}),e.artist&&jsxRuntime.jsx("div",{className:o("truncate text-[10px]",c),children:e.artist})]}),S.has(n)&&jsxRuntime.jsx(lucideReact.Heart,{className:"h-3 w-3 shrink-0 text-rose-500",fill:"currentColor"})]},n)})})})})]})})]})}exports.MiniPlayer=ot;
@@ -1,6 +1,6 @@
1
- import {useState,useRef,useEffect,useCallback}from'react';import {clsx}from'clsx';import {twMerge}from'tailwind-merge';import {Heart,ListMusic,X,Shuffle,Repeat1,SkipBack,Pause,Play,SkipForward,VolumeX,Volume2,Disc3}from'lucide-react';import {jsxs,Fragment,jsx}from'react/jsx-runtime';function n(...o){return twMerge(clsx(o))}var V="data:image/svg+xml,"+encodeURIComponent(`<svg xmlns="http://www.w3.org/2000/svg" width="200" height="200" viewBox="0 0 200 200">
1
+ import {useState,useRef,useEffect,useCallback}from'react';import {clsx}from'clsx';import {twMerge}from'tailwind-merge';import {Heart,ListMusic,X,Shuffle,Repeat1,SkipBack,Pause,Play,SkipForward,VolumeX,Volume2,Disc3}from'lucide-react';import {jsxs,Fragment,jsx}from'react/jsx-runtime';function o(...r){return twMerge(clsx(r))}var B="data:image/svg+xml,"+encodeURIComponent(`<svg xmlns="http://www.w3.org/2000/svg" width="200" height="200" viewBox="0 0 200 200">
2
2
  <rect width="200" height="200" fill="#1e1b2e"/>
3
3
  <circle cx="100" cy="100" r="60" fill="none" stroke="#6366f1" stroke-width="1.5" opacity="0.3"/>
4
4
  <circle cx="100" cy="100" r="20" fill="none" stroke="#6366f1" stroke-width="1" opacity="0.4"/>
5
5
  <text x="100" y="108" text-anchor="middle" font-family="monospace" font-size="18" fill="#6366f1" opacity="0.6">\u266A</text>
6
- </svg>`);function ne(o){if(!isFinite(o)||o<0)return "0:00";let R=Math.floor(o/60),p=Math.floor(o%60);return `${R}:${p.toString().padStart(2,"0")}`}function Ae(o){return o.startsWith("bottom")?"bottom":o.startsWith("top")?"top":"right"}var ze={"bottom-right":"bottom-4 right-4","bottom-left":"bottom-4 left-4","top-right":"top-4 right-4","top-left":"top-4 left-4"},Ve={"bottom-right":"bottom-4 right-0","bottom-left":"bottom-4 left-0","top-right":"top-4 right-0","top-left":"top-4 left-0"},We={"bottom-right":"bottom-8 right-0 w-1.5 h-16 rounded-l-full","bottom-left":"bottom-8 left-0 w-1.5 h-16 rounded-r-full","top-right":"top-8 right-0 w-1.5 h-16 rounded-l-full","top-left":"top-8 left-0 w-1.5 h-16 rounded-r-full"};function et({playlist:o,initialTrack:R=0,position:p="bottom-right",entrance:re,theme:W,docked:O=false,visible:_,onVisibleChange:y,onTrackChange:B,onLike:U,autoPlay:X$1=true,shuffle:ae=false,loop:ie=false,accent:F="#8b5cf6",className:se}){let [a,le]=useState(R),[d,D]=useState(false),[K,$]=useState(0),[k,ce]=useState(0),[M,ue]=useState(.8),[b,q]=useState(false),[P,de]=useState(new Set),[me,fe]=useState(false),[he,j]=useState(_??!O),[C,H]=useState(false),[I,A]=useState(false),[g,pe]=useState(ae),[z,ve]=useState(ie),G=useRef(false),m=useRef(null),be=useRef(null),x=useRef(void 0),S=_??he,J=re??Ae(p),s=o[a],f=O,ge=W==="dark"?"dark":W==="light"?"light":"",xe="bg-(--mp-bg)",E="text-(--mp-text)",l="text-(--mp-text-muted)",T="text-(--accent)",Q="border-(--mp-border)";useEffect(()=>{let e=m.current;e&&(e.src=s.src,e.load(),d&&e.play().catch(()=>{}));},[a,s.src]),useEffect(()=>{if(!X$1||G.current)return;let e=m.current;if(!e)return;let r=()=>{G.current=true,D(true),e.play().catch(()=>{});};return e.addEventListener("canplaythrough",r,{once:true}),()=>e.removeEventListener("canplaythrough",r)},[X$1]),useEffect(()=>{let e=m.current;e&&(d?e.play().catch(()=>{}):e.pause());},[d]),useEffect(()=>{let e=m.current;e&&(e.volume=b?0:M);},[M,b]),useEffect(()=>{let e=m.current;if(!e)return;let r=()=>$(e.currentTime),u=()=>ce(e.duration),h=()=>{z?(e.currentTime=0,e.play().catch(()=>{})):Y();};return e.addEventListener("timeupdate",r),e.addEventListener("loadedmetadata",u),e.addEventListener("ended",h),()=>{e.removeEventListener("timeupdate",r),e.removeEventListener("loadedmetadata",u),e.removeEventListener("ended",h);}},[a,o.length]);let v=useCallback(e=>{let r=(e%o.length+o.length)%o.length;le(r),$(0),B?.(r,o[r]),S||(j(true),y?.(true));},[o,S,B,y]),Y=useCallback(()=>{if(g){let e;do e=Math.floor(Math.random()*o.length);while(e===a&&o.length>1);v(e);}else v(a+1);},[v,a,g,o.length]),we=useCallback(()=>{if(g){let e;do e=Math.floor(Math.random()*o.length);while(e===a&&o.length>1);v(e);}else v(a-1);},[v,a,g,o.length]),Ne=useCallback(()=>{let e=P.has(a);de(r=>{let u=new Set(r);return e?u.delete(a):u.add(a),u}),U?.(a,s,!e);},[a,P,U,s]),ye=useCallback(e=>{let r=e.currentTarget.getBoundingClientRect(),h=Math.max(0,Math.min(1,(e.clientX-r.left)/r.width))*k;m.current&&(m.current.currentTime=h),$(h);},[k]),Z=useCallback(()=>{H(true);let e=f?200:400;x.current=setTimeout(()=>{H(false),j(false),y?.(false);},e);},[f,y]);useEffect(()=>()=>{x.current&&clearTimeout(x.current);},[]);let ke=I?"fade-in 0.2s ease-out both":`mp-enter-${J} 0.45s cubic-bezier(0.16, 1, 0.3, 1) both`,Pe=I?"fade-in 0.2s ease-in reverse both":`mp-exit-${J} 0.4s cubic-bezier(0.7, 0, 0.84, 0) both`,ee=k>0?K/k*100:0;return f&&!S&&!C?jsxs(Fragment,{children:[jsx("audio",{ref:m,preload:"metadata"}),jsxs("div",{className:n("fixed z-100 cursor-pointer transition-all duration-300",We[p]),style:{"--accent":F},onMouseEnter:()=>{A(true),j(true),y?.(true);},children:[jsx("div",{className:n("h-full w-full rounded-full",d?"bg-(--accent)":"bg-(--mp-dock-strip)"),style:d?{animation:"mp-progress-glow 2s ease-in-out infinite",boxShadow:"0 0 12px color-mix(in srgb, var(--accent) 50%, transparent)"}:void 0}),d&&jsx("div",{className:"absolute inset-0 rounded-full bg-(--accent)/30",style:{animation:"mp-pulse-ring 2s ease-out infinite"}})]})]}):!S&&!C?jsx("audio",{ref:m,preload:"metadata"}):jsxs(Fragment,{children:[jsx("audio",{ref:m,preload:"metadata"}),jsx("div",{className:n("fixed z-100",f?Ve[p]:ze[p],ge),style:{"--accent":F,...C?{animation:Pe}:{animation:ke}},onMouseEnter:()=>{f&&(x.current&&(clearTimeout(x.current),x.current=void 0),C&&H(false),A(true));},onMouseLeave:()=>{f&&(A(false),Z());},children:jsxs("div",{className:n("w-[320px] overflow-hidden rounded-2xl border shadow-2xl backdrop-blur-xl",xe,Q,f&&"rounded-none",p.endsWith("right")&&f&&"rounded-l-2xl",p.endsWith("left")&&f&&"rounded-r-2xl",se),children:[jsxs("div",{className:"relative",children:[jsx("div",{className:"absolute inset-0 overflow-hidden",children:jsx("img",{src:s.cover||V,alt:"",className:"h-full w-full scale-110 object-cover opacity-30 blur-2xl",draggable:false})}),jsxs("div",{className:"relative flex items-center gap-3.5 p-4 pb-3",children:[jsxs("div",{className:"relative h-14 w-14 shrink-0",children:[jsxs("div",{className:"h-14 w-14 overflow-hidden rounded-full border-2 border-white/10 shadow-lg",style:d?{animation:"mp-vinyl-spin 4s linear infinite"}:void 0,children:[jsx("img",{src:s.cover||V,alt:s.album??s.title,className:"h-full w-full object-cover",draggable:false}),jsx("div",{className:"absolute inset-0 flex items-center justify-center",children:jsx("div",{className:"h-3 w-3 rounded-full bg-black/60 ring-1 ring-white/10"})})]}),d&&jsx("div",{className:"absolute inset-0 rounded-full bg-(--accent)/20",style:{animation:"mp-pulse-ring 2.5s ease-out infinite"}})]}),jsxs("div",{className:"min-w-0 flex-1",children:[jsx("div",{className:n("truncate text-sm font-semibold",E),children:s.title}),s.artist&&jsx("div",{className:n("truncate text-xs",l),children:s.artist}),s.album&&jsx("div",{className:n("mt-0.5 truncate text-[10px] tracking-wide",l,"opacity-60"),children:s.album})]}),jsxs("div",{className:"flex shrink-0 items-center gap-0.5",children:[jsx("button",{className:n("rounded-full p-1.5 transition-all duration-200",P.has(a)?"text-rose-500 hover:text-rose-400":n(l,"hover:text-rose-500")),onClick:Ne,title:"Like",children:jsx(Heart,{className:"h-4 w-4",fill:P.has(a)?"currentColor":"none"})}),jsx("button",{className:n("rounded-full p-1.5 transition-colors",l,"hover:"+E.split(" ")[0]),onClick:()=>fe(e=>!e),title:"Playlist",children:jsx(ListMusic,{className:"h-4 w-4"})}),!f&&jsx("button",{className:n("rounded-full p-1.5 transition-colors",l,"hover:"+E.split(" ")[0]),onClick:Z,title:"Dismiss",children:jsx(X,{className:"h-3.5 w-3.5"})})]})]})]}),jsxs("div",{className:"px-4",children:[jsxs("div",{ref:be,className:"group relative h-1.5 cursor-pointer rounded-full bg-(--mp-surface)",onClick:ye,children:[jsx("div",{className:"h-full rounded-full bg-(--accent) transition-[width] duration-150",style:{width:`${ee}%`}}),jsx("div",{className:"absolute top-1/2 h-3 w-3 -translate-y-1/2 rounded-full bg-(--accent) opacity-0 shadow-md transition-opacity group-hover:opacity-100",style:{left:`calc(${ee}% - 6px)`}})]}),jsxs("div",{className:n("mt-1 flex justify-between text-[10px] font-mono",l),children:[jsx("span",{children:ne(K)}),jsx("span",{children:ne(k)})]})]}),jsxs("div",{className:"flex items-center justify-center gap-2 px-4 pb-3 pt-1",children:[jsx("button",{className:n("rounded-full p-1.5 transition-colors",g?T:l,"hover:text-(--mp-text)"),onClick:()=>pe(e=>!e),title:g?"Shuffle On":"Shuffle Off",children:jsx(Shuffle,{className:"h-3.5 w-3.5"})}),jsx("button",{className:n("rounded-full p-1.5 transition-colors",z?T:l,"hover:text-(--mp-text)"),onClick:()=>ve(e=>!e),title:z?"Loop On":"Loop Off",children:jsx(Repeat1,{className:"h-3.5 w-3.5"})}),jsx("button",{className:n("rounded-full p-2 transition-colors",l,"hover:text-(--mp-text)"),onClick:we,title:"Previous",children:jsx(SkipBack,{className:"h-4 w-4",fill:"currentColor"})}),jsx("button",{className:n("flex h-10 w-10 items-center justify-center rounded-full transition-all duration-200","bg-(--accent) text-white shadow-lg active:scale-95"),style:{boxShadow:"0 6px 20px color-mix(in srgb, var(--accent) 35%, transparent)"},onClick:()=>D(e=>!e),title:d?"Pause":"Play",children:d?jsx(Pause,{className:"h-4.5 w-4.5",fill:"currentColor"}):jsx(Play,{className:"h-4.5 w-4.5 translate-x-px",fill:"currentColor"})}),jsx("button",{className:n("rounded-full p-2 transition-colors",l,"hover:text-(--mp-text)"),onClick:Y,title:"Next",children:jsx(SkipForward,{className:"h-4 w-4",fill:"currentColor"})}),jsxs("div",{className:"ml-2 flex items-center gap-1.5",children:[jsx("button",{className:n("rounded-full p-1 transition-colors",l,"hover:text-(--mp-text)"),onClick:()=>q(e=>!e),title:b?"Unmute":"Mute",children:b||M===0?jsx(VolumeX,{className:"h-3.5 w-3.5"}):jsx(Volume2,{className:"h-3.5 w-3.5"})}),jsx("input",{type:"range",min:0,max:1,step:.01,value:b?0:M,onChange:e=>{ue(Number(e.target.value)),b&&q(false);},className:"mp-volume-slider h-1 w-14 cursor-pointer appearance-none rounded-full bg-(--mp-surface) accent-(--accent)"})]})]}),jsx("div",{className:n("overflow-hidden transition-all duration-300 ease-in-out",me?"max-h-60":"max-h-0"),children:jsx("div",{className:n("border-t px-2 py-2",Q),children:jsx("div",{className:"max-h-52 space-y-0.5 overflow-y-auto",children:o.map((e,r)=>{let u=r===a;return jsxs("button",{className:n("flex w-full items-center gap-2.5 rounded-lg px-2.5 py-2 text-left transition-all duration-200",u?"bg-(--accent)/10 dark:bg-(--accent)/15":"hover:bg-(--mp-surface-hover)"),onClick:()=>{v(r),D(true);},children:[jsx("div",{className:"flex h-8 w-8 shrink-0 items-center justify-center",children:u&&d?jsx("div",{className:"flex items-end gap-0.5",children:[1,2,3].map(h=>jsx("div",{className:"w-0.75 rounded-full bg-(--accent)",style:{height:`${8+h*4}px`,animation:`mp-eq-bar ${.4+h*.15}s ease-in-out infinite alternate`}},h))}):u?jsx(Disc3,{className:n("h-4 w-4",T)}):jsx("span",{className:n("text-xs font-mono",l),children:r+1})}),jsx("div",{className:"h-8 w-8 shrink-0 overflow-hidden rounded",children:jsx("img",{src:e.cover||V,alt:"",className:"h-full w-full object-cover",draggable:false})}),jsxs("div",{className:"min-w-0 flex-1",children:[jsx("div",{className:n("truncate text-xs font-medium",u?T:E),children:e.title}),e.artist&&jsx("div",{className:n("truncate text-[10px]",l),children:e.artist})]}),P.has(r)&&jsx(Heart,{className:"h-3 w-3 shrink-0 text-rose-500",fill:"currentColor"})]},r)})})})})]})})]})}export{et as MiniPlayer};
6
+ </svg>`);function ie(r){if(!isFinite(r)||r<0)return "0:00";let D=Math.floor(r/60),v=Math.floor(r%60);return `${D}:${v.toString().padStart(2,"0")}`}function We(r){return r.startsWith("bottom")?"bottom":r.startsWith("top")?"top":"right"}var _e={"bottom-right":"bottom-4 right-4","bottom-left":"bottom-4 left-4","top-right":"top-4 right-4","top-left":"top-4 left-4"},Be={"bottom-right":"bottom-4 right-0","bottom-left":"bottom-4 left-0","top-right":"top-4 right-0","top-left":"top-4 left-0"},Ge={"bottom-right":"bottom-8 right-0 w-1.5 h-16 rounded-l-full","bottom-left":"bottom-8 left-0 w-1.5 h-16 rounded-r-full","top-right":"top-8 right-0 w-1.5 h-16 rounded-l-full","top-left":"top-8 left-0 w-1.5 h-16 rounded-r-full"};function ot({playlist:r,initialTrack:D=0,position:v="bottom-right",entrance:se,theme:G,docked:A=false,visible:U,onVisibleChange:M,onTrackChange:X$1,onLike:F,autoPlay:K=true,shuffle:le=false,loop:ce=false,accent:q="#8b5cf6",className:ue}){let [i,de]=useState(D),[m,$]=useState(false),[J,j]=useState(0),[P,me]=useState(0),[g,fe]=useState(.8),[h,Q]=useState(false),[S,he]=useState(new Set),[pe,ve]=useState(false),[ge,H]=useState(U??!A),[E,I]=useState(false),[z,V]=useState(false),[N,be]=useState(le),[W,xe]=useState(ce),Y=useRef(false),d=useRef(null),we=useRef(null),y=useRef(void 0),T=useRef(null),b=useRef(null),L=U??ge,Z=se??We(v),l=r[i],f=A,Ne=G==="dark"?"dark":G==="light"?"light":"",ye="bg-(--mp-bg)",R="text-(--mp-text)",c="text-(--mp-text-muted)",O="text-(--accent)",ee="border-(--mp-border)";useEffect(()=>{let e=d.current;e&&(e.src=l.src,e.load(),m&&e.play().catch(()=>{}));},[i,l.src]),useEffect(()=>{if(!K||Y.current)return;let e=d.current;if(!e)return;let n=()=>{Y.current=true,$(true),e.play().catch(()=>{});};return e.addEventListener("canplaythrough",n,{once:true}),()=>e.removeEventListener("canplaythrough",n)},[K]),useEffect(()=>{let e=d.current;e&&(m?e.play().catch(()=>{}):e.pause());},[m]),useEffect(()=>{let e=d.current;e&&(e.muted=h,b.current?b.current.gain.value=h?0:g:e.volume=g);},[g,h]),useEffect(()=>{let e=d.current;if(!e)return;let n=()=>j(e.currentTime),s=()=>me(e.duration),p=()=>{W?(e.currentTime=0,e.play().catch(()=>{})):te();};return e.addEventListener("timeupdate",n),e.addEventListener("loadedmetadata",s),e.addEventListener("ended",p),()=>{e.removeEventListener("timeupdate",n),e.removeEventListener("loadedmetadata",s),e.removeEventListener("ended",p);}},[i,r.length]);let x=useCallback(e=>{let n=(e%r.length+r.length)%r.length;de(n),j(0),X$1?.(n,r[n]),L||(H(true),M?.(true));},[r,L,X$1,M]),te=useCallback(()=>{if(N){let e;do e=Math.floor(Math.random()*r.length);while(e===i&&r.length>1);x(e);}else x(i+1);},[x,i,N,r.length]),ke=useCallback(()=>{if(N){let e;do e=Math.floor(Math.random()*r.length);while(e===i&&r.length>1);x(e);}else x(i-1);},[x,i,N,r.length]),Ce=useCallback(()=>{let e=S.has(i);he(n=>{let s=new Set(n);return e?s.delete(i):s.add(i),s}),F?.(i,l,!e);},[i,S,F,l]),Me=useCallback(e=>{let n=e.currentTarget.getBoundingClientRect(),p=Math.max(0,Math.min(1,(e.clientX-n.left)/n.width))*P;d.current&&(d.current.currentTime=p),j(p);},[P]),ne=useCallback(()=>{I(true);let e=f?200:400;y.current=setTimeout(()=>{I(false),H(false),M?.(false);},e);},[f,M]);useEffect(()=>()=>{y.current&&clearTimeout(y.current);},[]),useEffect(()=>()=>{T.current?.close();},[]);function _(){if(T.current||!d.current){T.current?.resume();return}try{let e=window.AudioContext??window.webkitAudioContext;if(!e)return;let n=new e,s=n.createGain();s.gain.value=h?0:g,n.createMediaElementSource(d.current).connect(s).connect(n.destination),T.current=n,b.current=s,n.resume();}catch{}}let Pe=z?"fade-in 0.2s ease-out both":`mp-enter-${Z} 0.45s cubic-bezier(0.16, 1, 0.3, 1) both`,Se=z?"fade-in 0.2s ease-in reverse both":`mp-exit-${Z} 0.4s cubic-bezier(0.7, 0, 0.84, 0) both`,oe=P>0?J/P*100:0;return f&&!L&&!E?jsxs(Fragment,{children:[jsx("audio",{ref:d,preload:"metadata",crossOrigin:"anonymous"}),jsxs("div",{className:o("fixed z-100 cursor-pointer transition-all duration-300",Ge[v]),style:{"--accent":q},onMouseEnter:()=>{V(true),H(true),M?.(true);},children:[jsx("div",{className:o("h-full w-full rounded-full",m?"bg-(--accent)":"bg-(--mp-dock-strip)"),style:m?{animation:"mp-progress-glow 2s ease-in-out infinite",boxShadow:"0 0 12px color-mix(in srgb, var(--accent) 50%, transparent)"}:void 0}),m&&jsx("div",{className:"absolute inset-0 rounded-full bg-(--accent)/30",style:{animation:"mp-pulse-ring 2s ease-out infinite"}})]})]}):!L&&!E?jsx("audio",{ref:d,preload:"metadata",crossOrigin:"anonymous"}):jsxs(Fragment,{children:[jsx("audio",{ref:d,preload:"metadata",crossOrigin:"anonymous"}),jsx("div",{className:o("fixed z-100",f?Be[v]:_e[v],Ne),style:{"--accent":q,...E?{animation:Se}:{animation:Pe}},onMouseEnter:()=>{f&&(y.current&&(clearTimeout(y.current),y.current=void 0),E&&I(false),V(true));},onMouseLeave:()=>{f&&(V(false),ne());},children:jsxs("div",{className:o("w-[320px] overflow-hidden rounded-2xl border shadow-2xl backdrop-blur-xl",ye,ee,f&&"rounded-none",v.endsWith("right")&&f&&"rounded-l-2xl",v.endsWith("left")&&f&&"rounded-r-2xl",ue),children:[jsxs("div",{className:"relative",children:[jsx("div",{className:"absolute inset-0 overflow-hidden",children:jsx("img",{src:l.cover||B,alt:"",className:"h-full w-full scale-110 object-cover opacity-30 blur-2xl",draggable:false})}),jsxs("div",{className:"relative flex items-center gap-3.5 p-4 pb-3",children:[jsxs("div",{className:"relative h-14 w-14 shrink-0",children:[jsxs("div",{className:"h-14 w-14 overflow-hidden rounded-full border-2 border-white/10 shadow-lg",style:m?{animation:"mp-vinyl-spin 4s linear infinite"}:void 0,children:[jsx("img",{src:l.cover||B,alt:l.album??l.title,className:"h-full w-full object-cover",draggable:false}),jsx("div",{className:"absolute inset-0 flex items-center justify-center",children:jsx("div",{className:"h-3 w-3 rounded-full bg-black/60 ring-1 ring-white/10"})})]}),m&&jsx("div",{className:"absolute inset-0 rounded-full bg-(--accent)/20",style:{animation:"mp-pulse-ring 2.5s ease-out infinite"}})]}),jsxs("div",{className:"min-w-0 flex-1",children:[jsx("div",{className:o("truncate text-sm font-semibold",R),children:l.title}),l.artist&&jsx("div",{className:o("truncate text-xs",c),children:l.artist}),l.album&&jsx("div",{className:o("mt-0.5 truncate text-[10px] tracking-wide",c,"opacity-60"),children:l.album})]}),jsxs("div",{className:"flex shrink-0 items-center gap-0.5",children:[jsx("button",{className:o("rounded-full p-1.5 transition-all duration-200",S.has(i)?"text-rose-500 hover:text-rose-400":o(c,"hover:text-rose-500")),onClick:Ce,title:"Like",children:jsx(Heart,{className:"h-4 w-4",fill:S.has(i)?"currentColor":"none"})}),jsx("button",{className:o("rounded-full p-1.5 transition-colors",c,"hover:"+R.split(" ")[0]),onClick:()=>ve(e=>!e),title:"Playlist",children:jsx(ListMusic,{className:"h-4 w-4"})}),!f&&jsx("button",{className:o("rounded-full p-1.5 transition-colors",c,"hover:"+R.split(" ")[0]),onClick:ne,title:"Dismiss",children:jsx(X,{className:"h-3.5 w-3.5"})})]})]})]}),jsxs("div",{className:"px-4",children:[jsxs("div",{ref:we,className:"group relative h-1.5 cursor-pointer rounded-full bg-(--mp-surface)",onClick:Me,children:[jsx("div",{className:"h-full rounded-full bg-(--accent) transition-[width] duration-150",style:{width:`${oe}%`}}),jsx("div",{className:"absolute top-1/2 h-3 w-3 -translate-y-1/2 rounded-full bg-(--accent) opacity-0 shadow-md transition-opacity group-hover:opacity-100",style:{left:`calc(${oe}% - 6px)`}})]}),jsxs("div",{className:o("mt-1 flex justify-between text-[10px] font-mono",c),children:[jsx("span",{children:ie(J)}),jsx("span",{children:ie(P)})]})]}),jsxs("div",{className:"flex items-center justify-center gap-2 px-4 pb-3 pt-1",children:[jsx("button",{className:o("rounded-full p-1.5 transition-colors",N?O:c,"hover:text-(--mp-text)"),onClick:()=>be(e=>!e),title:N?"Shuffle On":"Shuffle Off",children:jsx(Shuffle,{className:"h-3.5 w-3.5"})}),jsx("button",{className:o("rounded-full p-1.5 transition-colors",W?O:c,"hover:text-(--mp-text)"),onClick:()=>xe(e=>!e),title:W?"Loop On":"Loop Off",children:jsx(Repeat1,{className:"h-3.5 w-3.5"})}),jsx("button",{className:o("rounded-full p-2 transition-colors",c,"hover:text-(--mp-text)"),onClick:ke,title:"Previous",children:jsx(SkipBack,{className:"h-4 w-4",fill:"currentColor"})}),jsx("button",{className:o("flex h-10 w-10 items-center justify-center rounded-full transition-all duration-200","bg-(--accent) text-white shadow-lg active:scale-95"),style:{boxShadow:"0 6px 20px color-mix(in srgb, var(--accent) 35%, transparent)"},onClick:()=>{_(),$(e=>!e);},title:m?"Pause":"Play",children:m?jsx(Pause,{className:"h-4.5 w-4.5",fill:"currentColor"}):jsx(Play,{className:"h-4.5 w-4.5 translate-x-px",fill:"currentColor"})}),jsx("button",{className:o("rounded-full p-2 transition-colors",c,"hover:text-(--mp-text)"),onClick:te,title:"Next",children:jsx(SkipForward,{className:"h-4 w-4",fill:"currentColor"})}),jsxs("div",{className:"ml-2 flex items-center gap-1.5",children:[jsx("button",{className:o("rounded-full p-1 transition-colors",c,"hover:text-(--mp-text)"),onClick:()=>{_();let e=!h;Q(e),b.current&&(b.current.gain.value=e?0:g);},title:h?"Unmute":"Mute",children:h||g===0?jsx(VolumeX,{className:"h-3.5 w-3.5"}):jsx(Volume2,{className:"h-3.5 w-3.5"})}),jsx("input",{type:"range",min:0,max:1,step:.01,value:h?0:g,onChange:e=>{_();let n=Number(e.target.value);fe(n),h&&Q(false),b.current&&(b.current.gain.value=n);},className:"mp-volume-slider h-1 w-14 cursor-pointer appearance-none rounded-full bg-(--mp-surface) accent-(--accent)"})]})]}),jsx("div",{className:o("overflow-hidden transition-all duration-300 ease-in-out",pe?"max-h-60":"max-h-0"),children:jsx("div",{className:o("border-t px-2 py-2",ee),children:jsx("div",{className:"max-h-52 space-y-0.5 overflow-y-auto",children:r.map((e,n)=>{let s=n===i;return jsxs("button",{className:o("flex w-full items-center gap-2.5 rounded-lg px-2.5 py-2 text-left transition-all duration-200",s?"bg-(--accent)/10 dark:bg-(--accent)/15":"hover:bg-(--mp-surface-hover)"),onClick:()=>{x(n),$(true);},children:[jsx("div",{className:"flex h-8 w-8 shrink-0 items-center justify-center",children:s&&m?jsx("div",{className:"flex items-end gap-0.5",children:[1,2,3].map(p=>jsx("div",{className:"w-0.75 rounded-full bg-(--accent)",style:{height:`${8+p*4}px`,animation:`mp-eq-bar ${.4+p*.15}s ease-in-out infinite alternate`}},p))}):s?jsx(Disc3,{className:o("h-4 w-4",O)}):jsx("span",{className:o("text-xs font-mono",c),children:n+1})}),jsx("div",{className:"h-8 w-8 shrink-0 overflow-hidden rounded",children:jsx("img",{src:e.cover||B,alt:"",className:"h-full w-full object-cover",draggable:false})}),jsxs("div",{className:"min-w-0 flex-1",children:[jsx("div",{className:o("truncate text-xs font-medium",s?O:R),children:e.title}),e.artist&&jsx("div",{className:o("truncate text-[10px]",c),children:e.artist})]}),S.has(n)&&jsx(Heart,{className:"h-3 w-3 shrink-0 text-rose-500",fill:"currentColor"})]},n)})})})})]})})]})}export{ot as MiniPlayer};
@@ -0,0 +1 @@
1
+ 'use strict';var react=require('react'),clsx=require('clsx'),tailwindMerge=require('tailwind-merge'),jsxRuntime=require('react/jsx-runtime');function g(...e){return tailwindMerge.twMerge(clsx.clsx(e))}function Y({text:e="",mode:t="typewriter",speed:k=40,cursor:D=true,cursorChar:M="\u258B",thinking:T=false,streaming:o=false,delay:v=0,onComplete:d,as:A="span",className:B}){let[b,i]=react.useState(t==="instant"?e:""),[u,n]=react.useState(false),[I,s]=react.useState(t==="instant"),[R,l]=react.useState(false),p=react.useRef(0),h=react.useRef(d);h.current=d;let f=react.useRef(e);f.current=e,react.useEffect(()=>{if(t!=="typewriter")return;if(i(""),s(false),l(false),n(false),!e){s(true);return}let c=Math.max(10,1e3/k),r=0,a,C=()=>{n(true),a=setInterval(()=>{let P=f.current;r++,i(P.slice(0,r)),r>=P.length&&(clearInterval(a),n(false),s(true),h.current?.());},c);},E;return v>0?E=setTimeout(C,v):C(),()=>{clearTimeout(E),clearInterval(a);}},[e,t]),react.useEffect(()=>{if(t!=="stream")return;if(e.length===0){p.current=0,i(""),n(false),s(false),l(false);return}if(e.length<=p.current)return;let c=Math.max(10,1e3/k),r=p.current;n(true),s(false),l(false);let a=setInterval(()=>{r++,p.current=r,i(f.current.slice(0,r)),r>=f.current.length&&(clearInterval(a),n(false),h.current?.());},c);return ()=>clearInterval(a)},[e,t]),react.useEffect(()=>{t==="instant"&&(i(e),n(false),s(true));},[e,t]);let x=react.useRef(o);react.useEffect(()=>{let c=x.current;if(x.current=o,c&&!o&&!u&&t==="stream"){l(true);let r=setTimeout(()=>{l(false),s(true);},650);return ()=>clearTimeout(r)}},[o,u,t]);let N=D&&(T||u||R||t==="stream"&&o&&!I||t==="typewriter"&&!I),V=T?"tw-cursor--blink":u?"tw-cursor--solid":R?"tw-cursor--out":"tw-cursor--blink";return jsxRuntime.jsxs(A,{className:g(B),children:[T&&!b&&jsxRuntime.jsx("span",{"aria-hidden":"true",children:"\u200B"}),b,N&&jsxRuntime.jsx("span",{className:g("tw-cursor",V),"aria-hidden":"true",children:M})]})}exports.TypewriterText=Y;
@@ -0,0 +1 @@
1
+ @keyframes tw-blink{0%,to{opacity:1}50%{opacity:0}}@keyframes tw-cursor-out{0%{opacity:1}80%{opacity:1}to{opacity:0}}.tw-cursor{display:inline-block;line-height:1;vertical-align:baseline;user-select:none;transform:scaleY(.88);transform-origin:50% 90%;color:currentColor}.tw-cursor--blink{animation:tw-blink 1s step-end infinite}.tw-cursor--solid{opacity:1;animation:none}.tw-cursor--out{animation:tw-cursor-out .6s ease-out forwards;pointer-events:none}
@@ -0,0 +1,2 @@
1
+ export { TypewriterText_alias_3 as TypewriterText } from '../_tsup-dts-rollup.cjs';
2
+ export { TypewriterTextProps_alias_2 as TypewriterTextProps } from '../_tsup-dts-rollup.cjs';
@@ -0,0 +1,2 @@
1
+ export { TypewriterText_alias_3 as TypewriterText } from '../_tsup-dts-rollup.js';
2
+ export { TypewriterTextProps_alias_2 as TypewriterTextProps } from '../_tsup-dts-rollup.js';
@@ -0,0 +1 @@
1
+ import {useState,useRef,useEffect}from'react';import {clsx}from'clsx';import {twMerge}from'tailwind-merge';import {jsxs,jsx}from'react/jsx-runtime';function g(...e){return twMerge(clsx(e))}function Y({text:e="",mode:t="typewriter",speed:k=40,cursor:D=true,cursorChar:M="\u258B",thinking:T=false,streaming:o=false,delay:v=0,onComplete:d,as:A="span",className:B}){let[b,i]=useState(t==="instant"?e:""),[u,n]=useState(false),[I,s]=useState(t==="instant"),[R,l]=useState(false),p=useRef(0),h=useRef(d);h.current=d;let f=useRef(e);f.current=e,useEffect(()=>{if(t!=="typewriter")return;if(i(""),s(false),l(false),n(false),!e){s(true);return}let c=Math.max(10,1e3/k),r=0,a,C=()=>{n(true),a=setInterval(()=>{let P=f.current;r++,i(P.slice(0,r)),r>=P.length&&(clearInterval(a),n(false),s(true),h.current?.());},c);},E;return v>0?E=setTimeout(C,v):C(),()=>{clearTimeout(E),clearInterval(a);}},[e,t]),useEffect(()=>{if(t!=="stream")return;if(e.length===0){p.current=0,i(""),n(false),s(false),l(false);return}if(e.length<=p.current)return;let c=Math.max(10,1e3/k),r=p.current;n(true),s(false),l(false);let a=setInterval(()=>{r++,p.current=r,i(f.current.slice(0,r)),r>=f.current.length&&(clearInterval(a),n(false),h.current?.());},c);return ()=>clearInterval(a)},[e,t]),useEffect(()=>{t==="instant"&&(i(e),n(false),s(true));},[e,t]);let x=useRef(o);useEffect(()=>{let c=x.current;if(x.current=o,c&&!o&&!u&&t==="stream"){l(true);let r=setTimeout(()=>{l(false),s(true);},650);return ()=>clearTimeout(r)}},[o,u,t]);let N=D&&(T||u||R||t==="stream"&&o&&!I||t==="typewriter"&&!I),V=T?"tw-cursor--blink":u?"tw-cursor--solid":R?"tw-cursor--out":"tw-cursor--blink";return jsxs(A,{className:g(B),children:[T&&!b&&jsx("span",{"aria-hidden":"true",children:"\u200B"}),b,N&&jsx("span",{className:g("tw-cursor",V),"aria-hidden":"true",children:M})]})}export{Y as TypewriterText};