VisualizationState type is a discriminated union of all supported visualization kinds.
VisualizationState
Union type:CodeState
Source code with syntax highlighting, focus ranges, and annotations.Unique identifier for this code block
Language identifier (e.g.,
'typescript', 'python')Displayed filename
Source code
Line ranges to highlight
Line annotations
Named sub-regions for triggers
FocusRange
Starting line number (1-based)
Ending line number (inclusive)
CodeAnnotation
Line number to annotate
Annotation text
DataState
Data structure visualizations (arrays, trees, graphs, etc.).Data structure definition. See below for supported types.
Supported Data Structures
- ArrayData: Linear array with pointers
- LinkedListData: Singly linked list with nodes and edges
- DoublyLinkedListData: Doubly linked list
- TreeData: N-ary tree (supports BST, AVL, red-black, heap, etc.)
- BTreeData: B-tree variants (B-tree, B+ tree, 2-3 tree, 2-3-4 tree)
- TrieData: Trie variants (trie, radix tree, suffix tree)
- SkipListData: Skip list with levels
- StackData: Stack with top pointer
- QueueData: Queue with front/rear pointers
- DequeData: Double-ended queue
- RingBufferData: Circular buffer
- HashMapData: Hash table with chaining
- GraphData: Directed or undirected graph
- MatrixData: 2D matrix with labels
- UnionFindData: Disjoint set (union-find)
- LsmTreeData: Log-structured merge tree
- FibonacciHeapData: Fibonacci heap
- BitArrayData: Bit arrays (Bloom filter, cuckoo filter, count-min sketch, HyperLogLog)
ArrayData Example
Array elements
Named pointers to array indices
TreeData Example
One of:
'generic' | 'bst' | 'avl' | 'red-black' | 'heap-min' | 'heap-max' | 'splay' | 'treap' | 'aa' | 'segment' | 'interval' | 'fenwick' | 'merkle' | 'kd' | 'rope'TreeNodeDef
Unique node identifier
Node value
Child node IDs
Node annotation (e.g., balance factor, color)
GraphData Example
One of:
'ring' | 'force' | 'tree' | 'grid' | 'bipartite'DataPointerDef
Pointer label
Target node/element ID
DiagramState
System architecture diagrams.DiagramNodeDef
One of:
'client' | 'service' | 'database' | 'cache' | 'queue' | 'load-balancer' | 'api-gateway' | 'message-queue' | 'user' | 'server'Optional icon identifier
DiagramEdgeDef
MathState
Mathematical expressions rendered via LaTeX.MathExpression
LaTeX markup
ChartState
Data visualizations (bar, line, scatter, etc.).One of:
'bar' | 'line' | 'scatter' | 'area' | 'pie' | 'radar' | 'radial'ChartSeries
Series label
ChartDataPoint
PreviewState
Live HTML/React preview.HTML or JSX source code
One of:
'html' | 'react'RegionDef
Named sub-element for trigger targeting.Region identifier
CSS selector or element identifier