Skip to content

Commit b0f3d29

Browse files
committed
chore: consolidate changesets (16 → 9)
1 parent 6fe42fa commit b0f3d29

19 files changed

Lines changed: 48 additions & 117 deletions

‎.changeset/add-react-native-peer-dep.md‎

Lines changed: 0 additions & 5 deletions
This file was deleted.

‎.changeset/attrs-improvements.md‎

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
'styled-components': minor
3+
---
4+
5+
`.attrs()` improvements: props supplied via attrs are now automatically made optional on the resulting component (previously required even when attrs provided a default). Also fixes a bug where the attrs callback received a mutable props object that could be changed by subsequent attrs processing; it now receives an immutable snapshot.

‎.changeset/feat-create-theme.md‎

Lines changed: 7 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -2,35 +2,16 @@
22
'styled-components': minor
33
---
44

5-
Add `createTheme` utility for CSS variable theming that works across RSC and client components.
5+
Add `createTheme(defaultTheme, options?)` for CSS variable theming that works across RSC and client components.
66

7-
`createTheme` takes a default theme object and returns an object with the same shape where every leaf value is replaced with a `var(--prefix-path, fallback)` CSS string. This lets you use theme values in RSC styled components (which can't access React context) while keeping the same tokens as client components.
7+
Returns an object with the same shape where every leaf is `var(--prefix-path, fallback)`. Pass it to `ThemeProvider` for stable class name hashes across themes (no hydration mismatch on light/dark switch).
88

99
```ts
10-
import { createTheme } from 'styled-components';
11-
12-
const theme = createTheme({
13-
colors: { primary: '#0070f3', text: '#111' }
14-
});
15-
10+
const theme = createTheme({ colors: { primary: '#0070f3' } });
1611
// theme.colors.primary → "var(--sc-colors-primary, #0070f3)"
17-
// theme.colors.text → "var(--sc-colors-text, #111)"
18-
// theme.raw → { colors: { primary: '#0070f3', text: '#111' } }
19-
```
20-
21-
Pass the returned object to `ThemeProvider` so that `p.theme.colors.*` interpolations produce CSS variable references instead of literal values. This gives you stable class name hashing across themes (no hydration mismatches when switching light/dark) and lets CSS variables handle the actual theming.
22-
23-
**`theme.resolve(el?)`** — read the current computed CSS variable values from the DOM, returning an object with the same shape as the original theme but with resolved values. Useful for JS logic that needs the actual current color (e.g., canvas rendering, conditional branching). Client-only.
24-
25-
```ts
26-
const current = theme.resolve();
27-
// current.colors.primary → "#3b82f6" (dark mode value)
28-
// current.colors.text → "#f9fafb"
29-
30-
// Scoped to a specific element:
31-
const scoped = theme.resolve(myElement);
12+
// theme.raw → original object
13+
// theme.resolve(el?) → computed values from DOM (client-only)
14+
// theme.GlobalStyle → component that emits CSS var declarations
3215
```
3316

34-
Options:
35-
- `prefix` (default: `"sc"`) — namespace for CSS variable names
36-
- `selector` (default: `":root"`) — CSS selector for variable declarations, use `":host"` for Shadow DOM
17+
Options: `prefix` (default `"sc"`), `selector` (default `":root"`, use `":host"` for Shadow DOM).

‎.changeset/fix-attrs-mutation.md‎

Lines changed: 0 additions & 5 deletions
This file was deleted.

‎.changeset/fix-attrs-optionality.md‎

Lines changed: 0 additions & 5 deletions
This file was deleted.
File renamed without changes.

‎.changeset/fix-global-style-jsdom-perf.md‎

Lines changed: 0 additions & 5 deletions
This file was deleted.

‎.changeset/fix-rsc-hmr-accumulation.md‎

Lines changed: 0 additions & 5 deletions
This file was deleted.

‎.changeset/fix-rsc-restyling-specificity.md‎

Lines changed: 0 additions & 8 deletions
This file was deleted.
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
'styled-components': patch
3+
---
4+
5+
Fix RSC style injection: deduplicate inline `<style>` tags per render via `React.cache`, prevent stale CSS accumulating across HMR cycles by resetting the module-level sheet once per server render, and fix specificity when extending client components across the RSC boundary (`:where()` zero-specificity wrapping on base CSS, `Set`-based keyframe dedup).

0 commit comments

Comments
 (0)