From 2b31fcda81608b44acfcdae6761b87fe241a0f06 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Niels=20Lyngs=C3=B8?= Date: Sat, 28 Sep 2024 21:14:51 +0200 Subject: [PATCH 1/3] move section extensions --- .../core/extension-registry/models/index.ts | 12 ---------- src/packages/core/section/extensions/index.ts | 22 +++++++++++++++++++ .../extensions/section-route.extension.ts} | 2 +- .../section-sidebar-app.extension.ts} | 2 +- .../extensions/section-view.extension.ts} | 2 +- .../extensions/section.extension.ts} | 2 +- .../core/section/section-default.element.ts | 2 +- 7 files changed, 27 insertions(+), 17 deletions(-) create mode 100644 src/packages/core/section/extensions/index.ts rename src/packages/core/{extension-registry/models/section-route.model.ts => section/extensions/section-route.extension.ts} (84%) rename src/packages/core/{extension-registry/models/section-sidebar-app.model.ts => section/extensions/section-sidebar-app.extension.ts} (90%) rename src/packages/core/{extension-registry/models/section-view.model.ts => section/extensions/section-view.extension.ts} (89%) rename src/packages/core/{extension-registry/models/section.model.ts => section/extensions/section.extension.ts} (80%) diff --git a/src/packages/core/extension-registry/models/index.ts b/src/packages/core/extension-registry/models/index.ts index afa28545e2..c261c48113 100644 --- a/src/packages/core/extension-registry/models/index.ts +++ b/src/packages/core/extension-registry/models/index.ts @@ -34,9 +34,6 @@ import type { ManifestPreviewAppProvider } from './preview-app.model.js'; import type { ManifestPropertyAction, ManifestPropertyActionDefaultKind } from './property-action.model.js'; import type { ManifestPropertyEditorUi, ManifestPropertyEditorSchema } from './property-editor.model.js'; import type { ManifestRepository } from './repository.model.js'; -import type { ManifestSection } from './section.model.js'; -import type { ManifestSectionSidebarApp, ManifestSectionSidebarAppMenuKind } from './section-sidebar-app.model.js'; -import type { ManifestSectionView } from './section-view.model.js'; import type { ManifestStore, ManifestTreeStore, ManifestItemStore } from './store.model.js'; import type { ManifestTheme } from './theme.model.js'; import type { ManifestTinyMcePlugin } from './tinymce-plugin.model.js'; @@ -50,7 +47,6 @@ import type { ManifestAppEntryPoint } from './app-entry-point.model.js'; import type { ManifestBackofficeEntryPoint } from './backoffice-entry-point.model.js'; import type { ManifestEntryPoint } from './entry-point.model.js'; import type { ManifestMonacoMarkdownEditorAction } from './monaco-markdown-editor-action.model.js'; -import type { ManifestSectionRoute } from './section-route.model.js'; import type { ManifestPickerSearchResultItem } from './picker-search-result-item.model.js'; import type { ManifestBase, ManifestBundle, ManifestCondition } from '@umbraco-cms/backoffice/extension-api'; @@ -82,9 +78,6 @@ export type * from './preview-app.model.js'; export type * from './property-action.model.js'; export type * from './property-editor.model.js'; export type * from './repository.model.js'; -export type * from './section-sidebar-app.model.js'; -export type * from './section-view.model.js'; -export type * from './section.model.js'; export type * from './store.model.js'; export type * from './theme.model.js'; export type * from './tinymce-plugin.model.js'; @@ -150,11 +143,6 @@ export type ManifestTypes = | ManifestPropertyEditorSchema | ManifestPropertyEditorUi | ManifestRepository - | ManifestSection - | ManifestSectionRoute - | ManifestSectionSidebarApp - | ManifestSectionSidebarAppMenuKind - | ManifestSectionView | ManifestStore | ManifestTheme | ManifestTinyMcePlugin diff --git a/src/packages/core/section/extensions/index.ts b/src/packages/core/section/extensions/index.ts new file mode 100644 index 0000000000..22afd86d09 --- /dev/null +++ b/src/packages/core/section/extensions/index.ts @@ -0,0 +1,22 @@ +import type { ManifestSectionRoute } from './section-route.extension.js'; +import type { ManifestSectionSidebarApp, ManifestSectionSidebarAppMenuKind } from './section-sidebar-app.extension.js'; +import type { ManifestSectionView } from './section-view.extension.js'; +import type { ManifestSection } from './section.extension.js'; + +export type * from './section-route.extension.js'; +export type * from './section-sidebar-app.extension.js'; +export type * from './section-view.extension.js'; +export type * from './section.extension.js'; + +type UmbSectionExtensions = + | ManifestSection + | ManifestSectionRoute + | ManifestSectionSidebarApp + | ManifestSectionSidebarAppMenuKind + | ManifestSectionView; + +declare global { + interface UmbExtensionManifestMap { + UmbSectionExtensions: UmbSectionExtensions; + } +} diff --git a/src/packages/core/extension-registry/models/section-route.model.ts b/src/packages/core/section/extensions/section-route.extension.ts similarity index 84% rename from src/packages/core/extension-registry/models/section-route.model.ts rename to src/packages/core/section/extensions/section-route.extension.ts index fc57b62471..49f441df81 100644 --- a/src/packages/core/extension-registry/models/section-route.model.ts +++ b/src/packages/core/section/extensions/section-route.extension.ts @@ -1,6 +1,6 @@ -import type { UmbRouteEntry } from '../../router/types.js'; import type { UmbControllerHostElement } from '@umbraco-cms/backoffice/controller-api'; import type { ManifestElementAndApi } from '@umbraco-cms/backoffice/extension-api'; +import type { UmbRouteEntry } from '@umbraco-cms/backoffice/router'; export interface ManifestSectionRoute extends ManifestElementAndApi { type: 'sectionRoute'; diff --git a/src/packages/core/extension-registry/models/section-sidebar-app.model.ts b/src/packages/core/section/extensions/section-sidebar-app.extension.ts similarity index 90% rename from src/packages/core/extension-registry/models/section-sidebar-app.model.ts rename to src/packages/core/section/extensions/section-sidebar-app.extension.ts index 8bf18b69c2..8cf5037106 100644 --- a/src/packages/core/extension-registry/models/section-sidebar-app.model.ts +++ b/src/packages/core/section/extensions/section-sidebar-app.extension.ts @@ -1,5 +1,5 @@ -import type { UmbSectionSidebarAppElement } from '../interfaces/section-sidebar-app-element.interface.js'; import type { ManifestElement, ManifestWithDynamicConditions } from '@umbraco-cms/backoffice/extension-api'; +import type { UmbSectionSidebarAppElement } from '@umbraco-cms/backoffice/extension-registry'; export interface ManifestSectionSidebarApp extends ManifestElement, diff --git a/src/packages/core/extension-registry/models/section-view.model.ts b/src/packages/core/section/extensions/section-view.extension.ts similarity index 89% rename from src/packages/core/extension-registry/models/section-view.model.ts rename to src/packages/core/section/extensions/section-view.extension.ts index 8001e645cf..b96038133f 100644 --- a/src/packages/core/extension-registry/models/section-view.model.ts +++ b/src/packages/core/section/extensions/section-view.extension.ts @@ -1,5 +1,5 @@ -import type { UmbSectionViewElement } from '../interfaces/section-view-element.interface.js'; import type { ManifestElement, ManifestWithDynamicConditions } from '@umbraco-cms/backoffice/extension-api'; +import type { UmbSectionViewElement } from '@umbraco-cms/backoffice/extension-registry'; export interface ManifestSectionView extends ManifestElement, diff --git a/src/packages/core/extension-registry/models/section.model.ts b/src/packages/core/section/extensions/section.extension.ts similarity index 80% rename from src/packages/core/extension-registry/models/section.model.ts rename to src/packages/core/section/extensions/section.extension.ts index 8e615a895b..5834f280ad 100644 --- a/src/packages/core/extension-registry/models/section.model.ts +++ b/src/packages/core/section/extensions/section.extension.ts @@ -1,5 +1,5 @@ -import type { UmbSectionElement } from '../interfaces/index.js'; import type { ManifestElement, ManifestWithDynamicConditions } from '@umbraco-cms/backoffice/extension-api'; +import type { UmbSectionElement } from '@umbraco-cms/backoffice/extension-registry'; export interface ManifestSection extends ManifestElement, diff --git a/src/packages/core/section/section-default.element.ts b/src/packages/core/section/section-default.element.ts index 10ff6c620d..640257413e 100644 --- a/src/packages/core/section/section-default.element.ts +++ b/src/packages/core/section/section-default.element.ts @@ -1,4 +1,4 @@ -import type { ManifestSectionRoute } from '../extension-registry/models/section-route.model.js'; +import type { ManifestSectionRoute } from './extensions/section-route.extension.js'; import type { UmbSectionMainViewElement } from './section-main-views/section-main-views.element.js'; import { UmbTextStyles } from '@umbraco-cms/backoffice/style'; import { css, html, nothing, customElement, property, state, repeat } from '@umbraco-cms/backoffice/external/lit'; From c12d967176d8da759f0508df19c73ce26258adf4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Niels=20Lyngs=C3=B8?= Date: Sat, 28 Sep 2024 21:26:20 +0200 Subject: [PATCH 2/3] move section extensions --- src/apps/backoffice/backoffice.context.ts | 2 +- .../components/backoffice-header-sections.element.ts | 2 +- src/apps/backoffice/components/backoffice-main.element.ts | 2 +- .../controller/extension-api-initializer.test.ts | 3 ++- .../controller/extension-element-initializer.test.ts | 3 ++- src/packages/core/extension-registry/interfaces/index.ts | 3 --- src/packages/core/section/extensions/index.ts | 2 ++ .../extensions}/section-element.interface.ts | 2 +- .../extensions}/section-sidebar-app-element.interface.ts | 2 +- .../section/extensions/section-sidebar-app.extension.ts | 2 +- .../extensions}/section-view-element.interface.ts | 2 +- .../core/section/extensions/section-view.extension.ts | 2 +- src/packages/core/section/extensions/section.extension.ts | 2 +- src/packages/core/section/extensions/types.ts | 3 +++ .../section/repository/item/section-item.repository.ts | 2 +- src/packages/core/section/repository/item/types.ts | 2 +- src/packages/core/section/section-default.element.ts | 6 +++--- .../section-main-views/section-main-views.element.ts | 8 ++------ .../section-picker-modal/section-picker-modal.element.ts | 2 +- .../section-sidebar-menu-with-entity-actions.element.ts | 6 ++---- .../section-sidebar-menu/section-sidebar-menu.element.ts | 8 ++------ src/packages/core/section/section.context.ts | 2 +- src/packages/core/section/types.ts | 1 + src/packages/members/section/manifests.ts | 4 ++-- .../created/created-packages-section-view.element.ts | 2 +- .../installed/installed-packages-section-view.element.ts | 2 +- .../packages-marketplace-section-view.element.ts | 2 +- 27 files changed, 37 insertions(+), 42 deletions(-) rename src/packages/core/{extension-registry/interfaces => section/extensions}/section-element.interface.ts (58%) rename src/packages/core/{extension-registry/interfaces => section/extensions}/section-sidebar-app-element.interface.ts (56%) rename src/packages/core/{extension-registry/interfaces => section/extensions}/section-view-element.interface.ts (57%) create mode 100644 src/packages/core/section/extensions/types.ts diff --git a/src/apps/backoffice/backoffice.context.ts b/src/apps/backoffice/backoffice.context.ts index 04580295bb..3c188520e6 100644 --- a/src/apps/backoffice/backoffice.context.ts +++ b/src/apps/backoffice/backoffice.context.ts @@ -5,7 +5,7 @@ import { UmbContextToken } from '@umbraco-cms/backoffice/context-api'; import { UmbContextBase } from '@umbraco-cms/backoffice/class-api'; import { UmbExtensionsManifestInitializer } from '@umbraco-cms/backoffice/extension-api'; import { umbExtensionsRegistry } from '@umbraco-cms/backoffice/extension-registry'; -import type { ManifestSection } from '@umbraco-cms/backoffice/extension-registry'; +import type { ManifestSection } from '@umbraco-cms/backoffice/section'; import type { UmbControllerHost } from '@umbraco-cms/backoffice/controller-api'; import type { UmbExtensionManifestInitializer } from '@umbraco-cms/backoffice/extension-api'; import { UMB_AUTH_CONTEXT } from '@umbraco-cms/backoffice/auth'; diff --git a/src/apps/backoffice/components/backoffice-header-sections.element.ts b/src/apps/backoffice/components/backoffice-header-sections.element.ts index 21dcd450fe..f0588625ce 100644 --- a/src/apps/backoffice/components/backoffice-header-sections.element.ts +++ b/src/apps/backoffice/components/backoffice-header-sections.element.ts @@ -2,7 +2,7 @@ import { UMB_BACKOFFICE_CONTEXT } from '../backoffice.context.js'; import type { UmbBackofficeContext } from '../backoffice.context.js'; import type { CSSResultGroup } from '@umbraco-cms/backoffice/external/lit'; import { css, html, customElement, state, repeat, ifDefined } from '@umbraco-cms/backoffice/external/lit'; -import type { ManifestSection } from '@umbraco-cms/backoffice/extension-registry'; +import type { ManifestSection } from '@umbraco-cms/backoffice/section'; import { UmbLitElement } from '@umbraco-cms/backoffice/lit-element'; import type { UmbExtensionManifestInitializer } from '@umbraco-cms/backoffice/extension-api'; diff --git a/src/apps/backoffice/components/backoffice-main.element.ts b/src/apps/backoffice/components/backoffice-main.element.ts index 3a9ac24397..99b38b9b80 100644 --- a/src/apps/backoffice/components/backoffice-main.element.ts +++ b/src/apps/backoffice/components/backoffice-main.element.ts @@ -3,7 +3,7 @@ import { UMB_BACKOFFICE_CONTEXT } from '../backoffice.context.js'; import { css, html, customElement, state, nothing } from '@umbraco-cms/backoffice/external/lit'; import { UmbSectionContext, UMB_SECTION_CONTEXT, UMB_SECTION_PATH_PATTERN } from '@umbraco-cms/backoffice/section'; import type { PageComponent, UmbRoute, UmbRouterSlotChangeEvent } from '@umbraco-cms/backoffice/router'; -import type { ManifestSection, UmbSectionElement } from '@umbraco-cms/backoffice/extension-registry'; +import type { ManifestSection, UmbSectionElement } from '@umbraco-cms/backoffice/section'; import type { UmbExtensionManifestInitializer } from '@umbraco-cms/backoffice/extension-api'; import { createExtensionElement } from '@umbraco-cms/backoffice/extension-api'; import { UmbLitElement } from '@umbraco-cms/backoffice/lit-element'; diff --git a/src/libs/extension-api/controller/extension-api-initializer.test.ts b/src/libs/extension-api/controller/extension-api-initializer.test.ts index 78c6409286..11f5b9aad9 100644 --- a/src/libs/extension-api/controller/extension-api-initializer.test.ts +++ b/src/libs/extension-api/controller/extension-api-initializer.test.ts @@ -6,7 +6,8 @@ import { UmbControllerBase } from '@umbraco-cms/backoffice/class-api'; import { UmbControllerHostElementMixin } from '@umbraco-cms/backoffice/controller-api'; import type { UmbControllerHostElement, UmbControllerHost } from '@umbraco-cms/backoffice/controller-api'; import { customElement, html } from '@umbraco-cms/backoffice/external/lit'; -import { type ManifestSection, UmbSwitchCondition } from '@umbraco-cms/backoffice/extension-registry'; +import { UmbSwitchCondition } from '@umbraco-cms/backoffice/extension-registry'; +import type { ManifestSection } from '@umbraco-cms/backoffice/section'; @customElement('umb-test-controller-host') // Element is used in tests diff --git a/src/libs/extension-api/controller/extension-element-initializer.test.ts b/src/libs/extension-api/controller/extension-element-initializer.test.ts index 6a8242c209..bae2173bbe 100644 --- a/src/libs/extension-api/controller/extension-element-initializer.test.ts +++ b/src/libs/extension-api/controller/extension-element-initializer.test.ts @@ -3,7 +3,8 @@ import { UmbExtensionElementInitializer } from './index.js'; import { expect, fixture } from '@open-wc/testing'; import { UmbControllerHostElementMixin, type UmbControllerHostElement } from '@umbraco-cms/backoffice/controller-api'; import { customElement, html } from '@umbraco-cms/backoffice/external/lit'; -import { type ManifestSection, UmbSwitchCondition } from '@umbraco-cms/backoffice/extension-registry'; +import { UmbSwitchCondition } from '@umbraco-cms/backoffice/extension-registry'; +import type { ManifestSection } from '@umbraco-cms/backoffice/section'; @customElement('umb-test-controller-host') class UmbTestControllerHostElement extends UmbControllerHostElementMixin(HTMLElement) {} diff --git a/src/packages/core/extension-registry/interfaces/index.ts b/src/packages/core/extension-registry/interfaces/index.ts index d6a9ee345c..c24390c661 100644 --- a/src/packages/core/extension-registry/interfaces/index.ts +++ b/src/packages/core/extension-registry/interfaces/index.ts @@ -4,6 +4,3 @@ export * from './file-upload-preview.interface.js'; export * from './menu-item-element.interface.js'; export * from './modal-extension-element.interface.js'; export * from './property-editor-ui-element.interface.js'; -export * from './section-element.interface.js'; -export * from './section-sidebar-app-element.interface.js'; -export * from './section-view-element.interface.js'; diff --git a/src/packages/core/section/extensions/index.ts b/src/packages/core/section/extensions/index.ts index 22afd86d09..9a8529d636 100644 --- a/src/packages/core/section/extensions/index.ts +++ b/src/packages/core/section/extensions/index.ts @@ -8,6 +8,8 @@ export type * from './section-sidebar-app.extension.js'; export type * from './section-view.extension.js'; export type * from './section.extension.js'; +export type * from './types.js'; + type UmbSectionExtensions = | ManifestSection | ManifestSectionRoute diff --git a/src/packages/core/extension-registry/interfaces/section-element.interface.ts b/src/packages/core/section/extensions/section-element.interface.ts similarity index 58% rename from src/packages/core/extension-registry/interfaces/section-element.interface.ts rename to src/packages/core/section/extensions/section-element.interface.ts index 60c3cbde49..acdd30f300 100644 --- a/src/packages/core/extension-registry/interfaces/section-element.interface.ts +++ b/src/packages/core/section/extensions/section-element.interface.ts @@ -1,4 +1,4 @@ -import type { ManifestSection } from '../models/index.js'; +import type { ManifestSection } from './section.extension.js'; export interface UmbSectionElement extends HTMLElement { manifest?: ManifestSection; diff --git a/src/packages/core/extension-registry/interfaces/section-sidebar-app-element.interface.ts b/src/packages/core/section/extensions/section-sidebar-app-element.interface.ts similarity index 56% rename from src/packages/core/extension-registry/interfaces/section-sidebar-app-element.interface.ts rename to src/packages/core/section/extensions/section-sidebar-app-element.interface.ts index a1c536af91..f2aa4e64a5 100644 --- a/src/packages/core/extension-registry/interfaces/section-sidebar-app-element.interface.ts +++ b/src/packages/core/section/extensions/section-sidebar-app-element.interface.ts @@ -1,4 +1,4 @@ -import type { ManifestSectionSidebarApp } from '../models/index.js'; +import type { ManifestSectionSidebarApp } from './section-sidebar-app.extension.js'; export interface UmbSectionSidebarAppElement extends HTMLElement { manifest?: ManifestSectionSidebarApp; diff --git a/src/packages/core/section/extensions/section-sidebar-app.extension.ts b/src/packages/core/section/extensions/section-sidebar-app.extension.ts index 8cf5037106..4c285eef8f 100644 --- a/src/packages/core/section/extensions/section-sidebar-app.extension.ts +++ b/src/packages/core/section/extensions/section-sidebar-app.extension.ts @@ -1,5 +1,5 @@ import type { ManifestElement, ManifestWithDynamicConditions } from '@umbraco-cms/backoffice/extension-api'; -import type { UmbSectionSidebarAppElement } from '@umbraco-cms/backoffice/extension-registry'; +import type { UmbSectionSidebarAppElement } from '@umbraco-cms/backoffice/section'; export interface ManifestSectionSidebarApp extends ManifestElement, diff --git a/src/packages/core/extension-registry/interfaces/section-view-element.interface.ts b/src/packages/core/section/extensions/section-view-element.interface.ts similarity index 57% rename from src/packages/core/extension-registry/interfaces/section-view-element.interface.ts rename to src/packages/core/section/extensions/section-view-element.interface.ts index c1f1c89908..16ffb0ede6 100644 --- a/src/packages/core/extension-registry/interfaces/section-view-element.interface.ts +++ b/src/packages/core/section/extensions/section-view-element.interface.ts @@ -1,4 +1,4 @@ -import type { ManifestSectionView } from '../models/index.js'; +import type { ManifestSectionView } from './section-view.extension.js'; export interface UmbSectionViewElement extends HTMLElement { manifest?: ManifestSectionView; diff --git a/src/packages/core/section/extensions/section-view.extension.ts b/src/packages/core/section/extensions/section-view.extension.ts index b96038133f..b3a349f68b 100644 --- a/src/packages/core/section/extensions/section-view.extension.ts +++ b/src/packages/core/section/extensions/section-view.extension.ts @@ -1,5 +1,5 @@ +import type { UmbSectionViewElement } from './section-view-element.interface.js'; import type { ManifestElement, ManifestWithDynamicConditions } from '@umbraco-cms/backoffice/extension-api'; -import type { UmbSectionViewElement } from '@umbraco-cms/backoffice/extension-registry'; export interface ManifestSectionView extends ManifestElement, diff --git a/src/packages/core/section/extensions/section.extension.ts b/src/packages/core/section/extensions/section.extension.ts index 5834f280ad..ad03c3127c 100644 --- a/src/packages/core/section/extensions/section.extension.ts +++ b/src/packages/core/section/extensions/section.extension.ts @@ -1,5 +1,5 @@ +import type { UmbSectionElement } from './section-element.interface.js'; import type { ManifestElement, ManifestWithDynamicConditions } from '@umbraco-cms/backoffice/extension-api'; -import type { UmbSectionElement } from '@umbraco-cms/backoffice/extension-registry'; export interface ManifestSection extends ManifestElement, diff --git a/src/packages/core/section/extensions/types.ts b/src/packages/core/section/extensions/types.ts new file mode 100644 index 0000000000..028e21bc99 --- /dev/null +++ b/src/packages/core/section/extensions/types.ts @@ -0,0 +1,3 @@ +export type * from './section-element.interface.js'; +export type * from './section-sidebar-app-element.interface.js'; +export type * from './section-view-element.interface.js'; diff --git a/src/packages/core/section/repository/item/section-item.repository.ts b/src/packages/core/section/repository/item/section-item.repository.ts index ab02e50c20..6fabc37930 100644 --- a/src/packages/core/section/repository/item/section-item.repository.ts +++ b/src/packages/core/section/repository/item/section-item.repository.ts @@ -2,7 +2,7 @@ import type { UmbSectionItemModel } from './types.js'; import type { UmbControllerHost } from '@umbraco-cms/backoffice/controller-api'; import type { UmbItemRepository } from '@umbraco-cms/backoffice/repository'; import { UmbRepositoryBase } from '@umbraco-cms/backoffice/repository'; -import type { ManifestSection } from '@umbraco-cms/backoffice/extension-registry'; +import type { ManifestSection } from '@umbraco-cms/backoffice/section'; import { umbExtensionsRegistry } from '@umbraco-cms/backoffice/extension-registry'; import { createObservablePart } from '@umbraco-cms/backoffice/observable-api'; diff --git a/src/packages/core/section/repository/item/types.ts b/src/packages/core/section/repository/item/types.ts index 8da7a576e9..44c7b14b68 100644 --- a/src/packages/core/section/repository/item/types.ts +++ b/src/packages/core/section/repository/item/types.ts @@ -1,4 +1,4 @@ -import type { ManifestSection } from '@umbraco-cms/backoffice/extension-registry'; +import type { ManifestSection } from '@umbraco-cms/backoffice/section'; export interface UmbSectionItemModel extends ManifestSection { unique: string; diff --git a/src/packages/core/section/section-default.element.ts b/src/packages/core/section/section-default.element.ts index 640257413e..d34be38ab4 100644 --- a/src/packages/core/section/section-default.element.ts +++ b/src/packages/core/section/section-default.element.ts @@ -1,13 +1,13 @@ import type { ManifestSectionRoute } from './extensions/section-route.extension.js'; import type { UmbSectionMainViewElement } from './section-main-views/section-main-views.element.js'; -import { UmbTextStyles } from '@umbraco-cms/backoffice/style'; -import { css, html, nothing, customElement, property, state, repeat } from '@umbraco-cms/backoffice/external/lit'; import type { ManifestSection, ManifestSectionSidebarApp, ManifestSectionSidebarAppMenuKind, UmbSectionElement, -} from '@umbraco-cms/backoffice/extension-registry'; +} from './types.js'; +import { UmbTextStyles } from '@umbraco-cms/backoffice/style'; +import { css, html, nothing, customElement, property, state, repeat } from '@umbraco-cms/backoffice/external/lit'; import { umbExtensionsRegistry } from '@umbraco-cms/backoffice/extension-registry'; import type { IRoute, IRoutingInfo, PageComponent, UmbRoute } from '@umbraco-cms/backoffice/router'; import { UmbLitElement } from '@umbraco-cms/backoffice/lit-element'; diff --git a/src/packages/core/section/section-main-views/section-main-views.element.ts b/src/packages/core/section/section-main-views/section-main-views.element.ts index 2db690f7de..55ff31fc88 100644 --- a/src/packages/core/section/section-main-views/section-main-views.element.ts +++ b/src/packages/core/section/section-main-views/section-main-views.element.ts @@ -1,12 +1,8 @@ +import type { ManifestSectionView, UmbSectionViewElement } from '../extensions/index.js'; import { UmbTextStyles } from '@umbraco-cms/backoffice/style'; import { css, html, nothing, customElement, property, state } from '@umbraco-cms/backoffice/external/lit'; import type { UmbRoute, UmbRouterSlotChangeEvent, UmbRouterSlotInitEvent } from '@umbraco-cms/backoffice/router'; -import type { - ManifestDashboard, - ManifestSectionView, - UmbDashboardElement, - UmbSectionViewElement, -} from '@umbraco-cms/backoffice/extension-registry'; +import type { ManifestDashboard, UmbDashboardElement } from '@umbraco-cms/backoffice/extension-registry'; import { umbExtensionsRegistry } from '@umbraco-cms/backoffice/extension-registry'; import { UmbExtensionsManifestInitializer, createExtensionElement } from '@umbraco-cms/backoffice/extension-api'; import { UmbLitElement } from '@umbraco-cms/backoffice/lit-element'; diff --git a/src/packages/core/section/section-picker-modal/section-picker-modal.element.ts b/src/packages/core/section/section-picker-modal/section-picker-modal.element.ts index 2e7b019b81..bce08c4a13 100644 --- a/src/packages/core/section/section-picker-modal/section-picker-modal.element.ts +++ b/src/packages/core/section/section-picker-modal/section-picker-modal.element.ts @@ -1,7 +1,7 @@ import type { UmbSectionPickerModalData, UmbSectionPickerModalValue } from './section-picker-modal.token.js'; import { html, customElement, state } from '@umbraco-cms/backoffice/external/lit'; import { UmbSelectionManager } from '@umbraco-cms/backoffice/utils'; -import type { ManifestSection } from '@umbraco-cms/backoffice/extension-registry'; +import type { ManifestSection } from '@umbraco-cms/backoffice/section'; import { umbExtensionsRegistry } from '@umbraco-cms/backoffice/extension-registry'; import { UmbModalBaseElement } from '@umbraco-cms/backoffice/modal'; diff --git a/src/packages/core/section/section-sidebar-menu-with-entity-actions/section-sidebar-menu-with-entity-actions.element.ts b/src/packages/core/section/section-sidebar-menu-with-entity-actions/section-sidebar-menu-with-entity-actions.element.ts index ff659a7411..4141de2722 100644 --- a/src/packages/core/section/section-sidebar-menu-with-entity-actions/section-sidebar-menu-with-entity-actions.element.ts +++ b/src/packages/core/section/section-sidebar-menu-with-entity-actions/section-sidebar-menu-with-entity-actions.element.ts @@ -1,9 +1,7 @@ import { UmbSectionSidebarMenuElement } from '../section-sidebar-menu/section-sidebar-menu.element.js'; +import type { ManifestSectionSidebarAppMenuWithEntityActionsKind } from '../types.js'; import { css, html, customElement } from '@umbraco-cms/backoffice/external/lit'; -import type { - ManifestSectionSidebarAppMenuWithEntityActionsKind, - UmbExtensionManifestKind, -} from '@umbraco-cms/backoffice/extension-registry'; +import type { UmbExtensionManifestKind } from '@umbraco-cms/backoffice/extension-registry'; import { umbExtensionsRegistry } from '@umbraco-cms/backoffice/extension-registry'; const manifestWithEntityActions: UmbExtensionManifestKind = { diff --git a/src/packages/core/section/section-sidebar-menu/section-sidebar-menu.element.ts b/src/packages/core/section/section-sidebar-menu/section-sidebar-menu.element.ts index e7dff9272b..8cc7911bcc 100644 --- a/src/packages/core/section/section-sidebar-menu/section-sidebar-menu.element.ts +++ b/src/packages/core/section/section-sidebar-menu/section-sidebar-menu.element.ts @@ -1,11 +1,7 @@ +import type { ManifestSectionSidebarAppBaseMenu, ManifestSectionSidebarAppMenuKind } from '../types.js'; import { UmbTextStyles } from '@umbraco-cms/backoffice/style'; import { css, html, customElement, property } from '@umbraco-cms/backoffice/external/lit'; -import type { - ManifestMenu, - ManifestSectionSidebarAppBaseMenu, - ManifestSectionSidebarAppMenuKind, - UmbExtensionManifestKind, -} from '@umbraco-cms/backoffice/extension-registry'; +import type { ManifestMenu, UmbExtensionManifestKind } from '@umbraco-cms/backoffice/extension-registry'; import { umbExtensionsRegistry } from '@umbraco-cms/backoffice/extension-registry'; import { UmbLitElement } from '@umbraco-cms/backoffice/lit-element'; diff --git a/src/packages/core/section/section.context.ts b/src/packages/core/section/section.context.ts index 799ca5e0af..9a69f2ecab 100644 --- a/src/packages/core/section/section.context.ts +++ b/src/packages/core/section/section.context.ts @@ -1,4 +1,4 @@ -import type { ManifestSection } from '@umbraco-cms/backoffice/extension-registry'; +import type { ManifestSection } from '@umbraco-cms/backoffice/section'; import { UmbStringState } from '@umbraco-cms/backoffice/observable-api'; import { UmbContextToken } from '@umbraco-cms/backoffice/context-api'; diff --git a/src/packages/core/section/types.ts b/src/packages/core/section/types.ts index f28780c132..c2f8368cf9 100644 --- a/src/packages/core/section/types.ts +++ b/src/packages/core/section/types.ts @@ -1 +1,2 @@ export type * from './conditions/types.js'; +export type * from './extensions/index.js'; diff --git a/src/packages/members/section/manifests.ts b/src/packages/members/section/manifests.ts index 9837f42009..f4e22eb398 100644 --- a/src/packages/members/section/manifests.ts +++ b/src/packages/members/section/manifests.ts @@ -1,9 +1,9 @@ import { UMB_MEMBER_MANAGEMENT_SECTION_ALIAS } from './constants.js'; import { manifests as sectionSidebarAppManifests } from './sidebar-app/manifests.js'; import { manifests as menuManifests } from './menu/manifests.js'; -import type { ManifestSection, UmbExtensionManifestKind } from '@umbraco-cms/backoffice/extension-registry'; +import type { UmbExtensionManifestKind } from '@umbraco-cms/backoffice/extension-registry'; -const section: ManifestSection = { +const section: UmbExtensionManifest = { type: 'section', alias: UMB_MEMBER_MANAGEMENT_SECTION_ALIAS, name: 'Members Section', diff --git a/src/packages/packages/package-section/views/created/created-packages-section-view.element.ts b/src/packages/packages/package-section/views/created/created-packages-section-view.element.ts index 80e7b597ce..f8921ed5d0 100644 --- a/src/packages/packages/package-section/views/created/created-packages-section-view.element.ts +++ b/src/packages/packages/package-section/views/created/created-packages-section-view.element.ts @@ -2,7 +2,7 @@ import { html, customElement, state } from '@umbraco-cms/backoffice/external/lit import { createExtensionElement } from '@umbraco-cms/backoffice/extension-api'; import { umbExtensionsRegistry } from '@umbraco-cms/backoffice/extension-registry'; import { UmbLitElement } from '@umbraco-cms/backoffice/lit-element'; -import type { UmbSectionViewElement } from '@umbraco-cms/backoffice/extension-registry'; +import type { UmbSectionViewElement } from '@umbraco-cms/backoffice/section'; import type { ManifestWorkspace } from '@umbraco-cms/backoffice/workspace'; import type { UmbRoute } from '@umbraco-cms/backoffice/router'; diff --git a/src/packages/packages/package-section/views/installed/installed-packages-section-view.element.ts b/src/packages/packages/package-section/views/installed/installed-packages-section-view.element.ts index 7777865e09..699300d35c 100644 --- a/src/packages/packages/package-section/views/installed/installed-packages-section-view.element.ts +++ b/src/packages/packages/package-section/views/installed/installed-packages-section-view.element.ts @@ -4,7 +4,7 @@ import { html, css, customElement, state, repeat, nothing, unsafeHTML } from '@u import { observeMultiple } from '@umbraco-cms/backoffice/observable-api'; import { UmbLitElement } from '@umbraco-cms/backoffice/lit-element'; import { UmbTextStyles } from '@umbraco-cms/backoffice/style'; -import type { UmbSectionViewElement } from '@umbraco-cms/backoffice/extension-registry'; +import type { UmbSectionViewElement } from '@umbraco-cms/backoffice/section'; import './installed-packages-section-view-item.element.js'; diff --git a/src/packages/packages/package-section/views/marketplace/packages-marketplace-section-view.element.ts b/src/packages/packages/package-section/views/marketplace/packages-marketplace-section-view.element.ts index 045d4d7ebd..8ec10063cf 100644 --- a/src/packages/packages/package-section/views/marketplace/packages-marketplace-section-view.element.ts +++ b/src/packages/packages/package-section/views/marketplace/packages-marketplace-section-view.element.ts @@ -1,7 +1,7 @@ import { css, html, customElement, state } from '@umbraco-cms/backoffice/external/lit'; import { UmbLitElement } from '@umbraco-cms/backoffice/lit-element'; import { UmbPackageRepository } from '@umbraco-cms/backoffice/package'; -import type { UmbSectionViewElement } from '@umbraco-cms/backoffice/extension-registry'; +import type { UmbSectionViewElement } from '@umbraco-cms/backoffice/section'; @customElement('umb-packages-marketplace-section-view') export class UmbPackagesMarketplaceSectionViewElement extends UmbLitElement implements UmbSectionViewElement { From dbebc3b1f2cd9bc4b624bd24dabbdc0e4d3e201c Mon Sep 17 00:00:00 2001 From: Mads Rasmussen Date: Mon, 30 Sep 2024 07:45:47 +0200 Subject: [PATCH 3/3] move menu kind to menu module --- .../index.ts | 0 ...idebar-menu-with-entity-actions.element.ts | 2 +- ...idebar-menu-with-entity-actions.stories.ts | 0 .../section-sidebar-menu/index.ts | 0 .../section-sidebar-menu.element.ts | 2 +- .../section-sidebar-menu.stories.ts | 0 .../core/menu/section-sidebar-menu/types.ts | 26 +++++++++++++++++++ src/packages/core/section/extensions/index.ts | 9 ++----- .../section-sidebar-app.extension.ts | 25 ------------------ src/packages/core/section/index.ts | 4 +-- .../core/section/section-default.element.ts | 11 ++------ 11 files changed, 34 insertions(+), 45 deletions(-) rename src/packages/core/{section => menu}/section-sidebar-menu-with-entity-actions/index.ts (100%) rename src/packages/core/{section => menu}/section-sidebar-menu-with-entity-actions/section-sidebar-menu-with-entity-actions.element.ts (97%) rename src/packages/core/{section => menu}/section-sidebar-menu-with-entity-actions/section-sidebar-menu-with-entity-actions.stories.ts (100%) rename src/packages/core/{section => menu}/section-sidebar-menu/index.ts (100%) rename src/packages/core/{section => menu}/section-sidebar-menu/section-sidebar-menu.element.ts (97%) rename src/packages/core/{section => menu}/section-sidebar-menu/section-sidebar-menu.stories.ts (100%) create mode 100644 src/packages/core/menu/section-sidebar-menu/types.ts diff --git a/src/packages/core/section/section-sidebar-menu-with-entity-actions/index.ts b/src/packages/core/menu/section-sidebar-menu-with-entity-actions/index.ts similarity index 100% rename from src/packages/core/section/section-sidebar-menu-with-entity-actions/index.ts rename to src/packages/core/menu/section-sidebar-menu-with-entity-actions/index.ts diff --git a/src/packages/core/section/section-sidebar-menu-with-entity-actions/section-sidebar-menu-with-entity-actions.element.ts b/src/packages/core/menu/section-sidebar-menu-with-entity-actions/section-sidebar-menu-with-entity-actions.element.ts similarity index 97% rename from src/packages/core/section/section-sidebar-menu-with-entity-actions/section-sidebar-menu-with-entity-actions.element.ts rename to src/packages/core/menu/section-sidebar-menu-with-entity-actions/section-sidebar-menu-with-entity-actions.element.ts index 4141de2722..d54c73fa52 100644 --- a/src/packages/core/section/section-sidebar-menu-with-entity-actions/section-sidebar-menu-with-entity-actions.element.ts +++ b/src/packages/core/menu/section-sidebar-menu-with-entity-actions/section-sidebar-menu-with-entity-actions.element.ts @@ -1,5 +1,5 @@ import { UmbSectionSidebarMenuElement } from '../section-sidebar-menu/section-sidebar-menu.element.js'; -import type { ManifestSectionSidebarAppMenuWithEntityActionsKind } from '../types.js'; +import type { ManifestSectionSidebarAppMenuWithEntityActionsKind } from '../section-sidebar-menu/types.js'; import { css, html, customElement } from '@umbraco-cms/backoffice/external/lit'; import type { UmbExtensionManifestKind } from '@umbraco-cms/backoffice/extension-registry'; import { umbExtensionsRegistry } from '@umbraco-cms/backoffice/extension-registry'; diff --git a/src/packages/core/section/section-sidebar-menu-with-entity-actions/section-sidebar-menu-with-entity-actions.stories.ts b/src/packages/core/menu/section-sidebar-menu-with-entity-actions/section-sidebar-menu-with-entity-actions.stories.ts similarity index 100% rename from src/packages/core/section/section-sidebar-menu-with-entity-actions/section-sidebar-menu-with-entity-actions.stories.ts rename to src/packages/core/menu/section-sidebar-menu-with-entity-actions/section-sidebar-menu-with-entity-actions.stories.ts diff --git a/src/packages/core/section/section-sidebar-menu/index.ts b/src/packages/core/menu/section-sidebar-menu/index.ts similarity index 100% rename from src/packages/core/section/section-sidebar-menu/index.ts rename to src/packages/core/menu/section-sidebar-menu/index.ts diff --git a/src/packages/core/section/section-sidebar-menu/section-sidebar-menu.element.ts b/src/packages/core/menu/section-sidebar-menu/section-sidebar-menu.element.ts similarity index 97% rename from src/packages/core/section/section-sidebar-menu/section-sidebar-menu.element.ts rename to src/packages/core/menu/section-sidebar-menu/section-sidebar-menu.element.ts index 8cc7911bcc..bdad6c3b03 100644 --- a/src/packages/core/section/section-sidebar-menu/section-sidebar-menu.element.ts +++ b/src/packages/core/menu/section-sidebar-menu/section-sidebar-menu.element.ts @@ -1,4 +1,4 @@ -import type { ManifestSectionSidebarAppBaseMenu, ManifestSectionSidebarAppMenuKind } from '../types.js'; +import type { ManifestSectionSidebarAppBaseMenu, ManifestSectionSidebarAppMenuKind } from './types.js'; import { UmbTextStyles } from '@umbraco-cms/backoffice/style'; import { css, html, customElement, property } from '@umbraco-cms/backoffice/external/lit'; import type { ManifestMenu, UmbExtensionManifestKind } from '@umbraco-cms/backoffice/extension-registry'; diff --git a/src/packages/core/section/section-sidebar-menu/section-sidebar-menu.stories.ts b/src/packages/core/menu/section-sidebar-menu/section-sidebar-menu.stories.ts similarity index 100% rename from src/packages/core/section/section-sidebar-menu/section-sidebar-menu.stories.ts rename to src/packages/core/menu/section-sidebar-menu/section-sidebar-menu.stories.ts diff --git a/src/packages/core/menu/section-sidebar-menu/types.ts b/src/packages/core/menu/section-sidebar-menu/types.ts new file mode 100644 index 0000000000..af00746daf --- /dev/null +++ b/src/packages/core/menu/section-sidebar-menu/types.ts @@ -0,0 +1,26 @@ +import type { ManifestSectionSidebarApp } from '@umbraco-cms/backoffice/section'; + +export interface MetaSectionSidebarAppMenuKind { + label: string; + menu: string; +} + +export interface ManifestSectionSidebarAppBaseMenu extends ManifestSectionSidebarApp { + type: 'sectionSidebarApp'; + meta: MetaSectionSidebarAppMenuKind; +} + +export interface ManifestSectionSidebarAppMenuKind extends ManifestSectionSidebarAppBaseMenu { + type: 'sectionSidebarApp'; + kind: 'menu'; +} + +export interface ManifestSectionSidebarAppMenuWithEntityActionsKind extends ManifestSectionSidebarAppBaseMenu { + type: 'sectionSidebarApp'; + kind: 'menuWithEntityActions'; + meta: MetaSectionSidebarAppMenuWithEntityActionsKind; +} + +export interface MetaSectionSidebarAppMenuWithEntityActionsKind extends MetaSectionSidebarAppMenuKind { + entityType: string; +} diff --git a/src/packages/core/section/extensions/index.ts b/src/packages/core/section/extensions/index.ts index 9a8529d636..7e9361b328 100644 --- a/src/packages/core/section/extensions/index.ts +++ b/src/packages/core/section/extensions/index.ts @@ -1,5 +1,5 @@ import type { ManifestSectionRoute } from './section-route.extension.js'; -import type { ManifestSectionSidebarApp, ManifestSectionSidebarAppMenuKind } from './section-sidebar-app.extension.js'; +import type { ManifestSectionSidebarApp } from './section-sidebar-app.extension.js'; import type { ManifestSectionView } from './section-view.extension.js'; import type { ManifestSection } from './section.extension.js'; @@ -10,12 +10,7 @@ export type * from './section.extension.js'; export type * from './types.js'; -type UmbSectionExtensions = - | ManifestSection - | ManifestSectionRoute - | ManifestSectionSidebarApp - | ManifestSectionSidebarAppMenuKind - | ManifestSectionView; +type UmbSectionExtensions = ManifestSection | ManifestSectionRoute | ManifestSectionSidebarApp | ManifestSectionView; declare global { interface UmbExtensionManifestMap { diff --git a/src/packages/core/section/extensions/section-sidebar-app.extension.ts b/src/packages/core/section/extensions/section-sidebar-app.extension.ts index 4c285eef8f..37976a0105 100644 --- a/src/packages/core/section/extensions/section-sidebar-app.extension.ts +++ b/src/packages/core/section/extensions/section-sidebar-app.extension.ts @@ -6,28 +6,3 @@ export interface ManifestSectionSidebarApp ManifestWithDynamicConditions { type: 'sectionSidebarApp'; } - -export interface ManifestSectionSidebarAppBaseMenu extends ManifestSectionSidebarApp { - type: 'sectionSidebarApp'; - meta: MetaSectionSidebarAppMenuKind; -} - -export interface ManifestSectionSidebarAppMenuKind extends ManifestSectionSidebarAppBaseMenu { - type: 'sectionSidebarApp'; - kind: 'menu'; -} - -export interface MetaSectionSidebarAppMenuKind { - label: string; - menu: string; -} - -export interface ManifestSectionSidebarAppMenuWithEntityActionsKind extends ManifestSectionSidebarAppBaseMenu { - type: 'sectionSidebarApp'; - kind: 'menuWithEntityActions'; - meta: MetaSectionSidebarAppMenuWithEntityActionsKind; -} - -export interface MetaSectionSidebarAppMenuWithEntityActionsKind extends MetaSectionSidebarAppMenuKind { - entityType: string; -} diff --git a/src/packages/core/section/index.ts b/src/packages/core/section/index.ts index 1da6d056ac..79b9ce08f6 100644 --- a/src/packages/core/section/index.ts +++ b/src/packages/core/section/index.ts @@ -4,8 +4,8 @@ export * from './section-default.element.js'; export * from './section-main/index.js'; export * from './section-picker-modal/section-picker-modal.token.js'; export * from './section-sidebar-context-menu/index.js'; -export * from './section-sidebar-menu-with-entity-actions/index.js'; -export * from './section-sidebar-menu/index.js'; +export * from '../menu/section-sidebar-menu-with-entity-actions/index.js'; +export * from '../menu/section-sidebar-menu/index.js'; export * from './section-sidebar/index.js'; export * from './section.context.js'; export type * from './types.js'; diff --git a/src/packages/core/section/section-default.element.ts b/src/packages/core/section/section-default.element.ts index d34be38ab4..da8dd211d6 100644 --- a/src/packages/core/section/section-default.element.ts +++ b/src/packages/core/section/section-default.element.ts @@ -1,11 +1,6 @@ import type { ManifestSectionRoute } from './extensions/section-route.extension.js'; import type { UmbSectionMainViewElement } from './section-main-views/section-main-views.element.js'; -import type { - ManifestSection, - ManifestSectionSidebarApp, - ManifestSectionSidebarAppMenuKind, - UmbSectionElement, -} from './types.js'; +import type { ManifestSection, UmbSectionElement } from './types.js'; import { UmbTextStyles } from '@umbraco-cms/backoffice/style'; import { css, html, nothing, customElement, property, state, repeat } from '@umbraco-cms/backoffice/external/lit'; import { umbExtensionsRegistry } from '@umbraco-cms/backoffice/extension-registry'; @@ -44,9 +39,7 @@ export class UmbSectionDefaultElement extends UmbLitElement implements UmbSectio private _routes?: Array; @state() - private _sidebarApps?: Array< - UmbExtensionElementInitializer - >; + private _sidebarApps?: Array>; @state() _splitPanelPosition = '300px';