diff --git a/assets/index-AixpPbN9.js b/assets/index-8VJ82kI8.js similarity index 98% rename from assets/index-AixpPbN9.js rename to assets/index-8VJ82kI8.js index f12eb8e..d5e901e 100644 --- a/assets/index-AixpPbN9.js +++ b/assets/index-8VJ82kI8.js @@ -1189,6 +1189,6 @@ const ConnectedAccounts = () => { - );`;return u.jsxs(u.Fragment,{children:[u.jsx(Bn,{folder:e}),u.jsx(In,{title:"Extension Accounts Provider",subtitle:"Connect to available extensions and subscribe to accounts.",npm:t,status:"stable"}),u.jsxs("p",{children:[u.jsx("a",{href:"https://github.com/polkadot-ui/library/blob/main/packages/ui-react/lib/connect/ExtensionAccountsProvider/index.tsx",target:"_blank",rel:"noreferrer",children:u.jsx("code",{children:"ExtensionAccountsProvider"})})," ","provides a simple means of connecting to web3 extensions that implement the ",u.jsx("code",{children:"window.injectedWeb3"})," interface, and subscribes to their accounts. It automatically re-connects to extensions on subsequent visits, and allows dApps to set an active account if found in an extension."]}),u.jsx(at,{children:u.jsx("p",{children:"This provider prevents the multiple pop-up issue (all available extensions popping up when connecting to extensions) by design. Such behaviour should be treated as an anti-pattern and be avoided."})}),u.jsx(at,{children:u.jsxs("p",{children:["EVM accounts are not currently supported by"," ",u.jsx("code",{children:"ExtensionAccountsProvider"}),"."]})}),u.jsx(Te,{id:"requires",children:"Requires:"}),u.jsx("p",{}),u.jsx("ul",{children:u.jsxs("li",{children:[u.jsx(Jo,{to:"/extensions-provider",children:u.jsx("code",{children:"ExtensionsProvider"})}),": Must wrap ",u.jsx("code",{children:"ExtensionAccountsProvider"})," to provide the available extensions."]})}),u.jsx(Te,{id:"requires",children:"Warning:"}),u.jsx(at,{children:u.jsxs("p",{children:["When ",u.jsx("code",{children:"React.StrictMode"})," is used inside the Application, it should be placed ",u.jsx("b",{children:"after"})," the ",u.jsx("code",{children:"ExtensionsProvider"})," and"," ",u.jsx("code",{children:"ExtensionAccountsProvider"}),", or the providers will not work;"]})}),u.jsx(je,{code:n,standalone:!0}),u.jsx("hr",{}),u.jsx(Te,{id:"providers-setup",children:"Providers Setup"}),u.jsxs("p",{children:["Wrap your app with ",u.jsx("code",{children:"ExtensionAccountsProvider"})," and provide the required props. Note that ",u.jsx("code",{children:"ExtensionsProvider"})," is also required, in order to provide the available extensions to connect to. The required props are referenced further down."]}),u.jsx(iB,{}),u.jsx(Te,{id:"connecting-extensions",children:"Connecting Extensions"}),u.jsxs("p",{children:["With the providers in place, you can call"," ",u.jsx("code",{children:"connectExtensionAccounts"})," to connect to an extension. The following example attempts to find and connect to Subwallet JS upon a button click."]}),u.jsx(oB,{}),u.jsx("p",{children:"It is recommended to carry out validation checks, such as if the extension is already connected and if it exists."}),u.jsx(Te,{id:"getting-accounts",children:"Getting Accounts"}),u.jsxs("p",{children:["Once connected to an extension, the subscribed accounts become available via ",u.jsx("code",{children:"extensionAccounts"}),". The ",u.jsx("code",{children:"address"}),","," ",u.jsx("code",{children:"name"})," of the account, and ",u.jsx("code",{children:"signer"})," are returned for each account."]}),u.jsx(sB,{}),u.jsx("hr",{className:"lg"}),u.jsx(pn,{id:"props",children:"Props"}),u.jsx(Te,{id:"dappName",children:"dappName"}),u.jsx("div",{className:"params inline",children:u.jsx("p",{children:"string"})}),u.jsx("p",{children:"A dApp identifier that is provided to the web3 extension(s) being connected to."}),u.jsx(Te,{id:"network",children:"network"}),u.jsx("div",{className:"params inline",children:u.jsx("p",{children:'"polkadot" | "kusama" | "westend"'})}),u.jsx("p",{children:"The active network, in lower-case."}),u.jsx(Te,{id:"ss58",children:"ss58"}),u.jsx("div",{className:"params inline",children:u.jsx("p",{children:"number"})}),u.jsx("p",{children:"The SS58 prefix of the current network."}),u.jsx("p",{children:u.jsxs("i",{children:["Planned to be derived from ",u.jsx("code",{children:"network"})," in a future release."]})}),u.jsx(Te,{id:"activeAccount",children:"activeAccount"}),u.jsx("div",{className:"params inline",children:u.jsx("p",{children:"string | null"})}),u.jsxs("p",{children:["The current active account on your dApp, if any."," ",u.jsx("code",{children:"ExtensionAccountsProvider"})," will automatically connect to this active account, if found, when subscribing to extension account. See the next prop for more details."]}),u.jsx(Te,{id:"setActiveAccount",children:"setActiveAccount"}),u.jsx("div",{className:"params inline",children:u.jsx("p",{children:"(address: string): void"})}),u.jsx("p",{children:"Provide a setter function to call if the active account is found when subscribing to extension accounts."}),u.jsx("hr",{className:"lg"}),u.jsx(pn,{id:"values",children:"Values"}),u.jsx(Te,{id:"connectExtensionAccounts",children:"connectExtensionAccounts"}),u.jsx("div",{className:"params inline",children:u.jsx("p",{children:"(id: string): Promise"})}),u.jsxs("p",{children:["Call this function to connect to the provided extension ",u.jsx("code",{children:"id"})," ","and subscribe to its accounts."]}),u.jsx(Te,{id:"extensionAccounts",children:"extensionAccounts"}),u.jsx("div",{className:"params inline",children:u.jsx("p",{children:"ExtensionAccount[]"})}),u.jsx("p",{children:"The list of extension accounts that have been subscribed to."}),u.jsx(Te,{id:"extensionAccountsSynced",children:"extensionAccountsSynced"}),u.jsx("div",{className:"params inline",children:u.jsx("p",{children:"boolean"})}),u.jsxs("p",{children:["Signals whether extensions are still being connected to and subscribed to. A value of ",u.jsx("code",{children:"true"})," means that the process is complete."]})]})},lB=()=>u.jsx("div",{className:"doc",children:u.jsx(aB,{npm:"@polkadot-ui/react",folder:"Components/Connect/ExtensionAccountsProvider"})}),cB=[{path:"overview",name:"Overview",element:u.jsx(C6,{}),default:!0},{path:"installation",name:"Installation",element:u.jsx(qU,{})},{path:"using-themes",name:"Using Themes",element:u.jsx($U,{})}],uB=[{path:"base-utilities",name:"Base Utilities",element:u.jsx(FU,{})},{path:"unit_utilities",name:"Unit Utilities",element:u.jsx(DU,{})}],fB=[{path:"extensions",name:"Web3 Extensions",element:u.jsx(hU,{})},{path:"validators",name:"Validator Operators",element:u.jsx(gU,{})}],dB=[{path:"extensions-provider",name:"Extensions",element:u.jsx(rB,{})},{path:"extension-accounts-provider",name:"Extension Accounts",element:u.jsx(lB,{})},{path:"polkicon",name:"Polkicon",element:u.jsx(iU,{})},{path:"odometer",name:"Odometer",element:u.jsx(SU,{})},{path:"overlay",name:"Overlay",element:u.jsx(kU,{})}],qi=[{path:"/",name:"Home",element:u.jsx(C6,{})},...cB,...fB,...dB,...uB],hB=[{name:"Getting Started",paths:[{paths:["overview"]},{paths:["installation"]},{paths:["using-themes"]}]},{name:"Data & Assets",paths:[{paths:["extensions"]},{paths:["validators"]}]},{name:"Components",paths:[{heading:"Connect",paths:["extensions-provider","extension-accounts-provider"]},{heading:"UI",paths:["polkicon","odometer","overlay"]}]},{name:"Utilities",paths:[{paths:["base-utilities","unit_utilities"]}]}],R6=e=>{var t;return(t=qi==null?void 0:qi.find(n=>n.path===e))==null?void 0:t.name},F6=e=>!!(qi!=null&&qi.find(t=>t.default===!0&&t.path===e));var U6={};(function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.PowerGlitch=e.mergeOptions=void 0;const t=(x="always")=>({playMode:x,createContainers:!0,hideOverflow:!1,timing:x==="always"?{duration:2*1e3,iterations:1/0}:{duration:250,iterations:1},glitchTimeSpan:x==="always"?{start:.5,end:.7}:{start:0,end:1},shake:{velocity:15,amplitudeX:.2,amplitudeY:.2},slice:x==="click"?{count:15,velocity:20,minHeight:.02,maxHeight:.15,hueRotate:!0}:{count:6,velocity:15,minHeight:.02,maxHeight:.15,hueRotate:!0},pulse:!1}),n=(x,j)=>{if(!x.glitchTimeSpan)return 1;const w=x.glitchTimeSpan.start,T=x.glitchTimeSpan.end;if(jT)return 0;const b=w+(T-w)/2;return j(Math.random()-.5)*2*n(x,j),i=({minHeight:x,maxHeight:j,minWidth:w,maxWidth:T})=>{const b=Math.floor(Math.random()*((j-x)*100+1))+x*100,g=Math.floor(Math.random()*((T-w)*100+1))+w*100,v=Math.floor(Math.random()*(100-b)),N=Math.floor(Math.random()*(100-g)),z=`${N+g}% ${v}%`,O=`${N+g}% ${v+b}%`,U=`${N}% ${v+b}%`,V=`${N}% ${v}%`;return`polygon(${z},${O},${U},${V})`},o=x=>{const j=Math.floor(x.slice.velocity*x.timing.duration/1e3)+1,w=[];for(let T=0;Tx.pulse?{steps:[{transform:"scale(1)",opacity:"1"},{transform:`scale(${x.pulse.scale})`,opacity:"0"}],timing:Object.assign(Object.assign({},x.timing),{delay:(x.glitchTimeSpan?x.glitchTimeSpan.start:0)*x.timing.duration,easing:"ease-in-out"})}:null,a=x=>{if(!x.shake)return{steps:[],timing:{}};const j=Math.floor(x.shake.velocity*x.timing.duration/1e3)+1,w=[];for(let T=0;T[a(x),s(x),...Array.from({length:x.slice.count}).map(()=>o(x))].filter(j=>j!==null),c=(...x)=>{const j=w=>w&&typeof w=="object";return x.reduce((w,T)=>(Object.keys(T).forEach(b=>{j(w[b])&&j(T[b])?w[b]=(0,e.mergeOptions)(w[b],T[b]):T[b]!==void 0&&(w[b]=T[b])}),w),{})};e.mergeOptions=c;const f=(x,j)=>{var w,T;if(!j.createContainers)return{container:x,layersContainer:x,glitched:x.firstElementChild};if(!x.dataset.glitched){const v=document.createElement("div"),N=document.createElement("div");return getComputedStyle(x).getPropertyValue("display").match(/^inline/)&&(N.style.display="inline-block"),N.appendChild(v),(w=x.parentElement)===null||w===void 0||w.insertBefore(N,x),v.prepend(x),{container:N,layersContainer:v,glitched:x}}const b=x.parentElement,g=(T=x.parentElement)===null||T===void 0?void 0:T.parentElement;for(;b.children.length>1;)b.removeChild(b.children[1]);return b.firstElementChild.getAnimations().forEach(v=>v.cancel()),{container:g,layersContainer:b,glitched:x}},d=(x,j,w)=>{const{glitched:T,container:b,layersContainer:g}=f(x,w);g.style.display="grid",w.hideOverflow&&(b.style.overflow="hidden"),w.html&&(T.innerHTML=w.html),T.style.gridArea="1/1/-1/-1";const v=T.cloneNode(!0);v.style.gridArea="1/1/-1/-1",v.style.userSelect="none",v.style.pointerEvents="none",v.style.opacity="0";for(let O=0;O{j.forEach((O,U)=>{g.children[U].animate(O.steps,O.timing)})},z=()=>{j.forEach((O,U)=>{g.children[U].getAnimations().forEach(V=>{V.cancel()})})};switch(b.onmouseenter=null,b.onmouseleave=null,b.onclick=null,w.playMode){case"always":N();break;case"hover":b.onmouseenter=N,b.onmouseleave=z;break;case"click":b.onclick=()=>{z(),N()};break}return x.dataset.glitched="1",{container:b,startGlitch:N,stopGlitch:z}},m=(x=".powerglitch",j={})=>{const w=(0,e.mergeOptions)(t(j.playMode),j);let T=[];typeof x=="string"?T=Array.from(document.querySelectorAll(x)):x instanceof NodeList?T=Array.from(x):Array.isArray(x)?T=x:x instanceof HTMLElement&&(T=[x]);const b=l(w),g=T.map(v=>d(v,b,w));return{containers:g.map(v=>v.container),startGlitch:()=>g.forEach(v=>v.startGlitch()),stopGlitch:()=>g.forEach(v=>v.stopGlitch())}};e.PowerGlitch={glitch:m,generateLayers:l,getDefaultOptions:t}})(U6);function pB(e){const[t,n]=B.useState(e),[r,i]=B.useState(()=>()=>{}),[o,s]=B.useState(()=>()=>{});return{ref:B.useCallback(a=>{if(!a)return;const l=U6.PowerGlitch.glitch(a,t);i(()=>l.startGlitch),s(()=>l.stopGlitch)},[t]),startGlitch:r,stopGlitch:o,setOptions:n}}const B6=e=>B.createElement("svg",{id:"Logo",xmlns:"http://www.w3.org/2000/svg",xmlnsXlink:"http://www.w3.org/1999/xlink",x:"0px",y:"0px",viewBox:"0 0 1346 1410.3",style:{enableBackground:"new 0 0 1346 1410.3"},xmlSpace:"preserve",...e},B.createElement("ellipse",{cx:663,cy:147.9,rx:254.3,ry:147.9}),B.createElement("ellipse",{cx:663,cy:1262.3,rx:254.3,ry:147.9}),B.createElement("ellipse",{transform:"matrix(0.5 -0.866 0.866 0.5 -279.1512 369.5916)",cx:180.5,cy:426.5,rx:254.3,ry:148}),B.createElement("ellipse",{transform:"matrix(0.5 -0.866 0.866 0.5 -279.1552 1483.9517)",cx:1145.6,cy:983.7,rx:254.3,ry:147.9}),B.createElement("ellipse",{transform:"matrix(0.866 -0.5 0.5 0.866 -467.6798 222.044)",cx:180.5,cy:983.7,rx:148,ry:254.3}),B.createElement("ellipse",{transform:"matrix(0.866 -0.5 0.5 0.866 -59.8007 629.9254)",cx:1145.6,cy:426.6,rx:147.9,ry:254.3})),mB=()=>{const e=pB({timing:{duration:5e3},glitchTimeSpan:{start:.5,end:.65},shake:{velocity:2,amplitudeX:.2,amplitudeY:.2}});return u.jsxs("div",{className:"error-page",children:[u.jsx("div",{className:"icon",ref:e.ref,children:u.jsx(B6,{})}),u.jsx("h2",{style:{fontSize:"2.5rem",fontWeight:"bold"},children:"Oops!"}),u.jsx("h4",{children:"Something went wrong! You are not supposed to be here."}),u.jsx("a",{href:"/",children:"Go Back"})]})},gB=({rest:e,name:t,i:n})=>{const{setSideMenu:r}=Fu(),{pathname:i}=co(),o=t!=="Experimental",[s,a]=B.useState(o);return u.jsxs(u.Fragment,{children:[u.jsx("button",{onClick:()=>a(!s),children:u.jsxs("h3",{children:[u.jsx(hn,{icon:s?Gz:Yz,transform:"shrink-5"})," ",t]})}),u.jsx(y6.section,{initial:o?"show":"hidden",animate:s?"show":"hidden",variants:{hidden:{height:0},show:{height:"auto"}},transition:{ease:[.1,1,.1,1]},children:e.paths.map(({heading:l,paths:c},f)=>u.jsxs(B.Fragment,{children:[l?u.jsxs("h4",{children:[u.jsx(hn,{icon:QF,transform:"shrink-6"})," ",l]}):null,c.map((d,m)=>u.jsx(Jo,{className:`link ${l?" group":""} ${i===`/${d}`||i==="/"&&F6(d)?" selected":""}`,to:`${d}`,onClick:()=>r(!1),children:R6(d)},`nav_${n}_heading_${f}_path_${m}`))]},`nav_${n}_heading_${f}`))})]})};var I6="Expected a function",Fy=NaN,vB="[object Symbol]",yB=/^\s+|\s+$/g,xB=/^[-+]0x[0-9a-f]+$/i,wB=/^0b[01]+$/i,bB=/^0o[0-7]+$/i,kB=parseInt,PB=typeof Mt=="object"&&Mt&&Mt.Object===Object&&Mt,jB=typeof self=="object"&&self&&self.Object===Object&&self,EB=PB||jB||Function("return this")(),SB=Object.prototype,TB=SB.toString,MB=Math.max,NB=Math.min,Pd=function(){return EB.Date.now()};function OB(e,t,n){var r,i,o,s,a,l,c=0,f=!1,d=!1,m=!0;if(typeof e!="function")throw new TypeError(I6);t=Uy(t)||0,su(n)&&(f=!!n.leading,d="maxWait"in n,o=d?MB(Uy(n.maxWait)||0,t):o,m="trailing"in n?!!n.trailing:m);function x(O){var U=r,V=i;return r=i=void 0,c=O,s=e.apply(V,U),s}function j(O){return c=O,a=setTimeout(b,t),f?x(O):s}function w(O){var U=O-l,V=O-c,Z=t-U;return d?NB(Z,o-V):Z}function T(O){var U=O-l,V=O-c;return l===void 0||U>=t||U<0||d&&V>=o}function b(){var O=Pd();if(T(O))return g(O);a=setTimeout(b,w(O))}function g(O){return a=void 0,m&&r?x(O):(r=i=void 0,s)}function v(){a!==void 0&&clearTimeout(a),c=0,r=l=i=a=void 0}function N(){return a===void 0?s:g(Pd())}function z(){var O=Pd(),U=T(O);if(r=arguments,i=this,l=O,U){if(a===void 0)return j(l);if(d)return a=setTimeout(b,t),x(l)}return a===void 0&&(a=setTimeout(b,t)),s}return z.cancel=v,z.flush=N,z}function zB(e,t,n){var r=!0,i=!0;if(typeof e!="function")throw new TypeError(I6);return su(n)&&(r="leading"in n?!!n.leading:r,i="trailing"in n?!!n.trailing:i),OB(e,t,{leading:r,maxWait:t,trailing:i})}function su(e){var t=typeof e;return!!e&&(t=="object"||t=="function")}function AB(e){return!!e&&typeof e=="object"}function LB(e){return typeof e=="symbol"||AB(e)&&TB.call(e)==vB}function Uy(e){if(typeof e=="number")return e;if(LB(e))return Fy;if(su(e)){var t=typeof e.valueOf=="function"?e.valueOf():e;e=su(t)?t+"":t}if(typeof e!="string")return e===0?e:+e;e=e.replace(yB,"");var n=wB.test(e);return n||bB.test(e)?kB(e.slice(2),n?2:8):xB.test(e)?Fy:+e}var CB=zB;const RB=Va(CB),FB=(e,t,n=[])=>{B.useEffect(()=>{const r=i=>{e.current&&!e.current.contains(i.target)&&n.find(s=>i.target.classList.contains(s))===void 0&&t()};return document.addEventListener("mousedown",r),()=>{document.removeEventListener("mousedown",r)}},[e])},UB=()=>{const{pathname:e}=co(),{sideMenuOpen:t,setSideMenu:n}=Fu();B.useEffect(()=>(window.addEventListener("resize",i),()=>{window.removeEventListener("resize",i)}),[]);const i=RB(()=>{window.innerWidth>=1150&&n(!1)},200,{trailing:!0,leading:!1}),o=B.useRef(null);return FB(o,()=>n(!1)),u.jsx("div",{className:`menu${t?" open":""}`,ref:o,children:hB.map(({name:s,...a},l)=>u.jsx(B.Fragment,{children:"paths"in a?u.jsx(gB,{name:s,rest:a,i:l}):u.jsx(u.Fragment,{children:u.jsx(Jo,{className:`link lg${e===`/${a.path}`||e==="/"&&F6(a.path)?" selected":""}`,to:`${a.path}`,onClick:()=>n(!1),children:R6(a.path)})})},`nav_${l}`))})},BB=()=>u.jsxs("div",{className:"app-footer",children:[u.jsxs("section",{children:[u.jsx(B6,{className:"icon"}),u.jsx("div",{children:u.jsx("div",{className:"beta",children:"Beta"})}),u.jsx("div",{children:u.jsxs("h4",{children:["© Copyright ",new Date().getUTCFullYear(),"  ",u.jsx("span",{children:"Polkadot UI Authors & Contributors."})]})})," ",u.jsx("div",{children:u.jsxs("h4",{className:"license",children:["Licensed with"," ",u.jsx("a",{href:"https://spdx.org/licenses/MIT.html",target:"_blank",rel:"noreferrer",children:"MIT"})]})})]}),u.jsx("section",{children:u.jsx("h4",{children:u.jsxs("a",{href:"https://github.com/polkadot-ui/library",target:"_blank",rel:"noreferrer",children:[u.jsx(hn,{icon:Jp}),"  GitHub"]})})})]}),IB=e=>B.createElement("svg",{id:"Logo",xmlns:"http://www.w3.org/2000/svg",xmlnsXlink:"http://www.w3.org/1999/xlink",x:"0px",y:"0px",viewBox:"0 0 1326.1 1410.3",style:{enableBackground:"new 0 0 1326.1 1410.3"},xmlSpace:"preserve",...e},B.createElement("style",{type:"text/css"},` + );`;return u.jsxs(u.Fragment,{children:[u.jsx(Bn,{folder:e}),u.jsx(In,{title:"Extension Accounts Provider",subtitle:"Connect to available extensions and subscribe to accounts.",npm:t,status:"stable"}),u.jsxs("p",{children:[u.jsx("a",{href:"https://github.com/polkadot-ui/library/blob/main/packages/ui-react/lib/connect/ExtensionAccountsProvider/index.tsx",target:"_blank",rel:"noreferrer",children:u.jsx("code",{children:"ExtensionAccountsProvider"})})," ","provides a simple means of connecting to web3 extensions that implement the ",u.jsx("code",{children:"window.injectedWeb3"})," interface, and subscribes to their accounts. It automatically re-connects to extensions on subsequent visits, and allows dApps to set an active account if found in an extension."]}),u.jsx(at,{children:u.jsx("p",{children:"This provider prevents the multiple pop-up issue (all available extensions popping up when connecting to extensions) by design. Such behaviour should be treated as an anti-pattern and be avoided."})}),u.jsx(at,{children:u.jsxs("p",{children:["EVM accounts are not currently supported by"," ",u.jsx("code",{children:"ExtensionAccountsProvider"}),"."]})}),u.jsx(Te,{id:"requires",children:"Requires:"}),u.jsx("p",{}),u.jsx("ul",{children:u.jsxs("li",{children:[u.jsx(Jo,{to:"/extensions-provider",children:u.jsx("code",{children:"ExtensionsProvider"})}),": Must wrap ",u.jsx("code",{children:"ExtensionAccountsProvider"})," to provide the available extensions."]})}),u.jsx(Te,{id:"requires",children:"Warning:"}),u.jsx(at,{children:u.jsxs("p",{children:["When ",u.jsx("code",{children:"React.StrictMode"})," is used inside the Application, it should be placed ",u.jsx("b",{children:"after"})," the ",u.jsx("code",{children:"ExtensionsProvider"})," and"," ",u.jsx("code",{children:"ExtensionAccountsProvider"}),", or the providers will not work;"]})}),u.jsx(je,{code:n,standalone:!0}),u.jsx("hr",{}),u.jsx(Te,{id:"providers-setup",children:"Providers Setup"}),u.jsxs("p",{children:["Wrap your app with ",u.jsx("code",{children:"ExtensionAccountsProvider"})," and provide the required props. Note that ",u.jsx("code",{children:"ExtensionsProvider"})," is also required, in order to provide the available extensions to connect to. The required props are referenced further down."]}),u.jsx(iB,{}),u.jsx(Te,{id:"connecting-extensions",children:"Connecting Extensions"}),u.jsxs("p",{children:["With the providers in place, you can call"," ",u.jsx("code",{children:"connectExtensionAccounts"})," to connect to an extension. The following example attempts to find and connect to Subwallet JS upon a button click."]}),u.jsx(oB,{}),u.jsx("p",{children:"It is recommended to carry out validation checks, such as if the extension is already connected and if it exists."}),u.jsx(Te,{id:"getting-accounts",children:"Getting Accounts"}),u.jsxs("p",{children:["Once connected to an extension, the subscribed accounts become available via ",u.jsx("code",{children:"extensionAccounts"}),". The ",u.jsx("code",{children:"address"}),","," ",u.jsx("code",{children:"name"})," of the account, and ",u.jsx("code",{children:"signer"})," are returned for each account."]}),u.jsx(sB,{}),u.jsx("hr",{className:"lg"}),u.jsx(pn,{id:"props",children:"Props"}),u.jsx(Te,{id:"dappName",children:"dappName"}),u.jsx("div",{className:"params inline",children:u.jsx("p",{children:"string"})}),u.jsx("p",{children:"A dApp identifier that is provided to the web3 extension(s) being connected to."}),u.jsx(Te,{id:"network",children:"network"}),u.jsx("div",{className:"params inline",children:u.jsx("p",{children:'"polkadot" | "kusama" | "westend"'})}),u.jsx("p",{children:"The active network, in lower-case."}),u.jsx(Te,{id:"ss58",children:"ss58"}),u.jsx("div",{className:"params inline",children:u.jsx("p",{children:"number"})}),u.jsx("p",{children:"The SS58 prefix of the current network."}),u.jsx("p",{children:u.jsxs("i",{children:["Planned to be derived from ",u.jsx("code",{children:"network"})," in a future release."]})}),u.jsx(Te,{id:"activeAccount",children:"activeAccount"}),u.jsx("div",{className:"params inline",children:u.jsx("p",{children:"string | null"})}),u.jsxs("p",{children:["The current active account on your dApp, if any."," ",u.jsx("code",{children:"ExtensionAccountsProvider"})," will automatically connect to this active account, if found, when subscribing to extension account. See the next prop for more details."]}),u.jsx(Te,{id:"setActiveAccount",children:"setActiveAccount"}),u.jsx("div",{className:"params inline",children:u.jsx("p",{children:"(address: string): void"})}),u.jsx("p",{children:"Provide a setter function to call if the active account is found when subscribing to extension accounts."}),u.jsx("hr",{className:"lg"}),u.jsx(pn,{id:"values",children:"Values"}),u.jsx(Te,{id:"connectExtensionAccounts",children:"connectExtensionAccounts"}),u.jsx("div",{className:"params inline",children:u.jsx("p",{children:"(id: string): Promise"})}),u.jsxs("p",{children:["Call this function to connect to the provided extension ",u.jsx("code",{children:"id"})," ","and subscribe to its accounts."]}),u.jsx(Te,{id:"extensionAccounts",children:"extensionAccounts"}),u.jsx("div",{className:"params inline",children:u.jsx("p",{children:"ExtensionAccount[]"})}),u.jsx("p",{children:"The list of extension accounts that have been subscribed to."}),u.jsx(Te,{id:"extensionAccountsSynced",children:"extensionAccountsSynced"}),u.jsx("div",{className:"params inline",children:u.jsx("p",{children:"boolean"})}),u.jsxs("p",{children:["Signals whether extensions are still being connected to and subscribed to. A value of ",u.jsx("code",{children:"true"})," means that the process is complete."]})]})},lB=()=>u.jsx("div",{className:"doc",children:u.jsx(aB,{npm:"@polkadot-ui/react",folder:"Components/Connect/ExtensionAccountsProvider"})}),cB=[{path:"overview",name:"Overview",element:u.jsx(C6,{}),default:!0},{path:"installation",name:"Installation",element:u.jsx(qU,{})},{path:"using-themes",name:"Using Themes",element:u.jsx($U,{})}],uB=[{path:"base-utilities",name:"Base Utilities",element:u.jsx(FU,{})},{path:"unit_utilities",name:"Unit Utilities",element:u.jsx(DU,{})}],fB=[{path:"extensions",name:"Web3 Extensions",element:u.jsx(hU,{})},{path:"validators",name:"Validator Operators",element:u.jsx(gU,{})}],dB=[{path:"extensions-provider",name:"Extensions",element:u.jsx(rB,{})},{path:"extension-accounts-provider",name:"Extension Accounts",element:u.jsx(lB,{})},{path:"polkicon",name:"Polkicon",element:u.jsx(iU,{})},{path:"odometer",name:"Odometer",element:u.jsx(SU,{})},{path:"overlay",name:"Overlay",element:u.jsx(kU,{})}],qi=[{path:"/frontpage/",name:"Home",element:u.jsx(C6,{})},...cB,...fB,...dB,...uB],hB=[{name:"Getting Started",paths:[{paths:["overview"]},{paths:["installation"]},{paths:["using-themes"]}]},{name:"Data & Assets",paths:[{paths:["extensions"]},{paths:["validators"]}]},{name:"Components",paths:[{heading:"Connect",paths:["extensions-provider","extension-accounts-provider"]},{heading:"UI",paths:["polkicon","odometer","overlay"]}]},{name:"Utilities",paths:[{paths:["base-utilities","unit_utilities"]}]}],R6=e=>{var t;return(t=qi==null?void 0:qi.find(n=>n.path===e))==null?void 0:t.name},F6=e=>!!(qi!=null&&qi.find(t=>t.default===!0&&t.path===e));var U6={};(function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.PowerGlitch=e.mergeOptions=void 0;const t=(x="always")=>({playMode:x,createContainers:!0,hideOverflow:!1,timing:x==="always"?{duration:2*1e3,iterations:1/0}:{duration:250,iterations:1},glitchTimeSpan:x==="always"?{start:.5,end:.7}:{start:0,end:1},shake:{velocity:15,amplitudeX:.2,amplitudeY:.2},slice:x==="click"?{count:15,velocity:20,minHeight:.02,maxHeight:.15,hueRotate:!0}:{count:6,velocity:15,minHeight:.02,maxHeight:.15,hueRotate:!0},pulse:!1}),n=(x,j)=>{if(!x.glitchTimeSpan)return 1;const w=x.glitchTimeSpan.start,T=x.glitchTimeSpan.end;if(jT)return 0;const b=w+(T-w)/2;return j(Math.random()-.5)*2*n(x,j),i=({minHeight:x,maxHeight:j,minWidth:w,maxWidth:T})=>{const b=Math.floor(Math.random()*((j-x)*100+1))+x*100,g=Math.floor(Math.random()*((T-w)*100+1))+w*100,v=Math.floor(Math.random()*(100-b)),N=Math.floor(Math.random()*(100-g)),z=`${N+g}% ${v}%`,O=`${N+g}% ${v+b}%`,U=`${N}% ${v+b}%`,V=`${N}% ${v}%`;return`polygon(${z},${O},${U},${V})`},o=x=>{const j=Math.floor(x.slice.velocity*x.timing.duration/1e3)+1,w=[];for(let T=0;Tx.pulse?{steps:[{transform:"scale(1)",opacity:"1"},{transform:`scale(${x.pulse.scale})`,opacity:"0"}],timing:Object.assign(Object.assign({},x.timing),{delay:(x.glitchTimeSpan?x.glitchTimeSpan.start:0)*x.timing.duration,easing:"ease-in-out"})}:null,a=x=>{if(!x.shake)return{steps:[],timing:{}};const j=Math.floor(x.shake.velocity*x.timing.duration/1e3)+1,w=[];for(let T=0;T[a(x),s(x),...Array.from({length:x.slice.count}).map(()=>o(x))].filter(j=>j!==null),c=(...x)=>{const j=w=>w&&typeof w=="object";return x.reduce((w,T)=>(Object.keys(T).forEach(b=>{j(w[b])&&j(T[b])?w[b]=(0,e.mergeOptions)(w[b],T[b]):T[b]!==void 0&&(w[b]=T[b])}),w),{})};e.mergeOptions=c;const f=(x,j)=>{var w,T;if(!j.createContainers)return{container:x,layersContainer:x,glitched:x.firstElementChild};if(!x.dataset.glitched){const v=document.createElement("div"),N=document.createElement("div");return getComputedStyle(x).getPropertyValue("display").match(/^inline/)&&(N.style.display="inline-block"),N.appendChild(v),(w=x.parentElement)===null||w===void 0||w.insertBefore(N,x),v.prepend(x),{container:N,layersContainer:v,glitched:x}}const b=x.parentElement,g=(T=x.parentElement)===null||T===void 0?void 0:T.parentElement;for(;b.children.length>1;)b.removeChild(b.children[1]);return b.firstElementChild.getAnimations().forEach(v=>v.cancel()),{container:g,layersContainer:b,glitched:x}},d=(x,j,w)=>{const{glitched:T,container:b,layersContainer:g}=f(x,w);g.style.display="grid",w.hideOverflow&&(b.style.overflow="hidden"),w.html&&(T.innerHTML=w.html),T.style.gridArea="1/1/-1/-1";const v=T.cloneNode(!0);v.style.gridArea="1/1/-1/-1",v.style.userSelect="none",v.style.pointerEvents="none",v.style.opacity="0";for(let O=0;O{j.forEach((O,U)=>{g.children[U].animate(O.steps,O.timing)})},z=()=>{j.forEach((O,U)=>{g.children[U].getAnimations().forEach(V=>{V.cancel()})})};switch(b.onmouseenter=null,b.onmouseleave=null,b.onclick=null,w.playMode){case"always":N();break;case"hover":b.onmouseenter=N,b.onmouseleave=z;break;case"click":b.onclick=()=>{z(),N()};break}return x.dataset.glitched="1",{container:b,startGlitch:N,stopGlitch:z}},m=(x=".powerglitch",j={})=>{const w=(0,e.mergeOptions)(t(j.playMode),j);let T=[];typeof x=="string"?T=Array.from(document.querySelectorAll(x)):x instanceof NodeList?T=Array.from(x):Array.isArray(x)?T=x:x instanceof HTMLElement&&(T=[x]);const b=l(w),g=T.map(v=>d(v,b,w));return{containers:g.map(v=>v.container),startGlitch:()=>g.forEach(v=>v.startGlitch()),stopGlitch:()=>g.forEach(v=>v.stopGlitch())}};e.PowerGlitch={glitch:m,generateLayers:l,getDefaultOptions:t}})(U6);function pB(e){const[t,n]=B.useState(e),[r,i]=B.useState(()=>()=>{}),[o,s]=B.useState(()=>()=>{});return{ref:B.useCallback(a=>{if(!a)return;const l=U6.PowerGlitch.glitch(a,t);i(()=>l.startGlitch),s(()=>l.stopGlitch)},[t]),startGlitch:r,stopGlitch:o,setOptions:n}}const B6=e=>B.createElement("svg",{id:"Logo",xmlns:"http://www.w3.org/2000/svg",xmlnsXlink:"http://www.w3.org/1999/xlink",x:"0px",y:"0px",viewBox:"0 0 1346 1410.3",style:{enableBackground:"new 0 0 1346 1410.3"},xmlSpace:"preserve",...e},B.createElement("ellipse",{cx:663,cy:147.9,rx:254.3,ry:147.9}),B.createElement("ellipse",{cx:663,cy:1262.3,rx:254.3,ry:147.9}),B.createElement("ellipse",{transform:"matrix(0.5 -0.866 0.866 0.5 -279.1512 369.5916)",cx:180.5,cy:426.5,rx:254.3,ry:148}),B.createElement("ellipse",{transform:"matrix(0.5 -0.866 0.866 0.5 -279.1552 1483.9517)",cx:1145.6,cy:983.7,rx:254.3,ry:147.9}),B.createElement("ellipse",{transform:"matrix(0.866 -0.5 0.5 0.866 -467.6798 222.044)",cx:180.5,cy:983.7,rx:148,ry:254.3}),B.createElement("ellipse",{transform:"matrix(0.866 -0.5 0.5 0.866 -59.8007 629.9254)",cx:1145.6,cy:426.6,rx:147.9,ry:254.3})),mB=()=>{const e=pB({timing:{duration:5e3},glitchTimeSpan:{start:.5,end:.65},shake:{velocity:2,amplitudeX:.2,amplitudeY:.2}});return u.jsxs("div",{className:"error-page",children:[u.jsx("div",{className:"icon",ref:e.ref,children:u.jsx(B6,{})}),u.jsx("h2",{style:{fontSize:"2.5rem",fontWeight:"bold"},children:"Oops!"}),u.jsx("h4",{children:"Something went wrong! You are not supposed to be here."}),u.jsx("a",{href:"/",children:"Go Back"})]})},gB=({rest:e,name:t,i:n})=>{const{setSideMenu:r}=Fu(),{pathname:i}=co(),o=t!=="Experimental",[s,a]=B.useState(o);return u.jsxs(u.Fragment,{children:[u.jsx("button",{onClick:()=>a(!s),children:u.jsxs("h3",{children:[u.jsx(hn,{icon:s?Gz:Yz,transform:"shrink-5"})," ",t]})}),u.jsx(y6.section,{initial:o?"show":"hidden",animate:s?"show":"hidden",variants:{hidden:{height:0},show:{height:"auto"}},transition:{ease:[.1,1,.1,1]},children:e.paths.map(({heading:l,paths:c},f)=>u.jsxs(B.Fragment,{children:[l?u.jsxs("h4",{children:[u.jsx(hn,{icon:QF,transform:"shrink-6"})," ",l]}):null,c.map((d,m)=>u.jsx(Jo,{className:`link ${l?" group":""} ${i===`/${d}`||i==="/"&&F6(d)?" selected":""}`,to:`${d}`,onClick:()=>r(!1),children:R6(d)},`nav_${n}_heading_${f}_path_${m}`))]},`nav_${n}_heading_${f}`))})]})};var I6="Expected a function",Fy=NaN,vB="[object Symbol]",yB=/^\s+|\s+$/g,xB=/^[-+]0x[0-9a-f]+$/i,wB=/^0b[01]+$/i,bB=/^0o[0-7]+$/i,kB=parseInt,PB=typeof Mt=="object"&&Mt&&Mt.Object===Object&&Mt,jB=typeof self=="object"&&self&&self.Object===Object&&self,EB=PB||jB||Function("return this")(),SB=Object.prototype,TB=SB.toString,MB=Math.max,NB=Math.min,Pd=function(){return EB.Date.now()};function OB(e,t,n){var r,i,o,s,a,l,c=0,f=!1,d=!1,m=!0;if(typeof e!="function")throw new TypeError(I6);t=Uy(t)||0,su(n)&&(f=!!n.leading,d="maxWait"in n,o=d?MB(Uy(n.maxWait)||0,t):o,m="trailing"in n?!!n.trailing:m);function x(O){var U=r,V=i;return r=i=void 0,c=O,s=e.apply(V,U),s}function j(O){return c=O,a=setTimeout(b,t),f?x(O):s}function w(O){var U=O-l,V=O-c,Z=t-U;return d?NB(Z,o-V):Z}function T(O){var U=O-l,V=O-c;return l===void 0||U>=t||U<0||d&&V>=o}function b(){var O=Pd();if(T(O))return g(O);a=setTimeout(b,w(O))}function g(O){return a=void 0,m&&r?x(O):(r=i=void 0,s)}function v(){a!==void 0&&clearTimeout(a),c=0,r=l=i=a=void 0}function N(){return a===void 0?s:g(Pd())}function z(){var O=Pd(),U=T(O);if(r=arguments,i=this,l=O,U){if(a===void 0)return j(l);if(d)return a=setTimeout(b,t),x(l)}return a===void 0&&(a=setTimeout(b,t)),s}return z.cancel=v,z.flush=N,z}function zB(e,t,n){var r=!0,i=!0;if(typeof e!="function")throw new TypeError(I6);return su(n)&&(r="leading"in n?!!n.leading:r,i="trailing"in n?!!n.trailing:i),OB(e,t,{leading:r,maxWait:t,trailing:i})}function su(e){var t=typeof e;return!!e&&(t=="object"||t=="function")}function AB(e){return!!e&&typeof e=="object"}function LB(e){return typeof e=="symbol"||AB(e)&&TB.call(e)==vB}function Uy(e){if(typeof e=="number")return e;if(LB(e))return Fy;if(su(e)){var t=typeof e.valueOf=="function"?e.valueOf():e;e=su(t)?t+"":t}if(typeof e!="string")return e===0?e:+e;e=e.replace(yB,"");var n=wB.test(e);return n||bB.test(e)?kB(e.slice(2),n?2:8):xB.test(e)?Fy:+e}var CB=zB;const RB=Va(CB),FB=(e,t,n=[])=>{B.useEffect(()=>{const r=i=>{e.current&&!e.current.contains(i.target)&&n.find(s=>i.target.classList.contains(s))===void 0&&t()};return document.addEventListener("mousedown",r),()=>{document.removeEventListener("mousedown",r)}},[e])},UB=()=>{const{pathname:e}=co(),{sideMenuOpen:t,setSideMenu:n}=Fu();B.useEffect(()=>(window.addEventListener("resize",i),()=>{window.removeEventListener("resize",i)}),[]);const i=RB(()=>{window.innerWidth>=1150&&n(!1)},200,{trailing:!0,leading:!1}),o=B.useRef(null);return FB(o,()=>n(!1)),u.jsx("div",{className:`menu${t?" open":""}`,ref:o,children:hB.map(({name:s,...a},l)=>u.jsx(B.Fragment,{children:"paths"in a?u.jsx(gB,{name:s,rest:a,i:l}):u.jsx(u.Fragment,{children:u.jsx(Jo,{className:`link lg${e===`/${a.path}`||e==="/"&&F6(a.path)?" selected":""}`,to:`${a.path}`,onClick:()=>n(!1),children:R6(a.path)})})},`nav_${l}`))})},BB=()=>u.jsxs("div",{className:"app-footer",children:[u.jsxs("section",{children:[u.jsx(B6,{className:"icon"}),u.jsx("div",{children:u.jsx("div",{className:"beta",children:"Beta"})}),u.jsx("div",{children:u.jsxs("h4",{children:["© Copyright ",new Date().getUTCFullYear(),"  ",u.jsx("span",{children:"Polkadot UI Authors & Contributors."})]})})," ",u.jsx("div",{children:u.jsxs("h4",{className:"license",children:["Licensed with"," ",u.jsx("a",{href:"https://spdx.org/licenses/MIT.html",target:"_blank",rel:"noreferrer",children:"MIT"})]})})]}),u.jsx("section",{children:u.jsx("h4",{children:u.jsxs("a",{href:"https://github.com/polkadot-ui/library",target:"_blank",rel:"noreferrer",children:[u.jsx(hn,{icon:Jp}),"  GitHub"]})})})]}),IB=e=>B.createElement("svg",{id:"Logo",xmlns:"http://www.w3.org/2000/svg",xmlnsXlink:"http://www.w3.org/1999/xlink",x:"0px",y:"0px",viewBox:"0 0 1326.1 1410.3",style:{enableBackground:"new 0 0 1326.1 1410.3"},xmlSpace:"preserve",...e},B.createElement("style",{type:"text/css"},` .st0{fill:#E6007A;} `),B.createElement("ellipse",{className:"st0",cx:663,cy:147.9,rx:254.3,ry:147.9}),B.createElement("ellipse",{className:"st0",cx:663,cy:1262.3,rx:254.3,ry:147.9}),B.createElement("ellipse",{transform:"matrix(0.5 -0.866 0.866 0.5 -279.1512 369.5916)",className:"st0",cx:180.5,cy:426.5,rx:254.3,ry:148}),B.createElement("ellipse",{transform:"matrix(0.5 -0.866 0.866 0.5 -279.1552 1483.9517)",className:"st0",cx:1145.6,cy:983.7,rx:254.3,ry:147.9}),B.createElement("ellipse",{transform:"matrix(0.866 -0.5 0.5 0.866 -467.6798 222.044)",className:"st0",cx:180.5,cy:983.7,rx:148,ry:254.3}),B.createElement("ellipse",{transform:"matrix(0.866 -0.5 0.5 0.866 -59.8007 629.9254)",className:"st0",cx:1145.6,cy:426.6,rx:147.9,ry:254.3})),VB=()=>u.jsxs("div",{className:"app-header",children:[u.jsxs("section",{children:[u.jsx("div",{className:"icon",children:u.jsx(IB,{})}),u.jsx("div",{className:"title",children:u.jsx("h3",{children:"Polkadot UI Docs"})})]}),u.jsx("section",{children:u.jsx("a",{href:"https://github.com/polkadot-ui/library",target:"_blank",rel:"noreferrer",children:u.jsx(hn,{icon:Jp,transform:"grow-12",style:{marginLeft:"0.25rem"}})})})]}),DB=({children:e,style:t})=>u.jsx("div",{className:"core-body",style:t,children:e}),HB=({children:e,style:t,open:n,minimised:r,width:i="20rem"})=>{const o={"--core-side-width":i};return u.jsx("div",{style:{...o,...t},className:`core-side${za.appendOrEmpty(!n,"hidden")}${za.appendOrEmpty(r,"minimised")}`,children:e})},V6=B.forwardRef(({children:e,style:t},n)=>u.jsx("div",{className:"core-main",ref:n,style:t,children:e}));V6.displayName="Main";const XB=()=>{const{sideMenuOpen:e}=Fu(),{pathname:t,hash:n}=co();return B.useEffect(()=>{let r=!1;try{if(n){const i=document==null?void 0:document.querySelector(n);i&&(r=!0,i==null||i.scrollIntoView({behavior:"smooth"}))}}catch{r=!1}r||window.scrollTo(0,0)},[t,n]),u.jsxs(u.Fragment,{children:[u.jsxs(DB,{children:[u.jsx(VB,{}),u.jsx(ZB,{}),u.jsx(HB,{open:e,minimised:!1,style:{minHeight:"calc(100vh - 5.5rem)"},width:"20rem",children:u.jsx(UB,{})}),u.jsx(V6,{style:{minHeight:"calc(100vh - 5.5rem)"},children:u.jsx("div",{className:"main-area",children:u.jsx("div",{children:u.jsxs(o7,{children:[qi.map(r=>u.jsx(vh,{...r},`nav_page_${r.path}`)),u.jsx(vh,{path:"*",element:u.jsx(mB,{})},"nav_page_other")]})})})})]}),u.jsx(BB,{})]})},ZB=()=>{const{setSideMenu:e,sideMenuOpen:t}=Fu();return t?u.jsx(u.Fragment,{}):u.jsxs("button",{className:"toggle-menu",type:"button",onClick:()=>e(!t),children:[u.jsx(hn,{icon:Hz})," "]})},WB=()=>u.jsx("div",{className:"main theme-ui ui-theme-light",children:u.jsx(XB,{})}),GB=(...e)=>t=>n=>e.reduceRight((r,i)=>{let o=i;return Array.isArray(i)?(o=i[0],u.jsx(o,{...i[1],children:r})):u.jsx(o,{children:r})},u.jsx(t,{...n})),YB=GB(DN,XN)(WB),qB=()=>u.jsx(d7,{basename:"/",children:u.jsx(YB,{})});Q3(document.getElementById("root")).render(u.jsx(qB,{})); diff --git a/index.html b/index.html index ee1cd18..5fc31c0 100644 --- a/index.html +++ b/index.html @@ -69,7 +69,7 @@ href="/frontpage/favicons/site.webmanifest" crossorigin="use-credentials" /> - +