@tuwaio/nova-core 0.7.3 → 0.8.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +3 -3
- package/dist/index.cjs +3 -3
- package/dist/index.d.cts +12 -9
- package/dist/index.d.ts +12 -9
- package/dist/index.js +3 -3
- package/package.json +11 -9
package/README.md
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
[](https://www.npmjs.com/package/@tuwaio/nova-core)
|
|
4
4
|
[](https://github.com/TuwaIO/nova-uikit/blob/main/packages/nova-core/LICENSE)
|
|
5
5
|
|
|
6
|
-
`@tuwaio/nova-core` is the core Layer 6 (L6) package of **Nova UI Kit**, the user interface project of TUWA Stage 4 ("User Interface"). It holds what the L7 packages [`@tuwaio/nova-connect`](https://stories.tuwa.io/?path=/docs/packages-nova-connect-overview--docs) and [`@tuwaio/nova-transactions`](https://stories.tuwa.io/?path=/docs/packages-nova-transactions-overview--docs) share: the `--tuwa-*` CSS variables of the theme, a dialog built on Radix UI, network and wallet icons, and small React hooks and helpers. It has no Web3 logic and no wallet or transaction state.
|
|
6
|
+
`@tuwaio/nova-core` is the core Layer 6 (L6) package of **Nova UI Kit**, the user interface project of TUWA Stage 4 ("User Interface"). It holds what the L7 packages [`@tuwaio/nova-connect`](https://stories.tuwa.io/?path=/docs/packages-nova-connect-overview--docs) and [`@tuwaio/nova-transactions`](https://stories.tuwa.io/?path=/docs/packages-nova-transactions-overview--docs) share: the `--tuwa-*` CSS variables of the theme, a dialog built on Radix UI, network and wallet icons, and small React hooks and helpers. It has no Web3 logic and no wallet or transaction state; Solana cluster names come from `@tuwaio/orbit-core`, which has no dependencies of its own.
|
|
7
7
|
|
|
8
8
|
---
|
|
9
9
|
|
|
@@ -19,10 +19,10 @@
|
|
|
19
19
|
## 💾 Installation
|
|
20
20
|
|
|
21
21
|
```bash
|
|
22
|
-
pnpm add @tuwaio/nova-core react @radix-ui/react-dialog @web3icons/react @web3icons/common framer-motion clsx tailwind-merge
|
|
22
|
+
pnpm add @tuwaio/nova-core @tuwaio/orbit-core react @radix-ui/react-dialog @web3icons/react @web3icons/common framer-motion clsx tailwind-merge
|
|
23
23
|
```
|
|
24
24
|
|
|
25
|
-
Peer dependencies: `react` (>=19.2.3), `@radix-ui/react-dialog` (1.x), `@web3icons/react` (>=4), `@web3icons/common` (>=0.11), `framer-motion`, `clsx` (2.x) and `tailwind-merge` (3.x).
|
|
25
|
+
Peer dependencies: `@tuwaio/orbit-core` (>=0.4), `react` (>=19.2.3), `@radix-ui/react-dialog` (1.x), `@web3icons/react` (>=4), `@web3icons/common` (>=0.11), `framer-motion`, `clsx` (2.x) and `tailwind-merge` (3.x).
|
|
26
26
|
|
|
27
27
|
Import the stylesheet once, before the stylesheets of the other Nova packages:
|
|
28
28
|
|
package/dist/index.cjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
'use strict';var framerMotion=require('framer-motion'),clsx=require('clsx'),tailwindMerge=require('tailwind-merge'),metadata=require('@web3icons/common/metadata'),jsxRuntime=require('react/jsx-runtime'),d=require('react'),c=require('@radix-ui/react-dialog');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 d__namespace=/*#__PURE__*/_interopNamespace(d);var c__namespace=/*#__PURE__*/_interopNamespace(c);var Uo="novacore:cursor-pointer novacore:rounded-[var(--tuwa-rounded-corners)] novacore:bg-[var(--tuwa-standart-button-bg)] novacore:px-3 novacore:py-2 novacore:flex novacore:items-center novacore:gap-1 novacore:text-sm novacore:font-mono novacore:font-semibold novacore:text-[var(--tuwa-text-primary)] novacore:transition-colors novacore:hover:bg-[var(--tuwa-standart-button-hover)] novacore:disabled:cursor-not-allowed novacore:disabled:opacity-50 novacore:min-h-[36px]";function s(...o){return tailwindMerge.twMerge(clsx.clsx(o))}var y=o=>typeof o=="object"&&o!==null&&!Array.isArray(o);function J(o,e){let t={...o};return y(o)&&y(e)&&Object.keys(e).forEach(n=>{let r=o[n],a=e[n];y(r)&&y(a)?t[n]=J(r,a):t[n]=a;}),t}function x(o){if(typeof o!="string")return false;let e=o.toLowerCase();return e.includes("solana")&&(e.includes("devnet")||e.includes("testnet"))}var M="Unknown";function oo(o){return o.charAt(0).toUpperCase()+o.slice(1).toLowerCase()}function W(o){let e={name:M,id:M.toLowerCase(),filePath:M.toLowerCase(),chainId:o};if(typeof o=="number"){let i=metadata.networks.find(l=>l.chainId===o);return i?{name:i.name,id:i.id,filePath:i.filePath?.split(":")[1],chainId:o}:e}let[t,n]=o?o.split(":"):[o],r=metadata.networks.find(i=>i.id===t);return r?{name:n&&x(o)?`${r.name} ${oo(n)}`:r.name,id:r.id,filePath:r.filePath?.split(":")[1],chainId:o}:e}function G(o=1200){if(typeof window>"u")return false;let e="ontouchstart"in window,t=navigator.maxTouchPoints>0,n=false;window.matchMedia&&(n=window.matchMedia("(pointer: coarse)").matches);let r=e||t||n,a=window.innerWidth<=o;return r&&a}function eo(o){if(!o.startsWith("var("))return o;let e=o.match(/var\(\s*(--[\w-]+)/);if(!e)return o;let t=e[1];return getComputedStyle(document.documentElement).getPropertyValue(t).trim()||o}function to(o,e){let t=eo(e),r=new DOMParser().parseFromString(o,"image/svg+xml");if(r.querySelector("parsererror"))return console.warn("SVG parse error, returning original"),o;let i=r.querySelector("path");return i&&i.setAttribute("fill",t),new XMLSerializer().serializeToString(r.documentElement)}function N(o,e){let t=o;return e&&(t=to(t,e)),`data:image/svg+xml;base64,${btoa(unescape(encodeURIComponent(t)))}`}var C=o=>`${o.replace(/\s+/g,"-").toLowerCase()}.svg`;function te(o,e,t){if(!o)return "";if(o.length<=e+t)return o;let n=o.slice(0,e),r=o.slice(o.length-t);return `${n}...${r}`}function ve({className:o,strokeWidth:e,isOpen:t}){return jsxRuntime.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:e??2,stroke:"currentColor",className:s("novacore:w-4 novacore:h-4 novacore:text-[var(--tuwa-text-secondary)]",o),children:[jsxRuntime.jsx(framerMotion.AnimatePresence,{children:t&&jsxRuntime.jsx(framerMotion.motion.path,{strokeLinecap:"round",strokeLinejoin:"round",d:"m4.5 15.75 7.5-7.5 7.5 7.5",variants:{hidden:{translateY:3,scaleY:.8,opacity:0},visible:{translateY:0,scaleY:1,opacity:1}},initial:"hidden",animate:"visible",transition:{duration:.4}})}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:!t&&jsxRuntime.jsx(framerMotion.motion.path,{strokeLinecap:"round",strokeLinejoin:"round",d:"m19.5 8.25-7.5 7.5-7.5-7.5",className:"novacore:relative",variants:{hidden:{translateY:-3,scaleY:.8,opacity:0},visible:{translateY:0,scaleY:1,opacity:1}},initial:"hidden",animate:"visible",transition:{duration:.4}})})]})}var no=d__namespace.forwardRef(({className:o,...e},t)=>jsxRuntime.jsxs("svg",{ref:t,xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",className:s("novacore:h-5 novacore:w-5 novacore:text-[var(--tuwa-text-primary)] novacore:transition-colors",o),...e,children:[jsxRuntime.jsx("path",{d:"M18 6 6 18"}),jsxRuntime.jsx("path",{d:"m6 6 12 12"})]}));no.displayName="CloseIcon";var io="novacore:flex novacore:items-center novacore:justify-center novacore:w-full novacore:h-full novacore:rounded-full novacore:text-[var(--tuwa-text-secondary)] novacore:bg-[var(--tuwa-bg-muted)]",f=({animate:o=false,content:e="",className:t})=>jsxRuntime.jsx("div",{className:s(io,"Nova_Web3_Icon",t,{"novacore:animate-pulse":o}),children:e});function k({src:o,alt:e,...t}){return jsxRuntime.jsx("img",{...t,src:o,alt:e??"",draggable:false,onDragStart:n=>n.preventDefault(),style:{outline:"none",pointerEvents:"none"}})}var mo="https://raw.githubusercontent.com/0xa3k5/web3icons/refs/heads/main/raw-svgs",L=new Map;function P({githubSrc:o,className:e,alt:t,firstPathFill:n,...r}){let a=`${o}|${n??""}`,i=L.get(a),[l,m]=d.useState(null),[w,b]=d.useState("idle"),I=i||l,g=i?"success":w;return d.useEffect(()=>{let R=true;return L.has(a)?void 0:((async()=>{b("loading");try{let D=await fetch(`${mo}/${o}`);if(!D.ok)throw new Error(`Failed to load icon: ${D.status}`);let X=await D.text();if(R){let V=N(X,n);L.set(a,V),m(V),b("success");}}catch{R&&b("error");}})(),()=>{R=false;})},[o,n,a]),g==="loading"||g==="idle"?jsxRuntime.jsx(f,{animate:true,className:e}):g==="success"&&I?jsxRuntime.jsx(k,{...r,src:I,alt:t,className:e}):jsxRuntime.jsx(f,{content:"?",className:e})}var Ve=c__namespace.Root,ze=c__namespace.Trigger,uo=c__namespace.Portal,We=c__namespace.Close,po={initial:{opacity:0,scale:.9,y:20},animate:{opacity:1,scale:1,y:0},exit:{opacity:0,scale:.9,transition:{duration:.2}}},fo={initial:{opacity:0,y:"100%"},animate:{opacity:1,y:"0%"},exit:{opacity:0,y:"100%",transition:{duration:.2}}},vo={initial:{opacity:0},animate:{opacity:1},exit:{opacity:0}},Y=({className:o,backdropAnimation:e})=>(d__namespace.useEffect(()=>(typeof window<"u"&&window.document.body.classList.add("NovaModalOpen"),()=>{typeof window<"u"&&window.document.body.classList.remove("NovaModalOpen");}),[]),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:jsxRuntime.jsx(framerMotion.motion.div,{variants:e??vo,transition:{duration:.2,ease:"easeInOut"},animate:"animate",initial:"initial",exit:"exit",className:"novacore:relative novacore:overflow-hidden",children:jsxRuntime.jsx("div",{className:s("novacore:fixed novacore:inset-0 novacore:z-50 novacore:bg-black/55 novacore:backdrop-blur-sm novacore:backdrop-saturate-150",o)})})}));Y.displayName=c__namespace.Overlay.displayName;var go=d__namespace.forwardRef(({className:o,children:e,modalAnimation:t,backdropAnimation:n,...r},a)=>{let[i,l]=d__namespace.useState(false);d__namespace.useEffect(()=>{l(G());},[]);let m=t??(i?fo:po);return jsxRuntime.jsxs(uo,{children:[jsxRuntime.jsx(Y,{backdropAnimation:n}),jsxRuntime.jsx(c__namespace.Content,{"aria-describedby":"tuwa:modal-content",ref:a,className:s("NovaNoScrolling novacore:fixed novacore:bottom-0 novacore:left-0 novacore:p-0 novacore:sm:bottom-auto novacore:sm:left-[50%] novacore:sm:top-[50%] novacore:sm:translate-x-[-50%] novacore:sm:translate-y-[-50%] novacore:z-50 novacore:sm:p-4 novacore:outline-none",o),...r,children:jsxRuntime.jsx(framerMotion.motion.div,{layout:true,className:"NovaNoScrolling novacore:relative novacore:overflow-hidden",transition:{layout:{duration:.2,ease:[.1,.1,.2,1]}},children:jsxRuntime.jsx(framerMotion.AnimatePresence,{children:jsxRuntime.jsx(framerMotion.motion.div,{variants:m,transition:{duration:.2,ease:"easeInOut"},animate:"animate",initial:"initial",exit:"exit",className:"NovaNoScrolling novacore:relative novacore:overflow-hidden novacore:bg-[var(--tuwa-bg-primary)] novacore:border novacore:border-[var(--tuwa-border-primary)] novacore:rounded-t-[var(--tuwa-rounded-corners)] novacore:sm:rounded-[var(--tuwa-rounded-corners)]",children:jsxRuntime.jsx("div",{className:s("NovaNoScrolling NovaDialogContent__elements novacore:relative novacore:flex novacore:max-h-[100dvh] novacore:w-full novacore:flex-col novacore:overflow-y-auto","novacore:[transform:translateZ(0)] novacore:[backface-visibility:hidden]"),children:e})})})})})]})});go.displayName=c__namespace.Content.displayName;var wo=({className:o,...e})=>jsxRuntime.jsx("div",{"aria-describedby":"tuwa:modal-header",className:s("novacore:sticky novacore:flex novacore:top-0 novacore:z-11 novacore:w-full novacore:flex-row novacore:items-center novacore:justify-between","novacore:border-b novacore:border-[var(--tuwa-border-primary)] novacore:bg-[var(--tuwa-bg-primary)] novacore:p-4",o),...e});wo.displayName="DialogHeader";var bo=({className:o,...e})=>jsxRuntime.jsx("div",{"aria-describedby":"tuwa:modal-footer",className:s("novacore:flex novacore:flex-col-reverse novacore:sm:flex-row novacore:sm:justify-end novacore:sm:space-x-2",o),...e});bo.displayName="DialogFooter";var ho=d__namespace.forwardRef(({className:o,...e},t)=>jsxRuntime.jsx(c__namespace.Title,{ref:t,"aria-describedby":"tuwa:modal-title",className:s("novacore:text-lg novacore:font-bold novacore:leading-none novacore:tracking-tight novacore:text-[var(--tuwa-text-primary)] novacore:m-0 novacore:font-mono",o),...e}));ho.displayName=c__namespace.Title.displayName;var yo=d__namespace.forwardRef(({className:o,...e},t)=>jsxRuntime.jsx(c__namespace.Description,{"aria-describedby":"tuwa:modal-description",ref:t,className:s("novacore:text-sm novacore:text-[var(--tuwa-text-secondary)]",o),...e}));yo.displayName=c__namespace.Description.displayName;function h({children:o,iconId:e,alt:t,firstPathFill:n,...r}){let[a,i]=d.useState(null),l=d.useCallback(m=>{if(m){let w=N(m.outerHTML,n);i({id:e,src:w});}},[e,n]);return a&&a.id===e?jsxRuntime.jsx(k,{...r,src:a.src,alt:t}):jsxRuntime.jsx(jsxRuntime.Fragment,{children:o(l)})}var K=d.lazy(()=>import('@web3icons/react/dynamic').then(o=>({default:o.NetworkIcon}))),To="var(--tuwa-testnet-icons)";function Je({chainId:o,variant:e="background",className:t}){let n=W(o),r=typeof o=="string",a=r?o.split(":")[0].toLowerCase():o,l=r&&x(o)||n.name.toLowerCase().includes("testnet")?To:void 0,m=s("novacore:w-full novacore:h-full novacore:rounded-full",t),w=typeof a=="string"?a:n.filePath,b=`networks/${e}/${C(w)}`;return n.name==="Unknown"?typeof o=="number"?jsxRuntime.jsx(f,{content:"?",className:t}):jsxRuntime.jsx(P,{githubSrc:b,className:m,firstPathFill:l}):jsxRuntime.jsx(d.Suspense,{fallback:jsxRuntime.jsx(f,{animate:true,className:t}),children:jsxRuntime.jsx(h,{iconId:`${o}-${e}`,className:m,firstPathFill:l,children:g=>typeof a=="string"?jsxRuntime.jsx(K,{ref:g,id:a,variant:e}):jsxRuntime.jsx(K,{ref:g,chainId:a,variant:e})})})}function rt({starsCount:o}){let[e,t]=d.useState(false);d.useEffect(()=>t(true),[]);let n=d.useMemo(()=>e?Array.from({length:o??200}).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})):[],[e]);return jsxRuntime.jsx("div",{className:"novacore:absolute novacore:inset-0 novacore:z-1 novacore:h-full novacore:w-full novacore: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 framerMotion=require('framer-motion'),clsx=require('clsx'),tailwindMerge=require('tailwind-merge'),metadata=require('@web3icons/common/metadata'),orbitCore=require('@tuwaio/orbit-core'),jsxRuntime=require('react/jsx-runtime'),d=require('react'),c=require('@radix-ui/react-dialog');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 d__namespace=/*#__PURE__*/_interopNamespace(d);var c__namespace=/*#__PURE__*/_interopNamespace(c);var _e="novacore:cursor-pointer novacore:rounded-[var(--tuwa-rounded-corners)] novacore:bg-[var(--tuwa-standart-button-bg)] novacore:px-3 novacore:py-2 novacore:flex novacore:items-center novacore:gap-1 novacore:text-sm novacore:font-mono novacore:font-semibold novacore:text-[var(--tuwa-text-primary)] novacore:transition-colors novacore:hover:bg-[var(--tuwa-standart-button-hover)] novacore:disabled:cursor-not-allowed novacore:disabled:opacity-50 novacore:min-h-[36px]";function s(...e){return tailwindMerge.twMerge(clsx.clsx(e))}var y=e=>typeof e=="object"&&e!==null&&!Array.isArray(e);function oe(e,o){let t={...e};return y(e)&&y(o)&&Object.keys(o).forEach(n=>{let r=e[n],a=o[n];y(r)&&y(a)?t[n]=oe(r,a):t[n]=a;}),t}function x(e){if(typeof e!="string")return;let o=e.indexOf(":");if(o<0||e.slice(0,o).toLowerCase()!=="solana")return;let t=e.slice(o+1),n=orbitCore.getSolanaCluster(t)??orbitCore.getSolanaCluster(t.toLowerCase());return n==="devnet"||n==="testnet"?n:void 0}var M="Unknown";function te(e){return e.charAt(0).toUpperCase()+e.slice(1).toLowerCase()}function G(e){let o={name:M,id:M.toLowerCase(),filePath:M.toLowerCase(),chainId:e};if(typeof e=="number"){let i=metadata.networks.find(m=>m.chainId===e);return i?{name:i.name,id:i.id,filePath:i.filePath?.split(":")[1],chainId:e}:o}let[t,n]=e?e.split(":"):[e],r=metadata.networks.find(i=>i.id===t);if(!r)return o;let a=n?x(e):void 0;return {name:a?`${r.name} ${te(a)}`:r.name,id:r.id,filePath:r.filePath?.split(":")[1],chainId:e}}function $(e){return x(e)!==void 0}function B(e=1200){if(typeof window>"u")return false;let o="ontouchstart"in window,t=navigator.maxTouchPoints>0,n=false;window.matchMedia&&(n=window.matchMedia("(pointer: coarse)").matches);let r=o||t||n,a=window.innerWidth<=e;return r&&a}function re(e){if(!e.startsWith("var("))return e;let o=e.match(/var\(\s*(--[\w-]+)/);if(!o)return e;let t=o[1];return getComputedStyle(document.documentElement).getPropertyValue(t).trim()||e}function ne(e,o){let t=re(o),r=new DOMParser().parseFromString(e,"image/svg+xml");if(r.querySelector("parsererror"))return console.warn("SVG parse error, returning original"),e;let l=r.querySelector("path");return l&&l.setAttribute("fill",t),new XMLSerializer().serializeToString(r.documentElement)}function C(e,o){let t=e;return o&&(t=ne(t,o)),`data:image/svg+xml;base64,${btoa(unescape(encodeURIComponent(t)))}`}var N=e=>`${e.replace(/\s+/g,"-").toLowerCase()}.svg`;function io(e,o,t){if(!e)return "";if(e.length<=o+t)return e;let n=e.slice(0,o),r=e.slice(e.length-t);return `${n}...${r}`}function yo({className:e,strokeWidth:o,isOpen:t}){return jsxRuntime.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:o??2,stroke:"currentColor",className:s("novacore:w-4 novacore:h-4 novacore:text-[var(--tuwa-text-secondary)]",e),children:[jsxRuntime.jsx(framerMotion.AnimatePresence,{children:t&&jsxRuntime.jsx(framerMotion.motion.path,{strokeLinecap:"round",strokeLinejoin:"round",d:"m4.5 15.75 7.5-7.5 7.5 7.5",variants:{hidden:{translateY:3,scaleY:.8,opacity:0},visible:{translateY:0,scaleY:1,opacity:1}},initial:"hidden",animate:"visible",transition:{duration:.4}})}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:!t&&jsxRuntime.jsx(framerMotion.motion.path,{strokeLinecap:"round",strokeLinejoin:"round",d:"m19.5 8.25-7.5 7.5-7.5-7.5",className:"novacore:relative",variants:{hidden:{translateY:-3,scaleY:.8,opacity:0},visible:{translateY:0,scaleY:1,opacity:1}},initial:"hidden",animate:"visible",transition:{duration:.4}})})]})}var ie=d__namespace.forwardRef(({className:e,...o},t)=>jsxRuntime.jsxs("svg",{ref:t,xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",className:s("novacore:h-5 novacore:w-5 novacore:text-[var(--tuwa-text-primary)] novacore:transition-colors",e),...o,children:[jsxRuntime.jsx("path",{d:"M18 6 6 18"}),jsxRuntime.jsx("path",{d:"m6 6 12 12"})]}));ie.displayName="CloseIcon";var ce="novacore:flex novacore:items-center novacore:justify-center novacore:w-full novacore:h-full novacore:rounded-full novacore:text-[var(--tuwa-text-secondary)] novacore:bg-[var(--tuwa-bg-muted)]",f=({animate:e=false,content:o="",className:t})=>jsxRuntime.jsx("div",{className:s(ce,"Nova_Web3_Icon",t,{"novacore:animate-pulse":e}),children:o});function k({src:e,alt:o,...t}){return jsxRuntime.jsx("img",{...t,src:e,alt:o??"",draggable:false,onDragStart:n=>n.preventDefault(),style:{outline:"none",pointerEvents:"none"}})}var de="https://raw.githubusercontent.com/0xa3k5/web3icons/refs/heads/main/raw-svgs",L=new Map;function P({githubSrc:e,className:o,alt:t,firstPathFill:n,...r}){let a=`${e}|${n??""}`,l=L.get(a),[i,m]=d.useState(null),[w,b]=d.useState("idle"),D=l||i,g=l?"success":w;return d.useEffect(()=>{let I=true;return L.has(a)?void 0:((async()=>{b("loading");try{let R=await fetch(`${de}/${e}`);if(!R.ok)throw new Error(`Failed to load icon: ${R.status}`);let j=await R.text();if(I){let V=C(j,n);L.set(a,V),m(V),b("success");}}catch{I&&b("error");}})(),()=>{I=false;})},[e,n,a]),g==="loading"||g==="idle"?jsxRuntime.jsx(f,{animate:true,className:o}):g==="success"&&D?jsxRuntime.jsx(k,{...r,src:D,alt:t,className:o}):jsxRuntime.jsx(f,{content:"?",className:o})}var Bo=c__namespace.Root,Oo=c__namespace.Trigger,pe=c__namespace.Portal,Ho=c__namespace.Close,fe={initial:{opacity:0,scale:.9,y:20},animate:{opacity:1,scale:1,y:0},exit:{opacity:0,scale:.9,transition:{duration:.2}}},ve={initial:{opacity:0,y:"100%"},animate:{opacity:1,y:"0%"},exit:{opacity:0,y:"100%",transition:{duration:.2}}},ge={initial:{opacity:0},animate:{opacity:1},exit:{opacity:0}},K=({className:e,backdropAnimation:o})=>(d__namespace.useEffect(()=>(typeof window<"u"&&window.document.body.classList.add("NovaModalOpen"),()=>{typeof window<"u"&&window.document.body.classList.remove("NovaModalOpen");}),[]),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:jsxRuntime.jsx(framerMotion.motion.div,{variants:o??ge,transition:{duration:.2,ease:"easeInOut"},animate:"animate",initial:"initial",exit:"exit",className:"novacore:relative novacore:overflow-hidden",children:jsxRuntime.jsx("div",{className:s("novacore:fixed novacore:inset-0 novacore:z-50 novacore:bg-black/55 novacore:backdrop-blur-sm novacore:backdrop-saturate-150",e)})})}));K.displayName=c__namespace.Overlay.displayName;var we=d__namespace.forwardRef(({className:e,children:o,modalAnimation:t,backdropAnimation:n,...r},a)=>{let[l,i]=d__namespace.useState(false);d__namespace.useEffect(()=>{i(B());},[]);let m=t??(l?ve:fe);return jsxRuntime.jsxs(pe,{children:[jsxRuntime.jsx(K,{backdropAnimation:n}),jsxRuntime.jsx(c__namespace.Content,{"aria-describedby":"tuwa:modal-content",ref:a,className:s("NovaNoScrolling novacore:fixed novacore:bottom-0 novacore:left-0 novacore:p-0 novacore:sm:bottom-auto novacore:sm:left-[50%] novacore:sm:top-[50%] novacore:sm:translate-x-[-50%] novacore:sm:translate-y-[-50%] novacore:z-50 novacore:sm:p-4 novacore:outline-none",e),...r,children:jsxRuntime.jsx(framerMotion.motion.div,{layout:true,className:"NovaNoScrolling novacore:relative novacore:overflow-hidden",transition:{layout:{duration:.2,ease:[.1,.1,.2,1]}},children:jsxRuntime.jsx(framerMotion.AnimatePresence,{children:jsxRuntime.jsx(framerMotion.motion.div,{variants:m,transition:{duration:.2,ease:"easeInOut"},animate:"animate",initial:"initial",exit:"exit",className:"NovaNoScrolling novacore:relative novacore:overflow-hidden novacore:bg-[var(--tuwa-bg-primary)] novacore:border novacore:border-[var(--tuwa-border-primary)] novacore:rounded-t-[var(--tuwa-rounded-corners)] novacore:sm:rounded-[var(--tuwa-rounded-corners)]",children:jsxRuntime.jsx("div",{className:s("NovaNoScrolling NovaDialogContent__elements novacore:relative novacore:flex novacore:max-h-[100dvh] novacore:w-full novacore:flex-col novacore:overflow-y-auto","novacore:[transform:translateZ(0)] novacore:[backface-visibility:hidden]"),children:o})})})})})]})});we.displayName=c__namespace.Content.displayName;var be=({className:e,...o})=>jsxRuntime.jsx("div",{"aria-describedby":"tuwa:modal-header",className:s("novacore:sticky novacore:flex novacore:top-0 novacore:z-11 novacore:w-full novacore:flex-row novacore:items-center novacore:justify-between","novacore:border-b novacore:border-[var(--tuwa-border-primary)] novacore:bg-[var(--tuwa-bg-primary)] novacore:p-4",e),...o});be.displayName="DialogHeader";var he=({className:e,...o})=>jsxRuntime.jsx("div",{"aria-describedby":"tuwa:modal-footer",className:s("novacore:flex novacore:flex-col-reverse novacore:sm:flex-row novacore:sm:justify-end novacore:sm:space-x-2",e),...o});he.displayName="DialogFooter";var ye=d__namespace.forwardRef(({className:e,...o},t)=>jsxRuntime.jsx(c__namespace.Title,{ref:t,"aria-describedby":"tuwa:modal-title",className:s("novacore:text-lg novacore:font-bold novacore:leading-none novacore:tracking-tight novacore:text-[var(--tuwa-text-primary)] novacore:m-0 novacore:font-mono",e),...o}));ye.displayName=c__namespace.Title.displayName;var xe=d__namespace.forwardRef(({className:e,...o},t)=>jsxRuntime.jsx(c__namespace.Description,{"aria-describedby":"tuwa:modal-description",ref:t,className:s("novacore:text-sm novacore:text-[var(--tuwa-text-secondary)]",e),...o}));xe.displayName=c__namespace.Description.displayName;function h({children:e,iconId:o,alt:t,firstPathFill:n,...r}){let[a,l]=d.useState(null),i=d.useCallback(m=>{if(m){let w=C(m.outerHTML,n);l({id:o,src:w});}},[o,n]);return a&&a.id===o?jsxRuntime.jsx(k,{...r,src:a.src,alt:t}):jsxRuntime.jsx(jsxRuntime.Fragment,{children:e(i)})}var X=d.lazy(()=>import('@web3icons/react/dynamic').then(e=>({default:e.NetworkIcon}))),De="var(--tuwa-testnet-icons)";function nt({chainId:e,variant:o="background",className:t}){let n=G(e),r=typeof e=="string",a=r?e.split(":")[0].toLowerCase():e,i=r&&$(e)||n.name.toLowerCase().includes("testnet")?De:void 0,m=s("novacore:w-full novacore:h-full novacore:rounded-full",t),w=typeof a=="string"?a:n.filePath,b=`networks/${o}/${N(w)}`;return n.name==="Unknown"?typeof e=="number"?jsxRuntime.jsx(f,{content:"?",className:t}):jsxRuntime.jsx(P,{githubSrc:b,className:m,firstPathFill:i}):jsxRuntime.jsx(d.Suspense,{fallback:jsxRuntime.jsx(f,{animate:true,className:t}),children:jsxRuntime.jsx(h,{iconId:`${e}-${o}`,className:m,firstPathFill:i,children:g=>typeof a=="string"?jsxRuntime.jsx(X,{ref:g,id:a,variant:o}):jsxRuntime.jsx(X,{ref:g,chainId:a,variant:o})})})}function ct({starsCount:e}){let[o,t]=d.useState(false);d.useEffect(()=>t(true),[]);let n=d.useMemo(()=>o?Array.from({length:e??200}).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})):[],[o]);return jsxRuntime.jsx("div",{className:"novacore:absolute novacore:inset-0 novacore:z-1 novacore:h-full novacore:w-full novacore: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
|
-
`})}),n.map((r,a)=>jsxRuntime.jsx("circle",{cx:r.x,cy:r.y,r:r.r,fill:"rgba(var(--tuwa-bg-primary), 0.7)",className:r.isSupernova?"supernova":"pulsar",style:{animationDelay:`${r.delay}s`,animationDuration:`${r.duration}s`}},a))]})})}function
|
|
48
|
-
exports.ChevronArrowWithAnim=
|
|
47
|
+
`})}),n.map((r,a)=>jsxRuntime.jsx("circle",{cx:r.x,cy:r.y,r:r.r,fill:"rgba(var(--tuwa-bg-primary), 0.7)",className:r.isSupernova?"supernova":"pulsar",style:{animationDelay:`${r.delay}s`,animationDuration:`${r.duration}s`}},a))]})})}function dt({closeToast:e,ariaLabel:o="Close toast notification",title:t="Close toast notification",className:n,iconClassName:r}){return jsxRuntime.jsx("button",{type:"button",onClick:e,"aria-label":o,title:t,className:s("novacore:absolute novacore:top-2 novacore:right-2 novacore:cursor-pointer novacore:rounded-[var(--tuwa-rounded-corners)] novacore:p-1","novacore:text-[var(--tuwa-text-tertiary)] novacore:transition-colors","novacore:hover:bg-[var(--tuwa-bg-muted)] novacore:hover:text-[var(--tuwa-text-primary)]",n),children:jsxRuntime.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"currentColor",className:s("novacore:h-5 novacore:w-5",r),children:jsxRuntime.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M6 18 18 6M6 6l12 12"})})})}var Ve=d.lazy(()=>import('@web3icons/react/dynamic').then(e=>({default:e.WalletIcon}))),ze={walletconnect:"wallet-connect"};function We(e){return metadata.wallets.some(o=>o.id===e||o.name?.toLowerCase()===e)}var Ge=({className:e,ref:o})=>jsxRuntime.jsxs("svg",{ref:o,className:e,fill:"none",viewBox:"0 0 32 32",xmlns:"http://www.w3.org/2000/svg",children:[jsxRuntime.jsx("path",{fill:"#fff",fillRule:"evenodd",d:"M16 0c8.84 0 16 7.16 16 16s-7.16 16-16 16S0 24.84 0 16 7.16 0 16 0",clipRule:"evenodd"}),jsxRuntime.jsx("path",{fill:"#000",fillRule:"evenodd",d:"M16.54 2.01h1.53c.5.09.99.23 1.48.42.21.25.19.48-.05.69q-.195.045-.39 0c-1.86-.65-3.55-.35-5.07.89 2.39.7 3.84 2.27 4.36 4.7.12.85.08 1.68-.12 2.51.87 0 1.74 0 2.61-.02.39-.4.7-.85.94-1.35-.45-.45-.65-.99-.59-1.63-1.15.08-1.79-.44-1.92-1.58.14-1.12.78-1.67 1.92-1.63a.7.7 0 0 0-.12-.49l-.89-.89c-.02-.45.19-.6.62-.47.24.19.46.39.66.62.71-.79 1.5-.89 2.39-.32.44.42.62.94.54 1.55 1.49.02 2.11.76 1.85 2.22-.08.17-.17.34-.27.49.53.59.87 1.28 1.01 2.07.08 4.6.1 9.19.05 13.79-.19 1.58-1 2.71-2.44 3.37-.29.1-.59.2-.89.27H7.2c-1.31-.33-2.05-1.17-2.24-2.51-.03-5.24-.03-10.47 0-15.71.3-1.62 1.28-2.46 2.93-2.54 1.26-1.77 2.98-2.64 5.17-2.61.96-1.01 2.13-1.62 3.5-1.85zm6.11 1.87c.39-.03.7.12.91.44.06.39.09.79.1 1.18.02.12.07.21.17.27.41 0 .82.04 1.23.1.49.26.63.65.42 1.16-.07.14-.18.25-.32.32-.39.06-.79.09-1.18.1-.12.02-.21.07-.27.17l-.15 1.33c-.32.46-.72.55-1.21.27a.76.76 0 0 1-.27-.37c-.06-.41-.09-.82-.1-1.23a.35.35 0 0 0-.27-.17l-1.08-.05c-.46-.24-.62-.61-.47-1.11.14-.27.36-.43.66-.47l.99-.05s.09-.04.12-.07l.15-1.28q.18-.39.57-.54m-10.49.79c2.41-.09 4.12.94 5.15 3.1.44 1.12.48 2.25.12 3.4-.84.06-1.67.07-2.51.02.56-.68.52-1.32-.1-1.92-.26-.13-.54-.19-.84-.17.02-.95 0-1.91-.07-2.86-.21-.41-.55-.58-1.01-.52-.17.03-.31.09-.44.2-.72.92-1.43 1.85-2.14 2.78-.28.45-.29.91-.05 1.38q.225.3.57.42c.34.02.69.03 1.03.02v.69c-1.3.02-2.59 0-3.89-.05-.58-2.1-.08-3.88 1.53-5.34.79-.62 1.68-1 2.66-1.16zm.83 1.82c.07 0 .13.03.17.1l.05 3.05c.04.09.1.16.17.22l.89.05c.22.08.3.24.22.47q-.27.42-.57.81c-.43.02-.85.03-1.28.02 0-.41 0-.82-.02-1.23a.46.46 0 0 0-.17-.17l-1.28-.05c-.3-.1-.37-.29-.22-.57.7-.89 1.39-1.79 2.04-2.71zm-5.81.84h.2a6.1 6.1 0 0 0-.25 3.77c-.59-.13-1.01-.49-1.26-1.06-.36-1.29.08-2.19 1.31-2.71m17.98.83c.05 0 .1 0 .15.02q.825.855.96 2.04.045 1.305 0 2.61a3.76 3.76 0 0 0-2.54-1.55c-.61-.05-1.21-.08-1.82-.1.26-.31.48-.66.64-1.03 1.31.02 1.94-.62 1.87-1.95.26.02.5 0 .74-.05zM5.7 11.22c.41.4.91.65 1.48.76l16.06.05c1.42.13 2.38.87 2.88 2.19.07.24.12.49.15.74.03 2.86.03 5.71 0 8.57-.21 1.44-1 2.38-2.39 2.83-.24.05-.49.08-.74.1-1.26.02-2.53.03-3.79.02 0-1.33 0-2.66.02-3.99l1.55-1.55c1.42-.04 2.09-.78 1.99-2.19-.24-.88-.81-1.34-1.72-1.38-1.2.12-1.81.8-1.82 2.02l-1.92 1.92c-.08.11-.14.22-.2.34-.07 1.61-.1 3.22-.07 4.83h-.44c0-2.28 0-4.56-.02-6.85a1.8 1.8 0 0 0-.15-.34l-1.13-1.13c0-1.23-.61-1.92-1.82-2.07-1.29.17-1.87.91-1.72 2.22q.465 1.395 1.95 1.35l.71.71c0 .3.04.6.1.89.25.21.48.19.69-.05.03-.39.03-.79 0-1.18-.2-.25-.43-.49-.66-.71.15-.1.29-.22.39-.37.3.27.58.55.86.84.02 2.23.03 4.47.02 6.7h-.59c0-1.38 0-2.76-.02-4.14-.15-.25-.35-.31-.62-.17a1 1 0 0 0-.12.22c-.02 1.36-.03 2.73-.02 4.09h-.44c0-.99 0-1.97-.02-2.96-.02-.09-.06-.17-.1-.25-.67-.72-1.36-1.43-2.07-2.12-.06-1.48-.82-2.13-2.29-1.95-1.02.41-1.42 1.16-1.21 2.24q.51 1.32 1.95 1.26l1.55 1.55c.02.74.03 1.48.02 2.22-1.56.02-3.12 0-4.68-.07-.9-.24-1.42-.83-1.55-1.75-.02-4.48-.03-8.96-.02-13.45zm7.79 5.66c.84.06 1.19.5 1.06 1.33-.32.62-.8.79-1.45.52-.46-.37-.56-.82-.32-1.35.18-.26.42-.42.71-.49zm7.43 1.28c.89-.03 1.29.4 1.21 1.28-.33.67-.83.85-1.5.52-.54-.49-.58-1-.1-1.55.12-.11.25-.19.39-.25M9.94 19.94c.84 0 1.22.4 1.16 1.23-.28.68-.76.89-1.45.62-.63-.54-.65-1.09-.05-1.67l.34-.17zm9.75.24c.16.13.3.27.44.42-.53.52-1.05 1.05-1.55 1.6-.02 1.43-.03 2.86-.02 4.28h-.59c0-1.51 0-3.02.02-4.53a71 71 0 0 1 1.7-1.77M11.56 22c.62.53 1.21 1.11 1.75 1.72.02.92.03 1.84.02 2.76h-.59c0-.85 0-1.71-.02-2.56l-1.48-1.48s-.03-.07 0-.1c.12-.11.22-.22.32-.34",clipRule:"evenodd"})]});function xt({walletName:e,variant:o="background",className:t}){let n=s("novacore:w-full novacore:h-full novacore:rounded-full",t),r=e.toLowerCase();if(r==="impersonatedwallet")return jsxRuntime.jsx(h,{iconId:"impersonatedwallet",className:n,children:i=>jsxRuntime.jsx(Ge,{ref:i})});let a=ze[r]??r,l=`wallets/${o}/${N(a)}`;return We(a)?jsxRuntime.jsx(d.Suspense,{fallback:jsxRuntime.jsx(f,{animate:true,className:t}),children:jsxRuntime.jsx(h,{iconId:`${a}-${o}`,className:n,children:i=>jsxRuntime.jsx(Ve,{ref:i,id:a,variant:o})})}):jsxRuntime.jsx(P,{githubSrc:l,className:n})}function kt(e=2e3){let[o,t]=d.useState(false),[n,r]=d.useState(null),a=d.useCallback(async l=>{if(!l)return {copied:false,error:new Error("There is no text to copy.")};try{return await navigator.clipboard.writeText(l),t(!0),r(null),setTimeout(()=>t(!1),e),{copied:!0}}catch(i){let m=i instanceof Error?i:new Error("Failed to copy text.");return console.error(m),r(m),setTimeout(()=>r(null),e),{copied:false,error:m}}},[e]);return {isCopied:o,copy:a,error:n}}function Dt(e){let o=r=>typeof window<"u"?window.matchMedia(r).matches:false,[t,n]=d.useState(o(e));return d.useEffect(()=>{let r=window.matchMedia(e),a=()=>n(r.matches);return a(),window.addEventListener("resize",a),()=>window.removeEventListener("resize",a)},[e]),t}
|
|
48
|
+
exports.ChevronArrowWithAnim=yo;exports.CloseIcon=ie;exports.Dialog=Bo;exports.DialogClose=Ho;exports.DialogContent=we;exports.DialogDescription=xe;exports.DialogFooter=he;exports.DialogHeader=be;exports.DialogOverlay=K;exports.DialogPortal=pe;exports.DialogTitle=ye;exports.DialogTrigger=Oo;exports.FallbackIcon=f;exports.GithubFallbackIcon=P;exports.NetworkIcon=nt;exports.StarsBackground=ct;exports.SvgImg=k;exports.SvgToImg=h;exports.ToastCloseButton=dt;exports.WalletIcon=xt;exports.applyFirstPathFill=ne;exports.cn=s;exports.deepMerge=oe;exports.formatIconNameForGithub=N;exports.getChainName=G;exports.isSolanaDev=$;exports.isTouchDevice=B;exports.resolveCssVariable=re;exports.standardButtonClasses=_e;exports.svgToBase64=C;exports.textCenterEllipsis=io;exports.useCopyToClipboard=kt;exports.useMediaQuery=Dt;
|
package/dist/index.d.cts
CHANGED
|
@@ -150,7 +150,8 @@ declare const DialogDescription: React$1.ForwardRefExoticComponent<Omit<DialogPr
|
|
|
150
150
|
interface NetworkIconProps {
|
|
151
151
|
/**
|
|
152
152
|
* The network: an EVM chain ID (`1`), or a string whose part before `:` is a network id of `@web3icons/common`
|
|
153
|
-
* (`'solana:devnet'`, `'base'`).
|
|
153
|
+
* (`'solana:EtWTRABZaYq6iMfeYKouRu166VU2xqa1'`, `'solana:devnet'`, `'base'`). Solana devnet and testnet get the testnet
|
|
154
|
+
* color under their genesis-hash chain IDs and their names.
|
|
154
155
|
*/
|
|
155
156
|
chainId: number | string;
|
|
156
157
|
/** Icon style of `@web3icons/react`. Defaults to `'background'`. */
|
|
@@ -452,10 +453,11 @@ interface ChainInfo {
|
|
|
452
453
|
*
|
|
453
454
|
* Supports both EVM and non-EVM chain identifiers:
|
|
454
455
|
* - **Numeric IDs (EVM):** e.g., `1` → "Ethereum", `137` → "Polygon"
|
|
455
|
-
* - **String IDs (Non-EVM):** e.g., `"solana:devnet"` → "Solana Devnet"
|
|
456
|
+
* - **String IDs (Non-EVM):** e.g., `"solana:EtWTRABZaYq6iMfeYKouRu166VU2xqa1"` or `"solana:devnet"` → "Solana Devnet"
|
|
456
457
|
*
|
|
457
|
-
* For
|
|
458
|
-
* the
|
|
458
|
+
* For Solana dev and test clusters, given as the genesis-hash chain ID of CAIP-30 or as the cluster name
|
|
459
|
+
* (`solana:devnet`), the cluster is appended to the name. Mainnet (`solana:5eykt4UsFv8P8NJdTREpY1vzqKqZKvdp`) is
|
|
460
|
+
* "Solana".
|
|
459
461
|
*
|
|
460
462
|
* The networks are looked up in the metadata of `@web3icons/common`.
|
|
461
463
|
*
|
|
@@ -470,8 +472,8 @@ interface ChainInfo {
|
|
|
470
472
|
* getChainName(1);
|
|
471
473
|
* // → { name: 'Ethereum', id: 'ethereum', filePath: 'ethereum', chainId: 1 }
|
|
472
474
|
*
|
|
473
|
-
* getChainName('solana:
|
|
474
|
-
* // → { name: 'Solana Devnet', id: 'solana', filePath: 'solana', chainId: 'solana:
|
|
475
|
+
* getChainName('solana:EtWTRABZaYq6iMfeYKouRu166VU2xqa1');
|
|
476
|
+
* // → { name: 'Solana Devnet', id: 'solana', filePath: 'solana', chainId: 'solana:EtWTRABZaYq6iMfeYKouRu166VU2xqa1' }
|
|
475
477
|
*
|
|
476
478
|
* getChainName(999999);
|
|
477
479
|
* // → { name: 'Unknown', id: 'unknown', filePath: 'unknown', chainId: 999999 }
|
|
@@ -482,10 +484,11 @@ declare function getChainName(chainId: number | string): ChainInfo;
|
|
|
482
484
|
/**
|
|
483
485
|
* Determines if the current chain is a Solana development or test network.
|
|
484
486
|
*
|
|
485
|
-
* It
|
|
486
|
-
*
|
|
487
|
+
* It checks that the ID is a Solana chain ID (or a string containing 'solana') that names a non-production cluster:
|
|
488
|
+
* the genesis-hash chain ID of devnet or testnet (CAIP-30, e.g. `solana:EtWTRABZaYq6iMfeYKouRu166VU2xqa1`), or
|
|
489
|
+
* 'devnet' / 'testnet' in any letter case (e.g. `solana:devnet`).
|
|
487
490
|
*
|
|
488
|
-
* @param chainId - The chain identifier (e.g., "solana:devnet", 1
|
|
491
|
+
* @param chainId - The chain identifier (e.g., "solana:EtWTRABZaYq6iMfeYKouRu166VU2xqa1", "solana:devnet", 1).
|
|
489
492
|
* @returns {boolean} True only if it is a Solana dev/test chain.
|
|
490
493
|
*/
|
|
491
494
|
declare function isSolanaDev(chainId: number | string): boolean;
|
package/dist/index.d.ts
CHANGED
|
@@ -150,7 +150,8 @@ declare const DialogDescription: React$1.ForwardRefExoticComponent<Omit<DialogPr
|
|
|
150
150
|
interface NetworkIconProps {
|
|
151
151
|
/**
|
|
152
152
|
* The network: an EVM chain ID (`1`), or a string whose part before `:` is a network id of `@web3icons/common`
|
|
153
|
-
* (`'solana:devnet'`, `'base'`).
|
|
153
|
+
* (`'solana:EtWTRABZaYq6iMfeYKouRu166VU2xqa1'`, `'solana:devnet'`, `'base'`). Solana devnet and testnet get the testnet
|
|
154
|
+
* color under their genesis-hash chain IDs and their names.
|
|
154
155
|
*/
|
|
155
156
|
chainId: number | string;
|
|
156
157
|
/** Icon style of `@web3icons/react`. Defaults to `'background'`. */
|
|
@@ -452,10 +453,11 @@ interface ChainInfo {
|
|
|
452
453
|
*
|
|
453
454
|
* Supports both EVM and non-EVM chain identifiers:
|
|
454
455
|
* - **Numeric IDs (EVM):** e.g., `1` → "Ethereum", `137` → "Polygon"
|
|
455
|
-
* - **String IDs (Non-EVM):** e.g., `"solana:devnet"` → "Solana Devnet"
|
|
456
|
+
* - **String IDs (Non-EVM):** e.g., `"solana:EtWTRABZaYq6iMfeYKouRu166VU2xqa1"` or `"solana:devnet"` → "Solana Devnet"
|
|
456
457
|
*
|
|
457
|
-
* For
|
|
458
|
-
* the
|
|
458
|
+
* For Solana dev and test clusters, given as the genesis-hash chain ID of CAIP-30 or as the cluster name
|
|
459
|
+
* (`solana:devnet`), the cluster is appended to the name. Mainnet (`solana:5eykt4UsFv8P8NJdTREpY1vzqKqZKvdp`) is
|
|
460
|
+
* "Solana".
|
|
459
461
|
*
|
|
460
462
|
* The networks are looked up in the metadata of `@web3icons/common`.
|
|
461
463
|
*
|
|
@@ -470,8 +472,8 @@ interface ChainInfo {
|
|
|
470
472
|
* getChainName(1);
|
|
471
473
|
* // → { name: 'Ethereum', id: 'ethereum', filePath: 'ethereum', chainId: 1 }
|
|
472
474
|
*
|
|
473
|
-
* getChainName('solana:
|
|
474
|
-
* // → { name: 'Solana Devnet', id: 'solana', filePath: 'solana', chainId: 'solana:
|
|
475
|
+
* getChainName('solana:EtWTRABZaYq6iMfeYKouRu166VU2xqa1');
|
|
476
|
+
* // → { name: 'Solana Devnet', id: 'solana', filePath: 'solana', chainId: 'solana:EtWTRABZaYq6iMfeYKouRu166VU2xqa1' }
|
|
475
477
|
*
|
|
476
478
|
* getChainName(999999);
|
|
477
479
|
* // → { name: 'Unknown', id: 'unknown', filePath: 'unknown', chainId: 999999 }
|
|
@@ -482,10 +484,11 @@ declare function getChainName(chainId: number | string): ChainInfo;
|
|
|
482
484
|
/**
|
|
483
485
|
* Determines if the current chain is a Solana development or test network.
|
|
484
486
|
*
|
|
485
|
-
* It
|
|
486
|
-
*
|
|
487
|
+
* It checks that the ID is a Solana chain ID (or a string containing 'solana') that names a non-production cluster:
|
|
488
|
+
* the genesis-hash chain ID of devnet or testnet (CAIP-30, e.g. `solana:EtWTRABZaYq6iMfeYKouRu166VU2xqa1`), or
|
|
489
|
+
* 'devnet' / 'testnet' in any letter case (e.g. `solana:devnet`).
|
|
487
490
|
*
|
|
488
|
-
* @param chainId - The chain identifier (e.g., "solana:devnet", 1
|
|
491
|
+
* @param chainId - The chain identifier (e.g., "solana:EtWTRABZaYq6iMfeYKouRu166VU2xqa1", "solana:devnet", 1).
|
|
489
492
|
* @returns {boolean} True only if it is a Solana dev/test chain.
|
|
490
493
|
*/
|
|
491
494
|
declare function isSolanaDev(chainId: number | string): boolean;
|
package/dist/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {motion,AnimatePresence}from'framer-motion';import {clsx}from'clsx';import {twMerge}from'tailwind-merge';import {networks,wallets}from'@web3icons/common/metadata';import {jsxs,jsx,Fragment}from'react/jsx-runtime';import*as d from'react';import {lazy,useState,useEffect,useCallback,Suspense,useMemo}from'react';import*as c from'@radix-ui/react-dialog';var Uo="novacore:cursor-pointer novacore:rounded-[var(--tuwa-rounded-corners)] novacore:bg-[var(--tuwa-standart-button-bg)] novacore:px-3 novacore:py-2 novacore:flex novacore:items-center novacore:gap-1 novacore:text-sm novacore:font-mono novacore:font-semibold novacore:text-[var(--tuwa-text-primary)] novacore:transition-colors novacore:hover:bg-[var(--tuwa-standart-button-hover)] novacore:disabled:cursor-not-allowed novacore:disabled:opacity-50 novacore:min-h-[36px]";function s(...o){return twMerge(clsx(o))}var y=o=>typeof o=="object"&&o!==null&&!Array.isArray(o);function J(o,e){let t={...o};return y(o)&&y(e)&&Object.keys(e).forEach(n=>{let r=o[n],a=e[n];y(r)&&y(a)?t[n]=J(r,a):t[n]=a;}),t}function x(o){if(typeof o!="string")return false;let e=o.toLowerCase();return e.includes("solana")&&(e.includes("devnet")||e.includes("testnet"))}var M="Unknown";function oo(o){return o.charAt(0).toUpperCase()+o.slice(1).toLowerCase()}function W(o){let e={name:M,id:M.toLowerCase(),filePath:M.toLowerCase(),chainId:o};if(typeof o=="number"){let i=networks.find(l=>l.chainId===o);return i?{name:i.name,id:i.id,filePath:i.filePath?.split(":")[1],chainId:o}:e}let[t,n]=o?o.split(":"):[o],r=networks.find(i=>i.id===t);return r?{name:n&&x(o)?`${r.name} ${oo(n)}`:r.name,id:r.id,filePath:r.filePath?.split(":")[1],chainId:o}:e}function G(o=1200){if(typeof window>"u")return false;let e="ontouchstart"in window,t=navigator.maxTouchPoints>0,n=false;window.matchMedia&&(n=window.matchMedia("(pointer: coarse)").matches);let r=e||t||n,a=window.innerWidth<=o;return r&&a}function eo(o){if(!o.startsWith("var("))return o;let e=o.match(/var\(\s*(--[\w-]+)/);if(!e)return o;let t=e[1];return getComputedStyle(document.documentElement).getPropertyValue(t).trim()||o}function to(o,e){let t=eo(e),r=new DOMParser().parseFromString(o,"image/svg+xml");if(r.querySelector("parsererror"))return console.warn("SVG parse error, returning original"),o;let i=r.querySelector("path");return i&&i.setAttribute("fill",t),new XMLSerializer().serializeToString(r.documentElement)}function N(o,e){let t=o;return e&&(t=to(t,e)),`data:image/svg+xml;base64,${btoa(unescape(encodeURIComponent(t)))}`}var C=o=>`${o.replace(/\s+/g,"-").toLowerCase()}.svg`;function te(o,e,t){if(!o)return "";if(o.length<=e+t)return o;let n=o.slice(0,e),r=o.slice(o.length-t);return `${n}...${r}`}function ve({className:o,strokeWidth:e,isOpen:t}){return jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:e??2,stroke:"currentColor",className:s("novacore:w-4 novacore:h-4 novacore:text-[var(--tuwa-text-secondary)]",o),children:[jsx(AnimatePresence,{children:t&&jsx(motion.path,{strokeLinecap:"round",strokeLinejoin:"round",d:"m4.5 15.75 7.5-7.5 7.5 7.5",variants:{hidden:{translateY:3,scaleY:.8,opacity:0},visible:{translateY:0,scaleY:1,opacity:1}},initial:"hidden",animate:"visible",transition:{duration:.4}})}),jsx(AnimatePresence,{children:!t&&jsx(motion.path,{strokeLinecap:"round",strokeLinejoin:"round",d:"m19.5 8.25-7.5 7.5-7.5-7.5",className:"novacore:relative",variants:{hidden:{translateY:-3,scaleY:.8,opacity:0},visible:{translateY:0,scaleY:1,opacity:1}},initial:"hidden",animate:"visible",transition:{duration:.4}})})]})}var no=d.forwardRef(({className:o,...e},t)=>jsxs("svg",{ref:t,xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",className:s("novacore:h-5 novacore:w-5 novacore:text-[var(--tuwa-text-primary)] novacore:transition-colors",o),...e,children:[jsx("path",{d:"M18 6 6 18"}),jsx("path",{d:"m6 6 12 12"})]}));no.displayName="CloseIcon";var io="novacore:flex novacore:items-center novacore:justify-center novacore:w-full novacore:h-full novacore:rounded-full novacore:text-[var(--tuwa-text-secondary)] novacore:bg-[var(--tuwa-bg-muted)]",f=({animate:o=false,content:e="",className:t})=>jsx("div",{className:s(io,"Nova_Web3_Icon",t,{"novacore:animate-pulse":o}),children:e});function k({src:o,alt:e,...t}){return jsx("img",{...t,src:o,alt:e??"",draggable:false,onDragStart:n=>n.preventDefault(),style:{outline:"none",pointerEvents:"none"}})}var mo="https://raw.githubusercontent.com/0xa3k5/web3icons/refs/heads/main/raw-svgs",L=new Map;function P({githubSrc:o,className:e,alt:t,firstPathFill:n,...r}){let a=`${o}|${n??""}`,i=L.get(a),[l,m]=useState(null),[w,b]=useState("idle"),I=i||l,g=i?"success":w;return useEffect(()=>{let R=true;return L.has(a)?void 0:((async()=>{b("loading");try{let D=await fetch(`${mo}/${o}`);if(!D.ok)throw new Error(`Failed to load icon: ${D.status}`);let X=await D.text();if(R){let V=N(X,n);L.set(a,V),m(V),b("success");}}catch{R&&b("error");}})(),()=>{R=false;})},[o,n,a]),g==="loading"||g==="idle"?jsx(f,{animate:true,className:e}):g==="success"&&I?jsx(k,{...r,src:I,alt:t,className:e}):jsx(f,{content:"?",className:e})}var Ve=c.Root,ze=c.Trigger,uo=c.Portal,We=c.Close,po={initial:{opacity:0,scale:.9,y:20},animate:{opacity:1,scale:1,y:0},exit:{opacity:0,scale:.9,transition:{duration:.2}}},fo={initial:{opacity:0,y:"100%"},animate:{opacity:1,y:"0%"},exit:{opacity:0,y:"100%",transition:{duration:.2}}},vo={initial:{opacity:0},animate:{opacity:1},exit:{opacity:0}},Y=({className:o,backdropAnimation:e})=>(d.useEffect(()=>(typeof window<"u"&&window.document.body.classList.add("NovaModalOpen"),()=>{typeof window<"u"&&window.document.body.classList.remove("NovaModalOpen");}),[]),jsx(AnimatePresence,{children:jsx(motion.div,{variants:e??vo,transition:{duration:.2,ease:"easeInOut"},animate:"animate",initial:"initial",exit:"exit",className:"novacore:relative novacore:overflow-hidden",children:jsx("div",{className:s("novacore:fixed novacore:inset-0 novacore:z-50 novacore:bg-black/55 novacore:backdrop-blur-sm novacore:backdrop-saturate-150",o)})})}));Y.displayName=c.Overlay.displayName;var go=d.forwardRef(({className:o,children:e,modalAnimation:t,backdropAnimation:n,...r},a)=>{let[i,l]=d.useState(false);d.useEffect(()=>{l(G());},[]);let m=t??(i?fo:po);return jsxs(uo,{children:[jsx(Y,{backdropAnimation:n}),jsx(c.Content,{"aria-describedby":"tuwa:modal-content",ref:a,className:s("NovaNoScrolling novacore:fixed novacore:bottom-0 novacore:left-0 novacore:p-0 novacore:sm:bottom-auto novacore:sm:left-[50%] novacore:sm:top-[50%] novacore:sm:translate-x-[-50%] novacore:sm:translate-y-[-50%] novacore:z-50 novacore:sm:p-4 novacore:outline-none",o),...r,children:jsx(motion.div,{layout:true,className:"NovaNoScrolling novacore:relative novacore:overflow-hidden",transition:{layout:{duration:.2,ease:[.1,.1,.2,1]}},children:jsx(AnimatePresence,{children:jsx(motion.div,{variants:m,transition:{duration:.2,ease:"easeInOut"},animate:"animate",initial:"initial",exit:"exit",className:"NovaNoScrolling novacore:relative novacore:overflow-hidden novacore:bg-[var(--tuwa-bg-primary)] novacore:border novacore:border-[var(--tuwa-border-primary)] novacore:rounded-t-[var(--tuwa-rounded-corners)] novacore:sm:rounded-[var(--tuwa-rounded-corners)]",children:jsx("div",{className:s("NovaNoScrolling NovaDialogContent__elements novacore:relative novacore:flex novacore:max-h-[100dvh] novacore:w-full novacore:flex-col novacore:overflow-y-auto","novacore:[transform:translateZ(0)] novacore:[backface-visibility:hidden]"),children:e})})})})})]})});go.displayName=c.Content.displayName;var wo=({className:o,...e})=>jsx("div",{"aria-describedby":"tuwa:modal-header",className:s("novacore:sticky novacore:flex novacore:top-0 novacore:z-11 novacore:w-full novacore:flex-row novacore:items-center novacore:justify-between","novacore:border-b novacore:border-[var(--tuwa-border-primary)] novacore:bg-[var(--tuwa-bg-primary)] novacore:p-4",o),...e});wo.displayName="DialogHeader";var bo=({className:o,...e})=>jsx("div",{"aria-describedby":"tuwa:modal-footer",className:s("novacore:flex novacore:flex-col-reverse novacore:sm:flex-row novacore:sm:justify-end novacore:sm:space-x-2",o),...e});bo.displayName="DialogFooter";var ho=d.forwardRef(({className:o,...e},t)=>jsx(c.Title,{ref:t,"aria-describedby":"tuwa:modal-title",className:s("novacore:text-lg novacore:font-bold novacore:leading-none novacore:tracking-tight novacore:text-[var(--tuwa-text-primary)] novacore:m-0 novacore:font-mono",o),...e}));ho.displayName=c.Title.displayName;var yo=d.forwardRef(({className:o,...e},t)=>jsx(c.Description,{"aria-describedby":"tuwa:modal-description",ref:t,className:s("novacore:text-sm novacore:text-[var(--tuwa-text-secondary)]",o),...e}));yo.displayName=c.Description.displayName;function h({children:o,iconId:e,alt:t,firstPathFill:n,...r}){let[a,i]=useState(null),l=useCallback(m=>{if(m){let w=N(m.outerHTML,n);i({id:e,src:w});}},[e,n]);return a&&a.id===e?jsx(k,{...r,src:a.src,alt:t}):jsx(Fragment,{children:o(l)})}var K=lazy(()=>import('@web3icons/react/dynamic').then(o=>({default:o.NetworkIcon}))),To="var(--tuwa-testnet-icons)";function Je({chainId:o,variant:e="background",className:t}){let n=W(o),r=typeof o=="string",a=r?o.split(":")[0].toLowerCase():o,l=r&&x(o)||n.name.toLowerCase().includes("testnet")?To:void 0,m=s("novacore:w-full novacore:h-full novacore:rounded-full",t),w=typeof a=="string"?a:n.filePath,b=`networks/${e}/${C(w)}`;return n.name==="Unknown"?typeof o=="number"?jsx(f,{content:"?",className:t}):jsx(P,{githubSrc:b,className:m,firstPathFill:l}):jsx(Suspense,{fallback:jsx(f,{animate:true,className:t}),children:jsx(h,{iconId:`${o}-${e}`,className:m,firstPathFill:l,children:g=>typeof a=="string"?jsx(K,{ref:g,id:a,variant:e}):jsx(K,{ref:g,chainId:a,variant:e})})})}function rt({starsCount:o}){let[e,t]=useState(false);useEffect(()=>t(true),[]);let n=useMemo(()=>e?Array.from({length:o??200}).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})):[],[e]);return jsx("div",{className:"novacore:absolute novacore:inset-0 novacore:z-1 novacore:h-full novacore:w-full novacore: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 {motion,AnimatePresence}from'framer-motion';import {clsx}from'clsx';import {twMerge}from'tailwind-merge';import {networks,wallets}from'@web3icons/common/metadata';import {getSolanaCluster}from'@tuwaio/orbit-core';import {jsxs,jsx,Fragment}from'react/jsx-runtime';import*as d from'react';import {lazy,useState,useEffect,useCallback,Suspense,useMemo}from'react';import*as c from'@radix-ui/react-dialog';var _e="novacore:cursor-pointer novacore:rounded-[var(--tuwa-rounded-corners)] novacore:bg-[var(--tuwa-standart-button-bg)] novacore:px-3 novacore:py-2 novacore:flex novacore:items-center novacore:gap-1 novacore:text-sm novacore:font-mono novacore:font-semibold novacore:text-[var(--tuwa-text-primary)] novacore:transition-colors novacore:hover:bg-[var(--tuwa-standart-button-hover)] novacore:disabled:cursor-not-allowed novacore:disabled:opacity-50 novacore:min-h-[36px]";function s(...e){return twMerge(clsx(e))}var y=e=>typeof e=="object"&&e!==null&&!Array.isArray(e);function oe(e,o){let t={...e};return y(e)&&y(o)&&Object.keys(o).forEach(n=>{let r=e[n],a=o[n];y(r)&&y(a)?t[n]=oe(r,a):t[n]=a;}),t}function x(e){if(typeof e!="string")return;let o=e.indexOf(":");if(o<0||e.slice(0,o).toLowerCase()!=="solana")return;let t=e.slice(o+1),n=getSolanaCluster(t)??getSolanaCluster(t.toLowerCase());return n==="devnet"||n==="testnet"?n:void 0}var M="Unknown";function te(e){return e.charAt(0).toUpperCase()+e.slice(1).toLowerCase()}function G(e){let o={name:M,id:M.toLowerCase(),filePath:M.toLowerCase(),chainId:e};if(typeof e=="number"){let i=networks.find(m=>m.chainId===e);return i?{name:i.name,id:i.id,filePath:i.filePath?.split(":")[1],chainId:e}:o}let[t,n]=e?e.split(":"):[e],r=networks.find(i=>i.id===t);if(!r)return o;let a=n?x(e):void 0;return {name:a?`${r.name} ${te(a)}`:r.name,id:r.id,filePath:r.filePath?.split(":")[1],chainId:e}}function $(e){return x(e)!==void 0}function B(e=1200){if(typeof window>"u")return false;let o="ontouchstart"in window,t=navigator.maxTouchPoints>0,n=false;window.matchMedia&&(n=window.matchMedia("(pointer: coarse)").matches);let r=o||t||n,a=window.innerWidth<=e;return r&&a}function re(e){if(!e.startsWith("var("))return e;let o=e.match(/var\(\s*(--[\w-]+)/);if(!o)return e;let t=o[1];return getComputedStyle(document.documentElement).getPropertyValue(t).trim()||e}function ne(e,o){let t=re(o),r=new DOMParser().parseFromString(e,"image/svg+xml");if(r.querySelector("parsererror"))return console.warn("SVG parse error, returning original"),e;let l=r.querySelector("path");return l&&l.setAttribute("fill",t),new XMLSerializer().serializeToString(r.documentElement)}function C(e,o){let t=e;return o&&(t=ne(t,o)),`data:image/svg+xml;base64,${btoa(unescape(encodeURIComponent(t)))}`}var N=e=>`${e.replace(/\s+/g,"-").toLowerCase()}.svg`;function io(e,o,t){if(!e)return "";if(e.length<=o+t)return e;let n=e.slice(0,o),r=e.slice(e.length-t);return `${n}...${r}`}function yo({className:e,strokeWidth:o,isOpen:t}){return jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:o??2,stroke:"currentColor",className:s("novacore:w-4 novacore:h-4 novacore:text-[var(--tuwa-text-secondary)]",e),children:[jsx(AnimatePresence,{children:t&&jsx(motion.path,{strokeLinecap:"round",strokeLinejoin:"round",d:"m4.5 15.75 7.5-7.5 7.5 7.5",variants:{hidden:{translateY:3,scaleY:.8,opacity:0},visible:{translateY:0,scaleY:1,opacity:1}},initial:"hidden",animate:"visible",transition:{duration:.4}})}),jsx(AnimatePresence,{children:!t&&jsx(motion.path,{strokeLinecap:"round",strokeLinejoin:"round",d:"m19.5 8.25-7.5 7.5-7.5-7.5",className:"novacore:relative",variants:{hidden:{translateY:-3,scaleY:.8,opacity:0},visible:{translateY:0,scaleY:1,opacity:1}},initial:"hidden",animate:"visible",transition:{duration:.4}})})]})}var ie=d.forwardRef(({className:e,...o},t)=>jsxs("svg",{ref:t,xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",className:s("novacore:h-5 novacore:w-5 novacore:text-[var(--tuwa-text-primary)] novacore:transition-colors",e),...o,children:[jsx("path",{d:"M18 6 6 18"}),jsx("path",{d:"m6 6 12 12"})]}));ie.displayName="CloseIcon";var ce="novacore:flex novacore:items-center novacore:justify-center novacore:w-full novacore:h-full novacore:rounded-full novacore:text-[var(--tuwa-text-secondary)] novacore:bg-[var(--tuwa-bg-muted)]",f=({animate:e=false,content:o="",className:t})=>jsx("div",{className:s(ce,"Nova_Web3_Icon",t,{"novacore:animate-pulse":e}),children:o});function k({src:e,alt:o,...t}){return jsx("img",{...t,src:e,alt:o??"",draggable:false,onDragStart:n=>n.preventDefault(),style:{outline:"none",pointerEvents:"none"}})}var de="https://raw.githubusercontent.com/0xa3k5/web3icons/refs/heads/main/raw-svgs",L=new Map;function P({githubSrc:e,className:o,alt:t,firstPathFill:n,...r}){let a=`${e}|${n??""}`,l=L.get(a),[i,m]=useState(null),[w,b]=useState("idle"),D=l||i,g=l?"success":w;return useEffect(()=>{let I=true;return L.has(a)?void 0:((async()=>{b("loading");try{let R=await fetch(`${de}/${e}`);if(!R.ok)throw new Error(`Failed to load icon: ${R.status}`);let j=await R.text();if(I){let V=C(j,n);L.set(a,V),m(V),b("success");}}catch{I&&b("error");}})(),()=>{I=false;})},[e,n,a]),g==="loading"||g==="idle"?jsx(f,{animate:true,className:o}):g==="success"&&D?jsx(k,{...r,src:D,alt:t,className:o}):jsx(f,{content:"?",className:o})}var Bo=c.Root,Oo=c.Trigger,pe=c.Portal,Ho=c.Close,fe={initial:{opacity:0,scale:.9,y:20},animate:{opacity:1,scale:1,y:0},exit:{opacity:0,scale:.9,transition:{duration:.2}}},ve={initial:{opacity:0,y:"100%"},animate:{opacity:1,y:"0%"},exit:{opacity:0,y:"100%",transition:{duration:.2}}},ge={initial:{opacity:0},animate:{opacity:1},exit:{opacity:0}},K=({className:e,backdropAnimation:o})=>(d.useEffect(()=>(typeof window<"u"&&window.document.body.classList.add("NovaModalOpen"),()=>{typeof window<"u"&&window.document.body.classList.remove("NovaModalOpen");}),[]),jsx(AnimatePresence,{children:jsx(motion.div,{variants:o??ge,transition:{duration:.2,ease:"easeInOut"},animate:"animate",initial:"initial",exit:"exit",className:"novacore:relative novacore:overflow-hidden",children:jsx("div",{className:s("novacore:fixed novacore:inset-0 novacore:z-50 novacore:bg-black/55 novacore:backdrop-blur-sm novacore:backdrop-saturate-150",e)})})}));K.displayName=c.Overlay.displayName;var we=d.forwardRef(({className:e,children:o,modalAnimation:t,backdropAnimation:n,...r},a)=>{let[l,i]=d.useState(false);d.useEffect(()=>{i(B());},[]);let m=t??(l?ve:fe);return jsxs(pe,{children:[jsx(K,{backdropAnimation:n}),jsx(c.Content,{"aria-describedby":"tuwa:modal-content",ref:a,className:s("NovaNoScrolling novacore:fixed novacore:bottom-0 novacore:left-0 novacore:p-0 novacore:sm:bottom-auto novacore:sm:left-[50%] novacore:sm:top-[50%] novacore:sm:translate-x-[-50%] novacore:sm:translate-y-[-50%] novacore:z-50 novacore:sm:p-4 novacore:outline-none",e),...r,children:jsx(motion.div,{layout:true,className:"NovaNoScrolling novacore:relative novacore:overflow-hidden",transition:{layout:{duration:.2,ease:[.1,.1,.2,1]}},children:jsx(AnimatePresence,{children:jsx(motion.div,{variants:m,transition:{duration:.2,ease:"easeInOut"},animate:"animate",initial:"initial",exit:"exit",className:"NovaNoScrolling novacore:relative novacore:overflow-hidden novacore:bg-[var(--tuwa-bg-primary)] novacore:border novacore:border-[var(--tuwa-border-primary)] novacore:rounded-t-[var(--tuwa-rounded-corners)] novacore:sm:rounded-[var(--tuwa-rounded-corners)]",children:jsx("div",{className:s("NovaNoScrolling NovaDialogContent__elements novacore:relative novacore:flex novacore:max-h-[100dvh] novacore:w-full novacore:flex-col novacore:overflow-y-auto","novacore:[transform:translateZ(0)] novacore:[backface-visibility:hidden]"),children:o})})})})})]})});we.displayName=c.Content.displayName;var be=({className:e,...o})=>jsx("div",{"aria-describedby":"tuwa:modal-header",className:s("novacore:sticky novacore:flex novacore:top-0 novacore:z-11 novacore:w-full novacore:flex-row novacore:items-center novacore:justify-between","novacore:border-b novacore:border-[var(--tuwa-border-primary)] novacore:bg-[var(--tuwa-bg-primary)] novacore:p-4",e),...o});be.displayName="DialogHeader";var he=({className:e,...o})=>jsx("div",{"aria-describedby":"tuwa:modal-footer",className:s("novacore:flex novacore:flex-col-reverse novacore:sm:flex-row novacore:sm:justify-end novacore:sm:space-x-2",e),...o});he.displayName="DialogFooter";var ye=d.forwardRef(({className:e,...o},t)=>jsx(c.Title,{ref:t,"aria-describedby":"tuwa:modal-title",className:s("novacore:text-lg novacore:font-bold novacore:leading-none novacore:tracking-tight novacore:text-[var(--tuwa-text-primary)] novacore:m-0 novacore:font-mono",e),...o}));ye.displayName=c.Title.displayName;var xe=d.forwardRef(({className:e,...o},t)=>jsx(c.Description,{"aria-describedby":"tuwa:modal-description",ref:t,className:s("novacore:text-sm novacore:text-[var(--tuwa-text-secondary)]",e),...o}));xe.displayName=c.Description.displayName;function h({children:e,iconId:o,alt:t,firstPathFill:n,...r}){let[a,l]=useState(null),i=useCallback(m=>{if(m){let w=C(m.outerHTML,n);l({id:o,src:w});}},[o,n]);return a&&a.id===o?jsx(k,{...r,src:a.src,alt:t}):jsx(Fragment,{children:e(i)})}var X=lazy(()=>import('@web3icons/react/dynamic').then(e=>({default:e.NetworkIcon}))),De="var(--tuwa-testnet-icons)";function nt({chainId:e,variant:o="background",className:t}){let n=G(e),r=typeof e=="string",a=r?e.split(":")[0].toLowerCase():e,i=r&&$(e)||n.name.toLowerCase().includes("testnet")?De:void 0,m=s("novacore:w-full novacore:h-full novacore:rounded-full",t),w=typeof a=="string"?a:n.filePath,b=`networks/${o}/${N(w)}`;return n.name==="Unknown"?typeof e=="number"?jsx(f,{content:"?",className:t}):jsx(P,{githubSrc:b,className:m,firstPathFill:i}):jsx(Suspense,{fallback:jsx(f,{animate:true,className:t}),children:jsx(h,{iconId:`${e}-${o}`,className:m,firstPathFill:i,children:g=>typeof a=="string"?jsx(X,{ref:g,id:a,variant:o}):jsx(X,{ref:g,chainId:a,variant:o})})})}function ct({starsCount:e}){let[o,t]=useState(false);useEffect(()=>t(true),[]);let n=useMemo(()=>o?Array.from({length:e??200}).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})):[],[o]);return jsx("div",{className:"novacore:absolute novacore:inset-0 novacore:z-1 novacore:h-full novacore:w-full novacore: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 {motion,AnimatePresence}from'framer-motion';import {clsx}from'clsx';impor
|
|
|
44
44
|
transform-origin: center;
|
|
45
45
|
stroke-width: 2;
|
|
46
46
|
}
|
|
47
|
-
`})}),n.map((r,a)=>jsx("circle",{cx:r.x,cy:r.y,r:r.r,fill:"rgba(var(--tuwa-bg-primary), 0.7)",className:r.isSupernova?"supernova":"pulsar",style:{animationDelay:`${r.delay}s`,animationDuration:`${r.duration}s`}},a))]})})}function
|
|
48
|
-
export{
|
|
47
|
+
`})}),n.map((r,a)=>jsx("circle",{cx:r.x,cy:r.y,r:r.r,fill:"rgba(var(--tuwa-bg-primary), 0.7)",className:r.isSupernova?"supernova":"pulsar",style:{animationDelay:`${r.delay}s`,animationDuration:`${r.duration}s`}},a))]})})}function dt({closeToast:e,ariaLabel:o="Close toast notification",title:t="Close toast notification",className:n,iconClassName:r}){return jsx("button",{type:"button",onClick:e,"aria-label":o,title:t,className:s("novacore:absolute novacore:top-2 novacore:right-2 novacore:cursor-pointer novacore:rounded-[var(--tuwa-rounded-corners)] novacore:p-1","novacore:text-[var(--tuwa-text-tertiary)] novacore:transition-colors","novacore:hover:bg-[var(--tuwa-bg-muted)] novacore:hover:text-[var(--tuwa-text-primary)]",n),children:jsx("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"currentColor",className:s("novacore:h-5 novacore:w-5",r),children:jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M6 18 18 6M6 6l12 12"})})})}var Ve=lazy(()=>import('@web3icons/react/dynamic').then(e=>({default:e.WalletIcon}))),ze={walletconnect:"wallet-connect"};function We(e){return wallets.some(o=>o.id===e||o.name?.toLowerCase()===e)}var Ge=({className:e,ref:o})=>jsxs("svg",{ref:o,className:e,fill:"none",viewBox:"0 0 32 32",xmlns:"http://www.w3.org/2000/svg",children:[jsx("path",{fill:"#fff",fillRule:"evenodd",d:"M16 0c8.84 0 16 7.16 16 16s-7.16 16-16 16S0 24.84 0 16 7.16 0 16 0",clipRule:"evenodd"}),jsx("path",{fill:"#000",fillRule:"evenodd",d:"M16.54 2.01h1.53c.5.09.99.23 1.48.42.21.25.19.48-.05.69q-.195.045-.39 0c-1.86-.65-3.55-.35-5.07.89 2.39.7 3.84 2.27 4.36 4.7.12.85.08 1.68-.12 2.51.87 0 1.74 0 2.61-.02.39-.4.7-.85.94-1.35-.45-.45-.65-.99-.59-1.63-1.15.08-1.79-.44-1.92-1.58.14-1.12.78-1.67 1.92-1.63a.7.7 0 0 0-.12-.49l-.89-.89c-.02-.45.19-.6.62-.47.24.19.46.39.66.62.71-.79 1.5-.89 2.39-.32.44.42.62.94.54 1.55 1.49.02 2.11.76 1.85 2.22-.08.17-.17.34-.27.49.53.59.87 1.28 1.01 2.07.08 4.6.1 9.19.05 13.79-.19 1.58-1 2.71-2.44 3.37-.29.1-.59.2-.89.27H7.2c-1.31-.33-2.05-1.17-2.24-2.51-.03-5.24-.03-10.47 0-15.71.3-1.62 1.28-2.46 2.93-2.54 1.26-1.77 2.98-2.64 5.17-2.61.96-1.01 2.13-1.62 3.5-1.85zm6.11 1.87c.39-.03.7.12.91.44.06.39.09.79.1 1.18.02.12.07.21.17.27.41 0 .82.04 1.23.1.49.26.63.65.42 1.16-.07.14-.18.25-.32.32-.39.06-.79.09-1.18.1-.12.02-.21.07-.27.17l-.15 1.33c-.32.46-.72.55-1.21.27a.76.76 0 0 1-.27-.37c-.06-.41-.09-.82-.1-1.23a.35.35 0 0 0-.27-.17l-1.08-.05c-.46-.24-.62-.61-.47-1.11.14-.27.36-.43.66-.47l.99-.05s.09-.04.12-.07l.15-1.28q.18-.39.57-.54m-10.49.79c2.41-.09 4.12.94 5.15 3.1.44 1.12.48 2.25.12 3.4-.84.06-1.67.07-2.51.02.56-.68.52-1.32-.1-1.92-.26-.13-.54-.19-.84-.17.02-.95 0-1.91-.07-2.86-.21-.41-.55-.58-1.01-.52-.17.03-.31.09-.44.2-.72.92-1.43 1.85-2.14 2.78-.28.45-.29.91-.05 1.38q.225.3.57.42c.34.02.69.03 1.03.02v.69c-1.3.02-2.59 0-3.89-.05-.58-2.1-.08-3.88 1.53-5.34.79-.62 1.68-1 2.66-1.16zm.83 1.82c.07 0 .13.03.17.1l.05 3.05c.04.09.1.16.17.22l.89.05c.22.08.3.24.22.47q-.27.42-.57.81c-.43.02-.85.03-1.28.02 0-.41 0-.82-.02-1.23a.46.46 0 0 0-.17-.17l-1.28-.05c-.3-.1-.37-.29-.22-.57.7-.89 1.39-1.79 2.04-2.71zm-5.81.84h.2a6.1 6.1 0 0 0-.25 3.77c-.59-.13-1.01-.49-1.26-1.06-.36-1.29.08-2.19 1.31-2.71m17.98.83c.05 0 .1 0 .15.02q.825.855.96 2.04.045 1.305 0 2.61a3.76 3.76 0 0 0-2.54-1.55c-.61-.05-1.21-.08-1.82-.1.26-.31.48-.66.64-1.03 1.31.02 1.94-.62 1.87-1.95.26.02.5 0 .74-.05zM5.7 11.22c.41.4.91.65 1.48.76l16.06.05c1.42.13 2.38.87 2.88 2.19.07.24.12.49.15.74.03 2.86.03 5.71 0 8.57-.21 1.44-1 2.38-2.39 2.83-.24.05-.49.08-.74.1-1.26.02-2.53.03-3.79.02 0-1.33 0-2.66.02-3.99l1.55-1.55c1.42-.04 2.09-.78 1.99-2.19-.24-.88-.81-1.34-1.72-1.38-1.2.12-1.81.8-1.82 2.02l-1.92 1.92c-.08.11-.14.22-.2.34-.07 1.61-.1 3.22-.07 4.83h-.44c0-2.28 0-4.56-.02-6.85a1.8 1.8 0 0 0-.15-.34l-1.13-1.13c0-1.23-.61-1.92-1.82-2.07-1.29.17-1.87.91-1.72 2.22q.465 1.395 1.95 1.35l.71.71c0 .3.04.6.1.89.25.21.48.19.69-.05.03-.39.03-.79 0-1.18-.2-.25-.43-.49-.66-.71.15-.1.29-.22.39-.37.3.27.58.55.86.84.02 2.23.03 4.47.02 6.7h-.59c0-1.38 0-2.76-.02-4.14-.15-.25-.35-.31-.62-.17a1 1 0 0 0-.12.22c-.02 1.36-.03 2.73-.02 4.09h-.44c0-.99 0-1.97-.02-2.96-.02-.09-.06-.17-.1-.25-.67-.72-1.36-1.43-2.07-2.12-.06-1.48-.82-2.13-2.29-1.95-1.02.41-1.42 1.16-1.21 2.24q.51 1.32 1.95 1.26l1.55 1.55c.02.74.03 1.48.02 2.22-1.56.02-3.12 0-4.68-.07-.9-.24-1.42-.83-1.55-1.75-.02-4.48-.03-8.96-.02-13.45zm7.79 5.66c.84.06 1.19.5 1.06 1.33-.32.62-.8.79-1.45.52-.46-.37-.56-.82-.32-1.35.18-.26.42-.42.71-.49zm7.43 1.28c.89-.03 1.29.4 1.21 1.28-.33.67-.83.85-1.5.52-.54-.49-.58-1-.1-1.55.12-.11.25-.19.39-.25M9.94 19.94c.84 0 1.22.4 1.16 1.23-.28.68-.76.89-1.45.62-.63-.54-.65-1.09-.05-1.67l.34-.17zm9.75.24c.16.13.3.27.44.42-.53.52-1.05 1.05-1.55 1.6-.02 1.43-.03 2.86-.02 4.28h-.59c0-1.51 0-3.02.02-4.53a71 71 0 0 1 1.7-1.77M11.56 22c.62.53 1.21 1.11 1.75 1.72.02.92.03 1.84.02 2.76h-.59c0-.85 0-1.71-.02-2.56l-1.48-1.48s-.03-.07 0-.1c.12-.11.22-.22.32-.34",clipRule:"evenodd"})]});function xt({walletName:e,variant:o="background",className:t}){let n=s("novacore:w-full novacore:h-full novacore:rounded-full",t),r=e.toLowerCase();if(r==="impersonatedwallet")return jsx(h,{iconId:"impersonatedwallet",className:n,children:i=>jsx(Ge,{ref:i})});let a=ze[r]??r,l=`wallets/${o}/${N(a)}`;return We(a)?jsx(Suspense,{fallback:jsx(f,{animate:true,className:t}),children:jsx(h,{iconId:`${a}-${o}`,className:n,children:i=>jsx(Ve,{ref:i,id:a,variant:o})})}):jsx(P,{githubSrc:l,className:n})}function kt(e=2e3){let[o,t]=useState(false),[n,r]=useState(null),a=useCallback(async l=>{if(!l)return {copied:false,error:new Error("There is no text to copy.")};try{return await navigator.clipboard.writeText(l),t(!0),r(null),setTimeout(()=>t(!1),e),{copied:!0}}catch(i){let m=i instanceof Error?i:new Error("Failed to copy text.");return console.error(m),r(m),setTimeout(()=>r(null),e),{copied:false,error:m}}},[e]);return {isCopied:o,copy:a,error:n}}function Dt(e){let o=r=>typeof window<"u"?window.matchMedia(r).matches:false,[t,n]=useState(o(e));return useEffect(()=>{let r=window.matchMedia(e),a=()=>n(r.matches);return a(),window.addEventListener("resize",a),()=>window.removeEventListener("resize",a)},[e]),t}
|
|
48
|
+
export{yo as ChevronArrowWithAnim,ie as CloseIcon,Bo as Dialog,Ho as DialogClose,we as DialogContent,xe as DialogDescription,he as DialogFooter,be as DialogHeader,K as DialogOverlay,pe as DialogPortal,ye as DialogTitle,Oo as DialogTrigger,f as FallbackIcon,P as GithubFallbackIcon,nt as NetworkIcon,ct as StarsBackground,k as SvgImg,h as SvgToImg,dt as ToastCloseButton,xt as WalletIcon,ne as applyFirstPathFill,s as cn,oe as deepMerge,N as formatIconNameForGithub,G as getChainName,$ as isSolanaDev,B as isTouchDevice,re as resolveCssVariable,_e as standardButtonClasses,C as svgToBase64,io as textCenterEllipsis,kt as useCopyToClipboard,Dt as useMediaQuery};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tuwaio/nova-core",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.8.1",
|
|
4
4
|
"private": false,
|
|
5
5
|
"author": "Oleksandr Tkach",
|
|
6
6
|
"license": "Apache-2.0",
|
|
@@ -50,28 +50,30 @@
|
|
|
50
50
|
],
|
|
51
51
|
"peerDependencies": {
|
|
52
52
|
"@radix-ui/react-dialog": "1.x.x",
|
|
53
|
-
"@
|
|
53
|
+
"@tuwaio/orbit-core": ">=0.4",
|
|
54
54
|
"@web3icons/common": ">=0.11",
|
|
55
|
+
"@web3icons/react": ">=4",
|
|
55
56
|
"clsx": "2.x.x",
|
|
56
|
-
"framer-motion": "12.x.x || 13.x.x",
|
|
57
|
+
"framer-motion": "12.x.x || 13.x.x || 14.x.x",
|
|
57
58
|
"react": ">=19.2.3",
|
|
58
59
|
"tailwind-merge": "3.x.x"
|
|
59
60
|
},
|
|
60
61
|
"devDependencies": {
|
|
62
|
+
"@radix-ui/react-dialog": "^1.2.0",
|
|
61
63
|
"@tailwindcss/postcss": "^4.3.3",
|
|
62
64
|
"@tailwindcss/vite": "^4.3.3",
|
|
65
|
+
"@tuwaio/orbit-core": "0.5.0",
|
|
63
66
|
"@types/react": "^19.3.0",
|
|
64
|
-
"@
|
|
65
|
-
"@web3icons/react": "^4.1.
|
|
66
|
-
"@web3icons/common": "^0.11.52",
|
|
67
|
+
"@web3icons/common": "^0.11.53",
|
|
68
|
+
"@web3icons/react": "^4.1.24",
|
|
67
69
|
"autoprefixer": "^10.6.1",
|
|
68
70
|
"clsx": "^2.1.1",
|
|
69
|
-
"framer-motion": "
|
|
70
|
-
"postcss": "^8.5.
|
|
71
|
+
"framer-motion": "14.0.0",
|
|
72
|
+
"postcss": "^8.5.29",
|
|
71
73
|
"postcss-cli": "^12.0.0",
|
|
72
74
|
"react": "^19.3.0",
|
|
73
|
-
"tailwindcss": "^4.3.3",
|
|
74
75
|
"tailwind-merge": "^3.7.0",
|
|
76
|
+
"tailwindcss": "^4.3.3",
|
|
75
77
|
"tsup": "^8.5.1",
|
|
76
78
|
"typescript": "6.0.3",
|
|
77
79
|
"vitest": "^5.0.3"
|