@unhead/vue 1.5.5 → 1.6.1

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.d.cts CHANGED
@@ -21,10 +21,16 @@ declare function createHead<T extends MergeHead>(options?: CreateHeadOptions): V
21
21
 
22
22
  declare function resolveUnrefHeadInput(ref: any, lastKey?: string | number): any;
23
23
 
24
+ /**
25
+ * @deprecated No longer needed for Vue2 if using UnheadPlugin. Import { HeadOptions } from `@unhead/vue/vue2` and use Vue.mixin(HeadOptions) instead.
26
+ */
24
27
  declare const VueHeadMixin: {
25
28
  created(): void;
26
29
  };
27
30
 
31
+ /**
32
+ * @deprecated Import { UnheadPlugin } from `@unhead/vue/vue2` and use Vue.mixin(UnheadPlugin(head)) instead.
33
+ */
28
34
  declare const Vue2ProvideUnheadPlugin: Plugin;
29
35
 
30
36
  declare const unheadVueComposablesImports: {
package/dist/index.d.mts CHANGED
@@ -21,10 +21,16 @@ declare function createHead<T extends MergeHead>(options?: CreateHeadOptions): V
21
21
 
22
22
  declare function resolveUnrefHeadInput(ref: any, lastKey?: string | number): any;
23
23
 
24
+ /**
25
+ * @deprecated No longer needed for Vue2 if using UnheadPlugin. Import { HeadOptions } from `@unhead/vue/vue2` and use Vue.mixin(HeadOptions) instead.
26
+ */
24
27
  declare const VueHeadMixin: {
25
28
  created(): void;
26
29
  };
27
30
 
31
+ /**
32
+ * @deprecated Import { UnheadPlugin } from `@unhead/vue/vue2` and use Vue.mixin(UnheadPlugin(head)) instead.
33
+ */
28
34
  declare const Vue2ProvideUnheadPlugin: Plugin;
29
35
 
30
36
  declare const unheadVueComposablesImports: {
package/dist/index.d.ts CHANGED
@@ -21,10 +21,16 @@ declare function createHead<T extends MergeHead>(options?: CreateHeadOptions): V
21
21
 
22
22
  declare function resolveUnrefHeadInput(ref: any, lastKey?: string | number): any;
23
23
 
24
+ /**
25
+ * @deprecated No longer needed for Vue2 if using UnheadPlugin. Import { HeadOptions } from `@unhead/vue/vue2` and use Vue.mixin(HeadOptions) instead.
26
+ */
24
27
  declare const VueHeadMixin: {
25
28
  created(): void;
26
29
  };
27
30
 
31
+ /**
32
+ * @deprecated Import { UnheadPlugin } from `@unhead/vue/vue2` and use Vue.mixin(UnheadPlugin(head)) instead.
33
+ */
28
34
  declare const Vue2ProvideUnheadPlugin: Plugin;
29
35
 
30
36
  declare const unheadVueComposablesImports: {
package/dist/vue2.cjs ADDED
@@ -0,0 +1,50 @@
1
+ 'use strict';
2
+
3
+ const vue = require('vue');
4
+ const useHead = require('./shared/vue.9cf7ea21.cjs');
5
+ require('unhead');
6
+ require('@unhead/shared');
7
+
8
+ const HeadOptions = {
9
+ created() {
10
+ let source = false;
11
+ if (useHead.Vue3) {
12
+ const instance = vue.getCurrentInstance();
13
+ if (!instance)
14
+ return;
15
+ const options = instance.type;
16
+ if (!options || !("head" in options))
17
+ return;
18
+ source = typeof options.head === "function" ? () => options.head.call(instance.proxy) : options.head;
19
+ } else {
20
+ const head = this.$options.head;
21
+ if (head) {
22
+ source = typeof head === "function" ? () => head.call(this) : head;
23
+ }
24
+ }
25
+ source && useHead.useHead(source);
26
+ }
27
+ };
28
+ function UnheadPlugin(head) {
29
+ return {
30
+ ...HeadOptions,
31
+ beforeCreate() {
32
+ const options = this.$options;
33
+ const origProvide = options.provide;
34
+ options.provide = function() {
35
+ let origProvideResult;
36
+ if (typeof origProvide === "function")
37
+ origProvideResult = origProvide.call(this);
38
+ else
39
+ origProvideResult = origProvide || {};
40
+ return {
41
+ ...origProvideResult,
42
+ [useHead.headSymbol]: head
43
+ };
44
+ };
45
+ }
46
+ };
47
+ }
48
+
49
+ exports.HeadOptions = HeadOptions;
50
+ exports.UnheadPlugin = UnheadPlugin;
@@ -0,0 +1,13 @@
1
+ import { V as VueHeadClient } from './shared/vue.8eef6ffc.cjs';
2
+ import '@unhead/schema';
3
+ import 'vue';
4
+
5
+ declare const HeadOptions: {
6
+ created(): void;
7
+ };
8
+ declare function UnheadPlugin(head: VueHeadClient<any>): {
9
+ beforeCreate(): void;
10
+ created(): void;
11
+ };
12
+
13
+ export { HeadOptions, UnheadPlugin };
@@ -0,0 +1,13 @@
1
+ import { V as VueHeadClient } from './shared/vue.8eef6ffc.mjs';
2
+ import '@unhead/schema';
3
+ import 'vue';
4
+
5
+ declare const HeadOptions: {
6
+ created(): void;
7
+ };
8
+ declare function UnheadPlugin(head: VueHeadClient<any>): {
9
+ beforeCreate(): void;
10
+ created(): void;
11
+ };
12
+
13
+ export { HeadOptions, UnheadPlugin };
package/dist/vue2.d.ts ADDED
@@ -0,0 +1,13 @@
1
+ import { V as VueHeadClient } from './shared/vue.8eef6ffc.js';
2
+ import '@unhead/schema';
3
+ import 'vue';
4
+
5
+ declare const HeadOptions: {
6
+ created(): void;
7
+ };
8
+ declare function UnheadPlugin(head: VueHeadClient<any>): {
9
+ beforeCreate(): void;
10
+ created(): void;
11
+ };
12
+
13
+ export { HeadOptions, UnheadPlugin };
package/dist/vue2.mjs ADDED
@@ -0,0 +1,47 @@
1
+ import { getCurrentInstance } from 'vue';
2
+ import { V as Vue3, u as useHead, h as headSymbol } from './shared/vue.b1b42453.mjs';
3
+ import 'unhead';
4
+ import '@unhead/shared';
5
+
6
+ const HeadOptions = {
7
+ created() {
8
+ let source = false;
9
+ if (Vue3) {
10
+ const instance = getCurrentInstance();
11
+ if (!instance)
12
+ return;
13
+ const options = instance.type;
14
+ if (!options || !("head" in options))
15
+ return;
16
+ source = typeof options.head === "function" ? () => options.head.call(instance.proxy) : options.head;
17
+ } else {
18
+ const head = this.$options.head;
19
+ if (head) {
20
+ source = typeof head === "function" ? () => head.call(this) : head;
21
+ }
22
+ }
23
+ source && useHead(source);
24
+ }
25
+ };
26
+ function UnheadPlugin(head) {
27
+ return {
28
+ ...HeadOptions,
29
+ beforeCreate() {
30
+ const options = this.$options;
31
+ const origProvide = options.provide;
32
+ options.provide = function() {
33
+ let origProvideResult;
34
+ if (typeof origProvide === "function")
35
+ origProvideResult = origProvide.call(this);
36
+ else
37
+ origProvideResult = origProvide || {};
38
+ return {
39
+ ...origProvideResult,
40
+ [headSymbol]: head
41
+ };
42
+ };
43
+ }
44
+ };
45
+ }
46
+
47
+ export { HeadOptions, UnheadPlugin };
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@unhead/vue",
3
3
  "type": "module",
4
- "version": "1.5.5",
4
+ "version": "1.6.1",
5
5
  "author": "Harlan Wilton <harlan@harlanzw.com>",
6
6
  "license": "MIT",
7
7
  "funding": "https://github.com/sponsors/harlan-zw",
@@ -25,6 +25,11 @@
25
25
  "types": "./dist/polyfill.d.ts",
26
26
  "import": "./dist/polyfill.mjs",
27
27
  "require": "./dist/polyfill.cjs"
28
+ },
29
+ "./vue2": {
30
+ "types": "./dist/vue2.d.ts",
31
+ "import": "./dist/vue2.mjs",
32
+ "require": "./dist/vue2.cjs"
28
33
  }
29
34
  },
30
35
  "main": "dist/index.cjs",
@@ -38,9 +43,9 @@
38
43
  },
39
44
  "dependencies": {
40
45
  "hookable": "^5.5.3",
41
- "@unhead/schema": "1.5.5",
42
- "@unhead/shared": "1.5.5",
43
- "unhead": "1.5.5"
46
+ "@unhead/schema": "1.6.1",
47
+ "@unhead/shared": "1.6.1",
48
+ "unhead": "1.6.1"
44
49
  },
45
50
  "devDependencies": {
46
51
  "vue": "^3.3.4"