@react-hive/honey-utils 3.28.0 → 3.31.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.
@@ -212,42 +212,55 @@ __webpack_require__.r(__webpack_exports__);
212
212
 
213
213
  /***/ },
214
214
 
215
- /***/ "./src/array.ts"
216
- /*!**********************!*\
217
- !*** ./src/array.ts ***!
218
- \**********************/
215
+ /***/ "./src/array/chunk.ts"
216
+ /*!****************************!*\
217
+ !*** ./src/array/chunk.ts ***!
218
+ \****************************/
219
219
  (__unused_webpack_module, __webpack_exports__, __webpack_require__) {
220
220
 
221
221
  __webpack_require__.r(__webpack_exports__);
222
222
  /* harmony export */ __webpack_require__.d(__webpack_exports__, {
223
- /* harmony export */ chunk: () => (/* binding */ chunk),
224
- /* harmony export */ compact: () => (/* binding */ compact),
225
- /* harmony export */ compose: () => (/* binding */ compose),
226
- /* harmony export */ difference: () => (/* binding */ difference),
227
- /* harmony export */ intersection: () => (/* binding */ intersection),
228
- /* harmony export */ isArray: () => (/* binding */ isArray),
229
- /* harmony export */ isEmptyArray: () => (/* binding */ isEmptyArray),
230
- /* harmony export */ pipe: () => (/* binding */ pipe),
231
- /* harmony export */ unique: () => (/* binding */ unique)
223
+ /* harmony export */ chunk: () => (/* binding */ chunk)
232
224
  /* harmony export */ });
233
225
  /* harmony import */ var _guards__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ~/guards */ "./src/guards.ts");
234
226
 
235
227
  /**
236
- * Checks if a value is an array.
228
+ * Splits an array into chunks of the specified size.
237
229
  *
238
- * @param value - The value to check.
230
+ * Useful for pagination, batch processing, or creating grid layouts.
239
231
  *
240
- * @returns `true` if the value is an array; otherwise, `false`.
241
- */
242
- const isArray = (value) => Array.isArray(value);
243
- /**
244
- * Checks if a value is an empty array.
232
+ * @template T - The type of the items in the array.
245
233
  *
246
- * @param value - The value to check.
234
+ * @param array - The input array to be chunked.
235
+ * @param size - The size of each chunk. Must be greater than 0.
247
236
  *
248
- * @returns `true` if the value is an empty array; otherwise, `false`.
237
+ * @returns An array of chunks, where each chunk is an array of the specified size
238
+ * (except possibly the last chunk, which may be smaller).
239
+ *
240
+ * @example
241
+ * ```ts
242
+ * chunk([1, 2, 3, 4, 5], 2); // [[1, 2], [3, 4], [5]]
243
+ * chunk(['a', 'b', 'c', 'd'], 3); // [['a', 'b', 'c'], ['d']]
244
+ * ```
249
245
  */
250
- const isEmptyArray = (value) => isArray(value) && value.length === 0;
246
+ const chunk = (array, size) => {
247
+ (0,_guards__WEBPACK_IMPORTED_MODULE_0__.assert)(size > 0, 'Chunk size must be greater than 0');
248
+ return Array.from({ length: Math.ceil(array.length / size) }, (_, index) => array.slice(index * size, (index + 1) * size));
249
+ };
250
+
251
+
252
+ /***/ },
253
+
254
+ /***/ "./src/array/compact.ts"
255
+ /*!******************************!*\
256
+ !*** ./src/array/compact.ts ***!
257
+ \******************************/
258
+ (__unused_webpack_module, __webpack_exports__, __webpack_require__) {
259
+
260
+ __webpack_require__.r(__webpack_exports__);
261
+ /* harmony export */ __webpack_require__.d(__webpack_exports__, {
262
+ /* harmony export */ compact: () => (/* binding */ compact)
263
+ /* harmony export */ });
251
264
  /**
252
265
  * Removes all falsy values from an array.
253
266
  *
@@ -267,47 +280,176 @@ const isEmptyArray = (value) => isArray(value) && value.length === 0;
267
280
  * ```
268
281
  */
269
282
  const compact = (array) => array.filter(Boolean);
283
+
284
+
285
+ /***/ },
286
+
287
+ /***/ "./src/array/compose.ts"
288
+ /*!******************************!*\
289
+ !*** ./src/array/compose.ts ***!
290
+ \******************************/
291
+ (__unused_webpack_module, __webpack_exports__, __webpack_require__) {
292
+
293
+ __webpack_require__.r(__webpack_exports__);
294
+ /* harmony export */ __webpack_require__.d(__webpack_exports__, {
295
+ /* harmony export */ compose: () => (/* binding */ compose)
296
+ /* harmony export */ });
270
297
  /**
271
- * Returns a new array with duplicate values removed.
272
- *
273
- * Uses Set for efficient duplicate removal while preserving the original order.
298
+ * Composes multiple unary functions into a single function, applying them from **right to left**.
274
299
  *
275
- * @template T - The type of the items in the array.
300
+ * Often used for building functional pipelines where the innermost function runs first.
301
+ * Types are inferred up to 5 chained functions for full type safety.
276
302
  *
277
- * @param array - The input array that may contain duplicate values.
303
+ * @param fns - A list of unary functions to compose.
278
304
  *
279
- * @returns A new array with only unique values, maintaining the original order.
305
+ * @returns A new function that applies all functions from right to left.
280
306
  *
281
307
  * @example
282
308
  * ```ts
283
- * unique([1, 2, 2, 3, 1, 4]); // [1, 2, 3, 4]
284
- * unique(['a', 'b', 'a', 'c']); // ['a', 'b', 'c']
309
+ * const add = (x: number) => x + 1;
310
+ * const double = (x: number) => x * 2;
311
+ * const toStr = (x: number) => `Result: ${x}`;
312
+ *
313
+ * const result = compose(toStr, double, add)(2);
314
+ * // => 'Result: 6'
285
315
  * ```
286
316
  */
287
- const unique = (array) => [...new Set(array)];
317
+ const compose = (...fns) => (arg) => fns.reduceRight((prev, fn) => fn(prev), arg);
318
+
319
+
320
+ /***/ },
321
+
322
+ /***/ "./src/array/difference.ts"
323
+ /*!*********************************!*\
324
+ !*** ./src/array/difference.ts ***!
325
+ \*********************************/
326
+ (__unused_webpack_module, __webpack_exports__, __webpack_require__) {
327
+
328
+ __webpack_require__.r(__webpack_exports__);
329
+ /* harmony export */ __webpack_require__.d(__webpack_exports__, {
330
+ /* harmony export */ difference: () => (/* binding */ difference)
331
+ /* harmony export */ });
288
332
  /**
289
- * Splits an array into chunks of the specified size.
290
- *
291
- * Useful for pagination, batch processing, or creating grid layouts.
333
+ * Returns elements from the first array that don't exist in the second array.
292
334
  *
293
- * @template T - The type of the items in the array.
335
+ * @template T - The type of the items in the arrays.
294
336
  *
295
- * @param array - The input array to be chunked.
296
- * @param size - The size of each chunk. Must be greater than 0.
337
+ * @param array - The source array.
338
+ * @param exclude - The array containing elements to exclude.
297
339
  *
298
- * @returns An array of chunks, where each chunk is an array of the specified size
299
- * (except possibly the last chunk, which may be smaller).
340
+ * @returns A new array with elements from the first array that don't exist in the second array.
300
341
  *
301
342
  * @example
302
343
  * ```ts
303
- * chunk([1, 2, 3, 4, 5], 2); // [[1, 2], [3, 4], [5]]
304
- * chunk(['a', 'b', 'c', 'd'], 3); // [['a', 'b', 'c'], ['d']]
344
+ * difference([1, 2, 3, 4], [2, 4]); // [1, 3]
345
+ * difference(['a', 'b', 'c'], ['b']); // ['a', 'c']
305
346
  * ```
306
347
  */
307
- const chunk = (array, size) => {
308
- (0,_guards__WEBPACK_IMPORTED_MODULE_0__.assert)(size > 0, 'Chunk size must be greater than 0');
309
- return Array.from({ length: Math.ceil(array.length / size) }, (_, index) => array.slice(index * size, (index + 1) * size));
348
+ const difference = (array, exclude) => array.filter(item => !exclude.includes(item));
349
+
350
+
351
+ /***/ },
352
+
353
+ /***/ "./src/array/get-adjacent-items.ts"
354
+ /*!*****************************************!*\
355
+ !*** ./src/array/get-adjacent-items.ts ***!
356
+ \*****************************************/
357
+ (__unused_webpack_module, __webpack_exports__, __webpack_require__) {
358
+
359
+ __webpack_require__.r(__webpack_exports__);
360
+ /* harmony export */ __webpack_require__.d(__webpack_exports__, {
361
+ /* harmony export */ getAdjacentItems: () => (/* binding */ getAdjacentItems)
362
+ /* harmony export */ });
363
+ /**
364
+ * Returns previous, current, and next items for the matched item.
365
+ *
366
+ * @param items - Source items.
367
+ * @param targetItem - Item to find in the source array.
368
+ * @param isSameItem - Comparator used to match items.
369
+ *
370
+ * @returns Adjacent items around the matched item.
371
+ */
372
+ const getAdjacentItems = (items, targetItem, isSameItem) => {
373
+ if (!items?.length || !targetItem) {
374
+ return {
375
+ previousItem: null,
376
+ currentItem: null,
377
+ nextItem: null,
378
+ };
379
+ }
380
+ const currentItemIndex = items.findIndex(item => isSameItem(item, targetItem));
381
+ if (currentItemIndex === -1) {
382
+ return {
383
+ previousItem: null,
384
+ currentItem: null,
385
+ nextItem: null,
386
+ };
387
+ }
388
+ return {
389
+ previousItem: currentItemIndex > 0 ? items[currentItemIndex - 1] : null,
390
+ currentItem: items[currentItemIndex],
391
+ nextItem: currentItemIndex < items.length - 1 ? items[currentItemIndex + 1] : null,
392
+ };
310
393
  };
394
+
395
+
396
+ /***/ },
397
+
398
+ /***/ "./src/array/index.ts"
399
+ /*!****************************!*\
400
+ !*** ./src/array/index.ts ***!
401
+ \****************************/
402
+ (__unused_webpack_module, __webpack_exports__, __webpack_require__) {
403
+
404
+ __webpack_require__.r(__webpack_exports__);
405
+ /* harmony export */ __webpack_require__.d(__webpack_exports__, {
406
+ /* harmony export */ chunk: () => (/* reexport safe */ _chunk__WEBPACK_IMPORTED_MODULE_4__.chunk),
407
+ /* harmony export */ compact: () => (/* reexport safe */ _compact__WEBPACK_IMPORTED_MODULE_6__.compact),
408
+ /* harmony export */ compose: () => (/* reexport safe */ _compose__WEBPACK_IMPORTED_MODULE_1__.compose),
409
+ /* harmony export */ difference: () => (/* reexport safe */ _difference__WEBPACK_IMPORTED_MODULE_2__.difference),
410
+ /* harmony export */ getAdjacentItems: () => (/* reexport safe */ _get_adjacent_items__WEBPACK_IMPORTED_MODULE_9__.getAdjacentItems),
411
+ /* harmony export */ intersection: () => (/* reexport safe */ _intersection__WEBPACK_IMPORTED_MODULE_3__.intersection),
412
+ /* harmony export */ isArray: () => (/* reexport safe */ _is_array__WEBPACK_IMPORTED_MODULE_7__.isArray),
413
+ /* harmony export */ isEmptyArray: () => (/* reexport safe */ _is_empty_array__WEBPACK_IMPORTED_MODULE_8__.isEmptyArray),
414
+ /* harmony export */ pipe: () => (/* reexport safe */ _pipe__WEBPACK_IMPORTED_MODULE_0__.pipe),
415
+ /* harmony export */ unique: () => (/* reexport safe */ _unique__WEBPACK_IMPORTED_MODULE_5__.unique)
416
+ /* harmony export */ });
417
+ /* harmony import */ var _pipe__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./pipe */ "./src/array/pipe.ts");
418
+ /* harmony import */ var _compose__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./compose */ "./src/array/compose.ts");
419
+ /* harmony import */ var _difference__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./difference */ "./src/array/difference.ts");
420
+ /* harmony import */ var _intersection__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./intersection */ "./src/array/intersection.ts");
421
+ /* harmony import */ var _chunk__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./chunk */ "./src/array/chunk.ts");
422
+ /* harmony import */ var _unique__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./unique */ "./src/array/unique.ts");
423
+ /* harmony import */ var _compact__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./compact */ "./src/array/compact.ts");
424
+ /* harmony import */ var _is_array__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ./is-array */ "./src/array/is-array.ts");
425
+ /* harmony import */ var _is_empty_array__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ./is-empty-array */ "./src/array/is-empty-array.ts");
426
+ /* harmony import */ var _get_adjacent_items__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! ./get-adjacent-items */ "./src/array/get-adjacent-items.ts");
427
+
428
+
429
+
430
+
431
+
432
+
433
+
434
+
435
+
436
+
437
+
438
+
439
+ /***/ },
440
+
441
+ /***/ "./src/array/intersection.ts"
442
+ /*!***********************************!*\
443
+ !*** ./src/array/intersection.ts ***!
444
+ \***********************************/
445
+ (__unused_webpack_module, __webpack_exports__, __webpack_require__) {
446
+
447
+ __webpack_require__.r(__webpack_exports__);
448
+ /* harmony export */ __webpack_require__.d(__webpack_exports__, {
449
+ /* harmony export */ intersection: () => (/* binding */ intersection)
450
+ /* harmony export */ });
451
+ /* harmony import */ var _array__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ~/array */ "./src/array/index.ts");
452
+
311
453
  /**
312
454
  * Returns an array containing elements that exist in all provided arrays.
313
455
  *
@@ -331,26 +473,69 @@ const intersection = (...arrays) => {
331
473
  return [...arrays[0]];
332
474
  }
333
475
  const [first, ...rest] = arrays;
334
- const uniqueFirst = unique(first);
476
+ const uniqueFirst = (0,_array__WEBPACK_IMPORTED_MODULE_0__.unique)(first);
335
477
  return uniqueFirst.filter(item => rest.every(array => array.includes(item)));
336
478
  };
479
+
480
+
481
+ /***/ },
482
+
483
+ /***/ "./src/array/is-array.ts"
484
+ /*!*******************************!*\
485
+ !*** ./src/array/is-array.ts ***!
486
+ \*******************************/
487
+ (__unused_webpack_module, __webpack_exports__, __webpack_require__) {
488
+
489
+ __webpack_require__.r(__webpack_exports__);
490
+ /* harmony export */ __webpack_require__.d(__webpack_exports__, {
491
+ /* harmony export */ isArray: () => (/* binding */ isArray)
492
+ /* harmony export */ });
337
493
  /**
338
- * Returns elements from the first array that don't exist in the second array.
494
+ * Checks if a value is an array.
339
495
  *
340
- * @template T - The type of the items in the arrays.
496
+ * @param value - The value to check.
341
497
  *
342
- * @param array - The source array.
343
- * @param exclude - The array containing elements to exclude.
498
+ * @returns `true` if the value is an array; otherwise, `false`.
499
+ */
500
+ const isArray = (value) => Array.isArray(value);
501
+
502
+
503
+ /***/ },
504
+
505
+ /***/ "./src/array/is-empty-array.ts"
506
+ /*!*************************************!*\
507
+ !*** ./src/array/is-empty-array.ts ***!
508
+ \*************************************/
509
+ (__unused_webpack_module, __webpack_exports__, __webpack_require__) {
510
+
511
+ __webpack_require__.r(__webpack_exports__);
512
+ /* harmony export */ __webpack_require__.d(__webpack_exports__, {
513
+ /* harmony export */ isEmptyArray: () => (/* binding */ isEmptyArray)
514
+ /* harmony export */ });
515
+ /* harmony import */ var _array__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ~/array */ "./src/array/index.ts");
516
+
517
+ /**
518
+ * Checks if a value is an empty array.
344
519
  *
345
- * @returns A new array with elements from the first array that don't exist in the second array.
520
+ * @param value - The value to check.
346
521
  *
347
- * @example
348
- * ```ts
349
- * difference([1, 2, 3, 4], [2, 4]); // [1, 3]
350
- * difference(['a', 'b', 'c'], ['b']); // ['a', 'c']
351
- * ```
522
+ * @returns `true` if the value is an empty array; otherwise, `false`.
352
523
  */
353
- const difference = (array, exclude) => array.filter(item => !exclude.includes(item));
524
+ const isEmptyArray = (value) => (0,_array__WEBPACK_IMPORTED_MODULE_0__.isArray)(value) && value.length === 0;
525
+
526
+
527
+ /***/ },
528
+
529
+ /***/ "./src/array/pipe.ts"
530
+ /*!***************************!*\
531
+ !*** ./src/array/pipe.ts ***!
532
+ \***************************/
533
+ (__unused_webpack_module, __webpack_exports__, __webpack_require__) {
534
+
535
+ __webpack_require__.r(__webpack_exports__);
536
+ /* harmony export */ __webpack_require__.d(__webpack_exports__, {
537
+ /* harmony export */ pipe: () => (/* binding */ pipe)
538
+ /* harmony export */ });
354
539
  /**
355
540
  * Composes multiple unary functions into a single function, applying them from left to right.
356
541
  *
@@ -373,27 +558,38 @@ const difference = (array, exclude) => array.filter(item => !exclude.includes(it
373
558
  * ```
374
559
  */
375
560
  const pipe = (...fns) => (arg) => fns.reduce((prev, fn) => fn(prev), arg);
561
+
562
+
563
+ /***/ },
564
+
565
+ /***/ "./src/array/unique.ts"
566
+ /*!*****************************!*\
567
+ !*** ./src/array/unique.ts ***!
568
+ \*****************************/
569
+ (__unused_webpack_module, __webpack_exports__, __webpack_require__) {
570
+
571
+ __webpack_require__.r(__webpack_exports__);
572
+ /* harmony export */ __webpack_require__.d(__webpack_exports__, {
573
+ /* harmony export */ unique: () => (/* binding */ unique)
574
+ /* harmony export */ });
376
575
  /**
377
- * Composes multiple unary functions into a single function, applying them from **right to left**.
576
+ * Returns a new array with duplicate values removed.
378
577
  *
379
- * Often used for building functional pipelines where the innermost function runs first.
380
- * Types are inferred up to 5 chained functions for full type safety.
578
+ * Uses Set for efficient duplicate removal while preserving the original order.
381
579
  *
382
- * @param fns - A list of unary functions to compose.
580
+ * @template T - The type of the items in the array.
383
581
  *
384
- * @returns A new function that applies all functions from right to left.
582
+ * @param array - The input array that may contain duplicate values.
583
+ *
584
+ * @returns A new array with only unique values, maintaining the original order.
385
585
  *
386
586
  * @example
387
587
  * ```ts
388
- * const add = (x: number) => x + 1;
389
- * const double = (x: number) => x * 2;
390
- * const toStr = (x: number) => `Result: ${x}`;
391
- *
392
- * const result = compose(toStr, double, add)(2);
393
- * // => 'Result: 6'
588
+ * unique([1, 2, 2, 3, 1, 4]); // [1, 2, 3, 4]
589
+ * unique(['a', 'b', 'a', 'c']); // ['a', 'b', 'c']
394
590
  * ```
395
591
  */
396
- const compose = (...fns) => (arg) => fns.reduceRight((prev, fn) => fn(prev), arg);
592
+ const unique = (array) => [...new Set(array)];
397
593
 
398
594
 
399
595
  /***/ },
@@ -416,7 +612,7 @@ __webpack_require__.r(__webpack_exports__);
416
612
  /* harmony export */ runSequential: () => (/* binding */ runSequential),
417
613
  /* harmony export */ someAsync: () => (/* binding */ someAsync)
418
614
  /* harmony export */ });
419
- /* harmony import */ var _array__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ~/array */ "./src/array.ts");
615
+ /* harmony import */ var _array__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ~/array */ "./src/array/index.ts");
420
616
  /* harmony import */ var _function__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ~/function */ "./src/function/index.ts");
421
617
 
422
618
 
@@ -1139,35 +1335,38 @@ __webpack_require__.r(__webpack_exports__);
1139
1335
  *
1140
1336
  * ### Behavior
1141
1337
  * - Centering is calculated independently for each enabled axis.
1142
- * - Translation is applied only when the container content overflows on that axis.
1143
- * - When no overflow exists, the container remains untransformed for that axis.
1338
+ * - Raw centering offset is always calculated first.
1339
+ * - Offset clamping is optional and controlled by `shouldClamp`.
1144
1340
  *
1145
1341
  * ### Notes
1146
1342
  * - This function performs immediate DOM reads and writes.
1147
- * - The resulting transform is clamped to valid scrollable bounds.
1148
1343
  *
1149
1344
  * @param containerElement - The container whose content is translated.
1150
1345
  * @param elementToCenter - The descendant element to align to the container’s center.
1151
- * @param options - Optional configuration controlling which axis or axes are centered.
1346
+ * @param options - Optional configuration controlling centering behavior.
1152
1347
  */
1153
- const centerElementInContainer = (containerElement, elementToCenter, { axis = 'both' } = {}) => {
1348
+ const centerElementInContainer = (containerElement, elementToCenter, { axis = 'both', shouldClamp = true } = {}) => {
1154
1349
  let translateX = 0;
1155
1350
  let translateY = 0;
1156
1351
  if (axis === 'x' || axis === 'both') {
1157
- translateX = (0,_geometry__WEBPACK_IMPORTED_MODULE_1__.calculateCenterOffset)({
1158
- overflowSize: (0,_dom__WEBPACK_IMPORTED_MODULE_0__.getXOverflowWidth)(containerElement),
1352
+ const offsetX = (0,_geometry__WEBPACK_IMPORTED_MODULE_1__.calculateCenterOffset)({
1159
1353
  containerSize: containerElement.clientWidth,
1160
1354
  elementOffset: elementToCenter.offsetLeft,
1161
1355
  elementSize: elementToCenter.clientWidth,
1162
1356
  });
1357
+ translateX = shouldClamp
1358
+ ? (0,_geometry__WEBPACK_IMPORTED_MODULE_1__.clampOffsetToOverflow)(offsetX, (0,_dom__WEBPACK_IMPORTED_MODULE_0__.getXOverflowWidth)(containerElement))
1359
+ : offsetX;
1163
1360
  }
1164
1361
  if (axis === 'y' || axis === 'both') {
1165
- translateY = (0,_geometry__WEBPACK_IMPORTED_MODULE_1__.calculateCenterOffset)({
1166
- overflowSize: (0,_dom__WEBPACK_IMPORTED_MODULE_0__.getYOverflowHeight)(containerElement),
1362
+ const offsetY = (0,_geometry__WEBPACK_IMPORTED_MODULE_1__.calculateCenterOffset)({
1167
1363
  containerSize: containerElement.clientHeight,
1168
1364
  elementOffset: elementToCenter.offsetTop,
1169
1365
  elementSize: elementToCenter.clientHeight,
1170
1366
  });
1367
+ translateY = shouldClamp
1368
+ ? (0,_geometry__WEBPACK_IMPORTED_MODULE_1__.clampOffsetToOverflow)(offsetY, (0,_dom__WEBPACK_IMPORTED_MODULE_0__.getYOverflowHeight)(containerElement))
1369
+ : offsetY;
1171
1370
  }
1172
1371
  containerElement.style.transform = `translate(${translateX}px, ${translateY}px)`;
1173
1372
  };
@@ -1837,6 +2036,7 @@ __webpack_require__.r(__webpack_exports__);
1837
2036
  /* harmony export */ __webpack_require__.d(__webpack_exports__, {
1838
2037
  /* harmony export */ applyInertiaStep: () => (/* reexport safe */ _apply_inertia_step__WEBPACK_IMPORTED_MODULE_2__.applyInertiaStep),
1839
2038
  /* harmony export */ calculateCenterOffset: () => (/* reexport safe */ _layout__WEBPACK_IMPORTED_MODULE_0__.calculateCenterOffset),
2039
+ /* harmony export */ clampOffsetToOverflow: () => (/* reexport safe */ _layout__WEBPACK_IMPORTED_MODULE_0__.clampOffsetToOverflow),
1840
2040
  /* harmony export */ resolveBoundedDelta: () => (/* reexport safe */ _resolve_bounded_delta__WEBPACK_IMPORTED_MODULE_1__.resolveBoundedDelta)
1841
2041
  /* harmony export */ });
1842
2042
  /* harmony import */ var _layout__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./layout */ "./src/geometry/layout/index.ts");
@@ -1860,24 +2060,43 @@ __webpack_require__.r(__webpack_exports__);
1860
2060
  /* harmony export */ calculateCenterOffset: () => (/* binding */ calculateCenterOffset)
1861
2061
  /* harmony export */ });
1862
2062
  /**
1863
- * Calculates the offset required to center an element within a container along a single axis.
2063
+ * Calculates the raw offset required to center an element within a container along a single axis.
1864
2064
  *
1865
- * The returned value is clamped so that the resulting translation does not
1866
- * exceed the container's scrollable bounds.
2065
+ * @returns A negative offset value suitable for use in a CSS `translate` transform.
2066
+ */
2067
+ const calculateCenterOffset = ({ containerSize, elementOffset, elementSize, }) => {
2068
+ const containerCenter = containerSize / 2;
2069
+ const elementCenter = elementOffset + elementSize / 2;
2070
+ const targetOffset = elementCenter - containerCenter;
2071
+ return -targetOffset;
2072
+ };
2073
+
2074
+
2075
+ /***/ },
2076
+
2077
+ /***/ "./src/geometry/layout/clamp-offset-to-overflow.ts"
2078
+ /*!*********************************************************!*\
2079
+ !*** ./src/geometry/layout/clamp-offset-to-overflow.ts ***!
2080
+ \*********************************************************/
2081
+ (__unused_webpack_module, __webpack_exports__, __webpack_require__) {
2082
+
2083
+ __webpack_require__.r(__webpack_exports__);
2084
+ /* harmony export */ __webpack_require__.d(__webpack_exports__, {
2085
+ /* harmony export */ clampOffsetToOverflow: () => (/* binding */ clampOffsetToOverflow)
2086
+ /* harmony export */ });
2087
+ /**
2088
+ * Clamps a negative translation offset to the available overflow bounds.
1867
2089
  *
1868
- * This function performs pure math only and does not access the DOM.
2090
+ * @param offset - Negative translate offset.
2091
+ * @param overflowSize - Maximum overflow size along the axis.
1869
2092
  *
1870
- * @returns A negative offset value suitable for use in a CSS `translate`
1871
- * transform, or `0` when no overflow exists on the axis.
2093
+ * @returns Clamped negative offset, or `0` when no overflow exists.
1872
2094
  */
1873
- const calculateCenterOffset = ({ overflowSize, containerSize, elementOffset, elementSize, }) => {
2095
+ const clampOffsetToOverflow = (offset, overflowSize) => {
1874
2096
  if (overflowSize <= 0) {
1875
2097
  return 0;
1876
2098
  }
1877
- const containerCenter = containerSize / 2;
1878
- const elementCenter = elementOffset + elementSize / 2;
1879
- const targetOffset = elementCenter - containerCenter;
1880
- return -Math.max(0, Math.min(targetOffset, overflowSize));
2099
+ return Math.max(-overflowSize, Math.min(offset, 0));
1881
2100
  };
1882
2101
 
1883
2102
 
@@ -1891,9 +2110,12 @@ const calculateCenterOffset = ({ overflowSize, containerSize, elementOffset, ele
1891
2110
 
1892
2111
  __webpack_require__.r(__webpack_exports__);
1893
2112
  /* harmony export */ __webpack_require__.d(__webpack_exports__, {
1894
- /* harmony export */ calculateCenterOffset: () => (/* reexport safe */ _calculate_center_offset__WEBPACK_IMPORTED_MODULE_0__.calculateCenterOffset)
2113
+ /* harmony export */ calculateCenterOffset: () => (/* reexport safe */ _calculate_center_offset__WEBPACK_IMPORTED_MODULE_0__.calculateCenterOffset),
2114
+ /* harmony export */ clampOffsetToOverflow: () => (/* reexport safe */ _clamp_offset_to_overflow__WEBPACK_IMPORTED_MODULE_1__.clampOffsetToOverflow)
1895
2115
  /* harmony export */ });
1896
2116
  /* harmony import */ var _calculate_center_offset__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./calculate-center-offset */ "./src/geometry/layout/calculate-center-offset.ts");
2117
+ /* harmony import */ var _clamp_offset_to_overflow__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./clamp-offset-to-overflow */ "./src/geometry/layout/clamp-offset-to-overflow.ts");
2118
+
1897
2119
 
1898
2120
 
1899
2121
 
@@ -3366,6 +3588,7 @@ __webpack_require__.r(__webpack_exports__);
3366
3588
  /* harmony export */ camelToWords: () => (/* reexport safe */ _string__WEBPACK_IMPORTED_MODULE_13__.camelToWords),
3367
3589
  /* harmony export */ centerElementInContainer: () => (/* reexport safe */ _dom__WEBPACK_IMPORTED_MODULE_3__.centerElementInContainer),
3368
3590
  /* harmony export */ chunk: () => (/* reexport safe */ _array__WEBPACK_IMPORTED_MODULE_1__.chunk),
3591
+ /* harmony export */ clampOffsetToOverflow: () => (/* reexport safe */ _geometry__WEBPACK_IMPORTED_MODULE_7__.clampOffsetToOverflow),
3369
3592
  /* harmony export */ cloneBlob: () => (/* reexport safe */ _dom__WEBPACK_IMPORTED_MODULE_3__.cloneBlob),
3370
3593
  /* harmony export */ compact: () => (/* reexport safe */ _array__WEBPACK_IMPORTED_MODULE_1__.compact),
3371
3594
  /* harmony export */ compose: () => (/* reexport safe */ _array__WEBPACK_IMPORTED_MODULE_1__.compose),
@@ -3382,6 +3605,7 @@ __webpack_require__.r(__webpack_exports__);
3382
3605
  /* harmony export */ flattenTree: () => (/* reexport safe */ _tree__WEBPACK_IMPORTED_MODULE_14__.flattenTree),
3383
3606
  /* harmony export */ forEachChar: () => (/* reexport safe */ _string__WEBPACK_IMPORTED_MODULE_13__.forEachChar),
3384
3607
  /* harmony export */ generateEphemeralId: () => (/* reexport safe */ _id__WEBPACK_IMPORTED_MODULE_9__.generateEphemeralId),
3608
+ /* harmony export */ getAdjacentItems: () => (/* reexport safe */ _array__WEBPACK_IMPORTED_MODULE_1__.getAdjacentItems),
3385
3609
  /* harmony export */ getDOMRectIntersectionRatio: () => (/* reexport safe */ _intersection__WEBPACK_IMPORTED_MODULE_10__.getDOMRectIntersectionRatio),
3386
3610
  /* harmony export */ getDataTransferJson: () => (/* reexport safe */ _dom__WEBPACK_IMPORTED_MODULE_3__.getDataTransferJson),
3387
3611
  /* harmony export */ getElementOffsetRect: () => (/* reexport safe */ _dom__WEBPACK_IMPORTED_MODULE_3__.getElementOffsetRect),
@@ -3452,7 +3676,7 @@ __webpack_require__.r(__webpack_exports__);
3452
3676
  /* harmony export */ unique: () => (/* reexport safe */ _array__WEBPACK_IMPORTED_MODULE_1__.unique)
3453
3677
  /* harmony export */ });
3454
3678
  /* harmony import */ var _a11y__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./a11y */ "./src/a11y/index.ts");
3455
- /* harmony import */ var _array__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./array */ "./src/array.ts");
3679
+ /* harmony import */ var _array__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./array */ "./src/array/index.ts");
3456
3680
  /* harmony import */ var _async__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./async */ "./src/async/index.ts");
3457
3681
  /* harmony import */ var _dom__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./dom */ "./src/dom/index.ts");
3458
3682
  /* harmony import */ var _env__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./env */ "./src/env/index.ts");