@tuwaio/nova-core 1.0.0-fix-integrate-orbit-alpha.12.a9a3dcd → 1.0.0-fix-integrate-orbit-alpha.13.0b297c4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.cjs +2 -2
- package/dist/index.cjs.map +1 -1
- package/dist/index.css +5 -0
- package/dist/index.js +2 -2
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
'use strict';var m=require('react'),clsx=require('clsx'),tailwindMerge=require('tailwind-merge'),jsxRuntime=require('react/jsx-runtime'),o=require('@radix-ui/react-dialog'),framerMotion=require('framer-motion');function _interopNamespace(e){if(e&&e.__esModule)return e;var n=Object.create(null);if(e){Object.keys(e).forEach(function(k){if(k!=='default'){var d=Object.getOwnPropertyDescriptor(e,k);Object.defineProperty(n,k,d.get?d:{enumerable:true,get:function(){return e[k]}});}})}n.default=e;return Object.freeze(n)}var m__namespace=/*#__PURE__*/_interopNamespace(m);var o__namespace=/*#__PURE__*/_interopNamespace(o);function l(...e){return tailwindMerge.twMerge(clsx.clsx(e))}var c=e=>e&&typeof e=="object"&&!Array.isArray(e);function P(e,t){let i={...e};return c(e)&&c(t)&&Object.keys(t).forEach(r=>{let a=e[r],n=t[r];c(a)&&c(n)?i[r]=P(a,n):i[r]=n;}),i}function J(e,t,i){if(!e)return "";if(e.length<=t+i)return e;let r=e.slice(0,t),a=e.slice(e.length-i);return `${r}...${a}`}var R=m__namespace.forwardRef(({className:e,...t},i)=>jsxRuntime.jsxs("svg",{ref:i,xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",className:l("h-5 w-5 text-[var(--tuwa-text-primary)] transition-colors",e),...t,children:[jsxRuntime.jsx("path",{d:"M18 6 6 18"}),jsxRuntime.jsx("path",{d:"m6 6 12 12"})]}));R.displayName="CloseIcon";var oe=o__namespace.Root,re=o__namespace.Trigger,N=o__namespace.Portal,ne=o__namespace.Close,M={initial:{opacity:0,scale:.9,y:20},animate:{opacity:1,scale:1,y:0},exit:{opacity:0,scale:.9,transition:{duration:.2}}},k={initial:{opacity:0},animate:{opacity:1},exit:{opacity:0}},x=m__namespace.forwardRef(({className:e,backdropAnimation:t,...i},r)=>jsxRuntime.jsx(framerMotion.AnimatePresence,{children:jsxRuntime.jsx(framerMotion.motion.div,{variants:t??k,transition:{duration:.2,ease:"easeInOut"},animate:"animate",initial:"initial",exit:"exit",className:"relative rounded-t-2xl sm:rounded-2xl overflow-hidden",children:jsxRuntime.jsx(o__namespace.Overlay,{ref:r,className:l("fixed inset-0 z-50 bg-black/55 backdrop-blur-sm backdrop-saturate-150",e),...i})})}));x.displayName=o__namespace.Overlay.displayName;var T=m__namespace.forwardRef(({className:e,children:t,modalAnimation:i,backdropAnimation:r,...a},n)=>jsxRuntime.jsxs(N,{children:[jsxRuntime.jsx(x,{backdropAnimation:r}),jsxRuntime.jsx(o__namespace.Content,{"aria-describedby":"tuwa:modal-content",ref:n,className:l("fixed bottom-0 left-0 p-0 sm:left-[50%] sm:top-[50%] sm:translate-x-[-50%] sm:translate-y-[-50%] z-50 sm:p-4 outline-none",e),...a,children:jsxRuntime.jsx(framerMotion.motion.div,{layout:true,className:"relative overflow-hidden",transition:{layout:{duration:.2,ease:[.1,.1,.2,1]}},children:jsxRuntime.jsx(framerMotion.AnimatePresence,{children:jsxRuntime.jsx(framerMotion.motion.div,{variants:i??M,transition:{duration:.2,ease:"easeInOut"},animate:"animate",initial:"initial",exit:"exit",className:"relative rounded-t-2xl sm:rounded-2xl overflow-hidden",children:jsxRuntime.jsx("div",{className:l("relative flex max-h-[98dvh] w-full flex-col gap-3 overflow-y-auto rounded-t-2xl sm:rounded-2xl shadow-2xl","border border-[var(--tuwa-border-primary)] bg-[var(--tuwa-bg-primary)]"),children:t})})})})})]}));T.displayName=o__namespace.Content.displayName;var E=({className:e,...t})=>jsxRuntime.jsx("div",{"aria-describedby":"tuwa:modal-header",className:l("sticky flex top-0 z-11 w-full flex-row items-center justify-between","border-b border-[var(--tuwa-border-primary)] bg-[var(--tuwa-bg-primary)] p-4",e),...t});E.displayName="DialogHeader";var A=({className:e,...t})=>jsxRuntime.jsx("div",{"aria-describedby":"tuwa:modal-footer",className:l("flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2",e),...t});A.displayName="DialogFooter";var V=m__namespace.forwardRef(({className:e,...t},i)=>jsxRuntime.jsx(o__namespace.Title,{ref:i,"aria-describedby":"tuwa:modal-title",className:l("text-lg font-bold leading-none tracking-tight text-[var(--tuwa-text-primary)] m-0",e),...t}));V.displayName=o__namespace.Title.displayName;var S=m__namespace.forwardRef(({className:e,...t},i)=>jsxRuntime.jsx(o__namespace.Description,{"aria-describedby":"tuwa:modal-description",ref:i,className:l("text-sm text-[var(--tuwa-text-secondary)]",e),...t}));S.displayName=o__namespace.Description.displayName;function ce({starsCount:e}){let[t,i]=m.useState(false);m.useEffect(()=>i(true),[]);let r=m.useMemo(()=>{if(!t)return [];let a=e??200;return Array.from({length:a}).map(()=>({x:Math.random()*window.innerWidth,y:Math.random()*window.innerHeight,r:Math.random()*1+.5,isSupernova:Math.random()<.1,delay:Math.random()*10,duration:5+Math.random()*5}))},[t]);return jsxRuntime.jsx("div",{className:"absolute inset-0 z-1 h-full w-full overflow-hidden",children:jsxRuntime.jsxs("svg",{width:"100%",height:"100%",xmlns:"http://www.w3.org/2000/svg",children:[jsxRuntime.jsx("defs",{children:jsxRuntime.jsx("style",{children:`
|
|
1
|
+
'use strict';var m=require('react'),clsx=require('clsx'),tailwindMerge=require('tailwind-merge'),jsxRuntime=require('react/jsx-runtime'),o=require('@radix-ui/react-dialog'),framerMotion=require('framer-motion');function _interopNamespace(e){if(e&&e.__esModule)return e;var n=Object.create(null);if(e){Object.keys(e).forEach(function(k){if(k!=='default'){var d=Object.getOwnPropertyDescriptor(e,k);Object.defineProperty(n,k,d.get?d:{enumerable:true,get:function(){return e[k]}});}})}n.default=e;return Object.freeze(n)}var m__namespace=/*#__PURE__*/_interopNamespace(m);var o__namespace=/*#__PURE__*/_interopNamespace(o);function l(...e){return tailwindMerge.twMerge(clsx.clsx(e))}var c=e=>e&&typeof e=="object"&&!Array.isArray(e);function P(e,t){let i={...e};return c(e)&&c(t)&&Object.keys(t).forEach(r=>{let a=e[r],n=t[r];c(a)&&c(n)?i[r]=P(a,n):i[r]=n;}),i}function J(e,t,i){if(!e)return "";if(e.length<=t+i)return e;let r=e.slice(0,t),a=e.slice(e.length-i);return `${r}...${a}`}var R=m__namespace.forwardRef(({className:e,...t},i)=>jsxRuntime.jsxs("svg",{ref:i,xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",className:l("h-5 w-5 text-[var(--tuwa-text-primary)] transition-colors",e),...t,children:[jsxRuntime.jsx("path",{d:"M18 6 6 18"}),jsxRuntime.jsx("path",{d:"m6 6 12 12"})]}));R.displayName="CloseIcon";var oe=o__namespace.Root,re=o__namespace.Trigger,N=o__namespace.Portal,ne=o__namespace.Close,M={initial:{opacity:0,scale:.9,y:20},animate:{opacity:1,scale:1,y:0},exit:{opacity:0,scale:.9,transition:{duration:.2}}},k={initial:{opacity:0},animate:{opacity:1},exit:{opacity:0}},x=m__namespace.forwardRef(({className:e,backdropAnimation:t,...i},r)=>jsxRuntime.jsx(framerMotion.AnimatePresence,{children:jsxRuntime.jsx(framerMotion.motion.div,{variants:t??k,transition:{duration:.2,ease:"easeInOut"},animate:"animate",initial:"initial",exit:"exit",className:"relative rounded-t-2xl sm:rounded-2xl overflow-hidden",children:jsxRuntime.jsx(o__namespace.Overlay,{ref:r,className:l("fixed inset-0 z-50 bg-black/55 backdrop-blur-sm backdrop-saturate-150",e),...i})})}));x.displayName=o__namespace.Overlay.displayName;var T=m__namespace.forwardRef(({className:e,children:t,modalAnimation:i,backdropAnimation:r,...a},n)=>jsxRuntime.jsxs(N,{children:[jsxRuntime.jsx(x,{backdropAnimation:r}),jsxRuntime.jsx(o__namespace.Content,{"aria-describedby":"tuwa:modal-content",ref:n,className:l("fixed bottom-0 left-0 p-0 sm:bottom-auto sm:left-[50%] sm:top-[50%] sm:translate-x-[-50%] sm:translate-y-[-50%] z-50 sm:p-4 outline-none",e),...a,children:jsxRuntime.jsx(framerMotion.motion.div,{layout:true,className:"relative overflow-hidden",transition:{layout:{duration:.2,ease:[.1,.1,.2,1]}},children:jsxRuntime.jsx(framerMotion.AnimatePresence,{children:jsxRuntime.jsx(framerMotion.motion.div,{variants:i??M,transition:{duration:.2,ease:"easeInOut"},animate:"animate",initial:"initial",exit:"exit",className:"relative rounded-t-2xl sm:rounded-2xl overflow-hidden",children:jsxRuntime.jsx("div",{className:l("relative flex max-h-[98dvh] w-full flex-col gap-3 overflow-y-auto rounded-t-2xl sm:rounded-2xl shadow-2xl","border border-[var(--tuwa-border-primary)] bg-[var(--tuwa-bg-primary)]"),children:t})})})})})]}));T.displayName=o__namespace.Content.displayName;var E=({className:e,...t})=>jsxRuntime.jsx("div",{"aria-describedby":"tuwa:modal-header",className:l("sticky flex top-0 z-11 w-full flex-row items-center justify-between","border-b border-[var(--tuwa-border-primary)] bg-[var(--tuwa-bg-primary)] p-4",e),...t});E.displayName="DialogHeader";var A=({className:e,...t})=>jsxRuntime.jsx("div",{"aria-describedby":"tuwa:modal-footer",className:l("flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2",e),...t});A.displayName="DialogFooter";var V=m__namespace.forwardRef(({className:e,...t},i)=>jsxRuntime.jsx(o__namespace.Title,{ref:i,"aria-describedby":"tuwa:modal-title",className:l("text-lg font-bold leading-none tracking-tight text-[var(--tuwa-text-primary)] m-0",e),...t}));V.displayName=o__namespace.Title.displayName;var S=m__namespace.forwardRef(({className:e,...t},i)=>jsxRuntime.jsx(o__namespace.Description,{"aria-describedby":"tuwa:modal-description",ref:i,className:l("text-sm text-[var(--tuwa-text-secondary)]",e),...t}));S.displayName=o__namespace.Description.displayName;function ce({starsCount:e}){let[t,i]=m.useState(false);m.useEffect(()=>i(true),[]);let r=m.useMemo(()=>{if(!t)return [];let a=e??200;return Array.from({length:a}).map(()=>({x:Math.random()*window.innerWidth,y:Math.random()*window.innerHeight,r:Math.random()*1+.5,isSupernova:Math.random()<.1,delay:Math.random()*10,duration:5+Math.random()*5}))},[t]);return jsxRuntime.jsx("div",{className:"absolute inset-0 z-1 h-full w-full overflow-hidden",children:jsxRuntime.jsxs("svg",{width:"100%",height:"100%",xmlns:"http://www.w3.org/2000/svg",children:[jsxRuntime.jsx("defs",{children:jsxRuntime.jsx("style",{children:`
|
|
2
2
|
/* Pulse animation now includes scale for a more organic feel. */
|
|
3
3
|
@keyframes pulse {
|
|
4
4
|
0%, 100% {
|
|
@@ -44,5 +44,5 @@
|
|
|
44
44
|
transform-origin: center;
|
|
45
45
|
stroke-width: 2;
|
|
46
46
|
}
|
|
47
|
-
`})}),r.map((a,n)=>jsxRuntime.jsx("circle",{cx:a.x,cy:a.y,r:a.r,fill:"rgba(var(--tuwa-bg-primary), 0.7)",className:a.isSupernova?"supernova":"pulsar",style:{animationDelay:`${a.delay}s`,animationDuration:`${a.duration}s`}},n))]})})}function
|
|
47
|
+
`})}),r.map((a,n)=>jsxRuntime.jsx("circle",{cx:a.x,cy:a.y,r:a.r,fill:"rgba(var(--tuwa-bg-primary), 0.7)",className:a.isSupernova?"supernova":"pulsar",style:{animationDelay:`${a.delay}s`,animationDuration:`${a.duration}s`}},n))]})})}function fe(e=2e3){let[t,i]=m.useState(false),[r,a]=m.useState(null),n=m.useCallback(async u=>{if(u)try{await navigator.clipboard.writeText(u),i(!0),a(null),setTimeout(()=>i(!1),e);}catch(f){let g=f instanceof Error?f:new Error("Failed to copy text.");console.error(g),a(g),setTimeout(()=>a(null),e);}},[e]);return {isCopied:t,copy:n,error:r}}function ve(e){let t=a=>typeof window<"u"?window.matchMedia(a).matches:false,[i,r]=m.useState(t(e));return m.useEffect(()=>{let a=window.matchMedia(e),n=()=>r(a.matches);return n(),window.addEventListener("resize",n),()=>window.removeEventListener("resize",n)},[e]),i}exports.CloseIcon=R;exports.Dialog=oe;exports.DialogClose=ne;exports.DialogContent=T;exports.DialogDescription=S;exports.DialogFooter=A;exports.DialogHeader=E;exports.DialogOverlay=x;exports.DialogPortal=N;exports.DialogTitle=V;exports.DialogTrigger=re;exports.StarsBackground=ce;exports.cn=l;exports.deepMerge=P;exports.textCenterEllipsis=J;exports.useCopyToClipboard=fe;exports.useMediaQuery=ve;//# sourceMappingURL=index.cjs.map
|
|
48
48
|
//# sourceMappingURL=index.cjs.map
|
package/dist/index.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/utils/cn.ts","../src/utils/deepMerge.ts","../src/utils/textCenterEllipsis.ts","../src/components/CloseIcon.tsx","../src/components/Modal.tsx","../src/components/StarsBackground.tsx","../src/hooks/useCopyToClipboard.ts","../src/hooks/useMediaQuery.ts"],"names":["cn","inputs","twMerge","clsx","isObject","item","deepMerge","target","source","output","key","targetValue","sourceValue","textCenterEllipsis","str","from","to","start","end","CloseIcon","v","className","props","ref","jsxs","jsx","Dialog","o","DialogTrigger","DialogPortal","DialogClose","defaultModalAnimation","defaultModalBackdropAnimation","DialogOverlay","m","backdropAnimation","AnimatePresence","motion","DialogContent","children","modalAnimation","DialogHeader","DialogFooter","DialogTitle","DialogDescription","StarsBackground","starsCount","isMounted","setIsMounted","useState","useEffect","stars","useMemo","numStars","star","i","useCopyToClipboard","timeout","isCopied","setIsCopied","error","setError","copy","useCallback","text","e","copyError","useMediaQuery","query","getMatches","q","matches","setMatches","media","listener"],"mappings":"4mBAwBO,SAASA,CAAAA,CAAAA,GAAMC,CAAAA,CAA8B,CAClD,OAAOC,qBAAAA,CAAQC,UAAKF,CAAM,CAAC,CAC7B,CChBA,IAAMG,CAAAA,C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SAAA,CAAU,UAAUA,CAAI,CAAA,CACxCL,CAAAA,CAAY,CAAA,CAAI,CAAA,CAChBE,CAAAA,CAAS,IAAI,CAAA,CAEb,UAAA,CAAW,IAAMF,CAAAA,CAAY,CAAA,CAAK,CAAA,CAAGF,CAAO,EAC9C,CAAA,MAASQ,CAAAA,CAAG,CACV,IAAMC,CAAAA,CAAYD,aAAa,KAAA,CAAQA,CAAAA,CAAI,IAAI,KAAA,CAAM,sBAAsB,EAC3E,OAAA,CAAQ,KAAA,CAAMC,CAAS,CAAA,CACvBL,CAAAA,CAASK,CAAS,EAGlB,UAAA,CAAW,IAAML,EAAS,IAAI,CAAA,CAAGJ,CAAO,EAC1C,CACF,CAAA,CACA,CAACA,CAAO,CACV,EAEA,OAAO,CAAE,SAAAC,CAAAA,CAAU,IAAA,CAAAI,EAAM,KAAA,CAAAF,CAAM,CACjC,CCpDO,SAASO,EAAAA,CAAcC,EAAwB,CACpD,IAAMC,CAAAA,CAAcC,CAAAA,EACd,OAAO,MAAA,CAAW,IACb,MAAA,CAAO,UAAA,CAAWA,CAAC,CAAA,CAAE,OAAA,CAEvB,MAGH,CAACC,CAAAA,CAASC,CAAU,CAAA,CAAIvB,UAAAA,CAAkBoB,CAAAA,CAAWD,CAAK,CAAC,CAAA,CAEjE,OAAAlB,WAAAA,CAAU,IAAM,CACd,IAAMuB,CAAAA,CAAQ,MAAA,CAAO,UAAA,CAAWL,CAAK,CAAA,CAC/BM,EAAW,IAAMF,CAAAA,CAAWC,EAAM,OAAO,CAAA,CAG/C,OAAAC,CAAAA,EAAS,CACT,MAAA,CAAO,gBAAA,CAAiB,QAAA,CAAUA,CAAQ,EAEnC,IAAM,MAAA,CAAO,mBAAA,CAAoB,QAAA,CAAUA,CAAQ,CAC5D,EAAG,CAACN,CAAK,CAAC,CAAA,CAEHG,CACT","file":"index.cjs","sourcesContent":["/**\n * @file This file contains a utility function for conditionally merging Tailwind CSS classes.\n */\n\nimport { type ClassValue, clsx } from 'clsx';\nimport { twMerge } from 'tailwind-merge';\n\n/**\n * A utility function to conditionally join class names together and resolve\n * conflicting Tailwind CSS classes.\n *\n * It combines the functionality of `clsx` and `tailwind-merge`.\n *\n * @param {...ClassValue[]} inputs - A list of class values to be combined.\n * This can include strings, numbers, objects, arrays, and booleans.\n * @returns {string} The final, merged class name string.\n *\n * @example\n * cn('p-4', 'bg-red-500', { 'font-bold': true }); // => 'p-4 bg-red-500 font-bold'\n * cn('p-2', 'p-4'); // => 'p-4' (tailwind-merge resolves the conflict)\n *\n * @see https://github.com/dcastil/tailwind-merge\n * @see https://github.com/lukeed/clsx\n */\nexport function cn(...inputs: ClassValue[]): string {\n return twMerge(clsx(inputs));\n}\n","/**\n * @file This file contains a utility for performing a deep (recursive) merge of two objects.\n */\n\n/**\n * Checks if the provided item is a plain object (i.e., not null and not an array).\n *\n * @param {any} item - The item to check.\n * @returns {item is Record<string, any>} True if the item is a plain object, otherwise false.\n */\nconst isObject = (item: any): item is Record<string, any> => {\n return item && typeof item === 'object' && !Array.isArray(item);\n};\n\n/**\n * Recursively merges the properties of a source object into a target object.\n * This function creates a new object and does not mutate the original target.\n *\n * @template T - The type of the objects being merged.\n * @param {T} target - The base object.\n * @param {Partial<T>} source - The object with properties to merge into the target.\n * @returns {T} A new object representing the merged result.\n *\n * @example\n * const defaults = { a: 1, b: { c: 2, d: 3 } };\n * const custom = { b: { c: 99 } };\n * const result = deepMerge(defaults, custom);\n * // result will be { a: 1, b: { c: 99, d: 3 } }\n */\nexport function deepMerge<T extends object>(target: T, source: Partial<T>): T {\n // Start with a shallow copy of the target to avoid mutation.\n const output = { ...target };\n\n if (isObject(target) && isObject(source)) {\n // Iterate over the keys in the source object.\n Object.keys(source).forEach((key) => {\n const targetValue = target[key as keyof T];\n const sourceValue = source[key as keyof T];\n\n // If the value is an object in both target and source, merge them recursively.\n if (isObject(targetValue) && isObject(sourceValue)) {\n // eslint-disable-next-line @typescript-eslint/ban-ts-comment\n // @ts-expect-error\n (output as Record<string, any>)[key] = deepMerge(targetValue, sourceValue);\n } else {\n // Otherwise, the source value overwrites the target value.\n (output as Record<string, any>)[key] = sourceValue;\n }\n });\n }\n\n return output;\n}\n","/**\n * @file This file contains a utility function for truncating a string with a center ellipsis.\n */\n\n/**\n * Truncates a string by showing a specified number of characters from the start and end,\n * with an ellipsis in the middle. If the string is too short to be truncated, it's returned as is.\n *\n * @param {string} str - The string to truncate.\n * @param {number} from - The number of characters to show from the beginning of the string.\n * @param {number} to - The number of characters to show from the end of the string.\n * @returns {string} The truncated string, or the original string if it's too short.\n *\n * @example\n * const hash = '0x1234567890abcdef1234567890abcdef';\n * textCenterEllipsis(hash, 6, 4); // => \"0x1234...cdef\"\n *\n * textCenterEllipsis('short', 6, 4); // => \"short\"\n */\nexport function textCenterEllipsis(str: string | undefined | null, from: number, to: number): string {\n if (!str) {\n return '';\n }\n\n // If the string is short enough, don't truncate it.\n if (str.length <= from + to) {\n return str;\n }\n\n const start = str.slice(0, from);\n const end = str.slice(str.length - to);\n\n return `${start}...${end}`;\n}\n","import * as React from 'react';\n\nimport { cn } from '../utils';\n\n/**\n * A reusable close button icon (X mark) styled with TUWA color scheme.\n */\nexport const CloseIcon = React.forwardRef<SVGSVGElement, React.SVGAttributes<SVGSVGElement>>(\n ({ className, ...props }, ref) => (\n <svg\n ref={ref}\n xmlns=\"http://www.w3.org/2000/svg\"\n viewBox=\"0 0 24 24\"\n fill=\"none\"\n stroke=\"currentColor\"\n strokeWidth=\"2\"\n strokeLinecap=\"round\"\n strokeLinejoin=\"round\"\n className={cn('h-5 w-5 text-[var(--tuwa-text-primary)] transition-colors', className)}\n {...props}\n >\n <path d=\"M18 6 6 18\" />\n <path d=\"m6 6 12 12\" />\n </svg>\n ),\n);\nCloseIcon.displayName = 'CloseIcon';\n","import * as DialogPrimitive from '@radix-ui/react-dialog';\nimport { AnimatePresence, motion, Variants } from 'framer-motion';\nimport * as React from 'react';\n\nimport { cn } from '../utils';\n\nconst Dialog = DialogPrimitive.Root;\nconst DialogTrigger = DialogPrimitive.Trigger;\nconst DialogPortal = DialogPrimitive.Portal;\nconst DialogClose = DialogPrimitive.Close;\n\nconst defaultModalAnimation: Variants = {\n initial: { opacity: 0, scale: 0.9, y: 20 },\n animate: { opacity: 1, scale: 1, y: 0 },\n exit: {\n opacity: 0,\n scale: 0.9,\n transition: {\n duration: 0.2,\n },\n },\n};\n\nconst defaultModalBackdropAnimation: Variants = {\n initial: { opacity: 0 },\n animate: { opacity: 1 },\n exit: { opacity: 0 },\n};\n\nconst DialogOverlay = React.forwardRef<\n React.ElementRef<typeof DialogPrimitive.Overlay>,\n React.ComponentPropsWithoutRef<typeof DialogPrimitive.Overlay> & {\n backdropAnimation?: Variants;\n }\n>(({ className, backdropAnimation, ...props }, ref) => (\n <AnimatePresence>\n <motion.div\n variants={backdropAnimation ?? defaultModalBackdropAnimation}\n transition={{ duration: 0.2, ease: 'easeInOut' }}\n animate=\"animate\"\n initial=\"initial\"\n exit=\"exit\"\n className=\"relative rounded-t-2xl sm:rounded-2xl overflow-hidden\"\n >\n <DialogPrimitive.Overlay\n ref={ref}\n className={cn('fixed inset-0 z-50 bg-black/55 backdrop-blur-sm backdrop-saturate-150', className)}\n {...props}\n />\n </motion.div>\n </AnimatePresence>\n));\nDialogOverlay.displayName = DialogPrimitive.Overlay.displayName;\n\nconst DialogContent = React.forwardRef<\n React.ElementRef<typeof DialogPrimitive.Content>,\n React.ComponentPropsWithoutRef<typeof DialogPrimitive.Content> & {\n modalAnimation?: Variants;\n backdropAnimation?: Variants;\n }\n>(({ className, children, modalAnimation, backdropAnimation, ...props }, ref) => (\n <DialogPortal>\n <DialogOverlay backdropAnimation={backdropAnimation} />\n\n <DialogPrimitive.Content\n aria-describedby=\"tuwa:modal-content\"\n ref={ref}\n className={cn(\n 'fixed bottom-0 left-0 p-0 sm:left-[50%] sm:top-[50%] sm:translate-x-[-50%] sm:translate-y-[-50%] z-50 sm:p-4 outline-none',\n className,\n )}\n {...props}\n >\n <motion.div\n layout\n className=\"relative overflow-hidden\"\n transition={{\n layout: {\n duration: 0.2,\n ease: [0.1, 0.1, 0.2, 1],\n },\n }}\n >\n <AnimatePresence>\n <motion.div\n variants={modalAnimation ?? defaultModalAnimation}\n transition={{ duration: 0.2, ease: 'easeInOut' }}\n animate=\"animate\"\n initial=\"initial\"\n exit=\"exit\"\n className=\"relative rounded-t-2xl sm:rounded-2xl overflow-hidden\"\n >\n <div\n className={cn(\n 'relative flex max-h-[98dvh] w-full flex-col gap-3 overflow-y-auto rounded-t-2xl sm:rounded-2xl shadow-2xl',\n 'border border-[var(--tuwa-border-primary)] bg-[var(--tuwa-bg-primary)]',\n )}\n >\n {children}\n </div>\n </motion.div>\n </AnimatePresence>\n </motion.div>\n </DialogPrimitive.Content>\n </DialogPortal>\n));\nDialogContent.displayName = DialogPrimitive.Content.displayName;\n\nconst DialogHeader = ({ className, ...props }: React.HTMLAttributes<HTMLDivElement>) => (\n <div\n aria-describedby=\"tuwa:modal-header\"\n className={cn(\n 'sticky flex top-0 z-11 w-full flex-row items-center justify-between',\n 'border-b border-[var(--tuwa-border-primary)] bg-[var(--tuwa-bg-primary)] p-4',\n className,\n )}\n {...props}\n />\n);\nDialogHeader.displayName = 'DialogHeader';\n\nconst DialogFooter = ({ className, ...props }: React.HTMLAttributes<HTMLDivElement>) => (\n <div\n aria-describedby=\"tuwa:modal-footer\"\n className={cn('flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2', className)}\n {...props}\n />\n);\nDialogFooter.displayName = 'DialogFooter';\n\nconst DialogTitle = React.forwardRef<\n React.ElementRef<typeof DialogPrimitive.Title>,\n React.ComponentPropsWithoutRef<typeof DialogPrimitive.Title>\n>(({ className, ...props }, ref) => (\n <DialogPrimitive.Title\n ref={ref}\n aria-describedby=\"tuwa:modal-title\"\n className={cn('text-lg font-bold leading-none tracking-tight text-[var(--tuwa-text-primary)] m-0', className)}\n {...props}\n />\n));\nDialogTitle.displayName = DialogPrimitive.Title.displayName;\n\nconst DialogDescription = React.forwardRef<\n React.ElementRef<typeof DialogPrimitive.Description>,\n React.ComponentPropsWithoutRef<typeof DialogPrimitive.Description>\n>(({ className, ...props }, ref) => (\n <DialogPrimitive.Description\n aria-describedby=\"tuwa:modal-description\"\n ref={ref}\n className={cn('text-sm text-[var(--tuwa-text-secondary)]', className)}\n {...props}\n />\n));\nDialogDescription.displayName = DialogPrimitive.Description.displayName;\n\nexport {\n Dialog,\n DialogClose,\n DialogContent,\n DialogDescription,\n DialogFooter,\n DialogHeader,\n DialogOverlay,\n DialogPortal,\n DialogTitle,\n DialogTrigger,\n};\n","import { useEffect, useMemo, useState } from 'react';\n\nexport function StarsBackground({ starsCount }: { starsCount?: number }) {\n const [isMounted, setIsMounted] = useState(false);\n useEffect(() => setIsMounted(true), []);\n\n const stars = useMemo(() => {\n if (!isMounted) {\n return [];\n }\n\n const numStars = starsCount ?? 200;\n return Array.from({ length: numStars }).map(() => ({\n x: Math.random() * window.innerWidth,\n y: Math.random() * window.innerHeight,\n r: Math.random() * 1 + 0.5,\n isSupernova: Math.random() < 0.1,\n delay: Math.random() * 10,\n duration: 5 + Math.random() * 5,\n }));\n }, [isMounted]);\n\n return (\n <div className=\"absolute inset-0 z-1 h-full w-full overflow-hidden\">\n <svg width=\"100%\" height=\"100%\" xmlns=\"http://www.w3.org/2000/svg\">\n <defs>\n <style>\n {`\n /* Pulse animation now includes scale for a more organic feel. */\n @keyframes pulse {\n 0%, 100% { \n opacity: 0.2;\n transform: scale(0.9);\n }\n 50% {\n opacity: 0.8;\n transform: scale(1.2);\n }\n }\n \n /* Supernova animation remains impactful. */\n @keyframes supernova {\n 0% { \n transform: scale(1);\n stroke: rgba(var(--tuwa-bg-primary), 0.5);\n opacity: 0.8;\n }\n 20% { \n transform: scale(3);\n stroke: var(--tuwa-button-gradient-from);\n opacity: 1;\n }\n 100% { \n transform: scale(0.8);\n stroke: var(--tuwa-button-gradient-to);\n opacity: 0;\n }\n }\n\n .pulsar {\n animation-name: pulse;\n animation-timing-function: ease-in-out;\n animation-iteration-count: infinite;\n transform-origin: center;\n }\n\n .supernova {\n animation-name: supernova;\n animation-timing-function: ease-out;\n animation-iteration-count: infinite;\n transform-origin: center;\n stroke-width: 2;\n }\n `}\n </style>\n </defs>\n\n {stars.map((star, i) => (\n <circle\n key={i}\n cx={star.x}\n cy={star.y}\n r={star.r}\n fill={`rgba(var(--tuwa-bg-primary), 0.7)`}\n className={star.isSupernova ? 'supernova' : 'pulsar'}\n style={{\n animationDelay: `${star.delay}s`,\n animationDuration: `${star.duration}s`,\n }}\n />\n ))}\n </svg>\n </div>\n );\n}\n","/**\n * @file This file contains a custom React hook for copying text to the clipboard.\n */\n\nimport { useCallback, useState } from 'react';\n\n/**\n * A custom React hook that provides functionality to copy text to the clipboard.\n * It also manages a \"copied\" state with a timeout for user feedback.\n *\n * @param {number} [timeout=2000] - The duration in milliseconds to keep the `isCopied` state as true.\n * @returns {{\n * isCopied: boolean;\n * copy: (text: string) => Promise<void>;\n * error: Error | null;\n * }} An object containing the `isCopied` state, the `copy` function, and any potential error.\n *\n * @example\n * const MyComponent = () => {\n * const { isCopied, copy } = useCopyToClipboard();\n * const textToCopy = '0x123...';\n *\n * return (\n * <button onClick={() => copy(textToCopy)}>\n * {isCopied ? 'Copied!' : 'Copy Address'}\n * </button>\n * );\n * }\n */\nexport function useCopyToClipboard(timeout = 2000): {\n isCopied: boolean;\n copy: (text: string) => Promise<void>;\n error: Error | null;\n} {\n const [isCopied, setIsCopied] = useState(false);\n const [error, setError] = useState<Error | null>(null);\n\n const copy = useCallback(\n async (text: string) => {\n if (!text) return;\n\n try {\n await navigator.clipboard.writeText(text);\n setIsCopied(true);\n setError(null);\n\n setTimeout(() => setIsCopied(false), timeout);\n } catch (e) {\n const copyError = e instanceof Error ? e : new Error('Failed to copy text.');\n console.error(copyError);\n setError(copyError);\n\n // Reset error state after timeout as well\n setTimeout(() => setError(null), timeout);\n }\n },\n [timeout],\n );\n\n return { isCopied, copy, error };\n}\n","import { useEffect, useState } from 'react';\n\n/**\n * A custom hook to detect if a media query matches the current screen dimensions.\n * Handles SSR gracefully.\n * @param {string} query - The media query string (e.g., '(max-width: 767px)').\n * @returns {boolean} Whether the query matches or not.\n */\nexport function useMediaQuery(query: string): boolean {\n const getMatches = (q: string): boolean => {\n if (typeof window !== 'undefined') {\n return window.matchMedia(q).matches;\n }\n return false;\n };\n\n const [matches, setMatches] = useState<boolean>(getMatches(query));\n\n useEffect(() => {\n const media = window.matchMedia(query);\n const listener = () => setMatches(media.matches);\n\n // Re-check on mount and subscribe to changes\n listener();\n window.addEventListener('resize', listener);\n\n return () => window.removeEventListener('resize', listener);\n }, [query]);\n\n return matches;\n}\n"]}
|
|
1
|
+
{"version":3,"sources":["../src/utils/cn.ts","../src/utils/deepMerge.ts","../src/utils/textCenterEllipsis.ts","../src/components/CloseIcon.tsx","../src/components/Modal.tsx","../src/components/StarsBackground.tsx","../src/hooks/useCopyToClipboard.ts","../src/hooks/useMediaQuery.ts"],"names":["cn","inputs","twMerge","clsx","isObject","item","deepMerge","target","source","output","key","targetValue","sourceValue","textCenterEllipsis","str","from","to","start","end","CloseIcon","v","className","props","ref","jsxs","jsx","Dialog","o","DialogTrigger","DialogPortal","DialogClose","defaultModalAnimation","defaultModalBackdropAnimation","DialogOverlay","m","backdropAnimation","AnimatePresence","motion","DialogContent","children","modalAnimation","DialogHeader","DialogFooter","DialogTitle","DialogDescription","StarsBackground","starsCount","isMounted","setIsMounted","useState","useEffect","stars","useMemo","numStars","star","i","useCopyToClipboard","timeout","isCopied","setIsCopied","error","setError","copy","useCallback","text","e","copyError","useMediaQuery","query","getMatches","q","matches","setMatches","media","listener"],"mappings":"4mBAwBO,SAASA,CAAAA,CAAAA,GAAMC,CAAAA,CAA8B,CAClD,OAAOC,qBAAAA,CAAQC,UAAKF,CAAM,CAAC,CAC7B,CChBA,IAAMG,CAAAA,CAAYC,CAAAA,EACTA,CAAAA,EAAQ,OAAOA,GAAS,QAAA,EAAY,CAAC,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AAA,CAChBE,CAAAA,CAAS,IAAI,CAAA,CAEb,UAAA,CAAW,IAAMF,CAAAA,CAAY,CAAA,CAAK,CAAA,CAAGF,CAAO,EAC9C,CAAA,MAASQ,CAAAA,CAAG,CACV,IAAMC,CAAAA,CAAYD,aAAa,KAAA,CAAQA,CAAAA,CAAI,IAAI,KAAA,CAAM,sBAAsB,EAC3E,OAAA,CAAQ,KAAA,CAAMC,CAAS,CAAA,CACvBL,CAAAA,CAASK,CAAS,EAGlB,UAAA,CAAW,IAAML,EAAS,IAAI,CAAA,CAAGJ,CAAO,EAC1C,CACF,CAAA,CACA,CAACA,CAAO,CACV,EAEA,OAAO,CAAE,SAAAC,CAAAA,CAAU,IAAA,CAAAI,EAAM,KAAA,CAAAF,CAAM,CACjC,CCpDO,SAASO,EAAAA,CAAcC,EAAwB,CACpD,IAAMC,CAAAA,CAAcC,CAAAA,EACd,OAAO,MAAA,CAAW,IACb,MAAA,CAAO,UAAA,CAAWA,CAAC,CAAA,CAAE,OAAA,CAEvB,MAGH,CAACC,CAAAA,CAASC,CAAU,CAAA,CAAIvB,UAAAA,CAAkBoB,CAAAA,CAAWD,CAAK,CAAC,CAAA,CAEjE,OAAAlB,WAAAA,CAAU,IAAM,CACd,IAAMuB,CAAAA,CAAQ,MAAA,CAAO,UAAA,CAAWL,CAAK,CAAA,CAC/BM,EAAW,IAAMF,CAAAA,CAAWC,EAAM,OAAO,CAAA,CAG/C,OAAAC,CAAAA,EAAS,CACT,MAAA,CAAO,gBAAA,CAAiB,QAAA,CAAUA,CAAQ,EAEnC,IAAM,MAAA,CAAO,mBAAA,CAAoB,QAAA,CAAUA,CAAQ,CAC5D,EAAG,CAACN,CAAK,CAAC,CAAA,CAEHG,CACT","file":"index.cjs","sourcesContent":["/**\n * @file This file contains a utility function for conditionally merging Tailwind CSS classes.\n */\n\nimport { type ClassValue, clsx } from 'clsx';\nimport { twMerge } from 'tailwind-merge';\n\n/**\n * A utility function to conditionally join class names together and resolve\n * conflicting Tailwind CSS classes.\n *\n * It combines the functionality of `clsx` and `tailwind-merge`.\n *\n * @param {...ClassValue[]} inputs - A list of class values to be combined.\n * This can include strings, numbers, objects, arrays, and booleans.\n * @returns {string} The final, merged class name string.\n *\n * @example\n * cn('p-4', 'bg-red-500', { 'font-bold': true }); // => 'p-4 bg-red-500 font-bold'\n * cn('p-2', 'p-4'); // => 'p-4' (tailwind-merge resolves the conflict)\n *\n * @see https://github.com/dcastil/tailwind-merge\n * @see https://github.com/lukeed/clsx\n */\nexport function cn(...inputs: ClassValue[]): string {\n return twMerge(clsx(inputs));\n}\n","/**\n * @file This file contains a utility for performing a deep (recursive) merge of two objects.\n */\n\n/**\n * Checks if the provided item is a plain object (i.e., not null and not an array).\n *\n * @param {any} item - The item to check.\n * @returns {item is Record<string, any>} True if the item is a plain object, otherwise false.\n */\nconst isObject = (item: any): item is Record<string, any> => {\n return item && typeof item === 'object' && !Array.isArray(item);\n};\n\n/**\n * Recursively merges the properties of a source object into a target object.\n * This function creates a new object and does not mutate the original target.\n *\n * @template T - The type of the objects being merged.\n * @param {T} target - The base object.\n * @param {Partial<T>} source - The object with properties to merge into the target.\n * @returns {T} A new object representing the merged result.\n *\n * @example\n * const defaults = { a: 1, b: { c: 2, d: 3 } };\n * const custom = { b: { c: 99 } };\n * const result = deepMerge(defaults, custom);\n * // result will be { a: 1, b: { c: 99, d: 3 } }\n */\nexport function deepMerge<T extends object>(target: T, source: Partial<T>): T {\n // Start with a shallow copy of the target to avoid mutation.\n const output = { ...target };\n\n if (isObject(target) && isObject(source)) {\n // Iterate over the keys in the source object.\n Object.keys(source).forEach((key) => {\n const targetValue = target[key as keyof T];\n const sourceValue = source[key as keyof T];\n\n // If the value is an object in both target and source, merge them recursively.\n if (isObject(targetValue) && isObject(sourceValue)) {\n // eslint-disable-next-line @typescript-eslint/ban-ts-comment\n // @ts-expect-error\n (output as Record<string, any>)[key] = deepMerge(targetValue, sourceValue);\n } else {\n // Otherwise, the source value overwrites the target value.\n (output as Record<string, any>)[key] = sourceValue;\n }\n });\n }\n\n return output;\n}\n","/**\n * @file This file contains a utility function for truncating a string with a center ellipsis.\n */\n\n/**\n * Truncates a string by showing a specified number of characters from the start and end,\n * with an ellipsis in the middle. If the string is too short to be truncated, it's returned as is.\n *\n * @param {string} str - The string to truncate.\n * @param {number} from - The number of characters to show from the beginning of the string.\n * @param {number} to - The number of characters to show from the end of the string.\n * @returns {string} The truncated string, or the original string if it's too short.\n *\n * @example\n * const hash = '0x1234567890abcdef1234567890abcdef';\n * textCenterEllipsis(hash, 6, 4); // => \"0x1234...cdef\"\n *\n * textCenterEllipsis('short', 6, 4); // => \"short\"\n */\nexport function textCenterEllipsis(str: string | undefined | null, from: number, to: number): string {\n if (!str) {\n return '';\n }\n\n // If the string is short enough, don't truncate it.\n if (str.length <= from + to) {\n return str;\n }\n\n const start = str.slice(0, from);\n const end = str.slice(str.length - to);\n\n return `${start}...${end}`;\n}\n","import * as React from 'react';\n\nimport { cn } from '../utils';\n\n/**\n * A reusable close button icon (X mark) styled with TUWA color scheme.\n */\nexport const CloseIcon = React.forwardRef<SVGSVGElement, React.SVGAttributes<SVGSVGElement>>(\n ({ className, ...props }, ref) => (\n <svg\n ref={ref}\n xmlns=\"http://www.w3.org/2000/svg\"\n viewBox=\"0 0 24 24\"\n fill=\"none\"\n stroke=\"currentColor\"\n strokeWidth=\"2\"\n strokeLinecap=\"round\"\n strokeLinejoin=\"round\"\n className={cn('h-5 w-5 text-[var(--tuwa-text-primary)] transition-colors', className)}\n {...props}\n >\n <path d=\"M18 6 6 18\" />\n <path d=\"m6 6 12 12\" />\n </svg>\n ),\n);\nCloseIcon.displayName = 'CloseIcon';\n","import * as DialogPrimitive from '@radix-ui/react-dialog';\nimport { AnimatePresence, motion, Variants } from 'framer-motion';\nimport * as React from 'react';\n\nimport { cn } from '../utils';\n\nconst Dialog = DialogPrimitive.Root;\nconst DialogTrigger = DialogPrimitive.Trigger;\nconst DialogPortal = DialogPrimitive.Portal;\nconst DialogClose = DialogPrimitive.Close;\n\nconst defaultModalAnimation: Variants = {\n initial: { opacity: 0, scale: 0.9, y: 20 },\n animate: { opacity: 1, scale: 1, y: 0 },\n exit: {\n opacity: 0,\n scale: 0.9,\n transition: {\n duration: 0.2,\n },\n },\n};\n\nconst defaultModalBackdropAnimation: Variants = {\n initial: { opacity: 0 },\n animate: { opacity: 1 },\n exit: { opacity: 0 },\n};\n\nconst DialogOverlay = React.forwardRef<\n React.ElementRef<typeof DialogPrimitive.Overlay>,\n React.ComponentPropsWithoutRef<typeof DialogPrimitive.Overlay> & {\n backdropAnimation?: Variants;\n }\n>(({ className, backdropAnimation, ...props }, ref) => (\n <AnimatePresence>\n <motion.div\n variants={backdropAnimation ?? defaultModalBackdropAnimation}\n transition={{ duration: 0.2, ease: 'easeInOut' }}\n animate=\"animate\"\n initial=\"initial\"\n exit=\"exit\"\n className=\"relative rounded-t-2xl sm:rounded-2xl overflow-hidden\"\n >\n <DialogPrimitive.Overlay\n ref={ref}\n className={cn('fixed inset-0 z-50 bg-black/55 backdrop-blur-sm backdrop-saturate-150', className)}\n {...props}\n />\n </motion.div>\n </AnimatePresence>\n));\nDialogOverlay.displayName = DialogPrimitive.Overlay.displayName;\n\nconst DialogContent = React.forwardRef<\n React.ElementRef<typeof DialogPrimitive.Content>,\n React.ComponentPropsWithoutRef<typeof DialogPrimitive.Content> & {\n modalAnimation?: Variants;\n backdropAnimation?: Variants;\n }\n>(({ className, children, modalAnimation, backdropAnimation, ...props }, ref) => (\n <DialogPortal>\n <DialogOverlay backdropAnimation={backdropAnimation} />\n\n <DialogPrimitive.Content\n aria-describedby=\"tuwa:modal-content\"\n ref={ref}\n className={cn(\n 'fixed bottom-0 left-0 p-0 sm:bottom-auto sm:left-[50%] sm:top-[50%] sm:translate-x-[-50%] sm:translate-y-[-50%] z-50 sm:p-4 outline-none',\n className,\n )}\n {...props}\n >\n <motion.div\n layout\n className=\"relative overflow-hidden\"\n transition={{\n layout: {\n duration: 0.2,\n ease: [0.1, 0.1, 0.2, 1],\n },\n }}\n >\n <AnimatePresence>\n <motion.div\n variants={modalAnimation ?? defaultModalAnimation}\n transition={{ duration: 0.2, ease: 'easeInOut' }}\n animate=\"animate\"\n initial=\"initial\"\n exit=\"exit\"\n className=\"relative rounded-t-2xl sm:rounded-2xl overflow-hidden\"\n >\n <div\n className={cn(\n 'relative flex max-h-[98dvh] w-full flex-col gap-3 overflow-y-auto rounded-t-2xl sm:rounded-2xl shadow-2xl',\n 'border border-[var(--tuwa-border-primary)] bg-[var(--tuwa-bg-primary)]',\n )}\n >\n {children}\n </div>\n </motion.div>\n </AnimatePresence>\n </motion.div>\n </DialogPrimitive.Content>\n </DialogPortal>\n));\nDialogContent.displayName = DialogPrimitive.Content.displayName;\n\nconst DialogHeader = ({ className, ...props }: React.HTMLAttributes<HTMLDivElement>) => (\n <div\n aria-describedby=\"tuwa:modal-header\"\n className={cn(\n 'sticky flex top-0 z-11 w-full flex-row items-center justify-between',\n 'border-b border-[var(--tuwa-border-primary)] bg-[var(--tuwa-bg-primary)] p-4',\n className,\n )}\n {...props}\n />\n);\nDialogHeader.displayName = 'DialogHeader';\n\nconst DialogFooter = ({ className, ...props }: React.HTMLAttributes<HTMLDivElement>) => (\n <div\n aria-describedby=\"tuwa:modal-footer\"\n className={cn('flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2', className)}\n {...props}\n />\n);\nDialogFooter.displayName = 'DialogFooter';\n\nconst DialogTitle = React.forwardRef<\n React.ElementRef<typeof DialogPrimitive.Title>,\n React.ComponentPropsWithoutRef<typeof DialogPrimitive.Title>\n>(({ className, ...props }, ref) => (\n <DialogPrimitive.Title\n ref={ref}\n aria-describedby=\"tuwa:modal-title\"\n className={cn('text-lg font-bold leading-none tracking-tight text-[var(--tuwa-text-primary)] m-0', className)}\n {...props}\n />\n));\nDialogTitle.displayName = DialogPrimitive.Title.displayName;\n\nconst DialogDescription = React.forwardRef<\n React.ElementRef<typeof DialogPrimitive.Description>,\n React.ComponentPropsWithoutRef<typeof DialogPrimitive.Description>\n>(({ className, ...props }, ref) => (\n <DialogPrimitive.Description\n aria-describedby=\"tuwa:modal-description\"\n ref={ref}\n className={cn('text-sm text-[var(--tuwa-text-secondary)]', className)}\n {...props}\n />\n));\nDialogDescription.displayName = DialogPrimitive.Description.displayName;\n\nexport {\n Dialog,\n DialogClose,\n DialogContent,\n DialogDescription,\n DialogFooter,\n DialogHeader,\n DialogOverlay,\n DialogPortal,\n DialogTitle,\n DialogTrigger,\n};\n","import { useEffect, useMemo, useState } from 'react';\n\nexport function StarsBackground({ starsCount }: { starsCount?: number }) {\n const [isMounted, setIsMounted] = useState(false);\n useEffect(() => setIsMounted(true), []);\n\n const stars = useMemo(() => {\n if (!isMounted) {\n return [];\n }\n\n const numStars = starsCount ?? 200;\n return Array.from({ length: numStars }).map(() => ({\n x: Math.random() * window.innerWidth,\n y: Math.random() * window.innerHeight,\n r: Math.random() * 1 + 0.5,\n isSupernova: Math.random() < 0.1,\n delay: Math.random() * 10,\n duration: 5 + Math.random() * 5,\n }));\n }, [isMounted]);\n\n return (\n <div className=\"absolute inset-0 z-1 h-full w-full overflow-hidden\">\n <svg width=\"100%\" height=\"100%\" xmlns=\"http://www.w3.org/2000/svg\">\n <defs>\n <style>\n {`\n /* Pulse animation now includes scale for a more organic feel. */\n @keyframes pulse {\n 0%, 100% { \n opacity: 0.2;\n transform: scale(0.9);\n }\n 50% {\n opacity: 0.8;\n transform: scale(1.2);\n }\n }\n \n /* Supernova animation remains impactful. */\n @keyframes supernova {\n 0% { \n transform: scale(1);\n stroke: rgba(var(--tuwa-bg-primary), 0.5);\n opacity: 0.8;\n }\n 20% { \n transform: scale(3);\n stroke: var(--tuwa-button-gradient-from);\n opacity: 1;\n }\n 100% { \n transform: scale(0.8);\n stroke: var(--tuwa-button-gradient-to);\n opacity: 0;\n }\n }\n\n .pulsar {\n animation-name: pulse;\n animation-timing-function: ease-in-out;\n animation-iteration-count: infinite;\n transform-origin: center;\n }\n\n .supernova {\n animation-name: supernova;\n animation-timing-function: ease-out;\n animation-iteration-count: infinite;\n transform-origin: center;\n stroke-width: 2;\n }\n `}\n </style>\n </defs>\n\n {stars.map((star, i) => (\n <circle\n key={i}\n cx={star.x}\n cy={star.y}\n r={star.r}\n fill={`rgba(var(--tuwa-bg-primary), 0.7)`}\n className={star.isSupernova ? 'supernova' : 'pulsar'}\n style={{\n animationDelay: `${star.delay}s`,\n animationDuration: `${star.duration}s`,\n }}\n />\n ))}\n </svg>\n </div>\n );\n}\n","/**\n * @file This file contains a custom React hook for copying text to the clipboard.\n */\n\nimport { useCallback, useState } from 'react';\n\n/**\n * A custom React hook that provides functionality to copy text to the clipboard.\n * It also manages a \"copied\" state with a timeout for user feedback.\n *\n * @param {number} [timeout=2000] - The duration in milliseconds to keep the `isCopied` state as true.\n * @returns {{\n * isCopied: boolean;\n * copy: (text: string) => Promise<void>;\n * error: Error | null;\n * }} An object containing the `isCopied` state, the `copy` function, and any potential error.\n *\n * @example\n * const MyComponent = () => {\n * const { isCopied, copy } = useCopyToClipboard();\n * const textToCopy = '0x123...';\n *\n * return (\n * <button onClick={() => copy(textToCopy)}>\n * {isCopied ? 'Copied!' : 'Copy Address'}\n * </button>\n * );\n * }\n */\nexport function useCopyToClipboard(timeout = 2000): {\n isCopied: boolean;\n copy: (text: string) => Promise<void>;\n error: Error | null;\n} {\n const [isCopied, setIsCopied] = useState(false);\n const [error, setError] = useState<Error | null>(null);\n\n const copy = useCallback(\n async (text: string) => {\n if (!text) return;\n\n try {\n await navigator.clipboard.writeText(text);\n setIsCopied(true);\n setError(null);\n\n setTimeout(() => setIsCopied(false), timeout);\n } catch (e) {\n const copyError = e instanceof Error ? e : new Error('Failed to copy text.');\n console.error(copyError);\n setError(copyError);\n\n // Reset error state after timeout as well\n setTimeout(() => setError(null), timeout);\n }\n },\n [timeout],\n );\n\n return { isCopied, copy, error };\n}\n","import { useEffect, useState } from 'react';\n\n/**\n * A custom hook to detect if a media query matches the current screen dimensions.\n * Handles SSR gracefully.\n * @param {string} query - The media query string (e.g., '(max-width: 767px)').\n * @returns {boolean} Whether the query matches or not.\n */\nexport function useMediaQuery(query: string): boolean {\n const getMatches = (q: string): boolean => {\n if (typeof window !== 'undefined') {\n return window.matchMedia(q).matches;\n }\n return false;\n };\n\n const [matches, setMatches] = useState<boolean>(getMatches(query));\n\n useEffect(() => {\n const media = window.matchMedia(query);\n const listener = () => setMatches(media.matches);\n\n // Re-check on mount and subscribe to changes\n listener();\n window.addEventListener('resize', listener);\n\n return () => window.removeEventListener('resize', listener);\n }, [query]);\n\n return matches;\n}\n"]}
|
package/dist/index.css
CHANGED
package/dist/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import*as m from'react';import {useState,useEffect,useMemo,useCallback}from'react';import {clsx}from'clsx';import {twMerge}from'tailwind-merge';import {jsxs,jsx}from'react/jsx-runtime';import*as o from'@radix-ui/react-dialog';import {AnimatePresence,motion}from'framer-motion';function l(...e){return twMerge(clsx(e))}var c=e=>e&&typeof e=="object"&&!Array.isArray(e);function P(e,t){let i={...e};return c(e)&&c(t)&&Object.keys(t).forEach(r=>{let a=e[r],n=t[r];c(a)&&c(n)?i[r]=P(a,n):i[r]=n;}),i}function J(e,t,i){if(!e)return "";if(e.length<=t+i)return e;let r=e.slice(0,t),a=e.slice(e.length-i);return `${r}...${a}`}var R=m.forwardRef(({className:e,...t},i)=>jsxs("svg",{ref:i,xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",className:l("h-5 w-5 text-[var(--tuwa-text-primary)] transition-colors",e),...t,children:[jsx("path",{d:"M18 6 6 18"}),jsx("path",{d:"m6 6 12 12"})]}));R.displayName="CloseIcon";var oe=o.Root,re=o.Trigger,N=o.Portal,ne=o.Close,M={initial:{opacity:0,scale:.9,y:20},animate:{opacity:1,scale:1,y:0},exit:{opacity:0,scale:.9,transition:{duration:.2}}},k={initial:{opacity:0},animate:{opacity:1},exit:{opacity:0}},x=m.forwardRef(({className:e,backdropAnimation:t,...i},r)=>jsx(AnimatePresence,{children:jsx(motion.div,{variants:t??k,transition:{duration:.2,ease:"easeInOut"},animate:"animate",initial:"initial",exit:"exit",className:"relative rounded-t-2xl sm:rounded-2xl overflow-hidden",children:jsx(o.Overlay,{ref:r,className:l("fixed inset-0 z-50 bg-black/55 backdrop-blur-sm backdrop-saturate-150",e),...i})})}));x.displayName=o.Overlay.displayName;var T=m.forwardRef(({className:e,children:t,modalAnimation:i,backdropAnimation:r,...a},n)=>jsxs(N,{children:[jsx(x,{backdropAnimation:r}),jsx(o.Content,{"aria-describedby":"tuwa:modal-content",ref:n,className:l("fixed bottom-0 left-0 p-0 sm:left-[50%] sm:top-[50%] sm:translate-x-[-50%] sm:translate-y-[-50%] z-50 sm:p-4 outline-none",e),...a,children:jsx(motion.div,{layout:true,className:"relative overflow-hidden",transition:{layout:{duration:.2,ease:[.1,.1,.2,1]}},children:jsx(AnimatePresence,{children:jsx(motion.div,{variants:i??M,transition:{duration:.2,ease:"easeInOut"},animate:"animate",initial:"initial",exit:"exit",className:"relative rounded-t-2xl sm:rounded-2xl overflow-hidden",children:jsx("div",{className:l("relative flex max-h-[98dvh] w-full flex-col gap-3 overflow-y-auto rounded-t-2xl sm:rounded-2xl shadow-2xl","border border-[var(--tuwa-border-primary)] bg-[var(--tuwa-bg-primary)]"),children:t})})})})})]}));T.displayName=o.Content.displayName;var E=({className:e,...t})=>jsx("div",{"aria-describedby":"tuwa:modal-header",className:l("sticky flex top-0 z-11 w-full flex-row items-center justify-between","border-b border-[var(--tuwa-border-primary)] bg-[var(--tuwa-bg-primary)] p-4",e),...t});E.displayName="DialogHeader";var A=({className:e,...t})=>jsx("div",{"aria-describedby":"tuwa:modal-footer",className:l("flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2",e),...t});A.displayName="DialogFooter";var V=m.forwardRef(({className:e,...t},i)=>jsx(o.Title,{ref:i,"aria-describedby":"tuwa:modal-title",className:l("text-lg font-bold leading-none tracking-tight text-[var(--tuwa-text-primary)] m-0",e),...t}));V.displayName=o.Title.displayName;var S=m.forwardRef(({className:e,...t},i)=>jsx(o.Description,{"aria-describedby":"tuwa:modal-description",ref:i,className:l("text-sm text-[var(--tuwa-text-secondary)]",e),...t}));S.displayName=o.Description.displayName;function ce({starsCount:e}){let[t,i]=useState(false);useEffect(()=>i(true),[]);let r=useMemo(()=>{if(!t)return [];let a=e??200;return Array.from({length:a}).map(()=>({x:Math.random()*window.innerWidth,y:Math.random()*window.innerHeight,r:Math.random()*1+.5,isSupernova:Math.random()<.1,delay:Math.random()*10,duration:5+Math.random()*5}))},[t]);return jsx("div",{className:"absolute inset-0 z-1 h-full w-full overflow-hidden",children:jsxs("svg",{width:"100%",height:"100%",xmlns:"http://www.w3.org/2000/svg",children:[jsx("defs",{children:jsx("style",{children:`
|
|
1
|
+
import*as m from'react';import {useState,useEffect,useMemo,useCallback}from'react';import {clsx}from'clsx';import {twMerge}from'tailwind-merge';import {jsxs,jsx}from'react/jsx-runtime';import*as o from'@radix-ui/react-dialog';import {AnimatePresence,motion}from'framer-motion';function l(...e){return twMerge(clsx(e))}var c=e=>e&&typeof e=="object"&&!Array.isArray(e);function P(e,t){let i={...e};return c(e)&&c(t)&&Object.keys(t).forEach(r=>{let a=e[r],n=t[r];c(a)&&c(n)?i[r]=P(a,n):i[r]=n;}),i}function J(e,t,i){if(!e)return "";if(e.length<=t+i)return e;let r=e.slice(0,t),a=e.slice(e.length-i);return `${r}...${a}`}var R=m.forwardRef(({className:e,...t},i)=>jsxs("svg",{ref:i,xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",className:l("h-5 w-5 text-[var(--tuwa-text-primary)] transition-colors",e),...t,children:[jsx("path",{d:"M18 6 6 18"}),jsx("path",{d:"m6 6 12 12"})]}));R.displayName="CloseIcon";var oe=o.Root,re=o.Trigger,N=o.Portal,ne=o.Close,M={initial:{opacity:0,scale:.9,y:20},animate:{opacity:1,scale:1,y:0},exit:{opacity:0,scale:.9,transition:{duration:.2}}},k={initial:{opacity:0},animate:{opacity:1},exit:{opacity:0}},x=m.forwardRef(({className:e,backdropAnimation:t,...i},r)=>jsx(AnimatePresence,{children:jsx(motion.div,{variants:t??k,transition:{duration:.2,ease:"easeInOut"},animate:"animate",initial:"initial",exit:"exit",className:"relative rounded-t-2xl sm:rounded-2xl overflow-hidden",children:jsx(o.Overlay,{ref:r,className:l("fixed inset-0 z-50 bg-black/55 backdrop-blur-sm backdrop-saturate-150",e),...i})})}));x.displayName=o.Overlay.displayName;var T=m.forwardRef(({className:e,children:t,modalAnimation:i,backdropAnimation:r,...a},n)=>jsxs(N,{children:[jsx(x,{backdropAnimation:r}),jsx(o.Content,{"aria-describedby":"tuwa:modal-content",ref:n,className:l("fixed bottom-0 left-0 p-0 sm:bottom-auto sm:left-[50%] sm:top-[50%] sm:translate-x-[-50%] sm:translate-y-[-50%] z-50 sm:p-4 outline-none",e),...a,children:jsx(motion.div,{layout:true,className:"relative overflow-hidden",transition:{layout:{duration:.2,ease:[.1,.1,.2,1]}},children:jsx(AnimatePresence,{children:jsx(motion.div,{variants:i??M,transition:{duration:.2,ease:"easeInOut"},animate:"animate",initial:"initial",exit:"exit",className:"relative rounded-t-2xl sm:rounded-2xl overflow-hidden",children:jsx("div",{className:l("relative flex max-h-[98dvh] w-full flex-col gap-3 overflow-y-auto rounded-t-2xl sm:rounded-2xl shadow-2xl","border border-[var(--tuwa-border-primary)] bg-[var(--tuwa-bg-primary)]"),children:t})})})})})]}));T.displayName=o.Content.displayName;var E=({className:e,...t})=>jsx("div",{"aria-describedby":"tuwa:modal-header",className:l("sticky flex top-0 z-11 w-full flex-row items-center justify-between","border-b border-[var(--tuwa-border-primary)] bg-[var(--tuwa-bg-primary)] p-4",e),...t});E.displayName="DialogHeader";var A=({className:e,...t})=>jsx("div",{"aria-describedby":"tuwa:modal-footer",className:l("flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2",e),...t});A.displayName="DialogFooter";var V=m.forwardRef(({className:e,...t},i)=>jsx(o.Title,{ref:i,"aria-describedby":"tuwa:modal-title",className:l("text-lg font-bold leading-none tracking-tight text-[var(--tuwa-text-primary)] m-0",e),...t}));V.displayName=o.Title.displayName;var S=m.forwardRef(({className:e,...t},i)=>jsx(o.Description,{"aria-describedby":"tuwa:modal-description",ref:i,className:l("text-sm text-[var(--tuwa-text-secondary)]",e),...t}));S.displayName=o.Description.displayName;function ce({starsCount:e}){let[t,i]=useState(false);useEffect(()=>i(true),[]);let r=useMemo(()=>{if(!t)return [];let a=e??200;return Array.from({length:a}).map(()=>({x:Math.random()*window.innerWidth,y:Math.random()*window.innerHeight,r:Math.random()*1+.5,isSupernova:Math.random()<.1,delay:Math.random()*10,duration:5+Math.random()*5}))},[t]);return jsx("div",{className:"absolute inset-0 z-1 h-full w-full overflow-hidden",children:jsxs("svg",{width:"100%",height:"100%",xmlns:"http://www.w3.org/2000/svg",children:[jsx("defs",{children:jsx("style",{children:`
|
|
2
2
|
/* Pulse animation now includes scale for a more organic feel. */
|
|
3
3
|
@keyframes pulse {
|
|
4
4
|
0%, 100% {
|
|
@@ -44,5 +44,5 @@ import*as m from'react';import {useState,useEffect,useMemo,useCallback}from'reac
|
|
|
44
44
|
transform-origin: center;
|
|
45
45
|
stroke-width: 2;
|
|
46
46
|
}
|
|
47
|
-
`})}),r.map((a,n)=>jsx("circle",{cx:a.x,cy:a.y,r:a.r,fill:"rgba(var(--tuwa-bg-primary), 0.7)",className:a.isSupernova?"supernova":"pulsar",style:{animationDelay:`${a.delay}s`,animationDuration:`${a.duration}s`}},n))]})})}function
|
|
47
|
+
`})}),r.map((a,n)=>jsx("circle",{cx:a.x,cy:a.y,r:a.r,fill:"rgba(var(--tuwa-bg-primary), 0.7)",className:a.isSupernova?"supernova":"pulsar",style:{animationDelay:`${a.delay}s`,animationDuration:`${a.duration}s`}},n))]})})}function fe(e=2e3){let[t,i]=useState(false),[r,a]=useState(null),n=useCallback(async u=>{if(u)try{await navigator.clipboard.writeText(u),i(!0),a(null),setTimeout(()=>i(!1),e);}catch(f){let g=f instanceof Error?f:new Error("Failed to copy text.");console.error(g),a(g),setTimeout(()=>a(null),e);}},[e]);return {isCopied:t,copy:n,error:r}}function ve(e){let t=a=>typeof window<"u"?window.matchMedia(a).matches:false,[i,r]=useState(t(e));return useEffect(()=>{let a=window.matchMedia(e),n=()=>r(a.matches);return n(),window.addEventListener("resize",n),()=>window.removeEventListener("resize",n)},[e]),i}export{R as CloseIcon,oe as Dialog,ne as DialogClose,T as DialogContent,S as DialogDescription,A as DialogFooter,E as DialogHeader,x as DialogOverlay,N as DialogPortal,V as DialogTitle,re as DialogTrigger,ce as StarsBackground,l as cn,P as deepMerge,J as textCenterEllipsis,fe as useCopyToClipboard,ve as useMediaQuery};//# sourceMappingURL=index.js.map
|
|
48
48
|
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/utils/cn.ts","../src/utils/deepMerge.ts","../src/utils/textCenterEllipsis.ts","../src/components/CloseIcon.tsx","../src/components/Modal.tsx","../src/components/StarsBackground.tsx","../src/hooks/useCopyToClipboard.ts","../src/hooks/useMediaQuery.ts"],"names":["cn","inputs","twMerge","clsx","isObject","item","deepMerge","target","source","output","key","targetValue","sourceValue","textCenterEllipsis","str","from","to","start","end","CloseIcon","v","className","props","ref","jsxs","jsx","Dialog","DialogTrigger","DialogPortal","DialogClose","defaultModalAnimation","defaultModalBackdropAnimation","DialogOverlay","backdropAnimation","AnimatePresence","motion","DialogContent","children","modalAnimation","DialogHeader","DialogFooter","DialogTitle","DialogDescription","StarsBackground","starsCount","isMounted","setIsMounted","useState","useEffect","stars","useMemo","numStars","star","i","useCopyToClipboard","timeout","isCopied","setIsCopied","error","setError","copy","useCallback","text","e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AAG,CAACN,CAAK,CAAC,CAAA,CAEHG,CACT","file":"index.js","sourcesContent":["/**\n * @file This file contains a utility function for conditionally merging Tailwind CSS classes.\n */\n\nimport { type ClassValue, clsx } from 'clsx';\nimport { twMerge } from 'tailwind-merge';\n\n/**\n * A utility function to conditionally join class names together and resolve\n * conflicting Tailwind CSS classes.\n *\n * It combines the functionality of `clsx` and `tailwind-merge`.\n *\n * @param {...ClassValue[]} inputs - A list of class values to be combined.\n * This can include strings, numbers, objects, arrays, and booleans.\n * @returns {string} The final, merged class name string.\n *\n * @example\n * cn('p-4', 'bg-red-500', { 'font-bold': true }); // => 'p-4 bg-red-500 font-bold'\n * cn('p-2', 'p-4'); // => 'p-4' (tailwind-merge resolves the conflict)\n *\n * @see https://github.com/dcastil/tailwind-merge\n * @see https://github.com/lukeed/clsx\n */\nexport function cn(...inputs: ClassValue[]): string {\n return twMerge(clsx(inputs));\n}\n","/**\n * @file This file contains a utility for performing a deep (recursive) merge of two objects.\n */\n\n/**\n * Checks if the provided item is a plain object (i.e., not null and not an array).\n *\n * @param {any} item - The item to check.\n * @returns {item is Record<string, any>} True if the item is a plain object, otherwise false.\n */\nconst isObject = (item: any): item is Record<string, any> => {\n return item && typeof item === 'object' && !Array.isArray(item);\n};\n\n/**\n * Recursively merges the properties of a source object into a target object.\n * This function creates a new object and does not mutate the original target.\n *\n * @template T - The type of the objects being merged.\n * @param {T} target - The base object.\n * @param {Partial<T>} source - The object with properties to merge into the target.\n * @returns {T} A new object representing the merged result.\n *\n * @example\n * const defaults = { a: 1, b: { c: 2, d: 3 } };\n * const custom = { b: { c: 99 } };\n * const result = deepMerge(defaults, custom);\n * // result will be { a: 1, b: { c: 99, d: 3 } }\n */\nexport function deepMerge<T extends object>(target: T, source: Partial<T>): T {\n // Start with a shallow copy of the target to avoid mutation.\n const output = { ...target };\n\n if (isObject(target) && isObject(source)) {\n // Iterate over the keys in the source object.\n Object.keys(source).forEach((key) => {\n const targetValue = target[key as keyof T];\n const sourceValue = source[key as keyof T];\n\n // If the value is an object in both target and source, merge them recursively.\n if (isObject(targetValue) && isObject(sourceValue)) {\n // eslint-disable-next-line @typescript-eslint/ban-ts-comment\n // @ts-expect-error\n (output as Record<string, any>)[key] = deepMerge(targetValue, sourceValue);\n } else {\n // Otherwise, the source value overwrites the target value.\n (output as Record<string, any>)[key] = sourceValue;\n }\n });\n }\n\n return output;\n}\n","/**\n * @file This file contains a utility function for truncating a string with a center ellipsis.\n */\n\n/**\n * Truncates a string by showing a specified number of characters from the start and end,\n * with an ellipsis in the middle. If the string is too short to be truncated, it's returned as is.\n *\n * @param {string} str - The string to truncate.\n * @param {number} from - The number of characters to show from the beginning of the string.\n * @param {number} to - The number of characters to show from the end of the string.\n * @returns {string} The truncated string, or the original string if it's too short.\n *\n * @example\n * const hash = '0x1234567890abcdef1234567890abcdef';\n * textCenterEllipsis(hash, 6, 4); // => \"0x1234...cdef\"\n *\n * textCenterEllipsis('short', 6, 4); // => \"short\"\n */\nexport function textCenterEllipsis(str: string | undefined | null, from: number, to: number): string {\n if (!str) {\n return '';\n }\n\n // If the string is short enough, don't truncate it.\n if (str.length <= from + to) {\n return str;\n }\n\n const start = str.slice(0, from);\n const end = str.slice(str.length - to);\n\n return `${start}...${end}`;\n}\n","import * as React from 'react';\n\nimport { cn } from '../utils';\n\n/**\n * A reusable close button icon (X mark) styled with TUWA color scheme.\n */\nexport const CloseIcon = React.forwardRef<SVGSVGElement, React.SVGAttributes<SVGSVGElement>>(\n ({ className, ...props }, ref) => (\n <svg\n ref={ref}\n xmlns=\"http://www.w3.org/2000/svg\"\n viewBox=\"0 0 24 24\"\n fill=\"none\"\n stroke=\"currentColor\"\n strokeWidth=\"2\"\n strokeLinecap=\"round\"\n strokeLinejoin=\"round\"\n className={cn('h-5 w-5 text-[var(--tuwa-text-primary)] transition-colors', className)}\n {...props}\n >\n <path d=\"M18 6 6 18\" />\n <path d=\"m6 6 12 12\" />\n </svg>\n ),\n);\nCloseIcon.displayName = 'CloseIcon';\n","import * as DialogPrimitive from '@radix-ui/react-dialog';\nimport { AnimatePresence, motion, Variants } from 'framer-motion';\nimport * as React from 'react';\n\nimport { cn } from '../utils';\n\nconst Dialog = DialogPrimitive.Root;\nconst DialogTrigger = DialogPrimitive.Trigger;\nconst DialogPortal = DialogPrimitive.Portal;\nconst DialogClose = DialogPrimitive.Close;\n\nconst defaultModalAnimation: Variants = {\n initial: { opacity: 0, scale: 0.9, y: 20 },\n animate: { opacity: 1, scale: 1, y: 0 },\n exit: {\n opacity: 0,\n scale: 0.9,\n transition: {\n duration: 0.2,\n },\n },\n};\n\nconst defaultModalBackdropAnimation: Variants = {\n initial: { opacity: 0 },\n animate: { opacity: 1 },\n exit: { opacity: 0 },\n};\n\nconst DialogOverlay = React.forwardRef<\n React.ElementRef<typeof DialogPrimitive.Overlay>,\n React.ComponentPropsWithoutRef<typeof DialogPrimitive.Overlay> & {\n backdropAnimation?: Variants;\n }\n>(({ className, backdropAnimation, ...props }, ref) => (\n <AnimatePresence>\n <motion.div\n variants={backdropAnimation ?? defaultModalBackdropAnimation}\n transition={{ duration: 0.2, ease: 'easeInOut' }}\n animate=\"animate\"\n initial=\"initial\"\n exit=\"exit\"\n className=\"relative rounded-t-2xl sm:rounded-2xl overflow-hidden\"\n >\n <DialogPrimitive.Overlay\n ref={ref}\n className={cn('fixed inset-0 z-50 bg-black/55 backdrop-blur-sm backdrop-saturate-150', className)}\n {...props}\n />\n </motion.div>\n </AnimatePresence>\n));\nDialogOverlay.displayName = DialogPrimitive.Overlay.displayName;\n\nconst DialogContent = React.forwardRef<\n React.ElementRef<typeof DialogPrimitive.Content>,\n React.ComponentPropsWithoutRef<typeof DialogPrimitive.Content> & {\n modalAnimation?: Variants;\n backdropAnimation?: Variants;\n }\n>(({ className, children, modalAnimation, backdropAnimation, ...props }, ref) => (\n <DialogPortal>\n <DialogOverlay backdropAnimation={backdropAnimation} />\n\n <DialogPrimitive.Content\n aria-describedby=\"tuwa:modal-content\"\n ref={ref}\n className={cn(\n 'fixed bottom-0 left-0 p-0 sm:left-[50%] sm:top-[50%] sm:translate-x-[-50%] sm:translate-y-[-50%] z-50 sm:p-4 outline-none',\n className,\n )}\n {...props}\n >\n <motion.div\n layout\n className=\"relative overflow-hidden\"\n transition={{\n layout: {\n duration: 0.2,\n ease: [0.1, 0.1, 0.2, 1],\n },\n }}\n >\n <AnimatePresence>\n <motion.div\n variants={modalAnimation ?? defaultModalAnimation}\n transition={{ duration: 0.2, ease: 'easeInOut' }}\n animate=\"animate\"\n initial=\"initial\"\n exit=\"exit\"\n className=\"relative rounded-t-2xl sm:rounded-2xl overflow-hidden\"\n >\n <div\n className={cn(\n 'relative flex max-h-[98dvh] w-full flex-col gap-3 overflow-y-auto rounded-t-2xl sm:rounded-2xl shadow-2xl',\n 'border border-[var(--tuwa-border-primary)] bg-[var(--tuwa-bg-primary)]',\n )}\n >\n {children}\n </div>\n </motion.div>\n </AnimatePresence>\n </motion.div>\n </DialogPrimitive.Content>\n </DialogPortal>\n));\nDialogContent.displayName = DialogPrimitive.Content.displayName;\n\nconst DialogHeader = ({ className, ...props }: React.HTMLAttributes<HTMLDivElement>) => (\n <div\n aria-describedby=\"tuwa:modal-header\"\n className={cn(\n 'sticky flex top-0 z-11 w-full flex-row items-center justify-between',\n 'border-b border-[var(--tuwa-border-primary)] bg-[var(--tuwa-bg-primary)] p-4',\n className,\n )}\n {...props}\n />\n);\nDialogHeader.displayName = 'DialogHeader';\n\nconst DialogFooter = ({ className, ...props }: React.HTMLAttributes<HTMLDivElement>) => (\n <div\n aria-describedby=\"tuwa:modal-footer\"\n className={cn('flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2', className)}\n {...props}\n />\n);\nDialogFooter.displayName = 'DialogFooter';\n\nconst DialogTitle = React.forwardRef<\n React.ElementRef<typeof DialogPrimitive.Title>,\n React.ComponentPropsWithoutRef<typeof DialogPrimitive.Title>\n>(({ className, ...props }, ref) => (\n <DialogPrimitive.Title\n ref={ref}\n aria-describedby=\"tuwa:modal-title\"\n className={cn('text-lg font-bold leading-none tracking-tight text-[var(--tuwa-text-primary)] m-0', className)}\n {...props}\n />\n));\nDialogTitle.displayName = DialogPrimitive.Title.displayName;\n\nconst DialogDescription = React.forwardRef<\n React.ElementRef<typeof DialogPrimitive.Description>,\n React.ComponentPropsWithoutRef<typeof DialogPrimitive.Description>\n>(({ className, ...props }, ref) => (\n <DialogPrimitive.Description\n aria-describedby=\"tuwa:modal-description\"\n ref={ref}\n className={cn('text-sm text-[var(--tuwa-text-secondary)]', className)}\n {...props}\n />\n));\nDialogDescription.displayName = DialogPrimitive.Description.displayName;\n\nexport {\n Dialog,\n DialogClose,\n DialogContent,\n DialogDescription,\n DialogFooter,\n DialogHeader,\n DialogOverlay,\n DialogPortal,\n DialogTitle,\n DialogTrigger,\n};\n","import { useEffect, useMemo, useState } from 'react';\n\nexport function StarsBackground({ starsCount }: { starsCount?: number }) {\n const [isMounted, setIsMounted] = useState(false);\n useEffect(() => setIsMounted(true), []);\n\n const stars = useMemo(() => {\n if (!isMounted) {\n return [];\n }\n\n const numStars = starsCount ?? 200;\n return Array.from({ length: numStars }).map(() => ({\n x: Math.random() * window.innerWidth,\n y: Math.random() * window.innerHeight,\n r: Math.random() * 1 + 0.5,\n isSupernova: Math.random() < 0.1,\n delay: Math.random() * 10,\n duration: 5 + Math.random() * 5,\n }));\n }, [isMounted]);\n\n return (\n <div className=\"absolute inset-0 z-1 h-full w-full overflow-hidden\">\n <svg width=\"100%\" height=\"100%\" xmlns=\"http://www.w3.org/2000/svg\">\n <defs>\n <style>\n {`\n /* Pulse animation now includes scale for a more organic feel. */\n @keyframes pulse {\n 0%, 100% { \n opacity: 0.2;\n transform: scale(0.9);\n }\n 50% {\n opacity: 0.8;\n transform: scale(1.2);\n }\n }\n \n /* Supernova animation remains impactful. */\n @keyframes supernova {\n 0% { \n transform: scale(1);\n stroke: rgba(var(--tuwa-bg-primary), 0.5);\n opacity: 0.8;\n }\n 20% { \n transform: scale(3);\n stroke: var(--tuwa-button-gradient-from);\n opacity: 1;\n }\n 100% { \n transform: scale(0.8);\n stroke: var(--tuwa-button-gradient-to);\n opacity: 0;\n }\n }\n\n .pulsar {\n animation-name: pulse;\n animation-timing-function: ease-in-out;\n animation-iteration-count: infinite;\n transform-origin: center;\n }\n\n .supernova {\n animation-name: supernova;\n animation-timing-function: ease-out;\n animation-iteration-count: infinite;\n transform-origin: center;\n stroke-width: 2;\n }\n `}\n </style>\n </defs>\n\n {stars.map((star, i) => (\n <circle\n key={i}\n cx={star.x}\n cy={star.y}\n r={star.r}\n fill={`rgba(var(--tuwa-bg-primary), 0.7)`}\n className={star.isSupernova ? 'supernova' : 'pulsar'}\n style={{\n animationDelay: `${star.delay}s`,\n animationDuration: `${star.duration}s`,\n }}\n />\n ))}\n </svg>\n </div>\n );\n}\n","/**\n * @file This file contains a custom React hook for copying text to the clipboard.\n */\n\nimport { useCallback, useState } from 'react';\n\n/**\n * A custom React hook that provides functionality to copy text to the clipboard.\n * It also manages a \"copied\" state with a timeout for user feedback.\n *\n * @param {number} [timeout=2000] - The duration in milliseconds to keep the `isCopied` state as true.\n * @returns {{\n * isCopied: boolean;\n * copy: (text: string) => Promise<void>;\n * error: Error | null;\n * }} An object containing the `isCopied` state, the `copy` function, and any potential error.\n *\n * @example\n * const MyComponent = () => {\n * const { isCopied, copy } = useCopyToClipboard();\n * const textToCopy = '0x123...';\n *\n * return (\n * <button onClick={() => copy(textToCopy)}>\n * {isCopied ? 'Copied!' : 'Copy Address'}\n * </button>\n * );\n * }\n */\nexport function useCopyToClipboard(timeout = 2000): {\n isCopied: boolean;\n copy: (text: string) => Promise<void>;\n error: Error | null;\n} {\n const [isCopied, setIsCopied] = useState(false);\n const [error, setError] = useState<Error | null>(null);\n\n const copy = useCallback(\n async (text: string) => {\n if (!text) return;\n\n try {\n await navigator.clipboard.writeText(text);\n setIsCopied(true);\n setError(null);\n\n setTimeout(() => setIsCopied(false), timeout);\n } catch (e) {\n const copyError = e instanceof Error ? e : new Error('Failed to copy text.');\n console.error(copyError);\n setError(copyError);\n\n // Reset error state after timeout as well\n setTimeout(() => setError(null), timeout);\n }\n },\n [timeout],\n );\n\n return { isCopied, copy, error };\n}\n","import { useEffect, useState } from 'react';\n\n/**\n * A custom hook to detect if a media query matches the current screen dimensions.\n * Handles SSR gracefully.\n * @param {string} query - The media query string (e.g., '(max-width: 767px)').\n * @returns {boolean} Whether the query matches or not.\n */\nexport function useMediaQuery(query: string): boolean {\n const getMatches = (q: string): boolean => {\n if (typeof window !== 'undefined') {\n return window.matchMedia(q).matches;\n }\n return false;\n };\n\n const [matches, setMatches] = useState<boolean>(getMatches(query));\n\n useEffect(() => {\n const media = window.matchMedia(query);\n const listener = () => setMatches(media.matches);\n\n // Re-check on mount and subscribe to changes\n listener();\n window.addEventListener('resize', listener);\n\n return () => window.removeEventListener('resize', listener);\n }, [query]);\n\n return matches;\n}\n"]}
|
|
1
|
+
{"version":3,"sources":["../src/utils/cn.ts","../src/utils/deepMerge.ts","../src/utils/textCenterEllipsis.ts","../src/components/CloseIcon.tsx","../src/components/Modal.tsx","../src/components/StarsBackground.tsx","../src/hooks/useCopyToClipboard.ts","../src/hooks/useMediaQuery.ts"],"names":["cn","inputs","twMerge","clsx","isObject","item","deepMerge","target","source","output","key","targetValue","sourceValue","textCenterEllipsis","str","from","to","start","end","CloseIcon","v","className","props","ref","jsxs","jsx","Dialog","DialogTrigger","DialogPortal","DialogClose","defaultModalAnimation","defaultModalBackdropAnimation","DialogOverlay","backdropAnimation","AnimatePresence","motion","DialogContent","children","modalAnimation","DialogHeader","DialogFooter","DialogTitle","DialogDescription","StarsBackground","starsCount","isMounted","setIsMounted","useState","useEffect","stars","useMemo","numStars","star","i","useCopyToClipboard","timeout","isCopied","setIsCopied","error","setError","copy","useCallback","text","e","copyError","useMediaQuery","query","getMatches","q","matches","setMatches","media","listener"],"mappings":"qRAwBO,SAASA,CAAAA,CAAAA,GAAMC,CAAAA,CAA8B,CAClD,OAAOC,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CACF,MAAM,SAAA,CAAU,SAAA,CAAU,UAAUA,CAAI,CAAA,CACxCL,CAAAA,CAAY,CAAA,CAAI,CAAA,CAChBE,CAAAA,CAAS,IAAI,CAAA,CAEb,UAAA,CAAW,IAAMF,CAAAA,CAAY,CAAA,CAAK,CAAA,CAAGF,CAAO,EAC9C,CAAA,MAASQ,CAAAA,CAAG,CACV,IAAMC,CAAAA,CAAYD,aAAa,KAAA,CAAQA,CAAAA,CAAI,IAAI,KAAA,CAAM,sBAAsB,EAC3E,OAAA,CAAQ,KAAA,CAAMC,CAAS,CAAA,CACvBL,CAAAA,CAASK,CAAS,EAGlB,UAAA,CAAW,IAAML,EAAS,IAAI,CAAA,CAAGJ,CAAO,EAC1C,CACF,CAAA,CACA,CAACA,CAAO,CACV,EAEA,OAAO,CAAE,SAAAC,CAAAA,CAAU,IAAA,CAAAI,EAAM,KAAA,CAAAF,CAAM,CACjC,CCpDO,SAASO,EAAAA,CAAcC,EAAwB,CACpD,IAAMC,CAAAA,CAAcC,CAAAA,EACd,OAAO,MAAA,CAAW,IACb,MAAA,CAAO,UAAA,CAAWA,CAAC,CAAA,CAAE,OAAA,CAEvB,MAGH,CAACC,CAAAA,CAASC,CAAU,CAAA,CAAIvB,QAAAA,CAAkBoB,CAAAA,CAAWD,CAAK,CAAC,CAAA,CAEjE,OAAAlB,SAAAA,CAAU,IAAM,CACd,IAAMuB,CAAAA,CAAQ,MAAA,CAAO,UAAA,CAAWL,CAAK,CAAA,CAC/BM,EAAW,IAAMF,CAAAA,CAAWC,EAAM,OAAO,CAAA,CAG/C,OAAAC,CAAAA,EAAS,CACT,MAAA,CAAO,gBAAA,CAAiB,QAAA,CAAUA,CAAQ,EAEnC,IAAM,MAAA,CAAO,mBAAA,CAAoB,QAAA,CAAUA,CAAQ,CAC5D,EAAG,CAACN,CAAK,CAAC,CAAA,CAEHG,CACT","file":"index.js","sourcesContent":["/**\n * @file This file contains a utility function for conditionally merging Tailwind CSS classes.\n */\n\nimport { type ClassValue, clsx } from 'clsx';\nimport { twMerge } from 'tailwind-merge';\n\n/**\n * A utility function to conditionally join class names together and resolve\n * conflicting Tailwind CSS classes.\n *\n * It combines the functionality of `clsx` and `tailwind-merge`.\n *\n * @param {...ClassValue[]} inputs - A list of class values to be combined.\n * This can include strings, numbers, objects, arrays, and booleans.\n * @returns {string} The final, merged class name string.\n *\n * @example\n * cn('p-4', 'bg-red-500', { 'font-bold': true }); // => 'p-4 bg-red-500 font-bold'\n * cn('p-2', 'p-4'); // => 'p-4' (tailwind-merge resolves the conflict)\n *\n * @see https://github.com/dcastil/tailwind-merge\n * @see https://github.com/lukeed/clsx\n */\nexport function cn(...inputs: ClassValue[]): string {\n return twMerge(clsx(inputs));\n}\n","/**\n * @file This file contains a utility for performing a deep (recursive) merge of two objects.\n */\n\n/**\n * Checks if the provided item is a plain object (i.e., not null and not an array).\n *\n * @param {any} item - The item to check.\n * @returns {item is Record<string, any>} True if the item is a plain object, otherwise false.\n */\nconst isObject = (item: any): item is Record<string, any> => {\n return item && typeof item === 'object' && !Array.isArray(item);\n};\n\n/**\n * Recursively merges the properties of a source object into a target object.\n * This function creates a new object and does not mutate the original target.\n *\n * @template T - The type of the objects being merged.\n * @param {T} target - The base object.\n * @param {Partial<T>} source - The object with properties to merge into the target.\n * @returns {T} A new object representing the merged result.\n *\n * @example\n * const defaults = { a: 1, b: { c: 2, d: 3 } };\n * const custom = { b: { c: 99 } };\n * const result = deepMerge(defaults, custom);\n * // result will be { a: 1, b: { c: 99, d: 3 } }\n */\nexport function deepMerge<T extends object>(target: T, source: Partial<T>): T {\n // Start with a shallow copy of the target to avoid mutation.\n const output = { ...target };\n\n if (isObject(target) && isObject(source)) {\n // Iterate over the keys in the source object.\n Object.keys(source).forEach((key) => {\n const targetValue = target[key as keyof T];\n const sourceValue = source[key as keyof T];\n\n // If the value is an object in both target and source, merge them recursively.\n if (isObject(targetValue) && isObject(sourceValue)) {\n // eslint-disable-next-line @typescript-eslint/ban-ts-comment\n // @ts-expect-error\n (output as Record<string, any>)[key] = deepMerge(targetValue, sourceValue);\n } else {\n // Otherwise, the source value overwrites the target value.\n (output as Record<string, any>)[key] = sourceValue;\n }\n });\n }\n\n return output;\n}\n","/**\n * @file This file contains a utility function for truncating a string with a center ellipsis.\n */\n\n/**\n * Truncates a string by showing a specified number of characters from the start and end,\n * with an ellipsis in the middle. If the string is too short to be truncated, it's returned as is.\n *\n * @param {string} str - The string to truncate.\n * @param {number} from - The number of characters to show from the beginning of the string.\n * @param {number} to - The number of characters to show from the end of the string.\n * @returns {string} The truncated string, or the original string if it's too short.\n *\n * @example\n * const hash = '0x1234567890abcdef1234567890abcdef';\n * textCenterEllipsis(hash, 6, 4); // => \"0x1234...cdef\"\n *\n * textCenterEllipsis('short', 6, 4); // => \"short\"\n */\nexport function textCenterEllipsis(str: string | undefined | null, from: number, to: number): string {\n if (!str) {\n return '';\n }\n\n // If the string is short enough, don't truncate it.\n if (str.length <= from + to) {\n return str;\n }\n\n const start = str.slice(0, from);\n const end = str.slice(str.length - to);\n\n return `${start}...${end}`;\n}\n","import * as React from 'react';\n\nimport { cn } from '../utils';\n\n/**\n * A reusable close button icon (X mark) styled with TUWA color scheme.\n */\nexport const CloseIcon = React.forwardRef<SVGSVGElement, React.SVGAttributes<SVGSVGElement>>(\n ({ className, ...props }, ref) => (\n <svg\n ref={ref}\n xmlns=\"http://www.w3.org/2000/svg\"\n viewBox=\"0 0 24 24\"\n fill=\"none\"\n stroke=\"currentColor\"\n strokeWidth=\"2\"\n strokeLinecap=\"round\"\n strokeLinejoin=\"round\"\n className={cn('h-5 w-5 text-[var(--tuwa-text-primary)] transition-colors', className)}\n {...props}\n >\n <path d=\"M18 6 6 18\" />\n <path d=\"m6 6 12 12\" />\n </svg>\n ),\n);\nCloseIcon.displayName = 'CloseIcon';\n","import * as DialogPrimitive from '@radix-ui/react-dialog';\nimport { AnimatePresence, motion, Variants } from 'framer-motion';\nimport * as React from 'react';\n\nimport { cn } from '../utils';\n\nconst Dialog = DialogPrimitive.Root;\nconst DialogTrigger = DialogPrimitive.Trigger;\nconst DialogPortal = DialogPrimitive.Portal;\nconst DialogClose = DialogPrimitive.Close;\n\nconst defaultModalAnimation: Variants = {\n initial: { opacity: 0, scale: 0.9, y: 20 },\n animate: { opacity: 1, scale: 1, y: 0 },\n exit: {\n opacity: 0,\n scale: 0.9,\n transition: {\n duration: 0.2,\n },\n },\n};\n\nconst defaultModalBackdropAnimation: Variants = {\n initial: { opacity: 0 },\n animate: { opacity: 1 },\n exit: { opacity: 0 },\n};\n\nconst DialogOverlay = React.forwardRef<\n React.ElementRef<typeof DialogPrimitive.Overlay>,\n React.ComponentPropsWithoutRef<typeof DialogPrimitive.Overlay> & {\n backdropAnimation?: Variants;\n }\n>(({ className, backdropAnimation, ...props }, ref) => (\n <AnimatePresence>\n <motion.div\n variants={backdropAnimation ?? defaultModalBackdropAnimation}\n transition={{ duration: 0.2, ease: 'easeInOut' }}\n animate=\"animate\"\n initial=\"initial\"\n exit=\"exit\"\n className=\"relative rounded-t-2xl sm:rounded-2xl overflow-hidden\"\n >\n <DialogPrimitive.Overlay\n ref={ref}\n className={cn('fixed inset-0 z-50 bg-black/55 backdrop-blur-sm backdrop-saturate-150', className)}\n {...props}\n />\n </motion.div>\n </AnimatePresence>\n));\nDialogOverlay.displayName = DialogPrimitive.Overlay.displayName;\n\nconst DialogContent = React.forwardRef<\n React.ElementRef<typeof DialogPrimitive.Content>,\n React.ComponentPropsWithoutRef<typeof DialogPrimitive.Content> & {\n modalAnimation?: Variants;\n backdropAnimation?: Variants;\n }\n>(({ className, children, modalAnimation, backdropAnimation, ...props }, ref) => (\n <DialogPortal>\n <DialogOverlay backdropAnimation={backdropAnimation} />\n\n <DialogPrimitive.Content\n aria-describedby=\"tuwa:modal-content\"\n ref={ref}\n className={cn(\n 'fixed bottom-0 left-0 p-0 sm:bottom-auto sm:left-[50%] sm:top-[50%] sm:translate-x-[-50%] sm:translate-y-[-50%] z-50 sm:p-4 outline-none',\n className,\n )}\n {...props}\n >\n <motion.div\n layout\n className=\"relative overflow-hidden\"\n transition={{\n layout: {\n duration: 0.2,\n ease: [0.1, 0.1, 0.2, 1],\n },\n }}\n >\n <AnimatePresence>\n <motion.div\n variants={modalAnimation ?? defaultModalAnimation}\n transition={{ duration: 0.2, ease: 'easeInOut' }}\n animate=\"animate\"\n initial=\"initial\"\n exit=\"exit\"\n className=\"relative rounded-t-2xl sm:rounded-2xl overflow-hidden\"\n >\n <div\n className={cn(\n 'relative flex max-h-[98dvh] w-full flex-col gap-3 overflow-y-auto rounded-t-2xl sm:rounded-2xl shadow-2xl',\n 'border border-[var(--tuwa-border-primary)] bg-[var(--tuwa-bg-primary)]',\n )}\n >\n {children}\n </div>\n </motion.div>\n </AnimatePresence>\n </motion.div>\n </DialogPrimitive.Content>\n </DialogPortal>\n));\nDialogContent.displayName = DialogPrimitive.Content.displayName;\n\nconst DialogHeader = ({ className, ...props }: React.HTMLAttributes<HTMLDivElement>) => (\n <div\n aria-describedby=\"tuwa:modal-header\"\n className={cn(\n 'sticky flex top-0 z-11 w-full flex-row items-center justify-between',\n 'border-b border-[var(--tuwa-border-primary)] bg-[var(--tuwa-bg-primary)] p-4',\n className,\n )}\n {...props}\n />\n);\nDialogHeader.displayName = 'DialogHeader';\n\nconst DialogFooter = ({ className, ...props }: React.HTMLAttributes<HTMLDivElement>) => (\n <div\n aria-describedby=\"tuwa:modal-footer\"\n className={cn('flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2', className)}\n {...props}\n />\n);\nDialogFooter.displayName = 'DialogFooter';\n\nconst DialogTitle = React.forwardRef<\n React.ElementRef<typeof DialogPrimitive.Title>,\n React.ComponentPropsWithoutRef<typeof DialogPrimitive.Title>\n>(({ className, ...props }, ref) => (\n <DialogPrimitive.Title\n ref={ref}\n aria-describedby=\"tuwa:modal-title\"\n className={cn('text-lg font-bold leading-none tracking-tight text-[var(--tuwa-text-primary)] m-0', className)}\n {...props}\n />\n));\nDialogTitle.displayName = DialogPrimitive.Title.displayName;\n\nconst DialogDescription = React.forwardRef<\n React.ElementRef<typeof DialogPrimitive.Description>,\n React.ComponentPropsWithoutRef<typeof DialogPrimitive.Description>\n>(({ className, ...props }, ref) => (\n <DialogPrimitive.Description\n aria-describedby=\"tuwa:modal-description\"\n ref={ref}\n className={cn('text-sm text-[var(--tuwa-text-secondary)]', className)}\n {...props}\n />\n));\nDialogDescription.displayName = DialogPrimitive.Description.displayName;\n\nexport {\n Dialog,\n DialogClose,\n DialogContent,\n DialogDescription,\n DialogFooter,\n DialogHeader,\n DialogOverlay,\n DialogPortal,\n DialogTitle,\n DialogTrigger,\n};\n","import { useEffect, useMemo, useState } from 'react';\n\nexport function StarsBackground({ starsCount }: { starsCount?: number }) {\n const [isMounted, setIsMounted] = useState(false);\n useEffect(() => setIsMounted(true), []);\n\n const stars = useMemo(() => {\n if (!isMounted) {\n return [];\n }\n\n const numStars = starsCount ?? 200;\n return Array.from({ length: numStars }).map(() => ({\n x: Math.random() * window.innerWidth,\n y: Math.random() * window.innerHeight,\n r: Math.random() * 1 + 0.5,\n isSupernova: Math.random() < 0.1,\n delay: Math.random() * 10,\n duration: 5 + Math.random() * 5,\n }));\n }, [isMounted]);\n\n return (\n <div className=\"absolute inset-0 z-1 h-full w-full overflow-hidden\">\n <svg width=\"100%\" height=\"100%\" xmlns=\"http://www.w3.org/2000/svg\">\n <defs>\n <style>\n {`\n /* Pulse animation now includes scale for a more organic feel. */\n @keyframes pulse {\n 0%, 100% { \n opacity: 0.2;\n transform: scale(0.9);\n }\n 50% {\n opacity: 0.8;\n transform: scale(1.2);\n }\n }\n \n /* Supernova animation remains impactful. */\n @keyframes supernova {\n 0% { \n transform: scale(1);\n stroke: rgba(var(--tuwa-bg-primary), 0.5);\n opacity: 0.8;\n }\n 20% { \n transform: scale(3);\n stroke: var(--tuwa-button-gradient-from);\n opacity: 1;\n }\n 100% { \n transform: scale(0.8);\n stroke: var(--tuwa-button-gradient-to);\n opacity: 0;\n }\n }\n\n .pulsar {\n animation-name: pulse;\n animation-timing-function: ease-in-out;\n animation-iteration-count: infinite;\n transform-origin: center;\n }\n\n .supernova {\n animation-name: supernova;\n animation-timing-function: ease-out;\n animation-iteration-count: infinite;\n transform-origin: center;\n stroke-width: 2;\n }\n `}\n </style>\n </defs>\n\n {stars.map((star, i) => (\n <circle\n key={i}\n cx={star.x}\n cy={star.y}\n r={star.r}\n fill={`rgba(var(--tuwa-bg-primary), 0.7)`}\n className={star.isSupernova ? 'supernova' : 'pulsar'}\n style={{\n animationDelay: `${star.delay}s`,\n animationDuration: `${star.duration}s`,\n }}\n />\n ))}\n </svg>\n </div>\n );\n}\n","/**\n * @file This file contains a custom React hook for copying text to the clipboard.\n */\n\nimport { useCallback, useState } from 'react';\n\n/**\n * A custom React hook that provides functionality to copy text to the clipboard.\n * It also manages a \"copied\" state with a timeout for user feedback.\n *\n * @param {number} [timeout=2000] - The duration in milliseconds to keep the `isCopied` state as true.\n * @returns {{\n * isCopied: boolean;\n * copy: (text: string) => Promise<void>;\n * error: Error | null;\n * }} An object containing the `isCopied` state, the `copy` function, and any potential error.\n *\n * @example\n * const MyComponent = () => {\n * const { isCopied, copy } = useCopyToClipboard();\n * const textToCopy = '0x123...';\n *\n * return (\n * <button onClick={() => copy(textToCopy)}>\n * {isCopied ? 'Copied!' : 'Copy Address'}\n * </button>\n * );\n * }\n */\nexport function useCopyToClipboard(timeout = 2000): {\n isCopied: boolean;\n copy: (text: string) => Promise<void>;\n error: Error | null;\n} {\n const [isCopied, setIsCopied] = useState(false);\n const [error, setError] = useState<Error | null>(null);\n\n const copy = useCallback(\n async (text: string) => {\n if (!text) return;\n\n try {\n await navigator.clipboard.writeText(text);\n setIsCopied(true);\n setError(null);\n\n setTimeout(() => setIsCopied(false), timeout);\n } catch (e) {\n const copyError = e instanceof Error ? e : new Error('Failed to copy text.');\n console.error(copyError);\n setError(copyError);\n\n // Reset error state after timeout as well\n setTimeout(() => setError(null), timeout);\n }\n },\n [timeout],\n );\n\n return { isCopied, copy, error };\n}\n","import { useEffect, useState } from 'react';\n\n/**\n * A custom hook to detect if a media query matches the current screen dimensions.\n * Handles SSR gracefully.\n * @param {string} query - The media query string (e.g., '(max-width: 767px)').\n * @returns {boolean} Whether the query matches or not.\n */\nexport function useMediaQuery(query: string): boolean {\n const getMatches = (q: string): boolean => {\n if (typeof window !== 'undefined') {\n return window.matchMedia(q).matches;\n }\n return false;\n };\n\n const [matches, setMatches] = useState<boolean>(getMatches(query));\n\n useEffect(() => {\n const media = window.matchMedia(query);\n const listener = () => setMatches(media.matches);\n\n // Re-check on mount and subscribe to changes\n listener();\n window.addEventListener('resize', listener);\n\n return () => window.removeEventListener('resize', listener);\n }, [query]);\n\n return matches;\n}\n"]}
|