@enact/ui 5.5.2 → 5.7.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.
Files changed (122) hide show
  1. package/AnnounceDecorator/Announce.js +8 -8
  2. package/AnnounceDecorator/AnnounceDecorator.js +5 -5
  3. package/BodyText/BodyText.js +5 -5
  4. package/BodyText/tests/BodyText-specs.js +2 -1
  5. package/Button/Button.js +5 -5
  6. package/CHANGELOG.md +24 -0
  7. package/Cancelable/Cancelable.js +9 -9
  8. package/Cancelable/tests/Cancelable-specs.js +5 -5
  9. package/Card/Card.js +5 -5
  10. package/Card/tests/Card-specs.js +2 -1
  11. package/Changeable/Changeable.js +9 -9
  12. package/ComponentOverride/ComponentOverride.js +15 -11
  13. package/FloatingLayer/FloatingLayer.js +10 -10
  14. package/FloatingLayer/FloatingLayerContainer.js +3 -3
  15. package/FloatingLayer/FloatingLayerDecorator.js +5 -5
  16. package/FloatingLayer/Scrim.js +9 -9
  17. package/FloatingLayer/tests/useFloatingLayerDecorator-specs.js +4 -4
  18. package/FloatingLayer/useFloatingLayer.js +3 -4
  19. package/ForwardRef/ForwardRef.js +5 -5
  20. package/Group/Group.js +5 -5
  21. package/Group/GroupItem.js +5 -5
  22. package/Group/tests/Group-specs.js +2 -1
  23. package/Heading/Heading.js +5 -5
  24. package/Icon/Icon.js +5 -5
  25. package/Icon/tests/Icon-specs.js +2 -1
  26. package/Image/Image.d.ts +15 -0
  27. package/Image/Image.js +41 -11
  28. package/Image/tests/Image-specs.js +2 -1
  29. package/ImageItem/ImageItem.js +5 -5
  30. package/ImageItem/tests/ImageItem-specs.js +6 -5
  31. package/Item/Item.js +5 -5
  32. package/LabeledIcon/LabeledIcon.js +5 -5
  33. package/Layout/Cell.js +5 -5
  34. package/Layout/Layout.js +5 -5
  35. package/Layout/tests/Layout-specs.js +9 -9
  36. package/Marquee/Marquee.module.css +44 -0
  37. package/Marquee/MarqueeBase.js +134 -21
  38. package/Marquee/MarqueeController.js +4 -4
  39. package/Marquee/MarqueeDecorator.js +219 -27
  40. package/Marquee/index.d.ts +60 -12
  41. package/Marquee/tests/Marquee-specs.js +3 -3
  42. package/Marquee/tests/Marquee-vertical-specs.js +1358 -0
  43. package/Marquee/useMarqueeController.js +4 -4
  44. package/Marquee/utils.js +22 -0
  45. package/Marquee/verticalMeasure.js +118 -0
  46. package/Measurable/Measurable.js +8 -9
  47. package/Measurable/tests/Measurable-specs.js +7 -6
  48. package/Media/Media.js +10 -10
  49. package/Placeholder/PlaceholderControllerDecorator.js +9 -9
  50. package/Placeholder/PlaceholderDecorator.js +9 -9
  51. package/Placeholder/tests/PlaceholderControllerDecorator-specs.js +4 -4
  52. package/ProgressBar/ProgressBar.js +5 -5
  53. package/Repeater/Repeater.js +5 -5
  54. package/Repeater/tests/Repeater-specs.js +6 -5
  55. package/Resizable/Resizable.js +4 -4
  56. package/Resizable/tests/Resizable-specs.js +2 -1
  57. package/Resizable/tests/useResize-specs.js +4 -4
  58. package/Resizable/useResize.js +3 -3
  59. package/Routable/Link.js +9 -9
  60. package/Routable/Routable.js +5 -5
  61. package/Routable/Router.js +9 -9
  62. package/Routable/tests/Routable-specs.js +7 -8
  63. package/Routable/tests/Router-specs.js +1 -1
  64. package/Scroller/Scroller.js +4 -4
  65. package/Scroller/ScrollerBasic.js +10 -10
  66. package/Skinnable/Skinnable.js +5 -5
  67. package/Skinnable/tests/Skinnable-specs.js +4 -4
  68. package/Skinnable/tests/useSkins-specs.js +4 -4
  69. package/Slider/Knob.js +5 -5
  70. package/Slider/PositionDecorator.js +8 -8
  71. package/Slider/Slider.js +5 -5
  72. package/Slottable/Slottable.js +4 -4
  73. package/Slottable/useSlots.js +5 -5
  74. package/Spinner/Spinner.js +5 -5
  75. package/ToggleIcon/ToggleIcon.js +5 -5
  76. package/Toggleable/Toggle.js +5 -5
  77. package/Toggleable/Toggleable.js +9 -9
  78. package/Toggleable/useToggle.js +5 -5
  79. package/Touchable/ClickAllow.js +3 -3
  80. package/Touchable/Drag.js +6 -6
  81. package/Touchable/Flick.js +5 -5
  82. package/Touchable/Hold.js +5 -5
  83. package/Touchable/Pinch.js +6 -6
  84. package/Touchable/Touch.js +3 -3
  85. package/Touchable/Touchable.js +5 -5
  86. package/Touchable/config.js +4 -4
  87. package/Touchable/tests/Touchable-specs.js +1 -1
  88. package/Touchable/tests/useTouch-specs.js +5 -5
  89. package/Touchable/useTouch.js +7 -8
  90. package/Transition/Transition.js +16 -15
  91. package/Transition/tests/Transition-specs.js +9 -9
  92. package/ViewManager/Arranger.js +4 -4
  93. package/ViewManager/TransitionGroup.js +7 -7
  94. package/ViewManager/View.js +9 -9
  95. package/ViewManager/ViewManager.js +11 -10
  96. package/ViewManager/tests/ViewManager-specs.js +6 -6
  97. package/VirtualList/VirtualList.js +4 -4
  98. package/VirtualList/VirtualListBasic.js +67 -47
  99. package/VirtualList/tests/VirtualGridList-native-specs.js +5 -5
  100. package/VirtualList/tests/VirtualGridList-specs.js +16 -15
  101. package/VirtualList/tests/VirtualList-native-specs.js +164 -16
  102. package/VirtualList/tests/VirtualList-specs.js +16 -15
  103. package/internal/IdProvider/IdProvider.js +4 -4
  104. package/internal/IdProvider/Provider.js +3 -3
  105. package/internal/IdProvider/tests/IdProvider-specs.js +4 -4
  106. package/internal/IdProvider/tests/useId-specs.js +16 -8
  107. package/internal/Pure/Pure.js +9 -9
  108. package/internal/Pure/tests/Pure-specs.js +8 -8
  109. package/internal/localized-fonts/localized-fonts.js +3 -4
  110. package/package.json +6 -6
  111. package/resolution/ResolutionDecorator.js +71 -87
  112. package/resolution/index.js +2 -1
  113. package/resolution/tests/resolution-specs.js +7 -8
  114. package/useControlledState/tests/useControlledState-specs.js +3 -4
  115. package/useControlledState/useControlledState.js +3 -4
  116. package/useScroll/ScrollAnimator.js +3 -3
  117. package/useScroll/Scrollbar.js +5 -5
  118. package/useScroll/ScrollbarTrack.js +5 -5
  119. package/useScroll/scrollMotion.js +126 -0
  120. package/useScroll/tests/scrollMotion-specs.js +215 -0
  121. package/useScroll/tests/useScroll-specs.js +430 -9
  122. package/useScroll/useScroll.js +156 -92
@@ -11,20 +11,20 @@ var _Arranger = require("./Arranger");
11
11
  var _jsxRuntime = require("react/jsx-runtime");
12
12
  function _interopRequireDefault(e) { return e && e.__esModule ? e : { "default": e }; }
13
13
  function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
14
- function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
15
- function _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }
14
+ function _objectSpread(r) { for (var t = 1; t < arguments.length; t++) { var o = null != arguments[t] ? arguments[t] : {}; t % 2 ? ownKeys(Object(o), !0).forEach(function (t) { _defineProperty(r, t, o[t]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(r, Object.getOwnPropertyDescriptors(o)) : ownKeys(Object(o)).forEach(function (e) { Object.defineProperty(r, e, Object.getOwnPropertyDescriptor(o, e)); }); } return r; }
15
+ function _defineProperty(r, t, o) { return (t = _toPropertyKey(t)) in r ? Object.defineProperty(r, t, { value: o, enumerable: !0, configurable: !0, writable: !0 }) : r[t] = o, r; }
16
16
  function _classCallCheck(a, n) { if (!(a instanceof n)) throw new TypeError("Cannot call a class as a function"); }
17
- function _defineProperties(e, r) { for (var t = 0; t < r.length; t++) { var o = r[t]; o.enumerable = o.enumerable || !1, o.configurable = !0, "value" in o && (o.writable = !0), Object.defineProperty(e, _toPropertyKey(o.key), o); } }
17
+ function _defineProperties(r, t) { for (var o = 0; o < t.length; o++) { var i = t[o]; i.enumerable = i.enumerable || !1, i.configurable = !0, "value" in i && (i.writable = !0), Object.defineProperty(r, _toPropertyKey(i.key), i); } }
18
18
  function _createClass(e, r, t) { return r && _defineProperties(e.prototype, r), t && _defineProperties(e, t), Object.defineProperty(e, "prototype", { writable: !1 }), e; }
19
- function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == typeof i ? i : i + ""; }
20
- function _toPrimitive(t, r) { if ("object" != typeof t || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != typeof i) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
21
- function _callSuper(t, o, e) { return o = _getPrototypeOf(o), _possibleConstructorReturn(t, _isNativeReflectConstruct() ? Reflect.construct(o, e || [], _getPrototypeOf(t).constructor) : o.apply(t, e)); }
19
+ function _toPropertyKey(r) { var o = _toPrimitive(r, "string"); return "symbol" == typeof o ? o : o + ""; }
20
+ function _toPrimitive(t, e) { if ("object" != typeof t || !t) return t; var r; if ("undefined" != typeof Symbol && void 0 !== (r = t[Symbol.toPrimitive])) { var i = r.call(t, e || "default"); if ("object" != typeof i) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === e ? String : Number)(t); }
21
+ function _inherits(t, r) { if ("function" != typeof r && null !== r) throw new TypeError("Super expression must either be null or a function"); t.prototype = Object.create(r && r.prototype, { constructor: { value: t, writable: !0, configurable: !0 } }), Object.defineProperty(t, "prototype", { writable: !1 }), r && _setPrototypeOf(t, r); }
22
+ function _setPrototypeOf(t, e) { return _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function (t, e) { return t.__proto__ = e, t; }, _setPrototypeOf(t, e); }
23
+ function _callSuper(e, c, p) { return c = _getPrototypeOf(c), _possibleConstructorReturn(e, _isNativeReflectConstruct() ? Reflect.construct(c, p || [], _getPrototypeOf(e).constructor) : c.apply(e, p)); }
22
24
  function _possibleConstructorReturn(t, e) { if (e && ("object" == typeof e || "function" == typeof e)) return e; if (void 0 !== e) throw new TypeError("Derived constructors may only return object or undefined"); return _assertThisInitialized(t); }
23
25
  function _assertThisInitialized(e) { if (void 0 === e) throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); return e; }
24
26
  function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); }
25
- function _getPrototypeOf(t) { return _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function (t) { return t.__proto__ || Object.getPrototypeOf(t); }, _getPrototypeOf(t); }
26
- function _inherits(t, e) { if ("function" != typeof e && null !== e) throw new TypeError("Super expression must either be null or a function"); t.prototype = Object.create(e && e.prototype, { constructor: { value: t, writable: !0, configurable: !0 } }), Object.defineProperty(t, "prototype", { writable: !1 }), e && _setPrototypeOf(t, e); }
27
- function _setPrototypeOf(t, e) { return _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function (t, e) { return t.__proto__ = e, t; }, _setPrototypeOf(t, e); } /*
27
+ function _getPrototypeOf(t) { return _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function (t) { return t.__proto__ || Object.getPrototypeOf(t); }, _getPrototypeOf(t); } /*
28
28
  * Exports the {@link ui/ViewManager.View} component.
29
29
  */ // If the View was "appearing", then entering will always be false and this will not result in a
30
30
  // re-render. If the view should enter, state.enter will be true and this will toggle it to false
@@ -55,25 +55,26 @@ var _Class;
55
55
  * @ui
56
56
  * @public
57
57
  */
58
- function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function _interopRequireWildcard(e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, "default": e }; if (null === e || "object" != typeof e && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (var _t in e) "default" !== _t && {}.hasOwnProperty.call(e, _t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, _t)) && (i.get || i.set) ? o(f, _t, i) : f[_t] = e[_t]); return f; })(e, t); }
58
+ var e;
59
+ function _interopRequireWildcard(t, r) { if (!r && t && t.__esModule) return t; var n, a, o = Object.defineProperty, f = { __proto__: null, "default": t }; if (Object(t) !== t) return f; if (e || "function" != typeof WeakMap || (e = new WeakMap()), e) { if (e.has(t)) return e.get(t); e.set(t, f); } for (a in t) "default" !== a && {}.hasOwnProperty.call(t, a) && ((n = o && Object.getOwnPropertyDescriptor(t, a)) && (n.get || n.set) ? o(f, a, n) : f[a] = t[a]); return f; }
59
60
  function _interopRequireDefault(e) { return e && e.__esModule ? e : { "default": e }; }
60
61
  function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
61
- function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
62
- function _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }
63
- function _objectWithoutProperties(e, t) { if (null == e) return {}; var o, r, i = _objectWithoutPropertiesLoose(e, t); if (Object.getOwnPropertySymbols) { var n = Object.getOwnPropertySymbols(e); for (r = 0; r < n.length; r++) o = n[r], -1 === t.indexOf(o) && {}.propertyIsEnumerable.call(e, o) && (i[o] = e[o]); } return i; }
62
+ function _objectSpread(r) { for (var t = 1; t < arguments.length; t++) { var o = null != arguments[t] ? arguments[t] : {}; t % 2 ? ownKeys(Object(o), !0).forEach(function (t) { _defineProperty(r, t, o[t]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(r, Object.getOwnPropertyDescriptors(o)) : ownKeys(Object(o)).forEach(function (e) { Object.defineProperty(r, e, Object.getOwnPropertyDescriptor(o, e)); }); } return r; }
63
+ function _defineProperty(r, t, o) { return (t = _toPropertyKey(t)) in r ? Object.defineProperty(r, t, { value: o, enumerable: !0, configurable: !0, writable: !0 }) : r[t] = o, r; }
64
+ function _objectWithoutProperties(t, r) { if (null == t) return {}; var o, n, i = _objectWithoutPropertiesLoose(t, r); if (Object.getOwnPropertySymbols) { var l = Object.getOwnPropertySymbols(t); for (n = 0; n < l.length; n++) o = l[n], -1 === r.indexOf(o) && {}.propertyIsEnumerable.call(t, o) && (i[o] = t[o]); } return i; }
64
65
  function _objectWithoutPropertiesLoose(r, e) { if (null == r) return {}; var t = {}; for (var n in r) if ({}.hasOwnProperty.call(r, n)) { if (-1 !== e.indexOf(n)) continue; t[n] = r[n]; } return t; }
65
66
  function _classCallCheck(a, n) { if (!(a instanceof n)) throw new TypeError("Cannot call a class as a function"); }
66
- function _defineProperties(e, r) { for (var t = 0; t < r.length; t++) { var o = r[t]; o.enumerable = o.enumerable || !1, o.configurable = !0, "value" in o && (o.writable = !0), Object.defineProperty(e, _toPropertyKey(o.key), o); } }
67
+ function _defineProperties(r, t) { for (var o = 0; o < t.length; o++) { var i = t[o]; i.enumerable = i.enumerable || !1, i.configurable = !0, "value" in i && (i.writable = !0), Object.defineProperty(r, _toPropertyKey(i.key), i); } }
67
68
  function _createClass(e, r, t) { return r && _defineProperties(e.prototype, r), t && _defineProperties(e, t), Object.defineProperty(e, "prototype", { writable: !1 }), e; }
68
- function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == typeof i ? i : i + ""; }
69
- function _toPrimitive(t, r) { if ("object" != typeof t || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != typeof i) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
70
- function _callSuper(t, o, e) { return o = _getPrototypeOf(o), _possibleConstructorReturn(t, _isNativeReflectConstruct() ? Reflect.construct(o, e || [], _getPrototypeOf(t).constructor) : o.apply(t, e)); }
69
+ function _toPropertyKey(r) { var o = _toPrimitive(r, "string"); return "symbol" == typeof o ? o : o + ""; }
70
+ function _toPrimitive(t, e) { if ("object" != typeof t || !t) return t; var r; if ("undefined" != typeof Symbol && void 0 !== (r = t[Symbol.toPrimitive])) { var i = r.call(t, e || "default"); if ("object" != typeof i) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === e ? String : Number)(t); }
71
+ function _inherits(t, r) { if ("function" != typeof r && null !== r) throw new TypeError("Super expression must either be null or a function"); t.prototype = Object.create(r && r.prototype, { constructor: { value: t, writable: !0, configurable: !0 } }), Object.defineProperty(t, "prototype", { writable: !1 }), r && _setPrototypeOf(t, r); }
72
+ function _setPrototypeOf(t, e) { return _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function (t, e) { return t.__proto__ = e, t; }, _setPrototypeOf(t, e); }
73
+ function _callSuper(e, c, p) { return c = _getPrototypeOf(c), _possibleConstructorReturn(e, _isNativeReflectConstruct() ? Reflect.construct(c, p || [], _getPrototypeOf(e).constructor) : c.apply(e, p)); }
71
74
  function _possibleConstructorReturn(t, e) { if (e && ("object" == typeof e || "function" == typeof e)) return e; if (void 0 !== e) throw new TypeError("Derived constructors may only return object or undefined"); return _assertThisInitialized(t); }
72
75
  function _assertThisInitialized(e) { if (void 0 === e) throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); return e; }
73
76
  function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); }
74
77
  function _getPrototypeOf(t) { return _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function (t) { return t.__proto__ || Object.getPrototypeOf(t); }, _getPrototypeOf(t); }
75
- function _inherits(t, e) { if ("function" != typeof e && null !== e) throw new TypeError("Super expression must either be null or a function"); t.prototype = Object.create(e && e.prototype, { constructor: { value: t, writable: !0, configurable: !0 } }), Object.defineProperty(t, "prototype", { writable: !1 }), e && _setPrototypeOf(t, e); }
76
- function _setPrototypeOf(t, e) { return _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function (t, e) { return t.__proto__ = e, t; }, _setPrototypeOf(t, e); }
77
78
  var ViewManagerBase = exports.ViewManagerBase = (_Class = /*#__PURE__*/function (_Component) {
78
79
  function ViewManagerBase(props) {
79
80
  var _this;
@@ -11,17 +11,17 @@ function _interopRequireDefault(e) { return e && e.__esModule ? e : { "default":
11
11
  function asyncGeneratorStep(n, t, e, r, o, a, c) { try { var i = n[a](c), u = i.value; } catch (n) { return void e(n); } i.done ? t(u) : Promise.resolve(u).then(r, o); }
12
12
  function _asyncToGenerator(n) { return function () { var t = this, e = arguments; return new Promise(function (r, o) { var a = n.apply(t, e); function _next(n) { asyncGeneratorStep(a, r, o, _next, _throw, "next", n); } function _throw(n) { asyncGeneratorStep(a, r, o, _next, _throw, "throw", n); } _next(void 0); }); }; }
13
13
  function _classCallCheck(a, n) { if (!(a instanceof n)) throw new TypeError("Cannot call a class as a function"); }
14
- function _defineProperties(e, r) { for (var t = 0; t < r.length; t++) { var o = r[t]; o.enumerable = o.enumerable || !1, o.configurable = !0, "value" in o && (o.writable = !0), Object.defineProperty(e, _toPropertyKey(o.key), o); } }
14
+ function _defineProperties(r, t) { for (var o = 0; o < t.length; o++) { var i = t[o]; i.enumerable = i.enumerable || !1, i.configurable = !0, "value" in i && (i.writable = !0), Object.defineProperty(r, _toPropertyKey(i.key), i); } }
15
15
  function _createClass(e, r, t) { return r && _defineProperties(e.prototype, r), t && _defineProperties(e, t), Object.defineProperty(e, "prototype", { writable: !1 }), e; }
16
- function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == typeof i ? i : i + ""; }
17
- function _toPrimitive(t, r) { if ("object" != typeof t || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != typeof i) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
18
- function _callSuper(t, o, e) { return o = _getPrototypeOf(o), _possibleConstructorReturn(t, _isNativeReflectConstruct() ? Reflect.construct(o, e || [], _getPrototypeOf(t).constructor) : o.apply(t, e)); }
16
+ function _toPropertyKey(r) { var o = _toPrimitive(r, "string"); return "symbol" == typeof o ? o : o + ""; }
17
+ function _toPrimitive(t, e) { if ("object" != typeof t || !t) return t; var r; if ("undefined" != typeof Symbol && void 0 !== (r = t[Symbol.toPrimitive])) { var i = r.call(t, e || "default"); if ("object" != typeof i) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === e ? String : Number)(t); }
18
+ function _inherits(t, r) { if ("function" != typeof r && null !== r) throw new TypeError("Super expression must either be null or a function"); t.prototype = Object.create(r && r.prototype, { constructor: { value: t, writable: !0, configurable: !0 } }), Object.defineProperty(t, "prototype", { writable: !1 }), r && _setPrototypeOf(t, r); }
19
+ function _setPrototypeOf(t, e) { return _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function (t, e) { return t.__proto__ = e, t; }, _setPrototypeOf(t, e); }
20
+ function _callSuper(e, c, p) { return c = _getPrototypeOf(c), _possibleConstructorReturn(e, _isNativeReflectConstruct() ? Reflect.construct(c, p || [], _getPrototypeOf(e).constructor) : c.apply(e, p)); }
19
21
  function _possibleConstructorReturn(t, e) { if (e && ("object" == typeof e || "function" == typeof e)) return e; if (void 0 !== e) throw new TypeError("Derived constructors may only return object or undefined"); return _assertThisInitialized(t); }
20
22
  function _assertThisInitialized(e) { if (void 0 === e) throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); return e; }
21
23
  function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); }
22
24
  function _getPrototypeOf(t) { return _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function (t) { return t.__proto__ || Object.getPrototypeOf(t); }, _getPrototypeOf(t); }
23
- function _inherits(t, e) { if ("function" != typeof e && null !== e) throw new TypeError("Super expression must either be null or a function"); t.prototype = Object.create(e && e.prototype, { constructor: { value: t, writable: !0, configurable: !0 } }), Object.defineProperty(t, "prototype", { writable: !1 }), e && _setPrototypeOf(t, e); }
24
- function _setPrototypeOf(t, e) { return _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function (t, e) { return t.__proto__ = e, t; }, _setPrototypeOf(t, e); }
25
25
  describe('ViewManager', function () {
26
26
  // Suite-wide setup
27
27
  beforeEach(function () {
@@ -32,10 +32,10 @@ var _VirtualListBasic = require("./VirtualListBasic");
32
32
  var _jsxRuntime = require("react/jsx-runtime");
33
33
  function _interopRequireDefault(e) { return e && e.__esModule ? e : { "default": e }; }
34
34
  function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
35
- function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
36
- function _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }
37
- function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == typeof i ? i : i + ""; }
38
- function _toPrimitive(t, r) { if ("object" != typeof t || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != typeof i) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); } /**
35
+ function _objectSpread(r) { for (var t = 1; t < arguments.length; t++) { var o = null != arguments[t] ? arguments[t] : {}; t % 2 ? ownKeys(Object(o), !0).forEach(function (t) { _defineProperty(r, t, o[t]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(r, Object.getOwnPropertyDescriptors(o)) : ownKeys(Object(o)).forEach(function (e) { Object.defineProperty(r, e, Object.getOwnPropertyDescriptor(o, e)); }); } return r; }
36
+ function _defineProperty(r, t, o) { return (t = _toPropertyKey(t)) in r ? Object.defineProperty(r, t, { value: o, enumerable: !0, configurable: !0, writable: !0 }) : r[t] = o, r; }
37
+ function _toPropertyKey(r) { var o = _toPrimitive(r, "string"); return "symbol" == typeof o ? o : o + ""; }
38
+ function _toPrimitive(t, e) { if ("object" != typeof t || !t) return t; var r; if ("undefined" != typeof Symbol && void 0 !== (r = t[Symbol.toPrimitive])) { var i = r.call(t, e || "default"); if ("object" != typeof i) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === e ? String : Number)(t); } /**
39
39
  * Unstyled virtual list components and behaviors to be customized by a theme or application.
40
40
  *
41
41
  * @module ui/VirtualList
@@ -16,30 +16,30 @@ var _VirtualListModule = _interopRequireDefault(require("./VirtualList.module.cs
16
16
  var _jsxRuntime = require("react/jsx-runtime");
17
17
  var _excluded = ["className", "containerProps", "placeholderRenderer", "role", "style", "scrollMode"];
18
18
  function _interopRequireDefault(e) { return e && e.__esModule ? e : { "default": e }; }
19
- function _objectWithoutProperties(e, t) { if (null == e) return {}; var o, r, i = _objectWithoutPropertiesLoose(e, t); if (Object.getOwnPropertySymbols) { var n = Object.getOwnPropertySymbols(e); for (r = 0; r < n.length; r++) o = n[r], -1 === t.indexOf(o) && {}.propertyIsEnumerable.call(e, o) && (i[o] = e[o]); } return i; }
19
+ function _objectWithoutProperties(t, r) { if (null == t) return {}; var o, n, i = _objectWithoutPropertiesLoose(t, r); if (Object.getOwnPropertySymbols) { var l = Object.getOwnPropertySymbols(t); for (n = 0; n < l.length; n++) o = l[n], -1 === r.indexOf(o) && {}.propertyIsEnumerable.call(t, o) && (i[o] = t[o]); } return i; }
20
20
  function _objectWithoutPropertiesLoose(r, e) { if (null == r) return {}; var t = {}; for (var n in r) if ({}.hasOwnProperty.call(r, n)) { if (-1 !== e.indexOf(n)) continue; t[n] = r[n]; } return t; }
21
21
  function _readOnlyError(r) { throw new TypeError('"' + r + '" is read-only'); }
22
- function _toConsumableArray(r) { return _arrayWithoutHoles(r) || _iterableToArray(r) || _unsupportedIterableToArray(r) || _nonIterableSpread(); }
22
+ function _toConsumableArray(a) { return _arrayWithoutHoles(a) || _iterableToArray(a) || _unsupportedIterableToArray(a) || _nonIterableSpread(); }
23
23
  function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
24
- function _unsupportedIterableToArray(r, a) { if (r) { if ("string" == typeof r) return _arrayLikeToArray(r, a); var t = {}.toString.call(r).slice(8, -1); return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : void 0; } }
25
- function _iterableToArray(r) { if ("undefined" != typeof Symbol && null != r[Symbol.iterator] || null != r["@@iterator"]) return Array.from(r); }
26
- function _arrayWithoutHoles(r) { if (Array.isArray(r)) return _arrayLikeToArray(r); }
24
+ function _unsupportedIterableToArray(t, e) { if (t) { if ("string" == typeof t) return _arrayLikeToArray(t, e); var o = {}.toString.call(t).slice(8, -1); return "Object" === o && t.constructor && (o = t.constructor.name), "Map" === o || "Set" === o ? Array.from(t) : "Arguments" === o || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(o) ? _arrayLikeToArray(t, e) : void 0; } }
25
+ function _iterableToArray(r) { var e = "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (Array.isArray(r) && (null == e || e === ("undefined" != typeof Symbol && [][Symbol.iterator]) || e === []["@@iterator"])) return r; if (null != e) { for (var t, o = [], a = e.call(r); !(t = a.next()).done;) o.push(t.value); return o; } }
26
+ function _arrayWithoutHoles(a) { if (Array.isArray(a)) return _arrayLikeToArray(a); }
27
27
  function _arrayLikeToArray(r, a) { (null == a || a > r.length) && (a = r.length); for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e]; return n; }
28
28
  function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
29
- function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
30
- function _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }
29
+ function _objectSpread(r) { for (var t = 1; t < arguments.length; t++) { var o = null != arguments[t] ? arguments[t] : {}; t % 2 ? ownKeys(Object(o), !0).forEach(function (t) { _defineProperty(r, t, o[t]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(r, Object.getOwnPropertyDescriptors(o)) : ownKeys(Object(o)).forEach(function (e) { Object.defineProperty(r, e, Object.getOwnPropertyDescriptor(o, e)); }); } return r; }
30
+ function _defineProperty(r, t, o) { return (t = _toPropertyKey(t)) in r ? Object.defineProperty(r, t, { value: o, enumerable: !0, configurable: !0, writable: !0 }) : r[t] = o, r; }
31
31
  function _classCallCheck(a, n) { if (!(a instanceof n)) throw new TypeError("Cannot call a class as a function"); }
32
- function _defineProperties(e, r) { for (var t = 0; t < r.length; t++) { var o = r[t]; o.enumerable = o.enumerable || !1, o.configurable = !0, "value" in o && (o.writable = !0), Object.defineProperty(e, _toPropertyKey(o.key), o); } }
32
+ function _defineProperties(r, t) { for (var o = 0; o < t.length; o++) { var i = t[o]; i.enumerable = i.enumerable || !1, i.configurable = !0, "value" in i && (i.writable = !0), Object.defineProperty(r, _toPropertyKey(i.key), i); } }
33
33
  function _createClass(e, r, t) { return r && _defineProperties(e.prototype, r), t && _defineProperties(e, t), Object.defineProperty(e, "prototype", { writable: !1 }), e; }
34
- function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == typeof i ? i : i + ""; }
35
- function _toPrimitive(t, r) { if ("object" != typeof t || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != typeof i) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
36
- function _callSuper(t, o, e) { return o = _getPrototypeOf(o), _possibleConstructorReturn(t, _isNativeReflectConstruct() ? Reflect.construct(o, e || [], _getPrototypeOf(t).constructor) : o.apply(t, e)); }
34
+ function _toPropertyKey(r) { var o = _toPrimitive(r, "string"); return "symbol" == typeof o ? o : o + ""; }
35
+ function _toPrimitive(t, e) { if ("object" != typeof t || !t) return t; var r; if ("undefined" != typeof Symbol && void 0 !== (r = t[Symbol.toPrimitive])) { var i = r.call(t, e || "default"); if ("object" != typeof i) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === e ? String : Number)(t); }
36
+ function _inherits(t, r) { if ("function" != typeof r && null !== r) throw new TypeError("Super expression must either be null or a function"); t.prototype = Object.create(r && r.prototype, { constructor: { value: t, writable: !0, configurable: !0 } }), Object.defineProperty(t, "prototype", { writable: !1 }), r && _setPrototypeOf(t, r); }
37
+ function _setPrototypeOf(t, e) { return _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function (t, e) { return t.__proto__ = e, t; }, _setPrototypeOf(t, e); }
38
+ function _callSuper(e, c, p) { return c = _getPrototypeOf(c), _possibleConstructorReturn(e, _isNativeReflectConstruct() ? Reflect.construct(c, p || [], _getPrototypeOf(e).constructor) : c.apply(e, p)); }
37
39
  function _possibleConstructorReturn(t, e) { if (e && ("object" == typeof e || "function" == typeof e)) return e; if (void 0 !== e) throw new TypeError("Derived constructors may only return object or undefined"); return _assertThisInitialized(t); }
38
40
  function _assertThisInitialized(e) { if (void 0 === e) throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); return e; }
39
41
  function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); }
40
42
  function _getPrototypeOf(t) { return _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function (t) { return t.__proto__ || Object.getPrototypeOf(t); }, _getPrototypeOf(t); }
41
- function _inherits(t, e) { if ("function" != typeof e && null !== e) throw new TypeError("Super expression must either be null or a function"); t.prototype = Object.create(e && e.prototype, { constructor: { value: t, writable: !0, configurable: !0 } }), Object.defineProperty(t, "prototype", { writable: !1 }), e && _setPrototypeOf(t, e); }
42
- function _setPrototypeOf(t, e) { return _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function (t, e) { return t.__proto__ = e, t; }, _setPrototypeOf(t, e); }
43
43
  var nop = function nop() {};
44
44
 
45
45
  /**
@@ -171,7 +171,7 @@ var VirtualListBasic = exports.VirtualListBasic = /*#__PURE__*/function (_Compon
171
171
  scrollBounds = _this2.scrollBounds;
172
172
  var maxPos = isPrimaryDirectionVertical ? scrollBounds.maxTop : scrollBounds.maxLeft;
173
173
  var position = _this.getGridPosition(index);
174
- var offset = 0;
174
+ var offset;
175
175
  var marginOffset = isPrimaryDirectionVertical ? _this.itemMarginTop + _this.itemMarginBottom : _this.itemMarginLeft + _this.itemMarginRight;
176
176
  if (stickTo === 'start') {
177
177
  // 'start'
@@ -319,10 +319,10 @@ var VirtualListBasic = exports.VirtualListBasic = /*#__PURE__*/function (_Compon
319
319
  }, key);
320
320
  };
321
321
  _this.getScrollHeight = function () {
322
- return _this.isPrimaryDirectionVertical ? _this.getVirtualScrollDimension() + _this.props.getAffordance() : _this.scrollBounds.clientHeight;
322
+ return _this.isPrimaryDirectionVertical ? _this.getVirtualScrollDimension() + _this.props.getAffordance() + _this.itemMarginTop + _this.itemMarginBottom : _this.scrollBounds.clientHeight;
323
323
  };
324
324
  _this.getScrollWidth = function () {
325
- return _this.isPrimaryDirectionVertical ? _this.scrollBounds.clientWidth : _this.getVirtualScrollDimension();
325
+ return _this.isPrimaryDirectionVertical ? _this.scrollBounds.clientWidth : _this.getVirtualScrollDimension() + _this.itemMarginLeft + _this.itemMarginRight;
326
326
  };
327
327
  _this.getVirtualScrollDimension = function () {
328
328
  if (_this.props.itemSizes) {
@@ -383,6 +383,8 @@ var VirtualListBasic = exports.VirtualListBasic = /*#__PURE__*/function (_Compon
383
383
  function componentDidMount() {
384
384
  if (!this.props.clientSize) {
385
385
  this.calculateMetrics(this.props);
386
+ // The metrics are measured from the rendered DOM, so they can only be stored after the first render
387
+ // eslint-disable-next-line @eslint-react/no-set-state-in-component-did-mount
386
388
  this.setState(this.getStatesAndUpdateBounds(this.props));
387
389
  } else {
388
390
  this.emitUpdateItems();
@@ -404,15 +406,7 @@ var VirtualListBasic = exports.VirtualListBasic = /*#__PURE__*/function (_Compon
404
406
  this.itemMarginBottom = Number(firstItemStyle.getPropertyValue('margin-bottom').slice(0, -2));
405
407
  this.itemMarginLeft = Number(firstItemStyle.getPropertyValue('margin-left').slice(0, -2));
406
408
  this.itemMarginRight = Number(firstItemStyle.getPropertyValue('margin-right').slice(0, -2));
407
- if (this.isPrimaryDirectionVertical) {
408
- var marginSum = this.itemMarginTop + this.itemMarginBottom;
409
- this.scrollBounds.scrollHeight += marginSum;
410
- this.scrollBounds.maxTop += marginSum;
411
- } else {
412
- var _marginSum = this.itemMarginLeft + this.itemMarginRight;
413
- this.scrollBounds.scrollWidth += _marginSum;
414
- this.scrollBounds.maxLeft += _marginSum;
415
- }
409
+ this.calculateScrollBounds(this.props);
416
410
  this.setContainerSize();
417
411
  }
418
412
  var deferScrollTo = false;
@@ -479,6 +473,8 @@ var VirtualListBasic = exports.VirtualListBasic = /*#__PURE__*/function (_Compon
479
473
  /* istanbul ignore next */
480
474
  if (this.scrollPosition === 0 && this.moreInfo.firstVisibleIndex !== 0) {
481
475
  this.scrollPosition = this.prevScrollPosition;
476
+ // Restores the previous first index after the layout props changed (guarded, so it does not loop)
477
+ // eslint-disable-next-line @eslint-react/no-set-state-in-component-did-update
482
478
  this.setState({
483
479
  firstIndex: prevState.firstIndex
484
480
  });
@@ -504,6 +500,8 @@ var VirtualListBasic = exports.VirtualListBasic = /*#__PURE__*/function (_Compon
504
500
  x = _this$getXY.x,
505
501
  y = _this$getXY.y;
506
502
  this.calculateMetrics(this.props);
503
+ // Layout props changed: the metrics are re-measured from the DOM and stored (guarded, so it does not loop)
504
+ // eslint-disable-next-line @eslint-react/no-set-state-in-component-did-update
507
505
  this.setState(this.getStatesAndUpdateBounds(this.props, prevState.firstIndex ? prevState.firstIndex : 0));
508
506
  this.setContainerSize();
509
507
  var xMax = scrollWidth - clientWidth;
@@ -515,6 +513,8 @@ var VirtualListBasic = exports.VirtualListBasic = /*#__PURE__*/function (_Compon
515
513
  deferScrollTo = true;
516
514
  } else if (this.hasDataSizeChanged) {
517
515
  var newState = this.getStatesAndUpdateBounds(this.props, this.state.firstIndex);
516
+ // Data size changed: the bounds are recalculated for the new items (guarded, so it does not loop)
517
+ // eslint-disable-next-line @eslint-react/no-set-state-in-component-did-update
518
518
  this.setState(newState);
519
519
  this.setContainerSize();
520
520
  deferScrollTo = true;
@@ -668,7 +668,7 @@ var VirtualListBasic = exports.VirtualListBasic = /*#__PURE__*/function (_Compon
668
668
  scrollPosition = this.scrollPosition,
669
669
  threshold = this.threshold,
670
670
  gridSize = primary.gridSize;
671
- var newFirstIndex = firstIndex;
671
+ var newFirstIndex;
672
672
  if (wasFirstIndexMax && dataSizeDiff > 0) {
673
673
  // If dataSize increased from bottom, we need adjust firstIndex
674
674
  // If this is a gridlist and dataSizeDiff is smaller than 1 line, we are adjusting firstIndex without threshold change.
@@ -825,27 +825,48 @@ var VirtualListBasic = exports.VirtualListBasic = /*#__PURE__*/function (_Compon
825
825
  key: "animateScroll",
826
826
  value: function _animateScroll(left, top, node) {
827
827
  var _this8 = this;
828
- // Determine the direction of scroll (1 for forward/down, -1 for backward/up, 0 for no movement)
829
- var directionX = Math.sign(left - node.scrollLeft);
830
- var directionY = Math.sign(top - node.scrollTop);
831
-
832
- // Calculate an adaptive scroll factor (pixels per frame).
833
- // It uses the average item size (gridSize) to ensure the speed feels consistent.
834
- var scrollFactor = Math.max(this.primary.gridSize / 12, 2);
835
- var startTime = performance.now();
828
+ // Retarget the ongoing animation instead of starting another loop so that only one loop drives the scroll.
829
+ // Concurrent loops keep scrolling toward their own old targets, and when frames are delayed
830
+ // (e.g. holding a 5-way key while the device is busy), their timeout fallbacks override the latest target.
831
+ // Keeping the loop alive also keeps `scrolling` true, so `onScrollStop` is not fired in the middle of a key repeat.
832
+ this.scrollAnimationTarget = {
833
+ left: left,
834
+ top: top
835
+ };
836
+ this.scrollAnimationStartTime = performance.now();
837
+ if (this.scrollAnimationId) {
838
+ return;
839
+ }
836
840
 
837
- // Progressively scrolls the node toward a target position using requestAnimationFrame.
841
+ // Progressively scrolls the node toward the latest target position using requestAnimationFrame.
838
842
  // It applies an incremental scroll on each frame and cancels the animation once
839
- // the target is reached or the duration (500ms) is exceeded, falling back to
843
+ // the target is reached or the duration (500ms since the latest request) is exceeded, falling back to
840
844
  // a smooth scroll if the timeout occurs first.
841
845
  var _animateScroll = function animateScroll(currentTime) {
842
- var elapsed = (currentTime - startTime) / 500;
846
+ var _this8$scrollAnimatio = _this8.scrollAnimationTarget,
847
+ targetLeft = _this8$scrollAnimatio.left,
848
+ targetTop = _this8$scrollAnimatio.top;
849
+ var elapsed = (currentTime - _this8.scrollAnimationStartTime) / 500;
850
+ var distanceX = targetLeft - node.scrollLeft;
851
+ var distanceY = targetTop - node.scrollTop;
852
+
853
+ // Determine the direction of scroll (1 for forward/down, -1 for backward/up, 0 for no movement)
854
+ var directionX = Math.sign(distanceX);
855
+ var directionY = Math.sign(distanceY);
856
+
857
+ // Calculate an adaptive scroll factor (pixels per frame) for each item left to scroll.
858
+ // It uses the average item size (gridSize) to ensure the speed feels consistent,
859
+ // and speeds up while the target is several items away (e.g. holding a 5-way key) to keep up with the focus.
860
+ var gridSize = Math.max(_this8.primary.gridSize, 1);
861
+ var scrollFactor = Math.max(gridSize / 12, 2);
862
+ var speedX = scrollFactor * Math.max(Math.ceil(Math.abs(distanceX) / gridSize), 1);
863
+ var speedY = scrollFactor * Math.max(Math.ceil(Math.abs(distanceY) / gridSize), 1);
843
864
 
844
865
  // Clamp each step to the remaining distance so the final frame lands exactly on the target
845
866
  // instead of overshooting by up to `scrollFactor`. Overshooting would push a focused item
846
867
  // anchored to the start edge (e.g. `stickTo="start"`) past that edge and clip it.
847
- var stepX = directionX === 0 ? 0 : directionX * Math.min(scrollFactor, Math.abs(left - node.scrollLeft));
848
- var stepY = directionY === 0 ? 0 : directionY * Math.min(scrollFactor, Math.abs(top - node.scrollTop));
868
+ var stepX = directionX * Math.min(speedX, Math.abs(distanceX));
869
+ var stepY = directionY * Math.min(speedY, Math.abs(distanceY));
849
870
  node.scrollBy({
850
871
  top: stepY,
851
872
  left: stepX,
@@ -853,20 +874,20 @@ var VirtualListBasic = exports.VirtualListBasic = /*#__PURE__*/function (_Compon
853
874
  });
854
875
  _this8.scrollAnimationId = window.requestAnimationFrame(_animateScroll);
855
876
  _this8.scrolling = true;
856
- var scrollHorizontally = directionX > 0 ? node.scrollLeft < left : node.scrollLeft > left;
857
- var scrollVertically = directionY > 0 ? node.scrollTop < top : node.scrollTop > top;
858
- var targetReached = node.scrollLeft === left && node.scrollTop === top;
877
+ var scrollHorizontally = directionX > 0 ? node.scrollLeft < targetLeft : node.scrollLeft > targetLeft;
878
+ var scrollVertically = directionY > 0 ? node.scrollTop < targetTop : node.scrollTop > targetTop;
879
+ var targetReached = node.scrollLeft === targetLeft && node.scrollTop === targetTop;
859
880
 
860
881
  // Check if we've reached the needed scroll position
861
- // or the elapsed time since startTime is longer than 0.5s and cancel the animation
882
+ // or the elapsed time since the latest request is longer than 0.5s and cancel the animation
862
883
  if (!scrollHorizontally && !scrollVertically || elapsed > 1) {
863
884
  _this8.cancelScrollAnimation();
864
885
 
865
886
  // Fallback: if time is out before reaching the target, jump there with smooth scroll
866
887
  if (elapsed > 1 && !targetReached) {
867
888
  node.scrollTo({
868
- top: top,
869
- left: left,
889
+ top: targetTop,
890
+ left: targetLeft,
870
891
  behavior: 'smooth'
871
892
  });
872
893
  }
@@ -948,8 +969,7 @@ var VirtualListBasic = exports.VirtualListBasic = /*#__PURE__*/function (_Compon
948
969
  pos = x;
949
970
  }
950
971
  if (pos > threshold.max || pos < threshold.min) {
951
- var newThresholdMin = -Infinity,
952
- newThresholdMax = Infinity;
972
+ var newThresholdMin, newThresholdMax;
953
973
  if (this.props.itemSizes) {
954
974
  var overhangBefore = Math.floor(this.props.overhang / 2);
955
975
  var firstRenderedIndex = -1;
@@ -8,11 +8,11 @@ var _jsxRuntime = require("react/jsx-runtime");
8
8
  var _excluded = ["index"],
9
9
  _excluded2 = ["index"];
10
10
  function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
11
- function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
12
- function _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }
13
- function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == typeof i ? i : i + ""; }
14
- function _toPrimitive(t, r) { if ("object" != typeof t || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != typeof i) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
15
- function _objectWithoutProperties(e, t) { if (null == e) return {}; var o, r, i = _objectWithoutPropertiesLoose(e, t); if (Object.getOwnPropertySymbols) { var n = Object.getOwnPropertySymbols(e); for (r = 0; r < n.length; r++) o = n[r], -1 === t.indexOf(o) && {}.propertyIsEnumerable.call(e, o) && (i[o] = e[o]); } return i; }
11
+ function _objectSpread(r) { for (var t = 1; t < arguments.length; t++) { var o = null != arguments[t] ? arguments[t] : {}; t % 2 ? ownKeys(Object(o), !0).forEach(function (t) { _defineProperty(r, t, o[t]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(r, Object.getOwnPropertyDescriptors(o)) : ownKeys(Object(o)).forEach(function (e) { Object.defineProperty(r, e, Object.getOwnPropertyDescriptor(o, e)); }); } return r; }
12
+ function _defineProperty(r, t, o) { return (t = _toPropertyKey(t)) in r ? Object.defineProperty(r, t, { value: o, enumerable: !0, configurable: !0, writable: !0 }) : r[t] = o, r; }
13
+ function _toPropertyKey(r) { var o = _toPrimitive(r, "string"); return "symbol" == typeof o ? o : o + ""; }
14
+ function _toPrimitive(t, e) { if ("object" != typeof t || !t) return t; var r; if ("undefined" != typeof Symbol && void 0 !== (r = t[Symbol.toPrimitive])) { var i = r.call(t, e || "default"); if ("object" != typeof i) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === e ? String : Number)(t); }
15
+ function _objectWithoutProperties(t, r) { if (null == t) return {}; var o, n, i = _objectWithoutPropertiesLoose(t, r); if (Object.getOwnPropertySymbols) { var l = Object.getOwnPropertySymbols(t); for (n = 0; n < l.length; n++) o = l[n], -1 === r.indexOf(o) && {}.propertyIsEnumerable.call(t, o) && (i[o] = t[o]); } return i; }
16
16
  function _objectWithoutPropertiesLoose(r, e) { if (null == r) return {}; var t = {}; for (var n in r) if ({}.hasOwnProperty.call(r, n)) { if (-1 !== e.indexOf(n)) continue; t[n] = r[n]; } return t; }
17
17
  describe('VirtualGridList with native scrollMode', function () {
18
18
  var clientSize, dataSize, items, itemSize, renderItem, svgGenerator;
@@ -8,11 +8,11 @@ var _jsxRuntime = require("react/jsx-runtime");
8
8
  var _excluded = ["index"],
9
9
  _excluded2 = ["index"];
10
10
  function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
11
- function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
12
- function _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }
13
- function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == typeof i ? i : i + ""; }
14
- function _toPrimitive(t, r) { if ("object" != typeof t || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != typeof i) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
15
- function _objectWithoutProperties(e, t) { if (null == e) return {}; var o, r, i = _objectWithoutPropertiesLoose(e, t); if (Object.getOwnPropertySymbols) { var n = Object.getOwnPropertySymbols(e); for (r = 0; r < n.length; r++) o = n[r], -1 === t.indexOf(o) && {}.propertyIsEnumerable.call(e, o) && (i[o] = e[o]); } return i; }
11
+ function _objectSpread(r) { for (var t = 1; t < arguments.length; t++) { var o = null != arguments[t] ? arguments[t] : {}; t % 2 ? ownKeys(Object(o), !0).forEach(function (t) { _defineProperty(r, t, o[t]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(r, Object.getOwnPropertyDescriptors(o)) : ownKeys(Object(o)).forEach(function (e) { Object.defineProperty(r, e, Object.getOwnPropertyDescriptor(o, e)); }); } return r; }
12
+ function _defineProperty(r, t, o) { return (t = _toPropertyKey(t)) in r ? Object.defineProperty(r, t, { value: o, enumerable: !0, configurable: !0, writable: !0 }) : r[t] = o, r; }
13
+ function _toPropertyKey(r) { var o = _toPrimitive(r, "string"); return "symbol" == typeof o ? o : o + ""; }
14
+ function _toPrimitive(t, e) { if ("object" != typeof t || !t) return t; var r; if ("undefined" != typeof Symbol && void 0 !== (r = t[Symbol.toPrimitive])) { var i = r.call(t, e || "default"); if ("object" != typeof i) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === e ? String : Number)(t); }
15
+ function _objectWithoutProperties(t, r) { if (null == t) return {}; var o, n, i = _objectWithoutPropertiesLoose(t, r); if (Object.getOwnPropertySymbols) { var l = Object.getOwnPropertySymbols(t); for (n = 0; n < l.length; n++) o = l[n], -1 === r.indexOf(o) && {}.propertyIsEnumerable.call(t, o) && (i[o] = t[o]); } return i; }
16
16
  function _objectWithoutPropertiesLoose(r, e) { if (null == r) return {}; var t = {}; for (var n in r) if ({}.hasOwnProperty.call(r, n)) { if (-1 !== e.indexOf(n)) continue; t[n] = r[n]; } return t; }
17
17
  function asyncGeneratorStep(n, t, e, r, o, a, c) { try { var i = n[a](c), u = i.value; } catch (n) { return void e(n); } i.done ? t(u) : Promise.resolve(u).then(r, o); }
18
18
  function _asyncToGenerator(n) { return function () { var t = this, e = arguments; return new Promise(function (r, o) { var a = n.apply(t, e); function _next(n) { asyncGeneratorStep(a, r, o, _next, _throw, "next", n); } function _throw(n) { asyncGeneratorStep(a, r, o, _next, _throw, "throw", n); } _next(void 0); }); }; }
@@ -41,7 +41,7 @@ var getElementClientCenter = function getElementClientCenter(element) {
41
41
  };
42
42
  };
43
43
  var drag = /*#__PURE__*/function () {
44
- var _ref2 = _asyncToGenerator(function* (element, _ref) {
44
+ var _drag = _asyncToGenerator(function* (element, _ref) {
45
45
  var delta = _ref.delta,
46
46
  _ref$steps = _ref.steps,
47
47
  steps = _ref$steps === void 0 ? 1 : _ref$steps;
@@ -72,9 +72,10 @@ var drag = /*#__PURE__*/function () {
72
72
  }
73
73
  _react.fireEvent.mouseUp(element, current);
74
74
  });
75
- return function drag(_x, _x2) {
76
- return _ref2.apply(this, arguments);
77
- };
75
+ function drag(_x, _x2) {
76
+ return _drag.apply(this, arguments);
77
+ }
78
+ return drag;
78
79
  }();
79
80
  describe('VirtualGridList', function () {
80
81
  var clientSize, dataSize, getScrollTo, handlerOnScroll, handlerOnScrollStart, handlerOnScrollStop, items, itemSize, myScrollTo, onScrollCount, onScrollStartCount, onScrollStopCount, renderItem, resultScrollTop, startScrollTop, svgGenerator;
@@ -112,9 +113,9 @@ describe('VirtualGridList', function () {
112
113
  done();
113
114
  };
114
115
  };
115
- renderItem = function renderItem(_ref3) {
116
- var index = _ref3.index,
117
- rest = _objectWithoutProperties(_ref3, _excluded);
116
+ renderItem = function renderItem(_ref2) {
117
+ var index = _ref2.index,
118
+ rest = _objectWithoutProperties(_ref2, _excluded);
118
119
  // eslint-disable-line enact/display-name
119
120
  var _items$index = items[index],
120
121
  text = _items$index.text,
@@ -578,9 +579,9 @@ describe('VirtualGridList', function () {
578
579
  }, {
579
580
  name: 'C'
580
581
  }];
581
- var renderItemArray = function renderItemArray(_ref5) {
582
- var index = _ref5.index,
583
- rest = _objectWithoutProperties(_ref5, _excluded2);
582
+ var renderItemArray = function renderItemArray(_ref4) {
583
+ var index = _ref4.index,
584
+ rest = _objectWithoutProperties(_ref4, _excluded2);
584
585
  return /*#__PURE__*/(0, _jsxRuntime.jsx)("div", _objectSpread(_objectSpread({}, rest), {}, {
585
586
  id: 'item' + index,
586
587
  children: itemArray[index].name