11
22import { render } from "lit"
3- import { Constructor , debounce , MapG } from "@e280/stz"
3+ import { debounce , MapG } from "@e280/stz"
44import { directive } from "lit/directive.js"
55import { tracker } from "@e280/strata/tracker"
66import { AsyncDirective } from "lit/async-directive.js"
@@ -10,7 +10,7 @@ import {applyAttrs} from "./utils/apply-attrs.js"
1010import { AttrWatcher } from "./utils/attr-watcher.js"
1111import { applyStyles } from "./utils/apply-styles.js"
1212import { Use , _wrap , _disconnect , _reconnect } from "./use.js"
13- import { AttrValue , Content , View , ViewFn , ViewSettings , ViewContext , ViewComponent , Elmix } from "./types.js"
13+ import { AttrValue , Content , View , ViewFn , ViewSettings , ViewContext , ViewComponent , ViewComponentClass } from "./types.js"
1414
1515export const view = setupView ( { mode : "open" } )
1616export class SlyView extends HTMLElement { }
@@ -135,8 +135,9 @@ function setupView(settings: ViewSettings) {
135135 return chain
136136 }
137137
138- rendy . component = < El extends Partial < ViewComponent > > ( fn : ( el : El ) => Props ) => {
138+ rendy . component = < Mix extends { } = { } > ( fn : ( el : Mix ) => Props ) => {
139139 return class VComponent extends HTMLElement implements ViewComponent {
140+ static view = rendy
140141 #context = freshViewContext ( )
141142 #directive = directive (
142143 make ( {
@@ -159,17 +160,17 @@ function setupView(settings: ViewSettings) {
159160 render ( this . #directive( this . #context, props ) , this )
160161 }
161162 }
162- } as any as ( Constructor < El > & typeof HTMLElement )
163+ } as any as ViewComponentClass < Mix , Props >
163164 }
164165
165166 return rendy
166167 }
167168
168169 view . declare = view
169170 view . settings = ( settings2 : Partial < ViewSettings > ) => setupView ( { ...settings , ...settings2 } )
170- view . component = < Mix extends Partial < ViewComponent > > ( ) => ( {
171- props : < Props extends any [ ] > ( elfn : ( el : Elmix < Mix > ) => Props ) => ( {
172- declare : ( fn : ViewFn < Props > ) => view ( fn ) . component ( elfn )
171+ view . component = < Mix extends { } > ( ) => ( {
172+ props : < Props extends any [ ] > ( elfn : ( el : ViewComponent < Mix > ) => Props ) => ( {
173+ declare : ( fn : ViewFn < Props > ) => view ( fn ) . component ( elfn ) ,
173174 } ) ,
174175 } )
175176 return view
0 commit comments