Renamed DebugContext type exports as UmbDebugContext

This commit is contained in:
leekelleher
2024-05-13 18:03:48 +01:00
parent e1340f45bd
commit afc5600d16
2 changed files with 21 additions and 21 deletions

View File

@@ -5,8 +5,8 @@
* @param contexts This is a map of the collected contexts from umb-debug
* @returns An array of simplified context data
*/
export function contextData(contexts: Map<any, any>): Array<DebugContextData> {
const contextData = new Array<DebugContextData>();
export function contextData(contexts: Map<any, any>): Array<UmbDebugContextData> {
const contextData = new Array<UmbDebugContextData>();
for (const [alias, instance] of contexts) {
const data: DebugContextItemData = contextItemData(instance);
contextData.push({ alias: alias, type: typeof instance, data });
@@ -20,8 +20,8 @@ export function contextData(contexts: Map<any, any>): Array<DebugContextData> {
* @param contextInstance The instance of the context
* @returns A simplied object contain the properties and methods of the context
*/
function contextItemData(contextInstance: any): DebugContextItemData {
let contextItemData: DebugContextItemData = { type: 'unknown' };
function contextItemData(contextInstance: any): UmbDebugContextItemData {
let contextItemData: UmbDebugContextItemData = { type: 'unknown' };
if (typeof contextInstance === 'function') {
contextItemData = { ...contextItemData, type: 'function' };
@@ -101,12 +101,12 @@ function getClassMethodNames(klass: any) {
return allMethods.filter((name: any) => name !== 'constructor' && !name.startsWith('_'));
}
export interface DebugContextData {
export interface UmbDebugContextData {
/**
* The alias of the context
*
* @type {string}
* @memberof DebugContextData
* @memberof UmbDebugContextData
*/
alias: string;
@@ -114,32 +114,32 @@ export interface DebugContextData {
* The type of the context such as object or string
*
* @type {("string" | "number" | "bigint" | "boolean" | "symbol" | "undefined" | "object" | "function")}
* @memberof DebugContextData
* @memberof UmbDebugContextData
*/
type: 'string' | 'number' | 'bigint' | 'boolean' | 'symbol' | 'undefined' | 'object' | 'function';
/**
* Data about the context that includes method and property names
*
* @type {DebugContextItemData}
* @memberof DebugContextData
* @type {UmbDebugContextItemData}
* @memberof UmbDebugContextData
*/
data: DebugContextItemData;
data: UmbDebugContextItemData;
}
export interface DebugContextItemData {
export interface UmbDebugContextItemData {
type: string;
methods?: Array<unknown>;
properties?: Array<DebugContextItemPropertyData>;
properties?: Array<UmbDebugContextItemPropertyData>;
value?: unknown;
}
export interface DebugContextItemPropertyData {
export interface UmbDebugContextItemPropertyData {
/**
* The name of the property
*
* @type {string}
* @memberof DebugContextItemPropertyData
* @memberof UmbDebugContextItemPropertyData
*/
key: string;
@@ -147,7 +147,7 @@ export interface DebugContextItemPropertyData {
* The type of the property's value such as string or number
*
* @type {("string" | "number" | "bigint" | "boolean" | "symbol" | "undefined" | "object" | "function")}
* @memberof DebugContextItemPropertyData
* @memberof UmbDebugContextItemPropertyData
*/
type: 'string' | 'number' | 'bigint' | 'boolean' | 'symbol' | 'undefined' | 'object' | 'function';
@@ -155,7 +155,7 @@ export interface DebugContextItemPropertyData {
* Simple types such as string or number can have their value displayed stored inside the property
*
* @type {("string" | "number" | "bigint" | "boolean" | "symbol" | "undefined" | "object" | "function")}
* @memberof DebugContextItemPropertyData
* @memberof UmbDebugContextItemPropertyData
*/
value?: unknown;
}

View File

@@ -2,11 +2,11 @@ import { UmbTextStyles } from '@umbraco-cms/backoffice/style';
import type { TemplateResult } from '@umbraco-cms/backoffice/external/lit';
import { css, html, nothing, customElement, property, state, repeat } from '@umbraco-cms/backoffice/external/lit';
import type { DebugContextData, DebugContextItemData } from '@umbraco-cms/backoffice/context-api';
import { contextData, UmbContextDebugRequest } from '@umbraco-cms/backoffice/context-api';
import { UmbLitElement } from '@umbraco-cms/backoffice/lit-element';
import type { UmbModalManagerContext } from '@umbraco-cms/backoffice/modal';
import { UMB_CONTEXT_DEBUGGER_MODAL, UMB_MODAL_MANAGER_CONTEXT } from '@umbraco-cms/backoffice/modal';
import type { UmbDebugContextData, UmbDebugContextItemData } from '@umbraco-cms/backoffice/context-api';
@customElement('umb-debug')
export class UmbDebugElement extends UmbLitElement {
@@ -17,7 +17,7 @@ export class UmbDebugElement extends UmbLitElement {
dialog = false;
@state()
contextData = Array<DebugContextData>();
private _contextData = Array<UmbDebugContextData>();
@state()
private _debugPaneOpen = false;
@@ -50,9 +50,9 @@ export class UmbDebugElement extends UmbLitElement {
// back to this property of the WebComponent
// Massage the data into a simplier array of objects
// From a function in the context-api '
this.contextData = contextData(contexts);
this.requestUpdate('contextData');
// from a function in the context-api.
this._contextData = contextData(contexts);
this.requestUpdate('_contextData');
}),
);
}