@vueuse/head
Advanced tools
Comparing version 0.9.3 to 0.9.4
@@ -80,2 +80,3 @@ import * as vue from 'vue'; | ||
input: UseHeadInput<T>; | ||
id?: number; | ||
} | ||
@@ -149,2 +150,3 @@ interface ResolvedHeadEntry<T extends MergeHead = {}> { | ||
declare const sortTags: (aTag: HeadTag, bTag: HeadTag) => number; | ||
declare const hash: (s: string) => number; | ||
declare const tagDedupeKey: <T extends HeadTag>(tag: T) => string | false; | ||
@@ -182,2 +184,2 @@ declare function resolveHeadEntry<T extends MergeHead = {}>(obj: HeadEntry<T>): ResolvedHeadEntry; | ||
export { DomUpdateCtx, HTMLResult, HandlesDuplicates, HasRenderPriority, HasTextContent, Head, HeadAttrs, HeadClient, HeadEntry, HeadEntryOptions, HeadObject, HeadObjectPlain, HeadTag, HookBeforeDomUpdate, HookTagsResolved, Never, RendersToBody, ResolvedHeadEntry, TagKeys, UseHeadInput, UseHeadRawInput, VueUseHeadSchema, createElement, createHead, escapeHtml, escapeJS, injectHead, isEqualNode, renderHeadToString, resolveHeadEntry, setAttrs, sortTags, stringifyAttrName, stringifyAttrValue, stringifyAttrs, tagDedupeKey, tagToString, updateElements, useHead, useHeadRaw }; | ||
export { DomUpdateCtx, HTMLResult, HandlesDuplicates, HasRenderPriority, HasTextContent, Head, HeadAttrs, HeadClient, HeadEntry, HeadEntryOptions, HeadObject, HeadObjectPlain, HeadTag, HookBeforeDomUpdate, HookTagsResolved, Never, RendersToBody, ResolvedHeadEntry, TagKeys, UseHeadInput, UseHeadRawInput, VueUseHeadSchema, createElement, createHead, escapeHtml, escapeJS, hash, injectHead, isEqualNode, renderHeadToString, resolveHeadEntry, setAttrs, sortTags, stringifyAttrName, stringifyAttrValue, stringifyAttrs, tagDedupeKey, tagToString, updateElements, useHead, useHeadRaw }; |
@@ -28,2 +28,3 @@ "use strict"; | ||
escapeJS: () => escapeJS, | ||
hash: () => hash, | ||
injectHead: () => injectHead, | ||
@@ -76,8 +77,12 @@ isEqualNode: () => isEqualNode, | ||
}; | ||
var hash = (s) => s.split("").reduce((a, b) => { | ||
a = (a << 5) - a + b.charCodeAt(0); | ||
return a & a; | ||
}, 0); | ||
var tagDedupeKey = (tag) => { | ||
if (!["meta", "base", "script", "link"].includes(tag.tag)) | ||
if (!["meta", "base", "script", "link", "title"].includes(tag.tag)) | ||
return false; | ||
const { props, tag: tagName } = tag; | ||
if (tagName === "base") | ||
return "base"; | ||
if (tagName === "base" || tagName === "title") | ||
return tagName; | ||
if (tagName === "link" && props.rel === "canonical") | ||
@@ -584,5 +589,7 @@ return "canonical"; | ||
addHeadObjs(objs, options) { | ||
const ctx = allHeadObjs.push({ input: objs, options }); | ||
const entry = { input: objs, options, id: -1 }; | ||
const idx = allHeadObjs.push(entry); | ||
entry.id = hash(`${idx}:${objs.toString()}`); | ||
return () => { | ||
allHeadObjs.splice(ctx - 1, 1); | ||
allHeadObjs = allHeadObjs.filter((_objs) => _objs.id !== entry.id); | ||
}; | ||
@@ -663,2 +670,3 @@ }, | ||
escapeJS, | ||
hash, | ||
injectHead, | ||
@@ -665,0 +673,0 @@ isEqualNode, |
{ | ||
"name": "@vueuse/head", | ||
"version": "0.9.3", | ||
"version": "0.9.4", | ||
"packageManager": "pnpm@7.5.0", | ||
@@ -5,0 +5,0 @@ "description": "Document head manager for Vue 3. SSR ready.", |
Sorry, the diff of this file is not supported yet
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
58332
1477