Skip to content

Build your personal knowledge base with Trilium Notes

feat(import): draw the import sources' marks from the brand icon pack

Elian Doran04c2468d385b
diff --git a/apps/client/src/widgets/dialogs/import/anytype.tsx b/apps/client/src/widgets/dialogs/import/anytype.tsx
index c8d23d12c2..15da655d5f 100644
--- a/apps/client/src/widgets/dialogs/import/anytype.tsx
+++ b/apps/client/src/widgets/dialogs/import/anytype.tsx
@@ -6,7 +6,6 @@ import { Card, CardSection } from "../../react/Card.js";
import FileDropZone from "../../react/FileDropZone.js";
import { useTriliumOptionBool } from "../../react/hooks.js";
import OptionsRow, { OptionsRowWithToggle } from "../../type_widgets/options/components/OptionsRow.js";
-import iconUrl from "./icons/anytype.svg?url";
import type { ImportProvider, ImportProviderPanelProps } from "./types.js";
import useProviderImport from "./useProviderImport.js";
@@ -57,7 +56,7 @@ const provider: ImportProvider = {
id: "anytype",
helpPage: "83zmPBJRgfnW",
name: t("anytype_import.name"),
- iconUrl,
+ icon: "tn-brand tn-brand-anytype",
description: t("anytype_import.description"),
Panel: AnytypePanel
};
diff --git a/apps/client/src/widgets/dialogs/import/evernote.tsx b/apps/client/src/widgets/dialogs/import/evernote.tsx
index 9eebf26bb0..d986c9208c 100644
--- a/apps/client/src/widgets/dialogs/import/evernote.tsx
+++ b/apps/client/src/widgets/dialogs/import/evernote.tsx
@@ -8,7 +8,6 @@ import { Card, CardSection } from "../../react/Card.js";
import FileDropZone from "../../react/FileDropZone.js";
import { useTriliumOptionBool } from "../../react/hooks.js";
import OptionsRow, { OptionsRowWithToggle } from "../../type_widgets/options/components/OptionsRow.js";
-import iconUrl from "./icons/evernote.svg?url";
import type { ImportProvider, ImportProviderPanelProps } from "./types.js";
function EvernotePanel({ parentNoteId, closeDialog, setFooter }: ImportProviderPanelProps) {
@@ -73,7 +72,7 @@ const provider: ImportProvider = {
id: "evernote",
helpPage: "syuSEKf2rUGr",
name: t("evernote_import.name"),
- iconUrl,
+ icon: "tn-brand tn-brand-evernote",
description: t("evernote_import.description"),
Panel: EvernotePanel
};
diff --git a/apps/client/src/widgets/dialogs/import/icons/anytype.svg b/apps/client/src/widgets/dialogs/import/icons/anytype.svg
deleted file mode 100644
index 7fa6e11cac..0000000000
--- a/apps/client/src/widgets/dialogs/import/icons/anytype.svg
+++ /dev/null
@@ -1 +0,0 @@
-<svg xmlns="http://www.w3.org/2000/svg" viewBox="-2.4 -2.4 28.8 28.8"><title>Anytype SVG Icon</title><path fill="currentColor" d="M5.333 0h13.334A5.32 5.32 0 0 1 24 5.333v13.334A5.32 5.32 0 0 1 18.667 24H5.333A5.32 5.32 0 0 1 0 18.667V5.333A5.32 5.32 0 0 1 5.333 0m10.334 7.667v-3H6.344v3zm0 0v11.666h3V7.667ZM9.5 19.333a4.833 4.833 0 1 0 0-9.666a4.833 4.833 0 0 0 0 9.666"/></svg>
\ No newline at end of file
diff --git a/apps/client/src/widgets/dialogs/import/icons/evernote.svg b/apps/client/src/widgets/dialogs/import/icons/evernote.svg
deleted file mode 100644
index d95923c98c..0000000000
--- a/apps/client/src/widgets/dialogs/import/icons/evernote.svg
+++ /dev/null
@@ -1 +0,0 @@
-<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M15.09,11.63C15.09,11.63 15.28,10.35 16,10.35C16.76,10.35 17.78,12.06 17.78,12.06C17.78,12.06 15.46,11.63 15.09,11.63M19,4.69C18.64,4.09 16.83,3.41 15.89,3.41C14.96,3.41 13.5,3.41 13.5,3.41C13.5,3.41 12.7,2 10.88,2C9.05,2 9.17,2.81 9.17,3.5V6.32L8.34,7.19H4.5C4.5,7.19 3.44,7.91 3.44,9.44C3.44,11 3.92,16.35 7.13,16.85C10.93,17.43 11.58,15.67 11.58,15.46C11.58,14.56 11.6,13.21 11.6,13.21C11.6,13.21 12.71,15.33 14.39,15.33C16.07,15.33 17.04,16.3 17.04,17.29C17.04,18.28 17.04,19.13 17.04,19.13C17.04,19.13 17,20.28 16,20.28C15,20.28 13.89,20.28 13.89,20.28C13.89,20.28 13.2,19.74 13.2,19C13.2,18.25 13.53,18.05 13.93,18.05C14.32,18.05 14.65,18.09 14.65,18.09V16.53C14.65,16.53 11.47,16.5 11.47,18.94C11.47,21.37 13.13,22 14.46,22C15.8,22 16.63,22 16.63,22C16.63,22 20.56,21.5 20.56,13.75C20.56,6 19.33,5.28 19,4.69M7.5,6.31H4.26L8.32,2.22V5.5L7.5,6.31Z" /></svg>
\ No newline at end of file
diff --git a/apps/client/src/widgets/dialogs/import/icons/keep.svg b/apps/client/src/widgets/dialogs/import/icons/keep.svg
deleted file mode 100644
index 539280a618..0000000000
--- a/apps/client/src/widgets/dialogs/import/icons/keep.svg
+++ /dev/null
@@ -1 +0,0 @@
-<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M4 2H20C21.11 2 22 2.9 22 4V17.33L17.33 22H4C2.9 22 2 21.11 2 20V4C2 2.9 2.9 2 4 2M17 17V20.25L20.25 17H17M10 19H14V18H15V13C16.21 12.09 17 10.64 17 9C17 6.24 14.76 4 12 4S7 6.24 7 9C7 10.64 7.79 12.09 9 13V18H10V19M14 17H10V15H14V17M12 5C14.21 5 16 6.79 16 9C16 10.5 15.2 11.77 14 12.46V14H10V12.46C8.8 11.77 8 10.5 8 9C8 6.79 9.79 5 12 5Z" /></svg>
\ No newline at end of file
diff --git a/apps/client/src/widgets/dialogs/import/icons/notion.svg b/apps/client/src/widgets/dialogs/import/icons/notion.svg
deleted file mode 100644
index 857d0875cf..0000000000
--- a/apps/client/src/widgets/dialogs/import/icons/notion.svg
+++ /dev/null
@@ -1 +0,0 @@
-<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 640 640"><!--!Font Awesome Free 7.2.0 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license/free Copyright 2026 Fonticons, Inc.--><path d="M158.9 164.2C173.8 176.3 179.4 175.4 207.5 173.5L471.8 157.6C477.4 157.6 472.7 152 470.9 151.1L426.9 119.4C418.5 112.9 407.3 105.4 385.8 107.3L129.9 125.9C120.6 126.8 118.7 131.5 122.4 135.2L158.8 164.1zM174.8 225.8L174.8 503.9C174.8 518.8 182.3 524.4 199.1 523.5L489.6 506.7C506.4 505.8 508.3 495.5 508.3 483.4L508.3 207.2C508.3 195.1 503.6 188.5 493.3 189.5L189.7 207.1C178.5 208 174.8 213.6 174.8 225.8zM461.5 240.7C463.4 249.1 461.5 257.5 453.1 258.5L439.1 261.3L439.1 466.6C426.9 473.1 415.7 476.9 406.4 476.9C391.4 476.9 387.7 472.2 376.5 458.2L285 314.5L285 453.5L314 460C314 460 314 476.8 290.6 476.8L226.2 480.5C224.3 476.8 226.2 467.4 232.7 465.6L249.5 460.9L249.5 277.1L226.2 275.2C224.3 266.8 229 254.7 242.1 253.7L311.2 249L406.5 394.6L406.5 265.8L382.2 263C380.3 252.7 387.8 245.3 397.1 244.3L461.6 240.5zM108.4 100.7L374.6 81.1C407.3 78.3 415.7 80.2 436.2 95.1L521.2 154.8C535.2 165.1 539.9 167.9 539.9 179.1L539.9 506.7C539.9 527.2 532.4 539.4 506.3 541.2L197.2 559.8C177.6 560.7 168.2 557.9 158 544.9L95.4 463.7C84.2 448.8 79.5 437.6 79.5 424.5L79.5 133.3C79.5 116.5 87 102.5 108.4 100.6z"/></svg>
\ No newline at end of file
diff --git a/apps/client/src/widgets/dialogs/import/icons/obsidian.svg b/apps/client/src/widgets/dialogs/import/icons/obsidian.svg
deleted file mode 100644
index 75cd259741..0000000000
--- a/apps/client/src/widgets/dialogs/import/icons/obsidian.svg
+++ /dev/null
@@ -1 +0,0 @@
-<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 640 640"><!--!Font Awesome Free 7.3.0 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license/free Copyright 2026 Fonticons, Inc.--><path d="M270.3 384.3C306.4 376.1 340.6 373.3 371.6 385C403.4 396.9 433.3 424.6 458.3 481C450.2 498.7 445.9 517.9 443.6 534.8C440.5 557.7 418.2 575.5 395.9 569.4C364.2 560.7 327.6 547.1 294.6 544.5C290.2 544.2 244 540.7 244 540.7C242.3 540.6 240.6 540.3 238.9 539.9C270.4 475.7 277.1 424.8 270.2 384.5zM183 283.5C205.3 298.3 232.5 321.3 247.1 357.1C263.2 396.5 264.9 452.8 225.5 533.2C224.5 532.4 223.4 531.5 222.5 530.5L135.4 440.8C125.9 431 123.3 416.4 128.9 403.9C129.5 402.6 173.5 305.6 183 283.5zM447.3 192.2C452.2 198.4 454.7 206.2 454.7 214.1C454.8 234.9 456.5 277.7 468 305.3C479.2 332.1 499.8 361.1 510.5 375.3C514.6 380.8 515.3 388.2 511.8 394C504.2 406.8 489.2 431.5 468 463.2C467.7 463.6 467.4 464.1 467.2 464.5C442 412.3 411.3 383.8 376.8 370.9C367.2 367.3 357.3 364.9 347.4 363.6C329.6 317.8 324.2 283.9 325.4 257.2C326.6 229.8 334.6 209.4 343.6 190.9C352.5 172.8 363.4 155 368.5 135.2C371.7 122.7 372.7 109.4 370.2 94.3L447.3 192.3zM312.2 78.1C322.5 68.9 336.8 67.3 348.5 72.6C358.1 97.2 358.2 115.4 354.1 131.4C349.5 149.2 340 164.4 330.2 184.2C320.6 203.7 311.8 226.2 310.5 256.5C309.3 284.4 314.6 318.4 330.9 362.3C309.9 361.7 288.4 364.9 267.2 369.7C265.5 363.3 263.4 357.3 261.1 351.5C243.8 309.3 211.2 283.6 187 268.2C190.1 249.5 195.2 212.8 198.6 190.7C199.8 183.1 203.5 176.1 209.3 170.9L312.2 78.1z"/></svg>
\ No newline at end of file
diff --git a/apps/client/src/widgets/dialogs/import/icons/onenote.svg b/apps/client/src/widgets/dialogs/import/icons/onenote.svg
deleted file mode 100644
index 8f010e884c..0000000000
--- a/apps/client/src/widgets/dialogs/import/icons/onenote.svg
+++ /dev/null
@@ -1 +0,0 @@
-<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M21.17 3.25Q21.5 3.25 21.76 3.5 22 3.74 22 4.08V19.92Q22 20.26 21.76 20.5 21.5 20.75 21.17 20.75H7.83Q7.5 20.75 7.24 20.5 7 20.26 7 19.92V17H2.83Q2.5 17 2.24 16.76 2 16.5 2 16.17V7.83Q2 7.5 2.24 7.24 2.5 7 2.83 7H7V4.08Q7 3.74 7.24 3.5 7.5 3.25 7.83 3.25M5.8 11.17L8.16 15.27H9.65V8.73H8.2V12.92L5.93 8.73H4.35V15.27H5.8M20.75 19.5V17H18.25V19.5M20.75 15.75V13.25H18.25V15.75M20.75 12V9.5H18.25V12M20.75 8.25V4.5H8.25V7H11.17Q11.5 7 11.76 7.24 12 7.5 12 7.83V16.17Q12 16.5 11.76 16.76 11.5 17 11.17 17H8.25V19.5H17V8.25Z" /></svg>
\ No newline at end of file
diff --git a/apps/client/src/widgets/dialogs/import/import_dialog.tsx b/apps/client/src/widgets/dialogs/import/import_dialog.tsx
index 84950440dc..20b426e4a7 100644
--- a/apps/client/src/widgets/dialogs/import/import_dialog.tsx
+++ b/apps/client/src/widgets/dialogs/import/import_dialog.tsx
@@ -66,14 +66,14 @@ export default function ImportDialog() {
<CardSection>
<SelectableCardGrid>
{serviceProviders.map((p) => (
- <SelectableCard key={p.id} iconUrl={p.iconUrl} icon={p.icon} title={p.name} description={p.description} selected={p.id === providerId} onSelect={() => setProviderId(p.id)} />
+ <SelectableCard key={p.id} icon={p.icon} title={p.name} description={p.description} selected={p.id === providerId} onSelect={() => setProviderId(p.id)} />
))}
</SelectableCardGrid>
{localProviders.length > 0 && (
<div className="import-provider-local">
{localProviders.map((p) => (
- <SelectableCard key={p.id} iconUrl={p.iconUrl} icon={p.icon} title={p.name} description={p.description} selected={p.id === providerId} onSelect={() => setProviderId(p.id)} />
+ <SelectableCard key={p.id} icon={p.icon} title={p.name} description={p.description} selected={p.id === providerId} onSelect={() => setProviderId(p.id)} />
))}
</div>
)}
diff --git a/apps/client/src/widgets/dialogs/import/index.spec.ts b/apps/client/src/widgets/dialogs/import/index.spec.ts
new file mode 100644
index 0000000000..b1ba501a9d
--- /dev/null
+++ b/apps/client/src/widgets/dialogs/import/index.spec.ts
@@ -0,0 +1,20 @@
+import fs from "fs";
+import path from "path";
+import { describe, expect, it } from "vitest";
+
+import { importProviders } from "./index.js";
+
+describe("importProviders", () => {
+ it("names only marks the brand icon pack has a glyph for", () => {
+ const manifestPath = path.join(__dirname,
+ "../../../../../../packages/trilium-core/src/services/icon_pack_brands.json");
+ const { icons } = JSON.parse(fs.readFileSync(manifestPath, "utf-8")) as {
+ icons: Record<string, unknown>;
+ };
+ const brandClasses = importProviders
+ .filter(({ icon }) => icon.startsWith("tn-brand "))
+ .map(({ icon }) => icon.slice("tn-brand ".length));
+ expect(brandClasses).toHaveLength(importProviders.length - 1);
+ expect(brandClasses.filter((name) => !icons[name])).toStrictEqual([]);
+ });
+});
diff --git a/apps/client/src/widgets/dialogs/import/keep.tsx b/apps/client/src/widgets/dialogs/import/keep.tsx
index f803a382fc..51bdbcfc24 100644
--- a/apps/client/src/widgets/dialogs/import/keep.tsx
+++ b/apps/client/src/widgets/dialogs/import/keep.tsx
@@ -6,7 +6,6 @@ import { Card, CardSection } from "../../react/Card.js";
import FileDropZone from "../../react/FileDropZone.js";
import { useTriliumOptionBool } from "../../react/hooks.js";
import OptionsRow, { OptionsRowWithToggle } from "../../type_widgets/options/components/OptionsRow.js";
-import iconUrl from "./icons/keep.svg?url";
import type { ImportProvider, ImportProviderPanelProps } from "./types.js";
import useProviderImport from "./useProviderImport.js";
@@ -57,7 +56,7 @@ const provider: ImportProvider = {
id: "keep",
helpPage: "nhQVuO4zvIxi",
name: t("keep_import.name"),
- iconUrl,
+ icon: "tn-brand tn-brand-google-keep",
description: t("keep_import.description"),
Panel: KeepPanel
};
diff --git a/apps/client/src/widgets/dialogs/import/notion.tsx b/apps/client/src/widgets/dialogs/import/notion.tsx
index 784e8885a9..828cc14e8c 100644
--- a/apps/client/src/widgets/dialogs/import/notion.tsx
+++ b/apps/client/src/widgets/dialogs/import/notion.tsx
@@ -6,7 +6,6 @@ import { Card, CardSection } from "../../react/Card.js";
import FileDropZone from "../../react/FileDropZone.js";
import { useTriliumOptionBool } from "../../react/hooks.js";
import OptionsRow, { OptionsRowWithToggle } from "../../type_widgets/options/components/OptionsRow.js";
-import iconUrl from "./icons/notion.svg?url";
import type { ImportProvider, ImportProviderPanelProps } from "./types.js";
import useProviderImport from "./useProviderImport.js";
@@ -57,7 +56,7 @@ const provider: ImportProvider = {
id: "notion",
helpPage: "Y5mKeJ6dsCld",
name: t("notion_import.name"),
- iconUrl,
+ icon: "tn-brand tn-brand-notion",
description: t("notion_import.description"),
Panel: NotionPanel
};
diff --git a/apps/client/src/widgets/dialogs/import/obsidian.tsx b/apps/client/src/widgets/dialogs/import/obsidian.tsx
index 91ba523c3f..5c4f96dc38 100644
--- a/apps/client/src/widgets/dialogs/import/obsidian.tsx
+++ b/apps/client/src/widgets/dialogs/import/obsidian.tsx
@@ -6,7 +6,6 @@ import { Card, CardSection } from "../../react/Card.js";
import FileDropZone from "../../react/FileDropZone.js";
import { useTriliumOptionBool } from "../../react/hooks.js";
import { OptionsRowWithToggle } from "../../type_widgets/options/components/OptionsRow.js";
-import iconUrl from "./icons/obsidian.svg?url";
import type { ImportProvider, ImportProviderPanelProps } from "./types.js";
import useProviderImport from "./useProviderImport.js";
@@ -56,7 +55,7 @@ const provider: ImportProvider = {
id: "obsidian",
helpPage: "iWD7wiIuMtgV",
name: t("obsidian_import.name"),
- iconUrl,
+ icon: "tn-brand tn-brand-obsidian",
description: t("obsidian_import.description"),
Panel: ObsidianPanel
};
diff --git a/apps/client/src/widgets/dialogs/import/onenote.tsx b/apps/client/src/widgets/dialogs/import/onenote.tsx
index b14084b412..1dcc9df31b 100644
--- a/apps/client/src/widgets/dialogs/import/onenote.tsx
+++ b/apps/client/src/widgets/dialogs/import/onenote.tsx
@@ -11,7 +11,6 @@ import { useTriliumOptionBool } from "../../react/hooks.js";
import LoadingSpinner from "../../react/LoadingSpinner.js";
import NoItems from "../../react/NoItems.js";
import OptionsRow, { OptionsRowWithToggle } from "../../type_widgets/options/components/OptionsRow.js";
-import iconUrl from "./icons/onenote.svg?url";
import type { ImportProvider, ImportProviderPanelProps } from "./types.js";
type Phase = "checking" | "disconnected" | "connecting" | "ready";
@@ -347,7 +346,7 @@ const provider: ImportProvider = {
id: "onenote",
helpPage: "GnhlmrATVqcH",
name: t("onenote_import.name"),
- iconUrl,
+ icon: "tn-brand tn-brand-onenote",
description: t("onenote_import.description"),
Panel: OneNotePanel
};
diff --git a/apps/client/src/widgets/dialogs/import/types.ts b/apps/client/src/widgets/dialogs/import/types.ts
index a9848b6d23..ac218dcd2a 100644
--- a/apps/client/src/widgets/dialogs/import/types.ts
+++ b/apps/client/src/widgets/dialogs/import/types.ts
@@ -18,10 +18,11 @@ export interface ImportProvider {
id: string;
/** Human-readable name shown in the provider picker. */
name: string;
- /** URL of the provider's logo (an imported SVG, e.g. `import iconUrl from "./icons/notion.svg?url"`). Rendered monochrome via a CSS mask so it adapts to the theme. Provide either this or {@link icon}. */
- iconUrl?: string;
- /** Boxicons class (e.g. `"bx bx-import"`) shown in place of {@link iconUrl}. Provide either this or `iconUrl`. */
- icon?: string;
+ /**
+ * The icon class, such as `"bx bx-import"`, or the service's mark,
+ * `"tn-brand tn-brand-notion"`.
+ */
+ icon: string;
/** One-line description shown under the name. */
description: string;
/** Help note ID (without the `_help_` prefix) for this provider's documentation; shown as a help button in the dialog header. */
diff --git a/packages/trilium-core/src/services/icon_packs.spec.ts b/packages/trilium-core/src/services/icon_packs.spec.ts
index e4ef25ee3b..6d37f24f47 100644
--- a/packages/trilium-core/src/services/icon_packs.spec.ts
+++ b/packages/trilium-core/src/services/icon_packs.spec.ts
@@ -360,9 +360,11 @@ describe("Listing icon packs", () => {
const iconPacks = getIconPacks();
expect(iconPacks.map(p => [ p.prefix, p.builtin, !!p.internal ])).toStrictEqual([
[ "bx", true, false ],
- [ "cke", true, true ]
+ [ "cke", true, true ],
+ [ "tn-brand", true, true ]
]);
expect(iconPacks[1].manifest.icons["cke-table-merge-cell"]).toBeDefined();
+ expect(iconPacks[2].manifest.icons["tn-brand-openai"]).toBeDefined();
expect(searchNotes).not.toHaveBeenCalled();
} finally {
becca.loaded = wasLoaded;
@@ -382,7 +384,7 @@ describe("Listing icon packs", () => {
becca.loaded = true;
try {
const iconPacks = getIconPacks();
- expect(iconPacks.map(p => p.prefix)).toStrictEqual([ "bx", "cke" ]);
+ expect(iconPacks.map(p => p.prefix)).toStrictEqual([ "bx", "cke", "tn-brand" ]);
expect(iconPacks[1].builtin).toBe(true);
} finally {
becca.loaded = wasLoaded;
@@ -401,7 +403,7 @@ describe("Listing icon packs", () => {
expect(listedPrefixes()).toStrictEqual([ "bx" ]);
getEnv.mockImplementation((key) => (key === "TRILIUM_ENV" ? "dev" : undefined));
- expect(listedPrefixes()).toStrictEqual([ "bx", "cke" ]);
+ expect(listedPrefixes()).toStrictEqual([ "bx", "cke", "tn-brand" ]);
} finally {
becca.loaded = wasLoaded;
}
diff --git a/packages/trilium-core/src/services/icon_packs.ts b/packages/trilium-core/src/services/icon_packs.ts
index dad41e9eb2..90813bcec6 100644
--- a/packages/trilium-core/src/services/icon_packs.ts
+++ b/packages/trilium-core/src/services/icon_packs.ts
@@ -4,6 +4,7 @@ import becca from "../becca/becca";
import type BAttachment from "../becca/entities/battachment";
import type BNote from "../becca/entities/bnote";
import boxiconsManifest from "./icon_pack_boxicons-v2.json" with { type: "json" };
+import brandsManifest from "./icon_pack_brands.json" with { type: "json" };
import textEditorManifest from "./icon_pack_text_editor.json" with { type: "json" };
import { getLog } from "./log";
import search from "./search/services/search";
@@ -90,6 +91,18 @@ export function getIconPacks() {
icon: "cke cke-pilcrow",
builtin: true,
internal: true
+ },
+ {
+ // The marks of the AI providers and import sources, built by `apps/icon-pack-builder`.
+ prefix: "tn-brand",
+ manifest: brandsManifest,
+ manifestNoteId: "brand-icons",
+ fontMime: "font/woff2",
+ fontAttachmentId: "brand-icons",
+ title: "Brand Icons",
+ icon: "tn-brand tn-brand-openai",
+ builtin: true,
+ internal: true
}
];