@codefast/theme 0.4.0-canary.6 → 0.4.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.
- package/CHANGELOG.md +46 -0
- package/package.json +6 -6
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,51 @@
|
|
|
1
1
|
# @codefast/theme
|
|
2
2
|
|
|
3
|
+
## 0.4.0
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [`2397801`](https://github.com/codefastlabs/codefast/commit/239780172d7a71c3426382ec66309ec7f39bd883) Thanks [@thevuong](https://github.com/thevuong)! - chore: align package config globs
|
|
8
|
+
|
|
9
|
+
- [`17c6445`](https://github.com/codefastlabs/codefast/commit/17c6445017ed3ffcc3a04db128362329669124e3) Thanks [@thevuong](https://github.com/thevuong)! - Security, correctness, and performance improvements to `ThemeProvider` and `ThemeScript`.
|
|
10
|
+
|
|
11
|
+
**Security**
|
|
12
|
+
|
|
13
|
+
- Validate `BroadcastChannel` messages with `themeSchema.safeParse` before applying — prevents injection from browser extensions or other same-origin scripts
|
|
14
|
+
- Use `JSON.stringify` in `ThemeScript` inline script to safely serialise the theme value
|
|
15
|
+
|
|
16
|
+
**Correctness**
|
|
17
|
+
|
|
18
|
+
- `ThemeProvider` now re-syncs internal state when the `theme` prop changes after mount (e.g. router re-runs the root loader), making the server the authoritative source of truth
|
|
19
|
+
- Fixed `disableTransitionOnChange` timing: animation cleanup now fires after `applyTheme` commits to the DOM instead of prematurely in the async persist `finally` block
|
|
20
|
+
- Added last-write-wins guard (`intentRef`) so rapid `setTheme` calls only commit the most recent intent
|
|
21
|
+
|
|
22
|
+
**Performance**
|
|
23
|
+
|
|
24
|
+
- `setTheme` callback is now stable across theme commits (reads `committedThemeRef` instead of capturing `theme` in deps) — prevents unnecessary re-renders in consumers
|
|
25
|
+
- `BroadcastChannel` is reused from a shared ref instead of opening a new channel on every `setTheme` call
|
|
26
|
+
- Removed obsolete `-moz-`, `-o-`, `-ms-` vendor prefixes from the `disableAnimation` CSS injection
|
|
27
|
+
|
|
28
|
+
**Features**
|
|
29
|
+
|
|
30
|
+
- `ThemeScript` accepts a new `storageKey` prop: when set, the inline script reads `localStorage` before first paint for FOUC-free client-only apps
|
|
31
|
+
- Runtime Zod validation of the `theme` prop in `ThemeProvider` guards against invalid values bypassing TypeScript
|
|
32
|
+
|
|
33
|
+
**Docs / Tests**
|
|
34
|
+
|
|
35
|
+
- Fixed README: `THEME_STORAGE_KEY` import example now correctly points to `@codefast/theme/constants`
|
|
36
|
+
- Added integration tests for the TanStack Start adapter server functions
|
|
37
|
+
- New test coverage for all security and correctness fixes above
|
|
38
|
+
|
|
39
|
+
- [`f79b333`](https://github.com/codefastlabs/codefast/commit/f79b333d0599c19028f29b9889afcbfb99db91a1) Thanks [@thevuong](https://github.com/thevuong)! - feat(dev): enable source condition for zero-rebuild HMR in apps/docs
|
|
40
|
+
|
|
41
|
+
- [`5c82b5e`](https://github.com/codefastlabs/codefast/commit/5c82b5ea742701ac7836ffa8bb4bf4135e069d1d) Thanks [@thevuong](https://github.com/thevuong)! - Use minimum `>=` ranges in peerDependencies instead of `^` caret ranges.
|
|
42
|
+
|
|
43
|
+
- [`ebdf9e3`](https://github.com/codefastlabs/codefast/commit/ebdf9e396d3c3a826f05f278c93d391a0ae5ca45) Thanks [@thevuong](https://github.com/thevuong)! - feat(web): refactor theme management to color scheme system
|
|
44
|
+
|
|
45
|
+
- [`6c3ac44`](https://github.com/codefastlabs/codefast/commit/6c3ac44b7ddb9e5bcf3fbe0757e00ef86f27b513) Thanks [@thevuong](https://github.com/thevuong)! - Normalize import statement order and package.json key order repo-wide via the new oxfmt `sortImports`/`sortPackageJson` settings — purely mechanical, no runtime behavior change.
|
|
46
|
+
|
|
47
|
+
- [`b2cad2e`](https://github.com/codefastlabs/codefast/commit/b2cad2e180977106accbc978131a32d50ef91f9f) Thanks [@thevuong](https://github.com/thevuong)! - fix(theme): migrate `setColorSchemeServerFn` to TanStack Start `.validator` API
|
|
48
|
+
|
|
3
49
|
## 0.4.0-canary.6
|
|
4
50
|
|
|
5
51
|
## 0.4.0-canary.5
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@codefast/theme",
|
|
3
|
-
"version": "0.4.0
|
|
3
|
+
"version": "0.4.0",
|
|
4
4
|
"description": "Theme management with React 19 features - optimistic updates, cross-tab sync, and SSR support",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"dark-mode",
|
|
@@ -115,20 +115,20 @@
|
|
|
115
115
|
"zod": "^4.4.3"
|
|
116
116
|
},
|
|
117
117
|
"devDependencies": {
|
|
118
|
-
"@tanstack/react-start": "^1.168.
|
|
118
|
+
"@tanstack/react-start": "^1.168.26",
|
|
119
119
|
"@testing-library/dom": "^10.4.1",
|
|
120
120
|
"@testing-library/jest-dom": "^6.9.1",
|
|
121
121
|
"@testing-library/react": "^16.3.2",
|
|
122
122
|
"@testing-library/user-event": "^14.6.1",
|
|
123
|
-
"@types/node": "^
|
|
124
|
-
"@typescript/native-preview": "7.0.0-dev.
|
|
123
|
+
"@types/node": "^26.0.0",
|
|
124
|
+
"@typescript/native-preview": "7.0.0-dev.20260621.1",
|
|
125
125
|
"@vitejs/plugin-react": "^6.0.2",
|
|
126
126
|
"@vitest/coverage-v8": "^4.1.9",
|
|
127
127
|
"jsdom": "^29.1.1",
|
|
128
|
-
"tsdown": "^0.22.
|
|
128
|
+
"tsdown": "^0.22.3",
|
|
129
129
|
"typescript": "^6.0.3",
|
|
130
130
|
"vitest": "^4.1.9",
|
|
131
|
-
"@codefast/typescript-config": "0.4.0
|
|
131
|
+
"@codefast/typescript-config": "0.4.0"
|
|
132
132
|
},
|
|
133
133
|
"peerDependencies": {
|
|
134
134
|
"@types/react": ">=19.0.0",
|