@bruno00o/graph 0.2.0 → 0.4.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.
- package/README.md +3 -2
- package/dist/db.d.ts +2 -2
- package/dist/index.d.ts +3 -3
- package/dist/index.js +1 -1
- package/dist/{mount-graph-B88WGOQu.d.ts → mount-graph-Br5IAZbP.d.ts} +13 -3
- package/dist/{mount-graph-DYOgD_ql.js → mount-graph-mObhwJ3e.js} +1097 -186
- package/dist/mount-graph-mObhwJ3e.js.map +1 -0
- package/dist/query.d.ts +1 -1
- package/dist/react.d.ts +3 -2
- package/dist/react.js +2 -1
- package/dist/react.js.map +1 -1
- package/dist/theme.css +3 -0
- package/dist/{types-D6b86Rt1.d.ts → types-DJEdpHUo.d.ts} +16 -4
- package/package.json +1 -1
- package/dist/mount-graph-DYOgD_ql.js.map +0 -1
package/README.md
CHANGED
|
@@ -24,7 +24,8 @@ Framework-agnostic, typed graph visualization rendered with WebGL2.
|
|
|
24
24
|
- Declarative marks: map your fields to color, size, labels, arrows and dashes through shared scales, with types inferred from your data
|
|
25
25
|
- Live sources: pass a TanStack DB collection as is, or anything with `subscribeChanges`, and only what changed is redrawn
|
|
26
26
|
- Named states (selection, hover, focus and your own) resolved on the GPU
|
|
27
|
-
-
|
|
27
|
+
- Images and icons clipped to the node shape, corner badges, outlines, label backgrounds, parallel edges and self loops
|
|
28
|
+
- Drag, pan, zoom, multiple selection and lasso out of the box, plus keyboard navigation announced to screen readers
|
|
28
29
|
- Themed with CSS variables, light and dark
|
|
29
30
|
- A framework-agnostic core with a thin React adapter, plus TanStack DB and TanStack Query integrations
|
|
30
31
|
|
|
@@ -108,7 +109,7 @@ nodes(itemsCollection, { color: 'group', label: 'label' })
|
|
|
108
109
|
|
|
109
110
|
## Examples
|
|
110
111
|
|
|
111
|
-
The [`examples`](./examples) folder holds runnable examples: vanilla and React graphs, parallel edges and loops, collaboration across tabs with TanStack DB, and neighborhood exploration with TanStack Query. Run them with `pnpm install && pnpm dev`.
|
|
112
|
+
The [`examples`](./examples) folder holds runnable examples: vanilla and React graphs, images, badges and outlines, parallel edges and loops, collaboration across tabs with TanStack DB, and neighborhood exploration with TanStack Query. Run them with `pnpm install && pnpm dev`.
|
|
112
113
|
|
|
113
114
|
## Get Involved
|
|
114
115
|
|
package/dist/db.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
1
|
+
import { i as GraphInstance } from "./mount-graph-Br5IAZbP.js";
|
|
2
|
+
import { _ as Key, d as FieldOf, k as Point } from "./types-DJEdpHUo.js";
|
|
3
3
|
import { Collection, MutationFn, Strategy } from "@tanstack/db";
|
|
4
4
|
export interface PersistPositionsOptions<T extends object, TKey extends string | number> {
|
|
5
5
|
readonly collection: Collection<T, TKey>;
|
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { A as
|
|
2
|
-
import { C as
|
|
1
|
+
import { A as ResolvedInteraction, B as View, C as NodeImage, D as NumberScale, E as NodeShape, F as SourceSubscription, I as StateStyle, L as StateStyles, M as ScalesOptions, N as SelectMode, O as NumberScaleType, P as SourceChange, R as Style, S as Mark, T as NodeOptions, _ as Key, a as Channel, b as LabelOptions, c as EdgeDash, d as FieldOf, f as FreeState, g as InteractionOptions, h as GraphDefinitionOptions, i as BuiltInState, j as ResolvedTransitions, k as Point, l as EdgeMark, m as GraphDefinition, n as Badge, o as ColorScale, p as GraphData, r as BadgeCorner, s as EdgeArrow, t as Accessor, u as EdgeOptions, v as KeyChannel, w as NodeMark, x as LiveSource, y as KeyFieldOf, z as TransitionOptions } from "./types-DJEdpHUo.js";
|
|
2
|
+
import { C as GraphTarget, S as GraphPositionEvent, T as PositionOrigin, _ as GraphEventHandler, a as GraphPositions, b as GraphFocusEvent, c as GraphStates, d as MountGraphOptions, f as ViewOptions, g as GraphDragEvent, h as ElementKeysInput, i as GraphInstance, l as GraphStore, m as ElementKeys, n as GraphElement, o as GraphSelection, p as mountGraph, r as GraphFocus, s as GraphState, t as FitOptions, u as GraphView, v as GraphEventName, w as GraphTargetEvent, x as GraphPointerEvent, y as GraphEvents } from "./mount-graph-Br5IAZbP.js";
|
|
3
3
|
export declare function defineGraph<S extends string = never>(options: GraphDefinitionOptions<S>): GraphDefinition<S>;
|
|
4
4
|
export declare function nodes<T>(data: LiveSource<T>, options?: NodeOptions<NoInfer<T>>): NodeMark<T>;
|
|
5
5
|
export declare function nodes<T extends {
|
|
@@ -15,5 +15,5 @@ export declare function edges<T extends {
|
|
|
15
15
|
export declare function edges<T>(data: Iterable<T>, options: EdgeOptions<NoInfer<T>> & {
|
|
16
16
|
readonly key: KeyChannel<NoInfer<T>>;
|
|
17
17
|
}): EdgeMark<T>;
|
|
18
|
-
export { type Accessor, type Badge, type BadgeCorner, type BuiltInState, type Channel, type ColorScale, type EdgeArrow, type EdgeDash, type EdgeMark, type EdgeOptions, type ElementKeys, type ElementKeysInput, type FieldOf, type FitOptions, type FreeState, type GraphData, type GraphDefinition, type GraphDefinitionOptions, type GraphDragEvent, type GraphElement, type GraphEventHandler, type GraphEventName, type GraphEvents, type GraphInstance, type GraphPointerEvent, type GraphPositionEvent, type GraphPositions, type GraphSelection, type GraphState, type GraphStates, type GraphStore, type GraphTarget, type GraphTargetEvent, type GraphView, type InteractionOptions, type Key, type KeyChannel, type KeyFieldOf, type LabelOptions, type LiveSource, type Mark, type MountGraphOptions, type NodeMark, type NodeOptions, type NodeShape, type NumberScale, type NumberScaleType, type Point, type PositionOrigin, type ResolvedInteraction, type ResolvedTransitions, type ScalesOptions, type SelectMode, type SourceChange, type SourceSubscription, type StateStyle, type StateStyles, type Style, type TransitionOptions, type View, type ViewOptions, mountGraph };
|
|
18
|
+
export { type Accessor, type Badge, type BadgeCorner, type BuiltInState, type Channel, type ColorScale, type EdgeArrow, type EdgeDash, type EdgeMark, type EdgeOptions, type ElementKeys, type ElementKeysInput, type FieldOf, type FitOptions, type FreeState, type GraphData, type GraphDefinition, type GraphDefinitionOptions, type GraphDragEvent, type GraphElement, type GraphEventHandler, type GraphEventName, type GraphEvents, type GraphFocus, type GraphFocusEvent, type GraphInstance, type GraphPointerEvent, type GraphPositionEvent, type GraphPositions, type GraphSelection, type GraphState, type GraphStates, type GraphStore, type GraphTarget, type GraphTargetEvent, type GraphView, type InteractionOptions, type Key, type KeyChannel, type KeyFieldOf, type LabelOptions, type LiveSource, type Mark, type MountGraphOptions, type NodeImage, type NodeMark, type NodeOptions, type NodeShape, type NumberScale, type NumberScaleType, type Point, type PositionOrigin, type ResolvedInteraction, type ResolvedTransitions, type ScalesOptions, type SelectMode, type SourceChange, type SourceSubscription, type StateStyle, type StateStyles, type Style, type TransitionOptions, type View, type ViewOptions, mountGraph };
|
|
19
19
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { n as freeStateNames, r as maxFreeStates, t as mountGraph } from "./mount-graph-
|
|
1
|
+
import { n as freeStateNames, r as maxFreeStates, t as mountGraph } from "./mount-graph-mObhwJ3e.js";
|
|
2
2
|
// src/define-graph.ts
|
|
3
3
|
const defaultZoomSpeed = 1;
|
|
4
4
|
const defaultPositionTransition = 120;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { B as View, _ as Key, f as FreeState, k as Point, m as GraphDefinition } from "./types-DJEdpHUo.js";
|
|
2
2
|
import { ReadonlyStore } from "@tanstack/store";
|
|
3
3
|
interface Endpoints {
|
|
4
4
|
readonly source: Key;
|
|
@@ -40,6 +40,9 @@ interface GraphDragEvent {
|
|
|
40
40
|
readonly world: Point;
|
|
41
41
|
readonly originalEvent: PointerEvent;
|
|
42
42
|
}
|
|
43
|
+
interface GraphFocusEvent {
|
|
44
|
+
readonly target: GraphTarget | null;
|
|
45
|
+
}
|
|
43
46
|
type PositionOrigin = "drag" | "api";
|
|
44
47
|
interface GraphPositionEvent {
|
|
45
48
|
readonly origin: PositionOrigin;
|
|
@@ -56,6 +59,7 @@ interface GraphEvents {
|
|
|
56
59
|
readonly dragend: GraphDragEvent;
|
|
57
60
|
readonly positionchange: GraphPositionEvent;
|
|
58
61
|
readonly selectionchange: ElementKeys;
|
|
62
|
+
readonly focuschange: GraphFocusEvent;
|
|
59
63
|
readonly viewchange: {
|
|
60
64
|
readonly view: View;
|
|
61
65
|
};
|
|
@@ -67,6 +71,7 @@ interface GraphState<S extends string = string> {
|
|
|
67
71
|
readonly width: number;
|
|
68
72
|
readonly height: number;
|
|
69
73
|
readonly hovered: GraphTarget | null;
|
|
74
|
+
readonly focused: GraphTarget | null;
|
|
70
75
|
readonly selection: ElementKeys;
|
|
71
76
|
readonly states: { readonly [K in FreeState<S>]: ElementKeys; };
|
|
72
77
|
readonly positionsVersion: number;
|
|
@@ -95,6 +100,10 @@ interface GraphSelection {
|
|
|
95
100
|
set(keys: ElementKeysInput): void;
|
|
96
101
|
clear(): void;
|
|
97
102
|
}
|
|
103
|
+
interface GraphFocus {
|
|
104
|
+
get(): GraphTarget | null;
|
|
105
|
+
set(element: GraphElement | null): void;
|
|
106
|
+
}
|
|
98
107
|
interface GraphStates<N extends string = string> {
|
|
99
108
|
set(name: N, keys: ElementKeysInput): void;
|
|
100
109
|
add(name: N, keys: ElementKeysInput): void;
|
|
@@ -117,6 +126,7 @@ interface GraphInstance<S extends string = string> {
|
|
|
117
126
|
readonly store: GraphStore<S>;
|
|
118
127
|
readonly view: GraphView;
|
|
119
128
|
readonly selection: GraphSelection;
|
|
129
|
+
readonly focus: GraphFocus;
|
|
120
130
|
readonly states: GraphStates<FreeState<S>>;
|
|
121
131
|
readonly positions: GraphPositions;
|
|
122
132
|
readonly element: HTMLElement;
|
|
@@ -129,5 +139,5 @@ interface GraphInstance<S extends string = string> {
|
|
|
129
139
|
destroy(): void;
|
|
130
140
|
}
|
|
131
141
|
declare function mountGraph<S extends string = string>(container: HTMLElement, options: MountGraphOptions<S>): GraphInstance<S>;
|
|
132
|
-
export {
|
|
133
|
-
//# sourceMappingURL=mount-graph-
|
|
142
|
+
export { GraphTarget as C, GraphPositionEvent as S, PositionOrigin as T, GraphEventHandler as _, GraphPositions as a, GraphFocusEvent as b, GraphStates as c, MountGraphOptions as d, ViewOptions as f, GraphDragEvent as g, ElementKeysInput as h, GraphInstance as i, GraphStore as l, ElementKeys as m, GraphElement as n, GraphSelection as o, mountGraph as p, GraphFocus as r, GraphState as s, FitOptions as t, GraphView as u, GraphEventName as v, GraphTargetEvent as w, GraphPointerEvent as x, GraphEvents as y };
|
|
143
|
+
//# sourceMappingURL=mount-graph-Br5IAZbP.d.ts.map
|