Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@unhead/schema

Package Overview
Dependencies
Maintainers
1
Versions
204
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@unhead/schema - npm Package Compare versions

Comparing version 1.0.22 to 1.1.0

98

dist/index.d.ts

@@ -1,3 +0,3 @@

import { MaybePromiseProps, HeadTag as HeadTag$1, MergeHead, BaseBodyAttributes, HtmlAttributes as HtmlAttributes$1, Merge, Base as Base$1, DefinedValueOrEmptyObject, LinkBase, HttpEventAttributes, DataKeys, Style as Style$1, ScriptBase, Noscript as Noscript$1, BodyEvents, Meta as Meta$1, Stringable } from 'zhead';
export { BodyEvents, DataKeys, DefinedValueOrEmptyObject, MergeHead, MetaFlatInput, SpeculationRules, TagKey } from 'zhead';
import { MaybePromiseProps, MergeHead, BaseBodyAttributes, HtmlAttributes as HtmlAttributes$1, Meta as Meta$1, Stringable, Merge, Base as Base$1, DefinedValueOrEmptyObject, LinkBase, HttpEventAttributes, DataKeys, Style as Style$1, ScriptBase, Noscript as Noscript$1, BodyEvents } from 'zhead';
export { BodyEvents, DataKeys, DefinedValueOrEmptyObject, MergeHead, MetaFlatInput, SpeculationRules } from 'zhead';
import { NestedHooks, Hookable } from 'hookable';

@@ -46,15 +46,15 @@

*
* Alias for children
* Warning: This is not safe for XSS. Do not use this with user input, use `textContent` instead.
*/
innerHTML?: InnerContentVal;
/**
* Sets the textContent of an element.
* Sets the textContent of an element. Safer for XSS.
*/
children?: InnerContentVal;
textContent?: InnerContentVal;
/**
* Sets the textContent of an element. This will be HTML encoded.
* Sets the textContent of an element.
*
* Alias for children
* @deprecated Use `textContent` or `innerHTML`.
*/
textContent?: InnerContentVal;
children?: InnerContentVal;
}

@@ -76,3 +76,10 @@ interface TagPriority {

type TagUserProperties = TagPriority & TagPosition & MaybePromiseProps<InnerContent> & ResolvesDuplicates;
interface TagInternalProperties {
type TagKey = keyof Head;
type TemplateParams = {
separator?: string;
} & Record<string, string | Record<string, string>>;
interface HasTemplateParams {
templateParams?: TemplateParams;
}
interface HeadTag extends TagPriority, TagPosition, ResolvesDuplicates, HasTemplateParams {
/**

@@ -90,4 +97,11 @@ * Entry ID

_d?: string;
/**
* Hash code used to represent the tag.
*/
_h?: string;
tag: TagKey;
props: Record<string, string>;
innerHTML?: string;
textContent?: string;
}
type HeadTag = HeadTag$1 & TagUserProperties & TagInternalProperties;
type HeadTagKeys = (keyof HeadTag)[];

@@ -153,4 +167,16 @@

type BodyAttributes<E extends EntryAugmentation = {}> = MaybePromiseProps<BodyAttr> & MaybeFunctionEntries<BodyEvents> & DataKeys & SchemaAugmentations['bodyAttrs'] & DefinedValueOrEmptyObject<E>;
interface Head<E extends MergeHead = SchemaAugmentations> {
interface HeadUtils {
/**
* Generate the title from a template.
*
* Should include a `%s` placeholder for the title, for example `%s - My Site`.
*/
titleTemplate?: TitleTemplate;
/**
* Variables used to substitute in the title and meta content.
*/
templateParams?: TemplateParams;
}
interface Head<E extends MergeHead = SchemaAugmentations> extends HeadUtils {
/**
* The <title> HTML element defines the document's title that is shown in a browser's title bar or a page's tab.

@@ -163,8 +189,2 @@ * It only contains text; tags within the element are ignored.

/**
* Generate the title from a template.
*
* Should include a `%s` placeholder for the title, for example `%s - My Site`.
*/
titleTemplate?: TitleTemplate;
/**
* The <base> HTML element specifies the base URL to use for all relative URLs in a document.

@@ -196,3 +216,3 @@ * There can be only one <base> element in a document.

*/
style?: Style<E['style']>[];
style?: (Style<E['style']> | string)[];
/**

@@ -203,3 +223,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?: Script<E['script']>[];
script?: (Script<E['script']> | string)[];
/**

@@ -211,3 +231,3 @@ * The <noscript> HTML element defines a section of HTML to be inserted if a script type on the page is unsupported

*/
noscript?: Noscript<E['noscript']>[];
noscript?: (Noscript<E['noscript']> | string)[];
/**

@@ -227,2 +247,22 @@ * Attributes for the <html> HTML element.

type SafeBodyAttr = Pick<BodyAttr, 'id' | 'class'> & DataKeys;
type SafeHtmlAttr = Pick<HtmlAttr, 'id' | 'class' | 'lang' | 'dir'> & DataKeys;
type SafeMeta = Pick<Meta, 'id' | 'name' | 'property' | 'content'> & DataKeys;
type SafeLink = Pick<Link, 'color' | 'crossorigin' | 'fetchpriority' | 'href' | 'hreflang' | 'imagesizes' | 'imagesrcset' | 'integrity' | 'media' | 'referrerpolicy' | 'sizes' | 'id'> & {
rel?: Omit<Link['rel'], 'stylesheet' | 'canonical' | 'modulepreload' | 'prerender' | 'preload' | 'prefetch'>;
type?: 'audio/aac' | 'application/x-abiword' | 'application/x-freearc' | 'image/avif' | 'video/x-msvideo' | 'application/vnd.amazon.ebook' | 'application/octet-stream' | 'image/bmp' | 'application/x-bzip' | 'application/x-bzip2' | 'application/x-cdf' | 'application/x-csh' | 'text/csv' | 'application/msword' | 'application/vnd.openxmlformats-officedocument.wordprocessingml.document' | 'application/vnd.ms-fontobject' | 'application/epub+zip' | 'application/gzip' | 'image/gif' | 'image/vnd.microsoft.icon' | 'text/calendar' | 'application/java-archive' | 'image/jpeg' | 'application/json' | 'application/ld+json' | 'audio/midi' | 'audio/x-midi' | 'audio/mpeg' | 'video/mp4' | 'video/mpeg' | 'application/vnd.apple.installer+xml' | 'application/vnd.oasis.opendocument.presentation' | 'application/vnd.oasis.opendocument.spreadsheet' | 'application/vnd.oasis.opendocument.text' | 'audio/ogg' | 'video/ogg' | 'application/ogg' | 'audio/opus' | 'font/otf' | 'image/png' | 'application/pdf' | 'application/x-httpd-php' | 'application/vnd.ms-powerpoint' | 'application/vnd.openxmlformats-officedocument.presentationml.presentation' | 'application/vnd.rar' | 'application/rtf' | 'application/x-sh' | 'image/svg+xml' | 'application/x-tar' | 'image/tiff' | 'video/mp2t' | 'font/ttf' | 'text/plain' | 'application/vnd.visio' | 'audio/wav' | 'audio/webm' | 'video/webm' | 'image/webp' | 'font/woff' | 'font/woff2' | 'application/xhtml+xml' | 'application/vnd.ms-excel' | 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet' | 'text/xml' | 'application/atom+xml' | 'application/xml' | 'application/vnd.mozilla.xul+xml' | 'application/zip' | 'video/3gpp' | 'audio/3gpp' | 'video/3gpp2' | 'audio/3gpp2' | (string & Record<never, never>);
} & DataKeys;
type SafeScript = Pick<Script, 'id' | 'textContent'> & {
type: 'application/json' | 'application/ld+json';
} & DataKeys;
type SafeNoscript = Pick<Noscript, 'id' | 'textContent'> & DataKeys;
interface HeadSafe extends Pick<Head, 'title' | 'titleTemplate' | 'templateParams'> {
meta?: SafeMeta[];
link?: SafeLink[];
noscript?: SafeNoscript[];
script?: SafeScript[];
htmlAttrs?: SafeHtmlAttr;
bodyAttrs?: SafeBodyAttr;
}
type HookResult = Promise<void> | void;

@@ -241,8 +281,8 @@ interface SSRHeadPayload {

interface DomRenderTagContext {
renderId: string;
$el?: Element | null;
shouldRender: boolean;
renderId: string;
tag: HeadTag;
entry?: HeadEntry<any>;
staleSideEffects: SideEffectsRecord;
markSideEffect: (key: string, fn: () => void) => void;
}

@@ -263,2 +303,3 @@ interface BeforeRenderContext {

entry: HeadEntry<any>;
resolvedOptions: CreateHeadOptions;
}) => HookResult;

@@ -281,3 +322,3 @@ 'tags:resolve': (ctx: {

*
* For example `meta:data-h-4h46h465`: () => { document.querySelector('meta[data-h-4h46h465]').remove() }
* For example, `meta:data-h-4h46h465`: () => { document.querySelector('meta[data-h-4h46h465]').remove() }
*/

@@ -302,2 +343,8 @@ type SideEffectsRecord = Record<string, () => void>;

/**
* Transformer function for the entry.
*
* @internal
*/
_t?: (input: Input) => Input;
/**
* Head entry index

@@ -338,5 +385,7 @@ *

hooks?: NestedHooks<HeadHooks>;
experimentalHashHydration?: boolean;
}
interface HeadEntryOptions {
mode?: RuntimeMode;
transform?: (input: unknown) => unknown;
}

@@ -376,4 +425,5 @@ interface Unhead<Input extends {} = Head> {

_elMap: Record<string, Element>;
_hash?: string | false;
}
export { ActiveHeadEntry, Base, BaseBodyAttr, BaseHtmlAttr, BeforeRenderContext, BodyAttributes, CreateHeadOptions, DomRenderTagContext, EntryAugmentation, EntryResolveCtx, Head, HeadEntry, HeadEntryOptions, HeadHooks, HeadPlugin, HeadTag, HeadTagKeys, HookResult, HtmlAttributes, InnerContent, InnerContentVal, Link, MaybeArray, MaybeFunctionEntries, Meta, Never, Noscript, ResolvesDuplicates, RuntimeMode, SSRHeadPayload, SSRRenderContext, SchemaAugmentations, Script, SideEffectsRecord, Style, TagInternalProperties, TagPosition, TagPriority, TagUserProperties, Title, TitleTemplate, Unhead, UserAttributesConfig, UserTagConfigWithoutInnerContent, ValidTagPositions };
export { ActiveHeadEntry, Base, BaseBodyAttr, BaseHtmlAttr, BaseMeta, BeforeRenderContext, BodyAttr, BodyAttributes, CreateHeadOptions, DomRenderTagContext, EntryAugmentation, EntryResolveCtx, HasTemplateParams, Head, HeadEntry, HeadEntryOptions, HeadHooks, HeadPlugin, HeadSafe, HeadTag, HeadTagKeys, HeadUtils, HookResult, HtmlAttr, HtmlAttributes, InnerContent, InnerContentVal, Link, MaybeArray, MaybeFunctionEntries, Meta, Never, Noscript, ResolvesDuplicates, RuntimeMode, SSRHeadPayload, SSRRenderContext, SafeBodyAttr, SafeHtmlAttr, SafeLink, SafeMeta, SafeNoscript, SafeScript, SchemaAugmentations, Script, SideEffectsRecord, Style, TagKey, TagPosition, TagPriority, TagUserProperties, TemplateParams, Title, TitleTemplate, Unhead, UserAttributesConfig, UserTagConfigWithoutInnerContent, ValidTagPositions };
{
"name": "@unhead/schema",
"type": "module",
"version": "1.0.22",
"packageManager": "pnpm@7.26.3",
"version": "1.1.0",
"packageManager": "pnpm@7.27.1",
"author": "Harlan Wilton <harlan@harlanzw.com>",

@@ -39,3 +39,3 @@ "license": "MIT",

"hookable": "^5.4.2",
"zhead": "^2.0.0"
"zhead": "^2.0.4"
},

@@ -42,0 +42,0 @@ "scripts": {

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc