@enact/core 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 (113) hide show
  1. package/CHANGELOG.md +16 -0
  2. package/{build/dispatcher → dispatcher}/dispatcher.d.ts +0 -0
  3. package/dispatcher/dispatcher.js +76 -57
  4. package/dispatcher/listeners.js +31 -19
  5. package/dispatcher/tests/dispatcher-specs.js +75 -100
  6. package/{build/handle → handle}/handle.d.ts +0 -0
  7. package/handle/handle.js +260 -212
  8. package/handle/tests/handle-specs.js +476 -601
  9. package/{build/hoc → hoc}/hoc.d.ts +0 -0
  10. package/hoc/hoc.js +47 -33
  11. package/hoc/tests/hoc-specs.js +85 -126
  12. package/{build/index.d.ts → index.d.ts} +0 -0
  13. package/index.js +1 -0
  14. package/{build/internal → internal}/ApiDecorator/ApiDecorator.d.ts +0 -0
  15. package/internal/ApiDecorator/ApiDecorator.js +107 -61
  16. package/internal/ApiDecorator/tests/ApiDecorator-specs.js +106 -97
  17. package/{build/internal → internal}/Registry/Registry.d.ts +0 -0
  18. package/internal/Registry/Registry.js +68 -51
  19. package/internal/Registry/tests/Registry-specs.js +201 -143
  20. package/{build/internal → internal}/deprecate/deprecate.d.ts +0 -0
  21. package/internal/deprecate/deprecate.js +85 -60
  22. package/{build/internal → internal}/prop-types/prop-types.d.ts +0 -0
  23. package/internal/prop-types/prop-types.js +68 -61
  24. package/{build/keymap → keymap}/index.d.ts +0 -0
  25. package/keymap/index.js +27 -15
  26. package/keymap/keymap.js +67 -52
  27. package/keymap/tests/keymap-specs.js +75 -104
  28. package/kind/computed.js +29 -16
  29. package/{build/kind → kind}/kind.d.ts +0 -0
  30. package/kind/kind.js +150 -114
  31. package/kind/styles.js +62 -47
  32. package/kind/tests/computed-specs.js +87 -86
  33. package/kind/tests/kind-specs.js +216 -214
  34. package/kind/tests/styles-specs.js +170 -223
  35. package/kind/util.js +15 -7
  36. package/package.json +1 -1
  37. package/{build/platform → platform}/platform.d.ts +0 -0
  38. package/platform/platform.js +263 -169
  39. package/platform/tests/platform-specs.js +92 -90
  40. package/{build/snapshot → snapshot}/snapshot.d.ts +0 -0
  41. package/snapshot/snapshot.js +34 -27
  42. package/useChainRefs/tests/useChainRefs-specs.js +46 -30
  43. package/{build/useChainRefs → useChainRefs}/useChainRefs.d.ts +0 -0
  44. package/useChainRefs/useChainRefs.js +49 -29
  45. package/useClass/tests/useClass-specs.js +51 -46
  46. package/{build/useClass → useClass}/useClass.d.ts +0 -0
  47. package/useClass/useClass.js +27 -9
  48. package/useHandlers/Handlers.js +55 -30
  49. package/useHandlers/tests/useHandlers-specs.js +79 -95
  50. package/{build/useHandlers → useHandlers}/useHandlers.d.ts +0 -0
  51. package/useHandlers/useHandlers.js +18 -11
  52. package/util/Job.js +203 -241
  53. package/util/tests/Job-specs.js +216 -204
  54. package/util/tests/util-specs.js +123 -146
  55. package/{build/util → util}/util.d.ts +0 -0
  56. package/util/util.js +146 -103
  57. package/build/CHANGELOG.md +0 -699
  58. package/build/README.md +0 -33
  59. package/build/dispatcher/dispatcher.js +0 -160
  60. package/build/dispatcher/listeners.js +0 -37
  61. package/build/dispatcher/package.json +0 -3
  62. package/build/dispatcher/tests/dispatcher-specs.js +0 -75
  63. package/build/handle/handle.js +0 -846
  64. package/build/handle/package.json +0 -3
  65. package/build/handle/tests/handle-specs.js +0 -476
  66. package/build/hoc/hoc.js +0 -102
  67. package/build/hoc/package.json +0 -3
  68. package/build/hoc/tests/hoc-specs.js +0 -90
  69. package/build/index.js +0 -2
  70. package/build/internal/ApiDecorator/ApiDecorator.js +0 -143
  71. package/build/internal/ApiDecorator/package.json +0 -3
  72. package/build/internal/ApiDecorator/tests/ApiDecorator-specs.js +0 -106
  73. package/build/internal/Registry/Registry.js +0 -76
  74. package/build/internal/Registry/package.json +0 -3
  75. package/build/internal/Registry/tests/Registry-specs.js +0 -201
  76. package/build/internal/deprecate/deprecate.js +0 -116
  77. package/build/internal/deprecate/package.json +0 -3
  78. package/build/internal/prop-types/package.json +0 -3
  79. package/build/internal/prop-types/prop-types.js +0 -90
  80. package/build/keymap/index.js +0 -54
  81. package/build/keymap/keymap.js +0 -201
  82. package/build/keymap/package.json +0 -3
  83. package/build/keymap/tests/keymap-specs.js +0 -75
  84. package/build/kind/computed.js +0 -60
  85. package/build/kind/kind.js +0 -266
  86. package/build/kind/package.json +0 -3
  87. package/build/kind/styles.js +0 -105
  88. package/build/kind/tests/computed-specs.js +0 -87
  89. package/build/kind/tests/kind-specs.js +0 -216
  90. package/build/kind/tests/styles-specs.js +0 -170
  91. package/build/kind/util.js +0 -17
  92. package/build/package-lock.json +0 -206
  93. package/build/package.json +0 -38
  94. package/build/platform/package.json +0 -3
  95. package/build/platform/platform.js +0 -306
  96. package/build/platform/tests/platform-specs.js +0 -92
  97. package/build/snapshot/package.json +0 -3
  98. package/build/snapshot/snapshot.js +0 -89
  99. package/build/useChainRefs/package.json +0 -3
  100. package/build/useChainRefs/tests/useChainRefs-specs.js +0 -57
  101. package/build/useChainRefs/useChainRefs.js +0 -78
  102. package/build/useClass/package.json +0 -3
  103. package/build/useClass/tests/useClass-specs.js +0 -51
  104. package/build/useClass/useClass.js +0 -59
  105. package/build/useHandlers/Handlers.js +0 -55
  106. package/build/useHandlers/package.json +0 -3
  107. package/build/useHandlers/tests/useHandlers-specs.js +0 -84
  108. package/build/useHandlers/useHandlers.js +0 -36
  109. package/build/util/Job.js +0 -211
  110. package/build/util/package.json +0 -3
  111. package/build/util/tests/Job-specs.js +0 -216
  112. package/build/util/tests/util-specs.js +0 -123
  113. package/build/util/util.js +0 -322
@@ -1,142 +1,242 @@
1
- /**
2
- * Utilities for detecting basic platform capabilities.
3
- *
4
- * @module core/platform
5
- * @exports detect
6
- * @exports platform
7
- * @public
8
- */
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.platform = exports.parseUserAgent = exports.detect = exports["default"] = void 0;
9
7
 
10
- import uniq from 'ramda/src/uniq';
8
+ var _uniq = _interopRequireDefault(require("ramda/src/uniq"));
11
9
 
12
- const hasGesture = () => {
13
- return Boolean(
14
- ('ongesturestart' in window) ||
15
- ('onmsgesturestart' in window && (
16
- window.navigator.msMaxTouchPoints > 1 ||
17
- window.navigator.maxTouchPoints > 1
18
- ))
19
- );
20
- };
10
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
11
+
12
+ function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
13
+
14
+ 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."); }
15
+
16
+ function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
21
17
 
22
- const hasTouch = () => {
23
- return Boolean(
24
- ('TouchEvent' in window) ||
25
- ('ontouchstart' in window) ||
26
- window.navigator.msMaxTouchPoints ||
27
- (window.navigator.msManipulationViewsEnabled && window.navigator.maxTouchPoints)
28
- );
18
+ function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && Symbol.iterator in Object(iter)) return Array.from(iter); }
19
+
20
+ function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
21
+
22
+ function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
23
+
24
+ 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; }
25
+
26
+ 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; }
27
+
28
+ 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; }
29
+
30
+ var hasGesture = function hasGesture() {
31
+ return Boolean('ongesturestart' in window || 'onmsgesturestart' in window && (window.navigator.msMaxTouchPoints > 1 || window.navigator.maxTouchPoints > 1));
29
32
  };
30
33
 
31
- // Adapted from https://patrickhlauke.github.io/touch/touchscreen-detection/
34
+ var hasTouch = function hasTouch() {
35
+ return Boolean('TouchEvent' in window || 'ontouchstart' in window || window.navigator.msMaxTouchPoints || window.navigator.msManipulationViewsEnabled && window.navigator.maxTouchPoints);
36
+ }; // Adapted from https://patrickhlauke.github.io/touch/touchscreen-detection/
32
37
  // I've omitted the touch event fallback since that is covered by hasTouch and we're less concerned
33
38
  // with legacy browsers used in touchscreen environments.
34
- const hasTouchScreen = () => {
35
- return (
36
- // if Pointer Events are supported, just check maxTouchPoints
37
- (window.PointerEvent && ('maxTouchPoints' in window.navigator) && window.navigator.maxTouchPoints > 0) ||
38
- // check for any-pointer:coarse which mostly means touchscreen
39
- (window.matchMedia && window.matchMedia('(any-pointer:coarse)').matches)
40
- );
41
- };
42
39
 
43
- const platforms = [
44
- // Windows Phone 7 - 10
45
- {platform: 'windowsPhone', regex: /Windows Phone (?:OS )?(\d+)[.\d]+/},
46
- // Android 4+ using Chrome
47
- {platform: 'androidChrome', regex: /Android .* Chrome\/(\d+)[.\d]+/},
48
- // Android 2 - 4
49
- {platform: 'android', regex: /Android(?:\s|\/)(\d+)/},
50
- // Kindle Fire
51
- // Force version to 2, (desktop mode does not list android version)
52
- {platform: 'android', regex: /Silk\/1./, forceVersion: 2, extra: {silk: 1}},
53
- // Kindle Fire HD (Silk versions 2 or 3)
54
- // Force version to 4
55
- {platform: 'android', regex: /Silk\/2./, forceVersion: 4, extra: {silk: 2}},
56
- {platform: 'android', regex: /Silk\/3./, forceVersion: 4, extra: {silk: 3}},
57
- // IE 8 - 10
58
- {platform: 'ie', regex: /MSIE (\d+)/},
59
- // IE 11
60
- {platform: 'ie', regex: /Trident\/.*; rv:(\d+)/},
61
- // Edge
62
- {platform: 'edge', regex: /Edge\/(\d+)/},
63
- // iOS 3 - 5
64
- // Apple likes to make this complicated
65
- {platform: 'ios', regex: /iP(?:hone|ad;(?: U;)? CPU) OS (\d+)/},
66
- // LG webOS
67
- {platform: 'webos', regex: /Web0S;.*Safari\/537.41/, forceVersion: 1},
68
- {platform: 'webos', regex: /Web0S;.*Safari\/538.2/, forceVersion: 2},
69
- {platform: 'webos', regex: /Web0S;.*Chrome\/38/, forceVersion: 3},
70
- {platform: 'webos', regex: /Web0S;.*Chrome\/53/, forceVersion: 4},
71
- {platform: 'webos', regex: /Web0S;.*Chrome\/68/, forceVersion: 5},
72
- // LG webOS of indeterminate version
73
- {platform: 'webos', regex: /Web0S;/, forceVersion: -1},
74
- // LuneOS
75
- {platform: 'webos', regex: /LuneOS/, forceVersion: -1, extra: {luneos: 1}},
76
- // Palm/HP/Open webOS
77
- {platform: 'webos', regex: /WebAppManager|Isis|webOS\./, forceVersion: -1, extra: {legacy: 4}},
78
- {platform: 'webos', regex: /(?:web|hpw)OS\/1/, forceVersion: -1, extra: {legacy: 1}},
79
- {platform: 'webos', regex: /(?:web|hpw)OS\/2/, forceVersion: -1, extra: {legacy: 2}},
80
- {platform: 'webos', regex: /(?:web|hpw)OS\/3/, forceVersion: -1, extra: {legacy: 3}},
81
- // desktop Safari
82
- {platform: 'safari', regex: /Version\/(\d+)[.\d]+\s+Safari/},
83
- // desktop Chrome
84
- {platform: 'chrome', regex: /Chrome\/(\d+)[.\d]+/},
85
- // Firefox on Android
86
- {platform: 'androidFirefox', regex: /Android;.*Firefox\/(\d+)/},
87
- // FirefoxOS
88
- {platform: 'firefoxOS', regex: /Mobile;.*Firefox\/(\d+)/},
89
- // desktop Firefox
90
- {platform: 'firefox', regex: /Firefox\/(\d+)/},
91
- // Blackberry Playbook
92
- {platform: 'blackberry', regex: /PlayBook/i, forceVersion: 2},
93
- // Blackberry 10+
94
- {platform: 'blackberry', regex: /BB1\d;.*Version\/(\d+\.\d+)/},
95
- // Tizen
96
- {platform: 'tizen', regex: /Tizen (\d+)/}
97
- ];
98
-
99
- const ua = () => {
100
- return window.navigator ? window.navigator.userAgent : '';
40
+
41
+ var hasTouchScreen = function hasTouchScreen() {
42
+ return (// if Pointer Events are supported, just check maxTouchPoints
43
+ window.PointerEvent && 'maxTouchPoints' in window.navigator && window.navigator.maxTouchPoints > 0 || // check for any-pointer:coarse which mostly means touchscreen
44
+ window.matchMedia && window.matchMedia('(any-pointer:coarse)').matches
45
+ );
101
46
  };
102
47
 
103
- let _platform;
104
-
105
- const parseUserAgent = (userAgent) => {
106
- let plat = {
107
- gesture: hasGesture(),
108
- node: false,
109
- touch: hasTouch(),
110
- touchscreen: hasTouchScreen(),
111
- unknown: true
112
- };
113
-
114
- for (let i = 0, p, m, v; (p = platforms[i]); i++) {
115
- m = p.regex.exec(userAgent);
116
-
117
- if (m) {
118
- plat.unknown = false;
119
-
120
- if ('forceVersion' in p) {
121
- v = p.forceVersion;
122
- } else {
123
- v = Number(m[1]);
124
- }
125
- plat[p.platform] = v;
126
- if (p.extra) {
127
- plat = {
128
- ...plat,
129
- ...p.extra
130
- };
131
- }
132
- plat.platformName = p.platform;
133
- break;
134
- }
135
- }
136
-
137
- return plat;
48
+ var platforms = [// Windows Phone 7 - 10
49
+ {
50
+ platform: 'windowsPhone',
51
+ regex: /Windows Phone (?:OS )?(\d+)[.\d]+/
52
+ }, // Android 4+ using Chrome
53
+ {
54
+ platform: 'androidChrome',
55
+ regex: /Android .* Chrome\/(\d+)[.\d]+/
56
+ }, // Android 2 - 4
57
+ {
58
+ platform: 'android',
59
+ regex: /Android(?:\s|\/)(\d+)/
60
+ }, // Kindle Fire
61
+ // Force version to 2, (desktop mode does not list android version)
62
+ {
63
+ platform: 'android',
64
+ regex: /Silk\/1./,
65
+ forceVersion: 2,
66
+ extra: {
67
+ silk: 1
68
+ }
69
+ }, // Kindle Fire HD (Silk versions 2 or 3)
70
+ // Force version to 4
71
+ {
72
+ platform: 'android',
73
+ regex: /Silk\/2./,
74
+ forceVersion: 4,
75
+ extra: {
76
+ silk: 2
77
+ }
78
+ }, {
79
+ platform: 'android',
80
+ regex: /Silk\/3./,
81
+ forceVersion: 4,
82
+ extra: {
83
+ silk: 3
84
+ }
85
+ }, // IE 8 - 10
86
+ {
87
+ platform: 'ie',
88
+ regex: /MSIE (\d+)/
89
+ }, // IE 11
90
+ {
91
+ platform: 'ie',
92
+ regex: /Trident\/.*; rv:(\d+)/
93
+ }, // Edge
94
+ {
95
+ platform: 'edge',
96
+ regex: /Edge\/(\d+)/
97
+ }, // iOS 3 - 5
98
+ // Apple likes to make this complicated
99
+ {
100
+ platform: 'ios',
101
+ regex: /iP(?:hone|ad;(?: U;)? CPU) OS (\d+)/
102
+ }, // LG webOS
103
+ {
104
+ platform: 'webos',
105
+ regex: /Web0S;.*Safari\/537.41/,
106
+ forceVersion: 1
107
+ }, {
108
+ platform: 'webos',
109
+ regex: /Web0S;.*Safari\/538.2/,
110
+ forceVersion: 2
111
+ }, {
112
+ platform: 'webos',
113
+ regex: /Web0S;.*Chrome\/38/,
114
+ forceVersion: 3
115
+ }, {
116
+ platform: 'webos',
117
+ regex: /Web0S;.*Chrome\/53/,
118
+ forceVersion: 4
119
+ }, {
120
+ platform: 'webos',
121
+ regex: /Web0S;.*Chrome\/68/,
122
+ forceVersion: 5
123
+ }, // LG webOS of indeterminate version
124
+ {
125
+ platform: 'webos',
126
+ regex: /Web0S;/,
127
+ forceVersion: -1
128
+ }, // LuneOS
129
+ {
130
+ platform: 'webos',
131
+ regex: /LuneOS/,
132
+ forceVersion: -1,
133
+ extra: {
134
+ luneos: 1
135
+ }
136
+ }, // Palm/HP/Open webOS
137
+ {
138
+ platform: 'webos',
139
+ regex: /WebAppManager|Isis|webOS\./,
140
+ forceVersion: -1,
141
+ extra: {
142
+ legacy: 4
143
+ }
144
+ }, {
145
+ platform: 'webos',
146
+ regex: /(?:web|hpw)OS\/1/,
147
+ forceVersion: -1,
148
+ extra: {
149
+ legacy: 1
150
+ }
151
+ }, {
152
+ platform: 'webos',
153
+ regex: /(?:web|hpw)OS\/2/,
154
+ forceVersion: -1,
155
+ extra: {
156
+ legacy: 2
157
+ }
158
+ }, {
159
+ platform: 'webos',
160
+ regex: /(?:web|hpw)OS\/3/,
161
+ forceVersion: -1,
162
+ extra: {
163
+ legacy: 3
164
+ }
165
+ }, // desktop Safari
166
+ {
167
+ platform: 'safari',
168
+ regex: /Version\/(\d+)[.\d]+\s+Safari/
169
+ }, // desktop Chrome
170
+ {
171
+ platform: 'chrome',
172
+ regex: /Chrome\/(\d+)[.\d]+/
173
+ }, // Firefox on Android
174
+ {
175
+ platform: 'androidFirefox',
176
+ regex: /Android;.*Firefox\/(\d+)/
177
+ }, // FirefoxOS
178
+ {
179
+ platform: 'firefoxOS',
180
+ regex: /Mobile;.*Firefox\/(\d+)/
181
+ }, // desktop Firefox
182
+ {
183
+ platform: 'firefox',
184
+ regex: /Firefox\/(\d+)/
185
+ }, // Blackberry Playbook
186
+ {
187
+ platform: 'blackberry',
188
+ regex: /PlayBook/i,
189
+ forceVersion: 2
190
+ }, // Blackberry 10+
191
+ {
192
+ platform: 'blackberry',
193
+ regex: /BB1\d;.*Version\/(\d+\.\d+)/
194
+ }, // Tizen
195
+ {
196
+ platform: 'tizen',
197
+ regex: /Tizen (\d+)/
198
+ }];
199
+
200
+ var ua = function ua() {
201
+ return window.navigator ? window.navigator.userAgent : '';
138
202
  };
139
203
 
204
+ var _platform;
205
+
206
+ var parseUserAgent = function parseUserAgent(userAgent) {
207
+ var plat = {
208
+ gesture: hasGesture(),
209
+ node: false,
210
+ touch: hasTouch(),
211
+ touchscreen: hasTouchScreen(),
212
+ unknown: true
213
+ };
214
+
215
+ for (var i = 0, p, m, v; p = platforms[i]; i++) {
216
+ m = p.regex.exec(userAgent);
217
+
218
+ if (m) {
219
+ plat.unknown = false;
220
+
221
+ if ('forceVersion' in p) {
222
+ v = p.forceVersion;
223
+ } else {
224
+ v = Number(m[1]);
225
+ }
226
+
227
+ plat[p.platform] = v;
228
+
229
+ if (p.extra) {
230
+ plat = _objectSpread(_objectSpread({}, plat), p.extra);
231
+ }
232
+
233
+ plat.platformName = p.platform;
234
+ break;
235
+ }
236
+ }
237
+
238
+ return plat;
239
+ };
140
240
  /**
141
241
  * @typedef {Object} PlatformDescription
142
242
  * @property {Object} [extra] - Additional information about the detected platform
@@ -159,24 +259,26 @@ const parseUserAgent = (userAgent) => {
159
259
  * @memberof core/platform
160
260
  * @public
161
261
  */
162
- const detect = () => {
163
- if (_platform) {
164
- // if we've already determined the platform, we'll use that determination
165
- return _platform;
166
- } else if (typeof window === 'undefined') {
167
- return {
168
- gesture: false,
169
- node: true,
170
- touch: false,
171
- unknown: true
172
- };
173
- }
174
-
175
- const userAgent = ua();
176
-
177
- return (_platform = parseUserAgent(userAgent));
178
- };
179
262
 
263
+
264
+ exports.parseUserAgent = parseUserAgent;
265
+
266
+ var detect = function detect() {
267
+ if (_platform) {
268
+ // if we've already determined the platform, we'll use that determination
269
+ return _platform;
270
+ } else if (typeof window === 'undefined') {
271
+ return {
272
+ gesture: false,
273
+ node: true,
274
+ touch: false,
275
+ unknown: true
276
+ };
277
+ }
278
+
279
+ var userAgent = ua();
280
+ return _platform = parseUserAgent(userAgent);
281
+ };
180
282
  /**
181
283
  * Provides basic information about the running platform.
182
284
  *
@@ -184,29 +286,21 @@ const detect = () => {
184
286
  * @memberof core/platform
185
287
  * @public
186
288
  */
187
- const platform = {};
188
-
189
- [
190
- 'gesture',
191
- 'node',
192
- 'platformName',
193
- 'touch',
194
- 'touchscreen',
195
- 'unknown',
196
- ...uniq(platforms.map(p => p.platform))
197
- ].forEach(name => {
198
- Object.defineProperty(platform, name, {
199
- enumerable: true,
200
- get: () => {
201
- const p = detect();
202
- return p[name];
203
- }
204
- });
205
- });
206
289
 
207
- export default platform;
208
- export {
209
- detect,
210
- parseUserAgent,
211
- platform
212
- };
290
+
291
+ exports.detect = detect;
292
+ var platform = {};
293
+ exports.platform = platform;
294
+ ['gesture', 'node', 'platformName', 'touch', 'touchscreen', 'unknown'].concat(_toConsumableArray((0, _uniq["default"])(platforms.map(function (p) {
295
+ return p.platform;
296
+ })))).forEach(function (name) {
297
+ Object.defineProperty(platform, name, {
298
+ enumerable: true,
299
+ get: function get() {
300
+ var p = detect();
301
+ return p[name];
302
+ }
303
+ });
304
+ });
305
+ var _default = platform;
306
+ exports["default"] = _default;
@@ -1,90 +1,92 @@
1
- import {parseUserAgent} from '../platform';
2
-
3
- describe('platform', () => {
4
-
5
- describe('webOS', () => {
6
- // From http://webostv.developer.lge.com/discover/specifications/web-engine/
7
- const webOSTV5 = 'Mozilla/5.0 (Web0S; Linux/SmartTV) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/68.0.3440.106 Safari/537.36 WebAppManager';
8
- const webOSTV4 = 'Mozilla/5.0 (Web0S; Linux/SmartTV) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/53.0.1785.34 Safari/537.36 WebAppManager';
9
- const webOSTV3 = 'Mozilla/5.0 (Web0S; Linux/SmartTV) AppleWebKit/537.36 (KHTML, like Gecko) QtWebEngine/5.1.1 Chrome/38.0.2125.122 Safari/537.36 WebAppManager';
10
- const webOSTV2 = 'Mozilla/5.0 (Web0S; Linux/SmartTV) AppleWebKit/538.2 (KHTML, like Gecko) Large Screen WebAppManager Safari/538.2';
11
- const webOSTV1 = 'Mozilla/5.0 (Web0S; Linux/SmartTV) AppleWebKit/537.41 (KHTML, like Gecko) Large Screen WebAppManager Safari/537.41';
12
-
13
- // From https://developers.whatismybrowser.com/useragents/explore/operating_system_name/webos/
14
- const LuneOS2 = 'Mozilla/5.0 (LuneOS, like webOS/3.0.5; Tablet) AppleWebKit/537.36 (KHTML, like Gecko) QtWebEngine/5.9.2 Chrome/56.0.2924.103 Safari/537.36';
15
- const LuneOS1 = 'Mozilla/5.0 (LuneOS, like webOS/3.0.5; Tablet) AppleWebKit/537.36 (KHTML, like Gecko) QtWebEngine/5.6.2 Chrome/45.0.2454.103 Safari/537.36';
16
- const webOS10 = 'Mozilla/5.0 (webOS/1.0; U; en-US) AppleWebKit/525.27.1 (KHTML, like Geko) Version/1.0 Safari/525.27.1 Pre/1.0';
17
- const webOS11 = 'Mozilla/5.0 (webOS/1.1; U; en-US) AppleWebKit/525.27.1 (KHTML, like Gecko) Version/1.0 Safari/525.27.1 Pre/1.0';
18
- const webOS12 = 'Mozilla/5.0 (webOS/1.2; U; en-US) AppleWebKit/525.27.1 (KHTML, like Gecko) Version/1.0 Safari/525.27.1 Pre/1.0';
19
- const webOS13 = 'Mozilla/5.0 (webOS/1.3.1; U; en-US) AppleWebKit/525.27.1 (KHTML, like Gecko) Version/1.0 Safari/525.27.1 Pre/1.0';
20
- const webOS1351 = 'Mozilla/5.0 (webOS/1.3.5.1; U; en-US) AppleWebKit/525.27.1 (KHTML, like Gecko) Version/1.0 Safari/525.27.1 Pre/1.1';
21
- const webOS2 = 'Mozilla/5.0 (webOS/2.0.1; U; en-US) AppleWebKit/532.2 (KHTML, like Gecko) Version/1.0 Safari/532.2 Pre/1.2';
22
-
23
- const webOSOther = 'Mozilla/5.0 (Web0S; Linux) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/70.0.3440.106 Safari/537.36 WebAppManager';
24
-
25
- test('should return webOS 1', () => {
26
- const expected = {webos: 1};
27
- const actual = parseUserAgent(webOSTV1);
28
-
29
- expect(actual).toMatchObject(expected);
30
- });
31
-
32
- test('should return webOS 2', () => {
33
- const expected = {webos: 2};
34
- const actual = parseUserAgent(webOSTV2);
35
-
36
- expect(actual).toMatchObject(expected);
37
- });
38
-
39
- test('should return webOS 3', () => {
40
- const expected = {webos: 3};
41
- const actual = parseUserAgent(webOSTV3);
42
-
43
- expect(actual).toMatchObject(expected);
44
- });
45
-
46
- test('should return webOS 4', () => {
47
- const expected = {webos: 4};
48
- const actual = parseUserAgent(webOSTV4);
49
-
50
- expect(actual).toMatchObject(expected);
51
- });
52
-
53
- test('should return webOS 5', () => {
54
- const expected = {webos: 5};
55
- const actual = parseUserAgent(webOSTV5);
56
-
57
- expect(actual).toMatchObject(expected);
58
- });
59
-
60
- test('should return webOS -1', () => {
61
- const expected = {webos: -1};
62
- const actual = parseUserAgent(webOSOther);
63
-
64
- expect(actual).toMatchObject(expected);
65
- });
66
-
67
- test('should return webOS -1 + LuneOS 1', () => {
68
- const expected = {webos: -1, luneos: 1};
69
-
70
- expect(parseUserAgent(LuneOS1)).toMatchObject(expected);
71
- expect(parseUserAgent(LuneOS2)).toMatchObject(expected);
72
- });
73
-
74
- test('should return webOS -1 + legacy 1', () => {
75
- const expected = {webos: -1, legacy: 1};
76
-
77
- expect(parseUserAgent(webOS10)).toMatchObject(expected);
78
- expect(parseUserAgent(webOS11)).toMatchObject(expected);
79
- expect(parseUserAgent(webOS12)).toMatchObject(expected);
80
- expect(parseUserAgent(webOS13)).toMatchObject(expected);
81
- expect(parseUserAgent(webOS1351)).toMatchObject(expected);
82
- });
83
-
84
- test('should return webOS -1 + legacy 2', () => {
85
- const expected = {webos: -1, legacy: 2};
86
-
87
- expect(parseUserAgent(webOS2)).toMatchObject(expected);
88
- });
89
- });
90
- });
1
+ "use strict";
2
+
3
+ var _platform = require("../platform");
4
+
5
+ describe('platform', function () {
6
+ describe('webOS', function () {
7
+ // From http://webostv.developer.lge.com/discover/specifications/web-engine/
8
+ var webOSTV5 = 'Mozilla/5.0 (Web0S; Linux/SmartTV) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/68.0.3440.106 Safari/537.36 WebAppManager';
9
+ var webOSTV4 = 'Mozilla/5.0 (Web0S; Linux/SmartTV) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/53.0.1785.34 Safari/537.36 WebAppManager';
10
+ var webOSTV3 = 'Mozilla/5.0 (Web0S; Linux/SmartTV) AppleWebKit/537.36 (KHTML, like Gecko) QtWebEngine/5.1.1 Chrome/38.0.2125.122 Safari/537.36 WebAppManager';
11
+ var webOSTV2 = 'Mozilla/5.0 (Web0S; Linux/SmartTV) AppleWebKit/538.2 (KHTML, like Gecko) Large Screen WebAppManager Safari/538.2';
12
+ var webOSTV1 = 'Mozilla/5.0 (Web0S; Linux/SmartTV) AppleWebKit/537.41 (KHTML, like Gecko) Large Screen WebAppManager Safari/537.41'; // From https://developers.whatismybrowser.com/useragents/explore/operating_system_name/webos/
13
+
14
+ var LuneOS2 = 'Mozilla/5.0 (LuneOS, like webOS/3.0.5; Tablet) AppleWebKit/537.36 (KHTML, like Gecko) QtWebEngine/5.9.2 Chrome/56.0.2924.103 Safari/537.36';
15
+ var LuneOS1 = 'Mozilla/5.0 (LuneOS, like webOS/3.0.5; Tablet) AppleWebKit/537.36 (KHTML, like Gecko) QtWebEngine/5.6.2 Chrome/45.0.2454.103 Safari/537.36';
16
+ var webOS10 = 'Mozilla/5.0 (webOS/1.0; U; en-US) AppleWebKit/525.27.1 (KHTML, like Geko) Version/1.0 Safari/525.27.1 Pre/1.0';
17
+ var webOS11 = 'Mozilla/5.0 (webOS/1.1; U; en-US) AppleWebKit/525.27.1 (KHTML, like Gecko) Version/1.0 Safari/525.27.1 Pre/1.0';
18
+ var webOS12 = 'Mozilla/5.0 (webOS/1.2; U; en-US) AppleWebKit/525.27.1 (KHTML, like Gecko) Version/1.0 Safari/525.27.1 Pre/1.0';
19
+ var webOS13 = 'Mozilla/5.0 (webOS/1.3.1; U; en-US) AppleWebKit/525.27.1 (KHTML, like Gecko) Version/1.0 Safari/525.27.1 Pre/1.0';
20
+ var webOS1351 = 'Mozilla/5.0 (webOS/1.3.5.1; U; en-US) AppleWebKit/525.27.1 (KHTML, like Gecko) Version/1.0 Safari/525.27.1 Pre/1.1';
21
+ var webOS2 = 'Mozilla/5.0 (webOS/2.0.1; U; en-US) AppleWebKit/532.2 (KHTML, like Gecko) Version/1.0 Safari/532.2 Pre/1.2';
22
+ var webOSOther = 'Mozilla/5.0 (Web0S; Linux) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/70.0.3440.106 Safari/537.36 WebAppManager';
23
+ test('should return webOS 1', function () {
24
+ var expected = {
25
+ webos: 1
26
+ };
27
+ var actual = (0, _platform.parseUserAgent)(webOSTV1);
28
+ expect(actual).toMatchObject(expected);
29
+ });
30
+ test('should return webOS 2', function () {
31
+ var expected = {
32
+ webos: 2
33
+ };
34
+ var actual = (0, _platform.parseUserAgent)(webOSTV2);
35
+ expect(actual).toMatchObject(expected);
36
+ });
37
+ test('should return webOS 3', function () {
38
+ var expected = {
39
+ webos: 3
40
+ };
41
+ var actual = (0, _platform.parseUserAgent)(webOSTV3);
42
+ expect(actual).toMatchObject(expected);
43
+ });
44
+ test('should return webOS 4', function () {
45
+ var expected = {
46
+ webos: 4
47
+ };
48
+ var actual = (0, _platform.parseUserAgent)(webOSTV4);
49
+ expect(actual).toMatchObject(expected);
50
+ });
51
+ test('should return webOS 5', function () {
52
+ var expected = {
53
+ webos: 5
54
+ };
55
+ var actual = (0, _platform.parseUserAgent)(webOSTV5);
56
+ expect(actual).toMatchObject(expected);
57
+ });
58
+ test('should return webOS -1', function () {
59
+ var expected = {
60
+ webos: -1
61
+ };
62
+ var actual = (0, _platform.parseUserAgent)(webOSOther);
63
+ expect(actual).toMatchObject(expected);
64
+ });
65
+ test('should return webOS -1 + LuneOS 1', function () {
66
+ var expected = {
67
+ webos: -1,
68
+ luneos: 1
69
+ };
70
+ expect((0, _platform.parseUserAgent)(LuneOS1)).toMatchObject(expected);
71
+ expect((0, _platform.parseUserAgent)(LuneOS2)).toMatchObject(expected);
72
+ });
73
+ test('should return webOS -1 + legacy 1', function () {
74
+ var expected = {
75
+ webos: -1,
76
+ legacy: 1
77
+ };
78
+ expect((0, _platform.parseUserAgent)(webOS10)).toMatchObject(expected);
79
+ expect((0, _platform.parseUserAgent)(webOS11)).toMatchObject(expected);
80
+ expect((0, _platform.parseUserAgent)(webOS12)).toMatchObject(expected);
81
+ expect((0, _platform.parseUserAgent)(webOS13)).toMatchObject(expected);
82
+ expect((0, _platform.parseUserAgent)(webOS1351)).toMatchObject(expected);
83
+ });
84
+ test('should return webOS -1 + legacy 2', function () {
85
+ var expected = {
86
+ webos: -1,
87
+ legacy: 2
88
+ };
89
+ expect((0, _platform.parseUserAgent)(webOS2)).toMatchObject(expected);
90
+ });
91
+ });
92
+ });
File without changes