@unhead/vue 1.0.20 → 1.0.21
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 +11 -1
- package/dist/index.mjs +12 -2
- package/package.json +3 -3
package/dist/index.cjs
CHANGED
|
@@ -1023,17 +1023,27 @@ function changeKeyCasingDeep(input) {
|
|
|
1023
1023
|
|
|
1024
1024
|
function clientUseHead(input, options = {}) {
|
|
1025
1025
|
const head = injectHead();
|
|
1026
|
+
const deactivated = vue.ref(false);
|
|
1026
1027
|
const resolvedInput = vue.ref({});
|
|
1027
1028
|
vue.watchEffect(() => {
|
|
1028
1029
|
resolvedInput.value = resolveUnrefHeadInput(input);
|
|
1029
1030
|
});
|
|
1030
1031
|
const entry = head.push(resolvedInput.value, options);
|
|
1031
|
-
vue.watch(resolvedInput, (e) =>
|
|
1032
|
+
vue.watch([resolvedInput, deactivated], ([e, disable]) => {
|
|
1033
|
+
if (!disable)
|
|
1034
|
+
entry.patch(e);
|
|
1035
|
+
});
|
|
1032
1036
|
const vm = vue.getCurrentInstance();
|
|
1033
1037
|
if (vm) {
|
|
1034
1038
|
vue.onBeforeUnmount(() => {
|
|
1035
1039
|
entry.dispose();
|
|
1036
1040
|
});
|
|
1041
|
+
vue.onDeactivated(() => {
|
|
1042
|
+
deactivated.value = true;
|
|
1043
|
+
});
|
|
1044
|
+
vue.onActivated(() => {
|
|
1045
|
+
deactivated.value = false;
|
|
1046
|
+
});
|
|
1037
1047
|
}
|
|
1038
1048
|
return entry;
|
|
1039
1049
|
}
|
package/dist/index.mjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { createHooks } from 'hookable';
|
|
2
|
-
import { unref, isRef, version, getCurrentInstance, inject, nextTick, ref, watchEffect, watch, onBeforeUnmount } from 'vue';
|
|
2
|
+
import { unref, isRef, version, getCurrentInstance, inject, nextTick, ref, watchEffect, watch, onBeforeUnmount, onDeactivated, onActivated } from 'vue';
|
|
3
3
|
|
|
4
4
|
const TagsWithInnerContent = ["script", "style", "noscript"];
|
|
5
5
|
const HasElementTags$1 = [
|
|
@@ -1021,17 +1021,27 @@ function changeKeyCasingDeep(input) {
|
|
|
1021
1021
|
|
|
1022
1022
|
function clientUseHead(input, options = {}) {
|
|
1023
1023
|
const head = injectHead();
|
|
1024
|
+
const deactivated = ref(false);
|
|
1024
1025
|
const resolvedInput = ref({});
|
|
1025
1026
|
watchEffect(() => {
|
|
1026
1027
|
resolvedInput.value = resolveUnrefHeadInput(input);
|
|
1027
1028
|
});
|
|
1028
1029
|
const entry = head.push(resolvedInput.value, options);
|
|
1029
|
-
watch(resolvedInput, (e) =>
|
|
1030
|
+
watch([resolvedInput, deactivated], ([e, disable]) => {
|
|
1031
|
+
if (!disable)
|
|
1032
|
+
entry.patch(e);
|
|
1033
|
+
});
|
|
1030
1034
|
const vm = getCurrentInstance();
|
|
1031
1035
|
if (vm) {
|
|
1032
1036
|
onBeforeUnmount(() => {
|
|
1033
1037
|
entry.dispose();
|
|
1034
1038
|
});
|
|
1039
|
+
onDeactivated(() => {
|
|
1040
|
+
deactivated.value = true;
|
|
1041
|
+
});
|
|
1042
|
+
onActivated(() => {
|
|
1043
|
+
deactivated.value = false;
|
|
1044
|
+
});
|
|
1035
1045
|
}
|
|
1036
1046
|
return entry;
|
|
1037
1047
|
}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@unhead/vue",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "1.0.
|
|
4
|
+
"version": "1.0.21",
|
|
5
5
|
"packageManager": "pnpm@7.25.1",
|
|
6
6
|
"author": "Harlan Wilton <harlan@harlanzw.com>",
|
|
7
7
|
"license": "MIT",
|
|
@@ -34,11 +34,11 @@
|
|
|
34
34
|
},
|
|
35
35
|
"dependencies": {
|
|
36
36
|
"hookable": "^5.4.2",
|
|
37
|
-
"@unhead/schema": "1.0.
|
|
37
|
+
"@unhead/schema": "1.0.21"
|
|
38
38
|
},
|
|
39
39
|
"devDependencies": {
|
|
40
40
|
"vue": "^3.2.45",
|
|
41
|
-
"unhead": "1.0.
|
|
41
|
+
"unhead": "1.0.21"
|
|
42
42
|
},
|
|
43
43
|
"scripts": {
|
|
44
44
|
"build": "unbuild .",
|