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

@gabio/design-svelte

v1.4.0

Published

A killer Svelte design library

Downloads

1

Readme

Build NPM publish npm version

@gabio/design-svelte

☠️ A killer Svelte design library!

Installation

yarn add @gabio/design-svelte

Prerequisites

For a working App setup, you can inspire yourself from mine : https://github.com/vigenere23/gabio-web-svelte

Documentation

Will be completed soon

Preparation

In order to use all the features this package offers, you'll need to do some more steps.

Icons

The GioIcon component uses the font-awesome icon library. You can decide to use either the free or premium version, or you can even create an adapter to provide your own icons. It will always look for icons that have been registered in the IconRegistry static class.

Using the IconRegistry

In order to make icons available by their name, you need to first register them with the IconRegistry.registerIcons(). This should be done at the app's startup, most probably in your main, index or entry file.

This method accepts a dictionnary of name: IconDefinition with the later provided by the font-awesome libreary itself. Its interface looks like this :

export interface IconDefinition extends IconLookup {
  icon: [
    number, // width
    number, // height
    string[], // ligatures
    string, // unicode
    IconPathData // svgPathData
  ];
}

Usage example

// main.ts

import App from './App.svelte'

import { FaIconRegistry } from '@gabio/design-svelte/src/lib/faicon-registry'
import { faHome, faCode } from '@fortawesome/free-solid-svg-icons'
import { faGithub, faBehance } from '@fortawesome/free-brands-svg-icons'

FaIconRegistry.registerIcons({
  faHome,
  faCode,
  faGithub,
  faBehance
})

const app = new App({
  target: document.getElementById('app')
})

export default app

Optimizing the use of font-awesome icons

With the above example, your bundler will likely bundle the entire stack of icons provided by the two libraries. To optimize your bundle size, you should import each icon individually.

import { FaIconRegistry } from '@gabio/design-svelte/src/lib/faicon-registry'
import { faHome } from '@fortawesome/free-solid-svg-icons/faHome'
import { faCode } from '@fortawesome/free-solid-svg-icons/faCode'
import { faGithub } from '@fortawesome/free-brands-svg-icons/faGithub'
import { faBehance } from '@fortawesome/free-brands-svg-icons/faBehance'

FaIconRegistry.registerIcons({
  faHome,
  faCode,
  faGithub,
  faBehance
})

Code blocks

The GioCodeBlock component uses prismjs under the hood to tokenize code texts into stylable html. For optimization reasons, it does not use the npm package, but rather a minified custom build that supports the most popular languages. These include :

  • C, C#, C++
  • Java
  • Python
  • Ruby
  • Javascript, Typescript
  • Bash, Shell
  • Markdown
  • HTML, CSS
  • ...and more

If you would like to see more languages added, please create an issue. Future plans are to provide an interface to supply your own build of prism.

Styling code blocks

This library offers an adapted version of the popular (and beautiful) One Dark theme by Atom. The style source (in SCSS) is offered here.

To apply a style, simply import it in your App.svelte component as global rules.

<style lang="scss" global>
  @import '@gabio/design-svelte/src/styles/reset';
  @import '@gabio/design-svelte/src/styles/code-themes/one-dark-prism';
</style>

Markdown transpiler

The library provides a GioSvelteMarkdownParser for parsing markdown content to this library's components. It also works marvelously with the @gabio/markdown-parser. Give it a try!

Enjoy!

This project was made by Gabriel St-Pierre (@vigenere23) as an open source design library. I hope it can inspire you or make you better understand the Svelte ecosystem!