@effect/atom-solid 4.0.0-beta.77 → 4.0.0-beta.79
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/Hooks.d.ts.map +1 -1
- package/dist/Hooks.js +4 -20
- package/dist/Hooks.js.map +1 -1
- package/dist/RegistryContext.d.ts +4 -21
- package/dist/RegistryContext.d.ts.map +1 -1
- package/dist/RegistryContext.js.map +1 -1
- package/package.json +3 -3
- package/src/Hooks.ts +4 -20
- package/src/RegistryContext.ts +4 -21
package/dist/Hooks.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Hooks.d.ts","sourceRoot":"","sources":["../src/Hooks.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"Hooks.d.ts","sourceRoot":"","sources":["../src/Hooks.ts"],"names":[],"mappings":"AAUA,OAAO,KAAK,IAAI,MAAM,aAAa,CAAA;AACnC,OAAO,KAAK,WAAW,MAAM,wCAAwC,CAAA;AACrE,OAAO,KAAK,IAAI,MAAM,iCAAiC,CAAA;AACvD,OAAO,KAAK,KAAK,OAAO,MAAM,oCAAoC,CAAA;AAElE,OAAO,KAAK,EAAE,QAAQ,EAAE,eAAe,EAAE,cAAc,EAAE,MAAM,UAAU,CAAA;AAMzE;;;;;;;;;;;;;;;;GAgBG;AACH,eAAO,MAAM,oBAAoB,GAAI,eAAe,QAAQ,CAAC,SAAS,CAAC,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,EAAE,GAAG,CAAC,CAAC,KAAG,IAa9F,CAAA;AAED;;;;;;GAMG;AACH,eAAO,MAAM,YAAY,EAAE;IACzB;;;;;;OAMG;IACH,CAAC,CAAC,EAAE,IAAI,EAAE,MAAM,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,GAAG,QAAQ,CAAC,CAAC,CAAC,CAAA;IAC1C;;;;;;OAMG;IACH,CAAC,CAAC,EAAE,CAAC,EAAE,IAAI,EAAE,MAA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- Write without subscribing to the value with {@link useAtomSet}
|
|
10
|
-
* - Refresh or mount atoms from components with {@link useAtomRefresh} and {@link useAtomMount}
|
|
11
|
-
* - Convert `AsyncResult` atoms into Solid resources with {@link useAtomResource}
|
|
12
|
-
* - Work with atom refs and nested ref properties with {@link useAtomRef}, {@link useAtomRefProp},
|
|
13
|
-
* and {@link useAtomRefPropValue}
|
|
14
|
-
*
|
|
15
|
-
* **Solid integration notes**
|
|
16
|
-
*
|
|
17
|
-
* Hooks in this module read the registry from {@link RegistryContext}, so they
|
|
18
|
-
* should be used under the matching provider for the atom graph you want to
|
|
19
|
-
* observe. Atom arguments are thunks so Solid can track dynamic atom selection;
|
|
20
|
-
* subscriptions are registered in Solid computations and disposed with
|
|
21
|
-
* `onCleanup` when the computation changes or the component unmounts.
|
|
2
|
+
* Solid hooks for using Effect Atoms from components and computations. The
|
|
3
|
+
* hooks read and write atoms through the current `RegistryContext`, mount atoms
|
|
4
|
+
* for cleanup, subscribe callbacks, seed initial values, expose `AsyncResult`
|
|
5
|
+
* atoms as Solid resources, and read values from `AtomRef` references.
|
|
22
6
|
*
|
|
23
7
|
* @since 4.0.0
|
|
24
8
|
*/
|
package/dist/Hooks.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Hooks.js","names":["Cause","Effect","Exit","AsyncResult","Atom","AtomRegistry","createComputed","createEffect","createMemo","createResource","createSignal","onCleanup","useContext","RegistryContext","initialValuesSet","WeakMap","useAtomInitialValues","initialValues","registry","set","get","undefined","WeakSet","atom","value","has","add","ensureNode","setValue","useAtomValue","f","createAtomAccessor","map","subscribe","constImmediate","immediate","mountAtom","mount","setAtom","options","memo","mode","promise","runPromiseExit","getResult","suspendOnWaiting","then","flattenExit","exit","isSuccess","squash","cause","useAtomMount","useAtomSet","useAtomRefresh","refresh","useAtom","useAtomSubscribe","useAtomResource","result","isInitial","waiting","constUnresolvedPromise","Promise","resolve","reject","useAtomRef","ref","r","useAtomRefProp","prop","useAtomRefPropValue"],"sources":["../src/Hooks.ts"],"sourcesContent":[null],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"Hooks.js","names":["Cause","Effect","Exit","AsyncResult","Atom","AtomRegistry","createComputed","createEffect","createMemo","createResource","createSignal","onCleanup","useContext","RegistryContext","initialValuesSet","WeakMap","useAtomInitialValues","initialValues","registry","set","get","undefined","WeakSet","atom","value","has","add","ensureNode","setValue","useAtomValue","f","createAtomAccessor","map","subscribe","constImmediate","immediate","mountAtom","mount","setAtom","options","memo","mode","promise","runPromiseExit","getResult","suspendOnWaiting","then","flattenExit","exit","isSuccess","squash","cause","useAtomMount","useAtomSet","useAtomRefresh","refresh","useAtom","useAtomSubscribe","useAtomResource","result","isInitial","waiting","constUnresolvedPromise","Promise","resolve","reject","useAtomRef","ref","r","useAtomRefProp","prop","useAtomRefPropValue"],"sources":["../src/Hooks.ts"],"sourcesContent":[null],"mappings":"AAAA;;;;;;;;AAQA,OAAO,KAAKA,KAAK,MAAM,cAAc;AACrC,OAAO,KAAKC,MAAM,MAAM,eAAe;AACvC,OAAO,KAAKC,IAAI,MAAM,aAAa;AACnC,OAAO,KAAKC,WAAW,MAAM,wCAAwC;AACrE,OAAO,KAAKC,IAAI,MAAM,iCAAiC;AAEvD,OAAO,KAAKC,YAAY,MAAM,yCAAyC;AAEvE,SAASC,cAAc,EAAEC,YAAY,EAAEC,UAAU,EAAEC,cAAc,EAAEC,YAAY,EAAEC,SAAS,EAAEC,UAAU,QAAQ,UAAU;AACxH,SAASC,eAAe,QAAQ,sBAAsB;AAEtD,MAAMC,gBAAgB,gBAAG,IAAIC,OAAO,EAAsD;AAE1F;;;;;;;;;;;;;;;;;AAiBA,OAAO,MAAMC,oBAAoB,GAAIC,aAAuD,IAAU;EACpG,MAAMC,QAAQ,GAAGN,UAAU,CAACC,eAAe,CAAC;EAC5C,IAAIM,GAAG,GAAGL,gBAAgB,CAACM,GAAG,CAACF,QAAQ,CAAC;EACxC,IAAIC,GAAG,KAAKE,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|
@@ -1,25 +1,8 @@
|
|
|
1
1
|
/**
|
|
2
|
-
*
|
|
3
|
-
*
|
|
4
|
-
*
|
|
5
|
-
*
|
|
6
|
-
* registries.
|
|
7
|
-
*
|
|
8
|
-
* **Common tasks**
|
|
9
|
-
*
|
|
10
|
-
* - Use {@link RegistryProvider} to scope atom state to a Solid subtree
|
|
11
|
-
* - Seed atoms for tests, examples, or server-provided data with `initialValues`
|
|
12
|
-
* - Override scheduling or idle timing for custom rendering environments
|
|
13
|
-
* - Read {@link RegistryContext} when integrating lower-level atom APIs
|
|
14
|
-
*
|
|
15
|
-
* **Gotchas**
|
|
16
|
-
*
|
|
17
|
-
* - The provider creates a registry for the current Solid owner and disposes it
|
|
18
|
-
* with `onCleanup`
|
|
19
|
-
* - `initialValues` are applied when the provider creates the registry, not as
|
|
20
|
-
* reactive updates after creation
|
|
21
|
-
* - Overriding `scheduleTask` changes when atom work is flushed, so it should
|
|
22
|
-
* return a cancellation function that is safe to call during Solid cleanup
|
|
2
|
+
* Solid context and provider for the Atom registry used by Effect Atom hooks.
|
|
3
|
+
* The registry stores atom values, schedules update work, and cleans up unused
|
|
4
|
+
* atoms. Sharing one registry through Solid context lets components and
|
|
5
|
+
* computations in the same owner tree read and write the same atom state.
|
|
23
6
|
*
|
|
24
7
|
* @since 4.0.0
|
|
25
8
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"RegistryContext.d.ts","sourceRoot":"","sources":["../src/RegistryContext.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"RegistryContext.d.ts","sourceRoot":"","sources":["../src/RegistryContext.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AACH,OAAO,KAAK,KAAK,IAAI,MAAM,iCAAiC,CAAA;AAC5D,OAAO,KAAK,YAAY,MAAM,yCAAyC,CAAA;AACvE,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,UAAU,CAAA;AAGnC;;;;;;;;;;;;;;;;;GAiBG;AACH,eAAO,MAAM,eAAe,uDAAgE,CAAA;AAE5F;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AACH,eAAO,MAAM,gBAAgB,GAAI,SAAS;IACxC,QAAQ,CAAC,QAAQ,CAAC,EAAE,GAAG,CAAC,OAAO,GAAG,SAAS,CAAA;IAC3C,QAAQ,CAAC,aAAa,CAAC,EAAE,QAAQ,CAAC,SAAS,CAAC,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,EAAE,GAAG,CAAC,CAAC,GAAG,SAAS,CAAA;IAC7E,QAAQ,CAAC,YAAY,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,MAAM,IAAI,KAAK,MAAM,IAAI,CAAC,GAAG,SAAS,CAAA;IACnE,QAAQ,CAAC,iBAAiB,CAAC,EAAE,MAAM,GAAG,SAAS,CAAA;IAC/C,QAAQ,CAAC,cAAc,CAAC,EAAE,MAAM,GAAG,SAAS,CAAA;CAC7C,gBAcA,CAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"RegistryContext.js","names":["AtomRegistry","createComponent","createContext","onCleanup","RegistryContext","make","RegistryProvider","options","registry","scheduleTask","initialValues","timeoutResolution","defaultIdleTTL","dispose","Provider","value","children"],"sources":["../src/RegistryContext.ts"],"sourcesContent":[null],"mappings":"
|
|
1
|
+
{"version":3,"file":"RegistryContext.js","names":["AtomRegistry","createComponent","createContext","onCleanup","RegistryContext","make","RegistryProvider","options","registry","scheduleTask","initialValues","timeoutResolution","defaultIdleTTL","dispose","Provider","value","children"],"sources":["../src/RegistryContext.ts"],"sourcesContent":[null],"mappings":"AASA,OAAO,KAAKA,YAAY,MAAM,yCAAyC;AAEvE,SAASC,eAAe,EAAEC,aAAa,EAAEC,SAAS,QAAQ,UAAU;AAEpE;;;;;;;;;;;;;;;;;;AAkBA,OAAO,MAAMC,eAAe,gBAAGF,aAAa,cAA4BF,YAAY,CAACK,IAAI,EAAE,CAAC;AAE5F;;;;;;;;;;;;;;;;;;;;;;;;;;AA0BA,OAAO,MAAMC,gBAAgB,GAAIC,OAMhC,IAAI;EACH,MAAMC,QAAQ,GAAGR,YAAY,CAACK,IAAI,CAAC;IACjCI,YAAY,EAAEF,OAAO,CAACE,YAAY;IAClCC,aAAa,EAAEH,OAAO,CAACG,aAAa;IACpCC,iBAAiB,EAAEJ,OAAO,CAACI,iBAAiB;IAC5CC,cAAc,EAAEL,OAAO,CAACK,cAAc,IAAI;GAC3C,CAAC;EACFT,SAAS,CAAC,MAAMK,QAAQ,CAACK,OAAO,EAAE,CAAC;EACnC,OAAOZ,eAAe,CAACG,eAAe,CAACU,QAAQ,EAAE;IAC/CC,KAAK,EAAEP,QAAQ;IACf,IAAIQ,QAAQA,CAAA;MACV,OAAOT,OAAO,CAACS,QAAQ;IACzB;GACD,CAAC;AACJ,CAAC","ignoreList":[]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@effect/atom-solid",
|
|
3
|
-
"version": "4.0.0-beta.
|
|
3
|
+
"version": "4.0.0-beta.79",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"description": "SolidJS bindings for the Effect Atom modules",
|
|
@@ -44,7 +44,7 @@
|
|
|
44
44
|
},
|
|
45
45
|
"peerDependencies": {
|
|
46
46
|
"solid-js": ">=1 <2",
|
|
47
|
-
"effect": "^4.0.0-beta.
|
|
47
|
+
"effect": "^4.0.0-beta.79"
|
|
48
48
|
},
|
|
49
49
|
"devDependencies": {
|
|
50
50
|
"@solidjs/testing-library": "^0.8.0",
|
|
@@ -52,7 +52,7 @@
|
|
|
52
52
|
"@testing-library/jest-dom": "^6.9.1",
|
|
53
53
|
"jsdom": "^29.1.1",
|
|
54
54
|
"solid-js": "^1.9.12",
|
|
55
|
-
"effect": "^4.0.0-beta.
|
|
55
|
+
"effect": "^4.0.0-beta.79"
|
|
56
56
|
},
|
|
57
57
|
"scripts": {
|
|
58
58
|
"build": "tsc -b tsconfig.json && pnpm babel",
|
package/src/Hooks.ts
CHANGED
|
@@ -1,24 +1,8 @@
|
|
|
1
1
|
/**
|
|
2
|
-
*
|
|
3
|
-
*
|
|
4
|
-
*
|
|
5
|
-
*
|
|
6
|
-
*
|
|
7
|
-
* - Read an atom as a Solid accessor with {@link useAtomValue}
|
|
8
|
-
* - Read and write a writable atom with {@link useAtom}
|
|
9
|
-
* - Write without subscribing to the value with {@link useAtomSet}
|
|
10
|
-
* - Refresh or mount atoms from components with {@link useAtomRefresh} and {@link useAtomMount}
|
|
11
|
-
* - Convert `AsyncResult` atoms into Solid resources with {@link useAtomResource}
|
|
12
|
-
* - Work with atom refs and nested ref properties with {@link useAtomRef}, {@link useAtomRefProp},
|
|
13
|
-
* and {@link useAtomRefPropValue}
|
|
14
|
-
*
|
|
15
|
-
* **Solid integration notes**
|
|
16
|
-
*
|
|
17
|
-
* Hooks in this module read the registry from {@link RegistryContext}, so they
|
|
18
|
-
* should be used under the matching provider for the atom graph you want to
|
|
19
|
-
* observe. Atom arguments are thunks so Solid can track dynamic atom selection;
|
|
20
|
-
* subscriptions are registered in Solid computations and disposed with
|
|
21
|
-
* `onCleanup` when the computation changes or the component unmounts.
|
|
2
|
+
* Solid hooks for using Effect Atoms from components and computations. The
|
|
3
|
+
* hooks read and write atoms through the current `RegistryContext`, mount atoms
|
|
4
|
+
* for cleanup, subscribe callbacks, seed initial values, expose `AsyncResult`
|
|
5
|
+
* atoms as Solid resources, and read values from `AtomRef` references.
|
|
22
6
|
*
|
|
23
7
|
* @since 4.0.0
|
|
24
8
|
*/
|
package/src/RegistryContext.ts
CHANGED
|
@@ -1,25 +1,8 @@
|
|
|
1
1
|
/**
|
|
2
|
-
*
|
|
3
|
-
*
|
|
4
|
-
*
|
|
5
|
-
*
|
|
6
|
-
* registries.
|
|
7
|
-
*
|
|
8
|
-
* **Common tasks**
|
|
9
|
-
*
|
|
10
|
-
* - Use {@link RegistryProvider} to scope atom state to a Solid subtree
|
|
11
|
-
* - Seed atoms for tests, examples, or server-provided data with `initialValues`
|
|
12
|
-
* - Override scheduling or idle timing for custom rendering environments
|
|
13
|
-
* - Read {@link RegistryContext} when integrating lower-level atom APIs
|
|
14
|
-
*
|
|
15
|
-
* **Gotchas**
|
|
16
|
-
*
|
|
17
|
-
* - The provider creates a registry for the current Solid owner and disposes it
|
|
18
|
-
* with `onCleanup`
|
|
19
|
-
* - `initialValues` are applied when the provider creates the registry, not as
|
|
20
|
-
* reactive updates after creation
|
|
21
|
-
* - Overriding `scheduleTask` changes when atom work is flushed, so it should
|
|
22
|
-
* return a cancellation function that is safe to call during Solid cleanup
|
|
2
|
+
* Solid context and provider for the Atom registry used by Effect Atom hooks.
|
|
3
|
+
* The registry stores atom values, schedules update work, and cleans up unused
|
|
4
|
+
* atoms. Sharing one registry through Solid context lets components and
|
|
5
|
+
* computations in the same owner tree read and write the same atom state.
|
|
23
6
|
*
|
|
24
7
|
* @since 4.0.0
|
|
25
8
|
*/
|