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

@peculiarjs/cssfull

v0.1.2

Published

Minimalistic css library focused on positioning and sizing classes

Downloads

4

Readme

@peculiarjs/cssfull

version MIT last-commit

Minimalistic css library of utilitarian classes, focused on positioning, sizing and extra goodies around it. Easy to set up and start prototyping blazingly fast ⚡

Table of Contents

1. What cssfull is:

  • just css — simple bits of good old css
  • modular — use specific module or the whole bundle
  • minimalistic — up to 10 sm/md size css files
  • easy to setup — because it's plain css, it is easy to add to any project without hustle
  • focused — main goal is to provide helpers around positioning and sizing and not being a swiss knife for everything
  • lib, not a framework — created to be used as addition to your current styling approach, not a replacement

2. Installation

As npm package:

# npm
npm install @peculiarjs/cssfull

# pnpm
pnpm add @peculiarjs/cssfull

After that you can import index.css or any specific file from the lib into your app.js and your bundler should do the rest:

// app.js
import { render } from 'preact'
import '@peculiarjs/cssfull/lib/index.css'

const App = () => (
  <div className="m-40 debug">
    The Spot!
  </div>
)

render(<App />, document.getElementById('app'))

Another way is to avoid npm package and simply inject it as stylesheet directly into html:

<!DOCTYPE html>
<html lang="en">
  <link rel="stylesheet" href="https://unpkg.com/@peculiarjs/[email protected]/lib/border.css">
  <link rel="stylesheet" href="https://unpkg.com/@peculiarjs/[email protected]/lib/cursor.css">
  <!-- or whole bundle.css can be linked — concatenated and minified version of the whole library -->
  <!-- <link rel="stylesheet" href="https://unpkg.com/@peculiarjs/[email protected]/lib/bundle.css">  -->
  <body>
    <div class="debug pointer">
      Content 
    </div>
  </body>
</html>

3. Classes naming approach

Measurement units

Majority of classes in this lib approach 2 main measurement units:

  • %
  • px

For simplicity % is made the default and used everywhere except margin, so class w-100 should be read like width: 100% and top-50 like top: 50%. On the opposite, absolute values like px are used only for margin or padding, so in that case mr-20 means margin-right: 20px and m-10 means margin: 10px.

Shortenings

It is expected that some utilities will be used much more often: width, height, margin, padding, so for a better and easier readability in HTML/JSX, these utils names are shortened and used as mnemonics:

/* "w" stands for width */
.w-100 {
  width: 100%;
}

/* "h" stands for height */
.h-100 {
  height: 100%;
}

/* "mt" stands for margin-top */
.mt-20 {
  margin-top: 20px;
}

/* "pr" stands for padding-right */
.pr-20 {
  padding-right: 20px;
}

4. Utils overview

Brief overview of the classes.

flex.css

Everything around flexbox properties with simple naming.

.flex {
  display: flex
}
.column {
  flex-direction: column;
}
.row {
  flex-direction: row;
}
...

position.css

Main positioning helpers are created around: relative, absolute, fixed, static and sticky options. Also there are helpers for every side top, right, bottom, left with 3 values [0, 50%, 100%] each.

.relative {
  position: relative;
}
.absolute {
  position: absolute;
}
...

.top-0 {
  top: 0;
}
.top-50 {
  top: 50%;
}
.top-100 {
  top: 100%;
}

width.css

Set of classes for approaching elements width in %.

/* from 100 to 0 with a step of 5 */
.w-100 {
  width: 100%;
}
.w-95 {
  width: 95%;
}
...

.w-auto {
  width: auto;
}

height.css

Same but for height.

/* from 100 to 0 with a step of 5 */
.h-100 {
  height: 100%;
}
.h-95 {
  height: 95%;
}
...

.h-auto {
  height: auto;
}

display.css

A block/inline-block pair.

.block {
  display: block;
}
.inline-block {
  display: inline-block;
}
.hidden {
  display: none;
}

margin.css

Pretty Similiar approach to width and height classes is used for margins. There are mnemonic for every margin side:

  • mmargin
  • mtmargin-top
  • mrmargin-right
  • mbmargin-bottom
  • mlmargin-left

So for every side classes go with a step of 1px from 0 to 20px and then with a step of 5px from 20px to 50px.

/* top */ 
.mt-0 {
  margin-top: 0;
}
.mt-1 {
  margin-top: 1px;
}
.mt-2 {
  margin-top: 2px;
}
...

.mt-20 {
  margin-top: 20px;
}
.mt-25 {
  margin-top: 25px;
}
...

.mt-50 {
  margin-top: 50px;
}

padding.css

For padding is used the the same approach as for margin. Mnemonics:

  • ppadding
  • ptpadding-top
  • prpadding-right
  • pbpadding-bottom
  • plpadding-left

So for every side classes go with a step of 1px from 0 to 20px and then with a step of 5px from 20px to 50px.

/* right */ 
.pr-0 {
  padding-right: 0;
}
.pr-1 {
  padding-right: 1px;
}
.pr-2 {
  padding-right: 2px;
}
...

.pr-20 {
  padding-right: 20px;
}
.pr-25 {
  padding-right: 25px;
}
...

.pr-50 {
  padding-right: 50px;
}

border.css

.debug class for highlighting the needed part and some helpers around no-border:

.debug {
  border: 2px dashed red;
}
.no-border {
  border: none;
}
.no-border-top {
  border-top: none;
}
.no-border-right {
  border-right: none;
}
.no-border-bottom {
  border-bottom: none;
}
.no-border-left {
  border-left: none;
}