@manyducks.co/dolla 3.1.0 → 3.2.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/dist/core/index.d.ts +1 -1
- package/dist/core/signals.d.ts +33 -1
- package/dist/core-2CFW0uRa.js +1047 -0
- package/dist/core-2CFW0uRa.js.map +1 -0
- package/dist/index.js +2 -4
- package/dist/jsx-dev-runtime.js +1 -1
- package/dist/jsx-runtime.js +1 -1
- package/dist/router/types.d.ts +4 -3
- package/dist/router/utils.d.ts +1 -1
- package/dist/router.js +148 -150
- package/dist/router.js.map +1 -1
- package/dist/translate.js +24 -24
- package/package.json +1 -1
- package/dist/context-B5blupD2.js +0 -363
- package/dist/context-B5blupD2.js.map +0 -1
- package/dist/core-JHktdqjt.js +0 -242
- package/dist/core-JHktdqjt.js.map +0 -1
- package/dist/signals-CMJPGr_M.js +0 -354
- package/dist/signals-CMJPGr_M.js.map +0 -1
package/dist/core/index.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
export { createRoot } from "./root.js";
|
|
2
2
|
export type { DollaPlugin } from "./root.js";
|
|
3
|
-
export { batch, compose, createAtom, createEffect, peek, subscribe, unwrap } from "./signals.js";
|
|
3
|
+
export { batch, compose, createAtom, createEffect, createStream, peek, subscribe, unwrap } from "./signals.js";
|
|
4
4
|
export type { Getter, Setter } from "./signals.js";
|
|
5
5
|
export { addStore, getNearestViewNode, getRootElement, getStore, onCleanup, onEffect, onMount } from "./context.js";
|
|
6
6
|
export type { Context } from "./context.js";
|
package/dist/core/signals.d.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { Context } from "./index.js";
|
|
1
2
|
/**
|
|
2
3
|
* Returns the currently held value. Registers the state as a dependency when called within a tracking context.
|
|
3
4
|
*/
|
|
@@ -50,7 +51,7 @@ export declare function createAtom<T>(compute: Getter<T>): AtomAccessors<T>;
|
|
|
50
51
|
* const [getCount, setCount] = createAtom(5);
|
|
51
52
|
*/
|
|
52
53
|
export declare function createAtom<T>(initialValue: T): AtomAccessors<T>;
|
|
53
|
-
export declare function compose<T>(getter: (previousValue?: T) => Getter<T> | T): Getter<T>;
|
|
54
|
+
export declare function compose<T>(getter: T | ((previousValue?: T) => Getter<T> | T)): Getter<T>;
|
|
54
55
|
export declare function createEffect(fn: () => void): () => void;
|
|
55
56
|
/**
|
|
56
57
|
* Unwraps a `MaybeGetter<T>` into a plain `T`.
|
|
@@ -68,3 +69,34 @@ export declare function peek<T>(value: T | Getter<T>): T;
|
|
|
68
69
|
*/
|
|
69
70
|
export declare function batch(callback: () => void): void;
|
|
70
71
|
export declare function subscribe<T>(target: Getter<T>, fn: (value: T) => any): () => void;
|
|
72
|
+
export interface StreamOptions<T> {
|
|
73
|
+
/**
|
|
74
|
+
* An initial value for non-nullable streams.
|
|
75
|
+
*/
|
|
76
|
+
initialValue?: T;
|
|
77
|
+
/**
|
|
78
|
+
* Cancel pending `next` listeners when this context is unmounted.
|
|
79
|
+
*/
|
|
80
|
+
context?: Context;
|
|
81
|
+
/**
|
|
82
|
+
* Number of emitted values to keep. Defaults to 0 (latest value only).
|
|
83
|
+
*/
|
|
84
|
+
history?: number;
|
|
85
|
+
}
|
|
86
|
+
export interface StreamOptionsWithValue<T> extends StreamOptions<T> {
|
|
87
|
+
initialValue: T;
|
|
88
|
+
}
|
|
89
|
+
export interface Stream<T> {
|
|
90
|
+
readonly latest: T;
|
|
91
|
+
current: Getter<T>;
|
|
92
|
+
next(): Promise<T>;
|
|
93
|
+
map<O>(callback: (value: T, previous?: O) => O): Stream<O>;
|
|
94
|
+
reduce<O>(callback: (reduced: O, value: T) => O, initialValue: O): Stream<O>;
|
|
95
|
+
filter(callback: (value: T, previous?: T) => boolean, defaultValue: T): Stream<T>;
|
|
96
|
+
filter(callback: (value: T, previous?: T) => boolean, defaultValue?: T): Stream<T | undefined>;
|
|
97
|
+
throttle(milliseconds: number): Stream<T>;
|
|
98
|
+
debounce(milliseconds: number): Stream<T>;
|
|
99
|
+
delay(milliseconds: number, initialValue?: T): Stream<T>;
|
|
100
|
+
}
|
|
101
|
+
export declare function createStream<T>(options: StreamOptionsWithValue<T>): [Stream<T>, Setter<T>];
|
|
102
|
+
export declare function createStream<T>(options: StreamOptions<T>): [Stream<T | undefined>, Setter<T | undefined>];
|