markupr 2.1.8
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/.claude/commands/review-feedback.md +47 -0
- package/.eslintrc.json +35 -0
- package/.github/CODEOWNERS +16 -0
- package/.github/FUNDING.yml +1 -0
- package/.github/ISSUE_TEMPLATE/bug_report.md +56 -0
- package/.github/ISSUE_TEMPLATE/feature_request.md +54 -0
- package/.github/PULL_REQUEST_TEMPLATE.md +89 -0
- package/.github/dependabot.yml +70 -0
- package/.github/workflows/ci.yml +184 -0
- package/.github/workflows/deploy-landing.yml +134 -0
- package/.github/workflows/nightly.yml +288 -0
- package/.github/workflows/release.yml +318 -0
- package/CHANGELOG.md +127 -0
- package/CLAUDE.md +137 -0
- package/CODE_OF_CONDUCT.md +9 -0
- package/CONTRIBUTING.md +390 -0
- package/LICENSE +21 -0
- package/PRODUCT_VISION.md +277 -0
- package/README.md +517 -0
- package/SECURITY.md +51 -0
- package/SIGNING_INSTRUCTIONS.md +284 -0
- package/assets/DMG_BACKGROUND_INSTRUCTIONS.md +130 -0
- package/assets/svg-source/dmg-background.svg +70 -0
- package/assets/svg-source/icon.svg +20 -0
- package/assets/svg-source/tray-icon-processing.svg +7 -0
- package/assets/svg-source/tray-icon-recording.svg +7 -0
- package/assets/svg-source/tray-icon.svg +6 -0
- package/assets/tray-complete.png +0 -0
- package/assets/tray-complete@2x.png +0 -0
- package/assets/tray-completeTemplate.png +0 -0
- package/assets/tray-completeTemplate@2x.png +0 -0
- package/assets/tray-error.png +0 -0
- package/assets/tray-error@2x.png +0 -0
- package/assets/tray-errorTemplate.png +0 -0
- package/assets/tray-errorTemplate@2x.png +0 -0
- package/assets/tray-icon-processing.png +0 -0
- package/assets/tray-icon-processing@2x.png +0 -0
- package/assets/tray-icon-processingTemplate.png +0 -0
- package/assets/tray-icon-processingTemplate@2x.png +0 -0
- package/assets/tray-icon-recording.png +0 -0
- package/assets/tray-icon-recording@2x.png +0 -0
- package/assets/tray-icon-recordingTemplate.png +0 -0
- package/assets/tray-icon-recordingTemplate@2x.png +0 -0
- package/assets/tray-icon.png +0 -0
- package/assets/tray-icon@2x.png +0 -0
- package/assets/tray-iconTemplate.png +0 -0
- package/assets/tray-iconTemplate@2x.png +0 -0
- package/assets/tray-idle.png +0 -0
- package/assets/tray-idle@2x.png +0 -0
- package/assets/tray-idleTemplate.png +0 -0
- package/assets/tray-idleTemplate@2x.png +0 -0
- package/assets/tray-processing-0.png +0 -0
- package/assets/tray-processing-0@2x.png +0 -0
- package/assets/tray-processing-0Template.png +0 -0
- package/assets/tray-processing-0Template@2x.png +0 -0
- package/assets/tray-processing-1.png +0 -0
- package/assets/tray-processing-1@2x.png +0 -0
- package/assets/tray-processing-1Template.png +0 -0
- package/assets/tray-processing-1Template@2x.png +0 -0
- package/assets/tray-processing-2.png +0 -0
- package/assets/tray-processing-2@2x.png +0 -0
- package/assets/tray-processing-2Template.png +0 -0
- package/assets/tray-processing-2Template@2x.png +0 -0
- package/assets/tray-processing-3.png +0 -0
- package/assets/tray-processing-3@2x.png +0 -0
- package/assets/tray-processing-3Template.png +0 -0
- package/assets/tray-processing-3Template@2x.png +0 -0
- package/assets/tray-processing.png +0 -0
- package/assets/tray-processing@2x.png +0 -0
- package/assets/tray-processingTemplate.png +0 -0
- package/assets/tray-processingTemplate@2x.png +0 -0
- package/assets/tray-recording.png +0 -0
- package/assets/tray-recording@2x.png +0 -0
- package/assets/tray-recordingTemplate.png +0 -0
- package/assets/tray-recordingTemplate@2x.png +0 -0
- package/build/DMG_BACKGROUND_SPEC.md +50 -0
- package/build/dmg-background.png +0 -0
- package/build/dmg-background@2x.png +0 -0
- package/build/entitlements.mac.inherit.plist +27 -0
- package/build/entitlements.mac.plist +41 -0
- package/build/favicon-16.png +0 -0
- package/build/favicon-180.png +0 -0
- package/build/favicon-192.png +0 -0
- package/build/favicon-32.png +0 -0
- package/build/favicon-48.png +0 -0
- package/build/favicon-512.png +0 -0
- package/build/favicon-64.png +0 -0
- package/build/icon-128.png +0 -0
- package/build/icon-16.png +0 -0
- package/build/icon-24.png +0 -0
- package/build/icon-256.png +0 -0
- package/build/icon-32.png +0 -0
- package/build/icon-48.png +0 -0
- package/build/icon-64.png +0 -0
- package/build/icon.icns +0 -0
- package/build/icon.ico +0 -0
- package/build/icon.iconset/icon_128x128.png +0 -0
- package/build/icon.iconset/icon_128x128@2x.png +0 -0
- package/build/icon.iconset/icon_16x16.png +0 -0
- package/build/icon.iconset/icon_16x16@2x.png +0 -0
- package/build/icon.iconset/icon_256x256.png +0 -0
- package/build/icon.iconset/icon_256x256@2x.png +0 -0
- package/build/icon.iconset/icon_32x32.png +0 -0
- package/build/icon.iconset/icon_32x32@2x.png +0 -0
- package/build/icon.iconset/icon_512x512.png +0 -0
- package/build/icon.iconset/icon_512x512@2x.png +0 -0
- package/build/icon.png +0 -0
- package/build/installer-header.bmp +0 -0
- package/build/installer-header.png +0 -0
- package/build/installer-sidebar.bmp +0 -0
- package/build/installer-sidebar.png +0 -0
- package/build/installer.nsh +45 -0
- package/build/overlay-processing.png +0 -0
- package/build/overlay-recording.png +0 -0
- package/build/toolbar-record.png +0 -0
- package/build/toolbar-screenshot.png +0 -0
- package/build/toolbar-settings.png +0 -0
- package/build/toolbar-stop.png +0 -0
- package/dist/main/index.mjs +12612 -0
- package/dist/preload/index.mjs +907 -0
- package/dist/renderer/assets/index-CCmUjl9K.js +19495 -0
- package/dist/renderer/assets/index-CUqz_Gs6.css +2270 -0
- package/dist/renderer/index.html +27 -0
- package/docs/AI_AGENT_QUICKSTART.md +42 -0
- package/docs/AI_PIPELINE_DESIGN.md +595 -0
- package/docs/API.md +514 -0
- package/docs/ARCHITECTURE.md +460 -0
- package/docs/CONFIGURATION.md +336 -0
- package/docs/DEVELOPMENT.md +508 -0
- package/docs/EXPORT_FORMATS.md +451 -0
- package/docs/GETTING_STARTED.md +236 -0
- package/docs/KEYBOARD_SHORTCUTS.md +334 -0
- package/docs/TROUBLESHOOTING.md +418 -0
- package/docs/landing/index.html +672 -0
- package/docs/landing/script.js +342 -0
- package/docs/landing/styles.css +1543 -0
- package/electron-builder.yml +140 -0
- package/electron.vite.config.ts +63 -0
- package/package.json +108 -0
- package/railway.json +12 -0
- package/scripts/build.mjs +51 -0
- package/scripts/generate-icons.mjs +314 -0
- package/scripts/generate-installer-images.cjs +253 -0
- package/scripts/generate-tray-icons.mjs +258 -0
- package/scripts/notarize.cjs +180 -0
- package/scripts/one-click-clean-test.sh +147 -0
- package/scripts/postinstall.mjs +36 -0
- package/scripts/setup-markupr.sh +55 -0
- package/setup +17 -0
- package/site/index.html +1835 -0
- package/site/package.json +11 -0
- package/site/railway.json +12 -0
- package/site/server.js +31 -0
- package/src/main/AutoUpdater.ts +392 -0
- package/src/main/CrashRecovery.ts +655 -0
- package/src/main/ErrorHandler.ts +703 -0
- package/src/main/HotkeyManager.ts +399 -0
- package/src/main/MenuManager.ts +529 -0
- package/src/main/PermissionManager.ts +420 -0
- package/src/main/SessionController.ts +1465 -0
- package/src/main/TrayManager.ts +540 -0
- package/src/main/ai/AIPipelineManager.ts +199 -0
- package/src/main/ai/ClaudeAnalyzer.ts +339 -0
- package/src/main/ai/ImageOptimizer.ts +176 -0
- package/src/main/ai/StructuredMarkdownBuilder.ts +379 -0
- package/src/main/ai/index.ts +16 -0
- package/src/main/ai/types.ts +258 -0
- package/src/main/analysis/ClarificationGenerator.ts +385 -0
- package/src/main/analysis/FeedbackAnalyzer.ts +531 -0
- package/src/main/analysis/index.ts +19 -0
- package/src/main/audio/AudioCapture.ts +978 -0
- package/src/main/audio/audioUtils.ts +100 -0
- package/src/main/audio/index.ts +20 -0
- package/src/main/capture/index.ts +1 -0
- package/src/main/index.ts +1693 -0
- package/src/main/ipc/captureHandlers.ts +272 -0
- package/src/main/ipc/index.ts +45 -0
- package/src/main/ipc/outputHandlers.ts +302 -0
- package/src/main/ipc/sessionHandlers.ts +56 -0
- package/src/main/ipc/settingsHandlers.ts +471 -0
- package/src/main/ipc/types.ts +56 -0
- package/src/main/ipc/windowHandlers.ts +277 -0
- package/src/main/output/ClipboardService.ts +369 -0
- package/src/main/output/ExportService.ts +539 -0
- package/src/main/output/FileManager.ts +416 -0
- package/src/main/output/MarkdownGenerator.ts +791 -0
- package/src/main/output/MarkdownPatcher.ts +299 -0
- package/src/main/output/index.ts +186 -0
- package/src/main/output/sessionAdapter.ts +207 -0
- package/src/main/output/templates/html-template.ts +553 -0
- package/src/main/pipeline/FrameExtractor.ts +330 -0
- package/src/main/pipeline/PostProcessor.ts +399 -0
- package/src/main/pipeline/TranscriptAnalyzer.ts +226 -0
- package/src/main/pipeline/index.ts +36 -0
- package/src/main/platform/WindowsTaskbar.ts +600 -0
- package/src/main/platform/index.ts +16 -0
- package/src/main/settings/SettingsManager.ts +730 -0
- package/src/main/settings/index.ts +19 -0
- package/src/main/transcription/ModelDownloadManager.ts +494 -0
- package/src/main/transcription/TierManager.ts +219 -0
- package/src/main/transcription/TranscriptionRecoveryService.ts +340 -0
- package/src/main/transcription/WhisperService.ts +748 -0
- package/src/main/transcription/index.ts +56 -0
- package/src/main/transcription/types.ts +135 -0
- package/src/main/windows/PopoverManager.ts +284 -0
- package/src/main/windows/TaskbarIntegration.ts +452 -0
- package/src/main/windows/index.ts +23 -0
- package/src/preload/index.ts +1047 -0
- package/src/renderer/App.tsx +515 -0
- package/src/renderer/AppWrapper.tsx +28 -0
- package/src/renderer/assets/logo-dark.svg +7 -0
- package/src/renderer/assets/logo.svg +7 -0
- package/src/renderer/audio/AudioCaptureRenderer.ts +454 -0
- package/src/renderer/capture/ScreenRecordingRenderer.ts +492 -0
- package/src/renderer/components/AnnotationOverlay.tsx +836 -0
- package/src/renderer/components/AudioWaveform.tsx +811 -0
- package/src/renderer/components/ClarificationQuestions.tsx +656 -0
- package/src/renderer/components/CountdownTimer.tsx +495 -0
- package/src/renderer/components/CrashRecoveryDialog.tsx +632 -0
- package/src/renderer/components/DonateButton.tsx +127 -0
- package/src/renderer/components/ErrorBoundary.tsx +308 -0
- package/src/renderer/components/ExportDialog.tsx +872 -0
- package/src/renderer/components/HotkeyHint.tsx +261 -0
- package/src/renderer/components/KeyboardShortcuts.tsx +787 -0
- package/src/renderer/components/ModelDownloadDialog.tsx +844 -0
- package/src/renderer/components/Onboarding.tsx +1830 -0
- package/src/renderer/components/ProcessingOverlay.tsx +157 -0
- package/src/renderer/components/RecordingOverlay.tsx +423 -0
- package/src/renderer/components/SessionHistory.tsx +1746 -0
- package/src/renderer/components/SessionReview.tsx +1321 -0
- package/src/renderer/components/SettingsPanel.tsx +217 -0
- package/src/renderer/components/Skeleton.tsx +347 -0
- package/src/renderer/components/StatusIndicator.tsx +86 -0
- package/src/renderer/components/ThemeProvider.tsx +429 -0
- package/src/renderer/components/Tooltip.tsx +370 -0
- package/src/renderer/components/TranscriptionPreview.tsx +183 -0
- package/src/renderer/components/TranscriptionTierSelector.tsx +640 -0
- package/src/renderer/components/UpdateNotification.tsx +377 -0
- package/src/renderer/components/WindowSelector.tsx +947 -0
- package/src/renderer/components/index.ts +99 -0
- package/src/renderer/components/primitives/ApiKeyInput.tsx +98 -0
- package/src/renderer/components/primitives/ColorPicker.tsx +65 -0
- package/src/renderer/components/primitives/DangerButton.tsx +45 -0
- package/src/renderer/components/primitives/DirectoryPicker.tsx +41 -0
- package/src/renderer/components/primitives/Dropdown.tsx +34 -0
- package/src/renderer/components/primitives/KeyRecorder.tsx +117 -0
- package/src/renderer/components/primitives/SettingsSection.tsx +32 -0
- package/src/renderer/components/primitives/Slider.tsx +43 -0
- package/src/renderer/components/primitives/Toggle.tsx +36 -0
- package/src/renderer/components/primitives/index.ts +10 -0
- package/src/renderer/components/settings/AdvancedTab.tsx +174 -0
- package/src/renderer/components/settings/AppearanceTab.tsx +77 -0
- package/src/renderer/components/settings/GeneralTab.tsx +40 -0
- package/src/renderer/components/settings/HotkeysTab.tsx +79 -0
- package/src/renderer/components/settings/RecordingTab.tsx +84 -0
- package/src/renderer/components/settings/index.ts +9 -0
- package/src/renderer/components/settings/settingsStyles.ts +673 -0
- package/src/renderer/components/settings/tabConfig.tsx +85 -0
- package/src/renderer/components/settings/useSettingsPanel.ts +447 -0
- package/src/renderer/contexts/ProcessingContext.tsx +227 -0
- package/src/renderer/contexts/RecordingContext.tsx +683 -0
- package/src/renderer/contexts/UIContext.tsx +326 -0
- package/src/renderer/contexts/index.ts +24 -0
- package/src/renderer/donateMessages.ts +69 -0
- package/src/renderer/hooks/index.ts +75 -0
- package/src/renderer/hooks/useAnimation.tsx +544 -0
- package/src/renderer/hooks/useTheme.ts +313 -0
- package/src/renderer/index.html +26 -0
- package/src/renderer/main.tsx +52 -0
- package/src/renderer/styles/animations.css +1093 -0
- package/src/renderer/styles/app-shell.css +662 -0
- package/src/renderer/styles/globals.css +515 -0
- package/src/renderer/styles/theme.ts +578 -0
- package/src/renderer/types/electron.d.ts +385 -0
- package/src/shared/hotkeys.ts +283 -0
- package/src/shared/types.ts +809 -0
- package/tests/clipboard.test.ts +228 -0
- package/tests/e2e/criticalPaths.test.ts +594 -0
- package/tests/feedbackAnalyzer.test.ts +303 -0
- package/tests/integration/sessionFlow.test.ts +583 -0
- package/tests/markdownGenerator.test.ts +418 -0
- package/tests/output.test.ts +96 -0
- package/tests/setup.ts +486 -0
- package/tests/unit/appIntegration.test.ts +676 -0
- package/tests/unit/appViewState.test.ts +281 -0
- package/tests/unit/audioIpcChannels.test.ts +17 -0
- package/tests/unit/exportService.test.ts +492 -0
- package/tests/unit/hotkeys.test.ts +92 -0
- package/tests/unit/navigationPreload.test.ts +94 -0
- package/tests/unit/onboardingFlow.test.ts +345 -0
- package/tests/unit/permissionManager.test.ts +175 -0
- package/tests/unit/permissionManagerExpanded.test.ts +296 -0
- package/tests/unit/screenRecordingRenderer.test.ts +368 -0
- package/tests/unit/sessionController.test.ts +515 -0
- package/tests/unit/tierManager.test.ts +61 -0
- package/tests/unit/tierManagerExpanded.test.ts +142 -0
- package/tests/unit/transcriptAnalyzer.test.ts +64 -0
- package/tsconfig.json +25 -0
- package/vitest.config.ts +46 -0
|
@@ -0,0 +1,947 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Window Selector Component
|
|
3
|
+
*
|
|
4
|
+
* A modal dialog for selecting which window or screen to capture.
|
|
5
|
+
* Displays thumbnails in a grid with keyboard navigation support.
|
|
6
|
+
* Designed to feel like a native macOS picker - premium and responsive.
|
|
7
|
+
*
|
|
8
|
+
* Features:
|
|
9
|
+
* - Multi-monitor layout diagram showing physical arrangement
|
|
10
|
+
* - Per-display DPI indicators (HiDPI badge)
|
|
11
|
+
* - Keyboard navigation
|
|
12
|
+
*
|
|
13
|
+
* Animations:
|
|
14
|
+
* - Spring physics dialog entrance
|
|
15
|
+
* - Staggered grid item entrance
|
|
16
|
+
* - Smooth hover/selection transitions
|
|
17
|
+
* - Button press effects
|
|
18
|
+
*/
|
|
19
|
+
|
|
20
|
+
import React, { useState, useEffect, useCallback, useRef, useMemo } from 'react';
|
|
21
|
+
import type { CaptureSource, DisplayInfo } from '../../shared/types';
|
|
22
|
+
import { SkeletonWindowSource } from './Skeleton';
|
|
23
|
+
import { useTheme } from '../hooks/useTheme';
|
|
24
|
+
|
|
25
|
+
interface WindowSelectorProps {
|
|
26
|
+
sources: CaptureSource[];
|
|
27
|
+
onSelect: (source: CaptureSource) => void;
|
|
28
|
+
onCancel: () => void;
|
|
29
|
+
isLoading?: boolean;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
// =============================================================================
|
|
33
|
+
// Monitor Layout Component
|
|
34
|
+
// =============================================================================
|
|
35
|
+
|
|
36
|
+
interface MonitorLayoutProps {
|
|
37
|
+
displays: DisplayInfo[];
|
|
38
|
+
selectedSourceId: string | null;
|
|
39
|
+
onSelect: (sourceId: string) => void;
|
|
40
|
+
sources: CaptureSource[];
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
/**
|
|
44
|
+
* Visual diagram showing the physical arrangement of monitors
|
|
45
|
+
* Users can click on a monitor to select it for capture
|
|
46
|
+
*/
|
|
47
|
+
const MonitorLayout: React.FC<MonitorLayoutProps> = ({
|
|
48
|
+
displays,
|
|
49
|
+
selectedSourceId,
|
|
50
|
+
onSelect,
|
|
51
|
+
sources,
|
|
52
|
+
}) => {
|
|
53
|
+
const { colors } = useTheme();
|
|
54
|
+
// Calculate the bounding box of all displays
|
|
55
|
+
const layoutBounds = useMemo(() => {
|
|
56
|
+
if (displays.length === 0) {
|
|
57
|
+
return { minX: 0, minY: 0, width: 1920, height: 1080 };
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
let minX = Infinity;
|
|
61
|
+
let minY = Infinity;
|
|
62
|
+
let maxX = -Infinity;
|
|
63
|
+
let maxY = -Infinity;
|
|
64
|
+
|
|
65
|
+
displays.forEach((d) => {
|
|
66
|
+
minX = Math.min(minX, d.bounds.x);
|
|
67
|
+
minY = Math.min(minY, d.bounds.y);
|
|
68
|
+
maxX = Math.max(maxX, d.bounds.x + d.bounds.width);
|
|
69
|
+
maxY = Math.max(maxY, d.bounds.y + d.bounds.height);
|
|
70
|
+
});
|
|
71
|
+
|
|
72
|
+
return {
|
|
73
|
+
minX,
|
|
74
|
+
minY,
|
|
75
|
+
width: maxX - minX,
|
|
76
|
+
height: maxY - minY,
|
|
77
|
+
};
|
|
78
|
+
}, [displays]);
|
|
79
|
+
|
|
80
|
+
// Scale factor to fit the layout in the container
|
|
81
|
+
const containerWidth = 280;
|
|
82
|
+
const containerHeight = 160;
|
|
83
|
+
const padding = 16;
|
|
84
|
+
|
|
85
|
+
const scale = useMemo(() => {
|
|
86
|
+
const availableWidth = containerWidth - padding * 2;
|
|
87
|
+
const availableHeight = containerHeight - padding * 2;
|
|
88
|
+
|
|
89
|
+
const scaleX = availableWidth / layoutBounds.width;
|
|
90
|
+
const scaleY = availableHeight / layoutBounds.height;
|
|
91
|
+
|
|
92
|
+
return Math.min(scaleX, scaleY, 0.15); // Cap at 15% to prevent oversized displays
|
|
93
|
+
}, [layoutBounds]);
|
|
94
|
+
|
|
95
|
+
// Find the source ID for a given display index
|
|
96
|
+
const getSourceIdForDisplay = (displayIndex: number): string | null => {
|
|
97
|
+
// Screen source IDs are typically "screen:INDEX:0"
|
|
98
|
+
const screenSource = sources.find(
|
|
99
|
+
(s) => s.type === 'screen' && s.id === `screen:${displayIndex}:0`
|
|
100
|
+
);
|
|
101
|
+
return screenSource?.id || null;
|
|
102
|
+
};
|
|
103
|
+
|
|
104
|
+
if (displays.length <= 1) {
|
|
105
|
+
return null; // Don't show layout for single monitor
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
return (
|
|
109
|
+
<div style={monitorLayoutStyles.container}>
|
|
110
|
+
<div style={monitorLayoutStyles.label}>Monitor Arrangement</div>
|
|
111
|
+
<div style={monitorLayoutStyles.layoutArea}>
|
|
112
|
+
{displays.map((display, index) => {
|
|
113
|
+
const sourceId = getSourceIdForDisplay(index);
|
|
114
|
+
const isSelected = sourceId === selectedSourceId;
|
|
115
|
+
const isHiDPI = display.scaleFactor > 1;
|
|
116
|
+
|
|
117
|
+
// Calculate position within the container
|
|
118
|
+
const x = (display.bounds.x - layoutBounds.minX) * scale + padding;
|
|
119
|
+
const y = (display.bounds.y - layoutBounds.minY) * scale + padding;
|
|
120
|
+
const w = display.bounds.width * scale;
|
|
121
|
+
const h = display.bounds.height * scale;
|
|
122
|
+
|
|
123
|
+
return (
|
|
124
|
+
<button
|
|
125
|
+
key={display.id}
|
|
126
|
+
onClick={() => sourceId && onSelect(sourceId)}
|
|
127
|
+
disabled={!sourceId}
|
|
128
|
+
style={{
|
|
129
|
+
...monitorLayoutStyles.monitor,
|
|
130
|
+
left: x,
|
|
131
|
+
top: y,
|
|
132
|
+
width: w,
|
|
133
|
+
height: h,
|
|
134
|
+
borderColor: isSelected ? colors.accent.default : colors.border.strong,
|
|
135
|
+
backgroundColor: isSelected
|
|
136
|
+
? 'rgba(59, 130, 246, 0.2)'
|
|
137
|
+
: 'rgba(55, 65, 81, 0.5)',
|
|
138
|
+
cursor: sourceId ? 'pointer' : 'not-allowed',
|
|
139
|
+
opacity: sourceId ? 1 : 0.5,
|
|
140
|
+
}}
|
|
141
|
+
title={`${display.label} (${display.bounds.width}x${display.bounds.height}${isHiDPI ? ' @' + display.scaleFactor + 'x' : ''})`}
|
|
142
|
+
>
|
|
143
|
+
{/* Display label */}
|
|
144
|
+
<span style={monitorLayoutStyles.monitorLabel}>
|
|
145
|
+
{display.isPrimary && (
|
|
146
|
+
<span style={monitorLayoutStyles.primaryStar}>★</span>
|
|
147
|
+
)}
|
|
148
|
+
{index + 1}
|
|
149
|
+
</span>
|
|
150
|
+
|
|
151
|
+
{/* HiDPI indicator */}
|
|
152
|
+
{isHiDPI && (
|
|
153
|
+
<span style={monitorLayoutStyles.hiDpiBadge}>
|
|
154
|
+
{display.scaleFactor}x
|
|
155
|
+
</span>
|
|
156
|
+
)}
|
|
157
|
+
|
|
158
|
+
{/* Selection checkmark */}
|
|
159
|
+
{isSelected && (
|
|
160
|
+
<span style={monitorLayoutStyles.checkmark}>
|
|
161
|
+
<svg width="12" height="12" viewBox="0 0 12 12" fill="none">
|
|
162
|
+
<path
|
|
163
|
+
d="M2 6L5 9L10 3"
|
|
164
|
+
stroke={colors.accent.default}
|
|
165
|
+
strokeWidth="2"
|
|
166
|
+
strokeLinecap="round"
|
|
167
|
+
strokeLinejoin="round"
|
|
168
|
+
/>
|
|
169
|
+
</svg>
|
|
170
|
+
</span>
|
|
171
|
+
)}
|
|
172
|
+
</button>
|
|
173
|
+
);
|
|
174
|
+
})}
|
|
175
|
+
</div>
|
|
176
|
+
<div style={monitorLayoutStyles.hint}>
|
|
177
|
+
Click a monitor to capture it
|
|
178
|
+
</div>
|
|
179
|
+
</div>
|
|
180
|
+
);
|
|
181
|
+
};
|
|
182
|
+
|
|
183
|
+
const monitorLayoutStyles: Record<string, React.CSSProperties> = {
|
|
184
|
+
container: {
|
|
185
|
+
marginBottom: 16,
|
|
186
|
+
padding: 12,
|
|
187
|
+
backgroundColor: 'rgba(0, 0, 0, 0.2)',
|
|
188
|
+
borderRadius: 12,
|
|
189
|
+
border: '1px solid rgba(255, 255, 255, 0.06)',
|
|
190
|
+
},
|
|
191
|
+
label: {
|
|
192
|
+
color: 'var(--text-tertiary)',
|
|
193
|
+
fontSize: 11,
|
|
194
|
+
fontWeight: 600,
|
|
195
|
+
textTransform: 'uppercase',
|
|
196
|
+
letterSpacing: '0.05em',
|
|
197
|
+
marginBottom: 8,
|
|
198
|
+
},
|
|
199
|
+
layoutArea: {
|
|
200
|
+
position: 'relative',
|
|
201
|
+
width: 280,
|
|
202
|
+
height: 160,
|
|
203
|
+
margin: '0 auto',
|
|
204
|
+
backgroundColor: 'rgba(0, 0, 0, 0.3)',
|
|
205
|
+
borderRadius: 8,
|
|
206
|
+
border: '1px solid rgba(255, 255, 255, 0.05)',
|
|
207
|
+
},
|
|
208
|
+
monitor: {
|
|
209
|
+
position: 'absolute',
|
|
210
|
+
display: 'flex',
|
|
211
|
+
alignItems: 'center',
|
|
212
|
+
justifyContent: 'center',
|
|
213
|
+
borderRadius: 4,
|
|
214
|
+
border: '2px solid',
|
|
215
|
+
transition: 'all 0.15s ease',
|
|
216
|
+
outline: 'none',
|
|
217
|
+
padding: 0,
|
|
218
|
+
},
|
|
219
|
+
monitorLabel: {
|
|
220
|
+
color: 'var(--text-primary)',
|
|
221
|
+
fontSize: 11,
|
|
222
|
+
fontWeight: 600,
|
|
223
|
+
display: 'flex',
|
|
224
|
+
alignItems: 'center',
|
|
225
|
+
gap: 2,
|
|
226
|
+
},
|
|
227
|
+
primaryStar: {
|
|
228
|
+
color: 'var(--status-warning)',
|
|
229
|
+
fontSize: 10,
|
|
230
|
+
},
|
|
231
|
+
hiDpiBadge: {
|
|
232
|
+
position: 'absolute',
|
|
233
|
+
bottom: 2,
|
|
234
|
+
right: 2,
|
|
235
|
+
backgroundColor: 'rgba(139, 92, 246, 0.8)',
|
|
236
|
+
color: 'var(--text-inverse)',
|
|
237
|
+
fontSize: 8,
|
|
238
|
+
fontWeight: 600,
|
|
239
|
+
padding: '1px 3px',
|
|
240
|
+
borderRadius: 3,
|
|
241
|
+
},
|
|
242
|
+
checkmark: {
|
|
243
|
+
position: 'absolute',
|
|
244
|
+
top: 2,
|
|
245
|
+
right: 2,
|
|
246
|
+
},
|
|
247
|
+
hint: {
|
|
248
|
+
color: 'var(--text-tertiary)',
|
|
249
|
+
fontSize: 10,
|
|
250
|
+
textAlign: 'center',
|
|
251
|
+
marginTop: 8,
|
|
252
|
+
},
|
|
253
|
+
};
|
|
254
|
+
|
|
255
|
+
export const WindowSelector: React.FC<WindowSelectorProps> = ({
|
|
256
|
+
sources,
|
|
257
|
+
onSelect,
|
|
258
|
+
onCancel,
|
|
259
|
+
isLoading = false,
|
|
260
|
+
}) => {
|
|
261
|
+
const [selectedId, setSelectedId] = useState<string | null>(null);
|
|
262
|
+
const [focusIndex, setFocusIndex] = useState(0);
|
|
263
|
+
const gridRef = useRef<HTMLDivElement>(null);
|
|
264
|
+
|
|
265
|
+
// Calculate grid columns for keyboard navigation
|
|
266
|
+
const getColumnsCount = useCallback(() => {
|
|
267
|
+
if (!gridRef.current) return 3;
|
|
268
|
+
const gridWidth = gridRef.current.offsetWidth;
|
|
269
|
+
// Each item is ~140px (128px + gap)
|
|
270
|
+
return Math.max(1, Math.floor(gridWidth / 140));
|
|
271
|
+
}, []);
|
|
272
|
+
|
|
273
|
+
// Keyboard navigation
|
|
274
|
+
useEffect(() => {
|
|
275
|
+
const handleKeyDown = (e: KeyboardEvent) => {
|
|
276
|
+
const cols = getColumnsCount();
|
|
277
|
+
|
|
278
|
+
switch (e.key) {
|
|
279
|
+
case 'ArrowRight':
|
|
280
|
+
e.preventDefault();
|
|
281
|
+
setFocusIndex((i) => Math.min(i + 1, sources.length - 1));
|
|
282
|
+
break;
|
|
283
|
+
case 'ArrowLeft':
|
|
284
|
+
e.preventDefault();
|
|
285
|
+
setFocusIndex((i) => Math.max(i - 1, 0));
|
|
286
|
+
break;
|
|
287
|
+
case 'ArrowDown':
|
|
288
|
+
e.preventDefault();
|
|
289
|
+
setFocusIndex((i) => Math.min(i + cols, sources.length - 1));
|
|
290
|
+
break;
|
|
291
|
+
case 'ArrowUp':
|
|
292
|
+
e.preventDefault();
|
|
293
|
+
setFocusIndex((i) => Math.max(i - cols, 0));
|
|
294
|
+
break;
|
|
295
|
+
case 'Enter':
|
|
296
|
+
case ' ':
|
|
297
|
+
e.preventDefault();
|
|
298
|
+
if (sources[focusIndex]) {
|
|
299
|
+
setSelectedId(sources[focusIndex].id);
|
|
300
|
+
onSelect(sources[focusIndex]);
|
|
301
|
+
}
|
|
302
|
+
break;
|
|
303
|
+
case 'Escape':
|
|
304
|
+
e.preventDefault();
|
|
305
|
+
onCancel();
|
|
306
|
+
break;
|
|
307
|
+
case 'Tab':
|
|
308
|
+
// Allow tab to cycle through sources
|
|
309
|
+
e.preventDefault();
|
|
310
|
+
if (e.shiftKey) {
|
|
311
|
+
setFocusIndex((i) => (i > 0 ? i - 1 : sources.length - 1));
|
|
312
|
+
} else {
|
|
313
|
+
setFocusIndex((i) => (i < sources.length - 1 ? i + 1 : 0));
|
|
314
|
+
}
|
|
315
|
+
break;
|
|
316
|
+
}
|
|
317
|
+
};
|
|
318
|
+
|
|
319
|
+
window.addEventListener('keydown', handleKeyDown);
|
|
320
|
+
return () => window.removeEventListener('keydown', handleKeyDown);
|
|
321
|
+
}, [sources, focusIndex, onSelect, onCancel, getColumnsCount]);
|
|
322
|
+
|
|
323
|
+
// Auto-select first screen source (Entire Screen) by default
|
|
324
|
+
useEffect(() => {
|
|
325
|
+
if (sources.length > 0 && !selectedId) {
|
|
326
|
+
const firstScreen = sources.find((s) => s.type === 'screen');
|
|
327
|
+
const firstSource = firstScreen || sources[0];
|
|
328
|
+
setSelectedId(firstSource.id);
|
|
329
|
+
const index = sources.findIndex((s) => s.id === firstSource.id);
|
|
330
|
+
if (index >= 0) setFocusIndex(index);
|
|
331
|
+
}
|
|
332
|
+
}, [sources, selectedId]);
|
|
333
|
+
|
|
334
|
+
// Scroll focused item into view
|
|
335
|
+
useEffect(() => {
|
|
336
|
+
const focusedElement = document.querySelector(`[data-source-index="${focusIndex}"]`);
|
|
337
|
+
if (focusedElement) {
|
|
338
|
+
focusedElement.scrollIntoView({ block: 'nearest', behavior: 'smooth' });
|
|
339
|
+
}
|
|
340
|
+
}, [focusIndex]);
|
|
341
|
+
|
|
342
|
+
const handleSourceClick = useCallback((source: CaptureSource, index: number) => {
|
|
343
|
+
setSelectedId(source.id);
|
|
344
|
+
setFocusIndex(index);
|
|
345
|
+
}, []);
|
|
346
|
+
|
|
347
|
+
const handleStartRecording = useCallback(() => {
|
|
348
|
+
const source = sources.find((s) => s.id === selectedId);
|
|
349
|
+
if (source) {
|
|
350
|
+
onSelect(source);
|
|
351
|
+
}
|
|
352
|
+
}, [sources, selectedId, onSelect]);
|
|
353
|
+
|
|
354
|
+
// Separate screens and windows for better organization
|
|
355
|
+
const screens = sources.filter((s) => s.type === 'screen');
|
|
356
|
+
const windows = sources.filter((s) => s.type === 'window');
|
|
357
|
+
|
|
358
|
+
// Extract display info from screen sources for multi-monitor layout
|
|
359
|
+
const displays = useMemo(() => {
|
|
360
|
+
return screens
|
|
361
|
+
.filter((s) => s.display)
|
|
362
|
+
.map((s) => s.display as DisplayInfo);
|
|
363
|
+
}, [screens]);
|
|
364
|
+
|
|
365
|
+
// Handler for monitor layout selection
|
|
366
|
+
const handleMonitorSelect = useCallback((sourceId: string) => {
|
|
367
|
+
setSelectedId(sourceId);
|
|
368
|
+
const index = sources.findIndex((s) => s.id === sourceId);
|
|
369
|
+
if (index >= 0) setFocusIndex(index);
|
|
370
|
+
}, [sources]);
|
|
371
|
+
|
|
372
|
+
return (
|
|
373
|
+
<div style={styles.overlay} className="ff-backdrop-enter">
|
|
374
|
+
<div style={styles.modal} className="ff-dialog-enter">
|
|
375
|
+
{/* Header */}
|
|
376
|
+
<div style={styles.header}>
|
|
377
|
+
<h2 style={styles.title}>Select Window to Capture</h2>
|
|
378
|
+
<p style={styles.subtitle}>
|
|
379
|
+
Choose a screen or window, then start recording
|
|
380
|
+
</p>
|
|
381
|
+
</div>
|
|
382
|
+
|
|
383
|
+
{isLoading ? (
|
|
384
|
+
<div style={styles.content}>
|
|
385
|
+
<div style={styles.section}>
|
|
386
|
+
<h3 style={styles.sectionTitle}>Screens</h3>
|
|
387
|
+
<div style={styles.grid}>
|
|
388
|
+
<SkeletonWindowSource animation="shimmer" />
|
|
389
|
+
<SkeletonWindowSource animation="shimmer" />
|
|
390
|
+
</div>
|
|
391
|
+
</div>
|
|
392
|
+
<div style={styles.section}>
|
|
393
|
+
<h3 style={styles.sectionTitle}>Windows</h3>
|
|
394
|
+
<div style={styles.grid}>
|
|
395
|
+
<SkeletonWindowSource animation="shimmer" />
|
|
396
|
+
<SkeletonWindowSource animation="shimmer" />
|
|
397
|
+
<SkeletonWindowSource animation="shimmer" />
|
|
398
|
+
</div>
|
|
399
|
+
</div>
|
|
400
|
+
</div>
|
|
401
|
+
) : (
|
|
402
|
+
<div style={styles.content}>
|
|
403
|
+
{/* Multi-Monitor Layout Diagram */}
|
|
404
|
+
{displays.length > 1 && (
|
|
405
|
+
<MonitorLayout
|
|
406
|
+
displays={displays}
|
|
407
|
+
selectedSourceId={selectedId}
|
|
408
|
+
onSelect={handleMonitorSelect}
|
|
409
|
+
sources={sources}
|
|
410
|
+
/>
|
|
411
|
+
)}
|
|
412
|
+
|
|
413
|
+
{/* Screens Section */}
|
|
414
|
+
{screens.length > 0 && (
|
|
415
|
+
<div style={styles.section}>
|
|
416
|
+
<h3 style={styles.sectionTitle}>Screens</h3>
|
|
417
|
+
<div ref={gridRef} style={styles.grid}>
|
|
418
|
+
{screens.map((source, staggerIdx) => {
|
|
419
|
+
const globalIndex = sources.findIndex((s) => s.id === source.id);
|
|
420
|
+
return (
|
|
421
|
+
<SourceItem
|
|
422
|
+
key={source.id}
|
|
423
|
+
source={source}
|
|
424
|
+
isSelected={selectedId === source.id}
|
|
425
|
+
isFocused={focusIndex === globalIndex}
|
|
426
|
+
index={globalIndex}
|
|
427
|
+
staggerIndex={staggerIdx}
|
|
428
|
+
onClick={() => handleSourceClick(source, globalIndex)}
|
|
429
|
+
onDoubleClick={() => onSelect(source)}
|
|
430
|
+
/>
|
|
431
|
+
);
|
|
432
|
+
})}
|
|
433
|
+
</div>
|
|
434
|
+
</div>
|
|
435
|
+
)}
|
|
436
|
+
|
|
437
|
+
{/* Windows Section */}
|
|
438
|
+
{windows.length > 0 && (
|
|
439
|
+
<div style={styles.section}>
|
|
440
|
+
<h3 style={styles.sectionTitle}>Windows</h3>
|
|
441
|
+
<div style={styles.grid}>
|
|
442
|
+
{windows.map((source, staggerIdx) => {
|
|
443
|
+
const globalIndex = sources.findIndex((s) => s.id === source.id);
|
|
444
|
+
return (
|
|
445
|
+
<SourceItem
|
|
446
|
+
key={source.id}
|
|
447
|
+
source={source}
|
|
448
|
+
isSelected={selectedId === source.id}
|
|
449
|
+
isFocused={focusIndex === globalIndex}
|
|
450
|
+
index={globalIndex}
|
|
451
|
+
staggerIndex={screens.length + staggerIdx}
|
|
452
|
+
onClick={() => handleSourceClick(source, globalIndex)}
|
|
453
|
+
onDoubleClick={() => onSelect(source)}
|
|
454
|
+
/>
|
|
455
|
+
);
|
|
456
|
+
})}
|
|
457
|
+
</div>
|
|
458
|
+
</div>
|
|
459
|
+
)}
|
|
460
|
+
|
|
461
|
+
{sources.length === 0 && (
|
|
462
|
+
<div style={styles.emptyState}>
|
|
463
|
+
<span style={styles.emptyIcon}>No sources available</span>
|
|
464
|
+
<p style={styles.emptyText}>
|
|
465
|
+
Unable to find any screens or windows to capture.
|
|
466
|
+
<br />
|
|
467
|
+
Please check your screen recording permissions.
|
|
468
|
+
</p>
|
|
469
|
+
</div>
|
|
470
|
+
)}
|
|
471
|
+
</div>
|
|
472
|
+
)}
|
|
473
|
+
|
|
474
|
+
{/* Footer */}
|
|
475
|
+
<div style={styles.footer}>
|
|
476
|
+
<div style={styles.hint}>
|
|
477
|
+
<span style={styles.hintKey}>Arrow keys</span> to navigate
|
|
478
|
+
<span style={styles.hintSeparator}>|</span>
|
|
479
|
+
<span style={styles.hintKey}>Enter</span> to select
|
|
480
|
+
<span style={styles.hintSeparator}>|</span>
|
|
481
|
+
<span style={styles.hintKey}>Esc</span> to cancel
|
|
482
|
+
</div>
|
|
483
|
+
<div style={styles.buttonGroup}>
|
|
484
|
+
<button
|
|
485
|
+
style={styles.cancelButton}
|
|
486
|
+
className="ff-btn-press ff-transition-colors"
|
|
487
|
+
onClick={onCancel}
|
|
488
|
+
>
|
|
489
|
+
Cancel
|
|
490
|
+
</button>
|
|
491
|
+
<button
|
|
492
|
+
style={{
|
|
493
|
+
...styles.startButton,
|
|
494
|
+
...((!selectedId || isLoading) ? styles.startButtonDisabled : {}),
|
|
495
|
+
}}
|
|
496
|
+
className={`ff-btn-press ${selectedId && !isLoading ? 'ff-success-pulse' : ''}`}
|
|
497
|
+
onClick={handleStartRecording}
|
|
498
|
+
disabled={!selectedId || isLoading}
|
|
499
|
+
>
|
|
500
|
+
Start Recording
|
|
501
|
+
</button>
|
|
502
|
+
</div>
|
|
503
|
+
</div>
|
|
504
|
+
</div>
|
|
505
|
+
|
|
506
|
+
{/* pulse, spin, pageZoomIn keyframes provided by animations.css */}
|
|
507
|
+
</div>
|
|
508
|
+
);
|
|
509
|
+
};
|
|
510
|
+
|
|
511
|
+
/**
|
|
512
|
+
* Individual source item component with staggered entrance animation
|
|
513
|
+
*/
|
|
514
|
+
interface SourceItemProps {
|
|
515
|
+
source: CaptureSource;
|
|
516
|
+
isSelected: boolean;
|
|
517
|
+
isFocused: boolean;
|
|
518
|
+
index: number;
|
|
519
|
+
staggerIndex: number;
|
|
520
|
+
onClick: () => void;
|
|
521
|
+
onDoubleClick: () => void;
|
|
522
|
+
}
|
|
523
|
+
|
|
524
|
+
const SourceItem: React.FC<SourceItemProps> = ({
|
|
525
|
+
source,
|
|
526
|
+
isSelected,
|
|
527
|
+
isFocused,
|
|
528
|
+
index,
|
|
529
|
+
staggerIndex,
|
|
530
|
+
onClick,
|
|
531
|
+
onDoubleClick,
|
|
532
|
+
}) => {
|
|
533
|
+
const { colors } = useTheme();
|
|
534
|
+
const [isHovered, setIsHovered] = useState(false);
|
|
535
|
+
const [isPressed, setIsPressed] = useState(false);
|
|
536
|
+
|
|
537
|
+
const itemStyle: React.CSSProperties = {
|
|
538
|
+
...styles.sourceItem,
|
|
539
|
+
...(isSelected ? styles.sourceItemSelected : {}),
|
|
540
|
+
...(isFocused ? styles.sourceItemFocused : {}),
|
|
541
|
+
...(isHovered && !isSelected ? styles.sourceItemHovered : {}),
|
|
542
|
+
// Staggered entrance animation
|
|
543
|
+
animationDelay: `${staggerIndex * 40}ms`,
|
|
544
|
+
// Button press effect
|
|
545
|
+
transform: isPressed ? 'scale(0.97)' : isSelected ? 'scale(1.02)' : 'scale(1)',
|
|
546
|
+
};
|
|
547
|
+
|
|
548
|
+
const getSourceIcon = () => {
|
|
549
|
+
if (source.type === 'screen') {
|
|
550
|
+
return (
|
|
551
|
+
<svg width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="1.5">
|
|
552
|
+
<rect x="2" y="3" width="20" height="14" rx="2" />
|
|
553
|
+
<line x1="8" y1="21" x2="16" y2="21" />
|
|
554
|
+
<line x1="12" y1="17" x2="12" y2="21" />
|
|
555
|
+
</svg>
|
|
556
|
+
);
|
|
557
|
+
}
|
|
558
|
+
return (
|
|
559
|
+
<svg width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="1.5">
|
|
560
|
+
<rect x="3" y="3" width="18" height="18" rx="2" />
|
|
561
|
+
<line x1="3" y1="9" x2="21" y2="9" />
|
|
562
|
+
<circle cx="6" cy="6" r="1" fill="currentColor" />
|
|
563
|
+
<circle cx="9" cy="6" r="1" fill="currentColor" />
|
|
564
|
+
<circle cx="12" cy="6" r="1" fill="currentColor" />
|
|
565
|
+
</svg>
|
|
566
|
+
);
|
|
567
|
+
};
|
|
568
|
+
|
|
569
|
+
return (
|
|
570
|
+
<button
|
|
571
|
+
data-source-index={index}
|
|
572
|
+
className="ff-list-item-enter-scale"
|
|
573
|
+
style={itemStyle}
|
|
574
|
+
onClick={onClick}
|
|
575
|
+
onDoubleClick={onDoubleClick}
|
|
576
|
+
onMouseEnter={() => setIsHovered(true)}
|
|
577
|
+
onMouseLeave={() => {
|
|
578
|
+
setIsHovered(false);
|
|
579
|
+
setIsPressed(false);
|
|
580
|
+
}}
|
|
581
|
+
onMouseDown={() => setIsPressed(true)}
|
|
582
|
+
onMouseUp={() => setIsPressed(false)}
|
|
583
|
+
>
|
|
584
|
+
{/* Thumbnail with hover scale effect */}
|
|
585
|
+
<div
|
|
586
|
+
style={{
|
|
587
|
+
...styles.thumbnail,
|
|
588
|
+
transform: isHovered ? 'scale(1.02)' : 'scale(1)',
|
|
589
|
+
transition: 'transform 0.15s cubic-bezier(0.34, 1.56, 0.64, 1)',
|
|
590
|
+
}}
|
|
591
|
+
>
|
|
592
|
+
{source.thumbnail ? (
|
|
593
|
+
<img
|
|
594
|
+
src={source.thumbnail}
|
|
595
|
+
alt={source.name}
|
|
596
|
+
style={styles.thumbnailImage}
|
|
597
|
+
draggable={false}
|
|
598
|
+
/>
|
|
599
|
+
) : (
|
|
600
|
+
<div style={styles.thumbnailPlaceholder}>
|
|
601
|
+
{getSourceIcon()}
|
|
602
|
+
</div>
|
|
603
|
+
)}
|
|
604
|
+
</div>
|
|
605
|
+
|
|
606
|
+
{/* Name with resolution info for screens */}
|
|
607
|
+
<div style={styles.sourceName}>
|
|
608
|
+
{source.type === 'screen' ? (
|
|
609
|
+
<span style={styles.sourceNameWithBadge}>
|
|
610
|
+
{source.display?.label || source.name}
|
|
611
|
+
{source.display && source.display.scaleFactor > 1 && (
|
|
612
|
+
<span style={styles.hiDpiBadgeInline}>
|
|
613
|
+
{source.display.scaleFactor}x
|
|
614
|
+
</span>
|
|
615
|
+
)}
|
|
616
|
+
</span>
|
|
617
|
+
) : (
|
|
618
|
+
source.name
|
|
619
|
+
)}
|
|
620
|
+
</div>
|
|
621
|
+
|
|
622
|
+
{/* Resolution info for screens */}
|
|
623
|
+
{source.type === 'screen' && source.display && (
|
|
624
|
+
<div style={styles.resolutionInfo}>
|
|
625
|
+
{source.display.bounds.width} x {source.display.bounds.height}
|
|
626
|
+
</div>
|
|
627
|
+
)}
|
|
628
|
+
|
|
629
|
+
{/* Selection indicator with scale animation */}
|
|
630
|
+
<div
|
|
631
|
+
style={{
|
|
632
|
+
...styles.selectionDot,
|
|
633
|
+
...(isSelected ? styles.selectionDotSelected : {}),
|
|
634
|
+
transform: isSelected ? 'scale(1)' : 'scale(0.8)',
|
|
635
|
+
transition: 'all 0.2s cubic-bezier(0.34, 1.56, 0.64, 1)',
|
|
636
|
+
}}
|
|
637
|
+
>
|
|
638
|
+
{isSelected && (
|
|
639
|
+
<svg
|
|
640
|
+
width="8"
|
|
641
|
+
height="8"
|
|
642
|
+
viewBox="0 0 8 8"
|
|
643
|
+
fill="none"
|
|
644
|
+
style={{ position: 'absolute', top: 2, left: 2 }}
|
|
645
|
+
>
|
|
646
|
+
<path
|
|
647
|
+
d="M1.5 4L3 5.5L6.5 2"
|
|
648
|
+
stroke={colors.text.inverse}
|
|
649
|
+
strokeWidth="1.5"
|
|
650
|
+
strokeLinecap="round"
|
|
651
|
+
strokeLinejoin="round"
|
|
652
|
+
className="ff-success-check"
|
|
653
|
+
/>
|
|
654
|
+
</svg>
|
|
655
|
+
)}
|
|
656
|
+
</div>
|
|
657
|
+
</button>
|
|
658
|
+
);
|
|
659
|
+
};
|
|
660
|
+
|
|
661
|
+
// Extended CSS properties for webkit
|
|
662
|
+
type ExtendedCSSProperties = React.CSSProperties & {
|
|
663
|
+
WebkitAppRegion?: 'drag' | 'no-drag';
|
|
664
|
+
};
|
|
665
|
+
|
|
666
|
+
const styles: Record<string, ExtendedCSSProperties> = {
|
|
667
|
+
// Overlay
|
|
668
|
+
overlay: {
|
|
669
|
+
position: 'fixed',
|
|
670
|
+
inset: 0,
|
|
671
|
+
display: 'flex',
|
|
672
|
+
alignItems: 'center',
|
|
673
|
+
justifyContent: 'center',
|
|
674
|
+
backgroundColor: 'rgba(0, 0, 0, 0.6)',
|
|
675
|
+
backdropFilter: 'blur(4px)',
|
|
676
|
+
zIndex: 50,
|
|
677
|
+
animation: 'pageZoomIn 0.15s ease-out',
|
|
678
|
+
},
|
|
679
|
+
|
|
680
|
+
// Modal container
|
|
681
|
+
modal: {
|
|
682
|
+
backgroundColor: 'rgba(17, 24, 39, 0.98)',
|
|
683
|
+
borderRadius: 16,
|
|
684
|
+
boxShadow: '0 25px 50px -12px rgba(0, 0, 0, 0.6), 0 0 0 1px rgba(255, 255, 255, 0.1)',
|
|
685
|
+
width: '100%',
|
|
686
|
+
maxWidth: 640,
|
|
687
|
+
maxHeight: '80vh',
|
|
688
|
+
margin: 16,
|
|
689
|
+
display: 'flex',
|
|
690
|
+
flexDirection: 'column',
|
|
691
|
+
overflow: 'hidden',
|
|
692
|
+
WebkitAppRegion: 'no-drag',
|
|
693
|
+
},
|
|
694
|
+
|
|
695
|
+
// Header
|
|
696
|
+
header: {
|
|
697
|
+
padding: '20px 24px 16px',
|
|
698
|
+
borderBottom: '1px solid rgba(255, 255, 255, 0.08)',
|
|
699
|
+
},
|
|
700
|
+
title: {
|
|
701
|
+
color: 'var(--text-primary)',
|
|
702
|
+
fontSize: 18,
|
|
703
|
+
fontWeight: 600,
|
|
704
|
+
margin: 0,
|
|
705
|
+
letterSpacing: '-0.01em',
|
|
706
|
+
},
|
|
707
|
+
subtitle: {
|
|
708
|
+
color: 'var(--text-secondary)',
|
|
709
|
+
fontSize: 13,
|
|
710
|
+
margin: '6px 0 0',
|
|
711
|
+
},
|
|
712
|
+
|
|
713
|
+
// Content area
|
|
714
|
+
content: {
|
|
715
|
+
flex: 1,
|
|
716
|
+
overflowY: 'auto',
|
|
717
|
+
padding: '16px 24px',
|
|
718
|
+
},
|
|
719
|
+
|
|
720
|
+
// Section
|
|
721
|
+
section: {
|
|
722
|
+
marginBottom: 20,
|
|
723
|
+
},
|
|
724
|
+
sectionTitle: {
|
|
725
|
+
color: 'var(--text-tertiary)',
|
|
726
|
+
fontSize: 11,
|
|
727
|
+
fontWeight: 600,
|
|
728
|
+
textTransform: 'uppercase',
|
|
729
|
+
letterSpacing: '0.05em',
|
|
730
|
+
margin: '0 0 12px',
|
|
731
|
+
},
|
|
732
|
+
|
|
733
|
+
// Grid
|
|
734
|
+
grid: {
|
|
735
|
+
display: 'grid',
|
|
736
|
+
gridTemplateColumns: 'repeat(auto-fill, minmax(128px, 1fr))',
|
|
737
|
+
gap: 12,
|
|
738
|
+
},
|
|
739
|
+
|
|
740
|
+
// Source item
|
|
741
|
+
sourceItem: {
|
|
742
|
+
display: 'flex',
|
|
743
|
+
flexDirection: 'column',
|
|
744
|
+
alignItems: 'center',
|
|
745
|
+
padding: 12,
|
|
746
|
+
borderRadius: 12,
|
|
747
|
+
border: '2px solid transparent',
|
|
748
|
+
backgroundColor: 'rgba(255, 255, 255, 0.04)',
|
|
749
|
+
cursor: 'pointer',
|
|
750
|
+
transition: 'all 0.15s ease',
|
|
751
|
+
outline: 'none',
|
|
752
|
+
},
|
|
753
|
+
sourceItemHovered: {
|
|
754
|
+
backgroundColor: 'rgba(255, 255, 255, 0.08)',
|
|
755
|
+
},
|
|
756
|
+
sourceItemSelected: {
|
|
757
|
+
backgroundColor: 'rgba(59, 130, 246, 0.15)',
|
|
758
|
+
borderColor: 'var(--accent-default)',
|
|
759
|
+
},
|
|
760
|
+
sourceItemFocused: {
|
|
761
|
+
boxShadow: '0 0 0 2px rgba(59, 130, 246, 0.5)',
|
|
762
|
+
},
|
|
763
|
+
|
|
764
|
+
// Thumbnail
|
|
765
|
+
thumbnail: {
|
|
766
|
+
width: 104,
|
|
767
|
+
height: 64,
|
|
768
|
+
borderRadius: 8,
|
|
769
|
+
overflow: 'hidden',
|
|
770
|
+
backgroundColor: 'rgba(0, 0, 0, 0.3)',
|
|
771
|
+
marginBottom: 8,
|
|
772
|
+
display: 'flex',
|
|
773
|
+
alignItems: 'center',
|
|
774
|
+
justifyContent: 'center',
|
|
775
|
+
border: '1px solid rgba(255, 255, 255, 0.08)',
|
|
776
|
+
},
|
|
777
|
+
thumbnailImage: {
|
|
778
|
+
width: '100%',
|
|
779
|
+
height: '100%',
|
|
780
|
+
objectFit: 'cover',
|
|
781
|
+
},
|
|
782
|
+
thumbnailPlaceholder: {
|
|
783
|
+
color: 'var(--text-tertiary)',
|
|
784
|
+
display: 'flex',
|
|
785
|
+
alignItems: 'center',
|
|
786
|
+
justifyContent: 'center',
|
|
787
|
+
},
|
|
788
|
+
|
|
789
|
+
// Source name
|
|
790
|
+
sourceName: {
|
|
791
|
+
color: 'var(--text-primary)',
|
|
792
|
+
fontSize: 11,
|
|
793
|
+
fontWeight: 500,
|
|
794
|
+
textAlign: 'center',
|
|
795
|
+
overflow: 'hidden',
|
|
796
|
+
textOverflow: 'ellipsis',
|
|
797
|
+
whiteSpace: 'nowrap',
|
|
798
|
+
width: '100%',
|
|
799
|
+
padding: '0 4px',
|
|
800
|
+
marginBottom: 4,
|
|
801
|
+
},
|
|
802
|
+
sourceNameWithBadge: {
|
|
803
|
+
display: 'inline-flex',
|
|
804
|
+
alignItems: 'center',
|
|
805
|
+
gap: 4,
|
|
806
|
+
},
|
|
807
|
+
hiDpiBadgeInline: {
|
|
808
|
+
backgroundColor: 'rgba(139, 92, 246, 0.8)',
|
|
809
|
+
color: 'var(--text-inverse)',
|
|
810
|
+
fontSize: 8,
|
|
811
|
+
fontWeight: 600,
|
|
812
|
+
padding: '1px 4px',
|
|
813
|
+
borderRadius: 3,
|
|
814
|
+
flexShrink: 0,
|
|
815
|
+
},
|
|
816
|
+
resolutionInfo: {
|
|
817
|
+
color: 'var(--text-tertiary)',
|
|
818
|
+
fontSize: 9,
|
|
819
|
+
textAlign: 'center',
|
|
820
|
+
marginBottom: 4,
|
|
821
|
+
},
|
|
822
|
+
|
|
823
|
+
// Selection dot
|
|
824
|
+
selectionDot: {
|
|
825
|
+
width: 12,
|
|
826
|
+
height: 12,
|
|
827
|
+
borderRadius: '50%',
|
|
828
|
+
border: '2px solid var(--border-strong)',
|
|
829
|
+
backgroundColor: 'transparent',
|
|
830
|
+
transition: 'all 0.15s ease',
|
|
831
|
+
},
|
|
832
|
+
selectionDotSelected: {
|
|
833
|
+
borderColor: 'var(--accent-default)',
|
|
834
|
+
backgroundColor: 'var(--accent-default)',
|
|
835
|
+
},
|
|
836
|
+
|
|
837
|
+
// Loading state
|
|
838
|
+
loadingContainer: {
|
|
839
|
+
display: 'flex',
|
|
840
|
+
flexDirection: 'column',
|
|
841
|
+
alignItems: 'center',
|
|
842
|
+
justifyContent: 'center',
|
|
843
|
+
padding: '48px 24px',
|
|
844
|
+
gap: 16,
|
|
845
|
+
},
|
|
846
|
+
spinner: {
|
|
847
|
+
width: 32,
|
|
848
|
+
height: 32,
|
|
849
|
+
border: '3px solid rgba(255, 255, 255, 0.1)',
|
|
850
|
+
borderTopColor: 'var(--accent-default)',
|
|
851
|
+
borderRadius: '50%',
|
|
852
|
+
animation: 'spin 0.8s linear infinite',
|
|
853
|
+
},
|
|
854
|
+
loadingText: {
|
|
855
|
+
color: 'var(--text-secondary)',
|
|
856
|
+
fontSize: 13,
|
|
857
|
+
},
|
|
858
|
+
|
|
859
|
+
// Empty state
|
|
860
|
+
emptyState: {
|
|
861
|
+
display: 'flex',
|
|
862
|
+
flexDirection: 'column',
|
|
863
|
+
alignItems: 'center',
|
|
864
|
+
justifyContent: 'center',
|
|
865
|
+
padding: '48px 24px',
|
|
866
|
+
textAlign: 'center',
|
|
867
|
+
},
|
|
868
|
+
emptyIcon: {
|
|
869
|
+
color: 'var(--text-tertiary)',
|
|
870
|
+
fontSize: 14,
|
|
871
|
+
fontWeight: 500,
|
|
872
|
+
marginBottom: 8,
|
|
873
|
+
},
|
|
874
|
+
emptyText: {
|
|
875
|
+
color: 'var(--text-tertiary)',
|
|
876
|
+
fontSize: 13,
|
|
877
|
+
lineHeight: 1.5,
|
|
878
|
+
margin: 0,
|
|
879
|
+
},
|
|
880
|
+
|
|
881
|
+
// Footer
|
|
882
|
+
footer: {
|
|
883
|
+
padding: '16px 24px 20px',
|
|
884
|
+
borderTop: '1px solid rgba(255, 255, 255, 0.08)',
|
|
885
|
+
display: 'flex',
|
|
886
|
+
flexDirection: 'column',
|
|
887
|
+
gap: 16,
|
|
888
|
+
},
|
|
889
|
+
|
|
890
|
+
// Keyboard hints
|
|
891
|
+
hint: {
|
|
892
|
+
color: 'var(--text-tertiary)',
|
|
893
|
+
fontSize: 11,
|
|
894
|
+
textAlign: 'center',
|
|
895
|
+
display: 'flex',
|
|
896
|
+
alignItems: 'center',
|
|
897
|
+
justifyContent: 'center',
|
|
898
|
+
gap: 6,
|
|
899
|
+
flexWrap: 'wrap',
|
|
900
|
+
},
|
|
901
|
+
hintKey: {
|
|
902
|
+
backgroundColor: 'rgba(255, 255, 255, 0.08)',
|
|
903
|
+
padding: '2px 6px',
|
|
904
|
+
borderRadius: 4,
|
|
905
|
+
fontFamily: 'system-ui, -apple-system, sans-serif',
|
|
906
|
+
fontWeight: 500,
|
|
907
|
+
},
|
|
908
|
+
hintSeparator: {
|
|
909
|
+
color: 'var(--border-strong)',
|
|
910
|
+
},
|
|
911
|
+
|
|
912
|
+
// Buttons
|
|
913
|
+
buttonGroup: {
|
|
914
|
+
display: 'flex',
|
|
915
|
+
justifyContent: 'flex-end',
|
|
916
|
+
gap: 12,
|
|
917
|
+
},
|
|
918
|
+
cancelButton: {
|
|
919
|
+
padding: '10px 20px',
|
|
920
|
+
borderRadius: 8,
|
|
921
|
+
border: 'none',
|
|
922
|
+
backgroundColor: 'rgba(255, 255, 255, 0.08)',
|
|
923
|
+
color: 'var(--text-primary)',
|
|
924
|
+
fontSize: 14,
|
|
925
|
+
fontWeight: 500,
|
|
926
|
+
cursor: 'pointer',
|
|
927
|
+
transition: 'all 0.15s ease',
|
|
928
|
+
},
|
|
929
|
+
startButton: {
|
|
930
|
+
padding: '10px 24px',
|
|
931
|
+
borderRadius: 8,
|
|
932
|
+
border: 'none',
|
|
933
|
+
backgroundColor: 'var(--accent-default)',
|
|
934
|
+
color: 'var(--text-inverse)',
|
|
935
|
+
fontSize: 14,
|
|
936
|
+
fontWeight: 600,
|
|
937
|
+
cursor: 'pointer',
|
|
938
|
+
transition: 'all 0.15s ease',
|
|
939
|
+
},
|
|
940
|
+
startButtonDisabled: {
|
|
941
|
+
backgroundColor: 'var(--bg-tertiary)',
|
|
942
|
+
color: 'var(--text-tertiary)',
|
|
943
|
+
cursor: 'not-allowed',
|
|
944
|
+
},
|
|
945
|
+
};
|
|
946
|
+
|
|
947
|
+
export default WindowSelector;
|