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

material-shell

v1.2.7

Published

Shell element for material app.

Downloads

12

Readme

material-shell

Published on npm

Shell element for material app.

Its utility revolves around these principles:

  • It should be the first script/element to be fetched to avoid FOUC (in non-SSR environment)
  • The element loads default material styles (tokens)
    • or load the tokens saved in material-theme local storage if it exists.
  • Your app can be slotted inside the element.
  • The element shows a circular progress by default, you can use helper functions to toggle loading/showing content.

Playground Demo

Usage

Install

npm add -D material-shell

Importing styles and shell element

index.html:

<head>
	<script src="./node_modules/material-shell/material-styles.js"></script>
	<script src="./node_modules/material-shell/material-shell.js"></script>
</head>
<body>
	<material-shell></material-shell>
</body>

Notes:

  • Update src to wherever the scripts are located, they should be included during your building process
  • The scripts are minified for fast loading
  • You can load these scripts from a CDN

Slot your app

By default <material-shell> element will show a circular progress in the middle of the screen, even if you slot a content:

index.html:

<material-shell>
	<my-material-app-or-whatever></my-material-app-or-whatever>
</material-shell>

When your content is ready you can send an event to instruct the shell to show content:

// Somewhere in your app when content is ready
myApp.dispatchEvent(
	new Event('material-loading-off', {composed: true, bubbles: true})
);

But that's tedious, instead you can use a helper function:

import {materialShellLoadingOff} from 'material-shell';

// Somewhere in your app...
materialShellLoadingOff.call(this);

(There is also materialShellLoadingOn in case you want to hide the content again)

License

MIT License