Add interface languages and improve themes and workspace controls for 0.1.36
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
<script lang="ts">
|
||||
import { t } from "$lib/i18n";
|
||||
import { onDestroy, tick } from "svelte";
|
||||
import { actionMenu, type ActionMenuItem } from "$lib/ui/actionMenu";
|
||||
import { actionIcons } from "$lib/ui/actionIcons";
|
||||
@@ -122,24 +123,24 @@
|
||||
children: item.children ? wrapActions(item.children) : undefined };
|
||||
});
|
||||
menu = actionMenu(x, y, [
|
||||
closing("Close", "one"),
|
||||
closing("Close others", "others"),
|
||||
closing("Close tabs after", "after"),
|
||||
closing("Close all", "all"),
|
||||
closing($t("Close"), "one"),
|
||||
closing($t("Close others"), "others"),
|
||||
closing($t("Close tabs after"), "after"),
|
||||
closing($t("Close all"), "all"),
|
||||
...(tabs[index].pinned !== undefined ? [
|
||||
{ separator: true as const },
|
||||
{ label: tabs[index].pinned ? "Unpin" : "Pin", icon: "pin" as const, run: run(() => onPin(path)) },
|
||||
{ label: tabs[index].pinned ? $t("Unpin") : $t("Pin"), icon: "pin" as const, run: run(() => onPin(path)) },
|
||||
] : []),
|
||||
...wrapActions(tabActions(tabs[index])),
|
||||
...(path === activePath ? wrapActions(fileActions(tabs[index])) : []),
|
||||
{ separator: true },
|
||||
{ label: "Move tab", icon: "swap", children: [
|
||||
{ label: "Move tab left", icon: "move-left", disabled: index <= 0,
|
||||
{ label: $t("Move tab"), icon: "swap", children: [
|
||||
{ label: $t("Move tab left"), icon: "move-left", disabled: index <= 0,
|
||||
run: run(() => { void move(path, index - 1); }) },
|
||||
{ label: "Move tab right", icon: "move-right", disabled: index === tabs.length - 1,
|
||||
{ label: $t("Move tab right"), icon: "move-right", disabled: index === tabs.length - 1,
|
||||
run: run(() => { void move(path, index + 1); }) },
|
||||
] },
|
||||
], () => closeMenu(true), "Tab actions");
|
||||
], () => closeMenu(true), $t("Tab actions"));
|
||||
menu.classList.add("tab-menu");
|
||||
}
|
||||
|
||||
@@ -255,7 +256,7 @@
|
||||
|
||||
<svelte:window onpointerdown={(event) => { if (menu && !menu.contains(event.target as Node)) closeMenu(); }} onresize={() => closeMenu()} />
|
||||
|
||||
<div bind:this={bar} class="tabs" class:receiving role="tablist" aria-label="Working tabs" tabindex="-1"
|
||||
<div bind:this={bar} class="tabs" class:receiving role="tablist" aria-label={$t("Working tabs")} tabindex="-1"
|
||||
ondragover={dragOver} ondrop={dropTab}
|
||||
ondragleave={(event) => { if (!(event.relatedTarget instanceof Node) || !bar.contains(event.relatedTarget)) { receiving = false; dropBefore = dropAfter = null; } }}>
|
||||
{#each tabs as tab (tab.id)}
|
||||
@@ -270,7 +271,7 @@
|
||||
aria-controls={tab.panelId}
|
||||
aria-describedby={tab.pinned ? `tab-pin-${tab.id}` : undefined}
|
||||
aria-keyshortcuts="Alt+Shift+ArrowLeft Alt+Shift+ArrowRight"
|
||||
title={`${tab.title}\n${tab.draggable ? "Drag to reorder or move to another RuneStone window." : "Drag to reorder."} Right-click for tab actions.`}
|
||||
title={`${tab.title}\n${tab.draggable ? $t("Drag to reorder or move to another RuneStone window.") : $t("Drag to reorder.")} ${$t("Right-click for tab actions.")}`}
|
||||
onclick={() => { if (suppressClick) { suppressClick = false; return; } onSelect(tab.relPath); }}
|
||||
onpointerdown={(event) => { if (!tab.draggable) startDrag(event, tab.relPath); else suppressClick = false; }}
|
||||
draggable={!!tab.draggable}
|
||||
@@ -289,12 +290,12 @@
|
||||
<TabIcon image={tab.iconImage} icon={tab.icon} />
|
||||
<span class="tab-label">{tab.name}{tab.dirty ? " •" : ""}</span>
|
||||
</button>
|
||||
{#if tab.pinned}<span class="sr-only" id={`tab-pin-${tab.id}`}>Pinned tab</span>{/if}
|
||||
{#if tab.pinned}<span class="sr-only" id={`tab-pin-${tab.id}`}>{$t("Pinned tab")}</span>{/if}
|
||||
<button
|
||||
class="close"
|
||||
type="button"
|
||||
aria-label="Close {tab.name}"
|
||||
title="Close {tab.name}"
|
||||
aria-label={$t("Close {name}", { name: tab.name })}
|
||||
title={$t("Close {name}", { name: tab.name })}
|
||||
onclick={() => onClose(tab.relPath)}
|
||||
onmousedown={onMiddleDown}
|
||||
onmouseup={(event) => onMiddleUp(event, tab.relPath)}
|
||||
|
||||
Reference in New Issue
Block a user