npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

@bewinxed/wallet-adapter-svelte-ui

v0.2.1

Published

This is a direct port of [anza-xyz/wallet-adapter](https://github.com/anza-xyz/wallet-adapter) to Svelte 5 (Will not support older versions).

Readme

@bewinxed/wallet-adapter-svelte-ui

This is a direct port of anza-xyz/wallet-adapter to Svelte 5 (Will not support older versions).

With (IMO) better UI, Accessibility, and Performance.

Requirements

Note: Svelte 5 & TailwindCSS are required!

Installation

Make sure you install the Wallet Adapter first.

npm install @bewinxed/wallet-adapter-svelte-ui
pnpm add @bewinxed/wallet-adapter-svelte-ui
bun add @bewinxed/wallet-adapter-svelte-ui

Setup

Add the connection/wallet/modal providers into your main layout.

<script lang="ts">
	import { ConnectionProvider, WalletProvider } from '@bewinxed/wallet-adapter-svelte';
    import { WalletModalProvider, WalletMultiButton } from '@bewinxed/wallet-adapter-svelte-ui';
	import { Connection, PublicKey } from '@solana/web3.js';
	import { onMount } from 'svelte';
</script>

<ConnectionProvider config={{endpoint: 'https://api.mainnet-beta.solana.com'}}>
	<WalletProvider wallets={[]}>
		<WalletModalProvider>
			<WalletMultiButton />
		</WalletModalProvider>
	</WalletProvider>
</ConnectionProvider>

Context

The connection and wallet data are available in one rune, useSolana().

<script lang="ts">
	import { useSolana } from '@bewinxed/wallet-adapter-svelte';

    const solana = useSolana();
    const {connection, context} = $derived(solana);
</script>

{#if context.wallet}
	{context.wallet.publicKey}
{/if}

Events

Multiple helpful event types have been exposed on the WalletProvider and WalletModalProvider, as well as the WalletMultiButton.

WalletProvider

  • onconnect
  • ondisconnect
  • onerror

WalletModalProvider

  • onopen
  • onclose

WalletMultiButton

  • onconnect
  • ondisconnect
  • onselectwallet
  • ...all HTML button props/handlers.

Changes/Fixes vs Wallet Adapter & Svelte-On-Solana

  • Wallets are auto detected now, no need to add them separately.
  • Updates in line with the React version (With much cleanup because react).
  • No svelte stores needed, all done with runes now.
  • Better UI (Styled with tailwind, CSS later if asked.)
  • Accessibility (Keyboard navigation, focus management, etc.)

Customization

  • You can pass classes/styles to the buttons now, making it easier to customize the button for your app vs fiddling with global CSS styles.
<WalletMultiButton class="bg-red-500 text-white rounded-full p-2" />

Note: The buttons have helpful attributes for styling, such as square and flat. | Attribute | Description | | --- | --- | | square | Removes border radius. | flat | Removes shadows. | headless | Removes all styling from the button, then you can pass your own styles.

CSS Variables (Will work next version)

You can use the following CSS variables to customize the WalletAdapter Svelte UI. | Variable | Description | | --- | --- | | --solana-primary | Primary color for the WalletAdapter Svelte UI. | --solana-primary-light | Lighter primary color for the WalletAdapter Svelte UI. | --solana-secondary | Secondary color for the WalletAdapter Svelte UI. | --solana-secondary-light | Lighter secondary color for the WalletAdapter Svelte UI. | --solana-accent | Accent color for the WalletAdapter Svelte UI. | --solana-accent-light | Lighter accent color for the WalletAdapter Svelte UI. | --solana-backdrop | Backdrop color for the WalletAdapter Svelte UI.

Comparison

Better Modal UI, Native modal on mobile.

Old: before

New: after

Next up.

  • Add helpful utilities to generate messages/transactions/send transactions.
  • UI polishes.
  • Make sure Anchor works.
  • Migrate to @solana/web3.js 2.* experimental.