react-state-basis 0.4.1 → 0.4.2
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 +26 -12
- package/dist/index.d.mts +13 -6
- package/dist/index.d.ts +13 -6
- package/dist/index.js +312 -203
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +311 -203
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -179,9 +179,19 @@ Shows:
|
|
|
179
179
|
- **Synchronized Clusters** - Groups of variables that move together
|
|
180
180
|
- **Correlation Matrix** - Full pairwise similarity analysis (for <15 variables)
|
|
181
181
|
|
|
182
|
+
### Hardware Telemetry
|
|
183
|
+
|
|
184
|
+
Verify engine efficiency and heap stability in real-time:
|
|
185
|
+
|
|
186
|
+
```tsx
|
|
187
|
+
window.getBasisMetrics();
|
|
188
|
+
```
|
|
189
|
+
|
|
190
|
+
Returns: Engine execution time, active hook count, and current memory allocation strategy.
|
|
191
|
+
|
|
182
192
|
---
|
|
183
193
|
|
|
184
|
-
## How It Works (v0.4.
|
|
194
|
+
## How It Works (v0.4.x)
|
|
185
195
|
|
|
186
196
|
### Temporal Cross-Correlation
|
|
187
197
|
|
|
@@ -276,7 +286,7 @@ In production builds, the entire tool is replaced with zero-op shims. **Zero run
|
|
|
276
286
|
Add `// @basis-ignore` at the top of a file to disable instrumentation:
|
|
277
287
|
```tsx
|
|
278
288
|
// @basis-ignore
|
|
279
|
-
// This file
|
|
289
|
+
// This file contains external protocols or hardware-bound synchronization outside the scope of architectural auditing.
|
|
280
290
|
```
|
|
281
291
|
|
|
282
292
|
**Good candidates for skipping:**
|
|
@@ -305,24 +315,27 @@ These tools are complementary - use them together for best results.
|
|
|
305
315
|
|
|
306
316
|
**Development Mode**
|
|
307
317
|
|
|
308
|
-
|
|
318
|
+
**Basis is designed to be statistically invisible to the main thread.**
|
|
319
|
+
|
|
320
|
+
The v0.4.2 **Flat Memory Architecture** utilizes `Uint8Array` Ring Buffers to eliminate Garbage Collection (GC) churn and provide constant-time $O(1)$ telemetry recording.
|
|
309
321
|
|
|
310
|
-
|
|
322
|
+
### Audited Benchmarks
|
|
311
323
|
|
|
312
|
-
**
|
|
324
|
+
These metrics were recorded during a **20-minute high-frequency endurance audit** (1.2M state pulses) using the built-in **Stress Lab**.
|
|
313
325
|
|
|
314
|
-
*
|
|
315
|
-
*
|
|
316
|
-
*
|
|
317
|
-
*
|
|
326
|
+
* **Logic Execution Overhead:** < 1.0ms per 100-hook update cycle.
|
|
327
|
+
* **Memory Profile:** **0 Delta heap growth.** (Static allocation via Ring Buffers).
|
|
328
|
+
* **Interaction Latency (INP):** ~56ms during continuous 50-hook concurrency tests (Green Zone).
|
|
329
|
+
* **Drawing Efficiency:** ~15ms drawing cost via Path2D GPU-batching.
|
|
318
330
|
|
|
319
|
-
>
|
|
331
|
+
> 🔍 **Forensic Proof:** Detailed heap snapshots, modulo-tax analysis, and linearized math benchmarks are documented in the [**v0.4.2 Performance RFC (#33)**](https://github.com/liovic/react-state-basis/issues/33).
|
|
320
332
|
|
|
321
333
|
<p align="center">
|
|
322
|
-
<img src="./assets/
|
|
334
|
+
<img src="./assets/perf.gif" width="800" alt="Basis Stress Lab" />
|
|
323
335
|
</p>
|
|
324
336
|
|
|
325
337
|
|
|
338
|
+
|
|
326
339
|
**Production Mode:**
|
|
327
340
|
- Overhead: ~0.01ms per hook call (negligible wrapper overhead)
|
|
328
341
|
- Bundle size: ~2-3 KB minified (no-op wrappers only, no analysis engine)
|
|
@@ -354,7 +367,8 @@ Location: `/example`
|
|
|
354
367
|
### v0.4.x
|
|
355
368
|
- [x] **v0.4.0**: Temporal Cross-Correlation Engine (Lead-Lag Analysis)
|
|
356
369
|
- [x] **v0.4.1:** Density Filtering (Eliminate false positives from animations/sliders)
|
|
357
|
-
- [
|
|
370
|
+
- [x] v0.4.2: Ring Buffer (Zero-jank memory management for 500+ hooks) [**v0.4.2 Performance RFC (#33)**](https://github.com/liovic/react-state-basis/issues/33)
|
|
371
|
+
|
|
358
372
|
|
|
359
373
|
### v0.5.0 (Planned)
|
|
360
374
|
- [ ] Zustand & Redux middleware integration
|
package/dist/index.d.mts
CHANGED
|
@@ -3,6 +3,18 @@ import React__default, { ReactNode } from 'react';
|
|
|
3
3
|
export { basis } from './vite-plugin.mjs';
|
|
4
4
|
import 'vite';
|
|
5
5
|
|
|
6
|
+
declare const configureBasis: (c: any) => void;
|
|
7
|
+
/**
|
|
8
|
+
* DISPLAY: window.printBasisReport()
|
|
9
|
+
*/
|
|
10
|
+
declare const printBasisHealthReport: (threshold?: number) => void;
|
|
11
|
+
declare const getBasisMetrics: () => {
|
|
12
|
+
engine: string;
|
|
13
|
+
hooks: number;
|
|
14
|
+
load: number;
|
|
15
|
+
analysis_ms: string;
|
|
16
|
+
};
|
|
17
|
+
|
|
6
18
|
type GetReducerState<R extends React.Reducer<any, any>> = R extends React.Reducer<infer S, any> ? S : never;
|
|
7
19
|
type GetReducerAction<R extends React.Reducer<any, any>> = R extends React.Reducer<any, infer A> ? A : never;
|
|
8
20
|
declare function useState<S>(initialState: S | (() => S), label?: string): [S, React.Dispatch<React.SetStateAction<S>>];
|
|
@@ -34,9 +46,4 @@ declare const useBasisConfig: () => {
|
|
|
34
46
|
debug: boolean;
|
|
35
47
|
};
|
|
36
48
|
|
|
37
|
-
|
|
38
|
-
debug: boolean;
|
|
39
|
-
}>) => void;
|
|
40
|
-
declare const printBasisHealthReport: (threshold?: number) => void;
|
|
41
|
-
|
|
42
|
-
export { BasisProvider, configureBasis, printBasisHealthReport, use, useActionState, useBasisConfig, useCallback, useDebugValue, useDeferredValue, useEffect, useId, useImperativeHandle, useInsertionEffect, useLayoutEffect, useMemo, useOptimistic, useReducer, useRef, useState, useSyncExternalStore, useTransition };
|
|
49
|
+
export { BasisProvider, configureBasis, getBasisMetrics, printBasisHealthReport, use, useActionState, useBasisConfig, useCallback, useDebugValue, useDeferredValue, useEffect, useId, useImperativeHandle, useInsertionEffect, useLayoutEffect, useMemo, useOptimistic, useReducer, useRef, useState, useSyncExternalStore, useTransition };
|
package/dist/index.d.ts
CHANGED
|
@@ -3,6 +3,18 @@ import React__default, { ReactNode } from 'react';
|
|
|
3
3
|
export { basis } from './vite-plugin.js';
|
|
4
4
|
import 'vite';
|
|
5
5
|
|
|
6
|
+
declare const configureBasis: (c: any) => void;
|
|
7
|
+
/**
|
|
8
|
+
* DISPLAY: window.printBasisReport()
|
|
9
|
+
*/
|
|
10
|
+
declare const printBasisHealthReport: (threshold?: number) => void;
|
|
11
|
+
declare const getBasisMetrics: () => {
|
|
12
|
+
engine: string;
|
|
13
|
+
hooks: number;
|
|
14
|
+
load: number;
|
|
15
|
+
analysis_ms: string;
|
|
16
|
+
};
|
|
17
|
+
|
|
6
18
|
type GetReducerState<R extends React.Reducer<any, any>> = R extends React.Reducer<infer S, any> ? S : never;
|
|
7
19
|
type GetReducerAction<R extends React.Reducer<any, any>> = R extends React.Reducer<any, infer A> ? A : never;
|
|
8
20
|
declare function useState<S>(initialState: S | (() => S), label?: string): [S, React.Dispatch<React.SetStateAction<S>>];
|
|
@@ -34,9 +46,4 @@ declare const useBasisConfig: () => {
|
|
|
34
46
|
debug: boolean;
|
|
35
47
|
};
|
|
36
48
|
|
|
37
|
-
|
|
38
|
-
debug: boolean;
|
|
39
|
-
}>) => void;
|
|
40
|
-
declare const printBasisHealthReport: (threshold?: number) => void;
|
|
41
|
-
|
|
42
|
-
export { BasisProvider, configureBasis, printBasisHealthReport, use, useActionState, useBasisConfig, useCallback, useDebugValue, useDeferredValue, useEffect, useId, useImperativeHandle, useInsertionEffect, useLayoutEffect, useMemo, useOptimistic, useReducer, useRef, useState, useSyncExternalStore, useTransition };
|
|
49
|
+
export { BasisProvider, configureBasis, getBasisMetrics, printBasisHealthReport, use, useActionState, useBasisConfig, useCallback, useDebugValue, useDeferredValue, useEffect, useId, useImperativeHandle, useInsertionEffect, useLayoutEffect, useMemo, useOptimistic, useReducer, useRef, useState, useSyncExternalStore, useTransition };
|