native-fn 1.0.82 → 1.0.83
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/dist/index.d.ts +8 -1
- package/dist/native.cjs +4 -10
- package/dist/native.min.cjs +1 -1
- package/dist/native.min.mjs +1 -1
- package/dist/native.mjs +4 -10
- package/dist/native.umd.js +4 -10
- package/dist/native.umd.min.js +1 -1
- package/dist/plugin/app/index.cjs +102 -255
- package/dist/plugin/app/index.min.cjs +1 -1
- package/dist/plugin/app/index.min.mjs +1 -1
- package/dist/plugin/app/index.mjs +102 -255
- package/dist/plugin/app/index.umd.js +102 -255
- package/dist/plugin/app/index.umd.min.js +1 -1
- package/dist/plugin/app/src/plugin/appearance/constants/index.d.ts +2 -2
- package/dist/plugin/app/src/plugin/appearance/types/appearance.d.ts +0 -6
- package/dist/plugin/app/src/plugin/dimension/constants/index.d.ts +3 -0
- package/dist/plugin/app/src/plugin/dimension/types/dimension.d.ts +9 -6
- package/dist/plugin/app/src/plugin/dimension/types/dimensions.d.ts +11 -0
- package/dist/plugin/app/src/plugin/dimension/types/index.d.ts +2 -2
- package/dist/plugin/app/src/plugin/platform/constants/index.d.ts +1 -0
- package/dist/plugin/app/src/plugin/platform/cores/index.d.ts +0 -10
- package/dist/plugin/app/src/plugin/platform/types/platform.d.ts +3 -19
- package/dist/plugin/app/src/types/listener-entry.d.ts +6 -0
- package/dist/plugin/app/src/utils/request.d.ts +1 -0
- package/dist/plugin/appearance/index.cjs +55 -208
- package/dist/plugin/appearance/index.d.ts +1 -7
- package/dist/plugin/appearance/index.min.cjs +1 -1
- package/dist/plugin/appearance/index.min.mjs +1 -1
- package/dist/plugin/appearance/index.mjs +55 -208
- package/dist/plugin/appearance/index.umd.js +55 -208
- package/dist/plugin/appearance/index.umd.min.js +1 -1
- package/dist/plugin/appearance/src/plugin/appearance/constants/index.d.ts +2 -2
- package/dist/plugin/appearance/src/plugin/appearance/types/appearance.d.ts +0 -6
- package/dist/plugin/appearance/src/plugin/dimension/constants/index.d.ts +3 -0
- package/dist/plugin/appearance/src/plugin/dimension/types/dimension.d.ts +9 -6
- package/dist/plugin/appearance/src/plugin/dimension/types/dimensions.d.ts +11 -0
- package/dist/plugin/appearance/src/plugin/dimension/types/index.d.ts +2 -2
- package/dist/plugin/appearance/src/plugin/platform/constants/index.d.ts +1 -0
- package/dist/plugin/appearance/src/plugin/platform/cores/index.d.ts +0 -10
- package/dist/plugin/appearance/src/plugin/platform/types/platform.d.ts +3 -19
- package/dist/plugin/appearance/src/types/listener-entry.d.ts +6 -0
- package/dist/plugin/appearance/src/utils/request.d.ts +1 -0
- package/dist/plugin/clipboard/index.cjs +61 -214
- package/dist/plugin/clipboard/index.min.cjs +1 -1
- package/dist/plugin/clipboard/index.min.mjs +1 -1
- package/dist/plugin/clipboard/index.mjs +61 -214
- package/dist/plugin/clipboard/index.umd.js +61 -214
- package/dist/plugin/clipboard/index.umd.min.js +1 -1
- package/dist/plugin/clipboard/src/plugin/appearance/constants/index.d.ts +2 -2
- package/dist/plugin/clipboard/src/plugin/appearance/types/appearance.d.ts +0 -6
- package/dist/plugin/clipboard/src/plugin/dimension/constants/index.d.ts +3 -0
- package/dist/plugin/clipboard/src/plugin/dimension/types/dimension.d.ts +9 -6
- package/dist/plugin/clipboard/src/plugin/dimension/types/dimensions.d.ts +11 -0
- package/dist/plugin/clipboard/src/plugin/dimension/types/index.d.ts +2 -2
- package/dist/plugin/clipboard/src/plugin/platform/constants/index.d.ts +1 -0
- package/dist/plugin/clipboard/src/plugin/platform/cores/index.d.ts +0 -10
- package/dist/plugin/clipboard/src/plugin/platform/types/platform.d.ts +3 -19
- package/dist/plugin/clipboard/src/types/listener-entry.d.ts +6 -0
- package/dist/plugin/clipboard/src/utils/request.d.ts +1 -0
- package/dist/plugin/dimension/index.cjs +935 -1
- package/dist/plugin/dimension/index.d.ts +9 -0
- package/dist/plugin/dimension/index.min.cjs +1 -1
- package/dist/plugin/dimension/index.min.mjs +1 -1
- package/dist/plugin/dimension/index.mjs +935 -1
- package/dist/plugin/dimension/index.umd.js +935 -1
- package/dist/plugin/dimension/index.umd.min.js +1 -1
- package/dist/plugin/dimension/src/plugin/appearance/constants/index.d.ts +2 -2
- package/dist/plugin/dimension/src/plugin/appearance/types/appearance.d.ts +0 -6
- package/dist/plugin/dimension/src/plugin/dimension/constants/index.d.ts +3 -0
- package/dist/plugin/dimension/src/plugin/dimension/types/dimension.d.ts +9 -6
- package/dist/plugin/dimension/src/plugin/dimension/types/dimensions.d.ts +11 -0
- package/dist/plugin/dimension/src/plugin/dimension/types/index.d.ts +2 -2
- package/dist/plugin/dimension/src/plugin/platform/constants/index.d.ts +1 -0
- package/dist/plugin/dimension/src/plugin/platform/cores/index.d.ts +0 -10
- package/dist/plugin/dimension/src/plugin/platform/types/platform.d.ts +3 -19
- package/dist/plugin/dimension/src/types/listener-entry.d.ts +6 -0
- package/dist/plugin/dimension/src/utils/request.d.ts +1 -0
- package/dist/plugin/fullscreen/index.cjs +54 -207
- package/dist/plugin/fullscreen/index.min.cjs +1 -1
- package/dist/plugin/fullscreen/index.min.mjs +1 -1
- package/dist/plugin/fullscreen/index.mjs +54 -207
- package/dist/plugin/fullscreen/index.umd.js +54 -207
- package/dist/plugin/fullscreen/index.umd.min.js +1 -1
- package/dist/plugin/fullscreen/src/plugin/appearance/constants/index.d.ts +2 -2
- package/dist/plugin/fullscreen/src/plugin/appearance/types/appearance.d.ts +0 -6
- package/dist/plugin/fullscreen/src/plugin/dimension/constants/index.d.ts +3 -0
- package/dist/plugin/fullscreen/src/plugin/dimension/types/dimension.d.ts +9 -6
- package/dist/plugin/fullscreen/src/plugin/dimension/types/dimensions.d.ts +11 -0
- package/dist/plugin/fullscreen/src/plugin/dimension/types/index.d.ts +2 -2
- package/dist/plugin/fullscreen/src/plugin/platform/constants/index.d.ts +1 -0
- package/dist/plugin/fullscreen/src/plugin/platform/cores/index.d.ts +0 -10
- package/dist/plugin/fullscreen/src/plugin/platform/types/platform.d.ts +3 -19
- package/dist/plugin/fullscreen/src/types/listener-entry.d.ts +6 -0
- package/dist/plugin/fullscreen/src/utils/request.d.ts +1 -0
- package/dist/plugin/platform/index.cjs +50 -203
- package/dist/plugin/platform/index.d.ts +4 -20
- package/dist/plugin/platform/index.min.cjs +1 -1
- package/dist/plugin/platform/index.min.mjs +1 -1
- package/dist/plugin/platform/index.mjs +50 -203
- package/dist/plugin/platform/index.umd.js +50 -203
- package/dist/plugin/platform/index.umd.min.js +1 -1
- package/dist/plugin/platform/src/plugin/appearance/constants/index.d.ts +2 -2
- package/dist/plugin/platform/src/plugin/appearance/types/appearance.d.ts +0 -6
- package/dist/plugin/platform/src/plugin/dimension/constants/index.d.ts +3 -0
- package/dist/plugin/platform/src/plugin/dimension/types/dimension.d.ts +9 -6
- package/dist/plugin/platform/src/plugin/dimension/types/dimensions.d.ts +11 -0
- package/dist/plugin/platform/src/plugin/dimension/types/index.d.ts +2 -2
- package/dist/plugin/platform/src/plugin/platform/constants/index.d.ts +1 -0
- package/dist/plugin/platform/src/plugin/platform/cores/index.d.ts +0 -10
- package/dist/plugin/platform/src/plugin/platform/types/platform.d.ts +3 -19
- package/dist/plugin/platform/src/types/listener-entry.d.ts +6 -0
- package/dist/plugin/platform/src/utils/request.d.ts +1 -0
- package/dist/plugin/theme/index.cjs +51 -204
- package/dist/plugin/theme/index.min.cjs +1 -1
- package/dist/plugin/theme/index.min.mjs +1 -1
- package/dist/plugin/theme/index.mjs +51 -204
- package/dist/plugin/theme/index.umd.js +51 -204
- package/dist/plugin/theme/index.umd.min.js +1 -1
- package/dist/plugin/theme/src/plugin/appearance/constants/index.d.ts +2 -2
- package/dist/plugin/theme/src/plugin/appearance/types/appearance.d.ts +0 -6
- package/dist/plugin/theme/src/plugin/dimension/constants/index.d.ts +3 -0
- package/dist/plugin/theme/src/plugin/dimension/types/dimension.d.ts +9 -6
- package/dist/plugin/theme/src/plugin/dimension/types/dimensions.d.ts +11 -0
- package/dist/plugin/theme/src/plugin/dimension/types/index.d.ts +2 -2
- package/dist/plugin/theme/src/plugin/platform/constants/index.d.ts +1 -0
- package/dist/plugin/theme/src/plugin/platform/cores/index.d.ts +0 -10
- package/dist/plugin/theme/src/plugin/platform/types/platform.d.ts +3 -19
- package/dist/plugin/theme/src/types/listener-entry.d.ts +6 -0
- package/dist/plugin/theme/src/utils/request.d.ts +1 -0
- package/dist/src/plugin/appearance/constants/index.d.ts +2 -2
- package/dist/src/plugin/appearance/types/appearance.d.ts +0 -6
- package/dist/src/plugin/dimension/constants/index.d.ts +3 -0
- package/dist/src/plugin/dimension/types/dimension.d.ts +9 -6
- package/dist/src/plugin/dimension/types/dimensions.d.ts +11 -0
- package/dist/src/plugin/dimension/types/index.d.ts +2 -2
- package/dist/src/plugin/platform/constants/index.d.ts +1 -0
- package/dist/src/plugin/platform/cores/index.d.ts +0 -10
- package/dist/src/plugin/platform/types/platform.d.ts +3 -19
- package/dist/src/types/listener-entry.d.ts +6 -0
- package/dist/src/utils/request.d.ts +1 -0
- package/package.json +1 -1
|
@@ -45,6 +45,14 @@ var CrossPlatformFramework;
|
|
|
45
45
|
CrossPlatformFramework["Cordova"] = "Cordova";
|
|
46
46
|
})(CrossPlatformFramework || (CrossPlatformFramework = {}));
|
|
47
47
|
var USER_AGENT = typeof globalThis.navigator !== 'undefined' && typeof globalThis.navigator.userAgent === 'string' ? globalThis.navigator.userAgent : '';
|
|
48
|
+
var HIGH_ENTROPY_BRAND_NAME_MAP = {
|
|
49
|
+
'Google Chrome': 'Chrome',
|
|
50
|
+
'Microsoft Edge': 'Edge',
|
|
51
|
+
'Microsoft Edge WebView2': 'Edge WebView2',
|
|
52
|
+
'Android WebView': 'Chrome WebView',
|
|
53
|
+
'HeadlessChrome': 'Chrome Headless',
|
|
54
|
+
'OperaMobile': 'Opera Mobi',
|
|
55
|
+
};
|
|
48
56
|
|
|
49
57
|
function compareVersion(lhs, rhs) {
|
|
50
58
|
var pa = lhs.split('.');
|
|
@@ -81,15 +89,9 @@ var Platform = {
|
|
|
81
89
|
get readyState() {
|
|
82
90
|
return readyState;
|
|
83
91
|
},
|
|
84
|
-
get network() {
|
|
85
|
-
return getNetwork();
|
|
86
|
-
},
|
|
87
92
|
get locale() {
|
|
88
93
|
return getLocale();
|
|
89
94
|
},
|
|
90
|
-
get dimension() {
|
|
91
|
-
return getDimension();
|
|
92
|
-
},
|
|
93
95
|
get device() {
|
|
94
96
|
if (this.os.name === OS.iOS || this.os.name === OS.Android)
|
|
95
97
|
return Devices.Mobile;
|
|
@@ -104,7 +106,7 @@ var Platform = {
|
|
|
104
106
|
return /; ?wv|applewebkit(?!.*safari)/i.test(this.userAgent);
|
|
105
107
|
},
|
|
106
108
|
get isNode() {
|
|
107
|
-
return typeof globalThis.process !== 'undefined' && typeof globalThis.process.versions !== 'undefined' && globalThis.process.versions.node !== undefined;
|
|
109
|
+
return typeof globalThis.process !== 'undefined' && typeof globalThis.process.versions !== 'undefined' && typeof globalThis.process.versions.node !== 'undefined';
|
|
108
110
|
},
|
|
109
111
|
get isStandalone() {
|
|
110
112
|
if (this.os.name === OS.iOS)
|
|
@@ -126,6 +128,33 @@ var Platform = {
|
|
|
126
128
|
}
|
|
127
129
|
}
|
|
128
130
|
};
|
|
131
|
+
function resolveWindowsVersion(string) {
|
|
132
|
+
if (typeof string === 'undefined')
|
|
133
|
+
return '';
|
|
134
|
+
var mapped = {
|
|
135
|
+
'4.90': 'ME',
|
|
136
|
+
'NT3.51': 'NT 3.11',
|
|
137
|
+
'NT4.0': 'NT 4.0',
|
|
138
|
+
'NT 5.0': '2000',
|
|
139
|
+
'NT 5.1': 'XP',
|
|
140
|
+
'NT 5.2': 'XP',
|
|
141
|
+
'NT 6.0': 'Vista',
|
|
142
|
+
'NT 6.1': '7',
|
|
143
|
+
'NT 6.2': '8',
|
|
144
|
+
'NT 6.3': '8.1',
|
|
145
|
+
'NT 6.4': '10',
|
|
146
|
+
'NT 10.0': '10',
|
|
147
|
+
'ARM': 'RT'
|
|
148
|
+
}[string];
|
|
149
|
+
if (typeof mapped !== 'undefined')
|
|
150
|
+
return mapped;
|
|
151
|
+
return string;
|
|
152
|
+
}
|
|
153
|
+
function resolveUnderscoreVersion(string) {
|
|
154
|
+
if (typeof string === 'undefined')
|
|
155
|
+
return '';
|
|
156
|
+
return string.replace(/_/g, '.');
|
|
157
|
+
}
|
|
129
158
|
var OS_RESOLVER_MAP = [
|
|
130
159
|
[/windows nt (6\.[23]); arm/i, OS.Windows, resolveWindowsVersion],
|
|
131
160
|
[/windows (?:phone|mobile|iot)(?: os)?[\/ ]?([\d.]*( se)?)/i, OS.Windows, resolveWindowsVersion],
|
|
@@ -184,14 +213,6 @@ var BROWSER_RESOLVER_MAP = [
|
|
|
184
213
|
[/mobile vr; rv:([\w.]+)\).+firefox/i, Browsers.Firefox],
|
|
185
214
|
[/firefox\/([\w.]+)/i, Browsers.Firefox],
|
|
186
215
|
];
|
|
187
|
-
var HIGH_ENTROPY_BRAND_NAME_MAP = {
|
|
188
|
-
'Google Chrome': 'Chrome',
|
|
189
|
-
'Microsoft Edge': 'Edge',
|
|
190
|
-
'Microsoft Edge WebView2': 'Edge WebView2',
|
|
191
|
-
'Android WebView': 'Chrome WebView',
|
|
192
|
-
'HeadlessChrome': 'Chrome Headless',
|
|
193
|
-
'OperaMobile': 'Opera Mobi',
|
|
194
|
-
};
|
|
195
216
|
function incrementPendingTasks() {
|
|
196
217
|
pendingTasks++;
|
|
197
218
|
}
|
|
@@ -212,33 +233,6 @@ function checkReady() {
|
|
|
212
233
|
readyCallback.length = 0;
|
|
213
234
|
}
|
|
214
235
|
}
|
|
215
|
-
function resolveWindowsVersion(string) {
|
|
216
|
-
if (string === undefined)
|
|
217
|
-
return '';
|
|
218
|
-
var mapped = {
|
|
219
|
-
'4.90': 'ME',
|
|
220
|
-
'NT3.51': 'NT 3.11',
|
|
221
|
-
'NT4.0': 'NT 4.0',
|
|
222
|
-
'NT 5.0': '2000',
|
|
223
|
-
'NT 5.1': 'XP',
|
|
224
|
-
'NT 5.2': 'XP',
|
|
225
|
-
'NT 6.0': 'Vista',
|
|
226
|
-
'NT 6.1': '7',
|
|
227
|
-
'NT 6.2': '8',
|
|
228
|
-
'NT 6.3': '8.1',
|
|
229
|
-
'NT 6.4': '10',
|
|
230
|
-
'NT 10.0': '10',
|
|
231
|
-
'ARM': 'RT'
|
|
232
|
-
}[string];
|
|
233
|
-
if (mapped !== undefined)
|
|
234
|
-
return mapped;
|
|
235
|
-
return string;
|
|
236
|
-
}
|
|
237
|
-
function resolveUnderscoreVersion(string) {
|
|
238
|
-
if (string === undefined)
|
|
239
|
-
return '';
|
|
240
|
-
return string.replace(/_/g, '.');
|
|
241
|
-
}
|
|
242
236
|
function resolveSemanticWindowsVersion(version, defaultValue) {
|
|
243
237
|
if (version.major === 10 && version.minor === 0 && version.build >= 22000)
|
|
244
238
|
return '11';
|
|
@@ -375,12 +369,12 @@ function resolveVersion(string, resolver) {
|
|
|
375
369
|
return resolver(string);
|
|
376
370
|
if (typeof resolver === 'string')
|
|
377
371
|
return resolver;
|
|
378
|
-
if (string === undefined)
|
|
372
|
+
if (typeof string === 'undefined')
|
|
379
373
|
return '';
|
|
380
374
|
return string;
|
|
381
375
|
}
|
|
382
376
|
function normalizeBrand(entry) {
|
|
383
|
-
if (entry === null || entry === undefined)
|
|
377
|
+
if (entry === null || typeof entry === 'undefined')
|
|
384
378
|
return { brand: '', version: '' };
|
|
385
379
|
if (typeof entry === 'string')
|
|
386
380
|
return { brand: entry, version: '' };
|
|
@@ -434,102 +428,13 @@ function getRenderer() {
|
|
|
434
428
|
return '';
|
|
435
429
|
}
|
|
436
430
|
}
|
|
437
|
-
function getNetwork() {
|
|
438
|
-
var network = {
|
|
439
|
-
isOnline: null,
|
|
440
|
-
effectiveType: null,
|
|
441
|
-
type: null,
|
|
442
|
-
downlink: null,
|
|
443
|
-
rtt: null,
|
|
444
|
-
saveData: null,
|
|
445
|
-
};
|
|
446
|
-
if (typeof globalThis.navigator !== 'undefined') {
|
|
447
|
-
if (typeof globalThis.navigator.onLine !== 'undefined')
|
|
448
|
-
network.isOnline = globalThis.navigator.onLine;
|
|
449
|
-
var connection = globalThis.navigator.connection || globalThis.navigator.mozConnection || globalThis.navigator.webkitConnection;
|
|
450
|
-
if (typeof connection !== 'undefined') {
|
|
451
|
-
if (typeof connection.effectiveType !== 'undefined')
|
|
452
|
-
network.effectiveType = connection.effectiveType;
|
|
453
|
-
if (typeof connection.type !== 'undefined')
|
|
454
|
-
network.type = connection.type;
|
|
455
|
-
if (typeof connection.downlink !== 'undefined')
|
|
456
|
-
network.downlink = connection.downlink;
|
|
457
|
-
if (typeof connection.rtt !== 'undefined')
|
|
458
|
-
network.rtt = connection.rtt;
|
|
459
|
-
if (typeof connection.saveData !== 'undefined')
|
|
460
|
-
network.saveData = connection.saveData;
|
|
461
|
-
return network;
|
|
462
|
-
}
|
|
463
|
-
}
|
|
464
|
-
if (Platform.isNode) {
|
|
465
|
-
try {
|
|
466
|
-
var os = require('os');
|
|
467
|
-
var networkInterfaces = os.networkInterfaces();
|
|
468
|
-
var networkInterfaceNames = Object.keys(networkInterfaces);
|
|
469
|
-
for (var i = 0; i < networkInterfaceNames.length; i++) {
|
|
470
|
-
var name_1 = networkInterfaceNames[i];
|
|
471
|
-
var networkInterface = networkInterfaces[name_1];
|
|
472
|
-
for (var j = 0; j < networkInterface.length; j++) {
|
|
473
|
-
var address = networkInterface[j];
|
|
474
|
-
if (!address.internal && address.family === 'IPv4')
|
|
475
|
-
network.isOnline = true;
|
|
476
|
-
}
|
|
477
|
-
if (network.isOnline)
|
|
478
|
-
break;
|
|
479
|
-
}
|
|
480
|
-
}
|
|
481
|
-
catch (_) {
|
|
482
|
-
}
|
|
483
|
-
try {
|
|
484
|
-
var childProcess = require('child_process');
|
|
485
|
-
if (Platform.os.name === OS.Windows) {
|
|
486
|
-
try {
|
|
487
|
-
var output = childProcess.execSync('netsh wlan show interfaces', { encoding: 'utf8', timeout: 5000 });
|
|
488
|
-
if (output.includes('State') && output.includes('connected'))
|
|
489
|
-
network.type = 'wifi';
|
|
490
|
-
}
|
|
491
|
-
catch (_) {
|
|
492
|
-
}
|
|
493
|
-
if (network.type === null) {
|
|
494
|
-
try {
|
|
495
|
-
var output = childProcess.execSync('ipconfig', { encoding: 'utf8', timeout: 5000 });
|
|
496
|
-
if (output.includes('Ethernet adapter'))
|
|
497
|
-
network.type = 'ethernet';
|
|
498
|
-
}
|
|
499
|
-
catch (_) {
|
|
500
|
-
}
|
|
501
|
-
}
|
|
502
|
-
if (network.type === null)
|
|
503
|
-
network.type = 'other';
|
|
504
|
-
}
|
|
505
|
-
else if (Platform.os.name === OS.MacOS) {
|
|
506
|
-
try {
|
|
507
|
-
var output = childProcess.execSync('networksetup -listallhardwareports', { encoding: 'utf8', timeout: 5000 });
|
|
508
|
-
var activeInterface = childProcess.execSync('route -n get default | grep interface', { encoding: 'utf8', timeout: 5000 });
|
|
509
|
-
if (activeInterface.includes('en0') && output.includes('Wi-Fi'))
|
|
510
|
-
network.type = 'wifi';
|
|
511
|
-
else if (activeInterface.includes('en') || output.includes('Ethernet'))
|
|
512
|
-
network.type = 'ethernet';
|
|
513
|
-
else
|
|
514
|
-
network.type = 'other';
|
|
515
|
-
}
|
|
516
|
-
catch (_) {
|
|
517
|
-
network.type = 'other';
|
|
518
|
-
}
|
|
519
|
-
}
|
|
520
|
-
}
|
|
521
|
-
catch (_) {
|
|
522
|
-
}
|
|
523
|
-
}
|
|
524
|
-
return network;
|
|
525
|
-
}
|
|
526
431
|
function normalizeLocale(locale) {
|
|
527
|
-
if (locale === null || locale === undefined)
|
|
432
|
+
if (locale === null || typeof locale === 'undefined')
|
|
528
433
|
return locale;
|
|
529
434
|
if (locale.length === 0)
|
|
530
435
|
return null;
|
|
531
436
|
locale = locale.replace(/_/g, '-');
|
|
532
|
-
if (locale === 'C' || locale === 'posix'
|
|
437
|
+
if (locale === 'C' || locale.toLowerCase() === 'posix')
|
|
533
438
|
return 'en-US';
|
|
534
439
|
if (locale.indexOf('.') !== -1)
|
|
535
440
|
return normalizeLocale(locale.split('.')[0]);
|
|
@@ -547,9 +452,9 @@ function normalizeLocale(locale) {
|
|
|
547
452
|
}
|
|
548
453
|
function getLocale() {
|
|
549
454
|
var locale = {
|
|
550
|
-
language:
|
|
455
|
+
language: null,
|
|
551
456
|
languages: [],
|
|
552
|
-
timezone:
|
|
457
|
+
timezone: null,
|
|
553
458
|
timezoneOffset: 0,
|
|
554
459
|
};
|
|
555
460
|
function addLanguages(language) {
|
|
@@ -559,7 +464,7 @@ function getLocale() {
|
|
|
559
464
|
function addLanguage(language) {
|
|
560
465
|
language = normalizeLocale(language);
|
|
561
466
|
if (typeof language === "string" && locale.languages.indexOf(language) === -1) {
|
|
562
|
-
if (locale.language
|
|
467
|
+
if (locale.language === null)
|
|
563
468
|
locale.language = language;
|
|
564
469
|
locale.languages.push(language);
|
|
565
470
|
}
|
|
@@ -617,6 +522,11 @@ function getLocale() {
|
|
|
617
522
|
}
|
|
618
523
|
catch (_) {
|
|
619
524
|
}
|
|
525
|
+
try {
|
|
526
|
+
locale.timezone = Intl.DateTimeFormat().resolvedOptions().timeZone;
|
|
527
|
+
}
|
|
528
|
+
catch (_) {
|
|
529
|
+
}
|
|
620
530
|
}
|
|
621
531
|
if (typeof globalThis.navigator !== 'undefined') {
|
|
622
532
|
if (typeof globalThis.navigator.languages !== 'undefined')
|
|
@@ -630,13 +540,6 @@ function getLocale() {
|
|
|
630
540
|
if (typeof globalThis.navigator.systemLanguage !== 'undefined')
|
|
631
541
|
addLanguage(globalThis.navigator.systemLanguage);
|
|
632
542
|
}
|
|
633
|
-
try {
|
|
634
|
-
if (typeof Intl !== 'undefined') {
|
|
635
|
-
locale.timezone = Intl.DateTimeFormat().resolvedOptions().timeZone;
|
|
636
|
-
}
|
|
637
|
-
}
|
|
638
|
-
catch (_) {
|
|
639
|
-
}
|
|
640
543
|
try {
|
|
641
544
|
locale.timezoneOffset = new Date().getTimezoneOffset();
|
|
642
545
|
}
|
|
@@ -644,63 +547,8 @@ function getLocale() {
|
|
|
644
547
|
}
|
|
645
548
|
return locale;
|
|
646
549
|
}
|
|
647
|
-
function getDimension() {
|
|
648
|
-
var dimension = {
|
|
649
|
-
innerWidth: -1,
|
|
650
|
-
innerHeight: -1,
|
|
651
|
-
outerWidth: -1,
|
|
652
|
-
outerHeight: -1,
|
|
653
|
-
scale: 1,
|
|
654
|
-
};
|
|
655
|
-
if (typeof globalThis.innerWidth !== 'undefined') {
|
|
656
|
-
dimension.innerWidth = globalThis.innerWidth;
|
|
657
|
-
dimension.innerHeight = globalThis.innerHeight;
|
|
658
|
-
dimension.outerWidth = globalThis.outerWidth;
|
|
659
|
-
dimension.outerHeight = globalThis.outerHeight;
|
|
660
|
-
dimension.scale = globalThis.devicePixelRatio || 1;
|
|
661
|
-
return dimension;
|
|
662
|
-
}
|
|
663
|
-
if (Platform.crossPlatformFramework === CrossPlatformFramework.ReactNative) {
|
|
664
|
-
try {
|
|
665
|
-
var reactNative = require('react-native');
|
|
666
|
-
var dimensions = reactNative.Dimensions;
|
|
667
|
-
var pixelRatio = reactNative.PixelRatio;
|
|
668
|
-
var screenDimensions = dimensions.get('screen');
|
|
669
|
-
var windowDimensions = dimensions.get('window');
|
|
670
|
-
dimension.innerWidth = screenDimensions.width;
|
|
671
|
-
dimension.innerHeight = screenDimensions.height;
|
|
672
|
-
dimension.outerWidth = windowDimensions.width;
|
|
673
|
-
dimension.outerHeight = windowDimensions.height;
|
|
674
|
-
dimension.scale = pixelRatio.get();
|
|
675
|
-
return dimension;
|
|
676
|
-
}
|
|
677
|
-
catch (_) {
|
|
678
|
-
}
|
|
679
|
-
}
|
|
680
|
-
if (Platform.crossPlatformFramework === CrossPlatformFramework.Electron) {
|
|
681
|
-
try {
|
|
682
|
-
var electron = require('electron');
|
|
683
|
-
var screen_1 = electron.screen;
|
|
684
|
-
var browserWindow = electron.BrowserWindow;
|
|
685
|
-
var focusedWindow = browserWindow.getFocusedWindow() || browserWindow.getAllWindows()[0];
|
|
686
|
-
if (focusedWindow !== undefined) {
|
|
687
|
-
var contentSize = focusedWindow.getContentSize();
|
|
688
|
-
var size = focusedWindow.getSize();
|
|
689
|
-
dimension.innerWidth = contentSize[0];
|
|
690
|
-
dimension.innerHeight = contentSize[1];
|
|
691
|
-
dimension.outerWidth = size[0];
|
|
692
|
-
dimension.outerHeight = size[1];
|
|
693
|
-
dimension.scale = screen_1.getDisplayMatching(focusedWindow.getBounds()).scaleFactor;
|
|
694
|
-
}
|
|
695
|
-
return dimension;
|
|
696
|
-
}
|
|
697
|
-
catch (_) {
|
|
698
|
-
}
|
|
699
|
-
}
|
|
700
|
-
return dimension;
|
|
701
|
-
}
|
|
702
550
|
function init() {
|
|
703
|
-
if ((typeof globalThis.process !== 'undefined' && typeof globalThis.process.versions !== 'undefined' && globalThis.process.versions.electron !== undefined) || (/ electron\//i.test(USER_AGENT)))
|
|
551
|
+
if ((typeof globalThis.process !== 'undefined' && typeof globalThis.process.versions !== 'undefined' && typeof globalThis.process.versions.electron !== 'undefined') || (/ electron\//i.test(USER_AGENT)))
|
|
704
552
|
Platform.crossPlatformFramework = CrossPlatformFramework.Electron;
|
|
705
553
|
if (typeof globalThis.navigator !== 'undefined' && globalThis.navigator.product === 'ReactNative')
|
|
706
554
|
Platform.crossPlatformFramework = CrossPlatformFramework.ReactNative;
|
|
@@ -896,8 +744,7 @@ function init() {
|
|
|
896
744
|
finally {
|
|
897
745
|
decrementPendingTasks();
|
|
898
746
|
}
|
|
899
|
-
})
|
|
900
|
-
.catch(decrementPendingTasks);
|
|
747
|
+
});
|
|
901
748
|
}
|
|
902
749
|
checkReady();
|
|
903
750
|
}
|