Socket
Socket
Sign inDemoInstall

@storm-stack/jotai

Package Overview
Dependencies
Maintainers
2
Versions
61
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@storm-stack/jotai - npm Package Compare versions

Comparing version 1.15.1 to 1.15.2

428

dist/index.d.ts

@@ -1,426 +0,8 @@

import { AsyncStorage } from 'jotai/vanilla/utils/atomWithStorage';
import { AsyncStringStorage } from 'jotai/vanilla/utils/atomWithStorage';
import { Atom } from 'jotai';
import { Atom as Atom_2 } from 'jotai/vanilla';
import { ComponentProps } from 'react';
import type { createStore } from 'jotai/vanilla';
import { Getter } from 'jotai/vanilla';
import { Getter as Getter_2 } from 'jotai';
import { JSX as JSX_2 } from 'react/jsx-runtime';
import { PrimitiveAtom } from 'jotai';
import { PrimitiveAtom as PrimitiveAtom_2 } from 'jotai/vanilla';
import { Provider } from 'jotai';
import { default as React_2 } from 'react';
import { SetStateAction } from 'jotai';
import { SetStateAction as SetStateAction_2 } from 'jotai/vanilla';
import { SetStateAction as SetStateAction_3 } from 'react';
import { Setter } from 'jotai/vanilla';
import { SyncStorage } from 'jotai/vanilla/utils/atomWithStorage';
import { SyncStringStorage } from 'jotai/vanilla/utils/atomWithStorage';
import { useAtomValue } from 'jotai/react';
import type { useHydrateAtoms } from 'jotai/utils';
import { WritableAtom } from 'jotai/vanilla';
import { WritableAtom as WritableAtom_2 } from 'jotai';
import type { Table } from '@tanstack/table-core';
import type { TableOptionsResolved } from '@tanstack/table-core';
/**
* Creates an atom that runs an effect function when mounted and unmounts.
*
* @param effectFn - The effect function to run
* @returns An atom that runs an effect function when mounted and unmounts.
*/
declare function atomEffect(effectFn: (get: Getter, set: Setter) => void | CleanupFn): Atom_2<void>;
export { atomEffect }
export { atomEffect as atomEffect_alias_1 }
export { atomEffect as atomEffect_alias_2 }
declare const createTable: <T>(config: TableOptionsResolved<T>) => Table<T>;
export { createTable }
export { createTable as createTable_alias_1 }
declare type AtomProviderProps = ComponentProps<typeof Provider>;
declare type AtomRecord<O> = {
[K in keyof O]: Atom_2<O[K]>;
};
export { AtomRecord }
export { AtomRecord as AtomRecord_alias_1 }
export { AtomRecord as AtomRecord_alias_2 }
declare type AtomStoreApi<T extends object, E extends AtomRecord<object>, N extends string = ""> = {
name: N;
} & {
[key in keyof Record<NameProvider<N>, object>]: React_2.FC<ProviderProps<T>>;
} & {
[key in keyof Record<NameStore<N>, object>]: StoreApi<T, E, N>;
} & {
[key in keyof Record<UseNameStore<N>, object>]: UseStoreApi<T, E>;
};
export { AtomStoreApi }
export { AtomStoreApi as AtomStoreApi_alias_1 }
export { AtomStoreApi as AtomStoreApi_alias_2 }
/**
* Creates an atom that broadcasts its value to other tabs/windows using the BroadcastChannel API.
*
* @param key - The key to use for the BroadcastChannel
* @param initialValue - The initial value of the atom
* @returns An atom that broadcasts its value to other tabs/windows using the BroadcastChannel API.
*/
declare function atomWithBroadcast<TValue>(key: string, initialValue: TValue): WritableAtom<TValue, [TValue], void>;
export { atomWithBroadcast }
export { atomWithBroadcast as atomWithBroadcast_alias_1 }
export { atomWithBroadcast as atomWithBroadcast_alias_2 }
declare function atomWithCompare<Value>(initialValue: Value, areEqual: (prev: Value, next: Value) => boolean): WritableAtom_2<Value, [Value], void>;
export { atomWithCompare }
export { atomWithCompare as atomWithCompare_alias_1 }
export { atomWithCompare as atomWithCompare_alias_2 }
declare function atomWithDebounce<TValue>(initialValue: TValue, delayMilliseconds?: number, shouldDebounceOnReset?: boolean): {
currentValueAtom: Atom<TValue>;
isDebouncingAtom: PrimitiveAtom<boolean> & {
init: boolean;
};
clearTimeoutAtom: WritableAtom_2<null, [_arg: unknown], void> & {
init: null;
};
debouncedValueAtom: WritableAtom_2<TValue, [update: SetStateAction<TValue>], void> & {
init: TValue;
};
};
export { atomWithDebounce }
export { atomWithDebounce as atomWithDebounce_alias_1 }
export { atomWithDebounce as atomWithDebounce_alias_2 }
/**
* Creates an atom that broadcasts its value to other tabs/windows using the BroadcastChannel API.
*
* @param key - The key to use for the BroadcastChannel
* @param initialValue - The initial value of the atom
* @returns An atom that broadcasts its value to other tabs/windows using the BroadcastChannel API.
*/
declare function atomWithListeners<TValue>(initial: TValue | WritableAtom<TValue, any, any>): readonly [WritableAtom<TValue, [arg: SetStateAction_2<TValue>], void>, (callback: Callback<TValue>) => void];
export { atomWithListeners }
export { atomWithListeners as atomWithListeners_alias_1 }
export { atomWithListeners as atomWithListeners_alias_2 }
/**
* Creates an atom that always returns a pending promise.
*
* @returns An atom that always returns a pending promise.
*/
declare const atomWithPending: <Value>() => PrimitiveAtom_2<Value> & {
init: Value;
};
export { atomWithPending }
export { atomWithPending as atomWithPending_alias_1 }
export { atomWithPending as atomWithPending_alias_2 }
declare function atomWithRefresh<TValue>(fn: (get: Getter_2) => TValue): WritableAtom_2<TValue, [], void>;
export { atomWithRefresh }
export { atomWithRefresh as atomWithRefresh_alias_1 }
export { atomWithRefresh as atomWithRefresh_alias_2 }
declare const atomWithRefreshAndDefault: <TValue extends unknown>(refreshAtom: PrimitiveAtom<number>, getDefault: (get: Getter_2) => TValue) => WritableAtom_2<TValue, [update: TValue], void>;
export { atomWithRefreshAndDefault }
export { atomWithRefreshAndDefault as atomWithRefreshAndDefault_alias_1 }
export { atomWithRefreshAndDefault as atomWithRefreshAndDefault_alias_2 }
declare function atomWithToggle(initialValue?: boolean): WritableAtom_2<boolean, [boolean | undefined], void>;
export { atomWithToggle }
export { atomWithToggle as atomWithToggle_alias_1 }
export { atomWithToggle as atomWithToggle_alias_2 }
/**
* Creates an atom that persists its state in external storage and sends a broadcast message to other tabs/windows when the state changes.
*
* @param key - The key to use for the storage
* @param initialValue - The initial value of the atom
* @param webStorage - The storage to use
* @returns An atom that persists its state in external storage and sends a broadcast message to other tabs/windows when the state changes.
*/
declare function atomWithWebStorage<TValue = unknown>(key: string, initialValue: TValue, webStorage?: SyncStorage<TValue> | AsyncStorage<TValue>): WritableAtom_2<TValue, [SetStateAction_3<TValue>], void>;
export { atomWithWebStorage }
export { atomWithWebStorage as atomWithWebStorage_alias_1 }
export { atomWithWebStorage as atomWithWebStorage_alias_2 }
/**
* Create an atom with a wrapper that allows functions as values.
*
* @remarks
* Jotai atoms don't allow functions as values by default. This function is a
* drop-in replacement for `atom` that wraps functions in an object while
* leaving non-functions unchanged. The wrapper object should be completely
* invisible to consumers of the atom.
*
* @param initialValue - The initial value of the atom
* @returns An atom with a wrapper that allows functions as values.
*/
declare const atomWithWrapper: <TValue>(initialValue: TValue) => WritableAtom<TValue, [TValue], void>;
export { atomWithWrapper }
export { atomWithWrapper as atomWithWrapper_alias_1 }
export { atomWithWrapper as atomWithWrapper_alias_2 }
declare type Callback<Value> = (get: Getter, set: Setter, newVal: Value, prevVal: Value) => void;
export { Callback }
export { Callback as Callback_alias_1 }
export { Callback as Callback_alias_2 }
declare type CleanupFn = () => void;
/**
* Creates a generic provider for a jotai store.
* - `initialValues`: Initial values for the store.
* - `props`: Dynamic values for the store.
*/
declare const createAtomProvider: <T extends object, N extends string = "">(storeScope: N, atoms: SimpleWritableAtomRecord<T>, options?: {
effect?: React_2.FC;
}) => ({ store, scope, children, resetKey, ...props }: ProviderProps<T>) => JSX_2.Element;
export { createAtomProvider }
export { createAtomProvider as createAtomProvider_alias_1 }
export { createAtomProvider as createAtomProvider_alias_2 }
/**
* Create an atom store from an initial value.
*
* @remarks
* Each property will have a getter and setter.
*
* @example
* const { exampleStore, useExampleStore } = createAtomStore({ count: 1, say: 'hello' }, { name: 'example' as const })
* const { exampleStore, useExampleStore } = createAtomStore({ count: 1, say: 'hello' }, { name: 'example' as const })
* const [count, setCount] = useExampleStore().use.count()
* const say = useExampleStore().get.say()
* const setSay = useExampleStore().set.say()
* setSay('world')
* const countAtom = exampleStore.atom.count
*
* @param initialState - The initial state of the store
* @param options - The options for the store
* @returns The store and the store hook
*/
declare const createAtomStore: <T extends object, E extends object, N extends string = "">(initialState: T, { name, delay: delayRoot, effect, extend }: CreateAtomStoreOptions<T, E, N>) => AtomStoreApi<T, E, N>;
export { createAtomStore }
export { createAtomStore as createAtomStore_alias_1 }
export { createAtomStore as createAtomStore_alias_2 }
declare interface CreateAtomStoreOptions<T extends object, E extends AtomRecord<object>, N extends string> {
name: N;
delay?: UseAtomOptions["delay"];
effect?: React_2.FC;
extend?: (atomsWithoutExtend: StoreAtomsWithoutExtend<T>) => E;
}
export { CreateAtomStoreOptions }
export { CreateAtomStoreOptions as CreateAtomStoreOptions_alias_1 }
export { CreateAtomStoreOptions as CreateAtomStoreOptions_alias_2 }
declare function createWebStorage<TValue>(getStringStorage: () => AsyncStringStorage | SyncStringStorage | undefined): AsyncStorage<TValue> | SyncStorage<TValue>;
export { createWebStorage }
export { createWebStorage as createWebStorage_alias_1 }
export { createWebStorage as createWebStorage_alias_2 }
declare type FilterWritableAtoms<T> = {
[K in keyof T]-?: T[K] extends WritableAtom<any, any, any> ? T[K] : never;
};
export { FilterWritableAtoms }
export { FilterWritableAtoms as FilterWritableAtoms_alias_1 }
export { FilterWritableAtoms as FilterWritableAtoms_alias_2 }
declare type GetAtomFn = <V>(atom: Atom_2<V>, options?: UseAtomOptionsOrScope) => V;
export { GetAtomFn }
export { GetAtomFn as GetAtomFn_alias_1 }
export { GetAtomFn as GetAtomFn_alias_2 }
declare type GetRecord<O> = {
[K in keyof O]: O[K] extends Atom_2<infer V> ? (options?: UseAtomOptionsOrScope) => V : never;
};
export { GetRecord }
export { GetRecord as GetRecord_alias_1 }
export { GetRecord as GetRecord_alias_2 }
declare const HydrateAtoms: <T extends object>({ initialValues, children, store, atoms, ...props }: Omit<ProviderProps<T>, "scope"> & {
atoms: SimpleWritableAtomRecord<T>;
}) => JSX_2.Element;
export { HydrateAtoms }
export { HydrateAtoms as HydrateAtoms_alias_1 }
export { HydrateAtoms as HydrateAtoms_alias_2 }
export declare const isAtom: <TValue = any>(value: unknown) => value is Atom<TValue>;
export declare const isWritableAtom: <TValue = any, TArgs extends unknown[] = unknown[], TResult = any>(value: unknown) => value is WritableAtom_2<TValue, TArgs, TResult>;
declare type JotaiStore = ReturnType<typeof createStore>;
export { JotaiStore }
export { JotaiStore as JotaiStore_alias_1 }
export { JotaiStore as JotaiStore_alias_2 }
declare type NameProvider<N extends string = ""> = `${Capitalize<N>}Provider`;
declare type NameStore<N extends string = ""> = N extends "" ? "store" : `${N}Store`;
declare type Options = Parameters<typeof useAtomValue>[1];
declare type ProviderProps<T extends object> = AtomProviderProps & Partial<T> & {
scope?: string;
initialValues?: Partial<T>;
resetKey?: any;
};
export { ProviderProps }
export { ProviderProps as ProviderProps_alias_1 }
export { ProviderProps as ProviderProps_alias_2 }
/**
* Add a debug label to the Jotai Atom
*
* @param atom - The atom to apply the debug label to
* @param label - The label to apply to the atom
*/
declare const setAtomDebugLabel: (atom: Atom_2<unknown>, label: string) => void;
export { setAtomDebugLabel }
export { setAtomDebugLabel as setAtomDebugLabel_alias_1 }
export { setAtomDebugLabel as setAtomDebugLabel_alias_2 }
declare type SetAtomFn = <V, A extends unknown[], R>(atom: WritableAtom<V, A, R>, options?: UseAtomOptionsOrScope) => (...args: A) => R;
export { SetAtomFn }
export { SetAtomFn as SetAtomFn_alias_1 }
export { SetAtomFn as SetAtomFn_alias_2 }
/**
* Mark the atom as a *private* or internal
*
* @param atom - The atom to mark as private
*/
declare const setAtomPrivate: (atom: Atom_2<unknown>) => void;
export { setAtomPrivate }
export { setAtomPrivate as setAtomPrivate_alias_1 }
export { setAtomPrivate as setAtomPrivate_alias_2 }
declare type SetRecord<O> = {
[K in keyof O]: O[K] extends WritableAtom<infer _V, infer A, infer R> ? (options?: UseAtomOptionsOrScope) => (...args: A) => R : never;
};
export { SetRecord }
export { SetRecord as SetRecord_alias_1 }
export { SetRecord as SetRecord_alias_2 }
declare type SimpleWritableAtom<T> = WritableAtom<T, [T], void>;
export { SimpleWritableAtom }
export { SimpleWritableAtom as SimpleWritableAtom_alias_1 }
export { SimpleWritableAtom as SimpleWritableAtom_alias_2 }
declare type SimpleWritableAtomRecord<T> = {
[K in keyof T]: SimpleWritableAtom<T[K]>;
};
export { SimpleWritableAtomRecord }
export { SimpleWritableAtomRecord as SimpleWritableAtomRecord_alias_1 }
export { SimpleWritableAtomRecord as SimpleWritableAtomRecord_alias_2 }
declare type StoreApi<T extends object, E extends AtomRecord<object>, N extends string = ""> = {
atom: StoreAtoms<T, E>;
name: N;
};
export { StoreApi }
export { StoreApi as StoreApi_alias_1 }
export { StoreApi as StoreApi_alias_2 }
declare type StoreAtoms<T, E> = StoreAtomsWithoutExtend<T> & E;
export { StoreAtoms }
export { StoreAtoms as StoreAtoms_alias_1 }
export { StoreAtoms as StoreAtoms_alias_2 }
declare type StoreAtomsWithoutExtend<T> = {
[K in keyof T]: T[K] extends Atom_2<any> ? T[K] : SimpleWritableAtom<T[K]>;
};
export { StoreAtomsWithoutExtend }
export { StoreAtomsWithoutExtend as StoreAtomsWithoutExtend_alias_1 }
export { StoreAtomsWithoutExtend as StoreAtomsWithoutExtend_alias_2 }
declare type UseAtomFn = <V, A extends unknown[], R>(atom: WritableAtom<V, A, R>, options?: UseAtomOptionsOrScope) => [V, (...args: A) => R];
export { UseAtomFn }
export { UseAtomFn as UseAtomFn_alias_1 }
export { UseAtomFn as UseAtomFn_alias_2 }
declare type UseAtomOptions = {
scope?: string;
store?: JotaiStore;
delay?: number;
};
export { UseAtomOptions }
export { UseAtomOptions as UseAtomOptions_alias_1 }
export { UseAtomOptions as UseAtomOptions_alias_2 }
declare type UseAtomOptionsOrScope = UseAtomOptions | string;
export { UseAtomOptionsOrScope }
export { UseAtomOptionsOrScope as UseAtomOptionsOrScope_alias_1 }
export { UseAtomOptionsOrScope as UseAtomOptionsOrScope_alias_2 }
/**
* Tries to find a store in each of the following places, in order:
* 1. The store context, matching the store name and scope
* 2. The store context, matching the store name and 'provider' scope
* 3. Otherwise, return undefined
*/
declare const useAtomStore: (storeName: string, scope?: string, warnIfUndefined?: boolean) => JotaiStore | undefined;
export { useAtomStore }
export { useAtomStore as useAtomStore_alias_1 }
export { useAtomStore as useAtomStore_alias_2 }
declare type UseHydrateAtoms<T> = (initialValues: Partial<Record<keyof T, any>>, options?: Parameters<typeof useHydrateAtoms>[1]) => void;
export { UseHydrateAtoms }
export { UseHydrateAtoms as UseHydrateAtoms_alias_1 }
export { UseHydrateAtoms as UseHydrateAtoms_alias_2 }
/**
* Hydrate atoms with initial values for SSR.
*/
declare const useHydrateStore: (atoms: SimpleWritableAtomRecord<any>, initialValues: Parameters<UseHydrateAtoms<any>>[0], options?: Parameters<UseHydrateAtoms<any>>[1]) => void;
export { useHydrateStore }
export { useHydrateStore as useHydrateStore_alias_1 }
export { useHydrateStore as useHydrateStore_alias_2 }
declare type UseNameStore<N extends string = ""> = `use${Capitalize<N>}Store`;
declare function usePrepareAtoms(atoms: Atom_2<unknown>[], options?: Options): void;
export { usePrepareAtoms }
export { usePrepareAtoms as usePrepareAtoms_alias_1 }
export { usePrepareAtoms as usePrepareAtoms_alias_2 }
declare type UseRecord<O> = {
[K in keyof O]: O[K] extends WritableAtom<infer V, infer A, infer R> ? (options?: UseAtomOptionsOrScope) => [V, (...args: A) => R] : never;
};
export { UseRecord }
export { UseRecord as UseRecord_alias_1 }
export { UseRecord as UseRecord_alias_2 }
declare type UseStoreApi<T, E> = (options?: UseAtomOptionsOrScope) => {
get: GetRecord<StoreAtoms<T, E>> & {
atom: GetAtomFn;
};
set: SetRecord<WritableStoreAtoms<T, E>> & {
atom: SetAtomFn;
};
use: UseRecord<WritableStoreAtoms<T, E>> & {
atom: UseAtomFn;
};
store: (options?: UseAtomOptionsOrScope) => JotaiStore | undefined;
};
export { UseStoreApi }
export { UseStoreApi as UseStoreApi_alias_1 }
export { UseStoreApi as UseStoreApi_alias_2 }
declare type UseSyncAtoms<T> = (values: Partial<Record<keyof T, any>>, options?: {
store?: JotaiStore;
}) => void;
export { UseSyncAtoms }
export { UseSyncAtoms as UseSyncAtoms_alias_1 }
export { UseSyncAtoms as UseSyncAtoms_alias_2 }
/**
* Update atoms with new values on changes.
*/
declare const useSyncStore: (atoms: SimpleWritableAtomRecord<any>, values: any, { store }?: Parameters<UseSyncAtoms<any>>[1]) => void;
export { useSyncStore }
export { useSyncStore as useSyncStore_alias_1 }
export { useSyncStore as useSyncStore_alias_2 }
declare type WritableStoreAtoms<T, E> = FilterWritableAtoms<StoreAtoms<T, E>>;
export { WritableStoreAtoms }
export { WritableStoreAtoms as WritableStoreAtoms_alias_1 }
export { WritableStoreAtoms as WritableStoreAtoms_alias_2 }
export { }

2

package.json
{
"name": "@storm-stack/jotai",
"version": "1.15.1",
"version": "1.15.2",
"private": false,

@@ -5,0 +5,0 @@ "description": "⚡ The storm-stack monorepo contains utility applications, tools, and various libraries to create modern and scalable web applications.",

@@ -19,3 +19,3 @@ <!-- START header -->

[![Version](https://img.shields.io/badge/version-1.15.0-1fb2a6.svg?style=for-the-badge&color=1fb2a6)](https://prettier.io/)&nbsp;
[![Version](https://img.shields.io/badge/version-1.15.2-1fb2a6.svg?style=for-the-badge&color=1fb2a6)](https://prettier.io/)&nbsp;
[![Nx](https://img.shields.io/badge/Nx-17.0.2-lightgrey?style=for-the-badge&logo=nx&logoWidth=20&&color=1fb2a6)](http://nx.dev/)&nbsp;[![NextJs](https://img.shields.io/badge/Next.js-14.0.2-lightgrey?style=for-the-badge&logo=nextdotjs&logoWidth=20&color=1fb2a6)](https://nextjs.org/)&nbsp;[![Commitizen friendly](https://img.shields.io/badge/commitizen-friendly-brightgreen.svg?style=for-the-badge&logo=commitlint&color=1fb2a6)](http://commitizen.github.io/cz-cli/)&nbsp;![Semantic-Release](https://img.shields.io/badge/%20%20%F0%9F%93%A6%F0%9F%9A%80-semantic--release-e10079.svg?style=for-the-badge&color=1fb2a6)&nbsp;[![documented with docusaurus](https://img.shields.io/badge/documented_with-docusaurus-success.svg?style=for-the-badge&logo=readthedocs&color=1fb2a6)](https://docusaurus.io/)&nbsp;![GitHub Workflow Status (with event)](https://img.shields.io/github/actions/workflow/status/storm-software/storm-ops/cr.yml?style=for-the-badge&logo=github-actions&color=1fb2a6)

@@ -22,0 +22,0 @@

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc