@zayne-labs/toolkit-react 0.11.5 → 0.11.7
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.
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import { ContextError, CustomContextOptions, UseCustomContext, createCustomContext, createUseLocationState, createUseStorageState, getErrorMessage, useAfterMountEffect, useAnimateElementRefs, useAnimationInterval, useAsyncEffect, useCallbackRef, useClickOutside, useComposeRefs, useConstant, useCopyToClipboard, useDebouncedFn, useDebouncedState, useDisclosure, useEffectOnce, useIsHydrated, useIsServer, useLazyRef, useLifeCycle, useLocationState, useMountEffect, useScrollObserver, useSearch, useSearchParams, useSearchParamsObject, useShallowCompSelector, useShallowCompValue, useStorageState, useStore, useThrottleByFrame, useThrottleBySetTimeout, useThrottleByTimer, useToggle, useUnmountEffect } from "../index-
|
|
2
|
-
import "../index-
|
|
1
|
+
import { ContextError, CustomContextOptions, UseCustomContext, createCustomContext, createUseLocationState, createUseStorageState, getErrorMessage, useAfterMountEffect, useAnimateElementRefs, useAnimationInterval, useAsyncEffect, useCallbackRef, useClickOutside, useComposeRefs, useConstant, useCopyToClipboard, useDebouncedFn, useDebouncedState, useDisclosure, useEffectOnce, useIsHydrated, useIsServer, useLazyRef, useLifeCycle, useLocationState, useMountEffect, useScrollObserver, useSearch, useSearchParams, useSearchParamsObject, useShallowCompSelector, useShallowCompValue, useStorageState, useStore, useThrottleByFrame, useThrottleBySetTimeout, useThrottleByTimer, useToggle, useUnmountEffect } from "../index-BszCeil2.js";
|
|
2
|
+
import "../index-BDOKnQLQ.js";
|
|
3
3
|
export { ContextError, CustomContextOptions, UseCustomContext, createCustomContext, createUseLocationState, createUseStorageState, getErrorMessage, useAfterMountEffect, useAnimateElementRefs, useAnimationInterval, useAsyncEffect, useCallbackRef, useClickOutside, useComposeRefs, useConstant, useCopyToClipboard, useDebouncedFn, useDebouncedState, useDisclosure, useEffectOnce, useIsHydrated, useIsServer, useLazyRef, useLifeCycle, useLocationState, useMountEffect, useScrollObserver, useSearch, useSearchParams, useSearchParamsObject, useShallowCompSelector, useShallowCompValue, useStorageState, useStore, useThrottleByFrame, useThrottleBySetTimeout, useThrottleByTimer, useToggle, useUnmountEffect };
|
|
@@ -178,8 +178,11 @@ declare const mergeProps: <TProps extends Record<never, never>>(...propsObjectAr
|
|
|
178
178
|
declare const mergeTwoProps: <TProps extends Record<never, never>>(formerProps: TProps | undefined, latterProps: TProps | undefined) => TProps;
|
|
179
179
|
//#endregion
|
|
180
180
|
//#region src/utils/types/common.d.ts
|
|
181
|
-
type
|
|
182
|
-
type
|
|
181
|
+
type ValidElementType = HTMLElement | React.ElementType;
|
|
182
|
+
type ForwardedRefType<TElement extends ValidElementType> = TElement extends React.ElementType ? React.ForwardedRef<React.Ref<TElement>> : React.ForwardedRef<TElement>;
|
|
183
|
+
type InferProps<TElement extends ValidElementType> = TElement extends React.ElementType ? React.ComponentProps<TElement> : React.HTMLAttributes<TElement>;
|
|
184
|
+
type RemoveStringSignature<TObject extends object> = { [Key in keyof TObject as string extends Key ? never : Key]: TObject[Key] };
|
|
185
|
+
type InferPropsStrict<TElement extends ValidElementType> = RemoveStringSignature<InferProps<TElement>>;
|
|
183
186
|
type StateSetter<TSetter = unknown> = React.Dispatch<React.SetStateAction<TSetter>>;
|
|
184
187
|
type CssWithCustomProperties<TExtra extends Record<string, string> = NonNullable<unknown>> = React.CSSProperties & Record<`--${string}`, string> & TExtra;
|
|
185
188
|
type DefaultRenderItemErrorMessages = {
|
|
@@ -217,9 +220,9 @@ type DiscriminatedRenderProps<TRenderPropType, TErrorMessages extends Record<key
|
|
|
217
220
|
type AsProp<TElement extends React.ElementType> = {
|
|
218
221
|
as?: TElement;
|
|
219
222
|
};
|
|
220
|
-
type
|
|
221
|
-
type
|
|
222
|
-
type
|
|
223
|
+
type MergedGivenPropsWithAs<TElement extends React.ElementType, TProps> = Omit<AsProp<TElement>, keyof TProps> & TProps;
|
|
224
|
+
type PolymorphicProps<TElement extends React.ElementType, TProps extends AnyObject = NonNullable<unknown>> = MergedGivenPropsWithAs<TElement, TProps> & Omit<InferProps<TElement>, keyof TProps>;
|
|
225
|
+
type PolymorphicPropsStrict<TElement extends React.ElementType, TProps extends AnyObject = NonNullable<unknown>> = MergedGivenPropsWithAs<TElement, TProps> & Omit<InferPropsStrict<TElement>, keyof TProps>;
|
|
223
226
|
//#endregion
|
|
224
|
-
export { AsProp, CssWithCustomProperties, DefaultRenderErrorMessages, DefaultRenderItemErrorMessages, DiscriminatedRenderItemProps, DiscriminatedRenderProps, ForwardedRefType, FunctionalComponent, GetSlotComponentProps, GetSlotMapResult, InferProps, PolymorphicProps, PossibleRef, StateSetter, composeEventHandlers, composeRefs, composeTwoEventHandlers, createSlotComponent, getMultipleSlots, getRegularChildren, getSingleSlot, getSlotMap, matchesAnySlotComponent, matchesSlotComponent, mergeProps, mergeTwoProps, setRef, slotComponentSymbol, withSlotNameAndSymbol };
|
|
225
|
-
//# sourceMappingURL=index-
|
|
227
|
+
export { AsProp, CssWithCustomProperties, DefaultRenderErrorMessages, DefaultRenderItemErrorMessages, DiscriminatedRenderItemProps, DiscriminatedRenderProps, ForwardedRefType, FunctionalComponent, GetSlotComponentProps, GetSlotMapResult, InferProps, InferPropsStrict, PolymorphicProps, PolymorphicPropsStrict, PossibleRef, StateSetter, composeEventHandlers, composeRefs, composeTwoEventHandlers, createSlotComponent, getMultipleSlots, getRegularChildren, getSingleSlot, getSlotMap, matchesAnySlotComponent, matchesSlotComponent, mergeProps, mergeTwoProps, setRef, slotComponentSymbol, withSlotNameAndSymbol };
|
|
228
|
+
//# sourceMappingURL=index-BDOKnQLQ.d.ts.map
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { PossibleRef } from "./index-
|
|
2
|
-
import * as
|
|
1
|
+
import { PossibleRef } from "./index-BDOKnQLQ.js";
|
|
2
|
+
import * as react0 from "react";
|
|
3
3
|
import { RefCallback, useEffect } from "react";
|
|
4
4
|
import * as _zayne_labs_toolkit_core0 from "@zayne-labs/toolkit-core";
|
|
5
5
|
import { AnimationIntervalOptions, LocationInfo, LocationStoreApi, LocationStoreOptions, ScrollObserverOptions, StorageOptions, StorageStoreApi, StoreApi, URLSearchParamsInit } from "@zayne-labs/toolkit-core";
|
|
@@ -16,7 +16,7 @@ type CustomContextOptions<TContextValue, TStrict extends boolean> = {
|
|
|
16
16
|
strict?: TStrict;
|
|
17
17
|
};
|
|
18
18
|
type UseCustomContext<TContextValue, TStrict extends boolean> = () => TStrict extends true ? TContextValue : TContextValue | null;
|
|
19
|
-
declare const createCustomContext: <TContextValue = null, TStrict extends boolean = true>(options?: CustomContextOptions<TContextValue, TStrict>) => [Provider:
|
|
19
|
+
declare const createCustomContext: <TContextValue = null, TStrict extends boolean = true>(options?: CustomContextOptions<TContextValue, TStrict>) => [Provider: react0.Context<TContextValue>, useCustomContext: UseCustomContext<TContextValue, TStrict>];
|
|
20
20
|
declare class ContextError extends Error {
|
|
21
21
|
name: string;
|
|
22
22
|
}
|
|
@@ -88,11 +88,11 @@ type UseClickOutsideOptions<TElement extends HTMLElement> = {
|
|
|
88
88
|
ref?: Array<React.RefObject<TElement>> | React.RefObject<TElement>;
|
|
89
89
|
};
|
|
90
90
|
declare const useClickOutside: <TElement extends HTMLElement>(options: UseClickOutsideOptions<TElement>) => {
|
|
91
|
-
ref:
|
|
91
|
+
ref: react0.RefObject<TElement | null>;
|
|
92
92
|
};
|
|
93
93
|
//#endregion
|
|
94
94
|
//#region src/hooks/useComposeRefs.d.ts
|
|
95
|
-
declare const useComposeRefs: <TRef extends HTMLElement>(...refs: Array<PossibleRef<TRef>>) =>
|
|
95
|
+
declare const useComposeRefs: <TRef extends HTMLElement>(...refs: Array<PossibleRef<TRef>>) => react0.RefCallback<TRef>;
|
|
96
96
|
//#endregion
|
|
97
97
|
//#region src/hooks/useConstant.d.ts
|
|
98
98
|
declare const useConstant: <TResult>(initCallbackFn: () => TResult) => TResult;
|
|
@@ -114,13 +114,13 @@ declare const useDebouncedFn: <TParams>(callBackFn: CallbackFn<TParams>, delay:
|
|
|
114
114
|
cancelMaxWait(): void;
|
|
115
115
|
};
|
|
116
116
|
declare const useDebouncedState: <TValue>(defaultValue: TValue, delay: number | undefined) => readonly [TValue, {
|
|
117
|
-
(...params:
|
|
118
|
-
(params:
|
|
117
|
+
(...params: react0.SetStateAction<TValue>[]): void;
|
|
118
|
+
(params: react0.SetStateAction<TValue> | react0.SetStateAction<TValue>[], overrideOptions: {
|
|
119
119
|
$delay: number;
|
|
120
120
|
}): void;
|
|
121
121
|
cancel: () => void;
|
|
122
122
|
cancelMaxWait(): void;
|
|
123
|
-
},
|
|
123
|
+
}, react0.Dispatch<react0.SetStateAction<TValue>>];
|
|
124
124
|
//#endregion
|
|
125
125
|
//#region src/hooks/useDisclosure.d.ts
|
|
126
126
|
type DisclosureOptions = {
|
|
@@ -170,7 +170,7 @@ declare const useIsServer: () => boolean;
|
|
|
170
170
|
//#endregion
|
|
171
171
|
//#region src/hooks/useLocationState.d.ts
|
|
172
172
|
type UseLocationResult<TSlice> = [state: TSlice, actions: LocationStoreApi];
|
|
173
|
-
declare const createUseLocationState: (options?: LocationStoreOptions) => Omit<_zayne_labs_toolkit_core0.StoreApi<_zayne_labs_toolkit_core0.URLInfoObject>, "
|
|
173
|
+
declare const createUseLocationState: (options?: LocationStoreOptions) => Omit<_zayne_labs_toolkit_core0.StoreApi<_zayne_labs_toolkit_core0.URLInfoObject>, "resetState" | "setState"> & {
|
|
174
174
|
push: (url: string | _zayne_labs_toolkit_core0.PartialURLInfo, options?: {
|
|
175
175
|
state?: _zayne_labs_toolkit_core0.PartialURLInfo["state"];
|
|
176
176
|
}) => void;
|
|
@@ -190,7 +190,7 @@ declare const useSearch: <TData>(initialData: TData[], delay?: number) => {
|
|
|
190
190
|
data: TData[];
|
|
191
191
|
isLoading: boolean;
|
|
192
192
|
query: string;
|
|
193
|
-
setQuery:
|
|
193
|
+
setQuery: react0.Dispatch<react0.SetStateAction<string>>;
|
|
194
194
|
};
|
|
195
195
|
//#endregion
|
|
196
196
|
//#region src/hooks/useSearchParams.d.ts
|
|
@@ -243,4 +243,4 @@ type InitialState = boolean | (() => boolean);
|
|
|
243
243
|
declare const useToggle: (initialValue?: InitialState) => readonly [boolean, <TValue>(newValue?: TValue) => void];
|
|
244
244
|
//#endregion
|
|
245
245
|
export { ContextError, CustomContextOptions, UseCustomContext, createCustomContext, createUseLocationState, createUseStorageState, getErrorMessage, useAfterMountEffect, useAnimateElementRefs, useAnimationInterval, useAsyncEffect, useCallbackRef, useClickOutside, useComposeRefs, useConstant, useCopyToClipboard, useDebouncedFn, useDebouncedState, useDisclosure, useEffectOnce, useIsHydrated, useIsServer, useLazyRef, useLifeCycle, useLocationState, useMountEffect, useScrollObserver, useSearch, useSearchParams, useSearchParamsObject, useShallowCompSelector, useShallowCompValue, useStorageState, useStore, useThrottleByFrame, useThrottleBySetTimeout, useThrottleByTimer, useToggle, useUnmountEffect };
|
|
246
|
-
//# sourceMappingURL=index-
|
|
246
|
+
//# sourceMappingURL=index-BszCeil2.d.ts.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { AsProp, CssWithCustomProperties, DefaultRenderErrorMessages, DefaultRenderItemErrorMessages, DiscriminatedRenderItemProps, DiscriminatedRenderProps, ForwardedRefType, FunctionalComponent, GetSlotComponentProps, GetSlotMapResult, InferProps, PolymorphicProps, PossibleRef, StateSetter, composeEventHandlers, composeRefs, composeTwoEventHandlers, createSlotComponent, getMultipleSlots, getRegularChildren, getSingleSlot, getSlotMap, matchesAnySlotComponent, matchesSlotComponent, mergeProps, mergeTwoProps, setRef, slotComponentSymbol, withSlotNameAndSymbol } from "../index-
|
|
2
|
-
export { AsProp, CssWithCustomProperties, DefaultRenderErrorMessages, DefaultRenderItemErrorMessages, DiscriminatedRenderItemProps, DiscriminatedRenderProps, ForwardedRefType, FunctionalComponent, GetSlotComponentProps, GetSlotMapResult, InferProps, PolymorphicProps, PossibleRef, StateSetter, composeEventHandlers, composeRefs, composeTwoEventHandlers, createSlotComponent, getMultipleSlots, getRegularChildren, getSingleSlot, getSlotMap, matchesAnySlotComponent, matchesSlotComponent, mergeProps, mergeTwoProps, setRef, slotComponentSymbol, withSlotNameAndSymbol };
|
|
1
|
+
import { AsProp, CssWithCustomProperties, DefaultRenderErrorMessages, DefaultRenderItemErrorMessages, DiscriminatedRenderItemProps, DiscriminatedRenderProps, ForwardedRefType, FunctionalComponent, GetSlotComponentProps, GetSlotMapResult, InferProps, InferPropsStrict, PolymorphicProps, PolymorphicPropsStrict, PossibleRef, StateSetter, composeEventHandlers, composeRefs, composeTwoEventHandlers, createSlotComponent, getMultipleSlots, getRegularChildren, getSingleSlot, getSlotMap, matchesAnySlotComponent, matchesSlotComponent, mergeProps, mergeTwoProps, setRef, slotComponentSymbol, withSlotNameAndSymbol } from "../index-BDOKnQLQ.js";
|
|
2
|
+
export { AsProp, CssWithCustomProperties, DefaultRenderErrorMessages, DefaultRenderItemErrorMessages, DiscriminatedRenderItemProps, DiscriminatedRenderProps, ForwardedRefType, FunctionalComponent, GetSlotComponentProps, GetSlotMapResult, InferProps, InferPropsStrict, PolymorphicProps, PolymorphicPropsStrict, PossibleRef, StateSetter, composeEventHandlers, composeRefs, composeTwoEventHandlers, createSlotComponent, getMultipleSlots, getRegularChildren, getSingleSlot, getSlotMap, matchesAnySlotComponent, matchesSlotComponent, mergeProps, mergeTwoProps, setRef, slotComponentSymbol, withSlotNameAndSymbol };
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { CustomContextOptions } from "../index-
|
|
2
|
-
import "../index-
|
|
3
|
-
import * as
|
|
1
|
+
import { CustomContextOptions } from "../index-BszCeil2.js";
|
|
2
|
+
import "../index-BDOKnQLQ.js";
|
|
3
|
+
import * as react9 from "react";
|
|
4
4
|
import { StoreApi } from "@zayne-labs/toolkit-core";
|
|
5
5
|
import { AnyObject, Prettify, SelectorFn } from "@zayne-labs/toolkit-type-helpers";
|
|
6
6
|
import * as zustand0 from "zustand";
|
|
@@ -10,7 +10,7 @@ import { Mutate, StateCreator as StateCreator$1, StoreMutatorIdentifier, UseBoun
|
|
|
10
10
|
declare const createZustandContext: <TState extends Record<string, unknown>, TStore extends StoreApi<TState> = StoreApi<TState>>(options?: CustomContextOptions<TStore, true>) => [ZustandStoreContextProvider: (props: {
|
|
11
11
|
children: React.ReactNode;
|
|
12
12
|
store: TStore;
|
|
13
|
-
}) =>
|
|
13
|
+
}) => react9.FunctionComponentElement<react9.ProviderProps<TStore>>, useZustandStoreContext: <TResult = TState>(selector?: SelectorFn<TState, TResult>) => TResult];
|
|
14
14
|
//#endregion
|
|
15
15
|
//#region src/zustand/createZustandStoreWithCombine.d.ts
|
|
16
16
|
type Write<TInitialState, TExtraState> = Prettify<Omit<TInitialState, keyof TExtraState> & TExtraState>;
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@zayne-labs/toolkit-react",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "0.11.
|
|
4
|
+
"version": "0.11.7",
|
|
5
5
|
"description": "A collection of utility functions, types and composables used by my other projects. Nothing too fancy but can be useful.",
|
|
6
6
|
"author": "Ryan Zayne",
|
|
7
7
|
"license": "MIT",
|
|
@@ -47,8 +47,8 @@
|
|
|
47
47
|
}
|
|
48
48
|
},
|
|
49
49
|
"dependencies": {
|
|
50
|
-
"@zayne-labs/toolkit-core": "0.11.
|
|
51
|
-
"@zayne-labs/toolkit-type-helpers": "0.11.
|
|
50
|
+
"@zayne-labs/toolkit-core": "0.11.7",
|
|
51
|
+
"@zayne-labs/toolkit-type-helpers": "0.11.7"
|
|
52
52
|
},
|
|
53
53
|
"devDependencies": {
|
|
54
54
|
"@arethetypeswrong/cli": "^0.18.2",
|