@unhead/vue 1.0.3 → 1.0.4

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
@@ -44,6 +44,8 @@ const setAttrs = (ctx, markSideEffect) => {
44
44
  value = String(value);
45
45
  const attrSdeKey = `attr:${k}`;
46
46
  if (k === "class") {
47
+ if (!value)
48
+ return;
47
49
  for (const c of value.split(" ")) {
48
50
  const classSdeKey = `${attrSdeKey}:${c}`;
49
51
  if (markSideEffect)
@@ -582,7 +584,7 @@ const TagEntityBits = 10;
582
584
 
583
585
  async function normaliseEntryTags(e) {
584
586
  const tagPromises = [];
585
- Object.entries(e.input).filter(([k, v]) => typeof v !== "undefined" && ValidHeadTags.includes(k)).forEach(([k, value]) => {
587
+ Object.entries(e.resolvedInput || e.input).filter(([k, v]) => typeof v !== "undefined" && ValidHeadTags.includes(k)).forEach(([k, value]) => {
586
588
  const v = asArray$1(value);
587
589
  tagPromises.push(...v.map((props) => normaliseTag(k, props)).flat());
588
590
  });
@@ -798,7 +800,7 @@ const VueReactiveUseHeadPlugin = () => {
798
800
  hooks: {
799
801
  "entries:resolve": function(ctx) {
800
802
  for (const entry of ctx.entries)
801
- entry.input = resolveUnrefHeadInput(entry.input);
803
+ entry.resolvedInput = resolveUnrefHeadInput(entry.input);
802
804
  }
803
805
  }
804
806
  });
@@ -1009,10 +1011,10 @@ const useServerBodyAttrs = (attrs) => useHead({ bodyAttrs: attrs });
1009
1011
 
1010
1012
  function useHead(input, options = {}) {
1011
1013
  const head = injectHead();
1012
- const isBrowser = IsBrowser || head.resolvedOptions?.document;
1014
+ const isBrowser = IsBrowser || !!head.resolvedOptions?.document;
1013
1015
  if (options.mode === "server" && isBrowser || options.mode === "client" && !isBrowser)
1014
1016
  return;
1015
- return IsBrowser ? clientUseHead(input, options) : serverUseHead(input, options);
1017
+ return isBrowser ? clientUseHead(input, options) : serverUseHead(input, options);
1016
1018
  }
1017
1019
  const useTagTitle = (title) => useHead({ title });
1018
1020
  const useTitleTemplate = (titleTemplate) => useHead({ titleTemplate });
package/dist/index.mjs CHANGED
@@ -42,6 +42,8 @@ const setAttrs = (ctx, markSideEffect) => {
42
42
  value = String(value);
43
43
  const attrSdeKey = `attr:${k}`;
44
44
  if (k === "class") {
45
+ if (!value)
46
+ return;
45
47
  for (const c of value.split(" ")) {
46
48
  const classSdeKey = `${attrSdeKey}:${c}`;
47
49
  if (markSideEffect)
@@ -580,7 +582,7 @@ const TagEntityBits = 10;
580
582
 
581
583
  async function normaliseEntryTags(e) {
582
584
  const tagPromises = [];
583
- Object.entries(e.input).filter(([k, v]) => typeof v !== "undefined" && ValidHeadTags.includes(k)).forEach(([k, value]) => {
585
+ Object.entries(e.resolvedInput || e.input).filter(([k, v]) => typeof v !== "undefined" && ValidHeadTags.includes(k)).forEach(([k, value]) => {
584
586
  const v = asArray$1(value);
585
587
  tagPromises.push(...v.map((props) => normaliseTag(k, props)).flat());
586
588
  });
@@ -796,7 +798,7 @@ const VueReactiveUseHeadPlugin = () => {
796
798
  hooks: {
797
799
  "entries:resolve": function(ctx) {
798
800
  for (const entry of ctx.entries)
799
- entry.input = resolveUnrefHeadInput(entry.input);
801
+ entry.resolvedInput = resolveUnrefHeadInput(entry.input);
800
802
  }
801
803
  }
802
804
  });
@@ -1007,10 +1009,10 @@ const useServerBodyAttrs = (attrs) => useHead({ bodyAttrs: attrs });
1007
1009
 
1008
1010
  function useHead(input, options = {}) {
1009
1011
  const head = injectHead();
1010
- const isBrowser = IsBrowser || head.resolvedOptions?.document;
1012
+ const isBrowser = IsBrowser || !!head.resolvedOptions?.document;
1011
1013
  if (options.mode === "server" && isBrowser || options.mode === "client" && !isBrowser)
1012
1014
  return;
1013
- return IsBrowser ? clientUseHead(input, options) : serverUseHead(input, options);
1015
+ return isBrowser ? clientUseHead(input, options) : serverUseHead(input, options);
1014
1016
  }
1015
1017
  const useTagTitle = (title) => useHead({ title });
1016
1018
  const useTitleTemplate = (titleTemplate) => useHead({ titleTemplate });
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@unhead/vue",
3
3
  "type": "module",
4
- "version": "1.0.3",
4
+ "version": "1.0.4",
5
5
  "packageManager": "pnpm@7.17.0",
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.3"
37
+ "@unhead/schema": "1.0.4"
38
38
  },
39
39
  "devDependencies": {
40
40
  "vue": "^3.2.45",
41
- "unhead": "1.0.3"
41
+ "unhead": "1.0.4"
42
42
  },
43
43
  "scripts": {
44
44
  "build": "unbuild .",