@unhead/vue 1.10.0-beta.1 → 1.10.0-beta.3
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 +15 -0
- package/dist/index.d.cts +2 -2
- package/dist/index.d.mts +2 -2
- package/dist/index.d.ts +2 -2
- package/dist/index.mjs +16 -1
- package/package.json +4 -4
package/dist/index.cjs
CHANGED
|
@@ -118,6 +118,21 @@ function useScript(_input, _options) {
|
|
|
118
118
|
});
|
|
119
119
|
script = unhead.useScript(input, options);
|
|
120
120
|
script.status = status;
|
|
121
|
+
if (scope) {
|
|
122
|
+
const _registerCb = (key2, cb) => {
|
|
123
|
+
let i = script._cbs[key2].push(cb);
|
|
124
|
+
const destroy = () => {
|
|
125
|
+
if (i) {
|
|
126
|
+
script._cbs[key2].splice(i - 1, 1);
|
|
127
|
+
i = null;
|
|
128
|
+
}
|
|
129
|
+
};
|
|
130
|
+
vue.onScopeDispose(destroy);
|
|
131
|
+
return destroy;
|
|
132
|
+
};
|
|
133
|
+
script.onLoaded = (cb) => _registerCb("loaded", cb);
|
|
134
|
+
script.onError = (cb) => _registerCb("error", cb);
|
|
135
|
+
}
|
|
121
136
|
return script;
|
|
122
137
|
}
|
|
123
138
|
|
package/dist/index.d.cts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
export { CapoPlugin, HashHydrationPlugin, createHeadCore } from 'unhead';
|
|
2
2
|
import * as _unhead_schema from '@unhead/schema';
|
|
3
|
-
import { SafeMeta, SafeLink, SafeNoscript, SafeScript, SafeHtmlAttr, SafeBodyAttr, MergeHead, CreateHeadOptions, ActiveHeadEntry, ScriptInstance, UseScriptStatus, ScriptBase, DataKeys, SchemaAugmentations, AsAsyncFunctionValues, UseScriptOptions } from '@unhead/schema';
|
|
3
|
+
import { SafeMeta, SafeLink, SafeNoscript, SafeScript, SafeHtmlAttr, SafeBodyAttr, MergeHead, CreateHeadOptions, ActiveHeadEntry, ScriptInstance, UseScriptStatus, ScriptBase, DataKeys, SchemaAugmentations, AsAsyncFunctionValues, UseScriptOptions, UseFunctionType } from '@unhead/schema';
|
|
4
4
|
export { ActiveHeadEntry, Head, HeadEntryOptions, HeadTag, MergeHead, Unhead } from '@unhead/schema';
|
|
5
5
|
import { R as ReactiveHead, M as MaybeComputedRefEntries, a as MaybeComputedRef, V as VueHeadClient, U as UseHeadInput, b as UseHeadOptions, c as UseSeoMetaInput, d as MaybeComputedRefEntriesOnly } from './shared/vue.3d788732.cjs';
|
|
6
6
|
export { f as Base, B as BodyAttr, j as BodyAttributes, H as HtmlAttr, i as HtmlAttributes, L as Link, l as MaybeComputedRefOrPromise, k as MaybeReadonlyRef, g as Meta, N as Noscript, h as Script, S as Style, T as Title, e as TitleTemplate } from './shared/vue.3d788732.cjs';
|
|
@@ -61,6 +61,6 @@ type UseScriptContext<T extends Record<symbol | string, any>> = (Promise<T> & Vu
|
|
|
61
61
|
*/
|
|
62
62
|
$script: Promise<T> & VueScriptInstance<T>;
|
|
63
63
|
};
|
|
64
|
-
declare function useScript<T extends Record<symbol | string, any>>(_input: UseScriptInput, _options?: UseScriptOptions<T>): UseScriptContext<T
|
|
64
|
+
declare function useScript<T extends Record<symbol | string, any> = Record<symbol | string, any>, U = Record<symbol | string, any>>(_input: UseScriptInput, _options?: UseScriptOptions<T, U>): UseScriptContext<UseFunctionType<UseScriptOptions<T, U>, T>>;
|
|
65
65
|
|
|
66
66
|
export { type HeadSafe, MaybeComputedRef, MaybeComputedRefEntries, MaybeComputedRefEntriesOnly, ReactiveHead, UseHeadInput, UseHeadOptions, type UseHeadSafeInput, type UseScriptContext, 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
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
export { CapoPlugin, HashHydrationPlugin, createHeadCore } from 'unhead';
|
|
2
2
|
import * as _unhead_schema from '@unhead/schema';
|
|
3
|
-
import { SafeMeta, SafeLink, SafeNoscript, SafeScript, SafeHtmlAttr, SafeBodyAttr, MergeHead, CreateHeadOptions, ActiveHeadEntry, ScriptInstance, UseScriptStatus, ScriptBase, DataKeys, SchemaAugmentations, AsAsyncFunctionValues, UseScriptOptions } from '@unhead/schema';
|
|
3
|
+
import { SafeMeta, SafeLink, SafeNoscript, SafeScript, SafeHtmlAttr, SafeBodyAttr, MergeHead, CreateHeadOptions, ActiveHeadEntry, ScriptInstance, UseScriptStatus, ScriptBase, DataKeys, SchemaAugmentations, AsAsyncFunctionValues, UseScriptOptions, UseFunctionType } from '@unhead/schema';
|
|
4
4
|
export { ActiveHeadEntry, Head, HeadEntryOptions, HeadTag, MergeHead, Unhead } from '@unhead/schema';
|
|
5
5
|
import { R as ReactiveHead, M as MaybeComputedRefEntries, a as MaybeComputedRef, V as VueHeadClient, U as UseHeadInput, b as UseHeadOptions, c as UseSeoMetaInput, d as MaybeComputedRefEntriesOnly } from './shared/vue.3d788732.mjs';
|
|
6
6
|
export { f as Base, B as BodyAttr, j as BodyAttributes, H as HtmlAttr, i as HtmlAttributes, L as Link, l as MaybeComputedRefOrPromise, k as MaybeReadonlyRef, g as Meta, N as Noscript, h as Script, S as Style, T as Title, e as TitleTemplate } from './shared/vue.3d788732.mjs';
|
|
@@ -61,6 +61,6 @@ type UseScriptContext<T extends Record<symbol | string, any>> = (Promise<T> & Vu
|
|
|
61
61
|
*/
|
|
62
62
|
$script: Promise<T> & VueScriptInstance<T>;
|
|
63
63
|
};
|
|
64
|
-
declare function useScript<T extends Record<symbol | string, any>>(_input: UseScriptInput, _options?: UseScriptOptions<T>): UseScriptContext<T
|
|
64
|
+
declare function useScript<T extends Record<symbol | string, any> = Record<symbol | string, any>, U = Record<symbol | string, any>>(_input: UseScriptInput, _options?: UseScriptOptions<T, U>): UseScriptContext<UseFunctionType<UseScriptOptions<T, U>, T>>;
|
|
65
65
|
|
|
66
66
|
export { type HeadSafe, MaybeComputedRef, MaybeComputedRefEntries, MaybeComputedRefEntriesOnly, ReactiveHead, UseHeadInput, UseHeadOptions, type UseHeadSafeInput, type UseScriptContext, 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
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
export { CapoPlugin, HashHydrationPlugin, createHeadCore } from 'unhead';
|
|
2
2
|
import * as _unhead_schema from '@unhead/schema';
|
|
3
|
-
import { SafeMeta, SafeLink, SafeNoscript, SafeScript, SafeHtmlAttr, SafeBodyAttr, MergeHead, CreateHeadOptions, ActiveHeadEntry, ScriptInstance, UseScriptStatus, ScriptBase, DataKeys, SchemaAugmentations, AsAsyncFunctionValues, UseScriptOptions } from '@unhead/schema';
|
|
3
|
+
import { SafeMeta, SafeLink, SafeNoscript, SafeScript, SafeHtmlAttr, SafeBodyAttr, MergeHead, CreateHeadOptions, ActiveHeadEntry, ScriptInstance, UseScriptStatus, ScriptBase, DataKeys, SchemaAugmentations, AsAsyncFunctionValues, UseScriptOptions, UseFunctionType } from '@unhead/schema';
|
|
4
4
|
export { ActiveHeadEntry, Head, HeadEntryOptions, HeadTag, MergeHead, Unhead } from '@unhead/schema';
|
|
5
5
|
import { R as ReactiveHead, M as MaybeComputedRefEntries, a as MaybeComputedRef, V as VueHeadClient, U as UseHeadInput, b as UseHeadOptions, c as UseSeoMetaInput, d as MaybeComputedRefEntriesOnly } from './shared/vue.3d788732.js';
|
|
6
6
|
export { f as Base, B as BodyAttr, j as BodyAttributes, H as HtmlAttr, i as HtmlAttributes, L as Link, l as MaybeComputedRefOrPromise, k as MaybeReadonlyRef, g as Meta, N as Noscript, h as Script, S as Style, T as Title, e as TitleTemplate } from './shared/vue.3d788732.js';
|
|
@@ -61,6 +61,6 @@ type UseScriptContext<T extends Record<symbol | string, any>> = (Promise<T> & Vu
|
|
|
61
61
|
*/
|
|
62
62
|
$script: Promise<T> & VueScriptInstance<T>;
|
|
63
63
|
};
|
|
64
|
-
declare function useScript<T extends Record<symbol | string, any>>(_input: UseScriptInput, _options?: UseScriptOptions<T>): UseScriptContext<T
|
|
64
|
+
declare function useScript<T extends Record<symbol | string, any> = Record<symbol | string, any>, U = Record<symbol | string, any>>(_input: UseScriptInput, _options?: UseScriptOptions<T, U>): UseScriptContext<UseFunctionType<UseScriptOptions<T, U>, T>>;
|
|
65
65
|
|
|
66
66
|
export { type HeadSafe, MaybeComputedRef, MaybeComputedRefEntries, MaybeComputedRefEntriesOnly, ReactiveHead, UseHeadInput, UseHeadOptions, type UseHeadSafeInput, type UseScriptContext, 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 { resolveScriptKey, 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.40986ab9.mjs';
|
|
4
4
|
export { c as createHead, a as createServerHead, r as resolveUnrefHeadInput, s as setHeadInjectionHandler } from './shared/vue.40986ab9.mjs';
|
|
5
|
-
import { getCurrentInstance, onMounted, ref } from 'vue';
|
|
5
|
+
import { getCurrentInstance, onMounted, ref, onScopeDispose } from 'vue';
|
|
6
6
|
import { u as useHead } from './shared/vue.65b7bcda.mjs';
|
|
7
7
|
import { composableNames, whitelistSafeInput, unpackMeta } from '@unhead/shared';
|
|
8
8
|
|
|
@@ -118,6 +118,21 @@ function useScript(_input, _options) {
|
|
|
118
118
|
});
|
|
119
119
|
script = useScript$1(input, options);
|
|
120
120
|
script.status = status;
|
|
121
|
+
if (scope) {
|
|
122
|
+
const _registerCb = (key2, cb) => {
|
|
123
|
+
let i = script._cbs[key2].push(cb);
|
|
124
|
+
const destroy = () => {
|
|
125
|
+
if (i) {
|
|
126
|
+
script._cbs[key2].splice(i - 1, 1);
|
|
127
|
+
i = null;
|
|
128
|
+
}
|
|
129
|
+
};
|
|
130
|
+
onScopeDispose(destroy);
|
|
131
|
+
return destroy;
|
|
132
|
+
};
|
|
133
|
+
script.onLoaded = (cb) => _registerCb("loaded", cb);
|
|
134
|
+
script.onError = (cb) => _registerCb("error", cb);
|
|
135
|
+
}
|
|
121
136
|
return script;
|
|
122
137
|
}
|
|
123
138
|
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@unhead/vue",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "1.10.0-beta.
|
|
4
|
+
"version": "1.10.0-beta.3",
|
|
5
5
|
"author": "Harlan Wilton <harlan@harlanzw.com>",
|
|
6
6
|
"license": "MIT",
|
|
7
7
|
"funding": "https://github.com/sponsors/harlan-zw",
|
|
@@ -66,9 +66,9 @@
|
|
|
66
66
|
},
|
|
67
67
|
"dependencies": {
|
|
68
68
|
"hookable": "^5.5.3",
|
|
69
|
-
"@unhead/schema": "1.10.0-beta.
|
|
70
|
-
"
|
|
71
|
-
"unhead": "1.10.0-beta.
|
|
69
|
+
"@unhead/schema": "1.10.0-beta.3",
|
|
70
|
+
"unhead": "1.10.0-beta.3",
|
|
71
|
+
"@unhead/shared": "1.10.0-beta.3"
|
|
72
72
|
},
|
|
73
73
|
"scripts": {
|
|
74
74
|
"build": "unbuild .",
|