react-state-basis 0.3.0 → 0.3.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/dist/chunk-I5ZFRXQP.mjs +18 -0
- package/dist/chunk-I5ZFRXQP.mjs.map +1 -0
- package/dist/index.d.mts +13 -96
- package/dist/index.d.ts +13 -96
- package/dist/index.js +146 -248
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +152 -215
- package/dist/index.mjs.map +1 -1
- package/dist/plugin.js +51 -29
- package/dist/production.d.mts +19 -14
- package/dist/production.d.ts +19 -14
- package/dist/production.js +25 -8
- package/dist/production.js.map +1 -1
- package/dist/production.mjs +20 -9
- package/dist/production.mjs.map +1 -1
- package/dist/vite-plugin.js +5 -15
- package/dist/vite-plugin.js.map +1 -1
- package/dist/vite-plugin.mjs +1 -1
- package/package.json +1 -1
- package/dist/chunk-GEHMQPV4.mjs +0 -28
- package/dist/chunk-GEHMQPV4.mjs.map +0 -1
package/dist/index.js
CHANGED
|
@@ -31,63 +31,33 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
|
|
|
31
31
|
var index_exports = {};
|
|
32
32
|
__export(index_exports, {
|
|
33
33
|
BasisProvider: () => BasisProvider,
|
|
34
|
-
Children: () => Children2,
|
|
35
|
-
Component: () => Component2,
|
|
36
|
-
Fragment: () => Fragment2,
|
|
37
|
-
Profiler: () => Profiler2,
|
|
38
|
-
PureComponent: () => PureComponent2,
|
|
39
|
-
React: () => ReactNamespace,
|
|
40
|
-
StrictMode: () => StrictMode2,
|
|
41
|
-
Suspense: () => Suspense2,
|
|
42
|
-
__testEngine__: () => __testEngine__,
|
|
43
|
-
__test__: () => __test__,
|
|
44
34
|
basis: () => basis,
|
|
45
|
-
beginEffectTracking: () => beginEffectTracking,
|
|
46
|
-
cloneElement: () => cloneElement2,
|
|
47
|
-
config: () => config,
|
|
48
35
|
configureBasis: () => configureBasis,
|
|
49
|
-
createContext: () => createContext2,
|
|
50
|
-
createElement: () => createElement2,
|
|
51
|
-
createPortal: () => createPortal,
|
|
52
|
-
createRef: () => createRef2,
|
|
53
|
-
currentTickBatch: () => currentTickBatch,
|
|
54
|
-
default: () => index_default,
|
|
55
|
-
endEffectTracking: () => endEffectTracking,
|
|
56
|
-
flushSync: () => flushSync,
|
|
57
|
-
forwardRef: () => forwardRef2,
|
|
58
|
-
history: () => history,
|
|
59
|
-
isValidElement: () => isValidElement2,
|
|
60
|
-
lazy: () => lazy2,
|
|
61
|
-
memo: () => memo2,
|
|
62
36
|
printBasisHealthReport: () => printBasisHealthReport,
|
|
63
|
-
recordUpdate: () => recordUpdate,
|
|
64
|
-
registerVariable: () => registerVariable,
|
|
65
|
-
startTransition: () => startTransition2,
|
|
66
|
-
unregisterVariable: () => unregisterVariable,
|
|
67
37
|
use: () => use,
|
|
68
38
|
useActionState: () => useActionState2,
|
|
69
39
|
useBasisConfig: () => useBasisConfig,
|
|
70
40
|
useCallback: () => useCallback,
|
|
71
|
-
useContext: () => useContext2,
|
|
72
41
|
useDebugValue: () => useDebugValue2,
|
|
73
42
|
useDeferredValue: () => useDeferredValue,
|
|
74
|
-
useEffect: () =>
|
|
43
|
+
useEffect: () => useEffect,
|
|
75
44
|
useId: () => useId2,
|
|
76
45
|
useImperativeHandle: () => useImperativeHandle2,
|
|
77
46
|
useInsertionEffect: () => useInsertionEffect2,
|
|
78
|
-
useLayoutEffect: () =>
|
|
47
|
+
useLayoutEffect: () => useLayoutEffect,
|
|
79
48
|
useMemo: () => useMemo,
|
|
80
49
|
useOptimistic: () => useOptimistic2,
|
|
81
50
|
useReducer: () => useReducer,
|
|
82
|
-
useRef: () =>
|
|
83
|
-
useState: () =>
|
|
51
|
+
useRef: () => useRef,
|
|
52
|
+
useState: () => useState,
|
|
84
53
|
useSyncExternalStore: () => useSyncExternalStore,
|
|
85
|
-
useTransition: () => useTransition
|
|
86
|
-
version: () => version2
|
|
54
|
+
useTransition: () => useTransition
|
|
87
55
|
});
|
|
88
56
|
module.exports = __toCommonJS(index_exports);
|
|
89
|
-
|
|
90
|
-
|
|
57
|
+
|
|
58
|
+
// src/hooks.ts
|
|
59
|
+
var React = __toESM(require("react"));
|
|
60
|
+
var import_react = require("react");
|
|
91
61
|
|
|
92
62
|
// src/core/logger.ts
|
|
93
63
|
var isWeb = typeof window !== "undefined" && typeof window.document !== "undefined";
|
|
@@ -428,11 +398,134 @@ var __testEngine__ = {
|
|
|
428
398
|
endEffectTracking
|
|
429
399
|
};
|
|
430
400
|
|
|
401
|
+
// src/hooks.ts
|
|
402
|
+
function useState(initialState, label) {
|
|
403
|
+
const [val, setVal] = (0, import_react.useState)(initialState);
|
|
404
|
+
const effectiveLabel = label || "anonymous_state";
|
|
405
|
+
(0, import_react.useEffect)(() => {
|
|
406
|
+
registerVariable(effectiveLabel);
|
|
407
|
+
return () => unregisterVariable(effectiveLabel);
|
|
408
|
+
}, [effectiveLabel]);
|
|
409
|
+
const setter = (0, import_react.useCallback)((newValue) => {
|
|
410
|
+
if (recordUpdate(effectiveLabel)) setVal(newValue);
|
|
411
|
+
}, [effectiveLabel, setVal]);
|
|
412
|
+
return [val, setter];
|
|
413
|
+
}
|
|
414
|
+
function useRef(initialValue, _label) {
|
|
415
|
+
return (0, import_react.useRef)(initialValue);
|
|
416
|
+
}
|
|
417
|
+
function useReducer(reducer, initialArg, init, label) {
|
|
418
|
+
const effectiveLabel = typeof init === "string" ? init : label || "anonymous_reducer";
|
|
419
|
+
const reactInit = typeof init === "function" ? init : void 0;
|
|
420
|
+
const [state, dispatch] = (0, import_react.useReducer)(reducer, initialArg, reactInit);
|
|
421
|
+
(0, import_react.useEffect)(() => {
|
|
422
|
+
registerVariable(effectiveLabel);
|
|
423
|
+
return () => unregisterVariable(effectiveLabel);
|
|
424
|
+
}, [effectiveLabel]);
|
|
425
|
+
const basisDispatch = (0, import_react.useCallback)((action) => {
|
|
426
|
+
if (recordUpdate(effectiveLabel)) dispatch(action);
|
|
427
|
+
}, [effectiveLabel, dispatch]);
|
|
428
|
+
return [state, basisDispatch];
|
|
429
|
+
}
|
|
430
|
+
function useMemo(factory, deps, label) {
|
|
431
|
+
const effectiveLabel = label || "anonymous_projection";
|
|
432
|
+
(0, import_react.useEffect)(() => {
|
|
433
|
+
if (config.debug) console.log(`%c [Basis] Valid Projection: "${effectiveLabel}" `, "color: #2ecc71; font-weight: bold;");
|
|
434
|
+
}, [effectiveLabel]);
|
|
435
|
+
return (0, import_react.useMemo)(factory, deps || []);
|
|
436
|
+
}
|
|
437
|
+
function useCallback(callback, deps, label) {
|
|
438
|
+
const effectiveLabel = label || "anonymous_callback";
|
|
439
|
+
(0, import_react.useEffect)(() => {
|
|
440
|
+
if (config.debug) console.log(`%c [Basis] Stable Callback: "${effectiveLabel}" `, "color: #2ecc71; font-weight: bold;");
|
|
441
|
+
}, [effectiveLabel]);
|
|
442
|
+
return (0, import_react.useCallback)(callback, deps);
|
|
443
|
+
}
|
|
444
|
+
function useEffect(effect, deps, label) {
|
|
445
|
+
const effectiveLabel = label || "anonymous_effect";
|
|
446
|
+
(0, import_react.useEffect)(() => {
|
|
447
|
+
beginEffectTracking(effectiveLabel);
|
|
448
|
+
const cleanup = effect();
|
|
449
|
+
endEffectTracking();
|
|
450
|
+
return cleanup;
|
|
451
|
+
}, deps);
|
|
452
|
+
}
|
|
453
|
+
function useLayoutEffect(effect, deps, label) {
|
|
454
|
+
const effectiveLabel = label || "anonymous_layout_effect";
|
|
455
|
+
(0, import_react.useLayoutEffect)(() => {
|
|
456
|
+
beginEffectTracking(effectiveLabel);
|
|
457
|
+
const cleanup = effect();
|
|
458
|
+
endEffectTracking();
|
|
459
|
+
return cleanup;
|
|
460
|
+
}, deps);
|
|
461
|
+
}
|
|
462
|
+
function useTransition(_label) {
|
|
463
|
+
const [isPending, startTransition] = (0, import_react.useTransition)();
|
|
464
|
+
const effectiveLabel = _label || "anonymous_transition";
|
|
465
|
+
const basisStartTransition = (callback) => {
|
|
466
|
+
if (config.debug) console.log(`%c [Basis] Transition Started: "${effectiveLabel}" `, "color: #e67e22; font-weight: bold;");
|
|
467
|
+
startTransition(callback);
|
|
468
|
+
};
|
|
469
|
+
return [isPending, basisStartTransition];
|
|
470
|
+
}
|
|
471
|
+
function useDeferredValue(value, initialValueOrLabel, label) {
|
|
472
|
+
const isLabelAsSecondArg = typeof initialValueOrLabel === "string" && label === void 0;
|
|
473
|
+
const actualInitialValue = isLabelAsSecondArg ? void 0 : initialValueOrLabel;
|
|
474
|
+
const effectiveLabel = isLabelAsSecondArg ? initialValueOrLabel : label || "anonymous_deferred";
|
|
475
|
+
const deferredValue = (0, import_react.useDeferredValue)(value, actualInitialValue);
|
|
476
|
+
(0, import_react.useEffect)(() => {
|
|
477
|
+
if (config.debug && value !== deferredValue) console.log(`%c [Basis] Value Deferred: "${effectiveLabel}" `, "color: #e67e22; font-weight: bold;");
|
|
478
|
+
}, [value, deferredValue, effectiveLabel]);
|
|
479
|
+
return deferredValue;
|
|
480
|
+
}
|
|
481
|
+
var useId2 = (label) => React.useId();
|
|
482
|
+
var useDebugValue2 = React.useDebugValue;
|
|
483
|
+
var useImperativeHandle2 = React.useImperativeHandle;
|
|
484
|
+
var useInsertionEffect2 = React.useInsertionEffect;
|
|
485
|
+
var useSyncExternalStore = import_react.useSyncExternalStore;
|
|
486
|
+
function use(usable) {
|
|
487
|
+
return (0, import_react.use)(usable);
|
|
488
|
+
}
|
|
489
|
+
function useOptimistic2(passthrough, reducer, label) {
|
|
490
|
+
const effectiveLabel = label || "anonymous_optimistic";
|
|
491
|
+
(0, import_react.useEffect)(() => {
|
|
492
|
+
registerVariable(effectiveLabel);
|
|
493
|
+
return () => unregisterVariable(effectiveLabel);
|
|
494
|
+
}, [effectiveLabel]);
|
|
495
|
+
const [state, reactAddOptimistic] = React.useOptimistic(passthrough, reducer);
|
|
496
|
+
const addOptimistic = (0, import_react.useCallback)((payload) => {
|
|
497
|
+
if (recordUpdate(effectiveLabel)) {
|
|
498
|
+
reactAddOptimistic(payload);
|
|
499
|
+
}
|
|
500
|
+
}, [effectiveLabel, reactAddOptimistic]);
|
|
501
|
+
return [state, addOptimistic];
|
|
502
|
+
}
|
|
503
|
+
function useActionState2(action, initialState, permalink, label) {
|
|
504
|
+
const isLabelAsThirdArg = typeof permalink === "string" && label === void 0;
|
|
505
|
+
const actualPermalink = isLabelAsThirdArg ? void 0 : permalink;
|
|
506
|
+
const effectiveLabel = isLabelAsThirdArg ? permalink : label || "anonymous_action_state";
|
|
507
|
+
const [state, reactDispatch, isPending] = React.useActionState(
|
|
508
|
+
action,
|
|
509
|
+
initialState,
|
|
510
|
+
actualPermalink
|
|
511
|
+
);
|
|
512
|
+
(0, import_react.useEffect)(() => {
|
|
513
|
+
registerVariable(effectiveLabel);
|
|
514
|
+
return () => unregisterVariable(effectiveLabel);
|
|
515
|
+
}, [effectiveLabel]);
|
|
516
|
+
const basisDispatch = (0, import_react.useCallback)((payload) => {
|
|
517
|
+
if (recordUpdate(effectiveLabel)) {
|
|
518
|
+
reactDispatch(payload);
|
|
519
|
+
}
|
|
520
|
+
}, [effectiveLabel, reactDispatch]);
|
|
521
|
+
return [state, basisDispatch, isPending];
|
|
522
|
+
}
|
|
523
|
+
|
|
431
524
|
// src/context.tsx
|
|
432
|
-
var
|
|
525
|
+
var import_react3 = require("react");
|
|
433
526
|
|
|
434
527
|
// src/ui/BasisHUD.tsx
|
|
435
|
-
var
|
|
528
|
+
var import_react2 = require("react");
|
|
436
529
|
|
|
437
530
|
// src/ui/config.ts
|
|
438
531
|
var HUD_DIMENSIONS = {
|
|
@@ -474,9 +567,9 @@ var getHUDContainerStyle = (isExpanded) => ({
|
|
|
474
567
|
// src/ui/BasisHUD.tsx
|
|
475
568
|
var import_jsx_runtime = require("react/jsx-runtime");
|
|
476
569
|
var BasisHUD = () => {
|
|
477
|
-
const [isExpanded, setIsExpanded] = (0,
|
|
478
|
-
const canvasRef = (0,
|
|
479
|
-
(0,
|
|
570
|
+
const [isExpanded, setIsExpanded] = (0, import_react2.useState)(false);
|
|
571
|
+
const canvasRef = (0, import_react2.useRef)(null);
|
|
572
|
+
(0, import_react2.useEffect)(() => {
|
|
480
573
|
if (!isExpanded) return;
|
|
481
574
|
let animationFrame;
|
|
482
575
|
const draw = () => {
|
|
@@ -582,10 +675,10 @@ var HUDFooter = () => /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { styl
|
|
|
582
675
|
|
|
583
676
|
// src/context.tsx
|
|
584
677
|
var import_jsx_runtime2 = require("react/jsx-runtime");
|
|
585
|
-
var BasisContext = (0,
|
|
678
|
+
var BasisContext = (0, import_react3.createContext)({ debug: false });
|
|
586
679
|
var isWeb2 = typeof window !== "undefined" && typeof window.document !== "undefined";
|
|
587
680
|
var BasisProvider = ({ children, debug = true }) => {
|
|
588
|
-
(0,
|
|
681
|
+
(0, import_react3.useLayoutEffect)(() => {
|
|
589
682
|
configureBasis({ debug });
|
|
590
683
|
if (isWeb2) {
|
|
591
684
|
window._basis_debug = debug;
|
|
@@ -596,225 +689,31 @@ var BasisProvider = ({ children, debug = true }) => {
|
|
|
596
689
|
debug && isWeb2 && /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(BasisHUD, {})
|
|
597
690
|
] });
|
|
598
691
|
};
|
|
599
|
-
var useBasisConfig = () => (0,
|
|
600
|
-
|
|
601
|
-
// src/hooks.ts
|
|
602
|
-
var React3 = __toESM(require("react"));
|
|
603
|
-
var import_react3 = require("react");
|
|
604
|
-
function useState2(initialState, label) {
|
|
605
|
-
const [val, setVal] = (0, import_react3.useState)(initialState);
|
|
606
|
-
const effectiveLabel = label || "anonymous_state";
|
|
607
|
-
(0, import_react3.useEffect)(() => {
|
|
608
|
-
registerVariable(effectiveLabel);
|
|
609
|
-
return () => unregisterVariable(effectiveLabel);
|
|
610
|
-
}, [effectiveLabel]);
|
|
611
|
-
const setter = (0, import_react3.useCallback)((newValue) => {
|
|
612
|
-
if (recordUpdate(effectiveLabel)) setVal(newValue);
|
|
613
|
-
}, [effectiveLabel, setVal]);
|
|
614
|
-
return [val, setter];
|
|
615
|
-
}
|
|
616
|
-
function useRef2(initialValue, _label) {
|
|
617
|
-
return (0, import_react3.useRef)(initialValue);
|
|
618
|
-
}
|
|
619
|
-
function useReducer(reducer, initialArg, init, label) {
|
|
620
|
-
const effectiveLabel = typeof init === "string" ? init : label || "anonymous_reducer";
|
|
621
|
-
const reactInit = typeof init === "function" ? init : void 0;
|
|
622
|
-
const [state, dispatch] = (0, import_react3.useReducer)(reducer, initialArg, reactInit);
|
|
623
|
-
(0, import_react3.useEffect)(() => {
|
|
624
|
-
registerVariable(effectiveLabel);
|
|
625
|
-
return () => unregisterVariable(effectiveLabel);
|
|
626
|
-
}, [effectiveLabel]);
|
|
627
|
-
const basisDispatch = (0, import_react3.useCallback)((action) => {
|
|
628
|
-
if (recordUpdate(effectiveLabel)) dispatch(action);
|
|
629
|
-
}, [effectiveLabel, dispatch]);
|
|
630
|
-
return [state, basisDispatch];
|
|
631
|
-
}
|
|
632
|
-
function useMemo(factory, deps, label) {
|
|
633
|
-
const effectiveLabel = label || "anonymous_projection";
|
|
634
|
-
(0, import_react3.useEffect)(() => {
|
|
635
|
-
if (config.debug) console.log(`%c [Basis] Valid Projection: "${effectiveLabel}" `, "color: #2ecc71; font-weight: bold;");
|
|
636
|
-
}, [effectiveLabel]);
|
|
637
|
-
return (0, import_react3.useMemo)(factory, deps || []);
|
|
638
|
-
}
|
|
639
|
-
function useCallback(callback, deps, label) {
|
|
640
|
-
const effectiveLabel = label || "anonymous_callback";
|
|
641
|
-
(0, import_react3.useEffect)(() => {
|
|
642
|
-
if (config.debug) console.log(`%c [Basis] Stable Callback: "${effectiveLabel}" `, "color: #2ecc71; font-weight: bold;");
|
|
643
|
-
}, [effectiveLabel]);
|
|
644
|
-
return (0, import_react3.useCallback)(callback, deps);
|
|
645
|
-
}
|
|
646
|
-
function useEffect2(effect, deps, label) {
|
|
647
|
-
const effectiveLabel = label || "anonymous_effect";
|
|
648
|
-
(0, import_react3.useEffect)(() => {
|
|
649
|
-
beginEffectTracking(effectiveLabel);
|
|
650
|
-
const cleanup = effect();
|
|
651
|
-
endEffectTracking();
|
|
652
|
-
return cleanup;
|
|
653
|
-
}, deps);
|
|
654
|
-
}
|
|
655
|
-
function useLayoutEffect2(effect, deps, label) {
|
|
656
|
-
const effectiveLabel = label || "anonymous_layout_effect";
|
|
657
|
-
(0, import_react3.useLayoutEffect)(() => {
|
|
658
|
-
beginEffectTracking(effectiveLabel);
|
|
659
|
-
const cleanup = effect();
|
|
660
|
-
endEffectTracking();
|
|
661
|
-
return cleanup;
|
|
662
|
-
}, deps);
|
|
663
|
-
}
|
|
664
|
-
function useTransition(_label) {
|
|
665
|
-
const [isPending, startTransition3] = (0, import_react3.useTransition)();
|
|
666
|
-
const effectiveLabel = _label || "anonymous_transition";
|
|
667
|
-
const basisStartTransition = (callback) => {
|
|
668
|
-
if (config.debug) console.log(`%c [Basis] Transition Started: "${effectiveLabel}" `, "color: #e67e22; font-weight: bold;");
|
|
669
|
-
startTransition3(callback);
|
|
670
|
-
};
|
|
671
|
-
return [isPending, basisStartTransition];
|
|
672
|
-
}
|
|
673
|
-
function useDeferredValue(value, initialValueOrLabel, label) {
|
|
674
|
-
const isLabelAsSecondArg = typeof initialValueOrLabel === "string" && label === void 0;
|
|
675
|
-
const actualInitialValue = isLabelAsSecondArg ? void 0 : initialValueOrLabel;
|
|
676
|
-
const effectiveLabel = isLabelAsSecondArg ? initialValueOrLabel : label || "anonymous_deferred";
|
|
677
|
-
const deferredValue = (0, import_react3.useDeferredValue)(value, actualInitialValue);
|
|
678
|
-
(0, import_react3.useEffect)(() => {
|
|
679
|
-
if (config.debug && value !== deferredValue) console.log(`%c [Basis] Value Deferred: "${effectiveLabel}" `, "color: #e67e22; font-weight: bold;");
|
|
680
|
-
}, [value, deferredValue, effectiveLabel]);
|
|
681
|
-
return deferredValue;
|
|
682
|
-
}
|
|
683
|
-
function createContext2(defaultValue, label) {
|
|
684
|
-
const context = (0, import_react3.createContext)(defaultValue);
|
|
685
|
-
if (label) context._basis_label = label;
|
|
686
|
-
return context;
|
|
687
|
-
}
|
|
688
|
-
var useContext2 = import_react3.useContext;
|
|
689
|
-
var useId2 = (label) => React3.useId();
|
|
690
|
-
var useDebugValue2 = React3.useDebugValue;
|
|
691
|
-
var useImperativeHandle2 = React3.useImperativeHandle;
|
|
692
|
-
var useInsertionEffect2 = React3.useInsertionEffect;
|
|
693
|
-
var useSyncExternalStore = import_react3.useSyncExternalStore;
|
|
694
|
-
function use(usable) {
|
|
695
|
-
return (0, import_react3.use)(usable);
|
|
696
|
-
}
|
|
697
|
-
function useOptimistic2(passthrough, reducer, label) {
|
|
698
|
-
const effectiveLabel = label || "anonymous_optimistic";
|
|
699
|
-
(0, import_react3.useEffect)(() => {
|
|
700
|
-
registerVariable(effectiveLabel);
|
|
701
|
-
return () => unregisterVariable(effectiveLabel);
|
|
702
|
-
}, [effectiveLabel]);
|
|
703
|
-
const [state, reactAddOptimistic] = React3.useOptimistic(passthrough, reducer);
|
|
704
|
-
const addOptimistic = (0, import_react3.useCallback)((payload) => {
|
|
705
|
-
if (recordUpdate(effectiveLabel)) {
|
|
706
|
-
reactAddOptimistic(payload);
|
|
707
|
-
}
|
|
708
|
-
}, [effectiveLabel, reactAddOptimistic]);
|
|
709
|
-
return [state, addOptimistic];
|
|
710
|
-
}
|
|
711
|
-
function useActionState2(action, initialState, permalink, label) {
|
|
712
|
-
const isLabelAsThirdArg = typeof permalink === "string" && label === void 0;
|
|
713
|
-
const actualPermalink = isLabelAsThirdArg ? void 0 : permalink;
|
|
714
|
-
const effectiveLabel = isLabelAsThirdArg ? permalink : label || "anonymous_action_state";
|
|
715
|
-
const [state, reactDispatch, isPending] = React3.useActionState(
|
|
716
|
-
action,
|
|
717
|
-
initialState,
|
|
718
|
-
actualPermalink
|
|
719
|
-
);
|
|
720
|
-
(0, import_react3.useEffect)(() => {
|
|
721
|
-
registerVariable(effectiveLabel);
|
|
722
|
-
return () => unregisterVariable(effectiveLabel);
|
|
723
|
-
}, [effectiveLabel]);
|
|
724
|
-
const basisDispatch = (0, import_react3.useCallback)((payload) => {
|
|
725
|
-
if (recordUpdate(effectiveLabel)) {
|
|
726
|
-
reactDispatch(payload);
|
|
727
|
-
}
|
|
728
|
-
}, [effectiveLabel, reactDispatch]);
|
|
729
|
-
return [state, basisDispatch, isPending];
|
|
730
|
-
}
|
|
731
|
-
var __test__ = { registerVariable, unregisterVariable, recordUpdate, beginEffectTracking, endEffectTracking, history, currentTickBatch };
|
|
692
|
+
var useBasisConfig = () => (0, import_react3.useContext)(BasisContext);
|
|
732
693
|
|
|
733
694
|
// src/vite-plugin.ts
|
|
734
695
|
function basis() {
|
|
735
696
|
return {
|
|
736
697
|
name: "vite-plugin-react-state-basis",
|
|
737
|
-
|
|
738
|
-
|
|
739
|
-
|
|
740
|
-
|
|
741
|
-
const isYalc = importer && importer.includes(".yalc");
|
|
742
|
-
if (isLibraryCore || isYalc) {
|
|
743
|
-
return null;
|
|
698
|
+
config() {
|
|
699
|
+
return {
|
|
700
|
+
optimizeDeps: {
|
|
701
|
+
exclude: ["react-state-basis"]
|
|
744
702
|
}
|
|
745
|
-
|
|
746
|
-
"react": "react-state-basis",
|
|
747
|
-
"react-dom": "react-state-basis",
|
|
748
|
-
"react-dom/client": "react-state-basis/client"
|
|
749
|
-
};
|
|
750
|
-
return this.resolve(mapping[source], importer, { skipSelf: true });
|
|
751
|
-
}
|
|
752
|
-
return null;
|
|
703
|
+
};
|
|
753
704
|
}
|
|
754
705
|
};
|
|
755
706
|
}
|
|
756
|
-
|
|
757
|
-
// src/index.ts
|
|
758
|
-
var Children2 = ReactNamespace.Children;
|
|
759
|
-
var Component2 = ReactNamespace.Component;
|
|
760
|
-
var Fragment2 = ReactNamespace.Fragment;
|
|
761
|
-
var Profiler2 = ReactNamespace.Profiler;
|
|
762
|
-
var PureComponent2 = ReactNamespace.PureComponent;
|
|
763
|
-
var StrictMode2 = ReactNamespace.StrictMode;
|
|
764
|
-
var Suspense2 = ReactNamespace.Suspense;
|
|
765
|
-
var cloneElement2 = ReactNamespace.cloneElement;
|
|
766
|
-
var createElement2 = ReactNamespace.createElement;
|
|
767
|
-
var createRef2 = ReactNamespace.createRef;
|
|
768
|
-
var forwardRef2 = ReactNamespace.forwardRef;
|
|
769
|
-
var isValidElement2 = ReactNamespace.isValidElement;
|
|
770
|
-
var lazy2 = ReactNamespace.lazy;
|
|
771
|
-
var memo2 = ReactNamespace.memo;
|
|
772
|
-
var startTransition2 = ReactNamespace.startTransition;
|
|
773
|
-
var version2 = ReactNamespace.version;
|
|
774
|
-
var RD = ReactDOMNamespace;
|
|
775
|
-
var createPortal = RD.createPortal;
|
|
776
|
-
var flushSync = RD.flushSync;
|
|
777
|
-
var index_default = ReactNamespace;
|
|
778
707
|
// Annotate the CommonJS export names for ESM import in node:
|
|
779
708
|
0 && (module.exports = {
|
|
780
709
|
BasisProvider,
|
|
781
|
-
Children,
|
|
782
|
-
Component,
|
|
783
|
-
Fragment,
|
|
784
|
-
Profiler,
|
|
785
|
-
PureComponent,
|
|
786
|
-
React,
|
|
787
|
-
StrictMode,
|
|
788
|
-
Suspense,
|
|
789
|
-
__testEngine__,
|
|
790
|
-
__test__,
|
|
791
710
|
basis,
|
|
792
|
-
beginEffectTracking,
|
|
793
|
-
cloneElement,
|
|
794
|
-
config,
|
|
795
711
|
configureBasis,
|
|
796
|
-
createContext,
|
|
797
|
-
createElement,
|
|
798
|
-
createPortal,
|
|
799
|
-
createRef,
|
|
800
|
-
currentTickBatch,
|
|
801
|
-
endEffectTracking,
|
|
802
|
-
flushSync,
|
|
803
|
-
forwardRef,
|
|
804
|
-
history,
|
|
805
|
-
isValidElement,
|
|
806
|
-
lazy,
|
|
807
|
-
memo,
|
|
808
712
|
printBasisHealthReport,
|
|
809
|
-
recordUpdate,
|
|
810
|
-
registerVariable,
|
|
811
|
-
startTransition,
|
|
812
|
-
unregisterVariable,
|
|
813
713
|
use,
|
|
814
714
|
useActionState,
|
|
815
715
|
useBasisConfig,
|
|
816
716
|
useCallback,
|
|
817
|
-
useContext,
|
|
818
717
|
useDebugValue,
|
|
819
718
|
useDeferredValue,
|
|
820
719
|
useEffect,
|
|
@@ -828,7 +727,6 @@ var index_default = ReactNamespace;
|
|
|
828
727
|
useRef,
|
|
829
728
|
useState,
|
|
830
729
|
useSyncExternalStore,
|
|
831
|
-
useTransition
|
|
832
|
-
version
|
|
730
|
+
useTransition
|
|
833
731
|
});
|
|
834
732
|
//# sourceMappingURL=index.js.map
|