@brightspace-ui/core 3.79.6 → 3.79.7
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/components/dialog/demo/dialog-async-content.js +13 -4
- package/components/dialog/dialog-mixin.js +13 -1
- package/custom-elements.json +8 -0
- package/helpers/README.md +2 -1
- package/helpers/dom.js +4 -2
- package/helpers/internal/waitForElem.js +25 -0
- package/mixins/localize/README.md +1 -0
- package/package.json +1 -1
@@ -3,8 +3,9 @@ import '../../list/list-item.js';
|
|
3
3
|
import '../../list/list-item-content.js';
|
4
4
|
import { html, LitElement } from 'lit';
|
5
5
|
import { InitialStateError, runAsync } from '../../../directives/run-async/run-async.js';
|
6
|
+
import { LoadingCompleteMixin } from '../../../mixins/loading-complete/loading-complete-mixin.js';
|
6
7
|
|
7
|
-
class DialogAsyncContent extends LitElement {
|
8
|
+
class DialogAsyncContent extends LoadingCompleteMixin(LitElement) {
|
8
9
|
|
9
10
|
static get properties() {
|
10
11
|
return {
|
@@ -32,21 +33,21 @@ class DialogAsyncContent extends LitElement {
|
|
32
33
|
resolve(html`
|
33
34
|
<d2l-list>
|
34
35
|
<d2l-list-item>
|
35
|
-
<img slot="illustration" src="https://s.brightspace.com/course-images/images/38e839b1-37fa-470c-8830-b189ce4ae134/tile-high-density-max-size.jpg"
|
36
|
+
<img slot="illustration" src="https://s.brightspace.com/course-images/images/38e839b1-37fa-470c-8830-b189ce4ae134/tile-high-density-max-size.jpg" @load="${this.#handleImageLoad}">
|
36
37
|
<d2l-list-item-content>
|
37
38
|
<div>Introductory Earth Sciences</div>
|
38
39
|
<div slot="supporting-info">This course explores the geological process of the Earth's interior and surface. These include volcanism, earthquakes, mountains...</div>
|
39
40
|
</d2l-list-item-content>
|
40
41
|
</d2l-list-item>
|
41
42
|
<d2l-list-item>
|
42
|
-
<img slot="illustration" src="https://s.brightspace.com/course-images/images/e5fd575a-bc14-4a80-89e1-46f349a76178/tile-high-density-max-size.jpg"
|
43
|
+
<img slot="illustration" src="https://s.brightspace.com/course-images/images/e5fd575a-bc14-4a80-89e1-46f349a76178/tile-high-density-max-size.jpg" @load="${this.#handleImageLoad}">
|
43
44
|
<d2l-list-item-content>
|
44
45
|
<div>Engineering Materials for Energy Systems</div>
|
45
46
|
<div slot="supporting-info">This course explores the geological processes of the Earth's interior and surface. These include volcanism, earthquakes, mountain...</div>
|
46
47
|
</d2l-list-item-content>
|
47
48
|
</d2l-list-item>
|
48
49
|
<d2l-list-item>
|
49
|
-
<img slot="illustration" src="https://s.brightspace.com/course-images/images/63b162ab-b582-4bf9-8c1d-1dad04714121/tile-high-density-max-size.jpg"
|
50
|
+
<img slot="illustration" src="https://s.brightspace.com/course-images/images/63b162ab-b582-4bf9-8c1d-1dad04714121/tile-high-density-max-size.jpg" @load="${this.#handleImageLoad}">
|
50
51
|
<d2l-list-item-content>
|
51
52
|
<div>Geomorphology and GIS </div>
|
52
53
|
<div slot="supporting-info">This course explores the geological processes of the Earth's interior and surface. These include volcanism, earthquakes, mountain...</div>
|
@@ -58,6 +59,14 @@ class DialogAsyncContent extends LitElement {
|
|
58
59
|
});
|
59
60
|
}
|
60
61
|
|
62
|
+
#handleImageLoad() {
|
63
|
+
const images = this.shadowRoot.querySelectorAll('img');
|
64
|
+
for (const image of images) {
|
65
|
+
if (!image.complete) return;
|
66
|
+
}
|
67
|
+
this.resolveLoadingComplete();
|
68
|
+
}
|
69
|
+
|
61
70
|
}
|
62
71
|
|
63
72
|
customElements.define('d2l-dialog-demo-async-content', DialogAsyncContent);
|
@@ -2,7 +2,7 @@ import '../focus-trap/focus-trap.js';
|
|
2
2
|
import '../../helpers/viewport-size.js';
|
3
3
|
import { allowBodyScroll, preventBodyScroll } from '../backdrop/backdrop.js';
|
4
4
|
import { clearDismissible, setDismissible } from '../../helpers/dismissible.js';
|
5
|
-
import { findComposedAncestor, isComposedAncestor } from '../../helpers/dom.js';
|
5
|
+
import { findComposedAncestor, getComposedChildren, isComposedAncestor } from '../../helpers/dom.js';
|
6
6
|
import { getComposedActiveElement, getFirstFocusableDescendant, getNextFocusable, isFocusable } from '../../helpers/focus.js';
|
7
7
|
import { classMap } from 'lit/directives/class-map.js';
|
8
8
|
import { getUniqueId } from '../../helpers/uniqueId.js';
|
@@ -11,6 +11,7 @@ import { ifDefined } from 'lit/directives/if-defined.js';
|
|
11
11
|
import { RtlMixin } from '../../mixins/rtl/rtl-mixin.js';
|
12
12
|
import { styleMap } from 'lit/directives/style-map.js';
|
13
13
|
import { tryGetIfrauBackdropService } from '../../helpers/ifrauBackdropService.js';
|
14
|
+
import { waitForElem } from '../../helpers/internal/waitForElem.js';
|
14
15
|
|
15
16
|
window.D2L = window.D2L || {};
|
16
17
|
window.D2L.DialogMixin = window.D2L.DialogMixin || {};
|
@@ -452,6 +453,11 @@ export const DialogMixin = superclass => class extends RtlMixin(superclass) {
|
|
452
453
|
if (reduceMotion) await new Promise(resolve => requestAnimationFrame(resolve));
|
453
454
|
else await animPromise;
|
454
455
|
|
456
|
+
const flag = window.D2L?.LP?.Web?.UI?.Flags.Flag('GAUD-7397-dialog-resize-updateComplete', true) ?? true;
|
457
|
+
if (flag) {
|
458
|
+
await this.#waitForUpdateComplete();
|
459
|
+
}
|
460
|
+
await this._updateSize();
|
455
461
|
/** Dispatched when the dialog is opened */
|
456
462
|
this.dispatchEvent(new CustomEvent(
|
457
463
|
'd2l-dialog-open', { bubbles: true, composed: true }
|
@@ -580,4 +586,10 @@ export const DialogMixin = superclass => class extends RtlMixin(superclass) {
|
|
580
586
|
});
|
581
587
|
});
|
582
588
|
}
|
589
|
+
|
590
|
+
async #waitForUpdateComplete() {
|
591
|
+
const predicate = () => true;
|
592
|
+
const composedChildren = getComposedChildren(this, predicate);
|
593
|
+
await Promise.all(composedChildren.map(child => waitForElem(child, predicate)));
|
594
|
+
}
|
583
595
|
};
|
package/custom-elements.json
CHANGED
@@ -1996,6 +1996,14 @@
|
|
1996
1996
|
"name": "href",
|
1997
1997
|
"attribute": "href",
|
1998
1998
|
"type": "string"
|
1999
|
+
},
|
2000
|
+
{
|
2001
|
+
"name": "loadingComplete",
|
2002
|
+
"type": "Promise<any>"
|
2003
|
+
},
|
2004
|
+
{
|
2005
|
+
"name": "resolveLoadingComplete",
|
2006
|
+
"type": "() => void"
|
1999
2007
|
}
|
2000
2008
|
]
|
2001
2009
|
},
|
package/helpers/README.md
CHANGED
@@ -86,7 +86,8 @@ elemIdListRemoves(node, attrName, value);
|
|
86
86
|
findComposedAncestor(node, predicate);
|
87
87
|
|
88
88
|
// gets the composed children (including shadow children & distributed children)
|
89
|
-
|
89
|
+
// includes a predicate which will add children nodes when predicate(node) is true
|
90
|
+
getComposedChildren(element, predicate = () => true);
|
90
91
|
|
91
92
|
// gets the composed parent (including shadow host & insertion points)
|
92
93
|
getComposedParent(node);
|
package/helpers/dom.js
CHANGED
@@ -79,7 +79,7 @@ export function getBoundingAncestor(node) {
|
|
79
79
|
});
|
80
80
|
}
|
81
81
|
|
82
|
-
export function getComposedChildren(node) {
|
82
|
+
export function getComposedChildren(node, predicate = () => true) {
|
83
83
|
|
84
84
|
if (!node) {
|
85
85
|
return null;
|
@@ -104,7 +104,9 @@ export function getComposedChildren(node) {
|
|
104
104
|
|
105
105
|
for (let i = 0; i < nodes.length; i++) {
|
106
106
|
if (nodes[i].nodeType === 1) {
|
107
|
-
|
107
|
+
if (predicate(nodes[i])) {
|
108
|
+
children.push(nodes[i]);
|
109
|
+
}
|
108
110
|
}
|
109
111
|
}
|
110
112
|
|
@@ -0,0 +1,25 @@
|
|
1
|
+
import { getComposedChildren } from '../dom.js';
|
2
|
+
|
3
|
+
export async function waitForElem(elem, predicate = () => true) {
|
4
|
+
|
5
|
+
if (!elem) return;
|
6
|
+
|
7
|
+
const update = elem.updateComplete;
|
8
|
+
if (typeof update === 'object' && Promise.resolve(update) === update) {
|
9
|
+
await update;
|
10
|
+
await new Promise(resolve => {
|
11
|
+
requestAnimationFrame(() => resolve());
|
12
|
+
});
|
13
|
+
}
|
14
|
+
|
15
|
+
if (typeof elem.getLoadingComplete === 'function') {
|
16
|
+
await elem.getLoadingComplete();
|
17
|
+
await new Promise(resolve => {
|
18
|
+
requestAnimationFrame(() => resolve());
|
19
|
+
});
|
20
|
+
}
|
21
|
+
|
22
|
+
const children = getComposedChildren(elem, predicate);
|
23
|
+
await Promise.all(children.map(e => waitForElem(e, predicate)));
|
24
|
+
|
25
|
+
}
|
@@ -196,6 +196,7 @@ static get localizeConfig() {
|
|
196
196
|
};
|
197
197
|
}
|
198
198
|
```
|
199
|
+
See [Creating a new collection](https://desire2learn.atlassian.net/wiki/spaces/DEVCENTRAL/pages/3105063520/OSLO#Creating-a-new-collection) to determine your collection name. Backslash (`\`) characters in your collection name must be escaped.
|
199
200
|
|
200
201
|
> **Important:** When defining language resource keys, avoid using the Full Stop (`.`) character for grouping. OSLO does not support it.
|
201
202
|
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@brightspace-ui/core",
|
3
|
-
"version": "3.79.
|
3
|
+
"version": "3.79.7",
|
4
4
|
"description": "A collection of accessible, free, open-source web components for building Brightspace applications",
|
5
5
|
"type": "module",
|
6
6
|
"repository": "https://github.com/BrightspaceUI/core.git",
|