@quan-erp/shared-frontend-core 1.0.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/README.md +92 -0
- package/dist/index.js +2921 -0
- package/dist/types/core/accelerometer.d.ts +47 -0
- package/dist/types/core/assets.d.ts +13 -0
- package/dist/types/core/backend-api.d.ts +2 -0
- package/dist/types/core/background-location.d.ts +1 -0
- package/dist/types/core/battery.d.ts +40 -0
- package/dist/types/core/bluetooth.d.ts +77 -0
- package/dist/types/core/camera.d.ts +83 -0
- package/dist/types/core/clipboard.d.ts +56 -0
- package/dist/types/core/database.d.ts +13 -0
- package/dist/types/core/device-class-tier.d.ts +19 -0
- package/dist/types/core/device-fingerprint.d.ts +29 -0
- package/dist/types/core/device.d.ts +33 -0
- package/dist/types/core/filesystem.d.ts +85 -0
- package/dist/types/core/firebase.d.ts +5 -0
- package/dist/types/core/gyroscope.d.ts +52 -0
- package/dist/types/core/index.d.ts +32 -0
- package/dist/types/core/location.d.ts +87 -0
- package/dist/types/core/microphone.d.ts +54 -0
- package/dist/types/core/morientation.d.ts +14 -0
- package/dist/types/core/motion-orientation.d.ts +25 -0
- package/dist/types/core/network.d.ts +15 -0
- package/dist/types/core/notification.d.ts +113 -0
- package/dist/types/core/number-formatter.d.ts +20 -0
- package/dist/types/core/orientation.d.ts +49 -0
- package/dist/types/core/permissions.d.ts +6 -0
- package/dist/types/core/platform.d.ts +27 -0
- package/dist/types/core/plugin-api.d.ts +33 -0
- package/dist/types/core/printer.d.ts +54 -0
- package/dist/types/core/safearea.d.ts +30 -0
- package/dist/types/core/shared-preferences.d.ts +61 -0
- package/dist/types/core/sqlite.d.ts +18 -0
- package/dist/types/core/system-locale.d.ts +24 -0
- package/dist/types/core/system.d.ts +109 -0
- package/dist/types/core/user-behavior.d.ts +24 -0
- package/dist/types/core/user-hand-behavior.d.ts +90 -0
- package/dist/types/core/vibration.d.ts +78 -0
- package/dist/types/dto/dto.d.ts +9 -0
- package/dist/types/dto/index.d.ts +2 -0
- package/dist/types/dto/pagination.dto.d.ts +29 -0
- package/dist/types/index.d.ts +4 -0
- package/dist/types/security/websecurity.d.ts +4 -0
- package/dist/types/utilities/index.d.ts +1 -0
- package/dist/types/utilities/plugin-expose.d.ts +5 -0
- package/dist/types/utilities/version.util.d.ts +53 -0
- package/external-global-rollup-config.json +61 -0
- package/package.json +73 -0
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
export interface IAccelerometer {
|
|
2
|
+
start(callback: (data: {
|
|
3
|
+
x: number | null;
|
|
4
|
+
y: number | null;
|
|
5
|
+
z: number | null;
|
|
6
|
+
}) => void): void;
|
|
7
|
+
stop(): void;
|
|
8
|
+
}
|
|
9
|
+
export declare class WebAccelerometer implements IAccelerometer {
|
|
10
|
+
private handler?;
|
|
11
|
+
start(callback: (data: {
|
|
12
|
+
x: number | null;
|
|
13
|
+
y: number | null;
|
|
14
|
+
z: number | null;
|
|
15
|
+
}) => void): void;
|
|
16
|
+
stop(): void;
|
|
17
|
+
}
|
|
18
|
+
export declare class CapacitorAccelerometer extends WebAccelerometer implements IAccelerometer {
|
|
19
|
+
}
|
|
20
|
+
export declare class ElectronAccelerometer extends WebAccelerometer implements IAccelerometer {
|
|
21
|
+
}
|
|
22
|
+
/**
|
|
23
|
+
* Cross-platform Accelerometer tracking utility that delegates sensor reading requests
|
|
24
|
+
* to native Capacitor modules, Electron, or Web APIs depending on the active platform.
|
|
25
|
+
*/
|
|
26
|
+
export declare class Accelerometer implements IAccelerometer {
|
|
27
|
+
private static _instance;
|
|
28
|
+
private impl;
|
|
29
|
+
private constructor();
|
|
30
|
+
/**
|
|
31
|
+
* Singleton instance of the Accelerometer tracker.
|
|
32
|
+
*/
|
|
33
|
+
static get instance(): Accelerometer;
|
|
34
|
+
/**
|
|
35
|
+
* Starts listening to accelerometer sensor data streams.
|
|
36
|
+
* @param callback Callback function receiving acceleration data on x, y, and z axes (in m/s²).
|
|
37
|
+
*/
|
|
38
|
+
start(callback: (data: {
|
|
39
|
+
x: number | null;
|
|
40
|
+
y: number | null;
|
|
41
|
+
z: number | null;
|
|
42
|
+
}) => void): void;
|
|
43
|
+
/**
|
|
44
|
+
* Stops listening to the accelerometer sensor data streams and cleans up underlying listeners.
|
|
45
|
+
*/
|
|
46
|
+
stop(): void;
|
|
47
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { PluginMetadata } from "@quan-erp/shared-types";
|
|
2
|
+
/**
|
|
3
|
+
* Utility class for resolving static asset URLs served by plugins on the backend.
|
|
4
|
+
*/
|
|
5
|
+
export declare class PluginAssets {
|
|
6
|
+
/**
|
|
7
|
+
* Resolves the backend network URL for a given plugin asset.
|
|
8
|
+
* @param metadata The plugin's module metadata.
|
|
9
|
+
* @param url The relative asset path (e.g., 'images/logo.png').
|
|
10
|
+
* @returns The fully qualified absolute URL pointing to the backend static resource.
|
|
11
|
+
*/
|
|
12
|
+
static network(metadata: PluginMetadata, url: string): string;
|
|
13
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Common interface defining battery status and lifecycle listeners.
|
|
3
|
+
*/
|
|
4
|
+
export interface IBattery {
|
|
5
|
+
getLevel(): Promise<number>;
|
|
6
|
+
isCharging(): Promise<boolean>;
|
|
7
|
+
onLevelChange(callback: (level: number) => void): void;
|
|
8
|
+
onChargingChange(callback: (charging: boolean) => void): void;
|
|
9
|
+
}
|
|
10
|
+
/**
|
|
11
|
+
* Cross-platform Battery tracking utility that delegates status lookups and level change event
|
|
12
|
+
* subscriptions to native Capacitor plugins, Electron, or Web Battery APIs.
|
|
13
|
+
*/
|
|
14
|
+
export declare class Battery {
|
|
15
|
+
private static _instance;
|
|
16
|
+
private constructor();
|
|
17
|
+
private static get impl();
|
|
18
|
+
/**
|
|
19
|
+
* Get the current battery level as a number between 0 and 1.
|
|
20
|
+
* @returns {Promise<number>} A promise that resolves with the battery level.
|
|
21
|
+
*/
|
|
22
|
+
static getLevel(): Promise<number>;
|
|
23
|
+
/**
|
|
24
|
+
* Check whether the device is currently charging.
|
|
25
|
+
* @returns {Promise<boolean>} A promise that resolves to true if charging, false otherwise.
|
|
26
|
+
*/
|
|
27
|
+
static isCharging(): Promise<boolean>;
|
|
28
|
+
/**
|
|
29
|
+
* Subscribe to battery level changes.
|
|
30
|
+
* @param {(level: number) => void} callback - Callback invoked when the battery level changes.
|
|
31
|
+
* @returns {() => void} A function to unsubscribe from the level change event.
|
|
32
|
+
*/
|
|
33
|
+
static onLevelChange(callback: (level: number) => void): void;
|
|
34
|
+
/**
|
|
35
|
+
* Subscribe to charging status changes.
|
|
36
|
+
* @param {(charging: boolean) => void} callback - Callback invoked when the charging status changes.
|
|
37
|
+
* @returns {() => void} A function to unsubscribe from the charging change event.
|
|
38
|
+
*/
|
|
39
|
+
static onChargingChange(callback: (charging: boolean) => void): void;
|
|
40
|
+
}
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
export interface BluetoothDeviceInfo {
|
|
2
|
+
id: string;
|
|
3
|
+
name?: string;
|
|
4
|
+
}
|
|
5
|
+
export interface IBluetooth {
|
|
6
|
+
requestPermission(): Promise<boolean>;
|
|
7
|
+
scan(): Promise<BluetoothDeviceInfo[]>;
|
|
8
|
+
connect(deviceId: string): Promise<void>;
|
|
9
|
+
disconnect(deviceId: string): Promise<void>;
|
|
10
|
+
isConnected(deviceId: string): Promise<boolean>;
|
|
11
|
+
}
|
|
12
|
+
export declare class CapacitorBluetooth implements IBluetooth {
|
|
13
|
+
private devices;
|
|
14
|
+
private connectedDevices;
|
|
15
|
+
constructor();
|
|
16
|
+
requestPermission(): Promise<boolean>;
|
|
17
|
+
scan(): Promise<BluetoothDeviceInfo[]>;
|
|
18
|
+
connect(deviceId: string): Promise<void>;
|
|
19
|
+
disconnect(deviceId: string): Promise<void>;
|
|
20
|
+
isConnected(deviceId: string): Promise<boolean>;
|
|
21
|
+
}
|
|
22
|
+
export declare class ElectronBluetooth implements IBluetooth {
|
|
23
|
+
private connectedDevices;
|
|
24
|
+
requestPermission(): Promise<boolean>;
|
|
25
|
+
scan(): Promise<BluetoothDeviceInfo[]>;
|
|
26
|
+
connect(deviceId: string): Promise<void>;
|
|
27
|
+
disconnect(deviceId: string): Promise<void>;
|
|
28
|
+
isConnected(deviceId: string): Promise<boolean>;
|
|
29
|
+
}
|
|
30
|
+
export declare class WebBluetooth implements IBluetooth {
|
|
31
|
+
private devices;
|
|
32
|
+
private connectedDevices;
|
|
33
|
+
requestPermission(): Promise<boolean>;
|
|
34
|
+
scan(): Promise<BluetoothDeviceInfo[]>;
|
|
35
|
+
connect(deviceId: string): Promise<void>;
|
|
36
|
+
disconnect(deviceId: string): Promise<void>;
|
|
37
|
+
isConnected(deviceId: string): Promise<boolean>;
|
|
38
|
+
}
|
|
39
|
+
/**
|
|
40
|
+
* Cross-platform Bluetooth LE tracking utility that delegates permission prompts, scanning,
|
|
41
|
+
* and connection lifecycle methods to Capacitor BLE plugins, Electron, or Web Bluetooth APIs.
|
|
42
|
+
*/
|
|
43
|
+
export declare class Bluetooth implements IBluetooth {
|
|
44
|
+
private impl;
|
|
45
|
+
private static _instance;
|
|
46
|
+
private constructor();
|
|
47
|
+
/**
|
|
48
|
+
* Singleton instance of the Bluetooth LE utility.
|
|
49
|
+
*/
|
|
50
|
+
static get instance(): Bluetooth;
|
|
51
|
+
/**
|
|
52
|
+
* Triggers the platform's native Bluetooth permission prompt or scan dialog.
|
|
53
|
+
* @returns A promise resolving to true if permission was granted.
|
|
54
|
+
*/
|
|
55
|
+
requestPermission(): Promise<boolean>;
|
|
56
|
+
/**
|
|
57
|
+
* Initiates a scanner session to discover nearby Bluetooth LE peripherals.
|
|
58
|
+
* @returns A promise resolving to a list of discovered devices.
|
|
59
|
+
*/
|
|
60
|
+
scan(): Promise<BluetoothDeviceInfo[]>;
|
|
61
|
+
/**
|
|
62
|
+
* Connects to a specific Bluetooth LE device.
|
|
63
|
+
* @param deviceId Unique hardware identifier of the target device.
|
|
64
|
+
*/
|
|
65
|
+
connect(deviceId: string): Promise<void>;
|
|
66
|
+
/**
|
|
67
|
+
* Closes the active GATT connection with a specific device.
|
|
68
|
+
* @param deviceId Unique hardware identifier of the target device.
|
|
69
|
+
*/
|
|
70
|
+
disconnect(deviceId: string): Promise<void>;
|
|
71
|
+
/**
|
|
72
|
+
* Checks if a specific device is currently connected.
|
|
73
|
+
* @param deviceId Unique hardware identifier of the target device.
|
|
74
|
+
* @returns A promise resolving to true if connected, false otherwise.
|
|
75
|
+
*/
|
|
76
|
+
isConnected(deviceId: string): Promise<boolean>;
|
|
77
|
+
}
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
import { CameraResultType } from "@capacitor/camera";
|
|
2
|
+
export interface ICamera {
|
|
3
|
+
requestPermission(): Promise<boolean>;
|
|
4
|
+
takePicture(): Promise<string>;
|
|
5
|
+
startPreview(videoElement: HTMLVideoElement): Promise<void>;
|
|
6
|
+
stopPreview(): void;
|
|
7
|
+
pickImageFromGallery({ resultType }: {
|
|
8
|
+
resultType: CameraResultType;
|
|
9
|
+
}): Promise<string>;
|
|
10
|
+
pickVideoFromGallery(): Promise<string>;
|
|
11
|
+
}
|
|
12
|
+
export declare class CapacitorCamera implements ICamera {
|
|
13
|
+
private videoEl?;
|
|
14
|
+
private stream?;
|
|
15
|
+
requestPermission(): Promise<boolean>;
|
|
16
|
+
takePicture(): Promise<string>;
|
|
17
|
+
startPreview(videoElement: HTMLVideoElement): Promise<void>;
|
|
18
|
+
stopPreview(): void;
|
|
19
|
+
pickImageFromGallery({ resultType }: {
|
|
20
|
+
resultType: CameraResultType;
|
|
21
|
+
}): Promise<string>;
|
|
22
|
+
pickVideoFromGallery(): Promise<string>;
|
|
23
|
+
}
|
|
24
|
+
export declare class WebCamera implements ICamera {
|
|
25
|
+
private stream?;
|
|
26
|
+
private videoEl?;
|
|
27
|
+
takePicture(): Promise<string>;
|
|
28
|
+
startPreview(videoElement: HTMLVideoElement): Promise<void>;
|
|
29
|
+
stopPreview(): void;
|
|
30
|
+
requestPermission(): Promise<boolean>;
|
|
31
|
+
pickImageFromGallery({ resultType }: {
|
|
32
|
+
resultType: CameraResultType;
|
|
33
|
+
}): Promise<string>;
|
|
34
|
+
pickVideoFromGallery(): Promise<string>;
|
|
35
|
+
}
|
|
36
|
+
export declare class ElectronCamera extends WebCamera {
|
|
37
|
+
}
|
|
38
|
+
/**
|
|
39
|
+
* Cross-platform Camera tracking utility that delegates permission requests, image capturing,
|
|
40
|
+
* live video element previews, and photo/video gallery selection to Capacitor Camera,
|
|
41
|
+
* Electron, or HTML5 MediaStream APIs depending on the active platform.
|
|
42
|
+
*/
|
|
43
|
+
export declare class Camera implements ICamera {
|
|
44
|
+
private static _instance;
|
|
45
|
+
private impl;
|
|
46
|
+
private constructor();
|
|
47
|
+
/**
|
|
48
|
+
* Singleton instance of the Camera utility.
|
|
49
|
+
*/
|
|
50
|
+
static get instance(): Camera;
|
|
51
|
+
/**
|
|
52
|
+
* Checks and requests permission to access the camera hardware.
|
|
53
|
+
* @returns A promise resolving to true if access was successfully granted.
|
|
54
|
+
*/
|
|
55
|
+
requestPermission(): Promise<boolean>;
|
|
56
|
+
/**
|
|
57
|
+
* Captures a single image using the device camera.
|
|
58
|
+
* @returns A promise resolving to the picture data encoded as a Base64 string or file URL.
|
|
59
|
+
*/
|
|
60
|
+
takePicture(): Promise<string>;
|
|
61
|
+
/**
|
|
62
|
+
* Binds a real-time camera stream to a given HTMLVideoElement for a custom camera preview layout.
|
|
63
|
+
* @param videoElement The HTML5 Video element to bind the streaming media tracks to.
|
|
64
|
+
*/
|
|
65
|
+
startPreview(videoElement: HTMLVideoElement): Promise<void>;
|
|
66
|
+
/**
|
|
67
|
+
* Disconnects and releases the active camera streams, stopping the custom preview window.
|
|
68
|
+
*/
|
|
69
|
+
stopPreview(): void;
|
|
70
|
+
/**
|
|
71
|
+
* Triggers the platform's image picker to select a photo from the local photo gallery.
|
|
72
|
+
* @param options Target result layout configurations.
|
|
73
|
+
* @returns A promise resolving to the chosen image's Base64 data or URI path.
|
|
74
|
+
*/
|
|
75
|
+
pickImageFromGallery(options: {
|
|
76
|
+
resultType: CameraResultType;
|
|
77
|
+
}): Promise<string>;
|
|
78
|
+
/**
|
|
79
|
+
* Triggers the platform's video picker to select a video file from the local library.
|
|
80
|
+
* @returns A promise resolving to the chosen video's file path or URL.
|
|
81
|
+
*/
|
|
82
|
+
pickVideoFromGallery(): Promise<string>;
|
|
83
|
+
}
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Common interface defining system clipboard text reading and writing APIs.
|
|
3
|
+
*/
|
|
4
|
+
export interface IClipboard {
|
|
5
|
+
/** Reads the current plain text contents from the system clipboard. */
|
|
6
|
+
readText(): Promise<string>;
|
|
7
|
+
/** Writes the specified plain text to the system clipboard. */
|
|
8
|
+
writeText(text: string): Promise<void>;
|
|
9
|
+
/** Requests permission to access the system clipboard if required. */
|
|
10
|
+
requestPermission(): Promise<boolean>;
|
|
11
|
+
}
|
|
12
|
+
export declare class CapacitorClipboard implements IClipboard {
|
|
13
|
+
readText(): Promise<string>;
|
|
14
|
+
writeText(text: string): Promise<void>;
|
|
15
|
+
requestPermission(): Promise<boolean>;
|
|
16
|
+
}
|
|
17
|
+
export declare class ElectronClipboard implements IClipboard {
|
|
18
|
+
private electronClipboard;
|
|
19
|
+
readText(): Promise<string>;
|
|
20
|
+
writeText(text: string): Promise<void>;
|
|
21
|
+
requestPermission(): Promise<boolean>;
|
|
22
|
+
}
|
|
23
|
+
export declare class WebClipboard implements IClipboard {
|
|
24
|
+
readText(): Promise<string>;
|
|
25
|
+
writeText(text: string): Promise<void>;
|
|
26
|
+
requestPermission(): Promise<boolean>;
|
|
27
|
+
}
|
|
28
|
+
/**
|
|
29
|
+
* Cross-platform Clipboard utility that delegates copy/paste text actions
|
|
30
|
+
* to native Capacitor plugins, Electron, or browser Clipboard APIs depending on the environment.
|
|
31
|
+
*/
|
|
32
|
+
export declare class Clipboard implements IClipboard {
|
|
33
|
+
private static _instance;
|
|
34
|
+
private impl;
|
|
35
|
+
private constructor();
|
|
36
|
+
/**
|
|
37
|
+
* Singleton instance of the Clipboard utility.
|
|
38
|
+
*/
|
|
39
|
+
static get instance(): Clipboard;
|
|
40
|
+
private detectPlatform;
|
|
41
|
+
/**
|
|
42
|
+
* Reads plain text from the system clipboard.
|
|
43
|
+
* @returns A promise resolving to the clipboard's string value.
|
|
44
|
+
*/
|
|
45
|
+
readText(): Promise<string>;
|
|
46
|
+
/**
|
|
47
|
+
* Writes the specified text to the system clipboard.
|
|
48
|
+
* @param text The plain text string to copy.
|
|
49
|
+
*/
|
|
50
|
+
writeText(text: string): Promise<void>;
|
|
51
|
+
/**
|
|
52
|
+
* Requests system clipboard permission prompts on the current platform.
|
|
53
|
+
* @returns A promise resolving to true if clipboard access was successfully permitted.
|
|
54
|
+
*/
|
|
55
|
+
requestPermission(): Promise<boolean>;
|
|
56
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { SQLiteDBConnection } from "@capacitor-community/sqlite";
|
|
2
|
+
/**
|
|
3
|
+
* Mobile-specific local SQLite database helper.
|
|
4
|
+
*/
|
|
5
|
+
export declare class Database {
|
|
6
|
+
private static _instance;
|
|
7
|
+
private constructor();
|
|
8
|
+
/**
|
|
9
|
+
* Retrieves the singleton mobile SQLite database connection.
|
|
10
|
+
* @returns A promise resolving to the database connection instance.
|
|
11
|
+
*/
|
|
12
|
+
static getInstance(): Promise<SQLiteDBConnection>;
|
|
13
|
+
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
type DeviceTier = "low" | "mid" | "high" | "unknown";
|
|
2
|
+
/**
|
|
3
|
+
* Classifies device performance capabilities into low, mid, or high tiers.
|
|
4
|
+
* Used for dynamic feature gating and layout optimization.
|
|
5
|
+
*/
|
|
6
|
+
export declare class DeviceClassDetector {
|
|
7
|
+
private static _instance;
|
|
8
|
+
/**
|
|
9
|
+
* Singleton instance of the DeviceClassDetector.
|
|
10
|
+
*/
|
|
11
|
+
static get instance(): DeviceClassDetector;
|
|
12
|
+
/**
|
|
13
|
+
* Detects the performance tier of the current device.
|
|
14
|
+
* Leverages RAM memory parameters, CPU core counts, and network speed signals.
|
|
15
|
+
* @returns A promise resolving to "low", "mid", "high", or "unknown" tier.
|
|
16
|
+
*/
|
|
17
|
+
detect(): Promise<DeviceTier>;
|
|
18
|
+
}
|
|
19
|
+
export {};
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Common interface defining unique device fingerprint retrieval APIs.
|
|
3
|
+
*/
|
|
4
|
+
export interface IDeviceFingerprint {
|
|
5
|
+
/**
|
|
6
|
+
* Resolves the unique device fingerprint value.
|
|
7
|
+
* @returns A promise resolving to the device fingerprint string.
|
|
8
|
+
*/
|
|
9
|
+
getFingerprint(): Promise<string>;
|
|
10
|
+
}
|
|
11
|
+
/**
|
|
12
|
+
* Cross-platform Device Fingerprint tracking utility that delegates fingerprinting queries
|
|
13
|
+
* to native physical hardware parameters on desktop (e.g. MAC address) and FingerprintJS
|
|
14
|
+
* npm package on web, PWA, or Capacitor.
|
|
15
|
+
*/
|
|
16
|
+
export declare class DeviceFingerprint implements IDeviceFingerprint {
|
|
17
|
+
private impl;
|
|
18
|
+
private static _instance;
|
|
19
|
+
private constructor();
|
|
20
|
+
/**
|
|
21
|
+
* Singleton instance of the DeviceFingerprint utility.
|
|
22
|
+
*/
|
|
23
|
+
static get instance(): DeviceFingerprint;
|
|
24
|
+
/**
|
|
25
|
+
* Retrieves the platform-optimized unique device fingerprint identifier.
|
|
26
|
+
* @returns A promise resolving to the visitor/device fingerprint string.
|
|
27
|
+
*/
|
|
28
|
+
getFingerprint(): Promise<string>;
|
|
29
|
+
}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Common interface defining system device information and hardware identifier retrieval APIs.
|
|
3
|
+
*/
|
|
4
|
+
export interface IDevice {
|
|
5
|
+
/** Reads the physical MAC address (or derived stable identifier) of the device. */
|
|
6
|
+
getMacAddress(): Promise<string>;
|
|
7
|
+
/** Reads the native unique device identifier (UUID / advertising ID / LocalStorage key). */
|
|
8
|
+
getDeviceId(): Promise<string>;
|
|
9
|
+
}
|
|
10
|
+
/**
|
|
11
|
+
* Cross-platform Device utility that delegates unique hardware identity and address querying
|
|
12
|
+
* to native Capacitor modules, Electron system layers, or persistent Web local storage keys.
|
|
13
|
+
*/
|
|
14
|
+
export declare class Device implements IDevice {
|
|
15
|
+
private impl;
|
|
16
|
+
private static _instance;
|
|
17
|
+
private constructor();
|
|
18
|
+
/**
|
|
19
|
+
* Singleton instance of the Device utility.
|
|
20
|
+
*/
|
|
21
|
+
static get instance(): Device;
|
|
22
|
+
/**
|
|
23
|
+
* Retrieves the physical network interface MAC address of the host machine (desktop)
|
|
24
|
+
* or a derived stable custom MAC identifier matching the hardware device profile.
|
|
25
|
+
* @returns A promise resolving to the MAC address string.
|
|
26
|
+
*/
|
|
27
|
+
getMacAddress(): Promise<string>;
|
|
28
|
+
/**
|
|
29
|
+
* Retrieves a platform-specific persistent unique device identifier.
|
|
30
|
+
* @returns A promise resolving to the device ID string.
|
|
31
|
+
*/
|
|
32
|
+
getDeviceId(): Promise<string>;
|
|
33
|
+
}
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
import { WriteFileOptions, ReadFileOptions, ReadFileResult, GetUriOptions, GetUriResult, StatOptions, StatResult } from "@capacitor/filesystem";
|
|
2
|
+
/**
|
|
3
|
+
* Common interface defining local file-system operations (reading, writing, deleting).
|
|
4
|
+
*/
|
|
5
|
+
export interface IFileSystem {
|
|
6
|
+
/** Requests storage/filesystem read/write permissions from the user. */
|
|
7
|
+
requestPermission(): Promise<boolean>;
|
|
8
|
+
/** Writes text data to a specific file path. */
|
|
9
|
+
write(...args: any[]): Promise<void>;
|
|
10
|
+
/** Reads text content from a specific file path. */
|
|
11
|
+
read(...args: any[]): Promise<string | any>;
|
|
12
|
+
/** Deletes the specified file from storage. */
|
|
13
|
+
delete(path: string): Promise<void>;
|
|
14
|
+
/** Checks whether a file exists at the specified path. */
|
|
15
|
+
exists(path: string): Promise<boolean>;
|
|
16
|
+
}
|
|
17
|
+
export declare class WebFileSystem implements IFileSystem {
|
|
18
|
+
requestPermission(): Promise<any>;
|
|
19
|
+
write(path: string, data: string): Promise<void>;
|
|
20
|
+
read(path: string): Promise<string>;
|
|
21
|
+
delete(path: string): Promise<void>;
|
|
22
|
+
exists(path: string): Promise<boolean>;
|
|
23
|
+
}
|
|
24
|
+
export interface ICapacitorFileSystem extends IFileSystem {
|
|
25
|
+
write(options: WriteFileOptions): Promise<void>;
|
|
26
|
+
read(options: ReadFileOptions): Promise<ReadFileResult>;
|
|
27
|
+
getUri(options: GetUriOptions): Promise<GetUriResult>;
|
|
28
|
+
stat(option: StatOptions): Promise<StatResult>;
|
|
29
|
+
}
|
|
30
|
+
export declare class CapacitorFileSystem implements ICapacitorFileSystem {
|
|
31
|
+
requestPermission(): Promise<boolean>;
|
|
32
|
+
write(options: WriteFileOptions): Promise<void>;
|
|
33
|
+
read(options: ReadFileOptions): Promise<ReadFileResult>;
|
|
34
|
+
delete(path: string): Promise<void>;
|
|
35
|
+
exists(path: string): Promise<boolean>;
|
|
36
|
+
getUri(options: GetUriOptions): Promise<GetUriResult>;
|
|
37
|
+
stat(option: StatOptions): Promise<import("@capacitor/filesystem").FileInfo>;
|
|
38
|
+
}
|
|
39
|
+
export declare class ElectronFileSystem implements IFileSystem {
|
|
40
|
+
requestPermission(): Promise<boolean>;
|
|
41
|
+
write(path: string, data: string): Promise<void>;
|
|
42
|
+
read(path: string): Promise<string>;
|
|
43
|
+
delete(path: string): Promise<void>;
|
|
44
|
+
exists(path: string): Promise<boolean>;
|
|
45
|
+
}
|
|
46
|
+
/**
|
|
47
|
+
* Cross-platform FileSystem utility that delegates persistent local read/write file transactions
|
|
48
|
+
* to native Capacitor plugins, Electron preload APIs, or falling back to Web localStorage.
|
|
49
|
+
*/
|
|
50
|
+
export declare class FileSystem implements IFileSystem {
|
|
51
|
+
private impl;
|
|
52
|
+
private static _instance;
|
|
53
|
+
/**
|
|
54
|
+
* Singleton instance of the FileSystem utility.
|
|
55
|
+
*/
|
|
56
|
+
static get instance(): IFileSystem;
|
|
57
|
+
/**
|
|
58
|
+
* Requests native filesystem permissions on the current device.
|
|
59
|
+
* @returns A promise resolving to true if permissions were granted.
|
|
60
|
+
*/
|
|
61
|
+
requestPermission(): Promise<boolean>;
|
|
62
|
+
/**
|
|
63
|
+
* Writes text or data to a specific file.
|
|
64
|
+
* @param path Target relative path of the file.
|
|
65
|
+
* @param data Raw content or options to write.
|
|
66
|
+
*/
|
|
67
|
+
write(path: string, data: string): Promise<void>;
|
|
68
|
+
/**
|
|
69
|
+
* Reads text or data from a specific file.
|
|
70
|
+
* @param path Target relative path of the file.
|
|
71
|
+
* @returns A promise resolving to the read contents.
|
|
72
|
+
*/
|
|
73
|
+
read(path: string): Promise<any>;
|
|
74
|
+
/**
|
|
75
|
+
* Deletes a file from the device storage.
|
|
76
|
+
* @param path Target relative path to delete.
|
|
77
|
+
*/
|
|
78
|
+
delete(path: string): Promise<void>;
|
|
79
|
+
/**
|
|
80
|
+
* Verifies if a file exists at the specified path.
|
|
81
|
+
* @param path Target relative path to test.
|
|
82
|
+
* @returns A promise resolving to true if the file exists, false otherwise.
|
|
83
|
+
*/
|
|
84
|
+
exists(path: string): Promise<boolean>;
|
|
85
|
+
}
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Common interface defining gyroscope angular rotation rate tracking APIs.
|
|
3
|
+
*/
|
|
4
|
+
export interface IGyroscope {
|
|
5
|
+
/** Starts listening to the gyroscope sensor streams. */
|
|
6
|
+
start(callback: (data: {
|
|
7
|
+
alpha: number | null;
|
|
8
|
+
beta: number | null;
|
|
9
|
+
gamma: number | null;
|
|
10
|
+
}) => void): void;
|
|
11
|
+
/** Stops listening to the gyroscope sensor streams. */
|
|
12
|
+
stop(): void;
|
|
13
|
+
}
|
|
14
|
+
export declare class WebGyroscope implements IGyroscope {
|
|
15
|
+
private handler?;
|
|
16
|
+
start(callback: (data: {
|
|
17
|
+
alpha: number | null;
|
|
18
|
+
beta: number | null;
|
|
19
|
+
gamma: number | null;
|
|
20
|
+
}) => void): void;
|
|
21
|
+
stop(): void;
|
|
22
|
+
}
|
|
23
|
+
export declare class CapacitorGyroscope extends WebGyroscope implements IGyroscope {
|
|
24
|
+
}
|
|
25
|
+
export declare class ElectronGyroscope extends WebGyroscope implements IGyroscope {
|
|
26
|
+
}
|
|
27
|
+
/**
|
|
28
|
+
* Cross-platform Gyroscope sensor tracking utility that delegates angular velocity queries
|
|
29
|
+
* to native Capacitor plugins, Electron, or Web DeviceOrientation APIs depending on the environment.
|
|
30
|
+
*/
|
|
31
|
+
export declare class Gryoscope implements IGyroscope {
|
|
32
|
+
private static _instance;
|
|
33
|
+
private impl;
|
|
34
|
+
private constructor();
|
|
35
|
+
/**
|
|
36
|
+
* Singleton instance of the Gyroscope tracker.
|
|
37
|
+
*/
|
|
38
|
+
static get instance(): Gryoscope;
|
|
39
|
+
/**
|
|
40
|
+
* Starts listening to gyroscope rotation rate events.
|
|
41
|
+
* @param callback Callback function receiving rotation speed on alpha, beta, and gamma axes.
|
|
42
|
+
*/
|
|
43
|
+
start(callback: (data: {
|
|
44
|
+
alpha: number | null;
|
|
45
|
+
beta: number | null;
|
|
46
|
+
gamma: number | null;
|
|
47
|
+
}) => void): void;
|
|
48
|
+
/**
|
|
49
|
+
* Stops listening to gyroscope events and releases sensor listeners.
|
|
50
|
+
*/
|
|
51
|
+
stop(): void;
|
|
52
|
+
}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
export * from './camera.js';
|
|
2
|
+
export * from './notification.js';
|
|
3
|
+
export * from './platform.js';
|
|
4
|
+
export * from './filesystem.js';
|
|
5
|
+
export * from './database.js';
|
|
6
|
+
export * from './location.js';
|
|
7
|
+
export * from './notification.js';
|
|
8
|
+
export * from './permissions.js';
|
|
9
|
+
export * from './network.js';
|
|
10
|
+
export * from './bluetooth.js';
|
|
11
|
+
export * from './clipboard.js';
|
|
12
|
+
export * from './battery.js';
|
|
13
|
+
export * from './system.js';
|
|
14
|
+
export * from './vibration.js';
|
|
15
|
+
export * from './microphone.js';
|
|
16
|
+
export * from './orientation.js';
|
|
17
|
+
export * from './background-location.js';
|
|
18
|
+
export * from './sqlite.js';
|
|
19
|
+
export * from './printer.js';
|
|
20
|
+
export * from './firebase.js';
|
|
21
|
+
export * from './backend-api.js';
|
|
22
|
+
export * from './assets.js';
|
|
23
|
+
export * from './number-formatter.js';
|
|
24
|
+
export * from './system-locale.js';
|
|
25
|
+
export * from './device-class-tier.js';
|
|
26
|
+
export * from './user-hand-behavior.js';
|
|
27
|
+
export * from './gyroscope.js';
|
|
28
|
+
export * from './accelerometer.js';
|
|
29
|
+
export * from './motion-orientation.js';
|
|
30
|
+
export * from './plugin-api.js';
|
|
31
|
+
export * from './device.js';
|
|
32
|
+
export * from './device-fingerprint.js';
|