@brightspace-ui/core 3.231.0 → 3.232.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.
@@ -1,225 +1,250 @@
1
+ import { svgToCSS } from '../../helpers/svg-to-css.js';
2
+
3
+ const primitiveVariables = new Map([
4
+ // basic grays (lightest to darkest)
5
+ ['--d2l-color-regolith', '#f9fbff'],
6
+ ['--d2l-color-sylvite', '#f1f5fb'],
7
+ ['--d2l-color-gypsum', '#e3e9f1'],
8
+ ['--d2l-color-mica', '#cdd5dc'],
9
+ ['--d2l-color-corundum', '#b1b9be'],
10
+ ['--d2l-color-chromite', '#90989d'],
11
+ ['--d2l-color-galena', '#6e7477'],
12
+ ['--d2l-color-tungsten', '#494c4e'],
13
+ ['--d2l-color-ferrite', '#202122'],
14
+ // zircon
15
+ ['--d2l-color-zircon-plus-2', '#e0feff'],
16
+ ['--d2l-color-zircon-plus-1', '#00d2ed'],
17
+ ['--d2l-color-zircon', '#008eab'],
18
+ ['--d2l-color-zircon-minus-1', '#035670'],
19
+ // celestine
20
+ ['--d2l-color-celestine-plus-2', '#e8f8ff'],
21
+ ['--d2l-color-celestine-plus-1', '#29a6ff'],
22
+ ['--d2l-color-celestine', '#006fbf'],
23
+ ['--d2l-color-celestine-minus-1', '#004489'],
24
+ // amethyst
25
+ ['--d2l-color-amethyst-plus-2', '#f2f0ff'],
26
+ ['--d2l-color-amethyst-plus-1', '#8982ff'],
27
+ ['--d2l-color-amethyst', '#6038ff'],
28
+ ['--d2l-color-amethyst-minus-1', '#4500db'],
29
+ // fluorite
30
+ ['--d2l-color-fluorite-plus-2', '#f9ebff'],
31
+ ['--d2l-color-fluorite-plus-1', '#ce68fa'],
32
+ ['--d2l-color-fluorite', '#9d1fd4'],
33
+ ['--d2l-color-fluorite-minus-1', '#6900a0'],
34
+ // tourmaline
35
+ ['--d2l-color-tourmaline-plus-2', '#ffebf6'],
36
+ ['--d2l-color-tourmaline-plus-1', '#fd4e9d'],
37
+ ['--d2l-color-tourmaline', '#d40067'],
38
+ ['--d2l-color-tourmaline-minus-1', '#990056'],
39
+ // cinnabar
40
+ ['--d2l-color-cinnabar-plus-2', '#ffede8'],
41
+ ['--d2l-color-cinnabar-plus-1', '#ff575a'],
42
+ ['--d2l-color-cinnabar', '#cd2026'],
43
+ ['--d2l-color-cinnabar-minus-1', '#990006'],
44
+ // carnelian
45
+ ['--d2l-color-carnelian-plus-1', '#fff3e0'],
46
+ ['--d2l-color-carnelian', '#e87511'],
47
+ ['--d2l-color-carnelian-minus-1', '#ba4700'],
48
+ ['--d2l-color-carnelian-minus-2', '#7d2600'],
49
+ // citrine
50
+ ['--d2l-color-citrine-plus-1', '#fff9d6'],
51
+ ['--d2l-color-citrine', '#ffba59'],
52
+ ['--d2l-color-citrine-minus-1', '#c47400'],
53
+ ['--d2l-color-citrine-minus-2', '#7a4300'],
54
+ // peridot
55
+ ['--d2l-color-peridot-plus-1', '#efffd9'],
56
+ ['--d2l-color-peridot', '#8ad934'],
57
+ ['--d2l-color-peridot-minus-1', '#4a8f00'],
58
+ ['--d2l-color-peridot-minus-2', '#2f5e00'],
59
+ // olivine
60
+ ['--d2l-color-olivine-plus-1', '#e7ffe3'],
61
+ ['--d2l-color-olivine', '#46a661'],
62
+ ['--d2l-color-olivine-minus-1', '#027a21'],
63
+ ['--d2l-color-olivine-minus-2', '#005614'],
64
+ // malachite
65
+ ['--d2l-color-malachite-plus-1', '#e3fff5'],
66
+ ['--d2l-color-malachite', '#2de2c0'],
67
+ ['--d2l-color-malachite-minus-1', '#00a490'],
68
+ ['--d2l-color-malachite-minus-2', '#00635e']
69
+ ]);
70
+
71
+ // Note: do not use these semantic variables outside of core yet - they are subject to change
72
+ const lightVariables = new Map([
73
+ // figma
74
+ ['--d2l-theme-background-color-base', '#ffffff'],
75
+ ['--d2l-theme-background-color-elevated', '--d2l-theme-background-color-base'],
76
+ ['--d2l-theme-background-color-floating', '--d2l-theme-background-color-base'],
77
+ ['--d2l-theme-background-color-interactive-faint-default', '--d2l-color-regolith'],
78
+ ['--d2l-theme-background-color-interactive-faint-hover', '--d2l-color-sylvite'],
79
+ ['--d2l-theme-background-color-interactive-highlighted', '--d2l-theme-brand-color-highlight'],
80
+ ['--d2l-theme-background-color-interactive-primary-default', '--d2l-theme-brand-color-primary-default'],
81
+ ['--d2l-theme-background-color-interactive-primary-hover', '--d2l-theme-brand-color-primary-hover'],
82
+ ['--d2l-theme-background-color-interactive-secondary-default', '--d2l-color-gypsum'],
83
+ ['--d2l-theme-background-color-interactive-secondary-hover', '--d2l-color-mica'],
84
+ ['--d2l-theme-background-color-interactive-tertiary-default', 'transparent'],
85
+ ['--d2l-theme-background-color-interactive-tertiary-hover', '--d2l-theme-background-color-interactive-secondary-default'],
86
+ ['--d2l-theme-background-color-interactive-translucent-default', '#00000080'],
87
+ ['--d2l-theme-background-color-interactive-translucent-hover', '--d2l-theme-brand-color-primary-default'],
88
+ ['--d2l-theme-background-color-sunken', '#f6f7f8'],
89
+ ['--d2l-theme-border-color-emphasized', '--d2l-color-galena'],
90
+ ['--d2l-theme-border-color-focus', '--d2l-color-celestine'],
91
+ ['--d2l-theme-border-color-standard', '--d2l-color-mica'],
92
+ ['--d2l-theme-border-color-subtle', '--d2l-color-gypsum'],
93
+ ['--d2l-theme-brand-color-highlight', '--d2l-color-celestine-plus-2'],
94
+ ['--d2l-theme-brand-color-primary-default', '--d2l-color-celestine'],
95
+ ['--d2l-theme-brand-color-primary-hover', '--d2l-color-celestine-minus-1'],
96
+ ['--d2l-theme-icon-color-faint', '--d2l-theme-border-color-standard'],
97
+ ['--d2l-theme-icon-color-inverted', '#ffffff'],
98
+ ['--d2l-theme-icon-color-standard', '--d2l-color-tungsten'],
99
+ ['--d2l-theme-shadow-attached-color', '#00000008'],
100
+ ['--d2l-theme-shadow-floating-color', '#00000026'],
101
+ ['--d2l-theme-status-color-default', '--d2l-color-celestine'],
102
+ ['--d2l-theme-status-color-error', '--d2l-color-cinnabar'],
103
+ ['--d2l-theme-status-color-success-text', '--d2l-color-olivine-minus-1'],
104
+ ['--d2l-theme-status-color-success', '--d2l-color-olivine'],
105
+ ['--d2l-theme-status-color-warning-text', '--d2l-color-carnelian-minus-1'],
106
+ ['--d2l-theme-status-color-warning', '--d2l-color-carnelian'],
107
+ ['--d2l-theme-text-color-interactive-default', '--d2l-theme-brand-color-primary-default'],
108
+ ['--d2l-theme-text-color-interactive-hover', '--d2l-theme-brand-color-primary-hover'],
109
+ ['--d2l-theme-text-color-static-faint', '--d2l-color-galena'],
110
+ ['--d2l-theme-text-color-static-inverted', '#ffffff'],
111
+ ['--d2l-theme-text-color-static-standard', '--d2l-color-ferrite'],
112
+ ['--d2l-theme-text-color-static-subtle', '--d2l-color-tungsten'],
113
+ // figma - undefined
114
+ ['--d2l-theme-badge-background-color', '--d2l-color-gypsum'],
115
+ ['--d2l-theme-badge-text-color', '--d2l-theme-text-color-static-standard'],
116
+ ['--d2l-theme-notification-background-color', '--d2l-color-carnelian-minus-1'],
117
+ ['--d2l-theme-notification-text-color', '#ffffff'],
118
+ ['--d2l-theme-text-color-static-disabled', '#20212280'], /* --d2l-theme-text-color-static-standard at 50% opacity, remove once color-mix is widely supported */
119
+ // opacity
120
+ ['--d2l-theme-opacity-disabled-control', '0.5'],
121
+ ['--d2l-theme-opacity-disabled-link', '0.74'],
122
+ ['--d2l-theme-opacity-disabled-linkicon', '0.64'],
123
+ // shadows
124
+ ['--d2l-theme-shadow-attached', '0 2px 4px 0 rgba(0, 0, 0, 0.03)'],
125
+ ['--d2l-theme-shadow-attached-block-start', '0 2px 4px 0 rgba(0, 0, 0, 0.03)'],
126
+ ['--d2l-theme-shadow-attached-block-end', '0 -2px 4px 0 rgba(0, 0, 0, 0.03)'],
127
+ ['--d2l-theme-shadow-floating', '0 2px 12px 0 rgba(0, 0, 0, 0.15)'],
128
+ ['--d2l-theme-shadow-inset', 'inset 0 2px 0 0 rgba(177, 185, 190, 0.2)'], /* corundum */
129
+ // feedback (old semantic names)
130
+ ['--d2l-color-feedback-error', '--d2l-theme-status-color-error'],
131
+ ['--d2l-color-feedback-warning', '--d2l-theme-status-color-warning'],
132
+ ['--d2l-color-feedback-success', '--d2l-theme-status-color-success'],
133
+ ['--d2l-color-feedback-action', '--d2l-theme-status-color-default']
134
+ ]);
135
+
136
+ // Note: do not use these semantic variables outside of core yet - they are subject to change
137
+ const darkVariables = new Map([
138
+ // figma
139
+ ['--d2l-theme-background-color-base', '#161718'],
140
+ ['--d2l-theme-background-color-elevated', '--d2l-color-ferrite'],
141
+ ['--d2l-theme-background-color-floating', '--d2l-color-ferrite'],
142
+ ['--d2l-theme-background-color-interactive-faint-default', '--d2l-color-ferrite'],
143
+ ['--d2l-theme-background-color-interactive-faint-hover', '#303335'],
144
+ ['--d2l-theme-background-color-interactive-highlighted', '--d2l-theme-brand-color-highlight'],
145
+ ['--d2l-theme-background-color-interactive-primary-default', '--d2l-theme-brand-color-primary-default'],
146
+ ['--d2l-theme-background-color-interactive-primary-hover', '--d2l-theme-brand-color-primary-hover'],
147
+ ['--d2l-theme-background-color-interactive-secondary-default', '#303335'],
148
+ ['--d2l-theme-background-color-interactive-secondary-hover', '--d2l-color-ferrite'],
149
+ ['--d2l-theme-background-color-interactive-tertiary-default', 'transparent'],
150
+ ['--d2l-theme-background-color-interactive-tertiary-hover', '--d2l-theme-background-color-interactive-secondary-default'],
151
+ ['--d2l-theme-background-color-interactive-translucent-default', '#00000080'],
152
+ ['--d2l-theme-background-color-interactive-translucent-hover', '--d2l-theme-brand-color-primary-default'],
153
+ ['--d2l-theme-background-color-sunken', '#000000'],
154
+ ['--d2l-theme-border-color-emphasized', '--d2l-color-galena'],
155
+ ['--d2l-theme-border-color-focus', '--d2l-color-celestine-plus-1'],
156
+ ['--d2l-theme-border-color-standard', '--d2l-color-tungsten'],
157
+ ['--d2l-theme-border-color-subtle', '#303335'],
158
+ ['--d2l-theme-brand-color-highlight', '#161718'],
159
+ ['--d2l-theme-brand-color-primary-default', '--d2l-color-celestine-plus-1'],
160
+ ['--d2l-theme-brand-color-primary-hover', '--d2l-color-celestine'],
161
+ ['--d2l-theme-icon-color-faint', '--d2l-theme-border-color-standard'],
162
+ ['--d2l-theme-icon-color-inverted', '#ffffff'],
163
+ ['--d2l-theme-icon-color-standard', '--d2l-color-corundum'],
164
+ ['--d2l-theme-shadow-attached-color', '#000000d9'],
165
+ ['--d2l-theme-shadow-floating-color', '#000000d9'],
166
+ ['--d2l-theme-status-color-default', '--d2l-theme-brand-color-primary-default'],
167
+ ['--d2l-theme-status-color-error', '--d2l-color-cinnabar-plus-1'],
168
+ ['--d2l-theme-status-color-success-text', '#ffffff'],
169
+ ['--d2l-theme-status-color-success', '--d2l-color-olivine'],
170
+ ['--d2l-theme-status-color-warning-text', '--d2l-color-carnelian'],
171
+ ['--d2l-theme-status-color-warning', '--d2l-color-carnelian'],
172
+ ['--d2l-theme-text-color-interactive-default', '--d2l-theme-brand-color-primary-default'],
173
+ ['--d2l-theme-text-color-interactive-hover', '--d2l-theme-brand-color-primary-hover'],
174
+ ['--d2l-theme-text-color-static-faint', '--d2l-color-galena'],
175
+ ['--d2l-theme-text-color-static-inverted', '#161718'],
176
+ ['--d2l-theme-text-color-static-standard', '--d2l-color-mica'],
177
+ ['--d2l-theme-text-color-static-subtle', '--d2l-color-chromite'],
178
+ // figma - undefined
179
+ ['--d2l-theme-badge-background-color', '#303335'],
180
+ ['--d2l-theme-badge-text-color', '--d2l-theme-text-color-static-standard'],
181
+ ['--d2l-theme-notification-background-color', '--d2l-color-carnelian-minus-1'],
182
+ ['--d2l-theme-notification-text-color', '#ffffff'],
183
+ ['--d2l-theme-text-color-static-disabled', '#cdd5dc80'], /* --d2l-theme-text-color-static-standard at 50% opacity, remove once color-mix is widely supported */
184
+ // opacity
185
+ ['--d2l-theme-opacity-disabled-control', '0.5'],
186
+ ['--d2l-theme-opacity-disabled-link', '0.74'],
187
+ ['--d2l-theme-opacity-disabled-linkicon', '0.64'],
188
+ // shadows
189
+ ['--d2l-theme-shadow-attached', '0 2px 4px 0 rgba(0, 0, 0, 0.85)'],
190
+ ['--d2l-theme-shadow-attached-block-start', '0 2px 4px 0 rgba(0, 0, 0, 0.85)'],
191
+ ['--d2l-theme-shadow-attached-block-end', '0 -2px 4px 0 rgba(0, 0, 0, 0.85)'],
192
+ ['--d2l-theme-shadow-floating', '0 2px 12px 0 rgba(0, 0, 0, 0.85)'],
193
+ ['--d2l-theme-shadow-inset', 'inset 0 2px 0 0 rgba(177, 185, 190, 0.2)'], /* corundum */
194
+ // feedback (old semantic names)
195
+ ['--d2l-color-feedback-error', '--d2l-theme-status-color-error'],
196
+ ['--d2l-color-feedback-warning', '--d2l-theme-status-color-warning'],
197
+ ['--d2l-color-feedback-success', '--d2l-theme-status-color-success'],
198
+ ['--d2l-color-feedback-action', '--d2l-theme-status-color-default']
199
+ ]);
200
+
201
+ function formatCSSVariable([key, value]) {
202
+ if (value.startsWith('--')) return `${key}: var(${value});`;
203
+ else return `${key}: ${value};`;
204
+ }
205
+
206
+ function resolvePrimitive(variableName, variables) {
207
+ const value = variables.get(variableName);
208
+ if (!value) return;
209
+
210
+ if (value.startsWith('--d2l-color-')) return resolvePrimitive(value, primitiveVariables);
211
+ else if (value.startsWith('--d2l-theme-')) return resolvePrimitive(value, variables);
212
+ else return value;
213
+ }
214
+
215
+ function replaceSemanticVariables(value, semanticVariables) {
216
+ return value.replace(/var\((--d2l-theme-[^)]+)\)/g, (match, semanticVarName) => {
217
+ return resolvePrimitive(semanticVarName, semanticVariables) ?? match;
218
+ });
219
+ }
220
+
221
+ let style;
1
222
  if (globalThis.document !== undefined && !globalThis.document.head.querySelector('#d2l-colors')) {
2
- const style = globalThis.document.createElement('style');
223
+ style = globalThis.document.createElement('style');
3
224
  style.id = 'd2l-colors';
4
225
 
5
- // Note: do not use these semantic variables outside of core yet - they are subject to change
6
- const lightPalette = `
7
- --d2l-theme-background-color-base: #ffffff;
8
- --d2l-theme-background-color-elevated: var(--d2l-theme-background-color-base);
9
- --d2l-theme-background-color-floating: var(--d2l-theme-background-color-base);
10
- --d2l-theme-background-color-interactive-faint-default: var(--d2l-color-regolith);
11
- --d2l-theme-background-color-interactive-faint-hover: var(--d2l-color-sylvite);
12
- --d2l-theme-background-color-interactive-highlighted: var(--d2l-theme-brand-color-highlight);
13
- --d2l-theme-background-color-interactive-primary-default: var(--d2l-theme-brand-color-primary-default);
14
- --d2l-theme-background-color-interactive-primary-hover: var(--d2l-theme-brand-color-primary-hover);
15
- --d2l-theme-background-color-interactive-secondary-default: var(--d2l-color-gypsum);
16
- --d2l-theme-background-color-interactive-secondary-hover: var(--d2l-color-mica);
17
- --d2l-theme-background-color-interactive-tertiary-default: transparent;
18
- --d2l-theme-background-color-interactive-tertiary-hover: var(--d2l-theme-background-color-interactive-secondary-default);
19
- --d2l-theme-background-color-interactive-translucent-default: #00000080;
20
- --d2l-theme-background-color-interactive-translucent-hover: var(--d2l-theme-brand-color-primary-default);
21
- --d2l-theme-background-color-sunken: #f6f7f8;
22
- --d2l-theme-border-color-emphasized: var(--d2l-color-galena);
23
- --d2l-theme-border-color-focus: var(--d2l-color-celestine);
24
- --d2l-theme-border-color-standard: var(--d2l-color-mica);
25
- --d2l-theme-border-color-subtle: var(--d2l-color-gypsum);
26
- --d2l-theme-brand-color-highlight: var(--d2l-color-celestine-plus-2);
27
- --d2l-theme-brand-color-primary-default: var(--d2l-color-celestine);
28
- --d2l-theme-brand-color-primary-hover: var(--d2l-color-celestine-minus-1);
29
- --d2l-theme-icon-color-faint: var(--d2l-theme-border-color-standard);
30
- --d2l-theme-icon-color-inverted: #ffffff;
31
- --d2l-theme-icon-color-standard: var(--d2l-color-tungsten);
32
- --d2l-theme-shadow-attached-color: #00000008;
33
- --d2l-theme-shadow-floating-color: #00000026;
34
- --d2l-theme-status-color-default: var(--d2l-color-celestine);
35
- --d2l-theme-status-color-error: var(--d2l-color-cinnabar);
36
- --d2l-theme-status-color-success-text: var(--d2l-color-olivine-minus-1);
37
- --d2l-theme-status-color-success: var(--d2l-color-olivine);
38
- --d2l-theme-status-color-warning-text: var(--d2l-color-carnelian-minus-1);
39
- --d2l-theme-status-color-warning: var(--d2l-color-carnelian);
40
- --d2l-theme-text-color-interactive-default: var(--d2l-theme-brand-color-primary-default);
41
- --d2l-theme-text-color-interactive-hover: var(--d2l-theme-brand-color-primary-hover);
42
- --d2l-theme-text-color-static-faint: var(--d2l-color-galena);
43
- --d2l-theme-text-color-static-inverted: #ffffff;
44
- --d2l-theme-text-color-static-standard: var(--d2l-color-ferrite);
45
- --d2l-theme-text-color-static-subtle: var(--d2l-color-tungsten);
46
-
47
- --d2l-theme-badge-background-color: var(--d2l-color-gypsum);
48
- --d2l-theme-badge-text-color: var(--d2l-theme-text-color-static-standard);
49
- --d2l-theme-notification-background-color: var(--d2l-color-carnelian-minus-1);
50
- --d2l-theme-notification-text-color: #ffffff;
51
- --d2l-theme-text-color-static-disabled: #20212280; /* --d2l-theme-text-color-static-standard at 50% opacity, remove once color-mix is widely supported */
52
-
53
- --d2l-theme-opacity-disabled-control: 0.5;
54
- --d2l-theme-opacity-disabled-link: 0.74;
55
- --d2l-theme-opacity-disabled-linkicon: 0.64;
56
-
57
- --d2l-theme-shadow-attached: 0 2px 4px 0 rgba(0, 0, 0, 0.03);
58
- --d2l-theme-shadow-attached-block-start: 0 2px 4px 0 rgba(0, 0, 0, 0.03);
59
- --d2l-theme-shadow-attached-block-end: 0 -2px 4px 0 rgba(0, 0, 0, 0.03);
60
- --d2l-theme-shadow-floating: 0 2px 12px 0 rgba(0, 0, 0, 0.15);
61
- --d2l-theme-shadow-inset: inset 0 2px 0 0 rgba(177, 185, 190, 0.2); /* corundum */
62
- `;
63
-
64
- // Note: do not use these semantic variables outside of core yet - they are subject to change
65
- const darkPalette = `
66
- --d2l-theme-background-color-base: #161718;
67
- --d2l-theme-background-color-elevated: var(--d2l-color-ferrite);
68
- --d2l-theme-background-color-floating: var(--d2l-color-ferrite);
69
- --d2l-theme-background-color-interactive-faint-default: var(--d2l-color-ferrite);
70
- --d2l-theme-background-color-interactive-faint-hover: #303335;
71
- --d2l-theme-background-color-interactive-highlighted: var(--d2l-theme-brand-color-highlight);
72
- --d2l-theme-background-color-interactive-primary-default: var(--d2l-theme-brand-color-primary-default);
73
- --d2l-theme-background-color-interactive-primary-hover: var(--d2l-theme-brand-color-primary-hover);
74
- --d2l-theme-background-color-interactive-secondary-default: #303335;
75
- --d2l-theme-background-color-interactive-secondary-hover: var(--d2l-color-ferrite);
76
- --d2l-theme-background-color-interactive-tertiary-default: transparent;
77
- --d2l-theme-background-color-interactive-tertiary-hover: var(--d2l-theme-background-color-interactive-secondary-default);
78
- --d2l-theme-background-color-interactive-translucent-default: #00000080;
79
- --d2l-theme-background-color-interactive-translucent-hover: var(--d2l-theme-brand-color-primary-default);
80
- --d2l-theme-background-color-sunken: #000000;
81
- --d2l-theme-border-color-emphasized: var(--d2l-color-galena);
82
- --d2l-theme-border-color-focus: var(--d2l-color-celestine-plus-1);
83
- --d2l-theme-border-color-standard: var(--d2l-color-tungsten);
84
- --d2l-theme-border-color-subtle: #303335;
85
- --d2l-theme-brand-color-highlight: #161718;
86
- --d2l-theme-brand-color-primary-default: var(--d2l-color-celestine-plus-1);
87
- --d2l-theme-brand-color-primary-hover: var(--d2l-color-celestine);
88
- --d2l-theme-icon-color-faint: var(--d2l-theme-border-color-standard);
89
- --d2l-theme-icon-color-inverted: #ffffff;
90
- --d2l-theme-icon-color-standard: var(--d2l-color-corundum);
91
- --d2l-theme-shadow-attached-color: #000000d9;
92
- --d2l-theme-shadow-floating-color: #000000d9;
93
- --d2l-theme-status-color-default: var(--d2l-theme-brand-color-primary-default);
94
- --d2l-theme-status-color-error: var(--d2l-color-cinnabar-plus-1);
95
- --d2l-theme-status-color-success-text: #ffffff;
96
- --d2l-theme-status-color-success: var(--d2l-color-olivine);
97
- --d2l-theme-status-color-warning-text: var(--d2l-color-carnelian);
98
- --d2l-theme-status-color-warning: var(--d2l-color-carnelian);
99
- --d2l-theme-text-color-interactive-default: var(--d2l-theme-brand-color-primary-default);
100
- --d2l-theme-text-color-interactive-hover: var(--d2l-theme-brand-color-primary-hover);
101
- --d2l-theme-text-color-static-faint: var(--d2l-color-galena);
102
- --d2l-theme-text-color-static-inverted: #161718;
103
- --d2l-theme-text-color-static-standard: var(--d2l-color-mica);
104
- --d2l-theme-text-color-static-subtle: var(--d2l-color-chromite);
105
-
106
- --d2l-theme-badge-background-color: #303335;
107
- --d2l-theme-badge-text-color: var(--d2l-theme-text-color-static-standard);
108
- --d2l-theme-notification-background-color: var(--d2l-color-carnelian-minus-1);
109
- --d2l-theme-notification-text-color: #ffffff;
110
- --d2l-theme-text-color-static-disabled: #cdd5dc80; /* --d2l-theme-text-color-static-standard at 50% opacity, remove once color-mix is widely supported */
111
-
112
- --d2l-theme-opacity-disabled-control: 0.5;
113
- --d2l-theme-opacity-disabled-link: 0.74;
114
- --d2l-theme-opacity-disabled-linkicon: 0.64;
115
-
116
- --d2l-theme-shadow-attached: 0 2px 4px 0 rgba(0, 0, 0, 0.85);
117
- --d2l-theme-shadow-attached-block-start: 0 2px 4px 0 rgba(0, 0, 0, 0.85);
118
- --d2l-theme-shadow-attached-block-end: 0 -2px 4px 0 rgba(0, 0, 0, 0.85);
119
- --d2l-theme-shadow-floating: 0 2px 12px 0 rgba(0, 0, 0, 0.85);
120
- --d2l-theme-shadow-inset: inset 0 2px 0 0 rgba(177, 185, 190, 0.2); /* corundum */
121
- `;
226
+ const primitiveCSS = [...primitiveVariables.entries()].map(formatCSSVariable).join('\n');
227
+ const lightCSS = [...lightVariables.entries()].map(formatCSSVariable).join('\n');
228
+ const darkCSS = [...darkVariables.entries()].map(formatCSSVariable).join('\n');
122
229
 
123
230
  style.textContent = `
124
231
  html {
125
- /* basic grays (lightest to darkest) */
126
- --d2l-color-regolith: #f9fbff;
127
- --d2l-color-sylvite: #f1f5fb;
128
- --d2l-color-gypsum: #e3e9f1;
129
- --d2l-color-mica: #cdd5dc;
130
- --d2l-color-corundum: #b1b9be;
131
- --d2l-color-chromite: #90989d;
132
- --d2l-color-galena: #6e7477;
133
- --d2l-color-tungsten: #494c4e;
134
- --d2l-color-ferrite: #202122;
135
-
136
- /* zircon */
137
- --d2l-color-zircon-plus-2: #e0feff;
138
- --d2l-color-zircon-plus-1: #00d2ed;
139
- --d2l-color-zircon: #008eab;
140
- --d2l-color-zircon-minus-1: #035670;
141
-
142
- /* celestine */
143
- --d2l-color-celestine-plus-2: #e8f8ff;
144
- --d2l-color-celestine-plus-1: #29a6ff;
145
- --d2l-color-celestine: #006fbf;
146
- --d2l-color-celestine-minus-1: #004489;
147
-
148
- /* amethyst */
149
- --d2l-color-amethyst-plus-2: #f2f0ff;
150
- --d2l-color-amethyst-plus-1: #8982ff;
151
- --d2l-color-amethyst: #6038ff;
152
- --d2l-color-amethyst-minus-1: #4500db;
153
-
154
- /* fluorite */
155
- --d2l-color-fluorite-plus-2: #f9ebff;
156
- --d2l-color-fluorite-plus-1: #ce68fa;
157
- --d2l-color-fluorite: #9d1fd4;
158
- --d2l-color-fluorite-minus-1: #6900a0;
159
-
160
- /* tourmaline */
161
- --d2l-color-tourmaline-plus-2: #ffebf6;
162
- --d2l-color-tourmaline-plus-1: #fd4e9d;
163
- --d2l-color-tourmaline: #d40067;
164
- --d2l-color-tourmaline-minus-1: #990056;
165
-
166
- /* cinnabar */
167
- --d2l-color-cinnabar-plus-2: #ffede8;
168
- --d2l-color-cinnabar-plus-1: #ff575a;
169
- --d2l-color-cinnabar: #cd2026;
170
- --d2l-color-cinnabar-minus-1: #990006;
171
-
172
- /* carnelian */
173
- --d2l-color-carnelian-plus-1: #fff3e0;
174
- --d2l-color-carnelian: #e87511;
175
- --d2l-color-carnelian-minus-1: #ba4700;
176
- --d2l-color-carnelian-minus-2: #7d2600;
177
-
178
- /* citrine */
179
- --d2l-color-citrine-plus-1: #fff9d6;
180
- --d2l-color-citrine: #ffba59;
181
- --d2l-color-citrine-minus-1: #c47400;
182
- --d2l-color-citrine-minus-2: #7a4300;
183
-
184
- /* peridot */
185
- --d2l-color-peridot-plus-1: #efffd9;
186
- --d2l-color-peridot: #8ad934;
187
- --d2l-color-peridot-minus-1: #4a8f00;
188
- --d2l-color-peridot-minus-2: #2f5e00;
189
-
190
- /* olivine */
191
- --d2l-color-olivine-plus-1: #e7ffe3;
192
- --d2l-color-olivine: #46a661;
193
- --d2l-color-olivine-minus-1: #027a21;
194
- --d2l-color-olivine-minus-2: #005614;
195
-
196
- /* malachite */
197
- --d2l-color-malachite-plus-1: #e3fff5;
198
- --d2l-color-malachite: #2de2c0;
199
- --d2l-color-malachite-minus-1: #00a490;
200
- --d2l-color-malachite-minus-2: #00635e;
232
+ ${ primitiveCSS }
201
233
 
202
234
  /* primary accent */
203
235
  --d2l-color-primary-accent-action: var(--d2l-color-celestine);
204
236
  --d2l-color-primary-accent-indicator: var(--d2l-color-carnelian);
205
-
206
- /* feedback */
207
- --d2l-color-feedback-error: var(--d2l-color-cinnabar);
208
- --d2l-color-feedback-warning: var(--d2l-color-carnelian);
209
- --d2l-color-feedback-success: var(--d2l-color-olivine);
210
- --d2l-color-feedback-action: var(--d2l-color-celestine);
211
237
  }
212
238
 
213
- /* semantic palette */
214
239
  html {
215
- ${lightPalette}
240
+ ${lightCSS}
216
241
  }
217
242
  html[data-color-mode="dark"] {
218
- ${darkPalette}
243
+ ${darkCSS}
219
244
  }
220
245
  @media (prefers-color-scheme: dark) {
221
246
  html[data-color-mode="os"] {
222
- ${darkPalette}
247
+ ${darkCSS}
223
248
  }
224
249
  }
225
250
 
@@ -229,3 +254,18 @@ if (globalThis.document !== undefined && !globalThis.document.head.querySelector
229
254
  `;
230
255
  globalThis.document.head.appendChild(style);
231
256
  }
257
+
258
+ export function registerSemanticVariableForSvgImageUrl(name, value) {
259
+ if (!name || typeof value !== 'string') {
260
+ throw new TypeError('registerSemanticVariableForSvgImageUrl requires both a name and value');
261
+ }
262
+
263
+ const replacedLightValue = svgToCSS(replaceSemanticVariables(value, lightVariables));
264
+ style.sheet.insertRule(`html { ${ name }: ${ replacedLightValue } }`, 0);
265
+
266
+ const replacedDarkValue = svgToCSS(replaceSemanticVariables(value, darkVariables));
267
+ style.sheet.insertRule(`html[data-color-mode="dark"] { ${ name }: ${ replacedDarkValue } }`, 1);
268
+ style.sheet.insertRule(`@media (prefers-color-scheme: dark) {
269
+ html[data-color-mode="os"] { ${ name }: ${ replacedDarkValue } }
270
+ }`, 2);
271
+ };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@brightspace-ui/core",
3
- "version": "3.231.0",
3
+ "version": "3.232.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",