@vielzeug/ripple 1.2.3 → 2.0.0
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 +33 -71
- package/dist/_async.cjs +2 -0
- package/dist/_async.cjs.map +1 -0
- package/dist/_async.d.ts +40 -0
- package/dist/_async.d.ts.map +1 -0
- package/dist/_async.js +75 -0
- package/dist/_async.js.map +1 -0
- package/dist/_store.cjs +2 -0
- package/dist/_store.cjs.map +1 -0
- package/dist/_store.d.ts +20 -0
- package/dist/_store.d.ts.map +1 -0
- package/dist/_store.js +24 -0
- package/dist/_store.js.map +1 -0
- package/dist/_watch.cjs +2 -0
- package/dist/_watch.cjs.map +1 -0
- package/dist/_watch.d.ts +15 -0
- package/dist/_watch.d.ts.map +1 -0
- package/dist/_watch.js +18 -0
- package/dist/_watch.js.map +1 -0
- package/dist/async.cjs +1 -0
- package/dist/async.d.ts +3 -0
- package/dist/async.d.ts.map +1 -0
- package/dist/async.js +2 -0
- package/dist/errors.cjs +1 -1
- package/dist/errors.cjs.map +1 -1
- package/dist/errors.d.ts +2 -15
- package/dist/errors.d.ts.map +1 -1
- package/dist/errors.js +2 -2
- package/dist/errors.js.map +1 -1
- package/dist/index.cjs +2 -1
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.ts +34 -11
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +25 -12
- package/dist/index.js.map +1 -0
- package/dist/ripple.cjs +1 -1
- package/dist/ripple.cjs.map +1 -1
- package/dist/ripple.iife.js +1 -1
- package/dist/ripple.iife.js.map +1 -1
- package/dist/ripple.js +1 -1
- package/dist/ripple.js.map +1 -1
- package/dist/runtime.cjs +2 -0
- package/dist/runtime.cjs.map +1 -0
- package/dist/runtime.d.ts +98 -0
- package/dist/runtime.d.ts.map +1 -0
- package/dist/runtime.js +340 -0
- package/dist/runtime.js.map +1 -0
- package/dist/store.cjs +1 -2
- package/dist/store.d.ts +2 -44
- package/dist/store.d.ts.map +1 -1
- package/dist/store.js +2 -205
- package/dist/types.d.ts +37 -292
- package/dist/types.d.ts.map +1 -1
- package/dist/watch.cjs +1 -0
- package/dist/watch.d.ts +3 -0
- package/dist/watch.d.ts.map +1 -0
- package/dist/watch.js +2 -0
- package/package.json +23 -16
- package/dist/_dev.cjs +0 -2
- package/dist/_dev.cjs.map +0 -1
- package/dist/_dev.d.ts +0 -2
- package/dist/_dev.d.ts.map +0 -1
- package/dist/_dev.js +0 -9
- package/dist/_dev.js.map +0 -1
- package/dist/_error-utils.cjs +0 -2
- package/dist/_error-utils.cjs.map +0 -1
- package/dist/_error-utils.d.ts +0 -24
- package/dist/_error-utils.d.ts.map +0 -1
- package/dist/_error-utils.js +0 -20
- package/dist/_error-utils.js.map +0 -1
- package/dist/_virtual/_rolldown/runtime.js +0 -7
- package/dist/async-computed.cjs +0 -2
- package/dist/async-computed.cjs.map +0 -1
- package/dist/async-computed.d.ts +0 -36
- package/dist/async-computed.d.ts.map +0 -1
- package/dist/async-computed.js +0 -58
- package/dist/async-computed.js.map +0 -1
- package/dist/computed.cjs +0 -2
- package/dist/computed.cjs.map +0 -1
- package/dist/computed.d.ts +0 -26
- package/dist/computed.d.ts.map +0 -1
- package/dist/computed.js +0 -113
- package/dist/computed.js.map +0 -1
- package/dist/devtools-hook.cjs +0 -2
- package/dist/devtools-hook.cjs.map +0 -1
- package/dist/devtools-hook.d.ts +0 -4
- package/dist/devtools-hook.d.ts.map +0 -1
- package/dist/devtools-hook.js +0 -8
- package/dist/devtools-hook.js.map +0 -1
- package/dist/devtools.d.ts +0 -50
- package/dist/devtools.d.ts.map +0 -1
- package/dist/effect.cjs +0 -2
- package/dist/effect.cjs.map +0 -1
- package/dist/effect.d.ts +0 -104
- package/dist/effect.d.ts.map +0 -1
- package/dist/effect.js +0 -173
- package/dist/effect.js.map +0 -1
- package/dist/reactive-base.cjs +0 -2
- package/dist/reactive-base.cjs.map +0 -1
- package/dist/reactive-base.d.ts +0 -60
- package/dist/reactive-base.d.ts.map +0 -1
- package/dist/reactive-base.js +0 -56
- package/dist/reactive-base.js.map +0 -1
- package/dist/scheduling.cjs +0 -2
- package/dist/scheduling.cjs.map +0 -1
- package/dist/scheduling.d.ts +0 -5
- package/dist/scheduling.d.ts.map +0 -1
- package/dist/scheduling.js +0 -57
- package/dist/scheduling.js.map +0 -1
- package/dist/signal.cjs +0 -2
- package/dist/signal.cjs.map +0 -1
- package/dist/signal.d.ts +0 -24
- package/dist/signal.d.ts.map +0 -1
- package/dist/signal.js +0 -54
- package/dist/signal.js.map +0 -1
- package/dist/src/devtools.cjs +0 -2
- package/dist/src/devtools.cjs.map +0 -1
- package/dist/src/devtools.js +0 -36
- package/dist/src/devtools.js.map +0 -1
- package/dist/src/ssr/index.cjs +0 -2
- package/dist/src/ssr/index.cjs.map +0 -1
- package/dist/src/ssr/index.js +0 -38
- package/dist/src/ssr/index.js.map +0 -1
- package/dist/ssr/index.d.ts +0 -56
- package/dist/ssr/index.d.ts.map +0 -1
- package/dist/store-history.cjs +0 -2
- package/dist/store-history.cjs.map +0 -1
- package/dist/store-history.d.ts +0 -42
- package/dist/store-history.d.ts.map +0 -1
- package/dist/store-history.js +0 -60
- package/dist/store-history.js.map +0 -1
- package/dist/store.cjs.map +0 -1
- package/dist/store.js.map +0 -1
- package/dist/subscription.cjs +0 -2
- package/dist/subscription.cjs.map +0 -1
- package/dist/subscription.d.ts +0 -22
- package/dist/subscription.d.ts.map +0 -1
- package/dist/subscription.js +0 -47
- package/dist/subscription.js.map +0 -1
- package/dist/symbols.cjs +0 -2
- package/dist/symbols.cjs.map +0 -1
- package/dist/symbols.d.ts +0 -6
- package/dist/symbols.d.ts.map +0 -1
- package/dist/symbols.js +0 -6
- package/dist/symbols.js.map +0 -1
- package/dist/tracking.cjs +0 -2
- package/dist/tracking.cjs.map +0 -1
- package/dist/tracking.d.ts +0 -82
- package/dist/tracking.d.ts.map +0 -1
- package/dist/tracking.js +0 -76
- package/dist/tracking.js.map +0 -1
- package/dist/utilities.cjs +0 -2
- package/dist/utilities.cjs.map +0 -1
- package/dist/utilities.d.ts +0 -56
- package/dist/utilities.d.ts.map +0 -1
- package/dist/utilities.js +0 -25
- package/dist/utilities.js.map +0 -1
package/README.md
CHANGED
|
@@ -1,101 +1,63 @@
|
|
|
1
1
|
# @vielzeug/ripple
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
[](https://www.npmjs.com/package/@vielzeug/ripple) [](https://opensource.org/licenses/MIT)
|
|
6
|
-
|
|
7
|
-
<details>
|
|
8
|
-
<summary>Quick Reference</summary>
|
|
9
|
-
|
|
10
|
-
**Package:** `@vielzeug/ripple` · **Category:** State
|
|
11
|
-
|
|
12
|
-
**Key exports:** `signal`, `computed`, `effect`, `effectAsync`, `resource`, `watch`, `batch`, `store`, `storeWithHistory`, `untrack`, `scope`, `onCleanup`, `readonly`, `isSignal`, `isComputed`, `isStore`
|
|
13
|
-
|
|
14
|
-
**When to use:** Fine-grained reactivity without a framework. Powers Ore templates. Works in any TS/JS environment including Node, Deno, and SSR.
|
|
15
|
-
|
|
16
|
-
**Related:** [@vielzeug/ore](https://vielzeug.dev/ore/) · [@vielzeug/forge](https://vielzeug.dev/forge/) · [@vielzeug/herald](https://vielzeug.dev/herald/)
|
|
17
|
-
|
|
18
|
-
</details>
|
|
19
|
-
|
|
20
|
-
`@vielzeug/ripple` is part of Vielzeug and ships as a zero-dependency TypeScript package with ESM+CJS output.
|
|
3
|
+
Framework-agnostic reactive graphs. Zero dependencies. ESM and CJS.
|
|
21
4
|
|
|
22
5
|
## Installation
|
|
23
6
|
|
|
24
7
|
```sh
|
|
25
|
-
# pnpm
|
|
26
8
|
pnpm add @vielzeug/ripple
|
|
27
|
-
# npm
|
|
28
|
-
npm install @vielzeug/ripple
|
|
29
|
-
# yarn
|
|
30
|
-
yarn add @vielzeug/ripple
|
|
31
9
|
```
|
|
32
10
|
|
|
33
|
-
##
|
|
34
|
-
|
|
35
|
-
| Import | Purpose |
|
|
36
|
-
| --------------------------- | ------------------------------------------------------------------------ |
|
|
37
|
-
| `@vielzeug/ripple` | Core primitives and types |
|
|
38
|
-
| `@vielzeug/ripple/devtools` | `installDevTools`, `debugEffect` — dev-only, tree-shaken from production |
|
|
39
|
-
| `@vielzeug/ripple/ssr` | SSR tracking isolation helpers (`setTrackingProvider`, `createAsyncProvider`, `withProvider`, `runWithProvider`). Node.js only — do not import in browser builds. |
|
|
40
|
-
|
|
41
|
-
## Quick Start
|
|
11
|
+
## Reactive graph
|
|
42
12
|
|
|
43
13
|
```ts
|
|
44
|
-
import {
|
|
14
|
+
import { createRipple } from '@vielzeug/ripple';
|
|
45
15
|
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
const sub = effect(() => {
|
|
51
|
-
console.log('doubled:', doubled.value); // re-runs when count changes
|
|
16
|
+
const ripple = createRipple({
|
|
17
|
+
onError(error, context) {
|
|
18
|
+
console.error(context.kind, error);
|
|
19
|
+
},
|
|
52
20
|
});
|
|
53
21
|
|
|
54
|
-
count
|
|
55
|
-
|
|
56
|
-
|
|
22
|
+
const count = ripple.signal(0);
|
|
23
|
+
const doubled = ripple.computed(() => count.value * 2);
|
|
24
|
+
const stop = ripple.effect(() => console.log(doubled.value));
|
|
57
25
|
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
26
|
+
ripple.batch(() => {
|
|
27
|
+
count.value = 1;
|
|
28
|
+
count.value = 2;
|
|
29
|
+
});
|
|
61
30
|
|
|
62
|
-
|
|
63
|
-
|
|
31
|
+
stop.dispose();
|
|
32
|
+
ripple.dispose();
|
|
33
|
+
```
|
|
64
34
|
|
|
65
|
-
|
|
66
|
-
cart.reset();
|
|
35
|
+
Use default exports (`signal`, `computed`, `effect`, `batch`) only when application has one graph for full lifetime.
|
|
67
36
|
|
|
68
|
-
|
|
69
|
-
const stop = effect(() => console.log('items:', items.value), { scheduler: 'microtask', name: 'cart-logger' });
|
|
70
|
-
stop.dispose();
|
|
37
|
+
## Bound helpers
|
|
71
38
|
|
|
72
|
-
|
|
73
|
-
import { resource } from '@vielzeug/ripple';
|
|
39
|
+
Every `Ripple` instance provides bound helpers:
|
|
74
40
|
|
|
75
|
-
|
|
76
|
-
const
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
// userState.value → { status: 'loading' | 'ready' | 'error', data, error }
|
|
41
|
+
```ts
|
|
42
|
+
const user = ripple.resource(() => userId.value, loadUser);
|
|
43
|
+
const cart = ripple.createStore({ items: 0 });
|
|
44
|
+
const stop = ripple.watch(() => cart.value.items, renderItems);
|
|
45
|
+
```
|
|
81
46
|
|
|
82
|
-
|
|
83
|
-
import { storeWithHistory } from '@vielzeug/ripple';
|
|
47
|
+
Nested effects and resources created inside an effect automatically dispose before parent effect reruns:
|
|
84
48
|
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
editor.redo(); // forward to 'hello world'
|
|
49
|
+
```ts
|
|
50
|
+
ripple.effect(() => {
|
|
51
|
+
ripple.effect(() => render())
|
|
52
|
+
})
|
|
90
53
|
```
|
|
91
54
|
|
|
92
55
|
## Documentation
|
|
93
56
|
|
|
94
57
|
- [Overview](https://vielzeug.dev/ripple/)
|
|
95
|
-
- [Usage
|
|
96
|
-
- [API
|
|
97
|
-
- [Examples](https://vielzeug.dev/ripple/examples)
|
|
58
|
+
- [Usage guide](https://vielzeug.dev/ripple/usage)
|
|
59
|
+
- [API reference](https://vielzeug.dev/ripple/api)
|
|
98
60
|
|
|
99
61
|
## License
|
|
100
62
|
|
|
101
|
-
MIT ©
|
|
63
|
+
MIT © Helmuth Saatkamp
|
package/dist/_async.cjs
ADDED
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
var e=e=>(t,n,r)=>{let i=e.signal({status:`pending`},{name:r?.name}),a=e.signal(0),o=new AbortController,s,c=!1,l=()=>{a.value,s?.abort();let e=i.peek(),r=e.status===`success`?e.value:`previous`in e?e.previous:void 0,o;try{o=t()}catch(e){i.value=r===void 0?{error:e,status:`error`}:{error:e,previous:r,status:`error`};return}let l=new AbortController;s=l,i.value=r===void 0?{status:`pending`}:{previous:r,status:`pending`};let u;try{u=Promise.resolve(n(o,{signal:l.signal}))}catch(e){u=Promise.reject(e)}u.then(e=>{!c&&!l.signal.aborted&&(i.value={status:`success`,value:e})},e=>{!c&&!l.signal.aborted&&(i.value=r===void 0?{error:e,status:`error`}:{error:e,previous:r,status:`error`})})},u=e.effect(()=>(l(),()=>s?.abort()),{name:r?.name});return u.disposalSignal.addEventListener(`abort`,()=>{c=!0,o.abort()},{once:!0}),{get disposalSignal(){return o.signal},dispose:()=>u.dispose(),get disposed(){return c},get name(){return i.name},peek:()=>i.peek(),reload:()=>{c||(a.value=a.peek()+1)},subscribe:e=>i.subscribe(e),[Symbol.dispose](){this.dispose()},get value(){return i.value}}};exports.createResource=e;
|
|
2
|
+
//# sourceMappingURL=_async.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"_async.cjs","names":[],"sources":["../src/_async.ts"],"sourcesContent":["import type { EffectHandle, Signal } from './types';\n\nexport type AsyncState<T> =\n | { readonly previous?: T; readonly status: 'pending' }\n | { readonly status: 'success'; readonly value: T }\n | { readonly error: unknown; readonly previous?: T; readonly status: 'error' };\n\nexport type Resource<T> = {\n [Symbol.dispose](): void;\n readonly disposalSignal: AbortSignal;\n dispose(): void;\n readonly disposed: boolean;\n readonly name?: string;\n peek(): AsyncState<T>;\n reload(): void;\n subscribe(listener: () => void): () => void;\n readonly value: AsyncState<T>;\n};\n\nexport type ResourceOptions = {\n name?: string;\n};\n\ntype AsyncRuntime = {\n effect(callback: () => void | (() => void), options?: { name?: string }): EffectHandle;\n signal<T>(initial: T, options?: { name?: string }): Signal<T>;\n};\n\n/** Resource only depends on primitive runtime methods; graph binding stays private. */\nexport const createResource =\n (runtime: AsyncRuntime) =>\n <Source, Value>(\n source: () => Source,\n loader: (source: Source, context: { readonly signal: AbortSignal }) => Promise<Value>,\n options?: ResourceOptions,\n ): Resource<Value> => {\n const state = runtime.signal<AsyncState<Value>>({ status: 'pending' }, { name: options?.name });\n const reloadEpoch = runtime.signal(0);\n const controller = new AbortController();\n let active: AbortController | undefined;\n let disposed = false;\n\n const run = (): void => {\n void reloadEpoch.value;\n active?.abort();\n\n const current = state.peek();\n const previous =\n current.status === 'success' ? current.value : 'previous' in current ? current.previous : undefined;\n let input: Source;\n\n try {\n input = source();\n } catch (error) {\n state.value = previous === undefined ? { error, status: 'error' } : { error, previous, status: 'error' };\n\n return;\n }\n\n const next = new AbortController();\n\n active = next;\n state.value = previous === undefined ? { status: 'pending' } : { previous, status: 'pending' };\n\n let request: Promise<Value>;\n\n try {\n request = Promise.resolve(loader(input, { signal: next.signal }));\n } catch (error) {\n request = Promise.reject(error);\n }\n\n void request.then(\n (value) => {\n if (!disposed && !next.signal.aborted) state.value = { status: 'success', value };\n },\n (error: unknown) => {\n if (!disposed && !next.signal.aborted) {\n state.value = previous === undefined ? { error, status: 'error' } : { error, previous, status: 'error' };\n }\n },\n );\n };\n\n const stop = runtime.effect(\n () => {\n run();\n\n return () => active?.abort();\n },\n { name: options?.name },\n );\n\n stop.disposalSignal.addEventListener(\n 'abort',\n () => {\n disposed = true;\n controller.abort();\n },\n { once: true },\n );\n\n return {\n get disposalSignal() {\n return controller.signal;\n },\n dispose: () => stop.dispose(),\n get disposed() {\n return disposed;\n },\n get name() {\n return state.name;\n },\n peek: () => state.peek(),\n reload: () => {\n if (disposed) return;\n\n reloadEpoch.value = reloadEpoch.peek() + 1;\n },\n subscribe: (listener) => state.subscribe(listener),\n [Symbol.dispose]() {\n this.dispose();\n },\n get value() {\n return state.value;\n },\n };\n };\n"],"mappings":"AA6BA,IAAa,EACV,IAEC,EACA,EACA,IACoB,CACpB,IAAM,EAAQ,EAAQ,OAA0B,CAAE,OAAQ,SAAU,EAAG,CAAE,KAAM,GAAS,IAAK,CAAC,EACxF,EAAc,EAAQ,OAAO,CAAC,EAC9B,EAAa,IAAI,gBACnB,EACA,EAAW,GAET,MAAkB,CACtB,EAAiB,MACjB,GAAQ,MAAM,EAEd,IAAM,EAAU,EAAM,KAAK,EACrB,EACJ,EAAQ,SAAW,UAAY,EAAQ,MAAQ,aAAc,EAAU,EAAQ,SAAW,IAAA,GACxF,EAEJ,GAAI,CACF,EAAQ,EAAO,CACjB,OAAS,EAAO,CACd,EAAM,MAAQ,IAAa,IAAA,GAAY,CAAE,QAAO,OAAQ,OAAQ,EAAI,CAAE,QAAO,WAAU,OAAQ,OAAQ,EAEvG,MACF,CAEA,IAAM,EAAO,IAAI,gBAEjB,EAAS,EACT,EAAM,MAAQ,IAAa,IAAA,GAAY,CAAE,OAAQ,SAAU,EAAI,CAAE,WAAU,OAAQ,SAAU,EAE7F,IAAI,EAEJ,GAAI,CACF,EAAU,QAAQ,QAAQ,EAAO,EAAO,CAAE,OAAQ,EAAK,MAAO,CAAC,CAAC,CAClE,OAAS,EAAO,CACd,EAAU,QAAQ,OAAO,CAAK,CAChC,CAEA,EAAa,KACV,GAAU,CACL,CAAC,GAAY,CAAC,EAAK,OAAO,UAAS,EAAM,MAAQ,CAAE,OAAQ,UAAW,OAAM,EAClF,EACC,GAAmB,CACd,CAAC,GAAY,CAAC,EAAK,OAAO,UAC5B,EAAM,MAAQ,IAAa,IAAA,GAAY,CAAE,QAAO,OAAQ,OAAQ,EAAI,CAAE,QAAO,WAAU,OAAQ,OAAQ,EAE3G,CACF,CACF,EAEM,EAAO,EAAQ,YAEjB,EAAI,MAES,GAAQ,MAAM,GAE7B,CAAE,KAAM,GAAS,IAAK,CACxB,EAWA,OATA,EAAK,eAAe,iBAClB,YACM,CACJ,EAAW,GACX,EAAW,MAAM,CACnB,EACA,CAAE,KAAM,EAAK,CACf,EAEO,CACL,IAAI,gBAAiB,CACnB,OAAO,EAAW,MACpB,EACA,YAAe,EAAK,QAAQ,EAC5B,IAAI,UAAW,CACb,OAAO,CACT,EACA,IAAI,MAAO,CACT,OAAO,EAAM,IACf,EACA,SAAY,EAAM,KAAK,EACvB,WAAc,CACR,IAEJ,EAAY,MAAQ,EAAY,KAAK,EAAI,EAC3C,EACA,UAAY,GAAa,EAAM,UAAU,CAAQ,EACjD,CAAC,OAAO,UAAW,CACjB,KAAK,QAAQ,CACf,EACA,IAAI,OAAQ,CACV,OAAO,EAAM,KACf,CACF,CACF"}
|
package/dist/_async.d.ts
ADDED
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import type { EffectHandle, Signal } from './types';
|
|
2
|
+
export type AsyncState<T> = {
|
|
3
|
+
readonly previous?: T;
|
|
4
|
+
readonly status: 'pending';
|
|
5
|
+
} | {
|
|
6
|
+
readonly status: 'success';
|
|
7
|
+
readonly value: T;
|
|
8
|
+
} | {
|
|
9
|
+
readonly error: unknown;
|
|
10
|
+
readonly previous?: T;
|
|
11
|
+
readonly status: 'error';
|
|
12
|
+
};
|
|
13
|
+
export type Resource<T> = {
|
|
14
|
+
[Symbol.dispose](): void;
|
|
15
|
+
readonly disposalSignal: AbortSignal;
|
|
16
|
+
dispose(): void;
|
|
17
|
+
readonly disposed: boolean;
|
|
18
|
+
readonly name?: string;
|
|
19
|
+
peek(): AsyncState<T>;
|
|
20
|
+
reload(): void;
|
|
21
|
+
subscribe(listener: () => void): () => void;
|
|
22
|
+
readonly value: AsyncState<T>;
|
|
23
|
+
};
|
|
24
|
+
export type ResourceOptions = {
|
|
25
|
+
name?: string;
|
|
26
|
+
};
|
|
27
|
+
type AsyncRuntime = {
|
|
28
|
+
effect(callback: () => void | (() => void), options?: {
|
|
29
|
+
name?: string;
|
|
30
|
+
}): EffectHandle;
|
|
31
|
+
signal<T>(initial: T, options?: {
|
|
32
|
+
name?: string;
|
|
33
|
+
}): Signal<T>;
|
|
34
|
+
};
|
|
35
|
+
/** Resource only depends on primitive runtime methods; graph binding stays private. */
|
|
36
|
+
export declare const createResource: (runtime: AsyncRuntime) => <Source, Value>(source: () => Source, loader: (source: Source, context: {
|
|
37
|
+
readonly signal: AbortSignal;
|
|
38
|
+
}) => Promise<Value>, options?: ResourceOptions) => Resource<Value>;
|
|
39
|
+
export {};
|
|
40
|
+
//# sourceMappingURL=_async.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"_async.d.ts","sourceRoot":"","sources":["../src/_async.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,EAAE,MAAM,SAAS,CAAC;AAEpD,MAAM,MAAM,UAAU,CAAC,CAAC,IACpB;IAAE,QAAQ,CAAC,QAAQ,CAAC,EAAE,CAAC,CAAC;IAAC,QAAQ,CAAC,MAAM,EAAE,SAAS,CAAA;CAAE,GACrD;IAAE,QAAQ,CAAC,MAAM,EAAE,SAAS,CAAC;IAAC,QAAQ,CAAC,KAAK,EAAE,CAAC,CAAA;CAAE,GACjD;IAAE,QAAQ,CAAC,KAAK,EAAE,OAAO,CAAC;IAAC,QAAQ,CAAC,QAAQ,CAAC,EAAE,CAAC,CAAC;IAAC,QAAQ,CAAC,MAAM,EAAE,OAAO,CAAA;CAAE,CAAC;AAEjF,MAAM,MAAM,QAAQ,CAAC,CAAC,IAAI;IACxB,CAAC,MAAM,CAAC,OAAO,CAAC,IAAI,IAAI,CAAC;IACzB,QAAQ,CAAC,cAAc,EAAE,WAAW,CAAC;IACrC,OAAO,IAAI,IAAI,CAAC;IAChB,QAAQ,CAAC,QAAQ,EAAE,OAAO,CAAC;IAC3B,QAAQ,CAAC,IAAI,CAAC,EAAE,MAAM,CAAC;IACvB,IAAI,IAAI,UAAU,CAAC,CAAC,CAAC,CAAC;IACtB,MAAM,IAAI,IAAI,CAAC;IACf,SAAS,CAAC,QAAQ,EAAE,MAAM,IAAI,GAAG,MAAM,IAAI,CAAC;IAC5C,QAAQ,CAAC,KAAK,EAAE,UAAU,CAAC,CAAC,CAAC,CAAC;CAC/B,CAAC;AAEF,MAAM,MAAM,eAAe,GAAG;IAC5B,IAAI,CAAC,EAAE,MAAM,CAAC;CACf,CAAC;AAEF,KAAK,YAAY,GAAG;IAClB,MAAM,CAAC,QAAQ,EAAE,MAAM,IAAI,GAAG,CAAC,MAAM,IAAI,CAAC,EAAE,OAAO,CAAC,EAAE;QAAE,IAAI,CAAC,EAAE,MAAM,CAAA;KAAE,GAAG,YAAY,CAAC;IACvF,MAAM,CAAC,CAAC,EAAE,OAAO,EAAE,CAAC,EAAE,OAAO,CAAC,EAAE;QAAE,IAAI,CAAC,EAAE,MAAM,CAAA;KAAE,GAAG,MAAM,CAAC,CAAC,CAAC,CAAC;CAC/D,CAAC;AAEF,uFAAuF;AACvF,eAAO,MAAM,cAAc,GACxB,SAAS,YAAY,MACrB,MAAM,EAAE,KAAK,EACZ,QAAQ,MAAM,MAAM,EACpB,QAAQ,CAAC,MAAM,EAAE,MAAM,EAAE,OAAO,EAAE;IAAE,QAAQ,CAAC,MAAM,EAAE,WAAW,CAAA;CAAE,KAAK,OAAO,CAAC,KAAK,CAAC,EACrF,UAAU,eAAe,KACxB,QAAQ,CAAC,KAAK,CA4FhB,CAAC"}
|
package/dist/_async.js
ADDED
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
//#region src/_async.ts
|
|
2
|
+
var e = (e) => (t, n, r) => {
|
|
3
|
+
let i = e.signal({ status: "pending" }, { name: r?.name }), a = e.signal(0), o = new AbortController(), s, c = !1, l = () => {
|
|
4
|
+
a.value, s?.abort();
|
|
5
|
+
let e = i.peek(), r = e.status === "success" ? e.value : "previous" in e ? e.previous : void 0, o;
|
|
6
|
+
try {
|
|
7
|
+
o = t();
|
|
8
|
+
} catch (e) {
|
|
9
|
+
i.value = r === void 0 ? {
|
|
10
|
+
error: e,
|
|
11
|
+
status: "error"
|
|
12
|
+
} : {
|
|
13
|
+
error: e,
|
|
14
|
+
previous: r,
|
|
15
|
+
status: "error"
|
|
16
|
+
};
|
|
17
|
+
return;
|
|
18
|
+
}
|
|
19
|
+
let l = new AbortController();
|
|
20
|
+
s = l, i.value = r === void 0 ? { status: "pending" } : {
|
|
21
|
+
previous: r,
|
|
22
|
+
status: "pending"
|
|
23
|
+
};
|
|
24
|
+
let u;
|
|
25
|
+
try {
|
|
26
|
+
u = Promise.resolve(n(o, { signal: l.signal }));
|
|
27
|
+
} catch (e) {
|
|
28
|
+
u = Promise.reject(e);
|
|
29
|
+
}
|
|
30
|
+
u.then((e) => {
|
|
31
|
+
!c && !l.signal.aborted && (i.value = {
|
|
32
|
+
status: "success",
|
|
33
|
+
value: e
|
|
34
|
+
});
|
|
35
|
+
}, (e) => {
|
|
36
|
+
!c && !l.signal.aborted && (i.value = r === void 0 ? {
|
|
37
|
+
error: e,
|
|
38
|
+
status: "error"
|
|
39
|
+
} : {
|
|
40
|
+
error: e,
|
|
41
|
+
previous: r,
|
|
42
|
+
status: "error"
|
|
43
|
+
});
|
|
44
|
+
});
|
|
45
|
+
}, u = e.effect(() => (l(), () => s?.abort()), { name: r?.name });
|
|
46
|
+
return u.disposalSignal.addEventListener("abort", () => {
|
|
47
|
+
c = !0, o.abort();
|
|
48
|
+
}, { once: !0 }), {
|
|
49
|
+
get disposalSignal() {
|
|
50
|
+
return o.signal;
|
|
51
|
+
},
|
|
52
|
+
dispose: () => u.dispose(),
|
|
53
|
+
get disposed() {
|
|
54
|
+
return c;
|
|
55
|
+
},
|
|
56
|
+
get name() {
|
|
57
|
+
return i.name;
|
|
58
|
+
},
|
|
59
|
+
peek: () => i.peek(),
|
|
60
|
+
reload: () => {
|
|
61
|
+
c || (a.value = a.peek() + 1);
|
|
62
|
+
},
|
|
63
|
+
subscribe: (e) => i.subscribe(e),
|
|
64
|
+
[Symbol.dispose]() {
|
|
65
|
+
this.dispose();
|
|
66
|
+
},
|
|
67
|
+
get value() {
|
|
68
|
+
return i.value;
|
|
69
|
+
}
|
|
70
|
+
};
|
|
71
|
+
};
|
|
72
|
+
//#endregion
|
|
73
|
+
export { e as createResource };
|
|
74
|
+
|
|
75
|
+
//# sourceMappingURL=_async.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"_async.js","names":[],"sources":["../src/_async.ts"],"sourcesContent":["import type { EffectHandle, Signal } from './types';\n\nexport type AsyncState<T> =\n | { readonly previous?: T; readonly status: 'pending' }\n | { readonly status: 'success'; readonly value: T }\n | { readonly error: unknown; readonly previous?: T; readonly status: 'error' };\n\nexport type Resource<T> = {\n [Symbol.dispose](): void;\n readonly disposalSignal: AbortSignal;\n dispose(): void;\n readonly disposed: boolean;\n readonly name?: string;\n peek(): AsyncState<T>;\n reload(): void;\n subscribe(listener: () => void): () => void;\n readonly value: AsyncState<T>;\n};\n\nexport type ResourceOptions = {\n name?: string;\n};\n\ntype AsyncRuntime = {\n effect(callback: () => void | (() => void), options?: { name?: string }): EffectHandle;\n signal<T>(initial: T, options?: { name?: string }): Signal<T>;\n};\n\n/** Resource only depends on primitive runtime methods; graph binding stays private. */\nexport const createResource =\n (runtime: AsyncRuntime) =>\n <Source, Value>(\n source: () => Source,\n loader: (source: Source, context: { readonly signal: AbortSignal }) => Promise<Value>,\n options?: ResourceOptions,\n ): Resource<Value> => {\n const state = runtime.signal<AsyncState<Value>>({ status: 'pending' }, { name: options?.name });\n const reloadEpoch = runtime.signal(0);\n const controller = new AbortController();\n let active: AbortController | undefined;\n let disposed = false;\n\n const run = (): void => {\n void reloadEpoch.value;\n active?.abort();\n\n const current = state.peek();\n const previous =\n current.status === 'success' ? current.value : 'previous' in current ? current.previous : undefined;\n let input: Source;\n\n try {\n input = source();\n } catch (error) {\n state.value = previous === undefined ? { error, status: 'error' } : { error, previous, status: 'error' };\n\n return;\n }\n\n const next = new AbortController();\n\n active = next;\n state.value = previous === undefined ? { status: 'pending' } : { previous, status: 'pending' };\n\n let request: Promise<Value>;\n\n try {\n request = Promise.resolve(loader(input, { signal: next.signal }));\n } catch (error) {\n request = Promise.reject(error);\n }\n\n void request.then(\n (value) => {\n if (!disposed && !next.signal.aborted) state.value = { status: 'success', value };\n },\n (error: unknown) => {\n if (!disposed && !next.signal.aborted) {\n state.value = previous === undefined ? { error, status: 'error' } : { error, previous, status: 'error' };\n }\n },\n );\n };\n\n const stop = runtime.effect(\n () => {\n run();\n\n return () => active?.abort();\n },\n { name: options?.name },\n );\n\n stop.disposalSignal.addEventListener(\n 'abort',\n () => {\n disposed = true;\n controller.abort();\n },\n { once: true },\n );\n\n return {\n get disposalSignal() {\n return controller.signal;\n },\n dispose: () => stop.dispose(),\n get disposed() {\n return disposed;\n },\n get name() {\n return state.name;\n },\n peek: () => state.peek(),\n reload: () => {\n if (disposed) return;\n\n reloadEpoch.value = reloadEpoch.peek() + 1;\n },\n subscribe: (listener) => state.subscribe(listener),\n [Symbol.dispose]() {\n this.dispose();\n },\n get value() {\n return state.value;\n },\n };\n };\n"],"mappings":";AA6BA,IAAa,KACV,OAEC,GACA,GACA,MACoB;CACpB,IAAM,IAAQ,EAAQ,OAA0B,EAAE,QAAQ,UAAU,GAAG,EAAE,MAAM,GAAS,KAAK,CAAC,GACxF,IAAc,EAAQ,OAAO,CAAC,GAC9B,IAAa,IAAI,gBAAgB,GACnC,GACA,IAAW,IAET,UAAkB;EAEtB,AADA,EAAiB,OACjB,GAAQ,MAAM;EAEd,IAAM,IAAU,EAAM,KAAK,GACrB,IACJ,EAAQ,WAAW,YAAY,EAAQ,QAAQ,cAAc,IAAU,EAAQ,WAAW,KAAA,GACxF;EAEJ,IAAI;GACF,IAAQ,EAAO;EACjB,SAAS,GAAO;GACd,EAAM,QAAQ,MAAa,KAAA,IAAY;IAAE;IAAO,QAAQ;GAAQ,IAAI;IAAE;IAAO;IAAU,QAAQ;GAAQ;GAEvG;EACF;EAEA,IAAM,IAAO,IAAI,gBAAgB;EAGjC,AADA,IAAS,GACT,EAAM,QAAQ,MAAa,KAAA,IAAY,EAAE,QAAQ,UAAU,IAAI;GAAE;GAAU,QAAQ;EAAU;EAE7F,IAAI;EAEJ,IAAI;GACF,IAAU,QAAQ,QAAQ,EAAO,GAAO,EAAE,QAAQ,EAAK,OAAO,CAAC,CAAC;EAClE,SAAS,GAAO;GACd,IAAU,QAAQ,OAAO,CAAK;EAChC;EAEA,EAAa,MACV,MAAU;GACT,AAAI,CAAC,KAAY,CAAC,EAAK,OAAO,YAAS,EAAM,QAAQ;IAAE,QAAQ;IAAW;GAAM;EAClF,IACC,MAAmB;GAClB,AAAI,CAAC,KAAY,CAAC,EAAK,OAAO,YAC5B,EAAM,QAAQ,MAAa,KAAA,IAAY;IAAE;IAAO,QAAQ;GAAQ,IAAI;IAAE;IAAO;IAAU,QAAQ;GAAQ;EAE3G,CACF;CACF,GAEM,IAAO,EAAQ,cAEjB,EAAI,SAES,GAAQ,MAAM,IAE7B,EAAE,MAAM,GAAS,KAAK,CACxB;CAWA,OATA,EAAK,eAAe,iBAClB,eACM;EAEJ,AADA,IAAW,IACX,EAAW,MAAM;CACnB,GACA,EAAE,MAAM,GAAK,CACf,GAEO;EACL,IAAI,iBAAiB;GACnB,OAAO,EAAW;EACpB;EACA,eAAe,EAAK,QAAQ;EAC5B,IAAI,WAAW;GACb,OAAO;EACT;EACA,IAAI,OAAO;GACT,OAAO,EAAM;EACf;EACA,YAAY,EAAM,KAAK;EACvB,cAAc;GACR,MAEJ,EAAY,QAAQ,EAAY,KAAK,IAAI;EAC3C;EACA,YAAY,MAAa,EAAM,UAAU,CAAQ;EACjD,CAAC,OAAO,WAAW;GACjB,KAAK,QAAQ;EACf;EACA,IAAI,QAAQ;GACV,OAAO,EAAM;EACf;CACF;AACF"}
|
package/dist/_store.cjs
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"_store.cjs","names":[],"sources":["../src/_store.ts"],"sourcesContent":["import type { Signal } from './types';\n\nexport type Store<T> = {\n readonly name?: string;\n peek(): T;\n set(value: T): void;\n subscribe(listener: () => void): () => void;\n update(updater: (value: T) => T): void;\n readonly value: T;\n};\n\nexport type StoreOptions = {\n name?: string;\n};\n\ntype StoreRuntime = {\n signal<T>(initial: T, options?: { name?: string }): Signal<T>;\n};\n\nexport const createStore =\n (runtime: StoreRuntime) =>\n <T>(initial: T, options?: StoreOptions): Store<T> => {\n const state = runtime.signal(initial, { name: options?.name });\n\n return {\n get name() {\n return state.name;\n },\n peek: () => state.peek(),\n set: (value) => {\n state.value = value;\n },\n subscribe: (listener) => state.subscribe(listener),\n update: (updater) => {\n state.value = updater(state.peek());\n },\n get value() {\n return state.value;\n },\n };\n };\n"],"mappings":"AAmBA,IAAa,EACV,IACG,EAAY,IAAqC,CACnD,IAAM,EAAQ,EAAQ,OAAO,EAAS,CAAE,KAAM,GAAS,IAAK,CAAC,EAE7D,MAAO,CACL,IAAI,MAAO,CACT,OAAO,EAAM,IACf,EACA,SAAY,EAAM,KAAK,EACvB,IAAM,GAAU,CACd,EAAM,MAAQ,CAChB,EACA,UAAY,GAAa,EAAM,UAAU,CAAQ,EACjD,OAAS,GAAY,CACnB,EAAM,MAAQ,EAAQ,EAAM,KAAK,CAAC,CACpC,EACA,IAAI,OAAQ,CACV,OAAO,EAAM,KACf,CACF,CACF"}
|
package/dist/_store.d.ts
ADDED
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import type { Signal } from './types';
|
|
2
|
+
export type Store<T> = {
|
|
3
|
+
readonly name?: string;
|
|
4
|
+
peek(): T;
|
|
5
|
+
set(value: T): void;
|
|
6
|
+
subscribe(listener: () => void): () => void;
|
|
7
|
+
update(updater: (value: T) => T): void;
|
|
8
|
+
readonly value: T;
|
|
9
|
+
};
|
|
10
|
+
export type StoreOptions = {
|
|
11
|
+
name?: string;
|
|
12
|
+
};
|
|
13
|
+
type StoreRuntime = {
|
|
14
|
+
signal<T>(initial: T, options?: {
|
|
15
|
+
name?: string;
|
|
16
|
+
}): Signal<T>;
|
|
17
|
+
};
|
|
18
|
+
export declare const createStore: (runtime: StoreRuntime) => <T>(initial: T, options?: StoreOptions) => Store<T>;
|
|
19
|
+
export {};
|
|
20
|
+
//# sourceMappingURL=_store.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"_store.d.ts","sourceRoot":"","sources":["../src/_store.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,SAAS,CAAC;AAEtC,MAAM,MAAM,KAAK,CAAC,CAAC,IAAI;IACrB,QAAQ,CAAC,IAAI,CAAC,EAAE,MAAM,CAAC;IACvB,IAAI,IAAI,CAAC,CAAC;IACV,GAAG,CAAC,KAAK,EAAE,CAAC,GAAG,IAAI,CAAC;IACpB,SAAS,CAAC,QAAQ,EAAE,MAAM,IAAI,GAAG,MAAM,IAAI,CAAC;IAC5C,MAAM,CAAC,OAAO,EAAE,CAAC,KAAK,EAAE,CAAC,KAAK,CAAC,GAAG,IAAI,CAAC;IACvC,QAAQ,CAAC,KAAK,EAAE,CAAC,CAAC;CACnB,CAAC;AAEF,MAAM,MAAM,YAAY,GAAG;IACzB,IAAI,CAAC,EAAE,MAAM,CAAC;CACf,CAAC;AAEF,KAAK,YAAY,GAAG;IAClB,MAAM,CAAC,CAAC,EAAE,OAAO,EAAE,CAAC,EAAE,OAAO,CAAC,EAAE;QAAE,IAAI,CAAC,EAAE,MAAM,CAAA;KAAE,GAAG,MAAM,CAAC,CAAC,CAAC,CAAC;CAC/D,CAAC;AAEF,eAAO,MAAM,WAAW,GACrB,SAAS,YAAY,MACrB,CAAC,EAAE,SAAS,CAAC,EAAE,UAAU,YAAY,KAAG,KAAK,CAAC,CAAC,CAmB/C,CAAC"}
|
package/dist/_store.js
ADDED
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
//#region src/_store.ts
|
|
2
|
+
var e = (e) => (t, n) => {
|
|
3
|
+
let r = e.signal(t, { name: n?.name });
|
|
4
|
+
return {
|
|
5
|
+
get name() {
|
|
6
|
+
return r.name;
|
|
7
|
+
},
|
|
8
|
+
peek: () => r.peek(),
|
|
9
|
+
set: (e) => {
|
|
10
|
+
r.value = e;
|
|
11
|
+
},
|
|
12
|
+
subscribe: (e) => r.subscribe(e),
|
|
13
|
+
update: (e) => {
|
|
14
|
+
r.value = e(r.peek());
|
|
15
|
+
},
|
|
16
|
+
get value() {
|
|
17
|
+
return r.value;
|
|
18
|
+
}
|
|
19
|
+
};
|
|
20
|
+
};
|
|
21
|
+
//#endregion
|
|
22
|
+
export { e as createStore };
|
|
23
|
+
|
|
24
|
+
//# sourceMappingURL=_store.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"_store.js","names":[],"sources":["../src/_store.ts"],"sourcesContent":["import type { Signal } from './types';\n\nexport type Store<T> = {\n readonly name?: string;\n peek(): T;\n set(value: T): void;\n subscribe(listener: () => void): () => void;\n update(updater: (value: T) => T): void;\n readonly value: T;\n};\n\nexport type StoreOptions = {\n name?: string;\n};\n\ntype StoreRuntime = {\n signal<T>(initial: T, options?: { name?: string }): Signal<T>;\n};\n\nexport const createStore =\n (runtime: StoreRuntime) =>\n <T>(initial: T, options?: StoreOptions): Store<T> => {\n const state = runtime.signal(initial, { name: options?.name });\n\n return {\n get name() {\n return state.name;\n },\n peek: () => state.peek(),\n set: (value) => {\n state.value = value;\n },\n subscribe: (listener) => state.subscribe(listener),\n update: (updater) => {\n state.value = updater(state.peek());\n },\n get value() {\n return state.value;\n },\n };\n };\n"],"mappings":";AAmBA,IAAa,KACV,OACG,GAAY,MAAqC;CACnD,IAAM,IAAQ,EAAQ,OAAO,GAAS,EAAE,MAAM,GAAS,KAAK,CAAC;CAE7D,OAAO;EACL,IAAI,OAAO;GACT,OAAO,EAAM;EACf;EACA,YAAY,EAAM,KAAK;EACvB,MAAM,MAAU;GACd,EAAM,QAAQ;EAChB;EACA,YAAY,MAAa,EAAM,UAAU,CAAQ;EACjD,SAAS,MAAY;GACnB,EAAM,QAAQ,EAAQ,EAAM,KAAK,CAAC;EACpC;EACA,IAAI,QAAQ;GACV,OAAO,EAAM;EACf;CACF;AACF"}
|
package/dist/_watch.cjs
ADDED
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
var e=e=>(t,n,r)=>{let i=typeof t==`function`?t:()=>t.value,a=r?.equals??Object.is,o=!0,s,c=!1,l=e.effect(()=>{let e=i();if(o){o=!1,s=e,r?.immediate&&n(e,void 0),c=r?.once===!0&&r.immediate===!0;return}if(a(s,e))return;let t=s;s=e,n(e,t),r?.once&&l.dispose()},{name:r?.name});return c&&l.dispose(),l};exports.createWatch=e;
|
|
2
|
+
//# sourceMappingURL=_watch.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"_watch.cjs","names":[],"sources":["../src/_watch.ts"],"sourcesContent":["import type { EffectHandle, Equality, Readable } from './types';\n\nexport type WatchOptions<T> = {\n equals?: Equality<T>;\n immediate?: boolean;\n name?: string;\n once?: boolean;\n};\n\ntype WatchRuntime = {\n effect(callback: () => void | (() => void), options?: { name?: string }): EffectHandle;\n};\n\nexport const createWatch =\n (runtime: WatchRuntime) =>\n <T>(\n source: Readable<T> | (() => T),\n callback: (value: T, previous: T | undefined) => void,\n options?: WatchOptions<T>,\n ): EffectHandle => {\n const read = typeof source === 'function' ? source : () => source.value;\n const equals = options?.equals ?? Object.is;\n let initial = true;\n let previous: T | undefined;\n let stopAfterInitialRun = false;\n\n const handle = runtime.effect(\n () => {\n const value = read();\n\n if (initial) {\n initial = false;\n previous = value;\n\n if (options?.immediate) callback(value, undefined);\n\n stopAfterInitialRun = options?.once === true && options.immediate === true;\n\n return;\n }\n\n if (equals(previous as T, value)) return;\n\n const oldValue = previous;\n\n previous = value;\n callback(value, oldValue);\n\n if (options?.once) handle.dispose();\n },\n { name: options?.name },\n );\n\n if (stopAfterInitialRun) handle.dispose();\n\n return handle;\n };\n"],"mappings":"AAaA,IAAa,EACV,IAEC,EACA,EACA,IACiB,CACjB,IAAM,EAAO,OAAO,GAAW,WAAa,MAAe,EAAO,MAC5D,EAAS,GAAS,QAAU,OAAO,GACrC,EAAU,GACV,EACA,EAAsB,GAEpB,EAAS,EAAQ,WACf,CACJ,IAAM,EAAQ,EAAK,EAEnB,GAAI,EAAS,CACX,EAAU,GACV,EAAW,EAEP,GAAS,WAAW,EAAS,EAAO,IAAA,EAAS,EAEjD,EAAsB,GAAS,OAAS,IAAQ,EAAQ,YAAc,GAEtE,MACF,CAEA,GAAI,EAAO,EAAe,CAAK,EAAG,OAElC,IAAM,EAAW,EAEjB,EAAW,EACX,EAAS,EAAO,CAAQ,EAEpB,GAAS,MAAM,EAAO,QAAQ,CACpC,EACA,CAAE,KAAM,GAAS,IAAK,CACxB,EAIA,OAFI,GAAqB,EAAO,QAAQ,EAEjC,CACT"}
|
package/dist/_watch.d.ts
ADDED
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import type { EffectHandle, Equality, Readable } from './types';
|
|
2
|
+
export type WatchOptions<T> = {
|
|
3
|
+
equals?: Equality<T>;
|
|
4
|
+
immediate?: boolean;
|
|
5
|
+
name?: string;
|
|
6
|
+
once?: boolean;
|
|
7
|
+
};
|
|
8
|
+
type WatchRuntime = {
|
|
9
|
+
effect(callback: () => void | (() => void), options?: {
|
|
10
|
+
name?: string;
|
|
11
|
+
}): EffectHandle;
|
|
12
|
+
};
|
|
13
|
+
export declare const createWatch: (runtime: WatchRuntime) => <T>(source: Readable<T> | (() => T), callback: (value: T, previous: T | undefined) => void, options?: WatchOptions<T>) => EffectHandle;
|
|
14
|
+
export {};
|
|
15
|
+
//# sourceMappingURL=_watch.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"_watch.d.ts","sourceRoot":"","sources":["../src/_watch.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,QAAQ,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAC;AAEhE,MAAM,MAAM,YAAY,CAAC,CAAC,IAAI;IAC5B,MAAM,CAAC,EAAE,QAAQ,CAAC,CAAC,CAAC,CAAC;IACrB,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,IAAI,CAAC,EAAE,OAAO,CAAC;CAChB,CAAC;AAEF,KAAK,YAAY,GAAG;IAClB,MAAM,CAAC,QAAQ,EAAE,MAAM,IAAI,GAAG,CAAC,MAAM,IAAI,CAAC,EAAE,OAAO,CAAC,EAAE;QAAE,IAAI,CAAC,EAAE,MAAM,CAAA;KAAE,GAAG,YAAY,CAAC;CACxF,CAAC;AAEF,eAAO,MAAM,WAAW,GACrB,SAAS,YAAY,MACrB,CAAC,EACA,QAAQ,QAAQ,CAAC,CAAC,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC,EAC/B,UAAU,CAAC,KAAK,EAAE,CAAC,EAAE,QAAQ,EAAE,CAAC,GAAG,SAAS,KAAK,IAAI,EACrD,UAAU,YAAY,CAAC,CAAC,CAAC,KACxB,YAqCF,CAAC"}
|
package/dist/_watch.js
ADDED
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
//#region src/_watch.ts
|
|
2
|
+
var e = (e) => (t, n, r) => {
|
|
3
|
+
let i = typeof t == "function" ? t : () => t.value, a = r?.equals ?? Object.is, o = !0, s, c = !1, l = e.effect(() => {
|
|
4
|
+
let e = i();
|
|
5
|
+
if (o) {
|
|
6
|
+
o = !1, s = e, r?.immediate && n(e, void 0), c = r?.once === !0 && r.immediate === !0;
|
|
7
|
+
return;
|
|
8
|
+
}
|
|
9
|
+
if (a(s, e)) return;
|
|
10
|
+
let t = s;
|
|
11
|
+
s = e, n(e, t), r?.once && l.dispose();
|
|
12
|
+
}, { name: r?.name });
|
|
13
|
+
return c && l.dispose(), l;
|
|
14
|
+
};
|
|
15
|
+
//#endregion
|
|
16
|
+
export { e as createWatch };
|
|
17
|
+
|
|
18
|
+
//# sourceMappingURL=_watch.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"_watch.js","names":[],"sources":["../src/_watch.ts"],"sourcesContent":["import type { EffectHandle, Equality, Readable } from './types';\n\nexport type WatchOptions<T> = {\n equals?: Equality<T>;\n immediate?: boolean;\n name?: string;\n once?: boolean;\n};\n\ntype WatchRuntime = {\n effect(callback: () => void | (() => void), options?: { name?: string }): EffectHandle;\n};\n\nexport const createWatch =\n (runtime: WatchRuntime) =>\n <T>(\n source: Readable<T> | (() => T),\n callback: (value: T, previous: T | undefined) => void,\n options?: WatchOptions<T>,\n ): EffectHandle => {\n const read = typeof source === 'function' ? source : () => source.value;\n const equals = options?.equals ?? Object.is;\n let initial = true;\n let previous: T | undefined;\n let stopAfterInitialRun = false;\n\n const handle = runtime.effect(\n () => {\n const value = read();\n\n if (initial) {\n initial = false;\n previous = value;\n\n if (options?.immediate) callback(value, undefined);\n\n stopAfterInitialRun = options?.once === true && options.immediate === true;\n\n return;\n }\n\n if (equals(previous as T, value)) return;\n\n const oldValue = previous;\n\n previous = value;\n callback(value, oldValue);\n\n if (options?.once) handle.dispose();\n },\n { name: options?.name },\n );\n\n if (stopAfterInitialRun) handle.dispose();\n\n return handle;\n };\n"],"mappings":";AAaA,IAAa,KACV,OAEC,GACA,GACA,MACiB;CACjB,IAAM,IAAO,OAAO,KAAW,aAAa,UAAe,EAAO,OAC5D,IAAS,GAAS,UAAU,OAAO,IACrC,IAAU,IACV,GACA,IAAsB,IAEpB,IAAS,EAAQ,aACf;EACJ,IAAM,IAAQ,EAAK;EAEnB,IAAI,GAAS;GAMX,AALA,IAAU,IACV,IAAW,GAEP,GAAS,aAAW,EAAS,GAAO,KAAA,CAAS,GAEjD,IAAsB,GAAS,SAAS,MAAQ,EAAQ,cAAc;GAEtE;EACF;EAEA,IAAI,EAAO,GAAe,CAAK,GAAG;EAElC,IAAM,IAAW;EAKjB,AAHA,IAAW,GACX,EAAS,GAAO,CAAQ,GAEpB,GAAS,QAAM,EAAO,QAAQ;CACpC,GACA,EAAE,MAAM,GAAS,KAAK,CACxB;CAIA,OAFI,KAAqB,EAAO,QAAQ,GAEjC;AACT"}
|
package/dist/async.cjs
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("./index.cjs");exports.resource=e.resource;
|
package/dist/async.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"async.d.ts","sourceRoot":"","sources":["../src/async.ts"],"names":[],"mappings":"AAAA,YAAY,EAAE,UAAU,EAAE,QAAQ,EAAE,eAAe,EAAE,MAAM,UAAU,CAAC;AACtE,OAAO,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAC"}
|
package/dist/async.js
ADDED
package/dist/errors.cjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
var e=class e extends Error{constructor(e,t){super(e,t),this.name=new.target.name,Object.setPrototypeOf(this,new.target.prototype)}static is(t){return t instanceof e}},t=class extends e{},n=class extends e{},r=class extends e{}
|
|
1
|
+
var e=class e extends Error{constructor(e,t){super(e,t),this.name=new.target.name,Object.setPrototypeOf(this,new.target.prototype)}static is(t){return t instanceof e}},t=class extends e{},n=class extends e{},r=class extends e{};exports.RippleComputedCycleError=t,exports.RippleDisposedScopeError=n,exports.RippleError=e,exports.RippleInfiniteLoopError=r;
|
|
2
2
|
//# sourceMappingURL=errors.cjs.map
|
package/dist/errors.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"errors.cjs","names":[],"sources":["../src/errors.ts"],"sourcesContent":["
|
|
1
|
+
{"version":3,"file":"errors.cjs","names":[],"sources":["../src/errors.ts"],"sourcesContent":["export class RippleError extends Error {\n constructor(message: string, options?: ErrorOptions) {\n super(message, options);\n this.name = new.target.name;\n Object.setPrototypeOf(this, new.target.prototype);\n }\n\n static is(error: unknown): error is RippleError {\n return error instanceof RippleError;\n }\n}\n\nexport class RippleComputedCycleError extends RippleError {}\nexport class RippleDisposedScopeError extends RippleError {}\nexport class RippleInfiniteLoopError extends RippleError {}\n"],"mappings":"AAAA,IAAa,EAAb,MAAa,UAAoB,KAAM,CACrC,YAAY,EAAiB,EAAwB,CACnD,MAAM,EAAS,CAAO,EACtB,KAAK,KAAO,WAAW,KACvB,OAAO,eAAe,KAAM,WAAW,SAAS,CAClD,CAEA,OAAO,GAAG,EAAsC,CAC9C,OAAO,aAAiB,CAC1B,CACF,EAEa,EAAb,cAA8C,CAAY,CAAC,EAC9C,EAAb,cAA8C,CAAY,CAAC,EAC9C,EAAb,cAA6C,CAAY,CAAC"}
|
package/dist/errors.d.ts
CHANGED
|
@@ -1,24 +1,11 @@
|
|
|
1
|
-
/** Base class for all ripple errors. Use `instanceof RippleError` to catch any ripple-originated error. */
|
|
2
1
|
export declare class RippleError extends Error {
|
|
3
|
-
constructor(message: string,
|
|
4
|
-
static is(
|
|
2
|
+
constructor(message: string, options?: ErrorOptions);
|
|
3
|
+
static is(error: unknown): error is RippleError;
|
|
5
4
|
}
|
|
6
|
-
/** Thrown when a computed value reads itself, creating a circular dependency. */
|
|
7
5
|
export declare class RippleComputedCycleError extends RippleError {
|
|
8
6
|
}
|
|
9
|
-
/** Thrown when a method is called on a scope that has already been disposed. */
|
|
10
7
|
export declare class RippleDisposedScopeError extends RippleError {
|
|
11
8
|
}
|
|
12
|
-
/** Thrown when the current runtime environment does not support the requested feature (e.g. SSR APIs in the browser). */
|
|
13
|
-
export declare class RippleEnvironmentError extends RippleError {
|
|
14
|
-
}
|
|
15
|
-
/** Thrown when an effect or flush loop exceeds the maximum iteration count. */
|
|
16
9
|
export declare class RippleInfiniteLoopError extends RippleError {
|
|
17
10
|
}
|
|
18
|
-
/** Thrown when `onCleanup()` is called outside an active effect or scope. */
|
|
19
|
-
export declare class RippleInvalidCleanupError extends RippleError {
|
|
20
|
-
}
|
|
21
|
-
/** Thrown when a store is created or mutated with an invalid value or path. */
|
|
22
|
-
export declare class RippleInvalidStoreError extends RippleError {
|
|
23
|
-
}
|
|
24
11
|
//# sourceMappingURL=errors.d.ts.map
|
package/dist/errors.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"errors.d.ts","sourceRoot":"","sources":["../src/errors.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"errors.d.ts","sourceRoot":"","sources":["../src/errors.ts"],"names":[],"mappings":"AAAA,qBAAa,WAAY,SAAQ,KAAK;gBACxB,OAAO,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,YAAY;IAMnD,MAAM,CAAC,EAAE,CAAC,KAAK,EAAE,OAAO,GAAG,KAAK,IAAI,WAAW;CAGhD;AAED,qBAAa,wBAAyB,SAAQ,WAAW;CAAG;AAC5D,qBAAa,wBAAyB,SAAQ,WAAW;CAAG;AAC5D,qBAAa,uBAAwB,SAAQ,WAAW;CAAG"}
|
package/dist/errors.js
CHANGED
|
@@ -6,8 +6,8 @@ var e = class e extends Error {
|
|
|
6
6
|
static is(t) {
|
|
7
7
|
return t instanceof e;
|
|
8
8
|
}
|
|
9
|
-
}, t = class extends e {}, n = class extends e {}, r = class extends e {}
|
|
9
|
+
}, t = class extends e {}, n = class extends e {}, r = class extends e {};
|
|
10
10
|
//#endregion
|
|
11
|
-
export { t as RippleComputedCycleError, n as RippleDisposedScopeError,
|
|
11
|
+
export { t as RippleComputedCycleError, n as RippleDisposedScopeError, e as RippleError, r as RippleInfiniteLoopError };
|
|
12
12
|
|
|
13
13
|
//# sourceMappingURL=errors.js.map
|
package/dist/errors.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"errors.js","names":[],"sources":["../src/errors.ts"],"sourcesContent":["
|
|
1
|
+
{"version":3,"file":"errors.js","names":[],"sources":["../src/errors.ts"],"sourcesContent":["export class RippleError extends Error {\n constructor(message: string, options?: ErrorOptions) {\n super(message, options);\n this.name = new.target.name;\n Object.setPrototypeOf(this, new.target.prototype);\n }\n\n static is(error: unknown): error is RippleError {\n return error instanceof RippleError;\n }\n}\n\nexport class RippleComputedCycleError extends RippleError {}\nexport class RippleDisposedScopeError extends RippleError {}\nexport class RippleInfiniteLoopError extends RippleError {}\n"],"mappings":";AAAA,IAAa,IAAb,MAAa,UAAoB,MAAM;CACrC,YAAY,GAAiB,GAAwB;EAGnD,AAFA,MAAM,GAAS,CAAO,GACtB,KAAK,OAAO,WAAW,MACvB,OAAO,eAAe,MAAM,WAAW,SAAS;CAClD;CAEA,OAAO,GAAG,GAAsC;EAC9C,OAAO,aAAiB;CAC1B;AACF,GAEa,IAAb,cAA8C,EAAY,CAAC,GAC9C,IAAb,cAA8C,EAAY,CAAC,GAC9C,IAAb,cAA6C,EAAY,CAAC"}
|
package/dist/index.cjs
CHANGED
|
@@ -1 +1,2 @@
|
|
|
1
|
-
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("./
|
|
1
|
+
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("./errors.cjs"),t=require("./runtime.cjs"),n=require("./_async.cjs"),r=require("./_store.cjs"),i=require("./_watch.cjs");var a=e=>{let a=new t.ReactiveRuntime(e),o=n.createResource(a),s=r.createStore(a);return{batch:a.batch,computed:a.computed,createScope:a.createScope,createStore:s,dispose:()=>a.dispose(),effect:a.effect,resource:o,signal:a.signal,untrack:a.untrack,watch:i.createWatch(a)}},o=a(),s=o.signal,c=o.computed,l=o.effect,u=o.batch,d=o.createScope,f=o.createStore,p=o.resource,m=o.untrack,h=o.watch;exports.RippleComputedCycleError=e.RippleComputedCycleError,exports.RippleDisposedScopeError=e.RippleDisposedScopeError,exports.RippleError=e.RippleError,exports.RippleInfiniteLoopError=e.RippleInfiniteLoopError,exports.batch=u,exports.computed=c,exports.createRipple=a,exports.createScope=d,exports.createStore=f,exports.effect=l,exports.isReactive=t.isReactive,exports.resource=p,exports.signal=s,exports.untrack=m,exports.watch=h;
|
|
2
|
+
//# sourceMappingURL=index.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.cjs","names":[],"sources":["../src/index.ts"],"sourcesContent":["export type {\n Cleanup,\n ComputedOptions,\n Disposable,\n EffectHandle,\n EffectOptions,\n Equality,\n ReactiveErrorContext,\n ReactiveEvent,\n ReactiveObserver,\n Readable,\n RippleOptions,\n Scope,\n Signal,\n SignalOptions,\n Unsubscribe,\n} from './types';\n\nexport { RippleComputedCycleError, RippleDisposedScopeError, RippleError, RippleInfiniteLoopError } from './errors';\nexport { isReactive } from './runtime';\n\nimport type {\n Cleanup,\n ComputedOptions,\n EffectHandle,\n EffectOptions,\n Readable,\n RippleOptions,\n Scope,\n Signal,\n SignalOptions,\n} from './types';\n\nimport { createResource, type Resource, type ResourceOptions } from './_async';\nimport { createStore as createStoreFactory, type Store, type StoreOptions } from './_store';\nimport { createWatch, type WatchOptions } from './_watch';\nimport { ReactiveRuntime } from './runtime';\n\nexport interface Ripple {\n batch<T>(fn: () => T): T;\n computed<T>(derive: () => T, options?: ComputedOptions<T>): Readable<T>;\n createScope(name?: string): Scope;\n createStore<T>(initial: T, options?: StoreOptions): Store<T>;\n dispose(): void;\n effect(callback: () => Cleanup | void, options?: EffectOptions): EffectHandle;\n resource<Source, Value>(\n source: () => Source,\n loader: (source: Source, context: { readonly signal: AbortSignal }) => Promise<Value>,\n options?: ResourceOptions,\n ): Resource<Value>;\n signal<T>(initial: T, options?: SignalOptions<T>): Signal<T>;\n untrack<T>(fn: () => T): T;\n watch<T>(\n source: Readable<T> | (() => T),\n callback: (value: T, previous: T | undefined) => void,\n options?: WatchOptions<T>,\n ): EffectHandle;\n}\n\n/** Creates one complete reactive graph. All factories on the object share its runtime. */\nexport const createRipple = (options?: RippleOptions): Ripple => {\n const runtime = new ReactiveRuntime(options);\n const resource = createResource(runtime);\n const createStore = createStoreFactory(runtime);\n\n return {\n batch: runtime.batch,\n computed: runtime.computed,\n createScope: runtime.createScope,\n createStore,\n dispose: () => runtime.dispose(),\n effect: runtime.effect,\n resource,\n signal: runtime.signal,\n untrack: runtime.untrack,\n watch: createWatch(runtime),\n };\n};\n\nconst defaultRipple = createRipple();\n\nexport const signal = defaultRipple.signal;\nexport const computed = defaultRipple.computed;\nexport const effect = defaultRipple.effect;\nexport const batch = defaultRipple.batch;\nexport const createScope = defaultRipple.createScope;\nexport const createStore = defaultRipple.createStore;\nexport const resource = defaultRipple.resource;\nexport const untrack = defaultRipple.untrack;\nexport const watch = defaultRipple.watch;\n"],"mappings":"4MA4DA,IAAa,EAAgB,GAAoC,CAC/D,IAAM,EAAU,IAAI,EAAA,gBAAgB,CAAO,EACrC,EAAW,EAAA,eAAe,CAAO,EACjC,EAAc,EAAA,YAAmB,CAAO,EAE9C,MAAO,CACL,MAAO,EAAQ,MACf,SAAU,EAAQ,SAClB,YAAa,EAAQ,YACrB,cACA,YAAe,EAAQ,QAAQ,EAC/B,OAAQ,EAAQ,OAChB,WACA,OAAQ,EAAQ,OAChB,QAAS,EAAQ,QACjB,MAAO,EAAA,YAAY,CAAO,CAC5B,CACF,EAEM,EAAgB,EAAa,EAEtB,EAAS,EAAc,OACvB,EAAW,EAAc,SACzB,EAAS,EAAc,OACvB,EAAQ,EAAc,MACtB,EAAc,EAAc,YAC5B,EAAc,EAAc,YAC5B,EAAW,EAAc,SACzB,EAAU,EAAc,QACxB,EAAQ,EAAc"}
|
package/dist/index.d.ts
CHANGED
|
@@ -1,12 +1,35 @@
|
|
|
1
|
-
export type {
|
|
2
|
-
export { RippleComputedCycleError, RippleDisposedScopeError,
|
|
3
|
-
export {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
export
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
1
|
+
export type { Cleanup, ComputedOptions, Disposable, EffectHandle, EffectOptions, Equality, ReactiveErrorContext, ReactiveEvent, ReactiveObserver, Readable, RippleOptions, Scope, Signal, SignalOptions, Unsubscribe, } from './types';
|
|
2
|
+
export { RippleComputedCycleError, RippleDisposedScopeError, RippleError, RippleInfiniteLoopError } from './errors';
|
|
3
|
+
export { isReactive } from './runtime';
|
|
4
|
+
import type { Cleanup, ComputedOptions, EffectHandle, EffectOptions, Readable, RippleOptions, Scope, Signal, SignalOptions } from './types';
|
|
5
|
+
import { type Resource, type ResourceOptions } from './_async';
|
|
6
|
+
import { type Store, type StoreOptions } from './_store';
|
|
7
|
+
import { type WatchOptions } from './_watch';
|
|
8
|
+
export interface Ripple {
|
|
9
|
+
batch<T>(fn: () => T): T;
|
|
10
|
+
computed<T>(derive: () => T, options?: ComputedOptions<T>): Readable<T>;
|
|
11
|
+
createScope(name?: string): Scope;
|
|
12
|
+
createStore<T>(initial: T, options?: StoreOptions): Store<T>;
|
|
13
|
+
dispose(): void;
|
|
14
|
+
effect(callback: () => Cleanup | void, options?: EffectOptions): EffectHandle;
|
|
15
|
+
resource<Source, Value>(source: () => Source, loader: (source: Source, context: {
|
|
16
|
+
readonly signal: AbortSignal;
|
|
17
|
+
}) => Promise<Value>, options?: ResourceOptions): Resource<Value>;
|
|
18
|
+
signal<T>(initial: T, options?: SignalOptions<T>): Signal<T>;
|
|
19
|
+
untrack<T>(fn: () => T): T;
|
|
20
|
+
watch<T>(source: Readable<T> | (() => T), callback: (value: T, previous: T | undefined) => void, options?: WatchOptions<T>): EffectHandle;
|
|
21
|
+
}
|
|
22
|
+
/** Creates one complete reactive graph. All factories on the object share its runtime. */
|
|
23
|
+
export declare const createRipple: (options?: RippleOptions) => Ripple;
|
|
24
|
+
export declare const signal: <T>(initial: T, options?: SignalOptions<T>) => Signal<T>;
|
|
25
|
+
export declare const computed: <T>(derive: () => T, options?: ComputedOptions<T>) => Readable<T>;
|
|
26
|
+
export declare const effect: (callback: () => Cleanup | void, options?: EffectOptions) => EffectHandle;
|
|
27
|
+
export declare const batch: <T>(fn: () => T) => T;
|
|
28
|
+
export declare const createScope: (name?: string) => Scope;
|
|
29
|
+
export declare const createStore: <T>(initial: T, options?: StoreOptions) => Store<T>;
|
|
30
|
+
export declare const resource: <Source, Value>(source: () => Source, loader: (source: Source, context: {
|
|
31
|
+
readonly signal: AbortSignal;
|
|
32
|
+
}) => Promise<Value>, options?: ResourceOptions) => Resource<Value>;
|
|
33
|
+
export declare const untrack: <T>(fn: () => T) => T;
|
|
34
|
+
export declare const watch: <T>(source: Readable<T> | (() => T), callback: (value: T, previous: T | undefined) => void, options?: WatchOptions<T>) => EffectHandle;
|
|
12
35
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"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"}
|