@unhead/vue 1.8.0-beta.5 → 1.8.0-beta.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 CHANGED
@@ -103,10 +103,12 @@ function useScript(_input, _options) {
103
103
  const status = vue.ref("awaitingLoad");
104
104
  shared.NetworkEvents.forEach((fn) => {
105
105
  const _fn = typeof input[fn] === "function" ? input[fn].bind(ctx) : null;
106
- input[fn] = (e) => {
107
- status.value = fn === "onload" ? "loaded" : fn === "onerror" ? "error" : "loading";
108
- _fn && _fn(e);
109
- };
106
+ if (_fn) {
107
+ input[fn] = (e) => {
108
+ status.value = fn === "onload" ? "loaded" : fn === "onerror" ? "error" : "loading";
109
+ _fn && _fn(e);
110
+ };
111
+ }
110
112
  });
111
113
  options.stub = ({ script, fn }) => {
112
114
  if (fn === "$script") {
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, UseScriptStatus, UseScriptInput, UseScriptOptions } from '@unhead/schema';
3
+ import { SafeMeta, SafeLink, SafeNoscript, SafeScript, SafeHtmlAttr, SafeBodyAttr, MergeHead, CreateHeadOptions, ActiveHeadEntry, ScriptInstance, UseScriptStatus, UseScriptInput, UseScriptOptions } 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 } from './shared/vue.44f175ba.cjs';
6
6
  export { e as Base, B as BodyAttr, i as BodyAttributes, H as HtmlAttr, h as HtmlAttributes, L as Link, k as MaybeComputedRefOrPromise, j as MaybeReadonlyRef, f as Meta, N as Noscript, g as Script, S as Style, T as Title, d as TitleTemplate } from './shared/vue.44f175ba.cjs';
@@ -52,10 +52,9 @@ declare function useServerHeadSafe(input: UseHeadSafeInput, options?: UseHeadOpt
52
52
 
53
53
  declare function useServerSeoMeta(input: UseSeoMetaInput, options?: UseHeadOptions): ActiveHeadEntry<any> | void;
54
54
 
55
- interface VueScriptInstance<T> {
55
+ interface VueScriptInstance<T> extends Omit<ScriptInstance<T>, 'loaded' | 'status'> {
56
56
  loaded: ComputedRef<boolean>;
57
57
  status: Ref<UseScriptStatus>;
58
- waitForUse: () => Promise<T>;
59
58
  }
60
59
  declare function useScript<T>(_input: MaybeComputedRefEntries<UseScriptInput>, _options?: UseScriptOptions<T>): T & {
61
60
  $script: VueScriptInstance<T>;
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, UseScriptStatus, UseScriptInput, UseScriptOptions } from '@unhead/schema';
3
+ import { SafeMeta, SafeLink, SafeNoscript, SafeScript, SafeHtmlAttr, SafeBodyAttr, MergeHead, CreateHeadOptions, ActiveHeadEntry, ScriptInstance, UseScriptStatus, UseScriptInput, UseScriptOptions } 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 } from './shared/vue.44f175ba.mjs';
6
6
  export { e as Base, B as BodyAttr, i as BodyAttributes, H as HtmlAttr, h as HtmlAttributes, L as Link, k as MaybeComputedRefOrPromise, j as MaybeReadonlyRef, f as Meta, N as Noscript, g as Script, S as Style, T as Title, d as TitleTemplate } from './shared/vue.44f175ba.mjs';
@@ -52,10 +52,9 @@ declare function useServerHeadSafe(input: UseHeadSafeInput, options?: UseHeadOpt
52
52
 
53
53
  declare function useServerSeoMeta(input: UseSeoMetaInput, options?: UseHeadOptions): ActiveHeadEntry<any> | void;
54
54
 
55
- interface VueScriptInstance<T> {
55
+ interface VueScriptInstance<T> extends Omit<ScriptInstance<T>, 'loaded' | 'status'> {
56
56
  loaded: ComputedRef<boolean>;
57
57
  status: Ref<UseScriptStatus>;
58
- waitForUse: () => Promise<T>;
59
58
  }
60
59
  declare function useScript<T>(_input: MaybeComputedRefEntries<UseScriptInput>, _options?: UseScriptOptions<T>): T & {
61
60
  $script: VueScriptInstance<T>;
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, UseScriptStatus, UseScriptInput, UseScriptOptions } from '@unhead/schema';
3
+ import { SafeMeta, SafeLink, SafeNoscript, SafeScript, SafeHtmlAttr, SafeBodyAttr, MergeHead, CreateHeadOptions, ActiveHeadEntry, ScriptInstance, UseScriptStatus, UseScriptInput, UseScriptOptions } 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 } from './shared/vue.44f175ba.js';
6
6
  export { e as Base, B as BodyAttr, i as BodyAttributes, H as HtmlAttr, h as HtmlAttributes, L as Link, k as MaybeComputedRefOrPromise, j as MaybeReadonlyRef, f as Meta, N as Noscript, g as Script, S as Style, T as Title, d as TitleTemplate } from './shared/vue.44f175ba.js';
@@ -52,10 +52,9 @@ declare function useServerHeadSafe(input: UseHeadSafeInput, options?: UseHeadOpt
52
52
 
53
53
  declare function useServerSeoMeta(input: UseSeoMetaInput, options?: UseHeadOptions): ActiveHeadEntry<any> | void;
54
54
 
55
- interface VueScriptInstance<T> {
55
+ interface VueScriptInstance<T> extends Omit<ScriptInstance<T>, 'loaded' | 'status'> {
56
56
  loaded: ComputedRef<boolean>;
57
57
  status: Ref<UseScriptStatus>;
58
- waitForUse: () => Promise<T>;
59
58
  }
60
59
  declare function useScript<T>(_input: MaybeComputedRefEntries<UseScriptInput>, _options?: UseScriptOptions<T>): T & {
61
60
  $script: VueScriptInstance<T>;
package/dist/index.mjs CHANGED
@@ -103,10 +103,12 @@ function useScript(_input, _options) {
103
103
  const status = ref("awaitingLoad");
104
104
  NetworkEvents.forEach((fn) => {
105
105
  const _fn = typeof input[fn] === "function" ? input[fn].bind(ctx) : null;
106
- input[fn] = (e) => {
107
- status.value = fn === "onload" ? "loaded" : fn === "onerror" ? "error" : "loading";
108
- _fn && _fn(e);
109
- };
106
+ if (_fn) {
107
+ input[fn] = (e) => {
108
+ status.value = fn === "onload" ? "loaded" : fn === "onerror" ? "error" : "loading";
109
+ _fn && _fn(e);
110
+ };
111
+ }
110
112
  });
111
113
  options.stub = ({ script, fn }) => {
112
114
  if (fn === "$script") {
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@unhead/vue",
3
3
  "type": "module",
4
- "version": "1.8.0-beta.5",
4
+ "version": "1.8.0-beta.7",
5
5
  "author": "Harlan Wilton <harlan@harlanzw.com>",
6
6
  "license": "MIT",
7
7
  "funding": "https://github.com/sponsors/harlan-zw",
@@ -48,9 +48,9 @@
48
48
  },
49
49
  "dependencies": {
50
50
  "hookable": "^5.5.3",
51
- "@unhead/schema": "1.8.0-beta.5",
52
- "@unhead/shared": "1.8.0-beta.5",
53
- "unhead": "1.8.0-beta.5"
51
+ "@unhead/schema": "1.8.0-beta.7",
52
+ "@unhead/shared": "1.8.0-beta.7",
53
+ "unhead": "1.8.0-beta.7"
54
54
  },
55
55
  "devDependencies": {
56
56
  "vue": "^3.3.4"