@unhead/vue 2.0.0-alpha.3 → 2.0.0-alpha.30
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 +33 -17
- package/dist/index.d.ts +33 -17
- package/dist/index.mjs +13 -7
- 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.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.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 +24 -100
- package/dist/types.d.ts +24 -100
- 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/types.d.ts +1 -1
- 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 -26
- package/dist/index.d.cts +0 -28
- 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 -142
package/dist/client.d.mts
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { VueHeadClient } from '@unhead/vue';
|
|
1
|
+
import { CreateClientHeadOptions } from 'unhead/types';
|
|
3
2
|
export { V as VueHeadMixin } from './shared/vue.DnywREVF.mjs';
|
|
4
|
-
export
|
|
3
|
+
export { renderDOMHead } from 'unhead/client';
|
|
4
|
+
import { V as VueHeadClient } from './shared/vue.C1egIkvG.mjs';
|
|
5
|
+
import 'vue';
|
|
5
6
|
|
|
6
|
-
declare function createHead
|
|
7
|
+
declare function createHead(options?: CreateClientHeadOptions): VueHeadClient;
|
|
7
8
|
|
|
8
9
|
export { createHead };
|
package/dist/client.d.ts
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { VueHeadClient } from '@unhead/vue';
|
|
1
|
+
import { CreateClientHeadOptions } from 'unhead/types';
|
|
3
2
|
export { V as VueHeadMixin } from './shared/vue.DnywREVF.js';
|
|
4
|
-
export
|
|
3
|
+
export { renderDOMHead } from 'unhead/client';
|
|
4
|
+
import { V as VueHeadClient } from './shared/vue.C1egIkvG.js';
|
|
5
|
+
import 'vue';
|
|
5
6
|
|
|
6
|
-
declare function createHead
|
|
7
|
+
declare function createHead(options?: CreateClientHeadOptions): VueHeadClient;
|
|
7
8
|
|
|
8
9
|
export { createHead };
|
package/dist/client.mjs
CHANGED
|
@@ -1,21 +1,18 @@
|
|
|
1
|
-
import { createHead as createHead$1 } from 'unhead/client';
|
|
2
|
-
export
|
|
1
|
+
import { createHead as createHead$1, createDebouncedFn, renderDOMHead } from 'unhead/client';
|
|
2
|
+
export { renderDOMHead } from 'unhead/client';
|
|
3
3
|
import { nextTick } from 'vue';
|
|
4
|
-
import { v as vueInstall } from './shared/vue.
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
import '
|
|
4
|
+
import { v as vueInstall } from './shared/vue.BYLJNEcq.mjs';
|
|
5
|
+
export { V as VueHeadMixin } from './shared/vue.nvpYXC6D.mjs';
|
|
6
|
+
import 'unhead/plugins';
|
|
7
|
+
import 'unhead/utils';
|
|
8
|
+
import './shared/vue.N9zWjxoK.mjs';
|
|
8
9
|
|
|
9
10
|
function createHead(options = {}) {
|
|
10
11
|
const head = createHead$1({
|
|
11
12
|
domOptions: {
|
|
12
|
-
|
|
13
|
+
render: createDebouncedFn(() => renderDOMHead(head), nextTick)
|
|
13
14
|
},
|
|
14
|
-
...options
|
|
15
|
-
plugins: [
|
|
16
|
-
...options.plugins || [],
|
|
17
|
-
VueReactivityPlugin
|
|
18
|
-
]
|
|
15
|
+
...options
|
|
19
16
|
});
|
|
20
17
|
head.install = vueInstall(head);
|
|
21
18
|
return head;
|
package/dist/components.mjs
CHANGED
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import { defineComponent, ref, onBeforeUnmount, watchEffect } from 'vue';
|
|
2
|
-
import { u as useHead } from './shared/vue.
|
|
3
|
-
import '
|
|
2
|
+
import { u as useHead } from './shared/vue.BYLJNEcq.mjs';
|
|
3
|
+
import 'unhead/plugins';
|
|
4
|
+
import 'unhead/utils';
|
|
5
|
+
import './shared/vue.N9zWjxoK.mjs';
|
|
4
6
|
|
|
5
7
|
function addVNodeToHeadObj(node, obj) {
|
|
6
8
|
const nodeType = node.type;
|
|
@@ -21,10 +23,10 @@ function addVNodeToHeadObj(node, obj) {
|
|
|
21
23
|
}
|
|
22
24
|
function vnodesToHeadObj(nodes) {
|
|
23
25
|
const obj = {
|
|
24
|
-
title:
|
|
25
|
-
htmlAttrs:
|
|
26
|
-
bodyAttrs:
|
|
27
|
-
base:
|
|
26
|
+
title: void 0,
|
|
27
|
+
htmlAttrs: void 0,
|
|
28
|
+
bodyAttrs: void 0,
|
|
29
|
+
base: void 0,
|
|
28
30
|
meta: [],
|
|
29
31
|
link: [],
|
|
30
32
|
style: [],
|
package/dist/index.d.mts
CHANGED
|
@@ -1,28 +1,44 @@
|
|
|
1
|
-
import
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
export {
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
1
|
+
import { createUnhead } from 'unhead';
|
|
2
|
+
export { createUnhead } from 'unhead';
|
|
3
|
+
import { ActiveHeadEntry } from 'unhead/types';
|
|
4
|
+
export { ActiveHeadEntry, AriaAttributes, Base, BodyAttributesWithoutEvents, BodyEvents, DataKeys, GlobalAttributes, Head, HeadEntryOptions, HeadTag, HtmlAttributes, HttpEventAttributes, LinkWithoutEvents, MergeHead, Meta, MetaFlat, MetaFlatInput, Noscript, RenderSSRHeadOptions, ResolvableHead, ScriptWithoutEvents, SerializableResolvedHead, SpeculationRules, Style, Unhead } from 'unhead/types';
|
|
5
|
+
import { V as VueHeadClient, U as UseHeadInput, a as UseHeadOptions, b as UseSeoMetaInput } from './shared/vue.C1egIkvG.mjs';
|
|
6
|
+
export { B as BodyAttr, H as HtmlAttr, M as MaybeFalsy, l as ReactiveHead, n as ResolvableArray, d as ResolvableBase, k as ResolvableBodyAttributes, j as ResolvableHtmlAttributes, e as ResolvableLink, f as ResolvableMeta, i as ResolvableNoscript, o as ResolvableProperties, h as ResolvableScript, g as ResolvableStyle, R as ResolvableTitle, c as ResolvableTitleTemplate, m as ResolvableValue } from './shared/vue.C1egIkvG.mjs';
|
|
7
|
+
import { UseHeadSafeInput } from './types.mjs';
|
|
8
|
+
export { HeadSafe, SafeBodyAttr, SafeHtmlAttr, SafeLink, SafeMeta, SafeNoscript, SafeScript, SafeStyle } from './types.mjs';
|
|
9
|
+
export { resolveUnrefHeadInput } from './utils.mjs';
|
|
8
10
|
export { V as VueHeadMixin } from './shared/vue.DnywREVF.mjs';
|
|
11
|
+
export { useScript } from './scripts.mjs';
|
|
9
12
|
import 'vue';
|
|
13
|
+
import 'unhead/utils';
|
|
14
|
+
import 'unhead/scripts';
|
|
10
15
|
|
|
11
16
|
declare const unheadVueComposablesImports: {
|
|
12
17
|
'@unhead/vue': string[];
|
|
13
18
|
};
|
|
14
19
|
|
|
15
|
-
declare function injectHead(): VueHeadClient
|
|
16
|
-
declare function useHead<
|
|
17
|
-
declare function useHeadSafe(input
|
|
18
|
-
declare function useSeoMeta(input
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
20
|
+
declare function injectHead(): VueHeadClient;
|
|
21
|
+
declare function useHead<I = UseHeadInput>(input?: UseHeadInput, options?: UseHeadOptions): ActiveHeadEntry<I>;
|
|
22
|
+
declare function useHeadSafe(input?: UseHeadSafeInput, options?: UseHeadOptions): ActiveHeadEntry<UseHeadSafeInput>;
|
|
23
|
+
declare function useSeoMeta(input?: UseSeoMetaInput, options?: UseHeadOptions): ActiveHeadEntry<UseSeoMetaInput>;
|
|
24
|
+
/**
|
|
25
|
+
* @deprecated use `useHead` instead.Advanced use cases should tree shake using import.meta.* if statements.
|
|
26
|
+
*/
|
|
27
|
+
declare function useServerHead<I = UseHeadInput>(input?: UseHeadInput, options?: UseHeadOptions): ActiveHeadEntry<I>;
|
|
28
|
+
/**
|
|
29
|
+
* @deprecated use `useHeadSafe` instead.Advanced use cases should tree shake using import.meta.* if statements.
|
|
30
|
+
*/
|
|
31
|
+
declare function useServerHeadSafe(input?: UseHeadSafeInput, options?: UseHeadOptions): ActiveHeadEntry<UseHeadSafeInput>;
|
|
32
|
+
/**
|
|
33
|
+
* @deprecated use `useSeoMeta` instead.Advanced use cases should tree shake using import.meta.* if statements.
|
|
34
|
+
*/
|
|
35
|
+
declare function useServerSeoMeta(input?: UseSeoMetaInput, options?: UseHeadOptions): ActiveHeadEntry<UseSeoMetaInput>;
|
|
36
|
+
|
|
37
|
+
declare const headSymbol = "usehead";
|
|
22
38
|
|
|
23
39
|
/**
|
|
24
|
-
* @deprecated
|
|
40
|
+
* @deprecated Use createUnhead
|
|
25
41
|
*/
|
|
26
|
-
declare const
|
|
42
|
+
declare const createCoreHead: typeof createUnhead;
|
|
27
43
|
|
|
28
|
-
export {
|
|
44
|
+
export { UseHeadInput, UseHeadOptions, UseHeadSafeInput, UseSeoMetaInput, VueHeadClient, createCoreHead, headSymbol, injectHead, unheadVueComposablesImports, useHead, useHeadSafe, useSeoMeta, useServerHead, useServerHeadSafe, useServerSeoMeta };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,28 +1,44 @@
|
|
|
1
|
-
import
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
export {
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
1
|
+
import { createUnhead } from 'unhead';
|
|
2
|
+
export { createUnhead } from 'unhead';
|
|
3
|
+
import { ActiveHeadEntry } from 'unhead/types';
|
|
4
|
+
export { ActiveHeadEntry, AriaAttributes, Base, BodyAttributesWithoutEvents, BodyEvents, DataKeys, GlobalAttributes, Head, HeadEntryOptions, HeadTag, HtmlAttributes, HttpEventAttributes, LinkWithoutEvents, MergeHead, Meta, MetaFlat, MetaFlatInput, Noscript, RenderSSRHeadOptions, ResolvableHead, ScriptWithoutEvents, SerializableResolvedHead, SpeculationRules, Style, Unhead } from 'unhead/types';
|
|
5
|
+
import { V as VueHeadClient, U as UseHeadInput, a as UseHeadOptions, b as UseSeoMetaInput } from './shared/vue.C1egIkvG.js';
|
|
6
|
+
export { B as BodyAttr, H as HtmlAttr, M as MaybeFalsy, l as ReactiveHead, n as ResolvableArray, d as ResolvableBase, k as ResolvableBodyAttributes, j as ResolvableHtmlAttributes, e as ResolvableLink, f as ResolvableMeta, i as ResolvableNoscript, o as ResolvableProperties, h as ResolvableScript, g as ResolvableStyle, R as ResolvableTitle, c as ResolvableTitleTemplate, m as ResolvableValue } from './shared/vue.C1egIkvG.js';
|
|
7
|
+
import { UseHeadSafeInput } from './types.js';
|
|
8
|
+
export { HeadSafe, SafeBodyAttr, SafeHtmlAttr, SafeLink, SafeMeta, SafeNoscript, SafeScript, SafeStyle } from './types.js';
|
|
9
|
+
export { resolveUnrefHeadInput } from './utils.js';
|
|
8
10
|
export { V as VueHeadMixin } from './shared/vue.DnywREVF.js';
|
|
11
|
+
export { useScript } from './scripts.js';
|
|
9
12
|
import 'vue';
|
|
13
|
+
import 'unhead/utils';
|
|
14
|
+
import 'unhead/scripts';
|
|
10
15
|
|
|
11
16
|
declare const unheadVueComposablesImports: {
|
|
12
17
|
'@unhead/vue': string[];
|
|
13
18
|
};
|
|
14
19
|
|
|
15
|
-
declare function injectHead(): VueHeadClient
|
|
16
|
-
declare function useHead<
|
|
17
|
-
declare function useHeadSafe(input
|
|
18
|
-
declare function useSeoMeta(input
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
20
|
+
declare function injectHead(): VueHeadClient;
|
|
21
|
+
declare function useHead<I = UseHeadInput>(input?: UseHeadInput, options?: UseHeadOptions): ActiveHeadEntry<I>;
|
|
22
|
+
declare function useHeadSafe(input?: UseHeadSafeInput, options?: UseHeadOptions): ActiveHeadEntry<UseHeadSafeInput>;
|
|
23
|
+
declare function useSeoMeta(input?: UseSeoMetaInput, options?: UseHeadOptions): ActiveHeadEntry<UseSeoMetaInput>;
|
|
24
|
+
/**
|
|
25
|
+
* @deprecated use `useHead` instead.Advanced use cases should tree shake using import.meta.* if statements.
|
|
26
|
+
*/
|
|
27
|
+
declare function useServerHead<I = UseHeadInput>(input?: UseHeadInput, options?: UseHeadOptions): ActiveHeadEntry<I>;
|
|
28
|
+
/**
|
|
29
|
+
* @deprecated use `useHeadSafe` instead.Advanced use cases should tree shake using import.meta.* if statements.
|
|
30
|
+
*/
|
|
31
|
+
declare function useServerHeadSafe(input?: UseHeadSafeInput, options?: UseHeadOptions): ActiveHeadEntry<UseHeadSafeInput>;
|
|
32
|
+
/**
|
|
33
|
+
* @deprecated use `useSeoMeta` instead.Advanced use cases should tree shake using import.meta.* if statements.
|
|
34
|
+
*/
|
|
35
|
+
declare function useServerSeoMeta(input?: UseSeoMetaInput, options?: UseHeadOptions): ActiveHeadEntry<UseSeoMetaInput>;
|
|
36
|
+
|
|
37
|
+
declare const headSymbol = "usehead";
|
|
22
38
|
|
|
23
39
|
/**
|
|
24
|
-
* @deprecated
|
|
40
|
+
* @deprecated Use createUnhead
|
|
25
41
|
*/
|
|
26
|
-
declare const
|
|
42
|
+
declare const createCoreHead: typeof createUnhead;
|
|
27
43
|
|
|
28
|
-
export {
|
|
44
|
+
export { UseHeadInput, UseHeadOptions, UseHeadSafeInput, UseSeoMetaInput, VueHeadClient, createCoreHead, headSymbol, injectHead, unheadVueComposablesImports, useHead, useHeadSafe, useSeoMeta, useServerHead, useServerHeadSafe, useServerSeoMeta };
|
package/dist/index.mjs
CHANGED
|
@@ -1,13 +1,19 @@
|
|
|
1
|
-
import {
|
|
2
|
-
export {
|
|
3
|
-
export {
|
|
4
|
-
export {
|
|
1
|
+
import { createUnhead } from 'unhead';
|
|
2
|
+
export { createUnhead } from 'unhead';
|
|
3
|
+
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.BYLJNEcq.mjs';
|
|
4
|
+
export { resolveUnrefHeadInput } from './utils.mjs';
|
|
5
|
+
export { V as VueHeadMixin } from './shared/vue.nvpYXC6D.mjs';
|
|
6
|
+
export { u as useScript } from './shared/vue.cHBs6zvy.mjs';
|
|
7
|
+
import 'unhead/plugins';
|
|
8
|
+
import 'unhead/utils';
|
|
5
9
|
import 'vue';
|
|
10
|
+
import './shared/vue.N9zWjxoK.mjs';
|
|
11
|
+
import 'unhead/scripts';
|
|
6
12
|
|
|
7
13
|
const unheadVueComposablesImports = {
|
|
8
|
-
"@unhead/vue": ["injectHead",
|
|
14
|
+
"@unhead/vue": ["injectHead", "useHead", "useSeoMeta", "useHeadSafe", "useServerHead", "useServerSeoMeta", "useServerHeadSafe"]
|
|
9
15
|
};
|
|
10
16
|
|
|
11
|
-
const
|
|
17
|
+
const createCoreHead = createUnhead;
|
|
12
18
|
|
|
13
|
-
export {
|
|
19
|
+
export { createCoreHead, unheadVueComposablesImports };
|
package/dist/legacy.d.mts
CHANGED
|
@@ -1,52 +1,34 @@
|
|
|
1
|
-
import * as
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
import
|
|
7
|
-
import { ScriptInstance, UseScriptStatus, UseScriptOptions as UseScriptOptions$1, UseFunctionType } from 'unhead/legacy';
|
|
8
|
-
export { UseFunctionType, resolveScriptKey } from 'unhead/legacy';
|
|
9
|
-
import { Ref } from 'vue';
|
|
1
|
+
import * as unhead_types from 'unhead/types';
|
|
2
|
+
import { CreateClientHeadOptions, ActiveHeadEntry } from 'unhead/types';
|
|
3
|
+
import { createUnhead } from 'unhead';
|
|
4
|
+
import { V as VueHeadClient, U as UseHeadInput, a as UseHeadOptions, b as UseSeoMetaInput } from './shared/vue.C1egIkvG.mjs';
|
|
5
|
+
import { UseHeadSafeInput } from './types.mjs';
|
|
6
|
+
import 'vue';
|
|
10
7
|
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
});
|
|
17
|
-
interface UseScriptOptions<T extends Record<symbol | string, any> = Record<string, any>> extends Omit<HeadEntryOptions, 'head'>, Pick<UseScriptOptions$1<T>, 'use' | 'eventContext' | 'beforeInit'> {
|
|
18
|
-
/**
|
|
19
|
-
* The trigger to load the script:
|
|
20
|
-
* - `undefined` | `client` - (Default) Load the script on the client when this js is loaded.
|
|
21
|
-
* - `manual` - Load the script manually by calling `$script.load()`, exists only on the client.
|
|
22
|
-
* - `Promise` - Load the script when the promise resolves, exists only on the client.
|
|
23
|
-
* - `Function` - Register a callback function to load the script, exists only on the client.
|
|
24
|
-
* - `server` - Have the script injected on the server.
|
|
25
|
-
* - `ref` - Load the script when the ref is true.
|
|
26
|
-
*/
|
|
27
|
-
trigger?: UseScriptOptions$1['trigger'] | Ref<boolean>;
|
|
28
|
-
/**
|
|
29
|
-
* The Unhead instance to use.
|
|
30
|
-
*/
|
|
31
|
-
head?: UseHeadOptions['head'];
|
|
32
|
-
}
|
|
33
|
-
type UseScriptContext<T extends Record<symbol | string, any>> = Promise<T> & VueScriptInstance<T>;
|
|
34
|
-
type UseScriptReturn<T extends Record<symbol | string, any>> = UseScriptContext<UseFunctionType<UseScriptOptions<T>, T>>;
|
|
35
|
-
declare function useScript<T extends Record<symbol | string, any> = Record<symbol | string, any>>(_input: UseScriptInput, _options?: UseScriptOptions<T>): UseScriptReturn<T>;
|
|
36
|
-
|
|
37
|
-
declare const CapoPlugin: () => _unhead_schema.HeadPluginInput;
|
|
38
|
-
declare function createHead<T extends MergeHead>(options?: CreateClientHeadOptions): VueHeadClient<T>;
|
|
39
|
-
declare function createServerHead<T extends MergeHead>(options?: CreateClientHeadOptions): VueHeadClient<T>;
|
|
8
|
+
declare const createHeadCore: typeof createUnhead;
|
|
9
|
+
declare function resolveUnrefHeadInput(input: any): any;
|
|
10
|
+
declare function CapoPlugin(): unhead_types.HeadPluginInput;
|
|
11
|
+
declare function createHead(options?: CreateClientHeadOptions): VueHeadClient;
|
|
12
|
+
declare function createServerHead(options?: CreateClientHeadOptions): VueHeadClient;
|
|
40
13
|
/**
|
|
41
14
|
* @deprecated Please switch to non-legacy version
|
|
42
15
|
*/
|
|
43
16
|
declare function setHeadInjectionHandler(handler: () => VueHeadClient<any> | undefined): void;
|
|
44
17
|
declare function injectHead(): VueHeadClient<any> | undefined;
|
|
45
|
-
declare function useHead
|
|
46
|
-
declare function useHeadSafe(input: UseHeadSafeInput, options?: UseHeadOptions
|
|
47
|
-
declare function useSeoMeta(input: UseSeoMetaInput, options?: UseHeadOptions
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
18
|
+
declare function useHead(input: UseHeadInput, options?: UseHeadOptions): ActiveHeadEntry<UseHeadInput> | void;
|
|
19
|
+
declare function useHeadSafe(input: UseHeadSafeInput, options?: UseHeadOptions): ActiveHeadEntry<any> | void;
|
|
20
|
+
declare function useSeoMeta(input: UseSeoMetaInput, options?: UseHeadOptions): ActiveHeadEntry<any> | void;
|
|
21
|
+
/**
|
|
22
|
+
* @deprecated use `useHead` instead. Advanced use cases should tree shake using import.meta.* if statements.
|
|
23
|
+
*/
|
|
24
|
+
declare function useServerHead(input: UseHeadInput, options?: UseHeadOptions): ActiveHeadEntry<any> | void;
|
|
25
|
+
/**
|
|
26
|
+
* @deprecated use `useHeadSafe` instead. Advanced use cases should tree shake using import.meta.* if statements.
|
|
27
|
+
*/
|
|
28
|
+
declare function useServerHeadSafe(input: UseHeadSafeInput, options?: UseHeadOptions): ActiveHeadEntry<any> | void;
|
|
29
|
+
/**
|
|
30
|
+
* @deprecated use `useSeoMeta` instead. Advanced use cases should tree shake using import.meta.* if statements.
|
|
31
|
+
*/
|
|
32
|
+
declare function useServerSeoMeta(input: UseSeoMetaInput, options?: UseHeadOptions): ActiveHeadEntry<any> | void;
|
|
51
33
|
|
|
52
|
-
export { CapoPlugin,
|
|
34
|
+
export { CapoPlugin, createHead, createHeadCore, createServerHead, injectHead, resolveUnrefHeadInput, setHeadInjectionHandler, useHead, useHeadSafe, useSeoMeta, useServerHead, useServerHeadSafe, useServerSeoMeta };
|
package/dist/legacy.d.ts
CHANGED
|
@@ -1,52 +1,34 @@
|
|
|
1
|
-
import * as
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
import
|
|
7
|
-
import { ScriptInstance, UseScriptStatus, UseScriptOptions as UseScriptOptions$1, UseFunctionType } from 'unhead/legacy';
|
|
8
|
-
export { UseFunctionType, resolveScriptKey } from 'unhead/legacy';
|
|
9
|
-
import { Ref } from 'vue';
|
|
1
|
+
import * as unhead_types from 'unhead/types';
|
|
2
|
+
import { CreateClientHeadOptions, ActiveHeadEntry } from 'unhead/types';
|
|
3
|
+
import { createUnhead } from 'unhead';
|
|
4
|
+
import { V as VueHeadClient, U as UseHeadInput, a as UseHeadOptions, b as UseSeoMetaInput } from './shared/vue.C1egIkvG.js';
|
|
5
|
+
import { UseHeadSafeInput } from './types.js';
|
|
6
|
+
import 'vue';
|
|
10
7
|
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
});
|
|
17
|
-
interface UseScriptOptions<T extends Record<symbol | string, any> = Record<string, any>> extends Omit<HeadEntryOptions, 'head'>, Pick<UseScriptOptions$1<T>, 'use' | 'eventContext' | 'beforeInit'> {
|
|
18
|
-
/**
|
|
19
|
-
* The trigger to load the script:
|
|
20
|
-
* - `undefined` | `client` - (Default) Load the script on the client when this js is loaded.
|
|
21
|
-
* - `manual` - Load the script manually by calling `$script.load()`, exists only on the client.
|
|
22
|
-
* - `Promise` - Load the script when the promise resolves, exists only on the client.
|
|
23
|
-
* - `Function` - Register a callback function to load the script, exists only on the client.
|
|
24
|
-
* - `server` - Have the script injected on the server.
|
|
25
|
-
* - `ref` - Load the script when the ref is true.
|
|
26
|
-
*/
|
|
27
|
-
trigger?: UseScriptOptions$1['trigger'] | Ref<boolean>;
|
|
28
|
-
/**
|
|
29
|
-
* The Unhead instance to use.
|
|
30
|
-
*/
|
|
31
|
-
head?: UseHeadOptions['head'];
|
|
32
|
-
}
|
|
33
|
-
type UseScriptContext<T extends Record<symbol | string, any>> = Promise<T> & VueScriptInstance<T>;
|
|
34
|
-
type UseScriptReturn<T extends Record<symbol | string, any>> = UseScriptContext<UseFunctionType<UseScriptOptions<T>, T>>;
|
|
35
|
-
declare function useScript<T extends Record<symbol | string, any> = Record<symbol | string, any>>(_input: UseScriptInput, _options?: UseScriptOptions<T>): UseScriptReturn<T>;
|
|
36
|
-
|
|
37
|
-
declare const CapoPlugin: () => _unhead_schema.HeadPluginInput;
|
|
38
|
-
declare function createHead<T extends MergeHead>(options?: CreateClientHeadOptions): VueHeadClient<T>;
|
|
39
|
-
declare function createServerHead<T extends MergeHead>(options?: CreateClientHeadOptions): VueHeadClient<T>;
|
|
8
|
+
declare const createHeadCore: typeof createUnhead;
|
|
9
|
+
declare function resolveUnrefHeadInput(input: any): any;
|
|
10
|
+
declare function CapoPlugin(): unhead_types.HeadPluginInput;
|
|
11
|
+
declare function createHead(options?: CreateClientHeadOptions): VueHeadClient;
|
|
12
|
+
declare function createServerHead(options?: CreateClientHeadOptions): VueHeadClient;
|
|
40
13
|
/**
|
|
41
14
|
* @deprecated Please switch to non-legacy version
|
|
42
15
|
*/
|
|
43
16
|
declare function setHeadInjectionHandler(handler: () => VueHeadClient<any> | undefined): void;
|
|
44
17
|
declare function injectHead(): VueHeadClient<any> | undefined;
|
|
45
|
-
declare function useHead
|
|
46
|
-
declare function useHeadSafe(input: UseHeadSafeInput, options?: UseHeadOptions
|
|
47
|
-
declare function useSeoMeta(input: UseSeoMetaInput, options?: UseHeadOptions
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
18
|
+
declare function useHead(input: UseHeadInput, options?: UseHeadOptions): ActiveHeadEntry<UseHeadInput> | void;
|
|
19
|
+
declare function useHeadSafe(input: UseHeadSafeInput, options?: UseHeadOptions): ActiveHeadEntry<any> | void;
|
|
20
|
+
declare function useSeoMeta(input: UseSeoMetaInput, options?: UseHeadOptions): ActiveHeadEntry<any> | void;
|
|
21
|
+
/**
|
|
22
|
+
* @deprecated use `useHead` instead. Advanced use cases should tree shake using import.meta.* if statements.
|
|
23
|
+
*/
|
|
24
|
+
declare function useServerHead(input: UseHeadInput, options?: UseHeadOptions): ActiveHeadEntry<any> | void;
|
|
25
|
+
/**
|
|
26
|
+
* @deprecated use `useHeadSafe` instead. Advanced use cases should tree shake using import.meta.* if statements.
|
|
27
|
+
*/
|
|
28
|
+
declare function useServerHeadSafe(input: UseHeadSafeInput, options?: UseHeadOptions): ActiveHeadEntry<any> | void;
|
|
29
|
+
/**
|
|
30
|
+
* @deprecated use `useSeoMeta` instead. Advanced use cases should tree shake using import.meta.* if statements.
|
|
31
|
+
*/
|
|
32
|
+
declare function useServerSeoMeta(input: UseSeoMetaInput, options?: UseHeadOptions): ActiveHeadEntry<any> | void;
|
|
51
33
|
|
|
52
|
-
export { CapoPlugin,
|
|
34
|
+
export { CapoPlugin, createHead, createHeadCore, createServerHead, injectHead, resolveUnrefHeadInput, setHeadInjectionHandler, useHead, useHeadSafe, useSeoMeta, useServerHead, useServerHeadSafe, useServerSeoMeta };
|
package/dist/legacy.mjs
CHANGED
|
@@ -1,83 +1,24 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
import { DeprecationsPlugin, PromisesPlugin } from 'unhead/plugins';
|
|
4
|
-
import { getCurrentInstance, onMounted, isRef, watch, onScopeDispose, ref, inject, watchEffect, onBeforeUnmount, onDeactivated, onActivated } from 'vue';
|
|
1
|
+
import { createUnhead } from 'unhead';
|
|
2
|
+
import { inject, ref, watchEffect, unref, watch, getCurrentInstance, onBeforeUnmount, onDeactivated, onActivated } from 'vue';
|
|
5
3
|
import { createHead as createHead$1 } from './client.mjs';
|
|
6
|
-
import { h as headSymbol
|
|
4
|
+
import { h as headSymbol } from './shared/vue.BYLJNEcq.mjs';
|
|
5
|
+
import { V as VueResolver } from './shared/vue.N9zWjxoK.mjs';
|
|
7
6
|
import { createHead as createHead$2 } from './server.mjs';
|
|
8
|
-
import {
|
|
9
|
-
|
|
7
|
+
import { walkResolver } from 'unhead/utils';
|
|
8
|
+
import { defineHeadPlugin, DeprecationsPlugin, PromisesPlugin, TemplateParamsPlugin, AliasSortingPlugin, SafeInputPlugin, FlatMetaPlugin } from 'unhead/plugins';
|
|
10
9
|
import 'unhead/client';
|
|
11
|
-
import './shared/vue.
|
|
12
|
-
import './shared/vue.CNiRntV8.mjs';
|
|
10
|
+
import './shared/vue.nvpYXC6D.mjs';
|
|
13
11
|
import 'unhead/server';
|
|
14
12
|
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
}
|
|
19
|
-
const _registerCb = (key, cb) => {
|
|
20
|
-
if (!script._cbs[key]) {
|
|
21
|
-
cb(script.instance);
|
|
22
|
-
return () => {
|
|
23
|
-
};
|
|
24
|
-
}
|
|
25
|
-
let i = script._cbs[key].push(cb);
|
|
26
|
-
const destroy = () => {
|
|
27
|
-
if (i) {
|
|
28
|
-
script._cbs[key]?.splice(i - 1, 1);
|
|
29
|
-
i = null;
|
|
30
|
-
}
|
|
31
|
-
};
|
|
32
|
-
onScopeDispose(destroy);
|
|
33
|
-
return destroy;
|
|
34
|
-
};
|
|
35
|
-
script.onLoaded = (cb) => _registerCb("loaded", cb);
|
|
36
|
-
script.onError = (cb) => _registerCb("error", cb);
|
|
37
|
-
onScopeDispose(() => {
|
|
38
|
-
script._triggerAbortController?.abort();
|
|
39
|
-
});
|
|
13
|
+
const createHeadCore = createUnhead;
|
|
14
|
+
function resolveUnrefHeadInput(input) {
|
|
15
|
+
return walkResolver(input, VueResolver);
|
|
40
16
|
}
|
|
41
|
-
function
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
const head = options?.head || injectHead();
|
|
45
|
-
options.head = head;
|
|
46
|
-
const scope = getCurrentInstance();
|
|
47
|
-
options.eventContext = scope;
|
|
48
|
-
if (scope && typeof options.trigger === "undefined") {
|
|
49
|
-
options.trigger = onMounted;
|
|
50
|
-
} else if (isRef(options.trigger)) {
|
|
51
|
-
const refTrigger = options.trigger;
|
|
52
|
-
let off;
|
|
53
|
-
options.trigger = new Promise((resolve) => {
|
|
54
|
-
off = watch(refTrigger, (val) => {
|
|
55
|
-
if (val) {
|
|
56
|
-
resolve(true);
|
|
57
|
-
}
|
|
58
|
-
}, {
|
|
59
|
-
immediate: true
|
|
60
|
-
});
|
|
61
|
-
onScopeDispose(() => resolve(false), true);
|
|
62
|
-
}).then((val) => {
|
|
63
|
-
off?.();
|
|
64
|
-
return val;
|
|
65
|
-
});
|
|
66
|
-
}
|
|
67
|
-
head._scriptStatusWatcher = head._scriptStatusWatcher || head.hooks.hook("script:updated", ({ script: s }) => {
|
|
68
|
-
s._statusRef.value = s.status;
|
|
69
|
-
});
|
|
70
|
-
const script = useScript$1(input, options);
|
|
71
|
-
script._statusRef = script._statusRef || ref(script.status);
|
|
72
|
-
registerVueScopeHandlers(script, scope);
|
|
73
|
-
return new Proxy(script, {
|
|
74
|
-
get(_, key, a) {
|
|
75
|
-
return Reflect.get(_, key === "status" ? "_statusRef" : key, a);
|
|
76
|
-
}
|
|
17
|
+
function CapoPlugin() {
|
|
18
|
+
return defineHeadPlugin({
|
|
19
|
+
key: "capo"
|
|
77
20
|
});
|
|
78
21
|
}
|
|
79
|
-
|
|
80
|
-
const CapoPlugin = () => defineHeadPlugin({});
|
|
81
22
|
function createHead(options = {}) {
|
|
82
23
|
return createHead$1({
|
|
83
24
|
disableCapoSorting: true,
|
|
@@ -85,6 +26,8 @@ function createHead(options = {}) {
|
|
|
85
26
|
plugins: [
|
|
86
27
|
DeprecationsPlugin,
|
|
87
28
|
PromisesPlugin,
|
|
29
|
+
TemplateParamsPlugin,
|
|
30
|
+
AliasSortingPlugin,
|
|
88
31
|
...options.plugins || []
|
|
89
32
|
]
|
|
90
33
|
});
|
|
@@ -96,6 +39,8 @@ function createServerHead(options = {}) {
|
|
|
96
39
|
plugins: [
|
|
97
40
|
DeprecationsPlugin,
|
|
98
41
|
PromisesPlugin,
|
|
42
|
+
TemplateParamsPlugin,
|
|
43
|
+
AliasSortingPlugin,
|
|
99
44
|
...options.plugins || []
|
|
100
45
|
]
|
|
101
46
|
});
|
|
@@ -115,7 +60,7 @@ function clientUseHead(head, input, options = {}) {
|
|
|
115
60
|
const deactivated = ref(false);
|
|
116
61
|
const resolvedInput = ref({});
|
|
117
62
|
watchEffect(() => {
|
|
118
|
-
resolvedInput.value = deactivated.value ? {} :
|
|
63
|
+
resolvedInput.value = deactivated.value ? {} : walkResolver(input, (v) => unref(v));
|
|
119
64
|
});
|
|
120
65
|
const entry = head.push(resolvedInput.value, options);
|
|
121
66
|
watch(resolvedInput, (e) => {
|
|
@@ -136,27 +81,25 @@ function clientUseHead(head, input, options = {}) {
|
|
|
136
81
|
return entry;
|
|
137
82
|
}
|
|
138
83
|
function useHeadSafe(input, options = {}) {
|
|
139
|
-
|
|
84
|
+
const head = options.head || injectHead();
|
|
85
|
+
if (head) {
|
|
86
|
+
head.use(SafeInputPlugin);
|
|
87
|
+
options._safe = true;
|
|
88
|
+
return useHead(input, options);
|
|
89
|
+
}
|
|
140
90
|
}
|
|
141
91
|
function useSeoMeta(input, options) {
|
|
142
|
-
const
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
titleTemplate,
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
return {
|
|
154
|
-
// @ts-expect-error runtime type
|
|
155
|
-
...t,
|
|
156
|
-
meta: meta2
|
|
157
|
-
};
|
|
158
|
-
}
|
|
159
|
-
});
|
|
92
|
+
const head = options?.head || injectHead();
|
|
93
|
+
if (head) {
|
|
94
|
+
head.use(FlatMetaPlugin);
|
|
95
|
+
const { title, titleTemplate, ...meta } = input;
|
|
96
|
+
return useHead({
|
|
97
|
+
title,
|
|
98
|
+
titleTemplate,
|
|
99
|
+
// @ts-expect-error runtime type
|
|
100
|
+
_flatMeta: meta
|
|
101
|
+
}, options);
|
|
102
|
+
}
|
|
160
103
|
}
|
|
161
104
|
function useServerHead(input, options = {}) {
|
|
162
105
|
return useHead(input, { ...options, mode: "server" });
|
|
@@ -168,4 +111,4 @@ function useServerSeoMeta(input, options) {
|
|
|
168
111
|
return useSeoMeta(input, { ...options, mode: "server" });
|
|
169
112
|
}
|
|
170
113
|
|
|
171
|
-
export { CapoPlugin, createHead, createServerHead, injectHead, resolveUnrefHeadInput, setHeadInjectionHandler, useHead, useHeadSafe,
|
|
114
|
+
export { CapoPlugin, createHead, createHeadCore, createServerHead, injectHead, resolveUnrefHeadInput, setHeadInjectionHandler, useHead, useHeadSafe, useSeoMeta, useServerHead, useServerHeadSafe, useServerSeoMeta };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from 'unhead/plugins';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from 'unhead/plugins';
|
package/dist/plugins.mjs
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from 'unhead/plugins';
|
|
@@ -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.mjs';
|
|
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 };
|