1.3.0-12 • Published 2 years ago

muser v1.3.0-12

Weekly downloads
-
License
ISC
Repository
github
Last release
2 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

2 years ago

1.3.0-3

2 years ago

1.3.0-2

2 years ago

1.3.0-1

2 years ago

1.3.0-8

2 years ago

1.3.0-7

2 years ago

1.3.0-6

2 years ago

1.3.0-9

2 years ago

1.3.0-11

2 years ago

1.3.0-10

2 years ago

1.3.0-12

2 years ago

1.2.6

2 years ago

1.2.5

2 years ago

1.2.4

2 years ago

1.2.3

2 years ago

1.2.2

2 years ago

1.3.0

2 years ago

1.2.1

2 years ago

1.2.0

2 years ago

1.1.0-beta.1.0

2 years ago

1.0.4-beta.1.8

2 years ago

1.0.4-beta.1.7

2 years ago

1.0.4-beta.1.6

2 years ago

1.0.4-beta.1.5

2 years ago

1.0.4-beta.1.4

2 years ago

1.0.4-beta.1.3

2 years ago

1.0.4-beta.1.2

2 years ago

1.0.4-beta.1.1

2 years ago

1.0.4-beta.1.0

2 years ago

1.0.4

2 years ago

1.0.3

2 years ago

1.0.2

2 years ago

1.0.1

2 years ago

1.0.0

2 years ago