redesign capture and settings
This commit is contained in:
@@ -0,0 +1,13 @@
|
|||||||
|
{
|
||||||
|
"$schema": "../gen/schemas/desktop-schema.json",
|
||||||
|
"identifier": "main-window",
|
||||||
|
"description": "Window controls for the main ByteSize title bar",
|
||||||
|
"windows": ["main"],
|
||||||
|
"permissions": [
|
||||||
|
"core:window:allow-close",
|
||||||
|
"core:window:allow-minimize",
|
||||||
|
"core:window:allow-is-maximized",
|
||||||
|
"core:window:allow-toggle-maximize",
|
||||||
|
"core:window:allow-internal-toggle-maximize"
|
||||||
|
]
|
||||||
|
}
|
||||||
+14
-2
@@ -212,12 +212,24 @@ impl Config {
|
|||||||
}
|
}
|
||||||
|
|
||||||
pub fn save(&self, path: &Path) -> Result<()> {
|
pub fn save(&self, path: &Path) -> Result<()> {
|
||||||
|
use std::io::Write;
|
||||||
|
|
||||||
let serialized = toml::to_string_pretty(self)?;
|
let serialized = toml::to_string_pretty(self)?;
|
||||||
if let Some(parent) = path.parent() {
|
if let Some(parent) = path.parent() {
|
||||||
std::fs::create_dir_all(parent)?;
|
std::fs::create_dir_all(parent)?;
|
||||||
}
|
}
|
||||||
std::fs::write(path, serialized)?;
|
let staging = path.with_extension("toml.part");
|
||||||
Ok(())
|
let result = (|| {
|
||||||
|
let mut file = std::fs::File::create(&staging)?;
|
||||||
|
file.write_all(serialized.as_bytes())?;
|
||||||
|
file.sync_all()?;
|
||||||
|
drop(file);
|
||||||
|
std::fs::rename(&staging, path)
|
||||||
|
})();
|
||||||
|
if result.is_err() {
|
||||||
|
drop(std::fs::remove_file(&staging));
|
||||||
|
}
|
||||||
|
result.map_err(Into::into)
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn needs_first_run(&self) -> bool {
|
pub fn needs_first_run(&self) -> bool {
|
||||||
|
|||||||
@@ -1147,6 +1147,21 @@ pub(crate) fn extract_thumbnails(
|
|||||||
Ok(paths)
|
Ok(paths)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pub(crate) fn display_preview(ffmpeg: &Path, x: i32, y: i32, width: u32, height: u32) -> Result<Vec<u8>> {
|
||||||
|
use std::os::windows::process::CommandExt;
|
||||||
|
const CREATE_NO_WINDOW: u32 = 0x0800_0000;
|
||||||
|
let output = Command::new(ffmpeg)
|
||||||
|
.creation_flags(CREATE_NO_WINDOW)
|
||||||
|
.args(["-hide_banner", "-loglevel", "error", "-f", "gdigrab", "-draw_mouse", "0"])
|
||||||
|
.args(["-offset_x", &x.to_string(), "-offset_y", &y.to_string(), "-video_size", &format!("{width}x{height}")])
|
||||||
|
.args(["-i", "desktop", "-frames:v", "1", "-vf", "scale=960:-2", "-c:v", "mjpeg", "-f", "image2pipe", "pipe:1"])
|
||||||
|
.output().context("opening display preview")?;
|
||||||
|
if !output.status.success() || output.stdout.is_empty() {
|
||||||
|
bail!(ffmpeg_failure_message("display preview", output.status, &output.stderr));
|
||||||
|
}
|
||||||
|
Ok(output.stdout)
|
||||||
|
}
|
||||||
|
|
||||||
pub(crate) fn mux_with_audio(
|
pub(crate) fn mux_with_audio(
|
||||||
ffmpeg: &Path,
|
ffmpeg: &Path,
|
||||||
video: &Path,
|
video: &Path,
|
||||||
|
|||||||
+79
-58
@@ -181,34 +181,36 @@ pub struct HotkeyRegistrationResult {
|
|||||||
pub pause_ok: Option<bool>,
|
pub pause_ok: Option<bool>,
|
||||||
}
|
}
|
||||||
|
|
||||||
fn register_hotkeys(app: &AppHandle, cfg: &Config) -> HotkeyRegistrationResult {
|
fn configured_hotkeys(config: &Config) -> [Option<&str>; 3] {
|
||||||
|
[
|
||||||
|
config.hotkeys.start.as_deref(),
|
||||||
|
config.hotkeys.stop.as_deref(),
|
||||||
|
config.hotkeys.pause.as_deref(),
|
||||||
|
]
|
||||||
|
}
|
||||||
|
|
||||||
|
fn register_hotkeys(app: &AppHandle, cfg: &Config) -> (HotkeyRegistrationResult, Vec<Shortcut>) {
|
||||||
let gs = app.global_shortcut();
|
let gs = app.global_shortcut();
|
||||||
drop(gs.unregister_all());
|
let mut added = Vec::new();
|
||||||
|
let [start_ok, stop_ok, pause_ok] = configured_hotkeys(cfg).map(|input| {
|
||||||
let start_ok = cfg
|
input.map(|input| {
|
||||||
.hotkeys
|
let Some(shortcut) = parse_shortcut(input) else { return false };
|
||||||
.start
|
if gs.is_registered(shortcut) {
|
||||||
.as_deref()
|
return true;
|
||||||
.and_then(parse_shortcut)
|
|
||||||
.map(|sc| gs.register(sc).is_ok());
|
|
||||||
let stop_ok = cfg
|
|
||||||
.hotkeys
|
|
||||||
.stop
|
|
||||||
.as_deref()
|
|
||||||
.and_then(parse_shortcut)
|
|
||||||
.map(|sc| gs.register(sc).is_ok());
|
|
||||||
let pause_ok = cfg
|
|
||||||
.hotkeys
|
|
||||||
.pause
|
|
||||||
.as_deref()
|
|
||||||
.and_then(parse_shortcut)
|
|
||||||
.map(|sc| gs.register(sc).is_ok());
|
|
||||||
|
|
||||||
HotkeyRegistrationResult {
|
|
||||||
start_ok,
|
|
||||||
stop_ok,
|
|
||||||
pause_ok,
|
|
||||||
}
|
}
|
||||||
|
match gs.register(shortcut) {
|
||||||
|
Ok(()) => {
|
||||||
|
added.push(shortcut);
|
||||||
|
true
|
||||||
|
}
|
||||||
|
Err(e) => {
|
||||||
|
tracing::warn!("could not register {input}: {e}");
|
||||||
|
false
|
||||||
|
}
|
||||||
|
}
|
||||||
|
})
|
||||||
|
});
|
||||||
|
(HotkeyRegistrationResult { start_ok, stop_ok, pause_ok }, added)
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Serialize)]
|
#[derive(Serialize)]
|
||||||
@@ -217,36 +219,13 @@ struct SaveConfigResult {
|
|||||||
}
|
}
|
||||||
|
|
||||||
fn validate_config(config: &Config) -> Result<(), String> {
|
fn validate_config(config: &Config) -> Result<(), String> {
|
||||||
let mut keys = Vec::new();
|
let mut seen = Vec::new();
|
||||||
if let Some(k) = config
|
for input in configured_hotkeys(config).into_iter().flatten() {
|
||||||
.hotkeys
|
if let Some(shortcut) = parse_shortcut(input) {
|
||||||
.start
|
if seen.contains(&shortcut) {
|
||||||
.as_deref()
|
return Err(format!("duplicate shortcut: {input}"));
|
||||||
.filter(|s| !s.trim().is_empty())
|
|
||||||
{
|
|
||||||
keys.push(("start", k));
|
|
||||||
}
|
|
||||||
if let Some(k) = config
|
|
||||||
.hotkeys
|
|
||||||
.stop
|
|
||||||
.as_deref()
|
|
||||||
.filter(|s| !s.trim().is_empty())
|
|
||||||
{
|
|
||||||
keys.push(("stop", k));
|
|
||||||
}
|
|
||||||
if let Some(k) = config
|
|
||||||
.hotkeys
|
|
||||||
.pause
|
|
||||||
.as_deref()
|
|
||||||
.filter(|s| !s.trim().is_empty())
|
|
||||||
{
|
|
||||||
keys.push(("pause", k));
|
|
||||||
}
|
|
||||||
for (i, (a, ka)) in keys.iter().enumerate() {
|
|
||||||
for (b, kb) in keys.iter().skip(i + 1) {
|
|
||||||
if ka.eq_ignore_ascii_case(kb) {
|
|
||||||
return Err(format!("duplicate hotkey: {a} and {b} both use {ka}"));
|
|
||||||
}
|
}
|
||||||
|
seen.push(shortcut);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Ok(())
|
Ok(())
|
||||||
@@ -259,10 +238,33 @@ fn save_config(
|
|||||||
config: Config,
|
config: Config,
|
||||||
) -> Result<SaveConfigResult, String> {
|
) -> Result<SaveConfigResult, String> {
|
||||||
validate_config(&config)?;
|
validate_config(&config)?;
|
||||||
|
let mut current = lock(&state.config);
|
||||||
|
let gs = app.global_shortcut();
|
||||||
|
let (hotkey_result, added) = register_hotkeys(&app, &config);
|
||||||
|
let failed = [hotkey_result.start_ok, hotkey_result.stop_ok, hotkey_result.pause_ok]
|
||||||
|
.contains(&Some(false));
|
||||||
|
if failed {
|
||||||
|
for shortcut in added {
|
||||||
|
drop(gs.unregister(shortcut));
|
||||||
|
}
|
||||||
|
return Ok(SaveConfigResult { hotkey_result });
|
||||||
|
}
|
||||||
let path = config::config_path(&state.app_dir);
|
let path = config::config_path(&state.app_dir);
|
||||||
config.save(&path).map_err(|e| format!("{e:#}"))?;
|
if let Err(e) = config.save(&path) {
|
||||||
*lock(&state.config) = config.clone();
|
for shortcut in added {
|
||||||
let hotkey_result = register_hotkeys(&app, &config);
|
drop(gs.unregister(shortcut));
|
||||||
|
}
|
||||||
|
return Err(format!("{e:#}"));
|
||||||
|
}
|
||||||
|
let next = configured_hotkeys(&config).map(|input| input.and_then(parse_shortcut));
|
||||||
|
for shortcut in configured_hotkeys(¤t).into_iter().flatten().filter_map(parse_shortcut) {
|
||||||
|
if !next.contains(&Some(shortcut)) {
|
||||||
|
if let Err(e) = gs.unregister(shortcut) {
|
||||||
|
tracing::warn!("could not unregister an old hotkey: {e}");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
*current = config;
|
||||||
Ok(SaveConfigResult { hotkey_result })
|
Ok(SaveConfigResult { hotkey_result })
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1149,6 +1151,18 @@ fn render_raw_preview(state: State<'_, AppState>, timestamp: f64) -> Result<Path
|
|||||||
Ok(out_path)
|
Ok(out_path)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[tauri::command(async)]
|
||||||
|
fn preview_display(app: AppHandle, state: State<'_, AppState>, x: i32, y: i32) -> Result<tauri::ipc::Response, String> {
|
||||||
|
let window = app.get_webview_window("main").ok_or_else(|| "main window is unavailable".to_string())?;
|
||||||
|
let screen = window.available_monitors().map_err(|error| error.to_string())?
|
||||||
|
.into_iter().find(|monitor| monitor.position().x == x && monitor.position().y == y)
|
||||||
|
.ok_or_else(|| "display is no longer available".to_string())?;
|
||||||
|
let size = screen.size();
|
||||||
|
let png_or_jpeg = encode::display_preview(&bootstrap::ffmpeg_path(&state.app_dir), x, y, size.width, size.height)
|
||||||
|
.map_err(|error| format!("{error:#}"))?;
|
||||||
|
Ok(tauri::ipc::Response::new(png_or_jpeg))
|
||||||
|
}
|
||||||
|
|
||||||
#[derive(Debug, Serialize)]
|
#[derive(Debug, Serialize)]
|
||||||
pub struct ExportResult {
|
pub struct ExportResult {
|
||||||
pub output_path: PathBuf,
|
pub output_path: PathBuf,
|
||||||
@@ -1524,6 +1538,11 @@ fn enforce_overlay_aspect(app: AppHandle, state: State<'_, AppState>) -> Result<
|
|||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[tauri::command]
|
||||||
|
async fn check_for_updates() -> Result<Option<updates::UpdateInfo>, String> {
|
||||||
|
updates::check_for_update().await.map_err(|error| format!("{error:#}"))
|
||||||
|
}
|
||||||
|
|
||||||
#[tauri::command]
|
#[tauri::command]
|
||||||
fn list_windows() -> Vec<windows_list::WindowInfo> {
|
fn list_windows() -> Vec<windows_list::WindowInfo> {
|
||||||
windows_list::list_visible_windows()
|
windows_list::list_visible_windows()
|
||||||
@@ -2361,6 +2380,7 @@ pub fn run() {
|
|||||||
download_update,
|
download_update,
|
||||||
apply_update,
|
apply_update,
|
||||||
pending_update,
|
pending_update,
|
||||||
|
check_for_updates,
|
||||||
start_capture,
|
start_capture,
|
||||||
pause_capture,
|
pause_capture,
|
||||||
resume_capture,
|
resume_capture,
|
||||||
@@ -2371,6 +2391,7 @@ pub fn run() {
|
|||||||
default_output_path,
|
default_output_path,
|
||||||
extract_thumbnails,
|
extract_thumbnails,
|
||||||
render_preview,
|
render_preview,
|
||||||
|
preview_display,
|
||||||
render_raw_preview,
|
render_raw_preview,
|
||||||
estimate_gif_params,
|
estimate_gif_params,
|
||||||
estimate_gif_params_table,
|
estimate_gif_params_table,
|
||||||
|
|||||||
@@ -14,10 +14,11 @@
|
|||||||
{
|
{
|
||||||
"label": "main",
|
"label": "main",
|
||||||
"title": "ByteSize",
|
"title": "ByteSize",
|
||||||
"width": 900,
|
"width": 1120,
|
||||||
"height": 600,
|
"height": 760,
|
||||||
"minWidth": 600,
|
"minWidth": 600,
|
||||||
"minHeight": 400,
|
"minHeight": 400,
|
||||||
|
"decorations": false,
|
||||||
"resizable": true,
|
"resizable": true,
|
||||||
"fullscreen": false
|
"fullscreen": false
|
||||||
},
|
},
|
||||||
|
|||||||
+13
-14
@@ -11,6 +11,8 @@
|
|||||||
type View = "loading" | "bootstrap" | "first-run" | "main" | "settings"
|
type View = "loading" | "bootstrap" | "first-run" | "main" | "settings"
|
||||||
|
|
||||||
let view: View = $state("loading")
|
let view: View = $state("loading")
|
||||||
|
let updatesOpen = $state(false)
|
||||||
|
let updateCheck = $state(0)
|
||||||
|
|
||||||
async function refresh() {
|
async function refresh() {
|
||||||
view = "loading"
|
view = "loading"
|
||||||
@@ -35,29 +37,26 @@
|
|||||||
onMount(refresh)
|
onMount(refresh)
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<UpdateBanner />
|
<div class="app-view" hidden={updatesOpen}>
|
||||||
|
|
||||||
<div class="view-stage" class:shift={view !== "loading"}>
|
|
||||||
{#if view === "loading"}
|
{#if view === "loading"}
|
||||||
<Loading />
|
<Loading />
|
||||||
{:else if view === "bootstrap"}
|
{:else if view === "bootstrap"}
|
||||||
<Bootstrap onReady={refresh} />
|
<Bootstrap onReady={refresh} />
|
||||||
{:else if view === "first-run"}
|
{:else if view === "first-run"}
|
||||||
<FirstRun onDone={refresh} />
|
<FirstRun onDone={refresh} />
|
||||||
{:else if view === "settings"}
|
|
||||||
<Settings onClose={() => view = "main"} />
|
|
||||||
{:else}
|
{:else}
|
||||||
<Main onSettings={() => view = "settings"} />
|
<div class="app-view" hidden={view === "settings"}>
|
||||||
|
<Main settingsOpen={view === "settings" || updatesOpen} onSettings={() => view = "settings"} />
|
||||||
|
</div>
|
||||||
|
{#if view === "settings"}
|
||||||
|
<Settings onClose={() => view = "main"} onCheckUpdates={() => { updatesOpen = true; updateCheck++ }} />
|
||||||
|
{/if}
|
||||||
{/if}
|
{/if}
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<UpdateBanner bind:expanded={updatesOpen} checkRequest={updateCheck} />
|
||||||
|
|
||||||
<style>
|
<style>
|
||||||
.view-stage {
|
:global(#app) { display: flex; flex-direction: column; height: 100dvh; overflow: hidden; }
|
||||||
min-height: 100vh;
|
.app-view { display: contents; }
|
||||||
animation: enter 180ms ease-out;
|
|
||||||
}
|
|
||||||
@keyframes enter {
|
|
||||||
from { opacity: 0; transform: translateY(4px); }
|
|
||||||
to { opacity: 1; transform: translateY(0); }
|
|
||||||
}
|
|
||||||
</style>
|
</style>
|
||||||
|
|||||||
+19
-209
@@ -1,4 +1,6 @@
|
|||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
|
import SetupScreen from "./ui/SetupScreen.svelte"
|
||||||
|
import Progress from "./ui/Progress.svelte"
|
||||||
import { api, formatBytes, type DownloadProgress } from "./api"
|
import { api, formatBytes, type DownloadProgress } from "./api"
|
||||||
|
|
||||||
let { onReady }: { onReady: () => void } = $props()
|
let { onReady }: { onReady: () => void } = $props()
|
||||||
@@ -24,216 +26,24 @@
|
|||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<div class="stage">
|
<SetupScreen title={phase === "downloading" ? "Downloading FFmpeg" : phase === "error" ? "Could not install FFmpeg" : "Install FFmpeg"}
|
||||||
<div class="card">
|
subtitle={phase === "downloading" ? "ByteSize will verify and install the download automatically."
|
||||||
<div class="card-head">
|
: phase === "error" ? "Check your connection and try again."
|
||||||
<div class="logo">BYTESIZE</div>
|
: "ByteSize uses FFmpeg to export clips as MP4, WebM, or GIF."}>
|
||||||
<div class="tag">encoder setup</div>
|
{#if phase === "downloading"}
|
||||||
|
<div class="stack">
|
||||||
|
<Progress value={progress?.total ? progress.downloaded / progress.total * 100 : undefined} label="Downloading FFmpeg" compact />
|
||||||
|
<span class="note mono">{progress ? formatBytes(progress.downloaded) + (progress.total ? " of " + formatBytes(progress.total) : " downloaded") : "Connecting..."}</span>
|
||||||
</div>
|
</div>
|
||||||
|
{:else if phase === "error" && errMsg}
|
||||||
{#if phase === "idle"}
|
<p class="notice problem selectable" role="alert">{errMsg}</p>
|
||||||
<div class="body">
|
|
||||||
<p class="copy">
|
|
||||||
ByteSize needs <strong>ffmpeg</strong> to encode video. Download is ~30 MB and verified against a published SHA-256 checksum.
|
|
||||||
</p>
|
|
||||||
<button class="btn-primary" onclick={start}>Download ffmpeg</button>
|
|
||||||
<p class="manual">
|
|
||||||
Already have ffmpeg? Drop <code>ffmpeg.exe</code> into the <code>bin/</code> folder, then
|
|
||||||
<button class="link" onclick={onReady}>use it</button>.
|
|
||||||
</p>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
{:else if phase === "downloading"}
|
|
||||||
<div class="body">
|
|
||||||
<p class="status">Downloading ffmpeg</p>
|
|
||||||
{#if progress?.total}
|
|
||||||
<div class="track">
|
|
||||||
<div class="fill" style="width:{Math.min(100, (progress.downloaded / progress.total) * 100)}%"></div>
|
|
||||||
</div>
|
|
||||||
<p class="prog-text">
|
|
||||||
{formatBytes(progress.downloaded)} / {formatBytes(progress.total)}
|
|
||||||
</p>
|
|
||||||
{:else if progress}
|
|
||||||
<p class="prog-text">{formatBytes(progress.downloaded)} downloaded</p>
|
|
||||||
{:else}
|
{:else}
|
||||||
<p class="prog-text">Connecting</p>
|
<div class="row between"><span class="note">Install to</span><code class="mono selectable">.\bin\ffmpeg.exe</code></div>
|
||||||
{/if}
|
{/if}
|
||||||
</div>
|
{#snippet actions()}
|
||||||
|
{#if phase !== "downloading"}
|
||||||
{:else}
|
<button type="button" class="button ghost" onclick={onReady}>Use existing FFmpeg</button>
|
||||||
<div class="body">
|
<button type="button" class="button primary" onclick={start}>{phase === "error" ? "Retry download" : "Install"}</button>
|
||||||
<div class="err" role="alert">
|
|
||||||
<svg width="14" height="14" viewBox="0 0 14 14" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round">
|
|
||||||
<circle cx="7" cy="7" r="6"/><line x1="7" y1="4" x2="7" y2="7.5"/><circle cx="7" cy="10" r="0.5" fill="currentColor"/>
|
|
||||||
</svg>
|
|
||||||
Download failed
|
|
||||||
</div>
|
|
||||||
{#if errMsg}<pre class="err-detail">{errMsg}</pre>{/if}
|
|
||||||
<button class="btn-primary" onclick={start}>Retry</button>
|
|
||||||
<button class="link" onclick={onReady}>Use existing ffmpeg.exe</button>
|
|
||||||
</div>
|
|
||||||
{/if}
|
{/if}
|
||||||
</div>
|
{/snippet}
|
||||||
</div>
|
</SetupScreen>
|
||||||
|
|
||||||
<style>
|
|
||||||
.stage {
|
|
||||||
min-height: 100vh;
|
|
||||||
display: grid;
|
|
||||||
place-items: center;
|
|
||||||
padding: 24px;
|
|
||||||
background: var(--bg);
|
|
||||||
}
|
|
||||||
|
|
||||||
.card {
|
|
||||||
width: 100%;
|
|
||||||
max-width: 380px;
|
|
||||||
background: var(--bg-2);
|
|
||||||
border: 1px solid var(--border);
|
|
||||||
border-radius: var(--r-md);
|
|
||||||
overflow: hidden;
|
|
||||||
}
|
|
||||||
|
|
||||||
.card-head {
|
|
||||||
padding: 28px 24px 20px;
|
|
||||||
border-bottom: 1px solid var(--border);
|
|
||||||
text-align: center;
|
|
||||||
}
|
|
||||||
|
|
||||||
.logo {
|
|
||||||
font-family: var(--mono);
|
|
||||||
font-size: 13px;
|
|
||||||
font-weight: 500;
|
|
||||||
letter-spacing: 0.12em;
|
|
||||||
color: var(--accent);
|
|
||||||
}
|
|
||||||
|
|
||||||
.tag {
|
|
||||||
margin-top: 6px;
|
|
||||||
font-size: 12px;
|
|
||||||
color: var(--text-3);
|
|
||||||
letter-spacing: 0.02em;
|
|
||||||
}
|
|
||||||
|
|
||||||
.body {
|
|
||||||
padding: 24px;
|
|
||||||
display: flex;
|
|
||||||
flex-direction: column;
|
|
||||||
gap: 16px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.copy {
|
|
||||||
margin: 0;
|
|
||||||
font-size: 13px;
|
|
||||||
line-height: 1.6;
|
|
||||||
color: var(--text-2);
|
|
||||||
}
|
|
||||||
|
|
||||||
.copy strong {
|
|
||||||
color: var(--text);
|
|
||||||
font-weight: 600;
|
|
||||||
}
|
|
||||||
|
|
||||||
.btn-primary {
|
|
||||||
width: 100%;
|
|
||||||
padding: 11px 16px;
|
|
||||||
background: var(--accent);
|
|
||||||
border: none;
|
|
||||||
color: var(--accent-text);
|
|
||||||
border-radius: var(--r-sm);
|
|
||||||
font-family: var(--sans);
|
|
||||||
font-size: 13px;
|
|
||||||
font-weight: 600;
|
|
||||||
cursor: pointer;
|
|
||||||
transition: background 80ms;
|
|
||||||
}
|
|
||||||
.btn-primary:hover { background: var(--accent-hover); }
|
|
||||||
|
|
||||||
.manual {
|
|
||||||
margin: 0;
|
|
||||||
font-size: 12px;
|
|
||||||
color: var(--text-3);
|
|
||||||
text-align: center;
|
|
||||||
line-height: 1.5;
|
|
||||||
}
|
|
||||||
|
|
||||||
.manual code {
|
|
||||||
font-family: var(--mono);
|
|
||||||
font-size: 11px;
|
|
||||||
color: var(--text-2);
|
|
||||||
background: var(--bg-3);
|
|
||||||
padding: 1px 5px;
|
|
||||||
border-radius: var(--r-sm);
|
|
||||||
}
|
|
||||||
|
|
||||||
.link {
|
|
||||||
background: none;
|
|
||||||
border: none;
|
|
||||||
color: var(--accent);
|
|
||||||
cursor: pointer;
|
|
||||||
font-size: 12px;
|
|
||||||
padding: 0;
|
|
||||||
font-family: var(--sans);
|
|
||||||
text-decoration: underline;
|
|
||||||
text-underline-offset: 2px;
|
|
||||||
}
|
|
||||||
.link:hover { color: var(--accent-hover); }
|
|
||||||
|
|
||||||
.status {
|
|
||||||
margin: 0;
|
|
||||||
font-size: 13px;
|
|
||||||
color: var(--text-2);
|
|
||||||
text-align: center;
|
|
||||||
}
|
|
||||||
|
|
||||||
.track {
|
|
||||||
width: 100%;
|
|
||||||
height: 3px;
|
|
||||||
background: var(--bg-3);
|
|
||||||
border-radius: 2px;
|
|
||||||
overflow: hidden;
|
|
||||||
}
|
|
||||||
|
|
||||||
.fill {
|
|
||||||
height: 100%;
|
|
||||||
background: var(--accent);
|
|
||||||
border-radius: 2px;
|
|
||||||
transition: width 0.4s ease;
|
|
||||||
}
|
|
||||||
|
|
||||||
.prog-text {
|
|
||||||
margin: 0;
|
|
||||||
font-size: 11px;
|
|
||||||
font-family: var(--mono);
|
|
||||||
color: var(--text-3);
|
|
||||||
text-align: center;
|
|
||||||
}
|
|
||||||
|
|
||||||
.err {
|
|
||||||
display: flex;
|
|
||||||
align-items: center;
|
|
||||||
justify-content: center;
|
|
||||||
gap: 8px;
|
|
||||||
padding: 10px 14px;
|
|
||||||
background: var(--err-dim);
|
|
||||||
border: 1px solid var(--err-border);
|
|
||||||
border-radius: var(--r-sm);
|
|
||||||
font-size: 12px;
|
|
||||||
color: var(--err);
|
|
||||||
}
|
|
||||||
|
|
||||||
.err-detail {
|
|
||||||
margin: 0;
|
|
||||||
padding: 10px;
|
|
||||||
background: var(--bg-3);
|
|
||||||
border: 1px solid var(--border);
|
|
||||||
border-radius: var(--r-sm);
|
|
||||||
font-family: var(--mono);
|
|
||||||
font-size: 10px;
|
|
||||||
color: var(--err);
|
|
||||||
white-space: pre-wrap;
|
|
||||||
word-break: break-all;
|
|
||||||
max-height: 120px;
|
|
||||||
overflow-y: auto;
|
|
||||||
}
|
|
||||||
</style>
|
|
||||||
|
|||||||
+13
-143
@@ -1,4 +1,5 @@
|
|||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
|
import SetupScreen from "./ui/SetupScreen.svelte"
|
||||||
import { api } from "./api"
|
import { api } from "./api"
|
||||||
import HotkeyInput from "./HotkeyInput.svelte"
|
import HotkeyInput from "./HotkeyInput.svelte"
|
||||||
|
|
||||||
@@ -41,150 +42,19 @@
|
|||||||
let valid = $derived(!!start && !!stop && !!pause)
|
let valid = $derived(!!start && !!stop && !!pause)
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<div class="stage">
|
<SetupScreen title="Set recording shortcuts" subtitle="These shortcuts work while ByteSize is in the background.">
|
||||||
<div class="card">
|
<div>
|
||||||
<div class="card-head">
|
<div class="shortcut-row"><strong>Start recording</strong><HotkeyInput label="Start recording" bind:value={start} /></div>
|
||||||
<div class="logo">BYTESIZE</div>
|
<div class="shortcut-row"><strong>Stop recording</strong><HotkeyInput label="Stop recording" bind:value={stop} /></div>
|
||||||
<div class="tag">assign your hotkeys</div>
|
<div class="shortcut-row"><strong>Pause / resume</strong><HotkeyInput label="Pause or resume" bind:value={pause} /></div>
|
||||||
|
{#if warnings.length}<div class="notice problem" role="alert">{#each warnings as warning}<p>{warning}</p>{/each}</div>{/if}
|
||||||
</div>
|
</div>
|
||||||
|
{#snippet actions()}
|
||||||
<div class="body">
|
<button type="button" class="button primary" onclick={save} disabled={!valid || saving}>{saving ? "Saving..." : "Continue to capture"}</button>
|
||||||
<p class="copy">
|
{/snippet}
|
||||||
No defaults are shipped. Pick combos that work for you - you can change these later in settings.
|
</SetupScreen>
|
||||||
</p>
|
|
||||||
|
|
||||||
<div class="fields">
|
|
||||||
<label class="field">
|
|
||||||
<span class="field-label">Start recording</span>
|
|
||||||
<HotkeyInput bind:value={start} placeholder="e.g. F9" />
|
|
||||||
</label>
|
|
||||||
<label class="field">
|
|
||||||
<span class="field-label">Stop recording</span>
|
|
||||||
<HotkeyInput bind:value={stop} placeholder="e.g. F10" />
|
|
||||||
</label>
|
|
||||||
<label class="field">
|
|
||||||
<span class="field-label">Pause / resume</span>
|
|
||||||
<HotkeyInput bind:value={pause} placeholder="e.g. F11" />
|
|
||||||
</label>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
{#if warnings.length > 0}
|
|
||||||
<div class="warn" role="alert">
|
|
||||||
{#each warnings as w}<p>{w}</p>{/each}
|
|
||||||
</div>
|
|
||||||
{/if}
|
|
||||||
|
|
||||||
<button class="btn-primary" onclick={save} disabled={!valid || saving}>
|
|
||||||
{saving ? "Saving" : "Save and continue"}
|
|
||||||
</button>
|
|
||||||
|
|
||||||
<p class="hint">Click a field, press your combo. Escape to cancel.</p>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<style>
|
<style>
|
||||||
.stage {
|
.shortcut-row { display:flex; align-items:center; justify-content:space-between; gap:12px; padding:10px 0; }
|
||||||
min-height: 100vh;
|
.shortcut-row + .shortcut-row { border-top:var(--edge) solid var(--rule); }
|
||||||
display: grid;
|
|
||||||
place-items: center;
|
|
||||||
padding: 24px;
|
|
||||||
background: var(--bg);
|
|
||||||
}
|
|
||||||
|
|
||||||
.card {
|
|
||||||
width: 100%;
|
|
||||||
max-width: 400px;
|
|
||||||
background: var(--bg-2);
|
|
||||||
border: 1px solid var(--border);
|
|
||||||
border-radius: var(--r-md);
|
|
||||||
overflow: hidden;
|
|
||||||
}
|
|
||||||
|
|
||||||
.card-head {
|
|
||||||
padding: 28px 24px 20px;
|
|
||||||
border-bottom: 1px solid var(--border);
|
|
||||||
text-align: center;
|
|
||||||
}
|
|
||||||
|
|
||||||
.logo {
|
|
||||||
font-family: var(--mono);
|
|
||||||
font-size: 13px;
|
|
||||||
font-weight: 500;
|
|
||||||
letter-spacing: 0.12em;
|
|
||||||
color: var(--accent);
|
|
||||||
}
|
|
||||||
|
|
||||||
.tag {
|
|
||||||
margin-top: 6px;
|
|
||||||
font-size: 12px;
|
|
||||||
color: var(--text-3);
|
|
||||||
letter-spacing: 0.02em;
|
|
||||||
}
|
|
||||||
|
|
||||||
.body {
|
|
||||||
padding: 24px;
|
|
||||||
display: flex;
|
|
||||||
flex-direction: column;
|
|
||||||
gap: 16px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.copy {
|
|
||||||
margin: 0;
|
|
||||||
font-size: 13px;
|
|
||||||
line-height: 1.6;
|
|
||||||
color: var(--text-2);
|
|
||||||
text-align: center;
|
|
||||||
}
|
|
||||||
|
|
||||||
.fields {
|
|
||||||
display: flex;
|
|
||||||
flex-direction: column;
|
|
||||||
gap: 14px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.field {
|
|
||||||
display: flex;
|
|
||||||
flex-direction: column;
|
|
||||||
gap: 6px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.field-label {
|
|
||||||
font-size: 11px;
|
|
||||||
text-transform: uppercase;
|
|
||||||
letter-spacing: 0.08em;
|
|
||||||
color: var(--text-3);
|
|
||||||
}
|
|
||||||
|
|
||||||
.btn-primary {
|
|
||||||
width: 100%;
|
|
||||||
padding: 11px 16px;
|
|
||||||
background: var(--accent);
|
|
||||||
border: none;
|
|
||||||
color: var(--accent-text);
|
|
||||||
border-radius: var(--r-sm);
|
|
||||||
font-family: var(--sans);
|
|
||||||
font-size: 13px;
|
|
||||||
font-weight: 600;
|
|
||||||
cursor: pointer;
|
|
||||||
transition: background 80ms;
|
|
||||||
}
|
|
||||||
.btn-primary:hover:not(:disabled) { background: var(--accent-hover); }
|
|
||||||
.btn-primary:disabled { opacity: 0.4; cursor: not-allowed; }
|
|
||||||
|
|
||||||
.hint {
|
|
||||||
margin: 0;
|
|
||||||
font-size: 11px;
|
|
||||||
color: var(--text-3);
|
|
||||||
text-align: center;
|
|
||||||
}
|
|
||||||
|
|
||||||
.warn {
|
|
||||||
padding: 10px 14px;
|
|
||||||
background: var(--err-dim);
|
|
||||||
border: 1px solid var(--err-border);
|
|
||||||
border-radius: var(--r-sm);
|
|
||||||
text-align: center;
|
|
||||||
}
|
|
||||||
.warn p { margin: 0; font-size: 12px; color: var(--err); }
|
|
||||||
</style>
|
</style>
|
||||||
|
|||||||
@@ -1,10 +1,12 @@
|
|||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
|
import { IconX } from "./ui/icons"
|
||||||
let {
|
let {
|
||||||
value = $bindable(),
|
value = $bindable(),
|
||||||
placeholder = "press a key...",
|
placeholder = "Assign", label,
|
||||||
}: {
|
}: {
|
||||||
value: string | null
|
value: string | null
|
||||||
placeholder?: string
|
placeholder?: string
|
||||||
|
label: string
|
||||||
} = $props()
|
} = $props()
|
||||||
|
|
||||||
let capturing = $state(false)
|
let capturing = $state(false)
|
||||||
@@ -54,90 +56,16 @@
|
|||||||
</script>
|
</script>
|
||||||
|
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<button
|
<button bind:this={btn} class="button key" type="button" onclick={start} onkeydown={keydown}
|
||||||
bind:this={btn}
|
onblur={() => capturing = false} aria-label={capturing ? "Press a key combination for " + label : "Change shortcut for " + label}>
|
||||||
class="key"
|
{#if capturing}Press keys{:else if value}<kbd>{value}</kbd>{:else}<span class="note">{placeholder}</span>{/if}
|
||||||
class:capturing
|
|
||||||
onclick={start}
|
|
||||||
onkeydown={keydown}
|
|
||||||
onblur={() => { capturing = false }}
|
|
||||||
type="button"
|
|
||||||
aria-label={capturing ? "recording shortcut - press a key combo" : "click to assign shortcut"}
|
|
||||||
>
|
|
||||||
{#if capturing}
|
|
||||||
<span class="blink">type a combo</span>
|
|
||||||
{:else if value}
|
|
||||||
<span class="val">{value}</span>
|
|
||||||
{:else}
|
|
||||||
<span class="ph">{placeholder}</span>
|
|
||||||
{/if}
|
|
||||||
</button>
|
</button>
|
||||||
{#if value && !capturing}
|
{#if value && !capturing}
|
||||||
<button class="x" onclick={clear} type="button" aria-label="clear shortcut">
|
<button class="button ghost icon-only" onclick={clear} type="button" aria-label={"Clear shortcut for " + label}><IconX size={15} /></button>
|
||||||
<svg width="10" height="10" viewBox="0 0 10 10" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round">
|
|
||||||
<line x1="2" y1="2" x2="8" y2="8"/>
|
|
||||||
<line x1="8" y1="2" x2="2" y2="8"/>
|
|
||||||
</svg>
|
|
||||||
</button>
|
|
||||||
{/if}
|
{/if}
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<style>
|
<style>
|
||||||
.row {
|
.key { min-width:104px; }
|
||||||
display: flex;
|
.key kbd { white-space:nowrap; }
|
||||||
gap: 4px;
|
|
||||||
align-items: stretch;
|
|
||||||
}
|
|
||||||
|
|
||||||
.key {
|
|
||||||
flex: 1;
|
|
||||||
height: 34px;
|
|
||||||
padding: 0 12px;
|
|
||||||
background: var(--bg-3);
|
|
||||||
border: 1px solid var(--border-2);
|
|
||||||
color: var(--text);
|
|
||||||
border-radius: var(--r-sm);
|
|
||||||
cursor: pointer;
|
|
||||||
font-family: var(--mono);
|
|
||||||
font-size: 12px;
|
|
||||||
font-weight: 500;
|
|
||||||
letter-spacing: 0.02em;
|
|
||||||
transition: border-color 80ms, background 80ms;
|
|
||||||
text-align: left;
|
|
||||||
white-space: nowrap;
|
|
||||||
overflow: hidden;
|
|
||||||
text-overflow: ellipsis;
|
|
||||||
}
|
|
||||||
|
|
||||||
.key:hover { border-color: var(--border-3); background: var(--bg-4); }
|
|
||||||
.key:focus-visible { box-shadow: 0 0 0 1px var(--accent), 0 0 0 3px var(--accent-glow); outline: none; }
|
|
||||||
.key.capturing {
|
|
||||||
border-color: var(--accent);
|
|
||||||
background: var(--accent-dim);
|
|
||||||
color: var(--accent);
|
|
||||||
}
|
|
||||||
|
|
||||||
.val { color: var(--text); }
|
|
||||||
.ph { color: var(--text-3); font-style: italic; font-family: var(--sans); font-weight: 400; }
|
|
||||||
.blink { animation: blink 1s step-end infinite; color: var(--accent); }
|
|
||||||
|
|
||||||
@keyframes blink {
|
|
||||||
0%, 100% { opacity: 1; }
|
|
||||||
50% { opacity: 0.3; }
|
|
||||||
}
|
|
||||||
|
|
||||||
.x {
|
|
||||||
display: grid;
|
|
||||||
place-items: center;
|
|
||||||
width: 34px;
|
|
||||||
height: 34px;
|
|
||||||
background: transparent;
|
|
||||||
border: 1px solid var(--border);
|
|
||||||
color: var(--text-3);
|
|
||||||
border-radius: var(--r-sm);
|
|
||||||
cursor: pointer;
|
|
||||||
flex-shrink: 0;
|
|
||||||
transition: color 80ms, border-color 80ms;
|
|
||||||
}
|
|
||||||
.x:hover { color: var(--err); border-color: var(--err-border); }
|
|
||||||
</style>
|
</style>
|
||||||
|
|||||||
+2
-41
@@ -1,44 +1,5 @@
|
|||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
// Minimal loading state - a single breathing mark.
|
import SetupScreen from "./ui/SetupScreen.svelte"
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<div class="stage">
|
<SetupScreen title="Opening ByteSize" subtitle="Checking the encoder and recording settings." />
|
||||||
<div class="mark">
|
|
||||||
<span class="bar"></span>
|
|
||||||
<span class="bar"></span>
|
|
||||||
<span class="bar"></span>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<style>
|
|
||||||
.stage {
|
|
||||||
min-height: 100vh;
|
|
||||||
display: grid;
|
|
||||||
place-items: center;
|
|
||||||
background: var(--bg);
|
|
||||||
}
|
|
||||||
|
|
||||||
.mark {
|
|
||||||
display: flex;
|
|
||||||
gap: 4px;
|
|
||||||
align-items: flex-end;
|
|
||||||
height: 20px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.bar {
|
|
||||||
display: block;
|
|
||||||
width: 3px;
|
|
||||||
background: var(--accent);
|
|
||||||
border-radius: 1px;
|
|
||||||
animation: breathe 1s ease-in-out infinite;
|
|
||||||
}
|
|
||||||
|
|
||||||
.bar:nth-child(1) { height: 8px; animation-delay: 0ms; }
|
|
||||||
.bar:nth-child(2) { height: 16px; animation-delay: 120ms; }
|
|
||||||
.bar:nth-child(3) { height: 12px; animation-delay: 240ms; }
|
|
||||||
|
|
||||||
@keyframes breathe {
|
|
||||||
0%, 100% { opacity: 0.35; transform: scaleY(0.8); }
|
|
||||||
50% { opacity: 1; transform: scaleY(1); }
|
|
||||||
}
|
|
||||||
</style>
|
|
||||||
|
|||||||
+397
-539
File diff suppressed because it is too large
Load Diff
+124
-515
@@ -1,15 +1,21 @@
|
|||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
import { onMount } from "svelte"
|
import { onMount } from "svelte"
|
||||||
|
import { IconActivity, IconAdjustmentsHorizontal, IconFileExport, IconFolder, IconKeyboard, IconScan } from "./ui/icons"
|
||||||
|
import WindowBar from "./ui/WindowBar.svelte"
|
||||||
|
import WorkspaceScroll from "./ui/WorkspaceScroll.svelte"
|
||||||
|
import Dropdown from "./ui/Dropdown.svelte"
|
||||||
|
import Toggle from "./ui/Toggle.svelte"
|
||||||
|
import { appear, disclosure } from "./ui/motion"
|
||||||
|
import { scrollbar } from "./ui/scrollbar"
|
||||||
import { api, type Config, type CodecAvailability, type DiagnosticsInfo } from "./api"
|
import { api, type Config, type CodecAvailability, type DiagnosticsInfo } from "./api"
|
||||||
import HotkeyInput from "./HotkeyInput.svelte"
|
import HotkeyInput from "./HotkeyInput.svelte"
|
||||||
import { open } from "@tauri-apps/plugin-dialog"
|
import { open } from "@tauri-apps/plugin-dialog"
|
||||||
|
|
||||||
let { onClose }: { onClose: () => void } = $props()
|
let { onClose, onCheckUpdates }: { onClose: () => void; onCheckUpdates: () => void } = $props()
|
||||||
|
|
||||||
let cfg: Config | null = $state(null)
|
let cfg: Config | null = $state(null)
|
||||||
let saving: boolean = $state(false)
|
let saving: boolean = $state(false)
|
||||||
let hotkeyWarnings: string[] = $state([])
|
let hotkeyWarnings: string[] = $state([])
|
||||||
let showAdvanced: boolean = $state(false)
|
|
||||||
let activeTab: string = $state("capture")
|
let activeTab: string = $state("capture")
|
||||||
let initialCfg: Config | null = $state(null)
|
let initialCfg: Config | null = $state(null)
|
||||||
let codecs: CodecAvailability | null = $state(null)
|
let codecs: CodecAvailability | null = $state(null)
|
||||||
@@ -36,13 +42,34 @@
|
|||||||
let diagnostics: DiagnosticsInfo | null = $state(null)
|
let diagnostics: DiagnosticsInfo | null = $state(null)
|
||||||
|
|
||||||
const TABS = [
|
const TABS = [
|
||||||
{ id: "capture", label: "Capture" },
|
{ id: "capture", label: "Capture", icon: IconScan },
|
||||||
{ id: "export", label: "Export" },
|
{ id: "export", label: "Export", icon: IconFileExport },
|
||||||
{ id: "hotkeys", label: "Hotkeys" },
|
{ id: "hotkeys", label: "Shortcuts", icon: IconKeyboard },
|
||||||
{ id: "output", label: "Output" },
|
{ id: "output", label: "Files", icon: IconFolder },
|
||||||
{ id: "system", label: "System" },
|
{ id: "system", label: "System", icon: IconAdjustmentsHorizontal },
|
||||||
{ id: "diagnostics", label: "Diagnostics" },
|
{ id: "diagnostics", label: "Diagnostics", icon: IconActivity },
|
||||||
]
|
]
|
||||||
|
const descriptions: Record<string, string> = {
|
||||||
|
capture: "Choose defaults for new recordings.",
|
||||||
|
export: "Set format and encoding defaults for new clips.",
|
||||||
|
hotkeys: "Control recording while ByteSize is in the background.",
|
||||||
|
output: "Set where new exports are saved.",
|
||||||
|
system: "Manage appearance and app updates.",
|
||||||
|
diagnostics: "Check encoder availability and review recent activity.",
|
||||||
|
}
|
||||||
|
const rates = [1,2,5,10,15,24,30,60].map(value => ({value,label:value+" FPS"}))
|
||||||
|
const qualities = [{value:"auto",label:"Auto"},{value:"full",label:"Full"}] as const
|
||||||
|
const formats = [{value:"mp4",label:"MP4"},{value:"webm",label:"WebM"},{value:"gif",label:"GIF"}] as const
|
||||||
|
const dithers = [{value:"floyd_steinberg",label:"Floyd-Steinberg"},{value:"bayer",label:"Bayer"},{value:"none",label:"None"}] as const
|
||||||
|
const themes = [{value:"dark",label:"Dark"},{value:"light",label:"Light"}] as const
|
||||||
|
let mp4 = $derived.by(() => [
|
||||||
|
{value:"h264",label:codecs?.h264 === false ? "H.264 unavailable" : "H.264",disabled:codecs?.h264 === false},
|
||||||
|
{value:"h265",label:codecs?.h265 === false ? "H.265 unavailable" : "H.265",disabled:codecs?.h265 === false},
|
||||||
|
] as const)
|
||||||
|
let webm = $derived.by(() => [
|
||||||
|
{value:"vp9",label:codecs?.vp9 === false ? "VP9 unavailable" : "VP9",disabled:codecs?.vp9 === false},
|
||||||
|
{value:"av1",label:codecs?.av1 === false ? "AV1 unavailable" : "AV1",disabled:codecs?.av1 === false},
|
||||||
|
] as const)
|
||||||
|
|
||||||
onMount(async () => {
|
onMount(async () => {
|
||||||
cfg = await api.getConfig()
|
cfg = await api.getConfig()
|
||||||
@@ -87,7 +114,7 @@
|
|||||||
if (result.hotkey_result.stop_ok === false) failed.push("stop")
|
if (result.hotkey_result.stop_ok === false) failed.push("stop")
|
||||||
if (result.hotkey_result.pause_ok === false) failed.push("pause")
|
if (result.hotkey_result.pause_ok === false) failed.push("pause")
|
||||||
if (failed.length > 0) {
|
if (failed.length > 0) {
|
||||||
hotkeyWarnings = [`${failed.join(", ")} - hotkey may be in use by another app`]
|
hotkeyWarnings = [`Could not register the ${failed.join(", ")} shortcuts. Your settings were kept.`]
|
||||||
} else {
|
} else {
|
||||||
initialCfg = $state.snapshot(cfg)
|
initialCfg = $state.snapshot(cfg)
|
||||||
onClose()
|
onClose()
|
||||||
@@ -97,6 +124,12 @@
|
|||||||
} finally { saving = false }
|
} finally { saving = false }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function cancel() {
|
||||||
|
if (saving) return
|
||||||
|
if (initialCfg) document.documentElement.setAttribute("data-theme", initialCfg.theme)
|
||||||
|
onClose()
|
||||||
|
}
|
||||||
|
|
||||||
async function pickOutputDir() {
|
async function pickOutputDir() {
|
||||||
if (!cfg) return
|
if (!cfg) return
|
||||||
try {
|
try {
|
||||||
@@ -108,527 +141,103 @@
|
|||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<div class="settings">
|
<WindowBar current="settings" onCapture={cancel} onSettings={cancel} disabled={saving} />
|
||||||
<header class="settings-header">
|
<WorkspaceScroll>
|
||||||
<div class="header-left">
|
{#if cfg}
|
||||||
<button class="back-btn" onclick={onClose} aria-label="close settings">
|
<section class="settings-workspace">
|
||||||
<svg width="14" height="14" viewBox="0 0 14 14" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round">
|
<nav class="settings-nav" aria-label="Settings sections">
|
||||||
<polyline points="9,2 3,7 9,12"/>
|
<h3>Settings</h3>
|
||||||
</svg>
|
{#each TABS as tab}
|
||||||
</button>
|
<button type="button" class="button ghost" aria-current={activeTab === tab.id ? "true" : undefined}
|
||||||
<h1>Settings</h1>
|
onclick={() => activeTab = tab.id}><tab.icon size={17} />{tab.label}</button>
|
||||||
</div>
|
|
||||||
</header>
|
|
||||||
|
|
||||||
{#if cfg}
|
|
||||||
<div class="settings-body">
|
|
||||||
<!-- Tab nav -->
|
|
||||||
<nav class="tab-nav" aria-label="settings categories">
|
|
||||||
{#each TABS as t}
|
|
||||||
<button
|
|
||||||
class="tab"
|
|
||||||
class:active={activeTab === t.id}
|
|
||||||
aria-current={activeTab === t.id ? "true" : undefined}
|
|
||||||
onclick={() => activeTab = t.id}
|
|
||||||
>{t.label}</button>
|
|
||||||
{/each}
|
{/each}
|
||||||
</nav>
|
</nav>
|
||||||
|
{#key activeTab}
|
||||||
<!-- Tab content -->
|
<div class="settings-pane" use:appear>
|
||||||
<div class="tab-content">
|
<header>
|
||||||
|
<h1>{TABS.find(tab => tab.id === activeTab)?.label}</h1>
|
||||||
|
<p class="note">{descriptions[activeTab]}</p>
|
||||||
|
</header>
|
||||||
|
<div class="settings-fields">
|
||||||
{#if activeTab === "capture"}
|
{#if activeTab === "capture"}
|
||||||
<div class="tab-panel">
|
<div class="setting-row"><div><strong>Export frame rate</strong><p class="note">Preselected when you finish a recording.</p></div><Dropdown label="Default export frame rate" options={rates} bind:value={cfg.capture.default_fps} disabled={saving} /></div>
|
||||||
<div class="panel-head">
|
<div class="setting-row"><div><strong>Limit capture frame rate</strong><p class="note">Record at the selected rate instead of the display rate.</p></div><Toggle label="Limit capture frame rate" bind:checked={cfg.capture.limit_capture_fps} disabled={saving} /></div>
|
||||||
<h2>Capture</h2>
|
<div class="setting-row"><div><strong>Resolution</strong><p class="note">Auto caps the longest side at 1920 px.</p></div><Dropdown label="Default capture resolution" options={qualities} bind:value={cfg.capture.capture_quality} disabled={saving} /></div>
|
||||||
<p class="panel-desc">Recording behavior and defaults</p>
|
<div class="setting-row"><strong>Record mouse pointer</strong><Toggle label="Record mouse pointer" bind:checked={cfg.capture.capture_cursor} disabled={saving} /></div>
|
||||||
</div>
|
<div class="setting-row"><strong>Record system audio</strong><Toggle label="Record system audio" bind:checked={cfg.capture.capture_audio} disabled={saving} /></div>
|
||||||
<div class="field-list">
|
|
||||||
<label class="field">
|
|
||||||
<span class="field-label">Export FPS</span>
|
|
||||||
<select bind:value={cfg.capture.default_fps}>
|
|
||||||
{#each [15,24,30,60] as f}<option value={f}>{f} fps</option>{/each}
|
|
||||||
</select>
|
|
||||||
</label>
|
|
||||||
<label class="field-check">
|
|
||||||
<input type="checkbox" bind:checked={cfg.capture.limit_capture_fps} />
|
|
||||||
<span>Cap capture at this rate</span>
|
|
||||||
</label>
|
|
||||||
{#if cfg.capture.limit_capture_fps}
|
|
||||||
<p class="field-note">
|
|
||||||
Recording stops at {cfg.capture.default_fps} fps instead of the display's refresh
|
|
||||||
rate. Smaller temp files and less CPU, but nothing above that rate is captured.
|
|
||||||
</p>
|
|
||||||
{/if}
|
|
||||||
<label class="field">
|
|
||||||
<span class="field-label">Capture quality</span>
|
|
||||||
<select bind:value={cfg.capture.capture_quality}>
|
|
||||||
<option value="auto">Auto (cap 1920px, lower CPU)</option>
|
|
||||||
<option value="full">Full (native res up to 3840px)</option>
|
|
||||||
</select>
|
|
||||||
</label>
|
|
||||||
<label class="field-check">
|
|
||||||
<input type="checkbox" bind:checked={cfg.capture.capture_cursor} />
|
|
||||||
<span>Capture cursor</span>
|
|
||||||
</label>
|
|
||||||
<label class="field-check">
|
|
||||||
<input type="checkbox" bind:checked={cfg.capture.capture_audio} />
|
|
||||||
<span>Capture system audio</span>
|
|
||||||
</label>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
{:else if activeTab === "export"}
|
{:else if activeTab === "export"}
|
||||||
<div class="tab-panel">
|
<div class="setting-row"><div><strong>Default format</strong><p class="note">Preselected when you finish a recording.</p></div><Dropdown label="Default format" options={formats} bind:value={cfg.export.default_format} disabled={saving} /></div>
|
||||||
<div class="panel-head">
|
<details class="advanced" use:disclosure><summary>Advanced encoding</summary>
|
||||||
<h2>Export</h2>
|
<div class="disclosure-body">
|
||||||
<p class="panel-desc">Default format and encoding options</p>
|
<div class="setting-row"><strong>GIF dithering</strong><Dropdown label="Default GIF dithering" options={dithers} bind:value={cfg.export.gif_dither} disabled={saving} /></div>
|
||||||
|
<div class="setting-row"><strong>MP4 codec</strong><Dropdown label="MP4 codec" options={mp4} bind:value={cfg.export.mp4_codec} disabled={saving} /></div>
|
||||||
|
<div class="setting-row"><strong>WebM codec</strong><Dropdown label="WebM codec" options={webm} bind:value={cfg.export.webm_codec} disabled={saving} /></div>
|
||||||
</div>
|
</div>
|
||||||
<div class="field-list">
|
</details>
|
||||||
<label class="field">
|
|
||||||
<span class="field-label">Default format</span>
|
|
||||||
<select bind:value={cfg.export.default_format}>
|
|
||||||
<option value="gif">GIF</option>
|
|
||||||
<option value="webm">WebM</option>
|
|
||||||
<option value="mp4">MP4</option>
|
|
||||||
</select>
|
|
||||||
</label>
|
|
||||||
|
|
||||||
<button class="advanced-toggle" onclick={() => showAdvanced = !showAdvanced} aria-expanded={showAdvanced}>
|
|
||||||
<svg width="10" height="10" viewBox="0 0 10 10" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round" class:rotated={showAdvanced}>
|
|
||||||
<polyline points="2,3 5,6 8,3"/>
|
|
||||||
</svg>
|
|
||||||
Advanced codecs
|
|
||||||
</button>
|
|
||||||
|
|
||||||
{#if showAdvanced}
|
|
||||||
<label class="field">
|
|
||||||
<span class="field-label">GIF dithering</span>
|
|
||||||
<select bind:value={cfg.export.gif_dither}>
|
|
||||||
<option value="floyd_steinberg">Floyd-Steinberg</option>
|
|
||||||
<option value="bayer">Bayer</option>
|
|
||||||
<option value="none">None</option>
|
|
||||||
</select>
|
|
||||||
</label>
|
|
||||||
<label class="field">
|
|
||||||
<span class="field-label">WebM codec</span>
|
|
||||||
<select bind:value={cfg.export.webm_codec}>
|
|
||||||
<option value="vp9" disabled={codecs ? !codecs.vp9 : false}>VP9 (default){codecs && !codecs.vp9 ? " - unavailable" : ""}</option>
|
|
||||||
<option value="av1" disabled={codecs ? !codecs.av1 : false}>AV1 (smaller, slower){codecs && !codecs.av1 ? " - unavailable" : ""}</option>
|
|
||||||
</select>
|
|
||||||
</label>
|
|
||||||
<label class="field">
|
|
||||||
<span class="field-label">MP4 codec</span>
|
|
||||||
<select bind:value={cfg.export.mp4_codec}>
|
|
||||||
<option value="h264" disabled={codecs ? !codecs.h264 : false}>H.264 (default){codecs && !codecs.h264 ? " - unavailable" : ""}</option>
|
|
||||||
<option value="h265" disabled={codecs ? !codecs.h265 : false}>H.265 (smaller, less universal){codecs && !codecs.h265 ? " - unavailable" : ""}</option>
|
|
||||||
</select>
|
|
||||||
</label>
|
|
||||||
{#if codecs && (!codecs.av1 || !codecs.h265)}
|
|
||||||
<p class="field-note">Some codecs are unavailable in your ffmpeg build and disabled above.</p>
|
|
||||||
{/if}
|
|
||||||
{/if}
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
{:else if activeTab === "hotkeys"}
|
{:else if activeTab === "hotkeys"}
|
||||||
<div class="tab-panel">
|
<div class="setting-row"><strong>Start recording</strong><HotkeyInput label="Start recording" bind:value={cfg.hotkeys.start} placeholder="Assign" /></div>
|
||||||
<div class="panel-head">
|
<div class="setting-row"><strong>Stop recording</strong><HotkeyInput label="Stop recording" bind:value={cfg.hotkeys.stop} placeholder="Assign" /></div>
|
||||||
<h2>Hotkeys</h2>
|
<div class="setting-row"><strong>Pause / resume</strong><HotkeyInput label="Pause or resume" bind:value={cfg.hotkeys.pause} placeholder="Assign" /></div>
|
||||||
<p class="panel-desc">Global keyboard shortcuts</p>
|
|
||||||
</div>
|
|
||||||
<div class="field-list">
|
|
||||||
<label class="field">
|
|
||||||
<span class="field-label">Start recording</span>
|
|
||||||
<HotkeyInput bind:value={cfg.hotkeys.start} placeholder="e.g. F9" />
|
|
||||||
</label>
|
|
||||||
<label class="field">
|
|
||||||
<span class="field-label">Stop recording</span>
|
|
||||||
<HotkeyInput bind:value={cfg.hotkeys.stop} placeholder="e.g. F10" />
|
|
||||||
</label>
|
|
||||||
<label class="field">
|
|
||||||
<span class="field-label">Pause / resume</span>
|
|
||||||
<HotkeyInput bind:value={cfg.hotkeys.pause} placeholder="e.g. F11" />
|
|
||||||
</label>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
{:else if activeTab === "output"}
|
{:else if activeTab === "output"}
|
||||||
<div class="tab-panel">
|
<div class="setting-row"><label for="default-output"><strong>Default output folder</strong></label>
|
||||||
<div class="panel-head">
|
<input id="default-output" class="field mono folder" placeholder="Default output folder" value={cfg.output_dir ?? ""} oninput={e => { cfg!.output_dir = e.currentTarget.value.trim() || null }} disabled={saving} />
|
||||||
<h2>Output</h2>
|
|
||||||
<p class="panel-desc">Where exported files are saved</p>
|
|
||||||
</div>
|
</div>
|
||||||
<div class="field-list">
|
<div class="setting-row"><strong>Choose location</strong><button type="button" class="button" onclick={pickOutputDir} disabled={saving}><IconFolder size={17} />Browse</button></div>
|
||||||
<label class="field">
|
|
||||||
<span class="field-label">Save folder</span>
|
|
||||||
<div class="path-row">
|
|
||||||
<input type="text" class="path-input" placeholder="./output" value={cfg.output_dir ?? ""} oninput={(e) => { cfg!.output_dir = (e.currentTarget as HTMLInputElement).value.trim() || null }} />
|
|
||||||
<button class="btn-ghost" onclick={pickOutputDir}>Browse</button>
|
|
||||||
</div>
|
|
||||||
</label>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
{:else if activeTab === "system"}
|
{:else if activeTab === "system"}
|
||||||
<div class="tab-panel">
|
<div class="setting-row"><strong>Appearance</strong><Dropdown label="Appearance" options={themes} bind:value={cfg.theme} disabled={saving} /></div>
|
||||||
<div class="panel-head">
|
<div class="setting-row"><strong>Check for updates on launch</strong><Toggle label="Check for updates on launch" bind:checked={cfg.updates.check_on_launch} disabled={saving} /></div>
|
||||||
<h2>System</h2>
|
<div class="setting-row"><strong>App updates</strong><button type="button" class="button" onclick={onCheckUpdates} disabled={saving}>Check for updates</button></div>
|
||||||
<p class="panel-desc">Appearance and updates</p>
|
|
||||||
</div>
|
|
||||||
<div class="field-list">
|
|
||||||
<label class="field">
|
|
||||||
<span class="field-label">Theme</span>
|
|
||||||
<select bind:value={cfg.theme}>
|
|
||||||
<option value="dark">Dark</option>
|
|
||||||
<option value="light">Light</option>
|
|
||||||
</select>
|
|
||||||
</label>
|
|
||||||
<label class="field-check">
|
|
||||||
<input type="checkbox" bind:checked={cfg.updates.check_on_launch} />
|
|
||||||
<span>Check for updates on launch</span>
|
|
||||||
</label>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
{:else if activeTab === "diagnostics"}
|
|
||||||
<div class="tab-panel">
|
|
||||||
<div class="panel-head">
|
|
||||||
<h2>Diagnostics</h2>
|
|
||||||
<p class="panel-desc">Versions and recent log output</p>
|
|
||||||
</div>
|
|
||||||
<div class="field-list">
|
|
||||||
<div class="diag-row">
|
|
||||||
<span class="field-label">ByteSize</span>
|
|
||||||
<span class="diag-val mono">{diagnostics ? `v${diagnostics.app_version}` : "..."}</span>
|
|
||||||
</div>
|
|
||||||
<div class="diag-row">
|
|
||||||
<span class="field-label">ffmpeg</span>
|
|
||||||
<span class="diag-val mono">{diagnostics ? diagnostics.ffmpeg_version : "..."}</span>
|
|
||||||
</div>
|
|
||||||
<div class="diag-row">
|
|
||||||
<span class="field-label">Log folder</span>
|
|
||||||
<span class="diag-val mono">{diagnostics ? diagnostics.log_dir : "..."}</span>
|
|
||||||
<button class="btn-ghost compact" onclick={openLogFolder} disabled={!diagnostics}>Open</button>
|
|
||||||
</div>
|
|
||||||
<div class="diag-tail-wrap">
|
|
||||||
<div class="diag-tail-head">
|
|
||||||
<span class="field-label">Recent log</span>
|
|
||||||
<button class="link" onclick={refreshDiagnostics}>Refresh</button>
|
|
||||||
</div>
|
|
||||||
<pre class="diag-tail">{diagnostics ? diagnostics.log_tail || "(empty)" : "loading..."}</pre>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
{/if}
|
|
||||||
|
|
||||||
{#if hotkeyWarnings.length > 0}
|
|
||||||
<div class="warn-block" role="alert">
|
|
||||||
{#each hotkeyWarnings as w}<p>{w}</p>{/each}
|
|
||||||
<div class="warn-actions">
|
|
||||||
<button class="btn-warn" onclick={save} disabled={saving}>Try again</button>
|
|
||||||
<button class="btn-ghost" onclick={onClose}>Cancel</button>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
{:else if activeTab !== "diagnostics"}
|
|
||||||
<div class="panel-foot">
|
|
||||||
<button class="btn-primary" onclick={save} disabled={saving}>
|
|
||||||
{saving ? "Saving" : "Save changes"}
|
|
||||||
</button>
|
|
||||||
{#if dirty}<span class="unsaved-dot" title="unsaved changes"></span>{/if}
|
|
||||||
<button class="btn-ghost" onclick={onClose}>Cancel</button>
|
|
||||||
</div>
|
|
||||||
{:else}
|
{:else}
|
||||||
<div class="panel-foot">
|
<div class="setting-row"><strong>ByteSize</strong><code class="mono selectable">{diagnostics?.app_version ?? "Loading..."}</code></div>
|
||||||
<button class="btn-ghost" onclick={onClose}>Close</button>
|
<div class="setting-row"><strong>Encoder</strong><code class="mono selectable">{diagnostics?.ffmpeg_version ?? "Loading..."}</code></div>
|
||||||
|
<div class="setting-row"><div><strong>Log folder</strong><p class="note log-path selectable">{diagnostics?.log_dir ?? ""}</p></div>
|
||||||
|
<button type="button" class="button" onclick={openLogFolder} disabled={!diagnostics}><IconFolder size={17} />Show logs</button>
|
||||||
</div>
|
</div>
|
||||||
|
<div class="row between"><h3>Recent activity</h3><button type="button" class="button ghost" onclick={refreshDiagnostics}>Refresh</button></div>
|
||||||
|
<div class="log-scroll"><pre class="mono" use:scrollbar={"y"}>{diagnostics?.log_tail || "No recent log entries."}</pre></div>
|
||||||
{/if}
|
{/if}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
{#if hotkeyWarnings.length}
|
||||||
|
<div class="notice problem warnings" role="alert" use:appear>{#each hotkeyWarnings as warning}<p>{warning}</p>{/each}</div>
|
||||||
{/if}
|
{/if}
|
||||||
</div>
|
<div class="actions wrap setting-footer">
|
||||||
|
{#if activeTab !== "diagnostics"}<button class="button primary" type="button" onclick={save} disabled={saving || !dirty}>{saving ? "Saving..." : "Save changes"}</button>{/if}
|
||||||
|
<button class="button ghost" type="button" onclick={cancel} disabled={saving}>{dirty ? "Cancel" : "Close"}</button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
{/key}
|
||||||
|
</section>
|
||||||
|
{/if}
|
||||||
|
</WorkspaceScroll>
|
||||||
|
|
||||||
<style>
|
<style>
|
||||||
.settings {
|
.settings-workspace { display:grid; grid-template-columns:minmax(155px,215px) minmax(0,1fr); flex:1; }
|
||||||
min-height: 100vh;
|
.settings-nav { display:grid; align-content:start; gap:4px; padding:20px; background:var(--caption); }
|
||||||
background: var(--bg);
|
.settings-nav h3 { margin:4px 12px 12px; }
|
||||||
display: flex;
|
.settings-nav button { justify-content:flex-start; }
|
||||||
flex-direction: column;
|
.settings-nav button[aria-current="true"] { color:var(--ink); background:var(--raised); }
|
||||||
}
|
.settings-nav button[aria-current="true"] :global(svg) { color:var(--signal); }
|
||||||
|
:global(:root[data-theme="light"]) .settings-nav button[aria-current="true"] :global(svg) { color:#587324; }
|
||||||
.settings-header {
|
.settings-pane { min-width:0; max-width:840px; padding:clamp(20px,4vw,44px); }
|
||||||
display: flex;
|
header { margin-bottom:20px; }
|
||||||
align-items: center;
|
header .note { margin-top:8px; }
|
||||||
justify-content: space-between;
|
.settings-fields { border-radius:var(--radius); background:var(--caption); padding:0 16px; }
|
||||||
padding: 0 20px;
|
.setting-row { display:flex; justify-content:space-between; align-items:center; gap:12px; padding:12px 0; border-bottom:var(--edge) solid var(--rule); }
|
||||||
height: 44px;
|
.setting-row:last-child { border-bottom:0; }
|
||||||
border-bottom: 1px solid var(--border);
|
.setting-row > .folder { width:52%; }
|
||||||
background: var(--bg-2);
|
.setting-row :global(.combo) { width:min(47%,205px); min-width:104px; flex:0 0 auto; }
|
||||||
flex-shrink: 0;
|
.setting-row .button { white-space:nowrap; flex:0 0 auto; }
|
||||||
}
|
.setting-row p { margin-top:4px; }
|
||||||
|
.setting-footer { margin-top:20px; }
|
||||||
.header-left {
|
.warnings { margin-top:12px; }
|
||||||
display: flex;
|
.advanced summary { padding-block:12px; }
|
||||||
align-items: center;
|
.log-path { overflow-wrap:anywhere; }
|
||||||
gap: 12px;
|
.log-scroll { position:relative; padding-bottom:12px; }
|
||||||
}
|
pre { margin:0; max-height:230px; overflow:auto; overflow-wrap:anywhere; white-space:pre-wrap; padding:12px 16px 12px 12px; border-radius:var(--control-radius); background:var(--input); color:var(--copy); }
|
||||||
|
@media(max-width:680px) {
|
||||||
.back-btn {
|
.settings-workspace { grid-template-columns:1fr; }
|
||||||
display: grid; place-items: center;
|
.settings-nav { display:flex; flex-wrap:wrap; padding:8px 12px; }
|
||||||
width: 28px; height: 28px;
|
.settings-nav h3 { width:100%; }
|
||||||
background: transparent;
|
.settings-pane { padding:16px; }
|
||||||
border: 1px solid var(--border);
|
|
||||||
color: var(--text-3);
|
|
||||||
border-radius: var(--r-sm);
|
|
||||||
cursor: pointer;
|
|
||||||
transition: color 80ms, border-color 80ms;
|
|
||||||
}
|
|
||||||
.back-btn:hover { color: var(--text); border-color: var(--border-2); }
|
|
||||||
|
|
||||||
.settings-header h1 {
|
|
||||||
margin: 0;
|
|
||||||
font-size: 14px;
|
|
||||||
font-weight: 600;
|
|
||||||
color: var(--text);
|
|
||||||
letter-spacing: -0.01em;
|
|
||||||
}
|
|
||||||
|
|
||||||
.settings-body {
|
|
||||||
flex: 1;
|
|
||||||
display: grid;
|
|
||||||
grid-template-columns: 160px 1fr;
|
|
||||||
max-width: 640px;
|
|
||||||
width: 100%;
|
|
||||||
margin: 0 auto;
|
|
||||||
min-height: 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
@media (max-width: 560px) {
|
|
||||||
.settings-body { grid-template-columns: 1fr; }
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Tab nav */
|
|
||||||
.tab-nav {
|
|
||||||
display: flex;
|
|
||||||
flex-direction: column;
|
|
||||||
padding: 16px 8px;
|
|
||||||
gap: 2px;
|
|
||||||
border-right: 1px solid var(--border);
|
|
||||||
}
|
|
||||||
|
|
||||||
@media (max-width: 560px) {
|
|
||||||
.tab-nav {
|
|
||||||
flex-direction: row;
|
|
||||||
padding: 12px 16px;
|
|
||||||
border-right: none;
|
|
||||||
border-bottom: 1px solid var(--border);
|
|
||||||
overflow-x: auto;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
.tab {
|
|
||||||
text-align: left;
|
|
||||||
padding: 7px 12px;
|
|
||||||
background: transparent;
|
|
||||||
border: 1px solid transparent;
|
|
||||||
color: var(--text-3);
|
|
||||||
border-radius: var(--r-sm);
|
|
||||||
font-family: var(--sans);
|
|
||||||
font-size: 12px;
|
|
||||||
font-weight: 500;
|
|
||||||
cursor: pointer;
|
|
||||||
transition: all 80ms;
|
|
||||||
white-space: nowrap;
|
|
||||||
}
|
|
||||||
.tab:hover { color: var(--text-2); background: var(--bg-2); }
|
|
||||||
.tab.active { background: var(--accent-dim); color: var(--accent); border-color: rgba(20, 184, 166, 0.15); }
|
|
||||||
|
|
||||||
/* Tab content */
|
|
||||||
.tab-content {
|
|
||||||
padding: 24px 28px;
|
|
||||||
display: flex;
|
|
||||||
flex-direction: column;
|
|
||||||
gap: 24px;
|
|
||||||
overflow: auto;
|
|
||||||
}
|
|
||||||
|
|
||||||
.tab-panel { display: flex; flex-direction: column; gap: 20px; }
|
|
||||||
|
|
||||||
.panel-head { display: flex; flex-direction: column; gap: 2px; }
|
|
||||||
.panel-head h2 {
|
|
||||||
margin: 0;
|
|
||||||
font-size: 16px;
|
|
||||||
font-weight: 600;
|
|
||||||
color: var(--text);
|
|
||||||
letter-spacing: -0.01em;
|
|
||||||
}
|
|
||||||
.panel-desc {
|
|
||||||
margin: 0;
|
|
||||||
font-size: 12px;
|
|
||||||
color: var(--text-3);
|
|
||||||
}
|
|
||||||
|
|
||||||
.field-list { display: flex; flex-direction: column; gap: 14px; }
|
|
||||||
|
|
||||||
.field {
|
|
||||||
display: flex;
|
|
||||||
flex-direction: column;
|
|
||||||
gap: 6px;
|
|
||||||
}
|
|
||||||
.field-label {
|
|
||||||
font-size: 11px;
|
|
||||||
text-transform: uppercase;
|
|
||||||
letter-spacing: 0.06em;
|
|
||||||
color: var(--text-3);
|
|
||||||
}
|
|
||||||
|
|
||||||
.field-check {
|
|
||||||
display: flex;
|
|
||||||
align-items: center;
|
|
||||||
gap: 10px;
|
|
||||||
font-size: 13px;
|
|
||||||
color: var(--text-2);
|
|
||||||
cursor: pointer;
|
|
||||||
}
|
|
||||||
.field-check input[type="checkbox"] {
|
|
||||||
width: 14px; height: 14px;
|
|
||||||
accent-color: var(--accent);
|
|
||||||
cursor: pointer;
|
|
||||||
}
|
|
||||||
|
|
||||||
select, .path-input {
|
|
||||||
padding: 8px 10px;
|
|
||||||
background: var(--bg-2);
|
|
||||||
border: 1px solid var(--border);
|
|
||||||
color: var(--text);
|
|
||||||
border-radius: var(--r-sm);
|
|
||||||
font-size: 13px;
|
|
||||||
outline: none;
|
|
||||||
width: 100%;
|
|
||||||
}
|
|
||||||
select:focus, .path-input:focus { border-color: var(--accent); }
|
|
||||||
select { cursor: pointer; font-family: var(--sans); }
|
|
||||||
|
|
||||||
.advanced-toggle {
|
|
||||||
display: flex;
|
|
||||||
align-items: center;
|
|
||||||
gap: 6px;
|
|
||||||
background: transparent;
|
|
||||||
border: none;
|
|
||||||
color: var(--text-3);
|
|
||||||
font-size: 12px;
|
|
||||||
font-family: var(--sans);
|
|
||||||
cursor: pointer;
|
|
||||||
padding: 4px 0;
|
|
||||||
transition: color 80ms;
|
|
||||||
width: fit-content;
|
|
||||||
}
|
|
||||||
.advanced-toggle:hover { color: var(--text-2); }
|
|
||||||
.advanced-toggle svg { transition: transform 150ms; }
|
|
||||||
.advanced-toggle svg.rotated { transform: rotate(180deg); }
|
|
||||||
|
|
||||||
.field-note {
|
|
||||||
margin: 0;
|
|
||||||
font-size: 11px;
|
|
||||||
color: var(--warn);
|
|
||||||
}
|
|
||||||
|
|
||||||
.path-row { display: flex; gap: 6px; }
|
|
||||||
.path-input { flex: 1; font-family: var(--mono); font-size: 12px; }
|
|
||||||
|
|
||||||
.panel-foot {
|
|
||||||
display: flex;
|
|
||||||
gap: 10px;
|
|
||||||
padding-top: 8px;
|
|
||||||
border-top: 1px solid var(--border);
|
|
||||||
}
|
|
||||||
|
|
||||||
.btn-primary {
|
|
||||||
padding: 9px 22px;
|
|
||||||
background: var(--accent);
|
|
||||||
border: none;
|
|
||||||
color: var(--accent-text);
|
|
||||||
border-radius: var(--r-sm);
|
|
||||||
font-family: var(--sans);
|
|
||||||
font-size: 13px;
|
|
||||||
font-weight: 600;
|
|
||||||
cursor: pointer;
|
|
||||||
transition: background 80ms;
|
|
||||||
}
|
|
||||||
.btn-primary:hover:not(:disabled) { background: var(--accent-hover); }
|
|
||||||
.btn-primary:disabled { opacity: 0.4; cursor: not-allowed; }
|
|
||||||
|
|
||||||
.btn-ghost {
|
|
||||||
padding: 9px 18px;
|
|
||||||
background: transparent;
|
|
||||||
border: 1px solid var(--border-2);
|
|
||||||
color: var(--text-3);
|
|
||||||
border-radius: var(--r-sm);
|
|
||||||
font-family: var(--sans);
|
|
||||||
font-size: 13px;
|
|
||||||
cursor: pointer;
|
|
||||||
transition: border-color 80ms, color 80ms;
|
|
||||||
}
|
|
||||||
.btn-ghost:hover { border-color: var(--border-3); color: var(--text); }
|
|
||||||
|
|
||||||
.warn-block {
|
|
||||||
padding: 14px 16px;
|
|
||||||
background: var(--err-dim);
|
|
||||||
border: 1px solid var(--err-border);
|
|
||||||
border-radius: var(--r-sm);
|
|
||||||
display: flex;
|
|
||||||
flex-direction: column;
|
|
||||||
gap: 12px;
|
|
||||||
}
|
|
||||||
.warn-block p { margin: 0; font-size: 12px; color: var(--err); }
|
|
||||||
.warn-actions { display: flex; gap: 8px; }
|
|
||||||
.btn-warn {
|
|
||||||
padding: 8px 16px;
|
|
||||||
background: var(--err);
|
|
||||||
border: none;
|
|
||||||
color: #fff;
|
|
||||||
border-radius: var(--r-sm);
|
|
||||||
font-family: var(--sans);
|
|
||||||
font-size: 12px;
|
|
||||||
font-weight: 500;
|
|
||||||
cursor: pointer;
|
|
||||||
transition: background 80ms;
|
|
||||||
}
|
|
||||||
.btn-warn:hover:not(:disabled) { background: var(--stop-hover); }
|
|
||||||
.btn-warn:disabled { opacity: 0.4; cursor: not-allowed; }
|
|
||||||
|
|
||||||
.unsaved-dot {
|
|
||||||
width: 6px; height: 6px;
|
|
||||||
border-radius: 50%;
|
|
||||||
background: var(--warn);
|
|
||||||
display: inline-block;
|
|
||||||
margin-left: 8px;
|
|
||||||
vertical-align: middle;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* ---- Diagnostics ---- */
|
|
||||||
.diag-row {
|
|
||||||
display: flex;
|
|
||||||
align-items: center;
|
|
||||||
gap: 10px;
|
|
||||||
}
|
|
||||||
.diag-row .field-label { flex-shrink: 0; width: 90px; }
|
|
||||||
.diag-val { font-size: 12px; color: var(--text-2); flex: 1; min-width: 0; word-break: break-all; }
|
|
||||||
.btn-ghost.compact { padding: 5px 12px; font-size: 12px; }
|
|
||||||
.diag-tail-wrap { display: flex; flex-direction: column; gap: 6px; margin-top: 4px; }
|
|
||||||
.diag-tail-head { display: flex; align-items: center; justify-content: space-between; }
|
|
||||||
.diag-tail {
|
|
||||||
margin: 0;
|
|
||||||
padding: 10px;
|
|
||||||
background: var(--bg-3);
|
|
||||||
border: 1px solid var(--border);
|
|
||||||
border-radius: var(--r-sm);
|
|
||||||
font-family: var(--mono);
|
|
||||||
font-size: 10px;
|
|
||||||
line-height: 1.5;
|
|
||||||
color: var(--text-3);
|
|
||||||
max-height: 220px;
|
|
||||||
overflow: auto;
|
|
||||||
white-space: pre-wrap;
|
|
||||||
word-break: break-all;
|
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
|
|||||||
+83
-126
@@ -1,150 +1,107 @@
|
|||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
import { onMount } from "svelte"
|
import { onMount, untrack } from "svelte"
|
||||||
import { api, formatBytes, type UpdateInfo, type UpdateDownloadProgress } from "./api"
|
import { api, formatBytes, type UpdateDownloadProgress, type UpdateInfo } from "./api"
|
||||||
|
import SetupScreen from "./ui/SetupScreen.svelte"
|
||||||
|
import Progress from "./ui/Progress.svelte"
|
||||||
|
import Dialog from "./ui/Dialog.svelte"
|
||||||
|
import { appear } from "./ui/motion"
|
||||||
|
|
||||||
type Phase = "info" | "downloading" | "ready" | "error"
|
type Phase = "idle" | "checking" | "available" | "current" | "downloading" | "ready" | "error"
|
||||||
|
let { expanded = $bindable(false), checkRequest }: { expanded?: boolean; checkRequest: number } = $props()
|
||||||
|
let phase: Phase = $state("idle")
|
||||||
let info: UpdateInfo | null = $state(null)
|
let info: UpdateInfo | null = $state(null)
|
||||||
let phase: Phase = $state("info")
|
|
||||||
let progress: UpdateDownloadProgress | null = $state(null)
|
let progress: UpdateDownloadProgress | null = $state(null)
|
||||||
let errMsg: string | null = $state(null)
|
let error = $state("")
|
||||||
|
let confirmRestart = $state(false)
|
||||||
|
let notified = $state(false)
|
||||||
|
|
||||||
onMount(() => {
|
onMount(() => {
|
||||||
const unlisten: (() => void)[] = []
|
let active = true
|
||||||
const keep = (p: Promise<() => void>) => {
|
const listeners: (() => void)[] = []
|
||||||
void p.then(fn => unlisten.push(fn))
|
const keep = (registration: Promise<() => void>) => {
|
||||||
.catch(e => console.warn("could not register an update listener:", e))
|
void registration.then(fn => { if (active) listeners.push(fn); else fn() }).catch(console.warn)
|
||||||
}
|
}
|
||||||
|
keep(api.onUpdateAvailable(update => {
|
||||||
keep(api.onUpdateAvailable((i) => { info = i; phase = "info" }))
|
if (phase === "ready" || phase === "downloading") return
|
||||||
keep(api.onUpdateDownloadProgress((p) => { progress = p }))
|
info = update; phase = "available"; notified = true
|
||||||
void api.pendingUpdate()
|
}))
|
||||||
.then(pending => { if (pending) phase = "ready" })
|
keep(api.onUpdateDownloadProgress(value => progress = value))
|
||||||
.catch(e => console.warn("could not read the pending update state:", e))
|
void api.pendingUpdate().then(ready => {
|
||||||
|
if (active && ready) { phase = "ready"; notified = true }
|
||||||
return () => { unlisten.forEach(fn => fn()) }
|
}).catch(console.warn)
|
||||||
|
return () => { active = false; listeners.forEach(fn => fn()) }
|
||||||
})
|
})
|
||||||
|
|
||||||
function dismiss() { info = null; errMsg = null; phase = "info" }
|
$effect(() => { if (checkRequest > 0) untrack(() => { void check() }) })
|
||||||
function viewRelease() {
|
|
||||||
if (!info) return
|
|
||||||
void api.openUrl(info.release_url).catch(e => { errMsg = String(e); phase = "error" })
|
|
||||||
}
|
|
||||||
|
|
||||||
|
async function check() {
|
||||||
|
if (phase === "downloading" || phase === "ready" || phase === "checking") return
|
||||||
|
error = ""; phase = "checking"; info = null
|
||||||
|
try {
|
||||||
|
info = await api.checkForUpdates()
|
||||||
|
phase = info ? "available" : "current"
|
||||||
|
notified = !!info
|
||||||
|
} catch (e) { error = String(e); phase = "error" }
|
||||||
|
}
|
||||||
async function download() {
|
async function download() {
|
||||||
if (!info?.download_url) { errMsg = "no downloadable exe in this release"; phase = "error"; return }
|
if (!info?.download_url || phase === "downloading") return
|
||||||
phase = "downloading"; progress = null; errMsg = null
|
progress = null; error = ""; phase = "downloading"
|
||||||
try { await api.downloadUpdate(info.download_url); phase = "ready" }
|
try {
|
||||||
catch (e) { errMsg = String(e); phase = "error" }
|
await api.downloadUpdate(info.download_url)
|
||||||
|
phase = "ready"; notified = true
|
||||||
|
} catch (e) { phase = "error"; error = String(e) }
|
||||||
|
}
|
||||||
|
async function restart() {
|
||||||
|
try { await api.applyUpdate() } catch (e) { error = String(e) }
|
||||||
}
|
}
|
||||||
|
|
||||||
async function apply() { try { await api.applyUpdate() } catch (e) { errMsg = String(e); phase = "error" } }
|
let heading = $derived.by(() => phase === "ready" ? "Restart to finish updating" : phase === "checking" ? "Checking for updates"
|
||||||
|
: phase === "downloading" ? "Downloading ByteSize " + (info?.version ?? "") : phase === "current" ? "ByteSize is up to date"
|
||||||
|
: phase === "error" ? (info ? "Could not download update" : "Could not check for updates")
|
||||||
|
: info ? "ByteSize " + info.version + " is available" : "App updates")
|
||||||
|
let subtitle = $derived.by(() => phase === "available" ? "Installed version " + info?.current_version
|
||||||
|
: phase === "ready" ? "Finish any recording or export, then restart ByteSize to install the update."
|
||||||
|
: phase === "downloading" ? "You can return to ByteSize while it downloads."
|
||||||
|
: phase === "error" ? "Check your connection and try again." : undefined)
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
{#if info || phase === "ready"}
|
{#if expanded}
|
||||||
<div class="banner" role="status" aria-live="polite">
|
<SetupScreen title={heading} {subtitle}>
|
||||||
<div class="banner-main">
|
{#if phase === "downloading"}
|
||||||
{#if phase === "ready"}
|
<div class="stack">
|
||||||
<span class="dot" style="background:var(--recording)"></span>
|
<Progress compact value={progress?.total ? progress.downloaded / progress.total * 100 : undefined} label="Downloading update" />
|
||||||
<span class="banner-text">
|
<p class="mono note">{progress ? formatBytes(progress.downloaded) + (progress.total ? " of " + formatBytes(progress.total) : " downloaded") : "Connecting..."}</p>
|
||||||
<span class="banner-label">Update ready</span>
|
</div>
|
||||||
{#if info}<span class="ver">v{info.version}</span>{/if}
|
|
||||||
</span>
|
|
||||||
<button class="btn" onclick={apply}>Apply</button>
|
|
||||||
<button class="btn ghost" onclick={dismiss}>Dismiss</button>
|
|
||||||
|
|
||||||
{:else if phase === "downloading"}
|
|
||||||
<span class="dot pulse"></span>
|
|
||||||
<span class="banner-text">
|
|
||||||
<span class="banner-label">Downloading</span>
|
|
||||||
{#if info}<span class="ver">v{info.version}</span>{/if}
|
|
||||||
{#if progress}
|
|
||||||
<span class="banner-hint">
|
|
||||||
{formatBytes(progress.downloaded)}{progress.total ? ` / ${formatBytes(progress.total)}` : ""}
|
|
||||||
</span>
|
|
||||||
{/if}
|
{/if}
|
||||||
</span>
|
{#if error}<p class="notice problem details selectable" role="alert">{error}</p>{/if}
|
||||||
|
{#snippet actions()}
|
||||||
|
<button type="button" class="button ghost" onclick={() => expanded = false}>Back to ByteSize</button>
|
||||||
|
{#if phase === "available" && info}
|
||||||
|
{@const url = info.release_url}
|
||||||
|
<button type="button" class="button" onclick={() => api.openUrl(url).catch(e => error = String(e))}>Release notes</button>
|
||||||
|
{#if info.download_url}<button type="button" class="button primary" onclick={download}>Download update</button>{/if}
|
||||||
|
{:else if phase === "ready"}
|
||||||
|
<button type="button" class="button primary" onclick={() => confirmRestart = true}>Restart and install</button>
|
||||||
{:else if phase === "error"}
|
{:else if phase === "error"}
|
||||||
<span class="dot" style="background:var(--err)"></span>
|
<button type="button" class="button primary" onclick={info?.download_url ? download : check}>Try again</button>
|
||||||
<span class="banner-text">
|
|
||||||
<span class="banner-label">Update error</span>
|
|
||||||
{#if errMsg}<span class="banner-hint">{errMsg}</span>{/if}
|
|
||||||
</span>
|
|
||||||
<button class="btn ghost" onclick={dismiss}>Dismiss</button>
|
|
||||||
|
|
||||||
{:else if info}
|
|
||||||
<span class="dot pulse"></span>
|
|
||||||
<span class="banner-text">
|
|
||||||
<span class="banner-label">Update available</span>
|
|
||||||
<span class="ver">v{info.version}</span>
|
|
||||||
<span class="from">v{info.current_version}</span>
|
|
||||||
</span>
|
|
||||||
{#if info.download_url}
|
|
||||||
<button class="btn" onclick={download}>Download</button>
|
|
||||||
{/if}
|
|
||||||
<button class="btn ghost" onclick={viewRelease}>Notes</button>
|
|
||||||
<button class="btn ghost" onclick={dismiss}>Dismiss</button>
|
|
||||||
{/if}
|
{/if}
|
||||||
|
{/snippet}
|
||||||
|
</SetupScreen>
|
||||||
|
{:else if notified}
|
||||||
|
<div class="update-notice row between wrap" use:appear>
|
||||||
|
<span class="row"><i class="dot"></i>{phase === "ready" ? "Update ready to install" : "ByteSize " + (info?.version ?? "") + " is available"}</span>
|
||||||
|
<div class="actions">
|
||||||
|
<button type="button" class="button ghost" onclick={() => notified = false}>Dismiss</button>
|
||||||
|
<button type="button" class="button" onclick={() => expanded = true}>Review update</button>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
{/if}
|
{/if}
|
||||||
|
{#if confirmRestart}
|
||||||
|
<Dialog title="Restart to update?" description="ByteSize will close and reopen after installation." confirm="Restart ByteSize"
|
||||||
|
onresult={accepted => { confirmRestart = false; if (accepted) void restart() }} />
|
||||||
|
{/if}
|
||||||
|
|
||||||
<style>
|
<style>
|
||||||
.banner {
|
.update-notice { flex:none; background:var(--caption); border-top:var(--edge) solid var(--rule); padding:8px 16px; }
|
||||||
background: var(--bg-2);
|
.details { overflow-wrap:anywhere; }
|
||||||
border-bottom: 1px solid var(--border);
|
|
||||||
}
|
|
||||||
|
|
||||||
.banner-main {
|
|
||||||
display: flex;
|
|
||||||
align-items: center;
|
|
||||||
gap: 12px;
|
|
||||||
padding: 8px 20px;
|
|
||||||
flex-wrap: wrap;
|
|
||||||
}
|
|
||||||
|
|
||||||
.dot {
|
|
||||||
width: 6px; height: 6px;
|
|
||||||
border-radius: 50%;
|
|
||||||
background: var(--accent);
|
|
||||||
flex-shrink: 0;
|
|
||||||
}
|
|
||||||
.pulse { animation: blink 2s ease-in-out infinite; }
|
|
||||||
@keyframes blink { 0%,100%{opacity:1} 50%{opacity:0.3} }
|
|
||||||
|
|
||||||
.banner-text {
|
|
||||||
display: flex;
|
|
||||||
align-items: center;
|
|
||||||
gap: 8px;
|
|
||||||
font-size: 12px;
|
|
||||||
color: var(--text-2);
|
|
||||||
flex: 1;
|
|
||||||
min-width: 160px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.banner-label { font-weight: 500; color: var(--text); }
|
|
||||||
.ver { font-family: var(--mono); font-size: 11px; color: var(--accent); }
|
|
||||||
.from { font-size: 11px; color: var(--text-3); }
|
|
||||||
.banner-hint { font-size: 11px; color: var(--text-3); }
|
|
||||||
|
|
||||||
.btn {
|
|
||||||
padding: 4px 12px;
|
|
||||||
border-radius: var(--r-sm);
|
|
||||||
font-family: var(--sans);
|
|
||||||
font-size: 11px;
|
|
||||||
font-weight: 500;
|
|
||||||
cursor: pointer;
|
|
||||||
transition: all 80ms;
|
|
||||||
white-space: nowrap;
|
|
||||||
border: 1px solid transparent;
|
|
||||||
background: var(--accent);
|
|
||||||
color: var(--accent-text);
|
|
||||||
}
|
|
||||||
.btn:hover { background: var(--accent-hover); }
|
|
||||||
.btn.ghost {
|
|
||||||
background: transparent;
|
|
||||||
border-color: var(--border-2);
|
|
||||||
color: var(--text-2);
|
|
||||||
}
|
|
||||||
.btn.ghost:hover { border-color: var(--border-3); color: var(--text); }
|
|
||||||
</style>
|
</style>
|
||||||
|
|||||||
@@ -199,6 +199,7 @@ export const api = {
|
|||||||
export: (request: ExportRequest) => invoke<ExportResult>("export", { request }),
|
export: (request: ExportRequest) => invoke<ExportResult>("export", { request }),
|
||||||
revealInExplorer: (path: string) => invoke<void>("reveal_in_explorer", { path }),
|
revealInExplorer: (path: string) => invoke<void>("reveal_in_explorer", { path }),
|
||||||
showOverlay: () => invoke<void>("show_overlay"),
|
showOverlay: () => invoke<void>("show_overlay"),
|
||||||
|
openWindowPicker: () => invoke<void>("open_window_picker"),
|
||||||
hideOverlay: () => invoke<void>("hide_overlay"),
|
hideOverlay: () => invoke<void>("hide_overlay"),
|
||||||
setOverlaySize: (width: number, height: number) =>
|
setOverlaySize: (width: number, height: number) =>
|
||||||
invoke<void>("set_overlay_size", { width, height }),
|
invoke<void>("set_overlay_size", { width, height }),
|
||||||
@@ -210,6 +211,7 @@ export const api = {
|
|||||||
getOverlayRect: () => invoke<CaptureRect>("get_overlay_rect"),
|
getOverlayRect: () => invoke<CaptureRect>("get_overlay_rect"),
|
||||||
extractThumbnails: (fps: number) =>
|
extractThumbnails: (fps: number) =>
|
||||||
invoke<string[]>("extract_thumbnails", { fps }),
|
invoke<string[]>("extract_thumbnails", { fps }),
|
||||||
|
previewDisplay: (x: number, y: number) => invoke<ArrayBuffer>("preview_display", { x, y }),
|
||||||
renderPreview: (format: Format, fps: number, target_bytes: number, gif_budget_mode?: GifBudgetMode, gif_dither?: GifDither, gif_colors?: number) =>
|
renderPreview: (format: Format, fps: number, target_bytes: number, gif_budget_mode?: GifBudgetMode, gif_dither?: GifDither, gif_colors?: number) =>
|
||||||
invoke<string>("render_preview", { request: { format, fps, target_bytes, gif_budget_mode, gif_dither, gif_colors } }),
|
invoke<string>("render_preview", { request: { format, fps, target_bytes, gif_budget_mode, gif_dither, gif_colors } }),
|
||||||
estimateGifParams: (input: {
|
estimateGifParams: (input: {
|
||||||
@@ -240,6 +242,7 @@ export const api = {
|
|||||||
defaultOutputPath: (format: Format) =>
|
defaultOutputPath: (format: Format) =>
|
||||||
invoke<string>("default_output_path", { format }),
|
invoke<string>("default_output_path", { format }),
|
||||||
openUrl: (url: string) => invoke<void>("open_url", { url }),
|
openUrl: (url: string) => invoke<void>("open_url", { url }),
|
||||||
|
checkForUpdates: () => invoke<UpdateInfo | null>("check_for_updates"),
|
||||||
onUpdateAvailable: (handler: (info: UpdateInfo) => void): Promise<UnlistenFn> =>
|
onUpdateAvailable: (handler: (info: UpdateInfo) => void): Promise<UnlistenFn> =>
|
||||||
listen<UpdateInfo>("update-available", (e) => handler(e.payload)),
|
listen<UpdateInfo>("update-available", (e) => handler(e.payload)),
|
||||||
onHotkey: (handler: (kind: "start" | "stop" | "pause") => void): Promise<UnlistenFn> =>
|
onHotkey: (handler: (kind: "start" | "stop" | "pause") => void): Promise<UnlistenFn> =>
|
||||||
|
|||||||
@@ -1,6 +1,10 @@
|
|||||||
import { mount } from "svelte"
|
import { mount } from "svelte"
|
||||||
import "./app.css"
|
import "./app.css"
|
||||||
|
import "./ui.css"
|
||||||
import App from "./App.svelte"
|
import App from "./App.svelte"
|
||||||
|
import { installMotion } from "./lib/ui/motion"
|
||||||
|
|
||||||
|
installMotion()
|
||||||
|
|
||||||
const app = mount(App, {
|
const app = mount(App, {
|
||||||
target: document.getElementById("app")!,
|
target: document.getElementById("app")!,
|
||||||
|
|||||||
Reference in New Issue
Block a user