Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
37 changes: 27 additions & 10 deletions apps/tauri/src/ui/ConnectionHome.vue
Original file line number Diff line number Diff line change
Expand Up @@ -169,28 +169,28 @@ function openRelation(o: { id: string; name: string; kind: string; schema?: stri
<section v-else class="chips" aria-label="Database info">
<div class="chip">
<span class="chip-ico" aria-hidden="true">ⓘ</span>
<div>
<div class="chip-body">
<span class="chip-l">SQLite Version</span>
<span class="chip-v">{{ overview?.version || "—" }}</span>
</div>
</div>
<div class="chip">
<span class="chip-ico" aria-hidden="true">▤</span>
<div>
<div class="chip-body">
<span class="chip-l">Database Size</span>
<span class="chip-v">{{ sizeLabel }}</span>
</div>
</div>
<div class="chip">
<span class="chip-ico" aria-hidden="true">▦</span>
<div>
<div class="chip-body">
<span class="chip-l">Pages / Page Size</span>
<span class="chip-v">{{ pagesLabel }}</span>
</div>
</div>
<div class="chip">
<span class="chip-ico" aria-hidden="true">↺</span>
<div>
<div class="chip-body">
<span class="chip-l">Journal Mode</span>
<span class="chip-v">{{ overview?.journal_mode || "—" }}</span>
</div>
Expand Down Expand Up @@ -380,29 +380,41 @@ h1 {
min-height: 88px;
display: flex;
gap: 12px;
align-items: flex-start;
align-items: center;
padding: 12px 16px;
border-radius: 10px;
background: var(--q-card);
border: 1px solid color-mix(in srgb, var(--q-border) 50%, transparent);
}

.chip-ico {
margin-top: 2px;
flex: 0 0 auto;
width: 20px;
text-align: center;
color: var(--q-primary);
font-size: 16px;
line-height: 1;
}

.chip-body {
flex: 1;
min-width: 0;
display: flex;
flex-direction: column;
justify-content: center;
gap: 2px;
}

.chip-l {
display: block;
font-size: 11px;
line-height: 1.35;
letter-spacing: 0.01em;
color: var(--q-muted-foreground);
}

.chip-v {
display: block;
margin-top: 2px;
font-size: 13px;
font-weight: 600;
color: var(--q-foreground);
Expand Down Expand Up @@ -468,24 +480,29 @@ h1 {
padding: 6px 10px;
border-radius: 6px;
border: 1px solid color-mix(in srgb, var(--q-border) 30%, transparent);
background: color-mix(in srgb, var(--q-muted-foreground) 14%, transparent);
background: color-mix(in srgb, var(--q-muted) 40%, transparent);
color: var(--q-foreground);
font: inherit;
font-size: 12.5px;
font-size: 13px;
line-height: 1.25;
cursor: pointer;
}

.table-chip:hover {
background: color-mix(in srgb, var(--q-muted-foreground) 28%, transparent);
background: color-mix(in srgb, var(--q-muted) 70%, transparent);
}

.table-chip.view {
opacity: 0.95;
}

.t-ico {
flex: 0 0 auto;
width: 14px;
text-align: center;
color: var(--q-primary);
font-size: 12px;
line-height: 1;
}

.sql-park {
Expand Down
11 changes: 11 additions & 0 deletions apps/tauri/src/ui/glide/ResultDataEditor.ts
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ export function ResultDataEditor(props: ResultDataEditorProps): ReactElement {
);

const muted = theme.textMedium ?? theme.textLight ?? "#94a3b8";
const stripeBg = theme.bgCellMedium;

const getCellContent = useCallback(
([col, row]: Item): GridCell => {
Expand All @@ -57,10 +58,20 @@ export function ResultDataEditor(props: ResultDataEditorProps): ReactElement {
[rows, muted],
);

// Flutter grid: odd rows use muted @ 0.12 (chessboard readability).
const getRowThemeOverride = useCallback(
(row: number): Partial<Theme> | undefined => {
if (row % 2 === 0 || !stripeBg) return undefined;
return { bgCell: stripeBg };
},
[stripeBg],
);

return createElement(DataEditor, {
columns: gridColumns,
rows: rows.length,
getCellContent,
getRowThemeOverride,
width,
height,
theme,
Expand Down
40 changes: 33 additions & 7 deletions apps/tauri/src/ui/glide/queryaGlideTheme.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,13 +19,33 @@ function withAlpha(hexOrCss: string, alpha: number): string {
return `rgba(${r}, ${g}, ${b}, ${alpha})`;
}

function parseRgb(hexOrCss: string): [number, number, number] | null {
const m = /^#([0-9a-f]{6})$/i.exec(hexOrCss.trim());
if (!m) return null;
const n = parseInt(m[1]!, 16);
return [(n >> 16) & 255, (n >> 8) & 255, n & 255];
}

/** Opaque blend of `overlay` onto `base` (Glide needs solid `bgCell`). */
function mixOnto(base: string, overlay: string, alpha: number): string {
const b = parseRgb(base);
const o = parseRgb(overlay);
if (!b || !o) return base;
const mix = (x: number, y: number) => Math.round(x * (1 - alpha) + y * alpha);
const r = mix(b[0], o[0]);
const g = mix(b[1], o[1]);
const bl = mix(b[2], o[2]);
return `#${((1 << 24) | (r << 16) | (g << 8) | bl).toString(16).slice(1)}`;
}

/**
* Glide theme from Querya workbench tokens — Flutter darkDefault parity
* (near-black canvas, cyan accent) and lightDefault when `data-theme=light`.
*/
export function buildQueryaGlideTheme(): Partial<Theme> {
const fg = cssVar("--q-foreground", "#f8fafc");
const muted = cssVar("--q-muted-foreground", "#94a3b8");
const mutedFg = cssVar("--q-muted-foreground", "#94a3b8");
const muted = cssVar("--q-muted", "#18181b");
const surface = cssVar("--q-editor-bg", cssVar("--q-surface", "#0c0c0c"));
const canvas = cssVar("--q-canvas", "#000000");
const border = cssVar("--q-border", "#27272a");
Expand All @@ -40,22 +60,28 @@ export function buildQueryaGlideTheme(): Partial<Theme> {
"--q-font-sans",
'"Segoe UI", "SF Pro Text", system-ui, sans-serif',
);
// Flutter: scheme.muted @ 0.12 on odd rows. When muted ≈ cell surface
// (dark zinc), blend muted-foreground so the chessboard stays readable.
const stripeSrc =
muted.toLowerCase() === surface.toLowerCase() ? mutedFg : muted;
const bgCellStriped = mixOnto(surface, stripeSrc, 0.12);

return {
accentColor: primary,
accentFg: primaryFg,
accentLight: withAlpha(primary, 0.16),
textDark: fg,
textMedium: muted,
textLight: muted,
textMedium: mutedFg,
textLight: mutedFg,
textBubble: fg,
bgIconHeader: muted,
bgIconHeader: mutedFg,
fgIconHeader: fg,
textHeader: muted,
textGroupHeader: muted,
textHeader: mutedFg,
textGroupHeader: mutedFg,
textHeaderSelected: primaryFg,
bgCell: surface,
bgCellMedium: canvas,
/** Odd-row zebra fill (consumed by `getRowThemeOverride`). */
bgCellMedium: bgCellStriped,
bgHeader: canvas,
bgHeaderHasFocus: accent,
bgHeaderHovered: accent,
Expand Down
Loading