New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

@codemaskinc/store

Package Overview
Dependencies
Maintainers
5
Versions
15
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@codemaskinc/store - npm Package Compare versions

Comparing version 0.1.2 to 0.1.3

18

dist/index.d.ts

@@ -0,1 +1,2 @@

import { FC, PropsWithChildren } from "react";
export type Synchronizer<T> = {

@@ -9,5 +10,5 @@ value: T;

export type Actions<TState extends object> = {
[K in keyof TState as ActionKey<K>]: (value: Dispatch<TState, K> & {}) => void;
[K in keyof TState as ActionKey<K>]: (value: TState[K] | ((prevState: TState[K]) => TState[K])) => void;
} & {};
export type Dispatch<TState extends object, Keys extends keyof TState> = TState[Keys] | ((prevState: TState[Keys]) => TState[Keys]);
export type Dispatch<TState extends object, TKeys extends keyof TState> = TState[TKeys] | ((prevState: TState[TKeys]) => TState[TKeys]);
export type PickState<TState extends object, TKeys extends keyof TState> = {

@@ -22,9 +23,12 @@ [K in TKeys]: TState[K];

useStore: <TKeys extends (keyof TStateRaw)[]>(...keys_0: TKeys) => {
state: PickState<{ [K in keyof TStateRaw]: TStateRaw[K] extends Synchronizer<infer U> ? U : TStateRaw[K]; }, (TKeys extends [] ? (keyof TStateRaw)[] : TKeys)[number]>;
actions: PickState<{ [K in keyof TStateRaw]: TStateRaw[K] extends Synchronizer<infer U> ? U : TStateRaw[K]; }, (TKeys extends [] ? (keyof TStateRaw)[] : TKeys)[number]> extends infer T extends object ? { [K_1 in keyof T as `set${Capitalize<K_1 & string>}`]: (value: Dispatch<PickState<{ [K in keyof TStateRaw]: TStateRaw[K] extends Synchronizer<infer U> ? U : TStateRaw[K]; }, (TKeys extends [] ? (keyof TStateRaw)[] : TKeys)[number]>, K_1> & {}) => void; } : never;
state: (TKeys extends [] ? (keyof TStateRaw)[] : TKeys)[number] extends infer T extends keyof TStateRaw ? { [K in T]: { [K_1 in keyof TStateRaw]: TStateRaw[K_1] extends Synchronizer<infer U> ? U : TStateRaw[K_1]; }[K]; } : never;
actions: PickState<{ [K_1 in keyof TStateRaw]: TStateRaw[K_1] extends Synchronizer<infer U> ? U : TStateRaw[K_1]; }, (TKeys extends [] ? (keyof TStateRaw)[] : TKeys)[number]> extends infer T_1 extends object ? { [K_2 in keyof T_1 as `set${Capitalize<K_2 & string>}`]: (value: PickState<{ [K_1 in keyof TStateRaw]: TStateRaw[K_1] extends Synchronizer<infer U> ? U : TStateRaw[K_1]; }, (TKeys extends [] ? (keyof TStateRaw)[] : TKeys)[number]>[K_2] | ((prevState: PickState<{ [K_1 in keyof TStateRaw]: TStateRaw[K_1] extends Synchronizer<infer U> ? U : TStateRaw[K_1]; }, (TKeys extends [] ? (keyof TStateRaw)[] : TKeys)[number]>[K_2]) => PickState<{ [K_1 in keyof TStateRaw]: TStateRaw[K_1] extends Synchronizer<infer U> ? U : TStateRaw[K_1]; }, (TKeys extends [] ? (keyof TStateRaw)[] : TKeys)[number]>[K_2])) => void; } : never;
};
getState: () => { [K_2 in keyof { [K in keyof TStateRaw]: TStateRaw[K] extends Synchronizer<infer U> ? U : TStateRaw[K]; }]: { [K in keyof TStateRaw]: TStateRaw[K] extends Synchronizer<infer U> ? U : TStateRaw[K]; }[K_2]; };
actions: { [K_3 in keyof { [K in keyof TStateRaw]: TStateRaw[K] extends Synchronizer<infer U> ? U : TStateRaw[K]; } as `set${Capitalize<K_3 & string>}`]: (value: Dispatch<{ [K in keyof TStateRaw]: TStateRaw[K] extends Synchronizer<infer U> ? U : TStateRaw[K]; }, K_3> & {}) => void; };
getState: () => { [K_3 in keyof { [K_1 in keyof TStateRaw]: TStateRaw[K_1] extends Synchronizer<infer U> ? U : TStateRaw[K_1]; }]: { [K_1 in keyof TStateRaw]: TStateRaw[K_1] extends Synchronizer<infer U> ? U : TStateRaw[K_1]; }[K_3]; };
actions: { [K_4 in keyof { [K_1 in keyof TStateRaw]: TStateRaw[K_1] extends Synchronizer<infer U> ? U : TStateRaw[K_1]; } as `set${Capitalize<K_4 & string>}`]: (value: { [K_1 in keyof TStateRaw]: TStateRaw[K_1] extends Synchronizer<infer U> ? U : TStateRaw[K_1]; }[K_4] | ((prevState: { [K_1 in keyof TStateRaw]: TStateRaw[K_1] extends Synchronizer<infer U> ? U : TStateRaw[K_1]; }[K_4]) => { [K_1 in keyof TStateRaw]: TStateRaw[K_1] extends Synchronizer<infer U> ? U : TStateRaw[K_1]; }[K_4])) => void; };
reset: <TKeys_1 extends (keyof TStateRaw)[]>(...keys_0: TKeys_1) => void;
effect: <TKeys_2 extends (keyof TStateRaw)[]>(run: (state: { [K in keyof TStateRaw]: TStateRaw[K] extends Synchronizer<infer U> ? U : TStateRaw[K]; }) => void, deps: [...TKeys_2]) => () => void;
effect: <TKeys_2 extends (keyof TStateRaw)[]>(run: (state: { [K_1 in keyof TStateRaw]: TStateRaw[K_1] extends Synchronizer<infer U> ? U : TStateRaw[K_1]; }) => void, deps: [...TKeys_2]) => () => void;
HydrateStore: FC<PropsWithChildren<{
hydrateState: Partial<{ [K_1 in keyof TStateRaw]: TStateRaw[K_1] extends Synchronizer<infer U> ? U : TStateRaw[K_1]; }>;
}>>;
};

@@ -31,0 +35,0 @@ export function storage<T>(initialValue: T, localStorageKey?: string): Synchronizer<T>;

@@ -153,2 +153,14 @@ var $8zHUo$fastdeepequal = require("fast-deep-equal");

};
const HydrateStore = ({ hydrateState: hydrateState, children: children })=>{
Object.entries(hydrateState).forEach(([key, value])=>{
getAction(key)(value);
const initialState = stateRaw[key];
if ((0, $9ba0f9a5c47c04f2$export$c000ccc814a70475)(initialState)) {
initialState.value = value;
return;
}
stateRaw[key] = value;
});
return children;
};
return {

@@ -159,3 +171,4 @@ useStore: useStore,

reset: reset,
effect: effect
effect: effect,
HydrateStore: HydrateStore
};

@@ -162,0 +175,0 @@ };

{
"name": "@codemaskinc/store",
"version": "0.1.2",
"version": "0.1.3",
"description": "- ⚛️ updates outside react components - 🪝 easy access to all store values - ✍️ no repeating yourself - ⚡️ no unnecessary rerenders - 🚀 typescript intellisense",

@@ -40,3 +40,6 @@ "source": "src/index.ts",

"publishConfig": {
"access": "public"
"access": "public",
"ignore": [
"dist/*.map*"
]
},

@@ -43,0 +46,0 @@ "license": "MIT",

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

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