diff --git a/src/Umbraco.Web.UI.Client/src/packages/core/components/extension-slot/extension-slot.element.ts b/src/Umbraco.Web.UI.Client/src/packages/core/components/extension-slot/extension-slot.element.ts index 0aa5a4b1fe..2a13311cb7 100644 --- a/src/Umbraco.Web.UI.Client/src/packages/core/components/extension-slot/extension-slot.element.ts +++ b/src/Umbraco.Web.UI.Client/src/packages/core/components/extension-slot/extension-slot.element.ts @@ -30,49 +30,66 @@ export class UmbExtensionSlotElement extends UmbLitElement { * @type {string | string[]} * @memberof UmbExtensionSlot * @example - * + * * or multiple: - * + * * */ @property({ type: String }) public get type(): string | string[] | undefined { - return this._type; + return this.#type; } public set type(value: string | string[] | undefined) { - if (value === this._type) return; - this._type = value; + if (value === this.#type) return; + this.#type = value; if (this.#attached) { this._observeExtensions(); } } - private _type?: string | string[] | undefined; + #type?: string | string[] | undefined; + /** + * Filter method for extension manifests. + * This is an initial filter taking effect before conditions or overwrites, the extensions will still be filtered by the conditions defined in the manifest. + * @type {(manifest: any) => boolean} + * @memberof UmbExtensionSlot + * @example + * ext.meta.anyPropToFilter === 'foo'}> + * + */ @property({ type: Object, attribute: false }) public get filter(): (manifest: any) => boolean { - return this._filter; + return this.#filter; } public set filter(value: (manifest: any) => boolean) { - if (value === this._filter) return; - this._filter = value; + if (value === this.#filter) return; + this.#filter = value; if (this.#attached) { this._observeExtensions(); } } - private _filter: (manifest: any) => boolean = () => true; + #filter: (manifest: any) => boolean = () => true; - private _props?: Record = {}; + /** + * Properties to pass to the extensions elements. + * Notice: The individual manifest of the extension is parsed to each extension element no matter if this is set or not. + * @type {Record} + * @memberof UmbExtensionSlot + * @example + * + */ @property({ type: Object, attribute: false }) get props() { - return this._props; + return this.#props; } - set props(newVal) { + set props(newVal: Record | undefined) { // TODO, compare changes since last time. only reset the ones that changed. This might be better done by the controller is self: - this._props = newVal; + this.#props = newVal; if (this.#extensionsController) { this.#extensionsController.properties = newVal; } } + #props?: Record = {}; @property({ type: String, attribute: 'default-element' }) public defaultElement = ''; @@ -88,18 +105,18 @@ export class UmbExtensionSlotElement extends UmbLitElement { private _observeExtensions() { this.#extensionsController?.destroy(); - if (this._type) { + if (this.#type) { this.#extensionsController = new UmbExtensionsElementController( this, umbExtensionsRegistry, - this._type, + this.#type, this.filter, (extensionControllers) => { this._permittedExts = extensionControllers; }, this.defaultElement ); - this.#extensionsController.properties = this._props; + this.#extensionsController.properties = this.#props; } } diff --git a/src/Umbraco.Web.UI.Client/src/packages/core/extension-registry/conditions/section-alias.condition.ts b/src/Umbraco.Web.UI.Client/src/packages/core/extension-registry/conditions/section-alias.condition.ts index c026b1d6da..a8f79bbe91 100644 --- a/src/Umbraco.Web.UI.Client/src/packages/core/extension-registry/conditions/section-alias.condition.ts +++ b/src/Umbraco.Web.UI.Client/src/packages/core/extension-registry/conditions/section-alias.condition.ts @@ -29,7 +29,7 @@ export type SectionAliasConditionConfig = UmbConditionConfigBase<'Umb.Condition. /** * Define the section that this extension should be available in * - * @examples + * @example * "Umb.Section.Content" */ match: string; diff --git a/src/Umbraco.Web.UI.Client/src/packages/core/workspace/workspace-alias.condition.ts b/src/Umbraco.Web.UI.Client/src/packages/core/workspace/workspace-alias.condition.ts index 59a21c5c83..6d7aa163c2 100644 --- a/src/Umbraco.Web.UI.Client/src/packages/core/workspace/workspace-alias.condition.ts +++ b/src/Umbraco.Web.UI.Client/src/packages/core/workspace/workspace-alias.condition.ts @@ -27,7 +27,7 @@ export type WorkspaceAliasConditionConfig = UmbConditionConfigBase<'Umb.Conditio /** * Define the workspace that this extension should be available in * - * @examples + * @example * "Umb.Workspace.Document" */ match: string;