@brightspace-ui/core 2.18.2 → 2.18.5

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.
@@ -383,6 +383,7 @@
383
383
  <mo>)</mo>
384
384
  </mrow>
385
385
  </math>
386
+ $$ {\color{red}x} + {\color{blue}y} = {\color{green}z} $$
386
387
  <p>The wizard (<span data-replace-me-id="0">Elmer Fudd</span>) quickly jinxed the gnomes before they vaporized.</p>
387
388
  </div>
388
389
  </d2l-html-block>
@@ -495,6 +496,7 @@
495
496
  <template>
496
497
  <d2l-html-block>
497
498
  <div>$$ f(x) = \int \mathrm{e}^{-x}\,\mathrm{d}x $$ $$ x = \frac{-b \pm \sqrt{b^2 - 4ac}}{2a} $$</div>
499
+ <div>$$ {\color{red}x} + {\color{blue}y} = {\color{green}z} $$</div>
498
500
  </d2l-html-block>
499
501
  </template>
500
502
  </d2l-demo-snippet>
@@ -507,7 +509,7 @@
507
509
  <div>
508
510
  An equation rendered using LaTeX...
509
511
  \( f(x) = \int \mathrm{e}^{-x}\,\mathrm{d}x \)
510
- ... and some text!
512
+ ... and some text ...
511
513
  </div>
512
514
  </d2l-html-block>
513
515
  </template>
@@ -8,6 +8,10 @@ import { SwitchMixin } from './switch-mixin.js';
8
8
  */
9
9
  class VisibilitySwitch extends LocalizeCoreElement(SwitchMixin(LitElement)) {
10
10
 
11
+ /**
12
+ * The text that is displayed for the switch label.
13
+ * @default "Visibility"
14
+ */
11
15
  get text() {
12
16
  return (this._text ? this._text : this.localize('components.switch.visibility'));
13
17
  }
@@ -9354,8 +9354,9 @@
9354
9354
  "attributes": [
9355
9355
  {
9356
9356
  "name": "text",
9357
- "description": "REQUIRED: The text that is displayed for the switch label.",
9358
- "type": "string"
9357
+ "description": "The text that is displayed for the switch label.",
9358
+ "type": "string",
9359
+ "default": "\"\\\"Visibility\\\"\""
9359
9360
  },
9360
9361
  {
9361
9362
  "name": "tooltip",
@@ -9393,8 +9394,9 @@
9393
9394
  {
9394
9395
  "name": "text",
9395
9396
  "attribute": "text",
9396
- "description": "REQUIRED: The text that is displayed for the switch label.",
9397
- "type": "string"
9397
+ "description": "The text that is displayed for the switch label.",
9398
+ "type": "string",
9399
+ "default": "\"\\\"Visibility\\\"\""
9398
9400
  },
9399
9401
  {
9400
9402
  "name": "tooltip",
package/helpers/README.md CHANGED
@@ -125,7 +125,7 @@ getComposedActiveElement()
125
125
  // gets the first focusable descendant given a node, including those within the shadow DOM
126
126
  getFirstFocusableDescendant(node, includeHidden, predicate)
127
127
 
128
- // gets the last fusable descendant given a node, including those within the shadow DOM
128
+ // gets the last focusable descendant given a node, including those within the shadow DOM
129
129
  getLastFocusableDescendant(node, includeHidden)
130
130
 
131
131
  // gets the previous focusable node on the page given a node
@@ -134,7 +134,7 @@ getPreviousFocusable(node, includeHidden)
134
134
  // gets the next focusable node on the page given a node
135
135
  getNextFocusable(node, includeHidden)
136
136
 
137
- // gets the ancestor of the given node that is focusable
137
+ // gets the nearest focusable ancestor of the given node
138
138
  getPreviousFocusableAncestor(node, includeHidden, includeTabbablesOnly)
139
139
 
140
140
  // returns true/false whether the element is focusable
@@ -68,12 +68,13 @@ export class HtmlBlockMathRenderer {
68
68
  elem.querySelectorAll('mspace[linebreak="newline"]').forEach(elm => {
69
69
  elm.setAttribute('style', lineBreakStyle);
70
70
  });
71
+
71
72
  await window.MathJax.startup.promise;
72
- window.MathJax.typeset([elem]);
73
+ window.MathJax.typesetShadow(elem.getRootNode(), elem);
73
74
  return elem;
74
75
  }
75
76
 
76
- const inner = elem.innerHTML.replaceAll('<mspace linebreak="newline">', `<mspace linebreak="newline" style="${lineBreakStyle}">`);
77
+ const inner = elem.innerHTML.replace(/<mspace linebreak="newline">/gi, `<mspace linebreak="newline" style="${lineBreakStyle}">`);
77
78
 
78
79
  const temp = document.createElement('div');
79
80
  temp.style.display = 'none';
@@ -93,6 +94,11 @@ export function loadMathJax(mathJaxConfig) {
93
94
 
94
95
  if (mathJaxLoaded) return mathJaxLoaded;
95
96
 
97
+ const loadOptions = ['ui/menu'];
98
+ if (mathJaxConfig && mathJaxConfig.renderLatex) {
99
+ loadOptions.push('[tex]/all-packages');
100
+ }
101
+
96
102
  window.MathJax = {
97
103
  chtml: {
98
104
  scale: (mathJaxConfig && mathJaxConfig.outputScale) || 1
@@ -102,7 +108,7 @@ export function loadMathJax(mathJaxConfig) {
102
108
  settings: { zoom: 'None' }
103
109
  }
104
110
  },
105
- loader: { load: ['ui/menu'] },
111
+ loader: { load: loadOptions },
106
112
  startup: {
107
113
  ready: () => {
108
114
 
@@ -182,10 +188,13 @@ export function loadMathJax(mathJaxConfig) {
182
188
  // renders the document. The MathDocument is returned in case
183
189
  // you need to rerender the shadowRoot later.
184
190
  //
185
- window.MathJax.typesetShadow = function(root) {
191
+ window.MathJax.typesetShadow = function(root, elem) {
186
192
  const InputJax = startup.getInputJax();
187
193
  const OutputJax = startup.getOutputJax();
188
194
  const html = mathjax.document(root, { InputJax, OutputJax });
195
+
196
+ if (elem) html.options.elements = [elem];
197
+
189
198
  html.render().typeset();
190
199
  return html;
191
200
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@brightspace-ui/core",
3
- "version": "2.18.2",
3
+ "version": "2.18.5",
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",