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

layout-it

v0.4.2

Published

custom elements for building layouts

Downloads

17

Readme

layout-it

Custom elements for building layouts

  • <grid-it />
  • <center-it />

How To Use

  • via npm : npm i layout-it then use import from 'layout-it';
  • within HTML via script tag :
    <!-- ES5 version -->
    <script nomodule src="min.js"></script>
    <!-- ES6 version -->
    <script type="module" src="index.min.js"></script>

<grid-it />

Layout element for building flex grids

  • extends HTMLElement
  • based on display:grid style
  • with three custom attributes rows, columns and areas precursors of corresponding grid-template-xxx style properties.

Compared to grid-template-xxx style properties, rows, columns and areas must be declared with the following rules

  • expressions inrows and columns should not contain spaces, eg columns="repeat(3,1fr)", not columns="repeat(3, 1fr)"
  • areas has been simplified compared to grid-template-areas and it is just a sequence of letters or digits separated by (multiple) spaces, eg areas="a b c d", not areas="'a' 'b' 'c' 'd'". The sequence of letters match the grid children order.

Examples

    <!-- 3 rows header/footer layout -->
    <grid-it style="height:100vh"
             rows="auto 1fr auto"
             columns="1fr"
             areas="a b c">
        <div>Header</div>
        <div>Main</div>
        <div>Footer</div>
    </grid-it>
    <!-- 3 rows header/footer layout with left column
         Note : expressions should not contain space characters
                eg minmax(min-content, 33%) will not work -->
    <grid-it style="height:100vh"
             rows="auto 1fr auto"
             columns="minmax(min-content,33%) 1fr"
             areas="a a b c d d">
        <div>Header</div>
        <div>Left</div>
        <div>Main</div>
        <div>Footer</div>
    </grid-it>

    <!-- 3 rows header/footer with 3 main equal columns
         Note : attributes supports multiple spaces
                except for expression (see upper)-->
    <grid-it style="height:100vh"
             rows="auto 1fr auto"
             columns="repeat(3,1fr)"
             areas="a a a   b c d   e e e">
        <div>Header</div>
        <div>Left</div>
        <div>Main</div>
        <div>Right Menu</div>
        <div>Main</div>
        <div>Footer</div>
    </grid-it>

<center-it />

Layout element for content centering

  • extends HTMLElement
  • based on display:flex;justify-content:center;align-items:center style
  • no custom attribute

Examples

    <center-it>I am centered</center-it>

Default styles

layout-it uses a default style

    html, body {
            padding:0;
            margin:0;
        }
    *, *::before, *::after {
        box-sizing: border-box;
    }

Dependency

  • ustyler for inserting the default style in the head tag.

custom-elements polyfills

See WebReflection/custom-elements