@tramvai/state 2.24.3 → 2.25.1

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.
@@ -3,7 +3,7 @@ import type { Reducer } from '../../createReducer/createReducer.h';
3
3
  import type { BaseStoreConstructor } from '../../stores/BaseStore';
4
4
  export declare type ArrayKeys = keyof any[];
5
5
  export declare type Indices<T> = Exclude<keyof T, ArrayKeys>;
6
- declare type OptionalStoreType<S extends any = any, N extends string = string> = {
6
+ declare type OptionalStoreType<S = any, N extends string = string> = {
7
7
  store: Reducer<S, N> | string;
8
8
  optional: true;
9
9
  };
@@ -24,15 +24,15 @@ export declare function useSelector<T, R extends BaseStoreConstructor<any>>(stor
24
24
  export declare function useSelector<T, S extends ReadonlyArray<unknown>>(storesOrStore: S, selector: (state: {
25
25
  [Key in Indices<S> as InferStoreNameFromUnknownStore<S[Key]>]: InferStoreStateFromUnknownStore<S[Key]>;
26
26
  }) => T, equalityFn?: typeof shallowEqual): T;
27
- export declare function useSelector<T, S extends any>(storesOrStore: S, selector: (state: Record<string, any>) => T, equalityFn?: typeof shallowEqual): T;
27
+ export declare function useSelector<T, S>(storesOrStore: S, selector: (state: Record<string, any>) => T, equalityFn?: typeof shallowEqual): T;
28
28
  declare type DEFAULT_STORE_NAME = string;
29
29
  declare type DEFAULT_STORE_STATE = any;
30
30
  declare type InferStoreNameFromOptionalStore<Store extends OptionalStoreType> = Store['store'] extends Reducer<any, infer Name> ? Name : DEFAULT_STORE_NAME;
31
31
  declare type InferStoreStateFromOptionalStore<Store extends OptionalStoreType> = Store['store'] extends Reducer<infer State> ? State : DEFAULT_STORE_STATE;
32
- declare type InferStoreNameFromUnknownStore<Store extends unknown> = Store extends string ? Store : Store extends OptionalStoreType ? InferStoreNameFromOptionalStore<Store> : Store extends Reducer<any> ? InferStoreNameFromReducer<Store> : Store extends BaseStoreConstructor<any> ? InferStoreNameFromLegacyStore<Store> : DEFAULT_STORE_NAME;
32
+ declare type InferStoreNameFromUnknownStore<Store> = Store extends string ? Store : Store extends OptionalStoreType ? InferStoreNameFromOptionalStore<Store> : Store extends Reducer<any> ? InferStoreNameFromReducer<Store> : Store extends BaseStoreConstructor<any> ? InferStoreNameFromLegacyStore<Store> : DEFAULT_STORE_NAME;
33
33
  declare type InferStoreNameFromReducer<Store extends Reducer<any>> = Store['storeName'];
34
34
  declare type InferStoreStateFromReducer<Store extends Reducer<any>> = Store extends Reducer<infer State> ? State : DEFAULT_STORE_STATE;
35
35
  declare type InferStoreNameFromLegacyStore<Store extends BaseStoreConstructor<any>> = Store['storeName'];
36
36
  declare type InferStoreStateFromLegacyStore<Store extends BaseStoreConstructor<any>> = Store extends BaseStoreConstructor<infer State> ? State : DEFAULT_STORE_STATE;
37
- declare type InferStoreStateFromUnknownStore<Store extends unknown> = Store extends string ? DEFAULT_STORE_STATE : Store extends OptionalStoreType ? InferStoreStateFromOptionalStore<Store> : Store extends Reducer<any> ? InferStoreStateFromReducer<Store> : Store extends BaseStoreConstructor<any> ? InferStoreStateFromLegacyStore<Store> : DEFAULT_STORE_STATE;
37
+ declare type InferStoreStateFromUnknownStore<Store> = Store extends string ? DEFAULT_STORE_STATE : Store extends OptionalStoreType ? InferStoreStateFromOptionalStore<Store> : Store extends Reducer<any> ? InferStoreStateFromReducer<Store> : Store extends BaseStoreConstructor<any> ? InferStoreStateFromLegacyStore<Store> : DEFAULT_STORE_STATE;
38
38
  export {};
@@ -1,2 +1,2 @@
1
1
  import type { Reducer } from '../..';
2
- export declare const useStoreSelector: <TState extends unknown, TPayload extends unknown>(store: Reducer<TState, string>, selector: (state: TState) => TPayload) => TPayload;
2
+ export declare const useStoreSelector: <TState, TPayload>(store: Reducer<TState, string>, selector: (state: TState) => TPayload) => TPayload;
@@ -13,7 +13,7 @@ export declare function createConnect({ connectHOC, mapStateToPropsFactories, ma
13
13
  }): (stores: (StoreClass | string | {
14
14
  store: StoreClass | string;
15
15
  optional: boolean;
16
- })[], mapStateToProps: MapStateToProps, mapContextToProps?: MapContextToProps<any> | undefined, mergeProps?: MergeProps<any, any, any> | undefined, { pure, areStatesEqual, areOwnPropsEqual, areStatePropsEqual, areMergedPropsEqual, ...extraOptions }?: {
16
+ })[], mapStateToProps: MapStateToProps, mapContextToProps?: MapContextToProps, mergeProps?: MergeProps, { pure, areStatesEqual, areOwnPropsEqual, areStatePropsEqual, areMergedPropsEqual, ...extraOptions }?: {
17
17
  pure?: boolean | undefined;
18
18
  areStatesEqual?: ((test1: any, test2: any) => boolean) | undefined;
19
19
  areOwnPropsEqual?: ((test1: any, test2: any) => boolean) | undefined;
@@ -23,7 +23,7 @@ export declare function createConnect({ connectHOC, mapStateToPropsFactories, ma
23
23
  declare const connect: (stores: (StoreClass | string | {
24
24
  store: StoreClass | string;
25
25
  optional: boolean;
26
- })[], mapStateToProps: MapStateToProps, mapContextToProps?: MapContextToProps<any> | undefined, mergeProps?: MergeProps<any, any, any> | undefined, { pure, areStatesEqual, areOwnPropsEqual, areStatePropsEqual, areMergedPropsEqual, ...extraOptions }?: {
26
+ })[], mapStateToProps: MapStateToProps, mapContextToProps?: MapContextToProps, mergeProps?: MergeProps, { pure, areStatesEqual, areOwnPropsEqual, areStatePropsEqual, areMergedPropsEqual, ...extraOptions }?: {
27
27
  pure?: boolean | undefined;
28
28
  areStatesEqual?: ((test1: any, test2: any) => boolean) | undefined;
29
29
  areOwnPropsEqual?: ((test1: any, test2: any) => boolean) | undefined;
package/lib/index.es.js CHANGED
@@ -885,7 +885,7 @@ pure = true,
885
885
  // We memoize the elements for the rendered child component as an optimization.
886
886
  const renderedWrappedComponent = useMemo(
887
887
  // eslint-disable-next-line react/jsx-props-no-spreading
888
- () => jsx(WrappedComponent, Object.assign({}, actualChildProps, { ref: forwardedRef }), void 0), [forwardedRef, actualChildProps]);
888
+ () => jsx(WrappedComponent, { ...actualChildProps, ref: forwardedRef }), [forwardedRef, actualChildProps]);
889
889
  return renderedWrappedComponent;
890
890
  };
891
891
  // If we're in "pure" mode, ensure our wrapper component only re-renders when incoming props have changed.
@@ -895,7 +895,7 @@ pure = true,
895
895
  if (forwardRef) {
896
896
  const forwarded = React.forwardRef(function forwardConnectRef(props, ref) {
897
897
  // eslint-disable-next-line react/jsx-props-no-spreading
898
- return jsx(Connect, Object.assign({}, props, { forwardedRef: ref }), void 0);
898
+ return jsx(Connect, { ...props, forwardedRef: ref });
899
899
  });
900
900
  forwarded.displayName = displayName;
901
901
  forwarded.WrappedComponent = WrappedComponent;
@@ -1160,7 +1160,7 @@ function finalPropsSelectorFactory(context, { initMapStateToProps, initMapContex
1160
1160
  }
1161
1161
 
1162
1162
  const Provider = ({ context, children, serverState, }) => {
1163
- return (jsx(ConnectContext.Provider, Object.assign({ value: context }, { children: jsx(ServerStateContext.Provider, Object.assign({ value: serverState }, { children: children }), void 0) }), void 0));
1163
+ return (jsx(ConnectContext.Provider, { value: context, children: jsx(ServerStateContext.Provider, { value: serverState, children: children }) }));
1164
1164
  };
1165
1165
 
1166
1166
  /*
package/lib/index.js CHANGED
@@ -907,7 +907,7 @@ pure = true,
907
907
  // We memoize the elements for the rendered child component as an optimization.
908
908
  const renderedWrappedComponent = React.useMemo(
909
909
  // eslint-disable-next-line react/jsx-props-no-spreading
910
- () => jsxRuntime.jsx(WrappedComponent, Object.assign({}, actualChildProps, { ref: forwardedRef }), void 0), [forwardedRef, actualChildProps]);
910
+ () => jsxRuntime.jsx(WrappedComponent, { ...actualChildProps, ref: forwardedRef }), [forwardedRef, actualChildProps]);
911
911
  return renderedWrappedComponent;
912
912
  };
913
913
  // If we're in "pure" mode, ensure our wrapper component only re-renders when incoming props have changed.
@@ -917,7 +917,7 @@ pure = true,
917
917
  if (forwardRef) {
918
918
  const forwarded = React__default["default"].forwardRef(function forwardConnectRef(props, ref) {
919
919
  // eslint-disable-next-line react/jsx-props-no-spreading
920
- return jsxRuntime.jsx(Connect, Object.assign({}, props, { forwardedRef: ref }), void 0);
920
+ return jsxRuntime.jsx(Connect, { ...props, forwardedRef: ref });
921
921
  });
922
922
  forwarded.displayName = displayName;
923
923
  forwarded.WrappedComponent = WrappedComponent;
@@ -1182,7 +1182,7 @@ function finalPropsSelectorFactory(context, { initMapStateToProps, initMapContex
1182
1182
  }
1183
1183
 
1184
1184
  const Provider = ({ context, children, serverState, }) => {
1185
- return (jsxRuntime.jsx(ConnectContext.Provider, Object.assign({ value: context }, { children: jsxRuntime.jsx(ServerStateContext.Provider, Object.assign({ value: serverState }, { children: children }), void 0) }), void 0));
1185
+ return (jsxRuntime.jsx(ConnectContext.Provider, { value: context, children: jsxRuntime.jsx(ServerStateContext.Provider, { value: serverState, children: children }) }));
1186
1186
  };
1187
1187
 
1188
1188
  /*
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tramvai/state",
3
- "version": "2.24.3",
3
+ "version": "2.25.1",
4
4
  "description": "",
5
5
  "main": "lib/index.js",
6
6
  "typings": "lib/index.d.ts",
@@ -18,13 +18,13 @@
18
18
  "build-for-publish": "true"
19
19
  },
20
20
  "dependencies": {
21
- "@tinkoff/react-hooks": "0.1.2",
21
+ "@tinkoff/react-hooks": "0.1.3",
22
22
  "@tinkoff/utils": "^2.1.2",
23
- "@tramvai/types-actions-state-context": "2.24.3",
23
+ "@tramvai/types-actions-state-context": "2.25.1",
24
24
  "@types/hoist-non-react-statics": "^3.3.1",
25
25
  "invariant": "^2.2.4",
26
26
  "react-is": ">=17",
27
- "tslib": "^2.0.3",
27
+ "tslib": "^2.4.0",
28
28
  "use-sync-external-store": "^1.2.0"
29
29
  },
30
30
  "peerDependencies": {
@@ -35,7 +35,7 @@
35
35
  },
36
36
  "devDependencies": {
37
37
  "@reatom/core": "^1.1.5",
38
- "@tramvai/core": "2.24.3",
38
+ "@tramvai/core": "2.25.1",
39
39
  "@types/invariant": "^2.2.31",
40
40
  "@types/react-is": "^17.0.0",
41
41
  "@types/use-sync-external-store": "^0.0.3",