@hamur/adapter-solid 0.0.0-stage → 0.0.2
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/LICENSE +22 -0
- package/README.md +35 -2
- package/dist/chunks/browser-index-8rhv2s58.js +14 -0
- package/dist/chunks/browser-index-b05qbzsh.js +165 -0
- package/dist/chunks/browser-index-n80jt19y.js +114 -0
- package/dist/chunks/browser-index-ncnkshd9.js +39 -0
- package/dist/chunks/browser-index-r4jwfgh7.js +407 -0
- package/dist/src/adapter.js +556 -0
- package/dist/src/error-page.js +466 -0
- package/dist/src/index.js +1535 -0
- package/dist/src/keepalive.js +6 -0
- package/dist/src/runtime/client.js +174 -0
- package/dist/src/runtime/island.js +58 -0
- package/dist/src/runtime/server.js +138 -0
- package/dist/types/src/activation.d.ts +15 -0
- package/dist/types/src/adapter.d.ts +4 -0
- package/dist/types/src/async-data.d.ts +21 -0
- package/dist/types/src/client-component.d.ts +10 -0
- package/dist/types/src/client-fallback.d.ts +2 -0
- package/dist/types/src/context.d.ts +89 -0
- package/dist/types/src/error-page.d.ts +1 -0
- package/dist/types/src/index.d.ts +392 -0
- package/dist/types/src/island-html.d.ts +13 -0
- package/dist/types/src/island.d.ts +20 -0
- package/dist/types/src/jsx-locator.d.ts +6 -0
- package/dist/types/src/keepalive.d.ts +30 -0
- package/dist/types/src/lazy-hydration.d.ts +13 -0
- package/dist/types/src/markdown-page.d.ts +9 -0
- package/dist/types/src/markdown.d.ts +13 -0
- package/dist/types/src/plugin.d.ts +44 -0
- package/dist/types/src/runtime/client.d.ts +13 -0
- package/dist/types/src/runtime/hmr-solid.d.ts +5 -0
- package/dist/types/src/runtime/hmr.d.ts +27 -0
- package/dist/types/src/runtime/hydration-dev.d.ts +1 -0
- package/dist/types/src/runtime/hydration.d.ts +10 -0
- package/dist/types/src/runtime/island.d.ts +8 -0
- package/dist/types/src/runtime/portal.d.ts +13 -0
- package/dist/types/src/runtime/server.d.ts +14 -0
- package/dist/types/src/runtime/trusted.d.ts +2 -0
- package/dist/types/src/server-island.d.ts +10 -0
- package/dist/types/src/svg.d.ts +10 -0
- package/package.json +74 -4
- package/src/activation.ts +51 -0
- package/src/adapter.ts +42 -0
- package/src/async-data.ts +105 -0
- package/src/client-component.ts +40 -0
- package/src/client-fallback.ts +2 -0
- package/src/context.ts +495 -0
- package/src/env.d.ts +3 -0
- package/src/error-page.ts +1 -0
- package/src/index.ts +1900 -0
- package/src/island-html.ts +58 -0
- package/src/island.ts +55 -0
- package/src/jsx-locator.ts +199 -0
- package/src/keepalive.ts +147 -0
- package/src/lazy-hydration.ts +146 -0
- package/src/markdown-page.ts +18 -0
- package/src/markdown.ts +70 -0
- package/src/plugin.ts +310 -0
- package/src/runtime/client.ts +175 -0
- package/src/runtime/hmr-solid.ts +19 -0
- package/src/runtime/hmr.ts +231 -0
- package/src/runtime/hydration-dev.ts +41 -0
- package/src/runtime/hydration.ts +9 -0
- package/src/runtime/island.ts +66 -0
- package/src/runtime/portal.ts +64 -0
- package/src/runtime/server.ts +160 -0
- package/src/runtime/trusted.ts +16 -0
- package/src/server-island.ts +47 -0
- package/src/solid.d.ts +4 -0
- package/src/svg.ts +53 -0
- package/src/webmcp.d.ts +20 -0
|
@@ -0,0 +1,392 @@
|
|
|
1
|
+
import type { SyncedStateOptions } from "hamur/app";
|
|
2
|
+
import type { Accessor, Setter } from "solid-js";
|
|
3
|
+
import type { AppHooks, WebVitalMetric } from "hamur/app";
|
|
4
|
+
import type { JSX } from "@solidjs/web";
|
|
5
|
+
import type { AnnouncerActions, AnnouncerPoliteness, RouteAnnouncerActions, RouteAnnouncerPoliteness, LoadingIndicatorActions, LoadingIndicatorProps, LoadingIndicatorOptions, TimeInput } from "hamur/adapter";
|
|
6
|
+
import { clearState as clearStateOf } from "hamur/app";
|
|
7
|
+
import type { PreviewMode } from "hamur/app";
|
|
8
|
+
import type { $Fetch, FetchCheckedInput, FetchInputField } from "hamur/app";
|
|
9
|
+
import type { StateKey } from "hamur/app";
|
|
10
|
+
import type { HamurEvent } from "hamur/server";
|
|
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";
|
|
13
|
+
import type { FieldsOf, HamurLinkProps } from "hamur/app";
|
|
14
|
+
import type { ActionFailure, AppContext, FormSubmitArgs, PendingRun, PickFrom, RouteLocation, AsyncDataOptions, ClientRuntimeConfig, SiteConfig, ErrorPageProps, FetchData, AsyncDataStatus, HeadInput, HeadSafeInput, SeoMetaInput, UseCookieOptions, HamurError } from "hamur/app";
|
|
15
|
+
import type { RouteLoaderData, UseDataArgs, AsyncDataHandler, ErrorBoundaryFallbackProps, FetchRequest, GetCachedData, CheckedTarget, NavigationState, RouteValue, RouterApi } from "hamur/adapter";
|
|
16
|
+
export { addRouteMiddleware, clearError, disableScrollHandling, forbidden, navigateTo, notFound, permanentRedirect, refreshCookie, setPageLayout, showError, unauthorized, } from "hamur/app";
|
|
17
|
+
export { defineLazyHydrationComponent } from "./lazy-hydration.ts";
|
|
18
|
+
export { Island } from "./island.ts";
|
|
19
|
+
export type { IslandProps } from "./island.ts";
|
|
20
|
+
export { ServerIsland } from "./server-island.ts";
|
|
21
|
+
export type { ServerIslandProps } from "./server-island.ts";
|
|
22
|
+
export { MarkdownRenderer } from "./markdown.ts";
|
|
23
|
+
export type { MarkdownRendererProps } from "./markdown.ts";
|
|
24
|
+
import type { SetSearch } from "hamur/adapter";
|
|
25
|
+
import type { AppUpdateActions, AppUpdateState } from "hamur/adapter";
|
|
26
|
+
import type { MatchedRoute, RouteDataName, RouteDataOf, RouteError, RouteFor, RouteName } from "hamur/adapter";
|
|
27
|
+
export type { MatchedRoute, RouteDataName, RouteDataOf } from "hamur/adapter";
|
|
28
|
+
export type { NavigateToOptions, PickFrom } from "hamur/app";
|
|
29
|
+
export type { Blocker, BlockerArgs, SnapshotOptions, UseBlockerOptions } from "hamur/adapter";
|
|
30
|
+
export type { AfterNavigateHook, AsyncDataHandler, BeforeNavigateHook, ErrorBoundaryFallbackProps, FetchRequest, GetCachedData, GetCachedDataCause, NavigateHook, NavigateOptions, Navigation, NavigationState, NavigationType, RouteValue, RouterApi, } from "hamur/adapter";
|
|
31
|
+
export declare const Outlet: (props?: {
|
|
32
|
+
context?: unknown;
|
|
33
|
+
name?: string;
|
|
34
|
+
}) => JSX.Element;
|
|
35
|
+
export type { LinkDefaults, LinkSlot, UseLinkOptions } from "hamur/adapter";
|
|
36
|
+
interface LinkBaseProps extends Record<string, unknown>, HamurLinkProps {
|
|
37
|
+
replace?: boolean;
|
|
38
|
+
prefetch?: boolean;
|
|
39
|
+
prefetchOn?: PrefetchOn;
|
|
40
|
+
/** Removed: write `to`. */
|
|
41
|
+
href?: never;
|
|
42
|
+
/** Removed: write `prefetch={false}`. */
|
|
43
|
+
noPrefetch?: never;
|
|
44
|
+
/** The query as a function of the validated search of the page on screen. */
|
|
45
|
+
query?: (prev: RouteValue["search"]) => RouteValue["search"];
|
|
46
|
+
/** A serializable object kept in the history entry the click pushes, read as `useRoute().state`. */
|
|
47
|
+
state?: Record<string, unknown>;
|
|
48
|
+
/** `"route"` resolves a relative `to` against the path of the route, its pattern filled with its params, not the URL. */
|
|
49
|
+
relative?: "route";
|
|
50
|
+
/** The app path the address bar shows while `to` renders. */
|
|
51
|
+
mask?: string;
|
|
52
|
+
/** `false` renders `to` again after a reload of the masked entry. */
|
|
53
|
+
unmaskOnReload?: boolean;
|
|
54
|
+
/** `true` or `{ types }` runs this navigation in a view transition, `false` turns it off. */
|
|
55
|
+
viewTransition?: boolean | {
|
|
56
|
+
types: readonly string[];
|
|
57
|
+
};
|
|
58
|
+
activeClass?: string;
|
|
59
|
+
exactActiveClass?: string;
|
|
60
|
+
/** The class the navigator adds to this anchor while a navigation to it is in flight; `""` adds none. */
|
|
61
|
+
pendingClass?: string;
|
|
62
|
+
ariaCurrentValue?: "page" | "step" | "location" | "date" | "time" | "true";
|
|
63
|
+
/** A plain link the navigator never intercepts, with no prefetch and `rel="external"`. */
|
|
64
|
+
external?: boolean;
|
|
65
|
+
/** No `rel` is added for a `target="_blank"` or an other-origin `to`. */
|
|
66
|
+
noRel?: boolean;
|
|
67
|
+
/** The class the navigator adds to this anchor once its prefetch finished. */
|
|
68
|
+
prefetchedClass?: string;
|
|
69
|
+
/** `false` keeps the scroll position for the navigation the click starts. */
|
|
70
|
+
scroll?: boolean;
|
|
71
|
+
/** ms a hover or focus waits before it prefetches; one that ends sooner prefetches nothing. */
|
|
72
|
+
prefetchDelay?: number;
|
|
73
|
+
/** Runs for a navigation this anchor started, after the `onBeforeNavigate` hooks; `nav.cancel()` stops it. */
|
|
74
|
+
onBeforeNavigate?: (nav: Navigation) => void;
|
|
75
|
+
/** A function renders the link itself: it is given the `LinkSlot` and `Link` renders only what it returns; a function literal given as the child (a data property, not a getter) is the one detected, so no child is evaluated twice. */
|
|
76
|
+
children?: JSX.Element | ((link: LinkSlot) => JSX.Element);
|
|
77
|
+
}
|
|
78
|
+
/** `T` is the string `to`, which is checked against the route table. */
|
|
79
|
+
export type LinkProps<T extends string = string> = LinkBaseProps & {
|
|
80
|
+
to: CheckedTarget<T> | RouteLocation;
|
|
81
|
+
};
|
|
82
|
+
export declare function Link<T extends string = string>(props: LinkProps<T>): JSX.Element;
|
|
83
|
+
/** A `Link` with `defaults` over `app.link`; a prop of the element wins. */
|
|
84
|
+
export declare function defineLink(defaults: LinkDefaults): typeof Link;
|
|
85
|
+
export interface NavigateProps<T extends string = string> {
|
|
86
|
+
to: CheckedTarget<T, false> | RouteLocation;
|
|
87
|
+
replace?: boolean;
|
|
88
|
+
}
|
|
89
|
+
/** Navigates to `to` once after mount; during SSR it throws the redirect `navigateTo` throws there. */
|
|
90
|
+
export declare function Navigate<T extends string = string>(props: NavigateProps<T>): JSX.Element;
|
|
91
|
+
/** The `LinkSlot` of a link to `to`, for an element that renders its own `<a>`; `to` and `options` may be accessors. `app.link` sets its defaults. */
|
|
92
|
+
export declare function useLink<T extends string = string>(to: CheckedTarget<T> | RouteLocation | Accessor<CheckedTarget<T> | RouteLocation>, options?: UseLinkOptions | Accessor<UseLinkOptions>): Accessor<LinkSlot>;
|
|
93
|
+
export declare function useRoute<N extends RouteName>(name: N): Accessor<RouteFor<N>>;
|
|
94
|
+
export declare function useRoute<N extends RouteName = never>(): Accessor<RouteFor<N>>;
|
|
95
|
+
export declare function useRoute(): Accessor<RouteValue>;
|
|
96
|
+
export declare function useResolvedPath(to: string | Accessor<string>, { relative }?: {
|
|
97
|
+
relative?: "route";
|
|
98
|
+
}): Accessor<string>;
|
|
99
|
+
export declare function useRouter(): RouterApi;
|
|
100
|
+
interface FormBaseProps extends Record<string, unknown> {
|
|
101
|
+
encType?: "application/x-www-form-urlencoded" | "multipart/form-data";
|
|
102
|
+
replace?: boolean;
|
|
103
|
+
reset?: boolean;
|
|
104
|
+
reloadDocument?: boolean;
|
|
105
|
+
refresh?: boolean;
|
|
106
|
+
/** With a server function: the store of `useAction(fn, { instance })` this form belongs to. */
|
|
107
|
+
instance?: string | number;
|
|
108
|
+
restore?: boolean;
|
|
109
|
+
onSubmit?: (args: FormSubmitArgs) => void;
|
|
110
|
+
children?: JSX.Element;
|
|
111
|
+
}
|
|
112
|
+
export type FormProps<N extends string = string> = FormBaseProps &
|
|
113
|
+
/** A server function posts to this page with `?_fn=<id>`. */
|
|
114
|
+
({
|
|
115
|
+
action: ((...args: never[]) => unknown) & {
|
|
116
|
+
readonly url: string;
|
|
117
|
+
};
|
|
118
|
+
method?: "post";
|
|
119
|
+
} | {
|
|
120
|
+
action?: string | (RouteLocation & {
|
|
121
|
+
name: N;
|
|
122
|
+
});
|
|
123
|
+
method?: "get";
|
|
124
|
+
});
|
|
125
|
+
export declare function Form<N extends string = string>(props: FormProps<N>): JSX.Element;
|
|
126
|
+
export declare function useFormStatus(): {
|
|
127
|
+
pending: Accessor<boolean>;
|
|
128
|
+
data: Accessor<FormData | null>;
|
|
129
|
+
action: Accessor<string | null>;
|
|
130
|
+
};
|
|
131
|
+
interface UseFormInstance<I, O> {
|
|
132
|
+
readonly fields: FieldsOf<I>;
|
|
133
|
+
pending: Accessor<boolean>;
|
|
134
|
+
result: Accessor<O | undefined>;
|
|
135
|
+
}
|
|
136
|
+
export declare function useForm<I, O>(fn: Handler<I, O>): UseFormInstance<I, O> & {
|
|
137
|
+
for(key: string | number): UseFormInstance<I, O>;
|
|
138
|
+
};
|
|
139
|
+
export declare function useAction<I, O>(fn: Handler<I, O>, options?: ActionOptions<O> & {
|
|
140
|
+
instance?: string | number;
|
|
141
|
+
}): {
|
|
142
|
+
run: ActionRunner<I, O>["run"];
|
|
143
|
+
state: Accessor<O | undefined>;
|
|
144
|
+
pending: Accessor<boolean>;
|
|
145
|
+
error: Accessor<HamurError | undefined>;
|
|
146
|
+
failure: Accessor<ActionFailure | undefined>;
|
|
147
|
+
reset(): void;
|
|
148
|
+
};
|
|
149
|
+
export declare function ClientOnly(props: {
|
|
150
|
+
children?: JSX.Element;
|
|
151
|
+
fallback?: JSX.Element;
|
|
152
|
+
}): JSX.Element;
|
|
153
|
+
export declare function useId(): string;
|
|
154
|
+
export declare function useHydrated(): Accessor<boolean>;
|
|
155
|
+
export interface ClientFallbackProps {
|
|
156
|
+
fallback?: JSX.Element;
|
|
157
|
+
keepFallback?: boolean;
|
|
158
|
+
onSsrError?: (error: unknown) => unknown;
|
|
159
|
+
children?: JSX.Element;
|
|
160
|
+
}
|
|
161
|
+
/** A throw in `children` during SSR renders `fallback` in the HTML; the browser renders `children` again from scratch. */
|
|
162
|
+
export declare function ClientFallback(props: ClientFallbackProps): JSX.Element;
|
|
163
|
+
export declare function DevOnly(props: {
|
|
164
|
+
children?: JSX.Element;
|
|
165
|
+
fallback?: JSX.Element;
|
|
166
|
+
}): JSX.Element;
|
|
167
|
+
export interface AwaitProps<T> {
|
|
168
|
+
resolve: T;
|
|
169
|
+
fallback?: JSX.Element;
|
|
170
|
+
error?: (error: Error) => JSX.Element;
|
|
171
|
+
children: (value: Awaited<T>) => JSX.Element;
|
|
172
|
+
}
|
|
173
|
+
/** An async memo under `Loading`, so the server streams the fallback and the client hydrates the settled outcome; a settled value renders in place on both sides. */
|
|
174
|
+
export declare function Await<T>(props: AwaitProps<T>): JSX.Element;
|
|
175
|
+
export declare function useDeferred<T>(promise: T): Accessor<Awaited<T> | undefined>;
|
|
176
|
+
export type TimeProps = TimeInput & Omit<JSX.HTMLAttributes<HTMLTimeElement>, keyof TimeInput>;
|
|
177
|
+
export declare function Time(props: TimeProps): JSX.Element;
|
|
178
|
+
export type { LoadingIndicatorProps } from "hamur/adapter";
|
|
179
|
+
export declare function useLoadingIndicator(options?: LoadingIndicatorOptions): {
|
|
180
|
+
progress: Accessor<number>;
|
|
181
|
+
isLoading: Accessor<boolean>;
|
|
182
|
+
error: Accessor<boolean>;
|
|
183
|
+
} & LoadingIndicatorActions;
|
|
184
|
+
export declare function useAppUpdate(): {
|
|
185
|
+
[K in keyof AppUpdateState]: Accessor<AppUpdateState[K]>;
|
|
186
|
+
} & AppUpdateActions;
|
|
187
|
+
export declare function LoadingIndicator(props: LoadingIndicatorProps): JSX.Element;
|
|
188
|
+
export declare function useRouteAnnouncer(): {
|
|
189
|
+
message: Accessor<string>;
|
|
190
|
+
politeness: Accessor<RouteAnnouncerPoliteness>;
|
|
191
|
+
} & RouteAnnouncerActions;
|
|
192
|
+
export declare function RouteAnnouncer(props: {
|
|
193
|
+
politeness?: RouteAnnouncerPoliteness;
|
|
194
|
+
class?: string;
|
|
195
|
+
style?: string | JSX.CSSProperties;
|
|
196
|
+
}): JSX.Element;
|
|
197
|
+
export declare function useAnnouncer({ politeness }?: {
|
|
198
|
+
politeness?: AnnouncerPoliteness;
|
|
199
|
+
}): {
|
|
200
|
+
message: Accessor<string>;
|
|
201
|
+
politeness: Accessor<AnnouncerPoliteness>;
|
|
202
|
+
} & AnnouncerActions;
|
|
203
|
+
export declare function Announcer(): JSX.Element;
|
|
204
|
+
export declare function useData<T = unknown>(...unknownRoute: UseDataArgs<T>): Accessor<RouteLoaderData<T>>;
|
|
205
|
+
export declare function useOutletContext<T = unknown>(): Accessor<T>;
|
|
206
|
+
export declare function useLayoutSegments(): Accessor<string[]>;
|
|
207
|
+
export declare function useLayoutSegment(): Accessor<string | null>;
|
|
208
|
+
export declare function useLayout(): Accessor<{
|
|
209
|
+
name: string | false;
|
|
210
|
+
props: Record<string, unknown>;
|
|
211
|
+
}>;
|
|
212
|
+
export declare function useRouteData<N extends RouteDataName>(name: N): Accessor<RouteDataOf<N>>;
|
|
213
|
+
export declare function useMatches(): Accessor<MatchedRoute[]>;
|
|
214
|
+
export declare function useSearch(): {
|
|
215
|
+
value: Accessor<RouteValue["search"]>;
|
|
216
|
+
set: SetSearch;
|
|
217
|
+
};
|
|
218
|
+
export declare function useSearch<S>(select: (search: RouteValue["search"]) => S): {
|
|
219
|
+
value: Accessor<S>;
|
|
220
|
+
set: SetSearch;
|
|
221
|
+
};
|
|
222
|
+
export declare function usePoll(ms: number, options?: {
|
|
223
|
+
keys?: string[];
|
|
224
|
+
}): void;
|
|
225
|
+
export declare function useOnline(): Accessor<boolean>;
|
|
226
|
+
export declare function useSyncedState<T>(key: string, initial: T, options?: SyncedStateOptions): [Accessor<T>, Setter<T>];
|
|
227
|
+
export declare function useOptimistic<T, A = PendingRun>(value: T | Accessor<T>, reduce: (current: T, pending: A[]) => T): Accessor<T>;
|
|
228
|
+
export declare function useError(): Accessor<RouteError | undefined>;
|
|
229
|
+
export declare function ErrorBoundary(props: {
|
|
230
|
+
fallback: (props: ErrorBoundaryFallbackProps) => JSX.Element;
|
|
231
|
+
children?: JSX.Element;
|
|
232
|
+
}): JSX.Element;
|
|
233
|
+
export declare function DefaultErrorPage(props: {
|
|
234
|
+
error: ErrorPageProps;
|
|
235
|
+
}): JSX.Element;
|
|
236
|
+
export declare function useApp(): AppContext;
|
|
237
|
+
export declare function useRuntimeHook<K extends keyof AppHooks>(name: K, fn: AppHooks[K]): void;
|
|
238
|
+
export declare function useReportWebVitals(fn: (metric: WebVitalMetric) => void | Promise<void>): void;
|
|
239
|
+
export declare function onAppReady(fn: () => void | Promise<void>): void;
|
|
240
|
+
export declare function onPrehydrate(fn: (el: Element) => void): string | undefined;
|
|
241
|
+
export declare function useRequestEvent(): HamurEvent | undefined;
|
|
242
|
+
/** Preview mode: enabled by the payload's `draft` or by `?preview=true` on the first URL; `state` is the app's own store for preview values. */
|
|
243
|
+
export declare function usePreviewMode(): PreviewMode;
|
|
244
|
+
export declare function useRequestHeaders(names?: readonly string[]): Record<string, string>;
|
|
245
|
+
export declare function useRequestHeader(name: string): string | undefined;
|
|
246
|
+
export declare function useRequestURL(): URL;
|
|
247
|
+
export declare function useRequestFetch(): $Fetch;
|
|
248
|
+
export declare function setResponseStatus(status: number, statusText?: string): void;
|
|
249
|
+
export declare function useResponseHeader(name: string): [Accessor<string | undefined>, (value: string | undefined) => void];
|
|
250
|
+
export declare function HttpStatusCode(props: {
|
|
251
|
+
code: number;
|
|
252
|
+
text?: string;
|
|
253
|
+
}): JSX.Element;
|
|
254
|
+
export declare function HttpHeader(props: {
|
|
255
|
+
name: string;
|
|
256
|
+
value: string;
|
|
257
|
+
}): JSX.Element;
|
|
258
|
+
export declare function useAsyncDataEntry<T = unknown>(key: string): {
|
|
259
|
+
data: Accessor<T | undefined>;
|
|
260
|
+
setData(data: T): void;
|
|
261
|
+
};
|
|
262
|
+
export declare function useAsyncDataEntry<I, O>(fn: Handler<I, O>, input?: I): {
|
|
263
|
+
data: Accessor<O | undefined>;
|
|
264
|
+
setData(data: O): void;
|
|
265
|
+
};
|
|
266
|
+
export declare function clearState(keys?: Parameters<typeof clearStateOf>[1], options?: {
|
|
267
|
+
reset?: boolean;
|
|
268
|
+
}): void;
|
|
269
|
+
export declare function callOnce(key: string, fn: () => unknown | Promise<unknown>, options?: {
|
|
270
|
+
mode?: "render" | "navigation";
|
|
271
|
+
}): Promise<void>;
|
|
272
|
+
export declare function useRuntimeConfig(): ClientRuntimeConfig;
|
|
273
|
+
export declare function useSiteConfig(): SiteConfig;
|
|
274
|
+
export declare const onBeforeNavigate: (fn: BeforeNavigateHook) => void;
|
|
275
|
+
export declare const onNavigate: (fn: NavigateHook) => void;
|
|
276
|
+
export declare const onAfterNavigate: (fn: AfterNavigateHook) => void;
|
|
277
|
+
/** Runs `fn` after the component mounts and each time its kept page is shown again. */
|
|
278
|
+
export declare function onPageActivated(fn: () => void): void;
|
|
279
|
+
/** Runs `fn` each time its kept page is hidden and when the component unmounts on screen. */
|
|
280
|
+
export declare function onPageDeactivated(fn: () => void): void;
|
|
281
|
+
export declare const onBeforeRouteLeave: (fn: NavigationGuard) => void;
|
|
282
|
+
export declare const onBeforeRouteUpdate: (fn: NavigationGuard) => void;
|
|
283
|
+
export declare const usePreventNavigate: (fn: NavigationBlocker) => void;
|
|
284
|
+
export declare function useBlocker(options: ShouldBlock | UseBlockerOptions): Accessor<Blocker>;
|
|
285
|
+
export declare const useSnapshot: <T>(key: string, options: SnapshotOptions<T>) => void;
|
|
286
|
+
export declare function useNavigation(): Accessor<NavigationState>;
|
|
287
|
+
/** Inside a `Link`'s children, whether a navigation to that link is in flight; `pending` is false anywhere else. */
|
|
288
|
+
export declare function useLinkStatus(): {
|
|
289
|
+
pending: Accessor<boolean>;
|
|
290
|
+
};
|
|
291
|
+
export declare function useHead(input: HeadInput | (() => HeadInput)): void;
|
|
292
|
+
export declare function useSeoMeta(input: SeoMetaInput | (() => SeoMetaInput)): void;
|
|
293
|
+
type ServerHeadInput = Omit<HeadInput, "title" | "titleTemplate">;
|
|
294
|
+
type ServerSeoMetaInput = Omit<SeoMetaInput, "title" | "titleTemplate">;
|
|
295
|
+
export declare function useHeadSafe(input: HeadSafeInput | (() => HeadSafeInput)): void;
|
|
296
|
+
type HeadProps<K extends "meta" | "link" | "script" | "style"> = NonNullable<HeadInput[K]>[number] & {
|
|
297
|
+
children?: never;
|
|
298
|
+
};
|
|
299
|
+
type HeadAttrsProps = Record<string, string> & {
|
|
300
|
+
children?: never;
|
|
301
|
+
};
|
|
302
|
+
export declare function HeadTitle(props: {
|
|
303
|
+
title: string;
|
|
304
|
+
template?: string;
|
|
305
|
+
children?: never;
|
|
306
|
+
}): JSX.Element;
|
|
307
|
+
export declare function HeadMeta(props: HeadProps<"meta">): JSX.Element;
|
|
308
|
+
export declare function HeadLink(props: HeadProps<"link">): JSX.Element;
|
|
309
|
+
export declare function HeadScript(props: HeadProps<"script">): JSX.Element;
|
|
310
|
+
export declare function HeadStyle(props: HeadProps<"style">): JSX.Element;
|
|
311
|
+
export declare function HtmlAttrs(props: HeadAttrsProps): JSX.Element;
|
|
312
|
+
export declare function BodyAttrs(props: HeadAttrsProps): JSX.Element;
|
|
313
|
+
export declare function useServerHead(input: ServerHeadInput | (() => ServerHeadInput)): void;
|
|
314
|
+
export declare function useServerSeoMeta(input: ServerSeoMetaInput | (() => ServerSeoMetaInput)): void;
|
|
315
|
+
export declare function useState<T>(key: StateKey<T>): [Accessor<T>, (next: T | ((prev: T) => T)) => T];
|
|
316
|
+
export declare function useState<T = unknown>(key: string, init?: T | (() => T)): [Accessor<T>, (next: T | ((prev: T) => T)) => T];
|
|
317
|
+
export declare function useCookie<T = string>(name: string, options: Omit<UseCookieOptions<T>, "app"> & {
|
|
318
|
+
default: () => T;
|
|
319
|
+
}): [Accessor<T>, (next: T | undefined) => void];
|
|
320
|
+
export declare function useCookie<T = string>(name: string, options?: Omit<UseCookieOptions<T>, "app">): [Accessor<T | undefined>, (next: T | undefined) => void];
|
|
321
|
+
export interface UseAsyncDataOptions<T = unknown, R = T, K extends keyof T & string = never, D = T> extends Omit<AsyncDataOptions<T, R, D>, "pick"> {
|
|
322
|
+
/** Accessors whose change re-runs the handler. `false` is accepted and does nothing: nothing watches implicitly. */
|
|
323
|
+
watch?: ReadonlyArray<() => unknown> | false;
|
|
324
|
+
getCachedData?: GetCachedData<T>;
|
|
325
|
+
/** Top-level keys of an object result to keep. */
|
|
326
|
+
pick?: readonly K[];
|
|
327
|
+
}
|
|
328
|
+
export interface UseAsyncDataResult<T, D = undefined> {
|
|
329
|
+
data: Accessor<T | D>;
|
|
330
|
+
error: Accessor<HamurError | undefined>;
|
|
331
|
+
status: Accessor<AsyncDataStatus>;
|
|
332
|
+
/** `status === "pending"`, or `idle` without data under `app.asyncData.pendingWhenIdle`. */
|
|
333
|
+
pending: Accessor<boolean>;
|
|
334
|
+
refresh(): Promise<void>;
|
|
335
|
+
/** The same function as `refresh`. */
|
|
336
|
+
execute(): Promise<void>;
|
|
337
|
+
/** Resets the entry of the current key to `idle` (`clearAsyncData`). */
|
|
338
|
+
clear(): void;
|
|
339
|
+
}
|
|
340
|
+
export interface UseFetchOptions<T = unknown, R = T, K extends keyof T & string = never, D = T> extends FetchRequest, UseAsyncDataOptions<T, R, K, D> {
|
|
341
|
+
/** The store key, instead of the one derived from the url and the request. */
|
|
342
|
+
key?: string;
|
|
343
|
+
}
|
|
344
|
+
export declare function useAsyncData<I, R, T = R, K extends keyof T & string = never, D = T>(fn: Handler<I, R>, input: NoInfer<I> | Accessor<NoInfer<I>> | undefined, options: UseAsyncDataOptions<T, R, K, D> & {
|
|
345
|
+
default: () => D;
|
|
346
|
+
}): UseAsyncDataResult<PickFrom<T, K>, D>;
|
|
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 = unknown, R = T, K extends keyof T & string = never, D = T>(key: string | Accessor<string>, handler: AsyncDataHandler<R>, options: UseAsyncDataOptions<T, R, K, D> & {
|
|
349
|
+
default: () => D;
|
|
350
|
+
}): UseAsyncDataResult<PickFrom<T, K>, D>;
|
|
351
|
+
export declare function useAsyncData<T = unknown, R = T, K extends keyof T & string = never>(key: string | Accessor<string>, handler: AsyncDataHandler<R>, options?: UseAsyncDataOptions<T, R, K, undefined>): UseAsyncDataResult<PickFrom<T, K>>;
|
|
352
|
+
/** What a literal `useFetch` call is checked against; any other call stays loose. */
|
|
353
|
+
type FetchInput<X> = X extends {
|
|
354
|
+
key: infer K extends string;
|
|
355
|
+
input: infer I;
|
|
356
|
+
} ? FetchInputField<I, K, I | (() => I)> : unknown;
|
|
357
|
+
type Unkeyed<O, X> = X extends {
|
|
358
|
+
key: infer K extends string;
|
|
359
|
+
} ? Omit<O, K> : O;
|
|
360
|
+
type FetchCall<U extends string, M extends string, B extends string | undefined> = {
|
|
361
|
+
method?: M | string;
|
|
362
|
+
baseURL?: B | string;
|
|
363
|
+
} & FetchInput<FetchCheckedInput<U, M, B>>;
|
|
364
|
+
export declare function useFetch<U extends string, M extends string = "GET", K extends keyof FetchData<U, M> & string = never, D = undefined, B extends string | undefined = undefined>(url: U | Accessor<U>, options?: Unkeyed<UseFetchOptions<FetchData<U, M>, FetchData<U, M>, K, D>, FetchCheckedInput<U, M, B>> & FetchCall<U, M, B>): UseAsyncDataResult<PickFrom<FetchData<U, M>, K>, D>;
|
|
365
|
+
export declare function useFetch<T = unknown, R = T, K extends keyof T & string = never, D = T, U extends string = string, M extends string = "GET", B extends string | undefined = undefined>(url: U | Accessor<U>, options: Unkeyed<UseFetchOptions<T, R, K, D>, FetchCheckedInput<U, M, B>> & {
|
|
366
|
+
default: () => D;
|
|
367
|
+
} & FetchCall<U, M, B>): UseAsyncDataResult<PickFrom<T, K>, D>;
|
|
368
|
+
export declare function useFetch<T = unknown, R = T, K extends keyof T & string = never, U extends string = string, M extends string = "GET", B extends string | undefined = undefined>(url: U | Accessor<U>, options?: Unkeyed<UseFetchOptions<T, R, K, undefined>, FetchCheckedInput<U, M, B>> & FetchCall<U, M, B>): UseAsyncDataResult<PickFrom<T, K>>;
|
|
369
|
+
/** `createUseFetch` defaults change what a call sends (method, body, query, baseURL), so its calls check nothing. */
|
|
370
|
+
interface UseFetchLoose {
|
|
371
|
+
<U extends string, M extends string = "GET", K extends keyof FetchData<U, M> & string = never, D = undefined>(url: U | Accessor<U>, options?: UseFetchOptions<FetchData<U, M>, FetchData<U, M>, K, D> & {
|
|
372
|
+
method?: M;
|
|
373
|
+
}): UseAsyncDataResult<PickFrom<FetchData<U, M>, K>, D>;
|
|
374
|
+
<T = unknown, R = T, K extends keyof T & string = never, D = T>(url: string | Accessor<string>, options: UseFetchOptions<T, R, K, D> & {
|
|
375
|
+
default: () => D;
|
|
376
|
+
}): UseAsyncDataResult<PickFrom<T, K>, D>;
|
|
377
|
+
<T = unknown, R = T, K extends keyof T & string = never>(url: string | Accessor<string>, options?: UseFetchOptions<T, R, K, undefined>): UseAsyncDataResult<PickFrom<T, K>>;
|
|
378
|
+
}
|
|
379
|
+
type AnyFetchOptions = UseFetchOptions<any, any, any, any>;
|
|
380
|
+
/** `useFetch` with `defaults` under every call's options; `$fetch` replaces the request-bound client, e.g. a `$fetch.create` one. */
|
|
381
|
+
export declare function createUseFetch(defaults: AnyFetchOptions | ((options: AnyFetchOptions) => AnyFetchOptions), { $fetch: client }?: {
|
|
382
|
+
$fetch?: $Fetch;
|
|
383
|
+
}): UseFetchLoose;
|
|
384
|
+
/** `useAsyncData` with `defaults` under every call's options. */
|
|
385
|
+
export declare function createUseAsyncData(defaults: UseAsyncDataOptions<any, any, any, any> | ((options: UseAsyncDataOptions<any, any, any, any>) => UseAsyncDataOptions<any, any, any, any>)): typeof useAsyncData;
|
|
386
|
+
export declare const useLazyFetch: typeof useFetch;
|
|
387
|
+
export declare const useLazyAsyncData: typeof useAsyncData;
|
|
388
|
+
export declare function transitionName(name: string): {
|
|
389
|
+
style: {
|
|
390
|
+
"view-transition-name": string;
|
|
391
|
+
};
|
|
392
|
+
};
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { AppContext } from "hamur/app";
|
|
2
|
+
/**
|
|
3
|
+
* The HTML of an island whose root has finished rendering (or the attributes of a server island), or `undefined` while it renders, recorded in `pending`
|
|
4
|
+
* so the render is done again once it has settled. A failed island throws where its `Island` renders, so the nearest
|
|
5
|
+
* route boundary shows the error. An island's HTML is always rendered in its place, never spliced into the markup.
|
|
6
|
+
*/
|
|
7
|
+
export declare function settledIsland<T = string>(promise: Promise<T>, pending?: Promise<void>[] | undefined): T | undefined;
|
|
8
|
+
/** Runs a synchronous render whose `Island`s record the islands still rendering in `pending`. */
|
|
9
|
+
export declare function collectingIslands<T>(pending: Promise<void>[], render: () => T): T;
|
|
10
|
+
/** A pass of `renderInPasses` that met islands still rendering waits for them and is dropped, so the next pass renders them in place. */
|
|
11
|
+
export declare function islandsSettled(app: AppContext, pending: Promise<void>[]): Promise<void>;
|
|
12
|
+
/** An island's own root, rendered again until every island inside it has settled. */
|
|
13
|
+
export declare function renderSettled<T>(render: (pending: Promise<void>[]) => T | Promise<T>): Promise<T>;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import type { Component } from "solid-js";
|
|
2
|
+
import type { JSX } from "@solidjs/web";
|
|
3
|
+
import { type IslandOn } from "hamur/adapter";
|
|
4
|
+
export interface IslandProps<P extends Record<string, any>> {
|
|
5
|
+
/** The default export of a file under `app/islands/`. */
|
|
6
|
+
component: Component<P>;
|
|
7
|
+
props?: P;
|
|
8
|
+
/** The island directive: when the island hydrates, `"only"` to mount it in the browser alone, or a directive a module adds; default `"load"`. */
|
|
9
|
+
on?: IslandOn;
|
|
10
|
+
/** The island's id across swaps; a swap to a page with the same id keeps its element and state. */
|
|
11
|
+
persist?: string;
|
|
12
|
+
/** With `persist`, a swap keeps the island's old props. */
|
|
13
|
+
persistProps?: boolean;
|
|
14
|
+
/** What the server renders in place of the island under `on="only"`. */
|
|
15
|
+
fallback?: JSX.Element;
|
|
16
|
+
/** Rendered on the server only and given to the island as its `children`, inside `<hamur-slot>`; never hydrated. */
|
|
17
|
+
children?: JSX.Element;
|
|
18
|
+
}
|
|
19
|
+
/** On an island page, `component` rendered as a root of its own inside `<hamur-island>`, hydrated on its own in the browser. */
|
|
20
|
+
export declare function Island<P extends Record<string, any>>(props: IslandProps<P>): JSX.Element;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The source locator: adds `data-hamur-src="<file>:<line>:<column>"` to the host element each component of
|
|
3
|
+
* `source` returns from its own body (a capitalised function or arrow, a default export, `memo` and `forwardRef`
|
|
4
|
+
* around one); the position is the element's `<`, 1-based. Insertions stay on their line, so no line moves.
|
|
5
|
+
*/
|
|
6
|
+
export declare function locateJsx(source: string, file: string): string;
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import type { Accessor, Context, createComponent, createEffect, createMemo, mapArray, onCleanup, untrack, useContext } from "solid-js";
|
|
2
|
+
import type { JSX, dynamic } from "@solidjs/web";
|
|
3
|
+
import type { KeptUnit } from "hamur/adapter";
|
|
4
|
+
import type { Activation, activation, detach, setHidden } from "./activation.ts";
|
|
5
|
+
import type { AppState, Props, routeValue } from "./context.ts";
|
|
6
|
+
/** What the outlet takes from the adapter's base: this module imports nothing at run time, so loading it splits no chunk of the base. */
|
|
7
|
+
export interface KeepAliveBase {
|
|
8
|
+
createComponent: typeof createComponent;
|
|
9
|
+
createEffect: typeof createEffect;
|
|
10
|
+
createMemo: typeof createMemo;
|
|
11
|
+
mapArray: typeof mapArray;
|
|
12
|
+
onCleanup: typeof onCleanup;
|
|
13
|
+
untrack: typeof untrack;
|
|
14
|
+
useContext: typeof useContext;
|
|
15
|
+
dynamic: typeof dynamic;
|
|
16
|
+
ActivationContext: Context<Activation | null>;
|
|
17
|
+
AppContext: Context<Accessor<AppState> | null>;
|
|
18
|
+
activation: typeof activation;
|
|
19
|
+
detach: typeof detach;
|
|
20
|
+
setHidden: typeof setHidden;
|
|
21
|
+
routeValue: typeof routeValue;
|
|
22
|
+
holderOf(state: AppState, index: number): {
|
|
23
|
+
kept?: KeptUnit[];
|
|
24
|
+
} | undefined;
|
|
25
|
+
Nest(props: Props & {
|
|
26
|
+
bare?: boolean;
|
|
27
|
+
}): JSX.Element;
|
|
28
|
+
}
|
|
29
|
+
/** A place that renders a page level while keep-alive is on: each kept unit, then the current entry, keyed by the keep-alive key. */
|
|
30
|
+
export declare function createKeptOutlet({ createComponent, createEffect, createMemo, mapArray, onCleanup, untrack, useContext, dynamic, ActivationContext, AppContext, activation, detach, setHidden, routeValue, holderOf, Nest, }: KeepAliveBase): (props: Props) => JSX.Element;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { Component } from "solid-js";
|
|
2
|
+
import type { HydrateOn, HydrateOnOptions } from "hamur/adapter";
|
|
3
|
+
type Props = Record<string, any>;
|
|
4
|
+
type Module<P extends Props> = {
|
|
5
|
+
default: Component<P>;
|
|
6
|
+
};
|
|
7
|
+
/** The server renders synchronously, so `render` awaits the lazy modules still loading before each pass. */
|
|
8
|
+
export declare function lazyModules(): Promise<unknown> | undefined;
|
|
9
|
+
/** Renders the component on the server and, after hydration, keeps its server DOM until `on` fires; after a client navigation it mounts at once. */
|
|
10
|
+
export declare function defineLazyHydrationComponent<P extends Props>(on: HydrateOn, loader: () => Promise<Module<P>>, options?: Omit<HydrateOnOptions, "signal">): Component<P & {
|
|
11
|
+
onHydrated?: () => void;
|
|
12
|
+
}>;
|
|
13
|
+
export {};
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { type Component } from "solid-js";
|
|
2
|
+
import { type JSX } from "@solidjs/web";
|
|
3
|
+
import type { MarkdownDocument, MdNode } from "hamur/markdown";
|
|
4
|
+
export interface MarkdownRendererProps {
|
|
5
|
+
/** A Markdown AST node, a list of nodes, or a document, which renders its `ast`. */
|
|
6
|
+
value: MdNode | MdNode[] | MarkdownDocument;
|
|
7
|
+
/** Components by Markdown component name (kebab case); each gets the node's props as written, `children` and a prop per named slot. */
|
|
8
|
+
components?: Record<string, Component<any>>;
|
|
9
|
+
/** Renders `html` nodes, writing what it returns as their inner HTML; without it they are left out. A Markdown page under config `markdown.html` passes the core's Trusted Types writer. */
|
|
10
|
+
raw?: (html: string) => string;
|
|
11
|
+
}
|
|
12
|
+
/** Renders the Markdown AST through `dynamic`, an internal link as `Link`, a component node as its component in `components`. */
|
|
13
|
+
export declare function MarkdownRenderer(props: MarkdownRendererProps): JSX.Element;
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import type { AdapterBuildContext, AdapterTransform } from "hamur/adapter";
|
|
2
|
+
/**
|
|
3
|
+
* One `<binding>=<call>` entry per call in source order; the calls in `withArguments`
|
|
4
|
+
* also carry their arguments, so reordering or swapping two of them changes the signature.
|
|
5
|
+
*/
|
|
6
|
+
export declare function refreshSignature(source: string, calls: RegExp, withArguments: ReadonlySet<string>): string;
|
|
7
|
+
export interface RefreshOptions {
|
|
8
|
+
/** Path relative to `rootDir`, also the module's key in the hot runtime. */
|
|
9
|
+
id: string;
|
|
10
|
+
/** Pages, layouts and `app.<ext>` accept themselves even with other exports (`meta`). */
|
|
11
|
+
route: boolean;
|
|
12
|
+
runtime?: string;
|
|
13
|
+
}
|
|
14
|
+
export interface RefreshResult {
|
|
15
|
+
code: string;
|
|
16
|
+
signature: string;
|
|
17
|
+
accepted: boolean;
|
|
18
|
+
}
|
|
19
|
+
/**
|
|
20
|
+
* Wraps every component export in the hot runtime and bakes the module's refresh signature. A component is
|
|
21
|
+
* a capitalised function or arrow whose declaration renders JSX. Its binding stays the module's own (a hoisted
|
|
22
|
+
* `function` or a `let`) and is reassigned to the wrapper at the end, so the export, a circular importer and the
|
|
23
|
+
* module's other components all see the wrapper once the module has run.
|
|
24
|
+
*/
|
|
25
|
+
export declare function refreshTransform(source: string, { id, route, runtime }: RefreshOptions): RefreshResult;
|
|
26
|
+
/** The module's path relative to `rootDir` when it is an app source (not under `node_modules` or the build dir). */
|
|
27
|
+
export declare function appModuleId(rootDir: string, buildDir: string): (path: string) => string | undefined;
|
|
28
|
+
/**
|
|
29
|
+
* Points the `solid-js` import and export statements of an app module at the dev shim.
|
|
30
|
+
* Done on the source, not with `onResolve`: Bun's dev bundler re-sends a module an `onResolve` redirected, with the
|
|
31
|
+
* `solid-js` it re-exports, on every hot update of an importer, which evaluates a second Solid. Only statements that
|
|
32
|
+
* start a line are rewritten, so strings and comments keep their text.
|
|
33
|
+
*/
|
|
34
|
+
export declare function shimImports(source: string): string;
|
|
35
|
+
/** The server build takes `Portal` from the adapter, because @solidjs/web's server `Portal` renders nothing. */
|
|
36
|
+
export declare function serverPortal(code: string): string;
|
|
37
|
+
export declare function compileSolid(path: string, source: string, target: "client" | "server"): Promise<string>;
|
|
38
|
+
export declare function solidPlugin({ target, dev, hmr, rootDir, buildDir }: AdapterBuildContext): AdapterTransform;
|
|
39
|
+
/** The file each Solid specifier has under the `browser` and `development` conditions, read from its package's `exports`; `@solidjs/signals` is the one `solid-js` depends on. */
|
|
40
|
+
export declare function solidDevFiles(rootDir: string): Record<string, string>;
|
|
41
|
+
/** In `hamur dev` every import of `solid-js`, `@solidjs/web` and `@solidjs/signals`, in the app, the adapter and other packages alike, reaches the development build, so one Solid runs and its devtools hooks exist. */
|
|
42
|
+
export declare function solidDevBuild({ rootDir }: AdapterBuildContext): AdapterTransform;
|
|
43
|
+
/** In `hamur dev` the client runtime imports `runtime/hydration-dev.ts` first, which feeds the hydration mismatch report; a build adds nothing. */
|
|
44
|
+
export declare function solidHydrationPlugin(): AdapterTransform;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { Component } from "solid-js";
|
|
2
|
+
import type { ClientContext } from "hamur/adapter";
|
|
3
|
+
export { installKeepAlive } from "../context.ts";
|
|
4
|
+
export declare const hydrationCanBeAborted = true;
|
|
5
|
+
/** Disposes the root and renders it again with the same app state; the dev hot runtime calls it after a swap. */
|
|
6
|
+
export declare function remountRoot(): void;
|
|
7
|
+
export declare function hydrate(ctx: ClientContext): Promise<void>;
|
|
8
|
+
export declare function mount(ctx: ClientContext): Promise<void>;
|
|
9
|
+
/** Solid batches a write until the microtask; the contract has the page in the DOM when `update` returns. */
|
|
10
|
+
export declare function update(ctx: ClientContext): void | Promise<void>;
|
|
11
|
+
export { clientComponent } from "../client-component.ts";
|
|
12
|
+
/** The client side of a server-only component: the server HTML, never hydrated; a new props text fetches it anew. */
|
|
13
|
+
export declare function serverComponent(name: string): Component<Record<string, unknown>>;
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { createSignal as solidCreateSignal, createStore as solidCreateStore } from "solid-js";
|
|
2
|
+
export * from "solid-js";
|
|
3
|
+
/** Dev only: app modules import `solid-js` from here, so a hot update starts from the last value; a function form is derived and computed again, so nothing of it is kept. */
|
|
4
|
+
export declare const createSignal: typeof solidCreateSignal;
|
|
5
|
+
export declare const createStore: typeof solidCreateStore;
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import type { Component } from "solid-js";
|
|
2
|
+
interface Slot {
|
|
3
|
+
impl: Component<any>;
|
|
4
|
+
wrapper: Component<any>;
|
|
5
|
+
}
|
|
6
|
+
export interface HotModule {
|
|
7
|
+
readonly id: string;
|
|
8
|
+
signature: string;
|
|
9
|
+
version: string;
|
|
10
|
+
/** The namespaces of the modules it imports: a new one means that module ran again. */
|
|
11
|
+
dependencies: readonly unknown[];
|
|
12
|
+
next?: {
|
|
13
|
+
signature: string;
|
|
14
|
+
version: string;
|
|
15
|
+
dependencies: readonly unknown[];
|
|
16
|
+
};
|
|
17
|
+
slots: Map<string, Slot>;
|
|
18
|
+
component<P extends object>(name: string, impl: Component<P>): Component<P>;
|
|
19
|
+
commit(): void;
|
|
20
|
+
}
|
|
21
|
+
/** The value a shimmed `createSignal`/`createStore` starts from: the previous render's value at this position, or `initial`. */
|
|
22
|
+
export declare function restored<T>(initial: T): T;
|
|
23
|
+
/** Records how to read a signal or store the current instance's own body just created. */
|
|
24
|
+
export declare function track(read: () => unknown): void;
|
|
25
|
+
/** One per module version, `previous` is what the module's last version returned. */
|
|
26
|
+
export declare function hotModule(previous: HotModule | undefined, id: string, signature: string, version: string, dependencies?: readonly unknown[]): HotModule;
|
|
27
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/** What `hydration-dev.ts` hands the client runtime in `hamur dev`; a production client never sets it. */
|
|
2
|
+
export interface HydrationWatch {
|
|
3
|
+
/** An error the root boundary caught; Solid's own hydration mismatch error is reported. */
|
|
4
|
+
failed(error: unknown): void;
|
|
5
|
+
/** `hydrate` returned; `remount` renders the root again on the client, for a mismatch Solid only warned about. */
|
|
6
|
+
done(remount: () => void): void;
|
|
7
|
+
}
|
|
8
|
+
export declare const devHydration: {
|
|
9
|
+
watch?: (root: Element) => HydrationWatch;
|
|
10
|
+
};
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { IslandContext } from "hamur/adapter";
|
|
2
|
+
/** Hydrates the island's server HTML in `el` as a root of its own, its hydration keys under `<idPrefix>-`. */
|
|
3
|
+
export declare function hydrateIsland(el: Element, component: unknown, props: Record<string, unknown>, ctx: IslandContext): void;
|
|
4
|
+
/** Renders the island into `el` in place of the fallback it holds. */
|
|
5
|
+
export declare function mountIsland(el: Element, component: unknown, props: Record<string, unknown>, ctx: IslandContext): void;
|
|
6
|
+
export declare function unmountIsland(el: Element): void;
|
|
7
|
+
/** Gives the island's root a new state with the new props, which keeps the state its components hold. */
|
|
8
|
+
export declare function updateIsland(el: Element, props: Record<string, unknown>): void;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { Element as SolidElement } from "solid-js";
|
|
2
|
+
/** Where the server `Portal` writes: one entry per target selector (`#teleports`, `body`), in render order. */
|
|
3
|
+
export type TeleportSink = Record<string, string>;
|
|
4
|
+
/**
|
|
5
|
+
* The server `Portal`: @solidjs/web's renders nothing. Like the client's `Portal`, it takes one child owner of
|
|
6
|
+
* the owner it renders in, so the hydration keys after it are the client's; its children render inside that owner with
|
|
7
|
+
* no hydration keys, as the client builds a portal after hydration, and land in a `div` that the client entry removes
|
|
8
|
+
* before it hydrates; the client `Portal` then creates its own.
|
|
9
|
+
*/
|
|
10
|
+
export declare function Portal(props: {
|
|
11
|
+
mount?: unknown;
|
|
12
|
+
children?: SolidElement;
|
|
13
|
+
}): string;
|