rune-ts
TypeScript icon, indicating that this package has built-in type declarations

0.8.8 • Public • Published

rune

Rune - Web API based Front-end SDK

Rune is a fast and robust library for building high-quality frontend applications, serving as a modern web technology-based SDK.

  • Type-safe Generic Views & Enable
  • Single-component Server-Side Rendering
  • Sleek UI component development kit
  • High portability and performance
  • Object-oriented programming-based architecture

Getting Started

pnpm add rune-ts
npm install rune-ts

Documentation

Example

interface Setting {
  title: string;
  on: boolean;
}

class SettingController extends View<Setting[]> {
  private checkAllSwitchView = new SwitchView({ on: this.isAllChecked() });
  private settingListview = new SettingListView(this.data);

  override template() {
    return html`
      <div>
        <div class="header">
          <span class="title">Check All</span>
          ${this.checkAllSwitchView}
        </div>
        ${this.settingListview}
      </div>
    `;
  }

  @on('switch:change', '> .header')
  checkAll() {
    const { on } = this.checkAllSwitchView.data;
    this.settingListview.itemViews
      .filter((view) => on !== view.data.on)
      .forEach((view) => view.switchView.setOn(on));
  }

  @on('switch:change', `> .${SettingListView}`)
  private _changed() {
    this.checkAllSwitchView.setOn(this.isAllChecked());
  }

  isAllChecked() {
    return this.data.every(({ on }) => on);
  }
}

setting_controller

Readme

Keywords

none

Package Sidebar

Install

npm i rune-ts

Weekly Downloads

203

Version

0.8.8

License

Apache-2.0

Unpacked Size

292 kB

Total Files

177

Last publish

Collaborators

  • marpple-dev-admin