@brightspace-ui/core 2.121.0 → 2.122.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/list/list.js +0 -1
- package/custom-elements.json +11 -13
- package/helpers/mathjax.js +25 -36
- package/package.json +1 -1
package/components/list/list.js
CHANGED
package/custom-elements.json
CHANGED
|
@@ -8907,6 +8907,11 @@
|
|
|
8907
8907
|
"path": "./components/list/list.js",
|
|
8908
8908
|
"description": "A container for a styled list of items (\"d2l-list-item\"). It provides the appropriate \"list\" semantics as well as options for displaying separators, etc.",
|
|
8909
8909
|
"attributes": [
|
|
8910
|
+
{
|
|
8911
|
+
"name": "label",
|
|
8912
|
+
"description": "Sets an accessible label. For use when the list context is unclear. This property is only valid on top-level lists and will have no effect on nested lists.",
|
|
8913
|
+
"type": "string"
|
|
8914
|
+
},
|
|
8910
8915
|
{
|
|
8911
8916
|
"name": "separators",
|
|
8912
8917
|
"description": "Display separators. Valid values are \"all\" (default), \"between\", \"none\"",
|
|
@@ -8931,12 +8936,6 @@
|
|
|
8931
8936
|
"type": "boolean",
|
|
8932
8937
|
"default": "false"
|
|
8933
8938
|
},
|
|
8934
|
-
{
|
|
8935
|
-
"name": "label",
|
|
8936
|
-
"description": "Sets an accessible label. For use when the list context is unclear. This property is only valid on top-level lists and will have no effect on nested lists.",
|
|
8937
|
-
"type": "string",
|
|
8938
|
-
"default": "\"undefined\""
|
|
8939
|
-
},
|
|
8940
8939
|
{
|
|
8941
8940
|
"name": "item-count",
|
|
8942
8941
|
"description": "Total number of items. If not specified, features like select-all-pages will be disabled.",
|
|
@@ -8955,6 +8954,12 @@
|
|
|
8955
8954
|
}
|
|
8956
8955
|
],
|
|
8957
8956
|
"properties": [
|
|
8957
|
+
{
|
|
8958
|
+
"name": "label",
|
|
8959
|
+
"attribute": "label",
|
|
8960
|
+
"description": "Sets an accessible label. For use when the list context is unclear. This property is only valid on top-level lists and will have no effect on nested lists.",
|
|
8961
|
+
"type": "string"
|
|
8962
|
+
},
|
|
8958
8963
|
{
|
|
8959
8964
|
"name": "separators",
|
|
8960
8965
|
"attribute": "separators",
|
|
@@ -8983,13 +8988,6 @@
|
|
|
8983
8988
|
"type": "boolean",
|
|
8984
8989
|
"default": "false"
|
|
8985
8990
|
},
|
|
8986
|
-
{
|
|
8987
|
-
"name": "label",
|
|
8988
|
-
"attribute": "label",
|
|
8989
|
-
"description": "Sets an accessible label. For use when the list context is unclear. This property is only valid on top-level lists and will have no effect on nested lists.",
|
|
8990
|
-
"type": "string",
|
|
8991
|
-
"default": "\"undefined\""
|
|
8992
|
-
},
|
|
8993
8991
|
{
|
|
8994
8992
|
"name": "itemCount",
|
|
8995
8993
|
"attribute": "item-count",
|
package/helpers/mathjax.js
CHANGED
|
@@ -43,12 +43,36 @@ class HtmlBlockMathRenderer {
|
|
|
43
43
|
|
|
44
44
|
const context = JSON.parse(contextVal) || {};
|
|
45
45
|
|
|
46
|
-
|
|
46
|
+
if (!elem.querySelector('math') && !(context.renderLatex && /\$\$|\\\(|\\\[|\\begin{|\\ref{|\\eqref{/.test(elem.innerHTML))) return elem;
|
|
47
|
+
|
|
48
|
+
const mathJaxConfig = {
|
|
47
49
|
deferTypeset: true,
|
|
48
50
|
renderLatex: context.renderLatex,
|
|
49
51
|
outputScale: context.outputScale || 1,
|
|
50
52
|
window: window
|
|
53
|
+
};
|
|
54
|
+
|
|
55
|
+
await loadMathJax(mathJaxConfig);
|
|
56
|
+
|
|
57
|
+
// MathJax 3 does not support newlines, but it does persist styles, so add custom styles to mimic a linebreak
|
|
58
|
+
// This work-around should be removed when linebreaks are natively supported.
|
|
59
|
+
// MathJax issue: https://github.com/mathjax/MathJax/issues/2312
|
|
60
|
+
// A duplicate that explains our exact issue: https://github.com/mathjax/MathJax/issues/2495
|
|
61
|
+
elem.querySelectorAll('mspace[linebreak="newline"]').forEach(elm => {
|
|
62
|
+
elm.style.display = 'block';
|
|
63
|
+
elm.style.height = '0.5rem';
|
|
51
64
|
});
|
|
65
|
+
|
|
66
|
+
// If we're using deferred rendering, we need to create a document structure
|
|
67
|
+
// within the element so MathJax can appropriately process math.
|
|
68
|
+
if (!options.noDeferredRendering) elem.innerHTML = `<mjx-doc><mjx-head></mjx-head><mjx-body>${elem.innerHTML}</mjx-body></mjx-doc>`;
|
|
69
|
+
|
|
70
|
+
await window.MathJax.startup.promise;
|
|
71
|
+
window.D2L = window.D2L || {};
|
|
72
|
+
|
|
73
|
+
if (!window.D2L.renderingPromise) window.D2L.renderingPromise = Promise.resolve();
|
|
74
|
+
window.D2L.renderingPromise = window.D2L.renderingPromise.then(() => window.MathJax.typesetShadow(elem.getRootNode(), elem));
|
|
75
|
+
await window.D2L.renderingPromise;
|
|
52
76
|
}
|
|
53
77
|
|
|
54
78
|
}
|
|
@@ -214,38 +238,3 @@ export function loadMathJax(mathJaxConfig) {
|
|
|
214
238
|
return win.D2L.mathJaxLoaded;
|
|
215
239
|
|
|
216
240
|
}
|
|
217
|
-
|
|
218
|
-
export async function typesetMath(elem, options) {
|
|
219
|
-
if (!elem.querySelector('math') && !(options.renderLatex && /\$\$|\\\(|\\\[|\\begin{|\\ref{|\\eqref{/.test(elem.innerHTML))) return elem;
|
|
220
|
-
|
|
221
|
-
const win = options.window;
|
|
222
|
-
|
|
223
|
-
const mathJaxConfig = {
|
|
224
|
-
deferTypeset: options.deferTypeset,
|
|
225
|
-
renderLatex: options.renderLatex,
|
|
226
|
-
outputScale: options.outputScale || 1,
|
|
227
|
-
window: win
|
|
228
|
-
};
|
|
229
|
-
|
|
230
|
-
await loadMathJax(mathJaxConfig);
|
|
231
|
-
|
|
232
|
-
// MathJax 3 does not support newlines, but it does persist styles, so add custom styles to mimic a linebreak
|
|
233
|
-
// This work-around should be removed when linebreaks are natively supported.
|
|
234
|
-
// MathJax issue: https://github.com/mathjax/MathJax/issues/2312
|
|
235
|
-
// A duplicate that explains our exact issue: https://github.com/mathjax/MathJax/issues/2495
|
|
236
|
-
elem.querySelectorAll('mspace[linebreak="newline"]').forEach(elm => {
|
|
237
|
-
elm.style.display = 'block';
|
|
238
|
-
elm.style.height = '0.5rem';
|
|
239
|
-
});
|
|
240
|
-
|
|
241
|
-
// If we're using deferred rendering, we need to create a document structure
|
|
242
|
-
// within the element so MathJax can appropriately process math.
|
|
243
|
-
if (!options.noDeferredRendering) elem.innerHTML = `<mjx-doc><mjx-head></mjx-head><mjx-body>${elem.innerHTML}</mjx-body></mjx-doc>`;
|
|
244
|
-
|
|
245
|
-
await win.MathJax.startup.promise;
|
|
246
|
-
win.D2L = win.D2L || {};
|
|
247
|
-
|
|
248
|
-
if (!win.D2L.renderingPromise) win.D2L.renderingPromise = Promise.resolve();
|
|
249
|
-
win.D2L.renderingPromise = win.D2L.renderingPromise.then(() => win.MathJax.typesetShadow(elem.getRootNode(), elem));
|
|
250
|
-
await win.D2L.renderingPromise;
|
|
251
|
-
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@brightspace-ui/core",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.122.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",
|