fix(studio): centralize dark code-block surface and optimize message sync writes

This commit is contained in:
imagineer99 2026-04-10 12:54:41 +01:00
commit e310372c80
3 changed files with 10 additions and 10 deletions

View file

@ -41,7 +41,7 @@ const COPY_RESET_MS = 2000;
const MERMAID_SOURCE_RE = /```mermaid\s*([\s\S]*?)```/i;
const CODE_FENCE_RE = /^```([^\r\n`]*)\r?\n([\s\S]*?)\r?\n?```$/;
const ACTION_PANEL_CLASS =
"pointer-events-auto flex shrink-0 items-center gap-2 rounded-md border border-sidebar bg-sidebar/80 px-1.5 py-1 supports-[backdrop-filter]:bg-sidebar/70 supports-[backdrop-filter]:backdrop-blur dark:border-white/10 dark:bg-[#181818] dark:supports-[backdrop-filter]:bg-[#181818]";
"pointer-events-auto flex shrink-0 items-center gap-2 rounded-md border border-sidebar bg-sidebar/80 px-1.5 py-1 supports-[backdrop-filter]:bg-sidebar/70 supports-[backdrop-filter]:backdrop-blur dark:border-white/10 dark:bg-code-block dark:supports-[backdrop-filter]:bg-code-block";
const ACTION_BUTTON_CLASS =
"cursor-pointer p-1 text-muted-foreground transition-all hover:text-foreground disabled:cursor-not-allowed disabled:opacity-50";

View file

@ -79,9 +79,11 @@ async function syncExportedRepositoryToDexie(
await Promise.all(
existing.filter((m) => !keepIds.has(m.id)).map((m) => db.messages.delete(m.id)),
);
for (const { message, parentId } of exp.messages) {
await db.messages.put(exportedItemToRecord(remoteId, parentId, message));
}
await Promise.all(
exp.messages.map(({ message, parentId }) =>
db.messages.put(exportedItemToRecord(remoteId, parentId, message)),
),
);
});
}

View file

@ -173,6 +173,7 @@
--color-chart-3: var(--chart-3);
--color-chart-2: var(--chart-2);
--color-chart-1: var(--chart-1);
--color-code-block: #181818;
--color-ring: var(--ring);
--color-input: var(--input);
--color-border: var(--border);
@ -397,13 +398,10 @@
}
.dark .aui-thread-root [data-streamdown="code-block"] {
background: #181818;
/* Streamdown `pre` uses `dark:bg-[var(--shiki-dark-bg,...)]`; keep one surface on the outer shell. */
--shiki-dark-bg: transparent;
background: var(--color-code-block);
border: 1px solid oklch(1 0 0 / 0.07);
border-radius: 0.625rem;
}
.dark .aui-thread-root [data-streamdown="code-block"] pre {
background: transparent !important;
}
}