Skip to content

Commit

Permalink
Merge pull request #2355 from umbraco/v15/feature/emm-section
Browse files Browse the repository at this point in the history
Extension Manifest Map: Cection
  • Loading branch information
nielslyngsoe authored Sep 30, 2024
2 parents e0a2aa0 + 68c34ee commit f608ded
Show file tree
Hide file tree
Showing 35 changed files with 68 additions and 74 deletions.
2 changes: 1 addition & 1 deletion src/apps/backoffice/backoffice.context.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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';

Expand Down
2 changes: 1 addition & 1 deletion src/apps/backoffice/components/backoffice-main.element.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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) {}
Expand Down
3 changes: 0 additions & 3 deletions src/packages/core/extension-registry/interfaces/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,3 @@ export * from './dashboard-element.interface.js';
export * from './external-login-provider-element.interface.js';
export * from './file-upload-preview.interface.js';
export * from './menu-item-element.interface.js';
export * from './section-element.interface.js';
export * from './section-sidebar-app-element.interface.js';
export * from './section-view-element.interface.js';
12 changes: 0 additions & 12 deletions src/packages/core/extension-registry/models/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,6 @@ import type { ManifestMenu } from './menu.model.js';
import type { ManifestMenuItem, ManifestMenuItemLinkKind, ManifestMenuItemTreeKind } from './menu-item.model.js';
import type { ManifestPreviewAppProvider } from './preview-app.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 { ManifestTinyMcePlugin } from './tinymce-plugin.model.js';
import type { ManifestUfmComponent } from './ufm-component.model.js';
Expand All @@ -45,7 +42,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';

Expand Down Expand Up @@ -73,9 +69,6 @@ export type * from './monaco-markdown-editor-action.model.js';
export type * from './picker-search-result-item.model.js';
export type * from './preview-app.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 './tinymce-plugin.model.js';
export type * from './ufm-component.model.js';
Expand Down Expand Up @@ -133,11 +126,6 @@ export type ManifestTypes =
| ManifestPickerSearchResultItem
| ManifestPreviewAppProvider
| ManifestRepository
| ManifestSection
| ManifestSectionRoute
| ManifestSectionSidebarApp
| ManifestSectionSidebarAppMenuKind
| ManifestSectionView
| ManifestStore
| ManifestTinyMcePlugin
| ManifestTreeStore
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
import { UmbSectionSidebarMenuElement } from '../section-sidebar-menu/section-sidebar-menu.element.js';
import type { ManifestSectionSidebarAppMenuWithEntityActionsKind } from '../section-sidebar-menu/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 = {
Expand Down
Original file line number Diff line number Diff line change
@@ -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';

Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,8 @@
import type { UmbSectionSidebarAppElement } from '../interfaces/section-sidebar-app-element.interface.js';
import type { ManifestElement, ManifestWithDynamicConditions } from '@umbraco-cms/backoffice/extension-api';
import type { ManifestSectionSidebarApp } from '@umbraco-cms/backoffice/section';

export interface ManifestSectionSidebarApp
extends ManifestElement<UmbSectionSidebarAppElement>,
ManifestWithDynamicConditions<UmbExtensionCondition> {
type: 'sectionSidebarApp';
export interface MetaSectionSidebarAppMenuKind {
label: string;
menu: string;
}

export interface ManifestSectionSidebarAppBaseMenu extends ManifestSectionSidebarApp {
Expand All @@ -17,11 +15,6 @@ export interface ManifestSectionSidebarAppMenuKind extends ManifestSectionSideba
kind: 'menu';
}

export interface MetaSectionSidebarAppMenuKind {
label: string;
menu: string;
}

export interface ManifestSectionSidebarAppMenuWithEntityActionsKind extends ManifestSectionSidebarAppBaseMenu {
type: 'sectionSidebarApp';
kind: 'menuWithEntityActions';
Expand Down
19 changes: 19 additions & 0 deletions src/packages/core/section/extensions/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
import type { ManifestSectionRoute } from './section-route.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';

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';

export type * from './types.js';

type UmbSectionExtensions = ManifestSection | ManifestSectionRoute | ManifestSectionSidebarApp | ManifestSectionView;

declare global {
interface UmbExtensionManifestMap {
UmbSectionExtensions: UmbSectionExtensions;
}
}
Original file line number Diff line number Diff line change
@@ -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;
Expand Down
Original file line number Diff line number Diff line change
@@ -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<UmbControllerHostElement, UmbRouteEntry> {
type: 'sectionRoute';
Expand Down
Original file line number Diff line number Diff line change
@@ -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;
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
import type { ManifestElement, ManifestWithDynamicConditions } from '@umbraco-cms/backoffice/extension-api';
import type { UmbSectionSidebarAppElement } from '@umbraco-cms/backoffice/section';

export interface ManifestSectionSidebarApp
extends ManifestElement<UmbSectionSidebarAppElement>,
ManifestWithDynamicConditions<UmbExtensionCondition> {
type: 'sectionSidebarApp';
}
Original file line number Diff line number Diff line change
@@ -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;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import type { UmbSectionViewElement } from '../interfaces/section-view-element.interface.js';
import type { UmbSectionViewElement } from './section-view-element.interface.js';
import type { ManifestElement, ManifestWithDynamicConditions } from '@umbraco-cms/backoffice/extension-api';

export interface ManifestSectionView
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import type { UmbSectionElement } from '../interfaces/index.js';
import type { UmbSectionElement } from './section-element.interface.js';
import type { ManifestElement, ManifestWithDynamicConditions } from '@umbraco-cms/backoffice/extension-api';

export interface ManifestSection
Expand Down
3 changes: 3 additions & 0 deletions src/packages/core/section/extensions/types.ts
Original file line number Diff line number Diff line change
@@ -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';
4 changes: 2 additions & 2 deletions src/packages/core/section/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Original file line number Diff line number Diff line change
Expand Up @@ -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';

Expand Down
2 changes: 1 addition & 1 deletion src/packages/core/section/repository/item/types.ts
Original file line number Diff line number Diff line change
@@ -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;
Expand Down
13 changes: 3 additions & 10 deletions src/packages/core/section/section-default.element.ts
Original file line number Diff line number Diff line change
@@ -1,13 +1,8 @@
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 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 type {
ManifestSection,
ManifestSectionSidebarApp,
ManifestSectionSidebarAppMenuKind,
UmbSectionElement,
} from '@umbraco-cms/backoffice/extension-registry';
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';
Expand Down Expand Up @@ -44,9 +39,7 @@ export class UmbSectionDefaultElement extends UmbLitElement implements UmbSectio
private _routes?: Array<UmbRoute>;

@state()
private _sidebarApps?: Array<
UmbExtensionElementInitializer<ManifestSectionSidebarApp | ManifestSectionSidebarAppMenuKind>
>;
private _sidebarApps?: Array<UmbExtensionElementInitializer<any>>;

@state()
_splitPanelPosition = '300px';
Expand Down
Original file line number Diff line number Diff line change
@@ -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';
Expand Down
Original file line number Diff line number Diff line change
@@ -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';

Expand Down
2 changes: 1 addition & 1 deletion src/packages/core/section/section.context.ts
Original file line number Diff line number Diff line change
@@ -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';

Expand Down
1 change: 1 addition & 0 deletions src/packages/core/section/types.ts
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
export type * from './conditions/types.js';
export type * from './extensions/index.js';
4 changes: 2 additions & 2 deletions src/packages/members/section/manifests.ts
Original file line number Diff line number Diff line change
@@ -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',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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';

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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';

Expand Down
Original file line number Diff line number Diff line change
@@ -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 {
Expand Down

0 comments on commit f608ded

Please sign in to comment.