Skip to content

Commit

Permalink
handle important when specified for view-transition-names
Browse files Browse the repository at this point in the history
  • Loading branch information
martrapp committed Sep 19, 2024
1 parent 2680391 commit c0f574e
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 8 deletions.
6 changes: 6 additions & 0 deletions .changeset/kind-apricots-shave.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
'astro-vtbot': patch
---

Handles "!important" correctly when used with view-transition-names.

4 changes: 3 additions & 1 deletion components/css.ts
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,9 @@ export function elementsWithPropertyInStylesheet(
definitions.set(sheet, set);
const text = (owner?.textContent ?? '').replace(/@supports[^;{]+/g, '');
const matches = text.matchAll(new RegExp(`${property}:\\s*([^;}]*)`, 'gu'));
[...matches].forEach((match) => set.add(decode(property, match[1]!)));
[...matches].forEach((match) =>
set.add(decode(property, match[1]!.replace(/\s*!important\s*$/, '')))
);
});

walkSheets([...doc.styleSheets], undefined, (rule) => {
Expand Down
12 changes: 6 additions & 6 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@
"@playwright/test": "^1.47.1",
"@types/dom-view-transitions": "^1.0.5",
"@types/node": "^22.5.5",
"astro": "^4.15.5",
"astro": "^4.15.8",
"prettier": "^3.3.3",
"prettier-plugin-astro": "^0.14.1",
"typescript": "^5.6.2"
Expand Down

0 comments on commit c0f574e

Please sign in to comment.