@hamur/adapter-solid 0.0.1 → 0.0.3
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/types/src/index.d.ts +7 -7
- package/package.json +30 -9
- package/src/index.ts +7 -6
|
@@ -9,9 +9,9 @@ import type { $Fetch, FetchCheckedInput, FetchInputField } from "hamur/app";
|
|
|
9
9
|
import type { StateKey } from "hamur/app";
|
|
10
10
|
import type { HamurEvent } from "hamur/server";
|
|
11
11
|
import type { LinkDefaults, LinkSlot, Navigation, UseLinkOptions } from "hamur/adapter";
|
|
12
|
-
import type { ActionOptions, ActionRunner, PrefetchOn, Handler, AfterNavigateHook, BeforeNavigateHook, NavigateHook, NavigationBlocker, NavigationGuard, Blocker, ShouldBlock, UseBlockerOptions, SnapshotOptions } from "hamur/adapter";
|
|
12
|
+
import type { ActionOptions, ActionRunner, ActionValue, FailureOf, PrefetchOn, Handler, AfterNavigateHook, BeforeNavigateHook, NavigateHook, NavigationBlocker, NavigationGuard, Blocker, ShouldBlock, UseBlockerOptions, SnapshotOptions } from "hamur/adapter";
|
|
13
13
|
import type { FieldsOf, HamurLinkProps } from "hamur/app";
|
|
14
|
-
import type {
|
|
14
|
+
import type { AppContext, FormSubmitArgs, PendingRun, PickFrom, RouteLocation, AsyncDataOptions, ClientRuntimeConfig, SiteConfig, ErrorPageProps, FetchData, AsyncDataStatus, HeadInput, HeadSafeInput, SeoMetaInput, UseCookieOptions, HamurError } from "hamur/app";
|
|
15
15
|
import type { RouteLoaderData, UseDataArgs, AsyncDataHandler, ErrorBoundaryFallbackProps, FetchRequest, GetCachedData, CheckedTarget, NavigationState, RouteValue, RouterApi } from "hamur/adapter";
|
|
16
16
|
export { addRouteMiddleware, clearError, disableScrollHandling, forbidden, navigateTo, notFound, permanentRedirect, refreshCookie, setPageLayout, showError, unauthorized, } from "hamur/app";
|
|
17
17
|
export { defineLazyHydrationComponent } from "./lazy-hydration.ts";
|
|
@@ -140,10 +140,10 @@ export declare function useAction<I, O>(fn: Handler<I, O>, options?: ActionOptio
|
|
|
140
140
|
instance?: string | number;
|
|
141
141
|
}): {
|
|
142
142
|
run: ActionRunner<I, O>["run"];
|
|
143
|
-
state: Accessor<O | undefined>;
|
|
143
|
+
state: Accessor<ActionValue<O> | undefined>;
|
|
144
144
|
pending: Accessor<boolean>;
|
|
145
145
|
error: Accessor<HamurError | undefined>;
|
|
146
|
-
failure: Accessor<
|
|
146
|
+
failure: Accessor<FailureOf<O> | undefined>;
|
|
147
147
|
reset(): void;
|
|
148
148
|
};
|
|
149
149
|
export declare function ClientOnly(props: {
|
|
@@ -321,7 +321,7 @@ export declare function useCookie<T = string>(name: string, options?: Omit<UseCo
|
|
|
321
321
|
export interface UseAsyncDataOptions<T = unknown, R = T, K extends keyof T & string = never, D = T> extends Omit<AsyncDataOptions<T, R, D>, "pick"> {
|
|
322
322
|
/** Accessors whose change re-runs the handler. `false` is accepted and does nothing: nothing watches implicitly. */
|
|
323
323
|
watch?: ReadonlyArray<() => unknown> | false;
|
|
324
|
-
getCachedData?: GetCachedData<T
|
|
324
|
+
getCachedData?: GetCachedData<NoInfer<T>>;
|
|
325
325
|
/** Top-level keys of an object result to keep. */
|
|
326
326
|
pick?: readonly K[];
|
|
327
327
|
}
|
|
@@ -345,10 +345,10 @@ export declare function useAsyncData<I, R, T = R, K extends keyof T & string = n
|
|
|
345
345
|
default: () => D;
|
|
346
346
|
}): UseAsyncDataResult<PickFrom<T, K>, D>;
|
|
347
347
|
export declare function useAsyncData<I, R, T = R, K extends keyof T & string = never>(fn: Handler<I, R>, input?: NoInfer<I> | Accessor<NoInfer<I>>, options?: UseAsyncDataOptions<T, R, K, undefined>): UseAsyncDataResult<PickFrom<T, K>>;
|
|
348
|
-
export declare function useAsyncData<T =
|
|
348
|
+
export declare function useAsyncData<R, T = R, K extends keyof T & string = never, D = T>(key: string | Accessor<string>, handler: AsyncDataHandler<R>, options: UseAsyncDataOptions<T, R, K, D> & {
|
|
349
349
|
default: () => D;
|
|
350
350
|
}): UseAsyncDataResult<PickFrom<T, K>, D>;
|
|
351
|
-
export declare function useAsyncData<T =
|
|
351
|
+
export declare function useAsyncData<R, T = R, K extends keyof T & string = never>(key: string | Accessor<string>, handler: AsyncDataHandler<R>, options?: UseAsyncDataOptions<T, R, K, undefined>): UseAsyncDataResult<PickFrom<T, K>>;
|
|
352
352
|
/** What a literal `useFetch` call is checked against; any other call stays loose. */
|
|
353
353
|
type FetchInput<X> = X extends {
|
|
354
354
|
key: infer K extends string;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@hamur/adapter-solid",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.3",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"repository": {
|
|
@@ -11,31 +11,52 @@
|
|
|
11
11
|
"exports": {
|
|
12
12
|
".": {
|
|
13
13
|
"types": "./dist/types/src/index.d.ts",
|
|
14
|
-
"
|
|
14
|
+
"bun": "./src/index.ts",
|
|
15
|
+
"hamur-source": "./src/index.ts",
|
|
16
|
+
"node": "./dist/src/index.js",
|
|
17
|
+
"default": "./src/index.ts"
|
|
15
18
|
},
|
|
16
19
|
"./adapter": {
|
|
17
20
|
"types": "./dist/types/src/adapter.d.ts",
|
|
18
|
-
"
|
|
21
|
+
"bun": "./src/adapter.ts",
|
|
22
|
+
"hamur-source": "./src/adapter.ts",
|
|
23
|
+
"node": "./dist/src/adapter.js",
|
|
24
|
+
"default": "./src/adapter.ts"
|
|
19
25
|
},
|
|
20
26
|
"./runtime/server": {
|
|
21
27
|
"types": "./dist/types/src/runtime/server.d.ts",
|
|
22
|
-
"
|
|
28
|
+
"bun": "./src/runtime/server.ts",
|
|
29
|
+
"hamur-source": "./src/runtime/server.ts",
|
|
30
|
+
"node": "./dist/src/runtime/server.js",
|
|
31
|
+
"default": "./src/runtime/server.ts"
|
|
23
32
|
},
|
|
24
33
|
"./runtime/client": {
|
|
25
34
|
"types": "./dist/types/src/runtime/client.d.ts",
|
|
26
|
-
"
|
|
35
|
+
"bun": "./src/runtime/client.ts",
|
|
36
|
+
"hamur-source": "./src/runtime/client.ts",
|
|
37
|
+
"node": "./dist/src/runtime/client.js",
|
|
38
|
+
"default": "./src/runtime/client.ts"
|
|
27
39
|
},
|
|
28
40
|
"./runtime/keepalive": {
|
|
29
41
|
"types": "./dist/types/src/keepalive.d.ts",
|
|
30
|
-
"
|
|
42
|
+
"bun": "./src/keepalive.ts",
|
|
43
|
+
"hamur-source": "./src/keepalive.ts",
|
|
44
|
+
"node": "./dist/src/keepalive.js",
|
|
45
|
+
"default": "./src/keepalive.ts"
|
|
31
46
|
},
|
|
32
47
|
"./runtime/island": {
|
|
33
48
|
"types": "./dist/types/src/runtime/island.d.ts",
|
|
34
|
-
"
|
|
49
|
+
"bun": "./src/runtime/island.ts",
|
|
50
|
+
"hamur-source": "./src/runtime/island.ts",
|
|
51
|
+
"node": "./dist/src/runtime/island.js",
|
|
52
|
+
"default": "./src/runtime/island.ts"
|
|
35
53
|
},
|
|
36
54
|
"./error-page": {
|
|
37
55
|
"types": "./dist/types/src/error-page.d.ts",
|
|
38
|
-
"
|
|
56
|
+
"bun": "./src/error-page.ts",
|
|
57
|
+
"hamur-source": "./src/error-page.ts",
|
|
58
|
+
"node": "./dist/src/error-page.js",
|
|
59
|
+
"default": "./src/error-page.ts"
|
|
39
60
|
},
|
|
40
61
|
"./package.json": "./package.json"
|
|
41
62
|
},
|
|
@@ -50,6 +71,6 @@
|
|
|
50
71
|
"@solidjs/babel-plugin": "^2.0.3",
|
|
51
72
|
"@babel/core": "^8.1.4",
|
|
52
73
|
"@babel/preset-typescript": "^8.0.7",
|
|
53
|
-
"hamur": "^0.0.
|
|
74
|
+
"hamur": "^0.0.3"
|
|
54
75
|
}
|
|
55
76
|
}
|
package/src/index.ts
CHANGED
|
@@ -118,6 +118,8 @@ import type { LinkDefaults, LinkSlot, Navigation, UseLinkOptions } from "hamur/a
|
|
|
118
118
|
import type {
|
|
119
119
|
ActionOptions,
|
|
120
120
|
ActionRunner,
|
|
121
|
+
ActionValue,
|
|
122
|
+
FailureOf,
|
|
121
123
|
FormStatus,
|
|
122
124
|
PrefetchOn,
|
|
123
125
|
Handler,
|
|
@@ -135,7 +137,6 @@ import type {
|
|
|
135
137
|
import type { FieldsOf, HamurLinkProps, HandlerFormInstance } from "hamur/app"
|
|
136
138
|
import { linkPending } from "hamur/adapter"
|
|
137
139
|
import type {
|
|
138
|
-
ActionFailure,
|
|
139
140
|
AppContext,
|
|
140
141
|
FormSubmitArgs,
|
|
141
142
|
PendingRun,
|
|
@@ -775,10 +776,10 @@ export function useAction<I, O>(
|
|
|
775
776
|
options: ActionOptions<O> & { instance?: string | number } = {},
|
|
776
777
|
): {
|
|
777
778
|
run: ActionRunner<I, O>["run"]
|
|
778
|
-
state: Accessor<O | undefined>
|
|
779
|
+
state: Accessor<ActionValue<O> | undefined>
|
|
779
780
|
pending: Accessor<boolean>
|
|
780
781
|
error: Accessor<HamurError | undefined>
|
|
781
|
-
failure: Accessor<
|
|
782
|
+
failure: Accessor<FailureOf<O> | undefined>
|
|
782
783
|
reset(): void
|
|
783
784
|
} {
|
|
784
785
|
const router = useRouter()
|
|
@@ -1619,7 +1620,7 @@ export interface UseAsyncDataOptions<T = unknown, R = T, K extends keyof T & str
|
|
|
1619
1620
|
> {
|
|
1620
1621
|
/** Accessors whose change re-runs the handler. `false` is accepted and does nothing: nothing watches implicitly. */
|
|
1621
1622
|
watch?: ReadonlyArray<() => unknown> | false
|
|
1622
|
-
getCachedData?: GetCachedData<T
|
|
1623
|
+
getCachedData?: GetCachedData<NoInfer<T>>
|
|
1623
1624
|
/** Top-level keys of an object result to keep. */
|
|
1624
1625
|
pick?: readonly K[]
|
|
1625
1626
|
}
|
|
@@ -1653,12 +1654,12 @@ export function useAsyncData<I, R, T = R, K extends keyof T & string = never>(
|
|
|
1653
1654
|
input?: NoInfer<I> | Accessor<NoInfer<I>>,
|
|
1654
1655
|
options?: UseAsyncDataOptions<T, R, K, undefined>,
|
|
1655
1656
|
): UseAsyncDataResult<PickFrom<T, K>>
|
|
1656
|
-
export function useAsyncData<T =
|
|
1657
|
+
export function useAsyncData<R, T = R, K extends keyof T & string = never, D = T>(
|
|
1657
1658
|
key: string | Accessor<string>,
|
|
1658
1659
|
handler: AsyncDataHandler<R>,
|
|
1659
1660
|
options: UseAsyncDataOptions<T, R, K, D> & { default: () => D },
|
|
1660
1661
|
): UseAsyncDataResult<PickFrom<T, K>, D>
|
|
1661
|
-
export function useAsyncData<T =
|
|
1662
|
+
export function useAsyncData<R, T = R, K extends keyof T & string = never>(
|
|
1662
1663
|
key: string | Accessor<string>,
|
|
1663
1664
|
handler: AsyncDataHandler<R>,
|
|
1664
1665
|
options?: UseAsyncDataOptions<T, R, K, undefined>,
|