reflex 0.7.14a6__py3-none-any.whl → 0.8.0__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/jinja/app/rxconfig.py.jinja2 +4 -1
- reflex/.templates/jinja/web/package.json.jinja2 +1 -1
- reflex/.templates/jinja/web/pages/_app.js.jinja2 +21 -11
- reflex/.templates/jinja/web/pages/_document.js.jinja2 +1 -1
- reflex/.templates/jinja/web/pages/base_page.js.jinja2 +0 -1
- reflex/.templates/jinja/web/pages/stateful_component.js.jinja2 +4 -0
- reflex/.templates/jinja/web/styles/styles.css.jinja2 +1 -0
- reflex/.templates/jinja/web/utils/context.js.jinja2 +25 -8
- reflex/.templates/web/app/entry.client.js +8 -0
- reflex/.templates/web/app/routes.js +10 -0
- reflex/.templates/web/components/reflex/radix_themes_color_mode_provider.js +12 -37
- reflex/.templates/web/postcss.config.js +1 -1
- reflex/.templates/web/react-router.config.js +6 -0
- reflex/.templates/web/styles/__reflex_style_reset.css +399 -0
- reflex/.templates/web/utils/client_side_routing.js +21 -19
- reflex/.templates/web/utils/react-theme.js +92 -0
- reflex/.templates/web/utils/state.js +251 -100
- reflex/.templates/web/vite-plugin-safari-cachebust.js +160 -0
- reflex/.templates/web/vite.config.js +39 -0
- reflex/__init__.py +1 -6
- reflex/__init__.pyi +327 -192
- reflex/app.py +86 -135
- reflex/base.py +1 -87
- reflex/compiler/compiler.py +70 -19
- reflex/compiler/templates.py +3 -3
- reflex/compiler/utils.py +91 -33
- reflex/components/__init__.py +0 -2
- reflex/components/__init__.pyi +34 -18
- reflex/components/base/__init__.py +1 -5
- reflex/components/base/__init__.pyi +30 -21
- reflex/components/base/app_wrap.pyi +7 -7
- reflex/components/base/body.pyi +7 -7
- reflex/components/base/document.py +18 -14
- reflex/components/base/document.pyi +88 -38
- reflex/components/base/error_boundary.pyi +7 -7
- reflex/components/base/fragment.pyi +7 -7
- reflex/components/base/link.pyi +12 -12
- reflex/components/base/meta.py +4 -15
- reflex/components/base/meta.pyi +31 -31
- reflex/components/base/script.py +60 -58
- reflex/components/base/script.pyi +248 -34
- reflex/components/base/strict_mode.pyi +7 -7
- reflex/components/component.py +146 -217
- reflex/components/core/__init__.py +1 -0
- reflex/components/core/__init__.pyi +77 -37
- reflex/components/core/auto_scroll.pyi +7 -7
- reflex/components/core/banner.pyi +33 -33
- reflex/components/core/client_side_routing.py +7 -6
- reflex/components/core/client_side_routing.pyi +8 -59
- reflex/components/core/clipboard.pyi +7 -7
- reflex/components/core/debounce.py +1 -0
- reflex/components/core/debounce.pyi +7 -7
- reflex/components/core/foreach.py +5 -4
- reflex/components/core/helmet.py +14 -0
- reflex/components/{next/base.pyi → core/helmet.pyi} +12 -10
- reflex/components/core/html.pyi +7 -7
- reflex/components/core/match.py +3 -3
- reflex/components/core/sticky.pyi +21 -20
- reflex/components/core/upload.py +4 -2
- reflex/components/core/upload.pyi +26 -25
- reflex/components/datadisplay/__init__.pyi +13 -7
- reflex/components/datadisplay/code.py +14 -79
- reflex/components/datadisplay/code.pyi +11 -13
- reflex/components/datadisplay/dataeditor.pyi +38 -15
- reflex/components/datadisplay/shiki_code_block.py +5 -3
- reflex/components/datadisplay/shiki_code_block.pyi +16 -15
- reflex/components/dynamic.py +5 -5
- reflex/components/el/__init__.pyi +506 -246
- reflex/components/el/element.pyi +7 -7
- reflex/components/el/elements/__init__.pyi +504 -245
- reflex/components/el/elements/base.pyi +7 -7
- reflex/components/el/elements/forms.pyi +146 -101
- reflex/components/el/elements/inline.pyi +142 -142
- reflex/components/el/elements/media.pyi +131 -130
- reflex/components/el/elements/metadata.pyi +32 -32
- reflex/components/el/elements/other.pyi +37 -37
- reflex/components/el/elements/scripts.pyi +17 -17
- reflex/components/el/elements/sectioning.pyi +77 -77
- reflex/components/el/elements/tables.pyi +52 -52
- reflex/components/el/elements/typography.pyi +77 -77
- reflex/components/field.py +175 -0
- reflex/components/gridjs/datatable.py +2 -2
- reflex/components/gridjs/datatable.pyi +14 -14
- reflex/components/lucide/icon.py +6 -2
- reflex/components/lucide/icon.pyi +19 -17
- reflex/components/markdown/markdown.py +5 -3
- reflex/components/markdown/markdown.pyi +7 -7
- reflex/components/moment/moment.py +1 -1
- reflex/components/moment/moment.pyi +7 -7
- reflex/components/plotly/plotly.py +12 -6
- reflex/components/plotly/plotly.pyi +50 -49
- reflex/components/props.py +376 -27
- reflex/components/radix/__init__.pyi +123 -65
- reflex/components/radix/primitives/__init__.pyi +6 -4
- reflex/components/radix/primitives/accordion.py +8 -1
- reflex/components/radix/primitives/accordion.pyi +37 -37
- reflex/components/radix/primitives/base.pyi +12 -12
- reflex/components/radix/primitives/drawer.pyi +56 -55
- reflex/components/radix/primitives/form.pyi +63 -53
- reflex/components/radix/primitives/progress.pyi +26 -25
- reflex/components/radix/primitives/slider.pyi +27 -27
- reflex/components/radix/themes/__init__.pyi +5 -6
- reflex/components/radix/themes/base.py +3 -3
- reflex/components/radix/themes/base.pyi +42 -42
- reflex/components/radix/themes/color_mode.py +5 -6
- reflex/components/radix/themes/color_mode.pyi +17 -17
- reflex/components/radix/themes/components/__init__.pyi +75 -38
- reflex/components/radix/themes/components/alert_dialog.pyi +37 -37
- reflex/components/radix/themes/components/aspect_ratio.pyi +7 -7
- reflex/components/radix/themes/components/avatar.pyi +7 -7
- reflex/components/radix/themes/components/badge.pyi +7 -7
- reflex/components/radix/themes/components/button.pyi +7 -7
- reflex/components/radix/themes/components/callout.pyi +26 -25
- reflex/components/radix/themes/components/card.pyi +7 -7
- reflex/components/radix/themes/components/checkbox.pyi +16 -15
- reflex/components/radix/themes/components/checkbox_cards.pyi +12 -12
- reflex/components/radix/themes/components/checkbox_group.pyi +12 -12
- reflex/components/radix/themes/components/context_menu.pyi +67 -67
- reflex/components/radix/themes/components/data_list.pyi +22 -22
- reflex/components/radix/themes/components/dialog.pyi +36 -35
- reflex/components/radix/themes/components/dropdown_menu.pyi +42 -42
- reflex/components/radix/themes/components/hover_card.pyi +21 -20
- reflex/components/radix/themes/components/icon_button.pyi +7 -7
- reflex/components/radix/themes/components/inset.pyi +7 -7
- reflex/components/radix/themes/components/popover.pyi +22 -22
- reflex/components/radix/themes/components/progress.pyi +7 -7
- reflex/components/radix/themes/components/radio.pyi +7 -7
- reflex/components/radix/themes/components/radio_cards.pyi +12 -12
- reflex/components/radix/themes/components/radio_group.pyi +21 -20
- reflex/components/radix/themes/components/scroll_area.pyi +7 -7
- reflex/components/radix/themes/components/segmented_control.pyi +12 -12
- reflex/components/radix/themes/components/select.pyi +46 -45
- reflex/components/radix/themes/components/separator.pyi +7 -7
- reflex/components/radix/themes/components/skeleton.pyi +7 -7
- reflex/components/radix/themes/components/slider.pyi +17 -9
- reflex/components/radix/themes/components/spinner.pyi +7 -7
- reflex/components/radix/themes/components/switch.pyi +7 -7
- reflex/components/radix/themes/components/table.pyi +37 -37
- reflex/components/radix/themes/components/tabs.pyi +26 -25
- reflex/components/radix/themes/components/text_area.pyi +15 -9
- reflex/components/radix/themes/components/text_field.pyi +32 -19
- reflex/components/radix/themes/components/tooltip.pyi +7 -7
- reflex/components/radix/themes/layout/__init__.pyi +27 -14
- reflex/components/radix/themes/layout/base.pyi +7 -7
- reflex/components/radix/themes/layout/box.pyi +7 -7
- reflex/components/radix/themes/layout/center.pyi +7 -7
- reflex/components/radix/themes/layout/container.pyi +7 -7
- reflex/components/radix/themes/layout/flex.pyi +7 -7
- reflex/components/radix/themes/layout/grid.pyi +7 -7
- reflex/components/radix/themes/layout/list.pyi +26 -25
- reflex/components/radix/themes/layout/section.pyi +7 -7
- reflex/components/radix/themes/layout/spacer.pyi +7 -7
- reflex/components/radix/themes/layout/stack.pyi +17 -17
- reflex/components/radix/themes/typography/__init__.pyi +7 -5
- reflex/components/radix/themes/typography/blockquote.pyi +7 -7
- reflex/components/radix/themes/typography/code.pyi +7 -7
- reflex/components/radix/themes/typography/heading.pyi +7 -7
- reflex/components/radix/themes/typography/link.py +46 -11
- reflex/components/radix/themes/typography/link.pyi +312 -9
- reflex/components/radix/themes/typography/text.pyi +36 -35
- reflex/components/react_player/audio.pyi +10 -8
- reflex/components/react_player/react_player.pyi +7 -7
- reflex/components/react_player/video.pyi +10 -8
- reflex/components/recharts/__init__.pyi +208 -100
- reflex/components/recharts/cartesian.py +10 -8
- reflex/components/recharts/cartesian.pyi +90 -94
- reflex/components/recharts/charts.py +4 -2
- reflex/components/recharts/charts.pyi +49 -49
- reflex/components/recharts/general.pyi +31 -31
- reflex/components/recharts/polar.py +8 -4
- reflex/components/recharts/polar.pyi +23 -23
- reflex/components/recharts/recharts.py +2 -2
- reflex/components/recharts/recharts.pyi +12 -12
- reflex/components/sonner/toast.py +3 -3
- reflex/components/sonner/toast.pyi +9 -9
- reflex/config.py +10 -113
- reflex/constants/__init__.py +2 -2
- reflex/constants/base.py +28 -11
- reflex/constants/compiler.py +12 -3
- reflex/constants/event.py +1 -0
- reflex/constants/installer.py +26 -20
- reflex/constants/route.py +27 -8
- reflex/constants/state.py +2 -0
- reflex/custom_components/custom_components.py +0 -14
- reflex/environment.py +77 -5
- reflex/event.py +178 -81
- reflex/experimental/__init__.py +0 -30
- reflex/istate/__init__.py +69 -0
- reflex/istate/manager.py +1 -0
- reflex/istate/proxy.py +5 -3
- reflex/page.py +0 -27
- reflex/plugins/__init__.py +3 -2
- reflex/plugins/base.py +5 -1
- reflex/plugins/shared_tailwind.py +215 -0
- reflex/plugins/sitemap.py +206 -0
- reflex/plugins/tailwind_v3.py +15 -108
- reflex/plugins/tailwind_v4.py +18 -110
- reflex/reflex.py +1 -0
- reflex/route.py +157 -75
- reflex/state.py +171 -155
- reflex/testing.py +86 -16
- reflex/utils/build.py +38 -82
- reflex/utils/exec.py +83 -175
- reflex/utils/export.py +2 -2
- reflex/utils/format.py +1 -5
- reflex/utils/imports.py +5 -16
- reflex/utils/misc.py +67 -0
- reflex/utils/prerequisites.py +66 -68
- reflex/utils/processes.py +24 -47
- reflex/utils/pyi_generator.py +44 -49
- reflex/utils/serializers.py +14 -1
- reflex/utils/telemetry.py +0 -15
- reflex/utils/types.py +197 -62
- reflex/vars/__init__.py +2 -0
- reflex/vars/base.py +367 -134
- {reflex-0.7.14a6.dist-info → reflex-0.8.0.dist-info}/METADATA +15 -8
- reflex-0.8.0.dist-info/RECORD +403 -0
- reflex/.templates/web/next.config.js +0 -7
- reflex/components/base/head.py +0 -20
- reflex/components/base/head.pyi +0 -116
- reflex/components/next/__init__.py +0 -10
- reflex/components/next/base.py +0 -7
- reflex/components/next/image.py +0 -117
- reflex/components/next/image.pyi +0 -94
- reflex/components/next/link.py +0 -20
- reflex/components/next/link.pyi +0 -67
- reflex/components/next/video.py +0 -38
- reflex/components/next/video.pyi +0 -68
- reflex/components/suneditor/__init__.py +0 -5
- reflex/components/suneditor/editor.py +0 -269
- reflex/components/suneditor/editor.pyi +0 -199
- reflex/experimental/layout.py +0 -254
- reflex/experimental/layout.pyi +0 -814
- reflex-0.7.14a6.dist-info/RECORD +0 -408
- {reflex-0.7.14a6.dist-info → reflex-0.8.0.dist-info}/WHEEL +0 -0
- {reflex-0.7.14a6.dist-info → reflex-0.8.0.dist-info}/entry_points.txt +0 -0
- {reflex-0.7.14a6.dist-info → reflex-0.8.0.dist-info}/licenses/LICENSE +0 -0
|
@@ -2,12 +2,14 @@
|
|
|
2
2
|
{% from "web/pages/macros.js.jinja2" import renderHooks %}
|
|
3
3
|
|
|
4
4
|
{% block early_imports %}
|
|
5
|
-
import '$/styles/__reflex_global_styles.css'
|
|
5
|
+
import reflexGlobalStyles from '$/styles/__reflex_global_styles.css?url';
|
|
6
6
|
{% endblock %}
|
|
7
7
|
|
|
8
8
|
{% block declaration %}
|
|
9
|
-
import { EventLoopProvider, StateProvider, defaultColorMode } from "$/utils/context
|
|
10
|
-
import { ThemeProvider } from '
|
|
9
|
+
import { EventLoopProvider, StateProvider, defaultColorMode } from "$/utils/context";
|
|
10
|
+
import { ThemeProvider } from '$/utils/react-theme';
|
|
11
|
+
import { Layout as AppLayout } from './_document';
|
|
12
|
+
import { Outlet } from 'react-router';
|
|
11
13
|
{% for library_alias, library_path in window_libraries %}
|
|
12
14
|
import * as {{library_alias}} from "{{library_path}}";
|
|
13
15
|
{% endfor %}
|
|
@@ -18,6 +20,10 @@ import * as {{library_alias}} from "{{library_path}}";
|
|
|
18
20
|
{% endblock %}
|
|
19
21
|
|
|
20
22
|
{% block export %}
|
|
23
|
+
export const links = () => [
|
|
24
|
+
{ rel: 'stylesheet', href: reflexGlobalStyles, type: 'text/css' }
|
|
25
|
+
];
|
|
26
|
+
|
|
21
27
|
function AppWrap({children}) {
|
|
22
28
|
{{ renderHooks(hooks) }}
|
|
23
29
|
|
|
@@ -26,8 +32,9 @@ function AppWrap({children}) {
|
|
|
26
32
|
)
|
|
27
33
|
}
|
|
28
34
|
|
|
29
|
-
|
|
30
|
-
|
|
35
|
+
|
|
36
|
+
export function Layout({children}) {
|
|
37
|
+
useEffect(() => {
|
|
31
38
|
// Make contexts and state objects available globally for dynamic eval'd components
|
|
32
39
|
let windowImports = {
|
|
33
40
|
{% for library_alias, library_path in window_libraries %}
|
|
@@ -36,17 +43,20 @@ export default function MyApp({ Component, pageProps }) {
|
|
|
36
43
|
};
|
|
37
44
|
window["__reflex"] = windowImports;
|
|
38
45
|
}, []);
|
|
39
|
-
|
|
40
|
-
|
|
46
|
+
|
|
47
|
+
return jsx(AppLayout, {},
|
|
48
|
+
jsx(ThemeProvider, {defaultTheme: defaultColorMode, attribute: "class"},
|
|
41
49
|
jsx(StateProvider, {},
|
|
42
|
-
jsx(EventLoopProvider, {},
|
|
43
|
-
jsx(AppWrap, {},
|
|
44
|
-
jsx(Component, pageProps)
|
|
45
|
-
)
|
|
50
|
+
jsx(EventLoopProvider, {},
|
|
51
|
+
jsx(AppWrap, {}, children)
|
|
46
52
|
)
|
|
47
53
|
)
|
|
48
54
|
)
|
|
49
55
|
);
|
|
50
56
|
}
|
|
51
57
|
|
|
58
|
+
export default function App() {
|
|
59
|
+
return jsx(Outlet, {});
|
|
60
|
+
}
|
|
61
|
+
|
|
52
62
|
{% endblock %}
|
|
@@ -2,7 +2,11 @@
|
|
|
2
2
|
{% from 'web/pages/macros.js.jinja2' import renderHooksWithMemo %}
|
|
3
3
|
{% set all_hooks = component._get_all_hooks() %}
|
|
4
4
|
|
|
5
|
+
{% if export %}
|
|
5
6
|
export function {{tag_name}} () {
|
|
7
|
+
{% else %}
|
|
8
|
+
function {{tag_name}} () {
|
|
9
|
+
{% endif %}
|
|
6
10
|
{{ renderHooksWithMemo(all_hooks, memo_trigger_hooks) }}
|
|
7
11
|
|
|
8
12
|
return (
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
import { createContext, useContext, useMemo, useReducer, useState, createElement } from "react"
|
|
2
|
-
import { applyDelta, Event, hydrateClientStorage, useEventLoop, refs } from "$/utils/state
|
|
1
|
+
import { createContext, useContext, useMemo, useReducer, useState, createElement, useEffect } from "react"
|
|
2
|
+
import { applyDelta, Event, hydrateClientStorage, useEventLoop, refs } from "$/utils/state"
|
|
3
|
+
import { jsx } from "@emotion/react";
|
|
3
4
|
|
|
4
5
|
{% if initial_state %}
|
|
5
6
|
export const initialState = {{ initial_state|json_dumps }}
|
|
@@ -68,8 +69,6 @@ export const initialEvents = () => []
|
|
|
68
69
|
|
|
69
70
|
export const isDevMode = {{ is_dev_mode|json_dumps }}
|
|
70
71
|
|
|
71
|
-
export const lastCompiledTimeStamp = {{ last_compiled_time|json_dumps }}
|
|
72
|
-
|
|
73
72
|
export function UploadFilesProvider({ children }) {
|
|
74
73
|
const [filesById, setFilesById] = useState({})
|
|
75
74
|
refs["__clear_selected_files"] = (id) => setFilesById(filesById => {
|
|
@@ -77,7 +76,21 @@ export function UploadFilesProvider({ children }) {
|
|
|
77
76
|
delete newFilesById[id]
|
|
78
77
|
return newFilesById
|
|
79
78
|
})
|
|
80
|
-
return createElement(
|
|
79
|
+
return createElement(
|
|
80
|
+
UploadFilesContext.Provider,
|
|
81
|
+
{ value: [filesById, setFilesById] },
|
|
82
|
+
children
|
|
83
|
+
);
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
export function ClientSide(component) {
|
|
87
|
+
return ({ children, ...props }) => {
|
|
88
|
+
const [Component, setComponent] = useState(null);
|
|
89
|
+
useEffect(() => {
|
|
90
|
+
setComponent(component);
|
|
91
|
+
}, []);
|
|
92
|
+
return Component ? jsx(Component, props, children) : null;
|
|
93
|
+
};
|
|
81
94
|
}
|
|
82
95
|
|
|
83
96
|
export function EventLoopProvider({ children }) {
|
|
@@ -87,7 +100,11 @@ export function EventLoopProvider({ children }) {
|
|
|
87
100
|
initialEvents,
|
|
88
101
|
clientStorage,
|
|
89
102
|
)
|
|
90
|
-
return createElement(
|
|
103
|
+
return createElement(
|
|
104
|
+
EventLoopContext.Provider,
|
|
105
|
+
{ value: [addEvents, connectErrors] },
|
|
106
|
+
children
|
|
107
|
+
);
|
|
91
108
|
}
|
|
92
109
|
|
|
93
110
|
export function StateProvider({ children }) {
|
|
@@ -106,7 +123,7 @@ export function StateProvider({ children }) {
|
|
|
106
123
|
{% for state_name in initial_state %}
|
|
107
124
|
createElement(StateContexts.{{state_name|var_name}},{value: {{state_name|var_name}}},
|
|
108
125
|
{% endfor %}
|
|
109
|
-
createElement(DispatchContext
|
|
110
|
-
{% for state_name in initial_state
|
|
126
|
+
createElement(DispatchContext, {value: dispatchers}, children)
|
|
127
|
+
{% for state_name in initial_state %}){% endfor %}
|
|
111
128
|
)
|
|
112
129
|
}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { startTransition } from "react";
|
|
2
|
+
import { hydrateRoot } from "react-dom/client";
|
|
3
|
+
import { HydratedRouter } from "react-router/dom";
|
|
4
|
+
import { createElement } from "react";
|
|
5
|
+
|
|
6
|
+
startTransition(() => {
|
|
7
|
+
hydrateRoot(document, createElement(HydratedRouter));
|
|
8
|
+
});
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { route } from "@react-router/dev/routes";
|
|
2
|
+
import { flatRoutes } from "@react-router/fs-routes";
|
|
3
|
+
|
|
4
|
+
export default [
|
|
5
|
+
route("404", "routes/[404]._index.jsx", { id: "404" }),
|
|
6
|
+
...(await flatRoutes({
|
|
7
|
+
ignoredRouteFiles: ["routes/\\[404\\]._index.jsx"],
|
|
8
|
+
})),
|
|
9
|
+
route("*", "routes/[404]._index.jsx"),
|
|
10
|
+
];
|
|
@@ -1,45 +1,14 @@
|
|
|
1
|
-
import { useTheme } from "
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
ColorModeContext,
|
|
5
|
-
defaultColorMode,
|
|
6
|
-
isDevMode,
|
|
7
|
-
lastCompiledTimeStamp,
|
|
8
|
-
} from "$/utils/context.js";
|
|
1
|
+
import { useTheme } from "$/utils/react-theme";
|
|
2
|
+
import { createElement } from "react";
|
|
3
|
+
import { ColorModeContext, defaultColorMode } from "$/utils/context";
|
|
9
4
|
|
|
10
5
|
export default function RadixThemesColorModeProvider({ children }) {
|
|
11
6
|
const { theme, resolvedTheme, setTheme } = useTheme();
|
|
12
|
-
const [rawColorMode, setRawColorMode] = useState(defaultColorMode);
|
|
13
|
-
const [resolvedColorMode, setResolvedColorMode] = useState(
|
|
14
|
-
defaultColorMode === "dark" ? "dark" : "light",
|
|
15
|
-
);
|
|
16
|
-
const firstUpdate = useRef(true);
|
|
17
|
-
useEffect(() => {
|
|
18
|
-
if (firstUpdate.current) {
|
|
19
|
-
firstUpdate.current = false;
|
|
20
|
-
setRawColorMode(theme);
|
|
21
|
-
setResolvedColorMode(resolvedTheme);
|
|
22
|
-
}
|
|
23
|
-
});
|
|
24
|
-
|
|
25
|
-
useEffect(() => {
|
|
26
|
-
if (isDevMode) {
|
|
27
|
-
const lastCompiledTimeInLocalStorage =
|
|
28
|
-
localStorage.getItem("last_compiled_time");
|
|
29
|
-
if (lastCompiledTimeInLocalStorage !== lastCompiledTimeStamp) {
|
|
30
|
-
// on app startup, make sure the application color mode is persisted correctly.
|
|
31
|
-
setTheme(defaultColorMode);
|
|
32
|
-
localStorage.setItem("last_compiled_time", lastCompiledTimeStamp);
|
|
33
|
-
return;
|
|
34
|
-
}
|
|
35
|
-
}
|
|
36
|
-
setRawColorMode(theme);
|
|
37
|
-
setResolvedColorMode(resolvedTheme);
|
|
38
|
-
}, [theme, resolvedTheme]);
|
|
39
7
|
|
|
40
8
|
const toggleColorMode = () => {
|
|
41
9
|
setTheme(resolvedTheme === "light" ? "dark" : "light");
|
|
42
10
|
};
|
|
11
|
+
|
|
43
12
|
const setColorMode = (mode) => {
|
|
44
13
|
const allowedModes = ["light", "dark", "system"];
|
|
45
14
|
if (!allowedModes.includes(mode)) {
|
|
@@ -50,10 +19,16 @@ export default function RadixThemesColorModeProvider({ children }) {
|
|
|
50
19
|
}
|
|
51
20
|
setTheme(mode);
|
|
52
21
|
};
|
|
22
|
+
|
|
53
23
|
return createElement(
|
|
54
|
-
ColorModeContext,
|
|
24
|
+
ColorModeContext.Provider,
|
|
55
25
|
{
|
|
56
|
-
value: {
|
|
26
|
+
value: {
|
|
27
|
+
rawColorMode: theme,
|
|
28
|
+
resolvedColorMode: resolvedTheme,
|
|
29
|
+
toggleColorMode,
|
|
30
|
+
setColorMode,
|
|
31
|
+
},
|
|
57
32
|
},
|
|
58
33
|
children,
|
|
59
34
|
);
|
|
@@ -0,0 +1,399 @@
|
|
|
1
|
+
@layer __reflex_base {
|
|
2
|
+
/*
|
|
3
|
+
1. Prevent padding and border from affecting element width. (https://github.com/mozdevs/cssremedy/issues/4)
|
|
4
|
+
2. Remove default margins and padding
|
|
5
|
+
3. Reset all borders.
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
*,
|
|
9
|
+
::after,
|
|
10
|
+
::before,
|
|
11
|
+
::backdrop,
|
|
12
|
+
::file-selector-button {
|
|
13
|
+
box-sizing: border-box; /* 1 */
|
|
14
|
+
margin: 0; /* 2 */
|
|
15
|
+
padding: 0; /* 2 */
|
|
16
|
+
border: 0 solid; /* 3 */
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
/*
|
|
20
|
+
1. Use a consistent sensible line-height in all browsers.
|
|
21
|
+
2. Prevent adjustments of font size after orientation changes in iOS.
|
|
22
|
+
3. Use a more readable tab size.
|
|
23
|
+
4. Use the user's configured `sans` font-family by default.
|
|
24
|
+
5. Use the user's configured `sans` font-feature-settings by default.
|
|
25
|
+
6. Use the user's configured `sans` font-variation-settings by default.
|
|
26
|
+
7. Disable tap highlights on iOS.
|
|
27
|
+
*/
|
|
28
|
+
|
|
29
|
+
html,
|
|
30
|
+
:host {
|
|
31
|
+
line-height: 1.5; /* 1 */
|
|
32
|
+
-webkit-text-size-adjust: 100%; /* 2 */
|
|
33
|
+
tab-size: 4; /* 3 */
|
|
34
|
+
font-family: --theme(
|
|
35
|
+
--default-font-family,
|
|
36
|
+
ui-sans-serif,
|
|
37
|
+
system-ui,
|
|
38
|
+
sans-serif,
|
|
39
|
+
"Apple Color Emoji",
|
|
40
|
+
"Segoe UI Emoji",
|
|
41
|
+
"Segoe UI Symbol",
|
|
42
|
+
"Noto Color Emoji"
|
|
43
|
+
); /* 4 */
|
|
44
|
+
font-feature-settings: --theme(
|
|
45
|
+
--default-font-feature-settings,
|
|
46
|
+
normal
|
|
47
|
+
); /* 5 */
|
|
48
|
+
font-variation-settings: --theme(
|
|
49
|
+
--default-font-variation-settings,
|
|
50
|
+
normal
|
|
51
|
+
); /* 6 */
|
|
52
|
+
-webkit-tap-highlight-color: transparent; /* 7 */
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
/*
|
|
56
|
+
1. Add the correct height in Firefox.
|
|
57
|
+
2. Correct the inheritance of border color in Firefox. (https://bugzilla.mozilla.org/show_bug.cgi?id=190655)
|
|
58
|
+
3. Reset the default border style to a 1px solid border.
|
|
59
|
+
*/
|
|
60
|
+
|
|
61
|
+
hr {
|
|
62
|
+
height: 0; /* 1 */
|
|
63
|
+
color: inherit; /* 2 */
|
|
64
|
+
border-top-width: 1px; /* 3 */
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
/*
|
|
68
|
+
Add the correct text decoration in Chrome, Edge, and Safari.
|
|
69
|
+
*/
|
|
70
|
+
|
|
71
|
+
abbr:where([title]) {
|
|
72
|
+
-webkit-text-decoration: underline dotted;
|
|
73
|
+
text-decoration: underline dotted;
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
/*
|
|
77
|
+
Remove the default font size and weight for headings.
|
|
78
|
+
*/
|
|
79
|
+
|
|
80
|
+
h1,
|
|
81
|
+
h2,
|
|
82
|
+
h3,
|
|
83
|
+
h4,
|
|
84
|
+
h5,
|
|
85
|
+
h6 {
|
|
86
|
+
font-size: inherit;
|
|
87
|
+
font-weight: inherit;
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
/*
|
|
91
|
+
Reset links to optimize for opt-in styling instead of opt-out.
|
|
92
|
+
*/
|
|
93
|
+
|
|
94
|
+
a {
|
|
95
|
+
color: inherit;
|
|
96
|
+
-webkit-text-decoration: inherit;
|
|
97
|
+
text-decoration: inherit;
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
/*
|
|
101
|
+
Add the correct font weight in Edge and Safari.
|
|
102
|
+
*/
|
|
103
|
+
|
|
104
|
+
b,
|
|
105
|
+
strong {
|
|
106
|
+
font-weight: bolder;
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
/*
|
|
110
|
+
1. Use the user's configured `mono` font-family by default.
|
|
111
|
+
2. Use the user's configured `mono` font-feature-settings by default.
|
|
112
|
+
3. Use the user's configured `mono` font-variation-settings by default.
|
|
113
|
+
4. Correct the odd `em` font sizing in all browsers.
|
|
114
|
+
*/
|
|
115
|
+
|
|
116
|
+
code,
|
|
117
|
+
kbd,
|
|
118
|
+
samp,
|
|
119
|
+
pre {
|
|
120
|
+
font-family: --theme(
|
|
121
|
+
--default-mono-font-family,
|
|
122
|
+
ui-monospace,
|
|
123
|
+
SFMono-Regular,
|
|
124
|
+
Menlo,
|
|
125
|
+
Monaco,
|
|
126
|
+
Consolas,
|
|
127
|
+
"Liberation Mono",
|
|
128
|
+
"Courier New",
|
|
129
|
+
monospace
|
|
130
|
+
); /* 1 */
|
|
131
|
+
font-feature-settings: --theme(
|
|
132
|
+
--default-mono-font-feature-settings,
|
|
133
|
+
normal
|
|
134
|
+
); /* 2 */
|
|
135
|
+
font-variation-settings: --theme(
|
|
136
|
+
--default-mono-font-variation-settings,
|
|
137
|
+
normal
|
|
138
|
+
); /* 3 */
|
|
139
|
+
font-size: 1em; /* 4 */
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
/*
|
|
143
|
+
Add the correct font size in all browsers.
|
|
144
|
+
*/
|
|
145
|
+
|
|
146
|
+
small {
|
|
147
|
+
font-size: 80%;
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
/*
|
|
151
|
+
Prevent `sub` and `sup` elements from affecting the line height in all browsers.
|
|
152
|
+
*/
|
|
153
|
+
|
|
154
|
+
sub,
|
|
155
|
+
sup {
|
|
156
|
+
font-size: 75%;
|
|
157
|
+
line-height: 0;
|
|
158
|
+
position: relative;
|
|
159
|
+
vertical-align: baseline;
|
|
160
|
+
}
|
|
161
|
+
|
|
162
|
+
sub {
|
|
163
|
+
bottom: -0.25em;
|
|
164
|
+
}
|
|
165
|
+
|
|
166
|
+
sup {
|
|
167
|
+
top: -0.5em;
|
|
168
|
+
}
|
|
169
|
+
|
|
170
|
+
/*
|
|
171
|
+
1. Remove text indentation from table contents in Chrome and Safari. (https://bugs.chromium.org/p/chromium/issues/detail?id=999088, https://bugs.webkit.org/show_bug.cgi?id=201297)
|
|
172
|
+
2. Correct table border color inheritance in all Chrome and Safari. (https://bugs.chromium.org/p/chromium/issues/detail?id=935729, https://bugs.webkit.org/show_bug.cgi?id=195016)
|
|
173
|
+
3. Remove gaps between table borders by default.
|
|
174
|
+
*/
|
|
175
|
+
|
|
176
|
+
table {
|
|
177
|
+
text-indent: 0; /* 1 */
|
|
178
|
+
border-color: inherit; /* 2 */
|
|
179
|
+
border-collapse: collapse; /* 3 */
|
|
180
|
+
}
|
|
181
|
+
|
|
182
|
+
/*
|
|
183
|
+
Use the modern Firefox focus style for all focusable elements.
|
|
184
|
+
*/
|
|
185
|
+
|
|
186
|
+
:-moz-focusring {
|
|
187
|
+
outline: auto;
|
|
188
|
+
}
|
|
189
|
+
|
|
190
|
+
/*
|
|
191
|
+
Add the correct vertical alignment in Chrome and Firefox.
|
|
192
|
+
*/
|
|
193
|
+
|
|
194
|
+
progress {
|
|
195
|
+
vertical-align: baseline;
|
|
196
|
+
}
|
|
197
|
+
|
|
198
|
+
/*
|
|
199
|
+
Add the correct display in Chrome and Safari.
|
|
200
|
+
*/
|
|
201
|
+
|
|
202
|
+
summary {
|
|
203
|
+
display: list-item;
|
|
204
|
+
}
|
|
205
|
+
|
|
206
|
+
/*
|
|
207
|
+
Make lists unstyled by default.
|
|
208
|
+
*/
|
|
209
|
+
|
|
210
|
+
ol,
|
|
211
|
+
ul,
|
|
212
|
+
menu {
|
|
213
|
+
list-style: none;
|
|
214
|
+
}
|
|
215
|
+
|
|
216
|
+
/*
|
|
217
|
+
1. Make replaced elements `display: block` by default. (https://github.com/mozdevs/cssremedy/issues/14)
|
|
218
|
+
2. Add `vertical-align: middle` to align replaced elements more sensibly by default. (https://github.com/jensimmons/cssremedy/issues/14#issuecomment-634934210)
|
|
219
|
+
This can trigger a poorly considered lint error in some tools but is included by design.
|
|
220
|
+
*/
|
|
221
|
+
|
|
222
|
+
img,
|
|
223
|
+
svg,
|
|
224
|
+
video,
|
|
225
|
+
canvas,
|
|
226
|
+
audio,
|
|
227
|
+
iframe,
|
|
228
|
+
embed,
|
|
229
|
+
object {
|
|
230
|
+
display: block; /* 1 */
|
|
231
|
+
vertical-align: middle; /* 2 */
|
|
232
|
+
}
|
|
233
|
+
|
|
234
|
+
/*
|
|
235
|
+
Constrain images and videos to the parent width and preserve their intrinsic aspect ratio. (https://github.com/mozdevs/cssremedy/issues/14)
|
|
236
|
+
*/
|
|
237
|
+
|
|
238
|
+
img,
|
|
239
|
+
video {
|
|
240
|
+
max-width: 100%;
|
|
241
|
+
height: auto;
|
|
242
|
+
}
|
|
243
|
+
|
|
244
|
+
/*
|
|
245
|
+
1. Inherit font styles in all browsers.
|
|
246
|
+
2. Remove border radius in all browsers.
|
|
247
|
+
3. Remove background color in all browsers.
|
|
248
|
+
4. Ensure consistent opacity for disabled states in all browsers.
|
|
249
|
+
*/
|
|
250
|
+
|
|
251
|
+
button,
|
|
252
|
+
input,
|
|
253
|
+
select,
|
|
254
|
+
optgroup,
|
|
255
|
+
textarea,
|
|
256
|
+
::file-selector-button {
|
|
257
|
+
font: inherit; /* 1 */
|
|
258
|
+
font-feature-settings: inherit; /* 1 */
|
|
259
|
+
font-variation-settings: inherit; /* 1 */
|
|
260
|
+
letter-spacing: inherit; /* 1 */
|
|
261
|
+
color: inherit; /* 1 */
|
|
262
|
+
border-radius: 0; /* 2 */
|
|
263
|
+
background-color: transparent; /* 3 */
|
|
264
|
+
opacity: 1; /* 4 */
|
|
265
|
+
}
|
|
266
|
+
|
|
267
|
+
/*
|
|
268
|
+
Restore default font weight.
|
|
269
|
+
*/
|
|
270
|
+
|
|
271
|
+
:where(select:is([multiple], [size])) optgroup {
|
|
272
|
+
font-weight: bolder;
|
|
273
|
+
}
|
|
274
|
+
|
|
275
|
+
/*
|
|
276
|
+
Restore indentation.
|
|
277
|
+
*/
|
|
278
|
+
|
|
279
|
+
:where(select:is([multiple], [size])) optgroup option {
|
|
280
|
+
padding-inline-start: 20px;
|
|
281
|
+
}
|
|
282
|
+
|
|
283
|
+
/*
|
|
284
|
+
Restore space after button.
|
|
285
|
+
*/
|
|
286
|
+
|
|
287
|
+
::file-selector-button {
|
|
288
|
+
margin-inline-end: 4px;
|
|
289
|
+
}
|
|
290
|
+
|
|
291
|
+
/*
|
|
292
|
+
Reset the default placeholder opacity in Firefox. (https://github.com/tailwindlabs/tailwindcss/issues/3300)
|
|
293
|
+
*/
|
|
294
|
+
|
|
295
|
+
::placeholder {
|
|
296
|
+
opacity: 1;
|
|
297
|
+
}
|
|
298
|
+
|
|
299
|
+
/*
|
|
300
|
+
Set the default placeholder color to a semi-transparent version of the current text color in browsers that do not
|
|
301
|
+
crash when using `color-mix(…)` with `currentcolor`. (https://github.com/tailwindlabs/tailwindcss/issues/17194)
|
|
302
|
+
*/
|
|
303
|
+
|
|
304
|
+
@supports (not (-webkit-appearance: -apple-pay-button)) /* Not Safari */ or
|
|
305
|
+
(contain-intrinsic-size: 1px) /* Safari 17+ */ {
|
|
306
|
+
::placeholder {
|
|
307
|
+
color: color-mix(in oklab, currentcolor 50%, transparent);
|
|
308
|
+
}
|
|
309
|
+
}
|
|
310
|
+
|
|
311
|
+
/*
|
|
312
|
+
Prevent resizing textareas horizontally by default.
|
|
313
|
+
*/
|
|
314
|
+
|
|
315
|
+
textarea {
|
|
316
|
+
resize: vertical;
|
|
317
|
+
}
|
|
318
|
+
|
|
319
|
+
/*
|
|
320
|
+
Remove the inner padding in Chrome and Safari on macOS.
|
|
321
|
+
*/
|
|
322
|
+
|
|
323
|
+
::-webkit-search-decoration {
|
|
324
|
+
-webkit-appearance: none;
|
|
325
|
+
}
|
|
326
|
+
|
|
327
|
+
/*
|
|
328
|
+
1. Ensure date/time inputs have the same height when empty in iOS Safari.
|
|
329
|
+
2. Ensure text alignment can be changed on date/time inputs in iOS Safari.
|
|
330
|
+
*/
|
|
331
|
+
|
|
332
|
+
::-webkit-date-and-time-value {
|
|
333
|
+
min-height: 1lh; /* 1 */
|
|
334
|
+
text-align: inherit; /* 2 */
|
|
335
|
+
}
|
|
336
|
+
|
|
337
|
+
/*
|
|
338
|
+
Prevent height from changing on date/time inputs in macOS Safari when the input is set to `display: block`.
|
|
339
|
+
*/
|
|
340
|
+
|
|
341
|
+
::-webkit-datetime-edit {
|
|
342
|
+
display: inline-flex;
|
|
343
|
+
}
|
|
344
|
+
|
|
345
|
+
/*
|
|
346
|
+
Remove excess padding from pseudo-elements in date/time inputs to ensure consistent height across browsers.
|
|
347
|
+
*/
|
|
348
|
+
|
|
349
|
+
::-webkit-datetime-edit-fields-wrapper {
|
|
350
|
+
padding: 0;
|
|
351
|
+
}
|
|
352
|
+
|
|
353
|
+
::-webkit-datetime-edit,
|
|
354
|
+
::-webkit-datetime-edit-year-field,
|
|
355
|
+
::-webkit-datetime-edit-month-field,
|
|
356
|
+
::-webkit-datetime-edit-day-field,
|
|
357
|
+
::-webkit-datetime-edit-hour-field,
|
|
358
|
+
::-webkit-datetime-edit-minute-field,
|
|
359
|
+
::-webkit-datetime-edit-second-field,
|
|
360
|
+
::-webkit-datetime-edit-millisecond-field,
|
|
361
|
+
::-webkit-datetime-edit-meridiem-field {
|
|
362
|
+
padding-block: 0;
|
|
363
|
+
}
|
|
364
|
+
|
|
365
|
+
/*
|
|
366
|
+
Remove the additional `:invalid` styles in Firefox. (https://github.com/mozilla/gecko-dev/blob/2f9eacd9d3d995c937b4251a5557d95d494c9be1/layout/style/res/forms.css#L728-L737)
|
|
367
|
+
*/
|
|
368
|
+
|
|
369
|
+
:-moz-ui-invalid {
|
|
370
|
+
box-shadow: none;
|
|
371
|
+
}
|
|
372
|
+
|
|
373
|
+
/*
|
|
374
|
+
Correct the inability to style the border radius in iOS Safari.
|
|
375
|
+
*/
|
|
376
|
+
|
|
377
|
+
button,
|
|
378
|
+
input:where([type="button"], [type="reset"], [type="submit"]),
|
|
379
|
+
::file-selector-button {
|
|
380
|
+
appearance: button;
|
|
381
|
+
}
|
|
382
|
+
|
|
383
|
+
/*
|
|
384
|
+
Correct the cursor style of increment and decrement buttons in Safari.
|
|
385
|
+
*/
|
|
386
|
+
|
|
387
|
+
::-webkit-inner-spin-button,
|
|
388
|
+
::-webkit-outer-spin-button {
|
|
389
|
+
height: auto;
|
|
390
|
+
}
|
|
391
|
+
|
|
392
|
+
/*
|
|
393
|
+
Make elements with the HTML hidden attribute stay hidden by default.
|
|
394
|
+
*/
|
|
395
|
+
|
|
396
|
+
[hidden]:where(:not([hidden="until-found"])) {
|
|
397
|
+
display: none !important;
|
|
398
|
+
}
|
|
399
|
+
}
|