Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

zustand

Package Overview
Dependencies
Maintainers
3
Versions
142
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

zustand - npm Package Compare versions

Comparing version 4.4.4 to 4.4.5

3

context.d.ts

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

import ReactExports from 'react';
import type { ReactNode } from 'react';

@@ -20,3 +21,3 @@ import type { StoreApi } from 'zustand';

children: ReactNode;
}) => import("react").FunctionComponentElement<import("react").ProviderProps<S | undefined>>;
}) => ReactExports.FunctionComponentElement<ReactExports.ProviderProps<S | undefined>>;
useStore: UseContextStore<S>;

@@ -23,0 +24,0 @@ useStoreApi: () => WithoutCallSignature<S>;

'use strict';
var react = require('react');
var ReactExports = require('react');
var traditional = require('zustand/traditional');

@@ -21,2 +21,7 @@

var createElement = ReactExports.createElement,
reactCreateContext = ReactExports.createContext,
useContext = ReactExports.useContext,
useMemo = ReactExports.useMemo,
useRef = ReactExports.useRef;
function createContext() {

@@ -26,11 +31,11 @@ if (process.env.NODE_ENV !== 'production') {

}
var ZustandContext = react.createContext(undefined);
var ZustandContext = reactCreateContext(undefined);
var Provider = function Provider(_ref) {
var createStore = _ref.createStore,
children = _ref.children;
var storeRef = react.useRef();
var storeRef = useRef();
if (!storeRef.current) {
storeRef.current = createStore();
}
return react.createElement(ZustandContext.Provider, {
return createElement(ZustandContext.Provider, {
value: storeRef.current

@@ -40,3 +45,3 @@ }, children);

var useContextStore = function useContextStore(selector, equalityFn) {
var store = react.useContext(ZustandContext);
var store = useContext(ZustandContext);
if (!store) {

@@ -48,7 +53,7 @@ throw new Error('Seems like you have not used zustand provider as an ancestor.');

var useStoreApi = function useStoreApi() {
var store = react.useContext(ZustandContext);
var store = useContext(ZustandContext);
if (!store) {
throw new Error('Seems like you have not used zustand provider as an ancestor.');
}
return react.useMemo(function () {
return useMemo(function () {
return _extends({}, store);

@@ -55,0 +60,0 @@ }, [store]);

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

import ReactExports from 'react';
import type { ReactNode } from 'react';

@@ -20,3 +21,3 @@ import type { StoreApi } from 'zustand';

children: ReactNode;
}) => import("react").FunctionComponentElement<import("react").ProviderProps<S | undefined>>;
}) => ReactExports.FunctionComponentElement<ReactExports.ProviderProps<S | undefined>>;
useStore: UseContextStore<S>;

@@ -23,0 +24,0 @@ useStoreApi: () => WithoutCallSignature<S>;

@@ -1,4 +0,11 @@

import { createContext as createContext$1, useRef, createElement, useContext, useMemo } from 'react';
import ReactExports from 'react';
import { useStoreWithEqualityFn } from 'zustand/traditional';
const {
createElement,
createContext: reactCreateContext,
useContext,
useMemo,
useRef
} = ReactExports;
function createContext() {

@@ -10,3 +17,3 @@ if (process.env.NODE_ENV !== "production") {

}
const ZustandContext = createContext$1(void 0);
const ZustandContext = reactCreateContext(void 0);
const Provider = ({

@@ -13,0 +20,0 @@ createStore,

import { createStore } from 'zustand/vanilla';
export * from 'zustand/vanilla';
import { useDebugValue } from 'react';
import ReactExports from 'react';
import useSyncExternalStoreExports from 'use-sync-external-store/shim/with-selector.js';
const { useDebugValue } = ReactExports;
const { useSyncExternalStoreWithSelector } = useSyncExternalStoreExports;

@@ -7,0 +8,0 @@ let didWarnAboutEqualityFn = false;

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

import { useRef } from 'react';
import ReactExports from 'react';

@@ -42,2 +42,3 @@ function shallow(objA, objB) {

const { useRef } = ReactExports;
function useShallow(selector) {

@@ -44,0 +45,0 @@ const prev = useRef();

@@ -1,5 +0,6 @@

import { useDebugValue } from 'react';
import ReactExports from 'react';
import useSyncExternalStoreExports from 'use-sync-external-store/shim/with-selector.js';
import { createStore } from 'zustand/vanilla';
const { useDebugValue } = ReactExports;
const { useSyncExternalStoreWithSelector } = useSyncExternalStoreExports;

@@ -6,0 +7,0 @@ function useStoreWithEqualityFn(api, selector = api.getState, equalityFn) {

'use strict';
var vanilla = require('zustand/vanilla');
var react$1 = require('react');
var ReactExports = require('react');
var useSyncExternalStoreExports = require('use-sync-external-store/shim/with-selector');
var useDebugValue = ReactExports.useDebugValue;
var useSyncExternalStoreWithSelector = useSyncExternalStoreExports.useSyncExternalStoreWithSelector;

@@ -18,3 +19,3 @@ var didWarnAboutEqualityFn = false;

var slice = useSyncExternalStoreWithSelector(api.subscribe, api.getState, api.getServerState || api.getState, selector, equalityFn);
react$1.useDebugValue(slice);
useDebugValue(slice);
return slice;

@@ -21,0 +22,0 @@ }

{
"name": "zustand",
"private": false,
"version": "4.4.4",
"version": "4.4.5",
"description": "🐻 Bear necessities for state management in React",

@@ -24,3 +24,2 @@ "main": "./index.js",

".": {
"types": "./index.d.ts",
"import": {

@@ -30,4 +29,10 @@ "types": "./esm/index.d.mts",

},
"module": "./esm/index.js",
"default": "./index.js"
"module": {
"types": "./index.d.ts",
"default": "./esm/index.js"
},
"default": {
"types": "./index.d.ts",
"default": "./index.js"
}
},

@@ -34,0 +39,0 @@ "./vanilla": {

'use strict';
var react = require('react');
var ReactExports = require('react');

@@ -78,4 +78,5 @@ function _unsupportedIterableToArray(o, minLen) {

var useRef = ReactExports.useRef;
function useShallow(selector) {
var prev = react.useRef();
var prev = useRef();
return function (state) {

@@ -82,0 +83,0 @@ var next = selector(state);

System.register(['react', 'zustand/traditional'], (function (exports) {
'use strict';
var createContext$1, useRef, createElement, useContext, useMemo, useStoreWithEqualityFn;
var ReactExports, useStoreWithEqualityFn;
return {
setters: [function (module) {
createContext$1 = module.createContext;
useRef = module.useRef;
createElement = module.createElement;
useContext = module.useContext;
useMemo = module.useMemo;
ReactExports = module.default;
}, function (module) {

@@ -18,2 +14,9 @@ useStoreWithEqualityFn = module.useStoreWithEqualityFn;

const {
createElement,
createContext: reactCreateContext,
useContext,
useMemo,
useRef
} = ReactExports;
function createContext() {

@@ -25,3 +28,3 @@ {

}
const ZustandContext = createContext$1(void 0);
const ZustandContext = reactCreateContext(void 0);
const Provider = ({

@@ -28,0 +31,0 @@ createStore,

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

System.register(["react","zustand/traditional"],function(d){"use strict";var s,a,c,n,i,f;return{setters:[function(e){s=e.createContext,a=e.useRef,c=e.createElement,n=e.useContext,i=e.useMemo},function(e){f=e.useStoreWithEqualityFn}],execute:function(){d("default",e);function e(){const o=s(void 0);return{Provider:({createStore:t,children:u})=>{const r=a();return r.current||(r.current=t()),c(o.Provider,{value:r.current},u)},useStore:(t,u)=>{const r=n(o);if(!r)throw new Error("Seems like you have not used zustand provider as an ancestor.");return f(r,t,u)},useStoreApi:()=>{const t=n(o);if(!t)throw new Error("Seems like you have not used zustand provider as an ancestor.");return i(()=>({...t}),[t])}}}}}});
System.register(["react","zustand/traditional"],function(a){"use strict";var o,s;return{setters:[function(r){o=r.default},function(r){s=r.useStoreWithEqualityFn}],execute:function(){a("default",l);const{createElement:r,createContext:c,useContext:i,useMemo:d,useRef:f}=o;function l(){const n=c(void 0);return{Provider:({createStore:e,children:u})=>{const t=f();return t.current||(t.current=e()),r(n.Provider,{value:t.current},u)},useStore:(e,u)=>{const t=i(n);if(!t)throw new Error("Seems like you have not used zustand provider as an ancestor.");return s(t,e,u)},useStoreApi:()=>{const e=i(n);if(!e)throw new Error("Seems like you have not used zustand provider as an ancestor.");return d(()=>({...e}),[e])}}}}}});

@@ -8,3 +8,3 @@ System.register(['zustand/vanilla', 'react', 'use-sync-external-store/shim/with-selector'], (function (exports) {

};
var createStore, useDebugValue, useSyncExternalStoreExports;
var createStore, ReactExports, useSyncExternalStoreExports;
return {

@@ -19,3 +19,3 @@ setters: [function (module) {

}, function (module) {
useDebugValue = module.useDebugValue;
ReactExports = module.default;
}, function (module) {

@@ -28,2 +28,3 @@ useSyncExternalStoreExports = module.default;

const { useDebugValue } = ReactExports;
const { useSyncExternalStoreWithSelector } = useSyncExternalStoreExports;

@@ -30,0 +31,0 @@ let didWarnAboutEqualityFn = false;

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

System.register(["zustand/vanilla","react","use-sync-external-store/shim/with-selector"],function(c){"use strict";var f={create:1,default:1,useStore:1},o,i,S;return{setters:[function(t){o=t.createStore;var n={};for(var r in t)f[r]||(n[r]=t[r]);c(n)},function(t){i=t.useDebugValue},function(t){S=t.default}],execute:function(){c("useStore",n);const{useSyncExternalStoreWithSelector:t}=S;function n(e,s=e.getState,u){const a=t(e.subscribe,e.getState,e.getServerState||e.getState,s,u);return i(a),a}const r=e=>{const s=typeof e=="function"?o(e):e,u=(a,g)=>n(s,a,g);return Object.assign(u,s),u},l=c("create",e=>e?r(e):r);var v=c("default",e=>l(e))}}});
System.register(["zustand/vanilla","react","use-sync-external-store/shim/with-selector"],function(c){"use strict";var l={create:1,default:1,useStore:1},o,i,f;return{setters:[function(t){o=t.createStore;var n={};for(var r in t)l[r]||(n[r]=t[r]);c(n)},function(t){i=t.default},function(t){f=t.default}],execute:function(){c("useStore",r);const{useDebugValue:t}=i,{useSyncExternalStoreWithSelector:n}=f;function r(e,s=e.getState,a){const u=n(e.subscribe,e.getState,e.getServerState||e.getState,s,a);return t(u),u}const S=e=>{const s=typeof e=="function"?o(e):e,a=(u,v)=>r(s,u,v);return Object.assign(a,s),a},g=c("create",e=>e?S(e):S);var b=c("default",e=>g(e))}}});
System.register(['react'], (function (exports) {
'use strict';
var useRef;
var ReactExports;
return {
setters: [function (module) {
useRef = module.useRef;
ReactExports = module.default;
}],

@@ -51,2 +51,3 @@ execute: (function () {

const { useRef } = ReactExports;
function useShallow(selector) {

@@ -53,0 +54,0 @@ const prev = useRef();

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

System.register(["react"],function(c){"use strict";var u;return{setters:[function(s){u=s.useRef}],execute:function(){c("useShallow",f);function s(r,e){if(Object.is(r,e))return!0;if(typeof r!="object"||r===null||typeof e!="object"||e===null)return!1;if(r instanceof Map&&e instanceof Map){if(r.size!==e.size)return!1;for(const[t,o]of r)if(!Object.is(o,e.get(t)))return!1;return!0}if(r instanceof Set&&e instanceof Set){if(r.size!==e.size)return!1;for(const t of r)if(!e.has(t))return!1;return!0}const n=Object.keys(r);if(n.length!==Object.keys(e).length)return!1;for(let t=0;t<n.length;t++)if(!Object.prototype.hasOwnProperty.call(e,n[t])||!Object.is(r[n[t]],e[n[t]]))return!1;return!0}function f(r){const e=u();return n=>{const t=r(n);return s(e.current,t)?e.current:e.current=t}}}}});
System.register(["react"],function(o){"use strict";var s;return{setters:[function(c){s=c.default}],execute:function(){o("useShallow",f);function c(e,t){if(Object.is(e,t))return!0;if(typeof e!="object"||e===null||typeof t!="object"||t===null)return!1;if(e instanceof Map&&t instanceof Map){if(e.size!==t.size)return!1;for(const[r,i]of e)if(!Object.is(i,t.get(r)))return!1;return!0}if(e instanceof Set&&t instanceof Set){if(e.size!==t.size)return!1;for(const r of e)if(!t.has(r))return!1;return!0}const n=Object.keys(e);if(n.length!==Object.keys(t).length)return!1;for(let r=0;r<n.length;r++)if(!Object.prototype.hasOwnProperty.call(t,n[r])||!Object.is(e[n[r]],t[n[r]]))return!1;return!0}const{useRef:u}=s;function f(e){const t=u();return n=>{const r=e(n);return c(t.current,r)?t.current:t.current=r}}}}});
System.register(['react', 'use-sync-external-store/shim/with-selector', 'zustand/vanilla'], (function (exports) {
'use strict';
var useDebugValue, useSyncExternalStoreExports, createStore;
var ReactExports, useSyncExternalStoreExports, createStore;
return {
setters: [function (module) {
useDebugValue = module.useDebugValue;
ReactExports = module.default;
}, function (module) {

@@ -16,2 +16,3 @@ useSyncExternalStoreExports = module.default;

const { useDebugValue } = ReactExports;
const { useSyncExternalStoreWithSelector } = useSyncExternalStoreExports;

@@ -18,0 +19,0 @@ function useStoreWithEqualityFn(api, selector = api.getState, equalityFn) {

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

System.register(["react","use-sync-external-store/shim/with-selector","zustand/vanilla"],function(a){"use strict";var s,c,i;return{setters:[function(t){s=t.useDebugValue},function(t){c=t.default},function(t){i=t.createStore}],execute:function(){a("useStoreWithEqualityFn",o);const{useSyncExternalStoreWithSelector:t}=c;function o(e,n=e.getState,r){const u=t(e.subscribe,e.getState,e.getServerState||e.getState,n,r);return s(u),u}const l=(e,n)=>{const r=i(e),u=(S,g=n)=>o(r,S,g);return Object.assign(u,r),u},f=a("createWithEqualityFn",(e,n)=>e?l(e,n):l)}}});
System.register(["react","use-sync-external-store/shim/with-selector","zustand/vanilla"],function(a){"use strict";var c,s,i;return{setters:[function(e){c=e.default},function(e){s=e.default},function(e){i=e.createStore}],execute:function(){a("useStoreWithEqualityFn",o);const{useDebugValue:e}=c,{useSyncExternalStoreWithSelector:S}=s;function o(t,n=t.getState,u){const r=S(t.subscribe,t.getState,t.getServerState||t.getState,n,u);return e(r),r}const l=(t,n)=>{const u=i(t),r=(f,g=n)=>o(u,f,g);return Object.assign(r,u),r},h=a("createWithEqualityFn",(t,n)=>t?l(t,n):l)}}});
'use strict';
var react = require('react');
var ReactExports = require('react');
var useSyncExternalStoreExports = require('use-sync-external-store/shim/with-selector');
var vanilla = require('zustand/vanilla');
var useDebugValue = ReactExports.useDebugValue;
var useSyncExternalStoreWithSelector = useSyncExternalStoreExports.useSyncExternalStoreWithSelector;

@@ -13,3 +14,3 @@ function useStoreWithEqualityFn(api, selector, equalityFn) {

var slice = useSyncExternalStoreWithSelector(api.subscribe, api.getState, api.getServerState || api.getState, selector, equalityFn);
react.useDebugValue(slice);
useDebugValue(slice);
return slice;

@@ -16,0 +17,0 @@ }

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

import ReactExports from 'react';
import { ReactNode } from 'react';

@@ -20,3 +21,3 @@ import { StoreApi } from 'zustand';

children: ReactNode;
}) => import("react").FunctionComponentElement<import("react").ProviderProps<S | undefined>>;
}) => ReactExports.FunctionComponentElement<ReactExports.ProviderProps<S | undefined>>;
useStore: UseContextStore<S>;

@@ -23,0 +24,0 @@ useStoreApi: () => WithoutCallSignature<S>;

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

import ReactExports from 'react';
import { ReactNode } from 'react';

@@ -20,3 +21,3 @@ import { StoreApi } from 'zustand';

children: ReactNode;
}) => import("react").FunctionComponentElement<import("react").ProviderProps<S | undefined>>;
}) => ReactExports.FunctionComponentElement<ReactExports.ProviderProps<S | undefined>>;
useStore: UseContextStore<S>;

@@ -23,0 +24,0 @@ useStoreApi: () => WithoutCallSignature<S>;

@@ -5,3 +5,3 @@ (function (global, factory) {

(global = typeof globalThis !== 'undefined' ? globalThis : global || self, global.zustandContext = factory(global.React, global.traditional));
})(this, (function (react, traditional) { 'use strict';
})(this, (function (ReactExports, traditional) { 'use strict';

@@ -23,2 +23,7 @@ function _extends() {

var createElement = ReactExports.createElement,
reactCreateContext = ReactExports.createContext,
useContext = ReactExports.useContext,
useMemo = ReactExports.useMemo,
useRef = ReactExports.useRef;
function createContext() {

@@ -28,11 +33,11 @@ {

}
var ZustandContext = react.createContext(undefined);
var ZustandContext = reactCreateContext(undefined);
var Provider = function Provider(_ref) {
var createStore = _ref.createStore,
children = _ref.children;
var storeRef = react.useRef();
var storeRef = useRef();
if (!storeRef.current) {
storeRef.current = createStore();
}
return react.createElement(ZustandContext.Provider, {
return createElement(ZustandContext.Provider, {
value: storeRef.current

@@ -42,3 +47,3 @@ }, children);

var useContextStore = function useContextStore(selector, equalityFn) {
var store = react.useContext(ZustandContext);
var store = useContext(ZustandContext);
if (!store) {

@@ -50,7 +55,7 @@ throw new Error('Seems like you have not used zustand provider as an ancestor.');

var useStoreApi = function useStoreApi() {
var store = react.useContext(ZustandContext);
var store = useContext(ZustandContext);
if (!store) {
throw new Error('Seems like you have not used zustand provider as an ancestor.');
}
return react.useMemo(function () {
return useMemo(function () {
return _extends({}, store);

@@ -57,0 +62,0 @@ }, [store]);

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

!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t(require("react"),require("zustand/traditional")):"function"==typeof define&&define.amd?define(["react","zustand/traditional"],t):(e="undefined"!=typeof globalThis?globalThis:e||self).zustandContext=t(e.React,e.traditional)}(this,(function(e,t){"use strict";function r(){return r=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},r.apply(this,arguments)}return function(){var n=e.createContext(void 0);return{Provider:function(t){var r=t.createStore,o=t.children,u=e.useRef();return u.current||(u.current=r()),e.createElement(n.Provider,{value:u.current},o)},useStore:function(r,o){var u=e.useContext(n);if(!u)throw new Error("Seems like you have not used zustand provider as an ancestor.");return t.useStoreWithEqualityFn(u,r,o)},useStoreApi:function(){var t=e.useContext(n);if(!t)throw new Error("Seems like you have not used zustand provider as an ancestor.");return e.useMemo((function(){return r({},t)}),[t])}}}}));
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t(require("react"),require("zustand/traditional")):"function"==typeof define&&define.amd?define(["react","zustand/traditional"],t):(e="undefined"!=typeof globalThis?globalThis:e||self).zustandContext=t(e.React,e.traditional)}(this,(function(e,t){"use strict";function r(){return r=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},r.apply(this,arguments)}var n=e.createElement,o=e.createContext,i=e.useContext,u=e.useMemo,a=e.useRef;return function(){var e=o(void 0);return{Provider:function(t){var r=t.createStore,o=t.children,i=a();return i.current||(i.current=r()),n(e.Provider,{value:i.current},o)},useStore:function(r,n){var o=i(e);if(!o)throw new Error("Seems like you have not used zustand provider as an ancestor.");return t.useStoreWithEqualityFn(o,r,n)},useStoreApi:function(){var t=i(e);if(!t)throw new Error("Seems like you have not used zustand provider as an ancestor.");return u((function(){return r({},t)}),[t])}}}}));

@@ -5,4 +5,5 @@ (function (global, factory) {

(global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global.zustand = {}, global.zustandVanilla, global.React, global.useSyncExternalStoreShimWithSelector));
})(this, (function (exports, vanilla, react$1, useSyncExternalStoreExports) { 'use strict';
})(this, (function (exports, vanilla, ReactExports, useSyncExternalStoreExports) { 'use strict';
var useDebugValue = ReactExports.useDebugValue;
var useSyncExternalStoreWithSelector = useSyncExternalStoreExports.useSyncExternalStoreWithSelector;

@@ -19,3 +20,3 @@ var didWarnAboutEqualityFn = false;

var slice = useSyncExternalStoreWithSelector(api.subscribe, api.getState, api.getServerState || api.getState, selector, equalityFn);
react$1.useDebugValue(slice);
useDebugValue(slice);
return slice;

@@ -22,0 +23,0 @@ }

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

!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("zustand/vanilla"),require("react"),require("use-sync-external-store/shim/with-selector")):"function"==typeof define&&define.amd?define(["exports","zustand/vanilla","react","use-sync-external-store/shim/with-selector"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self).zustand={},e.zustandVanilla,e.React,e.useSyncExternalStoreShimWithSelector)}(this,(function(e,t,r,n){"use strict";var u=n.useSyncExternalStoreWithSelector;function o(e,t,n){void 0===t&&(t=e.getState);var o=u(e.subscribe,e.getState,e.getServerState||e.getState,t,n);return r.useDebugValue(o),o}var a=function(e){var r="function"==typeof e?t.createStore(e):e,n=function(e,t){return o(r,e,t)};return Object.assign(n,r),n},i=function(e){return e?a(e):a};e.create=i,e.default=function(e){return i(e)},e.useStore=o,Object.keys(t).forEach((function(r){"default"===r||Object.prototype.hasOwnProperty.call(e,r)||Object.defineProperty(e,r,{enumerable:!0,get:function(){return t[r]}})})),Object.defineProperty(e,"__esModule",{value:!0})}));
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("zustand/vanilla"),require("react"),require("use-sync-external-store/shim/with-selector")):"function"==typeof define&&define.amd?define(["exports","zustand/vanilla","react","use-sync-external-store/shim/with-selector"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self).zustand={},e.zustandVanilla,e.React,e.useSyncExternalStoreShimWithSelector)}(this,(function(e,t,r,n){"use strict";var u=r.useDebugValue,o=n.useSyncExternalStoreWithSelector;function a(e,t,r){void 0===t&&(t=e.getState);var n=o(e.subscribe,e.getState,e.getServerState||e.getState,t,r);return u(n),n}var i=function(e){var r="function"==typeof e?t.createStore(e):e,n=function(e,t){return a(r,e,t)};return Object.assign(n,r),n},c=function(e){return e?i(e):i};e.create=c,e.default=function(e){return c(e)},e.useStore=a,Object.keys(t).forEach((function(r){"default"===r||Object.prototype.hasOwnProperty.call(e,r)||Object.defineProperty(e,r,{enumerable:!0,get:function(){return t[r]}})})),Object.defineProperty(e,"__esModule",{value:!0})}));

@@ -5,3 +5,3 @@ (function (global, factory) {

(global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global.zustandReactShallow = {}, global.React));
})(this, (function (exports, react) { 'use strict';
})(this, (function (exports, ReactExports) { 'use strict';

@@ -81,4 +81,5 @@ function _unsupportedIterableToArray(o, minLen) {

var useRef = ReactExports.useRef;
function useShallow(selector) {
var prev = react.useRef();
var prev = useRef();
return function (state) {

@@ -85,0 +86,0 @@ var next = selector(state);

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

!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("react")):"function"==typeof define&&define.amd?define(["exports","react"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self).zustandReactShallow={},e.React)}(this,(function(e,t){"use strict";function r(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}function n(e,t){var n="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(n)return(n=n.call(e)).next.bind(n);if(Array.isArray(e)||(n=function(e,t){if(e){if("string"==typeof e)return r(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?r(e,t):void 0}}(e))||t&&e&&"number"==typeof e.length){n&&(e=n);var o=0;return function(){return o>=e.length?{done:!0}:{done:!1,value:e[o++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}e.useShallow=function(e){var r=t.useRef();return function(t){var o=e(t);return function(e,t){if(Object.is(e,t))return!0;if("object"!=typeof e||null===e||"object"!=typeof t||null===t)return!1;if(e instanceof Map&&t instanceof Map){if(e.size!==t.size)return!1;for(var r,o=n(e);!(r=o()).done;){var i=r.value,a=i[0],u=i[1];if(!Object.is(u,t.get(a)))return!1}return!0}if(e instanceof Set&&t instanceof Set){if(e.size!==t.size)return!1;for(var f,c=n(e);!(f=c()).done;){var l=f.value;if(!t.has(l))return!1}return!0}var s=Object.keys(e);if(s.length!==Object.keys(t).length)return!1;for(var y=0;y<s.length;y++)if(!Object.prototype.hasOwnProperty.call(t,s[y])||!Object.is(e[s[y]],t[s[y]]))return!1;return!0}(r.current,o)?r.current:r.current=o}}}));
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("react")):"function"==typeof define&&define.amd?define(["exports","react"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self).zustandReactShallow={},e.React)}(this,(function(e,t){"use strict";function r(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}function n(e,t){var n="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(n)return(n=n.call(e)).next.bind(n);if(Array.isArray(e)||(n=function(e,t){if(e){if("string"==typeof e)return r(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?r(e,t):void 0}}(e))||t&&e&&"number"==typeof e.length){n&&(e=n);var o=0;return function(){return o>=e.length?{done:!0}:{done:!1,value:e[o++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var o=t.useRef;e.useShallow=function(e){var t=o();return function(r){var o=e(r);return function(e,t){if(Object.is(e,t))return!0;if("object"!=typeof e||null===e||"object"!=typeof t||null===t)return!1;if(e instanceof Map&&t instanceof Map){if(e.size!==t.size)return!1;for(var r,o=n(e);!(r=o()).done;){var i=r.value,a=i[0],u=i[1];if(!Object.is(u,t.get(a)))return!1}return!0}if(e instanceof Set&&t instanceof Set){if(e.size!==t.size)return!1;for(var f,c=n(e);!(f=c()).done;){var l=f.value;if(!t.has(l))return!1}return!0}var s=Object.keys(e);if(s.length!==Object.keys(t).length)return!1;for(var y=0;y<s.length;y++)if(!Object.prototype.hasOwnProperty.call(t,s[y])||!Object.is(e[s[y]],t[s[y]]))return!1;return!0}(t.current,o)?t.current:t.current=o}}}));

@@ -5,4 +5,5 @@ (function (global, factory) {

(global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global.zustandTraditional = {}, global.React, global.useSyncExternalStoreShimWithSelector, global.zustandVanilla));
})(this, (function (exports, react, useSyncExternalStoreExports, vanilla) { 'use strict';
})(this, (function (exports, ReactExports, useSyncExternalStoreExports, vanilla) { 'use strict';
var useDebugValue = ReactExports.useDebugValue;
var useSyncExternalStoreWithSelector = useSyncExternalStoreExports.useSyncExternalStoreWithSelector;

@@ -14,3 +15,3 @@ function useStoreWithEqualityFn(api, selector, equalityFn) {

var slice = useSyncExternalStoreWithSelector(api.subscribe, api.getState, api.getServerState || api.getState, selector, equalityFn);
react.useDebugValue(slice);
useDebugValue(slice);
return slice;

@@ -17,0 +18,0 @@ }

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

!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("react"),require("use-sync-external-store/shim/with-selector"),require("zustand/vanilla")):"function"==typeof define&&define.amd?define(["exports","react","use-sync-external-store/shim/with-selector","zustand/vanilla"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self).zustandTraditional={},e.React,e.useSyncExternalStoreShimWithSelector,e.zustandVanilla)}(this,(function(e,t,n,r){"use strict";var i=n.useSyncExternalStoreWithSelector;function a(e,n,r){void 0===n&&(n=e.getState);var a=i(e.subscribe,e.getState,e.getServerState||e.getState,n,r);return t.useDebugValue(a),a}var u=function(e,t){var n=r.createStore(e),i=function(e,r){return void 0===r&&(r=t),a(n,e,r)};return Object.assign(i,n),i};e.createWithEqualityFn=function(e,t){return e?u(e,t):u},e.useStoreWithEqualityFn=a}));
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("react"),require("use-sync-external-store/shim/with-selector"),require("zustand/vanilla")):"function"==typeof define&&define.amd?define(["exports","react","use-sync-external-store/shim/with-selector","zustand/vanilla"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self).zustandTraditional={},e.React,e.useSyncExternalStoreShimWithSelector,e.zustandVanilla)}(this,(function(e,t,n,r){"use strict";var i=t.useDebugValue,a=n.useSyncExternalStoreWithSelector;function u(e,t,n){void 0===t&&(t=e.getState);var r=a(e.subscribe,e.getState,e.getServerState||e.getState,t,n);return i(r),r}var o=function(e,t){var n=r.createStore(e),i=function(e,r){return void 0===r&&(r=t),u(n,e,r)};return Object.assign(i,n),i};e.createWithEqualityFn=function(e,t){return e?o(e,t):o},e.useStoreWithEqualityFn=u}));

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