From 5f7c3118b6da956b85bea9ec72d5d0d14ecd4f61 Mon Sep 17 00:00:00 2001 From: harlan Date: Tue, 21 Jan 2025 16:44:01 +1100 Subject: [PATCH] chore(types): export `ResolvedHead` --- packages/schema/src/schema.ts | 37 ++++++++++++++++++++++++++++------- 1 file changed, 30 insertions(+), 7 deletions(-) diff --git a/packages/schema/src/schema.ts b/packages/schema/src/schema.ts index 23b46749..714a34a0 100644 --- a/packages/schema/src/schema.ts +++ b/packages/schema/src/schema.ts @@ -63,13 +63,24 @@ type TitleTemplateResolver = string | ((title?: string) => string | null) export type Title = MaybeFunction | ResolvableValues<({ textContent: string } & SchemaAugmentations['title'])> export type TitleTemplate = TitleTemplateResolver | null | ({ textContent: TitleTemplateResolver } & SchemaAugmentations['titleTemplate']) export type Base> = Partial>> & DefinedValueOrEmptyObject -export type Link> = ResolvableValues & MaybeEventFnHandlers & DataKeys & SchemaAugmentations['link'] & DefinedValueOrEmptyObject -export type Meta> = ResolvableValues & DataKeys & SchemaAugmentations['meta'] & DefinedValueOrEmptyObject -export type Style> = ResolvableValues<_Style> & DataKeys & SchemaAugmentations['style'] & DefinedValueOrEmptyObject -export type Script> = ResolvableValues & MaybeEventFnHandlers & DataKeys & SchemaAugmentations['script'] & DefinedValueOrEmptyObject -export type Noscript> = ResolvableValues<_Noscript> & DataKeys & SchemaAugmentations['noscript'] & DefinedValueOrEmptyObject -export type HtmlAttributes> = ResolvableValues & DataKeys & SchemaAugmentations['htmlAttrs'] & DefinedValueOrEmptyObject -export type BodyAttributes> = ResolvableValues & MaybeEventFnHandlers & DataKeys & SchemaAugmentations['bodyAttrs'] & DefinedValueOrEmptyObject +export type Link> = ResolvableValues & MaybeEventFnHandlers & SchemaAugmentations['link'] & DefinedValueOrEmptyObject +export type Meta> = ResolvableValues & SchemaAugmentations['meta'] & DefinedValueOrEmptyObject +export type Style> = ResolvableValues<_Style & DataKeys> & SchemaAugmentations['style'] & DefinedValueOrEmptyObject +export type Script> = ResolvableValues & MaybeEventFnHandlers & SchemaAugmentations['script'] & DefinedValueOrEmptyObject +export type Noscript> = ResolvableValues<_Noscript & DataKeys> & SchemaAugmentations['noscript'] & DefinedValueOrEmptyObject +export type HtmlAttributes> = ResolvableValues & SchemaAugmentations['htmlAttrs'] & DefinedValueOrEmptyObject +export type BodyAttributes> = ResolvableValues & MaybeEventFnHandlers & SchemaAugmentations['bodyAttrs'] & DefinedValueOrEmptyObject + +export type ResolvedTitle = ({ textContent: string } & SchemaAugmentations['title']) +export type ResolvedTitleTemplate = TitleTemplateResolver | null | ({ textContent: TitleTemplateResolver } & SchemaAugmentations['titleTemplate']) +export type ResolvedBase> = Partial> & DefinedValueOrEmptyObject +export type ResolvedLink> = LinkBase & MaybeEventFnHandlers & DataKeys & SchemaAugmentations['link'] & DefinedValueOrEmptyObject +export type ResolvedMeta> = BaseMeta & DataKeys & SchemaAugmentations['meta'] & DefinedValueOrEmptyObject +export type ResolvedStyle> = _Style & DataKeys & SchemaAugmentations['style'] & DefinedValueOrEmptyObject +export type ResolvedScript> = ScriptBase & MaybeEventFnHandlers & DataKeys & SchemaAugmentations['script'] & DefinedValueOrEmptyObject +export type ResolvedNoscript> = _Noscript & DataKeys & SchemaAugmentations['noscript'] & DefinedValueOrEmptyObject +export type ResolvedHtmlAttributes> = HtmlAttr & DataKeys & SchemaAugmentations['htmlAttrs'] & DefinedValueOrEmptyObject +export type ResolvedBodyAttributes> = BodyAttr & MaybeEventFnHandlers & DataKeys & SchemaAugmentations['bodyAttrs'] & DefinedValueOrEmptyObject export interface HeadUtils { /** @@ -147,6 +158,18 @@ export interface Head extends HeadUti bodyAttrs?: BodyAttributes } +export interface ResolvedHead extends HeadUtils { + title: ResolvedTitle + base: ResolvedBase + link: ResolvedLink[] + meta: ResolvedMeta[] + style: (ResolvedStyle | string)[] + script: (ResolvedScript | string)[] + noscript: (ResolvedNoscript | string)[] + htmlAttrs: ResolvedHtmlAttributes + bodyAttrs: ResolvedBodyAttributes +} + export type UseSeoMetaInput = MetaFlatInput & { title?: Title, titleTemplate?: TitleTemplate } export type { BodyEvents, DataKeys, DefinedValueOrEmptyObject, MergeHead, MetaFlatInput, ScriptBase, SpeculationRules } from 'zhead'