All Projects → adobe → Lit Mobx

adobe / Lit Mobx

Licence: other
Mixin and base class for using mobx with lit-element

Programming Languages

typescript
32286 projects

Projects that are alternatives of or similar to Lit Mobx

React Mobx Firebase Authentication
🔥Boilerplate Project for Authentication with Firebase in React and MobX
Stars: ✭ 111 (-11.9%)
Mutual labels:  mobx
Feline For Product Hunt
A beautiful, unofficial app for Product Hunt
Stars: ✭ 115 (-8.73%)
Mutual labels:  mobx
Fit Html
💪 Combining web components + lit-html + redux (3KB)
Stars: ✭ 121 (-3.97%)
Mutual labels:  web-components
Vue Mobx
😄 ⭐️ 😇 Mobx binding for Vuejs 2.
Stars: ✭ 111 (-11.9%)
Mutual labels:  mobx
Hot Table
Handsontable - Best Data Grid Web Component with Spreadsheet Look and Feel.
Stars: ✭ 114 (-9.52%)
Mutual labels:  web-components
Mobx Preact
MobX bindings for Preact
Stars: ✭ 117 (-7.14%)
Mutual labels:  mobx
Vanilla Hamburger
Animated hamburger menu icons for modern web apps (1.8 KB) 🍔
Stars: ✭ 110 (-12.7%)
Mutual labels:  web-components
Elm Canvas
A canvas drawing library for Elm
Stars: ✭ 124 (-1.59%)
Mutual labels:  web-components
Image Crop Element
A custom element for cropping a square image. Returns x, y, width, and height.
Stars: ✭ 115 (-8.73%)
Mutual labels:  web-components
Gakki
🌼🌸 A React Native App for Mastodon. 一个由React Native编写的长毛象客户端App🦋
Stars: ✭ 120 (-4.76%)
Mutual labels:  mobx
Smart Webcomponents
Web Components & Custom Elements for Professional Web Applications
Stars: ✭ 110 (-12.7%)
Mutual labels:  web-components
Rnexample
一个基于mobx、react-navigation、teaset的react-native框架
Stars: ✭ 114 (-9.52%)
Mutual labels:  mobx
Polydev
Automatic web components profiling in chrome devtools
Stars: ✭ 118 (-6.35%)
Mutual labels:  web-components
Nutmeg
Build, test, and publish vanilla Web Components with a little spice
Stars: ✭ 111 (-11.9%)
Mutual labels:  web-components
React Eva
Effects+View+Actions(React distributed state management solution with rxjs.)
Stars: ✭ 121 (-3.97%)
Mutual labels:  mobx
Datx
DatX is an opinionated JS/TS data store. It features support for simple property definition, references to other models and first-class TypeScript support.
Stars: ✭ 111 (-11.9%)
Mutual labels:  mobx
S Mobx
轻量级mobx实现,仅供参考
Stars: ✭ 116 (-7.94%)
Mutual labels:  mobx
Apple Basket Redux
🍎 苹果篮子,一个微型的redux/mobx演示(附多版本)
Stars: ✭ 125 (-0.79%)
Mutual labels:  mobx
Gank
🦅 Gank api base △ next.js (react&ssr)
Stars: ✭ 122 (-3.17%)
Mutual labels:  mobx
Vime
Customizable, extensible, accessible and framework agnostic media player. Modern alternative to Video.js and Plyr. Supports HTML5, HLS, Dash, YouTube, Vimeo, Dailymotion...
Stars: ✭ 1,928 (+1430.16%)
Mutual labels:  web-components

Known Vulnerabilities

lit-mobx

Mixin and base class that allow easy usage of mobx observables with lit-element.

The mixin implementation is based heavily on the work of Alexander Weiss in his mobx-lit-element implementation. This has been rewritten to support multiple forms of usage (mixin, or base class) as well as to be based on typescript to get type definitions.

Installation

As a dependency:

npm install --save @adobe/lit-mobx lit-element mobx

Demo

npm install
npm run demo

Usage

See the JavaScript and TypeScript example projects on StackBlitz. See this example for a demonstration of usage with Mobx v6 in Typescript without the use of decorators.

import { LitElement, html, TemplateResult, customElement } from 'lit-element';
import { observable, action } from 'mobx';
import { MobxLitElement } from '@adobe/lit-mobx';

// create a mobx observable
class Counter {
    @observable
    public count = 0;

    @action
    public increment() {
        this.count++;
    }
}

// create instance that can be shared across components
const counter = new Counter();

// create a new custom element, and use the base MobxLitElement class
// alternatively you can use the MobxReactionUpdate mixin, e.g. `class MyElement extends MobxReactionUpdate(LitElement)`
@customElement('my-element')
export class MyElement extends MobxLitElement {
    private counter = counter

    // any observables accessed in the render method will now trigger an update
    public render(): TemplateResult {
        return html`
            Count is ${this.counter.count}
            <br />
            <button @click=${this.incrementCount}>Add</button>
        `;
    }

    private incrementCount() {
        this.counter.increment();
    }
}

For further examples see the demo folder.

Contributing

Contributions are welcomed! Read the Contributing Guide for more information.

Licensing

This project is licensed under the Apache V2 License. See LICENSE for more information.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].