JSPM

  • Created
  • Published
  • Downloads 199
  • Score
    100M100P100Q97106F
  • License MIT

A powerful, modern, and lightweight runtime for creating reactive web components with TypeScript

Package Exports

  • @jasonshimmy/custom-elements-runtime

Readme

๐Ÿงฉ Custom Elements Runtime

Patreon

Ultra-powerful, type-safe runtime for fast, reactive, and maintainable web components.

Build modern components with strict TypeScript, zero dependencies, and a clean functional API. Designed for speed, standards compliance, and productivity.

๐Ÿ•น๏ธ Try it on Codepen.io.

โœจ Why You'll Love It

  • โšก Blazing Fast: Minimal runtime, instant updates, zero dependencies.
  • ๐ŸŽจ JIT CSS: On-demand, utility-first styling directly in your HTML at runtime.
  • ๐Ÿ’ช No Build Necessary: Instant development feedback, no bundling required.
  • ๐Ÿง‘โ€๐Ÿ’ป TypeScript First: Strict types, intellisense, and safety everywhere.
  • ๐Ÿงฉ Functional API: No classes, no boilerplateโ€”just pure functions.
  • ๐Ÿ› ๏ธ SSR & HMR Ready: Universal rendering and instant hot reloads.
  • ๐Ÿ”Œ Extensible: Directives, event bus, store, and more for advanced use cases.
  • ๐Ÿ† Developer Friendly: Clean docs, examples, and a welcoming community.

โฑ๏ธ Getting Started

  1. Install: npm install @jasonshimmy/custom-elements-runtime
  2. Create a Component:
import { component, ref, html, useEmit } from '@jasonshimmy/custom-elements-runtime';

component('my-counter', ({ initialCount = 0 }) => {
  const count = ref(initialCount);
  const emit = useEmit();

  const handleClick = () => {
    count.value++;
    emit('update:initial-count', { count: count.value });
  };

  return html`
    <button
      type="button"
      class="px-4 py-2 bg-primary-500 text-white rounded"
      @click.prevent="${handleClick}"
    >
      Count: ${count.value}
    </button>
  `;
});
  1. Use in HTML:
<my-counter
  initial-count="5"
  @update:initial-count="handleCountUpdate"
></my-counter>

<script>
function handleCountUpdate(event) {
  console.log('Count updated to:', event.detail.count);
}
</script>
  1. Enjoy instant reactivity and type safety!

๐Ÿ“– Documentation Index

Explore the complete documentation for every runtime feature:

๐Ÿš€ Getting Started

๐Ÿ—๏ธ Core Features

๐ŸŽจ Styling

๐Ÿ”— Communication & State

โšก Advanced Features

๐Ÿ”ง Integration Guides

๐Ÿ› ๏ธ Troubleshooting

For examples and implementation details, explore the source code in src/lib/.

๐Ÿง‘โ€๐Ÿ”ฌ Real-World Examples

๐ŸŒŸ Showcase & Community

๐Ÿ’– Support This Project

Custom Elements Runtime is a labor of love built to make modern web development faster and more expressive. If it's helping you build better components, consider supporting me on Patreon to help keep the momentum going.

Your support helps fund continued development, documentation, and community engagement. Every bit helpsโ€”thank you!