@enact/ui 4.6.1 → 4.6.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/AnnounceDecorator/Announce.js +4 -2
- package/AnnounceDecorator/AnnounceDecorator.d.ts +64 -0
- package/AnnounceDecorator/AnnounceDecorator.js +3 -1
- package/BodyText/BodyText.d.ts +66 -0
- package/BodyText/BodyText.js +3 -1
- package/Button/Button.d.ts +125 -0
- package/Button/Button.js +3 -1
- package/CHANGELOG.md +4 -0
- package/Cancelable/Cancelable.d.ts +64 -0
- package/Cancelable/Cancelable.js +4 -2
- package/Cancelable/tests/Cancelable-specs.js +3 -1
- package/Changeable/Changeable.d.ts +54 -0
- package/Changeable/Changeable.js +4 -2
- package/ComponentOverride/ComponentOverride.d.ts +52 -0
- package/ComponentOverride/ComponentOverride.js +3 -1
- package/FloatingLayer/FloatingLayer.js +4 -2
- package/FloatingLayer/FloatingLayerContainer.js +3 -1
- package/FloatingLayer/FloatingLayerDecorator.js +3 -1
- package/FloatingLayer/Scrim.js +4 -2
- package/FloatingLayer/index.d.ts +100 -0
- package/FloatingLayer/tests/useFloatingLayerDecorator-specs.js +3 -1
- package/FloatingLayer/useFloatingLayer.js +2 -2
- package/ForwardRef/ForwardRef.d.ts +22 -0
- package/ForwardRef/ForwardRef.js +3 -1
- package/GridListImageItem/GridListImageItem.d.ts +85 -0
- package/GridListImageItem/GridListImageItem.js +3 -1
- package/Group/Group.d.ts +107 -0
- package/Group/Group.js +3 -1
- package/Group/GroupItem.js +3 -1
- package/Heading/Heading.d.ts +89 -0
- package/Heading/Heading.js +3 -1
- package/Icon/Icon.d.ts +88 -0
- package/Icon/Icon.js +3 -1
- package/IconButton/IconButton.d.ts +115 -0
- package/IconButton/IconButton.js +4 -2
- package/Image/Image.d.ts +113 -0
- package/Image/Image.js +3 -1
- package/ImageItem/ImageItem.d.ts +83 -0
- package/ImageItem/ImageItem.js +3 -1
- package/ImageItem/tests/ImageItem-specs.js +3 -1
- package/Item/Item.d.ts +64 -0
- package/Item/Item.js +3 -1
- package/LabeledIcon/LabeledIcon.d.ts +130 -0
- package/LabeledIcon/LabeledIcon.js +3 -1
- package/Layout/Cell.js +3 -1
- package/Layout/Layout.d.ts +267 -0
- package/Layout/Layout.js +28 -5
- package/Layout/tests/Layout-specs.js +5 -3
- package/Marquee/MarqueeBase.js +3 -1
- package/Marquee/MarqueeController.js +4 -2
- package/Marquee/MarqueeDecorator.js +4 -2
- package/Marquee/index.d.ts +258 -0
- package/Marquee/tests/Marquee-specs.js +3 -1
- package/Measurable/Measurable.d.ts +26 -0
- package/Measurable/Measurable.js +5 -3
- package/Measurable/tests/Measurable-specs.js +8 -6
- package/Media/Media.d.ts +99 -0
- package/Media/Media.js +6 -4
- package/Placeholder/PlaceholderControllerDecorator.js +4 -2
- package/Placeholder/PlaceholderDecorator.js +4 -2
- package/Placeholder/index.d.ts +53 -0
- package/ProgressBar/ProgressBar.d.ts +92 -0
- package/ProgressBar/ProgressBar.js +3 -1
- package/README.md +1 -1
- package/RadioDecorator/RadioControllerDecorator.js +4 -2
- package/RadioDecorator/RadioDecorator.d.ts +35 -0
- package/RadioDecorator/RadioDecorator.js +4 -2
- package/Repeater/Repeater.d.ts +82 -0
- package/Repeater/Repeater.js +3 -1
- package/Repeater/tests/Repeater-specs.js +3 -1
- package/Resizable/Resizable.d.ts +31 -0
- package/Resizable/Resizable.js +4 -2
- package/Routable/Link.js +4 -2
- package/Routable/Routable.d.ts +148 -0
- package/Routable/Routable.js +3 -1
- package/Routable/Router.js +4 -2
- package/Routable/tests/Routable-specs.js +5 -3
- package/Scrollable/ScrollAnimator.js +3 -1
- package/Scrollable/ScrollThumb.js +3 -1
- package/Scrollable/Scrollable.d.ts +0 -0
- package/Scrollable/Scrollable.js +4 -2
- package/Scrollable/ScrollableNative.js +4 -2
- package/Scrollable/Scrollbar.js +4 -2
- package/Scroller/Scroller.d.ts +276 -0
- package/Scroller/Scroller.js +3 -1
- package/Scroller/ScrollerBasic.js +4 -2
- package/Scroller/UiScrollerBase.js +4 -2
- package/Skinnable/Skinnable.d.ts +94 -0
- package/Skinnable/Skinnable.js +3 -1
- package/Skinnable/tests/Skinnable-specs.js +3 -1
- package/Skinnable/tests/useSkins-specs.js +3 -1
- package/Slider/Knob.js +3 -1
- package/Slider/PositionDecorator.js +4 -2
- package/Slider/Slider.d.ts +202 -0
- package/Slider/Slider.js +3 -1
- package/SlotItem/SlotItem.d.ts +118 -0
- package/SlotItem/SlotItem.js +3 -1
- package/Slottable/Slottable.d.ts +22 -0
- package/Slottable/Slottable.js +3 -1
- package/Slottable/useSlots.js +3 -1
- package/Spinner/Spinner.d.ts +95 -0
- package/Spinner/Spinner.js +3 -1
- package/ToggleIcon/ToggleIcon.d.ts +90 -0
- package/ToggleIcon/ToggleIcon.js +3 -1
- package/ToggleItem/ToggleItem.d.ts +132 -0
- package/ToggleItem/ToggleItem.js +3 -1
- package/ToggleItem/tests/ToggleItem-specs.js +3 -1
- package/Toggleable/Toggle.js +4 -2
- package/Toggleable/Toggleable.d.ts +103 -0
- package/Toggleable/Toggleable.js +3 -1
- package/Toggleable/useToggle.js +1 -1
- package/Touchable/ClickAllow.js +3 -1
- package/Touchable/Drag.js +4 -2
- package/Touchable/Flick.js +4 -2
- package/Touchable/Hold.js +4 -2
- package/Touchable/Pinch.js +4 -2
- package/Touchable/Touch.js +3 -1
- package/Touchable/Touchable.d.ts +217 -0
- package/Touchable/Touchable.js +3 -1
- package/Touchable/config.js +3 -1
- package/Touchable/tests/useTouch-specs.js +3 -1
- package/Touchable/useTouch.js +5 -3
- package/Transition/Transition.d.ts +194 -0
- package/Transition/Transition.js +4 -2
- package/Transition/tests/Transition-specs.js +5 -3
- package/ViewManager/Arranger.js +3 -1
- package/ViewManager/TransitionGroup.js +3 -1
- package/ViewManager/View.js +4 -2
- package/ViewManager/ViewManager.d.ts +191 -0
- package/ViewManager/ViewManager.js +4 -2
- package/ViewManager/tests/ViewManager-specs.js +3 -1
- package/VirtualList/UiVirtualListBase.js +5 -3
- package/VirtualList/VirtualList.d.ts +528 -0
- package/VirtualList/VirtualList.js +3 -1
- package/VirtualList/VirtualListBasic.js +5 -3
- package/VirtualList/tests/VirtualGridList-native-specs.js +3 -1
- package/VirtualList/tests/VirtualGridList-specs.js +3 -1
- package/VirtualList/tests/VirtualList-native-specs.js +3 -1
- package/VirtualList/tests/VirtualList-specs.js +3 -1
- package/index.d.ts +0 -0
- package/internal/IdProvider/IdProvider.d.ts +0 -0
- package/internal/IdProvider/IdProvider.js +3 -1
- package/internal/IdProvider/Provider.js +3 -1
- package/internal/IdProvider/tests/IdProvider-specs.js +3 -1
- package/internal/IdProvider/tests/useId-specs.js +4 -3
- package/internal/Pure/Pure.d.ts +0 -0
- package/internal/Pure/Pure.js +4 -2
- package/internal/Pure/tests/Pure-specs.js +4 -2
- package/internal/localized-fonts/localized-fonts.d.ts +53 -0
- package/internal/localized-fonts/localized-fonts.js +2 -2
- package/internal/selection/selection.d.ts +0 -0
- package/internal/validators/validators.d.ts +0 -0
- package/package.json +2 -2
- package/resolution/ResolutionDecorator.js +4 -2
- package/resolution/index.d.ts +187 -0
- package/useControlledState/tests/useControlledState-specs.js +2 -2
- package/useControlledState/useControlledState.d.ts +0 -0
- package/useControlledState/useControlledState.js +2 -2
- package/useScroll/ScrollAnimator.js +3 -1
- package/useScroll/Scrollbar.js +6 -4
- package/useScroll/ScrollbarTrack.js +3 -1
- package/useScroll/useScroll.d.ts +0 -0
- package/useScroll/useScroll.js +64 -52
|
@@ -7,14 +7,15 @@ var _jsxRuntime = require("react/jsx-runtime");
|
|
|
7
7
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
|
8
8
|
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
9
9
|
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
10
|
-
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
10
|
+
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
11
|
+
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return typeof key === "symbol" ? key : String(key); }
|
|
12
|
+
function _toPrimitive(input, hint) { if (typeof input !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (typeof res !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
|
|
11
13
|
describe('useId', function () {
|
|
12
14
|
var data = [];
|
|
13
15
|
function Base(props) {
|
|
14
16
|
data.push(props);
|
|
15
17
|
return /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
|
|
16
|
-
id: data.id
|
|
17
|
-
generateid: data.generateId
|
|
18
|
+
id: data.id
|
|
18
19
|
});
|
|
19
20
|
}
|
|
20
21
|
function Component(_ref) {
|
|
File without changes
|
package/internal/Pure/Pure.js
CHANGED
|
@@ -10,10 +10,12 @@ var _jsxRuntime = require("react/jsx-runtime");
|
|
|
10
10
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
|
11
11
|
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
12
12
|
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
13
|
-
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
13
|
+
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
14
14
|
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
|
15
|
-
function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
|
|
15
|
+
function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, _toPropertyKey(descriptor.key), descriptor); } }
|
|
16
16
|
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
|
|
17
|
+
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return typeof key === "symbol" ? key : String(key); }
|
|
18
|
+
function _toPrimitive(input, hint) { if (typeof input !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (typeof res !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
|
|
17
19
|
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); Object.defineProperty(subClass, "prototype", { writable: false }); if (superClass) _setPrototypeOf(subClass, superClass); }
|
|
18
20
|
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
|
|
19
21
|
function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
|
|
@@ -9,10 +9,12 @@ var _jsxRuntime = require("react/jsx-runtime");
|
|
|
9
9
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
|
10
10
|
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
11
11
|
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
12
|
-
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
12
|
+
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
13
13
|
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
|
14
|
-
function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
|
|
14
|
+
function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, _toPropertyKey(descriptor.key), descriptor); } }
|
|
15
15
|
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
|
|
16
|
+
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return typeof key === "symbol" ? key : String(key); }
|
|
17
|
+
function _toPrimitive(input, hint) { if (typeof input !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (typeof res !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
|
|
16
18
|
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); Object.defineProperty(subClass, "prototype", { writable: false }); if (superClass) _setPrototypeOf(subClass, superClass); }
|
|
17
19
|
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
|
|
18
20
|
function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Generates locale-specific font rules allowing any locale to have its own custom font. Each
|
|
3
|
+
locale-font from the configuration block (defined in this file) is generated at run-time. If the
|
|
4
|
+
locale you're currently in is in the locale-font list an additional `@font-face` rule will be
|
|
5
|
+
generated that will override the standard font.
|
|
6
|
+
*
|
|
7
|
+
* In addition to the standard override-font being generated, named region-specific fonts are also
|
|
8
|
+
generated. This lets you incorporate language specific fonts when you're outside of one of those
|
|
9
|
+
regions; useful in a language list context where you want the name of each language to be
|
|
10
|
+
represented by that language's designated font.
|
|
11
|
+
*
|
|
12
|
+
* Below is example genarated-output of the Urdu ("ur") locale-font.
|
|
13
|
+
* ```
|
|
14
|
+
@font-face {
|
|
15
|
+
font-family: 'Custom Font ur';
|
|
16
|
+
font-weight: 500;
|
|
17
|
+
src: local('CustomFont_Urdu');
|
|
18
|
+
unicode-range: U+0600-U+06FF, U+FE70-U+FEFE, U+FB50-U+FDFF;
|
|
19
|
+
}
|
|
20
|
+
@font-face {
|
|
21
|
+
font-family: 'Custom Font ur Bold';
|
|
22
|
+
font-weight: 700;
|
|
23
|
+
src: local('CustomFont_Urdu');
|
|
24
|
+
unicode-range: U+0600-U+06FF, U+FE70-U+FEFE, U+FB50-U+FDFF;
|
|
25
|
+
}
|
|
26
|
+
@font-face {
|
|
27
|
+
font-family: 'Custom Font ur Light';
|
|
28
|
+
font-weight: 300;
|
|
29
|
+
src: local('CustomFont_Urdu');
|
|
30
|
+
unicode-range: U+0600-U+06FF, U+FE70-U+FEFE, U+FB50-U+FDFF;
|
|
31
|
+
}
|
|
32
|
+
```
|
|
33
|
+
*/
|
|
34
|
+
function generateFontRules(locale: string): string;
|
|
35
|
+
/**
|
|
36
|
+
* Adds a localed font to the font map
|
|
37
|
+
* ```
|
|
38
|
+
addLocalizedFont('My Theme Font', {
|
|
39
|
+
'ur': {
|
|
40
|
+
regular: 'My Theme Urdu',
|
|
41
|
+
unicodeRange:
|
|
42
|
+
'U+600-6FF,' +
|
|
43
|
+
'U+FE70-FEFE,' +
|
|
44
|
+
'U+FB50-FDFF'
|
|
45
|
+
}
|
|
46
|
+
})
|
|
47
|
+
```
|
|
48
|
+
*/
|
|
49
|
+
function addLocalizedFont(name: string, fonts: object): void;
|
|
50
|
+
/**
|
|
51
|
+
* Removes a localized font from the font map
|
|
52
|
+
*/
|
|
53
|
+
function removeLocalizedFont(name: string): void;
|
|
@@ -3,8 +3,8 @@
|
|
|
3
3
|
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
4
4
|
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
5
5
|
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
|
6
|
-
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++)
|
|
7
|
-
function _iterableToArrayLimit(arr, i) { var _i =
|
|
6
|
+
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
|
|
7
|
+
function _iterableToArrayLimit(arr, i) { var _i = null == arr ? null : "undefined" != typeof Symbol && arr[Symbol.iterator] || arr["@@iterator"]; if (null != _i) { var _s, _e, _x, _r, _arr = [], _n = !0, _d = !1; try { if (_x = (_i = _i.call(arr)).next, 0 === i) { if (Object(_i) !== _i) return; _n = !1; } else for (; !(_n = (_s = _x.call(_i)).done) && (_arr.push(_s.value), _arr.length !== i); _n = !0); } catch (err) { _d = !0, _e = err; } finally { try { if (!_n && null != _i["return"] && (_r = _i["return"](), Object(_r) !== _r)) return; } finally { if (_d) throw _e; } } return _arr; } }
|
|
8
8
|
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
9
9
|
var fontMap = {};
|
|
10
10
|
var currentLocale = null;
|
|
File without changes
|
|
File without changes
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@enact/ui",
|
|
3
|
-
"version": "4.6.
|
|
3
|
+
"version": "4.6.2",
|
|
4
4
|
"description": "A collection of simplified unstyled cross-platform UI components for Enact",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -31,7 +31,7 @@
|
|
|
31
31
|
}
|
|
32
32
|
},
|
|
33
33
|
"dependencies": {
|
|
34
|
-
"@enact/core": "^4.6.
|
|
34
|
+
"@enact/core": "^4.6.2",
|
|
35
35
|
"classnames": "^2.3.2",
|
|
36
36
|
"direction": "^1.0.4",
|
|
37
37
|
"invariant": "^2.2.4",
|
|
@@ -13,10 +13,12 @@ var _jsxRuntime = require("react/jsx-runtime");
|
|
|
13
13
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
|
14
14
|
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
15
15
|
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
16
|
-
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
16
|
+
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
17
17
|
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
|
18
|
-
function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
|
|
18
|
+
function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, _toPropertyKey(descriptor.key), descriptor); } }
|
|
19
19
|
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
|
|
20
|
+
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return typeof key === "symbol" ? key : String(key); }
|
|
21
|
+
function _toPrimitive(input, hint) { if (typeof input !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (typeof res !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
|
|
20
22
|
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); Object.defineProperty(subClass, "prototype", { writable: false }); if (superClass) _setPrototypeOf(subClass, superClass); }
|
|
21
23
|
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
|
|
22
24
|
function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
|
|
@@ -0,0 +1,187 @@
|
|
|
1
|
+
// Type definitions for ui/resolution
|
|
2
|
+
|
|
3
|
+
type Omit<T, K extends keyof T> = Pick<T, Exclude<keyof T, K>>;
|
|
4
|
+
type Merge<M, N> = Omit<M, Extract<keyof M, keyof N>> & N;
|
|
5
|
+
|
|
6
|
+
export interface ResolutionDecoratorConfig extends Object {
|
|
7
|
+
/**
|
|
8
|
+
* Attaches an event listener to the window to listen for resize events.
|
|
9
|
+
*/
|
|
10
|
+
dynamic?: boolean;
|
|
11
|
+
/**
|
|
12
|
+
* An array of objects containing declarations for screen types to add to the list of known
|
|
13
|
+
screen types.
|
|
14
|
+
*/
|
|
15
|
+
screenTypes?: object[];
|
|
16
|
+
}
|
|
17
|
+
export interface ResolutionDecoratorProps {}
|
|
18
|
+
export function ResolutionDecorator<P>(
|
|
19
|
+
config: ResolutionDecoratorConfig,
|
|
20
|
+
Component: React.ComponentType<P> | string
|
|
21
|
+
): React.ComponentType<P & ResolutionDecoratorProps>;
|
|
22
|
+
|
|
23
|
+
export function ResolutionDecorator<P>(
|
|
24
|
+
Component: React.ComponentType<P> | string
|
|
25
|
+
): React.ComponentType<P & ResolutionDecoratorProps>;
|
|
26
|
+
|
|
27
|
+
/**
|
|
28
|
+
* Object that stores all of the pixel conversion factors to each keyed unit.
|
|
29
|
+
*/
|
|
30
|
+
export declare const unitToPixelFactors: object;
|
|
31
|
+
/**
|
|
32
|
+
* Sets up screen resolution scaling capabilities by defining an array of all the screens
|
|
33
|
+
being used.
|
|
34
|
+
*
|
|
35
|
+
* These should be listed in order from smallest to largest, according to
|
|
36
|
+
width.
|
|
37
|
+
*
|
|
38
|
+
* The `name` , `pxPerRem` , `width` , and `aspectRatioName` properties are required for
|
|
39
|
+
each screen type in the array. Setting `base: true` on a screen type marks it as the
|
|
40
|
+
default resolution, upon which everything else will be based.
|
|
41
|
+
*
|
|
42
|
+
* Executing this method also initializes the rest of the resolution-independence code.
|
|
43
|
+
*
|
|
44
|
+
* Example:
|
|
45
|
+
* ```
|
|
46
|
+
import ri from 'enact/ui/resolution';
|
|
47
|
+
|
|
48
|
+
ri.defineScreenTypes([
|
|
49
|
+
{name: 'vga', pxPerRem: 8, width: 640, height: 480, aspectRatioName: 'standard'},
|
|
50
|
+
{name: 'xga', pxPerRem: 16, width: 1024, height: 768, aspectRatioName: 'standard'},
|
|
51
|
+
{name: 'hd', pxPerRem: 16, width: 1280, height: 720, aspectRatioName: 'hdtv'},
|
|
52
|
+
{name: 'fhd', pxPerRem: 24, width: 1920, height: 1080, aspectRatioName: 'hdtv', base: true},
|
|
53
|
+
{name: 'uw-uxga', pxPerRem: 24, width: 2560, height: 1080, aspectRatioName: 'cinema'},
|
|
54
|
+
{name: 'uhd', pxPerRem: 48, width: 3840, height: 2160, aspectRatioName: 'hdtv'}
|
|
55
|
+
]);
|
|
56
|
+
```
|
|
57
|
+
*/
|
|
58
|
+
export function defineScreenTypes(types: object[]): void;
|
|
59
|
+
/**
|
|
60
|
+
* Fetches the name of the screen type that best matches the current screen size.
|
|
61
|
+
*
|
|
62
|
+
* The best match is defined as the screen type that is the closest to the screen resolution without
|
|
63
|
+
going over. ("The Price is Right" style.)
|
|
64
|
+
*/
|
|
65
|
+
export function getScreenType(rez: object): string;
|
|
66
|
+
/**
|
|
67
|
+
* Calculate the base rem font size.
|
|
68
|
+
*
|
|
69
|
+
* This is how the magic happens. This accepts an optional `screenType` name. If one isn't provided,
|
|
70
|
+
the currently detected screen type is used. This uses the config option `orientationHandling` ,
|
|
71
|
+
which when set to "scale" and the screen is in portrait orientation, will dynamically calculate
|
|
72
|
+
what the base font size should be, if the width were proportionally scaled down to fit in the portrait space.
|
|
73
|
+
*
|
|
74
|
+
* To use, put the following in your application code:
|
|
75
|
+
* ```
|
|
76
|
+
import ri from '@enact/ui/resolution';
|
|
77
|
+
|
|
78
|
+
ri.config.orientationHandling = 'scale';
|
|
79
|
+
ri.init();
|
|
80
|
+
```
|
|
81
|
+
|
|
82
|
+
* This has no effect if the screen is in landscape, or if `orientationHandling` is unset.
|
|
83
|
+
*/
|
|
84
|
+
export function calculateFontSize(type: string): string;
|
|
85
|
+
/**
|
|
86
|
+
* Returns the CSS classes for the given `type` .
|
|
87
|
+
*/
|
|
88
|
+
export function getResolutionClasses(type: string): string;
|
|
89
|
+
/**
|
|
90
|
+
* Returns the ratio of pixels per rem for the given `type` to the pixels per rem for the base type.
|
|
91
|
+
*/
|
|
92
|
+
export function getRiRatio(type: string): number;
|
|
93
|
+
/**
|
|
94
|
+
* Returns the pixels per rem for the given `type` .
|
|
95
|
+
*/
|
|
96
|
+
export function getUnitToPixelFactors(type: string): number;
|
|
97
|
+
/**
|
|
98
|
+
* Calculates the aspect ratio of the specified screen type.
|
|
99
|
+
*
|
|
100
|
+
* If no screen type is provided, the current screen type is used.
|
|
101
|
+
*/
|
|
102
|
+
export function getAspectRatio(type: string): number;
|
|
103
|
+
/**
|
|
104
|
+
* Returns the name of the aspect ratio for a specified screen type, or for the default
|
|
105
|
+
screen type if none is provided.
|
|
106
|
+
*/
|
|
107
|
+
export function getAspectRatioName(type: string): string;
|
|
108
|
+
/**
|
|
109
|
+
* Takes a provided pixel value and performs a scaling operation based on the current
|
|
110
|
+
screen type.
|
|
111
|
+
*/
|
|
112
|
+
export function scale(px: number): number;
|
|
113
|
+
/**
|
|
114
|
+
* Convert to various unit formats.
|
|
115
|
+
*
|
|
116
|
+
* Useful for converting pixels to a resolution-independent
|
|
117
|
+
measurement method, like "rem". Other units are available if defined in the
|
|
118
|
+
object.
|
|
119
|
+
*
|
|
120
|
+
* Example:
|
|
121
|
+
* ```
|
|
122
|
+
import ri from '@enact/ui/resolution';
|
|
123
|
+
|
|
124
|
+
// Do calculations and get back the desired CSS unit.
|
|
125
|
+
var frameWidth = 250,
|
|
126
|
+
frameWithMarginInches = ri.unit( 10 + frameWidth + 10, 'in' ), // '2.8125in' == frameWithMarginInches
|
|
127
|
+
frameWithMarginRems = ri.unit( 10 + frameWidth + 10, 'rem' ); // '22.5rem' == frameWithMarginRems
|
|
128
|
+
```
|
|
129
|
+
*/
|
|
130
|
+
export function unit(pixels: string | number, toUnit: string): string | void;
|
|
131
|
+
/**
|
|
132
|
+
* Shorthand for when you know you need to scale some pixel value and have it converted to "rem" for
|
|
133
|
+
proper scaling.
|
|
134
|
+
*
|
|
135
|
+
* This runs and together.
|
|
136
|
+
*/
|
|
137
|
+
export function scaleToRem(pixels: number): string | void;
|
|
138
|
+
/**
|
|
139
|
+
* The default configurable options for . Additional resolutions
|
|
140
|
+
may be added.
|
|
141
|
+
*/
|
|
142
|
+
export interface selectSrcOptions {
|
|
143
|
+
/**
|
|
144
|
+
* HD / 720p Resolution image asset source URI/URL
|
|
145
|
+
*/
|
|
146
|
+
hd?: string
|
|
147
|
+
/**
|
|
148
|
+
* FHD / 1080p Resolution image asset source URI/URL
|
|
149
|
+
*/;
|
|
150
|
+
fhd?: string
|
|
151
|
+
/**
|
|
152
|
+
* UHD / 4K Resolution image asset source URI/URL
|
|
153
|
+
*/;
|
|
154
|
+
uhd?: string;
|
|
155
|
+
}
|
|
156
|
+
/**
|
|
157
|
+
* Selects the ideal image asset from a set of assets, based on various screen
|
|
158
|
+
resolutions: HD (720p), FHD (1080p), UHD (4k).
|
|
159
|
+
*
|
|
160
|
+
* When a `src` argument is provided, `selectSrc()` will choose the best image with
|
|
161
|
+
respect to the current screen resolution. `src` may be either the traditional
|
|
162
|
+
string, which will pass straight through, or a hash/object of screen types and
|
|
163
|
+
their asset sources (keys:screen and values:src). The image sources will be used
|
|
164
|
+
when the screen resolution is less than or equal to the provided screen types.
|
|
165
|
+
*
|
|
166
|
+
* Example:
|
|
167
|
+
* ```
|
|
168
|
+
// Take advantage of the multi-res mode
|
|
169
|
+
import {Image} from '@enact/ui/Image';
|
|
170
|
+
|
|
171
|
+
const src = {
|
|
172
|
+
'hd': 'http://lorempixel.com/64/64/city/1/',
|
|
173
|
+
'fhd': 'http://lorempixel.com/128/128/city/1/',
|
|
174
|
+
'uhd': 'http://lorempixel.com/256/256/city/1/'
|
|
175
|
+
};
|
|
176
|
+
...
|
|
177
|
+
<Image src={src} ... />
|
|
178
|
+
...
|
|
179
|
+
```
|
|
180
|
+
*/
|
|
181
|
+
export function selectSrc(
|
|
182
|
+
src: string | ui_resolution_selectSrcSrcOptions
|
|
183
|
+
): string;
|
|
184
|
+
/**
|
|
185
|
+
* This will need to be re-run any time the screen size changes, so all the values can be re-cached.
|
|
186
|
+
*/
|
|
187
|
+
export function init(args: object): void;
|
|
@@ -8,8 +8,8 @@ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "d
|
|
|
8
8
|
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
9
9
|
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
10
10
|
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
|
11
|
-
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++)
|
|
12
|
-
function _iterableToArrayLimit(arr, i) { var _i =
|
|
11
|
+
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
|
|
12
|
+
function _iterableToArrayLimit(arr, i) { var _i = null == arr ? null : "undefined" != typeof Symbol && arr[Symbol.iterator] || arr["@@iterator"]; if (null != _i) { var _s, _e, _x, _r, _arr = [], _n = !0, _d = !1; try { if (_x = (_i = _i.call(arr)).next, 0 === i) { if (Object(_i) !== _i) return; _n = !1; } else for (; !(_n = (_s = _x.call(_i)).done) && (_arr.push(_s.value), _arr.length !== i); _n = !0); } catch (err) { _d = !0, _e = err; } finally { try { if (!_n && null != _i["return"] && (_r = _i["return"](), Object(_r) !== _r)) return; } finally { if (_d) throw _e; } } return _arr; } }
|
|
13
13
|
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
14
14
|
describe('useControlledState', function () {
|
|
15
15
|
var data;
|
|
File without changes
|
|
@@ -9,8 +9,8 @@ var _react = require("react");
|
|
|
9
9
|
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
10
10
|
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
11
11
|
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
|
12
|
-
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++)
|
|
13
|
-
function _iterableToArrayLimit(arr, i) { var _i =
|
|
12
|
+
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
|
|
13
|
+
function _iterableToArrayLimit(arr, i) { var _i = null == arr ? null : "undefined" != typeof Symbol && arr[Symbol.iterator] || arr["@@iterator"]; if (null != _i) { var _s, _e, _x, _r, _arr = [], _n = !0, _d = !1; try { if (_x = (_i = _i.call(arr)).next, 0 === i) { if (Object(_i) !== _i) return; _n = !1; } else for (; !(_n = (_s = _x.call(_i)).done) && (_arr.push(_s.value), _arr.length !== i); _n = !0); } catch (err) { _d = !0, _e = err; } finally { try { if (!_n && null != _i["return"] && (_r = _i["return"](), Object(_r) !== _r)) return; } finally { if (_d) throw _e; } } return _arr; } }
|
|
14
14
|
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
15
15
|
function nop() {}
|
|
16
16
|
|
|
@@ -8,8 +8,10 @@ var _util = require("@enact/core/util");
|
|
|
8
8
|
var _clamp = _interopRequireDefault(require("ramda/src/clamp"));
|
|
9
9
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
|
10
10
|
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
|
11
|
-
function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
|
|
11
|
+
function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, _toPropertyKey(descriptor.key), descriptor); } }
|
|
12
12
|
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
|
|
13
|
+
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return typeof key === "symbol" ? key : String(key); }
|
|
14
|
+
function _toPrimitive(input, hint) { if (typeof input !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (typeof res !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
|
|
13
15
|
var
|
|
14
16
|
// Use eases library
|
|
15
17
|
timingFunctions = {
|
package/useScroll/Scrollbar.js
CHANGED
|
@@ -23,7 +23,9 @@ var _excluded = ["className", "clientSize", "corner", "css", "minThumbSize", "sc
|
|
|
23
23
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
|
24
24
|
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
25
25
|
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
26
|
-
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
26
|
+
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
27
|
+
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return typeof key === "symbol" ? key : String(key); }
|
|
28
|
+
function _toPrimitive(input, hint) { if (typeof input !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (typeof res !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
|
|
27
29
|
function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
|
|
28
30
|
function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
|
|
29
31
|
var scrollbarTrackHidingDelay = 900; // 900ms + 100ms(fade out duration) = 1000ms.
|
|
@@ -97,9 +99,9 @@ var useScrollbar = function useScrollbar(props) {
|
|
|
97
99
|
scrollViewSize = vertical ? bounds.clientHeight : bounds.clientWidth,
|
|
98
100
|
scrollContentSize = vertical ? bounds.scrollHeight : bounds.scrollWidth,
|
|
99
101
|
scrollOrigin = vertical ? bounds.scrollTop : bounds.scrollLeft,
|
|
100
|
-
scrollbarThumbSizeRatioBase = scrollViewSize / scrollContentSize,
|
|
101
|
-
scrollbarThumbProgressRatio = scrollOrigin / (scrollContentSize - scrollViewSize),
|
|
102
|
-
scrollbarThumbSizeRatio = Math.max(_resolution["default"].scale(minThumbSize) / trackSize, Math.min(1, scrollbarThumbSizeRatioBase));
|
|
102
|
+
scrollbarThumbSizeRatioBase = scrollContentSize !== 0 ? scrollViewSize / scrollContentSize : 1,
|
|
103
|
+
scrollbarThumbProgressRatio = scrollContentSize - scrollViewSize !== 0 ? scrollOrigin / (scrollContentSize - scrollViewSize) : 0,
|
|
104
|
+
scrollbarThumbSizeRatio = trackSize !== 0 ? Math.max(_resolution["default"].scale(minThumbSize) / trackSize, Math.min(1, scrollbarThumbSizeRatioBase)) : 1;
|
|
103
105
|
setCSSVariable(scrollbarTrackRef.current, '--scrollbar-thumb-size-ratio', scrollbarThumbSizeRatio);
|
|
104
106
|
setCSSVariable(scrollbarTrackRef.current, '--scrollbar-thumb-progress-ratio', scrollbarThumbProgressRatio);
|
|
105
107
|
}
|
|
@@ -13,7 +13,9 @@ var _excluded = ["vertical"];
|
|
|
13
13
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
|
14
14
|
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
15
15
|
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
16
|
-
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
16
|
+
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
17
|
+
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return typeof key === "symbol" ? key : String(key); }
|
|
18
|
+
function _toPrimitive(input, hint) { if (typeof input !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (typeof res !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
|
|
17
19
|
function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
|
|
18
20
|
function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
|
|
19
21
|
/**
|
|
File without changes
|
package/useScroll/useScroll.js
CHANGED
|
@@ -28,12 +28,14 @@ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "d
|
|
|
28
28
|
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
29
29
|
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
30
30
|
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
|
31
|
-
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++)
|
|
32
|
-
function _iterableToArrayLimit(arr, i) { var _i =
|
|
31
|
+
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
|
|
32
|
+
function _iterableToArrayLimit(arr, i) { var _i = null == arr ? null : "undefined" != typeof Symbol && arr[Symbol.iterator] || arr["@@iterator"]; if (null != _i) { var _s, _e, _x, _r, _arr = [], _n = !0, _d = !1; try { if (_x = (_i = _i.call(arr)).next, 0 === i) { if (Object(_i) !== _i) return; _n = !1; } else for (; !(_n = (_s = _x.call(_i)).done) && (_arr.push(_s.value), _arr.length !== i); _n = !0); } catch (err) { _d = !0, _e = err; } finally { try { if (!_n && null != _i["return"] && (_r = _i["return"](), Object(_r) !== _r)) return; } finally { if (_d) throw _e; } } return _arr; } }
|
|
33
33
|
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
34
34
|
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
35
35
|
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
36
|
-
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
36
|
+
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
37
|
+
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return typeof key === "symbol" ? key : String(key); }
|
|
38
|
+
function _toPrimitive(input, hint) { if (typeof input !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (typeof res !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
|
|
37
39
|
function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
|
|
38
40
|
function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
|
|
39
41
|
var constants = {
|
|
@@ -236,73 +238,83 @@ var useScrollBase = function useScrollBase(props) {
|
|
|
236
238
|
isVerticalScrollbarVisible: isVerticalScrollbarVisible
|
|
237
239
|
}
|
|
238
240
|
});
|
|
241
|
+
|
|
242
|
+
/* istanbul ignore next */
|
|
243
|
+
var themeScrollContainerHandle = (0, _react.useRef)({
|
|
244
|
+
get animator() {
|
|
245
|
+
return mutableRef.current.animator;
|
|
246
|
+
},
|
|
247
|
+
get bounds() {
|
|
248
|
+
return mutableRef.current.bounds;
|
|
249
|
+
},
|
|
250
|
+
get isDragging() {
|
|
251
|
+
return mutableRef.current.isDragging;
|
|
252
|
+
},
|
|
253
|
+
set isDragging(val) {
|
|
254
|
+
mutableRef.current.isDragging = val;
|
|
255
|
+
},
|
|
256
|
+
get isScrollAnimationTargetAccumulated() {
|
|
257
|
+
return mutableRef.current.isScrollAnimationTargetAccumulated;
|
|
258
|
+
},
|
|
259
|
+
set isScrollAnimationTargetAccumulated(val) {
|
|
260
|
+
mutableRef.current.isScrollAnimationTargetAccumulated = val;
|
|
261
|
+
},
|
|
262
|
+
get lastInputType() {
|
|
263
|
+
return mutableRef.current.lastInputType;
|
|
264
|
+
},
|
|
265
|
+
set lastInputType(val) {
|
|
266
|
+
mutableRef.current.lastInputType = val;
|
|
267
|
+
},
|
|
268
|
+
get rtl() {
|
|
269
|
+
return rtl;
|
|
270
|
+
},
|
|
271
|
+
get scrollBounds() {
|
|
272
|
+
return getScrollBounds();
|
|
273
|
+
},
|
|
274
|
+
get scrollHeight() {
|
|
275
|
+
return mutableRef.current.bounds.scrollHeight;
|
|
276
|
+
},
|
|
277
|
+
get scrolling() {
|
|
278
|
+
return mutableRef.current.scrolling;
|
|
279
|
+
},
|
|
280
|
+
get scrollLeft() {
|
|
281
|
+
return mutableRef.current.scrollLeft;
|
|
282
|
+
},
|
|
283
|
+
get scrollToInfo() {
|
|
284
|
+
return mutableRef.current.scrollToInfo;
|
|
285
|
+
},
|
|
286
|
+
get scrollTop() {
|
|
287
|
+
return mutableRef.current.scrollTop;
|
|
288
|
+
},
|
|
289
|
+
get wheelDirection() {
|
|
290
|
+
return mutableRef.current.wheelDirection;
|
|
291
|
+
},
|
|
292
|
+
set wheelDirection(val) {
|
|
293
|
+
mutableRef.current.wheelDirection = val;
|
|
294
|
+
}
|
|
295
|
+
});
|
|
239
296
|
if (mutableRef.current.animator == null) {
|
|
240
297
|
mutableRef.current.animator = new _ScrollAnimator["default"]();
|
|
241
298
|
}
|
|
242
299
|
(0, _react.useLayoutEffect)(function () {
|
|
300
|
+
/* istanbul ignore next */
|
|
243
301
|
if (setScrollContainerHandle) {
|
|
244
|
-
|
|
245
|
-
animator: mutableRef.current.animator,
|
|
302
|
+
Object.assign(themeScrollContainerHandle.current, {
|
|
246
303
|
applyOverscrollEffect: applyOverscrollEffect,
|
|
247
|
-
bounds: mutableRef.current.bounds,
|
|
248
304
|
calculateDistanceByWheel: calculateDistanceByWheel,
|
|
249
305
|
canScrollHorizontally: canScrollHorizontally,
|
|
250
306
|
canScrollVertically: canScrollVertically,
|
|
251
307
|
checkAndApplyOverscrollEffect: checkAndApplyOverscrollEffect,
|
|
252
308
|
getScrollBounds: getScrollBounds,
|
|
253
|
-
get isDragging() {
|
|
254
|
-
return mutableRef.current.isDragging;
|
|
255
|
-
},
|
|
256
|
-
set isDragging(val) {
|
|
257
|
-
mutableRef.current.isDragging = val;
|
|
258
|
-
},
|
|
259
|
-
get isScrollAnimationTargetAccumulated() {
|
|
260
|
-
return mutableRef.current.isScrollAnimationTargetAccumulated;
|
|
261
|
-
},
|
|
262
|
-
set isScrollAnimationTargetAccumulated(val) {
|
|
263
|
-
mutableRef.current.isScrollAnimationTargetAccumulated = val;
|
|
264
|
-
},
|
|
265
|
-
get lastInputType() {
|
|
266
|
-
return mutableRef.current.lastInputType;
|
|
267
|
-
},
|
|
268
|
-
set lastInputType(val) {
|
|
269
|
-
mutableRef.current.lastInputType = val;
|
|
270
|
-
},
|
|
271
|
-
get rtl() {
|
|
272
|
-
return rtl;
|
|
273
|
-
},
|
|
274
|
-
get scrollBounds() {
|
|
275
|
-
return getScrollBounds();
|
|
276
|
-
},
|
|
277
|
-
get scrollHeight() {
|
|
278
|
-
return mutableRef.current.bounds.scrollHeight;
|
|
279
|
-
},
|
|
280
|
-
get scrolling() {
|
|
281
|
-
return mutableRef.current.scrolling;
|
|
282
|
-
},
|
|
283
|
-
get scrollLeft() {
|
|
284
|
-
return mutableRef.current.scrollLeft;
|
|
285
|
-
},
|
|
286
309
|
scrollTo: scrollTo,
|
|
287
310
|
scrollToAccumulatedTarget: scrollToAccumulatedTarget,
|
|
288
|
-
get scrollToInfo() {
|
|
289
|
-
return mutableRef.current.scrollToInfo;
|
|
290
|
-
},
|
|
291
|
-
get scrollTop() {
|
|
292
|
-
return mutableRef.current.scrollTop;
|
|
293
|
-
},
|
|
294
311
|
setOverscrollStatus: setOverscrollStatus,
|
|
295
312
|
showScrollbarTrack: showScrollbarTrack,
|
|
296
313
|
start: start,
|
|
297
314
|
startHidingScrollbarTrack: startHidingScrollbarTrack,
|
|
298
|
-
stop: stop
|
|
299
|
-
get wheelDirection() {
|
|
300
|
-
return mutableRef.current.wheelDirection;
|
|
301
|
-
},
|
|
302
|
-
set wheelDirection(val) {
|
|
303
|
-
mutableRef.current.wheelDirection = val;
|
|
304
|
-
}
|
|
315
|
+
stop: stop
|
|
305
316
|
});
|
|
317
|
+
setScrollContainerHandle(themeScrollContainerHandle.current);
|
|
306
318
|
}
|
|
307
319
|
});
|
|
308
320
|
(0, _react.useLayoutEffect)(function () {
|