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

declarative-custom-element

v0.0.2

Published

Native declarative way to create a custom webcomponent

Downloads

4

Readme

custom-element

Native declarative way to create a custom webcomponent

Since Polymer shadowdom polyfill causes some issues with other libraries (notable with MooTools) I decided to create this clone of the polymer-element element that doesn't use the shadow dom part.

custom-element follows a native approach so it's not dependant on any framework to work, so any component built with it will work with both Polymer or X-Tag but it can also be used as standalone just by including only a Custom Elements polyfill like the Polymer one or @WebReflection one , and it will work natively in browsers which supports the document.registerElement method such as Google Chrome Canary

What's similar to polymer-element

  • custom-element will look for the first template element inside the component and it will clone its content and attach it to its body
  • the prototype registration can be done anywhere, even in a different script
  • if you don't need to register any prototype you can use the noscript attribute
  • it can extend an existing element using extend
  • it can publish a constructor using the constructor attribute
  • you can publish some attributes using the attributes attribute
  • you can use the content tag inside template to define where your element content will appear
  • you can listen to the {propertyName}Changed event.
  • you can listen to the ready event.
  • you can listen to the created event.

also from the Custom Element Polyfill

  • you can listen to the attributeChangedCallback event.
  • you can listen to the attachedCallback event.
  • you can listen to the detachedCallback event.

Differences with Polymer-Element

  • The biggest change is that custom-element do not use shadow dom, since the polyfill was causing some issues with MooTools. This change will make the component simpler to theme also since all the subtree is exposed now.

  • Instead of calling Polymer you will call document.register.tag instead, the syntax is the same

  • the $ shortcut will map using data-id instead of the id, since otherwise there will possibly be duplicates id in the page.

  • it doesn't support publishing attributes via the published options

  • if no content element is provided in the template element, the content will still be appended after the template contents

Work in progress. Alpha version. Don't try this at home. No Cats has been harmed during the writing of this clone.