native-fn 1.0.90 → 1.1.0
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 +751 -4
- package/dist/native.cjs +3509 -1995
- package/dist/native.min.cjs +1 -1
- package/dist/native.min.mjs +1 -1
- package/dist/native.mjs +3509 -1995
- package/dist/native.umd.js +3509 -1995
- package/dist/native.umd.min.js +1 -1
- package/dist/src/constants/index.d.ts +1 -0
- package/dist/src/errors/not-supported-error.d.ts +2 -0
- package/dist/src/errors/permission-not-granted-error.d.ts +2 -0
- package/dist/src/plugin/app/constants/index.d.ts +8 -0
- package/dist/src/plugin/app/cores/index.d.ts +0 -1
- package/dist/src/plugin/app/types/app.d.ts +53 -5
- package/dist/src/plugin/appearance/constants/index.d.ts +1 -4
- package/dist/src/plugin/appearance/cores/index.d.ts +2 -2
- package/dist/src/plugin/appearance/types/appearance.d.ts +2 -2
- package/dist/src/plugin/appearance/types/appearanceInstance.d.ts +9 -0
- package/dist/src/plugin/badge/cores/index.d.ts +3 -0
- package/dist/src/plugin/badge/index.d.ts +3 -0
- package/dist/src/plugin/badge/types/badge.d.ts +10 -0
- package/dist/src/plugin/badge/types/index.d.ts +1 -0
- package/dist/src/plugin/battery/cores/index.d.ts +3 -0
- package/dist/src/plugin/battery/index.d.ts +3 -0
- package/dist/src/plugin/battery/types/battery.d.ts +26 -0
- package/dist/src/plugin/battery/types/index.d.ts +1 -0
- package/dist/src/plugin/clipboard/cores/index.d.ts +2 -2
- package/dist/src/plugin/clipboard/types/clipboard.d.ts +1 -1
- package/dist/src/plugin/dimension/constants/index.d.ts +42 -2
- package/dist/src/plugin/dimension/cores/index.d.ts +2 -2
- package/dist/src/plugin/dimension/types/dimensions.d.ts +24 -3
- package/dist/src/plugin/dimension/utils/create-env-observer.d.ts +24 -0
- package/dist/src/plugin/fullscreen/cores/index.d.ts +4 -2
- package/dist/src/plugin/fullscreen/types/fullscreen.d.ts +8 -5
- package/dist/src/plugin/geolocation/constants/index.d.ts +2 -0
- package/dist/src/plugin/geolocation/cores/index.d.ts +3 -0
- package/dist/src/plugin/geolocation/index.d.ts +3 -0
- package/dist/src/plugin/geolocation/types/geolocation.d.ts +12 -0
- package/dist/src/plugin/geolocation/types/index.d.ts +1 -0
- package/dist/src/plugin/notification/cores/index.d.ts +3 -0
- package/dist/src/plugin/notification/index.d.ts +3 -0
- package/dist/src/plugin/notification/types/index.d.ts +1 -0
- package/dist/src/plugin/notification/types/notification.d.ts +27 -0
- package/dist/src/plugin/open/constants/index.d.ts +28 -0
- package/dist/src/plugin/open/cores/index.d.ts +55 -0
- package/dist/src/plugin/open/errors/not-supported-error.d.ts +2 -0
- package/dist/src/plugin/open/errors/url-open-error.d.ts +2 -0
- package/dist/src/plugin/open/errors/user-cancel-error.d.ts +2 -0
- package/dist/src/plugin/open/index.d.ts +3 -0
- package/dist/src/plugin/open/types/index.d.ts +1 -0
- package/dist/src/plugin/open/types/open.d.ts +187 -0
- package/dist/src/plugin/permission/constants/index.d.ts +22 -0
- package/dist/src/plugin/permission/cores/index.d.ts +3 -0
- package/dist/src/plugin/permission/index.d.ts +3 -0
- package/dist/src/plugin/permission/types/index.d.ts +1 -0
- package/dist/src/plugin/permission/types/permission.d.ts +10 -0
- package/dist/src/plugin/pip/cores/index.d.ts +12 -0
- package/dist/src/plugin/pip/index.d.ts +3 -0
- package/dist/src/plugin/pip/types/index.d.ts +1 -0
- package/dist/src/plugin/pip/types/pip.d.ts +15 -0
- package/dist/src/plugin/platform/constants/index.d.ts +0 -1
- package/dist/src/plugin/platform/cores/index.d.ts +15 -2
- package/dist/src/plugin/platform/types/platform.d.ts +12 -3
- package/dist/src/plugin/pwa/cores/index.d.ts +3 -0
- package/dist/src/plugin/pwa/index.d.ts +3 -0
- package/dist/src/plugin/pwa/types/index.d.ts +1 -0
- package/dist/src/plugin/pwa/types/pwa.d.ts +8 -0
- package/dist/src/plugin/speech/cores/index.d.ts +53 -0
- package/dist/src/plugin/speech/index.d.ts +3 -0
- package/dist/src/plugin/speech/types/index.d.ts +1 -0
- package/dist/src/plugin/speech/types/speech.d.ts +9 -0
- package/dist/src/plugin/theme/cores/index.d.ts +2 -2
- package/dist/src/plugin/theme/types/theme.d.ts +1 -1
- package/dist/src/plugin/vibration/cores/index.d.ts +3 -0
- package/dist/src/plugin/vibration/index.d.ts +3 -0
- package/dist/src/plugin/vibration/types/index.d.ts +1 -0
- package/dist/src/plugin/vibration/types/vibration.d.ts +9 -0
- package/dist/src/types/event-listener.d.ts +35 -0
- package/dist/src/types/index.d.ts +3 -0
- package/dist/src/types/listener-entry.d.ts +0 -1
- package/dist/src/types/native.d.ts +30 -16
- package/dist/src/types/subscription-manager.d.ts +4 -0
- package/dist/src/utils/create-env-observer.d.ts +8 -0
- package/dist/src/utils/create-hidden-element.d.ts +1 -1
- package/dist/src/utils/create-subscription-manager.d.ts +2 -0
- package/dist/src/utils/defer.d.ts +1 -0
- package/dist/src/utils/event-listener.d.ts +3 -0
- package/dist/src/utils/keys.d.ts +1 -0
- package/dist/src/utils/now.d.ts +1 -0
- package/dist/src/utils/pad-start.d.ts +1 -0
- package/dist/src/utils/random-string.d.ts +1 -0
- package/dist/src/utils/set-style.d.ts +3 -0
- package/package.json +1 -1
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import {
|
|
2
|
-
declare const Dimension:
|
|
1
|
+
import { DimensionInstance } from "../types";
|
|
2
|
+
declare const Dimension: DimensionInstance;
|
|
3
3
|
export default Dimension;
|
|
@@ -1,7 +1,16 @@
|
|
|
1
|
-
|
|
1
|
+
import { ENV_PRESETS, Orientation } from "../constants";
|
|
2
|
+
export type EnvironmentPresetKey = keyof typeof ENV_PRESETS;
|
|
3
|
+
export type EnvironmentPresetAttr<K extends EnvironmentPresetKey> = keyof typeof ENV_PRESETS[K];
|
|
4
|
+
export type EnvironmentPresetValues<K extends EnvironmentPresetKey> = {
|
|
5
|
+
[P in EnvironmentPresetAttr<K>]: number;
|
|
6
|
+
};
|
|
7
|
+
export declare interface DimensionInstance {
|
|
2
8
|
get value(): Dimensions;
|
|
3
|
-
|
|
4
|
-
|
|
9
|
+
environment: Environment;
|
|
10
|
+
onChange(listener: (dimension: Dimensions) => void, options?: AddEventListenerOptions): () => void;
|
|
11
|
+
Constants: {
|
|
12
|
+
Orientation: typeof Orientation;
|
|
13
|
+
};
|
|
5
14
|
Errors: {};
|
|
6
15
|
}
|
|
7
16
|
export declare interface Dimensions {
|
|
@@ -10,4 +19,16 @@ export declare interface Dimensions {
|
|
|
10
19
|
innerWidth: number;
|
|
11
20
|
innerHeight: number;
|
|
12
21
|
scale: number;
|
|
22
|
+
orientation: Orientation;
|
|
23
|
+
}
|
|
24
|
+
export declare interface EnvironmentPreset<K extends EnvironmentPresetKey> {
|
|
25
|
+
get value(): EnvironmentPresetValues<K>;
|
|
26
|
+
onChange(listener: (value: EnvironmentPresetValues<K>) => void, options?: AddEventListenerOptions): () => void;
|
|
27
|
+
}
|
|
28
|
+
export declare interface Environment {
|
|
29
|
+
safeAreaInset: EnvironmentPreset<'safe-area-inset'>;
|
|
30
|
+
safeAreaMaxInset: EnvironmentPreset<'safe-area-max-inset'>;
|
|
31
|
+
keyboardInset: EnvironmentPreset<'keyboard-inset'>;
|
|
32
|
+
titlebarArea: EnvironmentPreset<'titlebar-area'>;
|
|
33
|
+
viewportSegment: EnvironmentPreset<'viewport-segment'>;
|
|
13
34
|
}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { EnvironmentPresetKey, EnvironmentPresetValues } from "../types";
|
|
2
|
+
declare global {
|
|
3
|
+
interface Navigator {
|
|
4
|
+
readonly virtualKeyboard?: VirtualKeyboard;
|
|
5
|
+
}
|
|
6
|
+
}
|
|
7
|
+
type ChangeCallback<K extends EnvironmentPresetKey> = (values: EnvironmentPresetValues<K>) => void;
|
|
8
|
+
interface VirtualKeyboardEventMap {
|
|
9
|
+
geometrychange: Event;
|
|
10
|
+
}
|
|
11
|
+
interface VirtualKeyboard extends EventTarget {
|
|
12
|
+
readonly boundingRect: DOMRect;
|
|
13
|
+
overlaysContent: boolean;
|
|
14
|
+
show(): void;
|
|
15
|
+
hide(): void;
|
|
16
|
+
addEventListener<K extends keyof VirtualKeyboardEventMap>(type: K, listener: (this: VirtualKeyboard, ev: VirtualKeyboardEventMap[K]) => any, options?: AddEventListenerOptions): void;
|
|
17
|
+
removeEventListener<K extends keyof VirtualKeyboardEventMap>(type: K, listener: (this: VirtualKeyboard, ev: VirtualKeyboardEventMap[K]) => any, options?: boolean | EventListenerOptions): void;
|
|
18
|
+
}
|
|
19
|
+
export type EnvObserver<K extends EnvironmentPresetKey> = {
|
|
20
|
+
get(): EnvironmentPresetValues<K>;
|
|
21
|
+
onChange(callback: ChangeCallback<K>, options?: AddEventListenerOptions): () => void;
|
|
22
|
+
};
|
|
23
|
+
export default function createEnvObserver<K extends EnvironmentPresetKey>(preset: K): EnvObserver<K>;
|
|
24
|
+
export {};
|
|
@@ -1,11 +1,12 @@
|
|
|
1
|
-
import {
|
|
2
|
-
declare const Fullscreen: Fullscreen;
|
|
1
|
+
import { FullscreenInstance } from "../types";
|
|
3
2
|
declare global {
|
|
4
3
|
interface HTMLVideoElement {
|
|
5
4
|
webkitEnterFullscreen?: () => void;
|
|
6
5
|
webkitExitFullscreen?: () => void;
|
|
7
6
|
webkitSupportsFullscreen?: boolean;
|
|
8
7
|
webkitDisplayingFullscreen?: boolean;
|
|
8
|
+
onwebkitbeginfullscreen?: ((this: HTMLVideoElement, ev: Event) => any) | null;
|
|
9
|
+
onwebkitendfullscreen?: ((this: HTMLVideoElement, ev: Event) => any) | null;
|
|
9
10
|
__fsBridged__?: boolean;
|
|
10
11
|
}
|
|
11
12
|
interface Document {
|
|
@@ -32,4 +33,5 @@ declare global {
|
|
|
32
33
|
msRequestFullscreen?: () => Promise<void>;
|
|
33
34
|
}
|
|
34
35
|
}
|
|
36
|
+
declare const Fullscreen: FullscreenInstance;
|
|
35
37
|
export default Fullscreen;
|
|
@@ -1,12 +1,15 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
import { NotSupportedError } from "../../../errors/not-supported-error";
|
|
2
|
+
export declare interface FullscreenInstance {
|
|
3
|
+
supported: boolean;
|
|
3
4
|
element: Element | null;
|
|
4
5
|
isFullscreen: boolean;
|
|
5
6
|
request(target?: Element, options?: FullscreenOptions): Promise<void>;
|
|
6
7
|
exit(): Promise<void>;
|
|
7
8
|
toggle(target?: Element, options?: FullscreenOptions): Promise<void>;
|
|
8
|
-
|
|
9
|
-
|
|
9
|
+
onChange(listener: (event: Event) => void, options?: AddEventListenerOptions): () => void;
|
|
10
|
+
onError(listener: (event: Event) => void, options?: AddEventListenerOptions): () => void;
|
|
10
11
|
Constants: {};
|
|
11
|
-
Errors: {
|
|
12
|
+
Errors: {
|
|
13
|
+
NotSupportedError: typeof NotSupportedError;
|
|
14
|
+
};
|
|
12
15
|
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { NotSupportedError } from "../../../errors/not-supported-error";
|
|
2
|
+
import { PermissionNotGrantedError } from "../../../errors/permission-not-granted-error";
|
|
3
|
+
export declare interface GeolocationInstance {
|
|
4
|
+
get value(): Promise<GeolocationCoordinates>;
|
|
5
|
+
get supported(): boolean;
|
|
6
|
+
onChange(listener: (coordinates: GeolocationCoordinates) => void, options?: AddEventListenerOptions): () => void;
|
|
7
|
+
Constants: {};
|
|
8
|
+
Errors: {
|
|
9
|
+
NotSupportedError: typeof NotSupportedError;
|
|
10
|
+
PermissionNotGrantedError: typeof PermissionNotGrantedError;
|
|
11
|
+
};
|
|
12
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./geolocation";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./notification";
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { NotSupportedError } from "../../../errors/not-supported-error";
|
|
2
|
+
import { PermissionNotGrantedError } from "../../../errors/permission-not-granted-error";
|
|
3
|
+
export interface NotificationOptions {
|
|
4
|
+
title: string;
|
|
5
|
+
badge?: string;
|
|
6
|
+
body?: string;
|
|
7
|
+
data?: any;
|
|
8
|
+
dir?: NotificationDirection;
|
|
9
|
+
icon?: string;
|
|
10
|
+
lang?: string;
|
|
11
|
+
requireInteraction?: boolean;
|
|
12
|
+
silent?: boolean | null;
|
|
13
|
+
tag?: string;
|
|
14
|
+
onClick?: ((this: Notification, ev: Event) => any);
|
|
15
|
+
onClose?: ((this: Notification, ev: Event) => any);
|
|
16
|
+
onError?: ((this: Notification, ev: Event) => any);
|
|
17
|
+
onShow?: ((this: Notification, ev: Event) => any);
|
|
18
|
+
}
|
|
19
|
+
export declare interface NotificationInstance {
|
|
20
|
+
send(options: NotificationOptions): Promise<Notification>;
|
|
21
|
+
get supported(): boolean;
|
|
22
|
+
Constants: {};
|
|
23
|
+
Errors: {
|
|
24
|
+
NotSupportedError: typeof NotSupportedError;
|
|
25
|
+
PermissionNotGrantedError: typeof PermissionNotGrantedError;
|
|
26
|
+
};
|
|
27
|
+
}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
export declare enum AppOpenState {
|
|
2
|
+
Scheme = 0,
|
|
3
|
+
Universal = 1,
|
|
4
|
+
Intent = 2,
|
|
5
|
+
Fallback = 3,
|
|
6
|
+
Store = 4
|
|
7
|
+
}
|
|
8
|
+
export declare enum SettingType {
|
|
9
|
+
General = "general",
|
|
10
|
+
Network = "network",
|
|
11
|
+
Display = "display",
|
|
12
|
+
Appearance = "appearance",
|
|
13
|
+
Accessibility = "accessibility",
|
|
14
|
+
Battery = "battery",
|
|
15
|
+
Datetime = "datetime",
|
|
16
|
+
Language = "language",
|
|
17
|
+
Accounts = "accounts",
|
|
18
|
+
Storage = "storage"
|
|
19
|
+
}
|
|
20
|
+
export declare enum CameraType {
|
|
21
|
+
Image = "image",
|
|
22
|
+
Video = "video"
|
|
23
|
+
}
|
|
24
|
+
export declare enum CaptureType {
|
|
25
|
+
User = "user",
|
|
26
|
+
Environment = "environment"
|
|
27
|
+
}
|
|
28
|
+
export declare const SETTING_URL: Record<'Android' | 'Windows' | 'MacOS' | 'MacOS13+', Record<SettingType, string>>;
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import { Contact, OpenInstance } from "../types";
|
|
2
|
+
declare global {
|
|
3
|
+
interface Document {
|
|
4
|
+
webkitVisibilityState?: 'hidden' | 'visible';
|
|
5
|
+
mozVisibilityState?: 'hidden' | 'visible';
|
|
6
|
+
msVisibilityState?: 'hidden' | 'visible';
|
|
7
|
+
webkitHidden?: boolean;
|
|
8
|
+
mozHidden?: boolean;
|
|
9
|
+
msHidden?: boolean;
|
|
10
|
+
}
|
|
11
|
+
interface Navigator {
|
|
12
|
+
contacts?: ContactsManager;
|
|
13
|
+
}
|
|
14
|
+
interface FileSystemDirectoryHandle {
|
|
15
|
+
entries(): AsyncIterator<[string, FileSystemHandle]>;
|
|
16
|
+
}
|
|
17
|
+
var showOpenFilePicker: (options?: OpenFilePickerOptions) => Promise<FileSystemFileHandle[]>;
|
|
18
|
+
var showDirectoryPicker: (options?: OpenDirectoryPickerOptions) => Promise<FileSystemDirectoryHandle>;
|
|
19
|
+
var cordova: object | undefined;
|
|
20
|
+
}
|
|
21
|
+
interface AsyncIterator<T, TReturn = any, TNext = undefined> {
|
|
22
|
+
next(...args: [] | [TNext]): Promise<IteratorResult<T, TReturn>>;
|
|
23
|
+
return?(value?: TReturn | PromiseLike<TReturn>): Promise<IteratorResult<T, TReturn>>;
|
|
24
|
+
throw?(e?: any): Promise<IteratorResult<T, TReturn>>;
|
|
25
|
+
}
|
|
26
|
+
type IteratorResult<T, TReturn = any> = IteratorYieldResult<T> | IteratorReturnResult<TReturn>;
|
|
27
|
+
interface IteratorYieldResult<TYield> {
|
|
28
|
+
done?: false;
|
|
29
|
+
value: TYield;
|
|
30
|
+
}
|
|
31
|
+
interface IteratorReturnResult<TReturn> {
|
|
32
|
+
done: true;
|
|
33
|
+
value: TReturn;
|
|
34
|
+
}
|
|
35
|
+
interface OpenFilePickerOptions {
|
|
36
|
+
excludeAcceptAllOption?: boolean;
|
|
37
|
+
id?: string;
|
|
38
|
+
multiple?: boolean;
|
|
39
|
+
startIn?: 'desktop' | 'documents' | 'downloads' | 'music' | 'pictures' | 'videos';
|
|
40
|
+
types?: {
|
|
41
|
+
description?: string;
|
|
42
|
+
accept: Record<string, string[]>;
|
|
43
|
+
}[];
|
|
44
|
+
}
|
|
45
|
+
interface OpenDirectoryPickerOptions {
|
|
46
|
+
id?: string;
|
|
47
|
+
mode?: 'read' | 'readwrite';
|
|
48
|
+
startIn?: 'desktop' | 'documents' | 'downloads' | 'music' | 'pictures' | 'videos';
|
|
49
|
+
}
|
|
50
|
+
interface ContactsManager {
|
|
51
|
+
select(properties: string[], options?: Record<string, any>): Promise<Contact[]>;
|
|
52
|
+
getProperties(): Promise<string[]>;
|
|
53
|
+
}
|
|
54
|
+
declare const Open: OpenInstance;
|
|
55
|
+
export default Open;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./open";
|
|
@@ -0,0 +1,187 @@
|
|
|
1
|
+
import { AppOpenState, CameraType, CaptureType, SettingType } from "../constants";
|
|
2
|
+
import { OS } from "../../platform/constants";
|
|
3
|
+
import { URLOpenError } from "../errors/url-open-error";
|
|
4
|
+
import { UserCancelledError } from "../errors/user-cancel-error";
|
|
5
|
+
import { NotSupportedError } from "../../../errors/not-supported-error";
|
|
6
|
+
export declare interface AppInfo {
|
|
7
|
+
scheme?: URLCandidate;
|
|
8
|
+
fallback?: URLCandidateOrFallback;
|
|
9
|
+
timeout?: number;
|
|
10
|
+
allowAppStore?: boolean;
|
|
11
|
+
allowWebStore?: boolean;
|
|
12
|
+
}
|
|
13
|
+
export declare interface PackageName {
|
|
14
|
+
packageName?: string;
|
|
15
|
+
}
|
|
16
|
+
export declare interface ProductId {
|
|
17
|
+
productId?: string;
|
|
18
|
+
}
|
|
19
|
+
export declare interface BundleId {
|
|
20
|
+
bundleId?: string;
|
|
21
|
+
}
|
|
22
|
+
export declare interface TrackId {
|
|
23
|
+
trackId?: string;
|
|
24
|
+
}
|
|
25
|
+
export declare interface AndroidAppInfo extends AppInfo, PackageName {
|
|
26
|
+
intent?: URLCandidate;
|
|
27
|
+
}
|
|
28
|
+
export declare interface IOSAppInfo extends AppInfo, BundleId, TrackId {
|
|
29
|
+
universal?: URLCandidate;
|
|
30
|
+
}
|
|
31
|
+
export declare interface WindowsAppInfo extends AppInfo, PackageName, ProductId {
|
|
32
|
+
}
|
|
33
|
+
export declare interface MacOSAppInfo extends AppInfo, BundleId, TrackId {
|
|
34
|
+
}
|
|
35
|
+
export declare interface StoreInfo {
|
|
36
|
+
appStore?: string;
|
|
37
|
+
webStore?: string;
|
|
38
|
+
}
|
|
39
|
+
export declare interface AppOpenOptions {
|
|
40
|
+
[OS.Android]?: AndroidAppInfo;
|
|
41
|
+
['android']?: AndroidAppInfo;
|
|
42
|
+
[OS.iOS]?: IOSAppInfo;
|
|
43
|
+
['ios']?: IOSAppInfo;
|
|
44
|
+
[OS.Windows]?: WindowsAppInfo;
|
|
45
|
+
['windows']?: WindowsAppInfo;
|
|
46
|
+
[OS.MacOS]?: MacOSAppInfo;
|
|
47
|
+
['macos']?: MacOSAppInfo;
|
|
48
|
+
}
|
|
49
|
+
export interface Contact {
|
|
50
|
+
name?: string;
|
|
51
|
+
email?: string;
|
|
52
|
+
tel?: string;
|
|
53
|
+
address?: string;
|
|
54
|
+
icon?: Blob[];
|
|
55
|
+
}
|
|
56
|
+
export interface ContactOptions {
|
|
57
|
+
multiple?: boolean;
|
|
58
|
+
}
|
|
59
|
+
export type FileExtension = `.${string}`;
|
|
60
|
+
export type FileMimeType = `${string}/${string}`;
|
|
61
|
+
export interface FileOptions {
|
|
62
|
+
multiple?: boolean;
|
|
63
|
+
accept?: (FileExtension | FileMimeType)[];
|
|
64
|
+
id?: string;
|
|
65
|
+
startIn?: 'desktop' | 'documents' | 'downloads' | 'music' | 'pictures' | 'videos';
|
|
66
|
+
}
|
|
67
|
+
export interface DirectoryOptions {
|
|
68
|
+
mode?: 'read' | 'readwrite';
|
|
69
|
+
id?: string;
|
|
70
|
+
startIn?: 'desktop' | 'documents' | 'downloads' | 'music' | 'pictures' | 'videos';
|
|
71
|
+
}
|
|
72
|
+
export interface FileWithPath {
|
|
73
|
+
file: File;
|
|
74
|
+
relativePath: string;
|
|
75
|
+
}
|
|
76
|
+
export interface CameraOptions {
|
|
77
|
+
type?: CameraType;
|
|
78
|
+
capture?: CaptureType;
|
|
79
|
+
}
|
|
80
|
+
export interface CalendarOptions {
|
|
81
|
+
title?: string;
|
|
82
|
+
description?: string;
|
|
83
|
+
location?: string;
|
|
84
|
+
allDay?: boolean;
|
|
85
|
+
startDate: Date;
|
|
86
|
+
endDate: Date;
|
|
87
|
+
alarm?: CalendarAlarmOptions[];
|
|
88
|
+
recur?: CalendarRecurOptions;
|
|
89
|
+
}
|
|
90
|
+
export type CalendarAlarmOptions = {
|
|
91
|
+
description?: string;
|
|
92
|
+
} & CalendarAlarmTrigger;
|
|
93
|
+
export type CalendarAlarmTrigger = {
|
|
94
|
+
datetime?: Date;
|
|
95
|
+
repeat?: never;
|
|
96
|
+
repeatDuration?: never;
|
|
97
|
+
before?: never;
|
|
98
|
+
weeks?: never;
|
|
99
|
+
days?: never;
|
|
100
|
+
hours?: never;
|
|
101
|
+
minutes?: never;
|
|
102
|
+
seconds?: never;
|
|
103
|
+
} | {
|
|
104
|
+
datetime?: never;
|
|
105
|
+
repeat?: number;
|
|
106
|
+
repeatDuration?: number;
|
|
107
|
+
before?: boolean;
|
|
108
|
+
weeks?: number;
|
|
109
|
+
days?: number;
|
|
110
|
+
hours?: number;
|
|
111
|
+
minutes?: number;
|
|
112
|
+
seconds?: number;
|
|
113
|
+
};
|
|
114
|
+
export type CalendarRecurWeekDay = 'MO' | 'TU' | 'WE' | 'TH' | 'FR' | 'SA' | 'SU';
|
|
115
|
+
export type CalendarRecurDayValue = CalendarRecurWeekDay | `${number}${CalendarRecurWeekDay}`;
|
|
116
|
+
export type CalendarRecurOptions = {
|
|
117
|
+
frequency: 'SECONDLY' | 'MINUTELY' | 'HOURLY' | 'DAILY' | 'WEEKLY' | 'MONTHLY' | 'YEARLY';
|
|
118
|
+
interval?: number;
|
|
119
|
+
byMonth?: number[];
|
|
120
|
+
byWeekNo?: number[];
|
|
121
|
+
byYearDay?: number[];
|
|
122
|
+
byMonthDay?: number[];
|
|
123
|
+
byDay?: CalendarRecurDayValue[];
|
|
124
|
+
byHour?: number[];
|
|
125
|
+
byMinute?: number[];
|
|
126
|
+
bySecond?: number[];
|
|
127
|
+
bySetPos?: number[];
|
|
128
|
+
weekStart?: CalendarRecurWeekDay;
|
|
129
|
+
} & CalendarRecurLimit;
|
|
130
|
+
export type CalendarRecurLimit = {
|
|
131
|
+
count: number;
|
|
132
|
+
until?: never;
|
|
133
|
+
} | {
|
|
134
|
+
count?: never;
|
|
135
|
+
until: Date;
|
|
136
|
+
} | {
|
|
137
|
+
count?: never;
|
|
138
|
+
until?: never;
|
|
139
|
+
};
|
|
140
|
+
export declare type URLCandidate = URL | string;
|
|
141
|
+
export declare type URLCandidateOrFallback = URLCandidate | (() => any);
|
|
142
|
+
export declare type URLStringOrFallback = string | (() => any);
|
|
143
|
+
export declare interface TelephoneOptions {
|
|
144
|
+
to?: string | string[];
|
|
145
|
+
}
|
|
146
|
+
export declare interface MessageOptions extends TelephoneOptions {
|
|
147
|
+
body?: string;
|
|
148
|
+
}
|
|
149
|
+
export declare interface MailOptions extends MessageOptions {
|
|
150
|
+
cc?: string | string[];
|
|
151
|
+
bcc?: string | string[];
|
|
152
|
+
subject?: string;
|
|
153
|
+
}
|
|
154
|
+
export declare interface OpenInstance {
|
|
155
|
+
app(options: AppOpenOptions): Promise<AppOpenState>;
|
|
156
|
+
telephone(options: TelephoneOptions): Promise<void>;
|
|
157
|
+
message(options: MessageOptions): Promise<void>;
|
|
158
|
+
mail(options: MailOptions): Promise<void>;
|
|
159
|
+
file(options?: FileOptions): Promise<File[]>;
|
|
160
|
+
directory(options?: DirectoryOptions): Promise<FileWithPath[]>;
|
|
161
|
+
setting(type: SettingType): Promise<void>;
|
|
162
|
+
camera(options?: CameraOptions): Promise<File[]>;
|
|
163
|
+
contact(options?: ContactOptions): Promise<Contact[]>;
|
|
164
|
+
share(options: ShareData): Promise<void>;
|
|
165
|
+
calendar(options: CalendarOptions): void;
|
|
166
|
+
supported: {
|
|
167
|
+
get intent(): boolean;
|
|
168
|
+
get universal(): boolean;
|
|
169
|
+
get setting(): boolean;
|
|
170
|
+
get directory(): boolean;
|
|
171
|
+
get camera(): boolean;
|
|
172
|
+
get contact(): boolean;
|
|
173
|
+
get share(): boolean;
|
|
174
|
+
get calendar(): boolean;
|
|
175
|
+
};
|
|
176
|
+
Constants: {
|
|
177
|
+
AppOpenState: typeof AppOpenState;
|
|
178
|
+
SettingType: typeof SettingType;
|
|
179
|
+
CameraType: typeof CameraType;
|
|
180
|
+
CaptureType: typeof CaptureType;
|
|
181
|
+
};
|
|
182
|
+
Errors: {
|
|
183
|
+
URLOpenError: typeof URLOpenError;
|
|
184
|
+
NotSupportedError: typeof NotSupportedError;
|
|
185
|
+
UserCancelledError: typeof UserCancelledError;
|
|
186
|
+
};
|
|
187
|
+
}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
declare global {
|
|
2
|
+
interface Navigator {
|
|
3
|
+
getUserMedia?(constraints?: MediaStreamConstraints): Promise<MediaStream>;
|
|
4
|
+
webkitGetUserMedia?(constraints: MediaStreamConstraints, successCallback: (stream: MediaStream) => void, errorCallback: (error: DOMException) => void): void;
|
|
5
|
+
mozGetUserMedia?(constraints: MediaStreamConstraints, successCallback: (stream: MediaStream) => void, errorCallback: (error: DOMException) => void): void;
|
|
6
|
+
msGetUserMedia?(constraints: MediaStreamConstraints, successCallback: (stream: MediaStream) => void, errorCallback: (error: DOMException) => void): void;
|
|
7
|
+
}
|
|
8
|
+
}
|
|
9
|
+
export declare enum PermissionType {
|
|
10
|
+
Notification = "notifications",
|
|
11
|
+
Geolocation = "geolocation",
|
|
12
|
+
Camera = "camera",
|
|
13
|
+
Microphone = "microphone",
|
|
14
|
+
MIDI = "midi"
|
|
15
|
+
}
|
|
16
|
+
export declare enum PermissionState {
|
|
17
|
+
Grant = "grant",
|
|
18
|
+
Denied = "denied",
|
|
19
|
+
Prompt = "prompt",
|
|
20
|
+
Unsupported = "unsupported"
|
|
21
|
+
}
|
|
22
|
+
export declare const GET_USER_MEDIA: ((constraints?: MediaStreamConstraints) => Promise<MediaStream>) | undefined;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./permission";
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { PermissionState, PermissionType } from "../constants";
|
|
2
|
+
export declare interface PermissionInstance {
|
|
3
|
+
request(type: PermissionType): Promise<PermissionState>;
|
|
4
|
+
check(type: PermissionType): Promise<PermissionState>;
|
|
5
|
+
Constants: {
|
|
6
|
+
PermissionType: typeof PermissionType;
|
|
7
|
+
PermissionState: typeof PermissionState;
|
|
8
|
+
};
|
|
9
|
+
Errors: {};
|
|
10
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { PipInstance } from "../types";
|
|
2
|
+
declare global {
|
|
3
|
+
interface HTMLVideoElement {
|
|
4
|
+
webkitSupportsPresentationMode?: (mode: string) => boolean;
|
|
5
|
+
webkitSetPresentationMode?: (mode: string) => void;
|
|
6
|
+
webkitPresentationMode?: string;
|
|
7
|
+
onwebkitpresentationmodechanged?: ((this: HTMLVideoElement, ev: Event) => any) | null;
|
|
8
|
+
__pipBridged__?: boolean;
|
|
9
|
+
}
|
|
10
|
+
}
|
|
11
|
+
declare const Pip: PipInstance;
|
|
12
|
+
export default Pip;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./pip";
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { NotSupportedError } from "../../../errors/not-supported-error";
|
|
2
|
+
export declare interface PipInstance {
|
|
3
|
+
supported: boolean;
|
|
4
|
+
element: HTMLVideoElement | null;
|
|
5
|
+
isPip: boolean;
|
|
6
|
+
request(target?: HTMLVideoElement): Promise<void>;
|
|
7
|
+
exit(): Promise<void>;
|
|
8
|
+
toggle(target?: HTMLVideoElement): Promise<void>;
|
|
9
|
+
onChange(listener: (event: Event) => void, options?: AddEventListenerOptions): () => void;
|
|
10
|
+
onError(listener: (event: Event) => void, options?: AddEventListenerOptions): () => void;
|
|
11
|
+
Constants: {};
|
|
12
|
+
Errors: {
|
|
13
|
+
NotSupportedError: typeof NotSupportedError;
|
|
14
|
+
};
|
|
15
|
+
}
|
|
@@ -40,4 +40,3 @@ export declare const RTL_LANGUAGES: string[];
|
|
|
40
40
|
export declare const OS_RESOLVER_MAP: [RegExp, OS, VersionResolver?][];
|
|
41
41
|
export declare const ENGINE_RESOLVER_MAP: [RegExp, Engines, VersionResolver?][];
|
|
42
42
|
export declare const BROWSER_RESOLVER_MAP: [RegExp, Browsers, VersionResolver?][];
|
|
43
|
-
export declare const BOT_REGEXP: RegExp[];
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { GPUAdapterInfo, PlatformInstance } from "../types";
|
|
2
2
|
declare global {
|
|
3
3
|
interface Navigator {
|
|
4
4
|
userAgent?: string;
|
|
@@ -8,6 +8,8 @@ declare global {
|
|
|
8
8
|
browserLanguage?: string;
|
|
9
9
|
systemLanguage?: string;
|
|
10
10
|
userLanguage?: string;
|
|
11
|
+
standalone?: boolean;
|
|
12
|
+
gpu?: WebGPU;
|
|
11
13
|
}
|
|
12
14
|
interface NodeProcessVersions {
|
|
13
15
|
node?: string;
|
|
@@ -48,5 +50,16 @@ interface UserAgentDataValues {
|
|
|
48
50
|
interface UserAgentData {
|
|
49
51
|
getHighEntropyValues?(hints: string[]): Promise<UserAgentDataValues>;
|
|
50
52
|
}
|
|
51
|
-
|
|
53
|
+
interface WebGPU {
|
|
54
|
+
requestAdapter(options?: GPURequestAdapterOptions): Promise<GPUAdapter | null>;
|
|
55
|
+
}
|
|
56
|
+
interface GPURequestAdapterOptions {
|
|
57
|
+
powerPreference?: GPUPowerPreference;
|
|
58
|
+
forceFallbackAdapter?: boolean;
|
|
59
|
+
}
|
|
60
|
+
type GPUPowerPreference = "low-power" | "high-performance";
|
|
61
|
+
interface GPUAdapter {
|
|
62
|
+
readonly info: GPUAdapterInfo;
|
|
63
|
+
}
|
|
64
|
+
declare const Platform: PlatformInstance;
|
|
52
65
|
export default Platform;
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { Browsers, Devices, Engines, OS } from "../constants";
|
|
2
|
+
import { Writeable } from "../../../types";
|
|
2
3
|
export declare type VersionResolver = undefined | string | ((string: string | undefined) => string);
|
|
3
|
-
export declare interface
|
|
4
|
+
export declare interface PlatformInstance {
|
|
4
5
|
get userAgent(): string;
|
|
5
6
|
set userAgent(value: any);
|
|
6
7
|
get os(): NameVersionPair<OS>;
|
|
@@ -8,11 +9,10 @@ export declare interface Platform {
|
|
|
8
9
|
get browser(): NameVersionPair<Browsers>;
|
|
9
10
|
get device(): Devices;
|
|
10
11
|
get locale(): Locale;
|
|
11
|
-
get
|
|
12
|
+
get gpu(): GPU;
|
|
12
13
|
get isNode(): boolean;
|
|
13
14
|
get isStandalone(): boolean;
|
|
14
15
|
get isWebview(): boolean;
|
|
15
|
-
get isBot(): boolean;
|
|
16
16
|
Constants: {
|
|
17
17
|
OS: typeof OS;
|
|
18
18
|
Engines: typeof Engines;
|
|
@@ -32,3 +32,12 @@ export declare interface Locale {
|
|
|
32
32
|
offset: number;
|
|
33
33
|
isRTL: boolean;
|
|
34
34
|
}
|
|
35
|
+
export interface GPUAdapterInfo {
|
|
36
|
+
readonly vendor?: string;
|
|
37
|
+
readonly architecture?: string;
|
|
38
|
+
readonly device?: string;
|
|
39
|
+
readonly description?: string;
|
|
40
|
+
}
|
|
41
|
+
export declare type GPU = Writeable<GPUAdapterInfo> & {
|
|
42
|
+
webglRenderer: string;
|
|
43
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./pwa";
|