@atolljs/solidjs 0.1.0 → 0.1.2
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/README.md +49 -5
- package/package.json +8 -3
package/README.md
CHANGED
|
@@ -1,9 +1,53 @@
|
|
|
1
1
|
# @atolljs/solidjs
|
|
2
2
|
|
|
3
|
-
SolidJS bindings for `@atolljs/core` —
|
|
3
|
+
SolidJS bindings for `@atolljs/core` — shared-memory fields and worker tasks as
|
|
4
|
+
natively tracked `Accessor`s (the SDK uses `solid-js` internally for its
|
|
5
|
+
reactive core). Subscriptions auto-dispose via `onCleanup` when the owner is
|
|
6
|
+
destroyed.
|
|
4
7
|
|
|
5
|
-
|
|
6
|
-
- `createSharedValue(memory, key)` — a shared-memory field as an `Accessor`.
|
|
7
|
-
- `createTask(task)` — `{ state }` Accessor of the task snapshot plus `run`/`runOnce`.
|
|
8
|
+
**[Atoll — package documentation](https://jwhenry3.github.io/atolljs/consumer/quickstart/)**
|
|
8
9
|
|
|
9
|
-
|
|
10
|
+
## Install
|
|
11
|
+
|
|
12
|
+
```bash
|
|
13
|
+
npm install @atolljs/core @atolljs/solidjs
|
|
14
|
+
```
|
|
15
|
+
|
|
16
|
+
## Usage
|
|
17
|
+
|
|
18
|
+
```tsx
|
|
19
|
+
import { createSharedValue, createTask } from '@atolljs/solidjs';
|
|
20
|
+
import { counterMemory } from './counter.memory';
|
|
21
|
+
import { counter } from './counter';
|
|
22
|
+
|
|
23
|
+
export function App() {
|
|
24
|
+
const count = createSharedValue(counterMemory, 'count');
|
|
25
|
+
const increment = createTask(counter.increment);
|
|
26
|
+
|
|
27
|
+
return (
|
|
28
|
+
<button onClick={() => increment.run(1)}>
|
|
29
|
+
count: {count() ?? '…'}
|
|
30
|
+
</button>
|
|
31
|
+
);
|
|
32
|
+
}
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
## API
|
|
36
|
+
|
|
37
|
+
- `createObservable(source)` — subscribe to any `ObservableValue` snapshot as
|
|
38
|
+
an `Accessor`.
|
|
39
|
+
- `createSharedValue(memory, key, select?, options?)` — bind one shared-memory
|
|
40
|
+
field to an `Accessor`; optional selector + `equals`.
|
|
41
|
+
- `createTask(task | asyncFn)` — bind an `AsyncTask` (or any async fn) to
|
|
42
|
+
`{ state: Accessor<TaskSnapshot> }` plus `run`/`runOnce` triggers.
|
|
43
|
+
|
|
44
|
+
## Notes
|
|
45
|
+
|
|
46
|
+
- Worker-hosted Solid trees (islands) live in the companion package
|
|
47
|
+
[`@atolljs/solid-island`](../solid-island).
|
|
48
|
+
|
|
49
|
+
## Documentation
|
|
50
|
+
|
|
51
|
+
- [Atoll — package documentation](https://jwhenry3.github.io/atolljs/consumer/quickstart/)
|
|
52
|
+
- [SolidJS guide](https://jwhenry3.github.io/atolljs/consumer/fw-solid/)
|
|
53
|
+
- [Worker islands for Solid](https://jwhenry3.github.io/atolljs/consumer/fw-solid/worker-islands/)
|
package/package.json
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atolljs/solidjs",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.2",
|
|
4
4
|
"description": "SolidJS bindings — createObservable, createSharedValue, createTask",
|
|
5
|
+
"homepage": "https://jwhenry3.github.io/atolljs/consumer/quickstart/",
|
|
5
6
|
"type": "module",
|
|
6
7
|
"exports": {
|
|
7
8
|
".": "./src/index.ts"
|
|
@@ -10,15 +11,19 @@
|
|
|
10
11
|
"src"
|
|
11
12
|
],
|
|
12
13
|
"publishConfig": {
|
|
13
|
-
"access": "public"
|
|
14
|
+
"access": "public",
|
|
15
|
+
"registry": "https://registry.npmjs.org"
|
|
14
16
|
},
|
|
15
17
|
"peerDependencies": {
|
|
16
|
-
"@atolljs/core": "0.1.
|
|
18
|
+
"@atolljs/core": "0.1.2",
|
|
17
19
|
"solid-js": "^1.9.15"
|
|
18
20
|
},
|
|
19
21
|
"repository": {
|
|
20
22
|
"type": "git",
|
|
21
23
|
"url": "https://github.com/jwhenry3/atolljs",
|
|
22
24
|
"directory": "packages/solidjs"
|
|
25
|
+
},
|
|
26
|
+
"bugs": {
|
|
27
|
+
"url": "https://github.com/jwhenry3/atolljs/issues"
|
|
23
28
|
}
|
|
24
29
|
}
|