From 13d4bb587338e7cdd9bcfc0fcfadf5d579d95f17 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Niels=20Lyngs=C3=B8?= Date: Thu, 23 Mar 2023 21:20:39 +0100 Subject: [PATCH] move router to libs --- .../libs/modal/modal-route-registration.controller.ts | 2 +- src/Umbraco.Web.UI.Client/libs/router/index.ts | 3 +++ .../{src/core => libs}/router/route-location.interface.ts | 0 .../{src/core => libs}/router/route.context.ts | 7 ++++--- .../{src/core => libs}/router/route.interface.ts | 0 src/Umbraco.Web.UI.Client/src/core/router/index.ts | 3 --- .../src/core/router/router-slot.element.ts | 3 +-- src/Umbraco.Web.UI.Client/tsconfig.json | 1 + 8 files changed, 10 insertions(+), 9 deletions(-) rename src/Umbraco.Web.UI.Client/{src/core => libs}/router/route-location.interface.ts (100%) rename src/Umbraco.Web.UI.Client/{src/core => libs}/router/route.context.ts (95%) rename src/Umbraco.Web.UI.Client/{src/core => libs}/router/route.interface.ts (100%) diff --git a/src/Umbraco.Web.UI.Client/libs/modal/modal-route-registration.controller.ts b/src/Umbraco.Web.UI.Client/libs/modal/modal-route-registration.controller.ts index 8c13c00e5d..f1ef34e69c 100644 --- a/src/Umbraco.Web.UI.Client/libs/modal/modal-route-registration.controller.ts +++ b/src/Umbraco.Web.UI.Client/libs/modal/modal-route-registration.controller.ts @@ -1,5 +1,5 @@ // TODO: Be aware here we import a class from src! -import { UMB_ROUTE_CONTEXT_TOKEN } from '../../src/core/router/route.context'; +import { UMB_ROUTE_CONTEXT_TOKEN } from '../router/route.context'; import type { UmbControllerInterface } from '../controller'; import { UmbModalRouteRegistration } from './modal-route-registration'; import { UmbContextConsumerController } from '@umbraco-cms/backoffice/context-api'; diff --git a/src/Umbraco.Web.UI.Client/libs/router/index.ts b/src/Umbraco.Web.UI.Client/libs/router/index.ts index e69de29bb2..5a49b1769d 100644 --- a/src/Umbraco.Web.UI.Client/libs/router/index.ts +++ b/src/Umbraco.Web.UI.Client/libs/router/index.ts @@ -0,0 +1,3 @@ +export * from './route-location.interface'; +export * from './route.context'; +export * from './route.interface'; diff --git a/src/Umbraco.Web.UI.Client/src/core/router/route-location.interface.ts b/src/Umbraco.Web.UI.Client/libs/router/route-location.interface.ts similarity index 100% rename from src/Umbraco.Web.UI.Client/src/core/router/route-location.interface.ts rename to src/Umbraco.Web.UI.Client/libs/router/route-location.interface.ts diff --git a/src/Umbraco.Web.UI.Client/src/core/router/route.context.ts b/src/Umbraco.Web.UI.Client/libs/router/route.context.ts similarity index 95% rename from src/Umbraco.Web.UI.Client/src/core/router/route.context.ts rename to src/Umbraco.Web.UI.Client/libs/router/route.context.ts index 20999b8554..93cc0f64b8 100644 --- a/src/Umbraco.Web.UI.Client/src/core/router/route.context.ts +++ b/src/Umbraco.Web.UI.Client/libs/router/route.context.ts @@ -1,4 +1,5 @@ -import { IRoute, IRoutingInfo, PARAM_IDENTIFIER, stripSlash } from 'router-slot'; +import { IRoutingInfo, PARAM_IDENTIFIER, stripSlash } from 'router-slot'; +import { UmbRoute } from './route.interface'; import { UmbContextConsumerController, UmbContextProviderController, @@ -13,7 +14,7 @@ export class UmbRouteContext { //#host: UmbControllerHostInterface; #modalRegistrations: UmbModalRouteRegistration[] = []; #modalContext?: typeof UMB_MODAL_CONTEXT_TOKEN.TYPE; - #contextRoutes: IRoute[] = []; + #contextRoutes: UmbRoute[] = []; #routerBasePath?: string; #activeModalPath?: string; @@ -49,7 +50,7 @@ export class UmbRouteContext { return `/modal/${modalRegistration.alias.toString()}/${modalRegistration.path}`; } - #generateRoute(modalRegistration: UmbModalRouteRegistration): IRoute { + #generateRoute(modalRegistration: UmbModalRouteRegistration): UmbRoute { return { path: this.#getModalRoutePath(modalRegistration), component: EmptyDiv, diff --git a/src/Umbraco.Web.UI.Client/src/core/router/route.interface.ts b/src/Umbraco.Web.UI.Client/libs/router/route.interface.ts similarity index 100% rename from src/Umbraco.Web.UI.Client/src/core/router/route.interface.ts rename to src/Umbraco.Web.UI.Client/libs/router/route.interface.ts diff --git a/src/Umbraco.Web.UI.Client/src/core/router/index.ts b/src/Umbraco.Web.UI.Client/src/core/router/index.ts index 8977c05ae9..d3c5361842 100644 --- a/src/Umbraco.Web.UI.Client/src/core/router/index.ts +++ b/src/Umbraco.Web.UI.Client/src/core/router/index.ts @@ -1,8 +1,5 @@ export * from 'router-slot'; -export * from './route.interface'; -export * from './route.context'; export * from './router-slot.element'; export * from './router-slot-change.event'; export * from './router-slot-init.event'; export * from './variant-router-slot.element'; -export * from './route-location.interface'; diff --git a/src/Umbraco.Web.UI.Client/src/core/router/router-slot.element.ts b/src/Umbraco.Web.UI.Client/src/core/router/router-slot.element.ts index 6ceb4aedb5..0881affd54 100644 --- a/src/Umbraco.Web.UI.Client/src/core/router/router-slot.element.ts +++ b/src/Umbraco.Web.UI.Client/src/core/router/router-slot.element.ts @@ -2,11 +2,10 @@ import type { IRoute } from 'router-slot/model'; import { RouterSlot } from 'router-slot'; import { css, html, PropertyValueMap } from 'lit'; import { customElement, property } from 'lit/decorators.js'; +import { UmbRouteContext, UmbRoute } from '@umbraco-cms/backoffice/router'; import { UmbLitElement } from '../lit-element'; import { UmbRouterSlotInitEvent } from './router-slot-init.event'; import { UmbRouterSlotChangeEvent } from './router-slot-change.event'; -import { UmbRouteContext } from './route.context'; -import { UmbRoute } from './route.interface'; /** * @element umb-router-slot diff --git a/src/Umbraco.Web.UI.Client/tsconfig.json b/src/Umbraco.Web.UI.Client/tsconfig.json index 40bbd59d48..147a4a8288 100644 --- a/src/Umbraco.Web.UI.Client/tsconfig.json +++ b/src/Umbraco.Web.UI.Client/tsconfig.json @@ -35,6 +35,7 @@ "@umbraco-cms/backoffice/property-editor": ["libs/property-editor"], "@umbraco-cms/backoffice/repository": ["libs/repository"], "@umbraco-cms/backoffice/resources": ["libs/resources"], + "@umbraco-cms/backoffice/router": ["libs/router"], "@umbraco-cms/backoffice/store": ["libs/store"], "@umbraco-cms/backoffice/utils": ["libs/utils"], "@umbraco-cms/backoffice/workspace": ["libs/workspace"],