@smilodon/core 1.11.1 → 1.13.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/README.md +55 -1
- package/dist/index.cjs +333 -23
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +333 -23
- package/dist/index.js.map +1 -1
- package/dist/index.min.js +1 -1
- package/dist/index.min.js.map +1 -1
- package/dist/index.umd.js +333 -23
- package/dist/index.umd.js.map +1 -1
- package/dist/index.umd.min.js +1 -1
- package/dist/index.umd.min.js.map +1 -1
- package/dist/types/src/components/enhanced-select.d.ts +22 -0
- package/dist/types/src/config/global-config.d.ts +5 -1
- package/package.json +1 -1
package/dist/index.umd.js
CHANGED
|
@@ -2127,8 +2127,10 @@
|
|
|
2127
2127
|
busyBucket: {
|
|
2128
2128
|
enabled: true,
|
|
2129
2129
|
showSpinner: true,
|
|
2130
|
+
showMessage: true,
|
|
2130
2131
|
message: 'Loading...',
|
|
2131
2132
|
minDisplayTime: 200,
|
|
2133
|
+
contentMode: 'append',
|
|
2132
2134
|
},
|
|
2133
2135
|
styles: {
|
|
2134
2136
|
classNames: {},
|
|
@@ -4047,6 +4049,10 @@
|
|
|
4047
4049
|
super();
|
|
4048
4050
|
this._dataLoadingConfig = { ...LEGACY_DATA_LOADING_CONFIG };
|
|
4049
4051
|
this._hasLastInvalidDataLoadingCandidate = false;
|
|
4052
|
+
this._busyPresentationVisible = false;
|
|
4053
|
+
this._busyPresentationStartedAt = null;
|
|
4054
|
+
this._busyPresentationGeneration = 0;
|
|
4055
|
+
this._busyPresentationHideTimer = null;
|
|
4050
4056
|
this._engine = new SelectEngineBridge();
|
|
4051
4057
|
this._virtualizationScope = {
|
|
4052
4058
|
dataKeys: [],
|
|
@@ -4141,6 +4147,22 @@
|
|
|
4141
4147
|
this._renderCycleWaiterTimeouts = new Map();
|
|
4142
4148
|
this._suppressNextOpenClick = false;
|
|
4143
4149
|
this._resolvedDropdownPlacement = 'bottom';
|
|
4150
|
+
// Presentation only: the popup engine is already closed while the exit runs.
|
|
4151
|
+
this._dropdownExitTimer = null;
|
|
4152
|
+
this._onDropdownExitAnimationEnd = (event) => {
|
|
4153
|
+
if (event.target !== this._dropdown || this._state.isOpen)
|
|
4154
|
+
return;
|
|
4155
|
+
if (this._dropdown.getAttribute('data-motion') !== 'closing')
|
|
4156
|
+
return;
|
|
4157
|
+
// A composite consumer animation must finish all timelines, not just the first.
|
|
4158
|
+
const names = getComputedStyle(this._dropdown).animationName
|
|
4159
|
+
.split(',').map((name) => name.trim()).filter((name) => name && name !== 'none');
|
|
4160
|
+
if (names.length > 1)
|
|
4161
|
+
return; // bounded timeout waits for the longest timeline
|
|
4162
|
+
if (event.animationName && names[0] && event.animationName !== names[0])
|
|
4163
|
+
return;
|
|
4164
|
+
this._finishDropdownExit();
|
|
4165
|
+
};
|
|
4144
4166
|
this._multiScrollDrag = {
|
|
4145
4167
|
active: false,
|
|
4146
4168
|
moved: false,
|
|
@@ -4294,6 +4316,7 @@
|
|
|
4294
4316
|
this._syncListboxAccessibility();
|
|
4295
4317
|
}
|
|
4296
4318
|
disconnectedCallback() {
|
|
4319
|
+
this._cancelBusyPresentation();
|
|
4297
4320
|
if (this._dataRequestCoordinator) {
|
|
4298
4321
|
const actions = this._dataRequestCoordinator.disconnect();
|
|
4299
4322
|
this._acknowledgedReady = false;
|
|
@@ -4302,6 +4325,11 @@
|
|
|
4302
4325
|
this._state.isSearching = false;
|
|
4303
4326
|
this._state.preserveScrollPosition = false;
|
|
4304
4327
|
}
|
|
4328
|
+
// A disconnected popup must not retain a visual exit or a live timer.
|
|
4329
|
+
this._cancelDropdownExit();
|
|
4330
|
+
this._dropdown.style.display = 'none';
|
|
4331
|
+
this._dropdown.setAttribute('inert', '');
|
|
4332
|
+
this._dropdown.setAttribute('aria-hidden', 'true');
|
|
4305
4333
|
// unregister instance
|
|
4306
4334
|
EnhancedSelect._instances.delete(this);
|
|
4307
4335
|
if (this._state.isOpen) {
|
|
@@ -5655,6 +5683,12 @@
|
|
|
5655
5683
|
--select-dropdown-top: calc(100% + 6px);
|
|
5656
5684
|
--select-dropdown-bottom: calc(100% + 6px);
|
|
5657
5685
|
--select-dropdown-animation: dropdownEnter 200ms cubic-bezier(0.4, 0, 0.2, 1) forwards;
|
|
5686
|
+
--select-dropdown-exit-animation: dropdownExit 160ms cubic-bezier(0.4, 0, 1, 1) forwards;
|
|
5687
|
+
--select-dropdown-exit-from-opacity: 1;
|
|
5688
|
+
--select-dropdown-exit-from-transform: translateY(0) scale(1);
|
|
5689
|
+
--select-dropdown-exit-to-opacity: 0;
|
|
5690
|
+
--select-dropdown-exit-to-transform: translateY(-8px) scale(0.98);
|
|
5691
|
+
--select-dropdown-top-exit-to-transform: translateY(8px) scale(0.98);
|
|
5658
5692
|
--select-dropdown-enter-from-opacity: 0;
|
|
5659
5693
|
--select-dropdown-enter-from-transform: translateY(-8px) scale(0.98);
|
|
5660
5694
|
--select-dropdown-enter-to-opacity: 1;
|
|
@@ -6357,8 +6391,26 @@
|
|
|
6357
6391
|
|
|
6358
6392
|
.select-dropdown[data-placement="top"] {
|
|
6359
6393
|
--select-dropdown-enter-from-transform: var(--select-dropdown-top-enter-from-transform, translateY(8px) scale(0.98));
|
|
6394
|
+
--select-dropdown-exit-to-transform: var(--select-dropdown-top-exit-to-transform, translateY(8px) scale(0.98));
|
|
6360
6395
|
}
|
|
6361
|
-
|
|
6396
|
+
|
|
6397
|
+
/* A closed popup stays visually mounted for exit, but cannot be interacted with. */
|
|
6398
|
+
.select-dropdown[data-motion="closing"] {
|
|
6399
|
+
animation: var(--select-dropdown-exit-animation);
|
|
6400
|
+
pointer-events: none;
|
|
6401
|
+
}
|
|
6402
|
+
|
|
6403
|
+
@keyframes dropdownExit {
|
|
6404
|
+
from {
|
|
6405
|
+
opacity: var(--select-dropdown-exit-from-opacity);
|
|
6406
|
+
transform: var(--select-dropdown-exit-from-transform);
|
|
6407
|
+
}
|
|
6408
|
+
to {
|
|
6409
|
+
opacity: var(--select-dropdown-exit-to-opacity);
|
|
6410
|
+
transform: var(--select-dropdown-exit-to-transform);
|
|
6411
|
+
}
|
|
6412
|
+
}
|
|
6413
|
+
|
|
6362
6414
|
@keyframes dropdownEnter {
|
|
6363
6415
|
0% {
|
|
6364
6416
|
opacity: var(--select-dropdown-enter-from-opacity);
|
|
@@ -6607,12 +6659,40 @@
|
|
|
6607
6659
|
}
|
|
6608
6660
|
|
|
6609
6661
|
.busy-bucket {
|
|
6662
|
+
display: flex;
|
|
6663
|
+
flex-direction: column;
|
|
6664
|
+
align-items: center;
|
|
6665
|
+
justify-content: center;
|
|
6666
|
+
gap: var(--select-busy-gap, 8px);
|
|
6610
6667
|
padding: var(--select-busy-padding, 20px);
|
|
6611
6668
|
text-align: center;
|
|
6612
6669
|
color: var(--select-busy-color, var(--select-text-muted));
|
|
6613
6670
|
background: var(--select-busy-bg, transparent);
|
|
6614
6671
|
font-size: var(--select-busy-font-size, 0.8667em);
|
|
6615
6672
|
}
|
|
6673
|
+
|
|
6674
|
+
.busy-icon {
|
|
6675
|
+
display: flex;
|
|
6676
|
+
align-items: center;
|
|
6677
|
+
justify-content: center;
|
|
6678
|
+
}
|
|
6679
|
+
|
|
6680
|
+
.busy-icon[hidden] {
|
|
6681
|
+
display: none;
|
|
6682
|
+
}
|
|
6683
|
+
|
|
6684
|
+
.busy-message {
|
|
6685
|
+
text-align: center;
|
|
6686
|
+
}
|
|
6687
|
+
|
|
6688
|
+
.busy-content[hidden] {
|
|
6689
|
+
display: none;
|
|
6690
|
+
}
|
|
6691
|
+
|
|
6692
|
+
.busy-bucket--replace .busy-icon,
|
|
6693
|
+
.busy-bucket--replace .busy-message {
|
|
6694
|
+
display: none;
|
|
6695
|
+
}
|
|
6616
6696
|
|
|
6617
6697
|
.spinner {
|
|
6618
6698
|
display: inline-block;
|
|
@@ -7364,6 +7444,10 @@
|
|
|
7364
7444
|
if (!effects.some((effect) => effect.type === 'POPUP_OPENED'))
|
|
7365
7445
|
return;
|
|
7366
7446
|
this._runEngineEffects(effects);
|
|
7447
|
+
// Reopening during exit cancels the old finish callback and restores interactivity.
|
|
7448
|
+
this._cancelDropdownExit();
|
|
7449
|
+
this._dropdown.removeAttribute('inert');
|
|
7450
|
+
this._dropdown.removeAttribute('aria-hidden');
|
|
7367
7451
|
this._markOpenStart();
|
|
7368
7452
|
this.setAttribute('data-open', 'true');
|
|
7369
7453
|
this._liftStackingAncestors();
|
|
@@ -7400,14 +7484,78 @@
|
|
|
7400
7484
|
return;
|
|
7401
7485
|
this.removeAttribute('data-open');
|
|
7402
7486
|
this._restoreLiftedAncestors();
|
|
7403
|
-
this._dropdown.style.display = 'none';
|
|
7404
7487
|
this._dropdown.setAttribute('data-placement', this._resolvedDropdownPlacement);
|
|
7405
7488
|
this._updateArrowRotation();
|
|
7489
|
+
// Engine + ARIA close immediately. Only the visual panel waits for exit.
|
|
7406
7490
|
this._runEngineEffects(effects);
|
|
7491
|
+
this._beginDropdownExit(reason === 'disconnect' || !this.isConnected);
|
|
7407
7492
|
this._emit('close', {});
|
|
7408
7493
|
this._config.callbacks.onClose?.();
|
|
7409
7494
|
this._announce('Options collapsed');
|
|
7410
7495
|
}
|
|
7496
|
+
/** Stop an outstanding exit before reopening, disconnecting or starting another one. */
|
|
7497
|
+
_cancelDropdownExit() {
|
|
7498
|
+
if (this._dropdownExitTimer !== null) {
|
|
7499
|
+
window.clearTimeout(this._dropdownExitTimer);
|
|
7500
|
+
this._dropdownExitTimer = null;
|
|
7501
|
+
}
|
|
7502
|
+
this._dropdown.removeEventListener('animationend', this._onDropdownExitAnimationEnd);
|
|
7503
|
+
this._dropdown.removeAttribute('data-motion');
|
|
7504
|
+
}
|
|
7505
|
+
_finishDropdownExit() {
|
|
7506
|
+
if (this._state.isOpen || this._dropdown.getAttribute('data-motion') !== 'closing')
|
|
7507
|
+
return;
|
|
7508
|
+
this._cancelDropdownExit();
|
|
7509
|
+
this._dropdown.style.display = 'none';
|
|
7510
|
+
}
|
|
7511
|
+
_beginDropdownExit(immediate) {
|
|
7512
|
+
this._cancelDropdownExit();
|
|
7513
|
+
// Inert + aria-hidden apply at logical close, not at animation completion.
|
|
7514
|
+
this._dropdown.setAttribute('inert', '');
|
|
7515
|
+
this._dropdown.setAttribute('aria-hidden', 'true');
|
|
7516
|
+
if (immediate || this._dropdown.style.display === 'none') {
|
|
7517
|
+
this._dropdown.style.display = 'none';
|
|
7518
|
+
return;
|
|
7519
|
+
}
|
|
7520
|
+
this._dropdown.setAttribute('data-motion', 'closing');
|
|
7521
|
+
const duration = this._getDropdownExitDurationMs();
|
|
7522
|
+
if (duration <= 0) {
|
|
7523
|
+
this._finishDropdownExit();
|
|
7524
|
+
return;
|
|
7525
|
+
}
|
|
7526
|
+
// animationend optimizes normal completion; timeout handles missing/cancelled events.
|
|
7527
|
+
this._dropdown.addEventListener('animationend', this._onDropdownExitAnimationEnd);
|
|
7528
|
+
this._dropdownExitTimer = window.setTimeout(() => this._finishDropdownExit(), duration + 34);
|
|
7529
|
+
}
|
|
7530
|
+
/** CSS animations may be disabled or customized by consumers; never wait forever. */
|
|
7531
|
+
_getDropdownExitDurationMs() {
|
|
7532
|
+
if (window.matchMedia?.('(prefers-reduced-motion: reduce)').matches)
|
|
7533
|
+
return 0;
|
|
7534
|
+
const style = getComputedStyle(this._dropdown);
|
|
7535
|
+
const names = style.animationName.split(',').map((value) => value.trim());
|
|
7536
|
+
if (!names.length || names.every((name) => !name || name === 'none'))
|
|
7537
|
+
return 0;
|
|
7538
|
+
const toMs = (value) => {
|
|
7539
|
+
const trimmed = value.trim();
|
|
7540
|
+
const parsed = Number.parseFloat(trimmed);
|
|
7541
|
+
if (!Number.isFinite(parsed))
|
|
7542
|
+
return 0;
|
|
7543
|
+
return trimmed.endsWith('ms') ? parsed : trimmed.endsWith('s') ? parsed * 1000 : 0;
|
|
7544
|
+
};
|
|
7545
|
+
const durations = style.animationDuration.split(',');
|
|
7546
|
+
const delays = style.animationDelay.split(',');
|
|
7547
|
+
const counts = style.animationIterationCount.split(',');
|
|
7548
|
+
const maximum = names.reduce((max, name, index) => {
|
|
7549
|
+
if (!name || name === 'none')
|
|
7550
|
+
return max;
|
|
7551
|
+
const duration = toMs(durations[index % durations.length] ?? '0s');
|
|
7552
|
+
const delay = toMs(delays[index % delays.length] ?? '0s');
|
|
7553
|
+
const count = Number.parseFloat(counts[index % counts.length] ?? '1');
|
|
7554
|
+
const iterations = Number.isFinite(count) ? Math.max(0, count) : 1;
|
|
7555
|
+
return Math.max(max, Math.max(0, duration * iterations + delay));
|
|
7556
|
+
}, 0);
|
|
7557
|
+
return Math.min(maximum, 10000);
|
|
7558
|
+
}
|
|
7411
7559
|
_updateDropdownVisibility() {
|
|
7412
7560
|
if (this._state.isOpen) {
|
|
7413
7561
|
this.setAttribute('data-open', 'true');
|
|
@@ -8283,6 +8431,8 @@
|
|
|
8283
8431
|
}
|
|
8284
8432
|
}
|
|
8285
8433
|
_setBusy(busy) {
|
|
8434
|
+
if (busy)
|
|
8435
|
+
this._beginBusyPresentation();
|
|
8286
8436
|
this._state.isBusy = busy;
|
|
8287
8437
|
this._syncListboxAccessibility();
|
|
8288
8438
|
// Trigger re-render to show/hide busy indicator
|
|
@@ -9463,6 +9613,7 @@
|
|
|
9463
9613
|
_dispatchAcknowledgedActions(actions) {
|
|
9464
9614
|
for (const action of actions) {
|
|
9465
9615
|
if (action.type === 'cancel') {
|
|
9616
|
+
this._cancelBusyPresentation();
|
|
9466
9617
|
this._dispatchAcknowledgedEvent('dataRequestCancel', action.notification);
|
|
9467
9618
|
try {
|
|
9468
9619
|
this._dataRequestCancelCallback?.(action.notification);
|
|
@@ -9487,6 +9638,7 @@
|
|
|
9487
9638
|
this._state.preserveScrollPosition = false;
|
|
9488
9639
|
this._state.isSearching = true;
|
|
9489
9640
|
}
|
|
9641
|
+
this._beginBusyPresentation();
|
|
9490
9642
|
this._state.isBusy = true;
|
|
9491
9643
|
this._acknowledgedLastRequest = request;
|
|
9492
9644
|
this._syncListboxAccessibility();
|
|
@@ -9614,7 +9766,10 @@
|
|
|
9614
9766
|
throw new Error('Acknowledged snapshot render was superseded before completion');
|
|
9615
9767
|
this._state.isBusy = snapshot.busy;
|
|
9616
9768
|
if (!snapshot.busy) {
|
|
9617
|
-
this.
|
|
9769
|
+
this._syncBusyPresentation();
|
|
9770
|
+
if (!this._busyPresentationVisible) {
|
|
9771
|
+
this._optionsContainer.querySelector('.busy-bucket')?.remove();
|
|
9772
|
+
}
|
|
9618
9773
|
if (this._shouldRenderLoadMoreTrigger())
|
|
9619
9774
|
this._addLoadMoreTrigger();
|
|
9620
9775
|
}
|
|
@@ -9932,7 +10087,166 @@
|
|
|
9932
10087
|
_refreshVirtualizationScope(filteredIndices) {
|
|
9933
10088
|
this._virtualizationScope = this._deriveVirtualizationScope(filteredIndices);
|
|
9934
10089
|
}
|
|
10090
|
+
_clearBusyPresentationHideTimer() {
|
|
10091
|
+
if (this._busyPresentationHideTimer === null)
|
|
10092
|
+
return;
|
|
10093
|
+
window.clearTimeout(this._busyPresentationHideTimer);
|
|
10094
|
+
this._lifecycleTimers.delete(this._busyPresentationHideTimer);
|
|
10095
|
+
this._busyPresentationHideTimer = null;
|
|
10096
|
+
}
|
|
10097
|
+
_beginBusyPresentation() {
|
|
10098
|
+
this._busyPresentationGeneration += 1;
|
|
10099
|
+
this._clearBusyPresentationHideTimer();
|
|
10100
|
+
this._busyPresentationVisible = this._config.busyBucket.enabled;
|
|
10101
|
+
this._busyPresentationStartedAt = this._busyBucket?.isConnected ? Date.now() : null;
|
|
10102
|
+
}
|
|
10103
|
+
_syncBusyPresentation() {
|
|
10104
|
+
if (!this._config.busyBucket.enabled) {
|
|
10105
|
+
this._cancelBusyPresentation();
|
|
10106
|
+
return;
|
|
10107
|
+
}
|
|
10108
|
+
if (this._state.isBusy) {
|
|
10109
|
+
if (!this._busyPresentationVisible || this._busyPresentationHideTimer !== null) {
|
|
10110
|
+
this._beginBusyPresentation();
|
|
10111
|
+
}
|
|
10112
|
+
return;
|
|
10113
|
+
}
|
|
10114
|
+
if (!this._busyPresentationVisible || this._busyPresentationHideTimer !== null)
|
|
10115
|
+
return;
|
|
10116
|
+
const configuredMinimum = Number(this._config.busyBucket.minDisplayTime ?? 0);
|
|
10117
|
+
const minimum = Number.isFinite(configuredMinimum) ? Math.max(0, configuredMinimum) : 0;
|
|
10118
|
+
if (this._busyPresentationStartedAt === null)
|
|
10119
|
+
this._busyPresentationStartedAt = Date.now();
|
|
10120
|
+
const shownAt = this._busyPresentationStartedAt;
|
|
10121
|
+
const remaining = minimum - Math.max(0, Date.now() - shownAt);
|
|
10122
|
+
if (remaining <= 0) {
|
|
10123
|
+
this._busyPresentationGeneration += 1;
|
|
10124
|
+
this._busyPresentationVisible = false;
|
|
10125
|
+
this._busyPresentationStartedAt = null;
|
|
10126
|
+
return;
|
|
10127
|
+
}
|
|
10128
|
+
const generation = this._busyPresentationGeneration;
|
|
10129
|
+
this._busyPresentationHideTimer = this._setLifecycleTimeout(() => {
|
|
10130
|
+
if (generation !== this._busyPresentationGeneration || this._state.isBusy)
|
|
10131
|
+
return;
|
|
10132
|
+
this._busyPresentationHideTimer = null;
|
|
10133
|
+
this._busyPresentationVisible = false;
|
|
10134
|
+
this._busyPresentationStartedAt = null;
|
|
10135
|
+
this._busyBucket = undefined;
|
|
10136
|
+
this._clearBusyBucketContentObserver();
|
|
10137
|
+
this._renderOptions();
|
|
10138
|
+
}, remaining);
|
|
10139
|
+
}
|
|
10140
|
+
_clearBusyBucketContentObserver() {
|
|
10141
|
+
this._busyBucketContentObserver?.disconnect();
|
|
10142
|
+
this._busyBucketContentObserver = undefined;
|
|
10143
|
+
}
|
|
10144
|
+
_cancelBusyPresentation() {
|
|
10145
|
+
this._busyPresentationGeneration += 1;
|
|
10146
|
+
this._clearBusyPresentationHideTimer();
|
|
10147
|
+
this._busyPresentationVisible = false;
|
|
10148
|
+
this._busyPresentationStartedAt = null;
|
|
10149
|
+
this._clearBusyBucketContentObserver();
|
|
10150
|
+
this._busyBucket = undefined;
|
|
10151
|
+
this._optionsContainer?.querySelector('.busy-bucket')?.remove();
|
|
10152
|
+
}
|
|
10153
|
+
_hasAccessibleBusyContent(nodes) {
|
|
10154
|
+
return nodes.some((node) => {
|
|
10155
|
+
if (node.nodeType === Node.TEXT_NODE)
|
|
10156
|
+
return Boolean(node.textContent?.trim());
|
|
10157
|
+
if (!(node instanceof Element))
|
|
10158
|
+
return false;
|
|
10159
|
+
if (node.hasAttribute('hidden')
|
|
10160
|
+
|| node.hasAttribute('inert')
|
|
10161
|
+
|| node.getAttribute('aria-hidden')?.toLowerCase() === 'true')
|
|
10162
|
+
return false;
|
|
10163
|
+
if (['aria-label', 'aria-labelledby', 'alt', 'title'].some((name) => Boolean(node.getAttribute(name)?.trim()))) {
|
|
10164
|
+
return true;
|
|
10165
|
+
}
|
|
10166
|
+
return this._hasAccessibleBusyContent(Array.from(node.childNodes));
|
|
10167
|
+
});
|
|
10168
|
+
}
|
|
10169
|
+
_syncBusyBucketContent(bucket) {
|
|
10170
|
+
if (bucket !== this._busyBucket)
|
|
10171
|
+
return;
|
|
10172
|
+
const contentSlot = bucket.querySelector('slot[name="loading-content"]');
|
|
10173
|
+
const iconSlot = bucket.querySelector('slot[name="loading-icon"]');
|
|
10174
|
+
if (!contentSlot || !iconSlot)
|
|
10175
|
+
return;
|
|
10176
|
+
const contentNodes = contentSlot.assignedNodes({ flatten: true });
|
|
10177
|
+
const iconNodes = iconSlot.assignedNodes({ flatten: true });
|
|
10178
|
+
const hasContent = contentNodes.length > 0;
|
|
10179
|
+
const hasAccessibleContent = this._hasAccessibleBusyContent(contentNodes);
|
|
10180
|
+
const icon = bucket.querySelector('.busy-icon');
|
|
10181
|
+
icon?.toggleAttribute('hidden', this._config.busyBucket.showSpinner === false && iconNodes.length === 0);
|
|
10182
|
+
const content = bucket.querySelector('.busy-content');
|
|
10183
|
+
content?.toggleAttribute('hidden', !hasContent);
|
|
10184
|
+
bucket.classList.toggle('busy-bucket--replace', this._config.busyBucket.contentMode === 'replace' && hasAccessibleContent);
|
|
10185
|
+
const message = bucket.querySelector('.busy-message');
|
|
10186
|
+
if (message) {
|
|
10187
|
+
const needsAccessibleFallback = this._config.busyBucket.contentMode === 'replace' && !hasAccessibleContent;
|
|
10188
|
+
message.toggleAttribute('hidden', this._config.busyBucket.showMessage === false && !needsAccessibleFallback);
|
|
10189
|
+
if (needsAccessibleFallback && !message.textContent?.trim()) {
|
|
10190
|
+
message.textContent = this._config.busyBucket.message || 'Loading...';
|
|
10191
|
+
}
|
|
10192
|
+
}
|
|
10193
|
+
}
|
|
10194
|
+
_createBusyBucket() {
|
|
10195
|
+
const bucket = document.createElement('div');
|
|
10196
|
+
bucket.setAttribute('part', 'loading');
|
|
10197
|
+
bucket.className = 'busy-bucket';
|
|
10198
|
+
this._busyBucket = bucket;
|
|
10199
|
+
const icon = document.createElement('div');
|
|
10200
|
+
icon.className = 'busy-icon';
|
|
10201
|
+
icon.setAttribute('part', 'loading-icon');
|
|
10202
|
+
icon.setAttribute('aria-hidden', 'true');
|
|
10203
|
+
const iconSlot = document.createElement('slot');
|
|
10204
|
+
iconSlot.name = 'loading-icon';
|
|
10205
|
+
if (this._config.busyBucket.showSpinner !== false) {
|
|
10206
|
+
const spinner = document.createElement('div');
|
|
10207
|
+
spinner.className = 'spinner';
|
|
10208
|
+
spinner.setAttribute('part', 'loading-spinner');
|
|
10209
|
+
spinner.setAttribute('aria-hidden', 'true');
|
|
10210
|
+
iconSlot.appendChild(spinner);
|
|
10211
|
+
}
|
|
10212
|
+
icon.appendChild(iconSlot);
|
|
10213
|
+
bucket.appendChild(icon);
|
|
10214
|
+
const message = document.createElement('div');
|
|
10215
|
+
message.className = 'busy-message';
|
|
10216
|
+
message.setAttribute('part', 'loading-message');
|
|
10217
|
+
message.textContent = this._config.busyBucket.message ?? 'Loading...';
|
|
10218
|
+
message.toggleAttribute('hidden', this._config.busyBucket.showMessage === false);
|
|
10219
|
+
bucket.appendChild(message);
|
|
10220
|
+
const content = document.createElement('div');
|
|
10221
|
+
content.className = 'busy-content';
|
|
10222
|
+
content.setAttribute('part', 'loading-content');
|
|
10223
|
+
const contentSlot = document.createElement('slot');
|
|
10224
|
+
contentSlot.name = 'loading-content';
|
|
10225
|
+
content.appendChild(contentSlot);
|
|
10226
|
+
bucket.appendChild(content);
|
|
10227
|
+
const syncContent = () => this._syncBusyBucketContent(bucket);
|
|
10228
|
+
contentSlot.addEventListener('slotchange', syncContent);
|
|
10229
|
+
iconSlot.addEventListener('slotchange', syncContent);
|
|
10230
|
+
syncContent();
|
|
10231
|
+
if (typeof MutationObserver !== 'undefined') {
|
|
10232
|
+
this._clearBusyBucketContentObserver();
|
|
10233
|
+
this._busyBucketContentObserver = new MutationObserver(syncContent);
|
|
10234
|
+
this._busyBucketContentObserver.observe(this, { childList: true, subtree: true, characterData: true });
|
|
10235
|
+
}
|
|
10236
|
+
return bucket;
|
|
10237
|
+
}
|
|
10238
|
+
_appendBusyBucket() {
|
|
10239
|
+
const bucket = this._createBusyBucket();
|
|
10240
|
+
this._optionsContainer.appendChild(bucket);
|
|
10241
|
+
if (this._busyPresentationStartedAt === null)
|
|
10242
|
+
this._busyPresentationStartedAt = Date.now();
|
|
10243
|
+
this._syncBusyBucketContent(bucket);
|
|
10244
|
+
return bucket;
|
|
10245
|
+
}
|
|
9935
10246
|
_renderOptions() {
|
|
10247
|
+
this._syncBusyPresentation();
|
|
10248
|
+
this._clearBusyBucketContentObserver();
|
|
10249
|
+
this._busyBucket = undefined;
|
|
9936
10250
|
this._ensureRegistryCurrent();
|
|
9937
10251
|
const scrollTopBeforeRender = this._optionsContainer.scrollTop;
|
|
9938
10252
|
this._renderCycleId += 1;
|
|
@@ -10121,11 +10435,20 @@
|
|
|
10121
10435
|
this._renderSingleOption(item, itemIndex, getValue, getLabel, fragment);
|
|
10122
10436
|
}
|
|
10123
10437
|
const renderedTargets = Array.from(fragment.children);
|
|
10124
|
-
this._optionsContainer.
|
|
10438
|
+
const existingBusyBucket = this._optionsContainer.querySelector('.busy-bucket');
|
|
10439
|
+
if (existingBusyBucket)
|
|
10440
|
+
this._optionsContainer.insertBefore(fragment, existingBusyBucket);
|
|
10441
|
+
else
|
|
10442
|
+
this._optionsContainer.appendChild(fragment);
|
|
10125
10443
|
this._appendMountedVirtualizationTargets(renderedTargets);
|
|
10126
10444
|
this._syncRenderedOptionAccessibility();
|
|
10127
10445
|
this._syncLegacyActiveAria();
|
|
10128
10446
|
if (cursor < filteredIndices.length) {
|
|
10447
|
+
if (this._busyPresentationVisible
|
|
10448
|
+
&& this._config.busyBucket.enabled
|
|
10449
|
+
&& !this._optionsContainer.querySelector('.busy-bucket')) {
|
|
10450
|
+
this._appendBusyBucket();
|
|
10451
|
+
}
|
|
10129
10452
|
this._requestLifecycleFrame(renderChunk);
|
|
10130
10453
|
}
|
|
10131
10454
|
else {
|
|
@@ -10151,25 +10474,12 @@
|
|
|
10151
10474
|
this._appendGuardedBottomSpacer();
|
|
10152
10475
|
}
|
|
10153
10476
|
this._refreshMountedVirtualizationScope();
|
|
10154
|
-
|
|
10155
|
-
|
|
10156
|
-
|
|
10157
|
-
|
|
10158
|
-
|
|
10159
|
-
|
|
10160
|
-
const spinner = document.createElement('div');
|
|
10161
|
-
spinner.className = 'spinner';
|
|
10162
|
-
busyBucket.appendChild(spinner);
|
|
10163
|
-
}
|
|
10164
|
-
if (this._config.busyBucket.message) {
|
|
10165
|
-
const message = document.createElement('div');
|
|
10166
|
-
message.textContent = this._config.busyBucket.message;
|
|
10167
|
-
busyBucket.appendChild(message);
|
|
10168
|
-
}
|
|
10169
|
-
this._optionsContainer.appendChild(busyBucket);
|
|
10170
|
-
}
|
|
10171
|
-
// Append Load More Trigger (Button or Sentinel) if enabled and not busy
|
|
10172
|
-
else if ((!this._dataRequestCoordinator || !this._state.isBusy) && this._shouldRenderLoadMoreTrigger()) {
|
|
10477
|
+
if (this._busyPresentationVisible && this._config.busyBucket.enabled) {
|
|
10478
|
+
this._appendBusyBucket();
|
|
10479
|
+
}
|
|
10480
|
+
// The load-more trigger follows logical busy state, not any optional
|
|
10481
|
+
// visual minimum-display hold after a request has already completed.
|
|
10482
|
+
if ((!this._dataRequestCoordinator || !this._state.isBusy) && this._shouldRenderLoadMoreTrigger()) {
|
|
10173
10483
|
this._addLoadMoreTrigger();
|
|
10174
10484
|
}
|
|
10175
10485
|
// Rebuilding the list temporarily removes its spacer geometry. Browsers
|