//#region src/index.d.ts
declare const clientReferenceType: unique symbol;
declare const nodeMarker: unique symbol;
declare const Fragment: unique symbol;
/** A callable-typed symbol so `` type-checks as a JSX component. */
declare const Marker: (props: MarkerProps) => JSXElement;
declare const clientReferenceMarker: unique symbol;
declare global {
interface GlobalEventHandlersEventMap {}
}
type AttributeValue = string | number | boolean | null | undefined;
type Component
= any> = (props: P) => JSXChild;
type ClientReferenceValue = {
bind(_this: unknown, ...bound: readonly unknown[]): ClientReferenceValue;
readonly [clientReferenceMarker]: {
bivarianceHack(value: Argument): void;
}["bivarianceHack"];
};
type EventAttributeValue = ClientReferenceValue | {
bivarianceHack(this: EventTarget, event: EventType): void;
}["bivarianceHack"] | {
handleEvent(event: EventType): void;
};
type RefAttributeValue = ClientReferenceValue | {
bivarianceHack(ref: ElementType): void;
}["bivarianceHack"];
type KnownEventName = Extract;
type KnownEventAttributes = { [EventName in KnownEventName as `on${EventName}`]?: AttributeValue | EventAttributeValue | JSXChild; };
type KnownIntrinsicElementName = keyof HTMLElementTagNameMap | keyof SVGElementTagNameMap;
type IntrinsicElementFor = Name extends keyof HTMLElementTagNameMap ? Name extends keyof SVGElementTagNameMap ? HTMLElementTagNameMap[Name] | SVGElementTagNameMap[Name] : HTMLElementTagNameMap[Name] : Name extends keyof SVGElementTagNameMap ? SVGElementTagNameMap[Name] : Element;
type KnownIntrinsicElements = { [Name in KnownIntrinsicElementName]: JSXProps>; };
type JSXChild = JSXElement | string | number | boolean | null | undefined | PromiseLike | readonly JSXChild[];
interface JSXProps extends KnownEventAttributes {
children?: JSXChild;
innerHTML?: string;
ref?: RefAttributeValue;
[property: `on${string}`]: AttributeValue | EventAttributeValue | JSXChild;
[property: string]: AttributeValue | EventAttributeValue | RefAttributeValue | JSXChild;
}
interface MarkerProps {
children?: JSXChild;
name: string;
}
interface SuspenseProps {
children?: JSXChild;
fallback?: JSXChild;
}
interface ErrorBoundaryProps {
children?: JSXChild;
fallback?: JSXChild;
}
interface ClientEvent {
readonly event: string;
readonly reference: unknown;
}
interface RenderOptions {
bootstrapModules?: readonly string[];
bootstrapScripts?: readonly string[];
encodeLoadReference?: (reference: ClientReference) => string;
idPrefix?: string;
nonce?: string;
onError?: (error: unknown) => void;
prerender?: boolean;
signal?: AbortSignal;
}
type RenderReadableStream = ReadableStream;
type ClientReferenceDefinition = {
readonly bound?: readonly unknown[];
readonly deps: readonly string[];
readonly id: string;
readonly mod: string;
readonly name: string;
};
interface ClientReference {
bind(_this: unknown, ...bound: readonly unknown[]): ClientReference;
readonly bound?: readonly unknown[];
readonly deps: readonly string[];
readonly id: string;
readonly mod: string;
readonly name: string;
readonly type: typeof clientReferenceType;
}
interface ComponentNode {
readonly [nodeMarker]: true;
readonly kind: "component";
readonly props: JSXProps;
readonly type: Component;
}
interface ElementNode {
readonly [nodeMarker]: true;
readonly kind: "element";
readonly props: JSXProps;
readonly tagName: string;
}
interface ErrorBoundaryNode {
readonly [nodeMarker]: true;
readonly children: JSXChild;
readonly fallback: JSXChild;
readonly kind: "error-boundary";
}
interface SuspenseNode {
readonly [nodeMarker]: true;
readonly children: JSXChild;
readonly fallback: JSXChild;
readonly kind: "suspense";
}
interface MarkerNode {
readonly [nodeMarker]: true;
readonly children: JSXChild;
readonly name: string;
readonly kind: "marker";
}
type JSXElement = ComponentNode | ElementNode | ErrorBoundaryNode | SuspenseNode | MarkerNode;
declare function defineClientReference(reference: ClientReferenceDefinition): ClientReferenceValue;
declare function jsx(type: string | typeof Fragment | typeof Marker | Component, props: JSXProps | null): JSXChild;
declare const jsxs: typeof jsx;
declare function Suspense(props: SuspenseProps): JSXElement;
declare function ErrorBoundary(props: ErrorBoundaryProps): JSXElement;
declare function renderToReadableStream(value: JSXChild, options?: RenderOptions): Promise;
declare namespace JSX {
type Element = JSXElement;
type ElementType = string | typeof Fragment | Component;
interface ElementChildrenAttribute {
children: {};
}
interface IntrinsicAttributes {
key?: string;
}
interface IntrinsicElements extends KnownIntrinsicElements {
[elementName: string]: JSXProps;
}
}
//#endregion
export { AttributeValue, ClientEvent, ClientReferenceValue, Component, ErrorBoundary, ErrorBoundaryProps, Fragment, JSX, JSXChild, JSXElement, JSXProps, Marker, MarkerProps, RenderOptions, RenderReadableStream, Suspense, SuspenseProps, defineClientReference, jsx, jsxs, renderToReadableStream };
//# sourceMappingURL=index.d.mts.map