@vueuse/head
Advanced tools
Comparing version 0.2.3 to 0.3.0
@@ -36,2 +36,7 @@ import { UnwrapRef, App, Ref } from 'vue'; | ||
} | ||
/** | ||
* Inject the head manager instance | ||
* Exported for advanced usage or library integration, you probably don't need this | ||
*/ | ||
declare const injectHead: () => Head; | ||
declare const createHead: () => Head; | ||
@@ -41,2 +46,2 @@ declare const useHead: (obj: HeadObject | Ref<HeadObject> | (() => HeadObject)) => void; | ||
export { HTMLResult, Head, HeadAttrs, HeadObject, HeadObjectPlain, HeadTag, createHead, renderHeadToString, useHead }; | ||
export { HTMLResult, Head, HeadAttrs, HeadObject, HeadObjectPlain, HeadTag, createHead, injectHead, renderHeadToString, useHead }; |
@@ -11,3 +11,3 @@ "use strict";Object.defineProperty(exports, "__esModule", {value: true});// src/index.ts | ||
// src/constants.ts | ||
var PROVIDE_KEY = `_vue_use_head_`; | ||
var PROVIDE_KEY = `usehead`; | ||
var HEAD_COUNT_KEY = `head:count`; | ||
@@ -121,3 +121,7 @@ var HEAD_ATTRS_KEY = `data-head-attrs`; | ||
} | ||
el.setAttribute(HEAD_ATTRS_KEY, keys.join(",")); | ||
if (keys.length) { | ||
el.setAttribute(HEAD_ATTRS_KEY, keys.join(",")); | ||
} else { | ||
el.removeAttribute(HEAD_ATTRS_KEY); | ||
} | ||
}; | ||
@@ -244,6 +248,6 @@ var insertTags = (tags, document = window.document) => { | ||
let attrs = stringifyAttrs(tag.props); | ||
if (tag.props.children) { | ||
if (tag.props.children != null) { | ||
return `<${tag.tag}${attrs}>${tag.props.children}</${tag.tag}>`; | ||
} | ||
return `<${tag.tag}${attrs}/>`; | ||
return `<${tag.tag}${attrs}>`; | ||
}; | ||
@@ -266,3 +270,3 @@ var renderHeadToString = (head) => { | ||
} | ||
tags.push(`<meta name="${HEAD_COUNT_KEY}" content="${tags.length}" />`); | ||
tags.push(`<meta name="${HEAD_COUNT_KEY}" content="${tags.length}">`); | ||
return { | ||
@@ -290,2 +294,3 @@ get headTags() { | ||
exports.createHead = createHead; exports.renderHeadToString = renderHeadToString; exports.useHead = useHead; | ||
exports.createHead = createHead; exports.injectHead = injectHead; exports.renderHeadToString = renderHeadToString; exports.useHead = useHead; |
{ | ||
"name": "@vueuse/head", | ||
"version": "0.2.3", | ||
"version": "0.3.0", | ||
"license": "MIT", | ||
@@ -27,3 +27,4 @@ "description": "Document head manager for Vue 3. SSR ready.", | ||
"build": "tsup src/index.ts --format esm,cjs --external vue --dts", | ||
"test:e2e": "uvu -r esbuild-register" | ||
"prepublishOnly": "npm run build", | ||
"test:e2e": "ava" | ||
}, | ||
@@ -38,2 +39,11 @@ "repository": { | ||
}, | ||
"ava": { | ||
"extensions": [ | ||
"ts", | ||
"tsx" | ||
], | ||
"require": [ | ||
"esbuild-register" | ||
] | ||
}, | ||
"husky": { | ||
@@ -58,9 +68,7 @@ "hooks": { | ||
"lint-staged": "^10.5.3", | ||
"playwright-chromium": "^1.7.1", | ||
"playwright-chromium": "^1.8.0", | ||
"prettier": "^2.2.1", | ||
"shipjs": "0.23.0", | ||
"start-server-and-test": "^1.11.7", | ||
"tsup": "^3.11.0", | ||
"typescript": "^4.1.3", | ||
"uvu": "^0.5.1", | ||
"vite": "^2.0.0-beta.30", | ||
@@ -67,0 +75,0 @@ "vue": "^3.0.5", |
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
15
606
22722
6