diff --git a/.changeset/kind-apricots-shave.md b/.changeset/kind-apricots-shave.md new file mode 100644 index 0000000..eead541 --- /dev/null +++ b/.changeset/kind-apricots-shave.md @@ -0,0 +1,6 @@ +--- +'astro-vtbot': patch +--- + +Handles "!important" correctly when used with view-transition-names. + diff --git a/components/css.ts b/components/css.ts index 98a66e3..50cb789 100644 --- a/components/css.ts +++ b/components/css.ts @@ -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) => { diff --git a/package-lock.json b/package-lock.json index 44ccb2d..26b8e8d 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "astro-vtbot", - "version": "1.9.2", + "version": "1.9.3", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "astro-vtbot", - "version": "1.9.2", + "version": "1.9.3", "license": "ISC", "dependencies": { "@vtbag/element-crossing": "^1.0.1", @@ -20,7 +20,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" @@ -2194,9 +2194,9 @@ } }, "node_modules/astro": { - "version": "4.15.5", - "resolved": "https://registry.npmjs.org/astro/-/astro-4.15.5.tgz", - "integrity": "sha512-zcHXpRav0dtYpddxoGMDN7A7SKrGL9wsu5IxLjqCcZhylfZ/5mfLfoGYnSg7aFwuAleUXP66lyfY+GDbFTbF2w==", + "version": "4.15.8", + "resolved": "https://registry.npmjs.org/astro/-/astro-4.15.8.tgz", + "integrity": "sha512-pdXjtRF6O1xChiPAUF32R7oVRTW7AK1/Oy/JqPNhLfbelO0l6C7cLdSEuSLektwOEnMhOVXqccetjBs7HPaoxA==", "dev": true, "dependencies": { "@astrojs/compiler": "^2.10.3", diff --git a/package.json b/package.json index ee675a2..ec5a8c8 100644 --- a/package.json +++ b/package.json @@ -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"