Hylograph.Data.Node
- Package
- purescript-hylograph-selection
- Repository
- afcondon/purescript-hylograph-selection
#NodeID Source
type NodeID = IntTypes for working with D3 simulations and graphs.
Simulation nodes now use PARAMETERIZED TYPE pattern (matching hierarchy layouts) instead of extended row pattern. This enables:
- Typeclass instances (HasDatum)
- Typed lambdas without DatumFn wrappers
- Consistent API with TreeNode, PackNode, etc.
Hierarchy layouts use pure PureScript (Hylograph.Layout.Hierarchy.*) with their own node types. Links
#Link Source
type Link :: Type -> Row Type -> Typetype Link id r = { source :: id, target :: id | r }
Row-polymorphic link type parameterized by ID type (source of truth in PureScript)
Links have required source/target fields with a configurable ID type. User adds extra fields via row parameter. This replaces the opaque D3Link_Unswizzled for type-safe link handling.
Example:
-- Spago uses Int IDs
type SpagoLinkRow = (linktype :: LinkType, inSim :: Boolean)
type SpagoLink = Link Int SpagoLinkRow
-- Expands to: { source :: Int, target :: Int, linktype :: LinkType, inSim :: Boolean }
-- LesMis uses String IDs
type LesMisLink = Link String (value :: Number)
-- Expands to: { source :: String, target :: String, value :: Number }
#SwizzledLink Source
type SwizzledLink :: Row Type -> Row Type -> Typetype SwizzledLink nodeData r = { source :: SimulationNode nodeData, target :: SimulationNode nodeData | r }
Swizzled link where source/target are node object references
After swizzling, links can access node positions via link.source.x, etc. The nodeData parameter matches the SimulationNode's row parameter.
Example:
type SpagoSwizzledLink = SwizzledLink SpagoNodeRow SpagoLinkRow
#SimulationNode Source
type SimulationNode :: Row Type -> Typetype SimulationNode r = Record (D3_XY + D3_VxyFxy + r)
#D3_ID Source
type D3_ID :: Row Type -> Row Typetype D3_ID row = (id :: NodeID | row)
Simulation Node (Row Polymorphic - matches D3's extend behavior) Simulation node that extends user data with D3 simulation fields This matches D3's behavior: it EXTENDS your objects with position/velocity fields (unlike hierarchies which EMBED your data inside wrapper objects)
Fields managed by D3 simulation:
- x, y: Position
- vx, vy: Velocity
- fx, fy: Fixed position (Nullable - Nothing means not fixed)
User data fields go directly in the row parameter r
Example:
type MyNode = SimulationNode (id :: String, group :: Int)
-- Expands to: { x :: Number, y :: Number, vx :: Number, vy :: Number,
-- fx :: Nullable Number, fy :: Nullable Number,
-- id :: String, group :: Int }
- Modules
- Data.
DependencyGraph - Hylograph.
AST - Hylograph.
Axis. Axis - Hylograph.
Brush - Hylograph.
Brush. FFI - Hylograph.
Brush. Types - Hylograph.
Classify - Hylograph.
Data. Graph - Hylograph.
Data. Graph. Algorithms - Hylograph.
Data. Node - Hylograph.
Data. Tree - Hylograph.
Expr. Animation - Hylograph.
Expr. Attr - Hylograph.
Expr. Datum - Hylograph.
Expr. Expr - Hylograph.
Expr. Friendly - Hylograph.
Expr. Integration - Hylograph.
Expr. Interpreter. CodeGen - Hylograph.
Expr. Interpreter. Eval - Hylograph.
Expr. Interpreter. Meta - Hylograph.
Expr. Interpreter. PureSVG - Hylograph.
Expr. Interpreter. SVG - Hylograph.
Expr. Path - Hylograph.
Expr. Path. Generators - Hylograph.
Expr. Sugar - Hylograph.
Expr. Units - Hylograph.
HATS - Hylograph.
HATS. Friendly - Hylograph.
HATS. InterpreterTick - Hylograph.
HATS. Transitions - Hylograph.
Interaction. Brush - Hylograph.
Interaction. Coordinated - Hylograph.
Interaction. Pointer - Hylograph.
Interaction. Zoom - Hylograph.
Internal. Attribute - Hylograph.
Internal. Behavior. FFI - Hylograph.
Internal. Behavior. Types - Hylograph.
Internal. Capabilities. Selection - Hylograph.
Internal. Capabilities. Transition - Hylograph.
Internal. FFI - Hylograph.
Internal. Selection. Join - Hylograph.
Internal. Selection. Operations - Hylograph.
Internal. Selection. Operations. Conversions - Hylograph.
Internal. Selection. Operations. Helpers - Hylograph.
Internal. Selection. Operations. Selection - Hylograph.
Internal. Selection. Query - Hylograph.
Internal. Selection. Types - Hylograph.
Internal. Transition. FFI - Hylograph.
Internal. Transition. Manager - Hylograph.
Internal. Transition. Scene - Hylograph.
Internal. Transition. Types - Hylograph.
Internal. Types - Hylograph.
Interpreter. D3 - Hylograph.
Interpreter. English - Hylograph.
Interpreter. Mermaid - Hylograph.
Interpreter. MetaAST - Hylograph.
Interpreter. SemiQuine - Hylograph.
Interpreter. SemiQuine. TreeToCode - Hylograph.
Interpreter. SemiQuine. Types - Hylograph.
Render - Hylograph.
Scale - Hylograph.
Scale. FP - Hylograph.
Shape. Arc - Hylograph.
Shape. Pie - Hylograph.
Shape. Polygon - Hylograph.
Tooltip - Hylograph.
Transform - Hylograph.
TreeDSL - Hylograph.
TreeDSL. ShapeTree - Hylograph.
Unified - Hylograph.
Unified. Attribute - Hylograph.
Unified. DataDSL - Hylograph.
Unified. Display - Hylograph.
Unified. Examples - Hylograph.
Unified. Join - Hylograph.
Unified. Sugar