Skip to content

Commit dd5abe3

Browse files
committed
fix(material/icon): remove deprecated factory functions
Removes factory functions that we had marked as deprecated for v21. These functions aren't necessary since we switched to standalone. BREAKING CHANGE: * `ICON_REGISTRY_PROVIDER` has been removed. * `ICON_REGISTRY_PROVIDER_FACTORY` has been removed. * `MAT_ICON_LOCATION_FACTORY` has been removed.
1 parent 89ff55f commit dd5abe3

File tree

3 files changed

+10
-66
lines changed

3 files changed

+10
-66
lines changed

goldens/material/icon/index.api.md

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@ import { InjectionToken } from '@angular/core';
1515
import { Observable } from 'rxjs';
1616
import { OnDestroy } from '@angular/core';
1717
import { OnInit } from '@angular/core';
18-
import { Optional } from '@angular/core';
1918
import { SafeHtml } from '@angular/platform-browser';
2019
import { SafeResourceUrl } from '@angular/platform-browser';
2120

@@ -31,16 +30,6 @@ export function getMatIconNameNotFoundError(iconName: string): Error;
3130
// @public
3231
export function getMatIconNoHttpProviderError(): Error;
3332

34-
// @public @deprecated
35-
export const ICON_REGISTRY_PROVIDER: {
36-
provide: typeof MatIconRegistry;
37-
deps: (Optional[] | typeof DomSanitizer | typeof ErrorHandler)[];
38-
useFactory: typeof ICON_REGISTRY_PROVIDER_FACTORY;
39-
};
40-
41-
// @public @deprecated
42-
export function ICON_REGISTRY_PROVIDER_FACTORY(parentRegistry: MatIconRegistry, httpClient: HttpClient, sanitizer: DomSanitizer, errorHandler: ErrorHandler, document?: any): MatIconRegistry;
43-
4433
// @public
4534
export interface IconOptions {
4635
viewBox?: string;
@@ -56,9 +45,6 @@ export const MAT_ICON_DEFAULT_OPTIONS: InjectionToken<MatIconDefaultOptions>;
5645
// @public
5746
export const MAT_ICON_LOCATION: InjectionToken<MatIconLocation>;
5847

59-
// @public @deprecated
60-
export function MAT_ICON_LOCATION_FACTORY(): MatIconLocation;
61-
6248
// @public
6349
export class MatIcon implements OnInit, AfterViewChecked, OnDestroy {
6450
constructor(...args: unknown[]);

src/material/icon/icon-registry.ts

Lines changed: 0 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -11,11 +11,9 @@ import {
1111
ErrorHandler,
1212
Inject,
1313
Injectable,
14-
InjectionToken,
1514
OnDestroy,
1615
Optional,
1716
SecurityContext,
18-
SkipSelf,
1917
DOCUMENT,
2018
} from '@angular/core';
2119
import {DomSanitizer, SafeHtml, SafeResourceUrl} from '@angular/platform-browser';
@@ -728,39 +726,6 @@ export class MatIconRegistry implements OnDestroy {
728726
}
729727
}
730728

731-
/**
732-
* @docs-private
733-
* @deprecated No longer used, will be removed.
734-
* @breaking-change 21.0.0
735-
*/
736-
export function ICON_REGISTRY_PROVIDER_FACTORY(
737-
parentRegistry: MatIconRegistry,
738-
httpClient: HttpClient,
739-
sanitizer: DomSanitizer,
740-
errorHandler: ErrorHandler,
741-
document?: any,
742-
) {
743-
return parentRegistry || new MatIconRegistry(httpClient, sanitizer, document, errorHandler);
744-
}
745-
746-
/**
747-
* @docs-private
748-
* @deprecated No longer used, will be removed.
749-
* @breaking-change 21.0.0
750-
*/
751-
export const ICON_REGISTRY_PROVIDER = {
752-
// If there is already an MatIconRegistry available, use that. Otherwise, provide a new one.
753-
provide: MatIconRegistry,
754-
deps: [
755-
[new Optional(), new SkipSelf(), MatIconRegistry],
756-
[new Optional(), HttpClient],
757-
DomSanitizer,
758-
ErrorHandler,
759-
[new Optional(), DOCUMENT as InjectionToken<any>],
760-
],
761-
useFactory: ICON_REGISTRY_PROVIDER_FACTORY,
762-
};
763-
764729
/** Clones an SVGElement while preserving type information. */
765730
function cloneSvg(svg: SVGElement): SVGElement {
766731
return svg.cloneNode(true) as SVGElement;

src/material/icon/icon.ts

Lines changed: 10 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,16 @@ export const MAT_ICON_DEFAULT_OPTIONS = new InjectionToken<MatIconDefaultOptions
5454
*/
5555
export const MAT_ICON_LOCATION = new InjectionToken<MatIconLocation>('mat-icon-location', {
5656
providedIn: 'root',
57-
factory: MAT_ICON_LOCATION_FACTORY,
57+
factory: () => {
58+
const _document = inject(DOCUMENT);
59+
const _location = _document ? _document.location : null;
60+
61+
return {
62+
// Note that this needs to be a function, rather than a property, because Angular
63+
// will only resolve it once, but we want the current path on each call.
64+
getPathname: () => (_location ? _location.pathname + _location.search : ''),
65+
};
66+
},
5867
});
5968

6069
/**
@@ -65,22 +74,6 @@ export interface MatIconLocation {
6574
getPathname: () => string;
6675
}
6776

68-
/**
69-
* @docs-private
70-
* @deprecated No longer used, will be removed.
71-
* @breaking-change 21.0.0
72-
*/
73-
export function MAT_ICON_LOCATION_FACTORY(): MatIconLocation {
74-
const _document = inject(DOCUMENT);
75-
const _location = _document ? _document.location : null;
76-
77-
return {
78-
// Note that this needs to be a function, rather than a property, because Angular
79-
// will only resolve it once, but we want the current path on each call.
80-
getPathname: () => (_location ? _location.pathname + _location.search : ''),
81-
};
82-
}
83-
8477
/** SVG attributes that accept a FuncIRI (e.g. `url(<something>)`). */
8578
const funcIriAttributes = [
8679
'clip-path',

0 commit comments

Comments
 (0)