Skip to content

fix(multiple): deprecate exported factories #30608

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Mar 12, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 10 additions & 2 deletions src/cdk/a11y/key-manager/tree-key-manager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -411,7 +411,11 @@ export class TreeKeyManager<T extends TreeKeyManagerItem> implements TreeKeyMana
}
}

/** @docs-private */
/**
* @docs-private
* @deprecated No longer used, will be removed.
* @breaking-change 21.0.0
Copy link
Contributor

@andrewseguin andrewseguin Mar 10, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shouldn't this be v22, since it'd be deprecated during two major releases (v20, v21)? Or does v19 count as one (feels a little late for that)

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The way I interpreted it is that it would have to be deprecated during two major versions: 19 and 20.

*/
export function TREE_KEY_MANAGER_FACTORY<T extends TreeKeyManagerItem>(): TreeKeyManagerFactory<T> {
return (items, options) => new TreeKeyManager(items, options);
}
Expand All @@ -422,7 +426,11 @@ export const TREE_KEY_MANAGER = new InjectionToken<TreeKeyManagerFactory<any>>('
factory: TREE_KEY_MANAGER_FACTORY,
});

/** @docs-private */
/**
* @docs-private
* @deprecated No longer used, will be removed.
* @breaking-change 21.0.0
*/
export const TREE_KEY_MANAGER_FACTORY_PROVIDER = {
provide: TREE_KEY_MANAGER,
useFactory: TREE_KEY_MANAGER_FACTORY,
Expand Down
6 changes: 5 additions & 1 deletion src/cdk/a11y/live-announcer/live-announcer-tokens.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,11 @@ export const LIVE_ANNOUNCER_ELEMENT_TOKEN = new InjectionToken<HTMLElement | nul
},
);

/** @docs-private */
/**
* @docs-private
* @deprecated No longer used, will be removed.
* @breaking-change 21.0.0
*/
export function LIVE_ANNOUNCER_ELEMENT_TOKEN_FACTORY(): null {
return null;
}
Expand Down
6 changes: 5 additions & 1 deletion src/cdk/bidi/dir-document-token.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,11 @@ export const DIR_DOCUMENT = new InjectionToken<Document>('cdk-dir-doc', {
factory: DIR_DOCUMENT_FACTORY,
});

/** @docs-private */
/**
* @docs-private
* @deprecated No longer used, will be removed.
* @breaking-change 21.0.0
*/
export function DIR_DOCUMENT_FACTORY(): Document {
return inject(DOCUMENT);
}
12 changes: 10 additions & 2 deletions src/cdk/overlay/overlay-directives.ts
Original file line number Diff line number Diff line change
Expand Up @@ -457,14 +457,22 @@ export class CdkConnectedOverlay implements OnDestroy, OnChanges {
}
}

/** @docs-private */
/**
* @docs-private
* @deprecated No longer used, will be removed.
* @breaking-change 21.0.0
*/
export function CDK_CONNECTED_OVERLAY_SCROLL_STRATEGY_PROVIDER_FACTORY(
overlay: Overlay,
): () => RepositionScrollStrategy {
return () => overlay.scrollStrategies.reposition();
}

/** @docs-private */
/**
* @docs-private
* @deprecated No longer used, will be removed.
* @breaking-change 21.0.0
*/
export const CDK_CONNECTED_OVERLAY_SCROLL_STRATEGY_PROVIDER = {
provide: CDK_CONNECTED_OVERLAY_SCROLL_STRATEGY,
deps: [Overlay],
Expand Down
6 changes: 5 additions & 1 deletion src/material-luxon-adapter/adapter/luxon-date-adapter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,11 @@ export const MAT_LUXON_DATE_ADAPTER_OPTIONS = new InjectionToken<MatLuxonDateAda
},
);

/** @docs-private */
/**
* @docs-private
* @deprecated No longer used, will be removed.
* @breaking-change 21.0.0
*/
export function MAT_LUXON_DATE_ADAPTER_OPTIONS_FACTORY(): MatLuxonDateAdapterOptions {
return {
useUtc: false,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,11 @@ export const MAT_MOMENT_DATE_ADAPTER_OPTIONS = new InjectionToken<MatMomentDateA
},
);

/** @docs-private */
/**
* @docs-private
* @deprecated No longer used, will be removed.
* @breaking-change 21.0.0
*/
export function MAT_MOMENT_DATE_ADAPTER_OPTIONS_FACTORY(): MatMomentDateAdapterOptions {
return {
useUtc: false,
Expand Down
12 changes: 10 additions & 2 deletions src/material/autocomplete/autocomplete-trigger.ts
Original file line number Diff line number Diff line change
Expand Up @@ -93,12 +93,20 @@ export const MAT_AUTOCOMPLETE_SCROLL_STRATEGY = new InjectionToken<() => ScrollS
},
);

/** @docs-private */
/**
* @docs-private
* @deprecated No longer used, will be removed.
* @breaking-change 21.0.0
*/
export function MAT_AUTOCOMPLETE_SCROLL_STRATEGY_FACTORY(overlay: Overlay): () => ScrollStrategy {
return () => overlay.scrollStrategies.reposition();
}

/** @docs-private */
/**
* @docs-private
* @deprecated No longer used, will be removed.
* @breaking-change 21.0.0
*/
export const MAT_AUTOCOMPLETE_SCROLL_STRATEGY_FACTORY_PROVIDER = {
provide: MAT_AUTOCOMPLETE_SCROLL_STRATEGY,
deps: [Overlay],
Expand Down
6 changes: 5 additions & 1 deletion src/material/autocomplete/autocomplete.ts
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,11 @@ export const MAT_AUTOCOMPLETE_DEFAULT_OPTIONS = new InjectionToken<MatAutocomple
},
);

/** @docs-private */
/**
* @docs-private
* @deprecated No longer used, will be removed.
* @breaking-change 21.0.0
*/
export function MAT_AUTOCOMPLETE_DEFAULT_OPTIONS_FACTORY(): MatAutocompleteDefaultOptions {
return {
autoActiveFirstOption: false,
Expand Down
5 changes: 5 additions & 0 deletions src/material/button-toggle/button-toggle.ts
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,11 @@ export const MAT_BUTTON_TOGGLE_DEFAULT_OPTIONS = new InjectionToken<MatButtonTog
},
);

/**
* @docs-private
* @deprecated No longer used, will be removed.
* @breaking-change 21.0.0
*/
export function MAT_BUTTON_TOGGLE_GROUP_DEFAULT_OPTIONS_FACTORY(): MatButtonToggleDefaultOptions {
return {
hideSingleSelectionIndicator: false,
Expand Down
6 changes: 5 additions & 1 deletion src/material/button/fab.ts
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,11 @@ export const MAT_FAB_DEFAULT_OPTIONS = new InjectionToken<MatFabDefaultOptions>(
},
);

/** @docs-private */
/**
* @docs-private
* @deprecated No longer used, will be removed.
* @breaking-change 21.0.0
*/
export function MAT_FAB_DEFAULT_OPTIONS_FACTORY(): MatFabDefaultOptions {
return {
// The FAB by default has its color set to accent.
Expand Down
6 changes: 5 additions & 1 deletion src/material/checkbox/checkbox-config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,11 @@ export const MAT_CHECKBOX_DEFAULT_OPTIONS = new InjectionToken<MatCheckboxDefaul
},
);

/** @docs-private */
/**
* @docs-private
* @deprecated No longer used, will be removed.
* @breaking-change 21.0.0
*/
export function MAT_CHECKBOX_DEFAULT_OPTIONS_FACTORY(): MatCheckboxDefaultOptions {
return {
color: 'accent',
Expand Down
6 changes: 5 additions & 1 deletion src/material/core/datetime/date-adapter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,11 @@ export const MAT_DATE_LOCALE = new InjectionToken<{}>('MAT_DATE_LOCALE', {
factory: MAT_DATE_LOCALE_FACTORY,
});

/** @docs-private */
/**
* @docs-private
* @deprecated No longer used, will be removed.
* @breaking-change 21.0.0
*/
export function MAT_DATE_LOCALE_FACTORY(): {} {
return inject(LOCALE_ID);
}
Expand Down
12 changes: 10 additions & 2 deletions src/material/datepicker/date-range-selection-strategy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -131,15 +131,23 @@ export class DefaultMatCalendarRangeStrategy<D> implements MatDateRangeSelection
}
}

/** @docs-private */
/**
* @docs-private
* @deprecated No longer used, will be removed.
* @breaking-change 21.0.0
*/
export function MAT_CALENDAR_RANGE_STRATEGY_PROVIDER_FACTORY(
parent: MatDateRangeSelectionStrategy<unknown>,
adapter: DateAdapter<unknown>,
) {
return parent || new DefaultMatCalendarRangeStrategy(adapter);
}

/** @docs-private */
/**
* @docs-private
* @deprecated No longer used, will be removed.
* @breaking-change 21.0.0
*/
export const MAT_CALENDAR_RANGE_STRATEGY_PROVIDER: FactoryProvider = {
provide: MAT_DATE_RANGE_SELECTION_STRATEGY,
deps: [[new Optional(), new SkipSelf(), MAT_DATE_RANGE_SELECTION_STRATEGY], DateAdapter],
Expand Down
16 changes: 14 additions & 2 deletions src/material/datepicker/date-selection-model.ts
Original file line number Diff line number Diff line change
Expand Up @@ -211,7 +211,11 @@ export class MatRangeDateSelectionModel<D> extends MatDateSelectionModel<DateRan
}
}

/** @docs-private */
/**
* @docs-private
* @deprecated No longer used, will be removed.
* @breaking-change 21.0.0
*/
export function MAT_SINGLE_DATE_SELECTION_MODEL_FACTORY(
parent: MatSingleDateSelectionModel<unknown>,
adapter: DateAdapter<unknown>,
Expand All @@ -222,14 +226,20 @@ export function MAT_SINGLE_DATE_SELECTION_MODEL_FACTORY(
/**
* Used to provide a single selection model to a component.
* @docs-private
* @deprecated No longer used, will be removed.
* @breaking-change 21.0.0
*/
export const MAT_SINGLE_DATE_SELECTION_MODEL_PROVIDER: FactoryProvider = {
provide: MatDateSelectionModel,
deps: [[new Optional(), new SkipSelf(), MatDateSelectionModel], DateAdapter],
useFactory: MAT_SINGLE_DATE_SELECTION_MODEL_FACTORY,
};

/** @docs-private */
/**
* @docs-private
* @deprecated No longer used, will be removed.
* @breaking-change 21.0.0
*/
export function MAT_RANGE_DATE_SELECTION_MODEL_FACTORY(
parent: MatSingleDateSelectionModel<unknown>,
adapter: DateAdapter<unknown>,
Expand All @@ -240,6 +250,8 @@ export function MAT_RANGE_DATE_SELECTION_MODEL_FACTORY(
/**
* Used to provide a range selection model to a component.
* @docs-private
* @deprecated No longer used, will be removed.
* @breaking-change 21.0.0
*/
export const MAT_RANGE_DATE_SELECTION_MODEL_PROVIDER: FactoryProvider = {
provide: MatDateSelectionModel,
Expand Down
12 changes: 10 additions & 2 deletions src/material/datepicker/datepicker-base.ts
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,11 @@ export const MAT_DATEPICKER_SCROLL_STRATEGY = new InjectionToken<() => ScrollStr
},
);

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

/** @docs-private */
/**
* @docs-private
* @deprecated No longer used, will be removed.
* @breaking-change 21.0.0
*/
export const MAT_DATEPICKER_SCROLL_STRATEGY_FACTORY_PROVIDER = {
provide: MAT_DATEPICKER_SCROLL_STRATEGY,
deps: [Overlay],
Expand Down
12 changes: 10 additions & 2 deletions src/material/icon/icon-registry.ts
Original file line number Diff line number Diff line change
Expand Up @@ -728,7 +728,11 @@ export class MatIconRegistry implements OnDestroy {
}
}

/** @docs-private */
/**
* @docs-private
* @deprecated No longer used, will be removed.
* @breaking-change 21.0.0
*/
export function ICON_REGISTRY_PROVIDER_FACTORY(
parentRegistry: MatIconRegistry,
httpClient: HttpClient,
Expand All @@ -739,7 +743,11 @@ export function ICON_REGISTRY_PROVIDER_FACTORY(
return parentRegistry || new MatIconRegistry(httpClient, sanitizer, document, errorHandler);
}

/** @docs-private */
/**
* @docs-private
* @deprecated No longer used, will be removed.
* @breaking-change 21.0.0
*/
export const ICON_REGISTRY_PROVIDER = {
// If there is already an MatIconRegistry available, use that. Otherwise, provide a new one.
provide: MatIconRegistry,
Expand Down
6 changes: 5 additions & 1 deletion src/material/icon/icon.ts
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,11 @@ export interface MatIconLocation {
getPathname: () => string;
}

/** @docs-private */
/**
* @docs-private
* @deprecated No longer used, will be removed.
* @breaking-change 21.0.0
*/
export function MAT_ICON_LOCATION_FACTORY(): MatIconLocation {
const _document = inject(DOCUMENT);
const _location = _document ? _document.location : null;
Expand Down
12 changes: 10 additions & 2 deletions src/material/menu/menu-trigger.ts
Original file line number Diff line number Diff line change
Expand Up @@ -60,12 +60,20 @@ export const MAT_MENU_SCROLL_STRATEGY = new InjectionToken<() => ScrollStrategy>
},
);

/** @docs-private */
/**
* @docs-private
* @deprecated No longer used, will be removed.
* @breaking-change 21.0.0
*/
export function MAT_MENU_SCROLL_STRATEGY_FACTORY(overlay: Overlay): () => ScrollStrategy {
return () => overlay.scrollStrategies.reposition();
}

/** @docs-private */
/**
* @docs-private
* @deprecated No longer used, will be removed.
* @breaking-change 21.0.0
*/
export const MAT_MENU_SCROLL_STRATEGY_FACTORY_PROVIDER = {
provide: MAT_MENU_SCROLL_STRATEGY,
deps: [Overlay],
Expand Down
6 changes: 5 additions & 1 deletion src/material/menu/menu.ts
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,11 @@ export const MAT_MENU_DEFAULT_OPTIONS = new InjectionToken<MatMenuDefaultOptions
},
);

/** @docs-private */
/**
* @docs-private
* @deprecated No longer used, will be removed.
* @breaking-change 21.0.0
*/
export function MAT_MENU_DEFAULT_OPTIONS_FACTORY(): MatMenuDefaultOptions {
return {
overlapTrigger: false,
Expand Down
12 changes: 10 additions & 2 deletions src/material/paginator/paginator-intl.ts
Original file line number Diff line number Diff line change
Expand Up @@ -58,12 +58,20 @@ export class MatPaginatorIntl {
};
}

/** @docs-private */
/**
* @docs-private
* @deprecated No longer used, will be removed.
* @breaking-change 21.0.0
*/
export function MAT_PAGINATOR_INTL_PROVIDER_FACTORY(parentIntl: MatPaginatorIntl) {
return parentIntl || new MatPaginatorIntl();
}

/** @docs-private */
/**
* @docs-private
* @deprecated No longer used, will be removed.
* @breaking-change 21.0.0
*/
export const MAT_PAGINATOR_INTL_PROVIDER = {
// If there is already an MatPaginatorIntl available, use that. Otherwise, provide a new one.
provide: MatPaginatorIntl,
Expand Down
6 changes: 5 additions & 1 deletion src/material/progress-bar/progress-bar.ts
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,11 @@ export interface MatProgressBarLocation {
getPathname: () => string;
}

/** @docs-private */
/**
* @docs-private
* @deprecated No longer used, will be removed.
* @breaking-change 21.0.0
*/
export function MAT_PROGRESS_BAR_LOCATION_FACTORY(): MatProgressBarLocation {
const _document = inject(DOCUMENT);
const _location = _document ? _document.location : null;
Expand Down
Loading
Loading