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

@bulba/element

v0.14.4

Published

An intuitive, deterministic, and extendable web component base class

Downloads

24

Readme

🧾 Explore

Getting Started

So you're ready to take the dive? Awesome! Check out the wiki articles below on getting started. If you run into any problems or simply have ideas and suggestions, don't be shy about submitting an issue or pull request!

Install

With NPM:

$ npm i @bulba/element

Bulba will include needed packages alongside itself: @bulba/utils, @bulba/jsx, @bulba/template.


Using Bulba is then as simple as this for the Template flavor:

import { BulbaElement, register} from "@bulba/element"
import { Renderer } from "@bulba/template"

class MyComponent extends BulbaElement(Renderer) { ... }

And for the JSX flavor:

import { BulbaElement, register} from "@bulba/element"
import { Renderer, jsx, Fragment } from "@bulba/jsx"

class MyComponent extends BulbaElement(Renderer) { ... }

Note that the jsx and Fragment are pragmas for the internal JSX library, snabbdom, and should be included in any file with JSX. You'll also need to configure your environment to transform JSX.

Learn more about the Snabbdom JSX API in the modules section of their documentation. Bulba uses a syntax modifier internally for JSX to enable a more user-friendly prop signature.

CDN

You can specify the JSX or Template flavors using CDN. BulbaElement, the renderer, and utilities will be bundled together in this scenario.

<script
  type="text/javascript"
  src="https://cdn.jsdelivr.net/npm/@bulba/[email protected]/dist/bulba-template.js"
  integrity="sha256-AmDcP/sdpRYuEzpOqxrrMUe+j2N4rXBDmuOtzhsngok="
  crossorigin="anonymous"
></script>
<script
  type="text/javascript"
  src="https://cdn.jsdelivr.net/npm/@bulba/[email protected]/dist/bulba-template.min.js"
  integrity="sha256-rVw3SxOyQLMP8YGPSMmajj09cZ7Jw6y2Wol6XcE6PLo="
  crossorigin="anonymous"
></script>
<script
  type="text/javascript"
  src="https://cdn.jsdelivr.net/npm/@bulba/[email protected]/dist/bulba-jsx.js"
  integrity="sha256-zsOCH9e2LQhReCMqnK9bsp4EliqVbp2EkXm+vsZcN/c="
  crossorigin="anonymous"
></script>
<script
  type="text/javascript"
  src="https://cdn.jsdelivr.net/npm/@bulba/[email protected]/dist/bulba-jsx.min.js"
  integrity="sha256-ygwZLJhcHsbSyVfO+0gcgJqCWEYvcI+dNDdg+OL56Is="
  crossorigin="anonymous"
></script>

Note that if you use the CDN bundles, you should set all "@bulba/*" package external names to "Bulba" in your app bundler of choice.

Here's a rollup example:

const globals = {
  "@bulba/element": "Bulba",
  "@bulba/jsx": "Bulba",
  "@bulba/template": "Bulba",
  "@bulba/utils": "Bulba",
}

// export config
export default {
  // ...
  external: (id) => /@bulba\/./.test(id),
  output: {
    // ...,
    globals,
  },
}

Browser Support

The npm and browser bundles will work in all major browsers, except IE11. The package contains no explicit polyfills.

Use the below polyfills to achieve IE11 support. Include them once in your app (or page) before importing Bulba.

You will also need to run the bundle through ES5 transpilation for things like arrow functions.

Contribute

If you like the project or find issues, feel free to contribute!

See this StackOverflow answer on prerelease versioning.