@but212/atom-effect-jquery 0.24.1 → 0.25.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/index.d.ts CHANGED
@@ -11,6 +11,12 @@ import { ReadonlyAtom } from '@but212/atom-effect';
11
11
  import { untracked } from '@but212/atom-effect';
12
12
  import { WritableAtom } from '@but212/atom-effect';
13
13
 
14
+ /**
15
+ * Represents a value that can be a synchronous `ReactiveValue<T>`,
16
+ * a `Promise<T>`, or an Atom yielding `T | Promise<T>`.
17
+ */
18
+ declare type AsyncReactiveValue<T> = T | ReadonlyAtom<T | Promise<T>> | Promise<T> | (() => T | Promise<T>);
19
+
14
20
  export { atom }
15
21
 
16
22
  export { batch }
@@ -21,21 +27,21 @@ export { batch }
21
27
  */
22
28
  export declare interface BindingOptions<T = unknown> {
23
29
  /** Binds textContent to any reactive source. */
24
- text?: ReactiveValue<unknown>;
30
+ text?: AsyncReactiveValue<unknown>;
25
31
  /** Binds innerHTML to a reactive string source (sanitized). */
26
- html?: ReactiveValue<string>;
32
+ html?: AsyncReactiveValue<string>;
27
33
  /** Map of class names to reactive boolean conditions. */
28
- class?: Record<string, ReactiveValue<boolean>>;
34
+ class?: Record<string, AsyncReactiveValue<boolean>>;
29
35
  /** Map of CSS properties to reactive values or [value, unit] tuples. */
30
36
  css?: CssBindings;
31
37
  /** Binds attributes with consistent primitive constraints. */
32
- attr?: Record<string, ReactiveValue<PrimitiveValue>>;
38
+ attr?: Record<string, AsyncReactiveValue<PrimitiveValue>>;
33
39
  /** Binds DOM properties. */
34
- prop?: Record<string, ReactiveValue<unknown>>;
40
+ prop?: Record<string, AsyncReactiveValue<unknown>>;
35
41
  /** Direct visibility control (display: none). */
36
- show?: ReactiveValue<boolean>;
42
+ show?: AsyncReactiveValue<boolean>;
37
43
  /** Inverse visibility control. */
38
- hide?: ReactiveValue<boolean>;
44
+ hide?: AsyncReactiveValue<boolean>;
39
45
  /**
40
46
  * Two-way binding for input values.
41
47
  * Pass an atom or a `[atom, options]` tuple.
@@ -43,6 +49,8 @@ export declare interface BindingOptions<T = unknown> {
43
49
  val?: WritableAtom<T> | [atom: WritableAtom<T>, options: ValOptions<T>];
44
50
  /** Two-way binding for checkboxes and radio buttons. */
45
51
  checked?: WritableAtom<boolean>;
52
+ /** Fully automated two-way form binding using name attributes. */
53
+ form?: WritableAtom<T extends object ? T : unknown>;
46
54
  /** Event listeners with automatic batched execution and lifecycle-bound cleanup. */
47
55
  on?: Record<string, (e: JQuery.Event) => void>;
48
56
  }
@@ -92,7 +100,7 @@ export declare type CssBindings = Record<string, CssValue>;
92
100
  /**
93
101
  * CSS value: either a direct reactive value or a numeric tuple of [source, unit].
94
102
  */
95
- export declare type CssValue = ReactiveValue<string | number> | [source: ReactiveValue<number>, unit: string];
103
+ export declare type CssValue = AsyncReactiveValue<string | number> | [source: AsyncReactiveValue<number>, unit: string];
96
104
 
97
105
  export default default_2;
98
106
 
@@ -261,7 +269,7 @@ export declare type PrimitiveValue = string | number | boolean | null | undefine
261
269
  * `ComputedAtom<T>` is a structural sub-type of `ReadonlyAtom<T>`, so it is
262
270
  * already covered by `ReadonlyAtom<T>`.
263
271
  */
264
- export declare type ReactiveValue<T> = T | ReadonlyAtom<T>;
272
+ export declare type ReactiveValue<T> = T | ReadonlyAtom<T> | (() => T);
265
273
 
266
274
  export { ReadonlyAtom }
267
275