@unhead/vue 1.0.15 → 1.0.17

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
@@ -148,12 +148,16 @@ async function renderDOMHead(head, options = {}) {
148
148
  Object.entries(pendingRenders).forEach(([pos, queue]) => {
149
149
  if (!queue.length)
150
150
  return;
151
- for (const $el of [...dom[pos].children].reverse()) {
151
+ const children = dom?.[pos]?.children;
152
+ if (!children)
153
+ return;
154
+ for (const $el of [...children].reverse()) {
152
155
  const elTag = $el.tagName.toLowerCase();
153
156
  if (!HasElementTags$1.includes(elTag))
154
157
  continue;
155
158
  const dedupeKey = tagDedupeKey$1({
156
159
  tag: elTag,
160
+ // convert attributes to object
157
161
  props: $el.getAttributeNames().reduce((props, name) => ({ ...props, [name]: $el.getAttribute(name) }), {})
158
162
  });
159
163
  const matchIdx = queue.findIndex((ctx2) => ctx2 && (ctx2.tag._d === dedupeKey || $el.isEqualNode(ctx2.$el)));
@@ -598,6 +602,7 @@ async function normaliseEntryTags(e) {
598
602
  }
599
603
 
600
604
  const CorePlugins = () => [
605
+ // dedupe needs to come first
601
606
  DedupesTagsPlugin(),
602
607
  SortTagsPlugin(),
603
608
  TitleTemplatePlugin(),
@@ -662,6 +667,7 @@ function createHeadCore(options = {}) {
662
667
  return false;
663
668
  });
664
669
  },
670
+ // a patch is the same as creating a new entry, just a nice DX
665
671
  patch(input2) {
666
672
  entries = entries.map((e) => {
667
673
  if (e._i === activeEntry._i) {
@@ -706,6 +712,7 @@ const composableNames = [
706
712
  "useTagBase",
707
713
  "useTagMeta",
708
714
  "useTagMetaFlat",
715
+ // alias
709
716
  "useSeoMeta",
710
717
  "useTagLink",
711
718
  "useTagScript",
@@ -714,6 +721,7 @@ const composableNames = [
714
721
  "useHtmlAttrs",
715
722
  "useBodyAttrs",
716
723
  "useTitleTemplate",
724
+ // server only composables
717
725
  "useServerHead",
718
726
  "useServerTagTitle",
719
727
  "useServerTagBase",
@@ -770,6 +778,7 @@ function injectHead() {
770
778
  function createHead(options = {}) {
771
779
  const head = createHead$1({
772
780
  ...options,
781
+ // arbitrary delay the dom update for batch updates
773
782
  domDelayFn: (fn) => setTimeout(() => vue.nextTick(() => fn()), 10),
774
783
  plugins: [
775
784
  VueReactiveUseHeadPlugin(),
package/dist/index.mjs CHANGED
@@ -146,12 +146,16 @@ async function renderDOMHead(head, options = {}) {
146
146
  Object.entries(pendingRenders).forEach(([pos, queue]) => {
147
147
  if (!queue.length)
148
148
  return;
149
- for (const $el of [...dom[pos].children].reverse()) {
149
+ const children = dom?.[pos]?.children;
150
+ if (!children)
151
+ return;
152
+ for (const $el of [...children].reverse()) {
150
153
  const elTag = $el.tagName.toLowerCase();
151
154
  if (!HasElementTags$1.includes(elTag))
152
155
  continue;
153
156
  const dedupeKey = tagDedupeKey$1({
154
157
  tag: elTag,
158
+ // convert attributes to object
155
159
  props: $el.getAttributeNames().reduce((props, name) => ({ ...props, [name]: $el.getAttribute(name) }), {})
156
160
  });
157
161
  const matchIdx = queue.findIndex((ctx2) => ctx2 && (ctx2.tag._d === dedupeKey || $el.isEqualNode(ctx2.$el)));
@@ -596,6 +600,7 @@ async function normaliseEntryTags(e) {
596
600
  }
597
601
 
598
602
  const CorePlugins = () => [
603
+ // dedupe needs to come first
599
604
  DedupesTagsPlugin(),
600
605
  SortTagsPlugin(),
601
606
  TitleTemplatePlugin(),
@@ -660,6 +665,7 @@ function createHeadCore(options = {}) {
660
665
  return false;
661
666
  });
662
667
  },
668
+ // a patch is the same as creating a new entry, just a nice DX
663
669
  patch(input2) {
664
670
  entries = entries.map((e) => {
665
671
  if (e._i === activeEntry._i) {
@@ -704,6 +710,7 @@ const composableNames = [
704
710
  "useTagBase",
705
711
  "useTagMeta",
706
712
  "useTagMetaFlat",
713
+ // alias
707
714
  "useSeoMeta",
708
715
  "useTagLink",
709
716
  "useTagScript",
@@ -712,6 +719,7 @@ const composableNames = [
712
719
  "useHtmlAttrs",
713
720
  "useBodyAttrs",
714
721
  "useTitleTemplate",
722
+ // server only composables
715
723
  "useServerHead",
716
724
  "useServerTagTitle",
717
725
  "useServerTagBase",
@@ -768,6 +776,7 @@ function injectHead() {
768
776
  function createHead(options = {}) {
769
777
  const head = createHead$1({
770
778
  ...options,
779
+ // arbitrary delay the dom update for batch updates
771
780
  domDelayFn: (fn) => setTimeout(() => nextTick(() => fn()), 10),
772
781
  plugins: [
773
782
  VueReactiveUseHeadPlugin(),
package/package.json CHANGED
@@ -1,8 +1,8 @@
1
1
  {
2
2
  "name": "@unhead/vue",
3
3
  "type": "module",
4
- "version": "1.0.15",
5
- "packageManager": "pnpm@7.23.0",
4
+ "version": "1.0.17",
5
+ "packageManager": "pnpm@7.25.0",
6
6
  "author": "Harlan Wilton <harlan@harlanzw.com>",
7
7
  "license": "MIT",
8
8
  "funding": "https://github.com/sponsors/harlan-zw",
@@ -34,11 +34,11 @@
34
34
  },
35
35
  "dependencies": {
36
36
  "hookable": "^5.4.2",
37
- "@unhead/schema": "1.0.15"
37
+ "@unhead/schema": "1.0.17"
38
38
  },
39
39
  "devDependencies": {
40
40
  "vue": "^3.2.45",
41
- "unhead": "1.0.15"
41
+ "unhead": "1.0.17"
42
42
  },
43
43
  "scripts": {
44
44
  "build": "unbuild .",