CoolFace
Apppublic

AK-21/Graphite-Industrial-Intelligence

sourceHugging Faceupdated 3mo agoView on Hugging Face
0likes
context.development.js74 linesDownload Raw Back to system
1System.register(['react', 'zustand/traditional'], (function (exports) {2  'use strict';3  var ReactExports, useStoreWithEqualityFn;4  return {5    setters: [function (module) {6      ReactExports = module.default;7    }, function (module) {8      useStoreWithEqualityFn = module.useStoreWithEqualityFn;9    }],10    execute: (function () {11 12      exports("default", createContext);13 14      const {15        createElement,16        createContext: reactCreateContext,17        useContext,18        useMemo,19        useRef20      } = ReactExports;21      function createContext() {22        {23          console.warn(24            "[DEPRECATED] `context` will be removed in a future version. Instead use `import { createStore, useStore } from 'zustand'`. See: https://github.com/pmndrs/zustand/discussions/1180."25          );26        }27        const ZustandContext = reactCreateContext(void 0);28        const Provider = ({29          createStore,30          children31        }) => {32          const storeRef = useRef();33          if (!storeRef.current) {34            storeRef.current = createStore();35          }36          return createElement(37            ZustandContext.Provider,38            { value: storeRef.current },39            children40          );41        };42        const useContextStore = (selector, equalityFn) => {43          const store = useContext(ZustandContext);44          if (!store) {45            throw new Error(46              "Seems like you have not used zustand provider as an ancestor."47            );48          }49          return useStoreWithEqualityFn(50            store,51            selector,52            equalityFn53          );54        };55        const useStoreApi = () => {56          const store = useContext(ZustandContext);57          if (!store) {58            throw new Error(59              "Seems like you have not used zustand provider as an ancestor."60            );61          }62          return useMemo(() => ({ ...store }), [store]);63        };64        return {65          Provider,66          useStore: useContextStore,67          useStoreApi68        };69      }70 71    })72  };73}));74