@unhead/vue 1.0.21 → 1.1.0
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 +63 -964
- package/dist/index.d.ts +118 -39
- package/dist/index.mjs +49 -951
- package/package.json +9 -8
package/dist/index.d.ts
CHANGED
|
@@ -1,16 +1,9 @@
|
|
|
1
|
+
export { createHeadCore } from 'unhead';
|
|
1
2
|
import * as _unhead_schema from '@unhead/schema';
|
|
2
|
-
import {
|
|
3
|
+
import { BaseHtmlAttr, MaybeArray, BaseBodyAttr, Title as Title$1, TitleTemplate as TitleTemplate$1, EntryAugmentation, Base as Base$1, Link as Link$1, Meta as Meta$1, Style as Style$1, Script as Script$1, Noscript as Noscript$1, DataKeys, SchemaAugmentations, DefinedValueOrEmptyObject, MaybeFunctionEntries, BodyEvents, MergeHead, SafeMeta, SafeLink, SafeNoscript, SafeScript, SafeHtmlAttr, SafeBodyAttr, Unhead, CreateHeadOptions, HeadEntryOptions, ActiveHeadEntry, MetaFlatInput } from '@unhead/schema';
|
|
3
4
|
export { ActiveHeadEntry, Head, HeadEntryOptions, HeadTag, MergeHead, Unhead } from '@unhead/schema';
|
|
4
5
|
import { ComputedRef, Ref, Plugin } from 'vue';
|
|
5
6
|
|
|
6
|
-
/**
|
|
7
|
-
* Creates a core instance of unhead. Does not provide a global ctx for composables to work
|
|
8
|
-
* and does not register DOM plugins.
|
|
9
|
-
*
|
|
10
|
-
* @param options
|
|
11
|
-
*/
|
|
12
|
-
declare function createHeadCore<T extends {} = Head>(options?: CreateHeadOptions): Unhead<T>;
|
|
13
|
-
|
|
14
7
|
type MaybeReadonlyRef<T> = (() => T) | ComputedRef<T>;
|
|
15
8
|
type MaybeComputedRef<T> = T | MaybeReadonlyRef<T> | Ref<T>;
|
|
16
9
|
type MaybeComputedRefOrPromise<T> = T | MaybeReadonlyRef<T> | Ref<T> | Promise<T>;
|
|
@@ -57,6 +50,10 @@ interface ReactiveHead<E extends MergeHead = MergeHead> {
|
|
|
57
50
|
* Generate the title from a template.
|
|
58
51
|
*/
|
|
59
52
|
titleTemplate?: TitleTemplate;
|
|
53
|
+
/**
|
|
54
|
+
* Variables used to substitute in the title and meta content.
|
|
55
|
+
*/
|
|
56
|
+
templateParams?: MaybeComputedRefEntries<Record<string, string>>;
|
|
60
57
|
/**
|
|
61
58
|
* The <base> HTML element specifies the base URL to use for all relative URLs in a document.
|
|
62
59
|
* There can be only one <base> element in a document.
|
|
@@ -84,20 +81,20 @@ interface ReactiveHead<E extends MergeHead = MergeHead> {
|
|
|
84
81
|
*
|
|
85
82
|
* @see https://developer.mozilla.org/en-US/docs/Web/HTML/Element/style
|
|
86
83
|
*/
|
|
87
|
-
style?: MaybeComputedRef<Style<E['style']>[]>;
|
|
84
|
+
style?: MaybeComputedRef<(Style<E['style']> | string)[]>;
|
|
88
85
|
/**
|
|
89
86
|
* The <script> HTML element is used to embed executable code or data; this is typically used to embed or refer to JavaScript code.
|
|
90
87
|
*
|
|
91
88
|
* @see https://developer.mozilla.org/en-US/docs/Web/HTML/Element/script
|
|
92
89
|
*/
|
|
93
|
-
script?: MaybeComputedRef<Script<E['script']>[]>;
|
|
90
|
+
script?: MaybeComputedRef<(Script<E['script']> | string)[]>;
|
|
94
91
|
/**
|
|
95
92
|
* The <noscript> HTML element defines a section of HTML to be inserted if a script type on the page is unsupported
|
|
96
93
|
* or if scripting is currently turned off in the browser.
|
|
97
94
|
*
|
|
98
95
|
* @see https://developer.mozilla.org/en-US/docs/Web/HTML/Element/noscript
|
|
99
96
|
*/
|
|
100
|
-
noscript?: MaybeComputedRef<Noscript<E['noscript']>[]>;
|
|
97
|
+
noscript?: MaybeComputedRef<(Noscript<E['noscript']> | string)[]>;
|
|
101
98
|
/**
|
|
102
99
|
* Attributes for the <html> HTML element.
|
|
103
100
|
*
|
|
@@ -113,8 +110,17 @@ interface ReactiveHead<E extends MergeHead = MergeHead> {
|
|
|
113
110
|
}
|
|
114
111
|
type UseHeadInput<T extends MergeHead = {}> = MaybeComputedRef<ReactiveHead<T>>;
|
|
115
112
|
|
|
113
|
+
interface HeadSafe extends Pick<ReactiveHead, 'title' | 'titleTemplate' | 'templateParams'> {
|
|
114
|
+
meta?: MaybeComputedRefEntries<SafeMeta>[];
|
|
115
|
+
link?: MaybeComputedRefEntries<SafeLink>[];
|
|
116
|
+
noscript?: MaybeComputedRefEntries<SafeNoscript>[];
|
|
117
|
+
script?: MaybeComputedRefEntries<SafeScript>[];
|
|
118
|
+
htmlAttrs?: MaybeComputedRefEntries<SafeHtmlAttr>;
|
|
119
|
+
bodyAttrs?: MaybeComputedRefEntries<SafeBodyAttr>;
|
|
120
|
+
}
|
|
121
|
+
type UseHeadSafeInput = MaybeComputedRef<HeadSafe>;
|
|
122
|
+
|
|
116
123
|
declare function resolveUnrefHeadInput(ref: any, lastKey?: string | number): any;
|
|
117
|
-
declare function asArray<T>(value: Arrayable<T>): T[];
|
|
118
124
|
|
|
119
125
|
type VueHeadClient<T extends MergeHead> = Unhead<MaybeComputedRef<ReactiveHead<T>>> & Plugin;
|
|
120
126
|
declare const headSymbol = "usehead";
|
|
@@ -129,40 +135,113 @@ declare const VueReactiveUseHeadPlugin: () => _unhead_schema.HeadPlugin;
|
|
|
129
135
|
|
|
130
136
|
declare const Vue2ProvideUnheadPlugin: Plugin;
|
|
131
137
|
|
|
132
|
-
declare function
|
|
133
|
-
|
|
134
|
-
declare
|
|
135
|
-
declare const useServerTagMeta: (meta: Arrayable<Meta>) => void | _unhead_schema.ActiveHeadEntry<UseHeadInput<MergeHead>>;
|
|
136
|
-
declare const useServerTagMetaFlat: (meta: MaybeComputedRefEntries<MetaFlatInput>) => void | _unhead_schema.ActiveHeadEntry<UseHeadInput<MergeHead>>;
|
|
137
|
-
declare const useServerTagLink: (link: Arrayable<Link>) => void | _unhead_schema.ActiveHeadEntry<UseHeadInput<MergeHead>>;
|
|
138
|
-
declare const useServerTagScript: (script: Arrayable<Script>) => void | _unhead_schema.ActiveHeadEntry<UseHeadInput<MergeHead>>;
|
|
139
|
-
declare const useServerTagStyle: (style: Arrayable<Style>) => void | _unhead_schema.ActiveHeadEntry<UseHeadInput<MergeHead>>;
|
|
140
|
-
declare const useServerTagNoscript: (noscript: Arrayable<Noscript>) => void | _unhead_schema.ActiveHeadEntry<UseHeadInput<MergeHead>>;
|
|
141
|
-
declare const useServerTagBase: (base: ReactiveHead['base']) => void | _unhead_schema.ActiveHeadEntry<UseHeadInput<MergeHead>>;
|
|
142
|
-
declare const useServerHtmlAttrs: (attrs: ReactiveHead['htmlAttrs']) => void | _unhead_schema.ActiveHeadEntry<UseHeadInput<MergeHead>>;
|
|
143
|
-
declare const useServerBodyAttrs: (attrs: ReactiveHead['bodyAttrs']) => void | _unhead_schema.ActiveHeadEntry<UseHeadInput<MergeHead>>;
|
|
138
|
+
declare function useHead<T extends MergeHead>(input: UseHeadInput<T>, options?: HeadEntryOptions): ActiveHeadEntry<UseHeadInput<T>> | void;
|
|
139
|
+
|
|
140
|
+
declare function useHeadSafe(input: UseHeadSafeInput, options?: HeadEntryOptions): ActiveHeadEntry<UseHeadSafeInput> | void;
|
|
144
141
|
|
|
145
142
|
type UseSeoMetaInput = MaybeComputedRefEntries<MetaFlatInput> & {
|
|
146
143
|
title?: ReactiveHead['title'];
|
|
147
144
|
titleTemplate?: ReactiveHead['titleTemplate'];
|
|
148
145
|
};
|
|
149
|
-
declare const useSeoMeta: (input: UseSeoMetaInput) => ActiveHeadEntry<any> | void;
|
|
146
|
+
declare const useSeoMeta: (input: UseSeoMetaInput, options?: HeadEntryOptions) => ActiveHeadEntry<any> | void;
|
|
150
147
|
|
|
151
|
-
declare function
|
|
152
|
-
|
|
153
|
-
declare
|
|
154
|
-
|
|
155
|
-
declare
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
declare const
|
|
161
|
-
|
|
162
|
-
|
|
148
|
+
declare function useServerHead<T extends MergeHead>(input: UseHeadInput<T>, options?: HeadEntryOptions): void | _unhead_schema.ActiveHeadEntry<UseHeadInput<T>>;
|
|
149
|
+
|
|
150
|
+
declare function useServerHeadSafe(input: UseHeadSafeInput, options?: HeadEntryOptions): void | _unhead_schema.ActiveHeadEntry<UseHeadSafeInput>;
|
|
151
|
+
|
|
152
|
+
declare function useServerSeoMeta(input: UseSeoMetaInput, options?: HeadEntryOptions): ActiveHeadEntry<any> | void;
|
|
153
|
+
|
|
154
|
+
/**
|
|
155
|
+
* @deprecated Use `useHead`
|
|
156
|
+
*/
|
|
157
|
+
declare const useTagTitle: (title: ReactiveHead['title']) => ActiveHeadEntry<any> | void;
|
|
158
|
+
/**
|
|
159
|
+
* @deprecated Use `useHead`
|
|
160
|
+
*/
|
|
161
|
+
declare const useTitleTemplate: (titleTemplate: ReactiveHead['titleTemplate']) => ActiveHeadEntry<any> | void;
|
|
162
|
+
/**
|
|
163
|
+
* @deprecated Use `useHead`
|
|
164
|
+
*/
|
|
165
|
+
declare const useTagMeta: (meta: Arrayable<Meta>) => ActiveHeadEntry<any> | void;
|
|
166
|
+
/**
|
|
167
|
+
* @deprecated Use `useHead`
|
|
168
|
+
*/
|
|
169
|
+
declare const useTagMetaFlat: (meta: MaybeComputedRefEntries<MetaFlatInput>) => ActiveHeadEntry<any> | void;
|
|
170
|
+
/**
|
|
171
|
+
* @deprecated Use `useHead`
|
|
172
|
+
*/
|
|
173
|
+
declare const useTagLink: (link: Arrayable<Link>) => ActiveHeadEntry<any> | void;
|
|
174
|
+
/**
|
|
175
|
+
* @deprecated Use `useHead`
|
|
176
|
+
*/
|
|
177
|
+
declare const useTagScript: (script: Arrayable<Script>) => ActiveHeadEntry<any> | void;
|
|
178
|
+
/**
|
|
179
|
+
* @deprecated Use `useHead`
|
|
180
|
+
*/
|
|
181
|
+
declare const useTagStyle: (style: Arrayable<Style>) => ActiveHeadEntry<any> | void;
|
|
182
|
+
/**
|
|
183
|
+
* @deprecated Use `useHead`
|
|
184
|
+
*/
|
|
185
|
+
declare const useTagNoscript: (noscript: Arrayable<Noscript>) => ActiveHeadEntry<any> | void;
|
|
186
|
+
/**
|
|
187
|
+
* @deprecated Use `useHead`
|
|
188
|
+
*/
|
|
189
|
+
declare const useTagBase: (base: ReactiveHead['base']) => ActiveHeadEntry<any> | void;
|
|
190
|
+
/**
|
|
191
|
+
* @deprecated Use `useHead`
|
|
192
|
+
*/
|
|
193
|
+
declare const useHtmlAttrs: (attrs: ReactiveHead['htmlAttrs']) => ActiveHeadEntry<any> | void;
|
|
194
|
+
/**
|
|
195
|
+
* @deprecated Use `useHead`
|
|
196
|
+
*/
|
|
197
|
+
declare const useBodyAttrs: (attrs: ReactiveHead['bodyAttrs']) => ActiveHeadEntry<any> | void;
|
|
198
|
+
/**
|
|
199
|
+
* @deprecated Use `useHead`
|
|
200
|
+
*/
|
|
201
|
+
declare const useServerTagTitle: (title: ReactiveHead['title']) => ActiveHeadEntry<any> | void;
|
|
202
|
+
/**
|
|
203
|
+
* @deprecated Use `useHead`
|
|
204
|
+
*/
|
|
205
|
+
declare const useServerTitleTemplate: (titleTemplate: ReactiveHead['titleTemplate']) => ActiveHeadEntry<any> | void;
|
|
206
|
+
/**
|
|
207
|
+
* @deprecated Use `useHead`
|
|
208
|
+
*/
|
|
209
|
+
declare const useServerTagMeta: (meta: Arrayable<Meta>) => ActiveHeadEntry<any> | void;
|
|
210
|
+
/**
|
|
211
|
+
* @deprecated Use `useHead`
|
|
212
|
+
*/
|
|
213
|
+
declare const useServerTagMetaFlat: (meta: MaybeComputedRefEntries<MetaFlatInput>) => ActiveHeadEntry<any> | void;
|
|
214
|
+
/**
|
|
215
|
+
* @deprecated Use `useHead`
|
|
216
|
+
*/
|
|
217
|
+
declare const useServerTagLink: (link: Arrayable<Link>) => ActiveHeadEntry<any> | void;
|
|
218
|
+
/**
|
|
219
|
+
* @deprecated Use `useHead`
|
|
220
|
+
*/
|
|
221
|
+
declare const useServerTagScript: (script: Arrayable<Script>) => ActiveHeadEntry<any> | void;
|
|
222
|
+
/**
|
|
223
|
+
* @deprecated Use `useHead`
|
|
224
|
+
*/
|
|
225
|
+
declare const useServerTagStyle: (style: Arrayable<Style>) => ActiveHeadEntry<any> | void;
|
|
226
|
+
/**
|
|
227
|
+
* @deprecated Use `useHead`
|
|
228
|
+
*/
|
|
229
|
+
declare const useServerTagNoscript: (noscript: Arrayable<Noscript>) => ActiveHeadEntry<any> | void;
|
|
230
|
+
/**
|
|
231
|
+
* @deprecated Use `useHead`
|
|
232
|
+
*/
|
|
233
|
+
declare const useServerTagBase: (base: ReactiveHead['base']) => ActiveHeadEntry<any> | void;
|
|
234
|
+
/**
|
|
235
|
+
* @deprecated Use `useHead`
|
|
236
|
+
*/
|
|
237
|
+
declare const useServerHtmlAttrs: (attrs: ReactiveHead['htmlAttrs']) => ActiveHeadEntry<any> | void;
|
|
238
|
+
/**
|
|
239
|
+
* @deprecated Use `useHead`
|
|
240
|
+
*/
|
|
241
|
+
declare const useServerBodyAttrs: (attrs: ReactiveHead['bodyAttrs']) => ActiveHeadEntry<any> | void;
|
|
163
242
|
|
|
164
243
|
declare const unheadVueComposablesImports: {
|
|
165
244
|
'@unhead/vue': string[];
|
|
166
245
|
};
|
|
167
246
|
|
|
168
|
-
export { Arrayable, Base, BodyAttributes, HtmlAttributes, Link, MaybeComputedRef, MaybeComputedRefEntries, MaybeComputedRefOrPromise, MaybeReadonlyRef, Meta, Noscript, ReactiveHead, Script, Style, Title, TitleTemplate, UseHeadInput, UseSeoMetaInput, Vue2ProvideUnheadPlugin, VueHeadClient, VueHeadMixin, VueReactiveUseHeadPlugin,
|
|
247
|
+
export { Arrayable, Base, BodyAttr, BodyAttributes, HeadSafe, HtmlAttr, HtmlAttributes, Link, MaybeComputedRef, MaybeComputedRefEntries, MaybeComputedRefOrPromise, MaybeReadonlyRef, Meta, Noscript, ReactiveHead, Script, Style, Title, TitleTemplate, UseHeadInput, UseHeadSafeInput, UseSeoMetaInput, Vue2ProvideUnheadPlugin, VueHeadClient, VueHeadMixin, VueReactiveUseHeadPlugin, createHead, headSymbol, injectHead, resolveUnrefHeadInput, unheadVueComposablesImports, useBodyAttrs, useHead, useHeadSafe, useHtmlAttrs, useSeoMeta, useServerBodyAttrs, useServerHead, useServerHeadSafe, useServerHtmlAttrs, useServerSeoMeta, useServerTagBase, useServerTagLink, useServerTagMeta, useServerTagMetaFlat, useServerTagNoscript, useServerTagScript, useServerTagStyle, useServerTagTitle, useServerTitleTemplate, useTagBase, useTagLink, useTagMeta, useTagMetaFlat, useTagNoscript, useTagScript, useTagStyle, useTagTitle, useTitleTemplate };
|