From c6a8cbb7e268999b131c1946ee4e97e1599157b4 Mon Sep 17 00:00:00 2001 From: saberzero1 Date: Sun, 8 Feb 2026 11:12:24 +0100 Subject: [PATCH] refactor: align graph component exports with shared types --- src/components/Graph.tsx | 55 +++++++++++++++------------------------- src/components/index.ts | 2 +- src/index.ts | 3 ++- 3 files changed, 23 insertions(+), 37 deletions(-) diff --git a/src/components/Graph.tsx b/src/components/Graph.tsx index 0ffbb53..27403d5 100644 --- a/src/components/Graph.tsx +++ b/src/components/Graph.tsx @@ -2,6 +2,8 @@ import type { QuartzComponent, QuartzComponentConstructor, QuartzComponentProps, + D3Config, + GraphOptions, } from "@quartz-community/types"; import { classNames } from "../util/lang"; import { i18n } from "../i18n"; @@ -9,28 +11,7 @@ import style from "./styles/graph.scss"; // @ts-ignore import script from "./scripts/graph.inline.ts"; -export interface D3Config { - drag: boolean; - zoom: boolean; - depth: number; - scale: number; - repelForce: number; - centerForce: number; - linkDistance: number; - fontSize: number; - opacityScale: number; - removeTags: string[]; - showTags: boolean; - focusOnHover?: boolean; - enableRadial?: boolean; -} - -export interface GraphOptions { - localGraph?: Partial; - globalGraph?: Partial; -} - -const defaultOptions = { +const defaultOptions: GraphOptions = { localGraph: { drag: true, zoom: true, @@ -42,7 +23,7 @@ const defaultOptions = { fontSize: 0.6, opacityScale: 1, showTags: true, - removeTags: [] as string[], + removeTags: [], focusOnHover: false, enableRadial: false, }, @@ -57,7 +38,7 @@ const defaultOptions = { fontSize: 0.6, opacityScale: 1, showTags: true, - removeTags: [] as string[], + removeTags: [], focusOnHover: true, enableRadial: true, }, @@ -70,7 +51,8 @@ export default ((userOpts?: Partial) => { return (
-
+

{i18n(cfg.locale).components.graph.title}

+
-
+
@@ -110,3 +93,5 @@ export default ((userOpts?: Partial) => { return Graph; }) satisfies QuartzComponentConstructor; + +export type { GraphOptions, D3Config }; diff --git a/src/components/index.ts b/src/components/index.ts index eee5323..6e0f50a 100644 --- a/src/components/index.ts +++ b/src/components/index.ts @@ -1,2 +1,2 @@ export { default as Graph } from "./Graph"; -export type { GraphOptions, D3Config } from "./Graph"; +export type { GraphOptions, D3Config } from "@quartz-community/types"; diff --git a/src/index.ts b/src/index.ts index fc1bd99..25a6b80 100644 --- a/src/index.ts +++ b/src/index.ts @@ -1,2 +1,3 @@ export { default as Graph } from "./components/Graph"; -export type { GraphOptions, D3Config } from "./components/Graph"; +export type { GraphOptions, D3Config } from "@quartz-community/types"; +export { manifest } from "./manifest";