@brightspace-ui/core 3.34.0 → 3.35.1
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.
@@ -36,7 +36,13 @@ class ButtonIcon extends PropertyRequiredMixin(ThemeMixin(ButtonMixin(VisibleOnA
|
|
36
36
|
* REQUIRED: Preset icon key (e.g. "tier1:gear")
|
37
37
|
* @type {string}
|
38
38
|
*/
|
39
|
-
icon: {
|
39
|
+
icon: {
|
40
|
+
type: String,
|
41
|
+
reflect: true,
|
42
|
+
required: {
|
43
|
+
validator: (_value, elem, hasValue) => hasValue || elem._hasCustomIcon
|
44
|
+
}
|
45
|
+
},
|
40
46
|
|
41
47
|
/**
|
42
48
|
* ACCESSIBILITY: REQUIRED: Accessible text for the button
|
@@ -162,6 +168,8 @@ class ButtonIcon extends PropertyRequiredMixin(ThemeMixin(ButtonMixin(VisibleOnA
|
|
162
168
|
this._buttonId = getUniqueId();
|
163
169
|
/** @internal */
|
164
170
|
this._describedById = getUniqueId();
|
171
|
+
/** @internal */
|
172
|
+
this._hasCustomIcon = false;
|
165
173
|
}
|
166
174
|
|
167
175
|
render() {
|
@@ -185,13 +193,19 @@ class ButtonIcon extends PropertyRequiredMixin(ThemeMixin(ButtonMixin(VisibleOnA
|
|
185
193
|
name="${ifDefined(this.name)}"
|
186
194
|
title="${ifDefined(this.text)}"
|
187
195
|
type="${this._getType()}">
|
188
|
-
<slot name="icon">${icon}</slot>
|
196
|
+
<slot name="icon" @slotchange="${this._handleSlotChange}">${icon}</slot>
|
189
197
|
</button>
|
190
198
|
${this.description ? html`<span id="${this._describedById}" hidden>${this.description}</span>` : null}
|
191
199
|
${this.disabled && this.disabledTooltip ? html`<d2l-tooltip for="${this._buttonId}">${this.disabledTooltip}</d2l-tooltip>` : ''}
|
192
200
|
`;
|
193
201
|
}
|
194
202
|
|
203
|
+
_handleSlotChange(e) {
|
204
|
+
this._hasCustomIcon = e.target.assignedNodes().find(
|
205
|
+
node => node.nodeType === 1 && node.tagName.toLowerCase() === 'd2l-icon-custom'
|
206
|
+
) !== undefined;
|
207
|
+
}
|
208
|
+
|
195
209
|
}
|
196
210
|
|
197
211
|
customElements.define('d2l-button-icon', ButtonIcon);
|
@@ -216,7 +216,10 @@ class HtmlBlock extends LitElement {
|
|
216
216
|
|
217
217
|
const contextValsPromise = contextKeysPromise.then(contextKeys => {
|
218
218
|
return Promise.allSettled(contextKeys.map(key => {
|
219
|
-
return tryGet(key, undefined, ctx =>
|
219
|
+
return tryGet(key, undefined, ctx => {
|
220
|
+
this._context.set(key, ctx);
|
221
|
+
this.updated(new Map([['_context']]));
|
222
|
+
});
|
220
223
|
}));
|
221
224
|
});
|
222
225
|
|
@@ -234,24 +237,17 @@ class HtmlBlock extends LitElement {
|
|
234
237
|
'd2l-html-block-compact': this.compact
|
235
238
|
};
|
236
239
|
|
237
|
-
|
238
|
-
|
239
|
-
|
240
|
-
|
241
|
-
|
242
|
-
|
243
|
-
`;
|
244
|
-
} else {
|
245
|
-
return html`
|
246
|
-
<div class="${classMap(renderContainerClasses)}"></div>
|
247
|
-
${this.noDeferredRendering ? html`<slot @slotchange="${this._handleSlotChange}"></slot>` : ''}
|
248
|
-
`;
|
249
|
-
}
|
240
|
+
return html`
|
241
|
+
<div class="${classMap(renderContainerClasses)}">
|
242
|
+
${!this.noDeferredRendering ? until(this._processEmbeds(), nothing) : nothing}
|
243
|
+
</div>
|
244
|
+
${this.noDeferredRendering ? html`<slot @slotchange="${this._handleSlotChange}"></slot>` : ''}
|
245
|
+
`;
|
250
246
|
}
|
251
247
|
|
252
248
|
async updated(changedProperties) {
|
253
249
|
super.updated(changedProperties);
|
254
|
-
if ((changedProperties.has('
|
250
|
+
if ((changedProperties.has('embeds') || changedProperties.has('_context')) && this.html !== undefined && this.html !== null && !this.noDeferredRendering) {
|
255
251
|
await this._updateRenderContainer();
|
256
252
|
}
|
257
253
|
}
|
@@ -260,10 +256,6 @@ class HtmlBlock extends LitElement {
|
|
260
256
|
return this._renderersProcessedPromise;
|
261
257
|
}
|
262
258
|
|
263
|
-
_embedsFeatureEnabled() {
|
264
|
-
return window.D2L?.LP?.Web?.UI?.Flags.Flag('shield-7574-enable-embed-rendering-framework', true);
|
265
|
-
}
|
266
|
-
|
267
259
|
async _handleSlotChange(e) {
|
268
260
|
if (!e.target || !this.shadowRoot || !this.noDeferredRendering) return;
|
269
261
|
await this._renderInline(e.target);
|
@@ -272,6 +264,7 @@ class HtmlBlock extends LitElement {
|
|
272
264
|
async _processEmbeds() {
|
273
265
|
const htmlFragment = document.createRange().createContextualFragment(this.html);
|
274
266
|
await renderEmbeds(htmlFragment);
|
267
|
+
this.updated(new Map([['embeds']]));
|
275
268
|
return htmlFragment;
|
276
269
|
}
|
277
270
|
|
@@ -315,7 +308,6 @@ class HtmlBlock extends LitElement {
|
|
315
308
|
|
316
309
|
async _updateRenderContainer() {
|
317
310
|
const renderContainer = this.shadowRoot.querySelector('.d2l-html-block-rendered');
|
318
|
-
if (!this._embedsFeatureEnabled()) renderContainer.innerHTML = this.html;
|
319
311
|
await this._processRenderers(renderContainer);
|
320
312
|
}
|
321
313
|
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@brightspace-ui/core",
|
3
|
-
"version": "3.
|
3
|
+
"version": "3.35.1",
|
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",
|