native-fn 1.1.4 → 1.1.5
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 +2 -1
- package/dist/native.cjs +1 -1
- package/dist/native.min.cjs +1 -1
- package/dist/native.min.mjs +1 -1
- package/dist/native.mjs +1 -1
- package/dist/native.umd.js +1 -1
- package/dist/native.umd.min.js +1 -1
- package/dist/plugin/appearance/src/plugin/open/types/open.d.ts +2 -1
- package/dist/plugin/appearance/src/plugin/permission/index.d.ts +1 -0
- package/dist/plugin/badge/src/plugin/open/types/open.d.ts +2 -1
- package/dist/plugin/badge/src/plugin/permission/index.d.ts +1 -0
- package/dist/plugin/battery/src/plugin/open/types/open.d.ts +2 -1
- package/dist/plugin/battery/src/plugin/permission/index.d.ts +1 -0
- package/dist/plugin/clipboard/src/plugin/open/types/open.d.ts +2 -1
- package/dist/plugin/clipboard/src/plugin/permission/index.d.ts +1 -0
- package/dist/plugin/dimension/src/plugin/open/types/open.d.ts +2 -1
- package/dist/plugin/dimension/src/plugin/permission/index.d.ts +1 -0
- package/dist/plugin/fullscreen/src/plugin/open/types/open.d.ts +2 -1
- package/dist/plugin/fullscreen/src/plugin/permission/index.d.ts +1 -0
- package/dist/plugin/geolocation/src/plugin/open/types/open.d.ts +2 -1
- package/dist/plugin/geolocation/src/plugin/permission/index.d.ts +1 -0
- package/dist/plugin/notification/src/plugin/open/types/open.d.ts +2 -1
- package/dist/plugin/notification/src/plugin/permission/index.d.ts +1 -0
- package/dist/plugin/open/index.d.ts +3 -2
- package/dist/plugin/open/src/plugin/open/types/open.d.ts +2 -1
- package/dist/plugin/open/src/plugin/permission/index.d.ts +1 -0
- package/dist/plugin/permission/index.cjs +31 -28
- package/dist/plugin/permission/index.d.ts +2 -1
- package/dist/plugin/permission/index.mjs +1 -1
- package/dist/plugin/permission/src/plugin/open/types/open.d.ts +2 -1
- package/dist/plugin/permission/src/plugin/permission/index.d.ts +1 -0
- package/dist/plugin/pip/src/plugin/open/types/open.d.ts +2 -1
- package/dist/plugin/pip/src/plugin/permission/index.d.ts +1 -0
- package/dist/plugin/platform/src/plugin/open/types/open.d.ts +2 -1
- package/dist/plugin/platform/src/plugin/permission/index.d.ts +1 -0
- package/dist/plugin/theme/src/plugin/open/types/open.d.ts +2 -1
- package/dist/plugin/theme/src/plugin/permission/index.d.ts +1 -0
- package/dist/plugin/vibration/src/plugin/open/types/open.d.ts +2 -1
- package/dist/plugin/vibration/src/plugin/permission/index.d.ts +1 -0
- package/dist/src/plugin/open/types/open.d.ts +2 -1
- package/dist/src/plugin/permission/index.d.ts +1 -0
- package/package.json +1 -1
|
@@ -1,20 +1,22 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
+
|
|
5
|
+
exports.PermissionType = void 0;
|
|
4
6
|
(function (PermissionType) {
|
|
5
7
|
PermissionType["Notification"] = "notifications";
|
|
6
8
|
PermissionType["Geolocation"] = "geolocation";
|
|
7
9
|
PermissionType["Camera"] = "camera";
|
|
8
10
|
PermissionType["Microphone"] = "microphone";
|
|
9
11
|
PermissionType["MIDI"] = "midi";
|
|
10
|
-
})(PermissionType || (PermissionType = {}));
|
|
11
|
-
|
|
12
|
+
})(exports.PermissionType || (exports.PermissionType = {}));
|
|
13
|
+
exports.PermissionState = void 0;
|
|
12
14
|
(function (PermissionState) {
|
|
13
15
|
PermissionState["Grant"] = "grant";
|
|
14
16
|
PermissionState["Denied"] = "denied";
|
|
15
17
|
PermissionState["Prompt"] = "prompt";
|
|
16
18
|
PermissionState["Unsupported"] = "unsupported";
|
|
17
|
-
})(PermissionState || (PermissionState = {}));
|
|
19
|
+
})(exports.PermissionState || (exports.PermissionState = {}));
|
|
18
20
|
var GET_USER_MEDIA = (function () {
|
|
19
21
|
if (typeof globalThis.navigator.mediaDevices !== 'undefined' && typeof globalThis.navigator.mediaDevices.getUserMedia !== 'undefined')
|
|
20
22
|
return globalThis.navigator.mediaDevices.getUserMedia.bind(globalThis.navigator.mediaDevices);
|
|
@@ -42,8 +44,8 @@ var Permission = {
|
|
|
42
44
|
request: request,
|
|
43
45
|
check: check,
|
|
44
46
|
Constants: {
|
|
45
|
-
PermissionType: PermissionType,
|
|
46
|
-
PermissionState: PermissionState,
|
|
47
|
+
PermissionType: exports.PermissionType,
|
|
48
|
+
PermissionState: exports.PermissionState,
|
|
47
49
|
},
|
|
48
50
|
Errors: {},
|
|
49
51
|
};
|
|
@@ -55,37 +57,37 @@ function request(type) {
|
|
|
55
57
|
}
|
|
56
58
|
instance.check(type)
|
|
57
59
|
.then(function (state) {
|
|
58
|
-
if (state === PermissionState.Grant)
|
|
60
|
+
if (state === exports.PermissionState.Grant)
|
|
59
61
|
return resolve(state);
|
|
60
62
|
switch (type) {
|
|
61
|
-
case PermissionType.Notification:
|
|
63
|
+
case exports.PermissionType.Notification:
|
|
62
64
|
if (typeof globalThis.Notification === 'undefined')
|
|
63
|
-
return resolve(PermissionState.Unsupported);
|
|
65
|
+
return resolve(exports.PermissionState.Unsupported);
|
|
64
66
|
globalThis.Notification.requestPermission().then(function (value) {
|
|
65
67
|
switch (value) {
|
|
66
68
|
case 'default':
|
|
67
|
-
return resolve(PermissionState.Prompt);
|
|
69
|
+
return resolve(exports.PermissionState.Prompt);
|
|
68
70
|
case 'granted':
|
|
69
|
-
return resolve(PermissionState.Grant);
|
|
71
|
+
return resolve(exports.PermissionState.Grant);
|
|
70
72
|
case 'denied':
|
|
71
|
-
return resolve(PermissionState.Denied);
|
|
73
|
+
return resolve(exports.PermissionState.Denied);
|
|
72
74
|
default:
|
|
73
75
|
resolveAfterCheck();
|
|
74
76
|
}
|
|
75
77
|
});
|
|
76
78
|
break;
|
|
77
|
-
case PermissionType.Geolocation:
|
|
79
|
+
case exports.PermissionType.Geolocation:
|
|
78
80
|
if (typeof globalThis.navigator.geolocation === 'undefined')
|
|
79
|
-
return resolve(PermissionState.Unsupported);
|
|
81
|
+
return resolve(exports.PermissionState.Unsupported);
|
|
80
82
|
globalThis.navigator.geolocation.getCurrentPosition(resolveAfterCheck, resolveAfterCheck);
|
|
81
83
|
break;
|
|
82
|
-
case PermissionType.Microphone:
|
|
83
|
-
case PermissionType.Camera:
|
|
84
|
+
case exports.PermissionType.Microphone:
|
|
85
|
+
case exports.PermissionType.Camera:
|
|
84
86
|
if (typeof GET_USER_MEDIA === 'undefined')
|
|
85
|
-
return resolve(PermissionState.Unsupported);
|
|
87
|
+
return resolve(exports.PermissionState.Unsupported);
|
|
86
88
|
GET_USER_MEDIA({
|
|
87
|
-
video: type === PermissionType.Camera,
|
|
88
|
-
audio: type === PermissionType.Microphone,
|
|
89
|
+
video: type === exports.PermissionType.Camera,
|
|
90
|
+
audio: type === exports.PermissionType.Microphone,
|
|
89
91
|
})
|
|
90
92
|
.then(function (stream) {
|
|
91
93
|
var tracks = stream.getTracks();
|
|
@@ -95,15 +97,15 @@ function request(type) {
|
|
|
95
97
|
})
|
|
96
98
|
.catch(resolveAfterCheck);
|
|
97
99
|
break;
|
|
98
|
-
case PermissionType.MIDI:
|
|
100
|
+
case exports.PermissionType.MIDI:
|
|
99
101
|
if (typeof globalThis.navigator.requestMIDIAccess === 'undefined')
|
|
100
|
-
return resolve(PermissionState.Unsupported);
|
|
102
|
+
return resolve(exports.PermissionState.Unsupported);
|
|
101
103
|
globalThis.navigator.requestMIDIAccess()
|
|
102
104
|
.then(resolveAfterCheck)
|
|
103
105
|
.catch(resolveAfterCheck);
|
|
104
106
|
break;
|
|
105
107
|
default:
|
|
106
|
-
return resolve(PermissionState.Unsupported);
|
|
108
|
+
return resolve(exports.PermissionState.Unsupported);
|
|
107
109
|
}
|
|
108
110
|
});
|
|
109
111
|
});
|
|
@@ -111,21 +113,22 @@ function request(type) {
|
|
|
111
113
|
function check(type) {
|
|
112
114
|
return new Promise(function (resolve) {
|
|
113
115
|
if (typeof globalThis.navigator.permissions === 'undefined')
|
|
114
|
-
return resolve(PermissionState.Unsupported);
|
|
116
|
+
return resolve(exports.PermissionState.Unsupported);
|
|
115
117
|
globalThis.navigator.permissions.query({ name: type })
|
|
116
118
|
.then(function (status) {
|
|
117
119
|
switch (status.state) {
|
|
118
120
|
case 'prompt':
|
|
119
|
-
return resolve(PermissionState.Prompt);
|
|
121
|
+
return resolve(exports.PermissionState.Prompt);
|
|
120
122
|
case 'granted':
|
|
121
|
-
return resolve(PermissionState.Grant);
|
|
123
|
+
return resolve(exports.PermissionState.Grant);
|
|
122
124
|
case 'denied':
|
|
123
|
-
return resolve(PermissionState.Denied);
|
|
125
|
+
return resolve(exports.PermissionState.Denied);
|
|
124
126
|
default:
|
|
125
|
-
return resolve(PermissionState.Unsupported);
|
|
127
|
+
return resolve(exports.PermissionState.Unsupported);
|
|
126
128
|
}
|
|
127
129
|
});
|
|
128
130
|
});
|
|
129
131
|
}
|
|
130
132
|
|
|
131
|
-
|
|
133
|
+
exports.GET_USER_MEDIA = GET_USER_MEDIA;
|
|
134
|
+
exports.default = Permission;
|
|
@@ -19,6 +19,7 @@ declare enum PermissionState {
|
|
|
19
19
|
Prompt = "prompt",
|
|
20
20
|
Unsupported = "unsupported"
|
|
21
21
|
}
|
|
22
|
+
declare const GET_USER_MEDIA: ((constraints?: MediaStreamConstraints) => Promise<MediaStream>) | undefined;
|
|
22
23
|
|
|
23
24
|
declare interface PermissionInstance {
|
|
24
25
|
request(type: PermissionType): Promise<PermissionState>;
|
|
@@ -32,5 +33,5 @@ declare interface PermissionInstance {
|
|
|
32
33
|
|
|
33
34
|
declare const Permission: PermissionInstance;
|
|
34
35
|
|
|
35
|
-
export { Permission as default };
|
|
36
|
+
export { GET_USER_MEDIA, PermissionState, PermissionType, Permission as default };
|
|
36
37
|
export type { PermissionInstance };
|
|
@@ -58,9 +58,10 @@ export interface ContactOptions {
|
|
|
58
58
|
}
|
|
59
59
|
export type FileExtension = `.${string}`;
|
|
60
60
|
export type FileMimeType = `${string}/${string}`;
|
|
61
|
+
export type FileAccept = (FileExtension | FileMimeType)[];
|
|
61
62
|
export interface FileOptions {
|
|
62
63
|
multiple?: boolean;
|
|
63
|
-
accept?:
|
|
64
|
+
accept?: FileAccept;
|
|
64
65
|
id?: string;
|
|
65
66
|
startIn?: ExplorerStartIn;
|
|
66
67
|
}
|
|
@@ -58,9 +58,10 @@ export interface ContactOptions {
|
|
|
58
58
|
}
|
|
59
59
|
export type FileExtension = `.${string}`;
|
|
60
60
|
export type FileMimeType = `${string}/${string}`;
|
|
61
|
+
export type FileAccept = (FileExtension | FileMimeType)[];
|
|
61
62
|
export interface FileOptions {
|
|
62
63
|
multiple?: boolean;
|
|
63
|
-
accept?:
|
|
64
|
+
accept?: FileAccept;
|
|
64
65
|
id?: string;
|
|
65
66
|
startIn?: ExplorerStartIn;
|
|
66
67
|
}
|
|
@@ -58,9 +58,10 @@ export interface ContactOptions {
|
|
|
58
58
|
}
|
|
59
59
|
export type FileExtension = `.${string}`;
|
|
60
60
|
export type FileMimeType = `${string}/${string}`;
|
|
61
|
+
export type FileAccept = (FileExtension | FileMimeType)[];
|
|
61
62
|
export interface FileOptions {
|
|
62
63
|
multiple?: boolean;
|
|
63
|
-
accept?:
|
|
64
|
+
accept?: FileAccept;
|
|
64
65
|
id?: string;
|
|
65
66
|
startIn?: ExplorerStartIn;
|
|
66
67
|
}
|
|
@@ -58,9 +58,10 @@ export interface ContactOptions {
|
|
|
58
58
|
}
|
|
59
59
|
export type FileExtension = `.${string}`;
|
|
60
60
|
export type FileMimeType = `${string}/${string}`;
|
|
61
|
+
export type FileAccept = (FileExtension | FileMimeType)[];
|
|
61
62
|
export interface FileOptions {
|
|
62
63
|
multiple?: boolean;
|
|
63
|
-
accept?:
|
|
64
|
+
accept?: FileAccept;
|
|
64
65
|
id?: string;
|
|
65
66
|
startIn?: ExplorerStartIn;
|
|
66
67
|
}
|
|
@@ -58,9 +58,10 @@ export interface ContactOptions {
|
|
|
58
58
|
}
|
|
59
59
|
export type FileExtension = `.${string}`;
|
|
60
60
|
export type FileMimeType = `${string}/${string}`;
|
|
61
|
+
export type FileAccept = (FileExtension | FileMimeType)[];
|
|
61
62
|
export interface FileOptions {
|
|
62
63
|
multiple?: boolean;
|
|
63
|
-
accept?:
|
|
64
|
+
accept?: FileAccept;
|
|
64
65
|
id?: string;
|
|
65
66
|
startIn?: ExplorerStartIn;
|
|
66
67
|
}
|
|
@@ -58,9 +58,10 @@ export interface ContactOptions {
|
|
|
58
58
|
}
|
|
59
59
|
export type FileExtension = `.${string}`;
|
|
60
60
|
export type FileMimeType = `${string}/${string}`;
|
|
61
|
+
export type FileAccept = (FileExtension | FileMimeType)[];
|
|
61
62
|
export interface FileOptions {
|
|
62
63
|
multiple?: boolean;
|
|
63
|
-
accept?:
|
|
64
|
+
accept?: FileAccept;
|
|
64
65
|
id?: string;
|
|
65
66
|
startIn?: ExplorerStartIn;
|
|
66
67
|
}
|