Skip to content

Commit adb4f3b

Browse files
feat: add demandCustomElement for all elements that require other uui-elements to render correctly (#172)
1 parent e966be5 commit adb4f3b

File tree

30 files changed

+160
-56
lines changed

30 files changed

+160
-56
lines changed

package-lock.json

Lines changed: 40 additions & 24 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

packages/uui-avatar-group/package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,8 @@
3030
"custom-elements.json"
3131
],
3232
"dependencies": {
33-
"@umbraco-ui/uui-base": "0.0.17"
33+
"@umbraco-ui/uui-base": "0.0.17",
34+
"@umbraco-ui/uui-avatar": "0.0.19"
3435
},
3536
"scripts": {
3637
"build": "npm run analyze && tsc --build --force && rollup -c rollup.config.js",

packages/uui-avatar-group/tsconfig.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,9 @@
1212
"references": [
1313
{
1414
"path": "../uui-base"
15+
},
16+
{
17+
"path": "../uui-avatar"
1518
}
1619
]
1720
}

packages/uui-button-group/package.json

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,8 +31,7 @@
3131
"custom-elements.json"
3232
],
3333
"dependencies": {
34-
"@umbraco-ui/uui-base": "0.0.17",
35-
"@umbraco-ui/uui-icon-registry-essential": "0.0.3"
34+
"@umbraco-ui/uui-base": "0.0.17"
3635
},
3736
"scripts": {
3837
"build": "npm run analyze && tsc --build --force && rollup -c rollup.config.js",

packages/uui-button-group/tsconfig.json

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,6 @@
1212
"references": [
1313
{
1414
"path": "../uui-base"
15-
},
16-
{
17-
"path": "../uui-icon-registry-essential"
1815
}
1916
]
2017
}

packages/uui-button/lib/uui-button.element.ts

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,8 @@
1-
import '@umbraco-ui/uui-icon/lib';
2-
31
import {
42
UUIHorizontalShakeAnimationValue,
53
UUIHorizontalShakeKeyframes,
64
} from '@umbraco-ui/uui-base/lib/animations';
5+
import { demandCustomElement } from '@umbraco-ui/uui-base/lib/utils';
76
import { LabelMixin } from '@umbraco-ui/uui-base/lib/mixins';
87
import { defineElement } from '@umbraco-ui/uui-base/lib/registration';
98
import {
@@ -609,19 +608,17 @@ export class UUIButtonElement extends LabelMixin('', LitElement) {
609608
let element = html``;
610609
switch (this.state) {
611610
case 'waiting':
612-
if (!customElements.get('uui-loader-circle')) {
613-
console.warn(
614-
'To properly render the waiting state, the uui-loader-circle element has to be registered'
615-
);
616-
}
611+
demandCustomElement(this, 'uui-loader-circle');
617612
element = html`<uui-loader-circle id="loader"></uui-loader-circle>`;
618613
break;
619614
case 'success':
615+
demandCustomElement(this, 'uui-icon');
620616
element = html`<uui-icon
621617
name="check"
622618
.fallback=${iconCheck.strings[0]}></uui-icon>`;
623619
break;
624620
case 'failed':
621+
demandCustomElement(this, 'uui-icon');
625622
element = html`<uui-icon
626623
name="wrong"
627624
.fallback=${iconWrong.strings[0]}></uui-icon>`;

packages/uui-button/package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,8 @@
3030
"custom-elements.json"
3131
],
3232
"dependencies": {
33-
"@umbraco-ui/uui-base": "0.0.17"
33+
"@umbraco-ui/uui-base": "0.0.17",
34+
"@umbraco-ui/uui-icon-registry-essential": "0.0.3"
3435
},
3536
"scripts": {
3637
"build": "npm run analyze && tsc --build --force && rollup -c rollup.config.js",

packages/uui-button/tsconfig.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,9 @@
1212
"references": [
1313
{
1414
"path": "../uui-base"
15+
},
16+
{
17+
"path": "../uui-icon-registry-essential"
1518
}
1619
]
1720
}

packages/uui-card-content-node/lib/uui-card-content-node.element.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import { defineElement } from '@umbraco-ui/uui-base/lib/registration';
2+
import { demandCustomElement } from '@umbraco-ui/uui-base/lib/utils';
23
import { UUICardElement } from '@umbraco-ui/uui-card/lib';
34
import { css, html, nothing } from 'lit';
45
import { property, state } from 'lit/decorators.js';
@@ -108,6 +109,7 @@ export class UUICardContentNodeElement extends UUICardElement {
108109
}
109110

110111
private _renderFallbackIcon() {
112+
demandCustomElement(this, 'uui-icon');
111113
return html`<uui-icon .svg="${this.fallbackIcon}"></uui-icon>`;
112114
}
113115

packages/uui-card-media/lib/uui-card-media.element.ts

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import { defineElement } from '@umbraco-ui/uui-base/lib/registration';
2+
import { demandCustomElement } from '@umbraco-ui/uui-base/lib/utils';
23
import { UUICardElement } from '@umbraco-ui/uui-card/lib';
34
import { css, html, nothing } from 'lit';
45
import { property, state } from 'lit/decorators.js';
@@ -125,6 +126,13 @@ export class UUICardMediaElement extends UUICardElement {
125126
@state()
126127
protected hasPreview = false;
127128

129+
connectedCallback(): void {
130+
super.connectedCallback();
131+
132+
demandCustomElement(this, 'uui-symbol-folder');
133+
demandCustomElement(this, 'uui-symbol-file');
134+
}
135+
128136
private queryPreviews(e: any): void {
129137
this.hasPreview =
130138
(e.path[0] as HTMLSlotElement).assignedElements({ flatten: true })

0 commit comments

Comments
 (0)