@tomaszjarosz/react-visualizers 0.1.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/LICENSE +21 -0
- package/README.md +73 -0
- package/dist/index.cjs +10120 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.ts +322 -0
- package/dist/index.js +10120 -0
- package/dist/index.js.map +1 -0
- package/package.json +71 -0
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,322 @@
|
|
|
1
|
+
import { default as default_2 } from 'react';
|
|
2
|
+
|
|
3
|
+
export declare const ArrayDequeVisualizer: default_2.NamedExoticComponent<ArrayDequeVisualizerProps>;
|
|
4
|
+
|
|
5
|
+
declare interface ArrayDequeVisualizerProps {
|
|
6
|
+
showControls?: boolean;
|
|
7
|
+
showCode?: boolean;
|
|
8
|
+
className?: string;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
export declare const ArrayInput: default_2.FC<ArrayInputProps>;
|
|
12
|
+
|
|
13
|
+
export declare interface ArrayInputProps {
|
|
14
|
+
array: number[];
|
|
15
|
+
onArrayChange: (newArray: number[]) => void;
|
|
16
|
+
disabled?: boolean;
|
|
17
|
+
maxSize?: number;
|
|
18
|
+
minSize?: number;
|
|
19
|
+
maxValue?: number;
|
|
20
|
+
minValue?: number;
|
|
21
|
+
accentColor?: 'indigo' | 'orange' | 'green' | 'purple' | 'blue' | 'cyan' | 'red' | 'lime' | 'teal' | 'violet';
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
export declare const ArrayListVisualizer: default_2.NamedExoticComponent<ArrayListVisualizerProps>;
|
|
25
|
+
|
|
26
|
+
declare interface ArrayListVisualizerProps {
|
|
27
|
+
showControls?: boolean;
|
|
28
|
+
showCode?: boolean;
|
|
29
|
+
className?: string;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
export declare const BinarySearchVisualizer: default_2.NamedExoticComponent<BinarySearchVisualizerProps>;
|
|
33
|
+
|
|
34
|
+
declare interface BinarySearchVisualizerProps {
|
|
35
|
+
initialSize?: number;
|
|
36
|
+
showControls?: boolean;
|
|
37
|
+
showCode?: boolean;
|
|
38
|
+
className?: string;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
export declare const BlockingQueueVisualizer: default_2.NamedExoticComponent<BlockingQueueVisualizerProps>;
|
|
42
|
+
|
|
43
|
+
declare interface BlockingQueueVisualizerProps {
|
|
44
|
+
showControls?: boolean;
|
|
45
|
+
showCode?: boolean;
|
|
46
|
+
className?: string;
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
export declare const CodePanel: default_2.FC<CodePanelProps>;
|
|
50
|
+
|
|
51
|
+
declare interface CodePanelProps {
|
|
52
|
+
code: string[];
|
|
53
|
+
activeLine: number;
|
|
54
|
+
variables?: Record<string, string | number>;
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
export declare const ConcurrentHashMapVisualizer: default_2.NamedExoticComponent<ConcurrentHashMapVisualizerProps>;
|
|
58
|
+
|
|
59
|
+
declare interface ConcurrentHashMapVisualizerProps {
|
|
60
|
+
showControls?: boolean;
|
|
61
|
+
showCode?: boolean;
|
|
62
|
+
className?: string;
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
export declare const ControlPanel: default_2.FC<ControlPanelProps>;
|
|
66
|
+
|
|
67
|
+
export declare interface ControlPanelProps {
|
|
68
|
+
isPlaying: boolean;
|
|
69
|
+
currentStep: number;
|
|
70
|
+
totalSteps: number;
|
|
71
|
+
speed: number;
|
|
72
|
+
onPlayPause: () => void;
|
|
73
|
+
onStep: () => void;
|
|
74
|
+
onStepBack: () => void;
|
|
75
|
+
onReset: () => void;
|
|
76
|
+
onSpeedChange: (speed: number) => void;
|
|
77
|
+
onShuffle?: () => void;
|
|
78
|
+
accentColor?: 'indigo' | 'orange' | 'green' | 'purple' | 'blue' | 'cyan' | 'red' | 'lime' | 'teal' | 'violet';
|
|
79
|
+
showShuffle?: boolean;
|
|
80
|
+
shuffleLabel?: string;
|
|
81
|
+
extraControls?: default_2.ReactNode;
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
export declare const CopyOnWriteVisualizer: default_2.NamedExoticComponent<CopyOnWriteVisualizerProps>;
|
|
85
|
+
|
|
86
|
+
declare interface CopyOnWriteVisualizerProps {
|
|
87
|
+
showControls?: boolean;
|
|
88
|
+
showCode?: boolean;
|
|
89
|
+
className?: string;
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
export declare const DijkstraVisualizer: default_2.NamedExoticComponent<DijkstraVisualizerProps>;
|
|
93
|
+
|
|
94
|
+
declare interface DijkstraVisualizerProps {
|
|
95
|
+
showControls?: boolean;
|
|
96
|
+
showCode?: boolean;
|
|
97
|
+
className?: string;
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
export declare const DPVisualizer: default_2.NamedExoticComponent<DPVisualizerProps>;
|
|
101
|
+
|
|
102
|
+
declare interface DPVisualizerProps {
|
|
103
|
+
showControls?: boolean;
|
|
104
|
+
showCode?: boolean;
|
|
105
|
+
className?: string;
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
export declare const EnumSetVisualizer: default_2.NamedExoticComponent<EnumSetVisualizerProps>;
|
|
109
|
+
|
|
110
|
+
declare interface EnumSetVisualizerProps {
|
|
111
|
+
showControls?: boolean;
|
|
112
|
+
showCode?: boolean;
|
|
113
|
+
className?: string;
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
export declare const GCVisualizer: default_2.NamedExoticComponent<GCVisualizerProps>;
|
|
117
|
+
|
|
118
|
+
declare interface GCVisualizerProps {
|
|
119
|
+
showControls?: boolean;
|
|
120
|
+
showCode?: boolean;
|
|
121
|
+
className?: string;
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
export declare const GraphVisualizer: default_2.NamedExoticComponent<GraphVisualizerProps>;
|
|
125
|
+
|
|
126
|
+
declare interface GraphVisualizerProps {
|
|
127
|
+
algorithm?: TraversalAlgorithm;
|
|
128
|
+
showControls?: boolean;
|
|
129
|
+
showAlgorithmSelector?: boolean;
|
|
130
|
+
showCode?: boolean;
|
|
131
|
+
className?: string;
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
export declare const HashMapVisualizer: default_2.NamedExoticComponent<HashMapVisualizerProps>;
|
|
135
|
+
|
|
136
|
+
declare interface HashMapVisualizerProps {
|
|
137
|
+
showControls?: boolean;
|
|
138
|
+
showCode?: boolean;
|
|
139
|
+
className?: string;
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
export declare const HashTableVisualizer: default_2.NamedExoticComponent<HashTableVisualizerProps>;
|
|
143
|
+
|
|
144
|
+
declare interface HashTableVisualizerProps {
|
|
145
|
+
showControls?: boolean;
|
|
146
|
+
showCode?: boolean;
|
|
147
|
+
className?: string;
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
export declare const HelpPanel: default_2.FC;
|
|
151
|
+
|
|
152
|
+
export declare const ImmutableCollectionsVisualizer: default_2.NamedExoticComponent<ImmutableCollectionsVisualizerProps>;
|
|
153
|
+
|
|
154
|
+
declare interface ImmutableCollectionsVisualizerProps {
|
|
155
|
+
showControls?: boolean;
|
|
156
|
+
showCode?: boolean;
|
|
157
|
+
className?: string;
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
export declare const Legend: default_2.FC<LegendProps>;
|
|
161
|
+
|
|
162
|
+
export declare interface LegendItem {
|
|
163
|
+
color: string;
|
|
164
|
+
label: string;
|
|
165
|
+
border?: string;
|
|
166
|
+
}
|
|
167
|
+
|
|
168
|
+
export declare interface LegendProps {
|
|
169
|
+
items: LegendItem[];
|
|
170
|
+
showKeyboardHints?: boolean;
|
|
171
|
+
}
|
|
172
|
+
|
|
173
|
+
export declare const LinkedHashMapVisualizer: default_2.NamedExoticComponent<LinkedHashMapVisualizerProps>;
|
|
174
|
+
|
|
175
|
+
declare interface LinkedHashMapVisualizerProps {
|
|
176
|
+
showControls?: boolean;
|
|
177
|
+
showCode?: boolean;
|
|
178
|
+
className?: string;
|
|
179
|
+
}
|
|
180
|
+
|
|
181
|
+
export declare const LinkedListVisualizer: default_2.NamedExoticComponent<LinkedListVisualizerProps>;
|
|
182
|
+
|
|
183
|
+
declare interface LinkedListVisualizerProps {
|
|
184
|
+
showControls?: boolean;
|
|
185
|
+
showCode?: boolean;
|
|
186
|
+
className?: string;
|
|
187
|
+
}
|
|
188
|
+
|
|
189
|
+
export declare const PriorityQueueVisualizer: default_2.NamedExoticComponent<PriorityQueueVisualizerProps>;
|
|
190
|
+
|
|
191
|
+
declare interface PriorityQueueVisualizerProps {
|
|
192
|
+
showControls?: boolean;
|
|
193
|
+
showCode?: boolean;
|
|
194
|
+
className?: string;
|
|
195
|
+
}
|
|
196
|
+
|
|
197
|
+
/**
|
|
198
|
+
* Shared constants for sorting algorithm visualizers.
|
|
199
|
+
* Centralizes algorithm metadata to avoid duplication.
|
|
200
|
+
*/
|
|
201
|
+
declare type SortingAlgorithm = 'bubble' | 'selection' | 'insertion' | 'quick' | 'merge';
|
|
202
|
+
|
|
203
|
+
export declare const SortingComparisonVisualizer: default_2.NamedExoticComponent<SortingComparisonVisualizerProps>;
|
|
204
|
+
|
|
205
|
+
declare interface SortingComparisonVisualizerProps {
|
|
206
|
+
className?: string;
|
|
207
|
+
}
|
|
208
|
+
|
|
209
|
+
export declare const SortingVisualizer: default_2.NamedExoticComponent<SortingVisualizerProps>;
|
|
210
|
+
|
|
211
|
+
declare interface SortingVisualizerProps {
|
|
212
|
+
algorithm?: SortingAlgorithm;
|
|
213
|
+
initialSize?: number;
|
|
214
|
+
showControls?: boolean;
|
|
215
|
+
showAlgorithmSelector?: boolean;
|
|
216
|
+
showCode?: boolean;
|
|
217
|
+
className?: string;
|
|
218
|
+
}
|
|
219
|
+
|
|
220
|
+
export declare const SQLJoinVisualizer: default_2.NamedExoticComponent<SQLJoinVisualizerProps>;
|
|
221
|
+
|
|
222
|
+
declare interface SQLJoinVisualizerProps {
|
|
223
|
+
showControls?: boolean;
|
|
224
|
+
showCode?: boolean;
|
|
225
|
+
className?: string;
|
|
226
|
+
}
|
|
227
|
+
|
|
228
|
+
export declare const StatusPanel: default_2.FC<StatusPanelProps>;
|
|
229
|
+
|
|
230
|
+
export declare interface StatusPanelProps {
|
|
231
|
+
description: string;
|
|
232
|
+
currentStep: number;
|
|
233
|
+
totalSteps: number;
|
|
234
|
+
variant?: 'default' | 'success' | 'error' | 'warning';
|
|
235
|
+
}
|
|
236
|
+
|
|
237
|
+
export declare interface Step {
|
|
238
|
+
description: string;
|
|
239
|
+
comparisons?: number;
|
|
240
|
+
swaps?: number;
|
|
241
|
+
}
|
|
242
|
+
|
|
243
|
+
export declare const StepHistory: default_2.FC<StepHistoryProps>;
|
|
244
|
+
|
|
245
|
+
export declare interface StepHistoryProps {
|
|
246
|
+
steps: Step[];
|
|
247
|
+
currentStep: number;
|
|
248
|
+
onStepClick: (stepIndex: number) => void;
|
|
249
|
+
maxHeight?: string;
|
|
250
|
+
showStats?: boolean;
|
|
251
|
+
accentColor?: 'indigo' | 'orange' | 'green' | 'purple' | 'blue' | 'cyan' | 'red' | 'lime' | 'teal' | 'violet';
|
|
252
|
+
collapsed?: boolean;
|
|
253
|
+
onToggleCollapse?: () => void;
|
|
254
|
+
}
|
|
255
|
+
|
|
256
|
+
declare type TraversalAlgorithm = 'dfs' | 'bfs';
|
|
257
|
+
|
|
258
|
+
export declare const TreeSetVisualizer: default_2.NamedExoticComponent<TreeSetVisualizerProps>;
|
|
259
|
+
|
|
260
|
+
declare interface TreeSetVisualizerProps {
|
|
261
|
+
showControls?: boolean;
|
|
262
|
+
showCode?: boolean;
|
|
263
|
+
className?: string;
|
|
264
|
+
}
|
|
265
|
+
|
|
266
|
+
export declare function useUrlState(options?: UseUrlStateOptions): UseUrlStateReturn;
|
|
267
|
+
|
|
268
|
+
export declare interface UseUrlStateOptions {
|
|
269
|
+
prefix?: string;
|
|
270
|
+
enabled?: boolean;
|
|
271
|
+
scrollToId?: string;
|
|
272
|
+
}
|
|
273
|
+
|
|
274
|
+
export declare interface UseUrlStateReturn {
|
|
275
|
+
state: VisualizerState | null;
|
|
276
|
+
updateUrl: (state: VisualizerState) => void;
|
|
277
|
+
getShareableUrl: (state: VisualizerState) => string;
|
|
278
|
+
copyUrlToClipboard: (state: VisualizerState) => Promise<boolean>;
|
|
279
|
+
clearUrlState: () => void;
|
|
280
|
+
}
|
|
281
|
+
|
|
282
|
+
export declare function useVisualizerPlayback<T>({ generateSteps, onReset, }: UseVisualizerPlaybackOptions<T>): UseVisualizerPlaybackReturn<T>;
|
|
283
|
+
|
|
284
|
+
export declare interface UseVisualizerPlaybackOptions<T> {
|
|
285
|
+
generateSteps: () => T[];
|
|
286
|
+
onReset?: () => void;
|
|
287
|
+
}
|
|
288
|
+
|
|
289
|
+
export declare interface UseVisualizerPlaybackReturn<T> {
|
|
290
|
+
steps: T[];
|
|
291
|
+
currentStep: number;
|
|
292
|
+
currentStepData: T | undefined;
|
|
293
|
+
isPlaying: boolean;
|
|
294
|
+
speed: number;
|
|
295
|
+
setSpeed: (speed: number) => void;
|
|
296
|
+
handlePlayPause: () => void;
|
|
297
|
+
handleStep: () => void;
|
|
298
|
+
handleStepBack: () => void;
|
|
299
|
+
handleReset: () => void;
|
|
300
|
+
reinitialize: () => void;
|
|
301
|
+
}
|
|
302
|
+
|
|
303
|
+
/**
|
|
304
|
+
* Container for visualization content with fixed minimum height
|
|
305
|
+
* to prevent layout shifts during animation steps.
|
|
306
|
+
*/
|
|
307
|
+
export declare const VisualizationArea: default_2.FC<VisualizationAreaProps>;
|
|
308
|
+
|
|
309
|
+
export declare interface VisualizationAreaProps {
|
|
310
|
+
children: default_2.ReactNode;
|
|
311
|
+
minHeight?: number;
|
|
312
|
+
className?: string;
|
|
313
|
+
}
|
|
314
|
+
|
|
315
|
+
export declare interface VisualizerState {
|
|
316
|
+
array?: number[];
|
|
317
|
+
algorithm?: string;
|
|
318
|
+
step?: number;
|
|
319
|
+
speed?: number;
|
|
320
|
+
}
|
|
321
|
+
|
|
322
|
+
export { }
|