key-screen-framework 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.
Files changed (113) hide show
  1. package/chunks/store-txJwmrlO.js +281 -0
  2. package/chunks/useArduinoBuild-CVr4XAsL.js +152 -0
  3. package/cli/check-arduino-bundle.mjs +157 -0
  4. package/cli/doctor-project.mjs +554 -0
  5. package/cli/generate-screen.mjs +286 -0
  6. package/cli/migrate-project.mjs +679 -0
  7. package/cli/new-project.mjs +344 -0
  8. package/cli/remove-screen.mjs +83 -0
  9. package/cli/screen-generation-contract.mjs +127 -0
  10. package/cli/screen-generation-renderers.mjs +71 -0
  11. package/cli/screen-module-utils.mjs +148 -0
  12. package/cli/screen-script-utils.mjs +92 -0
  13. package/cli/setup-arduino-cli.mjs +515 -0
  14. package/cli/source-module-specifiers.mjs +89 -0
  15. package/cli/sync-screens.mjs +48 -0
  16. package/main/index.js +2003 -0
  17. package/package.json +108 -0
  18. package/preload/index.js +69 -0
  19. package/renderer/components/VideoSceneScreen.js +160 -0
  20. package/renderer/hooks/index.js +6 -0
  21. package/renderer/index.js +3092 -0
  22. package/renderer/store.js +6 -0
  23. package/renderer/styles.css +1395 -0
  24. package/shared/arduino-board.js +136 -0
  25. package/shared/arduino-keyboard-shortcut.js +77 -0
  26. package/shared/index.js +25 -0
  27. package/shared/screen-catalog.js +35 -0
  28. package/shared/screen-shortcuts.js +164 -0
  29. package/shared/types.js +1 -0
  30. package/templates/project/README.md +45 -0
  31. package/templates/project/build/favicon-mac.png +0 -0
  32. package/templates/project/build/favicon.ico +0 -0
  33. package/templates/project/build/favicon.png +0 -0
  34. package/templates/project/e2e/smoke.spec.ts +10 -0
  35. package/templates/project/electron.vite.config.ts +40 -0
  36. package/templates/project/eslint.config.js +23 -0
  37. package/templates/project/gitignore +19 -0
  38. package/templates/project/media/audio/.gitkeep +1 -0
  39. package/templates/project/media/font/.gitkeep +1 -0
  40. package/templates/project/media/image/.gitkeep +1 -0
  41. package/templates/project/media/video/.gitkeep +1 -0
  42. package/templates/project/media/video/external-sample-30s.mp4 +0 -0
  43. package/templates/project/package.json +117 -0
  44. package/templates/project/playwright.config.ts +7 -0
  45. package/templates/project/postcss.config.js +6 -0
  46. package/templates/project/src/arduino-output-signals.ts +19 -0
  47. package/templates/project/src/assets/audio/.gitkeep +1 -0
  48. package/templates/project/src/assets/font/PretendardVariable.woff2 +0 -0
  49. package/templates/project/src/assets/image/.gitkeep +1 -0
  50. package/templates/project/src/assets/image/key-icon.png +0 -0
  51. package/templates/project/src/assets/video/.gitkeep +1 -0
  52. package/templates/project/src/assets/video/sample-30s.mp4 +0 -0
  53. package/templates/project/src/device-signal-handlers.test.ts +9 -0
  54. package/templates/project/src/device-signal-handlers.ts +14 -0
  55. package/templates/project/src/device-signal-targets.ts +3 -0
  56. package/templates/project/src/main/index.ts +17 -0
  57. package/templates/project/src/preload/index.ts +4 -0
  58. package/templates/project/src/project.config.ts +11 -0
  59. package/templates/project/src/renderer/index.html +16 -0
  60. package/templates/project/src/renderer/main.tsx +20 -0
  61. package/templates/project/src/renderer/vite-env.d.ts +1 -0
  62. package/templates/project/src/screen-definitions.ts +75 -0
  63. package/templates/project/src/screens/Screen001Black.test.tsx +21 -0
  64. package/templates/project/src/screens/Screen001Black.tsx +38 -0
  65. package/templates/project/src/screens/Screen002Video.test.tsx +18 -0
  66. package/templates/project/src/screens/Screen002Video.tsx +22 -0
  67. package/templates/project/src/screens/Screen003ExternalVideo.test.tsx +26 -0
  68. package/templates/project/src/screens/Screen003ExternalVideo.tsx +22 -0
  69. package/templates/project/src/store.test.ts +21 -0
  70. package/templates/project/src/store.ts +32 -0
  71. package/templates/project/src/styles.css +60 -0
  72. package/templates/project/tailwind.config.ts +69 -0
  73. package/templates/project/tsconfig.json +4 -0
  74. package/templates/project/tsconfig.node.json +32 -0
  75. package/templates/project/vitest.config.ts +20 -0
  76. package/templates/project/vitest.setup.ts +1 -0
  77. package/types/main/app-keyboard-shortcuts.d.ts +4 -0
  78. package/types/main/arduino-cli.d.ts +55 -0
  79. package/types/main/arduino-sketch-generator.d.ts +10 -0
  80. package/types/main/device-controller.d.ts +39 -0
  81. package/types/main/device-log-writer.d.ts +21 -0
  82. package/types/main/dtoa-dispatcher.d.ts +17 -0
  83. package/types/main/dtoa-handler.d.ts +9 -0
  84. package/types/main/game-session.d.ts +12 -0
  85. package/types/main/kiosk-quit.d.ts +5 -0
  86. package/types/main/media-manager.d.ts +17 -0
  87. package/types/main/runtime-paths.d.ts +10 -0
  88. package/types/main/serial-protocol.d.ts +29 -0
  89. package/types/main/start.d.ts +2 -0
  90. package/types/main/window-mode.d.ts +18 -0
  91. package/types/main/windows-key-lock.d.ts +3 -0
  92. package/types/preload/bridge.d.ts +4 -0
  93. package/types/renderer/src/App.d.ts +3 -0
  94. package/types/renderer/src/KeyScreenApp.d.ts +3 -0
  95. package/types/renderer/src/bridge.d.ts +3 -0
  96. package/types/renderer/src/components/DeviceLogOverlay.d.ts +7 -0
  97. package/types/renderer/src/components/ScreenRenderer.d.ts +7 -0
  98. package/types/renderer/src/components/SplashScreen.d.ts +7 -0
  99. package/types/renderer/src/components/VideoSceneScreen.d.ts +16 -0
  100. package/types/renderer/src/framework/AdminScreen.d.ts +3 -0
  101. package/types/renderer/src/hooks/index.d.ts +4 -0
  102. package/types/renderer/src/hooks/useArduinoBuild.d.ts +14 -0
  103. package/types/renderer/src/hooks/useAtodSignal.d.ts +12 -0
  104. package/types/renderer/src/index.d.ts +9 -0
  105. package/types/renderer/src/project-runtime.d.ts +10 -0
  106. package/types/renderer/src/screen-types.d.ts +24 -0
  107. package/types/renderer/src/store.d.ts +33 -0
  108. package/types/shared/arduino-board.d.ts +11 -0
  109. package/types/shared/arduino-keyboard-shortcut.d.ts +14 -0
  110. package/types/shared/index.d.ts +5 -0
  111. package/types/shared/screen-catalog.d.ts +19 -0
  112. package/types/shared/screen-shortcuts.d.ts +10 -0
  113. package/types/shared/types.d.ts +272 -0
@@ -0,0 +1,69 @@
1
+ import type { Config } from 'tailwindcss'
2
+
3
+ export default {
4
+ content: [
5
+ './src/renderer/index.html',
6
+ './src/**/*.{ts,tsx}',
7
+ './node_modules/key-screen-framework/**/*.{js,mjs}'
8
+ ],
9
+ theme: {
10
+ extend: {
11
+ colors: {
12
+ 'app-bg': 'var(--color-bg)',
13
+ 'app-bg-start': 'var(--color-bg-start)',
14
+ 'app-bg-mid': 'var(--color-bg-mid)',
15
+ 'app-bg-end': 'var(--color-bg-end)',
16
+ 'app-bg-radial': 'var(--color-bg-radial)',
17
+ surface: 'var(--color-surface)',
18
+ 'surface-strong': 'var(--color-surface-strong)',
19
+ 'surface-soft': 'var(--color-surface-soft)',
20
+ 'surface-subtle': 'var(--color-surface-subtle)',
21
+ 'surface-hover': 'var(--color-surface-hover)',
22
+ 'surface-selected': 'var(--color-surface-selected)',
23
+ border: 'var(--color-border)',
24
+ 'border-strong': 'var(--color-border-strong)',
25
+ 'border-soft': 'var(--color-border-soft)',
26
+ text: 'var(--color-text)',
27
+ 'text-muted': 'var(--color-text-muted)',
28
+ 'text-subtle': 'var(--color-text-subtle)',
29
+ 'text-dim': 'var(--color-text-dim)',
30
+ 'text-inverse': 'var(--color-text-inverse)',
31
+ 'status-disconnected-bg': 'var(--color-status-disconnected-bg)',
32
+ 'status-disconnected-text': 'var(--color-status-disconnected-text)',
33
+ 'status-disconnected-ring': 'var(--color-status-disconnected-ring)',
34
+ 'status-connecting-bg': 'var(--color-status-connecting-bg)',
35
+ 'status-connecting-text': 'var(--color-status-connecting-text)',
36
+ 'status-connecting-ring': 'var(--color-status-connecting-ring)',
37
+ 'status-connected-bg': 'var(--color-status-connected-bg)',
38
+ 'status-connected-text': 'var(--color-status-connected-text)',
39
+ 'status-connected-ring': 'var(--color-status-connected-ring)',
40
+ 'status-error-bg': 'var(--color-status-error-bg)',
41
+ 'status-error-text': 'var(--color-status-error-text)',
42
+ 'status-error-ring': 'var(--color-status-error-ring)',
43
+ 'log-in-bg': 'var(--color-log-in-bg)',
44
+ 'log-out-bg': 'var(--color-log-out-bg)',
45
+ 'log-system-bg': 'var(--color-log-system-bg)',
46
+ 'log-error-bg': 'var(--color-log-error-bg)',
47
+ 'log-in-label-bg': 'var(--color-log-in-label-bg)',
48
+ 'log-in-label-text': 'var(--color-log-in-label-text)',
49
+ 'log-out-label-bg': 'var(--color-log-out-label-bg)',
50
+ 'log-out-label-text': 'var(--color-log-out-label-text)',
51
+ 'log-system-label-bg': 'var(--color-log-system-label-bg)',
52
+ 'log-system-label-text': 'var(--color-log-system-label-text)',
53
+ 'log-error-label-bg': 'var(--color-log-error-label-bg)',
54
+ 'log-error-label-text': 'var(--color-log-error-label-text)',
55
+ 'button-primary-bg': 'var(--color-button-primary-bg)',
56
+ 'button-primary-hover': 'var(--color-button-primary-hover)',
57
+ 'button-primary-text': 'var(--color-button-primary-text)'
58
+ },
59
+ fontFamily: {
60
+ display: ['"Pretendard Variable"', '"Segoe UI"', 'sans-serif'],
61
+ body: ['"Pretendard Variable"', '"Segoe UI"', 'sans-serif']
62
+ },
63
+ boxShadow: {
64
+ glow: '0 0 0 1px rgba(255, 255, 255, 0.08), 0 24px 80px rgba(15, 23, 42, 0.28)'
65
+ }
66
+ }
67
+ },
68
+ plugins: []
69
+ } satisfies Config
@@ -0,0 +1,4 @@
1
+ {
2
+ "files": [],
3
+ "references": [{ "path": "./tsconfig.node.json" }]
4
+ }
@@ -0,0 +1,32 @@
1
+ {
2
+ "compilerOptions": {
3
+ "target": "ES2022",
4
+ "lib": ["ES2023", "DOM"],
5
+ "module": "ESNext",
6
+ "moduleResolution": "Bundler",
7
+ "jsx": "react-jsx",
8
+ "allowSyntheticDefaultImports": true,
9
+ "resolveJsonModule": true,
10
+ "isolatedModules": true,
11
+ "noEmit": true,
12
+ "strict": true,
13
+ "noUnusedLocals": true,
14
+ "noUnusedParameters": true,
15
+ "skipLibCheck": true,
16
+ "baseUrl": ".",
17
+ "paths": {
18
+ "@project/*": ["src/*"],
19
+ "@screens/*": ["src/screens/*"],
20
+ "@assets/*": ["src/assets/*"]
21
+ },
22
+ "types": ["node", "vitest/globals", "@testing-library/jest-dom"]
23
+ },
24
+ "include": [
25
+ "electron.vite.config.ts",
26
+ "eslint.config.js",
27
+ "playwright.config.ts",
28
+ "src/**/*.ts",
29
+ "src/**/*.tsx",
30
+ "e2e/**/*.ts"
31
+ ]
32
+ }
@@ -0,0 +1,20 @@
1
+ import { resolve } from 'node:path'
2
+ import react from '@vitejs/plugin-react'
3
+ import { defineConfig } from 'vitest/config'
4
+
5
+ export default defineConfig({
6
+ plugins: [react()],
7
+ resolve: {
8
+ alias: {
9
+ '@project': resolve(__dirname, 'src'),
10
+ '@screens': resolve(__dirname, 'src/screens'),
11
+ '@assets': resolve(__dirname, 'src/assets')
12
+ }
13
+ },
14
+ test: {
15
+ include: ['src/**/*.test.{ts,tsx}'],
16
+ environment: 'jsdom',
17
+ globals: true,
18
+ setupFiles: ['./vitest.setup.ts']
19
+ }
20
+ })
@@ -0,0 +1 @@
1
+ import '@testing-library/jest-dom/vitest'
@@ -0,0 +1,4 @@
1
+ import type { Input } from 'electron';
2
+ type Platform = NodeJS.Platform;
3
+ export declare function isReloadShortcut(input: Input, platform?: Platform): boolean;
4
+ export {};
@@ -0,0 +1,55 @@
1
+ import { EventEmitter } from 'node:events';
2
+ import { spawn } from 'node:child_process';
3
+ export interface ArduinoCliPaths {
4
+ cliPath: string;
5
+ dataDir: string;
6
+ userDir: string;
7
+ libraryPaths: string[];
8
+ }
9
+ export interface ArduinoCliRunResult {
10
+ exitCode: number | null;
11
+ signal: NodeJS.Signals | null;
12
+ cancelled: boolean;
13
+ }
14
+ interface ArduinoCliRunnerEvents {
15
+ log: [{
16
+ stream: 'stdout' | 'stderr';
17
+ line: string;
18
+ createdAt: string;
19
+ }];
20
+ }
21
+ interface AppPathLike {
22
+ isPackaged: boolean;
23
+ getAppPath(): string;
24
+ getPath(name: 'userData'): string;
25
+ }
26
+ type ArduinoCliSpawn = typeof spawn;
27
+ export declare function resolveArduinoCliPaths(app: AppPathLike, options?: {
28
+ arch?: NodeJS.Architecture;
29
+ platform?: NodeJS.Platform;
30
+ resourcesPath?: string;
31
+ }): ArduinoCliPaths;
32
+ export declare function buildArduinoCompileArgs(options: {
33
+ fqbn: string;
34
+ libraryPaths: string[];
35
+ sketchDir: string;
36
+ }): string[];
37
+ export declare function buildArduinoUploadArgs(options: {
38
+ fqbn: string;
39
+ libraryPaths: string[];
40
+ sketchDir: string;
41
+ portPath: string;
42
+ }): string[];
43
+ export declare class ArduinoCliRunner extends EventEmitter<ArduinoCliRunnerEvents> {
44
+ private readonly paths;
45
+ private readonly spawnProcess;
46
+ private currentProcess;
47
+ private cancelled;
48
+ constructor(paths: ArduinoCliPaths, spawnProcess?: ArduinoCliSpawn);
49
+ compileSketch(sketchDir: string, fqbn: string): Promise<ArduinoCliRunResult>;
50
+ uploadSketch(sketchDir: string, fqbn: string, portPath: string): Promise<ArduinoCliRunResult>;
51
+ cancel(): void;
52
+ private run;
53
+ private attachLineLogger;
54
+ }
55
+ export {};
@@ -0,0 +1,10 @@
1
+ import type { ArduinoBoardConfig, ScreenShortcutDefinition } from '../shared/types.js';
2
+ interface GenerateArduinoSketchOptions {
3
+ boardConfig: ArduinoBoardConfig;
4
+ globalShortcuts: ScreenShortcutDefinition[];
5
+ }
6
+ export declare function generateArduinoSketch(options: GenerateArduinoSketchOptions): {
7
+ source: string;
8
+ warnings: string[];
9
+ };
10
+ export {};
@@ -0,0 +1,39 @@
1
+ import { EventEmitter } from 'node:events';
2
+ import type { ArduinoCommand, ArduinoResponse, DeviceConnectionState, DevicePortInfo } from '../shared/types.js';
3
+ interface DeviceControllerOptions {
4
+ onDtoa(target: string, raw: string): Promise<ArduinoResponse>;
5
+ }
6
+ export declare class DeviceController extends EventEmitter {
7
+ private port;
8
+ private readonly options;
9
+ private readBuffer;
10
+ private heartbeatInterval;
11
+ private heartbeatTimeout;
12
+ private writeQueue;
13
+ private pendingRequest;
14
+ private state;
15
+ constructor(options: DeviceControllerOptions);
16
+ listPorts(): Promise<DevicePortInfo[]>;
17
+ getState(): DeviceConnectionState;
18
+ logSystemEvent(message: string): void;
19
+ connect(portPath?: string): Promise<DeviceConnectionState>;
20
+ disconnect(emit?: boolean): Promise<DeviceConnectionState>;
21
+ send(command: ArduinoCommand): Promise<ArduinoResponse>;
22
+ private sendWithRetry;
23
+ private attachPortListeners;
24
+ private emitState;
25
+ private flushReadBuffer;
26
+ private handleIncomingLine;
27
+ private markHandshake;
28
+ private startHeartbeat;
29
+ private sendHeartbeatPing;
30
+ private stopHeartbeat;
31
+ private refreshHeartbeatTimeout;
32
+ private waitForMatchingResponse;
33
+ private writeLine;
34
+ private pushLog;
35
+ private pushRawLog;
36
+ private shouldSkipMessageLog;
37
+ private shouldKeepAsLastMessage;
38
+ }
39
+ export {};
@@ -0,0 +1,21 @@
1
+ import type { DeviceConnectionStatus, DeviceLogArchiveInfo, DeviceLogEntry } from '../shared/types.js';
2
+ export interface PersistedDeviceLogEntry extends DeviceLogEntry {
3
+ selectedPortPath?: string;
4
+ status: DeviceConnectionStatus;
5
+ }
6
+ export interface DeviceLogWriterOptions {
7
+ rawLogMaxBytes?: number;
8
+ rawLogRetentionDays?: number;
9
+ }
10
+ export declare class DeviceLogWriter {
11
+ private readonly logsRootDir;
12
+ private writeQueue;
13
+ private readonly rawLogMaxBytes;
14
+ private readonly rawLogRetentionDays;
15
+ constructor(logsRootDir: string, options?: DeviceLogWriterOptions);
16
+ write(entry: PersistedDeviceLogEntry): void;
17
+ listArchives(): Promise<DeviceLogArchiveInfo[]>;
18
+ readArchive(dateKey: string): Promise<DeviceLogEntry[]>;
19
+ pruneExpiredRawLogs(referenceCreatedAt?: string): Promise<void>;
20
+ private resolveWritableRawLogPath;
21
+ }
@@ -0,0 +1,17 @@
1
+ import type { ArduinoResponse, ScreenDefinition } from '../shared/types.js';
2
+ import type { ScreenCatalog } from '../shared/screen-catalog.js';
3
+ import { GameSession } from './game-session.js';
4
+ interface DtoaCommandContext {
5
+ gameSession: GameSession;
6
+ screenCatalog: ScreenCatalog;
7
+ }
8
+ export declare class DtoaDispatcher {
9
+ private readonly context;
10
+ private readonly commands;
11
+ private readonly screenCatalog;
12
+ constructor(context: DtoaCommandContext);
13
+ getAvailableScreens(): ScreenDefinition[];
14
+ hasScreenTarget(target: string): boolean;
15
+ dispatch(target: string): Promise<ArduinoResponse>;
16
+ }
17
+ export {};
@@ -0,0 +1,9 @@
1
+ import type { ArduinoResponse, DeviceSignal } from '../shared/types.js';
2
+ import type { DtoaDispatcher } from './dtoa-dispatcher.js';
3
+ interface DtoaHandlerOptions {
4
+ dtoaDispatcher: DtoaDispatcher;
5
+ deviceSignalTargets: ReadonlySet<string>;
6
+ broadcastDeviceSignal(signal: DeviceSignal): void;
7
+ }
8
+ export declare function handleDtoa(target: string, raw: string, options: DtoaHandlerOptions): Promise<ArduinoResponse>;
9
+ export {};
@@ -0,0 +1,12 @@
1
+ import { EventEmitter } from 'node:events';
2
+ import type { ScreenCatalog } from '../shared/screen-catalog.js';
3
+ import type { GameState } from '../shared/types.js';
4
+ export declare class GameSession extends EventEmitter {
5
+ private readonly screenCatalog;
6
+ private state;
7
+ constructor(screenCatalog: ScreenCatalog);
8
+ getState(): GameState;
9
+ start(): GameState;
10
+ reset(): GameState;
11
+ moveToTarget(target: string): GameState;
12
+ }
@@ -0,0 +1,5 @@
1
+ import type { Input } from 'electron';
2
+ type Platform = NodeJS.Platform;
3
+ export declare function isKioskQuitShortcut(input: Input, platform?: Platform): boolean;
4
+ export declare function isBlockedKioskShortcut(input: Input, platform?: Platform): boolean;
5
+ export {};
@@ -0,0 +1,17 @@
1
+ import type { MediaLibrary, MediaRef } from '../shared/types.js';
2
+ export declare class MediaManager {
3
+ private readonly rootPath;
4
+ constructor(rootPath: string);
5
+ getRootPath(): string;
6
+ ensureDirectories(): Promise<void>;
7
+ seedFrom(sourceRootPath: string): Promise<void>;
8
+ listLibrary(): Promise<MediaLibrary>;
9
+ resolveMediaPath(ref: MediaRef): string;
10
+ resolveMediaUrl(ref: MediaRef): string;
11
+ private listAssetsForType;
12
+ }
13
+ export interface ByteRange {
14
+ end: number;
15
+ start: number;
16
+ }
17
+ export declare function parseByteRange(rangeHeader: string | null, sizeBytes: number): ByteRange | null;
@@ -0,0 +1,10 @@
1
+ import type { KeyScreenRuntimePaths } from '../shared/types.js';
2
+ interface RuntimePathContext {
3
+ mainDirectory: string;
4
+ appPath: string;
5
+ resourcesPath: string;
6
+ isPackaged: boolean;
7
+ isDev: boolean;
8
+ }
9
+ export declare function resolveMainRuntimePaths(overrides: Partial<KeyScreenRuntimePaths> | undefined, context: RuntimePathContext): KeyScreenRuntimePaths;
10
+ export {};
@@ -0,0 +1,29 @@
1
+ import type { ArduinoCommand, ArduinoErrorCode, ArduinoResponse } from '../shared/types.js';
2
+ export type IncomingSerialMessage = {
3
+ type: 'ready';
4
+ raw: string;
5
+ } | {
6
+ type: 'pong';
7
+ raw: string;
8
+ } | {
9
+ type: 'dtoa';
10
+ target: string;
11
+ raw: string;
12
+ } | {
13
+ type: 'ack';
14
+ target: string;
15
+ raw: string;
16
+ } | {
17
+ type: 'err';
18
+ code: ArduinoErrorCode;
19
+ target?: string;
20
+ raw: string;
21
+ };
22
+ export declare const SERIAL_BAUD_RATE = 115200;
23
+ export declare const REQUEST_TIMEOUT_MS = 500;
24
+ export declare const REQUEST_RETRY_LIMIT = 3;
25
+ export declare const HEARTBEAT_INTERVAL_MS = 10000;
26
+ export declare const HEARTBEAT_TIMEOUT_MS = 22000;
27
+ export declare function buildOutgoingLine(command: ArduinoCommand): string;
28
+ export declare function buildResponseLine(response: Pick<ArduinoResponse, 'ok' | 'target' | 'code'>): string;
29
+ export declare function parseIncomingLine(rawLine: string): IncomingSerialMessage | null;
@@ -0,0 +1,2 @@
1
+ import type { KeyScreenMainOptions } from '../shared/types.js';
2
+ export declare function startKeyScreenMain(options: KeyScreenMainOptions): void;
@@ -0,0 +1,18 @@
1
+ import type { BrowserWindow } from 'electron';
2
+ import type { WindowMode } from '../shared/types.js';
3
+ export type WindowBounds = {
4
+ x: number;
5
+ y: number;
6
+ width: number;
7
+ height: number;
8
+ };
9
+ export type ApplyWindowModeOptions = {
10
+ kioskBounds?: WindowBounds;
11
+ };
12
+ export declare function getEnvWindowModeOverride(env: NodeJS.ProcessEnv): WindowMode | undefined;
13
+ export declare function resolveInitialWindowMode(options: {
14
+ env: NodeJS.ProcessEnv;
15
+ isDev: boolean;
16
+ savedMode?: WindowMode;
17
+ }): WindowMode;
18
+ export declare function applyWindowMode(window: BrowserWindow, mode: WindowMode, options?: ApplyWindowModeOptions): void;
@@ -0,0 +1,3 @@
1
+ export declare function createWindowsKeyBlockerArgs(script?: string): string[];
2
+ export declare function startWindowsKeyLock(platform?: NodeJS.Platform): boolean;
3
+ export declare function stopWindowsKeyLock(): void;
@@ -0,0 +1,4 @@
1
+ import type { IpcRenderer } from 'electron';
2
+ import type { BridgeApi } from '../shared/types.js';
3
+ export declare function createKeyScreenBridgeApi<TScreenId extends string = string>(renderer?: Pick<IpcRenderer, 'invoke' | 'send' | 'on' | 'removeListener'>): BridgeApi<TScreenId>;
4
+ export declare function exposeKeyScreenApi<TScreenId extends string = string>(): BridgeApi<TScreenId>;
@@ -0,0 +1,3 @@
1
+ import type { JSX } from 'react';
2
+ declare function App(): JSX.Element;
3
+ export default App;
@@ -0,0 +1,3 @@
1
+ import type { JSX } from 'react';
2
+ import type { KeyScreenRendererOptions } from './screen-types.js';
3
+ export declare function KeyScreenApp({ appIconUrl, arduinoOutputSignals, deviceSignalHandlers, getProjectStore, projectConfig, screenDefinitions, screenModules }: KeyScreenRendererOptions): JSX.Element;
@@ -0,0 +1,3 @@
1
+ import type { BridgeApi, ScreenDefinition } from '../../shared/types.js';
2
+ export declare function configureRendererPreview(screenDefinitions: readonly ScreenDefinition[]): void;
3
+ export declare function getGameApi<TScreenId extends string = string>(): BridgeApi<TScreenId>;
@@ -0,0 +1,7 @@
1
+ import type { DeviceConnectionState } from '../../../shared/types.js';
2
+ interface DeviceLogOverlayProps {
3
+ deviceState: DeviceConnectionState;
4
+ onClose(): void;
5
+ }
6
+ declare function DeviceLogOverlay({ deviceState, onClose }: DeviceLogOverlayProps): import("react").JSX.Element;
7
+ export default DeviceLogOverlay;
@@ -0,0 +1,7 @@
1
+ import type { GameState, ScreenDefinition } from '../../../shared/types.js';
2
+ interface ScreenRendererProps {
3
+ gameState: GameState;
4
+ screens: ScreenDefinition[];
5
+ }
6
+ declare function ScreenRenderer({ gameState, screens }: ScreenRendererProps): import("react").JSX.Element;
7
+ export default ScreenRenderer;
@@ -0,0 +1,7 @@
1
+ interface SplashScreenProps {
2
+ appIconAlt: string;
3
+ appIconUrl: string;
4
+ leaving: boolean;
5
+ }
6
+ declare function SplashScreen({ appIconAlt, appIconUrl, leaving }: SplashScreenProps): import("react").JSX.Element;
7
+ export default SplashScreen;
@@ -0,0 +1,16 @@
1
+ import type { VideoHTMLAttributes } from 'react';
2
+ type VideoObjectFit = 'contain' | 'cover' | 'fill' | 'none' | 'scale-down';
3
+ export interface VideoSceneScreenProps extends Omit<VideoHTMLAttributes<HTMLVideoElement>, 'autoPlay' | 'children' | 'src'> {
4
+ src: string;
5
+ objectFit?: VideoObjectFit;
6
+ onPlaybackError?: (error: unknown) => void;
7
+ hideCursor?: boolean;
8
+ }
9
+ export interface VideoPreloadOptions {
10
+ crossOrigin?: '' | 'anonymous' | 'use-credentials';
11
+ rejectOnError?: boolean;
12
+ timeoutMs?: number;
13
+ }
14
+ export declare function preloadVideoSource(src: string, { crossOrigin, rejectOnError, timeoutMs }?: VideoPreloadOptions): Promise<void>;
15
+ declare function VideoSceneScreen({ className, hideCursor, loop, muted, objectFit, onPlaybackError, playsInline, preload, src, ...videoProps }: VideoSceneScreenProps): import("react").JSX.Element;
16
+ export default VideoSceneScreen;
@@ -0,0 +1,3 @@
1
+ import type { ScreenComponentProps } from '../screen-types.js';
2
+ declare function AdminScreen({ gameState }: ScreenComponentProps): import("react").JSX.Element;
3
+ export default AdminScreen;
@@ -0,0 +1,4 @@
1
+ export { createUseAtodSignal, useAtodSignal } from './useAtodSignal.js';
2
+ export type { ArduinoOutputActionForTarget, ArduinoOutputTarget, UseAtodSignalResult } from './useAtodSignal.js';
3
+ export { useArduinoBuild } from './useArduinoBuild.js';
4
+ export type { UseArduinoBuildResult } from './useArduinoBuild.js';
@@ -0,0 +1,14 @@
1
+ import type { ArduinoBuildResult, ArduinoBuildStatus, ArduinoLogEntry, ArduinoSketchPreview } from '../../../shared/types.js';
2
+ export interface UseArduinoBuildResult {
3
+ status: ArduinoBuildStatus;
4
+ logs: ArduinoLogEntry[];
5
+ compiling: boolean;
6
+ uploading: boolean;
7
+ error: Error | null;
8
+ preview(): Promise<ArduinoSketchPreview>;
9
+ compile(): Promise<ArduinoBuildResult>;
10
+ upload(portPath?: string): Promise<ArduinoBuildResult>;
11
+ cancel(): void;
12
+ clearLogs(): void;
13
+ }
14
+ export declare function useArduinoBuild(): UseArduinoBuildResult;
@@ -0,0 +1,12 @@
1
+ import type { ArduinoOutputSignalDefinition, ArduinoResponse } from '../../../shared/types.js';
2
+ export type ArduinoOutputTarget<TSignals extends readonly ArduinoOutputSignalDefinition[]> = TSignals[number]['target'];
3
+ export type ArduinoOutputActionForTarget<TSignals extends readonly ArduinoOutputSignalDefinition[], TTarget extends ArduinoOutputTarget<TSignals>> = TSignals[number] extends infer TSignal ? TSignal extends ArduinoOutputSignalDefinition ? TTarget extends TSignal['target'] ? TSignal['action'] : never : never : never;
4
+ export interface UseAtodSignalResult<TSignals extends readonly ArduinoOutputSignalDefinition[] = readonly ArduinoOutputSignalDefinition[], TDefaultTarget extends ArduinoOutputTarget<TSignals> | undefined = undefined> {
5
+ sending: boolean;
6
+ error: Error | null;
7
+ lastResponse: ArduinoResponse | null;
8
+ sendAtod<TTarget extends ArduinoOutputTarget<TSignals>>(target: TTarget, action: ArduinoOutputActionForTarget<TSignals, TTarget>): Promise<ArduinoResponse>;
9
+ sendAction(action: TDefaultTarget extends ArduinoOutputTarget<TSignals> ? ArduinoOutputActionForTarget<TSignals, TDefaultTarget> : never): Promise<ArduinoResponse>;
10
+ }
11
+ export declare function useAtodSignal<TDefaultTarget extends string | undefined = undefined>(defaultTarget?: TDefaultTarget): UseAtodSignalResult<readonly ArduinoOutputSignalDefinition[], TDefaultTarget>;
12
+ export declare function createUseAtodSignal<const TSignals extends readonly ArduinoOutputSignalDefinition[]>(_signalDefinitions: TSignals): <TDefaultTarget extends ArduinoOutputTarget<TSignals> | undefined = undefined>(defaultTarget?: TDefaultTarget) => UseAtodSignalResult<TSignals, TDefaultTarget>;
@@ -0,0 +1,9 @@
1
+ import type { Root } from 'react-dom/client';
2
+ import type { KeyScreenRendererOptions } from './screen-types.js';
3
+ export { KeyScreenApp } from './KeyScreenApp.js';
4
+ export { getGameApi } from './bridge.js';
5
+ export { createUseAtodSignal, useAtodSignal } from './hooks/useAtodSignal.js';
6
+ export { ProjectRuntimeContext, useProjectRuntime } from './project-runtime.js';
7
+ export type { ArduinoOutputActionForTarget, ArduinoOutputTarget, UseAtodSignalResult } from './hooks/useAtodSignal.js';
8
+ export type { KeyScreenRendererOptions, ScreenComponentProps, ScreenComponentType, ScreenModule, ScreenModuleRegistry, ScreenPreloadFunction } from './screen-types.js';
9
+ export declare function mountKeyScreenApp(options: KeyScreenRendererOptions, element?: HTMLElement | null): Root;
@@ -0,0 +1,10 @@
1
+ import type { JSX, ReactNode } from 'react';
2
+ import type { KeyScreenRendererOptions } from './screen-types.js';
3
+ export declare const ProjectRuntimeContext: import("react").Context<KeyScreenRendererOptions<string> | null>;
4
+ interface ProjectRuntimeProviderProps {
5
+ children: ReactNode;
6
+ options: KeyScreenRendererOptions;
7
+ }
8
+ export declare function ProjectRuntimeProvider({ children, options }: ProjectRuntimeProviderProps): JSX.Element;
9
+ export declare function useProjectRuntime(): KeyScreenRendererOptions;
10
+ export {};
@@ -0,0 +1,24 @@
1
+ import type { ComponentType } from 'react';
2
+ import type { ArduinoOutputSignalDefinition, DeviceSignalHandlerRegistry, GameState, ProjectConfig, ProjectStoreAdapter, ScreenDefinition } from '../../shared/types.js';
3
+ export type ScreenPreloadFunction = () => Promise<void> | void;
4
+ export interface ScreenComponentProps {
5
+ screen: ScreenDefinition;
6
+ gameState: GameState;
7
+ }
8
+ export type ScreenComponentType = ComponentType<ScreenComponentProps>;
9
+ export interface ScreenModule {
10
+ default: ScreenComponentType;
11
+ preload?: ScreenPreloadFunction;
12
+ }
13
+ export type ScreenModuleRegistry = Readonly<Record<string, ScreenModule | undefined>>;
14
+ export interface KeyScreenRendererOptions<TScreenId extends string = string> {
15
+ projectConfig: ProjectConfig;
16
+ appIconUrl: string;
17
+ screenDefinitions: readonly (ScreenDefinition & {
18
+ id: TScreenId;
19
+ })[];
20
+ screenModules: ScreenModuleRegistry;
21
+ deviceSignalHandlers: DeviceSignalHandlerRegistry<TScreenId>;
22
+ arduinoOutputSignals: readonly ArduinoOutputSignalDefinition[];
23
+ getProjectStore(): ProjectStoreAdapter;
24
+ }
@@ -0,0 +1,33 @@
1
+ import type { ArduinoBoardConfig, ArduinoCommand, DeviceConnectionState, DevicePortInfo, GameState, ScreenDefinition, ScreenShortcutDefinition, WindowMode } from '../../shared/types.js';
2
+ interface AppStore {
3
+ deviceState: DeviceConnectionState;
4
+ gameState: GameState;
5
+ ports: DevicePortInfo[];
6
+ screens: ScreenDefinition[];
7
+ shortcuts: ScreenShortcutDefinition[];
8
+ arduinoBoardConfig: ArduinoBoardConfig;
9
+ deviceSignalTargets: string[];
10
+ windowMode: WindowMode;
11
+ windowModeLocked: boolean;
12
+ loading: boolean;
13
+ setLoading(value: boolean): void;
14
+ setPorts(ports: DevicePortInfo[]): void;
15
+ setDeviceState(state: DeviceConnectionState): void;
16
+ setGameState(state: GameState): void;
17
+ setScreens(screens: ScreenDefinition[]): void;
18
+ setShortcuts(shortcuts: ScreenShortcutDefinition[]): void;
19
+ setArduinoBoardConfig(config: ArduinoBoardConfig): void;
20
+ setDeviceSignalTargets(targets: string[]): void;
21
+ setWindowMode(mode: WindowMode): void;
22
+ setWindowModeLocked(value: boolean): void;
23
+ bootstrap(): Promise<void>;
24
+ connect(portPath?: string): Promise<void>;
25
+ disconnect(): Promise<void>;
26
+ send(command: ArduinoCommand): Promise<void>;
27
+ updateGlobalShortcuts(shortcuts: ScreenShortcutDefinition[]): Promise<void>;
28
+ updateArduinoBoardConfig(config: ArduinoBoardConfig): Promise<void>;
29
+ updateWindowMode(mode: WindowMode): Promise<void>;
30
+ moveToScreen(target: string): Promise<void>;
31
+ }
32
+ export declare const useAppStore: import("zustand").UseBoundStore<import("zustand").StoreApi<AppStore>>;
33
+ export {};
@@ -0,0 +1,11 @@
1
+ import type { ArduinoBoardConfig, ArduinoBoardPreset } from './types.js';
2
+ export declare const ARDUINO_BOARD_PRESETS: readonly ["Generic", "Leonardo", "Micro", "ProMicro", "Uno"];
3
+ export declare const BOARD_PRESET_FQBN: Record<ArduinoBoardPreset, string>;
4
+ export declare const ARDUINO_MAX_INPUTS = 32;
5
+ export declare const ARDUINO_MAX_OUTPUTS = 32;
6
+ export declare const ARDUINO_MAX_TARGET_LENGTH = 64;
7
+ export declare const ARDUINO_MAX_PIN = 255;
8
+ export declare const DEFAULT_ARDUINO_SERIAL_HEALTHY_TIMEOUT_MS = 6000;
9
+ export declare function defaultArduinoBoardConfig(): ArduinoBoardConfig;
10
+ export declare function resolveArduinoBoardFqbn(preset: ArduinoBoardPreset, override?: string): string;
11
+ export declare function validateArduinoBoardConfig(config: ArduinoBoardConfig): ArduinoBoardConfig;
@@ -0,0 +1,14 @@
1
+ export type ArduinoKeyboardModifier = 'KEY_LEFT_CTRL' | 'KEY_LEFT_GUI' | 'KEY_LEFT_ALT' | 'KEY_LEFT_SHIFT';
2
+ export interface ArduinoKeyboardShortcutValue {
3
+ key: string;
4
+ keyLiteral: string;
5
+ modifiers: ArduinoKeyboardModifier[];
6
+ }
7
+ export type ArduinoKeyboardShortcutResult = {
8
+ ok: true;
9
+ shortcut: ArduinoKeyboardShortcutValue;
10
+ } | {
11
+ ok: false;
12
+ warning: string;
13
+ };
14
+ export declare function acceleratorToArduinoKeyboardShortcut(accelerator: string): ArduinoKeyboardShortcutResult;
@@ -0,0 +1,5 @@
1
+ export * from './types.js';
2
+ export * from './screen-catalog.js';
3
+ export * from './screen-shortcuts.js';
4
+ export * from './arduino-board.js';
5
+ export * from './arduino-keyboard-shortcut.js';