tilia 2.1.0 → 2.1.1

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 CHANGED
@@ -216,7 +216,7 @@ let computed: (unit => 'a) => 'a
216
216
  * @param f The setup function, receives a setter.
217
217
  * @param v The initial value.
218
218
  */
219
- let source: (('a => unit) => unit, 'a) => 'a
219
+ let source: (('a => unit) => 'ignored, 'a) => 'a
220
220
 
221
221
  /**
222
222
  * Return a managed value to be inserted into a tilia object.
@@ -298,7 +298,10 @@ export function batch(fn: () => void): void;
298
298
 
299
299
  // Functional reactive programming
300
300
  export function computed<T>(fn: () => T): T;
301
- export function source<T>(fn: (set: Setter<T>) => void, initialValue: T): T;
301
+ export function source<T, Ignored>(
302
+ fn: (set: Setter<T>) => Ignored,
303
+ initialValue: T
304
+ ): T;
302
305
  export function store<T>(fn: (set: Setter<T>) => T): T;
303
306
  export function readonly<T>(data: T): Readonly<T>;
304
307
  export function signal<T>(value: T): Signal<T>;
package/dist/index.d.ts CHANGED
@@ -28,7 +28,7 @@ export function batch(fn: () => void): void;
28
28
 
29
29
  // Functional reactive programming
30
30
  export function computed<T>(fn: () => T): T;
31
- export function source<T>(fn: (set: Setter<T>) => void, initialValue: T): T;
31
+ export function source<T, Ignored>(fn: (set: Setter<T>) => Ignored, initialValue: T): T;
32
32
  export function store<T>(fn: (set: Setter<T>) => T): T;
33
33
  export function readonly<T>(data: T): Readonly<T>;
34
34
  export function signal<T>(value: T): Signal<T>;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "tilia",
3
- "version": "2.1.0",
3
+ "version": "2.1.1",
4
4
  "homepage": "https://tiliajs.com",
5
5
  "main": "./dist/index.cjs",
6
6
  "module": "./dist/index.mjs",
package/src/Tilia.res CHANGED
@@ -34,14 +34,14 @@ let ctxKey = symbol("ctx")
34
34
 
35
35
  type compute<'a> = {mutable rebuild: unit => 'a}
36
36
 
37
- type source<'a> = {
38
- source: ('a => unit) => unit,
37
+ type source<'a, 'ignored> = {
38
+ source: ('a => unit) => 'ignored,
39
39
  value: 'a,
40
40
  }
41
41
 
42
- type dynamic<'a> =
42
+ type dynamic<'a, 'b> =
43
43
  | Computed(unit => 'a)
44
- | Source(source<'a>)
44
+ | Source(source<'a, 'b>)
45
45
  | Store(('a => unit) => 'a)
46
46
  | Compiled(compute<'a>)
47
47
 
@@ -58,7 +58,7 @@ function(v) {
58
58
  }
59
59
  `)
60
60
 
61
- let dynamic: 'a => nullable<dynamic<'a>> = %raw(`
61
+ let dynamic: 'a => nullable<dynamic<'a, 'b>> = %raw(`
62
62
  function(v) {
63
63
  return typeof v === 'object' && v !== null && v[dynamicKey] ? v : undefined;
64
64
  }
@@ -326,7 +326,7 @@ let notify = (root, observed, key) => {
326
326
  }
327
327
 
328
328
  @inline
329
- let sourceCallback = (set, source: source<'a>) => {
329
+ let sourceCallback = (set, source: source<'a, 'b>) => {
330
330
  let v = source.value
331
331
  let val = ref(v)
332
332
  let set = v => {
package/src/Tilia.resi CHANGED
@@ -189,7 +189,7 @@ let computed: (unit => 'a) => 'a
189
189
  * @param f The setup function, receives a setter.
190
190
  * @param v The initial value.
191
191
  */
192
- let source: (('a => unit) => unit, 'a) => 'a
192
+ let source: (('a => unit) => 'ignored, 'a) => 'a
193
193
 
194
194
  /**
195
195
  * Return a managed value to be inserted into a tilia object.