native-fn 1.0.81 → 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 +189 -224
- package/dist/plugin/app/index.min.cjs +1 -1
- package/dist/plugin/app/index.min.mjs +1 -1
- package/dist/plugin/app/index.mjs +189 -224
- package/dist/plugin/app/index.umd.js +189 -224
- 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 +1 -7
- package/dist/plugin/app/src/plugin/clipboard/types/appearance.d.ts +13 -0
- package/dist/plugin/app/src/plugin/dimension/constants/index.d.ts +3 -0
- package/dist/plugin/app/src/plugin/dimension/cores/index.d.ts +3 -0
- package/dist/plugin/app/src/plugin/dimension/index.d.ts +4 -0
- package/dist/plugin/app/src/plugin/dimension/types/dimension.d.ts +11 -0
- package/dist/plugin/app/src/plugin/dimension/types/dimensions.d.ts +11 -0
- package/dist/plugin/app/src/plugin/dimension/types/index.d.ts +13 -0
- package/dist/plugin/app/src/plugin/platform/constants/index.d.ts +1 -0
- package/dist/plugin/app/src/plugin/platform/cores/index.d.ts +5 -10
- package/dist/plugin/app/src/plugin/platform/types/platform.d.ts +7 -18
- 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 +165 -222
- package/dist/plugin/appearance/index.d.ts +2 -8
- package/dist/plugin/appearance/index.min.cjs +1 -1
- package/dist/plugin/appearance/index.min.mjs +1 -1
- package/dist/plugin/appearance/index.mjs +165 -222
- package/dist/plugin/appearance/index.umd.js +165 -222
- 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 +1 -7
- package/dist/plugin/appearance/src/plugin/clipboard/types/appearance.d.ts +13 -0
- package/dist/plugin/appearance/src/plugin/dimension/constants/index.d.ts +3 -0
- package/dist/plugin/appearance/src/plugin/dimension/cores/index.d.ts +3 -0
- package/dist/plugin/appearance/src/plugin/dimension/index.d.ts +4 -0
- package/dist/plugin/appearance/src/plugin/dimension/types/dimension.d.ts +11 -0
- package/dist/plugin/appearance/src/plugin/dimension/types/dimensions.d.ts +11 -0
- package/dist/plugin/appearance/src/plugin/dimension/types/index.d.ts +13 -0
- package/dist/plugin/appearance/src/plugin/platform/constants/index.d.ts +1 -0
- package/dist/plugin/appearance/src/plugin/platform/cores/index.d.ts +5 -10
- package/dist/plugin/appearance/src/plugin/platform/types/platform.d.ts +7 -18
- 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 +148 -183
- package/dist/plugin/clipboard/index.min.cjs +1 -1
- package/dist/plugin/clipboard/index.min.mjs +1 -1
- package/dist/plugin/clipboard/index.mjs +148 -183
- package/dist/plugin/clipboard/index.umd.js +148 -183
- 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 +1 -7
- package/dist/plugin/clipboard/src/plugin/clipboard/types/appearance.d.ts +13 -0
- package/dist/plugin/clipboard/src/plugin/dimension/constants/index.d.ts +3 -0
- package/dist/plugin/clipboard/src/plugin/dimension/cores/index.d.ts +3 -0
- package/dist/plugin/clipboard/src/plugin/dimension/index.d.ts +4 -0
- package/dist/plugin/clipboard/src/plugin/dimension/types/dimension.d.ts +11 -0
- package/dist/plugin/clipboard/src/plugin/dimension/types/dimensions.d.ts +11 -0
- package/dist/plugin/clipboard/src/plugin/dimension/types/index.d.ts +13 -0
- package/dist/plugin/clipboard/src/plugin/platform/constants/index.d.ts +1 -0
- package/dist/plugin/clipboard/src/plugin/platform/cores/index.d.ts +5 -10
- package/dist/plugin/clipboard/src/plugin/platform/types/platform.d.ts +7 -18
- 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 +947 -0
- package/dist/plugin/dimension/index.d.ts +36 -0
- package/dist/plugin/dimension/index.min.cjs +1 -0
- package/dist/plugin/dimension/index.min.mjs +1 -0
- package/dist/plugin/dimension/index.mjs +945 -0
- package/dist/plugin/dimension/index.umd.js +953 -0
- package/dist/plugin/dimension/index.umd.min.js +1 -0
- package/dist/plugin/dimension/src/errors/plugin-not-extended-error.d.ts +2 -0
- package/dist/plugin/dimension/src/plugin/app/constants/index.d.ts +12 -0
- package/dist/plugin/dimension/src/plugin/app/cores/index.d.ts +13 -0
- package/dist/plugin/dimension/src/plugin/app/errors/url-open-error.d.ts +2 -0
- package/dist/plugin/dimension/src/plugin/app/index.d.ts +12 -0
- package/dist/plugin/dimension/src/plugin/app/types/app.d.ts +54 -0
- package/dist/plugin/dimension/src/plugin/app/types/index.d.ts +16 -0
- package/dist/plugin/dimension/src/plugin/appearance/constants/index.d.ts +11 -0
- package/dist/plugin/dimension/src/plugin/appearance/cores/index.d.ts +3 -0
- package/dist/plugin/dimension/src/plugin/appearance/index.d.ts +8 -0
- package/dist/plugin/dimension/src/plugin/appearance/types/appearance.d.ts +6 -0
- package/dist/plugin/dimension/src/plugin/appearance/types/index.d.ts +13 -0
- package/dist/plugin/dimension/src/plugin/clipboard/cores/index.d.ts +3 -0
- package/dist/plugin/dimension/src/plugin/clipboard/index.d.ts +5 -0
- package/dist/plugin/dimension/src/plugin/clipboard/types/appearance.d.ts +13 -0
- package/dist/plugin/dimension/src/plugin/clipboard/types/clipboard.d.ts +4 -0
- package/dist/plugin/dimension/src/plugin/clipboard/types/index.d.ts +11 -0
- package/dist/plugin/dimension/src/plugin/dimension/constants/index.d.ts +3 -0
- package/dist/plugin/dimension/src/plugin/dimension/cores/index.d.ts +3 -0
- package/dist/plugin/dimension/src/plugin/dimension/index.d.ts +4 -0
- package/dist/plugin/dimension/src/plugin/dimension/types/dimension.d.ts +11 -0
- package/dist/plugin/dimension/src/plugin/dimension/types/dimensions.d.ts +11 -0
- package/dist/plugin/dimension/src/plugin/dimension/types/index.d.ts +13 -0
- package/dist/plugin/dimension/src/plugin/fullscreen/cores/index.d.ts +35 -0
- package/dist/plugin/dimension/src/plugin/fullscreen/index.d.ts +5 -0
- package/dist/plugin/dimension/src/plugin/fullscreen/types/fullscreen.d.ts +10 -0
- package/dist/plugin/dimension/src/plugin/fullscreen/types/index.d.ts +11 -0
- package/dist/plugin/dimension/src/plugin/platform/constants/index.d.ts +43 -0
- package/dist/plugin/dimension/src/plugin/platform/cores/index.d.ts +35 -0
- package/dist/plugin/dimension/src/plugin/platform/index.d.ts +12 -0
- package/dist/plugin/dimension/src/plugin/platform/types/index.d.ts +11 -0
- package/dist/plugin/dimension/src/plugin/platform/types/platform.d.ts +27 -0
- package/dist/plugin/dimension/src/plugin/theme/constants/index.d.ts +2 -0
- package/dist/plugin/dimension/src/plugin/theme/cores/index.d.ts +3 -0
- package/dist/plugin/dimension/src/plugin/theme/index.d.ts +5 -0
- package/dist/plugin/dimension/src/plugin/theme/types/index.d.ts +11 -0
- package/dist/plugin/dimension/src/plugin/theme/types/theme.d.ts +4 -0
- package/dist/plugin/dimension/src/types/event-listener-util.d.ts +11 -0
- package/dist/plugin/dimension/src/types/index.d.ts +1 -0
- package/dist/plugin/dimension/src/types/listener-entry.d.ts +6 -0
- package/dist/plugin/dimension/src/types/native.d.ts +27 -0
- package/dist/plugin/dimension/src/utils/assign.d.ts +1 -0
- package/dist/plugin/dimension/src/utils/compare-version.d.ts +1 -0
- package/dist/plugin/dimension/src/utils/create-custom-error.d.ts +6 -0
- package/dist/plugin/dimension/src/utils/create-hidden-element.d.ts +1 -0
- package/dist/plugin/dimension/src/utils/dispatch-click-event.d.ts +1 -0
- package/dist/plugin/dimension/src/utils/event-listener-utils.d.ts +3 -0
- package/dist/plugin/dimension/src/utils/get-topmost-window.d.ts +1 -0
- package/dist/plugin/dimension/src/utils/is-secure-context.d.ts +1 -0
- package/dist/plugin/dimension/src/utils/request.d.ts +1 -0
- package/dist/plugin/fullscreen/index.cjs +156 -188
- package/dist/plugin/fullscreen/index.min.cjs +1 -1
- package/dist/plugin/fullscreen/index.min.mjs +1 -1
- package/dist/plugin/fullscreen/index.mjs +156 -188
- package/dist/plugin/fullscreen/index.umd.js +156 -188
- 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 +1 -7
- package/dist/plugin/fullscreen/src/plugin/clipboard/types/appearance.d.ts +13 -0
- package/dist/plugin/fullscreen/src/plugin/dimension/constants/index.d.ts +3 -0
- package/dist/plugin/fullscreen/src/plugin/dimension/cores/index.d.ts +3 -0
- package/dist/plugin/fullscreen/src/plugin/dimension/index.d.ts +4 -0
- package/dist/plugin/fullscreen/src/plugin/dimension/types/dimension.d.ts +11 -0
- package/dist/plugin/fullscreen/src/plugin/dimension/types/dimensions.d.ts +11 -0
- package/dist/plugin/fullscreen/src/plugin/dimension/types/index.d.ts +13 -0
- package/dist/plugin/fullscreen/src/plugin/platform/constants/index.d.ts +1 -0
- package/dist/plugin/fullscreen/src/plugin/platform/cores/index.d.ts +5 -10
- package/dist/plugin/fullscreen/src/plugin/platform/types/platform.d.ts +7 -18
- 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 +137 -172
- package/dist/plugin/platform/index.d.ts +8 -19
- package/dist/plugin/platform/index.min.cjs +1 -1
- package/dist/plugin/platform/index.min.mjs +1 -1
- package/dist/plugin/platform/index.mjs +137 -172
- package/dist/plugin/platform/index.umd.js +137 -172
- 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 +1 -7
- package/dist/plugin/platform/src/plugin/clipboard/types/appearance.d.ts +13 -0
- package/dist/plugin/platform/src/plugin/dimension/constants/index.d.ts +3 -0
- package/dist/plugin/platform/src/plugin/dimension/cores/index.d.ts +3 -0
- package/dist/plugin/platform/src/plugin/dimension/index.d.ts +4 -0
- package/dist/plugin/platform/src/plugin/dimension/types/dimension.d.ts +11 -0
- package/dist/plugin/platform/src/plugin/dimension/types/dimensions.d.ts +11 -0
- package/dist/plugin/platform/src/plugin/dimension/types/index.d.ts +13 -0
- package/dist/plugin/platform/src/plugin/platform/constants/index.d.ts +1 -0
- package/dist/plugin/platform/src/plugin/platform/cores/index.d.ts +5 -10
- package/dist/plugin/platform/src/plugin/platform/types/platform.d.ts +7 -18
- 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 +138 -173
- package/dist/plugin/theme/index.min.cjs +1 -1
- package/dist/plugin/theme/index.min.mjs +1 -1
- package/dist/plugin/theme/index.mjs +138 -173
- package/dist/plugin/theme/index.umd.js +138 -173
- 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 +1 -7
- package/dist/plugin/theme/src/plugin/clipboard/types/appearance.d.ts +13 -0
- package/dist/plugin/theme/src/plugin/dimension/constants/index.d.ts +3 -0
- package/dist/plugin/theme/src/plugin/dimension/cores/index.d.ts +3 -0
- package/dist/plugin/theme/src/plugin/dimension/index.d.ts +4 -0
- package/dist/plugin/theme/src/plugin/dimension/types/dimension.d.ts +11 -0
- package/dist/plugin/theme/src/plugin/dimension/types/dimensions.d.ts +11 -0
- package/dist/plugin/theme/src/plugin/dimension/types/index.d.ts +13 -0
- package/dist/plugin/theme/src/plugin/platform/constants/index.d.ts +1 -0
- package/dist/plugin/theme/src/plugin/platform/cores/index.d.ts +5 -10
- package/dist/plugin/theme/src/plugin/platform/types/platform.d.ts +7 -18
- 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 +1 -7
- package/dist/src/plugin/clipboard/types/appearance.d.ts +13 -0
- package/dist/src/plugin/dimension/constants/index.d.ts +3 -0
- package/dist/src/plugin/dimension/cores/index.d.ts +3 -0
- package/dist/src/plugin/dimension/index.d.ts +4 -0
- package/dist/src/plugin/dimension/types/dimension.d.ts +11 -0
- package/dist/src/plugin/dimension/types/dimensions.d.ts +11 -0
- package/dist/src/plugin/dimension/types/index.d.ts +13 -0
- package/dist/src/plugin/platform/constants/index.d.ts +1 -0
- package/dist/src/plugin/platform/cores/index.d.ts +5 -10
- package/dist/src/plugin/platform/types/platform.d.ts +7 -18
- package/dist/src/types/listener-entry.d.ts +6 -0
- package/dist/src/utils/request.d.ts +1 -0
- package/package.json +15 -15
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { Appearances } from "../constants";
|
|
2
|
+
import { NativeModule } from "../../../types";
|
|
3
|
+
export declare interface ListenerEntry {
|
|
4
|
+
fn: (appearance: Appearances) => any;
|
|
5
|
+
capture: boolean;
|
|
6
|
+
once: boolean;
|
|
7
|
+
signal?: AbortSignal;
|
|
8
|
+
}
|
|
9
|
+
export declare interface AppearanceInstance extends NativeModule {
|
|
10
|
+
get value(): Appearances;
|
|
11
|
+
set value(appearances: Exclude<Appearances, Appearances.Unknown>);
|
|
12
|
+
onchange(listener: (appearance?: Appearances) => any, options?: boolean | AddEventListenerOptions): () => void;
|
|
13
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { DimensionInstance } from "./dimensions";
|
|
2
|
+
import Dimension from "../cores";
|
|
3
|
+
export * from "./dimensions";
|
|
4
|
+
declare module 'native-fn' {
|
|
5
|
+
interface NativePlugins {
|
|
6
|
+
Dimension: DimensionInstance;
|
|
7
|
+
}
|
|
8
|
+
interface NativeConstants {
|
|
9
|
+
Dimension: typeof Dimension;
|
|
10
|
+
}
|
|
11
|
+
interface NativeErrors {
|
|
12
|
+
}
|
|
13
|
+
}
|
|
@@ -5,18 +5,13 @@ declare global {
|
|
|
5
5
|
interface Navigator {
|
|
6
6
|
userAgent?: string;
|
|
7
7
|
userAgentData?: UserAgentData;
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
8
|
+
language?: string;
|
|
9
|
+
languages?: readonly string[];
|
|
10
|
+
browserLanguage?: string;
|
|
11
|
+
systemLanguage?: string;
|
|
12
|
+
userLanguage?: string;
|
|
11
13
|
}
|
|
12
14
|
}
|
|
13
|
-
interface NavigatorConnection {
|
|
14
|
-
effectiveType?: 'slow-2g' | '2g' | '3g' | '4g';
|
|
15
|
-
type?: 'bluetooth' | 'cellular' | 'ethernet' | 'none' | 'wifi' | 'wimax' | 'other';
|
|
16
|
-
downlink?: number;
|
|
17
|
-
rtt?: number;
|
|
18
|
-
saveData?: boolean;
|
|
19
|
-
}
|
|
20
15
|
interface CordovaDevice {
|
|
21
16
|
platform: string;
|
|
22
17
|
version: string;
|
|
@@ -1,19 +1,17 @@
|
|
|
1
1
|
import { Browsers, CrossPlatformFramework, Devices, Engines, OS } from "../constants";
|
|
2
|
+
export declare type VersionResolver = undefined | string | ((string: string | undefined) => string);
|
|
2
3
|
export declare interface PlatformInstance {
|
|
3
4
|
os: NameVersionPair<OS>;
|
|
4
5
|
engine: NameVersionPair<Engines>;
|
|
5
6
|
browser: NameVersionPair<Browsers>;
|
|
6
7
|
device: Devices;
|
|
7
8
|
crossPlatformFramework: CrossPlatformFramework;
|
|
8
|
-
|
|
9
|
-
dimension: Dimension;
|
|
9
|
+
locale: Locale;
|
|
10
10
|
renderer: string;
|
|
11
11
|
userAgent: string;
|
|
12
12
|
readyState: 'loading' | 'complete';
|
|
13
13
|
isNode: boolean;
|
|
14
14
|
isStandalone: boolean;
|
|
15
|
-
isMobile: boolean;
|
|
16
|
-
isDesktop: boolean;
|
|
17
15
|
isWebview: boolean;
|
|
18
16
|
onready(callback: (platform: PlatformInstance) => void): void;
|
|
19
17
|
}
|
|
@@ -21,18 +19,9 @@ export declare interface NameVersionPair<T> {
|
|
|
21
19
|
name: T;
|
|
22
20
|
version: string;
|
|
23
21
|
}
|
|
24
|
-
export declare interface
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
rtt: number | null;
|
|
30
|
-
saveData: boolean | null;
|
|
31
|
-
}
|
|
32
|
-
export declare interface Dimension {
|
|
33
|
-
outerWidth: number;
|
|
34
|
-
outerHeight: number;
|
|
35
|
-
innerWidth: number;
|
|
36
|
-
innerHeight: number;
|
|
37
|
-
scale: number;
|
|
22
|
+
export declare interface Locale {
|
|
23
|
+
language: string | null;
|
|
24
|
+
languages: string[];
|
|
25
|
+
timezone: string | null;
|
|
26
|
+
timezoneOffset: number;
|
|
38
27
|
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export default function request<T = unknown>(url: string, options?: Record<string, any>): Promise<T>;
|
|
@@ -47,6 +47,14 @@ var CrossPlatformFramework;
|
|
|
47
47
|
CrossPlatformFramework["Cordova"] = "Cordova";
|
|
48
48
|
})(CrossPlatformFramework || (CrossPlatformFramework = {}));
|
|
49
49
|
var USER_AGENT = typeof globalThis.navigator !== 'undefined' && typeof globalThis.navigator.userAgent === 'string' ? globalThis.navigator.userAgent : '';
|
|
50
|
+
var HIGH_ENTROPY_BRAND_NAME_MAP = {
|
|
51
|
+
'Google Chrome': 'Chrome',
|
|
52
|
+
'Microsoft Edge': 'Edge',
|
|
53
|
+
'Microsoft Edge WebView2': 'Edge WebView2',
|
|
54
|
+
'Android WebView': 'Chrome WebView',
|
|
55
|
+
'HeadlessChrome': 'Chrome Headless',
|
|
56
|
+
'OperaMobile': 'Opera Mobi',
|
|
57
|
+
};
|
|
50
58
|
|
|
51
59
|
function compareVersion(lhs, rhs) {
|
|
52
60
|
var pa = lhs.split('.');
|
|
@@ -83,11 +91,8 @@ var Platform = {
|
|
|
83
91
|
get readyState() {
|
|
84
92
|
return readyState;
|
|
85
93
|
},
|
|
86
|
-
get
|
|
87
|
-
return
|
|
88
|
-
},
|
|
89
|
-
get dimension() {
|
|
90
|
-
return getDimension();
|
|
94
|
+
get locale() {
|
|
95
|
+
return getLocale();
|
|
91
96
|
},
|
|
92
97
|
get device() {
|
|
93
98
|
if (this.os.name === OS.iOS || this.os.name === OS.Android)
|
|
@@ -99,17 +104,11 @@ var Platform = {
|
|
|
99
104
|
get renderer() {
|
|
100
105
|
return getRenderer();
|
|
101
106
|
},
|
|
102
|
-
get isMobile() {
|
|
103
|
-
return this.device === Devices.Mobile;
|
|
104
|
-
},
|
|
105
|
-
get isDesktop() {
|
|
106
|
-
return this.device === Devices.Desktop;
|
|
107
|
-
},
|
|
108
107
|
get isWebview() {
|
|
109
108
|
return /; ?wv|applewebkit(?!.*safari)/i.test(this.userAgent);
|
|
110
109
|
},
|
|
111
110
|
get isNode() {
|
|
112
|
-
return typeof globalThis.process !== 'undefined' && typeof globalThis.process.versions !== 'undefined' && globalThis.process.versions.node !== undefined;
|
|
111
|
+
return typeof globalThis.process !== 'undefined' && typeof globalThis.process.versions !== 'undefined' && typeof globalThis.process.versions.node !== 'undefined';
|
|
113
112
|
},
|
|
114
113
|
get isStandalone() {
|
|
115
114
|
if (this.os.name === OS.iOS)
|
|
@@ -131,6 +130,33 @@ var Platform = {
|
|
|
131
130
|
}
|
|
132
131
|
}
|
|
133
132
|
};
|
|
133
|
+
function resolveWindowsVersion(string) {
|
|
134
|
+
if (typeof string === 'undefined')
|
|
135
|
+
return '';
|
|
136
|
+
var mapped = {
|
|
137
|
+
'4.90': 'ME',
|
|
138
|
+
'NT3.51': 'NT 3.11',
|
|
139
|
+
'NT4.0': 'NT 4.0',
|
|
140
|
+
'NT 5.0': '2000',
|
|
141
|
+
'NT 5.1': 'XP',
|
|
142
|
+
'NT 5.2': 'XP',
|
|
143
|
+
'NT 6.0': 'Vista',
|
|
144
|
+
'NT 6.1': '7',
|
|
145
|
+
'NT 6.2': '8',
|
|
146
|
+
'NT 6.3': '8.1',
|
|
147
|
+
'NT 6.4': '10',
|
|
148
|
+
'NT 10.0': '10',
|
|
149
|
+
'ARM': 'RT'
|
|
150
|
+
}[string];
|
|
151
|
+
if (typeof mapped !== 'undefined')
|
|
152
|
+
return mapped;
|
|
153
|
+
return string;
|
|
154
|
+
}
|
|
155
|
+
function resolveUnderscoreVersion(string) {
|
|
156
|
+
if (typeof string === 'undefined')
|
|
157
|
+
return '';
|
|
158
|
+
return string.replace(/_/g, '.');
|
|
159
|
+
}
|
|
134
160
|
var OS_RESOLVER_MAP = [
|
|
135
161
|
[/windows nt (6\.[23]); arm/i, OS.Windows, resolveWindowsVersion],
|
|
136
162
|
[/windows (?:phone|mobile|iot)(?: os)?[\/ ]?([\d.]*( se)?)/i, OS.Windows, resolveWindowsVersion],
|
|
@@ -189,14 +215,6 @@ var BROWSER_RESOLVER_MAP = [
|
|
|
189
215
|
[/mobile vr; rv:([\w.]+)\).+firefox/i, Browsers.Firefox],
|
|
190
216
|
[/firefox\/([\w.]+)/i, Browsers.Firefox],
|
|
191
217
|
];
|
|
192
|
-
var HIGH_ENTROPY_BRAND_NAME_MAP = {
|
|
193
|
-
'Google Chrome': 'Chrome',
|
|
194
|
-
'Microsoft Edge': 'Edge',
|
|
195
|
-
'Microsoft Edge WebView2': 'Edge WebView2',
|
|
196
|
-
'Android WebView': 'Chrome WebView',
|
|
197
|
-
'HeadlessChrome': 'Chrome Headless',
|
|
198
|
-
'OperaMobile': 'Opera Mobi',
|
|
199
|
-
};
|
|
200
218
|
function incrementPendingTasks() {
|
|
201
219
|
pendingTasks++;
|
|
202
220
|
}
|
|
@@ -217,33 +235,6 @@ function checkReady() {
|
|
|
217
235
|
readyCallback.length = 0;
|
|
218
236
|
}
|
|
219
237
|
}
|
|
220
|
-
function resolveWindowsVersion(string) {
|
|
221
|
-
if (string === undefined)
|
|
222
|
-
return '';
|
|
223
|
-
var mapped = {
|
|
224
|
-
'4.90': 'ME',
|
|
225
|
-
'NT3.51': 'NT 3.11',
|
|
226
|
-
'NT4.0': 'NT 4.0',
|
|
227
|
-
'NT 5.0': '2000',
|
|
228
|
-
'NT 5.1': 'XP',
|
|
229
|
-
'NT 5.2': 'XP',
|
|
230
|
-
'NT 6.0': 'Vista',
|
|
231
|
-
'NT 6.1': '7',
|
|
232
|
-
'NT 6.2': '8',
|
|
233
|
-
'NT 6.3': '8.1',
|
|
234
|
-
'NT 6.4': '10',
|
|
235
|
-
'NT 10.0': '10',
|
|
236
|
-
'ARM': 'RT'
|
|
237
|
-
}[string];
|
|
238
|
-
if (mapped !== undefined)
|
|
239
|
-
return mapped;
|
|
240
|
-
return string;
|
|
241
|
-
}
|
|
242
|
-
function resolveUnderscoreVersion(string) {
|
|
243
|
-
if (string === undefined)
|
|
244
|
-
return '';
|
|
245
|
-
return string.replace(/_/g, '.');
|
|
246
|
-
}
|
|
247
238
|
function resolveSemanticWindowsVersion(version, defaultValue) {
|
|
248
239
|
if (version.major === 10 && version.minor === 0 && version.build >= 22000)
|
|
249
240
|
return '11';
|
|
@@ -380,12 +371,12 @@ function resolveVersion(string, resolver) {
|
|
|
380
371
|
return resolver(string);
|
|
381
372
|
if (typeof resolver === 'string')
|
|
382
373
|
return resolver;
|
|
383
|
-
if (string === undefined)
|
|
374
|
+
if (typeof string === 'undefined')
|
|
384
375
|
return '';
|
|
385
376
|
return string;
|
|
386
377
|
}
|
|
387
378
|
function normalizeBrand(entry) {
|
|
388
|
-
if (entry === null || entry === undefined)
|
|
379
|
+
if (entry === null || typeof entry === 'undefined')
|
|
389
380
|
return { brand: '', version: '' };
|
|
390
381
|
if (typeof entry === 'string')
|
|
391
382
|
return { brand: entry, version: '' };
|
|
@@ -439,152 +430,127 @@ function getRenderer() {
|
|
|
439
430
|
return '';
|
|
440
431
|
}
|
|
441
432
|
}
|
|
442
|
-
function
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
433
|
+
function normalizeLocale(locale) {
|
|
434
|
+
if (locale === null || typeof locale === 'undefined')
|
|
435
|
+
return locale;
|
|
436
|
+
if (locale.length === 0)
|
|
437
|
+
return null;
|
|
438
|
+
locale = locale.replace(/_/g, '-');
|
|
439
|
+
if (locale === 'C' || locale.toLowerCase() === 'posix')
|
|
440
|
+
return 'en-US';
|
|
441
|
+
if (locale.indexOf('.') !== -1)
|
|
442
|
+
return normalizeLocale(locale.split('.')[0]);
|
|
443
|
+
if (locale.indexOf('@') !== -1)
|
|
444
|
+
return normalizeLocale(locale.split('@')[0]);
|
|
445
|
+
var parts = locale.split('-');
|
|
446
|
+
if (parts.length === 0)
|
|
447
|
+
return null;
|
|
448
|
+
parts[0] = parts[0].toLowerCase();
|
|
449
|
+
if (parts.length > 1 && parts[1].length === 2)
|
|
450
|
+
parts[1] = parts[1].toUpperCase();
|
|
451
|
+
if (parts.length > 2 && parts[1].length === 4)
|
|
452
|
+
parts[1] = parts[1].charAt(0).toUpperCase() + parts[1].slice(1).toLowerCase();
|
|
453
|
+
return parts.join('-');
|
|
454
|
+
}
|
|
455
|
+
function getLocale() {
|
|
456
|
+
var locale = {
|
|
457
|
+
language: null,
|
|
458
|
+
languages: [],
|
|
459
|
+
timezone: null,
|
|
460
|
+
timezoneOffset: 0,
|
|
450
461
|
};
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
var connection = globalThis.navigator.connection || globalThis.navigator.mozConnection || globalThis.navigator.webkitConnection;
|
|
455
|
-
if (typeof connection !== 'undefined') {
|
|
456
|
-
if (typeof connection.effectiveType !== 'undefined')
|
|
457
|
-
network.effectiveType = connection.effectiveType;
|
|
458
|
-
if (typeof connection.type !== 'undefined')
|
|
459
|
-
network.type = connection.type;
|
|
460
|
-
if (typeof connection.downlink !== 'undefined')
|
|
461
|
-
network.downlink = connection.downlink;
|
|
462
|
-
if (typeof connection.rtt !== 'undefined')
|
|
463
|
-
network.rtt = connection.rtt;
|
|
464
|
-
if (typeof connection.saveData !== 'undefined')
|
|
465
|
-
network.saveData = connection.saveData;
|
|
466
|
-
return network;
|
|
467
|
-
}
|
|
462
|
+
function addLanguages(language) {
|
|
463
|
+
for (var i = 0; i < language.length; i++)
|
|
464
|
+
addLanguage(language[i]);
|
|
468
465
|
}
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
var name_1 = networkInterfaceNames[i];
|
|
476
|
-
var networkInterface = networkInterfaces[name_1];
|
|
477
|
-
for (var j = 0; j < networkInterface.length; j++) {
|
|
478
|
-
var address = networkInterface[j];
|
|
479
|
-
if (!address.internal && address.family === 'IPv4')
|
|
480
|
-
network.isOnline = true;
|
|
481
|
-
}
|
|
482
|
-
if (network.isOnline)
|
|
483
|
-
break;
|
|
484
|
-
}
|
|
485
|
-
}
|
|
486
|
-
catch (_) {
|
|
466
|
+
function addLanguage(language) {
|
|
467
|
+
language = normalizeLocale(language);
|
|
468
|
+
if (typeof language === "string" && locale.languages.indexOf(language) === -1) {
|
|
469
|
+
if (locale.language === null)
|
|
470
|
+
locale.language = language;
|
|
471
|
+
locale.languages.push(language);
|
|
487
472
|
}
|
|
473
|
+
}
|
|
474
|
+
if (Platform.crossPlatformFramework === CrossPlatformFramework.ReactNative) {
|
|
488
475
|
try {
|
|
489
|
-
var
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
if (
|
|
502
|
-
|
|
503
|
-
}
|
|
504
|
-
catch (_) {
|
|
476
|
+
var reactNative = require('react-native');
|
|
477
|
+
var nativeModules = reactNative.NativeModules;
|
|
478
|
+
if (typeof nativeModules.SettingsManager !== 'undefined') {
|
|
479
|
+
var settingManager = nativeModules.SettingsManager;
|
|
480
|
+
if (typeof settingManager !== 'undefined') {
|
|
481
|
+
var constant = typeof settingManager.getConstants === 'function'
|
|
482
|
+
? settingManager.getConstants()
|
|
483
|
+
: settingManager;
|
|
484
|
+
if (typeof constant !== 'undefined' && typeof constant.settings !== 'undefined') {
|
|
485
|
+
var settings = constant.settings;
|
|
486
|
+
if (typeof settings.AppleLocale === 'string')
|
|
487
|
+
addLanguage(settings.AppleLocale);
|
|
488
|
+
if (Array.isArray(settings.AppleLanguages) && settings.AppleLanguages.length > 0)
|
|
489
|
+
addLanguages(settings.AppleLanguages);
|
|
505
490
|
}
|
|
506
491
|
}
|
|
507
|
-
if (network.type === null)
|
|
508
|
-
network.type = 'other';
|
|
509
492
|
}
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
var
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
else
|
|
519
|
-
network.type = 'other';
|
|
520
|
-
}
|
|
521
|
-
catch (_) {
|
|
522
|
-
network.type = 'other';
|
|
493
|
+
if (typeof nativeModules.I18nManager !== 'undefined') {
|
|
494
|
+
var i18nManager = nativeModules.I18nManager;
|
|
495
|
+
if (typeof i18nManager !== 'undefined') {
|
|
496
|
+
var constant = typeof i18nManager.getConstants === 'function'
|
|
497
|
+
? i18nManager.getConstants()
|
|
498
|
+
: i18nManager;
|
|
499
|
+
if (typeof constant !== 'undefined' && typeof constant.localeIdentifier !== 'undefined')
|
|
500
|
+
addLanguage(constant.localeIdentifier);
|
|
523
501
|
}
|
|
524
502
|
}
|
|
525
503
|
}
|
|
526
504
|
catch (_) {
|
|
527
505
|
}
|
|
528
506
|
}
|
|
529
|
-
|
|
530
|
-
}
|
|
531
|
-
function getDimension() {
|
|
532
|
-
var dimension = {
|
|
533
|
-
innerWidth: -1,
|
|
534
|
-
innerHeight: -1,
|
|
535
|
-
outerWidth: -1,
|
|
536
|
-
outerHeight: -1,
|
|
537
|
-
scale: 1,
|
|
538
|
-
};
|
|
539
|
-
if (typeof globalThis.innerWidth !== 'undefined') {
|
|
540
|
-
dimension.innerWidth = globalThis.innerWidth;
|
|
541
|
-
dimension.innerHeight = globalThis.innerHeight;
|
|
542
|
-
dimension.outerWidth = globalThis.outerWidth;
|
|
543
|
-
dimension.outerHeight = globalThis.outerHeight;
|
|
544
|
-
dimension.scale = globalThis.devicePixelRatio || 1;
|
|
545
|
-
return dimension;
|
|
546
|
-
}
|
|
547
|
-
if (Platform.crossPlatformFramework === CrossPlatformFramework.ReactNative) {
|
|
507
|
+
if (Platform.crossPlatformFramework === CrossPlatformFramework.Electron) {
|
|
548
508
|
try {
|
|
549
|
-
var
|
|
550
|
-
var
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
|
|
557
|
-
dimension.outerHeight = windowDimensions.height;
|
|
558
|
-
dimension.scale = pixelRatio.get();
|
|
559
|
-
return dimension;
|
|
509
|
+
var electron = require('electron');
|
|
510
|
+
var app = electron.app;
|
|
511
|
+
if (typeof app.getLocale !== 'undefined')
|
|
512
|
+
addLanguage(app.getLocale());
|
|
513
|
+
if (typeof app.getSystemLocale !== 'undefined')
|
|
514
|
+
addLanguage(app.getSystemLocale());
|
|
515
|
+
if (typeof app.getPreferredSystemLanguages !== 'undefined')
|
|
516
|
+
addLanguages(app.getPreferredSystemLanguages());
|
|
560
517
|
}
|
|
561
518
|
catch (_) {
|
|
562
519
|
}
|
|
563
520
|
}
|
|
564
|
-
if (
|
|
521
|
+
if (typeof Intl !== 'undefined') {
|
|
565
522
|
try {
|
|
566
|
-
|
|
567
|
-
var screen_1 = electron.screen;
|
|
568
|
-
var browserWindow = electron.BrowserWindow;
|
|
569
|
-
var focusedWindow = browserWindow.getFocusedWindow() || browserWindow.getAllWindows()[0];
|
|
570
|
-
if (focusedWindow !== undefined) {
|
|
571
|
-
var contentSize = focusedWindow.getContentSize();
|
|
572
|
-
var size = focusedWindow.getSize();
|
|
573
|
-
dimension.innerWidth = contentSize[0];
|
|
574
|
-
dimension.innerHeight = contentSize[1];
|
|
575
|
-
dimension.outerWidth = size[0];
|
|
576
|
-
dimension.outerHeight = size[1];
|
|
577
|
-
dimension.scale = screen_1.getDisplayMatching(focusedWindow.getBounds()).scaleFactor;
|
|
578
|
-
}
|
|
579
|
-
return dimension;
|
|
523
|
+
addLanguage(Intl.DateTimeFormat().resolvedOptions().locale);
|
|
580
524
|
}
|
|
581
525
|
catch (_) {
|
|
582
526
|
}
|
|
527
|
+
try {
|
|
528
|
+
locale.timezone = Intl.DateTimeFormat().resolvedOptions().timeZone;
|
|
529
|
+
}
|
|
530
|
+
catch (_) {
|
|
531
|
+
}
|
|
532
|
+
}
|
|
533
|
+
if (typeof globalThis.navigator !== 'undefined') {
|
|
534
|
+
if (typeof globalThis.navigator.languages !== 'undefined')
|
|
535
|
+
addLanguages(globalThis.navigator.languages);
|
|
536
|
+
if (typeof globalThis.navigator.language !== 'undefined')
|
|
537
|
+
addLanguage(globalThis.navigator.language);
|
|
538
|
+
if (typeof globalThis.navigator.userLanguage !== 'undefined')
|
|
539
|
+
addLanguage(globalThis.navigator.userLanguage);
|
|
540
|
+
if (typeof globalThis.navigator.browserLanguage !== 'undefined')
|
|
541
|
+
addLanguage(globalThis.navigator.browserLanguage);
|
|
542
|
+
if (typeof globalThis.navigator.systemLanguage !== 'undefined')
|
|
543
|
+
addLanguage(globalThis.navigator.systemLanguage);
|
|
544
|
+
}
|
|
545
|
+
try {
|
|
546
|
+
locale.timezoneOffset = new Date().getTimezoneOffset();
|
|
547
|
+
}
|
|
548
|
+
catch (_) {
|
|
583
549
|
}
|
|
584
|
-
return
|
|
550
|
+
return locale;
|
|
585
551
|
}
|
|
586
552
|
function init() {
|
|
587
|
-
if ((typeof globalThis.process !== 'undefined' && typeof globalThis.process.versions !== 'undefined' && globalThis.process.versions.electron !== undefined) || (/ electron\//i.test(USER_AGENT)))
|
|
553
|
+
if ((typeof globalThis.process !== 'undefined' && typeof globalThis.process.versions !== 'undefined' && typeof globalThis.process.versions.electron !== 'undefined') || (/ electron\//i.test(USER_AGENT)))
|
|
588
554
|
Platform.crossPlatformFramework = CrossPlatformFramework.Electron;
|
|
589
555
|
if (typeof globalThis.navigator !== 'undefined' && globalThis.navigator.product === 'ReactNative')
|
|
590
556
|
Platform.crossPlatformFramework = CrossPlatformFramework.ReactNative;
|
|
@@ -780,8 +746,7 @@ function init() {
|
|
|
780
746
|
finally {
|
|
781
747
|
decrementPendingTasks();
|
|
782
748
|
}
|
|
783
|
-
})
|
|
784
|
-
.catch(decrementPendingTasks);
|
|
749
|
+
});
|
|
785
750
|
}
|
|
786
751
|
checkReady();
|
|
787
752
|
}
|
|
@@ -48,21 +48,19 @@ declare enum CrossPlatformFramework {
|
|
|
48
48
|
Cordova = "Cordova"
|
|
49
49
|
}
|
|
50
50
|
|
|
51
|
+
declare type VersionResolver = undefined | string | ((string: string | undefined) => string);
|
|
51
52
|
declare interface PlatformInstance {
|
|
52
53
|
os: NameVersionPair<OS>;
|
|
53
54
|
engine: NameVersionPair<Engines>;
|
|
54
55
|
browser: NameVersionPair<Browsers>;
|
|
55
56
|
device: Devices;
|
|
56
57
|
crossPlatformFramework: CrossPlatformFramework;
|
|
57
|
-
|
|
58
|
-
dimension: Dimension;
|
|
58
|
+
locale: Locale;
|
|
59
59
|
renderer: string;
|
|
60
60
|
userAgent: string;
|
|
61
61
|
readyState: 'loading' | 'complete';
|
|
62
62
|
isNode: boolean;
|
|
63
63
|
isStandalone: boolean;
|
|
64
|
-
isMobile: boolean;
|
|
65
|
-
isDesktop: boolean;
|
|
66
64
|
isWebview: boolean;
|
|
67
65
|
onready(callback: (platform: PlatformInstance) => void): void;
|
|
68
66
|
}
|
|
@@ -70,20 +68,11 @@ declare interface NameVersionPair<T> {
|
|
|
70
68
|
name: T;
|
|
71
69
|
version: string;
|
|
72
70
|
}
|
|
73
|
-
declare interface
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
rtt: number | null;
|
|
79
|
-
saveData: boolean | null;
|
|
80
|
-
}
|
|
81
|
-
declare interface Dimension {
|
|
82
|
-
outerWidth: number;
|
|
83
|
-
outerHeight: number;
|
|
84
|
-
innerWidth: number;
|
|
85
|
-
innerHeight: number;
|
|
86
|
-
scale: number;
|
|
71
|
+
declare interface Locale {
|
|
72
|
+
language: string | null;
|
|
73
|
+
languages: string[];
|
|
74
|
+
timezone: string | null;
|
|
75
|
+
timezoneOffset: number;
|
|
87
76
|
}
|
|
88
77
|
|
|
89
78
|
declare module 'native-fn' {
|
|
@@ -105,4 +94,4 @@ declare const NativePlatformPlugin: NativePlugin<'Platform', PlatformInstance, {
|
|
|
105
94
|
}, {}>;
|
|
106
95
|
|
|
107
96
|
export { NativePlatformPlugin as default };
|
|
108
|
-
export type {
|
|
97
|
+
export type { Locale, NameVersionPair, PlatformInstance, VersionResolver };
|