@zhead/schema
Advanced tools
Comparing version 0.5.3 to 0.6.0
@@ -11,7 +11,7 @@ interface BodyAttributes { | ||
*/ | ||
lang: string; | ||
lang?: string; | ||
/** | ||
* The dir global attribute is an enumerated attribute that indicates the directionality of the element's text. | ||
*/ | ||
dir: 'ltr' | 'rtl' | 'auto'; | ||
dir?: 'ltr' | 'rtl' | 'auto'; | ||
} | ||
@@ -28,3 +28,3 @@ | ||
*/ | ||
as: 'audio' | 'document' | 'embed' | 'fetch' | 'font' | 'image' | 'object' | 'script' | 'style' | 'track' | 'video' | 'worker'; | ||
as?: 'audio' | 'document' | 'embed' | 'fetch' | 'font' | 'image' | 'object' | 'script' | 'style' | 'track' | 'video' | 'worker'; | ||
/** | ||
@@ -36,3 +36,3 @@ * This enumerated attribute indicates whether CORS must be used when fetching the resource. | ||
*/ | ||
crossorigin: '' | 'anonymous' | 'use-credentials'; | ||
crossorigin?: '' | 'anonymous' | 'use-credentials'; | ||
/** | ||
@@ -43,3 +43,3 @@ * Provides a hint of the relative priority to use when fetching a preloaded resource. | ||
*/ | ||
fetchpriority: 'high' | 'low' | 'auto'; | ||
fetchpriority?: 'high' | 'low' | 'auto'; | ||
/** | ||
@@ -50,3 +50,3 @@ * This attribute specifies the URL of the linked resource. A URL can be absolute or relative. | ||
*/ | ||
href: string; | ||
href?: string; | ||
/** | ||
@@ -59,3 +59,3 @@ * This attribute indicates the language of the linked resource. It is purely advisory. | ||
*/ | ||
hreflang: string; | ||
hreflang?: string; | ||
/** | ||
@@ -67,3 +67,3 @@ * For rel="preload" and as="image" only, the imagesizes attribute is a sizes attribute that indicates to preload | ||
*/ | ||
imagesizes: string; | ||
imagesizes?: string; | ||
/** | ||
@@ -76,3 +76,3 @@ * For rel="preload" and as="image" only, the imagesrcset attribute is a sourceset attribute that indicates | ||
*/ | ||
imagesrcset: string; | ||
imagesrcset?: string; | ||
/** | ||
@@ -85,3 +85,3 @@ * Contains inline metadata — a base64-encoded cryptographic hash of the resource (file) | ||
*/ | ||
integrity: string; | ||
integrity?: string; | ||
/** | ||
@@ -95,3 +95,3 @@ * This attribute specifies the media that the linked resource applies to. | ||
*/ | ||
media: string; | ||
media?: string; | ||
/** | ||
@@ -103,3 +103,3 @@ * Identifies a resource that might be required by the next navigation and that the user agent should retrieve it. | ||
*/ | ||
prefetch: string; | ||
prefetch?: string; | ||
/** | ||
@@ -110,3 +110,3 @@ * A string indicating which referrer to use when fetching the resource. | ||
*/ | ||
referrerpolicy: '' | 'no-referrer' | 'no-referrer-when-downgrade' | 'origin' | 'origin-when-cross-origin' | 'same-origin' | 'strict-origin' | 'strict-origin-when-cross-origin' | 'unsafe-url'; | ||
referrerpolicy?: '' | 'no-referrer' | 'no-referrer-when-downgrade' | 'origin' | 'origin-when-cross-origin' | 'same-origin' | 'strict-origin' | 'strict-origin-when-cross-origin' | 'unsafe-url'; | ||
/** | ||
@@ -118,3 +118,3 @@ * This attribute names a relationship of the linked document to the current document. | ||
*/ | ||
rel: 'alternate' | 'author' | 'shortcut icon' | 'bookmark' | 'canonical' | 'dns-prefetch' | 'external' | 'help' | 'icon' | 'license' | 'manifest' | 'me' | 'modulepreload' | 'next' | 'nofollow' | 'noopener' | 'noreferrer' | 'opener' | 'pingback' | 'preconnect' | 'prefetch' | 'preload' | 'prerender' | 'prev' | 'search' | 'shortlink' | 'stylesheet' | 'tag' | 'apple-touch-icon' | 'apple-touch-startup-image'; | ||
rel?: 'alternate' | 'author' | 'shortcut icon' | 'bookmark' | 'canonical' | 'dns-prefetch' | 'external' | 'help' | 'icon' | 'license' | 'manifest' | 'me' | 'modulepreload' | 'next' | 'nofollow' | 'noopener' | 'noreferrer' | 'opener' | 'pingback' | 'preconnect' | 'prefetch' | 'preload' | 'prerender' | 'prev' | 'search' | 'shortlink' | 'stylesheet' | 'tag' | 'apple-touch-icon' | 'apple-touch-startup-image'; | ||
/** | ||
@@ -127,3 +127,3 @@ * This attribute defines the sizes of the icons for visual media contained in the resource. | ||
*/ | ||
sizes: string; | ||
sizes?: string; | ||
/** | ||
@@ -135,3 +135,3 @@ * The title attribute has special semantics on the <link> element. | ||
*/ | ||
title: string; | ||
title?: string; | ||
/** | ||
@@ -147,15 +147,5 @@ * This attribute is used to define the type of the content linked to. | ||
*/ | ||
type: string; | ||
/** | ||
* @internal This property is used to dedupe the link tags | ||
*/ | ||
key: string; | ||
type?: string; | ||
} | ||
declare type LinkEntries<T extends Record<string, any>> = Partial<Link & T>[]; | ||
declare type Stringable = string | boolean | number; | ||
interface UnsafeKeys { | ||
[key: string]: Stringable; | ||
} | ||
interface MetaFlat { | ||
@@ -751,3 +741,3 @@ /** | ||
*/ | ||
charset: string; | ||
charset?: string; | ||
/** | ||
@@ -758,3 +748,3 @@ * This attribute contains the value for the http-equiv or name attribute, depending on which is used. | ||
*/ | ||
content: MetaFlat[keyof MetaFlat] | string | number; | ||
content?: (MetaFlat[keyof MetaFlat] extends string ? MetaFlat[keyof MetaFlat] : never) | string | number; | ||
/** | ||
@@ -766,3 +756,3 @@ * Defines a pragma directive. The attribute is named http-equiv(alent) because all the allowed values are names of | ||
*/ | ||
['http-equiv']: 'content-security-policy' | 'content-type' | 'default-style' | 'x-ua-compatible' | 'refresh' | 'accept-ch'; | ||
['http-equiv']?: 'content-security-policy' | 'content-type' | 'default-style' | 'x-ua-compatible' | 'refresh' | 'accept-ch'; | ||
/** | ||
@@ -774,3 +764,3 @@ * The name and content attributes can be used together to provide document metadata in terms of name-value pairs, | ||
*/ | ||
name: FixCase<ContentKeys<keyof MetaFlat>> | string; | ||
name?: FixCase<ContentKeys<keyof MetaFlat>> | string; | ||
/** | ||
@@ -781,9 +771,4 @@ * The property attribute is used to define a property associated with the content attribute. | ||
*/ | ||
property: FixCase<PropertyKeys<keyof MetaFlat>> | string; | ||
/** | ||
* @internal This property is used to dedupe the link tags | ||
*/ | ||
key: string; | ||
property?: FixCase<PropertyKeys<keyof MetaFlat>> | string; | ||
} | ||
declare type MetaEntries<T extends Record<string, any> = UnsafeKeys> = Partial<Meta & T>[]; | ||
@@ -801,3 +786,3 @@ interface Script { | ||
*/ | ||
async: boolean; | ||
async?: boolean; | ||
/** | ||
@@ -810,3 +795,3 @@ * Normal script elements pass minimal information to the window.onerror | ||
*/ | ||
crossorigin: '' | 'anonymous' | 'use-credentials'; | ||
crossorigin?: '' | 'anonymous' | 'use-credentials'; | ||
/** | ||
@@ -818,3 +803,3 @@ * This Boolean attribute is set to indicate to a browser that the script is meant to be executed after the document | ||
*/ | ||
defer: boolean; | ||
defer?: boolean; | ||
/** | ||
@@ -825,3 +810,3 @@ * Provides a hint of the relative priority to use when fetching an external script. | ||
*/ | ||
fetchpriority: 'high' | 'low' | 'auto'; | ||
fetchpriority?: 'high' | 'low' | 'auto'; | ||
/** | ||
@@ -833,3 +818,3 @@ * This attribute contains inline metadata that a user agent can use to verify | ||
*/ | ||
integrity: string; | ||
integrity?: string; | ||
/** | ||
@@ -842,3 +827,3 @@ * This Boolean attribute is set to indicate that the script should not be executed in browsers | ||
*/ | ||
nomodule: boolean; | ||
nomodule?: boolean; | ||
/** | ||
@@ -851,3 +836,3 @@ * A cryptographic nonce (number used once) to allow scripts in a script-src Content-Security-Policy. | ||
*/ | ||
nonce: string; | ||
nonce?: string; | ||
/** | ||
@@ -858,3 +843,3 @@ * Indicates which referrer to send when fetching the script, or resources fetched by the script. | ||
*/ | ||
referrerpolicy: '' | 'no-referrer' | 'no-referrer-when-downgrade' | 'origin' | 'origin-when-cross-origin' | 'same-origin' | 'strict-origin' | 'strict-origin-when-cross-origin' | 'unsafe-url'; | ||
referrerpolicy?: '' | 'no-referrer' | 'no-referrer-when-downgrade' | 'origin' | 'origin-when-cross-origin' | 'same-origin' | 'strict-origin' | 'strict-origin-when-cross-origin' | 'unsafe-url'; | ||
/** | ||
@@ -866,13 +851,11 @@ * This attribute specifies the URI of an external script; | ||
*/ | ||
src: string; | ||
src?: string; | ||
/** | ||
* This attribute indicates the type of script represented. | ||
*/ | ||
type: '' | 'text/javascript' | 'module'; | ||
type?: '' | 'text/javascript' | 'module'; | ||
} | ||
declare type ScriptEntries<T extends Record<string, any>> = Partial<Script & T>[]; | ||
interface Noscript { | ||
} | ||
declare type NoscriptEntries<T extends Record<string, any>> = Partial<Noscript & T>[]; | ||
@@ -886,3 +869,3 @@ interface Style { | ||
*/ | ||
media: string; | ||
media?: string; | ||
/** | ||
@@ -895,3 +878,3 @@ * A cryptographic nonce (number used once) used to allow inline styles in a style-src Content-Security-Policy. | ||
*/ | ||
nonce: string; | ||
nonce?: string; | ||
/** | ||
@@ -902,3 +885,3 @@ * This attribute specifies alternative style sheet sets. | ||
*/ | ||
title: string; | ||
title?: string; | ||
} | ||
@@ -913,3 +896,3 @@ declare type StyleEntries<T extends Record<string, any>> = Partial<Style & T>[]; | ||
*/ | ||
href: string; | ||
href?: string; | ||
/** | ||
@@ -921,6 +904,25 @@ * A keyword or author-defined name of the default browsing context to show the results of navigation from <a>, | ||
*/ | ||
target: string; | ||
target?: string; | ||
} | ||
interface Head<E extends Record<string, any> = UnsafeKeys> { | ||
declare type Stringable = string | boolean | number; | ||
interface UnsafeKeys { | ||
[key: string]: Stringable; | ||
} | ||
declare type Default<T extends undefined | Record<string, any>, D = {}> = [T] extends [undefined] ? D : T; | ||
declare type Merge<T extends undefined | Record<string, any>, D = {}> = [T] extends [undefined] ? D : D & T; | ||
interface MergeHead { | ||
title?: any; | ||
titleTemplate?: any; | ||
base?: Record<string, any>; | ||
link?: Record<string, any>; | ||
meta?: Record<string, any>; | ||
style?: Record<string, any>; | ||
script?: Record<string, any>; | ||
noscript?: Record<string, any>; | ||
htmlAttrs?: Record<string, any>; | ||
bodyAttrs?: Record<string, any>; | ||
} | ||
interface Head<E extends MergeHead = MergeHead> { | ||
/** | ||
@@ -932,7 +934,7 @@ * The <title> HTML element defines the document's title that is shown in a browser's title bar or a page's tab. | ||
*/ | ||
title?: string; | ||
title?: Default<E['title'], string>; | ||
/** | ||
* Generate the title from a template. | ||
*/ | ||
titleTemplate?: string | ((title?: string) => string); | ||
titleTemplate?: Default<E['titleTemplate'], string | ((title?: string) => string)>; | ||
/** | ||
@@ -944,3 +946,3 @@ * The <base> HTML element specifies the base URL to use for all relative URLs in a document. | ||
*/ | ||
base?: Partial<Base>; | ||
base?: Partial<Merge<E['base'], Base>>; | ||
/** | ||
@@ -953,3 +955,3 @@ * The <link> HTML element specifies relationships between the current document and an external resource. | ||
*/ | ||
link?: LinkEntries<E>; | ||
link?: (Link & UnsafeKeys & Default<E['link']>)[]; | ||
/** | ||
@@ -960,3 +962,3 @@ * The <meta> element represents metadata that cannot be expressed in other HTML elements, like <link> or <script>. | ||
*/ | ||
meta?: MetaEntries<E>; | ||
meta?: (Meta & UnsafeKeys & Default<E['meta']>)[]; | ||
/** | ||
@@ -968,3 +970,3 @@ * The <style> HTML element contains style information for a document, or part of a document. | ||
*/ | ||
style?: StyleEntries<E>; | ||
style?: (Style & UnsafeKeys & Default<E['style']>)[]; | ||
/** | ||
@@ -975,3 +977,3 @@ * The <script> HTML element is used to embed executable code or data; this is typically used to embed or refer to JavaScript code. | ||
*/ | ||
script?: ScriptEntries<E>; | ||
script?: (Script & UnsafeKeys & Default<E['script']>)[]; | ||
/** | ||
@@ -983,3 +985,3 @@ * The <noscript> HTML element defines a section of HTML to be inserted if a script type on the page is unsupported | ||
*/ | ||
noscript?: NoscriptEntries<E>; | ||
noscript?: (Noscript & UnsafeKeys & Default<E['noscript']>)[]; | ||
/** | ||
@@ -990,3 +992,3 @@ * Attributes for the <html> HTML element. | ||
*/ | ||
htmlAttrs?: Partial<HtmlAttributes & E>; | ||
htmlAttrs?: (HtmlAttributes & UnsafeKeys & Default<E['htmlAttrs']>); | ||
/** | ||
@@ -997,5 +999,5 @@ * Attributes for the <body> HTML element. | ||
*/ | ||
bodyAttrs?: Partial<BodyAttributes & E>; | ||
bodyAttrs?: (BodyAttributes & UnsafeKeys & Default<E['bodyAttrs']>); | ||
} | ||
export { Base, BodyAttributes, Head, HtmlAttributes, Link, LinkEntries, Meta, MetaEntries, MetaFlat, MetaFlatInput, Noscript, NoscriptEntries, Script, ScriptEntries, Stringable, Style, StyleEntries, UnsafeKeys }; | ||
export { Base, BodyAttributes, Default, Head, HtmlAttributes, Link, Merge, MergeHead, Meta, MetaFlat, MetaFlatInput, Noscript, Script, Stringable, Style, StyleEntries, UnsafeKeys }; |
{ | ||
"name": "@zhead/schema", | ||
"version": "0.5.3", | ||
"version": "0.6.0", | ||
"packageManager": "pnpm@7.8.0", | ||
@@ -5,0 +5,0 @@ "author": "Harlan Wilton <harlan@harlanzw.com>", |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
41836
950