@unhead/vue 2.0.0-alpha.7 → 2.0.0-beta.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/client.d.mts +5 -4
- package/dist/client.d.ts +5 -4
- package/dist/client.mjs +9 -12
- package/dist/components.mjs +8 -6
- package/dist/index.d.mts +35 -14
- package/dist/index.d.ts +35 -14
- package/dist/index.mjs +14 -6
- package/dist/legacy.d.mts +27 -45
- package/dist/legacy.d.ts +27 -45
- package/dist/legacy.mjs +36 -93
- package/dist/plugins.d.mts +1 -0
- package/dist/plugins.d.ts +1 -0
- package/dist/plugins.mjs +1 -0
- package/dist/scripts.d.mts +32 -0
- package/dist/scripts.d.ts +32 -0
- package/dist/scripts.mjs +7 -0
- package/dist/server.d.mts +5 -4
- package/dist/server.d.ts +5 -4
- package/dist/server.mjs +7 -9
- package/dist/shared/vue.A6QPXQyg.d.ts +63 -0
- package/dist/shared/vue.BYLJNEcq.mjs +83 -0
- package/dist/shared/vue.C1egIkvG.d.mts +134 -0
- package/dist/shared/vue.C1egIkvG.d.ts +134 -0
- package/dist/shared/vue.Ds_C3mXu.d.mts +63 -0
- package/dist/shared/vue.N9zWjxoK.mjs +7 -0
- package/dist/shared/vue.cHBs6zvy.mjs +70 -0
- package/dist/shared/{vue.CNiRntV8.mjs → vue.nvpYXC6D.mjs} +1 -1
- package/dist/types.d.mts +14 -135
- package/dist/types.d.ts +14 -135
- package/dist/utils.d.mts +11 -0
- package/dist/utils.d.ts +11 -0
- package/dist/utils.mjs +10 -0
- package/package.json +34 -18
- package/plugins.d.ts +1 -0
- package/utils.d.ts +1 -0
- package/dist/client.cjs +0 -36
- package/dist/client.d.cts +0 -8
- package/dist/components.cjs +0 -65
- package/dist/components.d.cts +0 -5
- package/dist/index.cjs +0 -24
- package/dist/index.d.cts +0 -24
- package/dist/legacy.cjs +0 -186
- package/dist/legacy.d.cts +0 -52
- package/dist/server.cjs +0 -33
- package/dist/server.d.cts +0 -8
- package/dist/shared/vue.51u-UkLG.mjs +0 -13
- package/dist/shared/vue.BF-HCrO8.d.cts +0 -3
- package/dist/shared/vue.BF-HCrO8.d.mts +0 -3
- package/dist/shared/vue.BF-HCrO8.d.ts +0 -3
- package/dist/shared/vue.Btxz9wTa.cjs +0 -126
- package/dist/shared/vue.D2UzSD_b.mjs +0 -115
- package/dist/shared/vue.DFf1FJKf.cjs +0 -20
- package/dist/shared/vue.DnywREVF.d.cts +0 -5
- package/dist/shared/vue.rzkVHzqg.cjs +0 -15
- package/dist/types.cjs +0 -2
- package/dist/types.d.cts +0 -137
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { UseScriptOptions as UseScriptOptions$1, ScriptInstance, UseScriptStatus, UseFunctionType } from 'unhead/scripts';
|
|
2
|
+
import { ScriptWithoutEvents, DataKeys, SchemaAugmentations, HeadEntryOptions } from 'unhead/types';
|
|
3
|
+
import { Ref } from 'vue';
|
|
4
|
+
import { o as ResolvableProperties, V as VueHeadClient } from './shared/vue.C1egIkvG.js';
|
|
5
|
+
|
|
6
|
+
interface VueScriptInstance<T extends Record<symbol | string, any>> extends Omit<ScriptInstance<T>, 'status'> {
|
|
7
|
+
status: Ref<UseScriptStatus>;
|
|
8
|
+
}
|
|
9
|
+
type UseScriptInput = string | (ResolvableProperties<Omit<ScriptWithoutEvents & DataKeys & SchemaAugmentations['script'], 'src'>> & {
|
|
10
|
+
src: string;
|
|
11
|
+
});
|
|
12
|
+
interface UseScriptOptions<T extends Record<symbol | string, any> = Record<string, any>> extends Omit<HeadEntryOptions, 'head'>, Pick<UseScriptOptions$1<T>, 'use' | 'eventContext' | 'beforeInit'> {
|
|
13
|
+
/**
|
|
14
|
+
* The trigger to load the script:
|
|
15
|
+
* - `undefined` | `client` - (Default) Load the script on the client when this js is loaded.
|
|
16
|
+
* - `manual` - Load the script manually by calling `$script.load()`, exists only on the client.
|
|
17
|
+
* - `Promise` - Load the script when the promise resolves, exists only on the client.
|
|
18
|
+
* - `Function` - Register a callback function to load the script, exists only on the client.
|
|
19
|
+
* - `server` - Have the script injected on the server.
|
|
20
|
+
* - `ref` - Load the script when the ref is true.
|
|
21
|
+
*/
|
|
22
|
+
trigger?: UseScriptOptions$1['trigger'] | Ref<boolean>;
|
|
23
|
+
/**
|
|
24
|
+
* Unhead instance.
|
|
25
|
+
*/
|
|
26
|
+
head?: VueHeadClient<any>;
|
|
27
|
+
}
|
|
28
|
+
type UseScriptContext<T extends Record<symbol | string, any>> = VueScriptInstance<T>;
|
|
29
|
+
type UseScriptReturn<T extends Record<symbol | string, any>> = UseScriptContext<UseFunctionType<UseScriptOptions<T>, T>>;
|
|
30
|
+
declare function useScript<T extends Record<symbol | string, any> = Record<symbol | string, any>>(_input: UseScriptInput, _options?: UseScriptOptions<T>): UseScriptReturn<T>;
|
|
31
|
+
|
|
32
|
+
export { type UseScriptContext, type UseScriptInput, type UseScriptOptions, type UseScriptReturn, type VueScriptInstance, useScript };
|
package/dist/scripts.mjs
ADDED
package/dist/server.d.mts
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { VueHeadClient } from '@unhead/vue';
|
|
1
|
+
import { CreateServerHeadOptions } from 'unhead/types';
|
|
3
2
|
export { V as VueHeadMixin } from './shared/vue.DnywREVF.mjs';
|
|
4
|
-
export
|
|
3
|
+
export { SSRHeadPayload, extractUnheadInputFromHtml, propsToString, renderSSRHead, transformHtmlTemplate } from 'unhead/server';
|
|
4
|
+
import { V as VueHeadClient } from './shared/vue.C1egIkvG.mjs';
|
|
5
|
+
import 'vue';
|
|
5
6
|
|
|
6
|
-
declare function createHead
|
|
7
|
+
declare function createHead(options?: Omit<CreateServerHeadOptions, 'propsResolver'>): VueHeadClient;
|
|
7
8
|
|
|
8
9
|
export { createHead };
|
package/dist/server.d.ts
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { VueHeadClient } from '@unhead/vue';
|
|
1
|
+
import { CreateServerHeadOptions } from 'unhead/types';
|
|
3
2
|
export { V as VueHeadMixin } from './shared/vue.DnywREVF.js';
|
|
4
|
-
export
|
|
3
|
+
export { SSRHeadPayload, extractUnheadInputFromHtml, propsToString, renderSSRHead, transformHtmlTemplate } from 'unhead/server';
|
|
4
|
+
import { V as VueHeadClient } from './shared/vue.C1egIkvG.js';
|
|
5
|
+
import 'vue';
|
|
5
6
|
|
|
6
|
-
declare function createHead
|
|
7
|
+
declare function createHead(options?: Omit<CreateServerHeadOptions, 'propsResolver'>): VueHeadClient;
|
|
7
8
|
|
|
8
9
|
export { createHead };
|
package/dist/server.mjs
CHANGED
|
@@ -1,18 +1,16 @@
|
|
|
1
1
|
import { createHead as createHead$1 } from 'unhead/server';
|
|
2
|
-
export
|
|
3
|
-
import { v as vueInstall } from './shared/vue.
|
|
4
|
-
import { V as
|
|
5
|
-
export { V as VueHeadMixin } from './shared/vue.
|
|
6
|
-
import '
|
|
2
|
+
export { extractUnheadInputFromHtml, propsToString, renderSSRHead, transformHtmlTemplate } from 'unhead/server';
|
|
3
|
+
import { v as vueInstall } from './shared/vue.BYLJNEcq.mjs';
|
|
4
|
+
import { V as VueResolver } from './shared/vue.N9zWjxoK.mjs';
|
|
5
|
+
export { V as VueHeadMixin } from './shared/vue.nvpYXC6D.mjs';
|
|
6
|
+
import 'unhead/plugins';
|
|
7
|
+
import 'unhead/utils';
|
|
7
8
|
import 'vue';
|
|
8
9
|
|
|
9
10
|
function createHead(options = {}) {
|
|
10
11
|
const head = createHead$1({
|
|
11
12
|
...options,
|
|
12
|
-
|
|
13
|
-
...options.plugins || [],
|
|
14
|
-
VueReactivityPlugin
|
|
15
|
-
]
|
|
13
|
+
propResolvers: [VueResolver]
|
|
16
14
|
});
|
|
17
15
|
head.install = vueInstall(head);
|
|
18
16
|
return head;
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
import { ResolvableHead, LinkWithoutEvents, DataKeys, SchemaAugmentations, UnheadMeta, Style, ScriptWithoutEvents, TagPriority, TagPosition, ResolvesDuplicates, ProcessesTemplateParams, Noscript, HtmlAttributes, BodyAttributesWithoutEvents } from 'unhead/types';
|
|
2
|
+
import { m as ResolvableValue, o as ResolvableProperties } from './vue.C1egIkvG.js';
|
|
3
|
+
|
|
4
|
+
type SafeBodyAttr = ResolvableProperties<Pick<BodyAttributesWithoutEvents, 'id' | 'class' | 'style'> & DataKeys & SchemaAugmentations['bodyAttrs']>;
|
|
5
|
+
type SafeHtmlAttr = ResolvableProperties<Pick<HtmlAttributes, 'id' | 'class' | 'style' | 'lang' | 'dir'> & DataKeys & SchemaAugmentations['htmlAttrs']>;
|
|
6
|
+
type SafeMeta = ResolvableProperties<Pick<UnheadMeta, 'id' | 'name' | 'property' | 'charset' | 'content' | 'media'> & DataKeys & SchemaAugmentations['meta']>;
|
|
7
|
+
type SafeLink = ResolvableProperties<Pick<LinkWithoutEvents, 'id' | 'color' | 'crossorigin' | 'fetchpriority' | 'href' | 'hreflang' | 'imagesrcset' | 'imagesizes' | 'integrity' | 'media' | 'referrerpolicy' | 'rel' | 'sizes' | 'type'> & DataKeys & SchemaAugmentations['link']>;
|
|
8
|
+
type SafeScript = ResolvableProperties<Pick<ScriptWithoutEvents, 'id' | 'type' | 'nonce' | 'blocking'> & DataKeys & {
|
|
9
|
+
textContent?: string;
|
|
10
|
+
} & TagPriority & TagPosition & ResolvesDuplicates & ProcessesTemplateParams>;
|
|
11
|
+
type SafeNoscript = ResolvableProperties<Pick<Noscript, 'id'> & DataKeys & Omit<SchemaAugmentations['noscript'], 'innerHTML'>>;
|
|
12
|
+
type SafeStyle = ResolvableProperties<Pick<Style, 'id' | 'media' | 'nonce' | 'title' | 'blocking'> & DataKeys & Omit<SchemaAugmentations['style'], 'innerHTML'>>;
|
|
13
|
+
interface HeadSafe extends Pick<ResolvableHead, 'title' | 'titleTemplate' | 'templateParams'> {
|
|
14
|
+
/**
|
|
15
|
+
* The `<link>` HTML element specifies relationships between the current document and an external resource.
|
|
16
|
+
* This element is most commonly used to link to stylesheets, but is also used to establish site icons
|
|
17
|
+
* (both "favicon" style icons and icons for the home screen and apps on mobile devices) among other things.
|
|
18
|
+
*
|
|
19
|
+
* @see https://developer.mozilla.org/en-US/docs/Web/HTML/Element/link#attr-as
|
|
20
|
+
*/
|
|
21
|
+
link?: ResolvableValue<ResolvableValue<SafeLink[]>>;
|
|
22
|
+
/**
|
|
23
|
+
* The `<meta>` element represents metadata that cannot be expressed in other HTML elements, like `<link>` or `<script>`.
|
|
24
|
+
*
|
|
25
|
+
* @see https://developer.mozilla.org/en-US/docs/Web/HTML/Element/meta
|
|
26
|
+
*/
|
|
27
|
+
meta?: ResolvableValue<ResolvableValue<SafeMeta>[]>;
|
|
28
|
+
/**
|
|
29
|
+
* The `<style>` HTML element contains style information for a document, or part of a document.
|
|
30
|
+
* It contains CSS, which is applied to the contents of the document containing the `<style>` element.
|
|
31
|
+
*
|
|
32
|
+
* @see https://developer.mozilla.org/en-US/docs/Web/HTML/Element/style
|
|
33
|
+
*/
|
|
34
|
+
style?: ResolvableValue<ResolvableValue<(SafeStyle | string)>[]>;
|
|
35
|
+
/**
|
|
36
|
+
* The `<script>` HTML element is used to embed executable code or data; this is typically used to embed or refer to JavaScript code.
|
|
37
|
+
*
|
|
38
|
+
* @see https://developer.mozilla.org/en-US/docs/Web/HTML/Element/script
|
|
39
|
+
*/
|
|
40
|
+
script?: ResolvableValue<ResolvableValue<(SafeScript | string)>[]>;
|
|
41
|
+
/**
|
|
42
|
+
* The `<noscript>` HTML element defines a section of HTML to be inserted if a script type on the page is unsupported
|
|
43
|
+
* or if scripting is currently turned off in the browser.
|
|
44
|
+
*
|
|
45
|
+
* @see https://developer.mozilla.org/en-US/docs/Web/HTML/Element/noscript
|
|
46
|
+
*/
|
|
47
|
+
noscript?: ResolvableValue<ResolvableValue<(SafeNoscript | string)>[]>;
|
|
48
|
+
/**
|
|
49
|
+
* Attributes for the `<html>` HTML element.
|
|
50
|
+
*
|
|
51
|
+
* @see https://developer.mozilla.org/en-US/docs/Web/HTML/Element/html
|
|
52
|
+
*/
|
|
53
|
+
htmlAttrs?: ResolvableValue<SafeHtmlAttr>;
|
|
54
|
+
/**
|
|
55
|
+
* Attributes for the `<body>` HTML element.
|
|
56
|
+
*
|
|
57
|
+
* @see https://developer.mozilla.org/en-US/docs/Web/HTML/Element/body
|
|
58
|
+
*/
|
|
59
|
+
bodyAttrs?: ResolvableValue<SafeBodyAttr>;
|
|
60
|
+
}
|
|
61
|
+
type UseHeadSafeInput = ResolvableValue<HeadSafe>;
|
|
62
|
+
|
|
63
|
+
export type { HeadSafe as H, SafeBodyAttr as S, UseHeadSafeInput as U, SafeHtmlAttr as a, SafeMeta as b, SafeLink as c, SafeScript as d, SafeNoscript as e, SafeStyle as f };
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
import { SafeInputPlugin, FlatMetaPlugin } from 'unhead/plugins';
|
|
2
|
+
import { walkResolver } from 'unhead/utils';
|
|
3
|
+
import { hasInjectionContext, inject, ref, watchEffect, getCurrentInstance, onBeforeUnmount, onDeactivated, onActivated } from 'vue';
|
|
4
|
+
import { V as VueResolver } from './vue.N9zWjxoK.mjs';
|
|
5
|
+
|
|
6
|
+
const headSymbol = "usehead";
|
|
7
|
+
function vueInstall(head) {
|
|
8
|
+
const plugin = {
|
|
9
|
+
install(app) {
|
|
10
|
+
app.config.globalProperties.$unhead = head;
|
|
11
|
+
app.config.globalProperties.$head = head;
|
|
12
|
+
app.provide(headSymbol, head);
|
|
13
|
+
}
|
|
14
|
+
};
|
|
15
|
+
return plugin.install;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
function injectHead() {
|
|
19
|
+
if (hasInjectionContext()) {
|
|
20
|
+
const instance = inject(headSymbol);
|
|
21
|
+
if (!instance) {
|
|
22
|
+
throw new Error("useHead() was called without provide context, ensure you call it through the setup() function.");
|
|
23
|
+
}
|
|
24
|
+
return instance;
|
|
25
|
+
}
|
|
26
|
+
throw new Error("useHead() was called without provide context, ensure you call it through the setup() function.");
|
|
27
|
+
}
|
|
28
|
+
function useHead(input, options = {}) {
|
|
29
|
+
const head = options.head || injectHead();
|
|
30
|
+
return head.ssr ? head.push(input || {}, options) : clientUseHead(head, input, options);
|
|
31
|
+
}
|
|
32
|
+
function clientUseHead(head, input, options = {}) {
|
|
33
|
+
const deactivated = ref(false);
|
|
34
|
+
let entry;
|
|
35
|
+
watchEffect(() => {
|
|
36
|
+
const i = deactivated.value ? {} : walkResolver(input, VueResolver);
|
|
37
|
+
if (entry) {
|
|
38
|
+
entry.patch(i);
|
|
39
|
+
} else {
|
|
40
|
+
entry = head.push(i, options);
|
|
41
|
+
}
|
|
42
|
+
});
|
|
43
|
+
const vm = getCurrentInstance();
|
|
44
|
+
if (vm) {
|
|
45
|
+
onBeforeUnmount(() => {
|
|
46
|
+
entry.dispose();
|
|
47
|
+
});
|
|
48
|
+
onDeactivated(() => {
|
|
49
|
+
deactivated.value = true;
|
|
50
|
+
});
|
|
51
|
+
onActivated(() => {
|
|
52
|
+
deactivated.value = false;
|
|
53
|
+
});
|
|
54
|
+
}
|
|
55
|
+
return entry;
|
|
56
|
+
}
|
|
57
|
+
function useHeadSafe(input = {}, options = {}) {
|
|
58
|
+
const head = options.head || injectHead();
|
|
59
|
+
head.use(SafeInputPlugin);
|
|
60
|
+
options._safe = true;
|
|
61
|
+
return useHead(input, options);
|
|
62
|
+
}
|
|
63
|
+
function useSeoMeta(input = {}, options = {}) {
|
|
64
|
+
const head = options.head || injectHead();
|
|
65
|
+
head.use(FlatMetaPlugin);
|
|
66
|
+
const { title, titleTemplate, ...meta } = input;
|
|
67
|
+
return useHead({
|
|
68
|
+
title,
|
|
69
|
+
titleTemplate,
|
|
70
|
+
_flatMeta: meta
|
|
71
|
+
}, options);
|
|
72
|
+
}
|
|
73
|
+
function useServerHead(input, options = {}) {
|
|
74
|
+
return useHead(input, { ...options, mode: "server" });
|
|
75
|
+
}
|
|
76
|
+
function useServerHeadSafe(input, options = {}) {
|
|
77
|
+
return useHeadSafe(input, { ...options, mode: "server" });
|
|
78
|
+
}
|
|
79
|
+
function useServerSeoMeta(input, options = {}) {
|
|
80
|
+
return useSeoMeta(input, { ...options, mode: "server" });
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
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 };
|
|
@@ -0,0 +1,134 @@
|
|
|
1
|
+
import { Stringable, SchemaAugmentations, ResolvableTitleTemplate as ResolvableTitleTemplate$1, Base, LinkWithoutEvents, DataKeys, MaybeEventFnHandlers, HttpEventAttributes, UnheadMeta, Style, ScriptWithoutEvents, Noscript, HtmlAttributes, MaybeArray, BodyAttributesWithoutEvents, BodyEvents, Unhead, HeadEntryOptions, MetaFlatInput } from 'unhead/types';
|
|
2
|
+
import { ComputedRef, Ref, CSSProperties, Plugin } from 'vue';
|
|
3
|
+
|
|
4
|
+
type Falsy = false | null | undefined;
|
|
5
|
+
type MaybeFalsy<T> = T | Falsy;
|
|
6
|
+
type ResolvableValue<T> = MaybeFalsy<T> | (() => MaybeFalsy<T>) | ComputedRef<MaybeFalsy<T>> | Ref<MaybeFalsy<T>>;
|
|
7
|
+
type ResolvableArray<T> = ResolvableValue<ResolvableValue<T>[]>;
|
|
8
|
+
type ResolvableProperties<T> = {
|
|
9
|
+
[key in keyof T]?: ResolvableValue<T[key]>;
|
|
10
|
+
};
|
|
11
|
+
|
|
12
|
+
interface HtmlAttr extends Omit<HtmlAttributes, 'class' | 'style'> {
|
|
13
|
+
/**
|
|
14
|
+
* The class global attribute is a space-separated list of the case-sensitive classes of the element.
|
|
15
|
+
*
|
|
16
|
+
* @see https://developer.mozilla.org/en-US/docs/Web/HTML/Global_attributes/class
|
|
17
|
+
*/
|
|
18
|
+
class?: MaybeArray<ResolvableValue<Stringable> | Record<string, ResolvableValue<Stringable>>>;
|
|
19
|
+
/**
|
|
20
|
+
* The class global attribute is a space-separated list of the case-sensitive classes of the element.
|
|
21
|
+
*
|
|
22
|
+
* @see https://developer.mozilla.org/en-US/docs/Web/HTML/Global_attributes/class
|
|
23
|
+
*/
|
|
24
|
+
style?: MaybeArray<ResolvableValue<Stringable> | ResolvableProperties<CSSProperties>>;
|
|
25
|
+
}
|
|
26
|
+
interface BodyAttr extends Omit<BodyAttributesWithoutEvents, 'class' | 'style'> {
|
|
27
|
+
/**
|
|
28
|
+
* The class global attribute is a space-separated list of the case-sensitive classes of the element.
|
|
29
|
+
*
|
|
30
|
+
* @see https://developer.mozilla.org/en-US/docs/Web/HTML/Global_attributes/class
|
|
31
|
+
*/
|
|
32
|
+
class?: MaybeArray<ResolvableValue<Stringable>> | Record<string, ResolvableValue<Stringable>>;
|
|
33
|
+
/**
|
|
34
|
+
* The class global attribute is a space-separated list of the case-sensitive classes of the element.
|
|
35
|
+
*
|
|
36
|
+
* @see https://developer.mozilla.org/en-US/docs/Web/HTML/Global_attributes/class
|
|
37
|
+
*/
|
|
38
|
+
style?: MaybeArray<ResolvableValue<string>> | ResolvableProperties<CSSProperties>;
|
|
39
|
+
}
|
|
40
|
+
type ResolvableTitle = ResolvableValue<Stringable> | ResolvableProperties<({
|
|
41
|
+
textContent: Stringable;
|
|
42
|
+
} & SchemaAugmentations['title'])>;
|
|
43
|
+
type ResolvableTitleTemplate = ResolvableTitleTemplate$1 | Ref<string>;
|
|
44
|
+
type ResolvableBase = ResolvableProperties<Base & SchemaAugmentations['base']>;
|
|
45
|
+
type ResolvableLink = ResolvableProperties<LinkWithoutEvents & DataKeys & SchemaAugmentations['link']> & MaybeEventFnHandlers<HttpEventAttributes>;
|
|
46
|
+
type ResolvableMeta = ResolvableProperties<UnheadMeta & DataKeys & SchemaAugmentations['meta']>;
|
|
47
|
+
type ResolvableStyle = ResolvableProperties<Style & DataKeys & SchemaAugmentations['style']>;
|
|
48
|
+
type ResolvableScript = ResolvableProperties<ScriptWithoutEvents & DataKeys & SchemaAugmentations['script']> & MaybeEventFnHandlers<HttpEventAttributes>;
|
|
49
|
+
type ResolvableNoscript = ResolvableProperties<Noscript & DataKeys & SchemaAugmentations['noscript']>;
|
|
50
|
+
type ResolvableHtmlAttributes = ResolvableProperties<HtmlAttr & DataKeys & SchemaAugmentations['htmlAttrs']>;
|
|
51
|
+
type ResolvableBodyAttributes = ResolvableProperties<BodyAttr & DataKeys & SchemaAugmentations['bodyAttrs']> & MaybeEventFnHandlers<BodyEvents>;
|
|
52
|
+
interface ReactiveHead {
|
|
53
|
+
/**
|
|
54
|
+
* The `<title>` HTML element defines the document's title that is shown in a browser's title bar or a page's tab.
|
|
55
|
+
* It only contains text; tags within the element are ignored.
|
|
56
|
+
*
|
|
57
|
+
* @see https://developer.mozilla.org/en-US/docs/Web/HTML/Element/title
|
|
58
|
+
*/
|
|
59
|
+
title?: ResolvableTitle;
|
|
60
|
+
/**
|
|
61
|
+
* Generate the title from a template.
|
|
62
|
+
*/
|
|
63
|
+
titleTemplate?: ResolvableTitleTemplate;
|
|
64
|
+
/**
|
|
65
|
+
* Variables used to substitute in the title and meta content.
|
|
66
|
+
*/
|
|
67
|
+
templateParams?: ResolvableProperties<{
|
|
68
|
+
separator?: '|' | '-' | '·' | string;
|
|
69
|
+
} & Record<string, Stringable | ResolvableProperties<Record<string, Stringable>>>>;
|
|
70
|
+
/**
|
|
71
|
+
* The `<base>` HTML element specifies the base URL to use for all relative URLs in a document.
|
|
72
|
+
* There can be only one <base> element in a document.
|
|
73
|
+
*
|
|
74
|
+
* @see https://developer.mozilla.org/en-US/docs/Web/HTML/Element/base
|
|
75
|
+
*/
|
|
76
|
+
base?: ResolvableBase;
|
|
77
|
+
/**
|
|
78
|
+
* The `<link>` HTML element specifies relationships between the current document and an external resource.
|
|
79
|
+
* This element is most commonly used to link to stylesheets, but is also used to establish site icons
|
|
80
|
+
* (both "favicon" style icons and icons for the home screen and apps on mobile devices) among other things.
|
|
81
|
+
*
|
|
82
|
+
* @see https://developer.mozilla.org/en-US/docs/Web/HTML/Element/link#attr-as
|
|
83
|
+
*/
|
|
84
|
+
link?: ResolvableArray<ResolvableLink>;
|
|
85
|
+
/**
|
|
86
|
+
* The `<meta>` element represents metadata that cannot be expressed in other HTML elements, like `<link>` or `<script>`.
|
|
87
|
+
*
|
|
88
|
+
* @see https://developer.mozilla.org/en-US/docs/Web/HTML/Element/meta
|
|
89
|
+
*/
|
|
90
|
+
meta?: ResolvableArray<ResolvableMeta>;
|
|
91
|
+
/**
|
|
92
|
+
* The `<style>` HTML element contains style information for a document, or part of a document.
|
|
93
|
+
* It contains CSS, which is applied to the contents of the document containing the `<style>` element.
|
|
94
|
+
*
|
|
95
|
+
* @see https://developer.mozilla.org/en-US/docs/Web/HTML/Element/style
|
|
96
|
+
*/
|
|
97
|
+
style?: ResolvableArray<(ResolvableStyle | string)>;
|
|
98
|
+
/**
|
|
99
|
+
* The `<script>` HTML element is used to embed executable code or data; this is typically used to embed or refer to JavaScript code.
|
|
100
|
+
*
|
|
101
|
+
* @see https://developer.mozilla.org/en-US/docs/Web/HTML/Element/script
|
|
102
|
+
*/
|
|
103
|
+
script?: ResolvableArray<(ResolvableScript | string)>;
|
|
104
|
+
/**
|
|
105
|
+
* The `<noscript>` HTML element defines a section of HTML to be inserted if a script type on the page is unsupported
|
|
106
|
+
* or if scripting is currently turned off in the browser.
|
|
107
|
+
*
|
|
108
|
+
* @see https://developer.mozilla.org/en-US/docs/Web/HTML/Element/noscript
|
|
109
|
+
*/
|
|
110
|
+
noscript?: ResolvableArray<(ResolvableNoscript | string)>;
|
|
111
|
+
/**
|
|
112
|
+
* Attributes for the `<html>` HTML element.
|
|
113
|
+
*
|
|
114
|
+
* @see https://developer.mozilla.org/en-US/docs/Web/HTML/Element/html
|
|
115
|
+
*/
|
|
116
|
+
htmlAttrs?: ResolvableHtmlAttributes;
|
|
117
|
+
/**
|
|
118
|
+
* Attributes for the `<body>` HTML element.
|
|
119
|
+
*
|
|
120
|
+
* @see https://developer.mozilla.org/en-US/docs/Web/HTML/Element/body
|
|
121
|
+
*/
|
|
122
|
+
bodyAttrs?: ResolvableBodyAttributes;
|
|
123
|
+
}
|
|
124
|
+
type UseHeadOptions = Omit<HeadEntryOptions, 'head'> & {
|
|
125
|
+
head?: VueHeadClient<any>;
|
|
126
|
+
};
|
|
127
|
+
type UseHeadInput<Deprecated = never> = ResolvableValue<ReactiveHead>;
|
|
128
|
+
type UseSeoMetaInput = ResolvableProperties<MetaFlatInput> & {
|
|
129
|
+
title?: ReactiveHead['title'];
|
|
130
|
+
titleTemplate?: ReactiveHead['titleTemplate'];
|
|
131
|
+
};
|
|
132
|
+
type VueHeadClient<I = UseHeadInput> = Unhead<I> & Plugin;
|
|
133
|
+
|
|
134
|
+
export type { BodyAttr as B, HtmlAttr as H, MaybeFalsy as M, ResolvableTitle as R, UseHeadInput as U, VueHeadClient as V, UseHeadOptions as a, UseSeoMetaInput as b, ResolvableTitleTemplate as c, ResolvableBase as d, ResolvableLink as e, ResolvableMeta as f, ResolvableStyle as g, ResolvableScript as h, ResolvableNoscript as i, ResolvableHtmlAttributes as j, ResolvableBodyAttributes as k, ReactiveHead as l, ResolvableValue as m, ResolvableArray as n, ResolvableProperties as o };
|
|
@@ -0,0 +1,134 @@
|
|
|
1
|
+
import { Stringable, SchemaAugmentations, ResolvableTitleTemplate as ResolvableTitleTemplate$1, Base, LinkWithoutEvents, DataKeys, MaybeEventFnHandlers, HttpEventAttributes, UnheadMeta, Style, ScriptWithoutEvents, Noscript, HtmlAttributes, MaybeArray, BodyAttributesWithoutEvents, BodyEvents, Unhead, HeadEntryOptions, MetaFlatInput } from 'unhead/types';
|
|
2
|
+
import { ComputedRef, Ref, CSSProperties, Plugin } from 'vue';
|
|
3
|
+
|
|
4
|
+
type Falsy = false | null | undefined;
|
|
5
|
+
type MaybeFalsy<T> = T | Falsy;
|
|
6
|
+
type ResolvableValue<T> = MaybeFalsy<T> | (() => MaybeFalsy<T>) | ComputedRef<MaybeFalsy<T>> | Ref<MaybeFalsy<T>>;
|
|
7
|
+
type ResolvableArray<T> = ResolvableValue<ResolvableValue<T>[]>;
|
|
8
|
+
type ResolvableProperties<T> = {
|
|
9
|
+
[key in keyof T]?: ResolvableValue<T[key]>;
|
|
10
|
+
};
|
|
11
|
+
|
|
12
|
+
interface HtmlAttr extends Omit<HtmlAttributes, 'class' | 'style'> {
|
|
13
|
+
/**
|
|
14
|
+
* The class global attribute is a space-separated list of the case-sensitive classes of the element.
|
|
15
|
+
*
|
|
16
|
+
* @see https://developer.mozilla.org/en-US/docs/Web/HTML/Global_attributes/class
|
|
17
|
+
*/
|
|
18
|
+
class?: MaybeArray<ResolvableValue<Stringable> | Record<string, ResolvableValue<Stringable>>>;
|
|
19
|
+
/**
|
|
20
|
+
* The class global attribute is a space-separated list of the case-sensitive classes of the element.
|
|
21
|
+
*
|
|
22
|
+
* @see https://developer.mozilla.org/en-US/docs/Web/HTML/Global_attributes/class
|
|
23
|
+
*/
|
|
24
|
+
style?: MaybeArray<ResolvableValue<Stringable> | ResolvableProperties<CSSProperties>>;
|
|
25
|
+
}
|
|
26
|
+
interface BodyAttr extends Omit<BodyAttributesWithoutEvents, 'class' | 'style'> {
|
|
27
|
+
/**
|
|
28
|
+
* The class global attribute is a space-separated list of the case-sensitive classes of the element.
|
|
29
|
+
*
|
|
30
|
+
* @see https://developer.mozilla.org/en-US/docs/Web/HTML/Global_attributes/class
|
|
31
|
+
*/
|
|
32
|
+
class?: MaybeArray<ResolvableValue<Stringable>> | Record<string, ResolvableValue<Stringable>>;
|
|
33
|
+
/**
|
|
34
|
+
* The class global attribute is a space-separated list of the case-sensitive classes of the element.
|
|
35
|
+
*
|
|
36
|
+
* @see https://developer.mozilla.org/en-US/docs/Web/HTML/Global_attributes/class
|
|
37
|
+
*/
|
|
38
|
+
style?: MaybeArray<ResolvableValue<string>> | ResolvableProperties<CSSProperties>;
|
|
39
|
+
}
|
|
40
|
+
type ResolvableTitle = ResolvableValue<Stringable> | ResolvableProperties<({
|
|
41
|
+
textContent: Stringable;
|
|
42
|
+
} & SchemaAugmentations['title'])>;
|
|
43
|
+
type ResolvableTitleTemplate = ResolvableTitleTemplate$1 | Ref<string>;
|
|
44
|
+
type ResolvableBase = ResolvableProperties<Base & SchemaAugmentations['base']>;
|
|
45
|
+
type ResolvableLink = ResolvableProperties<LinkWithoutEvents & DataKeys & SchemaAugmentations['link']> & MaybeEventFnHandlers<HttpEventAttributes>;
|
|
46
|
+
type ResolvableMeta = ResolvableProperties<UnheadMeta & DataKeys & SchemaAugmentations['meta']>;
|
|
47
|
+
type ResolvableStyle = ResolvableProperties<Style & DataKeys & SchemaAugmentations['style']>;
|
|
48
|
+
type ResolvableScript = ResolvableProperties<ScriptWithoutEvents & DataKeys & SchemaAugmentations['script']> & MaybeEventFnHandlers<HttpEventAttributes>;
|
|
49
|
+
type ResolvableNoscript = ResolvableProperties<Noscript & DataKeys & SchemaAugmentations['noscript']>;
|
|
50
|
+
type ResolvableHtmlAttributes = ResolvableProperties<HtmlAttr & DataKeys & SchemaAugmentations['htmlAttrs']>;
|
|
51
|
+
type ResolvableBodyAttributes = ResolvableProperties<BodyAttr & DataKeys & SchemaAugmentations['bodyAttrs']> & MaybeEventFnHandlers<BodyEvents>;
|
|
52
|
+
interface ReactiveHead {
|
|
53
|
+
/**
|
|
54
|
+
* The `<title>` HTML element defines the document's title that is shown in a browser's title bar or a page's tab.
|
|
55
|
+
* It only contains text; tags within the element are ignored.
|
|
56
|
+
*
|
|
57
|
+
* @see https://developer.mozilla.org/en-US/docs/Web/HTML/Element/title
|
|
58
|
+
*/
|
|
59
|
+
title?: ResolvableTitle;
|
|
60
|
+
/**
|
|
61
|
+
* Generate the title from a template.
|
|
62
|
+
*/
|
|
63
|
+
titleTemplate?: ResolvableTitleTemplate;
|
|
64
|
+
/**
|
|
65
|
+
* Variables used to substitute in the title and meta content.
|
|
66
|
+
*/
|
|
67
|
+
templateParams?: ResolvableProperties<{
|
|
68
|
+
separator?: '|' | '-' | '·' | string;
|
|
69
|
+
} & Record<string, Stringable | ResolvableProperties<Record<string, Stringable>>>>;
|
|
70
|
+
/**
|
|
71
|
+
* The `<base>` HTML element specifies the base URL to use for all relative URLs in a document.
|
|
72
|
+
* There can be only one <base> element in a document.
|
|
73
|
+
*
|
|
74
|
+
* @see https://developer.mozilla.org/en-US/docs/Web/HTML/Element/base
|
|
75
|
+
*/
|
|
76
|
+
base?: ResolvableBase;
|
|
77
|
+
/**
|
|
78
|
+
* The `<link>` HTML element specifies relationships between the current document and an external resource.
|
|
79
|
+
* This element is most commonly used to link to stylesheets, but is also used to establish site icons
|
|
80
|
+
* (both "favicon" style icons and icons for the home screen and apps on mobile devices) among other things.
|
|
81
|
+
*
|
|
82
|
+
* @see https://developer.mozilla.org/en-US/docs/Web/HTML/Element/link#attr-as
|
|
83
|
+
*/
|
|
84
|
+
link?: ResolvableArray<ResolvableLink>;
|
|
85
|
+
/**
|
|
86
|
+
* The `<meta>` element represents metadata that cannot be expressed in other HTML elements, like `<link>` or `<script>`.
|
|
87
|
+
*
|
|
88
|
+
* @see https://developer.mozilla.org/en-US/docs/Web/HTML/Element/meta
|
|
89
|
+
*/
|
|
90
|
+
meta?: ResolvableArray<ResolvableMeta>;
|
|
91
|
+
/**
|
|
92
|
+
* The `<style>` HTML element contains style information for a document, or part of a document.
|
|
93
|
+
* It contains CSS, which is applied to the contents of the document containing the `<style>` element.
|
|
94
|
+
*
|
|
95
|
+
* @see https://developer.mozilla.org/en-US/docs/Web/HTML/Element/style
|
|
96
|
+
*/
|
|
97
|
+
style?: ResolvableArray<(ResolvableStyle | string)>;
|
|
98
|
+
/**
|
|
99
|
+
* The `<script>` HTML element is used to embed executable code or data; this is typically used to embed or refer to JavaScript code.
|
|
100
|
+
*
|
|
101
|
+
* @see https://developer.mozilla.org/en-US/docs/Web/HTML/Element/script
|
|
102
|
+
*/
|
|
103
|
+
script?: ResolvableArray<(ResolvableScript | string)>;
|
|
104
|
+
/**
|
|
105
|
+
* The `<noscript>` HTML element defines a section of HTML to be inserted if a script type on the page is unsupported
|
|
106
|
+
* or if scripting is currently turned off in the browser.
|
|
107
|
+
*
|
|
108
|
+
* @see https://developer.mozilla.org/en-US/docs/Web/HTML/Element/noscript
|
|
109
|
+
*/
|
|
110
|
+
noscript?: ResolvableArray<(ResolvableNoscript | string)>;
|
|
111
|
+
/**
|
|
112
|
+
* Attributes for the `<html>` HTML element.
|
|
113
|
+
*
|
|
114
|
+
* @see https://developer.mozilla.org/en-US/docs/Web/HTML/Element/html
|
|
115
|
+
*/
|
|
116
|
+
htmlAttrs?: ResolvableHtmlAttributes;
|
|
117
|
+
/**
|
|
118
|
+
* Attributes for the `<body>` HTML element.
|
|
119
|
+
*
|
|
120
|
+
* @see https://developer.mozilla.org/en-US/docs/Web/HTML/Element/body
|
|
121
|
+
*/
|
|
122
|
+
bodyAttrs?: ResolvableBodyAttributes;
|
|
123
|
+
}
|
|
124
|
+
type UseHeadOptions = Omit<HeadEntryOptions, 'head'> & {
|
|
125
|
+
head?: VueHeadClient<any>;
|
|
126
|
+
};
|
|
127
|
+
type UseHeadInput<Deprecated = never> = ResolvableValue<ReactiveHead>;
|
|
128
|
+
type UseSeoMetaInput = ResolvableProperties<MetaFlatInput> & {
|
|
129
|
+
title?: ReactiveHead['title'];
|
|
130
|
+
titleTemplate?: ReactiveHead['titleTemplate'];
|
|
131
|
+
};
|
|
132
|
+
type VueHeadClient<I = UseHeadInput> = Unhead<I> & Plugin;
|
|
133
|
+
|
|
134
|
+
export type { BodyAttr as B, HtmlAttr as H, MaybeFalsy as M, ResolvableTitle as R, UseHeadInput as U, VueHeadClient as V, UseHeadOptions as a, UseSeoMetaInput as b, ResolvableTitleTemplate as c, ResolvableBase as d, ResolvableLink as e, ResolvableMeta as f, ResolvableStyle as g, ResolvableScript as h, ResolvableNoscript as i, ResolvableHtmlAttributes as j, ResolvableBodyAttributes as k, ReactiveHead as l, ResolvableValue as m, ResolvableArray as n, ResolvableProperties as o };
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
import { ResolvableHead, LinkWithoutEvents, DataKeys, SchemaAugmentations, UnheadMeta, Style, ScriptWithoutEvents, TagPriority, TagPosition, ResolvesDuplicates, ProcessesTemplateParams, Noscript, HtmlAttributes, BodyAttributesWithoutEvents } from 'unhead/types';
|
|
2
|
+
import { m as ResolvableValue, o as ResolvableProperties } from './vue.C1egIkvG.mjs';
|
|
3
|
+
|
|
4
|
+
type SafeBodyAttr = ResolvableProperties<Pick<BodyAttributesWithoutEvents, 'id' | 'class' | 'style'> & DataKeys & SchemaAugmentations['bodyAttrs']>;
|
|
5
|
+
type SafeHtmlAttr = ResolvableProperties<Pick<HtmlAttributes, 'id' | 'class' | 'style' | 'lang' | 'dir'> & DataKeys & SchemaAugmentations['htmlAttrs']>;
|
|
6
|
+
type SafeMeta = ResolvableProperties<Pick<UnheadMeta, 'id' | 'name' | 'property' | 'charset' | 'content' | 'media'> & DataKeys & SchemaAugmentations['meta']>;
|
|
7
|
+
type SafeLink = ResolvableProperties<Pick<LinkWithoutEvents, 'id' | 'color' | 'crossorigin' | 'fetchpriority' | 'href' | 'hreflang' | 'imagesrcset' | 'imagesizes' | 'integrity' | 'media' | 'referrerpolicy' | 'rel' | 'sizes' | 'type'> & DataKeys & SchemaAugmentations['link']>;
|
|
8
|
+
type SafeScript = ResolvableProperties<Pick<ScriptWithoutEvents, 'id' | 'type' | 'nonce' | 'blocking'> & DataKeys & {
|
|
9
|
+
textContent?: string;
|
|
10
|
+
} & TagPriority & TagPosition & ResolvesDuplicates & ProcessesTemplateParams>;
|
|
11
|
+
type SafeNoscript = ResolvableProperties<Pick<Noscript, 'id'> & DataKeys & Omit<SchemaAugmentations['noscript'], 'innerHTML'>>;
|
|
12
|
+
type SafeStyle = ResolvableProperties<Pick<Style, 'id' | 'media' | 'nonce' | 'title' | 'blocking'> & DataKeys & Omit<SchemaAugmentations['style'], 'innerHTML'>>;
|
|
13
|
+
interface HeadSafe extends Pick<ResolvableHead, 'title' | 'titleTemplate' | 'templateParams'> {
|
|
14
|
+
/**
|
|
15
|
+
* The `<link>` HTML element specifies relationships between the current document and an external resource.
|
|
16
|
+
* This element is most commonly used to link to stylesheets, but is also used to establish site icons
|
|
17
|
+
* (both "favicon" style icons and icons for the home screen and apps on mobile devices) among other things.
|
|
18
|
+
*
|
|
19
|
+
* @see https://developer.mozilla.org/en-US/docs/Web/HTML/Element/link#attr-as
|
|
20
|
+
*/
|
|
21
|
+
link?: ResolvableValue<ResolvableValue<SafeLink[]>>;
|
|
22
|
+
/**
|
|
23
|
+
* The `<meta>` element represents metadata that cannot be expressed in other HTML elements, like `<link>` or `<script>`.
|
|
24
|
+
*
|
|
25
|
+
* @see https://developer.mozilla.org/en-US/docs/Web/HTML/Element/meta
|
|
26
|
+
*/
|
|
27
|
+
meta?: ResolvableValue<ResolvableValue<SafeMeta>[]>;
|
|
28
|
+
/**
|
|
29
|
+
* The `<style>` HTML element contains style information for a document, or part of a document.
|
|
30
|
+
* It contains CSS, which is applied to the contents of the document containing the `<style>` element.
|
|
31
|
+
*
|
|
32
|
+
* @see https://developer.mozilla.org/en-US/docs/Web/HTML/Element/style
|
|
33
|
+
*/
|
|
34
|
+
style?: ResolvableValue<ResolvableValue<(SafeStyle | string)>[]>;
|
|
35
|
+
/**
|
|
36
|
+
* The `<script>` HTML element is used to embed executable code or data; this is typically used to embed or refer to JavaScript code.
|
|
37
|
+
*
|
|
38
|
+
* @see https://developer.mozilla.org/en-US/docs/Web/HTML/Element/script
|
|
39
|
+
*/
|
|
40
|
+
script?: ResolvableValue<ResolvableValue<(SafeScript | string)>[]>;
|
|
41
|
+
/**
|
|
42
|
+
* The `<noscript>` HTML element defines a section of HTML to be inserted if a script type on the page is unsupported
|
|
43
|
+
* or if scripting is currently turned off in the browser.
|
|
44
|
+
*
|
|
45
|
+
* @see https://developer.mozilla.org/en-US/docs/Web/HTML/Element/noscript
|
|
46
|
+
*/
|
|
47
|
+
noscript?: ResolvableValue<ResolvableValue<(SafeNoscript | string)>[]>;
|
|
48
|
+
/**
|
|
49
|
+
* Attributes for the `<html>` HTML element.
|
|
50
|
+
*
|
|
51
|
+
* @see https://developer.mozilla.org/en-US/docs/Web/HTML/Element/html
|
|
52
|
+
*/
|
|
53
|
+
htmlAttrs?: ResolvableValue<SafeHtmlAttr>;
|
|
54
|
+
/**
|
|
55
|
+
* Attributes for the `<body>` HTML element.
|
|
56
|
+
*
|
|
57
|
+
* @see https://developer.mozilla.org/en-US/docs/Web/HTML/Element/body
|
|
58
|
+
*/
|
|
59
|
+
bodyAttrs?: ResolvableValue<SafeBodyAttr>;
|
|
60
|
+
}
|
|
61
|
+
type UseHeadSafeInput = ResolvableValue<HeadSafe>;
|
|
62
|
+
|
|
63
|
+
export type { HeadSafe as H, SafeBodyAttr as S, UseHeadSafeInput as U, SafeHtmlAttr as a, SafeMeta as b, SafeLink as c, SafeScript as d, SafeNoscript as e, SafeStyle as f };
|