UNPKG

@studiocms/ui

Version:

The UI library for StudioCMS. Includes the layouts & components we use to build StudioCMS.

44 lines (43 loc) 2.13 kB
import type { AstroGlobalPartial } from 'astro'; import { z } from 'astro/zod'; export declare const HeadConfigSchema: () => z.ZodDefault<z.ZodArray<z.ZodObject<{ /** Name of the HTML tag to add to `<head>`, e.g. `'meta'`, `'link'`, or `'script'`. */ tag: z.ZodEnum<["title", "base", "link", "style", "meta", "script", "noscript", "template"]>; /** Attributes to set on the tag, e.g. `{ rel: 'stylesheet', href: '/custom.css' }`. */ attrs: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodUnion<[z.ZodString, z.ZodBoolean, z.ZodUndefined]>>>; /** Content to place inside the tag (optional). */ content: z.ZodDefault<z.ZodString>; }, "strip", z.ZodTypeAny, { content: string; tag: "base" | "link" | "meta" | "noscript" | "script" | "style" | "template" | "title"; attrs: Record<string, string | boolean | undefined>; }, { tag: "base" | "link" | "meta" | "noscript" | "script" | "style" | "template" | "title"; content?: string | undefined; attrs?: Record<string, string | boolean | undefined> | undefined; }>, "many">>; /** * Default Head Tags for use with createHead() helper * * @param title * @param description * @param lang * @param Astro * @param favicon * @param ogImage * @param canonical * @returns */ export declare const headDefaults: (title: string, description: string, Astro: AstroGlobalPartial, ogImage: string | undefined, canonical: URL | undefined) => { tag: "base" | "link" | "meta" | "noscript" | "script" | "style" | "template" | "title"; content?: string | undefined; attrs?: Record<string, string | boolean | undefined> | undefined; }[]; export type HeadUserConfig = z.input<ReturnType<typeof HeadConfigSchema>>; export type HeadConfig = z.output<ReturnType<typeof HeadConfigSchema>>; /** Create a fully parsed, merged, and sorted head entry array from multiple sources. */ export declare function createHead(defaultHeaders: HeadUserConfig, ...heads: HeadConfig[]): { content: string; tag: "base" | "link" | "meta" | "noscript" | "script" | "style" | "template" | "title"; attrs: Record<string, string | boolean | undefined>; }[];