@@ -3,15 +3,11 @@ import {customElement, property} from 'lit/decorators.js';
33
44@customElement ( 'my-element' )
55class MyElement extends LitElement {
6- @property ( { type : Boolean , reflect : true } )
7- active : boolean = false ;
8-
9- @property ( { type : String , reflect : true , useDefault : true } as PropertyDeclaration )
10- variant = 'normal' ;
11-
6+ /* playground-fold */
127 static styles = css `
138 :host {
14- display: inline-block; padding: 4px;
9+ display: inline-block;
10+ padding: 4px;
1511 }
1612 :host([active]) {
1713 font-weight: 800;
@@ -22,17 +18,25 @@ class MyElement extends LitElement {
2218 :host([variant="special"]) {
2319 border-radius: 8px; border: 4px solid red;
2420 }` ;
21+ /* playground-fold-end */
22+ @property ( { type : Boolean , reflect : true } )
23+ active : boolean = false ;
24+
25+ @property ( { reflect : true , useDefault : true } as PropertyDeclaration )
26+ variant = 'normal' ;
2527
2628 render ( ) {
2729 return html `
2830 < div > < label > active: < input type ="checkbox "
2931 .value ="${ this . active } "
30- @change ="${ ( e : Event ) => this . active = ( e . target ! as HTMLInputElement ) . checked } ">
32+ @change ="${ ( e : { target : HTMLInputElement } ) =>
33+ this . active = e . target . checked } ">
3134 ${ this . active }
3235 </ label > </ div >
3336 < div > < label > variant: < input type ="checkbox "
3437 .value ="${ this . variant === 'special' } "
35- @change ="${ ( e : Event ) => this . variant = ( e . target ! as HTMLInputElement ) . checked ? 'special' : 'normal' } ">
38+ @change ="${ ( e : { target : HTMLInputElement } ) =>
39+ this . variant = e . target . checked ? 'special' : 'normal' } ">
3640 ${ this . variant }
3741 </ label > </ div >
3842 ` ;
0 commit comments