@enact/ui 4.8.0 → 4.9.0-alpha.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 +1 -1
- package/CHANGELOG.md +18 -0
- package/Cancelable/Cancelable.js +1 -1
- package/Changeable/Changeable.js +1 -1
- package/FloatingLayer/FloatingLayer.js +1 -1
- package/FloatingLayer/Scrim.js +1 -1
- package/Layout/Cell.js +14 -2
- package/Layout/Layout.d.ts +8 -1
- package/Marquee/MarqueeController.js +23 -284
- package/Marquee/MarqueeDecorator.js +1 -1
- package/Marquee/index.d.ts +18 -18
- package/Marquee/useMarqueeController.js +273 -0
- package/Media/Media.js +1 -1
- package/Placeholder/PlaceholderControllerDecorator.js +1 -1
- package/Placeholder/PlaceholderDecorator.js +1 -1
- package/RadioDecorator/RadioControllerDecorator.js +1 -1
- package/RadioDecorator/RadioDecorator.js +1 -1
- package/Repeater/Repeater.js +7 -3
- package/Routable/Link.js +1 -1
- package/Routable/Router.js +1 -1
- package/Scrollable/Scrollable.js +1 -1
- package/Scrollable/ScrollableNative.js +2 -2
- package/Scrollable/Scrollbar.js +1 -1
- package/Scroller/Scroller.js +20 -18
- package/Scroller/Scroller.module.css +3 -0
- package/Scroller/ScrollerBasic.js +2 -2
- package/Scroller/UiScroller.module.css +3 -0
- package/Scroller/UiScrollerBase.js +2 -2
- package/Slider/PositionDecorator.js +1 -1
- package/Slottable/tests/Slottable-specs.js +2 -4
- package/Toggleable/Toggleable.js +11 -5
- package/Touchable/ClickAllow.js +1 -1
- package/Touchable/Touch.js +3 -3
- package/Touchable/Touchable.js +11 -6
- package/Transition/Transition.js +1 -1
- package/ViewManager/TransitionGroup.js +1 -1
- package/ViewManager/View.js +1 -1
- package/ViewManager/ViewManager.js +1 -1
- package/ViewManager/tests/ViewManager-specs.js +1 -1
- package/VirtualList/UiVirtualList.module.css +3 -0
- package/VirtualList/UiVirtualListBase.js +2 -2
- package/VirtualList/VirtualList.d.ts +13 -13
- package/VirtualList/VirtualList.js +25 -21
- package/VirtualList/VirtualList.module.css +3 -0
- package/VirtualList/VirtualListBasic.js +2 -2
- package/internal/Pure/Pure.js +1 -1
- package/internal/Pure/tests/Pure-specs.js +1 -1
- package/package.json +5 -5
- package/resolution/ResolutionDecorator.js +1 -1
- package/resolution/tests/resolution-specs.js +503 -13
- package/useScroll/Scrollbar.js +18 -8
- package/useScroll/ScrollbarTrack.js +7 -8
- package/useScroll/useScroll.js +1 -1
|
@@ -57,7 +57,7 @@ function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf ? Objec
|
|
|
57
57
|
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); }; }
|
|
58
58
|
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); }
|
|
59
59
|
function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
|
|
60
|
-
function _isNativeReflectConstruct() {
|
|
60
|
+
function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); }
|
|
61
61
|
function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
|
|
62
62
|
var Announce = exports.Announce = (_class = /*#__PURE__*/function (_Component) {
|
|
63
63
|
_inherits(Announce, _Component);
|
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,24 @@
|
|
|
2
2
|
|
|
3
3
|
The following is a curated list of changes in the Enact ui module, newest changes on the top.
|
|
4
4
|
|
|
5
|
+
## [4.9.0-alpha.2] - 2024-05-24
|
|
6
|
+
|
|
7
|
+
No significant changes.
|
|
8
|
+
|
|
9
|
+
## [4.0.14] - 2024-05-14
|
|
10
|
+
|
|
11
|
+
No significant changes.
|
|
12
|
+
|
|
13
|
+
## [4.7.11] - 2024-05-13
|
|
14
|
+
|
|
15
|
+
No significant changes.
|
|
16
|
+
|
|
17
|
+
## [4.9.0-alpha.1] - 2024-04-09
|
|
18
|
+
|
|
19
|
+
### Added
|
|
20
|
+
|
|
21
|
+
- `ui/Layout.Cell` prop `componentCss` to support customizing the component used in `Cell`
|
|
22
|
+
|
|
5
23
|
## [4.8.0] - 2024-02-08
|
|
6
24
|
|
|
7
25
|
No significant changes.
|
package/Cancelable/Cancelable.js
CHANGED
|
@@ -40,7 +40,7 @@ function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf ? Objec
|
|
|
40
40
|
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); }; }
|
|
41
41
|
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); }
|
|
42
42
|
function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
|
|
43
|
-
function _isNativeReflectConstruct() {
|
|
43
|
+
function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); }
|
|
44
44
|
function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); } /**
|
|
45
45
|
* Provides components and methods to add support for handling cancel actions.
|
|
46
46
|
*
|
package/Changeable/Changeable.js
CHANGED
|
@@ -25,7 +25,7 @@ function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf ? Objec
|
|
|
25
25
|
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); }; }
|
|
26
26
|
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); }
|
|
27
27
|
function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
|
|
28
|
-
function _isNativeReflectConstruct() {
|
|
28
|
+
function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); }
|
|
29
29
|
function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); } /* eslint-disable react/sort-prop-types */ /**
|
|
30
30
|
* A higher-order component that adds state management for a single prop via a single event handler.
|
|
31
31
|
*
|
|
@@ -33,7 +33,7 @@ function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf ? Objec
|
|
|
33
33
|
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); }; }
|
|
34
34
|
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); }
|
|
35
35
|
function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
|
|
36
|
-
function _isNativeReflectConstruct() {
|
|
36
|
+
function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); }
|
|
37
37
|
function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); } /**
|
|
38
38
|
* A component that creates an entry point to the new render tree.
|
|
39
39
|
*
|
package/FloatingLayer/Scrim.js
CHANGED
|
@@ -25,7 +25,7 @@ function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf ? Objec
|
|
|
25
25
|
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); }; }
|
|
26
26
|
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); }
|
|
27
27
|
function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
|
|
28
|
-
function _isNativeReflectConstruct() {
|
|
28
|
+
function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); }
|
|
29
29
|
function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
|
|
30
30
|
var transparentClassName = _ScrimModule["default"].scrim + ' enact-fit ' + _ScrimModule["default"].transparent;
|
|
31
31
|
var translucentClassName = _ScrimModule["default"].scrim + ' enact-fit ' + _ScrimModule["default"].translucent;
|
package/Layout/Cell.js
CHANGED
|
@@ -11,7 +11,7 @@ var _ForwardRef = _interopRequireDefault(require("../ForwardRef"));
|
|
|
11
11
|
var _resolution = _interopRequireDefault(require("../resolution"));
|
|
12
12
|
var _LayoutModule = _interopRequireDefault(require("./Layout.module.css"));
|
|
13
13
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
14
|
-
var _excluded = ["component", "componentRef"];
|
|
14
|
+
var _excluded = ["component", "componentCss", "componentRef"];
|
|
15
15
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
|
16
16
|
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; }
|
|
17
17
|
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; }
|
|
@@ -66,10 +66,20 @@ var CellBase = exports.CellBase = (0, _kind["default"])({
|
|
|
66
66
|
* @public
|
|
67
67
|
*/
|
|
68
68
|
component: _propTypes["default"].renderable,
|
|
69
|
+
/**
|
|
70
|
+
* Customizes `Cell` together with `component` prop.
|
|
71
|
+
*
|
|
72
|
+
* When using {@link ui/Layout.Cell}, the `componentCss` prop is passed to the rendered component
|
|
73
|
+
* as `css`.
|
|
74
|
+
*
|
|
75
|
+
* @type {Object}
|
|
76
|
+
* @public
|
|
77
|
+
*/
|
|
78
|
+
componentCss: _propTypes2["default"].object,
|
|
69
79
|
/**
|
|
70
80
|
* Called with a reference to the root component.
|
|
71
81
|
*
|
|
72
|
-
* When using {@link ui/Layout.Cell}, the `ref` prop is forwarded to
|
|
82
|
+
* When using {@link ui/Layout.Cell}, the `ref` prop is forwarded to the rendered component
|
|
73
83
|
* as `componentRef`.
|
|
74
84
|
*
|
|
75
85
|
* @type {Object|Function}
|
|
@@ -175,6 +185,7 @@ var CellBase = exports.CellBase = (0, _kind["default"])({
|
|
|
175
185
|
},
|
|
176
186
|
render: function render(_ref3) {
|
|
177
187
|
var Component = _ref3.component,
|
|
188
|
+
componentCss = _ref3.componentCss,
|
|
178
189
|
componentRef = _ref3.componentRef,
|
|
179
190
|
rest = _objectWithoutProperties(_ref3, _excluded);
|
|
180
191
|
delete rest.align;
|
|
@@ -182,6 +193,7 @@ var CellBase = exports.CellBase = (0, _kind["default"])({
|
|
|
182
193
|
delete rest.shrink;
|
|
183
194
|
delete rest.size;
|
|
184
195
|
return /*#__PURE__*/(0, _jsxRuntime.jsx)(Component, _objectSpread({
|
|
196
|
+
css: componentCss,
|
|
185
197
|
ref: componentRef
|
|
186
198
|
}, rest));
|
|
187
199
|
}
|
package/Layout/Layout.d.ts
CHANGED
|
@@ -28,9 +28,16 @@ horizontally in the case of a vertical layout. `"start"` , `"center"` and
|
|
|
28
28
|
*/
|
|
29
29
|
component?: string | React.ComponentType;
|
|
30
30
|
/**
|
|
31
|
+
* Customizes `Cell` together with `component` prop.
|
|
32
|
+
*
|
|
33
|
+
* When using , the `componentCss` prop is passed to the rendered component
|
|
34
|
+
as `css` .
|
|
35
|
+
*/
|
|
36
|
+
componentCss?: object;
|
|
37
|
+
/**
|
|
31
38
|
* Called with a reference to the root component.
|
|
32
39
|
*
|
|
33
|
-
* When using , the `ref` prop is forwarded to
|
|
40
|
+
* When using , the `ref` prop is forwarded to the rendered component
|
|
34
41
|
as `componentRef` .
|
|
35
42
|
*/
|
|
36
43
|
componentRef?: object | Function;
|
|
@@ -3,38 +3,23 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
exports
|
|
7
|
-
|
|
6
|
+
exports.MarqueeController = void 0;
|
|
7
|
+
Object.defineProperty(exports, "MarqueeControllerContext", {
|
|
8
|
+
enumerable: true,
|
|
9
|
+
get: function get() {
|
|
10
|
+
return _useMarqueeController2.MarqueeControllerContext;
|
|
11
|
+
}
|
|
12
|
+
});
|
|
13
|
+
exports["default"] = void 0;
|
|
8
14
|
var _hoc = _interopRequireDefault(require("@enact/core/hoc"));
|
|
9
|
-
var
|
|
10
|
-
var _react = require("react");
|
|
15
|
+
var _useMarqueeController2 = require("./useMarqueeController");
|
|
11
16
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
12
17
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
|
13
18
|
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
14
19
|
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
15
20
|
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; }
|
|
16
|
-
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
|
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, _toPropertyKey(descriptor.key), descriptor); } }
|
|
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; }
|
|
19
21
|
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == typeof i ? i : String(i); }
|
|
20
|
-
function _toPrimitive(t, r) { if ("object" != typeof t || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != typeof i) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
|
21
|
-
function _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); }
|
|
22
|
-
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
|
|
23
|
-
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); }; }
|
|
24
|
-
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); }
|
|
25
|
-
function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
|
|
26
|
-
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; } }
|
|
27
|
-
function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
|
|
28
|
-
var STATE = {
|
|
29
|
-
inactive: 0,
|
|
30
|
-
// Marquee is not necessary (render or focus not happened)
|
|
31
|
-
active: 1,
|
|
32
|
-
// Marquee in progress, awaiting complete
|
|
33
|
-
ready: 2 // Marquee completed or not needed, but state is active
|
|
34
|
-
};
|
|
35
|
-
var MarqueeControllerContext = exports.MarqueeControllerContext = /*#__PURE__*/(0, _react.createContext)(null);
|
|
36
|
-
|
|
37
|
-
/**
|
|
22
|
+
function _toPrimitive(t, r) { if ("object" != typeof t || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != typeof i) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); } /**
|
|
38
23
|
* Default configuration parameters for {@link ui/Marquee.MarqueeController}.
|
|
39
24
|
*
|
|
40
25
|
* @type {Object}
|
|
@@ -62,266 +47,20 @@ var defaultConfig = {
|
|
|
62
47
|
* @public
|
|
63
48
|
*/
|
|
64
49
|
var MarqueeController = exports.MarqueeController = (0, _hoc["default"])(defaultConfig, function (config, Wrapped) {
|
|
65
|
-
var _class;
|
|
66
50
|
var marqueeOnFocus = config.marqueeOnFocus;
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
}, 30);
|
|
79
|
-
/*
|
|
80
|
-
* Registers `component` with a set of handlers for `start` and `stop`.
|
|
81
|
-
*
|
|
82
|
-
* @param {Object} component A component, typically a React component instance, on
|
|
83
|
-
* which handlers will be dispatched.
|
|
84
|
-
* @param {Object} handlers An object containing `start` and `stop` functions
|
|
85
|
-
*
|
|
86
|
-
* @returns {undefined}
|
|
87
|
-
*/
|
|
88
|
-
_this.handleRegister = function (component, handlers) {
|
|
89
|
-
var needsStart = !_this.allInactive() || _this.isFocused;
|
|
90
|
-
_this.controlled.push(_objectSpread(_objectSpread({}, handlers), {}, {
|
|
91
|
-
state: STATE.inactive,
|
|
92
|
-
component: component
|
|
93
|
-
}));
|
|
94
|
-
if (needsStart) {
|
|
95
|
-
_this.dispatch('start');
|
|
96
|
-
}
|
|
97
|
-
};
|
|
98
|
-
/*
|
|
99
|
-
* Unregisters `component` for synchronization
|
|
100
|
-
*
|
|
101
|
-
* @param {Object} component A previously registered component
|
|
102
|
-
*
|
|
103
|
-
* @returns {undefined}
|
|
104
|
-
*/
|
|
105
|
-
_this.handleUnregister = function (component) {
|
|
106
|
-
var wasRunning = false;
|
|
107
|
-
for (var i = 0; i < _this.controlled.length; i++) {
|
|
108
|
-
if (_this.controlled[i].component === component) {
|
|
109
|
-
wasRunning = _this.controlled[i].state === STATE.active;
|
|
110
|
-
_this.controlled.splice(i, 1);
|
|
111
|
-
break;
|
|
112
|
-
}
|
|
113
|
-
}
|
|
114
|
-
if (wasRunning && !_this.anyRunning()) {
|
|
115
|
-
_this.dispatch('start');
|
|
116
|
-
}
|
|
117
|
-
};
|
|
118
|
-
/*
|
|
119
|
-
* Handler for the `start` context function
|
|
120
|
-
*
|
|
121
|
-
* @param {Object} component A previously registered component
|
|
122
|
-
*
|
|
123
|
-
* @returns {undefined}
|
|
124
|
-
*/
|
|
125
|
-
_this.handleStart = function (component) {
|
|
126
|
-
_this.cancelJob.stop();
|
|
127
|
-
if (!_this.anyRunning()) {
|
|
128
|
-
_this.markAll(STATE.ready);
|
|
129
|
-
_this.dispatch('start', component);
|
|
130
|
-
}
|
|
131
|
-
};
|
|
132
|
-
/*
|
|
133
|
-
* Handler for the `cancel` context function
|
|
134
|
-
*
|
|
135
|
-
* @param {Object} component A previously registered component
|
|
136
|
-
*
|
|
137
|
-
* @returns {undefined}
|
|
138
|
-
*/
|
|
139
|
-
_this.handleCancel = function () {
|
|
140
|
-
if (_this.anyRunning()) {
|
|
141
|
-
_this.cancelJob.start();
|
|
142
|
-
}
|
|
143
|
-
};
|
|
144
|
-
_this.doCancel = function () {
|
|
145
|
-
if (_this.isHovered || _this.isFocused) {
|
|
146
|
-
return;
|
|
147
|
-
}
|
|
148
|
-
_this.markAll(STATE.inactive);
|
|
149
|
-
_this.dispatch('stop');
|
|
150
|
-
};
|
|
151
|
-
/*
|
|
152
|
-
* Handler for the `complete` context function
|
|
153
|
-
*
|
|
154
|
-
* @param {Object} component A previously registered component
|
|
155
|
-
*
|
|
156
|
-
* @returns {undefined}
|
|
157
|
-
*/
|
|
158
|
-
_this.handleComplete = function (component) {
|
|
159
|
-
var complete = _this.markReady(component);
|
|
160
|
-
if (complete) {
|
|
161
|
-
_this.markAll(STATE.ready);
|
|
162
|
-
_this.dispatch('start');
|
|
163
|
-
}
|
|
164
|
-
};
|
|
165
|
-
_this.handleEnter = function () {
|
|
166
|
-
_this.isHovered = true;
|
|
167
|
-
if (!_this.anyRunning()) {
|
|
168
|
-
_this.dispatch('start');
|
|
169
|
-
}
|
|
170
|
-
_this.cancelJob.stop();
|
|
171
|
-
};
|
|
172
|
-
_this.handleLeave = function () {
|
|
173
|
-
_this.isHovered = false;
|
|
174
|
-
_this.cancelJob.start();
|
|
175
|
-
};
|
|
176
|
-
/*
|
|
177
|
-
* Handler for the focus event
|
|
178
|
-
*/
|
|
179
|
-
_this.handleFocus = function (ev) {
|
|
180
|
-
_this.isFocused = true;
|
|
181
|
-
if (!_this.anyRunning()) {
|
|
182
|
-
_this.dispatch('start');
|
|
183
|
-
}
|
|
184
|
-
_this.cancelJob.stop();
|
|
185
|
-
forwardFocus(ev, _this.props);
|
|
186
|
-
};
|
|
187
|
-
/*
|
|
188
|
-
* Handler for the blur event
|
|
189
|
-
*/
|
|
190
|
-
_this.handleBlur = function (ev) {
|
|
191
|
-
_this.isFocused = false;
|
|
192
|
-
if (_this.anyRunning()) {
|
|
193
|
-
_this.cancelJob.start();
|
|
194
|
-
}
|
|
195
|
-
forwardBlur(ev, _this.props);
|
|
196
|
-
};
|
|
197
|
-
_this.controlled = [];
|
|
198
|
-
_this.isFocused = false;
|
|
199
|
-
_this.childContext = {
|
|
200
|
-
cancel: _this.handleCancel,
|
|
201
|
-
complete: _this.handleComplete,
|
|
202
|
-
enter: _this.handleEnter,
|
|
203
|
-
leave: _this.handleLeave,
|
|
204
|
-
register: _this.handleRegister,
|
|
205
|
-
start: _this.handleStart,
|
|
206
|
-
unregister: _this.handleUnregister
|
|
207
|
-
};
|
|
208
|
-
return _this;
|
|
51
|
+
return function (props) {
|
|
52
|
+
var _useMarqueeController = (0, _useMarqueeController2.useMarqueeController)(props),
|
|
53
|
+
handleBlur = _useMarqueeController.handleBlur,
|
|
54
|
+
handleFocus = _useMarqueeController.handleFocus,
|
|
55
|
+
provideMarqueeControllerContext = _useMarqueeController.provideMarqueeControllerContext;
|
|
56
|
+
var wrappedProps = props;
|
|
57
|
+
if (marqueeOnFocus) {
|
|
58
|
+
wrappedProps = _objectSpread(_objectSpread({}, props), {}, {
|
|
59
|
+
onBlur: handleBlur,
|
|
60
|
+
onFocus: handleFocus
|
|
61
|
+
});
|
|
209
62
|
}
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
value: function componentWillUnmount() {
|
|
213
|
-
this.cancelJob.stop();
|
|
214
|
-
}
|
|
215
|
-
}, {
|
|
216
|
-
key: "dispatch",
|
|
217
|
-
value:
|
|
218
|
-
/*
|
|
219
|
-
* Invokes the `action` handler for each synchronized component except the invoking
|
|
220
|
-
* `component`.
|
|
221
|
-
*
|
|
222
|
-
* @param {String} action `'start'` or `'stop'`
|
|
223
|
-
* @param {Object} component A previously registered component
|
|
224
|
-
*
|
|
225
|
-
* @returns {undefined}
|
|
226
|
-
*/
|
|
227
|
-
function dispatch(action, component) {
|
|
228
|
-
this.controlled.forEach(function (controlled) {
|
|
229
|
-
var controlledComponent = controlled.component,
|
|
230
|
-
handler = controlled[action];
|
|
231
|
-
if (component !== controlledComponent && typeof handler === 'function') {
|
|
232
|
-
var complete = handler.call(controlledComponent);
|
|
233
|
-
|
|
234
|
-
// Returning `true` from a start request means that the marqueeing is
|
|
235
|
-
// unnecessary and is therefore not awaiting a finish
|
|
236
|
-
if (action === 'start' && complete) {
|
|
237
|
-
controlled.state = STATE.ready;
|
|
238
|
-
} else if (action === 'start') {
|
|
239
|
-
controlled.state = STATE.active;
|
|
240
|
-
}
|
|
241
|
-
} else if (action === 'start' && component === controlledComponent) {
|
|
242
|
-
controlled.state = STATE.active;
|
|
243
|
-
}
|
|
244
|
-
});
|
|
245
|
-
}
|
|
246
|
-
|
|
247
|
-
/*
|
|
248
|
-
* Marks all components with the passed-in state
|
|
249
|
-
*
|
|
250
|
-
* @param {Enum} state The state to set
|
|
251
|
-
*
|
|
252
|
-
* @returns {undefined}
|
|
253
|
-
*/
|
|
254
|
-
}, {
|
|
255
|
-
key: "markAll",
|
|
256
|
-
value: function markAll(state) {
|
|
257
|
-
this.controlled.forEach(function (c) {
|
|
258
|
-
c.state = state;
|
|
259
|
-
});
|
|
260
|
-
}
|
|
261
|
-
|
|
262
|
-
/*
|
|
263
|
-
* Marks `component` as ready for next marquee action
|
|
264
|
-
*
|
|
265
|
-
* @param {Object} component A previously registered component
|
|
266
|
-
*
|
|
267
|
-
* @returns {Boolean} `true` if no components are STATE.active
|
|
268
|
-
*/
|
|
269
|
-
}, {
|
|
270
|
-
key: "markReady",
|
|
271
|
-
value: function markReady(component) {
|
|
272
|
-
var complete = true;
|
|
273
|
-
this.controlled.forEach(function (c) {
|
|
274
|
-
if (c.component === component) {
|
|
275
|
-
c.state = STATE.ready;
|
|
276
|
-
}
|
|
277
|
-
complete = complete && c.state !== STATE.active;
|
|
278
|
-
});
|
|
279
|
-
return complete;
|
|
280
|
-
}
|
|
281
|
-
|
|
282
|
-
/*
|
|
283
|
-
* Checks that all components are inactive
|
|
284
|
-
*
|
|
285
|
-
* @returns {Boolean} `true` if any components should be running
|
|
286
|
-
*/
|
|
287
|
-
}, {
|
|
288
|
-
key: "allInactive",
|
|
289
|
-
value: function allInactive() {
|
|
290
|
-
var activeOrReady = this.controlled.reduce(function (res, component) {
|
|
291
|
-
return res || !(component.state === STATE.inactive);
|
|
292
|
-
}, false);
|
|
293
|
-
return !activeOrReady;
|
|
294
|
-
}
|
|
295
|
-
|
|
296
|
-
/*
|
|
297
|
-
* Checks for any components currently marqueeing
|
|
298
|
-
*
|
|
299
|
-
* @returns {Boolean} `true` if any component is marqueeing
|
|
300
|
-
*/
|
|
301
|
-
}, {
|
|
302
|
-
key: "anyRunning",
|
|
303
|
-
value: function anyRunning() {
|
|
304
|
-
return this.controlled.reduce(function (res, component) {
|
|
305
|
-
return res || component.state === STATE.active;
|
|
306
|
-
}, false);
|
|
307
|
-
}
|
|
308
|
-
}, {
|
|
309
|
-
key: "render",
|
|
310
|
-
value: function render() {
|
|
311
|
-
var props = this.props;
|
|
312
|
-
if (marqueeOnFocus) {
|
|
313
|
-
props = _objectSpread(_objectSpread({}, this.props), {}, {
|
|
314
|
-
onBlur: this.handleBlur,
|
|
315
|
-
onFocus: this.handleFocus
|
|
316
|
-
});
|
|
317
|
-
}
|
|
318
|
-
return /*#__PURE__*/(0, _jsxRuntime.jsx)(MarqueeControllerContext.Provider, {
|
|
319
|
-
value: this.childContext,
|
|
320
|
-
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(Wrapped, _objectSpread({}, props))
|
|
321
|
-
});
|
|
322
|
-
}
|
|
323
|
-
}]);
|
|
324
|
-
return _class;
|
|
325
|
-
}(_react.Component), _class.displayName = 'MarqueeController', _class;
|
|
63
|
+
return provideMarqueeControllerContext( /*#__PURE__*/(0, _jsxRuntime.jsx)(Wrapped, _objectSpread({}, wrappedProps)));
|
|
64
|
+
};
|
|
326
65
|
});
|
|
327
66
|
var _default = exports["default"] = MarqueeController;
|
|
@@ -38,7 +38,7 @@ function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf ? Objec
|
|
|
38
38
|
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); }; }
|
|
39
39
|
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); }
|
|
40
40
|
function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
|
|
41
|
-
function _isNativeReflectConstruct() {
|
|
41
|
+
function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); }
|
|
42
42
|
function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); } /* global ResizeObserver */ // The minimum number of milliseconds to wait before resetting the marquee position after it finishes.
|
|
43
43
|
var MINIMUM_MARQUEE_RESET_DELAY = 40;
|
|
44
44
|
|
package/Marquee/index.d.ts
CHANGED
|
@@ -5,6 +5,24 @@ import * as React from "react";
|
|
|
5
5
|
type Omit<T, K extends keyof T> = Pick<T, Exclude<keyof T, K>>;
|
|
6
6
|
type Merge<M, N> = Omit<M, Extract<keyof M, keyof N>> & N;
|
|
7
7
|
|
|
8
|
+
export interface MarqueeControllerConfig extends Object {
|
|
9
|
+
/**
|
|
10
|
+
* When `true` , any `onFocus` events that bubble to the controller will start the contained
|
|
11
|
+
`Marquee` instances. This is useful when a component contains `Marquee` instances that need to be
|
|
12
|
+
started when sibling components are focused.
|
|
13
|
+
*/
|
|
14
|
+
marqueeOnFocus?: boolean;
|
|
15
|
+
}
|
|
16
|
+
export interface MarqueeControllerProps {}
|
|
17
|
+
export function MarqueeController<P>(
|
|
18
|
+
config: MarqueeControllerConfig,
|
|
19
|
+
Component: React.ComponentType<P> | string,
|
|
20
|
+
): React.ComponentType<P & MarqueeControllerProps>;
|
|
21
|
+
|
|
22
|
+
export function MarqueeController<P>(
|
|
23
|
+
Component: React.ComponentType<P> | string,
|
|
24
|
+
): React.ComponentType<P & MarqueeControllerProps>;
|
|
25
|
+
|
|
8
26
|
export interface MarqueeBaseProps {
|
|
9
27
|
/**
|
|
10
28
|
* Text alignment value of the marquee
|
|
@@ -89,24 +107,6 @@ export class MarqueeBase extends React.Component<
|
|
|
89
107
|
Merge<React.HTMLProps<HTMLElement>, MarqueeBaseProps>
|
|
90
108
|
> {}
|
|
91
109
|
|
|
92
|
-
export interface MarqueeControllerConfig extends Object {
|
|
93
|
-
/**
|
|
94
|
-
* When `true` , any `onFocus` events that bubble to the controller will start the contained
|
|
95
|
-
`Marquee` instances. This is useful when a component contains `Marquee` instances that need to be
|
|
96
|
-
started when sibling components are focused.
|
|
97
|
-
*/
|
|
98
|
-
marqueeOnFocus?: boolean;
|
|
99
|
-
}
|
|
100
|
-
export interface MarqueeControllerProps {}
|
|
101
|
-
export function MarqueeController<P>(
|
|
102
|
-
config: MarqueeControllerConfig,
|
|
103
|
-
Component: React.ComponentType<P> | string,
|
|
104
|
-
): React.ComponentType<P & MarqueeControllerProps>;
|
|
105
|
-
|
|
106
|
-
export function MarqueeController<P>(
|
|
107
|
-
Component: React.ComponentType<P> | string,
|
|
108
|
-
): React.ComponentType<P & MarqueeControllerProps>;
|
|
109
|
-
|
|
110
110
|
export interface MarqueeProps
|
|
111
111
|
extends Merge<MarqueeBaseProps, MarqueeDecoratorProps> {}
|
|
112
112
|
/**
|