@dxos/effect-atom-solid 0.0.0 → 0.8.4-main.21d9917

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (52) hide show
  1. package/dist/lib/browser/index.mjs +261 -0
  2. package/dist/lib/browser/index.mjs.map +7 -0
  3. package/dist/lib/browser/meta.json +1 -0
  4. package/dist/lib/node-esm/index.mjs +263 -0
  5. package/dist/lib/node-esm/index.mjs.map +7 -0
  6. package/dist/lib/node-esm/meta.json +1 -0
  7. package/dist/types/src/hooks/index.d.ts +11 -0
  8. package/dist/types/src/hooks/index.d.ts.map +1 -0
  9. package/dist/types/src/hooks/useAtom.d.ts +12 -0
  10. package/dist/types/src/hooks/useAtom.d.ts.map +1 -0
  11. package/dist/types/src/hooks/useAtom.test.d.ts +2 -0
  12. package/dist/types/src/hooks/useAtom.test.d.ts.map +1 -0
  13. package/dist/types/src/hooks/useAtomInitialValues.d.ts +6 -0
  14. package/dist/types/src/hooks/useAtomInitialValues.d.ts.map +1 -0
  15. package/dist/types/src/hooks/useAtomInitialValues.test.d.ts +2 -0
  16. package/dist/types/src/hooks/useAtomInitialValues.test.d.ts.map +1 -0
  17. package/dist/types/src/hooks/useAtomMount.d.ts +6 -0
  18. package/dist/types/src/hooks/useAtomMount.d.ts.map +1 -0
  19. package/dist/types/src/hooks/useAtomRef.d.ts +15 -0
  20. package/dist/types/src/hooks/useAtomRef.d.ts.map +1 -0
  21. package/dist/types/src/hooks/useAtomRefresh.d.ts +6 -0
  22. package/dist/types/src/hooks/useAtomRefresh.d.ts.map +1 -0
  23. package/dist/types/src/hooks/useAtomRefresh.test.d.ts +2 -0
  24. package/dist/types/src/hooks/useAtomRefresh.test.d.ts.map +1 -0
  25. package/dist/types/src/hooks/useAtomResource.d.ts +14 -0
  26. package/dist/types/src/hooks/useAtomResource.d.ts.map +1 -0
  27. package/dist/types/src/hooks/useAtomResource.test.d.ts +2 -0
  28. package/dist/types/src/hooks/useAtomResource.test.d.ts.map +1 -0
  29. package/dist/types/src/hooks/useAtomSet.d.ts +16 -0
  30. package/dist/types/src/hooks/useAtomSet.d.ts.map +1 -0
  31. package/dist/types/src/hooks/useAtomSet.test.d.ts +2 -0
  32. package/dist/types/src/hooks/useAtomSet.test.d.ts.map +1 -0
  33. package/dist/types/src/hooks/useAtomSubscribe.d.ts +8 -0
  34. package/dist/types/src/hooks/useAtomSubscribe.d.ts.map +1 -0
  35. package/dist/types/src/hooks/useAtomSubscribe.test.d.ts +2 -0
  36. package/dist/types/src/hooks/useAtomSubscribe.test.d.ts.map +1 -0
  37. package/dist/types/src/hooks/useAtomSuspense.d.ts +7 -0
  38. package/dist/types/src/hooks/useAtomSuspense.d.ts.map +1 -0
  39. package/dist/types/src/hooks/useAtomSuspense.test.d.ts +2 -0
  40. package/dist/types/src/hooks/useAtomSuspense.test.d.ts.map +1 -0
  41. package/dist/types/src/hooks/useAtomValue.d.ts +16 -0
  42. package/dist/types/src/hooks/useAtomValue.d.ts.map +1 -0
  43. package/dist/types/src/hooks/useAtomValue.test.d.ts +2 -0
  44. package/dist/types/src/hooks/useAtomValue.test.d.ts.map +1 -0
  45. package/dist/types/src/index.d.ts +9 -0
  46. package/dist/types/src/index.d.ts.map +1 -0
  47. package/dist/types/src/registry.d.ts +28 -0
  48. package/dist/types/src/registry.d.ts.map +1 -0
  49. package/dist/types/src/registry.test.d.ts +2 -0
  50. package/dist/types/src/registry.test.d.ts.map +1 -0
  51. package/dist/types/tsconfig.tsbuildinfo +1 -0
  52. package/package.json +7 -3
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../src/index.ts", "../../../src/hooks/useAtomValue.ts", "../../../src/registry.ts", "../../../src/hooks/useAtomSet.ts", "../../../src/hooks/useAtom.ts", "../../../src/hooks/useAtomMount.ts", "../../../src/hooks/useAtomRefresh.ts", "../../../src/hooks/useAtomSubscribe.ts", "../../../src/hooks/useAtomRef.ts", "../../../src/hooks/useAtomResource.ts", "../../../src/hooks/useAtomSuspense.ts", "../../../src/hooks/useAtomInitialValues.ts"],
4
+ "sourcesContent": ["//\n// Copyright 2025 DXOS.org\n//\n\nexport * as Atom from '@effect-atom/atom/Atom';\nexport * as Registry from '@effect-atom/atom/Registry';\nexport * as Result from '@effect-atom/atom/Result';\nexport * as AtomRef from '@effect-atom/atom/AtomRef';\nexport * as AtomHttpApi from '@effect-atom/atom/AtomHttpApi';\nexport * as AtomRpc from '@effect-atom/atom/AtomRpc';\n\nexport * from './hooks';\nexport * from './registry';\n", "//\n// Copyright 2025 DXOS.org\n//\n\nimport type * as Atom from '@effect-atom/atom/Atom';\nimport * as AtomModule from '@effect-atom/atom/Atom';\nimport { type Accessor, createEffect, createMemo, createSignal, onCleanup } from 'solid-js';\n\nimport { useRegistry } from '../registry';\n\n/**\n * A value that may be a static value or a reactive accessor.\n */\ntype MaybeAccessor<T> = T | Accessor<T>;\n\n/**\n * Resolves a MaybeAccessor to its value.\n */\nconst access = <T>(value: MaybeAccessor<T>): T => (typeof value === 'function' ? (value as Accessor<T>)() : value);\n\n/**\n * Hook to read the value of an atom.\n * The returned accessor will update whenever the atom's value changes.\n * The atom parameter can be reactive (MaybeAccessor) - if the atom changes,\n * the hook will automatically unsubscribe from the old atom and subscribe to the new one.\n */\nexport function useAtomValue<A>(atom: MaybeAccessor<Atom.Atom<A>>): Accessor<A>;\nexport function useAtomValue<A, B>(atom: MaybeAccessor<Atom.Atom<A>>, f: (a: A) => B): Accessor<B>;\nexport function useAtomValue<A>(atom: MaybeAccessor<Atom.Atom<A>>, f?: (a: A) => A): Accessor<A> {\n const registry = useRegistry();\n\n // Resolve the atom reactively and apply mapping if provided.\n const resolvedAtom = createMemo(() => {\n const a = access(atom);\n return f ? AtomModule.map(a, f) : a;\n });\n\n const [value, setValue] = createSignal<A>(registry.get(resolvedAtom()));\n\n // Subscribe to atom changes reactively - re-subscribes when atom changes.\n createEffect(() => {\n const currentAtom = resolvedAtom();\n setValue(() => registry.get(currentAtom));\n\n const unsubscribe = registry.subscribe(\n currentAtom,\n (nextValue) => {\n setValue(() => nextValue);\n },\n { immediate: true },\n );\n\n onCleanup(unsubscribe);\n });\n\n return value;\n}\n", "//\n// Copyright 2025 DXOS.org\n//\n\nimport type * as Atom from '@effect-atom/atom/Atom';\nimport * as Registry from '@effect-atom/atom/Registry';\nimport * as GlobalValue from 'effect/GlobalValue';\nimport { type Context, createContext, onCleanup, useContext } from 'solid-js';\n\n/**\n * Default registry instance\n */\nexport const defaultRegistry: Registry.Registry = GlobalValue.globalValue(\n '@effect-atom/atom-solid/defaultRegistry',\n () => Registry.make(),\n);\n\n/**\n * Solid context for the atom registry\n */\nexport const RegistryContext: Context<Registry.Registry> = createContext<Registry.Registry>(defaultRegistry);\n\n/**\n * Get the current registry from context\n */\nexport const useRegistry = (): Registry.Registry => {\n return useContext(RegistryContext);\n};\n\n/**\n * Provider component for custom registry\n */\nexport interface RegistryProviderProps {\n children: any;\n registry?: Registry.Registry;\n initialValues?: Iterable<readonly [Atom.Atom<any>, any]>;\n scheduleTask?: (f: () => void) => void;\n timeoutResolution?: number;\n defaultIdleTTL?: number;\n}\n\nexport function RegistryProvider(props: RegistryProviderProps) {\n const registry =\n props.registry ??\n Registry.make({\n scheduleTask: props.scheduleTask,\n initialValues: props.initialValues,\n timeoutResolution: props.timeoutResolution,\n defaultIdleTTL: props.defaultIdleTTL ?? 400,\n });\n\n onCleanup(() => {\n // Delay disposal to allow for component re-mounting\n const timeout = setTimeout(() => {\n registry.dispose();\n }, 500);\n return () => clearTimeout(timeout);\n });\n\n return RegistryContext.Provider({\n value: registry,\n get children() {\n return props.children;\n },\n });\n}\n", "//\n// Copyright 2025 DXOS.org\n//\n\nimport type * as Atom from '@effect-atom/atom/Atom';\nimport * as Registry from '@effect-atom/atom/Registry';\nimport type * as Result from '@effect-atom/atom/Result';\nimport * as Cause from 'effect/Cause';\nimport * as Effect from 'effect/Effect';\nimport * as Exit from 'effect/Exit';\nimport { onCleanup } from 'solid-js';\n\nimport { useRegistry } from '../registry';\n\nconst flattenExit = <A, E>(exit: Exit.Exit<A, E>): A => {\n if (Exit.isSuccess(exit)) return exit.value;\n throw Cause.squash(exit.cause);\n};\n\nexport type SetAtomFn<R, W, Mode extends 'value' | 'promise' | 'promiseExit'> = 'promise' extends Mode\n ? (value: W) => Promise<Result.Result.Success<R>>\n : 'promiseExit' extends Mode\n ? (value: W) => Promise<Exit.Exit<Result.Result.Success<R>, Result.Result.Failure<R>>>\n : (value: W | ((value: R) => W)) => void;\n\nexport function createSetAtom<R, W, Mode extends 'value' | 'promise' | 'promiseExit' = never>(\n registry: Registry.Registry,\n atom: Atom.Writable<R, W>,\n options?: {\n readonly mode?: ([R] extends [Result.Result<any, any>] ? Mode : 'value') | undefined;\n },\n): SetAtomFn<R, W, Mode> {\n if (options?.mode === 'promise' || options?.mode === 'promiseExit') {\n return ((value: W) => {\n registry.set(atom, value);\n const promise = Effect.runPromiseExit(\n Registry.getResult(registry, atom as Atom.Atom<Result.Result<any, any>>, { suspendOnWaiting: true }),\n );\n return options!.mode === 'promise' ? promise.then(flattenExit) : promise;\n }) as SetAtomFn<R, W, Mode>;\n }\n return ((value: W | ((value: R) => W)) => {\n registry.set(atom, typeof value === 'function' ? (value as any)(registry.get(atom)) : value);\n }) as SetAtomFn<R, W, Mode>;\n}\n\n/**\n * Hook to get a setter function for an atom\n * Also mounts the atom in the registry\n */\nexport function useAtomSet<R, W, Mode extends 'value' | 'promise' | 'promiseExit' = never>(\n atom: Atom.Writable<R, W>,\n options?: {\n readonly mode?: ([R] extends [Result.Result<any, any>] ? Mode : 'value') | undefined;\n },\n): SetAtomFn<R, W, Mode> {\n const registry = useRegistry();\n\n // Mount the atom\n const unmount = registry.mount(atom);\n onCleanup(unmount);\n\n return createSetAtom(registry, atom, options);\n}\n", "//\n// Copyright 2025 DXOS.org\n//\n\nimport type * as Atom from '@effect-atom/atom/Atom';\nimport type * as Result from '@effect-atom/atom/Result';\nimport { type Accessor, createSignal, onCleanup } from 'solid-js';\n\nimport { useRegistry } from '../registry';\n\nimport { type SetAtomFn, createSetAtom } from './useAtomSet';\n\n/**\n * Hook to both read and write an atom\n * Returns a tuple of [value accessor, setter function]\n */\nexport function useAtom<R, W, Mode extends 'value' | 'promise' | 'promiseExit' = never>(\n atom: Atom.Writable<R, W>,\n options?: {\n readonly mode?: ([R] extends [Result.Result<any, any>] ? Mode : 'value') | undefined;\n },\n): readonly [Accessor<R>, SetAtomFn<R, W, Mode>] {\n const registry = useRegistry();\n\n const [value, setValue] = createSignal<R>(registry.get(atom));\n\n // Subscribe to atom changes\n const unsubscribe = registry.subscribe(\n atom,\n (nextValue) => {\n setValue(() => nextValue);\n },\n { immediate: true },\n );\n\n onCleanup(unsubscribe);\n\n return [value, createSetAtom(registry, atom, options)] as const;\n}\n", "//\n// Copyright 2025 DXOS.org\n//\n\nimport type * as Atom from '@effect-atom/atom/Atom';\nimport { onCleanup } from 'solid-js';\n\nimport { useRegistry } from '../registry';\n\n/**\n * Hook to mount an atom without reading its value\n */\nexport function useAtomMount<A>(atom: Atom.Atom<A>): void {\n const registry = useRegistry();\n const unmount = registry.mount(atom);\n onCleanup(unmount);\n}\n", "//\n// Copyright 2025 DXOS.org\n//\n\nimport type * as Atom from '@effect-atom/atom/Atom';\nimport { onCleanup } from 'solid-js';\n\nimport { useRegistry } from '../registry';\n\n/**\n * Hook to get a refresh function for an atom\n */\nexport function useAtomRefresh<A>(atom: Atom.Atom<A>): () => void {\n const registry = useRegistry();\n\n const unmount = registry.mount(atom);\n onCleanup(unmount);\n\n return () => registry.refresh(atom);\n}\n", "//\n// Copyright 2025 DXOS.org\n//\n\nimport type * as Atom from '@effect-atom/atom/Atom';\nimport { onCleanup } from 'solid-js';\n\nimport { useRegistry } from '../registry';\n\n/**\n * Hook to subscribe to atom changes with a callback\n */\nexport function useAtomSubscribe<A>(\n atom: Atom.Atom<A>,\n f: (value: A) => void,\n options?: { readonly immediate?: boolean },\n): void {\n const registry = useRegistry();\n\n const unsubscribe = registry.subscribe(atom, f, options);\n onCleanup(unsubscribe);\n}\n", "//\n// Copyright 2025 DXOS.org\n//\n\nimport type * as AtomRef from '@effect-atom/atom/AtomRef';\nimport { type Accessor, createMemo, createSignal, onCleanup } from 'solid-js';\n\n/**\n * Hook to read an AtomRef value\n */\nexport function useAtomRef<A>(ref: AtomRef.ReadonlyRef<A>): Accessor<A> {\n const [value, setValue] = createSignal<A>(ref.value);\n\n const unsubscribe = ref.subscribe((next) => {\n setValue(() => next);\n });\n\n onCleanup(unsubscribe);\n\n return value;\n}\n\n/**\n * Hook to get a prop accessor from an AtomRef\n */\nexport function useAtomRefProp<A, K extends keyof A>(ref: AtomRef.AtomRef<A>, prop: K): AtomRef.AtomRef<A[K]> {\n return createMemo(() => ref.prop(prop))();\n}\n\n/**\n * Hook to read a prop value from an AtomRef\n */\nexport function useAtomRefPropValue<A, K extends keyof A>(ref: AtomRef.AtomRef<A>, prop: K): Accessor<A[K]> {\n return useAtomRef(useAtomRefProp(ref, prop));\n}\n", "//\n// Copyright 2025 DXOS.org\n//\n\nimport type * as Atom from '@effect-atom/atom/Atom';\nimport type * as Result from '@effect-atom/atom/Result';\nimport * as Cause from 'effect/Cause';\nimport { type Accessor, createMemo, createSignal, onCleanup } from 'solid-js';\n\nimport { useRegistry } from '../registry';\n\n/**\n * Resource-like hook for atoms that contain Result values\n * Automatically handles loading and error states\n */\nexport function useAtomResource<A, E>(\n atom: Atom.Atom<Result.Result<A, E>>,\n): {\n value: Accessor<A | undefined>;\n error: Accessor<E | undefined>;\n loading: Accessor<boolean>;\n result: Accessor<Result.Result<A, E>>;\n} {\n const registry = useRegistry();\n const [result, setResult] = createSignal<Result.Result<A, E>>(registry.get(atom));\n\n const unsubscribe = registry.subscribe(\n atom,\n (nextValue) => {\n setResult(() => nextValue);\n },\n { immediate: true },\n );\n\n onCleanup(unsubscribe);\n\n const value = createMemo(() => {\n const r = result();\n return r._tag === 'Success' ? r.value : undefined;\n });\n\n const error = createMemo(() => {\n const r = result();\n return r._tag === 'Failure' ? (Cause.squash(r.cause) as E) : undefined;\n });\n\n const loading = createMemo(() => {\n const r = result();\n return r._tag === 'Initial' || r.waiting;\n });\n\n return {\n value,\n error,\n loading,\n result,\n };\n}\n", "//\n// Copyright 2025 DXOS.org\n//\n\nimport type * as Atom from '@effect-atom/atom/Atom';\nimport type * as Result from '@effect-atom/atom/Result';\nimport { createResource, onCleanup } from 'solid-js';\n\nimport { useRegistry } from '../registry';\n\n/**\n * Hook to read an atom value with Suspense support\n */\nexport function useAtomSuspense<A, E>(atom: Atom.Atom<Result.Result<A, E>>): () => A {\n const registry = useRegistry();\n\n const [data, { mutate, refetch }] = createResource(async () => {\n // Check if we already have a value\n const current = registry.get(atom);\n if (current._tag === 'Success') {\n return current.value;\n }\n if (current._tag === 'Failure') {\n throw current.cause;\n }\n\n // Wait for the next success or failure\n return new Promise<A>((resolve, reject) => {\n const unsubscribe = registry.subscribe(atom, (next) => {\n if (next._tag === 'Success') {\n unsubscribe();\n resolve(next.value);\n } else if (next._tag === 'Failure') {\n unsubscribe();\n reject(next.cause);\n }\n });\n // Note: We might want to handle cancellation if the resource is disposed?\n // But creating a promise that leaks isn't great.\n // Ideally we tie this to the component, but the promise itself is localized.\n });\n });\n\n // Subscribe to updates to keep the resource fresh\n const unsubscribe = registry.subscribe(atom, (next) => {\n if (next._tag === 'Success') {\n mutate(() => next.value);\n } else if (next._tag === 'Failure') {\n // If we encounter a failure, we trigger a refetch which will hit the fetcher\n // and throw the error (reject the promise)\n // Or we could try to mutate error state?\n // createResource doesn't have a direct 'setError'.\n // Refetching is the safe bet to re-enter the promise/error flow.\n void refetch();\n } else if (next._tag === 'Initial' || (next as any).waiting) {\n // If we go back to loading, refetch to suspend\n void refetch();\n }\n });\n\n onCleanup(unsubscribe);\n\n return () => {\n const value = data();\n if (value === undefined) {\n // This case handles when the resource is loading initially\n // createResource reads undefined (or initial value) when loading if strict mode isn't on for types,\n // but wrapping it ensures we signal \"read\" to Suspense.\n // However, data() itself should trigger Suspense if loading.\n // We assume standard Suspense behavior.\n }\n return value as A;\n };\n}\n", "//\n// Copyright 2025 DXOS.org\n//\n\nimport type * as Atom from '@effect-atom/atom/Atom';\n\nimport { useRegistry } from '../registry';\n\n/**\n * Hook to initialize atoms with values\n */\nexport function useAtomInitialValues(initialValues: Iterable<readonly [Atom.Writable<any, any>, any]>): void {\n const registry = useRegistry();\n\n for (const [atom, value] of initialValues) {\n registry.set(atom, value);\n }\n}\n"],
5
+ "mappings": ";;;AAIA,YAAYA,UAAU;AACtB,YAAYC,eAAc;AAC1B,YAAYC,YAAY;AACxB,YAAYC,aAAa;AACzB,YAAYC,iBAAiB;AAC7B,YAAYC,aAAa;;;ACJzB,YAAYC,gBAAgB;AAC5B,SAAwBC,cAAcC,YAAYC,cAAcC,aAAAA,kBAAiB;;;ACDjF,YAAYC,cAAc;AAC1B,YAAYC,iBAAiB;AAC7B,SAAuBC,eAAeC,WAAWC,kBAAkB;AAK5D,IAAMC,kBAAiDC,wBAC5D,2CACA,MAAeC,cAAI,CAAA;AAMd,IAAMC,kBAA8CC,cAAiCJ,eAAAA;AAKrF,IAAMK,cAAc,MAAA;AACzB,SAAOC,WAAWH,eAAAA;AACpB;AAcO,SAASI,iBAAiBC,OAA4B;AAC3D,QAAMC,WACJD,MAAMC,YACGP,cAAK;IACZQ,cAAcF,MAAME;IACpBC,eAAeH,MAAMG;IACrBC,mBAAmBJ,MAAMI;IACzBC,gBAAgBL,MAAMK,kBAAkB;EAC1C,CAAA;AAEFC,YAAU,MAAA;AAER,UAAMC,UAAUC,WAAW,MAAA;AACzBP,eAASQ,QAAO;IAClB,GAAG,GAAA;AACH,WAAO,MAAMC,aAAaH,OAAAA;EAC5B,CAAA;AAEA,SAAOZ,gBAAgBgB,SAAS;IAC9BC,OAAOX;IACP,IAAIY,WAAW;AACb,aAAOb,MAAMa;IACf;EACF,CAAA;AACF;;;AD/CA,IAAMC,SAAS,CAAIC,UAAgC,OAAOA,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OnC,SAASC,gBAAsBC,MAAoC;AACxE,QAAMC,WAAWC,YAAAA;AAEjB,QAAM,CAACC,MAAM,EAAEC,QAAQC,QAAO,CAAE,IAAIC,eAAe,YAAA;AAEjD,UAAMC,UAAUN,SAASO,IAAIR,IAAAA;AAC7B,QAAIO,QAAQE,SAAS,WAAW;AAC9B,aAAOF,QAAQG;IACjB;AACA,QAAIH,QAAQE,SAAS,WAAW;AAC9B,YAAMF,QAAQI;IAChB;AAGA,WAAO,IAAIC,QAAW,CAACC,SAASC,WAAAA;AAC9B,YAAMC,eAAcd,SAASe,UAAUhB,MAAM,CAACiB,SAAAA;AAC5C,YAAIA,KAAKR,SAAS,WAAW;AAC3BM,UAAAA,aAAAA;AACAF,kBAAQI,KAAKP,KAAK;QACpB,WAAWO,KAAKR,SAAS,WAAW;AAClCM,UAAAA,aAAAA;AACAD,iBAAOG,KAAKN,KAAK;QACnB;MACF,CAAA;IAIF,CAAA;EACF,CAAA;AAGA,QAAMI,cAAcd,SAASe,UAAUhB,MAAM,CAACiB,SAAAA;AAC5C,QAAIA,KAAKR,SAAS,WAAW;AAC3BL,aAAO,MAAMa,KAAKP,KAAK;IACzB,WAAWO,KAAKR,SAAS,WAAW;AAMlC,WAAKJ,QAAAA;IACP,WAAWY,KAAKR,SAAS,aAAcQ,KAAaC,SAAS;AAE3D,WAAKb,QAAAA;IACP;EACF,CAAA;AAEAc,EAAAA,YAAUJ,WAAAA;AAEV,SAAO,MAAA;AACL,UAAML,QAAQP,KAAAA;AACd,QAAIO,UAAUU,QAAW;IAMzB;AACA,WAAOV;EACT;AACF;;;AC9DO,SAASW,qBAAqBC,eAAgE;AACnG,QAAMC,WAAWC,YAAAA;AAEjB,aAAW,CAACC,MAAMC,KAAAA,KAAUJ,eAAe;AACzCC,aAASI,IAAIF,MAAMC,KAAAA;EACrB;AACF;",
6
+ "names": ["Atom", "Registry", "Result", "AtomRef", "AtomHttpApi", "AtomRpc", "AtomModule", "createEffect", "createMemo", "createSignal", "onCleanup", "Registry", "GlobalValue", "createContext", "onCleanup", "useContext", "defaultRegistry", "globalValue", "make", "RegistryContext", "createContext", "useRegistry", "useContext", "RegistryProvider", "props", "registry", "scheduleTask", "initialValues", "timeoutResolution", "defaultIdleTTL", "onCleanup", "timeout", "setTimeout", "dispose", "clearTimeout", "Provider", "value", "children", "access", "value", "useAtomValue", "atom", "f", "registry", "useRegistry", "resolvedAtom", "createMemo", "a", "map", "setValue", "createSignal", "get", "createEffect", "currentAtom", "unsubscribe", "subscribe", "nextValue", "immediate", "onCleanup", "Registry", "Cause", "Effect", "Exit", "onCleanup", "flattenExit", "exit", "isSuccess", "value", "squash", "cause", "createSetAtom", "registry", "atom", "options", "mode", "set", "promise", "runPromiseExit", "getResult", "suspendOnWaiting", "then", "get", "useAtomSet", "useRegistry", "unmount", "mount", "onCleanup", "createSignal", "onCleanup", "useAtom", "atom", "options", "registry", "useRegistry", "value", "setValue", "createSignal", "get", "unsubscribe", "subscribe", "nextValue", "immediate", "onCleanup", "createSetAtom", "onCleanup", "useAtomMount", "atom", "registry", "useRegistry", "unmount", "mount", "onCleanup", "onCleanup", "useAtomRefresh", "atom", "registry", "useRegistry", "unmount", "mount", "onCleanup", "refresh", "onCleanup", "useAtomSubscribe", "atom", "f", "options", "registry", "useRegistry", "unsubscribe", "subscribe", "onCleanup", "createMemo", "createSignal", "onCleanup", "useAtomRef", "ref", "value", "setValue", "createSignal", "unsubscribe", "subscribe", "next", "onCleanup", "useAtomRefProp", "prop", "createMemo", "useAtomRefPropValue", "Cause", "createMemo", "createSignal", "onCleanup", "useAtomResource", "atom", "registry", "useRegistry", "result", "setResult", "createSignal", "get", "unsubscribe", "subscribe", "nextValue", "immediate", "onCleanup", "value", "createMemo", "r", "_tag", "undefined", "error", "squash", "cause", "loading", "waiting", "createResource", "onCleanup", "useAtomSuspense", "atom", "registry", "useRegistry", "data", "mutate", "refetch", "createResource", "current", "get", "_tag", "value", "cause", "Promise", "resolve", "reject", "unsubscribe", "subscribe", "next", "waiting", "onCleanup", "undefined", "useAtomInitialValues", "initialValues", "registry", "useRegistry", "atom", "value", "set"]
7
+ }
@@ -0,0 +1 @@
1
+ {"inputs":{"src/registry.ts":{"bytes":5259,"imports":[{"path":"@effect-atom/atom/Registry","kind":"import-statement","external":true},{"path":"effect/GlobalValue","kind":"import-statement","external":true},{"path":"solid-js","kind":"import-statement","external":true}],"format":"esm"},"src/hooks/useAtomValue.ts":{"bytes":5052,"imports":[{"path":"@effect-atom/atom/Atom","kind":"import-statement","external":true},{"path":"solid-js","kind":"import-statement","external":true},{"path":"src/registry.ts","kind":"import-statement","original":"../registry"}],"format":"esm"},"src/hooks/useAtomSet.ts":{"bytes":6190,"imports":[{"path":"@effect-atom/atom/Registry","kind":"import-statement","external":true},{"path":"effect/Cause","kind":"import-statement","external":true},{"path":"effect/Effect","kind":"import-statement","external":true},{"path":"effect/Exit","kind":"import-statement","external":true},{"path":"solid-js","kind":"import-statement","external":true},{"path":"src/registry.ts","kind":"import-statement","original":"../registry"}],"format":"esm"},"src/hooks/useAtom.ts":{"bytes":3228,"imports":[{"path":"solid-js","kind":"import-statement","external":true},{"path":"src/registry.ts","kind":"import-statement","original":"../registry"},{"path":"src/hooks/useAtomSet.ts","kind":"import-statement","original":"./useAtomSet"}],"format":"esm"},"src/hooks/useAtomMount.ts":{"bytes":1486,"imports":[{"path":"solid-js","kind":"import-statement","external":true},{"path":"src/registry.ts","kind":"import-statement","original":"../registry"}],"format":"esm"},"src/hooks/useAtomRefresh.ts":{"bytes":1652,"imports":[{"path":"solid-js","kind":"import-statement","external":true},{"path":"src/registry.ts","kind":"import-statement","original":"../registry"}],"format":"esm"},"src/hooks/useAtomSubscribe.ts":{"bytes":1772,"imports":[{"path":"solid-js","kind":"import-statement","external":true},{"path":"src/registry.ts","kind":"import-statement","original":"../registry"}],"format":"esm"},"src/hooks/useAtomRef.ts":{"bytes":2981,"imports":[{"path":"solid-js","kind":"import-statement","external":true}],"format":"esm"},"src/hooks/useAtomResource.ts":{"bytes":4553,"imports":[{"path":"effect/Cause","kind":"import-statement","external":true},{"path":"solid-js","kind":"import-statement","external":true},{"path":"src/registry.ts","kind":"import-statement","original":"../registry"}],"format":"esm"},"src/hooks/useAtomSuspense.ts":{"bytes":8172,"imports":[{"path":"solid-js","kind":"import-statement","external":true},{"path":"src/registry.ts","kind":"import-statement","original":"../registry"}],"format":"esm"},"src/hooks/useAtomInitialValues.ts":{"bytes":1549,"imports":[{"path":"src/registry.ts","kind":"import-statement","original":"../registry"}],"format":"esm"},"src/hooks/index.ts":{"bytes":1397,"imports":[{"path":"src/hooks/useAtomValue.ts","kind":"import-statement","original":"./useAtomValue"},{"path":"src/hooks/useAtomSet.ts","kind":"import-statement","original":"./useAtomSet"},{"path":"src/hooks/useAtom.ts","kind":"import-statement","original":"./useAtom"},{"path":"src/hooks/useAtomMount.ts","kind":"import-statement","original":"./useAtomMount"},{"path":"src/hooks/useAtomRefresh.ts","kind":"import-statement","original":"./useAtomRefresh"},{"path":"src/hooks/useAtomSubscribe.ts","kind":"import-statement","original":"./useAtomSubscribe"},{"path":"src/hooks/useAtomRef.ts","kind":"import-statement","original":"./useAtomRef"},{"path":"src/hooks/useAtomResource.ts","kind":"import-statement","original":"./useAtomResource"},{"path":"src/hooks/useAtomSuspense.ts","kind":"import-statement","original":"./useAtomSuspense"},{"path":"src/hooks/useAtomInitialValues.ts","kind":"import-statement","original":"./useAtomInitialValues"}],"format":"esm"},"src/index.ts":{"bytes":1667,"imports":[{"path":"@effect-atom/atom/Atom","kind":"import-statement","external":true},{"path":"@effect-atom/atom/Registry","kind":"import-statement","external":true},{"path":"@effect-atom/atom/Result","kind":"import-statement","external":true},{"path":"@effect-atom/atom/AtomRef","kind":"import-statement","external":true},{"path":"@effect-atom/atom/AtomHttpApi","kind":"import-statement","external":true},{"path":"@effect-atom/atom/AtomRpc","kind":"import-statement","external":true},{"path":"src/hooks/index.ts","kind":"import-statement","original":"./hooks"},{"path":"src/registry.ts","kind":"import-statement","original":"./registry"}],"format":"esm"}},"outputs":{"dist/lib/node-esm/index.mjs.map":{"imports":[],"exports":[],"inputs":{},"bytes":22362},"dist/lib/node-esm/index.mjs":{"imports":[{"path":"@effect-atom/atom/Atom","kind":"import-statement","external":true},{"path":"@effect-atom/atom/Registry","kind":"import-statement","external":true},{"path":"@effect-atom/atom/Result","kind":"import-statement","external":true},{"path":"@effect-atom/atom/AtomRef","kind":"import-statement","external":true},{"path":"@effect-atom/atom/AtomHttpApi","kind":"import-statement","external":true},{"path":"@effect-atom/atom/AtomRpc","kind":"import-statement","external":true},{"path":"@effect-atom/atom/Atom","kind":"import-statement","external":true},{"path":"solid-js","kind":"import-statement","external":true},{"path":"@effect-atom/atom/Registry","kind":"import-statement","external":true},{"path":"effect/GlobalValue","kind":"import-statement","external":true},{"path":"solid-js","kind":"import-statement","external":true},{"path":"@effect-atom/atom/Registry","kind":"import-statement","external":true},{"path":"effect/Cause","kind":"import-statement","external":true},{"path":"effect/Effect","kind":"import-statement","external":true},{"path":"effect/Exit","kind":"import-statement","external":true},{"path":"solid-js","kind":"import-statement","external":true},{"path":"solid-js","kind":"import-statement","external":true},{"path":"solid-js","kind":"import-statement","external":true},{"path":"solid-js","kind":"import-statement","external":true},{"path":"solid-js","kind":"import-statement","external":true},{"path":"solid-js","kind":"import-statement","external":true},{"path":"effect/Cause","kind":"import-statement","external":true},{"path":"solid-js","kind":"import-statement","external":true},{"path":"solid-js","kind":"import-statement","external":true}],"exports":["Atom","AtomHttpApi","AtomRef","AtomRpc","Registry","RegistryContext","RegistryProvider","Result","createSetAtom","defaultRegistry","useAtom","useAtomInitialValues","useAtomMount","useAtomRef","useAtomRefProp","useAtomRefPropValue","useAtomRefresh","useAtomResource","useAtomSet","useAtomSubscribe","useAtomSuspense","useAtomValue","useRegistry"],"entryPoint":"src/index.ts","inputs":{"src/index.ts":{"bytesInOutput":327},"src/hooks/useAtomValue.ts":{"bytesInOutput":781},"src/registry.ts":{"bytesInOutput":939},"src/hooks/index.ts":{"bytesInOutput":0},"src/hooks/useAtomSet.ts":{"bytesInOutput":1036},"src/hooks/useAtom.ts":{"bytesInOutput":441},"src/hooks/useAtomMount.ts":{"bytesInOutput":181},"src/hooks/useAtomRefresh.ts":{"bytesInOutput":222},"src/hooks/useAtomSubscribe.ts":{"bytesInOutput":221},"src/hooks/useAtomRef.ts":{"bytesInOutput":493},"src/hooks/useAtomResource.ts":{"bytesInOutput":867},"src/hooks/useAtomSuspense.ts":{"bytesInOutput":1140},"src/hooks/useAtomInitialValues.ts":{"bytesInOutput":165}},"bytes":7711}}}
@@ -0,0 +1,11 @@
1
+ export * from './useAtomValue';
2
+ export * from './useAtomSet';
3
+ export * from './useAtom';
4
+ export * from './useAtomMount';
5
+ export * from './useAtomRefresh';
6
+ export * from './useAtomSubscribe';
7
+ export * from './useAtomRef';
8
+ export * from './useAtomResource';
9
+ export * from './useAtomSuspense';
10
+ export * from './useAtomInitialValues';
11
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/hooks/index.ts"],"names":[],"mappings":"AAIA,cAAc,gBAAgB,CAAC;AAC/B,cAAc,cAAc,CAAC;AAC7B,cAAc,WAAW,CAAC;AAC1B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,kBAAkB,CAAC;AACjC,cAAc,oBAAoB,CAAC;AACnC,cAAc,cAAc,CAAC;AAC7B,cAAc,mBAAmB,CAAC;AAClC,cAAc,mBAAmB,CAAC;AAClC,cAAc,wBAAwB,CAAC"}
@@ -0,0 +1,12 @@
1
+ import type * as Atom from '@effect-atom/atom/Atom';
2
+ import type * as Result from '@effect-atom/atom/Result';
3
+ import { type Accessor } from 'solid-js';
4
+ import { type SetAtomFn } from './useAtomSet';
5
+ /**
6
+ * Hook to both read and write an atom
7
+ * Returns a tuple of [value accessor, setter function]
8
+ */
9
+ export declare function useAtom<R, W, Mode extends 'value' | 'promise' | 'promiseExit' = never>(atom: Atom.Writable<R, W>, options?: {
10
+ readonly mode?: ([R] extends [Result.Result<any, any>] ? Mode : 'value') | undefined;
11
+ }): readonly [Accessor<R>, SetAtomFn<R, W, Mode>];
12
+ //# sourceMappingURL=useAtom.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useAtom.d.ts","sourceRoot":"","sources":["../../../../src/hooks/useAtom.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,KAAK,IAAI,MAAM,wBAAwB,CAAC;AACpD,OAAO,KAAK,KAAK,MAAM,MAAM,0BAA0B,CAAC;AACxD,OAAO,EAAE,KAAK,QAAQ,EAA2B,MAAM,UAAU,CAAC;AAIlE,OAAO,EAAE,KAAK,SAAS,EAAiB,MAAM,cAAc,CAAC;AAE7D;;;GAGG;AACH,wBAAgB,OAAO,CAAC,CAAC,EAAE,CAAC,EAAE,IAAI,SAAS,OAAO,GAAG,SAAS,GAAG,aAAa,GAAG,KAAK,EACpF,IAAI,EAAE,IAAI,CAAC,QAAQ,CAAC,CAAC,EAAE,CAAC,CAAC,EACzB,OAAO,CAAC,EAAE;IACR,QAAQ,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC,MAAM,CAAC,MAAM,CAAC,GAAG,EAAE,GAAG,CAAC,CAAC,GAAG,IAAI,GAAG,OAAO,CAAC,GAAG,SAAS,CAAC;CACtF,GACA,SAAS,CAAC,QAAQ,CAAC,CAAC,CAAC,EAAE,SAAS,CAAC,CAAC,EAAE,CAAC,EAAE,IAAI,CAAC,CAAC,CAiB/C"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=useAtom.test.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useAtom.test.d.ts","sourceRoot":"","sources":["../../../../src/hooks/useAtom.test.tsx"],"names":[],"mappings":""}
@@ -0,0 +1,6 @@
1
+ import type * as Atom from '@effect-atom/atom/Atom';
2
+ /**
3
+ * Hook to initialize atoms with values
4
+ */
5
+ export declare function useAtomInitialValues(initialValues: Iterable<readonly [Atom.Writable<any, any>, any]>): void;
6
+ //# sourceMappingURL=useAtomInitialValues.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useAtomInitialValues.d.ts","sourceRoot":"","sources":["../../../../src/hooks/useAtomInitialValues.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,KAAK,IAAI,MAAM,wBAAwB,CAAC;AAIpD;;GAEG;AACH,wBAAgB,oBAAoB,CAAC,aAAa,EAAE,QAAQ,CAAC,SAAS,CAAC,IAAI,CAAC,QAAQ,CAAC,GAAG,EAAE,GAAG,CAAC,EAAE,GAAG,CAAC,CAAC,GAAG,IAAI,CAM3G"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=useAtomInitialValues.test.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useAtomInitialValues.test.d.ts","sourceRoot":"","sources":["../../../../src/hooks/useAtomInitialValues.test.tsx"],"names":[],"mappings":""}
@@ -0,0 +1,6 @@
1
+ import type * as Atom from '@effect-atom/atom/Atom';
2
+ /**
3
+ * Hook to mount an atom without reading its value
4
+ */
5
+ export declare function useAtomMount<A>(atom: Atom.Atom<A>): void;
6
+ //# sourceMappingURL=useAtomMount.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useAtomMount.d.ts","sourceRoot":"","sources":["../../../../src/hooks/useAtomMount.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,KAAK,IAAI,MAAM,wBAAwB,CAAC;AAKpD;;GAEG;AACH,wBAAgB,YAAY,CAAC,CAAC,EAAE,IAAI,EAAE,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,GAAG,IAAI,CAIxD"}
@@ -0,0 +1,15 @@
1
+ import type * as AtomRef from '@effect-atom/atom/AtomRef';
2
+ import { type Accessor } from 'solid-js';
3
+ /**
4
+ * Hook to read an AtomRef value
5
+ */
6
+ export declare function useAtomRef<A>(ref: AtomRef.ReadonlyRef<A>): Accessor<A>;
7
+ /**
8
+ * Hook to get a prop accessor from an AtomRef
9
+ */
10
+ export declare function useAtomRefProp<A, K extends keyof A>(ref: AtomRef.AtomRef<A>, prop: K): AtomRef.AtomRef<A[K]>;
11
+ /**
12
+ * Hook to read a prop value from an AtomRef
13
+ */
14
+ export declare function useAtomRefPropValue<A, K extends keyof A>(ref: AtomRef.AtomRef<A>, prop: K): Accessor<A[K]>;
15
+ //# sourceMappingURL=useAtomRef.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useAtomRef.d.ts","sourceRoot":"","sources":["../../../../src/hooks/useAtomRef.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,KAAK,OAAO,MAAM,2BAA2B,CAAC;AAC1D,OAAO,EAAE,KAAK,QAAQ,EAAuC,MAAM,UAAU,CAAC;AAE9E;;GAEG;AACH,wBAAgB,UAAU,CAAC,CAAC,EAAE,GAAG,EAAE,OAAO,CAAC,WAAW,CAAC,CAAC,CAAC,GAAG,QAAQ,CAAC,CAAC,CAAC,CAUtE;AAED;;GAEG;AACH,wBAAgB,cAAc,CAAC,CAAC,EAAE,CAAC,SAAS,MAAM,CAAC,EAAE,GAAG,EAAE,OAAO,CAAC,OAAO,CAAC,CAAC,CAAC,EAAE,IAAI,EAAE,CAAC,GAAG,OAAO,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAE5G;AAED;;GAEG;AACH,wBAAgB,mBAAmB,CAAC,CAAC,EAAE,CAAC,SAAS,MAAM,CAAC,EAAE,GAAG,EAAE,OAAO,CAAC,OAAO,CAAC,CAAC,CAAC,EAAE,IAAI,EAAE,CAAC,GAAG,QAAQ,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAE1G"}
@@ -0,0 +1,6 @@
1
+ import type * as Atom from '@effect-atom/atom/Atom';
2
+ /**
3
+ * Hook to get a refresh function for an atom
4
+ */
5
+ export declare function useAtomRefresh<A>(atom: Atom.Atom<A>): () => void;
6
+ //# sourceMappingURL=useAtomRefresh.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useAtomRefresh.d.ts","sourceRoot":"","sources":["../../../../src/hooks/useAtomRefresh.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,KAAK,IAAI,MAAM,wBAAwB,CAAC;AAKpD;;GAEG;AACH,wBAAgB,cAAc,CAAC,CAAC,EAAE,IAAI,EAAE,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,GAAG,MAAM,IAAI,CAOhE"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=useAtomRefresh.test.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useAtomRefresh.test.d.ts","sourceRoot":"","sources":["../../../../src/hooks/useAtomRefresh.test.tsx"],"names":[],"mappings":""}
@@ -0,0 +1,14 @@
1
+ import type * as Atom from '@effect-atom/atom/Atom';
2
+ import type * as Result from '@effect-atom/atom/Result';
3
+ import { type Accessor } from 'solid-js';
4
+ /**
5
+ * Resource-like hook for atoms that contain Result values
6
+ * Automatically handles loading and error states
7
+ */
8
+ export declare function useAtomResource<A, E>(atom: Atom.Atom<Result.Result<A, E>>): {
9
+ value: Accessor<A | undefined>;
10
+ error: Accessor<E | undefined>;
11
+ loading: Accessor<boolean>;
12
+ result: Accessor<Result.Result<A, E>>;
13
+ };
14
+ //# sourceMappingURL=useAtomResource.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useAtomResource.d.ts","sourceRoot":"","sources":["../../../../src/hooks/useAtomResource.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,KAAK,IAAI,MAAM,wBAAwB,CAAC;AACpD,OAAO,KAAK,KAAK,MAAM,MAAM,0BAA0B,CAAC;AAExD,OAAO,EAAE,KAAK,QAAQ,EAAuC,MAAM,UAAU,CAAC;AAI9E;;;GAGG;AACH,wBAAgB,eAAe,CAAC,CAAC,EAAE,CAAC,EAClC,IAAI,EAAE,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,GACnC;IACD,KAAK,EAAE,QAAQ,CAAC,CAAC,GAAG,SAAS,CAAC,CAAC;IAC/B,KAAK,EAAE,QAAQ,CAAC,CAAC,GAAG,SAAS,CAAC,CAAC;IAC/B,OAAO,EAAE,QAAQ,CAAC,OAAO,CAAC,CAAC;IAC3B,MAAM,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC;CACvC,CAmCA"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=useAtomResource.test.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useAtomResource.test.d.ts","sourceRoot":"","sources":["../../../../src/hooks/useAtomResource.test.tsx"],"names":[],"mappings":""}
@@ -0,0 +1,16 @@
1
+ import type * as Atom from '@effect-atom/atom/Atom';
2
+ import * as Registry from '@effect-atom/atom/Registry';
3
+ import type * as Result from '@effect-atom/atom/Result';
4
+ import * as Exit from 'effect/Exit';
5
+ export type SetAtomFn<R, W, Mode extends 'value' | 'promise' | 'promiseExit'> = 'promise' extends Mode ? (value: W) => Promise<Result.Result.Success<R>> : 'promiseExit' extends Mode ? (value: W) => Promise<Exit.Exit<Result.Result.Success<R>, Result.Result.Failure<R>>> : (value: W | ((value: R) => W)) => void;
6
+ export declare function createSetAtom<R, W, Mode extends 'value' | 'promise' | 'promiseExit' = never>(registry: Registry.Registry, atom: Atom.Writable<R, W>, options?: {
7
+ readonly mode?: ([R] extends [Result.Result<any, any>] ? Mode : 'value') | undefined;
8
+ }): SetAtomFn<R, W, Mode>;
9
+ /**
10
+ * Hook to get a setter function for an atom
11
+ * Also mounts the atom in the registry
12
+ */
13
+ export declare function useAtomSet<R, W, Mode extends 'value' | 'promise' | 'promiseExit' = never>(atom: Atom.Writable<R, W>, options?: {
14
+ readonly mode?: ([R] extends [Result.Result<any, any>] ? Mode : 'value') | undefined;
15
+ }): SetAtomFn<R, W, Mode>;
16
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G,IAAI,GAAG,OAAO,CAAC,GAAG,SAAS,CAAC;CACtF,GACA,SAAS,CAAC,CAAC,EAAE,CAAC,EAAE,IAAI,CAAC,CAavB;AAED;;;GAGG;AACH,wBAAgB,UAAU,CAAC,CAAC,EAAE,CAAC,EAAE,IAAI,SAAS,OAAO,GAAG,SAAS,GAAG,aAAa,GAAG,KAAK,EACvF,IAAI,EAAE,IAAI,CAAC,QAAQ,CAAC,CAAC,EAAE,CAAC,CAAC,EACzB,OAAO,CAAC,EAAE;IACR,QAAQ,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC,MAAM,CAAC,MAAM,CAAC,GAAG,EAAE,GAAG,CAAC,CAAC,GAAG,IAAI,GAAG,OAAO,CAAC,GAAG,SAAS,CAAC;CACtF,GACA,SAAS,CAAC,CAAC,EAAE,CAAC,EAAE,IAAI,CAAC,CAQvB"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=useAtomSet.test.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useAtomSet.test.d.ts","sourceRoot":"","sources":["../../../../src/hooks/useAtomSet.test.tsx"],"names":[],"mappings":""}
@@ -0,0 +1,8 @@
1
+ import type * as Atom from '@effect-atom/atom/Atom';
2
+ /**
3
+ * Hook to subscribe to atom changes with a callback
4
+ */
5
+ export declare function useAtomSubscribe<A>(atom: Atom.Atom<A>, f: (value: A) => void, options?: {
6
+ readonly immediate?: boolean;
7
+ }): void;
8
+ //# sourceMappingURL=useAtomSubscribe.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useAtomSubscribe.d.ts","sourceRoot":"","sources":["../../../../src/hooks/useAtomSubscribe.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,KAAK,IAAI,MAAM,wBAAwB,CAAC;AAKpD;;GAEG;AACH,wBAAgB,gBAAgB,CAAC,CAAC,EAChC,IAAI,EAAE,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,EAClB,CAAC,EAAE,CAAC,KAAK,EAAE,CAAC,KAAK,IAAI,EACrB,OAAO,CAAC,EAAE;IAAE,QAAQ,CAAC,SAAS,CAAC,EAAE,OAAO,CAAA;CAAE,GACzC,IAAI,CAKN"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=useAtomSubscribe.test.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useAtomSubscribe.test.d.ts","sourceRoot":"","sources":["../../../../src/hooks/useAtomSubscribe.test.tsx"],"names":[],"mappings":""}
@@ -0,0 +1,7 @@
1
+ import type * as Atom from '@effect-atom/atom/Atom';
2
+ import type * as Result from '@effect-atom/atom/Result';
3
+ /**
4
+ * Hook to read an atom value with Suspense support
5
+ */
6
+ export declare function useAtomSuspense<A, E>(atom: Atom.Atom<Result.Result<A, E>>): () => A;
7
+ //# sourceMappingURL=useAtomSuspense.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useAtomSuspense.d.ts","sourceRoot":"","sources":["../../../../src/hooks/useAtomSuspense.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,KAAK,IAAI,MAAM,wBAAwB,CAAC;AACpD,OAAO,KAAK,KAAK,MAAM,MAAM,0BAA0B,CAAC;AAKxD;;GAEG;AACH,wBAAgB,eAAe,CAAC,CAAC,EAAE,CAAC,EAAE,IAAI,EAAE,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,GAAG,MAAM,CAAC,CA4DnF"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=useAtomSuspense.test.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useAtomSuspense.test.d.ts","sourceRoot":"","sources":["../../../../src/hooks/useAtomSuspense.test.tsx"],"names":[],"mappings":""}
@@ -0,0 +1,16 @@
1
+ import type * as Atom from '@effect-atom/atom/Atom';
2
+ import { type Accessor } from 'solid-js';
3
+ /**
4
+ * A value that may be a static value or a reactive accessor.
5
+ */
6
+ type MaybeAccessor<T> = T | Accessor<T>;
7
+ /**
8
+ * Hook to read the value of an atom.
9
+ * The returned accessor will update whenever the atom's value changes.
10
+ * The atom parameter can be reactive (MaybeAccessor) - if the atom changes,
11
+ * the hook will automatically unsubscribe from the old atom and subscribe to the new one.
12
+ */
13
+ export declare function useAtomValue<A>(atom: MaybeAccessor<Atom.Atom<A>>): Accessor<A>;
14
+ export declare function useAtomValue<A, B>(atom: MaybeAccessor<Atom.Atom<A>>, f: (a: A) => B): Accessor<B>;
15
+ export {};
16
+ //# sourceMappingURL=useAtomValue.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useAtomValue.d.ts","sourceRoot":"","sources":["../../../../src/hooks/useAtomValue.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,KAAK,IAAI,MAAM,wBAAwB,CAAC;AAEpD,OAAO,EAAE,KAAK,QAAQ,EAAqD,MAAM,UAAU,CAAC;AAI5F;;GAEG;AACH,KAAK,aAAa,CAAC,CAAC,IAAI,CAAC,GAAG,QAAQ,CAAC,CAAC,CAAC,CAAC;AAOxC;;;;;GAKG;AACH,wBAAgB,YAAY,CAAC,CAAC,EAAE,IAAI,EAAE,aAAa,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,GAAG,QAAQ,CAAC,CAAC,CAAC,CAAC;AAChF,wBAAgB,YAAY,CAAC,CAAC,EAAE,CAAC,EAAE,IAAI,EAAE,aAAa,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,EAAE,CAAC,KAAK,CAAC,GAAG,QAAQ,CAAC,CAAC,CAAC,CAAC"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=useAtomValue.test.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useAtomValue.test.d.ts","sourceRoot":"","sources":["../../../../src/hooks/useAtomValue.test.tsx"],"names":[],"mappings":""}
@@ -0,0 +1,9 @@
1
+ export * as Atom from '@effect-atom/atom/Atom';
2
+ export * as Registry from '@effect-atom/atom/Registry';
3
+ export * as Result from '@effect-atom/atom/Result';
4
+ export * as AtomRef from '@effect-atom/atom/AtomRef';
5
+ export * as AtomHttpApi from '@effect-atom/atom/AtomHttpApi';
6
+ export * as AtomRpc from '@effect-atom/atom/AtomRpc';
7
+ export * from './hooks';
8
+ export * from './registry';
9
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/index.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,IAAI,MAAM,wBAAwB,CAAC;AAC/C,OAAO,KAAK,QAAQ,MAAM,4BAA4B,CAAC;AACvD,OAAO,KAAK,MAAM,MAAM,0BAA0B,CAAC;AACnD,OAAO,KAAK,OAAO,MAAM,2BAA2B,CAAC;AACrD,OAAO,KAAK,WAAW,MAAM,+BAA+B,CAAC;AAC7D,OAAO,KAAK,OAAO,MAAM,2BAA2B,CAAC;AAErD,cAAc,SAAS,CAAC;AACxB,cAAc,YAAY,CAAC"}
@@ -0,0 +1,28 @@
1
+ import type * as Atom from '@effect-atom/atom/Atom';
2
+ import * as Registry from '@effect-atom/atom/Registry';
3
+ import { type Context } from 'solid-js';
4
+ /**
5
+ * Default registry instance
6
+ */
7
+ export declare const defaultRegistry: Registry.Registry;
8
+ /**
9
+ * Solid context for the atom registry
10
+ */
11
+ export declare const RegistryContext: Context<Registry.Registry>;
12
+ /**
13
+ * Get the current registry from context
14
+ */
15
+ export declare const useRegistry: () => Registry.Registry;
16
+ /**
17
+ * Provider component for custom registry
18
+ */
19
+ export interface RegistryProviderProps {
20
+ children: any;
21
+ registry?: Registry.Registry;
22
+ initialValues?: Iterable<readonly [Atom.Atom<any>, any]>;
23
+ scheduleTask?: (f: () => void) => void;
24
+ timeoutResolution?: number;
25
+ defaultIdleTTL?: number;
26
+ }
27
+ export declare function RegistryProvider(props: RegistryProviderProps): import("solid-js").JSX.Element;
28
+ //# sourceMappingURL=registry.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"registry.d.ts","sourceRoot":"","sources":["../../../src/registry.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,KAAK,IAAI,MAAM,wBAAwB,CAAC;AACpD,OAAO,KAAK,QAAQ,MAAM,4BAA4B,CAAC;AAEvD,OAAO,EAAE,KAAK,OAAO,EAAwC,MAAM,UAAU,CAAC;AAE9E;;GAEG;AACH,eAAO,MAAM,eAAe,EAAE,QAAQ,CAAC,QAGtC,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,eAAe,EAAE,OAAO,CAAC,QAAQ,CAAC,QAAQ,CAAqD,CAAC;AAE7G;;GAEG;AACH,eAAO,MAAM,WAAW,QAAO,QAAQ,CAAC,QAEvC,CAAC;AAEF;;GAEG;AACH,MAAM,WAAW,qBAAqB;IACpC,QAAQ,EAAE,GAAG,CAAC;IACd,QAAQ,CAAC,EAAE,QAAQ,CAAC,QAAQ,CAAC;IAC7B,aAAa,CAAC,EAAE,QAAQ,CAAC,SAAS,CAAC,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,EAAE,GAAG,CAAC,CAAC,CAAC;IACzD,YAAY,CAAC,EAAE,CAAC,CAAC,EAAE,MAAM,IAAI,KAAK,IAAI,CAAC;IACvC,iBAAiB,CAAC,EAAE,MAAM,CAAC;IAC3B,cAAc,CAAC,EAAE,MAAM,CAAC;CACzB;AAED,wBAAgB,gBAAgB,CAAC,KAAK,EAAE,qBAAqB,kCAwB5D"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=registry.test.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"registry.test.d.ts","sourceRoot":"","sources":["../../../src/registry.test.tsx"],"names":[],"mappings":""}