@@ -11,21 +11,10 @@ function loadPlaygroundState() {
1111 reflectPlaygroundState ( playgroundState ) ;
1212 } catch {
1313 const initialPlaygroundState = {
14- minify : true ,
15- targets : {
16- chrome : 95 << 16 ,
17- } ,
18- source : `.foo {
19- background: yellow;
20-
21- -webkit-border-radius: 2px;
22- -moz-border-radius: 2px;
23- border-radius: 2px;
24-
25- -webkit-transition: background 200ms;
26- -moz-transition: background 200ms;
27- transition: background 200ms;
28- }` ,
14+ minify : minify . checked ,
15+ nesting : nesting . checked ,
16+ targets : getTargets ( ) ,
17+ source : source . value ,
2918 } ;
3019
3120 reflectPlaygroundState ( initialPlaygroundState ) ;
@@ -37,17 +26,15 @@ function reflectPlaygroundState(playgroundState) {
3726 minify . checked = playgroundState . minify ;
3827 }
3928
29+ if ( typeof playgroundState . nesting !== 'undefined' ) {
30+ nesting . checked = playgroundState . nesting ;
31+ }
32+
4033 if ( playgroundState . targets ) {
4134 const { targets} = playgroundState ;
42- for ( const target in targets ) {
43- const value = targets [ target ] ;
44- if ( value ) {
45- for ( const input of Array . from ( inputs ) ) {
46- if ( input . id === target ) {
47- input . value = value >> 16 ;
48- }
49- }
50- }
35+ for ( let input of inputs ) {
36+ let value = targets [ input . id ] ;
37+ input . value = value == null ? '' : value >> 16 ;
5138 }
5239 }
5340
@@ -59,6 +46,7 @@ function reflectPlaygroundState(playgroundState) {
5946function savePlaygroundState ( ) {
6047 const playgroundState = {
6148 minify : minify . checked ,
49+ nesting : nesting . checked ,
6250 targets : getTargets ( ) ,
6351 source : source . value ,
6452 } ;
@@ -98,6 +86,9 @@ async function update() {
9886 code : enc . encode ( source . value ) ,
9987 minify : minify . checked ,
10088 targets : Object . keys ( targets ) . length === 0 ? null : targets ,
89+ drafts : {
90+ nesting : nesting . checked
91+ }
10192 } ) ;
10293
10394 compiled . value = dec . decode ( res . code ) ;
0 commit comments