Skip to content

Commit 4d8f3aa

Browse files
committed
fix(multiple): deprecate exported factories (#30608)
There are a bunch of factory functions that made it into our public API as a result of an old ViewEngine limitation where the factories had to be separate variables and had to be exported. With Ivy this isn't necessary and the factories can be inlined. Also they were never meant to be public APIs. These changes mark them as deprecated so they can be dropped from the public API in v21. (cherry picked from commit 810495c)
1 parent 3de78fe commit 4d8f3aa

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

50 files changed

+258
-78
lines changed

src/cdk/a11y/key-manager/tree-key-manager.ts

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -411,7 +411,11 @@ export class TreeKeyManager<T extends TreeKeyManagerItem> implements TreeKeyMana
411411
}
412412
}
413413

414-
/** @docs-private */
414+
/**
415+
* @docs-private
416+
* @deprecated No longer used, will be removed.
417+
* @breaking-change 21.0.0
418+
*/
415419
export function TREE_KEY_MANAGER_FACTORY<T extends TreeKeyManagerItem>(): TreeKeyManagerFactory<T> {
416420
return (items, options) => new TreeKeyManager(items, options);
417421
}
@@ -422,7 +426,11 @@ export const TREE_KEY_MANAGER = new InjectionToken<TreeKeyManagerFactory<any>>('
422426
factory: TREE_KEY_MANAGER_FACTORY,
423427
});
424428

425-
/** @docs-private */
429+
/**
430+
* @docs-private
431+
* @deprecated No longer used, will be removed.
432+
* @breaking-change 21.0.0
433+
*/
426434
export const TREE_KEY_MANAGER_FACTORY_PROVIDER = {
427435
provide: TREE_KEY_MANAGER,
428436
useFactory: TREE_KEY_MANAGER_FACTORY,

src/cdk/a11y/live-announcer/live-announcer-tokens.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,11 @@ export const LIVE_ANNOUNCER_ELEMENT_TOKEN = new InjectionToken<HTMLElement | nul
2222
},
2323
);
2424

25-
/** @docs-private */
25+
/**
26+
* @docs-private
27+
* @deprecated No longer used, will be removed.
28+
* @breaking-change 21.0.0
29+
*/
2630
export function LIVE_ANNOUNCER_ELEMENT_TOKEN_FACTORY(): null {
2731
return null;
2832
}

src/cdk/bidi/dir-document-token.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,11 @@ export const DIR_DOCUMENT = new InjectionToken<Document>('cdk-dir-doc', {
2929
factory: DIR_DOCUMENT_FACTORY,
3030
});
3131

32-
/** @docs-private */
32+
/**
33+
* @docs-private
34+
* @deprecated No longer used, will be removed.
35+
* @breaking-change 21.0.0
36+
*/
3337
export function DIR_DOCUMENT_FACTORY(): Document {
3438
return inject(DOCUMENT);
3539
}

src/cdk/overlay/overlay-directives.ts

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -457,14 +457,22 @@ export class CdkConnectedOverlay implements OnDestroy, OnChanges {
457457
}
458458
}
459459

460-
/** @docs-private */
460+
/**
461+
* @docs-private
462+
* @deprecated No longer used, will be removed.
463+
* @breaking-change 21.0.0
464+
*/
461465
export function CDK_CONNECTED_OVERLAY_SCROLL_STRATEGY_PROVIDER_FACTORY(
462466
overlay: Overlay,
463467
): () => RepositionScrollStrategy {
464468
return () => overlay.scrollStrategies.reposition();
465469
}
466470

467-
/** @docs-private */
471+
/**
472+
* @docs-private
473+
* @deprecated No longer used, will be removed.
474+
* @breaking-change 21.0.0
475+
*/
468476
export const CDK_CONNECTED_OVERLAY_SCROLL_STRATEGY_PROVIDER = {
469477
provide: CDK_CONNECTED_OVERLAY_SCROLL_STRATEGY,
470478
deps: [Overlay],

src/material-luxon-adapter/adapter/luxon-date-adapter.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,11 @@ export const MAT_LUXON_DATE_ADAPTER_OPTIONS = new InjectionToken<MatLuxonDateAda
4545
},
4646
);
4747

48-
/** @docs-private */
48+
/**
49+
* @docs-private
50+
* @deprecated No longer used, will be removed.
51+
* @breaking-change 21.0.0
52+
*/
4953
export function MAT_LUXON_DATE_ADAPTER_OPTIONS_FACTORY(): MatLuxonDateAdapterOptions {
5054
return {
5155
useUtc: false,

src/material-moment-adapter/adapter/moment-date-adapter.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,11 @@ export const MAT_MOMENT_DATE_ADAPTER_OPTIONS = new InjectionToken<MatMomentDateA
4444
},
4545
);
4646

47-
/** @docs-private */
47+
/**
48+
* @docs-private
49+
* @deprecated No longer used, will be removed.
50+
* @breaking-change 21.0.0
51+
*/
4852
export function MAT_MOMENT_DATE_ADAPTER_OPTIONS_FACTORY(): MatMomentDateAdapterOptions {
4953
return {
5054
useUtc: false,

src/material/autocomplete/autocomplete-trigger.ts

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -93,12 +93,20 @@ export const MAT_AUTOCOMPLETE_SCROLL_STRATEGY = new InjectionToken<() => ScrollS
9393
},
9494
);
9595

96-
/** @docs-private */
96+
/**
97+
* @docs-private
98+
* @deprecated No longer used, will be removed.
99+
* @breaking-change 21.0.0
100+
*/
97101
export function MAT_AUTOCOMPLETE_SCROLL_STRATEGY_FACTORY(overlay: Overlay): () => ScrollStrategy {
98102
return () => overlay.scrollStrategies.reposition();
99103
}
100104

101-
/** @docs-private */
105+
/**
106+
* @docs-private
107+
* @deprecated No longer used, will be removed.
108+
* @breaking-change 21.0.0
109+
*/
102110
export const MAT_AUTOCOMPLETE_SCROLL_STRATEGY_FACTORY_PROVIDER = {
103111
provide: MAT_AUTOCOMPLETE_SCROLL_STRATEGY,
104112
deps: [Overlay],

src/material/autocomplete/autocomplete.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,11 @@ export const MAT_AUTOCOMPLETE_DEFAULT_OPTIONS = new InjectionToken<MatAutocomple
8686
},
8787
);
8888

89-
/** @docs-private */
89+
/**
90+
* @docs-private
91+
* @deprecated No longer used, will be removed.
92+
* @breaking-change 21.0.0
93+
*/
9094
export function MAT_AUTOCOMPLETE_DEFAULT_OPTIONS_FACTORY(): MatAutocompleteDefaultOptions {
9195
return {
9296
autoActiveFirstOption: false,

src/material/button-toggle/button-toggle.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,11 @@ export const MAT_BUTTON_TOGGLE_DEFAULT_OPTIONS = new InjectionToken<MatButtonTog
7777
},
7878
);
7979

80+
/**
81+
* @docs-private
82+
* @deprecated No longer used, will be removed.
83+
* @breaking-change 21.0.0
84+
*/
8085
export function MAT_BUTTON_TOGGLE_GROUP_DEFAULT_OPTIONS_FACTORY(): MatButtonToggleDefaultOptions {
8186
return {
8287
hideSingleSelectionIndicator: false,

src/material/button/fab.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,11 @@ export const MAT_FAB_DEFAULT_OPTIONS = new InjectionToken<MatFabDefaultOptions>(
4141
},
4242
);
4343

44-
/** @docs-private */
44+
/**
45+
* @docs-private
46+
* @deprecated No longer used, will be removed.
47+
* @breaking-change 21.0.0
48+
*/
4549
export function MAT_FAB_DEFAULT_OPTIONS_FACTORY(): MatFabDefaultOptions {
4650
return {
4751
// The FAB by default has its color set to accent.

src/material/checkbox/checkbox-config.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,11 @@ export const MAT_CHECKBOX_DEFAULT_OPTIONS = new InjectionToken<MatCheckboxDefaul
3535
},
3636
);
3737

38-
/** @docs-private */
38+
/**
39+
* @docs-private
40+
* @deprecated No longer used, will be removed.
41+
* @breaking-change 21.0.0
42+
*/
3943
export function MAT_CHECKBOX_DEFAULT_OPTIONS_FACTORY(): MatCheckboxDefaultOptions {
4044
return {
4145
color: 'accent',

src/material/core/datetime/date-adapter.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,11 @@ export const MAT_DATE_LOCALE = new InjectionToken<{}>('MAT_DATE_LOCALE', {
1515
factory: MAT_DATE_LOCALE_FACTORY,
1616
});
1717

18-
/** @docs-private */
18+
/**
19+
* @docs-private
20+
* @deprecated No longer used, will be removed.
21+
* @breaking-change 21.0.0
22+
*/
1923
export function MAT_DATE_LOCALE_FACTORY(): {} {
2024
return inject(LOCALE_ID);
2125
}

src/material/datepicker/date-range-selection-strategy.ts

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -131,15 +131,23 @@ export class DefaultMatCalendarRangeStrategy<D> implements MatDateRangeSelection
131131
}
132132
}
133133

134-
/** @docs-private */
134+
/**
135+
* @docs-private
136+
* @deprecated No longer used, will be removed.
137+
* @breaking-change 21.0.0
138+
*/
135139
export function MAT_CALENDAR_RANGE_STRATEGY_PROVIDER_FACTORY(
136140
parent: MatDateRangeSelectionStrategy<unknown>,
137141
adapter: DateAdapter<unknown>,
138142
) {
139143
return parent || new DefaultMatCalendarRangeStrategy(adapter);
140144
}
141145

142-
/** @docs-private */
146+
/**
147+
* @docs-private
148+
* @deprecated No longer used, will be removed.
149+
* @breaking-change 21.0.0
150+
*/
143151
export const MAT_CALENDAR_RANGE_STRATEGY_PROVIDER: FactoryProvider = {
144152
provide: MAT_DATE_RANGE_SELECTION_STRATEGY,
145153
deps: [[new Optional(), new SkipSelf(), MAT_DATE_RANGE_SELECTION_STRATEGY], DateAdapter],

src/material/datepicker/date-selection-model.ts

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -211,7 +211,11 @@ export class MatRangeDateSelectionModel<D> extends MatDateSelectionModel<DateRan
211211
}
212212
}
213213

214-
/** @docs-private */
214+
/**
215+
* @docs-private
216+
* @deprecated No longer used, will be removed.
217+
* @breaking-change 21.0.0
218+
*/
215219
export function MAT_SINGLE_DATE_SELECTION_MODEL_FACTORY(
216220
parent: MatSingleDateSelectionModel<unknown>,
217221
adapter: DateAdapter<unknown>,
@@ -222,14 +226,20 @@ export function MAT_SINGLE_DATE_SELECTION_MODEL_FACTORY(
222226
/**
223227
* Used to provide a single selection model to a component.
224228
* @docs-private
229+
* @deprecated No longer used, will be removed.
230+
* @breaking-change 21.0.0
225231
*/
226232
export const MAT_SINGLE_DATE_SELECTION_MODEL_PROVIDER: FactoryProvider = {
227233
provide: MatDateSelectionModel,
228234
deps: [[new Optional(), new SkipSelf(), MatDateSelectionModel], DateAdapter],
229235
useFactory: MAT_SINGLE_DATE_SELECTION_MODEL_FACTORY,
230236
};
231237

232-
/** @docs-private */
238+
/**
239+
* @docs-private
240+
* @deprecated No longer used, will be removed.
241+
* @breaking-change 21.0.0
242+
*/
233243
export function MAT_RANGE_DATE_SELECTION_MODEL_FACTORY(
234244
parent: MatSingleDateSelectionModel<unknown>,
235245
adapter: DateAdapter<unknown>,
@@ -240,6 +250,8 @@ export function MAT_RANGE_DATE_SELECTION_MODEL_FACTORY(
240250
/**
241251
* Used to provide a range selection model to a component.
242252
* @docs-private
253+
* @deprecated No longer used, will be removed.
254+
* @breaking-change 21.0.0
243255
*/
244256
export const MAT_RANGE_DATE_SELECTION_MODEL_PROVIDER: FactoryProvider = {
245257
provide: MatDateSelectionModel,

src/material/datepicker/datepicker-base.ts

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,11 @@ export const MAT_DATEPICKER_SCROLL_STRATEGY = new InjectionToken<() => ScrollStr
8888
},
8989
);
9090

91-
/** @docs-private */
91+
/**
92+
* @docs-private
93+
* @deprecated No longer used, will be removed.
94+
* @breaking-change 21.0.0
95+
*/
9296
export function MAT_DATEPICKER_SCROLL_STRATEGY_FACTORY(overlay: Overlay): () => ScrollStrategy {
9397
return () => overlay.scrollStrategies.reposition();
9498
}
@@ -99,7 +103,11 @@ export type DatepickerDropdownPositionX = 'start' | 'end';
99103
/** Possible positions for the datepicker dropdown along the Y axis. */
100104
export type DatepickerDropdownPositionY = 'above' | 'below';
101105

102-
/** @docs-private */
106+
/**
107+
* @docs-private
108+
* @deprecated No longer used, will be removed.
109+
* @breaking-change 21.0.0
110+
*/
103111
export const MAT_DATEPICKER_SCROLL_STRATEGY_FACTORY_PROVIDER = {
104112
provide: MAT_DATEPICKER_SCROLL_STRATEGY,
105113
deps: [Overlay],

src/material/icon/icon-registry.ts

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -728,7 +728,11 @@ export class MatIconRegistry implements OnDestroy {
728728
}
729729
}
730730

731-
/** @docs-private */
731+
/**
732+
* @docs-private
733+
* @deprecated No longer used, will be removed.
734+
* @breaking-change 21.0.0
735+
*/
732736
export function ICON_REGISTRY_PROVIDER_FACTORY(
733737
parentRegistry: MatIconRegistry,
734738
httpClient: HttpClient,
@@ -739,7 +743,11 @@ export function ICON_REGISTRY_PROVIDER_FACTORY(
739743
return parentRegistry || new MatIconRegistry(httpClient, sanitizer, document, errorHandler);
740744
}
741745

742-
/** @docs-private */
746+
/**
747+
* @docs-private
748+
* @deprecated No longer used, will be removed.
749+
* @breaking-change 21.0.0
750+
*/
743751
export const ICON_REGISTRY_PROVIDER = {
744752
// If there is already an MatIconRegistry available, use that. Otherwise, provide a new one.
745753
provide: MatIconRegistry,

src/material/icon/icon.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,11 @@ export interface MatIconLocation {
6565
getPathname: () => string;
6666
}
6767

68-
/** @docs-private */
68+
/**
69+
* @docs-private
70+
* @deprecated No longer used, will be removed.
71+
* @breaking-change 21.0.0
72+
*/
6973
export function MAT_ICON_LOCATION_FACTORY(): MatIconLocation {
7074
const _document = inject(DOCUMENT);
7175
const _location = _document ? _document.location : null;

src/material/menu/menu-trigger.ts

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -60,12 +60,20 @@ export const MAT_MENU_SCROLL_STRATEGY = new InjectionToken<() => ScrollStrategy>
6060
},
6161
);
6262

63-
/** @docs-private */
63+
/**
64+
* @docs-private
65+
* @deprecated No longer used, will be removed.
66+
* @breaking-change 21.0.0
67+
*/
6468
export function MAT_MENU_SCROLL_STRATEGY_FACTORY(overlay: Overlay): () => ScrollStrategy {
6569
return () => overlay.scrollStrategies.reposition();
6670
}
6771

68-
/** @docs-private */
72+
/**
73+
* @docs-private
74+
* @deprecated No longer used, will be removed.
75+
* @breaking-change 21.0.0
76+
*/
6977
export const MAT_MENU_SCROLL_STRATEGY_FACTORY_PROVIDER = {
7078
provide: MAT_MENU_SCROLL_STRATEGY,
7179
deps: [Overlay],

src/material/menu/menu.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,11 @@ export const MAT_MENU_DEFAULT_OPTIONS = new InjectionToken<MatMenuDefaultOptions
8282
},
8383
);
8484

85-
/** @docs-private */
85+
/**
86+
* @docs-private
87+
* @deprecated No longer used, will be removed.
88+
* @breaking-change 21.0.0
89+
*/
8690
export function MAT_MENU_DEFAULT_OPTIONS_FACTORY(): MatMenuDefaultOptions {
8791
return {
8892
overlapTrigger: false,

src/material/paginator/paginator-intl.ts

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -58,12 +58,20 @@ export class MatPaginatorIntl {
5858
};
5959
}
6060

61-
/** @docs-private */
61+
/**
62+
* @docs-private
63+
* @deprecated No longer used, will be removed.
64+
* @breaking-change 21.0.0
65+
*/
6266
export function MAT_PAGINATOR_INTL_PROVIDER_FACTORY(parentIntl: MatPaginatorIntl) {
6367
return parentIntl || new MatPaginatorIntl();
6468
}
6569

66-
/** @docs-private */
70+
/**
71+
* @docs-private
72+
* @deprecated No longer used, will be removed.
73+
* @breaking-change 21.0.0
74+
*/
6775
export const MAT_PAGINATOR_INTL_PROVIDER = {
6876
// If there is already an MatPaginatorIntl available, use that. Otherwise, provide a new one.
6977
provide: MatPaginatorIntl,

src/material/progress-bar/progress-bar.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,11 @@ export interface MatProgressBarLocation {
7070
getPathname: () => string;
7171
}
7272

73-
/** @docs-private */
73+
/**
74+
* @docs-private
75+
* @deprecated No longer used, will be removed.
76+
* @breaking-change 21.0.0
77+
*/
7478
export function MAT_PROGRESS_BAR_LOCATION_FACTORY(): MatProgressBarLocation {
7579
const _document = inject(DOCUMENT);
7680
const _location = _document ? _document.location : null;

0 commit comments

Comments
 (0)