@brightspace-ui/core 3.32.0 → 3.33.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -318,3 +318,65 @@ export const blockquoteStyles = css`
318
318
  }
319
319
  }
320
320
  `;
321
+
322
+ const importUrl = 'https://s.brightspace.com/lib/fonts/0.6.1/assets/';
323
+ const fonts = {
324
+ LatoRegular: 'Lato-400',
325
+ LatoBold: 'Lato-700',
326
+ BCSansLight: 'BCSans-Light',
327
+ BCSansRegular: 'BCSans-Regular',
328
+ BCSansBold: 'BCSans-Bold',
329
+ BCSansLightItalic: 'BCSans-LightItalic',
330
+ BCSansItalic: 'BCSans-Italic',
331
+ BCSansBoldItalic: 'BCSans-BoldItalic'
332
+ };
333
+ export const fontFacesCss = `
334
+ @font-face {
335
+ font-family: 'Lato';
336
+ font-style: normal;
337
+ font-weight: 400;
338
+ src: local('Lato Regular'), local('Lato-Regular'), url(${new URL(`${fonts.LatoRegular}.woff2`, importUrl)}) format('woff2'), url(${new URL(`${fonts.LatoRegular}.woff`, importUrl)}) format('woff'), url(${new URL(`${fonts.LatoRegular}.ttf`, importUrl)}) format('truetype');
339
+ }
340
+ @font-face {
341
+ font-family: 'Lato';
342
+ font-style: normal;
343
+ font-weight: 700;
344
+ src: local('Lato Bold'), local('Lato-Bold'), url(${new URL(`${fonts.LatoBold}.woff2`, importUrl)}) format('woff2'), url(${new URL(`${fonts.LatoBold}.woff`, importUrl)}) format('woff'), url(${new URL(`${fonts.LatoBold}.ttf`, importUrl)}) format('truetype');
345
+ }
346
+ @font-face {
347
+ font-family: 'BC Sans';
348
+ font-style: normal;
349
+ font-weight: 300;
350
+ src: url(${new URL(`${fonts.BCSansLight}.woff2`, importUrl)}) format('woff2'), url(${new URL(`${fonts.BCSansLight}.woff`, importUrl)}) format('woff');
351
+ }
352
+ @font-face {
353
+ font-family: 'BC Sans';
354
+ font-style: normal;
355
+ font-weight: 400;
356
+ src: url(${new URL(`${fonts.BCSansRegular}.woff2`, importUrl)}) format('woff2'), url(${new URL(`${fonts.BCSansRegular}.woff`, importUrl)}) format('woff');
357
+ }
358
+ @font-face {
359
+ font-family: 'BC Sans';
360
+ font-style: normal;
361
+ font-weight: 700;
362
+ src: url(${new URL(`${fonts.BCSansBold}.woff2`, importUrl)}) format('woff2'), url(${new URL(`${fonts.BCSansBold}.woff`, importUrl)}) format('woff');
363
+ }
364
+ @font-face {
365
+ font-family: 'BC Sans';
366
+ font-style: italic;
367
+ font-weight: 300;
368
+ src: url(${new URL(`${fonts.BCSansLightItalic}.woff2`, importUrl)}) format('woff2'), url(${new URL(`${fonts.BCSansLightItalic}.woff`, importUrl)}) format('woff');
369
+ }
370
+ @font-face {
371
+ font-family: 'BC Sans';
372
+ font-style: italic;
373
+ font-weight: 400;
374
+ src: url(${new URL(`${fonts.BCSansItalic}.woff2`, importUrl)}) format('woff2'), url(${new URL(`${fonts.BCSansItalic}.woff`, importUrl)}) format('woff');
375
+ }
376
+ @font-face {
377
+ font-family: 'BC Sans';
378
+ font-style: italic;
379
+ font-weight: 700;
380
+ src: url(${new URL(`${fonts.BCSansBoldItalic}.woff2`, importUrl)}) format('woff2'), url(${new URL(`${fonts.BCSansBoldItalic}.woff`, importUrl)}) format('woff');
381
+ }
382
+ `;
@@ -1,16 +1,5 @@
1
1
  import '../colors/colors.js';
2
-
3
- export const importUrl = 'https://s.brightspace.com/lib/fonts/0.6.1/assets/';
4
- export const fonts = {
5
- LatoRegular: 'Lato-400',
6
- LatoBold: 'Lato-700',
7
- BCSansLight: 'BCSans-Light',
8
- BCSansRegular: 'BCSans-Regular',
9
- BCSansBold: 'BCSans-Bold',
10
- BCSansLightItalic: 'BCSans-LightItalic',
11
- BCSansItalic: 'BCSans-Italic',
12
- BCSansBoldItalic: 'BCSans-BoldItalic'
13
- };
2
+ import { fontFacesCss } from './styles.js';
14
3
 
15
4
  if (!document.head.querySelector('#d2l-typography-font-face')) {
16
5
  const style = document.createElement('style');
@@ -24,54 +13,7 @@ if (!document.head.querySelector('#d2l-typography-font-face')) {
24
13
  --d2l-document-direction: rtl;
25
14
  }
26
15
 
27
- @font-face {
28
- font-family: 'Lato';
29
- font-style: normal;
30
- font-weight: 400;
31
- src: local('Lato Regular'), local('Lato-Regular'), url(${new URL(`${fonts.LatoRegular}.woff2`, importUrl)}) format('woff2'), url(${new URL(`${fonts.LatoRegular}.woff`, importUrl)}) format('woff'), url(${new URL(`${fonts.LatoRegular}.ttf`, importUrl)}) format('truetype');
32
- }
33
- @font-face {
34
- font-family: 'Lato';
35
- font-style: normal;
36
- font-weight: 700;
37
- src: local('Lato Bold'), local('Lato-Bold'), url(${new URL(`${fonts.LatoBold}.woff2`, importUrl)}) format('woff2'), url(${new URL(`${fonts.LatoBold}.woff`, importUrl)}) format('woff'), url(${new URL(`${fonts.LatoBold}.ttf`, importUrl)}) format('truetype');
38
- }
39
- @font-face {
40
- font-family: 'BC Sans';
41
- font-style: normal;
42
- font-weight: 300;
43
- src: url(${new URL(`${fonts.BCSansLight}.woff2`, importUrl)}) format('woff2'), url(${new URL(`${fonts.BCSansLight}.woff`, importUrl)}) format('woff');
44
- }
45
- @font-face {
46
- font-family: 'BC Sans';
47
- font-style: normal;
48
- font-weight: 400;
49
- src: url(${new URL(`${fonts.BCSansRegular}.woff2`, importUrl)}) format('woff2'), url(${new URL(`${fonts.BCSansRegular}.woff`, importUrl)}) format('woff');
50
- }
51
- @font-face {
52
- font-family: 'BC Sans';
53
- font-style: normal;
54
- font-weight: 700;
55
- src: url(${new URL(`${fonts.BCSansBold}.woff2`, importUrl)}) format('woff2'), url(${new URL(`${fonts.BCSansBold}.woff`, importUrl)}) format('woff');
56
- }
57
- @font-face {
58
- font-family: 'BC Sans';
59
- font-style: italic;
60
- font-weight: 300;
61
- src: url(${new URL(`${fonts.BCSansLightItalic}.woff2`, importUrl)}) format('woff2'), url(${new URL(`${fonts.BCSansLightItalic}.woff`, importUrl)}) format('woff');
62
- }
63
- @font-face {
64
- font-family: 'BC Sans';
65
- font-style: italic;
66
- font-weight: 400;
67
- src: url(${new URL(`${fonts.BCSansItalic}.woff2`, importUrl)}) format('woff2'), url(${new URL(`${fonts.BCSansItalic}.woff`, importUrl)}) format('woff');
68
- }
69
- @font-face {
70
- font-family: 'BC Sans';
71
- font-style: italic;
72
- font-weight: 700;
73
- src: url(${new URL(`${fonts.BCSansBoldItalic}.woff2`, importUrl)}) format('woff2'), url(${new URL(`${fonts.BCSansBoldItalic}.woff`, importUrl)}) format('woff');
74
- }
16
+ ${fontFacesCss}
75
17
 
76
18
  .d2l-typography {
77
19
  color: var(--d2l-color-ferrite);
@@ -45,7 +45,6 @@ class HtmlBlockMathRenderer {
45
45
 
46
46
  const mathJaxConfig = {
47
47
  deferTypeset: true,
48
- enableMML3Support: context.enableMML3Support,
49
48
  renderLatex: context.renderLatex,
50
49
  outputScale: context.outputScale || 1,
51
50
  window: window
@@ -62,24 +61,6 @@ class HtmlBlockMathRenderer {
62
61
  elm.style.height = '0.5rem';
63
62
  });
64
63
 
65
- if (context.enableMML3Support) {
66
- // There's a bug in the experimental MML3 plugin that causes mi and mo elements containing non-breaking
67
- // spaces to break MathJax's math processing (e.g. <mo>&nbsp;</mo>, <mi>Some&nbsp;Identifier</mi>).
68
- // Unfortunately, WIRIS tends to add a lot of these in chemistry equations, so they break math processing.
69
- //
70
- // In order to address this, we can just remove any non-breaking spaces entirely, replacing them with
71
- // empty strings. MathJax will ignore any empty elements as a result, and while this may mean intended
72
- // whitespace is occasionally removed, it's necessary for MathJax to render anything at all.
73
- //
74
- // NOTE: MathJax evidently has a fix for this in MathJax 4, so we should consider trying to remove this when
75
- // the update comes out of beta and we decide to take it on.
76
- //
77
- // See https://github.com/mathjax/MathJax/issues/3030 for some related discussion.
78
- elem.querySelectorAll('mo, mi').forEach(elm => {
79
- elm.innerHTML = elm.innerHTML.replace(/&nbsp;/g, '');
80
- });
81
- }
82
-
83
64
  // If we're using deferred rendering, we need to create a document structure
84
65
  // within the element so MathJax can appropriately process math.
85
66
  if (!options.noDeferredRendering) elem.innerHTML = `<mjx-doc><mjx-head></mjx-head><mjx-body>${elem.innerHTML}</mjx-body></mjx-doc>`;
@@ -120,13 +101,7 @@ export function loadMathJax(mathJaxConfig) {
120
101
  }
121
102
  },
122
103
  loader: {
123
- load: mathJaxConfig && mathJaxConfig.enableMML3Support
124
- ? [
125
- '[mml]/mml3',
126
- 'ui/menu'
127
- ] : [
128
- 'ui/menu'
129
- ]
104
+ load: ['ui/menu']
130
105
  },
131
106
  startup: {
132
107
  ready: () => {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@brightspace-ui/core",
3
- "version": "3.32.0",
3
+ "version": "3.33.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",
@@ -4,6 +4,5 @@ console.warn('Using mathjax test context, this is intended for demo pages and te
4
4
 
5
5
  addContext('d2l-mathjax', {
6
6
  outputScale: 1.1,
7
- renderLatex: !(window.location.search.indexOf('latex=false') !== -1),
8
- enableMML3Support: true
7
+ renderLatex: !(window.location.search.indexOf('latex=false') !== -1)
9
8
  });