@brightspace-ui/core 2.121.0 → 2.122.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/dialog/dialog-mixin.js +8 -0
- package/components/dropdown/dropdown-content-mixin.js +8 -0
- 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/templates/primary-secondary/demo/integration.html +38 -9
|
@@ -142,6 +142,7 @@ export const DialogMixin = superclass => class extends RtlMixin(superclass) {
|
|
|
142
142
|
|
|
143
143
|
_addHandlers() {
|
|
144
144
|
window.addEventListener('resize', this._updateSize);
|
|
145
|
+
this.addEventListener('touchstart', this._handleTouchStart);
|
|
145
146
|
if (this.shadowRoot) this.shadowRoot.querySelector('.d2l-dialog-content').addEventListener('scroll', this._updateOverflow);
|
|
146
147
|
}
|
|
147
148
|
|
|
@@ -356,6 +357,12 @@ export const DialogMixin = superclass => class extends RtlMixin(superclass) {
|
|
|
356
357
|
this._useNative = false;
|
|
357
358
|
}
|
|
358
359
|
|
|
360
|
+
_handleTouchStart(e) {
|
|
361
|
+
// elements external to the dialog such as primary-secondary template should not be reacting
|
|
362
|
+
// to touchstart events originating inside the dialog or backdrop
|
|
363
|
+
e.stopPropagation();
|
|
364
|
+
}
|
|
365
|
+
|
|
359
366
|
_isCloseAborted() {
|
|
360
367
|
const abortEvent = new CustomEvent('d2l-dialog-before-close', {
|
|
361
368
|
cancelable: true,
|
|
@@ -441,6 +448,7 @@ export const DialogMixin = superclass => class extends RtlMixin(superclass) {
|
|
|
441
448
|
|
|
442
449
|
_removeHandlers() {
|
|
443
450
|
window.removeEventListener('resize', this._updateSize);
|
|
451
|
+
this.removeEventListener('touchstart', this._handleTouchStart);
|
|
444
452
|
if (this.shadowRoot) this.shadowRoot.querySelector('.d2l-dialog-content').removeEventListener('scroll', this._updateOverflow);
|
|
445
453
|
}
|
|
446
454
|
|
|
@@ -294,6 +294,7 @@ export const DropdownContentMixin = superclass => class extends LocalizeCoreElem
|
|
|
294
294
|
|
|
295
295
|
window.addEventListener('resize', this.__onResize);
|
|
296
296
|
this.addEventListener('blur', this.__onAutoCloseFocus, true);
|
|
297
|
+
this.addEventListener('touchstart', this.__onTouchStart);
|
|
297
298
|
document.body.addEventListener('focus', this.__onAutoCloseFocus, true);
|
|
298
299
|
document.body.addEventListener('click', this.__onAutoCloseClick, true);
|
|
299
300
|
this.mediaQueryList = window.matchMedia(`(max-width: ${this.mobileBreakpointOverride - 1}px)`);
|
|
@@ -305,6 +306,7 @@ export const DropdownContentMixin = superclass => class extends LocalizeCoreElem
|
|
|
305
306
|
super.disconnectedCallback();
|
|
306
307
|
if (this.mediaQueryList.removeEventListener) this.mediaQueryList.removeEventListener('change', this._handleMobileResize);
|
|
307
308
|
this.removeEventListener('blur', this.__onAutoCloseFocus);
|
|
309
|
+
this.removeEventListener('touchstart', this.__onTouchStart);
|
|
308
310
|
window.removeEventListener('resize', this.__onResize);
|
|
309
311
|
if (document.body) {
|
|
310
312
|
// DE41322: document.body can be null in some scenarios
|
|
@@ -530,6 +532,12 @@ export const DropdownContentMixin = superclass => class extends LocalizeCoreElem
|
|
|
530
532
|
this.resize();
|
|
531
533
|
}
|
|
532
534
|
|
|
535
|
+
__onTouchStart(e) {
|
|
536
|
+
// elements external to the dropdown content such as primary-secondary template should not be reacting
|
|
537
|
+
// to touchstart events originating inside the dropdown content
|
|
538
|
+
e.stopPropagation();
|
|
539
|
+
}
|
|
540
|
+
|
|
533
541
|
async __openedChanged(newValue) {
|
|
534
542
|
|
|
535
543
|
// DE44538: wait for dropdown content to fully render,
|
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.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",
|
|
@@ -14,6 +14,7 @@
|
|
|
14
14
|
import '../../../components/collapsible-panel/collapsible-panel.js';
|
|
15
15
|
import '../../../components/collapsible-panel/collapsible-panel-summary-item.js';
|
|
16
16
|
import '../../../components/demo/demo-page.js';
|
|
17
|
+
import '../../../components/dialog/dialog.js';
|
|
17
18
|
import '../../../components/dialog/dialog-fullscreen.js';
|
|
18
19
|
import '../../../components/dropdown/dropdown-button-subtle.js';
|
|
19
20
|
import '../../../components/dropdown/dropdown-content.js';
|
|
@@ -54,6 +55,7 @@
|
|
|
54
55
|
|
|
55
56
|
<d2l-list item-count="50" extend-separators>
|
|
56
57
|
<d2l-list-controls slot="controls" select-all-pages-allowed>
|
|
58
|
+
<d2l-button-icon icon="tier1:gear" id="openMainDialog" text="Open"></d2l-button-icon>
|
|
57
59
|
<d2l-selection-action icon="tier1:plus-default" text="Add"></d2l-selection-action>
|
|
58
60
|
<d2l-selection-action-dropdown text="Move To" requires-selection>
|
|
59
61
|
<d2l-dropdown-menu>
|
|
@@ -195,7 +197,6 @@
|
|
|
195
197
|
</d2l-list-item>
|
|
196
198
|
</d2l-list>
|
|
197
199
|
|
|
198
|
-
|
|
199
200
|
<div style="height: 100px;"></div>
|
|
200
201
|
|
|
201
202
|
<d2l-list item-count="50">
|
|
@@ -341,9 +342,7 @@
|
|
|
341
342
|
</d2l-list-item>
|
|
342
343
|
</d2l-list>
|
|
343
344
|
|
|
344
|
-
|
|
345
|
-
<div slot="secondary" style="padding: 1rem;">
|
|
346
|
-
<d2l-dialog-fullscreen id="dialogFullscreen" title-text="Fullscreen Title">
|
|
345
|
+
<d2l-dialog-fullscreen id="dialogMain" title-text="Dialog Title">
|
|
347
346
|
<p>Deadlights jack lad schooner scallywag dance the hempen jig carouser broadside cable strike colors. Bring a spring upon her cable holystone blow the man down spanker</p>
|
|
348
347
|
<p>Shiver me timbers to go on account lookout wherry doubloon chase. Belay yo-ho-ho keelhaul squiffy black spot yardarm spyglass sheet transom heave to.</p>
|
|
349
348
|
<p>Trysail Sail ho Corsair red ensign hulk smartly boom jib rum gangway. Case shot Shiver me timbers gangplank crack Jennys tea cup ballast Blimey lee snow crow's nest rutters. Fluke jib scourge of the seven seas boatswain schooner gaff booty Jack Tar transom spirits.</p>
|
|
@@ -353,14 +352,32 @@
|
|
|
353
352
|
<d2l-button slot="footer" primary data-dialog-action="save">Save</d2l-button>
|
|
354
353
|
<d2l-button slot="footer" data-dialog-action>Cancel</d2l-button>
|
|
355
354
|
</d2l-dialog-fullscreen>
|
|
355
|
+
|
|
356
|
+
<script>
|
|
357
|
+
document.querySelector('#openMainDialog').addEventListener('click', () => {
|
|
358
|
+
document.querySelector('#dialogMain').opened = true;
|
|
359
|
+
});
|
|
360
|
+
document.querySelector('#dialogMain').addEventListener('d2l-dialog-close', (e) => {
|
|
361
|
+
console.log('main dialog action:', e.detail.action);
|
|
362
|
+
});
|
|
363
|
+
</script>
|
|
364
|
+
|
|
365
|
+
</div>
|
|
366
|
+
<div slot="secondary" style="padding: 1rem;">
|
|
367
|
+
|
|
356
368
|
<d2l-collapsible-panel panel-title="Availability" expanded>
|
|
357
369
|
<d2l-collapsible-panel-summary-item slot="summary" text="Availability starts 8/16/2022 and ends 8/12/2022"></d2l-collapsible-panel-summary-item>
|
|
358
370
|
<d2l-collapsible-panel-summary-item slot="summary" text="Hidden by special access"></d2l-collapsible-panel-summary-item>
|
|
359
|
-
<d2l-button-icon slot="actions" icon="tier1:gear" id="
|
|
371
|
+
<d2l-button-icon slot="actions" icon="tier1:gear" id="openSecondaryDialog" text="Settings"></d2l-button-icon>
|
|
360
372
|
<d2l-dropdown-more slot="actions">
|
|
361
373
|
<d2l-dropdown-menu>
|
|
362
374
|
<d2l-menu>
|
|
375
|
+
<d2l-menu-item text="Add New"></d2l-menu-item>
|
|
376
|
+
<d2l-menu-item text="Bookmark"></d2l-menu-item>
|
|
363
377
|
<d2l-menu-item text="Duplicate"></d2l-menu-item>
|
|
378
|
+
<d2l-menu-item text="Settings"></d2l-menu-item>
|
|
379
|
+
<d2l-menu-item text="Move"></d2l-menu-item>
|
|
380
|
+
<d2l-menu-item text="Publish"></d2l-menu-item>
|
|
364
381
|
<d2l-menu-item text="Delete"></d2l-menu-item>
|
|
365
382
|
</d2l-menu>
|
|
366
383
|
</d2l-dropdown-menu>
|
|
@@ -397,12 +414,24 @@
|
|
|
397
414
|
</div>
|
|
398
415
|
<d2l-input-textarea label="Extra Text" label-hidden rows="6" value="This is a d2l-input-textarea." style="margin-top: 1rem;"></d2l-input-textarea>
|
|
399
416
|
</d2l-collapsible-panel>
|
|
417
|
+
|
|
418
|
+
<d2l-dialog id="dialogSecondary" title-text="Dialog Title">
|
|
419
|
+
<p>Deadlights jack lad schooner scallywag dance the hempen jig carouser broadside cable strike colors. Bring a spring upon her cable holystone blow the man down spanker</p>
|
|
420
|
+
<p>Shiver me timbers to go on account lookout wherry doubloon chase. Belay yo-ho-ho keelhaul squiffy black spot yardarm spyglass sheet transom heave to.</p>
|
|
421
|
+
<p>Trysail Sail ho Corsair red ensign hulk smartly boom jib rum gangway. Case shot Shiver me timbers gangplank crack Jennys tea cup ballast Blimey lee snow crow's nest rutters. Fluke jib scourge of the seven seas boatswain schooner gaff booty Jack Tar transom spirits.</p>
|
|
422
|
+
<p>Deadlights jack lad schooner scallywag dance the hempen jig carouser broadside cable strike colors. Bring a spring upon her cable holystone blow the man down spanker</p>
|
|
423
|
+
<p>Shiver me timbers to go on account lookout wherry doubloon chase. Belay yo-ho-ho keelhaul squiffy black spot yardarm spyglass sheet transom heave to.</p>
|
|
424
|
+
<p>Trysail Sail ho Corsair red ensign hulk smartly boom jib rum gangway. Case shot Shiver me timbers gangplank crack Jennys tea cup ballast Blimey lee snow crow's nest rutters. Fluke jib scourge of the seven seas boatswain schooner gaff booty Jack Tar transom spirits.</p>
|
|
425
|
+
<d2l-button slot="footer" primary data-dialog-action="save">Save</d2l-button>
|
|
426
|
+
<d2l-button slot="footer" data-dialog-action>Cancel</d2l-button>
|
|
427
|
+
</d2l-dialog>
|
|
428
|
+
|
|
400
429
|
<script>
|
|
401
|
-
document.querySelector('#
|
|
402
|
-
document.querySelector('#
|
|
430
|
+
document.querySelector('#openSecondaryDialog').addEventListener('click', () => {
|
|
431
|
+
document.querySelector('#dialogSecondary').opened = true;
|
|
403
432
|
});
|
|
404
|
-
document.querySelector('#
|
|
405
|
-
console.log('
|
|
433
|
+
document.querySelector('#dialogSecondary').addEventListener('d2l-dialog-close', (e) => {
|
|
434
|
+
console.log('secondary dialog action:', e.detail.action);
|
|
406
435
|
});
|
|
407
436
|
</script>
|
|
408
437
|
<p>
|