3.2.0 • Published 3 years ago

lit-props v3.2.0

Weekly downloads
3
License
MIT
Repository
github
Last release
3 years ago

lit-props

Build Status npm version Node.js Version

Lit TypeScript properties made easy. Zero dependencies.

Without lit-props:

import { LitElement } from 'lit';
import { customElement, property } from 'lit/decorators.js';

@customElement('my-element')
export class MyElement extends LitElement {
  @property({ type: Object }) obj = {};
  @property({ type: Number }) id = 0;
  @property({ type: Boolean, reflect: true }) reflectedBool = false;
  @state() protected _counter = 0;
}

With lit-props:

import { LitElement } from 'lit';
import { customElement, property } from 'lit/decorators.js';
import * as lp from 'lit-props';

@customElement('my-element')
export class MyElement extends LitElement {
  @lp.object obj = {};
  @lp.number id = 0;
  @lp.reflected.bool reflectedBool = false;
  @lp.state protected _counter = 0;
}

Installation

npm i lit-props

Supported property types

string
bool
number
array
object

reflected
  string
  bool
  number
  array
  object

State is also supported via state.

3.2.0

3 years ago

3.1.1

3 years ago

3.1.0

3 years ago

3.0.1

3 years ago

3.0.0

3 years ago

2.0.0

3 years ago

1.1.0

3 years ago

1.0.0

4 years ago

0.0.2

4 years ago

0.0.1

4 years ago