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 🙏

© 2025 – Pkg Stats / Ryan Hefner

unocss-preset-strict-design

v2.0.0

Published

**A strict design system preset for [UnoCSS](https://github.com/unocss/unocss).**

Downloads

12

Readme

UnoCSS Strict Design Preset

A strict design system preset for UnoCSS.

github license npm version

Features

  • 🎨 Enforces usage of theme values for colors, spacing, font sizes, and more
  • 🚫 Blocks arbitrary values (e.g., text-[20px], m-[10px])
  • ✨ Ensures consistent class naming conventions
  • 🎯 Perfect for maintaining design system consistency

Design Philosophy

This preset is built on the principle that consistent design systems lead to better user experiences and more maintainable codebases. Key principles include:

  1. Intentional Constraints: By limiting to predefined theme values, we ensure design consistency across your entire application.

  2. No Magic Numbers: Arbitrary values often lead to design inconsistencies. All values should come from your theme configuration.

  3. Predictable Patterns: Class names follow consistent patterns, making your code more readable and maintainable.

  4. Design System First: Forces teams to think in terms of design systems rather than one-off solutions.

Installation

# Using npm
npm install -D unocss-preset-strict-design

# Using yarn
yarn add -D unocss-preset-strict-design

# Using pnpm
pnpm add -D unocss-preset-strict-design

Usage

Add the preset to your UnoCSS configuration:

// uno.config.ts
import { defineConfig } from 'unocss'
import { presetStrictDesign } from 'unocss-preset-strict-design'

export default defineConfig({
  presets: [
    presetStrictDesign({
      theme: {
        colors: {
          // Your color palette
          primary: '#0066cc',
          // ...
        },
        spacing: {
          // Your spacing scale
          '1': '0.25rem',
          // ...
        },
        fontSize: {
          // Your font sizes
          sm: '0.875rem',
          // ...
        },
        fontWeight: {
          // Your font weights
          normal: '400',
          // ...
        },
        opacity: {
          // Your opacity values
          '50': '0.5',
          // ...
        },
      },
    }),
  ],
})

Theme Value Inheritance

For convenience, if not explicitly defined, the following theme properties will automatically inherit values from theme.spacing:

  • width
  • height
  • maxWidth
  • maxHeight
  • minWidth
  • minHeight

This means you can use your spacing scale values for these properties without additional configuration.

Restrictions

This preset enforces several restrictions to maintain design consistency:

  1. Theme Values Only: All properties must use predefined theme values

    • text-[20px], m-[10px], bg-[#fff]
    • text-sm, m-4, bg-primary
  2. Consistent Class Names: Enforces consistent naming conventions

    • color-red, fw-bold
    • text-red, font-bold
  3. Required Theme Properties: The theme configuration must include:

    • colors
    • spacing
    • fontSize
    • fontWeight
    • opacity

Available Utility Classes

This preset provides the following utility classes:

Mask Size

  • mask-size-{size}: Sets the mask size using your theme's spacing values
    • Example: mask-size-4 will use the spacing value defined at theme.spacing['4']
    • Only uses predefined spacing values from your theme

Opacity

  • opacity-{value}: Sets the opacity using your theme's opacity values
    • Example: opacity-50 will use the opacity value defined at theme.opacity['50']
    • Only uses predefined opacity values from your theme
    • This overrides the opacity rule in the wind preset that allows for arbitrary opacity values