@dxos/effect-atom-solid 0.8.4-main.ef1bc66f44 → 0.8.4-main.effb148878

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/LICENSE CHANGED
@@ -1,8 +1,105 @@
1
- MIT License
2
- Copyright (c) 2025 DXOS
1
+ # Functional Source License, Version 1.1, ALv2 Future License
3
2
 
4
- Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
3
+ ## Abbreviation
5
4
 
6
- The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
5
+ FSL-1.1-Apache-2.0
7
6
 
8
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
7
+ ## Notice
8
+
9
+ Copyright 2026 DXOS
10
+
11
+ ## Terms and Conditions
12
+
13
+ ### Licensor ("We")
14
+
15
+ The party offering the Software under these Terms and Conditions.
16
+
17
+ ### The Software
18
+
19
+ The "Software" is each version of the software that we make available under
20
+ these Terms and Conditions, as indicated by our inclusion of these Terms and
21
+ Conditions with the Software.
22
+
23
+ ### License Grant
24
+
25
+ Subject to your compliance with this License Grant and the Patents,
26
+ Redistribution and Trademark clauses below, we hereby grant you the right to
27
+ use, copy, modify, create derivative works, publicly perform, publicly display
28
+ and redistribute the Software for any Permitted Purpose identified below.
29
+
30
+ ### Permitted Purpose
31
+
32
+ A Permitted Purpose is any purpose other than a Competing Use. A Competing Use
33
+ means making the Software available to others in a commercial product or
34
+ service that:
35
+
36
+ 1. substitutes for the Software;
37
+
38
+ 2. substitutes for any other product or service we offer using the Software
39
+ that exists as of the date we make the Software available; or
40
+
41
+ 3. offers the same or substantially similar functionality as the Software.
42
+
43
+ Permitted Purposes specifically include using the Software:
44
+
45
+ 1. for your internal use and access;
46
+
47
+ 2. for non-commercial education;
48
+
49
+ 3. for non-commercial research; and
50
+
51
+ 4. in connection with professional services that you provide to a licensee
52
+ using the Software in accordance with these Terms and Conditions.
53
+
54
+ ### Patents
55
+
56
+ To the extent your use for a Permitted Purpose would necessarily infringe our
57
+ patents, the license grant above includes a license under our patents. If you
58
+ make a claim against any party that the Software infringes or contributes to
59
+ the infringement of any patent, then your patent license to the Software ends
60
+ immediately.
61
+
62
+ ### Redistribution
63
+
64
+ The Terms and Conditions apply to all copies, modifications and derivatives of
65
+ the Software.
66
+
67
+ If you redistribute any copies, modifications or derivatives of the Software,
68
+ you must include a copy of or a link to these Terms and Conditions and not
69
+ remove any copyright notices provided in or with the Software.
70
+
71
+ ### Disclaimer
72
+
73
+ THE SOFTWARE IS PROVIDED "AS IS" AND WITHOUT WARRANTIES OF ANY KIND, EXPRESS OR
74
+ IMPLIED, INCLUDING WITHOUT LIMITATION WARRANTIES OF FITNESS FOR A PARTICULAR
75
+ PURPOSE, MERCHANTABILITY, TITLE OR NON-INFRINGEMENT.
76
+
77
+ IN NO EVENT WILL WE HAVE ANY LIABILITY TO YOU ARISING OUT OF OR RELATED TO THE
78
+ SOFTWARE, INCLUDING INDIRECT, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES,
79
+ EVEN IF WE HAVE BEEN INFORMED OF THEIR POSSIBILITY IN ADVANCE.
80
+
81
+ ### Trademarks
82
+
83
+ Except for displaying the License Details and identifying us as the origin of
84
+ the Software, you have no right under these Terms and Conditions to use our
85
+ trademarks, trade names, service marks or product names.
86
+
87
+ ## Grant of Future License
88
+
89
+ We hereby irrevocably grant you an additional license to use the Software under
90
+ the Apache License, Version 2.0 that is effective on the second anniversary of
91
+ the date we make the Software available. On or after that date, you may use the
92
+ Software under the Apache License, Version 2.0, in which case the following
93
+ will apply:
94
+
95
+ Licensed under the Apache License, Version 2.0 (the "License"); you may not use
96
+ this file except in compliance with the License.
97
+
98
+ You may obtain a copy of the License at
99
+
100
+ http://www.apache.org/licenses/LICENSE-2.0
101
+
102
+ Unless required by applicable law or agreed to in writing, software distributed
103
+ under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
104
+ CONDITIONS OF ANY KIND, either express or implied. See the License for the
105
+ specific language governing permissions and limitations under the License.
@@ -69,7 +69,9 @@ import * as Effect from "effect/Effect";
69
69
  import * as Exit from "effect/Exit";
70
70
  import { onCleanup as onCleanup3 } from "solid-js";
71
71
  var flattenExit = (exit) => {
72
- if (Exit.isSuccess(exit)) return exit.value;
72
+ if (Exit.isSuccess(exit)) {
73
+ return exit.value;
74
+ }
73
75
  throw Cause.squash(exit.cause);
74
76
  };
75
77
  function createSetAtom(registry, atom, options) {
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
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,UAAU,aAAcA,MAAAA,IAA0BA;AAUrG,SAASC,aAAgBC,MAAmCC,GAAe;AAChF,QAAMC,WAAWC,YAAAA;AAGjB,QAAMC,eAAeC,WAAW,MAAA;AAC9B,UAAMC,IAAIT,OAAOG,IAAAA;AACjB,WAAOC,IAAeM,eAAID,GAAGL,CAAAA,IAAKK;EACpC,CAAA;AAE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jB;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"]
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)) {\n return exit.value;\n }\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';\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,kBAA8CN,cAAiCG,eAAAA;AAKrF,IAAMI,cAAc,MAAA;AACzB,SAAOL,WAAWI,eAAAA;AACpB;AAcO,SAASE,iBAAiBC,OAA4B;AAC3D,QAAMC,WACJD,MAAMC,YACGL,cAAK;IACZM,cAAcF,MAAME;IACpBC,eAAeH,MAAMG;IACrBC,mBAAmBJ,MAAMI;IACzBC,gBAAgBL,MAAMK,kBAAkB;EAC1C,CAAA;AAEFb,YAAU,MAAA;AAER,UAAMc,UAAUC,WAAW,MAAA;AACzBN,eAASO,QAAO;IAClB,GAAG,GAAA;AACH,WAAO,MAAMC,aAAaH,OAAAA;EAC5B,CAAA;AAEA,SAAOT,gBAAgBa,SAAS;IAC9BC,OAAOV;IACP,IAAIW,WAAW;AACb,aAAOZ,MAAMY;IACf;EACF,CAAA;AACF;;;AD/CA,IAAMC,SAAS,CAAIC,UAAgC,OAAOA,UAAU,aAAcA,MAAAA,IAA0BA;AAUrG,SAASC,aAAgBC,MAAmCC,GAAe;AAChF,QAAMC,WAAWC,YAAAA;AAGjB,QAAMC,eAAeC,WAAW,MAAA;AAC9B,UAAMC,IAAIT,OAAOG,IAAAA;AACjB,WAAOC,IAAeM,eAAID,GAAGL,CAAAA,IAAKK;EACpC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OF,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", "useRegistry", "RegistryProvider", "props", "registry", "scheduleTask", "initialValues", "timeoutResolution", "defaultIdleTTL", "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", "unsubscribe", "subscribe", "next", "useAtomRefProp", "prop", "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
7
  }
@@ -1 +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/browser/index.mjs.map":{"imports":[],"exports":[],"inputs":{},"bytes":22360},"dist/lib/browser/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":7618}}}
1
+ {"inputs":{"src/registry.ts":{"bytes":5168,"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":4955,"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":6139,"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":3132,"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":1389,"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":1553,"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":1671,"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":2882,"imports":[{"path":"solid-js","kind":"import-statement","external":true}],"format":"esm"},"src/hooks/useAtomResource.ts":{"bytes":4453,"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":8072,"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":1440,"imports":[{"path":"src/registry.ts","kind":"import-statement","original":"../registry"}],"format":"esm"},"src/hooks/index.ts":{"bytes":1307,"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":1579,"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/browser/index.mjs.map":{"imports":[],"exports":[],"inputs":{},"bytes":22292},"dist/lib/browser/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":1046},"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":7628}}}
@@ -71,7 +71,9 @@ import * as Effect from "effect/Effect";
71
71
  import * as Exit from "effect/Exit";
72
72
  import { onCleanup as onCleanup3 } from "solid-js";
73
73
  var flattenExit = (exit) => {
74
- if (Exit.isSuccess(exit)) return exit.value;
74
+ if (Exit.isSuccess(exit)) {
75
+ return exit.value;
76
+ }
75
77
  throw Cause.squash(exit.cause);
76
78
  };
77
79
  function createSetAtom(registry, atom, options) {
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
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;A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,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"]
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)) {\n return exit.value;\n }\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';\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": ";;;AA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A;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", "useRegistry", "RegistryProvider", "props", "registry", "scheduleTask", "initialValues", "timeoutResolution", "defaultIdleTTL", "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", "unsubscribe", "subscribe", "next", "useAtomRefProp", "prop", "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
7
  }
@@ -1 +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}}}
1
+ {"inputs":{"src/registry.ts":{"bytes":5168,"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":4955,"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":6139,"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":3132,"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":1389,"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":1553,"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":1671,"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":2882,"imports":[{"path":"solid-js","kind":"import-statement","external":true}],"format":"esm"},"src/hooks/useAtomResource.ts":{"bytes":4453,"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":8072,"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":1440,"imports":[{"path":"src/registry.ts","kind":"import-statement","original":"../registry"}],"format":"esm"},"src/hooks/index.ts":{"bytes":1307,"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":1579,"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":22294},"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":1046},"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":7721}}}
@@ -1 +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"}
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,CA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