From af02bdf542fe5d8afbca980debcb319ca216c2d1 Mon Sep 17 00:00:00 2001 From: Jacob Overgaard <752371+iOvergaard@users.noreply.github.com> Date: Thu, 19 Jan 2023 11:01:41 +0100 Subject: [PATCH] rename UmbContextAlias to UmbContextToken --- .../design/workspace-view-document-type-design.element.ts | 2 +- .../views/edit/data-type-workspace-view-edit.element.ts | 2 +- .../views/info/workspace-view-data-type-info.element.ts | 2 +- .../src/core/element/element.mixin.ts | 2 +- .../src/stories/umbelement.stories.mdx | 8 ++++---- 5 files changed, 8 insertions(+), 8 deletions(-) diff --git a/src/Umbraco.Web.UI.Client/src/backoffice/documents/document-types/workspace/views/design/workspace-view-document-type-design.element.ts b/src/Umbraco.Web.UI.Client/src/backoffice/documents/document-types/workspace/views/design/workspace-view-document-type-design.element.ts index ef831cf3c7..146230903f 100644 --- a/src/Umbraco.Web.UI.Client/src/backoffice/documents/document-types/workspace/views/design/workspace-view-document-type-design.element.ts +++ b/src/Umbraco.Web.UI.Client/src/backoffice/documents/document-types/workspace/views/design/workspace-view-document-type-design.element.ts @@ -18,7 +18,7 @@ export class UmbWorkspaceViewDocumentTypeDesignElement extends UmbLitElement { constructor() { super(); - // TODO: Figure out if this is the best way to consume the context or if it can be strongly typed with an UmbContextAlias + // TODO: Figure out if this is the best way to consume the context or if it can be strongly typed with an UmbContextToken this.consumeContext('umbWorkspaceContext', (documentTypeContext) => { this._workspaceContext = documentTypeContext; this._observeDocumentType(); diff --git a/src/Umbraco.Web.UI.Client/src/backoffice/settings/data-types/workspace/views/edit/data-type-workspace-view-edit.element.ts b/src/Umbraco.Web.UI.Client/src/backoffice/settings/data-types/workspace/views/edit/data-type-workspace-view-edit.element.ts index c0571e9665..f698c589ff 100644 --- a/src/Umbraco.Web.UI.Client/src/backoffice/settings/data-types/workspace/views/edit/data-type-workspace-view-edit.element.ts +++ b/src/Umbraco.Web.UI.Client/src/backoffice/settings/data-types/workspace/views/edit/data-type-workspace-view-edit.element.ts @@ -50,7 +50,7 @@ export class UmbDataTypeWorkspaceViewEditElement extends UmbLitElement { this._modalService = _instance; }); - // TODO: Figure out if this is the best way to consume a context or if it could be strongly typed using UmbContextAlias + // TODO: Figure out if this is the best way to consume a context or if it could be strongly typed using UmbContextToken this.consumeContext('umbWorkspaceContext', (_instance) => { this._workspaceContext = _instance; this._observeDataType(); diff --git a/src/Umbraco.Web.UI.Client/src/backoffice/settings/data-types/workspace/views/info/workspace-view-data-type-info.element.ts b/src/Umbraco.Web.UI.Client/src/backoffice/settings/data-types/workspace/views/info/workspace-view-data-type-info.element.ts index d532e3912f..fa4ecf1bf8 100644 --- a/src/Umbraco.Web.UI.Client/src/backoffice/settings/data-types/workspace/views/info/workspace-view-data-type-info.element.ts +++ b/src/Umbraco.Web.UI.Client/src/backoffice/settings/data-types/workspace/views/info/workspace-view-data-type-info.element.ts @@ -18,7 +18,7 @@ export class UmbWorkspaceViewDataTypeInfoElement extends UmbLitElement { constructor() { super(); - // TODO: Figure out if this is the best way to consume the context or if it can be strongly typed with an UmbContextAlias + // TODO: Figure out if this is the best way to consume the context or if it can be strongly typed with an UmbContextToken this.consumeContext('umbWorkspaceContext', (dataTypeContext) => { this._workspaceContext = dataTypeContext; this._observeDataType(); diff --git a/src/Umbraco.Web.UI.Client/src/core/element/element.mixin.ts b/src/Umbraco.Web.UI.Client/src/core/element/element.mixin.ts index eb855a226e..768b1d40cc 100644 --- a/src/Umbraco.Web.UI.Client/src/core/element/element.mixin.ts +++ b/src/Umbraco.Web.UI.Client/src/core/element/element.mixin.ts @@ -69,7 +69,7 @@ export const UmbElementMixin = (superClass: T) * @param {string} aliases * @param {method} callback Callback method called when all contexts are resolved. * @memberof UmbElementMixin - * @deprecated it should not be necessary to consume multiple contexts at once, use consumeContext instead with an UmbContextAlias + * @deprecated it should not be necessary to consume multiple contexts at once, use consumeContext instead with an UmbContextToken */ consumeAllContexts(_contextAliases: Array, callback: (_instances: ResolvedContexts) => void) { let resolvedAmount = 0; diff --git a/src/Umbraco.Web.UI.Client/src/stories/umbelement.stories.mdx b/src/Umbraco.Web.UI.Client/src/stories/umbelement.stories.mdx index c00203099e..be0ac5d44e 100644 --- a/src/Umbraco.Web.UI.Client/src/stories/umbelement.stories.mdx +++ b/src/Umbraco.Web.UI.Client/src/stories/umbelement.stories.mdx @@ -13,9 +13,9 @@ The methods are (_note this can be out of date, we need to look into how we can ``` observe(source: Observable, callback: (_value: T) => void, unique?: string): UmbObserverController -provideContext(alias: string | UmbContextAlias, instance: R): UmbContextProviderController +provideContext(alias: string | UmbContextToken, instance: R): UmbContextProviderController -consumeContext(alias: string | UmbContextAlias, callback: UmbContextCallback): UmbContextConsumerController +consumeContext(alias: string | UmbContextToken, callback: UmbContextCallback): UmbContextConsumerController ``` Use these for an smooth consumption, like this request for a Context API using a simple string context, where the callback value is unknown @@ -27,10 +27,10 @@ this.consumeContext('requestThisContextAlias', (context) => { }); ``` -Or use the UmbContextAlias type to define the type of the context, like this +Or use the UmbContextToken type to define the type of the context, like this ``` -const contextAlias = new UmbContextAlias('description of context for debugging purposes'); +const contextAlias = new UmbContextToken('description of context for debugging purposes'); this.consumeContext(contextAlias, (context) => { // Notice this is a subscription, as context might change or a new one appears, but the value is strongly typed