cross-state 0.37.7 → 0.37.9

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.
Files changed (67) hide show
  1. package/dist/cjs/autobind.cjs +41 -0
  2. package/dist/cjs/autobind.cjs.map +1 -0
  3. package/dist/cjs/index.cjs +2 -2
  4. package/dist/cjs/index.cjs.map +1 -1
  5. package/dist/cjs/mutative/register.cjs +2 -0
  6. package/dist/cjs/mutative/register.cjs.map +1 -1
  7. package/dist/cjs/mutativeMethods.cjs.map +1 -1
  8. package/dist/cjs/patches/index.cjs.map +1 -1
  9. package/dist/cjs/patches/register.cjs +4 -31
  10. package/dist/cjs/patches/register.cjs.map +1 -1
  11. package/dist/cjs/propAccess.cjs.map +1 -1
  12. package/dist/cjs/react/index.cjs +13 -12
  13. package/dist/cjs/react/index.cjs.map +1 -1
  14. package/dist/cjs/react/register.cjs +8 -23
  15. package/dist/cjs/react/register.cjs.map +1 -1
  16. package/dist/cjs/scope.cjs +0 -3
  17. package/dist/cjs/scope.cjs.map +1 -1
  18. package/dist/cjs/store.cjs +9 -51
  19. package/dist/cjs/store.cjs.map +1 -1
  20. package/dist/cjs/{useCache.cjs → storeMethods.cjs} +73 -50
  21. package/dist/cjs/storeMethods.cjs.map +1 -0
  22. package/dist/cjs/urlStore.cjs.map +1 -1
  23. package/dist/es/autobind.mjs +42 -0
  24. package/dist/es/autobind.mjs.map +1 -0
  25. package/dist/es/index.mjs +8 -8
  26. package/dist/es/index.mjs.map +1 -1
  27. package/dist/es/mutative/register.mjs +2 -0
  28. package/dist/es/mutative/register.mjs.map +1 -1
  29. package/dist/es/mutativeMethods.mjs.map +1 -1
  30. package/dist/es/patches/index.mjs.map +1 -1
  31. package/dist/es/patches/register.mjs +4 -32
  32. package/dist/es/patches/register.mjs.map +1 -1
  33. package/dist/es/propAccess.mjs.map +1 -1
  34. package/dist/es/react/index.mjs +10 -9
  35. package/dist/es/react/index.mjs.map +1 -1
  36. package/dist/es/react/register.mjs +6 -21
  37. package/dist/es/react/register.mjs.map +1 -1
  38. package/dist/es/scope.mjs +1 -4
  39. package/dist/es/scope.mjs.map +1 -1
  40. package/dist/es/store.mjs +14 -56
  41. package/dist/es/store.mjs.map +1 -1
  42. package/dist/es/{useCache.mjs → storeMethods.mjs} +77 -54
  43. package/dist/es/storeMethods.mjs.map +1 -0
  44. package/dist/es/urlStore.mjs.map +1 -1
  45. package/dist/types/core/cache.d.ts +1 -4
  46. package/dist/types/core/store.d.ts +5 -5
  47. package/dist/types/lib/autobind.d.ts +1 -1
  48. package/dist/types/lib/debounce.d.ts +5 -4
  49. package/dist/types/lib/deferred.d.ts +1 -1
  50. package/dist/types/lib/promiseWithState.d.ts +1 -1
  51. package/dist/types/lib/standardMethods.d.ts +1 -7
  52. package/dist/types/lib/trackingProxy.d.ts +1 -2
  53. package/dist/types/patches/register.d.ts +0 -2
  54. package/dist/types/react/cacheMethods.d.ts +5 -0
  55. package/dist/types/react/form/customInput.d.ts +1 -1
  56. package/dist/types/react/form/form.d.ts +6 -6
  57. package/dist/types/react/form/formField.d.ts +1 -1
  58. package/dist/types/react/form/formForEach.d.ts +1 -1
  59. package/dist/types/react/index.d.ts +3 -1
  60. package/dist/types/react/loadingBoundary.d.ts +1 -1
  61. package/dist/types/react/register.d.ts +4 -18
  62. package/dist/types/react/scope.d.ts +2 -5
  63. package/dist/types/react/scopeMethods.d.ts +9 -0
  64. package/dist/types/react/{reactMethods.d.ts → storeMethods.d.ts} +3 -4
  65. package/package.json +3 -2
  66. package/dist/cjs/useCache.cjs.map +0 -1
  67. package/dist/es/useCache.mjs.map +0 -1
@@ -1 +1 @@
1
- {"version":3,"file":"urlStore.mjs","sources":["../../src/core/urlStore.ts"],"sourcesContent":["import { type Cancel } from './commonTypes';\nimport { createStore, type Store, type StoreOptions } from './store';\n\nexport interface UrlStoreOptions<T> extends StoreOptions {\n key: string;\n type?: 'search' | 'hash';\n serialize?: (value: T) => string;\n deserialize?: (value: string) => T;\n defaultValue?: T;\n onCommit?: (value: T | undefined) => void;\n}\n\nexport interface UrlStoreOptionsWithDefaults<T> extends UrlStoreOptions<T> {\n defaultValue: T;\n}\n\nexport type UrlStoreOptionsRequired<T> = UrlStoreOptions<T> &\n Required<Pick<UrlStoreOptions<T>, 'type' | 'serialize' | 'deserialize' | 'defaultValue'>>;\n\nconst urlStore = createStore(() => (typeof window !== 'undefined' ? window.location.href : ''));\n\nurlStore.addEffect(() => {\n const originalPushState = window.history.pushState;\n const originalReplaceState = window.history.replaceState;\n\n const update = () => {\n urlStore.set(window.location.href);\n };\n\n window.history.pushState = (...args) => {\n originalPushState.apply(window.history, args);\n update();\n };\n\n window.history.replaceState = (...args) => {\n originalReplaceState.apply(window.history, args);\n update();\n };\n\n window.addEventListener('popstate', update);\n\n return () => {\n window.history.pushState = originalPushState;\n window.history.replaceState = originalReplaceState;\n window.removeEventListener('popstate', update);\n };\n});\n\nexport function updateUrlStore() {\n urlStore.set(window.location.href);\n}\n\nexport function connectUrl<T>(store: Store<T>, options: UrlStoreOptionsWithDefaults<T>): Cancel;\n\nexport function connectUrl<T>(store: Store<T | undefined>, options: UrlStoreOptions<T>): Cancel;\n\nexport function connectUrl<T>(\n store: Store<T>,\n {\n key,\n type = 'search',\n serialize = defaultSerializer,\n deserialize = defaultDeserializer,\n defaultValue = undefined as T,\n onCommit,\n }: UrlStoreOptions<T>,\n): Cancel {\n const serializedDefaultValue = serialize(defaultValue);\n\n const cancelUrlListener = urlStore.subscribe((_url) => {\n const url = new URL(_url);\n const parameters = new URLSearchParams(url[type].slice(1));\n const urlValue = parameters.get(key);\n\n store.set(urlValue !== null ? deserialize(urlValue) : defaultValue);\n });\n\n const cancelSubscription = store.subscribe((value) => {\n const url = new URL(window.location.href);\n const parameters = new URLSearchParams(url[type].slice(1));\n const serializedValue = value !== undefined ? serialize(value) : undefined;\n\n if (serializedValue === undefined || serializedValue === serializedDefaultValue) {\n parameters.delete(key);\n } else {\n parameters.set(key, serializedValue);\n }\n\n url[type] = parameters.toString();\n\n window.history.replaceState(window.history.state, '', url.toString());\n window.dispatchEvent(new PopStateEvent('popstate'));\n\n onCommit?.(value);\n });\n\n return () => {\n cancelUrlListener();\n cancelSubscription();\n };\n}\n\nfunction defaultDeserializer(value: string): any {\n if (value === undefined) {\n return undefined;\n }\n\n try {\n return JSON.parse(value, (_k, v) => {\n if (typeof v === 'object' && v !== null && '__set' in v) {\n return new Set(v.__set);\n }\n if (typeof v === 'object' && v !== null && '__map' in v) {\n return new Map(v.__map);\n }\n return v;\n });\n } catch {\n return undefined;\n }\n}\n\nfunction defaultSerializer(value: any): string {\n return JSON.stringify(value, (_k, v) => {\n if (v instanceof Set) {\n return { __set: Array.from(v) };\n }\n if (v instanceof Map) {\n return { __map: Array.from(v) };\n }\n return v;\n });\n}\n\nexport function createUrlStore<T>(options: UrlStoreOptionsWithDefaults<T>): Store<T>;\n\nexport function createUrlStore<T>(options: UrlStoreOptions<T>): Store<T | undefined>;\n\nexport function createUrlStore<T>(options: UrlStoreOptions<T>) {\n const store = createStore(options.defaultValue, options);\n connectUrl(store, options);\n return store;\n}\n"],"names":[],"mappings":";AAmBA,MAAM,WAAW,YAAY,MAAO,OAAO,WAAW,cAAc,OAAO,SAAS,OAAO,EAAG;AAE9F,SAAS,UAAU,MAAM;AACjB,QAAA,oBAAoB,OAAO,QAAQ;AACnC,QAAA,uBAAuB,OAAO,QAAQ;AAE5C,QAAM,SAAS,MAAM;AACV,aAAA,IAAI,OAAO,SAAS,IAAI;AAAA,EAAA;AAG5B,SAAA,QAAQ,YAAY,IAAI,SAAS;AACpB,sBAAA,MAAM,OAAO,SAAS,IAAI;AACrC;EAAA;AAGF,SAAA,QAAQ,eAAe,IAAI,SAAS;AACpB,yBAAA,MAAM,OAAO,SAAS,IAAI;AACxC;EAAA;AAGF,SAAA,iBAAiB,YAAY,MAAM;AAE1C,SAAO,MAAM;AACX,WAAO,QAAQ,YAAY;AAC3B,WAAO,QAAQ,eAAe;AACvB,WAA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,MAAM,YAAY,MAAM,QAAQ,WAAW,GAAG;AAChD,eAAA,IAAI,IAAI,EAAE,KAAK;AAAA,MACxB;AACA,UAAI,OAAO,MAAM,YAAY,MAAM,QAAQ,WAAW,GAAG;AAChD,eAAA,IAAI,IAAI,EAAE,KAAK;AAAA,MACxB;AACO,aAAA;AAAA,IAAA,CACR;AAAA,EAAA,QACK;AACC,WAAA;AAAA,EACT;AACF;AAEA,SAAS,kBAAkB,OAAoB;AAC7C,SAAO,KAAK,UAAU,OAAO,CAAC,IAAI,MAAM;AACtC,QAAI,aAAa,KAAK;AACpB,aAAO,EAAE,OAAO,MAAM,KAAK,CAAC,EAAE;AAAA,IAChC;AACA,QAAI,aAAa,KAAK;AACpB,aAAO,EAAE,OAAO,MAAM,KAAK,CAAC,EAAE;AAAA,IAChC;AACO,WAAA;AAAA,EAAA,CACR;AACH;AAMO,SAAS,eAAkB,SAA6B;AAC7D,QAAM,QAAQ,YAAY,QAAQ,cAAc,OAAO;AACvD,aAAW,OAAO,OAAO;AAClB,SAAA;AACT;"}
1
+ {"version":3,"file":"urlStore.mjs","sources":["../../src/core/urlStore.ts"],"sourcesContent":["import { type Cancel } from './commonTypes';\nimport { createStore, type Store, type StoreOptions } from './store';\n\nexport interface UrlStoreOptions<T> extends StoreOptions {\n key: string;\n type?: 'search' | 'hash';\n serialize?: (value: T) => string;\n deserialize?: (value: string) => T;\n defaultValue?: T;\n onCommit?: (value: T | undefined) => void;\n}\n\nexport interface UrlStoreOptionsWithDefaults<T> extends UrlStoreOptions<T> {\n defaultValue: T;\n}\n\nexport type UrlStoreOptionsRequired<T> = UrlStoreOptions<T> &\n Required<Pick<UrlStoreOptions<T>, 'type' | 'serialize' | 'deserialize' | 'defaultValue'>>;\n\nconst urlStore = createStore(() => (typeof window !== 'undefined' ? window.location.href : ''));\n\nurlStore.addEffect(() => {\n const originalPushState = window.history.pushState;\n const originalReplaceState = window.history.replaceState;\n\n const update = () => {\n urlStore.set(window.location.href);\n };\n\n window.history.pushState = (...args) => {\n originalPushState.apply(window.history, args);\n update();\n };\n\n window.history.replaceState = (...args) => {\n originalReplaceState.apply(window.history, args);\n update();\n };\n\n window.addEventListener('popstate', update);\n\n return () => {\n window.history.pushState = originalPushState;\n window.history.replaceState = originalReplaceState;\n window.removeEventListener('popstate', update);\n };\n});\n\nexport function updateUrlStore(): void {\n urlStore.set(window.location.href);\n}\n\nexport function connectUrl<T>(store: Store<T>, options: UrlStoreOptionsWithDefaults<T>): Cancel;\n\nexport function connectUrl<T>(store: Store<T | undefined>, options: UrlStoreOptions<T>): Cancel;\n\nexport function connectUrl<T>(\n store: Store<T>,\n {\n key,\n type = 'search',\n serialize = defaultSerializer,\n deserialize = defaultDeserializer,\n defaultValue = undefined as T,\n onCommit,\n }: UrlStoreOptions<T>,\n): Cancel {\n const serializedDefaultValue = serialize(defaultValue);\n\n const cancelUrlListener = urlStore.subscribe((_url) => {\n const url = new URL(_url);\n const parameters = new URLSearchParams(url[type].slice(1));\n const urlValue = parameters.get(key);\n\n store.set(urlValue !== null ? deserialize(urlValue) : defaultValue);\n });\n\n const cancelSubscription = store.subscribe((value) => {\n const url = new URL(window.location.href);\n const parameters = new URLSearchParams(url[type].slice(1));\n const serializedValue = value !== undefined ? serialize(value) : undefined;\n\n if (serializedValue === undefined || serializedValue === serializedDefaultValue) {\n parameters.delete(key);\n } else {\n parameters.set(key, serializedValue);\n }\n\n url[type] = parameters.toString();\n\n window.history.replaceState(window.history.state, '', url.toString());\n window.dispatchEvent(new PopStateEvent('popstate'));\n\n onCommit?.(value);\n });\n\n return () => {\n cancelUrlListener();\n cancelSubscription();\n };\n}\n\nfunction defaultDeserializer(value: string): any {\n if (value === undefined) {\n return undefined;\n }\n\n try {\n return JSON.parse(value, (_k, v) => {\n if (typeof v === 'object' && v !== null && '__set' in v) {\n return new Set(v.__set);\n }\n if (typeof v === 'object' && v !== null && '__map' in v) {\n return new Map(v.__map);\n }\n return v;\n });\n } catch {\n return undefined;\n }\n}\n\nfunction defaultSerializer(value: any): string {\n return JSON.stringify(value, (_k, v) => {\n if (v instanceof Set) {\n return { __set: Array.from(v) };\n }\n if (v instanceof Map) {\n return { __map: Array.from(v) };\n }\n return v;\n });\n}\n\nexport function createUrlStore<T>(options: UrlStoreOptionsWithDefaults<T>): Store<T>;\n\nexport function createUrlStore<T>(options: UrlStoreOptions<T>): Store<T | undefined>;\n\nexport function createUrlStore<T>(options: UrlStoreOptions<T>) {\n const store = createStore(options.defaultValue, options);\n connectUrl(store, options);\n return store;\n}\n"],"names":[],"mappings":";AAmBA,MAAM,WAAW,YAAY,MAAO,OAAO,WAAW,cAAc,OAAO,SAAS,OAAO,EAAG;AAE9F,SAAS,UAAU,MAAM;AACjB,QAAA,oBAAoB,OAAO,QAAQ;AACnC,QAAA,uBAAuB,OAAO,QAAQ;AAE5C,QAAM,SAAS,MAAM;AACV,aAAA,IAAI,OAAO,SAAS,IAAI;AAAA,EAAA;AAG5B,SAAA,QAAQ,YAAY,IAAI,SAAS;AACpB,sBAAA,MAAM,OAAO,SAAS,IAAI;AACrC;EAAA;AAGF,SAAA,QAAQ,eAAe,IAAI,SAAS;AACpB,yBAAA,MAAM,OAAO,SAAS,IAAI;AACxC;EAAA;AAGF,SAAA,iBAAiB,YAAY,MAAM;AAE1C,SAAO,MAAM;AACX,WAAO,QAAQ,YAAY;AAC3B,WAAO,QAAQ,eAAe;AACvB,WAAA,oBAAoB,YAAY,MAAM;AAAA,EAAA;AAEjD,CAAC;AAEM,SAAS,iBAAuB;AAC5B,WAAA,IAAI,OAAO,SAAS,IAAI;AACnC;AAMO,SAAS,WACd,OACA;AAAA,EACE;AAAA,EACA,OAAO;AAAA,EACP,YAAY;AAAA,EACZ,cAAc;AAAA,EACd,eAAe;AAAA,EACf;AACF,GACQ;AACF,QAAA,yBAAyB,UAAU,YAAY;AAErD,QAAM,oBAAoB,SAAS,UAAU,CAAC,SAAS;AAC/C,UAAA,MAAM,IAAI,IAAI,IAAI;AAClB,UAAA,aAAa,I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,aAAO,EAAE,OAAO,MAAM,KAAK,CAAC,EAAE;AAAA,IAChC;AACA,QAAI,aAAa,KAAK;AACpB,aAAO,EAAE,OAAO,MAAM,KAAK,CAAC,EAAE;AAAA,IAChC;AACO,WAAA;AAAA,EAAA,CACR;AACH;AAMO,SAAS,eAAkB,SAA6B;AAC7D,QAAM,QAAQ,YAAY,QAAQ,cAAc,OAAO;AACvD,aAAW,OAAO,OAAO;AAClB,SAAA;AACT;"}
@@ -25,10 +25,7 @@ export declare class Cache<T> extends Store<Promise<T>> {
25
25
  cache: Cache<any>;
26
26
  selectors: (Selector<any, any> | Path<any>)[];
27
27
  } | undefined;
28
- readonly state: Store<CacheState<T>> & Omit<ThisType<Store<CacheState<T>>>, keyof Store<T_1>> & {
29
- delete<T_2 extends Record<any, any>, K extends import("../lib/typeHelpers").OptionalPropertyOf<T_2>>(this: Store<T_2>, key: K): void;
30
- clear<T_3 extends Record<any, any>>(this: Store<Partial<T_3>>): void;
31
- };
28
+ readonly state: Store<CacheState<T>>;
32
29
  protected stalePromise?: Promise<T>;
33
30
  protected invalidationTimer?: ReturnType<typeof setTimeout>;
34
31
  constructor(getter: Calculate<Promise<T>>, options?: CacheOptions<T>, derivedFromCache?: {
@@ -31,11 +31,11 @@ export declare class Store<T> extends Callable<any, any> {
31
31
  protected readonly _call: (...args: any[]) => any;
32
32
  protected calculatedValue?: CalculatedValue<T>;
33
33
  protected defaultValue?: CalculatedValue<T>;
34
- protected listeners: Map<Listener<void>, boolean>;
34
+ protected listeners: Map<Listener, boolean>;
35
35
  protected effects: Map<Effect, {
36
- handle?: Cancel | undefined;
37
- retain?: number | undefined;
38
- timeout?: number | undefined;
36
+ handle?: Cancel;
37
+ retain?: number;
38
+ timeout?: ReturnType<typeof setTimeout>;
39
39
  }>;
40
40
  protected notifyId: {};
41
41
  constructor(getter: T | Calculate<T>, options?: StoreOptions, derivedFrom?: {
@@ -63,7 +63,7 @@ export declare class Store<T> extends Callable<any, any> {
63
63
  * @returns
64
64
  * The effect can return a teardown callback, which will be executed when the last subscription is removed and potentially the ratain time has passed.
65
65
  */
66
- addEffect(effect: Effect, retain?: Duration | undefined): () => void;
66
+ addEffect(effect: Effect, retain?: Duration | undefined): Cancel;
67
67
  /** Return whether the store is currently active, which means whether it has at least one subscriber. */
68
68
  isActive(): boolean;
69
69
  protected onSubscribe(): void;
@@ -1 +1 @@
1
- export declare const autobind: <TClass extends abstract new (...args: any) => any = abstract new (...args: any) => any>(_class: TClass, _context?: ClassDecoratorContext<TClass>) => TClass;
1
+ export declare const autobind: <TClass extends abstract new (...args: any) => any = abstract new (...args: any) => any>(_class: TClass) => TClass;
@@ -3,8 +3,9 @@ export type DebounceOptions = Duration | {
3
3
  wait: Duration;
4
4
  maxWait?: Duration;
5
5
  };
6
- export declare function debounce<Args extends any[]>(action: (...args: Args) => void, options: Duration | DebounceOptions): ((...args: Args) => void) & {
7
- flush: () => void;
8
- cancel: () => void;
9
- isScheduled: () => boolean;
6
+ export declare function debounce<Args extends any[]>(action: (...args: Args) => void, options: Duration | DebounceOptions): {
7
+ (...args: Args): void;
8
+ flush(): void;
9
+ cancel(): void;
10
+ isScheduled(): boolean;
10
11
  };
@@ -1,5 +1,5 @@
1
1
  export declare class Deferred<T = void> extends Promise<T> {
2
- static get [Symbol.species](): PromiseConstructor;
2
+ static get [Symbol.species](): typeof Promise;
3
3
  resolve: (value: T | PromiseLike<T>) => void;
4
4
  reject: (reason?: any) => void;
5
5
  constructor();
@@ -2,7 +2,7 @@ import { type ErrorState, type PendingState, type ValueState } from './cacheStat
2
2
  import { type MaybePromise } from './maybePromise';
3
3
  export declare class PromiseWithState<T> extends Promise<T> {
4
4
  state: ValueState<T> | ErrorState | PendingState;
5
- static get [Symbol.species](): PromiseConstructor;
5
+ static get [Symbol.species](): typeof Promise;
6
6
  static resolve(): PromiseWithState<void>;
7
7
  static resolve<T>(value: MaybePromise<T>): PromiseWithState<T>;
8
8
  static reject<T = never>(error: unknown): PromiseWithState<T>;
@@ -2,13 +2,7 @@ import type { Store } from '../core/store';
2
2
  import type { OptionalPropertyOf } from './typeHelpers';
3
3
  type Function_ = (...args: any) => any;
4
4
  export declare const arrayMethods: {
5
- splice: <T extends any[]>(this: Store<T>, ...args: T["splice"] extends Function_ ? Parameters<T["splice"]> : never) => T["splice"] extends Function_ ? ReturnType<T["splice"]> : never;
6
- push: <T_1 extends any[]>(this: Store<T_1>, ...args: T_1["push"] extends Function_ ? Parameters<T_1["push"]> : never) => T_1["push"] extends Function_ ? ReturnType<T_1["push"]> : never;
7
- pop: <T_2 extends any[]>(this: Store<T_2>, ...args: T_2["pop"] extends Function_ ? Parameters<T_2["pop"]> : never) => T_2["pop"] extends Function_ ? ReturnType<T_2["pop"]> : never;
8
- shift: <T_3 extends any[]>(this: Store<T_3>, ...args: T_3["shift"] extends Function_ ? Parameters<T_3["shift"]> : never) => T_3["shift"] extends Function_ ? ReturnType<T_3["shift"]> : never;
9
- unshift: <T_4 extends any[]>(this: Store<T_4>, ...args: T_4["unshift"] extends Function_ ? Parameters<T_4["unshift"]> : never) => T_4["unshift"] extends Function_ ? ReturnType<T_4["unshift"]> : never;
10
- reverse: <T_5 extends any[]>(this: Store<T_5>, ...args: T_5["reverse"] extends Function_ ? Parameters<T_5["reverse"]> : never) => T_5["reverse"] extends Function_ ? ReturnType<T_5["reverse"]> : never;
11
- sort: <T_6 extends any[]>(this: Store<T_6>, ...args: T_6["sort"] extends Function_ ? Parameters<T_6["sort"]> : never) => T_6["sort"] extends Function_ ? ReturnType<T_6["sort"]> : never;
5
+ [P in 'splice' | 'push' | 'pop' | 'shift' | 'unshift' | 'reverse' | 'sort']: <T extends Array<any>>(this: Store<T>, ...args: T[P] extends Function_ ? Parameters<T[P]> : never) => T[P] extends Function_ ? ReturnType<T[P]> : never;
12
6
  };
13
7
  export declare const recordMethods: {
14
8
  delete<T extends Record<any, any>, K extends OptionalPropertyOf<T>>(this: Store<T>, key: K): void;
@@ -1,3 +1,2 @@
1
- import { deepEqual } from './equals';
2
1
  export type TrackingProxy<T> = [value: T, equals: (newValue: T) => boolean, revoke?: () => void];
3
- export declare function trackingProxy<T>(value: T, equals?: typeof deepEqual): TrackingProxy<T>;
2
+ export declare function trackingProxy<T>(value: T, equals?: (a: any, b: any) => boolean): TrackingProxy<T>;
@@ -4,6 +4,4 @@ declare module '../core' {
4
4
  interface Store<T> extends PatchMethods {
5
5
  }
6
6
  }
7
- export declare function register(): void;
8
- export declare function unregister(): void;
9
7
  export {};
@@ -0,0 +1,5 @@
1
+ import type { Cache } from '../core';
2
+ import { type UseCacheOptions, type UseCacheValue } from '../react/useCache';
3
+ export declare const cacheMethods: {
4
+ useCache<T>(this: Cache<T>, options?: UseCacheOptions<T>): UseCacheValue<T>;
5
+ };
@@ -3,4 +3,4 @@ export interface CustomInputProps extends React.HTMLAttributes<HTMLDivElement> {
3
3
  name: string;
4
4
  children?: ReactNode;
5
5
  }
6
- export declare function CustomInput({ name, children, ...props }: CustomInputProps): import("react/jsx-runtime").JSX.Element;
6
+ export declare function CustomInput({ name, children, ...props }: CustomInputProps): JSX.Element;
@@ -1,7 +1,7 @@
1
1
  import { type Store, type UrlStoreOptions } from '../../core';
2
2
  import { type Path, type PathAsString, type Value, type WildcardPathAsString, type WildcardValue } from '../../lib/path';
3
3
  import type { Object_ } from '../../lib/typeHelpers';
4
- import { type FormEvent, type HTMLProps, type ReactNode } from 'react';
4
+ import { type Context, type FormEvent, type FunctionComponent, type HTMLProps, type ReactNode } from 'react';
5
5
  import { type UseStoreOptions } from '../useStore';
6
6
  import { type FormFieldComponent, type FormFieldPropsWithComponent, type FormFieldPropsWithRender } from './formField';
7
7
  import { type ElementName, type ForEachPath, type FormForEachProps } from './formForEach';
@@ -74,7 +74,7 @@ export interface FormInstance<TDraft, TOriginal> extends FormDerivedState<TDraft
74
74
  }
75
75
  export declare class Form<TDraft, TOriginal extends TDraft = TDraft> {
76
76
  readonly options: FormOptions<TDraft, TOriginal>;
77
- context: import("react").Context<FormContext<TDraft, TOriginal> | null>;
77
+ context: Context<FormContext<TDraft, TOriginal> | null>;
78
78
  constructor(options: FormOptions<TDraft, TOriginal>);
79
79
  useForm(): FormContext<TDraft, TOriginal>;
80
80
  useFormState<S>(selector: (state: FormInstance<TDraft, TOriginal>) => S, useStoreOptions?: UseStoreOptions<S>): S;
@@ -82,14 +82,14 @@ export declare class Form<TDraft, TOriginal extends TDraft = TDraft> {
82
82
  Form({ original, defaultValue, validations, localizeError, urlState, autoSave, transform, ...formProps }: {
83
83
  original?: TOriginal;
84
84
  onSubmit?: (event: FormEvent<HTMLFormElement>, form: FormInstance<TDraft, TOriginal>) => void;
85
- } & Partial<FormOptions<TDraft, TOriginal>> & Omit<HTMLProps<HTMLFormElement>, 'defaultValue' | 'autoSave' | 'onSubmit'>): import("react/jsx-runtime").JSX.Element;
85
+ } & Partial<FormOptions<TDraft, TOriginal>> & Omit<HTMLProps<HTMLFormElement>, 'defaultValue' | 'autoSave' | 'onSubmit'>): JSX.Element;
86
86
  FormState<S>({ selector, children, }: {
87
87
  selector: (form: FormInstance<TDraft, TOriginal>) => S;
88
88
  children: (selectedState: S) => ReactNode;
89
- }): import("react/jsx-runtime").JSX.Element;
89
+ }): JSX.Element;
90
90
  Field<TPath extends PathAsString<TDraft>>(props: FormFieldPropsWithRender<TDraft, TPath>): JSX.Element;
91
91
  Field<const TPath extends PathAsString<TDraft>, const TComponent extends FormFieldComponent = 'input'>(props: FormFieldPropsWithComponent<TDraft, TPath, TComponent>): JSX.Element;
92
- ForEach<TPath extends ForEachPath<TDraft>>(props: FormForEachProps<TDraft, TPath>): any;
93
- withForm<TProps extends Record<string, unknown>>(Component: React.ComponentType<TProps>, formProps?: Parameters<this['Form']>[0]): (props: TProps) => import("react/jsx-runtime").JSX.Element;
92
+ ForEach<TPath extends ForEachPath<TDraft>>(props: FormForEachProps<TDraft, TPath>): JSX.Element;
93
+ withForm<TProps extends Record<string, unknown>>(Component: React.ComponentType<TProps>, formProps?: Parameters<this['Form']>[0]): FunctionComponent<TProps>;
94
94
  }
95
95
  export declare function createForm<TDraft, TOriginal extends TDraft = TDraft>(options: FormOptions<TDraft, TOriginal>): Form<TDraft, TOriginal>;
@@ -59,5 +59,5 @@ export type FormFieldPropsWithComponent<TDraft, TPath extends PathAsString<TDraf
59
59
  } : {
60
60
  deserialize: (value: FieldChangeValue<TComponent>) => Value<TDraft, TPath>;
61
61
  });
62
- export declare function FormField<TDraft, TPath extends PathAsString<TDraft>, TComponent extends FormFieldComponent>(this: Form<TDraft, any>, { name, component, commitOnBlur, commitDebounce, render, inputFilter, defaultValue, serialize, deserialize, ...restProps }: FormFieldPropsWithRender<TDraft, TPath> | FormFieldPropsWithComponent<TDraft, TPath, TComponent>): string | number | boolean | import("react").ReactElement<any, string | import("react").JSXElementConstructor<any>> | Iterable<ReactNode> | null;
62
+ export declare function FormField<TDraft, TPath extends PathAsString<TDraft>, TComponent extends FormFieldComponent>(this: Form<TDraft, any>, { name, component, commitOnBlur, commitDebounce, render, inputFilter, defaultValue, serialize, deserialize, ...restProps }: FormFieldPropsWithRender<TDraft, TPath> | FormFieldPropsWithComponent<TDraft, TPath, TComponent>): JSX.Element | null;
63
63
  export {};
@@ -15,4 +15,4 @@ export interface FormForEachProps<TDraft, TPath extends ForEachPath<TDraft>> {
15
15
  setValue: (value: Value<TDraft, TPath> | ((value: Value<TDraft, TPath>) => Value<TDraft, TPath>)) => void;
16
16
  } & FieldHelperMethods<TDraft, TPath>) => ReactNode;
17
17
  }
18
- export declare function FormForEach<TDraft, TPath extends ForEachPath<TDraft>>(this: Form<TDraft, any>, { name, renderElement, children }: FormForEachProps<TDraft, TPath>): import("react/jsx-runtime").JSX.Element;
18
+ export declare function FormForEach<TDraft, TPath extends ForEachPath<TDraft>>(this: Form<TDraft, any>, { name, renderElement, children }: FormForEachProps<TDraft, TPath>): JSX.Element;
@@ -1,7 +1,9 @@
1
+ export { cacheMethods } from './cacheMethods';
1
2
  export * from './form';
2
3
  export { LoadingBoundary, useLoadingBoundary, type LoadingBoundaryEntry, type LoadingBoundaryProps, } from './loadingBoundary';
3
- export { reactMethods } from './reactMethods';
4
4
  export { ScopeProvider, useScope, type ScopeProps } from './scope';
5
+ export { scopeMethods } from './scopeMethods';
6
+ export { storeMethods } from './storeMethods';
5
7
  export { useCache, type UseCacheArray, type UseCacheValue } from './useCache';
6
8
  export { useDecoupledState, type UseDecoupledStateOptions } from './useDecoupledState';
7
9
  export { useProp } from './useProp';
@@ -17,5 +17,5 @@ export interface LoadingBoundaryProps {
17
17
  */
18
18
  isLoading?: boolean;
19
19
  }
20
- export declare function LoadingBoundary({ fallback, children, isLoading: isLoadingExternal, }: LoadingBoundaryProps): import("react/jsx-runtime").JSX.Element;
20
+ export declare function LoadingBoundary({ fallback, children, isLoading: isLoadingExternal, }: LoadingBoundaryProps): JSX.Element;
21
21
  export declare function useLoadingBoundary(isLoading: boolean | undefined, label?: ReactNode): void;
@@ -1,9 +1,7 @@
1
- import { Cache, Scope, Store } from '../core';
2
- import { reactMethods } from './reactMethods';
3
- import { type ScopeProps } from './scope';
4
- import { type UseCacheOptions } from './useCache';
5
- import { type UseStoreOptions } from './useStore';
6
- type StoreMethods = typeof reactMethods;
1
+ import { cacheMethods } from '../react/cacheMethods';
2
+ import { scopeMethods } from '../react/scopeMethods';
3
+ import { storeMethods } from './storeMethods';
4
+ type StoreMethods = typeof storeMethods;
7
5
  type CacheMethods = typeof cacheMethods;
8
6
  type ScopeMethods = typeof scopeMethods;
9
7
  declare module '../core' {
@@ -14,16 +12,4 @@ declare module '../core' {
14
12
  interface Scope<T> extends ScopeMethods {
15
13
  }
16
14
  }
17
- declare const cacheMethods: {
18
- useCache<T>(this: Cache<T>, options?: UseCacheOptions<T>): import("./useCache").UseCacheValue<T>;
19
- };
20
- declare const scopeMethods: {
21
- useScope<T>(this: Scope<T>): Store<T>;
22
- useStore<T_1>(this: Scope<T_1>, options?: UseStoreOptions<T_1> | undefined): T_1;
23
- useProp<T_2>(this: Scope<T_2>, options?: UseStoreOptions<T_2> | undefined): [value: T_2, setValue: {
24
- (update: import("../core").Update<T_2>): void;
25
- <const P extends import("..").Path<T_2>>(path: P, update: import("../core").Update<import("..").Value<T_2, P>>): void;
26
- }];
27
- Provider<T_3>(this: Scope<T_3>, props: Omit<ScopeProps<T_3>, "scope">): import("react/jsx-runtime").JSX.Element;
28
- };
29
15
  export {};
@@ -12,10 +12,7 @@ declare module '../core' {
12
12
  context?: Context<Store<T>>;
13
13
  }
14
14
  }
15
- export declare function ScopeProvider<T>({ scope, store: inputStore, children }: ScopeProps<T>): import("react/jsx-runtime").JSX.Element;
15
+ export declare function ScopeProvider<T>({ scope, store: inputStore, children, }: ScopeProps<T>): JSX.Element;
16
16
  export declare function useScope<T>(scope: Scope<T>): Store<T>;
17
17
  export declare function useScopeStore<T>(scope: Scope<T>, options?: UseStoreOptions<T>): T;
18
- export declare function useScopeProp<T>(scope: Scope<T>, options?: UseStoreOptions<T>): [value: T, setValue: {
19
- (update: import("../core").Update<T>): void;
20
- <const P extends import("..").Path<T>>(path: P, update: import("../core").Update<import("..").Value<T, P>>): void;
21
- }];
18
+ export declare function useScopeProp<T>(scope: Scope<T>, options?: UseStoreOptions<T>): [value: T, setValue: Store<T>['set']];
@@ -0,0 +1,9 @@
1
+ import type { Scope, Store } from '../core';
2
+ import { type ScopeProps } from '../react/scope';
3
+ import type { UseStoreOptions } from '../react/useStore';
4
+ export declare const scopeMethods: {
5
+ useScope<T>(this: Scope<T>): Store<T>;
6
+ useStore<T_1>(this: Scope<T_1>, options?: UseStoreOptions<T_1>): T_1;
7
+ useProp<T_2>(this: Scope<T_2>, options?: UseStoreOptions<T_2>): [value: T_2, setValue: Store<T_2>["set"]];
8
+ Provider<T_3>(this: Scope<T_3>, props: Omit<ScopeProps<T_3>, "scope">): JSX.Element;
9
+ };
@@ -1,14 +1,13 @@
1
- import type { Selector, Update } from '../core/commonTypes';
2
- import type { Store } from '../core/store';
1
+ import type { Selector, Store, Update } from '../core';
3
2
  import type { Path, Value } from '../lib/path';
4
- import { type UseStoreOptions } from './useStore';
3
+ import { type UseStoreOptions } from '../react/useStore';
5
4
  declare function boundUseStore<T, S>(this: Store<T>, selector: Selector<T, S>, option?: UseStoreOptions<S>): S;
6
5
  declare function boundUseStore<T, P extends Path<T>>(this: Store<T>, selector: P, option?: UseStoreOptions<Value<T, P>>): Value<T, P>;
7
6
  declare function boundUseStore<T>(this: Store<T>, option?: UseStoreOptions<T>): T;
8
7
  declare function boundUseProp<T, S>(this: Store<T>, selector: Selector<T, S>, updater: (value: S) => Update<T>, options?: UseStoreOptions<S>): [value: S, setValue: Store<S>['set']];
9
8
  declare function boundUseProp<T, P extends Path<T>>(this: Store<T>, selector: P, options?: UseStoreOptions<Value<T, P>>): [value: Value<T, P>, setValue: Store<Value<T, P>>['set']];
10
9
  declare function boundUseProp<T>(this: Store<T>, options?: UseStoreOptions<T>): [value: T, setValue: Store<T>['set']];
11
- export declare const reactMethods: {
10
+ export declare const storeMethods: {
12
11
  useStore: typeof boundUseStore;
13
12
  useProp: typeof boundUseProp;
14
13
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "cross-state",
3
- "version": "0.37.7",
3
+ "version": "0.37.9",
4
4
  "description": "(React) state library",
5
5
  "license": "ISC",
6
6
  "repository": "schummar/cross-state",
@@ -141,6 +141,7 @@
141
141
  "@types/ws": "8.5.10",
142
142
  "@vitejs/plugin-react": "4.2.1",
143
143
  "@vitest/coverage-v8": "1.4.0",
144
+ "@vitest/ui": "^1.4.0",
144
145
  "esbuild": "0.20.2",
145
146
  "eslint": "8.57.0",
146
147
  "happy-dom": "14.5.1",
@@ -155,7 +156,7 @@
155
156
  "semantic-release": "23.0.7",
156
157
  "size-limit": "11.1.2",
157
158
  "tsc-alias": "1.8.8",
158
- "typescript": "5.4.4",
159
+ "typescript": "5.5.0-beta",
159
160
  "use-sync-external-store": "1.2.0",
160
161
  "vite": "5.2.8",
161
162
  "vite-tsconfig-paths": "4.3.2",
@@ -1 +0,0 @@
1
- {"version":3,"file":"useCache.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.production.min.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.development.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.production.min.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/shim/with-selector.js","../../src/react/useStore.ts","../../src/react/loadingBoundary.tsx","../../src/react/useProp.ts","../../src/react/reactMethods.ts","../../src/react/scope.tsx","../../src/react/useCache.ts"],"sourcesContent":["import { isPlainObject } from '@lib/helpers';\nimport { 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\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.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","/**\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","'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.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","/**\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","'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 /**\n * If true, the cache content can be consumed but no fetch will be triggered.\n * @default false\n */\n passive?: boolean;\n\n disableTrackingProxy?: boolean;\n\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 = store.options.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 };\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 { createStore } from '@core';\nimport { useStore } from '@react/useStore';\nimport { createContext, useContext, useLayoutEffect, useMemo, type ReactNode } from 'react';\n\nexport interface LoadingBoundaryEntry {\n label?: ReactNode;\n}\n\nexport interface LoadingBoundaryProps {\n /**\n * Fallback node to render when there are loading components within the boundary.\n */\n fallback?: ReactNode | ((entries: LoadingBoundaryEntry[]) => ReactNode);\n\n /**\n * Child node to render when there are no loading components within the boundary.\n */\n children?: ReactNode;\n\n /**\n * Add a loading state from outside the boundary. Useful for when you want to\n * show a loading state for a component that is not a child of the boundary.\n */\n isLoading?: boolean;\n}\n\nconst LoadingBoundaryContext = createContext(createStore(new Set<LoadingBoundaryEntry>()));\n\nexport function LoadingBoundary({\n fallback,\n children,\n isLoading: isLoadingExternal,\n}: LoadingBoundaryProps) {\n const store = useMemo(() => createStore(new Set<LoadingBoundaryEntry>()), []);\n const entries = useStore(store);\n const isLoading = entries.size > 0 || isLoadingExternal;\n\n const fallbackNode = isLoading\n ? typeof fallback === 'function'\n ? fallback([...entries])\n : fallback\n : undefined;\n\n return (\n <LoadingBoundaryContext.Provider value={store}>\n {fallbackNode !== undefined ? (\n <>\n {fallbackNode}\n <div style={{ display: 'none' }}>{children}</div>\n </>\n ) : (\n children\n )}\n </LoadingBoundaryContext.Provider>\n );\n}\n\nexport function useLoadingBoundary(isLoading: boolean | undefined, label?: ReactNode) {\n const store = useContext(LoadingBoundaryContext);\n\n useLayoutEffect(() => {\n if (!isLoading) {\n return;\n }\n\n const entry = { label };\n store.set((entries) => new Set(entries).add(entry));\n\n return () => {\n store.set((entries) => {\n const newEntries = new Set(entries);\n newEntries.delete(entry);\n return newEntries;\n });\n };\n }, [isLoading]);\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 { 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","import type { Cache } from '@core';\nimport type { CacheState } from '@lib/cacheState';\nimport { makeSelector } from '@lib/makeSelector';\nimport { useEffect, useMemo, useRef } from 'react';\nimport type { UseStoreOptions } from './useStore';\nimport { useStore } from './useStore';\nimport { useLoadingBoundary } from '@react/loadingBoundary';\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 /**\n * If true, will always return undefined as value and no fetch will be triggered.\n * @default false\n */\n disabled?: boolean;\n\n /**\n * If true, the cache will be invalidated when the component mounts.\n * @default false\n */\n updateOnMount?: boolean;\n\n /**\n * If true, `useCache` will throw a promise when the cache is pending. This can be used with React Suspense.\n * @see https://react.dev/reference/react/Suspense\n * @default false\n */\n suspense?: boolean;\n\n /**\n * If true, `useCache` will register its loading state with the nearest `LoadingBoundary`.\n * @default true\n */\n loadingBoundary?: boolean;\n}\n\nexport function useCache<T>(\n cache: Cache<T>,\n {\n passive,\n disabled,\n updateOnMount,\n withViewTransition,\n suspense,\n loadingBoundary = true,\n ...options\n }: UseCacheOptions<T> = {},\n): UseCacheValue<T> {\n if (withViewTransition === true) {\n withViewTransition = (state) => state.value;\n }\n\n const { rootCache, selector } = 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, selector };\n }, [cache]);\n\n const hasMounted = useRef(false);\n\n useEffect(() => {\n hasMounted.current = true;\n\n if (updateOnMount) {\n rootCache.invalidate();\n }\n }, []);\n\n const result = useStore(\n rootCache.state,\n (state) => {\n if (disabled) {\n return Object.assign<UseCacheArray<T>, CacheState<T>>(\n [undefined, undefined, false, false],\n { status: 'pending', isUpdating: false, isStale: false, isConnected: false },\n );\n }\n\n const isStale = updateOnMount && !hasMounted.current ? true : state.isStale;\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, isStale],\n { ...state, value, isStale },\n );\n } catch (error) {\n return Object.assign<UseCacheArray<T>, CacheState<T>>(\n [undefined, error, state.isUpdating, isStale],\n {\n status: 'error',\n error,\n isUpdating: state.isUpdating,\n isStale: isStale,\n isConnected: state.isConnected,\n },\n );\n }\n },\n { ...options, withViewTransition, passive: passive || disabled },\n );\n\n useLoadingBoundary(loadingBoundary && !disabled && result.status === 'pending');\n\n if (suspense && result.status === 'pending') {\n throw rootCache.get();\n }\n\n return result;\n}\n"],"names":["deepEqual","isPlainObject","equals","error","shim","shimModule","require$$0","require$$1","a","c","d","b","e","withSelectorModule","store","makeSelector","useRef","useMemo","rootStore","mappingSelector","value","useCallback","hash","useSyncExternalStoreWithSelector","useLayoutEffect","useDebugValue","createContext","createStore","jsx","jsxs","Fragment","useContext","rootCache","selector","useEffect"],"mappings":";;;;;;AAGA,MAAM,2CAA2C,aAAa;AAK9C,SAAA,cAAiB,OAAU,SAASA,sBAA6B;AAC3E,MAAA,CAACC,yBAAc,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,eAA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ACZ,eAAO,OAAO;AAAA,UACZ,CAAC,QAAW,QAAW,OAAO,KAAK;AAAA,UACnC,EAAE,QAAQ,WAAW,YAAY,OAAO,SAAS,OAAO,aAAa,MAAM;AAAA,QAAA;AAAA,MAE/E;AAEA,YAAM,UAAU,iBAAiB,CAAC,WAAW,UAAU,OAAO,MAAM;AAChE,UAAA;AACF,cAAM,QAAQ,MAAM,WAAW,UAAU,SAAS,MAAM,KAAK,IAAI;AAEjE,eAAO,OAAO;AAAA,UACZ,CAAC,OAAO,MAAM,OAAO,MAAM,YAAY,OAAO;AAAA,UAC9C,EAAE,GAAG,OAAO,OAAO,QAAQ;AAAA,QAAA;AAAA,eAEtB,OAAO;AACd,eAAO,OAAO;AAAA,UACZ,CAAC,QAAW,OAAO,MAAM,YAAY,OAAO;AAAA,UAC5C;AAAA,YACE,QAAQ;AAAA,YACR;AAAA,YACA,YAAY,MAAM;AAAA,YAClB;AAAA,YACA,aAAa,MAAM;AAAA,UACrB;AAAA,QAAA;AAAA,MAEJ;AAAA,IACF;AAAA,IACA,EAAE,GAAG,SAAS,oBAAoB,SAAS,WAAW,SAAS;AAAA,EAAA;AAGjE,qBAAmB,mBAAmB,CAAC,YAAY,OAAO,WAAW,SAAS;AAE1E,MAAA,YAAY,OAAO,WAAW,WAAW;AAC3C,UAAM,UAAU;EAClB;AAEO,SAAA;AACT;;;;;;;;;;;","x_google_ignoreList":[1,2,3,4,5,6]}
@@ -1 +0,0 @@
1
- {"version":3,"file":"useCache.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.production.min.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.development.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.production.min.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/shim/with-selector.js","../../src/react/useStore.ts","../../src/react/loadingBoundary.tsx","../../src/react/useProp.ts","../../src/react/reactMethods.ts","../../src/react/scope.tsx","../../src/react/useCache.ts"],"sourcesContent":["import { isPlainObject } from '@lib/helpers';\nimport { 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\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.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","/**\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","'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.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","/**\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","'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 /**\n * If true, the cache content can be consumed but no fetch will be triggered.\n * @default false\n */\n passive?: boolean;\n\n disableTrackingProxy?: boolean;\n\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 = store.options.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 };\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 { createStore } from '@core';\nimport { useStore } from '@react/useStore';\nimport { createContext, useContext, useLayoutEffect, useMemo, type ReactNode } from 'react';\n\nexport interface LoadingBoundaryEntry {\n label?: ReactNode;\n}\n\nexport interface LoadingBoundaryProps {\n /**\n * Fallback node to render when there are loading components within the boundary.\n */\n fallback?: ReactNode | ((entries: LoadingBoundaryEntry[]) => ReactNode);\n\n /**\n * Child node to render when there are no loading components within the boundary.\n */\n children?: ReactNode;\n\n /**\n * Add a loading state from outside the boundary. Useful for when you want to\n * show a loading state for a component that is not a child of the boundary.\n */\n isLoading?: boolean;\n}\n\nconst LoadingBoundaryContext = createContext(createStore(new Set<LoadingBoundaryEntry>()));\n\nexport function LoadingBoundary({\n fallback,\n children,\n isLoading: isLoadingExternal,\n}: LoadingBoundaryProps) {\n const store = useMemo(() => createStore(new Set<LoadingBoundaryEntry>()), []);\n const entries = useStore(store);\n const isLoading = entries.size > 0 || isLoadingExternal;\n\n const fallbackNode = isLoading\n ? typeof fallback === 'function'\n ? fallback([...entries])\n : fallback\n : undefined;\n\n return (\n <LoadingBoundaryContext.Provider value={store}>\n {fallbackNode !== undefined ? (\n <>\n {fallbackNode}\n <div style={{ display: 'none' }}>{children}</div>\n </>\n ) : (\n children\n )}\n </LoadingBoundaryContext.Provider>\n );\n}\n\nexport function useLoadingBoundary(isLoading: boolean | undefined, label?: ReactNode) {\n const store = useContext(LoadingBoundaryContext);\n\n useLayoutEffect(() => {\n if (!isLoading) {\n return;\n }\n\n const entry = { label };\n store.set((entries) => new Set(entries).add(entry));\n\n return () => {\n store.set((entries) => {\n const newEntries = new Set(entries);\n newEntries.delete(entry);\n return newEntries;\n });\n };\n }, [isLoading]);\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 { 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","import type { Cache } from '@core';\nimport type { CacheState } from '@lib/cacheState';\nimport { makeSelector } from '@lib/makeSelector';\nimport { useEffect, useMemo, useRef } from 'react';\nimport type { UseStoreOptions } from './useStore';\nimport { useStore } from './useStore';\nimport { useLoadingBoundary } from '@react/loadingBoundary';\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 /**\n * If true, will always return undefined as value and no fetch will be triggered.\n * @default false\n */\n disabled?: boolean;\n\n /**\n * If true, the cache will be invalidated when the component mounts.\n * @default false\n */\n updateOnMount?: boolean;\n\n /**\n * If true, `useCache` will throw a promise when the cache is pending. This can be used with React Suspense.\n * @see https://react.dev/reference/react/Suspense\n * @default false\n */\n suspense?: boolean;\n\n /**\n * If true, `useCache` will register its loading state with the nearest `LoadingBoundary`.\n * @default true\n */\n loadingBoundary?: boolean;\n}\n\nexport function useCache<T>(\n cache: Cache<T>,\n {\n passive,\n disabled,\n updateOnMount,\n withViewTransition,\n suspense,\n loadingBoundary = true,\n ...options\n }: UseCacheOptions<T> = {},\n): UseCacheValue<T> {\n if (withViewTransition === true) {\n withViewTransition = (state) => state.value;\n }\n\n const { rootCache, selector } = 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, selector };\n }, [cache]);\n\n const hasMounted = useRef(false);\n\n useEffect(() => {\n hasMounted.current = true;\n\n if (updateOnMount) {\n rootCache.invalidate();\n }\n }, []);\n\n const result = useStore(\n rootCache.state,\n (state) => {\n if (disabled) {\n return Object.assign<UseCacheArray<T>, CacheState<T>>(\n [undefined, undefined, false, false],\n { status: 'pending', isUpdating: false, isStale: false, isConnected: false },\n );\n }\n\n const isStale = updateOnMount && !hasMounted.current ? true : state.isStale;\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, isStale],\n { ...state, value, isStale },\n );\n } catch (error) {\n return Object.assign<UseCacheArray<T>, CacheState<T>>(\n [undefined, error, state.isUpdating, isStale],\n {\n status: 'error',\n error,\n isUpdating: state.isUpdating,\n isStale: isStale,\n isConnected: state.isConnected,\n },\n );\n }\n },\n { ...options, withViewTransition, passive: passive || disabled },\n );\n\n useLoadingBoundary(loadingBoundary && !disabled && result.status === 'pending');\n\n if (suspense && result.status === 'pending') {\n throw rootCache.get();\n }\n\n return result;\n}\n"],"names":["equals","useEffect","useLayoutEffect","useDebugValue","error","shim","shimModule","require$$0","require$$1","a","c","d","b","e","useRef","useMemo","withSelectorModule","rootStore","mappingSelector","value","useSyncExternalStoreWithSelector","rootCache","selector"],"mappings":";;;;;AAGA,MAAM,2CAA2C,aAAa;AAK9C,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,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