feat(grid): compare original and edited JSON values

Closes #1638
This commit is contained in:
t8y2 committed 2026-08-24 23:25:24 +00:00
1 parent b3e8709272
commit efba56c8c0
22 files changed
+814 -339

No files matched your search

@@ -1,13 +1,13 @@
<script setup lang="ts">
import { computed, nextTick, onUnmounted, ref, watch, type CSSProperties } from "vue";
import { AlertCircle, Copy, FileDiff } from "@lucide/vue";
import { computed, ref, watch } from "vue";
import { AlertCircle, FileDiff } from "@lucide/vue";
import { useI18n } from "vue-i18n";
import { Button } from "@/components/ui/button";
import { Dialog, DialogContent, DialogHeader, DialogTitle } from "@/components/ui/dialog";
import DoltScrollArea from "@/components/dolt/DoltScrollArea.vue";
import SideBySideTextDiff, { type TextDiffSide } from "@/components/common/SideBySideTextDiff.vue";
import { useToast } from "@/composables/useToast";
import { copyToClipboard } from "@/lib/common/clipboard";
import { buildDoltTextDiff, detectDoltCellFormat, doltCellCopyText, doltCellDisplayValue, formatDoltCellText, type DoltCellFormat, type DoltCellFormatMode, type DoltCellSide, type DoltDiffCellTarget, type DoltTextDiffKind } from "@/lib/dolt/doltCellDiff";
import { detectDoltCellFormat, doltCellCopyText, doltCellDisplayValue, formatDoltCellText, type DoltCellFormat, type DoltCellFormatMode, type DoltDiffCellTarget } from "@/lib/dolt/doltCellDiff";
const props = defineProps<{
target: DoltDiffCellTarget | null;
@@ -20,15 +20,6 @@ const open = defineModel<boolean>("open", { default: false });
const { t } = useI18n();
const { toast } = useToast();
const formatMode = ref<DoltCellFormatMode>("auto");
const beforeScrollArea = ref<InstanceType<typeof DoltScrollArea> | null>(null);
const afterScrollArea = ref<InstanceType<typeof DoltScrollArea> | null>(null);
const scrollTop = ref(0);
const viewportHeight = ref(0);
let scrollSyncing = false;
let scrollSyncFrame = 0;
const ROW_HEIGHT = 22;
const ROW_BUFFER = 12;
const displayLabels = computed(() => ({
nullValue: t("doltVersionControl.cellNullValue"),
@@ -41,24 +32,6 @@ const detectedFormat = computed<DoltCellFormat>(() => detectDoltCellFormat([befo
const effectiveFormat = computed<DoltCellFormat>(() => (formatMode.value === "auto" ? detectedFormat.value : formatMode.value));
const beforeFormatted = computed(() => (beforeDisplay.value ? formatDoltCellText(beforeDisplay.value, effectiveFormat.value) : { text: "", error: null }));
const afterFormatted = computed(() => (afterDisplay.value ? formatDoltCellText(afterDisplay.value, effectiveFormat.value) : { text: "", error: null }));
const diffRows = computed(() => {
const rows = buildDoltTextDiff(beforeFormatted.value.text, afterFormatted.value.text);
if (beforeDisplay.value?.state !== "value" && afterDisplay.value?.state === "value") return rows.map((row) => ({ ...row, kind: "added" as const }));
if (afterDisplay.value?.state !== "value" && beforeDisplay.value?.state === "value") return rows.map((row) => ({ ...row, kind: "removed" as const }));
return rows;
});
const visibleStart = computed(() => Math.max(0, Math.floor(scrollTop.value / ROW_HEIGHT) - ROW_BUFFER));
const visibleEnd = computed(() => Math.min(diffRows.value.length, Math.ceil((scrollTop.value + viewportHeight.value) / ROW_HEIGHT) + ROW_BUFFER));
const visibleRows = computed(() => diffRows.value.slice(visibleStart.value, visibleEnd.value).map((row, offset) => ({ row, index: visibleStart.value + offset })));
const longestLineLength = computed(() => {
let maximum = 0;
for (const row of diffRows.value) maximum = Math.max(maximum, row.beforeText.length, row.afterText.length);
return Math.min(20_000, maximum);
});
const textContentStyle = computed<CSSProperties>(() => ({
height: `${Math.max(1, diffRows.value.length * ROW_HEIGHT)}px`,
width: `max(100%, ${Math.max(40, longestLineLength.value + 8)}ch)`,
}));
const formatOptions = computed<Array<{ value: DoltCellFormatMode; label: string }>>(() => [
{ value: "auto", label: t("doltVersionControl.cellDiffFormatAuto") },
{ value: "raw", label: t("doltVersionControl.cellDiffFormatRaw") },
@@ -66,38 +39,7 @@ const formatOptions = computed<Array<{ value: DoltCellFormatMode; label: string
{ value: "xml", label: "XML" },
]);
function rowClass(kind: DoltTextDiffKind, side: DoltCellSide): string {
if (kind === "modified") return "dolt-cell-text-row-modified";
if (kind === "added" && side === "after") return "dolt-cell-text-row-added";
if (kind === "removed" && side === "before") return "dolt-cell-text-row-removed";
return "";
}
function updateViewport(element: HTMLElement) {
scrollTop.value = element.scrollTop;
viewportHeight.value = element.clientHeight;
}
function syncScroll(side: DoltCellSide, source: HTMLElement) {
updateViewport(source);
if (scrollSyncing) return;
const target = side === "before" ? afterScrollArea.value?.scrollerElement() : beforeScrollArea.value?.scrollerElement();
if (!target) return;
scrollSyncing = true;
target.scrollTop = source.scrollTop;
target.scrollLeft = source.scrollLeft;
if (scrollSyncFrame) cancelAnimationFrame(scrollSyncFrame);
scrollSyncFrame = requestAnimationFrame(() => {
scrollSyncFrame = 0;
scrollSyncing = false;
});
}
function onResize(element: HTMLElement) {
viewportHeight.value = Math.max(viewportHeight.value, element.clientHeight);
}
async function copyValue(side: DoltCellSide) {
async function copyValue(side: TextDiffSide) {
if (!props.target) return;
const value = doltCellCopyText(props.target, side);
if (value === null) return;
@@ -111,28 +53,11 @@ async function copyValue(side: DoltCellSide) {
watch(
() => [open.value, props.target?.rowIndex, props.target?.columnIndex, props.target?.side],
async ([isOpen]) => {
([isOpen]) => {
if (!isOpen) return;
formatMode.value = "auto";
scrollTop.value = 0;
await nextTick();
const before = beforeScrollArea.value?.scrollerElement();
const after = afterScrollArea.value?.scrollerElement();
if (before) before.scrollTo({ top: 0, left: 0 });
if (after) after.scrollTo({ top: 0, left: 0 });
},
);
watch(effectiveFormat, async () => {
scrollTop.value = 0;
await nextTick();
beforeScrollArea.value?.scrollerElement()?.scrollTo({ top: 0, left: 0 });
afterScrollArea.value?.scrollerElement()?.scrollTo({ top: 0, left: 0 });
});
onUnmounted(() => {
if (scrollSyncFrame) cancelAnimationFrame(scrollSyncFrame);
});
</script>
<template>
@@ -167,104 +92,17 @@ onUnmounted(() => {
</div>
</div>
<div class="grid min-h-0 flex-1 grid-cols-2 overflow-hidden">
<section class="flex min-w-0 min-h-0 flex-col border-r">
<div class="flex h-8 shrink-0 items-center gap-2 border-b bg-muted/20 px-2 text-[11px]">
<span class="min-w-0 flex-1 truncate font-mono text-muted-foreground" :title="fromRevision">{{ fromRevision }}</span>
<Button variant="ghost" size="icon" class="h-6 w-6" :disabled="doltCellCopyText(target, 'before') === null" :title="t('doltVersionControl.copyBeforeValue')" @click="copyValue('before')"><Copy class="h-3 w-3" /></Button>
</div>
<DoltScrollArea ref="beforeScrollArea" class="min-h-0 flex-1" scroller-class="dolt-cell-diff-before-scroller" @scroll="syncScroll('before', $event)" @resize="onResize">
<div class="dolt-cell-text-content" :style="textContentStyle">
<div v-for="visible in visibleRows" :key="`before-${visible.index}`" class="dolt-cell-text-row" :class="rowClass(visible.row.kind, 'before')" :style="{ top: `${visible.index * ROW_HEIGHT}px`, height: `${ROW_HEIGHT}px` }">
<span class="dolt-cell-text-line-number">{{ visible.row.beforeLineNumber ?? "" }}</span>
<code class="dolt-cell-text-code"
><template v-for="(segment, index) in visible.row.beforeSegments" :key="index"
><span :class="{ 'dolt-cell-text-segment-changed': segment.changed }">{{ segment.text }}</span></template
>&nbsp;</code
>
</div>
</div>
</DoltScrollArea>
</section>
<section class="flex min-w-0 min-h-0 flex-col">
<div class="flex h-8 shrink-0 items-center gap-2 border-b bg-muted/20 px-2 text-[11px]">
<span class="min-w-0 flex-1 truncate font-mono text-muted-foreground" :title="toRevision">{{ toRevision }}</span>
<Button variant="ghost" size="icon" class="h-6 w-6" :disabled="doltCellCopyText(target, 'after') === null" :title="t('doltVersionControl.copyAfterValue')" @click="copyValue('after')"><Copy class="h-3 w-3" /></Button>
</div>
<DoltScrollArea ref="afterScrollArea" class="min-h-0 flex-1" scroller-class="dolt-cell-diff-after-scroller" @scroll="syncScroll('after', $event)" @resize="onResize">
<div class="dolt-cell-text-content" :style="textContentStyle">
<div v-for="visible in visibleRows" :key="`after-${visible.index}`" class="dolt-cell-text-row" :class="rowClass(visible.row.kind, 'after')" :style="{ top: `${visible.index * ROW_HEIGHT}px`, height: `${ROW_HEIGHT}px` }">
<span class="dolt-cell-text-line-number">{{ visible.row.afterLineNumber ?? "" }}</span>
<code class="dolt-cell-text-code"
><template v-for="(segment, index) in visible.row.afterSegments" :key="index"
><span :class="{ 'dolt-cell-text-segment-changed': segment.changed }">{{ segment.text }}</span></template
>&nbsp;</code
>
</div>
</div>
</DoltScrollArea>
</section>
</div>
<SideBySideTextDiff
:before-text="beforeFormatted.text"
:after-text="afterFormatted.text"
:before-label="fromRevision"
:after-label="toRevision"
:copy-before-title="t('doltVersionControl.copyBeforeValue')"
:copy-after-title="t('doltVersionControl.copyAfterValue')"
:before-available="beforeDisplay?.state === 'value'"
:after-available="afterDisplay?.state === 'value'"
@copy="copyValue"
/>
</DialogContent>
</Dialog>
</template>
<style scoped>
.dolt-cell-text-content {
position: relative;
min-width: 100%;
font-family: var(--font-mono);
font-size: 12px;
}
.dolt-cell-text-row {
position: absolute;
left: 0;
display: flex;
width: 100%;
min-width: 100%;
align-items: center;
border-bottom: 1px solid color-mix(in srgb, var(--border) 45%, transparent);
line-height: 21px;
}
.dolt-cell-text-line-number {
position: sticky;
left: 0;
z-index: 1;
width: 48px;
height: 100%;
flex: 0 0 48px;
border-right: 1px solid var(--border);
background: var(--background);
padding-right: 8px;
text-align: right;
color: var(--muted-foreground);
user-select: none;
}
.dolt-cell-text-code {
display: block;
min-width: 0;
padding: 0 8px;
white-space: pre;
font-family: inherit;
}
.dolt-cell-text-row-modified {
background: rgb(217 119 6 / 0.11);
}
.dolt-cell-text-row-added {
background: rgb(22 163 74 / 0.11);
}
.dolt-cell-text-row-removed {
background: rgb(220 38 38 / 0.1);
}
.dolt-cell-text-row-modified .dolt-cell-text-segment-changed {
background: rgb(217 119 6 / 0.32);
}
</style>
@@ -1,6 +1,6 @@
<script setup lang="ts">
import { computed, nextTick, onMounted, onUnmounted, ref, watch, type CSSProperties } from "vue";
import DoltScrollArea from "@/components/dolt/DoltScrollArea.vue";
import VirtualScrollArea from "@/components/common/VirtualScrollArea.vue";
import type { QueryResult } from "@/types/database";
import type { DoltDiffColumnKind, DoltDiffRow } from "@/lib/dolt/doltVersionControl";
import type { DoltDiffCellTarget } from "@/lib/dolt/doltCellDiff";
@@ -32,7 +32,7 @@ const COLUMN_BUFFER = 240;
const minimumColumnWidth = 72;
const maximumColumnWidth = 360;
const scrollArea = ref<InstanceType<typeof DoltScrollArea> | null>(null);
const scrollArea = ref<InstanceType<typeof VirtualScrollArea> | null>(null);
const measuredWidths = ref<number[]>([]);
const scrollTop = ref(0);
const scrollLeft = ref(0);
@@ -227,7 +227,7 @@ onUnmounted(() => {
</script>
<template>
<DoltScrollArea ref="scrollArea" class="min-h-0 flex-1" scroller-class="dolt-diff-table-scroller" @scroll="onScroll" @resize="updateViewport">
<VirtualScrollArea ref="scrollArea" class="min-h-0 flex-1" scroller-class="dolt-diff-table-scroller" @scroll="onScroll" @resize="updateViewport">
<div class="dolt-diff-table-content" :style="contentStyle">
<div class="dolt-diff-table-header" :style="{ width: `${Math.max(totalWidth, 1)}px`, height: '28px' }">
<div v-for="column in visibleColumns" :key="`header-${column.index}-${column.column}`" class="dolt-diff-table-header-cell" :class="headerClass?.(column.index, column.column)" :data-column-kind="column.kind" :style="{ left: `${column.left}px`, width: `${column.width}px` }">
@@ -258,7 +258,7 @@ onUnmounted(() => {
</div>
<div v-if="rows.length === 0" class="dolt-diff-table-empty">{{ $t("doltVersionControl.noRowChanges") }}</div>
</div>
</DoltScrollArea>
</VirtualScrollArea>
</template>
<style scoped>
@@ -1,7 +1,7 @@
<script setup lang="ts">
import { computed, nextTick, onMounted, onUnmounted, ref, watch } from "vue";
import { Check, ChevronDown, GitBranch, Tag } from "@lucide/vue";
import DoltScrollArea from "@/components/dolt/DoltScrollArea.vue";
import VirtualScrollArea from "@/components/common/VirtualScrollArea.vue";
import type { DoltRef } from "@/lib/dolt/doltVersionControl";
const props = defineProps<{
@@ -153,7 +153,7 @@ onUnmounted(() => document.removeEventListener("pointerdown", onDocumentPointerD
</div>
<div v-if="open && filteredOptions.length" class="dolt-revision-selector-options" role="listbox">
<DoltScrollArea class="max-h-[240px]" scroller-class="p-[3px]">
<VirtualScrollArea class="max-h-[240px]" scroller-class="p-[3px]">
<button
v-for="(option, index) in filteredOptions"
:key="`${option.kind}:${option.name}`"
@@ -170,7 +170,7 @@ onUnmounted(() => document.removeEventListener("pointerdown", onDocumentPointerD
<span class="min-w-0 flex-1 truncate font-mono text-[11px]">{{ option.name }}</span>
<Check v-if="option.name === modelValue" class="h-3.5 w-3.5 text-primary" />
</button>
</DoltScrollArea>
</VirtualScrollArea>
</div>
</div>
</template>
@@ -1,272 +0,0 @@
<script setup lang="ts">
import { nextTick, onMounted, onUnmounted, ref } from "vue";
const props = defineProps<{
scrollerClass?: string;
}>();
const emit = defineEmits<{
scroll: [element: HTMLElement];
resize: [element: HTMLElement];
}>();
const scroller = ref<HTMLElement | null>(null);
const horizontalThumb = ref<HTMLElement | null>(null);
const verticalThumb = ref<HTMLElement | null>(null);
const hasHorizontalOverflow = ref(false);
const hasVerticalOverflow = ref(false);
let horizontalThumbLeft = 0;
let horizontalThumbWidth = 100;
let verticalThumbTop = 0;
let verticalThumbHeight = 100;
let resizeObserver: ResizeObserver | undefined;
let mutationObserver: MutationObserver | undefined;
let refreshFrame = 0;
let dragFrame = 0;
let pendingDragPosition = 0;
let dragState:
| {
axis: "horizontal" | "vertical";
track: HTMLElement;
trackRect: DOMRect;
thumbOffset: number;
maxScroll: number;
}
| undefined;
function applyThumbStyles() {
if (horizontalThumb.value) {
horizontalThumb.value.style.left = `${horizontalThumbLeft}%`;
horizontalThumb.value.style.width = `${horizontalThumbWidth}%`;
}
if (verticalThumb.value) {
verticalThumb.value.style.top = `${verticalThumbTop}%`;
verticalThumb.value.style.height = `${verticalThumbHeight}%`;
}
}
function updateMetrics(emitResize = false) {
const element = scroller.value;
if (!element) return;
const maxScrollLeft = Math.max(0, element.scrollWidth - element.clientWidth);
const maxScrollTop = Math.max(0, element.scrollHeight - element.clientHeight);
hasHorizontalOverflow.value = maxScrollLeft > 1;
hasVerticalOverflow.value = maxScrollTop > 1;
const rawHorizontalWidth = element.scrollWidth > 0 ? (element.clientWidth / element.scrollWidth) * 100 : 100;
horizontalThumbWidth = Math.min(100, Math.max(6, rawHorizontalWidth));
horizontalThumbLeft = maxScrollLeft > 0 ? (element.scrollLeft / maxScrollLeft) * Math.max(0, 100 - horizontalThumbWidth) : 0;
const rawVerticalHeight = element.scrollHeight > 0 ? (element.clientHeight / element.scrollHeight) * 100 : 100;
verticalThumbHeight = Math.min(100, Math.max(6, rawVerticalHeight));
verticalThumbTop = maxScrollTop > 0 ? (element.scrollTop / maxScrollTop) * Math.max(0, 100 - verticalThumbHeight) : 0;
nextTick(applyThumbStyles);
if (emitResize) emit("resize", element);
}
function scheduleMetricsRefresh(emitResize = false) {
if (refreshFrame) cancelAnimationFrame(refreshFrame);
refreshFrame = requestAnimationFrame(() => {
refreshFrame = 0;
updateMetrics(emitResize);
});
}
function onScroll() {
const element = scroller.value;
if (!element) return;
updateMetrics();
emit("scroll", element);
}
function applyDrag() {
dragFrame = 0;
const state = dragState;
const element = scroller.value;
if (!state || !element) return;
const trackLength = state.axis === "horizontal" ? state.trackRect.width : state.trackRect.height;
const thumbPercent = state.axis === "horizontal" ? horizontalThumbWidth : verticalThumbHeight;
const thumbLength = trackLength * (thumbPercent / 100);
const maximumThumbPosition = Math.max(1, trackLength - thumbLength);
const pointerPosition = pendingDragPosition - (state.axis === "horizontal" ? state.trackRect.left : state.trackRect.top);
const thumbPosition = Math.min(maximumThumbPosition, Math.max(0, pointerPosition - state.thumbOffset));
const scrollPosition = (thumbPosition / maximumThumbPosition) * state.maxScroll;
if (state.axis === "horizontal") element.scrollLeft = scrollPosition;
else element.scrollTop = scrollPosition;
onScroll();
}
function onDragMove(event: PointerEvent) {
if (!dragState) return;
event.preventDefault();
pendingDragPosition = dragState.axis === "horizontal" ? event.clientX : event.clientY;
if (!dragFrame) dragFrame = requestAnimationFrame(applyDrag);
}
function stopDrag() {
if (!dragState) return;
if (dragFrame) {
cancelAnimationFrame(dragFrame);
applyDrag();
}
dragState.track.classList.remove("dolt-scrollbar-dragging");
dragState = undefined;
document.body.style.userSelect = "";
window.removeEventListener("pointermove", onDragMove, true);
window.removeEventListener("pointerup", stopDrag, true);
window.removeEventListener("pointercancel", stopDrag, true);
}
function startDrag(axis: "horizontal" | "vertical", event: PointerEvent) {
const element = scroller.value;
const track = event.currentTarget as HTMLElement;
if (!element) return;
const maxScroll = axis === "horizontal" ? element.scrollWidth - element.clientWidth : element.scrollHeight - element.clientHeight;
if (maxScroll <= 1) return;
const trackRect = track.getBoundingClientRect();
const trackLength = axis === "horizontal" ? trackRect.width : trackRect.height;
const thumbPercent = axis === "horizontal" ? horizontalThumbWidth : verticalThumbHeight;
const thumbStartPercent = axis === "horizontal" ? horizontalThumbLeft : verticalThumbTop;
const thumbLength = trackLength * (thumbPercent / 100);
const thumbStart = trackLength * (thumbStartPercent / 100);
const pointerPosition = axis === "horizontal" ? event.clientX - trackRect.left : event.clientY - trackRect.top;
const pointerInsideThumb = pointerPosition >= thumbStart && pointerPosition <= thumbStart + thumbLength;
dragState = {
axis,
track,
trackRect,
thumbOffset: pointerInsideThumb ? pointerPosition - thumbStart : thumbLength / 2,
maxScroll,
};
pendingDragPosition = axis === "horizontal" ? event.clientX : event.clientY;
track.classList.add("dolt-scrollbar-dragging");
document.body.style.userSelect = "none";
window.addEventListener("pointermove", onDragMove, true);
window.addEventListener("pointerup", stopDrag, true);
window.addEventListener("pointercancel", stopDrag, true);
event.preventDefault();
applyDrag();
}
function scrollerElement(): HTMLElement | null {
return scroller.value;
}
defineExpose({ scrollerElement, refresh: scheduleMetricsRefresh });
onMounted(() => {
updateMetrics(true);
resizeObserver = new ResizeObserver(() => scheduleMetricsRefresh(true));
if (scroller.value) resizeObserver.observe(scroller.value);
mutationObserver = new MutationObserver(() => scheduleMetricsRefresh(true));
if (scroller.value) mutationObserver.observe(scroller.value, { childList: true, subtree: true, characterData: true, attributes: true, attributeFilter: ["class", "style"] });
});
onUnmounted(() => {
stopDrag();
resizeObserver?.disconnect();
mutationObserver?.disconnect();
if (refreshFrame) cancelAnimationFrame(refreshFrame);
});
</script>
<template>
<div class="dolt-scroll-area">
<div ref="scroller" class="dolt-scroll-area-scroller" :class="props.scrollerClass" @scroll.passive="onScroll">
<slot />
</div>
<div v-if="hasHorizontalOverflow" class="dolt-horizontal-scrollbar" @pointerdown="startDrag('horizontal', $event)">
<div ref="horizontalThumb" class="dolt-horizontal-scrollbar-thumb" />
</div>
<div v-if="hasVerticalOverflow" class="dolt-vertical-scrollbar" :class="{ 'dolt-vertical-scrollbar-with-horizontal': hasHorizontalOverflow }" @pointerdown="startDrag('vertical', $event)">
<div ref="verticalThumb" class="dolt-vertical-scrollbar-thumb" />
</div>
</div>
</template>
<style scoped>
.dolt-scroll-area {
position: relative;
display: flex;
min-width: 0;
min-height: 0;
flex-direction: column;
overflow: hidden;
}
.dolt-scroll-area-scroller {
min-width: 0;
min-height: 0;
flex: 1;
overflow: auto;
overscroll-behavior: none;
scrollbar-width: none;
}
.dolt-scroll-area-scroller::-webkit-scrollbar {
display: none;
}
.dolt-horizontal-scrollbar {
position: relative;
height: 10px;
flex: 0 0 10px;
cursor: pointer;
touch-action: none;
background: var(--background);
}
.dolt-horizontal-scrollbar-thumb {
position: absolute;
top: 3px;
height: 4px;
min-width: 24px;
border-radius: 999px;
background: color-mix(in oklab, var(--foreground) 30%, transparent);
transition:
top 120ms ease,
height 120ms ease,
background-color 120ms ease;
}
.dolt-horizontal-scrollbar:hover .dolt-horizontal-scrollbar-thumb,
.dolt-horizontal-scrollbar.dolt-scrollbar-dragging .dolt-horizontal-scrollbar-thumb {
top: 2px;
height: 6px;
background: color-mix(in oklab, var(--foreground) 48%, transparent);
}
.dolt-vertical-scrollbar {
position: absolute;
top: 2px;
right: 0;
bottom: 2px;
z-index: 5;
width: 10px;
cursor: pointer;
touch-action: none;
}
.dolt-vertical-scrollbar-with-horizontal {
bottom: 12px;
}
.dolt-vertical-scrollbar-thumb {
position: absolute;
right: 3px;
width: 4px;
min-height: 24px;
border-radius: 999px;
background: color-mix(in oklab, var(--foreground) 30%, transparent);
transition:
right 120ms ease,
width 120ms ease,
background-color 120ms ease;
}
.dolt-vertical-scrollbar:hover .dolt-vertical-scrollbar-thumb,
.dolt-vertical-scrollbar.dolt-scrollbar-dragging .dolt-vertical-scrollbar-thumb {
right: 2px;
width: 6px;
background: color-mix(in oklab, var(--foreground) 48%, transparent);
}
</style>
@@ -14,7 +14,7 @@ import DoltDiffPagination from "@/components/dolt/DoltDiffPagination.vue";
import DoltDiffTable from "@/components/dolt/DoltDiffTable.vue";
import DoltCellDiffDialog from "@/components/dolt/DoltCellDiffDialog.vue";
import DoltRevisionSelector from "@/components/dolt/DoltRevisionSelector.vue";
import DoltScrollArea from "@/components/dolt/DoltScrollArea.vue";
import VirtualScrollArea from "@/components/common/VirtualScrollArea.vue";
import * as api from "@/lib/backend/api";
import { filterDatabaseNamesForVisiblePicker } from "@/lib/database/visibleDatabases";
import type { QueryResult } from "@/types/database";
@@ -1264,7 +1264,7 @@ onUnmounted(() => {
<span class="truncate">{{ t("doltVersionControl.changedTables") }}</span>
<span v-if="changes.length" class="ml-auto text-[11px] text-muted-foreground">{{ changes.length }}</span>
</div>
<DoltScrollArea class="min-h-0 flex-1">
<VirtualScrollArea class="min-h-0 flex-1">
<div v-if="comparisonLoading && changes.length === 0" class="flex h-24 items-center justify-center gap-2 text-xs text-muted-foreground"><Loader2 class="h-4 w-4 animate-spin" />{{ t("doltVersionControl.loadingDiff") }}</div>
<div v-else-if="comparisonError" class="p-3 text-xs text-destructive">{{ comparisonError }}</div>
<div v-else-if="changes.length === 0" class="flex h-24 items-center justify-center px-3 text-center text-xs text-muted-foreground">{{ t("doltVersionControl.noChanges") }}</div>
@@ -1276,7 +1276,7 @@ onUnmounted(() => {
<span v-for="flag in changeFlags(change)" :key="flag" class="dolt-change-flag">{{ changeFlagSymbol(flag) }}</span>
</span>
</button>
</DoltScrollArea>
</VirtualScrollArea>
</section>
</Pane>
@@ -1376,7 +1376,7 @@ onUnmounted(() => {
</TabsList>
</div>
<TabsContent value="branches" class="m-0 min-h-0 flex-1 overflow-hidden">
<DoltScrollArea class="h-full min-h-0" scroller-class="py-1 text-xs">
<VirtualScrollArea class="h-full min-h-0" scroller-class="py-1 text-xs">
<template v-if="branchTreeView">
<CustomContextMenu v-for="row in branchTreeRows" :key="`branch-tree-${row.key}`" :items="() => branchTreeRowContextMenuItems(row)" v-slot="{ onContextMenu, isOpen }">
<button
@@ -1419,10 +1419,10 @@ onUnmounted(() => {
</CustomContextMenu>
</template>
<div v-if="visibleBranches.length === 0" class="px-7 py-2 text-muted-foreground">{{ t("doltVersionControl.noBranches") }}</div>
</DoltScrollArea>
</VirtualScrollArea>
</TabsContent>
<TabsContent value="tags" class="m-0 min-h-0 flex-1 overflow-hidden">
<DoltScrollArea class="h-full min-h-0" scroller-class="py-1 text-xs">
<VirtualScrollArea class="h-full min-h-0" scroller-class="py-1 text-xs">
<CustomContextMenu v-for="item in visibleTags" :key="`tag-${item.name}`" :items="() => refContextMenuItems(item)" v-slot="{ onContextMenu, isOpen }">
<button
type="button"
@@ -1436,14 +1436,14 @@ onUnmounted(() => {
</button>
</CustomContextMenu>
<div v-if="visibleTags.length === 0" class="px-7 py-2 text-muted-foreground">{{ t("doltVersionControl.noTags") }}</div>
</DoltScrollArea>
</VirtualScrollArea>
</TabsContent>
</Tabs>
</aside>
</Pane>
<Pane :size="100 - doltLeftPaneSize" :min-size="100 - DOLT_LEFT_PANE_MAX_SIZE">
<DoltScrollArea class="relative h-full min-h-0">
<VirtualScrollArea class="relative h-full min-h-0">
<div class="dolt-commit-header sticky top-0 z-20 grid h-7 items-center border-b bg-muted/80 text-[11px] font-medium text-muted-foreground backdrop-blur" :style="{ gridTemplateColumns: `${graphWidth}px minmax(240px, 1fr) 150px 155px` }">
<span class="px-2">{{ t("doltVersionControl.graph") }}</span>
<span class="px-2">{{ t("doltVersionControl.commit") }}</span>
@@ -1512,7 +1512,7 @@ onUnmounted(() => {
</button>
</CustomContextMenu>
</div>
</DoltScrollArea>
</VirtualScrollArea>
</Pane>
</Splitpanes>
</Pane>