@unhead/vue 1.10.4 → 1.11.0-beta.2
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/components.cjs +1 -1
- package/dist/components.mjs +1 -1
- package/dist/index.cjs +80 -80
- package/dist/index.d.cts +20 -20
- package/dist/index.d.mts +20 -20
- package/dist/index.d.ts +20 -20
- package/dist/index.mjs +81 -81
- package/dist/polyfill.cjs +2 -2
- package/dist/polyfill.d.cts +1 -1
- package/dist/polyfill.d.mts +1 -1
- package/dist/polyfill.d.ts +1 -1
- package/dist/polyfill.mjs +2 -2
- package/dist/shared/{vue.fe30115b.cjs → vue.10fc9951.cjs} +3 -3
- package/dist/shared/{vue.8753d82d.cjs → vue.4291651c.cjs} +1 -1
- package/dist/shared/{vue.40986ab9.mjs → vue.538dba42.mjs} +3 -3
- package/dist/shared/{vue.3d788732.d.cts → vue.71760da0.d.cts} +9 -5
- package/dist/shared/{vue.3d788732.d.mts → vue.71760da0.d.mts} +9 -5
- package/dist/shared/{vue.3d788732.d.ts → vue.71760da0.d.ts} +9 -5
- package/dist/shared/{vue.65b7bcda.mjs → vue.fed13688.mjs} +1 -1
- package/dist/vue2.cjs +15 -3
- package/dist/vue2.mjs +15 -3
- package/package.json +5 -4
package/dist/components.cjs
CHANGED
package/dist/components.mjs
CHANGED
package/dist/index.cjs
CHANGED
|
@@ -1,51 +1,10 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
3
|
const unhead = require('unhead');
|
|
4
|
-
const injectHead = require('./shared/vue.
|
|
5
|
-
const vue = require('vue');
|
|
6
|
-
const useHead = require('./shared/vue.8753d82d.cjs');
|
|
4
|
+
const injectHead = require('./shared/vue.10fc9951.cjs');
|
|
7
5
|
const shared = require('@unhead/shared');
|
|
8
|
-
|
|
9
|
-
const
|
|
10
|
-
created() {
|
|
11
|
-
let source = false;
|
|
12
|
-
if (injectHead.Vue3) {
|
|
13
|
-
const instance = vue.getCurrentInstance();
|
|
14
|
-
if (!instance)
|
|
15
|
-
return;
|
|
16
|
-
const options = instance.type;
|
|
17
|
-
if (!options || !("head" in options))
|
|
18
|
-
return;
|
|
19
|
-
source = typeof options.head === "function" ? () => options.head.call(instance.proxy) : options.head;
|
|
20
|
-
} else {
|
|
21
|
-
const head = this.$options.head;
|
|
22
|
-
if (head) {
|
|
23
|
-
source = typeof head === "function" ? () => head.call(this) : head;
|
|
24
|
-
}
|
|
25
|
-
}
|
|
26
|
-
source && useHead.useHead(source);
|
|
27
|
-
}
|
|
28
|
-
};
|
|
29
|
-
|
|
30
|
-
const Vue2ProvideUnheadPlugin = (_Vue, head) => {
|
|
31
|
-
_Vue.mixin({
|
|
32
|
-
beforeCreate() {
|
|
33
|
-
const options = this.$options;
|
|
34
|
-
const origProvide = options.provide;
|
|
35
|
-
options.provide = function() {
|
|
36
|
-
let origProvideResult;
|
|
37
|
-
if (typeof origProvide === "function")
|
|
38
|
-
origProvideResult = origProvide.call(this);
|
|
39
|
-
else
|
|
40
|
-
origProvideResult = origProvide || {};
|
|
41
|
-
return {
|
|
42
|
-
...origProvideResult,
|
|
43
|
-
[injectHead.headSymbol]: head
|
|
44
|
-
};
|
|
45
|
-
};
|
|
46
|
-
}
|
|
47
|
-
});
|
|
48
|
-
};
|
|
6
|
+
const useHead = require('./shared/vue.4291651c.cjs');
|
|
7
|
+
const vue = require('vue');
|
|
49
8
|
|
|
50
9
|
const coreComposableNames = [
|
|
51
10
|
"injectHead"
|
|
@@ -58,42 +17,6 @@ function useHeadSafe(input, options = {}) {
|
|
|
58
17
|
return useHead.useHead(input, { ...options, transform: shared.whitelistSafeInput });
|
|
59
18
|
}
|
|
60
19
|
|
|
61
|
-
function useSeoMeta(input, options) {
|
|
62
|
-
const { title, titleTemplate, ...meta } = input;
|
|
63
|
-
return useHead.useHead({
|
|
64
|
-
title,
|
|
65
|
-
titleTemplate,
|
|
66
|
-
// @ts-expect-error runtime type
|
|
67
|
-
_flatMeta: meta
|
|
68
|
-
}, {
|
|
69
|
-
...options,
|
|
70
|
-
transform(t) {
|
|
71
|
-
const meta2 = shared.unpackMeta({ ...t._flatMeta });
|
|
72
|
-
delete t._flatMeta;
|
|
73
|
-
return {
|
|
74
|
-
// @ts-expect-error runtime type
|
|
75
|
-
...t,
|
|
76
|
-
meta: meta2
|
|
77
|
-
};
|
|
78
|
-
}
|
|
79
|
-
});
|
|
80
|
-
}
|
|
81
|
-
|
|
82
|
-
function useServerHead(input, options = {}) {
|
|
83
|
-
const head = options.head || injectHead.injectHead();
|
|
84
|
-
delete options.head;
|
|
85
|
-
if (head)
|
|
86
|
-
return head.push(input, { ...options, mode: "server" });
|
|
87
|
-
}
|
|
88
|
-
|
|
89
|
-
function useServerHeadSafe(input, options = {}) {
|
|
90
|
-
return useHeadSafe(input, { ...options, mode: "server" });
|
|
91
|
-
}
|
|
92
|
-
|
|
93
|
-
function useServerSeoMeta(input, options) {
|
|
94
|
-
return useSeoMeta(input, { ...options, mode: "server" });
|
|
95
|
-
}
|
|
96
|
-
|
|
97
20
|
function registerVueScopeHandlers(script, scope) {
|
|
98
21
|
if (!scope) {
|
|
99
22
|
return;
|
|
@@ -142,6 +65,83 @@ function useScript(_input, _options) {
|
|
|
142
65
|
});
|
|
143
66
|
}
|
|
144
67
|
|
|
68
|
+
function useSeoMeta(input, options) {
|
|
69
|
+
const { title, titleTemplate, ...meta } = input;
|
|
70
|
+
return useHead.useHead({
|
|
71
|
+
title,
|
|
72
|
+
titleTemplate,
|
|
73
|
+
// @ts-expect-error runtime type
|
|
74
|
+
_flatMeta: meta
|
|
75
|
+
}, {
|
|
76
|
+
...options,
|
|
77
|
+
transform(t) {
|
|
78
|
+
const meta2 = shared.unpackMeta({ ...t._flatMeta });
|
|
79
|
+
delete t._flatMeta;
|
|
80
|
+
return {
|
|
81
|
+
// @ts-expect-error runtime type
|
|
82
|
+
...t,
|
|
83
|
+
meta: meta2
|
|
84
|
+
};
|
|
85
|
+
}
|
|
86
|
+
});
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
function useServerHead(input, options = {}) {
|
|
90
|
+
const head = options.head || injectHead.injectHead();
|
|
91
|
+
delete options.head;
|
|
92
|
+
if (head)
|
|
93
|
+
return head.push(input, { ...options, mode: "server" });
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
function useServerHeadSafe(input, options = {}) {
|
|
97
|
+
return useHeadSafe(input, { ...options, mode: "server" });
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
function useServerSeoMeta(input, options) {
|
|
101
|
+
return useSeoMeta(input, { ...options, mode: "server" });
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
const Vue2ProvideUnheadPlugin = (_Vue, head) => {
|
|
105
|
+
_Vue.mixin({
|
|
106
|
+
beforeCreate() {
|
|
107
|
+
const options = this.$options;
|
|
108
|
+
const origProvide = options.provide;
|
|
109
|
+
options.provide = function() {
|
|
110
|
+
let origProvideResult;
|
|
111
|
+
if (typeof origProvide === "function")
|
|
112
|
+
origProvideResult = origProvide.call(this);
|
|
113
|
+
else
|
|
114
|
+
origProvideResult = origProvide || {};
|
|
115
|
+
return {
|
|
116
|
+
...origProvideResult,
|
|
117
|
+
[injectHead.headSymbol]: head
|
|
118
|
+
};
|
|
119
|
+
};
|
|
120
|
+
}
|
|
121
|
+
});
|
|
122
|
+
};
|
|
123
|
+
|
|
124
|
+
const VueHeadMixin = {
|
|
125
|
+
created() {
|
|
126
|
+
let source = false;
|
|
127
|
+
if (injectHead.Vue3) {
|
|
128
|
+
const instance = vue.getCurrentInstance();
|
|
129
|
+
if (!instance)
|
|
130
|
+
return;
|
|
131
|
+
const options = instance.type;
|
|
132
|
+
if (!options || !("head" in options))
|
|
133
|
+
return;
|
|
134
|
+
source = typeof options.head === "function" ? () => options.head.call(instance.proxy) : options.head;
|
|
135
|
+
} else {
|
|
136
|
+
const head = this.$options.head;
|
|
137
|
+
if (head) {
|
|
138
|
+
source = typeof head === "function" ? () => head.call(this) : head;
|
|
139
|
+
}
|
|
140
|
+
}
|
|
141
|
+
source && useHead.useHead(source);
|
|
142
|
+
}
|
|
143
|
+
};
|
|
144
|
+
|
|
145
145
|
exports.CapoPlugin = unhead.CapoPlugin;
|
|
146
146
|
exports.HashHydrationPlugin = unhead.HashHydrationPlugin;
|
|
147
147
|
exports.createHeadCore = unhead.createHeadCore;
|
package/dist/index.d.cts
CHANGED
|
@@ -2,9 +2,9 @@ export { CapoPlugin, HashHydrationPlugin, createHeadCore } from 'unhead';
|
|
|
2
2
|
import * as _unhead_schema from '@unhead/schema';
|
|
3
3
|
import { SafeMeta, SafeLink, SafeNoscript, SafeScript, SafeHtmlAttr, SafeBodyAttr, MergeHead, CreateHeadOptions, ActiveHeadEntry, ScriptInstance, UseScriptStatus, ScriptBase, DataKeys, SchemaAugmentations, AsAsyncFunctionValues, UseScriptOptions, UseFunctionType } from '@unhead/schema';
|
|
4
4
|
export { ActiveHeadEntry, Head, HeadEntryOptions, HeadTag, MergeHead, Unhead } from '@unhead/schema';
|
|
5
|
-
import { R as ReactiveHead, M as MaybeComputedRefEntries, a as MaybeComputedRef, V as VueHeadClient, U as UseHeadInput, b as UseHeadOptions, c as
|
|
6
|
-
export { f as Base, B as BodyAttr, j as BodyAttributes, H as HtmlAttr, i as HtmlAttributes, L as Link, l as MaybeComputedRefOrPromise, k as MaybeReadonlyRef, g as Meta, N as Noscript, h as Script, S as Style, T as Title, e as TitleTemplate } from './shared/vue.
|
|
7
|
-
import {
|
|
5
|
+
import { R as ReactiveHead, M as MaybeComputedRefEntries, a as MaybeComputedRef, V as VueHeadClient, U as UseHeadInput, b as UseHeadOptions, c as MaybeComputedRefEntriesOnly, d as UseSeoMetaInput } from './shared/vue.71760da0.cjs';
|
|
6
|
+
export { f as Base, B as BodyAttr, j as BodyAttributes, H as HtmlAttr, i as HtmlAttributes, L as Link, l as MaybeComputedRefOrFalsy, m as MaybeComputedRefOrPromise, k as MaybeReadonlyRef, g as Meta, N as Noscript, h as Script, S as Style, T as Title, e as TitleTemplate } from './shared/vue.71760da0.cjs';
|
|
7
|
+
import { Ref, Plugin } from 'vue';
|
|
8
8
|
|
|
9
9
|
interface HeadSafe extends Pick<ReactiveHead, 'title' | 'titleTemplate' | 'templateParams'> {
|
|
10
10
|
meta?: MaybeComputedRefEntries<SafeMeta>[];
|
|
@@ -21,15 +21,6 @@ declare function createHead<T extends MergeHead>(options?: CreateHeadOptions): V
|
|
|
21
21
|
|
|
22
22
|
declare function resolveUnrefHeadInput(ref: any): any;
|
|
23
23
|
|
|
24
|
-
declare const VueHeadMixin: {
|
|
25
|
-
created(): void;
|
|
26
|
-
};
|
|
27
|
-
|
|
28
|
-
/**
|
|
29
|
-
* @deprecated Import { UnheadPlugin } from `@unhead/vue/vue2` and use Vue.mixin(UnheadPlugin(head)) instead.
|
|
30
|
-
*/
|
|
31
|
-
declare const Vue2ProvideUnheadPlugin: Plugin;
|
|
32
|
-
|
|
33
24
|
declare const unheadVueComposablesImports: {
|
|
34
25
|
'@unhead/vue': string[];
|
|
35
26
|
};
|
|
@@ -41,14 +32,6 @@ declare function useHead<T extends MergeHead>(input: UseHeadInput<T>, options?:
|
|
|
41
32
|
|
|
42
33
|
declare function useHeadSafe(input: UseHeadSafeInput, options?: UseHeadOptions): ActiveHeadEntry<UseHeadSafeInput> | void;
|
|
43
34
|
|
|
44
|
-
declare function useSeoMeta(input: UseSeoMetaInput, options?: UseHeadOptions): ActiveHeadEntry<any> | void;
|
|
45
|
-
|
|
46
|
-
declare function useServerHead<T extends MergeHead>(input: UseHeadInput<T>, options?: UseHeadOptions): _unhead_schema.ActiveHeadEntry<MaybeComputedRef<ReactiveHead<any>>> | undefined;
|
|
47
|
-
|
|
48
|
-
declare function useServerHeadSafe(input: UseHeadSafeInput, options?: UseHeadOptions): void | _unhead_schema.ActiveHeadEntry<UseHeadSafeInput>;
|
|
49
|
-
|
|
50
|
-
declare function useServerSeoMeta(input: UseSeoMetaInput, options?: UseHeadOptions): ActiveHeadEntry<any> | void;
|
|
51
|
-
|
|
52
35
|
interface VueScriptInstance<T extends Record<symbol | string, any>> extends Omit<ScriptInstance<T>, 'status'> {
|
|
53
36
|
status: Ref<UseScriptStatus>;
|
|
54
37
|
}
|
|
@@ -63,4 +46,21 @@ type UseScriptContext<T extends Record<symbol | string, any>> = (Promise<T> & Vu
|
|
|
63
46
|
};
|
|
64
47
|
declare function useScript<T extends Record<symbol | string, any> = Record<symbol | string, any>, U = Record<symbol | string, any>>(_input: UseScriptInput, _options?: UseScriptOptions<T, U>): UseScriptContext<UseFunctionType<UseScriptOptions<T, U>, T>>;
|
|
65
48
|
|
|
49
|
+
declare function useSeoMeta(input: UseSeoMetaInput, options?: UseHeadOptions): ActiveHeadEntry<any> | void;
|
|
50
|
+
|
|
51
|
+
declare function useServerHead<T extends MergeHead>(input: UseHeadInput<T>, options?: UseHeadOptions): _unhead_schema.ActiveHeadEntry<MaybeComputedRef<ReactiveHead<any>>> | undefined;
|
|
52
|
+
|
|
53
|
+
declare function useServerHeadSafe(input: UseHeadSafeInput, options?: UseHeadOptions): void | _unhead_schema.ActiveHeadEntry<UseHeadSafeInput>;
|
|
54
|
+
|
|
55
|
+
declare function useServerSeoMeta(input: UseSeoMetaInput, options?: UseHeadOptions): ActiveHeadEntry<any> | void;
|
|
56
|
+
|
|
57
|
+
/**
|
|
58
|
+
* @deprecated Import { UnheadPlugin } from `@unhead/vue/vue2` and use Vue.mixin(UnheadPlugin(head)) instead.
|
|
59
|
+
*/
|
|
60
|
+
declare const Vue2ProvideUnheadPlugin: Plugin;
|
|
61
|
+
|
|
62
|
+
declare const VueHeadMixin: {
|
|
63
|
+
created(): void;
|
|
64
|
+
};
|
|
65
|
+
|
|
66
66
|
export { type HeadSafe, MaybeComputedRef, MaybeComputedRefEntries, MaybeComputedRefEntriesOnly, ReactiveHead, UseHeadInput, UseHeadOptions, type UseHeadSafeInput, type UseScriptContext, type UseScriptInput, UseSeoMetaInput, Vue2ProvideUnheadPlugin, VueHeadClient, VueHeadMixin, type VueScriptInstance, createHead, createServerHead, injectHead, resolveUnrefHeadInput, setHeadInjectionHandler, unheadVueComposablesImports, useHead, useHeadSafe, useScript, useSeoMeta, useServerHead, useServerHeadSafe, useServerSeoMeta };
|
package/dist/index.d.mts
CHANGED
|
@@ -2,9 +2,9 @@ export { CapoPlugin, HashHydrationPlugin, createHeadCore } from 'unhead';
|
|
|
2
2
|
import * as _unhead_schema from '@unhead/schema';
|
|
3
3
|
import { SafeMeta, SafeLink, SafeNoscript, SafeScript, SafeHtmlAttr, SafeBodyAttr, MergeHead, CreateHeadOptions, ActiveHeadEntry, ScriptInstance, UseScriptStatus, ScriptBase, DataKeys, SchemaAugmentations, AsAsyncFunctionValues, UseScriptOptions, UseFunctionType } from '@unhead/schema';
|
|
4
4
|
export { ActiveHeadEntry, Head, HeadEntryOptions, HeadTag, MergeHead, Unhead } from '@unhead/schema';
|
|
5
|
-
import { R as ReactiveHead, M as MaybeComputedRefEntries, a as MaybeComputedRef, V as VueHeadClient, U as UseHeadInput, b as UseHeadOptions, c as
|
|
6
|
-
export { f as Base, B as BodyAttr, j as BodyAttributes, H as HtmlAttr, i as HtmlAttributes, L as Link, l as MaybeComputedRefOrPromise, k as MaybeReadonlyRef, g as Meta, N as Noscript, h as Script, S as Style, T as Title, e as TitleTemplate } from './shared/vue.
|
|
7
|
-
import {
|
|
5
|
+
import { R as ReactiveHead, M as MaybeComputedRefEntries, a as MaybeComputedRef, V as VueHeadClient, U as UseHeadInput, b as UseHeadOptions, c as MaybeComputedRefEntriesOnly, d as UseSeoMetaInput } from './shared/vue.71760da0.mjs';
|
|
6
|
+
export { f as Base, B as BodyAttr, j as BodyAttributes, H as HtmlAttr, i as HtmlAttributes, L as Link, l as MaybeComputedRefOrFalsy, m as MaybeComputedRefOrPromise, k as MaybeReadonlyRef, g as Meta, N as Noscript, h as Script, S as Style, T as Title, e as TitleTemplate } from './shared/vue.71760da0.mjs';
|
|
7
|
+
import { Ref, Plugin } from 'vue';
|
|
8
8
|
|
|
9
9
|
interface HeadSafe extends Pick<ReactiveHead, 'title' | 'titleTemplate' | 'templateParams'> {
|
|
10
10
|
meta?: MaybeComputedRefEntries<SafeMeta>[];
|
|
@@ -21,15 +21,6 @@ declare function createHead<T extends MergeHead>(options?: CreateHeadOptions): V
|
|
|
21
21
|
|
|
22
22
|
declare function resolveUnrefHeadInput(ref: any): any;
|
|
23
23
|
|
|
24
|
-
declare const VueHeadMixin: {
|
|
25
|
-
created(): void;
|
|
26
|
-
};
|
|
27
|
-
|
|
28
|
-
/**
|
|
29
|
-
* @deprecated Import { UnheadPlugin } from `@unhead/vue/vue2` and use Vue.mixin(UnheadPlugin(head)) instead.
|
|
30
|
-
*/
|
|
31
|
-
declare const Vue2ProvideUnheadPlugin: Plugin;
|
|
32
|
-
|
|
33
24
|
declare const unheadVueComposablesImports: {
|
|
34
25
|
'@unhead/vue': string[];
|
|
35
26
|
};
|
|
@@ -41,14 +32,6 @@ declare function useHead<T extends MergeHead>(input: UseHeadInput<T>, options?:
|
|
|
41
32
|
|
|
42
33
|
declare function useHeadSafe(input: UseHeadSafeInput, options?: UseHeadOptions): ActiveHeadEntry<UseHeadSafeInput> | void;
|
|
43
34
|
|
|
44
|
-
declare function useSeoMeta(input: UseSeoMetaInput, options?: UseHeadOptions): ActiveHeadEntry<any> | void;
|
|
45
|
-
|
|
46
|
-
declare function useServerHead<T extends MergeHead>(input: UseHeadInput<T>, options?: UseHeadOptions): _unhead_schema.ActiveHeadEntry<MaybeComputedRef<ReactiveHead<any>>> | undefined;
|
|
47
|
-
|
|
48
|
-
declare function useServerHeadSafe(input: UseHeadSafeInput, options?: UseHeadOptions): void | _unhead_schema.ActiveHeadEntry<UseHeadSafeInput>;
|
|
49
|
-
|
|
50
|
-
declare function useServerSeoMeta(input: UseSeoMetaInput, options?: UseHeadOptions): ActiveHeadEntry<any> | void;
|
|
51
|
-
|
|
52
35
|
interface VueScriptInstance<T extends Record<symbol | string, any>> extends Omit<ScriptInstance<T>, 'status'> {
|
|
53
36
|
status: Ref<UseScriptStatus>;
|
|
54
37
|
}
|
|
@@ -63,4 +46,21 @@ type UseScriptContext<T extends Record<symbol | string, any>> = (Promise<T> & Vu
|
|
|
63
46
|
};
|
|
64
47
|
declare function useScript<T extends Record<symbol | string, any> = Record<symbol | string, any>, U = Record<symbol | string, any>>(_input: UseScriptInput, _options?: UseScriptOptions<T, U>): UseScriptContext<UseFunctionType<UseScriptOptions<T, U>, T>>;
|
|
65
48
|
|
|
49
|
+
declare function useSeoMeta(input: UseSeoMetaInput, options?: UseHeadOptions): ActiveHeadEntry<any> | void;
|
|
50
|
+
|
|
51
|
+
declare function useServerHead<T extends MergeHead>(input: UseHeadInput<T>, options?: UseHeadOptions): _unhead_schema.ActiveHeadEntry<MaybeComputedRef<ReactiveHead<any>>> | undefined;
|
|
52
|
+
|
|
53
|
+
declare function useServerHeadSafe(input: UseHeadSafeInput, options?: UseHeadOptions): void | _unhead_schema.ActiveHeadEntry<UseHeadSafeInput>;
|
|
54
|
+
|
|
55
|
+
declare function useServerSeoMeta(input: UseSeoMetaInput, options?: UseHeadOptions): ActiveHeadEntry<any> | void;
|
|
56
|
+
|
|
57
|
+
/**
|
|
58
|
+
* @deprecated Import { UnheadPlugin } from `@unhead/vue/vue2` and use Vue.mixin(UnheadPlugin(head)) instead.
|
|
59
|
+
*/
|
|
60
|
+
declare const Vue2ProvideUnheadPlugin: Plugin;
|
|
61
|
+
|
|
62
|
+
declare const VueHeadMixin: {
|
|
63
|
+
created(): void;
|
|
64
|
+
};
|
|
65
|
+
|
|
66
66
|
export { type HeadSafe, MaybeComputedRef, MaybeComputedRefEntries, MaybeComputedRefEntriesOnly, ReactiveHead, UseHeadInput, UseHeadOptions, type UseHeadSafeInput, type UseScriptContext, type UseScriptInput, UseSeoMetaInput, Vue2ProvideUnheadPlugin, VueHeadClient, VueHeadMixin, type VueScriptInstance, createHead, createServerHead, injectHead, resolveUnrefHeadInput, setHeadInjectionHandler, unheadVueComposablesImports, useHead, useHeadSafe, useScript, useSeoMeta, useServerHead, useServerHeadSafe, useServerSeoMeta };
|
package/dist/index.d.ts
CHANGED
|
@@ -2,9 +2,9 @@ export { CapoPlugin, HashHydrationPlugin, createHeadCore } from 'unhead';
|
|
|
2
2
|
import * as _unhead_schema from '@unhead/schema';
|
|
3
3
|
import { SafeMeta, SafeLink, SafeNoscript, SafeScript, SafeHtmlAttr, SafeBodyAttr, MergeHead, CreateHeadOptions, ActiveHeadEntry, ScriptInstance, UseScriptStatus, ScriptBase, DataKeys, SchemaAugmentations, AsAsyncFunctionValues, UseScriptOptions, UseFunctionType } from '@unhead/schema';
|
|
4
4
|
export { ActiveHeadEntry, Head, HeadEntryOptions, HeadTag, MergeHead, Unhead } from '@unhead/schema';
|
|
5
|
-
import { R as ReactiveHead, M as MaybeComputedRefEntries, a as MaybeComputedRef, V as VueHeadClient, U as UseHeadInput, b as UseHeadOptions, c as
|
|
6
|
-
export { f as Base, B as BodyAttr, j as BodyAttributes, H as HtmlAttr, i as HtmlAttributes, L as Link, l as MaybeComputedRefOrPromise, k as MaybeReadonlyRef, g as Meta, N as Noscript, h as Script, S as Style, T as Title, e as TitleTemplate } from './shared/vue.
|
|
7
|
-
import {
|
|
5
|
+
import { R as ReactiveHead, M as MaybeComputedRefEntries, a as MaybeComputedRef, V as VueHeadClient, U as UseHeadInput, b as UseHeadOptions, c as MaybeComputedRefEntriesOnly, d as UseSeoMetaInput } from './shared/vue.71760da0.js';
|
|
6
|
+
export { f as Base, B as BodyAttr, j as BodyAttributes, H as HtmlAttr, i as HtmlAttributes, L as Link, l as MaybeComputedRefOrFalsy, m as MaybeComputedRefOrPromise, k as MaybeReadonlyRef, g as Meta, N as Noscript, h as Script, S as Style, T as Title, e as TitleTemplate } from './shared/vue.71760da0.js';
|
|
7
|
+
import { Ref, Plugin } from 'vue';
|
|
8
8
|
|
|
9
9
|
interface HeadSafe extends Pick<ReactiveHead, 'title' | 'titleTemplate' | 'templateParams'> {
|
|
10
10
|
meta?: MaybeComputedRefEntries<SafeMeta>[];
|
|
@@ -21,15 +21,6 @@ declare function createHead<T extends MergeHead>(options?: CreateHeadOptions): V
|
|
|
21
21
|
|
|
22
22
|
declare function resolveUnrefHeadInput(ref: any): any;
|
|
23
23
|
|
|
24
|
-
declare const VueHeadMixin: {
|
|
25
|
-
created(): void;
|
|
26
|
-
};
|
|
27
|
-
|
|
28
|
-
/**
|
|
29
|
-
* @deprecated Import { UnheadPlugin } from `@unhead/vue/vue2` and use Vue.mixin(UnheadPlugin(head)) instead.
|
|
30
|
-
*/
|
|
31
|
-
declare const Vue2ProvideUnheadPlugin: Plugin;
|
|
32
|
-
|
|
33
24
|
declare const unheadVueComposablesImports: {
|
|
34
25
|
'@unhead/vue': string[];
|
|
35
26
|
};
|
|
@@ -41,14 +32,6 @@ declare function useHead<T extends MergeHead>(input: UseHeadInput<T>, options?:
|
|
|
41
32
|
|
|
42
33
|
declare function useHeadSafe(input: UseHeadSafeInput, options?: UseHeadOptions): ActiveHeadEntry<UseHeadSafeInput> | void;
|
|
43
34
|
|
|
44
|
-
declare function useSeoMeta(input: UseSeoMetaInput, options?: UseHeadOptions): ActiveHeadEntry<any> | void;
|
|
45
|
-
|
|
46
|
-
declare function useServerHead<T extends MergeHead>(input: UseHeadInput<T>, options?: UseHeadOptions): _unhead_schema.ActiveHeadEntry<MaybeComputedRef<ReactiveHead<any>>> | undefined;
|
|
47
|
-
|
|
48
|
-
declare function useServerHeadSafe(input: UseHeadSafeInput, options?: UseHeadOptions): void | _unhead_schema.ActiveHeadEntry<UseHeadSafeInput>;
|
|
49
|
-
|
|
50
|
-
declare function useServerSeoMeta(input: UseSeoMetaInput, options?: UseHeadOptions): ActiveHeadEntry<any> | void;
|
|
51
|
-
|
|
52
35
|
interface VueScriptInstance<T extends Record<symbol | string, any>> extends Omit<ScriptInstance<T>, 'status'> {
|
|
53
36
|
status: Ref<UseScriptStatus>;
|
|
54
37
|
}
|
|
@@ -63,4 +46,21 @@ type UseScriptContext<T extends Record<symbol | string, any>> = (Promise<T> & Vu
|
|
|
63
46
|
};
|
|
64
47
|
declare function useScript<T extends Record<symbol | string, any> = Record<symbol | string, any>, U = Record<symbol | string, any>>(_input: UseScriptInput, _options?: UseScriptOptions<T, U>): UseScriptContext<UseFunctionType<UseScriptOptions<T, U>, T>>;
|
|
65
48
|
|
|
49
|
+
declare function useSeoMeta(input: UseSeoMetaInput, options?: UseHeadOptions): ActiveHeadEntry<any> | void;
|
|
50
|
+
|
|
51
|
+
declare function useServerHead<T extends MergeHead>(input: UseHeadInput<T>, options?: UseHeadOptions): _unhead_schema.ActiveHeadEntry<MaybeComputedRef<ReactiveHead<any>>> | undefined;
|
|
52
|
+
|
|
53
|
+
declare function useServerHeadSafe(input: UseHeadSafeInput, options?: UseHeadOptions): void | _unhead_schema.ActiveHeadEntry<UseHeadSafeInput>;
|
|
54
|
+
|
|
55
|
+
declare function useServerSeoMeta(input: UseSeoMetaInput, options?: UseHeadOptions): ActiveHeadEntry<any> | void;
|
|
56
|
+
|
|
57
|
+
/**
|
|
58
|
+
* @deprecated Import { UnheadPlugin } from `@unhead/vue/vue2` and use Vue.mixin(UnheadPlugin(head)) instead.
|
|
59
|
+
*/
|
|
60
|
+
declare const Vue2ProvideUnheadPlugin: Plugin;
|
|
61
|
+
|
|
62
|
+
declare const VueHeadMixin: {
|
|
63
|
+
created(): void;
|
|
64
|
+
};
|
|
65
|
+
|
|
66
66
|
export { type HeadSafe, MaybeComputedRef, MaybeComputedRefEntries, MaybeComputedRefEntriesOnly, ReactiveHead, UseHeadInput, UseHeadOptions, type UseHeadSafeInput, type UseScriptContext, type UseScriptInput, UseSeoMetaInput, Vue2ProvideUnheadPlugin, VueHeadClient, VueHeadMixin, type VueScriptInstance, createHead, createServerHead, injectHead, resolveUnrefHeadInput, setHeadInjectionHandler, unheadVueComposablesImports, useHead, useHeadSafe, useScript, useSeoMeta, useServerHead, useServerHeadSafe, useServerSeoMeta };
|
package/dist/index.mjs
CHANGED
|
@@ -1,51 +1,10 @@
|
|
|
1
1
|
import { useScript as useScript$1 } from 'unhead';
|
|
2
2
|
export { CapoPlugin, HashHydrationPlugin, createHeadCore } from 'unhead';
|
|
3
|
-
import {
|
|
4
|
-
export { c as createHead, a as createServerHead, r as resolveUnrefHeadInput, s as setHeadInjectionHandler } from './shared/vue.
|
|
5
|
-
import { getCurrentInstance, onMounted, ref, onScopeDispose } from 'vue';
|
|
6
|
-
import { u as useHead } from './shared/vue.65b7bcda.mjs';
|
|
3
|
+
import { i as injectHead, h as headSymbol, V as Vue3 } from './shared/vue.538dba42.mjs';
|
|
4
|
+
export { c as createHead, a as createServerHead, r as resolveUnrefHeadInput, s as setHeadInjectionHandler } from './shared/vue.538dba42.mjs';
|
|
7
5
|
import { composableNames, whitelistSafeInput, unpackMeta } from '@unhead/shared';
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
created() {
|
|
11
|
-
let source = false;
|
|
12
|
-
if (Vue3) {
|
|
13
|
-
const instance = getCurrentInstance();
|
|
14
|
-
if (!instance)
|
|
15
|
-
return;
|
|
16
|
-
const options = instance.type;
|
|
17
|
-
if (!options || !("head" in options))
|
|
18
|
-
return;
|
|
19
|
-
source = typeof options.head === "function" ? () => options.head.call(instance.proxy) : options.head;
|
|
20
|
-
} else {
|
|
21
|
-
const head = this.$options.head;
|
|
22
|
-
if (head) {
|
|
23
|
-
source = typeof head === "function" ? () => head.call(this) : head;
|
|
24
|
-
}
|
|
25
|
-
}
|
|
26
|
-
source && useHead(source);
|
|
27
|
-
}
|
|
28
|
-
};
|
|
29
|
-
|
|
30
|
-
const Vue2ProvideUnheadPlugin = (_Vue, head) => {
|
|
31
|
-
_Vue.mixin({
|
|
32
|
-
beforeCreate() {
|
|
33
|
-
const options = this.$options;
|
|
34
|
-
const origProvide = options.provide;
|
|
35
|
-
options.provide = function() {
|
|
36
|
-
let origProvideResult;
|
|
37
|
-
if (typeof origProvide === "function")
|
|
38
|
-
origProvideResult = origProvide.call(this);
|
|
39
|
-
else
|
|
40
|
-
origProvideResult = origProvide || {};
|
|
41
|
-
return {
|
|
42
|
-
...origProvideResult,
|
|
43
|
-
[headSymbol]: head
|
|
44
|
-
};
|
|
45
|
-
};
|
|
46
|
-
}
|
|
47
|
-
});
|
|
48
|
-
};
|
|
6
|
+
import { u as useHead } from './shared/vue.fed13688.mjs';
|
|
7
|
+
import { getCurrentInstance, onMounted, ref, onScopeDispose } from 'vue';
|
|
49
8
|
|
|
50
9
|
const coreComposableNames = [
|
|
51
10
|
"injectHead"
|
|
@@ -58,42 +17,6 @@ function useHeadSafe(input, options = {}) {
|
|
|
58
17
|
return useHead(input, { ...options, transform: whitelistSafeInput });
|
|
59
18
|
}
|
|
60
19
|
|
|
61
|
-
function useSeoMeta(input, options) {
|
|
62
|
-
const { title, titleTemplate, ...meta } = input;
|
|
63
|
-
return useHead({
|
|
64
|
-
title,
|
|
65
|
-
titleTemplate,
|
|
66
|
-
// @ts-expect-error runtime type
|
|
67
|
-
_flatMeta: meta
|
|
68
|
-
}, {
|
|
69
|
-
...options,
|
|
70
|
-
transform(t) {
|
|
71
|
-
const meta2 = unpackMeta({ ...t._flatMeta });
|
|
72
|
-
delete t._flatMeta;
|
|
73
|
-
return {
|
|
74
|
-
// @ts-expect-error runtime type
|
|
75
|
-
...t,
|
|
76
|
-
meta: meta2
|
|
77
|
-
};
|
|
78
|
-
}
|
|
79
|
-
});
|
|
80
|
-
}
|
|
81
|
-
|
|
82
|
-
function useServerHead(input, options = {}) {
|
|
83
|
-
const head = options.head || injectHead();
|
|
84
|
-
delete options.head;
|
|
85
|
-
if (head)
|
|
86
|
-
return head.push(input, { ...options, mode: "server" });
|
|
87
|
-
}
|
|
88
|
-
|
|
89
|
-
function useServerHeadSafe(input, options = {}) {
|
|
90
|
-
return useHeadSafe(input, { ...options, mode: "server" });
|
|
91
|
-
}
|
|
92
|
-
|
|
93
|
-
function useServerSeoMeta(input, options) {
|
|
94
|
-
return useSeoMeta(input, { ...options, mode: "server" });
|
|
95
|
-
}
|
|
96
|
-
|
|
97
20
|
function registerVueScopeHandlers(script, scope) {
|
|
98
21
|
if (!scope) {
|
|
99
22
|
return;
|
|
@@ -142,4 +65,81 @@ function useScript(_input, _options) {
|
|
|
142
65
|
});
|
|
143
66
|
}
|
|
144
67
|
|
|
68
|
+
function useSeoMeta(input, options) {
|
|
69
|
+
const { title, titleTemplate, ...meta } = input;
|
|
70
|
+
return useHead({
|
|
71
|
+
title,
|
|
72
|
+
titleTemplate,
|
|
73
|
+
// @ts-expect-error runtime type
|
|
74
|
+
_flatMeta: meta
|
|
75
|
+
}, {
|
|
76
|
+
...options,
|
|
77
|
+
transform(t) {
|
|
78
|
+
const meta2 = unpackMeta({ ...t._flatMeta });
|
|
79
|
+
delete t._flatMeta;
|
|
80
|
+
return {
|
|
81
|
+
// @ts-expect-error runtime type
|
|
82
|
+
...t,
|
|
83
|
+
meta: meta2
|
|
84
|
+
};
|
|
85
|
+
}
|
|
86
|
+
});
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
function useServerHead(input, options = {}) {
|
|
90
|
+
const head = options.head || injectHead();
|
|
91
|
+
delete options.head;
|
|
92
|
+
if (head)
|
|
93
|
+
return head.push(input, { ...options, mode: "server" });
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
function useServerHeadSafe(input, options = {}) {
|
|
97
|
+
return useHeadSafe(input, { ...options, mode: "server" });
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
function useServerSeoMeta(input, options) {
|
|
101
|
+
return useSeoMeta(input, { ...options, mode: "server" });
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
const Vue2ProvideUnheadPlugin = (_Vue, head) => {
|
|
105
|
+
_Vue.mixin({
|
|
106
|
+
beforeCreate() {
|
|
107
|
+
const options = this.$options;
|
|
108
|
+
const origProvide = options.provide;
|
|
109
|
+
options.provide = function() {
|
|
110
|
+
let origProvideResult;
|
|
111
|
+
if (typeof origProvide === "function")
|
|
112
|
+
origProvideResult = origProvide.call(this);
|
|
113
|
+
else
|
|
114
|
+
origProvideResult = origProvide || {};
|
|
115
|
+
return {
|
|
116
|
+
...origProvideResult,
|
|
117
|
+
[headSymbol]: head
|
|
118
|
+
};
|
|
119
|
+
};
|
|
120
|
+
}
|
|
121
|
+
});
|
|
122
|
+
};
|
|
123
|
+
|
|
124
|
+
const VueHeadMixin = {
|
|
125
|
+
created() {
|
|
126
|
+
let source = false;
|
|
127
|
+
if (Vue3) {
|
|
128
|
+
const instance = getCurrentInstance();
|
|
129
|
+
if (!instance)
|
|
130
|
+
return;
|
|
131
|
+
const options = instance.type;
|
|
132
|
+
if (!options || !("head" in options))
|
|
133
|
+
return;
|
|
134
|
+
source = typeof options.head === "function" ? () => options.head.call(instance.proxy) : options.head;
|
|
135
|
+
} else {
|
|
136
|
+
const head = this.$options.head;
|
|
137
|
+
if (head) {
|
|
138
|
+
source = typeof head === "function" ? () => head.call(this) : head;
|
|
139
|
+
}
|
|
140
|
+
}
|
|
141
|
+
source && useHead(source);
|
|
142
|
+
}
|
|
143
|
+
};
|
|
144
|
+
|
|
145
145
|
export { Vue2ProvideUnheadPlugin, VueHeadMixin, injectHead, unheadVueComposablesImports, useHead, useHeadSafe, useScript, useSeoMeta, useServerHead, useServerHeadSafe, useServerSeoMeta };
|
package/dist/polyfill.cjs
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
const useHead = require('./shared/vue.
|
|
3
|
+
const useHead = require('./shared/vue.4291651c.cjs');
|
|
4
4
|
require('vue');
|
|
5
|
-
require('./shared/vue.
|
|
5
|
+
require('./shared/vue.10fc9951.cjs');
|
|
6
6
|
require('unhead');
|
|
7
7
|
require('@unhead/shared');
|
|
8
8
|
|
package/dist/polyfill.d.cts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { MergeHead } from '@unhead/schema';
|
|
2
|
-
import { V as VueHeadClient, U as UseHeadInput, b as UseHeadOptions } from './shared/vue.
|
|
2
|
+
import { V as VueHeadClient, U as UseHeadInput, b as UseHeadOptions } from './shared/vue.71760da0.cjs';
|
|
3
3
|
import 'vue';
|
|
4
4
|
|
|
5
5
|
type VueHeadClientPollyFill<T extends MergeHead> = VueHeadClient<T> & {
|
package/dist/polyfill.d.mts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { MergeHead } from '@unhead/schema';
|
|
2
|
-
import { V as VueHeadClient, U as UseHeadInput, b as UseHeadOptions } from './shared/vue.
|
|
2
|
+
import { V as VueHeadClient, U as UseHeadInput, b as UseHeadOptions } from './shared/vue.71760da0.mjs';
|
|
3
3
|
import 'vue';
|
|
4
4
|
|
|
5
5
|
type VueHeadClientPollyFill<T extends MergeHead> = VueHeadClient<T> & {
|
package/dist/polyfill.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { MergeHead } from '@unhead/schema';
|
|
2
|
-
import { V as VueHeadClient, U as UseHeadInput, b as UseHeadOptions } from './shared/vue.
|
|
2
|
+
import { V as VueHeadClient, U as UseHeadInput, b as UseHeadOptions } from './shared/vue.71760da0.js';
|
|
3
3
|
import 'vue';
|
|
4
4
|
|
|
5
5
|
type VueHeadClientPollyFill<T extends MergeHead> = VueHeadClient<T> & {
|
package/dist/polyfill.mjs
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
const vue = require('vue');
|
|
4
3
|
const unhead = require('unhead');
|
|
4
|
+
const vue = require('vue');
|
|
5
5
|
const shared = require('@unhead/shared');
|
|
6
6
|
|
|
7
7
|
const Vue3 = vue.version[0] === "3";
|
|
@@ -10,7 +10,7 @@ function resolveUnref(r) {
|
|
|
10
10
|
return typeof r === "function" ? r() : vue.unref(r);
|
|
11
11
|
}
|
|
12
12
|
function resolveUnrefHeadInput(ref) {
|
|
13
|
-
if (ref instanceof Promise)
|
|
13
|
+
if (ref instanceof Promise || ref instanceof Date || ref instanceof RegExp)
|
|
14
14
|
return ref;
|
|
15
15
|
const root = resolveUnref(ref);
|
|
16
16
|
if (!ref || !root)
|
|
@@ -29,7 +29,7 @@ function resolveUnrefHeadInput(ref) {
|
|
|
29
29
|
}
|
|
30
30
|
resolved[k] = resolveUnrefHeadInput(root[k]);
|
|
31
31
|
}
|
|
32
|
-
return resolved;
|
|
32
|
+
return Object.keys(resolved) ? resolved : root;
|
|
33
33
|
}
|
|
34
34
|
return root;
|
|
35
35
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { version, unref, nextTick, inject } from 'vue';
|
|
2
1
|
import { createServerHead as createServerHead$1, createHead as createHead$1, getActiveHead } from 'unhead';
|
|
2
|
+
import { version, unref, nextTick, inject } from 'vue';
|
|
3
3
|
import { defineHeadPlugin } from '@unhead/shared';
|
|
4
4
|
|
|
5
5
|
const Vue3 = version[0] === "3";
|
|
@@ -8,7 +8,7 @@ function resolveUnref(r) {
|
|
|
8
8
|
return typeof r === "function" ? r() : unref(r);
|
|
9
9
|
}
|
|
10
10
|
function resolveUnrefHeadInput(ref) {
|
|
11
|
-
if (ref instanceof Promise)
|
|
11
|
+
if (ref instanceof Promise || ref instanceof Date || ref instanceof RegExp)
|
|
12
12
|
return ref;
|
|
13
13
|
const root = resolveUnref(ref);
|
|
14
14
|
if (!ref || !root)
|
|
@@ -27,7 +27,7 @@ function resolveUnrefHeadInput(ref) {
|
|
|
27
27
|
}
|
|
28
28
|
resolved[k] = resolveUnrefHeadInput(root[k]);
|
|
29
29
|
}
|
|
30
|
-
return resolved;
|
|
30
|
+
return Object.keys(resolved) ? resolved : root;
|
|
31
31
|
}
|
|
32
32
|
return root;
|
|
33
33
|
}
|
|
@@ -3,12 +3,16 @@ import { ComputedRef, Ref, Plugin } from 'vue';
|
|
|
3
3
|
|
|
4
4
|
type MaybeReadonlyRef<T> = (() => T) | ComputedRef<T>;
|
|
5
5
|
type MaybeComputedRef<T> = T | MaybeReadonlyRef<T> | Ref<T>;
|
|
6
|
-
type
|
|
6
|
+
type MaybeComputedRefOrFalsy<T> = undefined | false | null | T | MaybeReadonlyRef<T> | Ref<T>;
|
|
7
|
+
/**
|
|
8
|
+
* @deprecated Use MaybeComputedRefOrFalsy
|
|
9
|
+
*/
|
|
10
|
+
type MaybeComputedRefOrPromise<T> = MaybeComputedRefOrFalsy<T>;
|
|
7
11
|
type MaybeComputedRefEntries<T> = MaybeComputedRef<T> | {
|
|
8
|
-
[key in keyof T]?:
|
|
12
|
+
[key in keyof T]?: MaybeComputedRefOrFalsy<T[key]>;
|
|
9
13
|
};
|
|
10
14
|
type MaybeComputedRefEntriesOnly<T> = {
|
|
11
|
-
[key in keyof T]?:
|
|
15
|
+
[key in keyof T]?: MaybeComputedRefOrFalsy<T[key]>;
|
|
12
16
|
};
|
|
13
17
|
|
|
14
18
|
interface HtmlAttr extends Omit<BaseHtmlAttr, 'class'> {
|
|
@@ -50,7 +54,7 @@ interface ReactiveHead<E extends MergeHead = MergeHead> {
|
|
|
50
54
|
*
|
|
51
55
|
* @see https://developer.mozilla.org/en-US/docs/Web/HTML/Element/title
|
|
52
56
|
*/
|
|
53
|
-
title?: Title
|
|
57
|
+
title?: Title;
|
|
54
58
|
/**
|
|
55
59
|
* Generate the title from a template.
|
|
56
60
|
*/
|
|
@@ -125,4 +129,4 @@ type UseSeoMetaInput = MaybeComputedRefEntriesOnly<MetaFlatInput> & {
|
|
|
125
129
|
};
|
|
126
130
|
type VueHeadClient<T extends MergeHead> = Unhead<MaybeComputedRef<ReactiveHead<T>>> & Plugin;
|
|
127
131
|
|
|
128
|
-
export type { BodyAttr as B, HtmlAttr as H, Link as L, MaybeComputedRefEntries as M, Noscript as N, ReactiveHead as R, Style as S, Title as T, UseHeadInput as U, VueHeadClient as V, MaybeComputedRef as a, UseHeadOptions as b,
|
|
132
|
+
export type { BodyAttr as B, HtmlAttr as H, Link as L, MaybeComputedRefEntries as M, Noscript as N, ReactiveHead as R, Style as S, Title as T, UseHeadInput as U, VueHeadClient as V, MaybeComputedRef as a, UseHeadOptions as b, MaybeComputedRefEntriesOnly as c, UseSeoMetaInput as d, TitleTemplate as e, Base as f, Meta as g, Script as h, HtmlAttributes as i, BodyAttributes as j, MaybeReadonlyRef as k, MaybeComputedRefOrFalsy as l, MaybeComputedRefOrPromise as m };
|
|
@@ -3,12 +3,16 @@ import { ComputedRef, Ref, Plugin } from 'vue';
|
|
|
3
3
|
|
|
4
4
|
type MaybeReadonlyRef<T> = (() => T) | ComputedRef<T>;
|
|
5
5
|
type MaybeComputedRef<T> = T | MaybeReadonlyRef<T> | Ref<T>;
|
|
6
|
-
type
|
|
6
|
+
type MaybeComputedRefOrFalsy<T> = undefined | false | null | T | MaybeReadonlyRef<T> | Ref<T>;
|
|
7
|
+
/**
|
|
8
|
+
* @deprecated Use MaybeComputedRefOrFalsy
|
|
9
|
+
*/
|
|
10
|
+
type MaybeComputedRefOrPromise<T> = MaybeComputedRefOrFalsy<T>;
|
|
7
11
|
type MaybeComputedRefEntries<T> = MaybeComputedRef<T> | {
|
|
8
|
-
[key in keyof T]?:
|
|
12
|
+
[key in keyof T]?: MaybeComputedRefOrFalsy<T[key]>;
|
|
9
13
|
};
|
|
10
14
|
type MaybeComputedRefEntriesOnly<T> = {
|
|
11
|
-
[key in keyof T]?:
|
|
15
|
+
[key in keyof T]?: MaybeComputedRefOrFalsy<T[key]>;
|
|
12
16
|
};
|
|
13
17
|
|
|
14
18
|
interface HtmlAttr extends Omit<BaseHtmlAttr, 'class'> {
|
|
@@ -50,7 +54,7 @@ interface ReactiveHead<E extends MergeHead = MergeHead> {
|
|
|
50
54
|
*
|
|
51
55
|
* @see https://developer.mozilla.org/en-US/docs/Web/HTML/Element/title
|
|
52
56
|
*/
|
|
53
|
-
title?: Title
|
|
57
|
+
title?: Title;
|
|
54
58
|
/**
|
|
55
59
|
* Generate the title from a template.
|
|
56
60
|
*/
|
|
@@ -125,4 +129,4 @@ type UseSeoMetaInput = MaybeComputedRefEntriesOnly<MetaFlatInput> & {
|
|
|
125
129
|
};
|
|
126
130
|
type VueHeadClient<T extends MergeHead> = Unhead<MaybeComputedRef<ReactiveHead<T>>> & Plugin;
|
|
127
131
|
|
|
128
|
-
export type { BodyAttr as B, HtmlAttr as H, Link as L, MaybeComputedRefEntries as M, Noscript as N, ReactiveHead as R, Style as S, Title as T, UseHeadInput as U, VueHeadClient as V, MaybeComputedRef as a, UseHeadOptions as b,
|
|
132
|
+
export type { BodyAttr as B, HtmlAttr as H, Link as L, MaybeComputedRefEntries as M, Noscript as N, ReactiveHead as R, Style as S, Title as T, UseHeadInput as U, VueHeadClient as V, MaybeComputedRef as a, UseHeadOptions as b, MaybeComputedRefEntriesOnly as c, UseSeoMetaInput as d, TitleTemplate as e, Base as f, Meta as g, Script as h, HtmlAttributes as i, BodyAttributes as j, MaybeReadonlyRef as k, MaybeComputedRefOrFalsy as l, MaybeComputedRefOrPromise as m };
|
|
@@ -3,12 +3,16 @@ import { ComputedRef, Ref, Plugin } from 'vue';
|
|
|
3
3
|
|
|
4
4
|
type MaybeReadonlyRef<T> = (() => T) | ComputedRef<T>;
|
|
5
5
|
type MaybeComputedRef<T> = T | MaybeReadonlyRef<T> | Ref<T>;
|
|
6
|
-
type
|
|
6
|
+
type MaybeComputedRefOrFalsy<T> = undefined | false | null | T | MaybeReadonlyRef<T> | Ref<T>;
|
|
7
|
+
/**
|
|
8
|
+
* @deprecated Use MaybeComputedRefOrFalsy
|
|
9
|
+
*/
|
|
10
|
+
type MaybeComputedRefOrPromise<T> = MaybeComputedRefOrFalsy<T>;
|
|
7
11
|
type MaybeComputedRefEntries<T> = MaybeComputedRef<T> | {
|
|
8
|
-
[key in keyof T]?:
|
|
12
|
+
[key in keyof T]?: MaybeComputedRefOrFalsy<T[key]>;
|
|
9
13
|
};
|
|
10
14
|
type MaybeComputedRefEntriesOnly<T> = {
|
|
11
|
-
[key in keyof T]?:
|
|
15
|
+
[key in keyof T]?: MaybeComputedRefOrFalsy<T[key]>;
|
|
12
16
|
};
|
|
13
17
|
|
|
14
18
|
interface HtmlAttr extends Omit<BaseHtmlAttr, 'class'> {
|
|
@@ -50,7 +54,7 @@ interface ReactiveHead<E extends MergeHead = MergeHead> {
|
|
|
50
54
|
*
|
|
51
55
|
* @see https://developer.mozilla.org/en-US/docs/Web/HTML/Element/title
|
|
52
56
|
*/
|
|
53
|
-
title?: Title
|
|
57
|
+
title?: Title;
|
|
54
58
|
/**
|
|
55
59
|
* Generate the title from a template.
|
|
56
60
|
*/
|
|
@@ -125,4 +129,4 @@ type UseSeoMetaInput = MaybeComputedRefEntriesOnly<MetaFlatInput> & {
|
|
|
125
129
|
};
|
|
126
130
|
type VueHeadClient<T extends MergeHead> = Unhead<MaybeComputedRef<ReactiveHead<T>>> & Plugin;
|
|
127
131
|
|
|
128
|
-
export type { BodyAttr as B, HtmlAttr as H, Link as L, MaybeComputedRefEntries as M, Noscript as N, ReactiveHead as R, Style as S, Title as T, UseHeadInput as U, VueHeadClient as V, MaybeComputedRef as a, UseHeadOptions as b,
|
|
132
|
+
export type { BodyAttr as B, HtmlAttr as H, Link as L, MaybeComputedRefEntries as M, Noscript as N, ReactiveHead as R, Style as S, Title as T, UseHeadInput as U, VueHeadClient as V, MaybeComputedRef as a, UseHeadOptions as b, MaybeComputedRefEntriesOnly as c, UseSeoMetaInput as d, TitleTemplate as e, Base as f, Meta as g, Script as h, HtmlAttributes as i, BodyAttributes as j, MaybeReadonlyRef as k, MaybeComputedRefOrFalsy as l, MaybeComputedRefOrPromise as m };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { ref, watchEffect, watch, getCurrentInstance, onBeforeUnmount, onDeactivated, onActivated } from 'vue';
|
|
2
|
-
import { i as injectHead, r as resolveUnrefHeadInput } from './vue.
|
|
2
|
+
import { i as injectHead, r as resolveUnrefHeadInput } from './vue.538dba42.mjs';
|
|
3
3
|
|
|
4
4
|
function useHead(input, options = {}) {
|
|
5
5
|
const head = options.head || injectHead();
|
package/dist/vue2.cjs
CHANGED
|
@@ -1,12 +1,22 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
+
const defu = require('defu');
|
|
3
4
|
const vue = require('vue');
|
|
4
|
-
const
|
|
5
|
-
const
|
|
5
|
+
const useHead = require('./shared/vue.4291651c.cjs');
|
|
6
|
+
const injectHead = require('./shared/vue.10fc9951.cjs');
|
|
6
7
|
require('unhead');
|
|
7
8
|
require('@unhead/shared');
|
|
8
9
|
|
|
9
10
|
const UnheadPlugin = (_Vue) => {
|
|
11
|
+
_Vue.config.optionMergeStrategies.head = function(toVal, fromVal) {
|
|
12
|
+
if (typeof toVal === "function") {
|
|
13
|
+
toVal = toVal();
|
|
14
|
+
}
|
|
15
|
+
if (typeof fromVal === "function") {
|
|
16
|
+
fromVal = fromVal();
|
|
17
|
+
}
|
|
18
|
+
return defu.defu(toVal, fromVal);
|
|
19
|
+
};
|
|
10
20
|
_Vue.mixin({
|
|
11
21
|
created() {
|
|
12
22
|
let source = false;
|
|
@@ -24,7 +34,9 @@ const UnheadPlugin = (_Vue) => {
|
|
|
24
34
|
source = typeof head === "function" ? () => head.call(this) : head;
|
|
25
35
|
}
|
|
26
36
|
}
|
|
27
|
-
|
|
37
|
+
if (source) {
|
|
38
|
+
useHead.useHead(source);
|
|
39
|
+
}
|
|
28
40
|
},
|
|
29
41
|
beforeCreate() {
|
|
30
42
|
const options = this.$options;
|
package/dist/vue2.mjs
CHANGED
|
@@ -1,10 +1,20 @@
|
|
|
1
|
+
import { defu } from 'defu';
|
|
1
2
|
import { getCurrentInstance } from 'vue';
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
3
|
+
import { u as useHead } from './shared/vue.fed13688.mjs';
|
|
4
|
+
import { V as Vue3, h as headSymbol } from './shared/vue.538dba42.mjs';
|
|
4
5
|
import 'unhead';
|
|
5
6
|
import '@unhead/shared';
|
|
6
7
|
|
|
7
8
|
const UnheadPlugin = (_Vue) => {
|
|
9
|
+
_Vue.config.optionMergeStrategies.head = function(toVal, fromVal) {
|
|
10
|
+
if (typeof toVal === "function") {
|
|
11
|
+
toVal = toVal();
|
|
12
|
+
}
|
|
13
|
+
if (typeof fromVal === "function") {
|
|
14
|
+
fromVal = fromVal();
|
|
15
|
+
}
|
|
16
|
+
return defu(toVal, fromVal);
|
|
17
|
+
};
|
|
8
18
|
_Vue.mixin({
|
|
9
19
|
created() {
|
|
10
20
|
let source = false;
|
|
@@ -22,7 +32,9 @@ const UnheadPlugin = (_Vue) => {
|
|
|
22
32
|
source = typeof head === "function" ? () => head.call(this) : head;
|
|
23
33
|
}
|
|
24
34
|
}
|
|
25
|
-
|
|
35
|
+
if (source) {
|
|
36
|
+
useHead(source);
|
|
37
|
+
}
|
|
26
38
|
},
|
|
27
39
|
beforeCreate() {
|
|
28
40
|
const options = this.$options;
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@unhead/vue",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "1.
|
|
4
|
+
"version": "1.11.0-beta.2",
|
|
5
5
|
"author": "Harlan Wilton <harlan@harlanzw.com>",
|
|
6
6
|
"license": "MIT",
|
|
7
7
|
"funding": "https://github.com/sponsors/harlan-zw",
|
|
@@ -65,10 +65,11 @@
|
|
|
65
65
|
]
|
|
66
66
|
},
|
|
67
67
|
"dependencies": {
|
|
68
|
+
"defu": "^6.1.4",
|
|
68
69
|
"hookable": "^5.5.3",
|
|
69
|
-
"@unhead/schema": "1.
|
|
70
|
-
"unhead": "1.
|
|
71
|
-
"@unhead/shared": "1.
|
|
70
|
+
"@unhead/schema": "1.11.0-beta.2",
|
|
71
|
+
"unhead": "1.11.0-beta.2",
|
|
72
|
+
"@unhead/shared": "1.11.0-beta.2"
|
|
72
73
|
},
|
|
73
74
|
"scripts": {
|
|
74
75
|
"build": "unbuild .",
|