@hamur/adapter-preact 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-89d71ade.js +118 -0
- package/dist/chunks/browser-index-ezte15pp.js +67 -0
- package/dist/chunks/browser-index-hsy7tnbg.js +21 -0
- package/dist/chunks/browser-index-k3m2axbw.js +274 -0
- package/dist/src/adapter.js +456 -0
- package/dist/src/error-page.js +391 -0
- package/dist/src/index.js +1506 -0
- package/dist/src/keepalive.js +6 -0
- package/dist/src/runtime/client.js +96 -0
- package/dist/src/runtime/island.js +33 -0
- package/dist/src/runtime/server.js +95 -0
- package/dist/types/src/activation.d.ts +15 -0
- package/dist/types/src/adapter.d.ts +2 -0
- package/dist/types/src/async-data.d.ts +13 -0
- package/dist/types/src/client-component.d.ts +11 -0
- package/dist/types/src/client-fallback.d.ts +2 -0
- package/dist/types/src/context.d.ts +81 -0
- package/dist/types/src/error-page.d.ts +1 -0
- package/dist/types/src/head.d.ts +5 -0
- package/dist/types/src/index.d.ts +429 -0
- package/dist/types/src/island-html.d.ts +13 -0
- package/dist/types/src/island.d.ts +19 -0
- package/dist/types/src/jsx-locator.d.ts +6 -0
- package/dist/types/src/keepalive.d.ts +26 -0
- package/dist/types/src/lazy-hydration.d.ts +12 -0
- package/dist/types/src/markdown-page.d.ts +9 -0
- package/dist/types/src/markdown.d.ts +12 -0
- package/dist/types/src/plugin.d.ts +36 -0
- package/dist/types/src/route-boundary.d.ts +41 -0
- package/dist/types/src/runtime/client.d.ts +10 -0
- package/dist/types/src/runtime/hmr.d.ts +31 -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 +11 -0
- package/dist/types/src/server-island.d.ts +10 -0
- package/dist/types/src/svg.d.ts +10 -0
- package/package.json +71 -4
- package/src/activation.ts +51 -0
- package/src/adapter.ts +35 -0
- package/src/async-data.ts +65 -0
- package/src/client-component.ts +23 -0
- package/src/client-fallback.ts +2 -0
- package/src/context.ts +372 -0
- package/src/env.d.ts +3 -0
- package/src/error-page.ts +1 -0
- package/src/head.ts +34 -0
- package/src/index.ts +1868 -0
- package/src/island-html.ts +58 -0
- package/src/island.ts +56 -0
- package/src/jsx-locator.ts +199 -0
- package/src/keepalive.ts +100 -0
- package/src/lazy-hydration.ts +101 -0
- package/src/markdown-page.ts +18 -0
- package/src/markdown.ts +58 -0
- package/src/plugin.ts +231 -0
- package/src/route-boundary.ts +51 -0
- package/src/runtime/client.ts +85 -0
- package/src/runtime/hmr.ts +141 -0
- package/src/runtime/hydration-dev.ts +8 -0
- package/src/runtime/hydration.ts +7 -0
- package/src/runtime/island.ts +37 -0
- package/src/runtime/server.ts +102 -0
- package/src/server-island.ts +35 -0
- package/src/svg.ts +27 -0
- package/src/webmcp.d.ts +18 -0
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
import {
|
|
2
|
+
clientComponent2,
|
|
3
|
+
clientFallbackIds
|
|
4
|
+
} from "../../chunks/browser-index-hsy7tnbg.js";
|
|
5
|
+
import {
|
|
6
|
+
AppContextContext,
|
|
7
|
+
installKeepAlive2,
|
|
8
|
+
buildElement,
|
|
9
|
+
RootBoundary
|
|
10
|
+
} from "../../chunks/browser-index-k3m2axbw.js";
|
|
11
|
+
|
|
12
|
+
// packages/adapter-preact/src/runtime/client.ts
|
|
13
|
+
import { h, hydrate as hydrateInto, render } from "preact";
|
|
14
|
+
import { useContext, useEffect, useId, useRef, useState } from "preact/hooks";
|
|
15
|
+
import { setAdapterInstance } from "hamur/adapter";
|
|
16
|
+
import { fetchServerComponent, serverComponentAttributes, serverComponentProps, takeServerHTML } from "hamur/adapter";
|
|
17
|
+
|
|
18
|
+
// packages/adapter-preact/src/runtime/hydration.ts
|
|
19
|
+
var devHydration = {};
|
|
20
|
+
|
|
21
|
+
// packages/adapter-preact/src/runtime/client.ts
|
|
22
|
+
var container;
|
|
23
|
+
var starting;
|
|
24
|
+
var hydrationCanBeAborted = true;
|
|
25
|
+
function element(ctx) {
|
|
26
|
+
return h(RootBoundary, { app: ctx.app, children: buildElement(ctx) });
|
|
27
|
+
}
|
|
28
|
+
async function hydrate(ctx) {
|
|
29
|
+
await (starting = setAdapterInstance(ctx.app, null));
|
|
30
|
+
container = ctx.root;
|
|
31
|
+
for (const id of Array.isArray(ctx.payload.clientFallback) ? ctx.payload.clientFallback : [])
|
|
32
|
+
clientFallbackIds.add(String(id));
|
|
33
|
+
const watch = devHydration.watch?.(container);
|
|
34
|
+
hydrateInto(element(ctx), container);
|
|
35
|
+
watch?.done();
|
|
36
|
+
}
|
|
37
|
+
async function mount(ctx) {
|
|
38
|
+
await (starting = setAdapterInstance(ctx.app, null));
|
|
39
|
+
container = ctx.root;
|
|
40
|
+
render(element(ctx), container);
|
|
41
|
+
}
|
|
42
|
+
function update(ctx) {
|
|
43
|
+
if (!container && starting)
|
|
44
|
+
return starting.then(() => update(ctx));
|
|
45
|
+
if (!container)
|
|
46
|
+
throw new Error("update() called before hydrate() or mount()");
|
|
47
|
+
render(element(ctx), container);
|
|
48
|
+
}
|
|
49
|
+
function serverComponent(name) {
|
|
50
|
+
function ServerComponent(props) {
|
|
51
|
+
const app = useContext(AppContextContext);
|
|
52
|
+
const uid = useId();
|
|
53
|
+
const text = serverComponentProps(name, props, props.children !== undefined);
|
|
54
|
+
const [shown, setShown] = useState(() => {
|
|
55
|
+
const html = takeServerHTML(app, uid, name);
|
|
56
|
+
return html === undefined ? { view: { html: "" } } : { text, view: { html } };
|
|
57
|
+
});
|
|
58
|
+
const head = useRef(undefined);
|
|
59
|
+
useEffect(() => () => head.current?.dispose(), []);
|
|
60
|
+
useEffect(() => {
|
|
61
|
+
if (shown.text === text)
|
|
62
|
+
return;
|
|
63
|
+
const controller = new AbortController;
|
|
64
|
+
fetchServerComponent(app, name, text, controller.signal).then((view) => {
|
|
65
|
+
if (controller.signal.aborted)
|
|
66
|
+
return;
|
|
67
|
+
head.current?.dispose();
|
|
68
|
+
head.current = view.head ? app.head.push(view.head) : undefined;
|
|
69
|
+
setShown({ text, view });
|
|
70
|
+
}).catch((error) => {
|
|
71
|
+
if (!controller.signal.aborted)
|
|
72
|
+
setShown((last) => ({ ...last, error }));
|
|
73
|
+
});
|
|
74
|
+
return () => controller.abort();
|
|
75
|
+
}, [text]);
|
|
76
|
+
if (shown.error !== undefined)
|
|
77
|
+
throw shown.error;
|
|
78
|
+
return h("hamur-component", {
|
|
79
|
+
name,
|
|
80
|
+
uid,
|
|
81
|
+
...serverComponentAttributes(name),
|
|
82
|
+
dangerouslySetInnerHTML: { __html: shown.view.html }
|
|
83
|
+
});
|
|
84
|
+
}
|
|
85
|
+
ServerComponent.displayName = `${name}.server`;
|
|
86
|
+
return ServerComponent;
|
|
87
|
+
}
|
|
88
|
+
export {
|
|
89
|
+
clientComponent2 as clientComponent,
|
|
90
|
+
hydrate,
|
|
91
|
+
hydrationCanBeAborted,
|
|
92
|
+
installKeepAlive2 as installKeepAlive,
|
|
93
|
+
mount,
|
|
94
|
+
serverComponent,
|
|
95
|
+
update
|
|
96
|
+
};
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import {
|
|
2
|
+
RootBoundary,
|
|
3
|
+
islandElement
|
|
4
|
+
} from "../../chunks/browser-index-k3m2axbw.js";
|
|
5
|
+
|
|
6
|
+
// packages/adapter-preact/src/runtime/island.ts
|
|
7
|
+
import { h, hydrate, render } from "preact";
|
|
8
|
+
var sources = new WeakMap;
|
|
9
|
+
var element = (component, props, ctx) => h(RootBoundary, { app: ctx.app, children: islandElement(component, props, ctx) });
|
|
10
|
+
function hydrateIsland(el, component, props, ctx) {
|
|
11
|
+
sources.set(el, { component, ctx });
|
|
12
|
+
hydrate(element(component, props, ctx), el);
|
|
13
|
+
}
|
|
14
|
+
function mountIsland(el, component, props, ctx) {
|
|
15
|
+
el.replaceChildren();
|
|
16
|
+
sources.set(el, { component, ctx });
|
|
17
|
+
render(element(component, props, ctx), el);
|
|
18
|
+
}
|
|
19
|
+
function unmountIsland(el) {
|
|
20
|
+
sources.delete(el);
|
|
21
|
+
render(null, el);
|
|
22
|
+
}
|
|
23
|
+
function updateIsland(el, props) {
|
|
24
|
+
const source = sources.get(el);
|
|
25
|
+
if (source)
|
|
26
|
+
render(element(source.component, props, source.ctx), el);
|
|
27
|
+
}
|
|
28
|
+
export {
|
|
29
|
+
hydrateIsland,
|
|
30
|
+
mountIsland,
|
|
31
|
+
unmountIsland,
|
|
32
|
+
updateIsland
|
|
33
|
+
};
|
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
import {
|
|
2
|
+
installKeepAlive2,
|
|
3
|
+
buildElement,
|
|
4
|
+
islandElement
|
|
5
|
+
} from "../../chunks/browser-index-k3m2axbw.js";
|
|
6
|
+
import {
|
|
7
|
+
lazyModules,
|
|
8
|
+
collectingIslands,
|
|
9
|
+
islandsSettled,
|
|
10
|
+
renderSettled
|
|
11
|
+
} from "../../chunks/browser-index-89d71ade.js";
|
|
12
|
+
import {
|
|
13
|
+
exports_keepalive
|
|
14
|
+
} from "../../chunks/browser-index-ezte15pp.js";
|
|
15
|
+
|
|
16
|
+
// packages/adapter-preact/src/runtime/server.ts
|
|
17
|
+
import { h, options } from "preact";
|
|
18
|
+
import { useId } from "preact/hooks";
|
|
19
|
+
import { renderToString } from "preact-render-to-string";
|
|
20
|
+
import { renderToReadableStream } from "preact-render-to-string/stream";
|
|
21
|
+
import {
|
|
22
|
+
publicError,
|
|
23
|
+
renderInPasses,
|
|
24
|
+
serverComponentAttributes,
|
|
25
|
+
serverComponentProps,
|
|
26
|
+
setAdapterInstance
|
|
27
|
+
} from "hamur/adapter";
|
|
28
|
+
installKeepAlive2(exports_keepalive);
|
|
29
|
+
options.errorBoundaries = true;
|
|
30
|
+
async function render(ctx) {
|
|
31
|
+
await setAdapterInstance(ctx.app, null);
|
|
32
|
+
return renderInPasses({
|
|
33
|
+
app: ctx.app,
|
|
34
|
+
head: ctx.head,
|
|
35
|
+
render: async (head) => {
|
|
36
|
+
await lazyModules();
|
|
37
|
+
const element = buildElement({ ...ctx, head });
|
|
38
|
+
if (!ctx.stream) {
|
|
39
|
+
const pending = [];
|
|
40
|
+
const body = collectingIslands(pending, () => renderToString(element));
|
|
41
|
+
await islandsSettled(ctx.app, pending);
|
|
42
|
+
return { body };
|
|
43
|
+
}
|
|
44
|
+
const pending = [];
|
|
45
|
+
const stream = collectingIslands(pending, () => renderToReadableStream(element, ctx.nonce ? { nonce: ctx.nonce } : undefined));
|
|
46
|
+
stream.allReady.catch(() => {});
|
|
47
|
+
if (pending.length) {
|
|
48
|
+
await islandsSettled(ctx.app, pending);
|
|
49
|
+
return { body: stream };
|
|
50
|
+
}
|
|
51
|
+
return { body: await afterShell(stream, (error) => void publicError(ctx.app, error)) };
|
|
52
|
+
},
|
|
53
|
+
drop: ({ body }) => void (typeof body === "string" ? undefined : body.cancel())
|
|
54
|
+
});
|
|
55
|
+
}
|
|
56
|
+
async function renderComponent(component, props, ctx) {
|
|
57
|
+
await Promise.resolve();
|
|
58
|
+
await lazyModules();
|
|
59
|
+
return { html: await renderSettled(() => renderToString(islandElement(component, props, ctx))) };
|
|
60
|
+
}
|
|
61
|
+
async function afterShell(stream, late) {
|
|
62
|
+
const reader = stream.getReader();
|
|
63
|
+
const first = await reader.read();
|
|
64
|
+
if (first.done)
|
|
65
|
+
return new ReadableStream({ start: (controller) => controller.close() });
|
|
66
|
+
return new ReadableStream({
|
|
67
|
+
start: (controller) => controller.enqueue(first.value),
|
|
68
|
+
async pull(controller) {
|
|
69
|
+
const chunk = await reader.read().catch((error) => (late(error), { done: true, value: undefined }));
|
|
70
|
+
if (chunk.done)
|
|
71
|
+
controller.close();
|
|
72
|
+
else
|
|
73
|
+
controller.enqueue(chunk.value);
|
|
74
|
+
},
|
|
75
|
+
cancel: (reason) => reader.cancel(reason)
|
|
76
|
+
});
|
|
77
|
+
}
|
|
78
|
+
function clientComponent() {
|
|
79
|
+
return () => null;
|
|
80
|
+
}
|
|
81
|
+
function serverComponent(name, component) {
|
|
82
|
+
function ServerComponent(props) {
|
|
83
|
+
const uid = useId();
|
|
84
|
+
serverComponentProps(name, props, props.children !== undefined);
|
|
85
|
+
return h("hamur-component", { name, uid, ...serverComponentAttributes(name) }, h(component, props));
|
|
86
|
+
}
|
|
87
|
+
ServerComponent.displayName = `${name}.server`;
|
|
88
|
+
return ServerComponent;
|
|
89
|
+
}
|
|
90
|
+
export {
|
|
91
|
+
clientComponent,
|
|
92
|
+
render,
|
|
93
|
+
renderComponent,
|
|
94
|
+
serverComponent
|
|
95
|
+
};
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/** The shown state of one keep-alive wrapper and the `onPageActivated`/`onPageDeactivated` functions under it. */
|
|
2
|
+
export interface Activation {
|
|
3
|
+
hidden: boolean;
|
|
4
|
+
readonly parent: Activation | undefined;
|
|
5
|
+
readonly children: Set<Activation>;
|
|
6
|
+
readonly on: Set<() => void>;
|
|
7
|
+
readonly off: Set<() => void>;
|
|
8
|
+
}
|
|
9
|
+
export declare function activation(parent: Activation | undefined, hidden: boolean): Activation;
|
|
10
|
+
export declare function detach(own: Activation): void;
|
|
11
|
+
/** Whether a page under `own` is on screen: no wrapper above it is hidden. */
|
|
12
|
+
export declare function shown(own: Activation | undefined): boolean;
|
|
13
|
+
/** Runs `fn` once the commit is done; within one commit every deactivation runs before any activation, so a hide comes before the show it makes room for. */
|
|
14
|
+
export declare function later(isShown: boolean, fn: () => void): void;
|
|
15
|
+
export declare function setHidden(own: Activation, hidden: boolean): void;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { AppContext, AsyncDataOptions, FetchOptions } from "hamur/app";
|
|
2
|
+
import type { AsyncDataHandler, FetchRequest, GetCachedData, GetCachedDataCause, HandlerReference } from "hamur/adapter";
|
|
3
|
+
export declare const valueOf: <T>(value: T | (() => T)) => T;
|
|
4
|
+
export declare function requestOf({ query, body, ...rest }: FetchRequest): FetchOptions;
|
|
5
|
+
/** The restored payload entry's data while the app hydrates, else `undefined`. */
|
|
6
|
+
export declare function defaultGetCachedData<T>(key: string, app: AppContext): T | undefined;
|
|
7
|
+
/** `refresh()`, `execute()` and a `watch` change: ask `getCachedData` with their cause, run `handler` when it has nothing. */
|
|
8
|
+
export declare function refreshCached<T, R>(app: AppContext, key: string, handler: AsyncDataHandler<R>, options: AsyncDataOptions<T, R>, getCachedData: GetCachedData<T>, cause: GetCachedDataCause): Promise<void>;
|
|
9
|
+
export declare function keepCached<T>(app: AppContext, key: string, getCachedData: GetCachedData<T>): void;
|
|
10
|
+
/** The run's signal, combined with a `signal` the caller gave to `useFetch`. */
|
|
11
|
+
export declare const signalOf: (own: AbortSignal | undefined, run: AbortSignal) => AbortSignal;
|
|
12
|
+
/** The call of `useAsyncData(fn, input)`: in process with the request's event on the server, through the stub in the browser. */
|
|
13
|
+
export declare const callHandler: <R>(app: AppContext, fn: HandlerReference, input: unknown) => AsyncDataHandler<R>;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { ComponentChild, ComponentChildren, ComponentType } from "preact";
|
|
2
|
+
/** Set by `ClientOnly` around its children; a client-only component below shows its `fallback` while its chunk loads. */
|
|
3
|
+
export declare const ClientOnlyContext: import("preact").Context<{
|
|
4
|
+
fallback: ComponentChildren;
|
|
5
|
+
} | null>;
|
|
6
|
+
type Props = Record<string, unknown>;
|
|
7
|
+
/** The client side of a client-only component: nothing in the hydration render, the file's chunk once mounted. */
|
|
8
|
+
export declare function clientComponent(load: () => Promise<{
|
|
9
|
+
default: ComponentType<Props>;
|
|
10
|
+
}>): (props: Props) => ComponentChild;
|
|
11
|
+
export {};
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
import { Component } from "preact";
|
|
2
|
+
import type { ComponentChildren, Context, VNode } from "preact";
|
|
3
|
+
import type { AppContext, ErrorPageProps, ErrorStore, Head, State } from "hamur/app";
|
|
4
|
+
import type { ClientContext, FormStatusStore, NavigationState, RenderContext, ResolvedRoute, RouteValue, RouterApi } from "hamur/adapter";
|
|
5
|
+
import { type RouterSource } from "hamur/adapter";
|
|
6
|
+
import { type Activation } from "./activation.ts";
|
|
7
|
+
import type { RouteLocation } from "hamur/app";
|
|
8
|
+
export declare const RouteContext: Context<RouteValue | null>;
|
|
9
|
+
export declare const RouterContext: Context<RouterApi | null>;
|
|
10
|
+
/** `true` below a `"never"` lazy component, so its async data stays out of the payload. */
|
|
11
|
+
export declare const NeverHydratedContext: Context<boolean>;
|
|
12
|
+
export interface SearchStore {
|
|
13
|
+
get(): RouteValue["search"];
|
|
14
|
+
subscribe(listener: () => void): () => void;
|
|
15
|
+
router(): RouterApi;
|
|
16
|
+
}
|
|
17
|
+
/** One store per app, so `useSearch(select)` reads the search without the route context that re-renders every reader. */
|
|
18
|
+
export declare const SearchContext: Context<SearchStore | null>;
|
|
19
|
+
export declare const BaseURLContext: Context<string>;
|
|
20
|
+
export declare const HrefContext: Context<(to: string | RouteLocation) => string>;
|
|
21
|
+
export declare const DataContext: Context<Record<string, unknown>>;
|
|
22
|
+
export declare const EntryContext: Context<string | null>;
|
|
23
|
+
export interface ErrorSource {
|
|
24
|
+
store?: ErrorStore;
|
|
25
|
+
initial?: ErrorPageProps;
|
|
26
|
+
}
|
|
27
|
+
export declare const ErrorContext: Context<ErrorSource>;
|
|
28
|
+
export declare const HeadContext: Context<Head | null>;
|
|
29
|
+
export declare const StateContext: Context<State | null>;
|
|
30
|
+
export declare const OutletContext: Context<ComponentChildren>;
|
|
31
|
+
export declare const SlotsContext: Context<Record<string, ComponentChildren> | null>;
|
|
32
|
+
export declare const OutletValueContext: Context<unknown>;
|
|
33
|
+
export declare const LayoutContext: Context<{
|
|
34
|
+
name: string | false;
|
|
35
|
+
props: Record<string, unknown>;
|
|
36
|
+
} | null>;
|
|
37
|
+
export declare const ActivationContext: Context<Activation | undefined>;
|
|
38
|
+
export interface NavigationSource {
|
|
39
|
+
get(): NavigationState;
|
|
40
|
+
subscribe(listener: () => void): () => void;
|
|
41
|
+
}
|
|
42
|
+
export interface Submitted {
|
|
43
|
+
/** The `{ id, instance?, value | failure | error }` of a no-JS post to a page. */
|
|
44
|
+
handlerState?: unknown;
|
|
45
|
+
}
|
|
46
|
+
export declare const SubmittedContext: Context<Submitted>;
|
|
47
|
+
export declare const FormStatusContext: Context<FormStatusStore | null>;
|
|
48
|
+
export declare const AppContextContext: Context<AppContext | null>;
|
|
49
|
+
export declare const NavigationContext: Context<NavigationSource | null>;
|
|
50
|
+
/** The `href` of the `Link` whose children render, read by `useLinkStatus()`. */
|
|
51
|
+
export declare const LinkHrefContext: Context<string | null>;
|
|
52
|
+
export declare function routerOf(navigator: unknown, baseURL?: string, page?: Omit<RouterSource, "navigator" | "baseURL">): RouterApi;
|
|
53
|
+
export declare function routeValue(ctx: Pick<RenderContext, "route"> & Partial<Pick<RenderContext, "app" | "payload" | "tree">>): RouteValue;
|
|
54
|
+
/** The core's keep-alive feature loads the outlet (`Adapter.keepAliveOutlet`) and hands it to `installKeepAlive` before the first tree that holds kept units; it takes what it needs from the object it is built with, so its chunk imports nothing from the base. */
|
|
55
|
+
export declare function installKeepAlive(module: typeof import("./keepalive.ts")): void;
|
|
56
|
+
export type Source = Pick<RenderContext | ClientContext, "route" | "tree"> & Pick<RenderContext, "app" | "head"> & Partial<Pick<RenderContext, "payload" | "baseURL">> & Pick<RenderContext, "href"> & {
|
|
57
|
+
navigator?: unknown;
|
|
58
|
+
};
|
|
59
|
+
export declare function buildElement(ctx: Source): VNode<any>;
|
|
60
|
+
interface RootBoundaryProps {
|
|
61
|
+
app: AppContext;
|
|
62
|
+
children: ComponentChildren;
|
|
63
|
+
}
|
|
64
|
+
/** The root boundary: renders nothing for the tree that threw and reports it once the diff is done. */
|
|
65
|
+
export declare class RootBoundary extends Component<RootBoundaryProps, {
|
|
66
|
+
failed?: ComponentChildren;
|
|
67
|
+
}> {
|
|
68
|
+
componentDidCatch(error: unknown): void;
|
|
69
|
+
render(): ComponentChildren;
|
|
70
|
+
}
|
|
71
|
+
/** An island as a root of its own: the app's route, state and head contexts around one entry, its `useId` values under the island's `uid`; a `Link` takes a path, as no route table ships. */
|
|
72
|
+
export declare function islandElement(component: unknown, props: Record<string, unknown>, ctx: {
|
|
73
|
+
app: AppContext;
|
|
74
|
+
route: ResolvedRoute;
|
|
75
|
+
baseURL: string;
|
|
76
|
+
idPrefix: string;
|
|
77
|
+
slots?: {
|
|
78
|
+
default?: string;
|
|
79
|
+
};
|
|
80
|
+
}): VNode;
|
|
81
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { DefaultErrorPage as default } from "./index.ts";
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import type { Head, HeadEntry, HeadInput } from "hamur/app";
|
|
2
|
+
/** Render order, parent first: a component takes one the first time it renders. */
|
|
3
|
+
export declare const nextRank: () => number;
|
|
4
|
+
/** Layout effects run child first; an entry pushed after entries of a higher rank goes in front of them, so a page still wins over its layout. */
|
|
5
|
+
export declare function mountHead(head: Head, rank: number, input: HeadInput): HeadEntry;
|