@unhead/vue 1.9.5 → 1.9.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.cjs +7 -4
- package/dist/index.d.cts +3 -3
- package/dist/index.d.mts +3 -3
- package/dist/index.d.ts +3 -3
- package/dist/index.mjs +8 -5
- package/package.json +5 -5
package/dist/index.cjs
CHANGED
|
@@ -109,14 +109,17 @@ function useScript(_input, _options) {
|
|
|
109
109
|
return stubOptions?.({ script, fn });
|
|
110
110
|
};
|
|
111
111
|
let instance;
|
|
112
|
-
const
|
|
112
|
+
const _ = head.hooks.hook("script:updated", ({ script }) => {
|
|
113
113
|
if (instance && script.id === instance.$script.id) {
|
|
114
114
|
status.value = script.status;
|
|
115
|
-
|
|
116
|
-
rmHook();
|
|
115
|
+
script.status === "removed" && _();
|
|
117
116
|
}
|
|
118
117
|
});
|
|
119
|
-
|
|
118
|
+
const scope = vue.getCurrentInstance();
|
|
119
|
+
if (scope && !options.trigger)
|
|
120
|
+
options.trigger = vue.onMounted;
|
|
121
|
+
instance = unhead.useScript(input, options);
|
|
122
|
+
return instance;
|
|
120
123
|
}
|
|
121
124
|
|
|
122
125
|
exports.CapoPlugin = unhead.CapoPlugin;
|
package/dist/index.d.cts
CHANGED
|
@@ -49,14 +49,14 @@ declare function useServerHeadSafe(input: UseHeadSafeInput, options?: UseHeadOpt
|
|
|
49
49
|
|
|
50
50
|
declare function useServerSeoMeta(input: UseSeoMetaInput, options?: UseHeadOptions): ActiveHeadEntry<any> | void;
|
|
51
51
|
|
|
52
|
-
interface VueScriptInstance<T> extends Omit<ScriptInstance<T>, '
|
|
52
|
+
interface VueScriptInstance<T> extends Omit<ScriptInstance<T>, 'status'> {
|
|
53
53
|
status: Ref<UseScriptStatus>;
|
|
54
54
|
}
|
|
55
55
|
type UseScriptInput = string | (MaybeComputedRefEntriesOnly<Omit<ScriptBase & DataKeys & SchemaAugmentations['script'], 'src'>> & {
|
|
56
56
|
src: string;
|
|
57
57
|
});
|
|
58
|
-
declare function useScript<T
|
|
59
|
-
$script: VueScriptInstance<T>;
|
|
58
|
+
declare function useScript<T extends Record<symbol | string, any>>(_input: UseScriptInput, _options?: UseScriptOptions<T>): T & {
|
|
59
|
+
$script: VueScriptInstance<T> & Promise<T>;
|
|
60
60
|
};
|
|
61
61
|
|
|
62
62
|
export { type HeadSafe, MaybeComputedRef, MaybeComputedRefEntries, MaybeComputedRefEntriesOnly, ReactiveHead, UseHeadInput, UseHeadOptions, type UseHeadSafeInput, type UseScriptInput, UseSeoMetaInput, Vue2ProvideUnheadPlugin, VueHeadClient, VueHeadMixin, type VueScriptInstance, createHead, createServerHead, injectHead, resolveUnrefHeadInput, setHeadInjectionHandler, unheadVueComposablesImports, useHead, useHeadSafe, useScript, useSeoMeta, useServerHead, useServerHeadSafe, useServerSeoMeta };
|
package/dist/index.d.mts
CHANGED
|
@@ -49,14 +49,14 @@ declare function useServerHeadSafe(input: UseHeadSafeInput, options?: UseHeadOpt
|
|
|
49
49
|
|
|
50
50
|
declare function useServerSeoMeta(input: UseSeoMetaInput, options?: UseHeadOptions): ActiveHeadEntry<any> | void;
|
|
51
51
|
|
|
52
|
-
interface VueScriptInstance<T> extends Omit<ScriptInstance<T>, '
|
|
52
|
+
interface VueScriptInstance<T> extends Omit<ScriptInstance<T>, 'status'> {
|
|
53
53
|
status: Ref<UseScriptStatus>;
|
|
54
54
|
}
|
|
55
55
|
type UseScriptInput = string | (MaybeComputedRefEntriesOnly<Omit<ScriptBase & DataKeys & SchemaAugmentations['script'], 'src'>> & {
|
|
56
56
|
src: string;
|
|
57
57
|
});
|
|
58
|
-
declare function useScript<T
|
|
59
|
-
$script: VueScriptInstance<T>;
|
|
58
|
+
declare function useScript<T extends Record<symbol | string, any>>(_input: UseScriptInput, _options?: UseScriptOptions<T>): T & {
|
|
59
|
+
$script: VueScriptInstance<T> & Promise<T>;
|
|
60
60
|
};
|
|
61
61
|
|
|
62
62
|
export { type HeadSafe, MaybeComputedRef, MaybeComputedRefEntries, MaybeComputedRefEntriesOnly, ReactiveHead, UseHeadInput, UseHeadOptions, type UseHeadSafeInput, type UseScriptInput, UseSeoMetaInput, Vue2ProvideUnheadPlugin, VueHeadClient, VueHeadMixin, type VueScriptInstance, createHead, createServerHead, injectHead, resolveUnrefHeadInput, setHeadInjectionHandler, unheadVueComposablesImports, useHead, useHeadSafe, useScript, useSeoMeta, useServerHead, useServerHeadSafe, useServerSeoMeta };
|
package/dist/index.d.ts
CHANGED
|
@@ -49,14 +49,14 @@ declare function useServerHeadSafe(input: UseHeadSafeInput, options?: UseHeadOpt
|
|
|
49
49
|
|
|
50
50
|
declare function useServerSeoMeta(input: UseSeoMetaInput, options?: UseHeadOptions): ActiveHeadEntry<any> | void;
|
|
51
51
|
|
|
52
|
-
interface VueScriptInstance<T> extends Omit<ScriptInstance<T>, '
|
|
52
|
+
interface VueScriptInstance<T> extends Omit<ScriptInstance<T>, 'status'> {
|
|
53
53
|
status: Ref<UseScriptStatus>;
|
|
54
54
|
}
|
|
55
55
|
type UseScriptInput = string | (MaybeComputedRefEntriesOnly<Omit<ScriptBase & DataKeys & SchemaAugmentations['script'], 'src'>> & {
|
|
56
56
|
src: string;
|
|
57
57
|
});
|
|
58
|
-
declare function useScript<T
|
|
59
|
-
$script: VueScriptInstance<T>;
|
|
58
|
+
declare function useScript<T extends Record<symbol | string, any>>(_input: UseScriptInput, _options?: UseScriptOptions<T>): T & {
|
|
59
|
+
$script: VueScriptInstance<T> & Promise<T>;
|
|
60
60
|
};
|
|
61
61
|
|
|
62
62
|
export { type HeadSafe, MaybeComputedRef, MaybeComputedRefEntries, MaybeComputedRefEntriesOnly, ReactiveHead, UseHeadInput, UseHeadOptions, type UseHeadSafeInput, type UseScriptInput, UseSeoMetaInput, Vue2ProvideUnheadPlugin, VueHeadClient, VueHeadMixin, type VueScriptInstance, createHead, createServerHead, injectHead, resolveUnrefHeadInput, setHeadInjectionHandler, unheadVueComposablesImports, useHead, useHeadSafe, useScript, useSeoMeta, useServerHead, useServerHeadSafe, useServerSeoMeta };
|
package/dist/index.mjs
CHANGED
|
@@ -2,7 +2,7 @@ import { useScript as useScript$1 } from 'unhead';
|
|
|
2
2
|
export { CapoPlugin, HashHydrationPlugin, createHeadCore } from 'unhead';
|
|
3
3
|
import { V as Vue3, h as headSymbol, i as injectHead } from './shared/vue.cf295fb1.mjs';
|
|
4
4
|
export { c as createHead, a as createServerHead, r as resolveUnrefHeadInput, s as setHeadInjectionHandler } from './shared/vue.cf295fb1.mjs';
|
|
5
|
-
import { getCurrentInstance, ref } from 'vue';
|
|
5
|
+
import { getCurrentInstance, ref, onMounted } from 'vue';
|
|
6
6
|
import { u as useHead } from './shared/vue.f36acd1f.mjs';
|
|
7
7
|
import { composableNames, whitelistSafeInput, unpackMeta } from '@unhead/shared';
|
|
8
8
|
|
|
@@ -109,14 +109,17 @@ function useScript(_input, _options) {
|
|
|
109
109
|
return stubOptions?.({ script, fn });
|
|
110
110
|
};
|
|
111
111
|
let instance;
|
|
112
|
-
const
|
|
112
|
+
const _ = head.hooks.hook("script:updated", ({ script }) => {
|
|
113
113
|
if (instance && script.id === instance.$script.id) {
|
|
114
114
|
status.value = script.status;
|
|
115
|
-
|
|
116
|
-
rmHook();
|
|
115
|
+
script.status === "removed" && _();
|
|
117
116
|
}
|
|
118
117
|
});
|
|
119
|
-
|
|
118
|
+
const scope = getCurrentInstance();
|
|
119
|
+
if (scope && !options.trigger)
|
|
120
|
+
options.trigger = onMounted;
|
|
121
|
+
instance = useScript$1(input, options);
|
|
122
|
+
return instance;
|
|
120
123
|
}
|
|
121
124
|
|
|
122
125
|
export { Vue2ProvideUnheadPlugin, VueHeadMixin, injectHead, unheadVueComposablesImports, useHead, useHeadSafe, useScript, useSeoMeta, useServerHead, useServerHeadSafe, useServerSeoMeta };
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@unhead/vue",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "1.9.
|
|
4
|
+
"version": "1.9.7",
|
|
5
5
|
"author": "Harlan Wilton <harlan@harlanzw.com>",
|
|
6
6
|
"license": "MIT",
|
|
7
7
|
"funding": "https://github.com/sponsors/harlan-zw",
|
|
@@ -61,12 +61,12 @@
|
|
|
61
61
|
},
|
|
62
62
|
"dependencies": {
|
|
63
63
|
"hookable": "^5.5.3",
|
|
64
|
-
"@unhead/
|
|
65
|
-
"
|
|
66
|
-
"unhead": "1.9.
|
|
64
|
+
"@unhead/shared": "1.9.7",
|
|
65
|
+
"unhead": "1.9.7",
|
|
66
|
+
"@unhead/schema": "1.9.7"
|
|
67
67
|
},
|
|
68
68
|
"devDependencies": {
|
|
69
|
-
"vue": "^3.4.
|
|
69
|
+
"vue": "^3.4.23"
|
|
70
70
|
},
|
|
71
71
|
"scripts": {
|
|
72
72
|
"build": "unbuild .",
|