@enact/ui 4.7.7 → 4.7.9
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/CHANGELOG.md +10 -0
- package/Marquee/MarqueeDecorator.js +23 -11
- package/Marquee/index.d.ts +10 -10
- package/Marquee/tests/Marquee-specs.js +19 -0
- package/Routable/Routable.js +1 -1
- package/Routable/Router.js +1 -1
- package/Routable/util.js +2 -2
- package/package.json +3 -3
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,16 @@
|
|
|
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.7.9] - 2023-12-08
|
|
6
|
+
|
|
7
|
+
No significant changes.
|
|
8
|
+
|
|
9
|
+
## [4.7.8] - 2023-11-17
|
|
10
|
+
|
|
11
|
+
### Fixed
|
|
12
|
+
|
|
13
|
+
- `ui/Marquee.MarqueeDecorator` to re-render when its size changed
|
|
14
|
+
|
|
5
15
|
## [4.7.7] - 2023-11-09
|
|
6
16
|
|
|
7
17
|
No significant changes.
|
|
@@ -39,7 +39,7 @@ function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflec
|
|
|
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
41
|
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; } }
|
|
42
|
-
function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); } // The minimum number of milliseconds to wait before resetting the marquee position after it finishes.
|
|
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
|
|
|
45
45
|
/**
|
|
@@ -444,11 +444,13 @@ var MarqueeDecorator = exports.MarqueeDecorator = (0, _hoc["default"])(defaultCo
|
|
|
444
444
|
_this.distance = null;
|
|
445
445
|
_this.contentFits = null;
|
|
446
446
|
_this.resizeRegistry = null;
|
|
447
|
+
_this.resizeObserver = null;
|
|
447
448
|
return _this;
|
|
448
449
|
}
|
|
449
450
|
_createClass(_class, [{
|
|
450
451
|
key: "componentDidMount",
|
|
451
452
|
value: function componentDidMount() {
|
|
453
|
+
var _this2 = this;
|
|
452
454
|
if (this.context && this.context.register) {
|
|
453
455
|
this.sync = true;
|
|
454
456
|
this.context.register(this, {
|
|
@@ -457,6 +459,12 @@ var MarqueeDecorator = exports.MarqueeDecorator = (0, _hoc["default"])(defaultCo
|
|
|
457
459
|
});
|
|
458
460
|
}
|
|
459
461
|
this.validateTextDirection();
|
|
462
|
+
if (typeof ResizeObserver === 'function' && this.node) {
|
|
463
|
+
this.resizeObserver = new ResizeObserver(function () {
|
|
464
|
+
_this2.handleResize();
|
|
465
|
+
});
|
|
466
|
+
this.resizeObserver.observe(this.node);
|
|
467
|
+
}
|
|
460
468
|
if (this.props.marqueeOn === 'render') {
|
|
461
469
|
this.startAnimation(this.props.marqueeOnRenderDelay);
|
|
462
470
|
}
|
|
@@ -506,6 +514,10 @@ var MarqueeDecorator = exports.MarqueeDecorator = (0, _hoc["default"])(defaultCo
|
|
|
506
514
|
if (this.resizeRegistry) {
|
|
507
515
|
this.resizeRegistry.unregister(this.handleResize);
|
|
508
516
|
}
|
|
517
|
+
if (this.resizeObserver) {
|
|
518
|
+
this.resizeObserver.disconnect();
|
|
519
|
+
this.resizeObserver = null;
|
|
520
|
+
}
|
|
509
521
|
(0, _dispatcher.off)('keydown', this.handlePointerHide, document);
|
|
510
522
|
}
|
|
511
523
|
}, {
|
|
@@ -549,14 +561,14 @@ var MarqueeDecorator = exports.MarqueeDecorator = (0, _hoc["default"])(defaultCo
|
|
|
549
561
|
}, {
|
|
550
562
|
key: "setTimeout",
|
|
551
563
|
value: function setTimeout(fn) {
|
|
552
|
-
var
|
|
564
|
+
var _this3 = this;
|
|
553
565
|
var time = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0;
|
|
554
566
|
var state = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : TimerState.CLEAR;
|
|
555
567
|
this.clearTimeout();
|
|
556
568
|
if (window) {
|
|
557
569
|
this.timerState = state;
|
|
558
570
|
this.timer = window.setTimeout(function () {
|
|
559
|
-
|
|
571
|
+
_this3.timerState = TimerState.CLEAR;
|
|
560
572
|
fn();
|
|
561
573
|
}, time);
|
|
562
574
|
}
|
|
@@ -740,9 +752,9 @@ var MarqueeDecorator = exports.MarqueeDecorator = (0, _hoc["default"])(defaultCo
|
|
|
740
752
|
}, {
|
|
741
753
|
key: "validateTextDirection",
|
|
742
754
|
value: function validateTextDirection() {
|
|
743
|
-
var
|
|
755
|
+
var _this4 = this;
|
|
744
756
|
this.setState(function (state, props) {
|
|
745
|
-
var rtl = determineTextDirection(
|
|
757
|
+
var rtl = determineTextDirection(_this4.node, props.rtl, props.forceDirection);
|
|
746
758
|
return state.rtl === rtl ? null : {
|
|
747
759
|
rtl: rtl
|
|
748
760
|
};
|
|
@@ -825,16 +837,16 @@ var MarqueeDecorator = exports.MarqueeDecorator = (0, _hoc["default"])(defaultCo
|
|
|
825
837
|
}, {
|
|
826
838
|
key: "render",
|
|
827
839
|
value: function render() {
|
|
828
|
-
var
|
|
840
|
+
var _this5 = this;
|
|
829
841
|
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_Resizable.ResizeContext.Consumer, {
|
|
830
842
|
children: function children(register) {
|
|
831
|
-
if (!
|
|
832
|
-
|
|
843
|
+
if (!_this5.resizeRegistry && register) {
|
|
844
|
+
_this5.resizeRegistry = register(_this5.handleResize);
|
|
833
845
|
}
|
|
834
|
-
if (
|
|
835
|
-
return
|
|
846
|
+
if (_this5.props.marqueeDisabled) {
|
|
847
|
+
return _this5.renderWrapped();
|
|
836
848
|
} else {
|
|
837
|
-
return
|
|
849
|
+
return _this5.renderMarquee();
|
|
838
850
|
}
|
|
839
851
|
}
|
|
840
852
|
});
|
package/Marquee/index.d.ts
CHANGED
|
@@ -107,6 +107,16 @@ export function MarqueeController<P>(
|
|
|
107
107
|
Component: React.ComponentType<P> | string,
|
|
108
108
|
): React.ComponentType<P & MarqueeControllerProps>;
|
|
109
109
|
|
|
110
|
+
export interface MarqueeProps
|
|
111
|
+
extends Merge<MarqueeBaseProps, MarqueeDecoratorProps> {}
|
|
112
|
+
/**
|
|
113
|
+
* A minimally-styled marquee component.
|
|
114
|
+
*/
|
|
115
|
+
|
|
116
|
+
export class Marquee extends React.Component<
|
|
117
|
+
Merge<React.HTMLProps<HTMLElement>, MarqueeProps>
|
|
118
|
+
> {}
|
|
119
|
+
|
|
110
120
|
export interface MarqueeDecoratorConfig extends Object {
|
|
111
121
|
/**
|
|
112
122
|
* Property containing the callback to stop the animation when `marqueeOn` is `'focus'`
|
|
@@ -245,14 +255,4 @@ export function MarqueeDecorator<P>(
|
|
|
245
255
|
Component: React.ComponentType<P> | string,
|
|
246
256
|
): React.ComponentType<P & MarqueeDecoratorProps>;
|
|
247
257
|
|
|
248
|
-
export interface MarqueeProps
|
|
249
|
-
extends Merge<MarqueeBaseProps, MarqueeDecoratorProps> {}
|
|
250
|
-
/**
|
|
251
|
-
* A minimally-styled marquee component.
|
|
252
|
-
*/
|
|
253
|
-
|
|
254
|
-
export class Marquee extends React.Component<
|
|
255
|
-
Merge<React.HTMLProps<HTMLElement>, MarqueeProps>
|
|
256
|
-
> {}
|
|
257
|
-
|
|
258
258
|
export default Marquee;
|
|
@@ -300,6 +300,25 @@ describe('Marquee', function () {
|
|
|
300
300
|
_react.fireEvent.mouseLeave(marquee);
|
|
301
301
|
expect(spy).toHaveBeenCalled();
|
|
302
302
|
});
|
|
303
|
+
test('should creates and observes with ResizeObserver', function () {
|
|
304
|
+
var originalResizeObserver = global.ResizeObserver;
|
|
305
|
+
var observe = jest.fn();
|
|
306
|
+
global.ResizeObserver = jest.fn(function () {
|
|
307
|
+
return {
|
|
308
|
+
observe: observe,
|
|
309
|
+
disconnect: jest.fn()
|
|
310
|
+
};
|
|
311
|
+
});
|
|
312
|
+
(0, _react.render)( /*#__PURE__*/(0, _jsxRuntime.jsx)(_index.Marquee, {
|
|
313
|
+
children: ltrText
|
|
314
|
+
}));
|
|
315
|
+
(0, _react.act)(function () {
|
|
316
|
+
return jest.advanceTimersByTime(100);
|
|
317
|
+
});
|
|
318
|
+
expect(global.ResizeObserver).toHaveBeenCalled();
|
|
319
|
+
expect(observe).toHaveBeenCalled();
|
|
320
|
+
global.ResizeObserver = originalResizeObserver;
|
|
321
|
+
});
|
|
303
322
|
});
|
|
304
323
|
describe('MarqueeBase', function () {
|
|
305
324
|
// Computed Property Tests
|
package/Routable/Routable.js
CHANGED
|
@@ -103,7 +103,7 @@ var Routable = exports.Routable = (0, _hoc["default"])(defaultConfig, function (
|
|
|
103
103
|
* @required
|
|
104
104
|
* @public
|
|
105
105
|
*/
|
|
106
|
-
path: _util.
|
|
106
|
+
path: _util.RoutablePropTypes.path.isRequired
|
|
107
107
|
}, navigate, _propTypes2["default"].func),
|
|
108
108
|
handlers: _defineProperty({
|
|
109
109
|
handleNavigate: function handleNavigate(_ref, _ref2) {
|
package/Routable/Router.js
CHANGED
|
@@ -142,7 +142,7 @@ var RouterBase = exports.RouterBase = (_class = /*#__PURE__*/function (_ReactCom
|
|
|
142
142
|
* @required
|
|
143
143
|
* @public
|
|
144
144
|
*/
|
|
145
|
-
path: _util.
|
|
145
|
+
path: _util.RoutablePropTypes.path.isRequired,
|
|
146
146
|
/**
|
|
147
147
|
* The component wrapping the rendered path.
|
|
148
148
|
*
|
package/Routable/util.js
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
exports.toSegments = exports.stringifyRoutes = exports.resolve = exports.
|
|
6
|
+
exports.toSegments = exports.stringifyRoutes = exports.resolve = exports.RouteContext = exports.RoutablePropTypes = void 0;
|
|
7
7
|
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
8
8
|
var _react = require("react");
|
|
9
9
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
|
@@ -70,7 +70,7 @@ var resolve = exports.resolve = function resolve() {
|
|
|
70
70
|
// finally rebuild the path including the segment we just shifted
|
|
71
71
|
return "/".concat(base.concat(path).join('/'));
|
|
72
72
|
};
|
|
73
|
-
var
|
|
73
|
+
var RoutablePropTypes = exports.RoutablePropTypes = {
|
|
74
74
|
path: _propTypes["default"].oneOfType([_propTypes["default"].arrayOf(_propTypes["default"].string),
|
|
75
75
|
// array of path segments
|
|
76
76
|
_propTypes["default"].string // URI-style path
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@enact/ui",
|
|
3
|
-
"version": "4.7.
|
|
3
|
+
"version": "4.7.9",
|
|
4
4
|
"description": "A collection of simplified unstyled cross-platform UI components for Enact",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -31,12 +31,12 @@
|
|
|
31
31
|
}
|
|
32
32
|
},
|
|
33
33
|
"dependencies": {
|
|
34
|
-
"@enact/core": "^4.7.
|
|
34
|
+
"@enact/core": "^4.7.9",
|
|
35
35
|
"classnames": "^2.3.2",
|
|
36
36
|
"direction": "^1.0.4",
|
|
37
37
|
"invariant": "^2.2.4",
|
|
38
38
|
"prop-types": "^15.8.1",
|
|
39
|
-
"ramda": "^0.29.
|
|
39
|
+
"ramda": "^0.29.1",
|
|
40
40
|
"react": "^18.2.0",
|
|
41
41
|
"react-dom": "^18.2.0",
|
|
42
42
|
"react-is": "^18.2.0",
|