@@ -37,7 +37,7 @@ const appliedStylesTemplate = (
3737 <p class="title">Styles</p>
3838 <div class="swatch-stack">
3939 ${ repeat (
40- ( x ) => x . appliedStyleModules . get ( group ) ,
40+ ( x ) => x . appliedStyleModules . get ( group ) ! ,
4141 html < StyleModuleDisplay , App > `
4242 <div class="style-module applied">
4343 <span class="content">
@@ -71,7 +71,7 @@ const availableStylesTemplate = (
7171 <p class="title">Styles</p>
7272 <div class="swatch-stack">
7373 ${ repeat (
74- ( x ) => x . controller . styles . getAvailableStyleModules ( ) . get ( group ) ,
74+ ( x ) => x . controller . styles . getAvailableStyleModules ( ) . get ( group ) ! ,
7575 html < StyleModuleDisplay , App > `
7676 <div class="style-module available">
7777 <span
@@ -108,7 +108,7 @@ const appliedTokensTemplate = (
108108 ) }
109109 <div class="swatch-stack">
110110 ${ repeat (
111- ( _ ) => tokens ,
111+ ( _ ) => tokens ! ,
112112 html < AppliedDesignTokenItem , App > `
113113 <designer-style-token-item
114114 title=${ ( x , c ) => c . parent . controller . styles . getAppliableDesignTokenDefinition ( x . tokenID ) ?. title }
@@ -153,7 +153,7 @@ const availableTokensTemplate = (
153153 value=${ ( x , c ) => c . parent . controller . designTokens . getDefaultDesignTokenValueAsString ( x . token ) }
154154 glyphType=${ ( _ ) => glyphType }
155155 content-button
156- @click=${ ( x , c ) => c . parent . controller . styles . applyDesignToken ( x . intendedFor , x ) }
156+ @click=${ ( x , c ) => c . parent . controller . styles . applyDesignToken ( x . intendedFor || [ ] , x ) }
157157 >
158158 </designer-style-token-item>
159159 `
@@ -570,55 +570,55 @@ export class App extends FASTElement {
570570 public readonly controller : UIController ;
571571
572572 @observable
573- public supportsStyling : boolean ;
573+ public supportsStyling : boolean = false ;
574574
575575 @observable
576- public supportsColor : boolean ;
576+ public supportsColor : boolean = false ;
577577
578578 @observable
579- public supportsBorderThickness : boolean ;
579+ public supportsBorderThickness : boolean = false ;
580580
581581 @observable
582- public supportsDensity : boolean ;
582+ public supportsDensity : boolean = false ;
583583
584584 @observable
585- public supportsCornerRadius : boolean ;
585+ public supportsCornerRadius : boolean = false ;
586586
587587 @observable
588- public supportsText : boolean ;
588+ public supportsText : boolean = false ;
589589
590590 @observable
591- public supportsShadow : boolean ;
591+ public supportsShadow : boolean = false ;
592592
593593 @observable
594- public layerTokens : AppliedDesignTokenItem [ ] | null ;
594+ public layerTokens : AppliedDesignTokenItem [ ] | null = null ;
595595
596596 @observable
597- public backgroundTokens : AppliedDesignTokenItem [ ] | null ;
597+ public backgroundTokens : AppliedDesignTokenItem [ ] | null = null ;
598598
599599 @observable
600- public foregroundTokens : AppliedDesignTokenItem [ ] | null ;
600+ public foregroundTokens : AppliedDesignTokenItem [ ] | null = null ;
601601
602602 @observable
603- public borderFillTokens : AppliedDesignTokenItem [ ] | null ;
603+ public borderFillTokens : AppliedDesignTokenItem [ ] | null = null ;
604604
605605 @observable
606- public borderThicknessTokens : AppliedDesignTokenItem [ ] | null ;
606+ public borderThicknessTokens : AppliedDesignTokenItem [ ] | null = null ;
607607
608608 @observable
609- public densityTokens : AppliedDesignTokenItem [ ] | null ;
609+ public densityTokens : AppliedDesignTokenItem [ ] | null = null ;
610610
611611 @observable
612- public cornerRadiusTokens : AppliedDesignTokenItem [ ] | null ;
612+ public cornerRadiusTokens : AppliedDesignTokenItem [ ] | null = null ;
613613
614614 @observable
615- public textTokens : AppliedDesignTokenItem [ ] | null ;
615+ public textTokens : AppliedDesignTokenItem [ ] | null = null ;
616616
617617 @observable
618- public shadowTokens : AppliedDesignTokenItem [ ] | null ;
618+ public shadowTokens : AppliedDesignTokenItem [ ] | null = null ;
619619
620620 @observable
621- public supportsDesignSystem : boolean ;
621+ public supportsDesignSystem : boolean = false ;
622622
623623 @observable
624624 public appliedStyleModules : StyleModuleDisplayList = new Map ( ) ;
@@ -627,39 +627,41 @@ export class App extends FASTElement {
627627 public statesState : StatesState | "unknown" = "unknown" ;
628628
629629 @observable
630- public selectionDescription : string ;
630+ public selectionDescription : string = "No selection" ;
631631
632632 @observable
633- public selectedNodes : PluginUINodeData [ ] | null ;
633+ public selectedNodes : PluginUINodeData [ ] | null = null ;
634634 protected selectedNodesChanged ( prev : PluginUINodeData [ ] | null , next : PluginUINodeData [ ] | null ) {
635- this . controller . selectedNodes = next ;
636-
637- this . selectionDescription = this . selectedNodes ?. map ( ( node ) => `${ node . type } ` ) . join ( " | " ) || "No selection" ;
638-
639- this . supportsColor =
640- this . selectedNodes ?. some (
641- ( node ) =>
642- node . supports . includes ( StyleProperty . backgroundFill ) ||
643- node . supports . includes ( StyleProperty . foregroundFill ) ||
644- node . supports . includes ( StyleProperty . borderFillTop )
645- ) || false ;
646- this . supportsBorderThickness = this . controller . supports ( StyleProperty . borderThicknessTop ) ;
647- this . supportsDensity = this . controller . supports ( StyleProperty . gap ) ;
648- this . supportsCornerRadius = this . controller . supports ( StyleProperty . cornerRadiusTopLeft ) ;
649- this . supportsText = this . controller . supports ( StyleProperty . fontFamily ) ;
650- this . supportsShadow = this . controller . supports ( StyleProperty . shadow ) ;
651-
652- this . supportsStyling =
653- this . supportsColor ||
654- this . supportsBorderThickness ||
655- this . supportsDensity ||
656- this . supportsCornerRadius ||
657- this . supportsText ||
658- this . supportsShadow ;
659-
660- this . supportsDesignSystem = true ;
661-
662- this . refreshObservables ( ) ;
635+ if ( this . controller ) {
636+ this . controller . selectedNodes = next || [ ] ;
637+
638+ this . selectionDescription = this . selectedNodes ?. map ( ( node ) => `${ node . type } ` ) . join ( " | " ) || "No selection" ;
639+
640+ this . supportsColor =
641+ this . selectedNodes ?. some (
642+ ( node ) =>
643+ node . supports . includes ( StyleProperty . backgroundFill ) ||
644+ node . supports . includes ( StyleProperty . foregroundFill ) ||
645+ node . supports . includes ( StyleProperty . borderFillTop )
646+ ) || false ;
647+ this . supportsBorderThickness = this . controller . supports ( StyleProperty . borderThicknessTop ) ;
648+ this . supportsDensity = this . controller . supports ( StyleProperty . gap ) ;
649+ this . supportsCornerRadius = this . controller . supports ( StyleProperty . cornerRadiusTopLeft ) ;
650+ this . supportsText = this . controller . supports ( StyleProperty . fontFamily ) ;
651+ this . supportsShadow = this . controller . supports ( StyleProperty . shadow ) ;
652+
653+ this . supportsStyling =
654+ this . supportsColor ||
655+ this . supportsBorderThickness ||
656+ this . supportsDensity ||
657+ this . supportsCornerRadius ||
658+ this . supportsText ||
659+ this . supportsShadow ;
660+
661+ this . supportsDesignSystem = true ;
662+
663+ this . refreshObservables ( ) ;
664+ }
663665 }
664666
665667 constructor ( ) {
0 commit comments