mirror of https://github.com/VERT-sh/VERT.git
fix: forgor async oops
This commit is contained in:
parent
3e4ff6bdbe
commit
b32ec67bee
9
bun.lock
9
bun.lock
|
|
@ -1,5 +1,6 @@
|
||||||
{
|
{
|
||||||
"lockfileVersion": 1,
|
"lockfileVersion": 1,
|
||||||
|
"configVersion": 0,
|
||||||
"workspaces": {
|
"workspaces": {
|
||||||
"": {
|
"": {
|
||||||
"name": "vert",
|
"name": "vert",
|
||||||
|
|
@ -17,7 +18,7 @@
|
||||||
"clsx": "^2.1.1",
|
"clsx": "^2.1.1",
|
||||||
"fflate": "^0.8.2",
|
"fflate": "^0.8.2",
|
||||||
"lucide-svelte": "^0.554.0",
|
"lucide-svelte": "^0.554.0",
|
||||||
"music-metadata": "^11.10.1",
|
"music-metadata": "^11.10.3",
|
||||||
"overlayscrollbars": "^2.12.0",
|
"overlayscrollbars": "^2.12.0",
|
||||||
"overlayscrollbars-svelte": "^0.5.5",
|
"overlayscrollbars-svelte": "^0.5.5",
|
||||||
"p-queue": "^9.0.1",
|
"p-queue": "^9.0.1",
|
||||||
|
|
@ -31,7 +32,7 @@
|
||||||
"@inlang/paraglide-js": "^2.5.0",
|
"@inlang/paraglide-js": "^2.5.0",
|
||||||
"@poppanator/sveltekit-svg": "^5.0.1",
|
"@poppanator/sveltekit-svg": "^5.0.1",
|
||||||
"@sveltejs/adapter-static": "^3.0.10",
|
"@sveltejs/adapter-static": "^3.0.10",
|
||||||
"@sveltejs/kit": "^2.48.5",
|
"@sveltejs/kit": "^2.49.0",
|
||||||
"@sveltejs/vite-plugin-svelte": "^4.0.4",
|
"@sveltejs/vite-plugin-svelte": "^4.0.4",
|
||||||
"@types/eslint": "^9.6.1",
|
"@types/eslint": "^9.6.1",
|
||||||
"@types/sanitize-html": "^2.16.0",
|
"@types/sanitize-html": "^2.16.0",
|
||||||
|
|
@ -44,8 +45,8 @@
|
||||||
"prettier": "^3.6.2",
|
"prettier": "^3.6.2",
|
||||||
"prettier-plugin-svelte": "^3.4.0",
|
"prettier-plugin-svelte": "^3.4.0",
|
||||||
"prettier-plugin-tailwindcss": "^0.6.14",
|
"prettier-plugin-tailwindcss": "^0.6.14",
|
||||||
"sass": "^1.94.1",
|
"sass": "^1.94.2",
|
||||||
"svelte": "^5.43.12",
|
"svelte": "^5.43.14",
|
||||||
"svelte-check": "^4.3.4",
|
"svelte-check": "^4.3.4",
|
||||||
"tailwindcss": "^3.4.18",
|
"tailwindcss": "^3.4.18",
|
||||||
"typescript": "^5.9.3",
|
"typescript": "^5.9.3",
|
||||||
|
|
|
||||||
|
|
@ -84,6 +84,7 @@
|
||||||
"settings": {
|
"settings": {
|
||||||
"settings": "Settings",
|
"settings": "Settings",
|
||||||
"title": "File conversion settings",
|
"title": "File conversion settings",
|
||||||
|
"description": "Change the conversion settings for <b>{filename}</b>, which is using <b>{converter}</b>. These settings may not be available for all formats.",
|
||||||
"image": {
|
"image": {
|
||||||
"quality": "Quality",
|
"quality": "Quality",
|
||||||
"depth": "Color depth",
|
"depth": "Color depth",
|
||||||
|
|
|
||||||
|
|
@ -5,6 +5,7 @@
|
||||||
import Modal from "./Modal.svelte";
|
import Modal from "./Modal.svelte";
|
||||||
import { m } from "$lib/paraglide/messages";
|
import { m } from "$lib/paraglide/messages";
|
||||||
import type { VertFile } from "$lib/types";
|
import type { VertFile } from "$lib/types";
|
||||||
|
import { sanitize } from "$lib/store/index.svelte";
|
||||||
|
|
||||||
type Props = {
|
type Props = {
|
||||||
file: VertFile | null;
|
file: VertFile | null;
|
||||||
|
|
@ -35,7 +36,7 @@
|
||||||
|
|
||||||
<Modal
|
<Modal
|
||||||
icon={SearchIcon}
|
icon={SearchIcon}
|
||||||
title="Conversion Settings"
|
title={m["convert.settings.title"]()}
|
||||||
color="purple"
|
color="purple"
|
||||||
buttons={[
|
buttons={[
|
||||||
{
|
{
|
||||||
|
|
@ -51,89 +52,84 @@
|
||||||
onclose={() => onclose?.()}
|
onclose={() => onclose?.()}
|
||||||
>
|
>
|
||||||
<div class="flex flex-col gap-8">
|
<div class="flex flex-col gap-8">
|
||||||
{#if !file}
|
{#if file}
|
||||||
<p class="text-sm text-muted">No file selected</p>
|
{#await file.getAvailableSettings() then settings}
|
||||||
{:else}
|
<div class="flex flex-col gap-4">
|
||||||
{@const settings = file.getAvailableSettings()}
|
<p class="text-base">
|
||||||
<div class="flex flex-col gap-4">
|
{@html sanitize(
|
||||||
<div class="flex flex-col gap-2">
|
m["convert.settings.description"]({
|
||||||
<p class="text-base font-bold">
|
converter: file.findConverter()?.name,
|
||||||
{m["settings.conversion.title"]?.() ||
|
filename: file.name,
|
||||||
"Conversion Settings"}
|
}),
|
||||||
|
)}
|
||||||
</p>
|
</p>
|
||||||
<p class="text-sm text-muted font-normal">
|
|
||||||
{m["settings.conversion.description"]?.() ||
|
|
||||||
`Configure conversion options for ${file.name}`}
|
|
||||||
</p>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
{#if settings.length === 0}
|
{#if settings.length === 0}
|
||||||
<p class="text-sm text-muted">
|
<p class="text-sm text-muted">
|
||||||
{m["settings.conversion.no_settings"]?.() ||
|
{m["convert.settings.none"]()}
|
||||||
"No settings available for this converter"}
|
</p>
|
||||||
</p>
|
{:else}
|
||||||
{:else}
|
<div class="grid grid-cols-2 gap-4">
|
||||||
<div class="grid grid-cols-2 gap-4">
|
{#each settings as setting (setting.key)}
|
||||||
{#each settings as setting (setting.key)}
|
<div class="flex flex-col gap-2">
|
||||||
<div class="flex flex-col gap-2">
|
<p class="text-sm font-bold">
|
||||||
<p class="text-sm font-bold">
|
{setting.label}
|
||||||
{setting.label}
|
|
||||||
</p>
|
|
||||||
<!-- prob unneeded -->
|
|
||||||
{#if setting.description}
|
|
||||||
<p class="text-xs text-muted">
|
|
||||||
{setting.description}
|
|
||||||
</p>
|
</p>
|
||||||
{/if}
|
<!-- prob unneeded -->
|
||||||
|
{#if setting.description}
|
||||||
|
<p class="text-xs text-muted">
|
||||||
|
{setting.description}
|
||||||
|
</p>
|
||||||
|
{/if}
|
||||||
|
|
||||||
{#if setting.type === "select"}
|
{#if setting.type === "select"}
|
||||||
<Dropdown
|
<Dropdown
|
||||||
options={setting.options?.map(
|
options={setting.options?.map(
|
||||||
(opt) => opt.value,
|
(opt) => opt.value,
|
||||||
) || []}
|
) || []}
|
||||||
selected={file.conversionSettings[
|
selected={file.conversionSettings[
|
||||||
setting.key
|
setting.key
|
||||||
] ?? setting.default}
|
] ?? setting.default}
|
||||||
settingsStyle
|
settingsStyle
|
||||||
onselect={(value) =>
|
onselect={(value) =>
|
||||||
handleSettingChange(
|
handleSettingChange(
|
||||||
setting.key,
|
setting.key,
|
||||||
value,
|
value,
|
||||||
)}
|
)}
|
||||||
/>
|
/>
|
||||||
{:else if setting.type === "boolean"}
|
{:else if setting.type === "boolean"}
|
||||||
<FancyInput
|
<FancyInput
|
||||||
type="checkbox"
|
type="checkbox"
|
||||||
checked={file.conversionSettings[
|
checked={file.conversionSettings[
|
||||||
setting.key
|
setting.key
|
||||||
] ?? setting.default}
|
] ?? setting.default}
|
||||||
placeholder={setting.placeholder}
|
placeholder={setting.placeholder}
|
||||||
onchange={(e) =>
|
onchange={(e) =>
|
||||||
handleSettingChange(
|
handleSettingChange(
|
||||||
setting.key,
|
setting.key,
|
||||||
e.currentTarget.checked,
|
e.currentTarget.checked,
|
||||||
)}
|
)}
|
||||||
|
/>
|
||||||
/>
|
{:else}
|
||||||
{:else}
|
<FancyInput
|
||||||
<FancyInput
|
type={setting.type}
|
||||||
type={setting.type}
|
value={file.conversionSettings[
|
||||||
value={file.conversionSettings[
|
setting.key
|
||||||
setting.key
|
] ?? setting.default}
|
||||||
] ?? setting.default}
|
placeholder={setting.placeholder}
|
||||||
placeholder={setting.placeholder}
|
oninput={(e) =>
|
||||||
oninput={(e) =>
|
handleSettingChange(
|
||||||
handleSettingChange(
|
setting.key,
|
||||||
setting.key,
|
e.currentTarget.value,
|
||||||
e.currentTarget.value,
|
)}
|
||||||
)}
|
/>
|
||||||
/>
|
{/if}
|
||||||
{/if}
|
</div>
|
||||||
</div>
|
{/each}
|
||||||
{/each}
|
</div>
|
||||||
</div>
|
{/if}
|
||||||
{/if}
|
</div>
|
||||||
</div>
|
{/await}
|
||||||
{/if}
|
{/if}
|
||||||
</div>
|
</div>
|
||||||
</Modal>
|
</Modal>
|
||||||
|
|
|
||||||
|
|
@ -39,10 +39,10 @@ export class VertFile {
|
||||||
|
|
||||||
public isZip = $state(() => this.from === ".zip");
|
public isZip = $state(() => this.from === ".zip");
|
||||||
|
|
||||||
public getAvailableSettings(): SettingDefinition[] {
|
public getAvailableSettings(): Promise<SettingDefinition[]> {
|
||||||
const converter = this.findConverter();
|
const converter = this.findConverter();
|
||||||
if (!converter) return [];
|
if (!converter) return Promise.resolve([]);
|
||||||
return converter.getAvailableSettings(this);
|
return converter.getAvailableSettings();
|
||||||
}
|
}
|
||||||
|
|
||||||
public findConverters(supportedFormats: string[] = [this.from]) {
|
public findConverters(supportedFormats: string[] = [this.from]) {
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue