@godscene/playground-electron 1.7.11

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.
Files changed (98) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +4 -0
  3. package/dist/es/DeviceInteractionLayer.mjs +383 -0
  4. package/dist/es/PlaygroundApp.css +207 -0
  5. package/dist/es/PlaygroundApp.mjs +776 -0
  6. package/dist/es/PlaygroundPreview.mjs +29 -0
  7. package/dist/es/PlaygroundThemeProvider.mjs +10 -0
  8. package/dist/es/PreviewRenderer.mjs +270 -0
  9. package/dist/es/ScrcpyPanel.mjs +390 -0
  10. package/dist/es/SessionSetupPanel.css +299 -0
  11. package/dist/es/SessionSetupPanel.mjs +169 -0
  12. package/dist/es/components/Header/index.css +19 -0
  13. package/dist/es/components/Header/index.mjs +37 -0
  14. package/dist/es/components/Nav/index.css +15 -0
  15. package/dist/es/components/Nav/index.mjs +93 -0
  16. package/dist/es/components/WinControlTool/index.css +5 -0
  17. package/dist/es/components/WinControlTool/index.mjs +76 -0
  18. package/dist/es/controller/ai-config.mjs +40 -0
  19. package/dist/es/controller/auto-create.mjs +19 -0
  20. package/dist/es/controller/selectors.mjs +78 -0
  21. package/dist/es/controller/single-flight.mjs +13 -0
  22. package/dist/es/controller/types.mjs +0 -0
  23. package/dist/es/controller/usePlaygroundController.mjs +400 -0
  24. package/dist/es/icons/dropdown-chevron.mjs +61 -0
  25. package/dist/es/icons/midscene-logo.mjs +247 -0
  26. package/dist/es/icons/server-offline-background.mjs +102 -0
  27. package/dist/es/icons/server-offline-foreground.mjs +200 -0
  28. package/dist/es/index.mjs +7 -0
  29. package/dist/es/manual-interaction.mjs +56 -0
  30. package/dist/es/panels/PlaygroundConversationPanel.css +20 -0
  31. package/dist/es/panels/PlaygroundConversationPanel.mjs +140 -0
  32. package/dist/es/runtime-info.mjs +128 -0
  33. package/dist/es/scrcpy-preview.mjs +30 -0
  34. package/dist/es/scrcpy-stream.mjs +53 -0
  35. package/dist/es/session-setup.mjs +13 -0
  36. package/dist/es/session-state.mjs +32 -0
  37. package/dist/es/useServerStatus.mjs +120 -0
  38. package/dist/lib/DeviceInteractionLayer.js +434 -0
  39. package/dist/lib/PlaygroundApp.css +207 -0
  40. package/dist/lib/PlaygroundApp.js +821 -0
  41. package/dist/lib/PlaygroundPreview.js +63 -0
  42. package/dist/lib/PlaygroundThemeProvider.js +44 -0
  43. package/dist/lib/PreviewRenderer.js +304 -0
  44. package/dist/lib/ScrcpyPanel.js +424 -0
  45. package/dist/lib/SessionSetupPanel.css +299 -0
  46. package/dist/lib/SessionSetupPanel.js +217 -0
  47. package/dist/lib/components/Header/index.css +19 -0
  48. package/dist/lib/components/Header/index.js +81 -0
  49. package/dist/lib/components/Nav/index.css +15 -0
  50. package/dist/lib/components/Nav/index.js +127 -0
  51. package/dist/lib/components/WinControlTool/index.css +5 -0
  52. package/dist/lib/components/WinControlTool/index.js +110 -0
  53. package/dist/lib/controller/ai-config.js +80 -0
  54. package/dist/lib/controller/auto-create.js +59 -0
  55. package/dist/lib/controller/selectors.js +115 -0
  56. package/dist/lib/controller/single-flight.js +47 -0
  57. package/dist/lib/controller/types.js +18 -0
  58. package/dist/lib/controller/usePlaygroundController.js +434 -0
  59. package/dist/lib/icons/dropdown-chevron.js +95 -0
  60. package/dist/lib/icons/midscene-logo.js +281 -0
  61. package/dist/lib/icons/server-offline-background.js +136 -0
  62. package/dist/lib/icons/server-offline-foreground.js +234 -0
  63. package/dist/lib/index.js +56 -0
  64. package/dist/lib/manual-interaction.js +90 -0
  65. package/dist/lib/panels/PlaygroundConversationPanel.css +20 -0
  66. package/dist/lib/panels/PlaygroundConversationPanel.js +174 -0
  67. package/dist/lib/runtime-info.js +174 -0
  68. package/dist/lib/scrcpy-preview.js +79 -0
  69. package/dist/lib/scrcpy-stream.js +87 -0
  70. package/dist/lib/session-setup.js +47 -0
  71. package/dist/lib/session-state.js +69 -0
  72. package/dist/lib/useServerStatus.js +154 -0
  73. package/dist/types/DeviceInteractionLayer.d.ts +50 -0
  74. package/dist/types/PlaygroundApp.d.ts +14 -0
  75. package/dist/types/PlaygroundPreview.d.ts +22 -0
  76. package/dist/types/PlaygroundThemeProvider.d.ts +2 -0
  77. package/dist/types/PreviewRenderer.d.ts +27 -0
  78. package/dist/types/ScrcpyPanel.d.ts +21 -0
  79. package/dist/types/SessionSetupPanel.d.ts +16 -0
  80. package/dist/types/components/Header/index.d.ts +3 -0
  81. package/dist/types/components/Nav/index.d.ts +3 -0
  82. package/dist/types/components/WinControlTool/index.d.ts +3 -0
  83. package/dist/types/controller/ai-config.d.ts +5 -0
  84. package/dist/types/controller/auto-create.d.ts +15 -0
  85. package/dist/types/controller/selectors.d.ts +5 -0
  86. package/dist/types/controller/single-flight.d.ts +3 -0
  87. package/dist/types/controller/types.d.ts +36 -0
  88. package/dist/types/controller/usePlaygroundController.d.ts +16 -0
  89. package/dist/types/index.d.ts +13 -0
  90. package/dist/types/manual-interaction.d.ts +21 -0
  91. package/dist/types/panels/PlaygroundConversationPanel.d.ts +25 -0
  92. package/dist/types/runtime-info.d.ts +22 -0
  93. package/dist/types/scrcpy-preview.d.ts +11 -0
  94. package/dist/types/scrcpy-stream.d.ts +16 -0
  95. package/dist/types/session-setup.d.ts +2 -0
  96. package/dist/types/session-state.d.ts +9 -0
  97. package/dist/types/useServerStatus.d.ts +12 -0
  98. package/package.json +69 -0
@@ -0,0 +1,22 @@
1
+ import type { PlaygroundRuntimeInfo, PlaygroundSDK } from '@godscene/playground';
2
+ import type { ScreenshotViewerMode } from '@godscene/visualizer';
3
+ import type { CSSProperties, ReactNode } from 'react';
4
+ import type { ScrcpyErrorOverlayRenderer } from './ScrcpyPanel';
5
+ import type { ManualDragActionType } from './manual-interaction';
6
+ import type { ScrcpyPreviewStatus } from './scrcpy-preview';
7
+ export interface PlaygroundPreviewProps {
8
+ connectingOverlay?: ReactNode;
9
+ onScrcpyStatusChange?: (status: ScrcpyPreviewStatus, statusText: string) => void;
10
+ renderErrorOverlay?: ScrcpyErrorOverlayRenderer;
11
+ scrcpyViewportStyle?: CSSProperties;
12
+ screenshotViewerMode?: ScreenshotViewerMode;
13
+ playgroundSDK: PlaygroundSDK;
14
+ runtimeInfo: PlaygroundRuntimeInfo | null;
15
+ serverUrl: string;
16
+ serverOnline: boolean;
17
+ isUserOperating: boolean;
18
+ manualControlEnabled?: boolean;
19
+ manualDragActionType?: ManualDragActionType;
20
+ manualKeyboardEnabled?: boolean;
21
+ }
22
+ export declare function PlaygroundPreview(props: PlaygroundPreviewProps): import("react").JSX.Element;
@@ -0,0 +1,2 @@
1
+ import type { PropsWithChildren } from 'react';
2
+ export declare function PlaygroundThemeProvider({ children }: PropsWithChildren): import("react").JSX.Element;
@@ -0,0 +1,27 @@
1
+ import type { PlaygroundRuntimeInfo, PlaygroundSDK } from '@godscene/playground';
2
+ import { type ScreenshotViewerMode } from '@godscene/visualizer';
3
+ import React, { type CSSProperties, type ReactNode } from 'react';
4
+ import { type ScrcpyErrorOverlayRenderer } from './ScrcpyPanel';
5
+ import { type ManualDragActionType } from './manual-interaction';
6
+ import type { ScrcpyPreviewStatus } from './scrcpy-preview';
7
+ interface PreviewRendererProps {
8
+ connectingOverlay?: ReactNode;
9
+ onScrcpyStatusChange?: (status: ScrcpyPreviewStatus, statusText: string) => void;
10
+ renderErrorOverlay?: ScrcpyErrorOverlayRenderer;
11
+ scrcpyViewportStyle?: CSSProperties;
12
+ screenshotViewerMode?: ScreenshotViewerMode;
13
+ playgroundSDK: PlaygroundSDK;
14
+ runtimeInfo: PlaygroundRuntimeInfo | null;
15
+ serverUrl: string;
16
+ serverOnline: boolean;
17
+ isUserOperating: boolean;
18
+ /**
19
+ * When true, the preview accepts mouse/touch input and forwards it to the
20
+ * connected device (Android via ADB, iOS via WDA, Harmony via HDC).
21
+ */
22
+ manualControlEnabled?: boolean;
23
+ manualDragActionType?: ManualDragActionType;
24
+ manualKeyboardEnabled?: boolean;
25
+ }
26
+ export declare function PreviewRenderer({ connectingOverlay, onScrcpyStatusChange, renderErrorOverlay, scrcpyViewportStyle, screenshotViewerMode, playgroundSDK, runtimeInfo, serverUrl, serverOnline, isUserOperating, manualControlEnabled, manualDragActionType, manualKeyboardEnabled, }: PreviewRendererProps): React.JSX.Element;
27
+ export {};
@@ -0,0 +1,21 @@
1
+ import React, { type CSSProperties, type ReactNode } from 'react';
2
+ import { type ScrcpyPreviewStatus } from './scrcpy-preview';
3
+ export interface ScrcpyErrorOverlayContext {
4
+ errorMessage: string | null;
5
+ retry: () => void;
6
+ status: ScrcpyPreviewStatus;
7
+ statusText: string;
8
+ }
9
+ export type ScrcpyErrorOverlayRenderer = (context: ScrcpyErrorOverlayContext) => ReactNode;
10
+ interface ScrcpyPanelProps {
11
+ connectingOverlay?: ReactNode;
12
+ deviceId?: string;
13
+ onStatusChange?: (status: ScrcpyPreviewStatus, statusText: string) => void;
14
+ renderErrorOverlay?: ScrcpyErrorOverlayRenderer;
15
+ serverUrl?: string;
16
+ metadataTimeoutMs?: number;
17
+ reconnectInterval?: number;
18
+ viewportStyle?: CSSProperties;
19
+ }
20
+ export declare function ScrcpyPanel({ connectingOverlay, deviceId, onStatusChange, renderErrorOverlay, serverUrl, metadataTimeoutMs, reconnectInterval, viewportStyle, }: ScrcpyPanelProps): React.JSX.Element;
21
+ export {};
@@ -0,0 +1,16 @@
1
+ import type { PlaygroundSessionField, PlaygroundSessionSetup } from '@godscene/playground';
2
+ import type { FormInstance } from 'antd';
3
+ import type { PlaygroundFormValues } from './controller/types';
4
+ import type { PlaygroundSessionViewState } from './session-state';
5
+ import './SessionSetupPanel.less';
6
+ export declare function getPlatformSelectorOptions(field: PlaygroundSessionField, setup: PlaygroundSessionSetup | null): PlaygroundSessionField['options'];
7
+ export interface SessionSetupPanelProps {
8
+ form: FormInstance<PlaygroundFormValues>;
9
+ sessionSetup: PlaygroundSessionSetup | null;
10
+ sessionSetupError: string | null;
11
+ sessionViewState: PlaygroundSessionViewState;
12
+ sessionLoading: boolean;
13
+ sessionMutating: boolean;
14
+ onCreateSession: () => void | Promise<void>;
15
+ }
16
+ export declare function SessionSetupPanel({ form, sessionSetup, sessionSetupError, sessionViewState, sessionLoading, sessionMutating, onCreateSession, }: SessionSetupPanelProps): import("react").JSX.Element;
@@ -0,0 +1,3 @@
1
+ import React from 'react';
2
+ import './index.css';
3
+ export declare function Header(props: any): React.JSX.Element;
@@ -0,0 +1,3 @@
1
+ import React from 'react';
2
+ import './index.css';
3
+ export declare function Nav(): React.JSX.Element;
@@ -0,0 +1,3 @@
1
+ import React from "react";
2
+ import './index.css';
3
+ export default function WinControlTool({ token, parentToken, pageName }: any): React.JSX.Element;
@@ -0,0 +1,5 @@
1
+ import type { PlaygroundSDK } from '@godscene/playground';
2
+ export type PlaygroundAiConfig = Record<string, string>;
3
+ export declare function hasPlaygroundAiConfig(config: PlaygroundAiConfig): boolean;
4
+ export declare function serializePlaygroundAiConfig(config: PlaygroundAiConfig): string;
5
+ export declare function applyPlaygroundAiConfig(playgroundSDK: Pick<PlaygroundSDK, 'overrideConfig'>, config: PlaygroundAiConfig): Promise<boolean>;
@@ -0,0 +1,15 @@
1
+ export type AutoCreateInput = Record<string, unknown> | null | undefined;
2
+ export interface ResolveAutoCreateDecisionOptions {
3
+ autoCreateInput: AutoCreateInput;
4
+ lastAttemptedSignature: string | null;
5
+ blockedSignature: string | null;
6
+ }
7
+ export interface AutoCreateDecision {
8
+ signature: string | null;
9
+ shouldCreate: boolean;
10
+ }
11
+ export declare function serializeAutoCreateInput(autoCreateInput: AutoCreateInput): string | null;
12
+ export declare function resolveAutoCreateDecision({ autoCreateInput, lastAttemptedSignature, blockedSignature, }: ResolveAutoCreateDecisionOptions): AutoCreateDecision;
13
+ export declare function shouldResetAutoCreateBlock(options?: {
14
+ silent?: boolean;
15
+ }): boolean;
@@ -0,0 +1,5 @@
1
+ import type { PlaygroundRuntimeInfo } from '@godscene/playground';
2
+ import type { PlaygroundBranding, UniversalPlaygroundConfig } from '@godscene/visualizer';
3
+ import type { PlaygroundControllerState } from './types';
4
+ export declare function buildConversationConfig(state: Pick<PlaygroundControllerState, 'deviceType' | 'executionUxHints' | 'countdownSeconds'>, playgroundConfig?: Partial<UniversalPlaygroundConfig>): UniversalPlaygroundConfig;
5
+ export declare function buildConversationBranding(runtimeInfo: PlaygroundRuntimeInfo | null, title: string, appVersion: string, deviceType: string, branding?: Partial<PlaygroundBranding>): PlaygroundBranding;
@@ -0,0 +1,3 @@
1
+ export declare function runSingleFlight<T>(pendingRef: {
2
+ current: Promise<T> | null;
3
+ }, task: () => Promise<T>): Promise<T>;
@@ -0,0 +1,36 @@
1
+ import type { PlaygroundRuntimeInfo, PlaygroundSDK, PlaygroundSessionSetup } from '@godscene/playground';
2
+ import type { DeviceType, ExecutionUxHint } from '@godscene/visualizer';
3
+ import type { FormInstance } from 'antd';
4
+ import type { PlaygroundSessionViewState } from '../session-state';
5
+ export type PlaygroundFormValue = boolean | null | number | string | undefined;
6
+ export type PlaygroundFormValues = Record<string, PlaygroundFormValue>;
7
+ export interface PlaygroundControllerState {
8
+ playgroundSDK: PlaygroundSDK;
9
+ form: FormInstance<PlaygroundFormValues>;
10
+ formValues: Record<string, unknown>;
11
+ serverOnline: boolean;
12
+ isUserOperating: boolean;
13
+ deviceType: DeviceType;
14
+ runtimeInfo: PlaygroundRuntimeInfo | null;
15
+ executionUxHints: ExecutionUxHint[];
16
+ sessionViewState: PlaygroundSessionViewState;
17
+ sessionSetup: PlaygroundSessionSetup | null;
18
+ sessionSetupError: string | null;
19
+ sessionLoading: boolean;
20
+ sessionMutating: boolean;
21
+ countdown: number | string | null;
22
+ countdownSeconds: number;
23
+ }
24
+ export interface PlaygroundControllerActions {
25
+ refreshServerState: () => Promise<void>;
26
+ refreshSessionSetup: (input?: Record<string, unknown>) => Promise<void>;
27
+ createSession: (input?: Record<string, unknown>, options?: {
28
+ silent?: boolean;
29
+ }) => Promise<boolean>;
30
+ destroySession: () => Promise<void>;
31
+ finishCountdown: () => void;
32
+ }
33
+ export interface PlaygroundControllerResult {
34
+ state: PlaygroundControllerState;
35
+ actions: PlaygroundControllerActions;
36
+ }
@@ -0,0 +1,16 @@
1
+ import { type DeviceType } from '@godscene/visualizer';
2
+ import type { PlaygroundControllerResult } from './types';
3
+ export interface UsePlaygroundControllerOptions {
4
+ serverUrl: string;
5
+ defaultDeviceType?: DeviceType;
6
+ pollIntervalMs?: number;
7
+ countdownSeconds?: number;
8
+ /**
9
+ * Seed values written into the session-setup form on the first render.
10
+ * Useful for pre-selecting a default platform so the initial
11
+ * `refreshSessionSetup` poll already has a `platformId`, instead of
12
+ * returning a generic "Choose a platform" setup.
13
+ */
14
+ initialFormValues?: Record<string, unknown>;
15
+ }
16
+ export declare function usePlaygroundController({ serverUrl, defaultDeviceType, pollIntervalMs, countdownSeconds, initialFormValues, }: UsePlaygroundControllerOptions): PlaygroundControllerResult;
@@ -0,0 +1,13 @@
1
+ export { PlaygroundApp } from './PlaygroundApp';
2
+ export { PlaygroundPreview } from './PlaygroundPreview';
3
+ export type { ManualDragActionType } from './manual-interaction';
4
+ export { PlaygroundThemeProvider } from './PlaygroundThemeProvider';
5
+ export { DeviceInteractionLayer } from './DeviceInteractionLayer';
6
+ export type { DeviceInteractionLayerProps, DeviceSize, } from './DeviceInteractionLayer';
7
+ export { PlaygroundConversationPanel } from './panels/PlaygroundConversationPanel';
8
+ export type { PlaygroundAppProps } from './PlaygroundApp';
9
+ export type { PlaygroundPreviewProps } from './PlaygroundPreview';
10
+ export type { PlaygroundConversationPanelProps } from './panels/PlaygroundConversationPanel';
11
+ export type { DeviceType } from '@godscene/visualizer';
12
+ export type { PlaygroundControllerActions, PlaygroundControllerResult, PlaygroundControllerState, } from './controller/types';
13
+ export { usePlaygroundController } from './controller/usePlaygroundController';
@@ -0,0 +1,21 @@
1
+ export type ManualDragActionType = 'Swipe' | 'DragAndDrop';
2
+ export declare function buildManualDragInteractPayload(actionType: ManualDragActionType, start: {
3
+ x: number;
4
+ y: number;
5
+ }, end: {
6
+ x: number;
7
+ y: number;
8
+ }, duration: number): {
9
+ actionType: ManualDragActionType;
10
+ x: number;
11
+ y: number;
12
+ endX: number;
13
+ endY: number;
14
+ } | {
15
+ duration: number;
16
+ actionType: ManualDragActionType;
17
+ x: number;
18
+ y: number;
19
+ endX: number;
20
+ endY: number;
21
+ };
@@ -0,0 +1,25 @@
1
+ import { type PlaygroundBranding, type UniversalPlaygroundConfig } from '@godscene/visualizer';
2
+ import type { ReactNode } from 'react';
3
+ import type { PlaygroundControllerResult } from '../controller/types';
4
+ import './PlaygroundConversationPanel.less';
5
+ export interface PlaygroundConversationPanelProps {
6
+ controller: PlaygroundControllerResult;
7
+ appVersion: string;
8
+ title?: string;
9
+ branding?: Partial<PlaygroundBranding>;
10
+ playgroundConfig?: Partial<UniversalPlaygroundConfig>;
11
+ header?: ReactNode;
12
+ className?: string;
13
+ /**
14
+ * Extra class appended to the inner `UniversalPlayground` root.
15
+ */
16
+ playgroundClassName?: string;
17
+ /**
18
+ * Custom content shown while the session is not yet connected.
19
+ * When supplied, replaces the built-in `SessionSetupPanel`, letting hosts
20
+ * drive device selection elsewhere.
21
+ */
22
+ notConnectedFallback?: ReactNode;
23
+ onHumanUse: any;
24
+ }
25
+ export declare function PlaygroundConversationPanel({ controller, appVersion, title, branding, playgroundConfig, header, className, playgroundClassName, notConnectedFallback, onHumanUse }: PlaygroundConversationPanelProps): import("react").JSX.Element;
@@ -0,0 +1,22 @@
1
+ import type { PlaygroundRuntimeInfo } from '@godscene/playground';
2
+ import type { DeviceType, ExecutionUxHint } from '@godscene/visualizer';
3
+ export interface PreviewConnectionInfo {
4
+ type: 'none' | 'screenshot' | 'mjpeg' | 'scrcpy';
5
+ deviceId?: string;
6
+ mjpegUrl?: string;
7
+ scrcpyUrl?: string;
8
+ scrcpyPort?: number;
9
+ }
10
+ export declare function isValidDeviceType(type: string): type is DeviceType;
11
+ export declare function normalizeRuntimeDeviceType(runtimeInfo: PlaygroundRuntimeInfo | null, fallback: DeviceType): DeviceType;
12
+ export declare function buildFallbackRuntimeInfo(previousRuntimeInfo: PlaygroundRuntimeInfo | null, interfaceInfo: RuntimeInterfaceInfo): PlaygroundRuntimeInfo;
13
+ export interface RuntimeInterfaceInfo {
14
+ type: string;
15
+ description?: string;
16
+ size?: {
17
+ width: number;
18
+ height: number;
19
+ };
20
+ }
21
+ export declare function filterValidExecutionUxHints(runtimeInfo: PlaygroundRuntimeInfo | null): ExecutionUxHint[];
22
+ export declare function resolvePreviewConnectionInfo(runtimeInfo: PlaygroundRuntimeInfo | null, serverUrl: string): PreviewConnectionInfo;
@@ -0,0 +1,11 @@
1
+ export declare const SCRCPY_METADATA_TIMEOUT_MS: number;
2
+ export type ScrcpyPreviewStatus = 'connecting' | 'waiting-for-stream' | 'connected' | 'disconnected' | 'error';
3
+ export interface ScrcpyPreviewStatusEvent {
4
+ message: string;
5
+ phase?: string;
6
+ }
7
+ export declare function isScrcpyPreviewStatusEvent(value: unknown): value is ScrcpyPreviewStatusEvent;
8
+ export declare function getDefaultScrcpyWaitingStatusText(): string;
9
+ export declare function getScrcpyDecoderStatusText(): string;
10
+ export declare function getScrcpyPreviewStatusText(status: ScrcpyPreviewStatus, waitingMessage?: string): string;
11
+ export declare function getScrcpyMetadataTimeoutMessage(timeoutMs?: number): string;
@@ -0,0 +1,16 @@
1
+ import type { ScrcpyMediaStreamPacket } from '@yume-chan/scrcpy';
2
+ interface RawScrcpyVideoPacket {
3
+ type?: string;
4
+ data: ArrayLike<number>;
5
+ keyFrame?: boolean;
6
+ }
7
+ interface ScrcpyVideoSocketLike {
8
+ on(event: 'video-data', handler: (data: RawScrcpyVideoPacket) => void): void;
9
+ on(event: 'disconnect', handler: () => void): void;
10
+ on(event: 'error', handler: (error: Error) => void): void;
11
+ off(event: 'video-data', handler: (data: RawScrcpyVideoPacket) => void): void;
12
+ off(event: 'disconnect', handler: () => void): void;
13
+ off(event: 'error', handler: (error: Error) => void): void;
14
+ }
15
+ export declare function createScrcpyVideoStream(socket: ScrcpyVideoSocketLike): ReadableStream<ScrcpyMediaStreamPacket>;
16
+ export {};
@@ -0,0 +1,2 @@
1
+ import type { PlaygroundSessionSetup } from '@godscene/playground';
2
+ export declare function resolveAutoCreateSessionInput(setup: PlaygroundSessionSetup | null, existingValues?: Record<string, unknown>): Record<string, unknown> | null;
@@ -0,0 +1,9 @@
1
+ import type { PlaygroundRuntimeInfo, PlaygroundSessionSetup } from '@godscene/playground';
2
+ export interface PlaygroundSessionViewState {
3
+ connected: boolean;
4
+ displayName?: string;
5
+ setupState: 'required' | 'ready' | 'blocked';
6
+ setupBlockingReason?: string;
7
+ }
8
+ export declare function resolveSessionViewState(runtimeInfo: PlaygroundRuntimeInfo | null): PlaygroundSessionViewState;
9
+ export declare function buildSessionInitialValues(setup: PlaygroundSessionSetup | null, existingValues?: Record<string, unknown>): Record<string, unknown>;
@@ -0,0 +1,12 @@
1
+ import type { PlaygroundRuntimeInfo, PlaygroundSDK } from '@godscene/playground';
2
+ import type { DeviceType, ExecutionUxHint } from '@godscene/visualizer';
3
+ interface ServerStatusResult {
4
+ serverOnline: boolean;
5
+ isUserOperating: boolean;
6
+ deviceType: DeviceType;
7
+ runtimeInfo: PlaygroundRuntimeInfo | null;
8
+ executionUxHints: ExecutionUxHint[];
9
+ refreshServerState: () => Promise<void>;
10
+ }
11
+ export declare function useServerStatus(playgroundSDK: PlaygroundSDK, defaultDeviceType: DeviceType, pollIntervalMs: number): ServerStatusResult;
12
+ export {};
package/package.json ADDED
@@ -0,0 +1,69 @@
1
+ {
2
+ "name": "@godscene/playground-electron",
3
+ "version": "1.7.11",
4
+ "description": "Reusable React shell for Midscene playground applications",
5
+ "repository": "https://github.com/web-infra-dev/midscene",
6
+ "homepage": "https://midscenejs.com/",
7
+ "types": "./dist/types/index.d.ts",
8
+ "main": "./dist/lib/index.js",
9
+ "module": "./dist/es/index.mjs",
10
+ "exports": {
11
+ ".": {
12
+ "types": "./dist/types/index.d.ts",
13
+ "import": "./dist/es/index.mjs",
14
+ "require": "./dist/lib/index.js"
15
+ }
16
+ },
17
+ "files": [
18
+ "dist",
19
+ "README.md"
20
+ ],
21
+ "peerDependencies": {
22
+ "react": "^18.0.0",
23
+ "react-dom": "^18.0.0"
24
+ },
25
+ "dependencies": {
26
+ "@yume-chan/scrcpy": "2.3.0",
27
+ "@yume-chan/scrcpy-decoder-webcodecs": "2.5.0",
28
+ "@ant-design/icons": "^5.3.1",
29
+ "antd": "^5.21.6",
30
+ "react-resizable-panels": "2.0.22",
31
+ "socket.io-client": "4.8.1",
32
+ "@godscene/visualizer": "1.7.11",
33
+ "@godscene/playground": "1.7.11",
34
+ "@godscene/shared": "1.7.11"
35
+ },
36
+ "devDependencies": {
37
+ "@rsbuild/plugin-less": "^1.5.0",
38
+ "@rsbuild/plugin-node-polyfill": "1.4.2",
39
+ "@rsbuild/plugin-react": "^1.4.1",
40
+ "@rsbuild/plugin-svgr": "^1.2.2",
41
+ "@rslib/core": "^0.18.3",
42
+ "@types/node": "^18.0.0",
43
+ "@types/react": "^18.3.1",
44
+ "@types/react-dom": "^18.3.1",
45
+ "less": "^4.2.0",
46
+ "react": "18.3.1",
47
+ "react-dom": "18.3.1",
48
+ "typescript": "^5.8.3",
49
+ "vitest": "3.0.5"
50
+ },
51
+ "sideEffects": [
52
+ "**/*.css",
53
+ "**/*.less",
54
+ "**/*.sass",
55
+ "**/*.scss"
56
+ ],
57
+ "publishConfig": {
58
+ "access": "public",
59
+ "registry": "https://registry.npmjs.org"
60
+ },
61
+ "license": "MIT",
62
+ "scripts": {
63
+ "dev": "npm run build:watch",
64
+ "build": "rslib build",
65
+ "build:watch": "rslib build --watch --no-clean",
66
+ "test": "vitest --run",
67
+ "test:watch": "vitest"
68
+ }
69
+ }