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

mega-material

v1.0.0-alpha.3

Published

Material Lit Elements

Downloads

14

Readme

mega-material

Making Elements Great Again, Material Style!

Demo

Summary

A lightweight set of Web Components (using custom elements and ShadowDOM) implementing Google's Material Design System that should be compatible with any web-framwork on modern ever-green browsers.

Fast, efficient, easy to consume and easily themeable.

Status

The following components have been implemented or are in progress:

  • [ ] Bottom Navigation
  • [X] Button
  • [X] Card
  • [X] Checkbox
  • [ ] Chips
  • [X] Dialog
  • [X] Drawer
  • [X] FAB
  • [X] Icon
  • [X] Icon Button
  • [X] Linear Progress
  • [X] List
  • [ ] Radio Button
  • [X] Slider
  • [X] Snackbar
  • [X] Switch
  • [ ] Tabs
  • [ ] TextField
  • [X] Top-App-Bar

More work needs to be done on theming, events and tidying up the components.

Background

Google already provide an official Material Design web implementation:

https://github.com/material-components/material-components-web

This is designed to be used directly or act as a foundation that can be used to implement any framework-specific set of Material Design components by the creation of adaptor classes and re-use of the provided global BEM styles.

So a set of Material Design components for React, another for Angular, one for Vue, and so on with all the other web-frameworks.

Unfortunately, there are several issues with this approach:

The extra code to make it adaptable to multiple frameworks means there is more code than necessary for whichever framework you are using. The contributes to the JavaScript payload being larger than it needs to be - the full minified JS payload is 473Kb.

Because styles are global they need to be unique and the approach to this is to use BEM style classes. Lots of SASS templating allow customization but at the cost of bloat - the full set of minified CSS is 266Kb.

Implementing any elements in your app directly requires correctly matching up large blocks of HTML and CSS classes. While the framework-specific versions can create easier to consume components (at the cost of additional code) all design and implementation is then tied heavily to that framework.

It relies on abstractions and most abstractions are leaky. In this case there is an assumption that all HTML and styling is global to the page. So it doesn't work nicely with ShadowDOM.

Work has been progressing on a Web Component version, the snapily named:

https://github.com/material-components/material-components-web-components

But progress seems to be slow and there are challenges trying to adapt a system that has been fundamentally designed under the an assumption that global styling will be available into an implementation that actively prevents global styling.

This seems to be a real missed opportunity given that a single, web-component based implementation could be the only version required. It could be re-used by any framework without extra JavaScript and with less bloated styling (due to the isolation that ShadowDOM provides). By encapsulating the internal HTML and styling the components should provide a simpler and easier-to-consume API that would be consistent across frameworks.

Plans

In fairness, Google are trying to support more browsers than I am but I don't think it's worth compromising the components for IE and with Edge switching to use the Blink engine, all modern browsers will fully support Web Components.

RTL support using the dir attribute is old school and should be implemented using newer start & end styles (when available). RTL support is lower priority for me though.

JavaScript needs to be enabled to use Web Components so it makes no sense to recreate the CSS-only styling of the offical implementation.

SASS makes creating styles easy which maybe why it makes it easy to create too many styles. Instead of applying the same style properties to different classes (SASS mixins) we want to re-use elements internally to avoid repetition.

Customization and theming should be done using CSS variables although the new part feature may be useful for this in future.