@therealtinhtute/baroiplayer 1.0.4 → 1.0.6
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 +38 -1
- package/dist/package.json +22 -2
- package/dist/src/components/media-player-controls.js +1 -1
- package/dist/src/components/media-player-controls.tsx +1 -1
- package/dist/src/components/media-player-error.js +2 -2
- package/dist/src/components/media-player-error.tsx +2 -2
- package/dist/src/components/media-player-fullscreen.js +2 -2
- package/dist/src/components/media-player-fullscreen.tsx +2 -2
- package/dist/src/components/media-player-play.js +2 -2
- package/dist/src/components/media-player-play.tsx +2 -2
- package/dist/src/components/media-player-root.js +1 -1
- package/dist/src/components/media-player-root.tsx +1 -1
- package/dist/src/components/media-player-seek.js +1 -1
- package/dist/src/components/media-player-seek.tsx +1 -1
- package/dist/src/components/media-player-tooltip.js +1 -1
- package/dist/src/components/media-player-tooltip.tsx +1 -1
- package/dist/src/components/media-player-volume.js +2 -2
- package/dist/src/components/media-player-volume.tsx +3 -3
- package/dist/src/components/react-player-wrapper.js +5 -5
- package/dist/src/components/react-player-wrapper.tsx +5 -5
- package/dist/src/components/ui/button.tsx +49 -0
- package/dist/src/components/ui/dropdown-menu.tsx +137 -0
- package/dist/src/components/ui/icons.tsx +174 -0
- package/dist/src/components/ui/slider.tsx +55 -0
- package/dist/src/components/ui/tooltip.tsx +131 -0
- package/dist/src/hooks/use-mobile.ts +125 -0
- package/dist/src/hooks/use-touch-gestures.js +1 -1
- package/dist/src/hooks/use-touch-gestures.ts +1 -1
- package/package.json +22 -2
- package/src/components/media-player-controls.js +1 -1
- package/src/components/media-player-controls.tsx +1 -1
- package/src/components/media-player-error.js +2 -2
- package/src/components/media-player-error.tsx +2 -2
- package/src/components/media-player-fullscreen.js +2 -2
- package/src/components/media-player-fullscreen.tsx +2 -2
- package/src/components/media-player-play.js +2 -2
- package/src/components/media-player-play.tsx +2 -2
- package/src/components/media-player-root.js +1 -1
- package/src/components/media-player-root.tsx +1 -1
- package/src/components/media-player-seek.js +1 -1
- package/src/components/media-player-seek.tsx +1 -1
- package/src/components/media-player-tooltip.js +1 -1
- package/src/components/media-player-tooltip.tsx +1 -1
- package/src/components/media-player-volume.js +2 -2
- package/src/components/media-player-volume.tsx +3 -3
- package/src/components/react-player-wrapper.js +5 -5
- package/src/components/react-player-wrapper.tsx +5 -5
- package/src/components/ui/button.tsx +49 -0
- package/src/components/ui/dropdown-menu.tsx +137 -0
- package/src/components/ui/icons.tsx +174 -0
- package/src/components/ui/slider.tsx +55 -0
- package/src/components/ui/tooltip.tsx +131 -0
- package/src/hooks/use-mobile.ts +125 -0
- package/src/hooks/use-touch-gestures.js +1 -1
- package/src/hooks/use-touch-gestures.ts +1 -1
|
@@ -0,0 +1,125 @@
|
|
|
1
|
+
import { useState, useEffect } from 'react';
|
|
2
|
+
|
|
3
|
+
interface DeviceInfo {
|
|
4
|
+
isMobile: boolean;
|
|
5
|
+
isTablet: boolean;
|
|
6
|
+
isDesktop: boolean;
|
|
7
|
+
userAgent: string;
|
|
8
|
+
screenWidth: number;
|
|
9
|
+
screenHeight: number;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
export function useDeviceInfo(): DeviceInfo {
|
|
13
|
+
const [deviceInfo, setDeviceInfo] = useState<DeviceInfo>(() => {
|
|
14
|
+
if (typeof window === 'undefined') {
|
|
15
|
+
return {
|
|
16
|
+
isMobile: false,
|
|
17
|
+
isTablet: false,
|
|
18
|
+
isDesktop: true,
|
|
19
|
+
userAgent: '',
|
|
20
|
+
screenWidth: 1920,
|
|
21
|
+
screenHeight: 1080
|
|
22
|
+
};
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
const userAgent = navigator.userAgent;
|
|
26
|
+
const screenWidth = window.innerWidth;
|
|
27
|
+
const screenHeight = window.innerHeight;
|
|
28
|
+
|
|
29
|
+
const isMobile = /Android|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(userAgent) && screenWidth < 768;
|
|
30
|
+
const isTablet = /iPad|Android/i.test(userAgent) && screenWidth >= 768 && screenWidth < 1024;
|
|
31
|
+
const isDesktop = !isMobile && !isTablet;
|
|
32
|
+
|
|
33
|
+
return {
|
|
34
|
+
isMobile,
|
|
35
|
+
isTablet,
|
|
36
|
+
isDesktop,
|
|
37
|
+
userAgent,
|
|
38
|
+
screenWidth,
|
|
39
|
+
screenHeight
|
|
40
|
+
};
|
|
41
|
+
});
|
|
42
|
+
|
|
43
|
+
useEffect(() => {
|
|
44
|
+
if (typeof window === 'undefined') return;
|
|
45
|
+
|
|
46
|
+
const handleResize = () => {
|
|
47
|
+
const userAgent = navigator.userAgent;
|
|
48
|
+
const screenWidth = window.innerWidth;
|
|
49
|
+
const screenHeight = window.innerHeight;
|
|
50
|
+
|
|
51
|
+
const isMobile = /Android|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(userAgent) && screenWidth < 768;
|
|
52
|
+
const isTablet = /iPad|Android/i.test(userAgent) && screenWidth >= 768 && screenWidth < 1024;
|
|
53
|
+
const isDesktop = !isMobile && !isTablet;
|
|
54
|
+
|
|
55
|
+
setDeviceInfo({
|
|
56
|
+
isMobile,
|
|
57
|
+
isTablet,
|
|
58
|
+
isDesktop,
|
|
59
|
+
userAgent,
|
|
60
|
+
screenWidth,
|
|
61
|
+
screenHeight
|
|
62
|
+
});
|
|
63
|
+
};
|
|
64
|
+
|
|
65
|
+
window.addEventListener('resize', handleResize);
|
|
66
|
+
return () => window.removeEventListener('resize', handleResize);
|
|
67
|
+
}, []);
|
|
68
|
+
|
|
69
|
+
return deviceInfo;
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
export function useContainerQuery(): boolean {
|
|
73
|
+
const [isSmall, setIsSmall] = useState(false);
|
|
74
|
+
|
|
75
|
+
useEffect(() => {
|
|
76
|
+
if (typeof window === 'undefined') return;
|
|
77
|
+
|
|
78
|
+
const checkSize = () => {
|
|
79
|
+
setIsSmall(window.innerWidth < 640);
|
|
80
|
+
};
|
|
81
|
+
|
|
82
|
+
checkSize();
|
|
83
|
+
window.addEventListener('resize', checkSize);
|
|
84
|
+
return () => window.removeEventListener('resize', checkSize);
|
|
85
|
+
}, []);
|
|
86
|
+
|
|
87
|
+
return isSmall;
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
export function useMobileOptimizations() {
|
|
91
|
+
const deviceInfo = useDeviceInfo();
|
|
92
|
+
const [isTouch, setIsTouch] = useState(false);
|
|
93
|
+
|
|
94
|
+
useEffect(() => {
|
|
95
|
+
setIsTouch('ontouchstart' in window || navigator.maxTouchPoints > 0);
|
|
96
|
+
}, []);
|
|
97
|
+
|
|
98
|
+
return {
|
|
99
|
+
...deviceInfo,
|
|
100
|
+
isTouch,
|
|
101
|
+
preferReducedMotion: window.matchMedia('(prefers-reduced-motion: reduce)').matches,
|
|
102
|
+
prefersDarkScheme: window.matchMedia('(prefers-color-scheme: dark)').matches
|
|
103
|
+
};
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
export function useHapticFeedback() {
|
|
107
|
+
const deviceInfo = useDeviceInfo();
|
|
108
|
+
|
|
109
|
+
const triggerHaptic = (type: 'light' | 'medium' | 'heavy' = 'light') => {
|
|
110
|
+
if (!deviceInfo.isMobile || !('vibrate' in navigator)) return;
|
|
111
|
+
|
|
112
|
+
const patterns = {
|
|
113
|
+
light: [10],
|
|
114
|
+
medium: [20],
|
|
115
|
+
heavy: [50]
|
|
116
|
+
};
|
|
117
|
+
|
|
118
|
+
navigator.vibrate(patterns[type]);
|
|
119
|
+
};
|
|
120
|
+
|
|
121
|
+
return {
|
|
122
|
+
triggerHaptic,
|
|
123
|
+
supported: deviceInfo.isMobile && 'vibrate' in navigator
|
|
124
|
+
};
|
|
125
|
+
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import * as React from "react";
|
|
3
|
-
import { useDeviceInfo, useHapticFeedback } from "
|
|
3
|
+
import { useDeviceInfo, useHapticFeedback } from "./use-mobile";
|
|
4
4
|
// Default configuration
|
|
5
5
|
const defaultConfig = {
|
|
6
6
|
enabledGestures: ['tap', 'double-tap', 'long-press', 'swipe-left', 'swipe-right', 'swipe-up', 'swipe-down', 'pinch-in', 'pinch-out'],
|