Skip to content

Commit e4456ec

Browse files
committed
main - 5242169 refactor(multiple): remove focus indicators structural styles from core (#29804)
1 parent 7a6ee7a commit e4456ec

40 files changed

+92
-41
lines changed

core/_core.scss

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,10 @@
22
@use './tokens/m2/mat/app' as tokens-mat-app;
33
@use './tokens/token-utils';
44
@use './style/elevation';
5-
@use './focus-indicators/private';
65

76
// Mixin that renders all of the core styles that are not theme-dependent.
87
@mixin core() {
98
@include cdk.a11y-visually-hidden();
10-
@include private.structural-styling();
119
}
1210

1311
// Emits the mat-app-background CSS class. This predefined class sets the

core/index.d.ts

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1090,6 +1090,15 @@ export declare class ShowOnDirtyErrorStateMatcher implements ErrorStateMatcher {
10901090
static ɵprov: i0.ɵɵInjectableDeclaration<ShowOnDirtyErrorStateMatcher>;
10911091
}
10921092

1093+
/**
1094+
* Component used to load structural styles for focus indicators.
1095+
* @docs-private
1096+
*/
1097+
export declare class _StructuralStylesLoader {
1098+
static ɵfac: i0.ɵɵFactoryDeclaration<_StructuralStylesLoader, never>;
1099+
static ɵcmp: i0.ɵɵComponentDeclaration<_StructuralStylesLoader, "structural-styles", never, {}, {}, never, never, true, never>;
1100+
}
1101+
10931102

10941103
/** Possible color palette values. */
10951104
export declare type ThemePalette = 'primary' | 'accent' | 'warn' | undefined;

fesm2022/button-toggle.mjs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,8 @@ import * as i0 from '@angular/core';
55
import { InjectionToken, forwardRef, inject, ChangeDetectorRef, EventEmitter, booleanAttribute, Directive, ContentChildren, Input, Output, ElementRef, HostAttributeToken, Component, ViewEncapsulation, ChangeDetectionStrategy, ViewChild, NgModule } from '@angular/core';
66
import { Directionality } from '@angular/cdk/bidi';
77
import { NG_VALUE_ACCESSOR } from '@angular/forms';
8-
import { MatRipple, MatPseudoCheckbox, MatCommonModule, MatRippleModule } from '@angular/material/core';
8+
import { _StructuralStylesLoader, MatRipple, MatPseudoCheckbox, MatCommonModule, MatRippleModule } from '@angular/material/core';
9+
import { _CdkPrivateStyleLoader } from '@angular/cdk/private';
910

1011
/**
1112
* Injection token that can be used to configure the
@@ -481,6 +482,7 @@ class MatButtonToggle {
481482
this._disabled = false;
482483
/** Event emitted when the group value changes. */
483484
this.change = new EventEmitter();
485+
inject(_CdkPrivateStyleLoader).load(_StructuralStylesLoader);
484486
const toggleGroup = inject(MAT_BUTTON_TOGGLE_GROUP, { optional: true });
485487
const defaultTabIndex = inject(new HostAttributeToken('tabindex'), { optional: true });
486488
const defaultOptions = inject(MAT_BUTTON_TOGGLE_DEFAULT_OPTIONS, { optional: true });

fesm2022/button-toggle.mjs.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

fesm2022/button.mjs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,8 @@ import * as i0 from '@angular/core';
22
import { InjectionToken, inject, ElementRef, NgZone, ANIMATION_MODULE_TYPE, booleanAttribute, Directive, Input, numberAttribute, Component, ViewEncapsulation, ChangeDetectionStrategy, NgModule } from '@angular/core';
33
import { FocusMonitor } from '@angular/cdk/a11y';
44
import { Platform } from '@angular/cdk/platform';
5-
import { MatRippleLoader, MatCommonModule, MatRippleModule } from '@angular/material/core';
5+
import { MatRippleLoader, _StructuralStylesLoader, MatCommonModule, MatRippleModule } from '@angular/material/core';
6+
import { _CdkPrivateStyleLoader } from '@angular/cdk/private';
67

78
/** Injection token that can be used to provide the default options the button component. */
89
const MAT_BUTTON_CONFIG = new InjectionToken('MAT_BUTTON_CONFIG');
@@ -86,6 +87,7 @@ class MatButtonBase {
8687
this._isFab = false;
8788
this._disableRipple = false;
8889
this._disabled = false;
90+
inject(_CdkPrivateStyleLoader).load(_StructuralStylesLoader);
8991
const config = inject(MAT_BUTTON_CONFIG, { optional: true });
9092
const element = this._elementRef.nativeElement;
9193
const classList = element.classList;

fesm2022/button.mjs.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

fesm2022/checkbox.mjs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
import * as i0 from '@angular/core';
22
import { InjectionToken, forwardRef, inject, ElementRef, ChangeDetectorRef, NgZone, ANIMATION_MODULE_TYPE, EventEmitter, HostAttributeToken, booleanAttribute, numberAttribute, Component, ViewEncapsulation, ChangeDetectionStrategy, Input, Output, ViewChild, Directive, NgModule } from '@angular/core';
33
import { NG_VALUE_ACCESSOR, NG_VALIDATORS, CheckboxRequiredValidator } from '@angular/forms';
4-
import { MatRipple, _MatInternalFormField, MatCommonModule } from '@angular/material/core';
4+
import { _StructuralStylesLoader, MatRipple, _MatInternalFormField, MatCommonModule } from '@angular/material/core';
5+
import { _CdkPrivateStyleLoader } from '@angular/cdk/private';
56

67
/** Injection token to be used to override the default options for `mat-checkbox`. */
78
const MAT_CHECKBOX_DEFAULT_OPTIONS = new InjectionToken('mat-checkbox-default-options', {
@@ -114,6 +115,7 @@ class MatCheckbox {
114115
this._checked = false;
115116
this._disabled = false;
116117
this._indeterminate = false;
118+
inject(_CdkPrivateStyleLoader).load(_StructuralStylesLoader);
117119
const tabIndex = inject(new HostAttributeToken('tabindex'), { optional: true });
118120
this._options = this._options || defaults;
119121
this.color = this._options.color || defaults.color;

fesm2022/checkbox.mjs.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

fesm2022/chips.mjs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,9 @@ import { ENTER, SPACE, BACKSPACE, DELETE, TAB, hasModifierKey, UP_ARROW, DOWN_AR
33
import { DOCUMENT } from '@angular/common';
44
import * as i0 from '@angular/core';
55
import { InjectionToken, inject, ElementRef, booleanAttribute, numberAttribute, Directive, Input, ChangeDetectorRef, NgZone, EventEmitter, Injector, ANIMATION_MODULE_TYPE, afterNextRender, Component, ViewEncapsulation, ChangeDetectionStrategy, ContentChildren, Output, ContentChild, ViewChild, QueryList, forwardRef, NgModule } from '@angular/core';
6-
import { MAT_RIPPLE_GLOBAL_OPTIONS, MatRippleLoader, ErrorStateMatcher, _ErrorStateTracker, MatCommonModule, MatRippleModule } from '@angular/material/core';
6+
import { _StructuralStylesLoader, MAT_RIPPLE_GLOBAL_OPTIONS, MatRippleLoader, ErrorStateMatcher, _ErrorStateTracker, MatCommonModule, MatRippleModule } from '@angular/material/core';
77
import { Subject, merge } from 'rxjs';
8+
import { _CdkPrivateStyleLoader } from '@angular/cdk/private';
89
import { takeUntil, startWith, switchMap } from 'rxjs/operators';
910
import { Directionality } from '@angular/cdk/bidi';
1011
import { NG_VALUE_ACCESSOR, Validators, NgControl, NgForm, FormGroupDirective } from '@angular/forms';
@@ -82,6 +83,7 @@ class MatChipAction {
8283
* Private API to allow focusing this chip when it is disabled.
8384
*/
8485
this._allowFocusWhenDisabled = false;
86+
inject(_CdkPrivateStyleLoader).load(_StructuralStylesLoader);
8587
if (this._elementRef.nativeElement.nodeName === 'BUTTON') {
8688
this._elementRef.nativeElement.setAttribute('type', 'button');
8789
}
@@ -317,6 +319,7 @@ class MatChip {
317319
*/
318320
this._rippleLoader = inject(MatRippleLoader);
319321
this._injector = inject(Injector);
322+
inject(_CdkPrivateStyleLoader).load(_StructuralStylesLoader);
320323
const animationMode = inject(ANIMATION_MODULE_TYPE, { optional: true });
321324
this._animationsDisabled = animationMode === 'NoopAnimations';
322325
this._monitorFocus();

fesm2022/chips.mjs.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)