@enact/ui 4.5.2 → 4.6.1
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 +1 -40
- package/AnnounceDecorator/AnnounceDecorator.js +3 -21
- package/AnnounceDecorator/tests/Announce-specs.js +2 -7
- package/AnnounceDecorator/tests/AnnounceDecorator-specs.js +2 -6
- package/AnnounceDecorator/tests/useAnnounce-specs.js +8 -19
- package/AnnounceDecorator/useAnnounce.js +0 -6
- package/BodyText/BodyText.js +8 -28
- package/BodyText/tests/BodyText-specs.js +0 -19
- package/Button/Button.js +33 -63
- package/Button/tests/Button-specs.js +0 -26
- package/CHANGELOG.md +45 -0
- package/Cancelable/Cancelable.js +8 -47
- package/Cancelable/cancelHandler.js +5 -12
- package/Cancelable/modalHandler.js +3 -11
- package/Cancelable/tests/Cancelable-specs.js +3 -57
- package/Changeable/Changeable.js +2 -34
- package/Changeable/tests/Changeable-specs.js +20 -66
- package/ComponentOverride/ComponentOverride.js +1 -13
- package/FloatingLayer/FloatingLayer.js +17 -73
- package/FloatingLayer/FloatingLayerContainer.js +0 -15
- package/FloatingLayer/FloatingLayerDecorator.js +4 -17
- package/FloatingLayer/Scrim.js +9 -53
- package/FloatingLayer/index.js +0 -4
- package/FloatingLayer/package.json +3 -0
- package/FloatingLayer/tests/FloatingLayer-specs.js +8 -22
- package/FloatingLayer/tests/Scrim-specs.js +0 -9
- package/FloatingLayer/tests/useFloatingLayerDecorator-specs.js +0 -13
- package/FloatingLayer/useFloatingLayer.js +3 -14
- package/FloatingLayer/useFloatingLayerDecorator.js +3 -11
- package/ForwardRef/ForwardRef.js +1 -10
- package/GridListImageItem/GridListImageItem.js +18 -51
- package/Group/Group.js +5 -36
- package/Group/GroupItem.js +16 -33
- package/Group/tests/Group-specs.js +0 -32
- package/Heading/Heading.js +8 -36
- package/Heading/tests/Heading-specs.js +81 -14
- package/Icon/Icon.js +19 -53
- package/Icon/tests/Icon-specs.js +0 -22
- package/IconButton/IconButton.js +24 -57
- package/IconButton/tests/IconButton-specs.js +0 -7
- package/Image/Image.js +17 -46
- package/Image/tests/Image-specs.js +0 -14
- package/ImageItem/ImageItem.js +18 -47
- package/ImageItem/tests/ImageItem-specs.js +0 -25
- package/Item/Item.js +9 -33
- package/Item/tests/Item-specs.js +0 -24
- package/LabeledIcon/LabeledIcon.js +22 -53
- package/LabeledIcon/tests/LabeledIcon-specs.js +0 -14
- package/Layout/Cell.js +18 -44
- package/Layout/Layout.js +23 -46
- package/Layout/tests/Layout-specs.js +10 -39
- package/Marquee/MarqueeBase.js +29 -63
- package/Marquee/MarqueeController.js +11 -72
- package/Marquee/MarqueeDecorator.js +70 -196
- package/Marquee/index.js +1 -5
- package/Marquee/tests/Marquee-specs.js +295 -87
- package/Measurable/Measurable.js +12 -34
- package/Measurable/tests/Measurable-specs.js +115 -0
- package/Media/Media.js +15 -65
- package/Media/tests/Media-specs.js +168 -0
- package/Placeholder/PlaceholderControllerDecorator.js +7 -43
- package/Placeholder/PlaceholderDecorator.js +7 -38
- package/Placeholder/index.js +1 -5
- package/Placeholder/tests/PlaceholderControllerDecorator-specs.js +25 -0
- package/Placeholder/tests/PlaceholderDecorator-specs.js +28 -0
- package/ProgressBar/ProgressBar.js +14 -45
- package/ProgressBar/tests/ProgressBar-specs.js +0 -17
- package/RadioDecorator/RadioControllerDecorator.js +7 -29
- package/RadioDecorator/RadioDecorator.js +9 -42
- package/RadioDecorator/tests/RadioDecorator-specs.js +12 -49
- package/Repeater/Repeater.js +9 -33
- package/Repeater/tests/Repeater-specs.js +0 -38
- package/Resizable/Resizable.js +9 -37
- package/Resizable/tests/Resizable-specs.js +34 -0
- package/Routable/Link.js +11 -47
- package/Routable/Routable.js +12 -35
- package/Routable/Route.js +0 -6
- package/Routable/Router.js +15 -58
- package/Routable/tests/Routable-specs.js +7 -33
- package/Routable/tests/Router-specs.js +18 -44
- package/Routable/useLink.js +4 -8
- package/Routable/util.js +18 -24
- package/Scrollable/ScrollAnimator.js +49 -65
- package/Scrollable/ScrollThumb.js +2 -13
- package/Scrollable/Scrollable.js +180 -387
- package/Scrollable/ScrollableNative.js +189 -392
- package/Scrollable/Scrollbar.js +30 -102
- package/Scroller/Scroller.js +15 -39
- package/Scroller/ScrollerBasic.js +34 -89
- package/Scroller/UiScrollerBase.js +37 -84
- package/Scroller/tests/Scroller-specs.js +56 -0
- package/Skinnable/Skinnable.js +11 -38
- package/Skinnable/tests/Skinnable-specs.js +3 -74
- package/Skinnable/tests/useSkins-specs.js +1 -13
- package/Skinnable/tests/util-specs.js +0 -14
- package/Skinnable/useSkins.js +8 -15
- package/Skinnable/util.js +9 -20
- package/Slider/Knob.js +5 -24
- package/Slider/PositionDecorator.js +16 -54
- package/Slider/Slider.js +29 -67
- package/Slider/tests/Slider-specs.js +94 -7
- package/Slider/utils.js +0 -2
- package/SlotItem/SlotItem.js +23 -45
- package/SlotItem/tests/SlotItem-specs.js +0 -5
- package/Slottable/Slottable.js +4 -12
- package/Slottable/tests/Slottable-specs.js +19 -46
- package/Slottable/tests/useSlots-specs.js +27 -65
- package/Slottable/useSlots.js +8 -33
- package/Spinner/Spinner.js +16 -43
- package/Spinner/tests/Spinner-specs.js +0 -15
- package/ToggleIcon/ToggleIcon.js +10 -36
- package/ToggleIcon/tests/ToggleIcon-specs.js +0 -16
- package/ToggleItem/ToggleItem.js +24 -57
- package/ToggleItem/tests/ToggleItem-specs.js +0 -30
- package/Toggleable/Toggle.js +1 -15
- package/Toggleable/Toggleable.js +12 -45
- package/Toggleable/tests/Toggleable-specs.js +28 -96
- package/Toggleable/useToggle.js +3 -19
- package/Touchable/ClickAllow.js +5 -14
- package/Touchable/Drag.js +16 -54
- package/Touchable/Flick.js +11 -42
- package/Touchable/Hold.js +21 -68
- package/Touchable/Pinch.js +185 -0
- package/Touchable/Touch.js +71 -76
- package/Touchable/Touchable.js +95 -75
- package/Touchable/config.js +27 -24
- package/Touchable/tests/Touchable-specs.js +360 -119
- package/Touchable/tests/useTouch-specs.js +6 -80
- package/Touchable/useTouch.js +57 -65
- package/Transition/Transition.js +37 -118
- package/Transition/tests/Transition-specs.js +20 -60
- package/ViewManager/Arranger.js +10 -22
- package/ViewManager/TransitionGroup.js +32 -107
- package/ViewManager/View.js +35 -91
- package/ViewManager/ViewManager.js +20 -84
- package/ViewManager/tests/View-specs.js +0 -17
- package/ViewManager/tests/ViewManager-specs.js +236 -305
- package/ViewManager/tests/test-utils.js +0 -8
- package/VirtualList/UiVirtualListBase.js +265 -409
- package/VirtualList/VirtualList.js +29 -69
- package/VirtualList/VirtualListBase.js +0 -3
- package/VirtualList/VirtualListBasic.js +273 -431
- package/VirtualList/tests/VirtualGridList-native-specs.js +161 -0
- package/VirtualList/tests/VirtualGridList-specs.js +614 -0
- package/VirtualList/tests/VirtualList-native-specs.js +152 -0
- package/VirtualList/tests/VirtualList-specs.js +423 -95
- package/internal/IdProvider/IdProvider.js +7 -21
- package/internal/IdProvider/Provider.js +4 -17
- package/internal/IdProvider/tests/IdProvider-specs.js +44 -0
- package/internal/IdProvider/tests/useId-specs.js +6 -20
- package/internal/IdProvider/useId.js +0 -6
- package/internal/Pure/Pure.js +3 -30
- package/internal/Pure/tests/Pure-specs.js +88 -0
- package/internal/localized-fonts/localized-fonts.js +33 -62
- package/internal/localized-fonts/tests/localized-fonts-specs.js +33 -0
- package/internal/selection/selection.js +1 -6
- package/internal/selection/tests/selection-specs.js +6 -4
- package/internal/validators/tests/validators-specs.js +80 -0
- package/internal/validators/validators.js +14 -34
- package/package.json +9 -3
- package/resolution/ResolutionDecorator.js +4 -40
- package/resolution/index.js +0 -7
- package/resolution/resolution.js +42 -80
- package/resolution/tests/ResolutionDecorator-specs.js +4 -11
- package/resolution/tests/resolution-specs.js +2 -2
- package/useControlledState/tests/useControlledState-specs.js +15 -46
- package/useControlledState/useControlledState.js +11 -22
- package/useScroll/ScrollAnimator.js +49 -65
- package/useScroll/Scrollbar.js +22 -58
- package/useScroll/ScrollbarTrack.js +3 -19
- package/useScroll/useScroll.js +267 -454
- package/useScroll/utilDOM.js +8 -14
- package/useScroll/utilEvent.js +0 -4
- package/AnnounceDecorator/AnnounceDecorator.d.ts +0 -64
- package/BodyText/BodyText.d.ts +0 -66
- package/Button/Button.d.ts +0 -125
- package/Cancelable/Cancelable.d.ts +0 -64
- package/Changeable/Changeable.d.ts +0 -54
- package/ComponentOverride/ComponentOverride.d.ts +0 -52
- package/ForwardRef/ForwardRef.d.ts +0 -22
- package/GridListImageItem/GridListImageItem.d.ts +0 -85
- package/Group/Group.d.ts +0 -107
- package/Heading/Heading.d.ts +0 -90
- package/Icon/Icon.d.ts +0 -88
- package/IconButton/IconButton.d.ts +0 -115
- package/Image/Image.d.ts +0 -113
- package/ImageItem/ImageItem.d.ts +0 -83
- package/Item/Item.d.ts +0 -64
- package/LabeledIcon/LabeledIcon.d.ts +0 -130
- package/Layout/Layout.d.ts +0 -247
- package/Marquee/index.d.ts +0 -258
- package/Measurable/Measurable.d.ts +0 -26
- package/Media/Media.d.ts +0 -99
- package/Placeholder/index.d.ts +0 -53
- package/ProgressBar/ProgressBar.d.ts +0 -92
- package/RadioDecorator/RadioDecorator.d.ts +0 -35
- package/Repeater/Repeater.d.ts +0 -83
- package/Resizable/Resizable.d.ts +0 -31
- package/Routable/Routable.d.ts +0 -148
- package/Scrollable/Scrollable.d.ts +0 -0
- package/Scroller/Scroller.d.ts +0 -276
- package/Skinnable/Skinnable.d.ts +0 -94
- package/Slider/Slider.d.ts +0 -202
- package/SlotItem/SlotItem.d.ts +0 -118
- package/Slottable/Slottable.d.ts +0 -22
- package/Spinner/Spinner.d.ts +0 -95
- package/ToggleIcon/ToggleIcon.d.ts +0 -90
- package/ToggleItem/ToggleItem.d.ts +0 -134
- package/Toggleable/Toggleable.d.ts +0 -103
- package/Touchable/Touchable.d.ts +0 -175
- package/Transition/Transition.d.ts +0 -196
- package/ViewManager/ViewManager.d.ts +0 -191
- package/VirtualList/VirtualList.d.ts +0 -530
- package/index.d.ts +0 -0
- package/internal/IdProvider/IdProvider.d.ts +0 -0
- package/internal/Pure/Pure.d.ts +0 -0
- package/internal/localized-fonts/localized-fonts.d.ts +0 -53
- package/internal/selection/selection.d.ts +0 -0
- package/internal/validators/validators.d.ts +0 -0
- package/resolution/index.d.ts +0 -187
- package/useControlledState/useControlledState.d.ts +0 -0
- package/useScroll/useScroll.d.ts +0 -0
package/Marquee/MarqueeBase.js
CHANGED
|
@@ -4,38 +4,24 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports["default"] = exports.MarqueeBase = void 0;
|
|
7
|
-
|
|
8
7
|
var _propTypes = _interopRequireDefault(require("@enact/core/internal/prop-types"));
|
|
9
|
-
|
|
10
8
|
var _handle = require("@enact/core/handle");
|
|
11
|
-
|
|
12
9
|
var _kind = _interopRequireDefault(require("@enact/core/kind"));
|
|
13
|
-
|
|
14
10
|
var _propTypes2 = _interopRequireDefault(require("prop-types"));
|
|
15
|
-
|
|
16
11
|
var _react = require("react");
|
|
17
|
-
|
|
18
12
|
var _MarqueeModule = _interopRequireDefault(require("./Marquee.module.css"));
|
|
19
|
-
|
|
20
13
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
21
|
-
|
|
22
14
|
var _excluded = ["applyOffset", "children", "clientClassName", "clientRef", "clientStyle", "css", "duplicate", "onMarqueeComplete", "rtl"];
|
|
23
|
-
|
|
24
15
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
|
25
|
-
|
|
26
16
|
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; }
|
|
27
|
-
|
|
28
17
|
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; }
|
|
29
|
-
|
|
30
18
|
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; }
|
|
31
|
-
|
|
32
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; }
|
|
33
|
-
|
|
34
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; }
|
|
35
|
-
|
|
36
21
|
var isEventSource = function isEventSource(ev) {
|
|
37
22
|
return ev.target === ev.currentTarget;
|
|
38
23
|
};
|
|
24
|
+
|
|
39
25
|
/**
|
|
40
26
|
* Marquees the children of the component.
|
|
41
27
|
*
|
|
@@ -46,13 +32,9 @@ var isEventSource = function isEventSource(ev) {
|
|
|
46
32
|
* @ui
|
|
47
33
|
* @public
|
|
48
34
|
*/
|
|
49
|
-
|
|
50
|
-
|
|
51
35
|
var MarqueeBase = (0, _kind["default"])({
|
|
52
36
|
name: 'ui:Marquee',
|
|
53
|
-
propTypes:
|
|
54
|
-
/** @lends ui/Marquee.MarqueeBase.prototype */
|
|
55
|
-
{
|
|
37
|
+
propTypes: /** @lends ui/Marquee.MarqueeBase.prototype */{
|
|
56
38
|
/**
|
|
57
39
|
* Text alignment value of the marquee
|
|
58
40
|
*
|
|
@@ -66,7 +48,6 @@ var MarqueeBase = (0, _kind["default"])({
|
|
|
66
48
|
* @public
|
|
67
49
|
*/
|
|
68
50
|
alignment: _propTypes2["default"].oneOf(['left', 'right', 'center']),
|
|
69
|
-
|
|
70
51
|
/**
|
|
71
52
|
* Applies animating styles such as removing the ellipsis.
|
|
72
53
|
*
|
|
@@ -74,7 +55,6 @@ var MarqueeBase = (0, _kind["default"])({
|
|
|
74
55
|
* @public
|
|
75
56
|
*/
|
|
76
57
|
animating: _propTypes2["default"].bool,
|
|
77
|
-
|
|
78
58
|
/**
|
|
79
59
|
* Sets the value of the `aria-label` attribute for the wrapped component.
|
|
80
60
|
*
|
|
@@ -83,7 +63,6 @@ var MarqueeBase = (0, _kind["default"])({
|
|
|
83
63
|
* @public
|
|
84
64
|
*/
|
|
85
65
|
'aria-label': _propTypes2["default"].string,
|
|
86
|
-
|
|
87
66
|
/**
|
|
88
67
|
* The text or a set of components that should be marqueed
|
|
89
68
|
*
|
|
@@ -93,7 +72,6 @@ var MarqueeBase = (0, _kind["default"])({
|
|
|
93
72
|
* @public
|
|
94
73
|
*/
|
|
95
74
|
children: _propTypes2["default"].node,
|
|
96
|
-
|
|
97
75
|
/**
|
|
98
76
|
* Called when mounting or unmounting with a reference to the client node
|
|
99
77
|
*
|
|
@@ -101,7 +79,6 @@ var MarqueeBase = (0, _kind["default"])({
|
|
|
101
79
|
* @public
|
|
102
80
|
*/
|
|
103
81
|
clientRef: _propTypes["default"].ref,
|
|
104
|
-
|
|
105
82
|
/**
|
|
106
83
|
* Customizes the component by mapping the supplied collection of CSS class names to the
|
|
107
84
|
* corresponding internal elements and states of this component.
|
|
@@ -118,7 +95,6 @@ var MarqueeBase = (0, _kind["default"])({
|
|
|
118
95
|
* @public
|
|
119
96
|
*/
|
|
120
97
|
css: _propTypes2["default"].object,
|
|
121
|
-
|
|
122
98
|
/**
|
|
123
99
|
* Distance to animate the marquee
|
|
124
100
|
*
|
|
@@ -128,7 +104,6 @@ var MarqueeBase = (0, _kind["default"])({
|
|
|
128
104
|
* @public
|
|
129
105
|
*/
|
|
130
106
|
distance: _propTypes2["default"].number,
|
|
131
|
-
|
|
132
107
|
/**
|
|
133
108
|
* Called when the marquee completes its animation
|
|
134
109
|
*
|
|
@@ -136,7 +111,6 @@ var MarqueeBase = (0, _kind["default"])({
|
|
|
136
111
|
* @public
|
|
137
112
|
*/
|
|
138
113
|
onMarqueeComplete: _propTypes2["default"].func,
|
|
139
|
-
|
|
140
114
|
/**
|
|
141
115
|
* Text overflow setting. Either `'clip'` or `'ellipsis'`
|
|
142
116
|
*
|
|
@@ -144,7 +118,6 @@ var MarqueeBase = (0, _kind["default"])({
|
|
|
144
118
|
* @public
|
|
145
119
|
*/
|
|
146
120
|
overflow: _propTypes2["default"].oneOf(['clip', 'ellipsis']),
|
|
147
|
-
|
|
148
121
|
/**
|
|
149
122
|
* `true` if the directionality of the content is right-to-left
|
|
150
123
|
*
|
|
@@ -153,7 +126,6 @@ var MarqueeBase = (0, _kind["default"])({
|
|
|
153
126
|
* @default false
|
|
154
127
|
*/
|
|
155
128
|
rtl: _propTypes2["default"].bool,
|
|
156
|
-
|
|
157
129
|
/**
|
|
158
130
|
* Amount of spacing, in pixels, between the instances of the content
|
|
159
131
|
*
|
|
@@ -162,7 +134,6 @@ var MarqueeBase = (0, _kind["default"])({
|
|
|
162
134
|
* @public
|
|
163
135
|
*/
|
|
164
136
|
spacing: _propTypes2["default"].number,
|
|
165
|
-
|
|
166
137
|
/**
|
|
167
138
|
* Speed of marquee animation in pixels/second.
|
|
168
139
|
*
|
|
@@ -170,7 +141,6 @@ var MarqueeBase = (0, _kind["default"])({
|
|
|
170
141
|
* @public
|
|
171
142
|
*/
|
|
172
143
|
speed: _propTypes2["default"].number,
|
|
173
|
-
|
|
174
144
|
/**
|
|
175
145
|
* Indicates the marquee will animate soon.
|
|
176
146
|
*
|
|
@@ -196,17 +166,17 @@ var MarqueeBase = (0, _kind["default"])({
|
|
|
196
166
|
handlers: {
|
|
197
167
|
applyOffset: function applyOffset(node, _ref) {
|
|
198
168
|
var distance = _ref.distance,
|
|
199
|
-
|
|
200
|
-
|
|
169
|
+
rtl = _ref.rtl,
|
|
170
|
+
spacing = _ref.spacing;
|
|
201
171
|
if (!node || !global.IntersectionObserver) return;
|
|
202
172
|
var root = node.parentNode;
|
|
203
173
|
new global.IntersectionObserver(function (entries, observer) {
|
|
204
174
|
var _entries$0$boundingCl = entries[0].boundingClientRect,
|
|
205
|
-
|
|
206
|
-
|
|
175
|
+
left = _entries$0$boundingCl.left,
|
|
176
|
+
right = _entries$0$boundingCl.right;
|
|
207
177
|
var _entries$0$rootBounds = entries[0].rootBounds,
|
|
208
|
-
|
|
209
|
-
|
|
178
|
+
rootLeft = _entries$0$rootBounds.left,
|
|
179
|
+
rootRight = _entries$0$rootBounds.right;
|
|
210
180
|
var scale = root.getBoundingClientRect().width / root.offsetWidth || 1;
|
|
211
181
|
var textWidth = (rtl ? rootRight - right : left - rootLeft) / scale;
|
|
212
182
|
var offset = distance - (textWidth + spacing);
|
|
@@ -221,10 +191,9 @@ var MarqueeBase = (0, _kind["default"])({
|
|
|
221
191
|
computed: {
|
|
222
192
|
'aria-label': function ariaLabel(_ref2) {
|
|
223
193
|
var aria = _ref2['aria-label'],
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
194
|
+
children = _ref2.children,
|
|
195
|
+
distance = _ref2.distance,
|
|
196
|
+
willAnimate = _ref2.willAnimate;
|
|
228
197
|
if (children != null && aria == null && willAnimate && distance > 0) {
|
|
229
198
|
return _react.Children.map(children, function (c) {
|
|
230
199
|
return typeof c === 'string' && c;
|
|
@@ -235,8 +204,8 @@ var MarqueeBase = (0, _kind["default"])({
|
|
|
235
204
|
},
|
|
236
205
|
clientClassName: function clientClassName(_ref3) {
|
|
237
206
|
var animating = _ref3.animating,
|
|
238
|
-
|
|
239
|
-
|
|
207
|
+
willAnimate = _ref3.willAnimate,
|
|
208
|
+
styler = _ref3.styler;
|
|
240
209
|
return styler.join({
|
|
241
210
|
animate: animating,
|
|
242
211
|
text: true,
|
|
@@ -245,12 +214,12 @@ var MarqueeBase = (0, _kind["default"])({
|
|
|
245
214
|
},
|
|
246
215
|
clientStyle: function clientStyle(_ref4) {
|
|
247
216
|
var alignment = _ref4.alignment,
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
217
|
+
animating = _ref4.animating,
|
|
218
|
+
distance = _ref4.distance,
|
|
219
|
+
overflow = _ref4.overflow,
|
|
220
|
+
rtl = _ref4.rtl,
|
|
221
|
+
spacing = _ref4.spacing,
|
|
222
|
+
speed = _ref4.speed;
|
|
254
223
|
// If the components content directionality doesn't match the context, we need to set it
|
|
255
224
|
// inline
|
|
256
225
|
var direction = rtl ? 'rtl' : 'ltr';
|
|
@@ -261,7 +230,6 @@ var MarqueeBase = (0, _kind["default"])({
|
|
|
261
230
|
textAlign: alignment,
|
|
262
231
|
textOverflow: overflow
|
|
263
232
|
};
|
|
264
|
-
|
|
265
233
|
if (animating) {
|
|
266
234
|
var duration = distance / speed;
|
|
267
235
|
style.transform = "translateX(".concat(distance * rtlDirectionMultiplier, "px)");
|
|
@@ -269,27 +237,25 @@ var MarqueeBase = (0, _kind["default"])({
|
|
|
269
237
|
} else {
|
|
270
238
|
style.transform = 'translateX(0)';
|
|
271
239
|
}
|
|
272
|
-
|
|
273
240
|
return style;
|
|
274
241
|
},
|
|
275
242
|
duplicate: function duplicate(_ref5) {
|
|
276
243
|
var distance = _ref5.distance,
|
|
277
|
-
|
|
244
|
+
willAnimate = _ref5.willAnimate;
|
|
278
245
|
return willAnimate && distance > 0;
|
|
279
246
|
}
|
|
280
247
|
},
|
|
281
248
|
render: function render(_ref6) {
|
|
282
249
|
var applyOffset = _ref6.applyOffset,
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
250
|
+
children = _ref6.children,
|
|
251
|
+
clientClassName = _ref6.clientClassName,
|
|
252
|
+
clientRef = _ref6.clientRef,
|
|
253
|
+
clientStyle = _ref6.clientStyle,
|
|
254
|
+
css = _ref6.css,
|
|
255
|
+
duplicate = _ref6.duplicate,
|
|
256
|
+
onMarqueeComplete = _ref6.onMarqueeComplete,
|
|
257
|
+
rtl = _ref6.rtl,
|
|
258
|
+
rest = _objectWithoutProperties(_ref6, _excluded);
|
|
293
259
|
delete rest.alignment;
|
|
294
260
|
delete rest.animating;
|
|
295
261
|
delete rest.distance;
|
|
@@ -4,54 +4,35 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports["default"] = exports.MarqueeControllerContext = exports.MarqueeController = void 0;
|
|
7
|
-
|
|
8
7
|
var _handle = require("@enact/core/handle");
|
|
9
|
-
|
|
10
8
|
var _hoc = _interopRequireDefault(require("@enact/core/hoc"));
|
|
11
|
-
|
|
12
9
|
var _util = require("@enact/core/util");
|
|
13
|
-
|
|
14
10
|
var _react = require("react");
|
|
15
|
-
|
|
16
11
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
17
|
-
|
|
18
12
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
|
19
|
-
|
|
20
13
|
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; }
|
|
21
|
-
|
|
22
14
|
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; }
|
|
23
|
-
|
|
24
15
|
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; }
|
|
25
|
-
|
|
26
16
|
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
|
27
|
-
|
|
28
17
|
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); } }
|
|
29
|
-
|
|
30
18
|
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
|
|
31
|
-
|
|
32
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); }
|
|
33
|
-
|
|
34
20
|
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
|
|
35
|
-
|
|
36
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); }; }
|
|
37
|
-
|
|
38
22
|
function _possibleConstructorReturn(self, call) { if (call && (typeof call === "object" || typeof call === "function")) { return call; } else if (call !== void 0) { throw new TypeError("Derived constructors may only return object or undefined"); } return _assertThisInitialized(self); }
|
|
39
|
-
|
|
40
23
|
function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
|
|
41
|
-
|
|
42
24
|
function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
|
|
43
|
-
|
|
44
25
|
function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
|
|
45
|
-
|
|
46
26
|
var STATE = {
|
|
47
27
|
inactive: 0,
|
|
48
28
|
// Marquee is not necessary (render or focus not happened)
|
|
49
29
|
active: 1,
|
|
50
30
|
// Marquee in progress, awaiting complete
|
|
51
31
|
ready: 2 // Marquee completed or not needed, but state is active
|
|
52
|
-
|
|
53
32
|
};
|
|
33
|
+
|
|
54
34
|
var MarqueeControllerContext = /*#__PURE__*/(0, _react.createContext)(null);
|
|
35
|
+
|
|
55
36
|
/**
|
|
56
37
|
* Default configuration parameters for {@link ui/Marquee.MarqueeController}.
|
|
57
38
|
*
|
|
@@ -59,7 +40,6 @@ var MarqueeControllerContext = /*#__PURE__*/(0, _react.createContext)(null);
|
|
|
59
40
|
* @memberof ui/Marquee.MarqueeController
|
|
60
41
|
* @hocconfig
|
|
61
42
|
*/
|
|
62
|
-
|
|
63
43
|
exports.MarqueeControllerContext = MarqueeControllerContext;
|
|
64
44
|
var defaultConfig = {
|
|
65
45
|
/**
|
|
@@ -73,6 +53,7 @@ var defaultConfig = {
|
|
|
73
53
|
*/
|
|
74
54
|
marqueeOnFocus: false
|
|
75
55
|
};
|
|
56
|
+
|
|
76
57
|
/**
|
|
77
58
|
* A higher-order component that synchronizes contained `Marquee`s.
|
|
78
59
|
*
|
|
@@ -80,133 +61,96 @@ var defaultConfig = {
|
|
|
80
61
|
* @hoc
|
|
81
62
|
* @public
|
|
82
63
|
*/
|
|
83
|
-
|
|
84
64
|
var MarqueeController = (0, _hoc["default"])(defaultConfig, function (config, Wrapped) {
|
|
85
65
|
var _class;
|
|
86
|
-
|
|
87
66
|
var marqueeOnFocus = config.marqueeOnFocus;
|
|
88
67
|
var forwardBlur = (0, _handle.forward)('onBlur');
|
|
89
68
|
var forwardFocus = (0, _handle.forward)('onFocus');
|
|
90
69
|
return _class = /*#__PURE__*/function (_Component) {
|
|
91
70
|
_inherits(_class, _Component);
|
|
92
|
-
|
|
93
71
|
var _super = _createSuper(_class);
|
|
94
|
-
|
|
95
72
|
function _class(props) {
|
|
96
73
|
var _this;
|
|
97
|
-
|
|
98
74
|
_classCallCheck(this, _class);
|
|
99
|
-
|
|
100
75
|
_this = _super.call(this, props);
|
|
101
76
|
_this.cancelJob = new _util.Job(function () {
|
|
102
77
|
return _this.doCancel();
|
|
103
78
|
}, 30);
|
|
104
|
-
|
|
105
79
|
_this.handleRegister = function (component, handlers) {
|
|
106
80
|
var needsStart = !_this.allInactive() || _this.isFocused;
|
|
107
|
-
|
|
108
81
|
_this.controlled.push(_objectSpread(_objectSpread({}, handlers), {}, {
|
|
109
82
|
state: STATE.inactive,
|
|
110
83
|
component: component
|
|
111
84
|
}));
|
|
112
|
-
|
|
113
85
|
if (needsStart) {
|
|
114
86
|
_this.dispatch('start');
|
|
115
87
|
}
|
|
116
88
|
};
|
|
117
|
-
|
|
118
89
|
_this.handleUnregister = function (component) {
|
|
119
90
|
var wasRunning = false;
|
|
120
|
-
|
|
121
91
|
for (var i = 0; i < _this.controlled.length; i++) {
|
|
122
92
|
if (_this.controlled[i].component === component) {
|
|
123
93
|
wasRunning = _this.controlled[i].state === STATE.active;
|
|
124
|
-
|
|
125
94
|
_this.controlled.splice(i, 1);
|
|
126
|
-
|
|
127
95
|
break;
|
|
128
96
|
}
|
|
129
97
|
}
|
|
130
|
-
|
|
131
98
|
if (wasRunning && !_this.anyRunning()) {
|
|
132
99
|
_this.dispatch('start');
|
|
133
100
|
}
|
|
134
101
|
};
|
|
135
|
-
|
|
136
102
|
_this.handleStart = function (component) {
|
|
137
103
|
_this.cancelJob.stop();
|
|
138
|
-
|
|
139
104
|
if (!_this.anyRunning()) {
|
|
140
105
|
_this.markAll(STATE.ready);
|
|
141
|
-
|
|
142
106
|
_this.dispatch('start', component);
|
|
143
107
|
}
|
|
144
108
|
};
|
|
145
|
-
|
|
146
109
|
_this.handleCancel = function () {
|
|
147
110
|
if (_this.anyRunning()) {
|
|
148
111
|
_this.cancelJob.start();
|
|
149
112
|
}
|
|
150
113
|
};
|
|
151
|
-
|
|
152
114
|
_this.doCancel = function () {
|
|
153
115
|
if (_this.isHovered || _this.isFocused) {
|
|
154
116
|
return;
|
|
155
117
|
}
|
|
156
|
-
|
|
157
118
|
_this.markAll(STATE.inactive);
|
|
158
|
-
|
|
159
119
|
_this.dispatch('stop');
|
|
160
120
|
};
|
|
161
|
-
|
|
162
121
|
_this.handleComplete = function (component) {
|
|
163
122
|
var complete = _this.markReady(component);
|
|
164
|
-
|
|
165
123
|
if (complete) {
|
|
166
124
|
_this.markAll(STATE.ready);
|
|
167
|
-
|
|
168
125
|
_this.dispatch('start');
|
|
169
126
|
}
|
|
170
127
|
};
|
|
171
|
-
|
|
172
128
|
_this.handleEnter = function () {
|
|
173
129
|
_this.isHovered = true;
|
|
174
|
-
|
|
175
130
|
if (!_this.anyRunning()) {
|
|
176
131
|
_this.dispatch('start');
|
|
177
132
|
}
|
|
178
|
-
|
|
179
133
|
_this.cancelJob.stop();
|
|
180
134
|
};
|
|
181
|
-
|
|
182
135
|
_this.handleLeave = function () {
|
|
183
136
|
_this.isHovered = false;
|
|
184
|
-
|
|
185
137
|
_this.cancelJob.start();
|
|
186
138
|
};
|
|
187
|
-
|
|
188
139
|
_this.handleFocus = function (ev) {
|
|
189
140
|
_this.isFocused = true;
|
|
190
|
-
|
|
191
141
|
if (!_this.anyRunning()) {
|
|
192
142
|
_this.dispatch('start');
|
|
193
143
|
}
|
|
194
|
-
|
|
195
144
|
_this.cancelJob.stop();
|
|
196
|
-
|
|
197
145
|
forwardFocus(ev, _this.props);
|
|
198
146
|
};
|
|
199
|
-
|
|
200
147
|
_this.handleBlur = function (ev) {
|
|
201
148
|
_this.isFocused = false;
|
|
202
|
-
|
|
203
149
|
if (_this.anyRunning()) {
|
|
204
150
|
_this.cancelJob.start();
|
|
205
151
|
}
|
|
206
|
-
|
|
207
152
|
forwardBlur(ev, _this.props);
|
|
208
153
|
};
|
|
209
|
-
|
|
210
154
|
_this.controlled = [];
|
|
211
155
|
_this.isFocused = false;
|
|
212
156
|
_this.childContext = {
|
|
@@ -220,7 +164,6 @@ var MarqueeController = (0, _hoc["default"])(defaultConfig, function (config, Wr
|
|
|
220
164
|
};
|
|
221
165
|
return _this;
|
|
222
166
|
}
|
|
223
|
-
|
|
224
167
|
_createClass(_class, [{
|
|
225
168
|
key: "componentWillUnmount",
|
|
226
169
|
value: function componentWillUnmount() {
|
|
@@ -241,12 +184,12 @@ var MarqueeController = (0, _hoc["default"])(defaultConfig, function (config, Wr
|
|
|
241
184
|
function dispatch(action, component) {
|
|
242
185
|
this.controlled.forEach(function (controlled) {
|
|
243
186
|
var controlledComponent = controlled.component,
|
|
244
|
-
|
|
245
|
-
|
|
187
|
+
handler = controlled[action];
|
|
246
188
|
if (component !== controlledComponent && typeof handler === 'function') {
|
|
247
|
-
var complete = handler.call(controlledComponent);
|
|
248
|
-
// unnecessary and is therefore not awaiting a finish
|
|
189
|
+
var complete = handler.call(controlledComponent);
|
|
249
190
|
|
|
191
|
+
// Returning `true` from a start request means that the marqueeing is
|
|
192
|
+
// unnecessary and is therefore not awaiting a finish
|
|
250
193
|
if (action === 'start' && complete) {
|
|
251
194
|
controlled.state = STATE.ready;
|
|
252
195
|
} else if (action === 'start') {
|
|
@@ -257,6 +200,7 @@ var MarqueeController = (0, _hoc["default"])(defaultConfig, function (config, Wr
|
|
|
257
200
|
}
|
|
258
201
|
});
|
|
259
202
|
}
|
|
203
|
+
|
|
260
204
|
/*
|
|
261
205
|
* Marks all components with the passed-in state
|
|
262
206
|
*
|
|
@@ -264,7 +208,6 @@ var MarqueeController = (0, _hoc["default"])(defaultConfig, function (config, Wr
|
|
|
264
208
|
*
|
|
265
209
|
* @returns {undefined}
|
|
266
210
|
*/
|
|
267
|
-
|
|
268
211
|
}, {
|
|
269
212
|
key: "markAll",
|
|
270
213
|
value: function markAll(state) {
|
|
@@ -272,6 +215,7 @@ var MarqueeController = (0, _hoc["default"])(defaultConfig, function (config, Wr
|
|
|
272
215
|
c.state = state;
|
|
273
216
|
});
|
|
274
217
|
}
|
|
218
|
+
|
|
275
219
|
/*
|
|
276
220
|
* Marks `component` as ready for next marquee action
|
|
277
221
|
*
|
|
@@ -279,7 +223,6 @@ var MarqueeController = (0, _hoc["default"])(defaultConfig, function (config, Wr
|
|
|
279
223
|
*
|
|
280
224
|
* @returns {Boolean} `true` if no components are STATE.active
|
|
281
225
|
*/
|
|
282
|
-
|
|
283
226
|
}, {
|
|
284
227
|
key: "markReady",
|
|
285
228
|
value: function markReady(component) {
|
|
@@ -288,17 +231,16 @@ var MarqueeController = (0, _hoc["default"])(defaultConfig, function (config, Wr
|
|
|
288
231
|
if (c.component === component) {
|
|
289
232
|
c.state = STATE.ready;
|
|
290
233
|
}
|
|
291
|
-
|
|
292
234
|
complete = complete && c.state !== STATE.active;
|
|
293
235
|
});
|
|
294
236
|
return complete;
|
|
295
237
|
}
|
|
238
|
+
|
|
296
239
|
/*
|
|
297
240
|
* Checks that all components are inactive
|
|
298
241
|
*
|
|
299
242
|
* @returns {Boolean} `true` if any components should be running
|
|
300
243
|
*/
|
|
301
|
-
|
|
302
244
|
}, {
|
|
303
245
|
key: "allInactive",
|
|
304
246
|
value: function allInactive() {
|
|
@@ -307,12 +249,12 @@ var MarqueeController = (0, _hoc["default"])(defaultConfig, function (config, Wr
|
|
|
307
249
|
}, false);
|
|
308
250
|
return !activeOrReady;
|
|
309
251
|
}
|
|
252
|
+
|
|
310
253
|
/*
|
|
311
254
|
* Checks for any components currently marqueeing
|
|
312
255
|
*
|
|
313
256
|
* @returns {Boolean} `true` if any component is marqueeing
|
|
314
257
|
*/
|
|
315
|
-
|
|
316
258
|
}, {
|
|
317
259
|
key: "anyRunning",
|
|
318
260
|
value: function anyRunning() {
|
|
@@ -324,21 +266,18 @@ var MarqueeController = (0, _hoc["default"])(defaultConfig, function (config, Wr
|
|
|
324
266
|
key: "render",
|
|
325
267
|
value: function render() {
|
|
326
268
|
var props = this.props;
|
|
327
|
-
|
|
328
269
|
if (marqueeOnFocus) {
|
|
329
270
|
props = _objectSpread(_objectSpread({}, this.props), {}, {
|
|
330
271
|
onBlur: this.handleBlur,
|
|
331
272
|
onFocus: this.handleFocus
|
|
332
273
|
});
|
|
333
274
|
}
|
|
334
|
-
|
|
335
275
|
return /*#__PURE__*/(0, _jsxRuntime.jsx)(MarqueeControllerContext.Provider, {
|
|
336
276
|
value: this.childContext,
|
|
337
277
|
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(Wrapped, _objectSpread({}, props))
|
|
338
278
|
});
|
|
339
279
|
}
|
|
340
280
|
}]);
|
|
341
|
-
|
|
342
281
|
return _class;
|
|
343
282
|
}(_react.Component), _class.displayName = 'MarqueeController', _class;
|
|
344
283
|
});
|