Comparing version 2.1.1 to 2.1.2
@@ -66,3 +66,3 @@ // Type definitions for panel | ||
interface TemplateScope<AppState = {}> { | ||
interface TemplateScope<State, AppState = {}, Attrs = AnyAttrs> { | ||
/** AppState of the root panel component */ | ||
@@ -72,6 +72,6 @@ $app: AppState; | ||
/** Attributes parsed from component's html attributes using attrsSchema */ | ||
$attrs: {[attr: string]: any}; | ||
$attr<A extends keyof Attrs>(attr: A): Attrs[A]; | ||
/** A reference to the component itself */ | ||
$component: WebComponent; | ||
$component: Component<State, AppState, unknown, Attrs>; | ||
@@ -82,5 +82,5 @@ /** Helpers defined in component config */ | ||
interface ConfigOptions<State, AppState> { | ||
interface ConfigOptions<State, AppState, Attrs> { | ||
/** Function transforming state object to virtual dom tree */ | ||
template(scope: (TemplateScope<AppState> & State)): VNode; | ||
template(scope: TemplateScope<State, AppState, Attrs> & State): VNode; | ||
@@ -143,3 +143,3 @@ /** Component-specific Shadow DOM stylesheet */ | ||
export type ConfigOptions<State, AppState = {}> = Component.ConfigOptions<State, AppState>; | ||
export type ConfigOptions<State, AppState = {}, Attrs = AnyAttrs> = Component.ConfigOptions<State, AppState, Attrs>; | ||
@@ -172,3 +172,3 @@ export class Component<State, AppState = {}, App = unknown, Attrs = AnyAttrs> extends WebComponent { | ||
/** Defines standard component configuration */ | ||
config: ConfigOptions<State, AppState>; | ||
config: ConfigOptions<State, AppState, Attrs>; | ||
@@ -175,0 +175,0 @@ /** |
{ | ||
"name": "panel", | ||
"version": "2.1.1", | ||
"version": "2.1.2", | ||
"description": "Web Components with Virtual DOM: lightweight composable web apps", | ||
@@ -74,2 +74,3 @@ "main": "build/index.js", | ||
"readline-sync": "1.4.7", | ||
"tslint": "5.18.0", | ||
"typescript": "3.2.2", | ||
@@ -76,0 +77,0 @@ "wct-browser-legacy": "1.0.2", |
133366
25