@elliemae/ds-zustand-helpers 3.33.1 → 3.34.0-next.2
Sign up to get free protection for your applications and to get access to all the features.
- package/dist/cjs/types.js.map +1 -1
- package/dist/types/types.d.ts +1 -1
- package/package.json +3 -3
package/dist/cjs/types.js.map
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
{
|
2
2
|
"version": 3,
|
3
3
|
"sources": ["../../src/types.ts", "../../../../../scripts/build/transpile/react-shim.js"],
|
4
|
-
"sourcesContent": ["/* eslint-disable no-use-before-define */\nimport type React from 'react';\nimport type { Draft } from 'immer';\nimport type { StoreApi, UseBoundStore } from 'zustand';\nimport type createContext from 'zustand/context';\n\n// U is a generic assigned to the user props for clarity\n// P is a generic assigned to the internal props for clarity\n// A is a generic assigned to the atoms for clarity\n// C is a generic assigned to the auto-calculated values for clarity\n// S is a generic assigned to selectors for clarity\n// R is a generic assigned to reducers for clarity\n\nexport namespace ZustandT {\n type Write<T, U> = Omit<T, keyof U> & U;\n\n type ImmerSetter<T extends object> = {\n setState: (\n nextStateOrUpdater: T | Partial<T> | ((state: Draft<T>) => void),\n shouldReplace?: boolean | undefined,\n ) => void;\n };\n\n type StoreSubscribeWithSelector<T> = {\n subscribe: {\n (listener: (selectedState: T, previousSelectedState: T) => void): () => void;\n <U>(\n selector: (state: T) => U,\n listener: (selectedState: U, previousSelectedState: U) => void,\n options?: {\n equalityFn?: (a: U, b: U) => boolean;\n fireImmediately?: boolean;\n },\n ): () => void;\n };\n };\n\n // We add the immer setter method type\n type StoreWithImmer<T extends object> = Write<StoreApi<T>, ImmerSetter<T>>;\n\n // We add the subscribe with selector method type\n type StoreWithImmerAndSubscriber<T extends object> = Write<StoreWithImmer<T>, StoreSubscribeWithSelector<T>>;\n\n export type ZustandStore<T extends object> = UseBoundStore<StoreWithImmerAndSubscriber<T>>;\n\n export type Getter<T extends object> = StoreWithImmerAndSubscriber<T>['getState'];\n export type Setter<T extends object> = StoreWithImmerAndSubscriber<T>['setState'];\n\n export type InternalStore<A extends object, S extends object, R extends object> = A &\n AtomGetters<A> &\n AtomSetters<A, S, R> &\n S &\n R & {\n get: Getter<InternalStore<A, S, R>>;\n set: Setter<InternalStore<A, S, R>>;\n zustandRefs: Record<string, HTMLElement | null>;\n getZustandRef: (key: string[]) => HTMLElement | null;\n setZustandRef: (key: string[], value: HTMLElement | null) => void;\n apiRef: React.MutableRefObject<ZustandStore<InternalStore<A, S, R>>>;\n };\n\n export type PropsStore<T> = T & {\n get: Getter<PropsStore<T>>;\n set: Setter<PropsStore<T>>;\n };\n\n export type AtomGetters<A extends object> = {\n [key in keyof A as `get${Capitalize<string & key>}`]: () => A[key];\n };\n\n export type AtomSetters<A extends object, S extends object, R extends object> = {\n [key in keyof A as `set${Capitalize<string & key>}`]: (\n newVal: A[key] | ((arg: A[key], store: InternalStore<A, S, R>) => A[key]),\n ) => void;\n };\n\n export type SelectorObject<T extends object, S extends object> = (get: Getter<T>) => S;\n export type ReducerObject<T extends object, R extends object> = (get: Getter<T>, set: Setter<T>) => R;\n export type Subscribers<T extends object> = (api: StoreWithImmerAndSubscriber<T>) => void;\n\n export type InternalParameters<A extends object, S extends object, R extends object> = {\n internalAtomDefaultValues: A;\n selectors: SelectorObject<InternalStore<A, S, R>, S>;\n reducers: ReducerObject<InternalStore<A, S, R>, R>;\n subscribers: Subscribers<InternalStore<A, S, R>>;\n };\n\n export type Config<P extends object, A extends object, C extends object, S extends object, R extends object> = {\n defaultProps: P;\n internalAtomDefaultValues: A;\n useAutoCalculated: (props: P) => C;\n selectors?: SelectorObject<InternalStore<A, S, R>, S>;\n reducers?: ReducerObject<InternalStore<A, S, R>, R>;\n subscribers?: Subscribers<InternalStore<A, S, R>>;\n PropsProvider: ReturnType<typeof createContext<ZustandStore<PropsStore<P & C>>>>['Provider'];\n InternalProvider: ReturnType<typeof createContext<ZustandStore<InternalStore<A, S, R>>>>['Provider'];\n usePropsStore: ReturnType<typeof createContext<ZustandStore<PropsStore<P & C>>>>['useStore'];\n };\n\n export type AutoUpdaterComponentT = <\n P extends object,\n A extends object,\n C extends object,\n S extends object,\n R extends object,\n >(\n props: Pick<Config<P, A, C, S, R>, 'usePropsStore'> & { autoCalculatedData: C } & {\n propsWithDefault: P;\n } & { Component: React.ComponentType<Record<string, never>> },\n ) => JSX.Element;\n}\n", "import * as React from 'react';\nexport { React };\n"],
|
4
|
+
"sourcesContent": ["/* eslint-disable no-use-before-define */\nimport type React from 'react';\nimport type { Draft } from 'immer';\nimport type { StoreApi, UseBoundStore } from 'zustand';\nimport type createContext from 'zustand/context';\n\n// U is a generic assigned to the user props for clarity\n// P is a generic assigned to the internal props for clarity\n// A is a generic assigned to the atoms for clarity\n// C is a generic assigned to the auto-calculated values for clarity\n// S is a generic assigned to selectors for clarity\n// R is a generic assigned to reducers for clarity\n\nexport namespace ZustandT {\n type Write<T, U> = Omit<T, keyof U> & U;\n\n type ImmerSetter<T extends object> = {\n setState: (\n nextStateOrUpdater: T | Partial<T> | ((state: Draft<T>) => void),\n shouldReplace?: boolean | undefined,\n ) => void;\n };\n\n type StoreSubscribeWithSelector<T> = {\n subscribe: {\n (listener: (selectedState: T, previousSelectedState: T) => void): () => void;\n <U>(\n selector: (state: T) => U,\n listener: (selectedState: U, previousSelectedState: U) => void,\n options?: {\n equalityFn?: (a: U, b: U) => boolean;\n fireImmediately?: boolean;\n },\n ): () => void;\n };\n };\n\n // We add the immer setter method type\n type StoreWithImmer<T extends object> = Write<StoreApi<T>, ImmerSetter<T>>;\n\n // We add the subscribe with selector method type\n type StoreWithImmerAndSubscriber<T extends object> = Write<StoreWithImmer<T>, StoreSubscribeWithSelector<T>>;\n\n export type ZustandStore<T extends object> = UseBoundStore<StoreWithImmerAndSubscriber<T>>;\n\n export type Getter<T extends object> = StoreWithImmerAndSubscriber<T>['getState'];\n export type Setter<T extends object> = StoreWithImmerAndSubscriber<T>['setState'];\n\n export type InternalStore<A extends object, S extends object, R extends object> = A &\n AtomGetters<A> &\n AtomSetters<A, S, R> &\n S &\n R & {\n get: Getter<InternalStore<A, S, R>>;\n set: Setter<InternalStore<A, S, R>>;\n zustandRefs: Record<string, HTMLElement | null>;\n getZustandRef: (key: string[]) => HTMLElement | null;\n setZustandRef: (key: string[], value: HTMLElement | null) => void;\n apiRef: React.MutableRefObject<ZustandStore<InternalStore<A, S, R>>>;\n };\n\n export type PropsStore<T> = T & {\n get: Getter<PropsStore<T>>;\n set: Setter<PropsStore<T>>;\n };\n\n export type AtomGetters<A extends object> = {\n [key in keyof A as `get${Capitalize<string & key>}`]: () => A[key];\n };\n\n export type AtomSetters<A extends object, S extends object, R extends object> = {\n [key in keyof A as `set${Capitalize<string & key>}`]: (\n newVal: A[key] | ((arg: A[key], store: InternalStore<A, S, R>) => A[key]),\n ) => void;\n };\n\n export type SelectorObject<T extends object, S extends object> = (get: Getter<T>) => S;\n export type ReducerObject<T extends object, R extends object> = (get: Getter<T>, set: Setter<T>) => R;\n export type Subscribers<T extends object> = (api: StoreWithImmerAndSubscriber<T>) => void;\n\n export type InternalParameters<A extends object, S extends object, R extends object> = {\n internalAtomDefaultValues: A;\n selectors: SelectorObject<InternalStore<A, S, R>, S>;\n reducers: ReducerObject<InternalStore<A, S, R>, R>;\n subscribers: Subscribers<InternalStore<A, S, R>>;\n };\n\n export type Config<P extends object, A extends object, C extends object, S extends object, R extends object> = {\n defaultProps: P | (() => P);\n internalAtomDefaultValues: A;\n useAutoCalculated: (props: P) => C;\n selectors?: SelectorObject<InternalStore<A, S, R>, S>;\n reducers?: ReducerObject<InternalStore<A, S, R>, R>;\n subscribers?: Subscribers<InternalStore<A, S, R>>;\n PropsProvider: ReturnType<typeof createContext<ZustandStore<PropsStore<P & C>>>>['Provider'];\n InternalProvider: ReturnType<typeof createContext<ZustandStore<InternalStore<A, S, R>>>>['Provider'];\n usePropsStore: ReturnType<typeof createContext<ZustandStore<PropsStore<P & C>>>>['useStore'];\n };\n\n export type AutoUpdaterComponentT = <\n P extends object,\n A extends object,\n C extends object,\n S extends object,\n R extends object,\n >(\n props: Pick<Config<P, A, C, S, R>, 'usePropsStore'> & { autoCalculatedData: C } & {\n propsWithDefault: P;\n } & { Component: React.ComponentType<Record<string, never>> },\n ) => JSX.Element;\n}\n", "import * as React from 'react';\nexport { React };\n"],
|
5
5
|
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;ACAA,YAAuB;",
|
6
6
|
"names": []
|
7
7
|
}
|
package/dist/types/types.d.ts
CHANGED
@@ -49,7 +49,7 @@ export declare namespace ZustandT {
|
|
49
49
|
subscribers: Subscribers<InternalStore<A, S, R>>;
|
50
50
|
};
|
51
51
|
export type Config<P extends object, A extends object, C extends object, S extends object, R extends object> = {
|
52
|
-
defaultProps: P;
|
52
|
+
defaultProps: P | (() => P);
|
53
53
|
internalAtomDefaultValues: A;
|
54
54
|
useAutoCalculated: (props: P) => C;
|
55
55
|
selectors?: SelectorObject<InternalStore<A, S, R>, S>;
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@elliemae/ds-zustand-helpers",
|
3
|
-
"version": "3.
|
3
|
+
"version": "3.34.0-next.2",
|
4
4
|
"license": "MIT",
|
5
5
|
"description": "ICE MT - Dimsum - Zustand Helpers",
|
6
6
|
"files": [
|
@@ -41,12 +41,12 @@
|
|
41
41
|
"dependencies": {
|
42
42
|
"immer": "9.0.21",
|
43
43
|
"zustand": "4.3.6",
|
44
|
-
"@elliemae/ds-props-helpers": "3.
|
44
|
+
"@elliemae/ds-props-helpers": "3.34.0-next.2"
|
45
45
|
},
|
46
46
|
"devDependencies": {
|
47
47
|
"@elliemae/pui-cli": "~9.0.0-next.31",
|
48
48
|
"styled-components": "~5.3.9",
|
49
|
-
"@elliemae/ds-monorepo-devops": "3.
|
49
|
+
"@elliemae/ds-monorepo-devops": "3.34.0-next.2"
|
50
50
|
},
|
51
51
|
"peerDependencies": {
|
52
52
|
"react": "~17.0.2",
|