@enact/webos 5.0.0-alpha.1 → 5.0.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/CHANGELOG.md +28 -0
- package/LS2Request/LS2Request.js +4 -5
- package/LS2Request/tests/LS2Request-specs.js +1 -1
- package/deviceinfo/deviceinfo.js +1 -1
- package/lastInputType/lastInputType.js +1 -1
- package/package.json +2 -2
- package/platform/platform.js +5 -5
- package/signLang/SignLangDecorator.js +150 -0
- package/signLang/index.d.ts +38 -0
- package/signLang/index.js +26 -0
- package/signLang/package.json +3 -0
- package/signLang/signLang.js +123 -0
- package/speech/VoiceControlDecorator.js +21 -23
- package/speech/index.js +1 -1
- package/speech/readAlert.js +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,34 @@
|
|
|
2
2
|
|
|
3
3
|
The following is a curated list of changes in the Enact webos module, newest changes on the top.
|
|
4
4
|
|
|
5
|
+
## [5.0.0-alpha.2] - 2024-10-08
|
|
6
|
+
|
|
7
|
+
### Added
|
|
8
|
+
|
|
9
|
+
- `webos/signLang` module with `startSignLang()`, `stopSignLang()` functions and `SignLangDecorator` Higher-order Component
|
|
10
|
+
|
|
11
|
+
## [4.9.2] - 2024-09-26
|
|
12
|
+
|
|
13
|
+
No significant changes.
|
|
14
|
+
|
|
15
|
+
## [4.9.1] - 2024-09-09
|
|
16
|
+
|
|
17
|
+
### Added
|
|
18
|
+
|
|
19
|
+
- `webos/signLang` module with `startSignLang()`, `stopSignLang()` functions and `SignLangDecorator` Higher-order Component
|
|
20
|
+
|
|
21
|
+
## [4.7.12] - 2024-09-05
|
|
22
|
+
|
|
23
|
+
### Added
|
|
24
|
+
|
|
25
|
+
- `webos/signLang` module with `startSignLang()`, `stopSignLang()` functions and `SignLangDecorator` Higher-order Component
|
|
26
|
+
|
|
27
|
+
## [4.9.0] - 2024-07-17
|
|
28
|
+
|
|
29
|
+
### Fixed
|
|
30
|
+
|
|
31
|
+
- `webos/speech.VoiceControlDecorator` to not remount its children when it rerenders
|
|
32
|
+
|
|
5
33
|
## [5.0.0-alpha.1] - 2024-07-11
|
|
6
34
|
|
|
7
35
|
### Removed
|
package/LS2Request/LS2Request.js
CHANGED
|
@@ -5,9 +5,9 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
});
|
|
6
6
|
exports["default"] = void 0;
|
|
7
7
|
var _util = require("@enact/core/util");
|
|
8
|
-
function _classCallCheck(
|
|
9
|
-
function _defineProperties(
|
|
10
|
-
function _createClass(
|
|
8
|
+
function _classCallCheck(a, n) { if (!(a instanceof n)) throw new TypeError("Cannot call a class as a function"); }
|
|
9
|
+
function _defineProperties(e, r) { for (var t = 0; t < r.length; t++) { var o = r[t]; o.enumerable = o.enumerable || !1, o.configurable = !0, "value" in o && (o.writable = !0), Object.defineProperty(e, _toPropertyKey(o.key), o); } }
|
|
10
|
+
function _createClass(e, r, t) { return r && _defineProperties(e.prototype, r), t && _defineProperties(e, t), Object.defineProperty(e, "prototype", { writable: !1 }), e; }
|
|
11
11
|
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == typeof i ? i : i + ""; }
|
|
12
12
|
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); } /* eslint-disable no-console */ /**
|
|
13
13
|
* Provides a class for making LS2 service requests on webOS platforms.
|
|
@@ -83,7 +83,7 @@ var LS2Request = exports["default"] = /*#__PURE__*/function () {
|
|
|
83
83
|
* @returns {webos/LS2Request}
|
|
84
84
|
* @public
|
|
85
85
|
*/
|
|
86
|
-
_createClass(LS2Request, [{
|
|
86
|
+
return _createClass(LS2Request, [{
|
|
87
87
|
key: "send",
|
|
88
88
|
value: function send(_ref4) {
|
|
89
89
|
var _window$WebOSServiceB;
|
|
@@ -214,5 +214,4 @@ var LS2Request = exports["default"] = /*#__PURE__*/function () {
|
|
|
214
214
|
}
|
|
215
215
|
}
|
|
216
216
|
}]);
|
|
217
|
-
return LS2Request;
|
|
218
217
|
}();
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
3
|
var _LS2Request = _interopRequireDefault(require("../LS2Request"));
|
|
4
|
-
function _interopRequireDefault(
|
|
4
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { "default": e }; }
|
|
5
5
|
describe('LS2Request', function () {
|
|
6
6
|
var nop = function nop() {};
|
|
7
7
|
describe('callback', function () {
|
package/deviceinfo/deviceinfo.js
CHANGED
|
@@ -6,7 +6,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
6
6
|
exports.deviceinfo = exports["default"] = void 0;
|
|
7
7
|
var _LS2Request = _interopRequireDefault(require("../LS2Request"));
|
|
8
8
|
var _platform = require("../platform");
|
|
9
|
-
function _interopRequireDefault(
|
|
9
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { "default": e }; }
|
|
10
10
|
/**
|
|
11
11
|
* Provides a function to get the device-specific information.
|
|
12
12
|
*
|
|
@@ -6,7 +6,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
6
6
|
exports.requestLastInputType = exports["default"] = void 0;
|
|
7
7
|
var _LS2Request = _interopRequireDefault(require("../LS2Request"));
|
|
8
8
|
var _platform = _interopRequireDefault(require("../platform"));
|
|
9
|
-
function _interopRequireDefault(
|
|
9
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { "default": e }; }
|
|
10
10
|
/**
|
|
11
11
|
* Exports a method for calling `surfacemanager` service through LS2Request and returns `lastInputType`
|
|
12
12
|
*
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@enact/webos",
|
|
3
|
-
"version": "5.0.0-alpha.
|
|
3
|
+
"version": "5.0.0-alpha.2",
|
|
4
4
|
"description": "webOS support library",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -32,7 +32,7 @@
|
|
|
32
32
|
}
|
|
33
33
|
},
|
|
34
34
|
"dependencies": {
|
|
35
|
-
"@enact/core": "^5.0.0-alpha.
|
|
35
|
+
"@enact/core": "^5.0.0-alpha.2",
|
|
36
36
|
"prop-types": "^15.8.1",
|
|
37
37
|
"react": "^18.3.1",
|
|
38
38
|
"react-dom": "^18.3.1"
|
package/platform/platform.js
CHANGED
|
@@ -6,12 +6,12 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
6
6
|
exports["default"] = void 0;
|
|
7
7
|
exports.detect = detect;
|
|
8
8
|
exports.platform = exports.parseUserAgent = void 0;
|
|
9
|
-
function _toConsumableArray(
|
|
9
|
+
function _toConsumableArray(r) { return _arrayWithoutHoles(r) || _iterableToArray(r) || _unsupportedIterableToArray(r) || _nonIterableSpread(); }
|
|
10
10
|
function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
11
|
-
function _unsupportedIterableToArray(
|
|
12
|
-
function _iterableToArray(
|
|
13
|
-
function _arrayWithoutHoles(
|
|
14
|
-
function _arrayLikeToArray(
|
|
11
|
+
function _unsupportedIterableToArray(r, a) { if (r) { if ("string" == typeof r) return _arrayLikeToArray(r, a); var t = {}.toString.call(r).slice(8, -1); return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : void 0; } }
|
|
12
|
+
function _iterableToArray(r) { if ("undefined" != typeof Symbol && null != r[Symbol.iterator] || null != r["@@iterator"]) return Array.from(r); }
|
|
13
|
+
function _arrayWithoutHoles(r) { if (Array.isArray(r)) return _arrayLikeToArray(r); }
|
|
14
|
+
function _arrayLikeToArray(r, a) { (null == a || a > r.length) && (a = r.length); for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e]; return n; }
|
|
15
15
|
/**
|
|
16
16
|
* Utilities for webOS platform detection.
|
|
17
17
|
*
|
|
@@ -0,0 +1,150 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports["default"] = exports.SignLangDecorator = void 0;
|
|
7
|
+
var _handle = require("@enact/core/handle");
|
|
8
|
+
var _hoc = _interopRequireDefault(require("@enact/core/hoc"));
|
|
9
|
+
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
10
|
+
var _react = require("react");
|
|
11
|
+
var _signLang = require("./signLang");
|
|
12
|
+
var _jsxRuntime = require("react/jsx-runtime");
|
|
13
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { "default": e }; }
|
|
14
|
+
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; }
|
|
15
|
+
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; }
|
|
16
|
+
function _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }
|
|
17
|
+
function _classCallCheck(a, n) { if (!(a instanceof n)) throw new TypeError("Cannot call a class as a function"); }
|
|
18
|
+
function _defineProperties(e, r) { for (var t = 0; t < r.length; t++) { var o = r[t]; o.enumerable = o.enumerable || !1, o.configurable = !0, "value" in o && (o.writable = !0), Object.defineProperty(e, _toPropertyKey(o.key), o); } }
|
|
19
|
+
function _createClass(e, r, t) { return r && _defineProperties(e.prototype, r), t && _defineProperties(e, t), Object.defineProperty(e, "prototype", { writable: !1 }), e; }
|
|
20
|
+
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == typeof i ? i : i + ""; }
|
|
21
|
+
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); }
|
|
22
|
+
function _callSuper(t, o, e) { return o = _getPrototypeOf(o), _possibleConstructorReturn(t, _isNativeReflectConstruct() ? Reflect.construct(o, e || [], _getPrototypeOf(t).constructor) : o.apply(t, e)); }
|
|
23
|
+
function _possibleConstructorReturn(t, e) { if (e && ("object" == typeof e || "function" == typeof e)) return e; if (void 0 !== e) throw new TypeError("Derived constructors may only return object or undefined"); return _assertThisInitialized(t); }
|
|
24
|
+
function _assertThisInitialized(e) { if (void 0 === e) throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); return e; }
|
|
25
|
+
function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); }
|
|
26
|
+
function _getPrototypeOf(t) { return _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function (t) { return t.__proto__ || Object.getPrototypeOf(t); }, _getPrototypeOf(t); }
|
|
27
|
+
function _inherits(t, e) { if ("function" != typeof e && null !== e) throw new TypeError("Super expression must either be null or a function"); t.prototype = Object.create(e && e.prototype, { constructor: { value: t, writable: !0, configurable: !0 } }), Object.defineProperty(t, "prototype", { writable: !1 }), e && _setPrototypeOf(t, e); }
|
|
28
|
+
function _setPrototypeOf(t, e) { return _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function (t, e) { return t.__proto__ = e, t; }, _setPrototypeOf(t, e); } /**
|
|
29
|
+
* Default config for {@link webos/signLang.SignLangDecorator}
|
|
30
|
+
*
|
|
31
|
+
* @type {Object}
|
|
32
|
+
* @hocconfig
|
|
33
|
+
* @memberof webos/signLang.SignLangDecorator
|
|
34
|
+
*/
|
|
35
|
+
var defaultConfig = {
|
|
36
|
+
/**
|
|
37
|
+
* Time to wait (in milliseconds) before calling Sign Language API.
|
|
38
|
+
*
|
|
39
|
+
* @type {Number}
|
|
40
|
+
* @default 0
|
|
41
|
+
* @memberof webos/signLang.SignLangDecorator.defaultConfig
|
|
42
|
+
* @public
|
|
43
|
+
*/
|
|
44
|
+
signLangDelay: 0
|
|
45
|
+
};
|
|
46
|
+
|
|
47
|
+
/**
|
|
48
|
+
* Usage:
|
|
49
|
+
* ```
|
|
50
|
+
* import Button from '@enact/sandstone/Button';
|
|
51
|
+
* import {SignLangDecorator} from '@enact/webos/signLang';
|
|
52
|
+
* import {Component} from 'react';
|
|
53
|
+
*
|
|
54
|
+
* const SignLangButton = SignLangDecorator(Button);
|
|
55
|
+
*
|
|
56
|
+
* class Sample extends Component {
|
|
57
|
+
* render () {
|
|
58
|
+
* return(
|
|
59
|
+
* <div>
|
|
60
|
+
* <SignLangButton signLangId="settings_audioguide_1">Hello</SignLangButton>
|
|
61
|
+
* </div>
|
|
62
|
+
* );
|
|
63
|
+
* }
|
|
64
|
+
* }
|
|
65
|
+
* ```
|
|
66
|
+
*
|
|
67
|
+
* SignLangDecorator is a higher order component that adds feature for sign language
|
|
68
|
+
* to its wrapped component.
|
|
69
|
+
*
|
|
70
|
+
* @class SignLangDecorator
|
|
71
|
+
* @memberof webos/signLang
|
|
72
|
+
* @hoc
|
|
73
|
+
* @public
|
|
74
|
+
*/
|
|
75
|
+
var SignLangDecorator = exports.SignLangDecorator = (0, _hoc["default"])(defaultConfig, function (config, Wrapped) {
|
|
76
|
+
var _Class;
|
|
77
|
+
var signLangDelay = config.signLangDelay;
|
|
78
|
+
var forwardBlur = (0, _handle.forward)('onBlur');
|
|
79
|
+
var forwardFocus = (0, _handle.forward)('onFocus');
|
|
80
|
+
return _Class = /*#__PURE__*/function (_Component) {
|
|
81
|
+
function _Class(props) {
|
|
82
|
+
var _this;
|
|
83
|
+
_classCallCheck(this, _Class);
|
|
84
|
+
_this = _callSuper(this, _Class, [props]);
|
|
85
|
+
_this.requestSignLang = function (active) {
|
|
86
|
+
var _this$props = _this.props,
|
|
87
|
+
_this$props$signLangI = _this$props.signLangId,
|
|
88
|
+
signLangId = _this$props$signLangI === void 0 ? '' : _this$props$signLangI,
|
|
89
|
+
_this$props$signLangO = _this$props.signLangOption,
|
|
90
|
+
signLangOption = _this$props$signLangO === void 0 ? {} : _this$props$signLangO;
|
|
91
|
+
if (signLangId.length > 0) {
|
|
92
|
+
if (active) {
|
|
93
|
+
if (signLangDelay === 0) {
|
|
94
|
+
(0, _signLang.startSignLang)(signLangId, signLangOption);
|
|
95
|
+
} else {
|
|
96
|
+
clearTimeout(_this.signLangDelayId);
|
|
97
|
+
_this.signLangDelayId = setTimeout(function () {
|
|
98
|
+
(0, _signLang.startSignLang)(signLangId, signLangOption);
|
|
99
|
+
}, signLangDelay);
|
|
100
|
+
}
|
|
101
|
+
} else {
|
|
102
|
+
if (signLangDelay > 0) clearTimeout(_this.signLangDelayId);
|
|
103
|
+
(0, _signLang.stopSignLang)(signLangId, signLangOption);
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
};
|
|
107
|
+
_this.onFocus = function (ev) {
|
|
108
|
+
forwardFocus(ev, _this.props);
|
|
109
|
+
_this.requestSignLang(true);
|
|
110
|
+
};
|
|
111
|
+
_this.onBlur = function (ev) {
|
|
112
|
+
forwardBlur(ev, _this.props);
|
|
113
|
+
_this.requestSignLang(false);
|
|
114
|
+
};
|
|
115
|
+
_this.signLangDelayId = null;
|
|
116
|
+
return _this;
|
|
117
|
+
}
|
|
118
|
+
_inherits(_Class, _Component);
|
|
119
|
+
return _createClass(_Class, [{
|
|
120
|
+
key: "render",
|
|
121
|
+
value: function render() {
|
|
122
|
+
var props = Object.assign({}, this.props);
|
|
123
|
+
delete props.onBlur;
|
|
124
|
+
delete props.onFocus;
|
|
125
|
+
delete props.signLangId;
|
|
126
|
+
delete props.signLangOption;
|
|
127
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)(Wrapped, _objectSpread(_objectSpread({}, props), {}, {
|
|
128
|
+
onBlur: this.onBlur,
|
|
129
|
+
onFocus: this.onFocus
|
|
130
|
+
}));
|
|
131
|
+
}
|
|
132
|
+
}]);
|
|
133
|
+
}(_react.Component), _Class.displayName = 'SignLangDecorator', _Class.propTypes = /** @lends webos/signLang.SignLangDecorator.prototype */{
|
|
134
|
+
/**
|
|
135
|
+
* Unique ID for sign language.
|
|
136
|
+
*
|
|
137
|
+
* @type {String}
|
|
138
|
+
* @public
|
|
139
|
+
*/
|
|
140
|
+
signLangId: _propTypes["default"].string,
|
|
141
|
+
/**
|
|
142
|
+
* Additional option for sign language.
|
|
143
|
+
*
|
|
144
|
+
* @type {Object}
|
|
145
|
+
* @public
|
|
146
|
+
*/
|
|
147
|
+
signLangOption: _propTypes["default"].object
|
|
148
|
+
}, _Class;
|
|
149
|
+
});
|
|
150
|
+
var _default = exports["default"] = SignLangDecorator;
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
// Type definitions for webos/signLang
|
|
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 SignLangDecoratorConfig extends Object {
|
|
7
|
+
/**
|
|
8
|
+
* Time to wait (in milliseconds) before calling Sign Language API.
|
|
9
|
+
*/
|
|
10
|
+
signLangDelay?: number;
|
|
11
|
+
}
|
|
12
|
+
export interface SignLangDecoratorProps {
|
|
13
|
+
/**
|
|
14
|
+
* Unique ID for sign language.
|
|
15
|
+
*/
|
|
16
|
+
signLangId?: string;
|
|
17
|
+
/**
|
|
18
|
+
* Additional option for sign language.
|
|
19
|
+
*/
|
|
20
|
+
signLangOption?: object;
|
|
21
|
+
}
|
|
22
|
+
export function SignLangDecorator<P>(
|
|
23
|
+
config: SignLangDecoratorConfig,
|
|
24
|
+
Component: React.ComponentType<P> | string,
|
|
25
|
+
): React.ComponentType<P & SignLangDecoratorProps>;
|
|
26
|
+
|
|
27
|
+
export function SignLangDecorator<P>(
|
|
28
|
+
Component: React.ComponentType<P> | string,
|
|
29
|
+
): React.ComponentType<P & SignLangDecoratorProps>;
|
|
30
|
+
|
|
31
|
+
/**
|
|
32
|
+
* Activates sign language based on the singLangID.
|
|
33
|
+
*/
|
|
34
|
+
export function startSignLang(signLangId: string, option: object): void;
|
|
35
|
+
/**
|
|
36
|
+
* Deactivates sign language based on the signLangID.
|
|
37
|
+
*/
|
|
38
|
+
export function stopSignLang(signLangId: string, option: object): void;
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
Object.defineProperty(exports, "SignLangDecorator", {
|
|
7
|
+
enumerable: true,
|
|
8
|
+
get: function get() {
|
|
9
|
+
return _SignLangDecorator["default"];
|
|
10
|
+
}
|
|
11
|
+
});
|
|
12
|
+
Object.defineProperty(exports, "startSignLang", {
|
|
13
|
+
enumerable: true,
|
|
14
|
+
get: function get() {
|
|
15
|
+
return _signLang.startSignLang;
|
|
16
|
+
}
|
|
17
|
+
});
|
|
18
|
+
Object.defineProperty(exports, "stopSignLang", {
|
|
19
|
+
enumerable: true,
|
|
20
|
+
get: function get() {
|
|
21
|
+
return _signLang.stopSignLang;
|
|
22
|
+
}
|
|
23
|
+
});
|
|
24
|
+
var _signLang = require("./signLang");
|
|
25
|
+
var _SignLangDecorator = _interopRequireDefault(require("./SignLangDecorator"));
|
|
26
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { "default": e }; }
|
|
@@ -0,0 +1,123 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.stopSignLang = exports.startSignLang = void 0;
|
|
7
|
+
var _pmloglib = require("@enact/webos/pmloglib");
|
|
8
|
+
var _LS2Request = _interopRequireDefault(require("../LS2Request"));
|
|
9
|
+
var _platform = require("../platform");
|
|
10
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { "default": e }; }
|
|
11
|
+
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; }
|
|
12
|
+
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; }
|
|
13
|
+
function _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }
|
|
14
|
+
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == typeof i ? i : i + ""; }
|
|
15
|
+
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); } /* eslint-disable no-console */
|
|
16
|
+
var signLangEnabled = null;
|
|
17
|
+
var appId = '';
|
|
18
|
+
var checkSignLang = function checkSignLang() {
|
|
19
|
+
return new Promise(function (resolve, reject) {
|
|
20
|
+
if (signLangEnabled === null) {
|
|
21
|
+
new _LS2Request["default"]().send({
|
|
22
|
+
service: 'luna://com.webos.settingsservice',
|
|
23
|
+
method: 'getSystemSettings',
|
|
24
|
+
subscribe: true,
|
|
25
|
+
parameters: {
|
|
26
|
+
'keys': ['signLanguageGuidance'],
|
|
27
|
+
'category': 'option'
|
|
28
|
+
},
|
|
29
|
+
onSuccess: function onSuccess(res) {
|
|
30
|
+
(0, _pmloglib.info)('enact_signLang_checkSignLang', {
|
|
31
|
+
'onSuccess': res
|
|
32
|
+
}, '');
|
|
33
|
+
if (res && res.settings.signLanguageGuidance === 'on') {
|
|
34
|
+
signLangEnabled = true;
|
|
35
|
+
appId = typeof window == 'object' && window.PalmSystem && window.PalmSystem.getIdentifier && window.PalmSystem.getIdentifier();
|
|
36
|
+
resolve();
|
|
37
|
+
return;
|
|
38
|
+
}
|
|
39
|
+
signLangEnabled = false;
|
|
40
|
+
reject();
|
|
41
|
+
},
|
|
42
|
+
onFailure: function onFailure(err) {
|
|
43
|
+
(0, _pmloglib.info)('enact_signLang_checkSignLang', {
|
|
44
|
+
'onFailure': err
|
|
45
|
+
}, '');
|
|
46
|
+
reject('Failed to get sign language setting value: ' + JSON.stringify(err));
|
|
47
|
+
}
|
|
48
|
+
});
|
|
49
|
+
} else if (signLangEnabled) {
|
|
50
|
+
resolve();
|
|
51
|
+
} else {
|
|
52
|
+
reject();
|
|
53
|
+
}
|
|
54
|
+
});
|
|
55
|
+
};
|
|
56
|
+
var callSignLangAPI = function callSignLangAPI(signLangId, active, option) {
|
|
57
|
+
return function () {
|
|
58
|
+
return new Promise(function (resolve, reject) {
|
|
59
|
+
var parameters = _objectSpread({
|
|
60
|
+
appId: appId,
|
|
61
|
+
'signGuidanceId': signLangId,
|
|
62
|
+
'focusOut': !active
|
|
63
|
+
}, option);
|
|
64
|
+
(0, _pmloglib.info)('enact_signLang_callSignLangAPI', parameters, '');
|
|
65
|
+
new _LS2Request["default"]().send({
|
|
66
|
+
service: 'luna://com.webos.service.signlanguageavatar',
|
|
67
|
+
method: 'play',
|
|
68
|
+
parameters: parameters,
|
|
69
|
+
onSuccess: resolve,
|
|
70
|
+
onFailure: function onFailure(err) {
|
|
71
|
+
(0, _pmloglib.info)('enact_signLang_callSignLangAPI', {
|
|
72
|
+
'onFailure': err
|
|
73
|
+
}, '');
|
|
74
|
+
reject('Failed to callSignLangAPI: ' + JSON.stringify(err));
|
|
75
|
+
}
|
|
76
|
+
});
|
|
77
|
+
});
|
|
78
|
+
};
|
|
79
|
+
};
|
|
80
|
+
var requestSignLang = function requestSignLang(signLangId, active) {
|
|
81
|
+
var option = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
|
|
82
|
+
if (_platform.platform.tv) {
|
|
83
|
+
checkSignLang().then(callSignLangAPI(signLangId, active, option))["catch"](function (message) {
|
|
84
|
+
if (message) {
|
|
85
|
+
console.error("Failed to requestSignLang: ".concat(message));
|
|
86
|
+
}
|
|
87
|
+
});
|
|
88
|
+
} else {
|
|
89
|
+
console.warn('Platform doesn\'t support sing language.');
|
|
90
|
+
}
|
|
91
|
+
};
|
|
92
|
+
|
|
93
|
+
/**
|
|
94
|
+
* Activates sign language based on the singLangID.
|
|
95
|
+
*
|
|
96
|
+
* @function
|
|
97
|
+
* @param {String} [signLangId=''] signLangId Unique ID used for sign language.
|
|
98
|
+
* @param {Object} [option={}] Additional option for sign language.
|
|
99
|
+
* @returns {undefined}
|
|
100
|
+
* @memberof webos/signLang
|
|
101
|
+
* @public
|
|
102
|
+
*/
|
|
103
|
+
var startSignLang = exports.startSignLang = function startSignLang() {
|
|
104
|
+
var signLangId = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : '';
|
|
105
|
+
var option = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
106
|
+
requestSignLang(signLangId, true, option);
|
|
107
|
+
};
|
|
108
|
+
|
|
109
|
+
/**
|
|
110
|
+
* Deactivates sign language based on the signLangID.
|
|
111
|
+
*
|
|
112
|
+
* @function
|
|
113
|
+
* @param {String} [signLangId=''] signLangId Unique ID used for sign language.
|
|
114
|
+
* @param {Object} [option={}] Additional option for sign language.
|
|
115
|
+
* @returns {undefined}
|
|
116
|
+
* @memberof webos/signLang
|
|
117
|
+
* @public
|
|
118
|
+
*/
|
|
119
|
+
var stopSignLang = exports.stopSignLang = function stopSignLang() {
|
|
120
|
+
var signLangId = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : '';
|
|
121
|
+
var option = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
122
|
+
requestSignLang(signLangId, false, option);
|
|
123
|
+
};
|
|
@@ -9,22 +9,22 @@ var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
|
9
9
|
var _hoc = _interopRequireDefault(require("@enact/core/hoc"));
|
|
10
10
|
var _WithRef = require("@enact/core/internal/WithRef");
|
|
11
11
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
12
|
-
function _interopRequireDefault(
|
|
12
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { "default": e }; }
|
|
13
13
|
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
14
14
|
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
15
|
-
function _defineProperty(
|
|
16
|
-
function _classCallCheck(
|
|
17
|
-
function _defineProperties(
|
|
18
|
-
function _createClass(
|
|
15
|
+
function _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }
|
|
16
|
+
function _classCallCheck(a, n) { if (!(a instanceof n)) throw new TypeError("Cannot call a class as a function"); }
|
|
17
|
+
function _defineProperties(e, r) { for (var t = 0; t < r.length; t++) { var o = r[t]; o.enumerable = o.enumerable || !1, o.configurable = !0, "value" in o && (o.writable = !0), Object.defineProperty(e, _toPropertyKey(o.key), o); } }
|
|
18
|
+
function _createClass(e, r, t) { return r && _defineProperties(e.prototype, r), t && _defineProperties(e, t), Object.defineProperty(e, "prototype", { writable: !1 }), e; }
|
|
19
19
|
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == typeof i ? i : i + ""; }
|
|
20
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
|
|
22
|
-
function
|
|
23
|
-
function
|
|
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; }
|
|
21
|
+
function _callSuper(t, o, e) { return o = _getPrototypeOf(o), _possibleConstructorReturn(t, _isNativeReflectConstruct() ? Reflect.construct(o, e || [], _getPrototypeOf(t).constructor) : o.apply(t, e)); }
|
|
22
|
+
function _possibleConstructorReturn(t, e) { if (e && ("object" == typeof e || "function" == typeof e)) return e; if (void 0 !== e) throw new TypeError("Derived constructors may only return object or undefined"); return _assertThisInitialized(t); }
|
|
23
|
+
function _assertThisInitialized(e) { if (void 0 === e) throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); return e; }
|
|
26
24
|
function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); }
|
|
27
|
-
function _getPrototypeOf(
|
|
25
|
+
function _getPrototypeOf(t) { return _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function (t) { return t.__proto__ || Object.getPrototypeOf(t); }, _getPrototypeOf(t); }
|
|
26
|
+
function _inherits(t, e) { if ("function" != typeof e && null !== e) throw new TypeError("Super expression must either be null or a function"); t.prototype = Object.create(e && e.prototype, { constructor: { value: t, writable: !0, configurable: !0 } }), Object.defineProperty(t, "prototype", { writable: !1 }), e && _setPrototypeOf(t, e); }
|
|
27
|
+
function _setPrototypeOf(t, e) { return _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function (t, e) { return t.__proto__ = e, t; }, _setPrototypeOf(t, e); } /**
|
|
28
28
|
* VoiceControlDecorator is a higher-order component that adds a callback for voice event
|
|
29
29
|
* to its wrapped component.
|
|
30
30
|
*
|
|
@@ -76,19 +76,19 @@ function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.g
|
|
|
76
76
|
* @public
|
|
77
77
|
*/
|
|
78
78
|
var VoiceControlDecorator = exports.VoiceControlDecorator = (0, _hoc["default"])(function (config, Wrapped) {
|
|
79
|
-
var
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
function _class(props) {
|
|
79
|
+
var _Class;
|
|
80
|
+
var WithRefComponent = (0, _WithRef.WithRef)(Wrapped);
|
|
81
|
+
return _Class = /*#__PURE__*/function (_Component) {
|
|
82
|
+
function _Class(props) {
|
|
84
83
|
var _this;
|
|
85
|
-
_classCallCheck(this,
|
|
86
|
-
_this =
|
|
84
|
+
_classCallCheck(this, _Class);
|
|
85
|
+
_this = _callSuper(this, _Class, [props]);
|
|
87
86
|
_this.node = null;
|
|
88
87
|
_this.nodeRef = /*#__PURE__*/(0, _react.createRef)();
|
|
89
88
|
return _this;
|
|
90
89
|
}
|
|
91
|
-
|
|
90
|
+
_inherits(_Class, _Component);
|
|
91
|
+
return _createClass(_Class, [{
|
|
92
92
|
key: "componentDidMount",
|
|
93
93
|
value: function componentDidMount() {
|
|
94
94
|
this.node = this.nodeRef.current;
|
|
@@ -107,15 +107,13 @@ var VoiceControlDecorator = exports.VoiceControlDecorator = (0, _hoc["default"])
|
|
|
107
107
|
value: function render() {
|
|
108
108
|
var props = _objectSpread({}, this.props);
|
|
109
109
|
delete props.onVoice;
|
|
110
|
-
var WithRefComponent = (0, _WithRef.WithRef)(Wrapped);
|
|
111
110
|
return /*#__PURE__*/(0, _jsxRuntime.jsx)(WithRefComponent, _objectSpread(_objectSpread({}, props), {}, {
|
|
112
111
|
outermostRef: this.nodeRef,
|
|
113
112
|
referrerName: "VoiceControlDecorator"
|
|
114
113
|
}));
|
|
115
114
|
}
|
|
116
115
|
}]);
|
|
117
|
-
|
|
118
|
-
}(_react.Component), _class.displayName = 'VoiceControlDecorator', _class.propTypes = /** @lends webos/speech.VoiceControlDecorator.prototype */{
|
|
116
|
+
}(_react.Component), _Class.displayName = 'VoiceControlDecorator', _Class.propTypes = /** @lends webos/speech.VoiceControlDecorator.prototype */{
|
|
119
117
|
/**
|
|
120
118
|
* Callback to be executed when a wrapped element's `data-webos-voice-intent` is activated.
|
|
121
119
|
*
|
|
@@ -124,6 +122,6 @@ var VoiceControlDecorator = exports.VoiceControlDecorator = (0, _hoc["default"])
|
|
|
124
122
|
* @public
|
|
125
123
|
*/
|
|
126
124
|
onVoice: _propTypes["default"].func.isRequired
|
|
127
|
-
},
|
|
125
|
+
}, _Class;
|
|
128
126
|
});
|
|
129
127
|
var _default = exports["default"] = VoiceControlDecorator;
|
package/speech/index.js
CHANGED
|
@@ -17,4 +17,4 @@ Object.defineProperty(exports, "readAlert", {
|
|
|
17
17
|
});
|
|
18
18
|
var _readAlert = _interopRequireDefault(require("./readAlert"));
|
|
19
19
|
var _VoiceControlDecorator = _interopRequireDefault(require("./VoiceControlDecorator"));
|
|
20
|
-
function _interopRequireDefault(
|
|
20
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { "default": e }; }
|
package/speech/readAlert.js
CHANGED
|
@@ -6,7 +6,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
6
6
|
exports.readAlert = exports["default"] = void 0;
|
|
7
7
|
var _LS2Request = _interopRequireDefault(require("../LS2Request"));
|
|
8
8
|
var _platform = require("../platform");
|
|
9
|
-
function _interopRequireDefault(
|
|
9
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { "default": e }; }
|
|
10
10
|
/* eslint-disable no-console */
|
|
11
11
|
|
|
12
12
|
var audioGuidanceEnabled = null;
|