mirror of
https://github.com/Stability-AI/StableStudio.git
synced 2026-05-24 10:45:44 +08:00
24 lines
611 B
TypeScript
24 lines
611 B
TypeScript
import {
|
|
StoreApi,
|
|
UseBoundStore,
|
|
create as zustandDefault,
|
|
useStore as zustandUseStore,
|
|
} from "zustand";
|
|
|
|
import { shallow as zustandShallow } from "zustand/shallow";
|
|
|
|
export type GlobalState<A> = UseBoundStore<StoreApi<A>>;
|
|
export namespace GlobalState {
|
|
export type Store<State> = StoreApi<State>;
|
|
export type Selector<State, Selection> = (
|
|
state: ExtractState<State>
|
|
) => Selection;
|
|
|
|
type ExtractState<S> = S extends { getState: () => infer T } ? T : never;
|
|
|
|
export const create = zustandDefault;
|
|
export const shallow = zustandShallow;
|
|
|
|
export const useStore = zustandUseStore;
|
|
}
|