@enact/webos 4.0.6
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 +631 -0
- package/LS2Request/LS2Request.d.ts +22 -0
- package/LS2Request/LS2Request.js +239 -0
- package/LS2Request/package.json +3 -0
- package/LS2Request/tests/LS2Request-specs.js +85 -0
- package/README.md +22 -0
- package/application/application.d.ts +32 -0
- package/application/application.js +150 -0
- package/application/package.json +3 -0
- package/deviceinfo/deviceinfo.d.ts +22 -0
- package/deviceinfo/deviceinfo.js +114 -0
- package/deviceinfo/package.json +3 -0
- package/index.d.ts +0 -0
- package/index.js +2 -0
- package/keyboard/keyboard.d.ts +9 -0
- package/keyboard/keyboard.js +27 -0
- package/keyboard/package.json +3 -0
- package/package.json +33 -0
- package/platform/package.json +3 -0
- package/platform/platform.d.ts +15 -0
- package/platform/platform.js +105 -0
- package/pmloglib/package.json +3 -0
- package/pmloglib/pmloglib.d.ts +74 -0
- package/pmloglib/pmloglib.js +241 -0
- package/speech/VoiceControlDecorator.js +153 -0
- package/speech/index.d.ts +19 -0
- package/speech/index.js +23 -0
- package/speech/package.json +3 -0
- package/speech/readAlert.js +96 -0
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.isShowing = void 0;
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* Provides a function to check visibility of virtual keyboard.
|
|
10
|
+
*
|
|
11
|
+
* @module webos/keyboard
|
|
12
|
+
* @exports isShowing
|
|
13
|
+
*/
|
|
14
|
+
|
|
15
|
+
/**
|
|
16
|
+
* Checks if the virtual keyboard is visible (only works on SmartTV platform).
|
|
17
|
+
*
|
|
18
|
+
* @function
|
|
19
|
+
* @returns {Boolean} `true` if the virtual keyboard is displaying
|
|
20
|
+
* @memberof webos/keyboard
|
|
21
|
+
* @public
|
|
22
|
+
*/
|
|
23
|
+
var isShowing = function isShowing() {
|
|
24
|
+
return window.PalmSystem && window.PalmSystem.isKeyboardVisible;
|
|
25
|
+
};
|
|
26
|
+
|
|
27
|
+
exports.isShowing = isShowing;
|
package/package.json
ADDED
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@enact/webos",
|
|
3
|
+
"version": "4.0.6",
|
|
4
|
+
"description": "webOS support library",
|
|
5
|
+
"main": "index.js",
|
|
6
|
+
"scripts": {
|
|
7
|
+
"clean": "enact clean",
|
|
8
|
+
"lint": "enact lint --strict",
|
|
9
|
+
"test": "enact test",
|
|
10
|
+
"test-json": "enact test --json",
|
|
11
|
+
"test-watch": "enact test --watch",
|
|
12
|
+
"transpile": "enact transpile"
|
|
13
|
+
},
|
|
14
|
+
"license": "Apache-2.0",
|
|
15
|
+
"keywords": [
|
|
16
|
+
"framework",
|
|
17
|
+
"toolkit",
|
|
18
|
+
"components",
|
|
19
|
+
"mobile",
|
|
20
|
+
"webOS"
|
|
21
|
+
],
|
|
22
|
+
"enact": {
|
|
23
|
+
"ri": {
|
|
24
|
+
"baseSize": 24
|
|
25
|
+
}
|
|
26
|
+
},
|
|
27
|
+
"dependencies": {
|
|
28
|
+
"@enact/core": "^4.0.6",
|
|
29
|
+
"prop-types": "^15.7.2",
|
|
30
|
+
"react": "^17.0.1",
|
|
31
|
+
"react-dom": "^17.0.1"
|
|
32
|
+
}
|
|
33
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
// Type definitions for webos/platform
|
|
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
|
+
/**
|
|
7
|
+
* Returns the object.
|
|
8
|
+
*/
|
|
9
|
+
export function detect(): object;
|
|
10
|
+
/**
|
|
11
|
+
* Provides identification of webOS variants.
|
|
12
|
+
*/
|
|
13
|
+
export declare const platform: object;
|
|
14
|
+
|
|
15
|
+
export default platform;
|
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.detect = detect;
|
|
7
|
+
exports.platform = exports["default"] = void 0;
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* Utilities for webOS platform detection.
|
|
11
|
+
*
|
|
12
|
+
* @module webos/platform
|
|
13
|
+
* @exports detect
|
|
14
|
+
* @exports platform
|
|
15
|
+
*/
|
|
16
|
+
function is(type) {
|
|
17
|
+
return window.navigator.userAgent.indexOf(type) > -1;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
var _platform;
|
|
21
|
+
/**
|
|
22
|
+
* Returns the {@link webos/platform.platform} object.
|
|
23
|
+
*
|
|
24
|
+
* @function
|
|
25
|
+
* @returns {Object} The {@link webos/platform.platform} object
|
|
26
|
+
* @memberof webos/platform
|
|
27
|
+
* @public
|
|
28
|
+
*/
|
|
29
|
+
|
|
30
|
+
|
|
31
|
+
function detect() {
|
|
32
|
+
if (_platform) {
|
|
33
|
+
// if we've already determined the platform, we'll use that determination
|
|
34
|
+
return _platform;
|
|
35
|
+
} else if (typeof window === 'undefined' || !window.PalmSystem) {
|
|
36
|
+
// if window isn't available (in prerendering or snapshot runs), bail out early
|
|
37
|
+
return {
|
|
38
|
+
unknown: true
|
|
39
|
+
};
|
|
40
|
+
} // build out our cached platform determination for future usage
|
|
41
|
+
|
|
42
|
+
|
|
43
|
+
_platform = {};
|
|
44
|
+
|
|
45
|
+
if (is('SmartWatch')) {
|
|
46
|
+
_platform.watch = true;
|
|
47
|
+
} else if (is('SmartTV') || is('Large Screen')) {
|
|
48
|
+
_platform.tv = true;
|
|
49
|
+
} else {
|
|
50
|
+
try {
|
|
51
|
+
var legacyInfo = JSON.parse(window.PalmSystem.deviceInfo || '{}');
|
|
52
|
+
|
|
53
|
+
if (legacyInfo.platformVersionMajor && legacyInfo.platformVersionMinor) {
|
|
54
|
+
var major = parseInt(legacyInfo.platformVersionMajor);
|
|
55
|
+
var minor = parseInt(legacyInfo.platformVersionMinor);
|
|
56
|
+
|
|
57
|
+
if (major < 3 || major === 3 && minor <= 0) {
|
|
58
|
+
_platform.legacy = true;
|
|
59
|
+
} else {
|
|
60
|
+
_platform.open = true;
|
|
61
|
+
}
|
|
62
|
+
} else {
|
|
63
|
+
_platform.unknown = true;
|
|
64
|
+
}
|
|
65
|
+
} catch (e) {
|
|
66
|
+
_platform.open = true;
|
|
67
|
+
} // TODO: clean these up. They shouldn't be here
|
|
68
|
+
|
|
69
|
+
|
|
70
|
+
window.Mojo = window.Mojo || {
|
|
71
|
+
relaunch: function relaunch() {}
|
|
72
|
+
};
|
|
73
|
+
if (window.PalmSystem.stageReady) window.PalmSystem.stageReady();
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
return _platform;
|
|
77
|
+
}
|
|
78
|
+
/**
|
|
79
|
+
* Provides identification of webOS variants.
|
|
80
|
+
*
|
|
81
|
+
* @readonly
|
|
82
|
+
* @type {Object}
|
|
83
|
+
* @property {Boolean} [tv] `true` for LG webOS SmartTV
|
|
84
|
+
* @property {Boolean} [watch] `true` for LG webOS SmartWatch
|
|
85
|
+
* @property {Boolean} [open] `true` for Open webOS
|
|
86
|
+
* @property {Boolean} [legacy] `true` for legacy webOS (Palm and HP hardware)
|
|
87
|
+
* @property {Boolean} [unknown] `true` for any unknown system
|
|
88
|
+
* @memberof webos/platform
|
|
89
|
+
* @public
|
|
90
|
+
*/
|
|
91
|
+
|
|
92
|
+
|
|
93
|
+
var platform = {};
|
|
94
|
+
exports.platform = platform;
|
|
95
|
+
['tv', 'watch', 'open', 'legacy', 'unknown'].forEach(function (name) {
|
|
96
|
+
Object.defineProperty(platform, name, {
|
|
97
|
+
enumerable: true,
|
|
98
|
+
get: function get() {
|
|
99
|
+
var p = detect();
|
|
100
|
+
return p[name];
|
|
101
|
+
}
|
|
102
|
+
});
|
|
103
|
+
});
|
|
104
|
+
var _default = platform;
|
|
105
|
+
exports["default"] = _default;
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
// Type definitions for webos/pmloglib
|
|
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
|
+
/**
|
|
7
|
+
* Logs with PmLogLib at the "emergency" level.
|
|
8
|
+
*/
|
|
9
|
+
export function emergency(
|
|
10
|
+
messageId: string,
|
|
11
|
+
keyVals: object,
|
|
12
|
+
freeText: string
|
|
13
|
+
): void;
|
|
14
|
+
/**
|
|
15
|
+
* Logs with PmLogLib at the "alert" level.
|
|
16
|
+
*/
|
|
17
|
+
export function alert(
|
|
18
|
+
messageId: string,
|
|
19
|
+
keyVals: object,
|
|
20
|
+
freeText: string
|
|
21
|
+
): void;
|
|
22
|
+
/**
|
|
23
|
+
* Logs with PmLogLib at the "critical" level.
|
|
24
|
+
*/
|
|
25
|
+
export function critical(
|
|
26
|
+
messageId: string,
|
|
27
|
+
keyVals: object,
|
|
28
|
+
freeText: string
|
|
29
|
+
): void;
|
|
30
|
+
/**
|
|
31
|
+
* Logs with PmLogLib at the "error" level.
|
|
32
|
+
*/
|
|
33
|
+
export function error(
|
|
34
|
+
messageId: string,
|
|
35
|
+
keyVals: object,
|
|
36
|
+
freeText: string
|
|
37
|
+
): void;
|
|
38
|
+
/**
|
|
39
|
+
* Logs with PmLogLib at the "warning" level.
|
|
40
|
+
*/
|
|
41
|
+
export function warning(
|
|
42
|
+
messageId: string,
|
|
43
|
+
keyVals: object,
|
|
44
|
+
freeText: string
|
|
45
|
+
): void;
|
|
46
|
+
/**
|
|
47
|
+
* Logs with PmLogLib at the "notice" level.
|
|
48
|
+
*/
|
|
49
|
+
export function notice(
|
|
50
|
+
messageId: string,
|
|
51
|
+
keyVals: object,
|
|
52
|
+
freeText: string
|
|
53
|
+
): void;
|
|
54
|
+
/**
|
|
55
|
+
* Logs with PmLogLib at the "info" level.
|
|
56
|
+
*/
|
|
57
|
+
export function info(
|
|
58
|
+
messageId: string,
|
|
59
|
+
keyVals: object,
|
|
60
|
+
freeText: string
|
|
61
|
+
): void;
|
|
62
|
+
/**
|
|
63
|
+
* Logs with PmLogLib at the "debug" level.
|
|
64
|
+
*/
|
|
65
|
+
export function debug(freeText: string): void;
|
|
66
|
+
/**
|
|
67
|
+
* Places a time-stamped performance log entry into the system log using the `PmLogInfoWithClock()`
|
|
68
|
+
method.
|
|
69
|
+
*/
|
|
70
|
+
export function perfLog(
|
|
71
|
+
messageId: string,
|
|
72
|
+
perfType: string,
|
|
73
|
+
perfGroup: string
|
|
74
|
+
): void;
|
|
@@ -0,0 +1,241 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.perfLog = exports.debug = exports.info = exports.notice = exports.warning = exports.error = exports.critical = exports.alert = exports.emergency = void 0;
|
|
7
|
+
|
|
8
|
+
/* eslint-disable no-console */
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* Provides a wrapper around PmLogLib logging API
|
|
12
|
+
*
|
|
13
|
+
* @module webos/pmloglib
|
|
14
|
+
* @exports emergency
|
|
15
|
+
* @exports alert
|
|
16
|
+
* @exports critical
|
|
17
|
+
* @exports error
|
|
18
|
+
* @exports warning
|
|
19
|
+
* @exports notice
|
|
20
|
+
* @exports info
|
|
21
|
+
* @exports debug
|
|
22
|
+
* @exports perfLog
|
|
23
|
+
*/
|
|
24
|
+
// Log level constants
|
|
25
|
+
var levelEmergency = 0;
|
|
26
|
+
var levelAlert = 1;
|
|
27
|
+
var levelCritical = 2;
|
|
28
|
+
var levelError = 3;
|
|
29
|
+
var levelWarning = 4;
|
|
30
|
+
var levelNotice = 5;
|
|
31
|
+
var levelInfo = 6;
|
|
32
|
+
var levelDebug = 7;
|
|
33
|
+
|
|
34
|
+
var isObject = function isObject(obj) {
|
|
35
|
+
return !!obj && typeof obj === 'object' && Object.prototype.toString.call(obj) !== '[object Array]';
|
|
36
|
+
}; // Log function stringifies and escapes keyVals, and passes to PmLogString
|
|
37
|
+
|
|
38
|
+
|
|
39
|
+
var log = function log(level, messageId, keyVals, freeText) {
|
|
40
|
+
if (typeof window !== 'undefined' && window.PalmSystem) {
|
|
41
|
+
if (keyVals && !isObject(keyVals)) {
|
|
42
|
+
level = levelError;
|
|
43
|
+
keyVals = {
|
|
44
|
+
msgid: messageId
|
|
45
|
+
};
|
|
46
|
+
messageId = 'MISMATCHED_FMT';
|
|
47
|
+
freeText = null;
|
|
48
|
+
console.warn('webOSLog called with invalid format: keyVals must be an object');
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
if (!messageId && level !== levelDebug) {
|
|
52
|
+
console.warn('webOSLog called with invalid format: messageId was empty');
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
if (keyVals) {
|
|
56
|
+
keyVals = JSON.stringify(keyVals);
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
if (window.PalmSystem.PmLogString) {
|
|
60
|
+
if (level === levelDebug) {
|
|
61
|
+
// debug only accepts 2 arguments
|
|
62
|
+
window.PalmSystem.PmLogString(level, null, null, freeText);
|
|
63
|
+
} else {
|
|
64
|
+
window.PalmSystem.PmLogString(level, messageId, keyVals, freeText);
|
|
65
|
+
}
|
|
66
|
+
} else {
|
|
67
|
+
console.error('Unable to send log: PmLogString not found in this version of PalmSystem');
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
};
|
|
71
|
+
/**
|
|
72
|
+
* Logs with PmLogLib at the "emergency" level.
|
|
73
|
+
*
|
|
74
|
+
* @function
|
|
75
|
+
* @param {String} messageId Short string that uniquely identifies the log message within a component
|
|
76
|
+
* @param {Object} keyVals Key-value pairs to log
|
|
77
|
+
* @param {String} freeText Text string to log
|
|
78
|
+
* @returns {undefined}
|
|
79
|
+
* @memberof webos/pmloglib
|
|
80
|
+
* @public
|
|
81
|
+
*/
|
|
82
|
+
|
|
83
|
+
|
|
84
|
+
var emergency = function emergency(messageId, keyVals, freeText) {
|
|
85
|
+
log(levelEmergency, messageId, keyVals, freeText);
|
|
86
|
+
};
|
|
87
|
+
/**
|
|
88
|
+
* Logs with PmLogLib at the "alert" level.
|
|
89
|
+
*
|
|
90
|
+
* @function
|
|
91
|
+
* @param {String} messageId Short string that uniquely identifies the log message within a component
|
|
92
|
+
* @param {Object} keyVals Key-value pairs to log
|
|
93
|
+
* @param {String} freeText Text string to log
|
|
94
|
+
* @returns {undefined}
|
|
95
|
+
* @memberof webos/pmloglib
|
|
96
|
+
* @public
|
|
97
|
+
*/
|
|
98
|
+
|
|
99
|
+
|
|
100
|
+
exports.emergency = emergency;
|
|
101
|
+
|
|
102
|
+
var alert = function alert(messageId, keyVals, freeText) {
|
|
103
|
+
log(levelAlert, messageId, keyVals, freeText);
|
|
104
|
+
};
|
|
105
|
+
/**
|
|
106
|
+
* Logs with PmLogLib at the "critical" level.
|
|
107
|
+
*
|
|
108
|
+
* @function
|
|
109
|
+
* @param {String} messageId Short string that uniquely identifies the log message within a component
|
|
110
|
+
* @param {Object} keyVals Key-value pairs to log
|
|
111
|
+
* @param {String} freeText Text string to log
|
|
112
|
+
* @returns {undefined}
|
|
113
|
+
* @memberof webos/pmloglib
|
|
114
|
+
* @public
|
|
115
|
+
*/
|
|
116
|
+
|
|
117
|
+
|
|
118
|
+
exports.alert = alert;
|
|
119
|
+
|
|
120
|
+
var critical = function critical(messageId, keyVals, freeText) {
|
|
121
|
+
log(levelCritical, messageId, keyVals, freeText);
|
|
122
|
+
};
|
|
123
|
+
/**
|
|
124
|
+
* Logs with PmLogLib at the "error" level.
|
|
125
|
+
*
|
|
126
|
+
* @function
|
|
127
|
+
* @param {String} messageId Short string that uniquely identifies the log message within a component
|
|
128
|
+
* @param {Object} keyVals Key-value pairs to log
|
|
129
|
+
* @param {String} freeText Text string to log
|
|
130
|
+
* @returns {undefined}
|
|
131
|
+
* @memberof webos/pmloglib
|
|
132
|
+
* @public
|
|
133
|
+
*/
|
|
134
|
+
|
|
135
|
+
|
|
136
|
+
exports.critical = critical;
|
|
137
|
+
|
|
138
|
+
var error = function error(messageId, keyVals, freeText) {
|
|
139
|
+
log(levelError, messageId, keyVals, freeText);
|
|
140
|
+
};
|
|
141
|
+
/**
|
|
142
|
+
* Logs with PmLogLib at the "warning" level.
|
|
143
|
+
*
|
|
144
|
+
* @function
|
|
145
|
+
* @param {String} messageId Short string that uniquely identifies the log message within a component
|
|
146
|
+
* @param {Object} keyVals Key-value pairs to log
|
|
147
|
+
* @param {String} freeText Text string to log
|
|
148
|
+
* @returns {undefined}
|
|
149
|
+
* @memberof webos/pmloglib
|
|
150
|
+
* @public
|
|
151
|
+
*/
|
|
152
|
+
|
|
153
|
+
|
|
154
|
+
exports.error = error;
|
|
155
|
+
|
|
156
|
+
var warning = function warning(messageId, keyVals, freeText) {
|
|
157
|
+
log(levelWarning, messageId, keyVals, freeText);
|
|
158
|
+
};
|
|
159
|
+
/**
|
|
160
|
+
* Logs with PmLogLib at the "notice" level.
|
|
161
|
+
*
|
|
162
|
+
* @function
|
|
163
|
+
* @param {String} messageId Short string that uniquely identifies the log message within a component
|
|
164
|
+
* @param {Object} keyVals Key-value pairs to log
|
|
165
|
+
* @param {String} freeText Text string to log
|
|
166
|
+
* @returns {undefined}
|
|
167
|
+
* @memberof webos/pmloglib
|
|
168
|
+
* @public
|
|
169
|
+
*/
|
|
170
|
+
|
|
171
|
+
|
|
172
|
+
exports.warning = warning;
|
|
173
|
+
|
|
174
|
+
var notice = function notice(messageId, keyVals, freeText) {
|
|
175
|
+
log(levelNotice, messageId, keyVals, freeText);
|
|
176
|
+
};
|
|
177
|
+
/**
|
|
178
|
+
* Logs with PmLogLib at the "info" level.
|
|
179
|
+
*
|
|
180
|
+
* @function
|
|
181
|
+
* @param {String} messageId Short string that uniquely identifies the log message within a component
|
|
182
|
+
* @param {Object} keyVals Key-value pairs to log
|
|
183
|
+
* @param {String} freeText Text string to log
|
|
184
|
+
* @returns {undefined}
|
|
185
|
+
* @memberof webos/pmloglib
|
|
186
|
+
* @public
|
|
187
|
+
*/
|
|
188
|
+
|
|
189
|
+
|
|
190
|
+
exports.notice = notice;
|
|
191
|
+
|
|
192
|
+
var info = function info(messageId, keyVals, freeText) {
|
|
193
|
+
log(levelInfo, messageId, keyVals, freeText);
|
|
194
|
+
};
|
|
195
|
+
/**
|
|
196
|
+
* Logs with PmLogLib at the "debug" level.
|
|
197
|
+
*
|
|
198
|
+
* @function
|
|
199
|
+
* @param {String} freeText Text string to log
|
|
200
|
+
* @returns {undefined}
|
|
201
|
+
* @memberof webos/pmloglib
|
|
202
|
+
* @public
|
|
203
|
+
*/
|
|
204
|
+
|
|
205
|
+
|
|
206
|
+
exports.info = info;
|
|
207
|
+
|
|
208
|
+
var debug = function debug(freeText) {
|
|
209
|
+
log(levelDebug, '', '', freeText);
|
|
210
|
+
};
|
|
211
|
+
/**
|
|
212
|
+
* Places a time-stamped performance log entry into the system log using the `PmLogInfoWithClock()`
|
|
213
|
+
* method.
|
|
214
|
+
*
|
|
215
|
+
* @function
|
|
216
|
+
* @param {String} messageId Short string that uniquely identifies the log message within a component.
|
|
217
|
+
* @param {String} perfType A string that identifies the type of perf message
|
|
218
|
+
* @param {String} perfGroup A string that identifies the group of the perf message
|
|
219
|
+
* @returns {undefined}
|
|
220
|
+
* @memberof webos/pmloglib
|
|
221
|
+
* @public
|
|
222
|
+
*/
|
|
223
|
+
|
|
224
|
+
|
|
225
|
+
exports.debug = debug;
|
|
226
|
+
|
|
227
|
+
var perfLog = function perfLog(messageId, perfType, perfGroup) {
|
|
228
|
+
if (typeof window !== 'undefined' && window.PalmSystem) {
|
|
229
|
+
if (!messageId) {
|
|
230
|
+
console.warn('PmLogInfoWithClock called with invalid format: messageId was empty');
|
|
231
|
+
}
|
|
232
|
+
|
|
233
|
+
if (window.PalmSystem.PmLogInfoWithClock) {
|
|
234
|
+
window.PalmSystem.PmLogInfoWithClock(messageId, perfType ? perfType : '', perfGroup ? perfGroup : '');
|
|
235
|
+
} else {
|
|
236
|
+
console.error('Unable to send log: PmLogInfoWithClock not found in this version of PalmSystem');
|
|
237
|
+
}
|
|
238
|
+
}
|
|
239
|
+
};
|
|
240
|
+
|
|
241
|
+
exports.perfLog = perfLog;
|
|
@@ -0,0 +1,153 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.VoiceControlDecorator = exports["default"] = void 0;
|
|
7
|
+
|
|
8
|
+
var _react = 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
|
+
var _jsxRuntime = require("react/jsx-runtime");
|
|
17
|
+
|
|
18
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
|
19
|
+
|
|
20
|
+
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; }
|
|
21
|
+
|
|
22
|
+
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; }
|
|
23
|
+
|
|
24
|
+
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
25
|
+
|
|
26
|
+
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
|
27
|
+
|
|
28
|
+
function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
|
|
29
|
+
|
|
30
|
+
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
|
|
31
|
+
|
|
32
|
+
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); }
|
|
33
|
+
|
|
34
|
+
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
|
|
35
|
+
|
|
36
|
+
function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
|
|
37
|
+
|
|
38
|
+
function _possibleConstructorReturn(self, call) { if (call && (typeof call === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); }
|
|
39
|
+
|
|
40
|
+
function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
|
|
41
|
+
|
|
42
|
+
function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
|
|
43
|
+
|
|
44
|
+
function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
|
|
45
|
+
|
|
46
|
+
/**
|
|
47
|
+
* VoiceControlDecorator is a higher-order component that adds a callback for voice event
|
|
48
|
+
* to its wrapped component.
|
|
49
|
+
*
|
|
50
|
+
* By default, `onVoice` handler will be added to the node where `data-webos-voice-intent` attribute is declared.
|
|
51
|
+
* In addition, if you need to specify a target node, `data-webos-voice-event-target` attribute can be used.
|
|
52
|
+
*
|
|
53
|
+
* Usage:
|
|
54
|
+
* ```
|
|
55
|
+
* import {Component} from 'react';
|
|
56
|
+
* import Item from '@enact/moonstone/Item';
|
|
57
|
+
* import {VoiceControlDecorator} from '@enact/webos/speech';
|
|
58
|
+
*
|
|
59
|
+
* const VoiceDiv = VoiceControlDecorator('div');
|
|
60
|
+
* const VoiceItem = VoiceControlDecorator(Item);
|
|
61
|
+
*
|
|
62
|
+
* class Sample extends Component {
|
|
63
|
+
* handlePlayListControl = (e) => {
|
|
64
|
+
* const {intent, control} = e.detail;
|
|
65
|
+
* // Change the app status refer to the `control` value.
|
|
66
|
+
* }
|
|
67
|
+
*
|
|
68
|
+
* handlePlayContent = (e) => {
|
|
69
|
+
* const {intent, value} = e.detail;
|
|
70
|
+
* // Play content
|
|
71
|
+
* }
|
|
72
|
+
*
|
|
73
|
+
* render () {
|
|
74
|
+
* return(
|
|
75
|
+
* <div>
|
|
76
|
+
* <VoiceDiv
|
|
77
|
+
* data-webos-voice-intent='PlayListControl'
|
|
78
|
+
* onVoice={this.handlePlayListControl}
|
|
79
|
+
* />
|
|
80
|
+
* <VoiceItem
|
|
81
|
+
* data-webos-voice-intent='Select PlayContent'
|
|
82
|
+
* onVoice={this.handlePlayContent}
|
|
83
|
+
* >
|
|
84
|
+
* The Dark Knight
|
|
85
|
+
* </VoiceItem>
|
|
86
|
+
* </div>
|
|
87
|
+
* );
|
|
88
|
+
* }
|
|
89
|
+
* }
|
|
90
|
+
* ```
|
|
91
|
+
*
|
|
92
|
+
* @class VoiceControlDecorator
|
|
93
|
+
* @memberof webos/speech
|
|
94
|
+
* @hoc
|
|
95
|
+
* @public
|
|
96
|
+
*/
|
|
97
|
+
var VoiceControlDecorator = (0, _hoc["default"])(function (config, Wrapped) {
|
|
98
|
+
var _class, _temp;
|
|
99
|
+
|
|
100
|
+
return _temp = _class = /*#__PURE__*/function (_Component) {
|
|
101
|
+
_inherits(_class, _Component);
|
|
102
|
+
|
|
103
|
+
var _super = _createSuper(_class);
|
|
104
|
+
|
|
105
|
+
function _class() {
|
|
106
|
+
_classCallCheck(this, _class);
|
|
107
|
+
|
|
108
|
+
return _super.apply(this, arguments);
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
_createClass(_class, [{
|
|
112
|
+
key: "componentDidMount",
|
|
113
|
+
value: function componentDidMount() {
|
|
114
|
+
this.node = (0, _reactDom.findDOMNode)(this); // eslint-disable-line
|
|
115
|
+
|
|
116
|
+
if (this.node && !(this.node.hasAttribute('data-webos-voice-event-target') || this.node.hasAttribute('data-webos-voice-intent'))) {
|
|
117
|
+
this.node = this.node.querySelector('[data-webos-voice-event-target]') || this.node.querySelector('[data-webos-voice-intent]');
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
if (this.node) this.node.addEventListener('webOSVoice', this.props.onVoice);
|
|
121
|
+
}
|
|
122
|
+
}, {
|
|
123
|
+
key: "componentWillUnmount",
|
|
124
|
+
value: function componentWillUnmount() {
|
|
125
|
+
if (this.node) this.node.removeEventListener('webOSVoice', this.props.onVoice);
|
|
126
|
+
}
|
|
127
|
+
}, {
|
|
128
|
+
key: "render",
|
|
129
|
+
value: function render() {
|
|
130
|
+
var props = _objectSpread({}, this.props);
|
|
131
|
+
|
|
132
|
+
delete props.onVoice;
|
|
133
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)(Wrapped, _objectSpread({}, props));
|
|
134
|
+
}
|
|
135
|
+
}]);
|
|
136
|
+
|
|
137
|
+
return _class;
|
|
138
|
+
}(_react.Component), _class.displayName = 'VoiceControlDecorator', _class.propTypes =
|
|
139
|
+
/** @lends webos/speech.VoiceControlDecorator.prototype */
|
|
140
|
+
{
|
|
141
|
+
/**
|
|
142
|
+
* Callback to be executed when a wrapped element's `data-webos-voice-intent` is activated.
|
|
143
|
+
*
|
|
144
|
+
* @type {Function}
|
|
145
|
+
* @required
|
|
146
|
+
* @public
|
|
147
|
+
*/
|
|
148
|
+
onVoice: _propTypes["default"].func.isRequired
|
|
149
|
+
}, _temp;
|
|
150
|
+
});
|
|
151
|
+
exports.VoiceControlDecorator = VoiceControlDecorator;
|
|
152
|
+
var _default = VoiceControlDecorator;
|
|
153
|
+
exports["default"] = _default;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
// Type definitions for webos/speech
|
|
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 VoiceControlDecoratorProps {
|
|
7
|
+
/**
|
|
8
|
+
* Callback to be executed when a wrapped element's `data-webos-voice-intent` is activated.
|
|
9
|
+
*/
|
|
10
|
+
onVoice: Function;
|
|
11
|
+
}
|
|
12
|
+
export function VoiceControlDecorator<P>(
|
|
13
|
+
Component: React.ComponentType<P> | string
|
|
14
|
+
): React.ComponentType<P & VoiceControlDecoratorProps>;
|
|
15
|
+
|
|
16
|
+
/**
|
|
17
|
+
* Read alert text when accessibility audio guidance is enabled.
|
|
18
|
+
*/
|
|
19
|
+
export function readAlert(string: string, clear: boolean): void;
|