@brightspace-ui/core 3.237.0 → 3.237.2

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.
@@ -3,10 +3,13 @@ import '../loading-spinner/loading-spinner.js';
3
3
  import '../offscreen/offscreen.js';
4
4
  import { css, html, LitElement, nothing } from 'lit';
5
5
  import { getComposedChildren, getComposedParent } from '../../helpers/dom.js';
6
+ import { getFlag } from '../../helpers/flags.js';
6
7
  import { LocalizeCoreElement } from '../../helpers/localize-core-element.js';
7
8
  import { PropertyRequiredMixin } from '../../mixins/property-required/property-required-mixin.js';
8
9
  import { styleMap } from 'lit/directives/style-map.js';
9
10
 
11
+ const OffSCREEN_SIZELESS = getFlag('d2l-offscreen-sizeless', true);
12
+
10
13
  const BACKDROP_DELAY_MS = 800;
11
14
  const FADE_DURATION_MS = 500;
12
15
  const SPINNER_DELAY_MS = FADE_DURATION_MS;
@@ -101,6 +104,8 @@ class LoadingBackdrop extends PropertyRequiredMixin(LocalizeCoreElement(LitEleme
101
104
  }
102
105
 
103
106
  render() {
107
+ const forcedOffscreenSizelessStyles = OffSCREEN_SIZELESS ? {} : { height: '0px', width: '0px' };
108
+
104
109
  return html`
105
110
  ${this._state === 'hidden' ? nothing :
106
111
  html`<div id="visible">
@@ -108,7 +113,7 @@ class LoadingBackdrop extends PropertyRequiredMixin(LocalizeCoreElement(LitEleme
108
113
  <d2l-loading-spinner style=${styleMap({ top: `${this._spinnerTop}px` })} size="${LOADING_SPINNER_SIZE}"></d2l-loading-spinner>
109
114
  </div>`
110
115
  }
111
- <d2l-offscreen aria-live="polite">${this._ariaContent}</d2l-offscreen>
116
+ <d2l-offscreen style=${styleMap(forcedOffscreenSizelessStyles)} aria-live="polite">${this._ariaContent}</d2l-offscreen>
112
117
  `;
113
118
  }
114
119
  updated(changedProperties) {
@@ -60,7 +60,10 @@ class DemoPageSettings extends LitElement {
60
60
  } else {
61
61
  this._language = getDocumentLocaleSettings().language;
62
62
  }
63
+
63
64
  this._colorMode = document.documentElement.dataset.colorMode || defaultColorMode;
65
+
66
+ this.#updateColorSchemeMeta();
64
67
  }
65
68
 
66
69
  connectedCallback() {
@@ -176,6 +179,8 @@ class DemoPageSettings extends LitElement {
176
179
  this.#updateDefaultColorMode(newColorMode);
177
180
  }
178
181
 
182
+ this.#updateColorSchemeMeta();
183
+
179
184
  url.searchParams.set('color-mode', newColorMode);
180
185
  window.history.replaceState({}, '', url.toString());
181
186
  }
@@ -208,6 +213,18 @@ class DemoPageSettings extends LitElement {
208
213
  }
209
214
  }
210
215
 
216
+ #updateColorSchemeMeta() {
217
+ let elem = document.querySelector('meta[name="color-scheme"]');
218
+ if (!elem) {
219
+ elem = document.createElement('meta');
220
+ elem.name = 'color-scheme';
221
+ document.head.insertBefore(elem, document.head.firstChild);
222
+ }
223
+ if (document.documentElement.dataset.colorMode === 'dark') elem.content = 'dark';
224
+ else if (document.documentElement.dataset.colorMode === 'os') elem.content = 'light dark';
225
+ else elem.content = 'light';
226
+ }
227
+
211
228
  #updateDefaultColorMode(colorMode) {
212
229
  localStorage.setItem('color-mode', colorMode);
213
230
  }
@@ -1,16 +1,19 @@
1
1
  import { css, html, LitElement } from 'lit';
2
+ import { getFlag } from '../../helpers/flags.js';
3
+
4
+ const OffSCREEN_SIZELESS = getFlag('d2l-offscreen-sizeless', true);
2
5
 
3
6
  /**
4
7
  * A private helper declarations that should not be used by general consumers
5
8
  */
6
9
  export const _offscreenStyleDeclarations = css`
7
10
  direction: var(--d2l-document-direction, ${document.dir === 'rtl' ? css`rtl` : css`ltr`}); /* stylelint-disable-line @stylistic/string-quotes */
8
- height: 1px;
11
+ height: ${OffSCREEN_SIZELESS ? 0 : 1}px;
9
12
  inset-inline-start: -10000px;
10
13
  overflow: hidden;
11
14
  position: absolute !important;
12
15
  white-space: nowrap;
13
- width: 1px;
16
+ width: ${OffSCREEN_SIZELESS ? 0 : 1}px;
14
17
  ${document.dir === 'rtl' ? css`right` : css`left`}: -10000px;
15
18
  `;
16
19
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@brightspace-ui/core",
3
- "version": "3.237.0",
3
+ "version": "3.237.2",
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",