프로젝트
GitHub에서 보기
marpple/rune
소개
Web API based Front-end SDK
웹 및 앱 개발측정된 스타 증가
- in 24h
- 0
- in 7 days
- 0
- in 15 days
- 0
- in 1 month
- 기록 수집 중
서로 겹치는 기간의 순증가량이며 일별 합계가 아닙니다. 측정값이 없으면 비워 둡니다. 스타는 관심도를 나타내며 품질을 보장하지 않습니다.
README.md
Original
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.
- Object-oriented programming-based architecture
- Type-safe Generic Views & Enable
- Single-component Server-Side Rendering
- Sleek UI component development kit
- High portability and performance
Getting Started
pnpm add rune-ts
npm install rune-ts
Documentation
Example
interface Setting {
title: string;
on: boolean;
}
class SettingItemView extends View<Setting> {
switchView = new SwitchView(this.data);
override template() {
return html`
<div>
<span class="title">${this.data.title}</span>
${this.switchView}
</div>
`;
}
}
class SettingListView extends ListView<SettingItemView> {
ItemView = SettingItemView;
}
class SettingPage extends View<Setting[]> {
private listView = new SettingListView(this.data);
private toggleAllView = new SwitchView({ on: this.isAllOn() });
override template() {
return html`
<div>
<div class="header">
<h2>Setting</h2>
${this.toggleAllView}
</div>
<div class="body">${this.listView}</div>
</div>
`;
}
protected override onRender() {
this.toggleAllView.addEventListener(Toggled, (e) => this.toggleAll(e.detail.on));
this.listView.addEventListener(Toggled, () => this.syncToggleAllView());
}
private toggleAll(on: boolean) {
this.listView.itemViews
.filter((itemView) => itemView.data.on !== on)
.forEach((itemView) => itemView.switchView.setOn(on));
}
private syncToggleAllView() {
this.toggleAllView.setOn(this.isAllOn());
}
private isAllOn() {
return this.data.every(({ on }) => on);
}
}
관련 프로젝트 살펴보기
불러오는 중…