@tomaszjarosz/react-visualizers 0.2.14 → 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 CHANGED
@@ -3,12 +3,12 @@
3
3
  Interactive algorithm and data structure visualizers for React. Perfect for learning, teaching, and interview preparation.
4
4
 
5
5
  [![npm version](https://img.shields.io/npm/v/@tomaszjarosz/react-visualizers)](https://www.npmjs.com/package/@tomaszjarosz/react-visualizers)
6
- [![Storybook](https://img.shields.io/badge/Storybook-Live%20Demo-ff4785?logo=storybook&logoColor=white)](https://6934a2d9e17d1e509a92c935-rdicbxowdr.chromatic.com/)
6
+ [![Storybook](https://img.shields.io/badge/Storybook-Live%20Demo-ff4785?logo=storybook&logoColor=white)](https://6934a2d9e17d1e509a92c935-oajoxaxuir.chromatic.com/)
7
7
  [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
8
8
 
9
9
  ## Features
10
10
 
11
- - **36 interactive visualizers** covering algorithms, data structures, and distributed systems
11
+ - **51 interactive visualizers** covering algorithms, data structures, and distributed systems
12
12
  - **Interview Mode** with built-in questions, scoring, hints, and explanations
13
13
  - **Step-by-step animations** with playback controls (play, pause, step forward/back)
14
14
  - **Code highlighting** showing the current line being executed
@@ -19,7 +19,7 @@ Interactive algorithm and data structure visualizers for React. Perfect for lear
19
19
 
20
20
  ## Live Demo
21
21
 
22
- **[View all visualizers in Storybook](https://6934a2d9e17d1e509a92c935-rdicbxowdr.chromatic.com/)**
22
+ **[View all visualizers in Storybook](https://6934a2d9e17d1e509a92c935-oajoxaxuir.chromatic.com/)**
23
23
 
24
24
  ## Installation
25
25
 
@@ -55,7 +55,7 @@ function App() {
55
55
 
56
56
  ## Available Visualizers
57
57
 
58
- ### Algorithms (6)
58
+ ### Algorithms (8)
59
59
 
60
60
  | Visualizer | Description |
61
61
  |------------|-------------|
@@ -65,8 +65,10 @@ function App() {
65
65
  | `GraphVisualizer` | DFS and BFS traversal |
66
66
  | `DijkstraVisualizer` | Shortest path with distance relaxation |
67
67
  | `DPVisualizer` | Dynamic programming table (Fibonacci) |
68
+ | `AStarVisualizer` | A* pathfinding with f(n) = g(n) + h(n) |
69
+ | `TopologicalSortVisualizer` | Kahn's algorithm for DAG ordering |
68
70
 
69
- ### Data Structures (10)
71
+ ### Data Structures (12)
70
72
 
71
73
  | Visualizer | Description |
72
74
  |------------|-------------|
@@ -80,6 +82,8 @@ function App() {
80
82
  | `LinkedHashMapVisualizer` | HashMap + insertion order linked list |
81
83
  | `EnumSetVisualizer` | Bit vector implementation |
82
84
  | `ListComparisonVisualizer` | ArrayList vs LinkedList performance |
85
+ | `LRUCacheVisualizer` | Least Recently Used cache with HashMap + DLL |
86
+ | `SegmentTreeVisualizer` | Range sum queries with O(log n) updates |
83
87
 
84
88
  ### Concurrency (4)
85
89
 
@@ -90,12 +94,15 @@ function App() {
90
94
  | `CopyOnWriteVisualizer` | Copy-on-write pattern for reads |
91
95
  | `ImmutableCollectionsVisualizer` | Java 9+ immutable collections |
92
96
 
93
- ### Advanced Data Structures (2)
97
+ ### Advanced Data Structures (5)
94
98
 
95
99
  | Visualizer | Description |
96
100
  |------------|-------------|
97
101
  | `BloomFilterVisualizer` | Probabilistic set membership |
98
102
  | `BTreeVisualizer` | B-Tree with node splitting |
103
+ | `TrieVisualizer` | Prefix tree for autocomplete, spell checking |
104
+ | `UnionFindVisualizer` | Disjoint set union with path compression |
105
+ | `SkipListVisualizer` | Probabilistic sorted list with O(log n) operations |
99
106
 
100
107
  ### Distributed Systems (2)
101
108
 
@@ -111,7 +118,7 @@ function App() {
111
118
  | `GCVisualizer` | JVM generational garbage collection |
112
119
  | `SQLJoinVisualizer` | SQL JOIN operations (INNER, LEFT, RIGHT, FULL) |
113
120
 
114
- ### Interview Mode (10)
121
+ ### Interview Mode (15)
115
122
 
116
123
  Interview visualizers include built-in questions with multiple choice answers, hints, and detailed explanations. Perfect for interview preparation.
117
124
 
@@ -127,6 +134,11 @@ Interview visualizers include built-in questions with multiple choice answers, h
127
134
  | `BTreeInterviewVisualizer` | Node splitting, disk-based storage, order |
128
135
  | `ConsistentHashingInterviewVisualizer` | Virtual nodes, rebalancing, hot spots |
129
136
  | `RaftInterviewVisualizer` | Leader election, log replication, safety |
137
+ | `TrieInterviewVisualizer` | Prefix operations, autocomplete, space complexity |
138
+ | `UnionFindInterviewVisualizer` | Path compression, union by rank, cycle detection |
139
+ | `AStarInterviewVisualizer` | f=g+h, admissible heuristics, Manhattan distance |
140
+ | `SkipListInterviewVisualizer` | Probabilistic levels, expected complexity, Redis |
141
+ | `LinkedListInterviewVisualizer` | Two-pointer techniques, cycle detection, reversal |
130
142
 
131
143
  ## Interview Mode Usage
132
144
 
@@ -253,27 +265,99 @@ import type {
253
265
 
254
266
  ## Development
255
267
 
268
+ This project uses **bun** as the package manager.
269
+
256
270
  ```bash
257
271
  # Clone the repository
258
272
  git clone https://github.com/tomaszjarosz/tomaszjarosz-ui.git
259
273
  cd tomaszjarosz-ui/packages/react-visualizers
260
274
 
261
275
  # Install dependencies
262
- pnpm install
276
+ bun install
263
277
 
264
- # Run Storybook locally
265
- pnpm run storybook
278
+ # Run Storybook locally (port 6006)
279
+ bun run storybook
266
280
 
267
281
  # Build library
268
- pnpm run build
282
+ bun run build
269
283
 
270
284
  # Type check
271
- pnpm run typecheck
285
+ bun run typecheck
286
+
287
+ # Run unit tests
288
+ bun run test
289
+
290
+ # Run tests in watch mode
291
+ bun run test:watch
292
+ ```
293
+
294
+ ## Storybook
295
+
296
+ All visualizers have interactive stories in [Storybook](https://storybook.js.org/):
297
+
298
+ - **Local:** `bun run storybook` → http://localhost:6006
299
+ - **Live Demo:** https://6934a2d9e17d1e509a92c935-oajoxaxuir.chromatic.com/
300
+
301
+ Stories are located in `src/visualizers/stories/` directory.
302
+
303
+ ## Chromatic (Visual Testing)
304
+
305
+ This project uses [Chromatic](https://www.chromatic.com/) for visual regression testing and Storybook hosting.
306
+
307
+ - **Automatic deployment** on every push to `main` branch
308
+ - **Visual diff detection** for UI changes
309
+ - **Storybook hosting** at the live demo URL
310
+
311
+ Chromatic runs via GitHub Actions (`.github/workflows/chromatic.yml`).
312
+
313
+ ## Project Structure
314
+
315
+ ```
316
+ packages/react-visualizers/
317
+ ├── src/
318
+ │ ├── index.ts # Main exports
319
+ │ ├── styles.css # Tailwind entry point
320
+ │ ├── shared/ # Shared components & hooks
321
+ │ │ ├── ControlPanel.tsx
322
+ │ │ ├── CodePanel.tsx
323
+ │ │ ├── useVisualizerPlayback.ts
324
+ │ │ ├── useInterviewMode.ts
325
+ │ │ └── *.test.ts # Unit tests
326
+ │ └── visualizers/ # All visualizers
327
+ │ ├── SortingVisualizer.tsx
328
+ │ ├── HashMapVisualizer.tsx
329
+ │ └── stories/ # Storybook stories
330
+ ├── dist/ # Build output
331
+ ├── .storybook/ # Storybook config
332
+ ├── package.json
333
+ └── vite.config.ts
334
+ ```
335
+
336
+ ## Publishing
337
+
338
+ ```bash
339
+ # Bump version
340
+ npm version patch # or minor/major
341
+
342
+ # Build
343
+ bun run build
344
+
345
+ # Publish to npm
346
+ npm publish --access public
347
+
348
+ # Push version tag
349
+ git push && git push --tags
272
350
  ```
273
351
 
274
352
  ## Contributing
275
353
 
276
- Contributions are welcome! Please read the contributing guidelines before submitting a PR.
354
+ Contributions are welcome! Please:
355
+
356
+ 1. Fork the repository
357
+ 2. Create a feature branch
358
+ 3. Add tests for new functionality
359
+ 4. Ensure all tests pass (`bun run test`)
360
+ 5. Submit a pull request
277
361
 
278
362
  ## License
279
363