cross-state 0.31.0 → 0.31.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.
@@ -546,7 +546,7 @@ const reactMethods = {
546
546
  useStore: boundUseStore,
547
547
  useProp: boundUseProp
548
548
  };
549
- function useCache(cache, { passive, updateOnMount, withViewTransition, ...options } = {}) {
549
+ function useCache(cache, { passive, disabled, updateOnMount, withViewTransition, ...options } = {}) {
550
550
  if (withViewTransition === true) {
551
551
  withViewTransition = (state) => state.value;
552
552
  }
@@ -563,19 +563,37 @@ function useCache(cache, { passive, updateOnMount, withViewTransition, ...option
563
563
  };
564
564
  }
565
565
  return rootCache.state.map((state) => {
566
- const value = state.status === "value" ? selector(state.value) : void 0;
567
- return Object.assign(
568
- [value, state.error, state.isUpdating, state.isStale],
569
- { ...state, value }
570
- );
566
+ if (disabled) {
567
+ return Object.assign(
568
+ [void 0, void 0, false, false],
569
+ { status: "pending", isUpdating: false, isStale: false }
570
+ );
571
+ }
572
+ try {
573
+ const value = state.status === "value" ? selector(state.value) : void 0;
574
+ return Object.assign(
575
+ [value, state.error, state.isUpdating, state.isStale],
576
+ { ...state, value }
577
+ );
578
+ } catch (error) {
579
+ return Object.assign(
580
+ [void 0, error, state.isUpdating, state.isStale],
581
+ { status: "error", error, isUpdating: state.isUpdating, isStale: state.isStale }
582
+ );
583
+ }
571
584
  });
572
585
  }, [cache]);
573
- require$$0.useEffect(() => !passive ? cache.subscribe(() => void 0) : void 0, [cache, passive]);
574
586
  require$$0.useEffect(() => {
575
587
  if (updateOnMount) {
576
588
  cache.invalidate();
577
589
  }
578
590
  }, []);
591
+ require$$0.useEffect(() => {
592
+ if (passive || disabled) {
593
+ return;
594
+ }
595
+ return cache.subscribe(() => void 0);
596
+ }, [cache, passive, disabled]);
579
597
  return useStore(mappedState, { ...options, withViewTransition });
580
598
  }
581
599
  function getScopeContext(scope) {
@@ -1 +1 @@
1
- {"version":3,"file":"scope2.cjs","sources":["../../src/lib/trackingProxy.ts","../../node_modules/.pnpm/use-sync-external-store@1.2.0_react@18.2.0/node_modules/use-sync-external-store/cjs/use-sync-external-store-shim.development.js","../../node_modules/.pnpm/use-sync-external-store@1.2.0_react@18.2.0/node_modules/use-sync-external-store/cjs/use-sync-external-store-shim.production.min.js","../../node_modules/.pnpm/use-sync-external-store@1.2.0_react@18.2.0/node_modules/use-sync-external-store/shim/index.js","../../node_modules/.pnpm/use-sync-external-store@1.2.0_react@18.2.0/node_modules/use-sync-external-store/cjs/use-sync-external-store-shim/with-selector.development.js","../../node_modules/.pnpm/use-sync-external-store@1.2.0_react@18.2.0/node_modules/use-sync-external-store/cjs/use-sync-external-store-shim/with-selector.production.min.js","../../node_modules/.pnpm/use-sync-external-store@1.2.0_react@18.2.0/node_modules/use-sync-external-store/shim/with-selector.js","../../src/react/useStore.ts","../../src/react/useProp.ts","../../src/react/reactMethods.ts","../../src/react/useCache.ts","../../src/react/scope.tsx"],"sourcesContent":["import { deepEqual } from './equals';\n\nconst unwrapProxySymbol = /* @__PURE__ */ Symbol('unwrapProxy');\n\nexport type TrackingProxy<T> = [value: T, equals: (newValue: T) => boolean, revoke?: () => void];\ntype Object_ = Record<string | symbol, unknown>;\n\nfunction isPlainObject(value: unknown) {\n return (\n typeof value === 'object' && value !== null && Object.getPrototypeOf(value) === Object.prototype\n );\n}\n\nexport function trackingProxy<T>(value: T, equals = deepEqual): TrackingProxy<T> {\n if (!isPlainObject(value) && !Array.isArray(value)) {\n return [value, (other) => equals(value, other)];\n }\n\n // Unpack proxies, we don't want to nest them\n value = (value as any)[unwrapProxySymbol] ?? value;\n\n const deps = new Array<TrackingProxy<any>[1]>();\n const revokations = new Array<() => void>();\n let revoked = false;\n\n function trackComplexProp(function_: any, ...args: any[]) {\n const [proxiedValue, equals, revoke] = trackingProxy(function_(value, ...args));\n\n deps.push((otherValue) => {\n if (!isPlainObject(otherValue) && !Array.isArray(otherValue)) {\n return false;\n }\n\n return equals(function_(otherValue, ...args));\n });\n\n if (revoke) {\n revokations.push(revoke);\n }\n\n return proxiedValue;\n }\n\n function trackSimpleProp(function_: any, ...args: any[]) {\n const calculatedValue = function_(value, ...args);\n\n deps.push((otherValue) => {\n return function_(otherValue, ...args) === calculatedValue;\n });\n\n return calculatedValue;\n }\n\n const proxy = new Proxy(value as T & Object_, {\n get(target, p, receiver) {\n if (p === unwrapProxySymbol) {\n return value;\n }\n\n if (revoked) {\n return target[p];\n }\n\n const { writable, configurable } = Object.getOwnPropertyDescriptor(target, p) ?? {};\n if (writable === false && configurable === false) {\n return target[p];\n }\n\n return trackComplexProp(Reflect.get, p, receiver);\n },\n\n getOwnPropertyDescriptor(target, p) {\n const { writable, configurable } = Object.getOwnPropertyDescriptor(target, p) ?? {};\n if (writable === false && configurable === false) {\n return Reflect.getOwnPropertyDescriptor(target, p);\n }\n\n return trackComplexProp(Reflect.getOwnPropertyDescriptor, p);\n },\n\n ownKeys() {\n return trackComplexProp(Reflect.ownKeys);\n },\n\n getPrototypeOf() {\n return trackSimpleProp(Reflect.getPrototypeOf);\n },\n\n has(_target, p) {\n return trackSimpleProp(Reflect.has, p);\n },\n\n isExtensible() {\n return trackSimpleProp(Reflect.isExtensible);\n },\n });\n\n return [\n proxy,\n (other) => !!other && deps.every((equals) => equals(other)),\n () => {\n revoked = true;\n revokations.forEach((revoke) => revoke());\n },\n ];\n}\n","/**\n * @license React\n * use-sync-external-store-shim.development.js\n *\n * Copyright (c) Facebook, Inc. and its affiliates.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n */\n\n'use strict';\n\nif (process.env.NODE_ENV !== \"production\") {\n (function() {\n\n 'use strict';\n\n/* global __REACT_DEVTOOLS_GLOBAL_HOOK__ */\nif (\n typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ !== 'undefined' &&\n typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart ===\n 'function'\n) {\n __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart(new Error());\n}\n var React = require('react');\n\nvar ReactSharedInternals = React.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;\n\nfunction error(format) {\n {\n {\n for (var _len2 = arguments.length, args = new Array(_len2 > 1 ? _len2 - 1 : 0), _key2 = 1; _key2 < _len2; _key2++) {\n args[_key2 - 1] = arguments[_key2];\n }\n\n printWarning('error', format, args);\n }\n }\n}\n\nfunction printWarning(level, format, args) {\n // When changing this logic, you might want to also\n // update consoleWithStackDev.www.js as well.\n {\n var ReactDebugCurrentFrame = ReactSharedInternals.ReactDebugCurrentFrame;\n var stack = ReactDebugCurrentFrame.getStackAddendum();\n\n if (stack !== '') {\n format += '%s';\n args = args.concat([stack]);\n } // eslint-disable-next-line react-internal/safe-string-coercion\n\n\n var argsWithFormat = args.map(function (item) {\n return String(item);\n }); // Careful: RN currently depends on this prefix\n\n argsWithFormat.unshift('Warning: ' + format); // We intentionally don't use spread (or .apply) directly because it\n // breaks IE9: https://github.com/facebook/react/issues/13610\n // eslint-disable-next-line react-internal/no-production-logging\n\n Function.prototype.apply.call(console[level], console, argsWithFormat);\n }\n}\n\n/**\n * inlined Object.is polyfill to avoid requiring consumers ship their own\n * https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/is\n */\nfunction is(x, y) {\n return x === y && (x !== 0 || 1 / x === 1 / y) || x !== x && y !== y // eslint-disable-line no-self-compare\n ;\n}\n\nvar objectIs = typeof Object.is === 'function' ? Object.is : is;\n\n// dispatch for CommonJS interop named imports.\n\nvar useState = React.useState,\n useEffect = React.useEffect,\n useLayoutEffect = React.useLayoutEffect,\n useDebugValue = React.useDebugValue;\nvar didWarnOld18Alpha = false;\nvar didWarnUncachedGetSnapshot = false; // Disclaimer: This shim breaks many of the rules of React, and only works\n// because of a very particular set of implementation details and assumptions\n// -- change any one of them and it will break. The most important assumption\n// is that updates are always synchronous, because concurrent rendering is\n// only available in versions of React that also have a built-in\n// useSyncExternalStore API. And we only use this shim when the built-in API\n// does not exist.\n//\n// Do not assume that the clever hacks used by this hook also work in general.\n// The point of this shim is to replace the need for hacks by other libraries.\n\nfunction useSyncExternalStore(subscribe, getSnapshot, // Note: The shim does not use getServerSnapshot, because pre-18 versions of\n// React do not expose a way to check if we're hydrating. So users of the shim\n// will need to track that themselves and return the correct value\n// from `getSnapshot`.\ngetServerSnapshot) {\n {\n if (!didWarnOld18Alpha) {\n if (React.startTransition !== undefined) {\n didWarnOld18Alpha = true;\n\n error('You are using an outdated, pre-release alpha of React 18 that ' + 'does not support useSyncExternalStore. The ' + 'use-sync-external-store shim will not work correctly. Upgrade ' + 'to a newer pre-release.');\n }\n }\n } // Read the current snapshot from the store on every render. Again, this\n // breaks the rules of React, and only works here because of specific\n // implementation details, most importantly that updates are\n // always synchronous.\n\n\n var value = getSnapshot();\n\n {\n if (!didWarnUncachedGetSnapshot) {\n var cachedValue = getSnapshot();\n\n if (!objectIs(value, cachedValue)) {\n error('The result of getSnapshot should be cached to avoid an infinite loop');\n\n didWarnUncachedGetSnapshot = true;\n }\n }\n } // Because updates are synchronous, we don't queue them. Instead we force a\n // re-render whenever the subscribed state changes by updating an some\n // arbitrary useState hook. Then, during render, we call getSnapshot to read\n // the current value.\n //\n // Because we don't actually use the state returned by the useState hook, we\n // can save a bit of memory by storing other stuff in that slot.\n //\n // To implement the early bailout, we need to track some things on a mutable\n // object. Usually, we would put that in a useRef hook, but we can stash it in\n // our useState hook instead.\n //\n // To force a re-render, we call forceUpdate({inst}). That works because the\n // new object always fails an equality check.\n\n\n var _useState = useState({\n inst: {\n value: value,\n getSnapshot: getSnapshot\n }\n }),\n inst = _useState[0].inst,\n forceUpdate = _useState[1]; // Track the latest getSnapshot function with a ref. This needs to be updated\n // in the layout phase so we can access it during the tearing check that\n // happens on subscribe.\n\n\n useLayoutEffect(function () {\n inst.value = value;\n inst.getSnapshot = getSnapshot; // Whenever getSnapshot or subscribe changes, we need to check in the\n // commit phase if there was an interleaved mutation. In concurrent mode\n // this can happen all the time, but even in synchronous mode, an earlier\n // effect may have mutated the store.\n\n if (checkIfSnapshotChanged(inst)) {\n // Force a re-render.\n forceUpdate({\n inst: inst\n });\n }\n }, [subscribe, value, getSnapshot]);\n useEffect(function () {\n // Check for changes right before subscribing. Subsequent changes will be\n // detected in the subscription handler.\n if (checkIfSnapshotChanged(inst)) {\n // Force a re-render.\n forceUpdate({\n inst: inst\n });\n }\n\n var handleStoreChange = function () {\n // TODO: Because there is no cross-renderer API for batching updates, it's\n // up to the consumer of this library to wrap their subscription event\n // with unstable_batchedUpdates. Should we try to detect when this isn't\n // the case and print a warning in development?\n // The store changed. Check if the snapshot changed since the last time we\n // read from the store.\n if (checkIfSnapshotChanged(inst)) {\n // Force a re-render.\n forceUpdate({\n inst: inst\n });\n }\n }; // Subscribe to the store and return a clean-up function.\n\n\n return subscribe(handleStoreChange);\n }, [subscribe]);\n useDebugValue(value);\n return value;\n}\n\nfunction checkIfSnapshotChanged(inst) {\n var latestGetSnapshot = inst.getSnapshot;\n var prevValue = inst.value;\n\n try {\n var nextValue = latestGetSnapshot();\n return !objectIs(prevValue, nextValue);\n } catch (error) {\n return true;\n }\n}\n\nfunction useSyncExternalStore$1(subscribe, getSnapshot, getServerSnapshot) {\n // Note: The shim does not use getServerSnapshot, because pre-18 versions of\n // React do not expose a way to check if we're hydrating. So users of the shim\n // will need to track that themselves and return the correct value\n // from `getSnapshot`.\n return getSnapshot();\n}\n\nvar canUseDOM = !!(typeof window !== 'undefined' && typeof window.document !== 'undefined' && typeof window.document.createElement !== 'undefined');\n\nvar isServerEnvironment = !canUseDOM;\n\nvar shim = isServerEnvironment ? useSyncExternalStore$1 : useSyncExternalStore;\nvar useSyncExternalStore$2 = React.useSyncExternalStore !== undefined ? React.useSyncExternalStore : shim;\n\nexports.useSyncExternalStore = useSyncExternalStore$2;\n /* global __REACT_DEVTOOLS_GLOBAL_HOOK__ */\nif (\n typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ !== 'undefined' &&\n typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop ===\n 'function'\n) {\n __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop(new Error());\n}\n \n })();\n}\n","/**\n * @license React\n * use-sync-external-store-shim.production.min.js\n *\n * Copyright (c) Facebook, Inc. and its affiliates.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n */\n'use strict';var e=require(\"react\");function h(a,b){return a===b&&(0!==a||1/a===1/b)||a!==a&&b!==b}var k=\"function\"===typeof Object.is?Object.is:h,l=e.useState,m=e.useEffect,n=e.useLayoutEffect,p=e.useDebugValue;function q(a,b){var d=b(),f=l({inst:{value:d,getSnapshot:b}}),c=f[0].inst,g=f[1];n(function(){c.value=d;c.getSnapshot=b;r(c)&&g({inst:c})},[a,d,b]);m(function(){r(c)&&g({inst:c});return a(function(){r(c)&&g({inst:c})})},[a]);p(d);return d}\nfunction r(a){var b=a.getSnapshot;a=a.value;try{var d=b();return!k(a,d)}catch(f){return!0}}function t(a,b){return b()}var u=\"undefined\"===typeof window||\"undefined\"===typeof window.document||\"undefined\"===typeof window.document.createElement?t:q;exports.useSyncExternalStore=void 0!==e.useSyncExternalStore?e.useSyncExternalStore:u;\n","'use strict';\n\nif (process.env.NODE_ENV === 'production') {\n module.exports = require('../cjs/use-sync-external-store-shim.production.min.js');\n} else {\n module.exports = require('../cjs/use-sync-external-store-shim.development.js');\n}\n","/**\n * @license React\n * use-sync-external-store-shim/with-selector.development.js\n *\n * Copyright (c) Facebook, Inc. and its affiliates.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n */\n\n'use strict';\n\nif (process.env.NODE_ENV !== \"production\") {\n (function() {\n\n 'use strict';\n\n/* global __REACT_DEVTOOLS_GLOBAL_HOOK__ */\nif (\n typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ !== 'undefined' &&\n typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart ===\n 'function'\n) {\n __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart(new Error());\n}\n var React = require('react');\nvar shim = require('use-sync-external-store/shim');\n\n/**\n * inlined Object.is polyfill to avoid requiring consumers ship their own\n * https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/is\n */\nfunction is(x, y) {\n return x === y && (x !== 0 || 1 / x === 1 / y) || x !== x && y !== y // eslint-disable-line no-self-compare\n ;\n}\n\nvar objectIs = typeof Object.is === 'function' ? Object.is : is;\n\nvar useSyncExternalStore = shim.useSyncExternalStore;\n\n// for CommonJS interop.\n\nvar useRef = React.useRef,\n useEffect = React.useEffect,\n useMemo = React.useMemo,\n useDebugValue = React.useDebugValue; // Same as useSyncExternalStore, but supports selector and isEqual arguments.\n\nfunction useSyncExternalStoreWithSelector(subscribe, getSnapshot, getServerSnapshot, selector, isEqual) {\n // Use this to track the rendered snapshot.\n var instRef = useRef(null);\n var inst;\n\n if (instRef.current === null) {\n inst = {\n hasValue: false,\n value: null\n };\n instRef.current = inst;\n } else {\n inst = instRef.current;\n }\n\n var _useMemo = useMemo(function () {\n // Track the memoized state using closure variables that are local to this\n // memoized instance of a getSnapshot function. Intentionally not using a\n // useRef hook, because that state would be shared across all concurrent\n // copies of the hook/component.\n var hasMemo = false;\n var memoizedSnapshot;\n var memoizedSelection;\n\n var memoizedSelector = function (nextSnapshot) {\n if (!hasMemo) {\n // The first time the hook is called, there is no memoized result.\n hasMemo = true;\n memoizedSnapshot = nextSnapshot;\n\n var _nextSelection = selector(nextSnapshot);\n\n if (isEqual !== undefined) {\n // Even if the selector has changed, the currently rendered selection\n // may be equal to the new selection. We should attempt to reuse the\n // current value if possible, to preserve downstream memoizations.\n if (inst.hasValue) {\n var currentSelection = inst.value;\n\n if (isEqual(currentSelection, _nextSelection)) {\n memoizedSelection = currentSelection;\n return currentSelection;\n }\n }\n }\n\n memoizedSelection = _nextSelection;\n return _nextSelection;\n } // We may be able to reuse the previous invocation's result.\n\n\n // We may be able to reuse the previous invocation's result.\n var prevSnapshot = memoizedSnapshot;\n var prevSelection = memoizedSelection;\n\n if (objectIs(prevSnapshot, nextSnapshot)) {\n // The snapshot is the same as last time. Reuse the previous selection.\n return prevSelection;\n } // The snapshot has changed, so we need to compute a new selection.\n\n\n // The snapshot has changed, so we need to compute a new selection.\n var nextSelection = selector(nextSnapshot); // If a custom isEqual function is provided, use that to check if the data\n // has changed. If it hasn't, return the previous selection. That signals\n // to React that the selections are conceptually equal, and we can bail\n // out of rendering.\n\n // If a custom isEqual function is provided, use that to check if the data\n // has changed. If it hasn't, return the previous selection. That signals\n // to React that the selections are conceptually equal, and we can bail\n // out of rendering.\n if (isEqual !== undefined && isEqual(prevSelection, nextSelection)) {\n return prevSelection;\n }\n\n memoizedSnapshot = nextSnapshot;\n memoizedSelection = nextSelection;\n return nextSelection;\n }; // Assigning this to a constant so that Flow knows it can't change.\n\n\n // Assigning this to a constant so that Flow knows it can't change.\n var maybeGetServerSnapshot = getServerSnapshot === undefined ? null : getServerSnapshot;\n\n var getSnapshotWithSelector = function () {\n return memoizedSelector(getSnapshot());\n };\n\n var getServerSnapshotWithSelector = maybeGetServerSnapshot === null ? undefined : function () {\n return memoizedSelector(maybeGetServerSnapshot());\n };\n return [getSnapshotWithSelector, getServerSnapshotWithSelector];\n }, [getSnapshot, getServerSnapshot, selector, isEqual]),\n getSelection = _useMemo[0],\n getServerSelection = _useMemo[1];\n\n var value = useSyncExternalStore(subscribe, getSelection, getServerSelection);\n useEffect(function () {\n inst.hasValue = true;\n inst.value = value;\n }, [value]);\n useDebugValue(value);\n return value;\n}\n\nexports.useSyncExternalStoreWithSelector = useSyncExternalStoreWithSelector;\n /* global __REACT_DEVTOOLS_GLOBAL_HOOK__ */\nif (\n typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ !== 'undefined' &&\n typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop ===\n 'function'\n) {\n __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop(new Error());\n}\n \n })();\n}\n","/**\n * @license React\n * use-sync-external-store-shim/with-selector.production.min.js\n *\n * Copyright (c) Facebook, Inc. and its affiliates.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n */\n'use strict';var h=require(\"react\"),n=require(\"use-sync-external-store/shim\");function p(a,b){return a===b&&(0!==a||1/a===1/b)||a!==a&&b!==b}var q=\"function\"===typeof Object.is?Object.is:p,r=n.useSyncExternalStore,t=h.useRef,u=h.useEffect,v=h.useMemo,w=h.useDebugValue;\nexports.useSyncExternalStoreWithSelector=function(a,b,e,l,g){var c=t(null);if(null===c.current){var f={hasValue:!1,value:null};c.current=f}else f=c.current;c=v(function(){function a(a){if(!c){c=!0;d=a;a=l(a);if(void 0!==g&&f.hasValue){var b=f.value;if(g(b,a))return k=b}return k=a}b=k;if(q(d,a))return b;var e=l(a);if(void 0!==g&&g(b,e))return b;d=a;return k=e}var c=!1,d,k,m=void 0===e?null:e;return[function(){return a(b())},null===m?void 0:function(){return a(m())}]},[b,e,l,g]);var d=r(a,c[0],c[1]);\nu(function(){f.hasValue=!0;f.value=d},[d]);w(d);return d};\n","'use strict';\n\nif (process.env.NODE_ENV === 'production') {\n module.exports = require('../cjs/use-sync-external-store-shim/with-selector.production.min.js');\n} else {\n module.exports = require('../cjs/use-sync-external-store-shim/with-selector.development.js');\n}\n","import type { Selector, SubscribeOptions } from '@core/commonTypes';\nimport type { Store } from '@core/store';\nimport { deepEqual } from '@lib/equals';\nimport { hash } from '@lib/hash';\nimport { makeSelector } from '@lib/makeSelector';\nimport { type Path, type Value } from '@lib/path';\nimport { trackingProxy } from '@lib/trackingProxy';\nimport { useCallback, useDebugValue, useLayoutEffect, useMemo, useRef } from 'react';\nimport { useSyncExternalStoreWithSelector } from 'use-sync-external-store/shim/with-selector.js';\n\nexport interface UseStoreOptions<S> extends Omit<SubscribeOptions, 'runNow' | 'passive'> {\n disableTrackingProxy?: boolean;\n withViewTransition?: boolean | ((value: S) => unknown);\n}\n\nexport function useStore<T, S>(\n store: Store<T>,\n selector: Selector<T, S>,\n option?: UseStoreOptions<S>,\n): S;\n\nexport function useStore<T, P extends Path<T>>(\n store: Store<T>,\n selector: P,\n option?: UseStoreOptions<Value<T, P>>,\n): Value<T, P>;\n\nexport function useStore<T>(store: Store<T>, option?: UseStoreOptions<T>): T;\n\nexport function useStore<T, S>(store: Store<T>, argument1?: any, argument2?: any): S {\n const selector = makeSelector<T, S>(\n typeof argument1 === 'function' || typeof argument1 === 'string' ? argument1 : undefined,\n );\n const {\n disableTrackingProxy = true,\n equals = deepEqual,\n withViewTransition,\n ...options\n } = (typeof argument1 === 'object' ? argument1 : argument2 ?? {}) as UseStoreOptions<S>;\n\n const lastEqualsRef = useRef<(newValue: S) => boolean>();\n\n const { rootStore, mappingSelector } = useMemo(() => {\n const rootStore = store.derivedFrom?.store ?? store;\n let mappingSelector = (x: any) => x;\n\n if (store.derivedFrom) {\n mappingSelector = (value: any) => {\n for (const s of store.derivedFrom!.selectors) {\n value = makeSelector(s)(value);\n }\n return value;\n };\n }\n\n return { rootStore, mappingSelector };\n }, [store]);\n\n const subOptions = { ...options, runNow: false, passive: false };\n const subscribe = useCallback(\n (listener: () => void) => {\n let _listener: (value: any) => void = listener;\n\n if (withViewTransition && (document as any).startViewTransition) {\n let lastObservedValue: any;\n\n _listener = (value: any) => {\n const observedValue =\n withViewTransition instanceof Function ? withViewTransition(value) : value;\n\n if (equals(lastObservedValue, observedValue)) {\n listener();\n return;\n }\n\n lastObservedValue = observedValue;\n\n let hasChanges = false;\n const mutationObserver = new MutationObserver(() => {\n hasChanges = true;\n mutationObserver.disconnect();\n });\n mutationObserver.observe(document.body, { childList: true, subtree: true });\n\n (document as any).startViewTransition(() => {\n listener();\n\n if (!hasChanges) {\n throw new Error('no change');\n }\n });\n };\n }\n\n return rootStore.subscribe(_listener, subOptions);\n },\n [rootStore, hash(subOptions)],\n );\n\n let value = useSyncExternalStoreWithSelector<unknown, S>(\n //\n subscribe,\n rootStore.get,\n undefined,\n (x) => selector(mappingSelector(x)),\n (_v, newValue) => lastEqualsRef.current?.(newValue) ?? false,\n );\n let lastEquals = (newValue: S) => equals(newValue, value);\n let revoke: (() => void) | undefined;\n\n if (!disableTrackingProxy) {\n [value, lastEquals, revoke] = trackingProxy(value, equals);\n }\n\n useLayoutEffect(() => {\n lastEqualsRef.current = lastEquals;\n revoke?.();\n });\n\n useDebugValue(value);\n return value;\n}\n","import type { UseStoreOptions } from './useStore';\nimport { useStore } from './useStore';\nimport { type Selector, type Update } from '@core/commonTypes';\nimport type { Store } from '@core/store';\nimport { type Path, type Value } from '@lib/path';\n\nexport function useProp<T, S>(\n store: Store<T>,\n selector: Selector<T, S>,\n updater: (value: S) => Update<T>,\n options?: UseStoreOptions<S>,\n): [value: S, setValue: Store<S>['set']];\n\nexport function useProp<T, P extends Path<T>>(\n store: Store<T>,\n selector: P,\n options?: UseStoreOptions<Value<T, P>>,\n): [value: Value<T, P>, setValue: Store<Value<T, P>>['set']];\n\nexport function useProp<T>(\n store: Store<T>,\n options?: UseStoreOptions<T>,\n): [value: T, setValue: Store<T>['set']];\n\nexport function useProp<T, S>(\n store: Store<T>,\n argument1?: any,\n argument2?: any,\n argument3?: any,\n): [value: S, setValue: Store<S>['set']] {\n const selector =\n typeof argument1 === 'function' || typeof argument1 === 'string' ? argument1 : undefined;\n const updater = typeof argument2 === 'function' ? argument2 : undefined;\n const options =\n typeof argument1 === 'object'\n ? argument1\n : typeof argument2 === 'object'\n ? argument2\n : argument3;\n\n if (selector) {\n store = store.map(selector, updater);\n }\n\n const value = useStore(store, options) as S;\n return [value, store.set as Store<S>['set']];\n}\n","import type { Selector, Update } from '@core/commonTypes';\nimport type { Store } from '@core/store';\nimport type { Path, Value } from '@lib/path';\nimport { useProp } from './useProp';\nimport { useStore, type UseStoreOptions } from './useStore';\n\nfunction boundUseStore<T, S>(\n this: Store<T>,\n selector: Selector<T, S>,\n option?: UseStoreOptions<S>,\n): S;\nfunction boundUseStore<T, P extends Path<T>>(\n this: Store<T>,\n selector: P,\n option?: UseStoreOptions<Value<T, P>>,\n): Value<T, P>;\nfunction boundUseStore<T>(this: Store<T>, option?: UseStoreOptions<T>): T;\nfunction boundUseStore(this: Store<any>, ...args: any[]) {\n return useStore(this, ...args);\n}\n\nfunction boundUseProp<T, S>(\n this: Store<T>,\n selector: Selector<T, S>,\n updater: (value: S) => Update<T>,\n options?: UseStoreOptions<S>,\n): [value: S, setValue: Store<S>['set']];\nfunction boundUseProp<T, P extends Path<T>>(\n this: Store<T>,\n selector: P,\n options?: UseStoreOptions<Value<T, P>>,\n): [value: Value<T, P>, setValue: Store<Value<T, P>>['set']];\nfunction boundUseProp<T>(\n this: Store<T>,\n options?: UseStoreOptions<T>,\n): [value: T, setValue: Store<T>['set']];\nfunction boundUseProp(this: Store<any>, ...args: any[]) {\n return useProp(this, ...args);\n}\n\nexport const reactMethods = {\n useStore: boundUseStore,\n useProp: boundUseProp,\n};\n","import type { Cache } from '@core';\nimport type { CacheState } from '@lib/cacheState';\nimport { makeSelector } from '@lib/makeSelector';\nimport { useEffect, useMemo } from 'react';\nimport type { UseStoreOptions } from './useStore';\nimport { useStore } from './useStore';\n\nexport type UseCacheArray<T> = [\n value: T | undefined,\n error: unknown | undefined,\n isUpdating: boolean,\n isStale: boolean,\n];\n\nexport type UseCacheValue<T> = UseCacheArray<T> & CacheState<T>;\n\nexport interface UseCacheOptions<T> extends UseStoreOptions<UseCacheArray<T> & CacheState<T>> {\n passive?: boolean;\n updateOnMount?: boolean;\n}\n\nexport function useCache<T>(\n cache: Cache<T>,\n { passive, updateOnMount, withViewTransition, ...options }: UseCacheOptions<T> = {},\n): UseCacheValue<T> {\n if (withViewTransition === true) {\n withViewTransition = (state) => state.value;\n }\n\n const mappedState = useMemo(() => {\n const rootCache: Cache<any> = cache.derivedFromCache?.cache ?? cache;\n let selector = (x: any) => x;\n\n if (cache.derivedFromCache) {\n selector = (value: any) => {\n for (const s of cache.derivedFromCache!.selectors) {\n value = makeSelector(s)(value);\n }\n return value;\n };\n }\n\n return rootCache.state.map((state) => {\n const value = state.status === 'value' ? selector(state.value) : undefined;\n\n return Object.assign<UseCacheArray<T>, CacheState<T>>(\n [value, state.error, state.isUpdating, state.isStale],\n { ...state, value },\n );\n });\n }, [cache]);\n\n useEffect(() => (!passive ? cache.subscribe(() => undefined) : undefined), [cache, passive]);\n\n useEffect(() => {\n if (updateOnMount) {\n cache.invalidate();\n }\n }, []);\n\n return useStore(mappedState, { ...options, withViewTransition });\n}\n","import type { Context, ReactNode } from 'react';\nimport { createContext, useContext, useMemo } from 'react';\nimport { useProp } from './useProp';\nimport { useStore, type UseStoreOptions } from './useStore';\nimport { createStore } from '@core/store';\nimport type { Store } from '@core/store';\nimport type { Scope } from '@core';\n\nexport type ScopeProps<T> = { scope: Scope<T>; store?: Store<T>; children?: ReactNode };\n\ndeclare module '@core' {\n interface Scope<T> {\n context?: Context<Store<T>>;\n }\n}\n\nfunction getScopeContext<T>(scope: Scope<T>): Context<Store<T>> {\n scope.context ??= createContext<Store<T>>(createStore(scope.defaultValue));\n return scope.context;\n}\n\nexport function ScopeProvider<T>({ scope, store: inputStore, children }: ScopeProps<T>) {\n const context = getScopeContext(scope);\n const currentStore = useMemo(\n () => inputStore ?? createStore(scope.defaultValue),\n [scope, inputStore],\n );\n\n return <context.Provider value={currentStore}>{children}</context.Provider>;\n}\n\nexport function useScope<T>(scope: Scope<T>): Store<T> {\n const context = getScopeContext(scope);\n return useContext(context);\n}\n\nexport function useScopeStore<T>(scope: Scope<T>, options?: UseStoreOptions<T>): T {\n const store = useScope(scope);\n return useStore(store, options);\n}\n\nexport function useScopeProp<T>(scope: Scope<T>, options?: UseStoreOptions<T>) {\n const store = useScope(scope);\n return useProp(store, options);\n}\n"],"names":["deepEqual","equals","error","shim","shimModule","require$$1","require$$0","a","c","d","b","e","withSelectorModule","store","makeSelector","useRef","useMemo","rootStore","mappingSelector","value","useCallback","hash","useSyncExternalStoreWithSelector","useLayoutEffect","useDebugValue","useEffect","createContext","createStore","useContext"],"mappings":";;;;;AAEA,MAAM,2CAA2C,aAAa;AAK9D,SAAS,cAAc,OAAgB;AAEnC,SAAA,OAAO,UAAU,YAAY,UAAU,QAAQ,OAAO,eAAe,KAAK,MAAM,OAAO;AAE3F;AAEgB,SAAA,cAAiB,OAAU,SAASA,iBAA6B;AAC3E,MAAA,CAAC,cAAc,KAAK,KAAK,CAAC,MAAM,QAAQ,KAAK,GAAG;AAClD,WAAO,CAAC,OAAO,CAAC,UAAU,OAAO,OAAO,KAAK,CAAC;AAAA,EAChD;AAGS,UAAA,MAAc,iBAAiB,KAAK;AAEvC,QAAA,OAAO,IAAI;AACX,QAAA,cAAc,IAAI;AACxB,MAAI,UAAU;AAEL,WAAA,iBAAiB,cAAmB,MAAa;AAClD,UAAA,CAAC,cAAcC,SAAQ,MAAM,IAAI,cAAc,UAAU,OAAO,GAAG,IAAI,CAAC;AAEzE,SAAA,KAAK,CAAC,eAAe;AACpB,UAAA,CAAC,cAAc,UAAU,KAAK,CAAC,MAAM,QAAQ,UAAU,GAAG;AACrD,eAAA;AAAA,MACT;AAEA,aAAOA,QAAO,UAAU,YAAY,GAAG,IAAI,CAAC;AAAA,IAAA,CAC7C;AAED,QAAI,QAAQ;AACV,kBAAY,KAAK,MAAM;AAAA,IACzB;AAEO,WAAA;AAAA,EACT;AAES,WAAA,gBAAgB,cAAmB,MAAa;AACvD,UAAM,kBAAkB,UAAU,OAAO,GAAG,IAAI;AAE3C,SAAA,KAAK,CAAC,eAAe;AACxB,aAAO,UAAU,YAAY,GAAG,IAAI,MAAM;AAAA,IAAA,CAC3C;AAEM,WAAA;AAAA,EACT;AAEM,QAAA,QAAQ,IAAI,MAAM,OAAsB;AAAA,IAC5C,IAAI,QAAQ,GAAG,UAAU;AACvB,UAAI,MAAM,mBAAmB;AACpB,eAAA;AAAA,MACT;AAEA,UAAI,SAAS;AACX,eAAO,OAAO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AU,MAAM,UAAU,MAAM,MAAS,IAAI,QAAY,CAAC,OAAO,OAAO,CAAC;AAE3FA,aAAAA,UAAU,MAAM;AACd,QAAI,eAAe;AACjB,YAAM,WAAW;AAAA,IACnB;AAAA,EACF,GAAG,CAAE,CAAA;AAEL,SAAO,SAAS,aAAa,EAAE,GAAG,SAAS,mBAAoB,CAAA;AACjE;AC7CA,SAAS,gBAAmB,OAAoC;AAC9D,QAAM,YAAN,MAAM,UAAYC,WAAA,cAAwBC,MAAY,YAAA,MAAM,YAAY,CAAC;AACzE,SAAO,MAAM;AACf;AAEO,SAAS,cAAiB,EAAE,OAAO,OAAO,YAAY,YAA2B;AAChF,QAAA,UAAU,gBAAgB,KAAK;AACrC,QAAM,eAAeX,WAAA;AAAA,IACnB,MAAM,cAAcW,MAAAA,YAAY,MAAM,YAAY;AAAA,IAClD,CAAC,OAAO,UAAU;AAAA,EAAA;AAGpB,wCAAQ,QAAQ,UAAR,EAAiB,OAAO,cAAe,SAAS,CAAA;AAC1D;AAEO,SAAS,SAAY,OAA2B;AAC/C,QAAA,UAAU,gBAAgB,KAAK;AACrC,SAAOC,WAAAA,WAAW,OAAO;AAC3B;AAEgB,SAAA,cAAiB,OAAiB,SAAiC;AAC3E,QAAAf,SAAQ,SAAS,KAAK;AACrB,SAAA,SAASA,QAAO,OAAO;AAChC;AAEgB,SAAA,aAAgB,OAAiB,SAA8B;AACvE,QAAAA,SAAQ,SAAS,KAAK;AACrB,SAAA,QAAQA,QAAO,OAAO;AAC/B;;;;;;;;;","x_google_ignoreList":[1,2,3,4,5,6]}
1
+ {"version":3,"file":"scope2.cjs","sources":["../../src/lib/trackingProxy.ts","../../node_modules/.pnpm/use-sync-external-store@1.2.0_react@18.2.0/node_modules/use-sync-external-store/cjs/use-sync-external-store-shim.development.js","../../node_modules/.pnpm/use-sync-external-store@1.2.0_react@18.2.0/node_modules/use-sync-external-store/cjs/use-sync-external-store-shim.production.min.js","../../node_modules/.pnpm/use-sync-external-store@1.2.0_react@18.2.0/node_modules/use-sync-external-store/shim/index.js","../../node_modules/.pnpm/use-sync-external-store@1.2.0_react@18.2.0/node_modules/use-sync-external-store/cjs/use-sync-external-store-shim/with-selector.development.js","../../node_modules/.pnpm/use-sync-external-store@1.2.0_react@18.2.0/node_modules/use-sync-external-store/cjs/use-sync-external-store-shim/with-selector.production.min.js","../../node_modules/.pnpm/use-sync-external-store@1.2.0_react@18.2.0/node_modules/use-sync-external-store/shim/with-selector.js","../../src/react/useStore.ts","../../src/react/useProp.ts","../../src/react/reactMethods.ts","../../src/react/useCache.ts","../../src/react/scope.tsx"],"sourcesContent":["import { deepEqual } from './equals';\n\nconst unwrapProxySymbol = /* @__PURE__ */ Symbol('unwrapProxy');\n\nexport type TrackingProxy<T> = [value: T, equals: (newValue: T) => boolean, revoke?: () => void];\ntype Object_ = Record<string | symbol, unknown>;\n\nfunction isPlainObject(value: unknown) {\n return (\n typeof value === 'object' && value !== null && Object.getPrototypeOf(value) === Object.prototype\n );\n}\n\nexport function trackingProxy<T>(value: T, equals = deepEqual): TrackingProxy<T> {\n if (!isPlainObject(value) && !Array.isArray(value)) {\n return [value, (other) => equals(value, other)];\n }\n\n // Unpack proxies, we don't want to nest them\n value = (value as any)[unwrapProxySymbol] ?? value;\n\n const deps = new Array<TrackingProxy<any>[1]>();\n const revokations = new Array<() => void>();\n let revoked = false;\n\n function trackComplexProp(function_: any, ...args: any[]) {\n const [proxiedValue, equals, revoke] = trackingProxy(function_(value, ...args));\n\n deps.push((otherValue) => {\n if (!isPlainObject(otherValue) && !Array.isArray(otherValue)) {\n return false;\n }\n\n return equals(function_(otherValue, ...args));\n });\n\n if (revoke) {\n revokations.push(revoke);\n }\n\n return proxiedValue;\n }\n\n function trackSimpleProp(function_: any, ...args: any[]) {\n const calculatedValue = function_(value, ...args);\n\n deps.push((otherValue) => {\n return function_(otherValue, ...args) === calculatedValue;\n });\n\n return calculatedValue;\n }\n\n const proxy = new Proxy(value as T & Object_, {\n get(target, p, receiver) {\n if (p === unwrapProxySymbol) {\n return value;\n }\n\n if (revoked) {\n return target[p];\n }\n\n const { writable, configurable } = Object.getOwnPropertyDescriptor(target, p) ?? {};\n if (writable === false && configurable === false) {\n return target[p];\n }\n\n return trackComplexProp(Reflect.get, p, receiver);\n },\n\n getOwnPropertyDescriptor(target, p) {\n const { writable, configurable } = Object.getOwnPropertyDescriptor(target, p) ?? {};\n if (writable === false && configurable === false) {\n return Reflect.getOwnPropertyDescriptor(target, p);\n }\n\n return trackComplexProp(Reflect.getOwnPropertyDescriptor, p);\n },\n\n ownKeys() {\n return trackComplexProp(Reflect.ownKeys);\n },\n\n getPrototypeOf() {\n return trackSimpleProp(Reflect.getPrototypeOf);\n },\n\n has(_target, p) {\n return trackSimpleProp(Reflect.has, p);\n },\n\n isExtensible() {\n return trackSimpleProp(Reflect.isExtensible);\n },\n });\n\n return [\n proxy,\n (other) => !!other && deps.every((equals) => equals(other)),\n () => {\n revoked = true;\n revokations.forEach((revoke) => revoke());\n },\n ];\n}\n","/**\n * @license React\n * use-sync-external-store-shim.development.js\n *\n * Copyright (c) Facebook, Inc. and its affiliates.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n */\n\n'use strict';\n\nif (process.env.NODE_ENV !== \"production\") {\n (function() {\n\n 'use strict';\n\n/* global __REACT_DEVTOOLS_GLOBAL_HOOK__ */\nif (\n typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ !== 'undefined' &&\n typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart ===\n 'function'\n) {\n __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart(new Error());\n}\n var React = require('react');\n\nvar ReactSharedInternals = React.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;\n\nfunction error(format) {\n {\n {\n for (var _len2 = arguments.length, args = new Array(_len2 > 1 ? _len2 - 1 : 0), _key2 = 1; _key2 < _len2; _key2++) {\n args[_key2 - 1] = arguments[_key2];\n }\n\n printWarning('error', format, args);\n }\n }\n}\n\nfunction printWarning(level, format, args) {\n // When changing this logic, you might want to also\n // update consoleWithStackDev.www.js as well.\n {\n var ReactDebugCurrentFrame = ReactSharedInternals.ReactDebugCurrentFrame;\n var stack = ReactDebugCurrentFrame.getStackAddendum();\n\n if (stack !== '') {\n format += '%s';\n args = args.concat([stack]);\n } // eslint-disable-next-line react-internal/safe-string-coercion\n\n\n var argsWithFormat = args.map(function (item) {\n return String(item);\n }); // Careful: RN currently depends on this prefix\n\n argsWithFormat.unshift('Warning: ' + format); // We intentionally don't use spread (or .apply) directly because it\n // breaks IE9: https://github.com/facebook/react/issues/13610\n // eslint-disable-next-line react-internal/no-production-logging\n\n Function.prototype.apply.call(console[level], console, argsWithFormat);\n }\n}\n\n/**\n * inlined Object.is polyfill to avoid requiring consumers ship their own\n * https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/is\n */\nfunction is(x, y) {\n return x === y && (x !== 0 || 1 / x === 1 / y) || x !== x && y !== y // eslint-disable-line no-self-compare\n ;\n}\n\nvar objectIs = typeof Object.is === 'function' ? Object.is : is;\n\n// dispatch for CommonJS interop named imports.\n\nvar useState = React.useState,\n useEffect = React.useEffect,\n useLayoutEffect = React.useLayoutEffect,\n useDebugValue = React.useDebugValue;\nvar didWarnOld18Alpha = false;\nvar didWarnUncachedGetSnapshot = false; // Disclaimer: This shim breaks many of the rules of React, and only works\n// because of a very particular set of implementation details and assumptions\n// -- change any one of them and it will break. The most important assumption\n// is that updates are always synchronous, because concurrent rendering is\n// only available in versions of React that also have a built-in\n// useSyncExternalStore API. And we only use this shim when the built-in API\n// does not exist.\n//\n// Do not assume that the clever hacks used by this hook also work in general.\n// The point of this shim is to replace the need for hacks by other libraries.\n\nfunction useSyncExternalStore(subscribe, getSnapshot, // Note: The shim does not use getServerSnapshot, because pre-18 versions of\n// React do not expose a way to check if we're hydrating. So users of the shim\n// will need to track that themselves and return the correct value\n// from `getSnapshot`.\ngetServerSnapshot) {\n {\n if (!didWarnOld18Alpha) {\n if (React.startTransition !== undefined) {\n didWarnOld18Alpha = true;\n\n error('You are using an outdated, pre-release alpha of React 18 that ' + 'does not support useSyncExternalStore. The ' + 'use-sync-external-store shim will not work correctly. Upgrade ' + 'to a newer pre-release.');\n }\n }\n } // Read the current snapshot from the store on every render. Again, this\n // breaks the rules of React, and only works here because of specific\n // implementation details, most importantly that updates are\n // always synchronous.\n\n\n var value = getSnapshot();\n\n {\n if (!didWarnUncachedGetSnapshot) {\n var cachedValue = getSnapshot();\n\n if (!objectIs(value, cachedValue)) {\n error('The result of getSnapshot should be cached to avoid an infinite loop');\n\n didWarnUncachedGetSnapshot = true;\n }\n }\n } // Because updates are synchronous, we don't queue them. Instead we force a\n // re-render whenever the subscribed state changes by updating an some\n // arbitrary useState hook. Then, during render, we call getSnapshot to read\n // the current value.\n //\n // Because we don't actually use the state returned by the useState hook, we\n // can save a bit of memory by storing other stuff in that slot.\n //\n // To implement the early bailout, we need to track some things on a mutable\n // object. Usually, we would put that in a useRef hook, but we can stash it in\n // our useState hook instead.\n //\n // To force a re-render, we call forceUpdate({inst}). That works because the\n // new object always fails an equality check.\n\n\n var _useState = useState({\n inst: {\n value: value,\n getSnapshot: getSnapshot\n }\n }),\n inst = _useState[0].inst,\n forceUpdate = _useState[1]; // Track the latest getSnapshot function with a ref. This needs to be updated\n // in the layout phase so we can access it during the tearing check that\n // happens on subscribe.\n\n\n useLayoutEffect(function () {\n inst.value = value;\n inst.getSnapshot = getSnapshot; // Whenever getSnapshot or subscribe changes, we need to check in the\n // commit phase if there was an interleaved mutation. In concurrent mode\n // this can happen all the time, but even in synchronous mode, an earlier\n // effect may have mutated the store.\n\n if (checkIfSnapshotChanged(inst)) {\n // Force a re-render.\n forceUpdate({\n inst: inst\n });\n }\n }, [subscribe, value, getSnapshot]);\n useEffect(function () {\n // Check for changes right before subscribing. Subsequent changes will be\n // detected in the subscription handler.\n if (checkIfSnapshotChanged(inst)) {\n // Force a re-render.\n forceUpdate({\n inst: inst\n });\n }\n\n var handleStoreChange = function () {\n // TODO: Because there is no cross-renderer API for batching updates, it's\n // up to the consumer of this library to wrap their subscription event\n // with unstable_batchedUpdates. Should we try to detect when this isn't\n // the case and print a warning in development?\n // The store changed. Check if the snapshot changed since the last time we\n // read from the store.\n if (checkIfSnapshotChanged(inst)) {\n // Force a re-render.\n forceUpdate({\n inst: inst\n });\n }\n }; // Subscribe to the store and return a clean-up function.\n\n\n return subscribe(handleStoreChange);\n }, [subscribe]);\n useDebugValue(value);\n return value;\n}\n\nfunction checkIfSnapshotChanged(inst) {\n var latestGetSnapshot = inst.getSnapshot;\n var prevValue = inst.value;\n\n try {\n var nextValue = latestGetSnapshot();\n return !objectIs(prevValue, nextValue);\n } catch (error) {\n return true;\n }\n}\n\nfunction useSyncExternalStore$1(subscribe, getSnapshot, getServerSnapshot) {\n // Note: The shim does not use getServerSnapshot, because pre-18 versions of\n // React do not expose a way to check if we're hydrating. So users of the shim\n // will need to track that themselves and return the correct value\n // from `getSnapshot`.\n return getSnapshot();\n}\n\nvar canUseDOM = !!(typeof window !== 'undefined' && typeof window.document !== 'undefined' && typeof window.document.createElement !== 'undefined');\n\nvar isServerEnvironment = !canUseDOM;\n\nvar shim = isServerEnvironment ? useSyncExternalStore$1 : useSyncExternalStore;\nvar useSyncExternalStore$2 = React.useSyncExternalStore !== undefined ? React.useSyncExternalStore : shim;\n\nexports.useSyncExternalStore = useSyncExternalStore$2;\n /* global __REACT_DEVTOOLS_GLOBAL_HOOK__ */\nif (\n typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ !== 'undefined' &&\n typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop ===\n 'function'\n) {\n __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop(new Error());\n}\n \n })();\n}\n","/**\n * @license React\n * use-sync-external-store-shim.production.min.js\n *\n * Copyright (c) Facebook, Inc. and its affiliates.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n */\n'use strict';var e=require(\"react\");function h(a,b){return a===b&&(0!==a||1/a===1/b)||a!==a&&b!==b}var k=\"function\"===typeof Object.is?Object.is:h,l=e.useState,m=e.useEffect,n=e.useLayoutEffect,p=e.useDebugValue;function q(a,b){var d=b(),f=l({inst:{value:d,getSnapshot:b}}),c=f[0].inst,g=f[1];n(function(){c.value=d;c.getSnapshot=b;r(c)&&g({inst:c})},[a,d,b]);m(function(){r(c)&&g({inst:c});return a(function(){r(c)&&g({inst:c})})},[a]);p(d);return d}\nfunction r(a){var b=a.getSnapshot;a=a.value;try{var d=b();return!k(a,d)}catch(f){return!0}}function t(a,b){return b()}var u=\"undefined\"===typeof window||\"undefined\"===typeof window.document||\"undefined\"===typeof window.document.createElement?t:q;exports.useSyncExternalStore=void 0!==e.useSyncExternalStore?e.useSyncExternalStore:u;\n","'use strict';\n\nif (process.env.NODE_ENV === 'production') {\n module.exports = require('../cjs/use-sync-external-store-shim.production.min.js');\n} else {\n module.exports = require('../cjs/use-sync-external-store-shim.development.js');\n}\n","/**\n * @license React\n * use-sync-external-store-shim/with-selector.development.js\n *\n * Copyright (c) Facebook, Inc. and its affiliates.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n */\n\n'use strict';\n\nif (process.env.NODE_ENV !== \"production\") {\n (function() {\n\n 'use strict';\n\n/* global __REACT_DEVTOOLS_GLOBAL_HOOK__ */\nif (\n typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ !== 'undefined' &&\n typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart ===\n 'function'\n) {\n __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart(new Error());\n}\n var React = require('react');\nvar shim = require('use-sync-external-store/shim');\n\n/**\n * inlined Object.is polyfill to avoid requiring consumers ship their own\n * https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/is\n */\nfunction is(x, y) {\n return x === y && (x !== 0 || 1 / x === 1 / y) || x !== x && y !== y // eslint-disable-line no-self-compare\n ;\n}\n\nvar objectIs = typeof Object.is === 'function' ? Object.is : is;\n\nvar useSyncExternalStore = shim.useSyncExternalStore;\n\n// for CommonJS interop.\n\nvar useRef = React.useRef,\n useEffect = React.useEffect,\n useMemo = React.useMemo,\n useDebugValue = React.useDebugValue; // Same as useSyncExternalStore, but supports selector and isEqual arguments.\n\nfunction useSyncExternalStoreWithSelector(subscribe, getSnapshot, getServerSnapshot, selector, isEqual) {\n // Use this to track the rendered snapshot.\n var instRef = useRef(null);\n var inst;\n\n if (instRef.current === null) {\n inst = {\n hasValue: false,\n value: null\n };\n instRef.current = inst;\n } else {\n inst = instRef.current;\n }\n\n var _useMemo = useMemo(function () {\n // Track the memoized state using closure variables that are local to this\n // memoized instance of a getSnapshot function. Intentionally not using a\n // useRef hook, because that state would be shared across all concurrent\n // copies of the hook/component.\n var hasMemo = false;\n var memoizedSnapshot;\n var memoizedSelection;\n\n var memoizedSelector = function (nextSnapshot) {\n if (!hasMemo) {\n // The first time the hook is called, there is no memoized result.\n hasMemo = true;\n memoizedSnapshot = nextSnapshot;\n\n var _nextSelection = selector(nextSnapshot);\n\n if (isEqual !== undefined) {\n // Even if the selector has changed, the currently rendered selection\n // may be equal to the new selection. We should attempt to reuse the\n // current value if possible, to preserve downstream memoizations.\n if (inst.hasValue) {\n var currentSelection = inst.value;\n\n if (isEqual(currentSelection, _nextSelection)) {\n memoizedSelection = currentSelection;\n return currentSelection;\n }\n }\n }\n\n memoizedSelection = _nextSelection;\n return _nextSelection;\n } // We may be able to reuse the previous invocation's result.\n\n\n // We may be able to reuse the previous invocation's result.\n var prevSnapshot = memoizedSnapshot;\n var prevSelection = memoizedSelection;\n\n if (objectIs(prevSnapshot, nextSnapshot)) {\n // The snapshot is the same as last time. Reuse the previous selection.\n return prevSelection;\n } // The snapshot has changed, so we need to compute a new selection.\n\n\n // The snapshot has changed, so we need to compute a new selection.\n var nextSelection = selector(nextSnapshot); // If a custom isEqual function is provided, use that to check if the data\n // has changed. If it hasn't, return the previous selection. That signals\n // to React that the selections are conceptually equal, and we can bail\n // out of rendering.\n\n // If a custom isEqual function is provided, use that to check if the data\n // has changed. If it hasn't, return the previous selection. That signals\n // to React that the selections are conceptually equal, and we can bail\n // out of rendering.\n if (isEqual !== undefined && isEqual(prevSelection, nextSelection)) {\n return prevSelection;\n }\n\n memoizedSnapshot = nextSnapshot;\n memoizedSelection = nextSelection;\n return nextSelection;\n }; // Assigning this to a constant so that Flow knows it can't change.\n\n\n // Assigning this to a constant so that Flow knows it can't change.\n var maybeGetServerSnapshot = getServerSnapshot === undefined ? null : getServerSnapshot;\n\n var getSnapshotWithSelector = function () {\n return memoizedSelector(getSnapshot());\n };\n\n var getServerSnapshotWithSelector = maybeGetServerSnapshot === null ? undefined : function () {\n return memoizedSelector(maybeGetServerSnapshot());\n };\n return [getSnapshotWithSelector, getServerSnapshotWithSelector];\n }, [getSnapshot, getServerSnapshot, selector, isEqual]),\n getSelection = _useMemo[0],\n getServerSelection = _useMemo[1];\n\n var value = useSyncExternalStore(subscribe, getSelection, getServerSelection);\n useEffect(function () {\n inst.hasValue = true;\n inst.value = value;\n }, [value]);\n useDebugValue(value);\n return value;\n}\n\nexports.useSyncExternalStoreWithSelector = useSyncExternalStoreWithSelector;\n /* global __REACT_DEVTOOLS_GLOBAL_HOOK__ */\nif (\n typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ !== 'undefined' &&\n typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop ===\n 'function'\n) {\n __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop(new Error());\n}\n \n })();\n}\n","/**\n * @license React\n * use-sync-external-store-shim/with-selector.production.min.js\n *\n * Copyright (c) Facebook, Inc. and its affiliates.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n */\n'use strict';var h=require(\"react\"),n=require(\"use-sync-external-store/shim\");function p(a,b){return a===b&&(0!==a||1/a===1/b)||a!==a&&b!==b}var q=\"function\"===typeof Object.is?Object.is:p,r=n.useSyncExternalStore,t=h.useRef,u=h.useEffect,v=h.useMemo,w=h.useDebugValue;\nexports.useSyncExternalStoreWithSelector=function(a,b,e,l,g){var c=t(null);if(null===c.current){var f={hasValue:!1,value:null};c.current=f}else f=c.current;c=v(function(){function a(a){if(!c){c=!0;d=a;a=l(a);if(void 0!==g&&f.hasValue){var b=f.value;if(g(b,a))return k=b}return k=a}b=k;if(q(d,a))return b;var e=l(a);if(void 0!==g&&g(b,e))return b;d=a;return k=e}var c=!1,d,k,m=void 0===e?null:e;return[function(){return a(b())},null===m?void 0:function(){return a(m())}]},[b,e,l,g]);var d=r(a,c[0],c[1]);\nu(function(){f.hasValue=!0;f.value=d},[d]);w(d);return d};\n","'use strict';\n\nif (process.env.NODE_ENV === 'production') {\n module.exports = require('../cjs/use-sync-external-store-shim/with-selector.production.min.js');\n} else {\n module.exports = require('../cjs/use-sync-external-store-shim/with-selector.development.js');\n}\n","import type { Selector, SubscribeOptions } from '@core/commonTypes';\nimport type { Store } from '@core/store';\nimport { deepEqual } from '@lib/equals';\nimport { hash } from '@lib/hash';\nimport { makeSelector } from '@lib/makeSelector';\nimport { type Path, type Value } from '@lib/path';\nimport { trackingProxy } from '@lib/trackingProxy';\nimport { useCallback, useDebugValue, useLayoutEffect, useMemo, useRef } from 'react';\nimport { useSyncExternalStoreWithSelector } from 'use-sync-external-store/shim/with-selector.js';\n\nexport interface UseStoreOptions<S> extends Omit<SubscribeOptions, 'runNow' | 'passive'> {\n disableTrackingProxy?: boolean;\n withViewTransition?: boolean | ((value: S) => unknown);\n}\n\nexport function useStore<T, S>(\n store: Store<T>,\n selector: Selector<T, S>,\n option?: UseStoreOptions<S>,\n): S;\n\nexport function useStore<T, P extends Path<T>>(\n store: Store<T>,\n selector: P,\n option?: UseStoreOptions<Value<T, P>>,\n): Value<T, P>;\n\nexport function useStore<T>(store: Store<T>, option?: UseStoreOptions<T>): T;\n\nexport function useStore<T, S>(store: Store<T>, argument1?: any, argument2?: any): S {\n const selector = makeSelector<T, S>(\n typeof argument1 === 'function' || typeof argument1 === 'string' ? argument1 : undefined,\n );\n const {\n disableTrackingProxy = true,\n equals = deepEqual,\n withViewTransition,\n ...options\n } = (typeof argument1 === 'object' ? argument1 : argument2 ?? {}) as UseStoreOptions<S>;\n\n const lastEqualsRef = useRef<(newValue: S) => boolean>();\n\n const { rootStore, mappingSelector } = useMemo(() => {\n const rootStore = store.derivedFrom?.store ?? store;\n let mappingSelector = (x: any) => x;\n\n if (store.derivedFrom) {\n mappingSelector = (value: any) => {\n for (const s of store.derivedFrom!.selectors) {\n value = makeSelector(s)(value);\n }\n return value;\n };\n }\n\n return { rootStore, mappingSelector };\n }, [store]);\n\n const subOptions = { ...options, runNow: false, passive: false };\n const subscribe = useCallback(\n (listener: () => void) => {\n let _listener: (value: any) => void = listener;\n\n if (withViewTransition && (document as any).startViewTransition) {\n let lastObservedValue: any;\n\n _listener = (value: any) => {\n const observedValue =\n withViewTransition instanceof Function ? withViewTransition(value) : value;\n\n if (equals(lastObservedValue, observedValue)) {\n listener();\n return;\n }\n\n lastObservedValue = observedValue;\n\n let hasChanges = false;\n const mutationObserver = new MutationObserver(() => {\n hasChanges = true;\n mutationObserver.disconnect();\n });\n mutationObserver.observe(document.body, { childList: true, subtree: true });\n\n (document as any).startViewTransition(() => {\n listener();\n\n if (!hasChanges) {\n throw new Error('no change');\n }\n });\n };\n }\n\n return rootStore.subscribe(_listener, subOptions);\n },\n [rootStore, hash(subOptions)],\n );\n\n let value = useSyncExternalStoreWithSelector<unknown, S>(\n //\n subscribe,\n rootStore.get,\n undefined,\n (x) => selector(mappingSelector(x)),\n (_v, newValue) => lastEqualsRef.current?.(newValue) ?? false,\n );\n let lastEquals = (newValue: S) => equals(newValue, value);\n let revoke: (() => void) | undefined;\n\n if (!disableTrackingProxy) {\n [value, lastEquals, revoke] = trackingProxy(value, equals);\n }\n\n useLayoutEffect(() => {\n lastEqualsRef.current = lastEquals;\n revoke?.();\n });\n\n useDebugValue(value);\n return value;\n}\n","import type { UseStoreOptions } from './useStore';\nimport { useStore } from './useStore';\nimport { type Selector, type Update } from '@core/commonTypes';\nimport type { Store } from '@core/store';\nimport { type Path, type Value } from '@lib/path';\n\nexport function useProp<T, S>(\n store: Store<T>,\n selector: Selector<T, S>,\n updater: (value: S) => Update<T>,\n options?: UseStoreOptions<S>,\n): [value: S, setValue: Store<S>['set']];\n\nexport function useProp<T, P extends Path<T>>(\n store: Store<T>,\n selector: P,\n options?: UseStoreOptions<Value<T, P>>,\n): [value: Value<T, P>, setValue: Store<Value<T, P>>['set']];\n\nexport function useProp<T>(\n store: Store<T>,\n options?: UseStoreOptions<T>,\n): [value: T, setValue: Store<T>['set']];\n\nexport function useProp<T, S>(\n store: Store<T>,\n argument1?: any,\n argument2?: any,\n argument3?: any,\n): [value: S, setValue: Store<S>['set']] {\n const selector =\n typeof argument1 === 'function' || typeof argument1 === 'string' ? argument1 : undefined;\n const updater = typeof argument2 === 'function' ? argument2 : undefined;\n const options =\n typeof argument1 === 'object'\n ? argument1\n : typeof argument2 === 'object'\n ? argument2\n : argument3;\n\n if (selector) {\n store = store.map(selector, updater);\n }\n\n const value = useStore(store, options) as S;\n return [value, store.set as Store<S>['set']];\n}\n","import type { Selector, Update } from '@core/commonTypes';\nimport type { Store } from '@core/store';\nimport type { Path, Value } from '@lib/path';\nimport { useProp } from './useProp';\nimport { useStore, type UseStoreOptions } from './useStore';\n\nfunction boundUseStore<T, S>(\n this: Store<T>,\n selector: Selector<T, S>,\n option?: UseStoreOptions<S>,\n): S;\nfunction boundUseStore<T, P extends Path<T>>(\n this: Store<T>,\n selector: P,\n option?: UseStoreOptions<Value<T, P>>,\n): Value<T, P>;\nfunction boundUseStore<T>(this: Store<T>, option?: UseStoreOptions<T>): T;\nfunction boundUseStore(this: Store<any>, ...args: any[]) {\n return useStore(this, ...args);\n}\n\nfunction boundUseProp<T, S>(\n this: Store<T>,\n selector: Selector<T, S>,\n updater: (value: S) => Update<T>,\n options?: UseStoreOptions<S>,\n): [value: S, setValue: Store<S>['set']];\nfunction boundUseProp<T, P extends Path<T>>(\n this: Store<T>,\n selector: P,\n options?: UseStoreOptions<Value<T, P>>,\n): [value: Value<T, P>, setValue: Store<Value<T, P>>['set']];\nfunction boundUseProp<T>(\n this: Store<T>,\n options?: UseStoreOptions<T>,\n): [value: T, setValue: Store<T>['set']];\nfunction boundUseProp(this: Store<any>, ...args: any[]) {\n return useProp(this, ...args);\n}\n\nexport const reactMethods = {\n useStore: boundUseStore,\n useProp: boundUseProp,\n};\n","import type { Cache } from '@core';\nimport type { CacheState } from '@lib/cacheState';\nimport { makeSelector } from '@lib/makeSelector';\nimport { useEffect, useMemo } from 'react';\nimport type { UseStoreOptions } from './useStore';\nimport { useStore } from './useStore';\n\nexport type UseCacheArray<T> = [\n value: T | undefined,\n error: unknown | undefined,\n isUpdating: boolean,\n isStale: boolean,\n];\n\nexport type UseCacheValue<T> = UseCacheArray<T> & CacheState<T>;\n\nexport interface UseCacheOptions<T> extends UseStoreOptions<UseCacheArray<T> & CacheState<T>> {\n passive?: boolean;\n disabled?: boolean;\n updateOnMount?: boolean;\n}\n\nexport function useCache<T>(\n cache: Cache<T>,\n { passive, disabled, updateOnMount, withViewTransition, ...options }: UseCacheOptions<T> = {},\n): UseCacheValue<T> {\n if (withViewTransition === true) {\n withViewTransition = (state) => state.value;\n }\n\n const mappedState = useMemo(() => {\n const rootCache: Cache<any> = cache.derivedFromCache?.cache ?? cache;\n let selector = (x: any) => x;\n\n if (cache.derivedFromCache) {\n selector = (value: any) => {\n for (const s of cache.derivedFromCache!.selectors) {\n value = makeSelector(s)(value);\n }\n return value;\n };\n }\n\n return rootCache.state.map((state) => {\n if (disabled) {\n return Object.assign<UseCacheArray<T>, CacheState<T>>(\n [undefined, undefined, false, false],\n { status: 'pending', isUpdating: false, isStale: false },\n );\n }\n\n try {\n const value = state.status === 'value' ? selector(state.value) : undefined;\n\n return Object.assign<UseCacheArray<T>, CacheState<T>>(\n [value, state.error, state.isUpdating, state.isStale],\n { ...state, value },\n );\n } catch (error) {\n return Object.assign<UseCacheArray<T>, CacheState<T>>(\n [undefined, error, state.isUpdating, state.isStale],\n { status: 'error', error, isUpdating: state.isUpdating, isStale: state.isStale },\n );\n }\n });\n }, [cache]);\n\n useEffect(() => {\n if (updateOnMount) {\n cache.invalidate();\n }\n }, []);\n\n useEffect(() => {\n if (passive || disabled) {\n return;\n }\n\n return cache.subscribe(() => undefined);\n }, [cache, passive, disabled]);\n\n return useStore(mappedState, { ...options, withViewTransition });\n}\n","import type { Context, ReactNode } from 'react';\nimport { createContext, useContext, useMemo } from 'react';\nimport { useProp } from './useProp';\nimport { useStore, type UseStoreOptions } from './useStore';\nimport { createStore } from '@core/store';\nimport type { Store } from '@core/store';\nimport type { Scope } from '@core';\n\nexport type ScopeProps<T> = { scope: Scope<T>; store?: Store<T>; children?: ReactNode };\n\ndeclare module '@core' {\n interface Scope<T> {\n context?: Context<Store<T>>;\n }\n}\n\nfunction getScopeContext<T>(scope: Scope<T>): Context<Store<T>> {\n scope.context ??= createContext<Store<T>>(createStore(scope.defaultValue));\n return scope.context;\n}\n\nexport function ScopeProvider<T>({ scope, store: inputStore, children }: ScopeProps<T>) {\n const context = getScopeContext(scope);\n const currentStore = useMemo(\n () => inputStore ?? createStore(scope.defaultValue),\n [scope, inputStore],\n );\n\n return <context.Provider value={currentStore}>{children}</context.Provider>;\n}\n\nexport function useScope<T>(scope: Scope<T>): Store<T> {\n const context = getScopeContext(scope);\n return useContext(context);\n}\n\nexport function useScopeStore<T>(scope: Scope<T>, options?: UseStoreOptions<T>): T {\n const store = useScope(scope);\n return useStore(store, options);\n}\n\nexport function useScopeProp<T>(scope: Scope<T>, options?: UseStoreOptions<T>) {\n const store = useScope(scope);\n return useProp(store, options);\n}\n"],"names":["deepEqual","equals","error","shim","shimModule","require$$1","require$$0","a","c","d","b","e","withSelectorModule","store","makeSelector","useRef","useMemo","rootStore","mappingSelector","value","useCallback","hash","useSyncExternalStoreWithSelector","useLayoutEffect","useDebugValue","useEffect","createContext","createStore","useContext"],"mappings":";;;;;AAEA,MAAM,2CAA2C,aAAa;AAK9D,SAAS,cAAc,OAAgB;AAEnC,SAAA,OAAO,UAAU,YAAY,UAAU,QAAQ,OAAO,eAAe,KAAK,MAAM,OAAO;AAE3F;AAEgB,SAAA,cAAiB,OAAU,SAASA,iBAA6B;AAC3E,MAAA,CAAC,cAAc,KAAK,KAAK,CAAC,MAAM,QAAQ,KAAK,GAAG;AAClD,WAAO,CAAC,OAAO,CAAC,UAAU,OAAO,OAAO,KAAK,CAAC;AAAA,EAChD;AAGS,UAAA,MAAc,iBAAiB,KAAK;AAEvC,QAAA,OAAO,IAAI;AACX,QAAA,cAAc,IAAI;AACxB,MAAI,UAAU;AAEL,WAAA,iBAAiB,cAAmB,MAAa;AAClD,UAAA,CAAC,cAAcC,SAAQ,MAAM,IAAI,cAAc,UAAU,OAAO,GAAG,IAAI,CAAC;AAEzE,SAAA,KAAK,CAAC,eAAe;AACpB,UAAA,CAAC,cAAc,UAAU,KAAK,CAAC,MAAM,QAAQ,UAAU,GAAG;AACrD,eAAA;AAAA,MACT;AAEA,aAAOA,QAAO,UAAU,YAAY,GAAG,IAAI,CAAC;AAAA,IAAA,CAC7C;AAED,QAAI,QAAQ;AACV,kBAAY,KAAK,MAAM;AAAA,IACzB;AAEO,WAAA;AAAA,EACT;AAES,WAAA,gBAAgB,cAAmB,MAAa;AACvD,UAAM,kBAAkB,UAAU,OAAO,GAAG,IAAI;AAE3C,SAAA,KAAK,CAAC,eAAe;AACxB,aAAO,UAAU,YAAY,GAAG,IAAI,MAAM;AAAA,IAAA,CAC3C;AAEM,WAAA;AAAA,EACT;AAEM,QAAA,QAAQ,IAAI,MAAM,OAAsB;AAAA,IAC5C,IAAI,QAAQ,GAAG,UAAU;AACvB,UAAI,MAAM,mBAAmB;AACp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E,QAAAf,SAAQ,SAAS,KAAK;AACrB,SAAA,SAASA,QAAO,OAAO;AAChC;AAEgB,SAAA,aAAgB,OAAiB,SAA8B;AACvE,QAAAA,SAAQ,SAAS,KAAK;AACrB,SAAA,QAAQA,QAAO,OAAO;AAC/B;;;;;;;;;","x_google_ignoreList":[1,2,3,4,5,6]}
@@ -545,7 +545,7 @@ const reactMethods = {
545
545
  useStore: boundUseStore,
546
546
  useProp: boundUseProp
547
547
  };
548
- function useCache(cache, { passive, updateOnMount, withViewTransition, ...options } = {}) {
548
+ function useCache(cache, { passive, disabled, updateOnMount, withViewTransition, ...options } = {}) {
549
549
  if (withViewTransition === true) {
550
550
  withViewTransition = (state) => state.value;
551
551
  }
@@ -562,19 +562,37 @@ function useCache(cache, { passive, updateOnMount, withViewTransition, ...option
562
562
  };
563
563
  }
564
564
  return rootCache.state.map((state) => {
565
- const value = state.status === "value" ? selector(state.value) : void 0;
566
- return Object.assign(
567
- [value, state.error, state.isUpdating, state.isStale],
568
- { ...state, value }
569
- );
565
+ if (disabled) {
566
+ return Object.assign(
567
+ [void 0, void 0, false, false],
568
+ { status: "pending", isUpdating: false, isStale: false }
569
+ );
570
+ }
571
+ try {
572
+ const value = state.status === "value" ? selector(state.value) : void 0;
573
+ return Object.assign(
574
+ [value, state.error, state.isUpdating, state.isStale],
575
+ { ...state, value }
576
+ );
577
+ } catch (error) {
578
+ return Object.assign(
579
+ [void 0, error, state.isUpdating, state.isStale],
580
+ { status: "error", error, isUpdating: state.isUpdating, isStale: state.isStale }
581
+ );
582
+ }
570
583
  });
571
584
  }, [cache]);
572
- useEffect(() => !passive ? cache.subscribe(() => void 0) : void 0, [cache, passive]);
573
585
  useEffect(() => {
574
586
  if (updateOnMount) {
575
587
  cache.invalidate();
576
588
  }
577
589
  }, []);
590
+ useEffect(() => {
591
+ if (passive || disabled) {
592
+ return;
593
+ }
594
+ return cache.subscribe(() => void 0);
595
+ }, [cache, passive, disabled]);
578
596
  return useStore(mappedState, { ...options, withViewTransition });
579
597
  }
580
598
  function getScopeContext(scope) {
@@ -1 +1 @@
1
- {"version":3,"file":"scope2.mjs","sources":["../../src/lib/trackingProxy.ts","../../node_modules/.pnpm/use-sync-external-store@1.2.0_react@18.2.0/node_modules/use-sync-external-store/cjs/use-sync-external-store-shim.development.js","../../node_modules/.pnpm/use-sync-external-store@1.2.0_react@18.2.0/node_modules/use-sync-external-store/cjs/use-sync-external-store-shim.production.min.js","../../node_modules/.pnpm/use-sync-external-store@1.2.0_react@18.2.0/node_modules/use-sync-external-store/shim/index.js","../../node_modules/.pnpm/use-sync-external-store@1.2.0_react@18.2.0/node_modules/use-sync-external-store/cjs/use-sync-external-store-shim/with-selector.development.js","../../node_modules/.pnpm/use-sync-external-store@1.2.0_react@18.2.0/node_modules/use-sync-external-store/cjs/use-sync-external-store-shim/with-selector.production.min.js","../../node_modules/.pnpm/use-sync-external-store@1.2.0_react@18.2.0/node_modules/use-sync-external-store/shim/with-selector.js","../../src/react/useStore.ts","../../src/react/useProp.ts","../../src/react/reactMethods.ts","../../src/react/useCache.ts","../../src/react/scope.tsx"],"sourcesContent":["import { deepEqual } from './equals';\n\nconst unwrapProxySymbol = /* @__PURE__ */ Symbol('unwrapProxy');\n\nexport type TrackingProxy<T> = [value: T, equals: (newValue: T) => boolean, revoke?: () => void];\ntype Object_ = Record<string | symbol, unknown>;\n\nfunction isPlainObject(value: unknown) {\n return (\n typeof value === 'object' && value !== null && Object.getPrototypeOf(value) === Object.prototype\n );\n}\n\nexport function trackingProxy<T>(value: T, equals = deepEqual): TrackingProxy<T> {\n if (!isPlainObject(value) && !Array.isArray(value)) {\n return [value, (other) => equals(value, other)];\n }\n\n // Unpack proxies, we don't want to nest them\n value = (value as any)[unwrapProxySymbol] ?? value;\n\n const deps = new Array<TrackingProxy<any>[1]>();\n const revokations = new Array<() => void>();\n let revoked = false;\n\n function trackComplexProp(function_: any, ...args: any[]) {\n const [proxiedValue, equals, revoke] = trackingProxy(function_(value, ...args));\n\n deps.push((otherValue) => {\n if (!isPlainObject(otherValue) && !Array.isArray(otherValue)) {\n return false;\n }\n\n return equals(function_(otherValue, ...args));\n });\n\n if (revoke) {\n revokations.push(revoke);\n }\n\n return proxiedValue;\n }\n\n function trackSimpleProp(function_: any, ...args: any[]) {\n const calculatedValue = function_(value, ...args);\n\n deps.push((otherValue) => {\n return function_(otherValue, ...args) === calculatedValue;\n });\n\n return calculatedValue;\n }\n\n const proxy = new Proxy(value as T & Object_, {\n get(target, p, receiver) {\n if (p === unwrapProxySymbol) {\n return value;\n }\n\n if (revoked) {\n return target[p];\n }\n\n const { writable, configurable } = Object.getOwnPropertyDescriptor(target, p) ?? {};\n if (writable === false && configurable === false) {\n return target[p];\n }\n\n return trackComplexProp(Reflect.get, p, receiver);\n },\n\n getOwnPropertyDescriptor(target, p) {\n const { writable, configurable } = Object.getOwnPropertyDescriptor(target, p) ?? {};\n if (writable === false && configurable === false) {\n return Reflect.getOwnPropertyDescriptor(target, p);\n }\n\n return trackComplexProp(Reflect.getOwnPropertyDescriptor, p);\n },\n\n ownKeys() {\n return trackComplexProp(Reflect.ownKeys);\n },\n\n getPrototypeOf() {\n return trackSimpleProp(Reflect.getPrototypeOf);\n },\n\n has(_target, p) {\n return trackSimpleProp(Reflect.has, p);\n },\n\n isExtensible() {\n return trackSimpleProp(Reflect.isExtensible);\n },\n });\n\n return [\n proxy,\n (other) => !!other && deps.every((equals) => equals(other)),\n () => {\n revoked = true;\n revokations.forEach((revoke) => revoke());\n },\n ];\n}\n","/**\n * @license React\n * use-sync-external-store-shim.development.js\n *\n * Copyright (c) Facebook, Inc. and its affiliates.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n */\n\n'use strict';\n\nif (process.env.NODE_ENV !== \"production\") {\n (function() {\n\n 'use strict';\n\n/* global __REACT_DEVTOOLS_GLOBAL_HOOK__ */\nif (\n typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ !== 'undefined' &&\n typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart ===\n 'function'\n) {\n __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart(new Error());\n}\n var React = require('react');\n\nvar ReactSharedInternals = React.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;\n\nfunction error(format) {\n {\n {\n for (var _len2 = arguments.length, args = new Array(_len2 > 1 ? _len2 - 1 : 0), _key2 = 1; _key2 < _len2; _key2++) {\n args[_key2 - 1] = arguments[_key2];\n }\n\n printWarning('error', format, args);\n }\n }\n}\n\nfunction printWarning(level, format, args) {\n // When changing this logic, you might want to also\n // update consoleWithStackDev.www.js as well.\n {\n var ReactDebugCurrentFrame = ReactSharedInternals.ReactDebugCurrentFrame;\n var stack = ReactDebugCurrentFrame.getStackAddendum();\n\n if (stack !== '') {\n format += '%s';\n args = args.concat([stack]);\n } // eslint-disable-next-line react-internal/safe-string-coercion\n\n\n var argsWithFormat = args.map(function (item) {\n return String(item);\n }); // Careful: RN currently depends on this prefix\n\n argsWithFormat.unshift('Warning: ' + format); // We intentionally don't use spread (or .apply) directly because it\n // breaks IE9: https://github.com/facebook/react/issues/13610\n // eslint-disable-next-line react-internal/no-production-logging\n\n Function.prototype.apply.call(console[level], console, argsWithFormat);\n }\n}\n\n/**\n * inlined Object.is polyfill to avoid requiring consumers ship their own\n * https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/is\n */\nfunction is(x, y) {\n return x === y && (x !== 0 || 1 / x === 1 / y) || x !== x && y !== y // eslint-disable-line no-self-compare\n ;\n}\n\nvar objectIs = typeof Object.is === 'function' ? Object.is : is;\n\n// dispatch for CommonJS interop named imports.\n\nvar useState = React.useState,\n useEffect = React.useEffect,\n useLayoutEffect = React.useLayoutEffect,\n useDebugValue = React.useDebugValue;\nvar didWarnOld18Alpha = false;\nvar didWarnUncachedGetSnapshot = false; // Disclaimer: This shim breaks many of the rules of React, and only works\n// because of a very particular set of implementation details and assumptions\n// -- change any one of them and it will break. The most important assumption\n// is that updates are always synchronous, because concurrent rendering is\n// only available in versions of React that also have a built-in\n// useSyncExternalStore API. And we only use this shim when the built-in API\n// does not exist.\n//\n// Do not assume that the clever hacks used by this hook also work in general.\n// The point of this shim is to replace the need for hacks by other libraries.\n\nfunction useSyncExternalStore(subscribe, getSnapshot, // Note: The shim does not use getServerSnapshot, because pre-18 versions of\n// React do not expose a way to check if we're hydrating. So users of the shim\n// will need to track that themselves and return the correct value\n// from `getSnapshot`.\ngetServerSnapshot) {\n {\n if (!didWarnOld18Alpha) {\n if (React.startTransition !== undefined) {\n didWarnOld18Alpha = true;\n\n error('You are using an outdated, pre-release alpha of React 18 that ' + 'does not support useSyncExternalStore. The ' + 'use-sync-external-store shim will not work correctly. Upgrade ' + 'to a newer pre-release.');\n }\n }\n } // Read the current snapshot from the store on every render. Again, this\n // breaks the rules of React, and only works here because of specific\n // implementation details, most importantly that updates are\n // always synchronous.\n\n\n var value = getSnapshot();\n\n {\n if (!didWarnUncachedGetSnapshot) {\n var cachedValue = getSnapshot();\n\n if (!objectIs(value, cachedValue)) {\n error('The result of getSnapshot should be cached to avoid an infinite loop');\n\n didWarnUncachedGetSnapshot = true;\n }\n }\n } // Because updates are synchronous, we don't queue them. Instead we force a\n // re-render whenever the subscribed state changes by updating an some\n // arbitrary useState hook. Then, during render, we call getSnapshot to read\n // the current value.\n //\n // Because we don't actually use the state returned by the useState hook, we\n // can save a bit of memory by storing other stuff in that slot.\n //\n // To implement the early bailout, we need to track some things on a mutable\n // object. Usually, we would put that in a useRef hook, but we can stash it in\n // our useState hook instead.\n //\n // To force a re-render, we call forceUpdate({inst}). That works because the\n // new object always fails an equality check.\n\n\n var _useState = useState({\n inst: {\n value: value,\n getSnapshot: getSnapshot\n }\n }),\n inst = _useState[0].inst,\n forceUpdate = _useState[1]; // Track the latest getSnapshot function with a ref. This needs to be updated\n // in the layout phase so we can access it during the tearing check that\n // happens on subscribe.\n\n\n useLayoutEffect(function () {\n inst.value = value;\n inst.getSnapshot = getSnapshot; // Whenever getSnapshot or subscribe changes, we need to check in the\n // commit phase if there was an interleaved mutation. In concurrent mode\n // this can happen all the time, but even in synchronous mode, an earlier\n // effect may have mutated the store.\n\n if (checkIfSnapshotChanged(inst)) {\n // Force a re-render.\n forceUpdate({\n inst: inst\n });\n }\n }, [subscribe, value, getSnapshot]);\n useEffect(function () {\n // Check for changes right before subscribing. Subsequent changes will be\n // detected in the subscription handler.\n if (checkIfSnapshotChanged(inst)) {\n // Force a re-render.\n forceUpdate({\n inst: inst\n });\n }\n\n var handleStoreChange = function () {\n // TODO: Because there is no cross-renderer API for batching updates, it's\n // up to the consumer of this library to wrap their subscription event\n // with unstable_batchedUpdates. Should we try to detect when this isn't\n // the case and print a warning in development?\n // The store changed. Check if the snapshot changed since the last time we\n // read from the store.\n if (checkIfSnapshotChanged(inst)) {\n // Force a re-render.\n forceUpdate({\n inst: inst\n });\n }\n }; // Subscribe to the store and return a clean-up function.\n\n\n return subscribe(handleStoreChange);\n }, [subscribe]);\n useDebugValue(value);\n return value;\n}\n\nfunction checkIfSnapshotChanged(inst) {\n var latestGetSnapshot = inst.getSnapshot;\n var prevValue = inst.value;\n\n try {\n var nextValue = latestGetSnapshot();\n return !objectIs(prevValue, nextValue);\n } catch (error) {\n return true;\n }\n}\n\nfunction useSyncExternalStore$1(subscribe, getSnapshot, getServerSnapshot) {\n // Note: The shim does not use getServerSnapshot, because pre-18 versions of\n // React do not expose a way to check if we're hydrating. So users of the shim\n // will need to track that themselves and return the correct value\n // from `getSnapshot`.\n return getSnapshot();\n}\n\nvar canUseDOM = !!(typeof window !== 'undefined' && typeof window.document !== 'undefined' && typeof window.document.createElement !== 'undefined');\n\nvar isServerEnvironment = !canUseDOM;\n\nvar shim = isServerEnvironment ? useSyncExternalStore$1 : useSyncExternalStore;\nvar useSyncExternalStore$2 = React.useSyncExternalStore !== undefined ? React.useSyncExternalStore : shim;\n\nexports.useSyncExternalStore = useSyncExternalStore$2;\n /* global __REACT_DEVTOOLS_GLOBAL_HOOK__ */\nif (\n typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ !== 'undefined' &&\n typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop ===\n 'function'\n) {\n __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop(new Error());\n}\n \n })();\n}\n","/**\n * @license React\n * use-sync-external-store-shim.production.min.js\n *\n * Copyright (c) Facebook, Inc. and its affiliates.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n */\n'use strict';var e=require(\"react\");function h(a,b){return a===b&&(0!==a||1/a===1/b)||a!==a&&b!==b}var k=\"function\"===typeof Object.is?Object.is:h,l=e.useState,m=e.useEffect,n=e.useLayoutEffect,p=e.useDebugValue;function q(a,b){var d=b(),f=l({inst:{value:d,getSnapshot:b}}),c=f[0].inst,g=f[1];n(function(){c.value=d;c.getSnapshot=b;r(c)&&g({inst:c})},[a,d,b]);m(function(){r(c)&&g({inst:c});return a(function(){r(c)&&g({inst:c})})},[a]);p(d);return d}\nfunction r(a){var b=a.getSnapshot;a=a.value;try{var d=b();return!k(a,d)}catch(f){return!0}}function t(a,b){return b()}var u=\"undefined\"===typeof window||\"undefined\"===typeof window.document||\"undefined\"===typeof window.document.createElement?t:q;exports.useSyncExternalStore=void 0!==e.useSyncExternalStore?e.useSyncExternalStore:u;\n","'use strict';\n\nif (process.env.NODE_ENV === 'production') {\n module.exports = require('../cjs/use-sync-external-store-shim.production.min.js');\n} else {\n module.exports = require('../cjs/use-sync-external-store-shim.development.js');\n}\n","/**\n * @license React\n * use-sync-external-store-shim/with-selector.development.js\n *\n * Copyright (c) Facebook, Inc. and its affiliates.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n */\n\n'use strict';\n\nif (process.env.NODE_ENV !== \"production\") {\n (function() {\n\n 'use strict';\n\n/* global __REACT_DEVTOOLS_GLOBAL_HOOK__ */\nif (\n typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ !== 'undefined' &&\n typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart ===\n 'function'\n) {\n __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart(new Error());\n}\n var React = require('react');\nvar shim = require('use-sync-external-store/shim');\n\n/**\n * inlined Object.is polyfill to avoid requiring consumers ship their own\n * https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/is\n */\nfunction is(x, y) {\n return x === y && (x !== 0 || 1 / x === 1 / y) || x !== x && y !== y // eslint-disable-line no-self-compare\n ;\n}\n\nvar objectIs = typeof Object.is === 'function' ? Object.is : is;\n\nvar useSyncExternalStore = shim.useSyncExternalStore;\n\n// for CommonJS interop.\n\nvar useRef = React.useRef,\n useEffect = React.useEffect,\n useMemo = React.useMemo,\n useDebugValue = React.useDebugValue; // Same as useSyncExternalStore, but supports selector and isEqual arguments.\n\nfunction useSyncExternalStoreWithSelector(subscribe, getSnapshot, getServerSnapshot, selector, isEqual) {\n // Use this to track the rendered snapshot.\n var instRef = useRef(null);\n var inst;\n\n if (instRef.current === null) {\n inst = {\n hasValue: false,\n value: null\n };\n instRef.current = inst;\n } else {\n inst = instRef.current;\n }\n\n var _useMemo = useMemo(function () {\n // Track the memoized state using closure variables that are local to this\n // memoized instance of a getSnapshot function. Intentionally not using a\n // useRef hook, because that state would be shared across all concurrent\n // copies of the hook/component.\n var hasMemo = false;\n var memoizedSnapshot;\n var memoizedSelection;\n\n var memoizedSelector = function (nextSnapshot) {\n if (!hasMemo) {\n // The first time the hook is called, there is no memoized result.\n hasMemo = true;\n memoizedSnapshot = nextSnapshot;\n\n var _nextSelection = selector(nextSnapshot);\n\n if (isEqual !== undefined) {\n // Even if the selector has changed, the currently rendered selection\n // may be equal to the new selection. We should attempt to reuse the\n // current value if possible, to preserve downstream memoizations.\n if (inst.hasValue) {\n var currentSelection = inst.value;\n\n if (isEqual(currentSelection, _nextSelection)) {\n memoizedSelection = currentSelection;\n return currentSelection;\n }\n }\n }\n\n memoizedSelection = _nextSelection;\n return _nextSelection;\n } // We may be able to reuse the previous invocation's result.\n\n\n // We may be able to reuse the previous invocation's result.\n var prevSnapshot = memoizedSnapshot;\n var prevSelection = memoizedSelection;\n\n if (objectIs(prevSnapshot, nextSnapshot)) {\n // The snapshot is the same as last time. Reuse the previous selection.\n return prevSelection;\n } // The snapshot has changed, so we need to compute a new selection.\n\n\n // The snapshot has changed, so we need to compute a new selection.\n var nextSelection = selector(nextSnapshot); // If a custom isEqual function is provided, use that to check if the data\n // has changed. If it hasn't, return the previous selection. That signals\n // to React that the selections are conceptually equal, and we can bail\n // out of rendering.\n\n // If a custom isEqual function is provided, use that to check if the data\n // has changed. If it hasn't, return the previous selection. That signals\n // to React that the selections are conceptually equal, and we can bail\n // out of rendering.\n if (isEqual !== undefined && isEqual(prevSelection, nextSelection)) {\n return prevSelection;\n }\n\n memoizedSnapshot = nextSnapshot;\n memoizedSelection = nextSelection;\n return nextSelection;\n }; // Assigning this to a constant so that Flow knows it can't change.\n\n\n // Assigning this to a constant so that Flow knows it can't change.\n var maybeGetServerSnapshot = getServerSnapshot === undefined ? null : getServerSnapshot;\n\n var getSnapshotWithSelector = function () {\n return memoizedSelector(getSnapshot());\n };\n\n var getServerSnapshotWithSelector = maybeGetServerSnapshot === null ? undefined : function () {\n return memoizedSelector(maybeGetServerSnapshot());\n };\n return [getSnapshotWithSelector, getServerSnapshotWithSelector];\n }, [getSnapshot, getServerSnapshot, selector, isEqual]),\n getSelection = _useMemo[0],\n getServerSelection = _useMemo[1];\n\n var value = useSyncExternalStore(subscribe, getSelection, getServerSelection);\n useEffect(function () {\n inst.hasValue = true;\n inst.value = value;\n }, [value]);\n useDebugValue(value);\n return value;\n}\n\nexports.useSyncExternalStoreWithSelector = useSyncExternalStoreWithSelector;\n /* global __REACT_DEVTOOLS_GLOBAL_HOOK__ */\nif (\n typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ !== 'undefined' &&\n typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop ===\n 'function'\n) {\n __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop(new Error());\n}\n \n })();\n}\n","/**\n * @license React\n * use-sync-external-store-shim/with-selector.production.min.js\n *\n * Copyright (c) Facebook, Inc. and its affiliates.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n */\n'use strict';var h=require(\"react\"),n=require(\"use-sync-external-store/shim\");function p(a,b){return a===b&&(0!==a||1/a===1/b)||a!==a&&b!==b}var q=\"function\"===typeof Object.is?Object.is:p,r=n.useSyncExternalStore,t=h.useRef,u=h.useEffect,v=h.useMemo,w=h.useDebugValue;\nexports.useSyncExternalStoreWithSelector=function(a,b,e,l,g){var c=t(null);if(null===c.current){var f={hasValue:!1,value:null};c.current=f}else f=c.current;c=v(function(){function a(a){if(!c){c=!0;d=a;a=l(a);if(void 0!==g&&f.hasValue){var b=f.value;if(g(b,a))return k=b}return k=a}b=k;if(q(d,a))return b;var e=l(a);if(void 0!==g&&g(b,e))return b;d=a;return k=e}var c=!1,d,k,m=void 0===e?null:e;return[function(){return a(b())},null===m?void 0:function(){return a(m())}]},[b,e,l,g]);var d=r(a,c[0],c[1]);\nu(function(){f.hasValue=!0;f.value=d},[d]);w(d);return d};\n","'use strict';\n\nif (process.env.NODE_ENV === 'production') {\n module.exports = require('../cjs/use-sync-external-store-shim/with-selector.production.min.js');\n} else {\n module.exports = require('../cjs/use-sync-external-store-shim/with-selector.development.js');\n}\n","import type { Selector, SubscribeOptions } from '@core/commonTypes';\nimport type { Store } from '@core/store';\nimport { deepEqual } from '@lib/equals';\nimport { hash } from '@lib/hash';\nimport { makeSelector } from '@lib/makeSelector';\nimport { type Path, type Value } from '@lib/path';\nimport { trackingProxy } from '@lib/trackingProxy';\nimport { useCallback, useDebugValue, useLayoutEffect, useMemo, useRef } from 'react';\nimport { useSyncExternalStoreWithSelector } from 'use-sync-external-store/shim/with-selector.js';\n\nexport interface UseStoreOptions<S> extends Omit<SubscribeOptions, 'runNow' | 'passive'> {\n disableTrackingProxy?: boolean;\n withViewTransition?: boolean | ((value: S) => unknown);\n}\n\nexport function useStore<T, S>(\n store: Store<T>,\n selector: Selector<T, S>,\n option?: UseStoreOptions<S>,\n): S;\n\nexport function useStore<T, P extends Path<T>>(\n store: Store<T>,\n selector: P,\n option?: UseStoreOptions<Value<T, P>>,\n): Value<T, P>;\n\nexport function useStore<T>(store: Store<T>, option?: UseStoreOptions<T>): T;\n\nexport function useStore<T, S>(store: Store<T>, argument1?: any, argument2?: any): S {\n const selector = makeSelector<T, S>(\n typeof argument1 === 'function' || typeof argument1 === 'string' ? argument1 : undefined,\n );\n const {\n disableTrackingProxy = true,\n equals = deepEqual,\n withViewTransition,\n ...options\n } = (typeof argument1 === 'object' ? argument1 : argument2 ?? {}) as UseStoreOptions<S>;\n\n const lastEqualsRef = useRef<(newValue: S) => boolean>();\n\n const { rootStore, mappingSelector } = useMemo(() => {\n const rootStore = store.derivedFrom?.store ?? store;\n let mappingSelector = (x: any) => x;\n\n if (store.derivedFrom) {\n mappingSelector = (value: any) => {\n for (const s of store.derivedFrom!.selectors) {\n value = makeSelector(s)(value);\n }\n return value;\n };\n }\n\n return { rootStore, mappingSelector };\n }, [store]);\n\n const subOptions = { ...options, runNow: false, passive: false };\n const subscribe = useCallback(\n (listener: () => void) => {\n let _listener: (value: any) => void = listener;\n\n if (withViewTransition && (document as any).startViewTransition) {\n let lastObservedValue: any;\n\n _listener = (value: any) => {\n const observedValue =\n withViewTransition instanceof Function ? withViewTransition(value) : value;\n\n if (equals(lastObservedValue, observedValue)) {\n listener();\n return;\n }\n\n lastObservedValue = observedValue;\n\n let hasChanges = false;\n const mutationObserver = new MutationObserver(() => {\n hasChanges = true;\n mutationObserver.disconnect();\n });\n mutationObserver.observe(document.body, { childList: true, subtree: true });\n\n (document as any).startViewTransition(() => {\n listener();\n\n if (!hasChanges) {\n throw new Error('no change');\n }\n });\n };\n }\n\n return rootStore.subscribe(_listener, subOptions);\n },\n [rootStore, hash(subOptions)],\n );\n\n let value = useSyncExternalStoreWithSelector<unknown, S>(\n //\n subscribe,\n rootStore.get,\n undefined,\n (x) => selector(mappingSelector(x)),\n (_v, newValue) => lastEqualsRef.current?.(newValue) ?? false,\n );\n let lastEquals = (newValue: S) => equals(newValue, value);\n let revoke: (() => void) | undefined;\n\n if (!disableTrackingProxy) {\n [value, lastEquals, revoke] = trackingProxy(value, equals);\n }\n\n useLayoutEffect(() => {\n lastEqualsRef.current = lastEquals;\n revoke?.();\n });\n\n useDebugValue(value);\n return value;\n}\n","import type { UseStoreOptions } from './useStore';\nimport { useStore } from './useStore';\nimport { type Selector, type Update } from '@core/commonTypes';\nimport type { Store } from '@core/store';\nimport { type Path, type Value } from '@lib/path';\n\nexport function useProp<T, S>(\n store: Store<T>,\n selector: Selector<T, S>,\n updater: (value: S) => Update<T>,\n options?: UseStoreOptions<S>,\n): [value: S, setValue: Store<S>['set']];\n\nexport function useProp<T, P extends Path<T>>(\n store: Store<T>,\n selector: P,\n options?: UseStoreOptions<Value<T, P>>,\n): [value: Value<T, P>, setValue: Store<Value<T, P>>['set']];\n\nexport function useProp<T>(\n store: Store<T>,\n options?: UseStoreOptions<T>,\n): [value: T, setValue: Store<T>['set']];\n\nexport function useProp<T, S>(\n store: Store<T>,\n argument1?: any,\n argument2?: any,\n argument3?: any,\n): [value: S, setValue: Store<S>['set']] {\n const selector =\n typeof argument1 === 'function' || typeof argument1 === 'string' ? argument1 : undefined;\n const updater = typeof argument2 === 'function' ? argument2 : undefined;\n const options =\n typeof argument1 === 'object'\n ? argument1\n : typeof argument2 === 'object'\n ? argument2\n : argument3;\n\n if (selector) {\n store = store.map(selector, updater);\n }\n\n const value = useStore(store, options) as S;\n return [value, store.set as Store<S>['set']];\n}\n","import type { Selector, Update } from '@core/commonTypes';\nimport type { Store } from '@core/store';\nimport type { Path, Value } from '@lib/path';\nimport { useProp } from './useProp';\nimport { useStore, type UseStoreOptions } from './useStore';\n\nfunction boundUseStore<T, S>(\n this: Store<T>,\n selector: Selector<T, S>,\n option?: UseStoreOptions<S>,\n): S;\nfunction boundUseStore<T, P extends Path<T>>(\n this: Store<T>,\n selector: P,\n option?: UseStoreOptions<Value<T, P>>,\n): Value<T, P>;\nfunction boundUseStore<T>(this: Store<T>, option?: UseStoreOptions<T>): T;\nfunction boundUseStore(this: Store<any>, ...args: any[]) {\n return useStore(this, ...args);\n}\n\nfunction boundUseProp<T, S>(\n this: Store<T>,\n selector: Selector<T, S>,\n updater: (value: S) => Update<T>,\n options?: UseStoreOptions<S>,\n): [value: S, setValue: Store<S>['set']];\nfunction boundUseProp<T, P extends Path<T>>(\n this: Store<T>,\n selector: P,\n options?: UseStoreOptions<Value<T, P>>,\n): [value: Value<T, P>, setValue: Store<Value<T, P>>['set']];\nfunction boundUseProp<T>(\n this: Store<T>,\n options?: UseStoreOptions<T>,\n): [value: T, setValue: Store<T>['set']];\nfunction boundUseProp(this: Store<any>, ...args: any[]) {\n return useProp(this, ...args);\n}\n\nexport const reactMethods = {\n useStore: boundUseStore,\n useProp: boundUseProp,\n};\n","import type { Cache } from '@core';\nimport type { CacheState } from '@lib/cacheState';\nimport { makeSelector } from '@lib/makeSelector';\nimport { useEffect, useMemo } from 'react';\nimport type { UseStoreOptions } from './useStore';\nimport { useStore } from './useStore';\n\nexport type UseCacheArray<T> = [\n value: T | undefined,\n error: unknown | undefined,\n isUpdating: boolean,\n isStale: boolean,\n];\n\nexport type UseCacheValue<T> = UseCacheArray<T> & CacheState<T>;\n\nexport interface UseCacheOptions<T> extends UseStoreOptions<UseCacheArray<T> & CacheState<T>> {\n passive?: boolean;\n updateOnMount?: boolean;\n}\n\nexport function useCache<T>(\n cache: Cache<T>,\n { passive, updateOnMount, withViewTransition, ...options }: UseCacheOptions<T> = {},\n): UseCacheValue<T> {\n if (withViewTransition === true) {\n withViewTransition = (state) => state.value;\n }\n\n const mappedState = useMemo(() => {\n const rootCache: Cache<any> = cache.derivedFromCache?.cache ?? cache;\n let selector = (x: any) => x;\n\n if (cache.derivedFromCache) {\n selector = (value: any) => {\n for (const s of cache.derivedFromCache!.selectors) {\n value = makeSelector(s)(value);\n }\n return value;\n };\n }\n\n return rootCache.state.map((state) => {\n const value = state.status === 'value' ? selector(state.value) : undefined;\n\n return Object.assign<UseCacheArray<T>, CacheState<T>>(\n [value, state.error, state.isUpdating, state.isStale],\n { ...state, value },\n );\n });\n }, [cache]);\n\n useEffect(() => (!passive ? cache.subscribe(() => undefined) : undefined), [cache, passive]);\n\n useEffect(() => {\n if (updateOnMount) {\n cache.invalidate();\n }\n }, []);\n\n return useStore(mappedState, { ...options, withViewTransition });\n}\n","import type { Context, ReactNode } from 'react';\nimport { createContext, useContext, useMemo } from 'react';\nimport { useProp } from './useProp';\nimport { useStore, type UseStoreOptions } from './useStore';\nimport { createStore } from '@core/store';\nimport type { Store } from '@core/store';\nimport type { Scope } from '@core';\n\nexport type ScopeProps<T> = { scope: Scope<T>; store?: Store<T>; children?: ReactNode };\n\ndeclare module '@core' {\n interface Scope<T> {\n context?: Context<Store<T>>;\n }\n}\n\nfunction getScopeContext<T>(scope: Scope<T>): Context<Store<T>> {\n scope.context ??= createContext<Store<T>>(createStore(scope.defaultValue));\n return scope.context;\n}\n\nexport function ScopeProvider<T>({ scope, store: inputStore, children }: ScopeProps<T>) {\n const context = getScopeContext(scope);\n const currentStore = useMemo(\n () => inputStore ?? createStore(scope.defaultValue),\n [scope, inputStore],\n );\n\n return <context.Provider value={currentStore}>{children}</context.Provider>;\n}\n\nexport function useScope<T>(scope: Scope<T>): Store<T> {\n const context = getScopeContext(scope);\n return useContext(context);\n}\n\nexport function useScopeStore<T>(scope: Scope<T>, options?: UseStoreOptions<T>): T {\n const store = useScope(scope);\n return useStore(store, options);\n}\n\nexport function useScopeProp<T>(scope: Scope<T>, options?: UseStoreOptions<T>) {\n const store = useScope(scope);\n return useProp(store, options);\n}\n"],"names":["equals","useEffect","useLayoutEffect","useDebugValue","error","shim","shimModule","require$$1","require$$0","useRef","useMemo","a","c","d","b","e","withSelectorModule","rootStore","mappingSelector","value","useSyncExternalStoreWithSelector"],"mappings":";;;;AAEA,MAAM,2CAA2C,aAAa;AAK9D,SAAS,cAAc,OAAgB;AAEnC,SAAA,OAAO,UAAU,YAAY,UAAU,QAAQ,OAAO,eAAe,KAAK,MAAM,OAAO;AAE3F;AAEgB,SAAA,cAAiB,OAAU,SAAS,WAA6B;AAC3E,MAAA,CAAC,cAAc,KAAK,KAAK,CAAC,MAAM,QAAQ,KAAK,GAAG;AAClD,WAAO,CAAC,OAAO,CAAC,UAAU,OAAO,OAAO,KAAK,CAAC;AAAA,EAChD;AAGS,UAAA,MAAc,iBAAiB,KAAK;AAEvC,QAAA,OAAO,IAAI;AACX,QAAA,cAAc,IAAI;AACxB,MAAI,UAAU;AAEL,WAAA,iBAAiB,cAAmB,MAAa;AAClD,UAAA,CAAC,cAAcA,SAAQ,MAAM,IAAI,cAAc,UAAU,OAAO,GAAG,IAAI,CAAC;AAEzE,SAAA,KAAK,CAAC,eAAe;AACpB,UAAA,CAAC,cAAc,UAAU,KAAK,CAAC,MAAM,QAAQ,UAAU,GAAG;AACrD,eAAA;AAAA,MACT;AAEA,aAAOA,QAAO,UAAU,YAAY,GAAG,IAAI,CAAC;AAAA,IAAA,CAC7C;AAED,QAAI,QAAQ;AACV,kBAAY,KAAK,MAAM;AAAA,IACzB;AAEO,WAAA;AAAA,EACT;AAES,WAAA,gBAAgB,cAAmB,MAAa;AACvD,UAAM,kBAAkB,UAAU,OAAO,GAAG,IAAI;AAE3C,SAAA,KAAK,CAAC,eAAe;AACxB,aAAO,UAAU,YAAY,GAAG,IAAI,MAAM;AAAA,IAAA,CAC3C;AAEM,WAAA;AAAA,EACT;AAEM,QAAA,QAAQ,IAAI,MAAM,OAAsB;AAAA,IAC5C,IAAI,QAAQ,GAAG,UAAU;AACvB,UAAI,MAAM,mBAAmB;AACpB,eAAA;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UAAU,MAAM,MAAS,IAAI,QAAY,CAAC,OAAO,OAAO,CAAC;AAE3F,YAAU,MAAM;AACd,QAAI,eAAe;AACjB,YAAM,WAAW;AAAA,IACnB;AAAA,EACF,GAAG,CAAE,CAAA;AAEL,SAAO,SAAS,aAAa,EAAE,GAAG,SAAS,mBAAoB,CAAA;AACjE;AC7CA,SAAS,gBAAmB,OAAoC;AAC9D,QAAM,YAAN,MAAM,UAAY,cAAwB,YAAY,MAAM,YAAY,CAAC;AACzE,SAAO,MAAM;AACf;AAEO,SAAS,cAAiB,EAAE,OAAO,OAAO,YAAY,YAA2B;AAChF,QAAA,UAAU,gBAAgB,KAAK;AACrC,QAAM,eAAe;AAAA,IACnB,MAAM,cAAc,YAAY,MAAM,YAAY;AAAA,IAClD,CAAC,OAAO,UAAU;AAAA,EAAA;AAGpB,6BAAQ,QAAQ,UAAR,EAAiB,OAAO,cAAe,SAAS,CAAA;AAC1D;AAEO,SAAS,SAAY,OAA2B;AAC/C,QAAA,UAAU,gBAAgB,KAAK;AACrC,SAAO,WAAW,OAAO;AAC3B;AAEgB,SAAA,cAAiB,OAAiB,SAAiC;AAC3E,QAAA,QAAQ,SAAS,KAAK;AACrB,SAAA,SAAS,OAAO,OAAO;AAChC;AAEgB,SAAA,aAAgB,OAAiB,SAA8B;AACvE,QAAA,QAAQ,SAAS,KAAK;AACrB,SAAA,QAAQ,OAAO,OAAO;AAC/B;","x_google_ignoreList":[1,2,3,4,5,6]}
1
+ {"version":3,"file":"scope2.mjs","sources":["../../src/lib/trackingProxy.ts","../../node_modules/.pnpm/use-sync-external-store@1.2.0_react@18.2.0/node_modules/use-sync-external-store/cjs/use-sync-external-store-shim.development.js","../../node_modules/.pnpm/use-sync-external-store@1.2.0_react@18.2.0/node_modules/use-sync-external-store/cjs/use-sync-external-store-shim.production.min.js","../../node_modules/.pnpm/use-sync-external-store@1.2.0_react@18.2.0/node_modules/use-sync-external-store/shim/index.js","../../node_modules/.pnpm/use-sync-external-store@1.2.0_react@18.2.0/node_modules/use-sync-external-store/cjs/use-sync-external-store-shim/with-selector.development.js","../../node_modules/.pnpm/use-sync-external-store@1.2.0_react@18.2.0/node_modules/use-sync-external-store/cjs/use-sync-external-store-shim/with-selector.production.min.js","../../node_modules/.pnpm/use-sync-external-store@1.2.0_react@18.2.0/node_modules/use-sync-external-store/shim/with-selector.js","../../src/react/useStore.ts","../../src/react/useProp.ts","../../src/react/reactMethods.ts","../../src/react/useCache.ts","../../src/react/scope.tsx"],"sourcesContent":["import { deepEqual } from './equals';\n\nconst unwrapProxySymbol = /* @__PURE__ */ Symbol('unwrapProxy');\n\nexport type TrackingProxy<T> = [value: T, equals: (newValue: T) => boolean, revoke?: () => void];\ntype Object_ = Record<string | symbol, unknown>;\n\nfunction isPlainObject(value: unknown) {\n return (\n typeof value === 'object' && value !== null && Object.getPrototypeOf(value) === Object.prototype\n );\n}\n\nexport function trackingProxy<T>(value: T, equals = deepEqual): TrackingProxy<T> {\n if (!isPlainObject(value) && !Array.isArray(value)) {\n return [value, (other) => equals(value, other)];\n }\n\n // Unpack proxies, we don't want to nest them\n value = (value as any)[unwrapProxySymbol] ?? value;\n\n const deps = new Array<TrackingProxy<any>[1]>();\n const revokations = new Array<() => void>();\n let revoked = false;\n\n function trackComplexProp(function_: any, ...args: any[]) {\n const [proxiedValue, equals, revoke] = trackingProxy(function_(value, ...args));\n\n deps.push((otherValue) => {\n if (!isPlainObject(otherValue) && !Array.isArray(otherValue)) {\n return false;\n }\n\n return equals(function_(otherValue, ...args));\n });\n\n if (revoke) {\n revokations.push(revoke);\n }\n\n return proxiedValue;\n }\n\n function trackSimpleProp(function_: any, ...args: any[]) {\n const calculatedValue = function_(value, ...args);\n\n deps.push((otherValue) => {\n return function_(otherValue, ...args) === calculatedValue;\n });\n\n return calculatedValue;\n }\n\n const proxy = new Proxy(value as T & Object_, {\n get(target, p, receiver) {\n if (p === unwrapProxySymbol) {\n return value;\n }\n\n if (revoked) {\n return target[p];\n }\n\n const { writable, configurable } = Object.getOwnPropertyDescriptor(target, p) ?? {};\n if (writable === false && configurable === false) {\n return target[p];\n }\n\n return trackComplexProp(Reflect.get, p, receiver);\n },\n\n getOwnPropertyDescriptor(target, p) {\n const { writable, configurable } = Object.getOwnPropertyDescriptor(target, p) ?? {};\n if (writable === false && configurable === false) {\n return Reflect.getOwnPropertyDescriptor(target, p);\n }\n\n return trackComplexProp(Reflect.getOwnPropertyDescriptor, p);\n },\n\n ownKeys() {\n return trackComplexProp(Reflect.ownKeys);\n },\n\n getPrototypeOf() {\n return trackSimpleProp(Reflect.getPrototypeOf);\n },\n\n has(_target, p) {\n return trackSimpleProp(Reflect.has, p);\n },\n\n isExtensible() {\n return trackSimpleProp(Reflect.isExtensible);\n },\n });\n\n return [\n proxy,\n (other) => !!other && deps.every((equals) => equals(other)),\n () => {\n revoked = true;\n revokations.forEach((revoke) => revoke());\n },\n ];\n}\n","/**\n * @license React\n * use-sync-external-store-shim.development.js\n *\n * Copyright (c) Facebook, Inc. and its affiliates.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n */\n\n'use strict';\n\nif (process.env.NODE_ENV !== \"production\") {\n (function() {\n\n 'use strict';\n\n/* global __REACT_DEVTOOLS_GLOBAL_HOOK__ */\nif (\n typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ !== 'undefined' &&\n typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart ===\n 'function'\n) {\n __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart(new Error());\n}\n var React = require('react');\n\nvar ReactSharedInternals = React.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;\n\nfunction error(format) {\n {\n {\n for (var _len2 = arguments.length, args = new Array(_len2 > 1 ? _len2 - 1 : 0), _key2 = 1; _key2 < _len2; _key2++) {\n args[_key2 - 1] = arguments[_key2];\n }\n\n printWarning('error', format, args);\n }\n }\n}\n\nfunction printWarning(level, format, args) {\n // When changing this logic, you might want to also\n // update consoleWithStackDev.www.js as well.\n {\n var ReactDebugCurrentFrame = ReactSharedInternals.ReactDebugCurrentFrame;\n var stack = ReactDebugCurrentFrame.getStackAddendum();\n\n if (stack !== '') {\n format += '%s';\n args = args.concat([stack]);\n } // eslint-disable-next-line react-internal/safe-string-coercion\n\n\n var argsWithFormat = args.map(function (item) {\n return String(item);\n }); // Careful: RN currently depends on this prefix\n\n argsWithFormat.unshift('Warning: ' + format); // We intentionally don't use spread (or .apply) directly because it\n // breaks IE9: https://github.com/facebook/react/issues/13610\n // eslint-disable-next-line react-internal/no-production-logging\n\n Function.prototype.apply.call(console[level], console, argsWithFormat);\n }\n}\n\n/**\n * inlined Object.is polyfill to avoid requiring consumers ship their own\n * https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/is\n */\nfunction is(x, y) {\n return x === y && (x !== 0 || 1 / x === 1 / y) || x !== x && y !== y // eslint-disable-line no-self-compare\n ;\n}\n\nvar objectIs = typeof Object.is === 'function' ? Object.is : is;\n\n// dispatch for CommonJS interop named imports.\n\nvar useState = React.useState,\n useEffect = React.useEffect,\n useLayoutEffect = React.useLayoutEffect,\n useDebugValue = React.useDebugValue;\nvar didWarnOld18Alpha = false;\nvar didWarnUncachedGetSnapshot = false; // Disclaimer: This shim breaks many of the rules of React, and only works\n// because of a very particular set of implementation details and assumptions\n// -- change any one of them and it will break. The most important assumption\n// is that updates are always synchronous, because concurrent rendering is\n// only available in versions of React that also have a built-in\n// useSyncExternalStore API. And we only use this shim when the built-in API\n// does not exist.\n//\n// Do not assume that the clever hacks used by this hook also work in general.\n// The point of this shim is to replace the need for hacks by other libraries.\n\nfunction useSyncExternalStore(subscribe, getSnapshot, // Note: The shim does not use getServerSnapshot, because pre-18 versions of\n// React do not expose a way to check if we're hydrating. So users of the shim\n// will need to track that themselves and return the correct value\n// from `getSnapshot`.\ngetServerSnapshot) {\n {\n if (!didWarnOld18Alpha) {\n if (React.startTransition !== undefined) {\n didWarnOld18Alpha = true;\n\n error('You are using an outdated, pre-release alpha of React 18 that ' + 'does not support useSyncExternalStore. The ' + 'use-sync-external-store shim will not work correctly. Upgrade ' + 'to a newer pre-release.');\n }\n }\n } // Read the current snapshot from the store on every render. Again, this\n // breaks the rules of React, and only works here because of specific\n // implementation details, most importantly that updates are\n // always synchronous.\n\n\n var value = getSnapshot();\n\n {\n if (!didWarnUncachedGetSnapshot) {\n var cachedValue = getSnapshot();\n\n if (!objectIs(value, cachedValue)) {\n error('The result of getSnapshot should be cached to avoid an infinite loop');\n\n didWarnUncachedGetSnapshot = true;\n }\n }\n } // Because updates are synchronous, we don't queue them. Instead we force a\n // re-render whenever the subscribed state changes by updating an some\n // arbitrary useState hook. Then, during render, we call getSnapshot to read\n // the current value.\n //\n // Because we don't actually use the state returned by the useState hook, we\n // can save a bit of memory by storing other stuff in that slot.\n //\n // To implement the early bailout, we need to track some things on a mutable\n // object. Usually, we would put that in a useRef hook, but we can stash it in\n // our useState hook instead.\n //\n // To force a re-render, we call forceUpdate({inst}). That works because the\n // new object always fails an equality check.\n\n\n var _useState = useState({\n inst: {\n value: value,\n getSnapshot: getSnapshot\n }\n }),\n inst = _useState[0].inst,\n forceUpdate = _useState[1]; // Track the latest getSnapshot function with a ref. This needs to be updated\n // in the layout phase so we can access it during the tearing check that\n // happens on subscribe.\n\n\n useLayoutEffect(function () {\n inst.value = value;\n inst.getSnapshot = getSnapshot; // Whenever getSnapshot or subscribe changes, we need to check in the\n // commit phase if there was an interleaved mutation. In concurrent mode\n // this can happen all the time, but even in synchronous mode, an earlier\n // effect may have mutated the store.\n\n if (checkIfSnapshotChanged(inst)) {\n // Force a re-render.\n forceUpdate({\n inst: inst\n });\n }\n }, [subscribe, value, getSnapshot]);\n useEffect(function () {\n // Check for changes right before subscribing. Subsequent changes will be\n // detected in the subscription handler.\n if (checkIfSnapshotChanged(inst)) {\n // Force a re-render.\n forceUpdate({\n inst: inst\n });\n }\n\n var handleStoreChange = function () {\n // TODO: Because there is no cross-renderer API for batching updates, it's\n // up to the consumer of this library to wrap their subscription event\n // with unstable_batchedUpdates. Should we try to detect when this isn't\n // the case and print a warning in development?\n // The store changed. Check if the snapshot changed since the last time we\n // read from the store.\n if (checkIfSnapshotChanged(inst)) {\n // Force a re-render.\n forceUpdate({\n inst: inst\n });\n }\n }; // Subscribe to the store and return a clean-up function.\n\n\n return subscribe(handleStoreChange);\n }, [subscribe]);\n useDebugValue(value);\n return value;\n}\n\nfunction checkIfSnapshotChanged(inst) {\n var latestGetSnapshot = inst.getSnapshot;\n var prevValue = inst.value;\n\n try {\n var nextValue = latestGetSnapshot();\n return !objectIs(prevValue, nextValue);\n } catch (error) {\n return true;\n }\n}\n\nfunction useSyncExternalStore$1(subscribe, getSnapshot, getServerSnapshot) {\n // Note: The shim does not use getServerSnapshot, because pre-18 versions of\n // React do not expose a way to check if we're hydrating. So users of the shim\n // will need to track that themselves and return the correct value\n // from `getSnapshot`.\n return getSnapshot();\n}\n\nvar canUseDOM = !!(typeof window !== 'undefined' && typeof window.document !== 'undefined' && typeof window.document.createElement !== 'undefined');\n\nvar isServerEnvironment = !canUseDOM;\n\nvar shim = isServerEnvironment ? useSyncExternalStore$1 : useSyncExternalStore;\nvar useSyncExternalStore$2 = React.useSyncExternalStore !== undefined ? React.useSyncExternalStore : shim;\n\nexports.useSyncExternalStore = useSyncExternalStore$2;\n /* global __REACT_DEVTOOLS_GLOBAL_HOOK__ */\nif (\n typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ !== 'undefined' &&\n typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop ===\n 'function'\n) {\n __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop(new Error());\n}\n \n })();\n}\n","/**\n * @license React\n * use-sync-external-store-shim.production.min.js\n *\n * Copyright (c) Facebook, Inc. and its affiliates.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n */\n'use strict';var e=require(\"react\");function h(a,b){return a===b&&(0!==a||1/a===1/b)||a!==a&&b!==b}var k=\"function\"===typeof Object.is?Object.is:h,l=e.useState,m=e.useEffect,n=e.useLayoutEffect,p=e.useDebugValue;function q(a,b){var d=b(),f=l({inst:{value:d,getSnapshot:b}}),c=f[0].inst,g=f[1];n(function(){c.value=d;c.getSnapshot=b;r(c)&&g({inst:c})},[a,d,b]);m(function(){r(c)&&g({inst:c});return a(function(){r(c)&&g({inst:c})})},[a]);p(d);return d}\nfunction r(a){var b=a.getSnapshot;a=a.value;try{var d=b();return!k(a,d)}catch(f){return!0}}function t(a,b){return b()}var u=\"undefined\"===typeof window||\"undefined\"===typeof window.document||\"undefined\"===typeof window.document.createElement?t:q;exports.useSyncExternalStore=void 0!==e.useSyncExternalStore?e.useSyncExternalStore:u;\n","'use strict';\n\nif (process.env.NODE_ENV === 'production') {\n module.exports = require('../cjs/use-sync-external-store-shim.production.min.js');\n} else {\n module.exports = require('../cjs/use-sync-external-store-shim.development.js');\n}\n","/**\n * @license React\n * use-sync-external-store-shim/with-selector.development.js\n *\n * Copyright (c) Facebook, Inc. and its affiliates.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n */\n\n'use strict';\n\nif (process.env.NODE_ENV !== \"production\") {\n (function() {\n\n 'use strict';\n\n/* global __REACT_DEVTOOLS_GLOBAL_HOOK__ */\nif (\n typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ !== 'undefined' &&\n typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart ===\n 'function'\n) {\n __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart(new Error());\n}\n var React = require('react');\nvar shim = require('use-sync-external-store/shim');\n\n/**\n * inlined Object.is polyfill to avoid requiring consumers ship their own\n * https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/is\n */\nfunction is(x, y) {\n return x === y && (x !== 0 || 1 / x === 1 / y) || x !== x && y !== y // eslint-disable-line no-self-compare\n ;\n}\n\nvar objectIs = typeof Object.is === 'function' ? Object.is : is;\n\nvar useSyncExternalStore = shim.useSyncExternalStore;\n\n// for CommonJS interop.\n\nvar useRef = React.useRef,\n useEffect = React.useEffect,\n useMemo = React.useMemo,\n useDebugValue = React.useDebugValue; // Same as useSyncExternalStore, but supports selector and isEqual arguments.\n\nfunction useSyncExternalStoreWithSelector(subscribe, getSnapshot, getServerSnapshot, selector, isEqual) {\n // Use this to track the rendered snapshot.\n var instRef = useRef(null);\n var inst;\n\n if (instRef.current === null) {\n inst = {\n hasValue: false,\n value: null\n };\n instRef.current = inst;\n } else {\n inst = instRef.current;\n }\n\n var _useMemo = useMemo(function () {\n // Track the memoized state using closure variables that are local to this\n // memoized instance of a getSnapshot function. Intentionally not using a\n // useRef hook, because that state would be shared across all concurrent\n // copies of the hook/component.\n var hasMemo = false;\n var memoizedSnapshot;\n var memoizedSelection;\n\n var memoizedSelector = function (nextSnapshot) {\n if (!hasMemo) {\n // The first time the hook is called, there is no memoized result.\n hasMemo = true;\n memoizedSnapshot = nextSnapshot;\n\n var _nextSelection = selector(nextSnapshot);\n\n if (isEqual !== undefined) {\n // Even if the selector has changed, the currently rendered selection\n // may be equal to the new selection. We should attempt to reuse the\n // current value if possible, to preserve downstream memoizations.\n if (inst.hasValue) {\n var currentSelection = inst.value;\n\n if (isEqual(currentSelection, _nextSelection)) {\n memoizedSelection = currentSelection;\n return currentSelection;\n }\n }\n }\n\n memoizedSelection = _nextSelection;\n return _nextSelection;\n } // We may be able to reuse the previous invocation's result.\n\n\n // We may be able to reuse the previous invocation's result.\n var prevSnapshot = memoizedSnapshot;\n var prevSelection = memoizedSelection;\n\n if (objectIs(prevSnapshot, nextSnapshot)) {\n // The snapshot is the same as last time. Reuse the previous selection.\n return prevSelection;\n } // The snapshot has changed, so we need to compute a new selection.\n\n\n // The snapshot has changed, so we need to compute a new selection.\n var nextSelection = selector(nextSnapshot); // If a custom isEqual function is provided, use that to check if the data\n // has changed. If it hasn't, return the previous selection. That signals\n // to React that the selections are conceptually equal, and we can bail\n // out of rendering.\n\n // If a custom isEqual function is provided, use that to check if the data\n // has changed. If it hasn't, return the previous selection. That signals\n // to React that the selections are conceptually equal, and we can bail\n // out of rendering.\n if (isEqual !== undefined && isEqual(prevSelection, nextSelection)) {\n return prevSelection;\n }\n\n memoizedSnapshot = nextSnapshot;\n memoizedSelection = nextSelection;\n return nextSelection;\n }; // Assigning this to a constant so that Flow knows it can't change.\n\n\n // Assigning this to a constant so that Flow knows it can't change.\n var maybeGetServerSnapshot = getServerSnapshot === undefined ? null : getServerSnapshot;\n\n var getSnapshotWithSelector = function () {\n return memoizedSelector(getSnapshot());\n };\n\n var getServerSnapshotWithSelector = maybeGetServerSnapshot === null ? undefined : function () {\n return memoizedSelector(maybeGetServerSnapshot());\n };\n return [getSnapshotWithSelector, getServerSnapshotWithSelector];\n }, [getSnapshot, getServerSnapshot, selector, isEqual]),\n getSelection = _useMemo[0],\n getServerSelection = _useMemo[1];\n\n var value = useSyncExternalStore(subscribe, getSelection, getServerSelection);\n useEffect(function () {\n inst.hasValue = true;\n inst.value = value;\n }, [value]);\n useDebugValue(value);\n return value;\n}\n\nexports.useSyncExternalStoreWithSelector = useSyncExternalStoreWithSelector;\n /* global __REACT_DEVTOOLS_GLOBAL_HOOK__ */\nif (\n typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ !== 'undefined' &&\n typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop ===\n 'function'\n) {\n __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop(new Error());\n}\n \n })();\n}\n","/**\n * @license React\n * use-sync-external-store-shim/with-selector.production.min.js\n *\n * Copyright (c) Facebook, Inc. and its affiliates.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n */\n'use strict';var h=require(\"react\"),n=require(\"use-sync-external-store/shim\");function p(a,b){return a===b&&(0!==a||1/a===1/b)||a!==a&&b!==b}var q=\"function\"===typeof Object.is?Object.is:p,r=n.useSyncExternalStore,t=h.useRef,u=h.useEffect,v=h.useMemo,w=h.useDebugValue;\nexports.useSyncExternalStoreWithSelector=function(a,b,e,l,g){var c=t(null);if(null===c.current){var f={hasValue:!1,value:null};c.current=f}else f=c.current;c=v(function(){function a(a){if(!c){c=!0;d=a;a=l(a);if(void 0!==g&&f.hasValue){var b=f.value;if(g(b,a))return k=b}return k=a}b=k;if(q(d,a))return b;var e=l(a);if(void 0!==g&&g(b,e))return b;d=a;return k=e}var c=!1,d,k,m=void 0===e?null:e;return[function(){return a(b())},null===m?void 0:function(){return a(m())}]},[b,e,l,g]);var d=r(a,c[0],c[1]);\nu(function(){f.hasValue=!0;f.value=d},[d]);w(d);return d};\n","'use strict';\n\nif (process.env.NODE_ENV === 'production') {\n module.exports = require('../cjs/use-sync-external-store-shim/with-selector.production.min.js');\n} else {\n module.exports = require('../cjs/use-sync-external-store-shim/with-selector.development.js');\n}\n","import type { Selector, SubscribeOptions } from '@core/commonTypes';\nimport type { Store } from '@core/store';\nimport { deepEqual } from '@lib/equals';\nimport { hash } from '@lib/hash';\nimport { makeSelector } from '@lib/makeSelector';\nimport { type Path, type Value } from '@lib/path';\nimport { trackingProxy } from '@lib/trackingProxy';\nimport { useCallback, useDebugValue, useLayoutEffect, useMemo, useRef } from 'react';\nimport { useSyncExternalStoreWithSelector } from 'use-sync-external-store/shim/with-selector.js';\n\nexport interface UseStoreOptions<S> extends Omit<SubscribeOptions, 'runNow' | 'passive'> {\n disableTrackingProxy?: boolean;\n withViewTransition?: boolean | ((value: S) => unknown);\n}\n\nexport function useStore<T, S>(\n store: Store<T>,\n selector: Selector<T, S>,\n option?: UseStoreOptions<S>,\n): S;\n\nexport function useStore<T, P extends Path<T>>(\n store: Store<T>,\n selector: P,\n option?: UseStoreOptions<Value<T, P>>,\n): Value<T, P>;\n\nexport function useStore<T>(store: Store<T>, option?: UseStoreOptions<T>): T;\n\nexport function useStore<T, S>(store: Store<T>, argument1?: any, argument2?: any): S {\n const selector = makeSelector<T, S>(\n typeof argument1 === 'function' || typeof argument1 === 'string' ? argument1 : undefined,\n );\n const {\n disableTrackingProxy = true,\n equals = deepEqual,\n withViewTransition,\n ...options\n } = (typeof argument1 === 'object' ? argument1 : argument2 ?? {}) as UseStoreOptions<S>;\n\n const lastEqualsRef = useRef<(newValue: S) => boolean>();\n\n const { rootStore, mappingSelector } = useMemo(() => {\n const rootStore = store.derivedFrom?.store ?? store;\n let mappingSelector = (x: any) => x;\n\n if (store.derivedFrom) {\n mappingSelector = (value: any) => {\n for (const s of store.derivedFrom!.selectors) {\n value = makeSelector(s)(value);\n }\n return value;\n };\n }\n\n return { rootStore, mappingSelector };\n }, [store]);\n\n const subOptions = { ...options, runNow: false, passive: false };\n const subscribe = useCallback(\n (listener: () => void) => {\n let _listener: (value: any) => void = listener;\n\n if (withViewTransition && (document as any).startViewTransition) {\n let lastObservedValue: any;\n\n _listener = (value: any) => {\n const observedValue =\n withViewTransition instanceof Function ? withViewTransition(value) : value;\n\n if (equals(lastObservedValue, observedValue)) {\n listener();\n return;\n }\n\n lastObservedValue = observedValue;\n\n let hasChanges = false;\n const mutationObserver = new MutationObserver(() => {\n hasChanges = true;\n mutationObserver.disconnect();\n });\n mutationObserver.observe(document.body, { childList: true, subtree: true });\n\n (document as any).startViewTransition(() => {\n listener();\n\n if (!hasChanges) {\n throw new Error('no change');\n }\n });\n };\n }\n\n return rootStore.subscribe(_listener, subOptions);\n },\n [rootStore, hash(subOptions)],\n );\n\n let value = useSyncExternalStoreWithSelector<unknown, S>(\n //\n subscribe,\n rootStore.get,\n undefined,\n (x) => selector(mappingSelector(x)),\n (_v, newValue) => lastEqualsRef.current?.(newValue) ?? false,\n );\n let lastEquals = (newValue: S) => equals(newValue, value);\n let revoke: (() => void) | undefined;\n\n if (!disableTrackingProxy) {\n [value, lastEquals, revoke] = trackingProxy(value, equals);\n }\n\n useLayoutEffect(() => {\n lastEqualsRef.current = lastEquals;\n revoke?.();\n });\n\n useDebugValue(value);\n return value;\n}\n","import type { UseStoreOptions } from './useStore';\nimport { useStore } from './useStore';\nimport { type Selector, type Update } from '@core/commonTypes';\nimport type { Store } from '@core/store';\nimport { type Path, type Value } from '@lib/path';\n\nexport function useProp<T, S>(\n store: Store<T>,\n selector: Selector<T, S>,\n updater: (value: S) => Update<T>,\n options?: UseStoreOptions<S>,\n): [value: S, setValue: Store<S>['set']];\n\nexport function useProp<T, P extends Path<T>>(\n store: Store<T>,\n selector: P,\n options?: UseStoreOptions<Value<T, P>>,\n): [value: Value<T, P>, setValue: Store<Value<T, P>>['set']];\n\nexport function useProp<T>(\n store: Store<T>,\n options?: UseStoreOptions<T>,\n): [value: T, setValue: Store<T>['set']];\n\nexport function useProp<T, S>(\n store: Store<T>,\n argument1?: any,\n argument2?: any,\n argument3?: any,\n): [value: S, setValue: Store<S>['set']] {\n const selector =\n typeof argument1 === 'function' || typeof argument1 === 'string' ? argument1 : undefined;\n const updater = typeof argument2 === 'function' ? argument2 : undefined;\n const options =\n typeof argument1 === 'object'\n ? argument1\n : typeof argument2 === 'object'\n ? argument2\n : argument3;\n\n if (selector) {\n store = store.map(selector, updater);\n }\n\n const value = useStore(store, options) as S;\n return [value, store.set as Store<S>['set']];\n}\n","import type { Selector, Update } from '@core/commonTypes';\nimport type { Store } from '@core/store';\nimport type { Path, Value } from '@lib/path';\nimport { useProp } from './useProp';\nimport { useStore, type UseStoreOptions } from './useStore';\n\nfunction boundUseStore<T, S>(\n this: Store<T>,\n selector: Selector<T, S>,\n option?: UseStoreOptions<S>,\n): S;\nfunction boundUseStore<T, P extends Path<T>>(\n this: Store<T>,\n selector: P,\n option?: UseStoreOptions<Value<T, P>>,\n): Value<T, P>;\nfunction boundUseStore<T>(this: Store<T>, option?: UseStoreOptions<T>): T;\nfunction boundUseStore(this: Store<any>, ...args: any[]) {\n return useStore(this, ...args);\n}\n\nfunction boundUseProp<T, S>(\n this: Store<T>,\n selector: Selector<T, S>,\n updater: (value: S) => Update<T>,\n options?: UseStoreOptions<S>,\n): [value: S, setValue: Store<S>['set']];\nfunction boundUseProp<T, P extends Path<T>>(\n this: Store<T>,\n selector: P,\n options?: UseStoreOptions<Value<T, P>>,\n): [value: Value<T, P>, setValue: Store<Value<T, P>>['set']];\nfunction boundUseProp<T>(\n this: Store<T>,\n options?: UseStoreOptions<T>,\n): [value: T, setValue: Store<T>['set']];\nfunction boundUseProp(this: Store<any>, ...args: any[]) {\n return useProp(this, ...args);\n}\n\nexport const reactMethods = {\n useStore: boundUseStore,\n useProp: boundUseProp,\n};\n","import type { Cache } from '@core';\nimport type { CacheState } from '@lib/cacheState';\nimport { makeSelector } from '@lib/makeSelector';\nimport { useEffect, useMemo } from 'react';\nimport type { UseStoreOptions } from './useStore';\nimport { useStore } from './useStore';\n\nexport type UseCacheArray<T> = [\n value: T | undefined,\n error: unknown | undefined,\n isUpdating: boolean,\n isStale: boolean,\n];\n\nexport type UseCacheValue<T> = UseCacheArray<T> & CacheState<T>;\n\nexport interface UseCacheOptions<T> extends UseStoreOptions<UseCacheArray<T> & CacheState<T>> {\n passive?: boolean;\n disabled?: boolean;\n updateOnMount?: boolean;\n}\n\nexport function useCache<T>(\n cache: Cache<T>,\n { passive, disabled, updateOnMount, withViewTransition, ...options }: UseCacheOptions<T> = {},\n): UseCacheValue<T> {\n if (withViewTransition === true) {\n withViewTransition = (state) => state.value;\n }\n\n const mappedState = useMemo(() => {\n const rootCache: Cache<any> = cache.derivedFromCache?.cache ?? cache;\n let selector = (x: any) => x;\n\n if (cache.derivedFromCache) {\n selector = (value: any) => {\n for (const s of cache.derivedFromCache!.selectors) {\n value = makeSelector(s)(value);\n }\n return value;\n };\n }\n\n return rootCache.state.map((state) => {\n if (disabled) {\n return Object.assign<UseCacheArray<T>, CacheState<T>>(\n [undefined, undefined, false, false],\n { status: 'pending', isUpdating: false, isStale: false },\n );\n }\n\n try {\n const value = state.status === 'value' ? selector(state.value) : undefined;\n\n return Object.assign<UseCacheArray<T>, CacheState<T>>(\n [value, state.error, state.isUpdating, state.isStale],\n { ...state, value },\n );\n } catch (error) {\n return Object.assign<UseCacheArray<T>, CacheState<T>>(\n [undefined, error, state.isUpdating, state.isStale],\n { status: 'error', error, isUpdating: state.isUpdating, isStale: state.isStale },\n );\n }\n });\n }, [cache]);\n\n useEffect(() => {\n if (updateOnMount) {\n cache.invalidate();\n }\n }, []);\n\n useEffect(() => {\n if (passive || disabled) {\n return;\n }\n\n return cache.subscribe(() => undefined);\n }, [cache, passive, disabled]);\n\n return useStore(mappedState, { ...options, withViewTransition });\n}\n","import type { Context, ReactNode } from 'react';\nimport { createContext, useContext, useMemo } from 'react';\nimport { useProp } from './useProp';\nimport { useStore, type UseStoreOptions } from './useStore';\nimport { createStore } from '@core/store';\nimport type { Store } from '@core/store';\nimport type { Scope } from '@core';\n\nexport type ScopeProps<T> = { scope: Scope<T>; store?: Store<T>; children?: ReactNode };\n\ndeclare module '@core' {\n interface Scope<T> {\n context?: Context<Store<T>>;\n }\n}\n\nfunction getScopeContext<T>(scope: Scope<T>): Context<Store<T>> {\n scope.context ??= createContext<Store<T>>(createStore(scope.defaultValue));\n return scope.context;\n}\n\nexport function ScopeProvider<T>({ scope, store: inputStore, children }: ScopeProps<T>) {\n const context = getScopeContext(scope);\n const currentStore = useMemo(\n () => inputStore ?? createStore(scope.defaultValue),\n [scope, inputStore],\n );\n\n return <context.Provider value={currentStore}>{children}</context.Provider>;\n}\n\nexport function useScope<T>(scope: Scope<T>): Store<T> {\n const context = getScopeContext(scope);\n return useContext(context);\n}\n\nexport function useScopeStore<T>(scope: Scope<T>, options?: UseStoreOptions<T>): T {\n const store = useScope(scope);\n return useStore(store, options);\n}\n\nexport function useScopeProp<T>(scope: Scope<T>, options?: UseStoreOptions<T>) {\n const store = useScope(scope);\n return useProp(store, options);\n}\n"],"names":["equals","useEffect","useLayoutEffect","useDebugValue","error","shim","shimModule","require$$1","require$$0","useRef","useMemo","a","c","d","b","e","withSelectorModule","rootStore","mappingSelector","value","useSyncEx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,7 @@ export type UseCacheArray<T> = [
10
10
  export type UseCacheValue<T> = UseCacheArray<T> & CacheState<T>;
11
11
  export interface UseCacheOptions<T> extends UseStoreOptions<UseCacheArray<T> & CacheState<T>> {
12
12
  passive?: boolean;
13
+ disabled?: boolean;
13
14
  updateOnMount?: boolean;
14
15
  }
15
- export declare function useCache<T>(cache: Cache<T>, { passive, updateOnMount, withViewTransition, ...options }?: UseCacheOptions<T>): UseCacheValue<T>;
16
+ export declare function useCache<T>(cache: Cache<T>, { passive, disabled, updateOnMount, withViewTransition, ...options }?: UseCacheOptions<T>): UseCacheValue<T>;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "cross-state",
3
- "version": "0.31.0",
3
+ "version": "0.31.1",
4
4
  "description": "(React) state library",
5
5
  "license": "ISC",
6
6
  "repository": "schummar/cross-state",