cross-state 0.56.2 → 1.0.0
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.
- package/dist/{diff-qAkLCsnM.d.ts → diff-CAQaunfv.d.cts} +3 -3
- package/dist/{diff-D7XuntCn.d.cts → diff-DFvRd-Gf.d.ts} +3 -3
- package/dist/{extendedJson-BZkQBXEv.js → extendedJson-Dv9q6rps.js} +2 -2
- package/dist/{extendedJson-BZkQBXEv.js.map → extendedJson-Dv9q6rps.js.map} +1 -1
- package/dist/{extendedJson-Dn2F7Edo.cjs → extendedJson-ursQ8DbQ.cjs} +1 -1
- package/dist/{extendedJson-Dn2F7Edo.cjs.map → extendedJson-ursQ8DbQ.cjs.map} +1 -1
- package/dist/index.cjs +9 -11
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +4 -4
- package/dist/index.d.ts +4 -4
- package/dist/index.js +7 -9
- package/dist/index.js.map +1 -1
- package/dist/mutative/index.cjs +2 -1
- package/dist/mutative/index.d.cts +2 -2
- package/dist/mutative/index.d.ts +2 -2
- package/dist/mutative/index.js +2 -1
- package/dist/mutative/register.cjs +4 -3
- package/dist/mutative/register.cjs.map +1 -1
- package/dist/mutative/register.d.cts +2 -4
- package/dist/mutative/register.d.ts +2 -2
- package/dist/mutative/register.js +4 -3
- package/dist/mutative/register.js.map +1 -1
- package/dist/{mutativeMethods-Be_XPk5N.d.cts → mutativeMethods-BT1Cim3p.d.ts} +3 -3
- package/dist/{mutativeMethods-DRYtjUcH.d.ts → mutativeMethods-C8VcZWED.d.cts} +3 -3
- package/dist/{mutativeMethods-CgXk_bMt.cjs → mutativeMethods-CkNycpO9.cjs} +6 -7
- package/dist/{mutativeMethods-CgXk_bMt.cjs.map → mutativeMethods-CkNycpO9.cjs.map} +1 -1
- package/dist/{mutativeMethods-CZKeRIDL.js → mutativeMethods-Jowr0Znn.js} +4 -6
- package/dist/{mutativeMethods-CZKeRIDL.js.map → mutativeMethods-Jowr0Znn.js.map} +1 -1
- package/dist/{patchMethods-hhlLwtqE.cjs → patchMethods-B7Hm5-Qh.cjs} +4 -6
- package/dist/{patchMethods-hhlLwtqE.cjs.map → patchMethods-B7Hm5-Qh.cjs.map} +1 -1
- package/dist/{patchMethods-Dr2OFh02.d.ts → patchMethods-BmyvvHnP.d.cts} +4 -4
- package/dist/{patchMethods-BlYtjRUU.d.cts → patchMethods-CixmHmNt.d.ts} +4 -4
- package/dist/{patchMethods-C_f3PORQ.js → patchMethods-iK2F87G0.js} +5 -7
- package/dist/{patchMethods-C_f3PORQ.js.map → patchMethods-iK2F87G0.js.map} +1 -1
- package/dist/patches/index.cjs +3 -3
- package/dist/patches/index.d.cts +3 -3
- package/dist/patches/index.d.ts +3 -3
- package/dist/patches/index.js +3 -3
- package/dist/patches/register.cjs +4 -4
- package/dist/patches/register.cjs.map +1 -1
- package/dist/patches/register.d.cts +3 -5
- package/dist/patches/register.d.ts +3 -3
- package/dist/patches/register.js +4 -4
- package/dist/patches/register.js.map +1 -1
- package/dist/{chunk-CUT6urMc.cjs → path-B-Rq5q6m.cjs} +14 -1
- package/dist/path-B-Rq5q6m.cjs.map +1 -0
- package/dist/path-CyYq74W8.js +8 -0
- package/dist/path-CyYq74W8.js.map +1 -0
- package/dist/persist/register.cjs +5 -5
- package/dist/persist/register.cjs.map +1 -1
- package/dist/persist/register.d.cts +2 -4
- package/dist/persist/register.d.ts +2 -2
- package/dist/persist/register.js +5 -5
- package/dist/persist/register.js.map +1 -1
- package/dist/{persist-DFzbvNoJ.js → persist-Bunx8xfQ.js} +12 -15
- package/dist/persist-Bunx8xfQ.js.map +1 -0
- package/dist/{persist-CR3mhti7.d.cts → persist-CHRYYolx.d.cts} +3 -3
- package/dist/{persist-CQhYPv4d.cjs → persist-DMbVdqS_.cjs} +11 -14
- package/dist/persist-DMbVdqS_.cjs.map +1 -0
- package/dist/{persist-CIEYJ0rO.d.ts → persist-DyI_JLxZ.d.ts} +3 -3
- package/dist/{propAccess-BdLsqViO.cjs → propAccess-C2AIn9RC.cjs} +4 -6
- package/dist/{propAccess-BdLsqViO.cjs.map → propAccess-C2AIn9RC.cjs.map} +1 -1
- package/dist/{propAccess-B260LXN1.js → propAccess-DvWFpYoj.js} +5 -7
- package/dist/{propAccess-B260LXN1.js.map → propAccess-DvWFpYoj.js.map} +1 -1
- package/dist/react/index.cjs +66 -80
- package/dist/react/index.cjs.map +1 -1
- package/dist/react/index.d.cts +70 -70
- package/dist/react/index.d.ts +70 -70
- package/dist/react/index.js +62 -77
- package/dist/react/index.js.map +1 -1
- package/dist/react/register.cjs +5 -5
- package/dist/react/register.cjs.map +1 -1
- package/dist/react/register.d.cts +3 -5
- package/dist/react/register.d.ts +3 -3
- package/dist/react/register.js +5 -5
- package/dist/react/register.js.map +1 -1
- package/dist/{scope-C9JXWddv.cjs → scope-C1bcfK8e.cjs} +32 -7
- package/dist/scope-C1bcfK8e.cjs.map +1 -0
- package/dist/{scope-DkO-RIMy.d.cts → scope-CESkVNvI.d.cts} +3 -3
- package/dist/{scope-Mhr133F_.js → scope-CKGsCVn3.js} +20 -7
- package/dist/scope-CKGsCVn3.js.map +1 -0
- package/dist/{scope-ByLCVzKk.d.ts → scope-DJXSRsGy.d.ts} +3 -3
- package/dist/{store-B3PWCx63.d.cts → store-BRHFhRPm.d.ts} +22 -22
- package/dist/{store-DQcFfgKD.cjs → store-C1NYHLgR.cjs} +13 -14
- package/dist/store-C1NYHLgR.cjs.map +1 -0
- package/dist/{store-BJWoRQIs.d.ts → store-XcnTdeiJ.d.cts} +22 -22
- package/dist/{store-DOEc60aP.js → store-v3RYWzVg.js} +14 -15
- package/dist/store-v3RYWzVg.js.map +1 -0
- package/dist/{storeMethods-YDnpa-6-.cjs → storeMethods-CNu7VD6w.cjs} +135 -60
- package/dist/storeMethods-CNu7VD6w.cjs.map +1 -0
- package/dist/{storeMethods-C7bswcgj.js → storeMethods-CQhXlHpl.js} +115 -59
- package/dist/storeMethods-CQhXlHpl.js.map +1 -0
- package/dist/{storeMethods-Dt_mJTe3.d.cts → storeMethods-Dsz0-Cda.d.ts} +4 -4
- package/dist/{storeMethods-wsbbfJzY.d.ts → storeMethods-y3PlfTHV.d.cts} +4 -4
- package/package.json +26 -37
- package/dist/hash-DNFM5y_h.js +0 -19
- package/dist/hash-DNFM5y_h.js.map +0 -1
- package/dist/hash-Dv3XlmHn.cjs +0 -30
- package/dist/hash-Dv3XlmHn.cjs.map +0 -1
- package/dist/persist-CQhYPv4d.cjs.map +0 -1
- package/dist/persist-DFzbvNoJ.js.map +0 -1
- package/dist/scope-C9JXWddv.cjs.map +0 -1
- package/dist/scope-Mhr133F_.js.map +0 -1
- package/dist/store-DOEc60aP.js.map +0 -1
- package/dist/store-DQcFfgKD.cjs.map +0 -1
- package/dist/storeMethods-C7bswcgj.js.map +0 -1
- package/dist/storeMethods-YDnpa-6-.cjs.map +0 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"store-v3RYWzVg.js","names":["state: ValueState<T> | ErrorState | PendingState","value","q: {\n action: Action<any>;\n resolve: (value: any) => void;\n reject: (error: unknown) => void;\n ref?: any;\n }[]","value: T | undefined","connection: { active: boolean; cancel?: Cancel } | undefined","value","cancel: Cancel | undefined","actions: AsyncConnectionActions<any>","_cancel: Cancel | undefined","run: (() => void) | undefined","timeout: ReturnType<typeof setTimeout> | undefined","timeoutStarted: number | undefined","debounce","arrayMethods: {\n [P in 'splice' | 'push' | 'pop' | 'shift' | 'unshift' | 'reverse' | 'sort']: <\n T extends Array<any>,\n >(\n this: Store<T>,\n ...args: T[P] extends Function_ ? Parameters<T[P]> : never\n ) => T[P] extends Function_ ? ReturnType<T[P]> : never;\n}","timeout: ReturnType<typeof setTimeout> | undefined","getter: T | Calculate<T>","options: StoreOptions<T>","derivedFrom?: {\n store: Store<any>;\n selectors: (Selector<any, any> | AnyPath)[];\n updater: (state: any) => void;\n }","path: any","update: Update<any>","previousValue: { value: T } | undefined","timer: ReturnType<typeof setTimeout> | undefined","updater: ((value: any) => Update<T>) | undefined","active","methods: StoreMethods | undefined","createStore: typeof create & { defaultOptions: StoreOptions<any> }"],"sources":["../src/lib/autobind.ts","../src/lib/calcDuration.ts","../src/lib/deferred.ts","../src/lib/isPromise.ts","../src/lib/promiseWithState.ts","../src/lib/queue.ts","../src/lib/calculatedValue.ts","../src/lib/makeSelector.ts","../src/lib/debounce.ts","../src/lib/disposable.ts","../src/lib/forwardError.ts","../src/lib/promiseWithCancel.ts","../src/lib/standardMethods.ts","../src/lib/throttle.ts","../src/core/store.ts"],"sourcesContent":["const marker = Symbol('autobind');\n\nexport const autobind = <\n TClass extends abstract new (...args: any) => any = abstract new (...args: any) => any,\n>(\n _class: TClass,\n): TClass => {\n for (const key of Reflect.ownKeys(_class.prototype)) {\n if (key === 'constructor') {\n continue;\n }\n\n const descriptor = Reflect.getOwnPropertyDescriptor(_class.prototype, key);\n let method = descriptor?.get?.() ?? descriptor?.value;\n let isBinding = false;\n\n if (typeof method !== 'function' || method[marker]) {\n continue;\n }\n\n Reflect.defineProperty(_class.prototype, key, {\n configurable: true,\n get() {\n if (\n isBinding ||\n this === _class.prototype ||\n Object.prototype.hasOwnProperty.call(this, key) ||\n typeof method !== 'function'\n ) {\n return method;\n }\n\n const boundMethod = (...args: any[]) => Reflect.apply(method, this, args);\n boundMethod[marker] = true;\n isBinding = true;\n\n Object.defineProperty(this, key, {\n configurable: true,\n get() {\n return boundMethod;\n },\n });\n\n isBinding = false;\n return boundMethod;\n },\n set(v) {\n method = v;\n },\n });\n }\n\n return _class;\n};\n","import type { Duration } from '../core/commonTypes';\n\nexport function calcDuration(t: Duration): number {\n if (typeof t === 'number') return t;\n return (\n (t.milliseconds ?? 0) +\n (t.seconds ?? 0) * 1000 +\n (t.minutes ?? 0) * 60 * 1000 +\n (t.hours ?? 0) * 60 * 60 * 1000 +\n (t.days ?? 0) * 24 * 60 * 60 * 1000\n );\n}\n","export class Deferred<T = void> extends Promise<T> {\n resolve: (value: T | PromiseLike<T>) => void = () => undefined;\n reject: (reason?: any) => void = () => undefined;\n\n constructor() {\n Object.defineProperty(Deferred, Symbol.species, {\n value: Promise,\n });\n\n const that = {};\n\n super((resolve, reject) => {\n Object.assign(that, { resolve, reject });\n });\n\n Object.assign(this, that);\n }\n}\n","export default function isPromise(value: unknown): value is Promise<unknown> {\n return (\n typeof value === 'object' &&\n value !== null &&\n 'then' in value &&\n typeof value.then === 'function'\n );\n}\n","import isPromise from '@lib/isPromise';\nimport { type ErrorState, type PendingState, type ValueState } from './cacheState';\nimport { type MaybePromise } from './maybePromise';\n\nexport class PromiseWithState<T> extends Promise<T> {\n static override resolve(): PromiseWithState<void>;\n\n static override resolve<T>(value: MaybePromise<T>): PromiseWithState<T>;\n\n static override resolve<T>(value?: MaybePromise<T>) {\n return new PromiseWithState<T>(value as MaybePromise<T>);\n }\n\n static override reject<T = never>(error: unknown): PromiseWithState<T> {\n return new PromiseWithState<T>(Promise.reject(error), { status: 'error', error });\n }\n\n constructor(\n value: MaybePromise<T>,\n public state: ValueState<T> | ErrorState | PendingState = { status: 'pending' },\n ) {\n super((resolve) => resolve(value));\n\n Object.defineProperty(PromiseWithState, Symbol.species, {\n value: Promise,\n });\n\n if (isPromise(value)) {\n value\n .then((value) => {\n this.state = { status: 'value', value: value };\n })\n .catch((error) => {\n this.state = { status: 'error', error };\n });\n } else {\n this.state = { status: 'value', value: value };\n }\n }\n}\n","import isPromise from '@lib/isPromise';\nimport type { MaybePromise } from './maybePromise';\nimport type { Listener } from '@core';\n\ntype Action<T> = () => MaybePromise<T>;\n\nexport interface Queue {\n <T>(action: Action<T>, ref?: any): Promise<T>;\n clear: () => void;\n whenDone: () => Promise<void>;\n size: number;\n getRefs: () => any[];\n}\n\nexport function queue(): Queue {\n const q: {\n action: Action<any>;\n resolve: (value: any) => void;\n reject: (error: unknown) => void;\n ref?: any;\n }[] = [];\n const completionListeners = new Set<Listener<void>>();\n let active = false;\n\n const notify = () => {\n for (const listener of completionListeners) {\n listener();\n }\n\n completionListeners.clear();\n };\n\n const run = async () => {\n if (!active) {\n active = true;\n\n let next;\n while ((next = q.shift())) {\n try {\n let result = next.action();\n if (isPromise(result)) {\n result = await result;\n }\n\n next.resolve(result);\n } catch (error) {\n next.reject(error);\n }\n }\n\n active = false;\n notify();\n }\n };\n\n return Object.assign(\n <T>(action: Action<T>, ref?: any) => {\n return new Promise<T>((resolve, reject) => {\n q.push({ action, resolve, reject, ref });\n run();\n });\n },\n {\n clear() {\n q.length = 0;\n },\n\n whenDone() {\n if (!active) {\n return Promise.resolve();\n }\n\n return new Promise<void>((resolve) => {\n completionListeners.add(resolve);\n });\n },\n\n get size() {\n return q.length;\n },\n\n getRefs() {\n return q.map((item) => item.ref).filter((x) => x !== undefined);\n },\n },\n );\n}\n","import type { Cache } from '@core';\nimport type { AsyncConnectionActions, Cancel, Connection, StoreLike } from '@core/commonTypes';\nimport type { Store } from '@core/store';\nimport { Deferred } from '@lib/deferred';\nimport isPromise from '@lib/isPromise';\nimport { PromiseWithState } from '@lib/promiseWithState';\nimport { queue } from '@lib/queue';\nimport { deepEqual } from './equals';\n\nexport interface CalculatedValue<T> {\n value: T;\n check: () => void;\n stop(): void;\n invalidateDependencies(recursive?: boolean): void;\n}\n\nexport function calculatedValue<T>(store: Store<T>, notify: () => void): CalculatedValue<T> {\n if (!(store.getter instanceof Function)) {\n return staticValue(store.getter);\n }\n\n let active = false;\n const deps = new Array<{ store: StoreLike<any>; value: any; on: () => void; off: () => void }>();\n let value: T | undefined;\n const whenConnected = new Deferred();\n const whenExecuted = new Deferred();\n const ac = new AbortController();\n let connection: { active: boolean; cancel?: Cancel } | undefined;\n const q = queue();\n q(() => whenExecuted);\n\n const cancelEffect = store.addEffect(() => {\n if (connection) {\n store.invalidate();\n return;\n }\n\n active = true;\n\n for (const dep of deps) {\n dep.on();\n }\n\n return () => {\n active = false;\n\n for (const dep of deps) {\n dep.off();\n }\n\n if (connection) {\n connection.active = false;\n connection.cancel?.();\n q.clear();\n\n if ('state' in store) {\n (store as unknown as Cache<any>).state.set((state) => ({\n ...state,\n isConnected: false,\n isStale: true,\n }));\n }\n }\n };\n });\n\n function use<S>(dep: StoreLike<S>) {\n const value = dep.get();\n let cancel: Cancel | undefined;\n\n const on = () => {\n cancel ||= dep.subscribe(() => store.invalidate(), { runNow: false });\n };\n\n const off = () => {\n cancel?.();\n cancel = undefined;\n };\n\n deps.push({ store: dep, value, on, off });\n\n if (active) {\n on();\n }\n\n return value;\n }\n\n async function connect(createConnection: Connection<T>) {\n if (!active) {\n connection = { active: false };\n return;\n }\n\n const actions: AsyncConnectionActions<any> = {\n set(_value) {\n q(() => {\n if (!connection?.active) {\n return;\n }\n\n value = _value;\n notify();\n });\n },\n updateValue(update) {\n q(async () => {\n if (!connection?.active) {\n return;\n }\n\n if (update instanceof Function) {\n const currentValue = await value;\n\n if (!connection?.active) {\n return;\n }\n\n try {\n update = update(currentValue);\n } catch (error) {\n value = PromiseWithState.reject(error) as T;\n notify();\n connection.active = false;\n connection.cancel?.();\n return;\n }\n }\n\n value = PromiseWithState.resolve(update) as T;\n notify();\n });\n },\n updateError(error) {\n q(() => {\n if (!connection?.active) {\n return;\n }\n\n connection.active = false;\n connection.cancel?.();\n\n if ('state' in store) {\n (store as unknown as Cache<any>).state.set({\n status: 'error',\n error,\n isConnected: false,\n isUpdating: false,\n isStale: false,\n });\n }\n\n value = PromiseWithState.reject(error) as T;\n notify();\n });\n },\n updateIsConnected(isConnected) {\n if (isConnected) {\n whenConnected.resolve();\n }\n\n q(() => {\n if (!connection?.active) {\n return;\n }\n\n if ('state' in store) {\n (store as unknown as Cache<any>).state.set('isConnected', isConnected);\n }\n });\n },\n close() {\n if (connection?.active) {\n store.invalidate();\n }\n },\n };\n\n connection = { active: true };\n let _cancel: Cancel | undefined = createConnection(actions as any);\n\n connection.cancel = () => {\n _cancel?.();\n _cancel = undefined;\n };\n\n if (!connection.active) {\n connection.cancel();\n }\n\n return whenConnected;\n }\n\n try {\n value = store.getter({ signal: ac.signal, use, connect });\n } catch (error) {\n value = PromiseWithState.reject(error) as T;\n\n if (connection) {\n connection.active = false;\n connection.cancel?.();\n q.clear();\n }\n }\n\n if (isPromise(value)) {\n value.finally(() => whenExecuted.resolve()).catch(() => undefined);\n } else {\n whenExecuted.resolve();\n }\n\n function check() {\n if (store.options.cacheValue === false) {\n return false;\n }\n\n for (const dep of deps) {\n if (!deepEqual(dep.store.get(), dep.value)) {\n return false;\n }\n }\n return true;\n }\n\n function stop() {\n cancelEffect();\n whenExecuted.resolve();\n whenConnected.resolve();\n ac.abort();\n\n if (connection) {\n connection.active = false;\n connection.cancel?.();\n q.clear();\n }\n }\n\n function invalidateDependencies(recursive?: boolean) {\n for (const dep of deps) {\n dep.store.invalidate(recursive);\n }\n }\n\n return {\n get value() {\n return value!;\n },\n check,\n stop,\n invalidateDependencies,\n };\n}\n\nexport function staticValue<T>(value: T): CalculatedValue<T> {\n return {\n value,\n check: () => true,\n stop: () => undefined,\n invalidateDependencies: () => undefined,\n };\n}\n\nexport function staleValue<T>(value: T): CalculatedValue<T> {\n return {\n value,\n check: () => false,\n stop: () => undefined,\n invalidateDependencies: () => undefined,\n };\n}\n","import type { AnyPath } from './path';\nimport { get } from './propAccess';\n\nfunction identity<T>(x: T): T {\n return x;\n}\n\nexport function makeSelector<T, S>(selector?: ((value: T) => S) | AnyPath): (value: T) => S {\n if (!selector) {\n return identity as (value: T) => S;\n }\n\n if (selector instanceof Function) {\n return selector;\n }\n\n return (x) => get(x, selector as any) as any;\n}\n","import { calcDuration } from './calcDuration';\nimport type { Duration } from '@core';\n\nexport type DebounceOptions =\n | Duration\n | {\n wait: Duration;\n maxWait?: Duration;\n waitOnRunNow?: boolean;\n };\n\nexport function debounce<Args extends any[]>(\n action: (...args: Args) => void,\n options: Duration | DebounceOptions,\n): {\n (...args: Args): void;\n flush(): void;\n cancel(): void;\n isScheduled(): boolean;\n} {\n const wait =\n typeof options === 'object' && 'wait' in options\n ? calcDuration(options.wait)\n : calcDuration(options);\n\n const maxWait =\n typeof options === 'object' && 'maxWait' in options && options.maxWait !== undefined\n ? calcDuration(options.maxWait)\n : undefined;\n\n let run: (() => void) | undefined;\n let timeout: ReturnType<typeof setTimeout> | undefined;\n let timeoutStarted: number | undefined;\n\n function flush() {\n if (timeout !== undefined) {\n clearTimeout(timeout);\n }\n\n run?.();\n }\n\n function cancel() {\n if (timeout !== undefined) {\n clearTimeout(timeout);\n }\n\n run = undefined;\n timeout = undefined;\n timeoutStarted = undefined;\n }\n\n function isScheduled() {\n return timeout !== undefined;\n }\n\n function debounce(...args: Args) {\n const now = Date.now();\n timeoutStarted ??= now;\n\n const deadline = Math.min(\n //\n now + wait,\n timeoutStarted + (maxWait ?? Number.POSITIVE_INFINITY),\n );\n\n if (timeout !== undefined) {\n clearTimeout(timeout);\n }\n\n run = () => {\n run = undefined;\n timeout = undefined;\n timeoutStarted = undefined;\n\n action(...args);\n };\n\n timeout = setTimeout(run, deadline - now);\n }\n\n return Object.assign(debounce, { flush, cancel, isScheduled });\n}\n","import type { Cancel } from '@core';\nimport type { DisposableCancel } from '@core/commonTypes';\n\nexport default function disposable(dispose: Cancel): DisposableCancel {\n return Object.assign(\n dispose,\n Symbol.dispose ? { [Symbol.dispose]: dispose } : {},\n ) as DisposableCancel;\n}\n","export function forwardError(error: unknown): void {\n setTimeout(() => {\n throw error;\n });\n}\n","import { autobind } from '@lib/autobind';\n\nexport class PromiseCancelError extends Error {\n constructor() {\n super('cancelled');\n }\n}\n\nexport class PromiseWithCancel<T> extends Promise<T> {\n private abortController;\n\n constructor(\n executor: (\n resolve: (value: T) => void,\n reject: (error: unknown) => void,\n signal: AbortSignal,\n ) => void,\n ) {\n autobind(PromiseWithCancel);\n const abortController = new AbortController();\n\n super((resolve, reject) => {\n executor(resolve, reject, abortController.signal);\n\n abortController.signal.addEventListener('abort', () => {\n reject(abortController.signal.reason);\n });\n });\n\n this.abortController = abortController;\n }\n\n cancel(reason: any = new PromiseCancelError()): void {\n this.abortController.abort(reason);\n }\n}\n","import type { Store } from '../core/store';\nimport type { OptionalProperties, OptionalPropertyOf } from './typeHelpers';\n\ntype Function_ = (...args: any) => any;\n\nfunction createArrayAction<P extends keyof Array<any>>(prop: P) {\n return function arrayAction<T extends Array<any>>(\n this: Store<T>,\n ...args: T[P] extends Function_ ? Parameters<T[P]> : never\n ): T[P] extends Function_ ? ReturnType<T[P]> : never {\n const newArray = this.get().slice() as T;\n const result = (newArray[prop] as Function_)(...(args as any));\n this.set(newArray);\n return result;\n };\n}\nexport const arrayMethods: {\n [P in 'splice' | 'push' | 'pop' | 'shift' | 'unshift' | 'reverse' | 'sort']: <\n T extends Array<any>,\n >(\n this: Store<T>,\n ...args: T[P] extends Function_ ? Parameters<T[P]> : never\n ) => T[P] extends Function_ ? ReturnType<T[P]> : never;\n} = {\n splice: /* @__PURE__ */ createArrayAction('splice'),\n push: /* @__PURE__ */ createArrayAction('push'),\n pop: /* @__PURE__ */ createArrayAction('pop'),\n shift: /* @__PURE__ */ createArrayAction('shift'),\n unshift: /* @__PURE__ */ createArrayAction('unshift'),\n reverse: /* @__PURE__ */ createArrayAction('reverse'),\n sort: /* @__PURE__ */ createArrayAction('sort'),\n};\n\nexport const recordMethods = {\n delete<T extends Record<any, any>, K extends OptionalPropertyOf<T>>(\n this: Store<T>,\n key: K,\n ): void {\n const copy = { ...this.get() };\n delete copy[key];\n this.set(copy);\n },\n\n clear<T extends Record<any, any>>(\n this: OptionalProperties<T> extends T ? Store<T> : never,\n ): void {\n this.set({} as T);\n },\n};\n\nexport const mapMethods = {\n delete<K, V>(this: Store<Map<K, V>>, key: K): boolean {\n const newMap = new Map(this.get());\n const result = newMap.delete(key);\n this.set(newMap);\n return result;\n },\n\n clear<K, V>(this: Store<Map<K, V>>): void {\n this.set(new Map());\n },\n};\n\nexport const setMethods = {\n add<T>(this: Store<Set<T>>, value: T): void {\n const newSet = new Set(this.get());\n newSet.add(value);\n this.set(newSet);\n },\n\n delete<T>(this: Store<Set<T>>, value: T): void {\n const newSet = new Set(this.get());\n newSet.delete(value);\n this.set(newSet);\n },\n\n clear<T>(this: Store<Set<T>>): void {\n this.set(new Set());\n },\n};\n","import { calcDuration } from './calcDuration';\nimport type { Duration } from '@core';\n\nexport function throttle<Args extends any[]>(\n action: (...args: Args) => void,\n duration: Duration,\n): (...args: Args) => void {\n const ms = calcDuration(duration);\n\n let t = 0;\n let timeout: ReturnType<typeof setTimeout> | undefined;\n\n return (...args: Args) => {\n if (timeout !== undefined) {\n clearTimeout(timeout);\n }\n\n const dt = t + ms - Date.now();\n if (dt <= 0) {\n action(...args);\n t = Date.now();\n return;\n }\n\n timeout = setTimeout(() => {\n action(...args);\n t = Date.now();\n }, dt);\n };\n}\n","import { autobind } from '@lib/autobind';\nimport { calcDuration } from '@lib/calcDuration';\nimport { calculatedValue, staticValue, type CalculatedValue } from '@lib/calculatedValue';\nimport type { Constrain } from '@lib/constrain';\nimport { debounce } from '@lib/debounce';\nimport disposable from '@lib/disposable';\nimport { deepEqual } from '@lib/equals';\nimport { forwardError } from '@lib/forwardError';\nimport { isObject } from '@lib/helpers';\nimport { makeSelector } from '@lib/makeSelector';\nimport type { AnyPath, Path, SettablePath, Value } from '@lib/path';\nimport { PromiseWithCancel } from '@lib/promiseWithCancel';\nimport { get, set } from '@lib/propAccess';\nimport { arrayMethods, mapMethods, recordMethods, setMethods } from '@lib/standardMethods';\nimport { throttle } from '@lib/throttle';\nimport type {\n CalculationActions,\n Cancel,\n DisposableCancel,\n Duration,\n Effect,\n Listener,\n Selector,\n SubscribeOptions,\n Update,\n} from './commonTypes';\n\nexport type StoreMethods = Record<string, (...args: any[]) => any>;\n\nexport type BoundStoreMethods<T, Methods extends StoreMethods> = Methods &\n ThisType<Store<T> & Methods>;\n\nexport interface StoreOptions<T> {\n retain?: Duration;\n equals?: SubscribeOptions['equals'];\n effect?: Effect<Store<T>> | { effect: Effect<Store<T>>; retain?: Duration };\n cacheValue?: boolean;\n}\n\nexport interface StoreOptionsWithMethods<T, Methods extends StoreMethods> extends StoreOptions<T> {\n methods?: Methods & ThisType<Store<T> & Methods & StandardMethods<T>>;\n}\n\nexport type Calculate<T> = (helpers: CalculationActions<T>) => T;\n\ntype StandardMethods<T> =\n T extends Map<any, any>\n ? typeof mapMethods\n : T extends Set<any>\n ? typeof setMethods\n : T extends Array<any>\n ? typeof arrayMethods\n : T extends Record<any, any>\n ? typeof recordMethods\n : Record<string, never>;\n\ntype StoreWithMethods<T, Methods extends StoreMethods> = Store<T> &\n Omit<BoundStoreMethods<T, Methods>, keyof Store<T>> &\n StandardMethods<T>;\n\nexport interface OnceOptions {\n signal?: AbortSignal;\n timeout?: Duration;\n}\n\nfunction noop() {\n return undefined;\n}\n\nexport class Store<T> {\n private static hooks?: Set<(this: Store<any>, store: Store<any>) => void>;\n\n static addHook(hook: (store: Store<any>) => void): DisposableCancel {\n this.hooks ??= new Set();\n this.hooks.add(hook);\n return disposable(() => this.hooks?.delete(hook));\n }\n\n version?: string;\n\n protected calculatedValue?: CalculatedValue<T>;\n protected defaultValue?: CalculatedValue<T>;\n\n protected listeners: Map<Listener, boolean> = new Map();\n\n protected effects: Map<\n Effect<Store<T>>,\n { handle?: Cancel; retain?: number; timeout?: ReturnType<typeof setTimeout> }\n > = new Map();\n\n protected notifyId = {};\n\n constructor(\n public readonly getter: T | Calculate<T>,\n public readonly options: StoreOptions<T> = {},\n public readonly derivedFrom?: {\n store: Store<any>;\n selectors: (Selector<any, any> | AnyPath)[];\n updater: (state: any) => void;\n },\n ) {\n autobind(Store);\n\n if (typeof getter !== 'function') {\n this.calculatedValue = this.defaultValue = staticValue(getter);\n }\n\n for (const hook of Store.hooks ?? []) {\n hook.apply(this, [this]);\n }\n\n if (options.effect instanceof Function) {\n this.addEffect(options.effect);\n } else if (options.effect) {\n this.addEffect(options.effect.effect, options.effect.retain);\n }\n }\n\n get(): T {\n if (!this.calculatedValue?.check()) {\n this.calculatedValue?.stop();\n this.calculatedValue = undefined;\n }\n\n if (!this.calculatedValue) {\n this.calculatedValue = calculatedValue(this, this.notify);\n }\n\n return this.calculatedValue.value;\n }\n\n set(update: Update<T>): void;\n\n set<const P>(path: Constrain<P, Path<T>>, update: Update<Value<T, P>>): void;\n\n set(...args: any[]): void {\n const path: any = args.length > 1 ? args[0] : [];\n let update: Update<any> = args.length > 1 ? args[1] : args[0];\n\n if (update instanceof Function) {\n const before = this.get();\n const valueBefore = get(before, path);\n const valueAfter = update(valueBefore);\n update = set(before, path, valueAfter);\n } else if (path.length > 0) {\n update = set(this.get(), path, update);\n }\n\n if (this.derivedFrom) {\n this.derivedFrom.updater(update);\n return;\n }\n\n this.calculatedValue?.stop();\n this.calculatedValue = staticValue(update);\n this.notify();\n }\n\n invalidate(recursive?: boolean): void {\n if (recursive) {\n this.calculatedValue?.invalidateDependencies(recursive);\n }\n\n this.calculatedValue?.stop();\n this.calculatedValue = this.defaultValue;\n this.notify();\n }\n\n subscribe(\n listener: Listener<T, { cancel: Cancel }>,\n options?: SubscribeOptions,\n ): DisposableCancel {\n const {\n passive,\n runNow = true,\n throttle: throttleOption,\n debounce: debounceOption,\n equals = this.options.equals ?? deepEqual,\n } = options ?? {};\n\n let isSetup = false;\n let previousValue: { value: T } | undefined;\n\n let innerListener = () => {\n if (!isSetup) {\n return;\n }\n\n const value = passive ? this.calculatedValue : { value: this.get() };\n\n if (!value) {\n return;\n }\n\n if (previousValue && equals(value.value, previousValue.value)) {\n return;\n }\n\n const _previousValue = previousValue?.value;\n previousValue = this.calculatedValue && { value: this.calculatedValue?.value };\n\n try {\n listener.apply({ cancel }, [value.value, _previousValue]);\n } catch (error) {\n forwardError(error);\n }\n };\n\n if (throttleOption) {\n innerListener = throttle(innerListener, throttleOption);\n } else if (debounceOption) {\n innerListener = debounce(innerListener, debounceOption);\n }\n\n this.listeners.set(innerListener, !passive);\n const cancel = () => {\n if (this.listeners.delete(innerListener) && !passive) {\n this.onUnsubscribe();\n }\n };\n\n if (!passive) {\n this.onSubscribe();\n }\n\n isSetup = true;\n\n if (runNow) {\n innerListener();\n\n if (\n !throttleOption &&\n typeof debounceOption === 'object' &&\n 'waitOnRunNow' in debounceOption &&\n debounceOption.waitOnRunNow === false &&\n 'flush' in innerListener\n ) {\n (innerListener as { flush: () => void }).flush();\n }\n } else {\n previousValue = passive\n ? this.calculatedValue && { value: this.calculatedValue.value }\n : { value: this.get() };\n }\n\n return disposable(cancel);\n }\n\n once<S extends T>(\n condition: (value: T) => value is S,\n options?: OnceOptions,\n ): PromiseWithCancel<S>;\n\n once(condition: (value: T) => boolean, options?: OnceOptions): PromiseWithCancel<T>;\n\n once(options?: OnceOptions): PromiseWithCancel<Exclude<T, undefined>>;\n\n once(\n ...args: [condition: (value: any) => boolean, options?: OnceOptions] | [options?: OnceOptions]\n ): PromiseWithCancel<any> {\n const condition = args[0] instanceof Function ? args[0] : (x: T) => x !== undefined;\n const options = args[0] instanceof Function ? args[1] : args[0];\n\n return new PromiseWithCancel<T>((resolve, reject, signal) => {\n let stopped = false;\n let timer: ReturnType<typeof setTimeout> | undefined;\n\n const cancel = this.subscribe(\n (value) => {\n if (stopped || !condition(value)) {\n return;\n }\n\n resolve(value);\n stopped = true;\n if (timer) {\n clearTimeout(timer);\n }\n setTimeout(() => cancel());\n },\n {\n runNow: !!condition,\n },\n );\n\n if (stopped) {\n return;\n }\n\n signal.addEventListener('abort', cancel);\n\n options?.signal?.addEventListener('abort', () => {\n cancel();\n reject(options.signal?.reason ?? new Error('cancelled'));\n });\n\n if (options?.timeout !== undefined) {\n timer = setTimeout(() => {\n cancel();\n reject(new Error('timeout'));\n }, calcDuration(options.timeout));\n }\n });\n }\n\n map<S>(selector: Selector<T, S>, updater?: (value: S) => Update<T>): Store<S>;\n\n map<const P>(selector: Constrain<P, SettablePath<T>>): Store<Value<T, P>>;\n\n map(_selector: Selector<T, any> | SettablePath<any>, ...args: any[]): Store<any> {\n const updater: ((value: any) => Update<T>) | undefined =\n _selector instanceof Function\n ? args[0]\n : (value) => (state) => set(state, _selector as any, value);\n\n const selector = makeSelector(_selector);\n\n const derivedFrom = {\n store: this.derivedFrom ? this.derivedFrom.store : this,\n selectors: this.derivedFrom ? [...this.derivedFrom.selectors, _selector] : [_selector],\n\n updater: (value: any) => {\n if (!updater) {\n throw new TypeError(\n 'Can only update computed stores that either are derived from other stores using string selectors or have an updater function.',\n );\n }\n\n let update = updater(value);\n\n if (update instanceof Function) {\n update = update(this.get());\n }\n\n if (this.derivedFrom) {\n this.derivedFrom.updater(update);\n } else {\n this.set(update);\n }\n },\n };\n\n return new Store(\n ({ use }) => {\n return selector(use(this));\n },\n undefined,\n derivedFrom,\n );\n }\n\n /** Add an effect that will be executed when the store becomes active, which means when it has at least one subscriber.\n * @param effect\n * If there is already a subscriber, the effect will be executed immediately.\n * Otherweise it will be executed as soon as the first subscription is created.\n * Every time all subscriptions are removed and the first is created again, the effect will be executed again.\n * @param retain\n * If provided, delay tearing down effects when the last subscriber is removed. This is useful if a short gap in subscriber coverage is supposed to be ignored. E.g. when switching pages, the old page might unsubscribe, while the new page subscribes immediately after.\n * @returns\n * The effect can return a teardown callback, which will be executed when the last subscription is removed and potentially the ratain time has passed.\n */\n addEffect(\n effect: Effect<Store<T>>,\n retain: Duration | undefined = this.options.retain,\n ): DisposableCancel {\n this.effects.set(effect, {\n handle: this.isActive() ? (effect.apply(this, [this]) ?? noop) : undefined,\n retain: retain !== undefined ? calcDuration(retain) : undefined,\n });\n\n return disposable(() => {\n const { handle, timeout } = this.effects.get(effect) ?? {};\n handle?.();\n\n if (timeout !== undefined) {\n clearTimeout(timeout);\n }\n\n this.effects.delete(effect);\n });\n }\n\n /** Return whether the store is currently active, which means whether it has at least one subscriber. */\n isActive(): boolean {\n return [...this.listeners.values()].some(Boolean);\n }\n\n protected onSubscribe(): void {\n if ([...this.listeners.values()].filter(Boolean).length > 1) return;\n\n for (const [effect, { handle, retain, timeout }] of this.effects.entries()) {\n if (timeout !== undefined) {\n clearTimeout(timeout);\n }\n\n this.effects.set(effect, {\n handle: handle ?? effect.apply(this, [this]) ?? noop,\n retain,\n timeout: undefined,\n });\n }\n }\n\n protected onUnsubscribe(): void {\n if ([...this.listeners.values()].some(Boolean)) return;\n\n for (const [effect, { handle, retain, timeout }] of this.effects.entries()) {\n if (!retain) {\n handle?.();\n\n if (timeout !== undefined) {\n clearTimeout(timeout);\n }\n\n this.effects.set(effect, {\n handle: undefined,\n retain,\n timeout: undefined,\n });\n\n continue;\n }\n\n const newTimeout =\n timeout ??\n (handle\n ? setTimeout(() => {\n handle();\n this.effects.set(effect, {\n handle: undefined,\n retain,\n timeout: undefined,\n });\n }, retain)\n : undefined);\n\n this.effects.set(effect, {\n handle,\n retain,\n timeout: newTimeout,\n });\n }\n }\n\n protected notify(): void {\n const n = {};\n this.notifyId = n;\n\n const snapshot = [...this.listeners.entries()];\n const active = snapshot.filter(([, active]) => active);\n const passive = snapshot.filter(([, active]) => !active);\n for (const [listener] of [...active, ...passive]) {\n listener();\n if (n !== this.notifyId) break;\n }\n }\n}\n\nfunction create<T>(calculate: Calculate<T>, options?: StoreOptions<T>): Store<T>;\nfunction create<T, Methods extends StoreMethods = {}>(\n initialState: T,\n options?: StoreOptionsWithMethods<T, Methods>,\n): StoreWithMethods<T, Methods>;\nfunction create<T, Methods extends StoreMethods>(\n initialState: T | Calculate<T>,\n options?: StoreOptionsWithMethods<T, Methods>,\n): StoreWithMethods<T, Methods> | Store<T> {\n options = { ...createStore.defaultOptions, ...options };\n\n const store = new Store(initialState, options);\n\n if (initialState instanceof Function) {\n return store;\n }\n\n let methods: StoreMethods | undefined = options?.methods;\n\n if (initialState instanceof Map) {\n methods = { ...mapMethods, ...methods };\n } else if (initialState instanceof Set) {\n methods = { ...setMethods, ...methods };\n } else if (Array.isArray(initialState)) {\n methods = { ...arrayMethods, ...methods };\n } else if (isObject(initialState)) {\n methods = { ...recordMethods, ...methods };\n }\n\n const boundMethods = Object.fromEntries(\n Object.entries(methods ?? ({} as BoundStoreMethods<T, any>))\n .filter(([name]) => !(name in store))\n .map(([name, action]) => [name, (action as any).bind(store)]),\n ) as BoundStoreMethods<T, any>;\n\n return Object.assign(store, boundMethods);\n}\n\nexport const createStore: typeof create & { defaultOptions: StoreOptions<any> } =\n /* @__PURE__ */ Object.assign(create, {\n defaultOptions: {\n equals: deepEqual,\n } as StoreOptions<any>,\n });\n"],"mappings":";;;AAAA,MAAM,SAAS,OAAO,WAAW;AAEjC,MAAa,YAGX,WACW;AACX,MAAK,MAAM,OAAO,QAAQ,QAAQ,OAAO,UAAU,EAAE;AACnD,MAAI,QAAQ,cACV;EAGF,MAAM,aAAa,QAAQ,yBAAyB,OAAO,WAAW,IAAI;EAC1E,IAAI,SAAS,YAAY,OAAO,IAAI,YAAY;EAChD,IAAI,YAAY;AAEhB,MAAI,OAAO,WAAW,cAAc,OAAO,QACzC;AAGF,UAAQ,eAAe,OAAO,WAAW,KAAK;GAC5C,cAAc;GACd,MAAM;AACJ,QACE,aACA,SAAS,OAAO,aAChB,OAAO,UAAU,eAAe,KAAK,MAAM,IAAI,IAC/C,OAAO,WAAW,WAElB,QAAO;IAGT,MAAM,eAAe,GAAG,SAAgB,QAAQ,MAAM,QAAQ,MAAM,KAAK;AACzE,gBAAY,UAAU;AACtB,gBAAY;AAEZ,WAAO,eAAe,MAAM,KAAK;KAC/B,cAAc;KACd,MAAM;AACJ,aAAO;;KAEV,CAAC;AAEF,gBAAY;AACZ,WAAO;;GAET,IAAI,GAAG;AACL,aAAS;;GAEZ,CAAC;;AAGJ,QAAO;;;;;AClDT,SAAgB,aAAa,GAAqB;AAChD,KAAI,OAAO,MAAM,SAAU,QAAO;AAClC,SACG,EAAE,gBAAgB,MAClB,EAAE,WAAW,KAAK,OAClB,EAAE,WAAW,KAAK,KAAK,OACvB,EAAE,SAAS,KAAK,KAAK,KAAK,OAC1B,EAAE,QAAQ,KAAK,KAAK,KAAK,KAAK;;;;;ACTnC,IAAa,WAAb,MAAa,iBAA2B,QAAW;CAIjD,cAAc;AACZ,SAAO,eAAe,UAAU,OAAO,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,cACA,SACyC;AACzC,WAAU;EAAE,GAAG,YAAY;EAAgB,GAAG;EAAS;CAEvD,MAAM,QAAQ,IAAI,MAAM,cAAc,QAAQ;AAE9C,KAAI,wBAAwB,SAC1B,QAAO;CAGT,IAAIC,UAAoC,SAAS;AAEjD,KAAI,wBAAwB,IAC1B,WAAU;EAAE,GAAG;EAAY,GAAG;EAAS;UAC9B,wBAAwB,IACjC,WAAU;EAAE,GAAG;EAAY,GAAG;EAAS;UAC9B,MAAM,QAAQ,aAAa,CACpC,WAAU;EAAE,GAAG;EAAc,GAAG;EAAS;UAChC,SAAS,aAAa,CAC/B,WAAU;EAAE,GAAG;EAAe,GAAG;EAAS;CAG5C,MAAM,eAAe,OAAO,YAC1B,OAAO,QAAQ,WAAY,EAAE,CAA+B,CACzD,QAAQ,CAAC,UAAU,EAAE,QAAQ,OAAO,CACpC,KAAK,CAAC,MAAM,YAAY,CAAC,MAAO,OAAe,KAAK,MAAM,CAAC,CAAC,CAChE;AAED,QAAO,OAAO,OAAO,OAAO,aAAa;;AAG3C,MAAaC,cACK,uBAAO,OAAO,QAAQ,EACpC,gBAAgB,EACd,QAAQ,WACT,EACF,CAAC"}
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
const
|
|
2
|
-
const require_store = require('./store-
|
|
3
|
-
const require_propAccess = require('./propAccess-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
1
|
+
const require_path = require('./path-B-Rq5q6m.cjs');
|
|
2
|
+
const require_store = require('./store-C1NYHLgR.cjs');
|
|
3
|
+
const require_propAccess = require('./propAccess-C2AIn9RC.cjs');
|
|
4
|
+
let react = require("react");
|
|
5
|
+
react = require_path.__toESM(react);
|
|
6
|
+
let react_jsx_runtime = require("react/jsx-runtime");
|
|
7
|
+
react_jsx_runtime = require_path.__toESM(react_jsx_runtime);
|
|
8
8
|
|
|
9
9
|
//#region src/lib/trackingProxy.ts
|
|
10
10
|
const unwrapProxySymbol = /* @__PURE__ */ Symbol("unwrapProxy");
|
|
@@ -30,34 +30,33 @@ function trackingProxy(value, equals = require_propAccess.deepEqual) {
|
|
|
30
30
|
});
|
|
31
31
|
return calculatedValue;
|
|
32
32
|
}
|
|
33
|
-
const proxy = new Proxy(value, {
|
|
34
|
-
get(target, p, receiver) {
|
|
35
|
-
if (p === unwrapProxySymbol) return value;
|
|
36
|
-
if (revoked) return target[p];
|
|
37
|
-
const { writable, configurable } = Object.getOwnPropertyDescriptor(target, p) ?? {};
|
|
38
|
-
if (writable === false && configurable === false) return target[p];
|
|
39
|
-
return trackComplexProp(Reflect.get, p, receiver);
|
|
40
|
-
},
|
|
41
|
-
getOwnPropertyDescriptor(target, p) {
|
|
42
|
-
const { writable, configurable } = Object.getOwnPropertyDescriptor(target, p) ?? {};
|
|
43
|
-
if (writable === false && configurable === false) return Reflect.getOwnPropertyDescriptor(target, p);
|
|
44
|
-
return trackComplexProp(Reflect.getOwnPropertyDescriptor, p);
|
|
45
|
-
},
|
|
46
|
-
ownKeys() {
|
|
47
|
-
return trackComplexProp(Reflect.ownKeys);
|
|
48
|
-
},
|
|
49
|
-
getPrototypeOf() {
|
|
50
|
-
return trackSimpleProp(Reflect.getPrototypeOf);
|
|
51
|
-
},
|
|
52
|
-
has(_target, p) {
|
|
53
|
-
return trackSimpleProp(Reflect.has, p);
|
|
54
|
-
},
|
|
55
|
-
isExtensible() {
|
|
56
|
-
return trackSimpleProp(Reflect.isExtensible);
|
|
57
|
-
}
|
|
58
|
-
});
|
|
59
33
|
return [
|
|
60
|
-
|
|
34
|
+
new Proxy(value, {
|
|
35
|
+
get(target, p, receiver) {
|
|
36
|
+
if (p === unwrapProxySymbol) return value;
|
|
37
|
+
if (revoked) return target[p];
|
|
38
|
+
const { writable, configurable } = Object.getOwnPropertyDescriptor(target, p) ?? {};
|
|
39
|
+
if (writable === false && configurable === false) return target[p];
|
|
40
|
+
return trackComplexProp(Reflect.get, p, receiver);
|
|
41
|
+
},
|
|
42
|
+
getOwnPropertyDescriptor(target, p) {
|
|
43
|
+
const { writable, configurable } = Object.getOwnPropertyDescriptor(target, p) ?? {};
|
|
44
|
+
if (writable === false && configurable === false) return Reflect.getOwnPropertyDescriptor(target, p);
|
|
45
|
+
return trackComplexProp(Reflect.getOwnPropertyDescriptor, p);
|
|
46
|
+
},
|
|
47
|
+
ownKeys() {
|
|
48
|
+
return trackComplexProp(Reflect.ownKeys);
|
|
49
|
+
},
|
|
50
|
+
getPrototypeOf() {
|
|
51
|
+
return trackSimpleProp(Reflect.getPrototypeOf);
|
|
52
|
+
},
|
|
53
|
+
has(_target, p) {
|
|
54
|
+
return trackSimpleProp(Reflect.has, p);
|
|
55
|
+
},
|
|
56
|
+
isExtensible() {
|
|
57
|
+
return trackSimpleProp(Reflect.isExtensible);
|
|
58
|
+
}
|
|
59
|
+
}),
|
|
61
60
|
(other) => !!other && deps.every((equals$1) => equals$1(other)),
|
|
62
61
|
() => {
|
|
63
62
|
revoked = true;
|
|
@@ -66,22 +65,48 @@ function trackingProxy(value, equals = require_propAccess.deepEqual) {
|
|
|
66
65
|
];
|
|
67
66
|
}
|
|
68
67
|
|
|
68
|
+
//#endregion
|
|
69
|
+
//#region src/react/lib/useMemoEquals.ts
|
|
70
|
+
function useMemoEquals(value, equals = require_propAccess.deepEqual) {
|
|
71
|
+
const ref = (0, react.useRef)(void 0);
|
|
72
|
+
const hasChanged = !ref.current || !equals(ref.current.value, value);
|
|
73
|
+
(0, react.useEffect)(() => {
|
|
74
|
+
if (hasChanged) ref.current = { value };
|
|
75
|
+
});
|
|
76
|
+
return hasChanged ? value : ref.current.value;
|
|
77
|
+
}
|
|
78
|
+
|
|
69
79
|
//#endregion
|
|
70
80
|
//#region src/react/useStore.ts
|
|
71
|
-
function useStore(store,
|
|
72
|
-
|
|
73
|
-
|
|
81
|
+
function useStore(store, ...args) {
|
|
82
|
+
let selectorRaw;
|
|
83
|
+
let allOptions;
|
|
84
|
+
if (typeof args[0] === "function" || require_path.isAnyPath(args[0])) {
|
|
85
|
+
selectorRaw = args[0];
|
|
86
|
+
allOptions = args[1] ?? {};
|
|
87
|
+
} else allOptions = args[0] ?? {};
|
|
88
|
+
const selector = (0, react.useMemo)(() => require_store.makeSelector(selectorRaw), [selectorRaw]);
|
|
74
89
|
const lastEqualsRef = (0, react.useRef)(void 0);
|
|
75
90
|
if (store.derivedFrom) return useStore(store.derivedFrom.store, (value$1) => {
|
|
76
91
|
for (const selector$1 of store.derivedFrom.selectors) value$1 = require_store.makeSelector(selector$1)(value$1);
|
|
77
92
|
return selector(value$1);
|
|
78
93
|
}, allOptions);
|
|
79
94
|
const { disableTrackingProxy = true, equals = store.options.equals ?? require_propAccess.deepEqual, withViewTransition,...options } = allOptions;
|
|
80
|
-
const
|
|
95
|
+
const snapshot = (0, react.useRef)(void 0);
|
|
96
|
+
const get = (0, react.useCallback)(() => {
|
|
97
|
+
const storeValue = store.get();
|
|
98
|
+
const selectedValue = selector(storeValue);
|
|
99
|
+
if (!snapshot.current || storeValue !== snapshot.current.storeValue && !(lastEqualsRef.current?.(selectedValue) ?? false)) snapshot.current = {
|
|
100
|
+
storeValue,
|
|
101
|
+
selectedValue
|
|
102
|
+
};
|
|
103
|
+
return snapshot.current.selectedValue;
|
|
104
|
+
}, [store, selector]);
|
|
105
|
+
const subOptions = useMemoEquals({
|
|
81
106
|
...options,
|
|
82
107
|
runNow: false
|
|
83
|
-
};
|
|
84
|
-
|
|
108
|
+
});
|
|
109
|
+
let value = (0, react.useSyncExternalStore)((0, react.useCallback)((listener) => {
|
|
85
110
|
let _listener = listener;
|
|
86
111
|
let stopped = false;
|
|
87
112
|
if (withViewTransition && document.startViewTransition) {
|
|
@@ -114,8 +139,12 @@ function useStore(store, argument1, argument2) {
|
|
|
114
139
|
stopped = true;
|
|
115
140
|
cancel();
|
|
116
141
|
};
|
|
117
|
-
}, [
|
|
118
|
-
|
|
142
|
+
}, [
|
|
143
|
+
store,
|
|
144
|
+
withViewTransition,
|
|
145
|
+
equals,
|
|
146
|
+
subOptions
|
|
147
|
+
]), get, get);
|
|
119
148
|
let lastEquals = (newValue) => equals(newValue, value);
|
|
120
149
|
let revoke;
|
|
121
150
|
if (!disableTrackingProxy) [value, lastEquals, revoke] = trackingProxy(value, equals);
|
|
@@ -133,8 +162,7 @@ const LoadingBoundaryContext = (0, react.createContext)(require_store.createStor
|
|
|
133
162
|
function LoadingBoundary({ fallback, children, isLoading: isLoadingExternal }) {
|
|
134
163
|
const store = (0, react.useMemo)(() => require_store.createStore(/* @__PURE__ */ new Set()), []);
|
|
135
164
|
const entries = useStore(store);
|
|
136
|
-
const
|
|
137
|
-
const fallbackNode = isLoading ? typeof fallback === "function" ? fallback([...entries]) : fallback : void 0;
|
|
165
|
+
const fallbackNode = entries.size > 0 || isLoadingExternal ? typeof fallback === "function" ? fallback([...entries]) : fallback : void 0;
|
|
138
166
|
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(LoadingBoundaryContext.Provider, {
|
|
139
167
|
value: store,
|
|
140
168
|
children: fallbackNode !== void 0 ? /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(react_jsx_runtime.Fragment, { children: [fallbackNode, /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
@@ -156,7 +184,7 @@ function useLoadingBoundary(isLoading, label) {
|
|
|
156
184
|
return newEntries;
|
|
157
185
|
});
|
|
158
186
|
};
|
|
159
|
-
}, [isLoading]);
|
|
187
|
+
}, [store, isLoading]);
|
|
160
188
|
}
|
|
161
189
|
|
|
162
190
|
//#endregion
|
|
@@ -224,7 +252,11 @@ function useCache(cache, { passive, disabled, updateOnMount, withViewTransition,
|
|
|
224
252
|
withViewTransition,
|
|
225
253
|
passive: passive || disabled
|
|
226
254
|
});
|
|
227
|
-
(0, react.useEffect)(() => rootCache.subscribe(() => void 0, { passive: passive || disabled }), [
|
|
255
|
+
(0, react.useEffect)(() => rootCache.subscribe(() => void 0, { passive: passive || disabled }), [
|
|
256
|
+
rootCache,
|
|
257
|
+
passive,
|
|
258
|
+
disabled
|
|
259
|
+
]);
|
|
228
260
|
useLoadingBoundary(loadingBoundary && !disabled && result.status === "pending");
|
|
229
261
|
if (suspense && result.status === "pending") throw rootCache.get();
|
|
230
262
|
return result;
|
|
@@ -236,15 +268,43 @@ const cacheMethods = { useCache(options) {
|
|
|
236
268
|
return useCache(this, options);
|
|
237
269
|
} };
|
|
238
270
|
|
|
271
|
+
//#endregion
|
|
272
|
+
//#region src/react/lib/useLatestRef.ts
|
|
273
|
+
function useLatestRef(value) {
|
|
274
|
+
const ref = (0, react.useRef)(value);
|
|
275
|
+
(0, react.useEffect)(() => {
|
|
276
|
+
ref.current = value;
|
|
277
|
+
}, [value]);
|
|
278
|
+
return ref;
|
|
279
|
+
}
|
|
280
|
+
|
|
281
|
+
//#endregion
|
|
282
|
+
//#region src/react/lib/useLatestFunction.ts
|
|
283
|
+
function useLatestFunction(fn) {
|
|
284
|
+
const ref = useLatestRef(fn);
|
|
285
|
+
return (...args) => {
|
|
286
|
+
return ref.current(...args);
|
|
287
|
+
};
|
|
288
|
+
}
|
|
289
|
+
|
|
239
290
|
//#endregion
|
|
240
291
|
//#region src/react/useProp.ts
|
|
241
|
-
function useProp(store,
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
if (
|
|
246
|
-
|
|
247
|
-
|
|
292
|
+
function useProp(store, ...args) {
|
|
293
|
+
let selector;
|
|
294
|
+
let updater;
|
|
295
|
+
let options;
|
|
296
|
+
if (typeof args[0] === "function" || require_path.isAnyPath(args[0])) {
|
|
297
|
+
selector = args[0];
|
|
298
|
+
if (typeof args[1] === "function") {
|
|
299
|
+
updater = args[1];
|
|
300
|
+
options = args[2];
|
|
301
|
+
} else options = args[1];
|
|
302
|
+
} else options = args[0];
|
|
303
|
+
return [useStore(store, selector ?? ((x) => x), options), useLatestFunction((update) => {
|
|
304
|
+
let _store = store;
|
|
305
|
+
if (selector) _store = _store.map(selector, updater);
|
|
306
|
+
_store.set(update);
|
|
307
|
+
})];
|
|
248
308
|
}
|
|
249
309
|
|
|
250
310
|
//#endregion
|
|
@@ -262,16 +322,13 @@ function ScopeProvider({ scope, store: inputStore, children }) {
|
|
|
262
322
|
});
|
|
263
323
|
}
|
|
264
324
|
function useScope(scope) {
|
|
265
|
-
|
|
266
|
-
return (0, react.useContext)(context);
|
|
325
|
+
return (0, react.useContext)(getScopeContext(scope));
|
|
267
326
|
}
|
|
268
327
|
function useScopeStore(scope, ...args) {
|
|
269
|
-
|
|
270
|
-
return useStore(store, ...args);
|
|
328
|
+
return useStore(useScope(scope), ...args);
|
|
271
329
|
}
|
|
272
330
|
function useScopeProp(scope, ...args) {
|
|
273
|
-
|
|
274
|
-
return useProp(store, ...args);
|
|
331
|
+
return useProp(useScope(scope), ...args);
|
|
275
332
|
}
|
|
276
333
|
|
|
277
334
|
//#endregion
|
|
@@ -348,12 +405,30 @@ Object.defineProperty(exports, 'useCache', {
|
|
|
348
405
|
return useCache;
|
|
349
406
|
}
|
|
350
407
|
});
|
|
408
|
+
Object.defineProperty(exports, 'useLatestFunction', {
|
|
409
|
+
enumerable: true,
|
|
410
|
+
get: function () {
|
|
411
|
+
return useLatestFunction;
|
|
412
|
+
}
|
|
413
|
+
});
|
|
414
|
+
Object.defineProperty(exports, 'useLatestRef', {
|
|
415
|
+
enumerable: true,
|
|
416
|
+
get: function () {
|
|
417
|
+
return useLatestRef;
|
|
418
|
+
}
|
|
419
|
+
});
|
|
351
420
|
Object.defineProperty(exports, 'useLoadingBoundary', {
|
|
352
421
|
enumerable: true,
|
|
353
422
|
get: function () {
|
|
354
423
|
return useLoadingBoundary;
|
|
355
424
|
}
|
|
356
425
|
});
|
|
426
|
+
Object.defineProperty(exports, 'useMemoEquals', {
|
|
427
|
+
enumerable: true,
|
|
428
|
+
get: function () {
|
|
429
|
+
return useMemoEquals;
|
|
430
|
+
}
|
|
431
|
+
});
|
|
357
432
|
Object.defineProperty(exports, 'useProp', {
|
|
358
433
|
enumerable: true,
|
|
359
434
|
get: function () {
|
|
@@ -372,4 +447,4 @@ Object.defineProperty(exports, 'useStore', {
|
|
|
372
447
|
return useStore;
|
|
373
448
|
}
|
|
374
449
|
});
|
|
375
|
-
//# sourceMappingURL=storeMethods-
|
|
450
|
+
//# sourceMappingURL=storeMethods-CNu7VD6w.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"storeMethods-CNu7VD6w.cjs","names":["deepEqual","isPlainObject","equals","deepEqual","selectorRaw: Selector<T, S> | AnyPath | undefined","allOptions: UseStoreOptions<S>","isAnyPath","makeSelector","selector","value","deepEqual","_listener: (value: any) => void","lastObservedValue: any","revoke: (() => void) | undefined","createStore","rootCache: Cache<any, any>","selector","makeSelector","selector: Selector<T, S> | AnyPath | undefined","updater: ((value: S) => Update<T>) | undefined","options: UseStoreOptions<S> | undefined","isAnyPath","_store: Store<any>","createStore","scopeMethods: {\n useScope: typeof boundUseScope;\n useStore: typeof boundUseScopeStore;\n useProp: typeof boundUseScopeProp;\n Provider: typeof Provider;\n}","storeMethods: {\n useStore: typeof boundUseStore;\n useProp: typeof boundUseProp;\n}"],"sources":["../src/lib/trackingProxy.ts","../src/react/lib/useMemoEquals.ts","../src/react/useStore.ts","../src/react/loadingBoundary.tsx","../src/react/useCache.ts","../src/react/cacheMethods.ts","../src/react/lib/useLatestRef.ts","../src/react/lib/useLatestFunction.ts","../src/react/useProp.ts","../src/react/scope.tsx","../src/react/scopeMethods.ts","../src/react/storeMethods.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>(\n value: T,\n equals: (a: any, b: any) => boolean = deepEqual,\n): 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","import { deepEqual } from '@lib/equals';\nimport { useEffect, useRef } from 'react';\n\nexport default function useMemoEquals<T>(value: T, equals: (a: T, b: T) => boolean = deepEqual): T {\n const ref = useRef<{ value: T }>(undefined);\n const hasChanged = !ref.current || !equals(ref.current.value, value);\n\n useEffect(() => {\n if (hasChanged) {\n ref.current = { value };\n }\n });\n\n return hasChanged ? value : ref.current!.value;\n}\n","import type { Selector, SubscribeOptions } from '@core/commonTypes';\nimport type { Store } from '@core/store';\nimport type { Constrain } from '@lib/constrain';\nimport { deepEqual } from '@lib/equals';\nimport { makeSelector } from '@lib/makeSelector';\nimport { isAnyPath, type AnyPath, type Path, type Value } from '@lib/path';\nimport { trackingProxy } from '@lib/trackingProxy';\nimport useMemoEquals from '@react/lib/useMemoEquals';\nimport {\n useCallback,\n useDebugValue,\n useLayoutEffect,\n useMemo,\n useRef,\n useSyncExternalStore,\n} from 'react';\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, const P>(\n store: Store<T>,\n selector: Constrain<P, Path<T>>,\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>(\n store: Store<T>,\n ...args: [Selector<T, S> | AnyPath, UseStoreOptions<S>?] | [UseStoreOptions<S>?]\n): S {\n let selectorRaw: Selector<T, S> | AnyPath | undefined;\n let allOptions: UseStoreOptions<S>;\n\n if (typeof args[0] === 'function' || isAnyPath(args[0])) {\n selectorRaw = args[0];\n allOptions = args[1] ?? {};\n } else {\n allOptions = args[0] ?? {};\n }\n\n const selector = useMemo(() => makeSelector<T, S>(selectorRaw), [selectorRaw]);\n const lastEqualsRef = useRef<(newValue: S) => boolean | undefined>(undefined);\n\n if (store.derivedFrom) {\n return useStore(\n store.derivedFrom.store,\n (value) => {\n for (const selector of store.derivedFrom!.selectors) {\n value = makeSelector(selector)(value);\n }\n return selector(value);\n },\n allOptions,\n );\n }\n\n const {\n disableTrackingProxy = true,\n equals = store.options.equals ?? deepEqual,\n withViewTransition,\n ...options\n } = allOptions;\n\n const snapshot = useRef<{ storeValue: T; selectedValue: S }>(undefined);\n\n const get = useCallback(() => {\n const storeValue = store.get();\n const selectedValue = selector(storeValue);\n\n const hasChanged =\n !snapshot.current ||\n (storeValue !== snapshot.current.storeValue &&\n !(lastEqualsRef.current?.(selectedValue) ?? false));\n\n if (hasChanged) {\n snapshot.current = { storeValue, selectedValue };\n }\n\n return snapshot.current!.selectedValue;\n }, [store, selector]);\n\n const subOptions = useMemoEquals({ ...options, runNow: false });\n\n const subscribe = useCallback(\n (listener: () => void) => {\n let _listener: (value: any) => void = listener;\n let stopped = false;\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 mutationObserver.disconnect();\n\n if (!stopped) {\n listener();\n }\n\n if (!hasChanges) {\n throw new Error('no change');\n }\n });\n };\n }\n\n const cancel = store.subscribe(_listener, subOptions);\n return () => {\n stopped = true;\n cancel();\n };\n },\n [store, withViewTransition, equals, subOptions],\n );\n\n let value = useSyncExternalStore<S>(subscribe, get, get);\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): React.JSX.Element {\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): void {\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 // oxlint-disable-next-line exhaustive-deps\n }, [store, isLoading]);\n}\n","import type { Cache } from '@core';\nimport type { CacheState } from '@lib/cacheState';\nimport { makeSelector } from '@lib/makeSelector';\nimport { useLoadingBoundary } from '@react/loadingBoundary';\nimport { useEffect, useMemo, useRef } from 'react';\nimport { useStore, type UseStoreOptions } from './useStore';\n\nexport type UseCacheArray<T> = [\n value: T | undefined,\n error: unknown | undefined,\n isUpdating: boolean,\n isStale: boolean,\n];\n\nexport type UseCacheValue<T> = UseCacheArray<T> & CacheState<T>;\n\nexport interface UseCacheOptions<T> extends UseStoreOptions<UseCacheArray<T> & CacheState<T>> {\n /**\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 false\n */\n loadingBoundary?: boolean;\n}\n\nexport function useCache<T>(\n cache: Cache<T, any>,\n {\n passive,\n disabled,\n updateOnMount,\n withViewTransition,\n suspense,\n loadingBoundary,\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, 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 // oxlint-disable-next-line exhaustive-deps\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 useEffect(\n () => rootCache.subscribe(() => undefined, { passive: passive || disabled }),\n [rootCache, 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","import type { Cache } from '@core';\nimport { type UseCacheOptions, type UseCacheValue, useCache } from '@react/useCache';\n\nexport const cacheMethods = {\n useCache<T>(this: Cache<T, any>, options?: UseCacheOptions<T>): UseCacheValue<T> {\n return useCache(this, options);\n },\n};\n","import { useEffect, useRef } from 'react';\n\nexport default function useLatestRef<T>(value: T): { current: T } {\n const ref = useRef(value);\n\n useEffect(() => {\n ref.current = value;\n }, [value]);\n\n return ref;\n}\n","import useLatestRef from '@react/lib/useLatestRef';\n\nexport default function useLatestFunction<Args extends any[], R>(\n fn: (...args: Args) => R,\n): (...args: Args) => R {\n const ref = useLatestRef(fn);\n\n return (...args: Args) => {\n return ref.current(...args);\n };\n}\n","import { type Selector, type Update } from '@core/commonTypes';\nimport type { Store } from '@core/store';\nimport type { Constrain } from '@lib/constrain';\nimport { isAnyPath, type AnyPath, type SettablePath, type Value } from '@lib/path';\nimport useLatestFunction from '@react/lib/useLatestFunction';\nimport { useStore, type UseStoreOptions } from './useStore';\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, const P>(\n store: Store<T>,\n selector: Constrain<P, SettablePath<T>>,\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 ...args:\n | [Selector<T, S>, (value: S) => Update<T>, UseStoreOptions<S>?]\n | [AnyPath, UseStoreOptions<Value<T, any>>?]\n | [UseStoreOptions<S>?]\n): [value: S, setValue: Store<S>['set']] {\n let selector: Selector<T, S> | AnyPath | undefined;\n let updater: ((value: S) => Update<T>) | undefined;\n let options: UseStoreOptions<S> | undefined;\n\n if (typeof args[0] === 'function' || isAnyPath(args[0])) {\n selector = args[0];\n if (typeof args[1] === 'function') {\n updater = args[1];\n options = args[2];\n } else {\n options = args[1];\n }\n } else {\n options = args[0];\n }\n\n const value = useStore(store, (selector ?? ((x) => x)) as Selector<T, S>, options);\n\n const update = useLatestFunction((update) => {\n let _store: Store<any> = store;\n if (selector) {\n _store = _store.map(selector as Selector<any, any>, updater);\n }\n\n _store.set(update);\n });\n\n return [value, update];\n}\n","import type { Scope, Selector, Update } from '@core';\nimport { createStore, type Store } from '@core/store';\nimport type { Constrain } from '@lib/constrain';\nimport type { Path, Value } from '@lib/path';\nimport { createContext, useContext, useMemo, type Context, type ReactNode } from 'react';\nimport { useProp } from './useProp';\nimport { useStore, type UseStoreOptions } from './useStore';\n\nexport type ScopeProps<T> = { scope: Scope<T>; store?: Store<T>; children?: ReactNode };\n\ndeclare module '..' {\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>({\n scope,\n store: inputStore,\n children,\n}: ScopeProps<T>): React.JSX.Element {\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, S>(\n scope: Scope<T>,\n selector: Selector<T, S>,\n option?: UseStoreOptions<S>,\n): S;\n\nexport function useScopeStore<T, const P>(\n scope: Scope<T>,\n selector: Constrain<P, Path<T>>,\n option?: UseStoreOptions<Value<T, P>>,\n): Value<T, P>;\n\nexport function useScopeStore<T>(scope: Scope<T>, option?: UseStoreOptions<T>): T;\n\nexport function useScopeStore<T>(scope: Scope<T>, ...args: any[]): T {\n const store = useScope(scope);\n return useStore(store, ...args);\n}\n\nexport function useScopeProp<T, S>(\n scope: Scope<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 useScopeProp<T, const P>(\n scope: Scope<T>,\n selector: Constrain<P, Path<T>>,\n options?: UseStoreOptions<Value<T, P>>,\n): [value: Value<T, P>, setValue: Store<Value<T, P>>['set']];\n\nexport function useScopeProp<T>(\n scope: Scope<T>,\n options?: UseStoreOptions<T>,\n): [value: T, setValue: Store<T>['set']];\n\nexport function useScopeProp<T>(\n scope: Scope<T>,\n ...args: any[]\n): [value: T, setValue: Store<T>['set']] {\n const store = useScope(scope);\n return useProp(store, ...args);\n}\n","import type { Scope, Selector, Store, Update } from '@core';\nimport type { Constrain } from '@lib/constrain';\nimport type { Path, Value } from '@lib/path';\nimport {\n ScopeProvider,\n useScope,\n useScopeProp,\n useScopeStore,\n type ScopeProps,\n} from '@react/scope';\nimport type { UseStoreOptions } from '@react/useStore';\n\nfunction boundUseScope<T>(this: Scope<T>): Store<T> {\n return useScope(this);\n}\n\nfunction boundUseScopeStore<T, S>(\n this: Scope<T>,\n selector: Selector<T, S>,\n option?: UseStoreOptions<S>,\n): S;\n\nfunction boundUseScopeStore<T, const P>(\n this: Scope<T>,\n selector: Constrain<P, Path<T>>,\n option?: UseStoreOptions<Value<T, P>>,\n): Value<T, P>;\n\nfunction boundUseScopeStore<T>(this: Scope<T>, option?: UseStoreOptions<T>): T;\n\nfunction boundUseScopeStore(this: Scope<any>, ...args: any[]) {\n return useScopeStore(this, ...args);\n}\n\nfunction boundUseScopeProp<T, S>(\n this: Scope<T>,\n selector: Selector<T, S>,\n updater: (value: S) => Update<T>,\n options?: UseStoreOptions<S>,\n): [value: S, setValue: Store<S>['set']];\n\nfunction boundUseScopeProp<T, const P>(\n this: Scope<T>,\n selector: Constrain<P, Path<T>>,\n options?: UseStoreOptions<Value<T, P>>,\n): [value: Value<T, P>, setValue: Store<Value<T, P>>['set']];\n\nfunction boundUseScopeProp<T>(\n this: Scope<T>,\n options?: UseStoreOptions<T>,\n): [value: T, setValue: Store<T>['set']];\n\nfunction boundUseScopeProp(this: Scope<any>, ...args: any[]) {\n return useScopeProp(this, ...args);\n}\n\nfunction Provider<T>(this: Scope<T>, props: Omit<ScopeProps<T>, 'scope'>): React.JSX.Element {\n return ScopeProvider({ ...props, scope: this });\n}\n\nexport const scopeMethods: {\n useScope: typeof boundUseScope;\n useStore: typeof boundUseScopeStore;\n useProp: typeof boundUseScopeProp;\n Provider: typeof Provider;\n} = {\n useScope: boundUseScope,\n useStore: boundUseScopeStore,\n useProp: boundUseScopeProp,\n Provider,\n};\n","import type { Selector, Store, Update } from '@core';\nimport type { Constrain } from '@lib/constrain';\nimport type { Path, Value } from '@lib/path';\nimport { useProp } from '@react/useProp';\nimport { type UseStoreOptions, useStore } from '@react/useStore';\n\nfunction boundUseStore<T, S>(\n this: Store<T>,\n selector: Selector<T, S>,\n option?: UseStoreOptions<S>,\n): S;\nfunction boundUseStore<T, const P>(\n this: Store<T>,\n selector: Constrain<P, Path<T>>,\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, const P>(\n this: Store<T>,\n selector: Constrain<P, Path<T>>,\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 storeMethods: {\n useStore: typeof boundUseStore;\n useProp: typeof boundUseProp;\n} = {\n useStore: boundUseStore,\n useProp: boundUseProp,\n};\n"],"mappings":";;;;;;;;;AAGA,MAAM,oBAAoC,uBAAO,cAAc;AAK/D,SAAgB,cACd,OACA,SAAsCA,8BACpB;AAClB,KAAI,CAACC,iCAAc,MAAM,IAAI,CAAC,MAAM,QAAQ,MAAM,CAChD,QAAO,CAAC,QAAQ,UAAU,OAAO,OAAO,MAAM,CAAC;AAIjD,SAAS,MAAc,sBAAsB;CAE7C,MAAM,OAAO,IAAI,OAA8B;CAC/C,MAAM,cAAc,IAAI,OAAmB;CAC3C,IAAI,UAAU;CAEd,SAAS,iBAAiB,WAAgB,GAAG,MAAa;EACxD,MAAM,CAAC,cAAcC,UAAQ,UAAU,cAAc,UAAU,OAAO,GAAG,KAAK,CAAC;AAE/E,OAAK,MAAM,eAAe;AACxB,OAAI,CAACD,iCAAc,WAAW,IAAI,CAAC,MAAM,QAAQ,WAAW,CAC1D,QAAO;AAGT,UAAOC,SAAO,UAAU,YAAY,GAAG,KAAK,CAAC;IAC7C;AAEF,MAAI,OACF,aAAY,KAAK,OAAO;AAG1B,SAAO;;CAGT,SAAS,gBAAgB,WAAgB,GAAG,MAAa;EACvD,MAAM,kBAAkB,UAAU,OAAO,GAAG,KAAK;AAEjD,OAAK,MAAM,eAAe;AACx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