cross-state 1.9.6 → 1.9.7
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-Bcr0h7-x.d.cts → diff-BzE2cDaU.d.cts} +2 -2
- package/dist/{diff-CwiTYAVK.d.ts → diff-Cvc-z20n.d.ts} +2 -2
- package/dist/{extendedJson-DA3RQ_ly.js → extendedJson-BOmrkRrD.js} +2 -2
- package/dist/{extendedJson-DA3RQ_ly.js.map → extendedJson-BOmrkRrD.js.map} +1 -1
- package/dist/{extendedJson-DzXMFE1P.cjs → extendedJson-pbOLcymB.cjs} +2 -2
- package/dist/{extendedJson-DzXMFE1P.cjs.map → extendedJson-pbOLcymB.cjs.map} +1 -1
- package/dist/index.cjs +9 -8
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +6 -6
- package/dist/index.d.ts +6 -6
- package/dist/index.js +8 -8
- package/dist/index.js.map +1 -1
- package/dist/mutative/index.cjs +2 -1
- package/dist/mutative/index.d.cts +1 -1
- package/dist/mutative/index.d.ts +1 -1
- package/dist/mutative/index.js +1 -1
- package/dist/mutative/register.cjs +2 -2
- package/dist/mutative/register.cjs.map +1 -1
- package/dist/mutative/register.d.cts +2 -2
- package/dist/mutative/register.d.ts +2 -2
- package/dist/mutative/register.js +2 -2
- package/dist/mutative/register.js.map +1 -1
- package/dist/{mutativeMethods-CwDMtUNs.cjs → mutativeMethods-AiKkraqx.cjs} +1 -1
- package/dist/mutativeMethods-AiKkraqx.cjs.map +1 -0
- package/dist/{mutativeMethods-Do8JiJ5A.d.cts → mutativeMethods-BHPlSHBi.d.cts} +2 -2
- package/dist/{mutativeMethods-t67Kp1uA.d.ts → mutativeMethods-COQxFB3B.d.ts} +2 -2
- package/dist/{mutativeMethods-BrDU8SwY.js → mutativeMethods-qVJ36MY5.js} +1 -1
- package/dist/mutativeMethods-qVJ36MY5.js.map +1 -0
- package/dist/{patchMethods-C21iQqML.d.ts → patchMethods--ekCkYUF.d.ts} +4 -4
- package/dist/{patchMethods-CZje49Dk.cjs → patchMethods-BBQDDqwe.cjs} +9 -9
- package/dist/patchMethods-BBQDDqwe.cjs.map +1 -0
- package/dist/{patchMethods-Cui462lc.js → patchMethods-D3cdG80W.js} +9 -9
- package/dist/patchMethods-D3cdG80W.js.map +1 -0
- package/dist/{patchMethods-Cyb6MEOG.d.cts → patchMethods-R3f7HxTy.d.cts} +4 -4
- package/dist/patches/index.cjs +2 -1
- package/dist/patches/index.d.cts +1 -1
- package/dist/patches/index.d.ts +1 -1
- package/dist/patches/index.js +1 -1
- package/dist/patches/register.cjs +2 -2
- package/dist/patches/register.cjs.map +1 -1
- package/dist/patches/register.d.cts +2 -2
- package/dist/patches/register.d.ts +2 -2
- package/dist/patches/register.js +2 -2
- package/dist/patches/register.js.map +1 -1
- package/dist/{path-Il5r4PV4.cjs → path-B9-Z0127.cjs} +1 -1
- package/dist/{path-Il5r4PV4.cjs.map → path-B9-Z0127.cjs.map} +1 -1
- package/dist/{path-CCEtQjMB.js → path-C-5jTZu5.js} +1 -1
- package/dist/{path-CCEtQjMB.js.map → path-C-5jTZu5.js.map} +1 -1
- package/dist/persist/register.cjs +2 -2
- package/dist/persist/register.cjs.map +1 -1
- package/dist/persist/register.d.cts +2 -2
- package/dist/persist/register.d.ts +2 -2
- package/dist/persist/register.js +2 -2
- package/dist/persist/register.js.map +1 -1
- package/dist/{persist-CG1WHP6D.cjs → persist-B341lrOA.cjs} +43 -45
- package/dist/persist-B341lrOA.cjs.map +1 -0
- package/dist/{persist-CkZ7CzW8.d.cts → persist-CoSWtRt0.d.cts} +3 -3
- package/dist/{persist-3Nff6j1f.d.ts → persist-XVT4fROX.d.ts} +3 -3
- package/dist/{persist-CNA2sYtB.js → persist-xv73m7UR.js} +43 -45
- package/dist/persist-xv73m7UR.js.map +1 -0
- package/dist/{propAccess-BxCKNeOj.js → propAccess-CsUaG5V_.js} +8 -8
- package/dist/propAccess-CsUaG5V_.js.map +1 -0
- package/dist/{propAccess-udIdjqwY.cjs → propAccess-DdLF12Jq.cjs} +8 -8
- package/dist/propAccess-DdLF12Jq.cjs.map +1 -0
- package/dist/react/index.cjs +118 -117
- package/dist/react/index.cjs.map +1 -1
- package/dist/react/index.d.cts +98 -98
- package/dist/react/index.d.ts +97 -97
- package/dist/react/index.js +119 -119
- package/dist/react/index.js.map +1 -1
- package/dist/react/register.cjs +3 -3
- package/dist/react/register.cjs.map +1 -1
- package/dist/react/register.d.cts +2 -2
- package/dist/react/register.d.ts +2 -2
- package/dist/react/register.js +3 -3
- package/dist/react/register.js.map +1 -1
- package/dist/{scope-DkX72a-2.cjs → scope-8MUrzqlS.cjs} +60 -60
- package/dist/scope-8MUrzqlS.cjs.map +1 -0
- package/dist/{scope-8uUaV6I8.d.cts → scope-BQjncWGt.d.cts} +25 -25
- package/dist/{scope-CQE3HDNI.js → scope-BfaweXvz.js} +61 -61
- package/dist/scope-BfaweXvz.js.map +1 -0
- package/dist/{scope-qdOAlRWQ.d.ts → scope-BztVo2P8.d.ts} +25 -25
- package/dist/{store-D4q5zD7q.js → store-BmlnyYal.js} +81 -81
- package/dist/store-BmlnyYal.js.map +1 -0
- package/dist/{store-Cq1PqvEo.d.ts → store-dThvqc0k.d.cts} +55 -55
- package/dist/{store-21GsOOLS.d.cts → store-dThvqc0k.d.ts} +55 -55
- package/dist/{store-CPqOf4y5.cjs → store-fmAYV5hy.cjs} +80 -80
- package/dist/store-fmAYV5hy.cjs.map +1 -0
- package/dist/{storeMethods-BjuI0joo.d.cts → storeMethods-CYX3AAnA.d.ts} +4 -4
- package/dist/{storeMethods-BZb4k7Ma.cjs → storeMethods-DYgUGHSk.cjs} +14 -14
- package/dist/storeMethods-DYgUGHSk.cjs.map +1 -0
- package/dist/{storeMethods-CK9-Q17H.d.ts → storeMethods-DrMQ7hqX.d.cts} +4 -4
- package/dist/{storeMethods-CWeGkXoz.js → storeMethods-pGlt0zfb.js} +14 -14
- package/dist/storeMethods-pGlt0zfb.js.map +1 -0
- package/package.json +46 -63
- package/dist/mutativeMethods-BrDU8SwY.js.map +0 -1
- package/dist/mutativeMethods-CwDMtUNs.cjs.map +0 -1
- package/dist/patchMethods-CZje49Dk.cjs.map +0 -1
- package/dist/patchMethods-Cui462lc.js.map +0 -1
- package/dist/persist-CG1WHP6D.cjs.map +0 -1
- package/dist/persist-CNA2sYtB.js.map +0 -1
- package/dist/propAccess-BxCKNeOj.js.map +0 -1
- package/dist/propAccess-udIdjqwY.cjs.map +0 -1
- package/dist/scope-CQE3HDNI.js.map +0 -1
- package/dist/scope-DkX72a-2.cjs.map +0 -1
- package/dist/store-CPqOf4y5.cjs.map +0 -1
- package/dist/store-D4q5zD7q.js.map +0 -1
- package/dist/storeMethods-BZb4k7Ma.cjs.map +0 -1
- package/dist/storeMethods-CWeGkXoz.js.map +0 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"store-BmlnyYal.js","names":[],"sources":["../src/lib/autobind.ts","../src/lib/deferred.ts","../src/lib/isPromise.ts","../src/lib/promiseWithState.ts","../src/lib/queue.ts","../src/lib/calculatedValue.ts","../src/lib/duration.ts","../src/lib/debounce.ts","../src/lib/disposable.ts","../src/lib/forwardError.ts","../src/lib/makeSelector.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","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 void 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 void 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 { type ErrorState, type PendingState, type ValueState } from './cacheState';\nimport { type MaybePromise } from './maybePromise';\nimport isPromise from '@lib/isPromise';\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 void 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 type { MaybePromise } from './maybePromise';\nimport type { Listener } from '@core';\nimport isPromise from '@lib/isPromise';\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 void 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 { deepEqual } from './equals';\nimport 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';\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 void 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 void q(() => {\n if (!connection?.active) {\n return;\n }\n\n value = _value;\n notify();\n });\n },\n updateValue(update) {\n void 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 void 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 void 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 { Duration, DurationObject } from '../core/commonTypes';\n\nconst unitToMilliseconds = {\n ns: 1e-6,\n us: 1e-3,\n µs: 1e-3,\n ms: 1,\n s: 1_000,\n m: 60_000,\n h: 3_600_000,\n D: 86_400_000, // approximation - not accounting for DST changes\n M: 2_592_000_000, // approximation - 30 days\n Y: 31_536_000_000, // approximation - 365 days\n} satisfies Record<string, number>;\n\nexport function calcDuration(t: Duration): number {\n switch (typeof t) {\n case 'number':\n return t;\n case 'string':\n return calcDurationString(t);\n default:\n return calcDurationObject(t);\n }\n}\n\nconst plainNumberStyle = /^-?\\d+(\\.\\d+)?$/;\nconst golangStyle = /^-?(\\d+(\\.\\d+)?(h|m|s|ms|us|µs|ns))+$/;\nconst dotnetStyle =\n /^(?<sign>-)?((?<D>\\d+)\\.)?(?<h>\\d{1,2}):(?<m>\\d{1,2})(:(?<s>\\d{1,2}))?(\\.(?<ms>\\d{1,3}))?$/;\nconst iso8601Style =\n /^(?<sign>-)?P((?<Y>\\d+)Y)?((?<M>\\d+)M)?((?<D>\\d+)D)?T?((?<h>\\d+)H)?((?<m>\\d+)M)?((?<s>\\d+(\\.\\d+)?)S)?$/;\n\nexport function calcDurationString(t: string): number {\n let match;\n\n if (plainNumberStyle.test(t)) {\n return parseFloat(t);\n }\n\n if (golangStyle.test(t)) {\n let ms = 0;\n let sign = 1;\n\n if (t.startsWith('-')) {\n sign = -1;\n t = t.slice(1);\n }\n\n const parts = t.split(/(\\d+(?:\\.\\d+))|([a-zµ]+)/).filter(Boolean);\n for (let i = 0; i < parts.length; i += 2) {\n const value = parseFloat(parts[i]!);\n const unit = parts[i + 1] as keyof typeof unitToMilliseconds;\n ms += value * unitToMilliseconds[unit];\n }\n\n return ms * sign;\n }\n\n if ((match = t.match(dotnetStyle) ?? t.match(iso8601Style))) {\n let ms = 0;\n let sign = 1;\n\n for (const [unit, factor] of Object.entries(match.groups ?? {})) {\n if (!factor) {\n continue;\n }\n if (unit === 'sign') {\n sign = -1;\n continue;\n }\n\n ms += parseFloat(factor) * unitToMilliseconds[unit as keyof typeof unitToMilliseconds];\n }\n\n return ms * sign;\n }\n\n throw new Error(`Invalid duration string: \"${t}\"`);\n}\n\nexport function calcDurationObject(t: DurationObject): number {\n return (\n (t.milliseconds ?? 0) +\n (t.seconds ?? 0) * unitToMilliseconds.s +\n (t.minutes ?? 0) * unitToMilliseconds.m +\n (t.hours ?? 0) * unitToMilliseconds.h +\n (t.days ?? 0) * unitToMilliseconds.D +\n (t.months ?? 0) * unitToMilliseconds.M +\n (t.years ?? 0) * unitToMilliseconds.Y\n );\n}\n","import { calcDuration } from './duration';\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 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 { 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 void 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 './duration';\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 type {\n CalculationActions,\n Cancel,\n DisposableCancel,\n Duration,\n Effect,\n EffectOptions,\n Listener,\n Selector,\n SubscribeOptions,\n Update,\n} from './commonTypes';\nimport { autobind } from '@lib/autobind';\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 { calcDuration } from '@lib/duration';\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';\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);\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 signal,\n } = options ?? {};\n\n if (signal?.aborted) {\n return disposable(() => {});\n }\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 signal?.addEventListener('abort', cancel);\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 = this.options.retain, signal }: EffectOptions = {},\n ): DisposableCancel {\n if (signal?.aborted) {\n return disposable(() => {});\n }\n\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 const cancel = () => {\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 signal?.addEventListener('abort', cancel);\n return disposable(cancel);\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,UAAU;AAEhC,MAAa,YAGX,WACW;CACX,KAAK,MAAM,OAAO,QAAQ,QAAQ,OAAO,SAAS,GAAG;EACnD,IAAI,QAAQ,eACV;EAGF,MAAM,aAAa,QAAQ,yBAAyB,OAAO,WAAW,GAAG;EACzE,IAAI,SAAS,YAAY,MAAM,KAAK,YAAY;EAChD,IAAI,YAAY;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//#endregion
|
|
7
|
-
//#region src/lib/typeHelpers.d.ts
|
|
8
|
-
type Object_ = Record<string | number | symbol, any>;
|
|
9
|
-
type Array_ = readonly any[];
|
|
10
|
-
type StringToNumber<T> = T extends `${infer K extends number}` ? K : never;
|
|
11
|
-
type ArrayToStringPath<T> = T extends readonly [] ? "" : T extends readonly [infer First extends string | number, ...infer Rest] ? First extends `${string}.${string}` ? never : Rest extends readonly [] ? `${First}` : `${First}.${ArrayToStringPath<Rest>}` : T extends readonly KeyType[] ? string : never;
|
|
12
|
-
type StringToArrayPath<T> = T extends "" ? readonly [] : T extends `${infer First}.${infer Rest}` ? readonly [First, ...StringToArrayPath<Rest>] : readonly [T];
|
|
13
|
-
type OptionalPropertyOf<T> = Exclude<{ [K in keyof T]: string extends K ? K : number extends K ? K : symbol extends K ? K : T extends Record<K, T[K]> ? never : K }[keyof T], undefined>;
|
|
14
|
-
type OptionalProperties<T> = Pick<T, OptionalPropertyOf<T>>;
|
|
15
|
-
type IsAny<T> = 0 extends 1 & T ? true : false;
|
|
16
|
-
type IsNever<T> = [T] extends [never] ? true : false;
|
|
17
|
-
//#endregion
|
|
18
|
-
//#region src/lib/path.d.ts
|
|
19
|
-
type KeyType = string | number | symbol;
|
|
20
|
-
type AnyPath = string | readonly KeyType[];
|
|
21
|
-
type GetKeys<T extends Object_ | Array_> = T extends Array_ ? T extends readonly [] ? never : "0" extends keyof T ? StringToNumber<keyof T> : number : keyof T;
|
|
22
|
-
type _PathAsArray<T, Optional, MaxDepth, Depth extends 1[]> = (Optional extends false ? readonly [] : never) | (true extends IsAny<T> ? readonly KeyType[] : T extends never ? never : T extends Object_ ? Depth["length"] extends MaxDepth ? readonly string[] : T extends Map<infer K extends KeyType, infer V> ? readonly [K] | readonly [K, ..._PathAsArray<V, Optional, MaxDepth, [...Depth, 1]>] : T extends Set<any> ? readonly [number] : { [K in GetKeys<T>]: (Optional extends true ? K extends OptionalPropertyOf<T> ? readonly [K] : never : readonly [K]) | readonly [K, ..._PathAsArray<T[K], Optional, MaxDepth, [...Depth, 1]>] }[GetKeys<T>] : never);
|
|
23
|
-
type PathAsArray<T, Optional extends boolean = false, MaxDepth extends number = 5> = _PathAsArray<T, Optional, MaxDepth, []>;
|
|
24
|
-
type PathAsString<T, Optional extends boolean = false, MaxDepth extends number = 5> = ArrayToStringPath<PathAsArray<T, Optional, MaxDepth>>;
|
|
25
|
-
type Path<T, Optional extends boolean = false, MaxDepth extends number = 5> = PathAsString<T, Optional, MaxDepth> | PathAsArray<T, Optional, MaxDepth>;
|
|
26
|
-
type Value<T, P$1> = P$1 extends readonly [] ? T : true extends IsAny<T> | IsAny<P$1> ? any : true extends IsNever<T> | IsNever<P$1> ? never : P$1 extends string ? Value<T, StringToArrayPath<P$1>> : P$1 extends readonly [infer First extends KeyType, ...infer Rest extends readonly KeyType[]] ? T extends Map<any, infer V> | Set<infer V> ? Value<V, Rest> | undefined : T extends Array_ ? any[] extends T ? Value<T[First & keyof T], Rest> | undefined : Value<T[First & keyof T], Rest> : T extends Object_ ? Record<any, any> extends T ? Value<T[First], Rest> | undefined : Value<T[First], Rest> : never : never;
|
|
27
|
-
type _WildcardPathAsArray<T, MaxDepth, Depth extends 1[]> = [] | (0 extends 1 & T ? KeyType[] : T extends never ? never : T extends Object_ ? Depth["length"] extends MaxDepth ? string[] : T extends Map<infer K extends KeyType, infer V> ? ["*"] | [K] | [K, ..._WildcardPathAsArray<V, MaxDepth, [...Depth, 1]>] : T extends Set<any> ? ["*"] | [number] : Record<string, any> extends T ? ["*"] | ["*", ..._WildcardPathAsArray<T[string], MaxDepth, [...Depth, 1]>] : { [K in GetKeys<T>]: ["*"] | ["*", ..._WildcardPathAsArray<T[T extends readonly any[] ? number : keyof T], MaxDepth, [...Depth, 1]>] | [K] | [K, ..._WildcardPathAsArray<T[K], MaxDepth, [...Depth, 1]>] }[GetKeys<T>] : never);
|
|
28
|
-
type WildcardPathAsArray<T, MaxDepth extends number = 5> = _WildcardPathAsArray<T, MaxDepth, []>;
|
|
29
|
-
type WildcardPathAsString<T, MaxDepth extends number = 5> = ArrayToStringPath<_WildcardPathAsArray<T, MaxDepth, []>>;
|
|
30
|
-
type WildcardPath<T, MaxDepth extends number = 5> = WildcardPathAsString<T, MaxDepth> | WildcardPathAsArray<T, MaxDepth>;
|
|
31
|
-
type WildcardValue<T, P$1> = true extends IsAny<T> | IsAny<P$1> ? any : true extends IsNever<T> | IsNever<P$1> ? never : P$1 extends string ? WildcardValue<T, StringToArrayPath<P$1>> : P$1 extends readonly [infer First extends KeyType, ...infer Rest extends KeyType[]] ? T extends Map<any, infer V> | Set<infer V> ? WildcardValue<V, Rest> | (First extends "*" ? never : undefined) : T extends Array_ ? First extends "*" ? WildcardValue<T[number], Rest> : any[] extends T ? WildcardValue<T[First & keyof T], Rest> | undefined : First extends keyof T ? WildcardValue<T[First], Rest> : undefined : T extends Object_ ? First extends "*" ? WildcardValue<T[keyof T], Rest> : Record<any, any> extends T ? WildcardValue<T[First], Rest> | undefined : WildcardValue<T[First], Rest> : never : T;
|
|
32
|
-
type Join<A extends string | number, B extends string | number> = A extends "" ? B : B extends "" ? A : `${A}.${B}`;
|
|
33
|
-
type _SettablePathAsArray<T, MaxDepth, Depth extends 1[]> = readonly [] | (true extends IsAny<T> ? readonly KeyType[] : undefined extends T ? T extends Map<any, any> | Set<any> ? never : T extends Object_ ? { [K in GetKeys<T>]: Partial<T> extends Omit<T, K> ? readonly [K] | readonly [K, ..._SettablePathAsArray<T[K], MaxDepth, [...Depth, 1]>] : readonly [] }[GetKeys<T>] : never : T extends never ? never : T extends Object_ ? Depth["length"] extends MaxDepth ? readonly string[] : T extends Map<infer K extends KeyType, infer V> ? readonly [K] | readonly [K, ..._SettablePathAsArray<V, MaxDepth, [...Depth, 1]>] : T extends Set<any> ? readonly [number] : { [K in GetKeys<T>]: readonly [K] | readonly [K, ..._SettablePathAsArray<T[K], MaxDepth, [...Depth, 1]>] }[GetKeys<T>] : never);
|
|
34
|
-
type SettablePathAsArray<T, MaxDepth extends number = 5> = _SettablePathAsArray<T, MaxDepth, []>;
|
|
35
|
-
type SettablePathAsString<T, MaxDepth extends number = 5> = ArrayToStringPath<SettablePathAsArray<T, MaxDepth>>;
|
|
36
|
-
type SettablePath<T, MaxDepth extends number = 5> = SettablePathAsString<T, MaxDepth> | SettablePathAsArray<T, MaxDepth>;
|
|
37
|
-
type SettableValue<T, P$1> = P$1 extends readonly [] ? T : true extends IsAny<T> | IsAny<P$1> ? any : true extends IsNever<T> | IsNever<P$1> ? never : P$1 extends string ? SettableValue<T, StringToArrayPath<P$1>> : P$1 extends readonly [infer First extends KeyType, ...infer Rest extends readonly KeyType[]] ? T extends Map<any, infer V> | Set<infer V> ? SettableValue<V, Rest> : T extends Array_ ? SettableValue<T[First & keyof T], Rest> : T extends Object_ ? SettableValue<T[First], Rest> : never : never;
|
|
38
|
-
//#endregion
|
|
39
1
|
//#region src/lib/debounce.d.ts
|
|
40
2
|
type DebounceOptions = Duration | {
|
|
41
3
|
wait: Duration;
|
|
@@ -43,12 +5,15 @@ type DebounceOptions = Duration | {
|
|
|
43
5
|
waitOnRunNow?: boolean;
|
|
44
6
|
};
|
|
45
7
|
//#endregion
|
|
8
|
+
//#region src/lib/maybePromise.d.ts
|
|
9
|
+
type MaybePromise<T> = T | Promise<T>;
|
|
10
|
+
//#endregion
|
|
46
11
|
//#region src/core/commonTypes.d.ts
|
|
47
12
|
interface Listener<T = void, TThis = unknown> {
|
|
48
13
|
(this: TThis, value: T, previouseValue?: T): void;
|
|
49
14
|
}
|
|
50
|
-
interface Selector<T, S
|
|
51
|
-
(value: T): S
|
|
15
|
+
interface Selector<T, S> {
|
|
16
|
+
(value: T): S;
|
|
52
17
|
}
|
|
53
18
|
interface Effect<T> {
|
|
54
19
|
(this: T, context: T): void | Cancel;
|
|
@@ -99,13 +64,13 @@ interface DurationObject {
|
|
|
99
64
|
years?: number;
|
|
100
65
|
}
|
|
101
66
|
type Duration = number | string | DurationObject;
|
|
102
|
-
type UpdateFrom<Value
|
|
103
|
-
type Update<Value
|
|
104
|
-
interface UpdateFunction<Value
|
|
105
|
-
(update: Update<Value
|
|
67
|
+
type UpdateFrom<Value, From extends any[]> = Value | ((...args: From) => Value);
|
|
68
|
+
type Update<Value> = UpdateFrom<Value, [Value]>;
|
|
69
|
+
interface UpdateFunction<Value> {
|
|
70
|
+
(update: Update<Value>): void;
|
|
106
71
|
}
|
|
107
|
-
interface AsyncUpdateFunction<Value
|
|
108
|
-
(update: UpdateFrom<MaybePromise<Value
|
|
72
|
+
interface AsyncUpdateFunction<Value> {
|
|
73
|
+
(update: UpdateFrom<MaybePromise<Value>, [Value]>): void;
|
|
109
74
|
}
|
|
110
75
|
interface StoreLike<T> {
|
|
111
76
|
get(): T;
|
|
@@ -144,6 +109,41 @@ interface CalculatedValue<T> {
|
|
|
144
109
|
invalidateDependencies(recursive?: boolean): void;
|
|
145
110
|
}
|
|
146
111
|
//#endregion
|
|
112
|
+
//#region src/lib/constrain.d.ts
|
|
113
|
+
type Constrain<T, S> = T & S;
|
|
114
|
+
//#endregion
|
|
115
|
+
//#region src/lib/typeHelpers.d.ts
|
|
116
|
+
type Object_ = Record<string | number | symbol, any>;
|
|
117
|
+
type Array_ = readonly any[];
|
|
118
|
+
type StringToNumber<T> = T extends `${infer K extends number}` ? K : never;
|
|
119
|
+
type ArrayToStringPath<T> = T extends readonly [] ? "" : T extends readonly [infer First extends string | number, ...infer Rest] ? First extends `${string}.${string}` ? never : Rest extends readonly [] ? `${First}` : `${First}.${ArrayToStringPath<Rest>}` : T extends readonly KeyType[] ? string : never;
|
|
120
|
+
type StringToArrayPath<T> = T extends "" ? readonly [] : T extends `${infer First}.${infer Rest}` ? readonly [First, ...StringToArrayPath<Rest>] : readonly [T];
|
|
121
|
+
type OptionalPropertyOf<T> = Exclude<{ [K in keyof T]: string extends K ? K : number extends K ? K : symbol extends K ? K : T extends Record<K, T[K]> ? never : K }[keyof T], undefined>;
|
|
122
|
+
type OptionalProperties<T> = Pick<T, OptionalPropertyOf<T>>;
|
|
123
|
+
type IsAny<T> = 0 extends 1 & T ? true : false;
|
|
124
|
+
type IsNever<T> = [T] extends [never] ? true : false;
|
|
125
|
+
//#endregion
|
|
126
|
+
//#region src/lib/path.d.ts
|
|
127
|
+
type KeyType = string | number | symbol;
|
|
128
|
+
type AnyPath = string | readonly KeyType[];
|
|
129
|
+
type GetKeys<T extends Object_ | Array_> = T extends Array_ ? T extends readonly [] ? never : "0" extends keyof T ? StringToNumber<keyof T> : number : keyof T;
|
|
130
|
+
type _PathAsArray<T, Optional, MaxDepth, Depth extends 1[]> = (Optional extends false ? readonly [] : never) | (true extends IsAny<T> ? readonly KeyType[] : T extends never ? never : T extends Object_ ? Depth["length"] extends MaxDepth ? readonly string[] : T extends Map<infer K extends KeyType, infer V> ? readonly [K] | readonly [K, ..._PathAsArray<V, Optional, MaxDepth, [...Depth, 1]>] : T extends Set<any> ? readonly [number] : { [K in GetKeys<T>]: (Optional extends true ? K extends OptionalPropertyOf<T> ? readonly [K] : never : readonly [K]) | readonly [K, ..._PathAsArray<T[K], Optional, MaxDepth, [...Depth, 1]>] }[GetKeys<T>] : never);
|
|
131
|
+
type PathAsArray<T, Optional extends boolean = false, MaxDepth extends number = 5> = _PathAsArray<T, Optional, MaxDepth, []>;
|
|
132
|
+
type PathAsString<T, Optional extends boolean = false, MaxDepth extends number = 5> = ArrayToStringPath<PathAsArray<T, Optional, MaxDepth>>;
|
|
133
|
+
type Path<T, Optional extends boolean = false, MaxDepth extends number = 5> = PathAsString<T, Optional, MaxDepth> | PathAsArray<T, Optional, MaxDepth>;
|
|
134
|
+
type Value<T, P> = P extends readonly [] ? T : true extends IsAny<T> | IsAny<P> ? any : true extends IsNever<T> | IsNever<P> ? never : P extends string ? Value<T, StringToArrayPath<P>> : P extends readonly [infer First extends KeyType, ...infer Rest extends readonly KeyType[]] ? T extends Map<any, infer V> | Set<infer V> ? Value<V, Rest> | undefined : T extends Array_ ? any[] extends T ? Value<T[First & keyof T], Rest> | undefined : Value<T[First & keyof T], Rest> : T extends Object_ ? Record<any, any> extends T ? Value<T[First], Rest> | undefined : Value<T[First], Rest> : never : never;
|
|
135
|
+
type _WildcardPathAsArray<T, MaxDepth, Depth extends 1[]> = [] | (0 extends 1 & T ? KeyType[] : T extends never ? never : T extends Object_ ? Depth["length"] extends MaxDepth ? string[] : T extends Map<infer K extends KeyType, infer V> ? ["*"] | [K] | [K, ..._WildcardPathAsArray<V, MaxDepth, [...Depth, 1]>] : T extends Set<any> ? ["*"] | [number] : Record<string, any> extends T ? ["*"] | ["*", ..._WildcardPathAsArray<T[string], MaxDepth, [...Depth, 1]>] : { [K in GetKeys<T>]: ["*"] | ["*", ..._WildcardPathAsArray<T[T extends readonly any[] ? number : keyof T], MaxDepth, [...Depth, 1]>] | [K] | [K, ..._WildcardPathAsArray<T[K], MaxDepth, [...Depth, 1]>] }[GetKeys<T>] : never);
|
|
136
|
+
type WildcardPathAsArray<T, MaxDepth extends number = 5> = _WildcardPathAsArray<T, MaxDepth, []>;
|
|
137
|
+
type WildcardPathAsString<T, MaxDepth extends number = 5> = ArrayToStringPath<_WildcardPathAsArray<T, MaxDepth, []>>;
|
|
138
|
+
type WildcardPath<T, MaxDepth extends number = 5> = WildcardPathAsString<T, MaxDepth> | WildcardPathAsArray<T, MaxDepth>;
|
|
139
|
+
type WildcardValue<T, P> = true extends IsAny<T> | IsAny<P> ? any : true extends IsNever<T> | IsNever<P> ? never : P extends string ? WildcardValue<T, StringToArrayPath<P>> : P extends readonly [infer First extends KeyType, ...infer Rest extends KeyType[]] ? T extends Map<any, infer V> | Set<infer V> ? WildcardValue<V, Rest> | (First extends "*" ? never : undefined) : T extends Array_ ? First extends "*" ? WildcardValue<T[number], Rest> : any[] extends T ? WildcardValue<T[First & keyof T], Rest> | undefined : First extends keyof T ? WildcardValue<T[First], Rest> : undefined : T extends Object_ ? First extends "*" ? WildcardValue<T[keyof T], Rest> : Record<any, any> extends T ? WildcardValue<T[First], Rest> | undefined : WildcardValue<T[First], Rest> : never : T;
|
|
140
|
+
type Join<A extends string | number, B extends string | number> = A extends "" ? B : B extends "" ? A : `${A}.${B}`;
|
|
141
|
+
type _SettablePathAsArray<T, MaxDepth, Depth extends 1[]> = readonly [] | (true extends IsAny<T> ? readonly KeyType[] : undefined extends T ? T extends Map<any, any> | Set<any> ? never : T extends Object_ ? { [K in GetKeys<T>]: Partial<T> extends Omit<T, K> ? readonly [K] | readonly [K, ..._SettablePathAsArray<T[K], MaxDepth, [...Depth, 1]>] : readonly [] }[GetKeys<T>] : never : T extends never ? never : T extends Object_ ? Depth["length"] extends MaxDepth ? readonly string[] : T extends Map<infer K extends KeyType, infer V> ? readonly [K] | readonly [K, ..._SettablePathAsArray<V, MaxDepth, [...Depth, 1]>] : T extends Set<any> ? readonly [number] : { [K in GetKeys<T>]: readonly [K] | readonly [K, ..._SettablePathAsArray<T[K], MaxDepth, [...Depth, 1]>] }[GetKeys<T>] : never);
|
|
142
|
+
type SettablePathAsArray<T, MaxDepth extends number = 5> = _SettablePathAsArray<T, MaxDepth, []>;
|
|
143
|
+
type SettablePathAsString<T, MaxDepth extends number = 5> = ArrayToStringPath<SettablePathAsArray<T, MaxDepth>>;
|
|
144
|
+
type SettablePath<T, MaxDepth extends number = 5> = SettablePathAsString<T, MaxDepth> | SettablePathAsArray<T, MaxDepth>;
|
|
145
|
+
type SettableValue<T, P> = P extends readonly [] ? T : true extends IsAny<T> | IsAny<P> ? any : true extends IsNever<T> | IsNever<P> ? never : P extends string ? SettableValue<T, StringToArrayPath<P>> : P extends readonly [infer First extends KeyType, ...infer Rest extends readonly KeyType[]] ? T extends Map<any, infer V> | Set<infer V> ? SettableValue<V, Rest> : T extends Array_ ? SettableValue<T[First & keyof T], Rest> : T extends Object_ ? SettableValue<T[First], Rest> : never : never;
|
|
146
|
+
//#endregion
|
|
147
147
|
//#region src/lib/promiseWithCancel.d.ts
|
|
148
148
|
declare class PromiseWithCancel<T> extends Promise<T> {
|
|
149
149
|
private abortController;
|
|
@@ -155,12 +155,12 @@ declare class PromiseWithCancel<T> extends Promise<T> {
|
|
|
155
155
|
type Function_ = (...args: any) => any;
|
|
156
156
|
declare const arrayMethods: { [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 };
|
|
157
157
|
declare const recordMethods: {
|
|
158
|
-
delete<T extends Record<any, any>, K
|
|
158
|
+
delete<T extends Record<any, any>, K extends OptionalPropertyOf<T>>(this: Store<T>, key: K): void;
|
|
159
159
|
clear<T extends Record<any, any>>(this: OptionalProperties<T> extends T ? Store<T> : never): void;
|
|
160
160
|
};
|
|
161
161
|
declare const mapMethods: {
|
|
162
|
-
delete<K
|
|
163
|
-
clear<K
|
|
162
|
+
delete<K, V>(this: Store<Map<K, V>>, key: K): boolean;
|
|
163
|
+
clear<K, V>(this: Store<Map<K, V>>): void;
|
|
164
164
|
};
|
|
165
165
|
declare const setMethods: {
|
|
166
166
|
add<T>(this: Store<Set<T>>, value: T): void;
|
|
@@ -217,16 +217,16 @@ declare class Store<T> {
|
|
|
217
217
|
} | undefined);
|
|
218
218
|
get(): T;
|
|
219
219
|
set(update: Update<T>): void;
|
|
220
|
-
set<const P
|
|
220
|
+
set<const P>(path: Constrain<P, Path<T>>, update: Update<Value<T, P>>): void;
|
|
221
221
|
invalidate(recursive?: boolean): void;
|
|
222
222
|
subscribe(listener: Listener<T, {
|
|
223
223
|
cancel: Cancel;
|
|
224
224
|
}>, options?: SubscribeOptions): DisposableCancel;
|
|
225
|
-
once<S
|
|
225
|
+
once<S extends T>(condition: (value: T) => value is S, options?: OnceOptions): PromiseWithCancel<S>;
|
|
226
226
|
once(condition: (value: T) => boolean, options?: OnceOptions): PromiseWithCancel<T>;
|
|
227
227
|
once(options?: OnceOptions): PromiseWithCancel<Exclude<T, undefined>>;
|
|
228
|
-
map<S
|
|
229
|
-
map<const P
|
|
228
|
+
map<S>(selector: Selector<T, S>, updater?: (value: S) => Update<T>): Store<S>;
|
|
229
|
+
map<const P>(selector: Constrain<P, SettablePath<T>>): Store<Value<T, P>>;
|
|
230
230
|
/** Add an effect that will be executed when the store becomes active, which means when it has at least one subscriber.
|
|
231
231
|
* @param effect
|
|
232
232
|
* If there is already a subscriber, the effect will be executed immediately.
|
|
@@ -253,5 +253,5 @@ declare const createStore: typeof create & {
|
|
|
253
253
|
defaultOptions: StoreOptions<any>;
|
|
254
254
|
};
|
|
255
255
|
//#endregion
|
|
256
|
-
export {
|
|
257
|
-
//# sourceMappingURL=store-
|
|
256
|
+
export { AsyncUpdateFunction as A, Selector as B, Value as C, Object_ as D, WildcardValue as E, ConnectionActions as F, Use as G, Update as H, DisposableCancel as I, MaybePromise as K, Duration as L, CalculationActions as M, Cancel as N, Constrain as O, Connection as P, Effect as R, SettableValue as S, WildcardPathAsString as T, UpdateFrom as U, SubscribeOptions as V, UpdateFunction as W, PathAsArray as _, StoreOptions as a, SettablePathAsArray as b, arrayMethods as c, setMethods as d, AnyPath as f, Path as g, KeyType as h, StoreMethods as i, BaseConnectionActions as j, AsyncConnectionActions as k, mapMethods as l, Join as m, Calculate as n, StoreOptionsWithMethods as o, GetKeys as p, Store as r, createStore as s, BoundStoreMethods as t, recordMethods as u, PathAsString as v, WildcardPath as w, SettablePathAsString as x, SettablePath as y, Listener as z };
|
|
257
|
+
//# sourceMappingURL=store-dThvqc0k.d.cts.map
|
|
@@ -1,41 +1,3 @@
|
|
|
1
|
-
//#region src/lib/constrain.d.ts
|
|
2
|
-
type Constrain<T, S$1> = T & S$1;
|
|
3
|
-
//#endregion
|
|
4
|
-
//#region src/lib/maybePromise.d.ts
|
|
5
|
-
type MaybePromise<T> = T | Promise<T>;
|
|
6
|
-
//#endregion
|
|
7
|
-
//#region src/lib/typeHelpers.d.ts
|
|
8
|
-
type Object_ = Record<string | number | symbol, any>;
|
|
9
|
-
type Array_ = readonly any[];
|
|
10
|
-
type StringToNumber<T> = T extends `${infer K extends number}` ? K : never;
|
|
11
|
-
type ArrayToStringPath<T> = T extends readonly [] ? "" : T extends readonly [infer First extends string | number, ...infer Rest] ? First extends `${string}.${string}` ? never : Rest extends readonly [] ? `${First}` : `${First}.${ArrayToStringPath<Rest>}` : T extends readonly KeyType[] ? string : never;
|
|
12
|
-
type StringToArrayPath<T> = T extends "" ? readonly [] : T extends `${infer First}.${infer Rest}` ? readonly [First, ...StringToArrayPath<Rest>] : readonly [T];
|
|
13
|
-
type OptionalPropertyOf<T> = Exclude<{ [K in keyof T]: string extends K ? K : number extends K ? K : symbol extends K ? K : T extends Record<K, T[K]> ? never : K }[keyof T], undefined>;
|
|
14
|
-
type OptionalProperties<T> = Pick<T, OptionalPropertyOf<T>>;
|
|
15
|
-
type IsAny<T> = 0 extends 1 & T ? true : false;
|
|
16
|
-
type IsNever<T> = [T] extends [never] ? true : false;
|
|
17
|
-
//#endregion
|
|
18
|
-
//#region src/lib/path.d.ts
|
|
19
|
-
type KeyType = string | number | symbol;
|
|
20
|
-
type AnyPath = string | readonly KeyType[];
|
|
21
|
-
type GetKeys<T extends Object_ | Array_> = T extends Array_ ? T extends readonly [] ? never : "0" extends keyof T ? StringToNumber<keyof T> : number : keyof T;
|
|
22
|
-
type _PathAsArray<T, Optional, MaxDepth, Depth extends 1[]> = (Optional extends false ? readonly [] : never) | (true extends IsAny<T> ? readonly KeyType[] : T extends never ? never : T extends Object_ ? Depth["length"] extends MaxDepth ? readonly string[] : T extends Map<infer K extends KeyType, infer V> ? readonly [K] | readonly [K, ..._PathAsArray<V, Optional, MaxDepth, [...Depth, 1]>] : T extends Set<any> ? readonly [number] : { [K in GetKeys<T>]: (Optional extends true ? K extends OptionalPropertyOf<T> ? readonly [K] : never : readonly [K]) | readonly [K, ..._PathAsArray<T[K], Optional, MaxDepth, [...Depth, 1]>] }[GetKeys<T>] : never);
|
|
23
|
-
type PathAsArray<T, Optional extends boolean = false, MaxDepth extends number = 5> = _PathAsArray<T, Optional, MaxDepth, []>;
|
|
24
|
-
type PathAsString<T, Optional extends boolean = false, MaxDepth extends number = 5> = ArrayToStringPath<PathAsArray<T, Optional, MaxDepth>>;
|
|
25
|
-
type Path<T, Optional extends boolean = false, MaxDepth extends number = 5> = PathAsString<T, Optional, MaxDepth> | PathAsArray<T, Optional, MaxDepth>;
|
|
26
|
-
type Value<T, P$1> = P$1 extends readonly [] ? T : true extends IsAny<T> | IsAny<P$1> ? any : true extends IsNever<T> | IsNever<P$1> ? never : P$1 extends string ? Value<T, StringToArrayPath<P$1>> : P$1 extends readonly [infer First extends KeyType, ...infer Rest extends readonly KeyType[]] ? T extends Map<any, infer V> | Set<infer V> ? Value<V, Rest> | undefined : T extends Array_ ? any[] extends T ? Value<T[First & keyof T], Rest> | undefined : Value<T[First & keyof T], Rest> : T extends Object_ ? Record<any, any> extends T ? Value<T[First], Rest> | undefined : Value<T[First], Rest> : never : never;
|
|
27
|
-
type _WildcardPathAsArray<T, MaxDepth, Depth extends 1[]> = [] | (0 extends 1 & T ? KeyType[] : T extends never ? never : T extends Object_ ? Depth["length"] extends MaxDepth ? string[] : T extends Map<infer K extends KeyType, infer V> ? ["*"] | [K] | [K, ..._WildcardPathAsArray<V, MaxDepth, [...Depth, 1]>] : T extends Set<any> ? ["*"] | [number] : Record<string, any> extends T ? ["*"] | ["*", ..._WildcardPathAsArray<T[string], MaxDepth, [...Depth, 1]>] : { [K in GetKeys<T>]: ["*"] | ["*", ..._WildcardPathAsArray<T[T extends readonly any[] ? number : keyof T], MaxDepth, [...Depth, 1]>] | [K] | [K, ..._WildcardPathAsArray<T[K], MaxDepth, [...Depth, 1]>] }[GetKeys<T>] : never);
|
|
28
|
-
type WildcardPathAsArray<T, MaxDepth extends number = 5> = _WildcardPathAsArray<T, MaxDepth, []>;
|
|
29
|
-
type WildcardPathAsString<T, MaxDepth extends number = 5> = ArrayToStringPath<_WildcardPathAsArray<T, MaxDepth, []>>;
|
|
30
|
-
type WildcardPath<T, MaxDepth extends number = 5> = WildcardPathAsString<T, MaxDepth> | WildcardPathAsArray<T, MaxDepth>;
|
|
31
|
-
type WildcardValue<T, P$1> = true extends IsAny<T> | IsAny<P$1> ? any : true extends IsNever<T> | IsNever<P$1> ? never : P$1 extends string ? WildcardValue<T, StringToArrayPath<P$1>> : P$1 extends readonly [infer First extends KeyType, ...infer Rest extends KeyType[]] ? T extends Map<any, infer V> | Set<infer V> ? WildcardValue<V, Rest> | (First extends "*" ? never : undefined) : T extends Array_ ? First extends "*" ? WildcardValue<T[number], Rest> : any[] extends T ? WildcardValue<T[First & keyof T], Rest> | undefined : First extends keyof T ? WildcardValue<T[First], Rest> : undefined : T extends Object_ ? First extends "*" ? WildcardValue<T[keyof T], Rest> : Record<any, any> extends T ? WildcardValue<T[First], Rest> | undefined : WildcardValue<T[First], Rest> : never : T;
|
|
32
|
-
type Join<A extends string | number, B extends string | number> = A extends "" ? B : B extends "" ? A : `${A}.${B}`;
|
|
33
|
-
type _SettablePathAsArray<T, MaxDepth, Depth extends 1[]> = readonly [] | (true extends IsAny<T> ? readonly KeyType[] : undefined extends T ? T extends Map<any, any> | Set<any> ? never : T extends Object_ ? { [K in GetKeys<T>]: Partial<T> extends Omit<T, K> ? readonly [K] | readonly [K, ..._SettablePathAsArray<T[K], MaxDepth, [...Depth, 1]>] : readonly [] }[GetKeys<T>] : never : T extends never ? never : T extends Object_ ? Depth["length"] extends MaxDepth ? readonly string[] : T extends Map<infer K extends KeyType, infer V> ? readonly [K] | readonly [K, ..._SettablePathAsArray<V, MaxDepth, [...Depth, 1]>] : T extends Set<any> ? readonly [number] : { [K in GetKeys<T>]: readonly [K] | readonly [K, ..._SettablePathAsArray<T[K], MaxDepth, [...Depth, 1]>] }[GetKeys<T>] : never);
|
|
34
|
-
type SettablePathAsArray<T, MaxDepth extends number = 5> = _SettablePathAsArray<T, MaxDepth, []>;
|
|
35
|
-
type SettablePathAsString<T, MaxDepth extends number = 5> = ArrayToStringPath<SettablePathAsArray<T, MaxDepth>>;
|
|
36
|
-
type SettablePath<T, MaxDepth extends number = 5> = SettablePathAsString<T, MaxDepth> | SettablePathAsArray<T, MaxDepth>;
|
|
37
|
-
type SettableValue<T, P$1> = P$1 extends readonly [] ? T : true extends IsAny<T> | IsAny<P$1> ? any : true extends IsNever<T> | IsNever<P$1> ? never : P$1 extends string ? SettableValue<T, StringToArrayPath<P$1>> : P$1 extends readonly [infer First extends KeyType, ...infer Rest extends readonly KeyType[]] ? T extends Map<any, infer V> | Set<infer V> ? SettableValue<V, Rest> : T extends Array_ ? SettableValue<T[First & keyof T], Rest> : T extends Object_ ? SettableValue<T[First], Rest> : never : never;
|
|
38
|
-
//#endregion
|
|
39
1
|
//#region src/lib/debounce.d.ts
|
|
40
2
|
type DebounceOptions = Duration | {
|
|
41
3
|
wait: Duration;
|
|
@@ -43,12 +5,15 @@ type DebounceOptions = Duration | {
|
|
|
43
5
|
waitOnRunNow?: boolean;
|
|
44
6
|
};
|
|
45
7
|
//#endregion
|
|
8
|
+
//#region src/lib/maybePromise.d.ts
|
|
9
|
+
type MaybePromise<T> = T | Promise<T>;
|
|
10
|
+
//#endregion
|
|
46
11
|
//#region src/core/commonTypes.d.ts
|
|
47
12
|
interface Listener<T = void, TThis = unknown> {
|
|
48
13
|
(this: TThis, value: T, previouseValue?: T): void;
|
|
49
14
|
}
|
|
50
|
-
interface Selector<T, S
|
|
51
|
-
(value: T): S
|
|
15
|
+
interface Selector<T, S> {
|
|
16
|
+
(value: T): S;
|
|
52
17
|
}
|
|
53
18
|
interface Effect<T> {
|
|
54
19
|
(this: T, context: T): void | Cancel;
|
|
@@ -99,13 +64,13 @@ interface DurationObject {
|
|
|
99
64
|
years?: number;
|
|
100
65
|
}
|
|
101
66
|
type Duration = number | string | DurationObject;
|
|
102
|
-
type UpdateFrom<Value
|
|
103
|
-
type Update<Value
|
|
104
|
-
interface UpdateFunction<Value
|
|
105
|
-
(update: Update<Value
|
|
67
|
+
type UpdateFrom<Value, From extends any[]> = Value | ((...args: From) => Value);
|
|
68
|
+
type Update<Value> = UpdateFrom<Value, [Value]>;
|
|
69
|
+
interface UpdateFunction<Value> {
|
|
70
|
+
(update: Update<Value>): void;
|
|
106
71
|
}
|
|
107
|
-
interface AsyncUpdateFunction<Value
|
|
108
|
-
(update: UpdateFrom<MaybePromise<Value
|
|
72
|
+
interface AsyncUpdateFunction<Value> {
|
|
73
|
+
(update: UpdateFrom<MaybePromise<Value>, [Value]>): void;
|
|
109
74
|
}
|
|
110
75
|
interface StoreLike<T> {
|
|
111
76
|
get(): T;
|
|
@@ -144,6 +109,41 @@ interface CalculatedValue<T> {
|
|
|
144
109
|
invalidateDependencies(recursive?: boolean): void;
|
|
145
110
|
}
|
|
146
111
|
//#endregion
|
|
112
|
+
//#region src/lib/constrain.d.ts
|
|
113
|
+
type Constrain<T, S> = T & S;
|
|
114
|
+
//#endregion
|
|
115
|
+
//#region src/lib/typeHelpers.d.ts
|
|
116
|
+
type Object_ = Record<string | number | symbol, any>;
|
|
117
|
+
type Array_ = readonly any[];
|
|
118
|
+
type StringToNumber<T> = T extends `${infer K extends number}` ? K : never;
|
|
119
|
+
type ArrayToStringPath<T> = T extends readonly [] ? "" : T extends readonly [infer First extends string | number, ...infer Rest] ? First extends `${string}.${string}` ? never : Rest extends readonly [] ? `${First}` : `${First}.${ArrayToStringPath<Rest>}` : T extends readonly KeyType[] ? string : never;
|
|
120
|
+
type StringToArrayPath<T> = T extends "" ? readonly [] : T extends `${infer First}.${infer Rest}` ? readonly [First, ...StringToArrayPath<Rest>] : readonly [T];
|
|
121
|
+
type OptionalPropertyOf<T> = Exclude<{ [K in keyof T]: string extends K ? K : number extends K ? K : symbol extends K ? K : T extends Record<K, T[K]> ? never : K }[keyof T], undefined>;
|
|
122
|
+
type OptionalProperties<T> = Pick<T, OptionalPropertyOf<T>>;
|
|
123
|
+
type IsAny<T> = 0 extends 1 & T ? true : false;
|
|
124
|
+
type IsNever<T> = [T] extends [never] ? true : false;
|
|
125
|
+
//#endregion
|
|
126
|
+
//#region src/lib/path.d.ts
|
|
127
|
+
type KeyType = string | number | symbol;
|
|
128
|
+
type AnyPath = string | readonly KeyType[];
|
|
129
|
+
type GetKeys<T extends Object_ | Array_> = T extends Array_ ? T extends readonly [] ? never : "0" extends keyof T ? StringToNumber<keyof T> : number : keyof T;
|
|
130
|
+
type _PathAsArray<T, Optional, MaxDepth, Depth extends 1[]> = (Optional extends false ? readonly [] : never) | (true extends IsAny<T> ? readonly KeyType[] : T extends never ? never : T extends Object_ ? Depth["length"] extends MaxDepth ? readonly string[] : T extends Map<infer K extends KeyType, infer V> ? readonly [K] | readonly [K, ..._PathAsArray<V, Optional, MaxDepth, [...Depth, 1]>] : T extends Set<any> ? readonly [number] : { [K in GetKeys<T>]: (Optional extends true ? K extends OptionalPropertyOf<T> ? readonly [K] : never : readonly [K]) | readonly [K, ..._PathAsArray<T[K], Optional, MaxDepth, [...Depth, 1]>] }[GetKeys<T>] : never);
|
|
131
|
+
type PathAsArray<T, Optional extends boolean = false, MaxDepth extends number = 5> = _PathAsArray<T, Optional, MaxDepth, []>;
|
|
132
|
+
type PathAsString<T, Optional extends boolean = false, MaxDepth extends number = 5> = ArrayToStringPath<PathAsArray<T, Optional, MaxDepth>>;
|
|
133
|
+
type Path<T, Optional extends boolean = false, MaxDepth extends number = 5> = PathAsString<T, Optional, MaxDepth> | PathAsArray<T, Optional, MaxDepth>;
|
|
134
|
+
type Value<T, P> = P extends readonly [] ? T : true extends IsAny<T> | IsAny<P> ? any : true extends IsNever<T> | IsNever<P> ? never : P extends string ? Value<T, StringToArrayPath<P>> : P extends readonly [infer First extends KeyType, ...infer Rest extends readonly KeyType[]] ? T extends Map<any, infer V> | Set<infer V> ? Value<V, Rest> | undefined : T extends Array_ ? any[] extends T ? Value<T[First & keyof T], Rest> | undefined : Value<T[First & keyof T], Rest> : T extends Object_ ? Record<any, any> extends T ? Value<T[First], Rest> | undefined : Value<T[First], Rest> : never : never;
|
|
135
|
+
type _WildcardPathAsArray<T, MaxDepth, Depth extends 1[]> = [] | (0 extends 1 & T ? KeyType[] : T extends never ? never : T extends Object_ ? Depth["length"] extends MaxDepth ? string[] : T extends Map<infer K extends KeyType, infer V> ? ["*"] | [K] | [K, ..._WildcardPathAsArray<V, MaxDepth, [...Depth, 1]>] : T extends Set<any> ? ["*"] | [number] : Record<string, any> extends T ? ["*"] | ["*", ..._WildcardPathAsArray<T[string], MaxDepth, [...Depth, 1]>] : { [K in GetKeys<T>]: ["*"] | ["*", ..._WildcardPathAsArray<T[T extends readonly any[] ? number : keyof T], MaxDepth, [...Depth, 1]>] | [K] | [K, ..._WildcardPathAsArray<T[K], MaxDepth, [...Depth, 1]>] }[GetKeys<T>] : never);
|
|
136
|
+
type WildcardPathAsArray<T, MaxDepth extends number = 5> = _WildcardPathAsArray<T, MaxDepth, []>;
|
|
137
|
+
type WildcardPathAsString<T, MaxDepth extends number = 5> = ArrayToStringPath<_WildcardPathAsArray<T, MaxDepth, []>>;
|
|
138
|
+
type WildcardPath<T, MaxDepth extends number = 5> = WildcardPathAsString<T, MaxDepth> | WildcardPathAsArray<T, MaxDepth>;
|
|
139
|
+
type WildcardValue<T, P> = true extends IsAny<T> | IsAny<P> ? any : true extends IsNever<T> | IsNever<P> ? never : P extends string ? WildcardValue<T, StringToArrayPath<P>> : P extends readonly [infer First extends KeyType, ...infer Rest extends KeyType[]] ? T extends Map<any, infer V> | Set<infer V> ? WildcardValue<V, Rest> | (First extends "*" ? never : undefined) : T extends Array_ ? First extends "*" ? WildcardValue<T[number], Rest> : any[] extends T ? WildcardValue<T[First & keyof T], Rest> | undefined : First extends keyof T ? WildcardValue<T[First], Rest> : undefined : T extends Object_ ? First extends "*" ? WildcardValue<T[keyof T], Rest> : Record<any, any> extends T ? WildcardValue<T[First], Rest> | undefined : WildcardValue<T[First], Rest> : never : T;
|
|
140
|
+
type Join<A extends string | number, B extends string | number> = A extends "" ? B : B extends "" ? A : `${A}.${B}`;
|
|
141
|
+
type _SettablePathAsArray<T, MaxDepth, Depth extends 1[]> = readonly [] | (true extends IsAny<T> ? readonly KeyType[] : undefined extends T ? T extends Map<any, any> | Set<any> ? never : T extends Object_ ? { [K in GetKeys<T>]: Partial<T> extends Omit<T, K> ? readonly [K] | readonly [K, ..._SettablePathAsArray<T[K], MaxDepth, [...Depth, 1]>] : readonly [] }[GetKeys<T>] : never : T extends never ? never : T extends Object_ ? Depth["length"] extends MaxDepth ? readonly string[] : T extends Map<infer K extends KeyType, infer V> ? readonly [K] | readonly [K, ..._SettablePathAsArray<V, MaxDepth, [...Depth, 1]>] : T extends Set<any> ? readonly [number] : { [K in GetKeys<T>]: readonly [K] | readonly [K, ..._SettablePathAsArray<T[K], MaxDepth, [...Depth, 1]>] }[GetKeys<T>] : never);
|
|
142
|
+
type SettablePathAsArray<T, MaxDepth extends number = 5> = _SettablePathAsArray<T, MaxDepth, []>;
|
|
143
|
+
type SettablePathAsString<T, MaxDepth extends number = 5> = ArrayToStringPath<SettablePathAsArray<T, MaxDepth>>;
|
|
144
|
+
type SettablePath<T, MaxDepth extends number = 5> = SettablePathAsString<T, MaxDepth> | SettablePathAsArray<T, MaxDepth>;
|
|
145
|
+
type SettableValue<T, P> = P extends readonly [] ? T : true extends IsAny<T> | IsAny<P> ? any : true extends IsNever<T> | IsNever<P> ? never : P extends string ? SettableValue<T, StringToArrayPath<P>> : P extends readonly [infer First extends KeyType, ...infer Rest extends readonly KeyType[]] ? T extends Map<any, infer V> | Set<infer V> ? SettableValue<V, Rest> : T extends Array_ ? SettableValue<T[First & keyof T], Rest> : T extends Object_ ? SettableValue<T[First], Rest> : never : never;
|
|
146
|
+
//#endregion
|
|
147
147
|
//#region src/lib/promiseWithCancel.d.ts
|
|
148
148
|
declare class PromiseWithCancel<T> extends Promise<T> {
|
|
149
149
|
private abortController;
|
|
@@ -155,12 +155,12 @@ declare class PromiseWithCancel<T> extends Promise<T> {
|
|
|
155
155
|
type Function_ = (...args: any) => any;
|
|
156
156
|
declare const arrayMethods: { [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 };
|
|
157
157
|
declare const recordMethods: {
|
|
158
|
-
delete<T extends Record<any, any>, K
|
|
158
|
+
delete<T extends Record<any, any>, K extends OptionalPropertyOf<T>>(this: Store<T>, key: K): void;
|
|
159
159
|
clear<T extends Record<any, any>>(this: OptionalProperties<T> extends T ? Store<T> : never): void;
|
|
160
160
|
};
|
|
161
161
|
declare const mapMethods: {
|
|
162
|
-
delete<K
|
|
163
|
-
clear<K
|
|
162
|
+
delete<K, V>(this: Store<Map<K, V>>, key: K): boolean;
|
|
163
|
+
clear<K, V>(this: Store<Map<K, V>>): void;
|
|
164
164
|
};
|
|
165
165
|
declare const setMethods: {
|
|
166
166
|
add<T>(this: Store<Set<T>>, value: T): void;
|
|
@@ -217,16 +217,16 @@ declare class Store<T> {
|
|
|
217
217
|
} | undefined);
|
|
218
218
|
get(): T;
|
|
219
219
|
set(update: Update<T>): void;
|
|
220
|
-
set<const P
|
|
220
|
+
set<const P>(path: Constrain<P, Path<T>>, update: Update<Value<T, P>>): void;
|
|
221
221
|
invalidate(recursive?: boolean): void;
|
|
222
222
|
subscribe(listener: Listener<T, {
|
|
223
223
|
cancel: Cancel;
|
|
224
224
|
}>, options?: SubscribeOptions): DisposableCancel;
|
|
225
|
-
once<S
|
|
225
|
+
once<S extends T>(condition: (value: T) => value is S, options?: OnceOptions): PromiseWithCancel<S>;
|
|
226
226
|
once(condition: (value: T) => boolean, options?: OnceOptions): PromiseWithCancel<T>;
|
|
227
227
|
once(options?: OnceOptions): PromiseWithCancel<Exclude<T, undefined>>;
|
|
228
|
-
map<S
|
|
229
|
-
map<const P
|
|
228
|
+
map<S>(selector: Selector<T, S>, updater?: (value: S) => Update<T>): Store<S>;
|
|
229
|
+
map<const P>(selector: Constrain<P, SettablePath<T>>): Store<Value<T, P>>;
|
|
230
230
|
/** Add an effect that will be executed when the store becomes active, which means when it has at least one subscriber.
|
|
231
231
|
* @param effect
|
|
232
232
|
* If there is already a subscriber, the effect will be executed immediately.
|
|
@@ -253,5 +253,5 @@ declare const createStore: typeof create & {
|
|
|
253
253
|
defaultOptions: StoreOptions<any>;
|
|
254
254
|
};
|
|
255
255
|
//#endregion
|
|
256
|
-
export {
|
|
257
|
-
//# sourceMappingURL=store-
|
|
256
|
+
export { AsyncUpdateFunction as A, Selector as B, Value as C, Object_ as D, WildcardValue as E, ConnectionActions as F, Use as G, Update as H, DisposableCancel as I, MaybePromise as K, Duration as L, CalculationActions as M, Cancel as N, Constrain as O, Connection as P, Effect as R, SettableValue as S, WildcardPathAsString as T, UpdateFrom as U, SubscribeOptions as V, UpdateFunction as W, PathAsArray as _, StoreOptions as a, SettablePathAsArray as b, arrayMethods as c, setMethods as d, AnyPath as f, Path as g, KeyType as h, StoreMethods as i, BaseConnectionActions as j, AsyncConnectionActions as k, mapMethods as l, Join as m, Calculate as n, StoreOptionsWithMethods as o, GetKeys as p, Store as r, createStore as s, BoundStoreMethods as t, recordMethods as u, PathAsString as v, WildcardPath as w, SettablePathAsString as x, SettablePath as y, Listener as z };
|
|
257
|
+
//# sourceMappingURL=store-dThvqc0k.d.ts.map
|