@brightspace-ui/core 3.312.0 → 3.313.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,6 +1,6 @@
1
1
  import '../colors/colors.js';
2
2
  import { css, html, LitElement } from 'lit';
3
- import { cssEscape, getComposedChildren, getComposedParent, isComposedAncestor, isVisible } from '../../helpers/dom.js';
3
+ import { getComposedChildren, getComposedParent, isComposedAncestor, isVisible } from '../../helpers/dom.js';
4
4
  import { getComposedActiveElement } from '../../helpers/focus.js';
5
5
 
6
6
  const BACKDROP_HIDDEN = 'data-d2l-backdrop-hidden';
@@ -103,7 +103,7 @@ class Backdrop extends LitElement {
103
103
 
104
104
  if (this._state === null) {
105
105
  preventBodyScroll(this);
106
- const target = this.parentNode.querySelector(`#${cssEscape(this.forTarget)}`);
106
+ const target = this.parentNode.querySelector(`#${CSS.escape(this.forTarget)}`);
107
107
  // aria-hidden elements cannot have focus, so wait for focus to be within target
108
108
  waitForFocusWithinTarget(target, Date.now() + 200).then(() => {
109
109
  if (!this.shown || this._state !== 'showing') return;
@@ -1,6 +1,4 @@
1
1
 
2
- import { cssEscape } from '../../helpers/dom.js';
3
-
4
2
  const formElements = {
5
3
  button: true,
6
4
  fieldset: true,
@@ -67,7 +65,7 @@ const _tryGetLabelElement = ele => {
67
65
  }
68
66
  if (ele.id) {
69
67
  const rootNode = ele.getRootNode();
70
- return rootNode.querySelector(`label[for="${cssEscape(ele.id)}"]`);
68
+ return rootNode.querySelector(`label[for="${CSS.escape(ele.id)}"]`);
71
69
  }
72
70
  return null;
73
71
  };
@@ -1,4 +1,3 @@
1
- import { cssEscape } from '../../helpers/dom.js';
2
1
  import { SelectionInfo } from './selection-mixin.js';
3
2
 
4
3
  export const SelectionObserverMixin = superclass => class extends superclass {
@@ -103,7 +102,7 @@ export const SelectionObserverMixin = superclass => class extends superclass {
103
102
  }
104
103
 
105
104
  _updateProvider() {
106
- const selectionComponent = this.selectionFor ? this.getRootNode().querySelector(`#${cssEscape(this.selectionFor)}`) : undefined;
105
+ const selectionComponent = this.selectionFor ? this.getRootNode().querySelector(`#${CSS.escape(this.selectionFor)}`) : undefined;
107
106
  if (this._provider === selectionComponent) return;
108
107
 
109
108
  this._disconnectProvider();
@@ -2,7 +2,7 @@ import '../colors/colors.js';
2
2
  import '../icons/icon.js';
3
3
  import './tab-internal.js';
4
4
  import { css, html, LitElement, nothing, unsafeCSS } from 'lit';
5
- import { cssEscape, findComposedAncestor, getOffsetParent, isVisible } from '../../helpers/dom.js';
5
+ import { findComposedAncestor, getOffsetParent, isVisible } from '../../helpers/dom.js';
6
6
  import { getFocusPseudoClass, getFocusRingStyles } from '../../helpers/focus.js';
7
7
  import { ArrowKeysMixin } from '../../mixins/arrow-keys/arrow-keys-mixin.js';
8
8
  import { bodyCompactStyles } from '../typography/styles.js';
@@ -455,7 +455,7 @@ class Tabs extends LocalizeCoreElement(ArrowKeysMixin(SkeletonMixin(LitElement))
455
455
  // remove with GAUD-8299-core-tabs-use-new-structure flag clean up
456
456
  _animateTabAdditionDefaultSlotBehavior(tabInfo) {
457
457
  const tab = this.shadowRoot
458
- && this.shadowRoot.querySelector(`d2l-tab-internal[controls-panel="${cssEscape(tabInfo.id)}"]`);
458
+ && this.shadowRoot.querySelector(`d2l-tab-internal[controls-panel="${CSS.escape(tabInfo.id)}"]`);
459
459
  if (!tab) Promise.resolve();
460
460
 
461
461
  return new Promise((resolve) => {
@@ -487,7 +487,7 @@ class Tabs extends LocalizeCoreElement(ArrowKeysMixin(SkeletonMixin(LitElement))
487
487
  // remove with GAUD-8299-core-tabs-use-new-structure flag clean up
488
488
  _animateTabRemovalDefaultSlotBehavior(tabInfo) {
489
489
  const tab = this.shadowRoot &&
490
- this.shadowRoot.querySelector(`d2l-tab-internal[controls-panel="${cssEscape(tabInfo.id)}"]`);
490
+ this.shadowRoot.querySelector(`d2l-tab-internal[controls-panel="${CSS.escape(tabInfo.id)}"]`);
491
491
  if (!tab) Promise.resolve();
492
492
 
493
493
  return new Promise((resolve) => {
@@ -1,5 +1,5 @@
1
1
  import { css, html, LitElement } from 'lit';
2
- import { cssEscape, elemIdListAdd, elemIdListRemove, isComposedAncestor } from '../../helpers/dom.js';
2
+ import { elemIdListAdd, elemIdListRemove, isComposedAncestor } from '../../helpers/dom.js';
3
3
  import { getComposedActiveElement, isFocusable } from '../../helpers/focus.js';
4
4
  import { interactiveElements, interactiveRoles, isInteractive } from '../../helpers/interactive.js';
5
5
  import { announce } from '../../helpers/announce.js';
@@ -398,7 +398,7 @@ class Tooltip extends PopoverMixin(LitElement) {
398
398
 
399
399
  let target;
400
400
  if (this.for) {
401
- const targetSelector = `#${cssEscape(this.for)}`;
401
+ const targetSelector = `#${CSS.escape(this.for)}`;
402
402
  target = ownerRoot.querySelector(targetSelector);
403
403
  target = (target || ownerRoot?.host?.querySelector(targetSelector)) ?? null;
404
404
  } else {
@@ -1,5 +1,3 @@
1
- import { cssEscape } from '../../helpers/dom.js';
2
-
3
1
  class BaseController {
4
2
  constructor(host, name, options = {}) {
5
3
  if (!host || !name) throw new TypeError('SubscriberController: missing host or subscription name');
@@ -211,7 +209,7 @@ export class IdSubscriberController extends BaseSubscriber {
211
209
  }
212
210
 
213
211
  _updateRegistry(registryId) {
214
- const registryComponent = this._host.getRootNode().querySelector(`#${cssEscape(registryId)}`) || undefined;
212
+ const registryComponent = this._host.getRootNode().querySelector(`#${CSS.escape(registryId)}`) || undefined;
215
213
 
216
214
  if (this._registries.get(registryId) === registryComponent) return registryComponent;
217
215
 
package/helpers/dom.js CHANGED
@@ -1,14 +1,5 @@
1
1
  import { getFlag } from './flags.js';
2
2
 
3
- // needed for legacy-Edge, after it's removed use CSS.escape directly
4
- export function cssEscape(val) {
5
- if (window.CSS && window.CSS.escape) {
6
- return window.CSS.escape(val);
7
- }
8
- val = val.replace(/\$/g, '\\$');
9
- return val;
10
- }
11
-
12
3
  export function elemIdListAdd(elem, attrName, value) {
13
4
 
14
5
  if (elem === undefined || elem === null || !elem.getAttribute || !elem.setAttribute) {
@@ -1,5 +1,4 @@
1
1
 
2
- import { cssEscape } from '../../helpers/dom.js';
3
2
  import { PropertyRequiredMixin } from '../property-required/property-required-mixin.js';
4
3
 
5
4
  const getCommonAncestor = (elem1, elem2) => {
@@ -117,7 +116,7 @@ export const LabelledMixin = superclass => class extends PropertyRequiredMixin(s
117
116
  if (!this.labelledBy) {
118
117
  this._updateLabelElem(null);
119
118
  } else {
120
- const labelElem = await waitForElement(this.getRootNode(), `#${cssEscape(this.labelledBy)}`, 3000);
119
+ const labelElem = await waitForElement(this.getRootNode(), `#${CSS.escape(this.labelledBy)}`, 3000);
121
120
  if (!labelElem) {
122
121
  this._throwError(
123
122
  new Error(`LabelledMixin: "${this.tagName.toLowerCase()}" is labelled-by="${this.labelledBy}", but no such element exists`)
@@ -166,7 +165,7 @@ export const LabelledMixin = superclass => class extends PropertyRequiredMixin(s
166
165
  }
167
166
 
168
167
  this._labelObserver = new MutationObserver(() => {
169
- const newElem = this.getRootNode().querySelector(`#${cssEscape(this.labelledBy)}`);
168
+ const newElem = this.getRootNode().querySelector(`#${CSS.escape(this.labelledBy)}`);
170
169
  if (isCustomElement(newElem)) {
171
170
  requestAnimationFrame(() => {
172
171
  // element often sets its label in its own updated(), so we need to wait
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@brightspace-ui/core",
3
- "version": "3.312.0",
3
+ "version": "3.313.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",