Skip to content

Commit 6429bfe

Browse files
ZerowxmXiaoming Wu
andauthored
chore: bump csstype from 3.1.3 to 3.2.3 (#1867)
* chore: bump csstype from 3.1.3 to 3.2.3 - Update csstype version in package.json, packages/jest/package.json, and packages/react/package.json - Update AtRules type mapping in babel-plugin to reflect csstype 3.2.3 changes: - Remove @scroll-timeline (abandoned CSS proposal) - Remove @Viewport (obsolete, no modern browser support) - Add @container (CSS Container Queries) - Add @position-try (CSS Anchor Positioning) - Add @view-transition (View Transitions API) - Add changeset documenting the upgrade and rationale * docs: update changeset with detailed explanation of csstype bump and @container fix - Clarify that @container was partially supported but missing from cssMap validation - Explain what the atRules lookup table does - Update version bumps to minor for babel-plugin (new @container support) - Add detailed rationale for removed at-rules - Explain impact on cssMap validation * style: format changeset with prettier * feat: add support for :popover-open pseudo-class - Add '&:popover-open' to CSSPseudoClasses type in packages/react/src/types.ts - This pseudo-class is now available in csstype 3.2.3 - Add comprehensive test in packages/react/src/css-map/__tests__/index.test.tsx to verify popover-open works correctly with cssMap - Test verifies base opacity, transition properties, and :popover-open state --------- Co-authored-by: Xiaoming Wu <xwu2@atlassian.com>
1 parent aef4d99 commit 6429bfe

File tree

8 files changed

+65
-10
lines changed

8 files changed

+65
-10
lines changed
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
---
2+
'@compiled/babel-plugin': minor
3+
'@compiled/react': minor
4+
'@compiled/jest': minor
5+
---
6+
7+
Bump csstype from 3.1.3 to 3.2.3 and add missing `@container` support to cssMap validation
8+
9+
Updates csstype to the latest version which reflects the evolution of CSS standards. This change also fixes a bug where `@container` (CSS Container Queries) was partially supported in CSS processing but was missing from the cssMap type validation lookup table.
10+
11+
**Removed at-rules:**
12+
13+
- `@scroll-timeline` - Abandoned CSS proposal; Scroll-driven Animations now use `animation-timeline` property instead
14+
- `@viewport` - Obsolete at-rule with no modern browser support; viewport configuration is now handled via meta tags and media queries
15+
16+
**Added at-rules (with full support):**
17+
18+
- `@container` - CSS Container Queries (now fully validated in cssMap)
19+
- `@position-try` - CSS Anchor Positioning
20+
- `@view-transition` - View Transitions API
21+
22+
**What changed:**
23+
24+
- Updated csstype dependency to 3.2.3 across all packages
25+
- Updated `AtRules` type mapping in `packages/babel-plugin/src/utils/css-map.ts` to include the new at-rules and remove deprecated ones
26+
- Bumped to `minor` for `@compiled/babel-plugin` due to adding `@container` support to cssMap validation
27+
28+
**Note:** The `@scroll-timeline` and `@viewport` at-rules are not used anywhere in the Compiled codebase, so this is not a breaking change.

‎package.json‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@
6565
"@types/react": "^18.3.1",
6666
"@types/react-dom": "^18.3.1",
6767
"css-what": ">=6.1.0",
68-
"csstype": "3.1.3",
68+
"csstype": "3.2.3",
6969
"nth-check": ">=2.1.1",
7070
"postcss": "8.4.31",
7171
"semver": "^7.6.3",
@@ -96,7 +96,7 @@
9696
"@typescript-eslint/parser": "^6.21.0",
9797
"@typescript-eslint/utils": "^6.21.0",
9898
"babel-loader": "^9.1.2",
99-
"csstype": "^3.1.3",
99+
"csstype": "^3.2.3",
100100
"eslint": "^8.57.1",
101101
"eslint-plugin-import": "^2.31.0",
102102
"eslint-plugin-json-files": "^2.2.0",

‎packages/babel-plugin/src/utils/css-map.ts‎

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ export const EXTENDED_SELECTORS_KEY = 'selectors';
88

99
const atRules: Record<AtRules, boolean> = {
1010
'@charset': true,
11+
'@container': true,
1112
'@counter-style': true,
1213
'@document': true,
1314
'@font-face': true,
@@ -19,12 +20,12 @@ const atRules: Record<AtRules, boolean> = {
1920
'@media': true,
2021
'@namespace': true,
2122
'@page': true,
23+
'@position-try': true,
2224
'@property': true,
2325
'@scope': true,
24-
'@scroll-timeline': true,
2526
'@starting-style': true,
2627
'@supports': true,
27-
'@viewport': true,
28+
'@view-transition': true,
2829
};
2930

3031
type ObjectKeyWithLiteralValue = t.Identifier | t.StringLiteral;

‎packages/jest/package.json‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,6 @@
2424
},
2525
"devDependencies": {
2626
"@types/css": "^0.0.35",
27-
"csstype": "^3.1.3"
27+
"csstype": "^3.2.3"
2828
}
2929
}

‎packages/react/package.json‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@
7272
"jsx-dev-runtime"
7373
],
7474
"dependencies": {
75-
"csstype": "^3.1.3"
75+
"csstype": "^3.2.3"
7676
},
7777
"devDependencies": {
7878
"@compiled/benchmark": "^1.1.0",

‎packages/react/src/css-map/__tests__/index.test.tsx‎

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,4 +49,29 @@ describe('css map', () => {
4949

5050
expect(getByText('hello world')).toHaveCompiledCss('color', 'red');
5151
});
52+
53+
it('should support popover-open pseudo-class', () => {
54+
const popoverStyles = cssMap({
55+
fade: {
56+
opacity: 0,
57+
transition:
58+
'opacity 175ms cubic-bezier(0.15, 1, 0.3, 1), overlay 175ms allow-discrete, display 175ms allow-discrete',
59+
'&:popover-open': {
60+
opacity: 1,
61+
transitionDuration: '350ms',
62+
},
63+
},
64+
});
65+
66+
const Foo = () => <div css={popoverStyles.fade}>popover content</div>;
67+
const { getByText } = render(<Foo />);
68+
69+
expect(getByText('popover content')).toHaveCompiledCss('opacity', '0');
70+
expect(getByText('popover content')).toHaveCompiledCss('opacity', '1', {
71+
target: ':popover-open',
72+
});
73+
expect(getByText('popover content')).toHaveCompiledCss('transition-duration', '350ms', {
74+
target: ':popover-open',
75+
});
76+
});
5277
});

‎packages/react/src/types.ts‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -96,6 +96,7 @@ export type CSSPseudoClasses =
9696
| '&:picture-in-picture'
9797
| '&:placeholder-shown'
9898
| '&:playing'
99+
| '&:popover-open'
99100
| '&:read-only'
100101
| '&:read-write'
101102
| '&:required'

‎yarn.lock‎

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7757,10 +7757,10 @@ cssstyle@^2.3.0:
77577757
dependencies:
77587758
cssom "~0.3.6"
77597759

7760-
csstype@3.1.3, csstype@^3.1.3, csstype@^3.2.2:
7761-
version "3.1.3"
7762-
resolved "https://registry.yarnpkg.com/csstype/-/csstype-3.1.3.tgz#d80ff294d114fb0e6ac500fbf85b60137d7eff81"
7763-
integrity sha512-M1uQkMl8rQK/szD0LNhtqxIPLpimGm8sOBwU7lLnCpSbTyY3yeU1Vc7l4KT5zT4s/yOxHH5O7tIuuLOCnLADRw==
7760+
csstype@3.2.3, csstype@^3.2.2, csstype@^3.2.3:
7761+
version "3.2.3"
7762+
resolved "https://registry.yarnpkg.com/csstype/-/csstype-3.2.3.tgz#ec48c0f3e993e50648c86da559e2610995cf989a"
7763+
integrity sha512-z1HGKcYy2xA8AGQfwrn0PAy+PB7X/GSj3UVJW9qKyn43xWa+gl5nXmU4qqLMRzWVLFC8KusUX8T/0kCiOYpAIQ==
77647764

77657765
currently-unhandled@^0.4.1:
77667766
version "0.4.1"

0 commit comments

Comments
 (0)