@brightspace-ui/core 3.147.4 → 3.147.5
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.
@@ -14,6 +14,7 @@ import { RtlMixin } from '../../mixins/rtl/rtl-mixin.js';
|
|
14
14
|
import { styleMap } from 'lit/directives/style-map.js';
|
15
15
|
|
16
16
|
const usePopoverMixin = getFlag('GAUD-7355-tooltip-popover', false);
|
17
|
+
const useMutationObserver = getFlag('GAUD-8203-tooltip-mutation-observer', true);
|
17
18
|
|
18
19
|
const contentBorderSize = 1;
|
19
20
|
const contentHorizontalPadding = 15;
|
@@ -192,6 +193,7 @@ if (usePopoverMixin) {
|
|
192
193
|
this.#handleTargetFocusBound = this.#handleTargetFocus.bind(this);
|
193
194
|
this.#handleTargetMouseEnterBound = this.#handleTargetMouseEnter.bind(this);
|
194
195
|
this.#handleTargetMouseLeaveBound = this.#handleTargetMouseLeave.bind(this);
|
196
|
+
this.#handleTargetMutationBound = this.#handleTargetMutation.bind(this);
|
195
197
|
this.#handleTargetResizeBound = this.#handleTargetResize.bind(this);
|
196
198
|
this.#handleTargetTouchEndBound = this.#handleTargetTouchEnd.bind(this);
|
197
199
|
this.#handleTargetTouchStartBound = this.#handleTargetTouchStart.bind(this);
|
@@ -284,6 +286,7 @@ if (usePopoverMixin) {
|
|
284
286
|
#handleTargetFocusBound;
|
285
287
|
#handleTargetMouseEnterBound;
|
286
288
|
#handleTargetMouseLeaveBound;
|
289
|
+
#handleTargetMutationBound;
|
287
290
|
#handleTargetResizeBound;
|
288
291
|
#handleTargetTouchEndBound;
|
289
292
|
#handleTargetTouchStartBound;
|
@@ -299,6 +302,7 @@ if (usePopoverMixin) {
|
|
299
302
|
#showing;
|
300
303
|
#target;
|
301
304
|
#targetSizeObserver;
|
305
|
+
#targetMutationObserver;
|
302
306
|
|
303
307
|
#adaptPositionLocation(val) {
|
304
308
|
switch (val) {
|
@@ -332,6 +336,12 @@ if (usePopoverMixin) {
|
|
332
336
|
|
333
337
|
this.#targetSizeObserver = new ResizeObserver(this.#handleTargetResizeBound);
|
334
338
|
this.#targetSizeObserver.observe(this.#target);
|
339
|
+
|
340
|
+
if (useMutationObserver) {
|
341
|
+
this.#targetMutationObserver = new MutationObserver(this.#handleTargetMutationBound);
|
342
|
+
this.#targetMutationObserver.observe(this.#target, { attributes: true, attributeFilter: ['id'] });
|
343
|
+
this.#targetMutationObserver.observe(this.#target.parentNode, { childList: true });
|
344
|
+
}
|
335
345
|
}
|
336
346
|
|
337
347
|
#findTarget() {
|
@@ -341,7 +351,7 @@ if (usePopoverMixin) {
|
|
341
351
|
if (this.for) {
|
342
352
|
const targetSelector = `#${cssEscape(this.for)}`;
|
343
353
|
target = ownerRoot.querySelector(targetSelector);
|
344
|
-
target = target || ownerRoot?.host?.querySelector(targetSelector);
|
354
|
+
target = (target || ownerRoot?.host?.querySelector(targetSelector)) ?? null;
|
345
355
|
} else {
|
346
356
|
const parentNode = this.parentNode;
|
347
357
|
target = parentNode.nodeType === Node.DOCUMENT_FRAGMENT_NODE ? ownerRoot.host : parentNode;
|
@@ -402,6 +412,13 @@ if (usePopoverMixin) {
|
|
402
412
|
setTimeout(() => this.#updateShowing(), 100); // delay to allow for mouseenter to fire if hovering on tooltip
|
403
413
|
}
|
404
414
|
|
415
|
+
#handleTargetMutation([m]) {
|
416
|
+
if (!this.#target.isConnected || (m.target === this.#target && m.attributeName === 'id')) {
|
417
|
+
this.#targetMutationObserver.disconnect();
|
418
|
+
this._updateTarget();
|
419
|
+
}
|
420
|
+
}
|
421
|
+
|
405
422
|
#handleTargetResize() {
|
406
423
|
this.#resizeRunSinceTruncationCheck = true;
|
407
424
|
if (!this.showing) return;
|
@@ -453,6 +470,11 @@ if (usePopoverMixin) {
|
|
453
470
|
this.#targetSizeObserver.disconnect();
|
454
471
|
this.#targetSizeObserver = null;
|
455
472
|
}
|
473
|
+
|
474
|
+
if (this.#targetMutationObserver) {
|
475
|
+
this.#targetMutationObserver.disconnect();
|
476
|
+
this.#targetMutationObserver = null;
|
477
|
+
}
|
456
478
|
}
|
457
479
|
|
458
480
|
async #showingChanged(newValue, dispatch) {
|
@@ -954,6 +976,7 @@ if (usePopoverMixin) {
|
|
954
976
|
this._onTargetMouseEnter = this._onTargetMouseEnter.bind(this);
|
955
977
|
this._onTargetMouseLeave = this._onTargetMouseLeave.bind(this);
|
956
978
|
this._onTargetResize = this._onTargetResize.bind(this);
|
979
|
+
this._onTargetMutation = this._onTargetMutation.bind(this);
|
957
980
|
this._onTargetClick = this._onTargetClick.bind(this);
|
958
981
|
this._onTargetTouchStart = this._onTargetTouchStart.bind(this);
|
959
982
|
this._onTargetTouchEnd = this._onTargetTouchEnd.bind(this);
|
@@ -1069,13 +1092,12 @@ if (usePopoverMixin) {
|
|
1069
1092
|
willUpdate(changedProperties) {
|
1070
1093
|
super.willUpdate(changedProperties);
|
1071
1094
|
|
1072
|
-
changedProperties.
|
1073
|
-
|
1074
|
-
|
1075
|
-
|
1076
|
-
|
1077
|
-
|
1078
|
-
});
|
1095
|
+
if (changedProperties.has('for')) {
|
1096
|
+
this._updateTarget();
|
1097
|
+
}
|
1098
|
+
if (changedProperties.has('forceShow')) {
|
1099
|
+
this._updateShowing();
|
1100
|
+
}
|
1079
1101
|
}
|
1080
1102
|
|
1081
1103
|
hide() {
|
@@ -1192,6 +1214,12 @@ if (usePopoverMixin) {
|
|
1192
1214
|
|
1193
1215
|
this._targetSizeObserver = new ResizeObserver(this._onTargetResize);
|
1194
1216
|
this._targetSizeObserver.observe(this._target);
|
1217
|
+
|
1218
|
+
if (useMutationObserver) {
|
1219
|
+
this._targetMutationObserver = new MutationObserver(this._onTargetMutation);
|
1220
|
+
this._targetMutationObserver.observe(this._target, { attributes: true, attributeFilter: ['id'] });
|
1221
|
+
this._targetMutationObserver.observe(this._target.parentNode, { childList: true });
|
1222
|
+
}
|
1195
1223
|
}
|
1196
1224
|
|
1197
1225
|
_computeAvailableSpaces(targetRect, spaceAround) {
|
@@ -1260,7 +1288,7 @@ if (usePopoverMixin) {
|
|
1260
1288
|
if (this.for) {
|
1261
1289
|
const targetSelector = `#${cssEscape(this.for)}`;
|
1262
1290
|
target = ownerRoot.querySelector(targetSelector);
|
1263
|
-
target = target || ownerRoot?.host?.querySelector(targetSelector);
|
1291
|
+
target = (target || ownerRoot?.host?.querySelector(targetSelector)) ?? null;
|
1264
1292
|
} else {
|
1265
1293
|
const parentNode = this.parentNode;
|
1266
1294
|
target = parentNode.nodeType === Node.DOCUMENT_FRAGMENT_NODE ? ownerRoot.host : parentNode;
|
@@ -1391,6 +1419,13 @@ if (usePopoverMixin) {
|
|
1391
1419
|
setTimeout(() => this._updateShowing(), 100); // delay to allow for mouseenter to fire if hovering on tooltip
|
1392
1420
|
}
|
1393
1421
|
|
1422
|
+
_onTargetMutation([m]) {
|
1423
|
+
if (!this._target?.isConnected || (m.target === this._target && m.attributeName === 'id')) {
|
1424
|
+
this._targetMutationObserver?.disconnect();
|
1425
|
+
this._updateTarget();
|
1426
|
+
}
|
1427
|
+
}
|
1428
|
+
|
1394
1429
|
_onTargetResize() {
|
1395
1430
|
this._resizeRunSinceTruncationCheck = true;
|
1396
1431
|
if (!this.showing) {
|
@@ -1426,6 +1461,11 @@ if (usePopoverMixin) {
|
|
1426
1461
|
this._targetSizeObserver.disconnect();
|
1427
1462
|
this._targetSizeObserver = null;
|
1428
1463
|
}
|
1464
|
+
|
1465
|
+
if (this._targetMutationObserver) {
|
1466
|
+
this._targetMutationObserver.disconnect();
|
1467
|
+
this._targetMutationObserver = null;
|
1468
|
+
}
|
1429
1469
|
}
|
1430
1470
|
|
1431
1471
|
async _showingChanged(newValue, dispatch) {
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@brightspace-ui/core",
|
3
|
-
"version": "3.147.
|
3
|
+
"version": "3.147.5",
|
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",
|