Browse Source

export Color and ImportDict in top-level namespace (#4352)

These are useful for typing purposes and should be exposed at the top level to
avoid requiring deep imports from subpackages that we may need to change later.
Masen Furer 6 months ago
parent
commit
082f9a0bd1
2 changed files with 4 additions and 1 deletions
  1. 2 1
      reflex/__init__.py
  2. 2 0
      reflex/__init__.pyi

+ 2 - 1
reflex/__init__.py

@@ -298,6 +298,7 @@ _MAPPING: dict = {
     "components.moment": ["MomentDelta", "moment"],
     "components.moment": ["MomentDelta", "moment"],
     "config": ["Config", "DBConfig"],
     "config": ["Config", "DBConfig"],
     "constants": ["Env"],
     "constants": ["Env"],
+    "constants.colors": ["Color"],
     "event": [
     "event": [
         "EventChain",
         "EventChain",
         "EventHandler",
         "EventHandler",
@@ -338,7 +339,7 @@ _MAPPING: dict = {
     ],
     ],
     "istate.wrappers": ["get_state"],
     "istate.wrappers": ["get_state"],
     "style": ["Style", "toggle_color_mode"],
     "style": ["Style", "toggle_color_mode"],
-    "utils.imports": ["ImportVar"],
+    "utils.imports": ["ImportDict", "ImportVar"],
     "utils.serializers": ["serializer"],
     "utils.serializers": ["serializer"],
     "vars": ["Var", "field", "Field"],
     "vars": ["Var", "field", "Field"],
 }
 }

+ 2 - 0
reflex/__init__.pyi

@@ -152,6 +152,7 @@ from .components.suneditor import editor as editor
 from .config import Config as Config
 from .config import Config as Config
 from .config import DBConfig as DBConfig
 from .config import DBConfig as DBConfig
 from .constants import Env as Env
 from .constants import Env as Env
+from .constants.colors import Color as Color
 from .event import EventChain as EventChain
 from .event import EventChain as EventChain
 from .event import EventHandler as EventHandler
 from .event import EventHandler as EventHandler
 from .event import background as background
 from .event import background as background
@@ -192,6 +193,7 @@ from .state import dynamic as dynamic
 from .state import var as var
 from .state import var as var
 from .style import Style as Style
 from .style import Style as Style
 from .style import toggle_color_mode as toggle_color_mode
 from .style import toggle_color_mode as toggle_color_mode
+from .utils.imports import ImportDict as ImportDict
 from .utils.imports import ImportVar as ImportVar
 from .utils.imports import ImportVar as ImportVar
 from .utils.serializers import serializer as serializer
 from .utils.serializers import serializer as serializer
 from .vars import Field as Field
 from .vars import Field as Field