@codefast/theme 0.3.12 → 0.3.13-canary.1
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 +10 -0
- package/dist/core/provider.d.ts.map +1 -1
- package/dist/core/provider.js +4 -2
- package/dist/utils/dom.d.ts.map +1 -1
- package/dist/utils/dom.js +2 -1
- package/package.json +22 -22
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,15 @@
|
|
|
1
1
|
# @codefast/theme
|
|
2
2
|
|
|
3
|
+
## 0.3.13-canary.1
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [`02b16bc`](https://github.com/codefastlabs/codefast/commit/02b16bcb5e13712294a2fe285461bd8c9faa3c51) Thanks [@thevuong](https://github.com/thevuong)! - refactor(config): update tsconfig and tsdown for consistency
|
|
8
|
+
|
|
9
|
+
- [`fd3ee2e`](https://github.com/codefastlabs/codefast/commit/fd3ee2ee35dc780e8e925759e6520e51f0cb6320) Thanks [@thevuong](https://github.com/thevuong)! - feat(cli): enhance export generation and stale export pruning
|
|
10
|
+
|
|
11
|
+
## 0.3.13-canary.0
|
|
12
|
+
|
|
3
13
|
## 0.3.12
|
|
4
14
|
|
|
5
15
|
### Patch Changes
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"provider.d.ts","sourceRoot":"","sources":["../../src/core/provider.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,GAAG,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAc5C,OAAO,KAAK,EAAE,aAAa,EAAE,KAAK,EAAoB,MAAM,QAAQ,CAAC;AAwCrE,UAAU,kBAAkB;IAC1B,QAAQ,EAAE,SAAS,CAAC;IACpB;;;;OAIG;IACH,yBAAyB,CAAC,EAAE,OAAO,CAAC;IACpC;;OAEG;IACH,KAAK,CAAC,EAAE,MAAM,CAAC;IACf;;;;;OAKG;IACH,YAAY,CAAC,EAAE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EACL,YAAY,EACZ,cAAc,EACd,mBAAmB,EACnB,KAAK,EAAE,YAAY,EACpB,EAAE,kBAAkB,GAAG,GAAG,CAAC,OAAO,CA4IlC"}
|
package/dist/core/provider.js
CHANGED
|
@@ -111,8 +111,9 @@ export function ThemeProvider({ children, disableTransitionOnChange = false, non
|
|
|
111
111
|
// Handle cross-tab theme sync via BroadcastChannel
|
|
112
112
|
const handleCrossTabMessage = useEffectEvent((event) => {
|
|
113
113
|
const newTheme = event.data;
|
|
114
|
-
if (newTheme === theme)
|
|
114
|
+
if (newTheme === theme) {
|
|
115
115
|
return;
|
|
116
|
+
}
|
|
116
117
|
startTransition(() => {
|
|
117
118
|
setThemeState(newTheme);
|
|
118
119
|
});
|
|
@@ -127,8 +128,9 @@ export function ThemeProvider({ children, disableTransitionOnChange = false, non
|
|
|
127
128
|
}, []);
|
|
128
129
|
const setTheme = useCallback(async (value) => {
|
|
129
130
|
await Promise.resolve();
|
|
130
|
-
if (value === theme)
|
|
131
|
+
if (value === theme) {
|
|
131
132
|
return;
|
|
133
|
+
}
|
|
132
134
|
// Optionally disable animations during theme switch
|
|
133
135
|
const enable = disableTransitionOnChange ? disableAnimation(nonce) : null;
|
|
134
136
|
// Wrap in startTransition for proper concurrent mode handling
|
package/dist/utils/dom.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"dom.d.ts","sourceRoot":"","sources":["../../src/utils/dom.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,QAAQ,CAAC;AAM5C;;;;;;;;GAQG;AACH,wBAAgB,UAAU,CAAC,QAAQ,EAAE,aAAa,GAAG,IAAI,CAMxD;AAED;;;;;;;;;;;;;;;GAeG;AACH,wBAAgB,gBAAgB,CAAC,KAAK,CAAC,EAAE,MAAM,GAAG,MAAM,IAAI,
|
|
1
|
+
{"version":3,"file":"dom.d.ts","sourceRoot":"","sources":["../../src/utils/dom.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,QAAQ,CAAC;AAM5C;;;;;;;;GAQG;AACH,wBAAgB,UAAU,CAAC,QAAQ,EAAE,aAAa,GAAG,IAAI,CAMxD;AAED;;;;;;;;;;;;;;;GAeG;AACH,wBAAgB,gBAAgB,CAAC,KAAK,CAAC,EAAE,MAAM,GAAG,MAAM,IAAI,CA8C3D"}
|
package/dist/utils/dom.js
CHANGED
|
@@ -33,10 +33,11 @@ export function applyTheme(resolved) {
|
|
|
33
33
|
* ```
|
|
34
34
|
*/
|
|
35
35
|
export function disableAnimation(nonce) {
|
|
36
|
-
if (typeof globalThis.window === "undefined")
|
|
36
|
+
if (typeof globalThis.window === "undefined") {
|
|
37
37
|
return () => {
|
|
38
38
|
/* noop */
|
|
39
39
|
};
|
|
40
|
+
}
|
|
40
41
|
// Respect user's motion preferences
|
|
41
42
|
const prefersReducedMotion = globalThis.window.matchMedia("(prefers-reduced-motion: reduce)").matches;
|
|
42
43
|
if (prefersReducedMotion) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@codefast/theme",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.13-canary.1",
|
|
4
4
|
"description": "Theme management with React 19 features - optimistic updates, cross-tab sync, and SSR support",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"dark-mode",
|
|
@@ -49,6 +49,14 @@
|
|
|
49
49
|
"types": "./dist/index.d.ts",
|
|
50
50
|
"import": "./dist/index.js"
|
|
51
51
|
},
|
|
52
|
+
"./adapters/tanstack-start/server": {
|
|
53
|
+
"types": "./dist/adapters/tanstack-start/server.d.ts",
|
|
54
|
+
"import": "./dist/adapters/tanstack-start/server.js"
|
|
55
|
+
},
|
|
56
|
+
"./constants": {
|
|
57
|
+
"types": "./dist/constants.d.ts",
|
|
58
|
+
"import": "./dist/constants.js"
|
|
59
|
+
},
|
|
52
60
|
"./core": {
|
|
53
61
|
"types": "./dist/core/index.d.ts",
|
|
54
62
|
"import": "./dist/core/index.js"
|
|
@@ -65,22 +73,6 @@
|
|
|
65
73
|
"types": "./dist/core/use-theme.d.ts",
|
|
66
74
|
"import": "./dist/core/use-theme.js"
|
|
67
75
|
},
|
|
68
|
-
"./utils": {
|
|
69
|
-
"types": "./dist/utils/index.d.ts",
|
|
70
|
-
"import": "./dist/utils/index.js"
|
|
71
|
-
},
|
|
72
|
-
"./utils/dom": {
|
|
73
|
-
"types": "./dist/utils/dom.d.ts",
|
|
74
|
-
"import": "./dist/utils/dom.js"
|
|
75
|
-
},
|
|
76
|
-
"./utils/system": {
|
|
77
|
-
"types": "./dist/utils/system.d.ts",
|
|
78
|
-
"import": "./dist/utils/system.js"
|
|
79
|
-
},
|
|
80
|
-
"./adapters/tanstack-start/server": {
|
|
81
|
-
"types": "./dist/adapters/tanstack-start/server.d.ts",
|
|
82
|
-
"import": "./dist/adapters/tanstack-start/server.js"
|
|
83
|
-
},
|
|
84
76
|
"./script": {
|
|
85
77
|
"types": "./dist/script/index.d.ts",
|
|
86
78
|
"import": "./dist/script/index.js"
|
|
@@ -89,10 +81,6 @@
|
|
|
89
81
|
"types": "./dist/script/theme-script.d.ts",
|
|
90
82
|
"import": "./dist/script/theme-script.js"
|
|
91
83
|
},
|
|
92
|
-
"./constants": {
|
|
93
|
-
"types": "./dist/constants.d.ts",
|
|
94
|
-
"import": "./dist/constants.js"
|
|
95
|
-
},
|
|
96
84
|
"./start": {
|
|
97
85
|
"types": "./dist/start.d.ts",
|
|
98
86
|
"import": "./dist/start.js"
|
|
@@ -101,6 +89,18 @@
|
|
|
101
89
|
"types": "./dist/types.d.ts",
|
|
102
90
|
"import": "./dist/types.js"
|
|
103
91
|
},
|
|
92
|
+
"./utils": {
|
|
93
|
+
"types": "./dist/utils/index.d.ts",
|
|
94
|
+
"import": "./dist/utils/index.js"
|
|
95
|
+
},
|
|
96
|
+
"./utils/dom": {
|
|
97
|
+
"types": "./dist/utils/dom.d.ts",
|
|
98
|
+
"import": "./dist/utils/dom.js"
|
|
99
|
+
},
|
|
100
|
+
"./utils/system": {
|
|
101
|
+
"types": "./dist/utils/system.d.ts",
|
|
102
|
+
"import": "./dist/utils/system.js"
|
|
103
|
+
},
|
|
104
104
|
"./package.json": "./package.json"
|
|
105
105
|
},
|
|
106
106
|
"publishConfig": {
|
|
@@ -123,7 +123,7 @@
|
|
|
123
123
|
"jest": "^30.3.0",
|
|
124
124
|
"jest-environment-jsdom": "^30.3.0",
|
|
125
125
|
"typescript": "^6.0.2",
|
|
126
|
-
"@codefast/typescript-config": "0.3.
|
|
126
|
+
"@codefast/typescript-config": "0.3.13-canary.1"
|
|
127
127
|
},
|
|
128
128
|
"peerDependencies": {
|
|
129
129
|
"@tanstack/react-start": "^1.0",
|