feat(ui): scroll past the end of the YAML editor and history diff, with an appearance setting
This commit is contained in:
1 parent
6630b0c9bf
commit
b47f768076
7 files changed
+144
-106
No files matched your search
@@ -13,8 +13,8 @@ import {
|
||||
import ConfigCard from "./ConfigCard.vue";
|
||||
|
||||
const appearance = useAppearanceStore();
|
||||
const { density, motion, theme, tooltipsEnabled } = storeToRefs(appearance);
|
||||
const { setDensity, setMotion, setTheme, setTooltips } = appearance;
|
||||
const { density, motion, overscroll, theme, tooltipsEnabled } = storeToRefs(appearance);
|
||||
const { setDensity, setMotion, setOverscroll, setTheme, setTooltips } = appearance;
|
||||
|
||||
/**
|
||||
* Appearance: how the dashboard looks, on this browser. These preferences are
|
||||
@@ -42,7 +42,7 @@ function chooseMotion(value: unknown): void {
|
||||
<ConfigCard
|
||||
title="Dashboard preferences"
|
||||
>
|
||||
<div class="grid gap-8 md:grid-cols-2 lg:grid-cols-4">
|
||||
<div class="grid gap-8 md:grid-cols-2 lg:grid-cols-5">
|
||||
<section class="flex min-w-0 flex-col items-start">
|
||||
<div>
|
||||
<h2 id="appearance-theme" class="text-sm font-medium">Theme</h2>
|
||||
@@ -106,6 +106,18 @@ function chooseMotion(value: unknown): void {
|
||||
@update:model-value="setTooltips"
|
||||
/>
|
||||
</section>
|
||||
|
||||
<section class="flex min-w-0 flex-col items-start">
|
||||
<div>
|
||||
<h2 id="appearance-overscroll" class="text-sm font-medium">Scroll past end</h2>
|
||||
</div>
|
||||
<Switch
|
||||
:model-value="overscroll"
|
||||
class="mt-4"
|
||||
aria-labelledby="appearance-overscroll"
|
||||
@update:model-value="setOverscroll"
|
||||
/>
|
||||
</section>
|
||||
</div>
|
||||
</ConfigCard>
|
||||
</div>
|
||||
|
||||
@@ -5,6 +5,7 @@ export const THEME_KEY = "archie.theme";
|
||||
export const DENSITY_KEY = "archie.density";
|
||||
export const MOTION_KEY = "archie.motion";
|
||||
export const TOOLTIPS_KEY = "archie.tooltips";
|
||||
export const OVERSCROLL_KEY = "archie.overscroll";
|
||||
|
||||
export type Theme = "system" | "dark" | "light";
|
||||
export type Density = "comfortable" | "compact";
|
||||
@@ -57,6 +58,9 @@ export const useAppearanceStore = defineStore("appearance", () => {
|
||||
const tooltipsEnabled = ref(
|
||||
storedChoice(TOOLTIPS_KEY, ["on", "off"], "on") === "on",
|
||||
);
|
||||
const overscroll = ref(
|
||||
storedChoice(OVERSCROLL_KEY, ["on", "off"], "on") === "on",
|
||||
);
|
||||
let initialized = false;
|
||||
|
||||
function applyTheme(): void {
|
||||
@@ -86,10 +90,21 @@ export const useAppearanceStore = defineStore("appearance", () => {
|
||||
persist(TOOLTIPS_KEY, enabled ? "on" : "off");
|
||||
}
|
||||
|
||||
function applyOverscroll(): void {
|
||||
document.documentElement.dataset.overscroll = overscroll.value ? "on" : "off";
|
||||
}
|
||||
|
||||
function setOverscroll(enabled: boolean): void {
|
||||
overscroll.value = enabled;
|
||||
applyOverscroll();
|
||||
persist(OVERSCROLL_KEY, enabled ? "on" : "off");
|
||||
}
|
||||
|
||||
function initialize(): void {
|
||||
if (initialized) return;
|
||||
initialized = true;
|
||||
applyTheme();
|
||||
applyOverscroll();
|
||||
document.documentElement.dataset.density = density.value;
|
||||
document.documentElement.dataset.motion = motion.value;
|
||||
try {
|
||||
@@ -109,10 +124,12 @@ export const useAppearanceStore = defineStore("appearance", () => {
|
||||
density,
|
||||
motion,
|
||||
tooltipsEnabled,
|
||||
overscroll,
|
||||
initialize,
|
||||
setTheme,
|
||||
setDensity,
|
||||
setMotion,
|
||||
setTooltips,
|
||||
setOverscroll,
|
||||
};
|
||||
});
|
||||
@@ -26,6 +26,15 @@
|
||||
--spacing: 0.225rem;
|
||||
}
|
||||
|
||||
/* Room below the last line of a code view, so the end of a file can be
|
||||
scrolled up to the middle of the pane instead of pinned to its bottom edge. */
|
||||
:root {
|
||||
--code-overscroll: 0px;
|
||||
}
|
||||
[data-overscroll="on"] {
|
||||
--code-overscroll: 50vh;
|
||||
}
|
||||
|
||||
/*
|
||||
* Design tokens. Dark is the default because archied is a daemon you check at
|
||||
* odd hours; light is a toggle, not an afterthought, so both themes define the
|
||||
|
||||
@@ -544,7 +544,7 @@ function syncScroll(event: Event): void {
|
||||
name="workflow-yaml"
|
||||
required
|
||||
:readonly="archieWorking"
|
||||
class="relative min-h-96 resize-y max-md:h-full max-md:min-h-0 max-md:resize-none rounded-none border-0 bg-transparent py-3 pr-3 pl-14 text-[13px] leading-6 text-transparent caret-foreground shadow-none md:text-[13px] focus-visible:ring-0"
|
||||
class="relative min-h-96 resize-y max-md:h-full max-md:min-h-0 max-md:resize-none rounded-none border-0 bg-transparent pt-3 pr-3 pb-[calc(0.75rem+var(--code-overscroll))] pl-14 text-[13px] leading-6 text-transparent caret-foreground shadow-none md:text-[13px] focus-visible:ring-0"
|
||||
spellcheck="false"
|
||||
wrap="off"
|
||||
@scroll="syncScroll"
|
||||
|
||||
@@ -69,7 +69,7 @@ const CHANGE_VARIANTS = { added: "default", edited: "secondary", removed: "destr
|
||||
<RotateCcw data-icon="inline-start" /> Restore this version</Button>
|
||||
</div>
|
||||
<p v-if="then === null" class="rounded-lg border border-border p-4 text-sm text-fg-muted">Workflow removed in this revision.</p>
|
||||
<pre v-else-if="mode === 'yaml'" class="min-h-0 flex-1 overflow-auto rounded-lg border border-border py-2 font-mono text-[13px] leading-6"><code><span
|
||||
<pre v-else-if="mode === 'yaml'" class="min-h-0 flex-1 overflow-auto rounded-lg border border-border pt-2 pb-[calc(0.5rem+var(--code-overscroll))] font-mono text-[13px] leading-6"><code><span
|
||||
v-for="(line, i) in diff"
|
||||
:key="i"
|
||||
class="block min-h-6 px-3 whitespace-pre-wrap"
|
||||
|
||||
Reference in new issue
Block a user