Skip to content

Commit

Permalink
Merge branch 'rebeckerspecialties-feat/types'
Browse files Browse the repository at this point in the history
  • Loading branch information
vasturiano committed Apr 17, 2023
2 parents 895173c + 47370a1 commit dc0c62d
Showing 1 changed file with 81 additions and 3 deletions.
84 changes: 81 additions & 3 deletions src/index.d.ts
Original file line number Diff line number Diff line change
@@ -1,26 +1,104 @@
import { Object3D, Material } from 'three';

interface GraphData {
export interface GraphData {
nodes: NodeObject[];
links: LinkObject[];
}

type NodeObject = object & {
export type NodeObject = object & {
/**
* Node id
*/
id?: string | number;

/**
* The node’s zero-based index into *nodes*
*/
index?: number;

/**
* The node’s current *x*-position.
* This value may be subsequently modified by forces and by the simulation.
* If it is *NaN*, the position is initialized in a 3D [phyllotaxis arrangement](https://observablehq.com/@d3/force-layout-phyllotaxis) arrangement,
* so chosen to ensure a deterministic, uniform distribution around the origin.
*/
x?: number;
/**
* The node’s current *y*-position.
* This value may be subsequently modified by forces and by the simulation.
* If it is *NaN*, the position is initialized in a 3D [phyllotaxis arrangement](https://observablehq.com/@d3/force-layout-phyllotaxis) arrangement,
* so chosen to ensure a deterministic, uniform distribution around the origin.
*/
y?: number;
/**
* The node’s current *z*-position.
* This value may be subsequently modified by forces and by the simulation.
* If it is *NaN*, the position is initialized in a 3D [phyllotaxis arrangement](https://observablehq.com/@d3/force-layout-phyllotaxis) arrangement,
* so chosen to ensure a deterministic, uniform distribution around the origin.
*/
z?: number;

/**
* The node’s current *x*-velocity.
* This value may be subsequently modified by forces and by the simulation.
* @default 0
*/
vx?: number;
/**
* The node’s current *y*-velocity.
* This value may be subsequently modified by forces and by the simulation.
* @default 0
*/
vy?: number;
/**
* The node’s current *z*-velocity.
* This value may be subsequently modified by forces and by the simulation.
* @default 0
*/
vz?: number;

/**
* The node’s fixed *x*-position.
* At the end of each tick, after the application of any forces, a node with a defined *node*.fx has *node*.x reset to this value and *node*.vx set to zero.
* To unfix a node that was previously fixed, set *node*.fx to null, or delete this property.
* @default undefined
*/
fx?: number;
/**
* The node’s fixed *y*-position.
* At the end of each tick, after the application of any forces, a node with a defined *node*.fy has *node*.y reset to this value and *node*.vy set to zero.
* To unfix a node that was previously fixed, set *node*.fy to null, or delete this property.
* @default undefined
*/
fy?: number;
/**
* The node’s fixed *z*-position.
* At the end of each tick, after the application of any forces, a node with a defined *node*.fz has *node*.z reset to this value and *node*.vz set to zero.
* To unfix a node that was previously fixed, set *node*.fz to null, or delete this property.
* @default undefined
*/
fz?: number;
};

type LinkObject = object & {
export type LinkObject = object & {
/**
* The link’s source node.
* When the link force is initialized (or re-initialized, as when the nodes or links change), any *link*.source property which is *not* an object is replaced by an object reference to
* the corresponding *node* with the given identifier.
*/
source?: string | number | NodeObject;

/**
* The link’s target node.
* When the link force is initialized (or re-initialized, as when the nodes or links change), any *link*.target property which is *not* an object is replaced by an object reference to
* the corresponding *node* with the given identifier.
*/
target?: string | number | NodeObject;

/**
* The zero-based index into links
*/
index?: number;
};

type Accessor<In, Out> = Out | string | ((obj: In) => Out);
Expand Down

0 comments on commit dc0c62d

Please sign in to comment.