react-state-basis 0.2.1 → 0.2.3

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/index.d.mts CHANGED
@@ -1,6 +1,8 @@
1
- import * as React$1 from 'react';
2
- import React__default, { Dispatch, SetStateAction, Reducer, DependencyList, EffectCallback, Context, ReactNode } from 'react';
3
- export { CSSProperties, Context, DependencyList, Dispatch, EffectCallback, FC, PropsWithChildren, ReactElement, ReactNode, Reducer, SetStateAction } from 'react';
1
+ import * as React from 'react';
2
+ import React__default, { ReactNode } from 'react';
3
+ export { React };
4
+ export { React as default };
5
+ export { AnchorHTMLAttributes, Attributes, ButtonHTMLAttributes, CSSProperties, ChangeEvent, ComponentProps, ComponentPropsWithRef, ComponentPropsWithoutRef, ComponentType, DependencyList, DetailedHTMLProps, Dispatch, DragEvent, EffectCallback, ElementType, FC, FocusEvent, FormEvent, HTMLAttributes, HTMLProps, InputHTMLAttributes, JSX, Key, KeyboardEvent, MouseEvent, MutableRefObject, PointerEvent, PropsWithChildren, ReactElement, ReactNode, ReactPortal, Reducer, Ref, RefObject, SVGProps, SetStateAction, TouchEvent } from 'react';
4
6
 
5
7
  interface BasisConfig {
6
8
  debug: boolean;
@@ -27,22 +29,38 @@ declare const __testEngine__: {
27
29
  endEffectTracking: () => void;
28
30
  };
29
31
 
30
- declare function useState<T>(initialValue: T, label?: string): [T, Dispatch<SetStateAction<T>>];
31
- declare function useReducer<S, A, I>(reducer: Reducer<S, A>, initialArg: I & S, init?: any, label?: string): [S, Dispatch<A>];
32
- declare function useMemo<T>(factory: () => T, depsOrLabel?: DependencyList | string, label?: string): T;
33
- declare function useCallback<T extends (...args: any[]) => any>(callback: T, depsOrLabel?: DependencyList | string, label?: string): T;
34
- declare function useEffect(effect: EffectCallback, depsOrLabel?: DependencyList | string, label?: string): void;
35
- declare function useLayoutEffect(effect: EffectCallback, depsOrLabel?: DependencyList | string, label?: string): void;
36
- declare function useInsertionEffect(effect: EffectCallback, deps?: DependencyList, _label?: string): void;
32
+ interface BasisProviderProps {
33
+ children: ReactNode;
34
+ debug?: boolean;
35
+ }
36
+ declare const BasisProvider: React__default.FC<BasisProviderProps>;
37
+ declare const useBasisConfig: () => {
38
+ debug: boolean;
39
+ };
40
+
41
+ type GetReducerState<R extends React.Reducer<any, any>> = R extends React.Reducer<infer S, any> ? S : never;
42
+ type GetReducerAction<R extends React.Reducer<any, any>> = R extends React.Reducer<any, infer A> ? A : never;
43
+ declare function useState<S>(initialState: S | (() => S), label?: string): [S, React.Dispatch<React.SetStateAction<S>>];
44
+ declare function useRef<T>(initialValue: T): React.RefObject<T>;
45
+ declare function useRef<T>(initialValue: T | null): React.RefObject<T>;
46
+ declare function useRef<T = undefined>(): React.MutableRefObject<T | undefined>;
47
+ declare function useReducer<R extends React.Reducer<any, any>, I>(reducer: R, initialArg: I, init?: any, label?: string): [GetReducerState<R>, React.Dispatch<GetReducerAction<R>>];
48
+ declare function useMemo<T>(factory: () => T, deps: React.DependencyList | undefined, label?: string): T;
49
+ declare function useCallback<T extends (...args: any[]) => any>(callback: T, deps: React.DependencyList, label?: string): T;
50
+ declare function useEffect(effect: React.EffectCallback, deps?: React.DependencyList, label?: string): void;
51
+ declare function useLayoutEffect(effect: React.EffectCallback, deps?: React.DependencyList, label?: string): void;
37
52
  declare function useTransition(_label?: string): [boolean, (callback: () => void) => void];
38
53
  declare function useDeferredValue<T>(value: T, initialValueOrLabel?: T | string, label?: string): T;
39
- declare function useRef<T>(initialValue: T, _label?: string): React$1.RefObject<T>;
40
- declare function createContext<T>(defaultValue: T, label?: string): Context<T>;
41
- declare function useContext<T>(context: Context<T>): T;
42
- declare function useId(_label?: string): string;
43
- declare function useDebugValue<T>(value: T, formatter?: (value: T) => any, _label?: string): void;
44
- declare function useImperativeHandle<T, R extends T>(ref: React.Ref<T> | undefined, init: () => R, deps?: DependencyList, _label?: string): void;
45
- declare function useSyncExternalStore<Snapshot>(subscribe: (onStoreChange: () => void) => () => void, getSnapshot: () => Snapshot, getServerSnapshot?: () => Snapshot, _label?: string): Snapshot;
54
+ declare function createContext<T>(defaultValue: T, label?: string): React.Context<T>;
55
+ declare const useContext: typeof React.useContext;
56
+ declare const useId: (label?: string) => string;
57
+ declare const useDebugValue: typeof React.useDebugValue;
58
+ declare const useImperativeHandle: typeof React.useImperativeHandle;
59
+ declare const useInsertionEffect: typeof React.useInsertionEffect;
60
+ declare const useSyncExternalStore: any;
61
+ declare function use<T>(usable: React.Usable<T>): T;
62
+ declare function useOptimistic<S, P>(passthrough: S, reducer?: (state: S, payload: P) => S, label?: string): [S, (payload: P) => void];
63
+ declare function useActionState<State, Payload>(action: (state: State, payload: Payload) => Promise<State> | State, initialState: State, permalink?: string, label?: string): [state: State, dispatch: (payload: Payload) => void, isPending: boolean];
46
64
  declare const __test__: {
47
65
  registerVariable: (label: string) => void;
48
66
  unregisterVariable: (label: string) => void;
@@ -53,13 +71,30 @@ declare const __test__: {
53
71
  currentTickBatch: any;
54
72
  };
55
73
 
56
- interface BasisProviderProps {
57
- children: ReactNode;
58
- debug?: boolean;
59
- }
60
- declare const BasisProvider: React__default.FC<BasisProviderProps>;
61
- declare const useBasisConfig: () => {
62
- debug: boolean;
74
+ declare const Children: {
75
+ map<T, C>(children: C | readonly C[], fn: (child: C, index: number) => T): C extends null | undefined ? C : Array<Exclude<T, boolean | null | undefined>>;
76
+ forEach<C>(children: C | readonly C[], fn: (child: C, index: number) => void): void;
77
+ count(children: any): number;
78
+ only<C>(children: C): C extends any[] ? never : C;
79
+ toArray(children: React.ReactNode | React.ReactNode[]): Array<Exclude<React.ReactNode, boolean | null | undefined>>;
63
80
  };
81
+ declare const Component: typeof React.Component;
82
+ declare const Fragment: React.ExoticComponent<React.FragmentProps>;
83
+ declare const Profiler: React.ExoticComponent<React.ProfilerProps>;
84
+ declare const PureComponent: typeof React.PureComponent;
85
+ declare const StrictMode: React.ExoticComponent<{
86
+ children?: React.ReactNode | undefined;
87
+ }>;
88
+ declare const Suspense: React.ExoticComponent<React.SuspenseProps>;
89
+ declare const cloneElement: typeof React.cloneElement;
90
+ declare const createRef: typeof React.createRef;
91
+ declare const forwardRef: typeof React.forwardRef;
92
+ declare const isValidElement: typeof React.isValidElement;
93
+ declare const lazy: typeof React.lazy;
94
+ declare const memo: typeof React.memo;
95
+ declare const startTransition: typeof React.startTransition;
96
+ declare const version: string;
97
+ declare const createPortal: any;
98
+ declare const flushSync: any;
64
99
 
65
- export { type BasisConfig, BasisProvider, __testEngine__, __test__, beginEffectTracking, config, configureBasis, createContext, currentTickBatch, endEffectTracking, history, printBasisHealthReport, recordUpdate, registerVariable, unregisterVariable, useBasisConfig, useCallback, useContext, useDebugValue, useDeferredValue, useEffect, useId, useImperativeHandle, useInsertionEffect, useLayoutEffect, useMemo, useReducer, useRef, useState, useSyncExternalStore, useTransition };
100
+ export { BasisProvider, Children, Component, Fragment, Profiler, PureComponent, StrictMode, Suspense, __testEngine__, __test__, beginEffectTracking, cloneElement, config, configureBasis, createContext, createPortal, createRef, currentTickBatch, endEffectTracking, flushSync, forwardRef, history, isValidElement, lazy, memo, printBasisHealthReport, recordUpdate, registerVariable, startTransition, unregisterVariable, use, useActionState, useBasisConfig, useCallback, useContext, useDebugValue, useDeferredValue, useEffect, useId, useImperativeHandle, useInsertionEffect, useLayoutEffect, useMemo, useOptimistic, useReducer, useRef, useState, useSyncExternalStore, useTransition, version };
package/dist/index.d.ts CHANGED
@@ -1,6 +1,8 @@
1
- import * as React$1 from 'react';
2
- import React__default, { Dispatch, SetStateAction, Reducer, DependencyList, EffectCallback, Context, ReactNode } from 'react';
3
- export { CSSProperties, Context, DependencyList, Dispatch, EffectCallback, FC, PropsWithChildren, ReactElement, ReactNode, Reducer, SetStateAction } from 'react';
1
+ import * as React from 'react';
2
+ import React__default, { ReactNode } from 'react';
3
+ export { React };
4
+ export { React as default };
5
+ export { AnchorHTMLAttributes, Attributes, ButtonHTMLAttributes, CSSProperties, ChangeEvent, ComponentProps, ComponentPropsWithRef, ComponentPropsWithoutRef, ComponentType, DependencyList, DetailedHTMLProps, Dispatch, DragEvent, EffectCallback, ElementType, FC, FocusEvent, FormEvent, HTMLAttributes, HTMLProps, InputHTMLAttributes, JSX, Key, KeyboardEvent, MouseEvent, MutableRefObject, PointerEvent, PropsWithChildren, ReactElement, ReactNode, ReactPortal, Reducer, Ref, RefObject, SVGProps, SetStateAction, TouchEvent } from 'react';
4
6
 
5
7
  interface BasisConfig {
6
8
  debug: boolean;
@@ -27,22 +29,38 @@ declare const __testEngine__: {
27
29
  endEffectTracking: () => void;
28
30
  };
29
31
 
30
- declare function useState<T>(initialValue: T, label?: string): [T, Dispatch<SetStateAction<T>>];
31
- declare function useReducer<S, A, I>(reducer: Reducer<S, A>, initialArg: I & S, init?: any, label?: string): [S, Dispatch<A>];
32
- declare function useMemo<T>(factory: () => T, depsOrLabel?: DependencyList | string, label?: string): T;
33
- declare function useCallback<T extends (...args: any[]) => any>(callback: T, depsOrLabel?: DependencyList | string, label?: string): T;
34
- declare function useEffect(effect: EffectCallback, depsOrLabel?: DependencyList | string, label?: string): void;
35
- declare function useLayoutEffect(effect: EffectCallback, depsOrLabel?: DependencyList | string, label?: string): void;
36
- declare function useInsertionEffect(effect: EffectCallback, deps?: DependencyList, _label?: string): void;
32
+ interface BasisProviderProps {
33
+ children: ReactNode;
34
+ debug?: boolean;
35
+ }
36
+ declare const BasisProvider: React__default.FC<BasisProviderProps>;
37
+ declare const useBasisConfig: () => {
38
+ debug: boolean;
39
+ };
40
+
41
+ type GetReducerState<R extends React.Reducer<any, any>> = R extends React.Reducer<infer S, any> ? S : never;
42
+ type GetReducerAction<R extends React.Reducer<any, any>> = R extends React.Reducer<any, infer A> ? A : never;
43
+ declare function useState<S>(initialState: S | (() => S), label?: string): [S, React.Dispatch<React.SetStateAction<S>>];
44
+ declare function useRef<T>(initialValue: T): React.RefObject<T>;
45
+ declare function useRef<T>(initialValue: T | null): React.RefObject<T>;
46
+ declare function useRef<T = undefined>(): React.MutableRefObject<T | undefined>;
47
+ declare function useReducer<R extends React.Reducer<any, any>, I>(reducer: R, initialArg: I, init?: any, label?: string): [GetReducerState<R>, React.Dispatch<GetReducerAction<R>>];
48
+ declare function useMemo<T>(factory: () => T, deps: React.DependencyList | undefined, label?: string): T;
49
+ declare function useCallback<T extends (...args: any[]) => any>(callback: T, deps: React.DependencyList, label?: string): T;
50
+ declare function useEffect(effect: React.EffectCallback, deps?: React.DependencyList, label?: string): void;
51
+ declare function useLayoutEffect(effect: React.EffectCallback, deps?: React.DependencyList, label?: string): void;
37
52
  declare function useTransition(_label?: string): [boolean, (callback: () => void) => void];
38
53
  declare function useDeferredValue<T>(value: T, initialValueOrLabel?: T | string, label?: string): T;
39
- declare function useRef<T>(initialValue: T, _label?: string): React$1.RefObject<T>;
40
- declare function createContext<T>(defaultValue: T, label?: string): Context<T>;
41
- declare function useContext<T>(context: Context<T>): T;
42
- declare function useId(_label?: string): string;
43
- declare function useDebugValue<T>(value: T, formatter?: (value: T) => any, _label?: string): void;
44
- declare function useImperativeHandle<T, R extends T>(ref: React.Ref<T> | undefined, init: () => R, deps?: DependencyList, _label?: string): void;
45
- declare function useSyncExternalStore<Snapshot>(subscribe: (onStoreChange: () => void) => () => void, getSnapshot: () => Snapshot, getServerSnapshot?: () => Snapshot, _label?: string): Snapshot;
54
+ declare function createContext<T>(defaultValue: T, label?: string): React.Context<T>;
55
+ declare const useContext: typeof React.useContext;
56
+ declare const useId: (label?: string) => string;
57
+ declare const useDebugValue: typeof React.useDebugValue;
58
+ declare const useImperativeHandle: typeof React.useImperativeHandle;
59
+ declare const useInsertionEffect: typeof React.useInsertionEffect;
60
+ declare const useSyncExternalStore: any;
61
+ declare function use<T>(usable: React.Usable<T>): T;
62
+ declare function useOptimistic<S, P>(passthrough: S, reducer?: (state: S, payload: P) => S, label?: string): [S, (payload: P) => void];
63
+ declare function useActionState<State, Payload>(action: (state: State, payload: Payload) => Promise<State> | State, initialState: State, permalink?: string, label?: string): [state: State, dispatch: (payload: Payload) => void, isPending: boolean];
46
64
  declare const __test__: {
47
65
  registerVariable: (label: string) => void;
48
66
  unregisterVariable: (label: string) => void;
@@ -53,13 +71,30 @@ declare const __test__: {
53
71
  currentTickBatch: any;
54
72
  };
55
73
 
56
- interface BasisProviderProps {
57
- children: ReactNode;
58
- debug?: boolean;
59
- }
60
- declare const BasisProvider: React__default.FC<BasisProviderProps>;
61
- declare const useBasisConfig: () => {
62
- debug: boolean;
74
+ declare const Children: {
75
+ map<T, C>(children: C | readonly C[], fn: (child: C, index: number) => T): C extends null | undefined ? C : Array<Exclude<T, boolean | null | undefined>>;
76
+ forEach<C>(children: C | readonly C[], fn: (child: C, index: number) => void): void;
77
+ count(children: any): number;
78
+ only<C>(children: C): C extends any[] ? never : C;
79
+ toArray(children: React.ReactNode | React.ReactNode[]): Array<Exclude<React.ReactNode, boolean | null | undefined>>;
63
80
  };
81
+ declare const Component: typeof React.Component;
82
+ declare const Fragment: React.ExoticComponent<React.FragmentProps>;
83
+ declare const Profiler: React.ExoticComponent<React.ProfilerProps>;
84
+ declare const PureComponent: typeof React.PureComponent;
85
+ declare const StrictMode: React.ExoticComponent<{
86
+ children?: React.ReactNode | undefined;
87
+ }>;
88
+ declare const Suspense: React.ExoticComponent<React.SuspenseProps>;
89
+ declare const cloneElement: typeof React.cloneElement;
90
+ declare const createRef: typeof React.createRef;
91
+ declare const forwardRef: typeof React.forwardRef;
92
+ declare const isValidElement: typeof React.isValidElement;
93
+ declare const lazy: typeof React.lazy;
94
+ declare const memo: typeof React.memo;
95
+ declare const startTransition: typeof React.startTransition;
96
+ declare const version: string;
97
+ declare const createPortal: any;
98
+ declare const flushSync: any;
64
99
 
65
- export { type BasisConfig, BasisProvider, __testEngine__, __test__, beginEffectTracking, config, configureBasis, createContext, currentTickBatch, endEffectTracking, history, printBasisHealthReport, recordUpdate, registerVariable, unregisterVariable, useBasisConfig, useCallback, useContext, useDebugValue, useDeferredValue, useEffect, useId, useImperativeHandle, useInsertionEffect, useLayoutEffect, useMemo, useReducer, useRef, useState, useSyncExternalStore, useTransition };
100
+ export { BasisProvider, Children, Component, Fragment, Profiler, PureComponent, StrictMode, Suspense, __testEngine__, __test__, beginEffectTracking, cloneElement, config, configureBasis, createContext, createPortal, createRef, currentTickBatch, endEffectTracking, flushSync, forwardRef, history, isValidElement, lazy, memo, printBasisHealthReport, recordUpdate, registerVariable, startTransition, unregisterVariable, use, useActionState, useBasisConfig, useCallback, useContext, useDebugValue, useDeferredValue, useEffect, useId, useImperativeHandle, useInsertionEffect, useLayoutEffect, useMemo, useOptimistic, useReducer, useRef, useState, useSyncExternalStore, useTransition, version };