0.2.4 • Published 5 years ago

pencil-runtime v0.2.4

Weekly downloads
1
License
MIT
Repository
github
Last release
5 years ago

Pencil Runtime

Standalone Stencil runtime.

Stencil - Compiler + Extras = Pencil

Alternative explanation: SkateJS with Stencil decorator syntax.

Why

  • Not dependent on TypeScript (only decorators are required)
  • Build a single bundle using webpack/rollup
  • No duplicate code (dependencies!)
  • No polyfills
  • ???

Example

// File: my-first-component.jsx

// Additional import of `h` is required to make `render` work.
import { h, Component, Prop } from 'pencil-runtime';

@Component({
  tag: 'my-first-component',
  shadow: true,
})
export class MyComponent {
  // Extra `type` parameter is necessary 
  // b/c it cannot be inferred at runtime.
  @Prop({ type: String, mutable: true, reflectToAttr: true }) name;

  render() {
    return (
      <p>
        Hello, {this.name}!
      </p>
    );
  }
}

Usage:

// File: main.js
import `./my-first-component.jsx`;

// my-first-component is now defined:

const mfc = document.createElement('my-first-component');
mfc.name = "World";
document.body.appendChild(mfc;)
0.2.4

5 years ago

0.2.3

5 years ago

0.2.2

5 years ago

0.2.1

5 years ago

0.2.0

5 years ago

0.1.0

5 years ago