@umbraco-cms/backoffice 1.0.0-next.37dcc47c → 1.0.0-next.47cc3341

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -87,10 +87,10 @@ customElements.define('my-custom-dashboard', MyDashboardElement);
87
87
 
88
88
  ### TypeScript with Lit
89
89
 
90
- First install Lit and Vite. This command will create a new folder called "my-package". Choose "lit" and "typescript" when prompted.
90
+ First install Lit and Vite. This command will create a new folder called `my-package` which will have the Vite tooling and Lit for WebComponent development setup.
91
91
 
92
92
  ```bash
93
- npm create vite@latest my-package
93
+ npm create vite@latest -- --template lit-ts my-package
94
94
  ```
95
95
 
96
96
  Go to the new folder and install the backoffice package.
@@ -100,7 +100,7 @@ cd my-package
100
100
  npm install -D @umbraco-cms/backoffice
101
101
  ```
102
102
 
103
- Then go to the element located in `src/my-element.ts` and add the following code.
103
+ Then go to the element located in `src/my-element.ts` and replace it with the following code.
104
104
 
105
105
  ```typescript
106
106
  // src/my-element.ts
@@ -111,23 +111,24 @@ import { UmbNotificationContext, UMB_NOTIFICATION_CONTEXT_TOKEN } from '@umbraco
111
111
 
112
112
  @customElement('my-element')
113
113
  export default class MyElement extends UmbElementMixin(LitElement) {
114
- #notificationContext?: UmbNotificationContext;
114
+
115
+ private _notificationContext?: UmbNotificationContext;
115
116
 
116
117
  constructor() {
117
118
  super();
118
119
  this.consumeContext(UMB_NOTIFICATION_CONTEXT_TOKEN, (_instance) => {
119
- this.#notificationContext = _instance;
120
+ this._notificationContext = _instance;
120
121
  });
121
122
  }
122
123
 
123
124
  onClick() {
124
- this.#notificationContext?.peek('positive', { data: { message: '#h5yr' } });
125
+ this._notificationContext?.peek('positive', { data: { message: '#h5yr' } });
125
126
  }
126
127
 
127
128
  render() {
128
129
  return html`
129
130
  <uui-box headline="Welcome">
130
- <p>TS dashboard</p>
131
+ <p>A TypeScript Lit Dashboard</p>
131
132
  <uui-button look="primary" label="Click me" @click=${() => this.onClick()}></uui-button>
132
133
  </uui-box>
133
134
  `;
@@ -141,7 +142,7 @@ declare global {
141
142
  }
142
143
  ```
143
144
 
144
- Finally add an umbraco-package.json file in the root of your package.
145
+ Finally add an umbraco-package.json file in the root of your package folder `my-package`.
145
146
 
146
147
  ```json
147
148
  {
package/context-api.d.ts CHANGED
@@ -1,4 +1,6 @@
1
- import { UmbControllerHostInterface, UmbControllerInterface } from './controller';
1
+ import { UmbControllerHostElement, UmbControllerInterface } from './controller';
2
+ import { UmbWorkspaceContextInterface } from './workspace';
3
+ import { BaseEntity } from './models';
2
4
 
3
5
  declare class UmbContextToken<T = unknown> {
4
6
  protected alias: string;
@@ -90,9 +92,9 @@ declare class UmbContextConsumer<HostType extends EventTarget = EventTarget, T =
90
92
  destroy(): void;
91
93
  }
92
94
 
93
- declare class UmbContextConsumerController<T = unknown> extends UmbContextConsumer<UmbControllerHostInterface, T> implements UmbControllerInterface {
95
+ declare class UmbContextConsumerController<T = unknown> extends UmbContextConsumer<UmbControllerHostElement, T> implements UmbControllerInterface {
94
96
  get unique(): undefined;
95
- constructor(host: UmbControllerHostInterface, contextAlias: string | UmbContextToken<T>, callback: UmbContextCallback<T>);
97
+ constructor(host: UmbControllerHostElement, contextAlias: string | UmbContextToken<T>, callback: UmbContextCallback<T>);
96
98
  destroy(): void;
97
99
  }
98
100
 
@@ -136,9 +138,9 @@ declare class UmbContextProvider<HostType extends EventTarget = EventTarget> {
136
138
  destroy(): void;
137
139
  }
138
140
 
139
- declare class UmbContextProviderController<T = unknown> extends UmbContextProvider<UmbControllerHostInterface> implements UmbControllerInterface {
141
+ declare class UmbContextProviderController<T = unknown> extends UmbContextProvider<UmbControllerHostElement> implements UmbControllerInterface {
140
142
  get unique(): string;
141
- constructor(host: UmbControllerHostInterface, contextAlias: string | UmbContextToken<T>, instance: T);
143
+ constructor(host: UmbControllerHostElement, contextAlias: string | UmbContextToken<T>, instance: T);
142
144
  destroy(): void;
143
145
  }
144
146
 
@@ -162,4 +164,72 @@ declare class UmbContextProvideEventImplementation extends Event implements UmbC
162
164
  }
163
165
  declare const isUmbContextProvideEventType: (event: Event) => event is UmbContextProvideEventImplementation;
164
166
 
165
- export { UmbContextCallback, UmbContextConsumer, UmbContextConsumerController, UmbContextDebugRequest, UmbContextProvideEvent, UmbContextProvideEventImplementation, UmbContextProvider, UmbContextProviderController, UmbContextRequestEvent, UmbContextRequestEventImplementation, UmbContextToken, isUmbContextProvideEventType, isUmbContextRequestEvent, umbContextProvideEventType, umbContextRequestEventType, umbDebugContextEventType };
167
+ interface UmbEntityWorkspaceContextInterface<EntityType = unknown> extends UmbWorkspaceContextInterface<EntityType> {
168
+ getEntityKey(): string | undefined;
169
+ getEntityType(): string;
170
+ save(): Promise<void>;
171
+ }
172
+
173
+ declare const UMB_ENTITY_WORKSPACE_CONTEXT: UmbContextToken<UmbEntityWorkspaceContextInterface<BaseEntity>>;
174
+
175
+ /**
176
+ * Change the collection of Contexts into a simplified array of data
177
+ *
178
+ * @param contexts This is a map of the collected contexts from umb-debug
179
+ * @returns An array of simplified context data
180
+ */
181
+ declare function contextData(contexts: Map<any, any>): Array<DebugContextData>;
182
+ interface DebugContextData {
183
+ /**
184
+ * The alias of the context
185
+ *
186
+ * @type {string}
187
+ * @memberof DebugContextData
188
+ */
189
+ alias: string;
190
+ /**
191
+ * The type of the context such as object or string
192
+ *
193
+ * @type {("string" | "number" | "bigint" | "boolean" | "symbol" | "undefined" | "object" | "function")}
194
+ * @memberof DebugContextData
195
+ */
196
+ type: "string" | "number" | "bigint" | "boolean" | "symbol" | "undefined" | "object" | "function";
197
+ /**
198
+ * Data about the context that includes method and property names
199
+ *
200
+ * @type {DebugContextItemData}
201
+ * @memberof DebugContextData
202
+ */
203
+ data: DebugContextItemData;
204
+ }
205
+ interface DebugContextItemData {
206
+ type: string;
207
+ methods?: Array<unknown>;
208
+ properties?: Array<DebugContextItemPropertyData>;
209
+ value?: unknown;
210
+ }
211
+ interface DebugContextItemPropertyData {
212
+ /**
213
+ * The name of the property
214
+ *
215
+ * @type {string}
216
+ * @memberof DebugContextItemPropertyData
217
+ */
218
+ key: string;
219
+ /**
220
+ * The type of the property's value such as string or number
221
+ *
222
+ * @type {("string" | "number" | "bigint" | "boolean" | "symbol" | "undefined" | "object" | "function")}
223
+ * @memberof DebugContextItemPropertyData
224
+ */
225
+ type: "string" | "number" | "bigint" | "boolean" | "symbol" | "undefined" | "object" | "function";
226
+ /**
227
+ * Simple types such as string or number can have their value displayed stored inside the property
228
+ *
229
+ * @type {("string" | "number" | "bigint" | "boolean" | "symbol" | "undefined" | "object" | "function")}
230
+ * @memberof DebugContextItemPropertyData
231
+ */
232
+ value?: unknown;
233
+ }
234
+
235
+ export { DebugContextData, DebugContextItemData, DebugContextItemPropertyData, UMB_ENTITY_WORKSPACE_CONTEXT, UmbContextCallback, UmbContextConsumer, UmbContextConsumerController, UmbContextDebugRequest, UmbContextProvideEvent, UmbContextProvideEventImplementation, UmbContextProvider, UmbContextProviderController, UmbContextRequestEvent, UmbContextRequestEventImplementation, UmbContextToken, contextData, isUmbContextProvideEventType, isUmbContextRequestEvent, umbContextProvideEventType, umbContextRequestEventType, umbDebugContextEventType };
package/controller.d.ts CHANGED
@@ -7,7 +7,7 @@ interface UmbControllerInterface {
7
7
  destroy(): void;
8
8
  }
9
9
 
10
- declare class UmbControllerHostInterface extends HTMLElement {
10
+ declare class UmbControllerHostElement extends HTMLElement {
11
11
  hasController(controller: UmbControllerInterface): boolean;
12
12
  getControllers(filterMethod: (ctrl: UmbControllerInterface) => boolean): UmbControllerInterface[];
13
13
  addController(controller: UmbControllerInterface): void;
@@ -20,7 +20,7 @@ declare class UmbControllerHostInterface extends HTMLElement {
20
20
  * @param {Object} superClass - superclass to be extended.
21
21
  * @mixin
22
22
  */
23
- declare const UmbControllerHostMixin: <T extends HTMLElementConstructor<HTMLElement>>(superClass: T) => HTMLElementConstructor<UmbControllerHostInterface> & T;
23
+ declare const UmbControllerHostMixin: <T extends HTMLElementConstructor>(superClass: T) => HTMLElementConstructor<UmbControllerHostElement> & T;
24
24
  declare global {
25
25
  interface HTMLElement {
26
26
  connectedCallback(): void;
@@ -29,13 +29,13 @@ declare global {
29
29
  }
30
30
 
31
31
  declare abstract class UmbController implements UmbControllerInterface {
32
- protected host?: UmbControllerHostInterface;
32
+ protected host?: UmbControllerHostElement;
33
33
  private _alias?;
34
34
  get unique(): string | undefined;
35
- constructor(host: UmbControllerHostInterface, alias?: string);
35
+ constructor(host: UmbControllerHostElement, alias?: string);
36
36
  abstract hostConnected(): void;
37
37
  abstract hostDisconnected(): void;
38
38
  destroy(): void;
39
39
  }
40
40
 
41
- export { UmbController, UmbControllerHostInterface, UmbControllerHostMixin, UmbControllerInterface };
41
+ export { UmbController, UmbControllerHostElement, UmbControllerHostMixin, UmbControllerInterface };