@brightspace-ui/core 2.29.4 → 2.30.0
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/README.md +10 -0
- package/components/dialog/dialog-mixin.js +25 -3
- package/components/tooltip/tooltip-help.js +0 -1
- package/helpers/demo/prism.html +2128 -47
- package/helpers/focus.js +2 -2
- package/helpers/prism.js +113 -68
- package/package.json +1 -1
package/helpers/focus.js
CHANGED
|
@@ -13,8 +13,8 @@ const focusableElements = {
|
|
|
13
13
|
textarea: true
|
|
14
14
|
};
|
|
15
15
|
|
|
16
|
-
export function forceFocusVisible(elem) {
|
|
17
|
-
if (!isFocusable(elem)) {
|
|
16
|
+
export function forceFocusVisible(elem, includeTabbablesOnly) {
|
|
17
|
+
if (!isFocusable(elem, false, includeTabbablesOnly)) {
|
|
18
18
|
elem = getFirstFocusableDescendant(elem);
|
|
19
19
|
}
|
|
20
20
|
if (!elem) return;
|
package/helpers/prism.js
CHANGED
|
@@ -28,6 +28,7 @@ codeLanguages.set('plain', 'Plain Text');
|
|
|
28
28
|
codeLanguages.set('python', 'Python');
|
|
29
29
|
codeLanguages.set('r', 'R');
|
|
30
30
|
codeLanguages.set('racket', 'Racket');
|
|
31
|
+
codeLanguages.set('regex', 'Regex');
|
|
31
32
|
codeLanguages.set('sql', 'SQL');
|
|
32
33
|
codeLanguages.set('wolfram', 'Wolfram');
|
|
33
34
|
|
|
@@ -37,77 +38,78 @@ export const colorModes = {
|
|
|
37
38
|
};
|
|
38
39
|
|
|
39
40
|
const darkColors = Object.freeze({
|
|
40
|
-
background: '#
|
|
41
|
-
language: '#
|
|
42
|
-
lineNumbers: '#
|
|
43
|
-
|
|
44
|
-
tokenDefault: '#
|
|
45
|
-
tokenComment: '#
|
|
46
|
-
tokenPunctuation: '#
|
|
47
|
-
tokenNumber: '#
|
|
48
|
-
tokenUrl: '#
|
|
49
|
-
tokenOperator: '#
|
|
50
|
-
tokenInterpolation: '#
|
|
51
|
-
tokenAttributeName: '#
|
|
52
|
-
tokenConstant: '#
|
|
53
|
-
tokenProperty: '#
|
|
54
|
-
tokenTag: '#
|
|
55
|
-
tokenBoolean: '#
|
|
56
|
-
tokenEntity: '#
|
|
57
|
-
tokenInterpolationPunctuation: '#
|
|
58
|
-
tokenFunction: '#
|
|
59
|
-
tokenClassName: '#
|
|
60
|
-
tokenSymbol: '#
|
|
61
|
-
tokenBuiltin: '#
|
|
62
|
-
tokenKeyword: '#
|
|
63
|
-
tokenAtRule: '#
|
|
64
|
-
tokenSelector: '#
|
|
65
|
-
tokenImportant: '#
|
|
66
|
-
tokenRegex: '#
|
|
67
|
-
tokenString: '#
|
|
68
|
-
tokenChar: '#
|
|
69
|
-
tokenAttributeValue: '#
|
|
41
|
+
background: '#202122',
|
|
42
|
+
language: '#90989d',
|
|
43
|
+
lineNumbers: '#9ea5a9',
|
|
44
|
+
lineNumbersBackground: '#6e747733', // galena 20%
|
|
45
|
+
tokenDefault: '#cdd5dc',
|
|
46
|
+
tokenComment: '#81898d',
|
|
47
|
+
tokenPunctuation: '#cdd5dc',
|
|
48
|
+
tokenNumber: '#cdd5dc',
|
|
49
|
+
tokenUrl: '#cdd5dc',
|
|
50
|
+
tokenOperator: '#cdd5dc',
|
|
51
|
+
tokenInterpolation: '#92d1ff',
|
|
52
|
+
tokenAttributeName: '#92d1ff',
|
|
53
|
+
tokenConstant: '#00d2ed',
|
|
54
|
+
tokenProperty: '#92d1ff',
|
|
55
|
+
tokenTag: '#2899e9',
|
|
56
|
+
tokenBoolean: '#2896e4',
|
|
57
|
+
tokenEntity: '#29a6ff',
|
|
58
|
+
tokenInterpolationPunctuation: '#29a6ff',
|
|
59
|
+
tokenFunction: '#fff9d6',
|
|
60
|
+
tokenClassName: '#2ccfb0',
|
|
61
|
+
tokenSymbol: '#2de2c0',
|
|
62
|
+
tokenBuiltin: '#fd4e9d',
|
|
63
|
+
tokenKeyword: '#e94a92',
|
|
64
|
+
tokenAtRule: '#fd4e9d',
|
|
65
|
+
tokenSelector: '#fff9d6',
|
|
66
|
+
tokenImportant: '#ff575a',
|
|
67
|
+
tokenRegex: '#29A6FF',
|
|
68
|
+
tokenString: '#e9ba79',
|
|
69
|
+
tokenChar: '#e9ba79',
|
|
70
|
+
tokenAttributeValue: '#e9ba79'
|
|
70
71
|
});
|
|
71
72
|
|
|
72
73
|
const lightColors = Object.freeze({
|
|
73
|
-
background: '#
|
|
74
|
-
language: '#
|
|
75
|
-
lineNumbers: '#
|
|
76
|
-
|
|
77
|
-
tokenDefault: '#
|
|
78
|
-
tokenComment: '#
|
|
79
|
-
tokenPunctuation: '#
|
|
80
|
-
tokenNumber: '#
|
|
81
|
-
tokenUrl: '#
|
|
82
|
-
tokenOperator: '#
|
|
83
|
-
tokenInterpolation: '#
|
|
84
|
-
tokenAttributeName: '#
|
|
85
|
-
tokenConstant: '#
|
|
86
|
-
tokenProperty: '#
|
|
87
|
-
tokenTag: '#
|
|
88
|
-
tokenBoolean: '#
|
|
89
|
-
tokenEntity: '
|
|
90
|
-
tokenInterpolationPunctuation: '#
|
|
91
|
-
tokenFunction: '#
|
|
92
|
-
tokenClassName: '#
|
|
93
|
-
tokenSymbol: '#
|
|
94
|
-
tokenBuiltin: '#
|
|
95
|
-
tokenKeyword: '#
|
|
96
|
-
tokenAtRule: '#
|
|
97
|
-
tokenSelector: '#
|
|
98
|
-
tokenImportant: '
|
|
99
|
-
tokenRegex: '
|
|
100
|
-
tokenString: '#
|
|
101
|
-
tokenChar: '#
|
|
102
|
-
tokenAttributeValue: '#
|
|
74
|
+
background: '#f9fbff',
|
|
75
|
+
language: '#6e7477',
|
|
76
|
+
lineNumbers: '#6e7477',
|
|
77
|
+
lineNumbersBackground: '#f1f5fb',
|
|
78
|
+
tokenDefault: '#202122',
|
|
79
|
+
tokenComment: '#90989d',
|
|
80
|
+
tokenPunctuation: '#494c4e',
|
|
81
|
+
tokenNumber: '#494c4e',
|
|
82
|
+
tokenUrl: '#494c4e',
|
|
83
|
+
tokenOperator: '#006fbf',
|
|
84
|
+
tokenInterpolation: '#006fbf',
|
|
85
|
+
tokenAttributeName: '#006fbf',
|
|
86
|
+
tokenConstant: '#035670',
|
|
87
|
+
tokenProperty: '#008eab',
|
|
88
|
+
tokenTag: '#006fbf',
|
|
89
|
+
tokenBoolean: '#004489',
|
|
90
|
+
tokenEntity: '#004489',
|
|
91
|
+
tokenInterpolationPunctuation: '#004489',
|
|
92
|
+
tokenFunction: '#006fbf',
|
|
93
|
+
tokenClassName: '#00635e',
|
|
94
|
+
tokenSymbol: '#00635e',
|
|
95
|
+
tokenBuiltin: '#d40067',
|
|
96
|
+
tokenKeyword: '#d40067',
|
|
97
|
+
tokenAtRule: '#d40067',
|
|
98
|
+
tokenSelector: '#006fbf',
|
|
99
|
+
tokenImportant: '#cd2026',
|
|
100
|
+
tokenRegex: '#006fbf',
|
|
101
|
+
tokenString: '#c74c00',
|
|
102
|
+
tokenChar: '#c74c00',
|
|
103
|
+
tokenAttributeValue: '#c74c00',
|
|
104
|
+
tokenCombinator: '#202122'
|
|
103
105
|
});
|
|
104
106
|
|
|
105
107
|
export const getCodeColors = mode => {
|
|
106
108
|
return mode === colorModes.DARK ? darkColors : lightColors;
|
|
107
109
|
};
|
|
108
110
|
|
|
109
|
-
const generateColorVariables = mode => {
|
|
110
|
-
const colors = getCodeColors(mode);
|
|
111
|
+
const generateColorVariables = (mode, theme) => {
|
|
112
|
+
const colors = getCodeColors(mode, theme);
|
|
111
113
|
const keySelector = mode === colorModes.DARK ? '.d2l-code-dark' : '.d2l-code';
|
|
112
114
|
return `
|
|
113
115
|
pre[class*="language-"]${keySelector},
|
|
@@ -115,7 +117,7 @@ const generateColorVariables = mode => {
|
|
|
115
117
|
--d2l-code-background: ${colors.background};
|
|
116
118
|
--d2l-code-language: ${colors.language};
|
|
117
119
|
--d2l-code-line-numbers: ${colors.lineNumbers};
|
|
118
|
-
--d2l-code-line-numbers-
|
|
120
|
+
--d2l-code-line-numbers-background: ${colors.lineNumbersBackground};
|
|
119
121
|
--d2l-code-token-atrule: ${colors.tokenAtRule};
|
|
120
122
|
--d2l-code-token-attribute-name: ${colors.tokenAttributeName};
|
|
121
123
|
--d2l-code-token-attribute-value: ${colors.tokenAttributeValue};
|
|
@@ -149,7 +151,6 @@ const generateColorVariables = mode => {
|
|
|
149
151
|
export const codeStyles = css`
|
|
150
152
|
|
|
151
153
|
${unsafeCSS(generateColorVariables(colorModes.LIGHT))}
|
|
152
|
-
|
|
153
154
|
${unsafeCSS(generateColorVariables(colorModes.DARK))}
|
|
154
155
|
|
|
155
156
|
pre[class*="language-"].d2l-code,
|
|
@@ -255,19 +256,21 @@ export const codeStyles = css`
|
|
|
255
256
|
background-color: transparent;
|
|
256
257
|
}
|
|
257
258
|
|
|
258
|
-
pre[class*="language-"].line-numbers {
|
|
259
|
+
pre[class*="language-"].d2l-code.line-numbers {
|
|
259
260
|
counter-reset: linenumber;
|
|
260
261
|
padding-left: 3.8em;
|
|
261
262
|
position: relative;
|
|
262
263
|
}
|
|
263
264
|
|
|
264
|
-
pre[class*="language-"].line-numbers > code {
|
|
265
|
+
pre[class*="language-"].d2l-code.line-numbers > code {
|
|
265
266
|
position: relative;
|
|
266
267
|
white-space: inherit;
|
|
267
268
|
}
|
|
268
269
|
|
|
269
|
-
.line-numbers .line-numbers-rows {
|
|
270
|
-
|
|
270
|
+
.d2l-code.line-numbers > code > .line-numbers-rows {
|
|
271
|
+
background-color: var(--d2l-code-line-numbers-background);
|
|
272
|
+
border-bottom-right-radius: 6px;
|
|
273
|
+
border-top-right-radius: 6px;
|
|
271
274
|
font-size: 100%;
|
|
272
275
|
left: -3.8em;
|
|
273
276
|
letter-spacing: -1px;
|
|
@@ -293,6 +296,35 @@ export const codeStyles = css`
|
|
|
293
296
|
padding-right: 0.8em;
|
|
294
297
|
text-align: right;
|
|
295
298
|
}
|
|
299
|
+
|
|
300
|
+
span.inline-color-wrapper {
|
|
301
|
+
/*
|
|
302
|
+
* <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 2 2">
|
|
303
|
+
* <path fill="gray" d="M0 0h2v2H0z"/>
|
|
304
|
+
* <path fill="white" d="M0 0h1v1H0zM1 1h1v1H1z"/>
|
|
305
|
+
* </svg>
|
|
306
|
+
*/
|
|
307
|
+
background: url("data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHZpZXdCb3g9IjAgMCAyIDIiPjxwYXRoIGZpbGw9ImdyYXkiIGQ9Ik0wIDBoMnYySDB6Ii8+PHBhdGggZmlsbD0id2hpdGUiIGQ9Ik0wIDBoMXYxSDB6TTEgMWgxdjFIMXoiLz48L3N2Zz4=");
|
|
308
|
+
/* Prevent visual glitches where one pixel from the repeating pattern could be seen */
|
|
309
|
+
background-position: center;
|
|
310
|
+
background-size: 110%;
|
|
311
|
+
border: 1px solid white;
|
|
312
|
+
border-radius: 2px;
|
|
313
|
+
box-sizing: border-box;
|
|
314
|
+
display: inline-block;
|
|
315
|
+
height: 1.333ch;
|
|
316
|
+
margin: 0 0.333ch;
|
|
317
|
+
outline: 1px solid rgba(0, 0, 0, 0.5);
|
|
318
|
+
overflow: hidden;
|
|
319
|
+
width: 1.333ch;
|
|
320
|
+
}
|
|
321
|
+
|
|
322
|
+
span.inline-color {
|
|
323
|
+
display: block;
|
|
324
|
+
/* Prevent visual glitches again */
|
|
325
|
+
height: 120%;
|
|
326
|
+
width: 120%;
|
|
327
|
+
}
|
|
296
328
|
`;
|
|
297
329
|
|
|
298
330
|
const getLanguageInfo = elem => {
|
|
@@ -358,6 +390,18 @@ const loadPlugin = async plugin => {
|
|
|
358
390
|
return pluginsLoaded[plugin];
|
|
359
391
|
};
|
|
360
392
|
|
|
393
|
+
const languageAddons = {
|
|
394
|
+
css: [{ key: 'css-extras', type: 'lang' }, { key: 'inline-color', type: 'plugin' }]
|
|
395
|
+
};
|
|
396
|
+
|
|
397
|
+
const loadLanguageAddons = async key => {
|
|
398
|
+
if (!languageAddons[key]) return;
|
|
399
|
+
return Promise.all(languageAddons[key].map(addon => {
|
|
400
|
+
if (addon.type === 'lang') return loadLanguage(addon.key);
|
|
401
|
+
else return loadPlugin(addon.key);
|
|
402
|
+
}));
|
|
403
|
+
};
|
|
404
|
+
|
|
361
405
|
let prismLoaded;
|
|
362
406
|
|
|
363
407
|
const loadPrism = () => {
|
|
@@ -400,6 +444,7 @@ export async function formatCodeElement(elem) {
|
|
|
400
444
|
await loadPrism(); // must be loaded before loading plugins or languages
|
|
401
445
|
await Promise.all([
|
|
402
446
|
loadLanguage(languageInfo.key),
|
|
447
|
+
loadLanguageAddons(languageInfo.key),
|
|
403
448
|
lineNumbers ? loadPlugin('line-numbers') : null
|
|
404
449
|
]);
|
|
405
450
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@brightspace-ui/core",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.30.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",
|