@tomaszjarosz/react-visualizers 0.2.14 → 0.3.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 +84 -10
- package/dist/index.cjs +1082 -167
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +16 -0
- package/dist/index.js +1082 -167
- package/dist/index.js.map +1 -1
- package/dist/react-visualizers.css +13 -0
- package/package.json +6 -1
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
|
[](https://www.npmjs.com/package/@tomaszjarosz/react-visualizers)
|
|
6
|
-
[](https://6934a2d9e17d1e509a92c935-
|
|
6
|
+
[](https://6934a2d9e17d1e509a92c935-oajoxaxuir.chromatic.com/)
|
|
7
7
|
[](https://opensource.org/licenses/MIT)
|
|
8
8
|
|
|
9
9
|
## Features
|
|
10
10
|
|
|
11
|
-
- **
|
|
11
|
+
- **38 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-
|
|
22
|
+
**[View all visualizers in Storybook](https://6934a2d9e17d1e509a92c935-oajoxaxuir.chromatic.com/)**
|
|
23
23
|
|
|
24
24
|
## Installation
|
|
25
25
|
|
|
@@ -90,12 +90,14 @@ function App() {
|
|
|
90
90
|
| `CopyOnWriteVisualizer` | Copy-on-write pattern for reads |
|
|
91
91
|
| `ImmutableCollectionsVisualizer` | Java 9+ immutable collections |
|
|
92
92
|
|
|
93
|
-
### Advanced Data Structures (
|
|
93
|
+
### Advanced Data Structures (4)
|
|
94
94
|
|
|
95
95
|
| Visualizer | Description |
|
|
96
96
|
|------------|-------------|
|
|
97
97
|
| `BloomFilterVisualizer` | Probabilistic set membership |
|
|
98
98
|
| `BTreeVisualizer` | B-Tree with node splitting |
|
|
99
|
+
| `TrieVisualizer` | Prefix tree for autocomplete, spell checking |
|
|
100
|
+
| `UnionFindVisualizer` | Disjoint set union with path compression |
|
|
99
101
|
|
|
100
102
|
### Distributed Systems (2)
|
|
101
103
|
|
|
@@ -253,27 +255,99 @@ import type {
|
|
|
253
255
|
|
|
254
256
|
## Development
|
|
255
257
|
|
|
258
|
+
This project uses **bun** as the package manager.
|
|
259
|
+
|
|
256
260
|
```bash
|
|
257
261
|
# Clone the repository
|
|
258
262
|
git clone https://github.com/tomaszjarosz/tomaszjarosz-ui.git
|
|
259
263
|
cd tomaszjarosz-ui/packages/react-visualizers
|
|
260
264
|
|
|
261
265
|
# Install dependencies
|
|
262
|
-
|
|
266
|
+
bun install
|
|
263
267
|
|
|
264
|
-
# Run Storybook locally
|
|
265
|
-
|
|
268
|
+
# Run Storybook locally (port 6006)
|
|
269
|
+
bun run storybook
|
|
266
270
|
|
|
267
271
|
# Build library
|
|
268
|
-
|
|
272
|
+
bun run build
|
|
269
273
|
|
|
270
274
|
# Type check
|
|
271
|
-
|
|
275
|
+
bun run typecheck
|
|
276
|
+
|
|
277
|
+
# Run unit tests
|
|
278
|
+
bun run test
|
|
279
|
+
|
|
280
|
+
# Run tests in watch mode
|
|
281
|
+
bun run test:watch
|
|
282
|
+
```
|
|
283
|
+
|
|
284
|
+
## Storybook
|
|
285
|
+
|
|
286
|
+
All visualizers have interactive stories in [Storybook](https://storybook.js.org/):
|
|
287
|
+
|
|
288
|
+
- **Local:** `bun run storybook` → http://localhost:6006
|
|
289
|
+
- **Live Demo:** https://6934a2d9e17d1e509a92c935-oajoxaxuir.chromatic.com/
|
|
290
|
+
|
|
291
|
+
Stories are located in `src/visualizers/stories/` directory.
|
|
292
|
+
|
|
293
|
+
## Chromatic (Visual Testing)
|
|
294
|
+
|
|
295
|
+
This project uses [Chromatic](https://www.chromatic.com/) for visual regression testing and Storybook hosting.
|
|
296
|
+
|
|
297
|
+
- **Automatic deployment** on every push to `main` branch
|
|
298
|
+
- **Visual diff detection** for UI changes
|
|
299
|
+
- **Storybook hosting** at the live demo URL
|
|
300
|
+
|
|
301
|
+
Chromatic runs via GitHub Actions (`.github/workflows/chromatic.yml`).
|
|
302
|
+
|
|
303
|
+
## Project Structure
|
|
304
|
+
|
|
305
|
+
```
|
|
306
|
+
packages/react-visualizers/
|
|
307
|
+
├── src/
|
|
308
|
+
│ ├── index.ts # Main exports
|
|
309
|
+
│ ├── styles.css # Tailwind entry point
|
|
310
|
+
│ ├── shared/ # Shared components & hooks
|
|
311
|
+
│ │ ├── ControlPanel.tsx
|
|
312
|
+
│ │ ├── CodePanel.tsx
|
|
313
|
+
│ │ ├── useVisualizerPlayback.ts
|
|
314
|
+
│ │ ├── useInterviewMode.ts
|
|
315
|
+
│ │ └── *.test.ts # Unit tests
|
|
316
|
+
│ └── visualizers/ # All visualizers
|
|
317
|
+
│ ├── SortingVisualizer.tsx
|
|
318
|
+
│ ├── HashMapVisualizer.tsx
|
|
319
|
+
│ └── stories/ # Storybook stories
|
|
320
|
+
├── dist/ # Build output
|
|
321
|
+
├── .storybook/ # Storybook config
|
|
322
|
+
├── package.json
|
|
323
|
+
└── vite.config.ts
|
|
324
|
+
```
|
|
325
|
+
|
|
326
|
+
## Publishing
|
|
327
|
+
|
|
328
|
+
```bash
|
|
329
|
+
# Bump version
|
|
330
|
+
npm version patch # or minor/major
|
|
331
|
+
|
|
332
|
+
# Build
|
|
333
|
+
bun run build
|
|
334
|
+
|
|
335
|
+
# Publish to npm
|
|
336
|
+
npm publish --access public
|
|
337
|
+
|
|
338
|
+
# Push version tag
|
|
339
|
+
git push && git push --tags
|
|
272
340
|
```
|
|
273
341
|
|
|
274
342
|
## Contributing
|
|
275
343
|
|
|
276
|
-
Contributions are welcome! Please
|
|
344
|
+
Contributions are welcome! Please:
|
|
345
|
+
|
|
346
|
+
1. Fork the repository
|
|
347
|
+
2. Create a feature branch
|
|
348
|
+
3. Add tests for new functionality
|
|
349
|
+
4. Ensure all tests pass (`bun run test`)
|
|
350
|
+
5. Submit a pull request
|
|
277
351
|
|
|
278
352
|
## License
|
|
279
353
|
|