@brightspace-ui/core 3.243.0 → 3.243.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.
@@ -14,7 +14,7 @@ Used to surface pertinent information, cards make it easy for users to browse in
14
14
  import '@brightspace-ui/core/components/tooltip/tooltip.js';
15
15
  </script>
16
16
 
17
- <d2l-card align-center text="Biology" align-center style="width: 245px;">
17
+ <d2l-card align-center text="Biology" style="width: 245px;">
18
18
  <img slot="header" alt="" style="display: block; width: 100%;" src="https://s.brightspace.com/course-images/images/7905e442-f009-46f6-8586-2c273a7c0158/banner-narrow-low-density-max-size.jpg">
19
19
  <div slot="content">
20
20
  <div>Biology</div>
package/helpers/prism.js CHANGED
@@ -1,10 +1,7 @@
1
1
  import { css, unsafeCSS } from 'lit';
2
- import { getFlag } from './flags.js';
3
2
  import { svgToCSS } from './svg-to-css.js';
4
3
 
5
- const prismLocation = getFlag('shield-14201-update-prismjs-1-30', false)
6
- ? 'https://s.brightspace.com/lib/prismjs/1.30.0'
7
- : 'https://s.brightspace.com/lib/prismjs/1.28.0';
4
+ const prismLocation = 'https://s.brightspace.com/lib/prismjs/1.30.0';
8
5
  //const prismLocation = '/node_modules/prismjs'; // for local debugging
9
6
 
10
7
  // If adding a language, check its Prism dependencies and modify languageDependencies below if necessary
@@ -359,7 +356,7 @@ const languagesLoaded = {
359
356
  plain: Promise.resolve()
360
357
  };
361
358
 
362
- const loadLanguage = async(key, location) => {
359
+ const loadLanguage = async key => {
363
360
  if (languagesLoaded[key]) return languagesLoaded[key];
364
361
 
365
362
  // Prism languages can extend other anguages and must be loaded in order
@@ -373,7 +370,7 @@ const loadLanguage = async(key, location) => {
373
370
  const script = document.createElement('script');
374
371
  script.async = 'async';
375
372
  script.onload = resolve;
376
- script.src = `${location}/components/prism-${key}.min.js`;
373
+ script.src = `${prismLocation}/components/prism-${key}.min.js`;
377
374
  document.head.appendChild(script);
378
375
  });
379
376
 
@@ -382,14 +379,14 @@ const loadLanguage = async(key, location) => {
382
379
 
383
380
  const pluginsLoaded = {};
384
381
 
385
- const loadPlugin = async(plugin, location) => {
382
+ const loadPlugin = async plugin => {
386
383
  if (pluginsLoaded[plugin]) return pluginsLoaded[plugin];
387
384
 
388
385
  pluginsLoaded[plugin] = new Promise(resolve => {
389
386
  const script = document.createElement('script');
390
387
  script.async = 'async';
391
388
  script.onload = resolve;
392
- script.src = `${location}/plugins/${plugin}/prism-${plugin}.min.js`;
389
+ script.src = `${prismLocation}/plugins/${plugin}/prism-${plugin}.min.js`;
393
390
  document.head.appendChild(script);
394
391
  });
395
392
 
@@ -400,17 +397,17 @@ const languageAddons = {
400
397
  css: [{ key: 'css-extras', type: 'lang' }, { key: 'inline-color', type: 'plugin' }]
401
398
  };
402
399
 
403
- const loadLanguageAddons = async(key, location) => {
400
+ const loadLanguageAddons = async key => {
404
401
  if (!languageAddons[key]) return;
405
402
  return Promise.all(languageAddons[key].map(addon => {
406
- if (addon.type === 'lang') return loadLanguage(addon.key, location);
403
+ if (addon.type === 'lang') return loadLanguage(addon.key);
407
404
  else return loadPlugin(addon.key, location);
408
405
  }));
409
406
  };
410
407
 
411
408
  let prismLoaded;
412
409
 
413
- const loadPrism = (location) => {
410
+ const loadPrism = () => {
414
411
  if (prismLoaded) return prismLoaded;
415
412
 
416
413
  // Set Prism to manual mode before loading to make sure
@@ -424,7 +421,7 @@ const loadPrism = (location) => {
424
421
  const script = document.createElement('script');
425
422
  script.async = 'async';
426
423
  script.onload = resolve;
427
- script.src = `${location}/prism.js`;
424
+ script.src = `${prismLocation}/prism.js`;
428
425
  document.head.appendChild(script);
429
426
  }),
430
427
  new Promise(resolve => {
@@ -445,7 +442,7 @@ const getCodeElement = elem => {
445
442
  return elem.querySelector('code');
446
443
  };
447
444
 
448
- export async function formatCodeElement(elem, forceVersionBump) {
445
+ export async function formatCodeElement(elem) {
449
446
  const code = getCodeElement(elem);
450
447
 
451
448
  if (code.className.indexOf('language-') === -1) return;
@@ -453,14 +450,11 @@ export async function formatCodeElement(elem, forceVersionBump) {
453
450
  const languageInfo = getLanguageInfo(code);
454
451
  const lineNumbers = elem.classList.contains('line-numbers') || code.classList.contains('line-numbers');
455
452
 
456
- // Remove when shield-14201-update-prismjs-1-30 is removed (remove pass-throughs and use prismLocation directly in loadLanguage, loadPrism, and loadPlugin)
457
- const location = forceVersionBump ? 'https://s.brightspace.com/lib/prismjs/1.30.0' : prismLocation;
458
-
459
- await loadPrism(location); // must be loaded before loading plugins or languages
453
+ await loadPrism(); // must be loaded before loading plugins or languages
460
454
  await Promise.all([
461
- loadLanguage(languageInfo.key, location),
462
- loadLanguageAddons(languageInfo.key, location),
463
- lineNumbers ? loadPlugin('line-numbers', location) : null
455
+ loadLanguage(languageInfo.key),
456
+ loadLanguageAddons(languageInfo.key),
457
+ lineNumbers ? loadPlugin('line-numbers') : null
464
458
  ]);
465
459
 
466
460
  if (!elem.dataset.language && languageInfo.key !== 'plain') elem.dataset.language = languageInfo.desc;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@brightspace-ui/core",
3
- "version": "3.243.0",
3
+ "version": "3.243.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",