Skip to content

Open-source download manager & offline media toolbox for YouTube, music, social media, learning platforms & 1,800+ sites. Built with Tauri 2.0, Rust & Svelte.

feat(remake): D4-D6 settings + varredura global de tipografia legada (14.5/12.5px) para tokens

tonhowtfef77ba1c49d6
diff --git a/src/components/debug/DebugPanel.svelte b/src/components/debug/DebugPanel.svelte
index 8a2416b5..210bc80b 100644
--- a/src/components/debug/DebugPanel.svelte
+++ b/src/components/debug/DebugPanel.svelte
@@ -1,333 +1,333 @@
-<script lang="ts">
- import { t } from "$lib/i18n";
- import { onMount } from "svelte";
- import {
- getDebugLogs,
- isDebugPanelOpen,
- setDebugPanelOpen,
- toggleDebugPanel,
- clearLogs,
- exportDiagnostics,
- type LogLevel,
- } from "$lib/stores/debug-store.svelte";
- import { showToast } from "$lib/stores/toast-store.svelte";
-
- type FilterMode = "all" | "download" | "network" | "auth" | "system" | "convert" | "errors";
-
- let filter = $state<FilterMode>("all");
- let listEl: HTMLDivElement | undefined = $state();
- let autoScroll = $state(true);
- let copying = $state(false);
-
- let logs = $derived(getDebugLogs());
- let open = $derived(isDebugPanelOpen());
-
- let filtered = $derived.by(() => {
- if (filter === "all") return logs;
- if (filter === "errors") return logs.filter((l) => l.level === "error");
- return logs.filter((l) => l.category === filter);
- });
-
- $effect(() => {
- if (filtered.length && autoScroll && listEl) {
- requestAnimationFrame(() => {
- if (listEl) {
- listEl.scrollTop = listEl.scrollHeight;
- }
- });
- }
- });
-
- function handleScroll() {
- if (!listEl) return;
- const atBottom = listEl.scrollHeight - listEl.scrollTop - listEl.clientHeight < 40;
- autoScroll = atBottom;
- }
-
- async function handleCopy() {
- copying = true;
- try {
- const report = await exportDiagnostics();
- await navigator.clipboard.writeText(report);
- showToast("success", $t("debug.report_copied"));
- } catch {
- showToast("error", "Failed to copy report");
- } finally {
- copying = false;
- }
- }
-
- function handleClose() {
- setDebugPanelOpen(false);
- }
-
- function handleKeydown(e: KeyboardEvent) {
- if (e.key === "Escape") {
- handleClose();
- }
- }
-
- function levelColor(level: LogLevel): string {
- switch (level) {
- case "info": return "var(--blue)";
- case "warn": return "var(--orange)";
- case "error": return "var(--error)";
- }
- }
-
- function formatTime(ts: number): string {
- return new Date(ts).toLocaleTimeString("en-US", { hour12: false });
- }
-
- onMount(() => {
- const handler = (e: KeyboardEvent) => {
- if ((e.ctrlKey || e.metaKey) && e.shiftKey && e.key === "D") {
- e.preventDefault();
- toggleDebugPanel();
- }
- };
- window.addEventListener("keydown", handler);
- return () => window.removeEventListener("keydown", handler);
- });
-</script>
-
-{#if open}
- <!-- svelte-ignore a11y_no_noninteractive_element_interactions -->
- <div class="debug-panel" role="log" aria-label={$t("debug.title")} onkeydown={handleKeydown}>
- <div class="debug-header">
- <span class="debug-title">{$t("debug.title")}</span>
-
- <select
- class="debug-filter"
- bind:value={filter}
- aria-label={$t("debug.filter_all")}
- >
- <option value="all">{$t("debug.filter_all")}</option>
- <option value="download">{$t("debug.filter_downloads")}</option>
- <option value="network">{$t("debug.filter_network")}</option>
- <option value="auth">{$t("debug.filter_auth")}</option>
- <option value="system">{$t("debug.filter_system")}</option>
- <option value="convert">{$t("debug.filter_convert")}</option>
- <option value="errors">{$t("debug.filter_errors")}</option>
- </select>
-
- <div class="debug-actions">
- <button class="debug-btn" onclick={handleCopy} disabled={copying} aria-label={$t("debug.copy_report")}>
- <svg viewBox="0 0 24 24" width="14" height="14" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">
- <rect x="9" y="9" width="13" height="13" rx="2" ry="2" />
- <path d="M5 15H4a2 2 0 01-2-2V4a2 2 0 012-2h9a2 2 0 012 2v1" />
- </svg>
- {$t("debug.copy_report")}
- </button>
- <button class="debug-btn" onclick={() => clearLogs()} aria-label={$t("debug.clear")}>
- {$t("debug.clear")}
- </button>
- <button class="debug-close" onclick={handleClose} aria-label={$t("common.close")}>
- <svg viewBox="0 0 24 24" width="16" height="16" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round">
- <path d="M18 6L6 18M6 6l12 12" />
- </svg>
- </button>
- </div>
- </div>
-
- <div class="debug-list" bind:this={listEl} onscroll={handleScroll}>
- {#if filtered.length === 0}
- <div class="debug-empty">{$t("debug.no_entries")}</div>
- {:else}
- {#each filtered as entry (entry.id)}
- <div class="debug-entry" class:debug-error={entry.level === "error"} class:debug-warn={entry.level === "warn"}>
- <span class="debug-time">{formatTime(entry.timestamp)}</span>
- <span class="debug-level" style:background={levelColor(entry.level)}>
- {entry.level.toUpperCase()}
- </span>
- <span class="debug-msg">{entry.message}</span>
- </div>
- {#if entry.details}
- <div class="debug-details">{entry.details}</div>
- {/if}
- {/each}
- {/if}
- </div>
- </div>
-{/if}
-
-<style>
- .debug-panel {
- position: fixed;
- bottom: 0;
- left: var(--sidebar-width);
- right: 0;
- height: 40vh;
- min-height: 180px;
- max-height: 60vh;
- background: var(--popup-bg);
- border-top: 1px solid var(--content-border);
- display: flex;
- flex-direction: column;
- z-index: 100;
- font-size: 13px;
- }
-
- .debug-header {
- display: flex;
- align-items: center;
- gap: 8px;
- padding: 8px 12px;
- border-bottom: 1px solid var(--content-border);
- flex-shrink: 0;
- }
-
- .debug-title {
- font-size: 12.5px;
- font-weight: 500;
- color: var(--secondary);
- margin-right: 4px;
- }
-
- .debug-filter {
- font-size: 12px;
- padding: 3px 8px;
- background: var(--button);
- color: var(--secondary);
- border: 1px solid var(--input-border);
- border-radius: calc(var(--border-radius) - 4px);
- cursor: pointer;
- }
-
- .debug-actions {
- display: flex;
- align-items: center;
- gap: 6px;
- margin-left: auto;
- }
-
- .debug-btn {
- display: flex;
- align-items: center;
- gap: 4px;
- font-size: 11.5px;
- font-weight: 500;
- padding: 4px 10px;
- background: var(--button);
- color: var(--secondary);
- border: 1px solid var(--input-border);
- border-radius: calc(var(--border-radius) - 4px);
- cursor: pointer;
- }
-
- @media (hover: hover) {
- .debug-btn:hover {
- background: var(--button-hover);
- }
- }
-
- .debug-btn:focus-visible {
- outline: var(--focus-ring);
- outline-offset: var(--focus-ring-offset);
- }
-
- .debug-close {
- display: flex;
- align-items: center;
- justify-content: center;
- padding: 4px;
- background: none;
- border: none;
- color: var(--gray);
- cursor: pointer;
- border-radius: 4px;
- }
-
- @media (hover: hover) {
- .debug-close:hover {
- color: var(--secondary);
- background: var(--button-hover);
- }
- }
-
- .debug-close:focus-visible {
- outline: var(--focus-ring);
- outline-offset: var(--focus-ring-offset);
- }
-
- .debug-list {
- flex: 1;
- overflow-y: auto;
- padding: 4px 0;
- }
-
- .debug-empty {
- padding: 24px;
- text-align: center;
- color: var(--gray);
- font-size: 12.5px;
- }
-
- .debug-entry {
- display: flex;
- align-items: center;
- gap: 8px;
- padding: 3px 12px;
- min-height: 26px;
- }
-
- .debug-entry:nth-child(even) {
- background: var(--button);
- }
-
- .debug-error {
- background: color-mix(in srgb, var(--error) 8%, transparent) !important;
- }
-
- .debug-warn {
- background: color-mix(in srgb, var(--orange) 6%, transparent) !important;
- }
-
- .debug-time {
- font-family: var(--font-mono);
- font-size: 11px;
- color: var(--gray);
- flex-shrink: 0;
- }
-
- .debug-level {
- font-size: 10px;
- font-weight: 600;
- color: #fff;
- padding: 1px 5px;
- border-radius: 3px;
- flex-shrink: 0;
- text-transform: uppercase;
- letter-spacing: 0.3px;
- }
-
- .debug-msg {
- color: var(--secondary);
- font-size: 12.5px;
- white-space: nowrap;
- overflow: hidden;
- text-overflow: ellipsis;
- }
-
- .debug-details {
- padding: 2px 12px 4px calc(12px + 8px + 55px + 8px + 42px);
- font-family: var(--font-mono);
- font-size: 11px;
- color: var(--gray);
- word-break: break-all;
- }
-
- @media (max-width: 535px) {
- .debug-panel {
- left: 0;
- bottom: calc(44px + env(safe-area-inset-bottom));
- height: 50vh;
- }
- }
-
- @media (prefers-reduced-motion: reduce) {
- .debug-panel {
- transition: none;
- }
- }
-</style>
+<script lang="ts">
+ import { t } from "$lib/i18n";
+ import { onMount } from "svelte";
+ import {
+ getDebugLogs,
+ isDebugPanelOpen,
+ setDebugPanelOpen,
+ toggleDebugPanel,
+ clearLogs,
+ exportDiagnostics,
+ type LogLevel,
+ } from "$lib/stores/debug-store.svelte";
+ import { showToast } from "$lib/stores/toast-store.svelte";
+
+ type FilterMode = "all" | "download" | "network" | "auth" | "system" | "convert" | "errors";
+
+ let filter = $state<FilterMode>("all");
+ let listEl: HTMLDivElement | undefined = $state();
+ let autoScroll = $state(true);
+ let copying = $state(false);
+
+ let logs = $derived(getDebugLogs());
+ let open = $derived(isDebugPanelOpen());
+
+ let filtered = $derived.by(() => {
+ if (filter === "all") return logs;
+ if (filter === "errors") return logs.filter((l) => l.level === "error");
+ return logs.filter((l) => l.category === filter);
+ });
+
+ $effect(() => {
+ if (filtered.length && autoScroll && listEl) {
+ requestAnimationFrame(() => {
+ if (listEl) {
+ listEl.scrollTop = listEl.scrollHeight;
+ }
+ });
+ }
+ });
+
+ function handleScroll() {
+ if (!listEl) return;
+ const atBottom = listEl.scrollHeight - listEl.scrollTop - listEl.clientHeight < 40;
+ autoScroll = atBottom;
+ }
+
+ async function handleCopy() {
+ copying = true;
+ try {
+ const report = await exportDiagnostics();
+ await navigator.clipboard.writeText(report);
+ showToast("success", $t("debug.report_copied"));
+ } catch {
+ showToast("error", "Failed to copy report");
+ } finally {
+ copying = false;
+ }
+ }
+
+ function handleClose() {
+ setDebugPanelOpen(false);
+ }
+
+ function handleKeydown(e: KeyboardEvent) {
+ if (e.key === "Escape") {
+ handleClose();
+ }
+ }
+
+ function levelColor(level: LogLevel): string {
+ switch (level) {
+ case "info": return "var(--blue)";
+ case "warn": return "var(--orange)";
+ case "error": return "var(--error)";
+ }
+ }
+
+ function formatTime(ts: number): string {
+ return new Date(ts).toLocaleTimeString("en-US", { hour12: false });
+ }
+
+ onMount(() => {
+ const handler = (e: KeyboardEvent) => {
+ if ((e.ctrlKey || e.metaKey) && e.shiftKey && e.key === "D") {
+ e.preventDefault();
+ toggleDebugPanel();
+ }
+ };
+ window.addEventListener("keydown", handler);
+ return () => window.removeEventListener("keydown", handler);
+ });
+</script>
+
+{#if open}
+ <!-- svelte-ignore a11y_no_noninteractive_element_interactions -->
+ <div class="debug-panel" role="log" aria-label={$t("debug.title")} onkeydown={handleKeydown}>
+ <div class="debug-header">
+ <span class="debug-title">{$t("debug.title")}</span>
+
+ <select
+ class="debug-filter"
+ bind:value={filter}
+ aria-label={$t("debug.filter_all")}
+ >
+ <option value="all">{$t("debug.filter_all")}</option>
+ <option value="download">{$t("debug.filter_downloads")}</option>
+ <option value="network">{$t("debug.filter_network")}</option>
+ <option value="auth">{$t("debug.filter_auth")}</option>
+ <option value="system">{$t("debug.filter_system")}</option>
+ <option value="convert">{$t("debug.filter_convert")}</option>
+ <option value="errors">{$t("debug.filter_errors")}</option>
+ </select>
+
+ <div class="debug-actions">
+ <button class="debug-btn" onclick={handleCopy} disabled={copying} aria-label={$t("debug.copy_report")}>
+ <svg viewBox="0 0 24 24" width="14" height="14" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">
+ <rect x="9" y="9" width="13" height="13" rx="2" ry="2" />
+ <path d="M5 15H4a2 2 0 01-2-2V4a2 2 0 012-2h9a2 2 0 012 2v1" />
+ </svg>
+ {$t("debug.copy_report")}
+ </button>
+ <button class="debug-btn" onclick={() => clearLogs()} aria-label={$t("debug.clear")}>
+ {$t("debug.clear")}
+ </button>
+ <button class="debug-close" onclick={handleClose} aria-label={$t("common.close")}>
+ <svg viewBox="0 0 24 24" width="16" height="16" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round">
+ <path d="M18 6L6 18M6 6l12 12" />
+ </svg>
+ </button>
+ </div>
+ </div>
+
+ <div class="debug-list" bind:this={listEl} onscroll={handleScroll}>
+ {#if filtered.length === 0}
+ <div class="debug-empty">{$t("debug.no_entries")}</div>
+ {:else}
+ {#each filtered as entry (entry.id)}
+ <div class="debug-entry" class:debug-error={entry.level === "error"} class:debug-warn={entry.level === "warn"}>
+ <span class="debug-time">{formatTime(entry.timestamp)}</span>
+ <span class="debug-level" style:background={levelColor(entry.level)}>
+ {entry.level.toUpperCase()}
+ </span>
+ <span class="debug-msg">{entry.message}</span>
+ </div>
+ {#if entry.details}
+ <div class="debug-details">{entry.details}</div>
+ {/if}
+ {/each}
+ {/if}
+ </div>
+ </div>
+{/if}
+
+<style>
+ .debug-panel {
+ position: fixed;
+ bottom: 0;
+ left: var(--sidebar-width);
+ right: 0;
+ height: 40vh;
+ min-height: 180px;
+ max-height: 60vh;
+ background: var(--popup-bg);
+ border-top: 1px solid var(--content-border);
+ display: flex;
+ flex-direction: column;
+ z-index: 100;
+ font-size: 13px;
+ }
+
+ .debug-header {
+ display: flex;
+ align-items: center;
+ gap: 8px;
+ padding: 8px 12px;
+ border-bottom: 1px solid var(--content-border);
+ flex-shrink: 0;
+ }
+
+ .debug-title {
+ font-size: var(--text-sm);
+ font-weight: 500;
+ color: var(--secondary);
+ margin-right: 4px;
+ }
+
+ .debug-filter {
+ font-size: 12px;
+ padding: 3px 8px;
+ background: var(--button);
+ color: var(--secondary);
+ border: 1px solid var(--input-border);
+ border-radius: calc(var(--border-radius) - 4px);
+ cursor: pointer;
+ }
+
+ .debug-actions {
+ display: flex;
+ align-items: center;
+ gap: 6px;
+ margin-left: auto;
+ }
+
+ .debug-btn {
+ display: flex;
+ align-items: center;
+ gap: 4px;
+ font-size: 11.5px;
+ font-weight: 500;
+ padding: 4px 10px;
+ background: var(--button);
+ color: var(--secondary);
+ border: 1px solid var(--input-border);
+ border-radius: calc(var(--border-radius) - 4px);
+ cursor: pointer;
+ }
+
+ @media (hover: hover) {
+ .debug-btn:hover {
+ background: var(--button-hover);
+ }
+ }
+
+ .debug-btn:focus-visible {
+ outline: var(--focus-ring);
+ outline-offset: var(--focus-ring-offset);
+ }
+
+ .debug-close {
+ display: flex;
+ align-items: center;
+ justify-content: center;
+ padding: 4px;
+ background: none;
+ border: none;
+ color: var(--gray);
+ cursor: pointer;
+ border-radius: 4px;
+ }
+
+ @media (hover: hover) {
+ .debug-close:hover {
+ color: var(--secondary);
+ background: var(--button-hover);
+ }
+ }
+
+ .debug-close:focus-visible {
+ outline: var(--focus-ring);
+ outline-offset: var(--focus-ring-offset);
+ }
+
+ .debug-list {
+ flex: 1;
+ overflow-y: auto;
+ padding: 4px 0;
+ }
+
+ .debug-empty {
+ padding: 24px;
+ text-align: center;
+ color: var(--gray);
+ font-size: var(--text-sm);
+ }
+
+ .debug-entry {
+ display: flex;
+ align-items: center;
+ gap: 8px;
+ padding: 3px 12px;
+ min-height: 26px;
+ }
+
+ .debug-entry:nth-child(even) {
+ background: var(--button);
+ }
+
+ .debug-error {
+ background: color-mix(in srgb, var(--error) 8%, transparent) !important;
+ }
+
+ .debug-warn {
+ background: color-mix(in srgb, var(--orange) 6%, transparent) !important;
+ }
+
+ .debug-time {
+ font-family: var(--font-mono);
+ font-size: 11px;
+ color: var(--gray);
+ flex-shrink: 0;
+ }
+
+ .debug-level {
+ font-size: 10px;
+ font-weight: 600;
+ color: #fff;
+ padding: 1px 5px;
+ border-radius: 3px;
+ flex-shrink: 0;
+ text-transform: uppercase;
+ letter-spacing: 0.3px;
+ }
+
+ .debug-msg {
+ color: var(--secondary);
+ font-size: var(--text-sm);
+ white-space: nowrap;
+ overflow: hidden;
+ text-overflow: ellipsis;
+ }
+
+ .debug-details {
+ padding: 2px 12px 4px calc(12px + 8px + 55px + 8px + 42px);
+ font-family: var(--font-mono);
+ font-size: 11px;
+ color: var(--gray);
+ word-break: break-all;
+ }
+
+ @media (max-width: 535px) {
+ .debug-panel {
+ left: 0;
+ bottom: calc(44px + env(safe-area-inset-bottom));
+ height: 50vh;
+ }
+ }
+
+ @media (prefers-reduced-motion: reduce) {
+ .debug-panel {
+ transition: none;
+ }
+ }
+</style>
diff --git a/src/components/dialog/ChangelogDialog.svelte b/src/components/dialog/ChangelogDialog.svelte
index 3451f918..b6152b31 100644
--- a/src/components/dialog/ChangelogDialog.svelte
+++ b/src/components/dialog/ChangelogDialog.svelte
@@ -347,7 +347,7 @@
}
.empty-text {
- font-size: 14.5px;
+ font-size: var(--text-base);
font-weight: 500;
color: var(--gray);
text-align: center;
diff --git a/src/components/dialog/ConfirmCloseDialog.svelte b/src/components/dialog/ConfirmCloseDialog.svelte
index ff0b6850..5ec25865 100644
--- a/src/components/dialog/ConfirmCloseDialog.svelte
+++ b/src/components/dialog/ConfirmCloseDialog.svelte
@@ -76,7 +76,7 @@
.button {
padding: 8px 16px;
- font-size: 12.5px;
+ font-size: var(--text-sm);
font-weight: 500;
border-radius: var(--border-radius);
border: none;
diff --git a/src/components/dialog/LegalDialog.svelte b/src/components/dialog/LegalDialog.svelte
index 1c4a8867..41c625ce 100644
--- a/src/components/dialog/LegalDialog.svelte
+++ b/src/components/dialog/LegalDialog.svelte
@@ -87,7 +87,7 @@
.legal-body li {
color: var(--tertiary);
- font-size: 12.5px;
+ font-size: var(--text-sm);
}
.legal-footer {
diff --git a/src/components/dialog/RecoveryDialog.svelte b/src/components/dialog/RecoveryDialog.svelte
index 9bd18b53..5d2f7652 100644
--- a/src/components/dialog/RecoveryDialog.svelte
+++ b/src/components/dialog/RecoveryDialog.svelte
@@ -172,7 +172,7 @@
.button {
padding: 8px 16px;
- font-size: 12.5px;
+ font-size: var(--text-sm);
font-weight: 500;
border-radius: var(--border-radius);
border: none;
diff --git a/src/components/dialog/ReencodeDialog.svelte b/src/components/dialog/ReencodeDialog.svelte
index 87cc2f2b..f0ff8de5 100644
--- a/src/components/dialog/ReencodeDialog.svelte
+++ b/src/components/dialog/ReencodeDialog.svelte
@@ -187,7 +187,7 @@
.reencode-target {
margin: 0;
- font-size: 12.5px;
+ font-size: var(--text-sm);
color: var(--tertiary);
font-family: var(--font-mono, ui-monospace, monospace);
background: var(--button);
diff --git a/src/components/downloads/ToolsPanel.svelte b/src/components/downloads/ToolsPanel.svelte
index 63b5216d..b3aaca09 100644
--- a/src/components/downloads/ToolsPanel.svelte
+++ b/src/components/downloads/ToolsPanel.svelte
@@ -747,7 +747,7 @@
}
.tool-desc {
margin: 0;
- font-size: 12.5px;
+ font-size: var(--text-sm);
color: var(--text-muted);
line-height: 1.45;
}
@@ -886,7 +886,7 @@
align-items: baseline;
padding: 5px 0;
border-bottom: 1px solid color-mix(in oklab, var(--border) 40%, transparent);
- font-size: 12.5px;
+ font-size: var(--text-sm);
}
.cc-author {
font-weight: 600;
diff --git a/src/components/hotmart/CourseCard.svelte b/src/components/hotmart/CourseCard.svelte
index 9afe2106..0bd31874 100644
--- a/src/components/hotmart/CourseCard.svelte
+++ b/src/components/hotmart/CourseCard.svelte
@@ -1,309 +1,309 @@
-<script lang="ts">
- import { t } from "$lib/i18n";
-
- type CardDownloadStatus = "idle" | "downloading" | "complete" | "error";
-
- type CourseCardProps = {
- name: string;
- price: string;
- imageUrl?: string;
- externalPlatform?: boolean;
- downloadStatus?: CardDownloadStatus;
- downloadPercent?: number;
- onDownload: () => void;
- };
-
- let {
- name,
- price,
- imageUrl,
- externalPlatform = false,
- downloadStatus = "idle",
- downloadPercent = 0,
- onDownload,
- }: CourseCardProps = $props();
-
- let isDisabled = $derived(downloadStatus === "complete");
-
- function handleClick() {
- if (isDisabled) return;
- onDownload();
- }
-</script>
-
-<div class="course-card">
- <div class="card-image">
- {#if imageUrl}
- <img src={imageUrl} alt={name} loading="lazy" />
- {:else}
- <div class="card-placeholder">
- <svg
- width="48"
- height="48"
- viewBox="0 0 24 24"
- fill="none"
- stroke="currentColor"
- stroke-width="1.5"
- stroke-linecap="round"
- stroke-linejoin="round"
- >
- <path d="M22 9l-10 -4l-10 4l10 4l10 -4v6" />
- <path d="M6 10.6v5.4a6 3 0 0 0 12 0v-5.4" />
- </svg>
- </div>
- {/if}
- </div>
-
- <div class="card-body">
- <h4 class="card-title" title={name}>{name}</h4>
- <div class="card-meta">
- <span class="card-price">{price}</span>
- {#if externalPlatform}
- <span class="card-badge external">{$t("hotmart.external_platform")}</span>
- {/if}
- </div>
- {#if externalPlatform}
- <button class="button elevated card-download" disabled>
- <svg
- width="16"
- height="16"
- viewBox="0 0 24 24"
- fill="none"
- stroke="currentColor"
- stroke-width="2"
- stroke-linecap="round"
- stroke-linejoin="round"
- >
- <path d="M18 6L6 18M6 6l12 12" />
- </svg>
- {$t("hotmart.unavailable")}
- </button>
- {:else if downloadStatus === "downloading"}
- <button class="button elevated card-download status-downloading" onclick={handleClick}>
- <svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">
- <rect x="6" y="6" width="12" height="12" rx="2" />
- </svg>
- {$t("hotmart.cancel_download")}
- </button>
- <div class="mini-progress-track">
- <div
- class="mini-progress-fill"
- style="width: {downloadPercent.toFixed(1)}%"
- ></div>
- </div>
- {:else if downloadStatus === "complete"}
- <button class="button elevated card-download status-complete" disabled>
- <svg
- width="16"
- height="16"
- viewBox="0 0 24 24"
- fill="none"
- stroke="currentColor"
- stroke-width="2"
- stroke-linecap="round"
- stroke-linejoin="round"
- >
- <path d="M5 12l5 5l10 -10" />
- </svg>
- {$t("hotmart.downloaded")}
- </button>
- {:else if downloadStatus === "error"}
- <button class="button elevated card-download status-error" onclick={handleClick}>
- <svg
- width="16"
- height="16"
- viewBox="0 0 24 24"
- fill="none"
- stroke="currentColor"
- stroke-width="2"
- stroke-linecap="round"
- stroke-linejoin="round"
- >
- <path d="M12 9v4" />
- <path d="M12 17h.01" />
- <path d="M3 12a9 9 0 1 0 18 0a9 9 0 0 0 -18 0" />
- </svg>
- {$t("hotmart.download_retry")}
- </button>
- {:else}
- <button class="button elevated card-download" onclick={handleClick}>
- <svg
- width="16"
- height="16"
- viewBox="0 0 24 24"
- fill="none"
- stroke="currentColor"
- stroke-width="2"
- stroke-linecap="round"
- stroke-linejoin="round"
- >
- <path d="M4 17v2a2 2 0 0 0 2 2h12a2 2 0 0 0 2 -2v-2" />
- <polyline points="7 11 12 16 17 11" />
- <line x1="12" y1="4" x2="12" y2="16" />
- </svg>
- {$t("hotmart.download_btn")}
- </button>
- {/if}
- </div>
-</div>
-
-<style>
- .course-card {
- background: var(--button);
- border-radius: var(--border-radius);
- box-shadow: var(--button-box-shadow);
- overflow: hidden;
- display: flex;
- flex-direction: column;
- }
-
- .card-image {
- width: 100%;
- aspect-ratio: 16 / 9;
- overflow: hidden;
- border-radius: var(--border-radius) var(--border-radius) 0 0;
- background: var(--button-elevated);
- }
-
- .card-image img {
- width: 100%;
- height: 100%;
- object-fit: cover;
- pointer-events: none;
- }
-
- .card-placeholder {
- width: 100%;
- height: 100%;
- display: flex;
- align-items: center;
- justify-content: center;
- }
-
- .card-placeholder svg {
- stroke: var(--gray);
- opacity: 0.5;
- pointer-events: none;
- }
-
- .card-body {
- padding: var(--padding);
- display: flex;
- flex-direction: column;
- gap: calc(var(--padding) / 2);
- }
-
- .card-title {
- font-size: 14.5px;
- font-weight: 500;
- margin-block: 0;
- display: -webkit-box;
- -webkit-line-clamp: 2;
- line-clamp: 2;
- -webkit-box-orient: vertical;
- overflow: hidden;
- text-overflow: ellipsis;
- line-height: 1.3;
- color: var(--secondary);
- user-select: text;
- }
-
- .card-meta {
- display: flex;
- align-items: center;
- gap: calc(var(--padding) / 2);
- flex-wrap: wrap;
- }
-
- .card-price {
- font-size: 12.5px;
- font-weight: 500;
- color: var(--gray);
- }
-
- .card-badge {
- font-size: 10px;
- font-weight: 500;
- text-transform: uppercase;
- letter-spacing: 0.04em;
- padding: 2px calc(var(--padding) / 2);
- border-radius: calc(var(--border-radius) / 2);
- }
-
- .card-badge.external {
- background: var(--orange);
- color: #000;
- }
-
- .card-download {
- width: 100%;
- display: flex;
- align-items: center;
- justify-content: center;
- gap: calc(var(--padding) / 2);
- margin-top: calc(var(--padding) / 2);
- }
-
- .card-download:disabled {
- opacity: 0.4;
- cursor: default;
- }
-
- .card-download svg {
- pointer-events: none;
- }
-
- .status-downloading {
- opacity: 0.8;
- cursor: default;
- }
-
- .status-downloading:disabled {
- opacity: 0.8;
- }
-
- .status-complete {
- background: var(--green);
- color: #000;
- }
-
- .status-complete:disabled {
- opacity: 1;
- }
-
- .status-error {
- background: var(--red);
- color: #fff;
- }
-
- .btn-spinner {
- width: 14px;
- height: 14px;
- border: 2px solid var(--input-border);
- border-top-color: var(--blue);
- border-radius: 50%;
- animation: spin 0.6s linear infinite;
- flex-shrink: 0;
- }
-
- @keyframes spin {
- to {
- transform: rotate(360deg);
- }
- }
-
- .mini-progress-track {
- width: 100%;
- height: 4px;
- background: var(--button-elevated);
- border-radius: 2px;
- overflow: hidden;
- }
-
- .mini-progress-fill {
- height: 100%;
- background: var(--blue);
- border-radius: 2px;
- transition: width 0.3s ease-out;
- }
-</style>
+<script lang="ts">
+ import { t } from "$lib/i18n";
+
+ type CardDownloadStatus = "idle" | "downloading" | "complete" | "error";
+
+ type CourseCardProps = {
+ name: string;
+ price: string;
+ imageUrl?: string;
+ externalPlatform?: boolean;
+ downloadStatus?: CardDownloadStatus;
+ downloadPercent?: number;
+ onDownload: () => void;
+ };
+
+ let {
+ name,
+ price,
+ imageUrl,
+ externalPlatform = false,
+ downloadStatus = "idle",
+ downloadPercent = 0,
+ onDownload,
+ }: CourseCardProps = $props();
+
+ let isDisabled = $derived(downloadStatus === "complete");
+
+ function handleClick() {
+ if (isDisabled) return;
+ onDownload();
+ }
+</script>
+
+<div class="course-card">
+ <div class="card-image">
+ {#if imageUrl}
+ <img src={imageUrl} alt={name} loading="lazy" />
+ {:else}
+ <div class="card-placeholder">
+ <svg
+ width="48"
+ height="48"
+ viewBox="0 0 24 24"
+ fill="none"
+ stroke="currentColor"
+ stroke-width="1.5"
+ stroke-linecap="round"
+ stroke-linejoin="round"
+ >
+ <path d="M22 9l-10 -4l-10 4l10 4l10 -4v6" />
+ <path d="M6 10.6v5.4a6 3 0 0 0 12 0v-5.4" />
+ </svg>
+ </div>
+ {/if}
+ </div>
+
+ <div class="card-body">
+ <h4 class="card-title" title={name}>{name}</h4>
+ <div class="card-meta">
+ <span class="card-price">{price}</span>
+ {#if externalPlatform}
+ <span class="card-badge external">{$t("hotmart.external_platform")}</span>
+ {/if}
+ </div>
+ {#if externalPlatform}
+ <button class="button elevated card-download" disabled>
+ <svg
+ width="16"
+ height="16"
+ viewBox="0 0 24 24"
+ fill="none"
+ stroke="currentColor"
+ stroke-width="2"
+ stroke-linecap="round"
+ stroke-linejoin="round"
+ >
+ <path d="M18 6L6 18M6 6l12 12" />
+ </svg>
+ {$t("hotmart.unavailable")}
+ </button>
+ {:else if downloadStatus === "downloading"}
+ <button class="button elevated card-download status-downloading" onclick={handleClick}>
+ <svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">
+ <rect x="6" y="6" width="12" height="12" rx="2" />
+ </svg>
+ {$t("hotmart.cancel_download")}
+ </button>
+ <div class="mini-progress-track">
+ <div
+ class="mini-progress-fill"
+ style="width: {downloadPercent.toFixed(1)}%"
+ ></div>
+ </div>
+ {:else if downloadStatus === "complete"}
+ <button class="button elevated card-download status-complete" disabled>
+ <svg
+ width="16"
+ height="16"
+ viewBox="0 0 24 24"
+ fill="none"
+ stroke="currentColor"
+ stroke-width="2"
+ stroke-linecap="round"
+ stroke-linejoin="round"
+ >
+ <path d="M5 12l5 5l10 -10" />
+ </svg>
+ {$t("hotmart.downloaded")}
+ </button>
+ {:else if downloadStatus === "error"}
+ <button class="button elevated card-download status-error" onclick={handleClick}>
+ <svg
+ width="16"
+ height="16"
+ viewBox="0 0 24 24"
+ fill="none"
+ stroke="currentColor"
+ stroke-width="2"
+ stroke-linecap="round"
+ stroke-linejoin="round"
+ >
+ <path d="M12 9v4" />
+ <path d="M12 17h.01" />
+ <path d="M3 12a9 9 0 1 0 18 0a9 9 0 0 0 -18 0" />
+ </svg>
+ {$t("hotmart.download_retry")}
+ </button>
+ {:else}
+ <button class="button elevated card-download" onclick={handleClick}>
+ <svg
+ width="16"
+ height="16"
+ viewBox="0 0 24 24"
+ fill="none"
+ stroke="currentColor"
+ stroke-width="2"
+ stroke-linecap="round"
+ stroke-linejoin="round"
+ >
+ <path d="M4 17v2a2 2 0 0 0 2 2h12a2 2 0 0 0 2 -2v-2" />
+ <polyline points="7 11 12 16 17 11" />
+ <line x1="12" y1="4" x2="12" y2="16" />
+ </svg>
+ {$t("hotmart.download_btn")}
+ </button>
+ {/if}
+ </div>
+</div>
+
+<style>
+ .course-card {
+ background: var(--button);
+ border-radius: var(--border-radius);
+ box-shadow: var(--button-box-shadow);
+ overflow: hidden;
+ display: flex;
+ flex-direction: column;
+ }
+
+ .card-image {
+ width: 100%;
+ aspect-ratio: 16 / 9;
+ overflow: hidden;
+ border-radius: var(--border-radius) var(--border-radius) 0 0;
+ background: var(--button-elevated);
+ }
+
+ .card-image img {
+ width: 100%;
+ height: 100%;
+ object-fit: cover;
+ pointer-events: none;
+ }
+
+ .card-placeholder {
+ width: 100%;
+ height: 100%;
+ display: flex;
+ align-items: center;
+ justify-content: center;
+ }
+
+ .card-placeholder svg {
+ stroke: var(--gray);
+ opacity: 0.5;
+ pointer-events: none;
+ }
+
+ .card-body {
+ padding: var(--padding);
+ display: flex;
+ flex-direction: column;
+ gap: calc(var(--padding) / 2);
+ }
+
+ .card-title {
+ font-size: var(--text-base);
+ font-weight: 500;
+ margin-block: 0;
+ display: -webkit-box;
+ -webkit-line-clamp: 2;
+ line-clamp: 2;
+ -webkit-box-orient: vertical;
+ overflow: hidden;
+ text-overflow: ellipsis;
+ line-height: 1.3;
+ color: var(--secondary);
+ user-select: text;
+ }
+
+ .card-meta {
+ display: flex;
+ align-items: center;
+ gap: calc(var(--padding) / 2);
+ flex-wrap: wrap;
+ }
+
+ .card-price {
+ font-size: var(--text-sm);
+ font-weight: 500;
+ color: var(--gray);
+ }
+
+ .card-badge {
+ font-size: 10px;
+ font-weight: 500;
+ text-transform: uppercase;
+ letter-spacing: 0.04em;
+ padding: 2px calc(var(--padding) / 2);
+ border-radius: calc(var(--border-radius) / 2);
+ }
+
+ .card-badge.external {
+ background: var(--orange);
+ color: #000;
+ }
+
+ .card-download {
+ width: 100%;
+ display: flex;
+ align-items: center;
+ justify-content: center;
+ gap: calc(var(--padding) / 2);
+ margin-top: calc(var(--padding) / 2);
+ }
+
+ .card-download:disabled {
+ opacity: 0.4;
+ cursor: default;
+ }
+
+ .card-download svg {
+ pointer-events: none;
+ }
+
+ .status-downloading {
+ opacity: 0.8;
+ cursor: default;
+ }
+
+ .status-downloading:disabled {
+ opacity: 0.8;
+ }
+
+ .status-complete {
+ background: var(--green);
+ color: #000;
+ }
+
+ .status-complete:disabled {
+ opacity: 1;
+ }
+
+ .status-error {
+ background: var(--red);
+ color: #fff;
+ }
+
+ .btn-spinner {
+ width: 14px;
+ height: 14px;
+ border: 2px solid var(--input-border);
+ border-top-color: var(--blue);
+ border-radius: 50%;
+ animation: spin 0.6s linear infinite;
+ flex-shrink: 0;
+ }
+
+ @keyframes spin {
+ to {
+ transform: rotate(360deg);
+ }
+ }
+
+ .mini-progress-track {
+ width: 100%;
+ height: 4px;
+ background: var(--button-elevated);
+ border-radius: 2px;
+ overflow: hidden;
+ }
+
+ .mini-progress-fill {
+ height: 100%;
+ background: var(--blue);
+ border-radius: 2px;
+ transition: width 0.3s ease-out;
+ }
+</style>
diff --git a/src/components/omnibox/BatchDownload.svelte b/src/components/omnibox/BatchDownload.svelte
index 472d73da..5a79848a 100644
--- a/src/components/omnibox/BatchDownload.svelte
+++ b/src/components/omnibox/BatchDownload.svelte
@@ -26,7 +26,7 @@
}
.feedback-text {
- font-size: 12.5px;
+ font-size: var(--text-sm);
font-weight: 500;
}
@@ -36,7 +36,7 @@
justify-content: center;
gap: 6px;
padding: var(--padding) calc(var(--padding) * 2);
- font-size: 14.5px;
+ font-size: var(--text-base);
font-weight: 500;
background: var(--button);
border: none;
diff --git a/src/components/omnibox/CookieAccountPicker.svelte b/src/components/omnibox/CookieAccountPicker.svelte
index feee6db9..ccf39009 100644
--- a/src/components/omnibox/CookieAccountPicker.svelte
+++ b/src/components/omnibox/CookieAccountPicker.svelte
@@ -88,7 +88,7 @@
align-items: center;
gap: 6px;
padding: 6px 10px;
- font-size: 12.5px;
+ font-size: var(--text-sm);
font-weight: 500;
color: var(--gray);
background: var(--button);
@@ -141,7 +141,7 @@
gap: 2px;
width: 100%;
padding: 8px 10px;
- font-size: 12.5px;
+ font-size: var(--text-sm);
color: var(--secondary);
background: transparent;
border: none;
diff --git a/src/components/omnibox/DownloadModeSelector.svelte b/src/components/omnibox/DownloadModeSelector.svelte
index 05e627e5..84942cf6 100644
--- a/src/components/omnibox/DownloadModeSelector.svelte
+++ b/src/components/omnibox/DownloadModeSelector.svelte
@@ -57,7 +57,7 @@
justify-content: center;
gap: 6px;
padding: 8px 12px;
- font-size: 12.5px;
+ font-size: var(--text-sm);
font-weight: 500;
color: var(--gray);
background: none;
diff --git a/src/components/omnibox/FormatSelector.svelte b/src/components/omnibox/FormatSelector.svelte
index caabdbf3..8557a875 100644
--- a/src/components/omnibox/FormatSelector.svelte
+++ b/src/components/omnibox/FormatSelector.svelte
@@ -1,498 +1,523 @@
-<script lang="ts">
- import { t } from "$lib/i18n";
-
- type FormatInfo = {
- format_id: string;
- ext: string;
- resolution: string | null;
- width: number | null;
- height: number | null;
- fps: number | null;
- vcodec: string | null;
- acodec: string | null;
- filesize: number | null;
- tbr: number | null;
- has_video: boolean;
- has_audio: boolean;
- format_note: string | null;
- };
-
- let {
- platform,
- isPlaylist = false,
- formats = $bindable([]),
- selectedFormatId = $bindable<string | null>(null),
- loadingFormats = false,
- formatError = null as string | null,
- onLoadFormats,
- onSelectFormat,
- onClearFormat,
- onPresetBest,
- onPresetMusic,
- } = $props();
-
- function formatFilesize(bytes: number | null): string {
- if (bytes === null) return "—";
- if (bytes < 1024) return `${bytes} B`;
- if (bytes < 1024 * 1024) return `${(bytes / 1024).toFixed(0)} KB`;
- if (bytes < 1024 * 1024 * 1024) return `${(bytes / (1024 * 1024)).toFixed(1)} MB`;
- return `${(bytes / (1024 * 1024 * 1024)).toFixed(2)} GB`;
- }
-
- function formatCodec(codec: string | null): string {
- if (!codec || codec === "none") return "—";
- return codec.split(".")[0];
- }
-
- type Preset = "best" | "music" | "custom" | null;
- let activePreset = $state<Preset>(null);
-
- let bestVA = $derived([...formats].reverse().find(f => f.has_video && f.has_audio) ?? null);
- let bestAudio = $derived([...formats].reverse().find(f => f.has_audio && !f.has_video) ?? null);
- let bestVideo = $derived([...formats].reverse().find(f => f.has_video && !f.has_audio) ?? null);
-
- let hasMusicPreset = $derived(bestAudio !== null);
-
- let selectedFormatLabel = $derived.by(() => {
- if (!selectedFormatId) return null;
- const f = formats.find(fmt => fmt.format_id === selectedFormatId);
- if (!f) return selectedFormatId;
- const parts: string[] = [];
- if (f.resolution) parts.push(f.resolution);
- parts.push(f.ext);
- if (f.has_video && f.has_audio) parts.push("V+A");
- else if (f.has_video) parts.push("V");
- else if (f.has_audio) parts.push("A");
- return parts.join(" · ");
- });
-
- function isYtdlpPlatform(p: string): boolean {
- return !["hotmart", "telegram", "udemy", "unknown"].includes(p);
- }
-
- function applyBest() {
- activePreset = "best";
- if (selectedFormatId) onClearFormat();
- onPresetBest?.();
- }
-
- function applyMusic() {
- activePreset = "music";
- if (selectedFormatId) onClearFormat();
- onPresetMusic?.();
- }
-
- function toggleCustom() {
- activePreset = activePreset === "custom" ? null : "custom";
- if (selectedFormatId) onClearFormat();
- }
-
- $effect(() => {
- if (!formats.length) {
- activePreset = null;
- }
- });
-</script>
-
-{#if isYtdlpPlatform(platform) && isPlaylist}
- <div class="formats-playlist-note">
- {$t('omnibox.formats_playlist_note')}
- </div>
-{:else if isYtdlpPlatform(platform)}
- <button
- class="button formats-toggle-btn"
- onclick={onLoadFormats}
- disabled={loadingFormats}
- >
- {#if loadingFormats}
- <span class="feedback-spinner small-spinner"></span>
- {:else}
- <svg viewBox="0 0 24 24" width="14" height="14" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">
- <path d="M4 6h16M4 12h16M4 18h16" />
- </svg>
- {/if}
- {#if loadingFormats}
- {$t('omnibox.view_formats')}...
- {:else if formats.length > 0}
- {$t('omnibox.hide_formats')}
- {:else}
- {$t('omnibox.view_formats')}
- {/if}
- </button>
-
- {#if formatError && formats.length === 0}
- <div class="formats-error">
- <span class="formats-error-text">{formatError}</span>
- <button class="button formats-retry-btn" onclick={onLoadFormats}>
- {$t('omnibox.retry')}
- </button>
- </div>
- {/if}
-
- {#if formats.length > 0}
- <div class="formats-panel">
- <div class="formats-presets" role="radiogroup" aria-label={$t('omnibox.formats_presets_label')}>
- {#if bestVA || bestVideo}
- <button
- type="button"
- class="preset-pill"
- class:active={activePreset === "best"}
- onclick={applyBest}
- role="radio"
- aria-checked={activePreset === "best"}
- >
- <svg viewBox="0 0 24 24" width="14" height="14" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true">
- <polygon points="5 3 19 12 5 21 5 3" />
- </svg>
- <span>{$t('omnibox.preset_best')}</span>
- </button>
- {/if}
- {#if hasMusicPreset}
- <button
- type="button"
- class="preset-pill"
- class:active={activePreset === "music"}
- onclick={applyMusic}
- role="radio"
- aria-checked={activePreset === "music"}
- >
- <svg viewBox="0 0 24 24" width="14" height="14" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true">
- <path d="M9 18V5l12-2v13" />
- <circle cx="6" cy="18" r="3" />
- <circle cx="18" cy="16" r="3" />
- </svg>
- <span>{$t('omnibox.preset_music')}</span>
- </button>
- {/if}
- <button
- type="button"
- class="preset-pill"
- class:active={activePreset === "custom"}
- onclick={toggleCustom}
- role="radio"
- aria-checked={activePreset === "custom"}
- >
- <svg viewBox="0 0 24 24" width="14" height="14" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true">
- <circle cx="12" cy="12" r="3" />
- <path d="M19.4 15a1.65 1.65 0 0 0 .33 1.82l.06.06a2 2 0 0 1-2.83 2.83l-.06-.06a1.65 1.65 0 0 0-1.82-.33 1.65 1.65 0 0 0-1 1.51V21a2 2 0 0 1-4 0v-.09A1.65 1.65 0 0 0 9 19.4a1.65 1.65 0 0 0-1.82.33l-.06.06a2 2 0 0 1-2.83-2.83l.06-.06a1.65 1.65 0 0 0 .33-1.82 1.65 1.65 0 0 0-1.51-1H3a2 2 0 0 1 0-4h.09A1.65 1.65 0 0 0 4.6 9a1.65 1.65 0 0 0-.33-1.82l-.06-.06a2 2 0 0 1 2.83-2.83l.06.06a1.65 1.65 0 0 0 1.82.33H9a1.65 1.65 0 0 0 1-1.51V3a2 2 0 0 1 4 0v.09a1.65 1.65 0 0 0 1 1.51 1.65 1.65 0 0 0 1.82-.33l.06-.06a2 2 0 0 1 2.83 2.83l-.06.06a1.65 1.65 0 0 0-.33 1.82V9a1.65 1.65 0 0 0 1.51 1H21a2 2 0 0 1 0 4h-.09a1.65 1.65 0 0 0-1.51 1z" />
- </svg>
- <span>{$t('omnibox.preset_custom')}</span>
- </button>
- </div>
-
- {#if selectedFormatId}
- <div class="format-selected">
- <span class="format-selected-label">{selectedFormatLabel}</span>
- <button class="format-clear-btn" onclick={() => { onClearFormat(); activePreset = null; }} aria-label={$t('common.close')}>
- <svg viewBox="0 0 24 24" width="12" height="12" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">
- <path d="M18 6L6 18M6 6l12 12" />
- </svg>
- </button>
- </div>
- {:else}
- <div class="formats-info">
- <span class="formats-note">
- {$t('omnibox.formats_merge_note')}
- </span>
- </div>
- {/if}
-
- {#if activePreset === "custom"}
- <div class="formats-list">
- <div class="format-header">
- <span>ID</span>
- <span>{$t('omnibox.fmt_type')}</span>
- <span>{$t('omnibox.fmt_quality')}</span>
- <span>{$t('omnibox.fmt_streams')}</span>
- <span>{$t('omnibox.fmt_video')}</span>
- <span>{$t('omnibox.fmt_audio')}</span>
- <span>{$t('omnibox.fmt_size')}</span>
- <span>{$t('omnibox.fmt_speed')}</span>
- </div>
- {#each formats as fmt (fmt.format_id)}
- <button
- class="format-row"
- class:format-row-selected={selectedFormatId === fmt.format_id}
- onclick={() => onSelectFormat(fmt.format_id)}
- >
- <span class="format-id">{fmt.format_id}</span>
- <span class="format-ext">{fmt.ext}</span>
- <span class="format-res">{fmt.resolution ?? "—"}</span>
- <span class="format-codec">
- {#if fmt.has_video && fmt.has_audio}
- V+A
- {:else if fmt.has_video}
- V
- {:else if fmt.has_audio}
- A
- {:else}
- —
- {/if}
- </span>
- <span class="format-vcodec">{formatCodec(fmt.vcodec)}</span>
- <span class="format-acodec">{formatCodec(fmt.acodec)}</span>
- <span class="format-size">{formatFilesize(fmt.filesize)}</span>
- {#if fmt.tbr}
- <span class="format-tbr">{fmt.tbr.toFixed(0)}k</span>
- {:else}
- <span class="format-tbr">—</span>
- {/if}
- </button>
- {/each}
- </div>
- {/if}
- </div>
- {/if}
-{/if}
-
-<style>
- .formats-toggle-btn {
- display: flex;
- align-items: center;
- gap: 6px;
- font-size: 14.5px;
- }
-
- .formats-playlist-note {
- padding: calc(var(--padding) / 2) var(--padding);
- background: var(--button-elevated);
- border-radius: calc(var(--border-radius) - 2px);
- border-left: 3px solid var(--cta);
- font-size: 12.5px;
- color: var(--secondary);
- line-height: 1.4;
- }
-
- .small-spinner {
- width: 12px;
- height: 12px;
- border-width: 1.5px;
- }
-
- .formats-error {
- display: flex;
- align-items: center;
- justify-content: space-between;
- gap: var(--padding);
- padding: calc(var(--padding) / 2) var(--padding);
- background: var(--button-elevated);
- border-radius: calc(var(--border-radius) - 2px);
- border-left: 3px solid var(--red);
- }
-
- .formats-error-text {
- font-size: 12.5px;
- font-weight: 500;
- color: var(--secondary);
- flex: 1;
- min-width: 0;
- overflow: hidden;
- text-overflow: ellipsis;
- white-space: nowrap;
- }
-
- .formats-retry-btn {
- font-size: 12.5px;
- padding: 4px 10px;
- flex-shrink: 0;
- }
-
- .formats-panel {
- display: flex;
- flex-direction: column;
- gap: calc(var(--padding) / 2);
- width: 100%;
- background: var(--button);
- border-radius: var(--border-radius);
- box-shadow: var(--button-box-shadow);
- padding: var(--padding);
- max-height: 400px;
- overflow: hidden;
- }
-
- .formats-presets {
- display: flex;
- gap: calc(var(--padding) / 2);
- flex-wrap: wrap;
- }
-
- .preset-pill {
- display: inline-flex;
- align-items: center;
- gap: 6px;
- padding: 6px 14px;
- font-size: 13px;
- font-weight: 500;
- color: var(--secondary);
- background: var(--button);
- border: 1px solid var(--button-stroke);
- border-radius: 999px;
- cursor: pointer;
- transition: background 0.15s, border-color 0.15s, color 0.15s;
- }
-
- @media (hover: hover) {
- .preset-pill:hover {
- background: var(--button-hover);
- border-color: var(--content-border);
- }
- }
-
- .preset-pill:active {
- background: var(--button-press);
- }
-
- .preset-pill.active {
- background: var(--button-elevated);
- border-color: var(--accent, var(--secondary));
- color: var(--primary, var(--secondary));
- }
-
- .preset-pill:focus-visible {
- outline: 2px solid var(--accent, var(--secondary));
- outline-offset: 2px;
- }
-
- .formats-info {
- display: flex;
- justify-content: center;
- align-items: center;
- }
-
- .formats-note {
- font-size: 11px;
- color: var(--gray);
- text-align: center;
- line-height: 1.4;
- }
-
- .formats-list {
- max-height: 240px;
- overflow-y: auto;
- display: flex;
- flex-direction: column;
- background: var(--button);
- border-radius: var(--border-radius);
- box-shadow: var(--button-box-shadow);
- scrollbar-width: none;
- }
-
- .formats-list::-webkit-scrollbar {
- display: none;
- }
-
- .format-header {
- display: grid;
- grid-template-columns: 48px 48px 80px 32px 64px 64px 64px 48px;
- gap: 2px;
- padding: calc(var(--padding) / 2) calc(var(--padding) / 2 + 4px);
- font-size: 10px;
- font-weight: 600;
- color: var(--gray);
- opacity: 0.7;
- text-transform: uppercase;
- letter-spacing: 0.5px;
- border-bottom: 1px solid var(--content-border);
- position: sticky;
- top: 0;
- background: var(--button);
- }
-
- .format-row {
- display: grid;
- grid-template-columns: 48px 48px 80px 32px 64px 64px 64px 48px;
- align-items: center;
- gap: 2px;
- padding: calc(var(--padding) / 2) calc(var(--padding) / 2 + 4px);
- font-size: 11px;
- font-weight: 500;
- color: var(--gray);
- background: transparent;
- border: none;
- cursor: pointer;
- text-align: left;
- border-bottom: 1px solid var(--button-stroke);
- }
-
- .format-row:last-child {
- border-bottom: none;
- }
-
- @media (hover: hover) {
- .format-row:hover {
- background: var(--button-hover);
- color: var(--secondary);
- }
- }
-
- .format-row:active {
- background: var(--button-press);
- }
-
- .format-row-selected {
- background: var(--button-elevated);
- color: var(--secondary);
- }
-
- .format-id {
- color: var(--secondary);
- font-weight: 500;
- }
-
- .format-ext {
- color: var(--blue);
- }
-
- .format-res {
- color: var(--secondary);
- }
-
- .format-codec {
- text-align: center;
- }
-
- .format-selected {
- display: flex;
- align-items: center;
- justify-content: space-between;
- gap: var(--padding);
- padding: var(--padding);
- background: var(--button-elevated);
- border-radius: calc(var(--border-radius) - 2px);
- font-size: 13px;
- }
-
- .format-selected-label {
- color: var(--secondary);
- font-weight: 500;
- flex: 1;
- }
-
- .format-clear-btn {
- display: flex;
- align-items: center;
- justify-content: center;
- width: 24px;
- height: 24px;
- background: transparent;
- border: none;
- cursor: pointer;
- color: var(--secondary);
- padding: 0;
- }
-
- @media (max-width: 535px) {
- .format-header,
- .format-row {
- grid-template-columns: 40px 40px 64px 24px 56px 56px 56px 40px;
- font-size: 10px;
- }
-
- .format-header {
- font-size: 9px;
- }
- }
-
- @media (prefers-reduced-motion: reduce) {
- }
-</style>
+<script lang="ts">
+ import { t } from "$lib/i18n";
+
+ type FormatInfo = {
+ format_id: string;
+ ext: string;
+ resolution: string | null;
+ width: number | null;
+ height: number | null;
+ fps: number | null;
+ vcodec: string | null;
+ acodec: string | null;
+ filesize: number | null;
+ filesize_is_estimate?: boolean;
+ tbr: number | null;
+ has_video: boolean;
+ has_audio: boolean;
+ format_note: string | null;
+ audio_language?: string | null;
+ };
+
+ let {
+ platform,
+ isPlaylist = false,
+ formats = $bindable([]),
+ selectedFormatId = $bindable<string | null>(null),
+ loadingFormats = false,
+ formatError = null as string | null,
+ onLoadFormats,
+ onSelectFormat,
+ onClearFormat,
+ onPresetBest,
+ onPresetMusic,
+ } = $props();
+
+ function formatFilesize(bytes: number | null, isEstimate = false): string {
+ if (bytes === null) return "—";
+ // O `~` é um contrato com o usuário: número sem til é o que o site
+ // informou; com til, foi calculado por bitrate × duração.
+ const prefix = isEstimate ? "~" : "";
+ if (bytes < 1024) return `${prefix}${bytes} B`;
+ if (bytes < 1024 * 1024) return `${prefix}${(bytes / 1024).toFixed(0)} KB`;
+ if (bytes < 1024 * 1024 * 1024) return `${prefix}${(bytes / (1024 * 1024)).toFixed(1)} MB`;
+ return `${prefix}${(bytes / (1024 * 1024 * 1024)).toFixed(2)} GB`;
+ }
+
+ const languageNames =
+ typeof Intl !== "undefined" && "DisplayNames" in Intl
+ ? new Intl.DisplayNames(undefined, { type: "language" })
+ : null;
+
+ function formatAudioLanguage(code: string | null | undefined): string | null {
+ if (!code) return null;
+ try {
+ return languageNames?.of(code) ?? code;
+ } catch {
+ return code;
+ }
+ }
+
+ function formatCodec(codec: string | null): string {
+ if (!codec || codec === "none") return "—";
+ return codec.split(".")[0];
+ }
+
+ type Preset = "best" | "music" | "custom" | null;
+ let activePreset = $state<Preset>(null);
+
+ let bestVA = $derived([...formats].reverse().find(f => f.has_video && f.has_audio) ?? null);
+ let bestAudio = $derived([...formats].reverse().find(f => f.has_audio && !f.has_video) ?? null);
+ let bestVideo = $derived([...formats].reverse().find(f => f.has_video && !f.has_audio) ?? null);
+
+ let hasMusicPreset = $derived(bestAudio !== null);
+
+ let selectedFormatLabel = $derived.by(() => {
+ if (!selectedFormatId) return null;
+ const f = formats.find(fmt => fmt.format_id === selectedFormatId);
+ if (!f) return selectedFormatId;
+ const parts: string[] = [];
+ if (f.resolution) parts.push(f.resolution);
+ parts.push(f.ext);
+ if (f.has_video && f.has_audio) parts.push("V+A");
+ else if (f.has_video) parts.push("V");
+ else if (f.has_audio) parts.push("A");
+ return parts.join(" · ");
+ });
+
+ function isYtdlpPlatform(p: string): boolean {
+ return !["hotmart", "telegram", "udemy", "unknown"].includes(p);
+ }
+
+ function applyBest() {
+ activePreset = "best";
+ if (selectedFormatId) onClearFormat();
+ onPresetBest?.();
+ }
+
+ function applyMusic() {
+ activePreset = "music";
+ if (selectedFormatId) onClearFormat();
+ onPresetMusic?.();
+ }
+
+ function toggleCustom() {
+ activePreset = activePreset === "custom" ? null : "custom";
+ if (selectedFormatId) onClearFormat();
+ }
+
+ $effect(() => {
+ if (!formats.length) {
+ activePreset = null;
+ }
+ });
+</script>
+
+{#if isYtdlpPlatform(platform) && isPlaylist}
+ <div class="formats-playlist-note">
+ {$t('omnibox.formats_playlist_note')}
+ </div>
+{:else if isYtdlpPlatform(platform)}
+ <button
+ class="button formats-toggle-btn"
+ onclick={onLoadFormats}
+ disabled={loadingFormats}
+ >
+ {#if loadingFormats}
+ <span class="feedback-spinner small-spinner"></span>
+ {:else}
+ <svg viewBox="0 0 24 24" width="14" height="14" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">
+ <path d="M4 6h16M4 12h16M4 18h16" />
+ </svg>
+ {/if}
+ {#if loadingFormats}
+ {$t('omnibox.view_formats')}...
+ {:else if formats.length > 0}
+ {$t('omnibox.hide_formats')}
+ {:else}
+ {$t('omnibox.view_formats')}
+ {/if}
+ </button>
+
+ {#if formatError && formats.length === 0}
+ <div class="formats-error">
+ <span class="formats-error-text">{formatError}</span>
+ <button class="button formats-retry-btn" onclick={onLoadFormats}>
+ {$t('omnibox.retry')}
+ </button>
+ </div>
+ {/if}
+
+ {#if formats.length > 0}
+ <div class="formats-panel">
+ <div class="formats-presets" role="radiogroup" aria-label={$t('omnibox.formats_presets_label')}>
+ {#if bestVA || bestVideo}
+ <button
+ type="button"
+ class="preset-pill"
+ class:active={activePreset === "best"}
+ onclick={applyBest}
+ role="radio"
+ aria-checked={activePreset === "best"}
+ >
+ <svg viewBox="0 0 24 24" width="14" height="14" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true">
+ <polygon points="5 3 19 12 5 21 5 3" />
+ </svg>
+ <span>{$t('omnibox.preset_best')}</span>
+ </button>
+ {/if}
+ {#if hasMusicPreset}
+ <button
+ type="button"
+ class="preset-pill"
+ class:active={activePreset === "music"}
+ onclick={applyMusic}
+ role="radio"
+ aria-checked={activePreset === "music"}
+ >
+ <svg viewBox="0 0 24 24" width="14" height="14" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true">
+ <path d="M9 18V5l12-2v13" />
+ <circle cx="6" cy="18" r="3" />
+ <circle cx="18" cy="16" r="3" />
+ </svg>
+ <span>{$t('omnibox.preset_music')}</span>
+ </button>
+ {/if}
+ <button
+ type="button"
+ class="preset-pill"
+ class:active={activePreset === "custom"}
+ onclick={toggleCustom}
+ role="radio"
+ aria-checked={activePreset === "custom"}
+ >
+ <svg viewBox="0 0 24 24" width="14" height="14" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true">
+ <circle cx="12" cy="12" r="3" />
+ <path d="M19.4 15a1.65 1.65 0 0 0 .33 1.82l.06.06a2 2 0 0 1-2.83 2.83l-.06-.06a1.65 1.65 0 0 0-1.82-.33 1.65 1.65 0 0 0-1 1.51V21a2 2 0 0 1-4 0v-.09A1.65 1.65 0 0 0 9 19.4a1.65 1.65 0 0 0-1.82.33l-.06.06a2 2 0 0 1-2.83-2.83l.06-.06a1.65 1.65 0 0 0 .33-1.82 1.65 1.65 0 0 0-1.51-1H3a2 2 0 0 1 0-4h.09A1.65 1.65 0 0 0 4.6 9a1.65 1.65 0 0 0-.33-1.82l-.06-.06a2 2 0 0 1 2.83-2.83l.06.06a1.65 1.65 0 0 0 1.82.33H9a1.65 1.65 0 0 0 1-1.51V3a2 2 0 0 1 4 0v.09a1.65 1.65 0 0 0 1 1.51 1.65 1.65 0 0 0 1.82-.33l.06-.06a2 2 0 0 1 2.83 2.83l-.06.06a1.65 1.65 0 0 0-.33 1.82V9a1.65 1.65 0 0 0 1.51 1H21a2 2 0 0 1 0 4h-.09a1.65 1.65 0 0 0-1.51 1z" />
+ </svg>
+ <span>{$t('omnibox.preset_custom')}</span>
+ </button>
+ </div>
+
+ {#if selectedFormatId}
+ <div class="format-selected">
+ <span class="format-selected-label">{selectedFormatLabel}</span>
+ <button class="format-clear-btn" onclick={() => { onClearFormat(); activePreset = null; }} aria-label={$t('common.close')}>
+ <svg viewBox="0 0 24 24" width="12" height="12" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">
+ <path d="M18 6L6 18M6 6l12 12" />
+ </svg>
+ </button>
+ </div>
+ {:else}
+ <div class="formats-info">
+ <span class="formats-note">
+ {$t('omnibox.formats_merge_note')}
+ </span>
+ </div>
+ {/if}
+
+ {#if activePreset === "custom"}
+ <div class="formats-list">
+ <div class="format-header">
+ <span>ID</span>
+ <span>{$t('omnibox.fmt_type')}</span>
+ <span>{$t('omnibox.fmt_quality')}</span>
+ <span>{$t('omnibox.fmt_streams')}</span>
+ <span>{$t('omnibox.fmt_video')}</span>
+ <span>{$t('omnibox.fmt_audio')}</span>
+ <span>{$t('omnibox.fmt_size')}</span>
+ <span>{$t('omnibox.fmt_speed')}</span>
+ </div>
+ {#each formats as fmt (fmt.format_id)}
+ <button
+ class="format-row"
+ class:format-row-selected={selectedFormatId === fmt.format_id}
+ onclick={() => onSelectFormat(fmt.format_id)}
+ >
+ <span class="format-id">{fmt.format_id}</span>
+ <span class="format-ext">{fmt.ext}</span>
+ <span class="format-res">{fmt.resolution ?? "—"}</span>
+ <span class="format-codec">
+ {#if fmt.has_video && fmt.has_audio}
+ V+A
+ {:else if fmt.has_video}
+ V
+ {:else if fmt.has_audio}
+ A
+ {:else}
+ —
+ {/if}
+ </span>
+ <span class="format-vcodec">{formatCodec(fmt.vcodec)}</span>
+ <span class="format-acodec">
+ {formatCodec(fmt.acodec)}{#if formatAudioLanguage(fmt.audio_language)}<span class="format-lang"> · {formatAudioLanguage(fmt.audio_language)}</span>{/if}
+ </span>
+ <span class="format-size">{formatFilesize(fmt.filesize, fmt.filesize_is_estimate)}</span>
+ {#if fmt.tbr}
+ <span class="format-tbr">{fmt.tbr.toFixed(0)}k</span>
+ {:else}
+ <span class="format-tbr">—</span>
+ {/if}
+ </button>
+ {/each}
+ </div>
+ {/if}
+ </div>
+ {/if}
+{/if}
+
+<style>
+ .formats-toggle-btn {
+ display: flex;
+ align-items: center;
+ gap: 6px;
+ font-size: var(--text-base);
+ }
+
+ .formats-playlist-note {
+ padding: calc(var(--padding) / 2) var(--padding);
+ background: var(--button-elevated);
+ border-radius: calc(var(--border-radius) - 2px);
+ border-left: 3px solid var(--cta);
+ font-size: var(--text-sm);
+ color: var(--secondary);
+ line-height: 1.4;
+ }
+
+ .small-spinner {
+ width: 12px;
+ height: 12px;
+ border-width: 1.5px;
+ }
+
+ .formats-error {
+ display: flex;
+ align-items: center;
+ justify-content: space-between;
+ gap: var(--padding);
+ padding: calc(var(--padding) / 2) var(--padding);
+ background: var(--button-elevated);
+ border-radius: calc(var(--border-radius) - 2px);
+ border-left: 3px solid var(--red);
+ }
+
+ .formats-error-text {
+ font-size: var(--text-sm);
+ font-weight: 500;
+ color: var(--secondary);
+ flex: 1;
+ min-width: 0;
+ overflow: hidden;
+ text-overflow: ellipsis;
+ white-space: nowrap;
+ }
+
+ .formats-retry-btn {
+ font-size: var(--text-sm);
+ padding: 4px 10px;
+ flex-shrink: 0;
+ }
+
+ .formats-panel {
+ display: flex;
+ flex-direction: column;
+ gap: calc(var(--padding) / 2);
+ width: 100%;
+ background: var(--button);
+ border-radius: var(--border-radius);
+ box-shadow: var(--button-box-shadow);
+ padding: var(--padding);
+ max-height: 400px;
+ overflow: hidden;
+ }
+
+ .formats-presets {
+ display: flex;
+ gap: calc(var(--padding) / 2);
+ flex-wrap: wrap;
+ }
+
+ .preset-pill {
+ display: inline-flex;
+ align-items: center;
+ gap: 6px;
+ padding: 6px 14px;
+ font-size: 13px;
+ font-weight: 500;
+ color: var(--secondary);
+ background: var(--button);
+ border: 1px solid var(--button-stroke);
+ border-radius: 999px;
+ cursor: pointer;
+ transition: background 0.15s, border-color 0.15s, color 0.15s;
+ }
+
+ @media (hover: hover) {
+ .preset-pill:hover {
+ background: var(--button-hover);
+ border-color: var(--content-border);
+ }
+ }
+
+ .preset-pill:active {
+ background: var(--button-press);
+ }
+
+ .preset-pill.active {
+ background: var(--button-elevated);
+ border-color: var(--accent, var(--secondary));
+ color: var(--primary, var(--secondary));
+ }
+
+ .preset-pill:focus-visible {
+ outline: 2px solid var(--accent, var(--secondary));
+ outline-offset: 2px;
+ }
+
+ .formats-info {
+ display: flex;
+ justify-content: center;
+ align-items: center;
+ }
+
+ .formats-note {
+ font-size: 11px;
+ color: var(--gray);
+ text-align: center;
+ line-height: 1.4;
+ }
+
+ .formats-list {
+ max-height: 240px;
+ overflow-y: auto;
+ display: flex;
+ flex-direction: column;
+ background: var(--button);
+ border-radius: var(--border-radius);
+ box-shadow: var(--button-box-shadow);
+ scrollbar-width: none;
+ }
+
+ .formats-list::-webkit-scrollbar {
+ display: none;
+ }
+
+ .format-header {
+ display: grid;
+ grid-template-columns: 48px 48px 80px 32px 64px 64px 64px 48px;
+ gap: 2px;
+ padding: calc(var(--padding) / 2) calc(var(--padding) / 2 + 4px);
+ font-size: 10px;
+ font-weight: 600;
+ color: var(--gray);
+ opacity: 0.7;
+ text-transform: uppercase;
+ letter-spacing: 0.5px;
+ border-bottom: 1px solid var(--content-border);
+ position: sticky;
+ top: 0;
+ background: var(--button);
+ }
+
+ .format-row {
+ display: grid;
+ grid-template-columns: 48px 48px 80px 32px 64px 64px 64px 48px;
+ align-items: center;
+ gap: 2px;
+ padding: calc(var(--padding) / 2) calc(var(--padding) / 2 + 4px);
+ font-size: 11px;
+ font-weight: 500;
+ color: var(--gray);
+ background: transparent;
+ border: none;
+ cursor: pointer;
+ text-align: left;
+ border-bottom: 1px solid var(--button-stroke);
+ }
+
+ .format-row:last-child {
+ border-bottom: none;
+ }
+
+ @media (hover: hover) {
+ .format-row:hover {
+ background: var(--button-hover);
+ color: var(--secondary);
+ }
+ }
+
+ .format-row:active {
+ background: var(--button-press);
+ }
+
+ .format-row-selected {
+ background: var(--button-elevated);
+ color: var(--secondary);
+ }
+
+ .format-lang {
+ color: var(--tertiary);
+ }
+
+ .format-id {
+ color: var(--secondary);
+ font-weight: 500;
+ }
+
+ .format-ext {
+ color: var(--blue);
+ }
+
+ .format-res {
+ color: var(--secondary);
+ }
+
+ .format-codec {
+ text-align: center;
+ }
+
+ .format-selected {
+ display: flex;
+ align-items: center;
+ justify-content: space-between;
+ gap: var(--padding);
+ padding: var(--padding);
+ background: var(--button-elevated);
+ border-radius: calc(var(--border-radius) - 2px);
+ font-size: 13px;
+ }
+
+ .format-selected-label {
+ color: var(--secondary);
+ font-weight: 500;
+ flex: 1;
+ }
+
+ .format-clear-btn {
+ display: flex;
+ align-items: center;
+ justify-content: center;
+ width: 24px;
+ height: 24px;
+ background: transparent;
+ border: none;
+ cursor: pointer;
+ color: var(--secondary);
+ padding: 0;
+ }
+
+ @media (max-width: 535px) {
+ .format-header,
+ .format-row {
+ grid-template-columns: 40px 40px 64px 24px 56px 56px 56px 40px;
+ font-size: 10px;
+ }
+
+ .format-header {
+ font-size: 9px;
+ }
+ }
+
+ @media (prefers-reduced-motion: reduce) {
+ }
+</style>
diff --git a/src/components/omnibox/OmniboxAdvanced.svelte b/src/components/omnibox/OmniboxAdvanced.svelte
index 867989fc..c3821740 100644
--- a/src/components/omnibox/OmniboxAdvanced.svelte
+++ b/src/components/omnibox/OmniboxAdvanced.svelte
@@ -252,7 +252,7 @@
gap: 4px;
}
.field-label {
- font-size: 12.5px;
+ font-size: var(--text-sm);
color: var(--gray);
font-weight: 500;
}
@@ -310,7 +310,7 @@
border: 1px solid var(--button-stroke);
border-radius: calc(var(--border-radius) - 2px);
padding: 6px 12px;
- font-size: 12.5px;
+ font-size: var(--text-sm);
cursor: pointer;
}
.ghost-btn.small {
diff --git a/src/components/omnibox/QualityPicker.svelte b/src/components/omnibox/QualityPicker.svelte
index ebf3facf..faa2dcc1 100644
--- a/src/components/omnibox/QualityPicker.svelte
+++ b/src/components/omnibox/QualityPicker.svelte
@@ -37,7 +37,7 @@
}
.quality-label {
- font-size: 12.5px;
+ font-size: var(--text-sm);
font-weight: 500;
color: var(--gray);
}
diff --git a/src/components/onboarding/OnboardingWizard.svelte b/src/components/onboarding/OnboardingWizard.svelte
index 16ff38c9..a72c04f7 100644
--- a/src/components/onboarding/OnboardingWizard.svelte
+++ b/src/components/onboarding/OnboardingWizard.svelte
@@ -400,13 +400,13 @@
}
.step-indicator {
- font-size: 12.5px;
+ font-size: var(--text-sm);
font-weight: 500;
color: var(--gray);
}
.skip-btn {
- font-size: 12.5px;
+ font-size: var(--text-sm);
font-weight: 500;
color: var(--gray);
background: none;
@@ -457,7 +457,7 @@
}
.step-desc {
- font-size: 14.5px;
+ font-size: var(--text-base);
font-weight: 400;
color: var(--gray);
line-height: 1.6;
@@ -486,7 +486,7 @@
.language-select {
margin-left: auto;
padding: calc(var(--padding) / 2) 28px calc(var(--padding) / 2) var(--padding);
- font-size: 14.5px;
+ font-size: var(--text-base);
font-weight: 500;
font-family: var(--font-system);
color: var(--secondary);
@@ -528,7 +528,7 @@
}
.folder-label {
- font-size: 12.5px;
+ font-size: var(--text-sm);
font-weight: 500;
color: var(--gray);
}
@@ -580,12 +580,12 @@
}
.dep-name {
- font-size: 14.5px;
+ font-size: var(--text-base);
font-weight: 500;
}
.dep-version {
- font-size: 12.5px;
+ font-size: var(--text-sm);
font-weight: 500;
}
@@ -599,7 +599,7 @@
.dep-btn {
padding: calc(var(--padding) / 2) var(--padding);
- font-size: 12.5px;
+ font-size: var(--text-sm);
flex-shrink: 0;
}
@@ -780,7 +780,7 @@
.step-rpc-note {
margin-top: calc(var(--padding) / 2);
- font-size: 12.5px;
+ font-size: var(--text-sm);
opacity: 0.8;
}
diff --git a/src/components/p2p/P2pSendDialog.svelte b/src/components/p2p/P2pSendDialog.svelte
index e64de45c..61de3d66 100644
--- a/src/components/p2p/P2pSendDialog.svelte
+++ b/src/components/p2p/P2pSendDialog.svelte
@@ -1,613 +1,613 @@
-<script lang="ts">
- import { invoke } from "@tauri-apps/api/core";
- import { listen } from "@tauri-apps/api/event";
- import { open } from "@tauri-apps/plugin-dialog";
- import { onMount } from "svelte";
- import { t } from "$lib/i18n";
- import { showToast } from "$lib/stores/toast-store.svelte";
-
- let { onClose }: { onClose: () => void } = $props();
-
- type SendState =
- | { kind: "idle" }
- | { kind: "sending"; code: string; fileName: string; fileSize: number; progress: number; status: string; sentBytes: number; speed: number; paused: boolean }
- | { kind: "complete"; code: string; fileName: string }
- | { kind: "error"; message: string };
-
- let sendState: SendState = $state({ kind: "idle" });
- let dialogEl: HTMLDialogElement | null = $state(null);
- let unlisten: (() => void) | null = null;
- let unlistenComplete: (() => void) | null = null;
-
- onMount(() => {
- dialogEl?.showModal();
-
- listen<{ code: string; progress: number; status: string; sent_bytes: number; total_bytes: number; speed_bytes_per_sec: number }>("p2p-send-progress", (event) => {
- if (sendState.kind === "sending" && sendState.code === event.payload.code) {
- sendState = {
- ...sendState,
- progress: event.payload.progress,
- status: event.payload.status,
- sentBytes: event.payload.sent_bytes,
- speed: event.payload.speed_bytes_per_sec,
- paused: event.payload.status === "paused",
- };
- }
- }).then(fn => { unlisten = fn; });
-
- listen<{ code: string; success: boolean; error?: string }>("p2p-send-complete", (event) => {
- if (sendState.kind !== "sending" || sendState.code !== event.payload.code) return;
- if (event.payload.success) {
- sendState = { kind: "complete", code: sendState.code, fileName: sendState.fileName };
- } else {
- sendState = { kind: "error", message: event.payload.error ?? $t("p2p.send_failed") };
- }
- }).then(fn => { unlistenComplete = fn; });
-
- return () => {
- unlisten?.();
- unlistenComplete?.();
- };
- });
-
- async function selectAndSend() {
- const selected = await open({
- multiple: false,
- title: $t("p2p.select_file"),
- });
- if (!selected) return;
-
- try {
- const result = await invoke<{ code: string; file_name: string; file_size: number }>("p2p_send_file", {
- filePath: selected,
- });
-
- sendState = {
- kind: "sending",
- code: result.code,
- fileName: result.file_name,
- fileSize: result.file_size,
- progress: 0,
- status: "waiting_for_receiver",
- sentBytes: 0,
- speed: 0,
- paused: false,
- };
- } catch (e: any) {
- sendState = { kind: "error", message: typeof e === "string" ? e : e.message ?? $t("p2p.send_failed") };
- }
- }
-
- async function togglePause() {
- if (sendState.kind !== "sending") return;
- try {
- if (sendState.paused) {
- await invoke("p2p_resume_send", { code: sendState.code });
- sendState = { ...sendState, paused: false };
- } else {
- await invoke("p2p_pause_send", { code: sendState.code });
- sendState = { ...sendState, paused: true };
- }
- } catch {}
- }
-
- async function cancelSend() {
- if (sendState.kind === "sending") {
- try {
- await invoke("p2p_cancel_send", { code: sendState.code });
- } catch {}
- }
- handleClose();
- }
-
- function copyCode() {
- if (sendState.kind === "sending" || sendState.kind === "complete") {
- const fullCode = `p2p:${sendState.code}`;
- navigator.clipboard.writeText(fullCode);
- showToast("info", $t("p2p.code_copied"));
- }
- }
-
- function handleClose() {
- dialogEl?.close();
- onClose();
- }
-
- function getStatusLabel(status: string): string {
- switch (status) {
- case "waiting_for_receiver": return $t("p2p.waiting_for_receiver");
- case "transferring": return $t("p2p.transferring");
- case "paused": return $t("p2p.paused");
- case "complete": return $t("p2p.transfer_complete");
- default: return status;
- }
- }
-
- function formatBytes(bytes: number): string {
- if (bytes < 1024) return `${bytes} B`;
- if (bytes < 1024 * 1024) return `${(bytes / 1024).toFixed(1)} KB`;
- if (bytes < 1024 * 1024 * 1024) return `${(bytes / (1024 * 1024)).toFixed(1)} MB`;
- return `${(bytes / (1024 * 1024 * 1024)).toFixed(2)} GB`;
- }
-
- function formatSpeed(bytesPerSec: number): string {
- if (bytesPerSec <= 0) return "0 KB/s";
- if (bytesPerSec < 1024 * 1024) return `${(bytesPerSec / 1024).toFixed(0)} KB/s`;
- return `${(bytesPerSec / (1024 * 1024)).toFixed(1)} MB/s`;
- }
-
- function formatEta(remaining: number, speed: number): string {
- if (speed <= 0 || remaining <= 0) return "";
- const secs = Math.ceil(remaining / speed);
- if (secs < 60) return `~${secs}s`;
- if (secs < 3600) return `~${Math.floor(secs / 60)}m ${secs % 60}s`;
- return `~${Math.floor(secs / 3600)}h ${Math.floor((secs % 3600) / 60)}m`;
- }
-
- function handleBackdropClick(e: MouseEvent) {
- if (e.target === dialogEl) {
- if (sendState.kind === "sending") return;
- handleClose();
- }
- }
-</script>
-
-<!-- svelte-ignore a11y_no_noninteractive_element_interactions -->
-<dialog
- bind:this={dialogEl}
- class="p2p-dialog"
- aria-labelledby="p2p-dialog-title"
- aria-modal="true"
- onclick={handleBackdropClick}
- onkeydown={(e) => { if (e.key === "Escape" && sendState.kind !== "sending") handleClose(); }}
->
- <div class="dialog-content">
- <div class="dialog-header">
- <h3 id="p2p-dialog-title">{$t("p2p.send_title")}</h3>
- {#if sendState.kind !== "sending"}
- <button class="close-btn" onclick={handleClose} aria-label={$t("common.close")}>
- <svg viewBox="0 0 24 24" width="16" height="16" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">
- <path d="M18 6L6 18M6 6l12 12" />
- </svg>
- </button>
- {/if}
- </div>
-
- {#if sendState.kind === "idle"}
- <div class="dialog-body">
- <p class="description">{$t("p2p.send_description")}</p>
- <button class="button action-btn" onclick={selectAndSend}>
- {$t("p2p.select_file")}
- </button>
- </div>
-
- {:else if sendState.kind === "sending"}
- <div class="dialog-body">
- <div class="file-info">
- <span class="file-name">{sendState.fileName}</span>
- <span class="file-size">{formatBytes(sendState.fileSize)}</span>
- </div>
-
- <div class="code-section">
- <span class="code-label">{$t("p2p.share_code")}</span>
- <button class="code-display" onclick={copyCode} title={$t("p2p.click_to_copy")}>
- {sendState.code}
- </button>
- <span class="code-hint">{$t("p2p.share_hint")}</span>
- </div>
-
- {#if sendState.status === "transferring" || sendState.status === "paused"}
- <div class="progress-section">
- <div class="progress-bar-outer">
- <div
- class="progress-bar-inner"
- class:paused-bar={sendState.paused}
- style="width: {Math.min(sendState.progress, 100)}%"
- ></div>
- </div>
- <span class="progress-text">{sendState.progress.toFixed(1)}%</span>
- </div>
- <div class="transfer-stats">
- <span>{formatBytes(sendState.sentBytes)} / {formatBytes(sendState.fileSize)}</span>
- {#if sendState.paused}
- <span class="stat-paused">{$t("p2p.paused")}</span>
- {:else}
- <span>{formatSpeed(sendState.speed)}</span>
- {#if sendState.speed > 0}
- <span>{formatEta(sendState.fileSize - sendState.sentBytes, sendState.speed)}</span>
- {/if}
- {/if}
- </div>
- <div class="send-actions">
- <button class="button pause-btn" onclick={togglePause}>
- {#if sendState.paused}
- <svg viewBox="0 0 24 24" width="14" height="14" fill="currentColor" stroke="none">
- <polygon points="6,4 20,12 6,20" />
- </svg>
- {$t("p2p.resume")}
- {:else}
- <svg viewBox="0 0 24 24" width="14" height="14" fill="currentColor" stroke="none">
- <rect x="5" y="4" width="4" height="16" rx="1" />
- <rect x="15" y="4" width="4" height="16" rx="1" />
- </svg>
- {$t("p2p.pause")}
- {/if}
- </button>
- <button class="button cancel-btn" onclick={cancelSend}>
- {$t("common.cancel")}
- </button>
- </div>
- {:else}
- <div class="status-section">
- <span class="status-spinner"></span>
- <span class="status-text">{getStatusLabel(sendState.status)}</span>
- </div>
- <button class="button cancel-btn" onclick={cancelSend}>
- {$t("common.cancel")}
- </button>
- {/if}
- </div>
-
- {:else if sendState.kind === "complete"}
- <div class="dialog-body">
- <div class="complete-section">
- <svg class="complete-icon" viewBox="0 0 24 24" width="32" height="32" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">
- <path d="M20 6L9 17l-5-5" />
- </svg>
- <span class="complete-text">{$t("p2p.transfer_complete")}</span>
- <span class="file-name">{sendState.fileName}</span>
- </div>
- <button class="button action-btn" onclick={handleClose}>
- {$t("common.close")}
- </button>
- </div>
-
- {:else if sendState.kind === "error"}
- <div class="dialog-body">
- <div class="error-section">
- <svg class="error-icon" viewBox="0 0 24 24" width="32" height="32" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">
- <circle cx="12" cy="12" r="10" />
- <path d="M12 8v4m0 4h.01" />
- </svg>
- <span class="error-text">{sendState.message}</span>
- </div>
- <div class="error-actions">
- <button class="button action-btn" onclick={selectAndSend}>
- {$t("p2p.try_again")}
- </button>
- <button class="button cancel-btn" onclick={handleClose}>
- {$t("common.close")}
- </button>
- </div>
- </div>
- {/if}
- </div>
-</dialog>
-
-<style>
- .p2p-dialog {
- border: none;
- border-radius: var(--border-radius);
- background: var(--popup-bg);
- color: var(--secondary);
- padding: 0;
- max-width: 440px;
- width: 90vw;
- }
-
- .p2p-dialog::backdrop {
- background: var(--dialog-backdrop);
- }
-
- .dialog-content {
- padding: calc(var(--padding) * 1.5);
- display: flex;
- flex-direction: column;
- gap: calc(var(--padding) * 1.5);
- }
-
- .dialog-header {
- display: flex;
- align-items: center;
- justify-content: space-between;
- }
-
- .dialog-header h3 {
- font-size: 16px;
- font-weight: 500;
- margin: 0;
- }
-
- .close-btn {
- display: flex;
- align-items: center;
- justify-content: center;
- width: 28px;
- height: 28px;
- background: transparent;
- border: none;
- border-radius: 6px;
- cursor: pointer;
- color: var(--secondary);
- padding: 0;
- }
-
- @media (hover: hover) {
- .close-btn:hover {
- background: var(--button);
- }
- }
-
- .dialog-body {
- display: flex;
- flex-direction: column;
- gap: var(--padding);
- }
-
- .description {
- font-size: 13px;
- color: var(--gray);
- margin: 0;
- line-height: 1.5;
- }
-
- .file-info {
- display: flex;
- align-items: center;
- justify-content: space-between;
- padding: calc(var(--padding) / 2) var(--padding);
- background: var(--button);
- border-radius: calc(var(--border-radius) - 2px);
- }
-
- .file-name {
- font-size: 13px;
- font-weight: 500;
- overflow: hidden;
- text-overflow: ellipsis;
- white-space: nowrap;
- min-width: 0;
- }
-
- .file-size {
- font-size: 12px;
- color: var(--gray);
- flex-shrink: 0;
- margin-left: var(--padding);
- }
-
- .code-section {
- display: flex;
- flex-direction: column;
- align-items: center;
- gap: 6px;
- padding: var(--padding);
- background: var(--button-elevated);
- border-radius: var(--border-radius);
- }
-
- .code-label {
- font-size: 11.5px;
- font-weight: 500;
- color: var(--gray);
- text-transform: uppercase;
- letter-spacing: 0.5px;
- }
-
- .code-display {
- font-size: 20px;
- font-weight: 500;
- font-family: var(--font-mono);
- color: var(--accent);
- background: transparent;
- border: none;
- cursor: pointer;
- padding: 4px 8px;
- border-radius: 6px;
- letter-spacing: 1px;
- }
-
- @media (hover: hover) {
- .code-display:hover {
- background: var(--button);
- }
- }
-
- .code-hint {
- font-size: 11.5px;
- color: var(--gray);
- }
-
- .progress-section {
- display: flex;
- align-items: center;
- gap: var(--padding);
- }
-
- .progress-bar-outer {
- flex: 1;
- height: 6px;
- background: var(--button-elevated);
- border-radius: 3px;
- overflow: hidden;
- }
-
- .progress-bar-inner {
- height: 100%;
- background: var(--green);
- border-radius: 3px;
- transition: width 0.3s ease;
- }
-
- .paused-bar {
- background: var(--gray);
- }
-
- .progress-text {
- font-size: 12px;
- font-weight: 500;
- color: var(--secondary);
- min-width: 40px;
- text-align: right;
- }
-
- .transfer-stats {
- display: flex;
- align-items: center;
- justify-content: center;
- gap: 12px;
- font-size: 11.5px;
- color: var(--gray);
- }
-
- .stat-paused {
- color: var(--orange);
- font-weight: 500;
- }
-
- .send-actions {
- display: flex;
- gap: calc(var(--padding) / 2);
- }
-
- .pause-btn {
- flex: 1;
- display: flex;
- align-items: center;
- justify-content: center;
- gap: 6px;
- padding: calc(var(--padding) / 2) var(--padding);
- font-size: 13px;
- font-weight: 500;
- background: var(--button);
- border: 1px solid var(--input-border);
- border-radius: var(--border-radius);
- color: var(--secondary);
- cursor: pointer;
- }
-
- @media (hover: hover) {
- .pause-btn:hover {
- background: var(--button-hover);
- }
- }
-
- .status-section {
- display: flex;
- align-items: center;
- justify-content: center;
- gap: calc(var(--padding) / 2);
- padding: calc(var(--padding) / 2) 0;
- }
-
- .status-spinner {
- width: 14px;
- height: 14px;
- border: 2px solid var(--input-border);
- border-top-color: var(--secondary);
- border-radius: 50%;
- animation: spin 0.8s linear infinite;
- }
-
- @keyframes spin {
- to { transform: rotate(360deg); }
- }
-
- .status-text {
- font-size: 12.5px;
- color: var(--gray);
- }
-
- .complete-section {
- display: flex;
- flex-direction: column;
- align-items: center;
- gap: 8px;
- padding: var(--padding) 0;
- }
-
- .complete-icon {
- color: var(--green);
- }
-
- .complete-text {
- font-size: 14px;
- font-weight: 500;
- }
-
- .error-section {
- display: flex;
- flex-direction: column;
- align-items: center;
- gap: 8px;
- padding: var(--padding) 0;
- }
-
- .error-icon {
- color: var(--red);
- }
-
- .error-text {
- font-size: 13px;
- color: var(--gray);
- text-align: center;
- }
-
- .error-actions {
- display: flex;
- gap: calc(var(--padding) / 2);
- }
-
- .action-btn {
- width: 100%;
- display: flex;
- align-items: center;
- justify-content: center;
- padding: var(--padding);
- font-size: 14px;
- font-weight: 500;
- background: var(--button);
- border: none;
- border-radius: var(--border-radius);
- color: var(--button-text);
- cursor: pointer;
- box-shadow: var(--button-box-shadow);
- }
-
- @media (hover: hover) {
- .action-btn:hover {
- background: var(--button-hover);
- }
- }
-
- .cancel-btn {
- flex: 1;
- display: flex;
- align-items: center;
- justify-content: center;
- padding: calc(var(--padding) / 2) var(--padding);
- font-size: 13px;
- font-weight: 500;
- background: transparent;
- border: 1px solid var(--input-border);
- border-radius: var(--border-radius);
- color: var(--gray);
- cursor: pointer;
- }
-
- @media (hover: hover) {
- .cancel-btn:hover {
- background: var(--button);
- color: var(--secondary);
- }
- }
-
- @media (prefers-reduced-motion: reduce) {
- .status-spinner {
- animation-duration: 1.5s;
- }
- .progress-bar-inner {
- transition: none;
- }
- }
-</style>
+<script lang="ts">
+ import { invoke } from "@tauri-apps/api/core";
+ import { listen } from "@tauri-apps/api/event";
+ import { open } from "@tauri-apps/plugin-dialog";
+ import { onMount } from "svelte";
+ import { t } from "$lib/i18n";
+ import { showToast } from "$lib/stores/toast-store.svelte";
+
+ let { onClose }: { onClose: () => void } = $props();
+
+ type SendState =
+ | { kind: "idle" }
+ | { kind: "sending"; code: string; fileName: string; fileSize: number; progress: number; status: string; sentBytes: number; speed: number; paused: boolean }
+ | { kind: "complete"; code: string; fileName: string }
+ | { kind: "error"; message: string };
+
+ let sendState: SendState = $state({ kind: "idle" });
+ let dialogEl: HTMLDialogElement | null = $state(null);
+ let unlisten: (() => void) | null = null;
+ let unlistenComplete: (() => void) | null = null;
+
+ onMount(() => {
+ dialogEl?.showModal();
+
+ listen<{ code: string; progress: number; status: string; sent_bytes: number; total_bytes: number; speed_bytes_per_sec: number }>("p2p-send-progress", (event) => {
+ if (sendState.kind === "sending" && sendState.code === event.payload.code) {
+ sendState = {
+ ...sendState,
+ progress: event.payload.progress,
+ status: event.payload.status,
+ sentBytes: event.payload.sent_bytes,
+ speed: event.payload.speed_bytes_per_sec,
+ paused: event.payload.status === "paused",
+ };
+ }
+ }).then(fn => { unlisten = fn; });
+
+ listen<{ code: string; success: boolean; error?: string }>("p2p-send-complete", (event) => {
+ if (sendState.kind !== "sending" || sendState.code !== event.payload.code) return;
+ if (event.payload.success) {
+ sendState = { kind: "complete", code: sendState.code, fileName: sendState.fileName };
+ } else {
+ sendState = { kind: "error", message: event.payload.error ?? $t("p2p.send_failed") };
+ }
+ }).then(fn => { unlistenComplete = fn; });
+
+ return () => {
+ unlisten?.();
+ unlistenComplete?.();
+ };
+ });
+
+ async function selectAndSend() {
+ const selected = await open({
+ multiple: false,
+ title: $t("p2p.select_file"),
+ });
+ if (!selected) return;
+
+ try {
+ const result = await invoke<{ code: string; file_name: string; file_size: number }>("p2p_send_file", {
+ filePath: selected,
+ });
+
+ sendState = {
+ kind: "sending",
+ code: result.code,
+ fileName: result.file_name,
+ fileSize: result.file_size,
+ progress: 0,
+ status: "waiting_for_receiver",
+ sentBytes: 0,
+ speed: 0,
+ paused: false,
+ };
+ } catch (e: any) {
+ sendState = { kind: "error", message: typeof e === "string" ? e : e.message ?? $t("p2p.send_failed") };
+ }
+ }
+
+ async function togglePause() {
+ if (sendState.kind !== "sending") return;
+ try {
+ if (sendState.paused) {
+ await invoke("p2p_resume_send", { code: sendState.code });
+ sendState = { ...sendState, paused: false };
+ } else {
+ await invoke("p2p_pause_send", { code: sendState.code });
+ sendState = { ...sendState, paused: true };
+ }
+ } catch {}
+ }
+
+ async function cancelSend() {
+ if (sendState.kind === "sending") {
+ try {
+ await invoke("p2p_cancel_send", { code: sendState.code });
+ } catch {}
+ }
+ handleClose();
+ }
+
+ function copyCode() {
+ if (sendState.kind === "sending" || sendState.kind === "complete") {
+ const fullCode = `p2p:${sendState.code}`;
+ navigator.clipboard.writeText(fullCode);
+ showToast("info", $t("p2p.code_copied"));
+ }
+ }
+
+ function handleClose() {
+ dialogEl?.close();
+ onClose();
+ }
+
+ function getStatusLabel(status: string): string {
+ switch (status) {
+ case "waiting_for_receiver": return $t("p2p.waiting_for_receiver");
+ case "transferring": return $t("p2p.transferring");
+ case "paused": return $t("p2p.paused");
+ case "complete": return $t("p2p.transfer_complete");
+ default: return status;
+ }
+ }
+
+ function formatBytes(bytes: number): string {
+ if (bytes < 1024) return `${bytes} B`;
+ if (bytes < 1024 * 1024) return `${(bytes / 1024).toFixed(1)} KB`;
+ if (bytes < 1024 * 1024 * 1024) return `${(bytes / (1024 * 1024)).toFixed(1)} MB`;
+ return `${(bytes / (1024 * 1024 * 1024)).toFixed(2)} GB`;
+ }
+
+ function formatSpeed(bytesPerSec: number): string {
+ if (bytesPerSec <= 0) return "0 KB/s";
+ if (bytesPerSec < 1024 * 1024) return `${(bytesPerSec / 1024).toFixed(0)} KB/s`;
+ return `${(bytesPerSec / (1024 * 1024)).toFixed(1)} MB/s`;
+ }
+
+ function formatEta(remaining: number, speed: number): string {
+ if (speed <= 0 || remaining <= 0) return "";
+ const secs = Math.ceil(remaining / speed);
+ if (secs < 60) return `~${secs}s`;
+ if (secs < 3600) return `~${Math.floor(secs / 60)}m ${secs % 60}s`;
+ return `~${Math.floor(secs / 3600)}h ${Math.floor((secs % 3600) / 60)}m`;
+ }
+
+ function handleBackdropClick(e: MouseEvent) {
+ if (e.target === dialogEl) {
+ if (sendState.kind === "sending") return;
+ handleClose();
+ }
+ }
+</script>
+
+<!-- svelte-ignore a11y_no_noninteractive_element_interactions -->
+<dialog
+ bind:this={dialogEl}
+ class="p2p-dialog"
+ aria-labelledby="p2p-dialog-title"
+ aria-modal="true"
+ onclick={handleBackdropClick}
+ onkeydown={(e) => { if (e.key === "Escape" && sendState.kind !== "sending") handleClose(); }}
+>
+ <div class="dialog-content">
+ <div class="dialog-header">
+ <h3 id="p2p-dialog-title">{$t("p2p.send_title")}</h3>
+ {#if sendState.kind !== "sending"}
+ <button class="close-btn" onclick={handleClose} aria-label={$t("common.close")}>
+ <svg viewBox="0 0 24 24" width="16" height="16" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">
+ <path d="M18 6L6 18M6 6l12 12" />
+ </svg>
+ </button>
+ {/if}
+ </div>
+
+ {#if sendState.kind === "idle"}
+ <div class="dialog-body">
+ <p class="description">{$t("p2p.send_description")}</p>
+ <button class="button action-btn" onclick={selectAndSend}>
+ {$t("p2p.select_file")}
+ </button>
+ </div>
+
+ {:else if sendState.kind === "sending"}
+ <div class="dialog-body">
+ <div class="file-info">
+ <span class="file-name">{sendState.fileName}</span>
+ <span class="file-size">{formatBytes(sendState.fileSize)}</span>
+ </div>
+
+ <div class="code-section">
+ <span class="code-label">{$t("p2p.share_code")}</span>
+ <button class="code-display" onclick={copyCode} title={$t("p2p.click_to_copy")}>
+ {sendState.code}
+ </button>
+ <span class="code-hint">{$t("p2p.share_hint")}</span>
+ </div>
+
+ {#if sendState.status === "transferring" || sendState.status === "paused"}
+ <div class="progress-section">
+ <div class="progress-bar-outer">
+ <div
+ class="progress-bar-inner"
+ class:paused-bar={sendState.paused}
+ style="width: {Math.min(sendState.progress, 100)}%"
+ ></div>
+ </div>
+ <span class="progress-text">{sendState.progress.toFixed(1)}%</span>
+ </div>
+ <div class="transfer-stats">
+ <span>{formatBytes(sendState.sentBytes)} / {formatBytes(sendState.fileSize)}</span>
+ {#if sendState.paused}
+ <span class="stat-paused">{$t("p2p.paused")}</span>
+ {:else}
+ <span>{formatSpeed(sendState.speed)}</span>
+ {#if sendState.speed > 0}
+ <span>{formatEta(sendState.fileSize - sendState.sentBytes, sendState.speed)}</span>
+ {/if}
+ {/if}
+ </div>
+ <div class="send-actions">
+ <button class="button pause-btn" onclick={togglePause}>
+ {#if sendState.paused}
+ <svg viewBox="0 0 24 24" width="14" height="14" fill="currentColor" stroke="none">
+ <polygon points="6,4 20,12 6,20" />
+ </svg>
+ {$t("p2p.resume")}
+ {:else}
+ <svg viewBox="0 0 24 24" width="14" height="14" fill="currentColor" stroke="none">
+ <rect x="5" y="4" width="4" height="16" rx="1" />
+ <rect x="15" y="4" width="4" height="16" rx="1" />
+ </svg>
+ {$t("p2p.pause")}
+ {/if}
+ </button>
+ <button class="button cancel-btn" onclick={cancelSend}>
+ {$t("common.cancel")}
+ </button>
+ </div>
+ {:else}
+ <div class="status-section">
+ <span class="status-spinner"></span>
+ <span class="status-text">{getStatusLabel(sendState.status)}</span>
+ </div>
+ <button class="button cancel-btn" onclick={cancelSend}>
+ {$t("common.cancel")}
+ </button>
+ {/if}
+ </div>
+
+ {:else if sendState.kind === "complete"}
+ <div class="dialog-body">
+ <div class="complete-section">
+ <svg class="complete-icon" viewBox="0 0 24 24" width="32" height="32" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">
+ <path d="M20 6L9 17l-5-5" />
+ </svg>
+ <span class="complete-text">{$t("p2p.transfer_complete")}</span>
+ <span class="file-name">{sendState.fileName}</span>
+ </div>
+ <button class="button action-btn" onclick={handleClose}>
+ {$t("common.close")}
+ </button>
+ </div>
+
+ {:else if sendState.kind === "error"}
+ <div class="dialog-body">
+ <div class="error-section">
+ <svg class="error-icon" viewBox="0 0 24 24" width="32" height="32" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">
+ <circle cx="12" cy="12" r="10" />
+ <path d="M12 8v4m0 4h.01" />
+ </svg>
+ <span class="error-text">{sendState.message}</span>
+ </div>
+ <div class="error-actions">
+ <button class="button action-btn" onclick={selectAndSend}>
+ {$t("p2p.try_again")}
+ </button>
+ <button class="button cancel-btn" onclick={handleClose}>
+ {$t("common.close")}
+ </button>
+ </div>
+ </div>
+ {/if}
+ </div>
+</dialog>
+
+<style>
+ .p2p-dialog {
+ border: none;
+ border-radius: var(--border-radius);
+ background: var(--popup-bg);
+ color: var(--secondary);
+ padding: 0;
+ max-width: 440px;
+ width: 90vw;
+ }
+
+ .p2p-dialog::backdrop {
+ background: var(--dialog-backdrop);
+ }
+
+ .dialog-content {
+ padding: calc(var(--padding) * 1.5);
+ display: flex;
+ flex-direction: column;
+ gap: calc(var(--padding) * 1.5);
+ }
+
+ .dialog-header {
+ display: flex;
+ align-items: center;
+ justify-content: space-between;
+ }
+
+ .dialog-header h3 {
+ font-size: 16px;
+ font-weight: 500;
+ margin: 0;
+ }
+
+ .close-btn {
+ display: flex;
+ align-items: center;
+ justify-content: center;
+ width: 28px;
+ height: 28px;
+ background: transparent;
+ border: none;
+ border-radius: 6px;
+ cursor: pointer;
+ color: var(--secondary);
+ padding: 0;
+ }
+
+ @media (hover: hover) {
+ .close-btn:hover {
+ background: var(--button);
+ }
+ }
+
+ .dialog-body {
+ display: flex;
+ flex-direction: column;
+ gap: var(--padding);
+ }
+
+ .description {
+ font-size: 13px;
+ color: var(--gray);
+ margin: 0;
+ line-height: 1.5;
+ }
+
+ .file-info {
+ display: flex;
+ align-items: center;
+ justify-content: space-between;
+ padding: calc(var(--padding) / 2) var(--padding);
+ background: var(--button);
+ border-radius: calc(var(--border-radius) - 2px);
+ }
+
+ .file-name {
+ font-size: 13px;
+ font-weight: 500;
+ overflow: hidden;
+ text-overflow: ellipsis;
+ white-space: nowrap;
+ min-width: 0;
+ }
+
+ .file-size {
+ font-size: 12px;
+ color: var(--gray);
+ flex-shrink: 0;
+ margin-left: var(--padding);
+ }
+
+ .code-section {
+ display: flex;
+ flex-direction: column;
+ align-items: center;
+ gap: 6px;
+ padding: var(--padding);
+ background: var(--button-elevated);
+ border-radius: var(--border-radius);
+ }
+
+ .code-label {
+ font-size: 11.5px;
+ font-weight: 500;
+ color: var(--gray);
+ text-transform: uppercase;
+ letter-spacing: 0.5px;
+ }
+
+ .code-display {
+ font-size: 20px;
+ font-weight: 500;
+ font-family: var(--font-mono);
+ color: var(--accent);
+ background: transparent;
+ border: none;
+ cursor: pointer;
+ padding: 4px 8px;
+ border-radius: 6px;
+ letter-spacing: 1px;
+ }
+
+ @media (hover: hover) {
+ .code-display:hover {
+ background: var(--button);
+ }
+ }
+
+ .code-hint {
+ font-size: 11.5px;
+ color: var(--gray);
+ }
+
+ .progress-section {
+ display: flex;
+ align-items: center;
+ gap: var(--padding);
+ }
+
+ .progress-bar-outer {
+ flex: 1;
+ height: 6px;
+ background: var(--button-elevated);
+ border-radius: 3px;
+ overflow: hidden;
+ }
+
+ .progress-bar-inner {
+ height: 100%;
+ background: var(--green);
+ border-radius: 3px;
+ transition: width 0.3s ease;
+ }
+
+ .paused-bar {
+ background: var(--gray);
+ }
+
+ .progress-text {
+ font-size: 12px;
+ font-weight: 500;
+ color: var(--secondary);
+ min-width: 40px;
+ text-align: right;
+ }
+
+ .transfer-stats {
+ display: flex;
+ align-items: center;
+ justify-content: center;
+ gap: 12px;
+ font-size: 11.5px;
+ color: var(--gray);
+ }
+
+ .stat-paused {
+ color: var(--orange);
+ font-weight: 500;
+ }
+
+ .send-actions {
+ display: flex;
+ gap: calc(var(--padding) / 2);
+ }
+
+ .pause-btn {
+ flex: 1;
+ display: flex;
+ align-items: center;
+ justify-content: center;
+ gap: 6px;
+ padding: calc(var(--padding) / 2) var(--padding);
+ font-size: 13px;
+ font-weight: 500;
+ background: var(--button);
+ border: 1px solid var(--input-border);
+ border-radius: var(--border-radius);
+ color: var(--secondary);
+ cursor: pointer;
+ }
+
+ @media (hover: hover) {
+ .pause-btn:hover {
+ background: var(--button-hover);
+ }
+ }
+
+ .status-section {
+ display: flex;
+ align-items: center;
+ justify-content: center;
+ gap: calc(var(--padding) / 2);
+ padding: calc(var(--padding) / 2) 0;
+ }
+
+ .status-spinner {
+ width: 14px;
+ height: 14px;
+ border: 2px solid var(--input-border);
+ border-top-color: var(--secondary);
+ border-radius: 50%;
+ animation: spin 0.8s linear infinite;
+ }
+
+ @keyframes spin {
+ to { transform: rotate(360deg); }
+ }
+
+ .status-text {
+ font-size: var(--text-sm);
+ color: var(--gray);
+ }
+
+ .complete-section {
+ display: flex;
+ flex-direction: column;
+ align-items: center;
+ gap: 8px;
+ padding: var(--padding) 0;
+ }
+
+ .complete-icon {
+ color: var(--green);
+ }
+
+ .complete-text {
+ font-size: 14px;
+ font-weight: 500;
+ }
+
+ .error-section {
+ display: flex;
+ flex-direction: column;
+ align-items: center;
+ gap: 8px;
+ padding: var(--padding) 0;
+ }
+
+ .error-icon {
+ color: var(--red);
+ }
+
+ .error-text {
+ font-size: 13px;
+ color: var(--gray);
+ text-align: center;
+ }
+
+ .error-actions {
+ display: flex;
+ gap: calc(var(--padding) / 2);
+ }
+
+ .action-btn {
+ width: 100%;
+ display: flex;
+ align-items: center;
+ justify-content: center;
+ padding: var(--padding);
+ font-size: 14px;
+ font-weight: 500;
+ background: var(--button);
+ border: none;
+ border-radius: var(--border-radius);
+ color: var(--button-text);
+ cursor: pointer;
+ box-shadow: var(--button-box-shadow);
+ }
+
+ @media (hover: hover) {
+ .action-btn:hover {
+ background: var(--button-hover);
+ }
+ }
+
+ .cancel-btn {
+ flex: 1;
+ display: flex;
+ align-items: center;
+ justify-content: center;
+ padding: calc(var(--padding) / 2) var(--padding);
+ font-size: 13px;
+ font-weight: 500;
+ background: transparent;
+ border: 1px solid var(--input-border);
+ border-radius: var(--border-radius);
+ color: var(--gray);
+ cursor: pointer;
+ }
+
+ @media (hover: hover) {
+ .cancel-btn:hover {
+ background: var(--button);
+ color: var(--secondary);
+ }
+ }
+
+ @media (prefers-reduced-motion: reduce) {
+ .status-spinner {
+ animation-duration: 1.5s;
+ }
+ .progress-bar-inner {
+ transition: none;
+ }
+ }
+</style>
diff --git a/src/components/services/SupportedServices.svelte b/src/components/services/SupportedServices.svelte
index 5deb857f..3bbf5382 100644
--- a/src/components/services/SupportedServices.svelte
+++ b/src/components/services/SupportedServices.svelte
@@ -140,7 +140,7 @@
background: var(--button-elevated);
border-radius: calc(var(--border-radius) / 2);
padding: 4px 8px;
- font-size: 12.5px;
+ font-size: var(--text-sm);
font-weight: 500;
color: var(--secondary);
user-select: none;
diff --git a/src/components/settings/RichPresencePanel.svelte b/src/components/settings/RichPresencePanel.svelte
index 0a0b693d..5bf6673b 100644
--- a/src/components/settings/RichPresencePanel.svelte
+++ b/src/components/settings/RichPresencePanel.svelte
@@ -158,7 +158,7 @@
border-radius: calc(var(--border-radius) / 2);
color: var(--text);
font-family: ui-monospace, monospace;
- font-size: 12.5px;
+ font-size: var(--text-sm);
outline: none;
}
.rpc-input:focus-visible {
diff --git a/src/lib/style/settings.css b/src/lib/style/settings.css
index 8345fe98..bf1ae963 100644
--- a/src/lib/style/settings.css
+++ b/src/lib/style/settings.css
@@ -139,7 +139,7 @@
}
.settings-section-hint {
- font-size: 12.5px;
+ font-size: var(--text-sm);
font-weight: 500;
color: var(--text-dim, var(--gray));
margin: 0 0 var(--space-2) 0;
@@ -147,7 +147,7 @@
}
.platform-subhead {
- font-size: 13px;
+ font-size: var(--text-base);
font-weight: 600;
color: var(--text);
margin: var(--space-3) 0 var(--space-2) 0;
@@ -422,13 +422,13 @@
}
.settings-drill-item-title {
- font-size: 14.5px;
+ font-size: var(--text-base);
font-weight: 600;
color: var(--text);
}
.settings-drill-item-hint {
- font-size: 12.5px;
+ font-size: var(--text-sm);
font-weight: 500;
color: var(--text-dim, var(--gray));
line-height: 1.35;
@@ -458,7 +458,7 @@
border: none;
background: transparent;
color: var(--accent);
- font-size: 13px;
+ font-size: var(--text-base);
font-weight: 500;
cursor: pointer;
border-radius: var(--radius-sm);
@@ -489,7 +489,7 @@
}
.settings-subsection-head {
- font-size: 13px;
+ font-size: var(--text-base);
font-weight: 600;
color: var(--text);
margin: var(--space-3) 0 var(--space-2) 0;
@@ -509,7 +509,7 @@
.deps-table {
width: 100%;
border-collapse: collapse;
- font-size: 13px;
+ font-size: var(--text-base);
}
.deps-table thead {
@@ -519,7 +519,7 @@
.deps-table th {
padding: 8px 12px;
text-align: left;
- font-size: 11px;
+ font-size: var(--text-xs);
font-weight: 600;
letter-spacing: 0.03em;
text-transform: uppercase;
@@ -559,7 +559,7 @@
.card {
background: var(--surface);
- box-shadow: var(--elev-1);
+ border: 1px solid var(--border);
border-radius: var(--radius-md);
padding: 0 var(--space-4);
}
@@ -582,13 +582,13 @@
}
.setting-label {
- font-size: 14.5px;
+ font-size: var(--text-base);
font-weight: 500;
color: var(--secondary);
}
.setting-path {
- font-size: 12.5px;
+ font-size: var(--text-sm);
font-weight: 500;
color: var(--gray);
overflow: hidden;
@@ -603,7 +603,7 @@
.select {
padding: calc(var(--padding) / 2) 28px calc(var(--padding) / 2) var(--padding);
- font-size: 14.5px;
+ font-size: var(--text-base);
font-weight: 500;
background: var(--button-elevated);
border-radius: calc(var(--border-radius) / 2);
@@ -626,7 +626,7 @@
.input-number {
width: 72px;
padding: calc(var(--padding) / 2);
- font-size: 14.5px;
+ font-size: var(--text-base);
font-weight: 500;
text-align: center;
background: var(--button-elevated);
@@ -644,7 +644,7 @@
.input-hotkey {
width: 180px;
padding: calc(var(--padding) / 2);
- font-size: 12.5px;
+ font-size: var(--text-sm);
font-weight: 500;
background: var(--button-elevated);
border-radius: calc(var(--border-radius) / 2);
@@ -729,7 +729,7 @@
.input-template {
width: 100%;
padding: calc(var(--padding) / 2);
- font-size: 12.5px;
+ font-size: var(--text-sm);
font-weight: 500;
background: var(--button-elevated);
border-radius: calc(var(--border-radius) / 2);
@@ -797,7 +797,7 @@
.reset-btn {
padding: calc(var(--padding) / 2) var(--padding);
- font-size: 12.5px;
+ font-size: var(--text-sm);
color: var(--red);
}
@@ -812,7 +812,7 @@
}
.update-text {
- font-size: 14.5px;
+ font-size: var(--text-base);
font-weight: 500;
color: #fff;
}
@@ -823,7 +823,7 @@
justify-content: center;
gap: calc(var(--padding) / 2);
padding: calc(var(--padding) / 2) var(--padding);
- font-size: 12.5px;
+ font-size: var(--text-sm);
font-weight: 500;
background: #fff;
color: var(--blue);
@@ -868,7 +868,7 @@
.dep-btn {
padding: calc(var(--padding) / 2) var(--padding);
- font-size: 12.5px;
+ font-size: var(--text-sm);
flex-shrink: 0;
}
@@ -887,7 +887,7 @@
min-width: 120px;
max-width: 200px;
padding: calc(var(--padding) / 2);
- font-size: 13px;
+ font-size: var(--text-base);
font-weight: 500;
background: var(--button-elevated);
border-radius: calc(var(--border-radius) / 2);
@@ -931,7 +931,7 @@
.flag-value-input {
width: 70px;
padding: 2px 6px;
- font-size: 11px;
+ font-size: var(--text-xs);
background: var(--button-elevated);
color: var(--secondary);
border: 1px solid var(--input-border);
@@ -997,7 +997,7 @@
margin: 0 var(--padding) var(--padding);
padding: 8px 12px;
text-align: left;
- font-size: 13px;
+ font-size: var(--text-base);
font-weight: 500;
color: var(--accent);
background: transparent;
@@ -1111,7 +1111,7 @@
}
.theme-name {
- font-size: 11px;
+ font-size: var(--text-xs);
color: var(--tertiary);
text-align: center;
}
diff --git a/src/routes/+layout.svelte b/src/routes/+layout.svelte
index cecee196..cadd1f4a 100644
--- a/src/routes/+layout.svelte
+++ b/src/routes/+layout.svelte
@@ -401,7 +401,7 @@
color: color-mix(in srgb, var(--warning) 82%, var(--text));
border: 1px solid color-mix(in srgb, var(--warning) 34%, var(--border));
border-radius: var(--border-radius);
- font-size: 12.5px;
+ font-size: var(--text-sm);
font-weight: 500;
}
diff --git a/src/routes/+page.svelte b/src/routes/+page.svelte
index 75c04a0d..98612cd3 100644
--- a/src/routes/+page.svelte
+++ b/src/routes/+page.svelte
@@ -1228,7 +1228,7 @@
.study-maintenance-text strong {
font-weight: 500;
- font-size: 12.5px;
+ font-size: var(--text-sm);
color: var(--text);
}
@@ -1363,7 +1363,7 @@
}
.feedback-text {
- font-size: 12.5px;
+ font-size: var(--text-sm);
font-weight: 500;
}
@@ -1455,7 +1455,7 @@
}
.playlist-count {
- font-size: 12.5px;
+ font-size: var(--text-sm);
font-weight: 500;
color: var(--secondary);
}
@@ -1483,7 +1483,7 @@
display: flex;
align-items: center;
gap: 6px;
- font-size: 12.5px;
+ font-size: var(--text-sm);
color: var(--gray);
}
@@ -1540,7 +1540,7 @@
}
.options-toggle {
- font-size: 12.5px;
+ font-size: var(--text-sm);
font-weight: 500;
color: var(--gray);
cursor: pointer;
@@ -1579,7 +1579,7 @@
}
.referer-label {
- font-size: 12.5px;
+ font-size: var(--text-sm);
font-weight: 500;
color: var(--gray);
}
@@ -1609,7 +1609,7 @@
}
.timerange-label {
- font-size: 12.5px;
+ font-size: var(--text-sm);
font-weight: 500;
color: var(--gray);
}
@@ -1721,7 +1721,7 @@
justify-content: center;
gap: 6px;
padding: var(--padding) calc(var(--padding) * 2);
- font-size: 14.5px;
+ font-size: var(--text-base);
font-weight: 500;
background: var(--button);
border: none;
diff --git a/src/routes/about/changelog/+page.svelte b/src/routes/about/changelog/+page.svelte
index 8b601b9f..5dc18aba 100644
--- a/src/routes/about/changelog/+page.svelte
+++ b/src/routes/about/changelog/+page.svelte
@@ -1,227 +1,227 @@
-<script lang="ts">
- import { onMount } from "svelte";
- import { t } from "$lib/i18n";
- import {
- getChangelogBody,
- getCurrentVersion,
- fetchChangelog,
- } from "$lib/stores/changelog-store.svelte";
-
- let body = $derived(getChangelogBody());
- let version = $derived(getCurrentVersion());
- let loading = $state(true);
-
- onMount(async () => {
- await fetchChangelog();
- loading = false;
- });
-
- function renderMarkdown(md: string): string {
- return md
- .split("\n")
- .map((line) => {
- if (line.startsWith("### ")) {
- return `<h4>${escapeHtml(line.slice(4))}</h4>`;
- }
- if (line.startsWith("## ")) {
- return `<h3>${escapeHtml(line.slice(3))}</h3>`;
- }
- if (line.startsWith("# ")) {
- return `<h2>${escapeHtml(line.slice(2))}</h2>`;
- }
- if (line.startsWith("- ") || line.startsWith("* ")) {
- return `<li>${formatInline(line.slice(2))}</li>`;
- }
- if (line.trim() === "") {
- return "<br />";
- }
- return `<p>${formatInline(line)}</p>`;
- })
- .join("");
- }
-
- function escapeHtml(str: string): string {
- return str
- .replace(/&/g, "&amp;")
- .replace(/</g, "&lt;")
- .replace(/>/g, "&gt;")
- .replace(/"/g, "&quot;");
- }
-
- function formatInline(str: string): string {
- let result = escapeHtml(str);
- result = result.replace(/\*\*(.+?)\*\*/g, "<strong>$1</strong>");
- result = result.replace(/`(.+?)`/g, "<code>$1</code>");
- result = result.replace(
- /\[(.+?)\]\((.+?)\)/g,
- '<a href="$2" target="_blank" rel="noopener">$1</a>'
- );
- return result;
- }
-</script>
-
-<div class="changelog-page">
- {#if version}
- <div class="version-row">
- <span class="version-label">{$t("about.version")}</span>
- <span class="version-value">{version}</span>
- </div>
- {/if}
-
- {#if loading}
- <div class="loading">
- <span class="spinner"></span>
- </div>
- {:else if body}
- <div class="card">
- <div class="markdown-content">
- {@html renderMarkdown(body)}
- </div>
- </div>
- {:else}
- <div class="card empty-card">
- <p class="empty-text">{$t("changelog.empty")}</p>
- </div>
- {/if}
-</div>
-
-<style>
- .changelog-page {
- display: flex;
- flex-direction: column;
- gap: calc(var(--padding) * 1.5);
- }
-
- .version-row {
- display: flex;
- align-items: center;
- justify-content: center;
- gap: calc(var(--padding) / 2);
- }
-
- .version-label {
- font-size: 12.5px;
- font-weight: 500;
- color: var(--gray);
- }
-
- .version-value {
- font-size: 12.5px;
- font-weight: 500;
- color: var(--blue);
- }
-
- .loading {
- display: flex;
- align-items: center;
- justify-content: center;
- padding: calc(var(--padding) * 3) 0;
- }
-
- .spinner {
- width: 24px;
- height: 24px;
- border: 2px solid var(--input-border);
- border-top-color: var(--blue);
- border-radius: 50%;
- animation: spin 0.6s linear infinite;
- }
-
- @keyframes spin {
- to {
- transform: rotate(360deg);
- }
- }
-
- .card {
- width: 100%;
- background: var(--button);
- box-shadow: var(--button-box-shadow);
- border-radius: var(--border-radius);
- padding: calc(var(--padding) + 4px);
- }
-
- .empty-card {
- display: flex;
- align-items: center;
- justify-content: center;
- padding: calc(var(--padding) * 2);
- }
-
- .empty-text {
- font-size: 14.5px;
- font-weight: 500;
- color: var(--gray);
- }
-
- .markdown-content {
- font-size: 13px;
- font-weight: 400;
- line-height: 1.7;
- color: var(--secondary);
- }
-
- .markdown-content :global(h2) {
- font-size: 18px;
- font-weight: 500;
- margin: 0 0 calc(var(--padding) / 2);
- letter-spacing: -0.5px;
- }
-
- .markdown-content :global(h3) {
- font-size: 15px;
- font-weight: 500;
- margin: var(--padding) 0 calc(var(--padding) / 2);
- }
-
- .markdown-content :global(h4) {
- font-size: 13px;
- font-weight: 500;
- margin: var(--padding) 0 calc(var(--padding) / 4);
- color: var(--gray);
- }
-
- .markdown-content :global(p) {
- margin: 0 0 4px;
- }
-
- .markdown-content :global(li) {
- margin: 0 0 4px;
- padding-left: calc(var(--padding) / 2);
- list-style: none;
- }
-
- .markdown-content :global(li::before) {
- content: "•";
- color: var(--blue);
- margin-right: 6px;
- }
-
- .markdown-content :global(strong) {
- font-weight: 600;
- }
-
- .markdown-content :global(code) {
- font-size: 12px;
- padding: 1px 5px;
- background: var(--button-elevated);
- border-radius: 4px;
- }
-
- .markdown-content :global(a) {
- color: var(--blue);
- text-decoration: none;
- }
-
- @media (hover: hover) {
- .markdown-content :global(a:hover) {
- text-decoration: underline;
- }
- }
-
- .markdown-content :global(br) {
- display: block;
- content: "";
- margin-top: 4px;
- }
-</style>
+<script lang="ts">
+ import { onMount } from "svelte";
+ import { t } from "$lib/i18n";
+ import {
+ getChangelogBody,
+ getCurrentVersion,
+ fetchChangelog,
+ } from "$lib/stores/changelog-store.svelte";
+
+ let body = $derived(getChangelogBody());
+ let version = $derived(getCurrentVersion());
+ let loading = $state(true);
+
+ onMount(async () => {
+ await fetchChangelog();
+ loading = false;
+ });
+
+ function renderMarkdown(md: string): string {
+ return md
+ .split("\n")
+ .map((line) => {
+ if (line.startsWith("### ")) {
+ return `<h4>${escapeHtml(line.slice(4))}</h4>`;
+ }
+ if (line.startsWith("## ")) {
+ return `<h3>${escapeHtml(line.slice(3))}</h3>`;
+ }
+ if (line.startsWith("# ")) {
+ return `<h2>${escapeHtml(line.slice(2))}</h2>`;
+ }
+ if (line.startsWith("- ") || line.startsWith("* ")) {
+ return `<li>${formatInline(line.slice(2))}</li>`;
+ }
+ if (line.trim() === "") {
+ return "<br />";
+ }
+ return `<p>${formatInline(line)}</p>`;
+ })
+ .join("");
+ }
+
+ function escapeHtml(str: string): string {
+ return str
+ .replace(/&/g, "&amp;")
+ .replace(/</g, "&lt;")
+ .replace(/>/g, "&gt;")
+ .replace(/"/g, "&quot;");
+ }
+
+ function formatInline(str: string): string {
+ let result = escapeHtml(str);
+ result = result.replace(/\*\*(.+?)\*\*/g, "<strong>$1</strong>");
+ result = result.replace(/`(.+?)`/g, "<code>$1</code>");
+ result = result.replace(
+ /\[(.+?)\]\((.+?)\)/g,
+ '<a href="$2" target="_blank" rel="noopener">$1</a>'
+ );
+ return result;
+ }
+</script>
+
+<div class="changelog-page">
+ {#if version}
+ <div class="version-row">
+ <span class="version-label">{$t("about.version")}</span>
+ <span class="version-value">{version}</span>
+ </div>
+ {/if}
+
+ {#if loading}
+ <div class="loading">
+ <span class="spinner"></span>
+ </div>
+ {:else if body}
+ <div class="card">
+ <div class="markdown-content">
+ {@html renderMarkdown(body)}
+ </div>
+ </div>
+ {:else}
+ <div class="card empty-card">
+ <p class="empty-text">{$t("changelog.empty")}</p>
+ </div>
+ {/if}
+</div>
+
+<style>
+ .changelog-page {
+ display: flex;
+ flex-direction: column;
+ gap: calc(var(--padding) * 1.5);
+ }
+
+ .version-row {
+ display: flex;
+ align-items: center;
+ justify-content: center;
+ gap: calc(var(--padding) / 2);
+ }
+
+ .version-label {
+ font-size: var(--text-sm);
+ font-weight: 500;
+ color: var(--gray);
+ }
+
+ .version-value {
+ font-size: var(--text-sm);
+ font-weight: 500;
+ color: var(--blue);
+ }
+
+ .loading {
+ display: flex;
+ align-items: center;
+ justify-content: center;
+ padding: calc(var(--padding) * 3) 0;
+ }
+
+ .spinner {
+ width: 24px;
+ height: 24px;
+ border: 2px solid var(--input-border);
+ border-top-color: var(--blue);
+ border-radius: 50%;
+ animation: spin 0.6s linear infinite;
+ }
+
+ @keyframes spin {
+ to {
+ transform: rotate(360deg);
+ }
+ }
+
+ .card {
+ width: 100%;
+ background: var(--button);
+ box-shadow: var(--button-box-shadow);
+ border-radius: var(--border-radius);
+ padding: calc(var(--padding) + 4px);
+ }
+
+ .empty-card {
+ display: flex;
+ align-items: center;
+ justify-content: center;
+ padding: calc(var(--padding) * 2);
+ }
+
+ .empty-text {
+ font-size: var(--text-base);
+ font-weight: 500;
+ color: var(--gray);
+ }
+
+ .markdown-content {
+ font-size: 13px;
+ font-weight: 400;
+ line-height: 1.7;
+ color: var(--secondary);
+ }
+
+ .markdown-content :global(h2) {
+ font-size: 18px;
+ font-weight: 500;
+ margin: 0 0 calc(var(--padding) / 2);
+ letter-spacing: -0.5px;
+ }
+
+ .markdown-content :global(h3) {
+ font-size: 15px;
+ font-weight: 500;
+ margin: var(--padding) 0 calc(var(--padding) / 2);
+ }
+
+ .markdown-content :global(h4) {
+ font-size: 13px;
+ font-weight: 500;
+ margin: var(--padding) 0 calc(var(--padding) / 4);
+ color: var(--gray);
+ }
+
+ .markdown-content :global(p) {
+ margin: 0 0 4px;
+ }
+
+ .markdown-content :global(li) {
+ margin: 0 0 4px;
+ padding-left: calc(var(--padding) / 2);
+ list-style: none;
+ }
+
+ .markdown-content :global(li::before) {
+ content: "•";
+ color: var(--blue);
+ margin-right: 6px;
+ }
+
+ .markdown-content :global(strong) {
+ font-weight: 600;
+ }
+
+ .markdown-content :global(code) {
+ font-size: 12px;
+ padding: 1px 5px;
+ background: var(--button-elevated);
+ border-radius: 4px;
+ }
+
+ .markdown-content :global(a) {
+ color: var(--blue);
+ text-decoration: none;
+ }
+
+ @media (hover: hover) {
+ .markdown-content :global(a:hover) {
+ text-decoration: underline;
+ }
+ }
+
+ .markdown-content :global(br) {
+ display: block;
+ content: "";
+ margin-top: 4px;
+ }
+</style>
diff --git a/src/routes/about/project/+page.svelte b/src/routes/about/project/+page.svelte
index 338badf5..444f1f54 100644
--- a/src/routes/about/project/+page.svelte
+++ b/src/routes/about/project/+page.svelte
@@ -60,7 +60,7 @@
}
.star-description {
- font-size: 14.5px;
+ font-size: var(--text-base);
font-weight: 500;
color: var(--secondary);
}
@@ -77,7 +77,7 @@
gap: calc(var(--padding) / 2);
width: 100%;
padding: calc(var(--padding) + 2px) calc(var(--padding) * 2);
- font-size: 14.5px;
+ font-size: var(--text-base);
font-weight: 500;
color: #fff;
background: var(--orange);
@@ -121,7 +121,7 @@
}
.project-description {
- font-size: 14.5px;
+ font-size: var(--text-base);
font-weight: 400;
line-height: 1.8;
color: var(--gray);
@@ -162,7 +162,7 @@
}
.version {
- font-size: 12.5px;
+ font-size: var(--text-sm);
font-weight: 500;
color: var(--gray);
text-align: center;
diff --git a/src/routes/convert/+page.svelte b/src/routes/convert/+page.svelte
index 23bec5e7..a2c9d966 100644
--- a/src/routes/convert/+page.svelte
+++ b/src/routes/convert/+page.svelte
@@ -511,7 +511,7 @@
}
.hwaccel-badge {
- font-size: 12.5px;
+ font-size: var(--text-sm);
font-weight: 500;
padding: calc(var(--padding) / 3) calc(var(--padding) / 1.5);
border-radius: calc(var(--border-radius) / 2);
@@ -569,7 +569,7 @@
}
.file-name {
- font-size: 14.5px;
+ font-size: var(--text-base);
font-weight: 500;
color: var(--secondary);
overflow: hidden;
@@ -580,7 +580,7 @@
.file-meta {
display: flex;
gap: calc(var(--padding) / 2);
- font-size: 12.5px;
+ font-size: var(--text-sm);
font-weight: 500;
color: var(--gray);
flex-wrap: wrap;
@@ -598,7 +598,7 @@
}
.status-label {
- font-size: 12.5px;
+ font-size: var(--text-sm);
font-weight: 500;
color: var(--gray);
}
@@ -616,7 +616,7 @@
}
.percent {
- font-size: 12.5px;
+ font-size: var(--text-sm);
font-weight: 500;
color: var(--blue);
font-variant-numeric: tabular-nums;
@@ -663,14 +663,14 @@
}
.setting-label {
- font-size: 14.5px;
+ font-size: var(--text-base);
font-weight: 500;
color: var(--secondary);
}
.select {
padding: calc(var(--padding) / 2) 28px calc(var(--padding) / 2) var(--padding);
- font-size: 14.5px;
+ font-size: var(--text-base);
font-weight: 500;
background: var(--button-elevated);
border-radius: calc(var(--border-radius) / 2);
@@ -693,7 +693,7 @@
.input-text {
width: 100px;
padding: calc(var(--padding) / 2);
- font-size: 14.5px;
+ font-size: var(--text-base);
font-weight: 500;
text-align: center;
background: var(--button-elevated);
@@ -716,7 +716,7 @@
.convert-btn {
padding: calc(var(--padding) / 1.5) calc(var(--padding) * 2);
- font-size: 14.5px;
+ font-size: var(--text-base);
font-weight: 500;
background: var(--blue);
color: #fff;
@@ -743,13 +743,13 @@
.cancel-btn {
padding: calc(var(--padding) / 1.5) calc(var(--padding) * 2);
- font-size: 14.5px;
+ font-size: var(--text-base);
font-weight: 500;
color: var(--red);
}
.clear-btn {
- font-size: 14.5px;
+ font-size: var(--text-base);
font-weight: 500;
color: var(--gray);
}
@@ -762,7 +762,7 @@
}
.empty-text {
- font-size: 14.5px;
+ font-size: var(--text-base);
font-weight: 500;
color: var(--gray);
text-align: center;
diff --git a/src/routes/courses/+page.svelte b/src/routes/courses/+page.svelte
index cdacea7f..bc7cda93 100644
--- a/src/routes/courses/+page.svelte
+++ b/src/routes/courses/+page.svelte
@@ -321,7 +321,7 @@
}
.card-name {
- font-size: 14.5px;
+ font-size: var(--text-base);
font-weight: 500;
color: var(--secondary);
}
diff --git a/src/routes/courses/[platform]/+page.svelte b/src/routes/courses/[platform]/+page.svelte
index af53b293..0fc2a6cf 100644
--- a/src/routes/courses/[platform]/+page.svelte
+++ b/src/routes/courses/[platform]/+page.svelte
@@ -659,7 +659,7 @@
display: inline-flex;
align-items: center;
gap: 6px;
- font-size: 12.5px;
+ font-size: var(--text-sm);
font-weight: 500;
color: var(--gray);
margin-bottom: var(--padding);
@@ -701,7 +701,7 @@
}
.session-info {
- font-size: 12.5px;
+ font-size: var(--text-sm);
font-weight: 500;
color: var(--gray);
}
@@ -715,7 +715,7 @@
.session-bar :global(.button) {
padding: calc(var(--padding) / 2) var(--padding);
- font-size: 12.5px;
+ font-size: var(--text-sm);
}
.search-bar {
@@ -726,7 +726,7 @@
.search-bar .search-input {
padding: calc(var(--padding) / 2) var(--padding);
- font-size: 12.5px;
+ font-size: var(--text-sm);
background: var(--input-bg);
border: 1px solid var(--input-border);
border-radius: var(--border-radius);
@@ -751,7 +751,7 @@
.courses-header h2 { margin-block: 0; }
.subtext {
- font-size: 12.5px;
+ font-size: var(--text-sm);
font-weight: 500;
color: var(--gray);
}
@@ -775,7 +775,7 @@
}
.pagination-info {
- font-size: 12.5px;
+ font-size: var(--text-sm);
font-weight: 500;
color: var(--gray);
}
@@ -793,14 +793,14 @@
display: flex;
align-items: center;
justify-content: center;
- font-size: 14.5px;
+ font-size: var(--text-base);
}
.pagination-ellipsis {
min-width: 36px;
text-align: center;
color: var(--gray);
- font-size: 14.5px;
+ font-size: var(--text-base);
}
.login-card {
@@ -824,7 +824,7 @@
.login-tab {
flex: 1;
border-radius: 0;
- font-size: 12.5px;
+ font-size: var(--text-sm);
padding: calc(var(--padding) * 0.75) var(--padding);
}
@@ -849,7 +849,7 @@
}
.field-label {
- font-size: 12.5px;
+ font-size: var(--text-sm);
font-weight: 500;
color: var(--gray);
}
@@ -857,7 +857,7 @@
.input {
width: 100%;
padding: var(--padding);
- font-size: 14.5px;
+ font-size: var(--text-base);
background: var(--button);
border-radius: var(--border-radius);
color: var(--secondary);
@@ -872,11 +872,11 @@
min-height: 80px;
resize: vertical;
font-family: var(--font-mono);
- font-size: 12.5px;
+ font-size: var(--text-sm);
}
.otp-hint {
- font-size: 12.5px;
+ font-size: var(--text-sm);
color: var(--green);
text-align: center;
font-weight: 500;
@@ -890,7 +890,7 @@
}
.browser-hint {
- font-size: 12.5px;
+ font-size: var(--text-sm);
color: var(--gray);
text-align: center;
}
@@ -905,19 +905,19 @@
}
.file-btn {
- font-size: 12.5px;
+ font-size: var(--text-sm);
cursor: pointer;
}
.error-msg {
color: var(--red);
- font-size: 12.5px;
+ font-size: var(--text-sm);
font-weight: 500;
}
.captcha-warning {
color: var(--orange);
- font-size: 12.5px;
+ font-size: var(--text-sm);
font-weight: 500;
}
@@ -941,7 +941,7 @@
@keyframes spin { to { transform: rotate(360deg); } }
.spinner-text {
- font-size: 12.5px;
+ font-size: var(--text-sm);
font-weight: 500;
color: var(--gray);
}
@@ -956,7 +956,7 @@
.empty-text {
color: var(--gray);
- font-size: 14.5px;
+ font-size: var(--text-base);
text-align: center;
padding: calc(var(--padding) * 4) 0;
}
diff --git a/src/routes/downloads/+page.svelte b/src/routes/downloads/+page.svelte
index fd1e568d..169997b1 100644
--- a/src/routes/downloads/+page.svelte
+++ b/src/routes/downloads/+page.svelte
@@ -1157,7 +1157,7 @@
}
.empty-text {
- font-size: 14.5px;
+ font-size: var(--text-base);
}
.downloads-page {
@@ -1196,7 +1196,7 @@
}
.clear-btn {
- font-size: 12.5px;
+ font-size: var(--text-sm);
font-weight: 500;
padding: calc(var(--padding) / 3) calc(var(--padding) * 0.75);
background: var(--button-elevated);
@@ -1450,7 +1450,7 @@
}
.item-detail {
- font-size: 12.5px;
+ font-size: var(--text-sm);
font-weight: 500;
color: var(--gray);
overflow: hidden;
@@ -1462,7 +1462,7 @@
display: flex;
align-items: center;
gap: calc(var(--padding) / 3);
- font-size: 12.5px;
+ font-size: var(--text-sm);
font-weight: 500;
color: var(--gray);
font-variant-numeric: tabular-nums;
@@ -1473,7 +1473,7 @@
}
.item-error {
- font-size: 12.5px;
+ font-size: var(--text-sm);
font-weight: 500;
color: var(--red);
}
@@ -1695,7 +1695,7 @@
display: inline-flex;
align-items: center;
gap: 5px;
- font-size: 12.5px;
+ font-size: var(--text-sm);
color: var(--tertiary);
background: transparent;
border: none;
diff --git a/src/routes/marketplace/+page.svelte b/src/routes/marketplace/+page.svelte
index 7c293f1f..b0c0d138 100644
--- a/src/routes/marketplace/+page.svelte
+++ b/src/routes/marketplace/+page.svelte
@@ -508,7 +508,7 @@
.error-hint {
max-width: 420px;
- font-size: 12.5px;
+ font-size: var(--text-sm);
line-height: 1.5;
color: var(--gray);
}
@@ -617,7 +617,7 @@
}
.plugin-name {
- font-size: 14.5px;
+ font-size: var(--text-base);
font-weight: 500;
color: var(--secondary);
}
diff --git a/src/routes/study/music/now-playing/+page.svelte b/src/routes/study/music/now-playing/+page.svelte
index b4219a31..0550bc07 100644
--- a/src/routes/study/music/now-playing/+page.svelte
+++ b/src/routes/study/music/now-playing/+page.svelte
@@ -966,7 +966,7 @@
border-radius: 8px;
color: rgba(255, 255, 255, 0.85);
font-family: inherit;
- font-size: 12.5px;
+ font-size: var(--text-sm);
cursor: pointer;
text-align: left;
transition: background 100ms ease;
diff --git a/src/routes/study/music/youtube/+page.svelte b/src/routes/study/music/youtube/+page.svelte
index 16e584f3..71bf3ebf 100644
--- a/src/routes/study/music/youtube/+page.svelte
+++ b/src/routes/study/music/youtube/+page.svelte
@@ -605,7 +605,7 @@
}
.card-sub {
margin: 4px 0 0;
- font-size: 12.5px;
+ font-size: var(--text-sm);
font-weight: 400;
color: #aaa;
overflow: hidden;
diff --git a/src/routes/telegram/+page.svelte b/src/routes/telegram/+page.svelte
index 65dbf322..a0a19f76 100644
--- a/src/routes/telegram/+page.svelte
+++ b/src/routes/telegram/+page.svelte
@@ -1644,7 +1644,7 @@
}
.session-info {
- font-size: 12.5px;
+ font-size: var(--text-sm);
font-weight: 500;
color: var(--gray);
overflow: hidden;
@@ -1662,7 +1662,7 @@
.session-bar :global(.button) {
padding: calc(var(--padding) / 2) var(--padding);
- font-size: 12.5px;
+ font-size: var(--text-sm);
}
.spinning {
@@ -1726,7 +1726,7 @@
}
.qr-instruction {
- font-size: 12.5px;
+ font-size: var(--text-sm);
font-weight: 500;
color: var(--gray);
line-height: 1.6;
@@ -1745,7 +1745,7 @@
}
.separator-text {
- font-size: 12.5px;
+ font-size: var(--text-sm);
font-weight: 500;
color: var(--gray);
}
@@ -1770,7 +1770,7 @@
}
.field-label {
- font-size: 12.5px;
+ font-size: var(--text-sm);
font-weight: 500;
color: var(--gray);
}
@@ -1785,7 +1785,7 @@
.input {
width: 100%;
padding: var(--padding);
- font-size: 14.5px;
+ font-size: var(--text-base);
background: var(--button);
border-radius: var(--border-radius);
color: var(--secondary);
@@ -1812,7 +1812,7 @@
.error-msg {
color: var(--red);
- font-size: 12.5px;
+ font-size: var(--text-sm);
font-weight: 500;
}
@@ -1846,7 +1846,7 @@
}
.spinner-text {
- font-size: 12.5px;
+ font-size: var(--text-sm);
font-weight: 500;
color: var(--gray);
}
@@ -1861,7 +1861,7 @@
.empty-text {
color: var(--gray);
- font-size: 14.5px;
+ font-size: var(--text-base);
text-align: center;
padding: calc(var(--padding) * 4) 0;
}
@@ -1897,7 +1897,7 @@
border: none;
color: var(--gray);
font-family: inherit;
- font-size: 12.5px;
+ font-size: var(--text-sm);
font-weight: 500;
cursor: pointer;
border-radius: calc(var(--border-radius) - 2px);
@@ -1936,7 +1936,7 @@
align-items: center;
gap: 6px;
padding: calc(var(--padding) / 2) calc(var(--padding) * 1.25);
- font-size: 12.5px;
+ font-size: var(--text-sm);
}
.create-folder-overlay {
@@ -2011,7 +2011,7 @@
}
.subtext {
- font-size: 12.5px;
+ font-size: var(--text-sm);
font-weight: 500;
color: var(--gray);
}
@@ -2058,7 +2058,7 @@
align-items: center;
gap: calc(var(--padding) / 2);
padding: calc(var(--padding) / 2) var(--padding);
- font-size: 12.5px;
+ font-size: var(--text-sm);
}
.transfers-btn {
@@ -2101,7 +2101,7 @@
display: flex;
align-items: center;
justify-content: center;
- font-size: 14.5px;
+ font-size: var(--text-base);
font-weight: 500;
}
@@ -2127,7 +2127,7 @@
}
.chat-title {
- font-size: 14.5px;
+ font-size: var(--text-base);
font-weight: 500;
color: var(--secondary);
overflow: hidden;
@@ -2154,7 +2154,7 @@
.filter-btn {
padding: calc(var(--padding) / 2) var(--padding);
- font-size: 12.5px;
+ font-size: var(--text-sm);
}
.media-header {
@@ -2171,7 +2171,7 @@
.batch-download-btn,
.batch-cancel-btn {
padding: calc(var(--padding) / 2) var(--padding);
- font-size: 12.5px;
+ font-size: var(--text-sm);
}
.batch-cancel-btn {
@@ -2265,7 +2265,7 @@
.media-download-btn {
padding: calc(var(--padding) / 2) var(--padding);
- font-size: 12.5px;
+ font-size: var(--text-sm);
flex-shrink: 0;
}
@@ -2285,7 +2285,7 @@
.load-more-btn {
align-self: center;
padding: calc(var(--padding) / 2) calc(var(--padding) * 2);
- font-size: 12.5px;
+ font-size: var(--text-sm);
display: flex;
align-items: center;
gap: calc(var(--padding) / 2);
@@ -2356,7 +2356,7 @@
}
.media-name {
- font-size: 12.5px;
+ font-size: var(--text-sm);
}
.media-meta {