Skip to content

Commit

Permalink
Merge branch 'main' into move
Browse files Browse the repository at this point in the history
  • Loading branch information
martrapp authored Feb 29, 2024
2 parents fe6e331 + fea73d1 commit 5dce5a9
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 10 deletions.
5 changes: 5 additions & 0 deletions .changeset/sweet-ads-boil.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"astro-vtbot": patch
---

Fix bug with auto inserted root group in VtBotDebug
22 changes: 12 additions & 10 deletions components/VtBotDebug.astro
Original file line number Diff line number Diff line change
Expand Up @@ -189,7 +189,8 @@ const active = import.meta.env.DEV || production;

const bold = (s: string) => `**${s}**`;
const map = elementsWithStyleProperty('view-transition-name');
map.set('root', (map.get('root') ?? new Set()).add(document.documentElement));
[...map.values()].filter((set) => set.has(document.documentElement)).length === 0 &&
map.set('root', (map.get('root') ?? new Set()).add(document.documentElement));
const newMap = toCSSSelectorMap(map, 'new');
let i = 0;

Expand All @@ -209,14 +210,14 @@ const active = import.meta.env.DEV || production;
const oldSelector = originalMap!.get(name);
const newSelector = newMap.get(name);

logWithStyle(
`%ctransition ${++i}%c ${bold(name)} from ${bold(
oldSelector ?? '(nowhere)'
)} --to-> ${bold(newSelector ?? '(nowhere)')}`,
false,
ALTERNATE,
NORMAL
);
if (oldSelector || newSelector) {
logWithStyle(
`%ctransition ${++i}%c ${bold(name)} from ${bold(
oldSelector ?? '(nowhere)'
)} --to-> ${bold(newSelector ?? '(nowhere)')}`,
false
);
}
}
};

Expand Down Expand Up @@ -395,7 +396,8 @@ const active = import.meta.env.DEV || production;

if (supportsViewTransitions) {
const map = elementsWithStyleProperty('view-transition-name');
map.set('root', (map.get('root') ?? new Set()).add(document.documentElement));
[...map.values()].filter((set) => set.has(document.documentElement)).length === 0 &&
map.set('root', (map.get('root') ?? new Set()).add(document.documentElement));
window._vtbot_debug.originalMap = toCSSSelectorMap(map, 'old');
}
const originalSwap = swapEvent.swap;
Expand Down

0 comments on commit 5dce5a9

Please sign in to comment.