@brightspace-ui/core 3.242.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.
- package/components/card/README.md +1 -1
- package/components/page/page-main.js +24 -0
- package/components/page/page-panel-mixin.js +74 -0
- package/components/page/page-side-nav.js +19 -0
- package/components/page/page-supporting.js +19 -0
- package/components/page/page.js +5 -1
- package/custom-elements.json +111 -3
- package/helpers/prism.js +14 -20
- package/package.json +1 -1
|
@@ -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"
|
|
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>
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { css, html, LitElement } from 'lit';
|
|
2
|
+
import { PagePanelMixin, pagePanelStyles } from './page-panel-mixin.js';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Component to be placed in the main default slot of d2l-page, providing a panel with optional header
|
|
6
|
+
* @slot - The main content of the main page panel
|
|
7
|
+
* @slot header-start - Optional start content of the main page header
|
|
8
|
+
* @slot header-end - Optional end content of the main page header
|
|
9
|
+
*/
|
|
10
|
+
class PageMain extends PagePanelMixin(LitElement) {
|
|
11
|
+
|
|
12
|
+
static styles = [pagePanelStyles, css`
|
|
13
|
+
.panel-header {
|
|
14
|
+
top: var(--d2l-page-header-height, 0);
|
|
15
|
+
}
|
|
16
|
+
`];
|
|
17
|
+
|
|
18
|
+
render() {
|
|
19
|
+
return this._renderPanel(html`<slot></slot>`);
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
customElements.define('d2l-page-main', PageMain);
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
import '../colors/colors.js';
|
|
2
|
+
import { css, html } from 'lit';
|
|
3
|
+
import { classMap } from 'lit/directives/class-map.js';
|
|
4
|
+
|
|
5
|
+
export const pagePanelStyles = css`
|
|
6
|
+
.panel-header:not([hidden]) {
|
|
7
|
+
align-items: center;
|
|
8
|
+
display: flex;
|
|
9
|
+
flex-direction: row;
|
|
10
|
+
justify-content: space-between;
|
|
11
|
+
}
|
|
12
|
+
.panel-header {
|
|
13
|
+
background-color: white;
|
|
14
|
+
border-bottom: 1px solid var(--d2l-color-mica);
|
|
15
|
+
height: 70px;
|
|
16
|
+
overflow: hidden;
|
|
17
|
+
padding: 0 30px;
|
|
18
|
+
position: sticky;
|
|
19
|
+
top: 0;
|
|
20
|
+
z-index: 14; /* To be over sticky content of our core components, but not over the header shadow */
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
.header-start,
|
|
24
|
+
.header-end {
|
|
25
|
+
display: flex;
|
|
26
|
+
gap: 6px;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
.panel {
|
|
30
|
+
padding: 30px;
|
|
31
|
+
}
|
|
32
|
+
`;
|
|
33
|
+
|
|
34
|
+
export const PagePanelMixin = superclass => class extends superclass {
|
|
35
|
+
|
|
36
|
+
static properties = {
|
|
37
|
+
_hasHeader: { state: true },
|
|
38
|
+
_slotVisibility: { state: true }
|
|
39
|
+
};
|
|
40
|
+
|
|
41
|
+
constructor() {
|
|
42
|
+
super();
|
|
43
|
+
this._hasHeader = false;
|
|
44
|
+
this._slotVisibility = {};
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
_renderPanel(content) {
|
|
48
|
+
const panelClasses = {
|
|
49
|
+
'panel': true,
|
|
50
|
+
'header-sticky': this._hasHeader
|
|
51
|
+
};
|
|
52
|
+
const header = html`
|
|
53
|
+
<div ?hidden="${!this._hasHeader}" class="panel-header">
|
|
54
|
+
<div class="header-start"><slot name="header-start" @slotchange="${this.#handleSlotVisibilityChange}"></slot></div>
|
|
55
|
+
<div class="header-end"><slot name="header-end" @slotchange="${this.#handleSlotVisibilityChange}"></slot></div>
|
|
56
|
+
</div>`;
|
|
57
|
+
|
|
58
|
+
return html`
|
|
59
|
+
<div>
|
|
60
|
+
${header}
|
|
61
|
+
<div class="${classMap(panelClasses)}">${content}</div>
|
|
62
|
+
</div>
|
|
63
|
+
`;
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
#handleSlotVisibilityChange(e) {
|
|
67
|
+
const key = e.target.name;
|
|
68
|
+
const nodes = e.target.assignedNodes();
|
|
69
|
+
this._slotVisibility = { ...this._slotVisibility, [key]: nodes.length !== 0 };
|
|
70
|
+
|
|
71
|
+
this._hasHeader = this._slotVisibility['header-start'] || this._slotVisibility['header-end'];
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
};
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { html, LitElement } from 'lit';
|
|
2
|
+
import { PagePanelMixin, pagePanelStyles } from './page-panel-mixin.js';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Component to be placed in the side-nav slot of d2l-page, providing a panel with optional header
|
|
6
|
+
* @slot - The main content of the side-nav page panel
|
|
7
|
+
* @slot header-start - Optional start content of the side-nav page header
|
|
8
|
+
* @slot header-end - Optional end content of the side-nav page header
|
|
9
|
+
*/
|
|
10
|
+
class PageSideNav extends PagePanelMixin(LitElement) {
|
|
11
|
+
|
|
12
|
+
static styles = [pagePanelStyles];
|
|
13
|
+
|
|
14
|
+
render() {
|
|
15
|
+
return this._renderPanel(html`<slot></slot>`);
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
customElements.define('d2l-page-side-nav', PageSideNav);
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { html, LitElement } from 'lit';
|
|
2
|
+
import { PagePanelMixin, pagePanelStyles } from './page-panel-mixin.js';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Component to be placed in the supporting slot of d2l-page, providing a panel with optional header
|
|
6
|
+
* @slot - The main content of the supporting page panel
|
|
7
|
+
* @slot header-start - Optional start content of the supporting page header
|
|
8
|
+
* @slot header-end - Optional end content of the supporting page header
|
|
9
|
+
*/
|
|
10
|
+
class PageSupporting extends PagePanelMixin(LitElement) {
|
|
11
|
+
|
|
12
|
+
static styles = [pagePanelStyles];
|
|
13
|
+
|
|
14
|
+
render() {
|
|
15
|
+
return this._renderPanel(html`<slot></slot>`);
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
customElements.define('d2l-page-supporting', PageSupporting);
|
package/components/page/page.js
CHANGED
|
@@ -44,10 +44,14 @@ class Page extends LocalizeCoreElement(LitElement) {
|
|
|
44
44
|
--d2l-page-footer-max-width: 100%;
|
|
45
45
|
}
|
|
46
46
|
|
|
47
|
+
.header {
|
|
48
|
+
position: relative;
|
|
49
|
+
z-index: 15; /* To be over sticky content of our core components */
|
|
50
|
+
}
|
|
51
|
+
|
|
47
52
|
.page.header-sticky .header {
|
|
48
53
|
position: sticky;
|
|
49
54
|
top: 0;
|
|
50
|
-
z-index: 15; /* To be over sticky content of our core components */
|
|
51
55
|
}
|
|
52
56
|
|
|
53
57
|
.content {
|
package/custom-elements.json
CHANGED
|
@@ -12270,8 +12270,8 @@
|
|
|
12270
12270
|
"properties": [
|
|
12271
12271
|
{
|
|
12272
12272
|
"name": "properties",
|
|
12273
|
-
"type": "{ demoMode: { type: BooleanConstructor; attribute: string; }; hasFooter: { type: BooleanConstructor; attribute: string; };
|
|
12274
|
-
"default": "{\"demoMode\":{\"type\":\"Boolean\",\"attribute\":\"demo-mode\"},\"hasFooter\":{\"type\":\"Boolean\",\"attribute\":\"has-footer\"},\"hasSideNavPanel\":{\"type\":\"Boolean\",\"attribute\":\"has-side-nav-panel\"},\"hasSupportingPanel\":{\"type\":\"Boolean\",\"attribute\":\"has-supporting-panel\"},\"navType\":{\"type\":\"String\",\"attribute\":\"nav-type\"},\"widthType\":{\"type\":\"String\",\"attribute\":\"width-type\"},\"_allowThreePanels\":{\"state\":true}}"
|
|
12273
|
+
"type": "{ demoMode: { type: BooleanConstructor; attribute: string; }; hasFooter: { type: BooleanConstructor; attribute: string; }; hasMainHeader: { type: BooleanConstructor; attribute: string; }; ... 7 more ...; _demoDialogOpened: { ...; }; }",
|
|
12274
|
+
"default": "{\"demoMode\":{\"type\":\"Boolean\",\"attribute\":\"demo-mode\"},\"hasFooter\":{\"type\":\"Boolean\",\"attribute\":\"has-footer\"},\"hasMainHeader\":{\"type\":\"Boolean\",\"attribute\":\"has-main-header\"},\"hasSideNavHeader\":{\"type\":\"Boolean\",\"attribute\":\"has-side-nav-header\"},\"hasSideNavPanel\":{\"type\":\"Boolean\",\"attribute\":\"has-side-nav-panel\"},\"hasSupportingHeader\":{\"type\":\"Boolean\",\"attribute\":\"has-supporting-header\"},\"hasSupportingPanel\":{\"type\":\"Boolean\",\"attribute\":\"has-supporting-panel\"},\"navType\":{\"type\":\"String\",\"attribute\":\"nav-type\"},\"widthType\":{\"type\":\"String\",\"attribute\":\"width-type\"},\"_allowThreePanels\":{\"state\":true},\"_demoDialogOpened\":{\"state\":true}}"
|
|
12275
12275
|
},
|
|
12276
12276
|
{
|
|
12277
12277
|
"name": "styles",
|
|
@@ -12288,11 +12288,26 @@
|
|
|
12288
12288
|
"type": "boolean",
|
|
12289
12289
|
"default": "false"
|
|
12290
12290
|
},
|
|
12291
|
+
{
|
|
12292
|
+
"name": "hasMainHeader",
|
|
12293
|
+
"type": "boolean",
|
|
12294
|
+
"default": "false"
|
|
12295
|
+
},
|
|
12296
|
+
{
|
|
12297
|
+
"name": "hasSideNavHeader",
|
|
12298
|
+
"type": "boolean",
|
|
12299
|
+
"default": "false"
|
|
12300
|
+
},
|
|
12291
12301
|
{
|
|
12292
12302
|
"name": "hasSideNavPanel",
|
|
12293
12303
|
"type": "boolean",
|
|
12294
12304
|
"default": "false"
|
|
12295
12305
|
},
|
|
12306
|
+
{
|
|
12307
|
+
"name": "hasSupportingHeader",
|
|
12308
|
+
"type": "boolean",
|
|
12309
|
+
"default": "false"
|
|
12310
|
+
},
|
|
12296
12311
|
{
|
|
12297
12312
|
"name": "hasSupportingPanel",
|
|
12298
12313
|
"type": "boolean",
|
|
@@ -12310,6 +12325,99 @@
|
|
|
12310
12325
|
}
|
|
12311
12326
|
]
|
|
12312
12327
|
},
|
|
12328
|
+
{
|
|
12329
|
+
"name": "d2l-page-main",
|
|
12330
|
+
"path": "./components/page/page-main.js",
|
|
12331
|
+
"description": "Component to be placed in the main default slot of d2l-page, providing a panel with optional header",
|
|
12332
|
+
"properties": [
|
|
12333
|
+
{
|
|
12334
|
+
"name": "styles",
|
|
12335
|
+
"type": "CSSResult[]",
|
|
12336
|
+
"default": "[\"pagePanelStyles\",null]"
|
|
12337
|
+
},
|
|
12338
|
+
{
|
|
12339
|
+
"name": "properties",
|
|
12340
|
+
"type": "{ _hasHeader: { state: boolean; }; _slotVisibility: { state: boolean; }; }",
|
|
12341
|
+
"default": "{\"_hasHeader\":{\"state\":true},\"_slotVisibility\":{\"state\":true}}"
|
|
12342
|
+
}
|
|
12343
|
+
],
|
|
12344
|
+
"slots": [
|
|
12345
|
+
{
|
|
12346
|
+
"name": "",
|
|
12347
|
+
"description": "The main content of the main page panel"
|
|
12348
|
+
},
|
|
12349
|
+
{
|
|
12350
|
+
"name": "header-start",
|
|
12351
|
+
"description": "Optional start content of the main page header"
|
|
12352
|
+
},
|
|
12353
|
+
{
|
|
12354
|
+
"name": "header-end",
|
|
12355
|
+
"description": "Optional end content of the main page header"
|
|
12356
|
+
}
|
|
12357
|
+
]
|
|
12358
|
+
},
|
|
12359
|
+
{
|
|
12360
|
+
"name": "d2l-page-side-nav",
|
|
12361
|
+
"path": "./components/page/page-side-nav.js",
|
|
12362
|
+
"description": "Component to be placed in the side-nav slot of d2l-page, providing a panel with optional header",
|
|
12363
|
+
"properties": [
|
|
12364
|
+
{
|
|
12365
|
+
"name": "styles",
|
|
12366
|
+
"type": "CSSResult[]",
|
|
12367
|
+
"default": "[\"pagePanelStyles\"]"
|
|
12368
|
+
},
|
|
12369
|
+
{
|
|
12370
|
+
"name": "properties",
|
|
12371
|
+
"type": "{ _hasHeader: { state: boolean; }; _slotVisibility: { state: boolean; }; }",
|
|
12372
|
+
"default": "{\"_hasHeader\":{\"state\":true},\"_slotVisibility\":{\"state\":true}}"
|
|
12373
|
+
}
|
|
12374
|
+
],
|
|
12375
|
+
"slots": [
|
|
12376
|
+
{
|
|
12377
|
+
"name": "",
|
|
12378
|
+
"description": "The main content of the side-nav page panel"
|
|
12379
|
+
},
|
|
12380
|
+
{
|
|
12381
|
+
"name": "header-start",
|
|
12382
|
+
"description": "Optional start content of the side-nav page header"
|
|
12383
|
+
},
|
|
12384
|
+
{
|
|
12385
|
+
"name": "header-end",
|
|
12386
|
+
"description": "Optional end content of the side-nav page header"
|
|
12387
|
+
}
|
|
12388
|
+
]
|
|
12389
|
+
},
|
|
12390
|
+
{
|
|
12391
|
+
"name": "d2l-page-supporting",
|
|
12392
|
+
"path": "./components/page/page-supporting.js",
|
|
12393
|
+
"description": "Component to be placed in the supporting slot of d2l-page, providing a panel with optional header",
|
|
12394
|
+
"properties": [
|
|
12395
|
+
{
|
|
12396
|
+
"name": "styles",
|
|
12397
|
+
"type": "CSSResult[]",
|
|
12398
|
+
"default": "[\"pagePanelStyles\"]"
|
|
12399
|
+
},
|
|
12400
|
+
{
|
|
12401
|
+
"name": "properties",
|
|
12402
|
+
"type": "{ _hasHeader: { state: boolean; }; _slotVisibility: { state: boolean; }; }",
|
|
12403
|
+
"default": "{\"_hasHeader\":{\"state\":true},\"_slotVisibility\":{\"state\":true}}"
|
|
12404
|
+
}
|
|
12405
|
+
],
|
|
12406
|
+
"slots": [
|
|
12407
|
+
{
|
|
12408
|
+
"name": "",
|
|
12409
|
+
"description": "The main content of the supporting page panel"
|
|
12410
|
+
},
|
|
12411
|
+
{
|
|
12412
|
+
"name": "header-start",
|
|
12413
|
+
"description": "Optional start content of the supporting page header"
|
|
12414
|
+
},
|
|
12415
|
+
{
|
|
12416
|
+
"name": "header-end",
|
|
12417
|
+
"description": "Optional end content of the supporting page header"
|
|
12418
|
+
}
|
|
12419
|
+
]
|
|
12420
|
+
},
|
|
12313
12421
|
{
|
|
12314
12422
|
"name": "d2l-page",
|
|
12315
12423
|
"path": "./components/page/page.js",
|
|
@@ -12323,7 +12431,7 @@
|
|
|
12323
12431
|
{
|
|
12324
12432
|
"name": "styles",
|
|
12325
12433
|
"type": "CSSResult",
|
|
12326
|
-
"default": "\"css`\\n\\t\\t:host {\\n\\t\\t\\t--d2l-page-header-max-width: 1230px;\\n\\t\\t\\t--d2l-page-content-max-width: 1230px;\\n\\t\\t\\t--d2l-page-footer-max-width: 1230px;\\n\\t\\t\\t--d2l-page-margin-inline: auto;\\n\\t\\t}\\n\\n\\t\\t:host([width-type=\\\"wide\\\"]) {\\n\\t\\t\\t--d2l-page-header-max-width: 1440px;\\n\\t\\t\\t--d2l-page-content-max-width: 1440px;\\n\\t\\t\\t--d2l-page-footer-max-width: 1440px;\\n\\t\\t}\\n\\n\\t\\t:host([width-type=\\\"fullscreen\\\"]) {\\n\\t\\t\\t--d2l-page-header-max-width: 100%;\\n\\t\\t\\t--d2l-page-content-max-width: 100%;\\n\\t\\t\\t--d2l-page-footer-max-width: 100%;\\n\\t\\t}\\n\\n\\t\\t.
|
|
12434
|
+
"default": "\"css`\\n\\t\\t:host {\\n\\t\\t\\t--d2l-page-header-max-width: 1230px;\\n\\t\\t\\t--d2l-page-content-max-width: 1230px;\\n\\t\\t\\t--d2l-page-footer-max-width: 1230px;\\n\\t\\t\\t--d2l-page-margin-inline: auto;\\n\\t\\t}\\n\\n\\t\\t:host([width-type=\\\"wide\\\"]) {\\n\\t\\t\\t--d2l-page-header-max-width: 1440px;\\n\\t\\t\\t--d2l-page-content-max-width: 1440px;\\n\\t\\t\\t--d2l-page-footer-max-width: 1440px;\\n\\t\\t}\\n\\n\\t\\t:host([width-type=\\\"fullscreen\\\"]) {\\n\\t\\t\\t--d2l-page-header-max-width: 100%;\\n\\t\\t\\t--d2l-page-content-max-width: 100%;\\n\\t\\t\\t--d2l-page-footer-max-width: 100%;\\n\\t\\t}\\n\\n\\t\\t.header {\\n\\t\\t\\tposition: relative;\\n\\t\\t\\tz-index: 15; /* To be over sticky content of our core components */\\n\\t\\t}\\n\\n\\t\\t.page.header-sticky .header {\\n\\t\\t\\tposition: sticky;\\n\\t\\t\\ttop: 0;\\n\\t\\t}\\n\\n\\t\\t.content {\\n\\t\\t\\tdisplay: flex;\\n\\t\\t\\tmargin-inline: var(--d2l-page-margin-inline, 0);\\n\\t\\t\\tmax-width: var(--d2l-page-content-max-width, 100%);\\n\\t\\t\\tpadding-bottom: var(--d2l-page-footer-height, 0); /* Reserve space for fixed footer */\\n\\t\\t}\\n\\n\\t\\tmain {\\n\\t\\t\\tflex: 1;\\n\\t\\t\\tmin-width: min(400px, 100%); /* Actual min width TBD */\\n\\t\\t}\\n\\n\\t\\t.side-nav-panel,\\n\\t\\t.supporting-panel {\\n\\t\\t\\theight: calc(100vh - var(--d2l-page-header-height, 0) - var(--d2l-page-footer-height, 0));\\n\\t\\t\\toverflow: clip auto;\\n\\t\\t\\tposition: sticky;\\n\\t\\t\\ttop: var(--d2l-page-header-height, 0);\\n\\t\\t}\\n\\n\\t\\t.divider {\\n\\t\\t\\tbackground-color: var(--d2l-color-gypsum);\\n\\t\\t\\tflex: none;\\n\\t\\t\\twidth: 4px;\\n\\t\\t}\\n\\n\\t\\t.footer:not([hidden]),\\n\\t\\t.floating-buttons-container {\\n\\t\\t\\tdisplay: inline;\\n\\t\\t}\\n\\t\\t.fixed-footer {\\n\\t\\t\\tbackground-color: white;\\n\\t\\t\\tbox-shadow: 0 -2px 4px rgba(32, 33, 34, 0.2); /* ferrite */\\n\\t\\t\\tinset: auto 0 0;\\n\\t\\t\\tpadding: 0.75rem 0;\\n\\t\\t\\tposition: fixed;\\n\\t\\t\\tz-index: 10; /* To be over sticky content of our core components */\\n\\t\\t}\\n\\t\\t.footer-contents {\\n\\t\\t\\tmargin-inline: var(--d2l-page-margin-inline, 0);\\n\\t\\t\\tmax-width: var(--d2l-page-footer-max-width, 100%);\\n\\t\\t}\\n\\t`\""
|
|
12327
12435
|
},
|
|
12328
12436
|
{
|
|
12329
12437
|
"name": "widthType",
|
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 =
|
|
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
|
|
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 = `${
|
|
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
|
|
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 = `${
|
|
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
|
|
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
|
|
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 = (
|
|
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 = `${
|
|
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
|
|
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
|
-
|
|
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
|
|
462
|
-
loadLanguageAddons(languageInfo.key
|
|
463
|
-
lineNumbers ? loadPlugin('line-numbers'
|
|
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.
|
|
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",
|