@hamur/adapter-vue 0.0.0-stage → 0.0.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/LICENSE +22 -0
- package/README.md +32 -2
- package/dist/chunks/browser-index-43pdsfp6.js +69 -0
- package/dist/chunks/browser-index-d1bxd40m.js +320 -0
- package/dist/chunks/browser-index-nhft0ewv.js +161 -0
- package/dist/src/adapter.js +402 -0
- package/dist/src/index.js +1348 -0
- package/dist/src/keepalive.js +6 -0
- package/dist/src/runtime/client.js +20 -0
- package/dist/src/runtime/island.js +45 -0
- package/dist/src/runtime/server.js +238 -0
- package/dist/types/src/adapter.d.ts +2 -0
- package/dist/types/src/async-data.d.ts +14 -0
- package/dist/types/src/client-component.d.ts +12 -0
- package/dist/types/src/client-fallback.d.ts +2 -0
- package/dist/types/src/components/AwaitValue.d.ts +15 -0
- package/dist/types/src/components/ClientFallback.server.d.ts +17 -0
- package/dist/types/src/components/ErrorBoundary.server.d.ts +21 -0
- package/dist/types/src/components/error-code.d.ts +1 -0
- package/dist/types/src/context.d.ts +65 -0
- package/dist/types/src/index.d.ts +329 -0
- package/dist/types/src/island.d.ts +68 -0
- package/dist/types/src/keepalive.d.ts +22 -0
- package/dist/types/src/lazy-hydration.d.ts +10 -0
- package/dist/types/src/markdown-page.d.ts +9 -0
- package/dist/types/src/markdown.d.ts +45 -0
- package/dist/types/src/plugin.d.ts +45 -0
- package/dist/types/src/route-boundary.d.ts +35 -0
- package/dist/types/src/route-boundary.server.d.ts +5 -0
- package/dist/types/src/runtime/client.d.ts +11 -0
- package/dist/types/src/runtime/hydration-dev.d.ts +1 -0
- package/dist/types/src/runtime/hydration.d.ts +8 -0
- package/dist/types/src/runtime/island.d.ts +8 -0
- package/dist/types/src/runtime/server.d.ts +12 -0
- package/dist/types/src/server-island.d.ts +33 -0
- package/dist/types/src/svg.d.ts +10 -0
- package/package.json +46 -4
- package/src/adapter.ts +25 -0
- package/src/async-data.ts +77 -0
- package/src/client-component.ts +39 -0
- package/src/client-fallback.ts +2 -0
- package/src/components/Await.vue +30 -0
- package/src/components/AwaitValue.ts +41 -0
- package/src/components/ClientFallback.server.ts +41 -0
- package/src/components/ClientFallback.vue +31 -0
- package/src/components/ClientOnly.vue +16 -0
- package/src/components/DefaultErrorPage.vue +19 -0
- package/src/components/DevOnly.vue +8 -0
- package/src/components/ErrorBoundary.server.ts +69 -0
- package/src/components/ErrorBoundary.vue +32 -0
- package/src/components/Form.vue +85 -0
- package/src/components/Link.vue +200 -0
- package/src/components/Navigate.vue +16 -0
- package/src/components/Outlet.vue +28 -0
- package/src/components/error-code.ts +7 -0
- package/src/context.ts +391 -0
- package/src/index.ts +1528 -0
- package/src/island.ts +53 -0
- package/src/keepalive.ts +92 -0
- package/src/lazy-hydration.ts +53 -0
- package/src/markdown-page.ts +21 -0
- package/src/markdown.ts +80 -0
- package/src/plugin.ts +398 -0
- package/src/route-boundary.server.ts +29 -0
- package/src/route-boundary.ts +48 -0
- package/src/runtime/client.ts +137 -0
- package/src/runtime/hydration-dev.ts +38 -0
- package/src/runtime/hydration.ts +7 -0
- package/src/runtime/island.ts +60 -0
- package/src/runtime/server.ts +145 -0
- package/src/server-island.ts +38 -0
- package/src/svg.ts +28 -0
- package/src/vue.d.ts +5 -0
- package/src/webmcp.d.ts +18 -0
|
@@ -0,0 +1,329 @@
|
|
|
1
|
+
import { useId } from "vue";
|
|
2
|
+
import type { SyncedStateOptions } from "hamur/app";
|
|
3
|
+
import type { AppHooks, WebVitalMetric } from "hamur/app";
|
|
4
|
+
import type { ComputedRef, DefineSetupFnComponent, FunctionalComponent, MaybeRef, MaybeRefOrGetter, Ref, ShallowRef, WatchSource } from "vue";
|
|
5
|
+
import type { RouteLocation } from "hamur/app";
|
|
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 as StateKeyOf } from "hamur/app";
|
|
10
|
+
import type { HamurEvent } from "hamur/server";
|
|
11
|
+
import type { AnnouncerActions, AnnouncerPoliteness, RouteAnnouncerActions, RouteAnnouncerPoliteness, LoadingIndicatorActions, LoadingIndicatorProps, LoadingIndicatorOptions, TimeInput } from "hamur/adapter";
|
|
12
|
+
import type { ActionOptions, ActionRunner, FormStatus, Handler, AfterNavigateHook, BeforeNavigateHook, NavigateHook, NavigationBlocker, NavigationGuard, Blocker, ShouldBlock, UseBlockerOptions, SnapshotOptions } from "hamur/adapter";
|
|
13
|
+
import type { HandlerForm } from "hamur/app";
|
|
14
|
+
import type { CheckedTarget, LinkDefaults, LinkSlot, UseLinkOptions } from "hamur/adapter";
|
|
15
|
+
import type { RouteLoaderData, UseDataArgs, AsyncDataHandler, GetCachedData, NavigationState, RouteValue, RouterApi } from "hamur/adapter";
|
|
16
|
+
import type { ActionFailure, AppContext, PendingRun, PickFrom, ClientRuntimeConfig, SiteConfig, FetchData, AsyncDataOptions, AsyncDataStatus, UseCookieOptions, HeadInput, HeadSafeInput, SeoMetaInput, HamurError } from "hamur/app";
|
|
17
|
+
import type { FetchOptions } from "hamur/app";
|
|
18
|
+
export { addRouteMiddleware, clearError, disableScrollHandling, forbidden, navigateTo, notFound, permanentRedirect, refreshCookie, setPageLayout, showError, unauthorized, } from "hamur/app";
|
|
19
|
+
export { defineLazyHydrationComponent } from "./lazy-hydration.ts";
|
|
20
|
+
export { Island } from "./island.ts";
|
|
21
|
+
export type { IslandProps } from "./island.ts";
|
|
22
|
+
export { ServerIsland } from "./server-island.ts";
|
|
23
|
+
export type { ServerIslandProps } from "./server-island.ts";
|
|
24
|
+
export { MarkdownRenderer } from "./markdown.ts";
|
|
25
|
+
export type { MarkdownRendererProps } from "./markdown.ts";
|
|
26
|
+
import type { SetSearch } from "hamur/adapter";
|
|
27
|
+
import type { AppUpdateActions, AppUpdateState } from "hamur/adapter";
|
|
28
|
+
import type { MatchedRoute, RouteDataName, RouteDataOf, RouteError, RouteFor, RouteName } from "hamur/adapter";
|
|
29
|
+
export type { MatchedRoute, RouteDataName, RouteDataOf } from "hamur/adapter";
|
|
30
|
+
export type { NavigateToOptions, PickFrom } from "hamur/app";
|
|
31
|
+
export { default as Link } from "./components/Link.vue";
|
|
32
|
+
import LinkComponent from "./components/Link.vue";
|
|
33
|
+
export { default as Form } from "./components/Form.vue";
|
|
34
|
+
export { default as Outlet } from "./components/Outlet.vue";
|
|
35
|
+
export { default as ClientFallback } from "./components/ClientFallback.vue";
|
|
36
|
+
export { default as ClientOnly } from "./components/ClientOnly.vue";
|
|
37
|
+
export { default as DevOnly } from "./components/DevOnly.vue";
|
|
38
|
+
export { default as Await } from "./components/Await.vue";
|
|
39
|
+
export { default as Navigate } from "./components/Navigate.vue";
|
|
40
|
+
export { default as ErrorBoundary } from "./components/ErrorBoundary.vue";
|
|
41
|
+
export { default as DefaultErrorPage } from "./components/DefaultErrorPage.vue";
|
|
42
|
+
export type { Blocker, BlockerArgs, SnapshotOptions, UseBlockerOptions } from "hamur/adapter";
|
|
43
|
+
export type { AfterNavigateHook, AsyncDataHandler, BeforeNavigateHook, ErrorBoundaryFallbackProps, GetCachedData, GetCachedDataCause, NavigateHook, NavigateOptions, Navigation, NavigationState, NavigationType, RouteValue, RouterApi, } from "hamur/adapter";
|
|
44
|
+
export type { LinkDefaults, LinkSlot, UseLinkOptions } from "hamur/adapter";
|
|
45
|
+
export declare function useDeferred<T>(promise: T): Promise<Awaited<T>>;
|
|
46
|
+
export declare function useRoute<N extends RouteName>(name: N): RouteFor<N>;
|
|
47
|
+
export declare function useRoute<N extends RouteName = never>(): RouteFor<N>;
|
|
48
|
+
export declare function useRoute(): RouteValue;
|
|
49
|
+
export declare function useResolvedPath(to: MaybeRefOrGetter<string>, { relative }?: {
|
|
50
|
+
relative?: "route";
|
|
51
|
+
}): ComputedRef<string>;
|
|
52
|
+
export declare function useOutletContext<T = unknown>(): ComputedRef<T>;
|
|
53
|
+
export declare function useLayoutSegments(): ComputedRef<string[]>;
|
|
54
|
+
export declare function useLayoutSegment(): ComputedRef<string | null>;
|
|
55
|
+
export declare function useLayout(): ComputedRef<{
|
|
56
|
+
name: string | false;
|
|
57
|
+
props: Record<string, unknown>;
|
|
58
|
+
}>;
|
|
59
|
+
export declare function useRouter(): RouterApi;
|
|
60
|
+
export declare function useData<T = unknown>(...unknownRoute: UseDataArgs<T>): ComputedRef<RouteLoaderData<T>>;
|
|
61
|
+
export declare function useRouteData<N extends RouteDataName>(name: N): ComputedRef<RouteDataOf<N>>;
|
|
62
|
+
export declare function useMatches(): ComputedRef<MatchedRoute[]>;
|
|
63
|
+
export declare function useApp(): AppContext;
|
|
64
|
+
export declare function useRuntimeHook<K extends keyof AppHooks>(name: K, fn: AppHooks[K]): void;
|
|
65
|
+
export declare function useReportWebVitals(fn: (metric: WebVitalMetric) => void | Promise<void>): void;
|
|
66
|
+
export declare function onAppReady(fn: () => void | Promise<void>): void;
|
|
67
|
+
export declare function onPrehydrate(fn: (el: Element) => void): string | undefined;
|
|
68
|
+
export declare function useRequestEvent(): HamurEvent | undefined;
|
|
69
|
+
/** 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. */
|
|
70
|
+
export declare function usePreviewMode(): PreviewMode;
|
|
71
|
+
export declare function useRequestHeaders(names?: readonly string[]): Record<string, string>;
|
|
72
|
+
export declare function useRequestHeader(name: string): string | undefined;
|
|
73
|
+
export declare function useRequestURL(): URL;
|
|
74
|
+
export declare function useRequestFetch(): $Fetch;
|
|
75
|
+
export declare function setResponseStatus(status: number, statusText?: string): void;
|
|
76
|
+
export declare function useResponseHeader(name: string): Ref<string | undefined>;
|
|
77
|
+
export declare const HttpStatusCode: FunctionalComponent<{
|
|
78
|
+
code: number;
|
|
79
|
+
text?: string;
|
|
80
|
+
}>;
|
|
81
|
+
export declare const HttpHeader: FunctionalComponent<{
|
|
82
|
+
name: string;
|
|
83
|
+
value: string;
|
|
84
|
+
}>;
|
|
85
|
+
export declare const Time: DefineSetupFnComponent<TimeInput, {}, {}, TimeInput & {}, import("vue").PublicProps>;
|
|
86
|
+
export type { LoadingIndicatorProps } from "hamur/adapter";
|
|
87
|
+
export declare function useLoadingIndicator(options?: LoadingIndicatorOptions): {
|
|
88
|
+
progress: Readonly<Ref<number>>;
|
|
89
|
+
isLoading: Readonly<Ref<boolean>>;
|
|
90
|
+
error: Readonly<Ref<boolean>>;
|
|
91
|
+
} & LoadingIndicatorActions;
|
|
92
|
+
export declare function useAppUpdate(): {
|
|
93
|
+
[K in keyof AppUpdateState]: Readonly<Ref<AppUpdateState[K]>>;
|
|
94
|
+
} & AppUpdateActions;
|
|
95
|
+
export declare const LoadingIndicator: DefineSetupFnComponent<LoadingIndicatorProps, {}, {}, import("hamur/adapter").LoadingIndicatorLook & Pick<LoadingIndicatorOptions, "duration" | "estimatedProgress" | "throttle"> & {}, import("vue").PublicProps>;
|
|
96
|
+
export declare function useRouteAnnouncer(): {
|
|
97
|
+
message: Readonly<Ref<string>>;
|
|
98
|
+
politeness: Readonly<Ref<RouteAnnouncerPoliteness>>;
|
|
99
|
+
} & RouteAnnouncerActions;
|
|
100
|
+
export declare const RouteAnnouncer: DefineSetupFnComponent<{
|
|
101
|
+
politeness?: RouteAnnouncerPoliteness;
|
|
102
|
+
}, {}, {}, {
|
|
103
|
+
politeness?: RouteAnnouncerPoliteness;
|
|
104
|
+
} & {}, import("vue").PublicProps>;
|
|
105
|
+
export declare function useAnnouncer({ politeness }?: {
|
|
106
|
+
politeness?: AnnouncerPoliteness;
|
|
107
|
+
}): {
|
|
108
|
+
message: Readonly<Ref<string>>;
|
|
109
|
+
politeness: Readonly<Ref<AnnouncerPoliteness>>;
|
|
110
|
+
} & AnnouncerActions;
|
|
111
|
+
export declare const Announcer: DefineSetupFnComponent<Record<string, any>, {}, {}, Record<string, any> & {}, import("vue").PublicProps>;
|
|
112
|
+
export declare function useAsyncDataEntry<T = unknown>(key: string): {
|
|
113
|
+
data: Ref<T | undefined>;
|
|
114
|
+
};
|
|
115
|
+
export declare function useAsyncDataEntry<I, O>(fn: Handler<I, O>, input?: I): {
|
|
116
|
+
data: Ref<O | undefined>;
|
|
117
|
+
};
|
|
118
|
+
export declare const useNuxtData: typeof useAsyncDataEntry;
|
|
119
|
+
export declare function clearState(keys?: Parameters<typeof clearStateOf>[1], options?: {
|
|
120
|
+
reset?: boolean;
|
|
121
|
+
}): void;
|
|
122
|
+
export declare function callOnce(key: string, fn: () => unknown | Promise<unknown>, options?: {
|
|
123
|
+
mode?: "render" | "navigation";
|
|
124
|
+
}): Promise<void>;
|
|
125
|
+
export declare function useRuntimeConfig(): ClientRuntimeConfig;
|
|
126
|
+
export declare function useSiteConfig(): SiteConfig;
|
|
127
|
+
export declare function useNavigation(): Readonly<ShallowRef<NavigationState>>;
|
|
128
|
+
/** A `Link` with `defaults` over `app.link`; a prop of the element wins. */
|
|
129
|
+
export declare function defineLink(defaults: LinkDefaults): typeof LinkComponent;
|
|
130
|
+
/** The `LinkSlot` of a link to `to`, for an element that renders its own `<a>`; `app.link` sets its defaults. */
|
|
131
|
+
export declare function useLink<T extends string = string>(to: MaybeRefOrGetter<CheckedTarget<T> | RouteLocation>, options?: MaybeRefOrGetter<UseLinkOptions>): ComputedRef<LinkSlot>;
|
|
132
|
+
/** Inside a `Link`'s slot, whether a navigation to that link is in flight; `pending` is false anywhere else. */
|
|
133
|
+
export declare function useLinkStatus(): {
|
|
134
|
+
pending: ComputedRef<boolean>;
|
|
135
|
+
};
|
|
136
|
+
export declare const onBeforeNavigate: (fn: BeforeNavigateHook) => void;
|
|
137
|
+
export declare const onNavigate: (fn: NavigateHook) => void;
|
|
138
|
+
export declare const onAfterNavigate: (fn: AfterNavigateHook) => void;
|
|
139
|
+
/** Runs `fn` after the component mounts and each time its kept page is shown again (`onActivated`). */
|
|
140
|
+
export declare function onPageActivated(fn: () => void): void;
|
|
141
|
+
/** Runs `fn` each time its kept page is hidden and when the component unmounts (`onDeactivated`). */
|
|
142
|
+
export declare function onPageDeactivated(fn: () => void): void;
|
|
143
|
+
export declare const onBeforeRouteLeave: (fn: NavigationGuard) => void;
|
|
144
|
+
export declare const onBeforeRouteUpdate: (fn: NavigationGuard) => void;
|
|
145
|
+
export declare function usePreventNavigate(fn: NavigationBlocker): void;
|
|
146
|
+
export declare function useBlocker(options: ShouldBlock | UseBlockerOptions): Readonly<ShallowRef<Blocker>>;
|
|
147
|
+
export declare function useSnapshot<T>(key: string, options: SnapshotOptions<T>): void;
|
|
148
|
+
export declare function useSearch(): {
|
|
149
|
+
value: ComputedRef<RouteValue["search"]>;
|
|
150
|
+
set: SetSearch;
|
|
151
|
+
};
|
|
152
|
+
export declare function useSearch<S>(select: (search: RouteValue["search"]) => S): {
|
|
153
|
+
value: ComputedRef<S>;
|
|
154
|
+
set: SetSearch;
|
|
155
|
+
};
|
|
156
|
+
export declare function usePoll(ms: number, options?: {
|
|
157
|
+
keys?: string[];
|
|
158
|
+
}): void;
|
|
159
|
+
export declare function useOnline(): Readonly<Ref<boolean>>;
|
|
160
|
+
export declare function useSyncedState<T>(key: string, initial: T, options?: SyncedStateOptions): Ref<T>;
|
|
161
|
+
export { useId };
|
|
162
|
+
export declare function useHydrated(): Readonly<Ref<boolean>>;
|
|
163
|
+
export declare function useFormStatus(): Readonly<FormStatus>;
|
|
164
|
+
export declare function useForm<I, O>(fn: Handler<I, O>): HandlerForm<I, O>;
|
|
165
|
+
export interface UseActionResult<I, O> {
|
|
166
|
+
readonly run: ActionRunner<I, O>["run"];
|
|
167
|
+
readonly state: O | undefined;
|
|
168
|
+
readonly pending: boolean;
|
|
169
|
+
readonly error: HamurError | undefined;
|
|
170
|
+
readonly failure: ActionFailure | undefined;
|
|
171
|
+
reset(): void;
|
|
172
|
+
}
|
|
173
|
+
export declare function useAction<I, O>(fn: Handler<I, O>, options?: ActionOptions<O> & {
|
|
174
|
+
instance?: string | number;
|
|
175
|
+
}): UseActionResult<I, O>;
|
|
176
|
+
export declare function useOptimistic<T, A = PendingRun>(value: MaybeRefOrGetter<T>, reduce: (current: T, pending: A[]) => T): ComputedRef<T>;
|
|
177
|
+
export declare function useError(): ShallowRef<RouteError | undefined>;
|
|
178
|
+
type MaybeRefOrGetterDeep<T> = MaybeRefOrGetter<T extends (...args: never[]) => unknown ? T : T extends readonly (infer U)[] ? MaybeRefOrGetterDeep<U>[] : T extends object ? {
|
|
179
|
+
[K in keyof T]: MaybeRefOrGetterDeep<T[K]>;
|
|
180
|
+
} : T>;
|
|
181
|
+
export declare function useHead(input: MaybeRefOrGetterDeep<HeadInput>): void;
|
|
182
|
+
export declare function useSeoMeta(input: MaybeRefOrGetterDeep<SeoMetaInput>): void;
|
|
183
|
+
type ServerHeadInput = Omit<HeadInput, "title" | "titleTemplate">;
|
|
184
|
+
type ServerSeoMetaInput = Omit<SeoMetaInput, "title" | "titleTemplate">;
|
|
185
|
+
export declare function useHeadSafe(input: MaybeRefOrGetterDeep<HeadSafeInput>): void;
|
|
186
|
+
export declare const HeadTitle: DefineSetupFnComponent<{
|
|
187
|
+
title: string;
|
|
188
|
+
template?: string;
|
|
189
|
+
}, {}, {}, {
|
|
190
|
+
title: string;
|
|
191
|
+
template?: string;
|
|
192
|
+
} & {}, import("vue").PublicProps>;
|
|
193
|
+
export declare const HeadMeta: DefineSetupFnComponent<{
|
|
194
|
+
[x: string]: string;
|
|
195
|
+
} & {
|
|
196
|
+
key?: string;
|
|
197
|
+
tagPriority?: import("hamur/app").TagPriority;
|
|
198
|
+
}>;
|
|
199
|
+
export declare const HeadLink: DefineSetupFnComponent<{
|
|
200
|
+
[x: string]: string;
|
|
201
|
+
} & {
|
|
202
|
+
key?: string;
|
|
203
|
+
tagPriority?: import("hamur/app").TagPriority;
|
|
204
|
+
} & {
|
|
205
|
+
tagPosition?: import("hamur/app").TagPosition;
|
|
206
|
+
}>;
|
|
207
|
+
export declare const HeadScript: DefineSetupFnComponent<({
|
|
208
|
+
key?: string;
|
|
209
|
+
tagPriority?: import("hamur/app").TagPriority;
|
|
210
|
+
} & {
|
|
211
|
+
tagPosition?: import("hamur/app").TagPosition;
|
|
212
|
+
} & {
|
|
213
|
+
[data: `data-${string}`]: string;
|
|
214
|
+
innerHTML: () => void;
|
|
215
|
+
id?: string;
|
|
216
|
+
type?: string;
|
|
217
|
+
nonce?: string;
|
|
218
|
+
}) | ({
|
|
219
|
+
[x: string]: string;
|
|
220
|
+
} & {
|
|
221
|
+
key?: string;
|
|
222
|
+
tagPriority?: import("hamur/app").TagPriority;
|
|
223
|
+
} & {
|
|
224
|
+
tagPosition?: import("hamur/app").TagPosition;
|
|
225
|
+
} & {
|
|
226
|
+
innerHTML?: string;
|
|
227
|
+
})>;
|
|
228
|
+
export declare const HeadStyle: DefineSetupFnComponent<{
|
|
229
|
+
key?: string;
|
|
230
|
+
tagPriority?: import("hamur/app").TagPriority;
|
|
231
|
+
} & {
|
|
232
|
+
tagPosition?: import("hamur/app").TagPosition;
|
|
233
|
+
} & {
|
|
234
|
+
innerHTML: string;
|
|
235
|
+
media?: string;
|
|
236
|
+
}>;
|
|
237
|
+
export declare const HtmlAttrs: DefineSetupFnComponent<Record<string, string>>;
|
|
238
|
+
export declare const BodyAttrs: DefineSetupFnComponent<Record<string, string>>;
|
|
239
|
+
export declare function useServerHead(input: MaybeRefOrGetterDeep<ServerHeadInput>): void;
|
|
240
|
+
export declare function useServerSeoMeta(input: MaybeRefOrGetterDeep<ServerSeoMetaInput>): void;
|
|
241
|
+
export declare function useState<T>(key: StateKeyOf<T>): Ref<T>;
|
|
242
|
+
export declare function useState<T>(key: string, init?: T | (() => T)): Ref<T>;
|
|
243
|
+
export interface UseCookieWatchOptions {
|
|
244
|
+
/** `true` (default): a change inside an object value writes the cookie; `"shallow"`: only `.value = …` writes; `false`: nothing writes, `.value = …` is kept in the ref only. */
|
|
245
|
+
watch?: boolean | "shallow";
|
|
246
|
+
}
|
|
247
|
+
export declare function useCookie<T = string>(name: string, options: Omit<UseCookieOptions<T>, "app"> & UseCookieWatchOptions & {
|
|
248
|
+
default: () => T;
|
|
249
|
+
}): Ref<T>;
|
|
250
|
+
export declare function useCookie<T = string>(name: string, options?: Omit<UseCookieOptions<T>, "app"> & UseCookieWatchOptions): Ref<T | undefined>;
|
|
251
|
+
export interface UseAsyncDataOptions<T = unknown, R = T, K extends keyof T & string = never, D = T> extends Omit<AsyncDataOptions<T, R, D>, "pick"> {
|
|
252
|
+
/** Sources that re-run the handler when they change. In `useFetch`, `false` also stops `url`, `query` and `body` from re-fetching on change. */
|
|
253
|
+
watch?: WatchSource[] | false;
|
|
254
|
+
getCachedData?: GetCachedData<T>;
|
|
255
|
+
/** Top-level keys of an object result to keep. */
|
|
256
|
+
pick?: readonly K[];
|
|
257
|
+
/** `true` makes `data` deeply reactive; the default `false` keeps it a shallow ref, tracked by replacement only. */
|
|
258
|
+
deep?: boolean;
|
|
259
|
+
}
|
|
260
|
+
export interface UseAsyncDataResult<T, D = undefined> {
|
|
261
|
+
data: ComputedRef<T | D>;
|
|
262
|
+
error: ComputedRef<HamurError | undefined>;
|
|
263
|
+
status: ComputedRef<AsyncDataStatus>;
|
|
264
|
+
/** `status === "pending"`, or `idle` without data under `app.asyncData.pendingWhenIdle`. */
|
|
265
|
+
pending: ComputedRef<boolean>;
|
|
266
|
+
refresh(): Promise<void>;
|
|
267
|
+
/** The same function as `refresh`. */
|
|
268
|
+
execute(): Promise<void>;
|
|
269
|
+
/** Resets the entry of the current key to `idle` (`clearAsyncData`). */
|
|
270
|
+
clear(): void;
|
|
271
|
+
}
|
|
272
|
+
export interface UseFetchOptions<T = unknown, R = T, K extends keyof T & string = never, D = T> extends Omit<FetchOptions, "query" | "body">, UseAsyncDataOptions<T, R, K, D> {
|
|
273
|
+
/** The store key, instead of the one derived from the url and the request. */
|
|
274
|
+
key?: string;
|
|
275
|
+
query?: MaybeRefOrGetter<Record<string, MaybeRef<unknown>> | undefined>;
|
|
276
|
+
body?: MaybeRefOrGetter<unknown>;
|
|
277
|
+
}
|
|
278
|
+
export declare function useAsyncData<I, R, T = R, K extends keyof T & string = never, D = T>(fn: Handler<I, R>, input: MaybeRefOrGetter<NoInfer<I>> | undefined, options: UseAsyncDataOptions<T, R, K, D> & {
|
|
279
|
+
default: () => D;
|
|
280
|
+
}): UseAsyncDataResult<PickFrom<T, K>, D>;
|
|
281
|
+
export declare function useAsyncData<I, R, T = R, K extends keyof T & string = never>(fn: Handler<I, R>, input?: MaybeRefOrGetter<NoInfer<I>>, options?: UseAsyncDataOptions<T, R, K, undefined>): UseAsyncDataResult<PickFrom<T, K>>;
|
|
282
|
+
export declare function useAsyncData<T = unknown, R = T, K extends keyof T & string = never, D = T>(key: MaybeRefOrGetter<string>, handler: AsyncDataHandler<R>, options: UseAsyncDataOptions<T, R, K, D> & {
|
|
283
|
+
default: () => D;
|
|
284
|
+
}): UseAsyncDataResult<PickFrom<T, K>, D>;
|
|
285
|
+
export declare function useAsyncData<T = unknown, R = T, K extends keyof T & string = never>(key: MaybeRefOrGetter<string>, handler: AsyncDataHandler<R>, options?: UseAsyncDataOptions<T, R, K, undefined>): UseAsyncDataResult<PickFrom<T, K>>;
|
|
286
|
+
type DeepRef<T> = T extends Date | Blob | ArrayBufferView | ArrayBuffer | FormData | URLSearchParams | ReadableStream | ((...args: never[]) => unknown) ? T : MaybeRef<T extends readonly (infer E)[] ? DeepRef<E>[] : T extends object ? {
|
|
287
|
+
[K in keyof T]: DeepRef<T[K]>;
|
|
288
|
+
} : T>;
|
|
289
|
+
/** What a literal `useFetch` call is checked against; any other call stays loose. `query` and `body` take refs, getters and refs inside, as `deepToValue` resolves them. */
|
|
290
|
+
type FetchInput<X> = X extends {
|
|
291
|
+
key: infer K extends string;
|
|
292
|
+
input: infer I;
|
|
293
|
+
} ? FetchInputField<I, K, MaybeRefOrGetter<DeepRef<I>>> : unknown;
|
|
294
|
+
type Unkeyed<O, X> = X extends {
|
|
295
|
+
key: infer K extends string;
|
|
296
|
+
} ? Omit<O, K> : O;
|
|
297
|
+
type FetchCall<U extends string, M extends string, B extends string | undefined> = {
|
|
298
|
+
method?: M | string;
|
|
299
|
+
baseURL?: B | string;
|
|
300
|
+
} & FetchInput<FetchCheckedInput<U, M, B>>;
|
|
301
|
+
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: MaybeRefOrGetter<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>;
|
|
302
|
+
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: MaybeRefOrGetter<U>, options: Unkeyed<UseFetchOptions<T, R, K, D>, FetchCheckedInput<U, M, B>> & {
|
|
303
|
+
default: () => D;
|
|
304
|
+
} & FetchCall<U, M, B>): UseAsyncDataResult<PickFrom<T, K>, D>;
|
|
305
|
+
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: MaybeRefOrGetter<U>, options?: Unkeyed<UseFetchOptions<T, R, K, undefined>, FetchCheckedInput<U, M, B>> & FetchCall<U, M, B>): UseAsyncDataResult<PickFrom<T, K>>;
|
|
306
|
+
/** `createUseFetch` defaults change what a call sends (method, body, query, baseURL), so its calls check nothing. */
|
|
307
|
+
interface UseFetchLoose {
|
|
308
|
+
<U extends string, M extends string = "GET", K extends keyof FetchData<U, M> & string = never, D = undefined>(url: MaybeRefOrGetter<U>, options?: UseFetchOptions<FetchData<U, M>, FetchData<U, M>, K, D> & {
|
|
309
|
+
method?: M;
|
|
310
|
+
}): UseAsyncDataResult<PickFrom<FetchData<U, M>, K>, D>;
|
|
311
|
+
<T = unknown, R = T, K extends keyof T & string = never, D = T>(url: MaybeRefOrGetter<string>, options: UseFetchOptions<T, R, K, D> & {
|
|
312
|
+
default: () => D;
|
|
313
|
+
}): UseAsyncDataResult<PickFrom<T, K>, D>;
|
|
314
|
+
<T = unknown, R = T, K extends keyof T & string = never>(url: MaybeRefOrGetter<string>, options?: UseFetchOptions<T, R, K, undefined>): UseAsyncDataResult<PickFrom<T, K>>;
|
|
315
|
+
}
|
|
316
|
+
type AnyFetchOptions = UseFetchOptions<any, any, any, any>;
|
|
317
|
+
/** `useFetch` with `defaults` under every call's options; `$fetch` replaces the request-bound client, e.g. a `$fetch.create` one. */
|
|
318
|
+
export declare function createUseFetch(defaults: AnyFetchOptions | ((options: AnyFetchOptions) => AnyFetchOptions), { $fetch: client }?: {
|
|
319
|
+
$fetch?: $Fetch;
|
|
320
|
+
}): UseFetchLoose;
|
|
321
|
+
/** `useAsyncData` with `defaults` under every call's options. */
|
|
322
|
+
export declare function createUseAsyncData(defaults: UseAsyncDataOptions<any, any, any, any> | ((options: UseAsyncDataOptions<any, any, any, any>) => UseAsyncDataOptions<any, any, any, any>)): typeof useAsyncData;
|
|
323
|
+
export declare const useLazyFetch: typeof useFetch;
|
|
324
|
+
export declare const useLazyAsyncData: typeof useAsyncData;
|
|
325
|
+
export declare function transitionName(name: string): {
|
|
326
|
+
style: {
|
|
327
|
+
viewTransitionName: string;
|
|
328
|
+
};
|
|
329
|
+
};
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
import type { Component, PropType } from "vue";
|
|
2
|
+
import { type IslandOn } from "hamur/adapter";
|
|
3
|
+
export interface IslandProps {
|
|
4
|
+
/** The default export of a file under `app/islands/`. */
|
|
5
|
+
component: Component;
|
|
6
|
+
props?: Record<string, unknown>;
|
|
7
|
+
/** The island directive: when the island hydrates, `"only"` to mount it in the browser alone, or a directive a module adds; default `"load"`. */
|
|
8
|
+
on?: IslandOn;
|
|
9
|
+
/** The island's id across swaps; a swap to a page with the same id keeps its element and state. */
|
|
10
|
+
persist?: string;
|
|
11
|
+
/** With `persist`, a swap keeps the island's old props. */
|
|
12
|
+
persistProps?: boolean;
|
|
13
|
+
}
|
|
14
|
+
/**
|
|
15
|
+
* On an island page, `component` rendered as a root of its own inside `<hamur-island>`, hydrated on its own in the browser;
|
|
16
|
+
* the `fallback` slot is what the server renders under `on="only"`, and the default slot is rendered on the server only and given
|
|
17
|
+
* to the island as its default slot, inside `<hamur-slot>`.
|
|
18
|
+
*/
|
|
19
|
+
export declare const Island: import("vue").DefineComponent<import("vue").ExtractPropTypes<{
|
|
20
|
+
component: {
|
|
21
|
+
type: PropType<IslandProps["component"]>;
|
|
22
|
+
required: true;
|
|
23
|
+
};
|
|
24
|
+
props: {
|
|
25
|
+
type: PropType<IslandProps["props"]>;
|
|
26
|
+
default: undefined;
|
|
27
|
+
};
|
|
28
|
+
on: {
|
|
29
|
+
type: PropType<IslandProps["on"]>;
|
|
30
|
+
default: undefined;
|
|
31
|
+
};
|
|
32
|
+
persist: {
|
|
33
|
+
type: StringConstructor;
|
|
34
|
+
default: undefined;
|
|
35
|
+
};
|
|
36
|
+
persistProps: {
|
|
37
|
+
type: BooleanConstructor;
|
|
38
|
+
default: boolean;
|
|
39
|
+
};
|
|
40
|
+
}>, () => import("vue").VNode<import("vue").RendererNode, import("vue").RendererElement, {
|
|
41
|
+
[key: string]: any;
|
|
42
|
+
}>, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
|
|
43
|
+
component: {
|
|
44
|
+
type: PropType<IslandProps["component"]>;
|
|
45
|
+
required: true;
|
|
46
|
+
};
|
|
47
|
+
props: {
|
|
48
|
+
type: PropType<IslandProps["props"]>;
|
|
49
|
+
default: undefined;
|
|
50
|
+
};
|
|
51
|
+
on: {
|
|
52
|
+
type: PropType<IslandProps["on"]>;
|
|
53
|
+
default: undefined;
|
|
54
|
+
};
|
|
55
|
+
persist: {
|
|
56
|
+
type: StringConstructor;
|
|
57
|
+
default: undefined;
|
|
58
|
+
};
|
|
59
|
+
persistProps: {
|
|
60
|
+
type: BooleanConstructor;
|
|
61
|
+
default: boolean;
|
|
62
|
+
};
|
|
63
|
+
}>> & Readonly<{}>, {
|
|
64
|
+
props: Record<string, unknown> | undefined;
|
|
65
|
+
on: IslandOn | undefined;
|
|
66
|
+
persist: string;
|
|
67
|
+
persistProps: boolean;
|
|
68
|
+
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import type { InjectionKey, KeepAlive, ShallowRef, VNode, defineComponent, h, provide, shallowReactive, shallowRef, watchEffect } from "vue";
|
|
2
|
+
import type { KeptUnit, RenderEntry, RouteValue } from "hamur/adapter";
|
|
3
|
+
import type { Source, dataOf, routeValue } from "./context.ts";
|
|
4
|
+
/** 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. */
|
|
5
|
+
export interface KeepAliveBase {
|
|
6
|
+
KeepAlive: typeof KeepAlive;
|
|
7
|
+
defineComponent: typeof defineComponent;
|
|
8
|
+
h: typeof h;
|
|
9
|
+
provide: typeof provide;
|
|
10
|
+
shallowReactive: typeof shallowReactive;
|
|
11
|
+
shallowRef: typeof shallowRef;
|
|
12
|
+
watchEffect: typeof watchEffect;
|
|
13
|
+
RouteKey: InjectionKey<RouteValue>;
|
|
14
|
+
DataKey: InjectionKey<ShallowRef<Record<string, unknown>>>;
|
|
15
|
+
routeValue: typeof routeValue;
|
|
16
|
+
dataOf: typeof dataOf;
|
|
17
|
+
}
|
|
18
|
+
export type KeptOutlet = (item: {
|
|
19
|
+
kept?: KeptUnit[];
|
|
20
|
+
}, below: RenderEntry | undefined, child: VNode | undefined, source: () => Source) => VNode;
|
|
21
|
+
/** The outlet of `item` (an entry, or the tree's top level) in a `KeepAlive` that caches the current child under its keep-alive key and keeps the units of `item.kept`. */
|
|
22
|
+
export declare function createKeptOutlet({ KeepAlive, defineComponent, h, provide, shallowReactive, shallowRef, watchEffect, RouteKey, DataKey, routeValue, dataOf, }: KeepAliveBase): KeptOutlet;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { Component } from "vue";
|
|
2
|
+
import type { HydrateOn, HydrateOnOptions } from "hamur/adapter";
|
|
3
|
+
/**
|
|
4
|
+
* Renders the component on the server and, after hydration, keeps its server DOM until `on` fires; after a client
|
|
5
|
+
* navigation it mounts at once. Vue's `__asyncHydrate` loads the chunk before it asks a hydration strategy, so the gate is
|
|
6
|
+
* in the loader of a per-instance `defineAsyncComponent`.
|
|
7
|
+
*/
|
|
8
|
+
export declare function defineLazyHydrationComponent<T extends Component>(on: HydrateOn, loader: () => Promise<{
|
|
9
|
+
default: T;
|
|
10
|
+
}>, options?: Omit<HydrateOnOptions, "signal">): T;
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import { type Component, type PropType } from "vue";
|
|
2
|
+
import type { MarkdownDocument, MdNode } from "hamur/markdown";
|
|
3
|
+
export interface MarkdownRendererProps {
|
|
4
|
+
/** A Markdown AST node, a list of nodes, or a document, which renders its `ast`. */
|
|
5
|
+
value: MdNode | MdNode[] | MarkdownDocument;
|
|
6
|
+
/** Components by Markdown component name (kebab case); each gets the node's props, its default slot and a slot per named slot. */
|
|
7
|
+
components?: Record<string, Component>;
|
|
8
|
+
/** 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. */
|
|
9
|
+
raw?: (html: string) => string;
|
|
10
|
+
}
|
|
11
|
+
type Components = Record<string, Component>;
|
|
12
|
+
/** Renders the Markdown AST as Vue vnodes, an internal link as `Link`, a component node as its component in `components`. */
|
|
13
|
+
export declare const MarkdownRenderer: import("vue").DefineComponent<import("vue").ExtractPropTypes<{
|
|
14
|
+
value: {
|
|
15
|
+
type: PropType<MarkdownRendererProps["value"]>;
|
|
16
|
+
required: true;
|
|
17
|
+
};
|
|
18
|
+
components: {
|
|
19
|
+
type: PropType<Components>;
|
|
20
|
+
default: undefined;
|
|
21
|
+
};
|
|
22
|
+
raw: {
|
|
23
|
+
type: PropType<(html: string) => string>;
|
|
24
|
+
default: undefined;
|
|
25
|
+
};
|
|
26
|
+
}>, () => import("vue").VNode<import("vue").RendererNode, import("vue").RendererElement, {
|
|
27
|
+
[key: string]: any;
|
|
28
|
+
}>, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
|
|
29
|
+
value: {
|
|
30
|
+
type: PropType<MarkdownRendererProps["value"]>;
|
|
31
|
+
required: true;
|
|
32
|
+
};
|
|
33
|
+
components: {
|
|
34
|
+
type: PropType<Components>;
|
|
35
|
+
default: undefined;
|
|
36
|
+
};
|
|
37
|
+
raw: {
|
|
38
|
+
type: PropType<(html: string) => string>;
|
|
39
|
+
default: undefined;
|
|
40
|
+
};
|
|
41
|
+
}>> & Readonly<{}>, {
|
|
42
|
+
components: Components;
|
|
43
|
+
raw: (html: string) => string;
|
|
44
|
+
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
|
|
45
|
+
export {};
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import type { BunPlugin } from "bun";
|
|
2
|
+
import type { AdapterBuildContext, AdapterTransform } from "hamur/adapter";
|
|
3
|
+
interface TemplateNode {
|
|
4
|
+
type: number;
|
|
5
|
+
tag?: string;
|
|
6
|
+
tagType?: number;
|
|
7
|
+
content?: unknown;
|
|
8
|
+
props?: Array<{
|
|
9
|
+
type: number;
|
|
10
|
+
name?: string;
|
|
11
|
+
arg?: unknown;
|
|
12
|
+
nameLoc?: unknown;
|
|
13
|
+
value?: unknown;
|
|
14
|
+
loc?: unknown;
|
|
15
|
+
}>;
|
|
16
|
+
children?: unknown[];
|
|
17
|
+
loc?: {
|
|
18
|
+
start: {
|
|
19
|
+
line: number;
|
|
20
|
+
column: number;
|
|
21
|
+
};
|
|
22
|
+
};
|
|
23
|
+
}
|
|
24
|
+
/** The module's path relative to `rootDir` when it is an app source (not under `node_modules` or the build dir). */
|
|
25
|
+
export declare function appModuleId(rootDir: string, buildDir: string): (path: string) => string | undefined;
|
|
26
|
+
/**
|
|
27
|
+
* The source locator, dev only: a node transform that gives the template's single root element, when it is a plain
|
|
28
|
+
* HTML element, `data-hamur-src="<file>:<line>:<column>"`; `origin` is where the template's content starts in the file.
|
|
29
|
+
*/
|
|
30
|
+
export declare function locateRootElement(file: string, origin: {
|
|
31
|
+
line: number;
|
|
32
|
+
column: number;
|
|
33
|
+
}): (node: TemplateNode, context: {
|
|
34
|
+
parent: TemplateNode | null;
|
|
35
|
+
}) => void;
|
|
36
|
+
/** The tags under which a script imports `DevOnly` from this adapter, as written and in kebab-case. */
|
|
37
|
+
export declare function devOnlyTags(script: string): Set<string>;
|
|
38
|
+
/** Production: a node transform that keeps only the `#fallback` slot among the children of a `DevOnly` element. */
|
|
39
|
+
export declare function dropDevOnlyChildren(tags: ReadonlySet<string>): (node: TemplateNode) => void;
|
|
40
|
+
/** Bun.serve's dev bundler ignores `define` changed in a plugin, so the flags are replaced in Vue's own modules. */
|
|
41
|
+
export declare function vueFeatureFlags(): AdapterTransform;
|
|
42
|
+
export declare function vuePlugin(ctx: AdapterBuildContext): BunPlugin;
|
|
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 vueHydrationPlugin(): AdapterTransform;
|
|
45
|
+
export {};
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import type { ComponentInternalInstance, PropType } from "vue";
|
|
2
|
+
/** `onErrorCaptured` also runs while Vue renders on the server, and swallows the error there; `ssrRender` reads what it caught. */
|
|
3
|
+
export declare const caught: WeakMap<ComponentInternalInstance, {
|
|
4
|
+
error: unknown;
|
|
5
|
+
}>;
|
|
6
|
+
/** Errors a route boundary's own render threw, which no route boundary above may catch. */
|
|
7
|
+
export declare const rethrown: WeakSet<object>;
|
|
8
|
+
/** Wraps a boundary's render: what comes up from it is marked, and goes on to the app's error handler. */
|
|
9
|
+
export declare const Guard: import("vue").DefineComponent<{}, () => import("vue").VNode<import("vue").RendererNode, import("vue").RendererElement, {
|
|
10
|
+
[key: string]: any;
|
|
11
|
+
}> | undefined, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<{}> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
|
|
12
|
+
/** Shows its fallback for an error below it until `resetOn` is another object, which every navigation and update builds. */
|
|
13
|
+
export declare const RouteBoundary: import("vue").DefineComponent<import("vue").ExtractPropTypes<{
|
|
14
|
+
resetOn: {
|
|
15
|
+
type: null;
|
|
16
|
+
default: null;
|
|
17
|
+
};
|
|
18
|
+
fallback: {
|
|
19
|
+
type: PropType<(error: unknown) => unknown>;
|
|
20
|
+
required: true;
|
|
21
|
+
};
|
|
22
|
+
}>, () => import("vue").VNode<import("vue").RendererNode, import("vue").RendererElement, {
|
|
23
|
+
[key: string]: any;
|
|
24
|
+
}>[] | undefined, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
|
|
25
|
+
resetOn: {
|
|
26
|
+
type: null;
|
|
27
|
+
default: null;
|
|
28
|
+
};
|
|
29
|
+
fallback: {
|
|
30
|
+
type: PropType<(error: unknown) => unknown>;
|
|
31
|
+
required: true;
|
|
32
|
+
};
|
|
33
|
+
}>> & Readonly<{}>, {
|
|
34
|
+
resetOn: any;
|
|
35
|
+
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import type { ComponentInternalInstance } from "vue";
|
|
2
|
+
/** Vue's server renderer writes output as it goes, so the slot is rendered into a buffer and kept only if nothing in it failed. */
|
|
3
|
+
export declare function ssrRender(_ctx: unknown, push: (item: unknown) => void, instance: ComponentInternalInstance, _attrs: unknown, props: {
|
|
4
|
+
fallback: (error: unknown) => unknown;
|
|
5
|
+
}): void;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { AppConfig, Component } from "vue";
|
|
2
|
+
import type { ClientContext } from "hamur/adapter";
|
|
3
|
+
export { installKeepAlive } from "../context.ts";
|
|
4
|
+
/** A setup or render throw is a render failure; anything else shows the error page only when fatal. In dev the others reach the overlay; `import.meta.dev` is not defined in the dev client, `import.meta.hot` is. */
|
|
5
|
+
export declare function rootErrorHandler(app: ClientContext["app"]): NonNullable<AppConfig["errorHandler"]>;
|
|
6
|
+
export declare function hydrate(ctx: ClientContext): Promise<void>;
|
|
7
|
+
export declare function mount(ctx: ClientContext): Promise<void>;
|
|
8
|
+
export declare function update(ctx: ClientContext): Promise<void>;
|
|
9
|
+
export { clientComponent } from "../client-component.ts";
|
|
10
|
+
/** The client side of a server-only component: the server HTML, never hydrated; a new props text fetches it anew. */
|
|
11
|
+
export declare function serverComponent(name: string): Component;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/** What `hydration-dev.ts` hands the client runtime in `hamur dev`; a production client never sets it. */
|
|
2
|
+
export interface HydrationWatch {
|
|
3
|
+
/** `app.mount` returned: the hydration's warnings are in. */
|
|
4
|
+
done(): void;
|
|
5
|
+
}
|
|
6
|
+
export declare const devHydration: {
|
|
7
|
+
watch?: (root: Element) => HydrationWatch;
|
|
8
|
+
};
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { IslandContext } from "hamur/adapter";
|
|
2
|
+
/** Hydrates the island's server HTML in `el` as an app of its own. */
|
|
3
|
+
export declare function hydrateIsland(el: Element, component: unknown, props: Record<string, unknown>, ctx: IslandContext): Promise<void>;
|
|
4
|
+
/** Mounts 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): Promise<void>;
|
|
6
|
+
export declare function unmountIsland(el: Element): void;
|
|
7
|
+
/** Gives the island's app new props, which keeps its state. */
|
|
8
|
+
export declare function updateIsland(el: Element, props: Record<string, unknown>): Promise<void> | void;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { Component } from "vue";
|
|
2
|
+
import type { ComponentRenderContext, RenderContext, RenderResult } from "hamur/adapter";
|
|
3
|
+
/** A throw no `ErrorBoundary` caught fails the render, so the handler answers the error page with its status. */
|
|
4
|
+
export declare function render(ctx: RenderContext): Promise<RenderResult>;
|
|
5
|
+
/** `component` as an app of its own, its ids prefixed with `ctx.idPrefix` as `hydrateIsland` prefixes them. */
|
|
6
|
+
export declare function renderComponent(component: unknown, props: Record<string, unknown>, ctx: ComponentRenderContext): Promise<{
|
|
7
|
+
html: string;
|
|
8
|
+
}>;
|
|
9
|
+
/** The server side of a client-only component renders nothing: the comment Vue writes for an empty render. */
|
|
10
|
+
export declare function clientComponent(): Component;
|
|
11
|
+
/** The server side of a server-only component: the component itself inside `hamur-component`, its props checked as the client sends them. */
|
|
12
|
+
export declare function serverComponent(name: string, component: Component): Component;
|