diff --git a/src/tools/SetOptional.ts b/src/tools/SetOptional.ts deleted file mode 100644 index d202b335..00000000 --- a/src/tools/SetOptional.ts +++ /dev/null @@ -1 +0,0 @@ -export type SetOptional, K extends keyof T> = Omit & Partial>; diff --git a/src/tools/allPropertiesValuesToUndefined.ts b/src/tools/allPropertiesValuesToUndefined.ts deleted file mode 100644 index c141ccd5..00000000 --- a/src/tools/allPropertiesValuesToUndefined.ts +++ /dev/null @@ -1,5 +0,0 @@ -import "minimal-polyfills/Object.fromEntries"; - -export function allPropertiesValuesToUndefined>(obj: T): Record { - return Object.fromEntries(Object.entries(obj).map(([key]) => [key, undefined])) as any; -} diff --git a/src/tools/useCallbackFactory.ts b/src/tools/useCallbackFactory.ts deleted file mode 100644 index 2529a49e..00000000 --- a/src/tools/useCallbackFactory.ts +++ /dev/null @@ -1,45 +0,0 @@ -import { useRef, useState } from "react"; -import { id } from "tsafe/id"; -import { memoize } from "./memoize"; - -export type CallbackFactory = (...factoryArgs: FactoryArgs) => (...args: Args) => R; - -/** - * https://docs.powerhooks.dev/api-reference/usecallbackfactory - * - * const callbackFactory= useCallbackFactory( - * ([key]: [string], [params]: [{ foo: number; }]) => { - * ... - * }, - * [] - * ); - * - * WARNING: Factory args should not be of variable length. - * - */ -export function useCallbackFactory( - callback: (...callbackArgs: [FactoryArgs, Args]) => R -): CallbackFactory { - type Out = CallbackFactory; - - const callbackRef = useRef(callback); - - callbackRef.current = callback; - - const memoizedRef = useRef(undefined); - - return useState(() => - id((...factoryArgs) => { - if (memoizedRef.current === undefined) { - memoizedRef.current = memoize( - (...factoryArgs: FactoryArgs) => - (...args: Args) => - callbackRef.current(factoryArgs, args), - { "argsLength": factoryArgs.length } - ); - } - - return memoizedRef.current(...factoryArgs); - }) - )[0]; -} diff --git a/src/tools/useCssAndCx.ts b/src/tools/useCssAndCx.ts deleted file mode 100644 index c786ecfc..00000000 --- a/src/tools/useCssAndCx.ts +++ /dev/null @@ -1,12 +0,0 @@ -import { clsx as cx } from "./clsx"; - -/** - * @deprecated: Use clsx instead. - * import { clsx } from "keycloakify/lib/tools/clsx"; - * You can use clsx as cx. - * If you where using the css() function you can import - * it from @emotion/css: https://emotion.sh/docs/@emotion/css - */ -export function useCssAndCx() { - return { cx }; -}