1.3.0-12 • Published 3 years ago

muser v1.3.0-12

Weekly downloads
-
License
ISC
Repository
github
Last release
3 years ago

Muse

npm.io

中文

A Canvas Componentization Framework to Help You Build Complex UI.

  • Componentization
  • High Performance
  • Easy to Use

Install

npm install muser

or

yarn add muser

Usage

import { Element, useElement, Brush } from 'muser';
import ChildrenElement from 'src/components/children-element';

export default class App extends Element<{ value: string }> {
  state = { width: 10, color: 'green' };

  render({ state, props }: App) {
    const child = useElement(ChildrenElement, {
      width: 100,
      height: 100,
      key: 'key-of-child-element',
    });

    // re-render when 'width' or 'value' or 'color' was changed
    return ({ rect }: Brush) => {
      const { width, color } = state;
      const { value } = props;

      rect([0, 0, width, width], { fillStyle: color });

      child({ value })
        .paste({  x: 0, y: 0 });
    };
  }
}

const app = new App({ width: 100, height: 100 });
app.init({ value: 'hello world!' });

Document

See Document

1.3.0-4

3 years ago

1.3.0-3

3 years ago

1.3.0-2

3 years ago

1.3.0-1

3 years ago

1.3.0-8

3 years ago

1.3.0-7

3 years ago

1.3.0-6

3 years ago

1.3.0-9

3 years ago

1.3.0-11

3 years ago

1.3.0-10

3 years ago

1.3.0-12

3 years ago

1.2.6

3 years ago

1.2.5

3 years ago

1.2.4

3 years ago

1.2.3

3 years ago

1.2.2

3 years ago

1.3.0

3 years ago

1.2.1

3 years ago

1.2.0

3 years ago

1.1.0-beta.1.0

3 years ago

1.0.4-beta.1.8

3 years ago

1.0.4-beta.1.7

3 years ago

1.0.4-beta.1.6

3 years ago

1.0.4-beta.1.5

3 years ago

1.0.4-beta.1.4

3 years ago

1.0.4-beta.1.3

3 years ago

1.0.4-beta.1.2

3 years ago

1.0.4-beta.1.1

3 years ago

1.0.4-beta.1.0

3 years ago

1.0.4

3 years ago

1.0.3

3 years ago

1.0.2

3 years ago

1.0.1

3 years ago

1.0.0

3 years ago