Comparing version 0.0.7 to 0.0.8
@@ -15,6 +15,2 @@ import { View } from './View'; | ||
} | ||
export declare abstract class ListEnable<T, E> extends Enable<T[], E> { | ||
} | ||
export declare abstract class ListEnableWithOptions<T, O, E> extends EnableWithOptions<T[], O, E> { | ||
} | ||
export {}; |
@@ -7,5 +7,3 @@ "use strict"; | ||
Enable: null, | ||
EnableWithOptions: null, | ||
ListEnable: null, | ||
ListEnableWithOptions: null | ||
EnableWithOptions: null | ||
}); | ||
@@ -24,8 +22,2 @@ function _export(target, all) { | ||
return EnableWithOptions; | ||
}, | ||
ListEnable: function() { | ||
return ListEnable; | ||
}, | ||
ListEnableWithOptions: function() { | ||
return ListEnableWithOptions; | ||
} | ||
@@ -79,5 +71,1 @@ }); | ||
} | ||
class ListEnable extends Enable { | ||
} | ||
class ListEnableWithOptions extends EnableWithOptions { | ||
} |
@@ -47,5 +47,1 @@ function _define_property(obj, key, value) { | ||
} | ||
export class ListEnable extends Enable { | ||
} | ||
export class ListEnableWithOptions extends EnableWithOptions { | ||
} |
export { rune } from "./rune"; | ||
export { $Element, $ } from "./$Element"; | ||
export { View, ListView } from "./View"; | ||
export { Enable, ListEnable } from "./Enable"; | ||
export { View, ViewWithOptions } from "./View"; | ||
export { ListView, ListViewWithOptions } from "./ListView"; | ||
export { Enable, EnableWithOptions } from "./Enable"; | ||
export { ListEnable, ListEnableWithOptions } from "./ListEnable"; | ||
export { Layout } from "./Layout"; | ||
@@ -6,0 +8,0 @@ export { LayoutHelper } from "./LayoutHelper"; |
@@ -1,14 +0,1 @@ | ||
function _define_property(obj, key, value) { | ||
if (key in obj) { | ||
Object.defineProperty(obj, key, { | ||
value: value, | ||
enumerable: true, | ||
configurable: true, | ||
writable: true | ||
}); | ||
} else { | ||
obj[key] = value; | ||
} | ||
return obj; | ||
} | ||
import { View } from "./View"; | ||
@@ -19,6 +6,2 @@ export class Page extends View { | ||
} | ||
constructor(...args){ | ||
super(...args); | ||
_define_property(this, "layout", null); | ||
} | ||
} |
@@ -169,5 +169,1 @@ function _define_property(obj, key, value) { | ||
} | ||
export class ListView extends View { | ||
} | ||
export class ListViewWithOptions extends ViewWithOptions { | ||
} |
@@ -61,3 +61,3 @@ function _define_property(obj, key, value) { | ||
set data(data) { | ||
throw TypeError("data property is readonly."); | ||
throw TypeError("'data' property is readonly."); | ||
} | ||
@@ -104,6 +104,9 @@ /* eslint-disable-next-line @typescript-eslint/no-unused-vars */ template(data) { | ||
} | ||
ready() {} | ||
toHtml() { | ||
if (this.renderCount === 0) this.ready(); | ||
return this._makeHtml()._currentHtml; | ||
} | ||
async toHtmlAsync() { | ||
if (this.renderCount === 0) this.ready(); | ||
return (await this._makeHtmlAsync())._currentHtml; | ||
@@ -110,0 +113,0 @@ } |
export { rune } from './rune'; | ||
export { $Element, $ } from './$Element'; | ||
export { View, ListView } from './View'; | ||
export { Enable, ListEnable } from './Enable'; | ||
export { View, ViewWithOptions } from './View'; | ||
export { ListView, ListViewWithOptions } from './ListView'; | ||
export { Enable, EnableWithOptions } from './Enable'; | ||
export { ListEnable, ListEnableWithOptions } from './ListEnable'; | ||
export { Layout } from './Layout'; | ||
@@ -6,0 +8,0 @@ export { LayoutHelper } from './LayoutHelper'; |
@@ -9,9 +9,13 @@ "use strict"; | ||
Enable: null, | ||
EnableWithOptions: null, | ||
Layout: null, | ||
LayoutHelper: null, | ||
ListEnable: null, | ||
ListEnableWithOptions: null, | ||
ListView: null, | ||
ListViewWithOptions: null, | ||
Page: null, | ||
UnsafeHtml: null, | ||
View: null, | ||
ViewWithOptions: null, | ||
VirtualView: null, | ||
@@ -39,2 +43,5 @@ enable: null, | ||
}, | ||
EnableWithOptions: function() { | ||
return _Enable.EnableWithOptions; | ||
}, | ||
Layout: function() { | ||
@@ -47,7 +54,13 @@ return _Layout.Layout; | ||
ListEnable: function() { | ||
return _Enable.ListEnable; | ||
return _ListEnable.ListEnable; | ||
}, | ||
ListEnableWithOptions: function() { | ||
return _ListEnable.ListEnableWithOptions; | ||
}, | ||
ListView: function() { | ||
return _View.ListView; | ||
return _ListView.ListView; | ||
}, | ||
ListViewWithOptions: function() { | ||
return _ListView.ListViewWithOptions; | ||
}, | ||
Page: function() { | ||
@@ -62,2 +75,5 @@ return _Page.Page; | ||
}, | ||
ViewWithOptions: function() { | ||
return _View.ViewWithOptions; | ||
}, | ||
VirtualView: function() { | ||
@@ -82,3 +98,5 @@ return _VirtualView.VirtualView; | ||
const _View = require("./View"); | ||
const _ListView = require("./ListView"); | ||
const _Enable = require("./Enable"); | ||
const _ListEnable = require("./ListEnable"); | ||
const _Layout = require("./Layout"); | ||
@@ -85,0 +103,0 @@ const _LayoutHelper = require("./LayoutHelper"); |
import { View } from './View'; | ||
import { Layout } from './Layout'; | ||
export declare class Page<T extends object> extends View<T> { | ||
layout: Layout<object> | null; | ||
hydrateFromSSR(): this; | ||
} |
@@ -12,15 +12,2 @@ "use strict"; | ||
const _View = require("./View"); | ||
function _define_property(obj, key, value) { | ||
if (key in obj) { | ||
Object.defineProperty(obj, key, { | ||
value: value, | ||
enumerable: true, | ||
configurable: true, | ||
writable: true | ||
}); | ||
} else { | ||
obj[key] = value; | ||
} | ||
return obj; | ||
} | ||
class Page extends _View.View { | ||
@@ -30,6 +17,2 @@ hydrateFromSSR() { | ||
} | ||
constructor(...args){ | ||
super(...args); | ||
_define_property(this, "layout", null); | ||
} | ||
} |
@@ -43,6 +43,2 @@ import { VirtualView } from './VirtualView'; | ||
} | ||
export declare class ListView<T extends object> extends View<T[]> { | ||
} | ||
export declare class ListViewWithOptions<T extends object, O> extends ViewWithOptions<T[], O> { | ||
} | ||
export {}; |
@@ -6,4 +6,2 @@ "use strict"; | ||
0 && (module.exports = { | ||
ListView: null, | ||
ListViewWithOptions: null, | ||
View: null, | ||
@@ -19,8 +17,2 @@ ViewWithOptions: null | ||
_export(exports, { | ||
ListView: function() { | ||
return ListView; | ||
}, | ||
ListViewWithOptions: function() { | ||
return ListViewWithOptions; | ||
}, | ||
View: function() { | ||
@@ -201,5 +193,1 @@ return View; | ||
} | ||
class ListView extends View { | ||
} | ||
class ListViewWithOptions extends ViewWithOptions { | ||
} |
@@ -23,2 +23,3 @@ import { Base } from './Base'; | ||
protected _makeHtmlAsync(): Promise<this>; | ||
protected ready(): void; | ||
toHtml(): string; | ||
@@ -25,0 +26,0 @@ toHtmlAsync(): Promise<string>; |
@@ -91,3 +91,3 @@ "use strict"; | ||
set data(data) { | ||
throw TypeError("data property is readonly."); | ||
throw TypeError("'data' property is readonly."); | ||
} | ||
@@ -134,6 +134,9 @@ /* eslint-disable-next-line @typescript-eslint/no-unused-vars */ template(data) { | ||
} | ||
ready() {} | ||
toHtml() { | ||
if (this.renderCount === 0) this.ready(); | ||
return this._makeHtml()._currentHtml; | ||
} | ||
async toHtmlAsync() { | ||
if (this.renderCount === 0) this.ready(); | ||
return (await this._makeHtmlAsync())._currentHtml; | ||
@@ -140,0 +143,0 @@ } |
{ | ||
"name": "rune-ts", | ||
"version": "0.0.7", | ||
"version": "0.0.8", | ||
"description": "Rune Core Library", | ||
@@ -21,3 +21,2 @@ "engines": { | ||
"tsconfig.json", | ||
"docs/", | ||
"dist/", | ||
@@ -24,0 +23,0 @@ "README.md", |
@@ -28,3 +28,6 @@ # Rune - Web API based Front-end SDK | ||
class SettingsView extends View<Setting[]> { | ||
class SettingController extends View<Setting[]> { | ||
private checkAllSwitchView = new SwitchView({ on: this.isAllChecked() }); | ||
private settingListview = new SettingListView(this.data); | ||
override template() { | ||
@@ -35,12 +38,5 @@ return html` | ||
<span class="title">Check All</span> | ||
${new SwitchView({ on: this.isAllChecked() })} | ||
${this.checkAllSwitchView} | ||
</div> | ||
<ul class="body"> | ||
${this.data.map((setting) => html` | ||
<li> | ||
<span class="title">${setting.title}</span> | ||
${new SwitchView(setting)} | ||
</li> | ||
`)} | ||
</ul> | ||
${this.settingListview} | ||
</div> | ||
@@ -52,11 +48,11 @@ `; | ||
checkAll() { | ||
const { on } = this.subViewIn('> .header', SwitchView)!.data; | ||
this.subViewsIn('> .body', SwitchView) | ||
.filter((view) => on !== view.data.on) | ||
.forEach((view) => view.setOn(on)); | ||
const { on } = this.checkAllSwitchView.data; | ||
this.settingListview.itemViews | ||
.filter((view) => on !== view.data.on) | ||
.forEach((view) => view.switchView.setOn(on)); | ||
} | ||
@on('switch:change', '> .body') | ||
@on('switch:change', `> .${SettingListView}`) | ||
private _changed() { | ||
this.subViewIn('> .header', SwitchView)!.setOn(this.isAllChecked()); | ||
this.checkAllSwitchView.setOn(this.isAllChecked()); | ||
} | ||
@@ -68,2 +64,4 @@ | ||
} | ||
``` | ||
``` | ||
<img src="https://s3.marpple.co/files/u_218933/2024/3/original/a3e403fe7005e00e23b99bf3a331c5c252f392401.gif" width="100%"> |
@@ -30,2 +30,3 @@ { | ||
"dist", | ||
"demo", | ||
"taskfile.js", | ||
@@ -32,0 +33,0 @@ "taskfile-watch.js", |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Mixed license
License(Experimental) Package contains multiple licenses.
Found 1 instance in 1 package
0
3353
207524
128
63