diff --git a/examples/block-custom-view/block-custom-view.ts b/examples/block-custom-view/block-custom-view.ts index e564f537a6..78de43087d 100644 --- a/examples/block-custom-view/block-custom-view.ts +++ b/examples/block-custom-view/block-custom-view.ts @@ -1,7 +1,8 @@ import { UmbTextStyles } from '@umbraco-cms/backoffice/style'; import { html, customElement, LitElement, property, css } from '@umbraco-cms/backoffice/external/lit'; import { UmbElementMixin } from '@umbraco-cms/backoffice/element-api'; -import type { UmbBlockDataType, UmbBlockEditorCustomViewElement } from '@umbraco-cms/backoffice/extension-registry'; +import type { UmbBlockDataType } from '@umbraco-cms/backoffice/block'; +import type { UmbBlockEditorCustomViewElement } from '@umbraco-cms/backoffice/block-custom-view'; // eslint-disable-next-line local-rules/enforce-umb-prefix-on-element-name @customElement('example-block-custom-view') diff --git a/examples/block-custom-view/index.ts b/examples/block-custom-view/index.ts index da81e169ac..9bf95dc267 100644 --- a/examples/block-custom-view/index.ts +++ b/examples/block-custom-view/index.ts @@ -1,6 +1,4 @@ -import type { ManifestBlockEditorCustomView } from '@umbraco-cms/backoffice/extension-registry'; - -export const manifests: Array = [ +export const manifests: Array = [ { type: 'blockEditorCustomView', alias: 'Umb.blockEditorCustomView.TestView', diff --git a/package.json b/package.json index a522d9d100..40890bb7e1 100644 --- a/package.json +++ b/package.json @@ -17,6 +17,7 @@ "./action": "./dist-cms/packages/core/action/index.js", "./audit-log": "./dist-cms/packages/core/audit-log/index.js", "./auth": "./dist-cms/packages/core/auth/index.js", + "./block-custom-view": "./dist-cms/packages/block/block-custom-view/index.js", "./block-grid": "./dist-cms/packages/block/block-grid/index.js", "./block-list": "./dist-cms/packages/block/block-list/index.js", "./block-rte": "./dist-cms/packages/block/block-rte/index.js", diff --git a/src/libs/extension-api/models/extension-api.interface.ts b/src/libs/extension-api/models/extension-api.interface.ts new file mode 100644 index 0000000000..0183b99fe1 --- /dev/null +++ b/src/libs/extension-api/models/extension-api.interface.ts @@ -0,0 +1,9 @@ +import type { ManifestBase } from '../types/index.js'; +import type { UmbApi } from './api.interface.js'; + +/** + * Interface for APIs of a Extension. + */ +export interface UmbExtensionApi extends UmbApi { + manifest?: ManifestType; +} diff --git a/src/libs/extension-api/models/index.ts b/src/libs/extension-api/models/index.ts index bb52c4681d..45548d385c 100644 --- a/src/libs/extension-api/models/index.ts +++ b/src/libs/extension-api/models/index.ts @@ -1,2 +1,3 @@ export * from './entry-point.interface.js'; export * from './api.interface.js'; +export * from './extension-api.interface.js'; diff --git a/src/libs/extension-api/registry/extension.registry.ts b/src/libs/extension-api/registry/extension.registry.ts index e1535825a4..6ff5762ca7 100644 --- a/src/libs/extension-api/registry/extension.registry.ts +++ b/src/libs/extension-api/registry/extension.registry.ts @@ -11,8 +11,9 @@ import { map, distinctUntilChanged, combineLatest, of, switchMap } from '@umbrac /** * - * @param previousValue - * @param currentValue + * @param previousValue {Array} - previous value + * @param currentValue {Array} - current value + * @returns {boolean} - true if value is assumed to be the same as previous value. */ function extensionArrayMemoization>( previousValue: Array, @@ -31,8 +32,9 @@ function extensionArrayMemoization>( /** * - * @param previousValue - * @param currentValue + * @param previousValue {Array} - previous value + * @param currentValue {Array} - current value + * @returns {boolean} - true if value is assumed to be the same as previous value. */ function extensionAndKindMatchArrayMemoization< T extends Pick & { __isMatchedWithKind?: boolean }, @@ -62,8 +64,9 @@ function extensionAndKindMatchArrayMemoization< /** * - * @param previousValue - * @param currentValue + * @param previousValue {Array} - previous value + * @param currentValue {Array} - current value + * @returns {boolean} - true if value is assumed to be the same as previous value. */ function extensionSingleMemoization>( previousValue: T | undefined, @@ -77,8 +80,9 @@ function extensionSingleMemoization>( /** * - * @param previousValue - * @param currentValue + * @param previousValue {Array} - previous value + * @param currentValue {Array} - current value + * @returns {boolean} - true if value is assumed to be the same as previous value. */ function extensionAndKindMatchSingleMemoization< T extends Pick & { __isMatchedWithKind?: boolean }, diff --git a/src/libs/extension-api/types/manifest-bundle.interface.ts b/src/libs/extension-api/types/manifest-bundle.interface.ts index f0e62ede1b..9531fb9396 100644 --- a/src/libs/extension-api/types/manifest-bundle.interface.ts +++ b/src/libs/extension-api/types/manifest-bundle.interface.ts @@ -4,7 +4,7 @@ import type { ManifestBase } from './manifest-base.interface.js'; /** * This type of extension takes a JS module and registers all exported manifests from the pointed JS file. */ -export interface ManifestBundle - extends ManifestPlainJs<{ [key: string]: Array }> { +export interface ManifestBundle + extends ManifestPlainJs<{ [key: string]: Array }> { type: 'bundle'; } diff --git a/src/packages/core/extension-registry/models/block-editor-custom-view.model.ts b/src/packages/block/block-custom-view/block-editor-custom-view.extension.ts similarity index 61% rename from src/packages/core/extension-registry/models/block-editor-custom-view.model.ts rename to src/packages/block/block-custom-view/block-editor-custom-view.extension.ts index 55a8208789..2212ae53c1 100644 --- a/src/packages/core/extension-registry/models/block-editor-custom-view.model.ts +++ b/src/packages/block/block-custom-view/block-editor-custom-view.extension.ts @@ -1,20 +1,26 @@ -import type { UmbBlockEditorCustomViewElement } from '../interfaces/index.js'; +import type { UmbBlockEditorCustomViewElement } from './types.js'; import type { ManifestElement } from '@umbraco-cms/backoffice/extension-api'; export interface ManifestBlockEditorCustomView extends ManifestElement { type: 'blockEditorCustomView'; /** - * @property {string | Array } - Declare if this Custom View only must appear at specific Content Types by Alias. + * @property {string | Array } forContentTypeAlias - Declare if this Custom View only must appear at specific Content Types by Alias. * @description Optional condition if you like this custom view to only appear at for one or more specific Content Types. * @example 'my-element-type-alias' * @example ['my-element-type-alias-A', 'my-element-type-alias-B'] */ forContentTypeAlias?: string | Array; /** - * @property {string | Array } - Declare if this Custom View only must appear at specific Block Editors. + * @property {string | Array } forBlockEditor - Declare if this Custom View only must appear at specific Block Editors. * @description Optional condition if you like this custom view to only appear at a specific type of Block Editor. * @example 'block-list' * @example ['block-list', 'block-grid'] */ forBlockEditor?: string | Array; } + +declare global { + interface UmbExtensionManifestMap { + blockEditorCustomView: ManifestBlockEditorCustomView; + } +} diff --git a/src/packages/block/block-custom-view/index.ts b/src/packages/block/block-custom-view/index.ts new file mode 100644 index 0000000000..06c33f562f --- /dev/null +++ b/src/packages/block/block-custom-view/index.ts @@ -0,0 +1 @@ +export type * from './types.js'; diff --git a/src/packages/core/extension-registry/interfaces/block-editor-custom-view-element.interface.ts b/src/packages/block/block-custom-view/types.ts similarity index 57% rename from src/packages/core/extension-registry/interfaces/block-editor-custom-view-element.interface.ts rename to src/packages/block/block-custom-view/types.ts index 35ed551b97..63c13123f3 100644 --- a/src/packages/core/extension-registry/interfaces/block-editor-custom-view-element.interface.ts +++ b/src/packages/block/block-custom-view/types.ts @@ -1,29 +1,8 @@ -import type { ManifestBlockEditorCustomView } from '../index.js'; -import type { UUIModalSidebarSize } from '@umbraco-cms/backoffice/external/uui'; -// Shared with the Property Editor -export interface UmbBlockTypeBaseModel { - contentElementTypeKey: string; - settingsElementTypeKey?: string; - label?: string; - thumbnail?: string; - iconColor?: string; - backgroundColor?: string; - editorSize?: UUIModalSidebarSize; - forceHideContentEditorInOverlay: boolean; -} +import type { ManifestBlockEditorCustomView } from './block-editor-custom-view.extension.js'; +import type { UmbBlockLayoutBaseModel, UmbBlockDataType } from '@umbraco-cms/backoffice/block'; +import type { UmbBlockTypeBaseModel } from '@umbraco-cms/backoffice/block-type'; -// Shared with the Property Editor -export interface UmbBlockLayoutBaseModel { - contentUdi: string; - settingsUdi?: string | null; -} - -// Shared with the Property Editor -export interface UmbBlockDataType { - udi: string; - contentTypeKey: string; - [key: string]: unknown; -} +export type * from './block-editor-custom-view.extension.js'; export interface UmbBlockEditorCustomViewConfiguration { editContentPath?: string; diff --git a/src/packages/block/block-grid/components/block-grid-block-inline/block-grid-block-inline.element.ts b/src/packages/block/block-grid/components/block-grid-block-inline/block-grid-block-inline.element.ts index 08948600e1..076752e03a 100644 --- a/src/packages/block/block-grid/components/block-grid-block-inline/block-grid-block-inline.element.ts +++ b/src/packages/block/block-grid/components/block-grid-block-inline/block-grid-block-inline.element.ts @@ -3,9 +3,9 @@ import { UmbBlockGridInlinePropertyDatasetContext } from './block-grid-inline-pr import { UmbLitElement } from '@umbraco-cms/backoffice/lit-element'; import { css, customElement, html, property, state } from '@umbraco-cms/backoffice/external/lit'; import type { UmbPropertyTypeModel } from '@umbraco-cms/backoffice/content-type'; -import type { UmbBlockEditorCustomViewConfiguration } from '@umbraco-cms/backoffice/extension-registry'; import '../block-grid-areas-container/index.js'; import '../ref-grid-block/index.js'; +import type { UmbBlockEditorCustomViewConfiguration } from '@umbraco-cms/backoffice/block-custom-view'; /** * @element umb-block-grid-block-inline diff --git a/src/packages/block/block-grid/components/block-grid-block/block-grid-block.element.ts b/src/packages/block/block-grid/components/block-grid-block/block-grid-block.element.ts index 67cd1c81e7..1e16df8024 100644 --- a/src/packages/block/block-grid/components/block-grid-block/block-grid-block.element.ts +++ b/src/packages/block/block-grid/components/block-grid-block/block-grid-block.element.ts @@ -1,8 +1,8 @@ import { UMB_BLOCK_GRID_ENTRY_CONTEXT } from '../../context/block-grid-entry.context-token.js'; import { UmbLitElement } from '@umbraco-cms/backoffice/lit-element'; import { css, customElement, html, property, state } from '@umbraco-cms/backoffice/external/lit'; -import type { UmbBlockEditorCustomViewConfiguration } from '@umbraco-cms/backoffice/extension-registry'; import type { UmbBlockDataType } from '@umbraco-cms/backoffice/block'; +import type { UmbBlockEditorCustomViewConfiguration } from '@umbraco-cms/backoffice/block-custom-view'; import '@umbraco-cms/backoffice/ufm'; import '../block-grid-areas-container/index.js'; diff --git a/src/packages/block/block-grid/components/block-grid-entry/block-grid-entry.element.ts b/src/packages/block/block-grid/components/block-grid-entry/block-grid-entry.element.ts index 291e9f269d..a2091a3c91 100644 --- a/src/packages/block/block-grid/components/block-grid-entry/block-grid-entry.element.ts +++ b/src/packages/block/block-grid/components/block-grid-entry/block-grid-entry.element.ts @@ -2,11 +2,7 @@ import { UmbBlockGridEntryContext } from '../../context/block-grid-entry.context import { UmbLitElement } from '@umbraco-cms/backoffice/lit-element'; import { html, css, customElement, property, state, nothing } from '@umbraco-cms/backoffice/external/lit'; import type { PropertyValueMap } from '@umbraco-cms/backoffice/external/lit'; -import type { - ManifestBlockEditorCustomView, - UmbBlockEditorCustomViewProperties, - UmbPropertyEditorUiElement, -} from '@umbraco-cms/backoffice/extension-registry'; +import type { UmbPropertyEditorUiElement } from '@umbraco-cms/backoffice/extension-registry'; import { stringOrStringArrayContains } from '@umbraco-cms/backoffice/utils'; import { UMB_BLOCK_GRID, type UmbBlockGridLayoutModel } from '@umbraco-cms/backoffice/block-grid'; @@ -15,6 +11,10 @@ import '../block-grid-block/index.js'; import '../block-scale-handler/index.js'; import { UmbObserveValidationStateController } from '@umbraco-cms/backoffice/validation'; import { UmbDataPathBlockElementDataQuery } from '@umbraco-cms/backoffice/block'; +import type { + ManifestBlockEditorCustomView, + UmbBlockEditorCustomViewProperties, +} from '@umbraco-cms/backoffice/block-custom-view'; import { UUIBlinkAnimationValue, UUIBlinkKeyframes } from '@umbraco-cms/backoffice/external/uui'; import type { UmbExtensionElementInitializer } from '@umbraco-cms/backoffice/extension-api'; /** diff --git a/src/packages/block/block-list/components/block-list-entry/block-list-entry.element.ts b/src/packages/block/block-list/components/block-list-entry/block-list-entry.element.ts index 0172936a37..e378af99d2 100644 --- a/src/packages/block/block-list/components/block-list-entry/block-list-entry.element.ts +++ b/src/packages/block/block-list/components/block-list-entry/block-list-entry.element.ts @@ -2,16 +2,16 @@ import { UmbBlockListEntryContext } from '../../context/block-list-entry.context import { UMB_BLOCK_LIST, type UmbBlockListLayoutModel } from '../../types.js'; import { UmbLitElement } from '@umbraco-cms/backoffice/lit-element'; import { html, css, customElement, property, state, nothing } from '@umbraco-cms/backoffice/external/lit'; -import type { - ManifestBlockEditorCustomView, - UmbBlockEditorCustomViewProperties, - UmbPropertyEditorUiElement, -} from '@umbraco-cms/backoffice/extension-registry'; +import type { UmbPropertyEditorUiElement } from '@umbraco-cms/backoffice/extension-registry'; import '../ref-list-block/index.js'; import '../inline-list-block/index.js'; import { stringOrStringArrayContains } from '@umbraco-cms/backoffice/utils'; import { UmbObserveValidationStateController } from '@umbraco-cms/backoffice/validation'; import { UmbDataPathBlockElementDataQuery } from '@umbraco-cms/backoffice/block'; +import type { + ManifestBlockEditorCustomView, + UmbBlockEditorCustomViewProperties, +} from '@umbraco-cms/backoffice/block-custom-view'; /** * @element umb-block-list-entry diff --git a/src/packages/block/block-list/property-editors/block-list-editor/property-editor-ui-block-list.element.ts b/src/packages/block/block-list/property-editors/block-list-editor/property-editor-ui-block-list.element.ts index 5aa7bfe843..26ecb9fce0 100644 --- a/src/packages/block/block-list/property-editors/block-list-editor/property-editor-ui-block-list.element.ts +++ b/src/packages/block/block-list/property-editors/block-list-editor/property-editor-ui-block-list.element.ts @@ -6,7 +6,7 @@ import { UMB_BLOCK_LIST_PROPERTY_EDITOR_ALIAS } from './manifests.js'; import { UmbLitElement, umbDestroyOnDisconnect } from '@umbraco-cms/backoffice/lit-element'; import { html, customElement, property, state, repeat, css, nothing } from '@umbraco-cms/backoffice/external/lit'; import { UmbTextStyles } from '@umbraco-cms/backoffice/style'; -import type { UmbPropertyEditorUiElement, UmbBlockTypeBaseModel } from '@umbraco-cms/backoffice/extension-registry'; +import type { UmbPropertyEditorUiElement } from '@umbraco-cms/backoffice/extension-registry'; import { UmbPropertyValueChangeEvent, type UmbPropertyEditorConfigCollection, @@ -19,6 +19,7 @@ import { UmbBlockElementDataValidationPathTranslator, type UmbBlockLayoutBaseModel, } from '@umbraco-cms/backoffice/block'; +import type { UmbBlockTypeBaseModel } from '@umbraco-cms/backoffice/block-type'; import '../../components/block-list-entry/index.js'; import { UMB_PROPERTY_CONTEXT } from '@umbraco-cms/backoffice/property'; diff --git a/src/packages/block/block-list/property-editors/block-list-type-configuration/property-editor-ui-block-list-type-configuration.element.ts b/src/packages/block/block-list/property-editors/block-list-type-configuration/property-editor-ui-block-list-type-configuration.element.ts index 639175c2fb..53154a5743 100644 --- a/src/packages/block/block-list/property-editors/block-list-type-configuration/property-editor-ui-block-list-type-configuration.element.ts +++ b/src/packages/block/block-list/property-editors/block-list-type-configuration/property-editor-ui-block-list-type-configuration.element.ts @@ -1,7 +1,7 @@ import '../../../block-type/components/input-block-type/index.js'; -import type { UmbInputBlockTypeElement } from '../../../block-type/index.js'; import { UMB_BLOCK_LIST_TYPE } from '../../types.js'; -import type { UmbBlockTypeBaseModel, UmbPropertyEditorUiElement } from '@umbraco-cms/backoffice/extension-registry'; +import type { UmbBlockTypeBaseModel, UmbInputBlockTypeElement } from '@umbraco-cms/backoffice/block-type'; +import type { UmbPropertyEditorUiElement } from '@umbraco-cms/backoffice/extension-registry'; import { html, customElement, property, state } from '@umbraco-cms/backoffice/external/lit'; import { UmbPropertyValueChangeEvent, diff --git a/src/packages/block/block-list/types.ts b/src/packages/block/block-list/types.ts index 31c8dd7a55..94ff232c27 100644 --- a/src/packages/block/block-list/types.ts +++ b/src/packages/block/block-list/types.ts @@ -1,5 +1,5 @@ -import type { UmbBlockTypeBaseModel } from '@umbraco-cms/backoffice/extension-registry'; import type { UmbBlockLayoutBaseModel, UmbBlockValueType } from '@umbraco-cms/backoffice/block'; +import type { UmbBlockTypeBaseModel } from '@umbraco-cms/backoffice/block-type'; export const UMB_BLOCK_LIST_TYPE = 'block-list-type'; export const UMB_BLOCK_LIST = 'block-list'; diff --git a/src/packages/block/block-rte/components/block-rte-entry/block-rte-entry.element.ts b/src/packages/block/block-rte/components/block-rte-entry/block-rte-entry.element.ts index 3ca6afa49d..54a59940f8 100644 --- a/src/packages/block/block-rte/components/block-rte-entry/block-rte-entry.element.ts +++ b/src/packages/block/block-rte/components/block-rte-entry/block-rte-entry.element.ts @@ -2,11 +2,9 @@ import type { UmbBlockRteLayoutModel } from '../../types.js'; import { UmbBlockRteEntryContext } from '../../context/block-rte-entry.context.js'; import { UmbLitElement } from '@umbraco-cms/backoffice/lit-element'; import { html, css, property, state, customElement } from '@umbraco-cms/backoffice/external/lit'; -import type { - UmbBlockEditorCustomViewProperties, - UmbPropertyEditorUiElement, -} from '@umbraco-cms/backoffice/extension-registry'; +import type { UmbPropertyEditorUiElement } from '@umbraco-cms/backoffice/extension-registry'; import { UmbTextStyles } from '@umbraco-cms/backoffice/style'; +import type { UmbBlockEditorCustomViewProperties } from '@umbraco-cms/backoffice/block-custom-view'; import '../ref-rte-block/index.js'; diff --git a/src/packages/block/block-rte/tiny-mce-plugin/tiny-mce-block-picker.plugin.ts b/src/packages/block/block-rte/tiny-mce-plugin/tiny-mce-block-picker.plugin.ts index 380b62b1b1..c941292048 100644 --- a/src/packages/block/block-rte/tiny-mce-plugin/tiny-mce-block-picker.plugin.ts +++ b/src/packages/block/block-rte/tiny-mce-plugin/tiny-mce-block-picker.plugin.ts @@ -2,7 +2,7 @@ import { UMB_BLOCK_RTE_MANAGER_CONTEXT } from '../context/block-rte-manager.cont import { UMB_BLOCK_RTE_ENTRIES_CONTEXT } from '../context/block-rte-entries.context-token.js'; import { type TinyMcePluginArguments, UmbTinyMcePluginBase } from '@umbraco-cms/backoffice/tiny-mce'; import { UmbLocalizationController } from '@umbraco-cms/backoffice/localization-api'; -import type { UmbBlockTypeBaseModel } from '@umbraco-cms/backoffice/extension-registry'; +import type { UmbBlockTypeBaseModel } from '@umbraco-cms/backoffice/block-type'; export default class UmbTinyMceMultiUrlPickerPlugin extends UmbTinyMcePluginBase { #localize = new UmbLocalizationController(this._host); diff --git a/src/packages/block/block-rte/types.ts b/src/packages/block/block-rte/types.ts index ea18ec9bad..c97075ec68 100644 --- a/src/packages/block/block-rte/types.ts +++ b/src/packages/block/block-rte/types.ts @@ -1,4 +1,4 @@ -import type { UmbBlockTypeBaseModel } from '@umbraco-cms/backoffice/extension-registry'; +import type { UmbBlockTypeBaseModel } from '@umbraco-cms/backoffice/block-type'; import type { UmbBlockLayoutBaseModel, UmbBlockValueType } from '@umbraco-cms/backoffice/block'; export const UMB_BLOCK_RTE_TYPE = 'block-rte-type'; diff --git a/src/packages/block/block-type/components/block-type-custom-view-guide/block-type-custom-view-guide.element.ts b/src/packages/block/block-type/components/block-type-custom-view-guide/block-type-custom-view-guide.element.ts index ef5347f3d5..923339fc71 100644 --- a/src/packages/block/block-type/components/block-type-custom-view-guide/block-type-custom-view-guide.element.ts +++ b/src/packages/block/block-type/components/block-type-custom-view-guide/block-type-custom-view-guide.element.ts @@ -2,11 +2,12 @@ import { UMB_MANIFEST_VIEWER_MODAL } from '../../../modals/manifest-viewer/index import { UmbLitElement } from '@umbraco-cms/backoffice/lit-element'; import { html, customElement, state, property, css } from '@umbraco-cms/backoffice/external/lit'; import { UMB_PROPERTY_DATASET_CONTEXT } from '@umbraco-cms/backoffice/property'; -import { umbExtensionsRegistry, type ManifestBlockEditorCustomView } from '@umbraco-cms/backoffice/extension-registry'; +import { umbExtensionsRegistry } from '@umbraco-cms/backoffice/extension-registry'; import { stringOrStringArrayContains } from '@umbraco-cms/backoffice/utils'; import { UmbExtensionsManifestInitializer } from '@umbraco-cms/backoffice/extension-api'; import { UmbDocumentTypeDetailRepository } from '@umbraco-cms/backoffice/document-type'; import { UMB_MODAL_MANAGER_CONTEXT } from '@umbraco-cms/backoffice/modal'; +import type { ManifestBlockEditorCustomView } from '@umbraco-cms/backoffice/block-custom-view'; @customElement('umb-block-type-custom-view-guide') export class UmbBlockTypeCustomViewGuideElement extends UmbLitElement { @@ -88,7 +89,7 @@ export class UmbBlockTypeCustomViewGuideElement extends UmbLitElement { async #generateManifest() { const modalManager = await this.getContext(UMB_MODAL_MANAGER_CONTEXT); - const manifest = { + const manifest: UmbExtensionManifest = { type: 'blockEditorCustomView', alias: 'Local.blockEditorCustomView.' + this.#contentTypeAlias, name: 'Block Editor Custom View for ' + this.#contentTypeName, diff --git a/src/packages/block/block-type/components/input-block-type/input-block-type.element.ts b/src/packages/block/block-type/components/input-block-type/input-block-type.element.ts index cade6212d8..2c6380be9f 100644 --- a/src/packages/block/block-type/components/input-block-type/input-block-type.element.ts +++ b/src/packages/block/block-type/components/input-block-type/input-block-type.element.ts @@ -12,7 +12,7 @@ import { UMB_DOCUMENT_TYPE_PICKER_MODAL, } from '@umbraco-cms/backoffice/document-type'; import { UmbSorterController } from '@umbraco-cms/backoffice/sorter'; -import type { UmbBlockTypeBaseModel } from '@umbraco-cms/backoffice/extension-registry'; +import type { UmbBlockTypeBaseModel } from '@umbraco-cms/backoffice/block-type'; import '../block-type-card/index.js'; diff --git a/src/packages/block/block-type/types.ts b/src/packages/block/block-type/types.ts index 4bb332af04..58b67597e8 100644 --- a/src/packages/block/block-type/types.ts +++ b/src/packages/block/block-type/types.ts @@ -1,6 +1,16 @@ -import type { UmbBlockTypeBaseModel } from '@umbraco-cms/backoffice/extension-registry'; -export type { UmbBlockTypeBaseModel } from '@umbraco-cms/backoffice/extension-registry'; +import type { UUIModalSidebarSize } from '@umbraco-cms/backoffice/external/uui'; +// Shared with the Property Editor +export interface UmbBlockTypeBaseModel { + contentElementTypeKey: string; + settingsElementTypeKey?: string; + label?: string; + thumbnail?: string; + iconColor?: string; + backgroundColor?: string; + editorSize?: UUIModalSidebarSize; + forceHideContentEditorInOverlay: boolean; +} export interface UmbBlockTypeGroup { name?: string; key: string; diff --git a/src/packages/block/block-type/workspace/block-type-workspace.context.ts b/src/packages/block/block-type/workspace/block-type-workspace.context.ts index c50aad7dbb..61b2adb6a3 100644 --- a/src/packages/block/block-type/workspace/block-type-workspace.context.ts +++ b/src/packages/block/block-type/workspace/block-type-workspace.context.ts @@ -1,4 +1,4 @@ -import type { UmbBlockTypeWithGroupKey } from '../types.js'; +import type { UmbBlockTypeBaseModel, UmbBlockTypeWithGroupKey } from '../types.js'; import { UmbBlockTypeWorkspaceEditorElement } from './block-type-workspace-editor.element.js'; import type { UmbPropertyDatasetContext } from '@umbraco-cms/backoffice/property'; import { UMB_PROPERTY_CONTEXT } from '@umbraco-cms/backoffice/property'; @@ -13,7 +13,7 @@ import { } from '@umbraco-cms/backoffice/workspace'; import { UmbObjectState, appendToFrozenArray } from '@umbraco-cms/backoffice/observable-api'; import type { UmbControllerHost } from '@umbraco-cms/backoffice/controller-api'; -import type { ManifestWorkspace, UmbBlockTypeBaseModel } from '@umbraco-cms/backoffice/extension-registry'; +import type { ManifestWorkspace } from '@umbraco-cms/backoffice/extension-registry'; export class UmbBlockTypeWorkspaceContext extends UmbSubmittableWorkspaceContextBase diff --git a/src/packages/block/block/context/block-entries.context-token.ts b/src/packages/block/block/context/block-entries.context-token.ts index 75b2db18d9..e98e9607a0 100644 --- a/src/packages/block/block/context/block-entries.context-token.ts +++ b/src/packages/block/block/context/block-entries.context-token.ts @@ -3,7 +3,7 @@ import type { UmbBlockWorkspaceOriginData } from '../workspace/block-workspace.m import type { UmbBlockEntriesContext } from './block-entries.context.js'; import type { UMB_BLOCK_MANAGER_CONTEXT } from './block-manager.context-token.js'; import { UmbContextToken } from '@umbraco-cms/backoffice/context-api'; -import type { UmbBlockTypeBaseModel } from '@umbraco-cms/backoffice/extension-registry'; +import type { UmbBlockTypeBaseModel } from '@umbraco-cms/backoffice/block-type'; export const UMB_BLOCK_ENTRIES_CONTEXT = new UmbContextToken< UmbBlockEntriesContext< diff --git a/src/packages/block/block/context/block-entries.context.ts b/src/packages/block/block/context/block-entries.context.ts index 234c942397..e5cb10d0b0 100644 --- a/src/packages/block/block/context/block-entries.context.ts +++ b/src/packages/block/block/context/block-entries.context.ts @@ -4,10 +4,10 @@ import type { UmbBlockDataObjectModel, UmbBlockManagerContext } from './block-ma import { UMB_BLOCK_ENTRIES_CONTEXT } from './block-entries.context-token.js'; import { type Observable, UmbArrayState, UmbBasicState, UmbStringState } from '@umbraco-cms/backoffice/observable-api'; import { UmbContextBase } from '@umbraco-cms/backoffice/class-api'; -import type { UmbBlockTypeBaseModel } from '@umbraco-cms/backoffice/extension-registry'; import type { UmbContextToken } from '@umbraco-cms/backoffice/context-api'; import type { UmbControllerHost } from '@umbraco-cms/backoffice/controller-api'; import type { UmbModalRouteBuilder } from '@umbraco-cms/backoffice/router'; +import type { UmbBlockTypeBaseModel } from '@umbraco-cms/backoffice/block-type'; export abstract class UmbBlockEntriesContext< BlockManagerContextTokenType extends UmbContextToken, diff --git a/src/packages/block/block/context/block-entry.context-token.ts b/src/packages/block/block/context/block-entry.context-token.ts index 93b66d9b29..f913bec728 100644 --- a/src/packages/block/block/context/block-entry.context-token.ts +++ b/src/packages/block/block/context/block-entry.context-token.ts @@ -4,7 +4,7 @@ import type { UMB_BLOCK_ENTRIES_CONTEXT } from './block-entries.context-token.js import type { UmbBlockEntriesContext } from './block-entries.context.js'; import type { UmbBlockEntryContext } from './block-entry.context.js'; import type { UMB_BLOCK_MANAGER_CONTEXT } from './block-manager.context-token.js'; -import type { UmbBlockTypeBaseModel } from '@umbraco-cms/backoffice/extension-registry'; +import type { UmbBlockTypeBaseModel } from '@umbraco-cms/backoffice/block-type'; import { UmbContextToken } from '@umbraco-cms/backoffice/context-api'; export const UMB_BLOCK_ENTRY_CONTEXT = new UmbContextToken< diff --git a/src/packages/block/block/context/block-entry.context.ts b/src/packages/block/block/context/block-entry.context.ts index c338636571..e8fddb2ec3 100644 --- a/src/packages/block/block/context/block-entry.context.ts +++ b/src/packages/block/block/context/block-entry.context.ts @@ -15,7 +15,7 @@ import { encodeFilePath } from '@umbraco-cms/backoffice/utils'; import { umbConfirmModal } from '@umbraco-cms/backoffice/modal'; import type { UmbContentTypeModel } from '@umbraco-cms/backoffice/content-type'; import type { Observable } from '@umbraco-cms/backoffice/external/rxjs'; -import type { UmbBlockTypeBaseModel } from '@umbraco-cms/backoffice/extension-registry'; +import type { UmbBlockTypeBaseModel } from '@umbraco-cms/backoffice/block-type'; export abstract class UmbBlockEntryContext< BlockManagerContextTokenType extends UmbContextToken, diff --git a/src/packages/block/block/context/block-manager.context.ts b/src/packages/block/block/context/block-manager.context.ts index f44da55be5..b56ef6ac6f 100644 --- a/src/packages/block/block/context/block-manager.context.ts +++ b/src/packages/block/block/context/block-manager.context.ts @@ -5,12 +5,12 @@ import { UmbContextBase } from '@umbraco-cms/backoffice/class-api'; import type { UmbControllerHost } from '@umbraco-cms/backoffice/controller-api'; import { UmbArrayState, UmbBooleanState, UmbClassState, UmbStringState } from '@umbraco-cms/backoffice/observable-api'; import { UmbDocumentTypeDetailRepository } from '@umbraco-cms/backoffice/document-type'; -import type { UmbBlockTypeBaseModel } from '@umbraco-cms/backoffice/extension-registry'; import type { UmbContentTypeModel } from '@umbraco-cms/backoffice/content-type'; import { UmbId } from '@umbraco-cms/backoffice/id'; import type { UmbPropertyEditorConfigCollection } from '@umbraco-cms/backoffice/property-editor'; import { UMB_PROPERTY_CONTEXT } from '@umbraco-cms/backoffice/property'; import type { UmbVariantId } from '@umbraco-cms/backoffice/variant'; +import type { UmbBlockTypeBaseModel } from '@umbraco-cms/backoffice/block-type'; /** * diff --git a/src/packages/block/block/index.ts b/src/packages/block/block/index.ts index 0e7cb3f0dc..316fbaa517 100644 --- a/src/packages/block/block/index.ts +++ b/src/packages/block/block/index.ts @@ -1,5 +1,5 @@ export * from './context/index.js'; export * from './modals/index.js'; -export * from './types.js'; +export type * from './types.js'; export * from './validation/index.js'; export * from './workspace/index.js'; diff --git a/src/packages/block/block/modals/block-catalogue/block-catalogue-modal.token.ts b/src/packages/block/block/modals/block-catalogue/block-catalogue-modal.token.ts index d4fbc36096..743d522379 100644 --- a/src/packages/block/block/modals/block-catalogue/block-catalogue-modal.token.ts +++ b/src/packages/block/block/modals/block-catalogue/block-catalogue-modal.token.ts @@ -1,7 +1,6 @@ -import type { UmbBlockTypeBaseModel } from '@umbraco-cms/backoffice/extension-registry'; import { UmbModalToken } from '@umbraco-cms/backoffice/modal'; import type { UmbBlockWorkspaceData } from '@umbraco-cms/backoffice/block'; -import type { UmbBlockTypeGroup } from '@umbraco-cms/backoffice/block-type'; +import type { UmbBlockTypeGroup, UmbBlockTypeBaseModel } from '@umbraco-cms/backoffice/block-type'; export interface UmbBlockCatalogueModalData { blocks: Array; diff --git a/src/packages/block/block/types.ts b/src/packages/block/block/types.ts index 7c11cec0ac..0df9c79277 100644 --- a/src/packages/block/block/types.ts +++ b/src/packages/block/block/types.ts @@ -1,5 +1,15 @@ -import type { UmbBlockDataType, UmbBlockLayoutBaseModel } from '@umbraco-cms/backoffice/extension-registry'; -export type { UmbBlockDataType, UmbBlockLayoutBaseModel } from '@umbraco-cms/backoffice/extension-registry'; +// Shared with the Property Editor +export interface UmbBlockLayoutBaseModel { + contentUdi: string; + settingsUdi?: string | null; +} + +// Shared with the Property Editor +export interface UmbBlockDataType { + udi: string; + contentTypeKey: string; + [key: string]: unknown; +} export interface UmbBlockValueType { layout: { [key: string]: Array | undefined }; diff --git a/src/packages/block/custom-view/custom-view.element.ts b/src/packages/block/custom-view/custom-view.element.ts index 9ac9fff679..f06fb85444 100644 --- a/src/packages/block/custom-view/custom-view.element.ts +++ b/src/packages/block/custom-view/custom-view.element.ts @@ -1,4 +1,5 @@ -import type { UmbBlockDataType, UmbBlockEditorCustomViewElement } from '@umbraco-cms/backoffice/extension-registry'; +import type { UmbBlockDataType } from '@umbraco-cms/backoffice/block'; +import type { UmbBlockEditorCustomViewElement } from '@umbraco-cms/backoffice/block-custom-view'; import { css, customElement, html, property } from '@umbraco-cms/backoffice/external/lit'; import { UmbLitElement } from '@umbraco-cms/backoffice/lit-element'; diff --git a/src/packages/block/custom-view/manifest.ts b/src/packages/block/custom-view/manifest.ts index 71839f5ac4..46e74f3b3a 100644 --- a/src/packages/block/custom-view/manifest.ts +++ b/src/packages/block/custom-view/manifest.ts @@ -1,6 +1,4 @@ -import type { ManifestBlockEditorCustomView } from '@umbraco-cms/backoffice/extension-registry'; - -export const manifest: ManifestBlockEditorCustomView = { +export const manifest: UmbExtensionManifest = { type: 'blockEditorCustomView', alias: 'Umb.blockEditorCustomView.TestView', name: 'Block Editor Custom View Test', diff --git a/src/packages/block/vite.config.ts b/src/packages/block/vite.config.ts index a8a9c55143..47b4244ed0 100644 --- a/src/packages/block/vite.config.ts +++ b/src/packages/block/vite.config.ts @@ -12,6 +12,7 @@ export default defineConfig({ dist, entry: { 'block/index': 'block/index.ts', + 'block-custom-view/index': 'block-custom-view/index.ts', 'block-grid/index': 'block-grid/index.ts', 'block-list/index': 'block-list/index.ts', 'block-rte/index': 'block-rte/index.ts', diff --git a/src/packages/core/extension-registry/interfaces/index.ts b/src/packages/core/extension-registry/interfaces/index.ts index 7585b5001b..1721b7dfec 100644 --- a/src/packages/core/extension-registry/interfaces/index.ts +++ b/src/packages/core/extension-registry/interfaces/index.ts @@ -1,4 +1,3 @@ -export * from './block-editor-custom-view-element.interface.js'; export * from './dashboard-element.interface.js'; export * from './external-login-provider-element.interface.js'; export * from './menu-item-element.interface.js'; diff --git a/src/packages/core/extension-registry/models/index.ts b/src/packages/core/extension-registry/models/index.ts index f726d89b51..00fec52d8f 100644 --- a/src/packages/core/extension-registry/models/index.ts +++ b/src/packages/core/extension-registry/models/index.ts @@ -1,5 +1,4 @@ import type { ManifestAuthProvider } from './auth-provider.model.js'; -import type { ManifestBlockEditorCustomView } from './block-editor-custom-view.model.js'; import type { ManifestCollection } from './collection.models.js'; import type { ManifestCollectionView } from './collection-view.model.js'; import type { ManifestCurrentUserAction, ManifestCurrentUserActionDefaultKind } from './current-user-action.model.js'; @@ -78,7 +77,6 @@ import type { ManifestBase, ManifestBundle, ManifestCondition } from '@umbraco-c export type * from './app-entry-point.model.js'; export type * from './auth-provider.model.js'; export type * from './backoffice-entry-point.model.js'; -export type * from './block-editor-custom-view.model.js'; export type * from './collection-action.model.js'; export type * from './collection-view.model.js'; export type * from './collection.models.js'; @@ -160,7 +158,6 @@ export type ManifestTypes = | ManifestAppEntryPoint | ManifestAuthProvider | ManifestBackofficeEntryPoint - | ManifestBlockEditorCustomView | ManifestBundle | ManifestCollection | ManifestCollectionAction @@ -222,3 +219,36 @@ export type ManifestTypes = | ManifestWorkspaces | ManifestWorkspaceViews | ManifestBase; + +type UnionOfProperties = T extends object ? T[keyof T] : never; + +declare global { + /** + * This global type allows to declare manifests types from its own module. + * @example + ```js + declare global { + interface UmbExtensionManifestMap { + My_UNIQUE_MANIFEST_NAME: MyExtensionManifestType; + } + } + ``` + If you have multiple types, you can declare them in this way: + ```js + declare global { + interface UmbExtensionManifestMap { + My_UNIQUE_MANIFEST_NAME: MyExtensionManifestTypeA | MyExtensionManifestTypeB; + } + } + ``` + */ + interface UmbExtensionManifestMap { + UMB_CORE: ManifestTypes; + } + + /** + * This global type provides a union of all declared manifest types. + * If this is a local package that declares additional Manifest Types, then these will also be included in this union. + */ + type UmbExtensionManifest = UnionOfProperties; +} diff --git a/src/packages/core/extension-registry/registry.ts b/src/packages/core/extension-registry/registry.ts index 09294be440..649d77294a 100644 --- a/src/packages/core/extension-registry/registry.ts +++ b/src/packages/core/extension-registry/registry.ts @@ -1,8 +1,7 @@ -import type { ManifestTypes } from './models/index.js'; import type { ManifestKind } from '@umbraco-cms/backoffice/extension-api'; import { UmbExtensionRegistry } from '@umbraco-cms/backoffice/extension-api'; -export type UmbBackofficeManifestKind = ManifestKind; -export type UmbBackofficeExtensionRegistry = UmbExtensionRegistry; +export type UmbBackofficeManifestKind = ManifestKind; +export type UmbBackofficeExtensionRegistry = UmbExtensionRegistry; -export const umbExtensionsRegistry = new UmbExtensionRegistry() as UmbBackofficeExtensionRegistry; +export const umbExtensionsRegistry = new UmbExtensionRegistry() as UmbBackofficeExtensionRegistry; diff --git a/src/packages/core/extension-registry/umbraco-package.ts b/src/packages/core/extension-registry/umbraco-package.ts index 3a05a2d7f0..7e11d17764 100644 --- a/src/packages/core/extension-registry/umbraco-package.ts +++ b/src/packages/core/extension-registry/umbraco-package.ts @@ -1,4 +1,4 @@ -import type { ManifestTypes } from './models/index.js'; +import './models/index.js'; /** * Umbraco package manifest JSON @@ -37,7 +37,7 @@ export interface UmbracoPackage { * @title An array of Umbraco package manifest types that will be installed * @required */ - extensions: ManifestTypes[]; + extensions: UmbExtensionManifest[]; /** * @title The importmap for the package diff --git a/src/packages/core/json-schema/umbraco-package.ts b/src/packages/core/json-schema/umbraco-package.ts new file mode 100644 index 0000000000..5be7369f5a --- /dev/null +++ b/src/packages/core/json-schema/umbraco-package.ts @@ -0,0 +1 @@ +export * from '@umbraco-cms/backoffice/extension-registry'; diff --git a/src/packages/tiny-mce/property-editors/block/property-editor-ui-block-rte-type-configuration.element.ts b/src/packages/tiny-mce/property-editors/block/property-editor-ui-block-rte-type-configuration.element.ts index 2b59427770..264dab15ba 100644 --- a/src/packages/tiny-mce/property-editors/block/property-editor-ui-block-rte-type-configuration.element.ts +++ b/src/packages/tiny-mce/property-editors/block/property-editor-ui-block-rte-type-configuration.element.ts @@ -1,6 +1,6 @@ -import { UmbInputBlockTypeElement } from '@umbraco-cms/backoffice/block-type'; +import { type UmbBlockTypeBaseModel, UmbInputBlockTypeElement } from '@umbraco-cms/backoffice/block-type'; import { UMB_BLOCK_RTE_TYPE } from '@umbraco-cms/backoffice/block-rte'; -import type { UmbBlockTypeBaseModel, UmbPropertyEditorUiElement } from '@umbraco-cms/backoffice/extension-registry'; +import type { UmbPropertyEditorUiElement } from '@umbraco-cms/backoffice/extension-registry'; import { html, customElement, property, state, nothing } from '@umbraco-cms/backoffice/external/lit'; import { UmbPropertyValueChangeEvent, diff --git a/src/packages/user/user/manifests.ts b/src/packages/user/user/manifests.ts index b73a4378c2..4e03fe4f97 100644 --- a/src/packages/user/user/manifests.ts +++ b/src/packages/user/user/manifests.ts @@ -9,7 +9,6 @@ import { manifests as propertyEditorManifests } from './property-editor/manifest import { manifests as repositoryManifests } from './repository/manifests.js'; import { manifests as workspaceManifests } from './workspace/manifests.js'; import { manifests as menuItemManifests } from './menu-item/manifests.js'; - import type { ManifestTypes, UmbBackofficeManifestKind } from '@umbraco-cms/backoffice/extension-registry'; export const manifests: Array = [ diff --git a/tsconfig.json b/tsconfig.json index bcfc0e0b33..d6914be56f 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -45,6 +45,7 @@ DON'T EDIT THIS FILE DIRECTLY. It is generated by /devops/tsconfig/index.js "@umbraco-cms/backoffice/action": ["./src/packages/core/action/index.ts"], "@umbraco-cms/backoffice/audit-log": ["./src/packages/core/audit-log/index.ts"], "@umbraco-cms/backoffice/auth": ["./src/packages/core/auth/index.ts"], + "@umbraco-cms/backoffice/block-custom-view": ["./src/packages/block/block-custom-view/index.ts"], "@umbraco-cms/backoffice/block-grid": ["./src/packages/block/block-grid/index.ts"], "@umbraco-cms/backoffice/block-list": ["./src/packages/block/block-list/index.ts"], "@umbraco-cms/backoffice/block-rte": ["./src/packages/block/block-rte/index.ts"], diff --git a/utils/json-schema/test-package.json b/utils/json-schema/test-umbraco-package.json similarity index 99% rename from utils/json-schema/test-package.json rename to utils/json-schema/test-umbraco-package.json index 26812fa8b7..11b6cf37e8 100644 --- a/utils/json-schema/test-package.json +++ b/utils/json-schema/test-umbraco-package.json @@ -8,6 +8,7 @@ "name": "My Dashboard", "alias": "myDashboard", + "weight": -10, "elementName": "my-dashboard", "js": "js/my-dashboard.js",