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

@web-atoms/data-styles

v1.0.123

Published

Easy to use Data Styles

Downloads

528

Readme

Web Atoms Data Styles

Data styles utilizes data attributes to specify some easy styles. data-styles.d.ts provides intellisense to add corresponding data attributes in JSX.

Installation

  1. You can directly reference data-styles.css.
  2. Or you can import SystemJS module data-styles.js.

Usage

Multiple attributes on single node.

    <div
        data-font-weight="bold"
        data-color="red"/>

Change attribute based on condition

    <div
        data-font-weight={ isSomethingTrue ? "bold" : "normal" }
        data-color={ isValid ? "default" : "red" }
        />

Why?

  1. Data Styles are composable, you can combine multiple attributes on single node.

Why not style attribute?

  1. Style attribute is heavy, there is additional CSSStyleDeclaration created and associated with each element along with actual style that to be displayed.
  2. Style attribute requires parsing every time the style has been set, where else when set in data attribute, all styles are already parsed and they are associated with element quickly.
  3. Style attribute is not customizable, for example, we have a styled call data-layout="accent-button". When you are creating reusable components, you can specify initial styles using data attributes. And end user can customize styles based on desired design needs. Inline style does not allow other customizations such as media queries, pseudo elements, hover, active etc.

Layouts

We have created some basic layouts that are reusable and customizable.

  1. row - a single flex row with gap and padding of 5px (customizable through variables).
  2. flex-wrap - flex wrap with gap and padding of 5px.
  3. command-row - same as row but with some additional background and styling for container buttons.
  4. button - button with flex to contain and position icons correctly, there are various buttons such as accent-button, go-button (green), reject-button (dark red), stop-button (red), accept-button (blue).
  5. link - a simple link with text decoration set to none and on hover text decoration is set to underline. Colors are customizable.
  6. warning - a warning flex box with default border, radius and warning background color.