@schukai/monster 4.136.20 → 4.136.22

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.
@@ -138,6 +138,12 @@ const clearOptionEventHandler = Symbol("clearOptionEventHandler");
138
138
  */
139
139
  const resizeObserverSymbol = Symbol("resizeObserver");
140
140
  const resizeObserverFrameSymbol = Symbol("resizeObserverFrame");
141
+ const layoutCycleFrameSymbol = Symbol("layoutCycleFrame");
142
+ const layoutCycleTokenSymbol = Symbol("layoutCycleToken");
143
+ const layoutCycleModeSymbol = Symbol("layoutCycleMode");
144
+ const layoutCyclePendingFlagsSymbol = Symbol("layoutCyclePendingFlags");
145
+ const layoutCyclePendingPrioritySymbol = Symbol("layoutCyclePendingPriority");
146
+ const layoutCycleRunningSymbol = Symbol("layoutCycleRunning");
141
147
  const visualViewportResizeHandlerSymbol = Symbol("visualViewportResizeHandler");
142
148
  const visualViewportScrollHandlerSymbol = Symbol("visualViewportScrollHandler");
143
149
  const visibilityChangeHandlerSymbol = Symbol("visibilityChangeHandler");
@@ -307,6 +313,19 @@ const lookupInProgressSymbol = Symbol("lookupInProgress");
307
313
  const unresolvedSelectionValuesSymbol = Symbol("unresolvedSelectionValues");
308
314
  const fetchRequestVersionSymbol = Symbol("fetchRequestVersion");
309
315
  const remoteInfoRequestSymbol = Symbol("remoteInfoRequest");
316
+ const remoteInfoStableMessageSymbol = Symbol("remoteInfoStableMessage");
317
+
318
+ const SELECT_LAYOUT_PRIORITY_PASSIVE = 1;
319
+ const SELECT_LAYOUT_PRIORITY_INTERACTIVE = 2;
320
+ const SELECT_LAYOUT_PRIORITY_CRITICAL = 3;
321
+
322
+ const SELECT_LAYOUT_REASON_OPTION_STATE = 1 << 0;
323
+ const SELECT_LAYOUT_REASON_PAGINATION = 1 << 1;
324
+ const SELECT_LAYOUT_REASON_POSITION = 1 << 2;
325
+ const SELECT_LAYOUT_REASON_ALL =
326
+ SELECT_LAYOUT_REASON_OPTION_STATE |
327
+ SELECT_LAYOUT_REASON_PAGINATION |
328
+ SELECT_LAYOUT_REASON_POSITION;
310
329
 
311
330
  /**
312
331
  * @private
@@ -709,7 +728,7 @@ class Select extends CustomControl {
709
728
  }
710
729
 
711
730
  this.setOption("messages.selected", "");
712
- this.setOption("messages.total", "");
731
+ setRemoteInfoText.call(this, "");
713
732
  this.setOption("messages.summary", "");
714
733
  this.setOption("total", null);
715
734
  resetPaginationState.call(this);
@@ -718,9 +737,11 @@ class Select extends CustomControl {
718
737
 
719
738
  this[lazyLoadDoneSymbol] = false;
720
739
 
721
- checkOptionState.call(this);
722
- calcAndSetOptionsDimension.call(this);
723
- updatePopper.call(this);
740
+ scheduleSelectLayoutCycle.call(
741
+ this,
742
+ SELECT_LAYOUT_PRIORITY_CRITICAL,
743
+ SELECT_LAYOUT_REASON_ALL,
744
+ );
724
745
  })
725
746
  .catch((e) => {
726
747
  addErrorAttribute(this, e);
@@ -1102,6 +1123,44 @@ function processAndApplyRemoteInfoTotal(data) {
1102
1123
  }
1103
1124
  }
1104
1125
 
1126
+ /**
1127
+ * @private
1128
+ * @param {string|null|undefined} message
1129
+ * @param {object} [options]
1130
+ * @param {boolean} [options.reserveSpace=false]
1131
+ * @returns {void}
1132
+ */
1133
+ function setRemoteInfoText(message, { reserveSpace = false } = {}) {
1134
+ const normalizedMessage =
1135
+ message === undefined || message === null ? "" : `${message}`;
1136
+ const previousStableMessage =
1137
+ typeof this[remoteInfoStableMessageSymbol] === "string"
1138
+ ? this[remoteInfoStableMessageSymbol]
1139
+ : "";
1140
+ const renderedMessage =
1141
+ reserveSpace === true &&
1142
+ normalizedMessage === "" &&
1143
+ previousStableMessage !== ""
1144
+ ? previousStableMessage
1145
+ : normalizedMessage;
1146
+
1147
+ this.setOption("messages.total", renderedMessage);
1148
+
1149
+ if (normalizedMessage !== "") {
1150
+ this[remoteInfoStableMessageSymbol] = normalizedMessage;
1151
+ } else if (reserveSpace !== true) {
1152
+ this[remoteInfoStableMessageSymbol] = "";
1153
+ }
1154
+
1155
+ if (this[remoteInfoElementSymbol] instanceof HTMLElement) {
1156
+ if (reserveSpace === true && renderedMessage !== "") {
1157
+ this[remoteInfoElementSymbol].style.visibility = "hidden";
1158
+ } else {
1159
+ this[remoteInfoElementSymbol].style.removeProperty("visibility");
1160
+ }
1161
+ }
1162
+ }
1163
+
1105
1164
  /**
1106
1165
  * @private
1107
1166
  * @returns {number}
@@ -1129,7 +1188,10 @@ function getSelectionSyncState() {
1129
1188
  function hasSelectionLikeValue(candidate) {
1130
1189
  if (isArray(candidate)) {
1131
1190
  return candidate.some((entry) => {
1132
- if (isObject(entry) && Object.prototype.hasOwnProperty.call(entry, "value")) {
1191
+ if (
1192
+ isObject(entry) &&
1193
+ Object.prototype.hasOwnProperty.call(entry, "value")
1194
+ ) {
1133
1195
  return hasSelectionLikeValue.call(this, entry.value);
1134
1196
  }
1135
1197
 
@@ -1851,8 +1913,7 @@ function getTranslations() {
1851
1913
  */
1852
1914
  function lookupSelection() {
1853
1915
  const self = this;
1854
- const IntersectionObserverImplementation =
1855
- getGlobal().IntersectionObserver;
1916
+ const IntersectionObserverImplementation = getGlobal().IntersectionObserver;
1856
1917
 
1857
1918
  if (!(IntersectionObserverImplementation instanceof Function)) {
1858
1919
  runSelectionLookupWhenVisible(self);
@@ -1911,11 +1972,9 @@ function runSelectionLookupWhenVisible(self) {
1911
1972
  if (isEmptyLookupValue.call(self, value)) {
1912
1973
  continue;
1913
1974
  }
1914
- filterFromRemoteByValue
1915
- .call(self, url, { filter: value })
1916
- .catch((e) => {
1917
- addErrorAttribute(self, e);
1918
- });
1975
+ filterFromRemoteByValue.call(self, url, { filter: value }).catch((e) => {
1976
+ addErrorAttribute(self, e);
1977
+ });
1919
1978
  }
1920
1979
  }, 100);
1921
1980
  }
@@ -1964,7 +2023,9 @@ function fetchIt(url, controlOptions) {
1964
2023
  classes.add("d-none");
1965
2024
  this.setOption("classes.noOptions", classes.toString());
1966
2025
  this.setOption("messages.emptyOptions", "");
1967
- this.setOption("messages.total", "");
2026
+ setRemoteInfoText.call(this, "", {
2027
+ reserveSpace: true,
2028
+ });
1968
2029
  }
1969
2030
 
1970
2031
  new Processing(10, () => {
@@ -2158,21 +2219,16 @@ function disconnectResizeObserver() {
2158
2219
  this[resizeObserverSymbol].disconnect();
2159
2220
  }
2160
2221
  cancelScheduledResizeObserverPopperUpdate.call(this);
2222
+ cancelScheduledSelectLayoutCycle.call(this);
2161
2223
 
2162
2224
  const viewport = getGlobal().visualViewport;
2163
- if (
2164
- viewport &&
2165
- this[visualViewportResizeHandlerSymbol] instanceof Function
2166
- ) {
2225
+ if (viewport && this[visualViewportResizeHandlerSymbol] instanceof Function) {
2167
2226
  viewport.removeEventListener(
2168
2227
  "resize",
2169
2228
  this[visualViewportResizeHandlerSymbol],
2170
2229
  );
2171
2230
  }
2172
- if (
2173
- viewport &&
2174
- this[visualViewportScrollHandlerSymbol] instanceof Function
2175
- ) {
2231
+ if (viewport && this[visualViewportScrollHandlerSymbol] instanceof Function) {
2176
2232
  viewport.removeEventListener(
2177
2233
  "scroll",
2178
2234
  this[visualViewportScrollHandlerSymbol],
@@ -2213,11 +2269,15 @@ function scheduleResizeObserverPopperUpdate() {
2213
2269
  ? globalObject.requestAnimationFrame.bind(globalObject)
2214
2270
  : (callback) => {
2215
2271
  return globalObject.setTimeout(callback, 16);
2216
- };
2272
+ };
2217
2273
 
2218
2274
  this[resizeObserverFrameSymbol] = schedule(() => {
2219
2275
  delete this[resizeObserverFrameSymbol];
2220
- updatePopper.call(this);
2276
+ scheduleSelectLayoutCycle.call(
2277
+ this,
2278
+ SELECT_LAYOUT_PRIORITY_CRITICAL,
2279
+ SELECT_LAYOUT_REASON_ALL,
2280
+ );
2221
2281
  });
2222
2282
  }
2223
2283
 
@@ -2236,6 +2296,156 @@ function cancelScheduledResizeObserverPopperUpdate() {
2236
2296
  delete this[resizeObserverFrameSymbol];
2237
2297
  }
2238
2298
 
2299
+ function applySelectLayoutState(layoutReasons = 0) {
2300
+ if (layoutReasons & SELECT_LAYOUT_REASON_OPTION_STATE) {
2301
+ checkOptionState.call(this);
2302
+ }
2303
+
2304
+ calcAndSetOptionsDimension.call(this);
2305
+
2306
+ if (layoutReasons & SELECT_LAYOUT_REASON_PAGINATION) {
2307
+ refreshSelectPaginationLayout.call(this);
2308
+ }
2309
+ }
2310
+
2311
+ function performSelectLayoutCycle(layoutReasons = SELECT_LAYOUT_REASON_ALL) {
2312
+ if (!isPositionedPopperOpen(this[popperElementSymbol])) {
2313
+ return Promise.resolve();
2314
+ }
2315
+
2316
+ if (this.getOption("disabled", false) === true) {
2317
+ return Promise.resolve();
2318
+ }
2319
+
2320
+ return new Processing(() => {
2321
+ applySelectLayoutState.call(this, layoutReasons);
2322
+ if (layoutReasons & SELECT_LAYOUT_REASON_POSITION) {
2323
+ return positionPopper.call(
2324
+ this,
2325
+ this[controlElementSymbol],
2326
+ this[popperElementSymbol],
2327
+ getSelectPopperPositionOptions.call(this),
2328
+ );
2329
+ }
2330
+ }).run();
2331
+ }
2332
+
2333
+ function cancelScheduledSelectLayoutCycle() {
2334
+ const globalObject = getGlobal();
2335
+ const frameId = this[layoutCycleFrameSymbol];
2336
+ if (typeof frameId === "number") {
2337
+ if (globalObject?.cancelAnimationFrame instanceof Function) {
2338
+ globalObject.cancelAnimationFrame(frameId);
2339
+ } else {
2340
+ globalObject.clearTimeout(frameId);
2341
+ }
2342
+ }
2343
+
2344
+ delete this[layoutCycleFrameSymbol];
2345
+ this[layoutCycleTokenSymbol] = (this[layoutCycleTokenSymbol] || 0) + 1;
2346
+ delete this[layoutCycleModeSymbol];
2347
+ }
2348
+
2349
+ function flushScheduledSelectLayoutCycle() {
2350
+ if (this[layoutCycleRunningSymbol] === true) {
2351
+ return;
2352
+ }
2353
+
2354
+ const layoutReasons =
2355
+ this[layoutCyclePendingFlagsSymbol] || SELECT_LAYOUT_REASON_ALL;
2356
+ const layoutPriority =
2357
+ this[layoutCyclePendingPrioritySymbol] ||
2358
+ SELECT_LAYOUT_PRIORITY_INTERACTIVE;
2359
+
2360
+ delete this[layoutCyclePendingFlagsSymbol];
2361
+ delete this[layoutCyclePendingPrioritySymbol];
2362
+
2363
+ this[layoutCycleRunningSymbol] = true;
2364
+ performSelectLayoutCycle
2365
+ .call(this, layoutReasons)
2366
+ .catch((e) => {
2367
+ addErrorAttribute(this, e);
2368
+ })
2369
+ .finally(() => {
2370
+ delete this[layoutCycleRunningSymbol];
2371
+ if (this[layoutCyclePendingFlagsSymbol]) {
2372
+ scheduleSelectLayoutCycle.call(
2373
+ this,
2374
+ layoutPriority,
2375
+ this[layoutCyclePendingFlagsSymbol],
2376
+ );
2377
+ }
2378
+ });
2379
+ }
2380
+
2381
+ function scheduleSelectLayoutCycle(
2382
+ layoutPriority = SELECT_LAYOUT_PRIORITY_INTERACTIVE,
2383
+ layoutReasons = SELECT_LAYOUT_REASON_ALL,
2384
+ ) {
2385
+ this[layoutCyclePendingFlagsSymbol] =
2386
+ (this[layoutCyclePendingFlagsSymbol] || 0) | layoutReasons;
2387
+ this[layoutCyclePendingPrioritySymbol] = Math.max(
2388
+ this[layoutCyclePendingPrioritySymbol] || 0,
2389
+ layoutPriority,
2390
+ );
2391
+
2392
+ if (this[layoutCycleRunningSymbol] === true) {
2393
+ return;
2394
+ }
2395
+
2396
+ const pendingPriority = this[layoutCyclePendingPrioritySymbol];
2397
+ const currentMode = this[layoutCycleModeSymbol];
2398
+ if (
2399
+ currentMode === "microtask" ||
2400
+ (currentMode === "frame" &&
2401
+ pendingPriority !== SELECT_LAYOUT_PRIORITY_CRITICAL)
2402
+ ) {
2403
+ return;
2404
+ }
2405
+
2406
+ if (pendingPriority === SELECT_LAYOUT_PRIORITY_CRITICAL) {
2407
+ cancelScheduledSelectLayoutCycle.call(this);
2408
+ const token = this[layoutCycleTokenSymbol];
2409
+ this[layoutCycleModeSymbol] = "microtask";
2410
+ queueMicrotask(() => {
2411
+ if (
2412
+ this[layoutCycleModeSymbol] !== "microtask" ||
2413
+ this[layoutCycleTokenSymbol] !== token
2414
+ ) {
2415
+ return;
2416
+ }
2417
+
2418
+ delete this[layoutCycleModeSymbol];
2419
+ flushScheduledSelectLayoutCycle.call(this);
2420
+ });
2421
+ return;
2422
+ }
2423
+
2424
+ const globalObject = getGlobal();
2425
+ const schedule =
2426
+ globalObject?.requestAnimationFrame instanceof Function
2427
+ ? globalObject.requestAnimationFrame.bind(globalObject)
2428
+ : (callback) => {
2429
+ return globalObject.setTimeout(callback, 16);
2430
+ };
2431
+
2432
+ this[layoutCycleModeSymbol] = "frame";
2433
+ const token = (this[layoutCycleTokenSymbol] || 0) + 1;
2434
+ this[layoutCycleTokenSymbol] = token;
2435
+ this[layoutCycleFrameSymbol] = schedule(() => {
2436
+ delete this[layoutCycleFrameSymbol];
2437
+ if (
2438
+ this[layoutCycleModeSymbol] !== "frame" ||
2439
+ this[layoutCycleTokenSymbol] !== token
2440
+ ) {
2441
+ return;
2442
+ }
2443
+
2444
+ delete this[layoutCycleModeSymbol];
2445
+ flushScheduledSelectLayoutCycle.call(this);
2446
+ });
2447
+ }
2448
+
2239
2449
  /**
2240
2450
  * @private
2241
2451
  * @returns {string}
@@ -2327,6 +2537,27 @@ function buildSelectionLabel(value) {
2327
2537
  return map.get(key);
2328
2538
  }
2329
2539
 
2540
+ const options = this.getOption("options");
2541
+ if (isArray(options)) {
2542
+ for (const option of options) {
2543
+ if (!isObject(option) || option.value === undefined) {
2544
+ continue;
2545
+ }
2546
+
2547
+ const optionKey = strict
2548
+ ? option.value
2549
+ : getSelectionStateKey.call(this, option.value);
2550
+ if (optionKey !== key) {
2551
+ continue;
2552
+ }
2553
+
2554
+ if (clearUnresolvedSelectionValue.call(this, value)) {
2555
+ this[lookupCacheSymbol].delete(getSelectionCacheKey.call(this, value));
2556
+ }
2557
+ return option.label;
2558
+ }
2559
+ }
2560
+
2330
2561
  const cacheKey = getSelectionCacheKey.call(this, value);
2331
2562
  if (this[lookupCacheSymbol].has(cacheKey)) {
2332
2563
  return this[lookupCacheSymbol].get(cacheKey);
@@ -2773,19 +3004,21 @@ function setTotalText() {
2773
3004
  }
2774
3005
 
2775
3006
  if (this[isLoadingSymbol] === true) {
2776
- this.setOption("messages.total", "");
3007
+ setRemoteInfoText.call(this, "", {
3008
+ reserveSpace: true,
3009
+ });
2777
3010
  return;
2778
3011
  }
2779
3012
 
2780
3013
  const count = this.getOption("options").length;
2781
3014
  if (count === 0) {
2782
- this.setOption("messages.total", "");
3015
+ setRemoteInfoText.call(this, "");
2783
3016
  return;
2784
3017
  }
2785
3018
 
2786
3019
  const total = Number.parseInt(this.getOption("total"));
2787
3020
  if (Number.isNaN(total)) {
2788
- this.setOption("messages.total", "");
3021
+ setRemoteInfoText.call(this, "");
2789
3022
  return;
2790
3023
  }
2791
3024
 
@@ -2793,7 +3026,7 @@ function setTotalText() {
2793
3026
 
2794
3027
  const diff = total - count;
2795
3028
  if (diff < 0) {
2796
- this.setOption("messages.total", "");
3029
+ setRemoteInfoText.call(this, "");
2797
3030
  return;
2798
3031
  }
2799
3032
  const text = translations.getPluralRuleText("total", diff, "");
@@ -2801,7 +3034,7 @@ function setTotalText() {
2801
3034
  count: String(diff),
2802
3035
  }).format(text);
2803
3036
 
2804
- this.setOption("messages.total", selectedText);
3037
+ setRemoteInfoText.call(this, selectedText);
2805
3038
  }
2806
3039
 
2807
3040
  /**
@@ -2833,7 +3066,10 @@ function setSummaryAndControlText() {
2833
3066
  current === msg ||
2834
3067
  current === null
2835
3068
  ) {
2836
- if (selections.length === 0 && hasRequestedSelectionValue.call(this) !== true) {
3069
+ if (
3070
+ selections.length === 0 &&
3071
+ hasRequestedSelectionValue.call(this) !== true
3072
+ ) {
2837
3073
  this.setOption("messages.control", msg);
2838
3074
  } else {
2839
3075
  this.setOption("messages.control", "");
@@ -2951,7 +3187,9 @@ function calcAndSetOptionsDimension() {
2951
3187
  });
2952
3188
 
2953
3189
  container.style.height =
2954
- listDimension.desiredHeight > 0 ? `${listDimension.desiredHeight}px` : "0px";
3190
+ listDimension.desiredHeight > 0
3191
+ ? `${listDimension.desiredHeight}px`
3192
+ : "0px";
2955
3193
  container.style.maxHeight =
2956
3194
  listDimension.maxHeight > 0 ? `${listDimension.maxHeight}px` : "0px";
2957
3195
  container.style.overflowY = listDimension.overflowY;
@@ -3107,12 +3345,11 @@ function resolveSelectViewportMetrics({
3107
3345
  };
3108
3346
  }
3109
3347
 
3110
- function resolveSelectVisibleRect({
3111
- viewportMetrics,
3112
- boundaryRect = null,
3113
- }) {
3114
- const viewportLeft = (viewportMetrics?.left || 0) + (viewportMetrics?.padding || 0);
3115
- const viewportTop = (viewportMetrics?.top || 0) + (viewportMetrics?.padding || 0);
3348
+ function resolveSelectVisibleRect({ viewportMetrics, boundaryRect = null }) {
3349
+ const viewportLeft =
3350
+ (viewportMetrics?.left || 0) + (viewportMetrics?.padding || 0);
3351
+ const viewportTop =
3352
+ (viewportMetrics?.top || 0) + (viewportMetrics?.padding || 0);
3116
3353
  const viewportRight =
3117
3354
  (viewportMetrics?.left || 0) +
3118
3355
  (viewportMetrics?.width || 0) -
@@ -3160,14 +3397,8 @@ function getSelectPopperGeometry() {
3160
3397
  viewportMetrics: viewport,
3161
3398
  boundaryRect,
3162
3399
  });
3163
- const spaceAbove = Math.max(
3164
- 0,
3165
- controlRect.top - visibleRect.top,
3166
- );
3167
- const spaceBelow = Math.max(
3168
- 0,
3169
- visibleRect.bottom - controlRect.bottom,
3170
- );
3400
+ const spaceAbove = Math.max(0, controlRect.top - visibleRect.top);
3401
+ const spaceBelow = Math.max(0, visibleRect.bottom - controlRect.bottom);
3171
3402
  const availableHeight = Math.max(spaceAbove, spaceBelow, 0);
3172
3403
 
3173
3404
  return {
@@ -3193,15 +3424,15 @@ function getSelectPopperPositionOptions() {
3193
3424
  middleware.length === 0 ||
3194
3425
  usesLegacyDefaultMiddleware
3195
3426
  ) {
3196
- popperOptions.middleware = getDefaultSelectPopperPositionProfile().middleware;
3427
+ popperOptions.middleware =
3428
+ getDefaultSelectPopperPositionProfile().middleware;
3197
3429
  }
3198
3430
 
3199
3431
  if (
3200
3432
  !isString(popperOptions.placement) ||
3201
3433
  popperOptions.placement === "bottom"
3202
3434
  ) {
3203
- popperOptions.placement =
3204
- getDefaultSelectPopperPositionProfile().placement;
3435
+ popperOptions.placement = getDefaultSelectPopperPositionProfile().placement;
3205
3436
  }
3206
3437
 
3207
3438
  if (
@@ -3364,7 +3595,11 @@ function filterOptions() {
3364
3595
  .run()
3365
3596
  .then(() => {
3366
3597
  new Processing(100, () => {
3367
- calcAndSetOptionsDimension.call(this);
3598
+ scheduleSelectLayoutCycle.call(
3599
+ this,
3600
+ SELECT_LAYOUT_PRIORITY_CRITICAL,
3601
+ SELECT_LAYOUT_REASON_PAGINATION | SELECT_LAYOUT_REASON_POSITION,
3602
+ );
3368
3603
  focusFilter.call(this);
3369
3604
  })
3370
3605
  .run()
@@ -4518,8 +4753,10 @@ function show() {
4518
4753
  const shouldLoadRemoteOptions =
4519
4754
  getFilterMode.call(self) === FILTER_MODE_REMOTE &&
4520
4755
  getOptionElements.call(self).length === 0;
4521
- const shouldLoadDefaultOptions =
4522
- shouldUseDefaultOptionsUrl.call(self, getCurrentFilterValue.call(self));
4756
+ const shouldLoadDefaultOptions = shouldUseDefaultOptionsUrl.call(
4757
+ self,
4758
+ getCurrentFilterValue.call(self),
4759
+ );
4523
4760
 
4524
4761
  if (shouldLoadDefaultOptions) {
4525
4762
  setTimeout(() => {
@@ -4537,11 +4774,12 @@ function show() {
4537
4774
  } else {
4538
4775
  initTotal.call(self);
4539
4776
  }
4540
- calcAndSetOptionsDimension.call(this);
4541
4777
  focusFilter.call(this);
4542
- this[popperElementSymbol].style.removeProperty("visibility");
4543
- refreshSelectPaginationLayout.call(this);
4544
- updatePopper.call(this);
4778
+ return performSelectLayoutCycle
4779
+ .call(this, SELECT_LAYOUT_REASON_ALL)
4780
+ .then(() => {
4781
+ this[popperElementSymbol].style.removeProperty("visibility");
4782
+ });
4545
4783
  })
4546
4784
  .run()
4547
4785
  .catch((e) => {
@@ -4627,7 +4865,9 @@ function initTotal() {
4627
4865
  }
4628
4866
 
4629
4867
  const fetchOptions = this.getOption("fetch", {});
4630
- this.setOption("messages.total", "");
4868
+ setRemoteInfoText.call(this, "", {
4869
+ reserveSpace: true,
4870
+ });
4631
4871
 
4632
4872
  const remoteInfoRequest = getGlobal()
4633
4873
  .fetch(url, fetchOptions)
@@ -4684,7 +4924,7 @@ function resetPaginationState(clearTotalMessage = true) {
4684
4924
  paginationElement.setOption("currentPage", null);
4685
4925
  paginationElement.setOption("objectsPerPage", null);
4686
4926
  if (clearTotalMessage === true) {
4687
- this.setOption("messages.total", "");
4927
+ setRemoteInfoText.call(this, "");
4688
4928
  }
4689
4929
  }
4690
4930
 
@@ -4695,13 +4935,21 @@ function clearOptionsOnError() {
4695
4935
 
4696
4936
  function refreshSelectPaginationLayout() {
4697
4937
  const paginationElement = this[paginationElementSymbol];
4698
- if (!paginationElement || typeof paginationElement.getOption !== "function") {
4938
+ if (!paginationElement) {
4939
+ return;
4940
+ }
4941
+
4942
+ if (typeof paginationElement.refreshLayout === "function") {
4943
+ paginationElement.refreshLayout();
4944
+ return;
4945
+ }
4946
+
4947
+ if (typeof paginationElement.getOption !== "function") {
4699
4948
  return;
4700
4949
  }
4701
4950
 
4702
4951
  const currentPage = paginationElement.getOption("currentPage");
4703
4952
  const totalPages = paginationElement.getOption("pages");
4704
-
4705
4953
  if (!isInteger(currentPage) || !isInteger(totalPages)) {
4706
4954
  return;
4707
4955
  }
@@ -4962,9 +5210,11 @@ function initEventHandler() {
4962
5210
  this[debounceOptionsMutationObserverSymbol] = new DeadMansSwitch(
4963
5211
  100,
4964
5212
  () => {
4965
- checkOptionState.call(self);
4966
- calcAndSetOptionsDimension.call(self);
4967
- updatePopper.call(self);
5213
+ scheduleSelectLayoutCycle.call(
5214
+ self,
5215
+ SELECT_LAYOUT_PRIORITY_INTERACTIVE,
5216
+ SELECT_LAYOUT_REASON_ALL,
5217
+ );
4968
5218
  delete this[debounceOptionsMutationObserverSymbol];
4969
5219
  },
4970
5220
  );
@@ -5140,7 +5390,7 @@ function initControlReferences() {
5140
5390
  `[${ATTRIBUTE_ROLE}=popper]`,
5141
5391
  );
5142
5392
  this[popperElementSymbol].monsterBeforeFloatingUpdate = () => {
5143
- calcAndSetOptionsDimension.call(this);
5393
+ applySelectLayoutState.call(this, SELECT_LAYOUT_REASON_PAGINATION);
5144
5394
  };
5145
5395
  this[inlineFilterElementSymbol] = this.shadowRoot.querySelector(
5146
5396
  `[${ATTRIBUTE_ROLE}=filter][name="inline-filter"]`,
@@ -5170,31 +5420,11 @@ function initControlReferences() {
5170
5420
  * @private
5171
5421
  */
5172
5422
  function updatePopper() {
5173
- if (!isPositionedPopperOpen(this[popperElementSymbol])) {
5174
- return;
5175
- }
5176
-
5177
- if (this.getOption("disabled", false) === true) {
5178
- return;
5179
- }
5180
-
5181
- new Processing(() => {
5182
- calcAndSetOptionsDimension.call(this);
5183
- positionPopper.call(
5184
- this,
5185
- this[controlElementSymbol],
5186
- this[popperElementSymbol],
5187
- getSelectPopperPositionOptions.call(this),
5188
- );
5189
- requestAnimationFrame(() => {
5190
- refreshSelectPaginationLayout.call(this);
5191
- });
5192
- })
5193
- .run()
5194
- .catch((e) => {
5195
- addErrorAttribute(this, e);
5196
- });
5197
-
5423
+ scheduleSelectLayoutCycle.call(
5424
+ this,
5425
+ SELECT_LAYOUT_PRIORITY_INTERACTIVE,
5426
+ SELECT_LAYOUT_REASON_ALL,
5427
+ );
5198
5428
  return this;
5199
5429
  }
5200
5430