Skip to content

Beautiful, AI-native markdown IDE and LLM wiki

Restore muted tree colors in built default themes (#6170)

Nick Gomez6ff11898cd6c
diff --git a/.changeset/quiet-tree-colors.md b/.changeset/quiet-tree-colors.md
new file mode 100644
index 000000000..7c4e0e852
--- /dev/null
+++ b/.changeset/quiet-tree-colors.md
@@ -0,0 +1,5 @@
+---
+"@inkeep/open-knowledge": patch
+---
+
+Sidebar chevrons and tree indent guides now use the intended muted color in the default light and dark themes.
diff --git a/knip.config.ts b/knip.config.ts
index 69344114d..0004a763a 100644
--- a/knip.config.ts
+++ b/knip.config.ts
@@ -149,11 +149,15 @@ export default {
'packages/server': {
entry: ['src/**/*.test.ts', 'src/parse-worker.ts'],
project: 'src/**',
- ignoreDependencies: ['@types/shell-quote'],
+ ignoreDependencies: [
+ '@types/shell-quote',
+ ],
},
'packages/cli': {
entry: ['src/**/*.test.ts', 'scripts/*.ts', 'tests/**/*.ts', 'src/parse-worker.ts'],
- ignoreDependencies: ['yjs'],
+ ignoreDependencies: [
+ 'yjs',
+ ],
},
'packages/desktop': {
entry: [
diff --git a/packages/app/src/globals.css b/packages/app/src/globals.css
index a5d9b3965..ddcfc9526 100644
--- a/packages/app/src/globals.css
+++ b/packages/app/src/globals.css
@@ -3346,6 +3346,8 @@ button:active:not(:disabled) {
}
:root {
+ color-scheme: light;
+
/* Sidebar inset variant applies m-2 (8px top + 8px bottom) to SidebarInset — offset its height accordingly */
--layout-inset-offset: 16px;
@@ -3501,6 +3503,8 @@ button:active:not(:disabled) {
}
.dark {
+ color-scheme: dark;
+
--background: oklch(0.145 0 0);
--foreground: oklch(0.985 0 0);
--card: oklch(0.205 0 0);
diff --git a/packages/app/tests/foundation/build-app-stylesheet.ts b/packages/app/tests/foundation/build-app-stylesheet.ts
new file mode 100644
index 000000000..cec119bf9
--- /dev/null
+++ b/packages/app/tests/foundation/build-app-stylesheet.ts
@@ -0,0 +1,38 @@
+import { fileURLToPath } from 'node:url';
+import { build } from 'vite';
+import type { BrowserCommand } from 'vitest/node';
+
+declare module 'vitest/browser' {
+ interface BrowserCommands {
+ buildAppStylesheet: () => Promise<string>;
+ }
+}
+
+export const buildAppStylesheet: BrowserCommand<[]> = async () => {
+ const root = fileURLToPath(new URL('../../', import.meta.url));
+ const output = await build({
+ root,
+ configFile: false,
+ mode: 'production',
+ logLevel: 'warn',
+ build: {
+ write: false,
+ rolldownOptions: { input: fileURLToPath(new URL('../../src/globals.css', import.meta.url)) },
+ },
+ });
+ const results = Array.isArray(output) ? output : [output];
+ const stylesheets = results.flatMap((result) =>
+ 'output' in result
+ ? result.output
+ .filter((entry) => entry.type === 'asset')
+ .filter((entry) => entry.fileName.endsWith('.css'))
+ : [],
+ );
+ if (stylesheets.length !== 1) {
+ throw new Error(`Expected one app stylesheet, received ${stylesheets.length}`);
+ }
+ const stylesheet = stylesheets[0];
+ return typeof stylesheet.source === 'string'
+ ? stylesheet.source
+ : new TextDecoder().decode(stylesheet.source);
+};
diff --git a/packages/app/tests/foundation/tree-muted-built.browser.test.ts b/packages/app/tests/foundation/tree-muted-built.browser.test.ts
new file mode 100644
index 000000000..3e2d8d62f
--- /dev/null
+++ b/packages/app/tests/foundation/tree-muted-built.browser.test.ts
@@ -0,0 +1,89 @@
+import { FileTree } from '@pierre/trees';
+import { afterEach, beforeAll, describe, expect, test, vi } from 'vitest';
+import { commands } from 'vitest/browser';
+import { createFileTreeStyle, FILE_TREE_DENSITY_OPTIONS } from '@/components/file-tree-density';
+
+let css: string;
+let frame: HTMLIFrameElement | undefined;
+let tree: FileTree | undefined;
+
+beforeAll(async () => {
+ css = await commands.buildAppStylesheet();
+});
+
+afterEach(() => {
+ tree?.cleanUp();
+ tree = undefined;
+ frame?.remove();
+ frame = undefined;
+});
+
+async function renderColor(mode: 'light' | 'dark', theme: string, consumer: string) {
+ frame = document.createElement('iframe');
+ frame.width = '640';
+ frame.height = '400';
+ document.body.append(frame);
+ const doc = frame.contentDocument;
+ const view = frame.contentWindow;
+ if (!doc || !view) throw new Error('Missing isolated stylesheet document');
+ doc.documentElement.classList.toggle('dark', mode === 'dark');
+ doc.documentElement.style.colorScheme = mode;
+ if (theme !== 'default') doc.documentElement.dataset.colorTheme = theme;
+ const style = doc.createElement('style');
+ style.textContent = css;
+ doc.head.append(style);
+ const parent = doc.createElement('div');
+ parent.className = 'text-muted-foreground';
+ doc.body.append(parent);
+
+ if (consumer === 'sidebar utility') {
+ const icon = doc.createElementNS('http://www.w3.org/2000/svg', 'svg');
+ icon.setAttribute('class', 'text-tree-muted');
+ parent.append(icon);
+ return view.getComputedStyle(icon).color;
+ }
+
+ const mount = doc.createElement('div');
+ mount.style.height = '320px';
+ parent.append(mount);
+ tree = new FileTree({
+ ...FILE_TREE_DENSITY_OPTIONS,
+ paths: ['folder/note.md'],
+ initialExpansion: 'open',
+ });
+ tree.render({ containerWrapper: mount });
+ const host = tree.getFileTreeContainer();
+ if (!host) throw new Error('The real tree did not mount');
+ for (const [property, value] of Object.entries(createFileTreeStyle(mode))) {
+ host.style.setProperty(property, String(value));
+ }
+ const chevron = await vi.waitFor(() => {
+ const icon = host.shadowRoot?.querySelector('[role="treeitem"] [data-item-section="icon"] svg');
+ expect(icon).toBeTruthy();
+ if (!icon) throw new Error('The real tree did not render its disclosure icon');
+ return icon;
+ });
+ return view.getComputedStyle(chevron).color;
+}
+
+describe('built tree muted colors', () => {
+ for (const consumer of ['sidebar utility', 'tree disclosure']) {
+ test(`${consumer} uses the intended default light color`, async () => {
+ expect(await renderColor('light', 'default', consumer)).toBe('oklch(0.709 0.01 56.259)');
+ });
+
+ test(`${consumer} uses the intended default dark color`, async () => {
+ expect(await renderColor('dark', 'default', consumer)).toBe('oklch(0.553 0.013 58.071)');
+ });
+
+ test(`${consumer} retains the named light theme color`, async () => {
+ expect(await renderColor('light', 'catppuccin-latte', consumer)).toBe(
+ 'oklch(0.709 0.01 56.259)',
+ );
+ });
+
+ test(`${consumer} retains the named dark theme color`, async () => {
+ expect(await renderColor('dark', 'dracula', consumer)).toBe('oklch(0.553 0.013 58.071)');
+ });
+ }
+});
diff --git a/packages/app/tests/integration/bug3-source-mode-writeback.test.ts b/packages/app/tests/integration/bug3-source-mode-writeback.test.ts
index a50b00123..4549c74b3 100644
--- a/packages/app/tests/integration/bug3-source-mode-writeback.test.ts
+++ b/packages/app/tests/integration/bug3-source-mode-writeback.test.ts
@@ -1,3 +1,4 @@
+
import { readFileSync } from 'node:fs';
import { join } from 'node:path';
import { setTimeout as wait } from 'node:timers/promises';
diff --git a/packages/app/tests/integration/indented-jsx-byte-sacred.test.ts b/packages/app/tests/integration/indented-jsx-byte-sacred.test.ts
index 6fcdc23f2..4fc2c11f9 100644
--- a/packages/app/tests/integration/indented-jsx-byte-sacred.test.ts
+++ b/packages/app/tests/integration/indented-jsx-byte-sacred.test.ts
@@ -1,3 +1,4 @@
+
import { setTimeout as wait } from 'node:timers/promises';
import { normalizeBridge } from '@inkeep/open-knowledge-core';
import { updateYFragment } from '@tiptap/y-tiptap';
diff --git a/packages/app/tests/integration/interior-edit-freshness.test.ts b/packages/app/tests/integration/interior-edit-freshness.test.ts
index 40b5cdfd6..9f2f6feb6 100644
--- a/packages/app/tests/integration/interior-edit-freshness.test.ts
+++ b/packages/app/tests/integration/interior-edit-freshness.test.ts
@@ -1,3 +1,4 @@
+
import { setTimeout as wait } from 'node:timers/promises';
import { updateYFragment, yXmlFragmentToProseMirrorRootNode } from '@tiptap/y-tiptap';
import { afterAll, beforeAll, describe, expect, test } from 'vitest';
diff --git a/packages/app/tests/integration/keystroke-cadence-danger-space.test.ts b/packages/app/tests/integration/keystroke-cadence-danger-space.test.ts
index 93666af70..2a085742b 100644
--- a/packages/app/tests/integration/keystroke-cadence-danger-space.test.ts
+++ b/packages/app/tests/integration/keystroke-cadence-danger-space.test.ts
@@ -1,3 +1,4 @@
+
import { setTimeout as wait } from 'node:timers/promises';
import { updateYFragment, yXmlFragmentToProseMirrorRootNode } from '@tiptap/y-tiptap';
import { afterAll, beforeAll, describe, expect, test } from 'vitest';
diff --git a/packages/app/tests/integration/producer-guard-wiring.test.ts b/packages/app/tests/integration/producer-guard-wiring.test.ts
index 867598d34..878d5196b 100644
--- a/packages/app/tests/integration/producer-guard-wiring.test.ts
+++ b/packages/app/tests/integration/producer-guard-wiring.test.ts
@@ -1,3 +1,4 @@
+
import { setTimeout as wait } from 'node:timers/promises';
import { updateYFragment, yXmlFragmentToProseMirrorRootNode } from '@tiptap/y-tiptap';
import { afterAll, beforeAll, describe, expect, test } from 'vitest';
diff --git a/packages/app/tests/integration/qa-039-reconciliation-counters-http.test.ts b/packages/app/tests/integration/qa-039-reconciliation-counters-http.test.ts
index 0970ac12f..4ada3cf26 100644
--- a/packages/app/tests/integration/qa-039-reconciliation-counters-http.test.ts
+++ b/packages/app/tests/integration/qa-039-reconciliation-counters-http.test.ts
@@ -1,3 +1,4 @@
+
import { randomUUID } from 'node:crypto';
import { afterEach, describe, expect, test } from 'vitest';
import { agentWriteMd, createTestServer, type TestServer } from './test-harness';
diff --git a/packages/app/tests/integration/qa-045-restore-after-gc.test.ts b/packages/app/tests/integration/qa-045-restore-after-gc.test.ts
index b632185e1..cbe2b705f 100644
--- a/packages/app/tests/integration/qa-045-restore-after-gc.test.ts
+++ b/packages/app/tests/integration/qa-045-restore-after-gc.test.ts
@@ -1,3 +1,4 @@
+
import { execFileSync } from 'node:child_process';
import { randomUUID } from 'node:crypto';
import { join } from 'node:path';
diff --git a/packages/app/tests/integration/qa-050-rollback-undo-shipped-path.test.ts b/packages/app/tests/integration/qa-050-rollback-undo-shipped-path.test.ts
index c530ce4ba..89bc9b4d9 100644
--- a/packages/app/tests/integration/qa-050-rollback-undo-shipped-path.test.ts
+++ b/packages/app/tests/integration/qa-050-rollback-undo-shipped-path.test.ts
@@ -1,3 +1,4 @@
+
import { randomUUID } from 'node:crypto';
import { afterAll, afterEach, beforeAll, describe, expect, test } from 'vitest';
import type * as Y from 'yjs';
diff --git a/packages/app/tests/integration/undo-after-rollback.test.ts b/packages/app/tests/integration/undo-after-rollback.test.ts
index d3767adc9..a78aeb0e4 100644
--- a/packages/app/tests/integration/undo-after-rollback.test.ts
+++ b/packages/app/tests/integration/undo-after-rollback.test.ts
@@ -1,3 +1,4 @@
+
import { ROLLBACK_ORIGIN } from '@inkeep/open-knowledge-server';
import { afterAll, beforeAll, describe, expect, test } from 'vitest';
import * as Y from 'yjs';
diff --git a/packages/app/tests/integration/undo-recycle-reset.test.ts b/packages/app/tests/integration/undo-recycle-reset.test.ts
index b076f955c..e7cc69c3f 100644
--- a/packages/app/tests/integration/undo-recycle-reset.test.ts
+++ b/packages/app/tests/integration/undo-recycle-reset.test.ts
@@ -1,3 +1,4 @@
+
import { writeFileSync } from 'node:fs';
import { join } from 'node:path';
import { setTimeout as wait } from 'node:timers/promises';
diff --git a/packages/app/tests/integration/undo-rederive-survival.test.ts b/packages/app/tests/integration/undo-rederive-survival.test.ts
index 7935e35f8..9ddcd0730 100644
--- a/packages/app/tests/integration/undo-rederive-survival.test.ts
+++ b/packages/app/tests/integration/undo-rederive-survival.test.ts
@@ -1,3 +1,4 @@
+
import { prependFrontmatter } from '@inkeep/open-knowledge-core';
import { Plugin, PluginKey } from '@tiptap/pm/state';
import { updateYFragment, yXmlFragmentToProseMirrorRootNode } from '@tiptap/y-tiptap';
diff --git a/packages/app/vitest.browser.config.ts b/packages/app/vitest.browser.config.ts
index c35e95eac..f2523517b 100644
--- a/packages/app/vitest.browser.config.ts
+++ b/packages/app/vitest.browser.config.ts
@@ -17,6 +17,7 @@ import {
browserNodeSubstitutes,
NODE_MODULES,
} from './tests/foundation/browser-node-compat';
+import { buildAppStylesheet } from './tests/foundation/build-app-stylesheet';
import { chromiumGcLaunchEnvGuard } from './tests/foundation/chromium-gc-launch-env';
import { RENDERER_DEDUPE } from './vite.dedupe';
import { RENDERER_BABEL_OPTIONS } from './vite.react-babel';
@@ -78,7 +79,12 @@ export const appBrowserVitestConfig = {
headless: true,
screenshotFailures: false,
instances: [{ browser: 'chromium' }],
- commands: { runBrowserFixture, installNetworkGuard, takeBlockedNetworkRequests },
+ commands: {
+ runBrowserFixture,
+ installNetworkGuard,
+ takeBlockedNetworkRequests,
+ buildAppStylesheet,
+ },
},
},
} satisfies ViteUserConfig;
diff --git a/packages/core/src/bridge/compose.ts b/packages/core/src/bridge/compose.ts
index f4cc8a286..2a597ec3d 100644
--- a/packages/core/src/bridge/compose.ts
+++ b/packages/core/src/bridge/compose.ts
@@ -1,3 +1,4 @@
+
import { prependFrontmatter, stripFrontmatter } from '../extensions/frontmatter.ts';
export type ComposeAdjustment = 'none' | 'body' | 'frontmatter' | 'unresolved';
diff --git a/packages/core/src/bridge/doc-boundary-space.ts b/packages/core/src/bridge/doc-boundary-space.ts
index e7e63f43d..ffd8fce06 100644
--- a/packages/core/src/bridge/doc-boundary-space.ts
+++ b/packages/core/src/bridge/doc-boundary-space.ts
@@ -1,3 +1,4 @@
+
import { FRONTMATTER_RE, stripFrontmatter } from '../extensions/frontmatter.ts';
import { carriedEdgeEmpties, type DocEdgeEmpties } from '../markdown/doc-edge-blank-runs.ts';
diff --git a/packages/core/src/markdown/comment-promoter.ts b/packages/core/src/markdown/comment-promoter.ts
index fc267cbea..fb0ba5a7c 100644
--- a/packages/core/src/markdown/comment-promoter.ts
+++ b/packages/core/src/markdown/comment-promoter.ts
@@ -1,3 +1,4 @@
+
import type { Nodes, Paragraph, PhrasingContent, Root, RootContent, Text } from 'mdast';
import { SKIP, visit } from 'unist-util-visit';
import type { VFile } from 'vfile';
diff --git a/packages/core/src/markdown/merged-walker.ts b/packages/core/src/markdown/merged-walker.ts
index bfd7e3109..fa3cfcd86 100644
--- a/packages/core/src/markdown/merged-walker.ts
+++ b/packages/core/src/markdown/merged-walker.ts
@@ -1,3 +1,4 @@
+
import type { Nodes, Parent, Root } from 'mdast';
import { SKIP, visit } from 'unist-util-visit';
import type { VFile } from 'vfile';
diff --git a/packages/core/src/markdown/safe-url.ts b/packages/core/src/markdown/safe-url.ts
index 4d3250d3a..8be632ba4 100644
--- a/packages/core/src/markdown/safe-url.ts
+++ b/packages/core/src/markdown/safe-url.ts
@@ -1,3 +1,4 @@
+
export const SAFE_URL_SCHEMES = ['https', 'http', 'mailto', 'tel', 'ftp', 'sms'] as const;
const SCHEME_ALT = SAFE_URL_SCHEMES.map((s) => `${s}:`).join('|');