@aippy/runtime 0.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/README.md +117 -0
- package/dist/core/config.d.ts +13 -0
- package/dist/core/errors.d.ts +23 -0
- package/dist/core/index.d.ts +4 -0
- package/dist/core/index.js +59 -0
- package/dist/core/types.d.ts +51 -0
- package/dist/core/version.d.ts +13 -0
- package/dist/core.d.ts +2 -0
- package/dist/device/camera.d.ts +27 -0
- package/dist/device/file-system.d.ts +42 -0
- package/dist/device/geolocation.d.ts +26 -0
- package/dist/device/haptics.d.ts +27 -0
- package/dist/device/index.d.ts +6 -0
- package/dist/device/index.js +457 -0
- package/dist/device/sensors.d.ts +38 -0
- package/dist/device/types.d.ts +74 -0
- package/dist/device.d.ts +2 -0
- package/dist/errors-DAz5_jDJ.js +25 -0
- package/dist/index/index.js +33 -0
- package/dist/index.d.ts +4 -0
- package/dist/pwa-BkviTQoN.js +408 -0
- package/dist/tweaks/index.d.ts +2 -0
- package/dist/tweaks/index.js +5 -0
- package/dist/tweaks/useTweaks.d.ts +10 -0
- package/dist/tweaks.d.ts +2 -0
- package/dist/useTweaks-mK5PAWOs.js +258 -0
- package/dist/utils/index.d.ts +4 -0
- package/dist/utils/index.js +9 -0
- package/dist/utils/performance.d.ts +52 -0
- package/dist/utils/platform.d.ts +52 -0
- package/dist/utils/pwa.d.ts +66 -0
- package/dist/utils/types.d.ts +41 -0
- package/dist/utils.d.ts +2 -0
- package/package.json +100 -0
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import { PerformanceMetrics } from './types';
|
|
2
|
+
/**
|
|
3
|
+
* Performance monitoring utilities
|
|
4
|
+
*/
|
|
5
|
+
export declare class PerformanceMonitor {
|
|
6
|
+
/**
|
|
7
|
+
* Get Core Web Vitals metrics
|
|
8
|
+
*/
|
|
9
|
+
getCoreWebVitals(): Promise<PerformanceMetrics>;
|
|
10
|
+
/**
|
|
11
|
+
* Get navigation timing metrics
|
|
12
|
+
*/
|
|
13
|
+
getNavigationTiming(): {
|
|
14
|
+
dns: number;
|
|
15
|
+
tcp: number;
|
|
16
|
+
request: number;
|
|
17
|
+
response: number;
|
|
18
|
+
domProcessing: number;
|
|
19
|
+
total: number;
|
|
20
|
+
} | null;
|
|
21
|
+
/**
|
|
22
|
+
* Get resource timing metrics
|
|
23
|
+
*/
|
|
24
|
+
getResourceTiming(): {
|
|
25
|
+
name: string;
|
|
26
|
+
duration: number;
|
|
27
|
+
size: number;
|
|
28
|
+
type: string;
|
|
29
|
+
}[];
|
|
30
|
+
/**
|
|
31
|
+
* Measure function execution time
|
|
32
|
+
*/
|
|
33
|
+
measureFunction<T>(fn: () => T, name?: string): T;
|
|
34
|
+
/**
|
|
35
|
+
* Measure async function execution time
|
|
36
|
+
*/
|
|
37
|
+
measureAsyncFunction<T>(fn: () => Promise<T>, name?: string): Promise<T>;
|
|
38
|
+
/**
|
|
39
|
+
* Get memory usage (if available)
|
|
40
|
+
*/
|
|
41
|
+
getMemoryUsage(): {
|
|
42
|
+
used: number;
|
|
43
|
+
total: number;
|
|
44
|
+
limit: number;
|
|
45
|
+
} | null;
|
|
46
|
+
private calculateTTI;
|
|
47
|
+
private getResourceType;
|
|
48
|
+
}
|
|
49
|
+
/**
|
|
50
|
+
* Performance monitor instance
|
|
51
|
+
*/
|
|
52
|
+
export declare const performanceMonitor: PerformanceMonitor;
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import { PlatformCapabilities } from './types';
|
|
2
|
+
interface PlatformInfo {
|
|
3
|
+
name: 'ios' | 'android' | 'windows' | 'macos' | 'linux' | 'unknown';
|
|
4
|
+
version?: string;
|
|
5
|
+
browser: 'chrome' | 'firefox' | 'safari' | 'edge' | 'unknown';
|
|
6
|
+
browserVersion?: string;
|
|
7
|
+
isMobile: boolean;
|
|
8
|
+
isDesktop: boolean;
|
|
9
|
+
}
|
|
10
|
+
/**
|
|
11
|
+
* Platform detection utilities
|
|
12
|
+
*/
|
|
13
|
+
export declare class PlatformDetector {
|
|
14
|
+
private parser;
|
|
15
|
+
constructor();
|
|
16
|
+
/**
|
|
17
|
+
* Get platform information
|
|
18
|
+
*/
|
|
19
|
+
getPlatformInfo(): PlatformInfo;
|
|
20
|
+
/**
|
|
21
|
+
* Get platform capabilities
|
|
22
|
+
*/
|
|
23
|
+
getCapabilities(): PlatformCapabilities;
|
|
24
|
+
/**
|
|
25
|
+
* Check if device is mobile
|
|
26
|
+
*/
|
|
27
|
+
isMobileDevice(): boolean;
|
|
28
|
+
/**
|
|
29
|
+
* Check if device supports touch
|
|
30
|
+
*/
|
|
31
|
+
isTouchDevice(): boolean;
|
|
32
|
+
/**
|
|
33
|
+
* Check if running in standalone mode (PWA)
|
|
34
|
+
*/
|
|
35
|
+
isStandalone(): boolean;
|
|
36
|
+
/**
|
|
37
|
+
* Check if running in iOS Safari
|
|
38
|
+
*/
|
|
39
|
+
isIOSSafari(): boolean;
|
|
40
|
+
/**
|
|
41
|
+
* Check if running in Android Chrome
|
|
42
|
+
*/
|
|
43
|
+
isAndroidChrome(): boolean;
|
|
44
|
+
private normalizePlatformName;
|
|
45
|
+
private normalizeBrowserName;
|
|
46
|
+
private getWebGLContext;
|
|
47
|
+
}
|
|
48
|
+
/**
|
|
49
|
+
* Platform detector instance
|
|
50
|
+
*/
|
|
51
|
+
export declare const platform: PlatformDetector;
|
|
52
|
+
export {};
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
import { PWAInfo } from './types';
|
|
2
|
+
/**
|
|
3
|
+
* PWA utilities
|
|
4
|
+
*/
|
|
5
|
+
export declare class PWAUtils {
|
|
6
|
+
/**
|
|
7
|
+
* Get PWA information
|
|
8
|
+
*/
|
|
9
|
+
getPWAInfo(): PWAInfo;
|
|
10
|
+
/**
|
|
11
|
+
* Check if PWA is installed
|
|
12
|
+
*/
|
|
13
|
+
isInstalled(): boolean;
|
|
14
|
+
/**
|
|
15
|
+
* Check if PWA is installable
|
|
16
|
+
*/
|
|
17
|
+
isInstallable(): boolean;
|
|
18
|
+
/**
|
|
19
|
+
* Check if install prompt is available
|
|
20
|
+
*/
|
|
21
|
+
canInstall(): boolean;
|
|
22
|
+
/**
|
|
23
|
+
* Check if running in standalone mode
|
|
24
|
+
*/
|
|
25
|
+
isStandalone(): boolean;
|
|
26
|
+
/**
|
|
27
|
+
* Check if running in app (iOS)
|
|
28
|
+
*/
|
|
29
|
+
isInApp(): boolean;
|
|
30
|
+
/**
|
|
31
|
+
* Register service worker
|
|
32
|
+
*/
|
|
33
|
+
registerServiceWorker(swPath: string): Promise<ServiceWorkerRegistration | null>;
|
|
34
|
+
/**
|
|
35
|
+
* Unregister service worker
|
|
36
|
+
*/
|
|
37
|
+
unregisterServiceWorker(): Promise<boolean>;
|
|
38
|
+
/**
|
|
39
|
+
* Request notification permission
|
|
40
|
+
*/
|
|
41
|
+
requestNotificationPermission(): Promise<NotificationPermission>;
|
|
42
|
+
/**
|
|
43
|
+
* Send notification
|
|
44
|
+
*/
|
|
45
|
+
sendNotification(title: string, options?: NotificationOptions): Promise<void>;
|
|
46
|
+
/**
|
|
47
|
+
* Share content using Web Share API
|
|
48
|
+
*/
|
|
49
|
+
share(data: ShareData): Promise<void>;
|
|
50
|
+
/**
|
|
51
|
+
* Copy text to clipboard
|
|
52
|
+
*/
|
|
53
|
+
copyToClipboard(text: string): Promise<void>;
|
|
54
|
+
/**
|
|
55
|
+
* Read text from clipboard
|
|
56
|
+
*/
|
|
57
|
+
readFromClipboard(): Promise<string>;
|
|
58
|
+
/**
|
|
59
|
+
* Get install prompt event
|
|
60
|
+
*/
|
|
61
|
+
getInstallPromptEvent(): Promise<Event>;
|
|
62
|
+
}
|
|
63
|
+
/**
|
|
64
|
+
* PWA utils instance
|
|
65
|
+
*/
|
|
66
|
+
export declare const pwa: PWAUtils;
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Utility types and interfaces
|
|
3
|
+
*/
|
|
4
|
+
export interface PerformanceMetrics {
|
|
5
|
+
/** First Contentful Paint */
|
|
6
|
+
fcp?: number;
|
|
7
|
+
/** Largest Contentful Paint */
|
|
8
|
+
lcp?: number;
|
|
9
|
+
/** First Input Delay */
|
|
10
|
+
fid?: number;
|
|
11
|
+
/** Cumulative Layout Shift */
|
|
12
|
+
cls?: number;
|
|
13
|
+
/** Time to Interactive */
|
|
14
|
+
tti?: number;
|
|
15
|
+
}
|
|
16
|
+
export interface PWAInfo {
|
|
17
|
+
/** Is PWA installed */
|
|
18
|
+
isInstalled: boolean;
|
|
19
|
+
/** Is PWA installable */
|
|
20
|
+
isInstallable: boolean;
|
|
21
|
+
/** PWA install prompt available */
|
|
22
|
+
canInstall: boolean;
|
|
23
|
+
/** Standalone mode */
|
|
24
|
+
isStandalone: boolean;
|
|
25
|
+
}
|
|
26
|
+
export interface PlatformCapabilities {
|
|
27
|
+
/** Service Worker support */
|
|
28
|
+
serviceWorker: boolean;
|
|
29
|
+
/** Push notifications support */
|
|
30
|
+
pushNotifications: boolean;
|
|
31
|
+
/** Web Share API support */
|
|
32
|
+
webShare: boolean;
|
|
33
|
+
/** Clipboard API support */
|
|
34
|
+
clipboard: boolean;
|
|
35
|
+
/** WebRTC support */
|
|
36
|
+
webRTC: boolean;
|
|
37
|
+
/** WebGL support */
|
|
38
|
+
webGL: boolean;
|
|
39
|
+
/** WebAssembly support */
|
|
40
|
+
webAssembly: boolean;
|
|
41
|
+
}
|
package/dist/utils.d.ts
ADDED
package/package.json
ADDED
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@aippy/runtime",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"description": "Aippy Runtime SDK - Runtime SDK for Aippy projects",
|
|
5
|
+
"private": false,
|
|
6
|
+
"type": "module",
|
|
7
|
+
"main": "./dist/index.js",
|
|
8
|
+
"module": "./dist/index.js",
|
|
9
|
+
"types": "./dist/index.d.ts",
|
|
10
|
+
"exports": {
|
|
11
|
+
".": {
|
|
12
|
+
"import": "./dist/index.js",
|
|
13
|
+
"types": "./dist/index.d.ts"
|
|
14
|
+
},
|
|
15
|
+
"./core": {
|
|
16
|
+
"import": "./dist/core/index.js",
|
|
17
|
+
"types": "./dist/core/index.d.ts"
|
|
18
|
+
},
|
|
19
|
+
"./device": {
|
|
20
|
+
"import": "./dist/device/index.js",
|
|
21
|
+
"types": "./dist/device/index.d.ts"
|
|
22
|
+
},
|
|
23
|
+
"./utils": {
|
|
24
|
+
"import": "./dist/utils/index.js",
|
|
25
|
+
"types": "./dist/utils/index.d.ts"
|
|
26
|
+
},
|
|
27
|
+
"./tweaks": {
|
|
28
|
+
"import": "./dist/tweaks/index.js",
|
|
29
|
+
"types": "./dist/tweaks/index.d.ts"
|
|
30
|
+
}
|
|
31
|
+
},
|
|
32
|
+
"files": [
|
|
33
|
+
"dist",
|
|
34
|
+
"README.md"
|
|
35
|
+
],
|
|
36
|
+
"publishConfig": {
|
|
37
|
+
"access": "public"
|
|
38
|
+
},
|
|
39
|
+
"keywords": [
|
|
40
|
+
"aippy",
|
|
41
|
+
"runtime",
|
|
42
|
+
"sdk",
|
|
43
|
+
"typescript",
|
|
44
|
+
"frontend",
|
|
45
|
+
"web"
|
|
46
|
+
],
|
|
47
|
+
"author": "Aippy Team",
|
|
48
|
+
"license": "UNLICENSED",
|
|
49
|
+
"homepage": "https://aippy.ai",
|
|
50
|
+
"bugs": {
|
|
51
|
+
"url": "https://discord.com/invite/G94ZAx6gVq"
|
|
52
|
+
},
|
|
53
|
+
"devDependencies": {
|
|
54
|
+
"@types/node": "^24.5.2",
|
|
55
|
+
"@types/react": "^19.2.2",
|
|
56
|
+
"@types/ua-parser-js": "^0.7.39",
|
|
57
|
+
"@typescript-eslint/eslint-plugin": "^8.44.1",
|
|
58
|
+
"@typescript-eslint/parser": "^8.44.1",
|
|
59
|
+
"eslint": "^9.36.0",
|
|
60
|
+
"prettier": "^3.6.2",
|
|
61
|
+
"react": "^19.1.1",
|
|
62
|
+
"typescript": "^5.9.2",
|
|
63
|
+
"vite": "^7.1.7",
|
|
64
|
+
"vite-plugin-dts": "^4.5.4"
|
|
65
|
+
},
|
|
66
|
+
"dependencies": {
|
|
67
|
+
"ua-parser-js": "^2.0.5"
|
|
68
|
+
},
|
|
69
|
+
"peerDependencies": {
|
|
70
|
+
"react": "^19.1.1",
|
|
71
|
+
"typescript": ">=5.0.0"
|
|
72
|
+
},
|
|
73
|
+
"engines": {
|
|
74
|
+
"node": ">=20.0.0",
|
|
75
|
+
"pnpm": ">=10.0.0"
|
|
76
|
+
},
|
|
77
|
+
"scripts": {
|
|
78
|
+
"dev": "vite build --watch",
|
|
79
|
+
"build": "vite build && find dist -name '*.d.ts.map' -delete",
|
|
80
|
+
"type-check": "tsc --noEmit",
|
|
81
|
+
"lint": "eslint src --ext .ts,.tsx",
|
|
82
|
+
"lint:fix": "eslint src --ext .ts,.tsx --fix",
|
|
83
|
+
"format": "prettier --write \"src/**/*.{ts,tsx,json,md}\"",
|
|
84
|
+
"format:check": "prettier --check \"src/**/*.{ts,tsx,json,md}\"",
|
|
85
|
+
"clean": "rm -rf dist",
|
|
86
|
+
"publish:patch": "pnpm version patch && pnpm publish --no-git-checks",
|
|
87
|
+
"publish:minor": "pnpm version minor && pnpm publish --no-git-checks",
|
|
88
|
+
"publish:major": "pnpm version major && pnpm publish --no-git-checks",
|
|
89
|
+
"publish:alpha": "pnpm version prerelease --preid=alpha && pnpm publish --tag alpha --no-git-checks",
|
|
90
|
+
"publish:beta": "pnpm version prerelease --preid=beta && pnpm publish --tag beta --no-git-checks",
|
|
91
|
+
"publish:rc": "pnpm version prerelease --preid=rc && pnpm publish --tag rc --no-git-checks",
|
|
92
|
+
"publish:dev": "pnpm version prerelease --preid=dev && pnpm publish --tag dev --no-git-checks",
|
|
93
|
+
"audit": "pnpm audit --audit-level moderate",
|
|
94
|
+
"audit:fix": "pnpm audit --fix",
|
|
95
|
+
"security:check": "pnpm audit && pnpm outdated",
|
|
96
|
+
"prerelease": "pnpm run audit && pnpm run type-check && pnpm run lint && pnpm run build",
|
|
97
|
+
"release:dry": "npm publish --dry-run",
|
|
98
|
+
"test:build": "node -e \"require('./dist/index.js')\""
|
|
99
|
+
}
|
|
100
|
+
}
|