@hamur/adapter-html 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.
Files changed (54) hide show
  1. package/LICENSE +22 -0
  2. package/README.md +31 -2
  3. package/dist/chunks/browser-index-2h1699xv.js +148 -0
  4. package/dist/chunks/browser-index-n6x04zrf.js +28 -0
  5. package/dist/chunks/browser-index-naq02zzj.js +4 -0
  6. package/dist/chunks/browser-index-qx74bd1y.js +302 -0
  7. package/dist/src/adapter.js +141 -0
  8. package/dist/src/error-page.js +335 -0
  9. package/dist/src/index.js +1241 -0
  10. package/dist/src/runtime/client.js +330 -0
  11. package/dist/src/runtime/island.js +40 -0
  12. package/dist/src/runtime/server.js +59 -0
  13. package/dist/types/src/adapter.d.ts +2 -0
  14. package/dist/types/src/async-data.d.ts +13 -0
  15. package/dist/types/src/context.d.ts +109 -0
  16. package/dist/types/src/error-page.d.ts +1 -0
  17. package/dist/types/src/index.d.ts +343 -0
  18. package/dist/types/src/island-html.d.ts +13 -0
  19. package/dist/types/src/island.d.ts +40 -0
  20. package/dist/types/src/lazy-hydration.d.ts +11 -0
  21. package/dist/types/src/markdown-page.d.ts +9 -0
  22. package/dist/types/src/markdown.d.ts +11 -0
  23. package/dist/types/src/plugin.d.ts +11 -0
  24. package/dist/types/src/runtime/client.d.ts +15 -0
  25. package/dist/types/src/runtime/hmr.d.ts +8 -0
  26. package/dist/types/src/runtime/hydration-dev.d.ts +1 -0
  27. package/dist/types/src/runtime/hydration.d.ts +10 -0
  28. package/dist/types/src/runtime/island.d.ts +8 -0
  29. package/dist/types/src/runtime/server.d.ts +8 -0
  30. package/dist/types/src/runtime/svg-id.d.ts +2 -0
  31. package/dist/types/src/server-component.d.ts +4 -0
  32. package/dist/types/src/svg.d.ts +10 -0
  33. package/package.json +62 -4
  34. package/src/adapter.ts +25 -0
  35. package/src/async-data.ts +65 -0
  36. package/src/context.ts +445 -0
  37. package/src/env.d.ts +3 -0
  38. package/src/error-page.ts +1 -0
  39. package/src/index.ts +1620 -0
  40. package/src/island-html.ts +58 -0
  41. package/src/island.ts +126 -0
  42. package/src/lazy-hydration.ts +56 -0
  43. package/src/markdown-page.ts +17 -0
  44. package/src/markdown.ts +29 -0
  45. package/src/plugin.ts +70 -0
  46. package/src/runtime/client.ts +363 -0
  47. package/src/runtime/hmr.ts +38 -0
  48. package/src/runtime/hydration-dev.ts +12 -0
  49. package/src/runtime/hydration.ts +11 -0
  50. package/src/runtime/island.ts +52 -0
  51. package/src/runtime/server.ts +56 -0
  52. package/src/runtime/svg-id.ts +12 -0
  53. package/src/server-component.ts +30 -0
  54. package/src/svg.ts +54 -0
@@ -0,0 +1,1241 @@
1
+ import {
2
+ RERUN_STATE_KEY,
3
+ LINK_STATE_ATTRIBUTE,
4
+ linkStateKey,
5
+ CLIENT_MARKERS,
6
+ repaintPage,
7
+ paintCount,
8
+ repaintWithData,
9
+ isRepaintingWithData,
10
+ routerOf,
11
+ detachedHref,
12
+ markIndicatorRendered,
13
+ markAnnouncerRendered,
14
+ keepAnnouncerClaim,
15
+ followNavigation,
16
+ currentState,
17
+ currentRoute,
18
+ renderIn,
19
+ settle
20
+ } from "../chunks/browser-index-qx74bd1y.js";
21
+ import {
22
+ defineLazyHydrationComponent2,
23
+ defineIsland2,
24
+ island2,
25
+ serverIsland2
26
+ } from "../chunks/browser-index-2h1699xv.js";
27
+ import {
28
+ devHydration
29
+ } from "../chunks/browser-index-naq02zzj.js";
30
+
31
+ // packages/adapter-html/src/index.ts
32
+ import {
33
+ addRouteMiddleware,
34
+ clearAsyncData,
35
+ $fetch,
36
+ clearError,
37
+ createForm,
38
+ disableScrollHandling,
39
+ forbidden,
40
+ navigateTo,
41
+ notFound,
42
+ permanentRedirect,
43
+ redirect,
44
+ refreshCookie,
45
+ setPageLayout,
46
+ showError,
47
+ unauthorized,
48
+ useCookie as useCookieRef,
49
+ withoutBase
50
+ } from "hamur/app";
51
+ import { reportWebVitals, syncedState } from "hamur/app";
52
+ import { deferPartId, whenAppReady } from "hamur/adapter";
53
+ import {
54
+ asyncDataArguments,
55
+ asyncDataKey,
56
+ stateArguments,
57
+ fetchKey,
58
+ timeAttributes,
59
+ timeView,
60
+ createLoadingIndicator,
61
+ createRouteAnnouncer,
62
+ createAnnouncer,
63
+ announcerActions,
64
+ announcerRole,
65
+ ROUTE_ANNOUNCER_ID,
66
+ ANNOUNCER_POLITE_ID,
67
+ ANNOUNCER_ASSERTIVE_ID,
68
+ isHandlerReference,
69
+ isPending,
70
+ resolveCallOptions,
71
+ settledOf
72
+ } from "hamur/adapter";
73
+ import {
74
+ callOnce as callOnceOf,
75
+ clearState as clearStateOf,
76
+ setResponseStatus as setResponseStatusOf,
77
+ useResponseHeader as responseHeaderOf,
78
+ useRequestEvent as requestEventOf,
79
+ useRequestFetch as requestFetchOf,
80
+ useRequestHeader as requestHeaderOf,
81
+ useRequestHeaders as requestHeadersOf,
82
+ useRequestURL as requestURLOf,
83
+ usePreviewMode as previewModeOf
84
+ } from "hamur/app";
85
+ import {
86
+ assertFormMethod,
87
+ createActionRunner,
88
+ functionFormAction,
89
+ publicError,
90
+ restoredResult,
91
+ runtimeConfigOf,
92
+ siteConfigOf,
93
+ sanitizeHead,
94
+ seoMetaToHead,
95
+ LINK_DEFAULTS,
96
+ createLinkSlot,
97
+ linkAttributes,
98
+ linkDefaultsOf,
99
+ linkExtraAttributes,
100
+ linkPending,
101
+ linkPrefetchProps,
102
+ linkState,
103
+ warnRemovedLinkProps,
104
+ relativeTarget,
105
+ resolveLinkTarget,
106
+ resolveRelative,
107
+ prefetchAttribute,
108
+ viewTransitionAttribute,
109
+ checkTransitionName,
110
+ navigationHook,
111
+ navigationBlocker,
112
+ routeGuard,
113
+ createBlocker,
114
+ registerSnapshot
115
+ } from "hamur/adapter";
116
+ import { diagnosticURL, noteOutlet, prehydrate } from "hamur/adapter";
117
+ import { markWaiting } from "hamur/adapter";
118
+
119
+ // packages/adapter-html/src/async-data.ts
120
+ import { isPreviewMode } from "hamur/adapter";
121
+ var valueOf = (value) => typeof value === "function" ? value() : value;
122
+ function requestOf({ query, body, ...rest }) {
123
+ const request = rest;
124
+ const resolvedQuery = valueOf(query);
125
+ const resolvedBody = valueOf(body);
126
+ if (resolvedQuery !== undefined)
127
+ request.query = resolvedQuery;
128
+ if (resolvedBody !== undefined)
129
+ request.body = resolvedBody;
130
+ return request;
131
+ }
132
+ function defaultGetCachedData(key, app) {
133
+ if (!app.asyncData.hydrating || isPreviewMode(app))
134
+ return;
135
+ const entry = app.asyncData.get(key);
136
+ return entry?.status === "success" ? entry.data : undefined;
137
+ }
138
+ function refreshCached(app, key, handler, options, getCachedData, cause) {
139
+ const cached = getCachedData(key, app, { cause });
140
+ if (cached !== undefined) {
141
+ app.asyncData.fetch(key, handler, { ...options, cached });
142
+ return Promise.resolve();
143
+ }
144
+ if (!app.asyncData.has(key))
145
+ app.asyncData.fetch(key, handler, { ...options, immediate: false });
146
+ return app.asyncData.refresh(key, handler);
147
+ }
148
+ var kept = new WeakMap;
149
+ function keepCached(app, key, getCachedData) {
150
+ if (getCachedData === defaultGetCachedData)
151
+ return;
152
+ let keys = kept.get(app.asyncData);
153
+ if (!keys)
154
+ kept.set(app.asyncData, keys = new Set);
155
+ if (keys.has(key))
156
+ return;
157
+ keys.add(key);
158
+ app.asyncData.subscribe(key, () => {});
159
+ }
160
+ var signalOf = (own, run) => own ? AbortSignal.any([own, run]) : run;
161
+ var callHandler = (app, fn, input) => ({ signal }) => fn(input, {
162
+ signal,
163
+ event: app.event
164
+ });
165
+ // packages/adapter-html/src/markdown.ts
166
+ import { markdownProse, markdownView, writeMarkdownView } from "hamur/adapter";
167
+ function MarkdownRenderer({ value, components: given = {}, raw }) {
168
+ const { value: nodes, components } = markdownProse(value, given);
169
+ const writers = Object.fromEntries(Object.entries(components).map(([name, component]) => [
170
+ name,
171
+ (props, children, slots) => component({ ...props, ...slots, ...children === "" ? {} : { children } })
172
+ ]));
173
+ return writeMarkdownView(markdownView(nodes, { html: raw !== undefined, components }), {
174
+ components: writers,
175
+ link: (to, attrs, children) => Link({ ...attrs, to, children }),
176
+ raw: (html) => `<hamur-html style="display:contents">${raw(html)}</hamur-html>`
177
+ });
178
+ }
179
+
180
+ // packages/adapter-html/src/index.ts
181
+ import { layoutOf, layoutSegments, matchesOf, routeDataOf } from "hamur/adapter";
182
+ import { isOnline, pollInterval, searchTarget, startPoll } from "hamur/adapter";
183
+ import { createAppUpdate } from "hamur/adapter";
184
+ var ESCAPES = { "&": "&amp;", "<": "&lt;", ">": "&gt;", '"': "&quot;" };
185
+ function escapeAttribute(value) {
186
+ return String(value).replace(/[&<>"]/g, (char) => ESCAPES[char]);
187
+ }
188
+ function attributeString(attributes) {
189
+ let out = "";
190
+ for (const [name, value] of attributes) {
191
+ if (value === undefined || value === null || value === false)
192
+ continue;
193
+ out += value === true ? ` ${name}` : ` ${name}="${escapeAttribute(value)}"`;
194
+ }
195
+ return out;
196
+ }
197
+ function keepLinkState(states, href, entry) {
198
+ let occurrence = 0;
199
+ while (states.has(linkStateKey(href, occurrence)))
200
+ occurrence++;
201
+ states.set(linkStateKey(href, occurrence), entry);
202
+ return occurrence;
203
+ }
204
+ function resolveLink(props, attrs) {
205
+ warnRemovedLinkProps(props);
206
+ const { to: target, query, relative, mask, external } = props;
207
+ const current = currentState();
208
+ const searched = current ? searchTarget(relativeTarget(target, current.route, relative), current.route, query) : target;
209
+ const { to, props: rest } = resolveLinkTarget(current?.app, searched, attrs, current?.href, external);
210
+ const href = current ? current.href(to) : detachedHref(to);
211
+ const state = current ? linkState(typeof to === "string" ? to : withoutBase(href, current.baseURL), current.route) : undefined;
212
+ return {
213
+ current,
214
+ to,
215
+ href,
216
+ state,
217
+ rest,
218
+ maskHref: mask === undefined ? undefined : current ? current.href(mask) : detachedHref(mask)
219
+ };
220
+ }
221
+ function slotOf(props, d, { current, to, href, state, maskHref }) {
222
+ const {
223
+ state: entryState,
224
+ query,
225
+ mask,
226
+ unmaskOnReload,
227
+ viewTransition,
228
+ replace,
229
+ prefetch,
230
+ prefetchOn,
231
+ pendingClass = d.pendingClass,
232
+ ariaCurrentValue = "page",
233
+ external,
234
+ noRel,
235
+ prefetchedClass = d.prefetchedClass,
236
+ scroll,
237
+ prefetchDelay = d.prefetchDelay,
238
+ rel,
239
+ target
240
+ } = props;
241
+ return createLinkSlot({
242
+ href,
243
+ to,
244
+ attrs: linkAttributes({
245
+ href,
246
+ external,
247
+ ...linkPrefetchProps({ prefetch, prefetchOn }, d),
248
+ replace,
249
+ viewTransition,
250
+ pendingClass,
251
+ trim: !!query,
252
+ mask: maskHref,
253
+ unmaskOnReload,
254
+ ariaCurrent: state?.exact ? ariaCurrentValue : undefined,
255
+ rel,
256
+ target,
257
+ noRel,
258
+ prefetchedClass,
259
+ scroll,
260
+ prefetchDelay,
261
+ externalRelAttribute: d.externalRelAttribute
262
+ }),
263
+ active: !!state?.active,
264
+ exact: !!state?.exact,
265
+ pending: !!current?.navigator?.get && linkPending(href, current.navigator.get(), current.baseURL),
266
+ external,
267
+ options: {
268
+ replace,
269
+ state: entryState,
270
+ mask,
271
+ unmaskOnReload,
272
+ viewTransition,
273
+ scroll: scroll === false ? false : undefined
274
+ },
275
+ router: current ? routerOf(current.navigator, current.baseURL, current) : null
276
+ });
277
+ }
278
+ var NO_DEFAULTS = {};
279
+ function linkOf(props, defaults) {
280
+ const {
281
+ to: _to,
282
+ href: _href,
283
+ noPrefetch: _noPrefetch,
284
+ query,
285
+ state: entryState,
286
+ relative: _relative,
287
+ mask,
288
+ unmaskOnReload,
289
+ viewTransition,
290
+ replace,
291
+ prefetch,
292
+ prefetchOn,
293
+ activeClass,
294
+ exactActiveClass,
295
+ pendingClass,
296
+ ariaCurrentValue = "page",
297
+ external,
298
+ noRel,
299
+ prefetchedClass,
300
+ scroll,
301
+ prefetchDelay,
302
+ onBeforeNavigate,
303
+ children,
304
+ ...attrs
305
+ } = props;
306
+ const resolved = resolveLink(props, attrs);
307
+ const { current, href, state, maskHref, rest } = resolved;
308
+ const d = linkDefaultsOf(current?.app, defaults);
309
+ if (typeof children === "function")
310
+ return children(slotOf(props, d, resolved));
311
+ const mode = external ? "false" : prefetchAttribute(linkPrefetchProps({ prefetch, prefetchOn }, d));
312
+ const pending = pendingClass ?? d.pendingClass;
313
+ const { class: own, ...others } = rest;
314
+ const classes = [
315
+ own,
316
+ state?.active && (activeClass ?? d.activeClass),
317
+ state?.exact && (exactActiveClass ?? d.exactActiveClass)
318
+ ].filter(Boolean).join(" ");
319
+ const entry = { state: entryState, onBeforeNavigate };
320
+ const extras = linkExtraAttributes({
321
+ href,
322
+ external,
323
+ noRel,
324
+ rel: rest.rel,
325
+ target: rest.target,
326
+ prefetchedClass: prefetchedClass ?? d.prefetchedClass,
327
+ scroll,
328
+ prefetchDelay: prefetchDelay ?? d.prefetchDelay,
329
+ externalRelAttribute: d.externalRelAttribute
330
+ });
331
+ const attributes = [
332
+ ["class", classes || undefined],
333
+ ...Object.entries(others).filter(([name]) => !(name === "rel" && extras.rel !== undefined)),
334
+ ...state?.exact && others["aria-current"] === undefined ? [["aria-current", ariaCurrentValue]] : [],
335
+ ["href", href],
336
+ ["data-hamur-prefetch", mode],
337
+ ["data-hamur-view-transition", viewTransitionAttribute(viewTransition)],
338
+ ["data-hamur-mask", maskHref],
339
+ ["data-hamur-unmask", mask !== undefined && unmaskOnReload === false ? "false" : undefined],
340
+ [
341
+ LINK_STATE_ATTRIBUTE,
342
+ (entryState !== undefined || onBeforeNavigate !== undefined) && current ? keepLinkState(current.linkStates ??= new Map, href, entry) : undefined
343
+ ],
344
+ ["data-hamur-pending-class", pending === LINK_DEFAULTS.pendingClass ? undefined : pending],
345
+ ...Object.entries(extras)
346
+ ];
347
+ return `<a${attributeString(attributes)}${replace ? " data-hamur-replace" : ""}${query ? " data-hamur-trim" : ""}>${children ?? ""}</a>`;
348
+ }
349
+ function Link(props) {
350
+ return linkOf(props, NO_DEFAULTS);
351
+ }
352
+ function defineLink(defaults) {
353
+ return (props) => linkOf(props, defaults);
354
+ }
355
+ function useLink(to, options) {
356
+ const props = { to, ...options };
357
+ return slotOf(props, linkDefaultsOf(currentState()?.app), resolveLink(props, props));
358
+ }
359
+ var navigatedTrees = new WeakSet;
360
+ function Navigate({ to, replace }) {
361
+ const target = to;
362
+ if (isServer)
363
+ throw redirect(target);
364
+ const tree = currentState()?.tree;
365
+ if (tree && navigatedTrees.has(tree))
366
+ return "";
367
+ if (tree)
368
+ navigatedTrees.add(tree);
369
+ queueMicrotask(() => void navigateTo(target, { replace }));
370
+ return "";
371
+ }
372
+ function Form({ action, method, encType, replace, reset, reloadDocument, refresh, instance, restore, ...rest }, body = "") {
373
+ assertFormMethod(action, method);
374
+ const current = currentState();
375
+ const page = current ? current.route.fullPath.replace(/#.*$/, "") : undefined;
376
+ const target = typeof action === "function" ? functionFormAction(action, current ? current.href(page) : "/", instance) : action !== undefined ? current ? current.href(action) : detachedHref(action) : current ? current.href(page) : undefined;
377
+ const attributes = [
378
+ ...Object.entries(rest),
379
+ ["method", typeof action === "function" ? "post" : "get"],
380
+ ["action", target],
381
+ ["enctype", encType],
382
+ ["data-hamur-form", ""],
383
+ ["data-hamur-replace", replace ? "" : undefined],
384
+ ["data-hamur-reset", reset ? "" : undefined],
385
+ ["data-hamur-reload", reloadDocument || typeof action === "function" ? "" : undefined],
386
+ ["data-hamur-refresh", refresh === false ? "false" : undefined],
387
+ ["data-hamur-restore", restore === false ? "false" : undefined]
388
+ ];
389
+ return `<form${attributeString(attributes)}>${body}</form>`;
390
+ }
391
+ function Time(props) {
392
+ const current = currentState();
393
+ if (!current)
394
+ throw new Error("Time() must be called inside a Hamur app");
395
+ const view = timeView(current.app, current.route.path, props);
396
+ const attributes = [
397
+ ...Object.entries(timeAttributes(props)),
398
+ ["datetime", view.iso],
399
+ ["data-locale", view.locale],
400
+ ["data-time-zone", view.timeZone]
401
+ ];
402
+ return `<time${attributeString(attributes)}>${escapeAttribute(view.text)}</time>`;
403
+ }
404
+ function LoadingIndicator(props = {}) {
405
+ markIndicatorRendered();
406
+ const attributes = [
407
+ ["data-hamur-loading-indicator", true],
408
+ ["aria-hidden", "true"],
409
+ ["data-hamur-color", props.color],
410
+ ["data-hamur-error-color", props.errorColor],
411
+ ["data-hamur-height", props.height],
412
+ ["data-hamur-duration", props.duration],
413
+ ["data-hamur-throttle", props.throttle]
414
+ ];
415
+ return `<div${attributeString(attributes)}></div>`;
416
+ }
417
+ function useLoadingIndicator(options) {
418
+ const current = currentState();
419
+ if (!current)
420
+ throw new Error("useLoadingIndicator() must be called inside a Hamur app");
421
+ const store = createLoadingIndicator(current.app, options);
422
+ followNavigation(current.app, current.navigator);
423
+ return {
424
+ get progress() {
425
+ return store.get().progress;
426
+ },
427
+ get isLoading() {
428
+ return store.get().isLoading;
429
+ },
430
+ get error() {
431
+ return store.get().error;
432
+ },
433
+ start: store.start,
434
+ finish: store.finish,
435
+ set: store.set,
436
+ clear: store.clear
437
+ };
438
+ }
439
+ function useAppUpdate() {
440
+ rerunOnHydrate();
441
+ const store = createAppUpdate(useApp());
442
+ return {
443
+ get available() {
444
+ return store.get().available;
445
+ },
446
+ get buildId() {
447
+ return store.get().buildId;
448
+ },
449
+ get time() {
450
+ return store.get().time;
451
+ },
452
+ subscribe: store.subscribe,
453
+ check: store.check
454
+ };
455
+ }
456
+ function RouteAnnouncer(props = {}) {
457
+ const current = currentState();
458
+ if (!current)
459
+ throw new Error("RouteAnnouncer() must be called inside a Hamur app");
460
+ markAnnouncerRendered();
461
+ const store = createRouteAnnouncer(current.app);
462
+ const key = {};
463
+ const claimed = store.claim(key);
464
+ keepAnnouncerClaim(() => store.release(key));
465
+ if (!claimed)
466
+ return `<div${attributeString([
467
+ ["aria-live", "off"],
468
+ ["aria-atomic", "true"]
469
+ ])}></div>`;
470
+ const live = props.politeness ?? store.get().politeness;
471
+ const attributes = [
472
+ ["id", ROUTE_ANNOUNCER_ID],
473
+ ["data-hamur-announcer", "route"],
474
+ ["aria-live", live],
475
+ ["aria-atomic", "true"],
476
+ ["role", announcerRole(live)],
477
+ ["data-hamur-politeness", props.politeness],
478
+ ["class", props.class],
479
+ ["style", props.style]
480
+ ];
481
+ return `<div${attributeString(attributes)}></div>`;
482
+ }
483
+ function useRouteAnnouncer() {
484
+ const current = currentState();
485
+ if (!current)
486
+ throw new Error("useRouteAnnouncer() must be called inside a Hamur app");
487
+ const store = createRouteAnnouncer(current.app);
488
+ return {
489
+ get message() {
490
+ return store.get().message;
491
+ },
492
+ get politeness() {
493
+ return store.get().politeness;
494
+ },
495
+ set: store.set,
496
+ polite: store.polite,
497
+ assertive: store.assertive
498
+ };
499
+ }
500
+ function Announcer() {
501
+ if (!currentState())
502
+ throw new Error("Announcer() must be called inside a Hamur app");
503
+ markAnnouncerRendered();
504
+ return [
505
+ `<div${attributeString([
506
+ ["id", ANNOUNCER_POLITE_ID],
507
+ ["data-hamur-announcer", "polite"],
508
+ ["aria-live", "polite"],
509
+ ["aria-atomic", "true"],
510
+ ["role", "status"]
511
+ ])}></div>`,
512
+ `<div${attributeString([
513
+ ["id", ANNOUNCER_ASSERTIVE_ID],
514
+ ["data-hamur-announcer", "assertive"],
515
+ ["aria-live", "assertive"],
516
+ ["aria-atomic", "true"],
517
+ ["role", "alert"]
518
+ ])}></div>`
519
+ ].join("");
520
+ }
521
+ function useAnnouncer({ politeness = "polite" } = {}) {
522
+ const current = currentState();
523
+ if (!current)
524
+ throw new Error("useAnnouncer() must be called inside a Hamur app");
525
+ const store = createAnnouncer(current.app);
526
+ return {
527
+ get message() {
528
+ return store.get().message;
529
+ },
530
+ get politeness() {
531
+ return store.get().politeness;
532
+ },
533
+ ...announcerActions(store, politeness)
534
+ };
535
+ }
536
+ function useRoute(name) {
537
+ const route = currentRoute();
538
+ if (!route)
539
+ throw new Error("useRoute() must be called inside a Hamur app");
540
+ return route;
541
+ }
542
+ function useResolvedPath(to, { relative } = {}) {
543
+ return resolveRelative(to, useRoute(), relative);
544
+ }
545
+ function useRouter() {
546
+ const state = currentState();
547
+ if (!state)
548
+ throw new Error("useRouter() must be called inside a Hamur app");
549
+ return routerOf(state.navigator, state.baseURL, state);
550
+ }
551
+ function useData(...unknownRoute) {
552
+ const state = currentState();
553
+ if (!state)
554
+ throw new Error("useData() must be called inside a Hamur app");
555
+ const id = state.id;
556
+ return id === undefined ? null : state.data[id] ?? null;
557
+ }
558
+ function useError() {
559
+ const state = currentState();
560
+ if (!state)
561
+ throw new Error("useError() must be called inside a Hamur app");
562
+ if (state.boundaryError)
563
+ return state.boundaryError;
564
+ const stored = state.app.error?.get();
565
+ if (stored)
566
+ return stored;
567
+ return state.tree.error ? state.route.error : undefined;
568
+ }
569
+ function useRouteData(name) {
570
+ const state = currentState();
571
+ if (!state)
572
+ throw new Error("useRouteData() must be called inside a Hamur app");
573
+ return routeDataOf(state.route, state.data, name);
574
+ }
575
+ function useMatches() {
576
+ const state = currentState();
577
+ if (!state)
578
+ throw new Error("useMatches() must be called inside a Hamur app");
579
+ return matchesOf(state.route, state.data);
580
+ }
581
+ var isDev = import.meta.dev === true;
582
+ var warnedSlots = new Set;
583
+ function Outlet({ context, name } = {}) {
584
+ const state = currentState();
585
+ if (!state)
586
+ throw new Error("Outlet() must be called inside a Hamur app");
587
+ const render = () => {
588
+ if (name === undefined) {
589
+ if (isDev)
590
+ noteOutlet(state.id);
591
+ return state.outlet?.() ?? "";
592
+ }
593
+ const slot = state.slots?.[name];
594
+ if (!slot && isDev && !warnedSlots.has(`${state.id}:${name}`)) {
595
+ warnedSlots.add(`${state.id}:${name}`);
596
+ console.warn(`Outlet name "${name}" has no slot in ${state.id}`);
597
+ }
598
+ return slot?.() ?? "";
599
+ };
600
+ if (context === undefined)
601
+ return render();
602
+ const above = state.outletValue;
603
+ state.outletValue = context;
604
+ try {
605
+ return render();
606
+ } finally {
607
+ state.outletValue = above;
608
+ }
609
+ }
610
+ function useOutletContext() {
611
+ const state = currentState();
612
+ if (!state)
613
+ throw new Error("useOutletContext() must be called inside a Hamur app");
614
+ return state.outletValue;
615
+ }
616
+ function useLayoutSegments() {
617
+ const state = currentState();
618
+ if (!state)
619
+ throw new Error("useLayoutSegments() must be called inside a Hamur app");
620
+ return layoutSegments(state.route, state.id);
621
+ }
622
+ function useLayoutSegment() {
623
+ return useLayoutSegments()[0] ?? null;
624
+ }
625
+ function useLayout() {
626
+ const state = currentState();
627
+ if (!state)
628
+ throw new Error("useLayout() must be called inside a Hamur app");
629
+ return layoutOf(state.tree);
630
+ }
631
+ function ErrorBoundary({ children, fallback }) {
632
+ const parts = currentState()?.deferred;
633
+ const kept = parts?.length ?? 0;
634
+ try {
635
+ return settle(children());
636
+ } catch (error) {
637
+ if (parts)
638
+ parts.length = kept;
639
+ const app = currentState()?.app;
640
+ return fallback({ error: app ? publicError(app, error) : error, reset: repaintPage });
641
+ }
642
+ }
643
+ var learned = new WeakMap;
644
+ var watching = new WeakSet;
645
+ function learnOutcome(promise) {
646
+ if (watching.has(promise))
647
+ return;
648
+ watching.add(promise);
649
+ const settle = (outcome) => {
650
+ learned.set(promise, outcome);
651
+ queueMicrotask(() => repaintWithData(paintCount()));
652
+ };
653
+ promise.then((value) => settle({ status: "fulfilled", value }), (reason) => settle({ status: "rejected", reason }));
654
+ }
655
+ function Await(promise, { fallback = "", then, error }) {
656
+ const shown = (outcome) => {
657
+ if (outcome.status === "fulfilled")
658
+ return then(outcome.value);
659
+ if (error)
660
+ return error(outcome.reason);
661
+ throw outcome.reason;
662
+ };
663
+ const outcome = typeof promise?.then === "function" ? settledOf(promise) ?? learned.get(promise) : { status: "fulfilled", value: promise };
664
+ if (outcome)
665
+ return shown(outcome);
666
+ if (!isServer)
667
+ learnOutcome(promise);
668
+ const state = currentState();
669
+ if (!state?.deferred)
670
+ return fallback;
671
+ const id = state.deferred.length;
672
+ const value = Promise.resolve(promise);
673
+ value.catch(() => {});
674
+ const captured = { ...state };
675
+ state.deferred.push({
676
+ id,
677
+ value,
678
+ render: (settled) => renderIn(captured, () => shown("error" in settled ? { status: "rejected", reason: settled.error } : { status: "fulfilled", value: settled.value }))
679
+ });
680
+ return `<hamur-defer id="${deferPartId(id)}">${fallback}</hamur-defer>`;
681
+ }
682
+ function ClientOnly(children, { fallback = "" } = {}) {
683
+ if (!isServer)
684
+ return children();
685
+ if (currentState()?.route.meta.scripts === false)
686
+ return fallback;
687
+ return `<!--${CLIENT_MARKERS[0]}-->${fallback}<!--${CLIENT_MARKERS[1]}--><template data-hamur-client>${children()}</template>`;
688
+ }
689
+ function DevOnly(children, { fallback = "" } = {}) {
690
+ return (isDev || devHydration.devClient === true) && children ? children() : fallback;
691
+ }
692
+ function DefaultErrorPage({ error }) {
693
+ const code = isDev && error.code ? `<p><a href="${escapeAttribute(diagnosticURL(error.code))}" target="_blank" rel="noopener">${escapeAttribute(error.code)}</a></p>` : "";
694
+ const stack = error.stack ? `<pre>${escapeAttribute(error.stack)}</pre>` : "";
695
+ return `<main style="font-family:system-ui,sans-serif;text-align:center;padding:4rem 1rem"><h1 style="font-size:4rem;margin:0">${error.status}</h1><p>${escapeAttribute(error.message)}</p>${code}${stack}${Link({ to: "/", children: "Back home" })}</main>`;
696
+ }
697
+ function useApp() {
698
+ const state = currentState();
699
+ if (!state)
700
+ throw new Error("useApp() must be called inside a Hamur app");
701
+ return state.app;
702
+ }
703
+ function useId() {
704
+ const state = currentState();
705
+ if (!state)
706
+ throw new Error("useId() must be called inside a Hamur app");
707
+ return `s-${state.ids.next++}`;
708
+ }
709
+ function useHydrated() {
710
+ const app = useApp();
711
+ return () => !isServer && !app.asyncData.hydrating;
712
+ }
713
+ function useRequestEvent() {
714
+ return requestEventOf(useApp());
715
+ }
716
+ function usePreviewMode() {
717
+ return previewModeOf(useApp());
718
+ }
719
+ function useRequestHeaders(names) {
720
+ return requestHeadersOf(useApp(), names);
721
+ }
722
+ function useRequestHeader(name) {
723
+ return requestHeaderOf(useApp(), name);
724
+ }
725
+ function useRequestURL() {
726
+ return requestURLOf(useApp());
727
+ }
728
+ function useRequestFetch() {
729
+ return requestFetchOf(useApp());
730
+ }
731
+ function setResponseStatus(status, statusText) {
732
+ setResponseStatusOf(useApp(), status, statusText);
733
+ }
734
+ function useResponseHeader(name) {
735
+ const header = responseHeaderOf(useApp(), name);
736
+ return {
737
+ get value() {
738
+ return header.get();
739
+ },
740
+ set value(next) {
741
+ header.set(next);
742
+ }
743
+ };
744
+ }
745
+ function useAsyncDataEntry(target, input) {
746
+ const key = typeof target === "string" ? target : asyncDataKey(target, input);
747
+ const store = useApp().asyncData;
748
+ return {
749
+ get data() {
750
+ return store.get(key)?.data;
751
+ },
752
+ set data(next) {
753
+ store.setData(key, next);
754
+ }
755
+ };
756
+ }
757
+ function clearState(keys, options) {
758
+ clearStateOf(useApp(), keys, options);
759
+ }
760
+ function callOnce(key, fn, options) {
761
+ return callOnceOf(useApp(), key, fn, options);
762
+ }
763
+ function useRuntimeConfig() {
764
+ return runtimeConfigOf(useApp());
765
+ }
766
+ function useSiteConfig() {
767
+ return siteConfigOf(useApp());
768
+ }
769
+ function onPrehydrate(fn) {
770
+ const id = prehydrate(useApp(), fn);
771
+ return id === undefined ? "" : `data-hamur-p="${id}"`;
772
+ }
773
+ var onBeforeNavigate = (fn) => navigationHook("before", fn);
774
+ var onNavigate = (fn) => navigationHook("navigate", fn);
775
+ var onAfterNavigate = (fn) => navigationHook("after", fn);
776
+ function scoped(remove) {
777
+ currentState()?.scoped?.push(remove);
778
+ return remove;
779
+ }
780
+ var onBeforeRouteLeave = (fn) => scoped(routeGuard("leave", currentState()?.id, fn));
781
+ var onBeforeRouteUpdate = (fn) => scoped(routeGuard("update", currentState()?.id, fn));
782
+ var usePreventNavigate = (fn) => scoped(navigationBlocker(fn));
783
+ var useSnapshot = (key, options) => scoped(registerSnapshot(key, options));
784
+ function useRuntimeHook(name, fn) {
785
+ scoped(useApp().hooks.hook(name, fn));
786
+ }
787
+ function useReportWebVitals(fn) {
788
+ scoped(reportWebVitals(useApp(), fn));
789
+ }
790
+ var readyOfApp = new WeakMap;
791
+ function onAppReady(fn) {
792
+ if (typeof window === "undefined")
793
+ return;
794
+ const app = useApp();
795
+ let visit = readyOfApp.get(app);
796
+ if (!visit) {
797
+ const created = visit = { render: undefined, index: 0, scheduled: 0 };
798
+ readyOfApp.set(app, created);
799
+ navigationHook("navigate", () => {
800
+ created.scheduled = 0;
801
+ });
802
+ }
803
+ const render = currentState()?.scoped;
804
+ if (visit.render !== render) {
805
+ visit.render = render;
806
+ visit.index = 0;
807
+ }
808
+ const index = visit.index++;
809
+ if (index < visit.scheduled)
810
+ return;
811
+ visit.scheduled = index + 1;
812
+ whenAppReady(app, fn);
813
+ }
814
+ function useBlocker(options) {
815
+ const store = createBlocker(options);
816
+ const remove = scoped(store.start());
817
+ return {
818
+ get state() {
819
+ return store.get().state;
820
+ },
821
+ get location() {
822
+ return store.get().location;
823
+ },
824
+ proceed: () => store.get().proceed(),
825
+ reset: () => store.get().reset(),
826
+ subscribe: store.subscribe,
827
+ remove
828
+ };
829
+ }
830
+ function useNavigation() {
831
+ const state = currentState();
832
+ if (!state)
833
+ throw new Error("useNavigation() must be called inside a Hamur app");
834
+ if (state.completesNavigation)
835
+ return { state: "idle", pending: false };
836
+ return state.navigator?.get?.() ?? { state: "idle", pending: false };
837
+ }
838
+ function useSearch(select) {
839
+ const state = currentState();
840
+ if (!state)
841
+ throw new Error("useSearch() must be called inside a Hamur app");
842
+ const router = useRouter();
843
+ const value = select ? select(state.route.search) : state.route.search;
844
+ const set = (change, { replace = true } = {}) => {
845
+ const update = { query: (prev) => typeof change === "function" ? change(prev) : change };
846
+ return replace ? router.replace(update) : router.navigate(update);
847
+ };
848
+ return { value, set };
849
+ }
850
+ var pollsOfApp = new WeakMap;
851
+ function usePoll(ms, options = {}) {
852
+ pollInterval(ms);
853
+ const router = useRouter();
854
+ if (typeof document === "undefined")
855
+ return () => {};
856
+ const state = currentState();
857
+ let polls = pollsOfApp.get(state.app);
858
+ if (!polls) {
859
+ const registry = polls = new Map;
860
+ pollsOfApp.set(state.app, registry);
861
+ navigationHook("after", ({ to }) => {
862
+ for (const [, poll] of [...registry])
863
+ if (poll.page !== to?.name)
864
+ poll.stop();
865
+ });
866
+ }
867
+ const id = JSON.stringify([ms, options.keys ?? null]);
868
+ const running = polls.get(id);
869
+ if (running)
870
+ return running.stop;
871
+ const registry = polls;
872
+ const stop = startPoll(ms, () => options.keys ? router.refresh(options.keys) : router.refresh());
873
+ const poll = {
874
+ page: state.route.name,
875
+ stop() {
876
+ stop();
877
+ registry.delete(id);
878
+ }
879
+ };
880
+ registry.set(id, poll);
881
+ return poll.stop;
882
+ }
883
+ function useOnline() {
884
+ return {
885
+ get value() {
886
+ return isOnline();
887
+ }
888
+ };
889
+ }
890
+ function rerunOnHydrate() {
891
+ if (typeof document === "undefined")
892
+ currentState()?.app.state.set(RERUN_STATE_KEY, true);
893
+ }
894
+ function useSyncedState(key, initial, options = {}) {
895
+ rerunOnHydrate();
896
+ const { get, set, subscribe } = syncedState(key, initial, options);
897
+ return { get, set, subscribe };
898
+ }
899
+ var handlerForms = new WeakMap;
900
+ function useForm(fn) {
901
+ const state = currentState();
902
+ if (!state)
903
+ throw new Error("useForm() must be called inside a Hamur app");
904
+ let byFunction = handlerForms.get(state.app);
905
+ if (!byFunction)
906
+ handlerForms.set(state.app, byFunction = new WeakMap);
907
+ let form = byFunction.get(fn);
908
+ if (!form) {
909
+ byFunction.set(fn, form = createForm(fn, { app: state.app, submitted: () => currentState() ?? state }));
910
+ form.subscribe(repaintPage);
911
+ }
912
+ return form;
913
+ }
914
+ var actions = new WeakMap;
915
+ function useAction(fn, options = {}) {
916
+ const state = currentState();
917
+ if (!state)
918
+ throw new Error("useAction() must be called inside a Hamur app");
919
+ let byFunction = actions.get(state.app);
920
+ if (!byFunction)
921
+ actions.set(state.app, byFunction = new WeakMap);
922
+ let instances = byFunction.get(fn);
923
+ if (!instances)
924
+ byFunction.set(fn, instances = new Map);
925
+ const { instance } = options;
926
+ const key = instance === undefined ? undefined : String(instance);
927
+ let entry = instances.get(key);
928
+ if (!entry) {
929
+ const created = { options, runner: undefined };
930
+ created.runner = createActionRunner(fn, {
931
+ app: state.app,
932
+ instance,
933
+ options: () => created.options,
934
+ refresh: () => routerOf(state.navigator, state.baseURL).refresh(),
935
+ restored: restoredResult(state.handlerState, fn.id, instance)
936
+ });
937
+ instances.set(key, entry = created);
938
+ }
939
+ entry.options = options;
940
+ const { runner } = entry;
941
+ return {
942
+ run: runner.run,
943
+ reset: runner.reset,
944
+ subscribe: runner.subscribe,
945
+ get state() {
946
+ return runner.get().state;
947
+ },
948
+ get pending() {
949
+ return runner.get().pending;
950
+ },
951
+ get error() {
952
+ return runner.get().error;
953
+ },
954
+ get failure() {
955
+ return runner.get().failure;
956
+ }
957
+ };
958
+ }
959
+ function pushHead(name, input, options) {
960
+ const state = currentState();
961
+ if (!state)
962
+ throw new Error(`${name}() must be called inside a Hamur app`);
963
+ if (!options?.server && typeof document === "undefined")
964
+ state.app.state?.set(RERUN_STATE_KEY, true);
965
+ if (state.pending) {
966
+ state.pending.push({ input, options });
967
+ return;
968
+ }
969
+ const entry = state.head.push(input, options);
970
+ state.entries?.push(entry);
971
+ }
972
+ function useHead(input) {
973
+ pushHead("useHead", input);
974
+ }
975
+ function useSeoMeta(input) {
976
+ useHead(seoMetaToHead(input));
977
+ }
978
+ function useHeadSafe(input) {
979
+ useHead(sanitizeHead(input));
980
+ }
981
+ function useServerHead(input) {
982
+ if (typeof document === "undefined")
983
+ pushHead("useServerHead", input, { server: true });
984
+ }
985
+ function useServerSeoMeta(input) {
986
+ if (typeof document === "undefined")
987
+ useServerHead(seoMetaToHead(input));
988
+ }
989
+ function useState(...args) {
990
+ const { key, init } = stateArguments(args);
991
+ const store = currentState()?.app.state;
992
+ if (!store)
993
+ throw new Error("useState() must be called inside a Hamur app");
994
+ store.use(key, init);
995
+ return {
996
+ get value() {
997
+ return store.get(key);
998
+ },
999
+ set value(next) {
1000
+ store.set(key, next);
1001
+ }
1002
+ };
1003
+ }
1004
+ function useCookie(name, options = {}) {
1005
+ const cookie = useCookieRef(name, { ...options, app: useApp() });
1006
+ return {
1007
+ get value() {
1008
+ return cookie.get();
1009
+ },
1010
+ set value(next) {
1011
+ cookie.set(next);
1012
+ }
1013
+ };
1014
+ }
1015
+ var isServer = typeof document === "undefined";
1016
+ var holds = [];
1017
+ function holdForPaint(store, key, pending) {
1018
+ const paint = paintCount();
1019
+ let hold = holds.find((item) => item.paint === paint && item.store === store && item.key === key);
1020
+ if (!hold) {
1021
+ const created = { paint, store, key, waiting: false, stop: () => {} };
1022
+ created.stop = store.subscribe(key, () => {
1023
+ const status = store.get(key)?.status;
1024
+ if (!created.waiting || status === "pending" || status === "idle")
1025
+ return;
1026
+ created.waiting = false;
1027
+ queueMicrotask(() => repaintWithData(paint));
1028
+ });
1029
+ holds.push(hold = created);
1030
+ }
1031
+ if (pending)
1032
+ hold.waiting = true;
1033
+ const earlier = holds.filter((item) => item.paint !== paint);
1034
+ if (!earlier.length)
1035
+ return;
1036
+ holds = holds.filter((item) => item.paint === paint);
1037
+ for (const item of earlier)
1038
+ item.stop();
1039
+ }
1040
+ function useAsyncData(...args) {
1041
+ const [first, second, given] = asyncDataArguments("useAsyncData", args);
1042
+ const options = given ?? {};
1043
+ if (!isHandlerReference(first))
1044
+ return keyedAsyncData(first, second, options);
1045
+ const input = valueOf(second);
1046
+ return keyedAsyncData(asyncDataKey(first, input), callHandler(useApp(), first, input), options);
1047
+ }
1048
+ function keyedAsyncData(keyOrGetter, handler, options) {
1049
+ const key = valueOf(keyOrGetter);
1050
+ const app = useApp();
1051
+ const store = app.asyncData;
1052
+ const {
1053
+ server,
1054
+ lazy,
1055
+ default: init,
1056
+ transform,
1057
+ immediate,
1058
+ dedupe,
1059
+ pick,
1060
+ getCachedData = defaultGetCachedData
1061
+ } = options;
1062
+ const settings = {
1063
+ server,
1064
+ lazy,
1065
+ default: init,
1066
+ transform,
1067
+ immediate,
1068
+ dedupe,
1069
+ pick
1070
+ };
1071
+ const again = !isServer && isRepaintingWithData();
1072
+ keepCached(app, key, getCachedData);
1073
+ const entry = store.fetch(key, handler, again ? settings : { ...settings, cached: getCachedData(key, app, { cause: "initial" }) });
1074
+ if (isServer) {
1075
+ if (entry.status === "pending")
1076
+ markWaiting(store);
1077
+ } else
1078
+ holdForPaint(store, key, entry.status === "pending" || store.hydrating && server === false && immediate !== false && entry.status === "idle");
1079
+ const read = () => store.get(key) ?? entry;
1080
+ const refresh = () => refreshCached(app, key, handler, settings, getCachedData, "refresh:manual");
1081
+ if (!isServer && !store.refreshHook(key))
1082
+ store.onRefresh(key, () => refreshCached(app, key, handler, settings, getCachedData, "refresh:hook"));
1083
+ return {
1084
+ get data() {
1085
+ return read().data;
1086
+ },
1087
+ get error() {
1088
+ return read().error;
1089
+ },
1090
+ get status() {
1091
+ return read().status;
1092
+ },
1093
+ get pending() {
1094
+ return isPending(app, read());
1095
+ },
1096
+ refresh,
1097
+ execute: refresh,
1098
+ clear: () => clearAsyncData(app, key),
1099
+ subscribe: (listener) => store.subscribe(key, listener)
1100
+ };
1101
+ }
1102
+ function useFetch(urlOrGetter, options = {}) {
1103
+ return fetchWith(undefined, urlOrGetter, options);
1104
+ }
1105
+ function fetchWith(client, urlOrGetter, options) {
1106
+ const {
1107
+ key,
1108
+ server,
1109
+ lazy,
1110
+ default: init,
1111
+ transform,
1112
+ immediate,
1113
+ dedupe,
1114
+ pick,
1115
+ watch: _watch,
1116
+ getCachedData,
1117
+ ...rest
1118
+ } = options;
1119
+ const url = valueOf(urlOrGetter);
1120
+ const request = requestOf(rest);
1121
+ const fetcher = client ?? useApp().fetch ?? $fetch;
1122
+ return useAsyncData(key ?? fetchKey(url, request), ({ signal }) => fetcher(url, { ...request, signal: signalOf(request.signal, signal) }), { server, lazy, default: init, transform, immediate, dedupe, pick, getCachedData });
1123
+ }
1124
+ function createUseFetch(defaults, { $fetch: client } = {}) {
1125
+ return (url, options) => fetchWith(client, url, resolveCallOptions(defaults, options));
1126
+ }
1127
+ function createUseAsyncData(defaults) {
1128
+ return (...args) => {
1129
+ const [first, second, options] = asyncDataArguments("useAsyncData", args);
1130
+ return useAsyncData(first, second, resolveCallOptions(defaults, options));
1131
+ };
1132
+ }
1133
+ var useLazyFetch = (url, options) => useFetch(url, { ...options, lazy: true });
1134
+ var useLazyAsyncData = (...args) => {
1135
+ const [first, second, options] = asyncDataArguments("useLazyAsyncData", args);
1136
+ return useAsyncData(first, second, {
1137
+ ...options,
1138
+ lazy: true
1139
+ });
1140
+ };
1141
+ function transitionName(name) {
1142
+ return `view-transition-name: ${checkTransitionName(name)}`;
1143
+ }
1144
+ export {
1145
+ Announcer,
1146
+ Await,
1147
+ ClientOnly,
1148
+ DefaultErrorPage,
1149
+ DevOnly,
1150
+ ErrorBoundary,
1151
+ Form,
1152
+ Link,
1153
+ LoadingIndicator,
1154
+ MarkdownRenderer,
1155
+ Navigate,
1156
+ Outlet,
1157
+ RouteAnnouncer,
1158
+ Time,
1159
+ addRouteMiddleware,
1160
+ callOnce,
1161
+ clearError,
1162
+ clearState,
1163
+ createUseAsyncData,
1164
+ createUseFetch,
1165
+ defineIsland2 as defineIsland,
1166
+ defineLazyHydrationComponent2 as defineLazyHydrationComponent,
1167
+ defineLink,
1168
+ disableScrollHandling,
1169
+ forbidden,
1170
+ island2 as island,
1171
+ navigateTo,
1172
+ notFound,
1173
+ onAfterNavigate,
1174
+ onAppReady,
1175
+ onBeforeNavigate,
1176
+ onBeforeRouteLeave,
1177
+ onBeforeRouteUpdate,
1178
+ onNavigate,
1179
+ onPrehydrate,
1180
+ permanentRedirect,
1181
+ refreshCookie,
1182
+ rerunOnHydrate,
1183
+ serverIsland2 as serverIsland,
1184
+ setPageLayout,
1185
+ setResponseStatus,
1186
+ showError,
1187
+ transitionName,
1188
+ unauthorized,
1189
+ useAction,
1190
+ useAnnouncer,
1191
+ useApp,
1192
+ useAppUpdate,
1193
+ useAsyncData,
1194
+ useAsyncDataEntry,
1195
+ useBlocker,
1196
+ useCookie,
1197
+ useData,
1198
+ useError,
1199
+ useFetch,
1200
+ useForm,
1201
+ useHead,
1202
+ useHeadSafe,
1203
+ useHydrated,
1204
+ useId,
1205
+ useLayout,
1206
+ useLayoutSegment,
1207
+ useLayoutSegments,
1208
+ useLazyAsyncData,
1209
+ useLazyFetch,
1210
+ useLink,
1211
+ useLoadingIndicator,
1212
+ useMatches,
1213
+ useNavigation,
1214
+ useOnline,
1215
+ useOutletContext,
1216
+ usePoll,
1217
+ usePreventNavigate,
1218
+ usePreviewMode,
1219
+ useReportWebVitals,
1220
+ useRequestEvent,
1221
+ useRequestFetch,
1222
+ useRequestHeader,
1223
+ useRequestHeaders,
1224
+ useRequestURL,
1225
+ useResolvedPath,
1226
+ useResponseHeader,
1227
+ useRoute,
1228
+ useRouteAnnouncer,
1229
+ useRouteData,
1230
+ useRouter,
1231
+ useRuntimeConfig,
1232
+ useRuntimeHook,
1233
+ useSearch,
1234
+ useSeoMeta,
1235
+ useServerHead,
1236
+ useServerSeoMeta,
1237
+ useSiteConfig,
1238
+ useSnapshot,
1239
+ useState,
1240
+ useSyncedState
1241
+ };