
* Shiki Code block Experimental * refactor * update code * remove console.log * add transformers to namespace * some validations * fix components paths * fix ruff * add a high-level component * fix mapping * fix mapping * python 3.9+ * see if this fixes the tests * fix pyi and annotations * minimal update of theme and language map * add hack for reflex-web/flexdown * unit test file commit * [ENG-3895] [ENG-3896] Update styling for shiki code block * strip transformer triggers * minor refactor * linter * fix pyright * pyi fix * add unit tests * sneaky pyright ignore * the transformer trigger regex should remove the language comment character * minor refactor * fix silly mistake * component mapping in markdown should use the first child for codeblock * use ternary operator in numbers.py, move code block args to class for docs discoverability * precommit * pyright fix * remove id on copy button animation * pyright fix for real * pyi fix * pyi fix fr * check if svg exists * copy event chain * do a concatenation instead of first child * added comment --------- Co-authored-by: Carlos <cutillascarlos@gmail.com>
73 lines
2.0 KiB
Python
73 lines
2.0 KiB
Python
"""Namespace for experimental features."""
|
|
|
|
from types import SimpleNamespace
|
|
|
|
from reflex.components.datadisplay.shiki_code_block import code_block as code_block
|
|
from reflex.components.props import PropsBase
|
|
from reflex.components.radix.themes.components.progress import progress as progress
|
|
from reflex.components.sonner.toast import toast as toast
|
|
|
|
from ..utils.console import warn
|
|
from . import hooks as hooks
|
|
from .assets import asset as asset
|
|
from .client_state import ClientStateVar as ClientStateVar
|
|
from .layout import layout as layout
|
|
from .misc import run_in_thread as run_in_thread
|
|
|
|
warn(
|
|
"`rx._x` contains experimental features and might be removed at any time in the future .",
|
|
)
|
|
|
|
_EMITTED_PROMOTION_WARNINGS = set()
|
|
|
|
|
|
class ExperimentalNamespace(SimpleNamespace):
|
|
"""Namespace for experimental features."""
|
|
|
|
@property
|
|
def toast(self):
|
|
"""Temporary property returning the toast namespace.
|
|
|
|
Remove this property when toast is fully promoted.
|
|
|
|
Returns:
|
|
The toast namespace.
|
|
"""
|
|
self.register_component_warning("toast")
|
|
return toast
|
|
|
|
@property
|
|
def progress(self):
|
|
"""Temporary property returning the toast namespace.
|
|
|
|
Remove this property when toast is fully promoted.
|
|
|
|
Returns:
|
|
The toast namespace.
|
|
"""
|
|
self.register_component_warning("progress")
|
|
return progress
|
|
|
|
@staticmethod
|
|
def register_component_warning(component_name: str):
|
|
"""Add component to emitted warnings and throw a warning if it
|
|
doesn't exist.
|
|
|
|
Args:
|
|
component_name: name of the component.
|
|
"""
|
|
if component_name not in _EMITTED_PROMOTION_WARNINGS:
|
|
_EMITTED_PROMOTION_WARNINGS.add(component_name)
|
|
warn(f"`rx._x.{component_name}` was promoted to `rx.{component_name}`.")
|
|
|
|
|
|
_x = ExperimentalNamespace(
|
|
asset=asset,
|
|
client_state=ClientStateVar.create,
|
|
hooks=hooks,
|
|
layout=layout,
|
|
PropsBase=PropsBase,
|
|
run_in_thread=run_in_thread,
|
|
code_block=code_block,
|
|
)
|