reflex 0.8.4__py3-none-any.whl → 0.8.4a1__py3-none-any.whl
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.
Potentially problematic release.
This version of reflex might be problematic. Click here for more details.
- reflex/.templates/web/utils/react-theme.js +17 -12
- reflex/constants/installer.py +1 -1
- reflex/utils/misc.py +3 -0
- {reflex-0.8.4.dist-info → reflex-0.8.4a1.dist-info}/METADATA +1 -1
- {reflex-0.8.4.dist-info → reflex-0.8.4a1.dist-info}/RECORD +8 -8
- {reflex-0.8.4.dist-info → reflex-0.8.4a1.dist-info}/WHEEL +0 -0
- {reflex-0.8.4.dist-info → reflex-0.8.4a1.dist-info}/entry_points.txt +0 -0
- {reflex-0.8.4.dist-info → reflex-0.8.4a1.dist-info}/licenses/LICENSE +0 -0
|
@@ -18,9 +18,17 @@ const ThemeContext = createContext({
|
|
|
18
18
|
|
|
19
19
|
export function ThemeProvider({ children, defaultTheme = "system" }) {
|
|
20
20
|
const [theme, setTheme] = useState(defaultTheme);
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
)
|
|
21
|
+
|
|
22
|
+
// Detect system preference synchronously during initialization
|
|
23
|
+
const getInitialSystemTheme = () => {
|
|
24
|
+
if (defaultTheme !== "system") return defaultTheme;
|
|
25
|
+
if (typeof window === "undefined") return "light";
|
|
26
|
+
return window.matchMedia("(prefers-color-scheme: dark)").matches
|
|
27
|
+
? "dark"
|
|
28
|
+
: "light";
|
|
29
|
+
};
|
|
30
|
+
|
|
31
|
+
const [systemTheme, setSystemTheme] = useState(getInitialSystemTheme);
|
|
24
32
|
const [isInitialized, setIsInitialized] = useState(false);
|
|
25
33
|
|
|
26
34
|
const firstRender = useRef(true);
|
|
@@ -37,7 +45,6 @@ export function ThemeProvider({ children, defaultTheme = "system" }) {
|
|
|
37
45
|
if (lastCompiledTheme !== defaultColorMode) {
|
|
38
46
|
// on app startup, make sure the application color mode is persisted correctly.
|
|
39
47
|
localStorage.setItem("last_compiled_theme", defaultColorMode);
|
|
40
|
-
setIsInitialized(true);
|
|
41
48
|
return;
|
|
42
49
|
}
|
|
43
50
|
}
|
|
@@ -71,21 +78,19 @@ export function ThemeProvider({ children, defaultTheme = "system" }) {
|
|
|
71
78
|
};
|
|
72
79
|
});
|
|
73
80
|
|
|
74
|
-
// Save theme to localStorage whenever it changes
|
|
75
|
-
// Skip saving only if theme key already exists and we haven't initialized yet
|
|
81
|
+
// Save theme to localStorage whenever it changes (but not on initial mount)
|
|
76
82
|
useEffect(() => {
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
}, [theme]);
|
|
83
|
+
if (isInitialized) {
|
|
84
|
+
localStorage.setItem("theme", theme);
|
|
85
|
+
}
|
|
86
|
+
}, [theme, isInitialized]);
|
|
81
87
|
|
|
82
88
|
useEffect(() => {
|
|
83
|
-
if (!isInitialized) return;
|
|
84
89
|
const root = window.document.documentElement;
|
|
85
90
|
root.classList.remove("light", "dark");
|
|
86
91
|
root.classList.add(resolvedTheme);
|
|
87
92
|
root.style.colorScheme = resolvedTheme;
|
|
88
|
-
}, [resolvedTheme
|
|
93
|
+
}, [resolvedTheme]);
|
|
89
94
|
|
|
90
95
|
return createElement(
|
|
91
96
|
ThemeContext.Provider,
|
reflex/constants/installer.py
CHANGED
|
@@ -143,7 +143,7 @@ class PackageJson(SimpleNamespace):
|
|
|
143
143
|
"postcss-import": "16.1.1",
|
|
144
144
|
"@react-router/dev": _react_router_version,
|
|
145
145
|
"@react-router/fs-routes": _react_router_version,
|
|
146
|
-
"rolldown-vite": "7.0.
|
|
146
|
+
"rolldown-vite": "7.0.9",
|
|
147
147
|
}
|
|
148
148
|
OVERRIDES = {
|
|
149
149
|
# This should always match the `react` version in DEPENDENCIES for recharts compatibility.
|
reflex/utils/misc.py
CHANGED
|
@@ -113,6 +113,8 @@ if (typeof document !== 'undefined') {
|
|
|
113
113
|
const systemPreference = window.matchMedia("(prefers-color-scheme: dark)").matches ? "dark" : "light";
|
|
114
114
|
const resolvedTheme = theme === "system" ? systemPreference : theme;
|
|
115
115
|
|
|
116
|
+
console.log("[PRELOAD] Theme applied:", resolvedTheme, "from theme:", theme, "system:", systemPreference);
|
|
117
|
+
|
|
116
118
|
// Apply theme immediately - blocks until complete
|
|
117
119
|
// Use classList to avoid overwriting other classes
|
|
118
120
|
document.documentElement.classList.remove("light", "dark");
|
|
@@ -122,6 +124,7 @@ if (typeof document !== 'undefined') {
|
|
|
122
124
|
} catch (e) {
|
|
123
125
|
// Fallback to system preference on any error (resolve "system" to actual theme)
|
|
124
126
|
const fallbackTheme = window.matchMedia("(prefers-color-scheme: dark)").matches ? "dark" : "light";
|
|
127
|
+
console.log("[PRELOAD] Error, falling back to:", fallbackTheme);
|
|
125
128
|
document.documentElement.classList.remove("light", "dark");
|
|
126
129
|
document.documentElement.classList.add(fallbackTheme);
|
|
127
130
|
document.documentElement.style.colorScheme = fallbackTheme;
|
|
@@ -51,7 +51,7 @@ reflex/.templates/web/components/reflex/radix_themes_color_mode_provider.js,sha2
|
|
|
51
51
|
reflex/.templates/web/components/shiki/code.js,sha256=4Es1pxsr-lX4hTQ5mglrwwC6O_SI-z-O60k03z8VFzQ,1144
|
|
52
52
|
reflex/.templates/web/styles/__reflex_style_reset.css,sha256=qbC6JIT643YEsvSQ0D7xBmWE5vXy94JGrKNihRuEjnA,8913
|
|
53
53
|
reflex/.templates/web/utils/client_side_routing.js,sha256=lRNgEGCLfTejh8W3aCuBdFuko6UI2vetk64j8wLT5Uk,1650
|
|
54
|
-
reflex/.templates/web/utils/react-theme.js,sha256=
|
|
54
|
+
reflex/.templates/web/utils/react-theme.js,sha256=LRnJCHijMMIjDAy-hs7INgJXXGjbyAUD0qm_kFOP-BU,2800
|
|
55
55
|
reflex/.templates/web/utils/state.js,sha256=Z9NeC1sjePtIg03kvxILng-1ri_PNZFAM_t64K4d5Dg,36162
|
|
56
56
|
reflex/.templates/web/utils/helpers/dataeditor.js,sha256=pG6MgsHuStDR7-qPipzfiK32j9bKDBa-4hZ0JSUo4JM,1623
|
|
57
57
|
reflex/.templates/web/utils/helpers/debounce.js,sha256=xGhtTRtS_xIcaeqnYVvYJNseLgQVk-DW-eFiHJYO9As,528
|
|
@@ -344,7 +344,7 @@ reflex/constants/compiler.py,sha256=VoA1vWZpl-2EdIOhAiOLwSX4S-bFLbkiESlNBmN08NQ,
|
|
|
344
344
|
reflex/constants/config.py,sha256=8OIjiBdZZJrRVHsNBheMwopE9AwBFFzau0SXqXKcrPg,1715
|
|
345
345
|
reflex/constants/custom_components.py,sha256=joJt4CEt1yKy7wsBH6vYo7_QRW0O_fWXrrTf0VY2q14,1317
|
|
346
346
|
reflex/constants/event.py,sha256=tgoynWQi2L0_Kqc3XhXo7XXL76A-OKhJGHRrNjm7gFw,2885
|
|
347
|
-
reflex/constants/installer.py,sha256=
|
|
347
|
+
reflex/constants/installer.py,sha256=VBYFL9BHD0m6cO6RjTQm_PD3JIV63LEl-TtkFJxKkUI,4141
|
|
348
348
|
reflex/constants/route.py,sha256=UBjqaAOxiUxlDZCSY4O2JJChKvA4MZrhUU0E5rNvKbM,2682
|
|
349
349
|
reflex/constants/state.py,sha256=uF_7-M9Gid-P3DjAOq4F1ERplyZhiNccowo_jLrdJrg,323
|
|
350
350
|
reflex/constants/utils.py,sha256=e1ChEvbHfmE_V2UJvCSUhD_qTVAIhEGPpRJSqdSd6PA,780
|
|
@@ -381,7 +381,7 @@ reflex/utils/export.py,sha256=Z2AHuhkxGQzOi9I90BejQ4qEcD0URr2i-ZU5qTJt7eQ,2562
|
|
|
381
381
|
reflex/utils/format.py,sha256=FZe5NA0U3K0n0k7r8RIGcx-eHpN7sf8eQX9w1C8_uR8,21120
|
|
382
382
|
reflex/utils/imports.py,sha256=Ov-lqv-PfsPl3kTEW13r5aDauIfn6TqzEMyv42RKLOA,3761
|
|
383
383
|
reflex/utils/lazy_loader.py,sha256=BiY9OvmAJDCz10qpuyTYv9duXgMFQa6RXKQmTO9hqKU,4453
|
|
384
|
-
reflex/utils/misc.py,sha256=
|
|
384
|
+
reflex/utils/misc.py,sha256=tP_mVuLG38W8-KGwRDm0mJpKjzTYv4oKjPUxkYD5pFU,4781
|
|
385
385
|
reflex/utils/net.py,sha256=GXq5KNmYowT-BP4o9HmEqKthm-N9nj82KH8es3EeTWI,4138
|
|
386
386
|
reflex/utils/path_ops.py,sha256=_RS17IQDNr5vcoLLGZx2-z1E5WP-JgDHvaRAOgqrZiU,8154
|
|
387
387
|
reflex/utils/prerequisites.py,sha256=8S_Yn3n2ojiqwDkpVmTqbxnTY7ILobFSm4f2MjYXtAw,64129
|
|
@@ -401,8 +401,8 @@ reflex/vars/number.py,sha256=tO7pnvFaBsedq1HWT4skytnSqHWMluGEhUbjAUMx8XQ,28190
|
|
|
401
401
|
reflex/vars/object.py,sha256=BDmeiwG8v97s_BnR1Egq3NxOKVjv9TfnREB3cz0zZtk,17322
|
|
402
402
|
reflex/vars/sequence.py,sha256=1kBrqihspyjyQ1XDqFPC8OpVGtZs_EVkOdIKBro5ilA,55249
|
|
403
403
|
scripts/hatch_build.py,sha256=-4pxcLSFmirmujGpQX9UUxjhIC03tQ_fIQwVbHu9kc0,1861
|
|
404
|
-
reflex-0.8.
|
|
405
|
-
reflex-0.8.
|
|
406
|
-
reflex-0.8.
|
|
407
|
-
reflex-0.8.
|
|
408
|
-
reflex-0.8.
|
|
404
|
+
reflex-0.8.4a1.dist-info/METADATA,sha256=wzr6Xa_YGUJDS051hxGUEVoLq1tWxK6CaYPOMcyPIZw,12372
|
|
405
|
+
reflex-0.8.4a1.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
|
|
406
|
+
reflex-0.8.4a1.dist-info/entry_points.txt,sha256=Rxt4dXc7MLBNt5CSHTehVPuSe9Xqow4HLX55nD9tQQ0,45
|
|
407
|
+
reflex-0.8.4a1.dist-info/licenses/LICENSE,sha256=dw3zLrp9f5ObD7kqS32vWfhcImfO52PMmRqvtxq_YEE,11358
|
|
408
|
+
reflex-0.8.4a1.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|