rename to extension
This commit is contained in:
@@ -4,7 +4,7 @@ import { UmbSectionContext, UMB_SECTION_CONTEXT_TOKEN } from '@umbraco-cms/backo
|
||||
import type { UmbRoute, UmbRouterSlotChangeEvent } from '@umbraco-cms/backoffice/router';
|
||||
import type { ManifestSection, UmbSectionElement } from '@umbraco-cms/backoffice/extension-registry';
|
||||
import {
|
||||
UmbExtensionManifestInitializer, createManifestElement
|
||||
UmbExtensionManifestInitializer, createExtensionElement
|
||||
} from '@umbraco-cms/backoffice/extension-api';
|
||||
import { UmbLitElement } from '@umbraco-cms/internal/lit-element';
|
||||
|
||||
@@ -55,7 +55,7 @@ export class UmbBackofficeMainElement extends UmbLitElement {
|
||||
return {
|
||||
alias: section.alias,
|
||||
path: this._routePrefix + (section.manifest as ManifestSection).meta.pathname,
|
||||
component: () => createManifestElement(section.manifest!, 'umb-section-default'),
|
||||
component: () => createExtensionElement(section.manifest!, 'umb-section-default'),
|
||||
setup: (component) => {
|
||||
(component as UmbSectionElement).manifest = section.manifest as ManifestSection;
|
||||
},
|
||||
|
||||
@@ -4,7 +4,7 @@ import {
|
||||
type ManifestCondition,
|
||||
type ManifestWithDynamicConditions,
|
||||
type UmbExtensionRegistry,
|
||||
createManifestApi,
|
||||
createExtensionApi,
|
||||
} from '@umbraco-cms/backoffice/extension-api';
|
||||
import { UmbObserverController } from '@umbraco-cms/backoffice/observable-api';
|
||||
|
||||
@@ -143,7 +143,7 @@ export abstract class UmbBaseExtensionInitializer<
|
||||
// Check if we already have a controller for this config:
|
||||
const existing = this.#conditionControllers.find((controller) => controller.config === conditionConfig);
|
||||
if (!existing) {
|
||||
const conditionController = await createManifestApi(conditionManifest, [
|
||||
const conditionController = await createExtensionApi(conditionManifest, [
|
||||
{
|
||||
host: this,
|
||||
manifest: conditionManifest,
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { createManifestApi } from '../functions/create-manifest-api.function.js';
|
||||
import { createExtensionApi } from '../functions/create-extension-api.function.js';
|
||||
import { UmbApi } from '../models/api.interface.js';
|
||||
import { UmbExtensionRegistry } from '../registry/extension.registry.js';
|
||||
import { ManifestApi, ManifestCondition } from '../types/index.js';
|
||||
@@ -88,7 +88,7 @@ export class UmbExtensionApiInitializer<
|
||||
protected async _conditionsAreGood() {
|
||||
const manifest = this.manifest!; // In this case we are sure its not undefined.
|
||||
|
||||
const newApi = await createManifestApi<ExtensionApiInterface>(manifest as unknown as ManifestApi<ExtensionApiInterface>, this.#constructorArguments);
|
||||
const newApi = await createExtensionApi<ExtensionApiInterface>(manifest as unknown as ManifestApi<ExtensionApiInterface>, this.#constructorArguments);
|
||||
if (!this._positive) {
|
||||
// We are not positive anymore, so we will back out of this creation.
|
||||
return false;
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { createManifestElement } from '../functions/create-manifest-element.function.js';
|
||||
import { createExtensionElement } from '../functions/create-extension-element.function.js';
|
||||
import { UmbExtensionRegistry } from '../registry/extension.registry.js';
|
||||
import { ManifestCondition, ManifestWithDynamicConditions } from '../types/index.js';
|
||||
import { UmbBaseExtensionInitializer } from './base-extension-initializer.controller.js';
|
||||
@@ -79,7 +79,7 @@ export class UmbExtensionElementInitializer<
|
||||
protected async _conditionsAreGood() {
|
||||
const manifest = this.manifest!; // In this case we are sure its not undefined.
|
||||
|
||||
const newComponent = await createManifestElement(manifest, this.#defaultElement);
|
||||
const newComponent = await createExtensionElement(manifest, this.#defaultElement);
|
||||
if (!this._positive) {
|
||||
// We are not positive anymore, so we will back out of this creation.
|
||||
return false;
|
||||
|
||||
@@ -2,7 +2,7 @@ import { UmbApi } from "../models/api.interface.js";
|
||||
import { ManifestApi, ManifestElementAndApi } from "../types/base.types.js";
|
||||
import { loadManifestApi } from "./load-manifest-api.function.js";
|
||||
|
||||
export async function createManifestApi<ApiType extends UmbApi = UmbApi>(manifest: ManifestApi<ApiType> | ManifestElementAndApi<any, ApiType>, constructorArguments: unknown[] = []): Promise<ApiType | undefined> {
|
||||
export async function createExtensionApi<ApiType extends UmbApi = UmbApi>(manifest: ManifestApi<ApiType> | ManifestElementAndApi<any, ApiType>, constructorArguments: unknown[] = []): Promise<ApiType | undefined> {
|
||||
|
||||
if(manifest.api) {
|
||||
const apiConstructor = await loadManifestApi<ApiType>(manifest.api);
|
||||
@@ -1,7 +1,7 @@
|
||||
import { expect } from '@open-wc/testing';
|
||||
import { ManifestApi } from '../types/index.js';
|
||||
import { UmbApi } from '../models/api.interface.js';
|
||||
import { createManifestApi } from './create-manifest-api.function.js';
|
||||
import { createExtensionApi } from './create-extension-api.function.js';
|
||||
|
||||
|
||||
|
||||
@@ -49,7 +49,7 @@ describe('Extension-Api: Create Extension Api', () => {
|
||||
name: 'pretty name'
|
||||
};
|
||||
|
||||
const api = await createManifestApi(manifest, []);
|
||||
const api = await createExtensionApi(manifest, []);
|
||||
expect(api).to.be.undefined;
|
||||
});
|
||||
|
||||
@@ -62,7 +62,7 @@ describe('Extension-Api: Create Extension Api', () => {
|
||||
api: UmbExtensionApiTrueTestClass
|
||||
};
|
||||
|
||||
const api = await createManifestApi(manifest, []);
|
||||
const api = await createExtensionApi(manifest, []);
|
||||
expect(api).to.not.be.undefined;
|
||||
if(api) {
|
||||
expect(api.isValidClassInstance()).to.be.true;
|
||||
@@ -78,7 +78,7 @@ describe('Extension-Api: Create Extension Api', () => {
|
||||
js: () => Promise.resolve(jsModuleWithDefaultExport)
|
||||
};
|
||||
|
||||
const api = await createManifestApi(manifest, []);
|
||||
const api = await createExtensionApi(manifest, []);
|
||||
expect(api).to.not.be.undefined;
|
||||
if(api) {
|
||||
expect(api.isValidClassInstance()).to.be.true;
|
||||
@@ -94,7 +94,7 @@ describe('Extension-Api: Create Extension Api', () => {
|
||||
js: () => Promise.resolve(jsModuleWithApiExport)
|
||||
};
|
||||
|
||||
const api = await createManifestApi(manifest, []);
|
||||
const api = await createExtensionApi(manifest, []);
|
||||
expect(api).to.not.be.undefined;
|
||||
if(api) {
|
||||
expect(api.isValidClassInstance()).to.be.true;
|
||||
@@ -110,7 +110,7 @@ describe('Extension-Api: Create Extension Api', () => {
|
||||
js: () => Promise.resolve(jsModuleWithDefaultAndApiExport)
|
||||
};
|
||||
|
||||
const api = await createManifestApi(manifest, []);
|
||||
const api = await createExtensionApi(manifest, []);
|
||||
expect(api).to.not.be.undefined;
|
||||
if(api) {
|
||||
expect(api.isValidClassInstance()).to.be.true;
|
||||
@@ -1,7 +1,7 @@
|
||||
import { ManifestElement, ManifestElementAndApi } from "../types/base.types.js";
|
||||
import { loadManifestElement } from "./load-manifest-element.function.js";
|
||||
|
||||
export async function createManifestElement<ElementType extends HTMLElement>(manifest: ManifestElement<ElementType> | ManifestElementAndApi<ElementType>, fallbackElement?: string): Promise<ElementType | undefined> {
|
||||
export async function createExtensionElement<ElementType extends HTMLElement>(manifest: ManifestElement<ElementType> | ManifestElementAndApi<ElementType>, fallbackElement?: string): Promise<ElementType | undefined> {
|
||||
|
||||
if(manifest.element) {
|
||||
const elementConstructor = await loadManifestElement<ElementType>(manifest.element);
|
||||
@@ -1,6 +1,6 @@
|
||||
import { expect } from '@open-wc/testing';
|
||||
import { ManifestElement, ManifestElementAndApi } from '../types/index.js';
|
||||
import { createManifestElement } from './create-manifest-element.function.js';
|
||||
import { createExtensionElement } from './create-extension-element.function.js';
|
||||
import { customElement } from '@umbraco-cms/backoffice/external/lit';
|
||||
|
||||
|
||||
@@ -47,7 +47,7 @@ describe('Extension-Api: Create Extension Element', () => {
|
||||
name: 'pretty name'
|
||||
};
|
||||
|
||||
const api = await createManifestElement(manifest);
|
||||
const api = await createExtensionElement(manifest);
|
||||
expect(api).to.be.undefined;
|
||||
});
|
||||
|
||||
@@ -59,7 +59,7 @@ describe('Extension-Api: Create Extension Element', () => {
|
||||
name: 'pretty name'
|
||||
};
|
||||
|
||||
const element = await createManifestElement(manifest, 'umb-extension-api-true-test-element');
|
||||
const element = await createExtensionElement(manifest, 'umb-extension-api-true-test-element');
|
||||
expect(element).to.not.be.undefined;
|
||||
if(element) {
|
||||
expect(element.isValidClassInstance()).to.be.true;
|
||||
@@ -76,7 +76,7 @@ describe('Extension-Api: Create Extension Element', () => {
|
||||
api: class TestApi {}
|
||||
};
|
||||
|
||||
const element = await createManifestElement(manifest, 'umb-extension-api-true-test-element');
|
||||
const element = await createExtensionElement(manifest, 'umb-extension-api-true-test-element');
|
||||
expect(element).to.not.be.undefined;
|
||||
if(element) {
|
||||
expect(element.isValidClassInstance()).to.be.true;
|
||||
@@ -92,7 +92,7 @@ describe('Extension-Api: Create Extension Element', () => {
|
||||
elementName: 'umb-extension-api-true-test-element'
|
||||
};
|
||||
|
||||
const element = await createManifestElement(manifest);
|
||||
const element = await createExtensionElement(manifest);
|
||||
expect(element).to.not.be.undefined;
|
||||
if(element) {
|
||||
expect(element.isValidClassInstance()).to.be.true;
|
||||
@@ -108,7 +108,7 @@ describe('Extension-Api: Create Extension Element', () => {
|
||||
js: () => Promise.resolve(jsModuleWithDefaultExport)
|
||||
};
|
||||
|
||||
const element = await createManifestElement(manifest);
|
||||
const element = await createExtensionElement(manifest);
|
||||
expect(element).to.not.be.undefined;
|
||||
if(element) {
|
||||
expect(element.isValidClassInstance()).to.be.true;
|
||||
@@ -124,7 +124,7 @@ describe('Extension-Api: Create Extension Element', () => {
|
||||
js: () => Promise.resolve(jsModuleWithElementExport)
|
||||
};
|
||||
|
||||
const element = await createManifestElement(manifest);
|
||||
const element = await createExtensionElement(manifest);
|
||||
expect(element).to.not.be.undefined;
|
||||
if(element) {
|
||||
expect(element.isValidClassInstance()).to.be.true;
|
||||
@@ -140,7 +140,7 @@ describe('Extension-Api: Create Extension Element', () => {
|
||||
js: () => Promise.resolve(jsModuleWithDefaultAndElementExport)
|
||||
};
|
||||
|
||||
const element = await createManifestElement(manifest);
|
||||
const element = await createExtensionElement(manifest);
|
||||
expect(element).to.not.be.undefined;
|
||||
if(element) {
|
||||
expect(element.isValidClassInstance()).to.be.true;
|
||||
@@ -1,6 +1,6 @@
|
||||
|
||||
export * from './create-manifest-api.function.js';
|
||||
export * from './create-manifest-element.function.js';
|
||||
export * from './create-extension-api.function.js';
|
||||
export * from './create-extension-element.function.js';
|
||||
export * from './has-init-export.function.js';
|
||||
export * from './load-manifest-api.function.js';
|
||||
export * from './load-manifest-element.function.js';
|
||||
|
||||
@@ -7,7 +7,7 @@ import {
|
||||
UmbNumberState,
|
||||
UmbObjectState,
|
||||
} from '@umbraco-cms/backoffice/observable-api';
|
||||
import { UmbExtensionsManifestInitializer, createManifestApi } from '@umbraco-cms/backoffice/extension-api';
|
||||
import { UmbExtensionsManifestInitializer, createExtensionApi } from '@umbraco-cms/backoffice/extension-api';
|
||||
import { ManifestCollectionView, umbExtensionsRegistry } from '@umbraco-cms/backoffice/extension-registry';
|
||||
import type { UmbCollectionFilterModel } from '@umbraco-cms/backoffice/collection';
|
||||
import { UmbSelectionManager, UmbPaginationManager } from '@umbraco-cms/backoffice/utils';
|
||||
@@ -182,7 +182,7 @@ export class UmbCollectionContext<ItemType, FilterModelType extends UmbCollectio
|
||||
async (repositoryManifest) => {
|
||||
if (repositoryManifest) {
|
||||
// TODO: Maybe use the UmbExtensionApiController instead of createExtensionApi, to ensure usage of conditions:
|
||||
const result = await createManifestApi(repositoryManifest, [this._host]);
|
||||
const result = await createExtensionApi(repositoryManifest, [this._host]);
|
||||
this.repository = result as UmbCollectionRepository;
|
||||
this.requestCollection();
|
||||
}
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import { UMB_COLLECTION_CONTEXT, UmbCollectionContext } from './collection.context.js';
|
||||
import { UmbTextStyles } from '@umbraco-cms/backoffice/style';
|
||||
import { css, html, customElement, state, property } from '@umbraco-cms/backoffice/external/lit';
|
||||
import { createManifestElement } from '@umbraco-cms/backoffice/extension-api';
|
||||
import { createExtensionElement } from '@umbraco-cms/backoffice/extension-api';
|
||||
import { ManifestCollectionView } from '@umbraco-cms/backoffice/extension-registry';
|
||||
import { UmbLitElement } from '@umbraco-cms/internal/lit-element';
|
||||
import type { UmbRoute } from '@umbraco-cms/backoffice/router';
|
||||
@@ -45,7 +45,7 @@ export class UmbCollectionElement extends UmbLitElement {
|
||||
this._routes = views.map((view) => {
|
||||
return {
|
||||
path: `${view.meta.pathName}`,
|
||||
component: () => createManifestElement(view),
|
||||
component: () => createExtensionElement(view),
|
||||
};
|
||||
});
|
||||
}
|
||||
|
||||
@@ -3,7 +3,7 @@ import { html, nothing, ifDefined, customElement, property, state } from '@umbra
|
||||
import { UUIMenuItemEvent } from '@umbraco-cms/backoffice/external/uui';
|
||||
import { UmbLitElement } from '@umbraco-cms/internal/lit-element';
|
||||
import { ManifestEntityAction } from '@umbraco-cms/backoffice/extension-registry';
|
||||
import { createManifestApi } from '@umbraco-cms/backoffice/extension-api';
|
||||
import { createExtensionApi } from '@umbraco-cms/backoffice/extension-api';
|
||||
|
||||
@customElement('umb-entity-action')
|
||||
export class UmbEntityActionElement extends UmbLitElement {
|
||||
@@ -40,7 +40,7 @@ export class UmbEntityActionElement extends UmbLitElement {
|
||||
if (!this._manifest) return;
|
||||
if (this._unique === undefined) return;
|
||||
|
||||
this.#api = await createManifestApi(this._manifest, [this, this._manifest.meta.repositoryAlias, this.unique]);
|
||||
this.#api = await createExtensionApi(this._manifest, [this, this._manifest.meta.repositoryAlias, this.unique]);
|
||||
|
||||
// TODO: Fix so when we use a HREF it does not refresh the page?
|
||||
this._href = await this.#api.getHref?.();
|
||||
|
||||
@@ -3,7 +3,7 @@ import { UmbActionExecutedEvent } from '@umbraco-cms/backoffice/event';
|
||||
import { html, ifDefined, customElement, property } from '@umbraco-cms/backoffice/external/lit';
|
||||
import { ManifestEntityBulkAction } from '@umbraco-cms/backoffice/extension-registry';
|
||||
import { UmbLitElement } from '@umbraco-cms/internal/lit-element';
|
||||
import { createManifestApi } from '@umbraco-cms/backoffice/extension-api';
|
||||
import { createExtensionApi } from '@umbraco-cms/backoffice/extension-api';
|
||||
|
||||
@customElement('umb-entity-bulk-action')
|
||||
export class UmbEntityBulkActionElement extends UmbLitElement {
|
||||
@@ -38,7 +38,7 @@ export class UmbEntityBulkActionElement extends UmbLitElement {
|
||||
async #createApi() {
|
||||
if (!this._manifest) return;
|
||||
|
||||
this.#api = await createManifestApi(this._manifest, [this, this._manifest.meta.repositoryAlias, this._selection]);
|
||||
this.#api = await createExtensionApi(this._manifest, [this, this._manifest.meta.repositoryAlias, this._selection]);
|
||||
}
|
||||
|
||||
#api?: UmbEntityBulkActionBase;
|
||||
|
||||
@@ -7,7 +7,7 @@ import { BehaviorSubject } from '@umbraco-cms/backoffice/external/rxjs';
|
||||
import { UmbObserverController } from '@umbraco-cms/backoffice/observable-api';
|
||||
import { UUIDialogElement, UUIModalDialogElement, UUIModalSidebarElement } from '@umbraco-cms/backoffice/external/uui';
|
||||
import { UmbRouterSlotElement } from '@umbraco-cms/backoffice/router';
|
||||
import { createManifestElement } from '@umbraco-cms/backoffice/extension-api';
|
||||
import { createExtensionElement } from '@umbraco-cms/backoffice/extension-api';
|
||||
import { UmbContextProvider } from '@umbraco-cms/backoffice/context-api';
|
||||
|
||||
@customElement('umb-modal')
|
||||
@@ -104,7 +104,7 @@ export class UmbModalElement extends UmbLitElement {
|
||||
|
||||
async #createInnerElement(manifest: ManifestModal) {
|
||||
// TODO: add inner fallback element if no extension element is found
|
||||
const innerElement = (await createManifestElement(manifest));
|
||||
const innerElement = (await createExtensionElement(manifest));
|
||||
|
||||
if (innerElement) {
|
||||
innerElement.data = this.#modalContext!.data;
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import type { UmbPropertyAction } from './property-action.model.js';
|
||||
import { CSSResultGroup, html, LitElement, customElement, property, state } from '@umbraco-cms/backoffice/external/lit';
|
||||
import { UmbTextStyles } from "@umbraco-cms/backoffice/style";
|
||||
import { createManifestElement } from '@umbraco-cms/backoffice/extension-api';
|
||||
import { createExtensionElement } from '@umbraco-cms/backoffice/extension-api';
|
||||
|
||||
import type { ManifestPropertyAction } from '@umbraco-cms/backoffice/extension-registry';
|
||||
|
||||
@@ -30,7 +30,7 @@ export class UmbPropertyActionElement extends LitElement implements UmbPropertyA
|
||||
|
||||
try {
|
||||
// TODO: Here is a problem. The UmbPropertyActionElement is used for the type of the Extension Element. But is also a component that renders the Extension Element...
|
||||
this._element = (await createManifestElement(this.propertyAction));
|
||||
this._element = (await createExtensionElement(this.propertyAction));
|
||||
if (!this._element) return;
|
||||
|
||||
this._element.value = this.value;
|
||||
|
||||
@@ -5,7 +5,7 @@ import { UmbTextStyles } from '@umbraco-cms/backoffice/style';
|
||||
import type { UUIButtonState } from '@umbraco-cms/backoffice/external/uui';
|
||||
import { UmbLitElement } from '@umbraco-cms/internal/lit-element';
|
||||
import type { ManifestWorkspaceAction } from '@umbraco-cms/backoffice/extension-registry';
|
||||
import { createManifestApi } from '@umbraco-cms/backoffice/extension-api';
|
||||
import { createExtensionApi } from '@umbraco-cms/backoffice/extension-api';
|
||||
|
||||
@customElement('umb-workspace-action')
|
||||
export class UmbWorkspaceActionElement extends UmbLitElement {
|
||||
@@ -29,7 +29,7 @@ export class UmbWorkspaceActionElement extends UmbLitElement {
|
||||
|
||||
async #createApi() {
|
||||
if (!this._manifest) return;
|
||||
this.#api = await createManifestApi(this._manifest, [this]);
|
||||
this.#api = await createExtensionApi(this._manifest, [this]);
|
||||
}
|
||||
|
||||
#api?: UmbWorkspaceAction;
|
||||
|
||||
@@ -2,7 +2,7 @@ import { type UmbPropertyEditorConfig } from '../../property-editor/index.js';
|
||||
import { UmbWorkspacePropertyContext } from './workspace-property.context.js';
|
||||
import { UmbTextStyles } from "@umbraco-cms/backoffice/style";
|
||||
import { css, html, customElement, property, state, ifDefined } from '@umbraco-cms/backoffice/external/lit';
|
||||
import { createManifestElement } from '@umbraco-cms/backoffice/extension-api';
|
||||
import { createExtensionElement } from '@umbraco-cms/backoffice/extension-api';
|
||||
import { ManifestPropertyEditorUi, umbExtensionsRegistry } from '@umbraco-cms/backoffice/extension-registry';
|
||||
import { UmbObserverController } from '@umbraco-cms/backoffice/observable-api';
|
||||
import { UmbLitElement } from '@umbraco-cms/internal/lit-element';
|
||||
@@ -143,7 +143,7 @@ export class UmbWorkspacePropertyElement extends UmbLitElement {
|
||||
return;
|
||||
}
|
||||
|
||||
const el = await createManifestElement(manifest);
|
||||
const el = await createExtensionElement(manifest);
|
||||
if(el) {
|
||||
const oldValue = this._element;
|
||||
|
||||
|
||||
@@ -5,7 +5,7 @@ import {
|
||||
UmbSectionViewExtensionElement,
|
||||
umbExtensionsRegistry,
|
||||
} from '@umbraco-cms/backoffice/extension-registry';
|
||||
import { createManifestElement } from '@umbraco-cms/backoffice/extension-api';
|
||||
import { createExtensionElement } from '@umbraco-cms/backoffice/extension-api';
|
||||
import { UmbLitElement } from '@umbraco-cms/internal/lit-element';
|
||||
|
||||
@customElement('umb-created-packages-section-view')
|
||||
@@ -35,7 +35,7 @@ export class UmbCreatedPackagesSectionViewElement extends UmbLitElement implemen
|
||||
this._workspaces?.map((workspace: ManifestWorkspace) => {
|
||||
routes.push({
|
||||
path: `${workspace.meta.entityType}/:id`,
|
||||
component: () => createManifestElement(workspace),
|
||||
component: () => createExtensionElement(workspace),
|
||||
setup: (component, info) => {
|
||||
if (component) {
|
||||
(component as any).entityId = info.match.params.id;
|
||||
@@ -44,7 +44,7 @@ export class UmbCreatedPackagesSectionViewElement extends UmbLitElement implemen
|
||||
});
|
||||
routes.push({
|
||||
path: workspace.meta.entityType,
|
||||
component: () => createManifestElement(workspace),
|
||||
component: () => createExtensionElement(workspace),
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user