@unhead/vue 2.0.0-alpha.12 → 2.0.0-alpha.14
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/client.mjs +3 -2
- package/dist/components.mjs +2 -1
- package/dist/index.d.mts +3 -1
- package/dist/index.d.ts +3 -1
- package/dist/index.mjs +4 -2
- package/dist/legacy.mjs +5 -5
- package/dist/plugins.d.mts +0 -1
- package/dist/plugins.d.ts +0 -1
- package/dist/server.mjs +3 -2
- package/dist/shared/{vue.BOii_fac.mjs → vue.Ci2RuXYj.mjs} +1 -1
- package/dist/shared/vue.CkLIG7eN.mjs +7 -0
- package/dist/shared/{vue.0vTsLwbU.mjs → vue.pWToN6_t.mjs} +3 -6
- package/dist/types.d.mts +82 -26
- package/dist/types.d.ts +82 -26
- package/dist/utils.d.mts +10 -0
- package/dist/utils.d.ts +10 -0
- package/dist/utils.mjs +9 -0
- package/package.json +3 -3
package/dist/client.mjs
CHANGED
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
import { createHead as createHead$1, createDebouncedFn, renderDOMHead } from 'unhead/client';
|
|
2
2
|
export { renderDOMHead } from 'unhead/client';
|
|
3
3
|
import { nextTick } from 'vue';
|
|
4
|
-
import { v as vueInstall } from './shared/vue.
|
|
5
|
-
export { V as VueHeadMixin } from './shared/vue.
|
|
4
|
+
import { v as vueInstall } from './shared/vue.pWToN6_t.mjs';
|
|
5
|
+
export { V as VueHeadMixin } from './shared/vue.Ci2RuXYj.mjs';
|
|
6
6
|
import 'unhead/plugins';
|
|
7
7
|
import 'unhead/utils';
|
|
8
|
+
import './shared/vue.CkLIG7eN.mjs';
|
|
8
9
|
|
|
9
10
|
function createHead(options = {}) {
|
|
10
11
|
const head = createHead$1({
|
package/dist/components.mjs
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import { defineComponent, ref, onBeforeUnmount, watchEffect } from 'vue';
|
|
2
|
-
import { u as useHead } from './shared/vue.
|
|
2
|
+
import { u as useHead } from './shared/vue.pWToN6_t.mjs';
|
|
3
3
|
import 'unhead/plugins';
|
|
4
4
|
import 'unhead/utils';
|
|
5
|
+
import './shared/vue.CkLIG7eN.mjs';
|
|
5
6
|
|
|
6
7
|
function addVNodeToHeadObj(node, obj) {
|
|
7
8
|
const nodeType = node.type;
|
package/dist/index.d.mts
CHANGED
|
@@ -2,9 +2,11 @@ export { createHeadCore } from 'unhead';
|
|
|
2
2
|
import { MergeHead, ActiveHeadEntry } from 'unhead/types';
|
|
3
3
|
export { ActiveHeadEntry, Head, HeadEntryOptions, HeadTag, MergeHead, RenderSSRHeadOptions, ResolvedBase, ResolvedBodyAttributes, ResolvedHead, ResolvedHtmlAttributes, ResolvedLink, ResolvedMeta, ResolvedNoscript, ResolvedScript, ResolvedStyle, ResolvedTitle, ResolvedTitleTemplate, Unhead } from 'unhead/types';
|
|
4
4
|
import { VueHeadClient, UseHeadInput, UseHeadOptions, UseHeadSafeInput, UseSeoMetaInput } from './types.mjs';
|
|
5
|
-
export { Base, BodyAttr, BodyAttributes, HeadSafe, HtmlAttr, HtmlAttributes, Link,
|
|
5
|
+
export { Base, BodyAttr, BodyAttributes, HeadSafe, HtmlAttr, HtmlAttributes, Link, MaybeFalsey, Meta, Noscript, ReactiveHead, ResolvableArray, ResolvableProperties, ResolvableValue, SafeBodyAttr, SafeHtmlAttr, SafeLink, SafeMeta, SafeNoscript, SafeScript, SafeStyle, Script, Style, Title, TitleTemplate } from './types.mjs';
|
|
6
|
+
export { resolveUnrefHeadInput } from './utils.mjs';
|
|
6
7
|
export { V as VueHeadMixin } from './shared/vue.DnywREVF.mjs';
|
|
7
8
|
import 'vue';
|
|
9
|
+
import 'unhead/utils';
|
|
8
10
|
|
|
9
11
|
declare const unheadVueComposablesImports: {
|
|
10
12
|
'@unhead/vue': string[];
|
package/dist/index.d.ts
CHANGED
|
@@ -2,9 +2,11 @@ export { createHeadCore } from 'unhead';
|
|
|
2
2
|
import { MergeHead, ActiveHeadEntry } from 'unhead/types';
|
|
3
3
|
export { ActiveHeadEntry, Head, HeadEntryOptions, HeadTag, MergeHead, RenderSSRHeadOptions, ResolvedBase, ResolvedBodyAttributes, ResolvedHead, ResolvedHtmlAttributes, ResolvedLink, ResolvedMeta, ResolvedNoscript, ResolvedScript, ResolvedStyle, ResolvedTitle, ResolvedTitleTemplate, Unhead } from 'unhead/types';
|
|
4
4
|
import { VueHeadClient, UseHeadInput, UseHeadOptions, UseHeadSafeInput, UseSeoMetaInput } from './types.js';
|
|
5
|
-
export { Base, BodyAttr, BodyAttributes, HeadSafe, HtmlAttr, HtmlAttributes, Link,
|
|
5
|
+
export { Base, BodyAttr, BodyAttributes, HeadSafe, HtmlAttr, HtmlAttributes, Link, MaybeFalsey, Meta, Noscript, ReactiveHead, ResolvableArray, ResolvableProperties, ResolvableValue, SafeBodyAttr, SafeHtmlAttr, SafeLink, SafeMeta, SafeNoscript, SafeScript, SafeStyle, Script, Style, Title, TitleTemplate } from './types.js';
|
|
6
|
+
export { resolveUnrefHeadInput } from './utils.js';
|
|
6
7
|
export { V as VueHeadMixin } from './shared/vue.DnywREVF.js';
|
|
7
8
|
import 'vue';
|
|
9
|
+
import 'unhead/utils';
|
|
8
10
|
|
|
9
11
|
declare const unheadVueComposablesImports: {
|
|
10
12
|
'@unhead/vue': string[];
|
package/dist/index.mjs
CHANGED
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
export { createHeadCore } from 'unhead';
|
|
2
|
-
export { h as headSymbol, i as injectHead, u as useHead, a as useHeadSafe, b as useSeoMeta, c as useServerHead, d as useServerHeadSafe, e as useServerSeoMeta } from './shared/vue.
|
|
3
|
-
export {
|
|
2
|
+
export { h as headSymbol, i as injectHead, u as useHead, a as useHeadSafe, b as useSeoMeta, c as useServerHead, d as useServerHeadSafe, e as useServerSeoMeta } from './shared/vue.pWToN6_t.mjs';
|
|
3
|
+
export { resolveUnrefHeadInput } from './utils.mjs';
|
|
4
|
+
export { V as VueHeadMixin } from './shared/vue.Ci2RuXYj.mjs';
|
|
4
5
|
import 'unhead/plugins';
|
|
5
6
|
import 'unhead/utils';
|
|
6
7
|
import 'vue';
|
|
8
|
+
import './shared/vue.CkLIG7eN.mjs';
|
|
7
9
|
|
|
8
10
|
const unheadVueComposablesImports = {
|
|
9
11
|
"@unhead/vue": ["injectHead", "useHead", "useSeoMeta", "useHeadSafe", "useServerHead", "useServerSeoMeta", "useServerHeadSafe"]
|
package/dist/legacy.mjs
CHANGED
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
export { createHeadCore } from 'unhead';
|
|
2
|
-
import { DeprecationsPlugin, PromisesPlugin, TemplateParamsPlugin, AliasSortingPlugin, SafeInputPlugin, FlatMetaPlugin } from 'unhead/plugins';
|
|
3
|
-
import { defineHeadPlugin } from 'unhead/utils';
|
|
4
|
-
import { walkResolver } from 'unhead/utils/walkResolver';
|
|
5
2
|
import { getCurrentInstance, onMounted, isRef, watch, onScopeDispose, ref, inject, watchEffect, unref, onBeforeUnmount, onDeactivated, onActivated } from 'vue';
|
|
6
3
|
import { createHead as createHead$1 } from './client.mjs';
|
|
7
|
-
import {
|
|
4
|
+
import { h as headSymbol } from './shared/vue.pWToN6_t.mjs';
|
|
5
|
+
import { V as VueResolver } from './shared/vue.CkLIG7eN.mjs';
|
|
8
6
|
import { createHead as createHead$2 } from './server.mjs';
|
|
9
7
|
import { useScript as useScript$1 } from 'unhead/legacy';
|
|
10
8
|
export { resolveScriptKey } from 'unhead/legacy';
|
|
9
|
+
import { walkResolver, defineHeadPlugin } from 'unhead/utils';
|
|
10
|
+
import { DeprecationsPlugin, PromisesPlugin, TemplateParamsPlugin, AliasSortingPlugin, SafeInputPlugin, FlatMetaPlugin } from 'unhead/plugins';
|
|
11
11
|
import 'unhead/client';
|
|
12
|
-
import './shared/vue.
|
|
12
|
+
import './shared/vue.Ci2RuXYj.mjs';
|
|
13
13
|
import 'unhead/server';
|
|
14
14
|
|
|
15
15
|
function registerVueScopeHandlers(script, scope) {
|
package/dist/plugins.d.mts
CHANGED
package/dist/plugins.d.ts
CHANGED
package/dist/server.mjs
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import { createHead as createHead$1 } from 'unhead/server';
|
|
2
2
|
export { extractUnheadInputFromHtml, propsToString, renderSSRHead, transformHtmlTemplate } from 'unhead/server';
|
|
3
|
-
import {
|
|
4
|
-
|
|
3
|
+
import { v as vueInstall } from './shared/vue.pWToN6_t.mjs';
|
|
4
|
+
import { V as VueResolver } from './shared/vue.CkLIG7eN.mjs';
|
|
5
|
+
export { V as VueHeadMixin } from './shared/vue.Ci2RuXYj.mjs';
|
|
5
6
|
import 'unhead/plugins';
|
|
6
7
|
import 'unhead/utils';
|
|
7
8
|
import 'vue';
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { SafeInputPlugin, FlatMetaPlugin } from 'unhead/plugins';
|
|
2
2
|
import { walkResolver } from 'unhead/utils';
|
|
3
|
-
import {
|
|
3
|
+
import { hasInjectionContext, inject, ref, watchEffect, getCurrentInstance, onBeforeUnmount, onDeactivated, onActivated } from 'vue';
|
|
4
|
+
import { V as VueResolver } from './vue.CkLIG7eN.mjs';
|
|
4
5
|
|
|
5
6
|
const headSymbol = "usehead";
|
|
6
7
|
function vueInstall(head) {
|
|
@@ -14,10 +15,6 @@ function vueInstall(head) {
|
|
|
14
15
|
return plugin.install;
|
|
15
16
|
}
|
|
16
17
|
|
|
17
|
-
const VueResolver = (_, value) => {
|
|
18
|
-
return isRef(value) ? toValue(value) : value;
|
|
19
|
-
};
|
|
20
|
-
|
|
21
18
|
function injectHead() {
|
|
22
19
|
if (hasInjectionContext()) {
|
|
23
20
|
const instance = inject(headSymbol);
|
|
@@ -84,4 +81,4 @@ function useServerSeoMeta(input, options) {
|
|
|
84
81
|
return useSeoMeta(input, { ...options, mode: "server" });
|
|
85
82
|
}
|
|
86
83
|
|
|
87
|
-
export {
|
|
84
|
+
export { useHeadSafe as a, useSeoMeta as b, useServerHead as c, useServerHeadSafe as d, useServerSeoMeta as e, headSymbol as h, injectHead as i, useHead as u, vueInstall as v };
|
package/dist/types.d.mts
CHANGED
|
@@ -1,20 +1,86 @@
|
|
|
1
|
-
import { Falsey,
|
|
1
|
+
import { Falsey, BodyAttributes as BodyAttributes$1, DataKeys, SchemaAugmentations, HtmlAttributes as HtmlAttributes$1, BaseMeta, LinkBase, ScriptBase, Noscript as Noscript$1, Style as Style$1, Head, BaseHtmlAttr, MaybeArray, Stringable, BaseBodyAttr, TitleTemplate as TitleTemplate$1, EntryAugmentation, Base as Base$1, DefinedValueOrEmptyObject, MaybeEventFnHandlers, HttpEventAttributes, BodyEvents, MergeHead, HeadEntryOptions, MetaFlatInput, Unhead } from 'unhead/types';
|
|
2
2
|
export { ActiveHeadEntry, Head, HeadEntryOptions, HeadTag, MergeHead, RenderSSRHeadOptions, ResolvedBase, ResolvedBodyAttributes, ResolvedHead, ResolvedHtmlAttributes, ResolvedLink, ResolvedMeta, ResolvedNoscript, ResolvedScript, ResolvedStyle, ResolvedTitle, ResolvedTitleTemplate, Unhead } from 'unhead/types';
|
|
3
|
-
import { ComputedRef, Ref, Plugin } from 'vue';
|
|
3
|
+
import { ComputedRef, Ref, CSSProperties, Plugin } from 'vue';
|
|
4
4
|
|
|
5
|
-
type
|
|
6
|
-
type
|
|
5
|
+
type MaybeFalsey<T> = T | Falsey;
|
|
6
|
+
type ResolvableValue<T> = MaybeFalsey<T> | (() => MaybeFalsey<T>) | ComputedRef<MaybeFalsey<T>> | Ref<MaybeFalsey<T>>;
|
|
7
|
+
type ResolvableArray<T> = ResolvableValue<ResolvableValue<T>[]>;
|
|
7
8
|
type ResolvableProperties<T> = {
|
|
8
|
-
[key in keyof T]?:
|
|
9
|
+
[key in keyof T]?: ResolvableValue<T[key]>;
|
|
9
10
|
};
|
|
10
11
|
|
|
11
|
-
|
|
12
|
+
type SafeBodyAttr = ResolvableProperties<Pick<BodyAttributes$1, 'id' | 'class' | 'style'> & DataKeys & SchemaAugmentations['bodyAttrs']>;
|
|
13
|
+
type SafeHtmlAttr = ResolvableProperties<Pick<HtmlAttributes$1, 'id' | 'class' | 'style' | 'lang' | 'dir'> & DataKeys & SchemaAugmentations['htmlAttrs']>;
|
|
14
|
+
type SafeMeta = ResolvableProperties<Pick<BaseMeta, 'id' | 'name' | 'property' | 'charset' | 'content' | 'media'> & DataKeys & SchemaAugmentations['meta']>;
|
|
15
|
+
type SafeLink = ResolvableProperties<Pick<LinkBase, 'id' | 'color' | 'crossorigin' | 'fetchpriority' | 'href' | 'hreflang' | 'imagesrcset' | 'imagesizes' | 'integrity' | 'media' | 'referrerpolicy' | 'rel' | 'sizes' | 'type'> & DataKeys & SchemaAugmentations['link']>;
|
|
16
|
+
type SafeScript = ResolvableProperties<Pick<ScriptBase, 'id' | 'type' | 'nonce' | 'blocking'> & DataKeys & {
|
|
17
|
+
textContent?: string;
|
|
18
|
+
} & SchemaAugmentations['script']>;
|
|
19
|
+
type SafeNoscript = ResolvableProperties<Pick<Noscript$1, 'id' | 'textContent'> & DataKeys & SchemaAugmentations['noscript']>;
|
|
20
|
+
type SafeStyle = ResolvableProperties<Pick<Style$1, 'id' | 'media' | 'textContent' | 'nonce' | 'title' | 'blocking'> & DataKeys & SchemaAugmentations['style']>;
|
|
21
|
+
interface HeadSafe extends Pick<Head, 'title' | 'titleTemplate' | 'templateParams'> {
|
|
22
|
+
/**
|
|
23
|
+
* The `<link>` HTML element specifies relationships between the current document and an external resource.
|
|
24
|
+
* This element is most commonly used to link to stylesheets, but is also used to establish site icons
|
|
25
|
+
* (both "favicon" style icons and icons for the home screen and apps on mobile devices) among other things.
|
|
26
|
+
*
|
|
27
|
+
* @see https://developer.mozilla.org/en-US/docs/Web/HTML/Element/link#attr-as
|
|
28
|
+
*/
|
|
29
|
+
link?: ResolvableValue<ResolvableValue<SafeLink[]>>;
|
|
30
|
+
/**
|
|
31
|
+
* The `<meta>` element represents metadata that cannot be expressed in other HTML elements, like `<link>` or `<script>`.
|
|
32
|
+
*
|
|
33
|
+
* @see https://developer.mozilla.org/en-US/docs/Web/HTML/Element/meta
|
|
34
|
+
*/
|
|
35
|
+
meta?: ResolvableValue<ResolvableValue<SafeMeta>[]>;
|
|
36
|
+
/**
|
|
37
|
+
* The `<style>` HTML element contains style information for a document, or part of a document.
|
|
38
|
+
* It contains CSS, which is applied to the contents of the document containing the `<style>` element.
|
|
39
|
+
*
|
|
40
|
+
* @see https://developer.mozilla.org/en-US/docs/Web/HTML/Element/style
|
|
41
|
+
*/
|
|
42
|
+
style?: ResolvableValue<ResolvableValue<(SafeStyle | string)>[]>;
|
|
43
|
+
/**
|
|
44
|
+
* The `<script>` HTML element is used to embed executable code or data; this is typically used to embed or refer to JavaScript code.
|
|
45
|
+
*
|
|
46
|
+
* @see https://developer.mozilla.org/en-US/docs/Web/HTML/Element/script
|
|
47
|
+
*/
|
|
48
|
+
script?: ResolvableValue<ResolvableValue<(SafeScript | string)>[]>;
|
|
49
|
+
/**
|
|
50
|
+
* The `<noscript>` HTML element defines a section of HTML to be inserted if a script type on the page is unsupported
|
|
51
|
+
* or if scripting is currently turned off in the browser.
|
|
52
|
+
*
|
|
53
|
+
* @see https://developer.mozilla.org/en-US/docs/Web/HTML/Element/noscript
|
|
54
|
+
*/
|
|
55
|
+
noscript?: ResolvableValue<ResolvableValue<(SafeNoscript | string)>[]>;
|
|
56
|
+
/**
|
|
57
|
+
* Attributes for the `<html>` HTML element.
|
|
58
|
+
*
|
|
59
|
+
* @see https://developer.mozilla.org/en-US/docs/Web/HTML/Element/html
|
|
60
|
+
*/
|
|
61
|
+
htmlAttrs?: ResolvableValue<SafeHtmlAttr>;
|
|
62
|
+
/**
|
|
63
|
+
* Attributes for the `<body>` HTML element.
|
|
64
|
+
*
|
|
65
|
+
* @see https://developer.mozilla.org/en-US/docs/Web/HTML/Element/body
|
|
66
|
+
*/
|
|
67
|
+
bodyAttrs?: ResolvableValue<SafeBodyAttr>;
|
|
68
|
+
}
|
|
69
|
+
type UseHeadSafeInput = ResolvableValue<HeadSafe>;
|
|
70
|
+
|
|
71
|
+
interface HtmlAttr extends Omit<BaseHtmlAttr, 'class' | 'style'> {
|
|
72
|
+
/**
|
|
73
|
+
* The class global attribute is a space-separated list of the case-sensitive classes of the element.
|
|
74
|
+
*
|
|
75
|
+
* @see https://developer.mozilla.org/en-US/docs/Web/HTML/Global_attributes/class
|
|
76
|
+
*/
|
|
77
|
+
class?: MaybeArray<ResolvableValue<Falsey | Stringable> | Record<string, ResolvableValue<Falsey | Stringable>>>;
|
|
12
78
|
/**
|
|
13
79
|
* The class global attribute is a space-separated list of the case-sensitive classes of the element.
|
|
14
80
|
*
|
|
15
81
|
* @see https://developer.mozilla.org/en-US/docs/Web/HTML/Global_attributes/class
|
|
16
82
|
*/
|
|
17
|
-
|
|
83
|
+
style?: MaybeArray<ResolvableValue<Falsey | Stringable> | ResolvableProperties<CSSProperties>>;
|
|
18
84
|
}
|
|
19
85
|
interface BodyAttr extends Omit<BaseBodyAttr, 'class' | 'style'> {
|
|
20
86
|
/**
|
|
@@ -22,16 +88,16 @@ interface BodyAttr extends Omit<BaseBodyAttr, 'class' | 'style'> {
|
|
|
22
88
|
*
|
|
23
89
|
* @see https://developer.mozilla.org/en-US/docs/Web/HTML/Global_attributes/class
|
|
24
90
|
*/
|
|
25
|
-
class?: MaybeArray<
|
|
91
|
+
class?: MaybeArray<ResolvableValue<Falsey | Stringable>> | Record<string, ResolvableValue<Falsey | Stringable>>;
|
|
26
92
|
/**
|
|
27
93
|
* The class global attribute is a space-separated list of the case-sensitive classes of the element.
|
|
28
94
|
*
|
|
29
95
|
* @see https://developer.mozilla.org/en-US/docs/Web/HTML/Global_attributes/class
|
|
30
96
|
*/
|
|
31
|
-
style?: MaybeArray<
|
|
97
|
+
style?: MaybeArray<ResolvableValue<string>> | ResolvableProperties<CSSProperties>;
|
|
32
98
|
}
|
|
33
|
-
type Title =
|
|
34
|
-
textContent:
|
|
99
|
+
type Title = ResolvableValue<Stringable | Falsey> | ResolvableProperties<({
|
|
100
|
+
textContent: Stringable;
|
|
35
101
|
} & SchemaAugmentations['title'])>;
|
|
36
102
|
type TitleTemplate = TitleTemplate$1 | Ref<TitleTemplate$1> | ((title?: string) => TitleTemplate$1);
|
|
37
103
|
type Base<E extends EntryAugmentation = Record<string, any>> = ResolvableProperties<Base$1 & SchemaAugmentations['base']> & DefinedValueOrEmptyObject<E>;
|
|
@@ -57,9 +123,9 @@ interface ReactiveHead<E extends MergeHead = MergeHead> {
|
|
|
57
123
|
/**
|
|
58
124
|
* Variables used to substitute in the title and meta content.
|
|
59
125
|
*/
|
|
60
|
-
templateParams?:
|
|
126
|
+
templateParams?: ResolvableProperties<{
|
|
61
127
|
separator?: '|' | '-' | '·' | string;
|
|
62
|
-
} & Record<string,
|
|
128
|
+
} & Record<string, Stringable | Falsey | ResolvableProperties<Record<string, Stringable | Falsey>>>>;
|
|
63
129
|
/**
|
|
64
130
|
* The `<base>` HTML element specifies the base URL to use for all relative URLs in a document.
|
|
65
131
|
* There can be only one <base> element in a document.
|
|
@@ -117,21 +183,11 @@ interface ReactiveHead<E extends MergeHead = MergeHead> {
|
|
|
117
183
|
type UseHeadOptions = Omit<HeadEntryOptions, 'head'> & {
|
|
118
184
|
head?: VueHeadClient<any>;
|
|
119
185
|
};
|
|
120
|
-
type UseHeadInput<T extends MergeHead = Record<string, any>> =
|
|
186
|
+
type UseHeadInput<T extends MergeHead = Record<string, any>> = ResolvableValue<ReactiveHead<T>>;
|
|
121
187
|
type UseSeoMetaInput = ResolvableProperties<MetaFlatInput> & {
|
|
122
188
|
title?: ReactiveHead['title'];
|
|
123
189
|
titleTemplate?: ReactiveHead['titleTemplate'];
|
|
124
190
|
};
|
|
125
|
-
type VueHeadClient<T extends MergeHead> = Unhead<
|
|
126
|
-
|
|
127
|
-
interface HeadSafe extends Pick<ReactiveHead, 'title' | 'titleTemplate' | 'templateParams'> {
|
|
128
|
-
meta?: ResolvableArray<SafeMeta>[];
|
|
129
|
-
link?: ResolvableArray<SafeLink>[];
|
|
130
|
-
noscript?: ResolvableArray<SafeNoscript>[];
|
|
131
|
-
script?: ResolvableArray<SafeScript>[];
|
|
132
|
-
htmlAttrs?: ResolvableArray<SafeHtmlAttr>;
|
|
133
|
-
bodyAttrs?: ResolvableArray<SafeBodyAttr>;
|
|
134
|
-
}
|
|
135
|
-
type UseHeadSafeInput = MaybeComputedRef<HeadSafe>;
|
|
191
|
+
type VueHeadClient<T extends MergeHead> = Unhead<ResolvableValue<ReactiveHead<T>>> & Plugin;
|
|
136
192
|
|
|
137
|
-
export type { Base, BodyAttr, BodyAttributes, HeadSafe, HtmlAttr, HtmlAttributes, Link,
|
|
193
|
+
export type { Base, BodyAttr, BodyAttributes, HeadSafe, HtmlAttr, HtmlAttributes, Link, MaybeFalsey, Meta, Noscript, ReactiveHead, ResolvableArray, ResolvableProperties, ResolvableValue, SafeBodyAttr, SafeHtmlAttr, SafeLink, SafeMeta, SafeNoscript, SafeScript, SafeStyle, Script, Style, Title, TitleTemplate, UseHeadInput, UseHeadOptions, UseHeadSafeInput, UseSeoMetaInput, VueHeadClient };
|
package/dist/types.d.ts
CHANGED
|
@@ -1,20 +1,86 @@
|
|
|
1
|
-
import { Falsey,
|
|
1
|
+
import { Falsey, BodyAttributes as BodyAttributes$1, DataKeys, SchemaAugmentations, HtmlAttributes as HtmlAttributes$1, BaseMeta, LinkBase, ScriptBase, Noscript as Noscript$1, Style as Style$1, Head, BaseHtmlAttr, MaybeArray, Stringable, BaseBodyAttr, TitleTemplate as TitleTemplate$1, EntryAugmentation, Base as Base$1, DefinedValueOrEmptyObject, MaybeEventFnHandlers, HttpEventAttributes, BodyEvents, MergeHead, HeadEntryOptions, MetaFlatInput, Unhead } from 'unhead/types';
|
|
2
2
|
export { ActiveHeadEntry, Head, HeadEntryOptions, HeadTag, MergeHead, RenderSSRHeadOptions, ResolvedBase, ResolvedBodyAttributes, ResolvedHead, ResolvedHtmlAttributes, ResolvedLink, ResolvedMeta, ResolvedNoscript, ResolvedScript, ResolvedStyle, ResolvedTitle, ResolvedTitleTemplate, Unhead } from 'unhead/types';
|
|
3
|
-
import { ComputedRef, Ref, Plugin } from 'vue';
|
|
3
|
+
import { ComputedRef, Ref, CSSProperties, Plugin } from 'vue';
|
|
4
4
|
|
|
5
|
-
type
|
|
6
|
-
type
|
|
5
|
+
type MaybeFalsey<T> = T | Falsey;
|
|
6
|
+
type ResolvableValue<T> = MaybeFalsey<T> | (() => MaybeFalsey<T>) | ComputedRef<MaybeFalsey<T>> | Ref<MaybeFalsey<T>>;
|
|
7
|
+
type ResolvableArray<T> = ResolvableValue<ResolvableValue<T>[]>;
|
|
7
8
|
type ResolvableProperties<T> = {
|
|
8
|
-
[key in keyof T]?:
|
|
9
|
+
[key in keyof T]?: ResolvableValue<T[key]>;
|
|
9
10
|
};
|
|
10
11
|
|
|
11
|
-
|
|
12
|
+
type SafeBodyAttr = ResolvableProperties<Pick<BodyAttributes$1, 'id' | 'class' | 'style'> & DataKeys & SchemaAugmentations['bodyAttrs']>;
|
|
13
|
+
type SafeHtmlAttr = ResolvableProperties<Pick<HtmlAttributes$1, 'id' | 'class' | 'style' | 'lang' | 'dir'> & DataKeys & SchemaAugmentations['htmlAttrs']>;
|
|
14
|
+
type SafeMeta = ResolvableProperties<Pick<BaseMeta, 'id' | 'name' | 'property' | 'charset' | 'content' | 'media'> & DataKeys & SchemaAugmentations['meta']>;
|
|
15
|
+
type SafeLink = ResolvableProperties<Pick<LinkBase, 'id' | 'color' | 'crossorigin' | 'fetchpriority' | 'href' | 'hreflang' | 'imagesrcset' | 'imagesizes' | 'integrity' | 'media' | 'referrerpolicy' | 'rel' | 'sizes' | 'type'> & DataKeys & SchemaAugmentations['link']>;
|
|
16
|
+
type SafeScript = ResolvableProperties<Pick<ScriptBase, 'id' | 'type' | 'nonce' | 'blocking'> & DataKeys & {
|
|
17
|
+
textContent?: string;
|
|
18
|
+
} & SchemaAugmentations['script']>;
|
|
19
|
+
type SafeNoscript = ResolvableProperties<Pick<Noscript$1, 'id' | 'textContent'> & DataKeys & SchemaAugmentations['noscript']>;
|
|
20
|
+
type SafeStyle = ResolvableProperties<Pick<Style$1, 'id' | 'media' | 'textContent' | 'nonce' | 'title' | 'blocking'> & DataKeys & SchemaAugmentations['style']>;
|
|
21
|
+
interface HeadSafe extends Pick<Head, 'title' | 'titleTemplate' | 'templateParams'> {
|
|
22
|
+
/**
|
|
23
|
+
* The `<link>` HTML element specifies relationships between the current document and an external resource.
|
|
24
|
+
* This element is most commonly used to link to stylesheets, but is also used to establish site icons
|
|
25
|
+
* (both "favicon" style icons and icons for the home screen and apps on mobile devices) among other things.
|
|
26
|
+
*
|
|
27
|
+
* @see https://developer.mozilla.org/en-US/docs/Web/HTML/Element/link#attr-as
|
|
28
|
+
*/
|
|
29
|
+
link?: ResolvableValue<ResolvableValue<SafeLink[]>>;
|
|
30
|
+
/**
|
|
31
|
+
* The `<meta>` element represents metadata that cannot be expressed in other HTML elements, like `<link>` or `<script>`.
|
|
32
|
+
*
|
|
33
|
+
* @see https://developer.mozilla.org/en-US/docs/Web/HTML/Element/meta
|
|
34
|
+
*/
|
|
35
|
+
meta?: ResolvableValue<ResolvableValue<SafeMeta>[]>;
|
|
36
|
+
/**
|
|
37
|
+
* The `<style>` HTML element contains style information for a document, or part of a document.
|
|
38
|
+
* It contains CSS, which is applied to the contents of the document containing the `<style>` element.
|
|
39
|
+
*
|
|
40
|
+
* @see https://developer.mozilla.org/en-US/docs/Web/HTML/Element/style
|
|
41
|
+
*/
|
|
42
|
+
style?: ResolvableValue<ResolvableValue<(SafeStyle | string)>[]>;
|
|
43
|
+
/**
|
|
44
|
+
* The `<script>` HTML element is used to embed executable code or data; this is typically used to embed or refer to JavaScript code.
|
|
45
|
+
*
|
|
46
|
+
* @see https://developer.mozilla.org/en-US/docs/Web/HTML/Element/script
|
|
47
|
+
*/
|
|
48
|
+
script?: ResolvableValue<ResolvableValue<(SafeScript | string)>[]>;
|
|
49
|
+
/**
|
|
50
|
+
* The `<noscript>` HTML element defines a section of HTML to be inserted if a script type on the page is unsupported
|
|
51
|
+
* or if scripting is currently turned off in the browser.
|
|
52
|
+
*
|
|
53
|
+
* @see https://developer.mozilla.org/en-US/docs/Web/HTML/Element/noscript
|
|
54
|
+
*/
|
|
55
|
+
noscript?: ResolvableValue<ResolvableValue<(SafeNoscript | string)>[]>;
|
|
56
|
+
/**
|
|
57
|
+
* Attributes for the `<html>` HTML element.
|
|
58
|
+
*
|
|
59
|
+
* @see https://developer.mozilla.org/en-US/docs/Web/HTML/Element/html
|
|
60
|
+
*/
|
|
61
|
+
htmlAttrs?: ResolvableValue<SafeHtmlAttr>;
|
|
62
|
+
/**
|
|
63
|
+
* Attributes for the `<body>` HTML element.
|
|
64
|
+
*
|
|
65
|
+
* @see https://developer.mozilla.org/en-US/docs/Web/HTML/Element/body
|
|
66
|
+
*/
|
|
67
|
+
bodyAttrs?: ResolvableValue<SafeBodyAttr>;
|
|
68
|
+
}
|
|
69
|
+
type UseHeadSafeInput = ResolvableValue<HeadSafe>;
|
|
70
|
+
|
|
71
|
+
interface HtmlAttr extends Omit<BaseHtmlAttr, 'class' | 'style'> {
|
|
72
|
+
/**
|
|
73
|
+
* The class global attribute is a space-separated list of the case-sensitive classes of the element.
|
|
74
|
+
*
|
|
75
|
+
* @see https://developer.mozilla.org/en-US/docs/Web/HTML/Global_attributes/class
|
|
76
|
+
*/
|
|
77
|
+
class?: MaybeArray<ResolvableValue<Falsey | Stringable> | Record<string, ResolvableValue<Falsey | Stringable>>>;
|
|
12
78
|
/**
|
|
13
79
|
* The class global attribute is a space-separated list of the case-sensitive classes of the element.
|
|
14
80
|
*
|
|
15
81
|
* @see https://developer.mozilla.org/en-US/docs/Web/HTML/Global_attributes/class
|
|
16
82
|
*/
|
|
17
|
-
|
|
83
|
+
style?: MaybeArray<ResolvableValue<Falsey | Stringable> | ResolvableProperties<CSSProperties>>;
|
|
18
84
|
}
|
|
19
85
|
interface BodyAttr extends Omit<BaseBodyAttr, 'class' | 'style'> {
|
|
20
86
|
/**
|
|
@@ -22,16 +88,16 @@ interface BodyAttr extends Omit<BaseBodyAttr, 'class' | 'style'> {
|
|
|
22
88
|
*
|
|
23
89
|
* @see https://developer.mozilla.org/en-US/docs/Web/HTML/Global_attributes/class
|
|
24
90
|
*/
|
|
25
|
-
class?: MaybeArray<
|
|
91
|
+
class?: MaybeArray<ResolvableValue<Falsey | Stringable>> | Record<string, ResolvableValue<Falsey | Stringable>>;
|
|
26
92
|
/**
|
|
27
93
|
* The class global attribute is a space-separated list of the case-sensitive classes of the element.
|
|
28
94
|
*
|
|
29
95
|
* @see https://developer.mozilla.org/en-US/docs/Web/HTML/Global_attributes/class
|
|
30
96
|
*/
|
|
31
|
-
style?: MaybeArray<
|
|
97
|
+
style?: MaybeArray<ResolvableValue<string>> | ResolvableProperties<CSSProperties>;
|
|
32
98
|
}
|
|
33
|
-
type Title =
|
|
34
|
-
textContent:
|
|
99
|
+
type Title = ResolvableValue<Stringable | Falsey> | ResolvableProperties<({
|
|
100
|
+
textContent: Stringable;
|
|
35
101
|
} & SchemaAugmentations['title'])>;
|
|
36
102
|
type TitleTemplate = TitleTemplate$1 | Ref<TitleTemplate$1> | ((title?: string) => TitleTemplate$1);
|
|
37
103
|
type Base<E extends EntryAugmentation = Record<string, any>> = ResolvableProperties<Base$1 & SchemaAugmentations['base']> & DefinedValueOrEmptyObject<E>;
|
|
@@ -57,9 +123,9 @@ interface ReactiveHead<E extends MergeHead = MergeHead> {
|
|
|
57
123
|
/**
|
|
58
124
|
* Variables used to substitute in the title and meta content.
|
|
59
125
|
*/
|
|
60
|
-
templateParams?:
|
|
126
|
+
templateParams?: ResolvableProperties<{
|
|
61
127
|
separator?: '|' | '-' | '·' | string;
|
|
62
|
-
} & Record<string,
|
|
128
|
+
} & Record<string, Stringable | Falsey | ResolvableProperties<Record<string, Stringable | Falsey>>>>;
|
|
63
129
|
/**
|
|
64
130
|
* The `<base>` HTML element specifies the base URL to use for all relative URLs in a document.
|
|
65
131
|
* There can be only one <base> element in a document.
|
|
@@ -117,21 +183,11 @@ interface ReactiveHead<E extends MergeHead = MergeHead> {
|
|
|
117
183
|
type UseHeadOptions = Omit<HeadEntryOptions, 'head'> & {
|
|
118
184
|
head?: VueHeadClient<any>;
|
|
119
185
|
};
|
|
120
|
-
type UseHeadInput<T extends MergeHead = Record<string, any>> =
|
|
186
|
+
type UseHeadInput<T extends MergeHead = Record<string, any>> = ResolvableValue<ReactiveHead<T>>;
|
|
121
187
|
type UseSeoMetaInput = ResolvableProperties<MetaFlatInput> & {
|
|
122
188
|
title?: ReactiveHead['title'];
|
|
123
189
|
titleTemplate?: ReactiveHead['titleTemplate'];
|
|
124
190
|
};
|
|
125
|
-
type VueHeadClient<T extends MergeHead> = Unhead<
|
|
126
|
-
|
|
127
|
-
interface HeadSafe extends Pick<ReactiveHead, 'title' | 'titleTemplate' | 'templateParams'> {
|
|
128
|
-
meta?: ResolvableArray<SafeMeta>[];
|
|
129
|
-
link?: ResolvableArray<SafeLink>[];
|
|
130
|
-
noscript?: ResolvableArray<SafeNoscript>[];
|
|
131
|
-
script?: ResolvableArray<SafeScript>[];
|
|
132
|
-
htmlAttrs?: ResolvableArray<SafeHtmlAttr>;
|
|
133
|
-
bodyAttrs?: ResolvableArray<SafeBodyAttr>;
|
|
134
|
-
}
|
|
135
|
-
type UseHeadSafeInput = MaybeComputedRef<HeadSafe>;
|
|
191
|
+
type VueHeadClient<T extends MergeHead> = Unhead<ResolvableValue<ReactiveHead<T>>> & Plugin;
|
|
136
192
|
|
|
137
|
-
export type { Base, BodyAttr, BodyAttributes, HeadSafe, HtmlAttr, HtmlAttributes, Link,
|
|
193
|
+
export type { Base, BodyAttr, BodyAttributes, HeadSafe, HtmlAttr, HtmlAttributes, Link, MaybeFalsey, Meta, Noscript, ReactiveHead, ResolvableArray, ResolvableProperties, ResolvableValue, SafeBodyAttr, SafeHtmlAttr, SafeLink, SafeMeta, SafeNoscript, SafeScript, SafeStyle, Script, Style, Title, TitleTemplate, UseHeadInput, UseHeadOptions, UseHeadSafeInput, UseSeoMetaInput, VueHeadClient };
|
package/dist/utils.d.mts
CHANGED
|
@@ -1 +1,11 @@
|
|
|
1
|
+
import { PropResolver, ResolvedHead } from 'unhead/types';
|
|
1
2
|
export * from 'unhead/utils';
|
|
3
|
+
|
|
4
|
+
declare const VueResolver: PropResolver;
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* @deprecated Use head.resolveTags() instead
|
|
8
|
+
*/
|
|
9
|
+
declare function resolveUnrefHeadInput(input: any): ResolvedHead;
|
|
10
|
+
|
|
11
|
+
export { VueResolver, resolveUnrefHeadInput };
|
package/dist/utils.d.ts
CHANGED
|
@@ -1 +1,11 @@
|
|
|
1
|
+
import { PropResolver, ResolvedHead } from 'unhead/types';
|
|
1
2
|
export * from 'unhead/utils';
|
|
3
|
+
|
|
4
|
+
declare const VueResolver: PropResolver;
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* @deprecated Use head.resolveTags() instead
|
|
8
|
+
*/
|
|
9
|
+
declare function resolveUnrefHeadInput(input: any): ResolvedHead;
|
|
10
|
+
|
|
11
|
+
export { VueResolver, resolveUnrefHeadInput };
|
package/dist/utils.mjs
CHANGED
|
@@ -1 +1,10 @@
|
|
|
1
|
+
import { walkResolver } from 'unhead/utils';
|
|
1
2
|
export * from 'unhead/utils';
|
|
3
|
+
import { V as VueResolver } from './shared/vue.CkLIG7eN.mjs';
|
|
4
|
+
import 'vue';
|
|
5
|
+
|
|
6
|
+
function resolveUnrefHeadInput(input) {
|
|
7
|
+
return walkResolver(input, VueResolver);
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
export { VueResolver, resolveUnrefHeadInput };
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@unhead/vue",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "2.0.0-alpha.
|
|
4
|
+
"version": "2.0.0-alpha.14",
|
|
5
5
|
"description": "Full-stack <head> manager built for Vue.",
|
|
6
6
|
"author": "Harlan Wilton <harlan@harlanzw.com>",
|
|
7
7
|
"license": "MIT",
|
|
@@ -86,9 +86,9 @@
|
|
|
86
86
|
"client.d.ts",
|
|
87
87
|
"dist",
|
|
88
88
|
"legacy.d.ts",
|
|
89
|
+
"plugins.d.ts",
|
|
89
90
|
"server.d.ts",
|
|
90
91
|
"types.d.ts",
|
|
91
|
-
"plugins.d.ts",
|
|
92
92
|
"utils.d.ts"
|
|
93
93
|
],
|
|
94
94
|
"peerDependencies": {
|
|
@@ -101,7 +101,7 @@
|
|
|
101
101
|
},
|
|
102
102
|
"dependencies": {
|
|
103
103
|
"hookable": "^5.5.3",
|
|
104
|
-
"unhead": "2.0.0-alpha.
|
|
104
|
+
"unhead": "2.0.0-alpha.14"
|
|
105
105
|
},
|
|
106
106
|
"scripts": {
|
|
107
107
|
"build": "unbuild .",
|