Порівняти коміти

...
Автор SHA1 Повідомлення Дата
l0ng-ai 6d777382fd fix(ui): paint tree row tints as full-width bands
File colours, excluded folders and data source colours were painted as the
row's own background: inset from the tree's edges, rounded per row (file
colours) and dropped under hover and selection (data sources), so a run of
tinted rows read as a ragged stack instead of one block. The tint is now a
full-width band under the row; hover and selection stay rounded on top.
Excluded folders and data source colours use the same rowTint path.
2026-11-16 11:16:43 +08:00
6 змінених файлів з 25 додано та 58 видалено

No files matched your search

+2 -23
Переглянути файл
@@ -251,6 +251,8 @@
min-height: 0;
display: flex;
flex-direction: column;
/* Data source colours are stronger than file colours. */
--row-tint-strength: var(--tint-strength);
}
.treeHost > * {
flex: 1;
@@ -262,29 +264,6 @@
gap: var(--space-1-5);
min-width: 0;
}
/* The whole tree row, indent included, so a coloured source and its children form one band. */
.tintedRow:not([aria-selected="true"]):not(:hover) {
border-radius: 0;
background: color-mix(in srgb, var(--db-tint) var(--tint-strength), transparent);
}
.tintRed {
--db-tint: var(--db-color-red);
}
.tintOrange {
--db-tint: var(--db-color-orange);
}
.tintYellow {
--db-tint: var(--db-color-yellow);
}
.tintGreen {
--db-tint: var(--db-color-green);
}
.tintBlue {
--db-tint: var(--db-color-blue);
}
.tintViolet {
--db-tint: var(--db-color-violet);
}
.nodeLabel {
overflow: hidden;
text-overflow: ellipsis;
+5 -5
Переглянути файл
@@ -8,7 +8,6 @@ import { tablesKey, useDatabase } from "./store";
import { tableInput } from "./tableInput";
import { useEditorRegistry } from "@/editor/api";
import { provideEditorService, provideToolWindowService, type EditorInput } from "@/workbench/contributions";
import styles from "./Database.module.css";
vi.mock("@tanstack/react-virtual", () => ({
useVirtualizer: ({ count }: { count: number }) => ({
@@ -195,9 +194,10 @@ describe("data source colour", () => {
});
render(<DatabaseView />);
const tree = within(screen.getByRole("tree", { name: "Data sources" }));
for (const name of ["PostgreSQL", "public", "routines", "refresh_data"]) {
expect(tree.getByText(name).closest('[role="treeitem"]')).toHaveClass(styles.tintedRow!, styles.tintRed!);
}
expect(tree.getByText("SQLite").closest('[role="treeitem"]')).not.toHaveClass(styles.tintedRow!);
const tint = (name: string) =>
tree.getByText(name).closest<HTMLElement>('[role="treeitem"]')!.style.getPropertyValue("--row-tint");
for (const name of ["PostgreSQL", "public", "routines", "refresh_data"])
expect(tint(name)).toBe("var(--db-color-red)");
expect(tint("SQLite")).toBe("");
});
});
+3 -12
Переглянути файл
@@ -6,7 +6,7 @@
* source to open its query console.
*/
import { useEffect, useMemo, useRef } from "react";
import type { DbColor, DbDatabases, DbTableDetails } from "@/platform/ipc";
import type { DbDatabases, DbTableDetails } from "@/platform/ipc";
import { executeAction } from "@/platform/actions";
import { shortcutLabel } from "@/platform/keymap";
import {
@@ -55,15 +55,6 @@ import styles from "./Database.module.css";
import { tx } from "@/platform/i18n";
import { databaseRequest } from "./requests";
const ROW_TINTS: Record<DbColor, string | undefined> = {
red: styles.tintRed,
orange: styles.tintOrange,
yellow: styles.tintYellow,
green: styles.tintGreen,
blue: styles.tintBlue,
violet: styles.tintViolet,
};
const GROUP_LABELS: Record<Group, string> = {
columns: "columns",
keys: "keys",
@@ -525,11 +516,11 @@ export function DatabaseView() {
getIcon={(n) => icon(n)}
getDetail={detail}
getColor={(n) => (n.kind === "message" && n.error ? "var(--danger)" : undefined)}
rowClassName={(n) => {
rowTint={(n) => {
// IDEA tints every row of a coloured data source across its full width and height.
const target = nodeTarget(n);
const color = target ? sourceOf(target)?.color : null;
return color ? `${styles.tintedRow} ${ROW_TINTS[color]}` : undefined;
return color ? `var(--db-color-${color})` : undefined;
}}
speedSearchField
renderNode={(n: Node, state) => {
-3
Переглянути файл
@@ -56,9 +56,6 @@
.excluded {
color: var(--vcs-ignored);
}
.excludedRow {
background: color-mix(in srgb, var(--vcs-ignored) 14%, transparent);
}
.error {
text-decoration-line: underline;
text-decoration-style: wavy;
+4 -5
Переглянути файл
@@ -436,6 +436,8 @@ interface DragState {
}
const DRAG_THRESHOLD = 4;
/** IDEA's "excluded" look: excluded folders and what is under them get a muted band. */
const EXCLUDED_TINT = "var(--vcs-ignored)";
/** Folder under a viewport point inside `container` (a file row resolves to its folder). */
function folderAt(container: HTMLElement | null, x: number, y: number): { key: string; path: string } | null {
@@ -873,11 +875,8 @@ export function ProjectView() {
isExpandable={isExpandable}
loadChildren={loadChildren}
renderNode={renderNode}
rowClassName={(n) => (n.excluded ? styles.excludedRow : undefined)}
rowTint={
fileColors
? (n) => (n.excluded || n.group || n.placeholder ? undefined : fileColors(n.path, n.dir))
: undefined
rowTint={(n) =>
n.excluded ? EXCLUDED_TINT : n.group || n.placeholder ? undefined : fileColors?.(n.path, n.dir)
}
expanded={expanded}
onExpandedChange={onExpandedChange}
+11 -10
Переглянути файл
@@ -39,6 +39,8 @@
.sizer {
position: relative;
width: 100%;
/* Keeps the tint bands of rows above the tree's background. */
isolation: isolate;
}
.row {
position: absolute;
@@ -68,16 +70,15 @@
.row:hover {
background: var(--bg-tree-hover, color-mix(in srgb, var(--fg-strong) 4%, transparent));
}
/* File Colors: the row's background takes its scope's colour. */
.tinted {
background: color-mix(in srgb, var(--row-tint) var(--file-tint-strength, 14%), transparent);
}
.tinted:hover {
background: color-mix(
in srgb,
var(--row-tint) var(--file-tint-strength, 14%),
var(--bg-tree-hover, color-mix(in srgb, var(--fg-strong) 4%, transparent))
);
/* File Colors: a full-width band under the row, so runs of tinted rows read as one block;
hover and selection stay rounded on top of it. */
.tinted::before {
content: "";
position: absolute;
inset: 0 calc(-1 * var(--tree-inset, 6px));
z-index: -1;
background: color-mix(in srgb, var(--row-tint) var(--row-tint-strength, var(--file-tint-strength, 14%)), transparent);
pointer-events: none;
}
/* Tree.selectionInactiveBackground when unfocused, selectionBackground when focused. */
.selected,