Skip to content

Latest commit

 

History

History
502 lines (421 loc) · 18 KB

api.md

File metadata and controls

502 lines (421 loc) · 18 KB

API Report File for "@builder.io/qwik-city"

Do not edit this file. It is a report generated by API Extractor.

import { Component } from '@builder.io/qwik';
import { Cookie } from '@builder.io/qwik-city/middleware/request-handler';
import { CookieOptions } from '@builder.io/qwik-city/middleware/request-handler';
import { CookieValue } from '@builder.io/qwik-city/middleware/request-handler';
import { DeferReturn } from '@builder.io/qwik-city/middleware/request-handler';
import type { EnvGetter } from '@builder.io/qwik-city/middleware/request-handler';
import { JSXNode } from '@builder.io/qwik';
import { JSXOutput } from '@builder.io/qwik';
import { QRL } from '@builder.io/qwik';
import { QwikIntrinsicElements } from '@builder.io/qwik';
import { QwikJSX } from '@builder.io/qwik';
import type { ReadonlySignal } from '@builder.io/qwik';
import { RequestEvent } from '@builder.io/qwik-city/middleware/request-handler';
import { RequestEventAction } from '@builder.io/qwik-city/middleware/request-handler';
import { RequestEventBase } from '@builder.io/qwik-city/middleware/request-handler';
import { RequestEventCommon } from '@builder.io/qwik-city/middleware/request-handler';
import { RequestEventLoader } from '@builder.io/qwik-city/middleware/request-handler';
import { RequestHandler } from '@builder.io/qwik-city/middleware/request-handler';
import type { ResolveSyncValue } from '@builder.io/qwik-city/middleware/request-handler';
import { ValueOrPromise } from '@builder.io/qwik';
import { z } from 'zod';
import type * as zod from 'zod';

// @public (undocumented)
export type Action<RETURN, INPUT = Record<string, unknown>, OPTIONAL extends boolean = true> = {
    (): ActionStore<RETURN, INPUT, OPTIONAL>;
};

// @public (undocumented)
export type ActionConstructor = {
    <OBJ extends Record<string, any> | void | null, VALIDATOR extends TypedDataValidator, REST extends [DataValidator, ...DataValidator[]]>(actionQrl: (data: GetValidatorType<VALIDATOR>, event: RequestEventAction) => ValueOrPromise<OBJ>, options: {
        readonly id?: string;
        readonly validation: [VALIDATOR, ...REST];
    }): Action<StrictUnion<OBJ | FailReturn<zod.typeToFlattenedError<GetValidatorType<VALIDATOR>>> | FailReturn<FailOfRest<REST>>>, GetValidatorType<VALIDATOR>, false>;
    <OBJ extends Record<string, any> | void | null, VALIDATOR extends TypedDataValidator>(actionQrl: (data: GetValidatorType<VALIDATOR>, event: RequestEventAction) => ValueOrPromise<OBJ>, options: {
        readonly id?: string;
        readonly validation: [VALIDATOR];
    }): Action<StrictUnion<OBJ | FailReturn<zod.typeToFlattenedError<GetValidatorType<VALIDATOR>>>>, GetValidatorType<VALIDATOR>, false>;
    <OBJ extends Record<string, any> | void | null, REST extends [DataValidator, ...DataValidator[]]>(actionQrl: (data: JSONObject, event: RequestEventAction) => ValueOrPromise<OBJ>, options: {
        readonly id?: string;
        readonly validation: REST;
    }): Action<StrictUnion<OBJ | FailReturn<FailOfRest<REST>>>>;
    <OBJ extends Record<string, any> | void | null, VALIDATOR extends TypedDataValidator, REST extends [DataValidator, ...DataValidator[]]>(actionQrl: (data: GetValidatorType<VALIDATOR>, event: RequestEventAction) => ValueOrPromise<OBJ>, options: VALIDATOR, ...rest: REST): Action<StrictUnion<OBJ | FailReturn<zod.typeToFlattenedError<GetValidatorType<VALIDATOR>>> | FailReturn<FailOfRest<REST>>>, GetValidatorType<VALIDATOR>, false>;
    <OBJ extends Record<string, any> | void | null, VALIDATOR extends TypedDataValidator>(actionQrl: (data: GetValidatorType<VALIDATOR>, event: RequestEventAction) => ValueOrPromise<OBJ>, options: VALIDATOR): Action<StrictUnion<OBJ | FailReturn<zod.typeToFlattenedError<GetValidatorType<VALIDATOR>>>>, GetValidatorType<VALIDATOR>, false>;
    <OBJ extends Record<string, any> | void | null, REST extends [DataValidator, ...DataValidator[]]>(actionQrl: (form: JSONObject, event: RequestEventAction) => ValueOrPromise<OBJ>, ...rest: REST): Action<StrictUnion<OBJ | FailReturn<FailOfRest<REST>>>>;
    <OBJ>(actionQrl: (form: JSONObject, event: RequestEventAction) => ValueOrPromise<OBJ>, options?: {
        readonly id?: string;
    }): Action<StrictUnion<OBJ>>;
};

// @public (undocumented)
export type ActionReturn<RETURN> = {
    readonly status?: number;
    readonly value: RETURN;
};

// @public (undocumented)
export type ActionStore<RETURN, INPUT, OPTIONAL extends boolean = true> = {
    readonly actionPath: string;
    readonly isRunning: boolean;
    readonly status?: number;
    readonly formData: FormData | undefined;
    readonly value: RETURN | undefined;
    readonly submit: QRL<OPTIONAL extends true ? (form?: INPUT | FormData | SubmitEvent) => Promise<ActionReturn<RETURN>> : (form: INPUT | FormData | SubmitEvent) => Promise<ActionReturn<RETURN>>>;
};

// @public (undocumented)
export interface ContentHeading {
    // (undocumented)
    readonly id: string;
    // (undocumented)
    readonly level: number;
    // (undocumented)
    readonly text: string;
}

// @public (undocumented)
export interface ContentMenu {
    // (undocumented)
    readonly href?: string;
    // (undocumented)
    readonly items?: ContentMenu[];
    // (undocumented)
    readonly text: string;
}

export { Cookie }

export { CookieOptions }

export { CookieValue }

// @public (undocumented)
export type DataValidator<T extends Record<string, any> = {}> = {
    validate(ev: RequestEvent, data: unknown): Promise<ValidatorReturn<T>>;
};

export { DeferReturn }

// @public (undocumented)
export type DocumentHead = DocumentHeadValue | ((props: DocumentHeadProps) => DocumentHeadValue);

// @public (undocumented)
export interface DocumentHeadProps extends RouteLocation {
    // (undocumented)
    readonly head: ResolvedDocumentHead;
    // (undocumented)
    readonly resolveValue: ResolveSyncValue;
    // (undocumented)
    readonly withLocale: <T>(fn: () => T) => T;
}

// @public (undocumented)
export interface DocumentHeadValue<FrontMatter extends Record<string, any> = Record<string, unknown>> {
    readonly frontmatter?: Readonly<FrontMatter>;
    readonly links?: readonly DocumentLink[];
    readonly meta?: readonly DocumentMeta[];
    // Warning: (ae-incompatible-release-tags) The symbol "scripts" is marked as @public, but its signature references "DocumentScript" which is marked as @alpha
    readonly scripts?: readonly DocumentScript[];
    readonly styles?: readonly DocumentStyle[];
    readonly title?: string;
}

// @public (undocumented)
export interface DocumentLink {
    // (undocumented)
    as?: string;
    // (undocumented)
    crossorigin?: string;
    // (undocumented)
    disabled?: boolean;
    // (undocumented)
    href?: string;
    // (undocumented)
    hreflang?: string;
    // (undocumented)
    id?: string;
    // (undocumented)
    imagesizes?: string;
    // (undocumented)
    imagesrcset?: string;
    // (undocumented)
    integrity?: string;
    // (undocumented)
    key?: string;
    // (undocumented)
    media?: string;
    // (undocumented)
    prefetch?: string;
    // (undocumented)
    referrerpolicy?: string;
    // (undocumented)
    rel?: string;
    // (undocumented)
    sizes?: string;
    // (undocumented)
    title?: string;
    // (undocumented)
    type?: string;
}

// @public (undocumented)
export interface DocumentMeta {
    // (undocumented)
    readonly content?: string;
    // (undocumented)
    readonly httpEquiv?: string;
    // (undocumented)
    readonly itemprop?: string;
    // (undocumented)
    readonly key?: string;
    // (undocumented)
    readonly media?: string;
    // (undocumented)
    readonly name?: string;
    // (undocumented)
    readonly property?: string;
}

// @alpha (undocumented)
export interface DocumentScript {
    // (undocumented)
    readonly key?: string;
    // (undocumented)
    readonly props?: Readonly<QwikIntrinsicElements['script']>;
    // (undocumented)
    readonly script?: string;
}

// @public (undocumented)
export interface DocumentStyle {
    // (undocumented)
    readonly key?: string;
    // (undocumented)
    readonly props?: Readonly<QwikIntrinsicElements['style']>;
    // (undocumented)
    readonly style: string;
}

// @public (undocumented)
export type FailOfRest<REST extends readonly DataValidator[]> = REST extends readonly DataValidator<infer ERROR>[] ? ERROR : never;

// Warning: (ae-forgotten-export) The symbol "Failed" needs to be exported by the entry point index.d.ts
//
// @public (undocumented)
export type FailReturn<T> = T & Failed;

// @public (undocumented)
export const Form: <O, I>({ action, spaReset, reloadDocument, onSubmit$, ...rest }: FormProps<O, I>, key: string | null) => JSXOutput;

// @public (undocumented)
export interface FormProps<O, I> extends Omit<QwikJSX.IntrinsicElements['form'], 'action' | 'method'> {
    action?: ActionStore<O, I, true | false>;
    // (undocumented)
    key?: string | number | null;
    onSubmit$?: (event: Event, form: HTMLFormElement) => ValueOrPromise<void>;
    onSubmitCompleted$?: (event: CustomEvent<FormSubmitSuccessDetail<O>>, form: HTMLFormElement) => ValueOrPromise<void>;
    reloadDocument?: boolean;
    spaReset?: boolean;
}

// @public (undocumented)
export interface FormSubmitSuccessDetail<T> {
    // (undocumented)
    status: number;
    // (undocumented)
    value: T;
}

// @public (undocumented)
export type GetValidatorType<VALIDATOR extends TypedDataValidator> = VALIDATOR extends TypedDataValidator<infer TYPE> ? zod.infer<TYPE> : never;

// @public (undocumented)
export const globalAction$: ActionConstructor;

// Warning: (ae-forgotten-export) The symbol "ActionConstructorQRL" needs to be exported by the entry point index.d.ts
//
// @public (undocumented)
export const globalActionQrl: ActionConstructorQRL;

// @public (undocumented)
export type JSONObject = {
    [x: string]: JSONValue;
};

// @public (undocumented)
export type JSONValue = string | number | boolean | {
    [x: string]: JSONValue;
} | Array<JSONValue>;

// @public (undocumented)
export const Link: Component<LinkProps>;

// Warning: (ae-forgotten-export) The symbol "AnchorAttributes" needs to be exported by the entry point index.d.ts
//
// @public (undocumented)
export interface LinkProps extends AnchorAttributes {
    prefetch?: boolean | 'js';
    // (undocumented)
    reload?: boolean;
    // (undocumented)
    replaceState?: boolean;
    // (undocumented)
    scroll?: boolean;
}

// @public (undocumented)
type Loader_2<RETURN> = {
    (): LoaderSignal<RETURN>;
};
export { Loader_2 as Loader }

// @public (undocumented)
export type LoaderSignal<TYPE> = TYPE extends () => ValueOrPromise<infer VALIDATOR> ? ReadonlySignal<ValueOrPromise<VALIDATOR>> : ReadonlySignal<TYPE>;

// Warning: (ae-forgotten-export) The symbol "MenuModuleLoader" needs to be exported by the entry point index.d.ts
//
// @public (undocumented)
export type MenuData = [pathname: string, menuLoader: MenuModuleLoader];

// @public (undocumented)
export type NavigationType = 'initial' | 'form' | 'link' | 'popstate';

// Warning: (ae-forgotten-export) The symbol "RouteModule" needs to be exported by the entry point index.d.ts
//
// @public (undocumented)
export interface PageModule extends RouteModule {
    // (undocumented)
    readonly default: unknown;
    // Warning: (ae-forgotten-export) The symbol "ContentModuleHead" needs to be exported by the entry point index.d.ts
    //
    // (undocumented)
    readonly head?: ContentModuleHead;
    // (undocumented)
    readonly headings?: ContentHeading[];
    // (undocumented)
    readonly onStaticGenerate?: StaticGenerateHandler;
}

// @public (undocumented)
export type PathParams = Record<string, string>;

// @public (undocumented)
export interface QwikCityMockProps {
    // (undocumented)
    goto?: RouteNavigate;
    // (undocumented)
    params?: Record<string, string>;
    // (undocumented)
    url?: string;
}

// @public (undocumented)
export const QwikCityMockProvider: Component<QwikCityMockProps>;

// @public (undocumented)
export interface QwikCityPlan {
    // (undocumented)
    readonly basePathname?: string;
    // (undocumented)
    readonly cacheModules?: boolean;
    // (undocumented)
    readonly menus?: MenuData[];
    // (undocumented)
    readonly routes: RouteData[];
    // (undocumented)
    readonly serverPlugins?: RouteModule[];
    // (undocumented)
    readonly trailingSlash?: boolean;
}

// @public (undocumented)
export interface QwikCityProps {
    viewTransition?: boolean;
}

// @public (undocumented)
export const QwikCityProvider: Component<QwikCityProps>;

export { RequestEvent }

export { RequestEventAction }

export { RequestEventBase }

export { RequestEventCommon }

export { RequestEventLoader }

export { RequestHandler }

// @public (undocumented)
export type ResolvedDocumentHead<FrontMatter extends Record<string, any> = Record<string, unknown>> = Required<DocumentHeadValue<FrontMatter>>;

// @public (undocumented)
export const routeAction$: ActionConstructor;

// @public (undocumented)
export const routeActionQrl: ActionConstructorQRL;

// Warning: (ae-forgotten-export) The symbol "ModuleLoader" needs to be exported by the entry point index.d.ts
//
// @public (undocumented)
export type RouteData = [routeName: string, loaders: ModuleLoader[]] | [
routeName: string,
loaders: ModuleLoader[],
originalPathname: string,
routeBundleNames: string[]
];

// Warning: (ae-forgotten-export) The symbol "LoaderConstructor" needs to be exported by the entry point index.d.ts
//
// @public (undocumented)
export const routeLoader$: LoaderConstructor;

// Warning: (ae-forgotten-export) The symbol "LoaderConstructorQRL" needs to be exported by the entry point index.d.ts
//
// @public (undocumented)
export const routeLoaderQrl: LoaderConstructorQRL;

// @public (undocumented)
export interface RouteLocation {
    // (undocumented)
    readonly isNavigating: boolean;
    // (undocumented)
    readonly params: Readonly<Record<string, string>>;
    // (undocumented)
    readonly prevUrl: URL | undefined;
    // (undocumented)
    readonly url: URL;
}

// @public (undocumented)
export type RouteNavigate = QRL<(path?: string, options?: {
    type?: Exclude<NavigationType, 'initial'>;
    forceReload?: boolean;
    replaceState?: boolean;
    scroll?: boolean;
} | boolean) => Promise<void>>;

// @public (undocumented)
export const RouterOutlet: Component<unknown>;

// @public (undocumented)
export const server$: <T extends ServerFunction>(first: T) => ServerQRL<T>;

// @public (undocumented)
export type ServerFunction = {
    (this: RequestEventBase, ...args: any[]): any;
};

// @public
export type ServerQRL<T extends ServerFunction> = QRL<((abort: AbortSignal, ...args: Parameters<T>) => ReturnType<T>) | ((...args: Parameters<T>) => ReturnType<T>)>;

// @public (undocumented)
export const serverQrl: <T extends ServerFunction>(qrl: QRL<T>) => ServerQRL<T>;

// @public (undocumented)
export const ServiceWorkerRegister: (props: {
    nonce?: string;
}) => JSXNode<"script">;

// @public (undocumented)
export interface StaticGenerate {
    // (undocumented)
    params?: PathParams[];
}

// @public (undocumented)
export type StaticGenerateHandler = ({ env, }: {
    env: EnvGetter;
}) => Promise<StaticGenerate> | StaticGenerate;

// Warning: (ae-forgotten-export) The symbol "Prettify" needs to be exported by the entry point index.d.ts
// Warning: (ae-forgotten-export) The symbol "StrictUnionHelper" needs to be exported by the entry point index.d.ts
//
// @public (undocumented)
export type StrictUnion<T> = Prettify<StrictUnionHelper<T, T>>;

// @public (undocumented)
export type TypedDataValidator<T extends zod.ZodType = zod.ZodType> = {
    __zod: zod.ZodSchema<T>;
    validate(ev: RequestEvent, data: unknown): Promise<zod.SafeParseReturnType<T, T>>;
};

// Warning: (ae-forgotten-export) The symbol "ContentState" needs to be exported by the entry point index.d.ts
//
// @public (undocumented)
export const useContent: () => ContentState;

// @public
export const useDocumentHead: <FrontMatter extends Record<string, unknown> = Record<string, any>>() => Required<ResolvedDocumentHead<FrontMatter>>;

// @public (undocumented)
export const useLocation: () => RouteLocation;

// @public (undocumented)
export const useNavigate: () => RouteNavigate;

// Warning: (ae-forgotten-export) The symbol "ValidatorConstructor" needs to be exported by the entry point index.d.ts
//
// @public (undocumented)
export const validator$: ValidatorConstructor;

// Warning: (ae-forgotten-export) The symbol "ValidatorConstructorQRL" needs to be exported by the entry point index.d.ts
//
// @public (undocumented)
export const validatorQrl: ValidatorConstructorQRL;

// Warning: (ae-forgotten-export) The symbol "ValidatorReturnSuccess" needs to be exported by the entry point index.d.ts
// Warning: (ae-forgotten-export) The symbol "ValidatorReturnFail" needs to be exported by the entry point index.d.ts
//
// @public (undocumented)
export type ValidatorReturn<T extends Record<string, any> = {}> = ValidatorReturnSuccess | ValidatorReturnFail<T>;

export { z }

// @public (undocumented)
export const zod$: ZodConstructor;

// @public (undocumented)
export type ZodConstructor = {
    <T extends zod.ZodRawShape>(schema: T): TypedDataValidator<zod.ZodObject<T>>;
    <T extends zod.ZodRawShape>(schema: (z: typeof zod, ev: RequestEvent) => T): TypedDataValidator<zod.ZodObject<T>>;
    <T extends zod.Schema>(schema: T): TypedDataValidator<T>;
    <T extends zod.Schema>(schema: (z: typeof zod, ev: RequestEvent) => T): TypedDataValidator<T>;
};

// Warning: (ae-forgotten-export) The symbol "ZodConstructorQRL" needs to be exported by the entry point index.d.ts
//
// @public (undocumented)
export const zodQrl: ZodConstructorQRL;

// (No @packageDocumentation comment for this package)