@brightspace-ui/core 2.46.0 → 2.47.0
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/alert/alert.js +0 -11
- package/components/empty-state/empty-state-styles.js +3 -2
- package/components/html-block/html-block.js +16 -11
- package/controllers/attributeObserver/htmlAttributeObserverController.js +1 -1
- package/helpers/mathjax.js +5 -1
- package/helpers/prism.js +5 -1
- package/package.json +1 -1
|
@@ -196,23 +196,12 @@ class Alert extends LocalizeCoreElement(RtlMixin(LitElement)) {
|
|
|
196
196
|
}
|
|
197
197
|
|
|
198
198
|
close() {
|
|
199
|
-
// deprecated - event names should be present tense
|
|
200
|
-
/** @ignore */
|
|
201
|
-
const didDispatch = this.dispatchEvent(new CustomEvent('d2l-alert-closed', { bubbles: true, composed: true, cancelable: true }));
|
|
202
|
-
if (didDispatch) {
|
|
203
|
-
this.hidden = true;
|
|
204
|
-
}
|
|
205
199
|
if (this.dispatchEvent(new CustomEvent('d2l-alert-close', { bubbles: true, composed: true, cancelable: true }))) {
|
|
206
200
|
this.hidden = true;
|
|
207
201
|
}
|
|
208
202
|
}
|
|
209
203
|
|
|
210
204
|
_onButtonClick() {
|
|
211
|
-
// deprecated - event names should be present tense
|
|
212
|
-
/** @ignore */
|
|
213
|
-
this.dispatchEvent(new CustomEvent(
|
|
214
|
-
'd2l-alert-button-pressed', { bubbles: true, composed: true }
|
|
215
|
-
));
|
|
216
205
|
this.dispatchEvent(new CustomEvent(
|
|
217
206
|
'd2l-alert-button-press', { bubbles: true, composed: true }
|
|
218
207
|
));
|
|
@@ -15,8 +15,8 @@ export const emptyStateStyles = css`
|
|
|
15
15
|
display: none;
|
|
16
16
|
}
|
|
17
17
|
|
|
18
|
-
.action-slot::slotted(d2l-empty-state-action-button:first-
|
|
19
|
-
.action-slot::slotted(d2l-empty-state-action-link:first-
|
|
18
|
+
.action-slot::slotted(d2l-empty-state-action-button:first-of-type),
|
|
19
|
+
.action-slot::slotted(d2l-empty-state-action-link:first-of-type) {
|
|
20
20
|
display: inline;
|
|
21
21
|
}
|
|
22
22
|
|
|
@@ -52,6 +52,7 @@ export const emptyStateIllustratedStyles = css`
|
|
|
52
52
|
display: none;
|
|
53
53
|
}
|
|
54
54
|
|
|
55
|
+
.illustration-slot::slotted(img:first-of-type),
|
|
55
56
|
.illustration-slot::slotted(svg:first-of-type) {
|
|
56
57
|
display: inline-block;
|
|
57
58
|
}
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import '../colors/colors.js';
|
|
2
|
-
import { codeStyles,
|
|
2
|
+
import { codeStyles, createHtmlBlockRenderer as createCodeRenderer } from '../../helpers/prism.js';
|
|
3
3
|
import { css, html, LitElement } from 'lit';
|
|
4
4
|
import { classMap } from 'lit/directives/class-map.js';
|
|
5
|
+
import { createHtmlBlockRenderer as createMathRenderer } from '../../helpers/mathjax.js';
|
|
5
6
|
import { HtmlAttributeObserverController } from '../../controllers/attributeObserver/htmlAttributeObserverController.js';
|
|
6
|
-
import { HtmlBlockMathRenderer } from '../../helpers/mathjax.js';
|
|
7
7
|
import { requestInstance } from '../../mixins/provider-mixin.js';
|
|
8
8
|
import { RtlMixin } from '../../mixins/rtl-mixin.js';
|
|
9
9
|
|
|
@@ -118,10 +118,11 @@ export const htmlBlockContentStyles = css`
|
|
|
118
118
|
|
|
119
119
|
let renderers;
|
|
120
120
|
|
|
121
|
-
const getRenderers = () => {
|
|
121
|
+
const getRenderers = async() => {
|
|
122
122
|
if (renderers) return renderers;
|
|
123
|
-
const
|
|
124
|
-
const
|
|
123
|
+
const rendererLoader = requestInstance(document, 'html-block-renderer-loader');
|
|
124
|
+
const tempRenderers = rendererLoader ? await rendererLoader.getRenderers() : undefined;
|
|
125
|
+
const defaultRenderers = [ createMathRenderer(), createCodeRenderer() ];
|
|
125
126
|
renderers = (tempRenderers ? [ ...defaultRenderers, ...tempRenderers ] : defaultRenderers);
|
|
126
127
|
return renderers;
|
|
127
128
|
};
|
|
@@ -193,13 +194,12 @@ class HtmlBlock extends RtlMixin(LitElement) {
|
|
|
193
194
|
this.noDeferredRendering = false;
|
|
194
195
|
this._hasSlottedContent = false;
|
|
195
196
|
|
|
196
|
-
|
|
197
|
+
getRenderers().then(renderers => renderers.reduce((attrs, currentRenderer) => {
|
|
197
198
|
if (currentRenderer.contextAttributes) currentRenderer.contextAttributes.forEach(attr => attrs.push(attr));
|
|
198
199
|
return attrs;
|
|
199
|
-
}, [])
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
this._contextObserverController = new HtmlAttributeObserverController(this, ...rendererContextAttributes);
|
|
200
|
+
}, [])).then(rendererContextAttributes => {
|
|
201
|
+
this._contextObserverController = new HtmlAttributeObserverController(this, ...rendererContextAttributes);
|
|
202
|
+
});
|
|
203
203
|
}
|
|
204
204
|
|
|
205
205
|
connectedCallback() {
|
|
@@ -257,6 +257,10 @@ class HtmlBlock extends RtlMixin(LitElement) {
|
|
|
257
257
|
|
|
258
258
|
_contextChanged() {
|
|
259
259
|
if (!this._contextObserverController) return false;
|
|
260
|
+
if (!this._contextKeys) {
|
|
261
|
+
this._updateContextKeys();
|
|
262
|
+
return true;
|
|
263
|
+
}
|
|
260
264
|
|
|
261
265
|
if (this._contextKeys.size !== this._contextObserverController.values.size) return true;
|
|
262
266
|
for (const [attr, val] of this._contextKeys) {
|
|
@@ -286,7 +290,8 @@ class HtmlBlock extends RtlMixin(LitElement) {
|
|
|
286
290
|
}
|
|
287
291
|
|
|
288
292
|
async _processRenderers(elem) {
|
|
289
|
-
|
|
293
|
+
const renderers = await getRenderers();
|
|
294
|
+
for (const renderer of renderers) {
|
|
290
295
|
if (this._contextObserverController && renderer.contextAttributes) {
|
|
291
296
|
const contextValues = new Map();
|
|
292
297
|
renderer.contextAttributes.forEach(attr => contextValues.set(attr, this._contextObserverController.values.get(attr)));
|
package/helpers/mathjax.js
CHANGED
|
@@ -33,7 +33,7 @@ const mathjaxFontMappings = new Map([
|
|
|
33
33
|
let mathJaxLoaded;
|
|
34
34
|
let renderingPromise = Promise.resolve();
|
|
35
35
|
|
|
36
|
-
|
|
36
|
+
class HtmlBlockMathRenderer {
|
|
37
37
|
|
|
38
38
|
get contextAttributes() {
|
|
39
39
|
return [mathjaxContextAttribute];
|
|
@@ -77,6 +77,10 @@ export class HtmlBlockMathRenderer {
|
|
|
77
77
|
|
|
78
78
|
}
|
|
79
79
|
|
|
80
|
+
export function createHtmlBlockRenderer() {
|
|
81
|
+
return new HtmlBlockMathRenderer();
|
|
82
|
+
}
|
|
83
|
+
|
|
80
84
|
export function loadMathJax(mathJaxConfig) {
|
|
81
85
|
|
|
82
86
|
if (mathJaxLoaded) return mathJaxLoaded;
|
package/helpers/prism.js
CHANGED
|
@@ -452,7 +452,7 @@ export async function formatCodeElement(elem) {
|
|
|
452
452
|
Prism.highlightElement(code);
|
|
453
453
|
}
|
|
454
454
|
|
|
455
|
-
|
|
455
|
+
class HtmlBlockCodeRenderer {
|
|
456
456
|
|
|
457
457
|
get canRenderInline() {
|
|
458
458
|
return true;
|
|
@@ -471,3 +471,7 @@ export class HtmlBlockCodeRenderer {
|
|
|
471
471
|
}
|
|
472
472
|
|
|
473
473
|
}
|
|
474
|
+
|
|
475
|
+
export function createHtmlBlockRenderer() {
|
|
476
|
+
return new HtmlBlockCodeRenderer();
|
|
477
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@brightspace-ui/core",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.47.0",
|
|
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",
|