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.
Files changed (42) hide show
  1. package/dist/index.d.ts +2 -1
  2. package/dist/native.cjs +1 -1
  3. package/dist/native.min.cjs +1 -1
  4. package/dist/native.min.mjs +1 -1
  5. package/dist/native.mjs +1 -1
  6. package/dist/native.umd.js +1 -1
  7. package/dist/native.umd.min.js +1 -1
  8. package/dist/plugin/appearance/src/plugin/open/types/open.d.ts +2 -1
  9. package/dist/plugin/appearance/src/plugin/permission/index.d.ts +1 -0
  10. package/dist/plugin/badge/src/plugin/open/types/open.d.ts +2 -1
  11. package/dist/plugin/badge/src/plugin/permission/index.d.ts +1 -0
  12. package/dist/plugin/battery/src/plugin/open/types/open.d.ts +2 -1
  13. package/dist/plugin/battery/src/plugin/permission/index.d.ts +1 -0
  14. package/dist/plugin/clipboard/src/plugin/open/types/open.d.ts +2 -1
  15. package/dist/plugin/clipboard/src/plugin/permission/index.d.ts +1 -0
  16. package/dist/plugin/dimension/src/plugin/open/types/open.d.ts +2 -1
  17. package/dist/plugin/dimension/src/plugin/permission/index.d.ts +1 -0
  18. package/dist/plugin/fullscreen/src/plugin/open/types/open.d.ts +2 -1
  19. package/dist/plugin/fullscreen/src/plugin/permission/index.d.ts +1 -0
  20. package/dist/plugin/geolocation/src/plugin/open/types/open.d.ts +2 -1
  21. package/dist/plugin/geolocation/src/plugin/permission/index.d.ts +1 -0
  22. package/dist/plugin/notification/src/plugin/open/types/open.d.ts +2 -1
  23. package/dist/plugin/notification/src/plugin/permission/index.d.ts +1 -0
  24. package/dist/plugin/open/index.d.ts +3 -2
  25. package/dist/plugin/open/src/plugin/open/types/open.d.ts +2 -1
  26. package/dist/plugin/open/src/plugin/permission/index.d.ts +1 -0
  27. package/dist/plugin/permission/index.cjs +31 -28
  28. package/dist/plugin/permission/index.d.ts +2 -1
  29. package/dist/plugin/permission/index.mjs +1 -1
  30. package/dist/plugin/permission/src/plugin/open/types/open.d.ts +2 -1
  31. package/dist/plugin/permission/src/plugin/permission/index.d.ts +1 -0
  32. package/dist/plugin/pip/src/plugin/open/types/open.d.ts +2 -1
  33. package/dist/plugin/pip/src/plugin/permission/index.d.ts +1 -0
  34. package/dist/plugin/platform/src/plugin/open/types/open.d.ts +2 -1
  35. package/dist/plugin/platform/src/plugin/permission/index.d.ts +1 -0
  36. package/dist/plugin/theme/src/plugin/open/types/open.d.ts +2 -1
  37. package/dist/plugin/theme/src/plugin/permission/index.d.ts +1 -0
  38. package/dist/plugin/vibration/src/plugin/open/types/open.d.ts +2 -1
  39. package/dist/plugin/vibration/src/plugin/permission/index.d.ts +1 -0
  40. package/dist/src/plugin/open/types/open.d.ts +2 -1
  41. package/dist/src/plugin/permission/index.d.ts +1 -0
  42. package/package.json +1 -1
@@ -1,20 +1,22 @@
1
1
  'use strict';
2
2
 
3
- var PermissionType;
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
- var PermissionState;
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
- module.exports = Permission;
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 };
@@ -126,4 +126,4 @@ function check(type) {
126
126
  });
127
127
  }
128
128
 
129
- export { Permission as default };
129
+ export { GET_USER_MEDIA, PermissionState, PermissionType, Permission as default };
@@ -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?: (FileExtension | FileMimeType)[];
64
+ accept?: FileAccept;
64
65
  id?: string;
65
66
  startIn?: ExplorerStartIn;
66
67
  }
@@ -1,3 +1,4 @@
1
1
  import Permission from "./cores";
2
2
  export * from "./types";
3
+ export * from "./constants";
3
4
  export default Permission;
@@ -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?: (FileExtension | FileMimeType)[];
64
+ accept?: FileAccept;
64
65
  id?: string;
65
66
  startIn?: ExplorerStartIn;
66
67
  }
@@ -1,3 +1,4 @@
1
1
  import Permission from "./cores";
2
2
  export * from "./types";
3
+ export * from "./constants";
3
4
  export default Permission;
@@ -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?: (FileExtension | FileMimeType)[];
64
+ accept?: FileAccept;
64
65
  id?: string;
65
66
  startIn?: ExplorerStartIn;
66
67
  }
@@ -1,3 +1,4 @@
1
1
  import Permission from "./cores";
2
2
  export * from "./types";
3
+ export * from "./constants";
3
4
  export default Permission;
@@ -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?: (FileExtension | FileMimeType)[];
64
+ accept?: FileAccept;
64
65
  id?: string;
65
66
  startIn?: ExplorerStartIn;
66
67
  }
@@ -1,3 +1,4 @@
1
1
  import Permission from "./cores";
2
2
  export * from "./types";
3
+ export * from "./constants";
3
4
  export default Permission;
@@ -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?: (FileExtension | FileMimeType)[];
64
+ accept?: FileAccept;
64
65
  id?: string;
65
66
  startIn?: ExplorerStartIn;
66
67
  }
@@ -1,3 +1,4 @@
1
1
  import Permission from "./cores";
2
2
  export * from "./types";
3
+ export * from "./constants";
3
4
  export default Permission;
@@ -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?: (FileExtension | FileMimeType)[];
64
+ accept?: FileAccept;
64
65
  id?: string;
65
66
  startIn?: ExplorerStartIn;
66
67
  }
@@ -1,3 +1,4 @@
1
1
  import Permission from "./cores";
2
2
  export * from "./types";
3
+ export * from "./constants";
3
4
  export default Permission;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "native-fn",
3
- "version": "1.1.4",
3
+ "version": "1.1.5",
4
4
  "description": " ",
5
5
  "type": "module",
6
6