@limrun/ui 0.4.0-rc.8 → 0.4.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/src/demo.tsx DELETED
@@ -1,192 +0,0 @@
1
- import { useState, useRef } from 'react';
2
- import { createRoot } from 'react-dom/client';
3
- import { RemoteControl, RemoteControlHandle } from './components/remote-control';
4
-
5
- function Demo() {
6
- const [url, setUrl] = useState('wss://eu-hel1-5-staging.limrun.dev/v1/ios_eustg_01kd7xz7wnecrr3qtc0mp9pyb4/endpointWebSocket');
7
- const [token, setToken] = useState('lim_e38efd8b6b38733e268514a866e7b568d1bdc106632bfc9f');
8
- const [platform, setPlatform] = useState<'ios' | 'android'>('ios');
9
- const [isConnected, setIsConnected] = useState(false);
10
- const [key, setKey] = useState(0);
11
- const [showDebugInfo, setShowDebugInfo] = useState(false);
12
-
13
- const remoteControlRef = useRef<RemoteControlHandle>(null);
14
-
15
- const handleConnect = () => {
16
- if (url) {
17
- setIsConnected(true);
18
- // Force remount by changing key
19
- setKey(prev => prev + 1);
20
- }
21
- };
22
-
23
- const handleDisconnect = () => {
24
- setIsConnected(false);
25
- setKey(prev => prev + 1);
26
- };
27
-
28
- const handleScreenshot = async () => {
29
- if (remoteControlRef.current) {
30
- try {
31
- const screenshot = await remoteControlRef.current.screenshot();
32
- // Open screenshot in new window
33
- const win = window.open();
34
- if (win) {
35
- win.document.write(`<img src="${screenshot.dataUri}" style="max-width: 100%;" />`);
36
- }
37
- } catch (error) {
38
- console.error('Screenshot failed:', error);
39
- alert('Screenshot failed: ' + (error as Error).message);
40
- }
41
- }
42
- };
43
-
44
- return (
45
- <>
46
- <div className="header">
47
- <h1>📱 RemoteControl Component Demo</h1>
48
- <p>Test the iOS device frame and remote control features</p>
49
- </div>
50
-
51
- <div className="demo-container">
52
- <div className="info-box">
53
- <h4>â„šī¸ How to Use:</h4>
54
- <p>
55
- Enter your WebSocket URL and authentication token below, select iOS or Android platform,
56
- then click Connect to see the remote control in action. The iOS platform will display
57
- a realistic iPhone frame around the stream.
58
- </p>
59
- <p style={{ marginTop: '10px', fontWeight: 600 }}>
60
- ✨ iOS Feature: Touches can start from the bottom bezel area (below the screen, near the
61
- home indicator) to enable authentic iOS swipe-up gestures for going home or switching apps!
62
- </p>
63
- </div>
64
-
65
- <div className="controls">
66
- <div className="control-group">
67
- <label htmlFor="url">WebSocket URL</label>
68
- <input
69
- id="url"
70
- type="text"
71
- value={url}
72
- onChange={(e) => setUrl(e.target.value)}
73
- placeholder="wss://your-instance.limrun.com/control"
74
- disabled={isConnected}
75
- />
76
- </div>
77
-
78
- <div className="control-group">
79
- <label htmlFor="token">Authentication Token</label>
80
- <input
81
- id="token"
82
- type="password"
83
- value={token}
84
- onChange={(e) => setToken(e.target.value)}
85
- placeholder="Enter your token"
86
- disabled={isConnected}
87
- />
88
- </div>
89
-
90
- <div className="control-group">
91
- <label htmlFor="platform">Platform</label>
92
- <select
93
- id="platform"
94
- value={platform}
95
- onChange={(e) => setPlatform(e.target.value as 'ios' | 'android')}
96
- disabled={isConnected}
97
- >
98
- <option value="ios">iOS (with frame)</option>
99
- <option value="android">Android (no frame)</option>
100
- </select>
101
- </div>
102
-
103
- <div className="control-group">
104
- <label style={{ display: 'flex', alignItems: 'center', gap: '8px', cursor: 'pointer' }}>
105
- <input
106
- type="checkbox"
107
- checked={showDebugInfo}
108
- onChange={(e) => setShowDebugInfo(e.target.checked)}
109
- style={{ cursor: 'pointer' }}
110
- />
111
- Show iOS Extended Touch Area Info
112
- </label>
113
- </div>
114
-
115
- <div className="button-group">
116
- {!isConnected ? (
117
- <button
118
- className="primary"
119
- onClick={handleConnect}
120
- disabled={!url}
121
- >
122
- Connect
123
- </button>
124
- ) : (
125
- <>
126
- <button className="secondary" onClick={handleDisconnect}>
127
- Disconnect
128
- </button>
129
- <button className="primary" onClick={handleScreenshot}>
130
- Take Screenshot
131
- </button>
132
- </>
133
- )}
134
- </div>
135
- </div>
136
-
137
- {showDebugInfo && platform === 'ios' && (
138
- <div style={{
139
- background: '#e0f2fe',
140
- border: '2px solid #0284c7',
141
- borderRadius: '8px',
142
- padding: '15px',
143
- marginBottom: '20px'
144
- }}>
145
- <h4 style={{ color: '#0c4a6e', marginBottom: '8px', fontSize: '0.95rem' }}>
146
- 🔧 iOS Extended Touch Area
147
- </h4>
148
- <p style={{ color: '#075985', fontSize: '0.9rem', lineHeight: '1.5', margin: 0 }}>
149
- The iOS frame includes a <strong>60-pixel extended touch area</strong> below the visible screen.
150
- This area (where the home indicator is located) can receive touch events and sends coordinates
151
- beyond the screen bounds (y &gt; screenHeight), allowing iOS to properly detect gestures that
152
- start from outside the screen - just like on a real iPhone. Try starting a swipe gesture from
153
- the home indicator area!
154
- </p>
155
- </div>
156
- )}
157
-
158
- {isConnected ? (
159
- <div className="device-preview">
160
- <div className="preview-item">
161
- <h3>{platform === 'ios' ? '📱 iOS with Frame' : '🤖 Android (No Frame)'}</h3>
162
- <div className="device-wrapper">
163
- <RemoteControl
164
- key={key}
165
- ref={remoteControlRef}
166
- url={url}
167
- token={token}
168
- />
169
- </div>
170
- </div>
171
- </div>
172
- ) : (
173
- <div style={{
174
- textAlign: 'center',
175
- padding: '60px 20px',
176
- color: '#9ca3af',
177
- fontSize: '1.1rem'
178
- }}>
179
- Enter your connection details above and click Connect to start
180
- </div>
181
- )}
182
- </div>
183
- </>
184
- );
185
- }
186
-
187
- // Mount the demo app
188
- const container = document.getElementById('root');
189
- if (container) {
190
- const root = createRoot(container);
191
- root.render(<Demo />);
192
- }
package/src/image.png DELETED
Binary file
package/src/landscape.png DELETED
Binary file
package/src/portrait.png DELETED
Binary file