@tempots/ui 1.2.1-next.3 → 1.2.1-next.4

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tempots/ui",
3
- "version": "1.2.1-next.3",
3
+ "version": "1.2.1-next.4",
4
4
  "type": "module",
5
5
  "main": "./index.cjs",
6
6
  "module": "./index.js",
@@ -8,12 +8,10 @@ import { AsyncResource, ResourceLoadOptions } from '../utils/resource';
8
8
  * @public
9
9
  */
10
10
  export interface ResourceDisplayOptions<V, E> {
11
- /** Function to render when the resource has not been requested yet. */
12
- notAsked?: (reload: () => void) => TNode;
13
11
  /** Function to render when the resource is loading. */
14
12
  loading?: (previous: Signal<V | undefined>, reload: () => void) => TNode;
15
13
  /** Function to render when the resource has failed to load. */
16
- error?: (error: Signal<E>, reload: () => void) => TNode;
14
+ failure?: (error: Signal<E>, reload: () => void) => TNode;
17
15
  /** Function to render when the resource has successfully loaded. */
18
16
  success: (value: Signal<V>, reload: () => void) => TNode;
19
17
  }
@@ -42,4 +40,8 @@ export declare const ResourceDisplay: <V, E>(resource: AsyncResource<V, E>, opti
42
40
  * @returns A function that takes display options and returns a node representing the current state of the resource.
43
41
  * @public
44
42
  */
45
- export declare const Resource: <R, V, E>(request: Signal<R>, load: (options: ResourceLoadOptions<R, V, E>) => Promise<V>, convertError: (error: unknown) => E) => ((displayOptions: ResourceDisplayOptions<V, E>) => Renderable);
43
+ export declare const Resource: <R, V, E = unknown>({ request, load, mapError, }: {
44
+ request: Signal<R>;
45
+ load: (options: ResourceLoadOptions<R, V, E>) => Promise<V>;
46
+ mapError?: (error: unknown) => E;
47
+ }) => ((displayOptions: ResourceDisplayOptions<V, E>) => Renderable);