@@ -10,21 +10,19 @@ import * as i3 from '@angular/material/core';
1010
1111/** @title Monitoring focus with FocusMonitor */
1212class FocusMonitorDirectivesExample {
13- constructor ( ) {
14- this . _ngZone = inject ( NgZone ) ;
15- this . _cdr = inject ( ChangeDetectorRef ) ;
16- this . elementOrigin = this . formatOrigin ( null ) ;
17- this . subtreeOrigin = this . formatOrigin ( null ) ;
18- }
13+ _ngZone = inject ( NgZone ) ;
14+ _cdr = inject ( ChangeDetectorRef ) ;
15+ elementOrigin = this . formatOrigin ( null ) ;
16+ subtreeOrigin = this . formatOrigin ( null ) ;
1917 formatOrigin ( origin ) {
2018 return origin ? origin + ' focused' : 'blurred' ;
2119 }
2220 // Workaround for the fact that (cdkFocusChange) emits outside NgZone.
2321 markForCheck ( ) {
2422 this . _ngZone . run ( ( ) => this . _cdr . markForCheck ( ) ) ;
2523 }
26- static { this . ɵfac = i0 . ɵɵngDeclareFactory ( { minVersion : "12.0.0" , version : "19.0.0-next.10" , ngImport : i0 , type : FocusMonitorDirectivesExample , deps : [ ] , target : i0 . ɵɵFactoryTarget . Component } ) ; }
27- static { this . ɵcmp = i0 . ɵɵngDeclareComponent ( { minVersion : "14.0.0" , version : "19.0.0-next.10" , type : FocusMonitorDirectivesExample , isStandalone : true , selector : "focus-monitor-directives-example" , ngImport : i0 , template : "<div class=\"example-focus-monitor\">\n <button cdkMonitorSubtreeFocus\n (cdkFocusChange)=\"elementOrigin = formatOrigin($event); markForCheck()\">\n Focus Monitored Element ({{elementOrigin}})\n </button>\n</div>\n\n<div class=\"example-focus-monitor\">\n <div cdkMonitorSubtreeFocus\n (cdkFocusChange)=\"subtreeOrigin = formatOrigin($event); markForCheck()\">\n <p>Focus Monitored Subtree ({{subtreeOrigin}})</p>\n <button>Child Button 1</button>\n <button>Child Button 2</button>\n </div>\n</div>\n" , styles : [ ".example-focus-monitor {\n padding: 20px;\n}\n\n.example-focus-monitor .cdk-mouse-focused {\n background: rgba(255, 0, 0, 0.5);\n}\n\n.example-focus-monitor .cdk-keyboard-focused {\n background: rgba(0, 255, 0, 0.5);\n}\n\n.example-focus-monitor .cdk-touch-focused {\n background: rgba(0, 0, 255, 0.5);\n}\n\n.example-focus-monitor .cdk-program-focused {\n background: rgba(255, 0, 255, 0.5);\n}\n\nbutton {\n margin-right: 12px;\n}\n" ] , dependencies : [ { kind : "ngmodule" , type : A11yModule } , { kind : "directive" , type : i1 . CdkMonitorFocus , selector : "[cdkMonitorElementFocus], [cdkMonitorSubtreeFocus]" , outputs : [ "cdkFocusChange" ] , exportAs : [ "cdkMonitorFocus" ] } ] } ) ; }
24+ static ɵfac = i0 . ɵɵngDeclareFactory ( { minVersion : "12.0.0" , version : "19.0.0-next.10" , ngImport : i0 , type : FocusMonitorDirectivesExample , deps : [ ] , target : i0 . ɵɵFactoryTarget . Component } ) ;
25+ static ɵcmp = i0 . ɵɵngDeclareComponent ( { minVersion : "14.0.0" , version : "19.0.0-next.10" , type : FocusMonitorDirectivesExample , isStandalone : true , selector : "focus-monitor-directives-example" , ngImport : i0 , template : "<div class=\"example-focus-monitor\">\n <button cdkMonitorSubtreeFocus\n (cdkFocusChange)=\"elementOrigin = formatOrigin($event); markForCheck()\">\n Focus Monitored Element ({{elementOrigin}})\n </button>\n</div>\n\n<div class=\"example-focus-monitor\">\n <div cdkMonitorSubtreeFocus\n (cdkFocusChange)=\"subtreeOrigin = formatOrigin($event); markForCheck()\">\n <p>Focus Monitored Subtree ({{subtreeOrigin}})</p>\n <button>Child Button 1</button>\n <button>Child Button 2</button>\n </div>\n</div>\n" , styles : [ ".example-focus-monitor {\n padding: 20px;\n}\n\n.example-focus-monitor .cdk-mouse-focused {\n background: rgba(255, 0, 0, 0.5);\n}\n\n.example-focus-monitor .cdk-keyboard-focused {\n background: rgba(0, 255, 0, 0.5);\n}\n\n.example-focus-monitor .cdk-touch-focused {\n background: rgba(0, 0, 255, 0.5);\n}\n\n.example-focus-monitor .cdk-program-focused {\n background: rgba(255, 0, 255, 0.5);\n}\n\nbutton {\n margin-right: 12px;\n}\n" ] , dependencies : [ { kind : "ngmodule" , type : A11yModule } , { kind : "directive" , type : i1 . CdkMonitorFocus , selector : "[cdkMonitorElementFocus], [cdkMonitorSubtreeFocus]" , outputs : [ "cdkFocusChange" ] , exportAs : [ "cdkMonitorFocus" ] } ] } ) ;
2826}
2927i0 . ɵɵngDeclareClassMetadata ( { minVersion : "12.0.0" , version : "19.0.0-next.10" , ngImport : i0 , type : FocusMonitorDirectivesExample , decorators : [ {
3028 type : Component ,
@@ -33,12 +31,11 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.0-next.10",
3331
3432/** @title Focusing with a specific FocusOrigin */
3533class FocusMonitorFocusViaExample {
36- constructor ( ) {
37- this . focusMonitor = inject ( FocusMonitor ) ;
38- this . _cdr = inject ( ChangeDetectorRef ) ;
39- this . _ngZone = inject ( NgZone ) ;
40- this . origin = this . formatOrigin ( null ) ;
41- }
34+ focusMonitor = inject ( FocusMonitor ) ;
35+ _cdr = inject ( ChangeDetectorRef ) ;
36+ _ngZone = inject ( NgZone ) ;
37+ monitoredEl ;
38+ origin = this . formatOrigin ( null ) ;
4239 ngAfterViewInit ( ) {
4340 this . focusMonitor . monitor ( this . monitoredEl ) . subscribe ( origin => this . _ngZone . run ( ( ) => {
4441 this . origin = this . formatOrigin ( origin ) ;
@@ -51,8 +48,8 @@ class FocusMonitorFocusViaExample {
5148 formatOrigin ( origin ) {
5249 return origin ? origin + ' focused' : 'blurred' ;
5350 }
54- static { this . ɵfac = i0 . ɵɵngDeclareFactory ( { minVersion : "12.0.0" , version : "19.0.0-next.10" , ngImport : i0 , type : FocusMonitorFocusViaExample , deps : [ ] , target : i0 . ɵɵFactoryTarget . Component } ) ; }
55- static { this . ɵcmp = i0 . ɵɵngDeclareComponent ( { minVersion : "14.0.0" , version : "19.0.0-next.10" , type : FocusMonitorFocusViaExample , isStandalone : true , selector : "focus-monitor-focus-via-example" , viewQueries : [ { propertyName : "monitoredEl" , first : true , predicate : [ "monitored" ] , descendants : true } ] , ngImport : i0 , template : "<div class=\"example-focus-monitor\">\n <button #monitored>1. Focus Monitored Element ({{origin}})</button>\n <button #unmonitored>2. Not Monitored</button>\n</div>\n\n<mat-form-field>\n <mat-label>Simulated focus origin</mat-label>\n <mat-select #simulatedOrigin value=\"mouse\">\n <mat-option value=\"mouse\">Mouse</mat-option>\n <mat-option value=\"keyboard\">Keyboard</mat-option>\n <mat-option value=\"touch\">Touch</mat-option>\n <mat-option value=\"program\">Programmatic</mat-option>\n </mat-select>\n</mat-form-field>\n\n<button (click)=\"focusMonitor.focusVia(monitored, simulatedOrigin.value)\">\n Focus button #1\n</button>\n<button (click)=\"focusMonitor.focusVia(unmonitored, simulatedOrigin.value)\">\n Focus button #2\n</button>\n" , styles : [ ".example-focus-monitor {\n padding: 20px;\n}\n\n.example-focus-monitor .cdk-mouse-focused {\n background: rgba(255, 0, 0, 0.5);\n}\n\n.example-focus-monitor .cdk-keyboard-focused {\n background: rgba(0, 255, 0, 0.5);\n}\n\n.example-focus-monitor .cdk-touch-focused {\n background: rgba(0, 0, 255, 0.5);\n}\n\n.example-focus-monitor .cdk-program-focused {\n background: rgba(255, 0, 255, 0.5);\n}\n\n.example-focus-monitor button:focus {\n box-shadow: 0 0 30px cyan;\n}\n\nmat-form-field,\nbutton {\n margin-right: 12px;\n}\n" ] , dependencies : [ { kind : "ngmodule" , type : MatFormFieldModule } , { kind : "component" , type : i1$1 . MatFormField , selector : "mat-form-field" , inputs : [ "hideRequiredMarker" , "color" , "floatLabel" , "appearance" , "subscriptSizing" , "hintLabel" ] , exportAs : [ "matFormField" ] } , { kind : "directive" , type : i1$1 . MatLabel , selector : "mat-label" } , { kind : "ngmodule" , type : MatSelectModule } , { kind : "component" , type : i2 . MatSelect , selector : "mat-select" , inputs : [ "aria-describedby" , "panelClass" , "disabled" , "disableRipple" , "tabIndex" , "hideSingleSelectionIndicator" , "placeholder" , "required" , "multiple" , "disableOptionCentering" , "compareWith" , "value" , "aria-label" , "aria-labelledby" , "errorStateMatcher" , "typeaheadDebounceInterval" , "sortComparator" , "id" , "panelWidth" ] , outputs : [ "openedChange" , "opened" , "closed" , "selectionChange" , "valueChange" ] , exportAs : [ "matSelect" ] } , { kind : "component" , type : i3 . MatOption , selector : "mat-option" , inputs : [ "value" , "id" , "disabled" ] , outputs : [ "onSelectionChange" ] , exportAs : [ "matOption" ] } ] } ) ; }
51+ static ɵfac = i0 . ɵɵngDeclareFactory ( { minVersion : "12.0.0" , version : "19.0.0-next.10" , ngImport : i0 , type : FocusMonitorFocusViaExample , deps : [ ] , target : i0 . ɵɵFactoryTarget . Component } ) ;
52+ static ɵcmp = i0 . ɵɵngDeclareComponent ( { minVersion : "14.0.0" , version : "19.0.0-next.10" , type : FocusMonitorFocusViaExample , isStandalone : true , selector : "focus-monitor-focus-via-example" , viewQueries : [ { propertyName : "monitoredEl" , first : true , predicate : [ "monitored" ] , descendants : true } ] , ngImport : i0 , template : "<div class=\"example-focus-monitor\">\n <button #monitored>1. Focus Monitored Element ({{origin}})</button>\n <button #unmonitored>2. Not Monitored</button>\n</div>\n\n<mat-form-field>\n <mat-label>Simulated focus origin</mat-label>\n <mat-select #simulatedOrigin value=\"mouse\">\n <mat-option value=\"mouse\">Mouse</mat-option>\n <mat-option value=\"keyboard\">Keyboard</mat-option>\n <mat-option value=\"touch\">Touch</mat-option>\n <mat-option value=\"program\">Programmatic</mat-option>\n </mat-select>\n</mat-form-field>\n\n<button (click)=\"focusMonitor.focusVia(monitored, simulatedOrigin.value)\">\n Focus button #1\n</button>\n<button (click)=\"focusMonitor.focusVia(unmonitored, simulatedOrigin.value)\">\n Focus button #2\n</button>\n" , styles : [ ".example-focus-monitor {\n padding: 20px;\n}\n\n.example-focus-monitor .cdk-mouse-focused {\n background: rgba(255, 0, 0, 0.5);\n}\n\n.example-focus-monitor .cdk-keyboard-focused {\n background: rgba(0, 255, 0, 0.5);\n}\n\n.example-focus-monitor .cdk-touch-focused {\n background: rgba(0, 0, 255, 0.5);\n}\n\n.example-focus-monitor .cdk-program-focused {\n background: rgba(255, 0, 255, 0.5);\n}\n\n.example-focus-monitor button:focus {\n box-shadow: 0 0 30px cyan;\n}\n\nmat-form-field,\nbutton {\n margin-right: 12px;\n}\n" ] , dependencies : [ { kind : "ngmodule" , type : MatFormFieldModule } , { kind : "component" , type : i1$1 . MatFormField , selector : "mat-form-field" , inputs : [ "hideRequiredMarker" , "color" , "floatLabel" , "appearance" , "subscriptSizing" , "hintLabel" ] , exportAs : [ "matFormField" ] } , { kind : "directive" , type : i1$1 . MatLabel , selector : "mat-label" } , { kind : "ngmodule" , type : MatSelectModule } , { kind : "component" , type : i2 . MatSelect , selector : "mat-select" , inputs : [ "aria-describedby" , "panelClass" , "disabled" , "disableRipple" , "tabIndex" , "hideSingleSelectionIndicator" , "placeholder" , "required" , "multiple" , "disableOptionCentering" , "compareWith" , "value" , "aria-label" , "aria-labelledby" , "errorStateMatcher" , "typeaheadDebounceInterval" , "sortComparator" , "id" , "panelWidth" ] , outputs : [ "openedChange" , "opened" , "closed" , "selectionChange" , "valueChange" ] , exportAs : [ "matSelect" ] } , { kind : "component" , type : i3 . MatOption , selector : "mat-option" , inputs : [ "value" , "id" , "disabled" ] , outputs : [ "onSelectionChange" ] , exportAs : [ "matOption" ] } ] } ) ;
5653}
5754i0 . ɵɵngDeclareClassMetadata ( { minVersion : "12.0.0" , version : "19.0.0-next.10" , ngImport : i0 , type : FocusMonitorFocusViaExample , decorators : [ {
5855 type : Component ,
@@ -64,13 +61,13 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.0-next.10",
6461
6562/** @title Monitoring focus with FocusMonitor */
6663class FocusMonitorOverviewExample {
67- constructor ( ) {
68- this . _focusMonitor = inject ( FocusMonitor ) ;
69- this . _cdr = inject ( ChangeDetectorRef ) ;
70- this . _ngZone = inject ( NgZone ) ;
71- this . elementOrigin = this . formatOrigin ( null ) ;
72- this . subtreeOrigin = this . formatOrigin ( null ) ;
73- }
64+ _focusMonitor = inject ( FocusMonitor ) ;
65+ _cdr = inject ( ChangeDetectorRef ) ;
66+ _ngZone = inject ( NgZone ) ;
67+ element ;
68+ subtree ;
69+ elementOrigin = this . formatOrigin ( null ) ;
70+ subtreeOrigin = this . formatOrigin ( null ) ;
7471 ngAfterViewInit ( ) {
7572 this . _focusMonitor . monitor ( this . element ) . subscribe ( origin => this . _ngZone . run ( ( ) => {
7673 this . elementOrigin = this . formatOrigin ( origin ) ;
@@ -88,8 +85,8 @@ class FocusMonitorOverviewExample {
8885 formatOrigin ( origin ) {
8986 return origin ? origin + ' focused' : 'blurred' ;
9087 }
91- static { this . ɵfac = i0 . ɵɵngDeclareFactory ( { minVersion : "12.0.0" , version : "19.0.0-next.10" , ngImport : i0 , type : FocusMonitorOverviewExample , deps : [ ] , target : i0 . ɵɵFactoryTarget . Component } ) ; }
92- static { this . ɵcmp = i0 . ɵɵngDeclareComponent ( { minVersion : "14.0.0" , version : "19.0.0-next.10" , type : FocusMonitorOverviewExample , isStandalone : true , selector : "focus-monitor-overview-example" , viewQueries : [ { propertyName : "element" , first : true , predicate : [ "element" ] , descendants : true } , { propertyName : "subtree" , first : true , predicate : [ "subtree" ] , descendants : true } ] , ngImport : i0 , template : "<div class=\"example-focus-monitor\">\n <button #element>Focus Monitored Element ({{elementOrigin}})</button>\n</div>\n\n<div class=\"example-focus-monitor\">\n <div #subtree>\n <p>Focus Monitored Subtree ({{subtreeOrigin}})</p>\n <button>Child Button 1</button>\n <button>Child Button 2</button>\n </div>\n</div>\n" , styles : [ ".example-focus-monitor {\n padding: 20px;\n}\n\n.example-focus-monitor .cdk-mouse-focused {\n background: rgba(255, 0, 0, 0.5);\n}\n\n.example-focus-monitor .cdk-keyboard-focused {\n background: rgba(0, 255, 0, 0.5);\n}\n\n.example-focus-monitor .cdk-touch-focused {\n background: rgba(0, 0, 255, 0.5);\n}\n\n.example-focus-monitor .cdk-program-focused {\n background: rgba(255, 0, 255, 0.5);\n}\n\nbutton {\n margin-right: 12px;\n}\n" ] } ) ; }
88+ static ɵfac = i0 . ɵɵngDeclareFactory ( { minVersion : "12.0.0" , version : "19.0.0-next.10" , ngImport : i0 , type : FocusMonitorOverviewExample , deps : [ ] , target : i0 . ɵɵFactoryTarget . Component } ) ;
89+ static ɵcmp = i0 . ɵɵngDeclareComponent ( { minVersion : "14.0.0" , version : "19.0.0-next.10" , type : FocusMonitorOverviewExample , isStandalone : true , selector : "focus-monitor-overview-example" , viewQueries : [ { propertyName : "element" , first : true , predicate : [ "element" ] , descendants : true } , { propertyName : "subtree" , first : true , predicate : [ "subtree" ] , descendants : true } ] , ngImport : i0 , template : "<div class=\"example-focus-monitor\">\n <button #element>Focus Monitored Element ({{elementOrigin}})</button>\n</div>\n\n<div class=\"example-focus-monitor\">\n <div #subtree>\n <p>Focus Monitored Subtree ({{subtreeOrigin}})</p>\n <button>Child Button 1</button>\n <button>Child Button 2</button>\n </div>\n</div>\n" , styles : [ ".example-focus-monitor {\n padding: 20px;\n}\n\n.example-focus-monitor .cdk-mouse-focused {\n background: rgba(255, 0, 0, 0.5);\n}\n\n.example-focus-monitor .cdk-keyboard-focused {\n background: rgba(0, 255, 0, 0.5);\n}\n\n.example-focus-monitor .cdk-touch-focused {\n background: rgba(0, 0, 255, 0.5);\n}\n\n.example-focus-monitor .cdk-program-focused {\n background: rgba(255, 0, 255, 0.5);\n}\n\nbutton {\n margin-right: 12px;\n}\n" ] } ) ;
9390}
9491i0 . ɵɵngDeclareClassMetadata ( { minVersion : "12.0.0" , version : "19.0.0-next.10" , ngImport : i0 , type : FocusMonitorOverviewExample , decorators : [ {
9592 type : Component ,
0 commit comments