diff --git a/src/Umbraco.Web.UI.Client/src/core/router/route.context.ts b/src/Umbraco.Web.UI.Client/src/core/router/route.context.ts new file mode 100644 index 0000000000..8fbb7cc61e --- /dev/null +++ b/src/Umbraco.Web.UI.Client/src/core/router/route.context.ts @@ -0,0 +1,30 @@ +import { UmbContextProviderController, UmbContextToken } from '@umbraco-cms/context-api'; +import { UmbControllerHostInterface } from '@umbraco-cms/controller'; +import { UmbModalToken } from '@umbraco-cms/modal'; + +type GetResultType = T extends UmbModalToken ? Result : unknown; + +export type UmbModalRoute = { + path: string; + onSetup: (routeInfo: any) => void; + onSubmit: (data: UmbModalTokenResult) => void; + onReject: () => void; +}; + +export class UmbRouteContext { + #host: UmbControllerHostInterface; + + constructor(host: UmbControllerHostInterface) { + this.#host = host; + new UmbContextProviderController(host, UMB_ROUTE_CONTEXT_TOKEN, this); + } + + public registerModal>( + modalAlias: T, + options: UmbModalRoute + ) { + console.log('registerModalRoutee', modalAlias.toString(), options); + } +} + +export const UMB_ROUTE_CONTEXT_TOKEN = new UmbContextToken('UmbSectionContext');