@enact/webos 3.4.9-experimental-3 → 3.4.9-experimental-7

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.
Files changed (46) hide show
  1. package/CHANGELOG.md +16 -0
  2. package/{build/LS2Request → LS2Request}/LS2Request.d.ts +0 -0
  3. package/LS2Request/LS2Request.js +228 -173
  4. package/LS2Request/tests/LS2Request-specs.js +85 -95
  5. package/{build/application → application}/application.d.ts +0 -0
  6. package/application/application.js +92 -70
  7. package/{build/deviceinfo → deviceinfo}/deviceinfo.d.ts +0 -0
  8. package/deviceinfo/deviceinfo.js +78 -62
  9. package/{build/index.d.ts → index.d.ts} +0 -0
  10. package/index.js +1 -0
  11. package/{build/keyboard → keyboard}/keyboard.d.ts +0 -0
  12. package/keyboard/keyboard.js +11 -4
  13. package/package.json +2 -2
  14. package/{build/platform → platform}/platform.d.ts +0 -0
  15. package/platform/platform.js +67 -65
  16. package/{build/pmloglib → pmloglib}/pmloglib.d.ts +0 -0
  17. package/pmloglib/pmloglib.js +116 -86
  18. package/speech/VoiceControlDecorator.js +99 -42
  19. package/{build/speech → speech}/index.d.ts +0 -0
  20. package/speech/index.js +23 -15
  21. package/speech/readAlert.js +78 -60
  22. package/build/CHANGELOG.md +0 -603
  23. package/build/LS2Request/LS2Request.js +0 -239
  24. package/build/LS2Request/package.json +0 -3
  25. package/build/LS2Request/tests/LS2Request-specs.js +0 -85
  26. package/build/README.md +0 -22
  27. package/build/application/application.js +0 -150
  28. package/build/application/package.json +0 -3
  29. package/build/deviceinfo/deviceinfo.js +0 -114
  30. package/build/deviceinfo/package.json +0 -3
  31. package/build/index.js +0 -2
  32. package/build/keyboard/keyboard.js +0 -27
  33. package/build/keyboard/package.json +0 -3
  34. package/build/package-lock.json +0 -221
  35. package/build/package.json +0 -33
  36. package/build/platform/package.json +0 -3
  37. package/build/platform/platform.js +0 -105
  38. package/build/pmloglib/package.json +0 -3
  39. package/build/pmloglib/pmloglib.js +0 -241
  40. package/build/speech/VoiceControlDecorator.js +0 -152
  41. package/build/speech/index.js +0 -23
  42. package/build/speech/package.json +0 -3
  43. package/build/speech/readAlert.js +0 -96
  44. package/docs/index.md +0 -8
  45. package/docs/luna-service-api.md +0 -35
  46. package/docs/webos-features.md +0 -37
@@ -1,152 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.VoiceControlDecorator = exports["default"] = void 0;
7
-
8
- var _react = _interopRequireDefault(require("react"));
9
-
10
- var _propTypes = _interopRequireDefault(require("prop-types"));
11
-
12
- var _reactDom = require("react-dom");
13
-
14
- var _hoc = _interopRequireDefault(require("@enact/core/hoc"));
15
-
16
- function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
17
-
18
- function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; }
19
-
20
- function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
21
-
22
- 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; }
23
-
24
- function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
25
-
26
- 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); } }
27
-
28
- function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
29
-
30
- 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 } }); if (superClass) _setPrototypeOf(subClass, superClass); }
31
-
32
- function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
33
-
34
- 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); }; }
35
-
36
- function _possibleConstructorReturn(self, call) { if (call && (typeof call === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); }
37
-
38
- function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
39
-
40
- function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Date.prototype.toString.call(Reflect.construct(Date, [], function () {})); return true; } catch (e) { return false; } }
41
-
42
- function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
43
-
44
- /**
45
- * VoiceControlDecorator is a higher-order component that adds a callback for voice event
46
- * to its wrapped component.
47
- *
48
- * By default, `onVoice` handler will be added to the node where `data-webos-voice-intent` attribute is declared.
49
- * In addition, if you need to specify a target node, `data-webos-voice-event-target` attribute can be used.
50
- *
51
- * Usage:
52
- * ```
53
- * import React from 'react';
54
- * import Item from '@enact/moonstone/Item';
55
- * import {VoiceControlDecorator} from '@enact/webos/speech';
56
- *
57
- * const VoiceDiv = VoiceControlDecorator('div');
58
- * const VoiceItem = VoiceControlDecorator(Item);
59
- *
60
- * class Sample extends React.Component {
61
- * handlePlayListControl = (e) => {
62
- * const {intent, control} = e.detail;
63
- * // Change the app status refer to the `control` value.
64
- * }
65
- *
66
- * handlePlayContent = (e) => {
67
- * const {intent, value} = e.detail;
68
- * // Play content
69
- * }
70
- *
71
- * render () {
72
- * return(
73
- * <div>
74
- * <VoiceDiv
75
- * data-webos-voice-intent='PlayListControl'
76
- * onVoice={this.handlePlayListControl}
77
- * />
78
- * <VoiceItem
79
- * data-webos-voice-intent='Select PlayContent'
80
- * onVoice={this.handlePlayContent}
81
- * >
82
- * The Dark Knight
83
- * </VoiceItem>
84
- * </div>
85
- * );
86
- * }
87
- * }
88
- * ```
89
- *
90
- * @class VoiceControlDecorator
91
- * @memberof webos/speech
92
- * @hoc
93
- * @public
94
- */
95
- var VoiceControlDecorator = (0, _hoc["default"])(function (config, Wrapped) {
96
- var _class, _temp;
97
-
98
- // eslint-disable-line no-unused-vars
99
- return _temp = _class = /*#__PURE__*/function (_React$Component) {
100
- _inherits(_class, _React$Component);
101
-
102
- var _super = _createSuper(_class);
103
-
104
- function _class() {
105
- _classCallCheck(this, _class);
106
-
107
- return _super.apply(this, arguments);
108
- }
109
-
110
- _createClass(_class, [{
111
- key: "componentDidMount",
112
- value: function componentDidMount() {
113
- this.node = (0, _reactDom.findDOMNode)(this); // eslint-disable-line
114
-
115
- if (this.node && !(this.node.hasAttribute('data-webos-voice-event-target') || this.node.hasAttribute('data-webos-voice-intent'))) {
116
- this.node = this.node.querySelector('[data-webos-voice-event-target]') || this.node.querySelector('[data-webos-voice-intent]');
117
- }
118
-
119
- if (this.node) this.node.addEventListener('webOSVoice', this.props.onVoice);
120
- }
121
- }, {
122
- key: "componentWillUnmount",
123
- value: function componentWillUnmount() {
124
- if (this.node) this.node.removeEventListener('webOSVoice', this.props.onVoice);
125
- }
126
- }, {
127
- key: "render",
128
- value: function render() {
129
- var props = _objectSpread({}, this.props);
130
-
131
- delete props.onVoice;
132
- return /*#__PURE__*/_react["default"].createElement(Wrapped, props);
133
- }
134
- }]);
135
-
136
- return _class;
137
- }(_react["default"].Component), _class.displayName = 'VoiceControlDecorator', _class.propTypes =
138
- /** @lends webos/speech.VoiceControlDecorator.prototype */
139
- {
140
- /**
141
- * Callback to be executed when a wrapped element's `data-webos-voice-intent` is activated.
142
- *
143
- * @type {Function}
144
- * @required
145
- * @public
146
- */
147
- onVoice: _propTypes["default"].func.isRequired
148
- }, _temp;
149
- });
150
- exports.VoiceControlDecorator = VoiceControlDecorator;
151
- var _default = VoiceControlDecorator;
152
- exports["default"] = _default;
@@ -1,23 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- Object.defineProperty(exports, "readAlert", {
7
- enumerable: true,
8
- get: function get() {
9
- return _readAlert["default"];
10
- }
11
- });
12
- Object.defineProperty(exports, "VoiceControlDecorator", {
13
- enumerable: true,
14
- get: function get() {
15
- return _VoiceControlDecorator["default"];
16
- }
17
- });
18
-
19
- var _readAlert = _interopRequireDefault(require("./readAlert"));
20
-
21
- var _VoiceControlDecorator = _interopRequireDefault(require("./VoiceControlDecorator"));
22
-
23
- function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
@@ -1,3 +0,0 @@
1
- {
2
- "main": "index.js"
3
- }
@@ -1,96 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.readAlert = exports["default"] = void 0;
7
-
8
- var _LS2Request = _interopRequireDefault(require("../LS2Request"));
9
-
10
- var _platform = require("../platform");
11
-
12
- function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
13
-
14
- /* eslint-disable no-console */
15
- var audioGuidanceEnabled = null;
16
-
17
- var checkAudioGuidance = function checkAudioGuidance() {
18
- return new Promise(function (resolve, reject) {
19
- if (audioGuidanceEnabled === null) {
20
- new _LS2Request["default"]().send({
21
- service: 'luna://com.webos.settingsservice',
22
- method: 'getSystemSettings',
23
- subscribe: true,
24
- parameters: {
25
- 'keys': ['audioGuidance'],
26
- 'category': 'option'
27
- },
28
- onSuccess: function onSuccess(res) {
29
- if (res && res.settings.audioGuidance === 'on') {
30
- audioGuidanceEnabled = true;
31
- resolve();
32
- return;
33
- }
34
-
35
- audioGuidanceEnabled = false;
36
- reject();
37
- },
38
- onFailure: function onFailure(err) {
39
- reject('Failed to get system AudioGuidance settings: ' + JSON.stringify(err));
40
- }
41
- });
42
- } else if (audioGuidanceEnabled) {
43
- resolve();
44
- } else {
45
- reject();
46
- }
47
- });
48
- };
49
-
50
- var readAlertMessage = function readAlertMessage(string, clear) {
51
- return function () {
52
- return new Promise(function (resolve, reject) {
53
- new _LS2Request["default"]().send({
54
- service: 'luna://com.webos.service.tts',
55
- method: 'speak',
56
- parameters: {
57
- 'text': string,
58
- 'clear': clear
59
- },
60
- onSuccess: resolve,
61
- onFailure: function onFailure(err) {
62
- reject('Failed to readAlertMessage: ' + JSON.stringify(err));
63
- }
64
- });
65
- });
66
- };
67
- };
68
- /**
69
- * Read alert text when accessibility audio guidance is enabled.
70
- *
71
- * @function
72
- * @param {String} string String to voice readout
73
- * @param {Boolean} [clear=true] Clear option for TTS. If true, it will cut off previous reading.
74
- * @returns {undefined}
75
- * @memberof webos/speech
76
- * @public
77
- */
78
-
79
-
80
- var readAlert = function readAlert(string) {
81
- var clear = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true;
82
-
83
- if (_platform.platform.tv) {
84
- checkAudioGuidance().then(readAlertMessage(string, clear))["catch"](function (message) {
85
- if (message) {
86
- console.error("Failed to readAlert: ".concat(message));
87
- }
88
- });
89
- } else {
90
- console.warn('Platform doesn\'t support TTS api.');
91
- }
92
- };
93
-
94
- exports.readAlert = readAlert;
95
- var _default = readAlert;
96
- exports["default"] = _default;
package/docs/index.md DELETED
@@ -1,8 +0,0 @@
1
- ---
2
- title: webOS Support Module
3
- ---
4
-
5
- The webOS package includes the following documentation:
6
-
7
- * [Luna Service API](./luna-service-api.md)
8
- * [Using webOS Features](./webos-features.md)
@@ -1,35 +0,0 @@
1
- ---
2
- title: Luna Service API
3
- ---
4
-
5
- The [Luna service API](http://webostv.developer.lge.com/api/webos-service-api/) is available on webOS platforms and allows developers to create applications that can
6
- make use of platform features, such as the `Settings Service` or the `Media Database`.
7
-
8
- ### LS2Request
9
-
10
- The Enact framework provides `@enact/webos/LS2Request` for developers to interact with the API.
11
-
12
- #### Example
13
-
14
- ```js
15
- import LS2Request from '@enact/webos/LS2Request';
16
-
17
- ...
18
-
19
- startNetwork = () => {
20
- // to cancel a request you must store a reference
21
- this.findNetworkReq = new LS2Request().send({
22
- service: 'luna://com.webos.service.wifi',
23
- method: 'findnetworks',
24
- onSuccess: this.findNetworkSuccess
25
- });
26
- }
27
-
28
- findNetworkSuccess = (res) => {
29
- if (res.foundNetworks) {
30
- this.setState({
31
- foundNetworks: res.foundNetworks
32
- });
33
- }
34
- }
35
- ```
@@ -1,37 +0,0 @@
1
- ---
2
- title: Using webOS Features
3
- ---
4
-
5
- ## Built-in webOS Events
6
-
7
- Included within the webOS system itself are the following custom document events:
8
-
9
- * `webOSLaunch`: Dispatched when the application launches and the launch parameters are received. The launch parameters are included within the event data. Note that this does not necessarily mean that the application has been loaded or rendered.
10
- * `webOSRelaunch`: Dispatched when an already-running application is launched, potentially with new launch parameters.
11
- * `webOSLocaleChange`: Dispatched when the system changes its language settings.
12
-
13
- To listen for these events, you can use the global dispatcher's `on()` method.
14
-
15
- ```js
16
- import {off, on} from '@enact/core/dispatcher';
17
- ...
18
- const handleLaunch = () => {
19
- console.log('APP LAUNCH');
20
- };
21
- on('webOSLaunch', handleLaunch, window);
22
- ...
23
- ```
24
-
25
- ## `@enact/webos`
26
-
27
- The `@enact/webos` library has a number of features designed exclusively for the webOS platform, including service integration
28
- with LS2Request and other useful platform APIs.
29
-
30
- * `@enact/webos/application` - provides information about the application metadata
31
- * `@enact/webos/deviceinfo` - returns various details about the webOS device where the application is running
32
- * `@enact/webos/keyboard` - use to see if the keyboard is currently visible
33
- * `@enact/webos/LS2Request` - without this, your application cannot use the myriad webOS services that are available!
34
- * [Luna Service API example](./luna-service-api.md#example)
35
- * `@enact/webos/platform` - returns various details about the webOS platform where the application is running (SmartTV, Open webOS, legacy devices (Palm, HP), etc.)
36
- * `@enact/webos/pmloglib` - system-level logging for your application
37
- * `@enact/webos/speech` - working with webOS speech APIs