@limrun/ui 0.4.0-rc.6 → 0.4.0-rc.7

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@limrun/ui",
3
- "version": "0.4.0-rc.6",
3
+ "version": "0.4.0-rc.7",
4
4
  "publishConfig": {
5
5
  "access": "public"
6
6
  },
@@ -27,6 +27,13 @@
27
27
  background-color: black;
28
28
  }
29
29
 
30
+ .rc-video-frameless {
31
+ position: relative;
32
+ height: 100%;
33
+ top: auto;
34
+ left: auto;
35
+ }
36
+
30
37
  .rc-video-loading {
31
38
  aspect-ratio: 9 / 19.5;
32
39
  }
@@ -41,6 +41,10 @@ interface RemoteControlProps {
41
41
  //
42
42
  // If not provided, the component will not open any URL.
43
43
  openUrl?: string;
44
+
45
+ // showFrame controls whether to display the device frame
46
+ // around the video. Defaults to true.
47
+ showFrame?: boolean;
44
48
  }
45
49
 
46
50
  interface ScreenshotData {
@@ -131,7 +135,7 @@ function getAndroidKeycodeAndMeta(event: React.KeyboardEvent): { keycode: number
131
135
  }
132
136
 
133
137
  export const RemoteControl = forwardRef<RemoteControlHandle, RemoteControlProps>(
134
- ({ className, url, token, sessionId: propSessionId, openUrl }: RemoteControlProps, ref) => {
138
+ ({ className, url, token, sessionId: propSessionId, openUrl, showFrame = true }: RemoteControlProps, ref) => {
135
139
  const videoRef = useRef<HTMLVideoElement>(null);
136
140
  const frameRef = useRef<HTMLImageElement>(null);
137
141
  const [videoLoaded, setVideoLoaded] = useState(false);
@@ -779,7 +783,7 @@ export const RemoteControl = forwardRef<RemoteControlHandle, RemoteControlProps>
779
783
  useEffect(() => {
780
784
  const video = videoRef.current;
781
785
  const frame = frameRef.current;
782
- if (!video || !frame) return;
786
+ if (!video || !frame || !showFrame) return;
783
787
 
784
788
  const resizeObserver = new ResizeObserver((entries) => {
785
789
  for (const entry of entries) {
@@ -799,7 +803,7 @@ export const RemoteControl = forwardRef<RemoteControlHandle, RemoteControlProps>
799
803
  return () => {
800
804
  resizeObserver.disconnect();
801
805
  };
802
- }, [config]);
806
+ }, [config, showFrame]);
803
807
 
804
808
  const handleVideoClick = () => {
805
809
  if (videoRef.current) {
@@ -927,18 +931,20 @@ export const RemoteControl = forwardRef<RemoteControlHandle, RemoteControlProps>
927
931
  onTouchEnd={handleInteraction}
928
932
  onTouchCancel={handleInteraction}
929
933
  >
930
- <img
931
- ref={frameRef}
932
- src={config.frameImage}
933
- alt=""
934
- className="rc-phone-frame"
935
- draggable={false}
936
- />
934
+ {showFrame && (
935
+ <img
936
+ ref={frameRef}
937
+ src={config.frameImage}
938
+ alt=""
939
+ className="rc-phone-frame"
940
+ draggable={false}
941
+ />
942
+ )}
937
943
  <video
938
944
  ref={videoRef}
939
945
  className={clsx(
940
946
  'rc-video',
941
- platform === 'ios' ? 'rc-video-ios' : 'rc-video-android',
947
+ showFrame ? (platform === 'ios' ? 'rc-video-ios' : 'rc-video-android') : 'rc-video-frameless',
942
948
  !videoLoaded && 'rc-video-loading',
943
949
  )}
944
950
  style={
package/src/demo.tsx CHANGED
@@ -3,8 +3,8 @@ import { createRoot } from 'react-dom/client';
3
3
  import { RemoteControl, RemoteControlHandle } from './components/remote-control';
4
4
 
5
5
  function Demo() {
6
- const [url, setUrl] = useState('wss://eu-hel1-5-staging.limrun.dev/v1/organizations/org_01k3v8bvxvecfvscdhvcp3rga1/ios.limrun.com/v1/instances/ios_eustg_01kd5mjeb7fnc8d4yc3f8j8c37/endpointWebSocket');
7
- const [token, setToken] = useState('lim_3f6fc1574c8be1ee23afffe3601512d42f9b2ed486c7320a');
6
+ const [url, setUrl] = useState('wss://eu-hel1-5-staging.limrun.dev/v1/organizations/org_01k3v8bvxvecfvscdhvcp3rga1/android.limrun.com/v1/instances/android_eustg_01kd60xh0yfxzv6ccr0jz5dwf9/endpointWebSocket');
7
+ const [token, setToken] = useState('lim_0961f306d81a78c743aca5826d4d122c18ed5e55b813e181');
8
8
  const [platform, setPlatform] = useState<'ios' | 'android'>('ios');
9
9
  const [isConnected, setIsConnected] = useState(false);
10
10
  const [key, setKey] = useState(0);
@@ -165,6 +165,7 @@ function Demo() {
165
165
  ref={remoteControlRef}
166
166
  url={url}
167
167
  token={token}
168
+ showFrame={false}
168
169
  />
169
170
  </div>
170
171
  </div>