@umbraco-cms/backoffice 1.0.0-next.37dcc47c → 1.0.0-next.386e13e7

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
@@ -40,7 +40,7 @@ Create an umbraco-package.json file in the root of your package.
40
40
  Then create a dashboard.js file the same folder.
41
41
 
42
42
  ```javascript
43
- import { UmbElementMixin } from '@umbraco-cms/backoffice/element';
43
+ import { UmbElementMixin } from '@umbraco-cms/backoffice/element-api';
44
44
  import { UMB_NOTIFICATION_CONTEXT_TOKEN } from '@umbraco-cms/backoffice/notification';
45
45
 
46
46
  const template = document.createElement('template');
@@ -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,34 +100,34 @@ 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
107
107
  import { LitElement, html } from 'lit';
108
108
  import { customElement } from 'lit/decorators.js';
109
- import { UmbElementMixin } from '@umbraco-cms/backoffice/element';
109
+ import { UmbElementMixin } from '@umbraco-cms/backoffice/element-api';
110
110
  import { UmbNotificationContext, UMB_NOTIFICATION_CONTEXT_TOKEN } from '@umbraco-cms/backoffice/notification';
111
111
 
112
112
  @customElement('my-element')
113
113
  export default class MyElement extends UmbElementMixin(LitElement) {
114
- #notificationContext?: UmbNotificationContext;
114
+ private _notificationContext?: UmbNotificationContext;
115
115
 
116
116
  constructor() {
117
117
  super();
118
118
  this.consumeContext(UMB_NOTIFICATION_CONTEXT_TOKEN, (_instance) => {
119
- this.#notificationContext = _instance;
119
+ this._notificationContext = _instance;
120
120
  });
121
121
  }
122
122
 
123
123
  onClick() {
124
- this.#notificationContext?.peek('positive', { data: { message: '#h5yr' } });
124
+ this._notificationContext?.peek('positive', { data: { message: '#h5yr' } });
125
125
  }
126
126
 
127
127
  render() {
128
128
  return html`
129
129
  <uui-box headline="Welcome">
130
- <p>TS dashboard</p>
130
+ <p>A TypeScript Lit Dashboard</p>
131
131
  <uui-button look="primary" label="Click me" @click=${() => this.onClick()}></uui-button>
132
132
  </uui-box>
133
133
  `;
@@ -141,7 +141,7 @@ declare global {
141
141
  }
142
142
  ```
143
143
 
144
- Finally add an umbraco-package.json file in the root of your package.
144
+ Finally add an umbraco-package.json file in the root of your package folder `my-package`.
145
145
 
146
146
  ```json
147
147
  {