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

curium

v1.0.5

Published

Curium - Web Component Library/Framework Powerful & Small

Downloads

25

Readme

Curium

Development moved github.com/AlexanderElias/jenie

Curium is a custom web component library/framework. Curium has two main flavors Curium and Curium + Swathe. Curium is your main custom elements library similar to X-tag and Skate. Curium + Swathe is your custom components library plus fancy data binding features in which case it is more like Polymer but more performant and way way smaller.

Swathe Link: github.com/AlexanderElias/swathe

Minified Sizes

  • Curium: 2.04 KB
  • Curium + Swathe: 3.39 KB
  • X-tag: 13.7 KB
  • Skate: 13.7 KB
  • Polymer: varies on version but HUGE

Browser Support

  • Chrome
  • Firefox
  • IE 11+/Edge (IE 10 has flaky Mutation Observer)
  • Safari 7+
  • Safari (iOS 7.1)
  • Chrome (Android)

Usage

  • Curium With Pollyfill - curium.polly.min.js. This version bundles [webcomponents-lite.js ]

API

Curium

Returns an instance of the Curium object.

Properties

  • components: Object
  • component: Function
  • query: Function
  • script: Function
  • document: Function

Curium.components

Returns an object with all the custom components by there custom tag name. Helps keep the global scope clean.

Properties

  • tag
    • Curium.component

Curium.component()

Returns a custom component object. Accepts an options object.

Properties

  • template
  • element
  • attribute
  • controller (If using Swathe it is a special Swathe controller otherwise it is just an object)
  • model (If using Swathe it is a special Swathe model otherwise it is just an object)

Required Options

  • tag: String required (Note must be of format start-end)

Template Options

  • template: HTMLElement DOM element
  • template: String string containing html (Note must begin with a html tag <ANY-TAG> even an html comment will work)
  • template: String path to template using XHR (Note must begin with ./ , /, or http)
  • template: Function multiline comment inside function function () {/* <template>I can span multiple lines</template> */}
  • template: String querySelector on the current script (Note will not work if Curium.component(options) is wrapped by function such as event listener)

Methods Options

  • created: Function callback fired when custom element is created. Parameter is it's self.
  • attached: Function callback fired when custom element is created. Parameter is it's self.
  • detached: Function callback fired when custom element is created. Parameter is it's self.
  • attributed: Function callback fired when custom element is created. Parameter is it's self.

Curium.query()

Query selector on the current scripts document. Essentially a wrapper for document._currentScript.ownerDocument.querySelector(query) but in the current html document.

Curium.script()

Convenience and compatibility document._currentScript.

Curium.document()

Convenience and compatibility document._currentScript.ownerDocument.

Examples

Basic

Curium.component({ tag: 'c-tag' });

Life Cycle

Curium.component({
	tag: 'c-tag',
	created: function (self) {
		console.log('created');
		// manipulate self.template
	},
	attached: function (self) {
		console.log('attached');
		// if using XHR templates attached is fired before created other wise it is fired after created
	},
	detached: function (self) {
		console.log('detached');
		// fired when element is removed from DOM
	},
	attributed: function (self, name, oldValue, newValue) {
		console.log('attributed');
		// fired any time attribute changes
		// self.attribute an object that can set or get the target elements attributes
	}
});

JS File


var templateString = '<template><p>templateString</p></template>';

var templateMultiline = function () {/*

	<template>
		<p>templateMultiline</p>
	</template>

*/};

Curium.component({
	tag: 'c-tag',
	template: './template.html', // path to template.html file
	template: templateString,
	template: templateMultiline,
});

HTML File


<template>
	<p>templateQuery</p>
</template>

<script>
var templateElement = Curium.query('template');

Curium.component({
	tag: 'c-tag',
	template: 'template',
	template: templateElement,
});
</script>

License

Licensed Under MPL 2.0

Copyright 2016 Alexander Elias