rollup-plugin-react-scoped-css 1.2.7 → 1.3.0

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.
@@ -21,6 +21,13 @@ const isDeepFunctionSelector = (node) => node.type === "PseudoClassSelector" &&
21
21
  */
22
22
  const isRootLikePseudoSelector = (node) => node.type === "PseudoClassSelector" &&
23
23
  (node.name.toLowerCase() === "root" || node.name.toLowerCase() === "scope");
24
+ /**
25
+ * The `::view-transition-*` tree is rooted at the document root, which never
26
+ * receives the scope attribute. A bare occurrence can therefore never match
27
+ * once scoped, so it is left global just like `:root`.
28
+ */
29
+ const isViewTransitionPseudoElement = (node) => node.type === "PseudoElementSelector" &&
30
+ node.name.toLowerCase().startsWith("view-transition");
24
31
  const isCombinator = (node) => node.type === "Combinator";
25
32
  const isNestingSelector = (node) => node.type === "NestingSelector";
26
33
  /**
@@ -159,6 +166,11 @@ export function scopeCss(css, filename, hash, source = filename) {
159
166
  if (items.some((item) => isRootLikePseudoSelector(item.data))) {
160
167
  return;
161
168
  }
169
+ // Bare view-transition pseudo-elements are also rooted at the document
170
+ // root, so scoping them would only produce an unmatchable selector.
171
+ if (items.some((item) => isViewTransitionPseudoElement(item.data))) {
172
+ return;
173
+ }
162
174
  if (items.some((item) => item.data.type === "PseudoElementSelector")) {
163
175
  // An attribute cannot follow a pseudo-element, so it has to be
164
176
  // prepended: `::before` -> `[hash]::before`.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "rollup-plugin-react-scoped-css",
3
- "version": "1.2.7",
3
+ "version": "1.3.0",
4
4
  "description": "Bring scoped CSS to React with Vite & Rollup. Lightweight component-level style isolation similar to Vue and Angular.",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",