@loradb/lora-graph-canvas 0.11.3 → 0.13.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,26 @@
1
+ /**
2
+ * Palette helpers — shared between `nodeAutoColorBy` (in
3
+ * `useAccessorOverrides`) and the `GroupLegend` swatches so a given
4
+ * group key always maps to the same colour in the canvas and in the
5
+ * legend.
6
+ *
7
+ * The default ramp is `d3-scale-chromatic`'s `schemeTableau10`. Hosts
8
+ * can override the palette via `LoraGraphTheme.nodePalette` and the
9
+ * hash-to-index function picks colours deterministically — same string
10
+ * → same colour across re-renders, sessions, and consumers.
11
+ */
12
+ /** Default node palette (Tableau10). Kept in the same order as
13
+ * d3-scale-chromatic so any consumer that already uses Tableau10
14
+ * matches without configuration. */
15
+ export declare const DEFAULT_NODE_PALETTE: readonly string[];
16
+ /** Default relationship colour when nothing is selected or hovered.
17
+ * Stays in lock-step with `useAccessorOverrides`'s baseline so the
18
+ * in-engine fallback and the selection wrapper agree. */
19
+ export declare const DEFAULT_LINK_COLOR = "rgba(96, 102, 110, 0.55)";
20
+ /** Default colour for hovered relationships. Same alpha as
21
+ * `DEFAULT_LINK_COLOR` so a hover transition only mutates RGB and
22
+ * doesn't drag the link across Three.js's transparent/opaque sort
23
+ * groups (which would visibly reshuffle neighbouring lines). */
24
+ export declare const DEFAULT_LINK_HOVER_COLOR = "rgba(180, 188, 198, 0.55)";
25
+ /** Pick the palette colour for a group key. */
26
+ export declare function colorForGroup(group: string, palette?: readonly string[]): string;
@@ -6,6 +6,9 @@ export interface GroupLegendProps<N extends NodeObject = NodeObject> {
6
6
  /** Hidden group keys (stringified). Toggled by clicking. */
7
7
  hidden: Set<string>;
8
8
  onToggle(group: string): void;
9
+ /** Palette used for swatch backgrounds — must match the canvas's
10
+ * node palette so legend swatches and node fills line up. Defaults
11
+ * to the package's Tableau10 ramp. */
12
+ palette?: readonly string[];
9
13
  }
10
- export declare function colorForGroup(group: string): string;
11
- export declare function GroupLegend<N extends NodeObject = NodeObject>({ nodes, groupBy, hidden, onToggle, }: GroupLegendProps<N>): import("react/jsx-runtime").JSX.Element | null;
14
+ export declare function GroupLegend<N extends NodeObject = NodeObject>({ nodes, groupBy, hidden, onToggle, palette, }: GroupLegendProps<N>): import("react/jsx-runtime").JSX.Element | null;
package/dist/types.d.ts CHANGED
@@ -69,6 +69,18 @@ export interface LoraGraphTheme {
69
69
  menuHoverBackground?: string;
70
70
  fontFamily?: string;
71
71
  fontSize?: string;
72
+ /** Palette used when `nodeAutoColorBy` is set: nodes get a colour by
73
+ * hashing the group key against this array. Defaults to a
74
+ * Tableau10-style ramp. */
75
+ nodePalette?: readonly string[];
76
+ /** Default colour for relationships when nothing is selected /
77
+ * hovered. Defaults to `rgba(96, 102, 110, 0.55)`. */
78
+ linkDefault?: string;
79
+ /** Colour for hovered relationships — both direct hover and
80
+ * neighbour-of-hovered-node. Kept distinct from the selection
81
+ * accent so users can tell hover from selection at a glance.
82
+ * Defaults to `rgba(180, 188, 198, 0.55)`. */
83
+ linkHover?: string;
72
84
  }
73
85
  export interface ToolbarConfig {
74
86
  include?: ToolId[];
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@loradb/lora-graph-canvas",
3
- "version": "0.11.3",
3
+ "version": "0.13.0",
4
4
  "description": "React graph canvas for LoraDB. Unified 2D/3D force-directed component with a built-in tool palette for adding, connecting, selecting, and removing nodes.",
5
5
  "license": "BUSL-1.1",
6
6
  "packageManager": "yarn@4.5.1",