@unhead/vue 1.0.16 → 1.0.18
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.cjs +15 -2
- package/dist/index.d.ts +7 -2
- package/dist/index.mjs +15 -2
- package/package.json +4 -4
package/dist/index.cjs
CHANGED
|
@@ -160,7 +160,7 @@ async function renderDOMHead(head, options = {}) {
|
|
|
160
160
|
// convert attributes to object
|
|
161
161
|
props: $el.getAttributeNames().reduce((props, name) => ({ ...props, [name]: $el.getAttribute(name) }), {})
|
|
162
162
|
});
|
|
163
|
-
const matchIdx = queue.findIndex((ctx2) => ctx2 && (ctx2.tag._d === dedupeKey || $el.isEqualNode(ctx2.$el)));
|
|
163
|
+
const matchIdx = queue.findIndex((ctx2) => ctx2 && (ctx2.tag._d === dedupeKey || $el.isEqualNode?.(ctx2.$el)));
|
|
164
164
|
if (matchIdx !== -1) {
|
|
165
165
|
const ctx2 = queue[matchIdx];
|
|
166
166
|
ctx2.$el = $el;
|
|
@@ -1029,6 +1029,20 @@ const useServerTagBase = (base) => useServerHead({ base });
|
|
|
1029
1029
|
const useServerHtmlAttrs = (attrs) => useServerHead({ htmlAttrs: attrs });
|
|
1030
1030
|
const useServerBodyAttrs = (attrs) => useHead({ bodyAttrs: attrs });
|
|
1031
1031
|
|
|
1032
|
+
const useSeoMeta = (input) => {
|
|
1033
|
+
const headInput = vue.ref({});
|
|
1034
|
+
vue.watchEffect(() => {
|
|
1035
|
+
const resolvedMeta = resolveUnrefHeadInput(input);
|
|
1036
|
+
const { title, titleTemplate, ...meta } = resolvedMeta;
|
|
1037
|
+
headInput.value = {
|
|
1038
|
+
title,
|
|
1039
|
+
titleTemplate,
|
|
1040
|
+
meta: unpackMeta(meta)
|
|
1041
|
+
};
|
|
1042
|
+
});
|
|
1043
|
+
return useHead(headInput);
|
|
1044
|
+
};
|
|
1045
|
+
|
|
1032
1046
|
function useHead(input, options = {}) {
|
|
1033
1047
|
const head = injectHead();
|
|
1034
1048
|
if (head) {
|
|
@@ -1048,7 +1062,6 @@ const useTagMetaFlat = (meta) => {
|
|
|
1048
1062
|
});
|
|
1049
1063
|
return useHead({ meta: input });
|
|
1050
1064
|
};
|
|
1051
|
-
const useSeoMeta = useTagMetaFlat;
|
|
1052
1065
|
const useTagLink = (link) => useHead({ link: asArray(link) });
|
|
1053
1066
|
const useTagScript = (script) => useHead({ script: asArray(script) });
|
|
1054
1067
|
const useTagStyle = (style) => useHead({ style: asArray(style) });
|
package/dist/index.d.ts
CHANGED
|
@@ -142,12 +142,17 @@ declare const useServerTagBase: (base: ReactiveHead['base']) => void | _unhead_s
|
|
|
142
142
|
declare const useServerHtmlAttrs: (attrs: ReactiveHead['htmlAttrs']) => void | _unhead_schema.ActiveHeadEntry<UseHeadInput<MergeHead>>;
|
|
143
143
|
declare const useServerBodyAttrs: (attrs: ReactiveHead['bodyAttrs']) => void | _unhead_schema.ActiveHeadEntry<UseHeadInput<MergeHead>>;
|
|
144
144
|
|
|
145
|
+
type UseSeoMetaInput = MaybeComputedRefEntries<MetaFlatInput> & {
|
|
146
|
+
title?: ReactiveHead['title'];
|
|
147
|
+
titleTemplate?: ReactiveHead['titleTemplate'];
|
|
148
|
+
};
|
|
149
|
+
declare const useSeoMeta: (input: UseSeoMetaInput) => ActiveHeadEntry<any> | void;
|
|
150
|
+
|
|
145
151
|
declare function useHead<T extends MergeHead>(input: UseHeadInput<T>, options?: HeadEntryOptions): ActiveHeadEntry<UseHeadInput<T>> | void;
|
|
146
152
|
declare const useTagTitle: (title: ReactiveHead['title']) => void | ActiveHeadEntry<UseHeadInput<MergeHead>>;
|
|
147
153
|
declare const useTitleTemplate: (titleTemplate: ReactiveHead['titleTemplate']) => void | ActiveHeadEntry<UseHeadInput<MergeHead>>;
|
|
148
154
|
declare const useTagMeta: (meta: Arrayable<Meta>) => void | ActiveHeadEntry<UseHeadInput<MergeHead>>;
|
|
149
155
|
declare const useTagMetaFlat: (meta: MaybeComputedRefEntries<MetaFlatInput>) => void | ActiveHeadEntry<UseHeadInput<MergeHead>>;
|
|
150
|
-
declare const useSeoMeta: (meta: MaybeComputedRefEntries<MetaFlatInput>) => void | ActiveHeadEntry<UseHeadInput<MergeHead>>;
|
|
151
156
|
declare const useTagLink: (link: Arrayable<Link>) => void | ActiveHeadEntry<UseHeadInput<MergeHead>>;
|
|
152
157
|
declare const useTagScript: (script: Arrayable<Script>) => void | ActiveHeadEntry<UseHeadInput<MergeHead>>;
|
|
153
158
|
declare const useTagStyle: (style: Arrayable<Style>) => void | ActiveHeadEntry<UseHeadInput<MergeHead>>;
|
|
@@ -160,4 +165,4 @@ declare const unheadVueComposablesImports: {
|
|
|
160
165
|
'@unhead/vue': string[];
|
|
161
166
|
};
|
|
162
167
|
|
|
163
|
-
export { Arrayable, Base, BodyAttributes, HtmlAttributes, Link, MaybeComputedRef, MaybeComputedRefEntries, MaybeComputedRefOrPromise, MaybeReadonlyRef, Meta, Noscript, ReactiveHead, Script, Style, Title, TitleTemplate, UseHeadInput, Vue2ProvideUnheadPlugin, VueHeadClient, VueHeadMixin, VueReactiveUseHeadPlugin, asArray, createHead, createHeadCore, headSymbol, injectHead, resolveUnrefHeadInput, unheadVueComposablesImports, useBodyAttrs, useHead, useHtmlAttrs, useSeoMeta, useServerBodyAttrs, useServerHead, useServerHtmlAttrs, useServerTagBase, useServerTagLink, useServerTagMeta, useServerTagMetaFlat, useServerTagNoscript, useServerTagScript, useServerTagStyle, useServerTagTitle, useServerTitleTemplate, useTagBase, useTagLink, useTagMeta, useTagMetaFlat, useTagNoscript, useTagScript, useTagStyle, useTagTitle, useTitleTemplate };
|
|
168
|
+
export { Arrayable, Base, BodyAttributes, HtmlAttributes, Link, MaybeComputedRef, MaybeComputedRefEntries, MaybeComputedRefOrPromise, MaybeReadonlyRef, Meta, Noscript, ReactiveHead, Script, Style, Title, TitleTemplate, UseHeadInput, UseSeoMetaInput, Vue2ProvideUnheadPlugin, VueHeadClient, VueHeadMixin, VueReactiveUseHeadPlugin, asArray, createHead, createHeadCore, headSymbol, injectHead, resolveUnrefHeadInput, unheadVueComposablesImports, useBodyAttrs, useHead, useHtmlAttrs, useSeoMeta, useServerBodyAttrs, useServerHead, useServerHtmlAttrs, useServerTagBase, useServerTagLink, useServerTagMeta, useServerTagMetaFlat, useServerTagNoscript, useServerTagScript, useServerTagStyle, useServerTagTitle, useServerTitleTemplate, useTagBase, useTagLink, useTagMeta, useTagMetaFlat, useTagNoscript, useTagScript, useTagStyle, useTagTitle, useTitleTemplate };
|
package/dist/index.mjs
CHANGED
|
@@ -158,7 +158,7 @@ async function renderDOMHead(head, options = {}) {
|
|
|
158
158
|
// convert attributes to object
|
|
159
159
|
props: $el.getAttributeNames().reduce((props, name) => ({ ...props, [name]: $el.getAttribute(name) }), {})
|
|
160
160
|
});
|
|
161
|
-
const matchIdx = queue.findIndex((ctx2) => ctx2 && (ctx2.tag._d === dedupeKey || $el.isEqualNode(ctx2.$el)));
|
|
161
|
+
const matchIdx = queue.findIndex((ctx2) => ctx2 && (ctx2.tag._d === dedupeKey || $el.isEqualNode?.(ctx2.$el)));
|
|
162
162
|
if (matchIdx !== -1) {
|
|
163
163
|
const ctx2 = queue[matchIdx];
|
|
164
164
|
ctx2.$el = $el;
|
|
@@ -1027,6 +1027,20 @@ const useServerTagBase = (base) => useServerHead({ base });
|
|
|
1027
1027
|
const useServerHtmlAttrs = (attrs) => useServerHead({ htmlAttrs: attrs });
|
|
1028
1028
|
const useServerBodyAttrs = (attrs) => useHead({ bodyAttrs: attrs });
|
|
1029
1029
|
|
|
1030
|
+
const useSeoMeta = (input) => {
|
|
1031
|
+
const headInput = ref({});
|
|
1032
|
+
watchEffect(() => {
|
|
1033
|
+
const resolvedMeta = resolveUnrefHeadInput(input);
|
|
1034
|
+
const { title, titleTemplate, ...meta } = resolvedMeta;
|
|
1035
|
+
headInput.value = {
|
|
1036
|
+
title,
|
|
1037
|
+
titleTemplate,
|
|
1038
|
+
meta: unpackMeta(meta)
|
|
1039
|
+
};
|
|
1040
|
+
});
|
|
1041
|
+
return useHead(headInput);
|
|
1042
|
+
};
|
|
1043
|
+
|
|
1030
1044
|
function useHead(input, options = {}) {
|
|
1031
1045
|
const head = injectHead();
|
|
1032
1046
|
if (head) {
|
|
@@ -1046,7 +1060,6 @@ const useTagMetaFlat = (meta) => {
|
|
|
1046
1060
|
});
|
|
1047
1061
|
return useHead({ meta: input });
|
|
1048
1062
|
};
|
|
1049
|
-
const useSeoMeta = useTagMetaFlat;
|
|
1050
1063
|
const useTagLink = (link) => useHead({ link: asArray(link) });
|
|
1051
1064
|
const useTagScript = (script) => useHead({ script: asArray(script) });
|
|
1052
1065
|
const useTagStyle = (style) => useHead({ style: asArray(style) });
|
package/package.json
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@unhead/vue",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "1.0.
|
|
5
|
-
"packageManager": "pnpm@7.25.
|
|
4
|
+
"version": "1.0.18",
|
|
5
|
+
"packageManager": "pnpm@7.25.1",
|
|
6
6
|
"author": "Harlan Wilton <harlan@harlanzw.com>",
|
|
7
7
|
"license": "MIT",
|
|
8
8
|
"funding": "https://github.com/sponsors/harlan-zw",
|
|
@@ -34,11 +34,11 @@
|
|
|
34
34
|
},
|
|
35
35
|
"dependencies": {
|
|
36
36
|
"hookable": "^5.4.2",
|
|
37
|
-
"@unhead/schema": "1.0.
|
|
37
|
+
"@unhead/schema": "1.0.18"
|
|
38
38
|
},
|
|
39
39
|
"devDependencies": {
|
|
40
40
|
"vue": "^3.2.45",
|
|
41
|
-
"unhead": "1.0.
|
|
41
|
+
"unhead": "1.0.18"
|
|
42
42
|
},
|
|
43
43
|
"scripts": {
|
|
44
44
|
"build": "unbuild .",
|