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

@kesval/design

v4.1.2

Published

A opiniated design system used all across KesvaL's projects.

Downloads

11

Readme

@kesval/design

Motivation

Why'd I make this ? I need something to style my projects, and that's consistent across all of them. Now, there's cool libraries out there that could help me do that but I never really liked them. This library aims to be very accessible by using semantics a lot, and also wants to be easy to use, without ever over styling something so it can be modified in the final project.

You should never need to use more than one class on an element, and if you do, it's for very specific things, such as an outline primary button, which would be <button class="primary outline">. Otherwise, everything should be as clear as day in your classes.

Semantics ?

Yes. For example, if you want to create a card, you wouldn't do something like this :

<div class="card">
  <div class="card-header">
    header content
  </div>
  <div class="card-content">
    card content
  </div>
  <div class="card-footer">
    card footer
  </div>
</div>

This is not semantic, nor accessible, and it's not always easy to remember what class to use. With my package, you would instead do this :

<div class="card">
  <header>
    header content
  </header>
  <section>
    card content
  </section>
  <footer>
    something footer
  </footer>
</div> 

As you can see, it requires only one class and the rest is pure HTML. This also forces you to use the correct HTML tags, which is good for accessibility.

Classes

Classes are still available to use if you want to style something specific. For example, you most likely would sometimes want a button that is a link, and I won't link the button component to the a tag. So how do you do it ? Well, for every component, its name is also a class. So if you want a button that is a link, you would do this :

<a class="button" href="#">Link button</button>

Usage

To use this library, install it via npm:

npm install @kesval/design

Then import it in your project:

import '@kesval/design';

This will import everything that is standard css, so this is only for static things, such as the base (general, reset, etc.). But, you will probably need to use the utilities (media-query for example), and you can import them like this with Vite (recommended) :

import { sveltekit } from '@sveltejs/kit/vite';
import { defineConfig } from 'vite';
import { resolve } from 'path';

export default defineConfig({
 plugins: [sveltekit()],
 css: {
  preprocessorOptions: {
   scss: {
    additionalData: '@use "node_modules/@kesval/design/scss/utilities" as u;'
   }
  }
 }
});

Now you can use the utilies everywhere prefixed with u., for example, @include u.mq(md) { ...code }.

Why is X not included ?

I want to keep the package lightweight and only include things that I use in every project. Everything else that I need that, for example, requires JavaScript (such as a dropdown), I will have in my SvelteKit Starter. You might want to check it out, everything is already set up for you. Even internationalization.

Fonts

Font names are defined in utilities/typography.scss, but they are not imported. I leave it up to you to import the fonts you need in your project and define the font-faces with the correct font-family name. This is so you choose where you want to import your fonts from (Google Fonts, Self hosted, etc.).

Default fonts are Benzin for titles or important things and default ui font for everything else. In this package, I only use 700 for Benzin and 400, 500 and 700 for the default ui font.

Animations

A lot of components have animations that are turned on by default. If for some reason you want to turn them off, just add the clas no-anim to the component. I recommend you keep them on since they're not intrusive and they make the website feel more alive.

Ressources