Skip to content

Commit

Permalink
chore(popup-menu): rename *Callback to *Provider
Browse files Browse the repository at this point in the history
Ensures we call out what the things are, following our existing patterns of providers and consumers.

BREAKING CHANGES: PopupMenu *Callback types renamed to *Provider.
  • Loading branch information
nikku committed Jan 30, 2024
1 parent e803c5f commit 228b405
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
8 changes: 4 additions & 4 deletions lib/features/popup-menu/PopupMenuProvider.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ import { PopupMenuTarget } from './PopupMenu';
import PopupMenuProvider, {
PopupMenuEntries,
PopupMenuHeaderEntries,
PopupMenuEntriesCallback,
PopupMenuProviderHeaderEntriesCallback
PopupMenuEntriesProvider,
PopupMenuProviderHeaderEntriesProvider
} from './PopupMenuProvider';

export class FooPopupMenuProvider implements PopupMenuProvider {
Expand All @@ -29,7 +29,7 @@ export class FooPopupMenuProvider implements PopupMenuProvider {
}

export class BarPopupMenuProvider implements PopupMenuProvider {
getPopupMenuEntries(target: PopupMenuTarget): PopupMenuEntriesCallback {
getPopupMenuEntries(target: PopupMenuTarget): PopupMenuEntriesProvider {
return function(entries) {
return {
...entries,
Expand Down Expand Up @@ -85,7 +85,7 @@ export class BazPopupMenuProvider implements PopupMenuProvider {
return {};
}

getHeaderEntries(target: PopupMenuTarget): PopupMenuProviderHeaderEntriesCallback {
getHeaderEntries(target: PopupMenuTarget): PopupMenuProviderHeaderEntriesProvider {
return function(entries) {
return [
...entries,
Expand Down
8 changes: 4 additions & 4 deletions lib/features/popup-menu/PopupMenuProvider.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ export type PopupMenuEntry = {

export type PopupMenuEntries = Record<string, PopupMenuEntry>;

export type PopupMenuEntriesCallback = (entries: PopupMenuEntries) => PopupMenuEntries;
export type PopupMenuEntriesProvider = (entries: PopupMenuEntries) => PopupMenuEntries;

export type PopupMenuHeaderEntryAction = (event: Event, entry: PopupMenuHeaderEntry, action?: string) => any;

Expand All @@ -31,7 +31,7 @@ export type PopupMenuHeaderEntry = {

export type PopupMenuHeaderEntries = PopupMenuHeaderEntry[];

export type PopupMenuProviderHeaderEntriesCallback = (entries: PopupMenuHeaderEntries) => PopupMenuHeaderEntries;
export type PopupMenuProviderHeaderEntriesProvider = (entries: PopupMenuHeaderEntries) => PopupMenuHeaderEntries;

export type PopupMenuEmptyPlaceholder = VNode;

Expand Down Expand Up @@ -70,7 +70,7 @@ export default interface PopupMenuProvider {
*
* @param target
*/
getPopupMenuEntries(target: PopupMenuTarget): PopupMenuEntriesCallback | PopupMenuEntries;
getPopupMenuEntries(target: PopupMenuTarget): PopupMenuEntriesProvider | PopupMenuEntries;

/**
* Returns a list of header entries or a function that receives, modifies and
Expand Down Expand Up @@ -102,7 +102,7 @@ export default interface PopupMenuProvider {
*
* @param target
*/
getHeaderEntries?(target: PopupMenuTarget): PopupMenuProviderHeaderEntriesCallback | PopupMenuHeaderEntries;
getHeaderEntries?(target: PopupMenuTarget): PopupMenuProviderHeaderEntriesProvider | PopupMenuHeaderEntries;

/**
* Returns a component to be displayed when no popup menu entries
Expand Down

0 comments on commit 228b405

Please sign in to comment.